trybeacon 0.1.66 → 0.1.67
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 +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 +11 -11
- package/.next/server/app/_not-found.segments/_full.segment.rsc +11 -11
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
- 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/lesson/close/route.js +1 -1
- package/.next/server/app/api/lesson/questions/route.js +1 -1
- package/.next/server/app/api/lesson/route.js +1 -1
- package/.next/server/app/api/lesson/save/route.js +1 -1
- package/.next/server/app/api/lesson/verdict/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 +11 -11
- package/.next/server/app/docs.segments/_full.segment.rsc +11 -11
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +11 -11
- 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 +11 -11
- package/.next/server/app/feedback.segments/_full.segment.rsc +11 -11
- package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_index.segment.rsc +11 -11
- 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 +11 -11
- package/.next/server/app/help.segments/_full.segment.rsc +11 -11
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +11 -11
- 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 +12 -12
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +12 -12
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +11 -11
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/learn/page.js +5 -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 +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/plan/page.js +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/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 +8 -8
- package/.next/server/chunks/2025.js +1 -0
- package/.next/server/chunks/2994.js +2 -0
- package/.next/server/chunks/4046.js +3 -3
- package/.next/server/chunks/5683.js +1 -0
- package/.next/server/chunks/5719.js +1 -0
- package/.next/server/chunks/7720.js +154 -0
- 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/1276-b84f61ec9c0df862.js +1 -0
- package/.next/static/chunks/1a258343-954e0e6619585d3c.js +2 -0
- package/.next/static/chunks/2059-fba06ba63ba64522.js +62 -0
- package/.next/static/chunks/4607-a668ea431c41e60e.js +1 -0
- package/.next/static/chunks/4853-6dc402b4ce452fa5.js +1 -0
- package/.next/static/chunks/{7043-254590cf9891391f.js → 4888-911c0da3c2d785d2.js} +1 -1
- package/.next/static/chunks/5957-83f611fcd5a08b45.js +1 -0
- package/.next/static/chunks/766-242213d211df0afd.js +1 -0
- package/.next/static/chunks/8997-78a359d0d238622e.js +1 -0
- package/.next/static/chunks/app/{layout-0c993f55d3a798f4.js → layout-9f0f4d8e4534a62e.js} +1 -1
- package/.next/static/chunks/app/learn/page-03acad0a37068966.js +7 -0
- package/.next/static/chunks/app/map/page-5cfad64d5feea695.js +1 -0
- package/.next/static/chunks/app/page-d08947a671077569.js +1 -0
- package/.next/static/chunks/app/plan/page-5eacb6b83bd4873d.js +1 -0
- package/.next/static/chunks/app/s/[token]/page-1a350cf50a45500c.js +1 -0
- package/.next/static/chunks/app/settings/page-7e176d120b1effa9.js +1 -0
- package/.next/static/css/63986592e2be7d62.css +1 -0
- package/.next/trace +43 -43
- package/.next/trace-build +1 -1
- package/dist/bin/beacon.js +14 -12
- package/dist/bin/doctor.js +22 -15
- package/dist/bin/hook.js +18 -11
- package/dist/bin/mcp.js +41 -34
- package/dist/bin/plan.js +21 -14
- package/dist/bin/uninstall.js +26 -19
- package/dist/lib/assets.js +7 -0
- package/dist/lib/codex-install.js +28 -21
- package/dist/lib/global-install.js +27 -20
- package/package.json +1 -1
- package/plugin/skills/beacon-explain/SKILL.md +7 -0
- package/.next/server/chunks/3584.js +0 -154
- package/.next/server/chunks/6024.js +0 -2
- package/.next/server/chunks/7187.js +0 -1
- package/.next/server/chunks/8035.js +0 -1
- package/.next/static/chunks/1936-7fea5225b5bfcfda.js +0 -1
- package/.next/static/chunks/1a258343-6baccd9e573fdfaf.js +0 -2
- package/.next/static/chunks/2019-3be80edc82176878.js +0 -1
- package/.next/static/chunks/3845-6fe7e66d4bf82eb5.js +0 -1
- package/.next/static/chunks/4549-591415d55ca009a3.js +0 -62
- package/.next/static/chunks/6638-4e53879181b1df75.js +0 -1
- package/.next/static/chunks/7643-6c7ff4b9400f68fc.js +0 -1
- package/.next/static/chunks/app/learn/page-797d74e02b98fa88.js +0 -5
- package/.next/static/chunks/app/map/page-634b6d5d98e921b3.js +0 -1
- package/.next/static/chunks/app/page-84dc684d45002cfb.js +0 -1
- package/.next/static/chunks/app/plan/page-df829b2054c40611.js +0 -1
- package/.next/static/chunks/app/s/[token]/page-f97dec75856a7952.js +0 -1
- package/.next/static/chunks/app/settings/page-59d90685cd17fc1f.js +0 -1
- package/.next/static/css/b3d3212da726bbfb.css +0 -1
- /package/.next/static/{P3uXQySdS-m6_bxuiezYe → hkOIw5DQW9WSwBwZrD8_9}/_buildManifest.js +0 -0
- /package/.next/static/{P3uXQySdS-m6_bxuiezYe → hkOIw5DQW9WSwBwZrD8_9}/_ssgManifest.js +0 -0
package/dist/bin/plan.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var OZ=Object.defineProperty;var AZ=(Q)=>Q;function EZ(Q,Z){this[Q]=AZ.bind(null,Z)}var VQ=(Q,Z)=>{for(var $ in Z)OZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:EZ.bind(Z,$)})};var C=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var yQ=1500,
|
|
3
|
+
var OZ=Object.defineProperty;var AZ=(Q)=>Q;function EZ(Q,Z){this[Q]=AZ.bind(null,Z)}var VQ=(Q,Z)=>{for(var $ in Z)OZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:EZ.bind(Z,$)})};var C=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var yQ=1500,LQ=480000,P1=1800000,E=3600000,v1=3000;var zQ=()=>{};var WQ={};VQ(WQ,{removeRepoAssets:()=>pZ,installRefreshSkill:()=>IZ,installPlanSkill:()=>yZ,installInitSkill:()=>bZ,installExplainSkill:()=>LZ,installCodexRepoSkills:()=>_Z,ensureWorkflowDoc:()=>SZ,ensureMcp:()=>hZ,auditRepo:()=>mZ,REFRESH_SKILL:()=>XQ,PLAN_SKILL:()=>_Q,INIT_SKILL:()=>qQ,EXPLAIN_SKILL:()=>SQ});import{existsSync as M,mkdirSync as F,readFileSync as j,rmSync as b,writeFileSync as B}from"fs";import{join as U}from"path";function bZ(Q){let Z=U(Q,".claude","skills","beacon-init");F(Z,{recursive:!0});let $=U(Z,"SKILL.md");return B($,qQ),$}function IZ(Q){let Z=U(Q,".claude","skills","beacon-refresh");F(Z,{recursive:!0});let $=U(Z,"SKILL.md");return B($,XQ),$}function yZ(Q){let Z=U(Q,".claude","skills","beacon-plan");F(Z,{recursive:!0});let $=U(Z,"SKILL.md");return B($,_Q),$}function LZ(Q){let Z=U(Q,".claude","skills","beacon-explain");F(Z,{recursive:!0});let $=U(Z,"SKILL.md");return B($,SQ),$}function _Z(Q){let Z=[];for(let $ of kZ){let Y=U(Q,".agents","skills",$.name);F(Y,{recursive:!0});let J=U(Y,"SKILL.md");B(J,$.body()),Z.push(J)}return Z}function SZ(Q){let Z=U(Q,"AGENTS.md"),$="";try{$=j(Z,"utf8")}catch{}let Y=new RegExp(`${I}[\\s\\S]*?${UQ}`);$=Y.test($)?$.replace(Y,kQ):`${$.trim()}
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${kQ}
|
|
6
6
|
`.trimStart(),B(Z,$.endsWith(`
|
|
7
7
|
`)?$:`${$}
|
|
8
8
|
`);let J=U(Q,"CLAUDE.md"),V="";try{V=j(J,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))B(J,`${V?`${V.trim()}
|
|
@@ -214,6 +214,13 @@ push depth into \`detail\`, not the node face. Supply \`steps\` for the guided w
|
|
|
214
214
|
is the overview (empty \`focusIds\`), then teach one node (or a few) per step in order, each with its
|
|
215
215
|
\`focusIds\`.
|
|
216
216
|
|
|
217
|
+
When the topic involves DATABASE tables, pass them in \`tables\` (they render as annotated schema cards
|
|
218
|
+
on the SAME board, not just raw schemas). For each table give a one-line \`note\` (why it exists), mark
|
|
219
|
+
the key columns \`isPk\`, point FKs at another table with \`fkTo: "<that table's id>"\`, give EVERY column a
|
|
220
|
+
short plain-English \`note\`, and add a \`sample\` row or two (the worked example, made concrete). Connect a
|
|
221
|
+
concept to its table with an \`edge\` (e.g. \`persists to\` / \`reads from\`) whose \`toId\` is the table's id \u2014
|
|
222
|
+
so the learner sees the table IN CONTEXT, wired to the code that uses it.
|
|
223
|
+
|
|
217
224
|
## 4. Answer in the loop \u2014 don't stop after one round
|
|
218
225
|
|
|
219
226
|
\`beacon_explain\` returns the user's questions, each tagged \`[q:ID]\`. Answer EACH by calling
|
|
@@ -221,7 +228,7 @@ is the overview (empty \`focusIds\`), then teach one node (or a few) per step in
|
|
|
221
228
|
Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
|
|
222
229
|
the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
|
|
223
230
|
the lesson.
|
|
224
|
-
`,
|
|
231
|
+
`,kZ,I="<!-- beacon:workflow:start -->",UQ="<!-- beacon:workflow:end -->",kQ;var HQ=C(()=>{zQ();kZ=[{name:"beacon-init",body:()=>qQ},{name:"beacon-refresh",body:()=>XQ}];kQ=`${I}
|
|
225
232
|
## Beacon \u2014 feature workflow
|
|
226
233
|
|
|
227
234
|
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:
|
|
@@ -293,18 +300,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
293
300
|
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.
|
|
294
301
|
|
|
295
302
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
296
|
-
${UQ}`});import{existsSync as y,mkdirSync as BQ,readdirSync as cZ,readFileSync as
|
|
303
|
+
${UQ}`});import{existsSync as y,mkdirSync as BQ,readdirSync as cZ,readFileSync as T,rmSync as lZ,writeFileSync as L}from"fs";import{dirname as hQ,join as K}from"path";function mQ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function pQ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;let Z=K(Q,".claude","plugins");if(!y(Z))return null;let $=[Z];for(let Y=0;Y<3&&$.length;Y++){let J=[];for(let V of $){let q=K(V,".claude-plugin","plugin.json");try{if(y(q)&&JSON.parse(T(q,"utf8")).name==="beacon")return V}catch{}try{for(let W of cZ(V,{withFileTypes:!0}))if(W.isDirectory())J.push(K(V,W.name))}catch{}}$=J}return null}function cQ(Q){return pQ(Q)!==null}function dZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function aZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;try{let Z=JSON.parse(T(K(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 GQ(Q){try{return JSON.parse(T(Q,"utf8"))}catch{return{}}}function lQ(Q,Z){BQ(hQ(Q),{recursive:!0}),L(Q,JSON.stringify(Z,null,2)+`
|
|
297
304
|
`)}function _(Q,Z){let $=GQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let Y=$.hooks[Z.event];if(Y.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((q)=>q.command===Z.command)))return!1;return Y.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),lQ(Q,$),!0}function S(Q,Z){return(GQ(Q).hooks?.[Z.event]??[]).some((J)=>J.hooks?.some((V)=>V.command===Z.command))}function h(Q,Z){let $=GQ(Q),Y=$.hooks?.[Z.event];if(!Y)return!1;let J=!1,V=Y.map((q)=>{let W=q.hooks?.length??0,z=(q.hooks??[]).filter((X)=>X.command!==Z.command);if(z.length!==W)J=!0;return{...q,hooks:z}}).filter((q)=>(q.hooks??[]).length>0);if(!J)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return lQ(Q,$),!0}function m(Q,Z,$,Y){let J=`${Z}
|
|
298
305
|
${Y.trim()}
|
|
299
|
-
${$}`,V="";try{V=
|
|
306
|
+
${$}`,V="";try{V=T(Q,"utf8")}catch{}let q=new RegExp(`${Z}[\\s\\S]*?${$}`);V=q.test(V)?V.replace(q,J):V.trim()?`${V.trim()}
|
|
300
307
|
|
|
301
308
|
${J}
|
|
302
309
|
`:`${J}
|
|
303
|
-
`,BQ(hQ(Q),{recursive:!0}),
|
|
310
|
+
`,BQ(hQ(Q),{recursive:!0}),L(Q,V.endsWith(`
|
|
304
311
|
`)?V:`${V}
|
|
305
|
-
`)}function w(Q,Z){try{return
|
|
312
|
+
`)}function w(Q,Z){try{return T(Q,"utf8").includes(Z)}catch{return!1}}function p(Q,Z,$){let Y="";try{Y=T(Q,"utf8")}catch{return!1}let J=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!J.test(Y))return!1;let V=Y.replace(J,"").replace(/\n{3,}/g,`
|
|
306
313
|
|
|
307
|
-
`).trimStart();return
|
|
314
|
+
`).trimStart();return L(Q,V),!0}function c(Q,Z,$){let Y=K(Q,Z);BQ(Y,{recursive:!0});let J=K(Y,"SKILL.md");return L(J,$),J}function u(Q,Z){return y(K(Q,Z,"SKILL.md"))}function l(Q,Z){let $=K(Q,Z);if(!y($))return!1;return lZ($,{recursive:!0,force:!0}),!0}var x,k=`## Beacon (visual planning panel)
|
|
308
315
|
|
|
309
316
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
310
317
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -328,24 +335,24 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
328
335
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
329
336
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
330
337
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
331
|
-
verbatim. Do NOT implement until the tool returns approval.`;var jQ=C(()=>{
|
|
338
|
+
verbatim. Do NOT implement until the tool returns approval.`;var jQ=C(()=>{x=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as nZ,renameSync as tZ,rmSync as sZ,writeFileSync as rZ}from"fs";import{dirname as oZ}from"path";function d(Q,Z){nZ(oZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{rZ($,Z),tZ($,Q)}catch(Y){throw sZ($,{force:!0}),Y}}function f1(Q,Z,$=!1){d(Q,JSON.stringify(Z,null,$?2:void 0))}var dQ=()=>{};var eQ={};VQ(eQ,{setupCodexAssets:()=>Z0,removeCodexMcp:()=>iQ,removeCodexArtifacts:()=>Y0,hasCodexMcp:()=>PQ,ensureCodexMcp:()=>oQ,codexMcpProblem:()=>Q0,codexDetected:()=>tQ,auditCodex:()=>$0,CODEX_HOOKS:()=>r});import{readFileSync as s}from"fs";import{homedir as iZ}from"os";import{join as f}from"path";function aQ(){return process.env.HOME||process.env.USERPROFILE||iZ()}function tQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(KQ===void 0)KQ=Bun.which("codex")!==null;return KQ}function D(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function PQ(){try{return Boolean(D(s(R(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function Q0(){let Q="";try{Q=s(R(),"utf8")}catch{return null}let Z=D(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 oQ(){let Q="",Z=!1;try{Q=s(R(),"utf8"),Z=!0}catch{}if(Z){let V=D(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${g}`};if(V.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 $=!Q?"":Q.endsWith(`
|
|
332
339
|
`)?`
|
|
333
340
|
`:`
|
|
334
341
|
|
|
335
|
-
`,Y=Q+$+
|
|
342
|
+
`,Y=Q+$+eZ;if(D(Y)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${g}`};return d(R(),Y),{added:!0}}function iQ(){let Q="";try{Q=s(R(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
336
343
|
`),$=Z.indexOf(sQ);if($===-1)return{removed:!1,skipped:PQ()};let Y=Z.indexOf(rQ,$);if(Y===-1)return{removed:!1,skipped:!0};Z.splice($,Y-$+1);let J=Z.join(`
|
|
337
344
|
`).replace(/\n{3,}/g,`
|
|
338
345
|
|
|
339
|
-
`).replace(/^\n+/,"");if(D(J)===null)return{removed:!1,skipped:!0};return d(
|
|
346
|
+
`).replace(/^\n+/,"");if(D(J)===null)return{removed:!1,skipped:!0};return d(R(),J),{removed:!0}}async function Z0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (HQ(),WQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":Y},V=[];for(let X of x){if(!u(n(),X))V.push(X);c(n(),X,J[X])}let q=0;for(let X of r)if(_(NQ(),{event:X.event,matcher:X.matcher,command:X.command}))q++;let W=w(a(),t);m(a(),t,nQ,k);let z=oQ();return{skillsAdded:V,hooksAdded:q,agentsMdBlockTouched:!W,mcp:z}}function $0(){let Q={};for(let $ of x)Q[$]=u(n(),$);let Z={};for(let $ of r)Z[$.event]=S(NQ(),{event:$.event,command:$.command});return{detected:tQ(),skills:Q,hooks:Z,agentsMdBlock:w(a(),t),mcp:PQ()}}function Y0(){let Q=[];for(let J of x)if(l(n(),J))Q.push(J);let Z=0;for(let J of r)if(h(NQ(),{event:J.event,command:J.command}))Z++;let $=p(a(),t,nQ),Y=iQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var xQ=()=>f(aQ(),".codex"),NQ=()=>f(xQ(),"hooks.json"),R=()=>f(xQ(),"config.toml"),a=()=>f(xQ(),"AGENTS.md"),n=()=>f(aQ(),".agents","skills"),t="<!-- beacon:global:start -->",nQ="<!-- beacon:global:end -->",r,KQ,sQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",rQ="# beacon:end",eZ,g="add it manually: codex mcp add beacon -- beacon mcp";var QZ=C(()=>{jQ();dQ();r=[{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."}];eZ=`${sQ}
|
|
340
347
|
[mcp_servers.beacon]
|
|
341
348
|
command = "beacon"
|
|
342
349
|
args = ["mcp"]
|
|
343
350
|
${rQ}
|
|
344
|
-
`});var zZ={};VQ(zZ,{provisionDb:()=>u0});import{createClient as K0}from"@libsql/client";import{drizzle as x0}from"drizzle-orm/libsql";import{migrate as N0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as P0}from"drizzle-orm/migrator";import{dirname as RQ,join as v0}from"path";import{fileURLToPath as C0}from"url";async function e(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function R0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((Y)=>String(Y.name)))}async function VZ(Q){if(!await e(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 w0(Q){for(let[Z,$]of Object.entries(F0)){if(!await e(Q,Z))continue;let Y=await R0(Q,Z);for(let J of $){if(!Y.has(J))continue;await Q.execute(`UPDATE "${Z}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function u0(Q,Z=T0){let $=K0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let Y=await e($,"__drizzle_migrations"),J=await e($,"Node"),V=!1;if(J&&!Y){let W=P0({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 q=await VZ($);if(await N0(x0($),{migrationsFolder:Z}),await VZ($)>q)V=!0;return await w0($),{migrated:V}}finally{$.close()}}var M0,T0,F0;var qZ=C(async()=>{M0=RQ(RQ(RQ(C0(import.meta.url)))),T0=process.env.BEACON_MIGRATIONS_DIR||v0(M0,"drizzle"),F0={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 $0}from"fs";import{homedir as Y0}from"os";import{join as o}from"path";function J0(){return process.env.HOME||process.env.USERPROFILE||Y0()}var i=()=>o(J0(),".claude"),vQ=()=>o(i(),"skills"),CQ=()=>o(i(),"settings.json"),MQ=()=>o(i(),"CLAUDE.md"),TQ="<!-- beacon:global:start -->",ZZ="<!-- beacon:global:end -->";var V0=L,FQ=[{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 z0(Q,Z){return c(vQ(),Q,Z)}function $Z(Q){return u(vQ(),Q)}function q0(Q){return l(vQ(),Q)}function X0(Q){return _(CQ(),Q)}function U0(Q){return S(CQ(),Q)}function W0(Q){return h(CQ(),Q)}function H0(Q){m(MQ(),TQ,ZZ,Q)}function YZ(){return w(MQ(),TQ)}function B0(){return p(MQ(),TQ,ZZ)}function _1(){let Q={};for(let $ of K)Q[$]=$Z($);let Z={};for(let $ of FQ)Z[$.event]=U0({event:$.event,command:$.command});return{homeExists:$0(i()),skills:Q,hooks:Z,claudeMdBlock:YZ()}}async function G0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (HQ(),WQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":Y},V=[];for(let z of K){if(!$Z(z))V.push(z);z0(z,J[z])}let q=0;for(let z of FQ)if(X0({event:z.event,matcher:z.matcher,command:z.command}))q++;let W=YZ();return H0(V0),{skillsAdded:V,hooksAdded:q,claudeMdBlockTouched:!W}}async function JZ(){if(mQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(cQ()){try{j0()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await G0()}}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(() => (QZ(),eQ));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 j0(){let Q=[];for(let Y of K)if(q0(Y))Q.push(Y);let Z=0;for(let Y of FQ)if(W0(Y))Z++;let $=B0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as g0}from"async_hooks";import{spawnSync as D0}from"child_process";import{createHash as f0}from"crypto";import{existsSync as UZ,mkdirSync as O,readFileSync as uQ,writeFileSync as gQ}from"fs";import{homedir as WZ}from"os";import{basename as O0,join as x,parse as A0,resolve as XZ}from"path";function G(){return process.env.BEACON_HOME||x(WZ(),".beacon")}function DQ(){return x(G(),"workspaces.json")}function QQ(Q){return f0("sha256").update(Q).digest("hex").slice(0,12)}function i1(Q=process.cwd()){let Z=D0("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 HZ(Q){let Z=XZ(Q);return Z!==XZ(WZ())&&Z!==A0(Z).root}function BZ(){return x(G(),"deleted.json")}function fQ(){try{let Q=JSON.parse(uQ(BZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function GZ(Q){O(G(),{recursive:!0}),gQ(BZ(),JSON.stringify(Q,null,2))}function jZ(Q){return fQ().includes(Q)}function e1(Q){let Z=fQ();if(!Z.includes(Q))GZ([...Z,Q])}function E0(Q){let Z=fQ();if(Z.includes(Q))GZ(Z.filter(($)=>$!==Q))}function ZQ(Q){return x(G(),Q)}function b0(Q){return`file:${x(ZQ(Q),"db.sqlite")}`}function A(){try{let Q=JSON.parse(uQ(DQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function OQ(Q){O(G(),{recursive:!0}),gQ(DQ(),JSON.stringify(Q,null,2))}function KZ(){return A().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function P(Q){return A().find((Z)=>Z.id===Q)??null}function xZ(Q,Z,$=new Date().toISOString()){if(!HZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let Y=QQ(Q);if(jZ(Y))throw Error(`beacon: workspace ${Y} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let J=A(),V=J.find((z)=>z.id===Y),q={id:Y,path:Q,name:Z||V?.name||O0(Q),lastOpenedAt:$},W=[q,...J.filter((z)=>z.id!==Y)];return O(ZQ(Y),{recursive:!0}),OQ(W),q}function Q2(Q,Z){return E0(QQ(Q)),xZ(Q,Z)}function Z2(Q,Z=new Date().toISOString()){let $=A(),Y=$.find((J)=>J.id===Q);if(!Y)return;Y.lastOpenedAt=Z,OQ($)}function $2(Q){if(OQ(A().filter((Z)=>Z.id!==Q)),AQ()===Q)I0(KZ()[0]?.id??null)}function NZ(){return x(G(),"active")}function AQ(){try{return uQ(NZ(),"utf8").trim()||null}catch{return null}}function I0(Q){O(G(),{recursive:!0}),gQ(NZ(),Q??"")}function Y2(){let Q=AQ();return Q?P(Q):null}function J2(){let Q=L0()??AQ();return Q?P(Q):null}function V2(Q){return P(Q)?.path??null}function z2(){return UZ(DQ())}var PZ="beacon_ws";function vZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let Y of $.split(";")){let J=Y.indexOf("=");if(J===-1)continue;if(Y.slice(0,J).trim()===Z)return decodeURIComponent(Y.slice(J+1).trim())}return null}function q2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=vZ(Q,PZ);if($&&P($))return $;return y0()}function y0(){let Q=KZ();return Q.length===1?Q[0].id:null}var k0="x-beacon-workspace-path";async function X2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=Q.headers.get(k0);if($&&HZ($)&&!jZ(QQ($))&&(!Z||QQ($)===Z)){let J=xZ($);return await _0(J.id),J.id}let Y=vZ(Q,PZ);if(Y&&P(Y))return Y;return null}var CZ=new g0;function U2(Q,Z){return Q?CZ.run(Q,Z):Z()}function L0(){return CZ.getStore()??null}var wQ=new Set;function W2(Q){wQ.delete(x(ZQ(Q),"db.sqlite"))}async function _0(Q){let Z=ZQ(Q),$=x(Z,"db.sqlite"),Y=UZ($);if(Y&&wQ.has($))return{ok:!0,created:!1,migrated:!1};try{O(Z,{recursive:!0});let{provisionDb:J}=await qZ().then(() => zZ),V=await J(b0(Q));return wQ.add($),{ok:!0,created:!Y,migrated:Y&&V.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}import{connect as S0}from"net";var G2=4319;function h0(Q,Z,$=400){return new Promise((Y)=>{let J=S0({host:Q,port:Z}),V=!1,q=(W)=>{if(V)return;V=!0,J.destroy(),Y(W)};J.once("connect",()=>q(!0)),J.once("error",()=>q(!1)),J.setTimeout($,()=>q(!1))})}async function m0(Q){for(let Z of["127.0.0.1","::1"])if(await h0(Z,Q))return!1;return!0}async function MZ(Q,Z=20){for(let $=Q;$<Q+Z;$++)if(await m0($))return $;return Q}import{execSync as s0,spawn as r0}from"child_process";import{mkdirSync as o0,openSync as i0,readFileSync as e0,writeFileSync as Q1}from"fs";import{homedir as Z1}from"os";import{dirname as $1,join as YQ}from"path";import{fileURLToPath as Y1}from"url";import{createHash as J1}from"crypto";zQ();import{mkdirSync as c0,readFileSync as l0,writeFileSync as d0}from"fs";import{join as a0}from"path";var p0=["default","acceptEdits","bypassPermissions","auto"];function TZ(Q){return typeof Q==="string"&&p0.includes(Q)}function FZ(Q,Z){let $={behavior:"allow"};if(Q)$.updatedPermissions=[{type:"setMode",mode:Q,destination:"session"}];let Y={hookEventName:"PermissionRequest",decision:$};if(Z?.trim())Y.additionalContext=Z;return{hookSpecificOutput:Y}}function RZ(){return a0(G(),"preferences.json")}function EQ(){try{let Q=JSON.parse(l0(RZ(),"utf8"));return{planApprovalMode:TZ(Q.planApprovalMode)?Q.planApprovalMode:void 0,planApprovalModeConfigured:Q.planApprovalModeConfigured===!0,telemetryUuid:typeof Q.telemetryUuid==="string"?Q.telemetryUuid:void 0,telemetryEnabled:Q.telemetryEnabled===!1?!1:Q.telemetryEnabled===!0?!0:void 0}}catch{return{}}}function C2(Q){let Z={...EQ(),...Q};return c0(G(),{recursive:!0}),d0(RZ(),JSON.stringify(Z,null,2)),Z}function wZ(Q){if(!Q?.length)return"";let Z=Q.map((Y)=>Y.id?` \u2022 ${Y.title} \u2014 id: ${Y.id}`:` \u2022 ${Y.title}`),$=Q.some((Y)=>Y.id);return`
|
|
351
|
+
`});var zZ={};VQ(zZ,{provisionDb:()=>D0});import{createClient as N0}from"@libsql/client";import{drizzle as P0}from"drizzle-orm/libsql";import{migrate as v0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as C0}from"drizzle-orm/migrator";import{dirname as FQ,join as M0}from"path";import{fileURLToPath as T0}from"url";async function e(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function u0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((Y)=>String(Y.name)))}async function VZ(Q){if(!await e(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 g0(Q){for(let[Z,$]of Object.entries(w0)){if(!await e(Q,Z))continue;let Y=await u0(Q,Z);for(let J of $){if(!Y.has(J))continue;await Q.execute(`UPDATE "${Z}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function D0(Q,Z=F0){let $=N0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let Y=await e($,"__drizzle_migrations"),J=await e($,"Node"),V=!1;if(J&&!Y){let W=C0({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 q=await VZ($);if(await v0(P0($),{migrationsFolder:Z}),await VZ($)>q)V=!0;return await g0($),{migrated:V}}finally{$.close()}}var R0,F0,w0;var qZ=C(async()=>{R0=FQ(FQ(FQ(T0(import.meta.url)))),F0=process.env.BEACON_MIGRATIONS_DIR||M0(R0,"drizzle"),w0={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 J0}from"fs";import{homedir as V0}from"os";import{join as o}from"path";function z0(){return process.env.HOME||process.env.USERPROFILE||V0()}var i=()=>o(z0(),".claude"),vQ=()=>o(i(),"skills"),CQ=()=>o(i(),"settings.json"),MQ=()=>o(i(),"CLAUDE.md"),TQ="<!-- beacon:global:start -->",ZZ="<!-- beacon:global:end -->";var q0=k,RQ=[{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 X0(Q,Z){return c(vQ(),Q,Z)}function $Z(Q){return u(vQ(),Q)}function U0(Q){return l(vQ(),Q)}function W0(Q){return _(CQ(),Q)}function H0(Q){return S(CQ(),Q)}function B0(Q){return h(CQ(),Q)}function G0(Q){m(MQ(),TQ,ZZ,Q)}function YZ(){return w(MQ(),TQ)}function j0(){return p(MQ(),TQ,ZZ)}function h1(){let Q={};for(let $ of x)Q[$]=$Z($);let Z={};for(let $ of RQ)Z[$.event]=H0({event:$.event,command:$.command});return{homeExists:J0(i()),skills:Q,hooks:Z,claudeMdBlock:YZ()}}async function K0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:Y}=await Promise.resolve().then(() => (HQ(),WQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":Y},V=[];for(let z of x){if(!$Z(z))V.push(z);X0(z,J[z])}let q=0;for(let z of RQ)if(W0({event:z.event,matcher:z.matcher,command:z.command}))q++;let W=YZ();return G0(q0),{skillsAdded:V,hooksAdded:q,claudeMdBlockTouched:!W}}async function JZ(){if(mQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(cQ()){try{x0()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await K0()}}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(() => (QZ(),eQ));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 x0(){let Q=[];for(let Y of x)if(U0(Y))Q.push(Y);let Z=0;for(let Y of RQ)if(B0(Y))Z++;let $=j0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as f0}from"async_hooks";import{spawnSync as O0}from"child_process";import{createHash as A0}from"crypto";import{existsSync as UZ,mkdirSync as O,readFileSync as uQ,writeFileSync as gQ}from"fs";import{homedir as WZ}from"os";import{basename as E0,join as N,parse as b0,resolve as XZ}from"path";function G(){return process.env.BEACON_HOME||N(WZ(),".beacon")}function DQ(){return N(G(),"workspaces.json")}function QQ(Q){return A0("sha256").update(Q).digest("hex").slice(0,12)}function Q2(Q=process.cwd()){let Z=O0("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 HZ(Q){let Z=XZ(Q);return Z!==XZ(WZ())&&Z!==b0(Z).root}function BZ(){return N(G(),"deleted.json")}function fQ(){try{let Q=JSON.parse(uQ(BZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function GZ(Q){O(G(),{recursive:!0}),gQ(BZ(),JSON.stringify(Q,null,2))}function jZ(Q){return fQ().includes(Q)}function Z2(Q){let Z=fQ();if(!Z.includes(Q))GZ([...Z,Q])}function I0(Q){let Z=fQ();if(Z.includes(Q))GZ(Z.filter(($)=>$!==Q))}function ZQ(Q){return N(G(),Q)}function y0(Q){return`file:${N(ZQ(Q),"db.sqlite")}`}function A(){try{let Q=JSON.parse(uQ(DQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function OQ(Q){O(G(),{recursive:!0}),gQ(DQ(),JSON.stringify(Q,null,2))}function KZ(){return A().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function P(Q){return A().find((Z)=>Z.id===Q)??null}function xZ(Q,Z,$=new Date().toISOString()){if(!HZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let Y=QQ(Q);if(jZ(Y))throw Error(`beacon: workspace ${Y} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let J=A(),V=J.find((z)=>z.id===Y),q={id:Y,path:Q,name:Z||V?.name||E0(Q),lastOpenedAt:$},W=[q,...J.filter((z)=>z.id!==Y)];return O(ZQ(Y),{recursive:!0}),OQ(W),q}function $2(Q,Z){return I0(QQ(Q)),xZ(Q,Z)}function Y2(Q,Z=new Date().toISOString()){let $=A(),Y=$.find((J)=>J.id===Q);if(!Y)return;Y.lastOpenedAt=Z,OQ($)}function J2(Q){if(OQ(A().filter((Z)=>Z.id!==Q)),AQ()===Q)L0(KZ()[0]?.id??null)}function NZ(){return N(G(),"active")}function AQ(){try{return uQ(NZ(),"utf8").trim()||null}catch{return null}}function L0(Q){O(G(),{recursive:!0}),gQ(NZ(),Q??"")}function V2(){let Q=AQ();return Q?P(Q):null}function z2(){let Q=S0()??AQ();return Q?P(Q):null}function q2(Q){return P(Q)?.path??null}function X2(){return UZ(DQ())}var PZ="beacon_ws";function vZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let Y of $.split(";")){let J=Y.indexOf("=");if(J===-1)continue;if(Y.slice(0,J).trim()===Z)return decodeURIComponent(Y.slice(J+1).trim())}return null}function U2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=vZ(Q,PZ);if($&&P($))return $;return k0()}function k0(){let Q=KZ();return Q.length===1?Q[0].id:null}var _0="x-beacon-workspace-path";async function W2(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=Q.headers.get(_0);if($&&HZ($)&&!jZ(QQ($))&&(!Z||QQ($)===Z)){let J=xZ($);return await h0(J.id),J.id}let Y=vZ(Q,PZ);if(Y&&P(Y))return Y;return null}var CZ=new f0;function H2(Q,Z){return Q?CZ.run(Q,Z):Z()}function S0(){return CZ.getStore()??null}var wQ=new Set;function B2(Q){wQ.delete(N(ZQ(Q),"db.sqlite"))}async function h0(Q){let Z=ZQ(Q),$=N(Z,"db.sqlite"),Y=UZ($);if(Y&&wQ.has($))return{ok:!0,created:!1,migrated:!1};try{O(Z,{recursive:!0});let{provisionDb:J}=await qZ().then(() => zZ),V=await J(y0(Q));return wQ.add($),{ok:!0,created:!Y,migrated:Y&&V.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}import{connect as m0}from"net";var K2=4319;function p0(Q,Z,$=400){return new Promise((Y)=>{let J=m0({host:Q,port:Z}),V=!1,q=(W)=>{if(V)return;V=!0,J.destroy(),Y(W)};J.once("connect",()=>q(!0)),J.once("error",()=>q(!1)),J.setTimeout($,()=>q(!1))})}async function c0(Q){for(let Z of["127.0.0.1","::1"])if(await p0(Z,Q))return!1;return!0}async function MZ(Q,Z=20){for(let $=Q;$<Q+Z;$++)if(await c0($))return $;return Q}import{execSync as o0,spawn as i0}from"child_process";import{mkdirSync as e0,openSync as Q1,readFileSync as Z1,writeFileSync as $1}from"fs";import{homedir as Y1}from"os";import{dirname as J1,join as YQ}from"path";import{fileURLToPath as V1}from"url";import{createHash as z1}from"crypto";zQ();import{mkdirSync as d0,readFileSync as a0,writeFileSync as n0}from"fs";import{join as t0}from"path";var l0=["default","acceptEdits","bypassPermissions","auto"];function TZ(Q){return typeof Q==="string"&&l0.includes(Q)}function RZ(Q,Z){let $={behavior:"allow"};if(Q)$.updatedPermissions=[{type:"setMode",mode:Q,destination:"session"}];let Y={hookEventName:"PermissionRequest",decision:$};if(Z?.trim())Y.additionalContext=Z;return{hookSpecificOutput:Y}}function FZ(){return t0(G(),"preferences.json")}function EQ(){try{let Q=JSON.parse(a0(FZ(),"utf8"));return{planApprovalMode:TZ(Q.planApprovalMode)?Q.planApprovalMode:void 0,planApprovalModeConfigured:Q.planApprovalModeConfigured===!0,telemetryUuid:typeof Q.telemetryUuid==="string"?Q.telemetryUuid:void 0,telemetryEnabled:Q.telemetryEnabled===!1?!1:Q.telemetryEnabled===!0?!0:void 0}}catch{return{}}}function T2(Q){let Z={...EQ(),...Q};return d0(G(),{recursive:!0}),n0(FZ(),JSON.stringify(Z,null,2)),Z}function wZ(Q){if(!Q?.length)return"";let Z=Q.map((Y)=>Y.id?` \u2022 ${Y.title} \u2014 id: ${Y.id}`:` \u2022 ${Y.title}`),$=Q.some((Y)=>Y.id);return`
|
|
345
352
|
|
|
346
353
|
This plan created these roadmap feature(s):
|
|
347
354
|
`+Z.join(`
|
|
348
|
-
`)+'\n\nWhen the work ships, register them in ONE call: `beacon_feature({ action: "done" })` with a '+"`features` array \u2014 one entry per feature"+($?", each keyed by the `id` above (no title-matching needed)":"")+", each with the files you touched + a short markdown summary. Do them all in that single "+"batched call so every feature flips to Done \u2014 do NOT register only the umbrella, and do "+"NOT make one call per feature."}import{execSync as
|
|
349
|
-
`,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",W=await fetch(`${Y}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":V},body:JSON.stringify({description:q,markdown:Z})});if(W.status===422){let H=await W.json().catch(()=>({}));v($Q(H.error??"Beacon rejected the plan: every roadmap feature needs a category and a priority. Add them and re-present."))}if(!W.ok)v(bQ());await gZ(Y,V);let z=Date.now()+
|
|
355
|
+
`)+'\n\nWhen the work ships, register them in ONE call: `beacon_feature({ action: "done" })` with a '+"`features` array \u2014 one entry per feature"+($?", each keyed by the `id` above (no title-matching needed)":"")+", each with the files you touched + a short markdown summary. Do them all in that single "+"batched call so every feature flips to Done \u2014 do NOT register only the umbrella, and do "+"NOT make one call per feature."}import{execSync as s0}from"child_process";import{platform as uZ}from"os";function r0(Q){if(process.env.BEACON_NO_OPEN)return;let Z=uZ()==="darwin"?"open":uZ()==="win32"?"start":"xdg-open";try{s0(`${Z} "${Q}"`,{stdio:"ignore"})}catch{}}async function gZ(Q,Z){if(await fetch(`${Q}/api/plan/presence`,{headers:{"x-beacon-workspace":Z}}).then((J)=>J.json()).then((J)=>!!J?.live).catch(()=>!1))return;let Y=encodeURIComponent(`/plan?ws=${Z}`);r0(`${Q}/api/workspace/activate?id=${Z}&redirect=${Y}`)}var q1=YQ(J1(V1(import.meta.url)),".."),IQ=process.env.BEACON_HOME||YQ(Y1(),".beacon"),DZ=YQ(IQ,"server.json"),X1=process.env.PORT||"4319";function U1(Q){try{return process.kill(Q,0),!0}catch{return!1}}function W1(Q){try{return JSON.parse(Z1(Q,"utf8"))}catch{return null}}async function fZ(Q){try{return(await fetch(Q)).ok}catch{return!1}}async function H1(Q,Z=60){for(let $=0;$<Z;$++){if(await fZ(Q))return!0;await new Promise((Y)=>setTimeout(Y,500))}return!1}function B1(Q){e0(IQ,{recursive:!0});let Z=Q1(YQ(IQ,"server.log"),"a"),$={...process.env,PORT:Q,BEACON_NO_OPEN:"1"};delete $.BEACON_REPO,delete $.BEACON_DATA_DIR,delete $.DATABASE_URL;let Y=i0("bun",["run","dev"],{cwd:q1,env:$,detached:!0,stdio:["ignore",Z,Z]});Y.unref();let J={pid:Y.pid??0,port:Q};return $1(DZ,JSON.stringify(J)),J}async function G1(){let Q=W1(DZ);if(Q&&U1(Q.pid)&&await fZ(`http://localhost:${Q.port}/api/workspace`))return Q.port;let Z=String(await MZ(Number(X1))),{port:$}=B1(Z);return await H1(`http://localhost:${$}/api/workspace`),$}function j1(){try{return o0("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function K1(Q){return z1("sha256").update(Q).digest("hex").slice(0,12)}async function x1(){if(process.stdin.isTTY)return null;let Q=[];for await(let $ of process.stdin)Q.push($);let Z=Buffer.concat(Q).toString("utf8").trim();if(!Z)return null;try{return JSON.parse(Z)}catch{return null}}function bQ(Q,Z){return RZ(Q,Z)}function $Q(Q){return{hookSpecificOutput:{hookEventName:"PermissionRequest",decision:{behavior:"deny",message:Q}}}}function v(Q){process.stdout.write(JSON.stringify(Q)),process.exit(0)}(async()=>{await JZ();let Z=(await x1())?.tool_input?.plan;if(!Z||!Z.trim())v(bQ());let Y=`http://localhost:${await G1()}`,J=j1()||process.cwd(),V=K1(J);await fetch(`${Y}/api/workspace/activate?id=${V}`).catch(()=>{});let q=Z.split(`
|
|
356
|
+
`,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",W=await fetch(`${Y}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":V},body:JSON.stringify({description:q,markdown:Z})});if(W.status===422){let H=await W.json().catch(()=>({}));v($Q(H.error??"Beacon rejected the plan: every roadmap feature needs a category and a priority. Add them and re-present."))}if(!W.ok)v(bQ());await gZ(Y,V);let z=Date.now()+LQ,X=(H)=>new Promise((JQ)=>setTimeout(JQ,H));while(Date.now()<z){await X(yQ);let H=await fetch(`${Y}/api/plan/verdict`,{headers:{"x-beacon-workspace":V}}).then((JQ)=>JQ.json()).catch(()=>null);if(!H)continue;if(H.kind==="approved")v(bQ(EQ().planApprovalMode,wZ(H.features)));if(H.kind==="discarded")v($Q("The user discarded the plan in Beacon. Ask what they want to adjust before re-presenting."));if(H.kind==="feedback")v($Q(`The user left feedback on the plan in Beacon (inline comments and/or edits on the /map and /db boards). Revise the plan based on the feedback below, then re-present (call ExitPlanMode again):
|
|
350
357
|
|
|
351
358
|
`+H.feedback))}v($Q("\u23F3 Still awaiting your review in Beacon \u2014 the plan is open on /plan and nothing was lost. "+"Claude Code caps a single plan-review hook at ~10 minutes, so to keep waiting you MUST call ExitPlanMode again now with the SAME plan. Re-presenting resumes the same review (your in-progress annotations and any decision are preserved). Do NOT implement, and do "+"NOT ask in the terminal \u2014 just re-present."))})();
|
package/dist/bin/uninstall.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var EZ=Object.defineProperty;var DZ=(Q)=>Q;function
|
|
3
|
+
var EZ=Object.defineProperty;var DZ=(Q)=>Q;function bZ(Q,Z){this[Q]=DZ.bind(null,Z)}var jQ=(Q,Z)=>{for(var $ in Z)EZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:bZ.bind(Z,$)})};var f=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var m0=1500,p0=480000,c0=1800000,S=3600000,l0=3000;var cQ=()=>{};var xQ={};jQ(xQ,{removeRepoAssets:()=>NQ,installRefreshSkill:()=>OZ,installPlanSkill:()=>AZ,installInitSkill:()=>IZ,installExplainSkill:()=>yZ,installCodexRepoSkills:()=>_Z,ensureWorkflowDoc:()=>kZ,ensureMcp:()=>SZ,auditRepo:()=>hZ,REFRESH_SKILL:()=>PQ,PLAN_SKILL:()=>nQ,INIT_SKILL:()=>GQ,EXPLAIN_SKILL:()=>tQ});import{existsSync as T,mkdirSync as E,readFileSync as P,rmSync as h,writeFileSync as H}from"fs";import{join as X}from"path";function IZ(Q){let Z=X(Q,".claude","skills","beacon-init");E(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,GQ),$}function OZ(Q){let Z=X(Q,".claude","skills","beacon-refresh");E(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,PQ),$}function AZ(Q){let Z=X(Q,".claude","skills","beacon-plan");E(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,nQ),$}function yZ(Q){let Z=X(Q,".claude","skills","beacon-explain");E(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,tQ),$}function _Z(Q){let Z=[];for(let $ of LZ){let J=X(Q,".agents","skills",$.name);E(J,{recursive:!0});let Y=X(J,"SKILL.md");H(Y,$.body()),Z.push(Y)}return Z}function kZ(Q){let Z=X(Q,"AGENTS.md"),$="";try{$=P(Z,"utf8")}catch{}let J=new RegExp(`${m}[\\s\\S]*?${vQ}`);$=J.test($)?$.replace(J,lQ):`${$.trim()}
|
|
4
4
|
|
|
5
5
|
${lQ}
|
|
6
6
|
`.trimStart(),H(Z,$.endsWith(`
|
|
7
7
|
`)?$:`${$}
|
|
8
|
-
`);let Y=X(Q,"CLAUDE.md"),V="";try{V=
|
|
8
|
+
`);let Y=X(Q,"CLAUDE.md"),V="";try{V=P(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))H(Y,`${V?`${V.trim()}
|
|
9
9
|
|
|
10
10
|
`:""}@AGENTS.md
|
|
11
|
-
`)}function SZ(Q){let Z=X(Q,".mcp.json"),$={};try{$=JSON.parse(
|
|
11
|
+
`)}function SZ(Q){let Z=X(Q,".mcp.json"),$={};try{$=JSON.parse(P(Z,"utf8"))}catch{}$.mcpServers=$.mcpServers??{};let J=$.mcpServers.beacon;if(J){if(!J.timeout||J.timeout<S)return J.timeout=S,H(Z,JSON.stringify($,null,2)+`
|
|
12
12
|
`),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:S},H(Z,JSON.stringify($,null,2)+`
|
|
13
|
-
`),{path:Z,added:!0,updated:!1}}function hZ(Q){let Z=X(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(
|
|
14
|
-
`)}}catch{}let Y=!1,V=X(Q,"AGENTS.md");try{let z=
|
|
13
|
+
`),{path:Z,added:!0,updated:!1}}function hZ(Q){let Z=X(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(P(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=P(X(Q,"AGENTS.md"),"utf8").includes(m)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(P(X(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":T(X(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":T(X(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":T(X(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":T(X(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function NQ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=X(Q,".claude","skills",z);if(T(U))h(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=X(Q,".agents","skills",z);if(T(U))h(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=X(Q,".mcp.json");try{let z=JSON.parse(P(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)h(J,{force:!0});else H(J,JSON.stringify(z,null,2)+`
|
|
14
|
+
`)}}catch{}let Y=!1,V=X(Q,"AGENTS.md");try{let z=P(V,"utf8"),U=new RegExp(`\\n?${m}[\\s\\S]*?${vQ}\\n?`);if(U.test(z)){let BQ=z.replace(U,`
|
|
15
15
|
`).replace(/\n{3,}/g,`
|
|
16
16
|
|
|
17
17
|
`).trimStart();H(V,BQ.endsWith(`
|
|
18
18
|
`)?BQ:`${BQ}
|
|
19
|
-
`),Y=!0}}catch{}let q=!1,W=X(Q,"CLAUDE.md");try{let z=
|
|
19
|
+
`),Y=!0}}catch{}let q=!1,W=X(Q,"CLAUDE.md");try{let z=P(W,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())h(W,{force:!0});else H(W,U);q=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:q}}var GQ=`---
|
|
20
20
|
name: beacon-init
|
|
21
21
|
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.
|
|
22
22
|
---
|
|
@@ -63,7 +63,7 @@ beacon init-persist /tmp/beacon-init.json # or: beacon init-persist < /tmp/bea
|
|
|
63
63
|
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.
|
|
64
64
|
|
|
65
65
|
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.
|
|
66
|
-
`,
|
|
66
|
+
`,PQ=`---
|
|
67
67
|
name: beacon-refresh
|
|
68
68
|
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.
|
|
69
69
|
---
|
|
@@ -214,6 +214,13 @@ push depth into \`detail\`, not the node face. Supply \`steps\` for the guided w
|
|
|
214
214
|
is the overview (empty \`focusIds\`), then teach one node (or a few) per step in order, each with its
|
|
215
215
|
\`focusIds\`.
|
|
216
216
|
|
|
217
|
+
When the topic involves DATABASE tables, pass them in \`tables\` (they render as annotated schema cards
|
|
218
|
+
on the SAME board, not just raw schemas). For each table give a one-line \`note\` (why it exists), mark
|
|
219
|
+
the key columns \`isPk\`, point FKs at another table with \`fkTo: "<that table's id>"\`, give EVERY column a
|
|
220
|
+
short plain-English \`note\`, and add a \`sample\` row or two (the worked example, made concrete). Connect a
|
|
221
|
+
concept to its table with an \`edge\` (e.g. \`persists to\` / \`reads from\`) whose \`toId\` is the table's id \u2014
|
|
222
|
+
so the learner sees the table IN CONTEXT, wired to the code that uses it.
|
|
223
|
+
|
|
217
224
|
## 4. Answer in the loop \u2014 don't stop after one round
|
|
218
225
|
|
|
219
226
|
\`beacon_explain\` returns the user's questions, each tagged \`[q:ID]\`. Answer EACH by calling
|
|
@@ -221,7 +228,7 @@ is the overview (empty \`focusIds\`), then teach one node (or a few) per step in
|
|
|
221
228
|
Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
|
|
222
229
|
the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
|
|
223
230
|
the lesson.
|
|
224
|
-
`,
|
|
231
|
+
`,LZ,m="<!-- beacon:workflow:start -->",vQ="<!-- beacon:workflow:end -->",lQ;var p=f(()=>{cQ();LZ=[{name:"beacon-init",body:()=>GQ},{name:"beacon-refresh",body:()=>PQ}];lQ=`${m}
|
|
225
232
|
## Beacon \u2014 feature workflow
|
|
226
233
|
|
|
227
234
|
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:
|
|
@@ -293,18 +300,18 @@ Register them all in that single batched call. If a plan added five features, th
|
|
|
293
300
|
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.
|
|
294
301
|
|
|
295
302
|
Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
|
|
296
|
-
${vQ}`});import{existsSync as c,mkdirSync as KQ,readdirSync as mZ,readFileSync as
|
|
297
|
-
`)}function t(Q,Z){let $=uQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),oQ(Q,$),!0}function d(Q,Z){return(uQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function
|
|
303
|
+
${vQ}`});import{existsSync as c,mkdirSync as KQ,readdirSync as mZ,readFileSync as w,rmSync as pZ,writeFileSync as l}from"fs";import{dirname as dQ,join as N}from"path";function sQ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function aQ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;let Z=N(Q,".claude","plugins");if(!c(Z))return null;let $=[Z];for(let J=0;J<3&&$.length;J++){let Y=[];for(let V of $){let q=N(V,".claude-plugin","plugin.json");try{if(c(q)&&JSON.parse(w(q,"utf8")).name==="beacon")return V}catch{}try{for(let W of mZ(V,{withFileTypes:!0}))if(W.isDirectory())Y.push(N(V,W.name))}catch{}}$=Y}return null}function rQ(Q){return aQ(Q)!==null}function cZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function lZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;try{let Z=JSON.parse(w(N(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 uQ(Q){try{return JSON.parse(w(Q,"utf8"))}catch{return{}}}function oQ(Q,Z){KQ(dQ(Q),{recursive:!0}),l(Q,JSON.stringify(Z,null,2)+`
|
|
304
|
+
`)}function t(Q,Z){let $=uQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),oQ(Q,$),!0}function d(Q,Z){return(uQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function s(Q,Z){let $=uQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((q)=>{let W=q.hooks?.length??0,z=(q.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==W)Y=!0;return{...q,hooks:z}}).filter((q)=>(q.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 oQ(Q,$),!0}function a(Q,Z,$,J){let Y=`${Z}
|
|
298
305
|
${J.trim()}
|
|
299
|
-
${$}`,V="";try{V=
|
|
306
|
+
${$}`,V="";try{V=w(Q,"utf8")}catch{}let q=new RegExp(`${Z}[\\s\\S]*?${$}`);V=q.test(V)?V.replace(q,Y):V.trim()?`${V.trim()}
|
|
300
307
|
|
|
301
308
|
${Y}
|
|
302
309
|
`:`${Y}
|
|
303
310
|
`,KQ(dQ(Q),{recursive:!0}),l(Q,V.endsWith(`
|
|
304
311
|
`)?V:`${V}
|
|
305
|
-
`)}function D(Q,Z){try{return
|
|
312
|
+
`)}function D(Q,Z){try{return w(Q,"utf8").includes(Z)}catch{return!1}}function r(Q,Z,$){let J="";try{J=w(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,`
|
|
306
313
|
|
|
307
|
-
`).trimStart();return l(Q,V),!0}function o(Q,Z,$){let J=
|
|
314
|
+
`).trimStart();return l(Q,V),!0}function o(Q,Z,$){let J=N(Q,Z);KQ(J,{recursive:!0});let Y=N(J,"SKILL.md");return l(Y,$),Y}function b(Q,Z){return c(N(Q,Z,"SKILL.md"))}function i(Q,Z){let $=N(Q,Z);if(!c($))return!1;return pZ($,{recursive:!0,force:!0}),!0}var B,n=`## Beacon (visual planning panel)
|
|
308
315
|
|
|
309
316
|
This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
|
|
310
317
|
agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
|
|
@@ -328,20 +335,20 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
|
|
|
328
335
|
Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
|
|
329
336
|
on the /map and /db boards (added features, attached subtasks, edited columns, new
|
|
330
337
|
endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
|
|
331
|
-
verbatim. Do NOT implement until the tool returns approval.`;var CQ=
|
|
338
|
+
verbatim. Do NOT implement until the tool returns approval.`;var CQ=f(()=>{B=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as nZ,renameSync as tZ,rmSync as dZ,writeFileSync as sZ}from"fs";import{dirname as aZ}from"path";function e(Q,Z){nZ(aZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{sZ($,Z),tZ($,Q)}catch(J){throw dZ($,{force:!0}),J}}function Q1(Q,Z,$=!1){e(Q,JSON.stringify(Z,null,$?2:void 0))}var iQ=()=>{};var zZ={};jQ(zZ,{setupCodexAssets:()=>eZ,removeCodexMcp:()=>VZ,removeCodexArtifacts:()=>FQ,hasCodexMcp:()=>wQ,ensureCodexMcp:()=>YZ,codexMcpProblem:()=>iZ,codexDetected:()=>ZZ,auditCodex:()=>RQ,CODEX_HOOKS:()=>F});import{readFileSync as JQ}from"fs";import{homedir as rZ}from"os";import{join as A}from"path";function eQ(){return process.env.HOME||process.env.USERPROFILE||rZ()}function ZZ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(MQ===void 0)MQ=Bun.which("codex")!==null;return MQ}function O(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function wQ(){try{return Boolean(O(JQ(R(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function iZ(){let Q="";try{Q=JQ(R(),"utf8")}catch{return null}let Z=O(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${I}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${I}`;return null}function YZ(){let Q="",Z=!1;try{Q=JQ(R(),"utf8"),Z=!0}catch{}if(Z){let V=O(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${I}`};if(V.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 ${I}`}}let $=!Q?"":Q.endsWith(`
|
|
332
339
|
`)?`
|
|
333
340
|
`:`
|
|
334
341
|
|
|
335
|
-
`,J=Q+$+
|
|
342
|
+
`,J=Q+$+oZ;if(O(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${I}`};return e(R(),J),{added:!0}}function VZ(){let Q="";try{Q=JQ(R(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
|
|
336
343
|
`),$=Z.indexOf($Z);if($===-1)return{removed:!1,skipped:wQ()};let J=Z.indexOf(JZ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
|
|
337
344
|
`).replace(/\n{3,}/g,`
|
|
338
345
|
|
|
339
|
-
`).replace(/^\n+/,"");if(O(Y)===null)return{removed:!1,skipped:!0};return e(
|
|
346
|
+
`).replace(/^\n+/,"");if(O(Y)===null)return{removed:!1,skipped:!0};return e(R(),Y),{removed:!0}}async function eZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (p(),xQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let U of B){if(!b(ZQ(),U))V.push(U);o(ZQ(),U,Y[U])}let q=0;for(let U of F)if(t(TQ(),{event:U.event,matcher:U.matcher,command:U.command}))q++;let W=D(QQ(),$Q);a(QQ(),$Q,QZ,n);let z=YZ();return{skillsAdded:V,hooksAdded:q,agentsMdBlockTouched:!W,mcp:z}}function RQ(){let Q={};for(let $ of B)Q[$]=b(ZQ(),$);let Z={};for(let $ of F)Z[$.event]=d(TQ(),{event:$.event,command:$.command});return{detected:ZZ(),skills:Q,hooks:Z,agentsMdBlock:D(QQ(),$Q),mcp:wQ()}}function FQ(){let Q=[];for(let Y of B)if(i(ZQ(),Y))Q.push(Y);let Z=0;for(let Y of F)if(s(TQ(),{event:Y.event,command:Y.command}))Z++;let $=r(QQ(),$Q,QZ),J=VZ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var fQ=()=>A(eQ(),".codex"),TQ=()=>A(fQ(),"hooks.json"),R=()=>A(fQ(),"config.toml"),QQ=()=>A(fQ(),"AGENTS.md"),ZQ=()=>A(eQ(),".agents","skills"),$Q="<!-- beacon:global:start -->",QZ="<!-- beacon:global:end -->",F,MQ,$Z="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",JZ="# beacon:end",oZ,I="add it manually: codex mcp add beacon -- beacon mcp";var gQ=f(()=>{CQ();iQ();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."}];oZ=`${$Z}
|
|
340
347
|
[mcp_servers.beacon]
|
|
341
348
|
command = "beacon"
|
|
342
349
|
args = ["mcp"]
|
|
343
350
|
${JZ}
|
|
344
|
-
`});var BZ={};jQ(BZ,{provisionDb:()=>
|
|
345
|
-
\x1B[1m${Q}\x1B[0m`,gZ=(Q)=>`\x1B[33m!\x1B[0m ${Q}`,C=v(),
|
|
346
|
-
`),process.exit(0);console.log(
|
|
351
|
+
`});var BZ={};jQ(BZ,{provisionDb:()=>f0});import{createClient as B0}from"@libsql/client";import{drizzle as j0}from"drizzle-orm/libsql";import{migrate as G0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as P0}from"drizzle-orm/migrator";import{dirname as AQ,join as v0}from"path";import{fileURLToPath as N0}from"url";async function zQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function C0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function HZ(Q){if(!await zQ(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 M0(Q){for(let[Z,$]of Object.entries(u0)){if(!await zQ(Q,Z))continue;let J=await C0(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 f0(Q,Z=K0){let $=B0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await zQ($,"__drizzle_migrations"),Y=await zQ($,"Node"),V=!1;if(Y&&!J){let W=P0({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 q=await HZ($);if(await G0(j0($),{migrationsFolder:Z}),await HZ($)>q)V=!0;return await M0($),{migrated:V}}finally{$.close()}}var x0,K0,u0;var jZ=f(async()=>{x0=AQ(AQ(AQ(N0(import.meta.url)))),K0=process.env.BEACON_MIGRATIONS_DIR||v0(x0,"drizzle"),u0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});CQ();import{existsSync as Q0}from"fs";import{homedir as Z0}from"os";import{join as YQ}from"path";function $0(){return process.env.HOME||process.env.USERPROFILE||Z0()}var VQ=()=>YQ($0(),".claude"),EQ=()=>YQ(VQ(),"skills"),DQ=()=>YQ(VQ(),"settings.json"),bQ=()=>YQ(VQ(),"CLAUDE.md"),IQ="<!-- beacon:global:start -->",qZ="<!-- beacon:global:end -->";var J0=n,y=[{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 Y0(Q,Z){return o(EQ(),Q,Z)}function XZ(Q){return b(EQ(),Q)}function V0(Q){return i(EQ(),Q)}function z0(Q){return t(DQ(),Q)}function q0(Q){return d(DQ(),Q)}function X0(Q){return s(DQ(),Q)}function U0(Q){a(bQ(),IQ,qZ,Q)}function UZ(){return D(bQ(),IQ)}function W0(){return r(bQ(),IQ,qZ)}function WZ(){let Q={};for(let $ of B)Q[$]=XZ($);let Z={};for(let $ of y)Z[$.event]=q0({event:$.event,command:$.command});return{homeExists:Q0(VQ()),skills:Q,hooks:Z,claudeMdBlock:UZ()}}async function H0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (p(),xQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let z of B){if(!XZ(z))V.push(z);Y0(z,Y[z])}let q=0;for(let z of y)if(z0({event:z.event,matcher:z.matcher,command:z.command}))q++;let W=UZ();return U0(J0),{skillsAdded:V,hooksAdded:q,claudeMdBlockTouched:!W}}async function H1(){if(sQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(rQ()){try{OQ()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await H0()}}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(() => (gQ(),zZ));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 OQ(){let Q=[];for(let J of B)if(V0(J))Q.push(J);let Z=0;for(let J of y)if(X0(J))Z++;let $=W0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as T0}from"async_hooks";import{spawnSync as w0}from"child_process";import{createHash as R0}from"crypto";import{existsSync as PZ,mkdirSync as L,readFileSync as LQ,writeFileSync as _Q}from"fs";import{homedir as vZ}from"os";import{basename as F0,join as x,parse as g0,resolve as GZ}from"path";function v(){return process.env.BEACON_HOME||x(vZ(),".beacon")}function kQ(){return x(v(),"workspaces.json")}function qQ(Q){return R0("sha256").update(Q).digest("hex").slice(0,12)}function w1(Q=process.cwd()){let Z=w0("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 NZ(Q){let Z=GZ(Q);return Z!==GZ(vZ())&&Z!==g0(Z).root}function xZ(){return x(v(),"deleted.json")}function SQ(){try{let Q=JSON.parse(LQ(xZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function KZ(Q){L(v(),{recursive:!0}),_Q(xZ(),JSON.stringify(Q,null,2))}function uZ(Q){return SQ().includes(Q)}function R1(Q){let Z=SQ();if(!Z.includes(Q))KZ([...Z,Q])}function E0(Q){let Z=SQ();if(Z.includes(Q))KZ(Z.filter(($)=>$!==Q))}function XQ(Q){return x(v(),Q)}function D0(Q){return`file:${x(XQ(Q),"db.sqlite")}`}function _(){try{let Q=JSON.parse(LQ(kQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function hQ(Q){L(v(),{recursive:!0}),_Q(kQ(),JSON.stringify(Q,null,2))}function UQ(){return _().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function u(Q){return _().find((Z)=>Z.id===Q)??null}function CZ(Q,Z,$=new Date().toISOString()){if(!NZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=qQ(Q);if(uZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=_(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||F0(Q),lastOpenedAt:$},W=[q,...Y.filter((z)=>z.id!==J)];return L(XQ(J),{recursive:!0}),hQ(W),q}function F1(Q,Z){return E0(qQ(Q)),CZ(Q,Z)}function g1(Q,Z=new Date().toISOString()){let $=_(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,hQ($)}function E1(Q){if(hQ(_().filter((Z)=>Z.id!==Q)),mQ()===Q)b0(UQ()[0]?.id??null)}function MZ(){return x(v(),"active")}function mQ(){try{return LQ(MZ(),"utf8").trim()||null}catch{return null}}function b0(Q){L(v(),{recursive:!0}),_Q(MZ(),Q??"")}function D1(){let Q=mQ();return Q?u(Q):null}function b1(){let Q=A0()??mQ();return Q?u(Q):null}function I1(Q){return u(Q)?.path??null}function O1(){return PZ(kQ())}var fZ="beacon_ws";function TZ(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 A1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&u(Z))return Z;let $=TZ(Q,fZ);if($&&u($))return $;return I0()}function I0(){let Q=UQ();return Q.length===1?Q[0].id:null}var O0="x-beacon-workspace-path";async function y1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&u(Z))return Z;let $=Q.headers.get(O0);if($&&NZ($)&&!uZ(qQ($))&&(!Z||qQ($)===Z)){let Y=CZ($);return await y0(Y.id),Y.id}let J=TZ(Q,fZ);if(J&&u(J))return J;return null}var wZ=new T0;function L1(Q,Z){return Q?wZ.run(Q,Z):Z()}function A0(){return wZ.getStore()??null}var yQ=new Set;function _1(Q){yQ.delete(x(XQ(Q),"db.sqlite"))}async function y0(Q){let Z=XQ(Q),$=x(Z,"db.sqlite"),J=PZ($);if(J&&yQ.has($))return{ok:!0,created:!1,migrated:!1};try{L(Z,{recursive:!0});let{provisionDb:Y}=await jZ().then(() => BZ),V=await Y(D0(Q));return yQ.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)}}}p();gQ();import{existsSync as WQ,readFileSync as L0,rmSync as _0}from"fs";import{join as k0}from"path";var RZ=process.argv.slice(3),FZ=RZ.includes("--yes")||RZ.includes("-y"),G=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,j=(Q)=>`\x1B[2m${Q}\x1B[0m`,M=(Q)=>`
|
|
352
|
+
\x1B[1m${Q}\x1B[0m`,gZ=(Q)=>`\x1B[33m!\x1B[0m ${Q}`,C=v(),k=UQ(),pQ=WZ();console.log(M(FZ?"Beacon \xB7 uninstall":"Beacon \xB7 uninstall (dry run)"));console.log(M("Global"));console.log(` ${WQ(C)?`wipe ${C} (${k.length} workspaces)`:`${j(`${C} \u2014 already gone`)}`}`);for(let Q of B)console.log(` ${pQ.skills[Q]?`remove ~/.claude/skills/${Q}/`:j(`skill ${Q} \u2014 already gone`)}`);for(let Q of y)console.log(` ${pQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command}`:j(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${pQ.claudeMdBlock?"strip Beacon block from ~/.claude/CLAUDE.md":j("global CLAUDE.md block \u2014 already gone")}`);var HQ=RQ();console.log(M("Codex"));for(let Q of B)console.log(` ${HQ.skills[Q]?`remove ~/.agents/skills/${Q}/`:j(`skill ${Q} \u2014 already gone`)}`);for(let Q of F)console.log(` ${HQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command} from ~/.codex/hooks.json`:j(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${HQ.agentsMdBlock?"strip Beacon block from ~/.codex/AGENTS.md":j("global ~/.codex/AGENTS.md block \u2014 already gone")}`);console.log(` ${HQ.mcp?"strip [mcp_servers.beacon] from ~/.codex/config.toml (if Beacon wrote it)":j("config.toml beacon entry \u2014 already gone")}`);if(k.length){console.log(M(`Per-repo (${k.length})`));for(let Q of k){if(!WQ(Q.path)){console.log(` ${j(`${Q.path} \u2014 repo no longer on disk, skipping`)}`);continue}console.log(` ${Q.path}`),console.log(` ${j("strip beacon entry from .mcp.json, workflow block from AGENTS.md, skills, CLAUDE.md @-import")}`)}}if(!FZ)console.log(M("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.
|
|
353
|
+
`),process.exit(0);console.log(M("Applying\u2026"));var g=OQ();if(g.skillsRemoved.length)console.log(` ${G(`removed skills: ${g.skillsRemoved.join(", ")}`)}`);if(g.hooksRemoved)console.log(` ${G(`removed ${g.hooksRemoved} hook${g.hooksRemoved===1?"":"s"} from ~/.claude/settings.json`)}`);if(g.claudeMdBlockRemoved)console.log(` ${G("stripped Beacon block from ~/.claude/CLAUDE.md")}`);var K=FQ();if(K.skillsRemoved.length)console.log(` ${G(`removed ~/.agents/skills: ${K.skillsRemoved.join(", ")}`)}`);if(K.hooksRemoved)console.log(` ${G(`removed ${K.hooksRemoved} hook${K.hooksRemoved===1?"":"s"} from ~/.codex/hooks.json`)}`);if(K.agentsMdBlockRemoved)console.log(` ${G("stripped Beacon block from ~/.codex/AGENTS.md")}`);if(K.mcpRemoved)console.log(` ${G("stripped [mcp_servers.beacon] from ~/.codex/config.toml")}`);if(K.mcpSkipped)console.log(` ${gZ("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 k){if(!WQ(Q.path))continue;let Z=NQ(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(` ${G(`${Q.path} \u2192 ${$.join(", ")}`)}`)}var S0=k0(C,"server.json");try{let{pid:Q}=JSON.parse(L0(S0,"utf8"));if(Q)try{process.kill(Q),console.log(` ${G(`stopped daemon (pid ${Q})`)}`)}catch{}}catch{}if(WQ(C))_0(C,{recursive:!0,force:!0}),console.log(` ${G(`removed ${C}`)}`);console.log(M("Done."));console.log(` ${gZ("The `beacon` binary on your PATH is still there \u2014 run the matching uninstall step from your installer to remove it.")}
|
|
347
354
|
`);
|
package/dist/lib/assets.js
CHANGED
|
@@ -213,6 +213,13 @@ push depth into \`detail\`, not the node face. Supply \`steps\` for the guided w
|
|
|
213
213
|
is the overview (empty \`focusIds\`), then teach one node (or a few) per step in order, each with its
|
|
214
214
|
\`focusIds\`.
|
|
215
215
|
|
|
216
|
+
When the topic involves DATABASE tables, pass them in \`tables\` (they render as annotated schema cards
|
|
217
|
+
on the SAME board, not just raw schemas). For each table give a one-line \`note\` (why it exists), mark
|
|
218
|
+
the key columns \`isPk\`, point FKs at another table with \`fkTo: "<that table's id>"\`, give EVERY column a
|
|
219
|
+
short plain-English \`note\`, and add a \`sample\` row or two (the worked example, made concrete). Connect a
|
|
220
|
+
concept to its table with an \`edge\` (e.g. \`persists to\` / \`reads from\`) whose \`toId\` is the table's id \u2014
|
|
221
|
+
so the learner sees the table IN CONTEXT, wired to the code that uses it.
|
|
222
|
+
|
|
216
223
|
## 4. Answer in the loop \u2014 don't stop after one round
|
|
217
224
|
|
|
218
225
|
\`beacon_explain\` returns the user's questions, each tagged \`[q:ID]\`. Answer EACH by calling
|