gnosys 5.9.2 → 5.9.4
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/dist/cli.js +311 -147
- package/dist/cli.js.map +1 -1
- package/dist/lib/chat/index.d.ts.map +1 -1
- package/dist/lib/chat/index.js +5 -0
- package/dist/lib/chat/index.js.map +1 -1
- package/dist/lib/cleanup.d.ts +52 -0
- package/dist/lib/cleanup.d.ts.map +1 -0
- package/dist/lib/cleanup.js +168 -0
- package/dist/lib/cleanup.js.map +1 -0
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +41 -2
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/dream.d.ts.map +1 -1
- package/dist/lib/dream.js +13 -2
- package/dist/lib/dream.js.map +1 -1
- package/dist/lib/paths.d.ts +8 -0
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +15 -0
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/remote.d.ts +11 -0
- package/dist/lib/remote.d.ts.map +1 -1
- package/dist/lib/remote.js +26 -2
- package/dist/lib/remote.js.map +1 -1
- package/dist/lib/remoteWizard.d.ts.map +1 -1
- package/dist/lib/remoteWizard.js +112 -52
- package/dist/lib/remoteWizard.js.map +1 -1
- package/dist/lib/setup/coldStart.d.ts +71 -0
- package/dist/lib/setup/coldStart.d.ts.map +1 -0
- package/dist/lib/setup/coldStart.js +122 -0
- package/dist/lib/setup/coldStart.js.map +1 -0
- package/dist/lib/setup/configSetRender.d.ts +26 -0
- package/dist/lib/setup/configSetRender.d.ts.map +1 -0
- package/dist/lib/setup/configSetRender.js +103 -0
- package/dist/lib/setup/configSetRender.js.map +1 -0
- package/dist/lib/setup/dreamRender.d.ts +44 -0
- package/dist/lib/setup/dreamRender.d.ts.map +1 -0
- package/dist/lib/setup/dreamRender.js +55 -0
- package/dist/lib/setup/dreamRender.js.map +1 -0
- package/dist/lib/setup/dreamState.d.ts +50 -0
- package/dist/lib/setup/dreamState.d.ts.map +1 -0
- package/dist/lib/setup/dreamState.js +68 -0
- package/dist/lib/setup/dreamState.js.map +1 -0
- package/dist/lib/setup/modelsRender.d.ts +25 -0
- package/dist/lib/setup/modelsRender.d.ts.map +1 -0
- package/dist/lib/setup/modelsRender.js +33 -0
- package/dist/lib/setup/modelsRender.js.map +1 -0
- package/dist/lib/setup/remoteRender.d.ts +43 -0
- package/dist/lib/setup/remoteRender.d.ts.map +1 -0
- package/dist/lib/setup/remoteRender.js +65 -0
- package/dist/lib/setup/remoteRender.js.map +1 -0
- package/dist/lib/setup/routingRender.d.ts +48 -0
- package/dist/lib/setup/routingRender.d.ts.map +1 -0
- package/dist/lib/setup/routingRender.js +114 -0
- package/dist/lib/setup/routingRender.js.map +1 -0
- package/dist/lib/setup/sections/ides.d.ts +8 -0
- package/dist/lib/setup/sections/ides.d.ts.map +1 -1
- package/dist/lib/setup/sections/ides.js +88 -33
- package/dist/lib/setup/sections/ides.js.map +1 -1
- package/dist/lib/setup/sections/preferences.d.ts +8 -0
- package/dist/lib/setup/sections/preferences.d.ts.map +1 -1
- package/dist/lib/setup/sections/preferences.js +54 -20
- package/dist/lib/setup/sections/preferences.js.map +1 -1
- package/dist/lib/setup/sections/routing.d.ts +0 -1
- package/dist/lib/setup/sections/routing.d.ts.map +1 -1
- package/dist/lib/setup/sections/routing.js +80 -38
- package/dist/lib/setup/sections/routing.js.map +1 -1
- package/dist/lib/setup/storePath.d.ts +30 -0
- package/dist/lib/setup/storePath.d.ts.map +1 -0
- package/dist/lib/setup/storePath.js +47 -0
- package/dist/lib/setup/storePath.js.map +1 -0
- package/dist/lib/setup/summary.d.ts +33 -19
- package/dist/lib/setup/summary.d.ts.map +1 -1
- package/dist/lib/setup/summary.js +148 -113
- package/dist/lib/setup/summary.js.map +1 -1
- package/dist/lib/setup/syncProjectsRender.d.ts +57 -0
- package/dist/lib/setup/syncProjectsRender.d.ts.map +1 -0
- package/dist/lib/setup/syncProjectsRender.js +184 -0
- package/dist/lib/setup/syncProjectsRender.js.map +1 -0
- package/dist/lib/setup/ui/diff.d.ts +19 -0
- package/dist/lib/setup/ui/diff.d.ts.map +1 -0
- package/dist/lib/setup/ui/diff.js +34 -0
- package/dist/lib/setup/ui/diff.js.map +1 -0
- package/dist/lib/setup/ui/footer.d.ts +11 -0
- package/dist/lib/setup/ui/footer.d.ts.map +1 -0
- package/dist/lib/setup/ui/footer.js +21 -0
- package/dist/lib/setup/ui/footer.js.map +1 -0
- package/dist/lib/setup/ui/header.d.ts +24 -0
- package/dist/lib/setup/ui/header.d.ts.map +1 -0
- package/dist/lib/setup/ui/header.js +49 -0
- package/dist/lib/setup/ui/header.js.map +1 -0
- package/dist/lib/setup/ui/index.d.ts +28 -0
- package/dist/lib/setup/ui/index.d.ts.map +1 -0
- package/dist/lib/setup/ui/index.js +19 -0
- package/dist/lib/setup/ui/index.js.map +1 -0
- package/dist/lib/setup/ui/menu.d.ts +27 -0
- package/dist/lib/setup/ui/menu.d.ts.map +1 -0
- package/dist/lib/setup/ui/menu.js +75 -0
- package/dist/lib/setup/ui/menu.js.map +1 -0
- package/dist/lib/setup/ui/panel.d.ts +23 -0
- package/dist/lib/setup/ui/panel.d.ts.map +1 -0
- package/dist/lib/setup/ui/panel.js +60 -0
- package/dist/lib/setup/ui/panel.js.map +1 -0
- package/dist/lib/setup/ui/prompt.d.ts +27 -0
- package/dist/lib/setup/ui/prompt.d.ts.map +1 -0
- package/dist/lib/setup/ui/prompt.js +38 -0
- package/dist/lib/setup/ui/prompt.js.map +1 -0
- package/dist/lib/setup/ui/safePrompt.d.ts +24 -0
- package/dist/lib/setup/ui/safePrompt.d.ts.map +1 -0
- package/dist/lib/setup/ui/safePrompt.js +71 -0
- package/dist/lib/setup/ui/safePrompt.js.map +1 -0
- package/dist/lib/setup/ui/spinner.d.ts +28 -0
- package/dist/lib/setup/ui/spinner.d.ts.map +1 -0
- package/dist/lib/setup/ui/spinner.js +87 -0
- package/dist/lib/setup/ui/spinner.js.map +1 -0
- package/dist/lib/setup/ui/status.d.ts +21 -0
- package/dist/lib/setup/ui/status.d.ts.map +1 -0
- package/dist/lib/setup/ui/status.js +49 -0
- package/dist/lib/setup/ui/status.js.map +1 -0
- package/dist/lib/setup/ui/table.d.ts +37 -0
- package/dist/lib/setup/ui/table.d.ts.map +1 -0
- package/dist/lib/setup/ui/table.js +82 -0
- package/dist/lib/setup/ui/table.js.map +1 -0
- package/dist/lib/setup/ui/title.d.ts +14 -0
- package/dist/lib/setup/ui/title.d.ts.map +1 -0
- package/dist/lib/setup/ui/title.js +24 -0
- package/dist/lib/setup/ui/title.js.map +1 -0
- package/dist/lib/setup/ui/tokens.d.ts +66 -0
- package/dist/lib/setup/ui/tokens.d.ts.map +1 -0
- package/dist/lib/setup/ui/tokens.js +87 -0
- package/dist/lib/setup/ui/tokens.js.map +1 -0
- package/dist/lib/setup.d.ts +38 -0
- package/dist/lib/setup.d.ts.map +1 -1
- package/dist/lib/setup.js +440 -308
- package/dist/lib/setup.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Panel atom — rounded `╭─╮ │ ╰─╯` box in `accent-dim`.
|
|
3
|
+
*
|
|
4
|
+
* Used ONLY for summary views (settings overview, completion screen).
|
|
5
|
+
* Flow screens use Header + Title + content + Prompt — no box. The
|
|
6
|
+
* design handoff is strict about this.
|
|
7
|
+
*/
|
|
8
|
+
import { c, color, glyph, width } from "./tokens.js";
|
|
9
|
+
import { stripAnsi } from "./header.js";
|
|
10
|
+
/**
|
|
11
|
+
* Render a panel. Each row is a string (already formatted/colored). The
|
|
12
|
+
* panel wraps each row in `│ … │` with `accent-dim` border. The title
|
|
13
|
+
* sits in the top border: `╭─ title ────╮`.
|
|
14
|
+
*
|
|
15
|
+
* Width is fixed to the lesser of W or 68 cols of inner content (matches
|
|
16
|
+
* the spec mockup) so summary panels never spill on wider terminals.
|
|
17
|
+
*/
|
|
18
|
+
export function Panel(title, rows, opts = {}) {
|
|
19
|
+
const W = width();
|
|
20
|
+
const indent = " ";
|
|
21
|
+
// Inner content width: target 66 chars inner (between `│ ` and ` │`),
|
|
22
|
+
// clamp by terminal width.
|
|
23
|
+
const innerW = Math.min(66, Math.max(40, W - 4));
|
|
24
|
+
const border = c.accentDim;
|
|
25
|
+
// Top border: `╭─ title ──────╮` — must match the bottom border's total
|
|
26
|
+
// visible width of `innerW + 4` (corners + innerW+2 rule chars). The
|
|
27
|
+
// title segment `╭─ <title> ` already costs 4 + title chars, leaving
|
|
28
|
+
// `innerW - 1 - title` rule chars before the closing `╮` corner.
|
|
29
|
+
//
|
|
30
|
+
// v5.9.4 Bug 1 — pre-strip ANSI from the caller-supplied title so
|
|
31
|
+
// bolded / coloured titles still measure correctly; clamp `topPadLen`
|
|
32
|
+
// with `Math.max(1, ...)` so narrow widths never collapse the rule.
|
|
33
|
+
const titleStyled = color(c.textHi, title);
|
|
34
|
+
const titleBareLen = stripAnsi(title).length;
|
|
35
|
+
const topHead = `${color(border, `${glyph.boxTL}${glyph.boxH} `)}${titleStyled} `;
|
|
36
|
+
const topPadLen = Math.max(1, innerW - 1 - titleBareLen);
|
|
37
|
+
const top = `${indent}${topHead}${color(border, `${glyph.boxH.repeat(topPadLen)}${glyph.boxTR}`)}`;
|
|
38
|
+
// Each row: `│ <content> │` — pad content to innerW.
|
|
39
|
+
const left = color(border, `${glyph.boxV} `);
|
|
40
|
+
const right = color(border, ` ${glyph.boxV}`);
|
|
41
|
+
const middle = [];
|
|
42
|
+
rows.forEach((rowStyled, idx) => {
|
|
43
|
+
const bare = stripAnsi(rowStyled);
|
|
44
|
+
const trail = opts.trailing?.[idx] ?? "";
|
|
45
|
+
const trailBare = stripAnsi(trail);
|
|
46
|
+
// Reserve room for the optional trailing glyph (e.g. ✓), right-aligned.
|
|
47
|
+
const usable = innerW - bare.length - (trailBare ? trailBare.length + 1 : 0);
|
|
48
|
+
const padContent = " ".repeat(Math.max(0, usable));
|
|
49
|
+
const trailingPart = trail ? ` ${trail}` : "";
|
|
50
|
+
middle.push(`${indent}${left}${rowStyled}${padContent}${trailingPart}${right}`);
|
|
51
|
+
});
|
|
52
|
+
// Bottom border: `╰──────────────╯`
|
|
53
|
+
const bottom = `${indent}${color(border, `${glyph.boxBL}${glyph.boxH.repeat(innerW + 2)}${glyph.boxBR}`)}`;
|
|
54
|
+
return [top, ...middle, bottom].join("\n");
|
|
55
|
+
}
|
|
56
|
+
/** Convenience: print panel + trailing blank line. */
|
|
57
|
+
export function printPanel(title, rows, opts = {}) {
|
|
58
|
+
process.stdout.write(`${Panel(title, rows, opts)}\n\n`);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/panel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,IAAc,EAAE,OAAqB,EAAE;IAC1E,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC;IAClB,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,wEAAwE;IACxE,2BAA2B;IAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC;IAE3B,wEAAwE;IACxE,qEAAqE;IACrE,qEAAqE;IACrE,iEAAiE;IACjE,EAAE;IACF,kEAAkE;IAClE,sEAAsE;IACtE,oEAAoE;IACpE,MAAM,WAAW,GAAG,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AAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QACnD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,KAAK,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,oCAAoC;IACpC,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC;IAE3G,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,IAAc,EAAE,OAAqB,EAAE;IAC/E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt atom — single helper that wraps every readline question call.
|
|
3
|
+
*
|
|
4
|
+
* Catches `AbortError` from readline's signal/SIGINT path, prints a clean
|
|
5
|
+
* cancellation message in `text-dim`, closes the readline, and exits with
|
|
6
|
+
* code 130 (standard SIGINT exit). This is the *only* place SIGINT cleanup
|
|
7
|
+
* should live — every other site routes through here.
|
|
8
|
+
*/
|
|
9
|
+
import type { Interface as ReadlineInterface } from "readline/promises";
|
|
10
|
+
export interface PromptOptions {
|
|
11
|
+
/** Right-aligned dim hint (`1–8 · pick q · quit`). */
|
|
12
|
+
hint?: string;
|
|
13
|
+
/** Lead-in text shown after the prompt glyph (`press enter to begin`). */
|
|
14
|
+
lead?: string;
|
|
15
|
+
/** What to print on cancel. Default: `cancelled · no changes written`. */
|
|
16
|
+
cancelMessage?: string;
|
|
17
|
+
/** Skip the actual `process.exit(130)`. Used by some integration tests. */
|
|
18
|
+
skipExitOnCancel?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Render the prompt line and await user input. On `AbortError`, prints the
|
|
22
|
+
* cancellation message and exits 130 (unless `skipExitOnCancel`).
|
|
23
|
+
*
|
|
24
|
+
* @returns The user's input, trimmed. Returns the empty string on Enter.
|
|
25
|
+
*/
|
|
26
|
+
export declare function Prompt(rl: ReadlineInterface, opts?: PromptOptions): Promise<string>;
|
|
27
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKxE,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAC1B,EAAE,EAAE,iBAAiB,EACrB,IAAI,GAAE,aAAkB,GACvB,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt atom — single helper that wraps every readline question call.
|
|
3
|
+
*
|
|
4
|
+
* Catches `AbortError` from readline's signal/SIGINT path, prints a clean
|
|
5
|
+
* cancellation message in `text-dim`, closes the readline, and exits with
|
|
6
|
+
* code 130 (standard SIGINT exit). This is the *only* place SIGINT cleanup
|
|
7
|
+
* should live — every other site routes through here.
|
|
8
|
+
*/
|
|
9
|
+
import { c, color, glyph, width } from "./tokens.js";
|
|
10
|
+
import { stripAnsi } from "./header.js";
|
|
11
|
+
import { safeQuestion } from "./safePrompt.js";
|
|
12
|
+
/**
|
|
13
|
+
* Render the prompt line and await user input. On `AbortError`, prints the
|
|
14
|
+
* cancellation message and exits 130 (unless `skipExitOnCancel`).
|
|
15
|
+
*
|
|
16
|
+
* @returns The user's input, trimmed. Returns the empty string on Enter.
|
|
17
|
+
*/
|
|
18
|
+
export async function Prompt(rl, opts = {}) {
|
|
19
|
+
const W = width();
|
|
20
|
+
const indent = " ";
|
|
21
|
+
const glyphPart = color(c.accent, glyph.prompt);
|
|
22
|
+
const lead = opts.lead ? ` ${color(c.text, opts.lead)}` : "";
|
|
23
|
+
const head = `${indent}${glyphPart}${lead} `;
|
|
24
|
+
// If a hint is present, print it right-aligned ABOVE the prompt line.
|
|
25
|
+
// This matches the design's "hint on the line above the cursor".
|
|
26
|
+
if (opts.hint) {
|
|
27
|
+
const hint = color(c.textDim, opts.hint);
|
|
28
|
+
const hintBare = stripAnsi(hint);
|
|
29
|
+
const pad = " ".repeat(Math.max(1, W - 1 - hintBare.length));
|
|
30
|
+
process.stdout.write(`${pad}${hint}\n`);
|
|
31
|
+
}
|
|
32
|
+
const raw = await safeQuestion(rl, head, {
|
|
33
|
+
cancelMessage: opts.cancelMessage,
|
|
34
|
+
skipExitOnCancel: opts.skipExitOnCancel,
|
|
35
|
+
});
|
|
36
|
+
return raw.trim();
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/lib/setup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E,IAAI,EAAE;QACvC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;KACxC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* safeQuestion — a thin migration shim that gives every existing
|
|
3
|
+
* `rl.question(...)` call site clean Ctrl+C handling without forcing
|
|
4
|
+
* a rewrite to the full Prompt() atom.
|
|
5
|
+
*
|
|
6
|
+
* Behavior:
|
|
7
|
+
* - On normal input, returns the raw string (caller decides about trim).
|
|
8
|
+
* - On SIGINT (Ctrl+C), prints `cancelled · no changes written` in
|
|
9
|
+
* `text-dim`, closes the readline, exits 130.
|
|
10
|
+
*
|
|
11
|
+
* The SIGINT handler is installed lazily on the first call and remembered
|
|
12
|
+
* via a module-level flag so the same readline can be questioned many
|
|
13
|
+
* times without leaking listeners.
|
|
14
|
+
*
|
|
15
|
+
* v5.9.3 Phase B uses this everywhere the old helpers wrap `rl.question`.
|
|
16
|
+
* New screens compose Prompt() from `index.js` instead.
|
|
17
|
+
*/
|
|
18
|
+
import type { Interface as ReadlineInterface } from "readline/promises";
|
|
19
|
+
export interface SafeQuestionOptions {
|
|
20
|
+
cancelMessage?: string;
|
|
21
|
+
skipExitOnCancel?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function safeQuestion(rl: ReadlineInterface, prompt: string, opts?: SafeQuestionOptions): Promise<string>;
|
|
24
|
+
//# sourceMappingURL=safePrompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safePrompt.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/safePrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGxE,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAkCD,wBAAsB,YAAY,CAChC,EAAE,EAAE,iBAAiB,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* safeQuestion — a thin migration shim that gives every existing
|
|
3
|
+
* `rl.question(...)` call site clean Ctrl+C handling without forcing
|
|
4
|
+
* a rewrite to the full Prompt() atom.
|
|
5
|
+
*
|
|
6
|
+
* Behavior:
|
|
7
|
+
* - On normal input, returns the raw string (caller decides about trim).
|
|
8
|
+
* - On SIGINT (Ctrl+C), prints `cancelled · no changes written` in
|
|
9
|
+
* `text-dim`, closes the readline, exits 130.
|
|
10
|
+
*
|
|
11
|
+
* The SIGINT handler is installed lazily on the first call and remembered
|
|
12
|
+
* via a module-level flag so the same readline can be questioned many
|
|
13
|
+
* times without leaking listeners.
|
|
14
|
+
*
|
|
15
|
+
* v5.9.3 Phase B uses this everywhere the old helpers wrap `rl.question`.
|
|
16
|
+
* New screens compose Prompt() from `index.js` instead.
|
|
17
|
+
*/
|
|
18
|
+
import { c, color } from "./tokens.js";
|
|
19
|
+
/**
|
|
20
|
+
* Track which readline interfaces we've already wired SIGINT cleanup
|
|
21
|
+
* to. We use a WeakSet so a closed/GC'd interface drops out automatically.
|
|
22
|
+
*/
|
|
23
|
+
const sigintWired = new WeakSet();
|
|
24
|
+
function wireSigint(rl, cancelMessage, skipExit) {
|
|
25
|
+
if (sigintWired.has(rl))
|
|
26
|
+
return;
|
|
27
|
+
sigintWired.add(rl);
|
|
28
|
+
const handler = () => {
|
|
29
|
+
process.stdout.write(`\n ${color(c.textDim, cancelMessage)}\n`);
|
|
30
|
+
try {
|
|
31
|
+
rl.close();
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// already closed — fine
|
|
35
|
+
}
|
|
36
|
+
if (!skipExit) {
|
|
37
|
+
process.exit(130);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
// `rl.on('SIGINT', …)` fires when the user hits Ctrl+C with readline
|
|
41
|
+
// listening — Node's readline already emits SIGINT before bubbling to
|
|
42
|
+
// process. This is the load-bearing wire.
|
|
43
|
+
rl.on("SIGINT", handler);
|
|
44
|
+
}
|
|
45
|
+
export async function safeQuestion(rl, prompt, opts = {}) {
|
|
46
|
+
const message = opts.cancelMessage ?? "cancelled · no changes written";
|
|
47
|
+
wireSigint(rl, message, opts.skipExitOnCancel ?? false);
|
|
48
|
+
try {
|
|
49
|
+
return await rl.question(prompt);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
// Defensive: still catch AbortError for callers that pass their own
|
|
53
|
+
// AbortSignal through (e.g. test harness).
|
|
54
|
+
const isAbort = err instanceof Error &&
|
|
55
|
+
(err.name === "AbortError" || /aborted|signal/i.test(err.message ?? ""));
|
|
56
|
+
if (!isAbort)
|
|
57
|
+
throw err;
|
|
58
|
+
process.stdout.write(`\n ${color(c.textDim, message)}\n`);
|
|
59
|
+
try {
|
|
60
|
+
rl.close();
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Already closed — fine.
|
|
64
|
+
}
|
|
65
|
+
if (!opts.skipExitOnCancel) {
|
|
66
|
+
process.exit(130);
|
|
67
|
+
}
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=safePrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safePrompt.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/safePrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOvC;;;GAGG;AACH,MAAM,WAAW,GAAG,IAAI,O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AAC,OAAO;YAAE,MAAM,GAAG,CAAC;QAExB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1D,IAAI,CAAC;YACH,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;QAAC,MAAM,CAAC;YACP,yBAAyB;QAC3B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner atom — animated `◌ ◐ ◑ ◒ ◓` for any operation > 200 ms.
|
|
3
|
+
*
|
|
4
|
+
* Same line is rewritten in place via `\r` (carriage return). On `ok` /
|
|
5
|
+
* `fail` / `update`, the spinner stops cleanly and replaces the line with
|
|
6
|
+
* a final Status-style line. No newlines are emitted until resolution.
|
|
7
|
+
*/
|
|
8
|
+
export interface SpinnerHandle {
|
|
9
|
+
/** Replace the spinner with a `✓ text · meta` line and stop. */
|
|
10
|
+
ok(text: string, meta?: string): void;
|
|
11
|
+
/** Replace the spinner with a `✗ text · meta` line and stop. */
|
|
12
|
+
fail(text: string, meta?: string): void;
|
|
13
|
+
/** Update the in-progress label (spinner keeps animating). */
|
|
14
|
+
update(label: string): void;
|
|
15
|
+
/** Stop without printing a final line (for callers that handle output). */
|
|
16
|
+
stop(): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Start an animated spinner. Returns a handle. The spinner immediately
|
|
20
|
+
* writes its first frame. Caller MUST eventually call one of `ok`/`fail`/
|
|
21
|
+
* `stop` to release the line.
|
|
22
|
+
*
|
|
23
|
+
* When stdout isn't a TTY (CI, test capture), the spinner falls back to a
|
|
24
|
+
* single static `◌ label` line and the `ok/fail` calls print final lines
|
|
25
|
+
* directly — no `\r` redraw.
|
|
26
|
+
*/
|
|
27
|
+
export declare function Spinner(label: string): SpinnerHandle;
|
|
28
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,gEAAgE;IAChE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,8DAA8D;IAC9D,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,2EAA2E;IAC3E,IAAI,IAAI,IAAI,CAAC;CACd;AAKD;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAgEpD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner atom — animated `◌ ◐ ◑ ◒ ◓` for any operation > 200 ms.
|
|
3
|
+
*
|
|
4
|
+
* Same line is rewritten in place via `\r` (carriage return). On `ok` /
|
|
5
|
+
* `fail` / `update`, the spinner stops cleanly and replaces the line with
|
|
6
|
+
* a final Status-style line. No newlines are emitted until resolution.
|
|
7
|
+
*/
|
|
8
|
+
import { c, color, glyph } from "./tokens.js";
|
|
9
|
+
import { Status } from "./status.js";
|
|
10
|
+
const FRAMES = [glyph.spin0, glyph.spin1, glyph.spin2, glyph.spin3, glyph.spin4];
|
|
11
|
+
const FRAME_MS = 125; // ~8 fps
|
|
12
|
+
/**
|
|
13
|
+
* Start an animated spinner. Returns a handle. The spinner immediately
|
|
14
|
+
* writes its first frame. Caller MUST eventually call one of `ok`/`fail`/
|
|
15
|
+
* `stop` to release the line.
|
|
16
|
+
*
|
|
17
|
+
* When stdout isn't a TTY (CI, test capture), the spinner falls back to a
|
|
18
|
+
* single static `◌ label` line and the `ok/fail` calls print final lines
|
|
19
|
+
* directly — no `\r` redraw.
|
|
20
|
+
*/
|
|
21
|
+
export function Spinner(label) {
|
|
22
|
+
let currentLabel = label;
|
|
23
|
+
const isTTY = process.stdout.isTTY;
|
|
24
|
+
let frame = 0;
|
|
25
|
+
let timer = null;
|
|
26
|
+
let stopped = false;
|
|
27
|
+
function draw() {
|
|
28
|
+
if (stopped)
|
|
29
|
+
return;
|
|
30
|
+
if (!isTTY) {
|
|
31
|
+
// Non-TTY: print one static line only, do NOT animate.
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const g = color(c.accent, FRAMES[frame % FRAMES.length]);
|
|
35
|
+
const txt = color(c.text, currentLabel);
|
|
36
|
+
process.stdout.write(`\r ${g} ${txt}`);
|
|
37
|
+
}
|
|
38
|
+
function clearLine() {
|
|
39
|
+
if (isTTY) {
|
|
40
|
+
// Move to start of line, clear to end.
|
|
41
|
+
process.stdout.write("\r\x1b[2K");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function final(kind, text, meta) {
|
|
45
|
+
if (stopped)
|
|
46
|
+
return;
|
|
47
|
+
stopped = true;
|
|
48
|
+
if (timer)
|
|
49
|
+
clearInterval(timer);
|
|
50
|
+
clearLine();
|
|
51
|
+
process.stdout.write(`${Status(kind, text, meta)}\n`);
|
|
52
|
+
}
|
|
53
|
+
// First frame (or static line for non-TTY).
|
|
54
|
+
if (isTTY) {
|
|
55
|
+
draw();
|
|
56
|
+
timer = setInterval(() => {
|
|
57
|
+
frame = (frame + 1) % FRAMES.length;
|
|
58
|
+
draw();
|
|
59
|
+
}, FRAME_MS);
|
|
60
|
+
// Unref so the timer never blocks process exit on its own.
|
|
61
|
+
timer.unref?.();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
process.stdout.write(`${Status("progress", currentLabel)}\n`);
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
ok(text, meta) {
|
|
68
|
+
final("ok", text, meta);
|
|
69
|
+
},
|
|
70
|
+
fail(text, meta) {
|
|
71
|
+
final("fail", text, meta);
|
|
72
|
+
},
|
|
73
|
+
update(nextLabel) {
|
|
74
|
+
currentLabel = nextLabel;
|
|
75
|
+
draw();
|
|
76
|
+
},
|
|
77
|
+
stop() {
|
|
78
|
+
if (stopped)
|
|
79
|
+
return;
|
|
80
|
+
stopped = true;
|
|
81
|
+
if (timer)
|
|
82
|
+
clearInterval(timer);
|
|
83
|
+
clearLine();
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAmB,MAAM,aAAa,CAAC;AAatD,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AACjF,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,SAAS;AAE/B;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IACnC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAA0B,IAAI,CAAC;IACxC,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,SAAS,IAAI;QACX,IA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AC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;QACL,EAAE,CAAC,IAAY,EAAE,IAAa;YAC5B,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC,IAAY,EAAE,IAAa;YAC9B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM,CAAC,SAAiB;YACtB,YAAY,GAAG,SAAS,CAAC;YACzB,IAAI,EAAE,CAAC;QACT,CAAC;QACD,IAAI;YACF,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,IAAI,KAAK;gBAAE,aAAa,CAAC,KAAK,CAAC,CAAC;YAChC,SAAS,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status atom — one-liner with leading glyph + optional right-aligned meta.
|
|
3
|
+
*
|
|
4
|
+
* Kinds:
|
|
5
|
+
* ok ✓ in ok color
|
|
6
|
+
* warn ⚠ in warn color
|
|
7
|
+
* fail ✗ in fail color
|
|
8
|
+
* progress ◌ in accent color (use Spinner for animated variants)
|
|
9
|
+
*/
|
|
10
|
+
export type StatusKind = "ok" | "warn" | "fail" | "progress";
|
|
11
|
+
/**
|
|
12
|
+
* Render a status line. Returns the formatted string (no trailing newline).
|
|
13
|
+
*
|
|
14
|
+
* @param kind ok | warn | fail | progress
|
|
15
|
+
* @param text Body, in `text`.
|
|
16
|
+
* @param meta Optional right-aligned, in `text-dim`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Status(kind: StatusKind, text: string, meta?: string): string;
|
|
19
|
+
/** Convenience: print a single status line. */
|
|
20
|
+
export declare function printStatus(kind: StatusKind, text: string, meta?: string): void;
|
|
21
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAgB7D;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAY5E;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAE/E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status atom — one-liner with leading glyph + optional right-aligned meta.
|
|
3
|
+
*
|
|
4
|
+
* Kinds:
|
|
5
|
+
* ok ✓ in ok color
|
|
6
|
+
* warn ⚠ in warn color
|
|
7
|
+
* fail ✗ in fail color
|
|
8
|
+
* progress ◌ in accent color (use Spinner for animated variants)
|
|
9
|
+
*/
|
|
10
|
+
import { c, color, glyph, width } from "./tokens.js";
|
|
11
|
+
import { stripAnsi } from "./header.js";
|
|
12
|
+
const KIND_TO_GLYPH = {
|
|
13
|
+
ok: glyph.ok,
|
|
14
|
+
warn: glyph.warn,
|
|
15
|
+
fail: glyph.fail,
|
|
16
|
+
progress: glyph.spin0,
|
|
17
|
+
};
|
|
18
|
+
const KIND_TO_COLOR = {
|
|
19
|
+
ok: c.ok,
|
|
20
|
+
warn: c.warn,
|
|
21
|
+
fail: c.fail,
|
|
22
|
+
progress: c.accent,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Render a status line. Returns the formatted string (no trailing newline).
|
|
26
|
+
*
|
|
27
|
+
* @param kind ok | warn | fail | progress
|
|
28
|
+
* @param text Body, in `text`.
|
|
29
|
+
* @param meta Optional right-aligned, in `text-dim`.
|
|
30
|
+
*/
|
|
31
|
+
export function Status(kind, text, meta) {
|
|
32
|
+
const W = width();
|
|
33
|
+
const indent = " ";
|
|
34
|
+
const g = color(KIND_TO_COLOR[kind], KIND_TO_GLYPH[kind]);
|
|
35
|
+
const body = color(c.text, text);
|
|
36
|
+
const left = `${indent}${g} ${body}`;
|
|
37
|
+
if (!meta)
|
|
38
|
+
return left;
|
|
39
|
+
const metaTxt = color(c.textDim, meta);
|
|
40
|
+
const leftBare = stripAnsi(left);
|
|
41
|
+
const metaBare = stripAnsi(metaTxt);
|
|
42
|
+
const pad = " ".repeat(Math.max(1, W - 1 - leftBare.length - metaBare.length));
|
|
43
|
+
return `${left}${pad}${metaTxt}`;
|
|
44
|
+
}
|
|
45
|
+
/** Convenience: print a single status line. */
|
|
46
|
+
export function printStatus(kind, text, meta) {
|
|
47
|
+
process.stdout.write(`${Status(kind, text, meta)}\n`);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,aAAa,GAA+B;IAChD,EAAE,EAAE,KAAK,CAAC,EAAE;IACZ,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,QAAQ,EAAE,KAAK,CAAC,KAAK;CACtB,CAAC;AAEF,MAAM,aAAa,GAA+B;IAChD,EAAE,EAAE,CAAC,CAAC,EAAE;IACR,IAAI,EAAE,CAAC,CAAC,IAAI;IACZ,IAAI,EAAE,CAAC,CAAC,IAAI;IACZ,QAAQ,EAAE,CAAC,CAAC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
+
/** Optional fixed column width; otherwise auto-fits to widest cell + header. */
|
|
5
|
+
width?: number;
|
|
6
|
+
/** Cell alignment within its column. Default `left`. */
|
|
7
|
+
align?: "left" | "right";
|
|
8
|
+
/** Cell value extractor. Returns the RAW string — color is applied below. */
|
|
9
|
+
render: (row: T) => string;
|
|
10
|
+
/** Optional ANSI token for this column's cell values. Defaults to `c.text`. */
|
|
11
|
+
color?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TableOptions<T> {
|
|
14
|
+
/** Include the header row + divider. Default true. */
|
|
15
|
+
showHeader?: boolean;
|
|
16
|
+
/** Draw the thin `─` rule under the header. Default true. */
|
|
17
|
+
dividerAfterHeader?: boolean;
|
|
18
|
+
/** Spaces before each line. Default 1 (col 2 baseline per design). */
|
|
19
|
+
indent?: number;
|
|
20
|
+
/** Spaces between columns. Default 2. */
|
|
21
|
+
gap?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Optional row-level decorator. Receives the raw row and the fully built
|
|
24
|
+
* line; returns the final line. Lets callers prepend per-row markers
|
|
25
|
+
* (`▶ ` for changed rows, `✓ ` for completed) without bypassing the atom.
|
|
26
|
+
*/
|
|
27
|
+
rowFormatter?: (row: T, line: string) => string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Render a table. Returns one string per line (header + divider + rows),
|
|
31
|
+
* never trailing newline. Returns `[]` for an empty `rows` array unless
|
|
32
|
+
* `showHeader` is true (in which case header + divider are still emitted).
|
|
33
|
+
*/
|
|
34
|
+
export declare function renderTable<T>(rows: T[], columns: TableColumn<T>[], opts?: TableOptions<T>): string[];
|
|
35
|
+
/** Convenience: render + print + trailing newline. */
|
|
36
|
+
export declare function printTable<T>(rows: T[], columns: TableColumn<T>[], opts?: TableOptions<T>): void;
|
|
37
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/table.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,6EAA6E;IAC7E,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACjD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,IAAI,EAAE,CAAC,EAAE,EACT,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EACzB,IAAI,GAAE,YAAY,CAAC,CAAC,CAAM,GACzB,MAAM,EAAE,CAoDV;AAED,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,CAAC,EAC1B,IAAI,EAAE,CAAC,EAAE,EACT,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EACzB,IAAI,GAAE,YAAY,CAAC,CAAC,CAAM,GACzB,IAAI,CAGN"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table atom — generic tabular layout for the v5.9.4 CLI vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* Per `arch-004`: every tabular CLI screen reaches for `Table` first instead
|
|
5
|
+
* of hand-rolling `padEnd` columns. Header row + thin divider + auto-fit
|
|
6
|
+
* or fixed-width columns + optional per-row marker formatter (e.g. `▶` for
|
|
7
|
+
* changed routing rows).
|
|
8
|
+
*
|
|
9
|
+
* The renderer measures printable width with ANSI stripped so coloured
|
|
10
|
+
* cell contents don't break alignment. Cell `render(row)` returns the
|
|
11
|
+
* RAW string; `color` is applied per-column for the cell value (header
|
|
12
|
+
* is always `text-dim` per design §4).
|
|
13
|
+
*/
|
|
14
|
+
import { c, color, glyph } from "./tokens.js";
|
|
15
|
+
import { stripAnsi } from "./header.js";
|
|
16
|
+
/**
|
|
17
|
+
* Render a table. Returns one string per line (header + divider + rows),
|
|
18
|
+
* never trailing newline. Returns `[]` for an empty `rows` array unless
|
|
19
|
+
* `showHeader` is true (in which case header + divider are still emitted).
|
|
20
|
+
*/
|
|
21
|
+
export function renderTable(rows, columns, opts = {}) {
|
|
22
|
+
if (columns.length === 0)
|
|
23
|
+
return [];
|
|
24
|
+
const showHeader = opts.showHeader !== false;
|
|
25
|
+
const drawDivider = opts.dividerAfterHeader !== false;
|
|
26
|
+
const indent = " ".repeat(opts.indent ?? 1);
|
|
27
|
+
const gap = " ".repeat(opts.gap ?? 2);
|
|
28
|
+
// Pre-compute raw cell values + per-column widths.
|
|
29
|
+
const rawCells = rows.map((row) => columns.map((col) => col.render(row)));
|
|
30
|
+
const widths = columns.map((col, idx) => {
|
|
31
|
+
if (typeof col.width === "number")
|
|
32
|
+
return col.width;
|
|
33
|
+
const headerLen = col.header.length;
|
|
34
|
+
const maxCell = rawCells.reduce((max, cells) => {
|
|
35
|
+
const len = stripAnsi(cells[idx] ?? "").length;
|
|
36
|
+
return len > max ? len : max;
|
|
37
|
+
}, 0);
|
|
38
|
+
return Math.max(headerLen, maxCell);
|
|
39
|
+
});
|
|
40
|
+
const lines = [];
|
|
41
|
+
if (showHeader) {
|
|
42
|
+
const headerCells = columns.map((col, idx) => color(c.textDim, padCell(col.header, widths[idx], col.align ?? "left")));
|
|
43
|
+
lines.push(`${indent}${headerCells.join(gap)}`);
|
|
44
|
+
if (drawDivider) {
|
|
45
|
+
const ruleWidth = widths.reduce((sum, w) => sum + w, 0) + gap.length * (columns.length - 1);
|
|
46
|
+
lines.push(`${indent}${color(c.textGhost, glyph.ruleLight.repeat(Math.max(1, ruleWidth)))}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
rows.forEach((row, rowIdx) => {
|
|
50
|
+
const cells = columns.map((col, colIdx) => {
|
|
51
|
+
const raw = rawCells[rowIdx][colIdx];
|
|
52
|
+
// Last left-aligned column doesn't need trailing pad — saves a row of
|
|
53
|
+
// ghost whitespace per snapshot and matches the v5.9.3 hand-rolled output.
|
|
54
|
+
const isLastCol = colIdx === columns.length - 1;
|
|
55
|
+
const align = col.align ?? "left";
|
|
56
|
+
const padded = isLastCol && align === "left"
|
|
57
|
+
? raw
|
|
58
|
+
: padCell(raw, widths[colIdx], align);
|
|
59
|
+
// Empty string opts out of column-level colouring — useful when the
|
|
60
|
+
// cell's `render()` already emits its own ANSI (e.g. cost tiers).
|
|
61
|
+
const cellColor = col.color === "" ? null : col.color ?? c.text;
|
|
62
|
+
return cellColor ? color(cellColor, padded) : padded;
|
|
63
|
+
});
|
|
64
|
+
const line = `${indent}${cells.join(gap)}`;
|
|
65
|
+
lines.push(opts.rowFormatter ? opts.rowFormatter(row, line) : line);
|
|
66
|
+
});
|
|
67
|
+
return lines;
|
|
68
|
+
}
|
|
69
|
+
/** Convenience: render + print + trailing newline. */
|
|
70
|
+
export function printTable(rows, columns, opts = {}) {
|
|
71
|
+
const lines = renderTable(rows, columns, opts);
|
|
72
|
+
if (lines.length > 0)
|
|
73
|
+
process.stdout.write(`${lines.join("\n")}\n`);
|
|
74
|
+
}
|
|
75
|
+
/** Pad a cell value (which may contain ANSI) to a target printable width. */
|
|
76
|
+
function padCell(value, width, align) {
|
|
77
|
+
const bareLen = stripAnsi(value).length;
|
|
78
|
+
const padLen = Math.max(0, width - bareLen);
|
|
79
|
+
const pad = " ".repeat(padLen);
|
|
80
|
+
return align === "right" ? `${pad}${value}` : `${value}${pad}`;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgCxC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,IAAS,EACT,OAAyB,EACzB,OAAwB,EAAE;IAE1B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC;IAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC;IACtD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAEtC,mDAAmD;IACnD,MAAM,QAAQ,GAAe,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACtC,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;YAAE,OAAO,GAAG,CAAC,KAAK,CAAC;QACpD,MAAM,SAAS,GA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AAED,sDAAsD;AACtD,MAAM,UAAU,UAAU,CACxB,IAAS,EACT,OAAyB,EACzB,OAAwB,EAAE;IAE1B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtE,CAAC;AAED,6EAA6E;AAC7E,SAAS,OAAO,CAAC,KAAa,EAAE,KAAa,EAAE,KAAuB;IACpE,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,GAAG,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Title atom — screen-level heading + optional subtitle.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Render a title + optional subtitle. Caller follows with the standard
|
|
6
|
+
* blank line via normal flow.
|
|
7
|
+
*
|
|
8
|
+
* @param title Bold, `text-hi`.
|
|
9
|
+
* @param sub Optional, `text-mid`, rendered on the next line.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Title(title: string, sub?: string): string;
|
|
12
|
+
/** Convenience: print title + trailing blank line to stdout. */
|
|
13
|
+
export declare function printTitle(title: string, sub?: string): void;
|
|
14
|
+
//# sourceMappingURL=title.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/title.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED,gEAAgE;AAChE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAE5D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Title atom — screen-level heading + optional subtitle.
|
|
3
|
+
*/
|
|
4
|
+
import { c, color } from "./tokens.js";
|
|
5
|
+
/**
|
|
6
|
+
* Render a title + optional subtitle. Caller follows with the standard
|
|
7
|
+
* blank line via normal flow.
|
|
8
|
+
*
|
|
9
|
+
* @param title Bold, `text-hi`.
|
|
10
|
+
* @param sub Optional, `text-mid`, rendered on the next line.
|
|
11
|
+
*/
|
|
12
|
+
export function Title(title, sub) {
|
|
13
|
+
const indent = " ";
|
|
14
|
+
const line1 = `${indent}${color(c.textHi, title)}`;
|
|
15
|
+
if (!sub)
|
|
16
|
+
return line1;
|
|
17
|
+
const line2 = `${indent}${color(c.textMid, sub)}`;
|
|
18
|
+
return `${line1}\n${line2}`;
|
|
19
|
+
}
|
|
20
|
+
/** Convenience: print title + trailing blank line to stdout. */
|
|
21
|
+
export function printTitle(title, sub) {
|
|
22
|
+
process.stdout.write(`${Title(title, sub)}\n\n`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/title.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAY;IAC/C,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,MAAM,KAAK,GAAG,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IACnD,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,MAAM,KAAK,GAAG,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;IAClD,OAAO,GAAG,KAAK,KAAK,KAAK,EAAE,CAAC;AAC9B,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,GAAY;IACpD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
|