zard-cli 1.0.0-beta.115 → 1.0.0-beta.116
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/commands/add/component-installer.js +3 -3
- package/commands/add/component-installer.js.map +1 -1
- package/commands/add/component-selector.d.ts +3 -3
- package/commands/add/component-selector.js +3 -3
- package/commands/add/dependency-resolver.js +10 -7
- package/commands/add/dependency-resolver.js.map +1 -1
- package/commands/add/index.d.ts.map +1 -1
- package/commands/add/index.js +12 -20
- package/commands/add/index.js.map +1 -1
- package/commands/add/wizard.d.ts +8 -7
- package/commands/add/wizard.d.ts.map +1 -1
- package/commands/add/wizard.js +2 -2
- package/commands/add/wizard.js.map +1 -1
- package/commands/init/config-prompter.d.ts +18 -13
- package/commands/init/config-prompter.d.ts.map +1 -1
- package/commands/init/config-prompter.js +25 -19
- package/commands/init/config-prompter.js.map +1 -1
- package/commands/init/dependencies.d.ts.map +1 -1
- package/commands/init/dependencies.js +21 -24
- package/commands/init/dependencies.js.map +1 -1
- package/commands/init/index.js +20 -20
- package/commands/init/index.js.map +1 -1
- package/commands/init/project-kind.d.ts +39 -39
- package/commands/init/project-kind.d.ts.map +1 -1
- package/commands/init/project-kind.js +44 -44
- package/commands/init/project-kind.js.map +1 -1
- package/commands/init/steps.d.ts +3 -4
- package/commands/init/steps.d.ts.map +1 -1
- package/commands/init/steps.js +25 -24
- package/commands/init/steps.js.map +1 -1
- package/commands/init/tailwind-setup.d.ts +5 -5
- package/commands/init/tailwind-setup.js +14 -14
- package/commands/init/tailwind-setup.js.map +1 -1
- package/commands/init/tsconfig-updater.d.ts +4 -4
- package/commands/init/tsconfig-updater.js +12 -12
- package/commands/init/tsconfig-updater.js.map +1 -1
- package/commands/init/update-angular-config.js +4 -4
- package/commands/init/vite-setup.d.ts +5 -4
- package/commands/init/vite-setup.d.ts.map +1 -1
- package/commands/init/vite-setup.js +11 -10
- package/commands/init/vite-setup.js.map +1 -1
- package/commands/init/wizard.d.ts +5 -5
- package/commands/init/wizard.d.ts.map +1 -1
- package/commands/init/wizard.js +29 -29
- package/commands/init/wizard.js.map +1 -1
- package/core/icons/families.d.ts +20 -20
- package/core/icons/families.d.ts.map +1 -1
- package/core/icons/families.js +11 -11
- package/core/icons/families.js.map +1 -1
- package/core/icons/icon-map.d.ts.map +1 -1
- package/core/icons/icon-map.js +7 -4
- package/core/icons/icon-map.js.map +1 -1
- package/core/icons/index.d.ts +50 -50
- package/core/icons/index.d.ts.map +1 -1
- package/core/icons/index.js +45 -45
- package/core/icons/index.js.map +1 -1
- package/core/registry/registry-data.d.ts.map +1 -1
- package/core/registry/registry-data.js +82 -15
- package/core/registry/registry-data.js.map +1 -1
- package/core/themes/theme-definitions.d.ts.map +1 -1
- package/core/themes/theme-definitions.js +10 -0
- package/core/themes/theme-definitions.js.map +1 -1
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/package.json +6 -8
- package/ui/blocks.d.ts +29 -28
- package/ui/blocks.d.ts.map +1 -1
- package/ui/blocks.js +27 -27
- package/ui/blocks.js.map +1 -1
- package/ui/brand.d.ts +5 -5
- package/ui/brand.d.ts.map +1 -1
- package/ui/brand.js +6 -6
- package/ui/brand.js.map +1 -1
- package/ui/engine/animation/index.d.ts +2 -3
- package/ui/engine/animation/index.d.ts.map +1 -1
- package/ui/engine/animation/index.js +2 -3
- package/ui/engine/animation/index.js.map +1 -1
- package/ui/engine/ansi/index.d.ts +10 -11
- package/ui/engine/ansi/index.d.ts.map +1 -1
- package/ui/engine/ansi/index.js +6 -7
- package/ui/engine/ansi/index.js.map +1 -1
- package/ui/engine/components/index.d.ts +3 -3
- package/ui/engine/components/index.js +4 -4
- package/ui/engine/cursor/index.d.ts +3 -4
- package/ui/engine/cursor/index.d.ts.map +1 -1
- package/ui/engine/cursor/index.js +2 -3
- package/ui/engine/cursor/index.js.map +1 -1
- package/ui/engine/diff/index.d.ts +2 -3
- package/ui/engine/diff/index.d.ts.map +1 -1
- package/ui/engine/diff/index.js +5 -6
- package/ui/engine/diff/index.js.map +1 -1
- package/ui/engine/events/index.d.ts +2 -2
- package/ui/engine/events/index.js +3 -3
- package/ui/engine/events/index.js.map +1 -1
- package/ui/engine/focus/index.d.ts +2 -2
- package/ui/engine/focus/index.js +2 -2
- package/ui/engine/frame/index.d.ts +4 -4
- package/ui/engine/frame/index.js +0 -0
- package/ui/engine/index.d.ts +7 -7
- package/ui/engine/index.js +7 -7
- package/ui/engine/input/index.d.ts +2 -2
- package/ui/engine/input/index.js +11 -11
- package/ui/engine/input/index.js.map +1 -1
- package/ui/engine/layout/index.d.ts +3 -3
- package/ui/engine/layout/index.js +7 -7
- package/ui/engine/layout/index.js.map +1 -1
- package/ui/engine/renderer/index.d.ts +4 -4
- package/ui/engine/renderer/index.d.ts.map +1 -1
- package/ui/engine/renderer/index.js +3 -3
- package/ui/engine/scheduler/index.d.ts +3 -3
- package/ui/engine/scheduler/index.js +5 -5
- package/ui/engine/scheduler/index.js.map +1 -1
- package/ui/engine/screen/index.d.ts +5 -5
- package/ui/engine/screen/index.d.ts.map +1 -1
- package/ui/engine/screen/index.js +7 -7
- package/ui/engine/screen/index.js.map +1 -1
- package/ui/engine/terminal/index.d.ts +29 -29
- package/ui/engine/terminal/index.d.ts.map +1 -1
- package/ui/engine/terminal/index.js +47 -47
- package/ui/engine/terminal/index.js.map +1 -1
- package/ui/engine/testing/index.d.ts +4 -4
- package/ui/engine/testing/index.d.ts.map +1 -1
- package/ui/engine/testing/index.js +2 -2
- package/ui/engine/theme/index.d.ts +2 -3
- package/ui/engine/theme/index.d.ts.map +1 -1
- package/ui/engine/theme/index.js +3 -4
- package/ui/engine/theme/index.js.map +1 -1
- package/ui/engine/utils/index.d.ts +2 -2
- package/ui/engine/utils/index.js +4 -4
- package/ui/engine/utils/index.js.map +1 -1
- package/ui/gate.d.ts +7 -7
- package/ui/gate.d.ts.map +1 -1
- package/ui/gate.js +5 -5
- package/ui/index.d.ts +3 -3
- package/ui/index.js +3 -3
- package/ui/log-sink.d.ts +9 -9
- package/ui/log-sink.d.ts.map +1 -1
- package/ui/log-sink.js +9 -9
- package/ui/log-sink.js.map +1 -1
- package/ui/output.d.ts +6 -6
- package/ui/output.d.ts.map +1 -1
- package/ui/output.js +6 -6
- package/ui/output.js.map +1 -1
- package/ui/report.d.ts +8 -8
- package/ui/report.d.ts.map +1 -1
- package/ui/report.js +7 -7
- package/ui/report.js.map +1 -1
- package/ui/runner.d.ts +25 -25
- package/ui/runner.d.ts.map +1 -1
- package/ui/runner.js +27 -27
- package/ui/runner.js.map +1 -1
- package/ui/style.d.ts +7 -7
- package/ui/style.d.ts.map +1 -1
- package/ui/style.js +8 -8
- package/ui/style.js.map +1 -1
- package/ui/testing/fake-tty.d.ts +4 -4
- package/ui/testing/fake-tty.js +4 -4
- package/ui/text-input.d.ts +14 -13
- package/ui/text-input.d.ts.map +1 -1
- package/ui/text-input.js +15 -13
- package/ui/text-input.js.map +1 -1
- package/ui/theme.d.ts +4 -4
- package/ui/theme.js +4 -4
- package/utils/angular-compat.d.ts +21 -0
- package/utils/angular-compat.d.ts.map +1 -0
- package/utils/angular-compat.js +52 -0
- package/utils/angular-compat.js.map +1 -0
- package/utils/config.d.ts +6 -6
- package/utils/config.d.ts.map +1 -1
- package/utils/config.js +20 -20
- package/utils/config.js.map +1 -1
- package/utils/errors.d.ts +5 -5
- package/utils/errors.js +5 -5
- package/utils/get-project-info.d.ts +6 -6
- package/utils/get-project-info.d.ts.map +1 -1
- package/utils/get-project-info.js +35 -35
- package/utils/get-project-info.js.map +1 -1
- package/utils/http-client.d.ts.map +1 -1
- package/utils/http-client.js +18 -3
- package/utils/http-client.js.map +1 -1
- package/utils/icon-catalog.d.ts +16 -15
- package/utils/icon-catalog.d.ts.map +1 -1
- package/utils/icon-catalog.js +21 -20
- package/utils/icon-catalog.js.map +1 -1
- package/utils/logger.d.ts +3 -3
- package/utils/logger.js +9 -9
- package/utils/logger.js.map +1 -1
- package/utils/package-manager.d.ts +25 -25
- package/utils/package-manager.js +48 -48
- package/utils/package-manager.js.map +1 -1
- package/utils/registry.d.ts +14 -14
- package/utils/registry.d.ts.map +1 -1
- package/utils/registry.js +23 -19
- package/utils/registry.js.map +1 -1
- package/utils/schema-version.d.ts +11 -10
- package/utils/schema-version.d.ts.map +1 -1
- package/utils/schema-version.js +11 -10
- package/utils/schema-version.js.map +1 -1
- package/utils/source-file.d.ts +21 -21
- package/utils/source-file.d.ts.map +1 -1
- package/utils/source-file.js +24 -24
- package/utils/source-file.js.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* utils —
|
|
3
|
-
*
|
|
2
|
+
* utils — pure string/Unicode helpers. No I/O, no dependencies.
|
|
3
|
+
* Enough for ASCII, wide characters and emoji.
|
|
4
4
|
*/
|
|
5
5
|
export declare function graphemes(text: string): string[];
|
|
6
6
|
export declare function charWidth(grapheme: string): 0 | 1 | 2;
|
package/ui/engine/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* utils —
|
|
3
|
-
*
|
|
2
|
+
* utils — pure string/Unicode helpers. No I/O, no dependencies.
|
|
3
|
+
* Enough for ASCII, wide characters and emoji.
|
|
4
4
|
*/
|
|
5
5
|
const SEG = typeof Intl.Segmenter === 'function'
|
|
6
6
|
? new Intl.Segmenter('en', { granularity: 'grapheme' })
|
|
@@ -30,7 +30,7 @@ function isWide(cp) {
|
|
|
30
30
|
(cp >= 0xfe30 && cp <= 0xfe6f) ||
|
|
31
31
|
(cp >= 0xff00 && cp <= 0xff60) || // Fullwidth forms
|
|
32
32
|
(cp >= 0xffe0 && cp <= 0xffe6) ||
|
|
33
|
-
(cp >= 0x1f300 && cp <= 0x1faff) || // emoji &
|
|
33
|
+
(cp >= 0x1f300 && cp <= 0x1faff) || // emoji & symbols
|
|
34
34
|
(cp >= 0x20000 && cp <= 0x3fffd) // CJK Ext B+
|
|
35
35
|
);
|
|
36
36
|
}
|
|
@@ -104,7 +104,7 @@ export function wrapText(text, width) {
|
|
|
104
104
|
return out.length ? out : [''];
|
|
105
105
|
}
|
|
106
106
|
function splitWords(line) {
|
|
107
|
-
//
|
|
107
|
+
// keeps spaces attached to the following word so simple indents survive
|
|
108
108
|
return line.length ? (line.match(/\s*\S+\s*|\s+/g) ?? [line]) : [''];
|
|
109
109
|
}
|
|
110
110
|
export function truncate(text, width, ellipsis = '…') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/engine/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,GAAG,GACP,OAAQ,IAAgC,CAAC,SAAS,KAAK,UAAU;IAC/D,CAAC,CAAC,IAAK,IAA2B,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;IAC/E,CAAC,CAAC,IAAI,CAAC;AAEX,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,+EAA+E;AAC/E,SAAS,MAAM,CAAC,EAAU;IACxB,OAAO,CACL,CAAC,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,cAAc;QAChD,EAAE,KAAK,MAAM;QACb,EAAE,KAAK,MAAM;QACb,CAAC,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,uBAAuB;QACzD,CAAC,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,yBAAyB;QAC3D,CAAC,E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IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,GAAG,EAAE,IAAI,GAAG;YAAE,GAAG,IAAI,CAAC,CAAC;QAC9C,GAAG,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,IAAI,GAAG;YAAE,MAAM;IACxB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,OAAO,GAAG,4BAA4B,CAAC;AAC7C,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC"}
|
package/ui/gate.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gate —
|
|
2
|
+
* Gate — lets an async flow wait for an answer from the keyboard.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Linear wizards (choose → resolve → confirm → install) read far better written
|
|
5
|
+
* as one async function than as a state machine inside `onKey`. The gate is the
|
|
6
|
+
* missing piece: the flow awaits `wait()`, and the key handler calls `settle()`
|
|
7
|
+
* when the user decides.
|
|
8
8
|
*/
|
|
9
9
|
export interface Gate<T> {
|
|
10
10
|
wait(): Promise<T>;
|
|
11
|
-
/**
|
|
11
|
+
/** Delivers the answer. Later calls are ignored. */
|
|
12
12
|
settle(value: T): void;
|
|
13
13
|
/** Interrompe quem espera, propagando o erro. */
|
|
14
14
|
fail(error: unknown): void;
|
|
15
|
-
/**
|
|
15
|
+
/** True while somebody is waiting for an answer. */
|
|
16
16
|
readonly pending: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare function createGate<T>(): Gate<T>;
|
package/ui/gate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/ui/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/ui/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,oDAAoD;IACpD,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACvB,iDAAiD;IACjD,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CA2BvC"}
|
package/ui/gate.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gate —
|
|
2
|
+
* Gate — lets an async flow wait for an answer from the keyboard.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Linear wizards (choose → resolve → confirm → install) read far better written
|
|
5
|
+
* as one async function than as a state machine inside `onKey`. The gate is the
|
|
6
|
+
* missing piece: the flow awaits `wait()`, and the key handler calls `settle()`
|
|
7
|
+
* when the user decides.
|
|
8
8
|
*/
|
|
9
9
|
export function createGate() {
|
|
10
10
|
let resolveFn = null;
|
package/ui/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The public surface of the CLI's UI.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Commands import from here — never from `./engine` directly — so that replacing
|
|
5
|
+
* or upgrading the engine stays contained in this layer.
|
|
6
6
|
*/
|
|
7
7
|
export * from './engine/index.js';
|
|
8
8
|
export * from './blocks.js';
|
package/ui/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The public surface of the CLI's UI.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Commands import from here — never from `./engine` directly — so that replacing
|
|
5
|
+
* or upgrading the engine stays contained in this layer.
|
|
6
6
|
*/
|
|
7
7
|
export * from './engine/index.js';
|
|
8
8
|
export * from './blocks.js';
|
package/ui/log-sink.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Message sink — diverts the logger's output while the interactive screen is
|
|
3
|
+
* mounted.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* (tsconfig-updater, theme-loader, package manager…)
|
|
7
|
-
* engine
|
|
8
|
-
*
|
|
5
|
+
* In the alt-screen, any `console.log` fired by an internal module
|
|
6
|
+
* (tsconfig-updater, theme-loader, package manager…) would tear the frame the
|
|
7
|
+
* engine just painted. While capturing, messages are held here and re-emitted
|
|
8
|
+
* into the terminal's history after unmount, alongside the summary.
|
|
9
9
|
*/
|
|
10
10
|
export type LogLevel = 'info' | 'warn' | 'error' | 'success' | 'debug';
|
|
11
11
|
export interface LogRecord {
|
|
12
12
|
readonly level: LogLevel;
|
|
13
13
|
readonly message: string;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
15
|
+
/** Starts holding the logger's messages instead of writing them to the terminal. */
|
|
16
16
|
export declare function beginCapture(): void;
|
|
17
17
|
/** Encerra a captura e devolve o que foi retido, na ordem em que chegou. */
|
|
18
18
|
export declare function endCapture(): LogRecord[];
|
|
19
19
|
export declare function isCapturing(): boolean;
|
|
20
|
-
/**
|
|
20
|
+
/** Holds one message. Returns false when no capture is active. */
|
|
21
21
|
export declare function capture(level: LogLevel, message: string): boolean;
|
|
22
|
-
/**
|
|
22
|
+
/** The messages held so far, without ending the capture (for display in the UI). */
|
|
23
23
|
export declare function captured(): readonly LogRecord[];
|
|
24
24
|
//# sourceMappingURL=log-sink.d.ts.map
|
package/ui/log-sink.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-sink.d.ts","sourceRoot":"","sources":["../../src/ui/log-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAID,
|
|
1
|
+
{"version":3,"file":"log-sink.d.ts","sourceRoot":"","sources":["../../src/ui/log-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAID,oFAAoF;AACpF,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,IAAI,SAAS,EAAE,CAIxC;AAED,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED,oFAAoF;AACpF,wBAAgB,QAAQ,IAAI,SAAS,SAAS,EAAE,CAE/C"}
|
package/ui/log-sink.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Message sink — diverts the logger's output while the interactive screen is
|
|
3
|
+
* mounted.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* (tsconfig-updater, theme-loader, package manager…)
|
|
7
|
-
* engine
|
|
8
|
-
*
|
|
5
|
+
* In the alt-screen, any `console.log` fired by an internal module
|
|
6
|
+
* (tsconfig-updater, theme-loader, package manager…) would tear the frame the
|
|
7
|
+
* engine just painted. While capturing, messages are held here and re-emitted
|
|
8
|
+
* into the terminal's history after unmount, alongside the summary.
|
|
9
9
|
*/
|
|
10
10
|
let buffer = null;
|
|
11
|
-
/**
|
|
11
|
+
/** Starts holding the logger's messages instead of writing them to the terminal. */
|
|
12
12
|
export function beginCapture() {
|
|
13
13
|
buffer = [];
|
|
14
14
|
}
|
|
@@ -21,14 +21,14 @@ export function endCapture() {
|
|
|
21
21
|
export function isCapturing() {
|
|
22
22
|
return buffer !== null;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/** Holds one message. Returns false when no capture is active. */
|
|
25
25
|
export function capture(level, message) {
|
|
26
26
|
if (buffer === null)
|
|
27
27
|
return false;
|
|
28
28
|
buffer.push({ level, message });
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
31
|
+
/** The messages held so far, without ending the capture (for display in the UI). */
|
|
32
32
|
export function captured() {
|
|
33
33
|
return buffer ?? [];
|
|
34
34
|
}
|
package/ui/log-sink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-sink.js","sourceRoot":"","sources":["../../src/ui/log-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,IAAI,MAAM,GAAuB,IAAI,CAAC;AAEtC,
|
|
1
|
+
{"version":3,"file":"log-sink.js","sourceRoot":"","sources":["../../src/ui/log-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,IAAI,MAAM,GAAuB,IAAI,CAAC;AAEtC,oFAAoF;AACpF,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,EAAE,CAAC;AACd,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,UAAU;IACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC;IAC9B,MAAM,GAAG,IAAI,CAAC;IACd,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,MAAM,KAAK,IAAI,CAAC;AACzB,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,OAAO,CAAC,KAAe,EAAE,OAAe;IACtD,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,QAAQ;IACtB,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
package/ui/output.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* terminal,
|
|
2
|
+
* Line output — the only door through which the CLI writes loose text to the
|
|
3
|
+
* terminal, outside the interactive screen.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Concentrating writes here guarantees the logger, the final summary and the
|
|
6
|
+
* messages re-emitted from the sink all use exactly the same level markers and
|
|
7
|
+
* the same palette.
|
|
8
8
|
*/
|
|
9
9
|
import { type LogRecord } from './log-sink.js';
|
|
10
10
|
export declare function writeLine(text?: string): void;
|
|
11
11
|
export declare function formatRecord(record: LogRecord): string;
|
|
12
|
-
/**
|
|
12
|
+
/** Re-emits into the terminal's history the messages held while the screen was up. */
|
|
13
13
|
export declare function flushRecords(records: readonly LogRecord[]): void;
|
|
14
14
|
//# sourceMappingURL=output.d.ts.map
|
package/ui/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/ui/output.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,eAAe,CAAC;AAW9D,wBAAgB,SAAS,CAAC,IAAI,SAAK,GAAG,IAAI,CAEzC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAEtD;AAED,
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/ui/output.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,eAAe,CAAC;AAW9D,wBAAgB,SAAS,CAAC,IAAI,SAAK,GAAG,IAAI,CAEzC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAEtD;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CAEhE"}
|
package/ui/output.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* terminal,
|
|
2
|
+
* Line output — the only door through which the CLI writes loose text to the
|
|
3
|
+
* terminal, outside the interactive screen.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Concentrating writes here guarantees the logger, the final summary and the
|
|
6
|
+
* messages re-emitted from the sink all use exactly the same level markers and
|
|
7
|
+
* the same palette.
|
|
8
8
|
*/
|
|
9
9
|
import { style } from './style.js';
|
|
10
10
|
const MARKS = {
|
|
@@ -20,7 +20,7 @@ export function writeLine(text = '') {
|
|
|
20
20
|
export function formatRecord(record) {
|
|
21
21
|
return MARKS[record.level](record.message);
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/** Re-emits into the terminal's history the messages held while the screen was up. */
|
|
24
24
|
export function flushRecords(records) {
|
|
25
25
|
for (const record of records)
|
|
26
26
|
writeLine(formatRecord(record));
|
package/ui/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/ui/output.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,KAAK,GAA+C;IACxD,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAC7C,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAChD,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAC7C,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAC7C,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,IAAI,GAAG,EAAE;IACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/ui/output.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,KAAK,GAA+C;IACxD,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAC7C,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAChD,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAC7C,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;IAC7C,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,IAAI,GAAG,EAAE;IACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC"}
|
package/ui/report.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The post-run summary — what stays in the history after the alt-screen.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* On leaving the full screen, everything the wizard drew disappears. What the
|
|
5
|
+
* user needs to keep (what was written, what to run next, what went wrong) is
|
|
6
|
+
* reprinted here, in the terminal's normal flow, where it stays scrollable and
|
|
7
|
+
* copyable after the command ends.
|
|
8
8
|
*/
|
|
9
9
|
import { type LogRecord } from './log-sink.js';
|
|
10
10
|
export type ReportStatus = 'success' | 'cancelled' | 'error';
|
|
@@ -17,11 +17,11 @@ export interface Report {
|
|
|
17
17
|
readonly status: ReportStatus;
|
|
18
18
|
/** Uma frase: o desfecho do comando. */
|
|
19
19
|
readonly headline: string;
|
|
20
|
-
/**
|
|
20
|
+
/** What was actually done. */
|
|
21
21
|
readonly items?: readonly string[];
|
|
22
|
-
/**
|
|
22
|
+
/** Supporting text, shown in a secondary tone. */
|
|
23
23
|
readonly notes?: readonly string[];
|
|
24
|
-
/**
|
|
24
|
+
/** Suggested next steps. */
|
|
25
25
|
readonly commands?: readonly ReportCommand[];
|
|
26
26
|
/** Mensagens retidas enquanto a tela estava montada. */
|
|
27
27
|
readonly logs?: readonly LogRecord[];
|
package/ui/report.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/ui/report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/ui/report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,4BAA4B;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC7C,wDAAwD;IACxD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CACtC;AAQD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA+BhD"}
|
package/ui/report.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The post-run summary — what stays in the history after the alt-screen.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* On leaving the full screen, everything the wizard drew disappears. What the
|
|
5
|
+
* user needs to keep (what was written, what to run next, what went wrong) is
|
|
6
|
+
* reprinted here, in the terminal's normal flow, where it stays scrollable and
|
|
7
|
+
* copyable after the command ends.
|
|
8
8
|
*/
|
|
9
9
|
import { flushRecords, writeLine } from './output.js';
|
|
10
10
|
import { style } from './style.js';
|
|
@@ -37,8 +37,8 @@ export function printReport(report) {
|
|
|
37
37
|
writeLine(` ${style.foreground(command)}${suffix}`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
//
|
|
41
|
-
//
|
|
40
|
+
// Two lines, not one: the shell prompt comes back right below and, pressed up
|
|
41
|
+
// against it, the last suggested command looks like part of it.
|
|
42
42
|
writeLine();
|
|
43
43
|
writeLine();
|
|
44
44
|
}
|
package/ui/report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/ui/report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAwBnC,MAAM,QAAQ,GAAmD;IAC/D,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;IAC5D,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;IAC9D,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;CAC1D,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,SAAS,EAAE,CAAC;IACZ,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEpD,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QACxB,SAAS,EAAE,CAAC;QACZ,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QACzB,SAAS,EAAE,CAAC;QACZ,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK;YAAE,SAAS,CAAC,KAAK,K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AE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,8EAA8E;IAC9E,gEAAgE;IAChE,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;AACd,CAAC"}
|
package/ui/runner.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runner —
|
|
2
|
+
* Runner — the bridge between the engine's frame loop and the CLI's async flow.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Commands are sequential (`const config = await promptForConfig(...)`), while
|
|
5
|
+
* the engine is an event-driven render loop. The runner reconciles the two: it
|
|
6
|
+
* mounts the screen, hands control to `onKey`/`run`, and resolves a Promise when
|
|
7
|
+
* the flow calls `done()`.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* 1.
|
|
11
|
-
*
|
|
12
|
-
* 2.
|
|
13
|
-
*
|
|
14
|
-
* 3.
|
|
15
|
-
*
|
|
9
|
+
* Three invariants hold for every wizard:
|
|
10
|
+
* 1. the terminal is restored on every exit path — errors, SIGINT and a
|
|
11
|
+
* process crash included;
|
|
12
|
+
* 2. with no TTY the screen is never mounted: the caller gets a
|
|
13
|
+
* NonInteractiveError and follows the headless path;
|
|
14
|
+
* 3. whatever the logger would write during the mount is held in the sink and
|
|
15
|
+
* re-emitted afterwards, so the frame is not torn.
|
|
16
16
|
*/
|
|
17
17
|
import { type KeyEvent, type Node, type Screen, type TerminalStreams } from './engine/index.js';
|
|
18
18
|
import { type LogRecord } from './log-sink.js';
|
|
19
|
-
/**
|
|
19
|
+
/** Signals that the command has to carry on without an interactive UI (CI, pipe, --yes). */
|
|
20
20
|
export declare class NonInteractiveError extends Error {
|
|
21
21
|
constructor(message?: string);
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/** The user abandoned the wizard (Ctrl+C, or a step that cancels the flow). */
|
|
24
24
|
export declare class WizardCancelledError extends Error {
|
|
25
25
|
constructor(message?: string);
|
|
26
26
|
}
|
|
@@ -31,21 +31,21 @@ export interface WizardContext<T> {
|
|
|
31
31
|
cancel(message?: string): void;
|
|
32
32
|
/** Agenda um novo frame depois de alterar o estado. */
|
|
33
33
|
refresh(): void;
|
|
34
|
-
/**
|
|
34
|
+
/** Access to the screen, for cases that need the scheduler or the capabilities. */
|
|
35
35
|
readonly screen: Screen;
|
|
36
36
|
}
|
|
37
37
|
export interface WizardOptions<T> {
|
|
38
|
-
/**
|
|
38
|
+
/** Pure view, rebuilt every frame. */
|
|
39
39
|
view: () => Node;
|
|
40
|
-
/**
|
|
40
|
+
/** Keys the view handles on its own. */
|
|
41
41
|
onKey?: (event: KeyEvent, ctx: WizardContext<T>) => void;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Async work run with the screen alive — installing packages, writing files.
|
|
44
|
+
* The UI keeps animating until the promise resolves.
|
|
45
45
|
*/
|
|
46
46
|
run?: (ctx: WizardContext<T>) => Promise<void> | void;
|
|
47
47
|
fps?: number;
|
|
48
|
-
/**
|
|
48
|
+
/** How to find the terminal. Injectable for tests; the default resolves it itself. */
|
|
49
49
|
resolveStreams?: () => TerminalStreams | null;
|
|
50
50
|
}
|
|
51
51
|
export interface WizardResult<T> {
|
|
@@ -54,12 +54,12 @@ export interface WizardResult<T> {
|
|
|
54
54
|
readonly logs: readonly LogRecord[];
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* True when there is a terminal to mount the screen on.
|
|
58
58
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
59
|
+
* Looking at `process.stdout.isTTY && process.stdin.isTTY` is not enough: that
|
|
60
|
+
* is what made `npx zard-cli init` fall back to text mode on macOS and Linux,
|
|
61
|
+
* where npm runs the binary through a shell and hands over stdin as a pipe. The
|
|
62
|
+
* controlling terminal is still reachable, and it is what decides.
|
|
63
63
|
*/
|
|
64
64
|
export declare function isInteractive(resolve?: () => TerminalStreams | null): boolean;
|
|
65
65
|
export declare function runWizard<T>(options: WizardOptions<T>): Promise<WizardResult<T>>;
|
package/ui/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/ui/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAIzE,
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/ui/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAIzE,4FAA4F;AAC5F,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,SAAsC;CAI1D;AAED,+EAA+E;AAC/E,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,SAAyB;CAI7C;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,wDAAwD;IACxD,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,yDAAyD;IACzD,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,uDAAuD;IACvD,OAAO,IAAI,IAAI,CAAC;IAChB,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,sCAAsC;IACtC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACzD;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAM,eAAe,GAAG,IAA6B,GAAG,OAAO,CAMrG;AAED,wBAAsB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAwFtF"}
|
package/ui/runner.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runner —
|
|
2
|
+
* Runner — the bridge between the engine's frame loop and the CLI's async flow.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Commands are sequential (`const config = await promptForConfig(...)`), while
|
|
5
|
+
* the engine is an event-driven render loop. The runner reconciles the two: it
|
|
6
|
+
* mounts the screen, hands control to `onKey`/`run`, and resolves a Promise when
|
|
7
|
+
* the flow calls `done()`.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* 1.
|
|
11
|
-
*
|
|
12
|
-
* 2.
|
|
13
|
-
*
|
|
14
|
-
* 3.
|
|
15
|
-
*
|
|
9
|
+
* Three invariants hold for every wizard:
|
|
10
|
+
* 1. the terminal is restored on every exit path — errors, SIGINT and a
|
|
11
|
+
* process crash included;
|
|
12
|
+
* 2. with no TTY the screen is never mounted: the caller gets a
|
|
13
|
+
* NonInteractiveError and follows the headless path;
|
|
14
|
+
* 3. whatever the logger would write during the mount is held in the sink and
|
|
15
|
+
* re-emitted afterwards, so the frame is not torn.
|
|
16
16
|
*/
|
|
17
17
|
import { createScreen, createTerminal, resolveTerminalStreams, } from './engine/index.js';
|
|
18
18
|
import { beginCapture, endCapture } from './log-sink.js';
|
|
19
19
|
import { flushRecords } from './output.js';
|
|
20
20
|
import { zardTheme } from './theme.js';
|
|
21
|
-
/**
|
|
21
|
+
/** Signals that the command has to carry on without an interactive UI (CI, pipe, --yes). */
|
|
22
22
|
export class NonInteractiveError extends Error {
|
|
23
23
|
constructor(message = 'This terminal is not interactive.') {
|
|
24
24
|
super(message);
|
|
25
25
|
this.name = 'NonInteractiveError';
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
28
|
+
/** The user abandoned the wizard (Ctrl+C, or a step that cancels the flow). */
|
|
29
29
|
export class WizardCancelledError extends Error {
|
|
30
30
|
constructor(message = 'Operation cancelled.') {
|
|
31
31
|
super(message);
|
|
@@ -33,12 +33,12 @@ export class WizardCancelledError extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* True when there is a terminal to mount the screen on.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
38
|
+
* Looking at `process.stdout.isTTY && process.stdin.isTTY` is not enough: that
|
|
39
|
+
* is what made `npx zard-cli init` fall back to text mode on macOS and Linux,
|
|
40
|
+
* where npm runs the binary through a shell and hands over stdin as a pipe. The
|
|
41
|
+
* controlling terminal is still reachable, and it is what decides.
|
|
42
42
|
*/
|
|
43
43
|
export function isInteractive(resolve = resolveTerminalStreams) {
|
|
44
44
|
const streams = resolve();
|
|
@@ -55,8 +55,8 @@ export async function runWizard(options) {
|
|
|
55
55
|
theme: zardTheme,
|
|
56
56
|
fps: options.fps ?? 30,
|
|
57
57
|
terminal: createTerminal({ stdin: streams.input, stdout: streams.output }),
|
|
58
|
-
//
|
|
59
|
-
//
|
|
58
|
+
// Teardown is ours: we intercept Ctrl+C to end the wizard with a message,
|
|
59
|
+
// instead of killing the process from inside the engine.
|
|
60
60
|
handleExitSignals: false,
|
|
61
61
|
});
|
|
62
62
|
let settled = false;
|
|
@@ -66,15 +66,15 @@ export async function runWizard(options) {
|
|
|
66
66
|
return;
|
|
67
67
|
teardownDone = true;
|
|
68
68
|
screen.unmount();
|
|
69
|
-
//
|
|
70
|
-
//
|
|
69
|
+
// After the unmount: that is what returns the terminal to its normal state,
|
|
70
|
+
// and closing the streams first would leave the alt-screen and raw mode on.
|
|
71
71
|
streams.close();
|
|
72
72
|
process.off('exit', teardown);
|
|
73
73
|
process.off('SIGINT', onSignal);
|
|
74
74
|
process.off('SIGTERM', onSignal);
|
|
75
75
|
};
|
|
76
|
-
//
|
|
77
|
-
//
|
|
76
|
+
// Safety net: if the process dies with the screen mounted, the terminal still
|
|
77
|
+
// returns to normal (cursor visible, no raw mode, out of the alt-screen).
|
|
78
78
|
function onSignal() {
|
|
79
79
|
teardown();
|
|
80
80
|
process.exit(130);
|
|
@@ -123,8 +123,8 @@ export async function runWizard(options) {
|
|
|
123
123
|
return { value, logs: endCapture() };
|
|
124
124
|
}
|
|
125
125
|
catch (error) {
|
|
126
|
-
//
|
|
127
|
-
//
|
|
126
|
+
// Last chance to show what was held: the screen is already down and whoever
|
|
127
|
+
// handles the error above will only see the exception's message.
|
|
128
128
|
flushRecords(endCapture());
|
|
129
129
|
throw error;
|
|
130
130
|
}
|