bostrat-node 1.14.6 → 1.14.7
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/bin/bostrat-blueprint +1 -1
- package/dist/cli.js +58 -58
- package/dist/index.js +270 -260
- package/package.json +1 -1
package/bin/bostrat-blueprint
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var w=process.env.BOSTRAT_AGENT_URL||`http://127.0.0.1:${process.env.BOSTRAT_AGENT_PORT||3362}`;async function f(e,s,r){let t=await fetch(`${w}${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 a(e){console.error(`[bostrat-blueprint] ${e}`),process.exit(1)}function v(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 g(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 n=process.argv.slice(2),l=n.shift();if(l==="add"||l==="update"){let e=null,s=null,r=null,t=null,o=null,d=!1;for(let i=0;i<n.length;i++)n[i]==="--circuit"?e=n[++i]:n[i]==="--new-circuit"?s=n[++i]:n[i]==="--name"?r=n[++i]:n[i]==="--base"?o=n[++i]:n[i]==="--force"?d=!0:t=n[i];t||a(`usage: bostrat-blueprint ${l} [--circuit <name-or-id>] [--new-circuit "<name>"] [--name "<title>"] [--base <v>] [--force] <file.md>`),o!=null&&!/^[1-9]\d*$/.test(String(o))&&a(`--base takes a version number (what \`show\` prints), got "${o}"`);try{let i=await(await import("node:fs/promises")).readFile(t,"utf8"),b=null;try{let{execFileSync:m}=await import("node:child_process"),u=await import("node:path"),h=u.resolve(t),$=m("git",["rev-parse","--show-toplevel"],{cwd:u.dirname(h),encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),p=u.relative($,h);p&&!p.startsWith("..")&&(b=p.split(u.sep).join("/"))}catch{}let c=await f("POST","/api/blueprints/publish",{cwd:process.cwd(),circuit:e,newCircuit:s,name:r,markdown:i,base:o==null?null:Number(o),force:d,path:b});console.log(`[bostrat-blueprint] published \u201C${c.blueprint.name}\u201D v${c.blueprint.version} on circuit \u201C${c.circuit.name}\u201D${c.base?` (on v${c.base})`:""}${d?" (forced)":""}`),g(c.report),c.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 same PR as the item's work.")}catch(i){i.status===409&&i.data?.code&&v(i.data,t),a(i.message)}}else if(l==="show"||l==="report")try{let e=await f("GET",`/api/blueprints/show?cwd=${encodeURIComponent(process.cwd())}${n[0]?`&circuit=${encodeURIComponent(n[0])}`:""}`);if(console.log(`[bostrat-blueprint] \u201C${e.blueprint.name}\u201D v${e.blueprint.version} (circuit ${e.blueprint.circuitId})`),g(e.report),l==="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){a(e.message)}else if(l==="tag"){n.length||a("usage: bostrat-blueprint tag <BP-id> [<BP-id>\u2026]");try{let e=await f("POST","/api/blueprints/tag",{cwd:process.cwd(),itemIds:n});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){a(e.message)}}else a("usage: bostrat-blueprint <add|update|show|report|tag> \u2026 (add [--circuit <ref>] <file.md>)");
|