trybeacon 0.1.18 → 0.1.19
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 +11 -11
- 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 +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- 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 +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 +1 -1
- package/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- 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_client-reference-manifest.js +1 -1
- package/.next/server/app/feedback.html +1 -1
- package/.next/server/app/feedback.rsc +1 -1
- package/.next/server/app/feedback.segments/_full.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_index.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_tree.segment.rsc +1 -1
- 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_client-reference-manifest.js +1 -1
- package/.next/server/app/help.html +1 -1
- package/.next/server/app/help.rsc +1 -1
- package/.next/server/app/help.segments/_full.segment.rsc +1 -1
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +1 -1
- package/.next/server/app/help.segments/_tree.segment.rsc +1 -1
- 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/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- 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_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 +11 -11
- package/.next/server/chunks/7263.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/{9185-2dc95ca34d3ed35e.js → 9005-8ce19752fc3ddd2c.js} +1 -1
- package/.next/static/chunks/app/map/{page-8a50ebc7430720f9.js → page-2d506579d74725fe.js} +1 -1
- package/.next/static/chunks/app/plan/{page-8c84c74359ee2ea0.js → page-d6b31633d9630a26.js} +1 -1
- package/.next/trace +37 -37
- package/.next/trace-build +1 -1
- package/dist/bin/doctor.js +24 -24
- package/dist/bin/hook.js +24 -24
- package/dist/bin/mcp.js +30 -30
- package/dist/bin/plan.js +25 -25
- package/dist/bin/uninstall.js +26 -26
- package/dist/lib/codex-install.js +25 -25
- package/dist/lib/global-install.js +242 -0
- package/package.json +1 -1
- package/.next/server/chunks/7604.js +0 -1
- /package/.next/static/{zLC93esTvoKLzicL2UsF6 → zkOVrPg9gaBl1KxEF44lf}/_buildManifest.js +0 -0
- /package/.next/static/{zLC93esTvoKLzicL2UsF6 → zkOVrPg9gaBl1KxEF44lf}/_ssgManifest.js +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var uq=Object.defineProperty;var Xq=(q)=>q;function Gq(q,z){this[q]=Xq.bind(null,z)}var l=(q,z)=>{for(var J in z)uq(q,J,{get:z[J],enumerable:!0,configurable:!0,set:Gq.bind(z,J)})};var b=(q,z)=>()=>(q&&(z=q(q=0)),z);var d={};l(d,{removeRepoAssets:()=>fq,installRefreshSkill:()=>wq,installPlanSkill:()=>gq,installInitSkill:()=>bq,installCodexRepoSkills:()=>Cq,ensureWorkflowDoc:()=>Nq,ensureMcp:()=>Kq,auditRepo:()=>Mq,REFRESH_SKILL:()=>F,PLAN_SKILL:()=>t,INIT_SKILL:()=>E});import{existsSync as v,mkdirSync as g,readFileSync as W,rmSync as w,writeFileSync as B}from"fs";import{join as $}from"path";function bq(q){let z=$(q,".claude","skills","beacon-init");g(z,{recursive:!0});let J=$(z,"SKILL.md");return B(J,E),J}function wq(q){let z=$(q,".claude","skills","beacon-refresh");g(z,{recursive:!0});let J=$(z,"SKILL.md");return B(J,F),J}function gq(q){let z=$(q,".claude","skills","beacon-plan");g(z,{recursive:!0});let J=$(z,"SKILL.md");return B(J,t),J}function Cq(q){let z=[];for(let J of jq){let Q=$(q,".agents","skills",J.name);g(Q,{recursive:!0});let V=$(Q,"SKILL.md");B(V,J.body()),z.push(V)}return z}function Nq(q){let z=$(q,"AGENTS.md"),J="";try{J=W(z,"utf8")}catch{}let Q=new RegExp(`${j}[\\s\\S]*?${k}`);J=Q.test(J)?J.replace(Q,s):`${J.trim()}
|
|
3
3
|
|
|
4
|
-
${
|
|
5
|
-
`.trimStart(),
|
|
4
|
+
${s}
|
|
5
|
+
`.trimStart(),B(z,J.endsWith(`
|
|
6
6
|
`)?J:`${J}
|
|
7
|
-
`);let V=$(q,"CLAUDE.md"),Y="";try{Y=
|
|
7
|
+
`);let V=$(q,"CLAUDE.md"),Y="";try{Y=W(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))B(V,`${Y?`${Y.trim()}
|
|
8
8
|
|
|
9
9
|
`:""}@AGENTS.md
|
|
10
|
-
`)}function
|
|
11
|
-
`),{path:z,added:!0}}function
|
|
12
|
-
`)}}catch{}let V=!1,Y=$(q,"AGENTS.md");try{let Z=
|
|
10
|
+
`)}function Kq(q){let z=$(q,".mcp.json"),J={};try{J=JSON.parse(W(z,"utf8"))}catch{}if(J.mcpServers=J.mcpServers??{},J.mcpServers.beacon)return{path:z,added:!1};return J.mcpServers.beacon={command:"beacon",args:["mcp"]},B(z,JSON.stringify(J,null,2)+`
|
|
11
|
+
`),{path:z,added:!0}}function Mq(q){let z=$(q,".mcp.json"),J=!1;try{J=!!JSON.parse(W(z,"utf8")).mcpServers?.beacon}catch{}let Q=!1;try{Q=W($(q,"AGENTS.md"),"utf8").includes(j)}catch{}let V=!1;try{V=/@AGENTS\.md/.test(W($(q,"CLAUDE.md"),"utf8"))}catch{}return{repo:q,mcpRegistered:J,agentsMdBlock:Q,claudeMdImport:V,skills:{"beacon-init":v($(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v($(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v($(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v($(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function fq(q){let z=[];for(let Z of["beacon-init","beacon-refresh","beacon-db-design"]){let P=$(q,".claude","skills",Z);if(v(P))w(P,{recursive:!0,force:!0}),z.push(Z)}for(let Z of["beacon-init","beacon-refresh"]){let P=$(q,".agents","skills",Z);if(v(P))w(P,{recursive:!0,force:!0}),z.push(`codex:${Z}`)}let J=!1,Q=$(q,".mcp.json");try{let Z=JSON.parse(W(Q,"utf8"));if(Z.mcpServers?.beacon){if(delete Z.mcpServers.beacon,J=!0,Z.mcpServers&&Object.keys(Z.mcpServers).length===0)delete Z.mcpServers;if(Object.keys(Z).length===0)w(Q,{force:!0});else B(Q,JSON.stringify(Z,null,2)+`
|
|
12
|
+
`)}}catch{}let V=!1,Y=$(q,"AGENTS.md");try{let Z=W(Y,"utf8"),P=new RegExp(`\\n?${j}[\\s\\S]*?${k}\\n?`);if(P.test(Z)){let D=Z.replace(P,`
|
|
13
13
|
`).replace(/\n{3,}/g,`
|
|
14
14
|
|
|
15
|
-
`).trimStart();
|
|
16
|
-
`)?
|
|
17
|
-
`),V=!0}}catch{}let
|
|
15
|
+
`).trimStart();B(Y,D.endsWith(`
|
|
16
|
+
`)?D:`${D}
|
|
17
|
+
`),V=!0}}catch{}let U=!1,H=$(q,"CLAUDE.md");try{let Z=W(H,"utf8"),P=Z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==Z){if(!P.trim())w(H,{force:!0});else B(H,P);U=!0}}catch{}return{skillsRemoved:z,mcpUnregistered:J,agentsBlockRemoved:V,claudeImportRemoved:U}}var E=`---
|
|
18
18
|
name: beacon-init
|
|
19
19
|
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.
|
|
20
20
|
---
|
|
@@ -51,7 +51,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
51
51
|
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.
|
|
52
52
|
|
|
53
53
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
54
|
-
`,
|
|
54
|
+
`,F=`---
|
|
55
55
|
name: beacon-refresh
|
|
56
56
|
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.
|
|
57
57
|
---
|
|
@@ -98,7 +98,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
98
98
|
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.
|
|
99
99
|
|
|
100
100
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
101
|
-
`,
|
|
101
|
+
`,t=`---
|
|
102
102
|
name: beacon-plan
|
|
103
103
|
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.
|
|
104
104
|
---
|
|
@@ -140,7 +140,7 @@ If it returns feedback, revise and call it again.
|
|
|
140
140
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
141
141
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
142
142
|
run \`beacon\` in this repo once.
|
|
143
|
-
`,
|
|
143
|
+
`,jq,j="<!-- beacon:workflow:start -->",k="<!-- beacon:workflow:end -->",s;var c=b(()=>{jq=[{name:"beacon-init",body:()=>E},{name:"beacon-refresh",body:()=>F}];s=`${j}
|
|
144
144
|
## Beacon \u2014 feature workflow
|
|
145
145
|
|
|
146
146
|
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:
|
|
@@ -194,18 +194,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
194
194
|
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.
|
|
195
195
|
|
|
196
196
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
197
|
-
${
|
|
198
|
-
`)}function
|
|
197
|
+
${k}`});import{existsSync as n,mkdirSync as O,readFileSync as N,rmSync as Tq,writeFileSync as K}from"fs";import{dirname as r,join as C}from"path";function L(q){try{return JSON.parse(N(q,"utf8"))}catch{return{}}}function o(q,z){O(r(q),{recursive:!0}),K(q,JSON.stringify(z,null,2)+`
|
|
198
|
+
`)}function e(q,z){let J=L(q);J.hooks=J.hooks??{},J.hooks[z.event]=J.hooks[z.event]??[];let Q=J.hooks[z.event];if(Q.some((Y)=>Y.matcher===z.matcher&&Y.hooks?.some((U)=>U.command===z.command)))return!1;return Q.push({matcher:z.matcher,hooks:[{type:"command",command:z.command}]}),o(q,J),!0}function qq(q,z){return(L(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function zq(q,z){let J=L(q),Q=J.hooks?.[z.event];if(!Q)return!1;let V=!1,Y=Q.map((U)=>{let H=U.hooks?.length??0,Z=(U.hooks??[]).filter((P)=>P.command!==z.command);if(Z.length!==H)V=!0;return{...U,hooks:Z}}).filter((U)=>(U.hooks??[]).length>0);if(!V)return!1;if(Y.length)J.hooks[z.event]=Y;else delete J.hooks[z.event];if(J.hooks&&Object.keys(J.hooks).length===0)delete J.hooks;return o(q,J),!0}function Jq(q,z,J,Q){let V=`${z}
|
|
199
199
|
${Q.trim()}
|
|
200
|
-
${J}`,Y="";try{Y=
|
|
200
|
+
${J}`,Y="";try{Y=N(q,"utf8")}catch{}let U=new RegExp(`${z}[\\s\\S]*?${J}`);Y=U.test(Y)?Y.replace(U,V):Y.trim()?`${Y.trim()}
|
|
201
201
|
|
|
202
202
|
${V}
|
|
203
203
|
`:`${V}
|
|
204
|
-
`,r(
|
|
204
|
+
`,O(r(q),{recursive:!0}),K(q,Y.endsWith(`
|
|
205
205
|
`)?Y:`${Y}
|
|
206
|
-
`)}function
|
|
206
|
+
`)}function y(q,z){try{return N(q,"utf8").includes(z)}catch{return!1}}function Qq(q,z,J){let Q="";try{Q=N(q,"utf8")}catch{return!1}let V=new RegExp(`${z}[\\s\\S]*?${J}\\n?`);if(!V.test(Q))return!1;let Y=Q.replace(V,"").replace(/\n{3,}/g,`
|
|
207
207
|
|
|
208
|
-
`).trimStart();return
|
|
208
|
+
`).trimStart();return K(q,Y),!0}function Vq(q,z,J){let Q=C(q,z);O(Q,{recursive:!0});let V=C(Q,"SKILL.md");return K(V,J),V}function h(q,z){return n(C(q,z,"SKILL.md"))}function Yq(q,z){let J=C(q,z);if(!n(J))return!1;return Tq(J,{recursive:!0,force:!0}),!0}var M,i=`## Beacon (visual planning panel)
|
|
209
209
|
|
|
210
210
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
211
211
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -226,17 +226,17 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
226
226
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
227
227
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
228
228
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
229
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
229
|
+
verbatim. Do NOT implement until the tool returns approval.`;var Zq=b(()=>{M=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as Iq,renameSync as Rq,rmSync as Aq,writeFileSync as Dq}from"fs";import{dirname as Eq}from"path";function _(q,z){Iq(Eq(q),{recursive:!0});let J=`${q}.tmp`;try{Dq(J,z),Rq(J,q)}catch(Q){throw Aq(J,{force:!0}),Q}}var $q=()=>{};var _q={};l(_q,{setupCodexAssets:()=>Lq,removeCodexMcp:()=>xq,removeCodexArtifacts:()=>hq,hasCodexMcp:()=>a,ensureCodexMcp:()=>vq,codexMcpProblem:()=>Oq,codexDetected:()=>Bq,auditCodex:()=>yq,CODEX_HOOKS:()=>A});import{readFileSync as R}from"fs";import{homedir as Fq}from"os";import{join as G}from"path";function Uq(){return process.env.HOME||process.env.USERPROFILE||Fq()}function Bq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(m===void 0)m=Bun.which("codex")!==null;return m}function X(q){try{return Bun.TOML.parse(q)}catch{return null}}function a(){try{return Boolean(X(R(x(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function Oq(){let q="";try{q=R(x(),"utf8")}catch{return null}let z=X(q);if(!z)return`~/.codex/config.toml does not parse \u2014 ${u}`;if(z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${u}`;return null}function vq(){let q="",z=!1;try{q=R(x(),"utf8"),z=!0}catch{}if(z){let Y=X(q);if(!Y)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${u}`};if(Y.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 ${u}`}}let J=!q?"":q.endsWith(`
|
|
230
230
|
`)?`
|
|
231
231
|
`:`
|
|
232
232
|
|
|
233
|
-
`,Q=q+J+
|
|
234
|
-
`),J=z.indexOf(
|
|
233
|
+
`,Q=q+J+kq;if(X(Q)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${u}`};return _(x(),Q),{added:!0}}function xq(){let q="";try{q=R(x(),"utf8")}catch{return{removed:!1}}let z=q.split(`
|
|
234
|
+
`),J=z.indexOf(Wq);if(J===-1)return{removed:!1,skipped:a()};let Q=z.indexOf(Hq,J);if(Q===-1)return{removed:!1,skipped:!0};z.splice(J,Q-J+1);let V=z.join(`
|
|
235
235
|
`).replace(/\n{3,}/g,`
|
|
236
236
|
|
|
237
|
-
`).replace(/^\n+/,"");if(
|
|
237
|
+
`).replace(/^\n+/,"");if(X(V)===null)return{removed:!1,skipped:!0};return _(x(),V),{removed:!0}}async function Lq(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (c(),d)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let Z of M){if(!h(T(),Z))V.push(Z);Vq(T(),Z,Q[Z])}let Y=0;for(let Z of A)if(e(p(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let U=y(f(),I);Jq(f(),I,Pq,i);let H=vq();return{skillsAdded:V,hooksAdded:Y,agentsMdBlockTouched:!U,mcp:H}}function yq(){let q={};for(let J of M)q[J]=h(T(),J);let z={};for(let J of A)z[J.event]=qq(p(),{event:J.event,command:J.command});return{detected:Bq(),skills:q,hooks:z,agentsMdBlock:y(f(),I),mcp:a()}}function hq(){let q=[];for(let V of M)if(Yq(T(),V))q.push(V);let z=0;for(let V of A)if(zq(p(),{event:V.event,command:V.command}))z++;let J=Qq(f(),I,Pq),Q=xq();return{skillsRemoved:q,hooksRemoved:z,agentsMdBlockRemoved:J,mcpRemoved:Q.removed,mcpSkipped:Q.skipped}}var S=()=>G(Uq(),".codex"),p=()=>G(S(),"hooks.json"),x=()=>G(S(),"config.toml"),f=()=>G(S(),"AGENTS.md"),T=()=>G(Uq(),".agents","skills"),I="<!-- beacon:global:start -->",Pq="<!-- beacon:global:end -->",A,m,Wq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",Hq="# beacon:end",kq,u="add it manually: codex mcp add beacon -- beacon mcp";var mq=b(()=>{Zq();$q();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."}];kq=`${Wq}
|
|
238
238
|
[mcp_servers.beacon]
|
|
239
239
|
command = "beacon"
|
|
240
240
|
args = ["mcp"]
|
|
241
|
-
${
|
|
242
|
-
`});
|
|
241
|
+
${Hq}
|
|
242
|
+
`});mq();export{Lq as setupCodexAssets,xq as removeCodexMcp,hq as removeCodexArtifacts,a as hasCodexMcp,vq as ensureCodexMcp,Oq as codexMcpProblem,Bq as codexDetected,yq as auditCodex,A as CODEX_HOOKS};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var Fq=Object.defineProperty;var Tq=(q)=>q;function Rq(q,z){this[q]=Tq.bind(null,z)}var Pq=(q,z)=>{for(var J in z)Fq(q,J,{get:z[J],enumerable:!0,configurable:!0,set:Rq.bind(z,J)})};var b=(q,z)=>()=>(q&&(z=q(q=0)),z);var n={};Pq(n,{removeRepoAssets:()=>_q,installRefreshSkill:()=>Eq,installPlanSkill:()=>yq,installInitSkill:()=>Iq,installCodexRepoSkills:()=>Dq,ensureWorkflowDoc:()=>Oq,ensureMcp:()=>hq,auditRepo:()=>kq,REFRESH_SKILL:()=>c,PLAN_SKILL:()=>Uq,INIT_SKILL:()=>t});import{existsSync as H,mkdirSync as f,readFileSync as X,rmSync as G,writeFileSync as x}from"fs";import{join as $}from"path";function Iq(q){let z=$(q,".claude","skills","beacon-init");f(z,{recursive:!0});let J=$(z,"SKILL.md");return x(J,t),J}function Eq(q){let z=$(q,".claude","skills","beacon-refresh");f(z,{recursive:!0});let J=$(z,"SKILL.md");return x(J,c),J}function yq(q){let z=$(q,".claude","skills","beacon-plan");f(z,{recursive:!0});let J=$(z,"SKILL.md");return x(J,Uq),J}function Dq(q){let z=[];for(let J of Aq){let Q=$(q,".agents","skills",J.name);f(Q,{recursive:!0});let V=$(Q,"SKILL.md");x(V,J.body()),z.push(V)}return z}function Oq(q){let z=$(q,"AGENTS.md"),J="";try{J=X(z,"utf8")}catch{}let Q=new RegExp(`${C}[\\s\\S]*?${d}`);J=Q.test(J)?J.replace(Q,Wq):`${J.trim()}
|
|
3
|
+
|
|
4
|
+
${Wq}
|
|
5
|
+
`.trimStart(),x(z,J.endsWith(`
|
|
6
|
+
`)?J:`${J}
|
|
7
|
+
`);let V=$(q,"CLAUDE.md"),Y="";try{Y=X(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))x(V,`${Y?`${Y.trim()}
|
|
8
|
+
|
|
9
|
+
`:""}@AGENTS.md
|
|
10
|
+
`)}function hq(q){let z=$(q,".mcp.json"),J={};try{J=JSON.parse(X(z,"utf8"))}catch{}if(J.mcpServers=J.mcpServers??{},J.mcpServers.beacon)return{path:z,added:!1};return J.mcpServers.beacon={command:"beacon",args:["mcp"]},x(z,JSON.stringify(J,null,2)+`
|
|
11
|
+
`),{path:z,added:!0}}function kq(q){let z=$(q,".mcp.json"),J=!1;try{J=!!JSON.parse(X(z,"utf8")).mcpServers?.beacon}catch{}let Q=!1;try{Q=X($(q,"AGENTS.md"),"utf8").includes(C)}catch{}let V=!1;try{V=/@AGENTS\.md/.test(X($(q,"CLAUDE.md"),"utf8"))}catch{}return{repo:q,mcpRegistered:J,agentsMdBlock:Q,claudeMdImport:V,skills:{"beacon-init":H($(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":H($(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":H($(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":H($(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function _q(q){let z=[];for(let Z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=$(q,".claude","skills",Z);if(H(U))G(U,{recursive:!0,force:!0}),z.push(Z)}for(let Z of["beacon-init","beacon-refresh"]){let U=$(q,".agents","skills",Z);if(H(U))G(U,{recursive:!0,force:!0}),z.push(`codex:${Z}`)}let J=!1,Q=$(q,".mcp.json");try{let Z=JSON.parse(X(Q,"utf8"));if(Z.mcpServers?.beacon){if(delete Z.mcpServers.beacon,J=!0,Z.mcpServers&&Object.keys(Z.mcpServers).length===0)delete Z.mcpServers;if(Object.keys(Z).length===0)G(Q,{force:!0});else x(Q,JSON.stringify(Z,null,2)+`
|
|
12
|
+
`)}}catch{}let V=!1,Y=$(q,"AGENTS.md");try{let Z=X(Y,"utf8"),U=new RegExp(`\\n?${C}[\\s\\S]*?${d}\\n?`);if(U.test(Z)){let a=Z.replace(U,`
|
|
13
|
+
`).replace(/\n{3,}/g,`
|
|
14
|
+
|
|
15
|
+
`).trimStart();x(Y,a.endsWith(`
|
|
16
|
+
`)?a:`${a}
|
|
17
|
+
`),V=!0}}catch{}let P=!1,W=$(q,"CLAUDE.md");try{let Z=X(W,"utf8"),U=Z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==Z){if(!U.trim())G(W,{force:!0});else x(W,U);P=!0}}catch{}return{skillsRemoved:z,mcpUnregistered:J,agentsBlockRemoved:V,claudeImportRemoved:P}}var t=`---
|
|
18
|
+
name: beacon-init
|
|
19
|
+
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.
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Map this repo into Beacon (/beacon-init)
|
|
23
|
+
|
|
24
|
+
The user already has Beacon running. You're going to map this repository's architecture into it \u2014 what used to be \`beacon init\`. **You** do the analysis (your session already has the codebase context); Beacon just persists what you send.
|
|
25
|
+
|
|
26
|
+
## What you produce
|
|
27
|
+
|
|
28
|
+
A single \`beacon_init_persist\` MCP tool call with:
|
|
29
|
+
|
|
30
|
+
- **components**: 8\u201325 main building blocks of this codebase. NOT every file. Group them by \`domain\` (short UPPERCASE: AUTH, API, DATA, UI, JOBS, INFRA, BILLING, SEARCH, \u2026). For each: a one-line technical \`role\`, a one-sentence plain-language \`plain\`, the few \`files\` that implement it (repo-relative), and \`depends\` listing other component titles it relies on. Use the dependency graph you can see in the source \u2014 files that import each other heavily usually belong together. If you spot a bug or something worth investigating while reading a component's code, add \`bugs: [{ note }]\` to that component \u2014 it renders as a bug flag on the node (attributed to the agent). Only flag what you actually saw in the code; don't speculate.
|
|
31
|
+
- **roadmap**: 3\u20136 BROAD strategic directions. Big-picture themes only \u2014 "Harden auth & security", "Add observability", "Scale the data layer", "Pay down test-coverage debt". NOT detailed tasks. NOT file-level. Each gets a short title and one-line \`why\`.
|
|
32
|
+
- **overview**: one paragraph describing what this project is and its stack. This lands in AGENTS.md as the project intro.
|
|
33
|
+
- **conventions**: 3\u20138 concrete rules a contributor MUST follow \u2014 build/test commands, where code goes, patterns, things easy to get wrong. Infer from actual files, not assumptions.
|
|
34
|
+
- **snapshot** (optional but encouraged): \`{ tables, relations, endpoints }\` for the existing database. If the project uses Prisma, read \`prisma/schema.prisma\`. If SQLAlchemy, read the model files. If Django, read \`models.py\`. If you find no obvious schema source, skip the snapshot \u2014 don't fabricate.
|
|
35
|
+
|
|
36
|
+
## How to do it
|
|
37
|
+
|
|
38
|
+
1. **Survey**. Use \`LS\` / \`Glob\` to see the top-level structure. Read \`README.md\` and the manifest (\`package.json\` / \`pyproject.toml\` / \`go.mod\` / \`Cargo.toml\` / \`pom.xml\`).
|
|
39
|
+
2. **Sample the source.** Read 15\u201330 representative files \u2014 one per cluster you can identify. Don't read everything; pick by name (route files, model files, main entrypoints, key services). The goal is to identify boundaries, not memorize every line.
|
|
40
|
+
3. **Identify the schema** if any. \`prisma/schema.prisma\` \u2192 translate each model into a \`tables\` entry. \`alembic\`/SQLAlchemy \u2192 read the latest models. Django \u2192 read \`models.py\`. Skip the snapshot if the source-of-truth isn't obvious.
|
|
41
|
+
4. **Identify endpoints** if any. Look for routes \u2014 Next.js \`app/api/*\` files, FastAPI \`@router.*\` / \`@app.*\`, Express \`app.get\`/etc. For each endpoint try to fill \`uses: [{ table, access }]\` so the canvas can draw which endpoint touches which table.
|
|
42
|
+
5. **Call \`beacon_init_persist\`** ONCE with the whole analysis. It replaces any prior init-derived map (idempotent) and regenerates \`AGENTS.md\`.
|
|
43
|
+
|
|
44
|
+
## What you should NOT do
|
|
45
|
+
|
|
46
|
+
- Don't propose detailed tasks in \`roadmap\` \u2014 that's what \`beacon_propose_plan\` is for. Init roadmap is strategic only.
|
|
47
|
+
- Don't list every file as a \`component\`. Aim for ~15. If you have 40, you're listing files, not components.
|
|
48
|
+
- Don't fabricate tables/endpoints. If you can't find the schema source, omit \`snapshot\`.
|
|
49
|
+
- Don't ask the user to confirm before persisting. The user invoked /beacon-init \u2014 that's the confirmation.
|
|
50
|
+
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
54
|
+
`,c=`---
|
|
55
|
+
name: beacon-refresh
|
|
56
|
+
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.
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# Refresh Beacon's map (/beacon-refresh)
|
|
60
|
+
|
|
61
|
+
Beacon was already initialized in this repo (\`/beacon-init\` ran at some point). The codebase has moved since then \u2014 new modules, removed ones, schema changes, new routes. Your job is to re-survey the current code, show the user what changed, then persist the refreshed map.
|
|
62
|
+
|
|
63
|
+
## How it differs from /beacon-init
|
|
64
|
+
|
|
65
|
+
- **Init is a cold start** \u2014 no prior map, you survey everything fresh.
|
|
66
|
+
- **Refresh is incremental** \u2014 the map already exists. Read what's there first, then diff against the source so you can tell the user what actually changed. The user gets to see "+ 3 new components, \u2212 1 removed, ~ 2 changed roles" instead of an opaque re-run.
|
|
67
|
+
|
|
68
|
+
## What gets preserved vs replaced
|
|
69
|
+
|
|
70
|
+
The \`beacon_init_persist\` tool **replaces only init-derived nodes** (\`source=INIT\`). Anything the user added manually on the canvas \u2014 manually-created components, hand-edited tables, custom positions, notes, draft feature plans \u2014 survives the refresh untouched. So you can re-run this freely; nothing the user curated by hand is at risk.
|
|
71
|
+
|
|
72
|
+
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. If the user mentions hand-curated INIT nodes, ask whether they want those carried into the new analysis verbatim.
|
|
73
|
+
|
|
74
|
+
## How to do it
|
|
75
|
+
|
|
76
|
+
1. **Read the current map.** Call \`beacon_entities\` with \`{ kind: "architecture" }\`, \`{ kind: "roadmap" }\`, \`{ kind: "tables" }\`, \`{ kind: "endpoints" }\`. This is what Beacon has now.
|
|
77
|
+
2. **Survey the source like init.** Same approach as \`/beacon-init\`: \`LS\` / \`Glob\` for top-level structure, read \`README.md\` and the manifest, sample 15\u201330 representative files. Focus on areas likely to have changed \u2014 diff your memory against what \`beacon_entities\` returned.
|
|
78
|
+
3. **Build the diff in your head.** For each entity kind:
|
|
79
|
+
- **components**: which titles in the current map no longer match any cluster you'd produce? Which clusters you'd produce don't appear in the current map?
|
|
80
|
+
- **tables**: any added / removed since? Any model files you can see that aren't in the snapshot?
|
|
81
|
+
- **endpoints**: walk the route directories \u2014 any new routes, any deleted ones?
|
|
82
|
+
- **roadmap**: usually stable, but a strategic theme can finish or new ones can emerge.
|
|
83
|
+
4. **Surface the diff to the user, briefly, BEFORE persisting.** Something like:
|
|
84
|
+
- **+ added**: NEW_COMPONENT_1, NEW_COMPONENT_2 (with one-line reason each)
|
|
85
|
+
- **\u2212 removed**: STALE_COMPONENT (file no longer exists)
|
|
86
|
+
- **~ changed**: COMPONENT_X (role expanded to cover Y)
|
|
87
|
+
- **schema**: + 2 new tables (TableA, TableB); + 3 new endpoints; \u2212 1 deprecated endpoint
|
|
88
|
+
No need to wait for confirmation \u2014 just show the diff so the user sees what's about to land.
|
|
89
|
+
5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`). It replaces all init-source nodes and regenerates \`AGENTS.md\`. Bug flags already on a component survive the refresh (they're carried over by title); add \`bugs: [{ note }]\` for anything NEW you found worth investigating \u2014 identical open flags are not duplicated.
|
|
90
|
+
|
|
91
|
+
## What you should NOT do
|
|
92
|
+
|
|
93
|
+
- Don't ask "should I refresh?" \u2014 the user invoked /beacon-refresh, that's the answer.
|
|
94
|
+
- Don't preserve stale components for sentimental reasons. If the underlying files are gone or merged into another component, drop it from the new \`components\` list.
|
|
95
|
+
- Don't pad with file-level granularity. Refresh maintains the same ~15-component altitude as init.
|
|
96
|
+
- Don't fabricate changes. If the codebase hasn't materially moved since the last init, say so and persist the current state anyway (re-runs are cheap; it's fine).
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
101
|
+
`,Uq=`---
|
|
102
|
+
name: beacon-plan
|
|
103
|
+
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.
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
# Present a plan on Beacon (/beacon-plan)
|
|
107
|
+
|
|
108
|
+
Beacon reviews plans on a canvas at /plan \u2014 never as a wall of text in the terminal. So do NOT
|
|
109
|
+
end a turn with "here's my plan\u2026 should I proceed?" in prose. Present it through Beacon and let the
|
|
110
|
+
tool BLOCK until the user decides.
|
|
111
|
+
|
|
112
|
+
## How to present
|
|
113
|
+
|
|
114
|
+
Call the **\`beacon_present_plan\`** MCP tool with your plan as markdown:
|
|
115
|
+
|
|
116
|
+
- \`description\`: a one-line summary shown in the review header.
|
|
117
|
+
- \`markdown\`: the full plan as markdown (headings, lists, code).
|
|
118
|
+
- If the plan proposes DB tables / relations / endpoints or roadmap features, embed ONE fenced
|
|
119
|
+
\`\`\`beacon JSON block in the markdown \u2014 the same shapes \`beacon_propose_plan\` accepts:
|
|
120
|
+
|
|
121
|
+
\`\`\`beacon
|
|
122
|
+
{ "tables": [...], "relations": [...], "endpoints": [...], "features": [...] }
|
|
123
|
+
\`\`\`
|
|
124
|
+
|
|
125
|
+
Beacon extracts that block deterministically, strips it from the prose, and renders an editable
|
|
126
|
+
board on /plan. The board is built ONLY from the block \u2014 prose is never parsed \u2014 so mirror EVERY
|
|
127
|
+
table/endpoint/feature you mention in the prose into the block, or that board will be empty.
|
|
128
|
+
|
|
129
|
+
\`beacon_present_plan\` opens /plan and BLOCKS until the user clicks Approve / Discard / submits
|
|
130
|
+
feedback, then returns their verdict. Implement code or migrations ONLY after it returns approval.
|
|
131
|
+
If it returns feedback, revise and call it again.
|
|
132
|
+
|
|
133
|
+
## Which tool
|
|
134
|
+
|
|
135
|
+
- **Pure schema/feature plan** (tables + endpoints + roadmap features, little prose) \u2192 you may use
|
|
136
|
+
\`beacon_propose_plan\` with the structured fields instead; it's the same review loop.
|
|
137
|
+
- **Anything else** (a code-change plan, a mixed plan, a "how should I approach X") \u2192 use
|
|
138
|
+
\`beacon_present_plan\` with markdown so the full reasoning shows on /plan.
|
|
139
|
+
|
|
140
|
+
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
141
|
+
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
142
|
+
run \`beacon\` in this repo once.
|
|
143
|
+
`,Aq,C="<!-- beacon:workflow:start -->",d="<!-- beacon:workflow:end -->",Wq;var r=b(()=>{Aq=[{name:"beacon-init",body:()=>t},{name:"beacon-refresh",body:()=>c}];Wq=`${C}
|
|
144
|
+
## Beacon \u2014 feature workflow
|
|
145
|
+
|
|
146
|
+
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:
|
|
147
|
+
|
|
148
|
+
### 1. Load context FIRST \u2014 do NOT Glob/Grep the codebase blind
|
|
149
|
+
|
|
150
|
+
Call \`beacon_context_for_feature({ id | title | query })\` BEFORE reading files. It returns, in one round-trip:
|
|
151
|
+
- the files the feature is attached to,
|
|
152
|
+
- what those files import + what imports them (live code-graph blast radius),
|
|
153
|
+
- endpoints in the feature's domain + the tables each touches + those tables' FK relations,
|
|
154
|
+
- sibling architecture components and the project's conventions.
|
|
155
|
+
|
|
156
|
+
That bundle replaces the discovery phase. Read only the files it returns plus whatever those imports lead you to. If the feature has no files attached yet, the bundle still gives you the domain map \u2014 Glob is a last resort.
|
|
157
|
+
|
|
158
|
+
Mid-feature, when deciding whether a change is safe, call \`beacon_blast_radius({ path })\` for the file you're about to edit \u2014 same code-graph data, file-centric.
|
|
159
|
+
|
|
160
|
+
### 2. Design the data BEFORE writing code
|
|
161
|
+
|
|
162
|
+
Determine the database tables the feature needs. If any don't exist yet, design the schema and call \`beacon_propose_plan\` (tables + relations + endpoints). This renders an **editable draft on the /plan page** for the user to review. The tool BLOCKS until the user clicks Approve / Discard / submits feedback. Implement migrations + code ONLY after it returns approval.
|
|
163
|
+
|
|
164
|
+
When listing endpoints, give each \`uses: [{ table, access }]\` so the endpoint\u2192table links draw on /db.
|
|
165
|
+
|
|
166
|
+
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.
|
|
167
|
+
|
|
168
|
+
REUSE before you create. Call \`beacon_map\` to see the features + categories that already exist. Beacon HARD-BLOCKS a feature that duplicates an existing one (it returns the existing feature to use instead) and one created without a category \u2014 so don't re-create work that's already on the board, and reuse an existing category rather than a near-synonym. \`category\` is the ONLY domain field. \`front\` (in \`beacon_start_feature\`) nests a feature UNDER an existing parent feature \u2014 it is NOT a domain tag; a \`front\` that matches no real feature is rejected.
|
|
169
|
+
|
|
170
|
+
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.
|
|
171
|
+
|
|
172
|
+
### 2b. Presenting a plan in plan mode (ExitPlanMode)
|
|
173
|
+
|
|
174
|
+
In Codex (which has no ExitPlanMode), always present plans via \`beacon_present_plan\` / \`beacon_propose_plan\` instead \u2014 this section applies to Claude Code's plan mode only.
|
|
175
|
+
|
|
176
|
+
When you present a plan via ExitPlanMode (not \`beacon_propose_plan\`) and it proposes DB tables/relations/endpoints or roadmap features, embed ONE fenced \`\`\`beacon code block of JSON in the plan \u2014 the same shapes \`beacon_propose_plan\` accepts:
|
|
177
|
+
|
|
178
|
+
\`\`\`beacon
|
|
179
|
+
{ "tables": [...], "relations": [...], "endpoints": [...], "features": [...] }
|
|
180
|
+
\`\`\`
|
|
181
|
+
|
|
182
|
+
Beacon extracts it deterministically and **strips the block from the prose** (it's never shown in the annotation panel), then renders the tables + features as an **editable board** on /plan so the user can edit them and have those edits flow back as feedback. Omit the block for pure code-change plans.
|
|
183
|
+
|
|
184
|
+
**The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
|
|
185
|
+
|
|
186
|
+
### 3. At the end, register the work \u2014 in ONE call
|
|
187
|
+
|
|
188
|
+
Call \`beacon_describe_feature\` **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.
|
|
189
|
+
|
|
190
|
+
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.
|
|
191
|
+
|
|
192
|
+
Register them all in that single batched call. If a plan added five features, that's ONE \`beacon_describe_feature\` call with five entries \u2014 NOT five calls, and NOT just an umbrella ("Harden auth"), which leaves the individual features stuck on **Pending**.
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
197
|
+
${d}`});import{existsSync as xq,mkdirSync as s,readFileSync as M,rmSync as Lq,writeFileSync as F}from"fs";import{dirname as Xq,join as K}from"path";function l(q){try{return JSON.parse(M(q,"utf8"))}catch{return{}}}function wq(q,z){s(Xq(q),{recursive:!0}),F(q,JSON.stringify(z,null,2)+`
|
|
198
|
+
`)}function R(q,z){let J=l(q);J.hooks=J.hooks??{},J.hooks[z.event]=J.hooks[z.event]??[];let Q=J.hooks[z.event];if(Q.some((Y)=>Y.matcher===z.matcher&&Y.hooks?.some((P)=>P.command===z.command)))return!1;return Q.push({matcher:z.matcher,hooks:[{type:"command",command:z.command}]}),wq(q,J),!0}function I(q,z){return(l(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function E(q,z){let J=l(q),Q=J.hooks?.[z.event];if(!Q)return!1;let V=!1,Y=Q.map((P)=>{let W=P.hooks?.length??0,Z=(P.hooks??[]).filter((U)=>U.command!==z.command);if(Z.length!==W)V=!0;return{...P,hooks:Z}}).filter((P)=>(P.hooks??[]).length>0);if(!V)return!1;if(Y.length)J.hooks[z.event]=Y;else delete J.hooks[z.event];if(J.hooks&&Object.keys(J.hooks).length===0)delete J.hooks;return wq(q,J),!0}function y(q,z,J,Q){let V=`${z}
|
|
199
|
+
${Q.trim()}
|
|
200
|
+
${J}`,Y="";try{Y=M(q,"utf8")}catch{}let P=new RegExp(`${z}[\\s\\S]*?${J}`);Y=P.test(Y)?Y.replace(P,V):Y.trim()?`${Y.trim()}
|
|
201
|
+
|
|
202
|
+
${V}
|
|
203
|
+
`:`${V}
|
|
204
|
+
`,s(Xq(q),{recursive:!0}),F(q,Y.endsWith(`
|
|
205
|
+
`)?Y:`${Y}
|
|
206
|
+
`)}function v(q,z){try{return M(q,"utf8").includes(z)}catch{return!1}}function A(q,z,J){let Q="";try{Q=M(q,"utf8")}catch{return!1}let V=new RegExp(`${z}[\\s\\S]*?${J}\\n?`);if(!V.test(Q))return!1;let Y=Q.replace(V,"").replace(/\n{3,}/g,`
|
|
207
|
+
|
|
208
|
+
`).trimStart();return F(q,Y),!0}function D(q,z,J){let Q=K(q,z);s(Q,{recursive:!0});let V=K(Q,"SKILL.md");return F(V,J),V}function j(q,z){return xq(K(q,z,"SKILL.md"))}function O(q,z){let J=K(q,z);if(!xq(J))return!1;return Lq(J,{recursive:!0,force:!0}),!0}var w,T=`## Beacon (visual planning panel)
|
|
209
|
+
|
|
210
|
+
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
211
|
+
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
212
|
+
the user reviews on a canvas at /plan, and feedback flows back as the next round.
|
|
213
|
+
|
|
214
|
+
**When to invoke**
|
|
215
|
+
- User asks to "plan a feature" / "design a schema" \u2192 if the \`beacon_propose_plan\`
|
|
216
|
+
MCP tool is available, design the plan and call it. If it is NOT available, the panel
|
|
217
|
+
isn't wired in this repo \u2014 run \`beacon\` here once, then retry.
|
|
218
|
+
- User asks to "set up Beacon" / "map this repo" \u2192 invoke the \`beacon-init\` skill.
|
|
219
|
+
- User asks to "refresh Beacon" / "update the map" / "bring Beacon up to date" \u2192 invoke
|
|
220
|
+
the \`beacon-refresh\` skill. Re-surveys the repo and updates init-derived nodes while
|
|
221
|
+
preserving anything the user added by hand.
|
|
222
|
+
- Run \`beacon doctor\` to audit what's wired (global hooks, repo's .mcp.json, AGENTS.md block).
|
|
223
|
+
|
|
224
|
+
**The plan feedback loop**
|
|
225
|
+
\`beacon_propose_plan\` BLOCKS until the user clicks Approve / Discard / submits feedback.
|
|
226
|
+
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
227
|
+
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
228
|
+
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
229
|
+
verbatim. Do NOT implement until the tool returns approval.`;var i=b(()=>{w=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as mq,renameSync as pq,rmSync as Sq,writeFileSync as aq}from"fs";import{dirname as tq}from"path";function o(q,z){mq(tq(q),{recursive:!0});let J=`${q}.tmp`;try{aq(J,z),pq(J,q)}catch(Q){throw Sq(J,{force:!0}),Q}}var Hq=()=>{};var Gq={};Pq(Gq,{setupCodexAssets:()=>rq,removeCodexMcp:()=>bq,removeCodexArtifacts:()=>lq,hasCodexMcp:()=>Jq,ensureCodexMcp:()=>Nq,codexMcpProblem:()=>nq,codexDetected:()=>jq,auditCodex:()=>sq,CODEX_HOOKS:()=>m});import{readFileSync as L}from"fs";import{homedir as cq}from"os";import{join as N}from"path";function gq(){return process.env.HOME||process.env.USERPROFILE||cq()}function jq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(e===void 0)e=Bun.which("codex")!==null;return e}function u(q){try{return Bun.TOML.parse(q)}catch{return null}}function Jq(){try{return Boolean(u(L(g(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function nq(){let q="";try{q=L(g(),"utf8")}catch{return null}let z=u(q);if(!z)return`~/.codex/config.toml does not parse \u2014 ${B}`;if(z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${B}`;return null}function Nq(){let q="",z=!1;try{q=L(g(),"utf8"),z=!0}catch{}if(z){let Y=u(q);if(!Y)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${B}`};if(Y.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 ${B}`}}let J=!q?"":q.endsWith(`
|
|
230
|
+
`)?`
|
|
231
|
+
`:`
|
|
232
|
+
|
|
233
|
+
`,Q=q+J+dq;if(u(Q)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${B}`};return o(g(),Q),{added:!0}}function bq(){let q="";try{q=L(g(),"utf8")}catch{return{removed:!1}}let z=q.split(`
|
|
234
|
+
`),J=z.indexOf(Bq);if(J===-1)return{removed:!1,skipped:Jq()};let Q=z.indexOf(uq,J);if(Q===-1)return{removed:!1,skipped:!0};z.splice(J,Q-J+1);let V=z.join(`
|
|
235
|
+
`).replace(/\n{3,}/g,`
|
|
236
|
+
|
|
237
|
+
`).replace(/^\n+/,"");if(u(V)===null)return{removed:!1,skipped:!0};return o(g(),V),{removed:!0}}async function rq(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (r(),n)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let Z of w){if(!j(k(),Z))V.push(Z);D(k(),Z,Q[Z])}let Y=0;for(let Z of m)if(R(zq(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let P=v(h(),_);y(h(),_,vq,T);let W=Nq();return{skillsAdded:V,hooksAdded:Y,agentsMdBlockTouched:!P,mcp:W}}function sq(){let q={};for(let J of w)q[J]=j(k(),J);let z={};for(let J of m)z[J.event]=I(zq(),{event:J.event,command:J.command});return{detected:jq(),skills:q,hooks:z,agentsMdBlock:v(h(),_),mcp:Jq()}}function lq(){let q=[];for(let V of w)if(O(k(),V))q.push(V);let z=0;for(let V of m)if(E(zq(),{event:V.event,command:V.command}))z++;let J=A(h(),_,vq),Q=bq();return{skillsRemoved:q,hooksRemoved:z,agentsMdBlockRemoved:J,mcpRemoved:Q.removed,mcpSkipped:Q.skipped}}var qq=()=>N(gq(),".codex"),zq=()=>N(qq(),"hooks.json"),g=()=>N(qq(),"config.toml"),h=()=>N(qq(),"AGENTS.md"),k=()=>N(gq(),".agents","skills"),_="<!-- beacon:global:start -->",vq="<!-- beacon:global:end -->",m,e,Bq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",uq="# beacon:end",dq,B="add it manually: codex mcp add beacon -- beacon mcp";var fq=b(()=>{i();Hq();m=[{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."}];dq=`${Bq}
|
|
238
|
+
[mcp_servers.beacon]
|
|
239
|
+
command = "beacon"
|
|
240
|
+
args = ["mcp"]
|
|
241
|
+
${uq}
|
|
242
|
+
`});i();import{existsSync as iq}from"fs";import{homedir as oq}from"os";import{join as p}from"path";function eq(){return process.env.HOME||process.env.USERPROFILE||oq()}var S=()=>p(eq(),".claude"),Qq=()=>p(S(),"skills"),Vq=()=>p(S(),"settings.json"),Yq=()=>p(S(),"CLAUDE.md"),Zq="<!-- beacon:global:start -->",Cq="<!-- beacon:global:end -->";var qz=T,$q=[{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 zz(q,z){return D(Qq(),q,z)}function Kq(q){return j(Qq(),q)}function Jz(q){return O(Qq(),q)}function Qz(q){return R(Vq(),q)}function Vz(q){return I(Vq(),q)}function Yz(q){return E(Vq(),q)}function Zz(q){y(Yq(),Zq,Cq,q)}function Mq(){return v(Yq(),Zq)}function $z(){return A(Yq(),Zq,Cq)}function Fz(){let q={};for(let J of w)q[J]=Kq(J);let z={};for(let J of $q)z[J.event]=Vz({event:J.event,command:J.command});return{homeExists:iq(S()),skills:q,hooks:z,claudeMdBlock:Mq()}}async function Pz(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (r(),n)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let W of w){if(!Kq(W))V.push(W);zz(W,Q[W])}let Y=0;for(let W of $q)if(Qz({event:W.event,matcher:W.matcher,command:W.command}))Y++;let P=Mq();return Zz(qz),{skillsAdded:V,hooksAdded:Y,claudeMdBlockTouched:!P}}async function Tz(){let q;try{q={ok:!0,...await Pz()}}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(),Gq));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 Rz(){let q=[];for(let Q of w)if(Jz(Q))q.push(Q);let z=0;for(let Q of $q)if(Yz(Q))z++;let J=$z();return{skillsRemoved:q,hooksRemoved:z,claudeMdBlockRemoved:J}}export{Pz as setupGlobalAssets,Tz as selfHealGlobal,Jz as removeGlobalSkill,Yz as removeGlobalHook,$z as removeGlobalClaudeMdBlock,Rz as removeBeaconArtifacts,Kq as isGlobalSkillInstalled,zz as installGlobalSkill,Vz as hasGlobalHook,Mq as hasGlobalClaudeMdBlock,Qz as ensureGlobalHook,Zz as ensureGlobalClaudeMdBlock,Fz as auditGlobal,w as GLOBAL_SKILLS,$q as GLOBAL_HOOKS,qz as GLOBAL_CLAUDE_MD_BLOCK};
|