feat(mcpedia): Phase 3 — async indexing (BullMQ), git-sync webhook, revisions, MCP Resources

- packages/queue: ioredis singleton + BullMQ Queue/Worker (prefix mcpedia:
  on shared imrnes Redis :6379); apps/worker runs startWorker()
- @mcpedia/core: indexContentFile/runFullIndex (single indexing entry point
  shared by script/worker/hook) + revision.service (list/get/restore)
- document_revisions table (migration 0002) — snapshots only on body change
- apps/api: POST /hooks/reindex + /hooks/index webhooks; tRPC revisions,
  getRevision, restoreRevision, jobStatus, queueStatus
- apps/mcp: register MCP Resources mcpedia://docs{/,+slug/chunks/revisions}
  ({+slug} RFC6570 reserved expansion for slugs containing /)
- apps/mcp zod pinned to ^4 to match MCP SDK 1.30 compiled types
  (resolves registerTool TS2589/ShapeOutput skew)
- scripts/enqueue.ts one-shot job enqueue helper; indexer refactored to runFullIndex
- PHASES.md/README/.env.example/docs updated
This commit is contained in:
asepharyana
2026-08-19 20:18:28 +07:00
parent 9397303f01
commit 8f2229d447
30 changed files with 1233 additions and 78 deletions
+20
View File
@@ -0,0 +1,20 @@
{
"name": "@mcpedia/worker",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"start": "bun run src/index.ts",
"lint": "tsc --noEmit",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@mcpedia/config": "workspace:*",
"@mcpedia/core": "workspace:*",
"@mcpedia/db": "workspace:*",
"@mcpedia/queue": "workspace:*"
},
"devDependencies": {
"typescript": "^5.6.0"
}
}
+12
View File
@@ -0,0 +1,12 @@
import { startWorker } from "@mcpedia/queue/worker";
// Keep the process alive: the worker listens on the BullMQ queue until a
// SIGINT/SIGTERM closes it (handled inside startWorker).
const worker = await startWorker();
// Heartbeat so the supervisor/operator can see liveness without scraping logs.
const heartbeat = setInterval(() => {
console.log(`[worker] alive, ${worker.name} queue="${worker.name}"`);
}, 30_000);
worker.on("closed", () => clearInterval(heartbeat));
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"paths": {
"@mcpedia/db": ["../../packages/db/src/index.ts"],
"@mcpedia/db/schema": ["../../packages/db/src/schema.ts"],
"@mcpedia/*": ["../../packages/*"]
}
},
"include": ["src/**/*.ts"]
}