@kjanat/dreamcli 4.0.0-rc.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -7
- package/dist/{runtime/adapter.d.mts → adapter-D0hbBNVB.d.mts} +2 -4
- package/dist/completion-D4mz6axB.mjs +6 -0
- package/dist/completion.d.mts +90 -0
- package/dist/completion.mjs +1 -0
- package/dist/config-B9ddC-Kb.mjs +1 -0
- package/dist/config.d.mts +2 -0
- package/dist/config.mjs +1 -0
- package/dist/core-Cp2w8vRq.mjs +17 -0
- package/dist/index-BziI2aKc.d.mts +5440 -0
- package/dist/index-DOfClfYR.d.mts +370 -0
- package/dist/index-DWsnGZlx.d.mts +831 -0
- package/dist/{core/cli/index.d.mts → index-DXROeDPC.d.mts} +116 -57
- package/dist/index-DndPmT8J.d.mts +275 -0
- package/dist/{core/json-schema/index.d.mts → index-DyoaS234.d.mts} +43 -34
- package/dist/index.d.mts +190 -41
- package/dist/index.mjs +1 -26
- package/dist/json-schema-C9SzZ7jY.mjs +52 -0
- package/dist/json-schema.d.mts +2 -0
- package/dist/json-schema.mjs +1 -0
- package/dist/package-json-BgE9YjjQ.mjs +3 -0
- package/dist/prompt.d.mts +48 -0
- package/dist/prompt.mjs +1 -0
- package/dist/rolldown-runtime-G4Kt5YOX.mjs +1 -0
- package/dist/runtime.d.mts +2 -6
- package/dist/runtime.mjs +1 -6
- package/dist/terminal-C8KTXjv5.mjs +6 -0
- package/dist/test-prompter-v__jT2yG.mjs +1 -0
- package/dist/testkit.d.mts +54 -6
- package/dist/testkit.mjs +1 -5
- package/dist/version.mjs +1 -7
- package/dreamcli.schema.json +697 -538
- package/package.json +29 -7
- package/skills/cli-creation/SKILL.md +16 -11
- package/CHANGELOG.md +0 -1116
- package/dist/core/cli/builtins.d.mts +0 -117
- package/dist/core/cli/builtins.mjs +0 -135
- package/dist/core/cli/compiled.d.mts +0 -66
- package/dist/core/cli/compiled.mjs +0 -76
- package/dist/core/cli/dispatch.d.mts +0 -115
- package/dist/core/cli/dispatch.mjs +0 -205
- package/dist/core/cli/help-links.d.mts +0 -27
- package/dist/core/cli/help-links.mjs +0 -41
- package/dist/core/cli/index.mjs +0 -1271
- package/dist/core/cli/planner.d.mts +0 -174
- package/dist/core/cli/planner.mjs +0 -323
- package/dist/core/cli/plugin.d.mts +0 -94
- package/dist/core/cli/plugin.mjs +0 -41
- package/dist/core/cli/propagate.d.mts +0 -39
- package/dist/core/cli/propagate.mjs +0 -57
- package/dist/core/cli/reserved-flags.d.mts +0 -19
- package/dist/core/cli/reserved-flags.mjs +0 -158
- package/dist/core/cli/root-help.d.mts +0 -53
- package/dist/core/cli/root-help.mjs +0 -221
- package/dist/core/cli/root-output-flags.d.mts +0 -74
- package/dist/core/cli/root-output-flags.mjs +0 -169
- package/dist/core/cli/root-surface.d.mts +0 -64
- package/dist/core/cli/root-surface.mjs +0 -28
- package/dist/core/cli/runtime-preflight.d.mts +0 -213
- package/dist/core/cli/runtime-preflight.mjs +0 -221
- package/dist/core/completion/index.d.mts +0 -76
- package/dist/core/completion/index.mjs +0 -90
- package/dist/core/completion/shells/bash.d.mts +0 -23
- package/dist/core/completion/shells/bash.mjs +0 -312
- package/dist/core/completion/shells/fish.d.mts +0 -19
- package/dist/core/completion/shells/fish.mjs +0 -164
- package/dist/core/completion/shells/powershell.d.mts +0 -13
- package/dist/core/completion/shells/powershell.mjs +0 -360
- package/dist/core/completion/shells/shared.d.mts +0 -164
- package/dist/core/completion/shells/shared.mjs +0 -147
- package/dist/core/completion/shells/zsh.d.mts +0 -23
- package/dist/core/completion/shells/zsh.mjs +0 -256
- package/dist/core/config/index.d.mts +0 -191
- package/dist/core/config/index.mjs +0 -285
- package/dist/core/config/package-json.d.mts +0 -179
- package/dist/core/config/package-json.mjs +0 -353
- package/dist/core/errors/index.d.mts +0 -125
- package/dist/core/errors/index.mjs +0 -87
- package/dist/core/execution/index.d.mts +0 -61
- package/dist/core/execution/index.mjs +0 -220
- package/dist/core/help/ansi.d.mts +0 -84
- package/dist/core/help/ansi.mjs +0 -121
- package/dist/core/help/index.d.mts +0 -149
- package/dist/core/help/index.mjs +0 -418
- package/dist/core/help/theme.d.mts +0 -86
- package/dist/core/help/theme.mjs +0 -69
- package/dist/core/json-schema/index.mjs +0 -1008
- package/dist/core/json-schema/meta-descriptions.generated.d.mts +0 -274
- package/dist/core/json-schema/meta-descriptions.generated.mjs +0 -136
- package/dist/core/output/activity.d.mts +0 -193
- package/dist/core/output/activity.mjs +0 -452
- package/dist/core/output/bind.d.mts +0 -37
- package/dist/core/output/bind.mjs +0 -56
- package/dist/core/output/contracts.d.mts +0 -82
- package/dist/core/output/contracts.mjs +0 -57
- package/dist/core/output/display-value.d.mts +0 -19
- package/dist/core/output/display-value.mjs +0 -32
- package/dist/core/output/index.d.mts +0 -344
- package/dist/core/output/index.mjs +0 -514
- package/dist/core/output/renderers.d.mts +0 -45
- package/dist/core/output/renderers.mjs +0 -46
- package/dist/core/output/writer.d.mts +0 -39
- package/dist/core/output/writer.mjs +0 -12
- package/dist/core/parse/index.d.mts +0 -178
- package/dist/core/parse/index.mjs +0 -850
- package/dist/core/parse/occurrences.d.mts +0 -90
- package/dist/core/parse/occurrences.mjs +0 -114
- package/dist/core/prompt/index.d.mts +0 -213
- package/dist/core/prompt/index.mjs +0 -348
- package/dist/core/read-flags/index.d.mts +0 -150
- package/dist/core/read-flags/index.mjs +0 -217
- package/dist/core/resolve/args.d.mts +0 -39
- package/dist/core/resolve/args.mjs +0 -182
- package/dist/core/resolve/coerce.d.mts +0 -79
- package/dist/core/resolve/coerce.mjs +0 -900
- package/dist/core/resolve/config.d.mts +0 -10
- package/dist/core/resolve/config.mjs +0 -19
- package/dist/core/resolve/contracts.d.mts +0 -146
- package/dist/core/resolve/errors.d.mts +0 -10
- package/dist/core/resolve/errors.mjs +0 -148
- package/dist/core/resolve/flags.d.mts +0 -74
- package/dist/core/resolve/flags.mjs +0 -246
- package/dist/core/resolve/index.d.mts +0 -44
- package/dist/core/resolve/index.mjs +0 -123
- package/dist/core/resolve/path-checks.d.mts +0 -48
- package/dist/core/resolve/path-checks.mjs +0 -102
- package/dist/core/resolve/redaction.d.mts +0 -13
- package/dist/core/resolve/redaction.mjs +0 -14
- package/dist/core/resolve/stages.d.mts +0 -86
- package/dist/core/resolve/stages.mjs +0 -170
- package/dist/core/resolve/standard.d.mts +0 -26
- package/dist/core/resolve/standard.mjs +0 -212
- package/dist/core/schema/activity.d.mts +0 -189
- package/dist/core/schema/arg.d.mts +0 -1461
- package/dist/core/schema/arg.mjs +0 -1139
- package/dist/core/schema/brand.d.mts +0 -17
- package/dist/core/schema/cardinality.d.mts +0 -302
- package/dist/core/schema/cardinality.mjs +0 -514
- package/dist/core/schema/command.d.mts +0 -1132
- package/dist/core/schema/command.mjs +0 -999
- package/dist/core/schema/flag.d.mts +0 -1495
- package/dist/core/schema/flag.mjs +0 -1207
- package/dist/core/schema/index.d.mts +0 -15
- package/dist/core/schema/index.mjs +0 -10
- package/dist/core/schema/middleware.d.mts +0 -129
- package/dist/core/schema/middleware.mjs +0 -41
- package/dist/core/schema/number-constraints.d.mts +0 -96
- package/dist/core/schema/number-constraints.mjs +0 -60
- package/dist/core/schema/prompt.d.mts +0 -135
- package/dist/core/schema/provenance.d.mts +0 -99
- package/dist/core/schema/provenance.mjs +0 -28
- package/dist/core/schema/run.d.mts +0 -211
- package/dist/core/schema/source.d.mts +0 -180
- package/dist/core/schema/source.mjs +0 -206
- package/dist/core/schema/standard.d.mts +0 -100
- package/dist/core/schema/standard.mjs +0 -15
- package/dist/core/schema/stdin.d.mts +0 -97
- package/dist/core/schema/stdin.mjs +0 -91
- package/dist/core/schema/string-constraints.d.mts +0 -108
- package/dist/core/schema/string-constraints.mjs +0 -86
- package/dist/core/schema/value-parsers.d.mts +0 -150
- package/dist/core/schema/value-parsers.mjs +0 -160
- package/dist/core/schema/value.d.mts +0 -243
- package/dist/core/schema/value.mjs +0 -573
- package/dist/core/testkit/index.d.mts +0 -63
- package/dist/core/testkit/index.mjs +0 -102
- package/dist/runtime/adapter.mjs +0 -92
- package/dist/runtime/auto.d.mts +0 -25
- package/dist/runtime/auto.mjs +0 -45
- package/dist/runtime/deno.d.mts +0 -99
- package/dist/runtime/deno.mjs +0 -265
- package/dist/runtime/detect.d.mts +0 -86
- package/dist/runtime/detect.mjs +0 -45
- package/dist/runtime/index.d.mts +0 -6
- package/dist/runtime/node.d.mts +0 -71
- package/dist/runtime/node.mjs +0 -228
- package/dist/runtime/paths.d.mts +0 -31
- package/dist/runtime/paths.mjs +0 -48
- package/dist/strings.d.mts +0 -27
- package/dist/strings.mjs +0 -22
- package/examples/basic.ts +0 -37
- package/examples/flag-types.ts +0 -79
- package/examples/gh/package.json +0 -45
- package/examples/gh/src/commands/auth.ts +0 -66
- package/examples/gh/src/commands/issue.ts +0 -120
- package/examples/gh/src/commands/pr.ts +0 -125
- package/examples/gh/src/data/issues.yaml +0 -5
- package/examples/gh/src/data/issues.yaml.d.ts +0 -17
- package/examples/gh/src/data/pull-requests.yaml +0 -7
- package/examples/gh/src/data/pull-requests.yaml.d.ts +0 -18
- package/examples/gh/src/docs.ts +0 -11
- package/examples/gh/src/lib/auth.ts +0 -37
- package/examples/gh/src/lib/utils.ts +0 -17
- package/examples/gh/src/main.test.ts +0 -307
- package/examples/gh/src/main.ts +0 -46
- package/examples/help-config.ts +0 -43
- package/examples/interactive.ts +0 -67
- package/examples/json-mode.ts +0 -95
- package/examples/middleware.ts +0 -71
- package/examples/multi-command.ts +0 -66
- package/examples/output-extras.ts +0 -46
- package/examples/parser-control.ts +0 -40
- package/examples/pwsh-demo/README.md +0 -40
- package/examples/pwsh-demo/package.json +0 -41
- package/examples/pwsh-demo/pwsh-demo.cmd +0 -3
- package/examples/pwsh-demo/smoke-powershell.ps1 +0 -218
- package/examples/pwsh-demo/src/main.test.ts +0 -45
- package/examples/pwsh-demo/src/main.ts +0 -140
- package/examples/spinner-progress.ts +0 -49
- package/examples/standard-schema.ts +0 -45
- package/examples/testing.ts +0 -147
- package/examples/transport-launcher.ts +0 -85
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/core/output/display-value.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Shared runtime-value formatting for human-readable output.
|
|
4
|
-
*
|
|
5
|
-
* Used by help text and table rendering so default values and structured cells
|
|
6
|
-
* stringify consistently across the CLI surface.
|
|
7
|
-
*
|
|
8
|
-
* @module dreamcli/core/output/display-value
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Format an unknown runtime value for human-readable output.
|
|
13
|
-
*
|
|
14
|
-
* @param value - The value to format (any type).
|
|
15
|
-
* @returns A string representation suitable for table cells and help text.
|
|
16
|
-
*/
|
|
17
|
-
declare function formatDisplayValue(value: unknown): string;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { formatDisplayValue };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//#region src/core/output/display-value.ts
|
|
2
|
-
/**
|
|
3
|
-
* Shared runtime-value formatting for human-readable output.
|
|
4
|
-
*
|
|
5
|
-
* Used by help text and table rendering so default values and structured cells
|
|
6
|
-
* stringify consistently across the CLI surface.
|
|
7
|
-
*
|
|
8
|
-
* @module dreamcli/core/output/display-value
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Format an unknown runtime value for human-readable output.
|
|
13
|
-
*
|
|
14
|
-
* @param value - The value to format (any type).
|
|
15
|
-
* @returns A string representation suitable for table cells and help text.
|
|
16
|
-
*/
|
|
17
|
-
function formatDisplayValue(value) {
|
|
18
|
-
if (value === null || value === void 0) return "";
|
|
19
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint" || typeof value === "symbol") return String(value);
|
|
20
|
-
if (value instanceof Date) {
|
|
21
|
-
if (Number.isNaN(value.getTime())) return "Invalid Date";
|
|
22
|
-
return value.toISOString();
|
|
23
|
-
}
|
|
24
|
-
if (typeof value === "function") return value.name.length > 0 ? `[Function: ${value.name}]` : "[Function]";
|
|
25
|
-
try {
|
|
26
|
-
return JSON.stringify(value) ?? "[unserializable]";
|
|
27
|
-
} catch {
|
|
28
|
-
return "[unserializable]";
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { formatDisplayValue };
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { ActivityEvent, ProgressHandle, ProgressOptions, SpinnerHandle, SpinnerOptions, TableColumn, TableOptions } from "../schema/activity.mjs";
|
|
2
|
-
import { OutputPolicy, Verbosity } from "./contracts.mjs";
|
|
3
|
-
import { Out, outBrand } from "../schema/command.mjs";
|
|
4
|
-
import { WriteFn, writeLine } from "./writer.mjs";
|
|
5
|
-
import { Colors } from "ansispeck";
|
|
6
|
-
//#region src/core/output/index.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Configuration for creating an output channel.
|
|
9
|
-
*
|
|
10
|
-
* Every field is optional — sensible defaults are applied when omitted.
|
|
11
|
-
*/
|
|
12
|
-
interface OutputOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Writer for stdout-bound messages (`log`, `info`, `json`).
|
|
15
|
-
* Defaults to `process.stdout.write` when running in Node/Bun.
|
|
16
|
-
*/
|
|
17
|
-
readonly stdout?: WriteFn;
|
|
18
|
-
/**
|
|
19
|
-
* Writer for stderr-bound messages (`warn`, `error`).
|
|
20
|
-
* In JSON mode, `log` and `info` are also redirected here so that
|
|
21
|
-
* stdout contains only structured JSON output.
|
|
22
|
-
* Defaults to `process.stderr.write` when running in Node/Bun.
|
|
23
|
-
*/
|
|
24
|
-
readonly stderr?: WriteFn;
|
|
25
|
-
/**
|
|
26
|
-
* Whether stdout is connected to a TTY.
|
|
27
|
-
* When `false`, output may omit ANSI codes and decorations.
|
|
28
|
-
* Defaults to `false` (safe default — non-TTY until proven otherwise).
|
|
29
|
-
*/
|
|
30
|
-
readonly isTTY?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Verbosity level.
|
|
33
|
-
* - `'normal'` (default) — emit all messages
|
|
34
|
-
* - `'quiet'` — suppress `info` messages
|
|
35
|
-
*/
|
|
36
|
-
readonly verbosity?: Verbosity;
|
|
37
|
-
/**
|
|
38
|
-
* Enable JSON output mode.
|
|
39
|
-
*
|
|
40
|
-
* When `true`, `log` and `info` messages are redirected to stderr
|
|
41
|
-
* so that stdout is reserved exclusively for structured `json()` output.
|
|
42
|
-
* `warn` and `error` continue to write to stderr as normal.
|
|
43
|
-
*
|
|
44
|
-
* @defaultValue `false`
|
|
45
|
-
*/
|
|
46
|
-
readonly jsonMode?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Explicitly enable or disable ANSI colors on `out.color`.
|
|
49
|
-
*
|
|
50
|
-
* When set, this wins over the auto-gate — use it to force colors in
|
|
51
|
-
* captured test output or when embedding into a host that manages its
|
|
52
|
-
* own color policy.
|
|
53
|
-
*
|
|
54
|
-
* @defaultValue auto — enabled when `isTTY` is `true`, `jsonMode` is
|
|
55
|
-
* `false`, and the environment supports color (`NO_COLOR`,
|
|
56
|
-
* `FORCE_COLOR`, `--no-color`, `--color`, `CI` are respected).
|
|
57
|
-
*/
|
|
58
|
-
readonly color?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Resolved OSC 8 hyperlink support for `out.isHyperlinkSupported`.
|
|
61
|
-
*
|
|
62
|
-
* When set, this wins over the `isTTY` fallback. Callers pass the
|
|
63
|
-
* `NO_HYPERLINKS`/`FORCE_HYPERLINKS` (and `--no-hyperlinks`/`--hyperlinks`)
|
|
64
|
-
* decision here via {@linkcode resolveHyperlinkOverride}, keeping `process`
|
|
65
|
-
* access out of the output layer.
|
|
66
|
-
*
|
|
67
|
-
* @defaultValue `isTTY`
|
|
68
|
-
*/
|
|
69
|
-
readonly hyperlinks?: boolean;
|
|
70
|
-
}
|
|
71
|
-
/** Fully resolved output options with no optional fields. */
|
|
72
|
-
interface ResolvedOutputOptions {
|
|
73
|
-
readonly stdout: WriteFn;
|
|
74
|
-
readonly stderr: WriteFn;
|
|
75
|
-
readonly isTTY: boolean;
|
|
76
|
-
readonly verbosity: Verbosity;
|
|
77
|
-
readonly jsonMode: boolean;
|
|
78
|
-
readonly color: boolean;
|
|
79
|
-
readonly isHyperlinkSupported: boolean;
|
|
80
|
-
}
|
|
81
|
-
/** Store the exit code requested through an output channel. @internal */
|
|
82
|
-
declare function setRequestedExitCode(out: Out, code: number): void;
|
|
83
|
-
/** Read the exit code requested through an output channel. @internal */
|
|
84
|
-
declare function getRequestedExitCode(out: Out): number | undefined;
|
|
85
|
-
/** Clear a previously requested exit code from an output channel. @internal */
|
|
86
|
-
declare function clearRequestedExitCode(out: Out): void;
|
|
87
|
-
/**
|
|
88
|
-
* Forced hyperlink decision from the `--no-hyperlinks`/`--hyperlinks` argv
|
|
89
|
-
* flags, then `NO_HYPERLINKS`, then `FORCE_HYPERLINKS`; `undefined` when unset.
|
|
90
|
-
*
|
|
91
|
-
* Pure over its inputs — callers pass the adapter's `env`/`argv` so the
|
|
92
|
-
* output layer never touches `process` directly.
|
|
93
|
-
*
|
|
94
|
-
* @see https://no-hyperlinks.org/
|
|
95
|
-
*/
|
|
96
|
-
declare function resolveHyperlinkOverride(env: Readonly<Record<string, string | undefined>>, argv: readonly string[]): boolean | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* Concrete implementation of the {@linkcode Out} interface.
|
|
99
|
-
*
|
|
100
|
-
* Routes messages to the appropriate writer (stdout vs stderr) and
|
|
101
|
-
* respects the configured verbosity level.
|
|
102
|
-
*
|
|
103
|
-
* Handlers interact with this via the {@linkcode Out} interface — they never see
|
|
104
|
-
* {@linkcode OutputChannel} directly, which keeps the coupling minimal.
|
|
105
|
-
* Prefer {@link createOutput} unless you are extending the output layer.
|
|
106
|
-
*
|
|
107
|
-
* @internal
|
|
108
|
-
*/
|
|
109
|
-
declare class OutputChannel implements Out {
|
|
110
|
-
readonly [outBrand]: never;
|
|
111
|
-
/** @internal Resolved configuration. */
|
|
112
|
-
readonly options: ResolvedOutputOptions;
|
|
113
|
-
/** Semantic output policy snapshot shared by routing helpers. */
|
|
114
|
-
readonly policy: OutputPolicy;
|
|
115
|
-
/** Whether JSON output mode is active. */
|
|
116
|
-
readonly jsonMode: boolean;
|
|
117
|
-
/** Active verbosity level for informational output and activity rendering. */
|
|
118
|
-
readonly verbosity: Verbosity;
|
|
119
|
-
/**
|
|
120
|
-
* Whether stdout is connected to a TTY.
|
|
121
|
-
*
|
|
122
|
-
* When `jsonMode` is active, this reflects the underlying TTY status
|
|
123
|
-
* but decorative output should still be suppressed (jsonMode takes
|
|
124
|
-
* precedence).
|
|
125
|
-
*/
|
|
126
|
-
readonly isTTY: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Context-aware ANSI color palette.
|
|
129
|
-
*
|
|
130
|
-
* Enabled per the resolved `color` option — identity functions when
|
|
131
|
-
* colors are off, so handlers can style unconditionally.
|
|
132
|
-
*/
|
|
133
|
-
readonly color: Colors;
|
|
134
|
-
/**
|
|
135
|
-
* Whether OSC 8 hyperlinks should be emitted for this channel.
|
|
136
|
-
*
|
|
137
|
-
* Honors `NO_HYPERLINKS`/`FORCE_HYPERLINKS` and the
|
|
138
|
-
* `--no-hyperlinks`/`--hyperlinks` argv flags, falling back to `isTTY`.
|
|
139
|
-
*/
|
|
140
|
-
readonly isHyperlinkSupported: boolean;
|
|
141
|
-
constructor(options: ResolvedOutputOptions);
|
|
142
|
-
/**
|
|
143
|
-
* Write to stdout (normal output). Always emitted.
|
|
144
|
-
*
|
|
145
|
-
* In JSON mode, redirected to stderr so stdout is reserved for
|
|
146
|
-
* structured `json()` output only.
|
|
147
|
-
*/
|
|
148
|
-
log(message: string): void;
|
|
149
|
-
/**
|
|
150
|
-
* Informational message to stdout.
|
|
151
|
-
* Suppressed when verbosity is `'quiet'`.
|
|
152
|
-
*
|
|
153
|
-
* In JSON mode, redirected to stderr.
|
|
154
|
-
*/
|
|
155
|
-
info(message: string): void;
|
|
156
|
-
/**
|
|
157
|
-
* Status line to stderr (stdout stays clean for piping).
|
|
158
|
-
* Suppressed when verbosity is `'quiet'`.
|
|
159
|
-
*/
|
|
160
|
-
status(message: string): void;
|
|
161
|
-
/** Warning to stderr. Always emitted. */
|
|
162
|
-
warn(message: string): void;
|
|
163
|
-
/** Error to stderr. Always emitted. */
|
|
164
|
-
error(message: string): void;
|
|
165
|
-
/** Request a successful-process exit code without writing error output. */
|
|
166
|
-
setExitCode(code: number): void;
|
|
167
|
-
/**
|
|
168
|
-
* Emit a structured JSON value to stdout.
|
|
169
|
-
*
|
|
170
|
-
* Serialises `value` with `JSON.stringify` and writes to stdout
|
|
171
|
-
* regardless of JSON mode — `json()` always targets stdout.
|
|
172
|
-
*/
|
|
173
|
-
json(value: unknown): void;
|
|
174
|
-
/**
|
|
175
|
-
* Render tabular data.
|
|
176
|
-
*
|
|
177
|
-
* Default behavior matches the current output mode:
|
|
178
|
-
* - normal mode → text table to stdout
|
|
179
|
-
* - jsonMode → JSON array to stdout
|
|
180
|
-
*
|
|
181
|
-
* Per-call options can force text/json rendering and route text tables to
|
|
182
|
-
* stdout or stderr.
|
|
183
|
-
*/
|
|
184
|
-
table<T extends Record<string, unknown>>(rows: readonly T[], options: TableOptions): void;
|
|
185
|
-
table<T extends Record<string, unknown>>(rows: readonly T[], columns?: readonly TableColumn<T>[], options?: TableOptions): void;
|
|
186
|
-
/**
|
|
187
|
-
* Cleanup callback for the currently active spinner/progress handle.
|
|
188
|
-
*
|
|
189
|
-
* Set to `undefined` when no handle is active. The callback calls the
|
|
190
|
-
* appropriate terminal method (`.stop()` for spinners, `.done()` for
|
|
191
|
-
* progress) on the previous handle.
|
|
192
|
-
*
|
|
193
|
-
* @internal
|
|
194
|
-
*/
|
|
195
|
-
private activeCleanup;
|
|
196
|
-
/**
|
|
197
|
-
* Stop the currently active spinner/progress handle (if any).
|
|
198
|
-
*
|
|
199
|
-
* Called internally before creating a new handle to prevent overlap,
|
|
200
|
-
* and externally after handler execution to clean up leaked timers.
|
|
201
|
-
* Idempotent (safe to call when no handle is active).
|
|
202
|
-
*/
|
|
203
|
-
stopActive(): void;
|
|
204
|
-
/**
|
|
205
|
-
* Create a spinner handle.
|
|
206
|
-
*
|
|
207
|
-
* Mode dispatch:
|
|
208
|
-
* - quiet or `jsonMode` → noop (informational activity suppressed)
|
|
209
|
-
* - `isTTY` → animated TTY spinner (braille frames, ANSI overwrite)
|
|
210
|
-
* - `!isTTY && fallback: 'static'` → plain text at lifecycle boundaries
|
|
211
|
-
* - `!isTTY && fallback: 'silent'` (default) → noop
|
|
212
|
-
*
|
|
213
|
-
* All activity output (transient frames, terminal messages) routes to
|
|
214
|
-
* stderr so stdout remains clean for structured data and piping.
|
|
215
|
-
*
|
|
216
|
-
* If another spinner or progress handle is active, it is implicitly
|
|
217
|
-
* stopped before the new one starts.
|
|
218
|
-
*
|
|
219
|
-
* @virtual
|
|
220
|
-
*/
|
|
221
|
-
spinner(text: string, options?: SpinnerOptions): SpinnerHandle;
|
|
222
|
-
/**
|
|
223
|
-
* Create a progress handle.
|
|
224
|
-
*
|
|
225
|
-
* Mode dispatch:
|
|
226
|
-
* - quiet or `jsonMode` → noop (informational activity suppressed)
|
|
227
|
-
* - `isTTY` → animated TTY progress bar (determinate or indeterminate)
|
|
228
|
-
* - `!isTTY && fallback: 'static'` → plain text at lifecycle boundaries
|
|
229
|
-
* - `!isTTY && fallback: 'silent'` (default) → noop
|
|
230
|
-
*
|
|
231
|
-
* All activity output (transient frames, terminal messages) routes to
|
|
232
|
-
* stderr so stdout remains clean for structured data and piping.
|
|
233
|
-
*
|
|
234
|
-
* If another spinner or progress handle is active, it is implicitly
|
|
235
|
-
* stopped before the new one starts.
|
|
236
|
-
*
|
|
237
|
-
* @virtual
|
|
238
|
-
*/
|
|
239
|
-
progress(opts: ProgressOptions): ProgressHandle;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Output channel variant that returns capture handles for spinner/progress.
|
|
243
|
-
*
|
|
244
|
-
* Extends {@linkcode OutputChannel} to override `spinner()` and `progress()`, routing
|
|
245
|
-
* activity events into a shared {@linkcode ActivityEvent | ActivityEvent[]} for testkit assertion.
|
|
246
|
-
* Text output (log/info/warn/error) is handled by the parent class.
|
|
247
|
-
*
|
|
248
|
-
* @internal
|
|
249
|
-
*/
|
|
250
|
-
declare class CaptureOutputChannel extends OutputChannel {
|
|
251
|
-
private readonly activity;
|
|
252
|
-
constructor(options: ResolvedOutputOptions, activity: ActivityEvent[]);
|
|
253
|
-
/**
|
|
254
|
-
* Return a {@link CaptureSpinnerHandle} that records events into the activity log.
|
|
255
|
-
* @override
|
|
256
|
-
*/
|
|
257
|
-
spinner(text: string, _options?: SpinnerOptions): SpinnerHandle;
|
|
258
|
-
/**
|
|
259
|
-
* Return a {@link CaptureProgressHandle} that records events into the activity log.
|
|
260
|
-
* @override
|
|
261
|
-
*/
|
|
262
|
-
progress(opts: ProgressOptions): ProgressHandle;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Create an output channel.
|
|
266
|
-
*
|
|
267
|
-
* Low-level factory: action handlers already receive `out` automatically from
|
|
268
|
-
* `cli()`, `.execute()`, and `runCommand()`. Call `createOutput()` when you
|
|
269
|
-
* are embedding DreamCLI primitives into a custom runtime or need a standalone
|
|
270
|
-
* output implementation outside the normal command pipeline.
|
|
271
|
-
*
|
|
272
|
-
* @param options - Optional configuration. When omitted, output is
|
|
273
|
-
* discarded (useful for silent test runs). Pass `stdout`/`stderr`
|
|
274
|
-
* writers to direct output somewhere useful.
|
|
275
|
-
*
|
|
276
|
-
* @returns An {@link Out} instance backed by an {@link OutputChannel}.
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```ts
|
|
280
|
-
* // Production (wired by the runtime adapter)
|
|
281
|
-
* const out = createOutput({
|
|
282
|
-
* stdout: (s) => process.stdout.write(s),
|
|
283
|
-
* stderr: (s) => process.stderr.write(s),
|
|
284
|
-
* isTTY: process.stdout.isTTY === true,
|
|
285
|
-
* });
|
|
286
|
-
*
|
|
287
|
-
* // Test (capture output)
|
|
288
|
-
* const lines: string[] = [];
|
|
289
|
-
* const out = createOutput({
|
|
290
|
-
* stdout: (s) => lines.push(s),
|
|
291
|
-
* stderr: (s) => lines.push(s),
|
|
292
|
-
* });
|
|
293
|
-
* ```
|
|
294
|
-
*/
|
|
295
|
-
declare function createOutput(options?: OutputOptions): Out;
|
|
296
|
-
/** Captured output from a `createCaptureOutput` instance. */
|
|
297
|
-
interface CapturedOutput {
|
|
298
|
-
/**
|
|
299
|
-
* Lines written to stdout.
|
|
300
|
-
*
|
|
301
|
-
* In normal mode: `log`, `info`, and `json` output.
|
|
302
|
-
* In JSON mode: only `json` output (log/info redirected to stderr).
|
|
303
|
-
*/
|
|
304
|
-
readonly stdout: string[];
|
|
305
|
-
/**
|
|
306
|
-
* Lines written to stderr.
|
|
307
|
-
*
|
|
308
|
-
* In normal mode: `warn` and `error` output.
|
|
309
|
-
* In JSON mode: `warn`, `error`, `log`, and `info` output.
|
|
310
|
-
*/
|
|
311
|
-
readonly stderr: string[];
|
|
312
|
-
/**
|
|
313
|
-
* Activity events from spinner and progress handles.
|
|
314
|
-
*
|
|
315
|
-
* Captured separately from stdout/stderr to allow targeted assertions
|
|
316
|
-
* on activity lifecycle without parsing text output. Events are
|
|
317
|
-
* recorded in chronological order.
|
|
318
|
-
*/
|
|
319
|
-
readonly activity: ActivityEvent[];
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Create an output channel that captures all output into arrays.
|
|
323
|
-
*
|
|
324
|
-
* Useful in tests to assert on what a handler wrote without touching
|
|
325
|
-
* real I/O.
|
|
326
|
-
*
|
|
327
|
-
* @param options - Optional {@link OutputOptions} (minus `stdout`/`stderr`,
|
|
328
|
-
* which are wired to the capture buffers automatically).
|
|
329
|
-
*
|
|
330
|
-
* @returns A tuple of `[out, captured]` — the {@link Out} channel and the
|
|
331
|
-
* {@link CapturedOutput} buffers.
|
|
332
|
-
*
|
|
333
|
-
* @example
|
|
334
|
-
* ```ts
|
|
335
|
-
* const [out, captured] = createCaptureOutput();
|
|
336
|
-
* out.log('hello');
|
|
337
|
-
* out.warn('danger');
|
|
338
|
-
* expect(captured.stdout).toEqual(['hello\n']);
|
|
339
|
-
* expect(captured.stderr).toEqual(['danger\n']);
|
|
340
|
-
* ```
|
|
341
|
-
*/
|
|
342
|
-
declare function createCaptureOutput(options?: Omit<OutputOptions, 'stdout' | 'stderr'>): [out: Out, captured: CapturedOutput];
|
|
343
|
-
//#endregion
|
|
344
|
-
export { CaptureOutputChannel, type CapturedOutput, OutputChannel, type OutputOptions, type Verbosity, type WriteFn, clearRequestedExitCode, createCaptureOutput, createOutput, getRequestedExitCode, resolveHyperlinkOverride, setRequestedExitCode, writeLine };
|