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.
Files changed (114) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +13 -13
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/.next/server/app/api/context/feature/route.js +1 -1
  24. package/.next/server/app/api/db/arrange/route.js +1 -1
  25. package/.next/server/app/api/entities/route.js +1 -1
  26. package/.next/server/app/api/map/start/route.js +1 -1
  27. package/.next/server/app/docs/page.js +1 -1
  28. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  29. package/.next/server/app/docs.html +1 -1
  30. package/.next/server/app/docs.rsc +3 -3
  31. package/.next/server/app/docs.segments/_full.segment.rsc +3 -3
  32. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  33. package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
  34. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  35. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +2 -2
  36. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  37. package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/feedback.html +1 -1
  39. package/.next/server/app/feedback.rsc +2 -2
  40. package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
  41. package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
  42. package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
  43. package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
  44. package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
  45. package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
  46. package/.next/server/app/help/page.js +1 -1
  47. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/help.html +1 -1
  49. package/.next/server/app/help.rsc +4 -4
  50. package/.next/server/app/help.segments/_full.segment.rsc +4 -4
  51. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  52. package/.next/server/app/help.segments/_index.segment.rsc +2 -2
  53. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  54. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +10 -12
  55. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  56. package/.next/server/app/index.html +1 -1
  57. package/.next/server/app/index.rsc +3 -3
  58. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  59. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  60. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  61. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  62. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  63. package/.next/server/app/map/page.js +2 -2
  64. package/.next/server/app/map/page.js.nft.json +1 -1
  65. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/page.js +1 -1
  67. package/.next/server/app/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/plan/page.js +2 -2
  69. package/.next/server/app/plan/page.js.nft.json +1 -1
  70. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  72. package/.next/server/app-paths-manifest.json +13 -13
  73. package/.next/server/chunks/1130.js +1 -1
  74. package/.next/server/chunks/1341.js +1 -1
  75. package/.next/server/chunks/2933.js +1 -1
  76. package/.next/server/chunks/{7208.js → 2999.js} +3 -3
  77. package/.next/server/chunks/3622.js +1 -1
  78. package/.next/server/chunks/9734.js +1 -1
  79. package/.next/server/chunks/9773.js +1 -0
  80. package/.next/server/middleware-build-manifest.js +1 -1
  81. package/.next/server/pages/404.html +1 -1
  82. package/.next/server/pages/500.html +1 -1
  83. package/.next/server/server-reference-manifest.js +1 -1
  84. package/.next/server/server-reference-manifest.json +1 -1
  85. package/.next/static/chunks/1487-13f43d25413ae041.js +1 -0
  86. package/.next/static/chunks/3343-af1292b51a276724.js +1 -0
  87. package/.next/static/chunks/app/docs/page-ae19d2e91ec24771.js +1 -0
  88. package/.next/static/chunks/app/map/page-5074176a5e746ffb.js +1 -0
  89. package/.next/static/chunks/app/page-541e900d67f17dae.js +1 -0
  90. package/.next/static/chunks/app/plan/{page-257d486640eadd7f.js → page-3c4c1fc03275299f.js} +1 -1
  91. package/.next/static/css/629ab377241de9ca.css +1 -0
  92. package/.next/trace +39 -39
  93. package/.next/trace-build +1 -1
  94. package/dist/bin/beacon.js +7 -7
  95. package/dist/bin/doctor.js +43 -32
  96. package/dist/bin/hook.js +43 -32
  97. package/dist/bin/mcp.js +49 -38
  98. package/dist/bin/plan.js +45 -34
  99. package/dist/bin/prompt.js +1 -1
  100. package/dist/bin/remove.js +7 -7
  101. package/dist/bin/uninstall.js +42 -31
  102. package/dist/lib/assets.js +30 -19
  103. package/dist/lib/codex-install.js +40 -29
  104. package/dist/lib/global-install.js +40 -29
  105. package/package.json +1 -1
  106. package/.next/server/chunks/805.js +0 -1
  107. package/.next/static/chunks/8074-a6b2725786399e2c.js +0 -1
  108. package/.next/static/chunks/85-82015ecb44b65d3e.js +0 -1
  109. package/.next/static/chunks/app/docs/page-0c841cb9a7aa2f9a.js +0 -1
  110. package/.next/static/chunks/app/map/page-c06fcf30d8172f82.js +0 -1
  111. package/.next/static/chunks/app/page-968dd5a6f667bff9.js +0 -1
  112. package/.next/static/css/5a58d83133d25695.css +0 -1
  113. /package/.next/static/{gNMdQmtkjPn6XQhRMDoMg → J1AU9kp6Vs1x9YOBkXMiR}/_buildManifest.js +0 -0
  114. /package/.next/static/{gNMdQmtkjPn6XQhRMDoMg → J1AU9kp6Vs1x9YOBkXMiR}/_ssgManifest.js +0 -0
