Split the monolithic gitea/helpers.ts (which had Discord imports and created circular dependencies) into three focused libs: 1. **gitea/** — Pure API client: fetchPR, fetchReviewComments, convertUsername, threadName. No side effects or external deps. 2. **discord/** — Discord client setup: bot login, event listeners, slash commands. Now isolated from Gitea internals. 3. **bridge/** — New integration layer: webhook handler, DB mappings (Gitea PR ↔ Discord thread), Discord helpers, and createPRComment. Dependencies now flow one direction: bridge → gitea and bridge → discord. No circular imports. Added: - Barrel exports (index.ts) for each lib with public API - README.md for each lib documenting the barrel exports - Comprehensive spike README.md with setup guide and architecture explanation - Integration tests for webhooks (callback-based, no race conditions) - Unit tests for pure API functions - CLAUDE.md with links to each lib's README This architecture makes it possible for AI to understand a lib by reading just its README, keeping context focused and small. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
32 lines
783 B
JSON
32 lines
783 B
JSON
{
|
|
"name": "@workshop/spike",
|
|
"module": "src/discord/index.ts",
|
|
"type": "module",
|
|
"private": true,
|
|
"scripts": {
|
|
"bot:cli": "bun run --watch src/cli",
|
|
"bot:discord": "bun run --watch src/discord",
|
|
"authServer": "bun run --watch src/discord/auth.ts",
|
|
"subdomain:start": "bun run src/server.tsx",
|
|
"subdomain:dev": "bun run --hot src/server.tsx",
|
|
"test": "bun test src/gitea/test/"
|
|
},
|
|
"prettier": {
|
|
"printWidth": 110,
|
|
"semi": false
|
|
},
|
|
"dependencies": {
|
|
"@openai/agents": "^0.0.10",
|
|
"@workshop/shared": "workspace:*",
|
|
"discord.js": "^14.19.3",
|
|
"luxon": "catalog:",
|
|
"zod": "catalog:",
|
|
"hono": "catalog:"
|
|
},
|
|
"devDependencies": {
|
|
"@types/bun": "latest"
|
|
},
|
|
"peerDependencies": {
|
|
"typescript": "^5"
|
|
}
|
|
} |