bostrat-node 1.9.13 → 1.10.1

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.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- var d=process.env.BOSTRAT_AGENT_URL||`http://127.0.0.1:${process.env.BOSTRAT_AGENT_PORT||3362}`;async function l(e,n,r){let o=await fetch(`${d}${n}`,{method:e,headers:r?{"content-type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0}),t=await o.json().catch(()=>({}));if(!o.ok)throw new Error(t.error||`HTTP ${o.status}`);return t}function c(e){console.error(`[bostrat-blueprint] ${e}`),process.exit(1)}function u(e){if(e){console.log(` parsed: ${e.sections.recognized} recognized section(s), ${e.items.total} item(s) (${e.items.bindable} bindable)`);for(let n of e.issues??[])console.log(` \u26A0 ${n.message}`)}}var i=process.argv.slice(2),s=i.shift();if(s==="add"||s==="update"){let e=null,n=null,r=null,o=null;for(let t=0;t<i.length;t++)i[t]==="--circuit"?e=i[++t]:i[t]==="--new-circuit"?n=i[++t]:i[t]==="--name"?r=i[++t]:o=i[t];o||c(`usage: bostrat-blueprint ${s} [--circuit <name-or-id>] [--new-circuit "<name>"] [--name "<title>"] <file.md>`);try{let t=await(await import("node:fs/promises")).readFile(o,"utf8"),a=await l("POST","/api/blueprints/publish",{cwd:process.cwd(),circuit:e,newCircuit:n,name:r,markdown:t});console.log(`[bostrat-blueprint] published \u201C${a.blueprint.name}\u201D v${a.blueprint.version} on circuit \u201C${a.circuit.name}\u201D`),u(a.report),a.blueprint.version===1&&console.log(" The circuit page now carries this blueprint; PR titles/branches mentioning BP ids auto-tick on merge.")}catch(t){c(t.message)}}else if(s==="show"||s==="report")try{let e=await l("GET",`/api/blueprints/show?cwd=${encodeURIComponent(process.cwd())}${i[0]?`&circuit=${encodeURIComponent(i[0])}`:""}`);if(console.log(`[bostrat-blueprint] \u201C${e.blueprint.name}\u201D v${e.blueprint.version} (circuit ${e.blueprint.circuitId})`),u(e.report),s==="show")for(let n of e.items)console.log(` ${n.bindable?n.itemId.padEnd(8):"(no id)".padEnd(8)} ${n.sectionKind.padEnd(14)} ${n.text}`)}catch(e){c(e.message)}else if(s==="tag"){i.length||c("usage: bostrat-blueprint tag <BP-id> [<BP-id>\u2026]");try{let e=await l("POST","/api/blueprints/tag",{cwd:process.cwd(),itemIds:i});console.log(`[bostrat-blueprint] tagged this Track onto ${e.itemIds.join(", ")}`),console.log(" (association + cost attribution \u2014 completion still comes from merged PRs or a manual tick)")}catch(e){c(e.message)}}else c("usage: bostrat-blueprint <add|update|show|report|tag> \u2026 (add [--circuit <ref>] <file.md>)");
2
+ var d=process.env.BOSTRAT_AGENT_URL||`http://127.0.0.1:${process.env.BOSTRAT_AGENT_PORT||3362}`;async function l(e,n,c){let o=await fetch(`${d}${n}`,{method:e,headers:c?{"content-type":"application/json"}:void 0,body:c?JSON.stringify(c):void 0}),t=await o.json().catch(()=>({}));if(!o.ok)throw new Error(t.error||`HTTP ${o.status}`);return t}function r(e){console.error(`[bostrat-blueprint] ${e}`),process.exit(1)}function u(e){if(e){console.log(` parsed: ${e.sections.recognized} recognized section(s), ${e.items.total} item(s) (${e.items.bindable} bindable)`);for(let n of e.issues??[])console.log(` \u26A0 ${n.message}`)}}var i=process.argv.slice(2),s=i.shift();if(s==="add"||s==="update"){let e=null,n=null,c=null,o=null;for(let t=0;t<i.length;t++)i[t]==="--circuit"?e=i[++t]:i[t]==="--new-circuit"?n=i[++t]:i[t]==="--name"?c=i[++t]:o=i[t];o||r(`usage: bostrat-blueprint ${s} [--circuit <name-or-id>] [--new-circuit "<name>"] [--name "<title>"] <file.md>`);try{let t=await(await import("node:fs/promises")).readFile(o,"utf8"),a=await l("POST","/api/blueprints/publish",{cwd:process.cwd(),circuit:e,newCircuit:n,name:c,markdown:t});console.log(`[bostrat-blueprint] published \u201C${a.blueprint.name}\u201D v${a.blueprint.version} on circuit \u201C${a.circuit.name}\u201D`),u(a.report),a.blueprint.version===1&&console.log(" The circuit page now carries this blueprint; PRs/commits mentioning BP ids show as evidence \u2014 tick [x] + a *(done \u2026)* note in the doc when an item lands.")}catch(t){r(t.message)}}else if(s==="show"||s==="report")try{let e=await l("GET",`/api/blueprints/show?cwd=${encodeURIComponent(process.cwd())}${i[0]?`&circuit=${encodeURIComponent(i[0])}`:""}`);if(console.log(`[bostrat-blueprint] \u201C${e.blueprint.name}\u201D v${e.blueprint.version} (circuit ${e.blueprint.circuitId})`),u(e.report),s==="show")for(let n of e.items)console.log(` ${n.bindable?n.itemId.padEnd(8):"(no id)".padEnd(8)} ${n.sectionKind.padEnd(14)} ${n.text}`)}catch(e){r(e.message)}else if(s==="tag"){i.length||r("usage: bostrat-blueprint tag <BP-id> [<BP-id>\u2026]");try{let e=await l("POST","/api/blueprints/tag",{cwd:process.cwd(),itemIds:i});console.log(`[bostrat-blueprint] tagged this Track onto ${e.itemIds.join(", ")}`),console.log(" (association + cost attribution \u2014 completion still comes from merged PRs or a manual tick)")}catch(e){r(e.message)}}else r("usage: bostrat-blueprint <add|update|show|report|tag> \u2026 (add [--circuit <ref>] <file.md>)");
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- var f=process.env.BOSTRAT_AGENT_URL||`http://127.0.0.1:${process.env.BOSTRAT_AGENT_PORT||3362}`,n="[bostrat-followup]";function l(e){let o=/fetch failed|ECONNREFUSED/.test(String(e))?`the bostrat agent isn't reachable at ${f} \u2014 run this from inside a Track box`:e;console.error(`${n} ${o}`),process.exit(1)}async function c(e,o,s){let r=await fetch(`${f}${o}`,{method:e,headers:s?{"content-type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0}),t=await r.json().catch(()=>({}));if(!r.ok)throw new Error(t.error||`HTTP ${r.status}`);return t}async function p(e){let s=!e||e==="-"?await(async()=>{let r=[];for await(let t of process.stdin)r.push(t);return Buffer.concat(r).toString("utf8")})():await(await import("node:fs/promises")).readFile(e,"utf8");try{return JSON.parse(s)}catch{l("plan must be JSON (a file path, or piped on stdin) \u2014 see the `bostrat-followup` header for the shape")}}var h=process.argv.slice(2),i=h.shift(),d=h.filter(e=>!e.startsWith("--"));if(i==="offer")try{let e=await p(d[0]),{result:o}=await c("POST","/api/followups/offer",{cwd:process.cwd(),plan:e});o.kind==="covered"?console.log(`${n} already covered by "${o.covered.label}" (standing) \u2014 not armed.`):o.kind==="now"?(console.log(`${n} offered "${o.label}" \u2014 the card is in the Track chat now.`),console.log(" HOLD HERE: end your turn and wait \u2014 the operator answers the card in chat.")):o.kind==="ship"?o.skipped?console.log(`${n} ${o.reason}; no card rendered.`):console.log(`${n} ship offer posted (${o.offered.join(" + ")} on ${o.branch}) \u2014 one-tap controls are in the Track chat.
3
- HOLD HERE: end your turn; the go-ahead comes back as a chat message.`):(console.log(`${n} armed: ${o.label} \u2014 offered ${a(o.trigger)}${o.replaces?" (replaces the earlier arm for this moment)":""}.`),console.log(" Not blocking \u2014 carry on; the operator answers the card when the moment comes."))}catch(e){l(e.message)}else if(i==="propose")try{let e=await p(d[0]),{proposal:o}=await c("POST","/api/followups/propose",{cwd:process.cwd(),plan:e});console.log(`${n} proposed "${o.label}" \u2014 offered ${a(o.trigger)} on ${o.repo||"any repo"} \u2014 review card posted to the Track chat.`),console.log(" Nothing is saved until the operator confirms; the card shows your prompt verbatim."),console.log(" HOLD HERE: end your turn and wait \u2014 do not start or resume other work until the operator answers the card in chat.")}catch(e){l(e.message)}else if(i==="ls")try{let e=await c("GET",`/api/followups?cwd=${encodeURIComponent(process.cwd())}`);e.source==="unconfigured"?console.log("(this node isn't linked to a plane \u2014 standing follow-ups live in the plane)"):e.source==="unreachable"&&console.log(`(plane unreachable${e.error?` \u2014 ${e.error}`:""}; showing nothing standing)`);let o=(e.followups||[]).filter(t=>t.status!=="deleted"),s=(e.followups||[]).filter(t=>t.status==="deleted");console.log(o.length?"standing follow-ups:":"no standing follow-ups");for(let t of o)console.log(` ${t.status==="paused"?"\u25CB":"\u25CF"} ${t.label} [${a(t.trigger)} \xB7 ${t.repo||"any repo"} \xB7 ${t.origin}${t.status==="paused"?" \xB7 paused":""}] (followup:${t.id})`);if(s.length){console.log("deleted \u2014 do not re-propose:");for(let t of s)console.log(` - ${t.label} [${a(t.trigger)} \xB7 ${t.repo||"any repo"}]`)}let r=e.arms||[];if(r.length){console.log("armed on this Track:");for(let t of r)console.log(` + ${t.label} [${a(t.trigger)}] (arm:${t.armId})`)}}catch(e){l(e.message)}else l("usage: bostrat-followup <offer|propose|ls> [plan.json | -] (offer = one-shot on this Track; propose = standing, posts a review card; ls = what exists)");function a(e){return{now:"now","pr.merged":"after merge","ship.done":"after ship","pr.opened":"after the PR opens","checks.green":"after CI goes green","track.opened":"when a Track opens"}[e]||e}
2
+ var h=process.env.BOSTRAT_AGENT_URL||`http://127.0.0.1:${process.env.BOSTRAT_AGENT_PORT||3362}`,n="[bostrat-followup]";function c(o){let t=/fetch failed|ECONNREFUSED/.test(String(o))?`the bostrat agent isn't reachable at ${h} \u2014 run this from inside a Track box`:o;console.error(`${n} ${t}`),process.exit(1)}async function i(o,t,r){let s=await fetch(`${h}${t}`,{method:o,headers:r?{"content-type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0}),e=await s.json().catch(()=>({}));if(!s.ok)throw new Error(e.error||`HTTP ${s.status}`);return e}async function f(o){let r=!o||o==="-"?await(async()=>{let s=[];for await(let e of process.stdin)s.push(e);return Buffer.concat(s).toString("utf8")})():await(await import("node:fs/promises")).readFile(o,"utf8");try{return JSON.parse(r)}catch{c("plan must be JSON (a file path, or piped on stdin) \u2014 see the `bostrat-followup` header for the shape")}}var g=process.argv.slice(2),d=g.shift(),p=g.filter(o=>!o.startsWith("--"));if(d==="offer")try{let o=await f(p[0]),{result:t}=await i("POST","/api/followups/offer",{cwd:process.cwd(),plan:o}),r=Array.isArray(t.items)?t.items:[],s=(e,a)=>` ${a+1}. ${e.label}${e.standing==="never"?" (one-off)":""}${e.covered?` \u2014 already covered by "${e.covered.label}" (standing), not armed`:e.replaces?" \u2014 replaces the earlier item with this label":""}`;if(t.kind==="covered"){if(console.log(`${n} already covered by "${t.covered.label}" (standing) \u2014 not armed.`),r.length>1)for(let[e,a]of r.entries())console.log(s(a,e))}else if(t.kind==="now"){if(r.length>1){console.log(`${n} offered ${r.length} items \u2014 the card is in the Track chat now:`);for(let[e,a]of r.entries())console.log(s(a,e))}else console.log(`${n} offered "${t.label}" \u2014 the card is in the Track chat now.`);console.log(" HOLD HERE: end your turn and wait \u2014 the operator answers the card in chat.")}else if(t.kind==="ship")t.skipped?console.log(`${n} ${t.reason}; no card rendered.`):console.log(`${n} ship offer posted (${t.offered.join(" + ")} on ${t.branch}) \u2014 one-tap controls are in the Track chat.
3
+ HOLD HERE: end your turn; the go-ahead comes back as a chat message.`);else{if(r.length>1){console.log(`${n} armed ${r.filter(e=>e.armId).length} of ${r.length} items \u2014 offered ${l(t.trigger)}, each its own row:`);for(let[e,a]of r.entries())console.log(s(a,e))}else console.log(`${n} armed: ${t.label} \u2014 offered ${l(t.trigger)}${t.replaces?" (replaces the earlier item with this label)":""}.`);console.log(" Not blocking \u2014 carry on; the operator answers the card when the moment comes.")}}catch(o){c(o.message)}else if(d==="propose")try{let o=await f(p[0]),{proposal:t}=await i("POST","/api/followups/propose",{cwd:process.cwd(),plan:o});console.log(`${n} proposed "${t.label}" \u2014 offered ${l(t.trigger)} on ${t.repo||"any repo"} \u2014 review card posted to the Track chat.`),console.log(" Nothing is saved until the operator confirms; the card shows your prompt verbatim."),console.log(" HOLD HERE: end your turn and wait \u2014 do not start or resume other work until the operator answers the card in chat.")}catch(o){c(o.message)}else if(d==="ls")try{let o=await i("GET",`/api/followups?cwd=${encodeURIComponent(process.cwd())}`);o.source==="unconfigured"?console.log("(this node isn't linked to a plane \u2014 standing follow-ups live in the plane)"):o.source==="unreachable"&&console.log(`(plane unreachable${o.error?` \u2014 ${o.error}`:""}; showing nothing standing)`);let t=(o.followups||[]).filter(e=>e.status!=="deleted"),r=(o.followups||[]).filter(e=>e.status==="deleted");console.log(t.length?"standing follow-ups:":"no standing follow-ups");for(let e of t)console.log(` ${e.status==="paused"?"\u25CB":"\u25CF"} ${e.label} [${l(e.trigger)} \xB7 ${e.repo||"any repo"} \xB7 ${e.origin}${e.status==="paused"?" \xB7 paused":""}] (followup:${e.id})`);if(r.length){console.log("deleted \u2014 do not re-propose:");for(let e of r)console.log(` - ${e.label} [${l(e.trigger)} \xB7 ${e.repo||"any repo"}]`)}let s=o.arms||[];if(s.length){console.log("armed on this Track:");for(let e of s)console.log(` + ${e.label} [${l(e.trigger)}] (arm:${e.armId})`)}}catch(o){c(o.message)}else c("usage: bostrat-followup <offer|propose|ls> [plan.json | -] (offer = one-shot on this Track; propose = standing, posts a review card; ls = what exists)");function l(o){return{now:"now","pr.merged":"after merge","ship.done":"after ship","pr.opened":"after the PR opens","checks.green":"after CI goes green","track.opened":"when a Track opens"}[o]||o}