@@ -1,20 +1,21 @@
1
1
  // @bun
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:()=>k,PLAN_SKILL:()=>t,INIT_SKILL:()=>F});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,F),J}function wq(q){let z=$(q,".claude","skills","beacon-refresh");g(z,{recursive:!0});let J=$(z,"SKILL.md");return B(J,k),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]*?${O}`);J=Q.test(J)?J.replace(Q,s):`${J.trim()}
2
+ var bq=Object.defineProperty;var uq=(q)=>q;function wq(q,z){this[q]=uq.bind(null,z)}var d=(q,z)=>{for(var J in z)bq(q,J,{get:z[J],enumerable:!0,configurable:!0,set:wq.bind(z,J)})};var X=(q,z)=>()=>(q&&(z=q(q=0)),z);var lq=1500,dq=480000,sq=1800000,w=3600000,cq=3000;var s=()=>{};var n={};d(n,{removeRepoAssets:()=>Dq,installRefreshSkill:()=>gq,installPlanSkill:()=>Kq,installInitSkill:()=>jq,installCodexRepoSkills:()=>Nq,ensureWorkflowDoc:()=>Mq,ensureMcp:()=>fq,auditRepo:()=>Rq,REFRESH_SKILL:()=>L,PLAN_SKILL:()=>t,INIT_SKILL:()=>E});import{existsSync as v,mkdirSync as g,readFileSync as H,rmSync as j,writeFileSync as W}from"fs";import{join as $}from"path";function jq(q){let z=$(q,".claude","skills","beacon-init");g(z,{recursive:!0});let J=$(z,"SKILL.md");return W(J,E),J}function gq(q){let z=$(q,".claude","skills","beacon-refresh");g(z,{recursive:!0});let J=$(z,"SKILL.md");return W(J,L),J}function Kq(q){let z=$(q,".claude","skills","beacon-plan");g(z,{recursive:!0});let J=$(z,"SKILL.md");return W(J,t),J}function Nq(q){let z=[];for(let J of Cq){let Q=$(q,".agents","skills",J.name);g(Q,{recursive:!0});let V=$(Q,"SKILL.md");W(V,J.body()),z.push(V)}return z}function Mq(q){let z=$(q,"AGENTS.md"),J="";try{J=H(z,"utf8")}catch{}let Q=new RegExp(`${K}[\\s\\S]*?${y}`);J=Q.test(J)?J.replace(Q,c):`${J.trim()}
3
3
 
4
- ${s}
5
- `.trimStart(),B(z,J.endsWith(`
4
+ ${c}
5
+ `.trimStart(),W(z,J.endsWith(`
6
6
  `)?J:`${J}
7
- `);let V=$(q,"CLAUDE.md"),Y="";try{Y=W(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))B(V,`${Y?`${Y.trim()}
7
+ `);let V=$(q,"CLAUDE.md"),Y="";try{Y=H(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))W(V,`${Y?`${Y.trim()}
8
8
 
9
9
  `:""}@AGENTS.md
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]*?${O}\\n?`);if(P.test(Z)){let E=Z.replace(P,`
10
+ `)}function fq(q){let z=$(q,".mcp.json"),J={};try{J=JSON.parse(H(z,"utf8"))}catch{}J.mcpServers=J.mcpServers??{};let Q=J.mcpServers.beacon;if(Q){if(!Q.timeout||Q.timeout<w)return Q.timeout=w,W(z,JSON.stringify(J,null,2)+`
11
+ `),{path:z,added:!1,updated:!0};return{path:z,added:!1,updated:!1}}return J.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:w},W(z,JSON.stringify(J,null,2)+`
12
+ `),{path:z,added:!0,updated:!1}}function Rq(q){let z=$(q,".mcp.json"),J=!1;try{J=!!JSON.parse(H(z,"utf8")).mcpServers?.beacon}catch{}let Q=!1;try{Q=H($(q,"AGENTS.md"),"utf8").includes(K)}catch{}let V=!1;try{V=/@AGENTS\.md/.test(H($(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 Dq(q){let z=[];for(let Z of["beacon-init","beacon-refresh","beacon-db-design"]){let P=$(q,".claude","skills",Z);if(v(P))j(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))j(P,{recursive:!0,force:!0}),z.push(`codex:${Z}`)}let J=!1,Q=$(q,".mcp.json");try{let Z=JSON.parse(H(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)j(Q,{force:!0});else W(Q,JSON.stringify(Z,null,2)+`
13
+ `)}}catch{}let V=!1,Y=$(q,"AGENTS.md");try{let Z=H(Y,"utf8"),P=new RegExp(`\\n?${K}[\\s\\S]*?${y}\\n?`);if(P.test(Z)){let k=Z.replace(P,`
13
14
  `).replace(/\n{3,}/g,`
14
15
 
15
- `).trimStart();B(Y,E.endsWith(`
16
- `)?E:`${E}
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 F=`---
16
+ `).trimStart();W(Y,k.endsWith(`
17
+ `)?k:`${k}
18
+ `),V=!0}}catch{}let U=!1,B=$(q,"CLAUDE.md");try{let Z=H(B,"utf8"),P=Z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==Z){if(!P.trim())j(B,{force:!0});else W(B,P);U=!0}}catch{}return{skillsRemoved:z,mcpUnregistered:J,agentsBlockRemoved:V,claudeImportRemoved:U}}var E=`---
18
19
  name: beacon-init
19
20
  description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
20
21
  ---
@@ -53,7 +54,7 @@ A single \`beacon_init_persist\` MCP tool call with:
53
54
  If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
54
55
 
55
56
  After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
56
- `,k=`---
57
+ `,L=`---
57
58
  name: beacon-refresh
58
59
  description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
59
60
  ---
@@ -69,7 +70,7 @@ Beacon was already initialized in this repo (\`/beacon-init\` ran at some point)
69
70
 
70
71
  ## What gets preserved vs replaced
71
72
 
72
- The \`beacon_init_persist\` tool **replaces only init-derived nodes** (\`source=INIT\`). A curated architecture node (created by \`beacon_describe_feature\` 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.
73
+ 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.
73
74
 
74
75
  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.
75
76
 
@@ -148,7 +149,7 @@ If it returns feedback, revise and call it again.
148
149
  If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
149
150
  with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
150
151
  run \`beacon\` in this repo once.
151
- `,jq,j="<!-- beacon:workflow:start -->",O="<!-- beacon:workflow:end -->",s;var c=b(()=>{jq=[{name:"beacon-init",body:()=>F},{name:"beacon-refresh",body:()=>k}];s=`${j}
152
+ `,Cq,K="<!-- beacon:workflow:start -->",y="<!-- beacon:workflow:end -->",c;var r=X(()=>{s();Cq=[{name:"beacon-init",body:()=>E},{name:"beacon-refresh",body:()=>L}];c=`${K}
152
153
  ## Beacon \u2014 feature workflow
153
154
 
154
155
  This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
@@ -173,13 +174,23 @@ When listing endpoints, give each \`uses: [{ table, access }]\` so the endpoint\
173
174
 
174
175
  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.
175
176
 
176
- 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_start_feature\`, \`beacon_add_subtasks\` \u2014 sub-tasks default to the parent's layer) and on architecture components (\`beacon_describe_feature\` / \`beacon_init_persist\`). In a pure-backend repo, never set it \u2014 the boards don't show it there.
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, \`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.
177
178
 
178
- 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.
179
+ ### Adding a card directly \u2014 \`beacon_feature\` (no review gate)
180
+
181
+ To put a card on the board WITHOUT the plan-review flow, call \`beacon_feature\` \u2014 ONE tool for a feature's whole lifecycle:
182
+ - \`{ 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.
183
+ - \`{ action: "start" }\` marks an existing card IN_PROGRESS (create-or-flag).
184
+ - \`{ action: "subtasks" }\` adds child tasks under a card.
185
+ - \`{ action: "done" }\` completes feature(s) and registers the files/architecture touched.
186
+
187
+ 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.
188
+
189
+ 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.
179
190
 
180
191
  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.
181
192
 
182
- 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_start_feature\` (when the user says they're starting on a bug), \`beacon_add_subtasks\` items (a bug discovered mid-work), and \`beacon_init_persist\` roadmap items. Default is FEATURE.
193
+ 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.
183
194
 
184
195
  ### 2b. Presenting a plan in plan mode (ExitPlanMode)
185
196
 
@@ -197,27 +208,27 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
197
208
 
198
209
  ### 3. At the end, register the work \u2014 in ONE call
199
210
 
200
- 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.
211
+ 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.
201
212
 
202
213
  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.
203
214
 
204
- 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**.
215
+ 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**.
205
216
 
206
217
  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.
207
218
 
208
219
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
209
- ${O}`});import{existsSync as n,mkdirSync as L,readFileSync as N,rmSync as Tq,writeFileSync as K}from"fs";import{dirname as r,join as C}from"path";function y(q){try{return JSON.parse(N(q,"utf8"))}catch{return{}}}function o(q,z){L(r(q),{recursive:!0}),K(q,JSON.stringify(z,null,2)+`
210
- `)}function e(q,z){let J=y(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(y(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function zq(q,z){let J=y(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}
220
+ ${y}`});import{existsSync as i,mkdirSync as O,readFileSync as N,rmSync as Iq,writeFileSync as M}from"fs";import{dirname as o,join as C}from"path";function h(q){try{return JSON.parse(N(q,"utf8"))}catch{return{}}}function qq(q,z){O(o(q),{recursive:!0}),M(q,JSON.stringify(z,null,2)+`
221
+ `)}function zq(q,z){let J=h(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}]}),qq(q,J),!0}function Jq(q,z){return(h(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function Qq(q,z){let J=h(q),Q=J.hooks?.[z.event];if(!Q)return!1;let V=!1,Y=Q.map((U)=>{let B=U.hooks?.length??0,Z=(U.hooks??[]).filter((P)=>P.command!==z.command);if(Z.length!==B)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 qq(q,J),!0}function Vq(q,z,J,Q){let V=`${z}
211
222
  ${Q.trim()}
212
223
  ${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()}
213
224
 
214
225
  ${V}
215
226
  `:`${V}
216
- `,L(r(q),{recursive:!0}),K(q,Y.endsWith(`
227
+ `,O(o(q),{recursive:!0}),M(q,Y.endsWith(`
217
228
  `)?Y:`${Y}
218
- `)}function h(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,`
229
+ `)}function _(q,z){try{return N(q,"utf8").includes(z)}catch{return!1}}function Yq(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,`
219
230
 
220
- `).trimStart();return K(q,Y),!0}function Vq(q,z,J){let Q=C(q,z);L(Q,{recursive:!0});let V=C(Q,"SKILL.md");return K(V,J),V}function _(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)
231
+ `).trimStart();return M(q,Y),!0}function Zq(q,z,J){let Q=C(q,z);O(Q,{recursive:!0});let V=C(Q,"SKILL.md");return M(V,J),V}function m(q,z){return i(C(q,z,"SKILL.md"))}function $q(q,z){let J=C(q,z);if(!i(J))return!1;return Iq(J,{recursive:!0,force:!0}),!0}var f,e=`## Beacon (visual planning panel)
221
232
 
222
233
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
223
234
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -238,17 +249,17 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
238
249
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
239
250
  on the /map and /db boards (added features, attached subtasks, edited columns, new
240
251
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
241
- 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 f(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}}function nq(q,z,J=!1){f(q,JSON.stringify(z,null,J?2:void 0))}var $q=()=>{};var _q={};l(_q,{setupCodexAssets:()=>Lq,removeCodexMcp:()=>xq,removeCodexArtifacts:()=>hq,hasCodexMcp:()=>a,ensureCodexMcp:()=>vq,codexMcpProblem:()=>Oq,codexDetected:()=>Bq,auditCodex:()=>yq,CODEX_HOOKS:()=>D});import{readFileSync as A}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(A(x(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function Oq(){let q="";try{q=A(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=A(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(`
252
+ verbatim. Do NOT implement until the tool returns approval.`;var Uq=X(()=>{f=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as Aq,renameSync as Tq,rmSync as Fq,writeFileSync as kq}from"fs";import{dirname as Eq}from"path";function R(q,z){Aq(Eq(q),{recursive:!0});let J=`${q}.tmp`;try{kq(J,z),Tq(J,q)}catch(Q){throw Fq(J,{force:!0}),Q}}function Qz(q,z,J=!1){R(q,JSON.stringify(z,null,J?2:void 0))}var Pq=()=>{};var Sq={};d(Sq,{setupCodexAssets:()=>hq,removeCodexMcp:()=>Gq,removeCodexArtifacts:()=>mq,hasCodexMcp:()=>l,ensureCodexMcp:()=>Xq,codexMcpProblem:()=>Oq,codexDetected:()=>Bq,auditCodex:()=>_q,CODEX_HOOKS:()=>F});import{readFileSync as T}from"fs";import{homedir as Lq}from"os";import{join as u}from"path";function Wq(){return process.env.HOME||process.env.USERPROFILE||Lq()}function Bq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(S===void 0)S=Bun.which("codex")!==null;return S}function b(q){try{return Bun.TOML.parse(q)}catch{return null}}function l(){try{return Boolean(b(T(x(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function Oq(){let q="";try{q=T(x(),"utf8")}catch{return null}let z=b(q);if(!z)return`~/.codex/config.toml does not parse \u2014 ${G}`;if(z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${G}`;return null}function Xq(){let q="",z=!1;try{q=T(x(),"utf8"),z=!0}catch{}if(z){let Y=b(q);if(!Y)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${G}`};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 ${G}`}}let J=!q?"":q.endsWith(`
242
253
  `)?`
243
254
  `:`
244
255
 
245
- `,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 f(x(),Q),{added:!0}}function xq(){let q="";try{q=A(x(),"utf8")}catch{return{removed:!1}}let z=q.split(`
246
- `),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(`
256
+ `,Q=q+J+yq;if(b(Q)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${G}`};return R(x(),Q),{added:!0}}function Gq(){let q="";try{q=T(x(),"utf8")}catch{return{removed:!1}}let z=q.split(`
257
+ `),J=z.indexOf(vq);if(J===-1)return{removed:!1,skipped:l()};let Q=z.indexOf(xq,J);if(Q===-1)return{removed:!1,skipped:!0};z.splice(J,Q-J+1);let V=z.join(`
247
258
  `).replace(/\n{3,}/g,`
248
259
 
249
- `).replace(/^\n+/,"");if(X(V)===null)return{removed:!1,skipped:!0};return f(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(!_(I(),Z))V.push(Z);Vq(I(),Z,Q[Z])}let Y=0;for(let Z of D)if(e(p(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let U=h(T(),R);Jq(T(),R,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]=_(I(),J);let z={};for(let J of D)z[J.event]=qq(p(),{event:J.event,command:J.command});return{detected:Bq(),skills:q,hooks:z,agentsMdBlock:h(T(),R),mcp:a()}}function hq(){let q=[];for(let V of M)if(Yq(I(),V))q.push(V);let z=0;for(let V of D)if(zq(p(),{event:V.event,command:V.command}))z++;let J=Qq(T(),R,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"),T=()=>G(S(),"AGENTS.md"),I=()=>G(Uq(),".agents","skills"),R="<!-- beacon:global:start -->",Pq="<!-- beacon:global:end -->",D,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();D=[{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}
260
+ `).replace(/^\n+/,"");if(b(V)===null)return{removed:!1,skipped:!0};return R(x(),V),{removed:!0}}async function hq(){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 f){if(!m(I(),Z))V.push(Z);Zq(I(),Z,Q[Z])}let Y=0;for(let Z of F)if(zq(a(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let U=_(D(),A);Vq(D(),A,Hq,e);let B=Xq();return{skillsAdded:V,hooksAdded:Y,agentsMdBlockTouched:!U,mcp:B}}function _q(){let q={};for(let J of f)q[J]=m(I(),J);let z={};for(let J of F)z[J.event]=Jq(a(),{event:J.event,command:J.command});return{detected:Bq(),skills:q,hooks:z,agentsMdBlock:_(D(),A),mcp:l()}}function mq(){let q=[];for(let V of f)if($q(I(),V))q.push(V);let z=0;for(let V of F)if(Qq(a(),{event:V.event,command:V.command}))z++;let J=Yq(D(),A,Hq),Q=Gq();return{skillsRemoved:q,hooksRemoved:z,agentsMdBlockRemoved:J,mcpRemoved:Q.removed,mcpSkipped:Q.skipped}}var p=()=>u(Wq(),".codex"),a=()=>u(p(),"hooks.json"),x=()=>u(p(),"config.toml"),D=()=>u(p(),"AGENTS.md"),I=()=>u(Wq(),".agents","skills"),A="<!-- beacon:global:start -->",Hq="<!-- beacon:global:end -->",F,S,vq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",xq="# beacon:end",yq,G="add it manually: codex mcp add beacon -- beacon mcp";var pq=X(()=>{Uq();Pq();F=[{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."}];yq=`${vq}
250
261
  [mcp_servers.beacon]
251
262
  command = "beacon"
252
263
  args = ["mcp"]
253
- ${Hq}
254
- `});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,D as CODEX_HOOKS};
264
+ ${xq}
265
+ `});pq();export{hq as setupCodexAssets,Gq as removeCodexMcp,mq as removeCodexArtifacts,l as hasCodexMcp,Xq as ensureCodexMcp,Oq as codexMcpProblem,Bq as codexDetected,_q as auditCodex,F as CODEX_HOOKS};
@@ -1,20 +1,21 @@
1
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 r={};Pq(r,{removeRepoAssets:()=>_q,installRefreshSkill:()=>Eq,installPlanSkill:()=>yq,installInitSkill:()=>Iq,installCodexRepoSkills:()=>Dq,ensureWorkflowDoc:()=>Oq,ensureMcp:()=>hq,auditRepo:()=>kq,REFRESH_SKILL:()=>d,PLAN_SKILL:()=>Uq,INIT_SKILL:()=>c});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,c),J}function Eq(q){let z=$(q,".claude","skills","beacon-refresh");f(z,{recursive:!0});let J=$(z,"SKILL.md");return x(J,d),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]*?${n}`);J=Q.test(J)?J.replace(Q,Wq):`${J.trim()}
2
+ var Tq=Object.defineProperty;var Iq=(q)=>q;function yq(q,z){this[q]=Iq.bind(null,z)}var Wq=(q,z)=>{for(var J in z)Tq(q,J,{get:z[J],enumerable:!0,configurable:!0,set:yq.bind(z,J)})};var j=(q,z)=>()=>(q&&(z=q(q=0)),z);var xz=1500,Hz=480000,wz=1800000,b=3600000,vz=3000;var Xq=()=>{};var s={};Wq(s,{removeRepoAssets:()=>mq,installRefreshSkill:()=>Aq,installPlanSkill:()=>Eq,installInitSkill:()=>Dq,installCodexRepoSkills:()=>kq,ensureWorkflowDoc:()=>hq,ensureMcp:()=>Lq,auditRepo:()=>_q,REFRESH_SKILL:()=>n,PLAN_SKILL:()=>xq,INIT_SKILL:()=>d});import{existsSync as w,mkdirSync as f,readFileSync as x,rmSync as K,writeFileSync as U}from"fs";import{join as $}from"path";function Dq(q){let z=$(q,".claude","skills","beacon-init");f(z,{recursive:!0});let J=$(z,"SKILL.md");return U(J,d),J}function Aq(q){let z=$(q,".claude","skills","beacon-refresh");f(z,{recursive:!0});let J=$(z,"SKILL.md");return U(J,n),J}function Eq(q){let z=$(q,".claude","skills","beacon-plan");f(z,{recursive:!0});let J=$(z,"SKILL.md");return U(J,xq),J}function kq(q){let z=[];for(let J of Oq){let Q=$(q,".agents","skills",J.name);f(Q,{recursive:!0});let V=$(Q,"SKILL.md");U(V,J.body()),z.push(V)}return z}function hq(q){let z=$(q,"AGENTS.md"),J="";try{J=x(z,"utf8")}catch{}let Q=new RegExp(`${C}[\\s\\S]*?${r}`);J=Q.test(J)?J.replace(Q,Uq):`${J.trim()}
3
3
 
4
- ${Wq}
5
- `.trimStart(),x(z,J.endsWith(`
4
+ ${Uq}
5
+ `.trimStart(),U(z,J.endsWith(`
6
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()}
7
+ `);let V=$(q,"CLAUDE.md"),Y="";try{Y=x(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))U(V,`${Y?`${Y.trim()}
8
8
 
9
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]*?${n}\\n?`);if(U.test(Z)){let t=Z.replace(U,`
10
+ `)}function Lq(q){let z=$(q,".mcp.json"),J={};try{J=JSON.parse(x(z,"utf8"))}catch{}J.mcpServers=J.mcpServers??{};let Q=J.mcpServers.beacon;if(Q){if(!Q.timeout||Q.timeout<b)return Q.timeout=b,U(z,JSON.stringify(J,null,2)+`
11
+ `),{path:z,added:!1,updated:!0};return{path:z,added:!1,updated:!1}}return J.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:b},U(z,JSON.stringify(J,null,2)+`
12
+ `),{path:z,added:!0,updated:!1}}function _q(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":w($(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":w($(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":w($(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":w($(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function mq(q){let z=[];for(let Z of["beacon-init","beacon-refresh","beacon-db-design"]){let X=$(q,".claude","skills",Z);if(w(X))K(X,{recursive:!0,force:!0}),z.push(Z)}for(let Z of["beacon-init","beacon-refresh"]){let X=$(q,".agents","skills",Z);if(w(X))K(X,{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)K(Q,{force:!0});else U(Q,JSON.stringify(Z,null,2)+`
13
+ `)}}catch{}let V=!1,Y=$(q,"AGENTS.md");try{let Z=x(Y,"utf8"),X=new RegExp(`\\n?${C}[\\s\\S]*?${r}\\n?`);if(X.test(Z)){let t=Z.replace(X,`
13
14
  `).replace(/\n{3,}/g,`
14
15
 
15
- `).trimStart();x(Y,t.endsWith(`
16
+ `).trimStart();U(Y,t.endsWith(`
16
17
  `)?t:`${t}
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 c=`---
18
+ `),V=!0}}catch{}let P=!1,W=$(q,"CLAUDE.md");try{let Z=x(W,"utf8"),X=Z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(X!==Z){if(!X.trim())K(W,{force:!0});else U(W,X);P=!0}}catch{}return{skillsRemoved:z,mcpUnregistered:J,agentsBlockRemoved:V,claudeImportRemoved:P}}var d=`---
18
19
  name: beacon-init
19
20
  description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
20
21
  ---
@@ -53,7 +54,7 @@ A single \`beacon_init_persist\` MCP tool call with:
53
54
  If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
54
55
 
55
56
  After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
56
- `,d=`---
57
+ `,n=`---
57
58
  name: beacon-refresh
58
59
  description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
59
60
  ---
@@ -69,7 +70,7 @@ Beacon was already initialized in this repo (\`/beacon-init\` ran at some point)
69
70
 
70
71
  ## What gets preserved vs replaced
71
72
 
72
- The \`beacon_init_persist\` tool **replaces only init-derived nodes** (\`source=INIT\`). A curated architecture node (created by \`beacon_describe_feature\` 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.
73
+ 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.
73
74
 
74
75
  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.
75
76
 
@@ -100,7 +101,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
100
101
  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.
101
102
 
102
103
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
103
- `,Uq=`---
104
+ `,xq=`---
104
105
  name: beacon-plan
105
106
  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.
106
107
  ---
@@ -148,7 +149,7 @@ If it returns feedback, revise and call it again.
148
149
  If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
149
150
  with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
150
151
  run \`beacon\` in this repo once.
151
- `,Aq,C="<!-- beacon:workflow:start -->",n="<!-- beacon:workflow:end -->",Wq;var s=b(()=>{Aq=[{name:"beacon-init",body:()=>c},{name:"beacon-refresh",body:()=>d}];Wq=`${C}
152
+ `,Oq,C="<!-- beacon:workflow:start -->",r="<!-- beacon:workflow:end -->",Uq;var l=j(()=>{Xq();Oq=[{name:"beacon-init",body:()=>d},{name:"beacon-refresh",body:()=>n}];Uq=`${C}
152
153
  ## Beacon \u2014 feature workflow
153
154
 
154
155
  This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
@@ -173,13 +174,23 @@ When listing endpoints, give each \`uses: [{ table, access }]\` so the endpoint\
173
174
 
174
175
  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.
175
176
 
176
- 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_start_feature\`, \`beacon_add_subtasks\` \u2014 sub-tasks default to the parent's layer) and on architecture components (\`beacon_describe_feature\` / \`beacon_init_persist\`). In a pure-backend repo, never set it \u2014 the boards don't show it there.
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, \`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.
177
178
 
178
- 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.
179
+ ### Adding a card directly \u2014 \`beacon_feature\` (no review gate)
180
+
181
+ To put a card on the board WITHOUT the plan-review flow, call \`beacon_feature\` \u2014 ONE tool for a feature's whole lifecycle:
182
+ - \`{ 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.
183
+ - \`{ action: "start" }\` marks an existing card IN_PROGRESS (create-or-flag).
184
+ - \`{ action: "subtasks" }\` adds child tasks under a card.
185
+ - \`{ action: "done" }\` completes feature(s) and registers the files/architecture touched.
186
+
187
+ 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.
188
+
189
+ 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.
179
190
 
180
191
  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.
181
192
 
182
- 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_start_feature\` (when the user says they're starting on a bug), \`beacon_add_subtasks\` items (a bug discovered mid-work), and \`beacon_init_persist\` roadmap items. Default is FEATURE.
193
+ 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.
183
194
 
184
195
  ### 2b. Presenting a plan in plan mode (ExitPlanMode)
185
196
 
@@ -197,27 +208,27 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
197
208
 
198
209
  ### 3. At the end, register the work \u2014 in ONE call
199
210
 
200
- 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.
211
+ 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.
201
212
 
202
213
  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.
203
214
 
204
- 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**.
215
+ 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**.
205
216
 
206
217
  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.
207
218
 
208
219
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
209
- ${n}`});import{existsSync as xq,mkdirSync as l,readFileSync as M,rmSync as Lq,writeFileSync as F}from"fs";import{dirname as Xq,join as K}from"path";function i(q){try{return JSON.parse(M(q,"utf8"))}catch{return{}}}function wq(q,z){l(Xq(q),{recursive:!0}),F(q,JSON.stringify(z,null,2)+`
210
- `)}function R(q,z){let J=i(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(i(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function E(q,z){let J=i(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}
220
+ ${r}`});import{existsSync as Hq,mkdirSync as i,readFileSync as M,rmSync as pq,writeFileSync as R}from"fs";import{dirname as wq,join as F}from"path";function o(q){try{return JSON.parse(M(q,"utf8"))}catch{return{}}}function vq(q,z){i(wq(q),{recursive:!0}),R(q,JSON.stringify(z,null,2)+`
221
+ `)}function I(q,z){let J=o(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}]}),vq(q,J),!0}function y(q,z){return(o(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function D(q,z){let J=o(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((X)=>X.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 vq(q,J),!0}function A(q,z,J,Q){let V=`${z}
211
222
  ${Q.trim()}
212
223
  ${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()}
213
224
 
214
225
  ${V}
215
226
  `:`${V}
216
- `,l(Xq(q),{recursive:!0}),F(q,Y.endsWith(`
227
+ `,i(wq(q),{recursive:!0}),R(q,Y.endsWith(`
217
228
  `)?Y:`${Y}
218
- `)}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,`
229
+ `)}function g(q,z){try{return M(q,"utf8").includes(z)}catch{return!1}}function E(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,`
219
230
 
220
- `).trimStart();return F(q,Y),!0}function D(q,z,J){let Q=K(q,z);l(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)
231
+ `).trimStart();return R(q,Y),!0}function O(q,z,J){let Q=F(q,z);i(Q,{recursive:!0});let V=F(Q,"SKILL.md");return R(V,J),V}function B(q,z){return Hq(F(q,z,"SKILL.md"))}function k(q,z){let J=F(q,z);if(!Hq(J))return!1;return pq(J,{recursive:!0,force:!0}),!0}var H,T=`## Beacon (visual planning panel)
221
232
 
222
233
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
223
234
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -238,17 +249,17 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
238
249
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
239
250
  on the /map and /db boards (added features, attached subtasks, edited columns, new
240
251
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
241
- verbatim. Do NOT implement until the tool returns approval.`;var o=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 h(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}}function jz(q,z,J=!1){h(q,JSON.stringify(z,null,J?2:void 0))}var Hq=()=>{};var Gq={};Pq(Gq,{setupCodexAssets:()=>rq,removeCodexMcp:()=>bq,removeCodexArtifacts:()=>lq,hasCodexMcp:()=>Jq,ensureCodexMcp:()=>Nq,codexMcpProblem:()=>nq,codexDetected:()=>jq,auditCodex:()=>sq,CODEX_HOOKS:()=>p});import{readFileSync as m}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(m(g(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function nq(){let q="";try{q=m(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=m(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(`
252
+ verbatim. Do NOT implement until the tool returns approval.`;var e=j(()=>{H=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as Sq,renameSync as aq,rmSync as cq,writeFileSync as tq}from"fs";import{dirname as dq}from"path";function h(q,z){Sq(dq(q),{recursive:!0});let J=`${q}.tmp`;try{tq(J,z),aq(J,q)}catch(Q){throw cq(J,{force:!0}),Q}}function Cz(q,z,J=!1){h(q,JSON.stringify(z,null,J?2:void 0))}var jq=()=>{};var fq={};Wq(fq,{setupCodexAssets:()=>lq,removeCodexMcp:()=>Kq,removeCodexArtifacts:()=>oq,hasCodexMcp:()=>Qq,ensureCodexMcp:()=>bq,codexMcpProblem:()=>sq,codexDetected:()=>uq,auditCodex:()=>iq,CODEX_HOOKS:()=>S});import{readFileSync as p}from"fs";import{homedir as nq}from"os";import{join as G}from"path";function gq(){return process.env.HOME||process.env.USERPROFILE||nq()}function uq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(qq===void 0)qq=Bun.which("codex")!==null;return qq}function N(q){try{return Bun.TOML.parse(q)}catch{return null}}function Qq(){try{return Boolean(N(p(v(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function sq(){let q="";try{q=p(v(),"utf8")}catch{return null}let z=N(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 bq(){let q="",z=!1;try{q=p(v(),"utf8"),z=!0}catch{}if(z){let Y=N(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(`
242
253
  `)?`
243
254
  `:`
244
255
 
245
- `,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 h(g(),Q),{added:!0}}function bq(){let q="";try{q=m(g(),"utf8")}catch{return{removed:!1}}let z=q.split(`
246
- `),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(`
256
+ `,Q=q+J+rq;if(N(Q)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${u}`};return h(v(),Q),{added:!0}}function Kq(){let q="";try{q=p(v(),"utf8")}catch{return{removed:!1}}let z=q.split(`
257
+ `),J=z.indexOf(Nq);if(J===-1)return{removed:!1,skipped:Qq()};let Q=z.indexOf(Gq,J);if(Q===-1)return{removed:!1,skipped:!0};z.splice(J,Q-J+1);let V=z.join(`
247
258
  `).replace(/\n{3,}/g,`
248
259
 
249
- `).replace(/^\n+/,"");if(u(V)===null)return{removed:!1,skipped:!0};return h(g(),V),{removed:!0}}async function rq(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (s(),r)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let Z of w){if(!j(_(),Z))V.push(Z);D(_(),Z,Q[Z])}let Y=0;for(let Z of p)if(R(zq(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let P=v(k(),L);y(k(),L,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(_(),J);let z={};for(let J of p)z[J.event]=I(zq(),{event:J.event,command:J.command});return{detected:jq(),skills:q,hooks:z,agentsMdBlock:v(k(),L),mcp:Jq()}}function lq(){let q=[];for(let V of w)if(O(_(),V))q.push(V);let z=0;for(let V of p)if(E(zq(),{event:V.event,command:V.command}))z++;let J=A(k(),L,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"),k=()=>N(qq(),"AGENTS.md"),_=()=>N(gq(),".agents","skills"),L="<!-- beacon:global:start -->",vq="<!-- beacon:global:end -->",p,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(()=>{o();Hq();p=[{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}
260
+ `).replace(/^\n+/,"");if(N(V)===null)return{removed:!1,skipped:!0};return h(v(),V),{removed:!0}}async function lq(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (l(),s)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let Z of H){if(!B(_(),Z))V.push(Z);O(_(),Z,Q[Z])}let Y=0;for(let Z of S)if(I(Jq(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let P=g(L(),m);A(L(),m,Bq,T);let W=bq();return{skillsAdded:V,hooksAdded:Y,agentsMdBlockTouched:!P,mcp:W}}function iq(){let q={};for(let J of H)q[J]=B(_(),J);let z={};for(let J of S)z[J.event]=y(Jq(),{event:J.event,command:J.command});return{detected:uq(),skills:q,hooks:z,agentsMdBlock:g(L(),m),mcp:Qq()}}function oq(){let q=[];for(let V of H)if(k(_(),V))q.push(V);let z=0;for(let V of S)if(D(Jq(),{event:V.event,command:V.command}))z++;let J=E(L(),m,Bq),Q=Kq();return{skillsRemoved:q,hooksRemoved:z,agentsMdBlockRemoved:J,mcpRemoved:Q.removed,mcpSkipped:Q.skipped}}var zq=()=>G(gq(),".codex"),Jq=()=>G(zq(),"hooks.json"),v=()=>G(zq(),"config.toml"),L=()=>G(zq(),"AGENTS.md"),_=()=>G(gq(),".agents","skills"),m="<!-- beacon:global:start -->",Bq="<!-- beacon:global:end -->",S,qq,Nq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",Gq="# beacon:end",rq,u="add it manually: codex mcp add beacon -- beacon mcp";var Cq=j(()=>{e();jq();S=[{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."}];rq=`${Nq}
250
261
  [mcp_servers.beacon]
251
262
  command = "beacon"
252
263
  args = ["mcp"]
253
- ${uq}
254
- `});o();import{existsSync as iq}from"fs";import{homedir as oq}from"os";import{join as S}from"path";function eq(){return process.env.HOME||process.env.USERPROFILE||oq()}var a=()=>S(eq(),".claude"),Qq=()=>S(a(),"skills"),Vq=()=>S(a(),"settings.json"),Yq=()=>S(a(),"CLAUDE.md"),Zq="<!-- beacon:global:start -->",Cq="<!-- beacon:global:end -->";var qz=T,$q=[{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 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 Tz(){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(a()),skills:q,hooks:z,claudeMdBlock:Mq()}}async function Pz(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (s(),r)),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 Rz(){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 Iz(){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,Rz as selfHealGlobal,Jz as removeGlobalSkill,Yz as removeGlobalHook,$z as removeGlobalClaudeMdBlock,Iz as removeBeaconArtifacts,Kq as isGlobalSkillInstalled,zz as installGlobalSkill,Vz as hasGlobalHook,Mq as hasGlobalClaudeMdBlock,Qz as ensureGlobalHook,Zz as ensureGlobalClaudeMdBlock,Tz as auditGlobal,w as GLOBAL_SKILLS,$q as GLOBAL_HOOKS,qz as GLOBAL_CLAUDE_MD_BLOCK};
264
+ ${Gq}
265
+ `});e();import{existsSync as eq}from"fs";import{homedir as qz}from"os";import{join as a}from"path";function zz(){return process.env.HOME||process.env.USERPROFILE||qz()}var c=()=>a(zz(),".claude"),Vq=()=>a(c(),"skills"),Yq=()=>a(c(),"settings.json"),Zq=()=>a(c(),"CLAUDE.md"),$q="<!-- beacon:global:start -->",Fq="<!-- beacon:global:end -->";var Jz=T,Pq=[{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 Qz(q,z){return O(Vq(),q,z)}function Mq(q){return B(Vq(),q)}function Vz(q){return k(Vq(),q)}function Yz(q){return I(Yq(),q)}function Zz(q){return y(Yq(),q)}function $z(q){return D(Yq(),q)}function Pz(q){A(Zq(),$q,Fq,q)}function Rq(){return g(Zq(),$q)}function Wz(){return E(Zq(),$q,Fq)}function kz(){let q={};for(let J of H)q[J]=Mq(J);let z={};for(let J of Pq)z[J.event]=Zz({event:J.event,command:J.command});return{homeExists:eq(c()),skills:q,hooks:z,claudeMdBlock:Rq()}}async function Xz(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (l(),s)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let W of H){if(!Mq(W))V.push(W);Qz(W,Q[W])}let Y=0;for(let W of Pq)if(Yz({event:W.event,matcher:W.matcher,command:W.command}))Y++;let P=Rq();return Pz(Jz),{skillsAdded:V,hooksAdded:Y,claudeMdBlockTouched:!P}}async function hz(){let q;try{q={ok:!0,...await Xz()}}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(() => (Cq(),fq));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 Lz(){let q=[];for(let Q of H)if(Vz(Q))q.push(Q);let z=0;for(let Q of Pq)if($z(Q))z++;let J=Wz();return{skillsRemoved:q,hooksRemoved:z,claudeMdBlockRemoved:J}}export{Xz as setupGlobalAssets,hz as selfHealGlobal,Vz as removeGlobalSkill,$z as removeGlobalHook,Wz as removeGlobalClaudeMdBlock,Lz as removeBeaconArtifacts,Mq as isGlobalSkillInstalled,Qz as installGlobalSkill,Zz as hasGlobalHook,Rq as hasGlobalClaudeMdBlock,Yz as ensureGlobalHook,Pz as ensureGlobalClaudeMdBlock,kz as auditGlobal,H as GLOBAL_SKILLS,Pq as GLOBAL_HOOKS,Jz as GLOBAL_CLAUDE_MD_BLOCK};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trybeacon",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "The visual planning surface for the coding agent in your terminal.",
5
5
  "homepage": "https://trybeacon.sh",
6
6
  "bin": {