trybeacon 0.1.48 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +8 -8
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/db/arrange/route.js +1 -1
- package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +2 -2
- package/.next/server/app/docs.segments/_full.segment.rsc +2 -2
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
- package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
- package/.next/server/app/feedback.html +1 -1
- package/.next/server/app/feedback.rsc +2 -2
- package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
- package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
- package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
- package/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/.next/server/app/help.html +1 -1
- package/.next/server/app/help.rsc +2 -2
- package/.next/server/app/help.segments/_full.segment.rsc +2 -2
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +2 -2
- package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +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 +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/map/page.js +2 -2
- package/.next/server/app/map/page.js.nft.json +1 -1
- package/.next/server/app/map/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/plan/page.js +2 -2
- package/.next/server/app/plan/page.js.nft.json +1 -1
- package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +8 -8
- package/.next/server/chunks/1341.js +1 -1
- package/.next/server/chunks/2933.js +1 -1
- package/.next/server/chunks/{7208.js → 2999.js} +3 -3
- package/.next/server/chunks/7331.js +1 -0
- package/.next/server/chunks/9734.js +1 -1
- 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/3343-af1292b51a276724.js +1 -0
- package/.next/static/chunks/7323-480fb88e9d24f9e9.js +1 -0
- package/.next/static/chunks/app/map/page-66d71744ae3363d7.js +1 -0
- package/.next/static/chunks/app/page-541e900d67f17dae.js +1 -0
- package/.next/static/chunks/app/plan/page-e7d16fa2a3713a92.js +1 -0
- package/.next/static/css/629ab377241de9ca.css +1 -0
- package/.next/trace +39 -39
- package/.next/trace-build +1 -1
- package/dist/bin/beacon.js +7 -7
- package/dist/bin/doctor.js +27 -26
- package/dist/bin/hook.js +27 -26
- package/dist/bin/mcp.js +34 -33
- package/dist/bin/plan.js +29 -28
- package/dist/bin/remove.js +7 -7
- package/dist/bin/uninstall.js +26 -25
- package/dist/lib/assets.js +14 -13
- package/dist/lib/codex-install.js +24 -23
- package/dist/lib/global-install.js +24 -23
- package/package.json +1 -1
- package/.next/server/chunks/805.js +0 -1
- package/.next/static/chunks/8074-a6b2725786399e2c.js +0 -1
- package/.next/static/chunks/85-82015ecb44b65d3e.js +0 -1
- package/.next/static/chunks/app/map/page-c06fcf30d8172f82.js +0 -1
- package/.next/static/chunks/app/page-968dd5a6f667bff9.js +0 -1
- package/.next/static/chunks/app/plan/page-257d486640eadd7f.js +0 -1
- package/.next/static/css/5a58d83133d25695.css +0 -1
- /package/.next/static/{gNMdQmtkjPn6XQhRMDoMg → qeqVD-yeoYO_3C0pw9kHg}/_buildManifest.js +0 -0
- /package/.next/static/{gNMdQmtkjPn6XQhRMDoMg → qeqVD-yeoYO_3C0pw9kHg}/_ssgManifest.js +0 -0
package/dist/lib/assets.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var u=Object.defineProperty;var W=(z)=>z;function E(z,J){this[z]=W.bind(null,J)}var M=(z,J)=>{for(var q in J)u(z,q,{get:J[q],enumerable:!0,configurable:!0,set:E.bind(J,q)})};var A=(z,J)=>()=>(z&&(J=z(z=0)),J);var S=1500,s=480000,a=1800000,B=3600000,d=3000;var I=()=>{};var m={};M(m,{removeRepoAssets:()=>R,installRefreshSkill:()=>j,installPlanSkill:()=>L,installInitSkill:()=>K,installCodexRepoSkills:()=>g,ensureWorkflowDoc:()=>F,ensureMcp:()=>_,auditRepo:()=>h,REFRESH_SKILL:()=>P,PLAN_SKILL:()=>f,INIT_SKILL:()=>k});import{existsSync as D,mkdirSync as U,readFileSync as X,rmSync as C,writeFileSync as G}from"fs";import{join as Q}from"path";function K(z){let J=Q(z,".claude","skills","beacon-init");U(J,{recursive:!0});let q=Q(J,"SKILL.md");return G(q,k),q}function j(z){let J=Q(z,".claude","skills","beacon-refresh");U(J,{recursive:!0});let q=Q(J,"SKILL.md");return G(q,P),q}function L(z){let J=Q(z,".claude","skills","beacon-plan");U(J,{recursive:!0});let q=Q(J,"SKILL.md");return G(q,f),q}function g(z){let J=[];for(let q of O){let Y=Q(z,".agents","skills",q.name);U(Y,{recursive:!0});let $=Q(Y,"SKILL.md");G($,q.body()),J.push($)}return J}function F(z){let J=Q(z,"AGENTS.md"),q="";try{q=X(J,"utf8")}catch{}let Y=new RegExp(`${v}[\\s\\S]*?${b}`);q=Y.test(q)?q.replace(Y,T):`${q.trim()}
|
|
3
3
|
|
|
4
4
|
${T}
|
|
5
|
-
`.trimStart(),G(J,
|
|
6
|
-
`)?
|
|
7
|
-
`);let $=Q(
|
|
5
|
+
`.trimStart(),G(J,q.endsWith(`
|
|
6
|
+
`)?q:`${q}
|
|
7
|
+
`);let $=Q(z,"CLAUDE.md"),H="";try{H=X($,"utf8")}catch{}if(!/@AGENTS\.md/.test(H))G($,`${H?`${H.trim()}
|
|
8
8
|
|
|
9
9
|
`:""}@AGENTS.md
|
|
10
|
-
`)}function
|
|
11
|
-
`),{path:J,added:!0}
|
|
12
|
-
`)}}catch{}let
|
|
10
|
+
`)}function _(z){let J=Q(z,".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<B)return Y.timeout=B,G(J,JSON.stringify(q,null,2)+`
|
|
11
|
+
`),{path:J,added:!1,updated:!0};return{path:J,added:!1,updated:!1}}return q.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:B},G(J,JSON.stringify(q,null,2)+`
|
|
12
|
+
`),{path:J,added:!0,updated:!1}}function h(z){let J=Q(z,".mcp.json"),q=!1;try{q=!!JSON.parse(X(J,"utf8")).mcpServers?.beacon}catch{}let Y=!1;try{Y=X(Q(z,"AGENTS.md"),"utf8").includes(v)}catch{}let $=!1;try{$=/@AGENTS\.md/.test(X(Q(z,"CLAUDE.md"),"utf8"))}catch{}return{repo:z,mcpRegistered:q,agentsMdBlock:Y,claudeMdImport:$,skills:{"beacon-init":D(Q(z,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":D(Q(z,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":D(Q(z,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":D(Q(z,".agents","skills","beacon-refresh","SKILL.md"))}}}function R(z){let J=[];for(let V of["beacon-init","beacon-refresh","beacon-db-design"]){let Z=Q(z,".claude","skills",V);if(D(Z))C(Z,{recursive:!0,force:!0}),J.push(V)}for(let V of["beacon-init","beacon-refresh"]){let Z=Q(z,".agents","skills",V);if(D(Z))C(Z,{recursive:!0,force:!0}),J.push(`codex:${V}`)}let q=!1,Y=Q(z,".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)C(Y,{force:!0});else G(Y,JSON.stringify(V,null,2)+`
|
|
13
|
+
`)}}catch{}let $=!1,H=Q(z,"AGENTS.md");try{let V=X(H,"utf8"),Z=new RegExp(`\\n?${v}[\\s\\S]*?${b}\\n?`);if(Z.test(V)){let N=V.replace(Z,`
|
|
13
14
|
`).replace(/\n{3,}/g,`
|
|
14
15
|
|
|
15
|
-
`).trimStart();G(
|
|
16
|
+
`).trimStart();G(H,N.endsWith(`
|
|
16
17
|
`)?N:`${N}
|
|
17
|
-
`),$=!0}}catch{}let
|
|
18
|
+
`),$=!0}}catch{}let w=!1,x=Q(z,"CLAUDE.md");try{let V=X(x,"utf8"),Z=V.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(Z!==V){if(!Z.trim())C(x,{force:!0});else G(x,Z);w=!0}}catch{}return{skillsRemoved:J,mcpUnregistered:q,agentsBlockRemoved:$,claudeImportRemoved:w}}var k=`---
|
|
18
19
|
name: beacon-init
|
|
19
20
|
description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
|
|
20
21
|
---
|
|
@@ -53,7 +54,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
53
54
|
If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
|
|
54
55
|
|
|
55
56
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
56
|
-
`,
|
|
57
|
+
`,P=`---
|
|
57
58
|
name: beacon-refresh
|
|
58
59
|
description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
|
|
59
60
|
---
|
|
@@ -100,7 +101,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
100
101
|
If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
|
|
101
102
|
|
|
102
103
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
103
|
-
`,
|
|
104
|
+
`,f=`---
|
|
104
105
|
name: beacon-plan
|
|
105
106
|
description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
|
|
106
107
|
---
|
|
@@ -148,7 +149,7 @@ If it returns feedback, revise and call it again.
|
|
|
148
149
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
149
150
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
150
151
|
run \`beacon\` in this repo once.
|
|
151
|
-
`,
|
|
152
|
+
`,O,v="<!-- beacon:workflow:start -->",b="<!-- beacon:workflow:end -->",T;var y=A(()=>{I();O=[{name:"beacon-init",body:()=>k},{name:"beacon-refresh",body:()=>P}];T=`${v}
|
|
152
153
|
## Beacon \u2014 feature workflow
|
|
153
154
|
|
|
154
155
|
This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
|
|
@@ -206,4 +207,4 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
206
207
|
If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
|
|
207
208
|
|
|
208
209
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
209
|
-
${
|
|
210
|
+
${b}`});y();export{R as removeRepoAssets,j as installRefreshSkill,L as installPlanSkill,K as installInitSkill,g as installCodexRepoSkills,F as ensureWorkflowDoc,_ as ensureMcp,h as auditRepo,P as REFRESH_SKILL,f as PLAN_SKILL,k as INIT_SKILL};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var bq=Object.defineProperty;var uq=(q)=>q;function wq(q,z){this[q]=uq.bind(null,z)}var d=(q,z)=>{for(var J in z)bq(q,J,{get:z[J],enumerable:!0,configurable:!0,set:wq.bind(z,J)})};var X=(q,z)=>()=>(q&&(z=q(q=0)),z);var lq=1500,dq=480000,sq=1800000,w=3600000,cq=3000;var s=()=>{};var n={};d(n,{removeRepoAssets:()=>Dq,installRefreshSkill:()=>gq,installPlanSkill:()=>Kq,installInitSkill:()=>jq,installCodexRepoSkills:()=>Nq,ensureWorkflowDoc:()=>Mq,ensureMcp:()=>fq,auditRepo:()=>Rq,REFRESH_SKILL:()=>L,PLAN_SKILL:()=>t,INIT_SKILL:()=>E});import{existsSync as v,mkdirSync as g,readFileSync as H,rmSync as j,writeFileSync as W}from"fs";import{join as $}from"path";function jq(q){let z=$(q,".claude","skills","beacon-init");g(z,{recursive:!0});let J=$(z,"SKILL.md");return W(J,E),J}function gq(q){let z=$(q,".claude","skills","beacon-refresh");g(z,{recursive:!0});let J=$(z,"SKILL.md");return W(J,L),J}function Kq(q){let z=$(q,".claude","skills","beacon-plan");g(z,{recursive:!0});let J=$(z,"SKILL.md");return W(J,t),J}function Nq(q){let z=[];for(let J of Cq){let Q=$(q,".agents","skills",J.name);g(Q,{recursive:!0});let V=$(Q,"SKILL.md");W(V,J.body()),z.push(V)}return z}function Mq(q){let z=$(q,"AGENTS.md"),J="";try{J=H(z,"utf8")}catch{}let Q=new RegExp(`${K}[\\s\\S]*?${y}`);J=Q.test(J)?J.replace(Q,c):`${J.trim()}
|
|
3
3
|
|
|
4
|
-
${
|
|
5
|
-
`.trimStart(),
|
|
4
|
+
${c}
|
|
5
|
+
`.trimStart(),W(z,J.endsWith(`
|
|
6
6
|
`)?J:`${J}
|
|
7
|
-
`);let V=$(q,"CLAUDE.md"),Y="";try{Y=
|
|
7
|
+
`);let V=$(q,"CLAUDE.md"),Y="";try{Y=H(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))W(V,`${Y?`${Y.trim()}
|
|
8
8
|
|
|
9
9
|
`:""}@AGENTS.md
|
|
10
|
-
`)}function
|
|
11
|
-
`),{path:z,added:!0}
|
|
12
|
-
`)}}catch{}let
|
|
10
|
+
`)}function fq(q){let z=$(q,".mcp.json"),J={};try{J=JSON.parse(H(z,"utf8"))}catch{}J.mcpServers=J.mcpServers??{};let Q=J.mcpServers.beacon;if(Q){if(!Q.timeout||Q.timeout<w)return Q.timeout=w,W(z,JSON.stringify(J,null,2)+`
|
|
11
|
+
`),{path:z,added:!1,updated:!0};return{path:z,added:!1,updated:!1}}return J.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:w},W(z,JSON.stringify(J,null,2)+`
|
|
12
|
+
`),{path:z,added:!0,updated:!1}}function Rq(q){let z=$(q,".mcp.json"),J=!1;try{J=!!JSON.parse(H(z,"utf8")).mcpServers?.beacon}catch{}let Q=!1;try{Q=H($(q,"AGENTS.md"),"utf8").includes(K)}catch{}let V=!1;try{V=/@AGENTS\.md/.test(H($(q,"CLAUDE.md"),"utf8"))}catch{}return{repo:q,mcpRegistered:J,agentsMdBlock:Q,claudeMdImport:V,skills:{"beacon-init":v($(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v($(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v($(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v($(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function Dq(q){let z=[];for(let Z of["beacon-init","beacon-refresh","beacon-db-design"]){let P=$(q,".claude","skills",Z);if(v(P))j(P,{recursive:!0,force:!0}),z.push(Z)}for(let Z of["beacon-init","beacon-refresh"]){let P=$(q,".agents","skills",Z);if(v(P))j(P,{recursive:!0,force:!0}),z.push(`codex:${Z}`)}let J=!1,Q=$(q,".mcp.json");try{let Z=JSON.parse(H(Q,"utf8"));if(Z.mcpServers?.beacon){if(delete Z.mcpServers.beacon,J=!0,Z.mcpServers&&Object.keys(Z.mcpServers).length===0)delete Z.mcpServers;if(Object.keys(Z).length===0)j(Q,{force:!0});else W(Q,JSON.stringify(Z,null,2)+`
|
|
13
|
+
`)}}catch{}let V=!1,Y=$(q,"AGENTS.md");try{let Z=H(Y,"utf8"),P=new RegExp(`\\n?${K}[\\s\\S]*?${y}\\n?`);if(P.test(Z)){let k=Z.replace(P,`
|
|
13
14
|
`).replace(/\n{3,}/g,`
|
|
14
15
|
|
|
15
|
-
`).trimStart();
|
|
16
|
-
`)?
|
|
17
|
-
`),V=!0}}catch{}let U=!1,
|
|
16
|
+
`).trimStart();W(Y,k.endsWith(`
|
|
17
|
+
`)?k:`${k}
|
|
18
|
+
`),V=!0}}catch{}let U=!1,B=$(q,"CLAUDE.md");try{let Z=H(B,"utf8"),P=Z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==Z){if(!P.trim())j(B,{force:!0});else W(B,P);U=!0}}catch{}return{skillsRemoved:z,mcpUnregistered:J,agentsBlockRemoved:V,claudeImportRemoved:U}}var E=`---
|
|
18
19
|
name: beacon-init
|
|
19
20
|
description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
|
|
20
21
|
---
|
|
@@ -53,7 +54,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
53
54
|
If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
|
|
54
55
|
|
|
55
56
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
56
|
-
`,
|
|
57
|
+
`,L=`---
|
|
57
58
|
name: beacon-refresh
|
|
58
59
|
description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
|
|
59
60
|
---
|
|
@@ -148,7 +149,7 @@ If it returns feedback, revise and call it again.
|
|
|
148
149
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
149
150
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
150
151
|
run \`beacon\` in this repo once.
|
|
151
|
-
`,
|
|
152
|
+
`,Cq,K="<!-- beacon:workflow:start -->",y="<!-- beacon:workflow:end -->",c;var r=X(()=>{s();Cq=[{name:"beacon-init",body:()=>E},{name:"beacon-refresh",body:()=>L}];c=`${K}
|
|
152
153
|
## Beacon \u2014 feature workflow
|
|
153
154
|
|
|
154
155
|
This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
|
|
@@ -206,18 +207,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
206
207
|
If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
|
|
207
208
|
|
|
208
209
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
209
|
-
${
|
|
210
|
-
`)}function
|
|
210
|
+
${y}`});import{existsSync as i,mkdirSync as O,readFileSync as N,rmSync as Iq,writeFileSync as M}from"fs";import{dirname as o,join as C}from"path";function h(q){try{return JSON.parse(N(q,"utf8"))}catch{return{}}}function qq(q,z){O(o(q),{recursive:!0}),M(q,JSON.stringify(z,null,2)+`
|
|
211
|
+
`)}function zq(q,z){let J=h(q);J.hooks=J.hooks??{},J.hooks[z.event]=J.hooks[z.event]??[];let Q=J.hooks[z.event];if(Q.some((Y)=>Y.matcher===z.matcher&&Y.hooks?.some((U)=>U.command===z.command)))return!1;return Q.push({matcher:z.matcher,hooks:[{type:"command",command:z.command}]}),qq(q,J),!0}function Jq(q,z){return(h(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function Qq(q,z){let J=h(q),Q=J.hooks?.[z.event];if(!Q)return!1;let V=!1,Y=Q.map((U)=>{let B=U.hooks?.length??0,Z=(U.hooks??[]).filter((P)=>P.command!==z.command);if(Z.length!==B)V=!0;return{...U,hooks:Z}}).filter((U)=>(U.hooks??[]).length>0);if(!V)return!1;if(Y.length)J.hooks[z.event]=Y;else delete J.hooks[z.event];if(J.hooks&&Object.keys(J.hooks).length===0)delete J.hooks;return qq(q,J),!0}function Vq(q,z,J,Q){let V=`${z}
|
|
211
212
|
${Q.trim()}
|
|
212
213
|
${J}`,Y="";try{Y=N(q,"utf8")}catch{}let U=new RegExp(`${z}[\\s\\S]*?${J}`);Y=U.test(Y)?Y.replace(U,V):Y.trim()?`${Y.trim()}
|
|
213
214
|
|
|
214
215
|
${V}
|
|
215
216
|
`:`${V}
|
|
216
|
-
`,
|
|
217
|
+
`,O(o(q),{recursive:!0}),M(q,Y.endsWith(`
|
|
217
218
|
`)?Y:`${Y}
|
|
218
|
-
`)}function
|
|
219
|
+
`)}function _(q,z){try{return N(q,"utf8").includes(z)}catch{return!1}}function Yq(q,z,J){let Q="";try{Q=N(q,"utf8")}catch{return!1}let V=new RegExp(`${z}[\\s\\S]*?${J}\\n?`);if(!V.test(Q))return!1;let Y=Q.replace(V,"").replace(/\n{3,}/g,`
|
|
219
220
|
|
|
220
|
-
`).trimStart();return
|
|
221
|
+
`).trimStart();return M(q,Y),!0}function Zq(q,z,J){let Q=C(q,z);O(Q,{recursive:!0});let V=C(Q,"SKILL.md");return M(V,J),V}function m(q,z){return i(C(q,z,"SKILL.md"))}function $q(q,z){let J=C(q,z);if(!i(J))return!1;return Iq(J,{recursive:!0,force:!0}),!0}var f,e=`## Beacon (visual planning panel)
|
|
221
222
|
|
|
222
223
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
223
224
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -238,17 +239,17 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
238
239
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
239
240
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
240
241
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
241
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
242
|
+
verbatim. Do NOT implement until the tool returns approval.`;var Uq=X(()=>{f=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as Aq,renameSync as Tq,rmSync as Fq,writeFileSync as kq}from"fs";import{dirname as Eq}from"path";function R(q,z){Aq(Eq(q),{recursive:!0});let J=`${q}.tmp`;try{kq(J,z),Tq(J,q)}catch(Q){throw Fq(J,{force:!0}),Q}}function Qz(q,z,J=!1){R(q,JSON.stringify(z,null,J?2:void 0))}var Pq=()=>{};var Sq={};d(Sq,{setupCodexAssets:()=>hq,removeCodexMcp:()=>Gq,removeCodexArtifacts:()=>mq,hasCodexMcp:()=>l,ensureCodexMcp:()=>Xq,codexMcpProblem:()=>Oq,codexDetected:()=>Bq,auditCodex:()=>_q,CODEX_HOOKS:()=>F});import{readFileSync as T}from"fs";import{homedir as Lq}from"os";import{join as u}from"path";function Wq(){return process.env.HOME||process.env.USERPROFILE||Lq()}function Bq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(S===void 0)S=Bun.which("codex")!==null;return S}function b(q){try{return Bun.TOML.parse(q)}catch{return null}}function l(){try{return Boolean(b(T(x(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function Oq(){let q="";try{q=T(x(),"utf8")}catch{return null}let z=b(q);if(!z)return`~/.codex/config.toml does not parse \u2014 ${G}`;if(z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${G}`;return null}function Xq(){let q="",z=!1;try{q=T(x(),"utf8"),z=!0}catch{}if(z){let Y=b(q);if(!Y)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${G}`};if(Y.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${G}`}}let J=!q?"":q.endsWith(`
|
|
242
243
|
`)?`
|
|
243
244
|
`:`
|
|
244
245
|
|
|
245
|
-
`,Q=q+J+
|
|
246
|
-
`),J=z.indexOf(
|
|
246
|
+
`,Q=q+J+yq;if(b(Q)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${G}`};return R(x(),Q),{added:!0}}function Gq(){let q="";try{q=T(x(),"utf8")}catch{return{removed:!1}}let z=q.split(`
|
|
247
|
+
`),J=z.indexOf(vq);if(J===-1)return{removed:!1,skipped:l()};let Q=z.indexOf(xq,J);if(Q===-1)return{removed:!1,skipped:!0};z.splice(J,Q-J+1);let V=z.join(`
|
|
247
248
|
`).replace(/\n{3,}/g,`
|
|
248
249
|
|
|
249
|
-
`).replace(/^\n+/,"");if(
|
|
250
|
+
`).replace(/^\n+/,"");if(b(V)===null)return{removed:!1,skipped:!0};return R(x(),V),{removed:!0}}async function hq(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (r(),n)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let Z of f){if(!m(I(),Z))V.push(Z);Zq(I(),Z,Q[Z])}let Y=0;for(let Z of F)if(zq(a(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let U=_(D(),A);Vq(D(),A,Hq,e);let B=Xq();return{skillsAdded:V,hooksAdded:Y,agentsMdBlockTouched:!U,mcp:B}}function _q(){let q={};for(let J of f)q[J]=m(I(),J);let z={};for(let J of F)z[J.event]=Jq(a(),{event:J.event,command:J.command});return{detected:Bq(),skills:q,hooks:z,agentsMdBlock:_(D(),A),mcp:l()}}function mq(){let q=[];for(let V of f)if($q(I(),V))q.push(V);let z=0;for(let V of F)if(Qq(a(),{event:V.event,command:V.command}))z++;let J=Yq(D(),A,Hq),Q=Gq();return{skillsRemoved:q,hooksRemoved:z,agentsMdBlockRemoved:J,mcpRemoved:Q.removed,mcpSkipped:Q.skipped}}var p=()=>u(Wq(),".codex"),a=()=>u(p(),"hooks.json"),x=()=>u(p(),"config.toml"),D=()=>u(p(),"AGENTS.md"),I=()=>u(Wq(),".agents","skills"),A="<!-- beacon:global:start -->",Hq="<!-- beacon:global:end -->",F,S,vq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",xq="# beacon:end",yq,G="add it manually: codex mcp add beacon -- beacon mcp";var pq=X(()=>{Uq();Pq();F=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];yq=`${vq}
|
|
250
251
|
[mcp_servers.beacon]
|
|
251
252
|
command = "beacon"
|
|
252
253
|
args = ["mcp"]
|
|
253
|
-
${
|
|
254
|
-
`});
|
|
254
|
+
${xq}
|
|
255
|
+
`});pq();export{hq as setupCodexAssets,Gq as removeCodexMcp,mq as removeCodexArtifacts,l as hasCodexMcp,Xq as ensureCodexMcp,Oq as codexMcpProblem,Bq as codexDetected,_q as auditCodex,F as CODEX_HOOKS};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var Tq=Object.defineProperty;var Iq=(q)=>q;function yq(q,z){this[q]=Iq.bind(null,z)}var Wq=(q,z)=>{for(var J in z)Tq(q,J,{get:z[J],enumerable:!0,configurable:!0,set:yq.bind(z,J)})};var j=(q,z)=>()=>(q&&(z=q(q=0)),z);var xz=1500,Hz=480000,wz=1800000,b=3600000,vz=3000;var Xq=()=>{};var s={};Wq(s,{removeRepoAssets:()=>mq,installRefreshSkill:()=>Aq,installPlanSkill:()=>Eq,installInitSkill:()=>Dq,installCodexRepoSkills:()=>kq,ensureWorkflowDoc:()=>hq,ensureMcp:()=>Lq,auditRepo:()=>_q,REFRESH_SKILL:()=>n,PLAN_SKILL:()=>xq,INIT_SKILL:()=>d});import{existsSync as w,mkdirSync as f,readFileSync as x,rmSync as K,writeFileSync as U}from"fs";import{join as $}from"path";function Dq(q){let z=$(q,".claude","skills","beacon-init");f(z,{recursive:!0});let J=$(z,"SKILL.md");return U(J,d),J}function Aq(q){let z=$(q,".claude","skills","beacon-refresh");f(z,{recursive:!0});let J=$(z,"SKILL.md");return U(J,n),J}function Eq(q){let z=$(q,".claude","skills","beacon-plan");f(z,{recursive:!0});let J=$(z,"SKILL.md");return U(J,xq),J}function kq(q){let z=[];for(let J of Oq){let Q=$(q,".agents","skills",J.name);f(Q,{recursive:!0});let V=$(Q,"SKILL.md");U(V,J.body()),z.push(V)}return z}function hq(q){let z=$(q,"AGENTS.md"),J="";try{J=x(z,"utf8")}catch{}let Q=new RegExp(`${C}[\\s\\S]*?${r}`);J=Q.test(J)?J.replace(Q,Uq):`${J.trim()}
|
|
3
3
|
|
|
4
|
-
${
|
|
5
|
-
`.trimStart(),
|
|
4
|
+
${Uq}
|
|
5
|
+
`.trimStart(),U(z,J.endsWith(`
|
|
6
6
|
`)?J:`${J}
|
|
7
|
-
`);let V=$(q,"CLAUDE.md"),Y="";try{Y=
|
|
7
|
+
`);let V=$(q,"CLAUDE.md"),Y="";try{Y=x(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))U(V,`${Y?`${Y.trim()}
|
|
8
8
|
|
|
9
9
|
`:""}@AGENTS.md
|
|
10
|
-
`)}function
|
|
11
|
-
`),{path:z,added:!0}
|
|
12
|
-
`)}}catch{}let
|
|
10
|
+
`)}function Lq(q){let z=$(q,".mcp.json"),J={};try{J=JSON.parse(x(z,"utf8"))}catch{}J.mcpServers=J.mcpServers??{};let Q=J.mcpServers.beacon;if(Q){if(!Q.timeout||Q.timeout<b)return Q.timeout=b,U(z,JSON.stringify(J,null,2)+`
|
|
11
|
+
`),{path:z,added:!1,updated:!0};return{path:z,added:!1,updated:!1}}return J.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:b},U(z,JSON.stringify(J,null,2)+`
|
|
12
|
+
`),{path:z,added:!0,updated:!1}}function _q(q){let z=$(q,".mcp.json"),J=!1;try{J=!!JSON.parse(x(z,"utf8")).mcpServers?.beacon}catch{}let Q=!1;try{Q=x($(q,"AGENTS.md"),"utf8").includes(C)}catch{}let V=!1;try{V=/@AGENTS\.md/.test(x($(q,"CLAUDE.md"),"utf8"))}catch{}return{repo:q,mcpRegistered:J,agentsMdBlock:Q,claudeMdImport:V,skills:{"beacon-init":w($(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":w($(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":w($(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":w($(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function mq(q){let z=[];for(let Z of["beacon-init","beacon-refresh","beacon-db-design"]){let X=$(q,".claude","skills",Z);if(w(X))K(X,{recursive:!0,force:!0}),z.push(Z)}for(let Z of["beacon-init","beacon-refresh"]){let X=$(q,".agents","skills",Z);if(w(X))K(X,{recursive:!0,force:!0}),z.push(`codex:${Z}`)}let J=!1,Q=$(q,".mcp.json");try{let Z=JSON.parse(x(Q,"utf8"));if(Z.mcpServers?.beacon){if(delete Z.mcpServers.beacon,J=!0,Z.mcpServers&&Object.keys(Z.mcpServers).length===0)delete Z.mcpServers;if(Object.keys(Z).length===0)K(Q,{force:!0});else U(Q,JSON.stringify(Z,null,2)+`
|
|
13
|
+
`)}}catch{}let V=!1,Y=$(q,"AGENTS.md");try{let Z=x(Y,"utf8"),X=new RegExp(`\\n?${C}[\\s\\S]*?${r}\\n?`);if(X.test(Z)){let t=Z.replace(X,`
|
|
13
14
|
`).replace(/\n{3,}/g,`
|
|
14
15
|
|
|
15
|
-
`).trimStart();
|
|
16
|
+
`).trimStart();U(Y,t.endsWith(`
|
|
16
17
|
`)?t:`${t}
|
|
17
|
-
`),V=!0}}catch{}let P=!1,W=$(q,"CLAUDE.md");try{let Z=
|
|
18
|
+
`),V=!0}}catch{}let P=!1,W=$(q,"CLAUDE.md");try{let Z=x(W,"utf8"),X=Z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(X!==Z){if(!X.trim())K(W,{force:!0});else U(W,X);P=!0}}catch{}return{skillsRemoved:z,mcpUnregistered:J,agentsBlockRemoved:V,claudeImportRemoved:P}}var d=`---
|
|
18
19
|
name: beacon-init
|
|
19
20
|
description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
|
|
20
21
|
---
|
|
@@ -53,7 +54,7 @@ A single \`beacon_init_persist\` MCP tool call with:
|
|
|
53
54
|
If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
|
|
54
55
|
|
|
55
56
|
After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
56
|
-
`,
|
|
57
|
+
`,n=`---
|
|
57
58
|
name: beacon-refresh
|
|
58
59
|
description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
|
|
59
60
|
---
|
|
@@ -100,7 +101,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
100
101
|
If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
|
|
101
102
|
|
|
102
103
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
103
|
-
`,
|
|
104
|
+
`,xq=`---
|
|
104
105
|
name: beacon-plan
|
|
105
106
|
description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
|
|
106
107
|
---
|
|
@@ -148,7 +149,7 @@ If it returns feedback, revise and call it again.
|
|
|
148
149
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
149
150
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
150
151
|
run \`beacon\` in this repo once.
|
|
151
|
-
`,
|
|
152
|
+
`,Oq,C="<!-- beacon:workflow:start -->",r="<!-- beacon:workflow:end -->",Uq;var l=j(()=>{Xq();Oq=[{name:"beacon-init",body:()=>d},{name:"beacon-refresh",body:()=>n}];Uq=`${C}
|
|
152
153
|
## Beacon \u2014 feature workflow
|
|
153
154
|
|
|
154
155
|
This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
|
|
@@ -206,18 +207,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
206
207
|
If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
|
|
207
208
|
|
|
208
209
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
209
|
-
${
|
|
210
|
-
`)}function
|
|
210
|
+
${r}`});import{existsSync as Hq,mkdirSync as i,readFileSync as M,rmSync as pq,writeFileSync as R}from"fs";import{dirname as wq,join as F}from"path";function o(q){try{return JSON.parse(M(q,"utf8"))}catch{return{}}}function vq(q,z){i(wq(q),{recursive:!0}),R(q,JSON.stringify(z,null,2)+`
|
|
211
|
+
`)}function I(q,z){let J=o(q);J.hooks=J.hooks??{},J.hooks[z.event]=J.hooks[z.event]??[];let Q=J.hooks[z.event];if(Q.some((Y)=>Y.matcher===z.matcher&&Y.hooks?.some((P)=>P.command===z.command)))return!1;return Q.push({matcher:z.matcher,hooks:[{type:"command",command:z.command}]}),vq(q,J),!0}function y(q,z){return(o(q).hooks?.[z.event]??[]).some((V)=>V.hooks?.some((Y)=>Y.command===z.command))}function D(q,z){let J=o(q),Q=J.hooks?.[z.event];if(!Q)return!1;let V=!1,Y=Q.map((P)=>{let W=P.hooks?.length??0,Z=(P.hooks??[]).filter((X)=>X.command!==z.command);if(Z.length!==W)V=!0;return{...P,hooks:Z}}).filter((P)=>(P.hooks??[]).length>0);if(!V)return!1;if(Y.length)J.hooks[z.event]=Y;else delete J.hooks[z.event];if(J.hooks&&Object.keys(J.hooks).length===0)delete J.hooks;return vq(q,J),!0}function A(q,z,J,Q){let V=`${z}
|
|
211
212
|
${Q.trim()}
|
|
212
213
|
${J}`,Y="";try{Y=M(q,"utf8")}catch{}let P=new RegExp(`${z}[\\s\\S]*?${J}`);Y=P.test(Y)?Y.replace(P,V):Y.trim()?`${Y.trim()}
|
|
213
214
|
|
|
214
215
|
${V}
|
|
215
216
|
`:`${V}
|
|
216
|
-
`,
|
|
217
|
+
`,i(wq(q),{recursive:!0}),R(q,Y.endsWith(`
|
|
217
218
|
`)?Y:`${Y}
|
|
218
|
-
`)}function
|
|
219
|
+
`)}function g(q,z){try{return M(q,"utf8").includes(z)}catch{return!1}}function E(q,z,J){let Q="";try{Q=M(q,"utf8")}catch{return!1}let V=new RegExp(`${z}[\\s\\S]*?${J}\\n?`);if(!V.test(Q))return!1;let Y=Q.replace(V,"").replace(/\n{3,}/g,`
|
|
219
220
|
|
|
220
|
-
`).trimStart();return
|
|
221
|
+
`).trimStart();return R(q,Y),!0}function O(q,z,J){let Q=F(q,z);i(Q,{recursive:!0});let V=F(Q,"SKILL.md");return R(V,J),V}function B(q,z){return Hq(F(q,z,"SKILL.md"))}function k(q,z){let J=F(q,z);if(!Hq(J))return!1;return pq(J,{recursive:!0,force:!0}),!0}var H,T=`## Beacon (visual planning panel)
|
|
221
222
|
|
|
222
223
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
223
224
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -238,17 +239,17 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
238
239
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
239
240
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
240
241
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
241
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
242
|
+
verbatim. Do NOT implement until the tool returns approval.`;var e=j(()=>{H=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as Sq,renameSync as aq,rmSync as cq,writeFileSync as tq}from"fs";import{dirname as dq}from"path";function h(q,z){Sq(dq(q),{recursive:!0});let J=`${q}.tmp`;try{tq(J,z),aq(J,q)}catch(Q){throw cq(J,{force:!0}),Q}}function Cz(q,z,J=!1){h(q,JSON.stringify(z,null,J?2:void 0))}var jq=()=>{};var fq={};Wq(fq,{setupCodexAssets:()=>lq,removeCodexMcp:()=>Kq,removeCodexArtifacts:()=>oq,hasCodexMcp:()=>Qq,ensureCodexMcp:()=>bq,codexMcpProblem:()=>sq,codexDetected:()=>uq,auditCodex:()=>iq,CODEX_HOOKS:()=>S});import{readFileSync as p}from"fs";import{homedir as nq}from"os";import{join as G}from"path";function gq(){return process.env.HOME||process.env.USERPROFILE||nq()}function uq(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(qq===void 0)qq=Bun.which("codex")!==null;return qq}function N(q){try{return Bun.TOML.parse(q)}catch{return null}}function Qq(){try{return Boolean(N(p(v(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function sq(){let q="";try{q=p(v(),"utf8")}catch{return null}let z=N(q);if(!z)return`~/.codex/config.toml does not parse \u2014 ${u}`;if(z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(q))return`mcp_servers is an inline table \u2014 ${u}`;return null}function bq(){let q="",z=!1;try{q=p(v(),"utf8"),z=!0}catch{}if(z){let Y=N(q);if(!Y)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${u}`};if(Y.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${u}`}}let J=!q?"":q.endsWith(`
|
|
242
243
|
`)?`
|
|
243
244
|
`:`
|
|
244
245
|
|
|
245
|
-
`,Q=q+J+
|
|
246
|
-
`),J=z.indexOf(
|
|
246
|
+
`,Q=q+J+rq;if(N(Q)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${u}`};return h(v(),Q),{added:!0}}function Kq(){let q="";try{q=p(v(),"utf8")}catch{return{removed:!1}}let z=q.split(`
|
|
247
|
+
`),J=z.indexOf(Nq);if(J===-1)return{removed:!1,skipped:Qq()};let Q=z.indexOf(Gq,J);if(Q===-1)return{removed:!1,skipped:!0};z.splice(J,Q-J+1);let V=z.join(`
|
|
247
248
|
`).replace(/\n{3,}/g,`
|
|
248
249
|
|
|
249
|
-
`).replace(/^\n+/,"");if(
|
|
250
|
+
`).replace(/^\n+/,"");if(N(V)===null)return{removed:!1,skipped:!0};return h(v(),V),{removed:!0}}async function lq(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (l(),s)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let Z of H){if(!B(_(),Z))V.push(Z);O(_(),Z,Q[Z])}let Y=0;for(let Z of S)if(I(Jq(),{event:Z.event,matcher:Z.matcher,command:Z.command}))Y++;let P=g(L(),m);A(L(),m,Bq,T);let W=bq();return{skillsAdded:V,hooksAdded:Y,agentsMdBlockTouched:!P,mcp:W}}function iq(){let q={};for(let J of H)q[J]=B(_(),J);let z={};for(let J of S)z[J.event]=y(Jq(),{event:J.event,command:J.command});return{detected:uq(),skills:q,hooks:z,agentsMdBlock:g(L(),m),mcp:Qq()}}function oq(){let q=[];for(let V of H)if(k(_(),V))q.push(V);let z=0;for(let V of S)if(D(Jq(),{event:V.event,command:V.command}))z++;let J=E(L(),m,Bq),Q=Kq();return{skillsRemoved:q,hooksRemoved:z,agentsMdBlockRemoved:J,mcpRemoved:Q.removed,mcpSkipped:Q.skipped}}var zq=()=>G(gq(),".codex"),Jq=()=>G(zq(),"hooks.json"),v=()=>G(zq(),"config.toml"),L=()=>G(zq(),"AGENTS.md"),_=()=>G(gq(),".agents","skills"),m="<!-- beacon:global:start -->",Bq="<!-- beacon:global:end -->",S,qq,Nq="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",Gq="# beacon:end",rq,u="add it manually: codex mcp add beacon -- beacon mcp";var Cq=j(()=>{e();jq();S=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];rq=`${Nq}
|
|
250
251
|
[mcp_servers.beacon]
|
|
251
252
|
command = "beacon"
|
|
252
253
|
args = ["mcp"]
|
|
253
|
-
${
|
|
254
|
-
`});
|
|
254
|
+
${Gq}
|
|
255
|
+
`});e();import{existsSync as eq}from"fs";import{homedir as qz}from"os";import{join as a}from"path";function zz(){return process.env.HOME||process.env.USERPROFILE||qz()}var c=()=>a(zz(),".claude"),Vq=()=>a(c(),"skills"),Yq=()=>a(c(),"settings.json"),Zq=()=>a(c(),"CLAUDE.md"),$q="<!-- beacon:global:start -->",Fq="<!-- beacon:global:end -->";var Jz=T,Pq=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract (when the scope-guard flag is on): in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. No-op + fail-open otherwise."},{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function Qz(q,z){return O(Vq(),q,z)}function Mq(q){return B(Vq(),q)}function Vz(q){return k(Vq(),q)}function Yz(q){return I(Yq(),q)}function Zz(q){return y(Yq(),q)}function $z(q){return D(Yq(),q)}function Pz(q){A(Zq(),$q,Fq,q)}function Rq(){return g(Zq(),$q)}function Wz(){return E(Zq(),$q,Fq)}function kz(){let q={};for(let J of H)q[J]=Mq(J);let z={};for(let J of Pq)z[J.event]=Zz({event:J.event,command:J.command});return{homeExists:eq(c()),skills:q,hooks:z,claudeMdBlock:Rq()}}async function Xz(){let{INIT_SKILL:q,REFRESH_SKILL:z,PLAN_SKILL:J}=await Promise.resolve().then(() => (l(),s)),Q={"beacon-init":q,"beacon-refresh":z,"beacon-plan":J},V=[];for(let W of H){if(!Mq(W))V.push(W);Qz(W,Q[W])}let Y=0;for(let W of Pq)if(Yz({event:W.event,matcher:W.matcher,command:W.command}))Y++;let P=Rq();return Pz(Jz),{skillsAdded:V,hooksAdded:Y,claudeMdBlockTouched:!P}}async function hz(){let q;try{q={ok:!0,...await Xz()}}catch(z){q={ok:!1,error:z instanceof Error?z.message:String(z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let z=await Promise.resolve().then(() => (Cq(),fq));if(z.codexDetected())q.codex={ok:!0,...await z.setupCodexAssets()}}catch(z){q.codex={ok:!1,error:z instanceof Error?z.message:String(z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return q}function Lz(){let q=[];for(let Q of H)if(Vz(Q))q.push(Q);let z=0;for(let Q of Pq)if($z(Q))z++;let J=Wz();return{skillsRemoved:q,hooksRemoved:z,claudeMdBlockRemoved:J}}export{Xz as setupGlobalAssets,hz as selfHealGlobal,Vz as removeGlobalSkill,$z as removeGlobalHook,Wz as removeGlobalClaudeMdBlock,Lz as removeBeaconArtifacts,Mq as isGlobalSkillInstalled,Qz as installGlobalSkill,Zz as hasGlobalHook,Rq as hasGlobalClaudeMdBlock,Yz as ensureGlobalHook,Pz as ensureGlobalClaudeMdBlock,kz as auditGlobal,H as GLOBAL_SKILLS,Pq as GLOBAL_HOOKS,Jz as GLOBAL_CLAUDE_MD_BLOCK};
|