bostrat-node 1.9.1 → 1.9.2
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-circuit +1 -1
- package/bin/bostrat-roadmap +6 -0
- package/dist/index.js +226 -198
- package/package.json +1 -1
package/bin/bostrat-circuit
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var d=process.env.BOSTRAT_AGENT_URL||`http://127.0.0.1:${process.env.BOSTRAT_AGENT_PORT||3362}`;async function r(t,o,i){let s=await fetch(`${d}${o}`,{method:t,headers:i?{"content-type":"application/json"}:void 0,body:i?JSON.stringify(i):void 0}),n=await s.json().catch(()=>({}));if(!s.ok)throw new Error(n.error||`HTTP ${s.status}`);return n}function c(t){console.error(`[bostrat-circuit] ${t}`),process.exit(1)}var p=process.argv.slice(2),a=p.shift();if(a==="link"){let t=p.join(" ").trim();t||c("usage: bostrat-circuit link <circuit-name-or-id>");try{let{circuit:o}=await r("POST","/api/circuits/link",{cwd:process.cwd(),ref:t});console.log(`[bostrat-circuit] linked to \u201C${o.name}\u201D (${o.id})`),console.log("This Track now rolls up on that circuit's ledger (a Track is in at most one circuit \u2014 link moves it).")}catch(o){c(o.message)}}else if(a==="unlink")try{await r("POST","/api/circuits/unlink",{cwd:process.cwd()}),console.log("[bostrat-circuit] unlinked \u2014 this Track is back in the Unassigned bucket")}catch(t){c(t.message)}else if(a==="ls")try{let{circuits:t}=await r("GET","/api/circuits");t.length||console.log("[bostrat-circuit] no circuits yet \u2014 create one on the Circuits page");for(let o of t)console.log(` ${o.id} ${o.status.padEnd(9)} ${o.name}`)}catch(t){c(t.message)}else if(a==="propose")try{let t=p[0],o;if(!t||t==="-"){let e=[];for await(let l of process.stdin)e.push(l);o=Buffer.concat(e).toString("utf8")}else o=await(await import("node:fs/promises")).readFile(t,"utf8");let i;try{i=JSON.parse(o)}catch{c("plan must be JSON (a file path, or piped on stdin) \u2014 see the `bostrat-circuit` header for the shape")}let{proposal:s}=await r("POST","/api/planning/propose",{cwd:process.cwd(),plan:i,scope:"circuit"}),n={};for(let e of s.ops)n[e.op]=(n[e.op]||0)+1;let u=Object.entries(n).map(([e,l])=>`${l}\xD7 ${e}`).join(" \xB7 ");console.log(`[bostrat-circuit] proposed ${s.ops.length} op${s.ops.length===1?"":"s"} (${u}) \u2014 review card posted to the Track chat.`),console.log(" Nothing changes until you tap Apply."),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(t){c(t.message)}else c("usage: bostrat-circuit <link|unlink|ls|propose> \u2026 (link <circuit-name-or-id> \xB7 propose <plan.json>)");
|
|
@@ -0,0 +1,6 @@
|
|
|
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 c(e,t,s){let o=await fetch(`${d}${t}`,{method:e,headers:s?{"content-type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0}),n=await o.json().catch(()=>({}));if(!o.ok)throw new Error(n.error||`HTTP ${o.status}`);return n}function a(e){console.error(`[bostrat-roadmap] ${e}`),process.exit(1)}async function f(e){if(!e||e==="-"){let t=[];for await(let s of process.stdin)t.push(s);return Buffer.concat(t).toString("utf8")}return(await import("node:fs/promises")).readFile(e,"utf8")}var p=process.argv.slice(2),l=p.shift();if(l==="ls")try{let e=await c("GET","/api/roadmap"),t=o=>e.people.find(n=>n.personId===o)?.label??o,s=o=>e.circuits.find(n=>n.id===o)?.name??o;e.people.length||console.log(' (no roadmap rows yet \u2014 a slot proposal for "me" creates yours)');for(let o of e.people)console.log(` ${o.personId} ${o.kind==="user"?"user ":"placeholder"} ${o.label}`);console.log(e.slots.length?`
|
|
3
|
+
bookings:`:`
|
|
4
|
+
bookings: none`);for(let o of e.slots)console.log(` ${o.slotId} ${o.startDate} \u2192 ${o.endDate} ${t(o.personId)} \xB7 ${s(o.circuitId)}${o.estUsd!=null?` \xB7 est $${o.estUsd}`:""}`);if(e.reservations.length){console.log(`
|
|
5
|
+
reserved:`);for(let o of e.reservations)console.log(` ${o.reservationId} ${o.startDate} \u2192 ${o.endDate} ${t(o.personId)} \xB7 ${o.label}`)}if(e.tray.length){console.log(`
|
|
6
|
+
unslotted circuits:`);for(let o of e.tray)console.log(` ${o.id} ${String(o.type).padEnd(6)} ${o.name}`)}}catch(e){a(e.message)}else if(l==="propose")try{let e=await f(p[0]),t;try{t=JSON.parse(e)}catch{a("plan must be JSON (a file path, or piped on stdin) \u2014 see the `bostrat-roadmap` header for the shape")}let{proposal:s}=await c("POST","/api/planning/propose",{cwd:process.cwd(),plan:t}),o={};for(let r of s.ops)o[r.op]=(o[r.op]||0)+1;let n=Object.entries(o).map(([r,i])=>`${i}\xD7 ${r}`).join(" \xB7 ");console.log(`[bostrat-roadmap] proposed ${s.ops.length} op${s.ops.length===1?"":"s"} (${n}) \u2014 review card posted to the Track chat.`),s.snapped&&console.log(" (dates snapped to whole ISO weeks \u2014 the card shows the spans that will apply)"),s.createsMeRow&&console.log(" (you have no roadmap row yet \u2014 applying the card creates one for you)"),console.log(" Nothing changes until you tap Apply."),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){a(e.message)}else a("usage: bostrat-roadmap <ls|propose> \u2026 (propose <plan.json>, or - for stdin)");
|