trybeacon 0.1.89 → 0.1.91

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 (151) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.next/BUILD_ID +1 -1
  3. package/.next/app-path-routes-manifest.json +17 -17
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/server/app/@modal/(.)settings/page.js +1 -1
  7. package/.next/server/app/@modal/(.)settings/page.js.nft.json +1 -1
  8. package/.next/server/app/@modal/(.)settings/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/_global-error.html +1 -1
  11. package/.next/server/app/_global-error.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/.next/server/app/_not-found/page.js +1 -1
  19. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  20. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/.next/server/app/_not-found.html +1 -1
  22. package/.next/server/app/_not-found.rsc +3 -3
  23. package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  24. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  26. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  28. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  29. package/.next/server/app/api/linear/route.js +1 -17
  30. package/.next/server/app/api/linear/route.js.nft.json +1 -1
  31. package/.next/server/app/api/linear/scopes/route.js +1 -17
  32. package/.next/server/app/api/linear/scopes/route.js.nft.json +1 -1
  33. package/.next/server/app/api/linear/sync/route.js +1 -17
  34. package/.next/server/app/api/linear/sync/route.js.nft.json +1 -1
  35. package/.next/server/app/api/share/create/route.js +1 -1
  36. package/.next/server/app/docs/page.js +1 -1
  37. package/.next/server/app/docs/page.js.nft.json +1 -1
  38. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app/docs.html +1 -1
  40. package/.next/server/app/docs.rsc +4 -4
  41. package/.next/server/app/docs.segments/@modal/__DEFAULT__.segment.rsc +1 -1
  42. package/.next/server/app/docs.segments/_full.segment.rsc +4 -4
  43. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  44. package/.next/server/app/docs.segments/_index.segment.rsc +3 -3
  45. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  46. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +2 -2
  47. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  48. package/.next/server/app/help/page.js +2 -2
  49. package/.next/server/app/help/page.js.nft.json +1 -1
  50. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/help.html +1 -1
  52. package/.next/server/app/help.rsc +4 -4
  53. package/.next/server/app/help.segments/@modal/__DEFAULT__.segment.rsc +1 -1
  54. package/.next/server/app/help.segments/_full.segment.rsc +4 -4
  55. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  56. package/.next/server/app/help.segments/_index.segment.rsc +3 -3
  57. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  58. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +2 -2
  59. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  60. package/.next/server/app/index.html +1 -1
  61. package/.next/server/app/index.rsc +3 -3
  62. package/.next/server/app/index.segments/@modal/__DEFAULT__.segment.rsc +1 -1
  63. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  64. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  65. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  66. package/.next/server/app/index.segments/_index.segment.rsc +3 -3
  67. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  68. package/.next/server/app/learn/page.js +3 -3
  69. package/.next/server/app/learn/page.js.nft.json +1 -1
  70. package/.next/server/app/learn/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/map/page.js +2 -2
  72. package/.next/server/app/map/page.js.nft.json +1 -1
  73. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/page.js +1 -1
  75. package/.next/server/app/page.js.nft.json +1 -1
  76. package/.next/server/app/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/parked/page.js +1 -1
  78. package/.next/server/app/parked/page.js.nft.json +1 -1
  79. package/.next/server/app/parked/page_client-reference-manifest.js +1 -1
  80. package/.next/server/app/plan/page.js +3 -3
  81. package/.next/server/app/plan/page.js.nft.json +1 -1
  82. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/s/[token]/page.js +2 -2
  84. package/.next/server/app/s/[token]/page.js.nft.json +1 -1
  85. package/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app/settings/page.js +1 -1
  87. package/.next/server/app/settings/page.js.nft.json +1 -1
  88. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  89. package/.next/server/app-paths-manifest.json +17 -17
  90. package/.next/server/chunks/1495.js +18 -0
  91. package/.next/server/chunks/{7436.js → 1898.js} +3 -3
  92. package/.next/server/chunks/3825.js +1 -1
  93. package/.next/server/chunks/4378.js +1 -1
  94. package/.next/server/chunks/{5332.js → 473.js} +3 -3
  95. package/.next/server/chunks/5623.js +1 -1
  96. package/.next/server/chunks/799.js +1 -0
  97. package/.next/server/chunks/8709.js +8 -7
  98. package/.next/server/chunks/9683.js +1 -1
  99. package/.next/server/middleware-build-manifest.js +1 -1
  100. package/.next/server/pages/404.html +1 -1
  101. package/.next/server/pages/500.html +1 -1
  102. package/.next/server/server-reference-manifest.js +1 -1
  103. package/.next/server/server-reference-manifest.json +1 -1
  104. package/.next/static/chunks/2149-6eac4575d8a8281c.js +1 -0
  105. package/.next/static/chunks/{6283-20a6abe3453496ae.js → 3729-99f9edd66d1473ac.js} +3 -3
  106. package/.next/static/chunks/569-c70eb3d6c88282dc.js +1 -0
  107. package/.next/static/chunks/6818-051146427620d0f9.js +1 -0
  108. package/.next/static/chunks/8907-f1d97713a336fc2b.js +1 -0
  109. package/.next/static/chunks/app/@modal/(.)settings/page-77639f97e58859de.js +1 -0
  110. package/.next/static/chunks/app/docs/page-574e48b1b9519c80.js +1 -0
  111. package/.next/static/chunks/app/layout-6f04d1687adcd16e.js +1 -0
  112. package/.next/static/chunks/app/learn/page-ba0ec2cba32bd4e1.js +7 -0
  113. package/.next/static/chunks/app/map/page-a07e21cd94bae873.js +1 -0
  114. package/.next/static/chunks/app/plan/{page-809509b6149dbe6a.js → page-8e2a2edfb8fe69c5.js} +2 -2
  115. package/.next/static/chunks/app/s/[token]/page-b4dc768d9d1c6e29.js +1 -0
  116. package/.next/static/chunks/app/settings/page-c15764e1c2f54c5a.js +1 -0
  117. package/.next/static/css/b6c71ada5fa39830.css +1 -0
  118. package/.next/trace +47 -47
  119. package/.next/trace-build +1 -1
  120. package/dist/bin/ask.js +2 -2
  121. package/dist/bin/doctor.js +32 -30
  122. package/dist/bin/hook.js +31 -29
  123. package/dist/bin/mcp.js +41 -39
  124. package/dist/bin/plan.js +32 -30
  125. package/dist/bin/prompt.js +2 -2
  126. package/dist/bin/remove.js +3 -3
  127. package/dist/bin/stop-hook.js +4 -4
  128. package/dist/bin/uninstall.js +31 -29
  129. package/dist/lib/assets.js +20 -20
  130. package/dist/lib/codex-install.js +30 -28
  131. package/dist/lib/daemon-boot.js +11 -11
  132. package/dist/lib/global-install.js +31 -29
  133. package/drizzle/0013_quick_brother_voodoo.sql +1 -0
  134. package/drizzle/meta/0013_snapshot.json +1953 -0
  135. package/drizzle/meta/_journal.json +7 -0
  136. package/package.json +1 -1
  137. package/.next/server/chunks/2579.js +0 -1
  138. package/.next/static/chunks/2114-74736df56930b46c.js +0 -1
  139. package/.next/static/chunks/569-bfdcec83011428d3.js +0 -1
  140. package/.next/static/chunks/6579-1efe1d8b378c81a7.js +0 -1
  141. package/.next/static/chunks/6818-85b9a09bb74062ef.js +0 -1
  142. package/.next/static/chunks/app/@modal/(.)settings/page-58f068e66bf2fdf6.js +0 -1
  143. package/.next/static/chunks/app/docs/page-126c0e42c71731b2.js +0 -1
  144. package/.next/static/chunks/app/layout-a8bb07fb86893add.js +0 -1
  145. package/.next/static/chunks/app/learn/page-e6401368ea95de46.js +0 -7
  146. package/.next/static/chunks/app/map/page-374841ad0b729ce5.js +0 -1
  147. package/.next/static/chunks/app/s/[token]/page-57821fa904e9e018.js +0 -1
  148. package/.next/static/chunks/app/settings/page-435bfb2ac6f01744.js +0 -1
  149. package/.next/static/css/56890131dbc6daff.css +0 -1
  150. /package/.next/static/{CgztmUmahokH2oDzktISo → 5WK9Cj2xVeIioVVqODVpo}/_buildManifest.js +0 -0
  151. /package/.next/static/{CgztmUmahokH2oDzktISo → 5WK9Cj2xVeIioVVqODVpo}/_ssgManifest.js +0 -0
@@ -1,16 +1,16 @@
1
1
  // @bun
