bostrat-node 1.14.5 → 1.14.6

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,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>)");
2
+ var f=process.env.BOSTRAT_AGENT_URL||`http://127.0.0.1:${process.env.BOSTRAT_AGENT_PORT||3362}`;async function d(e,s,r){let t=await fetch(`${f}${s}`,{method:e,headers:r?{"content-type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0}),o=await t.json().catch(()=>({}));if(!t.ok)throw Object.assign(new Error(o.error||`HTTP ${t.status}`),{status:t.status,data:o});return o}function c(e){console.error(`[bostrat-blueprint] ${e}`),process.exit(1)}function b(e,s){if(console.error(`[bostrat-blueprint] refused: ${e.error}`),e.code==="stale-base"){if(console.error(` plane holds v${e.current}; this copy was built on v${e.yourBase}.`),e.drift?.length){console.error(" item-level difference:");for(let r of e.drift)console.error(` ${String(r.itemId).padEnd(12)} plane: ${String(r.plane).padEnd(7)} file: ${r.file}`)}else console.error(" no item differs \u2014 the newer version changed prose only.");console.error(" Bring this copy up to date, then republish:"),console.error(" git fetch origin && git merge origin/main # siblings' ticks land on main with their PRs"),console.error(" (copy any ticked item you still lack VERBATIM \u2014 never invent a sibling's note)"),console.error(` bostrat-blueprint show && bostrat-blueprint update ${s}`),console.error(` Or, once the file carries everything above: bostrat-blueprint update --base ${e.current} ${s}`)}else e.code==="untick"&&(console.error(` would un-tick: ${e.untick.join(", ")} (plane v${e.current} has them [x]).`),console.error(" Copy their ticks + status notes into the file (merge origin/main first), then republish."));console.error(" --force publishes the file exactly as it is (un-ticking the items above). Only when that is the intent."),process.exit(1)}function p(e){if(e){console.log(` parsed: ${e.sections.recognized} recognized section(s), ${e.items.total} item(s) (${e.items.bindable} bindable)`);for(let s of e.issues??[])console.log(` \u26A0 ${s.message}`)}}var i=process.argv.slice(2),a=i.shift();if(a==="add"||a==="update"){let e=null,s=null,r=null,t=null,o=null,u=!1;for(let n=0;n<i.length;n++)i[n]==="--circuit"?e=i[++n]:i[n]==="--new-circuit"?s=i[++n]:i[n]==="--name"?r=i[++n]:i[n]==="--base"?o=i[++n]:i[n]==="--force"?u=!0:t=i[n];t||c(`usage: bostrat-blueprint ${a} [--circuit <name-or-id>] [--new-circuit "<name>"] [--name "<title>"] [--base <v>] [--force] <file.md>`),o!=null&&!/^[1-9]\d*$/.test(String(o))&&c(`--base takes a version number (what \`show\` prints), got "${o}"`);try{let n=await(await import("node:fs/promises")).readFile(t,"utf8"),l=await d("POST","/api/blueprints/publish",{cwd:process.cwd(),circuit:e,newCircuit:s,name:r,markdown:n,base:o==null?null:Number(o),force:u});console.log(`[bostrat-blueprint] published \u201C${l.blueprint.name}\u201D v${l.blueprint.version} on circuit \u201C${l.circuit.name}\u201D${l.base?` (on v${l.base})`:""}${u?" (forced)":""}`),p(l.report),l.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(n){n.status===409&&n.data?.code&&b(n.data,t),c(n.message)}}else if(a==="show"||a==="report")try{let e=await d("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})`),p(e.report),a==="show"){let s=!!e.graph?.edges,r=t=>t.bindable?t.done?"done":s?t.ready?`ready${t.seam?" \xB7 seam":""}`:`waits on ${(t.waitsOn??[]).join(", ")}`:"":"";for(let t of e.items){let o=r(t);console.log(` ${t.bindable?t.itemId.padEnd(8):"(no id)".padEnd(8)} ${t.sectionKind.padEnd(14)} ${o?`[${o}] `:""}${t.text}`)}s&&console.log(" (readiness = every `after` item presents as done; a What-remains list bolds only ready items)")}}catch(e){c(e.message)}else if(a==="tag"){i.length||c("usage: bostrat-blueprint tag <BP-id> [<BP-id>\u2026]");try{let e=await d("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>)");