trybeacon 0.1.89 → 0.1.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +17 -17
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/@modal/(.)settings/page.js +1 -1
- package/.next/server/app/@modal/(.)settings/page.js.nft.json +1 -1
- package/.next/server/app/@modal/(.)settings/page_client-reference-manifest.js +1 -1
- 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 +1 -1
- 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 +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- 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/linear/route.js +1 -17
- package/.next/server/app/api/linear/route.js.nft.json +1 -1
- package/.next/server/app/api/linear/scopes/route.js +1 -17
- package/.next/server/app/api/linear/scopes/route.js.nft.json +1 -1
- package/.next/server/app/api/linear/sync/route.js +1 -17
- package/.next/server/app/api/linear/sync/route.js.nft.json +1 -1
- package/.next/server/app/api/share/create/route.js +1 -1
- package/.next/server/app/docs/page.js +1 -1
- 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 +4 -4
- package/.next/server/app/docs.segments/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_full.segment.rsc +4 -4
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +3 -3
- package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +2 -2
- 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 +4 -4
- package/.next/server/app/help.segments/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/help.segments/_full.segment.rsc +4 -4
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +3 -3
- package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +2 -2
- 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/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- 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 +3 -3
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/learn/page.js +3 -3
- 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 +1 -1
- 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/parked/page.js +1 -1
- package/.next/server/app/parked/page.js.nft.json +1 -1
- package/.next/server/app/parked/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 +1 -1
- 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 +17 -17
- package/.next/server/chunks/1495.js +18 -0
- package/.next/server/chunks/{7436.js → 1898.js} +3 -3
- package/.next/server/chunks/3825.js +1 -1
- package/.next/server/chunks/4378.js +1 -1
- package/.next/server/chunks/{5332.js → 473.js} +3 -3
- package/.next/server/chunks/5623.js +1 -1
- package/.next/server/chunks/799.js +1 -0
- package/.next/server/chunks/8709.js +8 -7
- package/.next/server/chunks/9683.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/2149-6eac4575d8a8281c.js +1 -0
- package/.next/static/chunks/{6283-20a6abe3453496ae.js → 3729-99f9edd66d1473ac.js} +3 -3
- package/.next/static/chunks/569-c70eb3d6c88282dc.js +1 -0
- package/.next/static/chunks/6818-051146427620d0f9.js +1 -0
- package/.next/static/chunks/8907-f1d97713a336fc2b.js +1 -0
- package/.next/static/chunks/app/@modal/(.)settings/page-77639f97e58859de.js +1 -0
- package/.next/static/chunks/app/docs/page-574e48b1b9519c80.js +1 -0
- package/.next/static/chunks/app/layout-6f04d1687adcd16e.js +1 -0
- package/.next/static/chunks/app/learn/page-ba0ec2cba32bd4e1.js +7 -0
- package/.next/static/chunks/app/map/page-a07e21cd94bae873.js +1 -0
- package/.next/static/chunks/app/plan/{page-809509b6149dbe6a.js → page-8e2a2edfb8fe69c5.js} +2 -2
- package/.next/static/chunks/app/s/[token]/page-b4dc768d9d1c6e29.js +1 -0
- package/.next/static/chunks/app/settings/page-c15764e1c2f54c5a.js +1 -0
- package/.next/static/css/b6c71ada5fa39830.css +1 -0
- package/.next/trace +47 -47
- package/.next/trace-build +1 -1
- package/dist/bin/ask.js +2 -2
- package/dist/bin/doctor.js +32 -30
- package/dist/bin/hook.js +31 -29
- package/dist/bin/mcp.js +41 -39
- package/dist/bin/plan.js +32 -30
- package/dist/bin/prompt.js +2 -2
- package/dist/bin/remove.js +3 -3
- package/dist/bin/stop-hook.js +4 -4
- package/dist/bin/uninstall.js +31 -29
- package/dist/lib/assets.js +20 -20
- package/dist/lib/codex-install.js +30 -28
- package/dist/lib/daemon-boot.js +11 -11
- package/dist/lib/global-install.js +31 -29
- package/drizzle/0013_quick_brother_voodoo.sql +1 -0
- package/drizzle/meta/0013_snapshot.json +1953 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/.next/server/chunks/2579.js +0 -1
- package/.next/static/chunks/2114-74736df56930b46c.js +0 -1
- package/.next/static/chunks/569-bfdcec83011428d3.js +0 -1
- package/.next/static/chunks/6579-1efe1d8b378c81a7.js +0 -1
- package/.next/static/chunks/6818-85b9a09bb74062ef.js +0 -1
- package/.next/static/chunks/app/@modal/(.)settings/page-58f068e66bf2fdf6.js +0 -1
- package/.next/static/chunks/app/docs/page-126c0e42c71731b2.js +0 -1
- package/.next/static/chunks/app/layout-a8bb07fb86893add.js +0 -1
- package/.next/static/chunks/app/learn/page-e6401368ea95de46.js +0 -7
- package/.next/static/chunks/app/map/page-374841ad0b729ce5.js +0 -1
- package/.next/static/chunks/app/s/[token]/page-57821fa904e9e018.js +0 -1
- package/.next/static/chunks/app/settings/page-435bfb2ac6f01744.js +0 -1
- package/.next/static/css/56890131dbc6daff.css +0 -1
- /package/.next/static/{CgztmUmahokH2oDzktISo → 5WK9Cj2xVeIioVVqODVpo}/_buildManifest.js +0 -0
- /package/.next/static/{CgztmUmahokH2oDzktISo → 5WK9Cj2xVeIioVVqODVpo}/_ssgManifest.js +0 -0
package/dist/bin/uninstall.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var
|
|
4
|
-
`)}function
|
|
3
|
+
var mZ=Object.defineProperty;var lZ=(Q)=>Q;function cZ(Q,Z){this[Q]=lZ.bind(null,Z)}var wQ=(Q,Z)=>{for(var $ in Z)mZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:cZ.bind(Z,$)})};var g=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);import{existsSync as b,mkdirSync as fQ,readdirSync as sZ,readFileSync as O,rmSync as tZ,writeFileSync as d}from"fs";import{basename as rZ,dirname as iQ,join as M}from"path";function eQ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function QZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;let Z=M(Q,".claude","plugins");if(!b(Z))return null;let $=[Z];for(let J=0;J<3&&$.length;J++){let Y=[];for(let V of $){let z=M(V,".claude-plugin","plugin.json");try{if(b(z)&&JSON.parse(O(z,"utf8")).name==="beacon")return V}catch{}try{for(let U of sZ(V,{withFileTypes:!0}))if(U.isDirectory())Y.push(M(V,U.name))}catch{}}$=Y}return null}function ZZ(Q){return QZ(Q)!==null}function dZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function R(){let Q=process.env.BEACON_CLI_PATH;if(Q)return Q;if(b(oQ))return oQ;return"beacon"}function FQ(Q){let Z=Q.indexOf(" ");return Z===-1?Q:Q.slice(0,Z)}function I(Q){let Z=R();if(Z==="beacon")return Q;return Q.replace(/^beacon(\s|$)/,`${Z}$1`)}function G(Q){let Z=FQ(Q);return rZ(Z)+Q.slice(Z.length)}function aZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;try{let Z=JSON.parse(O(M(Q,".claude","plugins","installed_plugins.json"),"utf8"));for(let $ of Object.keys(Z.plugins??{}))if(/^beacon@/.test($))return{key:$,marketplace:$.split("@")[1]??""}}catch{}return null}function L(Q){try{return JSON.parse(O(Q,"utf8"))}catch{return{}}}function xQ(Q,Z){fQ(iQ(Q),{recursive:!0}),d(Q,JSON.stringify(Z,null,2)+`
|
|
4
|
+
`)}function n(Q,Z,$={}){let J=L(Q);J.hooks=J.hooks??{},J.hooks[Z.event]=J.hooks[Z.event]??[];let Y=J.hooks[Z.event];if(Y.some((z)=>z.hooks?.some((U)=>G(U.command)===G(Z.command)&&($.matchAnyMatcher||z.matcher===Z.matcher))))return!1;return Y.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),xQ(Q,J),!0}function $Z(Q,Z){let $=L(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=J.flatMap((U,q)=>(U.hooks??[]).flatMap((X,v)=>G(X.command)===G(Z.command)?[{matcherIndex:q,hookIndex:v,preferred:U.matcher===Z.matcher}]:[]));if(Y.length<2)return!1;let V=Y.find((U)=>U.preferred)??Y[0],z=new Set(Y.filter((U)=>U!==V).map((U)=>`${U.matcherIndex}:${U.hookIndex}`));return $.hooks[Z.event]=J.map((U,q)=>({...U,hooks:(U.hooks??[]).filter((X,v)=>!z.has(`${q}:${v}`))})).filter((U)=>(U.hooks??[]).length>0),xQ(Q,$),!0}function o(Q,Z){return(L(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>G(V.command)===G(Z.command)))}function JZ(Q,Z){let J=L(Q).hooks?.[Z.event]??[];for(let Y of J)for(let V of Y.hooks??[])if(G(V.command)===G(Z.command))return V.command;return null}function i(Q,Z){let $=L(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((z)=>{let U=z.hooks?.length??0,q=(z.hooks??[]).filter((X)=>G(X.command)!==G(Z.command));if(q.length!==U)Y=!0;return{...z,hooks:q}}).filter((z)=>(z.hooks??[]).length>0);if(!Y)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return xQ(Q,$),!0}function e(Q,Z,$,J){let Y=`${Z}
|
|
5
5
|
${J.trim()}
|
|
6
|
-
${$}`,V="";try{V=
|
|
6
|
+
${$}`,V="";try{V=O(Q,"utf8")}catch{}let z=new RegExp(`${Z}[\\s\\S]*?${$}`);V=z.test(V)?V.replace(z,Y):V.trim()?`${V.trim()}
|
|
7
7
|
|
|
8
8
|
${Y}
|
|
9
9
|
`:`${Y}
|
|
10
|
-
`,
|
|
10
|
+
`,fQ(iQ(Q),{recursive:!0}),d(Q,V.endsWith(`
|
|
11
11
|
`)?V:`${V}
|
|
12
|
-
`)}function
|
|
12
|
+
`)}function k(Q,Z){try{return O(Q,"utf8").includes(Z)}catch{return!1}}function QQ(Q,Z,$){let J="";try{J=O(Q,"utf8")}catch{return!1}let Y=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!Y.test(J))return!1;let V=J.replace(Y,"").replace(/\n{3,}/g,`
|
|
13
13
|
|
|
14
|
-
`).trimStart();return
|
|
14
|
+
`).trimStart();return d(Q,V),!0}function ZQ(Q,Z,$){let J=M(Q,Z);fQ(J,{recursive:!0});let Y=M(J,"SKILL.md");return d(Y,$),Y}function _(Q,Z){return b(M(Q,Z,"SKILL.md"))}function $Q(Q,Z){let $=M(Q,Z);if(!b($))return!1;return tZ($,{recursive:!0,force:!0}),!0}var j,oQ="/Applications/Beacon.app/Contents/Resources/bin/beacon",a=`## Beacon (visual planning panel)
|
|
15
15
|
|
|
16
16
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
17
17
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -35,23 +35,23 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
35
35
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
36
36
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
37
37
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
38
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
38
|
+
verbatim. Do NOT implement until the tool returns approval.`;var JQ=g(()=>{j=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});var H1=1500,j1=480000,v1=1800000,YQ=3600000,G1=3000;var YZ=()=>{};var DQ={};wQ(DQ,{stripAgentsPointer:()=>UZ,repoMcpCliTarget:()=>Y0,removeRepoAssets:()=>AQ,installRefreshSkill:()=>oZ,installPlanSkill:()=>iZ,installInitSkill:()=>nZ,installExplainSkill:()=>eZ,installCodexRepoSkills:()=>Z0,ensureWorkflowDoc:()=>$0,ensureMcp:()=>J0,contextDocTargets:()=>OQ,auditRepo:()=>V0,REFRESH_SKILL:()=>CQ,PLAN_SKILL:()=>qZ,INIT_SKILL:()=>TQ,EXPLAIN_SKILL:()=>zZ});import{existsSync as N,mkdirSync as S,readFileSync as K,rmSync as VQ,writeFileSync as H}from"fs";import{join as W}from"path";function nZ(Q){let Z=W(Q,".claude","skills","beacon-init");S(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,TQ),$}function oZ(Q){let Z=W(Q,".claude","skills","beacon-refresh");S(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,CQ),$}function iZ(Q){let Z=W(Q,".claude","skills","beacon-plan");S(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,qZ),$}function eZ(Q){let Z=W(Q,".claude","skills","beacon-explain");S(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,zZ),$}function Z0(Q){let Z=[];for(let $ of Q0){let J=W(Q,".agents","skills",$.name);S(J,{recursive:!0});let Y=W(J,"SKILL.md");H(Y,$.body()),Z.push(Y)}return Z}function OQ(Q){let Z=W(Q,"AGENTS.md"),$=W(Q,"CLAUDE.md"),J=N(Z),Y=N($);if(!J&&!Y)return[Z,$];let V=[];if(J)V.push(Z);if(Y)V.push($);return V}function UZ(Q){let Z=W(Q,"CLAUDE.md");if(!N(Z))return;let $=K(Z,"utf8"),J=$.split(`
|
|
39
39
|
`).filter((Y)=>!/^\s*@\.?\/?AGENTS\.md\s*$/.test(Y)).join(`
|
|
40
40
|
`).trim();if(J&&J!==$.trim())H(Z,`${J}
|
|
41
|
-
`)}function
|
|
41
|
+
`)}function $0(Q){let Z=new RegExp(`${qQ}[\\s\\S]*?${gQ}`);for(let $ of OQ(Q)){let J="";try{J=K($,"utf8")}catch{}J=Z.test(J)?J.replace(Z,VZ):`${J.trim()}
|
|
42
42
|
|
|
43
|
-
${
|
|
43
|
+
${VZ}
|
|
44
44
|
`.trimStart(),H($,J.endsWith(`
|
|
45
45
|
`)?J:`${J}
|
|
46
|
-
`)}
|
|
47
|
-
`),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:R(),args:["mcp"],timeout
|
|
48
|
-
`),{path:Z,added:!0,updated:!1}}function
|
|
49
|
-
`)}}catch{}let Y=!1,V=new RegExp(`\\n?${
|
|
46
|
+
`)}UZ(Q)}function J0(Q){let Z=W(Q,".mcp.json"),$={};try{$=JSON.parse(K(Z,"utf8"))}catch{}$.mcpServers=$.mcpServers??{};let J=$.mcpServers.beacon;if(J){if(!J.timeout||J.timeout<YQ)return J.timeout=YQ,H(Z,JSON.stringify($,null,2)+`
|
|
47
|
+
`),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:R(),args:["mcp"],timeout:YQ},H(Z,JSON.stringify($,null,2)+`
|
|
48
|
+
`),{path:Z,added:!0,updated:!1}}function Y0(Q){try{return JSON.parse(K(W(Q,".mcp.json"),"utf8")).mcpServers?.beacon?.command??null}catch{return null}}function V0(Q){let Z=W(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(K(Z,"utf8")).mcpServers?.beacon}catch{}let J=OQ(Q).some((Y)=>{try{return K(Y,"utf8").includes(qQ)}catch{return!1}});return{repo:Q,mcpRegistered:$,workflowBlock:J,skills:{"beacon-init":N(W(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":N(W(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":N(W(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":N(W(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function AQ(Q){let Z=[];for(let q of["beacon-init","beacon-refresh","beacon-db-design"]){let X=W(Q,".claude","skills",q);if(N(X))VQ(X,{recursive:!0,force:!0}),Z.push(q)}for(let q of["beacon-init","beacon-refresh"]){let X=W(Q,".agents","skills",q);if(N(X))VQ(X,{recursive:!0,force:!0}),Z.push(`codex:${q}`)}let $=!1,J=W(Q,".mcp.json");try{let q=JSON.parse(K(J,"utf8"));if(q.mcpServers?.beacon){if(delete q.mcpServers.beacon,$=!0,q.mcpServers&&Object.keys(q.mcpServers).length===0)delete q.mcpServers;if(Object.keys(q).length===0)VQ(J,{force:!0});else H(J,JSON.stringify(q,null,2)+`
|
|
49
|
+
`)}}catch{}let Y=!1,V=new RegExp(`\\n?${qQ}[\\s\\S]*?${gQ}\\n?`);for(let q of[W(Q,"AGENTS.md"),W(Q,"CLAUDE.md")])try{let X=K(q,"utf8");if(V.test(X)){let v=X.replace(V,`
|
|
50
50
|
`).replace(/\n{3,}/g,`
|
|
51
51
|
|
|
52
|
-
`).trimStart();H(q,
|
|
53
|
-
`)?
|
|
54
|
-
`),Y=!0}}catch{}let z=!1,W
|
|
52
|
+
`).trimStart();H(q,v.endsWith(`
|
|
53
|
+
`)?v:`${v}
|
|
54
|
+
`),Y=!0}}catch{}let z=!1,U=W(Q,"CLAUDE.md");try{let q=K(U,"utf8"),X=q.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(X!==q){if(!X.trim())VQ(U,{force:!0});else H(U,X);z=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:z}}var TQ=`---
|
|
55
55
|
name: beacon-init
|
|
56
56
|
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.
|
|
57
57
|
---
|
|
@@ -98,7 +98,7 @@ beacon init-persist /tmp/beacon-init.json # or: beacon init-persist < /tmp/bea
|
|
|
98
98
|
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.
|
|
99
99
|
|
|
100
100
|
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.
|
|
101
|
-
`,
|
|
101
|
+
`,CQ=`---
|
|
102
102
|
name: beacon-refresh
|
|
103
103
|
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.
|
|
104
104
|
---
|
|
@@ -145,7 +145,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
145
145
|
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.
|
|
146
146
|
|
|
147
147
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
148
|
-
`,
|
|
148
|
+
`,qZ=`---
|
|
149
149
|
name: beacon-plan
|
|
150
150
|
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.
|
|
151
151
|
---
|
|
@@ -194,7 +194,7 @@ If it returns feedback, revise and call it again.
|
|
|
194
194
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
195
195
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
196
196
|
run \`beacon\` in this repo once.
|
|
197
|
-
`,
|
|
197
|
+
`,zZ=`---
|
|
198
198
|
name: beacon-explain
|
|
199
199
|
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".
|
|
200
200
|
---
|
|
@@ -264,7 +264,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
|
|
|
264
264
|
Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
|
|
265
265
|
the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
|
|
266
266
|
the lesson.
|
|
267
|
-
`,
|
|
267
|
+
`,Q0,qQ="<!-- beacon:workflow:start -->",gQ="<!-- beacon:workflow:end -->",VZ;var zQ=g(()=>{JQ();YZ();Q0=[{name:"beacon-init",body:()=>TQ},{name:"beacon-refresh",body:()=>CQ}];VZ=`${qQ}
|
|
268
268
|
## Beacon \u2014 feature workflow
|
|
269
269
|
|
|
270
270
|
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:
|
|
@@ -336,21 +336,23 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
336
336
|
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.
|
|
337
337
|
|
|
338
338
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
339
|
-
${
|
|
340
|
-
`)){let Y=J.trim();if(!Y||Y.startsWith("#"))continue;let V=/^\[([^\]]+)\]/.exec(Y);if(V){if($=V[1].trim()==="mcp_servers.beacon",$)Z.mcp_servers=Z.mcp_servers??{},Z.mcp_servers.beacon=Z.mcp_servers.beacon??{};continue}if($){let z=/^command\s*=\s*["']([^"']*)["']/.exec(Y);if(z)Z.mcp_servers.beacon.command=z[1]}}return Z}function
|
|
339
|
+
${gQ}`});import{mkdirSync as q0,renameSync as z0,rmSync as U0,writeFileSync as X0}from"fs";import{dirname as W0}from"path";function h(Q,Z){q0(W0(Q),{recursive:!0});let $=`${Q}.tmp`;try{X0($,Z),z0($,Q)}catch(J){throw U0($,{force:!0}),J}}function w1(Q,Z,$=!1){h(Q,JSON.stringify(Z,null,$?2:void 0))}var XZ=()=>{};var KZ={};wQ(KZ,{setupCodexAssets:()=>M0,removeCodexMcp:()=>NZ,removeCodexArtifacts:()=>LQ,parseTomlBeacon:()=>PZ,nodeWhich:()=>jZ,hasCodexMcp:()=>bQ,ensureCodexMcp:()=>BZ,commandExists:()=>vZ,codexMcpProblem:()=>N0,codexMcpCliTarget:()=>u0,codexDetected:()=>GZ,auditCodex:()=>IQ,CODEX_HOOKS:()=>E});import{accessSync as H0,constants as j0,readFileSync as m}from"fs";import{homedir as v0}from"os";import{delimiter as G0,join as D}from"path";function WZ(){return process.env.HOME||process.env.USERPROFILE||v0()}function jZ(Q,Z=process.env.PATH||"",$=P0){if(!Q)return null;for(let J of Z.split(G0)){if(!J)continue;let Y=D(J,Q);if($(Y))return Y}return null}function P0(Q){try{return H0(Q,j0.X_OK),!0}catch{return!1}}function vZ(Q){if(typeof Bun<"u"&&typeof Bun.which==="function")return Bun.which(Q)!==null;return jZ(Q)!==null}function GZ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(EQ===void 0)EQ=vZ("codex");return EQ}function PZ(Q){let Z={},$=!1;for(let J of Q.split(`
|
|
340
|
+
`)){let Y=J.trim();if(!Y||Y.startsWith("#"))continue;let V=/^\[([^\]]+)\]/.exec(Y);if(V){if($=V[1].trim()==="mcp_servers.beacon",$)Z.mcp_servers=Z.mcp_servers??{},Z.mcp_servers.beacon=Z.mcp_servers.beacon??{};continue}if($){let z=/^command\s*=\s*["']([^"']*)["']/.exec(Y);if(z)Z.mcp_servers.beacon.command=z[1]}}return Z}function A(Q){try{if(typeof Bun<"u"&&Bun.TOML?.parse)return Bun.TOML.parse(Q);return PZ(Q)}catch{return null}}function bQ(){try{return Boolean(A(m(w(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function N0(){let Q="";try{Q=m(w(),"utf8")}catch{return null}let Z=A(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${p}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${p}`;return null}function K0(Q){let Z=Q.split(`
|
|
341
|
+
`),$=Z.indexOf(jQ),J=Z.indexOf(vQ,$);if($===-1||J===-1)return null;let Y=Z.findIndex((U,q)=>q>$&&q<J&&U.trim()==="[mcp_servers.beacon]");if(Y===-1)return null;let V=Y+1;while(V<J&&!/^\s*\[/.test(Z[V]))V++;let z=Z.findIndex((U,q)=>q>Y&&q<V&&/^\s*command\s*=/.test(U));if(z===-1)return null;return Z[z]=`command = ${JSON.stringify(R())}`,Z.join(`
|
|
342
|
+
`)}function BZ(){let Q="",Z=!1;try{Q=m(w(),"utf8"),Z=!0}catch{}if(Z){let V=A(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${p}`};if(V.mcp_servers?.beacon){let z=K0(Q);if(z&&z!==Q)h(w(),z);return{added:!1}}if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${p}`}}let $=!Q?"":Q.endsWith(`
|
|
341
343
|
`)?`
|
|
342
344
|
`:`
|
|
343
345
|
|
|
344
|
-
`,J=Q+$+
|
|
345
|
-
`),$=Z.indexOf(
|
|
346
|
+
`,J=Q+$+B0();if(A(J)?.mcp_servers?.beacon?.command!==R())return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${p}`};return h(w(),J),{added:!0}}function u0(){try{return A(m(w(),"utf8"))?.mcp_servers?.beacon?.command??null}catch{return null}}function NZ(){let Q="";try{Q=m(w(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
347
|
+
`),$=Z.indexOf(jQ);if($===-1)return{removed:!1,skipped:bQ()};let J=Z.indexOf(vQ,$);if(J===-1)return{removed:!1,skipped:!0};let Y=Z.findIndex((U,q)=>q>$&&q<J&&U.trim()==="[mcp_servers.beacon]");if(Y===-1)return{removed:!1,skipped:!0};let V=Y+1;while(V<J&&!/^\s*\[/.test(Z[V]))V++;Z.splice(Y,V-Y),Z.splice(Z.indexOf(vQ),1),Z.splice(Z.indexOf(jQ),1);let z=Z.join(`
|
|
346
348
|
`).replace(/\n{3,}/g,`
|
|
347
349
|
|
|
348
|
-
`).replace(/^\n+/,"");if(
|
|
350
|
+
`).replace(/^\n+/,"");if(A(z)===null)return{removed:!1,skipped:!0};return h(w(),z),{removed:!0}}async function M0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (zQ(),DQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let X of j){if(!_(WQ(),X))V.push(X);ZQ(WQ(),X,Y[X])}let z=0;for(let X of E){let v=X.event==="UserPromptSubmit"||X.event==="Stop";if(v)$Z(UQ(),{event:X.event,matcher:X.matcher,command:I(X.command)});if(n(UQ(),{event:X.event,matcher:X.matcher,command:I(X.command)},{matchAnyMatcher:v}))z++}let U=k(XQ(),HQ);e(XQ(),HQ,HZ,a);let q=BZ();return{skillsAdded:V,hooksAdded:z,agentsMdBlockTouched:!U,mcp:q}}function IQ(){let Q={};for(let $ of j)Q[$]=_(WQ(),$);let Z={};for(let $ of E)Z[$.event]=o(UQ(),{event:$.event,command:$.command});return{detected:GZ(),skills:Q,hooks:Z,agentsMdBlock:k(XQ(),HQ),mcp:bQ()}}function LQ(){let Q=[];for(let Y of j)if($Q(WQ(),Y))Q.push(Y);let Z=0;for(let Y of E)if(i(UQ(),{event:Y.event,command:Y.command}))Z++;let $=QQ(XQ(),HQ,HZ),J=NZ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var yQ=()=>D(WZ(),".codex"),UQ=()=>D(yQ(),"hooks.json"),w=()=>D(yQ(),"config.toml"),XQ=()=>D(yQ(),"AGENTS.md"),WQ=()=>D(WZ(),".agents","skills"),HQ="<!-- beacon:global:start -->",HZ="<!-- beacon:global:end -->",E,EQ,jQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",vQ="# beacon:end",B0=()=>`${jQ}
|
|
349
351
|
[mcp_servers.beacon]
|
|
350
352
|
command = "${R()}"
|
|
351
353
|
args = ["mcp"]
|
|
352
|
-
${
|
|
353
|
-
`,k="add it manually: codex mcp add beacon -- beacon mcp";var bQ=C(()=>{ZQ();qZ();D=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}]});var wZ={};xQ(wZ,{provisionDb:()=>m0});import{createClient as D0}from"@libsql/client";import{drizzle as A0}from"drizzle-orm/libsql";import{migrate as E0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as b0}from"drizzle-orm/migrator";import{dirname as SQ,join as y0}from"path";import{fileURLToPath as L0}from"url";async function GQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function h0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function RZ(Q){if(!await GQ(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function p0(Q){for(let[Z,$]of Object.entries(S0)){if(!await GQ(Q,Z))continue;let J=await h0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function m0(Q,Z=_0){let $=D0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await GQ($,"__drizzle_migrations"),Y=await GQ($,"Node"),V=!1;if(Y&&!J){let W=b0({migrationsFolder:Z})[0];if(W)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[W.hash,W.folderMillis]}),V=!0}let z=await RZ($);if(await E0(A0($),{migrationsFolder:Z}),await RZ($)>z)V=!0;return await p0($),{migrated:V}}finally{$.close()}}var k0,_0,S0;var fZ=C(async()=>{k0=SQ(SQ(SQ(L0(import.meta.url)))),_0=process.env.BEACON_MIGRATIONS_DIR||y0(k0,"drizzle"),S0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});ZQ();import{existsSync as x0}from"fs";import{homedir as M0}from"os";import{join as WQ}from"path";function u0(){return process.env.HOME||process.env.USERPROFILE||M0()}var HQ=()=>WQ(u0(),".claude"),yQ=()=>WQ(HQ(),"skills"),jQ=()=>WQ(HQ(),"settings.json"),LQ=()=>WQ(HQ(),"CLAUDE.md"),kQ="<!-- beacon:global:start -->",KZ="<!-- beacon:global:end -->";var R0=s,S=[{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 w0(Q,Z){return e(yQ(),Q,Z)}function xZ(Q){return y(yQ(),Q)}function f0(Q){return QQ(yQ(),Q)}function T0(Q){return r(jQ(),Q)}function F0(Q){return n(jQ(),Q)}function C0(Q){return a(jQ(),Q)}function g0(Q){o(LQ(),kQ,KZ,Q)}function MZ(){return b(LQ(),kQ)}function O0(){return i(LQ(),kQ,KZ)}function uZ(){let Q={};for(let $ of j)Q[$]=xZ($);let Z={};for(let $ of S)Z[$.event]=F0({event:$.event,command:$.command});return{homeExists:x0(HQ()),skills:Q,hooks:Z,claudeMdBlock:MZ()}}function D1(){let Q=QZ(jQ(),{event:"PostToolUse",command:"beacon hook"});return Q?uQ(Q):null}async function I0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (VQ(),CQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let q of j){if(!xZ(q))V.push(q);w0(q,Y[q])}let z=0;for(let q of S)if(T0({event:q.event,matcher:q.matcher,command:t(q.command)}))z++;let W=MZ();return g0(R0),{skillsAdded:V,hooksAdded:z,claudeMdBlockTouched:!W}}async function A1(){if(aQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(iQ()){try{_Q()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await I0()}}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(() => (bQ(),BZ));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 _Q(){let Q=[];for(let J of j)if(f0(J))Q.push(J);let Z=0;for(let J of S)if(C0(J))Z++;let $=O0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as c0}from"async_hooks";import{spawnSync as l0}from"child_process";import{createHash as t0}from"crypto";import{existsSync as FZ,mkdirSync as p,readFileSync as pQ,writeFileSync as mQ}from"fs";import{homedir as CZ}from"os";import{basename as s0,join as M,parse as d0,resolve as TZ}from"path";function B(){return process.env.BEACON_HOME||M(CZ(),".beacon")}function cQ(){return M(B(),"workspaces.json")}function h(Q){return t0("sha256").update(Q).digest("hex").slice(0,12)}function r0(Q=process.cwd()){let Z=l0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function gZ(Q){let Z=TZ(Q);return Z!==TZ(CZ())&&Z!==d0(Z).root}function OZ(){return M(B(),"deleted.json")}function lQ(){try{let Q=JSON.parse(pQ(OZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function IZ(Q){p(B(),{recursive:!0}),mQ(OZ(),JSON.stringify(Q,null,2))}function DZ(Q){return lQ().includes(Q)}function s1(Q){let Z=lQ();if(!Z.includes(Q))IZ([...Z,Q])}function n0(Q){let Z=lQ();if(Z.includes(Q))IZ(Z.filter(($)=>$!==Q))}function vQ(Q){return M(B(),Q)}function a0(Q){return`file:${M(vQ(Q),"db.sqlite")}`}function m(){try{let Q=JSON.parse(pQ(cQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function tQ(Q){p(B(),{recursive:!0}),mQ(cQ(),JSON.stringify(Q,null,2))}function NQ(){return m().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function f(Q){return m().find((Z)=>Z.id===Q)??null}function AZ(Q,Z,$=new Date().toISOString()){if(!gZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=h(Q);if(DZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=m(),V=Y.find((q)=>q.id===J),z={id:J,path:Q,name:Z||V?.name||s0(Q),lastOpenedAt:$},W=[z,...Y.filter((q)=>q.id!==J)];return p(vQ(J),{recursive:!0}),tQ(W),z}function d1(Q,Z){return n0(h(Q)),AZ(Q,Z)}function r1(Q,Z=new Date().toISOString()){let $=m(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,tQ($)}function n1(Q){if(tQ(m().filter((Z)=>Z.id!==Q)),sQ()===Q)o0(NQ()[0]?.id??null)}function EZ(){return M(B(),"active")}function sQ(){try{return pQ(EZ(),"utf8").trim()||null}catch{return null}}function o0(Q){p(B(),{recursive:!0}),mQ(EZ(),Q??"")}function a1(){let Q=sQ();return Q?f(Q):null}function o1(){let Q=e0()??sQ();return Q?f(Q):null}function i1(Q){return f(Q)?.path??null}function e1(){return FZ(cQ())}var bZ="beacon_ws";function yZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function Q2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&f(Z))return Z;let $=yZ(Q,bZ);if($&&f($))return $;return i0()}function i0(){let Q=NQ();return Q.length===1?Q[0].id:null}var LZ="x-beacon-workspace-path";function Z2(Q=process.cwd()){let Z=r0(Q);return{"x-beacon-workspace":h(Z),[LZ]:Z}}async function $2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&f(Z))return Z;let $=Q.headers.get(LZ);if($&&gZ($)&&!DZ(h($))&&(!Z||h($)===Z)){let Y=AZ($);return await Q1(Y.id),Y.id}let J=yZ(Q,bZ);if(J&&f(J))return J;return null}var kZ=new c0;function J2(Q,Z){return Q?kZ.run(Q,Z):Z()}function e0(){return kZ.getStore()??null}var hQ=new Set;function Y2(Q){hQ.delete(M(vQ(Q),"db.sqlite"))}async function Q1(Q){let Z=vQ(Q),$=M(Z,"db.sqlite"),J=FZ($);if(J&&hQ.has($))return{ok:!0,created:!1,migrated:!1};try{p(Z,{recursive:!0});let{provisionDb:Y}=await fZ().then(() => wZ),V=await Y(a0(Q));return hQ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}VQ();bQ();import{existsSync as PQ,readFileSync as Z1,rmSync as $1}from"fs";import{join as J1}from"path";var _Z=process.argv.slice(3),SZ=_Z.includes("--yes")||_Z.includes("-y"),v=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,G=(Q)=>`\x1B[2m${Q}\x1B[0m`,F=(Q)=>`
|
|
354
|
-
\x1B[1m${Q}\x1B[0m`,
|
|
355
|
-
`),process.exit(0);console.log(
|
|
354
|
+
${vQ}
|
|
355
|
+
`,p="add it manually: codex mcp add beacon -- beacon mcp";var kQ=g(()=>{JQ();XZ();E=[{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."}]});var FZ={};wQ(FZ,{provisionDb:()=>c0});import{createClient as y0}from"@libsql/client";import{drizzle as b0}from"drizzle-orm/libsql";import{migrate as I0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as L0}from"drizzle-orm/migrator";import{dirname as mQ,join as k0}from"path";import{fileURLToPath as _0}from"url";async function NQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function m0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function fZ(Q){if(!await NQ(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function l0(Q){for(let[Z,$]of Object.entries(p0)){if(!await NQ(Q,Z))continue;let J=await m0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function c0(Q,Z=h0){let $=y0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await NQ($,"__drizzle_migrations"),Y=await NQ($,"Node"),V=!1;if(Y&&!J){let U=L0({migrationsFolder:Z})[0];if(U)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[U.hash,U.folderMillis]}),V=!0}let z=await fZ($);if(await I0(b0($),{migrationsFolder:Z}),await fZ($)>z)V=!0;return await l0($),{migrated:V}}finally{$.close()}}var S0,h0,p0;var xZ=g(async()=>{S0=mQ(mQ(mQ(_0(import.meta.url)))),h0=process.env.BEACON_MIGRATIONS_DIR||k0(S0,"drizzle"),p0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});JQ();import{existsSync as R0}from"fs";import{homedir as w0}from"os";import{join as GQ}from"path";function f0(){return process.env.HOME||process.env.USERPROFILE||w0()}var PQ=()=>GQ(f0(),".claude"),_Q=()=>GQ(PQ(),"skills"),BQ=()=>GQ(PQ(),"settings.json"),SQ=()=>GQ(PQ(),"CLAUDE.md"),hQ="<!-- beacon:global:start -->",uZ="<!-- beacon:global:end -->";var F0=a,l=[{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 x0(Q,Z){return ZQ(_Q(),Q,Z)}function MZ(Q){return _(_Q(),Q)}function T0(Q){return $Q(_Q(),Q)}function C0(Q){return n(BQ(),Q)}function g0(Q){return o(BQ(),Q)}function O0(Q){return i(BQ(),Q)}function A0(Q){e(SQ(),hQ,uZ,Q)}function RZ(){return k(SQ(),hQ)}function D0(){return QQ(SQ(),hQ,uZ)}function wZ(){let Q={};for(let $ of j)Q[$]=MZ($);let Z={};for(let $ of l)Z[$.event]=g0({event:$.event,command:$.command});return{homeExists:R0(PQ()),skills:Q,hooks:Z,claudeMdBlock:RZ()}}function y1(){let Q=JZ(BQ(),{event:"PostToolUse",command:"beacon hook"});return Q?FQ(Q):null}async function E0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (zQ(),DQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let q of j){if(!MZ(q))V.push(q);x0(q,Y[q])}let z=0;for(let q of l)if(C0({event:q.event,matcher:q.matcher,command:I(q.command)}))z++;let U=RZ();return A0(F0),{skillsAdded:V,hooksAdded:z,claudeMdBlockTouched:!U}}async function b1(){if(eQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(ZZ()){try{pQ()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await E0()}}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(() => (kQ(),KZ));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 pQ(){let Q=[];for(let J of j)if(T0(J))Q.push(J);let Z=0;for(let J of l)if(O0(J))Z++;let $=D0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as s0}from"async_hooks";import{spawnSync as t0}from"child_process";import{createHash as r0}from"crypto";import{existsSync as CZ,mkdirSync as s,readFileSync as cQ,writeFileSync as sQ}from"fs";import{homedir as gZ}from"os";import{basename as d0,join as f,parse as a0,resolve as TZ}from"path";function u(){return process.env.BEACON_HOME||f(gZ(),".beacon")}function tQ(){return f(u(),"workspaces.json")}function c(Q){return r0("sha256").update(Q).digest("hex").slice(0,12)}function n0(Q=process.cwd()){let Z=t0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function OZ(Q){let Z=TZ(Q);return Z!==TZ(gZ())&&Z!==a0(Z).root}function AZ(){return f(u(),"deleted.json")}function rQ(){try{let Q=JSON.parse(cQ(AZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function DZ(Q){s(u(),{recursive:!0}),sQ(AZ(),JSON.stringify(Q,null,2))}function EZ(Q){return rQ().includes(Q)}function d1(Q){let Z=rQ();if(!Z.includes(Q))DZ([...Z,Q])}function o0(Q){let Z=rQ();if(Z.includes(Q))DZ(Z.filter(($)=>$!==Q))}function KQ(Q){return f(u(),Q)}function i0(Q){return`file:${f(KQ(Q),"db.sqlite")}`}function t(){try{let Q=JSON.parse(cQ(tQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function dQ(Q){s(u(),{recursive:!0}),sQ(tQ(),JSON.stringify(Q,null,2))}function uQ(){return t().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function x(Q){return t().find((Z)=>Z.id===Q)??null}function yZ(Q,Z,$=new Date().toISOString()){if(!OZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=c(Q);if(EZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=t(),V=Y.find((q)=>q.id===J),z={id:J,path:Q,name:Z||V?.name||d0(Q),lastOpenedAt:$},U=[z,...Y.filter((q)=>q.id!==J)];return s(KQ(J),{recursive:!0}),dQ(U),z}function a1(Q,Z){return o0(c(Q)),yZ(Q,Z)}function n1(Q,Z=new Date().toISOString()){let $=t(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,dQ($)}function o1(Q){if(dQ(t().filter((Z)=>Z.id!==Q)),aQ()===Q)e0(uQ()[0]?.id??null)}function bZ(){return f(u(),"active")}function aQ(){try{return cQ(bZ(),"utf8").trim()||null}catch{return null}}function e0(Q){s(u(),{recursive:!0}),sQ(bZ(),Q??"")}function i1(){let Q=aQ();return Q?x(Q):null}function e1(){let Q=Z1()??aQ();return Q?x(Q):null}function Q2(Q){return x(Q)?.path??null}function Z2(){return CZ(tQ())}var IZ="beacon_ws";function LZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function $2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&x(Z))return Z;let $=LZ(Q,IZ);if($&&x($))return $;return Q1()}function Q1(){let Q=uQ();return Q.length===1?Q[0].id:null}var kZ="x-beacon-workspace-path";function J2(Q=process.cwd()){let Z=n0(Q);return{"x-beacon-workspace":c(Z),[kZ]:Z}}async function Y2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&x(Z))return Z;let $=Q.headers.get(kZ);if($&&OZ($)&&!EZ(c($))&&(!Z||c($)===Z)){let Y=yZ($);return await $1(Y.id),Y.id}let J=LZ(Q,IZ);if(J&&x(J))return J;return null}var _Z=new s0;function V2(Q,Z){return Q?_Z.run(Q,Z):Z()}function Z1(){return _Z.getStore()??null}var lQ=new Set;function q2(Q){lQ.delete(f(KQ(Q),"db.sqlite"))}async function $1(Q){let Z=KQ(Q),$=f(Z,"db.sqlite"),J=CZ($);if(J&&lQ.has($))return{ok:!0,created:!1,migrated:!1};try{s(Z,{recursive:!0});let{provisionDb:Y}=await xZ().then(() => FZ),V=await Y(i0(Q));return lQ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}zQ();kQ();import{existsSync as MQ,readFileSync as J1,rmSync as Y1}from"fs";import{join as V1}from"path";var SZ=process.argv.slice(3),hZ=SZ.includes("--yes")||SZ.includes("-y"),B=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,P=(Q)=>`\x1B[2m${Q}\x1B[0m`,C=(Q)=>`
|
|
356
|
+
\x1B[1m${Q}\x1B[0m`,pZ=(Q)=>`\x1B[33m!\x1B[0m ${Q}`,T=u(),r=uQ(),nQ=wZ();console.log(C(hZ?"Beacon \xB7 uninstall":"Beacon \xB7 uninstall (dry run)"));console.log(C("Global"));console.log(` ${MQ(T)?`wipe ${T} (${r.length} workspaces)`:`${P(`${T} \u2014 already gone`)}`}`);for(let Q of j)console.log(` ${nQ.skills[Q]?`remove ~/.claude/skills/${Q}/`:P(`skill ${Q} \u2014 already gone`)}`);for(let Q of l)console.log(` ${nQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command}`:P(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${nQ.claudeMdBlock?"strip Beacon block from ~/.claude/CLAUDE.md":P("global CLAUDE.md block \u2014 already gone")}`);var RQ=IQ();console.log(C("Codex"));for(let Q of j)console.log(` ${RQ.skills[Q]?`remove ~/.agents/skills/${Q}/`:P(`skill ${Q} \u2014 already gone`)}`);for(let Q of E)console.log(` ${RQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command} from ~/.codex/hooks.json`:P(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${RQ.agentsMdBlock?"strip Beacon block from ~/.codex/AGENTS.md":P("global ~/.codex/AGENTS.md block \u2014 already gone")}`);console.log(` ${RQ.mcp?"strip [mcp_servers.beacon] from ~/.codex/config.toml (if Beacon wrote it)":P("config.toml beacon entry \u2014 already gone")}`);if(r.length){console.log(C(`Per-repo (${r.length})`));for(let Q of r){if(!MQ(Q.path)){console.log(` ${P(`${Q.path} \u2014 repo no longer on disk, skipping`)}`);continue}console.log(` ${Q.path}`),console.log(` ${P("strip beacon entry from .mcp.json, workflow block from AGENTS.md, skills, CLAUDE.md @-import")}`)}}if(!hZ)console.log(C("Nothing was changed.")),console.log(" Run \x1B[1mbeacon uninstall --yes\x1B[0m to apply."),console.log(` The \x1B[1mbeacon\x1B[0m binary itself (the cloned source + your PATH symlink) is NOT removed by this \u2014 your install script handles that.
|
|
357
|
+
`),process.exit(0);console.log(C("Applying\u2026"));var y=pQ();if(y.skillsRemoved.length)console.log(` ${B(`removed skills: ${y.skillsRemoved.join(", ")}`)}`);if(y.hooksRemoved)console.log(` ${B(`removed ${y.hooksRemoved} hook${y.hooksRemoved===1?"":"s"} from ~/.claude/settings.json`)}`);if(y.claudeMdBlockRemoved)console.log(` ${B("stripped Beacon block from ~/.claude/CLAUDE.md")}`);var F=LQ();if(F.skillsRemoved.length)console.log(` ${B(`removed ~/.agents/skills: ${F.skillsRemoved.join(", ")}`)}`);if(F.hooksRemoved)console.log(` ${B(`removed ${F.hooksRemoved} hook${F.hooksRemoved===1?"":"s"} from ~/.codex/hooks.json`)}`);if(F.agentsMdBlockRemoved)console.log(` ${B("stripped Beacon block from ~/.codex/AGENTS.md")}`);if(F.mcpRemoved)console.log(` ${B("stripped [mcp_servers.beacon] from ~/.codex/config.toml")}`);if(F.mcpSkipped)console.log(` ${pZ("left [mcp_servers.beacon] in ~/.codex/config.toml \u2014 it wasn't written by Beacon (remove with: codex mcp remove beacon)")}`);for(let Q of r){if(!MQ(Q.path))continue;let Z=AQ(Q.path),$=[];if(Z.skillsRemoved.length)$.push(`skills(${Z.skillsRemoved.length})`);if(Z.mcpUnregistered)$.push(".mcp.json");if(Z.agentsBlockRemoved)$.push("AGENTS.md");if(Z.claudeImportRemoved)$.push("CLAUDE.md");if($.length)console.log(` ${B(`${Q.path} \u2192 ${$.join(", ")}`)}`)}var q1=V1(T,"server.json");try{let{pid:Q}=JSON.parse(J1(q1,"utf8"));if(Q)try{process.kill(Q),console.log(` ${B(`stopped daemon (pid ${Q})`)}`)}catch{}}catch{}if(MQ(T))Y1(T,{recursive:!0,force:!0}),console.log(` ${B(`removed ${T}`)}`);console.log(C("Done."));console.log(` ${pZ("The `beacon` binary on your PATH is still there \u2014 run the matching uninstall step from your installer to remove it.")}
|
|
356
358
|
`);
|
package/dist/lib/assets.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
`)}function
|
|
2
|
+
var l=Object.defineProperty;var p=(q)=>q;function s(q,J){this[q]=p.bind(null,J)}var t=(q,J)=>{for(var Q in J)l(q,Q,{get:J[Q],enumerable:!0,configurable:!0,set:s.bind(J,Q)})};var O=(q,J)=>()=>(q&&(J=q(q=0)),J);import{existsSync as T,mkdirSync as I,readdirSync as m,readFileSync as P,rmSync as d,writeFileSync as w}from"fs";import{basename as a,dirname as g,join as M}from"path";function Nq(){return!!process.env.CLAUDE_PLUGIN_ROOT}function n(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;let J=M(q,".claude","plugins");if(!T(J))return null;let Q=[J];for(let V=0;V<3&&Q.length;V++){let Y=[];for(let Z of Q){let U=M(Z,".claude-plugin","plugin.json");try{if(T(U)&&JSON.parse(P(U,"utf8")).name==="beacon")return Z}catch{}try{for(let X of m(Z,{withFileTypes:!0}))if(X.isDirectory())Y.push(M(Z,X.name))}catch{}}Q=Y}return null}function vq(q){return n(q)!==null}function Mq(q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(q)}function D(){let q=process.env.BEACON_CLI_PATH;if(q)return q;if(T(_))return _;return"beacon"}function c(q){let J=q.indexOf(" ");return J===-1?q:q.slice(0,J)}function Wq(q){let J=D();if(J==="beacon")return q;return q.replace(/^beacon(\s|$)/,`${J}$1`)}function B(q){let J=c(q);return a(J)+q.slice(J.length)}function Pq(q=process.env.HOME||process.env.USERPROFILE||""){if(!q)return null;try{let J=JSON.parse(P(M(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 u(q){try{return JSON.parse(P(q,"utf8"))}catch{return{}}}function x(q,J){I(g(q),{recursive:!0}),w(q,JSON.stringify(J,null,2)+`
|
|
3
|
+
`)}function uq(q,J,Q={}){let V=u(q);V.hooks=V.hooks??{},V.hooks[J.event]=V.hooks[J.event]??[];let Y=V.hooks[J.event];if(Y.some((U)=>U.hooks?.some((X)=>B(X.command)===B(J.command)&&(Q.matchAnyMatcher||U.matcher===J.matcher))))return!1;return Y.push({matcher:J.matcher,hooks:[{type:"command",command:J.command}]}),x(q,V),!0}function Aq(q,J){let Q=u(q),V=Q.hooks?.[J.event];if(!V)return!1;let Y=V.flatMap((X,$)=>(X.hooks??[]).flatMap((z,W)=>B(z.command)===B(J.command)?[{matcherIndex:$,hookIndex:W,preferred:X.matcher===J.matcher}]:[]));if(Y.length<2)return!1;let Z=Y.find((X)=>X.preferred)??Y[0],U=new Set(Y.filter((X)=>X!==Z).map((X)=>`${X.matcherIndex}:${X.hookIndex}`));return Q.hooks[J.event]=V.map((X,$)=>({...X,hooks:(X.hooks??[]).filter((z,W)=>!U.has(`${$}:${W}`))})).filter((X)=>(X.hooks??[]).length>0),x(q,Q),!0}function wq(q,J){return(u(q).hooks?.[J.event]??[]).some((Y)=>Y.hooks?.some((Z)=>B(Z.command)===B(J.command)))}function Kq(q,J){let V=u(q).hooks?.[J.event]??[];for(let Y of V)for(let Z of Y.hooks??[])if(B(Z.command)===B(J.command))return Z.command;return null}function Cq(q,J){let Q=u(q),V=Q.hooks?.[J.event];if(!V)return!1;let Y=!1,Z=V.map((U)=>{let X=U.hooks?.length??0,$=(U.hooks??[]).filter((z)=>B(z.command)!==B(J.command));if($.length!==X)Y=!0;return{...U,hooks:$}}).filter((U)=>(U.hooks??[]).length>0);if(!Y)return!1;if(Z.length)Q.hooks[J.event]=Z;else delete Q.hooks[J.event];if(Q.hooks&&Object.keys(Q.hooks).length===0)delete Q.hooks;return x(q,Q),!0}function Eq(q,J,Q,V){let Y=`${J}
|
|
4
4
|
${V.trim()}
|
|
5
|
-
${Q}`,Z="";try{Z=
|
|
5
|
+
${Q}`,Z="";try{Z=P(q,"utf8")}catch{}let U=new RegExp(`${J}[\\s\\S]*?${Q}`);Z=U.test(Z)?Z.replace(U,Y):Z.trim()?`${Z.trim()}
|
|
6
6
|
|
|
7
7
|
${Y}
|
|
8
8
|
`:`${Y}
|
|
9
|
-
`,
|
|
9
|
+
`,I(g(q),{recursive:!0}),w(q,Z.endsWith(`
|
|
10
10
|
`)?Z:`${Z}
|
|
11
|
-
`)}function
|
|
11
|
+
`)}function Oq(q,J){try{return P(q,"utf8").includes(J)}catch{return!1}}function Iq(q,J,Q){let V="";try{V=P(q,"utf8")}catch{return!1}let Y=new RegExp(`${J}[\\s\\S]*?${Q}\\n?`);if(!Y.test(V))return!1;let Z=V.replace(Y,"").replace(/\n{3,}/g,`
|
|
12
12
|
|
|
13
|
-
`).trimStart();return
|
|
13
|
+
`).trimStart();return w(q,Z),!0}function Dq(q,J,Q){let V=M(q,J);I(V,{recursive:!0});let Y=M(V,"SKILL.md");return w(Y,Q),Y}function xq(q,J){return T(M(q,J,"SKILL.md"))}function Lq(q,J){let Q=M(q,J);if(!T(Q))return!1;return d(Q,{recursive:!0,force:!0}),!0}var Bq,_="/Applications/Beacon.app/Contents/Resources/bin/beacon",Tq=`## Beacon (visual planning panel)
|
|
14
14
|
|
|
15
15
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
16
16
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -34,23 +34,23 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
34
34
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
35
35
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
36
36
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
37
|
-
verbatim. Do NOT implement until the tool returns approval.`;var
|
|
37
|
+
verbatim. Do NOT implement until the tool returns approval.`;var F=O(()=>{Bq=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});var jq=1500,Rq=480000,_q=1800000,K=3600000,gq=3000;var k=()=>{};var Gq={};t(Gq,{stripAgentsPointer:()=>h,repoMcpCliTarget:()=>Yq,removeRepoAssets:()=>$q,installRefreshSkill:()=>i,installPlanSkill:()=>o,installInitSkill:()=>r,installExplainSkill:()=>e,installCodexRepoSkills:()=>Jq,ensureWorkflowDoc:()=>Qq,ensureMcp:()=>Vq,contextDocTargets:()=>R,auditRepo:()=>Zq,REFRESH_SKILL:()=>b,PLAN_SKILL:()=>S,INIT_SKILL:()=>L,EXPLAIN_SKILL:()=>y});import{existsSync as N,mkdirSync as A,readFileSync as v,rmSync as C,writeFileSync as H}from"fs";import{join as G}from"path";function r(q){let J=G(q,".claude","skills","beacon-init");A(J,{recursive:!0});let Q=G(J,"SKILL.md");return H(Q,L),Q}function i(q){let J=G(q,".claude","skills","beacon-refresh");A(J,{recursive:!0});let Q=G(J,"SKILL.md");return H(Q,b),Q}function o(q){let J=G(q,".claude","skills","beacon-plan");A(J,{recursive:!0});let Q=G(J,"SKILL.md");return H(Q,S),Q}function e(q){let J=G(q,".claude","skills","beacon-explain");A(J,{recursive:!0});let Q=G(J,"SKILL.md");return H(Q,y),Q}function Jq(q){let J=[];for(let Q of qq){let V=G(q,".agents","skills",Q.name);A(V,{recursive:!0});let Y=G(V,"SKILL.md");H(Y,Q.body()),J.push(Y)}return J}function R(q){let J=G(q,"AGENTS.md"),Q=G(q,"CLAUDE.md"),V=N(J),Y=N(Q);if(!V&&!Y)return[J,Q];let Z=[];if(V)Z.push(J);if(Y)Z.push(Q);return Z}function h(q){let J=G(q,"CLAUDE.md");if(!N(J))return;let Q=v(J,"utf8"),V=Q.split(`
|
|
38
38
|
`).filter((Y)=>!/^\s*@\.?\/?AGENTS\.md\s*$/.test(Y)).join(`
|
|
39
39
|
`).trim();if(V&&V!==Q.trim())H(J,`${V}
|
|
40
|
-
`)}function Qq(q){let J=new RegExp(`${
|
|
40
|
+
`)}function Qq(q){let J=new RegExp(`${E}[\\s\\S]*?${j}`);for(let Q of R(q)){let V="";try{V=v(Q,"utf8")}catch{}V=J.test(V)?V.replace(J,f):`${V.trim()}
|
|
41
41
|
|
|
42
42
|
${f}
|
|
43
43
|
`.trimStart(),H(Q,V.endsWith(`
|
|
44
44
|
`)?V:`${V}
|
|
45
|
-
`)}
|
|
46
|
-
`),{path:J,added:!1,updated:!0};return{path:J,added:!1,updated:!1}}return Q.mcpServers.beacon={command:
|
|
47
|
-
`),{path:J,added:!0,updated:!1}}function Yq(q){try{return JSON.parse(
|
|
48
|
-
`)}}catch{}let Y=!1,Z=new RegExp(`\\n?${
|
|
45
|
+
`)}h(q)}function Vq(q){let J=G(q,".mcp.json"),Q={};try{Q=JSON.parse(v(J,"utf8"))}catch{}Q.mcpServers=Q.mcpServers??{};let V=Q.mcpServers.beacon;if(V){if(!V.timeout||V.timeout<K)return V.timeout=K,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:D(),args:["mcp"],timeout:K},H(J,JSON.stringify(Q,null,2)+`
|
|
47
|
+
`),{path:J,added:!0,updated:!1}}function Yq(q){try{return JSON.parse(v(G(q,".mcp.json"),"utf8")).mcpServers?.beacon?.command??null}catch{return null}}function Zq(q){let J=G(q,".mcp.json"),Q=!1;try{Q=!!JSON.parse(v(J,"utf8")).mcpServers?.beacon}catch{}let V=R(q).some((Y)=>{try{return v(Y,"utf8").includes(E)}catch{return!1}});return{repo:q,mcpRegistered:Q,workflowBlock:V,skills:{"beacon-init":N(G(q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":N(G(q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":N(G(q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":N(G(q,".agents","skills","beacon-refresh","SKILL.md"))}}}function $q(q){let J=[];for(let $ of["beacon-init","beacon-refresh","beacon-db-design"]){let z=G(q,".claude","skills",$);if(N(z))C(z,{recursive:!0,force:!0}),J.push($)}for(let $ of["beacon-init","beacon-refresh"]){let z=G(q,".agents","skills",$);if(N(z))C(z,{recursive:!0,force:!0}),J.push(`codex:${$}`)}let Q=!1,V=G(q,".mcp.json");try{let $=JSON.parse(v(V,"utf8"));if($.mcpServers?.beacon){if(delete $.mcpServers.beacon,Q=!0,$.mcpServers&&Object.keys($.mcpServers).length===0)delete $.mcpServers;if(Object.keys($).length===0)C(V,{force:!0});else H(V,JSON.stringify($,null,2)+`
|
|
48
|
+
`)}}catch{}let Y=!1,Z=new RegExp(`\\n?${E}[\\s\\S]*?${j}\\n?`);for(let $ of[G(q,"AGENTS.md"),G(q,"CLAUDE.md")])try{let z=v($,"utf8");if(Z.test(z)){let W=z.replace(Z,`
|
|
49
49
|
`).replace(/\n{3,}/g,`
|
|
50
50
|
|
|
51
|
-
`).trimStart();H(
|
|
52
|
-
`)?
|
|
53
|
-
`),Y=!0}}catch{}let
|
|
51
|
+
`).trimStart();H($,W.endsWith(`
|
|
52
|
+
`)?W:`${W}
|
|
53
|
+
`),Y=!0}}catch{}let U=!1,X=G(q,"CLAUDE.md");try{let $=v(X,"utf8"),z=$.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(z!==$){if(!z.trim())C(X,{force:!0});else H(X,z);U=!0}}catch{}return{skillsRemoved:J,mcpUnregistered:Q,agentsBlockRemoved:Y,claudeImportRemoved:U}}var L=`---
|
|
54
54
|
name: beacon-init
|
|
55
55
|
description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
|
|
56
56
|
---
|
|
@@ -97,7 +97,7 @@ beacon init-persist /tmp/beacon-init.json # or: beacon init-persist < /tmp/bea
|
|
|
97
97
|
That one command wires the repo (writes \`.mcp.json\` + skills so your NEXT session gets the \`beacon_*\` tools natively, heals the global install), starts the Beacon daemon if it isn't running, registers + provisions this workspace, and POSTs your analysis to the same \`/api/init\` endpoint the MCP tool uses \u2014 so init completes in THIS session. Read the counts it prints and report them.
|
|
98
98
|
|
|
99
99
|
After the tool (or \`beacon init-persist\`) returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
|
|
100
|
-
`,
|
|
100
|
+
`,b=`---
|
|
101
101
|
name: beacon-refresh
|
|
102
102
|
description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
|
|
103
103
|
---
|
|
@@ -144,7 +144,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
|
|
|
144
144
|
If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
|
|
145
145
|
|
|
146
146
|
After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
|
|
147
|
-
`,
|
|
147
|
+
`,S=`---
|
|
148
148
|
name: beacon-plan
|
|
149
149
|
description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
|
|
150
150
|
---
|
|
@@ -193,7 +193,7 @@ If it returns feedback, revise and call it again.
|
|
|
193
193
|
If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
|
|
194
194
|
with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
|
|
195
195
|
run \`beacon\` in this repo once.
|
|
196
|
-
`,
|
|
196
|
+
`,y=`---
|
|
197
197
|
name: beacon-explain
|
|
198
198
|
description: Teach the user part of THIS codebase as an interactive visual lesson on Beacon's /learn page \u2014 a concept map + plain-English narrative they can question \u2014 instead of a wall of text. Use when the user says "explain", "teach me", "walk me through", "how does X work", or "help me understand the Y category".
|
|
199
199
|
---
|
|
@@ -263,7 +263,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
|
|
|
263
263
|
Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
|
|
264
264
|
the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
|
|
265
265
|
the lesson.
|
|
266
|
-
`,qq,
|
|
266
|
+
`,qq,E="<!-- beacon:workflow:start -->",j="<!-- beacon:workflow:end -->",f;var Xq=O(()=>{F();k();qq=[{name:"beacon-init",body:()=>L},{name:"beacon-refresh",body:()=>b}];f=`${E}
|
|
267
267
|
## Beacon \u2014 feature workflow
|
|
268
268
|
|
|
269
269
|
This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
|
|
@@ -335,4 +335,4 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
335
335
|
If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
|
|
336
336
|
|
|
337
337
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
338
|
-
${
|
|
338
|
+
${j}`});Xq();export{h as stripAgentsPointer,Yq as repoMcpCliTarget,$q as removeRepoAssets,i as installRefreshSkill,o as installPlanSkill,r as installInitSkill,e as installExplainSkill,Jq as installCodexRepoSkills,Qq as ensureWorkflowDoc,Vq as ensureMcp,R as contextDocTargets,Zq as auditRepo,b as REFRESH_SKILL,S as PLAN_SKILL,L as INIT_SKILL,y as EXPLAIN_SKILL};
|