trybeacon 0.1.48 → 0.1.50
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 +13 -13
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +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_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/context/feature/route.js +1 -1
- package/.next/server/app/api/db/arrange/route.js +1 -1
- package/.next/server/app/api/entities/route.js +1 -1
- package/.next/server/app/api/map/start/route.js +1 -1
- package/.next/server/app/docs/page.js +1 -1
- 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 +3 -3
- package/.next/server/app/docs.segments/_full.segment.rsc +3 -3
- 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 +2 -2
- package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- 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 +1 -1
- 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 +4 -4
- package/.next/server/app/help.segments/_full.segment.rsc +4 -4
- 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 +10 -12
- package/.next/server/app/help.segments/help.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- 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 +1 -1
- 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_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +13 -13
- package/.next/server/chunks/1130.js +1 -1
- package/.next/server/chunks/1341.js +1 -1
- package/.next/server/chunks/2933.js +1 -1
- package/.next/server/chunks/{7208.js → 2999.js} +3 -3
- package/.next/server/chunks/3622.js +1 -1
- package/.next/server/chunks/9734.js +1 -1
- package/.next/server/chunks/9773.js +1 -0
- 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/1487-13f43d25413ae041.js +1 -0
- package/.next/static/chunks/3343-af1292b51a276724.js +1 -0
- package/.next/static/chunks/app/docs/page-ae19d2e91ec24771.js +1 -0
- package/.next/static/chunks/app/map/page-5074176a5e746ffb.js +1 -0
- package/.next/static/chunks/app/page-541e900d67f17dae.js +1 -0
- package/.next/static/chunks/app/plan/{page-257d486640eadd7f.js → page-3c4c1fc03275299f.js} +1 -1
- package/.next/static/css/629ab377241de9ca.css +1 -0
- package/.next/trace +39 -39
- package/.next/trace-build +1 -1
- package/dist/bin/beacon.js +7 -7
- package/dist/bin/doctor.js +43 -32
- package/dist/bin/hook.js +43 -32
- package/dist/bin/mcp.js +49 -38
- package/dist/bin/plan.js +45 -34
- package/dist/bin/prompt.js +1 -1
- package/dist/bin/remove.js +7 -7
- package/dist/bin/uninstall.js +42 -31
- package/dist/lib/assets.js +30 -19
- package/dist/lib/codex-install.js +40 -29
- package/dist/lib/global-install.js +40 -29
- package/package.json +1 -1
- package/.next/server/chunks/805.js +0 -1
- package/.next/static/chunks/8074-a6b2725786399e2c.js +0 -1
- package/.next/static/chunks/85-82015ecb44b65d3e.js +0 -1
- package/.next/static/chunks/app/docs/page-0c841cb9a7aa2f9a.js +0 -1
- package/.next/static/chunks/app/map/page-c06fcf30d8172f82.js +0 -1
- package/.next/static/chunks/app/page-968dd5a6f667bff9.js +0 -1
- package/.next/static/css/5a58d83133d25695.css +0 -1
- /package/.next/static/{gNMdQmtkjPn6XQhRMDoMg → J1AU9kp6Vs1x9YOBkXMiR}/_buildManifest.js +0 -0
- /package/.next/static/{gNMdQmtkjPn6XQhRMDoMg → J1AU9kp6Vs1x9YOBkXMiR}/_ssgManifest.js +0 -0
package/.next/trace-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"name":"run-webpack","duration":
|
|
1
|
+
[{"name":"run-webpack","duration":28943484,"timestamp":118901747,"id":14,"parentId":1,"tags":{},"startTime":1781631967154,"traceId":"6259803428af983d"},{"name":"run-typescript","duration":12690485,"timestamp":147847841,"id":4126,"parentId":1,"tags":{},"startTime":1781631996101,"traceId":"6259803428af983d"},{"name":"static-check","duration":667088,"timestamp":160586710,"id":4129,"parentId":1,"tags":{},"startTime":1781632008839,"traceId":"6259803428af983d"},{"name":"static-generation","duration":4218534,"timestamp":161797331,"id":4283,"parentId":1,"tags":{},"startTime":1781632010050,"traceId":"6259803428af983d"},{"name":"collect-build-traces","duration":11837205,"timestamp":161256828,"id":4280,"parentId":1,"tags":{},"startTime":1781632009510,"traceId":"6259803428af983d"},{"name":"telemetry-flush","duration":58,"timestamp":173097636,"id":4292,"parentId":1,"tags":{},"startTime":1781632021350,"traceId":"6259803428af983d"},{"name":"next-build","duration":54308800,"timestamp":118788903,"id":1,"tags":{"buildMode":"default","version":"16.2.7","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781631967042,"traceId":"6259803428af983d"}]
|
package/dist/bin/beacon.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
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(` ${
|
|
5
|
-
`)}return{initSkill:H,refreshSkill:B,mcp
|
|
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
|
|
3
|
+
import{execSync as _,spawn as m}from"child_process";import{existsSync as u,mkdirSync as g,openSync as c,readFileSync as d,writeFileSync as p}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 Q(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(Q("bin/mcp.ts"));else if(Y==="hook")await import(Q("bin/hook.ts"));else if(Y==="guard")await import(Q("bin/guard.ts"));else if(Y==="plan")await import(Q("bin/plan.ts"));else if(Y==="prompt")await import(Q("bin/prompt.ts"));else if(Y==="stop-hook")await import(Q("bin/stop-hook.ts"));else if(Y==="stop")f();else if(Y==="remove")await import(Q("bin/remove.ts"));else if(Y==="setup")await E(D()||P);else if(Y==="doctor")await import(Q("bin/doctor.ts"));else if(Y==="uninstall")await import(Q("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(Q("lib/assets.ts")),{selfHealGlobal:F}=await import(Q("lib/global-install.ts")),{codexDetected:M}=await import(Q("lib/codex-install.ts")),N=await F(),H=X(z),B=J(z);W(z);let $=G(z),y=M()?K(z):[];if(Z){if($.added||$.updated)console.log(`[beacon] ${$.added?"registered":"updated"} Beacon MCP in ${$.path} \u2014 restart your agent CLI`+($.updated?" to apply the longer plan-review timeout.":" to use @beacon mentions."))}else{console.log(`
|
|
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(` ${$.added?"\u2713 added ":"\xB7 kept "} Beacon MCP in ${$.path}`),console.log(` \u2192 in this repo, run /beacon-init in your agent (Claude Code or Codex) to map the repo.
|
|
5
|
+
`)}return{initSkill:H,refreshSkill:B,mcp:$,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(d(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 p(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(Q("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(Q("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
|
+
`+" 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 $=H.codex;if($){let q=[];if($.skillsAdded.length)q.push(`skills ${$.skillsAdded.join(", ")}`);if($.hooksAdded)q.push(`${$.hooksAdded} Codex hook${$.hooksAdded===1?"":"s"}`);if($.agentsMdBlockTouched)q.push("global AGENTS.md block");if($.mcp.added)q.push("MCP entry in config.toml");if(q.length)console.log(`[beacon] wired into ~/.codex/: ${q.join(" + ")}.`);if($.mcp.error)console.log(`[beacon] codex MCP not wired: ${$.mcp.error}`)}try{let q=await import(Q("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,
|
|
7
7
|
`+` architecture \u2014 never repo names, paths, or code) at most every 12h to count
|
|
8
8
|
`+` active installs. Opt out: \`beacon telemetry off\`, BEACON_TELEMETRY_DISABLED=1,
|
|
9
9
|
or DO_NOT_TRACK=1. Details: beacon telemetry status.${b?"":" (currently disabled by your env)"}`),q.ensureTelemetryId()}}catch{}Z(z);let I=`http://localhost:${await s()}`,C=`/map?ws=${W}`,h=`${I}/api/workspace/activate?id=${W}&redirect=${encodeURIComponent(C)}`;if(console.log(`
|
|
@@ -12,8 +12,8 @@ import{execSync as _,spawn as m}from"child_process";import{existsSync as u,mkdir
|
|
|
12
12
|
data: ${F}
|
|
13
13
|
url: ${I}
|
|
14
14
|
`),console.log(" (the server keeps running in the background \u2014 `beacon stop` to stop it)\n"),await fetch(`${I}/api/tab/presence`,{headers:{"x-beacon-workspace":W}}).then((q)=>q.json()).then((q)=>!!q?.live).catch(()=>!1))await fetch(`${I}/api/tab/nav`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":W},body:JSON.stringify({path:C})}).catch(()=>{}),console.log(` \u21BB reusing your open Beacon tab \u2014 switch to your browser.
|
|
15
|
-
`);else o(h)}function x(){return R(U(V,"package.json"))?.version??"0.0.0"}async function e(z){let Z=await import(
|
|
15
|
+
`);else o(h)}function x(){return R(U(V,"package.json"))?.version??"0.0.0"}async function e(z){let Z=await import(Q("lib/telemetry.ts"));if(z==="on"||z==="off"){Z.setTelemetryEnabled(z==="on"),console.log(`[beacon] telemetry ${z==="on"?"enabled":"disabled"}.`);return}if(z&&z!=="status")console.error("usage: beacon telemetry [on|off|status]"),process.exit(1);let X=Z.telemetryStatus(),J=X.reason==="env:BEACON_TELEMETRY_DISABLED"?" (BEACON_TELEMETRY_DISABLED=1)":X.reason==="env:DO_NOT_TRACK"?" (DO_NOT_TRACK)":X.reason==="preference"?" (beacon telemetry off)":"";if(console.log(`
|
|
16
16
|
\u25C9 Beacon telemetry: ${X.enabled?"enabled":"disabled"}${J}`),console.log(` machine id: ${X.machineId??"(not generated yet \u2014 created on first `beacon` run)"}`),X.machineId)console.log(` payload: ${JSON.stringify(Z.heartbeatPayload(x()))}`);console.log(` sent at most every 12h while the daemon runs \u2014 never repo names, paths, or code.
|
|
17
|
-
`+" toggle: `beacon telemetry on|off` \xB7 env: BEACON_TELEMETRY_DISABLED=1 or DO_NOT_TRACK=1\n")}async function zz(z){let Z=x(),{INSTALL_COMMAND:X,NPM_LATEST_URL:J}=await import(
|
|
18
|
-
npm i -g trybeacon@latest`);return}let K=null;try{let G=await fetch(J);if(G.ok)K=(await G.json()).version??null}catch{}if(K&&!z){let{isNewerVersion:G}=await import(
|
|
17
|
+
`+" toggle: `beacon telemetry on|off` \xB7 env: BEACON_TELEMETRY_DISABLED=1 or DO_NOT_TRACK=1\n")}async function zz(z){let Z=x(),{INSTALL_COMMAND:X,NPM_LATEST_URL:J}=await import(Q("lib/release.ts"));if(L()==="win32"){console.log(`[beacon] current version v${Z}.`),console.log(`[beacon] on Windows, update with your package manager:
|
|
18
|
+
npm i -g trybeacon@latest`);return}let K=null;try{let G=await fetch(J);if(G.ok)K=(await G.json()).version??null}catch{}if(K&&!z){let{isNewerVersion:G}=await import(Q("lib/semver.ts"));if(!G(K,Z)){console.log(`[beacon] already on the latest version (v${Z}).`),console.log(" run `beacon update --force` to reinstall anyway.");return}}console.log(K?`[beacon] updating Beacon v${Z} \u2192 v${K}\u2026`:`[beacon] reinstalling Beacon (current v${Z})\u2026`);try{_(X,{stdio:"inherit"})}catch{console.error(`[beacon] update failed. Run it manually:
|
|
19
19
|
${X}`),process.exitCode=1;return}f(),console.log("[beacon] updated. Run `beacon` to relaunch on the new version.")}function f(){let z=R(A);if(z&&k(z.pid))try{try{process.kill(-z.pid)}catch{process.kill(z.pid)}console.log(`[beacon] stopped the server (pid ${z.pid}).`)}catch{console.log("[beacon] could not stop the server.")}else console.log("[beacon] no server running.")}
|
package/dist/bin/doctor.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var
|
|
3
|
+
var MZ=Object.defineProperty;var uZ=(Q)=>Q;function wZ(Q,Z){this[Q]=uZ.bind(null,Z)}var jQ=(Q,Z)=>{for(var $ in Z)MZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:wZ.bind(Z,$)})};var u=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var b0=1500,L0=480000,_0=1800000,L=3600000,k0=3000;var hQ=()=>{};var GQ={};jQ(GQ,{removeRepoAssets:()=>OZ,installRefreshSkill:()=>TZ,installPlanSkill:()=>RZ,installInitSkill:()=>FZ,installCodexRepoSkills:()=>EZ,ensureWorkflowDoc:()=>IZ,ensureMcp:()=>DZ,auditRepo:()=>NQ,REFRESH_SKILL:()=>vQ,PLAN_SKILL:()=>pQ,INIT_SKILL:()=>PQ});import{existsSync as w,mkdirSync as k,readFileSync as x,rmSync as _,writeFileSync as N}from"fs";import{join as q}from"path";function FZ(Q){let Z=q(Q,".claude","skills","beacon-init");k(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,PQ),$}function TZ(Q){let Z=q(Q,".claude","skills","beacon-refresh");k(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,vQ),$}function RZ(Q){let Z=q(Q,".claude","skills","beacon-plan");k(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,pQ),$}function EZ(Q){let Z=[];for(let $ of gZ){let J=q(Q,".agents","skills",$.name);k(J,{recursive:!0});let Y=q(J,"SKILL.md");N(Y,$.body()),Z.push(Y)}return Z}function IZ(Q){let Z=q(Q,"AGENTS.md"),$="";try{$=x(Z,"utf8")}catch{}let J=new RegExp(`${S}[\\s\\S]*?${BQ}`);$=J.test($)?$.replace(J,mQ):`${$.trim()}
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${mQ}
|
|
6
6
|
`.trimStart(),N(Z,$.endsWith(`
|
|
7
7
|
`)?$:`${$}
|
|
8
|
-
`);let Y=q(Q,"CLAUDE.md"),V="";try{V=
|
|
8
|
+
`);let Y=q(Q,"CLAUDE.md"),V="";try{V=x(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))N(Y,`${V?`${V.trim()}
|
|
9
9
|
|
|
10
10
|
`:""}@AGENTS.md
|
|
11
|
-
`)}function
|
|
12
|
-
`),{path:Z,added:!0}
|
|
13
|
-
`)}}catch{}let
|
|
11
|
+
`)}function DZ(Q){let Z=q(Q,".mcp.json"),$={};try{$=JSON.parse(x(Z,"utf8"))}catch{}$.mcpServers=$.mcpServers??{};let J=$.mcpServers.beacon;if(J){if(!J.timeout||J.timeout<L)return J.timeout=L,N(Z,JSON.stringify($,null,2)+`
|
|
12
|
+
`),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:L},N(Z,JSON.stringify($,null,2)+`
|
|
13
|
+
`),{path:Z,added:!0,updated:!1}}function NQ(Q){let Z=q(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(x(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=x(q(Q,"AGENTS.md"),"utf8").includes(S)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(x(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":w(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":w(q(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":w(q(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":w(q(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function OZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let P=q(Q,".claude","skills",z);if(w(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(w(P))_(P,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=q(Q,".mcp.json");try{let z=JSON.parse(x(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)_(J,{force:!0});else N(J,JSON.stringify(z,null,2)+`
|
|
14
|
+
`)}}catch{}let Y=!1,V=q(Q,"AGENTS.md");try{let z=x(V,"utf8"),P=new RegExp(`\\n?${S}[\\s\\S]*?${BQ}\\n?`);if(P.test(z)){let HQ=z.replace(P,`
|
|
14
15
|
`).replace(/\n{3,}/g,`
|
|
15
16
|
|
|
16
|
-
`).trimStart();N(V,
|
|
17
|
-
`)?
|
|
18
|
-
`),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=
|
|
17
|
+
`).trimStart();N(V,HQ.endsWith(`
|
|
18
|
+
`)?HQ:`${HQ}
|
|
19
|
+
`),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=x(U,"utf8"),P=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==z){if(!P.trim())_(U,{force:!0});else N(U,P);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:X}}var PQ=`---
|
|
19
20
|
name: beacon-init
|
|
20
21
|
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
22
|
---
|
|
@@ -54,7 +55,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
54
55
|
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
56
|
|
|
56
57
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
57
|
-
`,
|
|
58
|
+
`,vQ=`---
|
|
58
59
|
name: beacon-refresh
|
|
59
60
|
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
61
|
---
|
|
@@ -70,7 +71,7 @@ Beacon was already initialized in this repo (\`/beacon-init\` ran at some point)
|
|
|
70
71
|
|
|
71
72
|
## What gets preserved vs replaced
|
|
72
73
|
|
|
73
|
-
The \`beacon_init_persist\` tool **replaces only init-derived nodes** (\`source=INIT\`). A curated architecture node (created by \`
|
|
74
|
+
The \`beacon_init_persist\` tool **replaces only init-derived nodes** (\`source=INIT\`). A curated architecture node (created by \`beacon_feature\` action:done or by hand) whose title matches a component in your refreshed analysis is **merged in place** \u2014 your fresh \`domain\`/\`role\`/\`plain\`/\`layer\`/\`files\` land on it, but it keeps its source, position, status, and bug flags, and no duplicate INIT node is created. Curated nodes your analysis does NOT mention survive untouched, as do hand-edited tables, custom positions, notes, and draft feature plans. So you can re-run this freely.
|
|
74
75
|
|
|
75
76
|
The one caveat: if the user manually edited an INIT-source node on the canvas (e.g., renamed it, rewrote its role), that edit IS overwritten when you re-persist \u2014 and a renamed node no longer title-matches, so it survives as its own card. If the user mentions hand-curated INIT nodes, ask whether they want those carried into the new analysis verbatim.
|
|
76
77
|
|
|
@@ -101,7 +102,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
101
102
|
If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
|
|
102
103
|
|
|
103
104
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
104
|
-
`,
|
|
105
|
+
`,pQ=`---
|
|
105
106
|
name: beacon-plan
|
|
106
107
|
description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
|
|
107
108
|
---
|
|
@@ -149,7 +150,7 @@ If it returns feedback, revise and call it again.
|
|
|
149
150
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
150
151
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
151
152
|
run \`beacon\` in this repo once.
|
|
152
|
-
`,
|
|
153
|
+
`,gZ,S="<!-- beacon:workflow:start -->",BQ="<!-- beacon:workflow:end -->",mQ;var h=u(()=>{hQ();gZ=[{name:"beacon-init",body:()=>PQ},{name:"beacon-refresh",body:()=>vQ}];mQ=`${S}
|
|
153
154
|
## Beacon \u2014 feature workflow
|
|
154
155
|
|
|
155
156
|
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:
|
|
@@ -174,13 +175,23 @@ When listing endpoints, give each \`uses: [{ table, access }]\` so the endpoint\
|
|
|
174
175
|
|
|
175
176
|
EVERY feature MUST carry \`category\` (e.g. AUTH | SEARCH | DATA | INTEL | BILLING | \u2026; \`cluster\` is accepted as an alias) and \`priority\` (0 = P0 critical, 1 = P1 high, 2 = P2 medium, 3 = P3 low). Beacon REJECTS a plan whose features omit either \u2014 \`beacon_propose_plan\` returns the list of what's missing, and an ExitPlanMode \`\`\`beacon block is denied \u2014 so set both on every feature instead of relying on defaults.
|
|
176
177
|
|
|
177
|
-
When the workspace HAS A FRONTEND (Beacon knows \u2014 the agent set \`hasFrontend\` at init, or frontend files were detected), every feature must ALSO carry \`layer\`: \`"frontend" | "backend" | "fullstack"\` \u2014 which side of the stack the work lands on. Plans omitting it are REJECTED the same way category/priority are. It works on every surface that creates roadmap cards (\`beacon_propose_plan\`, the \`\`\`beacon block, \`
|
|
178
|
+
When the workspace HAS A FRONTEND (Beacon knows \u2014 the agent set \`hasFrontend\` at init, or frontend files were detected), every feature must ALSO carry \`layer\`: \`"frontend" | "backend" | "fullstack"\` \u2014 which side of the stack the work lands on. Plans omitting it are REJECTED the same way category/priority are. It works on every surface that creates roadmap cards (\`beacon_propose_plan\`, the \`\`\`beacon block, \`beacon_feature\` \u2014 sub-tasks default to the parent's layer) and on architecture components (\`beacon_feature\` action:done / \`beacon_init_persist\`). In a pure-backend repo, never set it \u2014 the boards don't show it there.
|
|
178
179
|
|
|
179
|
-
|
|
180
|
+
### Adding a card directly \u2014 \`beacon_feature\` (no review gate)
|
|
181
|
+
|
|
182
|
+
To put a card on the board WITHOUT the plan-review flow, call \`beacon_feature\` \u2014 ONE tool for a feature's whole lifecycle:
|
|
183
|
+
- \`{ action: "add" }\` creates a card in a SINGLE call. It defaults to \`status: "backlog"\` (a PENDING item you're NOT working on yet); pass \`status: "active"\` to start it IN_PROGRESS now. A title that matches an existing card returns \`exists\` (reuse it) \u2014 \`add\` never activates or demotes a card already on the board.
|
|
184
|
+
- \`{ action: "start" }\` marks an existing card IN_PROGRESS (create-or-flag).
|
|
185
|
+
- \`{ action: "subtasks" }\` adds child tasks under a card.
|
|
186
|
+
- \`{ action: "done" }\` completes feature(s) and registers the files/architecture touched.
|
|
187
|
+
|
|
188
|
+
A NEW card REQUIRES \`category\` + \`priority\` (and \`layer\` where the workspace has a frontend). Use \`beacon_propose_plan\` / \`beacon_present_plan\` only when you want the user to REVIEW before the card lands.
|
|
189
|
+
|
|
190
|
+
REUSE before you create. Call \`beacon_map\` FIRST \u2014 it lists every card with its \`category\`, \`priority\`, \`layer\` and \`status\`, so you reuse an existing category (don't invent a near-synonym) and spot duplicates WITHOUT calling \`beacon_entities\`. Beacon HARD-BLOCKS a feature that duplicates an existing one (it returns the existing feature to use instead) and one created without a category. \`category\` is the ONLY domain field. \`front\` (in \`beacon_feature\`) nests a card UNDER an existing parent feature \u2014 it is NOT a domain tag; a \`front\` that matches no real feature is rejected.
|
|
180
191
|
|
|
181
192
|
When listing features, give each \`dependsOn: ["Other feature title", \u2026]\` for any feature that must ship after another in the same plan. Beacon draws these as "depends on" links so the roadmap shows the dependency chain instead of loose, disconnected cards.
|
|
182
193
|
|
|
183
|
-
A roadmap item that is a BUG to fix (not a feature to build) should carry \`kind: "BUG"\` \u2014 it renders as a typed bug card. This works everywhere roadmap cards are created: \`beacon_propose_plan\` features, the \`\`\`beacon block, \`
|
|
194
|
+
A roadmap item that is a BUG to fix (not a feature to build) should carry \`kind: "BUG"\` \u2014 it renders as a typed bug card. This works everywhere roadmap cards are created: \`beacon_propose_plan\` features, the \`\`\`beacon block, \`beacon_feature\` (add/start when the user is working on a bug; or \`subtasks\` items for a bug discovered mid-work), and \`beacon_init_persist\` roadmap items. Default is FEATURE.
|
|
184
195
|
|
|
185
196
|
### 2b. Presenting a plan in plan mode (ExitPlanMode)
|
|
186
197
|
|
|
@@ -198,27 +209,27 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
|
|
|
198
209
|
|
|
199
210
|
### 3. At the end, register the work \u2014 in ONE call
|
|
200
211
|
|
|
201
|
-
Call \`
|
|
212
|
+
Call \`beacon_feature({ action: "done" })\` **ONCE** with a \`features\` array \u2014 one entry per feature the plan created \u2014 each with the files you touched and a short markdown description. This flips each one to **Done** \u2014 including its sub-tasks (the cascade completes every PENDING/IN_PROGRESS child; a sub-task you did NOT finish must be set BLOCKED or CANCELLED before registering, so it survives visibly) \u2014 and keeps \`beacon_context_for_feature\` accurate for the next session.
|
|
202
213
|
|
|
203
214
|
Key each entry by its node \`id\`: the ids are handed back to you when the plan is approved (in the approval message / additionalContext), so you don't fuzzy-match titles or pay a disambiguation round-trip. If you don't have an id, \`title\` still works.
|
|
204
215
|
|
|
205
|
-
Register them all in that single batched call. If a plan added five features, that's ONE \`
|
|
216
|
+
Register them all in that single batched call. If a plan added five features, that's ONE \`beacon_feature({ action: "done" })\` call with five entries \u2014 NOT five calls, and NOT just an umbrella ("Harden auth"), which leaves the individual features stuck on **Pending**.
|
|
206
217
|
|
|
207
218
|
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.
|
|
208
219
|
|
|
209
220
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
210
|
-
${BQ}`});import{existsSync as
|
|
211
|
-
`)}function
|
|
221
|
+
${BQ}`});import{existsSync as cQ,mkdirSync as xQ,readFileSync as p,rmSync as yZ,writeFileSync as c}from"fs";import{dirname as nQ,join as m}from"path";function KQ(Q){try{return JSON.parse(p(Q,"utf8"))}catch{return{}}}function lQ(Q,Z){xQ(nQ(Q),{recursive:!0}),c(Q,JSON.stringify(Z,null,2)+`
|
|
222
|
+
`)}function l(Q,Z){let $=KQ(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}]}),lQ(Q,$),!0}function s(Q,Z){return(KQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function t(Q,Z){let $=KQ(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 lQ(Q,$),!0}function a(Q,Z,$,J){let Y=`${Z}
|
|
212
223
|
${J.trim()}
|
|
213
|
-
${$}`,V="";try{V=
|
|
224
|
+
${$}`,V="";try{V=p(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,Y):V.trim()?`${V.trim()}
|
|
214
225
|
|
|
215
226
|
${Y}
|
|
216
227
|
`:`${Y}
|
|
217
|
-
`,xQ(
|
|
228
|
+
`,xQ(nQ(Q),{recursive:!0}),c(Q,V.endsWith(`
|
|
218
229
|
`)?V:`${V}
|
|
219
|
-
`)}function
|
|
230
|
+
`)}function g(Q,Z){try{return p(Q,"utf8").includes(Z)}catch{return!1}}function d(Q,Z,$){let J="";try{J=p(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,`
|
|
220
231
|
|
|
221
|
-
`).trimStart();return
|
|
232
|
+
`).trimStart();return c(Q,V),!0}function r(Q,Z,$){let J=m(Q,Z);xQ(J,{recursive:!0});let Y=m(J,"SKILL.md");return c(Y,$),Y}function E(Q,Z){return cQ(m(Q,Z,"SKILL.md"))}function o(Q,Z){let $=m(Q,Z);if(!cQ($))return!1;return yZ($,{recursive:!0,force:!0}),!0}var v,n=`## Beacon (visual planning panel)
|
|
222
233
|
|
|
223
234
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
224
235
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -239,19 +250,19 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
239
250
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
240
251
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
241
252
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
242
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
253
|
+
verbatim. Do NOT implement until the tool returns approval.`;var CQ=u(()=>{v=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as AZ,renameSync as bZ,rmSync as LZ,writeFileSync as _Z}from"fs";import{dirname as kZ}from"path";function i(Q,Z){AZ(kZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{_Z($,Z),bZ($,Q)}catch(J){throw LZ($,{force:!0}),J}}function a0(Q,Z,$=!1){i(Q,JSON.stringify(Z,null,$?2:void 0))}var sQ=()=>{};var eQ={};jQ(eQ,{setupCodexAssets:()=>mZ,removeCodexMcp:()=>iQ,removeCodexArtifacts:()=>pZ,hasCodexMcp:()=>wQ,ensureCodexMcp:()=>oQ,codexMcpProblem:()=>FQ,codexDetected:()=>JQ,auditCodex:()=>TQ,CODEX_HOOKS:()=>C});import{readFileSync as $Q}from"fs";import{homedir as SZ}from"os";import{join as O}from"path";function tQ(){return process.env.HOME||process.env.USERPROFILE||SZ()}function JQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(fQ===void 0)fQ=Bun.which("codex")!==null;return fQ}function D(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function wQ(){try{return Boolean(D($Q(F(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function FQ(){let Q="";try{Q=$Q(F(),"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 oQ(){let Q="",Z=!1;try{Q=$Q(F(),"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(`
|
|
243
254
|
`)?`
|
|
244
255
|
`:`
|
|
245
256
|
|
|
246
|
-
`,J=Q+$+
|
|
247
|
-
`),$=Z.indexOf(
|
|
257
|
+
`,J=Q+$+hZ;if(D(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${I}`};return i(F(),J),{added:!0}}function iQ(){let Q="";try{Q=$Q(F(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
258
|
+
`),$=Z.indexOf(dQ);if($===-1)return{removed:!1,skipped:wQ()};let J=Z.indexOf(rQ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
|
|
248
259
|
`).replace(/\n{3,}/g,`
|
|
249
260
|
|
|
250
|
-
`).replace(/^\n+/,"");if(D(Y)===null)return{removed:!1,skipped:!0};return i(
|
|
261
|
+
`).replace(/^\n+/,"");if(D(Y)===null)return{removed:!1,skipped:!0};return i(F(),Y),{removed:!0}}async function mZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (h(),GQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let z of v){if(!E(QQ(),z))Y.push(z);r(QQ(),z,J[z])}let V=0;for(let z of C)if(l(uQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=g(e(),ZQ);a(e(),ZQ,aQ,n);let U=oQ();return{skillsAdded:Y,hooksAdded:V,agentsMdBlockTouched:!X,mcp:U}}function TQ(){let Q={};for(let $ of v)Q[$]=E(QQ(),$);let Z={};for(let $ of C)Z[$.event]=s(uQ(),{event:$.event,command:$.command});return{detected:JQ(),skills:Q,hooks:Z,agentsMdBlock:g(e(),ZQ),mcp:wQ()}}function pZ(){let Q=[];for(let Y of v)if(o(QQ(),Y))Q.push(Y);let Z=0;for(let Y of C)if(t(uQ(),{event:Y.event,command:Y.command}))Z++;let $=d(e(),ZQ,aQ),J=iQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var MQ=()=>O(tQ(),".codex"),uQ=()=>O(MQ(),"hooks.json"),F=()=>O(MQ(),"config.toml"),e=()=>O(MQ(),"AGENTS.md"),QQ=()=>O(tQ(),".agents","skills"),ZQ="<!-- beacon:global:start -->",aQ="<!-- beacon:global:end -->",C,fQ,dQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",rQ="# beacon:end",hZ,I="add it manually: codex mcp add beacon -- beacon mcp";var RQ=u(()=>{CQ();sQ();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."}];hZ=`${dQ}
|
|
251
262
|
[mcp_servers.beacon]
|
|
252
263
|
command = "beacon"
|
|
253
264
|
args = ["mcp"]
|
|
254
|
-
${
|
|
255
|
-
`});var
|
|
256
|
-
\x1B[1m${Q}\x1B[0m`;function
|
|
257
|
-
${
|
|
265
|
+
${rQ}
|
|
266
|
+
`});var VZ={};jQ(VZ,{provisionDb:()=>j0});import{createClient as Z0}from"@libsql/client";import{drizzle as $0}from"drizzle-orm/libsql";import{migrate as J0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as Y0}from"drizzle-orm/migrator";import{dirname as OQ,join as V0}from"path";import{fileURLToPath as z0}from"url";async function zQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function W0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function YZ(Q){if(!await zQ(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 H0(Q){for(let[Z,$]of Object.entries(U0)){if(!await zQ(Q,Z))continue;let J=await W0(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 j0(Q,Z=X0){let $=Z0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await zQ($,"__drizzle_migrations"),Y=await zQ($,"Node"),V=!1;if(Y&&!J){let U=Y0({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 YZ($);if(await J0($0($),{migrationsFolder:Z}),await YZ($)>X)V=!0;return await H0($),{migrated:V}}finally{$.close()}}var q0,X0,U0;var zZ=u(async()=>{q0=OQ(OQ(OQ(z0(import.meta.url)))),X0=process.env.BEACON_MIGRATIONS_DIR||V0(q0,"drizzle"),U0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});CQ();import{existsSync as cZ}from"fs";import{homedir as nZ}from"os";import{join as YQ}from"path";function lZ(){return process.env.HOME||process.env.USERPROFILE||nZ()}var VQ=()=>YQ(lZ(),".claude"),gQ=()=>YQ(VQ(),"skills"),EQ=()=>YQ(VQ(),"settings.json"),IQ=()=>YQ(VQ(),"CLAUDE.md"),DQ="<!-- beacon:global:start -->",QZ="<!-- beacon:global:end -->";var sZ=n,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 tZ(Q,Z){return r(gQ(),Q,Z)}function ZZ(Q){return E(gQ(),Q)}function aZ(Q){return o(gQ(),Q)}function dZ(Q){return l(EQ(),Q)}function rZ(Q){return s(EQ(),Q)}function oZ(Q){return t(EQ(),Q)}function iZ(Q){a(IQ(),DQ,QZ,Q)}function $Z(){return g(IQ(),DQ)}function eZ(){return d(IQ(),DQ,QZ)}function JZ(){let Q={};for(let $ of v)Q[$]=ZZ($);let Z={};for(let $ of T)Z[$.event]=rZ({event:$.event,command:$.command});return{homeExists:cZ(VQ()),skills:Q,hooks:Z,claudeMdBlock:$Z()}}async function Q0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (h(),GQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let U of v){if(!ZZ(U))Y.push(U);tZ(U,J[U])}let V=0;for(let U of T)if(dZ({event:U.event,matcher:U.matcher,command:U.command}))V++;let X=$Z();return iZ(sZ),{skillsAdded:Y,hooksAdded:V,claudeMdBlockTouched:!X}}async function V1(){let Q;try{Q={ok:!0,...await Q0()}}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(() => (RQ(),eQ));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 z1(){let Q=[];for(let J of v)if(aZ(J))Q.push(J);let Z=0;for(let J of T)if(oZ(J))Z++;let $=eZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as P0}from"async_hooks";import{spawnSync as v0}from"child_process";import{createHash as B0}from"crypto";import{existsSync as XZ,mkdirSync as y,readFileSync as AQ,writeFileSync as bQ}from"fs";import{homedir as UZ}from"os";import{basename as N0,join as K,parse as G0,resolve as qZ}from"path";function G(){return process.env.BEACON_HOME||K(UZ(),".beacon")}function LQ(){return K(G(),"workspaces.json")}function qQ(Q){return B0("sha256").update(Q).digest("hex").slice(0,12)}function C1(Q=process.cwd()){let Z=v0("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 WZ(Q){let Z=qZ(Q);return Z!==qZ(UZ())&&Z!==G0(Z).root}function HZ(){return K(G(),"deleted.json")}function _Q(){try{let Q=JSON.parse(AQ(HZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function jZ(Q){y(G(),{recursive:!0}),bQ(HZ(),JSON.stringify(Q,null,2))}function PZ(Q){return _Q().includes(Q)}function f1(Q){let Z=_Q();if(!Z.includes(Q))jZ([...Z,Q])}function x0(Q){let Z=_Q();if(Z.includes(Q))jZ(Z.filter(($)=>$!==Q))}function XQ(Q){return K(G(),Q)}function K0(Q){return`file:${K(XQ(Q),"db.sqlite")}`}function A(){try{let Q=JSON.parse(AQ(LQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function kQ(Q){y(G(),{recursive:!0}),bQ(LQ(),JSON.stringify(Q,null,2))}function UQ(){return A().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function f(Q){return A().find((Z)=>Z.id===Q)??null}function vZ(Q,Z,$=new Date().toISOString()){if(!WZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=qQ(Q);if(PZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=A(),V=Y.find((z)=>z.id===J),X={id:J,path:Q,name:Z||V?.name||N0(Q),lastOpenedAt:$},U=[X,...Y.filter((z)=>z.id!==J)];return y(XQ(J),{recursive:!0}),kQ(U),X}function M1(Q,Z){return x0(qQ(Q)),vZ(Q,Z)}function u1(Q,Z=new Date().toISOString()){let $=A(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,kQ($)}function w1(Q){if(kQ(A().filter((Z)=>Z.id!==Q)),SQ()===Q)C0(UQ()[0]?.id??null)}function BZ(){return K(G(),"active")}function SQ(){try{return AQ(BZ(),"utf8").trim()||null}catch{return null}}function C0(Q){y(G(),{recursive:!0}),bQ(BZ(),Q??"")}function F1(){let Q=SQ();return Q?f(Q):null}function T1(){let Q=u0()??SQ();return Q?f(Q):null}function R1(Q){return f(Q)?.path??null}function g1(){return XZ(LQ())}var NZ="beacon_ws";function GZ(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 E1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&f(Z))return Z;let $=GZ(Q,NZ);if($&&f($))return $;return f0()}function f0(){let Q=UQ();return Q.length===1?Q[0].id:null}var M0="x-beacon-workspace-path";async function I1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&f(Z))return Z;let $=Q.headers.get(M0);if($&&WZ($)&&!PZ(qQ($))&&(!Z||qQ($)===Z)){let Y=vZ($);return await w0(Y.id),Y.id}let J=GZ(Q,NZ);if(J&&f(J))return J;return null}var xZ=new P0;function D1(Q,Z){return Q?xZ.run(Q,Z):Z()}function u0(){return xZ.getStore()??null}var yQ=new Set;function O1(Q){yQ.delete(K(XQ(Q),"db.sqlite"))}async function w0(Q){let Z=XQ(Q),$=K(Z,"db.sqlite"),J=XZ($);if(J&&yQ.has($))return{ok:!0,created:!1,migrated:!1};try{y(Z,{recursive:!0});let{provisionDb:Y}=await zZ().then(() => VZ),V=await Y(K0(Q));return yQ.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)}}}h();RQ();import{execSync as F0,spawnSync as KZ}from"child_process";import{existsSync as T0,readFileSync as R0}from"fs";import{join as CZ}from"path";var W=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,H=(Q)=>`\x1B[31m\u2717\x1B[0m ${Q}`,M=(Q)=>`\x1B[2m${Q}\x1B[0m`,b=(Q)=>`
|
|
267
|
+
\x1B[1m${Q}\x1B[0m`;function g0(){try{return F0("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function E0(){let Q=CZ(G(),"server.json");try{let Z=JSON.parse(R0(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 I0(){let Q=KZ("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 D0(){return g0()||process.cwd()}var WQ=D0(),R=JZ(),fZ=UQ(),O0=fZ.some((Q)=>Q.path===WQ),j=O0||T0(CZ(WQ,".mcp.json"))?NQ(WQ):null;console.log(b("Beacon \xB7 doctor"));console.log(b("Runtime"));console.log(` ${I0()}`);console.log(` ${E0()}`);console.log(` ${W(`home: ${G()}`)}`);console.log(` ${W(`workspaces registered: ${fZ.length}`)}`);console.log(b("Global (~/.claude/)"));for(let Q of v)console.log(` ${R.skills[Q]?W(`skill ${Q}`):H(`skill ${Q} \u2014 missing`)}`);for(let Q of T)console.log(` ${R.hooks[Q.event]?W(`hook ${Q.event} \u2192 ${Q.command}`):H(`hook ${Q.event} \u2192 ${Q.command} \u2014 missing`)} ${M(Q.description)}`);console.log(` ${R.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 B=JQ()?TQ():null;if(!B)console.log(` ${M("codex not on PATH \u2014 Codex integration inactive (wires automatically once codex is installed)")}`);else{let Q=KZ("codex",["--version"],{stdio:["ignore","pipe","ignore"]});console.log(` ${Q.status===0?W(`codex ${Q.stdout.toString().trim()}`):M("codex version unavailable (BEACON_CODEX override?)")}`);for(let $ of v)console.log(` ${B.skills[$]?W(`skill ${$} (~/.agents/skills)`):H(`skill ${$} (~/.agents/skills) \u2014 missing`)}`);for(let $ of C)console.log(` ${B.hooks[$.event]?W(`hook ${$.event} \u2192 ${$.command}`):H(`hook ${$.event} \u2192 ${$.command} \u2014 missing`)} ${M($.description)}`);console.log(` ${B.agentsMdBlock?W("global ~/.codex/AGENTS.md block"):H("global ~/.codex/AGENTS.md block \u2014 missing")}`);let Z=FQ();console.log(` ${B.mcp?W("config.toml has [mcp_servers.beacon]"):H(`config.toml missing [mcp_servers.beacon]${Z?` \u2014 ${Z}`:""}`)}`)}console.log(b(`Current repo (${WQ})`));if(!j)console.log(` ${M("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")}`),B)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 y0=v.some((Q)=>!R.skills[Q])||T.some((Q)=>!R.hooks[Q.event])||!R.claudeMdBlock||(B?v.some((Q)=>!B.skills[Q])||C.some((Q)=>!B.hooks[Q.event])||!B.agentsMdBlock||!B.mcp:!1)||(j?!j.mcpRegistered||!j.agentsMdBlock||!j.claudeMdImport||!j.skills["beacon-init"]||!j.skills["beacon-refresh"]||(B?!j.codexSkills["beacon-init"]||!j.codexSkills["beacon-refresh"]:!1):!1);if(y0)console.log(`
|
|
268
|
+
${M("Fix everything marked \u2717 by running")} \x1B[1mbeacon\x1B[0m ${M("in this repo.")}`);console.log();
|