dispach 0.1.0 → 0.1.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.
- package/README.md +59 -18
- package/dist/App-5a35bjkt.js +11 -0
- package/dist/{App-dxqm39zx.js.map → App-5a35bjkt.js.map} +1 -1
- package/dist/{ConfigEditor-7v5nebvy.js → ConfigEditor-7nnc2ke6.js} +4 -4
- package/dist/{ConfigEditor-7v5nebvy.js.map → ConfigEditor-7nnc2ke6.js.map} +1 -1
- package/dist/{KeyProbe-vjhmdpx6.js → KeyProbe-kbz0j6sm.js} +3 -3
- package/dist/{KeyProbe-vjhmdpx6.js.map → KeyProbe-kbz0j6sm.js.map} +1 -1
- package/dist/{Picker-jxaesaxy.js → Picker-2zjjt17a.js} +3 -3
- package/dist/{Picker-jxaesaxy.js.map → Picker-2zjjt17a.js.map} +1 -1
- package/dist/{SessionPicker-z2t0p4b5.js → SessionPicker-fyyvxy40.js} +3 -3
- package/dist/{SessionPicker-z2t0p4b5.js.map → SessionPicker-fyyvxy40.js.map} +1 -1
- package/dist/{SkillBrowser-yyf2gy0q.js → SkillBrowser-x7r51zy0.js} +3 -3
- package/dist/{SkillBrowser-yyf2gy0q.js.map → SkillBrowser-x7r51zy0.js.map} +1 -1
- package/dist/WizardApp-v0dghsyw.js +5 -0
- package/dist/{WizardApp-12ndxgqv.js.map → WizardApp-v0dghsyw.js.map} +1 -1
- package/dist/client.js +8 -8
- package/dist/client.js.map +3 -3
- package/dist/{config-yz0nz51b.js → config-9cv76yrk.js} +13 -13
- package/dist/{config-yz0nz51b.js.map → config-9cv76yrk.js.map} +1 -1
- package/dist/{credential-wgt4gvcz.js → credential-yxqj8x1f.js} +5 -5
- package/dist/{credential-wgt4gvcz.js.map → credential-yxqj8x1f.js.map} +1 -1
- package/dist/{index-7da4fqcr.js → index-000rxxy3.js} +5 -5
- package/dist/{index-7da4fqcr.js.map → index-000rxxy3.js.map} +1 -1
- package/dist/{index-9f9pp2ef.js → index-0b1hdwnm.js} +4 -4
- package/dist/{index-9f9pp2ef.js.map → index-0b1hdwnm.js.map} +1 -1
- package/dist/{index-9nsfs0vy.js → index-17an0jqq.js} +4 -4
- package/dist/{index-9nsfs0vy.js.map → index-17an0jqq.js.map} +1 -1
- package/dist/index-2wmsmcbr.js +6 -0
- package/dist/{index-my5cjx00.js.map → index-2wmsmcbr.js.map} +1 -1
- package/dist/{index-9d011p3q.js → index-3g3ny01d.js} +4 -4
- package/dist/{index-9d011p3q.js.map → index-3g3ny01d.js.map} +1 -1
- package/dist/{index-8bmhd2hj.js → index-4cf6v9nb.js} +4 -4
- package/dist/{index-8bmhd2hj.js.map → index-4cf6v9nb.js.map} +1 -1
- package/dist/{index-bwckzbf8.js → index-4z7axw4r.js} +4 -4
- package/dist/{index-bwckzbf8.js.map → index-4z7axw4r.js.map} +1 -1
- package/dist/{index-b5wwtxzk.js → index-5t6wahx8.js} +28 -28
- package/dist/{index-b5wwtxzk.js.map → index-5t6wahx8.js.map} +5 -5
- package/dist/{index-6b7qvh1x.js → index-5x4dn0gg.js} +4 -4
- package/dist/{index-6b7qvh1x.js.map → index-5x4dn0gg.js.map} +1 -1
- package/dist/index-73jfw4jp.js +6 -0
- package/dist/{index-jym27m75.js.map → index-73jfw4jp.js.map} +1 -1
- package/dist/{index-2cvtz0fy.js → index-7z4sw2dm.js} +228 -228
- package/dist/{index-2cvtz0fy.js.map → index-7z4sw2dm.js.map} +4 -4
- package/dist/{index-gbnc99j8.js → index-83bqtze0.js} +9 -9
- package/dist/{index-gbnc99j8.js.map → index-83bqtze0.js.map} +1 -1
- package/dist/index-9bkd0fdj.js +427 -0
- package/dist/{index-bry9bzt3.js.map → index-9bkd0fdj.js.map} +2 -2
- package/dist/{index-cx3vz7sf.js → index-9r0wyj6w.js} +4 -4
- package/dist/{index-cx3vz7sf.js.map → index-9r0wyj6w.js.map} +1 -1
- package/dist/index-a4xqgdrm.js +6 -0
- package/dist/{index-rqbtm761.js.map → index-a4xqgdrm.js.map} +1 -1
- package/dist/{index-j97vttdt.js → index-ammv5st7.js} +6 -6
- package/dist/{index-j97vttdt.js.map → index-ammv5st7.js.map} +1 -1
- package/dist/{index-qc2vrq9z.js → index-cqqb6gaq.js} +5 -5
- package/dist/{index-qc2vrq9z.js.map → index-cqqb6gaq.js.map} +1 -1
- package/dist/{index-jk0def33.js → index-d4x6yvqh.js} +4 -4
- package/dist/{index-jk0def33.js.map → index-d4x6yvqh.js.map} +1 -1
- package/dist/{index-fvhg0xyd.js → index-d69d6pkm.js} +79 -79
- package/dist/{index-fvhg0xyd.js.map → index-d69d6pkm.js.map} +1 -1
- package/dist/{index-rqzg861g.js → index-dwyr2kdm.js} +4 -4
- package/dist/{index-rqzg861g.js.map → index-dwyr2kdm.js.map} +1 -1
- package/dist/{index-6z0yr17z.js → index-e0j1jafd.js} +7 -7
- package/dist/{index-6z0yr17z.js.map → index-e0j1jafd.js.map} +1 -1
- package/dist/{index-xqyms08r.js → index-ez2mb28y.js} +4 -4
- package/dist/{index-xqyms08r.js.map → index-ez2mb28y.js.map} +1 -1
- package/dist/{index-e8n70sgj.js → index-fex44816.js} +4 -4
- package/dist/{index-e8n70sgj.js.map → index-fex44816.js.map} +1 -1
- package/dist/{index-t1xvacym.js → index-gme2egyq.js} +4 -4
- package/dist/{index-t1xvacym.js.map → index-gme2egyq.js.map} +1 -1
- package/dist/{index-mrtb5y08.js → index-gz9x25tz.js} +4 -4
- package/dist/{index-mrtb5y08.js.map → index-gz9x25tz.js.map} +1 -1
- package/dist/{index-mgdgx22q.js → index-j7gyr5nx.js} +6 -6
- package/dist/{index-mgdgx22q.js.map → index-j7gyr5nx.js.map} +1 -1
- package/dist/{index-xgqzk5cq.js → index-nvm5hwe4.js} +6 -6
- package/dist/{index-xgqzk5cq.js.map → index-nvm5hwe4.js.map} +1 -1
- package/dist/index-r3wwvqzb.js +77 -0
- package/dist/index-r3wwvqzb.js.map +12 -0
- package/dist/index-v8e92nfw.js +6 -0
- package/dist/{index-b8zwg8a3.js.map → index-v8e92nfw.js.map} +1 -1
- package/dist/{index-yr25dnf5.js → index-xf178c4m.js} +4 -4
- package/dist/{index-yr25dnf5.js.map → index-xf178c4m.js.map} +1 -1
- package/dist/index-zked16y4.js +7 -0
- package/dist/{index-h2yds678.js.map → index-zked16y4.js.map} +1 -1
- package/dist/{index-3nwfz9jq.js → index-zxh0ntgf.js} +10 -10
- package/dist/{index-3nwfz9jq.js.map → index-zxh0ntgf.js.map} +1 -1
- package/dist/index.js +202 -198
- package/dist/index.js.map +6 -6
- package/dist/lib/bootstrap.d.ts +13 -0
- package/dist/lib/bootstrap.d.ts.map +1 -1
- package/dist/lib/provision.d.ts.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/{web-w7r68df1.js → web-x77y8w3v.js} +5 -5
- package/dist/{web-w7r68df1.js.map → web-x77y8w3v.js.map} +1 -1
- package/package.json +2 -2
- package/dist/App-dxqm39zx.js +0 -11
- package/dist/WizardApp-12ndxgqv.js +0 -5
- package/dist/index-9pj1ws0p.js +0 -77
- package/dist/index-9pj1ws0p.js.map +0 -12
- package/dist/index-b8zwg8a3.js +0 -6
- package/dist/index-bry9bzt3.js +0 -427
- package/dist/index-h2yds678.js +0 -7
- package/dist/index-jym27m75.js +0 -6
- package/dist/index-my5cjx00.js +0 -6
- package/dist/index-rqbtm761.js +0 -6
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * The one place in this package that starts a process.\n *\n * There were two callers before this file existed and the second one is what created it: `lib/service.ts`\n * ran `launchctl`, and fetching a skill source needs `git`. The rule the boundaries test enforces is\n * \"exactly one module imports `node:child_process`\", and its stated reason is that a second call site is a\n * second place a test has to intercept — the first one that forgets reaches somebody's real machine. Two\n * callers of one seam keeps that property; an allowlist with two entries in it loses it, and would go on\n * losing it once per phase.\n *\n * Deliberately thin, and deliberately not clever. Everything specific to a tool — git's four ways of\n * being told not to prompt, launchd's exit-status decoding — belongs to the caller that knows about it.\n * What lives here is \"run this, capture what it said, and tell me honestly how it ended\".\n *\n * `notFound` is a field rather than an exception because the two callers want different sentences for it:\n * a missing `git` has a remedy the person can act on, and a missing `launchctl` means this is not the\n * operating system the caller thought it was. A shared error message would be wrong for both.\n */\n\nimport { spawn, spawnSync } from \"node:child_process\"\n\nexport interface SpawnRequest {\n readonly command: string\n readonly args: readonly string[]\n readonly cwd?: string\n /** Replaces the environment entirely when given. Callers spread `process.env` themselves. */\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly timeoutMs?: number\n readonly maxBuffer?: number\n /**\n * Text to write to the child's stdin, which is then closed.\n *\n * Added for the clipboard: `pbcopy` reads what it copies from stdin and there is no argument form. The\n * alternative was a temporary file, which puts whatever was selected on disk — and a selection is\n * routinely the most sensitive thing on the screen. The seam grows rather than the caller working\n * around it, per the rule about first-party code not getting private escape hatches.\n */\n readonly input?: string\n}\n\nexport interface SpawnResult {\n readonly code: number\n readonly stdout: string\n readonly stderr: string\n /** True when a timeout or a signal ended it, rather than the process choosing to exit. */\n readonly signalled: boolean\n /** True when the command is not on PATH at all. */\n readonly notFound: boolean\n}\n\nexport function spawnCapture(request: SpawnRequest): SpawnResult {\n const result = spawnSync(request.command, [...request.args], {\n encoding: \"utf8\",\n ...(request.input === undefined ? {} : { input: request.input }),\n ...(request.cwd === undefined ? {} : { cwd: request.cwd }),\n ...(request.env === undefined ? {} : { env: request.env as NodeJS.ProcessEnv }),\n ...(request.timeoutMs === undefined ? {} : { timeout: request.timeoutMs }),\n ...(request.maxBuffer === undefined ? {} : { maxBuffer: request.maxBuffer }),\n })\n const code = (result.error as NodeJS.ErrnoException | undefined)?.code\n return {\n code: result.status ?? 1,\n stdout: result.stdout ?? \"\",\n stderr: result.stderr ?? \"\",\n signalled: result.signal !== null,\n notFound: code === \"ENOENT\",\n }\n}\n\n/**\n * The same thing, without blocking the event loop.\n *\n * Exists because `spawnSync` inside an Ink app freezes the whole terminal: no spinner frame advances, and\n * the keypresses that arrive during a twenty-second `git clone` are echoed by the tty instead of being\n * consumed by the app — which is how `^[[B^[[A` ended up printed in the middle of a fetch progress line.\n * Anything a rendered screen waits on has to be awaited, not blocked on.\n */\nexport function spawnCaptureAsync(request: SpawnRequest): Promise<SpawnResult> {\n return new Promise((resolve) => {\n const child = spawn(request.command, [...request.args], {\n ...(request.cwd === undefined ? {} : { cwd: request.cwd }),\n ...(request.env === undefined ? {} : { env: request.env as NodeJS.ProcessEnv }),\n // Never inherit: a child that writes to the terminal would paint over the rendered frame, and\n // one that reads from it would steal the keys the app is listening for.\n // A pipe only when there is something to write. `ignore` otherwise, for the reason below.\n stdio: [request.input === undefined ? \"ignore\" : \"pipe\", \"pipe\", \"pipe\"],\n })\n if (request.input !== undefined) {\n // Ended immediately: a child reading stdin waits for EOF, so a pipe left open is a process\n // that never exits and a promise that never settles.\n child.stdin?.end(request.input)\n }\n let stdout = \"\"\n let stderr = \"\"\n let signalled = false\n const cap = request.maxBuffer ?? 32 * 1024 * 1024\n child.stdout?.on(\"data\", (chunk: Buffer) => {\n if (stdout.length < cap) stdout += chunk.toString(\"utf8\")\n })\n child.stderr?.on(\"data\", (chunk: Buffer) => {\n if (stderr.length < cap) stderr += chunk.toString(\"utf8\")\n })\n const timer =\n request.timeoutMs === undefined\n ? undefined\n : setTimeout(() => {\n signalled = true\n // The group, not the pid: `git clone` spawns helpers, and killing only the parent\n // leaves them running with nothing referencing them.\n child.kill(\"SIGTERM\")\n }, request.timeoutMs)\n child.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (timer !== undefined) clearTimeout(timer)\n resolve({\n code: 1,\n stdout,\n stderr: error.message,\n signalled,\n notFound: error.code === \"ENOENT\",\n })\n })\n child.on(\"close\", (code, signal) => {\n if (timer !== undefined) clearTimeout(timer)\n resolve({\n code: code ?? 1,\n stdout,\n stderr,\n signalled: signalled || signal !== null,\n notFound: false,\n })\n })\n })\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAmBA,gBAAS,eAAO,2BA+BT,SAAS,EAAY,C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S,EAAK,GAAU,EAAM,SAAS,MAAM,EAC3D,EACD,IAAM,EACF,EAAQ,YAAc,OAChB,OACA,WAAW,IAAM,CACb,EAAY,GAGZ,EAAM,KAAK,SAAS,GACrB,EAAQ,SAAS,EAC9B,EAAM,GAAG,QAAS,CAAC,IAAiC,CAChD,GAAI,IAAU,OAAW,aAAa,CAAK,EAC3C,EAAQ,CACJ,KAAM,EACN,SACA,OAAQ,EAAM,QACd,YACA,SAAU,EAAM,OAAS,QAC7B,CAAC,EACJ,EACD,EAAM,GAAG,QAAS,CAAC,EAAM,IAAW,CAChC,GAAI,IAAU,OAAW,aAAa,CAAK,EAC3C,EAAQ,CACJ,KAAM,GAAQ,EACd,SACA,SACA,UAAW,GAAa,IAAW,KACnC,SAAU,EACd,CAAC,EACJ,EACJ",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "6440A2AD82AFB7D764756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{o,u,
|
|
3
|
-
export{
|
|
2
|
+
import{o,u,xn,En,Tn,I}from"./index-d4x6yvqh.js";import{W}from"./index-gz9x25tz.js";import{Box as T,Text as d}from"ink";import{jsx as m,jsxs as s}from"react/jsx-runtime";function Qt({rows:e,index:t,chosen:c,window:n,width:l}){let{from:r,to:a}=I(e.length,t,n),b=new Set(c),g=e.reduce((i,p)=>p.kind==="item"?Math.max(i,p.label.length):i,0),M=xn(l,g);return s(T,{flexDirection:"column",children:[r>0?s(d,{dimColor:!0,wrap:"truncate",children:[" ",u.ellipsis," ",r," above"]}):null,e.slice(r,a).map((i,p)=>{let x=r+p;if(i.kind!=="item"){let f=i.kind==="source";return s(d,{wrap:"truncate",bold:f,color:f?o.accent:o.muted,children:[f?" ":" ",Tn(i.label,l-(f?2:4))]},x)}let h=x===t,y=b.has(x),S=En({name:i.label,meta:i.meta??"",description:i.description??""},M);return s(d,{wrap:"truncate",children:[m(d,{color:o.accent,children:h?u.pointer:" "}),m(d,{color:y?o.success:o.muted,children:y?u.checked:u.unchecked}),m(d,{bold:h,...y?{color:o.success}:{},children:S.name})," ",m(d,{color:o.muted,children:S.meta}),S.description===""?"":" ",m(d,{dimColor:!0,children:S.description})]},x)}),a<e.length?s(d,{dimColor:!0,wrap:"truncate",children:[" ",u.ellipsis," ",e.length-a," below"]}):null]})}function k(e,t,c){let n=e;for(let l=0;l<=t.length;l+=1){if(t[n.index]===!0)return n;let r=W(n,{kind:c?"down":"up"});if(r.index===n.index)return;n=r}return}function v(e,t,c,n){if(c.length===0)return e;return k(t,c,n)??k(t,c,!n)??e}function ot(e,t,c){switch(t.kind){case"move":{if(!c.includes(!0))return e;let n=W(e.cursor,t.move),l=n.index>=e.cursor.index;return{...e,cursor:v(e.cursor,n,c,l)}}case"toggle":{let n=e.cursor.index;if(c[n]!==!0)return e;let l=e.chosen.includes(n)?e.chosen.filter((r)=>r!==n):[...e.chosen,n].sort((r,a)=>r-a);return{...e,chosen:l}}case"all":{let n=c.flatMap((l,r)=>l?[r]:[]);return{...e,chosen:n}}case"none":return{...e,chosen:[]}}}function en(e){let t=e.indexOf(!0);return t===-1?0:t}
|
|
3
|
+
export{Qt,ot,en};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=E6CE155E3D3FA44364756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-fex44816.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * The multi-select reducer: move a cursor, toggle rows, read back what was chosen.\n *\n * Pure, and PURE-listed for the same reason `select.ts` is — one `useInput` per screen root over a pure\n * keymap and a pure reducer, so the behaviour is unit-testable without mounting Ink and the component\n * cannot grow a second copy of the rules.\n *\n * `chosen` is a sorted index array rather than a `Set`, and that is deliberate: it makes the state\n * structurally comparable in a test (`toEqual`), keeps React's identity checks honest, and fixes the\n * install order to the order shown on screen — which is what somebody expects after ticking four boxes\n * top to bottom.\n *\n * Rows that are group headings are not selectable, so `count` alone is not enough: the reducer needs to\n * know which indices are real. `selectable` is passed in rather than derived, because the same reducer\n * serves a flat list (every row selectable) and a grouped one.\n */\n\nimport { moveSelect, type SelectMove, type SelectState } from \"#lib/select\"\n\nexport interface MultiSelectState {\n readonly cursor: SelectState\n /** Indices into the full row list, ascending. */\n readonly chosen: readonly number[]\n}\n\nexport type MultiSelectAction =\n | { readonly kind: \"move\"; readonly move: SelectMove }\n | { readonly kind: \"toggle\" }\n | { readonly kind: \"all\" }\n | { readonly kind: \"none\" }\n\nexport function startMultiSelect(count: number): MultiSelectState {\n return { cursor: { index: 0, count }, chosen: [] }\n}\n\n/**\n * Walk from a landing point until a selectable row is found, in one direction.\n *\n * `undefined` when the walk reaches the end of the list without finding one. Detected by the index\n * stopping rather than by counting: `moveSelect` clamps at both ends, so a walk that has run out of\n * list returns the same index forever, and *that* is the honest end condition.\n */\nfunction walk(\n from: SelectState,\n selectable: readonly boolean[],\n forward: boolean,\n): SelectState | undefined {\n let next = from\n for (let step = 0; step <= selectable.length; step += 1) {\n if (selectable[next.index] === true) return next\n const after = moveSelect(next, { kind: forward ? \"down\" : \"up\" })\n if (after.index === next.index) return undefined\n next = after\n }\n return undefined\n}\n\n/**\n * Put the cursor on a selectable row, given where it was and where the move would have put it.\n *\n * Without this the cursor lands on a group heading and enter does nothing, which reads as a broken\n * keyboard. Group headings are the reason it exists, and the first row of a grouped list is always one.\n *\n * Three passes, in order, and the order is the whole correctness argument:\n *\n * 1. **Continue the way it was going.** Down past a heading keeps going down.\n * 2. **Reverse.** The walk ran out of list — pressing up on the first skill of a grouped catalogue lands\n * on the source heading with nothing selectable above it, so the answer is the row below, which is\n * where the cursor already was. This pass is also what makes `g` (first) and `G` (last) work: `g`\n * lands on row 0, which in a grouped list is always a heading, and only a downward search finds\n * anything.\n * 3. **Stay put.** Nothing anywhere is selectable.\n *\n * Returning `moved` on exhaustion — which is what the first version did, by falling through to its own\n * parameter — put the cursor on the heading. That is the bug this function exists to prevent, wearing\n * the fix's clothes, and a frame test caught it by noticing the pointer had vanished from the list\n * entirely: a heading row draws no cursor, so parking there makes the cursor *invisible* as well as\n * inert.\n */\nfunction selectableCursor(\n from: SelectState,\n moved: SelectState,\n selectable: readonly boolean[],\n forward: boolean,\n): SelectState {\n if (selectable.length === 0) return from\n return walk(moved, selectable, forward) ?? walk(moved, selectable, !forward) ?? from\n}\n\nexport function reduceMultiSelect(\n state: MultiSelectState,\n action: MultiSelectAction,\n selectable: readonly boolean[],\n): MultiSelectState {\n switch (action.kind) {\n case \"move\": {\n // With nothing selectable the cursor does not move at all, rather than moving onto a heading:\n // parking it on an unselectable row is the exact thing `skipUnselectable` exists to prevent, so\n // doing it as a fallback would be the bug wearing the fix's clothes.\n if (!selectable.includes(true)) return state\n const moved = moveSelect(state.cursor, action.move)\n // Derived from where the cursor actually went rather than from the kind of move, because\n // the two disagree for `first` and `last`: `g` travels *backwards* to row 0 and then has to\n // search *forwards* to find anything selectable. Reading it off the indices makes every\n // move kind — including a digit jump — fall out of one rule.\n const forward = moved.index >= state.cursor.index\n return { ...state, cursor: selectableCursor(state.cursor, moved, selectable, forward) }\n }\n case \"toggle\": {\n const index = state.cursor.index\n if (selectable[index] !== true) return state\n const chosen = state.chosen.includes(index)\n ? state.chosen.filter((entry) => entry !== index)\n : [...state.chosen, index].sort((a, b) => a - b)\n return { ...state, chosen }\n }\n case \"all\": {\n const chosen = selectable.flatMap((ok, index) => (ok ? [index] : []))\n return { ...state, chosen }\n }\n case \"none\":\n return { ...state, chosen: [] }\n }\n}\n\n/** Where the cursor should start: the first selectable row, never a heading. */\nexport function firstSelectable(selectable: readonly boolean[]): number {\n const index = selectable.indexOf(true)\n return index === -1 ? 0 : index\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";mFAoBA,cAAS,UAAK,8DAuBP,SAAS,EAAS,EAAG,OAAM,QAAO,SAAQ,SAAQ,SAAyB,CAC9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IAAM,EAAI,CAAC,EACnD,MAAO,IAAK,EAAO,QAAO,CAC9B,KACK,MAAO,CACR,IAAM,EAAS,EAAW,QAAQ,CAAC,EAAI,IAAW,EAAK,CAAC,CAAK,EAAI,CAAC,CAAE,EACpE,MAAO,IAAK,EAAO,QAAO,CAC9B,KACK,OACD,MAAO,IAAK,EAAO,OAAQ,CAAC,CAAE,GAKnC,SAAS,EAAe,CAAC,EAAwC,CACpE,IAAM,EAAQ,EAAW,QAAQ,EAAI,EACrC,OAAO,IAAU,GAAK,EAAI",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "E6CE155E3D3FA44364756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{Yo}from"./index-d4x6yvqh.js";var c=[{title:"Specs and planning",skills:["prd","breakdown-feature-prd","breakdown-epic-pm","breakdown-feature-implementation","breakdown-plan","create-implementation-plan","create-specification","create-architectural-decision-record","create-technical-spike"]},{title:"Documents",skills:["create-readme","create-tldr-page","documentation-writer","convert-plaintext-to-md","markdown-to-html"]},{title:"Communications",skills:["meeting-minutes","email-drafter","linkedin-post-formatter","daily-prep"]},{title:"Go to market",skills:["gtm-0-to-1-launch","gtm-board-and-investor-communication","gtm-enterprise-account-planning","gtm-enterprise-onboarding","gtm-operating-cadence","gtm-partnership-architecture","gtm-positioning-strategy","gtm-product-led-growth","gtm-technical-product-pricing","gtm-developer-ecosystem"]},{title:"Team and process",skills:["mentoring-juniors","impediment-prioritization","quality-playbook"]},{title:"Diagrams",skills:["napkin","excalidraw-diagram-generator","draw-io-diagram-generator","plantuml-ascii"]},{title:"Prompt craft and research",skills:["boost-prompt","autoresearch"]}],lo=c.flatMap((e)=>e.skills);function u(e){return c.find((n)=>n.skills.includes(e))?.title}function m(e,n){let t=n.filter((a)=>a.problem===void 0);if(e.curated===void 0)return t;let r=new Set(e.curated);return t.filter((a)=>r.has(a.skill)||r.has(g(a.repoPath)))}function g(e){let n=e.lastIndexOf("/");return n===-1?e:e.slice(n+1)}function co(e){let n=[];for(let t of e){let r=m(t.spec,t.entries);if(r.length===0)continue;let a=new Set(t.installed??[]);n.push({kind:"source",label:`${t.spec.name} ${r.length} skill${r.length===1?"":"s"}`});let s=new Map,d=[];for(let o of r){let i=t.spec.curated===void 0?void 0:u(o.skill);if(i===void 0)d.push(o);else{let l=s.get(i);if(l===void 0)s.set(i,[o]);else l.push(o)}}for(let o of d)n.push(p(o,a));for(let[o,i]of s){n.push({kind:"group",label:o});for(let l of i)n.push(p(l,a))}}return n}function p(e,n){return{kind:"item",label:e.skill,meta:Yo(e.tokens,e.scripts.length,n.has(e.skill)),description:f(e.description),entry:e}}function f(e){let n=e.replace(/\s+/g," ").trim(),t=n.search(/\.\s/);return t===-1?n:n.slice(0,t+1)}function st(e){return e.map((n)=>n.kind==="item")}function tn(e,n){return n.map((t)=>e[t]?.entry).filter((t)=>t!==void 0)}function Et(e){let n=e.filter((t)=>t.ok);return{installed:n.map((t)=>t.name),failed:e.filter((t)=>!t.ok).map((t)=>({name:t.name,reason:t.reason??"not installed"})),runnable:n.reduce((t,r)=>t+r.runnable.length,0),withCode:n.filter((t)=>t.runnable.length>0).length,total:e.length}}
|
|
3
|
+
export{lo,co,st,tn,Et};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=1752D5B0B669A9A864756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-gme2egyq.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * The browse list: a curated catalogue turned into rows, and rows turned back into skills.\n *\n * Pure and PURE-listed. The screen root renders it and the plain path prints it, so the *shape* of the\n * list — which sources appear, in what order, under which headings, with what shown beside each entry —\n * is decided once here and asserted without mounting Ink or reaching a network.\n *\n * Keeping this separate from the component is what makes `--plain` honest: a terminal and a pipe print\n * the same list because both read the same rows, rather than the plain path reimplementing the ordering\n * and drifting the first time a group is added.\n */\n\nimport { curatedGroupOf } from \"#lib/curated\"\nimport { metaOf } from \"#lib/rows\"\nimport type { CatalogueEntry } from \"#lib/source-cache\"\nimport type { SourceSpec } from \"#lib/sources\"\n\nexport interface BrowseRow {\n /** `source` is a top-level heading, `group` a subheading; neither is selectable. */\n readonly kind: \"source\" | \"group\" | \"item\"\n readonly label: string\n /** Its own column, not appended to the label — the row is laid out, not concatenated. */\n readonly meta?: string\n readonly description?: string\n /** The skill this row installs. Absent on a heading. */\n readonly entry?: CatalogueEntry\n}\n\n/**\n * A source's entries, filtered by its curation and grouped for display.\n *\n * Curation is applied *here* rather than in `readCatalogue`, so `sources search` keeps seeing everything.\n * A curated list is a recommendation; a search that could not find a named skill would be a restriction.\n */\nexport function curatedEntries(\n spec: SourceSpec,\n entries: readonly CatalogueEntry[],\n): readonly CatalogueEntry[] {\n const usable = entries.filter((entry) => entry.problem === undefined)\n if (spec.curated === undefined) return usable\n const allowed = new Set(spec.curated)\n // Matched on the *folder* name, which is what a curated list is written in terms of — and which the\n // spec requires to equal the frontmatter name, so either would work today and the folder is the one\n // that stays true if upstream renames the skill inside the file.\n return usable.filter(\n (entry) => allowed.has(entry.skill) || allowed.has(basename(entry.repoPath)),\n )\n}\n\nfunction basename(path: string): string {\n const cut = path.lastIndexOf(\"/\")\n return cut === -1 ? path : path.slice(cut + 1)\n}\n\nexport interface BrowseInput {\n readonly spec: SourceSpec\n readonly entries: readonly CatalogueEntry[]\n /** Already installed in the target agent, shown as such rather than offered twice. */\n readonly installed?: readonly string[]\n}\n\n/**\n * Every row, in display order: one heading per source, then per curated group where the source has them.\n *\n * An installed skill is listed with a note rather than removed, because a list whose contents change\n * depending on which agent you picked is one you cannot learn.\n */\nexport function browseRows(inputs: readonly BrowseInput[]): readonly BrowseRow[] {\n const rows: BrowseRow[] = []\n for (const input of inputs) {\n const entries = curatedEntries(input.spec, input.entries)\n if (entries.length === 0) continue\n const installed = new Set(input.installed ?? [])\n\n rows.push({\n kind: \"source\",\n label: `${input.spec.name} ${entries.length} skill${entries.length === 1 ? \"\" : \"s\"}`,\n })\n\n // Grouped where the curation defines groups, flat otherwise. `anthropics/skills` is 17 broadly\n // useful entries and inventing categories for it would be editorialising about somebody else's\n // catalogue; `awesome-copilot` is 425 and the groups are why it is legible at all.\n const grouped = new Map<string, CatalogueEntry[]>()\n const ungrouped: CatalogueEntry[] = []\n for (const entry of entries) {\n const group = input.spec.curated === undefined ? undefined : curatedGroupOf(entry.skill)\n if (group === undefined) ungrouped.push(entry)\n else {\n const bucket = grouped.get(group)\n if (bucket === undefined) grouped.set(group, [entry])\n else bucket.push(entry)\n }\n }\n\n for (const entry of ungrouped) rows.push(itemRow(entry, installed))\n for (const [title, bucket] of grouped) {\n rows.push({ kind: \"group\", label: title })\n for (const entry of bucket) rows.push(itemRow(entry, installed))\n }\n }\n return rows\n}\n\nfunction itemRow(entry: CatalogueEntry, installed: ReadonlySet<string>): BrowseRow {\n return {\n kind: \"item\",\n label: entry.skill,\n // The script count is on the row because it is the one fact that should change somebody's mind\n // before ticking a box: a skill with runnable files is code that will run on this machine.\n meta: metaOf(entry.tokens, entry.scripts.length, installed.has(entry.skill)),\n description: summarise(entry.description),\n entry,\n }\n}\n\n/**\n * First sentence, uncapped.\n *\n * The *column* decides the visible width now, in `lib/rows.ts`, so capping here as well would truncate\n * twice — once at 96 characters and again at whatever the terminal has left, which is how a wide terminal\n * ends up showing a short description with an ellipsis and empty space after it.\n */\nexport function summarise(description: string): string {\n const flat = description.replace(/\\s+/g, \" \").trim()\n const stop = flat.search(/\\.\\s/)\n return stop === -1 ? flat : flat.slice(0, stop + 1)\n}\n\n/** Which rows the cursor may land on, for the multi-select reducer. */\nexport function selectableOf(rows: readonly BrowseRow[]): readonly boolean[] {\n return rows.map((row) => row.kind === \"item\")\n}\n\n/** The skills behind a set of chosen row indices, in the order they appear on screen. */\nexport function chosenEntries(\n rows: readonly BrowseRow[],\n chosen: readonly number[],\n): readonly CatalogueEntry[] {\n return chosen\n .map((index) => rows[index]?.entry)\n .filter((entry): entry is CatalogueEntry => entry !== undefined)\n}\n\n// ─── what an install did ─────────────────────────────────────────────────────────────────\n\n/**\n * The structural half of `skills.ts`'s `InstallOutcome`.\n *\n * Declared here rather than imported so this module stays free of the command that produces it —\n * `skills.ts` reaches the filesystem, and importing it would drag that into every consumer of the row\n * layout, including the pure tests.\n */\nexport interface InstallOutcomeLike {\n readonly name: string\n readonly ok: boolean\n readonly reason?: string\n readonly runnable: readonly string[]\n}\n\nexport interface InstallReport {\n readonly installed: readonly string[]\n readonly failed: readonly { readonly name: string; readonly reason: string }[]\n /** Runnable files across every successful install, and how many skills brought them. */\n readonly runnable: number\n readonly withCode: number\n readonly total: number\n}\n\n/**\n * One report for a batch, as data.\n *\n * Both renderings read this — the text one the pipe and `init` print, and the card the browser shows\n * inside its own frame. The alternative was each composing its own summary from the outcomes, and a\n * terminal and a pipe disagreeing about what happened is exactly the class of failure the shared\n * `browseRows` was introduced to end.\n */\nexport function installReport(outcomes: readonly InstallOutcomeLike[]): InstallReport {\n const ok = outcomes.filter((outcome) => outcome.ok)\n return {\n installed: ok.map((outcome) => outcome.name),\n failed: outcomes\n .filter((outcome) => !outcome.ok)\n .map((outcome) => ({ name: outcome.name, reason: outcome.reason ?? \"not installed\" })),\n runnable: ok.reduce((count, outcome) => count + outcome.runnable.length, 0),\n withCode: ok.filter((outcome) => outcome.runnable.length > 0).length,\n total: outcomes.length,\n }\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";oCAmCO,IAAM,EAA6C,CACtD,CACI,MAAO,qBACP,OAAQ,CACJ,MACA,wBACA,oBACA,mCACA,iBACA,6BACA,uBACA,uCACA,wBACJ,CACJ,EACA,CACI,MAAO,YACP,OAAQ,CACJ,gBACA,mBACA,uBACA,0BACA,kBACJ,CACJ,EACA,CACI,MAAO,iBACP,OAAQ,CAAC,kBAAmB,gBAAiB,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AG,IAAI,CAAC,IAAY,EAAQ,IAAI,EAC3C,OAAQ,EACH,OAAO,CAAC,IAAY,CAAC,EAAQ,EAAE,EAC/B,IAAI,CAAC,KAAa,CAAE,KAAM,EAAQ,KAAM,OAAQ,EAAQ,QAAU,eAAgB,EAAE,EACzF,SAAU,EAAG,OAAO,CAAC,EAAO,IAAY,EAAQ,EAAQ,SAAS,OAAQ,CAAC,EAC1E,SAAU,EAAG,OAAO,CAAC,IAAY,EAAQ,SAAS,OAAS,CAAC,EAAE,OAC9D,MAAO,EAAS,MACpB",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "1752D5B0B669A9A864756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{o,u,
|
|
3
|
-
export{ae,
|
|
2
|
+
import{o,u,I}from"./index-d4x6yvqh.js";import{Box as f,Text as d}from"ink";import{jsxs as r}from"react/jsx-runtime";function ae({items:e,index:n,numbered:t,maxRows:p}){let m=p===void 0?e.length:Math.max(1,p),{from:c,to:x}=I(e.length,n,m),s=e.slice(c,x).map((l,i)=>({at:c+i,item:l}));return r(f,{flexDirection:"column",children:[c>0?r(d,{dimColor:!0,wrap:"truncate",children:[" ",u.ellipsis," ",c," above"]}):null,s.map(({at:l,item:i})=>{let a=l===n,y=t===!0?`${l+1}. `:"";return r(d,{wrap:"truncate",...a?{color:o.accent}:{},children:[a?u.pointer:" ",r(d,{bold:a,children:[y,i.label]}),i.hint===void 0?"":r(d,{dimColor:!0,...a?{color:o.muted}:{},children:[" ",i.hint]})]},`row-${l}`)}),x<e.length?r(d,{dimColor:!0,wrap:"truncate",children:[" ",u.ellipsis," ",e.length-x," below"]}):null]})}function W(e,n){if(e.count===0)return e;let t=e.count-1;switch(n.kind){case"up":return{...e,index:Math.max(0,e.index-1)};case"down":return{...e,index:Math.min(t,e.index+1)};case"first":return{...e,index:0};case"last":return{...e,index:t};case"jump":return n.index<0||n.index>t?e:{...e,index:n.index}}}
|
|
3
|
+
export{ae,W};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=2BA8171202239BF664756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-gz9x25tz.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * List-cursor state: an index and the moves that change it. Pure, like every reducer here.\n */\n\nexport interface SelectState {\n readonly index: number\n readonly count: number\n}\n\nexport type SelectMove =\n | { readonly kind: \"up\" }\n | { readonly kind: \"down\" }\n | { readonly kind: \"first\" }\n | { readonly kind: \"last\" }\n /** 0-based. A digit key jumps the cursor — visibly and reversibly; it never chooses. */\n | { readonly kind: \"jump\"; readonly index: number }\n\nexport function moveSelect(state: SelectState, move: SelectMove): SelectState {\n if (state.count === 0) return state\n const last = state.count - 1\n switch (move.kind) {\n case \"up\":\n return { ...state, index: Math.max(0, state.index - 1) }\n case \"down\":\n return { ...state, index: Math.min(last, state.index + 1) }\n case \"first\":\n return { ...state, index: 0 }\n case \"last\":\n return { ...state, index: last }\n case \"jump\":\n return move.index < 0 || move.index > last ? state : { ...state, index: move.index }\n }\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";uCAoBA,cAAS,UAAK,qDAmBP,SAAS,EAAU,EAAG,QAAO,QAAO,WAAU,WAA4B,CAC7E,IAAM,EAAS,IAAY,OAAY,EAAM,OAAS,KAAK,IAAI,EAAG,CAAO,GACjE,OAAM,MAAO,EAAS,EAAM,OAAQ,EAAO,CAAM,EAGnD,EAAU,EAAM,MAAM,EAAM,CAAE,EAAE,IAAI,CAAC,EAAM,KAAY,CAAE,GAAI,EAAO,EAAQ,MAAK,EAAE,EAEzF,OACI,EA0CE,EA1CF,CAAK,cAAc,SAAnB,SA0CE,CAzCG,EAAO,EACJ,EAGE,EAHF,CAAM,SAAQ,GAAC,KAAK,WAApB,SAGE,CAFG,KACA,EAAM,S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
|
|
2
|
-
import{u}from"./index-
|
|
3
|
-
`)}function
|
|
2
|
+
import{u}from"./index-d4x6yvqh.js";var a=" ",i=2;function l(t){let r=t.filter((n)=>n.value!=="");if(r.length===0)return"";let e=Math.max(...r.map((n)=>n.label.length));return r.map((n)=>{let o=`${a}${n.label.padEnd(e)}${" ".repeat(i)}${n.value}`;return n.note===void 0?o:`${o}${" ".repeat(i)}${n.note}`}).join(`
|
|
3
|
+
`)}function p(t,r=!1){return r?t:`
|
|
4
4
|
${t}`}function d(t){return`${a}${u.bullet}${t}`}function c(t,r=2){let e=" ".repeat(r);return t.split(`
|
|
5
5
|
`).map((n)=>n===""?n:`${e}${n}`).join(`
|
|
6
|
-
`)}function
|
|
7
|
-
export{l,
|
|
6
|
+
`)}function bt(t){if(!Number.isFinite(t)||t<0)return"unknown";if(t<1024)return`${Math.round(t)} B`;let r=["KB","MB","GB","TB"],e=t/1024,n=0;while(e>=1024&&n<r.length-1)e/=1024,n+=1;return`${e<10?e.toFixed(1):Math.round(e)} ${r[n]}`}function or(t){if(!Number.isFinite(t)||t<0)return"unknown";let r=Math.floor(t/1000);if(r<60)return`${r}s`;let e=Math.floor(r/60);if(e<60)return`${e}m ${r%60}s`;let n=Math.floor(e/60);if(n<24)return`${n}h ${e%60}m`;return`${Math.floor(n/24)}d ${n%24}h`}function vt(t,r){if(r===""||!t.startsWith(r))return t;let e=t.slice(r.length);return e===""?"~":e.startsWith("/")?`~${e}`:t}var f=60000,s=24;function qe(t,r){let e=r-Date.parse(t);if(Number.isNaN(e))return t;let n=Math.floor(e/f);if(n<1)return"just now";if(n<60)return`${n}m ago`;let o=Math.floor(n/60);if(o<s)return`${o}h ago`;return`${Math.floor(o/s)}d ago`}
|
|
7
|
+
export{l,p,d,c,bt,or,vt,qe};
|
|
8
8
|
|
|
9
|
-
//# debugId=
|
|
10
|
-
//# sourceMappingURL=index-
|
|
9
|
+
//# debugId=346FEC51D619EB9F64756E2164756E21
|
|
10
|
+
//# sourceMappingURL=index-j7gyr5nx.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * The plain path's shared vocabulary — the half of the house style that never had one.\n *\n * `theme.ts` serves the Ink path. The plain path is most of the binary, and until this file every\n * command that printed a labelled block invented its own: eight hand-rolled `padEnd` widths across\n * seven files (9, 14, `FLAG_COLUMN`, `ENV_COLUMN`, `COMMAND_COLUMN`, and three computed maxima),\n * with `agents.ts` emitting tab-separated columns while everything beside it emitted padded ones.\n * `agents` and `validate` genuinely looked like output from two different products.\n *\n * So this is not a new style — it is the existing one, written down once. A new surface that wants\n * a labelled block, a status word or a byte count reaches here rather than adding a ninth variant.\n *\n * **Pure.** No `node:*`, no `process`, no colour decision. Every function is text in, text out, so\n * it belongs on the boundaries test's `PURE` list and every rendering rule is unit-testable without\n * capturing stdout. Colour is deliberately *not* applied here: the plain path is read as often from\n * a log file as from a terminal, and a module that emitted escape codes would have to know which,\n * which is `resolveMode`'s job and nowhere near a formatter's.\n */\n\nimport { GLYPH } from \"#lib/theme\"\n\n/** Where a labelled block starts, and the space between the widest label and its value. */\nconst INDENT = \" \"\nconst GAP = 2\n\nexport interface Row {\n readonly label: string\n readonly value: string\n /**\n * Trailing text, aligned past the value.\n *\n * Its own field rather than something the caller concatenates, because the interesting rows\n * are the ones carrying a fact *and* its consequence — \"2463 · launchd has restarted this\n * 2463 times\" — and a caller building that by hand loses the alignment on the next row.\n */\n readonly note?: string\n}\n\n/**\n * A labelled block: two-space indent, labels padded to the widest, values aligned.\n *\n * Rows with an empty value are dropped rather than printed blank. A field that does not apply is\n * not the same as a field that is empty, and printing `logs` with nothing after it invites the\n * reader to wonder which one they are looking at.\n */\nexport function keyValue(rows: readonly Row[]): string {\n const shown = rows.filter((row) => row.value !== \"\")\n if (shown.length === 0) return \"\"\n const width = Math.max(...shown.map((row) => row.label.length))\n return shown\n .map((row) => {\n const head = `${INDENT}${row.label.padEnd(width)}${\" \".repeat(GAP)}${row.value}`\n return row.note === undefined ? head : `${head}${\" \".repeat(GAP)}${row.note}`\n })\n .join(\"\\n\")\n}\n\n/** A heading with its own blank line above, unless it opens the output. */\nexport function section(title: string, first = false): string {\n return first ? title : `\\n${title}`\n}\n\nexport function bullet(text: string): string {\n return `${INDENT}${GLYPH.bullet}${text}`\n}\n\n/** Indent a block that was rendered elsewhere — a log tail, a nested report. */\nexport function indent(text: string, depth = 2): string {\n const pad = \" \".repeat(depth)\n return text\n .split(\"\\n\")\n .map((line) => (line === \"\" ? line : `${pad}${line}`))\n .join(\"\\n\")\n}\n\n/**\n * Bytes as a person reads them.\n *\n * Binary units, and the decimal place only below 10 in each unit — `1.2 MB` is worth a digit,\n * `847 MB` is not, and the extra precision only makes a size harder to compare at a glance.\n */\nexport function bytes(count: number): string {\n if (!Number.isFinite(count) || count < 0) return \"unknown\"\n if (count < 1024) return `${Math.round(count)} B`\n const units = [\"KB\", \"MB\", \"GB\", \"TB\"]\n let value = count / 1024\n let unit = 0\n while (value >= 1024 && unit < units.length - 1) {\n value /= 1024\n unit += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unit]}`\n}\n\n/**\n * A span, in the largest two units that carry information.\n *\n * \"3h 12m\" rather than \"3.2 hours\" or \"11520 seconds\": an uptime is read to answer \"since roughly\n * when\", and two units is where that question stops getting better answers.\n */\nexport function duration(ms: number): string {\n if (!Number.isFinite(ms) || ms < 0) return \"unknown\"\n const seconds = Math.floor(ms / 1000)\n if (seconds < 60) return `${seconds}s`\n const minutes = Math.floor(seconds / 60)\n if (minutes < 60) return `${minutes}m ${seconds % 60}s`\n const hours = Math.floor(minutes / 60)\n if (hours < 24) return `${hours}h ${minutes % 60}m`\n return `${Math.floor(hours / 24)}d ${hours % 24}h`\n}\n\n/**\n * `~/…` for a path under home, so a block of paths stays readable at a glance.\n *\n * Takes `home` rather than reading it, because this module is pure — and because the daemon's\n * output has to be able to render a path under a *different* home than the current process's when\n * it is describing a service definition it did not write.\n */\nexport function tildify(path: string, home: string): string {\n if (home === \"\" || !path.startsWith(home)) return path\n const rest = path.slice(home.length)\n return rest === \"\" ? \"~\" : rest.startsWith(\"/\") ? `~${rest}` : path\n}\n\nconst MINUTE_MS = 60_000\nconst HOURS_PER_DAY = 24\n\n/**\n * How long ago, in the shortest honest form.\n *\n * `now` is a parameter rather than a `Date.now()` call, which is what lets this live in a pure module and\n * be shared. It was previously private to `sessions.ts` and read the clock itself, so the session picker\n * would have had to reimplement it — and two renderings of \"how old is this conversation\" that disagree\n * is the drift this module exists to end.\n *\n * An unparseable timestamp is returned as itself. A store row with a bad date is a real thing to see, and\n * \"NaNm ago\" says nothing about it.\n */\nexport function ago(iso: string, now: number): string {\n const ms = now - Date.parse(iso)\n if (Number.isNaN(ms)) return iso\n const mins = Math.floor(ms / MINUTE_MS)\n if (mins < 1) return \"just now\"\n if (mins < 60) return `${mins}m ago`\n const hours = Math.floor(mins / 60)\n if (hours < HOURS_PER_DAY) return `${hours}h ago`\n return `${Math.floor(hours / HOURS_PER_DAY)}d ago`\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";mCAsBA,IAAM,EAAS,KACT,EAAM,EAsBL,SAAS,CAAQ,CAAC,EAA8B,CACnD,IAAM,EAAQ,EAAK,OAAO,CAAC,IAAQ,EAAI,QAAU,EAAE,EACnD,GAAI,EAAM,SAAW,EAAG,MAAO,GAC/B,IAAM,EAAQ,KAAK,IAAI,GAAG,EAAM,IAAI,CAAC,IAAQ,EAAI,MAAM,MAAM,CAAC,EAC9D,OAAO,EACF,IAAI,CAAC,IAAQ,CACV,IAAM,EAAO,GAAG,IAAS,EAAI,MAAM,OAAO,CAAK,IAAI,IAAI,OAAO,CAAG,IAAI,EAAI,QACzE,OAAO,EAAI,OAAS,OAAY,EAAO,GAAG,IAAO,IAAI,OAAO,CAAG,IAAI,EAAI,OAC1E,EACA,KAAK;AAAA,CAAI,EAIX,SAAS,CAAO,CAAC,EAAe,EAAQ,GAAe,CAC1D,OAAO,EAAQ,EAAQ;AAAA,EAAK,IA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AM,EAAK,WAAW,GAAG,EAAI,IAAI,IAAS,EAGnE,IAAM,EAAY,MACZ,EAAgB,GAaf,SAAS,EAAG,CAAC,EAAa,EAAqB,CAClD,IAAM,EAAK,EAAM,KAAK,MAAM,CAAG,EAC/B,GAAI,OAAO,MAAM,CAAE,EAAG,OAAO,EAC7B,IAAM,EAAO,KAAK,MAAM,EAAK,CAAS,EACtC,GAAI,EAAO,EAAG,MAAO,WACrB,GAAI,EAAO,GAAI,MAAO,GAAG,SACzB,IAAM,EAAQ,KAAK,MAAM,EAAO,EAAE,EAClC,GAAI,EAAQ,EAAe,MAAO,GAAG,SACrC,MAAO,GAAG,KAAK,MAAM,EAAQ,CAAa",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "346FEC51D619EB9F64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{xe}from"./index-
|
|
3
|
-
`)}t.length=0}async function T(e){await y(),J(),process.exitCode=e,await ue()}async function
|
|
2
|
+
import{xe}from"./index-000rxxy3.js";import{Ho}from"./index-d4x6yvqh.js";import{Xo,_n,Qo,es,s,is}from"./index-2wmsmcbr.js";function p(){return{out:process.stdout,in:process.stdin}}var t=[],i=!1,a=!1,n=!1,d=!1,u=!1,l=!1,c=!1;function Wt(){n=!0}function me(){n=!0,d=!0}function Zr(){n=!0,u=!0}function f(){n=!0,l=!0}function b(e){t.push(e)}function Vr(){c=!0}function J(e=p()){if(a||!n)return;if(a=!0,e.in.isTTY===!0&&e.in.setRawMode!==void 0)e.in.setRawMode(!1);if(e.out.isTTY!==!0)return;if(e.out.write(`${_n}${Xo}`),u)e.out.write(Ho);if(l)e.out.write(es);if(d)e.out.write(Qo)}async function ue(e=process.stdout){if(e.writableEnded===!0||e.destroyed===!0)return;await new Promise((o)=>{e.write("",()=>o())})}async function y(){for(let e of[...t].reverse())try{await e()}catch(o){process.stderr.write(`warning: cleanup failed: ${o instanceof Error?o.message:String(o)}
|
|
3
|
+
`)}t.length=0}async function T(e){await y(),J(),process.exitCode=e,await ue()}async function Dn(e){await T(e),process.exit(e)}function Yr(){if(i)return;i=!0,process.on("exit",()=>J()),process.on("SIGTERM",()=>{if(c)return;Dn(is)});let e=(o)=>(r)=>{J();let m=r instanceof Error?r.stack??r.message:String(r);process.stderr.write(`
|
|
4
4
|
${o}: ${m}
|
|
5
|
-
`),
|
|
6
|
-
export{
|
|
5
|
+
`),Dn(s)};process.on("uncaughtException",e("uncaught exception")),process.on("unhandledRejection",e("unhandled rejection"))}function Z(e){if(e??xe().noEnhancedKeys)return{};return f(),{kittyKeyboard:{mode:"enabled",flags:["disambiguateEscapeCodes","reportEventTypes"]}}}function E(e){if(e.json)return{mode:"json",because:"--json was passed"};if(e.plain)return{mode:"plain",because:"--plain was passed"};if(e.oneShot)return{mode:"plain",because:"--input is always plain"};if(!e.stdoutIsTTY)return{mode:"plain",because:"stdout is not a terminal"};if(!e.stdinIsTTY)return{mode:"plain",because:"stdin is not a terminal"};if(e.env.noColor)return{mode:"plain",because:"NO_COLOR is set"};if(e.env.dumbTerminal)return{mode:"plain",because:"TERM is dumb"};if(e.env.ci)return{mode:"plain",because:"CI is set"};return{mode:"rich",because:"stdout and stdin are both terminals"}}function ie(e){return E({...e,stdinIsTTY:process.stdin.isTTY===!0,stdoutIsTTY:process.stdout.isTTY===!0,env:xe()})}
|
|
6
|
+
export{Wt,me,Zr,b,Vr,J,ue,Dn,Yr,Z,ie};
|
|
7
7
|
|
|
8
|
-
//# debugId=
|
|
9
|
-
//# sourceMappingURL=index-
|
|
8
|
+
//# debugId=565CE5564AE8627C64756E2164756E21
|
|
9
|
+
//# sourceMappingURL=index-nvm5hwe4.js.map
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"/**\n * How output is rendered, resolved once per process.\n *\n * This mirrors the reasoning behind decision 3.5, which forbids the tool dialect from changing with\n * the model: behaviour that shifts silently with the environment cannot be reasoned about. So the\n * resolution is total and ordered, and it returns *why* it chose — the reason is printable, which is\n * what turns \"it wasn't interactive and I don't know why\" into a question with an answer.\n *\n * Measured, not assumed: importing Ink and React costs ~65 ms under Bun and ~170-210 ms under Node,\n * against a ~70 ms total runtime for `validate --json`. Nothing on a non-rich path may import them,\n * which is why this returns a mode rather than a renderer.\n */\n\nimport { readEnv } from \"#lib/env\"\nimport type { ModeDecision, ModeInputs } from \"#lib/schema\"\n\n/**\n * Total and ordered. Every branch is reachable and every input is consulted, so no combination of\n * flags and environment lands somewhere undocumented.\n */\nexport function resolveMode(inputs: ModeInputs): ModeDecision {\n if (inputs.json) return { mode: \"json\", because: \"--json was passed\" }\n if (inputs.plain) return { mode: \"plain\", because: \"--plain was passed\" }\n\n // A one-shot is a scripting affordance. Its output must not depend on whether a human happened\n // to be at a terminal, or `--input` would mean two different things in a shell script and in a\n // shell.\n if (inputs.oneShot) return { mode: \"plain\", because: \"--input is always plain\" }\n\n if (!inputs.stdoutIsTTY) return { mode: \"plain\", because: \"stdout is not a terminal\" }\n // A live transcript with no way to type into it is a worse plain renderer, not a better one.\n if (!inputs.stdinIsTTY) return { mode: \"plain\", because: \"stdin is not a terminal\" }\n\n if (inputs.env.noColor) return { mode: \"plain\", because: \"NO_COLOR is set\" }\n if (inputs.env.dumbTerminal) return { mode: \"plain\", because: \"TERM is dumb\" }\n // CI logs are files that happen to scroll. Cursor movement in one is noise forever.\n if (inputs.env.ci) return { mode: \"plain\", because: \"CI is set\" }\n\n return { mode: \"rich\", because: \"stdout and stdin are both terminals\" }\n}\n\n/**\n * Deliberately not consulted: `FORCE_COLOR`. It says how much colour a stream can carry, not\n * whether a human is watching, and honouring it here would turn a CI job that wanted coloured logs\n * into one driving a cursor around a file. Ink's own colour depth still respects it.\n */\nexport function resolveModeFromProcess(flags: {\n readonly json: boolean\n readonly plain: boolean\n readonly oneShot: boolean\n}): ModeDecision {\n return resolveMode({\n ...flags,\n stdinIsTTY: process.stdin.isTTY === true,\n stdo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