gnosys 5.9.2 → 5.9.3
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 +7 -1
- package/dist/lib/config.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/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/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 +44 -0
- package/dist/lib/setup/routingRender.d.ts.map +1 -0
- package/dist/lib/setup/routingRender.js +97 -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 +49 -27
- 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 +40 -19
- 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 +49 -29
- package/dist/lib/setup/sections/routing.js.map +1 -1
- 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 +135 -105
- package/dist/lib/setup/summary.js.map +1 -1
- package/dist/lib/setup/syncProjectsRender.d.ts +56 -0
- package/dist/lib/setup/syncProjectsRender.d.ts.map +1 -0
- package/dist/lib/setup/syncProjectsRender.js +168 -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 +26 -0
- package/dist/lib/setup/ui/index.d.ts.map +1 -0
- package/dist/lib/setup/ui/index.js +18 -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 +53 -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/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 +7 -0
- package/dist/lib/setup.d.ts.map +1 -1
- package/dist/lib/setup.js +204 -230
- package/dist/lib/setup.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render helpers for `gnosys setup sync-projects` output (Screen 10).
|
|
3
|
+
*
|
|
4
|
+
* These pure render functions turn the sync result data into the new
|
|
5
|
+
* hierarchical layout from the v5.9.3 design handoff §4 Screen 10:
|
|
6
|
+
*
|
|
7
|
+
* - Header at the top with breadcrumb + version
|
|
8
|
+
* - Inline summary spinner line
|
|
9
|
+
* - Hierarchical sections: upgraded, skipped, machines
|
|
10
|
+
* - Light dividers between sections
|
|
11
|
+
* - Paths collapsed to `~/…` when long
|
|
12
|
+
* - ⚠ + `← older` tag on out-of-date machines
|
|
13
|
+
*
|
|
14
|
+
* Pure string output, no I/O — snapshot-testable.
|
|
15
|
+
*/
|
|
16
|
+
import os from "os";
|
|
17
|
+
import path from "path";
|
|
18
|
+
import { c, color, glyph, width } from "./ui/tokens.js";
|
|
19
|
+
import { Header } from "./ui/header.js";
|
|
20
|
+
import { Status } from "./ui/status.js";
|
|
21
|
+
const MAX_PATH_DISPLAY = 50;
|
|
22
|
+
const MAX_VISIBLE_ROWS = 5;
|
|
23
|
+
/**
|
|
24
|
+
* Render the leading Header for the sync-projects screen.
|
|
25
|
+
* Caller follows with a blank line.
|
|
26
|
+
*/
|
|
27
|
+
export function renderSyncHeader(version) {
|
|
28
|
+
const v = version.startsWith("v") ? version : `v${version}`;
|
|
29
|
+
return Header(["gnosys", "upgrading registered projects"], { version: v });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Collapse a long path with a leading `~/…` so it fits on screen.
|
|
33
|
+
* Returns the original path unchanged when already short enough.
|
|
34
|
+
*/
|
|
35
|
+
export function collapsePath(p, homeDir = os.homedir()) {
|
|
36
|
+
// Always prefer ~/ shorthand when path is under home.
|
|
37
|
+
let display = p;
|
|
38
|
+
if (homeDir && p.startsWith(homeDir + path.sep)) {
|
|
39
|
+
display = "~" + p.slice(homeDir.length);
|
|
40
|
+
}
|
|
41
|
+
else if (homeDir && p === homeDir) {
|
|
42
|
+
display = "~";
|
|
43
|
+
}
|
|
44
|
+
if (display.length <= MAX_PATH_DISPLAY)
|
|
45
|
+
return display;
|
|
46
|
+
// Path is still too long: keep the head + ellipsis.
|
|
47
|
+
const head = display.slice(0, MAX_PATH_DISPLAY - 2);
|
|
48
|
+
return `${head}/…`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Render the "upgraded N projects" section. Returns an array of lines
|
|
52
|
+
* (with no trailing newline). Returns [] when there are no rows.
|
|
53
|
+
*/
|
|
54
|
+
export function renderUpgradedSection(rows) {
|
|
55
|
+
if (rows.length === 0)
|
|
56
|
+
return [];
|
|
57
|
+
const lines = [];
|
|
58
|
+
lines.push(` ${color(c.text, `upgraded ${rows.length} projects`)}`);
|
|
59
|
+
const visible = rows.slice(0, MAX_VISIBLE_ROWS);
|
|
60
|
+
for (const r of visible) {
|
|
61
|
+
lines.push(formatProjectRow("ok", r));
|
|
62
|
+
}
|
|
63
|
+
const remaining = rows.length - visible.length;
|
|
64
|
+
if (remaining > 0) {
|
|
65
|
+
lines.push(` ${color(c.textDim, `(${remaining} more)`)}`);
|
|
66
|
+
}
|
|
67
|
+
return lines;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Render the "skipped N projects" section. Same shape as upgraded but
|
|
71
|
+
* uses the hollow dot glyph. Returns [] when empty.
|
|
72
|
+
*/
|
|
73
|
+
export function renderSkippedSection(rows) {
|
|
74
|
+
if (rows.length === 0)
|
|
75
|
+
return [];
|
|
76
|
+
const lines = [];
|
|
77
|
+
lines.push(` ${color(c.text, `skipped ${rows.length} projects`)} ${color(c.textDim, "· no .gnosys directory")}`);
|
|
78
|
+
const visible = rows.slice(0, MAX_VISIBLE_ROWS);
|
|
79
|
+
for (const r of visible) {
|
|
80
|
+
lines.push(formatProjectRow("skip", r));
|
|
81
|
+
}
|
|
82
|
+
const remaining = rows.length - visible.length;
|
|
83
|
+
if (remaining > 0) {
|
|
84
|
+
lines.push(` ${color(c.textDim, `(${remaining} more)`)}`);
|
|
85
|
+
}
|
|
86
|
+
return lines;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Render the "failed N projects" section. Renders all rows (no "more"
|
|
90
|
+
* collapse) since failures matter.
|
|
91
|
+
*/
|
|
92
|
+
export function renderFailedSection(rows) {
|
|
93
|
+
if (rows.length === 0)
|
|
94
|
+
return [];
|
|
95
|
+
const lines = [];
|
|
96
|
+
lines.push(` ${color(c.text, `failed ${rows.length} projects`)}`);
|
|
97
|
+
for (const r of rows) {
|
|
98
|
+
lines.push(formatProjectRow("fail", r));
|
|
99
|
+
}
|
|
100
|
+
return lines;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Render the connected-machines callout. Returns [] when there's only
|
|
104
|
+
* one machine (no callout needed).
|
|
105
|
+
*/
|
|
106
|
+
export function renderMachinesSection(rows, currentVersion) {
|
|
107
|
+
if (rows.length <= 1)
|
|
108
|
+
return [];
|
|
109
|
+
const lines = [];
|
|
110
|
+
lines.push(` ${color(c.text, "connected machines")}`);
|
|
111
|
+
lines.push("");
|
|
112
|
+
const nameW = Math.max(...rows.map((r) => r.hostname.length));
|
|
113
|
+
for (const r of rows) {
|
|
114
|
+
const isOlder = r.version !== currentVersion;
|
|
115
|
+
const dot = isOlder ? color(c.warn, glyph.warn) : color(c.ok, glyph.ok);
|
|
116
|
+
const name = color(c.text, r.hostname.padEnd(nameW));
|
|
117
|
+
const versionDisplay = r.isCurrent && !isOlder ? "" : `v${r.version}`;
|
|
118
|
+
const versionCol = color(c.textDim, versionDisplay.padEnd(10));
|
|
119
|
+
const lastSeenDate = r.lastSeen.split("T")[0];
|
|
120
|
+
const lastSeen = r.isCurrent
|
|
121
|
+
? color(c.textDim, "this machine")
|
|
122
|
+
: color(c.textDim, `last seen ${lastSeenDate}`);
|
|
123
|
+
const tag = isOlder ? ` ${color(c.warn, "← older")}` : "";
|
|
124
|
+
lines.push(` ${dot} ${name} ${versionCol} ${lastSeen}${tag}`);
|
|
125
|
+
}
|
|
126
|
+
return lines;
|
|
127
|
+
}
|
|
128
|
+
/** Render a horizontal divider (1-col indent, thin rule). */
|
|
129
|
+
export function renderDivider() {
|
|
130
|
+
const W = width();
|
|
131
|
+
return ` ${color(c.textGhost, glyph.ruleLight.repeat(Math.max(1, W - 1)))}`;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Final "done · central DB stamped vX.Y.Z" status line.
|
|
135
|
+
*/
|
|
136
|
+
export function renderDoneLine(version) {
|
|
137
|
+
const v = version.startsWith("v") ? version : `v${version}`;
|
|
138
|
+
return Status("ok", "done", `central DB stamped ${v}`);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Build the dashboard summary lines (printed after the divider when
|
|
142
|
+
* regeneration succeeded).
|
|
143
|
+
*/
|
|
144
|
+
export function renderDashboardSummary(htmlPath, mdPath) {
|
|
145
|
+
const lines = [];
|
|
146
|
+
lines.push(` ${color(c.text, "portfolio dashboard regenerated")}`);
|
|
147
|
+
lines.push(` ${color(c.textDim, "html ")} ${color(c.textDim, collapsePath(htmlPath))}`);
|
|
148
|
+
lines.push(` ${color(c.textDim, "md ")} ${color(c.textDim, collapsePath(mdPath))}`);
|
|
149
|
+
return lines;
|
|
150
|
+
}
|
|
151
|
+
function formatProjectRow(kind, r) {
|
|
152
|
+
let dot;
|
|
153
|
+
switch (kind) {
|
|
154
|
+
case "ok":
|
|
155
|
+
dot = color(c.ok, glyph.ok);
|
|
156
|
+
break;
|
|
157
|
+
case "skip":
|
|
158
|
+
dot = color(c.textDim, glyph.dotHollow);
|
|
159
|
+
break;
|
|
160
|
+
case "fail":
|
|
161
|
+
dot = color(c.fail, glyph.fail);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
const title = color(c.text, r.title.padEnd(28));
|
|
165
|
+
const fullPath = collapsePath(r.fullPath);
|
|
166
|
+
return ` ${dot} ${title} ${color(c.textDim, fullPath)}`;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=syncProjectsRender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syncProjectsRender.js","sourceRoot":"","sources":["../../../src/lib/setup/syncProjectsRender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAkB3B;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;IAC5D,OAAO,MAAM,CAAC,CAAC,QAAQ,EAAE,+BAA+B,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,UAAkB,EAAE,CAAC,OAAO,EAAE;IACpE,sDAAsD;IACtD,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAChD,OAAO,GAAG,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAA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+
* Replaces the silent "Configuration saved" messages with a visible
|
|
5
|
+
* before/after summary. `to` is rendered in `accent-hi` to draw the eye.
|
|
6
|
+
*/
|
|
7
|
+
export interface DiffRow {
|
|
8
|
+
label: string;
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Render a diff block. Columns are auto-sized by widest entry in each
|
|
14
|
+
* column. Caller follows with the success line / next status.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Diff(rows: DiffRow[]): string;
|
|
17
|
+
/** Convenience: print diff + trailing blank line. */
|
|
18
|
+
export declare function printDiff(rows: DiffRow[]): void;
|
|
19
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAc5C;AAED,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAG/C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff atom — `label from → to` table shown after any mutation.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the silent "Configuration saved" messages with a visible
|
|
5
|
+
* before/after summary. `to` is rendered in `accent-hi` to draw the eye.
|
|
6
|
+
*/
|
|
7
|
+
import { c, color, glyph } from "./tokens.js";
|
|
8
|
+
/**
|
|
9
|
+
* Render a diff block. Columns are auto-sized by widest entry in each
|
|
10
|
+
* column. Caller follows with the success line / next status.
|
|
11
|
+
*/
|
|
12
|
+
export function Diff(rows) {
|
|
13
|
+
if (rows.length === 0)
|
|
14
|
+
return "";
|
|
15
|
+
const labelW = Math.max(...rows.map((r) => r.label.length));
|
|
16
|
+
const fromW = Math.max(...rows.map((r) => r.from.length));
|
|
17
|
+
const indent = " ";
|
|
18
|
+
const arrow = color(c.textGhost, glyph.arrow);
|
|
19
|
+
const lines = [];
|
|
20
|
+
for (const r of rows) {
|
|
21
|
+
const label = color(c.textDim, r.label.padEnd(labelW));
|
|
22
|
+
const from = color(c.textMid, r.from.padEnd(fromW));
|
|
23
|
+
const to = color(c.accentHi, r.to);
|
|
24
|
+
lines.push(`${indent}${label} ${from} ${arrow} ${to}`);
|
|
25
|
+
}
|
|
26
|
+
return lines.join("\n");
|
|
27
|
+
}
|
|
28
|
+
/** Convenience: print diff + trailing blank line. */
|
|
29
|
+
export function printDiff(rows) {
|
|
30
|
+
if (rows.length === 0)
|
|
31
|
+
return;
|
|
32
|
+
process.stdout.write(`${Diff(rows)}\n\n`);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAQ9C;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,IAAe;IAClC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC;IACrB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACvD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACpD,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,MAAM,IAAI,MAAM,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footer atom — single right-aligned dim hint at the bottom of long lists,
|
|
3
|
+
* shown immediately before the Prompt.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Render a right-aligned `text-dim` hint line.
|
|
7
|
+
*/
|
|
8
|
+
export declare function Footer(hint: string): string;
|
|
9
|
+
/** Convenience: print footer + newline. */
|
|
10
|
+
export declare function printFooter(hint: string): void;
|
|
11
|
+
//# sourceMappingURL=footer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/footer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3C;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE9C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footer atom — single right-aligned dim hint at the bottom of long lists,
|
|
3
|
+
* shown immediately before the Prompt.
|
|
4
|
+
*/
|
|
5
|
+
import { c, color, width } from "./tokens.js";
|
|
6
|
+
import { stripAnsi } from "./header.js";
|
|
7
|
+
/**
|
|
8
|
+
* Render a right-aligned `text-dim` hint line.
|
|
9
|
+
*/
|
|
10
|
+
export function Footer(hint) {
|
|
11
|
+
const W = width();
|
|
12
|
+
const txt = color(c.textDim, hint);
|
|
13
|
+
const bare = stripAnsi(txt);
|
|
14
|
+
const pad = " ".repeat(Math.max(1, W - 1 - bare.length));
|
|
15
|
+
return `${pad}${txt}`;
|
|
16
|
+
}
|
|
17
|
+
/** Convenience: print footer + newline. */
|
|
18
|
+
export function printFooter(hint) {
|
|
19
|
+
process.stdout.write(`${Footer(hint)}\n`);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=footer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/footer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC;IAClB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,OAAO,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AACxB,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header atom — breadcrumb + thin rule on every redesigned screen.
|
|
3
|
+
*
|
|
4
|
+
* Renders two lines: breadcrumb `⬢ gnosys ▸ setup ▸ models` (left) with a
|
|
5
|
+
* right-aligned version label, followed by a full-width `─` rule. Caller
|
|
6
|
+
* is responsible for following with one blank line via the normal flow.
|
|
7
|
+
*/
|
|
8
|
+
export interface HeaderOptions {
|
|
9
|
+
/** Version label, right-aligned. Pass `undefined` to omit. */
|
|
10
|
+
version?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Render a header for the given breadcrumb segments. Returns the full
|
|
14
|
+
* 2-line string (no trailing newline).
|
|
15
|
+
*
|
|
16
|
+
* @param crumbs Path segments. First should always be `gnosys`.
|
|
17
|
+
* @param opts Optional version label.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Header(crumbs: string[], opts?: HeaderOptions): string;
|
|
20
|
+
/** Strip ANSI escapes so we can measure printable width. Exported for callers/tests that need printable measurement. */
|
|
21
|
+
export declare function stripAnsi(s: string): string;
|
|
22
|
+
/** Convenience: print header + trailing blank line to stdout. */
|
|
23
|
+
export declare function printHeader(crumbs: string[], opts?: HeaderOptions): void;
|
|
24
|
+
//# sourceMappingURL=header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/header.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,aAAa;IAC5B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CA0BzE;AAED,wHAAwH;AACxH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3C;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,aAAkB,GAAG,IAAI,CAE5E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header atom — breadcrumb + thin rule on every redesigned screen.
|
|
3
|
+
*
|
|
4
|
+
* Renders two lines: breadcrumb `⬢ gnosys ▸ setup ▸ models` (left) with a
|
|
5
|
+
* right-aligned version label, followed by a full-width `─` rule. Caller
|
|
6
|
+
* is responsible for following with one blank line via the normal flow.
|
|
7
|
+
*/
|
|
8
|
+
import { c, color, glyph, width } from "./tokens.js";
|
|
9
|
+
/**
|
|
10
|
+
* Render a header for the given breadcrumb segments. Returns the full
|
|
11
|
+
* 2-line string (no trailing newline).
|
|
12
|
+
*
|
|
13
|
+
* @param crumbs Path segments. First should always be `gnosys`.
|
|
14
|
+
* @param opts Optional version label.
|
|
15
|
+
*/
|
|
16
|
+
export function Header(crumbs, opts = {}) {
|
|
17
|
+
const W = width();
|
|
18
|
+
const brand = color(c.accent, glyph.brand);
|
|
19
|
+
const head = `${brand} ${color(c.textHi, crumbs[0] ?? "gnosys")}`;
|
|
20
|
+
const tail = crumbs
|
|
21
|
+
.slice(1)
|
|
22
|
+
.map((s) => `${color(c.textDim, glyph.sep)} ${color(c.textDim, s)}`)
|
|
23
|
+
.join(" ");
|
|
24
|
+
const left = tail ? `${head} ${tail}` : head;
|
|
25
|
+
// Pad the right-aligned version. We measure printable width without ANSI.
|
|
26
|
+
const versionTxt = opts.version ? color(c.textDim, opts.version) : "";
|
|
27
|
+
const leftBare = stripAnsi(left);
|
|
28
|
+
const versionBare = opts.version ?? "";
|
|
29
|
+
// 1-col indent on the left ("content at col 2"), plus one space before the
|
|
30
|
+
// version, plus the version. Pad with spaces to push version to col W-1.
|
|
31
|
+
const indent = " ";
|
|
32
|
+
const usable = W - indent.length - leftBare.length - versionBare.length;
|
|
33
|
+
const pad = " ".repeat(Math.max(1, usable));
|
|
34
|
+
const line1 = `${indent}${left}${pad}${versionTxt}`;
|
|
35
|
+
// Rule line — full width with single space indent for alignment.
|
|
36
|
+
const ruleLen = Math.max(1, W - indent.length);
|
|
37
|
+
const line2 = `${indent}${color(c.textGhost, glyph.ruleLight.repeat(ruleLen))}`;
|
|
38
|
+
return `${line1}\n${line2}`;
|
|
39
|
+
}
|
|
40
|
+
/** Strip ANSI escapes so we can measure printable width. Exported for callers/tests that need printable measurement. */
|
|
41
|
+
export function stripAnsi(s) {
|
|
42
|
+
// eslint-disable-next-line no-control-regex
|
|
43
|
+
return s.replace(/\x1b\[[0-9;]*m/g, "");
|
|
44
|
+
}
|
|
45
|
+
/** Convenience: print header + trailing blank line to stdout. */
|
|
46
|
+
export function printHeader(crumbs, opts = {}) {
|
|
47
|
+
process.stdout.write(`${Header(crumbs, opts)}\n\n`);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/header.ts"],"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AAC,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IACxE,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,UAAU,EAAE,CAAC;IAEpD,iEAAiE;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;IAEhF,OAAO,GAAG,KAAK,KAAK,KAAK,EAAE,CAAC;AAC9B,CAAC;AAED,wHAAwH;AACxH,MAAM,UAAU,SAAS,CAAC,CAAS;IACjC,4CAA4C;IAC5C,OAAO,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,WAAW,CAAC,MAAgB,EAAE,OAAsB,EAAE;IACpE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public re-exports for the gnosys CLI UI atoms (v5.9.3 redesign).
|
|
3
|
+
*
|
|
4
|
+
* Always import from this module — never reach into individual files from
|
|
5
|
+
* outside `setup/ui/`. That keeps the atom boundaries clean and lets us
|
|
6
|
+
* rework internals (e.g. swap truecolor detection) without ripple.
|
|
7
|
+
*/
|
|
8
|
+
export { c, color, glyph, COLS, width, TRUECOLOR, RESET } from "./tokens.js";
|
|
9
|
+
export type { ColorTokens } from "./tokens.js";
|
|
10
|
+
export { Header, printHeader, stripAnsi } from "./header.js";
|
|
11
|
+
export type { HeaderOptions } from "./header.js";
|
|
12
|
+
export { Title, printTitle } from "./title.js";
|
|
13
|
+
export { Menu, printMenu } from "./menu.js";
|
|
14
|
+
export type { MenuItem } from "./menu.js";
|
|
15
|
+
export { Prompt } from "./prompt.js";
|
|
16
|
+
export type { PromptOptions } from "./prompt.js";
|
|
17
|
+
export { Status, printStatus } from "./status.js";
|
|
18
|
+
export type { StatusKind } from "./status.js";
|
|
19
|
+
export { Diff, printDiff } from "./diff.js";
|
|
20
|
+
export type { DiffRow } from "./diff.js";
|
|
21
|
+
export { Panel, printPanel } from "./panel.js";
|
|
22
|
+
export type { PanelOptions } from "./panel.js";
|
|
23
|
+
export { Spinner } from "./spinner.js";
|
|
24
|
+
export type { SpinnerHandle } from "./spinner.js";
|
|
25
|
+
export { Footer, printFooter } from "./footer.js";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public re-exports for the gnosys CLI UI atoms (v5.9.3 redesign).
|
|
3
|
+
*
|
|
4
|
+
* Always import from this module — never reach into individual files from
|
|
5
|
+
* outside `setup/ui/`. That keeps the atom boundaries clean and lets us
|
|
6
|
+
* rework internals (e.g. swap truecolor detection) without ripple.
|
|
7
|
+
*/
|
|
8
|
+
export { c, color, glyph, COLS, width, TRUECOLOR, RESET } from "./tokens.js";
|
|
9
|
+
export { Header, printHeader, stripAnsi } from "./header.js";
|
|
10
|
+
export { Title, printTitle } from "./title.js";
|
|
11
|
+
export { Menu, printMenu } from "./menu.js";
|
|
12
|
+
export { Prompt } from "./prompt.js";
|
|
13
|
+
export { Status, printStatus } from "./status.js";
|
|
14
|
+
export { Diff, printDiff } from "./diff.js";
|
|
15
|
+
export { Panel, printPanel } from "./panel.js";
|
|
16
|
+
export { Spinner } from "./spinner.js";
|
|
17
|
+
export { Footer, printFooter } from "./footer.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAG7E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu atom — the single numbered-menu format the redesign uses.
|
|
3
|
+
*
|
|
4
|
+
* 3-col number gutter, lowercase labels by convention, right-aligned
|
|
5
|
+
* meta column, optional `◂ tag` (recommended | current | detected) to
|
|
6
|
+
* the right of meta.
|
|
7
|
+
*/
|
|
8
|
+
export interface MenuItem {
|
|
9
|
+
/** The shortcut digit/letter (`1`, `2`, `b`, `q`, …). */
|
|
10
|
+
n: string;
|
|
11
|
+
/** Primary label text. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Optional right-side metadata (price, status, etc.). */
|
|
14
|
+
meta?: string;
|
|
15
|
+
/** Optional `◂ recommended` / `◂ current` / `◂ detected` style tag. */
|
|
16
|
+
tag?: string;
|
|
17
|
+
/** Render the whole row in `text-dim` (used for skip / back). */
|
|
18
|
+
dim?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Render a numbered menu as a single string (no trailing newline).
|
|
22
|
+
* Caller follows with one blank line then a Prompt/Footer.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Menu(items: MenuItem[]): string;
|
|
25
|
+
/** Convenience: print menu + trailing blank line. */
|
|
26
|
+
export declare function printMenu(items: MenuItem[]): void;
|
|
27
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/menu.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,QAAQ;IACvB,yDAAyD;IACzD,CAAC,EAAE,MAAM,CAAC;IACV,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CA0D9C;AAED,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAEjD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu atom — the single numbered-menu format the redesign uses.
|
|
3
|
+
*
|
|
4
|
+
* 3-col number gutter, lowercase labels by convention, right-aligned
|
|
5
|
+
* meta column, optional `◂ tag` (recommended | current | detected) to
|
|
6
|
+
* the right of meta.
|
|
7
|
+
*/
|
|
8
|
+
import { c, color, glyph, width } from "./tokens.js";
|
|
9
|
+
import { stripAnsi } from "./header.js";
|
|
10
|
+
/**
|
|
11
|
+
* Render a numbered menu as a single string (no trailing newline).
|
|
12
|
+
* Caller follows with one blank line then a Prompt/Footer.
|
|
13
|
+
*/
|
|
14
|
+
export function Menu(items) {
|
|
15
|
+
const W = width();
|
|
16
|
+
// Column layout:
|
|
17
|
+
// col 1: " " indent (content lives at col 2 per the spec)
|
|
18
|
+
// col 2-4: 3-char gutter for number, right-aligned
|
|
19
|
+
// col 5: " "
|
|
20
|
+
// col 6+: label
|
|
21
|
+
// meta is right-aligned within W-2
|
|
22
|
+
// tag (◂ ...) follows meta, right-aligned at the very right
|
|
23
|
+
const indent = " "; // menu items at col 4 — 4-space indent (1 base + 3)
|
|
24
|
+
const lines = [];
|
|
25
|
+
for (const it of items) {
|
|
26
|
+
// Numbers are always text-dim per design §3 (numbered-menu spec).
|
|
27
|
+
const labelColor = it.dim ? c.textDim : c.text;
|
|
28
|
+
const metaColor = it.dim ? c.textDim : c.textMid;
|
|
29
|
+
const tagColor = c.accentHi;
|
|
30
|
+
const num = color(c.textDim, it.n.padStart(2, " "));
|
|
31
|
+
const label = color(labelColor, it.label);
|
|
32
|
+
const meta = it.meta ? color(metaColor, it.meta) : "";
|
|
33
|
+
const tag = it.tag ? color(tagColor, `${glyph.tag} ${it.tag}`) : "";
|
|
34
|
+
// Build the inner content then right-pad meta + tag.
|
|
35
|
+
const leftSide = `${indent}${num} ${label}`;
|
|
36
|
+
const leftBare = stripAnsi(leftSide);
|
|
37
|
+
// Reserve room: leftBare | gap | meta | gap | tag, ending at col W-1.
|
|
38
|
+
const tagBare = it.tag ? `${glyph.tag} ${it.tag}` : "";
|
|
39
|
+
const metaBare = it.meta ?? "";
|
|
40
|
+
const tagWidth = tagBare.length;
|
|
41
|
+
const metaWidth = metaBare.length;
|
|
42
|
+
// tag occupies the rightmost slot if present; meta column ends before
|
|
43
|
+
// the tag with a one-space gap. If no tag, meta ends at col W-1.
|
|
44
|
+
const rightEnd = W - 1;
|
|
45
|
+
let line;
|
|
46
|
+
if (it.tag && it.meta) {
|
|
47
|
+
const tagStart = rightEnd - tagWidth;
|
|
48
|
+
const metaEnd = tagStart - 1; // one space between meta and tag
|
|
49
|
+
const metaStart = metaEnd - metaWidth;
|
|
50
|
+
const gap1 = " ".repeat(Math.max(1, metaStart - leftBare.length));
|
|
51
|
+
const gap2 = " ";
|
|
52
|
+
line = `${leftSide}${gap1}${meta}${gap2}${tag}`;
|
|
53
|
+
}
|
|
54
|
+
else if (it.tag) {
|
|
55
|
+
const tagStart = rightEnd - tagWidth;
|
|
56
|
+
const gap = " ".repeat(Math.max(1, tagStart - leftBare.length));
|
|
57
|
+
line = `${leftSide}${gap}${tag}`;
|
|
58
|
+
}
|
|
59
|
+
else if (it.meta) {
|
|
60
|
+
const metaStart = rightEnd - metaWidth;
|
|
61
|
+
const gap = " ".repeat(Math.max(1, metaStart - leftBare.length));
|
|
62
|
+
line = `${leftSide}${gap}${meta}`;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
line = leftSide;
|
|
66
|
+
}
|
|
67
|
+
lines.push(line);
|
|
68
|
+
}
|
|
69
|
+
return lines.join("\n");
|
|
70
|
+
}
|
|
71
|
+
/** Convenience: print menu + trailing blank line. */
|
|
72
|
+
export function printMenu(items) {
|
|
73
|
+
process.stdout.write(`${Menu(items)}\n\n`);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../../src/lib/setup/ui/menu.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;AAexC;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,KAAiB;IACpC,MAAM,CAAC,GAAG,KAAK,EAAE,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,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;YACvC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACjE,IAAI,GAAG,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,QAAQ,CAAC;QAClB,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,SAAS,CAAC,KAAiB;IACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export interface PanelOptions {
|
|
9
|
+
/** Right-side glyph on a row (e.g. `✓` to mark "edited this session"). */
|
|
10
|
+
trailing?: Record<number, string>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Render a panel. Each row is a string (already formatted/colored). The
|
|
14
|
+
* panel wraps each row in `│ … │` with `accent-dim` border. The title
|
|
15
|
+
* sits in the top border: `╭─ title ────╮`.
|
|
16
|
+
*
|
|
17
|
+
* Width is fixed to the lesser of W or 68 cols of inner content (matches
|
|
18
|
+
* the spec mockup) so summary panels never spill on wider terminals.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Panel(title: string, rows: string[], opts?: PanelOptions): string;
|
|
21
|
+
/** Convenience: print panel + trailing blank line. */
|
|
22
|
+
export declare function printPanel(title: string, rows: string[], opts?: PanelOptions): void;
|
|
23
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/ui/panel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,YAAY;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,YAAiB,GAAG,MAAM,CAkCpF;AAED,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,YAAiB,GAAG,IAAI,CAEvF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 ──────╮`
|
|
26
|
+
const titleStyled = color(c.textHi, title);
|
|
27
|
+
const topHead = `${color(border, `${glyph.boxTL}${glyph.boxH} `)}${titleStyled} `;
|
|
28
|
+
const topHeadBare = stripAnsi(topHead);
|
|
29
|
+
const topPadLen = Math.max(1, innerW + 2 - topHeadBare.length);
|
|
30
|
+
const top = `${indent}${topHead}${color(border, `${glyph.boxH.repeat(topPadLen)}${glyph.boxTR}`)}`;
|
|
31
|
+
// Each row: `│ <content> │` — pad content to innerW.
|
|
32
|
+
const left = color(border, `${glyph.boxV} `);
|
|
33
|
+
const right = color(border, ` ${glyph.boxV}`);
|
|
34
|
+
const middle = [];
|
|
35
|
+
rows.forEach((rowStyled, idx) => {
|
|
36
|
+
const bare = stripAnsi(rowStyled);
|
|
37
|
+
const trail = opts.trailing?.[idx] ?? "";
|
|
38
|
+
const trailBare = stripAnsi(trail);
|
|
39
|
+
// Reserve room for the optional trailing glyph (e.g. ✓), right-aligned.
|
|
40
|
+
const usable = innerW - bare.length - (trailBare ? trailBare.length + 1 : 0);
|
|
41
|
+
const padContent = " ".repeat(Math.max(0, usable));
|
|
42
|
+
const trailingPart = trail ? ` ${trail}` : "";
|
|
43
|
+
middle.push(`${indent}${left}${rowStyled}${padContent}${trailingPart}${right}`);
|
|
44
|
+
});
|
|
45
|
+
// Bottom border: `╰──────────────╯`
|
|
46
|
+
const bottom = `${indent}${color(border, `${glyph.boxBL}${glyph.boxH.repeat(innerW + 2)}${glyph.boxBR}`)}`;
|
|
47
|
+
return [top, ...middle, bottom].join("\n");
|
|
48
|
+
}
|
|
49
|
+
/** Convenience: print panel + trailing blank line. */
|
|
50
|
+
export function printPanel(title, rows, opts = {}) {
|
|
51
|
+
process.stdout.write(`${Panel(title, rows, opts)}\n\n`);
|
|
52
|
+
}
|
|
53
|
+
//# 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,iCAAiC;IACjC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,WAAW,GAAG,CAAC;IAClF,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;I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