trybeacon 0.1.80 → 0.1.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +18 -18
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +2 -2
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +26 -25
- package/.next/server/app/_not-found.segments/_full.segment.rsc +26 -25
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +15 -14
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/docs/page.js +2 -2
- package/.next/server/app/docs/page.js.nft.json +1 -1
- package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +27 -26
- package/.next/server/app/docs.segments/_full.segment.rsc +27 -26
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +15 -14
- package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/.next/server/app/help/page.js +2 -2
- package/.next/server/app/help/page.js.nft.json +1 -1
- package/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/.next/server/app/help.html +1 -1
- package/.next/server/app/help.rsc +35 -34
- package/.next/server/app/help.segments/_full.segment.rsc +35 -34
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +15 -14
- package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/help.segments/help.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +25 -24
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +25 -24
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +15 -14
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/learn/page.js +4 -4
- package/.next/server/app/learn/page.js.nft.json +1 -1
- package/.next/server/app/learn/page_client-reference-manifest.js +1 -1
- package/.next/server/app/map/page.js +2 -2
- package/.next/server/app/map/page.js.nft.json +1 -1
- package/.next/server/app/map/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/plan/page.js +3 -3
- package/.next/server/app/plan/page.js.nft.json +1 -1
- package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
- package/.next/server/app/s/[token]/page.js +2 -2
- package/.next/server/app/s/[token]/page.js.nft.json +1 -1
- package/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js +2 -2
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +18 -18
- package/.next/server/chunks/{7720.js → 141.js} +4 -4
- package/.next/server/chunks/2025.js +1 -1
- package/.next/server/chunks/2455.js +1 -0
- package/.next/server/chunks/3174.js +1 -1
- package/.next/server/chunks/3179.js +1 -0
- package/.next/server/chunks/6469.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/1909-0f500ebe4df09208.js +1 -0
- package/.next/static/chunks/{3908-80efc60050779adf.js → 3908-2ba88cd8ba5dfa2e.js} +1 -1
- package/.next/static/chunks/{2059-fba06ba63ba64522.js → 4674-31ad596c3e856647.js} +3 -3
- package/.next/static/chunks/4752-81a4fc25de32efa2.js +1 -0
- package/.next/static/chunks/4853-43350f60d0d9135b.js +1 -0
- package/.next/static/chunks/6639-f0b63e1e7d03a20a.js +1 -0
- package/.next/static/chunks/9784-880aab43467bf1e0.js +1 -0
- package/.next/static/chunks/app/layout-ef1edf5ed5839b01.js +1 -0
- package/.next/static/chunks/app/learn/page-6459c292421bec82.js +7 -0
- package/.next/static/chunks/app/map/page-602309791f192143.js +1 -0
- package/.next/static/chunks/app/page-32a051917fc57795.js +1 -0
- package/.next/static/chunks/app/plan/page-920d4fecdd6dde34.js +11 -0
- package/.next/static/chunks/app/s/[token]/page-1df7929974ceeb5a.js +1 -0
- package/.next/static/chunks/app/settings/page-f128ae102e013087.js +1 -0
- package/.next/static/css/9301599114d42898.css +1 -0
- package/.next/trace +47 -46
- package/.next/trace-build +1 -1
- package/dist/bin/beacon.js +16 -15
- package/dist/bin/doctor.js +61 -60
- package/dist/bin/hook.js +58 -57
- package/dist/bin/mcp.js +70 -69
- package/dist/bin/plan.js +61 -60
- package/dist/bin/uninstall.js +59 -58
- package/dist/lib/assets.js +55 -20
- package/dist/lib/codex-install.js +62 -61
- package/dist/lib/daemon-boot.js +37 -0
- package/dist/lib/global-install.js +62 -61
- package/package.json +1 -1
- package/.next/server/chunks/5295.js +0 -1
- package/.next/server/chunks/7652.js +0 -1
- package/.next/static/chunks/1909-98243a0473be2aae.js +0 -1
- package/.next/static/chunks/4477-cda153702c7812d2.js +0 -1
- package/.next/static/chunks/4607-a668ea431c41e60e.js +0 -1
- package/.next/static/chunks/4853-0082a1e1b820a293.js +0 -1
- package/.next/static/chunks/5520-32e29b8bbff59f44.js +0 -1
- package/.next/static/chunks/app/layout-e728d45f193e3b95.js +0 -1
- package/.next/static/chunks/app/learn/page-fc0bf8bce602526b.js +0 -7
- package/.next/static/chunks/app/map/page-847b374e7dfed924.js +0 -1
- package/.next/static/chunks/app/page-ec00130a7a249f14.js +0 -1
- package/.next/static/chunks/app/plan/page-1108bdf804b8a1bd.js +0 -11
- package/.next/static/chunks/app/s/[token]/page-2fc7806fc2f205a5.js +0 -1
- package/.next/static/chunks/app/settings/page-7e86fd456b92c248.js +0 -1
- package/.next/static/css/6eabb17c2a2081f2.css +0 -1
- /package/.next/static/{zI2f5SCpeUG4MfjJNbXnf → ms-hAcPFSz7LxuiDMzzcP}/_buildManifest.js +0 -0
- /package/.next/static/{zI2f5SCpeUG4MfjJNbXnf → ms-hAcPFSz7LxuiDMzzcP}/_ssgManifest.js +0 -0
|
@@ -1,21 +1,56 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
`).filter((
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
${
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`)
|
|
11
|
-
`),{
|
|
12
|
-
|
|
13
|
-
`)}
|
|
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}
|
|
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()}
|
|
6
|
+
|
|
7
|
+
${Z}
|
|
8
|
+
`:`${Z}
|
|
9
|
+
`,_(o(q),{recursive:!0}),C(q,$.endsWith(`
|
|
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,`
|
|
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)
|
|
14
|
+
|
|
15
|
+
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
16
|
+
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
17
|
+
the user reviews on a canvas at /plan, and feedback flows back as the next round.
|
|
18
|
+
|
|
19
|
+
**When to invoke**
|
|
20
|
+
- User asks to "plan a feature" / "design a schema" \u2192 if the \`beacon_propose_plan\`
|
|
21
|
+
MCP tool is available, design the plan and call it. If it is NOT available, the panel
|
|
22
|
+
isn't wired in this repo \u2014 run \`beacon\` here once, then retry.
|
|
23
|
+
- User asks to "set up Beacon" / "map this repo" \u2192 invoke the \`beacon-init\` skill.
|
|
24
|
+
- User asks to "refresh Beacon" / "update the map" / "bring Beacon up to date" \u2192 invoke
|
|
25
|
+
the \`beacon-refresh\` skill. Re-surveys the repo and updates init-derived nodes while
|
|
26
|
+
preserving anything the user added by hand.
|
|
27
|
+
- User asks to "explain" / "teach me" / "walk me through" / "how does X work" \u2192 if the
|
|
28
|
+
\`beacon_explain\` MCP tool is available, author an interactive Lesson (a concept map +
|
|
29
|
+
plain-English narrative on /learn the user questions back) via the \`beacon-explain\` skill.
|
|
30
|
+
- Run \`beacon doctor\` to audit what's wired (global hooks, repo's .mcp.json, AGENTS.md block).
|
|
31
|
+
|
|
32
|
+
**The plan feedback loop**
|
|
33
|
+
\`beacon_propose_plan\` BLOCKS until the user clicks Approve / Discard / submits feedback.
|
|
34
|
+
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
35
|
+
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
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(`
|
|
38
|
+
`).filter((Z)=>!/^\s*@\.?\/?AGENTS\.md\s*$/.test(Z)).join(`
|
|
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()}
|
|
41
|
+
|
|
42
|
+
${Hq}
|
|
43
|
+
`.trimStart(),H(Q,Y.endsWith(`
|
|
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($,`
|
|
14
49
|
`).replace(/\n{3,}/g,`
|
|
15
50
|
|
|
16
|
-
`).trimStart();
|
|
17
|
-
`)?
|
|
18
|
-
`),
|
|
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=`---
|
|
19
54
|
name: beacon-init
|
|
20
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.
|
|
21
56
|
---
|
|
@@ -62,7 +97,7 @@ beacon init-persist /tmp/beacon-init.json # or: beacon init-persist < /tmp/bea
|
|
|
62
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.
|
|
63
98
|
|
|
64
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.
|
|
65
|
-
`,
|
|
100
|
+
`,l=`---
|
|
66
101
|
name: beacon-refresh
|
|
67
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.
|
|
68
103
|
---
|
|
@@ -109,7 +144,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
109
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.
|
|
110
145
|
|
|
111
146
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
112
|
-
`,
|
|
147
|
+
`,Pq=`---
|
|
113
148
|
name: beacon-plan
|
|
114
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.
|
|
115
150
|
---
|
|
@@ -158,7 +193,7 @@ If it returns feedback, revise and call it again.
|
|
|
158
193
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
159
194
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
160
195
|
run \`beacon\` in this repo once.
|
|
161
|
-
`,
|
|
196
|
+
`,vq=`---
|
|
162
197
|
name: beacon-explain
|
|
163
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".
|
|
164
199
|
---
|
|
@@ -228,7 +263,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
|
|
|
228
263
|
Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
|
|
229
264
|
the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
|
|
230
265
|
the lesson.
|
|
231
|
-
`,
|
|
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}
|
|
232
267
|
## Beacon \u2014 feature workflow
|
|
233
268
|
|
|
234
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:
|
|
@@ -300,52 +335,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
300
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.
|
|
301
336
|
|
|
302
337
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
303
|
-
${
|
|
304
|
-
`)
|
|
305
|
-
${Q.trim()}
|
|
306
|
-
${J}`,Y="";try{Y=X(q,"utf8")}catch{}let P=new RegExp(`${z}[\\s\\S]*?${J}`);Y=P.test(Y)?Y.replace(P,V):Y.trim()?`${Y.trim()}
|
|
307
|
-
|
|
308
|
-
${V}
|
|
309
|
-
`:`${V}
|
|
310
|
-
`,_(zq(q),{recursive:!0}),R(q,Y.endsWith(`
|
|
311
|
-
`)?Y:`${Y}
|
|
312
|
-
`)}function S(q,z){try{return X(q,"utf8").includes(z)}catch{return!1}}function Uq(q,z,J){let Q="";try{Q=X(q,"utf8")}catch{return!1}let V=new RegExp(`${z}[\\s\\S]*?${J}\\n?`);if(!V.test(Q))return!1;let Y=Q.replace(V,"").replace(/\n{3,}/g,`
|
|
313
|
-
|
|
314
|
-
`).trimStart();return R(q,Y),!0}function Pq(q,z,J){let Q=G(q,z);_(Q,{recursive:!0});let V=G(Q,"SKILL.md");return R(V,J),V}function p(q,z){return M(G(q,z,"SKILL.md"))}function Wq(q,z){let J=G(q,z);if(!M(J))return!1;return kq(J,{recursive:!0,force:!0}),!0}var I,Jq=`## Beacon (visual planning panel)
|
|
315
|
-
|
|
316
|
-
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
317
|
-
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
318
|
-
the user reviews on a canvas at /plan, and feedback flows back as the next round.
|
|
319
|
-
|
|
320
|
-
**When to invoke**
|
|
321
|
-
- User asks to "plan a feature" / "design a schema" \u2192 if the \`beacon_propose_plan\`
|
|
322
|
-
MCP tool is available, design the plan and call it. If it is NOT available, the panel
|
|
323
|
-
isn't wired in this repo \u2014 run \`beacon\` here once, then retry.
|
|
324
|
-
- User asks to "set up Beacon" / "map this repo" \u2192 invoke the \`beacon-init\` skill.
|
|
325
|
-
- User asks to "refresh Beacon" / "update the map" / "bring Beacon up to date" \u2192 invoke
|
|
326
|
-
the \`beacon-refresh\` skill. Re-surveys the repo and updates init-derived nodes while
|
|
327
|
-
preserving anything the user added by hand.
|
|
328
|
-
- User asks to "explain" / "teach me" / "walk me through" / "how does X work" \u2192 if the
|
|
329
|
-
\`beacon_explain\` MCP tool is available, author an interactive Lesson (a concept map +
|
|
330
|
-
plain-English narrative on /learn the user questions back) via the \`beacon-explain\` skill.
|
|
331
|
-
- Run \`beacon doctor\` to audit what's wired (global hooks, repo's .mcp.json, AGENTS.md block).
|
|
332
|
-
|
|
333
|
-
**The plan feedback loop**
|
|
334
|
-
\`beacon_propose_plan\` BLOCKS until the user clicks Approve / Discard / submits feedback.
|
|
335
|
-
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
336
|
-
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
337
|
-
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
338
|
-
verbatim. Do NOT implement until the tool returns approval.`;var Hq=b(()=>{I=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as Lq,renameSync as yq,rmSync as hq,writeFileSync as _q}from"fs";import{dirname as mq}from"path";function D(q,z){Lq(mq(q),{recursive:!0});let J=`${q}.tmp`;try{_q(J,z),yq(J,q)}catch(Q){throw hq(J,{force:!0}),Q}}function vz(q,z,J=!1){D(q,JSON.stringify(z,null,J?2:void 0))}var Bq=()=>{};var sq={};s(sq,{setupCodexAssets:()=>aq,removeCodexMcp:()=>xq,removeCodexArtifacts:()=>cq,hasCodexMcp:()=>c,ensureCodexMcp:()=>wq,codexMcpProblem:()=>lq,codexDetected:()=>Xq,auditCodex:()=>dq,CODEX_HOOKS:()=>E});import{readFileSync as F}from"fs";import{homedir as Sq}from"os";import{join as g}from"path";function vq(){return process.env.HOME||process.env.USERPROFILE||Sq()}function Xq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(l===void 0)l=Bun.which("codex")!==null;return l}function j(q){try{return Bun.TOML.parse(q)}catch{return null}}function c(){try{return Boolean(j(F(u(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function lq(){let q="";try{q=F(u(),"utf8")}catch{return null}let z=j(q);if(!z)return`~/.codex/config.toml does not parse \u2014 ${x}`;if(z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${x}`;return null}function wq(){let q="",z=!1;try{q=F(u(),"utf8"),z=!0}catch{}if(z){let Y=j(q);if(!Y)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${x}`};if(Y.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${x}`}}let J=!q?"":q.endsWith(`
|
|
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(`
|
|
339
340
|
`)?`
|
|
340
341
|
`:`
|
|
341
342
|
|
|
342
|
-
`,
|
|
343
|
-
`),J
|
|
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(`
|
|
344
345
|
`).replace(/\n{3,}/g,`
|
|
345
346
|
|
|
346
|
-
`).replace(/^\n+/,"");if(j(
|
|
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}
|
|
347
348
|
[mcp_servers.beacon]
|
|
348
|
-
command = "
|
|
349
|
+
command = "${x()}"
|
|
349
350
|
args = ["mcp"]
|
|
350
|
-
${
|
|
351
|
-
|
|
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};
|
|
@@ -0,0 +1,37 @@
|
|
|
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()}
|
|
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,`
|
|
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)
|
|
14
|
+
|
|
15
|
+
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
16
|
+
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
17
|
+
the user reviews on a canvas at /plan, and feedback flows back as the next round.
|
|
18
|
+
|
|
19
|
+
**When to invoke**
|
|
20
|
+
- User asks to "plan a feature" / "design a schema" \u2192 if the \`beacon_propose_plan\`
|
|
21
|
+
MCP tool is available, design the plan and call it. If it is NOT available, the panel
|
|
22
|
+
isn't wired in this repo \u2014 run \`beacon\` here once, then retry.
|
|
23
|
+
- User asks to "set up Beacon" / "map this repo" \u2192 invoke the \`beacon-init\` skill.
|
|
24
|
+
- User asks to "refresh Beacon" / "update the map" / "bring Beacon up to date" \u2192 invoke
|
|
25
|
+
the \`beacon-refresh\` skill. Re-surveys the repo and updates init-derived nodes while
|
|
26
|
+
preserving anything the user added by hand.
|
|
27
|
+
- User asks to "explain" / "teach me" / "walk me through" / "how does X work" \u2192 if the
|
|
28
|
+
\`beacon_explain\` MCP tool is available, author an interactive Lesson (a concept map +
|
|
29
|
+
plain-English narrative on /learn the user questions back) via the \`beacon-explain\` skill.
|
|
30
|
+
- Run \`beacon doctor\` to audit what's wired (global hooks, repo's .mcp.json, AGENTS.md block).
|
|
31
|
+
|
|
32
|
+
**The plan feedback loop**
|
|
33
|
+
\`beacon_propose_plan\` BLOCKS until the user clicks Approve / Discard / submits feedback.
|
|
34
|
+
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
35
|
+
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
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};
|
|
@@ -1,21 +1,56 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
`).
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
${
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`)
|
|
11
|
-
`),{
|
|
12
|
-
|
|
13
|
-
`)}
|
|
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}
|
|
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()}
|
|
6
|
+
|
|
7
|
+
${Z}
|
|
8
|
+
`:`${Z}
|
|
9
|
+
`,e(Gq(q),{recursive:!0}),C(q,$.endsWith(`
|
|
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,`
|
|
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)
|
|
14
|
+
|
|
15
|
+
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
16
|
+
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
17
|
+
the user reviews on a canvas at /plan, and feedback flows back as the next round.
|
|
18
|
+
|
|
19
|
+
**When to invoke**
|
|
20
|
+
- User asks to "plan a feature" / "design a schema" \u2192 if the \`beacon_propose_plan\`
|
|
21
|
+
MCP tool is available, design the plan and call it. If it is NOT available, the panel
|
|
22
|
+
isn't wired in this repo \u2014 run \`beacon\` here once, then retry.
|
|
23
|
+
- User asks to "set up Beacon" / "map this repo" \u2192 invoke the \`beacon-init\` skill.
|
|
24
|
+
- User asks to "refresh Beacon" / "update the map" / "bring Beacon up to date" \u2192 invoke
|
|
25
|
+
the \`beacon-refresh\` skill. Re-surveys the repo and updates init-derived nodes while
|
|
26
|
+
preserving anything the user added by hand.
|
|
27
|
+
- User asks to "explain" / "teach me" / "walk me through" / "how does X work" \u2192 if the
|
|
28
|
+
\`beacon_explain\` MCP tool is available, author an interactive Lesson (a concept map +
|
|
29
|
+
plain-English narrative on /learn the user questions back) via the \`beacon-explain\` skill.
|
|
30
|
+
- Run \`beacon doctor\` to audit what's wired (global hooks, repo's .mcp.json, AGENTS.md block).
|
|
31
|
+
|
|
32
|
+
**The plan feedback loop**
|
|
33
|
+
\`beacon_propose_plan\` BLOCKS until the user clicks Approve / Discard / submits feedback.
|
|
34
|
+
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
35
|
+
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
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(`
|
|
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()}
|
|
41
|
+
|
|
42
|
+
${bq}
|
|
43
|
+
`.trimStart(),H(Q,Y.endsWith(`
|
|
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($,`
|
|
14
49
|
`).replace(/\n{3,}/g,`
|
|
15
50
|
|
|
16
|
-
`).trimStart();
|
|
17
|
-
`)?
|
|
18
|
-
`),
|
|
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=`---
|
|
19
54
|
name: beacon-init
|
|
20
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.
|
|
21
56
|
---
|
|
@@ -62,7 +97,7 @@ beacon init-persist /tmp/beacon-init.json # or: beacon init-persist < /tmp/bea
|
|
|
62
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.
|
|
63
98
|
|
|
64
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.
|
|
65
|
-
`,
|
|
100
|
+
`,Qq=`---
|
|
66
101
|
name: beacon-refresh
|
|
67
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.
|
|
68
103
|
---
|
|
@@ -109,7 +144,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
109
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.
|
|
110
145
|
|
|
111
146
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
112
|
-
`,
|
|
147
|
+
`,Rq=`---
|
|
113
148
|
name: beacon-plan
|
|
114
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.
|
|
115
150
|
---
|
|
@@ -158,7 +193,7 @@ If it returns feedback, revise and call it again.
|
|
|
158
193
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
159
194
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
160
195
|
run \`beacon\` in this repo once.
|
|
161
|
-
`,
|
|
196
|
+
`,Fq=`---
|
|
162
197
|
name: beacon-explain
|
|
163
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".
|
|
164
199
|
---
|
|
@@ -228,7 +263,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
|
|
|
228
263
|
Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
|
|
229
264
|
the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
|
|
230
265
|
the lesson.
|
|
231
|
-
`,
|
|
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}
|
|
232
267
|
## Beacon \u2014 feature workflow
|
|
233
268
|
|
|
234
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:
|
|
@@ -300,52 +335,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
300
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.
|
|
301
336
|
|
|
302
337
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
303
|
-
${
|
|
304
|
-
`)
|
|
305
|
-
${Q.trim()}
|
|
306
|
-
${J}`,Y="";try{Y=j(q,"utf8")}catch{}let U=new RegExp(`${z}[\\s\\S]*?${J}`);Y=U.test(Y)?Y.replace(U,V):Y.trim()?`${Y.trim()}
|
|
307
|
-
|
|
308
|
-
${V}
|
|
309
|
-
`:`${V}
|
|
310
|
-
`,e(Bq(q),{recursive:!0}),T(q,Y.endsWith(`
|
|
311
|
-
`)?Y:`${Y}
|
|
312
|
-
`)}function N(q,z){try{return j(q,"utf8").includes(z)}catch{return!1}}function y(q,z,J){let Q="";try{Q=j(q,"utf8")}catch{return!1}let V=new RegExp(`${z}[\\s\\S]*?${J}\\n?`);if(!V.test(Q))return!1;let Y=Q.replace(V,"").replace(/\n{3,}/g,`
|
|
313
|
-
|
|
314
|
-
`).trimStart();return T(q,Y),!0}function k(q,z,J){let Q=v(q,z);e(Q,{recursive:!0});let V=v(Q,"SKILL.md");return T(V,J),V}function b(q,z){return R(v(q,z,"SKILL.md"))}function h(q,z){let J=v(q,z);if(!R(J))return!1;return lq(J,{recursive:!0,force:!0}),!0}var x,I=`## Beacon (visual planning panel)
|
|
315
|
-
|
|
316
|
-
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
317
|
-
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
318
|
-
the user reviews on a canvas at /plan, and feedback flows back as the next round.
|
|
319
|
-
|
|
320
|
-
**When to invoke**
|
|
321
|
-
- User asks to "plan a feature" / "design a schema" \u2192 if the \`beacon_propose_plan\`
|
|
322
|
-
MCP tool is available, design the plan and call it. If it is NOT available, the panel
|
|
323
|
-
isn't wired in this repo \u2014 run \`beacon\` here once, then retry.
|
|
324
|
-
- User asks to "set up Beacon" / "map this repo" \u2192 invoke the \`beacon-init\` skill.
|
|
325
|
-
- User asks to "refresh Beacon" / "update the map" / "bring Beacon up to date" \u2192 invoke
|
|
326
|
-
the \`beacon-refresh\` skill. Re-surveys the repo and updates init-derived nodes while
|
|
327
|
-
preserving anything the user added by hand.
|
|
328
|
-
- User asks to "explain" / "teach me" / "walk me through" / "how does X work" \u2192 if the
|
|
329
|
-
\`beacon_explain\` MCP tool is available, author an interactive Lesson (a concept map +
|
|
330
|
-
plain-English narrative on /learn the user questions back) via the \`beacon-explain\` skill.
|
|
331
|
-
- Run \`beacon doctor\` to audit what's wired (global hooks, repo's .mcp.json, AGENTS.md block).
|
|
332
|
-
|
|
333
|
-
**The plan feedback loop**
|
|
334
|
-
\`beacon_propose_plan\` BLOCKS until the user clicks Approve / Discard / submits feedback.
|
|
335
|
-
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
336
|
-
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
337
|
-
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
338
|
-
verbatim. Do NOT implement until the tool returns approval.`;var zq=G(()=>{x=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as oq,renameSync as eq,rmSync as qz,writeFileSync as zz}from"fs";import{dirname as Jz}from"path";function L(q,z){oq(Jz(q),{recursive:!0});let J=`${q}.tmp`;try{zz(J,z),eq(J,q)}catch(Q){throw qz(J,{force:!0}),Q}}function kz(q,z,J=!1){L(q,JSON.stringify(z,null,J?2:void 0))}var Kq=()=>{};var Iq={};Pq(Iq,{setupCodexAssets:()=>Zz,removeCodexMcp:()=>Tq,removeCodexArtifacts:()=>Wz,hasCodexMcp:()=>Yq,ensureCodexMcp:()=>Rq,codexMcpProblem:()=>Yz,codexDetected:()=>fq,auditCodex:()=>$z,CODEX_HOOKS:()=>c});import{readFileSync as S}from"fs";import{homedir as Qz}from"os";import{join as C}from"path";function uq(){return process.env.HOME||process.env.USERPROFILE||Qz()}function fq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(Jq===void 0)Jq=Bun.which("codex")!==null;return Jq}function u(q){try{return Bun.TOML.parse(q)}catch{return null}}function Yq(){try{return Boolean(u(S(B(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function Yz(){let q="";try{q=S(B(),"utf8")}catch{return null}let z=u(q);if(!z)return`~/.codex/config.toml does not parse \u2014 ${K}`;if(z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${K}`;return null}function Rq(){let q="",z=!1;try{q=S(B(),"utf8"),z=!0}catch{}if(z){let Y=u(q);if(!Y)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${K}`};if(Y.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${K}`}}let J=!q?"":q.endsWith(`
|
|
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(`
|
|
339
340
|
`)?`
|
|
340
341
|
`:`
|
|
341
342
|
|
|
342
|
-
`,
|
|
343
|
-
`),J
|
|
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(`
|
|
344
345
|
`).replace(/\n{3,}/g,`
|
|
345
346
|
|
|
346
|
-
`).replace(/^\n+/,"");if(
|
|
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}
|
|
347
348
|
[mcp_servers.beacon]
|
|
348
|
-
command = "
|
|
349
|
+
command = "${G()}"
|
|
349
350
|
args = ["mcp"]
|
|
350
|
-
${
|
|
351
|
-
|
|
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};
|