trybeacon 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +9 -8
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +6 -0
- package/.next/server/app/_global-error/page.js +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +2 -2
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/board-annotations/[id]/route.js +1 -1
- package/.next/server/app/api/board-annotations/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/board-annotations/route.js +1 -1
- package/.next/server/app/api/board-annotations/route.js.nft.json +1 -1
- package/.next/server/app/api/board-layout/route.js +1 -0
- package/.next/server/app/api/board-layout/route.js.nft.json +1 -0
- package/.next/server/app/api/board-layout/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/bug-flags/[id]/route.js +1 -1
- package/.next/server/app/api/bug-flags/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/bug-flags/route.js +1 -1
- package/.next/server/app/api/bug-flags/route.js.nft.json +1 -1
- package/.next/server/app/api/code-graph/position/route.js +1 -1
- package/.next/server/app/api/code-graph/position/route.js.nft.json +1 -1
- package/.next/server/app/api/code-graph/route.js +1 -1
- package/.next/server/app/api/code-graph/route.js.nft.json +1 -1
- package/.next/server/app/api/context/feature/route.js +1 -1
- package/.next/server/app/api/context/feature/route.js.nft.json +1 -1
- package/.next/server/app/api/context/file/route.js +1 -1
- package/.next/server/app/api/context/file/route.js.nft.json +1 -1
- package/.next/server/app/api/context/route.js +2 -2
- package/.next/server/app/api/context/route.js.nft.json +1 -1
- package/.next/server/app/api/db/arrange/route.js +1 -1
- package/.next/server/app/api/db/arrange/route.js.nft.json +1 -1
- package/.next/server/app/api/db/backfill-access/route.js +1 -1
- package/.next/server/app/api/db/backfill-access/route.js.nft.json +1 -1
- package/.next/server/app/api/db/position/route.js +1 -1
- package/.next/server/app/api/db/position/route.js.nft.json +1 -1
- package/.next/server/app/api/db/reconcile-endpoints/route.js +1 -1
- package/.next/server/app/api/db/reconcile-endpoints/route.js.nft.json +1 -1
- package/.next/server/app/api/db/relations/[id]/route.js +1 -1
- package/.next/server/app/api/db/relations/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/db/tables/[id]/route.js +1 -1
- package/.next/server/app/api/db/tables/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/draft/approve/route.js +1 -5
- package/.next/server/app/api/draft/approve/route.js.nft.json +1 -1
- package/.next/server/app/api/draft/route.js +1 -5
- package/.next/server/app/api/draft/route.js.nft.json +1 -1
- package/.next/server/app/api/draft/status/route.js +1 -1
- package/.next/server/app/api/draft/status/route.js.nft.json +1 -1
- package/.next/server/app/api/edges/[id]/route.js +1 -1
- package/.next/server/app/api/edges/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/edges/route.js +1 -1
- package/.next/server/app/api/edges/route.js.nft.json +1 -1
- package/.next/server/app/api/endpoints/[id]/route.js +1 -1
- package/.next/server/app/api/endpoints/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/entities/route.js +1 -1
- package/.next/server/app/api/entities/route.js.nft.json +1 -1
- package/.next/server/app/api/feedback/[id]/route.js +1 -1
- package/.next/server/app/api/feedback/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/feedback/[id]/vote/route.js +1 -1
- package/.next/server/app/api/feedback/[id]/vote/route.js.nft.json +1 -1
- package/.next/server/app/api/feedback/route.js +1 -1
- package/.next/server/app/api/feedback/route.js.nft.json +1 -1
- package/.next/server/app/api/ingest/route.js +2 -2
- package/.next/server/app/api/ingest/route.js.nft.json +1 -1
- package/.next/server/app/api/init/route.js +2 -2
- package/.next/server/app/api/init/route.js.nft.json +1 -1
- package/.next/server/app/api/map/describe/route.js +2 -2
- package/.next/server/app/api/map/describe/route.js.nft.json +1 -1
- package/.next/server/app/api/map/files/route.js +1 -1
- package/.next/server/app/api/map/files/route.js.nft.json +1 -1
- package/.next/server/app/api/map/finish/route.js +1 -1
- package/.next/server/app/api/map/finish/route.js.nft.json +1 -1
- package/.next/server/app/api/map/route.js +1 -1
- package/.next/server/app/api/map/route.js.nft.json +1 -1
- package/.next/server/app/api/map/start/route.js +1 -1
- package/.next/server/app/api/map/start/route.js.nft.json +1 -1
- package/.next/server/app/api/map/touch-active/route.js +1 -1
- package/.next/server/app/api/map/touch-active/route.js.nft.json +1 -1
- package/.next/server/app/api/nodes/[id]/position/route.js +1 -1
- package/.next/server/app/api/nodes/[id]/position/route.js.nft.json +1 -1
- package/.next/server/app/api/nodes/[id]/route.js +1 -1
- package/.next/server/app/api/nodes/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/nodes/positions/route.js +1 -1
- package/.next/server/app/api/nodes/positions/route.js.nft.json +1 -1
- package/.next/server/app/api/nodes/route.js +1 -1
- package/.next/server/app/api/nodes/route.js.nft.json +1 -1
- package/.next/server/app/api/nodes/subtasks/route.js +1 -1
- package/.next/server/app/api/nodes/subtasks/route.js.nft.json +1 -1
- package/.next/server/app/api/notes/[id]/route.js +1 -1
- package/.next/server/app/api/notes/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/notes/route.js +1 -1
- package/.next/server/app/api/notes/route.js.nft.json +1 -1
- package/.next/server/app/api/open/route.js +1 -1
- package/.next/server/app/api/open/route.js.nft.json +1 -1
- package/.next/server/app/api/plan/annotations/route.js +3 -3
- package/.next/server/app/api/plan/annotations/route.js.nft.json +1 -1
- package/.next/server/app/api/plan/approve/route.js +2 -6
- package/.next/server/app/api/plan/approve/route.js.nft.json +1 -1
- package/.next/server/app/api/plan/history/route.js +1 -1
- package/.next/server/app/api/plan/history/route.js.nft.json +1 -1
- package/.next/server/app/api/plan/markdown/route.js +1 -1
- package/.next/server/app/api/plan/markdown/route.js.nft.json +1 -1
- package/.next/server/app/api/plan/presence/route.js +1 -1
- package/.next/server/app/api/plan/presence/route.js.nft.json +1 -1
- package/.next/server/app/api/plan/route.js +1 -1
- package/.next/server/app/api/plan/route.js.nft.json +1 -1
- package/.next/server/app/api/plan/verdict/route.js +1 -5
- package/.next/server/app/api/plan/verdict/route.js.nft.json +1 -1
- package/.next/server/app/api/preferences/route.js +1 -1
- package/.next/server/app/api/reset/route.js +1 -1
- package/.next/server/app/api/reset/route.js.nft.json +1 -1
- package/.next/server/app/api/stream/route.js +2 -2
- package/.next/server/app/api/stream/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/activate/route.js +1 -1
- package/.next/server/app/api/workspace/activate/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/route.js +1 -1
- package/.next/server/app/api/workspace/route.js.nft.json +1 -1
- package/.next/server/app/apple-icon.png/route.js +1 -1
- package/.next/server/app/docs/page.js +2 -2
- package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +2 -2
- package/.next/server/app/docs.segments/_full.segment.rsc +2 -2
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
- package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/.next/server/app/feedback/page.js +2 -2
- package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
- package/.next/server/app/feedback.html +1 -1
- package/.next/server/app/feedback.rsc +2 -2
- package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
- package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
- package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
- package/.next/server/app/help/page.js +2 -2
- package/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/.next/server/app/help.html +1 -1
- package/.next/server/app/help.rsc +2 -2
- package/.next/server/app/help.segments/_full.segment.rsc +2 -2
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +2 -2
- package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/help.segments/help.segment.rsc +1 -1
- package/.next/server/app/icon.svg/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/map/page.js +2 -2
- package/.next/server/app/map/page.js.nft.json +1 -1
- package/.next/server/app/map/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/plan/page.js +2 -2
- package/.next/server/app/plan/page.js.nft.json +1 -1
- package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js +2 -2
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +9 -8
- package/.next/server/chunks/249.js +1 -1
- package/.next/server/chunks/2809.js +1 -0
- package/.next/server/chunks/2877.js +7 -0
- package/.next/server/chunks/2933.js +2 -15
- package/.next/server/chunks/2981.js +1 -1
- package/.next/server/chunks/319.js +1 -1
- package/.next/server/chunks/3221.js +5 -0
- package/.next/server/chunks/3254.js +1 -1
- package/.next/server/chunks/4198.js +1 -0
- package/.next/server/chunks/4274.js +94 -0
- package/.next/server/chunks/4378.js +1 -0
- package/.next/server/chunks/5258.js +1 -1
- package/.next/server/chunks/5573.js +1 -0
- package/.next/server/chunks/6042.js +1 -0
- package/.next/server/chunks/617.js +1 -0
- package/.next/server/chunks/7373.js +1 -0
- package/.next/server/chunks/9127.js +1 -1
- package/.next/server/chunks/{3349.js → 9213.js} +1 -1
- package/.next/server/chunks/9313.js +14 -0
- package/.next/server/chunks/9683.js +1 -1
- package/.next/server/chunks/9734.js +1 -1
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware.js +2 -2
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/MYvJ_ebinIGa9MP5kWFaY/_buildManifest.js +1 -0
- package/.next/static/chunks/1a258343-7b029f38cf13f847.js +2 -0
- package/.next/static/chunks/6773-89cca3b011769270.js +1 -0
- package/.next/static/chunks/app/_global-error/{page-0fdd2f2bb2631a50.js → page-8fa95c63b95bf9c3.js} +1 -1
- package/.next/static/chunks/app/api/board-annotations/[id]/{route-0fdd2f2bb2631a50.js → route-8fa95c63b95bf9c3.js} +1 -1
- package/.next/static/chunks/app/api/board-annotations/{route-0fdd2f2bb2631a50.js → route-8fa95c63b95bf9c3.js} +1 -1
- package/.next/static/chunks/app/api/{bug-flags/[id]/route-0fdd2f2bb2631a50.js → board-layout/route-8fa95c63b95bf9c3.js} +1 -1
- package/.next/static/chunks/app/api/bug-flags/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/bug-flags/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/code-graph/position/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/code-graph/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/context/feature/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/context/file/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/context/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/db/arrange/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/db/backfill-access/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/db/position/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/db/reconcile-endpoints/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/db/relations/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/db/tables/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/draft/approve/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/draft/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/draft/status/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/edges/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/edges/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/endpoints/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/entities/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/feedback/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/feedback/[id]/vote/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/feedback/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/ingest/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/init/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/map/describe/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/map/files/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/map/finish/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/map/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/map/start/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/map/touch-active/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/nodes/[id]/position/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/nodes/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/nodes/positions/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/nodes/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/nodes/subtasks/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/notes/[id]/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/notes/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/open/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/plan/annotations/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/plan/approve/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/plan/history/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/plan/markdown/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/plan/presence/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/plan/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/plan/verdict/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/preferences/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/reset/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/stream/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/version/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/workspace/activate/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/api/workspace/route-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/app/map/{page-4af30c4813ea051d.js → page-2cac4ffa4e4220c2.js} +1 -1
- package/.next/static/chunks/app/plan/{page-8d555065dd64c94d.js → page-8a9ed9019afac5ca.js} +1 -1
- package/.next/static/chunks/app/settings/{page-d1b0fe0c79c8a745.js → page-4d4879990a4f14fc.js} +1 -1
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8fa95c63b95bf9c3.js +1 -0
- package/.next/static/css/30e69a9d2de6ece7.css +1 -0
- package/.next/trace +37 -37
- package/.next/trace-build +1 -1
- package/.next/types/app/api/board-layout/route.ts +351 -0
- package/.next/types/app/api/plan/route.ts +351 -0
- package/.next/types/routes.d.ts +2 -1
- package/.next/types/validator.ts +9 -0
- package/dist/bin/beacon.js +3 -3
- package/dist/bin/doctor.js +22 -22
- package/dist/bin/hook.js +26 -26
- package/dist/bin/mcp.js +27 -27
- package/dist/bin/plan.js +21 -21
- package/dist/bin/remove.js +8 -0
- package/dist/bin/uninstall.js +25 -25
- package/dist/lib/workspaces.js +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/1130.js +0 -1
- package/.next/server/chunks/1953.js +0 -1
- package/.next/server/chunks/2574.js +0 -94
- package/.next/server/chunks/873.js +0 -1
- package/.next/server/chunks/8815.js +0 -5
- package/.next/static/chunks/1a258343-248e24606fc4ca54.js +0 -2
- package/.next/static/chunks/2548-a99f7f03a36ea356.js +0 -1
- package/.next/static/chunks/app/api/bug-flags/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/code-graph/position/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/code-graph/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/context/feature/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/context/file/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/context/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/db/arrange/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/db/backfill-access/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/db/position/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/db/reconcile-endpoints/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/db/relations/[id]/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/db/tables/[id]/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/draft/approve/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/draft/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/draft/status/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/edges/[id]/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/edges/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/endpoints/[id]/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/entities/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/feedback/[id]/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/feedback/[id]/vote/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/feedback/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/ingest/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/init/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/map/describe/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/map/files/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/map/finish/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/map/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/map/start/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/map/touch-active/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/nodes/[id]/position/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/nodes/[id]/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/nodes/positions/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/nodes/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/nodes/subtasks/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/notes/[id]/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/notes/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/open/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/plan/annotations/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/plan/approve/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/plan/history/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/plan/markdown/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/plan/presence/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/plan/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/plan/verdict/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/preferences/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/reset/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/stream/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/version/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/workspace/activate/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/app/api/workspace/route-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-0fdd2f2bb2631a50.js +0 -1
- package/.next/static/css/75d4c21b97e04260.css +0 -1
- package/.next/static/uz47LXJTPwZFW9gDNmq99/_buildManifest.js +0 -1
- /package/.next/static/{uz47LXJTPwZFW9gDNmq99 → MYvJ_ebinIGa9MP5kWFaY}/_ssgManifest.js +0 -0
package/dist/bin/plan.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var xZ=Object.defineProperty;var GZ=(Q)=>Q;function KZ(Q,Z){this[Q]=GZ.bind(null,Z)}var
|
|
3
|
+
var xZ=Object.defineProperty;var GZ=(Q)=>Q;function KZ(Q,Z){this[Q]=GZ.bind(null,Z)}var $Q=(Q,Z)=>{for(var $ in Z)xZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:KZ.bind(Z,$)})};var T=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var zQ={};$Q(zQ,{removeRepoAssets:()=>uZ,installRefreshSkill:()=>vZ,installPlanSkill:()=>CZ,installInitSkill:()=>NZ,installCodexRepoSkills:()=>TZ,ensureWorkflowDoc:()=>gZ,ensureMcp:()=>wZ,auditRepo:()=>FZ,REFRESH_SKILL:()=>JQ,PLAN_SKILL:()=>bQ,INIT_SKILL:()=>YQ});import{existsSync as v,mkdirSync as D,readFileSync as P,rmSync as b,writeFileSync as H}from"fs";import{join as W}from"path";function NZ(Q){let Z=W(Q,".claude","skills","beacon-init");D(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,YQ),$}function vZ(Q){let Z=W(Q,".claude","skills","beacon-refresh");D(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,JQ),$}function CZ(Q){let Z=W(Q,".claude","skills","beacon-plan");D(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,bQ),$}function TZ(Q){let Z=[];for(let $ of MZ){let Y=W(Q,".agents","skills",$.name);D(Y,{recursive:!0});let J=W(Y,"SKILL.md");H(J,$.body()),Z.push(J)}return Z}function gZ(Q){let Z=W(Q,"AGENTS.md"),$="";try{$=P(Z,"utf8")}catch{}let Y=new RegExp(`${I}[\\s\\S]*?${VQ}`);$=Y.test($)?$.replace(Y,fQ):`${$.trim()}
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${fQ}
|
|
6
6
|
`.trimStart(),H(Z,$.endsWith(`
|
|
7
7
|
`)?$:`${$}
|
|
8
8
|
`);let J=W(Q,"CLAUDE.md"),V="";try{V=P(J,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))H(J,`${V?`${V.trim()}
|
|
9
9
|
|
|
10
10
|
`:""}@AGENTS.md
|
|
11
11
|
`)}function wZ(Q){let Z=W(Q,".mcp.json"),$={};try{$=JSON.parse(P(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},H(Z,JSON.stringify($,null,2)+`
|
|
12
|
-
`),{path:Z,added:!0}}function FZ(Q){let Z=W(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(P(Z,"utf8")).mcpServers?.beacon}catch{}let Y=!1;try{Y=P(W(Q,"AGENTS.md"),"utf8").includes(I)}catch{}let J=!1;try{J=/@AGENTS\.md/.test(P(W(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:Y,claudeMdImport:J,skills:{"beacon-init":
|
|
13
|
-
`)}}catch{}let J=!1,V=W(Q,"AGENTS.md");try{let z=P(V,"utf8"),U=new RegExp(`\\n?${I}[\\s\\S]*?${
|
|
12
|
+
`),{path:Z,added:!0}}function FZ(Q){let Z=W(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(P(Z,"utf8")).mcpServers?.beacon}catch{}let Y=!1;try{Y=P(W(Q,"AGENTS.md"),"utf8").includes(I)}catch{}let J=!1;try{J=/@AGENTS\.md/.test(P(W(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:Y,claudeMdImport:J,skills:{"beacon-init":v(W(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v(W(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v(W(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v(W(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function uZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=W(Q,".claude","skills",z);if(v(U))b(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=W(Q,".agents","skills",z);if(v(U))b(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,Y=W(Q,".mcp.json");try{let z=JSON.parse(P(Y,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)b(Y,{force:!0});else H(Y,JSON.stringify(z,null,2)+`
|
|
13
|
+
`)}}catch{}let J=!1,V=W(Q,"AGENTS.md");try{let z=P(V,"utf8"),U=new RegExp(`\\n?${I}[\\s\\S]*?${VQ}\\n?`);if(U.test(z)){let M=z.replace(U,`
|
|
14
14
|
`).replace(/\n{3,}/g,`
|
|
15
15
|
|
|
16
16
|
`).trimStart();H(V,M.endsWith(`
|
|
17
17
|
`)?M:`${M}
|
|
18
|
-
`),J=!0}}catch{}let X=!1,q=W(Q,"CLAUDE.md");try{let z=P(q,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())b(q,{force:!0});else H(q,U);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:J,claudeImportRemoved:X}}var
|
|
18
|
+
`),J=!0}}catch{}let X=!1,q=W(Q,"CLAUDE.md");try{let z=P(q,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())b(q,{force:!0});else H(q,U);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:J,claudeImportRemoved:X}}var YQ=`---
|
|
19
19
|
name: beacon-init
|
|
20
20
|
description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
|
|
21
21
|
---
|
|
@@ -52,7 +52,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
52
52
|
If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
|
|
53
53
|
|
|
54
54
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
55
|
-
`,
|
|
55
|
+
`,JQ=`---
|
|
56
56
|
name: beacon-refresh
|
|
57
57
|
description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
|
|
58
58
|
---
|
|
@@ -99,7 +99,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
99
99
|
If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
|
|
100
100
|
|
|
101
101
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
102
|
-
`,
|
|
102
|
+
`,bQ=`---
|
|
103
103
|
name: beacon-plan
|
|
104
104
|
description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
|
|
105
105
|
---
|
|
@@ -141,7 +141,7 @@ If it returns feedback, revise and call it again.
|
|
|
141
141
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
142
142
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
143
143
|
run \`beacon\` in this repo once.
|
|
144
|
-
`,MZ,I="<!-- beacon:workflow:start -->",
|
|
144
|
+
`,MZ,I="<!-- beacon:workflow:start -->",VQ="<!-- beacon:workflow:end -->",fQ;var qQ=T(()=>{MZ=[{name:"beacon-init",body:()=>YQ},{name:"beacon-refresh",body:()=>JQ}];fQ=`${I}
|
|
145
145
|
## Beacon \u2014 feature workflow
|
|
146
146
|
|
|
147
147
|
This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
|
|
@@ -197,18 +197,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
197
197
|
If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
|
|
198
198
|
|
|
199
199
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
200
|
-
${
|
|
201
|
-
`)}function k(Q,Z){let $=
|
|
200
|
+
${VQ}`});import{existsSync as DQ,mkdirSync as XQ,readFileSync as E,rmSync as RZ,writeFileSync as O}from"fs";import{dirname as IQ,join as A}from"path";function WQ(Q){try{return JSON.parse(E(Q,"utf8"))}catch{return{}}}function AQ(Q,Z){XQ(IQ(Q),{recursive:!0}),O(Q,JSON.stringify(Z,null,2)+`
|
|
201
|
+
`)}function k(Q,Z){let $=WQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let Y=$.hooks[Z.event];if(Y.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((X)=>X.command===Z.command)))return!1;return Y.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),AQ(Q,$),!0}function L(Q,Z){return(WQ(Q).hooks?.[Z.event]??[]).some((J)=>J.hooks?.some((V)=>V.command===Z.command))}function _(Q,Z){let $=WQ(Q),Y=$.hooks?.[Z.event];if(!Y)return!1;let J=!1,V=Y.map((X)=>{let q=X.hooks?.length??0,z=(X.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==q)J=!0;return{...X,hooks:z}}).filter((X)=>(X.hooks??[]).length>0);if(!J)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return AQ(Q,$),!0}function h(Q,Z,$,Y){let J=`${Z}
|
|
202
202
|
${Y.trim()}
|
|
203
203
|
${$}`,V="";try{V=E(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,J):V.trim()?`${V.trim()}
|
|
204
204
|
|
|
205
205
|
${J}
|
|
206
206
|
`:`${J}
|
|
207
|
-
`,
|
|
207
|
+
`,XQ(IQ(Q),{recursive:!0}),O(Q,V.endsWith(`
|
|
208
208
|
`)?V:`${V}
|
|
209
209
|
`)}function g(Q,Z){try{return E(Q,"utf8").includes(Z)}catch{return!1}}function S(Q,Z,$){let Y="";try{Y=E(Q,"utf8")}catch{return!1}let J=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!J.test(Y))return!1;let V=Y.replace(J,"").replace(/\n{3,}/g,`
|
|
210
210
|
|
|
211
|
-
`).trimStart();return O(Q,V),!0}function m(Q,Z,$){let Y=A(Q,Z);
|
|
211
|
+
`).trimStart();return O(Q,V),!0}function m(Q,Z,$){let Y=A(Q,Z);XQ(Y,{recursive:!0});let J=A(Y,"SKILL.md");return O(J,$),J}function w(Q,Z){return DQ(A(Q,Z,"SKILL.md"))}function p(Q,Z){let $=A(Q,Z);if(!DQ($))return!1;return RZ($,{recursive:!0,force:!0}),!0}var j,y=`## Beacon (visual planning panel)
|
|
212
212
|
|
|
213
213
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
214
214
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -229,24 +229,24 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
229
229
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
230
230
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
231
231
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
232
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
232
|
+
verbatim. Do NOT implement until the tool returns approval.`;var UQ=T(()=>{j=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as fZ,renameSync as bZ,rmSync as DZ,writeFileSync as IZ}from"fs";import{dirname as AZ}from"path";function BQ(Q,Z){fZ(AZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{IZ($,Z),bZ($,Q)}catch(Y){throw DZ($,{force:!0}),Y}}var EQ=()=>{};var mQ={};$Q(mQ,{setupCodexAssets:()=>kZ,removeCodexMcp:()=>SQ,removeCodexArtifacts:()=>_Z,hasCodexMcp:()=>xQ,ensureCodexMcp:()=>hQ,codexMcpProblem:()=>yZ,codexDetected:()=>kQ,auditCodex:()=>LZ,CODEX_HOOKS:()=>n});import{readFileSync as a}from"fs";import{homedir as EZ}from"os";import{join as R}from"path";function OQ(){return process.env.HOME||process.env.USERPROFILE||EZ()}function kQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(HQ===void 0)HQ=Bun.which("codex")!==null;return HQ}function u(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function xQ(){try{return Boolean(u(a(C(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function yZ(){let Q="";try{Q=a(C(),"utf8")}catch{return null}let Z=u(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${F}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${F}`;return null}function hQ(){let Q="",Z=!1;try{Q=a(C(),"utf8"),Z=!0}catch{}if(Z){let V=u(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${F}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${F}`}}let $=!Q?"":Q.endsWith(`
|
|
233
233
|
`)?`
|
|
234
234
|
`:`
|
|
235
235
|
|
|
236
|
-
`,Y=Q+$+OZ;if(u(Y)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${F}`};return
|
|
237
|
-
`),$=Z.indexOf(
|
|
236
|
+
`,Y=Q+$+OZ;if(u(Y)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${F}`};return BQ(C(),Y),{added:!0}}function SQ(){let Q="";try{Q=a(C(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
237
|
+
`),$=Z.indexOf(LQ);if($===-1)return{removed:!1,skipped:xQ()};let Y=Z.indexOf(_Q,$);if(Y===-1)return{removed:!1,skipped:!0};Z.splice($,Y-$+1);let J=Z.join(`
|
|
238
238
|
`).replace(/\n{3,}/g,`
|
|
239
239
|
|
|
240
|
-
`).replace(/^\n+/,"");if(u(J)===null)return{removed:!1,skipped:!0};return
|
|
240
|
+
`).replace(/^\n+/,"");if(u(J)===null)return{removed:!1,skipped:!0};return BQ(C(),J),{removed:!0}}async function kZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (qQ(),zQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let z of j){if(!w(l(),z))J.push(z);m(l(),z,Y[z])}let V=0;for(let z of n)if(k(jQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=g(c(),d);h(c(),d,yQ,y);let q=hQ();return{skillsAdded:J,hooksAdded:V,agentsMdBlockTouched:!X,mcp:q}}function LZ(){let Q={};for(let $ of j)Q[$]=w(l(),$);let Z={};for(let $ of n)Z[$.event]=L(jQ(),{event:$.event,command:$.command});return{detected:kQ(),skills:Q,hooks:Z,agentsMdBlock:g(c(),d),mcp:xQ()}}function _Z(){let Q=[];for(let J of j)if(p(l(),J))Q.push(J);let Z=0;for(let J of n)if(_(jQ(),{event:J.event,command:J.command}))Z++;let $=S(c(),d,yQ),Y=SQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var PQ=()=>R(OQ(),".codex"),jQ=()=>R(PQ(),"hooks.json"),C=()=>R(PQ(),"config.toml"),c=()=>R(PQ(),"AGENTS.md"),l=()=>R(OQ(),".agents","skills"),d="<!-- beacon:global:start -->",yQ="<!-- beacon:global:end -->",n,HQ,LQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",_Q="# beacon:end",OZ,F="add it manually: codex mcp add beacon -- beacon mcp";var pQ=T(()=>{UQ();EQ();n=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];OZ=`${LQ}
|
|
241
241
|
[mcp_servers.beacon]
|
|
242
242
|
command = "beacon"
|
|
243
243
|
args = ["mcp"]
|
|
244
|
-
${
|
|
245
|
-
`});var
|
|
244
|
+
${_Q}
|
|
245
|
+
`});var tQ={};$Q(tQ,{provisionDb:()=>X0});import{createClient as oZ}from"@libsql/client";import{drizzle as iZ}from"drizzle-orm/libsql";import{migrate as eZ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as Q0}from"drizzle-orm/migrator";import{dirname as MQ,join as Z0}from"path";import{fileURLToPath as $0}from"url";async function r(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function z0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((Y)=>String(Y.name)))}async function nQ(Q){if(!await r(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function q0(Q){for(let[Z,$]of Object.entries(V0)){if(!await r(Q,Z))continue;let Y=await z0(Q,Z);for(let J of $){if(!Y.has(J))continue;await Q.execute(`UPDATE "${Z}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function X0(Q,Z=J0){let $=oZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;");let Y=await r($,"__drizzle_migrations"),J=await r($,"Node"),V=!1;if(J&&!Y){let q=Q0({migrationsFolder:Z})[0];if(q)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[q.hash,q.folderMillis]}),V=!0}let X=await nQ($);if(await eZ(iZ($),{migrationsFolder:Z}),await nQ($)>X)V=!0;return await q0($),{migrated:V}}finally{$.close()}}var Y0,J0,V0;var sQ=T(async()=>{Y0=MQ(MQ(MQ($0(import.meta.url)))),J0=process.env.BEACON_MIGRATIONS_DIR||Z0(Y0,"drizzle"),V0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});UQ();import{existsSync as hZ}from"fs";import{homedir as SZ}from"os";import{join as t}from"path";function mZ(){return process.env.HOME||process.env.USERPROFILE||SZ()}var s=()=>t(mZ(),".claude"),GQ=()=>t(s(),"skills"),KQ=()=>t(s(),"settings.json"),NQ=()=>t(s(),"CLAUDE.md"),vQ="<!-- beacon:global:start -->",cQ="<!-- beacon:global:end -->";var pZ=y,CQ=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function cZ(Q,Z){return m(GQ(),Q,Z)}function lQ(Q){return w(GQ(),Q)}function lZ(Q){return p(GQ(),Q)}function dZ(Q){return k(KQ(),Q)}function aZ(Q){return L(KQ(),Q)}function nZ(Q){return _(KQ(),Q)}function tZ(Q){h(NQ(),vQ,cQ,Q)}function dQ(){return g(NQ(),vQ)}function sZ(){return S(NQ(),vQ,cQ)}function X1(){let Q={};for(let $ of j)Q[$]=lQ($);let Z={};for(let $ of CQ)Z[$.event]=aZ({event:$.event,command:$.command});return{homeExists:hZ(s()),skills:Q,hooks:Z,claudeMdBlock:dQ()}}async function rZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (qQ(),zQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let q of j){if(!lQ(q))J.push(q);cZ(q,Y[q])}let V=0;for(let q of CQ)if(dZ({event:q.event,matcher:q.matcher,command:q.command}))V++;let X=dQ();return tZ(pZ),{skillsAdded:J,hooksAdded:V,claudeMdBlockTouched:!X}}async function aQ(){let Q;try{Q={ok:!0,...await rZ()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (pQ(),mQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function W1(){let Q=[];for(let Y of j)if(lZ(Y))Q.push(Y);let Z=0;for(let Y of CQ)if(nZ(Y))Z++;let $=sZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as W0}from"async_hooks";import{spawnSync as U0}from"child_process";import{createHash as B0}from"crypto";import{existsSync as rQ,mkdirSync as o,readFileSync as oQ,writeFileSync as iQ}from"fs";import{homedir as H0}from"os";import{basename as P0,join as G}from"path";function K(){return process.env.BEACON_HOME||G(H0(),".beacon")}function gQ(){return G(K(),"workspaces.json")}function eQ(Q){return B0("sha256").update(Q).digest("hex").slice(0,12)}function g1(Q=process.cwd()){let Z=U0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function i(Q){return G(K(),Q)}function j0(Q){return`file:${G(i(Q),"db.sqlite")}`}function f(){try{let Q=JSON.parse(oQ(gQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function wQ(Q){o(K(),{recursive:!0}),iQ(gQ(),JSON.stringify(Q,null,2))}function x0(){return f().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function x(Q){return f().find((Z)=>Z.id===Q)??null}function G0(Q,Z,$=new Date().toISOString()){let Y=eQ(Q),J=f(),V=J.find((z)=>z.id===Y),X={id:Y,path:Q,name:Z||V?.name||P0(Q),lastOpenedAt:$},q=[X,...J.filter((z)=>z.id!==Y)];return o(i(Y),{recursive:!0}),wQ(q),X}function w1(Q,Z=new Date().toISOString()){let $=f(),Y=$.find((J)=>J.id===Q);if(!Y)return;Y.lastOpenedAt=Z,wQ($)}function F1(Q){if(wQ(f().filter((Z)=>Z.id!==Q)),FQ()===Q)K0(x0()[0]?.id??null)}function QZ(){return G(K(),"active")}function FQ(){try{return oQ(QZ(),"utf8").trim()||null}catch{return null}}function K0(Q){o(K(),{recursive:!0}),iQ(QZ(),Q??"")}function u1(){let Q=FQ();return Q?x(Q):null}function R1(){let Q=v0()??FQ();return Q?x(Q):null}function f1(Q){return x(Q)?.path??null}function b1(){return rQ(gQ())}var ZZ="beacon_ws";function $Z(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let Y of $.split(";")){let J=Y.indexOf("=");if(J===-1)continue;if(Y.slice(0,J).trim()===Z)return decodeURIComponent(Y.slice(J+1).trim())}return null}function D1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&x(Z))return Z;let $=$Z(Q,ZZ);if($&&x($))return $;return null}var N0="x-beacon-workspace-path";async function I1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&x(Z))return Z;let $=Q.headers.get(N0);if($&&(!Z||eQ($)===Z)){let J=G0($);return await C0(J.id),J.id}let Y=$Z(Q,ZZ);if(Y&&x(Y))return Y;return null}var YZ=new W0;function A1(Q,Z){return Q?YZ.run(Q,Z):Z()}function v0(){return YZ.getStore()??null}var TQ=new Set;function E1(Q){TQ.delete(G(i(Q),"db.sqlite"))}async function C0(Q){let Z=i(Q),$=G(Z,"db.sqlite"),Y=rQ($);if(Y&&TQ.has($))return{ok:!0,created:!1,migrated:!1};try{o(Z,{recursive:!0});let{provisionDb:J}=await sQ().then(() => tQ),V=await J(j0(Q));return TQ.add($),{ok:!0,created:!Y,migrated:Y&&V.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}import{execSync as HZ,spawn as F0}from"child_process";import{mkdirSync as u0,openSync as R0,readFileSync as f0,writeFileSync as b0}from"fs";import{homedir as D0,platform as UZ}from"os";import{dirname as I0,join as QQ}from"path";import{fileURLToPath as A0}from"url";import{createHash as E0}from"crypto";var JZ=1500,VZ=345600000,y1=1800000,k1=3000;import{mkdirSync as S1,readFileSync as T0,writeFileSync as m1}from"fs";import{join as g0}from"path";var M0=["default","acceptEdits","bypassPermissions","auto"];function zZ(Q){return typeof Q==="string"&&M0.includes(Q)}function qZ(Q,Z){let $={behavior:"allow"};if(Q)$.updatedPermissions=[{type:"setMode",mode:Q,destination:"session"}];let Y={hookEventName:"PermissionRequest",decision:$};if(Z?.trim())Y.additionalContext=Z;return{hookSpecificOutput:Y}}function w0(){return g0(K(),"preferences.json")}function XZ(){try{let Q=JSON.parse(T0(w0(),"utf8"));return{planApprovalMode:zZ(Q.planApprovalMode)?Q.planApprovalMode:void 0,planApprovalModeConfigured:Q.planApprovalModeConfigured===!0}}catch{return{}}}function WZ(Q){if(!Q?.length)return"";let Z=Q.map((Y)=>Y.id?` \u2022 ${Y.title} \u2014 id: ${Y.id}`:` \u2022 ${Y.title}`),$=Q.some((Y)=>Y.id);return`
|
|
246
246
|
|
|
247
247
|
This plan created these roadmap feature(s):
|
|
248
248
|
`+Z.join(`
|
|
249
|
-
`)+"\n\nWhen the work ships, register them in ONE call: `beacon_describe_feature` with a "+"`features` array \u2014 one entry per feature"+($?", each keyed by the `id` above (no title-matching needed)":"")+", each with the files you touched + a short markdown summary. Do them all in that single "+"batched call so every feature flips to Done \u2014 do NOT register only the umbrella, and do "+"NOT make one call per feature."}var O0=
|
|
250
|
-
`,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",q=await fetch(`${Y}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":V},body:JSON.stringify({description:X,markdown:Z})});if(q.status===422){let B=await q.json().catch(()=>({}));
|
|
249
|
+
`)+"\n\nWhen the work ships, register them in ONE call: `beacon_describe_feature` with a "+"`features` array \u2014 one entry per feature"+($?", each keyed by the `id` above (no title-matching needed)":"")+", each with the files you touched + a short markdown summary. Do them all in that single "+"batched call so every feature flips to Done \u2014 do NOT register only the umbrella, and do "+"NOT make one call per feature."}var O0=QQ(I0(A0(import.meta.url)),".."),RQ=process.env.BEACON_HOME||QQ(D0(),".beacon"),PZ=QQ(RQ,"server.json"),BZ=process.env.PORT||"4319";function y0(Q){try{return process.kill(Q,0),!0}catch{return!1}}function k0(Q){try{return JSON.parse(f0(Q,"utf8"))}catch{return null}}async function jZ(Q){try{return(await fetch(Q)).ok}catch{return!1}}async function L0(Q,Z=60){for(let $=0;$<Z;$++){if(await jZ(Q))return!0;await new Promise((Y)=>setTimeout(Y,500))}return!1}function _0(){u0(RQ,{recursive:!0});let Q=R0(QQ(RQ,"server.log"),"a"),Z={...process.env,PORT:BZ,BEACON_NO_OPEN:"1"};delete Z.BEACON_REPO,delete Z.BEACON_DATA_DIR,delete Z.DATABASE_URL;let $=F0("bun",["run","dev"],{cwd:O0,env:Z,detached:!0,stdio:["ignore",Q,Q]});$.unref();let Y={pid:$.pid??0,port:BZ};return b0(PZ,JSON.stringify(Y)),Y}async function h0(){let Q=k0(PZ);if(Q&&y0(Q.pid)&&await jZ(`http://localhost:${Q.port}/api/workspace`))return Q.port;let{port:Z}=_0();return await L0(`http://localhost:${Z}/api/workspace`),Z}function S0(Q){if(process.env.BEACON_NO_OPEN)return;let Z=UZ()==="darwin"?"open":UZ()==="win32"?"start":"xdg-open";try{HZ(`${Z} "${Q}"`,{stdio:"ignore"})}catch{}}function m0(){try{return HZ("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function p0(Q){return E0("sha256").update(Q).digest("hex").slice(0,12)}async function c0(){if(process.stdin.isTTY)return null;let Q=[];for await(let $ of process.stdin)Q.push($);let Z=Buffer.concat(Q).toString("utf8").trim();if(!Z)return null;try{return JSON.parse(Z)}catch{return null}}function uQ(Q,Z){return qZ(Q,Z)}function e(Q){return{hookSpecificOutput:{hookEventName:"PermissionRequest",decision:{behavior:"deny",message:Q}}}}function N(Q){process.stdout.write(JSON.stringify(Q)),process.exit(0)}(async()=>{await aQ();let Z=(await c0())?.tool_input?.plan;if(!Z||!Z.trim())N(uQ());let Y=`http://localhost:${await h0()}`,J=m0()||process.cwd(),V=p0(J);await fetch(`${Y}/api/workspace/activate?id=${V}`).catch(()=>{});let X=Z.split(`
|
|
250
|
+
`,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",q=await fetch(`${Y}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":V},body:JSON.stringify({description:X,markdown:Z})});if(q.status===422){let B=await q.json().catch(()=>({}));N(e(B.error??"Beacon rejected the plan: every roadmap feature needs a category and a priority. Add them and re-present."))}if(!q.ok)N(uQ());if(!await fetch(`${Y}/api/plan/presence`,{headers:{"x-beacon-workspace":V}}).then((B)=>B.json()).then((B)=>!!B?.live).catch(()=>!1)){let B=encodeURIComponent(`/plan?ws=${V}`);S0(`${Y}/api/workspace/activate?id=${V}&redirect=${B}`)}let U=Date.now()+VZ,M=(B)=>new Promise((ZQ)=>setTimeout(ZQ,B));while(Date.now()<U){await M(JZ);let B=await fetch(`${Y}/api/plan/verdict`,{headers:{"x-beacon-workspace":V}}).then((ZQ)=>ZQ.json()).catch(()=>null);if(!B)continue;if(B.kind==="approved")N(uQ(XZ().planApprovalMode,WZ(B.features)));if(B.kind==="discarded")N(e("The user discarded the plan in Beacon. Ask what they want to adjust before re-presenting."));if(B.kind==="feedback")N(e(`The user left feedback on the plan in Beacon (inline comments and/or edits on the /map and /db boards). Revise the plan based on the feedback below, then re-present (call ExitPlanMode again):
|
|
251
251
|
|
|
252
|
-
`+B.feedback))}
|
|
252
|
+
`+B.feedback))}N(e("Beacon plan review timed out without a verdict. Re-present the plan and ask the user to review it."))})();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
var F5=Object.defineProperty;var z5=(Z)=>Z;function P5(Z,$){this[Z]=z5.bind(null,$)}var TZ=(Z,$)=>{for(var Q in $)F5(Z,Q,{get:$[Q],enumerable:!0,configurable:!0,set:P5.bind($,Q)})};var $4=(Z,$)=>()=>(Z&&($=Z(Z=0)),$);var J4={};TZ(J4,{provisionDb:()=>x5});import{createClient as E5}from"@libsql/client";import{drizzle as I5}from"drizzle-orm/libsql";import{migrate as R5}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as S5}from"drizzle-orm/migrator";import{dirname as wZ,join as k5}from"path";import{fileURLToPath as v5}from"url";async function OZ(Z,$){return(await Z.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[$]})).rows.length>0}async function f5(Z,$){let Q=await Z.execute(`PRAGMA table_info("${$}")`);return new Set(Q.rows.map((J)=>String(J.name)))}async function Q4(Z){if(!await OZ(Z,"__drizzle_migrations"))return 0;let $=await Z.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number($.rows[0]?.n??0)}async function u5(Z){for(let[$,Q]of Object.entries(y5)){if(!await OZ(Z,$))continue;let J=await f5(Z,$);for(let K of Q){if(!J.has(K))continue;await Z.execute(`UPDATE "${$}" SET "${K}" = CAST((julianday("${K}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${K}") = 'text'`)}}}async function x5(Z,$=w5){let Q=E5({url:Z});try{await Q.execute("PRAGMA journal_mode = WAL;"),await Q.execute("PRAGMA foreign_keys = ON;");let J=await OZ(Q,"__drizzle_migrations"),K=await OZ(Q,"Node"),V=!1;if(K&&!J){let X=S5({migrationsFolder:$})[0];if(X)await Q.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await Q.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[X.hash,X.folderMillis]}),V=!0}let G=await Q4(Q);if(await R5(I5(Q),{migrationsFolder:$}),await Q4(Q)>G)V=!0;return await u5(Q),{migrated:V}}finally{Q.close()}}var T5,w5,y5;var V4=$4(async()=>{T5=wZ(wZ(wZ(v5(import.meta.url)))),w5=process.env.BEACON_MIGRATIONS_DIR||k5(T5,"drizzle"),y5={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{mkdirSync as E7,renameSync as I7,rmSync as R7,writeFileSync as S7}from"fs";import{dirname as k7}from"path";function N$(Z,$){E7(k7(Z),{recursive:!0});let Q=`${Z}.tmp`;try{S7(Q,$),I7(Q,Z)}catch(J){throw R7(Q,{force:!0}),J}}var V5=()=>{};import{AsyncLocalStorage as g5}from"async_hooks";import{spawnSync as h5}from"child_process";import{createHash as b5}from"crypto";import{existsSync as K4,mkdirSync as AZ,readFileSync as X4,writeFileSync as G4}from"fs";import{homedir as m5}from"os";import{basename as c5,join as $Z}from"path";function QZ(){return process.env.BEACON_HOME||$Z(m5(),".beacon")}function fZ(){return $Z(QZ(),"workspaces.json")}function WZ(Z){return b5("sha256").update(Z).digest("hex").slice(0,12)}function uZ(Z=process.cwd()){let $=h5("git",["rev-parse","--show-toplevel"],{cwd:Z,stdio:["ignore","pipe","ignore"]});if($.status===0){let Q=$.stdout?.toString().trim();if(Q)return Q}return Z}function n(Z){return $Z(QZ(),Z)}function JZ(Z){return`file:${$Z(n(Z),"db.sqlite")}`}function LZ(){try{let Z=JSON.parse(X4(fZ(),"utf8"));return Array.isArray(Z)?Z:[]}catch{return[]}}function xZ(Z){AZ(QZ(),{recursive:!0}),G4(fZ(),JSON.stringify(Z,null,2))}function gZ(){return LZ().sort((Z,$)=>$.lastOpenedAt.localeCompare(Z.lastOpenedAt))}function x(Z){return LZ().find(($)=>$.id===Z)??null}function p5(Z,$,Q=new Date().toISOString()){let J=WZ(Z),K=LZ(),V=K.find((j)=>j.id===J),G={id:J,path:Z,name:$||V?.name||c5(Z),lastOpenedAt:Q},X=[G,...K.filter((j)=>j.id!==J)];return AZ(n(J),{recursive:!0}),xZ(X),G}function W8(Z,$=new Date().toISOString()){let Q=LZ(),J=Q.find((K)=>K.id===Z);if(!J)return;J.lastOpenedAt=$,xZ(Q)}function Y4(Z){if(xZ(LZ().filter(($)=>$.id!==Z)),r()===Z)l5(gZ()[0]?.id??null)}function M4(){return $Z(QZ(),"active")}function r(){try{return X4(M4(),"utf8").trim()||null}catch{return null}}function l5(Z){AZ(QZ(),{recursive:!0}),G4(M4(),Z??"")}function d5(){let Z=r();return Z?x(Z):null}function L8(){let Z=_Z()??r();return Z?x(Z):null}function N8(Z){return x(Z)?.path??null}function C8(){return K4(fZ())}var j4="beacon_ws";function U4(Z,$){let Q=Z.headers.get("cookie");if(!Q)return null;for(let J of Q.split(";")){let K=J.indexOf("=");if(K===-1)continue;if(J.slice(0,K).trim()===$)return decodeURIComponent(J.slice(K+1).trim())}return null}function B8(Z){let $=Z.headers.get("x-beacon-workspace");if($&&x($))return $;let Q=U4(Z,j4);if(Q&&x(Q))return Q;return null}var n5="x-beacon-workspace-path";async function q8(Z){let $=Z.headers.get("x-beacon-workspace");if($&&x($))return $;let Q=Z.headers.get(n5);if(Q&&(!$||WZ(Q)===$)){let K=p5(Q);return await hZ(K.id),K.id}let J=U4(Z,j4);if(J&&x(J))return J;return null}var H4=new g5;function r5(Z,$){return Z?H4.run(Z,$):$()}function _Z(){return H4.getStore()??null}var yZ=new Set;function W4(Z){yZ.delete($Z(n(Z),"db.sqlite"))}async function hZ(Z){let $=n(Z),Q=$Z($,"db.sqlite"),J=K4(Q);if(J&&yZ.has(Q))return{ok:!0,created:!1,migrated:!1};try{AZ($,{recursive:!0});let{provisionDb:K}=await V4().then(() => J4),V=await K(JZ(Z));return yZ.add(Q),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(K){return{ok:!1,created:!1,migrated:!1,error:K instanceof Error?K.message:String(K)}}}import{existsSync as s7,readFileSync as a7}from"fs";import{resolve as O5}from"path";import{rmSync as i7}from"fs";import{drizzle as C6}from"drizzle-orm/libsql";import{createClient as B6}from"@libsql/client";var bZ={};TZ(bZ,{tag:()=>MZ,syncState:()=>a,projectMeta:()=>e5,note:()=>s5,nodeTags:()=>KZ,nodeFile:()=>NZ,node:()=>k,endpointTable:()=>o,endpoint:()=>T,edge:()=>VZ,draftTable:()=>p,draftRelation:()=>XZ,draftColumn:()=>BZ,dbTable:()=>I,dbRelation:()=>l,dbColumn:()=>e,codeFileEdge:()=>u,codeFile:()=>f,bugFlag:()=>CZ,boardAnnotation:()=>a5,appSetting:()=>t5});import{sqliteTable as v,index as S,foreignKey as o5,text as H,integer as F,real as b,uniqueIndex as t,primaryKey as i5}from"drizzle-orm/sqlite-core";import{createId as h}from"@paralleldrive/cuid2";var k=v("Node",{id:H().primaryKey().$defaultFn(()=>h()),view:H().notNull(),kind:H().default("FEATURE").notNull(),cluster:H(),title:H().notNull(),role:H(),plain:H(),status:H().default("PENDING").notNull(),priority:F().default(2).notNull(),progress:F().default(0).notNull(),x:b().default(0).notNull(),y:b().default(0).notNull(),sourceRef:H(),externalId:H(),source:H().default("MANUAL").notNull(),parentId:H(),createdAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},(Z)=>[S("Node_cluster_idx").on(Z.cluster),S("Node_parentId_idx").on(Z.parentId),S("Node_view_idx").on(Z.view),o5(()=>({columns:[Z.parentId],foreignColumns:[Z.id],name:"Node_parentId_Node_id_fk"})).onUpdate("cascade").onDelete("cascade")]),NZ=v("NodeFile",{id:H().primaryKey().$defaultFn(()=>h()),nodeId:H().notNull().references(()=>k.id,{onDelete:"cascade",onUpdate:"cascade"}),path:H().notNull()},(Z)=>[t("NodeFile_nodeId_path_key").on(Z.nodeId,Z.path),S("NodeFile_nodeId_idx").on(Z.nodeId)]),MZ=v("Tag",{id:H().primaryKey().$defaultFn(()=>h()),label:H().notNull(),color:H()},(Z)=>[t("Tag_label_key").on(Z.label)]),VZ=v("Edge",{id:H().primaryKey().$defaultFn(()=>h()),fromId:H().notNull().references(()=>k.id,{onDelete:"cascade",onUpdate:"cascade"}),toId:H().notNull().references(()=>k.id,{onDelete:"cascade",onUpdate:"cascade"}),kind:H().default("DEPENDS").notNull(),label:H(),sourceHandle:H(),targetHandle:H()},(Z)=>[t("Edge_fromId_toId_kind_key").on(Z.fromId,Z.toId,Z.kind),S("Edge_toId_idx").on(Z.toId),S("Edge_fromId_idx").on(Z.fromId)]),KZ=v("_NodeTags",{a:H("A").notNull().references(()=>k.id,{onDelete:"cascade",onUpdate:"cascade"}),b:H("B").notNull().references(()=>MZ.id,{onDelete:"cascade",onUpdate:"cascade"})},(Z)=>[t("_NodeTags_AB_unique").on(Z.a,Z.b),S("_NodeTags_B_index").on(Z.b)]),s5=v("Note",{id:H().primaryKey().$defaultFn(()=>h()),title:H().default("Untitled").notNull(),body:H().default("").notNull(),ord:b().default(0).notNull(),pinned:F({mode:"boolean"}).default(!1).notNull(),createdAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},(Z)=>[S("Note_updatedAt_idx").on(Z.updatedAt)]),a5=v("BoardAnnotation",{id:H().primaryKey().$defaultFn(()=>h()),targetKind:H().notNull(),targetId:H().notNull(),columnName:H(),body:H().default("").notNull(),x:b(),y:b(),createdAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},(Z)=>[S("BoardAnnotation_target_idx").on(Z.targetId)]),CZ=v("BugFlag",{id:H().primaryKey().$defaultFn(()=>h()),nodeId:H().notNull().references(()=>k.id,{onDelete:"cascade",onUpdate:"cascade"}),by:H().notNull(),note:H().notNull(),resolvedAt:F({mode:"timestamp_ms"}),createdAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date)},(Z)=>[S("BugFlag_nodeId_idx").on(Z.nodeId)]),I=v("DbTable",{id:H().primaryKey().$defaultFn(()=>h()),name:H().notNull(),domain:H(),description:H(),source:H().default("MANUAL").notNull(),x:b().default(0).notNull(),y:b().default(0).notNull(),createdAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},(Z)=>[S("DbTable_domain_idx").on(Z.domain),t("DbTable_name_key").on(Z.name)]),e=v("DbColumn",{id:H().primaryKey().$defaultFn(()=>h()),tableId:H().notNull().references(()=>I.id,{onDelete:"cascade",onUpdate:"cascade"}),name:H().notNull(),type:H().notNull(),isPk:F({mode:"boolean"}).default(!1).notNull(),isFk:F({mode:"boolean"}).default(!1).notNull(),nullable:F({mode:"boolean"}).default(!0).notNull(),note:H(),ord:F().default(0).notNull()},(Z)=>[t("DbColumn_tableId_name_key").on(Z.tableId,Z.name),S("DbColumn_tableId_idx").on(Z.tableId)]),l=v("DbRelation",{id:H().primaryKey().$defaultFn(()=>h()),fromTableId:H().notNull().references(()=>I.id,{onDelete:"cascade",onUpdate:"cascade"}),toTableId:H().notNull().references(()=>I.id,{onDelete:"cascade",onUpdate:"cascade"}),fromColumn:H().notNull(),toColumn:H().notNull(),label:H()},(Z)=>[S("DbRelation_toTableId_idx").on(Z.toTableId),S("DbRelation_fromTableId_idx").on(Z.fromTableId)]),T=v("Endpoint",{id:H().primaryKey().$defaultFn(()=>h()),method:H().notNull(),path:H().notNull(),domain:H(),description:H(),source:H().default("MANUAL").notNull(),x:b().default(0).notNull(),y:b().default(0).notNull(),createdAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},(Z)=>[t("Endpoint_method_path_key").on(Z.method,Z.path),S("Endpoint_domain_idx").on(Z.domain)]),o=v("EndpointTable",{id:H().primaryKey().$defaultFn(()=>h()),endpointId:H().notNull().references(()=>T.id,{onDelete:"cascade",onUpdate:"cascade"}),tableId:H().notNull().references(()=>I.id,{onDelete:"cascade",onUpdate:"cascade"}),access:H().default("read").notNull()},(Z)=>[t("EndpointTable_endpointId_tableId_key").on(Z.endpointId,Z.tableId),S("EndpointTable_tableId_idx").on(Z.tableId)]),p=v("DraftTable",{id:H().primaryKey().$defaultFn(()=>h()),name:H().notNull(),domain:H(),description:H(),x:b().default(0).notNull(),y:b().default(0).notNull(),createdAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date)},(Z)=>[t("DraftTable_name_key").on(Z.name)]),BZ=v("DraftColumn",{id:H().primaryKey().$defaultFn(()=>h()),tableId:H().notNull().references(()=>p.id,{onDelete:"cascade",onUpdate:"cascade"}),name:H().notNull(),type:H().notNull(),isPk:F({mode:"boolean"}).default(!1).notNull(),isFk:F({mode:"boolean"}).default(!1).notNull(),nullable:F({mode:"boolean"}).default(!0).notNull(),note:H(),ord:F().default(0).notNull()},(Z)=>[S("DraftColumn_tableId_idx").on(Z.tableId)]),XZ=v("DraftRelation",{id:H().primaryKey().$defaultFn(()=>h()),fromTableId:H().notNull().references(()=>p.id,{onDelete:"cascade",onUpdate:"cascade"}),toTableId:H().notNull().references(()=>p.id,{onDelete:"cascade",onUpdate:"cascade"}),fromColumn:H().notNull(),toColumn:H().notNull(),label:H()},(Z)=>[S("DraftRelation_toTableId_idx").on(Z.toTableId),S("DraftRelation_fromTableId_idx").on(Z.fromTableId)]),f=v("CodeFile",{path:H().primaryKey(),root:H(),lang:H(),x:b().default(0).notNull(),y:b().default(0).notNull(),mtimeMs:b(),size:F(),inDegree:F().default(0).notNull(),outDegree:F().default(0).notNull(),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),u=v("CodeFileEdge",{fromPath:H().notNull().references(()=>f.path,{onDelete:"cascade",onUpdate:"cascade"}),toPath:H().notNull().references(()=>f.path,{onDelete:"cascade",onUpdate:"cascade"}),circular:F({mode:"boolean"}).default(!1).notNull()},(Z)=>[S("CodeFileEdge_circular_idx").on(Z.circular),S("CodeFileEdge_toPath_idx").on(Z.toPath),S("CodeFileEdge_fromPath_idx").on(Z.fromPath),i5({columns:[Z.fromPath,Z.toPath],name:"CodeFileEdge_fromPath_toPath_pk"})]),a=v("SyncState",{id:H().primaryKey().default("singleton"),version:F().default(0).notNull(),codeGraphSyncedAt:F({mode:"timestamp_ms"}),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),t5=v("AppSetting",{id:H().primaryKey().default("singleton"),editor:H().default("auto").notNull(),currentFeatureId:H(),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),e5=v("ProjectMeta",{id:H().primaryKey().default("singleton"),overview:H(),conventions:H().default("[]").notNull(),updatedAt:F({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)});var mZ={};TZ(mZ,{tagRelations:()=>J6,nodeTagsRelations:()=>V6,nodeRelations:()=>Z6,nodeFileRelations:()=>$6,endpointTableRelations:()=>j6,endpointRelations:()=>M6,edgeRelations:()=>K6,draftTableRelations:()=>U6,draftRelationRelations:()=>W6,draftColumnRelations:()=>H6,dbTableRelations:()=>X6,dbRelationRelations:()=>Y6,dbColumnRelations:()=>G6,codeFileRelations:()=>L6,codeFileEdgeRelations:()=>N6,bugFlagRelations:()=>Q6});import{relations as g}from"drizzle-orm";var Z6=g(k,({one:Z,many:$})=>({files:$(NZ),bugFlags:$(CZ),nodeTags:$(KZ),edgesOut:$(VZ,{relationName:"EdgeFrom"}),edgesIn:$(VZ,{relationName:"EdgeTo"}),parent:Z(k,{fields:[k.parentId],references:[k.id],relationName:"NodeTree"}),children:$(k,{relationName:"NodeTree"})})),$6=g(NZ,({one:Z})=>({node:Z(k,{fields:[NZ.nodeId],references:[k.id]})})),Q6=g(CZ,({one:Z})=>({node:Z(k,{fields:[CZ.nodeId],references:[k.id]})})),J6=g(MZ,({many:Z})=>({nodeTags:Z(KZ)})),V6=g(KZ,({one:Z})=>({node:Z(k,{fields:[KZ.a],references:[k.id]}),tag:Z(MZ,{fields:[KZ.b],references:[MZ.id]})})),K6=g(VZ,({one:Z})=>({from:Z(k,{fields:[VZ.fromId],references:[k.id],relationName:"EdgeFrom"}),to:Z(k,{fields:[VZ.toId],references:[k.id],relationName:"EdgeTo"})})),X6=g(I,({many:Z})=>({columns:Z(e),fksOut:Z(l,{relationName:"FkFrom"}),fksIn:Z(l,{relationName:"FkTo"}),usages:Z(o)})),G6=g(e,({one:Z})=>({table:Z(I,{fields:[e.tableId],references:[I.id]})})),Y6=g(l,({one:Z})=>({fromTable:Z(I,{fields:[l.fromTableId],references:[I.id],relationName:"FkFrom"}),toTable:Z(I,{fields:[l.toTableId],references:[I.id],relationName:"FkTo"})})),M6=g(T,({many:Z})=>({tables:Z(o)})),j6=g(o,({one:Z})=>({endpoint:Z(T,{fields:[o.endpointId],references:[T.id]}),table:Z(I,{fields:[o.tableId],references:[I.id]})})),U6=g(p,({many:Z})=>({columns:Z(BZ),fksOut:Z(XZ,{relationName:"DraftFkFrom"}),fksIn:Z(XZ,{relationName:"DraftFkTo"})})),H6=g(BZ,({one:Z})=>({table:Z(p,{fields:[BZ.tableId],references:[p.id]})})),W6=g(XZ,({one:Z})=>({fromTable:Z(p,{fields:[XZ.fromTableId],references:[p.id],relationName:"DraftFkFrom"}),toTable:Z(p,{fields:[XZ.toTableId],references:[p.id],relationName:"DraftFkTo"})})),L6=g(f,({many:Z})=>({edgesOut:Z(u,{relationName:"CFEFrom"}),edgesIn:Z(u,{relationName:"CFETo"})})),N6=g(u,({one:Z})=>({fromFile:Z(f,{fields:[u.fromPath],references:[f.path],relationName:"CFEFrom"}),toFile:Z(f,{fields:[u.toPath],references:[f.path],relationName:"CFETo"})}));var q6={...bZ,...mZ};function O6(){let Z=process.env.DATABASE_URL;if(Z&&/^(file:|libsql:|wss?:|https?:|:memory:)/i.test(Z))return Z;return"file:./dev.db"}var A6=O6();function L4(Z){let $=B6({url:Z});return $.execute("PRAGMA foreign_keys = ON;"),C6($,{schema:q6})}var pZ=globalThis,cZ=pZ.dzDefault??L4(A6);pZ.dzDefault=cZ;var DZ=pZ.dzByUrl??=new Map;function lZ(Z){let $=DZ.get(Z);if(!$)$=L4(Z),DZ.set(Z,$);return $}function N4(Z){let $=DZ.get(Z);DZ.delete(Z);try{$?.$client?.close?.()}catch{}}function _6(){if(process.env.BEACON_REPO)return cZ;let Z=_Z()??r();if(!Z)return cZ;return lZ(JZ(Z))}var i=new Proxy({},{get(Z,$){let Q=_6(),J=Q[$];return typeof J==="function"?J.bind(Q):J}});import{existsSync as n7}from"fs";import{existsSync as L5,readFileSync as b7,watch as m7}from"fs";import{readFile as W5}from"fs/promises";import{join as qZ,relative as c7,resolve as p7}from"path";import{existsSync as y4,readFileSync as f4}from"fs";import{readdir as t6,readFile as e6,stat as u4}from"fs/promises";import{extname as x4,join as PZ,relative as UZ,resolve as jZ}from"path";import{extname as S4}from"path";import{dirname as D6,resolve as F6}from"path";var dZ=[".ts",".tsx",".js",".jsx",".mjs",".cjs"],z6=[/(?:^|[\n;])\s*(?:import|export)[^'"`\n]{0,4000}?from\s*['"]([^'"`]+)['"]/g,/(?:^|[\n;])\s*import\s*['"]([^'"`]+)['"]/g,/\brequire\(\s*['"]([^'"`]+)['"]\s*\)/g,/\bimport\(\s*['"]([^'"`]+)['"]\s*\)/g];function P6(Z){return Z.split(/[\\/]/).join("/")}function C4(Z,$){if($.has(Z))return Z;for(let Q of dZ){let J=`${Z}${Q}`;if($.has(J))return J}for(let Q of dZ){let J=`${Z}/index${Q}`;if($.has(J))return J}return null}function E6(Z){let $=new Set;for(let Q of z6)for(let J of Z.matchAll(Q))$.add(J[1]);return $}function I6(Z,$,Q,J){if(Z.startsWith(".")){let K=F6("/",D6($),Z),V=P6(K).replace(/^\//,"");return C4(V,Q)}for(let K of J)if(Z.startsWith(K.from)){let V=Z.slice(K.from.length),G=K.to?`${K.to}/${V}`:V,X=C4(G,Q);if(X)return X}return null}var B4={id:"ts",extensions:dZ,specifiers:E6,resolve(Z,$,Q){let J=I6(Z,$,Q.fileSet,Q.tsAliases??[]);return J?[J]:[]}};import{dirname as q4,join as R6,normalize as S6}from"path";var k6=[".py",".pyi"],O4=[/(?:^|[\n;])\s*from\s+(\.*[\w.]*)\s+import\b/g,/(?:^|[\n;])\s*import\s+([\w.]+(?:\s*,\s*[\w.]+)*)/g];function A4(Z,$){for(let Q of[`${Z}.py`,`${Z}/__init__.py`,`${Z}.pyi`])if($.has(Q))return[Q];return[]}function v6(Z){let $=new Set;for(let Q of Z.matchAll(O4[0])){let J=Q[1].trim();if(J)$.add(J)}for(let Q of Z.matchAll(O4[1]))for(let J of Q[1].split(/\s*,\s*/)){let K=J.trim().split(/\s+as\s+/)[0].trim();if(K)$.add(K)}return $}var _4={id:"python",extensions:k6,specifiers:v6,resolve(Z,$,Q){if(Z.startsWith(".")){let J=Z.length-Z.replace(/^\.+/,"").length,K=Z.slice(J),V=q4($);for(let X=1;X<J;X++)V=q4(V);let G=K?R6(V,K.replace(/\./g,"/")):V;return A4(S6(G).replace(/\\/g,"/"),Q.fileSet)}return A4(Z.replace(/\./g,"/"),Q.fileSet)}};import{dirname as T6}from"path";var w6=[".go"],y6=/(?:^|[\n;])\s*import\s+(?:[\w.]+\s+)?"([^"]+)"/g,f6=/(?:^|[\n;])\s*import\s*\(([\s\S]*?)\)/g,u6=/"([^"]+)"/g;function x6(Z){let $=new Set;for(let Q of Z.matchAll(y6))$.add(Q[1]);for(let Q of Z.matchAll(f6))for(let J of Q[1].matchAll(u6))$.add(J[1]);return $}var D4={id:"go",extensions:w6,resolve(Z,$,Q){let J=Q.goModulePath;if(!J)return[];let K=null;if(Z===J)K="";else if(Z.startsWith(`${J}/`))K=Z.slice(J.length+1);if(K===null)return[];let V=[];for(let G of Q.fileSet){if(!G.endsWith(".go"))continue;let X=T6(G);if(K===""&&X==="."||X===K)V.push(G)}return V.sort()},specifiers:x6};import{basename as F4,dirname as nZ,join as z4,normalize as P4}from"path";var g6=[".rs"],h6=/(?:^|[\n;])\s*(?:pub\s+)?mod\s+(\w+)\s*;/g,b6=/(?:^|[\n;])\s*(?:pub\s+)?use\s+([\w:]+)/g;function m6(Z){let $=Z.split("::").filter((Q)=>Q&&Q!=="*");if(!$.length)return"";if($[0]==="crate")return["crate",...$.slice(1)].join("/");if($[0]==="super")return["..",...$.slice(1)].join("/");if($[0]==="self")return[".",...$.slice(1)].join("/");return $.join("/")}function rZ(Z,$){for(let Q of[`${Z}.rs`,`${Z}/mod.rs`])if($.has(Q))return[Q];return[]}var c6=new Set(["mod.rs","lib.rs","main.rs"]);function p6(Z){let $=new Set;for(let Q of Z.matchAll(h6))$.add(`./${Q[1]}`);for(let Q of Z.matchAll(b6)){let J=m6(Q[1]);if(J)$.add(J)}return $}var E4={id:"rust",extensions:g6,specifiers:p6,resolve(Z,$,Q){let J=Q.fileSet;if(Z.startsWith("./")||Z.startsWith("../")){let K=Z.replace(/^\.\//,""),V=P4(z4(nZ($),Z)).replace(/\\/g,"/"),G=rZ(V,J);if(G.length)return G;if(Z.startsWith("./")&&!c6.has(F4($))){let X=z4(nZ($),F4($,".rs"),K);if(G=rZ(P4(X).replace(/\\/g,"/"),J),G.length)return G}return[]}if(Z.startsWith("crate/")){let K=$.split("/"),V=K.lastIndexOf("src"),G=V>=0?K.slice(0,V+1).join("/"):nZ($),X=Z.slice(6).split("/");for(let j of[X.join("/"),X.slice(0,-1).join("/")]){if(!j)continue;let W=rZ(`${G}/${j}`,J);if(W.length)return W}return[]}return[]}};import{dirname as l6,extname as d6,join as n6,normalize as r6}from"path";var I4=[".swift",".java",".rb",".kt",".kts",".cs",".php",".scala",".c",".h",".cpp",".hpp",".cc",".hh",".m",".mm",".ex",".exs",".lua",".dart",".vue",".svelte"],o6=[/\b(?:require_relative|require|include|import|use|using|from)\s*\(?\s*['"]([^'"`\n]+)['"]/g,/(?:^|[\n;])\s*import\s+([\w.]+)/g,/(?:^|[\n;])\s*from\s+([\w.]+)\s+import\b/g,/(?:^|[\n;])\s*using\s+([\w.]+)\s*;/g,/(?:^|[\n;])\s*use\s+([\w\\]+)/g,/#\s*include\s*[<"]([^>"\n]+)[>"]/g];function i6(Z){let $=new Set;for(let Q of o6)for(let J of Z.matchAll(Q)){let K=J[1].trim();if(K)$.add(K)}return $}var R4={id:"fallback",extensions:I4,specifiers:i6,resolve(Z,$,Q){let K=[d6($).toLowerCase(),...I4].filter((j,W,U)=>j&&U.indexOf(j)===W),V=Z.includes("/")||Z.includes("\\"),G=Z.startsWith(".")||V?Z.replace(/\\/g,"/"):Z.replace(/[.:]+/g,"/"),X=[r6(n6(l6($),G)).replace(/\\/g,"/"),G.replace(/^\.\//,"")];for(let j of X){if(Q.fileSet.has(j))return[j];for(let W of K){let U=j.endsWith(W)?j:`${j}${W}`;if(Q.fileSet.has(U))return[U];if(Q.fileSet.has(`${j}/index${W}`))return[`${j}/index${W}`]}}return[]}};var s6=[B4,_4,D4,E4,R4],FZ=new Map;for(let Z of s6)for(let $ of Z.extensions)FZ.set($,Z);var a6={".ts":"ts",".tsx":"ts",".js":"js",".jsx":"js",".mjs":"js",".cjs":"js",".py":"py",".pyi":"py",".go":"go",".rs":"rs",".swift":"swift",".java":"java",".rb":"ruby",".kt":"kotlin",".kts":"kotlin",".cs":"csharp",".php":"php",".scala":"scala",".c":"c",".h":"c",".cpp":"cpp",".hpp":"cpp",".cc":"cpp",".hh":"cpp",".m":"objc",".mm":"objc",".ex":"elixir",".exs":"elixir",".lua":"lua",".dart":"dart",".vue":"vue",".svelte":"svelte"};function oZ(Z){return FZ.get(S4(Z).toLowerCase())??null}function k4(Z){let $=S4(Z).toLowerCase();if(!FZ.has($))return null;return a6[$]??$.slice(1)}function iZ(){return new Set(FZ.keys())}var g4=new Set(["node_modules",".git",".next","dist","build","__pycache__","target",".venv","venv","env",".turbo","coverage",".beacon",".playwright-mcp","generated"]);function Z7(Z=5){let $=performance.now();return async()=>{if(performance.now()-$>Z)await new Promise((Q)=>setImmediate(Q)),$=performance.now()}}var $7=()=>Promise.resolve();async function h4(Z,$,Q,J,K){let V;try{V=await t6($,{withFileTypes:!0})}catch{return}for(let G of V){if(G.name.startsWith("."))continue;if(g4.has(G.name))continue;let X=PZ($,G.name);if(G.isDirectory()){await h4(Z,X,Q,J,K);continue}if(!G.isFile())continue;if(G.name.endsWith(".d.ts"))continue;if(!Q.has(x4(G.name).toLowerCase()))continue;J.push(UZ(Z,X))}await K()}async function Q7(Z,$=$7){let Q=[];return await h4(Z,Z,iZ(),Q,$),Q.map((J)=>J.split(/[\\/]/).join("/")).sort()}function J7(Z){try{return JSON.parse(Z)}catch{}let $=Z.replace(/\/\*[^"]*?\*\//g,"").replace(/(^|[^:"])\/\/.*$/gm,"$1").replace(/,\s*([}\]])/g,"$1");return JSON.parse($)}function v4(Z){return Z.replace(/^\.\/?/,"").replace(/\/$/,"")}function b4(Z){let $=PZ(Z,"tsconfig.json");if(!y4($))return[];let Q;try{Q=J7(f4($,"utf8"))}catch{return[]}let J=Q.compilerOptions?.paths??{},K=v4(Q.compilerOptions?.baseUrl??"."),V=[];for(let[G,X]of Object.entries(J)){if(!G.endsWith("/*")||!X.length)continue;let j=X[0];if(!j.endsWith("/*"))continue;let W=G.slice(0,-1),U=v4(j.slice(0,-1)),B=[K,U].filter(Boolean).join("/");V.push({from:W,to:B})}return V}function zZ(Z){let $=PZ(Z,"go.mod");if(!y4($))return null;try{let Q=/^\s*module\s+(\S+)/m.exec(f4($,"utf8"));return Q?Q[1]:null}catch{return null}}function c(Z){return Z.split(/[\\/]/).join("/")}function m4(Z){if(Z.length===1)return Z[0];let $=Z.map((K)=>c(K).split("/")),Q=$[0],J=0;for(;J<Q.length;J++)if(!$.every((K)=>K[J]===Q[J]))break;return Q.slice(0,J).join("/")||"/"}async function V7(Z,$,Q){let J=(Array.isArray(Z)?Z:[Z]).map((W)=>c(jZ(W))),K=c($?jZ($):J.length===1?J[0]:m4(J)),V=new Map,G=[];for(let W of J){let U=c(UZ(K,W));for(let B of b4(W))G.push({from:B.from,to:[U,B.to].filter(Boolean).join("/")});for(let B of await Q7(W,Q)){let L=c(PZ(W,B)),C=c(UZ(K,L));if(V.has(C))continue;try{let q=await u4(L);V.set(C,{path:C,abs:L,root:U||null,mtimeMs:q.mtimeMs,size:q.size})}catch{}await Q()}}let X=J.map(zZ).find(Boolean)??zZ(K);return{metas:[...V.values()].sort((W,U)=>W.path.localeCompare(U.path)),ctx:{fileSet:new Set(V.keys()),tsAliases:G,goModulePath:X}}}var T4=50000;function K7(Z){let $=0;for(let Q=0;Q<Z.length;Q++)if(Z.charCodeAt(Q)===10){if(Q-$>T4)return!0;$=Q+1}return Z.length-$>T4}async function w4(Z){let $=oZ(Z.path);if(!$||Z.size>200000)return new Set;try{let Q=await e6(Z.abs,"utf8");if(K7(Q))return new Set;return $.specifiers(Q)}catch{return new Set}}function c4(Z,$){let Q=(Array.isArray(Z)?Z:[Z]).map((q)=>c(jZ(q))),J=c($?jZ($):Q.length===1?Q[0]:m4(Q)),K=new Map,V=new Map,G=[],X=null;function j(){G=[];for(let q of Q){let Y=c(UZ(J,q));for(let N of b4(q))G.push({from:N.from,to:[Y,N.to].filter(Boolean).join("/")})}X=Q.map(zZ).find(Boolean)??zZ(J)}function W(q){let Y=q.split("/");for(let A=0;A<Y.length;A++){let O=Y[A];if(!O||O.startsWith("."))return!0;if(A<Y.length-1&&g4.has(O))return!0}let N=Y[Y.length-1];if(N.endsWith(".d.ts"))return!0;return!iZ().has(x4(N).toLowerCase())}function U(q){let Y=c(jZ(q));for(let N of Q)if(Y===N||Y.startsWith(`${N}/`)){let A=Y.slice(N.length).replace(/^\/+/,"");if(W(A))return null;return{path:c(UZ(J,Y)),root:c(UZ(J,N))||null}}return null}function B(){let q={fileSet:new Set(K.keys()),tsAliases:G,goModulePath:X},Y=[...K.values()].sort((O,M)=>O.path.localeCompare(M.path)),N=[];for(let O of Y){let M=oZ(O.path);if(!M)continue;let _=V.get(O.path)??new Set,D=new Set;for(let E of _)for(let R of M.resolve(E,O.path,q)){if(!R||R===O.path||D.has(R))continue;D.add(R),N.push({from:O.path,to:R})}}return{files:Y.map((O)=>({path:O.path,lang:k4(O.path),root:O.root,mtimeMs:O.mtimeMs,size:O.size})),edges:N}}async function L(){let q=Z7(),{metas:Y,ctx:N}=await V7(Z,$,q);K.clear(),V.clear();for(let A of Y)await q(),K.set(A.path,A),V.set(A.path,await w4(A));return G=N.tsAliases??[],X=N.goModulePath??null,B()}async function C(q){let Y=c(jZ(q));if(!Q.some((D)=>Y===D||Y.startsWith(`${D}/`)))return!1;let N=Y.split("/").pop()??"";if(N==="tsconfig.json"||N==="go.mod"){let D=Y.slice(0,Y.length-N.length-1);if(Q.includes(D))return j(),!0;return!1}let A=U(q);if(!A)return!1;let O;try{O=await u4(Y)}catch{let D=K.delete(A.path);return V.delete(A.path),D}let M=K.get(A.path);if(M&&M.mtimeMs===O.mtimeMs&&M.size===O.size)return!1;let _={path:A.path,abs:Y,root:A.root,mtimeMs:O.mtimeMs,size:O.size};return K.set(A.path,_),V.set(A.path,await w4(_)),!0}return{seed:L,applyChange:C,snapshot:B}}function p4(Z){let $=Object.keys(Z.tableVars),Q=new Map;if(!$.length){for(let G of Z.routeFiles)Q.set(G,[]);return Q}let J=new Map;for(let G of Z.edges){let X=J.get(G.from)??[];X.push(G.to),J.set(G.from,X)}let K=new Map($.map((G)=>[G,new RegExp(`(?:query\\.${G}\\b|\\.from\\(\\s*${G}\\b)`)])),V=new Map($.map((G)=>[G,new RegExp(`(?:insert|update|delete)\\(\\s*${G}\\b`)]));for(let G of Z.routeFiles){let X=new Set([G]),j=[G];for(let L=0;L<2&&X.size<25;L++){let C=[];for(let q of j)for(let Y of J.get(q)??[]){if(X.has(Y)||X.size>=25)continue;X.add(Y),C.push(Y)}j=C}let W=new Set,U=new Set;for(let L of X){let C=Z.content(L);if(!C)continue;for(let q of $){if(!W.has(q)&&K.get(q).test(C))W.add(q);if(!U.has(q)&&V.get(q).test(C))U.add(q)}}let B=[];for(let L of $){let C=W.has(L),q=U.has(L);if(!C&&!q)continue;B.push({table:Z.tableVars[L],access:C&&q?"read-write":q?"write":"read"})}Q.set(G,B)}return Q}function X7(Z,$){if(/_JSON_OR_JSONB|\bJSONB\b|\bJSON\b/.test(Z))return"jsonb";let Q=Z.match(/\b(GUID|Uuid|UUID|String|Text|DateTime|Date|Time|BigInteger|SmallInteger|Integer|Boolean|Float|Numeric|Decimal|Vector|TSVECTOR|LargeBinary|Enum)\b\s*(\([^)]*\))?/);if(Q){let K=Q[2]??"",V=K.match(/\d+/)?.[0];switch(Q[1]){case"GUID":case"Uuid":case"UUID":return"uuid";case"String":return V?`varchar(${V})`:"varchar";case"Text":return"text";case"DateTime":return/timezone\s*=\s*True/.test(K)?"timestamptz":"timestamp";case"Date":return"date";case"Time":return"time";case"BigInteger":return"bigint";case"SmallInteger":return"smallint";case"Integer":return"integer";case"Boolean":return"boolean";case"Float":return"float";case"Numeric":case"Decimal":return"numeric";case"Vector":return V?`vector(${V})`:"vector";case"TSVECTOR":return"tsvector";case"LargeBinary":return"bytea";case"Enum":return"varchar"}}let J=$.replace(/\s*\|\s*None/,"").trim();if(/uuid/i.test(J))return"uuid";if(/datetime/i.test(J))return"timestamptz";if(/\bint\b/i.test(J))return"integer";if(/\bbool\b/i.test(J))return"boolean";if(/\bfloat\b/i.test(J))return"float";if(/\bdict\b|\bAny\b/.test(J))return"jsonb";return"text"}function l4(Z,$){let Q=0;for(let J=$;J<Z.length;J++)if(Z[J]==="(")Q++;else if(Z[J]===")"){if(Q--,Q===0)return Z.slice($+1,J)}return""}function G7(Z,$,Q){let J=Q.match(/__tablename__\s*=\s*["']([^"']+)["']/)?.[1],K=[],V=[],G=/(\w+)\s*:\s*Mapped\[([^\]]+)\]\s*=\s*mapped_column\s*\(/g,X;while(X=G.exec(Q)){let j=X[1],W=X[2],U=l4(Q,X.index+X[0].length-1),B=/primary_key\s*=\s*True/.test(U)||void 0,L=/nullable\s*=\s*False/.test(U)?!1:!0,C=U.match(/ForeignKey\(\s*["']([^"']+?)\.([^"'.]+)["']/);if(K.push({name:j,type:X7(U,W),isPk:B,isFk:C?!0:void 0,nullable:L}),C)V.push({column:j,toTable:C[1],toColumn:C[2]})}return{name:Z,bases:$,tableName:J,columns:K,fks:V}}function Y7(Z){let $=new Map;for(let V of Z){if(!V.path.endsWith(".py"))continue;if(!/mapped_column\s*\(|__tablename__/.test(V.content))continue;let G=/^class\s+(\w+)\s*\(([^)]*)\)\s*:/gm,X,j=[];while(X=G.exec(V.content))j.push({name:X[1],bases:X[2].split(",").map((W)=>W.trim().split(/[.[]/)[0]).filter(Boolean),at:X.index});for(let W=0;W<j.length;W++){let U=V.content.slice(j[W].at,j[W+1]?.at??V.content.length),B=G7(j[W].name,j[W].bases,U);$.set(B.name,B)}}if(![...$.values()].some((V)=>V.tableName))return{tables:[],relations:[]};let Q=(V,G=new Set)=>{if(G.has(V.name))return[];G.add(V.name);let X=[];for(let j of V.bases){let W=$.get(j);if(W&&!W.tableName)X.push(...Q(W,G))}return X.push(...V.columns),X},J=[],K=[];for(let V of $.values()){if(!V.tableName)continue;let G=Q(V),X=new Map;for(let L of G)if(!X.has(L.name))X.set(L.name,L);let j=[...X.values()],W=(L)=>j.splice(j.findIndex((C)=>C.name===L),1)[0],U=j.some((L)=>L.name==="id")?W("id"):null,B=["created_at","updated_at","deleted_at"].filter((L)=>j.some((C)=>C.name===L)).map((L)=>W(L));J.push({name:V.tableName,columns:[...U?[U]:[],...j,...B]});for(let L of V.fks)K.push({fromTable:V.tableName,fromColumn:L.column,toTable:L.toTable,toColumn:L.toColumn})}return{tables:J,relations:K}}function M7(Z){let $=Z.replace(/[?[\]]/g,"");return{String:"text",Int:"integer",BigInt:"bigint",Float:"float",Decimal:"numeric",Boolean:"boolean",DateTime:"timestamptz",Json:"jsonb",Bytes:"bytea"}[$]??$.toLowerCase()}function j7(Z){let $=[],Q=[];for(let J of Z){if(!J.path.endsWith(".prisma"))continue;let K=/model\s+(\w+)\s*\{([\s\S]*?)\}/g,V;while(V=K.exec(J.content)){let G=V[1],X=V[2].match(/@@map\(\s*["']([^"']+)["']\s*\)/)?.[1]??G,j=[];for(let W of V[2].split(`
|
|
4
|
+
`)){let U=W.trim().match(/^(\w+)\s+(\w+(?:\[\])?\??)\s*(.*)$/);if(!U||/^@@/.test(W.trim()))continue;let[,B,L,C]=U,q=/^(String|Int|BigInt|Float|Decimal|Boolean|DateTime|Json|Bytes)(\[\])?\??$/.test(L),Y=C.match(/@relation\([^)]*fields:\s*\[(\w+)\][^)]*references:\s*\[(\w+)\]/);if(Y)Q.push({fromTable:X,fromColumn:Y[1],toTable:L.replace(/[?[\]]/g,""),toColumn:Y[2]});if(!q)continue;j.push({name:B,type:M7(L),isPk:/@id\b/.test(C)||void 0,isFk:/@relation\b/.test(C)||void 0,nullable:L.endsWith("?")})}if(j.length)$.push({name:X,columns:j})}}return{tables:$,relations:Q}}function U7(Z,$){if(/mode:\s*["']timestamp/.test($))return"timestamp";if(/mode:\s*["']boolean["']/.test($))return"boolean";if(/mode:\s*["']json["']/.test($))return"jsonb";return Z}function H7(Z,$){let Q=0;for(let J=$;J<Z.length;J++)if(Z[J]==="{")Q++;else if(Z[J]==="}"){if(Q--,Q===0)return Z.slice($+1,J)}return""}function W7(Z){let $=[],Q=/(\w+)\s*:\s*(text|integer|real|blob|numeric|varchar|boolean|timestamp|serial|uuid|json|jsonb)\s*\(/g;for(let V of Z){if(!/\.(ts|tsx|mts|cts)$/.test(V.path))continue;if(!/\b(?:sqliteTable|pgTable|mysqlTable)\s*\(/.test(V.content))continue;let G=/(?:export\s+)?const\s+(\w+)\s*=\s*(?:sqliteTable|pgTable|mysqlTable)\s*\(\s*["']([^"']+)["']\s*,/g,X;while(X=G.exec(V.content)){let j=V.content.indexOf("{",X.index+X[0].length);if(j<0)continue;let W=H7(V.content,j),U={varName:X[1],tableName:X[2],columns:[],colByProp:new Map,fks:[]},B=[];Q.lastIndex=0;for(let L of W.matchAll(Q))B.push({prop:L[1],builder:L[2],at:L.index,argOpen:L.index+L[0].length-1});B.forEach((L,C)=>{let q=W.slice(L.at,B[C+1]?.at??W.length),Y=l4(W,L.argOpen),A=Y.match(/^\s*["']([^"']+)["']/)?.[1]??L.prop,O=q.match(/\.references\(\s*\(\)\s*=>\s*(\w+)\.(\w+)/);if(U.columns.push({name:A,type:U7(L.builder,Y),isPk:/\.primaryKey\(\)/.test(q)||void 0,isFk:O?!0:void 0,nullable:/\.notNull\(\)/.test(q)?!1:!0}),U.colByProp.set(L.prop,A),O)U.fks.push({column:A,toVar:O[1],toProp:O[2]})}),$.push(U)}}if(!$.length)return{tables:[],relations:[]};let J=new Map($.map((V)=>[V.varName,V])),K=[];for(let V of $)for(let G of V.fks){let X=J.get(G.toVar);if(!X)continue;K.push({fromTable:V.tableName,fromColumn:G.column,toTable:X.tableName,toColumn:X.colByProp.get(G.toProp)??G.toProp})}return{tables:$.map((V)=>({name:V.tableName,columns:V.columns})),relations:K,tableVars:Object.fromEntries($.map((V)=>[V.varName,V.tableName]))}}function d4(Z){let $=W7(Z);if($.tables.length)return $;let Q=j7(Z);if(Q.tables.length)return Q;return Y7(Z)}var L7=["GET","POST","PUT","PATCH","DELETE"];function N7(Z){let $=Z.match(/(?:^|\/)app\/(.+)\/route\.(?:ts|tsx|js|jsx|mjs)$/);if(!$)return null;let Q=$[1].split("/").filter((J)=>!(J.startsWith("(")&&J.endsWith(")"))).map((J)=>{let K=J.match(/^\[{1,2}(?:\.\.\.)?([^\]]+)\]{1,2}$/);return K?`{${K[1]}}`:J});if(Q[0]!=="api")return null;return`/${Q.join("/")}`}function n4(Z){let $=[];for(let Q of Z){let J=N7(Q.path);if(!J)continue;for(let K of L7)if(new RegExp(`export\\s+(?:async\\s+)?(?:function|const)\\s+${K}\\b`).test(Q.content))$.push({method:K,path:J,uses:[],file:Q.path})}return $.sort((Q,J)=>`${Q.path} ${Q.method}`.localeCompare(`${J.path} ${J.method}`))}var C7=/(^|\/)app\/.*\/route\.(ts|tsx|js|jsx|mjs)$/,B7=/\.(ts|py)$/,q7=/(schema|model)/i;function sZ(Z){if(Z.endsWith(".prisma"))return!0;if(C7.test(Z))return!0;return B7.test(Z)&&q7.test(Z)}function r4(Z,$=300){return Z.filter(sZ).slice(0,$)}import{z as d}from"zod";import{and as Y5,eq as HZ,inArray as u7,notInArray as x7}from"drizzle-orm";import{z}from"zod";import{and as v7,eq as SZ,inArray as tZ,notInArray as T7,or as w7,sql as y7}from"drizzle-orm";var o4=240,i4=50;function s4(Z){for(let $=0;$<Z.length;$++)for(let Q=$+1;Q<Z.length;Q++){let J=Z[$],K=Z[Q];if(J.x<K.x+o4&&J.x+o4>K.x&&J.y<K.y+i4&&J.y+i4>K.y)return!0}return!1}import{eq as O7}from"drizzle-orm";var a4=(Z)=>Z.replace(/\{[^}]*\}/g,"{}");function A7(Z,$){if(Z.method.toUpperCase()!==$.method.toUpperCase())return!1;let Q=a4(Z.path),J=a4($.path);return J===Q||J.endsWith(Q)}async function t4(Z=i){let[$,Q]=await Promise.all([Z.query.endpoint.findMany({where:(K,{ne:V})=>V(K.source,"INTROSPECTION")}),Z.query.endpoint.findMany({where:(K,{eq:V})=>V(K.source,"INTROSPECTION")})]),J={collapsed:0,mappings:[]};for(let K of $){let V=Q.find((G)=>A7(K,G));if(!V)continue;await Z.delete(T).where(O7(T.id,K.id)),J.collapsed++,J.mappings.push({planned:`${K.method} ${K.path}`,code:`${V.method} ${V.path}`})}return J}var e4=320;function ZZ(Z){return 36+Math.max(0,Z)*30+16}var GZ=60,_7=280,EZ=14,D7=120,IZ=170,F7=2560;var RZ=(Z)=>(Z??"").trim()||"\u2014";function z7(Z,$,Q){let J=new Map;for(let V of Z.uses){if(!$.has(V.tableId))continue;J.set(V.tableId,(J.get(V.tableId)??0)+1)}let K=null;for(let[V,G]of J){if(K===null){K=V;continue}let X=J.get(K);if(G>X){K=V;continue}if(G<X)continue;let j=Q?.get(V)??0,W=Q?.get(K)??0;if(j<W)K=V;else if(j===W&&$.get(V).localeCompare($.get(K))<0)K=V}return K}function aZ(Z,$){let Q=new Map(Z.map((K)=>[K.id,K.name])),J=new Map;for(let K of $)for(let V of K.uses){if(!Q.has(V.tableId))continue;J.set(V.tableId,(J.get(V.tableId)??0)+1)}return new Map($.map((K)=>[K.id,z7(K,Q,J)]))}var P7=(Z,$)=>Z.path.localeCompare($.path)||Z.method.localeCompare($.method)||Z.id.localeCompare($.id);function Z5(Z,$){let Q=aZ(Z,$),J=new Map,K=[];for(let Y of[...$].sort(P7)){let N=Q.get(Y.id)??null;if(N){let A=J.get(N);if(A)A.push(Y);else J.set(N,[Y])}else K.push(Y)}let V=(Y)=>{let N=J.get(Y.id)?.length??0;return ZZ(Y.columnCount)+(N?EZ+N*GZ:0)+50},G=Array.from(new Set(Z.map((Y)=>RZ(Y.domain)))),X=G.filter((Y)=>Y!=="\u2014").sort(),j=G.includes("\u2014")?[...X,"\u2014"]:X,W=new Map,U=new Map,B=0,L=0,C=0,q=0;for(let Y of j){let N=Z.filter((E)=>RZ(E.domain)===Y).sort((E,R)=>E.name.localeCompare(R.name)),A=N.reduce((E,R)=>E+V(R),0),O=Math.max(1,Math.min(12,N.length,Math.round(Math.sqrt(1.9*A/320)))),M=O*320;if(B>0&&B+M>F7)L+=C+IZ,B=0,C=0;let _=Array(O).fill(0);for(let E of N){let R=0;for(let m=1;m<O;m++)if(_[m]<_[R])R=m;let w=B+R*320,y=L+_[R];W.set(E.id,{x:w,y}),(J.get(E.id)??[]).forEach((m,vZ)=>{U.set(m.id,{x:w,y:y+ZZ(E.columnCount)+EZ+vZ*GZ})}),_[R]+=V(E)}let D=Math.max(..._,0);C=Math.max(C,D),q=Math.max(q,L+D),B+=M+D7}if(K.length){let Y=q+IZ,N=Math.max(1,Math.min(4,Math.ceil(Math.sqrt(K.length/2))));K.forEach((A,O)=>{U.set(A.id,{x:O%N*_7,y:Y+Math.floor(O/N)*GZ})})}return{tables:W,endpoints:U}}function $5(Z,$,Q){let J=aZ($,Q),K=new Map;for(let C of Q){let q=J.get(C.id);if(q)K.set(q,(K.get(q)??0)+1)}let V=(C)=>{let q=K.get(C.id)??0;return C.y+ZZ(C.columnCount)+(q?EZ+q*GZ:0)},G=RZ(Z.domain),X=$.filter((C)=>RZ(C.domain)===G);if(!X.length){let C=$.length?Math.max(...$.map(V),...Q.map((q)=>q.y+GZ)):0;return{x:0,y:$.length||Q.length?C+IZ:0}}let j=Math.min(...X.map((C)=>C.x)),W=X.map((C)=>Math.max(0,Math.round((C.x-j)/320))),U=Math.min(12,Math.max(...W)+1),B=Array(U).fill(Math.min(...X.map((C)=>C.y)));X.forEach((C,q)=>{let Y=Math.min(W[q],U-1);B[Y]=Math.max(B[Y],V(C)+50)});let L=0;for(let C=1;C<U;C++)if(B[C]<B[L])L=C;return{x:j+L*320,y:B[L]}}function Q5(Z,$,Q){let J=aZ($,[...Q,Z]),K=J.get(Z.id),V=K?$.find((X)=>X.id===K):void 0;if(V){let X=Q.filter((U)=>J.get(U.id)===V.id),j=V.y+ZZ(V.columnCount)+EZ,W=X.length?Math.max(...X.map((U)=>U.y))+GZ:j;return{x:V.x,y:W}}let G=[...$.map((X)=>X.y+ZZ(X.columnCount)),...Q.map((X)=>X.y+GZ)];return{x:0,y:G.length?Math.max(...G)+IZ:0}}function J5(Z){let $=e4-20;for(let Q=0;Q<Z.length;Q++)for(let J=Q+1;J<Z.length;J++){let K=Z[Q],V=Z[J],G=ZZ(K.columnCount),X=ZZ(V.columnCount);if(K.x<V.x+$&&K.x+$>V.x&&K.y<V.y+X&&K.y+G>V.y)return!0}return!1}import{eq as K5}from"drizzle-orm";V5();async function X5(Z=i){let[$,Q]=await Promise.all([Z.query.dbTable.findMany({with:{columns:{columns:{id:!0}}},orderBy:(V,{asc:G})=>G(V.name)}),Z.query.endpoint.findMany({with:{tables:{columns:{tableId:!0}}}})]),J=Z5($.map((V)=>({id:V.id,name:V.name,domain:V.domain,columnCount:V.columns.length})),Q.map((V)=>({id:V.id,method:V.method,path:V.path,uses:V.tables.map((G)=>({tableId:G.tableId}))}))),K=0;for(let V of $){let G=J.tables.get(V.id);if(!G||Math.round(G.x)===Math.round(V.x)&&Math.round(G.y)===Math.round(V.y))continue;await Z.update(I).set({x:G.x,y:G.y}).where(K5(I.id,V.id)),K++}for(let V of Q){let G=J.endpoints.get(V.id);if(!G||Math.round(G.x)===Math.round(V.x)&&Math.round(G.y)===Math.round(V.y))continue;await Z.update(T).set({x:G.x,y:G.y}).where(K5(T.id,V.id)),K++}return K}var f7=z.object({tables:z.array(z.object({name:z.string().trim().min(1),domain:z.string().nullish(),description:z.string().nullish(),columns:z.array(z.object({name:z.string().trim().min(1),type:z.string().trim().min(1),isPk:z.boolean().optional(),isFk:z.boolean().optional(),nullable:z.boolean().optional(),note:z.string().nullish()})).default([])})).default([]),relations:z.array(z.object({fromTable:z.string(),fromColumn:z.string(),toTable:z.string(),toColumn:z.string(),label:z.string().nullish()})).default([]),endpoints:z.array(z.object({method:z.string().trim().min(1),path:z.string().trim().min(1),domain:z.string().nullish(),description:z.string().nullish(),uses:z.array(z.object({table:z.string(),access:z.string().default("read")})).default([])})).default([])});async function kZ(Z=i){let[$]=await Z.insert(a).values({id:"singleton",version:1}).onConflictDoUpdate({target:a.id,set:{version:y7`${a.version} + 1`}}).returning();return $.version}async function G5(Z,$=i,Q={}){let J=f7.parse(Z),K=!Q.partial||J.tables.length>0,V=!Q.partial||J.endpoints.length>0,G=J.tables.map((M)=>M.name);if(K)await $.delete(I).where(G.length?v7(SZ(I.source,"INTROSPECTION"),T7(I.name,G)):SZ(I.source,"INTROSPECTION"));let X=await $.query.dbTable.findMany({columns:{id:!0,name:!0,domain:!0,x:!0,y:!0},with:{columns:{columns:{id:!0}}}}),j=await $.query.endpoint.findMany({columns:{id:!0,method:!0,path:!0,x:!0,y:!0},with:{tables:{columns:{tableId:!0}}}}),W=new Map(X.map((M)=>[M.name,M])),U=X.map((M)=>({id:M.id,name:M.name,domain:M.domain,columnCount:M.columns.length,x:M.x,y:M.y})),B=j.map((M)=>({id:M.id,method:M.method,path:M.path,uses:M.tables.map((_)=>({tableId:_.tableId})),x:M.x,y:M.y})),L=new Map;for(let M of J.tables){if(W.has(M.name))continue;let _=$5({domain:M.domain??null,columnCount:M.columns.length},U,B);L.set(M.name,_),U.push({id:`new:${M.name}`,name:M.name,domain:M.domain??null,columnCount:M.columns.length,..._})}let C=new Map;for(let M of J.tables){let _=W.get(M.name),D=L.get(M.name),E=_?.x??D?.x??0,R=_?.y??D?.y??0,[w]=await $.insert(I).values({name:M.name,domain:M.domain??null,description:M.description??null,source:"INTROSPECTION",x:E,y:R}).onConflictDoUpdate({target:I.name,set:{domain:M.domain??null,description:M.description??null,source:"INTROSPECTION"}}).returning();if(C.set(M.name,w.id),await $.delete(e).where(SZ(e.tableId,w.id)),M.columns.length)await $.insert(e).values(M.columns.map((y,P)=>({tableId:w.id,name:y.name,type:y.type,isPk:y.isPk??!1,isFk:y.isFk??!1,nullable:y.nullable??!0,note:y.note??null,ord:P})))}let q=[...C.values()];if(q.length)await $.delete(l).where(w7(tZ(l.fromTableId,q),tZ(l.toTableId,q)));for(let M of J.relations){let _=C.get(M.fromTable),D=C.get(M.toTable);if(!_||!D)continue;await $.insert(l).values({fromTableId:_,toTableId:D,fromColumn:M.fromColumn,toColumn:M.toColumn,label:M.label??`${M.fromColumn} \u2192 ${M.toTable}.${M.toColumn}`})}let Y=new Set(J.endpoints.map((M)=>`${M.method} ${M.path}`));if(V){let _=(await $.query.endpoint.findMany({where:(D,{eq:E})=>E(D.source,"INTROSPECTION")})).filter((D)=>!Y.has(`${D.method} ${D.path}`)).map((D)=>D.id);if(_.length)await $.delete(T).where(tZ(T.id,_))}for(let M of U)if(M.id.startsWith("new:"))M.id=C.get(M.name)??M.id;for(let M of J.endpoints){let _=await $.query.endpoint.findFirst({where:(w,{and:y,eq:P})=>y(P(w.method,M.method),P(w.path,M.path))}),D,E;if(_)D=_.x,E=_.y;else{let w={id:`new:${M.method} ${M.path}`,method:M.method,path:M.path,uses:M.uses.map((P)=>({tableId:C.get(P.table)??""})).filter((P)=>P.tableId)},y=Q5(w,U,B);D=y.x,E=y.y,B.push({...w,x:D,y:E})}let[R]=await $.insert(T).values({method:M.method,path:M.path,domain:M.domain??null,description:M.description??null,source:"INTROSPECTION",x:D,y:E}).onConflictDoUpdate({target:[T.method,T.path],set:{domain:M.domain??null,description:M.description??null,source:"INTROSPECTION"}}).returning();if(!Q.partial||M.uses.length>0)await $.delete(o).where(SZ(o.endpointId,R.id));for(let w of M.uses){let y=C.get(w.table)??(await $.query.dbTable.findFirst({where:(P,{eq:m})=>m(P.name,w.table)}))?.id;if(!y)continue;await $.insert(o).values({endpointId:R.id,tableId:y,access:w.access})}}await t4($);let N=await $.query.dbTable.findMany({where:(M,{eq:_})=>_(M.source,"INTROSPECTION"),columns:{x:!0,y:!0},with:{columns:{columns:{id:!0}}}}),A=await $.select({x:T.x,y:T.y}).from(T);if(J5(N.map((M)=>({x:M.x,y:M.y,columnCount:M.columns.length})))||s4(A))await X5($);let O=await kZ($);return{tables:J.tables.length,relations:J.relations.length,endpoints:J.endpoints.length,version:O}}var M5=d.object({files:d.array(d.object({path:d.string().trim().min(1),root:d.string().nullish(),lang:d.string().nullish(),mtimeMs:d.number().nullish(),size:d.number().nullish()})).default([]),edges:d.array(d.object({from:d.string().trim().min(1),to:d.string().trim().min(1)})).default([])});function j5(Z,$){let Q=new Map;for(let L of Z)Q.set(L,[]);for(let L of $)Q.get(L.from)?.push(L.to);let J=new Map,K=new Map,V=new Set,G=[],X=new Map,j=[],W=0,U=0;for(let L of Z){if(J.has(L))continue;let C=[{v:L,iter:0}];J.set(L,W),K.set(L,W),W++,G.push(L),V.add(L);while(C.length){let q=C[C.length-1],Y=Q.get(q.v)??[];if(q.iter<Y.length){let N=Y[q.iter++];if(!J.has(N))J.set(N,W),K.set(N,W),W++,G.push(N),V.add(N),C.push({v:N,iter:0});else if(V.has(N))K.set(q.v,Math.min(K.get(q.v),J.get(N)))}else{if(K.get(q.v)===J.get(q.v)){let A=0,O;do O=G.pop(),V.delete(O),X.set(O,U),A++;while(O!==q.v);j.push(A),U++}C.pop();let N=C[C.length-1];if(N)K.set(N.v,Math.min(K.get(N.v),K.get(q.v)))}}}let B=new Set;for(let L of $){let C=X.get(L.from);if(C!==void 0&&C===X.get(L.to)&&j[C]>1)B.add(`${L.from}|${L.to}`)}return B}async function U5(Z,$=i){let Q=M5.parse(Z),J=Q.files.map((B)=>B.path),K=new Set(J),V=Q.edges.filter((B)=>K.has(B.from)&&K.has(B.to)&&B.from!==B.to),G=j5(J,V),X=new Map,j=new Map;for(let B of V)j.set(B.from,(j.get(B.from)??0)+1),X.set(B.to,(X.get(B.to)??0)+1);await $.delete(f).where(x7(f.path,J));for(let B of Q.files){let L={root:B.root??null,lang:B.lang??null,mtimeMs:B.mtimeMs??null,size:B.size??null,inDegree:X.get(B.path)??0,outDegree:j.get(B.path)??0};await $.insert(f).values({path:B.path,...L}).onConflictDoUpdate({target:f.path,set:L})}await $.delete(u);let W=0;if(V.length)await $.insert(u).values(V.map((B)=>{let L=G.has(`${B.from}|${B.to}`);if(L)W++;return{fromPath:B.from,toPath:B.to,circular:L}}));let U=await kZ($);return await $.update(a).set({codeGraphSyncedAt:new Date}).where(HZ(a.id,"singleton")),{files:Q.files.length,edges:V.length,circular:W,version:U}}var g7=(Z,$)=>`${Z}\x00${$}`;function eZ(Z){let $=M5.parse(Z),Q=$.files.map((U)=>U.path),J=new Set(Q),K=$.edges.filter((U)=>J.has(U.from)&&J.has(U.to)&&U.from!==U.to),V=j5(Q,K),G=new Map,X=new Map;for(let U of K)X.set(U.from,(X.get(U.from)??0)+1),G.set(U.to,(G.get(U.to)??0)+1);let j=new Map;for(let U of $.files)j.set(U.path,{root:U.root??null,lang:U.lang??null,mtimeMs:U.mtimeMs??null,size:U.size??null,inDegree:G.get(U.path)??0,outDegree:X.get(U.path)??0});let W=new Map;for(let U of K)W.set(g7(U.from,U.to),{from:U.from,to:U.to,circular:V.has(`${U.from}|${U.to}`)});return{files:j,edges:W}}var h7=(Z,$)=>Z.root===$.root&&Z.lang===$.lang&&Z.mtimeMs===$.mtimeMs&&Z.size===$.size&&Z.inDegree===$.inDegree&&Z.outDegree===$.outDegree;async function H5(Z,$,Q=i){for(let[X,j]of $.files){let W=Z.files.get(X);if(W&&h7(W,j))continue;let U={root:j.root,lang:j.lang,mtimeMs:j.mtimeMs,size:j.size,inDegree:j.inDegree,outDegree:j.outDegree};await Q.insert(f).values({path:X,...U}).onConflictDoUpdate({target:f.path,set:U})}let J=[...Z.files.keys()].filter((X)=>!$.files.has(X));if(J.length)await Q.delete(f).where(u7(f.path,J));for(let[X,j]of Z.edges)if(!$.edges.has(X))await Q.delete(u).where(Y5(HZ(u.fromPath,j.from),HZ(u.toPath,j.to)));let K=[];for(let[X,j]of $.edges){let W=Z.edges.get(X);if(!W)K.push({fromPath:j.from,toPath:j.to,circular:j.circular});else if(W.circular!==j.circular)await Q.update(u).set({circular:j.circular}).where(Y5(HZ(u.fromPath,j.from),HZ(u.toPath,j.to)))}if(K.length)await Q.insert(u).values(K);let V=await kZ(Q);await Q.update(a).set({codeGraphSyncedAt:new Date}).where(HZ(a.id,"singleton"));let G=0;for(let X of $.edges.values())if(X.circular)G++;return{files:$.files.size,edges:$.edges.size,circular:G,version:V}}var l7=/[/\\](node_modules|\.git|\.next|dist|build|__pycache__|target|\.venv|venv|\.beacon|\.playwright-mcp|generated|coverage)[/\\]/;function d7(Z){try{let $=qZ(Z,"beacon.config.json");if(L5($)){let Q=JSON.parse(b7($,"utf8"));if(Array.isArray(Q.roots)&&Q.roots.length)return Q.roots.map((J)=>p7(Z,J))}}catch{}return[Z]}function N5(Z){let $=d7(Z.path),Q=hZ(Z.id),J=lZ(JZ(Z.id)),K=c4($,Z.path);async function V(){let Y=r4(K.snapshot().files.map((_)=>_.path));for(let _ of $)for(let D of["prisma/schema.prisma","schema.prisma"]){let E=qZ(_,D);if(L5(E))Y.push(G(E))}let N=[];for(let _ of Y)try{N.push({path:_,content:await W5(qZ(Z.path,_),"utf8")})}catch{}let A=d4(N),O=n4(N);if(!A.tables.length&&!O.length)return;if(O.length&&A.tableVars&&Object.keys(A.tableVars).length){let D=K.snapshot().edges,E=new Set(O.map((P)=>P.file)),R=new Map;for(let P of D){let m=R.get(P.from)??[];m.push(P.to),R.set(P.from,m)}for(let P=0;P<2;P++)for(let m of[...E])for(let vZ of R.get(m)??[])E.add(vZ);let w=new Map;for(let P of[...E].slice(0,600))try{w.set(P,await W5(qZ(Z.path,P),"utf8"))}catch{}let y=p4({routeFiles:[...new Set(O.map((P)=>P.file))],edges:D,content:(P)=>w.get(P)??null,tableVars:A.tableVars});for(let P of O)P.uses=y.get(P.file)??[]}let M=await G5({tables:A.tables,relations:A.relations,endpoints:O},J,{partial:!0});console.log(`[beacon-inline] schema synced (${Z.name}): ${M.tables} tables / ${M.endpoints} endpoints`)}function G(Y){return c7(Z.path,Y).split(/[\\/]/).join("/")}let X=null,j=!1,W=new Set,U=null,B=!1;async function L(){if(B){C();return}B=!0;try{if(await Q,j)X=null,j=!1;if(X===null){let O=await K.seed(),M=await U5(O,J);X=eZ(O),console.log(`[beacon-inline] code-graph synced (${Z.name}): ${M.files} files / ${M.edges} imports${M.circular>0?` (${M.circular} circular)`:""}`),await V();return}let Y=[...W];W.clear();let N=Y.some((O)=>sZ(G(O))),A=!1;for(let O of Y)if(await K.applyChange(O))A=!0;if(A){let O=eZ(K.snapshot()),M=await H5(X,O,J);X=O,console.log(`[beacon-inline] code-graph updated (${Z.name}): ${M.files} files / ${M.edges} imports${M.circular>0?` (${M.circular} circular)`:""}`)}if(N)await V()}catch(Y){console.error(`[beacon-inline] error (${Z.name}):`,Y instanceof Error?Y.message:Y)}finally{B=!1}}function C(){if(U)clearTimeout(U);U=setTimeout(L,600)}let q=[];for(let Y of $)try{let N=m7(Y,{recursive:!0,persistent:!0},(A,O)=>{if(!O){j=!0,C();return}let M=String(O);if(l7.test(`/${M}`))return;W.add(qZ(Y,M)),C()});N.on("error",(A)=>console.error(`[beacon-inline] watcher error (${Z.name}):`,A)),q.push(N)}catch(N){console.error(`[beacon-inline] live watch unavailable for ${Y} (${Z.name}):`,N instanceof Error?N.message:N)}return console.log(`[beacon-inline] watching ${Z.name} (${$.join(", ")}) \u2014 initial extract\u2026`),L(),{async stop(){if(U)clearTimeout(U);for(let Y of q)Y.close()}}}function r7(Z){let $=Z.limit??6,Q=Z.hardCap??12,J=new Map,K=0,V=new Set;function G(Y){let N=J.get(Y);if(N)N.seq=++K}function X(Y){if(J.has(Y.id))return G(Y.id);if(!Z.exists(Y.path))return;J.set(Y.id,{handle:Z.start(Y),seq:++K})}function j(){let Y=null,N=1/0;for(let[A,O]of J){if(V.has(A))continue;if(O.seq<N)N=O.seq,Y=A}if(Y)J.get(Y).handle.stop(),J.delete(Y)}function W(){let Y=Z.list().filter((N)=>Z.exists(N.path)).slice(0,$);V=new Set(Y.map((N)=>N.id));for(let N of Y)X(N);for(let[N,A]of[...J]){let O=Z.get(N);if(!O||!Z.exists(O.path))A.handle.stop(),J.delete(N)}}function U(Y){if(J.has(Y))return G(Y);let N=Z.get(Y);if(!N||!Z.exists(N.path))return;if(J.size>=Q)j();if(J.size>=Q)return;J.set(Y,{handle:Z.start(N),seq:++K})}async function B(Y){let N=J.get(Y);if(!N)return;J.delete(Y),await N.handle.stop()}function L(Y){return J.has(Y)}function C(){return[...J.keys()]}async function q(){await Promise.all([...J.values()].map((Y)=>Y.handle.stop())),J.clear()}return{reconcile:W,ensureWatcher:U,stopWatcher:B,isWatching:L,activeIds:C,stopAll:q}}var o7=r7({list:gZ,get:x,exists:n7,start:(Z)=>N5(Z)});async function C5(Z){await o7.stopWatcher(Z)}async function B5(Z){if(!x(Z))return{ok:!1,removed:!1,fallbackId:r(),error:"unknown workspace"};Y4(Z),await C5(Z),N4(JZ(Z)),W4(Z);try{i7(n(Z),{recursive:!0,force:!0})}catch($){return{ok:!1,removed:!0,fallbackId:r(),error:$ instanceof Error?$.message:String($)}}return{ok:!0,removed:!0,fallbackId:r()}}var Z4=process.argv.slice(3),A5=Z4.includes("--yes")||Z4.includes("-y"),YZ=Z4.find((Z)=>!Z.startsWith("-")),q5=(Z)=>`\x1B[32m\u2713\x1B[0m ${Z}`,_5=(Z)=>`\x1B[2m${Z}\x1B[0m`,D5=(Z)=>`
|
|
5
|
+
\x1B[1m${Z}\x1B[0m`;function t7(){if(!YZ)return x(WZ(uZ(process.cwd())));if(/^[0-9a-f]{12}$/.test(YZ)){let Z=x(YZ);if(Z)return Z}return x(WZ(uZ(O5(YZ))))}var s=t7();if(!s)console.error(`[beacon] ${YZ??process.cwd()} is not a registered Beacon workspace \u2014 nothing to remove.`),process.exit(1);console.log(D5(A5?"Beacon \xB7 remove workspace":"Beacon \xB7 remove workspace (dry run)"));console.log(` name: ${s.name}${r()===s.id?" (currently active)":""}`);console.log(` repo: ${s.path} ${_5("(untouched \u2014 only Beacon's data is erased)")}`);console.log(` data: ${n(s.id)} ${_5("(deleted)")}`);if(!A5)console.log(D5("Nothing was changed.")),console.log(` Run \x1B[1mbeacon remove${YZ?` ${YZ}`:""} --yes\x1B[0m to apply.
|
|
6
|
+
`),process.exit(0);async function e7(Z){try{let{pid:$,port:Q}=JSON.parse(a7(O5(QZ(),"server.json"),"utf8"));if(!$||!Q)return!1;return process.kill($,0),(await fetch(`http://localhost:${Q}/api/workspace`,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({id:Z}),signal:AbortSignal.timeout(1e4)})).ok}catch{return!1}}if(await e7(s.id))console.log(` ${q5(`removed ${s.name} (via the running daemon)`)}
|
|
7
|
+
`);else{let Z=await B5(s.id);if(!Z.ok)console.error(`[beacon] remove failed: ${Z.error??"unknown error"}`),process.exit(1);console.log(` ${q5(`removed ${s.name}`)}
|
|
8
|
+
`)}if(s7(n(s.id)))console.error(`[beacon] warning: ${n(s.id)} still exists \u2014 remove it manually.`),process.exit(1);
|
package/dist/bin/uninstall.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var
|
|
3
|
+
var xZ=Object.defineProperty;var vZ=(Q)=>Q;function NZ(Q,Z){this[Q]=vZ.bind(null,Z)}var XQ=(Q,Z)=>{for(var $ in Z)xZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:NZ.bind(Z,$)})};var F=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var jQ={};XQ(jQ,{removeRepoAssets:()=>HQ,installRefreshSkill:()=>GZ,installPlanSkill:()=>KZ,installInitSkill:()=>uZ,installCodexRepoSkills:()=>MZ,ensureWorkflowDoc:()=>fZ,ensureMcp:()=>wZ,auditRepo:()=>TZ,REFRESH_SKILL:()=>PQ,PLAN_SKILL:()=>_Q,INIT_SKILL:()=>UQ});import{existsSync as M,mkdirSync as k,readFileSync as x,rmSync as y,writeFileSync as H}from"fs";import{join as q}from"path";function uZ(Q){let Z=q(Q,".claude","skills","beacon-init");k(Z,{recursive:!0});let $=q(Z,"SKILL.md");return H($,UQ),$}function GZ(Q){let Z=q(Q,".claude","skills","beacon-refresh");k(Z,{recursive:!0});let $=q(Z,"SKILL.md");return H($,PQ),$}function KZ(Q){let Z=q(Q,".claude","skills","beacon-plan");k(Z,{recursive:!0});let $=q(Z,"SKILL.md");return H($,_Q),$}function MZ(Q){let Z=[];for(let $ of CZ){let J=q(Q,".agents","skills",$.name);k(J,{recursive:!0});let Y=q(J,"SKILL.md");H(Y,$.body()),Z.push(Y)}return Z}function fZ(Q){let Z=q(Q,"AGENTS.md"),$="";try{$=x(Z,"utf8")}catch{}let J=new RegExp(`${_}[\\s\\S]*?${WQ}`);$=J.test($)?$.replace(J,kQ):`${$.trim()}
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${kQ}
|
|
6
6
|
`.trimStart(),H(Z,$.endsWith(`
|
|
7
7
|
`)?$:`${$}
|
|
8
|
-
`);let Y=q(Q,"CLAUDE.md"),V="";try{V=
|
|
8
|
+
`);let Y=q(Q,"CLAUDE.md"),V="";try{V=x(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))H(Y,`${V?`${V.trim()}
|
|
9
9
|
|
|
10
10
|
`:""}@AGENTS.md
|
|
11
|
-
`)}function
|
|
12
|
-
`),{path:Z,added:!0}}function
|
|
13
|
-
`)}}catch{}let Y=!1,V=q(Q,"AGENTS.md");try{let z=
|
|
11
|
+
`)}function wZ(Q){let Z=q(Q,".mcp.json"),$={};try{$=JSON.parse(x(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},H(Z,JSON.stringify($,null,2)+`
|
|
12
|
+
`),{path:Z,added:!0}}function TZ(Q){let Z=q(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(x(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=x(q(Q,"AGENTS.md"),"utf8").includes(_)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(x(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":M(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":M(q(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":M(q(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":M(q(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function HQ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let P=q(Q,".claude","skills",z);if(M(P))y(P,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let P=q(Q,".agents","skills",z);if(M(P))y(P,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=q(Q,".mcp.json");try{let z=JSON.parse(x(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)y(J,{force:!0});else H(J,JSON.stringify(z,null,2)+`
|
|
13
|
+
`)}}catch{}let Y=!1,V=q(Q,"AGENTS.md");try{let z=x(V,"utf8"),P=new RegExp(`\\n?${_}[\\s\\S]*?${WQ}\\n?`);if(P.test(z)){let qQ=z.replace(P,`
|
|
14
14
|
`).replace(/\n{3,}/g,`
|
|
15
15
|
|
|
16
|
-
`).trimStart();H(V,
|
|
17
|
-
`)?
|
|
18
|
-
`),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=
|
|
16
|
+
`).trimStart();H(V,qQ.endsWith(`
|
|
17
|
+
`)?qQ:`${qQ}
|
|
18
|
+
`),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=x(U,"utf8"),P=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==z){if(!P.trim())y(U,{force:!0});else H(U,P);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:X}}var UQ=`---
|
|
19
19
|
name: beacon-init
|
|
20
20
|
description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
|
|
21
21
|
---
|
|
@@ -52,7 +52,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
52
52
|
If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
|
|
53
53
|
|
|
54
54
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
55
|
-
`,
|
|
55
|
+
`,PQ=`---
|
|
56
56
|
name: beacon-refresh
|
|
57
57
|
description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
|
|
58
58
|
---
|
|
@@ -99,7 +99,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
99
99
|
If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
|
|
100
100
|
|
|
101
101
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
102
|
-
`,
|
|
102
|
+
`,_Q=`---
|
|
103
103
|
name: beacon-plan
|
|
104
104
|
description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
|
|
105
105
|
---
|
|
@@ -141,7 +141,7 @@ If it returns feedback, revise and call it again.
|
|
|
141
141
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
142
142
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
143
143
|
run \`beacon\` in this repo once.
|
|
144
|
-
`,CZ,_="<!-- beacon:workflow:start -->",
|
|
144
|
+
`,CZ,_="<!-- beacon:workflow:start -->",WQ="<!-- beacon:workflow:end -->",kQ;var L=F(()=>{CZ=[{name:"beacon-init",body:()=>UQ},{name:"beacon-refresh",body:()=>PQ}];kQ=`${_}
|
|
145
145
|
## Beacon \u2014 feature workflow
|
|
146
146
|
|
|
147
147
|
This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
|
|
@@ -197,18 +197,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
197
197
|
If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
|
|
198
198
|
|
|
199
199
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
200
|
-
${
|
|
201
|
-
`)}function c(Q,Z){let $=
|
|
200
|
+
${WQ}`});import{existsSync as LQ,mkdirSync as BQ,readFileSync as S,rmSync as FZ,writeFileSync as p}from"fs";import{dirname as hQ,join as h}from"path";function xQ(Q){try{return JSON.parse(S(Q,"utf8"))}catch{return{}}}function SQ(Q,Z){BQ(hQ(Q),{recursive:!0}),p(Q,JSON.stringify(Z,null,2)+`
|
|
201
|
+
`)}function c(Q,Z){let $=xQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((X)=>X.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),SQ(Q,$),!0}function l(Q,Z){return(xQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function t(Q,Z){let $=xQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((X)=>{let U=X.hooks?.length??0,z=(X.hooks??[]).filter((P)=>P.command!==Z.command);if(z.length!==U)Y=!0;return{...X,hooks:z}}).filter((X)=>(X.hooks??[]).length>0);if(!Y)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return SQ(Q,$),!0}function n(Q,Z,$,J){let Y=`${Z}
|
|
202
202
|
${J.trim()}
|
|
203
203
|
${$}`,V="";try{V=S(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,Y):V.trim()?`${V.trim()}
|
|
204
204
|
|
|
205
205
|
${Y}
|
|
206
206
|
`:`${Y}
|
|
207
|
-
`,
|
|
207
|
+
`,BQ(hQ(Q),{recursive:!0}),p(Q,V.endsWith(`
|
|
208
208
|
`)?V:`${V}
|
|
209
|
-
`)}function g(Q,Z){try{return S(Q,"utf8").includes(Z)}catch{return!1}}function
|
|
209
|
+
`)}function g(Q,Z){try{return S(Q,"utf8").includes(Z)}catch{return!1}}function a(Q,Z,$){let J="";try{J=S(Q,"utf8")}catch{return!1}let Y=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!Y.test(J))return!1;let V=J.replace(Y,"").replace(/\n{3,}/g,`
|
|
210
210
|
|
|
211
|
-
`).trimStart();return p(Q,V),!0}function
|
|
211
|
+
`).trimStart();return p(Q,V),!0}function d(Q,Z,$){let J=h(Q,Z);BQ(J,{recursive:!0});let Y=h(J,"SKILL.md");return p(Y,$),Y}function R(Q,Z){return LQ(h(Q,Z,"SKILL.md"))}function s(Q,Z){let $=h(Q,Z);if(!LQ($))return!1;return FZ($,{recursive:!0,force:!0}),!0}var W,m=`## Beacon (visual planning panel)
|
|
212
212
|
|
|
213
213
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
214
214
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -229,20 +229,20 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
229
229
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
230
230
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
231
231
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
232
|
-
verbatim. Do NOT implement until the tool returns approval.`;var vQ=F(()=>{W=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as gZ,renameSync as RZ,rmSync as EZ,writeFileSync as IZ}from"fs";import{dirname as bZ}from"path";function
|
|
232
|
+
verbatim. Do NOT implement until the tool returns approval.`;var vQ=F(()=>{W=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as gZ,renameSync as RZ,rmSync as EZ,writeFileSync as IZ}from"fs";import{dirname as bZ}from"path";function NQ(Q,Z){gZ(bZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{IZ($,Z),RZ($,Q)}catch(J){throw EZ($,{force:!0}),J}}var pQ=()=>{};var sQ={};XQ(sQ,{setupCodexAssets:()=>yZ,removeCodexMcp:()=>dQ,removeCodexArtifacts:()=>fQ,hasCodexMcp:()=>CQ,ensureCodexMcp:()=>aQ,codexMcpProblem:()=>AZ,codexDetected:()=>lQ,auditCodex:()=>MQ,CODEX_HOOKS:()=>w});import{readFileSync as e}from"fs";import{homedir as DZ}from"os";import{join as b}from"path";function mQ(){return process.env.HOME||process.env.USERPROFILE||DZ()}function lQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(uQ===void 0)uQ=Bun.which("codex")!==null;return uQ}function I(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function CQ(){try{return Boolean(I(e(f(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function AZ(){let Q="";try{Q=e(f(),"utf8")}catch{return null}let Z=I(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${E}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${E}`;return null}function aQ(){let Q="",Z=!1;try{Q=e(f(),"utf8"),Z=!0}catch{}if(Z){let V=I(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${E}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${E}`}}let $=!Q?"":Q.endsWith(`
|
|
233
233
|
`)?`
|
|
234
234
|
`:`
|
|
235
235
|
|
|
236
|
-
`,J=Q+$+OZ;if(I(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${E}`};return
|
|
237
|
-
`),$=Z.indexOf(
|
|
236
|
+
`,J=Q+$+OZ;if(I(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${E}`};return NQ(f(),J),{added:!0}}function dQ(){let Q="";try{Q=e(f(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
237
|
+
`),$=Z.indexOf(tQ);if($===-1)return{removed:!1,skipped:CQ()};let J=Z.indexOf(nQ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
|
|
238
238
|
`).replace(/\n{3,}/g,`
|
|
239
239
|
|
|
240
|
-
`).replace(/^\n+/,"");if(I(Y)===null)return{removed:!1,skipped:!0};return
|
|
240
|
+
`).replace(/^\n+/,"");if(I(Y)===null)return{removed:!1,skipped:!0};return NQ(f(),Y),{removed:!0}}async function yZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (L(),jQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let z of W){if(!R(o(),z))Y.push(z);d(o(),z,J[z])}let V=0;for(let z of w)if(c(KQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=g(r(),i);n(r(),i,cQ,m);let U=aQ();return{skillsAdded:Y,hooksAdded:V,agentsMdBlockTouched:!X,mcp:U}}function MQ(){let Q={};for(let $ of W)Q[$]=R(o(),$);let Z={};for(let $ of w)Z[$.event]=l(KQ(),{event:$.event,command:$.command});return{detected:lQ(),skills:Q,hooks:Z,agentsMdBlock:g(r(),i),mcp:CQ()}}function fQ(){let Q=[];for(let Y of W)if(s(o(),Y))Q.push(Y);let Z=0;for(let Y of w)if(t(KQ(),{event:Y.event,command:Y.command}))Z++;let $=a(r(),i,cQ),J=dQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var GQ=()=>b(mQ(),".codex"),KQ=()=>b(GQ(),"hooks.json"),f=()=>b(GQ(),"config.toml"),r=()=>b(GQ(),"AGENTS.md"),o=()=>b(mQ(),".agents","skills"),i="<!-- beacon:global:start -->",cQ="<!-- beacon:global:end -->",w,uQ,tQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",nQ="# beacon:end",OZ,E="add it manually: codex mcp add beacon -- beacon mcp";var wQ=F(()=>{vQ();pQ();w=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];OZ=`${tQ}
|
|
241
241
|
[mcp_servers.beacon]
|
|
242
242
|
command = "beacon"
|
|
243
243
|
args = ["mcp"]
|
|
244
|
-
${
|
|
245
|
-
`});var
|
|
246
|
-
\x1B[1m${Q}\x1B[0m`,BZ=(Q)=>`\x1B[33m!\x1B[0m ${Q}`,G
|
|
247
|
-
`),process.exit(0);console.log(
|
|
244
|
+
${nQ}
|
|
245
|
+
`});var $Z={};XQ($Z,{provisionDb:()=>V0});import{createClient as dZ}from"@libsql/client";import{drizzle as sZ}from"drizzle-orm/libsql";import{migrate as rZ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as oZ}from"drizzle-orm/migrator";import{dirname as EQ,join as iZ}from"path";import{fileURLToPath as eZ}from"url";async function $Q(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function J0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function ZZ(Q){if(!await $Q(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function Y0(Q){for(let[Z,$]of Object.entries($0)){if(!await $Q(Q,Z))continue;let J=await J0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function V0(Q,Z=Z0){let $=dZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;");let J=await $Q($,"__drizzle_migrations"),Y=await $Q($,"Node"),V=!1;if(Y&&!J){let U=oZ({migrationsFolder:Z})[0];if(U)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[U.hash,U.folderMillis]}),V=!0}let X=await ZZ($);if(await rZ(sZ($),{migrationsFolder:Z}),await ZZ($)>X)V=!0;return await Y0($),{migrated:V}}finally{$.close()}}var Q0,Z0,$0;var JZ=F(async()=>{Q0=EQ(EQ(EQ(eZ(import.meta.url)))),Z0=process.env.BEACON_MIGRATIONS_DIR||iZ(Q0,"drizzle"),$0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});vQ();import{existsSync as kZ}from"fs";import{homedir as _Z}from"os";import{join as QQ}from"path";function LZ(){return process.env.HOME||process.env.USERPROFILE||_Z()}var ZQ=()=>QQ(LZ(),".claude"),TQ=()=>QQ(ZQ(),"skills"),FQ=()=>QQ(ZQ(),"settings.json"),gQ=()=>QQ(ZQ(),"CLAUDE.md"),RQ="<!-- beacon:global:start -->",rQ="<!-- beacon:global:end -->";var hZ=m,D=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function SZ(Q,Z){return d(TQ(),Q,Z)}function oQ(Q){return R(TQ(),Q)}function pZ(Q){return s(TQ(),Q)}function mZ(Q){return c(FQ(),Q)}function cZ(Q){return l(FQ(),Q)}function lZ(Q){return t(FQ(),Q)}function tZ(Q){n(gQ(),RQ,rQ,Q)}function iQ(){return g(gQ(),RQ)}function nZ(){return a(gQ(),RQ,rQ)}function eQ(){let Q={};for(let $ of W)Q[$]=oQ($);let Z={};for(let $ of D)Z[$.event]=cZ({event:$.event,command:$.command});return{homeExists:kZ(ZQ()),skills:Q,hooks:Z,claudeMdBlock:iQ()}}async function aZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (L(),jQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let U of W){if(!oQ(U))Y.push(U);SZ(U,J[U])}let V=0;for(let U of D)if(mZ({event:U.event,matcher:U.matcher,command:U.command}))V++;let X=iQ();return tZ(hZ),{skillsAdded:Y,hooksAdded:V,claudeMdBlockTouched:!X}}async function h0(){let Q;try{Q={ok:!0,...await aZ()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (wQ(),sQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function QZ(){let Q=[];for(let J of W)if(pZ(J))Q.push(J);let Z=0;for(let J of D)if(lZ(J))Z++;let $=nZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as z0}from"async_hooks";import{spawnSync as q0}from"child_process";import{createHash as X0}from"crypto";import{existsSync as YZ,mkdirSync as JQ,readFileSync as VZ,writeFileSync as zZ}from"fs";import{homedir as U0}from"os";import{basename as P0,join as u}from"path";function G(){return process.env.BEACON_HOME||u(U0(),".beacon")}function bQ(){return u(G(),"workspaces.json")}function qZ(Q){return X0("sha256").update(Q).digest("hex").slice(0,12)}function e0(Q=process.cwd()){let Z=q0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function YQ(Q){return u(G(),Q)}function W0(Q){return`file:${u(YQ(Q),"db.sqlite")}`}function O(){try{let Q=JSON.parse(VZ(bQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function DQ(Q){JQ(G(),{recursive:!0}),zZ(bQ(),JSON.stringify(Q,null,2))}function OQ(){return O().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function N(Q){return O().find((Z)=>Z.id===Q)??null}function H0(Q,Z,$=new Date().toISOString()){let J=qZ(Q),Y=O(),V=Y.find((z)=>z.id===J),X={id:J,path:Q,name:Z||V?.name||P0(Q),lastOpenedAt:$},U=[X,...Y.filter((z)=>z.id!==J)];return JQ(YQ(J),{recursive:!0}),DQ(U),X}function Q1(Q,Z=new Date().toISOString()){let $=O(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,DQ($)}function Z1(Q){if(DQ(O().filter((Z)=>Z.id!==Q)),AQ()===Q)j0(OQ()[0]?.id??null)}function XZ(){return u(G(),"active")}function AQ(){try{return VZ(XZ(),"utf8").trim()||null}catch{return null}}function j0(Q){JQ(G(),{recursive:!0}),zZ(XZ(),Q??"")}function $1(){let Q=AQ();return Q?N(Q):null}function J1(){let Q=x0()??AQ();return Q?N(Q):null}function Y1(Q){return N(Q)?.path??null}function V1(){return YZ(bQ())}var UZ="beacon_ws";function PZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function z1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&N(Z))return Z;let $=PZ(Q,UZ);if($&&N($))return $;return null}var B0="x-beacon-workspace-path";async function q1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&N(Z))return Z;let $=Q.headers.get(B0);if($&&(!Z||qZ($)===Z)){let Y=H0($);return await v0(Y.id),Y.id}let J=PZ(Q,UZ);if(J&&N(J))return J;return null}var WZ=new z0;function X1(Q,Z){return Q?WZ.run(Q,Z):Z()}function x0(){return WZ.getStore()??null}var IQ=new Set;function U1(Q){IQ.delete(u(YQ(Q),"db.sqlite"))}async function v0(Q){let Z=YQ(Q),$=u(Z,"db.sqlite"),J=YZ($);if(J&&IQ.has($))return{ok:!0,created:!1,migrated:!1};try{JQ(Z,{recursive:!0});let{provisionDb:Y}=await JZ().then(() => $Z),V=await Y(W0(Q));return IQ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}L();wQ();import{existsSync as VQ,readFileSync as N0,rmSync as u0}from"fs";import{join as G0}from"path";var HZ=process.argv.slice(3),jZ=HZ.includes("--yes")||HZ.includes("-y"),B=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,j=(Q)=>`\x1B[2m${Q}\x1B[0m`,C=(Q)=>`
|
|
246
|
+
\x1B[1m${Q}\x1B[0m`,BZ=(Q)=>`\x1B[33m!\x1B[0m ${Q}`,K=G(),A=OQ(),yQ=eQ();console.log(C(jZ?"Beacon \xB7 uninstall":"Beacon \xB7 uninstall (dry run)"));console.log(C("Global"));console.log(` ${VQ(K)?`wipe ${K} (${A.length} workspaces)`:`${j(`${K} \u2014 already gone`)}`}`);for(let Q of W)console.log(` ${yQ.skills[Q]?`remove ~/.claude/skills/${Q}/`:j(`skill ${Q} \u2014 already gone`)}`);for(let Q of D)console.log(` ${yQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command}`:j(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${yQ.claudeMdBlock?"strip Beacon block from ~/.claude/CLAUDE.md":j("global CLAUDE.md block \u2014 already gone")}`);var zQ=MQ();console.log(C("Codex"));for(let Q of W)console.log(` ${zQ.skills[Q]?`remove ~/.agents/skills/${Q}/`:j(`skill ${Q} \u2014 already gone`)}`);for(let Q of w)console.log(` ${zQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command} from ~/.codex/hooks.json`:j(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${zQ.agentsMdBlock?"strip Beacon block from ~/.codex/AGENTS.md":j("global ~/.codex/AGENTS.md block \u2014 already gone")}`);console.log(` ${zQ.mcp?"strip [mcp_servers.beacon] from ~/.codex/config.toml (if Beacon wrote it)":j("config.toml beacon entry \u2014 already gone")}`);if(A.length){console.log(C(`Per-repo (${A.length})`));for(let Q of A){if(!VQ(Q.path)){console.log(` ${j(`${Q.path} \u2014 repo no longer on disk, skipping`)}`);continue}console.log(` ${Q.path}`),console.log(` ${j("strip beacon entry from .mcp.json, workflow block from AGENTS.md, skills, CLAUDE.md @-import")}`)}}if(!jZ)console.log(C("Nothing was changed.")),console.log(" Run \x1B[1mbeacon uninstall --yes\x1B[0m to apply."),console.log(` The \x1B[1mbeacon\x1B[0m binary itself (the cloned source + your PATH symlink) is NOT removed by this \u2014 your install script handles that.
|
|
247
|
+
`),process.exit(0);console.log(C("Applying\u2026"));var T=QZ();if(T.skillsRemoved.length)console.log(` ${B(`removed skills: ${T.skillsRemoved.join(", ")}`)}`);if(T.hooksRemoved)console.log(` ${B(`removed ${T.hooksRemoved} hook${T.hooksRemoved===1?"":"s"} from ~/.claude/settings.json`)}`);if(T.claudeMdBlockRemoved)console.log(` ${B("stripped Beacon block from ~/.claude/CLAUDE.md")}`);var v=fQ();if(v.skillsRemoved.length)console.log(` ${B(`removed ~/.agents/skills: ${v.skillsRemoved.join(", ")}`)}`);if(v.hooksRemoved)console.log(` ${B(`removed ${v.hooksRemoved} hook${v.hooksRemoved===1?"":"s"} from ~/.codex/hooks.json`)}`);if(v.agentsMdBlockRemoved)console.log(` ${B("stripped Beacon block from ~/.codex/AGENTS.md")}`);if(v.mcpRemoved)console.log(` ${B("stripped [mcp_servers.beacon] from ~/.codex/config.toml")}`);if(v.mcpSkipped)console.log(` ${BZ("left [mcp_servers.beacon] in ~/.codex/config.toml \u2014 it wasn't written by Beacon (remove with: codex mcp remove beacon)")}`);for(let Q of A){if(!VQ(Q.path))continue;let Z=HQ(Q.path),$=[];if(Z.skillsRemoved.length)$.push(`skills(${Z.skillsRemoved.length})`);if(Z.mcpUnregistered)$.push(".mcp.json");if(Z.agentsBlockRemoved)$.push("AGENTS.md");if(Z.claudeImportRemoved)$.push("CLAUDE.md");if($.length)console.log(` ${B(`${Q.path} \u2192 ${$.join(", ")}`)}`)}var K0=G0(K,"server.json");try{let{pid:Q}=JSON.parse(N0(K0,"utf8"));if(Q)try{process.kill(Q),console.log(` ${B(`stopped daemon (pid ${Q})`)}`)}catch{}}catch{}if(VQ(K))u0(K,{recursive:!0,force:!0}),console.log(` ${B(`removed ${K}`)}`);console.log(C("Done."));console.log(` ${BZ("The `beacon` binary on your PATH is still there \u2014 run the matching uninstall step from your installer to remove it.")}
|
|
248
248
|
`);
|