trybeacon 0.1.47 → 0.1.48
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 +16 -14
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +12 -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/route.js +1 -1
- package/.next/server/app/api/board-layout/route.js +1 -1
- package/.next/server/app/api/bug-flags/[id]/route.js +1 -1
- package/.next/server/app/api/bug-flags/route.js +1 -1
- package/.next/server/app/api/code-graph/position/route.js +1 -1
- package/.next/server/app/api/code-graph/route.js +1 -1
- package/.next/server/app/api/context/feature/route.js +1 -1
- package/.next/server/app/api/context/file/route.js +1 -1
- package/.next/server/app/api/context/route.js +2 -2
- package/.next/server/app/api/db/arrange/route.js +1 -1
- package/.next/server/app/api/db/backfill-access/route.js +1 -1
- package/.next/server/app/api/db/position/route.js +1 -1
- package/.next/server/app/api/db/prune-planned/route.js +1 -1
- package/.next/server/app/api/db/reconcile-endpoints/route.js +1 -1
- package/.next/server/app/api/db/relations/[id]/route.js +1 -1
- package/.next/server/app/api/db/tables/[id]/route.js +1 -1
- package/.next/server/app/api/draft/approve/route.js +1 -1
- package/.next/server/app/api/draft/route.js +1 -1
- package/.next/server/app/api/draft/status/route.js +1 -1
- package/.next/server/app/api/edges/[id]/route.js +1 -1
- package/.next/server/app/api/edges/route.js +1 -1
- package/.next/server/app/api/endpoints/[id]/route.js +1 -1
- package/.next/server/app/api/entities/route.js +1 -1
- package/.next/server/app/api/feedback/[id]/route.js +1 -1
- package/.next/server/app/api/feedback/[id]/vote/route.js +1 -1
- package/.next/server/app/api/feedback/route.js +1 -1
- package/.next/server/app/api/flags/route.js +1 -0
- package/.next/server/app/api/flags/route.js.nft.json +1 -0
- package/.next/server/app/api/flags/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ingest/route.js +2 -2
- package/.next/server/app/api/init/route.js +1 -1
- package/.next/server/app/api/map/describe/route.js +2 -2
- package/.next/server/app/api/map/files/route.js +1 -1
- package/.next/server/app/api/map/finish/route.js +1 -1
- package/.next/server/app/api/map/route.js +1 -1
- package/.next/server/app/api/map/start/route.js +1 -1
- package/.next/server/app/api/map/touch-active/route.js +1 -1
- package/.next/server/app/api/nodes/[id]/position/route.js +1 -1
- package/.next/server/app/api/nodes/[id]/route.js +1 -1
- package/.next/server/app/api/nodes/positions/route.js +1 -1
- package/.next/server/app/api/nodes/route.js +1 -1
- package/.next/server/app/api/nodes/subtasks/route.js +1 -1
- package/.next/server/app/api/notes/[id]/route.js +1 -1
- package/.next/server/app/api/notes/route.js +1 -1
- package/.next/server/app/api/open/route.js +1 -1
- package/.next/server/app/api/plan/annotations/route.js +3 -3
- package/.next/server/app/api/plan/approve/route.js +2 -2
- package/.next/server/app/api/plan/history/route.js +1 -1
- package/.next/server/app/api/plan/markdown/route.js +1 -1
- package/.next/server/app/api/plan/presence/route.js +1 -1
- package/.next/server/app/api/plan/route.js +1 -1
- package/.next/server/app/api/plan/verdict/route.js +1 -1
- package/.next/server/app/api/preferences/route.js +1 -1
- package/.next/server/app/api/project-meta/route.js +1 -1
- package/.next/server/app/api/reset/route.js +1 -1
- package/.next/server/app/api/scope-guard/check/route.js +1 -0
- package/.next/server/app/api/scope-guard/check/route.js.nft.json +1 -0
- package/.next/server/app/api/scope-guard/check/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/stream/route.js +2 -2
- package/.next/server/app/api/tab/nav/route.js +1 -1
- package/.next/server/app/api/tab/presence/route.js +1 -1
- package/.next/server/app/api/telemetry/route.js +1 -1
- package/.next/server/app/api/telemetry/stats/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/api/workspace/activate/route.js +1 -1
- package/.next/server/app/api/workspace/route.js +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_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +16 -14
- package/.next/server/chunks/249.js +1 -1
- package/.next/server/chunks/2933.js +1 -1
- package/.next/server/chunks/3221.js +2 -2
- package/.next/server/chunks/3622.js +1 -1
- package/.next/server/chunks/4378.js +1 -1
- package/.next/server/chunks/4940.js +1 -1
- package/.next/server/chunks/805.js +1 -0
- package/.next/server/chunks/9213.js +1 -1
- package/.next/server/chunks/9683.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- 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/chunks/85-82015ecb44b65d3e.js +1 -0
- package/.next/static/chunks/app/_global-error/page-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/board-annotations/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/board-annotations/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/board-layout/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/bug-flags/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/bug-flags/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/code-graph/position/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/code-graph/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/context/feature/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/context/file/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/context/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/db/arrange/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/db/backfill-access/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/db/position/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/db/prune-planned/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/db/reconcile-endpoints/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/db/relations/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/db/tables/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/draft/approve/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/draft/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/draft/status/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/edges/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/edges/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/endpoints/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/entities/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/feedback/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/feedback/[id]/vote/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/feedback/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/flags/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/ingest/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/init/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/map/describe/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/map/files/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/map/finish/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/map/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/map/start/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/map/touch-active/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/nodes/[id]/position/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/nodes/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/nodes/positions/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/nodes/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/nodes/subtasks/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/notes/[id]/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/notes/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/open/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/plan/annotations/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/plan/approve/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/plan/history/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/plan/markdown/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/plan/presence/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/plan/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/plan/verdict/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/preferences/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/project-meta/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/reset/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/scope-guard/check/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/stream/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/tab/nav/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/tab/presence/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/telemetry/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/telemetry/stats/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/version/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/workspace/activate/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/api/workspace/route-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/app/map/{page-a0bcd15b8dbfb3d3.js → page-c06fcf30d8172f82.js} +1 -1
- package/.next/static/chunks/app/plan/{page-376f36858e187c73.js → page-257d486640eadd7f.js} +1 -1
- package/.next/static/chunks/app/settings/page-7e176d120b1effa9.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-dc3f0f4fd9e88c4e.js +1 -0
- package/.next/static/css/5a58d83133d25695.css +1 -0
- package/.next/static/gNMdQmtkjPn6XQhRMDoMg/_buildManifest.js +1 -0
- package/.next/trace +39 -39
- package/.next/trace-build +1 -1
- package/.next/types/app/api/flags/route.ts +351 -0
- package/.next/types/app/api/scope-guard/check/route.ts +351 -0
- package/.next/types/routes.d.ts +3 -1
- package/.next/types/validator.ts +18 -0
- package/dist/bin/beacon.js +1 -1
- package/dist/bin/doctor.js +24 -18
- package/dist/bin/guard.js +3 -0
- package/dist/bin/hook.js +24 -18
- package/dist/bin/mcp.js +41 -35
- package/dist/bin/plan.js +21 -15
- package/dist/bin/remove.js +7 -6
- package/dist/bin/uninstall.js +24 -18
- package/dist/lib/assets.js +6 -0
- package/dist/lib/codex-install.js +6 -0
- package/dist/lib/global-install.js +7 -1
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/workspaces.js +1 -1
- package/drizzle/0008_good_lucky_pierre.sql +21 -0
- package/drizzle/meta/0008_snapshot.json +1904 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/public/install.sh +37 -6
- package/.next/server/chunks/142.js +0 -1
- package/.next/static/OO5fwNXOYFYnu4W91Z44C/_buildManifest.js +0 -1
- package/.next/static/chunks/5811-4d1f942c37146b40.js +0 -1
- package/.next/static/chunks/app/_global-error/page-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/board-annotations/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/board-annotations/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/board-layout/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/bug-flags/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/bug-flags/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/code-graph/position/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/code-graph/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/context/feature/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/context/file/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/context/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/db/arrange/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/db/backfill-access/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/db/position/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/db/prune-planned/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/db/reconcile-endpoints/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/db/relations/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/db/tables/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/draft/approve/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/draft/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/draft/status/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/edges/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/edges/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/endpoints/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/entities/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/feedback/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/feedback/[id]/vote/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/feedback/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/ingest/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/init/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/map/describe/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/map/files/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/map/finish/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/map/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/map/start/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/map/touch-active/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/nodes/[id]/position/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/nodes/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/nodes/positions/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/nodes/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/nodes/subtasks/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/notes/[id]/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/notes/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/open/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/plan/annotations/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/plan/approve/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/plan/history/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/plan/markdown/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/plan/presence/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/plan/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/plan/verdict/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/preferences/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/project-meta/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/reset/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/stream/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/tab/nav/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/tab/presence/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/telemetry/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/telemetry/stats/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/version/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/workspace/activate/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/api/workspace/route-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/app/settings/page-67cab634be8bfef2.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-16ca2ed05a1d74d1.js +0 -1
- package/.next/static/css/2d019ca6e0582481.css +0 -1
- /package/.next/static/{OO5fwNXOYFYnu4W91Z44C → gNMdQmtkjPn6XQhRMDoMg}/_ssgManifest.js +0 -0
package/.next/types/routes.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Do not edit this file manually
|
|
3
3
|
|
|
4
4
|
type AppRoutes = "/" | "/docs" | "/feedback" | "/help" | "/map" | "/plan" | "/settings"
|
|
5
|
-
type AppRouteHandlerRoutes = "/api/board-annotations" | "/api/board-annotations/[id]" | "/api/board-layout" | "/api/bug-flags" | "/api/bug-flags/[id]" | "/api/code-graph" | "/api/code-graph/position" | "/api/context" | "/api/context/feature" | "/api/context/file" | "/api/db/arrange" | "/api/db/backfill-access" | "/api/db/position" | "/api/db/prune-planned" | "/api/db/reconcile-endpoints" | "/api/db/relations/[id]" | "/api/db/tables/[id]" | "/api/draft" | "/api/draft/approve" | "/api/draft/status" | "/api/edges" | "/api/edges/[id]" | "/api/endpoints/[id]" | "/api/entities" | "/api/feedback" | "/api/feedback/[id]" | "/api/feedback/[id]/vote" | "/api/ingest" | "/api/init" | "/api/map" | "/api/map/describe" | "/api/map/files" | "/api/map/finish" | "/api/map/start" | "/api/map/touch-active" | "/api/nodes" | "/api/nodes/[id]" | "/api/nodes/[id]/position" | "/api/nodes/positions" | "/api/nodes/subtasks" | "/api/notes" | "/api/notes/[id]" | "/api/open" | "/api/plan" | "/api/plan/annotations" | "/api/plan/approve" | "/api/plan/history" | "/api/plan/markdown" | "/api/plan/presence" | "/api/plan/verdict" | "/api/preferences" | "/api/project-meta" | "/api/reset" | "/api/stream" | "/api/tab/nav" | "/api/tab/presence" | "/api/telemetry" | "/api/telemetry/stats" | "/api/version" | "/api/workspace" | "/api/workspace/activate"
|
|
5
|
+
type AppRouteHandlerRoutes = "/api/board-annotations" | "/api/board-annotations/[id]" | "/api/board-layout" | "/api/bug-flags" | "/api/bug-flags/[id]" | "/api/code-graph" | "/api/code-graph/position" | "/api/context" | "/api/context/feature" | "/api/context/file" | "/api/db/arrange" | "/api/db/backfill-access" | "/api/db/position" | "/api/db/prune-planned" | "/api/db/reconcile-endpoints" | "/api/db/relations/[id]" | "/api/db/tables/[id]" | "/api/draft" | "/api/draft/approve" | "/api/draft/status" | "/api/edges" | "/api/edges/[id]" | "/api/endpoints/[id]" | "/api/entities" | "/api/feedback" | "/api/feedback/[id]" | "/api/feedback/[id]/vote" | "/api/flags" | "/api/ingest" | "/api/init" | "/api/map" | "/api/map/describe" | "/api/map/files" | "/api/map/finish" | "/api/map/start" | "/api/map/touch-active" | "/api/nodes" | "/api/nodes/[id]" | "/api/nodes/[id]/position" | "/api/nodes/positions" | "/api/nodes/subtasks" | "/api/notes" | "/api/notes/[id]" | "/api/open" | "/api/plan" | "/api/plan/annotations" | "/api/plan/approve" | "/api/plan/history" | "/api/plan/markdown" | "/api/plan/presence" | "/api/plan/verdict" | "/api/preferences" | "/api/project-meta" | "/api/reset" | "/api/scope-guard/check" | "/api/stream" | "/api/tab/nav" | "/api/tab/presence" | "/api/telemetry" | "/api/telemetry/stats" | "/api/version" | "/api/workspace" | "/api/workspace/activate"
|
|
6
6
|
type PageRoutes = never
|
|
7
7
|
type LayoutRoutes = "/"
|
|
8
8
|
type RedirectRoutes = never
|
|
@@ -39,6 +39,7 @@ interface ParamMap {
|
|
|
39
39
|
"/api/feedback": {}
|
|
40
40
|
"/api/feedback/[id]": { "id": string; }
|
|
41
41
|
"/api/feedback/[id]/vote": { "id": string; }
|
|
42
|
+
"/api/flags": {}
|
|
42
43
|
"/api/ingest": {}
|
|
43
44
|
"/api/init": {}
|
|
44
45
|
"/api/map": {}
|
|
@@ -65,6 +66,7 @@ interface ParamMap {
|
|
|
65
66
|
"/api/preferences": {}
|
|
66
67
|
"/api/project-meta": {}
|
|
67
68
|
"/api/reset": {}
|
|
69
|
+
"/api/scope-guard/check": {}
|
|
68
70
|
"/api/stream": {}
|
|
69
71
|
"/api/tab/nav": {}
|
|
70
72
|
"/api/tab/presence": {}
|
package/.next/types/validator.ts
CHANGED
|
@@ -353,6 +353,15 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
|
|
|
353
353
|
type __Unused = __Check
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
// Validate ../../app/api/flags/route.ts
|
|
357
|
+
{
|
|
358
|
+
type __IsExpected<Specific extends RouteHandlerConfig<"/api/flags">> = Specific
|
|
359
|
+
const handler = {} as typeof import("../../app/api/flags/route.js")
|
|
360
|
+
type __Check = __IsExpected<typeof handler>
|
|
361
|
+
// @ts-ignore
|
|
362
|
+
type __Unused = __Check
|
|
363
|
+
}
|
|
364
|
+
|
|
356
365
|
// Validate ../../app/api/ingest/route.ts
|
|
357
366
|
{
|
|
358
367
|
type __IsExpected<Specific extends RouteHandlerConfig<"/api/ingest">> = Specific
|
|
@@ -587,6 +596,15 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
|
|
|
587
596
|
type __Unused = __Check
|
|
588
597
|
}
|
|
589
598
|
|
|
599
|
+
// Validate ../../app/api/scope-guard/check/route.ts
|
|
600
|
+
{
|
|
601
|
+
type __IsExpected<Specific extends RouteHandlerConfig<"/api/scope-guard/check">> = Specific
|
|
602
|
+
const handler = {} as typeof import("../../app/api/scope-guard/check/route.js")
|
|
603
|
+
type __Check = __IsExpected<typeof handler>
|
|
604
|
+
// @ts-ignore
|
|
605
|
+
type __Unused = __Check
|
|
606
|
+
}
|
|
607
|
+
|
|
590
608
|
// Validate ../../app/api/stream/route.ts
|
|
591
609
|
{
|
|
592
610
|
type __IsExpected<Specific extends RouteHandlerConfig<"/api/stream">> = Specific
|
package/dist/bin/beacon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{execSync as _,spawn as m}from"child_process";import{existsSync as u,mkdirSync as g,openSync as c,readFileSync as p,writeFileSync as d}from"fs";import{homedir as t,platform as L}from"os";import{basename as l,dirname as j,join as U}from"path";import{fileURLToPath as a}from"url";var T=j(a(import.meta.url)),O=l(j(T))==="dist",V=O?j(j(T)):j(T),P=process.cwd(),v=process.env.BEACON_HOME||U(t(),".beacon"),A=U(v,"server.json"),w=process.env.PORT||"4319";if(!process.env.BEACON_MIGRATIONS_DIR)process.env.BEACON_MIGRATIONS_DIR=U(V,"drizzle");function $(z){if(!O)return U(V,z);return U(V,"dist",z.replace(/\.ts$/,".js"))}var Y=process.argv[2];if(Y==="mcp")await import($("bin/mcp.ts"));else if(Y==="hook")await import($("bin/hook.ts"));else if(Y==="plan")await import($("bin/plan.ts"));else if(Y==="prompt")await import($("bin/prompt.ts"));else if(Y==="stop-hook")await import($("bin/stop-hook.ts"));else if(Y==="stop")f();else if(Y==="remove")await import($("bin/remove.ts"));else if(Y==="setup")await E(D()||P);else if(Y==="doctor")await import($("bin/doctor.ts"));else if(Y==="uninstall")await import($("bin/uninstall.ts"));else if(Y==="update")await zz(process.argv.includes("--force")||process.argv.includes("-f"));else if(Y==="telemetry")await e(process.argv[3]);else if(Y==="version"||Y==="--version"||Y==="-v")console.log(x());else await r();async function E(z,Z=!1){let{installInitSkill:X,installRefreshSkill:J,installCodexRepoSkills:K,ensureMcp:G,ensureWorkflowDoc:W}=await import($("lib/assets.ts")),{selfHealGlobal:F}=await import($("lib/global-install.ts")),{codexDetected:M}=await import($("lib/codex-install.ts")),N=await F(),H=X(z),B=J(z);W(z);let Q=G(z),y=M()?K(z):[];if(Z){if(Q.added)console.log(`[beacon] registered Beacon MCP in ${Q.path} \u2014 restart your agent CLI to use @beacon mentions.`)}else{console.log(`
|
|
3
|
+
import{execSync as _,spawn as m}from"child_process";import{existsSync as u,mkdirSync as g,openSync as c,readFileSync as p,writeFileSync as d}from"fs";import{homedir as t,platform as L}from"os";import{basename as l,dirname as j,join as U}from"path";import{fileURLToPath as a}from"url";var T=j(a(import.meta.url)),O=l(j(T))==="dist",V=O?j(j(T)):j(T),P=process.cwd(),v=process.env.BEACON_HOME||U(t(),".beacon"),A=U(v,"server.json"),w=process.env.PORT||"4319";if(!process.env.BEACON_MIGRATIONS_DIR)process.env.BEACON_MIGRATIONS_DIR=U(V,"drizzle");function $(z){if(!O)return U(V,z);return U(V,"dist",z.replace(/\.ts$/,".js"))}var Y=process.argv[2];if(Y==="mcp")await import($("bin/mcp.ts"));else if(Y==="hook")await import($("bin/hook.ts"));else if(Y==="guard")await import($("bin/guard.ts"));else if(Y==="plan")await import($("bin/plan.ts"));else if(Y==="prompt")await import($("bin/prompt.ts"));else if(Y==="stop-hook")await import($("bin/stop-hook.ts"));else if(Y==="stop")f();else if(Y==="remove")await import($("bin/remove.ts"));else if(Y==="setup")await E(D()||P);else if(Y==="doctor")await import($("bin/doctor.ts"));else if(Y==="uninstall")await import($("bin/uninstall.ts"));else if(Y==="update")await zz(process.argv.includes("--force")||process.argv.includes("-f"));else if(Y==="telemetry")await e(process.argv[3]);else if(Y==="version"||Y==="--version"||Y==="-v")console.log(x());else await r();async function E(z,Z=!1){let{installInitSkill:X,installRefreshSkill:J,installCodexRepoSkills:K,ensureMcp:G,ensureWorkflowDoc:W}=await import($("lib/assets.ts")),{selfHealGlobal:F}=await import($("lib/global-install.ts")),{codexDetected:M}=await import($("lib/codex-install.ts")),N=await F(),H=X(z),B=J(z);W(z);let Q=G(z),y=M()?K(z):[];if(Z){if(Q.added)console.log(`[beacon] registered Beacon MCP in ${Q.path} \u2014 restart your agent CLI to use @beacon mentions.`)}else{console.log(`
|
|
4
4
|
\u25C9 Beacon setup \xB7 ${z}`),console.log(` \u2713 skill: ${H}`),console.log(` \u2713 skill: ${B}`);for(let I of y)console.log(` \u2713 skill: ${I}`);console.log(` ${Q.added?"\u2713 added ":"\xB7 kept "} Beacon MCP in ${Q.path}`),console.log(` \u2192 in this repo, run /beacon-init in your agent (Claude Code or Codex) to map the repo.
|
|
5
5
|
`)}return{initSkill:H,refreshSkill:B,mcp:Q,codexSkills:y,heal:N}}function D(){try{return _("git rev-parse --show-toplevel",{cwd:P,stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function k(z){try{return process.kill(z,0),!0}catch{return!1}}function R(z){try{return JSON.parse(p(z,"utf8"))}catch{return null}}async function S(z){try{return(await fetch(z)).ok}catch{return!1}}async function n(z,Z=60){for(let X=0;X<Z;X++){if(await S(z))return!0;await new Promise((J)=>setTimeout(J,500))}return!1}function i(z){g(v,{recursive:!0});let Z=c(U(v,"server.log"),"a"),X={...process.env,PORT:z,BEACON_NO_OPEN:"1",BEACON_MIGRATIONS_DIR:U(V,"drizzle")};delete X.BEACON_REPO,delete X.BEACON_DATA_DIR,delete X.DATABASE_URL;let K=m("bun",O?["run","start"]:["run","dev"],{cwd:V,env:X,detached:!0,stdio:["ignore",Z,Z]});K.unref();let G={pid:K.pid??0,port:z};return d(A,JSON.stringify(G)),G}async function s(){let z=R(A);if(z&&k(z.pid)&&await S(`http://localhost:${z.port}/api/workspace`))return z.port;let{findAvailablePort:Z}=await import($("lib/daemon-port.ts")),X=String(await Z(Number(w)));console.log(X===w?"[beacon] starting the Beacon server\u2026":`[beacon] port ${w} is busy \u2014 starting the Beacon server on port ${X}\u2026`);let{port:J}=i(X);if(!await n(`http://localhost:${J}/api/workspace`))console.log("[beacon] (server is taking a while \u2014 it may still be compiling)");return J}function o(z){if(process.env.BEACON_NO_OPEN)return;let Z=L()==="darwin"?"open":L()==="win32"?"start":"xdg-open";try{_(`${Z} "${z}"`,{stdio:"ignore"})}catch{}}async function r(){let z=D()||P,{registerWorkspaceExplicit:Z,idForPath:X,dataDirFor:J,ensureWorkspaceDb:K,isRegistrableWorkspacePath:G}=await import($("lib/workspaces.ts"));if(!G(z))console.error(`[beacon] refusing to open Beacon in ${z} \u2014 that's your home directory, not a project.
|
|
6
6
|
`+" cd into a repo (or run `git init` there) and try again."),process.exit(1);let W=X(z),F=J(W),M=!u(U(F,"db.sqlite"));if(M)console.log(`[beacon] first run for ${z} \u2014 creating database\u2026`);let N=await K(W);if(!N.ok)console.error(`[beacon] failed to provision database: ${N.error}`);if(M)console.log("[beacon] tip: already have code here? run `/beacon-init` in your agent (Claude Code or Codex) to map the project.");let{heal:H}=await E(z,!0),B=[];if(H.skillsAdded.length)B.push(`skills ${H.skillsAdded.join(", ")}`);if(H.hooksAdded)B.push(`${H.hooksAdded} Claude Code hook${H.hooksAdded===1?"":"s"}`);if(H.claudeMdBlockTouched)B.push("global CLAUDE.md block");if(B.length)console.log(`[beacon] wired into ~/.claude/: ${B.join(" + ")}.`);let Q=H.codex;if(Q){let q=[];if(Q.skillsAdded.length)q.push(`skills ${Q.skillsAdded.join(", ")}`);if(Q.hooksAdded)q.push(`${Q.hooksAdded} Codex hook${Q.hooksAdded===1?"":"s"}`);if(Q.agentsMdBlockTouched)q.push("global AGENTS.md block");if(Q.mcp.added)q.push("MCP entry in config.toml");if(q.length)console.log(`[beacon] wired into ~/.codex/: ${q.join(" + ")}.`);if(Q.mcp.error)console.log(`[beacon] codex MCP not wired: ${Q.mcp.error}`)}try{let q=await import($("lib/telemetry.ts"));if(!q.telemetryStatus().machineId){let b=q.telemetryStatus().enabled;console.log(`[beacon] telemetry: Beacon sends an anonymous heartbeat (random machine id, version, OS,
|
package/dist/bin/doctor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var CZ=Object.defineProperty;var MZ=(Q)=>Q;function fZ(Q,Z){this[Q]=MZ.bind(null,Z)}var
|
|
3
|
+
var CZ=Object.defineProperty;var MZ=(Q)=>Q;function fZ(Q,Z){this[Q]=MZ.bind(null,Z)}var HQ=(Q,Z)=>{for(var $ in Z)CZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:fZ.bind(Z,$)})};var g=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var NQ={};HQ(NQ,{removeRepoAssets:()=>IZ,installRefreshSkill:()=>wZ,installPlanSkill:()=>TZ,installInitSkill:()=>uZ,installCodexRepoSkills:()=>gZ,ensureWorkflowDoc:()=>RZ,ensureMcp:()=>EZ,auditRepo:()=>vQ,REFRESH_SKILL:()=>PQ,PLAN_SKILL:()=>hQ,INIT_SKILL:()=>jQ});import{existsSync as u,mkdirSync as L,readFileSync as G,rmSync as _,writeFileSync as N}from"fs";import{join as q}from"path";function uZ(Q){let Z=q(Q,".claude","skills","beacon-init");L(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,jQ),$}function wZ(Q){let Z=q(Q,".claude","skills","beacon-refresh");L(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,PQ),$}function TZ(Q){let Z=q(Q,".claude","skills","beacon-plan");L(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,hQ),$}function gZ(Q){let Z=[];for(let $ of FZ){let J=q(Q,".agents","skills",$.name);L(J,{recursive:!0});let Y=q(J,"SKILL.md");N(Y,$.body()),Z.push(Y)}return Z}function RZ(Q){let Z=q(Q,"AGENTS.md"),$="";try{$=G(Z,"utf8")}catch{}let J=new RegExp(`${k}[\\s\\S]*?${BQ}`);$=J.test($)?$.replace(J,SQ):`${$.trim()}
|
|
4
4
|
|
|
5
5
|
${SQ}
|
|
6
6
|
`.trimStart(),N(Z,$.endsWith(`
|
|
@@ -9,13 +9,13 @@ ${SQ}
|
|
|
9
9
|
|
|
10
10
|
`:""}@AGENTS.md
|
|
11
11
|
`)}function EZ(Q){let Z=q(Q,".mcp.json"),$={};try{$=JSON.parse(G(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},N(Z,JSON.stringify($,null,2)+`
|
|
12
|
-
`),{path:Z,added:!0}}function
|
|
13
|
-
`)}}catch{}let Y=!1,V=q(Q,"AGENTS.md");try{let z=G(V,"utf8"),P=new RegExp(`\\n?${
|
|
12
|
+
`),{path:Z,added:!0}}function vQ(Q){let Z=q(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(G(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=G(q(Q,"AGENTS.md"),"utf8").includes(k)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(G(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":u(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":u(q(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":u(q(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":u(q(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function IZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let P=q(Q,".claude","skills",z);if(u(P))_(P,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let P=q(Q,".agents","skills",z);if(u(P))_(P,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=q(Q,".mcp.json");try{let z=JSON.parse(G(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)_(J,{force:!0});else N(J,JSON.stringify(z,null,2)+`
|
|
13
|
+
`)}}catch{}let Y=!1,V=q(Q,"AGENTS.md");try{let z=G(V,"utf8"),P=new RegExp(`\\n?${k}[\\s\\S]*?${BQ}\\n?`);if(P.test(z)){let WQ=z.replace(P,`
|
|
14
14
|
`).replace(/\n{3,}/g,`
|
|
15
15
|
|
|
16
|
-
`).trimStart();N(V,
|
|
17
|
-
`)?
|
|
18
|
-
`),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=G(U,"utf8"),P=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==z){if(!P.trim())_(U,{force:!0});else N(U,P);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:X}}var
|
|
16
|
+
`).trimStart();N(V,WQ.endsWith(`
|
|
17
|
+
`)?WQ:`${WQ}
|
|
18
|
+
`),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=G(U,"utf8"),P=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==z){if(!P.trim())_(U,{force:!0});else N(U,P);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:X}}var jQ=`---
|
|
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
|
---
|
|
@@ -54,7 +54,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
54
54
|
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.
|
|
55
55
|
|
|
56
56
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
57
|
-
`,
|
|
57
|
+
`,PQ=`---
|
|
58
58
|
name: beacon-refresh
|
|
59
59
|
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.
|
|
60
60
|
---
|
|
@@ -129,6 +129,12 @@ Beacon extracts that block deterministically, strips it from the prose, and rend
|
|
|
129
129
|
board on /plan. The board is built ONLY from the block \u2014 prose is never parsed \u2014 so mirror EVERY
|
|
130
130
|
table/endpoint/feature you mention in the prose into the block, or that board will be empty.
|
|
131
131
|
|
|
132
|
+
- **Declare your scope.** List the repo-relative files this plan will touch in a top-level
|
|
133
|
+
\`"contract"\` array in the block (or the \`contract\` arg of \`beacon_propose_plan\`). When the user
|
|
134
|
+
has the plan scope-guard enabled, those files are frozen at approval and you're held to them while
|
|
135
|
+
implementing \u2014 editing an undeclared file pauses for the user's authorization (which then adds it
|
|
136
|
+
to the contract). Harmless when the guard is off. Declare the files you genuinely expect to edit.
|
|
137
|
+
|
|
132
138
|
\`beacon_present_plan\` opens /plan and BLOCKS until the user clicks Approve / Discard / submits
|
|
133
139
|
feedback, then returns their verdict. Implement code or migrations ONLY after it returns approval.
|
|
134
140
|
If it returns feedback, revise and call it again.
|
|
@@ -143,7 +149,7 @@ If it returns feedback, revise and call it again.
|
|
|
143
149
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
144
150
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
145
151
|
run \`beacon\` in this repo once.
|
|
146
|
-
`,FZ,
|
|
152
|
+
`,FZ,k="<!-- beacon:workflow:start -->",BQ="<!-- beacon:workflow:end -->",SQ;var S=g(()=>{FZ=[{name:"beacon-init",body:()=>jQ},{name:"beacon-refresh",body:()=>PQ}];SQ=`${k}
|
|
147
153
|
## Beacon \u2014 feature workflow
|
|
148
154
|
|
|
149
155
|
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:
|
|
@@ -201,18 +207,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
201
207
|
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.
|
|
202
208
|
|
|
203
209
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
204
|
-
${
|
|
205
|
-
`)}function
|
|
210
|
+
${BQ}`});import{existsSync as mQ,mkdirSync as xQ,readFileSync as m,rmSync as DZ,writeFileSync as p}from"fs";import{dirname as pQ,join as h}from"path";function GQ(Q){try{return JSON.parse(m(Q,"utf8"))}catch{return{}}}function cQ(Q,Z){xQ(pQ(Q),{recursive:!0}),p(Q,JSON.stringify(Z,null,2)+`
|
|
211
|
+
`)}function n(Q,Z){let $=GQ(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}]}),cQ(Q,$),!0}function l(Q,Z){return(GQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function s(Q,Z){let $=GQ(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 cQ(Q,$),!0}function t(Q,Z,$,J){let Y=`${Z}
|
|
206
212
|
${J.trim()}
|
|
207
213
|
${$}`,V="";try{V=m(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,Y):V.trim()?`${V.trim()}
|
|
208
214
|
|
|
209
215
|
${Y}
|
|
210
216
|
`:`${Y}
|
|
211
|
-
`,
|
|
217
|
+
`,xQ(pQ(Q),{recursive:!0}),p(Q,V.endsWith(`
|
|
212
218
|
`)?V:`${V}
|
|
213
219
|
`)}function R(Q,Z){try{return m(Q,"utf8").includes(Z)}catch{return!1}}function a(Q,Z,$){let J="";try{J=m(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,`
|
|
214
220
|
|
|
215
|
-
`).trimStart();return p(Q,V),!0}function d(Q,Z,$){let J=h(Q,Z);
|
|
221
|
+
`).trimStart();return p(Q,V),!0}function d(Q,Z,$){let J=h(Q,Z);xQ(J,{recursive:!0});let Y=h(J,"SKILL.md");return p(Y,$),Y}function E(Q,Z){return mQ(h(Q,Z,"SKILL.md"))}function r(Q,Z){let $=h(Q,Z);if(!mQ($))return!1;return DZ($,{recursive:!0,force:!0}),!0}var B,c=`## Beacon (visual planning panel)
|
|
216
222
|
|
|
217
223
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
218
224
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -233,19 +239,19 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
233
239
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
234
240
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
235
241
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
236
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
242
|
+
verbatim. Do NOT implement until the tool returns approval.`;var KQ=g(()=>{B=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as OZ,renameSync as AZ,rmSync as yZ,writeFileSync as bZ}from"fs";import{dirname as _Z}from"path";function i(Q,Z){OZ(_Z(Q),{recursive:!0});let $=`${Q}.tmp`;try{bZ($,Z),AZ($,Q)}catch(J){throw yZ($,{force:!0}),J}}function h0(Q,Z,$=!1){i(Q,JSON.stringify(Z,null,$?2:void 0))}var nQ=()=>{};var iQ={};HQ(iQ,{setupCodexAssets:()=>SZ,removeCodexMcp:()=>rQ,removeCodexArtifacts:()=>hZ,hasCodexMcp:()=>uQ,ensureCodexMcp:()=>dQ,codexMcpProblem:()=>wQ,codexDetected:()=>$Q,auditCodex:()=>TQ,CODEX_HOOKS:()=>C});import{readFileSync as ZQ}from"fs";import{homedir as LZ}from"os";import{join as O}from"path";function lQ(){return process.env.HOME||process.env.USERPROFILE||LZ()}function $Q(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(CQ===void 0)CQ=Bun.which("codex")!==null;return CQ}function D(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function uQ(){try{return Boolean(D(ZQ(w(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function wQ(){let Q="";try{Q=ZQ(w(),"utf8")}catch{return null}let Z=D(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${I}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${I}`;return null}function dQ(){let Q="",Z=!1;try{Q=ZQ(w(),"utf8"),Z=!0}catch{}if(Z){let V=D(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${I}`};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 ${I}`}}let $=!Q?"":Q.endsWith(`
|
|
237
243
|
`)?`
|
|
238
244
|
`:`
|
|
239
245
|
|
|
240
|
-
`,J=Q+$+
|
|
241
|
-
`),$=Z.indexOf(tQ);if($===-1)return{removed:!1,skipped:
|
|
246
|
+
`,J=Q+$+kZ;if(D(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${I}`};return i(w(),J),{added:!0}}function rQ(){let Q="";try{Q=ZQ(w(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
247
|
+
`),$=Z.indexOf(tQ);if($===-1)return{removed:!1,skipped:uQ()};let J=Z.indexOf(aQ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
|
|
242
248
|
`).replace(/\n{3,}/g,`
|
|
243
249
|
|
|
244
|
-
`).replace(/^\n+/,"");if(D(Y)===null)return{removed:!1,skipped:!0};return
|
|
250
|
+
`).replace(/^\n+/,"");if(D(Y)===null)return{removed:!1,skipped:!0};return i(w(),Y),{removed:!0}}async function SZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (S(),NQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let z of B){if(!E(e(),z))Y.push(z);d(e(),z,J[z])}let V=0;for(let z of C)if(n(fQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=R(o(),QQ);t(o(),QQ,sQ,c);let U=dQ();return{skillsAdded:Y,hooksAdded:V,agentsMdBlockTouched:!X,mcp:U}}function TQ(){let Q={};for(let $ of B)Q[$]=E(e(),$);let Z={};for(let $ of C)Z[$.event]=l(fQ(),{event:$.event,command:$.command});return{detected:$Q(),skills:Q,hooks:Z,agentsMdBlock:R(o(),QQ),mcp:uQ()}}function hZ(){let Q=[];for(let Y of B)if(r(e(),Y))Q.push(Y);let Z=0;for(let Y of C)if(s(fQ(),{event:Y.event,command:Y.command}))Z++;let $=a(o(),QQ,sQ),J=rQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var MQ=()=>O(lQ(),".codex"),fQ=()=>O(MQ(),"hooks.json"),w=()=>O(MQ(),"config.toml"),o=()=>O(MQ(),"AGENTS.md"),e=()=>O(lQ(),".agents","skills"),QQ="<!-- beacon:global:start -->",sQ="<!-- beacon:global:end -->",C,CQ,tQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",aQ="# beacon:end",kZ,I="add it manually: codex mcp add beacon -- beacon mcp";var FQ=g(()=>{KQ();nQ();C=[{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."}];kZ=`${tQ}
|
|
245
251
|
[mcp_servers.beacon]
|
|
246
252
|
command = "beacon"
|
|
247
253
|
args = ["mcp"]
|
|
248
254
|
${aQ}
|
|
249
|
-
`});var JZ={};
|
|
250
|
-
\x1B[1m${Q}\x1B[0m`;function
|
|
255
|
+
`});var JZ={};HQ(JZ,{provisionDb:()=>W0});import{createClient as eZ}from"@libsql/client";import{drizzle as Q0}from"drizzle-orm/libsql";import{migrate as Z0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as $0}from"drizzle-orm/migrator";import{dirname as DQ,join as J0}from"path";import{fileURLToPath as Y0}from"url";async function VQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function X0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function $Z(Q){if(!await VQ(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 U0(Q){for(let[Z,$]of Object.entries(q0)){if(!await VQ(Q,Z))continue;let J=await X0(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 W0(Q,Z=z0){let $=eZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await VQ($,"__drizzle_migrations"),Y=await VQ($,"Node"),V=!1;if(Y&&!J){let U=$0({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 $Z($);if(await Z0(Q0($),{migrationsFolder:Z}),await $Z($)>X)V=!0;return await U0($),{migrated:V}}finally{$.close()}}var V0,z0,q0;var YZ=g(async()=>{V0=DQ(DQ(DQ(Y0(import.meta.url)))),z0=process.env.BEACON_MIGRATIONS_DIR||J0(V0,"drizzle"),q0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});KQ();import{existsSync as mZ}from"fs";import{homedir as pZ}from"os";import{join as JQ}from"path";function cZ(){return process.env.HOME||process.env.USERPROFILE||pZ()}var YQ=()=>JQ(cZ(),".claude"),gQ=()=>JQ(YQ(),"skills"),RQ=()=>JQ(YQ(),"settings.json"),EQ=()=>JQ(YQ(),"CLAUDE.md"),IQ="<!-- beacon:global:start -->",oQ="<!-- beacon:global:end -->";var nZ=c,T=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract (when the scope-guard flag is on): in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. No-op + fail-open otherwise."},{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 lZ(Q,Z){return d(gQ(),Q,Z)}function eQ(Q){return E(gQ(),Q)}function sZ(Q){return r(gQ(),Q)}function tZ(Q){return n(RQ(),Q)}function aZ(Q){return l(RQ(),Q)}function dZ(Q){return s(RQ(),Q)}function rZ(Q){t(EQ(),IQ,oQ,Q)}function QZ(){return R(EQ(),IQ)}function iZ(){return a(EQ(),IQ,oQ)}function ZZ(){let Q={};for(let $ of B)Q[$]=eQ($);let Z={};for(let $ of T)Z[$.event]=aZ({event:$.event,command:$.command});return{homeExists:mZ(YQ()),skills:Q,hooks:Z,claudeMdBlock:QZ()}}async function oZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (S(),NQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let U of B){if(!eQ(U))Y.push(U);lZ(U,J[U])}let V=0;for(let U of T)if(tZ({event:U.event,matcher:U.matcher,command:U.command}))V++;let X=QZ();return rZ(nZ),{skillsAdded:Y,hooksAdded:V,claudeMdBlockTouched:!X}}async function i0(){let Q;try{Q={ok:!0,...await oZ()}}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(() => (FQ(),iQ));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 o0(){let Q=[];for(let J of B)if(sZ(J))Q.push(J);let Z=0;for(let J of T)if(dZ(J))Z++;let $=iZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as H0}from"async_hooks";import{spawnSync as j0}from"child_process";import{createHash as P0}from"crypto";import{existsSync as zZ,mkdirSync as A,readFileSync as AQ,writeFileSync as yQ}from"fs";import{homedir as qZ}from"os";import{basename as B0,join as K,parse as v0,resolve as VZ}from"path";function x(){return process.env.BEACON_HOME||K(qZ(),".beacon")}function bQ(){return K(x(),"workspaces.json")}function zQ(Q){return P0("sha256").update(Q).digest("hex").slice(0,12)}function j1(Q=process.cwd()){let Z=j0("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 XZ(Q){let Z=VZ(Q);return Z!==VZ(qZ())&&Z!==v0(Z).root}function UZ(){return K(x(),"deleted.json")}function _Q(){try{let Q=JSON.parse(AQ(UZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function WZ(Q){A(x(),{recursive:!0}),yQ(UZ(),JSON.stringify(Q,null,2))}function HZ(Q){return _Q().includes(Q)}function P1(Q){let Z=_Q();if(!Z.includes(Q))WZ([...Z,Q])}function N0(Q){let Z=_Q();if(Z.includes(Q))WZ(Z.filter(($)=>$!==Q))}function qQ(Q){return K(x(),Q)}function x0(Q){return`file:${K(qQ(Q),"db.sqlite")}`}function y(){try{let Q=JSON.parse(AQ(bQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function LQ(Q){A(x(),{recursive:!0}),yQ(bQ(),JSON.stringify(Q,null,2))}function XQ(){return y().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function M(Q){return y().find((Z)=>Z.id===Q)??null}function jZ(Q,Z,$=new Date().toISOString()){if(!XZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=zQ(Q);if(HZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=y(),V=Y.find((z)=>z.id===J),X={id:J,path:Q,name:Z||V?.name||B0(Q),lastOpenedAt:$},U=[X,...Y.filter((z)=>z.id!==J)];return A(qQ(J),{recursive:!0}),LQ(U),X}function B1(Q,Z){return N0(zQ(Q)),jZ(Q,Z)}function v1(Q,Z=new Date().toISOString()){let $=y(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,LQ($)}function N1(Q){if(LQ(y().filter((Z)=>Z.id!==Q)),kQ()===Q)G0(XQ()[0]?.id??null)}function PZ(){return K(x(),"active")}function kQ(){try{return AQ(PZ(),"utf8").trim()||null}catch{return null}}function G0(Q){A(x(),{recursive:!0}),yQ(PZ(),Q??"")}function x1(){let Q=kQ();return Q?M(Q):null}function G1(){let Q=M0()??kQ();return Q?M(Q):null}function K1(Q){return M(Q)?.path??null}function C1(){return zZ(bQ())}var BZ="beacon_ws";function vZ(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 M1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&M(Z))return Z;let $=vZ(Q,BZ);if($&&M($))return $;return K0()}function K0(){let Q=XQ();return Q.length===1?Q[0].id:null}var C0="x-beacon-workspace-path";async function f1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&M(Z))return Z;let $=Q.headers.get(C0);if($&&XZ($)&&!HZ(zQ($))&&(!Z||zQ($)===Z)){let Y=jZ($);return await f0(Y.id),Y.id}let J=vZ(Q,BZ);if(J&&M(J))return J;return null}var NZ=new H0;function u1(Q,Z){return Q?NZ.run(Q,Z):Z()}function M0(){return NZ.getStore()??null}var OQ=new Set;function w1(Q){OQ.delete(K(qQ(Q),"db.sqlite"))}async function f0(Q){let Z=qQ(Q),$=K(Z,"db.sqlite"),J=zZ($);if(J&&OQ.has($))return{ok:!0,created:!1,migrated:!1};try{A(Z,{recursive:!0});let{provisionDb:Y}=await YZ().then(() => JZ),V=await Y(x0(Q));return OQ.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)}}}S();FQ();import{execSync as u0,spawnSync as xZ}from"child_process";import{existsSync as w0,readFileSync as T0}from"fs";import{join as GZ}from"path";var W=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,H=(Q)=>`\x1B[31m\u2717\x1B[0m ${Q}`,f=(Q)=>`\x1B[2m${Q}\x1B[0m`,b=(Q)=>`
|
|
256
|
+
\x1B[1m${Q}\x1B[0m`;function F0(){try{return u0("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function g0(){let Q=GZ(x(),"server.json");try{let Z=JSON.parse(T0(Q,"utf8"));if(!Z.pid)return H("daemon: no server.json yet");try{return process.kill(Z.pid,0),W(`daemon running (pid ${Z.pid}, port ${Z.port??"?"})`)}catch{return H(`daemon NOT running (server.json stale: pid ${Z.pid})`)}}catch{return H("daemon: no server.json (never started)")}}function R0(){let Q=xZ("bun",["--version"],{stdio:["ignore","pipe","ignore"]});if(Q.status===0)return W(`bun ${Q.stdout.toString().trim()}`);return H("bun NOT found on PATH (required to run Beacon)")}function E0(){return F0()||process.cwd()}var UQ=E0(),F=ZZ(),KZ=XQ(),I0=KZ.some((Q)=>Q.path===UQ),j=I0||w0(GZ(UQ,".mcp.json"))?vQ(UQ):null;console.log(b("Beacon \xB7 doctor"));console.log(b("Runtime"));console.log(` ${R0()}`);console.log(` ${g0()}`);console.log(` ${W(`home: ${x()}`)}`);console.log(` ${W(`workspaces registered: ${KZ.length}`)}`);console.log(b("Global (~/.claude/)"));for(let Q of B)console.log(` ${F.skills[Q]?W(`skill ${Q}`):H(`skill ${Q} \u2014 missing`)}`);for(let Q of T)console.log(` ${F.hooks[Q.event]?W(`hook ${Q.event} \u2192 ${Q.command}`):H(`hook ${Q.event} \u2192 ${Q.command} \u2014 missing`)} ${f(Q.description)}`);console.log(` ${F.claudeMdBlock?W("global CLAUDE.md block"):H("global CLAUDE.md block \u2014 missing (every Claude session won't auto-discover Beacon)")}`);console.log(b("Codex (~/.codex/ + ~/.agents/)"));var v=$Q()?TQ():null;if(!v)console.log(` ${f("codex not on PATH \u2014 Codex integration inactive (wires automatically once codex is installed)")}`);else{let Q=xZ("codex",["--version"],{stdio:["ignore","pipe","ignore"]});console.log(` ${Q.status===0?W(`codex ${Q.stdout.toString().trim()}`):f("codex version unavailable (BEACON_CODEX override?)")}`);for(let $ of B)console.log(` ${v.skills[$]?W(`skill ${$} (~/.agents/skills)`):H(`skill ${$} (~/.agents/skills) \u2014 missing`)}`);for(let $ of C)console.log(` ${v.hooks[$.event]?W(`hook ${$.event} \u2192 ${$.command}`):H(`hook ${$.event} \u2192 ${$.command} \u2014 missing`)} ${f($.description)}`);console.log(` ${v.agentsMdBlock?W("global ~/.codex/AGENTS.md block"):H("global ~/.codex/AGENTS.md block \u2014 missing")}`);let Z=wQ();console.log(` ${v.mcp?W("config.toml has [mcp_servers.beacon]"):H(`config.toml missing [mcp_servers.beacon]${Z?` \u2014 ${Z}`:""}`)}`)}console.log(b(`Current repo (${UQ})`));if(!j)console.log(` ${f("not registered with Beacon and no .mcp.json \u2014 run `beacon` here to wire it.")}`);else if(console.log(` ${j.mcpRegistered?W(".mcp.json has beacon entry"):H(".mcp.json missing beacon entry")}`),console.log(` ${j.agentsMdBlock?W("AGENTS.md has Beacon workflow block"):H("AGENTS.md missing Beacon workflow block")}`),console.log(` ${j.claudeMdImport?W("CLAUDE.md @-imports AGENTS.md"):H("CLAUDE.md does NOT @-import AGENTS.md")}`),console.log(` ${j.skills["beacon-init"]?W("skill beacon-init (repo)"):H("skill beacon-init (repo) \u2014 missing")}`),console.log(` ${j.skills["beacon-refresh"]?W("skill beacon-refresh (repo)"):H("skill beacon-refresh (repo) \u2014 missing")}`),v)console.log(` ${j.codexSkills["beacon-init"]?W("skill beacon-init (.agents/skills)"):H("skill beacon-init (.agents/skills) \u2014 missing")}`),console.log(` ${j.codexSkills["beacon-refresh"]?W("skill beacon-refresh (.agents/skills)"):H("skill beacon-refresh (.agents/skills) \u2014 missing")}`);var D0=B.some((Q)=>!F.skills[Q])||T.some((Q)=>!F.hooks[Q.event])||!F.claudeMdBlock||(v?B.some((Q)=>!v.skills[Q])||C.some((Q)=>!v.hooks[Q.event])||!v.agentsMdBlock||!v.mcp:!1)||(j?!j.mcpRegistered||!j.agentsMdBlock||!j.claudeMdImport||!j.skills["beacon-init"]||!j.skills["beacon-refresh"]||(v?!j.codexSkills["beacon-init"]||!j.codexSkills["beacon-refresh"]:!1):!1);if(D0)console.log(`
|
|
251
257
|
${f("Fix everything marked \u2717 by running")} \x1B[1mbeacon\x1B[0m ${f("in this repo.")}`);console.log();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
var n=Object.defineProperty;var s=(Q)=>Q;function d(Q,X){this[Q]=s.bind(null,X)}var o=(Q,X)=>{for(var Z in X)n(Q,Z,{get:X[Z],enumerable:!0,configurable:!0,set:d.bind(X,Z)})};var a=(Q,X)=>()=>(Q&&(X=Q(Q=0)),X);var R={};o(R,{provisionDb:()=>VQ});import{createClient as t}from"@libsql/client";import{drizzle as r}from"drizzle-orm/libsql";import{migrate as i}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as e}from"drizzle-orm/migrator";import{dirname as H,join as QQ}from"path";import{fileURLToPath as XQ}from"url";async function j(Q,X){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[X]})).rows.length>0}async function YQ(Q,X){let Z=await Q.execute(`PRAGMA table_info("${X}")`);return new Set(Z.rows.map(($)=>String($.name)))}async function q(Q){if(!await j(Q,"__drizzle_migrations"))return 0;let X=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(X.rows[0]?.n??0)}async function GQ(Q){for(let[X,Z]of Object.entries(JQ)){if(!await j(Q,X))continue;let $=await YQ(Q,X);for(let J of Z){if(!$.has(J))continue;await Q.execute(`UPDATE "${X}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function VQ(Q,X=$Q){let Z=t({url:Q});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;"),await Z.execute("PRAGMA busy_timeout = 5000;");let $=await j(Z,"__drizzle_migrations"),J=await j(Z,"Node"),Y=!1;if(J&&!$){let B=e({migrationsFolder:X})[0];if(B)await Z.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await Z.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[B.hash,B.folderMillis]}),Y=!0}let V=await q(Z);if(await i(r(Z),{migrationsFolder:X}),await q(Z)>V)Y=!0;return await GQ(Z),{migrated:Y}}finally{Z.close()}}var ZQ,$Q,JQ;var D=a(async()=>{ZQ=H(H(H(XQ(import.meta.url)))),$Q=process.env.BEACON_MIGRATIONS_DIR||QQ(ZQ,"drizzle"),JQ={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{AsyncLocalStorage as KQ}from"async_hooks";import{spawnSync as BQ}from"child_process";import{createHash as NQ}from"crypto";import{existsSync as v,mkdirSync as U,readFileSync as _,writeFileSync as T}from"fs";import{homedir as W}from"os";import{basename as MQ,join as K,parse as UQ,resolve as I}from"path";function G(){return process.env.BEACON_HOME||K(W(),".beacon")}function x(){return K(G(),"workspaces.json")}function M(Q){return NQ("sha256").update(Q).digest("hex").slice(0,12)}function S(Q=process.cwd()){let X=BQ("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(X.status===0){let Z=X.stdout?.toString().trim();if(Z)return Z}return Q}function F(Q){let X=I(Q);return X!==I(W())&&X!==UQ(X).root}function P(){return K(G(),"deleted.json")}function E(){try{let Q=JSON.parse(_(P(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function y(Q){U(G(),{recursive:!0}),T(P(),JSON.stringify(Q,null,2))}function f(Q){return E().includes(Q)}function bQ(Q){let X=E();if(!X.includes(Q))y([...X,Q])}function LQ(Q){let X=E();if(X.includes(Q))y(X.filter((Z)=>Z!==Q))}function z(Q){return K(G(),Q)}function jQ(Q){return`file:${K(z(Q),"db.sqlite")}`}function L(){try{let Q=JSON.parse(_(x(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function u(Q){U(G(),{recursive:!0}),T(x(),JSON.stringify(Q,null,2))}function k(){return L().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function N(Q){return L().find((X)=>X.id===Q)??null}function g(Q,X,Z=new Date().toISOString()){if(!F(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let $=M(Q);if(f($))throw Error(`beacon: workspace ${$} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let J=L(),Y=J.find((C)=>C.id===$),V={id:$,path:Q,name:X||Y?.name||MQ(Q),lastOpenedAt:Z},B=[V,...J.filter((C)=>C.id!==$)];return U(z($),{recursive:!0}),u(B),V}function mQ(Q,X){return LQ(M(Q)),g(Q,X)}function hQ(Q,X=new Date().toISOString()){let Z=L(),$=Z.find((J)=>J.id===Q);if(!$)return;$.lastOpenedAt=X,u(Z)}function pQ(Q){if(u(L().filter((X)=>X.id!==Q)),A()===Q)zQ(k()[0]?.id??null)}function w(){return K(G(),"active")}function A(){try{return _(w(),"utf8").trim()||null}catch{return null}}function zQ(Q){U(G(),{recursive:!0}),T(w(),Q??"")}function cQ(){let Q=A();return Q?N(Q):null}function lQ(){let Q=OQ()??A();return Q?N(Q):null}function nQ(Q){return N(Q)?.path??null}function sQ(){return v(x())}var b="beacon_ws";function m(Q,X){let Z=Q.headers.get("cookie");if(!Z)return null;for(let $ of Z.split(";")){let J=$.indexOf("=");if(J===-1)continue;if($.slice(0,J).trim()===X)return decodeURIComponent($.slice(J+1).trim())}return null}function dQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=m(Q,b);if(Z&&N(Z))return Z;return CQ()}function CQ(){let Q=k();return Q.length===1?Q[0].id:null}var HQ="x-beacon-workspace-path";async function oQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=Q.headers.get(HQ);if(Z&&F(Z)&&!f(M(Z))&&(!X||M(Z)===X)){let J=g(Z);return await _Q(J.id),J.id}let $=m(Q,b);if($&&N($))return $;return null}var h=new KQ;function aQ(Q,X){return Q?h.run(Q,X):X()}function OQ(){return h.getStore()??null}var O=new Set;function tQ(Q){O.delete(K(z(Q),"db.sqlite"))}async function _Q(Q){let X=z(Q),Z=K(X,"db.sqlite"),$=v(Z);if($&&O.has(Z))return{ok:!0,created:!1,migrated:!1};try{U(X,{recursive:!0});let{provisionDb:J}=await D().then(() => R),Y=await J(jQ(Q));return O.add(Z),{ok:!0,created:!$,migrated:$&&Y.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}import{connect as TQ}from"net";var p=4319;function xQ(Q,X,Z=400){return new Promise(($)=>{let J=TQ({host:Q,port:X}),Y=!1,V=(B)=>{if(Y)return;Y=!0,J.destroy(),$(B)};J.once("connect",()=>V(!0)),J.once("error",()=>V(!1)),J.setTimeout(Z,()=>V(!1))})}async function EQ(Q){for(let X of["127.0.0.1","::1"])if(await xQ(X,Q))return!1;return!0}async function eQ(Q,X=20){for(let Z=Q;Z<Q+X;Z++)if(await EQ(Z))return Z;return Q}import{readFileSync as uQ}from"fs";import{join as AQ}from"path";function qQ(){try{return JSON.parse(uQ(AQ(G(),"server.json"),"utf8"))}catch{return null}}function c(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${qQ()?.port||process.env.PORT||p}`}var l="";for await(let Q of process.stdin)l+=Q;try{let Q=JSON.parse(l||"{}"),X=Q?.tool_input?.file_path;if(typeof X==="string"&&X){let Z=M(S(typeof Q.cwd==="string"?Q.cwd:void 0)),$=await fetch(`${c()}/api/scope-guard/check?file=${encodeURIComponent(X)}`,{headers:{"x-beacon-workspace":Z}}).catch(()=>null);if($?.ok){let J=await $.json().catch(()=>null);if(J?.decision==="ask")process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:J.reason??"This edit is outside the current plan's declared scope."}}))}}}catch{}process.exit(0);
|
package/dist/bin/hook.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var WZ=Object.defineProperty;var
|
|
3
|
+
var WZ=Object.defineProperty;var BZ=(Q)=>Q;function HZ(Q,Z){this[Q]=BZ.bind(null,Z)}var e=(Q,Z)=>{for(var $ in Z)WZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:HZ.bind(Z,$)})};var v=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var JQ={};e(JQ,{removeRepoAssets:()=>MZ,installRefreshSkill:()=>PZ,installPlanSkill:()=>GZ,installInitSkill:()=>jZ,installCodexRepoSkills:()=>KZ,ensureWorkflowDoc:()=>uZ,ensureMcp:()=>vZ,auditRepo:()=>CZ,REFRESH_SKILL:()=>ZQ,PLAN_SKILL:()=>RQ,INIT_SKILL:()=>QQ});import{existsSync as N,mkdirSync as b,readFileSync as B,rmSync as f,writeFileSync as W}from"fs";import{join as U}from"path";function jZ(Q){let Z=U(Q,".claude","skills","beacon-init");b(Z,{recursive:!0});let $=U(Z,"SKILL.md");return W($,QQ),$}function PZ(Q){let Z=U(Q,".claude","skills","beacon-refresh");b(Z,{recursive:!0});let $=U(Z,"SKILL.md");return W($,ZQ),$}function GZ(Q){let Z=U(Q,".claude","skills","beacon-plan");b(Z,{recursive:!0});let $=U(Z,"SKILL.md");return W($,RQ),$}function KZ(Q){let Z=[];for(let $ of NZ){let J=U(Q,".agents","skills",$.name);b(J,{recursive:!0});let Y=U(J,"SKILL.md");W(Y,$.body()),Z.push(Y)}return Z}function uZ(Q){let Z=U(Q,"AGENTS.md"),$="";try{$=B(Z,"utf8")}catch{}let J=new RegExp(`${O}[\\s\\S]*?${$Q}`);$=J.test($)?$.replace(J,TQ):`${$.trim()}
|
|
4
4
|
|
|
5
5
|
${TQ}
|
|
6
|
-
`.trimStart(),
|
|
6
|
+
`.trimStart(),W(Z,$.endsWith(`
|
|
7
7
|
`)?$:`${$}
|
|
8
|
-
`);let Y=U(Q,"CLAUDE.md"),V="";try{V=B(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))
|
|
8
|
+
`);let Y=U(Q,"CLAUDE.md"),V="";try{V=B(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))W(Y,`${V?`${V.trim()}
|
|
9
9
|
|
|
10
10
|
`:""}@AGENTS.md
|
|
11
|
-
`)}function
|
|
12
|
-
`),{path:Z,added:!0}}function
|
|
13
|
-
`)}}catch{}let Y=!1,V=U(Q,"AGENTS.md");try{let z=B(V,"utf8"),
|
|
11
|
+
`)}function vZ(Q){let Z=U(Q,".mcp.json"),$={};try{$=JSON.parse(B(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},W(Z,JSON.stringify($,null,2)+`
|
|
12
|
+
`),{path:Z,added:!0}}function CZ(Q){let Z=U(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(B(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=B(U(Q,"AGENTS.md"),"utf8").includes(O)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(B(U(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":N(U(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":N(U(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":N(U(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":N(U(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function MZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let x=U(Q,".claude","skills",z);if(N(x))f(x,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let x=U(Q,".agents","skills",z);if(N(x))f(x,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=U(Q,".mcp.json");try{let z=JSON.parse(B(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)f(J,{force:!0});else W(J,JSON.stringify(z,null,2)+`
|
|
13
|
+
`)}}catch{}let Y=!1,V=U(Q,"AGENTS.md");try{let z=B(V,"utf8"),x=new RegExp(`\\n?${O}[\\s\\S]*?${$Q}\\n?`);if(x.test(z)){let i=z.replace(x,`
|
|
14
14
|
`).replace(/\n{3,}/g,`
|
|
15
15
|
|
|
16
|
-
`).trimStart();
|
|
16
|
+
`).trimStart();W(V,i.endsWith(`
|
|
17
17
|
`)?i:`${i}
|
|
18
|
-
`),Y=!0}}catch{}let q=!1,X=U(Q,"CLAUDE.md");try{let z=B(X,"utf8"),
|
|
18
|
+
`),Y=!0}}catch{}let q=!1,X=U(Q,"CLAUDE.md");try{let z=B(X,"utf8"),x=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(x!==z){if(!x.trim())f(X,{force:!0});else W(X,x);q=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:q}}var QQ=`---
|
|
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
|
---
|
|
@@ -129,6 +129,12 @@ Beacon extracts that block deterministically, strips it from the prose, and rend
|
|
|
129
129
|
board on /plan. The board is built ONLY from the block \u2014 prose is never parsed \u2014 so mirror EVERY
|
|
130
130
|
table/endpoint/feature you mention in the prose into the block, or that board will be empty.
|
|
131
131
|
|
|
132
|
+
- **Declare your scope.** List the repo-relative files this plan will touch in a top-level
|
|
133
|
+
\`"contract"\` array in the block (or the \`contract\` arg of \`beacon_propose_plan\`). When the user
|
|
134
|
+
has the plan scope-guard enabled, those files are frozen at approval and you're held to them while
|
|
135
|
+
implementing \u2014 editing an undeclared file pauses for the user's authorization (which then adds it
|
|
136
|
+
to the contract). Harmless when the guard is off. Declare the files you genuinely expect to edit.
|
|
137
|
+
|
|
132
138
|
\`beacon_present_plan\` opens /plan and BLOCKS until the user clicks Approve / Discard / submits
|
|
133
139
|
feedback, then returns their verdict. Implement code or migrations ONLY after it returns approval.
|
|
134
140
|
If it returns feedback, revise and call it again.
|
|
@@ -143,7 +149,7 @@ If it returns feedback, revise and call it again.
|
|
|
143
149
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
144
150
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
145
151
|
run \`beacon\` in this repo once.
|
|
146
|
-
`,
|
|
152
|
+
`,NZ,O="<!-- beacon:workflow:start -->",$Q="<!-- beacon:workflow:end -->",TQ;var YQ=v(()=>{NZ=[{name:"beacon-init",body:()=>QQ},{name:"beacon-refresh",body:()=>ZQ}];TQ=`${O}
|
|
147
153
|
## Beacon \u2014 feature workflow
|
|
148
154
|
|
|
149
155
|
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:
|
|
@@ -201,8 +207,8 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
201
207
|
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.
|
|
202
208
|
|
|
203
209
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
204
|
-
${$Q}`});import{existsSync as FQ,mkdirSync as VQ,readFileSync as E,rmSync as
|
|
205
|
-
`)}function y(Q,Z){let $=zQ(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((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),bQ(Q,$),!0}function L(Q,Z){return(zQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function
|
|
210
|
+
${$Q}`});import{existsSync as FQ,mkdirSync as VQ,readFileSync as E,rmSync as wZ,writeFileSync as A}from"fs";import{dirname as fQ,join as I}from"path";function zQ(Q){try{return JSON.parse(E(Q,"utf8"))}catch{return{}}}function bQ(Q,Z){VQ(fQ(Q),{recursive:!0}),A(Q,JSON.stringify(Z,null,2)+`
|
|
211
|
+
`)}function y(Q,Z){let $=zQ(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((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),bQ(Q,$),!0}function L(Q,Z){return(zQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function _(Q,Z){let $=zQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((q)=>{let X=q.hooks?.length??0,z=(q.hooks??[]).filter((x)=>x.command!==Z.command);if(z.length!==X)Y=!0;return{...q,hooks:z}}).filter((q)=>(q.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 bQ(Q,$),!0}function k(Q,Z,$,J){let Y=`${Z}
|
|
206
212
|
${J.trim()}
|
|
207
213
|
${$}`,V="";try{V=E(Q,"utf8")}catch{}let q=new RegExp(`${Z}[\\s\\S]*?${$}`);V=q.test(V)?V.replace(q,Y):V.trim()?`${V.trim()}
|
|
208
214
|
|
|
@@ -212,7 +218,7 @@ ${Y}
|
|
|
212
218
|
`)?V:`${V}
|
|
213
219
|
`)}function C(Q,Z){try{return E(Q,"utf8").includes(Z)}catch{return!1}}function S(Q,Z,$){let J="";try{J=E(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,`
|
|
214
220
|
|
|
215
|
-
`).trimStart();return A(Q,V),!0}function h(Q,Z,$){let J=I(Q,Z);VQ(J,{recursive:!0});let Y=I(J,"SKILL.md");return A(Y,$),Y}function M(Q,Z){return FQ(I(Q,Z,"SKILL.md"))}function m(Q,Z){let $=I(Q,Z);if(!FQ($))return!1;return
|
|
221
|
+
`).trimStart();return A(Q,V),!0}function h(Q,Z,$){let J=I(Q,Z);VQ(J,{recursive:!0});let Y=I(J,"SKILL.md");return A(Y,$),Y}function M(Q,Z){return FQ(I(Q,Z,"SKILL.md"))}function m(Q,Z){let $=I(Q,Z);if(!FQ($))return!1;return wZ($,{recursive:!0,force:!0}),!0}var j,D=`## Beacon (visual planning panel)
|
|
216
222
|
|
|
217
223
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
218
224
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -233,18 +239,18 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
233
239
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
234
240
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
235
241
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
236
|
-
verbatim. Do NOT implement until the tool returns approval.`;var qQ=v(()=>{j=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as
|
|
242
|
+
verbatim. Do NOT implement until the tool returns approval.`;var qQ=v(()=>{j=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as gZ,renameSync as TZ,rmSync as RZ,writeFileSync as FZ}from"fs";import{dirname as fZ}from"path";function p(Q,Z){gZ(fZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{FZ($,Z),TZ($,Q)}catch(J){throw RZ($,{force:!0}),J}}function y0(Q,Z,$=!1){p(Q,JSON.stringify(Z,null,$?2:void 0))}var OQ=()=>{};var kQ={};e(kQ,{setupCodexAssets:()=>EZ,removeCodexMcp:()=>_Q,removeCodexArtifacts:()=>DZ,hasCodexMcp:()=>WQ,ensureCodexMcp:()=>LQ,codexMcpProblem:()=>IZ,codexDetected:()=>AQ,auditCodex:()=>AZ,CODEX_HOOKS:()=>a});import{readFileSync as d}from"fs";import{homedir as bZ}from"os";import{join as T}from"path";function IQ(){return process.env.HOME||process.env.USERPROFILE||bZ()}function AQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(XQ===void 0)XQ=Bun.which("codex")!==null;return XQ}function g(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function WQ(){try{return Boolean(g(d(K(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function IZ(){let Q="";try{Q=d(K(),"utf8")}catch{return null}let Z=g(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${w}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${w}`;return null}function LQ(){let Q="",Z=!1;try{Q=d(K(),"utf8"),Z=!0}catch{}if(Z){let V=g(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${w}`};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 ${w}`}}let $=!Q?"":Q.endsWith(`
|
|
237
243
|
`)?`
|
|
238
244
|
`:`
|
|
239
245
|
|
|
240
|
-
`,J=Q+$+
|
|
241
|
-
`),$=Z.indexOf(DQ);if($===-1)return{removed:!1,skipped:
|
|
246
|
+
`,J=Q+$+OZ;if(g(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${w}`};return p(K(),J),{added:!0}}function _Q(){let Q="";try{Q=d(K(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
247
|
+
`),$=Z.indexOf(DQ);if($===-1)return{removed:!1,skipped:WQ()};let J=Z.indexOf(yQ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
|
|
242
248
|
`).replace(/\n{3,}/g,`
|
|
243
249
|
|
|
244
|
-
`).replace(/^\n+/,"");if(g(Y)===null)return{removed:!1,skipped:!0};return p(K(),Y),{removed:!0}}async function
|
|
250
|
+
`).replace(/^\n+/,"");if(g(Y)===null)return{removed:!1,skipped:!0};return p(K(),Y),{removed:!0}}async function EZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (YQ(),JQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let z of j){if(!M(n(),z))Y.push(z);h(n(),z,J[z])}let V=0;for(let z of a)if(y(xQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let q=C(c(),l);k(c(),l,EQ,D);let X=LQ();return{skillsAdded:Y,hooksAdded:V,agentsMdBlockTouched:!q,mcp:X}}function AZ(){let Q={};for(let $ of j)Q[$]=M(n(),$);let Z={};for(let $ of a)Z[$.event]=L(xQ(),{event:$.event,command:$.command});return{detected:AQ(),skills:Q,hooks:Z,agentsMdBlock:C(c(),l),mcp:WQ()}}function DZ(){let Q=[];for(let Y of j)if(m(n(),Y))Q.push(Y);let Z=0;for(let Y of a)if(_(xQ(),{event:Y.event,command:Y.command}))Z++;let $=S(c(),l,EQ),J=_Q();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var UQ=()=>T(IQ(),".codex"),xQ=()=>T(UQ(),"hooks.json"),K=()=>T(UQ(),"config.toml"),c=()=>T(UQ(),"AGENTS.md"),n=()=>T(IQ(),".agents","skills"),l="<!-- beacon:global:start -->",EQ="<!-- beacon:global:end -->",a,XQ,DQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",yQ="# beacon:end",OZ,w="add it manually: codex mcp add beacon -- beacon mcp";var SQ=v(()=>{qQ();OQ();a=[{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=`${DQ}
|
|
245
251
|
[mcp_servers.beacon]
|
|
246
252
|
command = "beacon"
|
|
247
253
|
args = ["mcp"]
|
|
248
254
|
${yQ}
|
|
249
|
-
`});var lQ={};e(lQ,{provisionDb:()=>
|
|
250
|
-
`)){let J=
|
|
255
|
+
`});var lQ={};e(lQ,{provisionDb:()=>Y0});import{createClient as aZ}from"@libsql/client";import{drizzle as sZ}from"drizzle-orm/libsql";import{migrate as tZ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as rZ}from"drizzle-orm/migrator";import{dirname as NQ,join as oZ}from"path";import{fileURLToPath as iZ}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 $0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.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 J0(Q){for(let[Z,$]of Object.entries(Z0)){if(!await r(Q,Z))continue;let J=await $0(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 Y0(Q,Z=Q0){let $=aZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await r($,"__drizzle_migrations"),Y=await r($,"Node"),V=!1;if(Y&&!J){let X=rZ({migrationsFolder:Z})[0];if(X)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:[X.hash,X.folderMillis]}),V=!0}let q=await nQ($);if(await tZ(sZ($),{migrationsFolder:Z}),await nQ($)>q)V=!0;return await J0($),{migrated:V}}finally{$.close()}}var eZ,Q0,Z0;var dQ=v(async()=>{eZ=NQ(NQ(NQ(iZ(import.meta.url)))),Q0=process.env.BEACON_MIGRATIONS_DIR||oZ(eZ,"drizzle"),Z0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});qQ();import{existsSync as yZ}from"fs";import{homedir as LZ}from"os";import{join as s}from"path";function _Z(){return process.env.HOME||process.env.USERPROFILE||LZ()}var t=()=>s(_Z(),".claude"),BQ=()=>s(t(),"skills"),HQ=()=>s(t(),"settings.json"),jQ=()=>s(t(),"CLAUDE.md"),PQ="<!-- beacon:global:start -->",hQ="<!-- beacon:global:end -->";var kZ=D,GQ=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract (when the scope-guard flag is on): in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. No-op + fail-open otherwise."},{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 h(BQ(),Q,Z)}function mQ(Q){return M(BQ(),Q)}function hZ(Q){return m(BQ(),Q)}function mZ(Q){return y(HQ(),Q)}function pZ(Q){return L(HQ(),Q)}function cZ(Q){return _(HQ(),Q)}function nZ(Q){k(jQ(),PQ,hQ,Q)}function pQ(){return C(jQ(),PQ)}function lZ(){return S(jQ(),PQ,hQ)}function d0(){let Q={};for(let $ of j)Q[$]=mQ($);let Z={};for(let $ of GQ)Z[$.event]=pZ({event:$.event,command:$.command});return{homeExists:yZ(t()),skills:Q,hooks:Z,claudeMdBlock:pQ()}}async function dZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (YQ(),JQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let X of j){if(!mQ(X))Y.push(X);SZ(X,J[X])}let V=0;for(let X of GQ)if(mZ({event:X.event,matcher:X.matcher,command:X.command}))V++;let q=pQ();return nZ(kZ),{skillsAdded:Y,hooksAdded:V,claudeMdBlockTouched:!q}}async function cQ(){let Q;try{Q={ok:!0,...await dZ()}}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(() => (SQ(),kQ));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 a0(){let Q=[];for(let J of j)if(hZ(J))Q.push(J);let Z=0;for(let J of GQ)if(cZ(J))Z++;let $=lZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as V0}from"async_hooks";import{spawnSync as z0}from"child_process";import{createHash as q0}from"crypto";import{existsSync as sQ,mkdirSync as R,readFileSync as uQ,writeFileSync as vQ}from"fs";import{homedir as tQ}from"os";import{basename as X0,join as P,parse as U0,resolve as aQ}from"path";function H(){return process.env.BEACON_HOME||P(tQ(),".beacon")}function CQ(){return P(H(),"workspaces.json")}function u(Q){return q0("sha256").update(Q).digest("hex").slice(0,12)}function rQ(Q=process.cwd()){let Z=z0("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 oQ(Q){let Z=aQ(Q);return Z!==aQ(tQ())&&Z!==U0(Z).root}function iQ(){return P(H(),"deleted.json")}function MQ(){try{let Q=JSON.parse(uQ(iQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function eQ(Q){R(H(),{recursive:!0}),vQ(iQ(),JSON.stringify(Q,null,2))}function QZ(Q){return MQ().includes(Q)}function q1(Q){let Z=MQ();if(!Z.includes(Q))eQ([...Z,Q])}function x0(Q){let Z=MQ();if(Z.includes(Q))eQ(Z.filter(($)=>$!==Q))}function o(Q){return P(H(),Q)}function W0(Q){return`file:${P(o(Q),"db.sqlite")}`}function F(){try{let Q=JSON.parse(uQ(CQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function wQ(Q){R(H(),{recursive:!0}),vQ(CQ(),JSON.stringify(Q,null,2))}function ZZ(){return F().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function G(Q){return F().find((Z)=>Z.id===Q)??null}function $Z(Q,Z,$=new Date().toISOString()){if(!oQ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=u(Q);if(QZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=F(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||X0(Q),lastOpenedAt:$},X=[q,...Y.filter((z)=>z.id!==J)];return R(o(J),{recursive:!0}),wQ(X),q}function X1(Q,Z){return x0(u(Q)),$Z(Q,Z)}function U1(Q,Z=new Date().toISOString()){let $=F(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,wQ($)}function x1(Q){if(wQ(F().filter((Z)=>Z.id!==Q)),gQ()===Q)B0(ZZ()[0]?.id??null)}function JZ(){return P(H(),"active")}function gQ(){try{return uQ(JZ(),"utf8").trim()||null}catch{return null}}function B0(Q){R(H(),{recursive:!0}),vQ(JZ(),Q??"")}function W1(){let Q=gQ();return Q?G(Q):null}function B1(){let Q=P0()??gQ();return Q?G(Q):null}function H1(Q){return G(Q)?.path??null}function j1(){return sQ(CQ())}var YZ="beacon_ws";function VZ(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 P1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&G(Z))return Z;let $=VZ(Q,YZ);if($&&G($))return $;return H0()}function H0(){let Q=ZZ();return Q.length===1?Q[0].id:null}var j0="x-beacon-workspace-path";async function G1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&G(Z))return Z;let $=Q.headers.get(j0);if($&&oQ($)&&!QZ(u($))&&(!Z||u($)===Z)){let Y=$Z($);return await G0(Y.id),Y.id}let J=VZ(Q,YZ);if(J&&G(J))return J;return null}var zZ=new V0;function N1(Q,Z){return Q?zZ.run(Q,Z):Z()}function P0(){return zZ.getStore()??null}var KQ=new Set;function K1(Q){KQ.delete(P(o(Q),"db.sqlite"))}async function G0(Q){let Z=o(Q),$=P(Z,"db.sqlite"),J=sQ($);if(J&&KQ.has($))return{ok:!0,created:!1,migrated:!1};try{R(Z,{recursive:!0});let{provisionDb:Y}=await dQ().then(() => lQ),V=await Y(W0(Q));return KQ.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)}}}import{connect as N0}from"net";var qZ=4319;function K0(Q,Z,$=400){return new Promise((J)=>{let Y=N0({host:Q,port:Z}),V=!1,q=(X)=>{if(V)return;V=!0,Y.destroy(),J(X)};Y.once("connect",()=>q(!0)),Y.once("error",()=>q(!1)),Y.setTimeout($,()=>q(!1))})}async function u0(Q){for(let Z of["127.0.0.1","::1"])if(await K0(Z,Q))return!1;return!0}async function C1(Q,Z=20){for(let $=Q;$<Q+Z;$++)if(await u0($))return $;return Q}import{resolve as v0}from"path";var C0="*** Begin Patch",M0=/^\*\*\* (Update File|Add File|Move to): (.+)$/;function w0(Q){let Z=[];for(let $ of Q.split(`
|
|
256
|
+
`)){let J=M0.exec($.trim());if(!J)continue;let Y=J[2].trim();if(J[1]==="Move to")Z.pop();Z.push(Y)}return Z}function XZ(Q){let Z=Q.tool_input;if(Z===null||typeof Z!=="object")return[];let $=Z,J=[];if(typeof $.file_path==="string")J.push($.file_path);if(typeof $.path==="string")J.push($.path);if(Array.isArray($.files))for(let V of $.files){let q=V?.file_path;if(typeof q==="string")J.push(q)}if(J.length)return J;let Y=typeof Q.cwd==="string"?Q.cwd:process.cwd();for(let V of Object.values($)){if(typeof V!=="string"||!V.includes(C0))continue;return w0(V).map((q)=>v0(Y,q))}return[]}import{readFileSync as g0}from"fs";import{join as T0}from"path";function R0(){try{return JSON.parse(g0(T0(H(),"server.json"),"utf8"))}catch{return null}}function UZ(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${R0()?.port||process.env.PORT||qZ}`}await cQ();var xZ="";for await(let Q of process.stdin)xZ+=Q;try{let Q=JSON.parse(xZ||"{}"),Z=XZ(Q);if(Z.length){let $=u(rQ(typeof Q.cwd==="string"?Q.cwd:void 0));await fetch(`${UZ()}/api/map/touch-active`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":$},body:JSON.stringify({files:Z})}).catch(()=>{})}}catch{}process.exit(0);
|