2
- var Iq=Object.defineProperty;var Aq=(q)=>q;function Fq(q,J){this[q]=Aq.bind(null,J)}var i=(q,J)=>{for(var Q in J)Iq(q,Q,{get:J[Q],enumerable:!0,configurable:!0,set:Fq.bind(J,Q)})};var N=(q,J)=>()=>(q&&(J=q(q=0)),J);import{existsSync as b,mkdirSync as _,readdirSync as Tq,readFileSync as u,rmSync as kq,writeFileSync as C}from"fs";import{basename as Dq,dirname as o,join as X}from"path";function GJ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function fq(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;let J=X(q,".claude","plugins");if(!b(J))return null;let Q=[J];for(let Y=0;Y<3&&Q.length;Y++){let Z=[];for(let $ of Q){let W=X($,".claude-plugin","plugin.json");try{if(b(W)&&JSON.parse(u(W,"utf8")).name==="beacon")return $}catch{}try{for(let P of Tq($,{withFileTypes:!0}))if(P.isDirectory())Z.push(X($,P.name))}catch{}}Q=Z}return null}function XJ(q){return fq(q)!==null}function BJ(q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(q)}function x(){let q=process.env.BEACON_CLI_PATH;if(q)return q;if(b(n))return n;return"beacon"}function Eq(q){let J=q.indexOf(" ");return J===-1?q:q.slice(0,J)}function e(q){let J=x();if(J==="beacon")return q;return q.replace(/^beacon(\s|$)/,`${J}$1`)}function B(q){let J=Eq(q);return Dq(J)+q.slice(J.length)}function wJ(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;try{let J=JSON.parse(u(X(q,".claude","plugins","installed_plugins.json"),"utf8"));for(let Q of Object.keys(J.plugins??{}))if(/^beacon@/.test(Q))return{key:Q,marketplace:Q.split("@")[1]??""}}catch{}return null}function A(q){try{return JSON.parse(u(q,"utf8"))}catch{return{}}}function Jq(q,J){_(o(q),{recursive:!0}),C(q,JSON.stringify(J,null,2)+`
3
- `)}function Qq(q,J){let Q=A(q);Q.hooks=Q.hooks??{},Q.hooks[J.event]=Q.hooks[J.event]??[];let Y=Q.hooks[J.event];if(Y.some(($)=>$.matcher===J.matcher&&$.hooks?.some((W)=>B(W.command)===B(J.command))))return!1;return Y.push({matcher:J.matcher,hooks:[{type:"command",command:J.command}]}),Jq(q,Q),!0}function Yq(q,J){return(A(q).hooks?.[J.event]??[]).some((Z)=>Z.hooks?.some(($)=>B($.command)===B(J.command)))}function uJ(q,J){let Y=A(q).hooks?.[J.event]??[];for(let Z of Y)for(let $ of Z.hooks??[])if(B($.command)===B(J.command))return $.command;return null}function Zq(q,J){let Q=A(q),Y=Q.hooks?.[J.event];if(!Y)return!1;let Z=!1,$=Y.map((W)=>{let P=W.hooks?.length??0,z=(W.hooks??[]).filter((U)=>B(U.command)!==B(J.command));if(z.length!==P)Z=!0;return{...W,hooks:z}}).filter((W)=>(W.hooks??[]).length>0);if(!Z)return!1;if($.length)Q.hooks[J.event]=$;else delete Q.hooks[J.event];if(Q.hooks&&Object.keys(Q.hooks).length===0)delete Q.hooks;return Jq(q,Q),!0}function $q(q,J,Q,Y){let Z=`${J}
2
+ var xq=Object.defineProperty;var Dq=(q)=>q;function Tq(q,J){this[q]=Dq.bind(null,J)}var qq=(q,J)=>{for(var Q in J)xq(q,Q,{get:J[Q],enumerable:!0,configurable:!0,set:Tq.bind(J,Q)})};var R=(q,J)=>()=>(q&&(J=q(q=0)),J);import{existsSync as M,mkdirSync as p,readdirSync as fq,readFileSync as K,rmSync as kq,writeFileSync as D}from"fs";import{basename as Lq,dirname as Qq,join as w}from"path";function XJ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function Oq(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;let J=w(q,".claude","plugins");if(!M(J))return null;let Q=[J];for(let Y=0;Y<3&&Q.length;Y++){let Z=[];for(let $ of Q){let z=w($,".claude-plugin","plugin.json");try{if(M(z)&&JSON.parse(K(z,"utf8")).name==="beacon")return $}catch{}try{for(let U of fq($,{withFileTypes:!0}))if(U.isDirectory())Z.push(w($,U.name))}catch{}}Q=Z}return null}function wJ(q){return Oq(q)!==null}function jJ(q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(q)}function u(){let q=process.env.BEACON_CLI_PATH;if(q)return q;if(M(Jq))return Jq;return"beacon"}function Eq(q){let J=q.indexOf(" ");return J===-1?q:q.slice(0,J)}function m(q){let J=u();if(J==="beacon")return q;return q.replace(/^beacon(\s|$)/,`${J}$1`)}function G(q){let J=Eq(q);return Lq(J)+q.slice(J.length)}function uJ(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;try{let J=JSON.parse(K(w(q,".claude","plugins","installed_plugins.json"),"utf8"));for(let Q of Object.keys(J.plugins??{}))if(/^beacon@/.test(Q))return{key:Q,marketplace:Q.split("@")[1]??""}}catch{}return null}function b(q){try{return JSON.parse(K(q,"utf8"))}catch{return{}}}function l(q,J){p(Qq(q),{recursive:!0}),D(q,JSON.stringify(J,null,2)+`
3
+ `)}function Zq(q,J,Q={}){let Y=b(q);Y.hooks=Y.hooks??{},Y.hooks[J.event]=Y.hooks[J.event]??[];let Z=Y.hooks[J.event];if(Z.some((z)=>z.hooks?.some((U)=>G(U.command)===G(J.command)&&(Q.matchAnyMatcher||z.matcher===J.matcher))))return!1;return Z.push({matcher:J.matcher,hooks:[{type:"command",command:J.command}]}),l(q,Y),!0}function $q(q,J){let Q=b(q),Y=Q.hooks?.[J.event];if(!Y)return!1;let Z=Y.flatMap((U,V)=>(U.hooks??[]).flatMap((W,v)=>G(W.command)===G(J.command)?[{matcherIndex:V,hookIndex:v,preferred:U.matcher===J.matcher}]:[]));if(Z.length<2)return!1;let $=Z.find((U)=>U.preferred)??Z[0],z=new Set(Z.filter((U)=>U!==$).map((U)=>`${U.matcherIndex}:${U.hookIndex}`));return Q.hooks[J.event]=Y.map((U,V)=>({...U,hooks:(U.hooks??[]).filter((W,v)=>!z.has(`${V}:${v}`))})).filter((U)=>(U.hooks??[]).length>0),l(q,Q),!0}function Vq(q,J){return(b(q).hooks?.[J.event]??[]).some((Z)=>Z.hooks?.some(($)=>G($.command)===G(J.command)))}function KJ(q,J){let Y=b(q).hooks?.[J.event]??[];for(let Z of Y)for(let $ of Z.hooks??[])if(G($.command)===G(J.command))return $.command;return null}function zq(q,J){let Q=b(q),Y=Q.hooks?.[J.event];if(!Y)return!1;let Z=!1,$=Y.map((z)=>{let U=z.hooks?.length??0,V=(z.hooks??[]).filter((W)=>G(W.command)!==G(J.command));if(V.length!==U)Z=!0;return{...z,hooks:V}}).filter((z)=>(z.hooks??[]).length>0);if(!Z)return!1;if($.length)Q.hooks[J.event]=$;else delete Q.hooks[J.event];if(Q.hooks&&Object.keys(Q.hooks).length===0)delete Q.hooks;return l(q,Q),!0}function Uq(q,J,Q,Y){let Z=`${J}
4
4
  ${Y.trim()}
5
- ${Q}`,$="";try{$=u(q,"utf8")}catch{}let W=new RegExp(`${J}[\\s\\S]*?${Q}`);$=W.test($)?$.replace(W,Z):$.trim()?`${$.trim()}
5
+ ${Q}`,$="";try{$=K(q,"utf8")}catch{}let z=new RegExp(`${J}[\\s\\S]*?${Q}`);$=z.test($)?$.replace(z,Z):$.trim()?`${$.trim()}
6
6
 
7
7
  ${Z}
8
8
  `:`${Z}
9
- `,_(o(q),{recursive:!0}),C(q,$.endsWith(`
9
+ `,p(Qq(q),{recursive:!0}),D(q,$.endsWith(`
10
10
  `)?$:`${$}
11
- `)}function h(q,J){try{return u(q,"utf8").includes(J)}catch{return!1}}function Vq(q,J,Q){let Y="";try{Y=u(q,"utf8")}catch{return!1}let Z=new RegExp(`${J}[\\s\\S]*?${Q}\\n?`);if(!Z.test(Y))return!1;let $=Y.replace(Z,"").replace(/\n{3,}/g,`
11
+ `)}function s(q,J){try{return K(q,"utf8").includes(J)}catch{return!1}}function Wq(q,J,Q){let Y="";try{Y=K(q,"utf8")}catch{return!1}let Z=new RegExp(`${J}[\\s\\S]*?${Q}\\n?`);if(!Z.test(Y))return!1;let $=Y.replace(Z,"").replace(/\n{3,}/g,`
12
12
 
13
- `).trimStart();return C(q,$),!0}function zq(q,J,Q){let Y=X(q,J);_(Y,{recursive:!0});let Z=X(Y,"SKILL.md");return C(Z,Q),Z}function S(q,J){return b(X(q,J,"SKILL.md"))}function Uq(q,J){let Q=X(q,J);if(!b(Q))return!1;return kq(Q,{recursive:!0,force:!0}),!0}var I,n="/Applications/Beacon.app/Contents/Resources/bin/beacon",qq=`## Beacon (visual planning panel)
13
+ `).trimStart();return D(q,$),!0}function Pq(q,J,Q){let Y=w(q,J);p(Y,{recursive:!0});let Z=w(Y,"SKILL.md");return D(Z,Q),Z}function t(q,J){return M(w(q,J,"SKILL.md"))}function Hq(q,J){let Q=w(q,J);if(!M(Q))return!1;return kq(Q,{recursive:!0,force:!0}),!0}var T,Jq="/Applications/Beacon.app/Contents/Resources/bin/beacon",Yq=`## Beacon (visual planning panel)
14
14
 
15
15
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
16
16
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -34,23 +34,23 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
34
34
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
35
35
  on the /map and /db boards (added features, attached subtasks, edited columns, new
36
36
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
37
- verbatim. Do NOT implement until the tool returns approval.`;var p=N(()=>{I=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});var jJ=1500,KJ=480000,NJ=1800000,F=3600000,bJ=3000;var Wq=()=>{};var Xq={};i(Xq,{stripAgentsPointer:()=>Gq,repoMcpCliTarget:()=>lq,removeRepoAssets:()=>dq,installRefreshSkill:()=>Lq,installPlanSkill:()=>yq,installInitSkill:()=>Oq,installExplainSkill:()=>_q,installCodexRepoSkills:()=>Sq,ensureWorkflowDoc:()=>pq,ensureMcp:()=>mq,contextDocTargets:()=>d,auditRepo:()=>sq,REFRESH_SKILL:()=>l,PLAN_SKILL:()=>Pq,INIT_SKILL:()=>m,EXPLAIN_SKILL:()=>vq});import{existsSync as v,mkdirSync as g,readFileSync as G,rmSync as T,writeFileSync as H}from"fs";import{join as V}from"path";function Oq(q){let J=V(q,".claude","skills","beacon-init");g(J,{recursive:!0});let Q=V(J,"SKILL.md");return H(Q,m),Q}function Lq(q){let J=V(q,".claude","skills","beacon-refresh");g(J,{recursive:!0});let Q=V(J,"SKILL.md");return H(Q,l),Q}function yq(q){let J=V(q,".claude","skills","beacon-plan");g(J,{recursive:!0});let Q=V(J,"SKILL.md");return H(Q,Pq),Q}function _q(q){let J=V(q,".claude","skills","beacon-explain");g(J,{recursive:!0});let Q=V(J,"SKILL.md");return H(Q,vq),Q}function Sq(q){let J=[];for(let Q of hq){let Y=V(q,".agents","skills",Q.name);g(Y,{recursive:!0});let Z=V(Y,"SKILL.md");H(Z,Q.body()),J.push(Z)}return J}function d(q){let J=V(q,"AGENTS.md"),Q=V(q,"CLAUDE.md"),Y=v(J),Z=v(Q);if(!Y&&!Z)return[J,Q];let $=[];if(Y)$.push(J);if(Z)$.push(Q);return $}function Gq(q){let J=V(q,"CLAUDE.md");if(!v(J))return;let Q=G(J,"utf8"),Y=Q.split(`
37
+ verbatim. Do NOT implement until the tool returns approval.`;var d=R(()=>{T=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});var gJ=1500,RJ=480000,MJ=1800000,f=3600000,bJ=3000;var vq=()=>{};var jq={};qq(jq,{stripAgentsPointer:()=>wq,repoMcpCliTarget:()=>sq,removeRepoAssets:()=>dq,installRefreshSkill:()=>yq,installPlanSkill:()=>_q,installInitSkill:()=>Iq,installExplainSkill:()=>Sq,installCodexRepoSkills:()=>pq,ensureWorkflowDoc:()=>mq,ensureMcp:()=>lq,contextDocTargets:()=>i,auditRepo:()=>tq,REFRESH_SKILL:()=>c,PLAN_SKILL:()=>Bq,INIT_SKILL:()=>r,EXPLAIN_SKILL:()=>Xq});import{existsSync as B,mkdirSync as A,readFileSync as X,rmSync as k,writeFileSync as H}from"fs";import{join as P}from"path";function Iq(q){let J=P(q,".claude","skills","beacon-init");A(J,{recursive:!0});let Q=P(J,"SKILL.md");return H(Q,r),Q}function yq(q){let J=P(q,".claude","skills","beacon-refresh");A(J,{recursive:!0});let Q=P(J,"SKILL.md");return H(Q,c),Q}function _q(q){let J=P(q,".claude","skills","beacon-plan");A(J,{recursive:!0});let Q=P(J,"SKILL.md");return H(Q,Bq),Q}function Sq(q){let J=P(q,".claude","skills","beacon-explain");A(J,{recursive:!0});let Q=P(J,"SKILL.md");return H(Q,Xq),Q}function pq(q){let J=[];for(let Q of hq){let Y=P(q,".agents","skills",Q.name);A(Y,{recursive:!0});let Z=P(Y,"SKILL.md");H(Z,Q.body()),J.push(Z)}return J}function i(q){let J=P(q,"AGENTS.md"),Q=P(q,"CLAUDE.md"),Y=B(J),Z=B(Q);if(!Y&&!Z)return[J,Q];let $=[];if(Y)$.push(J);if(Z)$.push(Q);return $}function wq(q){let J=P(q,"CLAUDE.md");if(!B(J))return;let Q=X(J,"utf8"),Y=Q.split(`
38
38
  `).filter((Z)=>!/^\s*@\.?\/?AGENTS\.md\s*$/.test(Z)).join(`
39
39
  `).trim();if(Y&&Y!==Q.trim())H(J,`${Y}
40
- `)}function pq(q){let J=new RegExp(`${k}[\\s\\S]*?${s}`);for(let Q of d(q)){let Y="";try{Y=G(Q,"utf8")}catch{}Y=J.test(Y)?Y.replace(J,Hq):`${Y.trim()}
40
+ `)}function mq(q){let J=new RegExp(`${L}[\\s\\S]*?${a}`);for(let Q of i(q)){let Y="";try{Y=X(Q,"utf8")}catch{}Y=J.test(Y)?Y.replace(J,Gq):`${Y.trim()}
41
41
 
42
- ${Hq}
42
+ ${Gq}
43
43
  `.trimStart(),H(Q,Y.endsWith(`
44
44
  `)?Y:`${Y}
45
- `)}Gq(q)}function mq(q){let J=V(q,".mcp.json"),Q={};try{Q=JSON.parse(G(J,"utf8"))}catch{}Q.mcpServers=Q.mcpServers??{};let Y=Q.mcpServers.beacon;if(Y){if(!Y.timeout||Y.timeout<F)return Y.timeout=F,H(J,JSON.stringify(Q,null,2)+`
46
- `),{path:J,added:!1,updated:!0};return{path:J,added:!1,updated:!1}}return Q.mcpServers.beacon={command:x(),args:["mcp"],timeout:F},H(J,JSON.stringify(Q,null,2)+`
47
- `),{path:J,added:!0,updated:!1}}function lq(q){try{return JSON.parse(G(V(q,".mcp.json"),"utf8")).mcpServers?.beacon?.command??null}catch{return null}}function sq(q){let J=V(q,".mcp.json"),Q=!1;try{Q=!!JSON.parse(G(J,"utf8")).mcpServers?.beacon}catch{}let Y=d(q).some((Z)=>{try{return G(Z,"utf8").includes(k)}catch{return!1}});return{repo:q,mcpRegistered:Q,workflowBlock:Y,skills:{"beacon-init":v(V(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v(V(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v(V(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v(V(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function dq(q){let J=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=V(q,".claude","skills",z);if(v(U))T(U,{recursive:!0,force:!0}),J.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=V(q,".agents","skills",z);if(v(U))T(U,{recursive:!0,force:!0}),J.push(`codex:${z}`)}let Q=!1,Y=V(q,".mcp.json");try{let z=JSON.parse(G(Y,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,Q=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)T(Y,{force:!0});else H(Y,JSON.stringify(z,null,2)+`
48
- `)}}catch{}let Z=!1,$=new RegExp(`\\n?${k}[\\s\\S]*?${s}\\n?`);for(let z of[V(q,"AGENTS.md"),V(q,"CLAUDE.md")])try{let U=G(z,"utf8");if($.test(U)){let y=U.replace($,`
45
+ `)}wq(q)}function lq(q){let J=P(q,".mcp.json"),Q={};try{Q=JSON.parse(X(J,"utf8"))}catch{}Q.mcpServers=Q.mcpServers??{};let Y=Q.mcpServers.beacon;if(Y){if(!Y.timeout||Y.timeout<f)return Y.timeout=f,H(J,JSON.stringify(Q,null,2)+`
46
+ `),{path:J,added:!1,updated:!0};return{path:J,added:!1,updated:!1}}return Q.mcpServers.beacon={command:u(),args:["mcp"],timeout:f},H(J,JSON.stringify(Q,null,2)+`
47
+ `),{path:J,added:!0,updated:!1}}function sq(q){try{return JSON.parse(X(P(q,".mcp.json"),"utf8")).mcpServers?.beacon?.command??null}catch{return null}}function tq(q){let J=P(q,".mcp.json"),Q=!1;try{Q=!!JSON.parse(X(J,"utf8")).mcpServers?.beacon}catch{}let Y=i(q).some((Z)=>{try{return X(Z,"utf8").includes(L)}catch{return!1}});return{repo:q,mcpRegistered:Q,workflowBlock:Y,skills:{"beacon-init":B(P(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":B(P(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":B(P(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":B(P(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function dq(q){let J=[];for(let V of["beacon-init","beacon-refresh","beacon-db-design"]){let W=P(q,".claude","skills",V);if(B(W))k(W,{recursive:!0,force:!0}),J.push(V)}for(let V of["beacon-init","beacon-refresh"]){let W=P(q,".agents","skills",V);if(B(W))k(W,{recursive:!0,force:!0}),J.push(`codex:${V}`)}let Q=!1,Y=P(q,".mcp.json");try{let V=JSON.parse(X(Y,"utf8"));if(V.mcpServers?.beacon){if(delete V.mcpServers.beacon,Q=!0,V.mcpServers&&Object.keys(V.mcpServers).length===0)delete V.mcpServers;if(Object.keys(V).length===0)k(Y,{force:!0});else H(Y,JSON.stringify(V,null,2)+`
48
+ `)}}catch{}let Z=!1,$=new RegExp(`\\n?${L}[\\s\\S]*?${a}\\n?`);for(let V of[P(q,"AGENTS.md"),P(q,"CLAUDE.md")])try{let W=X(V,"utf8");if($.test(W)){let v=W.replace($,`
49
49
  `).replace(/\n{3,}/g,`
50
50
 
51
- `).trimStart();H(z,y.endsWith(`
52
- `)?y:`${y}
53
- `),Z=!0}}catch{}let W=!1,P=V(q,"CLAUDE.md");try{let z=G(P,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())T(P,{force:!0});else H(P,U);W=!0}}catch{}return{skillsRemoved:J,mcpUnregistered:Q,agentsBlockRemoved:Z,claudeImportRemoved:W}}var m=`---
51
+ `).trimStart();H(V,v.endsWith(`
52
+ `)?v:`${v}
53
+ `),Z=!0}}catch{}let z=!1,U=P(q,"CLAUDE.md");try{let V=X(U,"utf8"),W=V.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(W!==V){if(!W.trim())k(U,{force:!0});else H(U,W);z=!0}}catch{}return{skillsRemoved:J,mcpUnregistered:Q,agentsBlockRemoved:Z,claudeImportRemoved:z}}var r=`---
54
54
  name: beacon-init
55
55
  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.
56
56
  ---
@@ -97,7 +97,7 @@ beacon init-persist /tmp/beacon-init.json # or: beacon init-persist < /tmp/bea
97
97
  That one command wires the repo (writes \`.mcp.json\` + skills so your NEXT session gets the \`beacon_*\` tools natively, heals the global install), starts the Beacon daemon if it isn't running, registers + provisions this workspace, and POSTs your analysis to the same \`/api/init\` endpoint the MCP tool uses \u2014 so init completes in THIS session. Read the counts it prints and report them.
98
98
 
99
99
  After the tool (or \`beacon init-persist\`) returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
100
- `,l=`---
100
+ `,c=`---
101
101
  name: beacon-refresh
102
102
  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.
103
103
  ---
@@ -144,7 +144,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
144
144
  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.
145
145
 
146
146
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
147
- `,Pq=`---
147
+ `,Bq=`---
148
148
  name: beacon-plan
149
149
  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.
150
150
  ---
@@ -193,7 +193,7 @@ If it returns feedback, revise and call it again.
193
193
  If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
194
194
  with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
195
195
  run \`beacon\` in this repo once.
196
- `,vq=`---
196
+ `,Xq=`---
197
197
  name: beacon-explain
198
198
  description: Teach the user part of THIS codebase as an interactive visual lesson on Beacon's /learn page \u2014 a concept map + plain-English narrative they can question \u2014 instead of a wall of text. Use when the user says "explain", "teach me", "walk me through", "how does X work", or "help me understand the Y category".
199
199
  ---
@@ -263,7 +263,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
263
263
  Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
264
264
  the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
265
265
  the lesson.
266
- `,hq,k="<!-- beacon:workflow:start -->",s="<!-- beacon:workflow:end -->",Hq;var Bq=N(()=>{p();Wq();hq=[{name:"beacon-init",body:()=>m},{name:"beacon-refresh",body:()=>l}];Hq=`${k}
266
+ `,hq,L="<!-- beacon:workflow:start -->",a="<!-- beacon:workflow:end -->",Gq;var uq=R(()=>{d();vq();hq=[{name:"beacon-init",body:()=>r},{name:"beacon-refresh",body:()=>c}];Gq=`${L}
267
267
  ## Beacon \u2014 feature workflow
268
268
 
269
269
  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:
@@ -335,18 +335,20 @@ Register them all in that single batched call. If a plan added five features, th
335
335
  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.
336
336
 
337
337
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
338
- ${s}`});import{mkdirSync as tq,renameSync as cq,rmSync as aq,writeFileSync as rq}from"fs";import{dirname as iq}from"path";function D(q,J){tq(iq(q),{recursive:!0});let Q=`${q}.tmp`;try{rq(Q,J),cq(Q,q)}catch(Y){throw aq(Q,{force:!0}),Y}}function TJ(q,J,Q=!1){D(q,JSON.stringify(J,null,Q?2:void 0))}var wq=()=>{};var UJ={};i(UJ,{setupCodexAssets:()=>$J,removeCodexMcp:()=>Cq,removeCodexArtifacts:()=>zJ,parseTomlBeacon:()=>Mq,nodeWhich:()=>jq,hasCodexMcp:()=>r,ensureCodexMcp:()=>Rq,commandExists:()=>Kq,codexMcpProblem:()=>YJ,codexMcpCliTarget:()=>ZJ,codexDetected:()=>Nq,auditCodex:()=>VJ,CODEX_HOOKS:()=>L});import{accessSync as nq,constants as oq,readFileSync as R}from"fs";import{homedir as eq}from"os";import{delimiter as qJ,join as K}from"path";function uq(){return process.env.HOME||process.env.USERPROFILE||eq()}function jq(q,J=process.env.PATH||"",Q=JJ){if(!q)return null;for(let Y of J.split(qJ)){if(!Y)continue;let Z=K(Y,q);if(Q(Z))return Z}return null}function JJ(q){try{return nq(q,oq.X_OK),!0}catch{return!1}}function Kq(q){if(typeof Bun<"u"&&typeof Bun.which==="function")return Bun.which(q)!==null;return jq(q)!==null}function Nq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(t===void 0)t=Kq("codex");return t}function Mq(q){let J={},Q=!1;for(let Y of q.split(`
339
- `)){let Z=Y.trim();if(!Z||Z.startsWith("#"))continue;let $=/^\[([^\]]+)\]/.exec(Z);if($){if(Q=$[1].trim()==="mcp_servers.beacon",Q)J.mcp_servers=J.mcp_servers??{},J.mcp_servers.beacon=J.mcp_servers.beacon??{};continue}if(Q){let W=/^command\s*=\s*["']([^"']*)["']/.exec(Z);if(W)J.mcp_servers.beacon.command=W[1]}}return J}function j(q){try{if(typeof Bun<"u"&&Bun.TOML?.parse)return Bun.TOML.parse(q);return Mq(q)}catch{return null}}function r(){try{return Boolean(j(R(w(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function YJ(){let q="";try{q=R(w(),"utf8")}catch{return null}let J=j(q);if(!J)return`~/.codex/config.toml does not parse \u2014 ${M}`;if(J.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${M}`;return null}function Rq(){let q="",J=!1;try{q=R(w(),"utf8"),J=!0}catch{}if(J){let $=j(q);if(!$)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${M}`};if($.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 ${M}`}}let Q=!q?"":q.endsWith(`
338
+ ${a}`});import{mkdirSync as rq,renameSync as cq,rmSync as aq,writeFileSync as iq}from"fs";import{dirname as oq}from"path";function F(q,J){rq(oq(q),{recursive:!0});let Q=`${q}.tmp`;try{iq(Q,J),cq(Q,q)}catch(Y){throw aq(Q,{force:!0}),Y}}function kJ(q,J,Q=!1){F(q,JSON.stringify(J,null,Q?2:void 0))}var Kq=()=>{};var PJ={};qq(PJ,{setupCodexAssets:()=>zJ,removeCodexMcp:()=>Cq,removeCodexArtifacts:()=>WJ,parseTomlBeacon:()=>Aq,nodeWhich:()=>Rq,hasCodexMcp:()=>e,ensureCodexMcp:()=>Fq,commandExists:()=>Mq,codexMcpProblem:()=>ZJ,codexMcpCliTarget:()=>VJ,codexDetected:()=>bq,auditCodex:()=>UJ,CODEX_HOOKS:()=>h});import{accessSync as nq,constants as eq,readFileSync as x}from"fs";import{homedir as qJ}from"os";import{delimiter as JJ,join as g}from"path";function Nq(){return process.env.HOME||process.env.USERPROFILE||qJ()}function Rq(q,J=process.env.PATH||"",Q=QJ){if(!q)return null;for(let Y of J.split(JJ)){if(!Y)continue;let Z=g(Y,q);if(Q(Z))return Z}return null}function QJ(q){try{return nq(q,eq.X_OK),!0}catch{return!1}}function Mq(q){if(typeof Bun<"u"&&typeof Bun.which==="function")return Bun.which(q)!==null;return Rq(q)!==null}function bq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(o===void 0)o=Mq("codex");return o}function Aq(q){let J={},Q=!1;for(let Y of q.split(`
339
+ `)){let Z=Y.trim();if(!Z||Z.startsWith("#"))continue;let $=/^\[([^\]]+)\]/.exec(Z);if($){if(Q=$[1].trim()==="mcp_servers.beacon",Q)J.mcp_servers=J.mcp_servers??{},J.mcp_servers.beacon=J.mcp_servers.beacon??{};continue}if(Q){let z=/^command\s*=\s*["']([^"']*)["']/.exec(Z);if(z)J.mcp_servers.beacon.command=z[1]}}return J}function N(q){try{if(typeof Bun<"u"&&Bun.TOML?.parse)return Bun.TOML.parse(q);return Aq(q)}catch{return null}}function e(){try{return Boolean(N(x(j(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function ZJ(){let q="";try{q=x(j(),"utf8")}catch{return null}let J=N(q);if(!J)return`~/.codex/config.toml does not parse \u2014 ${C}`;if(J.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${C}`;return null}function $J(q){let J=q.split(`
340
+ `),Q=J.indexOf(_),Y=J.indexOf(S,Q);if(Q===-1||Y===-1)return null;let Z=J.findIndex((U,V)=>V>Q&&V<Y&&U.trim()==="[mcp_servers.beacon]");if(Z===-1)return null;let $=Z+1;while($<Y&&!/^\s*\[/.test(J[$]))$++;let z=J.findIndex((U,V)=>V>Z&&V<$&&/^\s*command\s*=/.test(U));if(z===-1)return null;return J[z]=`command = ${JSON.stringify(u())}`,J.join(`
341
+ `)}function Fq(){let q="",J=!1;try{q=x(j(),"utf8"),J=!0}catch{}if(J){let $=N(q);if(!$)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${C}`};if($.mcp_servers?.beacon){let z=$J(q);if(z&&z!==q)F(j(),z);return{added:!1}}if(/^\s*mcp_servers\s*=/m.test(q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${C}`}}let Q=!q?"":q.endsWith(`
340
342
  `)?`
341
343
  `:`
342
344
 
343
- `,Y=q+Q+QJ();if(j(Y)?.mcp_servers?.beacon?.command!==x())return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${M}`};return D(w(),Y),{added:!0}}function ZJ(){try{return j(R(w(),"utf8"))?.mcp_servers?.beacon?.command??null}catch{return null}}function Cq(){let q="";try{q=R(w(),"utf8")}catch{return{removed:!1}}let J=q.split(`
344
- `),Q=J.indexOf(bq);if(Q===-1)return{removed:!1,skipped:r()};let Y=J.indexOf(gq,Q);if(Y===-1)return{removed:!1,skipped:!0};J.splice(Q,Y-Q+1);let Z=J.join(`
345
+ `,Y=q+Q+YJ();if(N(Y)?.mcp_servers?.beacon?.command!==u())return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${C}`};return F(j(),Y),{added:!0}}function VJ(){try{return N(x(j(),"utf8"))?.mcp_servers?.beacon?.command??null}catch{return null}}function Cq(){let q="";try{q=x(j(),"utf8")}catch{return{removed:!1}}let J=q.split(`
346
+ `),Q=J.indexOf(_);if(Q===-1)return{removed:!1,skipped:e()};let Y=J.indexOf(S,Q);if(Y===-1)return{removed:!1,skipped:!0};let Z=J.findIndex((U,V)=>V>Q&&V<Y&&U.trim()==="[mcp_servers.beacon]");if(Z===-1)return{removed:!1,skipped:!0};let $=Z+1;while($<Y&&!/^\s*\[/.test(J[$]))$++;J.splice(Z,$-Z),J.splice(J.indexOf(S),1),J.splice(J.indexOf(_),1);let z=J.join(`
345
347
  `).replace(/\n{3,}/g,`
346
348
 
347
- `).replace(/^\n+/,"");if(j(Z)===null)return{removed:!1,skipped:!0};return D(w(),Z),{removed:!0}}async function $J(){let{INIT_SKILL:q,REFRESH_SKILL:J,PLAN_SKILL:Q,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (Bq(),Xq)),Z={"beacon-init":q,"beacon-refresh":J,"beacon-plan":Q,"beacon-explain":Y},$=[];for(let U of I){if(!S(E(),U))$.push(U);zq(E(),U,Z[U])}let W=0;for(let U of L)if(Qq(a(),{event:U.event,matcher:U.matcher,command:e(U.command)}))W++;let P=h(f(),O);$q(f(),O,xq,qq);let z=Rq();return{skillsAdded:$,hooksAdded:W,agentsMdBlockTouched:!P,mcp:z}}function VJ(){let q={};for(let Q of I)q[Q]=S(E(),Q);let J={};for(let Q of L)J[Q.event]=Yq(a(),{event:Q.event,command:Q.command});return{detected:Nq(),skills:q,hooks:J,agentsMdBlock:h(f(),O),mcp:r()}}function zJ(){let q=[];for(let Z of I)if(Uq(E(),Z))q.push(Z);let J=0;for(let Z of L)if(Zq(a(),{event:Z.event,command:Z.command}))J++;let Q=Vq(f(),O,xq),Y=Cq();return{skillsRemoved:q,hooksRemoved:J,agentsMdBlockRemoved:Q,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var c=()=>K(uq(),".codex"),a=()=>K(c(),"hooks.json"),w=()=>K(c(),"config.toml"),f=()=>K(c(),"AGENTS.md"),E=()=>K(uq(),".agents","skills"),O="<!-- beacon:global:start -->",xq="<!-- beacon:global:end -->",L,t,bq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",gq="# beacon:end",QJ=()=>`${bq}
349
+ `).replace(/^\n+/,"");if(N(z)===null)return{removed:!1,skipped:!0};return F(j(),z),{removed:!0}}async function zJ(){let{INIT_SKILL:q,REFRESH_SKILL:J,PLAN_SKILL:Q,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (uq(),jq)),Z={"beacon-init":q,"beacon-refresh":J,"beacon-plan":Q,"beacon-explain":Y},$=[];for(let W of T){if(!t(I(),W))$.push(W);Pq(I(),W,Z[W])}let z=0;for(let W of h){let v=W.event==="UserPromptSubmit"||W.event==="Stop";if(v)$q(O(),{event:W.event,matcher:W.matcher,command:m(W.command)});if(Zq(O(),{event:W.event,matcher:W.matcher,command:m(W.command)},{matchAnyMatcher:v}))z++}let U=s(E(),y);Uq(E(),y,gq,Yq);let V=Fq();return{skillsAdded:$,hooksAdded:z,agentsMdBlockTouched:!U,mcp:V}}function UJ(){let q={};for(let Q of T)q[Q]=t(I(),Q);let J={};for(let Q of h)J[Q.event]=Vq(O(),{event:Q.event,command:Q.command});return{detected:bq(),skills:q,hooks:J,agentsMdBlock:s(E(),y),mcp:e()}}function WJ(){let q=[];for(let Z of T)if(Hq(I(),Z))q.push(Z);let J=0;for(let Z of h)if(zq(O(),{event:Z.event,command:Z.command}))J++;let Q=Wq(E(),y,gq),Y=Cq();return{skillsRemoved:q,hooksRemoved:J,agentsMdBlockRemoved:Q,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var n=()=>g(Nq(),".codex"),O=()=>g(n(),"hooks.json"),j=()=>g(n(),"config.toml"),E=()=>g(n(),"AGENTS.md"),I=()=>g(Nq(),".agents","skills"),y="<!-- beacon:global:start -->",gq="<!-- beacon:global:end -->",h,o,_="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",S="# beacon:end",YJ=()=>`${_}
348
350
  [mcp_servers.beacon]
349
- command = "${x()}"
351
+ command = "${u()}"
350
352
  args = ["mcp"]
351
- ${gq}
352
- `,M="add it manually: codex mcp add beacon -- beacon mcp";var WJ=N(()=>{p();wq();L=[{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."}]});WJ();export{$J as setupCodexAssets,Cq as removeCodexMcp,zJ as removeCodexArtifacts,Mq as parseTomlBeacon,jq as nodeWhich,r as hasCodexMcp,Rq as ensureCodexMcp,Kq as commandExists,YJ as codexMcpProblem,ZJ as codexMcpCliTarget,Nq as codexDetected,VJ as auditCodex,L as CODEX_HOOKS};
353
+ ${S}
354
+ `,C="add it manually: codex mcp add beacon -- beacon mcp";var HJ=R(()=>{d();Kq();h=[{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."}]});HJ();export{zJ as setupCodexAssets,Cq as removeCodexMcp,WJ as removeCodexArtifacts,Aq as parseTomlBeacon,Rq as nodeWhich,e as hasCodexMcp,Fq as ensureCodexMcp,Mq as commandExists,ZJ as codexMcpProblem,VJ as codexMcpCliTarget,bq as codexDetected,UJ as auditCodex,h as CODEX_HOOKS};
@@ -1,16 +1,16 @@
1
1
  // @bun
2
- var L=Object.defineProperty;var H=(q)=>q;function I(q,G){this[q]=H.bind(null,G)}var F=(q,G)=>{for(var J in G)L(q,J,{get:G[J],enumerable:!0,configurable:!0,set:I.bind(G,J)})};var _=(q,G)=>()=>(q&&(G=q(q=0)),G);import{existsSync as W,mkdirSync as K,readdirSync as v,readFileSync as V,rmSync as w,writeFileSync as Z}from"fs";import{basename as j,dirname as A,join as T}from"path";function k(){return!!process.env.CLAUDE_PLUGIN_ROOT}function x(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;let G=T(q,".claude","plugins");if(!W(G))return null;let J=[G];for(let O=0;O<3&&J.length;O++){let Q=[];for(let N of J){let R=T(N,".claude-plugin","plugin.json");try{if(W(R)&&JSON.parse(V(R,"utf8")).name==="beacon")return N}catch{}try{for(let X of v(N,{withFileTypes:!0}))if(X.isDirectory())Q.push(T(N,X.name))}catch{}}J=Q}return null}function y(q){return x(q)!==null}function h(q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(q)}function z(){let q=process.env.BEACON_CLI_PATH;if(q)return q;if(W(Y))return Y;return"beacon"}function E(q){let G=q.indexOf(" ");return G===-1?q:q.slice(0,G)}function f(q){let G=z();if(G==="beacon")return q;return q.replace(/^beacon(\s|$)/,`${G}$1`)}function U(q){let G=E(q);return j(G)+q.slice(G.length)}function p(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;try{let G=JSON.parse(V(T(q,".claude","plugins","installed_plugins.json"),"utf8"));for(let J of Object.keys(G.plugins??{}))if(/^beacon@/.test(J))return{key:J,marketplace:J.split("@")[1]??""}}catch{}return null}function $(q){try{return JSON.parse(V(q,"utf8"))}catch{return{}}}function M(q,G){K(A(q),{recursive:!0}),Z(q,JSON.stringify(G,null,2)+`
3
- `)}function r(q,G){let J=$(q);J.hooks=J.hooks??{},J.hooks[G.event]=J.hooks[G.event]??[];let O=J.hooks[G.event];if(O.some((N)=>N.matcher===G.matcher&&N.hooks?.some((R)=>U(R.command)===U(G.command))))return!1;return O.push({matcher:G.matcher,hooks:[{type:"command",command:G.command}]}),M(q,J),!0}function s(q,G){return($(q).hooks?.[G.event]??[]).some((Q)=>Q.hooks?.some((N)=>U(N.command)===U(G.command)))}function l(q,G){let O=$(q).hooks?.[G.event]??[];for(let Q of O)for(let N of Q.hooks??[])if(U(N.command)===U(G.command))return N.command;return null}function a(q,G){let J=$(q),O=J.hooks?.[G.event];if(!O)return!1;let Q=!1,N=O.map((R)=>{let X=R.hooks?.length??0,u=(R.hooks??[]).filter((B)=>U(B.command)!==U(G.command));if(u.length!==X)Q=!0;return{...R,hooks:u}}).filter((R)=>(R.hooks??[]).length>0);if(!Q)return!1;if(N.length)J.hooks[G.event]=N;else delete J.hooks[G.event];if(J.hooks&&Object.keys(J.hooks).length===0)delete J.hooks;return M(q,J),!0}function c(q,G,J,O){let Q=`${G}
4
- ${O.trim()}
5
- ${J}`,N="";try{N=V(q,"utf8")}catch{}let R=new RegExp(`${G}[\\s\\S]*?${J}`);N=R.test(N)?N.replace(R,Q):N.trim()?`${N.trim()}
2
+ var _=Object.defineProperty;var v=(q)=>q;function j(q,G){this[q]=v.bind(null,G)}var C=(q,G)=>{for(var J in G)_(q,J,{get:G[J],enumerable:!0,configurable:!0,set:j.bind(G,J)})};var w=(q,G)=>()=>(q&&(G=q(q=0)),G);import{existsSync as Y,mkdirSync as M,readdirSync as H,readFileSync as X,rmSync as E,writeFileSync as u}from"fs";import{basename as P,dirname as B,join as V}from"path";function y(){return!!process.env.CLAUDE_PLUGIN_ROOT}function z(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;let G=V(q,".claude","plugins");if(!Y(G))return null;let J=[G];for(let N=0;N<3&&J.length;N++){let O=[];for(let Q of J){let T=V(Q,".claude-plugin","plugin.json");try{if(Y(T)&&JSON.parse(X(T,"utf8")).name==="beacon")return Q}catch{}try{for(let R of H(Q,{withFileTypes:!0}))if(R.isDirectory())O.push(V(Q,R.name))}catch{}}J=O}return null}function f(q){return z(q)!==null}function p(q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(q)}function F(){let q=process.env.BEACON_CLI_PATH;if(q)return q;if(Y(K))return K;return"beacon"}function I(q){let G=q.indexOf(" ");return G===-1?q:q.slice(0,G)}function h(q){let G=F();if(G==="beacon")return q;return q.replace(/^beacon(\s|$)/,`${G}$1`)}function U(q){let G=I(q);return P(G)+q.slice(G.length)}function t(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;try{let G=JSON.parse(X(V(q,".claude","plugins","installed_plugins.json"),"utf8"));for(let J of Object.keys(G.plugins??{}))if(/^beacon@/.test(J))return{key:J,marketplace:J.split("@")[1]??""}}catch{}return null}function Z(q){try{return JSON.parse(X(q,"utf8"))}catch{return{}}}function g(q,G){M(B(q),{recursive:!0}),u(q,JSON.stringify(G,null,2)+`
3
+ `)}function s(q,G,J={}){let N=Z(q);N.hooks=N.hooks??{},N.hooks[G.event]=N.hooks[G.event]??[];let O=N.hooks[G.event];if(O.some((T)=>T.hooks?.some((R)=>U(R.command)===U(G.command)&&(J.matchAnyMatcher||T.matcher===G.matcher))))return!1;return O.push({matcher:G.matcher,hooks:[{type:"command",command:G.command}]}),g(q,N),!0}function r(q,G){let J=Z(q),N=J.hooks?.[G.event];if(!N)return!1;let O=N.flatMap((R,W)=>(R.hooks??[]).flatMap(($,A)=>U($.command)===U(G.command)?[{matcherIndex:W,hookIndex:A,preferred:R.matcher===G.matcher}]:[]));if(O.length<2)return!1;let Q=O.find((R)=>R.preferred)??O[0],T=new Set(O.filter((R)=>R!==Q).map((R)=>`${R.matcherIndex}:${R.hookIndex}`));return J.hooks[G.event]=N.map((R,W)=>({...R,hooks:(R.hooks??[]).filter(($,A)=>!T.has(`${W}:${A}`))})).filter((R)=>(R.hooks??[]).length>0),g(q,J),!0}function n(q,G){return(Z(q).hooks?.[G.event]??[]).some((O)=>O.hooks?.some((Q)=>U(Q.command)===U(G.command)))}function d(q,G){let N=Z(q).hooks?.[G.event]??[];for(let O of N)for(let Q of O.hooks??[])if(U(Q.command)===U(G.command))return Q.command;return null}function a(q,G){let J=Z(q),N=J.hooks?.[G.event];if(!N)return!1;let O=!1,Q=N.map((T)=>{let R=T.hooks?.length??0,W=(T.hooks??[]).filter(($)=>U($.command)!==U(G.command));if(W.length!==R)O=!0;return{...T,hooks:W}}).filter((T)=>(T.hooks??[]).length>0);if(!O)return!1;if(Q.length)J.hooks[G.event]=Q;else delete J.hooks[G.event];if(J.hooks&&Object.keys(J.hooks).length===0)delete J.hooks;return g(q,J),!0}function i(q,G,J,N){let O=`${G}
4
+ ${N.trim()}
5
+ ${J}`,Q="";try{Q=X(q,"utf8")}catch{}let T=new RegExp(`${G}[\\s\\S]*?${J}`);Q=T.test(Q)?Q.replace(T,O):Q.trim()?`${Q.trim()}
6
6
 
7
- ${Q}
8
- `:`${Q}
9
- `,K(A(q),{recursive:!0}),Z(q,N.endsWith(`
10
- `)?N:`${N}
11
- `)}function n(q,G){try{return V(q,"utf8").includes(G)}catch{return!1}}function d(q,G,J){let O="";try{O=V(q,"utf8")}catch{return!1}let Q=new RegExp(`${G}[\\s\\S]*?${J}\\n?`);if(!Q.test(O))return!1;let N=O.replace(Q,"").replace(/\n{3,}/g,`
7
+ ${O}
8
+ `:`${O}
9
+ `,M(B(q),{recursive:!0}),u(q,Q.endsWith(`
10
+ `)?Q:`${Q}
11
+ `)}function o(q,G){try{return X(q,"utf8").includes(G)}catch{return!1}}function c(q,G,J){let N="";try{N=X(q,"utf8")}catch{return!1}let O=new RegExp(`${G}[\\s\\S]*?${J}\\n?`);if(!O.test(N))return!1;let Q=N.replace(O,"").replace(/\n{3,}/g,`
12
12
 
13
- `).trimStart();return Z(q,N),!0}function o(q,G,J){let O=T(q,G);K(O,{recursive:!0});let Q=T(O,"SKILL.md");return Z(Q,J),Q}function m(q,G){return W(T(q,G,"SKILL.md"))}function i(q,G){let J=T(q,G);if(!W(J))return!1;return w(J,{recursive:!0,force:!0}),!0}var S,Y="/Applications/Beacon.app/Contents/Resources/bin/beacon",t=`## Beacon (visual planning panel)
13
+ `).trimStart();return u(q,Q),!0}function m(q,G,J){let N=V(q,G);M(N,{recursive:!0});let O=V(N,"SKILL.md");return u(O,J),O}function e(q,G){return Y(V(q,G,"SKILL.md"))}function qq(q,G){let J=V(q,G);if(!Y(J))return!1;return E(J,{recursive:!0,force:!0}),!0}var k,K="/Applications/Beacon.app/Contents/Resources/bin/beacon",l=`## Beacon (visual planning panel)
14
14
 
15
15
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
16
16
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -34,4 +34,4 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
34
34
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
35
35
  on the /map and /db boards (added features, attached subtasks, edited columns, new
36
36
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
37
- verbatim. Do NOT implement until the tool returns approval.`;var g=_(()=>{S=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});g();import{existsSync as P}from"fs";function Jq(q=Y){return P(q)}function Nq({healthy:q,appInstalled:G}){if(q)return"reuse";if(G)return"app";return"bun"}function Oq({present:q,alive:G,healthy:J}){return q&&G&&J?"reuse":"spawn"}export{Jq as desktopAppInstalled,Oq as decideDaemonRecheck,Nq as decideDaemonBoot};
37
+ verbatim. Do NOT implement until the tool returns approval.`;var L=w(()=>{k=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});L();import{existsSync as b}from"fs";function Oq(q=K){return b(q)}function Qq({healthy:q,appInstalled:G}){if(q)return"reuse";if(G)return"app";return"bun"}function Rq({present:q,alive:G,healthy:J}){return q&&G&&J?"reuse":"spawn"}export{Oq as desktopAppInstalled,Rq as decideDaemonRecheck,Qq as decideDaemonBoot};
@@ -1,16 +1,16 @@
1
1
  // @bun
2
- var cq=Object.defineProperty;var dq=(q)=>q;function sq(q,J){this[q]=dq.bind(null,J)}var xq=(q,J)=>{for(var Q in J)cq(q,Q,{get:J[Q],enumerable:!0,configurable:!0,set:sq.bind(J,Q)})};var u=(q,J)=>()=>(q&&(J=q(q=0)),J);import{existsSync as M,mkdirSync as e,readdirSync as rq,readFileSync as N,rmSync as lq,writeFileSync as C}from"fs";import{basename as aq,dirname as Gq,join as v}from"path";function Bq(){return!!process.env.CLAUDE_PLUGIN_ROOT}function Nq(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;let J=v(q,".claude","plugins");if(!M(J))return null;let Q=[J];for(let Y=0;Y<3&&Q.length;Y++){let Z=[];for(let $ of Q){let W=v($,".claude-plugin","plugin.json");try{if(M(W)&&JSON.parse(N(W,"utf8")).name==="beacon")return $}catch{}try{for(let X of rq($,{withFileTypes:!0}))if(X.isDirectory())Z.push(v($,X.name))}catch{}}Q=Z}return null}function Kq(q){return Nq(q)!==null}function iq(q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(q)}function G(){let q=process.env.BEACON_CLI_PATH;if(q)return q;if(M(jq))return jq;return"beacon"}function qq(q){let J=q.indexOf(" ");return J===-1?q:q.slice(0,J)}function O(q){let J=G();if(J==="beacon")return q;return q.replace(/^beacon(\s|$)/,`${J}$1`)}function x(q){let J=qq(q);return aq(J)+q.slice(J.length)}function nq(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;try{let J=JSON.parse(N(v(q,".claude","plugins","installed_plugins.json"),"utf8"));for(let Q of Object.keys(J.plugins??{}))if(/^beacon@/.test(Q))return{key:Q,marketplace:Q.split("@")[1]??""}}catch{}return null}function A(q){try{return JSON.parse(N(q,"utf8"))}catch{return{}}}function gq(q,J){e(Gq(q),{recursive:!0}),C(q,JSON.stringify(J,null,2)+`
3
- `)}function D(q,J){let Q=A(q);Q.hooks=Q.hooks??{},Q.hooks[J.event]=Q.hooks[J.event]??[];let Y=Q.hooks[J.event];if(Y.some(($)=>$.matcher===J.matcher&&$.hooks?.some((W)=>x(W.command)===x(J.command))))return!1;return Y.push({matcher:J.matcher,hooks:[{type:"command",command:J.command}]}),gq(q,Q),!0}function y(q,J){return(A(q).hooks?.[J.event]??[]).some((Z)=>Z.hooks?.some(($)=>x($.command)===x(J.command)))}function uq(q,J){let Y=A(q).hooks?.[J.event]??[];for(let Z of Y)for(let $ of Z.hooks??[])if(x($.command)===x(J.command))return $.command;return null}function E(q,J){let Q=A(q),Y=Q.hooks?.[J.event];if(!Y)return!1;let Z=!1,$=Y.map((W)=>{let X=W.hooks?.length??0,V=(W.hooks??[]).filter((U)=>x(U.command)!==x(J.command));if(V.length!==X)Z=!0;return{...W,hooks:V}}).filter((W)=>(W.hooks??[]).length>0);if(!Z)return!1;if($.length)Q.hooks[J.event]=$;else delete Q.hooks[J.event];if(Q.hooks&&Object.keys(Q.hooks).length===0)delete Q.hooks;return gq(q,Q),!0}function k(q,J,Q,Y){let Z=`${J}
2
+ var rq=Object.defineProperty;var lq=(q)=>q;function cq(q,J){this[q]=lq.bind(null,J)}var Nq=(q,J)=>{for(var Q in J)rq(q,Q,{get:J[Q],enumerable:!0,configurable:!0,set:cq.bind(J,Q)})};var F=(q,J)=>()=>(q&&(J=q(q=0)),J);import{existsSync as x,mkdirSync as Qq,readdirSync as dq,readFileSync as g,rmSync as aq,writeFileSync as D}from"fs";import{basename as iq,dirname as gq,join as G}from"path";function uq(){return!!process.env.CLAUDE_PLUGIN_ROOT}function Rq(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;let J=G(q,".claude","plugins");if(!x(J))return null;let Q=[J];for(let Y=0;Y<3&&Q.length;Y++){let Z=[];for(let $ of Q){let z=G($,".claude-plugin","plugin.json");try{if(x(z)&&JSON.parse(g(z,"utf8")).name==="beacon")return $}catch{}try{for(let W of dq($,{withFileTypes:!0}))if(W.isDirectory())Z.push(G($,W.name))}catch{}}Q=Z}return null}function Fq(q){return Rq(q)!==null}function nq(q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(q)}function N(){let q=process.env.BEACON_CLI_PATH;if(q)return q;if(x(Kq))return Kq;return"beacon"}function Yq(q){let J=q.indexOf(" ");return J===-1?q:q.slice(0,J)}function M(q){let J=N();if(J==="beacon")return q;return q.replace(/^beacon(\s|$)/,`${J}$1`)}function w(q){let J=Yq(q);return iq(J)+q.slice(J.length)}function oq(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;try{let J=JSON.parse(g(G(q,".claude","plugins","installed_plugins.json"),"utf8"));for(let Q of Object.keys(J.plugins??{}))if(/^beacon@/.test(Q))return{key:Q,marketplace:Q.split("@")[1]??""}}catch{}return null}function f(q){try{return JSON.parse(g(q,"utf8"))}catch{return{}}}function Zq(q,J){Qq(gq(q),{recursive:!0}),D(q,JSON.stringify(J,null,2)+`
3
+ `)}function E(q,J,Q={}){let Y=f(q);Y.hooks=Y.hooks??{},Y.hooks[J.event]=Y.hooks[J.event]??[];let Z=Y.hooks[J.event];if(Z.some((z)=>z.hooks?.some((W)=>w(W.command)===w(J.command)&&(Q.matchAnyMatcher||z.matcher===J.matcher))))return!1;return Z.push({matcher:J.matcher,hooks:[{type:"command",command:J.command}]}),Zq(q,Y),!0}function xq(q,J){let Q=f(q),Y=Q.hooks?.[J.event];if(!Y)return!1;let Z=Y.flatMap((W,V)=>(W.hooks??[]).flatMap((U,H)=>w(U.command)===w(J.command)?[{matcherIndex:V,hookIndex:H,preferred:W.matcher===J.matcher}]:[]));if(Z.length<2)return!1;let $=Z.find((W)=>W.preferred)??Z[0],z=new Set(Z.filter((W)=>W!==$).map((W)=>`${W.matcherIndex}:${W.hookIndex}`));return Q.hooks[J.event]=Y.map((W,V)=>({...W,hooks:(W.hooks??[]).filter((U,H)=>!z.has(`${V}:${H}`))})).filter((W)=>(W.hooks??[]).length>0),Zq(q,Q),!0}function I(q,J){return(f(q).hooks?.[J.event]??[]).some((Z)=>Z.hooks?.some(($)=>w($.command)===w(J.command)))}function Mq(q,J){let Y=f(q).hooks?.[J.event]??[];for(let Z of Y)for(let $ of Z.hooks??[])if(w($.command)===w(J.command))return $.command;return null}function L(q,J){let Q=f(q),Y=Q.hooks?.[J.event];if(!Y)return!1;let Z=!1,$=Y.map((z)=>{let W=z.hooks?.length??0,V=(z.hooks??[]).filter((U)=>w(U.command)!==w(J.command));if(V.length!==W)Z=!0;return{...z,hooks:V}}).filter((z)=>(z.hooks??[]).length>0);if(!Z)return!1;if($.length)Q.hooks[J.event]=$;else delete Q.hooks[J.event];if(Q.hooks&&Object.keys(Q.hooks).length===0)delete Q.hooks;return Zq(q,Q),!0}function _(q,J,Q,Y){let Z=`${J}
4
4
  ${Y.trim()}
5
- ${Q}`,$="";try{$=N(q,"utf8")}catch{}let W=new RegExp(`${J}[\\s\\S]*?${Q}`);$=W.test($)?$.replace(W,Z):$.trim()?`${$.trim()}
5
+ ${Q}`,$="";try{$=g(q,"utf8")}catch{}let z=new RegExp(`${J}[\\s\\S]*?${Q}`);$=z.test($)?$.replace(z,Z):$.trim()?`${$.trim()}
6
6
 
7
7
  ${Z}
8
8
  `:`${Z}
9
- `,e(Gq(q),{recursive:!0}),C(q,$.endsWith(`
9
+ `,Qq(gq(q),{recursive:!0}),D(q,$.endsWith(`
10
10
  `)?$:`${$}
11
- `)}function b(q,J){try{return N(q,"utf8").includes(J)}catch{return!1}}function h(q,J,Q){let Y="";try{Y=N(q,"utf8")}catch{return!1}let Z=new RegExp(`${J}[\\s\\S]*?${Q}\\n?`);if(!Z.test(Y))return!1;let $=Y.replace(Z,"").replace(/\n{3,}/g,`
11
+ `)}function b(q,J){try{return g(q,"utf8").includes(J)}catch{return!1}}function h(q,J,Q){let Y="";try{Y=g(q,"utf8")}catch{return!1}let Z=new RegExp(`${J}[\\s\\S]*?${Q}\\n?`);if(!Z.test(Y))return!1;let $=Y.replace(Z,"").replace(/\n{3,}/g,`
12
12
 
13
- `).trimStart();return C(q,$),!0}function L(q,J,Q){let Y=v(q,J);e(Y,{recursive:!0});let Z=v(Y,"SKILL.md");return C(Z,Q),Z}function R(q,J){return M(v(q,J,"SKILL.md"))}function _(q,J){let Q=v(q,J);if(!M(Q))return!1;return lq(Q,{recursive:!0,force:!0}),!0}var j,jq="/Applications/Beacon.app/Contents/Resources/bin/beacon",I=`## Beacon (visual planning panel)
13
+ `).trimStart();return D(q,$),!0}function S(q,J,Q){let Y=G(q,J);Qq(Y,{recursive:!0});let Z=G(Y,"SKILL.md");return D(Z,Q),Z}function T(q,J){return x(G(q,J,"SKILL.md"))}function p(q,J){let Q=G(q,J);if(!x(Q))return!1;return aq(Q,{recursive:!0,force:!0}),!0}var B,Kq="/Applications/Beacon.app/Contents/Resources/bin/beacon",k=`## Beacon (visual planning panel)
14
14
 
15
15
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
16
16
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -34,23 +34,23 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
34
34
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
35
35
  on the /map and /db boards (added features, attached subtasks, edited columns, new
36
36
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
37
- verbatim. Do NOT implement until the tool returns approval.`;var S=u(()=>{j=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});var mJ=1500,tJ=480000,cJ=1800000,p=3600000,dJ=3000;var Mq=()=>{};var $q={};xq($q,{stripAgentsPointer:()=>fq,repoMcpCliTarget:()=>VJ,removeRepoAssets:()=>WJ,installRefreshSkill:()=>eq,installPlanSkill:()=>qJ,installInitSkill:()=>oq,installExplainSkill:()=>JJ,installCodexRepoSkills:()=>YJ,ensureWorkflowDoc:()=>ZJ,ensureMcp:()=>$J,contextDocTargets:()=>Zq,auditRepo:()=>zJ,REFRESH_SKILL:()=>Qq,PLAN_SKILL:()=>Rq,INIT_SKILL:()=>Jq,EXPLAIN_SKILL:()=>Fq});import{existsSync as P,mkdirSync as F,readFileSync as w,rmSync as m,writeFileSync as H}from"fs";import{join as z}from"path";function oq(q){let J=z(q,".claude","skills","beacon-init");F(J,{recursive:!0});let Q=z(J,"SKILL.md");return H(Q,Jq),Q}function eq(q){let J=z(q,".claude","skills","beacon-refresh");F(J,{recursive:!0});let Q=z(J,"SKILL.md");return H(Q,Qq),Q}function qJ(q){let J=z(q,".claude","skills","beacon-plan");F(J,{recursive:!0});let Q=z(J,"SKILL.md");return H(Q,Rq),Q}function JJ(q){let J=z(q,".claude","skills","beacon-explain");F(J,{recursive:!0});let Q=z(J,"SKILL.md");return H(Q,Fq),Q}function YJ(q){let J=[];for(let Q of QJ){let Y=z(q,".agents","skills",Q.name);F(Y,{recursive:!0});let Z=z(Y,"SKILL.md");H(Z,Q.body()),J.push(Z)}return J}function Zq(q){let J=z(q,"AGENTS.md"),Q=z(q,"CLAUDE.md"),Y=P(J),Z=P(Q);if(!Y&&!Z)return[J,Q];let $=[];if(Y)$.push(J);if(Z)$.push(Q);return $}function fq(q){let J=z(q,"CLAUDE.md");if(!P(J))return;let Q=w(J,"utf8"),Y=Q.split(`
37
+ verbatim. Do NOT implement until the tool returns approval.`;var m=F(()=>{B=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});var sJ=1500,rJ=480000,lJ=1800000,t=3600000,cJ=3000;var fq=()=>{};var Uq={};Nq(Uq,{stripAgentsPointer:()=>Aq,repoMcpCliTarget:()=>zJ,removeRepoAssets:()=>UJ,installRefreshSkill:()=>qJ,installPlanSkill:()=>JJ,installInitSkill:()=>eq,installExplainSkill:()=>QJ,installCodexRepoSkills:()=>ZJ,ensureWorkflowDoc:()=>$J,ensureMcp:()=>VJ,contextDocTargets:()=>Wq,auditRepo:()=>WJ,REFRESH_SKILL:()=>Vq,PLAN_SKILL:()=>Tq,INIT_SKILL:()=>$q,EXPLAIN_SKILL:()=>Cq});import{existsSync as v,mkdirSync as C,readFileSync as j,rmSync as s,writeFileSync as P}from"fs";import{join as X}from"path";function eq(q){let J=X(q,".claude","skills","beacon-init");C(J,{recursive:!0});let Q=X(J,"SKILL.md");return P(Q,$q),Q}function qJ(q){let J=X(q,".claude","skills","beacon-refresh");C(J,{recursive:!0});let Q=X(J,"SKILL.md");return P(Q,Vq),Q}function JJ(q){let J=X(q,".claude","skills","beacon-plan");C(J,{recursive:!0});let Q=X(J,"SKILL.md");return P(Q,Tq),Q}function QJ(q){let J=X(q,".claude","skills","beacon-explain");C(J,{recursive:!0});let Q=X(J,"SKILL.md");return P(Q,Cq),Q}function ZJ(q){let J=[];for(let Q of YJ){let Y=X(q,".agents","skills",Q.name);C(Y,{recursive:!0});let Z=X(Y,"SKILL.md");P(Z,Q.body()),J.push(Z)}return J}function Wq(q){let J=X(q,"AGENTS.md"),Q=X(q,"CLAUDE.md"),Y=v(J),Z=v(Q);if(!Y&&!Z)return[J,Q];let $=[];if(Y)$.push(J);if(Z)$.push(Q);return $}function Aq(q){let J=X(q,"CLAUDE.md");if(!v(J))return;let Q=j(J,"utf8"),Y=Q.split(`
38
38
  `).filter((Z)=>!/^\s*@\.?\/?AGENTS\.md\s*$/.test(Z)).join(`
39
- `).trim();if(Y&&Y!==Q.trim())H(J,`${Y}
40
- `)}function ZJ(q){let J=new RegExp(`${t}[\\s\\S]*?${Yq}`);for(let Q of Zq(q)){let Y="";try{Y=w(Q,"utf8")}catch{}Y=J.test(Y)?Y.replace(J,bq):`${Y.trim()}
39
+ `).trim();if(Y&&Y!==Q.trim())P(J,`${Y}
40
+ `)}function $J(q){let J=new RegExp(`${r}[\\s\\S]*?${zq}`);for(let Q of Wq(q)){let Y="";try{Y=j(Q,"utf8")}catch{}Y=J.test(Y)?Y.replace(J,bq):`${Y.trim()}
41
41
 
42
42
  ${bq}
43
- `.trimStart(),H(Q,Y.endsWith(`
43
+ `.trimStart(),P(Q,Y.endsWith(`
44
44
  `)?Y:`${Y}
45
- `)}fq(q)}function $J(q){let J=z(q,".mcp.json"),Q={};try{Q=JSON.parse(w(J,"utf8"))}catch{}Q.mcpServers=Q.mcpServers??{};let Y=Q.mcpServers.beacon;if(Y){if(!Y.timeout||Y.timeout<p)return Y.timeout=p,H(J,JSON.stringify(Q,null,2)+`
46
- `),{path:J,added:!1,updated:!0};return{path:J,added:!1,updated:!1}}return Q.mcpServers.beacon={command:G(),args:["mcp"],timeout:p},H(J,JSON.stringify(Q,null,2)+`
47
- `),{path:J,added:!0,updated:!1}}function VJ(q){try{return JSON.parse(w(z(q,".mcp.json"),"utf8")).mcpServers?.beacon?.command??null}catch{return null}}function zJ(q){let J=z(q,".mcp.json"),Q=!1;try{Q=!!JSON.parse(w(J,"utf8")).mcpServers?.beacon}catch{}let Y=Zq(q).some((Z)=>{try{return w(Z,"utf8").includes(t)}catch{return!1}});return{repo:q,mcpRegistered:Q,workflowBlock:Y,skills:{"beacon-init":P(z(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":P(z(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":P(z(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":P(z(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function WJ(q){let J=[];for(let V of["beacon-init","beacon-refresh","beacon-db-design"]){let U=z(q,".claude","skills",V);if(P(U))m(U,{recursive:!0,force:!0}),J.push(V)}for(let V of["beacon-init","beacon-refresh"]){let U=z(q,".agents","skills",V);if(P(U))m(U,{recursive:!0,force:!0}),J.push(`codex:${V}`)}let Q=!1,Y=z(q,".mcp.json");try{let V=JSON.parse(w(Y,"utf8"));if(V.mcpServers?.beacon){if(delete V.mcpServers.beacon,Q=!0,V.mcpServers&&Object.keys(V.mcpServers).length===0)delete V.mcpServers;if(Object.keys(V).length===0)m(Y,{force:!0});else H(Y,JSON.stringify(V,null,2)+`
48
- `)}}catch{}let Z=!1,$=new RegExp(`\\n?${t}[\\s\\S]*?${Yq}\\n?`);for(let V of[z(q,"AGENTS.md"),z(q,"CLAUDE.md")])try{let U=w(V,"utf8");if($.test(U)){let o=U.replace($,`
45
+ `)}Aq(q)}function VJ(q){let J=X(q,".mcp.json"),Q={};try{Q=JSON.parse(j(J,"utf8"))}catch{}Q.mcpServers=Q.mcpServers??{};let Y=Q.mcpServers.beacon;if(Y){if(!Y.timeout||Y.timeout<t)return Y.timeout=t,P(J,JSON.stringify(Q,null,2)+`
46
+ `),{path:J,added:!1,updated:!0};return{path:J,added:!1,updated:!1}}return Q.mcpServers.beacon={command:N(),args:["mcp"],timeout:t},P(J,JSON.stringify(Q,null,2)+`
47
+ `),{path:J,added:!0,updated:!1}}function zJ(q){try{return JSON.parse(j(X(q,".mcp.json"),"utf8")).mcpServers?.beacon?.command??null}catch{return null}}function WJ(q){let J=X(q,".mcp.json"),Q=!1;try{Q=!!JSON.parse(j(J,"utf8")).mcpServers?.beacon}catch{}let Y=Wq(q).some((Z)=>{try{return j(Z,"utf8").includes(r)}catch{return!1}});return{repo:q,mcpRegistered:Q,workflowBlock:Y,skills:{"beacon-init":v(X(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v(X(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v(X(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v(X(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function UJ(q){let J=[];for(let V of["beacon-init","beacon-refresh","beacon-db-design"]){let U=X(q,".claude","skills",V);if(v(U))s(U,{recursive:!0,force:!0}),J.push(V)}for(let V of["beacon-init","beacon-refresh"]){let U=X(q,".agents","skills",V);if(v(U))s(U,{recursive:!0,force:!0}),J.push(`codex:${V}`)}let Q=!1,Y=X(q,".mcp.json");try{let V=JSON.parse(j(Y,"utf8"));if(V.mcpServers?.beacon){if(delete V.mcpServers.beacon,Q=!0,V.mcpServers&&Object.keys(V.mcpServers).length===0)delete V.mcpServers;if(Object.keys(V).length===0)s(Y,{force:!0});else P(Y,JSON.stringify(V,null,2)+`
48
+ `)}}catch{}let Z=!1,$=new RegExp(`\\n?${r}[\\s\\S]*?${zq}\\n?`);for(let V of[X(q,"AGENTS.md"),X(q,"CLAUDE.md")])try{let U=j(V,"utf8");if($.test(U)){let H=U.replace($,`
49
49
  `).replace(/\n{3,}/g,`
50
50
 
51
- `).trimStart();H(V,o.endsWith(`
52
- `)?o:`${o}
53
- `),Z=!0}}catch{}let W=!1,X=z(q,"CLAUDE.md");try{let V=w(X,"utf8"),U=V.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==V){if(!U.trim())m(X,{force:!0});else H(X,U);W=!0}}catch{}return{skillsRemoved:J,mcpUnregistered:Q,agentsBlockRemoved:Z,claudeImportRemoved:W}}var Jq=`---
51
+ `).trimStart();P(V,H.endsWith(`
52
+ `)?H:`${H}
53
+ `),Z=!0}}catch{}let z=!1,W=X(q,"CLAUDE.md");try{let V=j(W,"utf8"),U=V.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==V){if(!U.trim())s(W,{force:!0});else P(W,U);z=!0}}catch{}return{skillsRemoved:J,mcpUnregistered:Q,agentsBlockRemoved:Z,claudeImportRemoved:z}}var $q=`---
54
54
  name: beacon-init
55
55
  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.
56
56
  ---
@@ -97,7 +97,7 @@ beacon init-persist /tmp/beacon-init.json # or: beacon init-persist < /tmp/bea
97
97
  That one command wires the repo (writes \`.mcp.json\` + skills so your NEXT session gets the \`beacon_*\` tools natively, heals the global install), starts the Beacon daemon if it isn't running, registers + provisions this workspace, and POSTs your analysis to the same \`/api/init\` endpoint the MCP tool uses \u2014 so init completes in THIS session. Read the counts it prints and report them.
98
98
 
99
99
  After the tool (or \`beacon init-persist\`) returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
100
- `,Qq=`---
100
+ `,Vq=`---
101
101
  name: beacon-refresh
102
102
  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.
103
103
  ---
@@ -144,7 +144,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
144
144
  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.
145
145
 
146
146
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
147
- `,Rq=`---
147
+ `,Tq=`---
148
148
  name: beacon-plan
149
149
  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.
150
150
  ---
@@ -193,7 +193,7 @@ If it returns feedback, revise and call it again.
193
193
  If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
194
194
  with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
195
195
  run \`beacon\` in this repo once.
196
- `,Fq=`---
196
+ `,Cq=`---
197
197
  name: beacon-explain
198
198
  description: Teach the user part of THIS codebase as an interactive visual lesson on Beacon's /learn page \u2014 a concept map + plain-English narrative they can question \u2014 instead of a wall of text. Use when the user says "explain", "teach me", "walk me through", "how does X work", or "help me understand the Y category".
199
199
  ---
@@ -263,7 +263,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
263
263
  Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
264
264
  the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
265
265
  the lesson.
266
- `,QJ,t="<!-- beacon:workflow:start -->",Yq="<!-- beacon:workflow:end -->",bq;var Vq=u(()=>{S();Mq();QJ=[{name:"beacon-init",body:()=>Jq},{name:"beacon-refresh",body:()=>Qq}];bq=`${t}
266
+ `,YJ,r="<!-- beacon:workflow:start -->",zq="<!-- beacon:workflow:end -->",bq;var Xq=F(()=>{m();fq();YJ=[{name:"beacon-init",body:()=>$q},{name:"beacon-refresh",body:()=>Vq}];bq=`${r}
267
267
  ## Beacon \u2014 feature workflow
268
268
 
269
269
  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:
@@ -335,18 +335,20 @@ Register them all in that single batched call. If a plan added five features, th
335
335
  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.
336
336
 
337
337
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
338
- ${Yq}`});import{mkdirSync as UJ,renameSync as XJ,rmSync as HJ,writeFileSync as PJ}from"fs";import{dirname as wJ}from"path";function c(q,J){UJ(wJ(q),{recursive:!0});let Q=`${q}.tmp`;try{PJ(Q,J),XJ(Q,q)}catch(Y){throw HJ(Q,{force:!0}),Y}}function eJ(q,J,Q=!1){c(q,JSON.stringify(J,null,Q?2:void 0))}var Tq=()=>{};var _q={};xq(_q,{setupCodexAssets:()=>uJ,removeCodexMcp:()=>Lq,removeCodexArtifacts:()=>bJ,parseTomlBeacon:()=>kq,nodeWhich:()=>Iq,hasCodexMcp:()=>Xq,ensureCodexMcp:()=>hq,commandExists:()=>Aq,codexMcpProblem:()=>KJ,codexMcpCliTarget:()=>gJ,codexDetected:()=>Dq,auditCodex:()=>MJ,CODEX_HOOKS:()=>l});import{accessSync as vJ,constants as xJ,readFileSync as T}from"fs";import{homedir as jJ}from"os";import{delimiter as GJ,join as g}from"path";function Cq(){return process.env.HOME||process.env.USERPROFILE||jJ()}function Iq(q,J=process.env.PATH||"",Q=BJ){if(!q)return null;for(let Y of J.split(GJ)){if(!Y)continue;let Z=g(Y,q);if(Q(Z))return Z}return null}function BJ(q){try{return vJ(q,xJ.X_OK),!0}catch{return!1}}function Aq(q){if(typeof Bun<"u"&&typeof Bun.which==="function")return Bun.which(q)!==null;return Iq(q)!==null}function Dq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(zq===void 0)zq=Aq("codex");return zq}function kq(q){let J={},Q=!1;for(let Y of q.split(`
339
- `)){let Z=Y.trim();if(!Z||Z.startsWith("#"))continue;let $=/^\[([^\]]+)\]/.exec(Z);if($){if(Q=$[1].trim()==="mcp_servers.beacon",Q)J.mcp_servers=J.mcp_servers??{},J.mcp_servers.beacon=J.mcp_servers.beacon??{};continue}if(Q){let W=/^command\s*=\s*["']([^"']*)["']/.exec(Z);if(W)J.mcp_servers.beacon.command=W[1]}}return J}function K(q){try{if(typeof Bun<"u"&&Bun.TOML?.parse)return Bun.TOML.parse(q);return kq(q)}catch{return null}}function Xq(){try{return Boolean(K(T(B(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function KJ(){let q="";try{q=T(B(),"utf8")}catch{return null}let J=K(q);if(!J)return`~/.codex/config.toml does not parse \u2014 ${f}`;if(J.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${f}`;return null}function hq(){let q="",J=!1;try{q=T(B(),"utf8"),J=!0}catch{}if(J){let $=K(q);if(!$)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${f}`};if($.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${f}`}}let Q=!q?"":q.endsWith(`
338
+ ${zq}`});import{mkdirSync as XJ,renameSync as PJ,rmSync as HJ,writeFileSync as wJ}from"fs";import{dirname as vJ}from"path";function A(q,J){XJ(vJ(q),{recursive:!0});let Q=`${q}.tmp`;try{wJ(Q,J),PJ(Q,q)}catch(Y){throw HJ(Q,{force:!0}),Y}}function JQ(q,J,Q=!1){A(q,JSON.stringify(J,null,Q?2:void 0))}var Oq=()=>{};var Sq={};Nq(Sq,{setupCodexAssets:()=>xJ,removeCodexMcp:()=>hq,removeCodexArtifacts:()=>fJ,parseTomlBeacon:()=>Lq,nodeWhich:()=>kq,hasCodexMcp:()=>wq,ensureCodexMcp:()=>_q,commandExists:()=>Eq,codexMcpProblem:()=>uJ,codexMcpCliTarget:()=>FJ,codexDetected:()=>Iq,auditCodex:()=>MJ,CODEX_HOOKS:()=>o});import{accessSync as jJ,constants as GJ,readFileSync as y}from"fs";import{homedir as BJ}from"os";import{delimiter as NJ,join as R}from"path";function yq(){return process.env.HOME||process.env.USERPROFILE||BJ()}function kq(q,J=process.env.PATH||"",Q=KJ){if(!q)return null;for(let Y of J.split(NJ)){if(!Y)continue;let Z=R(Y,q);if(Q(Z))return Z}return null}function KJ(q){try{return jJ(q,GJ.X_OK),!0}catch{return!1}}function Eq(q){if(typeof Bun<"u"&&typeof Bun.which==="function")return Bun.which(q)!==null;return kq(q)!==null}function Iq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(Pq===void 0)Pq=Eq("codex");return Pq}function Lq(q){let J={},Q=!1;for(let Y of q.split(`
339
+ `)){let Z=Y.trim();if(!Z||Z.startsWith("#"))continue;let $=/^\[([^\]]+)\]/.exec(Z);if($){if(Q=$[1].trim()==="mcp_servers.beacon",Q)J.mcp_servers=J.mcp_servers??{},J.mcp_servers.beacon=J.mcp_servers.beacon??{};continue}if(Q){let z=/^command\s*=\s*["']([^"']*)["']/.exec(Z);if(z)J.mcp_servers.beacon.command=z[1]}}return J}function u(q){try{if(typeof Bun<"u"&&Bun.TOML?.parse)return Bun.TOML.parse(q);return Lq(q)}catch{return null}}function wq(){try{return Boolean(u(y(K(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function uJ(){let q="";try{q=y(K(),"utf8")}catch{return null}let J=u(q);if(!J)return`~/.codex/config.toml does not parse \u2014 ${O}`;if(J.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${O}`;return null}function RJ(q){let J=q.split(`
340
+ `),Q=J.indexOf(i),Y=J.indexOf(n,Q);if(Q===-1||Y===-1)return null;let Z=J.findIndex((W,V)=>V>Q&&V<Y&&W.trim()==="[mcp_servers.beacon]");if(Z===-1)return null;let $=Z+1;while($<Y&&!/^\s*\[/.test(J[$]))$++;let z=J.findIndex((W,V)=>V>Z&&V<$&&/^\s*command\s*=/.test(W));if(z===-1)return null;return J[z]=`command = ${JSON.stringify(N())}`,J.join(`
341
+ `)}function _q(){let q="",J=!1;try{q=y(K(),"utf8"),J=!0}catch{}if(J){let $=u(q);if(!$)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${O}`};if($.mcp_servers?.beacon){let z=RJ(q);if(z&&z!==q)A(K(),z);return{added:!1}}if(/^\s*mcp_servers\s*=/m.test(q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${O}`}}let Q=!q?"":q.endsWith(`
340
342
  `)?`
341
343
  `:`
342
344
 
343
- `,Y=q+Q+NJ();if(K(Y)?.mcp_servers?.beacon?.command!==G())return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${f}`};return c(B(),Y),{added:!0}}function gJ(){try{return K(T(B(),"utf8"))?.mcp_servers?.beacon?.command??null}catch{return null}}function Lq(){let q="";try{q=T(B(),"utf8")}catch{return{removed:!1}}let J=q.split(`
344
- `),Q=J.indexOf(yq);if(Q===-1)return{removed:!1,skipped:Xq()};let Y=J.indexOf(Eq,Q);if(Y===-1)return{removed:!1,skipped:!0};J.splice(Q,Y-Q+1);let Z=J.join(`
345
+ `,Y=q+Q+gJ();if(u(Y)?.mcp_servers?.beacon?.command!==N())return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${O}`};return A(K(),Y),{added:!0}}function FJ(){try{return u(y(K(),"utf8"))?.mcp_servers?.beacon?.command??null}catch{return null}}function hq(){let q="";try{q=y(K(),"utf8")}catch{return{removed:!1}}let J=q.split(`
346
+ `),Q=J.indexOf(i);if(Q===-1)return{removed:!1,skipped:wq()};let Y=J.indexOf(n,Q);if(Y===-1)return{removed:!1,skipped:!0};let Z=J.findIndex((W,V)=>V>Q&&V<Y&&W.trim()==="[mcp_servers.beacon]");if(Z===-1)return{removed:!1,skipped:!0};let $=Z+1;while($<Y&&!/^\s*\[/.test(J[$]))$++;J.splice(Z,$-Z),J.splice(J.indexOf(n),1),J.splice(J.indexOf(i),1);let z=J.join(`
345
347
  `).replace(/\n{3,}/g,`
346
348
 
347
- `).replace(/^\n+/,"");if(K(Z)===null)return{removed:!1,skipped:!0};return c(B(),Z),{removed:!0}}async function uJ(){let{INIT_SKILL:q,REFRESH_SKILL:J,PLAN_SKILL:Q,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (Vq(),$q)),Z={"beacon-init":q,"beacon-refresh":J,"beacon-plan":Q,"beacon-explain":Y},$=[];for(let U of j){if(!R(s(),U))$.push(U);L(s(),U,Z[U])}let W=0;for(let U of l)if(D(Uq(),{event:U.event,matcher:U.matcher,command:O(U.command)}))W++;let X=b(d(),r);k(d(),r,Oq,I);let V=hq();return{skillsAdded:$,hooksAdded:W,agentsMdBlockTouched:!X,mcp:V}}function MJ(){let q={};for(let Q of j)q[Q]=R(s(),Q);let J={};for(let Q of l)J[Q.event]=y(Uq(),{event:Q.event,command:Q.command});return{detected:Dq(),skills:q,hooks:J,agentsMdBlock:b(d(),r),mcp:Xq()}}function bJ(){let q=[];for(let Z of j)if(_(s(),Z))q.push(Z);let J=0;for(let Z of l)if(E(Uq(),{event:Z.event,command:Z.command}))J++;let Q=h(d(),r,Oq),Y=Lq();return{skillsRemoved:q,hooksRemoved:J,agentsMdBlockRemoved:Q,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var Wq=()=>g(Cq(),".codex"),Uq=()=>g(Wq(),"hooks.json"),B=()=>g(Wq(),"config.toml"),d=()=>g(Wq(),"AGENTS.md"),s=()=>g(Cq(),".agents","skills"),r="<!-- beacon:global:start -->",Oq="<!-- beacon:global:end -->",l,zq,yq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",Eq="# beacon:end",NJ=()=>`${yq}
349
+ `).replace(/^\n+/,"");if(u(z)===null)return{removed:!1,skipped:!0};return A(K(),z),{removed:!0}}async function xJ(){let{INIT_SKILL:q,REFRESH_SKILL:J,PLAN_SKILL:Q,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (Xq(),Uq)),Z={"beacon-init":q,"beacon-refresh":J,"beacon-plan":Q,"beacon-explain":Y},$=[];for(let U of B){if(!T(d(),U))$.push(U);S(d(),U,Z[U])}let z=0;for(let U of o){let H=U.event==="UserPromptSubmit"||U.event==="Stop";if(H)xq(l(),{event:U.event,matcher:U.matcher,command:M(U.command)});if(E(l(),{event:U.event,matcher:U.matcher,command:M(U.command)},{matchAnyMatcher:H}))z++}let W=b(c(),a);_(c(),a,Dq,k);let V=_q();return{skillsAdded:$,hooksAdded:z,agentsMdBlockTouched:!W,mcp:V}}function MJ(){let q={};for(let Q of B)q[Q]=T(d(),Q);let J={};for(let Q of o)J[Q.event]=I(l(),{event:Q.event,command:Q.command});return{detected:Iq(),skills:q,hooks:J,agentsMdBlock:b(c(),a),mcp:wq()}}function fJ(){let q=[];for(let Z of B)if(p(d(),Z))q.push(Z);let J=0;for(let Z of o)if(L(l(),{event:Z.event,command:Z.command}))J++;let Q=h(c(),a,Dq),Y=hq();return{skillsRemoved:q,hooksRemoved:J,agentsMdBlockRemoved:Q,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var Hq=()=>R(yq(),".codex"),l=()=>R(Hq(),"hooks.json"),K=()=>R(Hq(),"config.toml"),c=()=>R(Hq(),"AGENTS.md"),d=()=>R(yq(),".agents","skills"),a="<!-- beacon:global:start -->",Dq="<!-- beacon:global:end -->",o,Pq,i="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",n="# beacon:end",gJ=()=>`${i}
348
350
  [mcp_servers.beacon]
349
- command = "${G()}"
351
+ command = "${N()}"
350
352
  args = ["mcp"]
351
- ${Eq}
352
- `,f="add it manually: codex mcp add beacon -- beacon mcp";var Sq=u(()=>{S();Tq();l=[{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."}]});S();import{existsSync as RJ}from"fs";import{homedir as FJ}from"os";import{join as a}from"path";function fJ(){return process.env.HOME||process.env.USERPROFILE||FJ()}var i=()=>a(fJ(),".claude"),Hq=()=>a(i(),"skills"),n=()=>a(i(),"settings.json"),Pq=()=>a(i(),"CLAUDE.md"),wq="<!-- beacon:global:start -->",pq="<!-- beacon:global:end -->";var TJ=I,vq=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract: in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. Fail-open when there's no active contract."},{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:"PreToolUse",matcher:"AskUserQuestion",command:"beacon ask",description:"Surface the agent's AskUserQuestion in Beacon's modal; your pick flows back as the answer (falls through to the terminal if Beacon isn't open)."},{event:"PermissionRequest",matcher:"Edit|Write|MultiEdit|Bash|NotebookEdit",command:"beacon ask",description:"Surface edit/create/run approvals in Beacon's modal; your allow/deny flows back (falls through to the terminal prompt if Beacon isn't open)."},{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 CJ(q,J){return L(Hq(),q,J)}function mq(q){return R(Hq(),q)}function OJ(q){return _(Hq(),q)}function IJ(q){return D(n(),q)}function AJ(q){return y(n(),q)}function DJ(q){return E(n(),q)}function yJ(q){k(Pq(),wq,pq,q)}function tq(){return b(Pq(),wq)}function EJ(){return h(Pq(),wq,pq)}function XQ(){let q={};for(let Q of j)q[Q]=mq(Q);let J={};for(let Q of vq)J[Q.event]=AJ({event:Q.event,command:Q.command});return{homeExists:RJ(i()),skills:q,hooks:J,claudeMdBlock:tq()}}function HQ(){let q=uq(n(),{event:"PostToolUse",command:"beacon hook"});return q?qq(q):null}async function kJ(){let{INIT_SKILL:q,REFRESH_SKILL:J,PLAN_SKILL:Q,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (Vq(),$q)),Z={"beacon-init":q,"beacon-refresh":J,"beacon-plan":Q,"beacon-explain":Y},$=[];for(let V of j){if(!mq(V))$.push(V);CJ(V,Z[V])}let W=0;for(let V of vq)if(IJ({event:V.event,matcher:V.matcher,command:O(V.command)}))W++;let X=tq();return yJ(TJ),{skillsAdded:$,hooksAdded:W,claudeMdBlockTouched:!X}}async function PQ(){if(Bq())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let q;if(Kq()){try{hJ()}catch{}q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{q={ok:!0,...await kJ()}}catch(J){q={ok:!1,error:J instanceof Error?J.message:String(J),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let J=await Promise.resolve().then(() => (Sq(),_q));if(J.codexDetected())q.codex={ok:!0,...await J.setupCodexAssets()}}catch(J){q.codex={ok:!1,error:J instanceof Error?J.message:String(J),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return q}function hJ(){let q=[];for(let Y of j)if(OJ(Y))q.push(Y);let J=0;for(let Y of vq)if(DJ(Y))J++;let Q=EJ();return{skillsRemoved:q,hooksRemoved:J,claudeMdBlockRemoved:Q}}export{kJ as setupGlobalAssets,PQ as selfHealGlobal,OJ as removeGlobalSkill,DJ as removeGlobalHook,EJ as removeGlobalClaudeMdBlock,hJ as removeBeaconArtifacts,Bq as isPluginManaged,iq as isInstalledPluginPath,mq as isGlobalSkillInstalled,nq as installedBeaconPlugin,CJ as installGlobalSkill,AJ as hasGlobalHook,tq as hasGlobalClaudeMdBlock,HQ as globalHookCliTarget,Nq as findBeaconPluginDir,IJ as ensureGlobalHook,yJ as ensureGlobalClaudeMdBlock,Kq as beaconPluginInstalled,G as beaconCliCommand,XQ as auditGlobal,j as GLOBAL_SKILLS,vq as GLOBAL_HOOKS,TJ as GLOBAL_CLAUDE_MD_BLOCK};
353
+ ${n}
354
+ `,O="add it manually: codex mcp add beacon -- beacon mcp";var pq=F(()=>{m();Oq();o=[{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."}]});m();import{existsSync as bJ}from"fs";import{homedir as TJ}from"os";import{join as e}from"path";function CJ(){return process.env.HOME||process.env.USERPROFILE||TJ()}var qq=()=>e(CJ(),".claude"),vq=()=>e(qq(),"skills"),Jq=()=>e(qq(),"settings.json"),jq=()=>e(qq(),"CLAUDE.md"),Gq="<!-- beacon:global:start -->",mq="<!-- beacon:global:end -->";var AJ=k,Bq=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract: in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. Fail-open when there's no active contract."},{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:"PreToolUse",matcher:"AskUserQuestion",command:"beacon ask",description:"Surface the agent's AskUserQuestion in Beacon's modal; your pick flows back as the answer (falls through to the terminal if Beacon isn't open)."},{event:"PermissionRequest",matcher:"Edit|Write|MultiEdit|Bash|NotebookEdit",command:"beacon ask",description:"Surface edit/create/run approvals in Beacon's modal; your allow/deny flows back (falls through to the terminal prompt if Beacon isn't open)."},{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 OJ(q,J){return S(vq(),q,J)}function tq(q){return T(vq(),q)}function yJ(q){return p(vq(),q)}function DJ(q){return E(Jq(),q)}function kJ(q){return I(Jq(),q)}function EJ(q){return L(Jq(),q)}function IJ(q){_(jq(),Gq,mq,q)}function sq(){return b(jq(),Gq)}function LJ(){return h(jq(),Gq,mq)}function HQ(){let q={};for(let Q of B)q[Q]=tq(Q);let J={};for(let Q of Bq)J[Q.event]=kJ({event:Q.event,command:Q.command});return{homeExists:bJ(qq()),skills:q,hooks:J,claudeMdBlock:sq()}}function wQ(){let q=Mq(Jq(),{event:"PostToolUse",command:"beacon hook"});return q?Yq(q):null}async function _J(){let{INIT_SKILL:q,REFRESH_SKILL:J,PLAN_SKILL:Q,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (Xq(),Uq)),Z={"beacon-init":q,"beacon-refresh":J,"beacon-plan":Q,"beacon-explain":Y},$=[];for(let V of B){if(!tq(V))$.push(V);OJ(V,Z[V])}let z=0;for(let V of Bq)if(DJ({event:V.event,matcher:V.matcher,command:M(V.command)}))z++;let W=sq();return IJ(AJ),{skillsAdded:$,hooksAdded:z,claudeMdBlockTouched:!W}}async function vQ(){if(uq())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let q;if(Fq()){try{hJ()}catch{}q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{q={ok:!0,...await _J()}}catch(J){q={ok:!1,error:J instanceof Error?J.message:String(J),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let J=await Promise.resolve().then(() => (pq(),Sq));if(J.codexDetected())q.codex={ok:!0,...await J.setupCodexAssets()}}catch(J){q.codex={ok:!1,error:J instanceof Error?J.message:String(J),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return q}function hJ(){let q=[];for(let Y of B)if(yJ(Y))q.push(Y);let J=0;for(let Y of Bq)if(EJ(Y))J++;let Q=LJ();return{skillsRemoved:q,hooksRemoved:J,claudeMdBlockRemoved:Q}}export{_J as setupGlobalAssets,vQ as selfHealGlobal,yJ as removeGlobalSkill,EJ as removeGlobalHook,LJ as removeGlobalClaudeMdBlock,hJ as removeBeaconArtifacts,uq as isPluginManaged,nq as isInstalledPluginPath,tq as isGlobalSkillInstalled,oq as installedBeaconPlugin,OJ as installGlobalSkill,kJ as hasGlobalHook,sq as hasGlobalClaudeMdBlock,wQ as globalHookCliTarget,Rq as findBeaconPluginDir,DJ as ensureGlobalHook,IJ as ensureGlobalClaudeMdBlock,Fq as beaconPluginInstalled,N as beaconCliCommand,HQ as auditGlobal,B as GLOBAL_SKILLS,Bq as GLOBAL_HOOKS,AJ as GLOBAL_CLAUDE_MD_BLOCK};
@@ -0,0 +1 @@
1
+ ALTER TABLE `Node` ADD `externalMeta` text;