@kjanat/dreamcli 3.0.0-rc.1 → 3.0.0-rc.2
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/CHANGELOG.md +26 -1
- package/dist/core/cli/dispatch.mjs +214 -1
- package/dist/core/cli/help-links.mjs +41 -1
- package/dist/core/cli/index.mjs +901 -1
- package/dist/core/cli/planner.mjs +300 -1
- package/dist/core/cli/plugin.mjs +41 -1
- package/dist/core/cli/propagate.mjs +57 -1
- package/dist/core/cli/root-help.mjs +208 -4
- package/dist/core/cli/root-surface.mjs +27 -1
- package/dist/core/cli/runtime-preflight.mjs +168 -1
- package/dist/core/completion/index.mjs +90 -1
- package/dist/core/completion/shells/bash.mjs +304 -3
- package/dist/core/completion/shells/fish.mjs +159 -2
- package/dist/core/completion/shells/powershell.mjs +353 -2
- package/dist/core/completion/shells/shared.mjs +154 -1
- package/dist/core/completion/shells/zsh.mjs +244 -2
- package/dist/core/config/index.mjs +246 -1
- package/dist/core/config/package-json.mjs +385 -3
- package/dist/core/errors/index.mjs +87 -1
- package/dist/core/execution/index.mjs +189 -1
- package/dist/core/help/ansi.mjs +122 -2
- package/dist/core/help/index.mjs +329 -7
- package/dist/core/json-schema/index.mjs +487 -9
- package/dist/core/json-schema/meta-descriptions.generated.mjs +93 -28
- package/dist/core/output/activity.mjs +452 -1
- package/dist/core/output/bind.mjs +56 -1
- package/dist/core/output/contracts.mjs +57 -1
- package/dist/core/output/display-value.mjs +32 -1
- package/dist/core/output/index.d.mts +21 -0
- package/dist/core/output/index.mjs +442 -2
- package/dist/core/output/renderers.mjs +46 -1
- package/dist/core/output/writer.mjs +12 -1
- package/dist/core/parse/index.mjs +555 -1
- package/dist/core/prompt/index.d.mts +0 -1
- package/dist/core/prompt/index.mjs +348 -6
- package/dist/core/resolve/args.mjs +105 -1
- package/dist/core/resolve/coerce.mjs +279 -1
- package/dist/core/resolve/config.mjs +19 -1
- package/dist/core/resolve/errors.mjs +140 -2
- package/dist/core/resolve/flags.mjs +196 -1
- package/dist/core/resolve/index.mjs +85 -1
- package/dist/core/resolve/property.d.mts +0 -1
- package/dist/core/resolve/property.mjs +45 -1
- package/dist/core/schema/arg.mjs +463 -1
- package/dist/core/schema/command.d.mts +18 -0
- package/dist/core/schema/command.mjs +712 -1
- package/dist/core/schema/flag.mjs +453 -1
- package/dist/core/schema/middleware.mjs +41 -1
- package/dist/core/schema/number-constraints.mjs +60 -1
- package/dist/core/schema-dsl/runtime.mjs +271 -2
- package/dist/core/schema-dsl/to-json-schema.mjs +74 -1
- package/dist/core/testkit/index.mjs +83 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +22 -1
- package/dist/runtime/adapter.mjs +82 -1
- package/dist/runtime/auto.mjs +46 -1
- package/dist/runtime/bun.mjs +28 -1
- package/dist/runtime/deno.mjs +217 -2
- package/dist/runtime/detect.mjs +45 -1
- package/dist/runtime/node.mjs +169 -2
- package/dist/runtime/paths.mjs +48 -1
- package/dist/runtime.mjs +7 -1
- package/dist/strings.mjs +22 -1
- package/dist/testkit.mjs +5 -1
- package/dist/version.mjs +7 -1
- package/package.json +17 -26
- package/src/core/cli/dispatch.ts +0 -355
- package/src/core/cli/help-links.ts +0 -82
- package/src/core/cli/index.ts +0 -1614
- package/src/core/cli/planner.ts +0 -656
- package/src/core/cli/plugin.ts +0 -117
- package/src/core/cli/propagate.ts +0 -97
- package/src/core/cli/root-help.ts +0 -342
- package/src/core/cli/root-surface.ts +0 -87
- package/src/core/cli/runtime-preflight.ts +0 -456
- package/src/core/completion/index.ts +0 -138
- package/src/core/completion/shells/bash.ts +0 -459
- package/src/core/completion/shells/fish.ts +0 -259
- package/src/core/completion/shells/powershell.ts +0 -439
- package/src/core/completion/shells/shared.ts +0 -310
- package/src/core/completion/shells/zsh.ts +0 -381
- package/src/core/config/index.ts +0 -417
- package/src/core/config/package-json.ts +0 -560
- package/src/core/errors/index.ts +0 -193
- package/src/core/execution/index.ts +0 -265
- package/src/core/help/ansi.ts +0 -144
- package/src/core/help/index.ts +0 -563
- package/src/core/json-schema/index.ts +0 -910
- package/src/core/json-schema/meta-descriptions.generated.ts +0 -202
- package/src/core/output/activity.ts +0 -575
- package/src/core/output/bind.ts +0 -59
- package/src/core/output/contracts.ts +0 -194
- package/src/core/output/display-value.ts +0 -48
- package/src/core/output/index.ts +0 -704
- package/src/core/output/renderers.ts +0 -125
- package/src/core/output/writer.ts +0 -46
- package/src/core/parse/index.ts +0 -742
- package/src/core/prompt/index.ts +0 -623
- package/src/core/resolve/args.ts +0 -144
- package/src/core/resolve/coerce.ts +0 -500
- package/src/core/resolve/config.ts +0 -26
- package/src/core/resolve/contracts.ts +0 -135
- package/src/core/resolve/errors.ts +0 -227
- package/src/core/resolve/flags.ts +0 -269
- package/src/core/resolve/index.ts +0 -108
- package/src/core/resolve/property.ts +0 -99
- package/src/core/schema/activity.ts +0 -240
- package/src/core/schema/arg.ts +0 -841
- package/src/core/schema/command.ts +0 -1500
- package/src/core/schema/flag.ts +0 -917
- package/src/core/schema/index.ts +0 -96
- package/src/core/schema/middleware.ts +0 -171
- package/src/core/schema/number-constraints.ts +0 -153
- package/src/core/schema/prompt.ts +0 -171
- package/src/core/schema/run.ts +0 -198
- package/src/core/schema-dsl/index.ts +0 -109
- package/src/core/schema-dsl/parse.ts +0 -262
- package/src/core/schema-dsl/runtime.ts +0 -609
- package/src/core/schema-dsl/to-json-schema.ts +0 -102
- package/src/core/testkit/index.ts +0 -147
- package/src/index.ts +0 -181
- package/src/runtime/adapter.ts +0 -303
- package/src/runtime/auto.ts +0 -86
- package/src/runtime/bun.ts +0 -48
- package/src/runtime/deno.ts +0 -367
- package/src/runtime/detect.ts +0 -105
- package/src/runtime/index.ts +0 -21
- package/src/runtime/node-builtins.d.ts +0 -27
- package/src/runtime/node.ts +0 -289
- package/src/runtime/paths.ts +0 -64
- package/src/runtime/support.ts +0 -77
- package/src/runtime.ts +0 -31
- package/src/schema.ts +0 -16
- package/src/strings.ts +0 -34
- package/src/testkit.ts +0 -25
- package/src/version.ts +0 -20
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal output renderer factories.
|
|
3
|
-
*
|
|
4
|
-
* Keeps concrete writer and activity-handle construction separate from the
|
|
5
|
-
* semantic output-policy layer.
|
|
6
|
-
*
|
|
7
|
-
* @module dreamcli/core/output/renderers
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {
|
|
12
|
-
ProgressHandle,
|
|
13
|
-
ProgressOptions,
|
|
14
|
-
SpinnerHandle,
|
|
15
|
-
} from '#internals/core/schema/activity.ts';
|
|
16
|
-
import {
|
|
17
|
-
noopProgressHandle,
|
|
18
|
-
noopSpinnerHandle,
|
|
19
|
-
StaticProgressHandle,
|
|
20
|
-
StaticSpinnerHandle,
|
|
21
|
-
TTYProgressHandle,
|
|
22
|
-
TTYSpinnerHandle,
|
|
23
|
-
} from './activity.ts';
|
|
24
|
-
import type { ActivityPolicy, OutputStream } from './contracts.ts';
|
|
25
|
-
import type { WriteFn } from './writer.ts';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Paired write functions for the two standard output streams.
|
|
29
|
-
*
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
|
-
interface OutputWriters {
|
|
33
|
-
/** Write function targeting standard output. */
|
|
34
|
-
readonly stdout: WriteFn;
|
|
35
|
-
/** Write function targeting standard error. */
|
|
36
|
-
readonly stderr: WriteFn;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Spinner handle paired with its optional teardown function.
|
|
41
|
-
*
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
interface SpinnerRenderResult {
|
|
45
|
-
/** The spinner handle exposed to command handlers. */
|
|
46
|
-
readonly handle: SpinnerHandle;
|
|
47
|
-
/** Defined only when the mode requires cleanup (TTY or static); `undefined` for noop. */
|
|
48
|
-
readonly cleanup: (() => void) | undefined;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Progress handle paired with its optional teardown function.
|
|
53
|
-
*
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
interface ProgressRenderResult {
|
|
57
|
-
/** The progress handle exposed to command handlers. */
|
|
58
|
-
readonly handle: ProgressHandle;
|
|
59
|
-
/** Defined only when the mode requires cleanup (TTY or static); `undefined` for noop. */
|
|
60
|
-
readonly cleanup: (() => void) | undefined;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** Select the concrete {@linkcode WriteFn} for a given stream label. @internal */
|
|
64
|
-
function resolveWriterForStream(writers: OutputWriters, stream: OutputStream): WriteFn {
|
|
65
|
-
return stream === 'stderr' ? writers.stderr : writers.stdout;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Create a spinner handle matching the resolved {@linkcode ActivityPolicy} mode. @internal */
|
|
69
|
-
function createSpinnerHandleFromPolicy(
|
|
70
|
-
policy: ActivityPolicy,
|
|
71
|
-
text: string,
|
|
72
|
-
stderr: WriteFn,
|
|
73
|
-
): SpinnerRenderResult {
|
|
74
|
-
if (policy.mode === 'noop') {
|
|
75
|
-
return {
|
|
76
|
-
handle: noopSpinnerHandle,
|
|
77
|
-
cleanup: undefined,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (policy.mode === 'tty') {
|
|
82
|
-
const handle = new TTYSpinnerHandle(text, stderr);
|
|
83
|
-
return {
|
|
84
|
-
handle,
|
|
85
|
-
cleanup: () => handle.stop(),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const handle = new StaticSpinnerHandle(text, stderr);
|
|
90
|
-
return {
|
|
91
|
-
handle,
|
|
92
|
-
cleanup: () => handle.stop(),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** Create a progress handle matching the resolved {@linkcode ActivityPolicy} mode. @internal */
|
|
97
|
-
function createProgressHandleFromPolicy(
|
|
98
|
-
policy: ActivityPolicy,
|
|
99
|
-
options: ProgressOptions,
|
|
100
|
-
stderr: WriteFn,
|
|
101
|
-
): ProgressRenderResult {
|
|
102
|
-
if (policy.mode === 'noop') {
|
|
103
|
-
return {
|
|
104
|
-
handle: noopProgressHandle,
|
|
105
|
-
cleanup: undefined,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (policy.mode === 'tty') {
|
|
110
|
-
const handle = new TTYProgressHandle(options, stderr);
|
|
111
|
-
return {
|
|
112
|
-
handle,
|
|
113
|
-
cleanup: () => handle.done(),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const handle = new StaticProgressHandle(options.label, stderr);
|
|
118
|
-
return {
|
|
119
|
-
handle,
|
|
120
|
-
cleanup: () => handle.done(),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export type { OutputWriters, ProgressRenderResult, SpinnerRenderResult };
|
|
125
|
-
export { createProgressHandleFromPolicy, createSpinnerHandleFromPolicy, resolveWriterForStream };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal I/O seam — the only write primitive the output module depends on.
|
|
3
|
-
*
|
|
4
|
-
* Extracted to its own file so that both `index.ts` (OutputChannel) and
|
|
5
|
-
* `activity.ts` (handle classes) can import it without a circular dependency.
|
|
6
|
-
*
|
|
7
|
-
* @module dreamcli/core/output/writer
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// --- Writer abstraction
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A function that writes a string somewhere.
|
|
15
|
-
*
|
|
16
|
-
* This is the only write primitive the output layer depends on.
|
|
17
|
-
* In production it usually wraps `process.stdout.write` or
|
|
18
|
-
* `process.stderr.write`; in tests it is often a simple string accumulator.
|
|
19
|
-
*
|
|
20
|
-
* The contract is intentionally tiny:
|
|
21
|
-
* - writes are synchronous fire-and-forget
|
|
22
|
-
* - callers decide whether to append a trailing newline
|
|
23
|
-
* - there is no backpressure or flush signal
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* const lines: string[] = [];
|
|
28
|
-
* const write: WriteFn = (data) => {
|
|
29
|
-
* lines.push(data);
|
|
30
|
-
* };
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
type WriteFn = (data: string) => void;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Write a message followed by a newline.
|
|
37
|
-
*
|
|
38
|
-
* @param write - The underlying write function.
|
|
39
|
-
* @param message - The text to write.
|
|
40
|
-
*/
|
|
41
|
-
function writeLine(write: WriteFn, message: string): void {
|
|
42
|
-
write(`${message}\n`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type { WriteFn };
|
|
46
|
-
export { writeLine };
|