@kjanat/dreamcli 1.0.0 → 2.0.1
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 +63 -6
- package/LICENSE +1 -1
- package/README.md +296 -164
- package/dist/core/cli/dispatch.d.mts +85 -0
- package/dist/core/cli/dispatch.mjs +1 -0
- package/dist/core/cli/index.d.mts +418 -0
- package/dist/core/cli/index.mjs +1 -0
- package/dist/core/cli/planner.d.mts +143 -0
- package/dist/core/cli/planner.mjs +1 -0
- package/dist/core/cli/plugin.d.mts +94 -0
- package/dist/core/cli/plugin.mjs +1 -0
- package/dist/core/cli/propagate.d.mts +39 -0
- package/dist/core/cli/propagate.mjs +1 -0
- package/dist/core/cli/root-help.d.mts +28 -0
- package/dist/core/cli/root-help.mjs +7 -0
- package/dist/core/cli/root-surface.d.mts +42 -0
- package/dist/core/cli/root-surface.mjs +1 -0
- package/dist/core/cli/runtime-preflight.d.mts +149 -0
- package/dist/core/cli/runtime-preflight.mjs +1 -0
- package/dist/core/completion/index.d.mts +46 -0
- package/dist/core/completion/index.mjs +1 -0
- package/dist/core/completion/shells/bash.d.mts +24 -0
- package/dist/core/completion/shells/bash.mjs +3 -0
- package/dist/core/completion/shells/fish.d.mts +20 -0
- package/dist/core/completion/shells/fish.mjs +2 -0
- package/dist/core/completion/shells/powershell.d.mts +14 -0
- package/dist/core/completion/shells/powershell.mjs +2 -0
- package/dist/core/completion/shells/shared.d.mts +139 -0
- package/dist/core/completion/shells/shared.mjs +1 -0
- package/dist/core/completion/shells/zsh.d.mts +24 -0
- package/dist/core/completion/shells/zsh.mjs +2 -0
- package/dist/core/config/index.d.mts +161 -0
- package/dist/core/config/index.mjs +1 -0
- package/dist/core/config/package-json.d.mts +68 -0
- package/dist/core/config/package-json.mjs +1 -0
- package/dist/core/errors/index.d.mts +126 -0
- package/dist/core/errors/index.mjs +1 -0
- package/dist/core/execution/index.d.mts +49 -0
- package/dist/core/execution/index.mjs +1 -0
- package/dist/core/help/index.d.mts +49 -0
- package/dist/core/help/index.mjs +8 -0
- package/dist/core/json-schema/index.d.mts +109 -0
- package/dist/core/json-schema/index.mjs +55 -0
- package/dist/core/json-schema/meta-descriptions.generated.d.mts +185 -0
- package/dist/core/json-schema/meta-descriptions.generated.mjs +28 -0
- package/dist/core/output/activity.d.mts +194 -0
- package/dist/core/output/activity.mjs +1 -0
- package/dist/core/output/contracts.d.mts +88 -0
- package/dist/core/output/contracts.mjs +1 -0
- package/dist/core/output/display-value.d.mts +19 -0
- package/dist/core/output/display-value.mjs +1 -0
- package/dist/core/output/index.d.mts +280 -0
- package/dist/core/output/index.mjs +2 -0
- package/dist/core/output/renderers.d.mts +46 -0
- package/dist/core/output/renderers.mjs +1 -0
- package/dist/core/output/writer.d.mts +40 -0
- package/dist/core/output/writer.mjs +1 -0
- package/dist/core/parse/index.d.mts +79 -0
- package/dist/core/parse/index.mjs +1 -0
- package/dist/core/prompt/index.d.mts +205 -0
- package/dist/core/prompt/index.mjs +6 -0
- package/dist/core/resolve/args.d.mts +8 -0
- package/dist/core/resolve/args.mjs +1 -0
- package/dist/core/resolve/coerce.d.mts +22 -0
- package/dist/core/resolve/coerce.mjs +1 -0
- package/dist/core/resolve/config.d.mts +10 -0
- package/dist/core/resolve/config.mjs +1 -0
- package/dist/core/resolve/contracts.d.mts +112 -0
- package/dist/core/resolve/errors.d.mts +11 -0
- package/dist/core/resolve/errors.mjs +2 -0
- package/dist/core/resolve/flags.d.mts +10 -0
- package/dist/core/resolve/flags.mjs +1 -0
- package/dist/core/resolve/index.d.mts +42 -0
- package/dist/core/resolve/index.mjs +1 -0
- package/dist/core/resolve/property.d.mts +47 -0
- package/dist/core/resolve/property.mjs +1 -0
- package/dist/core/schema/activity.d.mts +169 -0
- package/dist/core/schema/arg.d.mts +559 -0
- package/dist/core/schema/arg.mjs +1 -0
- package/dist/core/schema/command.d.mts +960 -0
- package/dist/core/schema/command.mjs +1 -0
- package/dist/core/schema/flag.d.mts +491 -0
- package/dist/core/schema/flag.mjs +1 -0
- package/dist/core/schema/index.d.mts +8 -0
- package/dist/core/schema/middleware.d.mts +122 -0
- package/dist/core/schema/middleware.mjs +1 -0
- package/dist/core/schema/prompt.d.mts +117 -0
- package/dist/core/schema/run.d.mts +171 -0
- package/dist/core/schema-dsl/runtime.d.mts +144 -0
- package/dist/core/schema-dsl/runtime.mjs +2 -0
- package/dist/core/schema-dsl/to-json-schema.d.mts +30 -0
- package/dist/core/schema-dsl/to-json-schema.mjs +1 -0
- package/dist/core/testkit/index.d.mts +54 -0
- package/dist/core/testkit/index.mjs +1 -0
- package/dist/index.d.mts +28 -920
- package/dist/index.mjs +1 -10
- package/dist/runtime/adapter.d.mts +212 -0
- package/dist/{adapter-B37d9oia.mjs → runtime/adapter.mjs} +1 -1
- package/dist/runtime/auto.d.mts +26 -0
- package/dist/runtime/auto.mjs +1 -0
- package/dist/runtime/bun.d.mts +28 -0
- package/dist/runtime/bun.mjs +1 -0
- package/dist/runtime/deno.d.mts +76 -0
- package/dist/runtime/deno.mjs +2 -0
- package/dist/runtime/detect.d.mts +86 -0
- package/dist/runtime/detect.mjs +1 -0
- package/dist/runtime/index.d.mts +7 -0
- package/dist/runtime/node.d.mts +65 -0
- package/dist/runtime/node.mjs +2 -0
- package/dist/runtime/paths.d.mts +31 -0
- package/dist/runtime/paths.mjs +1 -0
- package/dist/runtime/support.d.mts +42 -0
- package/dist/runtime/support.mjs +1 -0
- package/dist/runtime.d.mts +6 -252
- package/dist/runtime.mjs +1 -1
- package/dist/testkit.d.mts +5 -24
- package/dist/testkit.mjs +1 -1
- package/dist/version.d.mts +16 -0
- package/dist/version.mjs +1 -0
- package/dreamcli.schema.json +338 -0
- package/examples/basic.ts +2 -2
- package/examples/gh/package.json +7 -11
- package/examples/gh/src/commands/auth.ts +2 -2
- package/examples/gh/src/commands/issue.ts +4 -4
- package/examples/gh/src/commands/pr.ts +4 -4
- package/examples/gh/src/docs.ts +11 -0
- package/examples/gh/src/lib/auth.ts +1 -1
- package/examples/gh/src/main.test.ts +6 -5
- package/examples/gh/src/main.ts +8 -6
- package/examples/interactive.ts +3 -3
- package/examples/json-mode.ts +4 -6
- package/examples/middleware.ts +3 -3
- package/examples/multi-command.ts +3 -3
- package/examples/spinner-progress.ts +5 -5
- package/examples/testing.ts +8 -6
- package/package.json +70 -44
- package/src/core/cli/dispatch.ts +4 -0
- package/src/core/cli/index.ts +185 -632
- package/src/core/cli/planner.ts +413 -0
- package/src/core/cli/plugin.ts +7 -1
- package/src/core/cli/propagate.ts +1 -1
- package/src/core/cli/runtime-preflight.ts +409 -0
- package/src/core/completion/index.ts +15 -9
- package/src/core/completion/shells/bash.ts +6 -3
- package/src/core/completion/shells/fish.ts +245 -10
- package/src/core/completion/shells/powershell.ts +390 -9
- package/src/core/completion/shells/shared.ts +4 -4
- package/src/core/completion/shells/zsh.ts +12 -7
- package/src/core/config/index.ts +7 -4
- package/src/core/config/package-json.ts +6 -2
- package/src/core/errors/index.ts +23 -8
- package/src/core/execution/index.ts +270 -0
- package/src/core/help/index.ts +13 -15
- package/src/core/json-schema/index.ts +193 -7
- package/src/core/json-schema/meta-descriptions.generated.ts +202 -0
- package/src/core/output/contracts.ts +194 -0
- package/src/core/output/index.ts +47 -82
- package/src/core/output/renderers.ts +125 -0
- package/src/core/parse/index.ts +39 -21
- package/src/core/prompt/index.ts +44 -27
- package/src/core/resolve/args.ts +144 -0
- package/src/core/resolve/coerce.ts +432 -0
- package/src/core/resolve/config.ts +26 -0
- package/src/core/resolve/contracts.ts +135 -0
- package/src/core/resolve/errors.ts +227 -0
- package/src/core/resolve/flags.ts +205 -0
- package/src/core/resolve/index.ts +41 -1264
- package/src/core/resolve/property.ts +99 -0
- package/src/core/schema/activity.ts +3 -0
- package/src/core/schema/arg.ts +26 -14
- package/src/core/schema/command.ts +265 -38
- package/src/core/schema/flag.ts +120 -15
- package/src/core/schema/index.ts +11 -2
- package/src/core/schema/middleware.ts +6 -6
- package/src/core/schema/prompt.ts +9 -1
- package/src/core/schema/run.ts +25 -17
- package/src/core/schema-dsl/index.ts +109 -0
- package/src/core/schema-dsl/parse.ts +262 -0
- package/src/core/schema-dsl/runtime.ts +609 -0
- package/src/core/schema-dsl/to-json-schema.ts +102 -0
- package/src/core/testkit/index.ts +55 -297
- package/src/index.ts +10 -4
- package/src/runtime/adapter.ts +13 -10
- package/src/runtime/auto.ts +3 -3
- package/src/runtime/bun.ts +4 -4
- package/src/runtime/deno.ts +43 -29
- package/src/runtime/detect.ts +4 -1
- package/src/runtime/index.ts +1 -1
- package/src/runtime/node.ts +43 -21
- package/src/runtime/paths.ts +9 -3
- package/src/runtime/support.ts +20 -4
- package/src/runtime.ts +1 -1
- package/src/testkit.ts +10 -8
- package/dist/adapter-CCSh5juX.cjs +0 -1
- package/dist/adapter-DIwO-q7K.d.mts +0 -3447
- package/dist/adapter-DQnxxLiE.d.cts +0 -3447
- package/dist/auto-5cjZaF9V.mjs +0 -3
- package/dist/auto-B0eSgoDw.cjs +0 -3
- package/dist/index.cjs +0 -10
- package/dist/index.d.cts +0 -920
- package/dist/runtime.cjs +0 -1
- package/dist/runtime.d.cts +0 -253
- package/dist/testkit-CEDYPvhF.mjs +0 -14
- package/dist/testkit-ClIKijxC.cjs +0 -14
- package/dist/testkit.cjs +0 -1
- package/dist/testkit.d.cts +0 -25
- package/examples/gh/tsconfig.json +0 -37
- package/examples/tsconfig.json +0 -17
- package/src/core/cli/AGENTS.md +0 -72
- package/src/core/completion/AGENTS.md +0 -72
- package/src/core/completion/completion-test-helpers.ts +0 -48
- package/src/core/output/AGENTS.md +0 -69
- package/src/core/resolve/AGENTS.md +0 -69
- package/src/core/schema/AGENTS.md +0 -61
- package/src/core/testkit/AGENTS.md +0 -55
- package/src/runtime/AGENTS.md +0 -74
- package/src/runtime/test-helpers.ts +0 -40
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal shared property-model helpers for resolver coercion.
|
|
3
|
+
*
|
|
4
|
+
* This seam is intentionally narrow: flags and args share coercion-compatible
|
|
5
|
+
* kinds, but they do not share precedence order, fallback rules, or
|
|
6
|
+
* required-value validation.
|
|
7
|
+
*
|
|
8
|
+
* @module dreamcli/core/resolve/property
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { ArgSchema, FlagSchema } from '#internals/core/schema/index.ts';
|
|
13
|
+
|
|
14
|
+
/** Flag/arg kinds that share a common coercion path. */
|
|
15
|
+
const SHARED_PROPERTY_MODEL_KINDS = ['string', 'number', 'enum', 'custom'] as const;
|
|
16
|
+
|
|
17
|
+
/** Union of kind discriminants that participate in shared coercion. */
|
|
18
|
+
type SharedPropertyKind = (typeof SHARED_PROPERTY_MODEL_KINDS)[number];
|
|
19
|
+
|
|
20
|
+
/** Minimal coercion-relevant slice of a flag or arg schema, discriminated by kind. */
|
|
21
|
+
type SharedPropertySchema =
|
|
22
|
+
| { readonly kind: 'string' }
|
|
23
|
+
| { readonly kind: 'number' }
|
|
24
|
+
| { readonly kind: 'enum'; readonly enumValues: readonly string[] | undefined }
|
|
25
|
+
| { readonly kind: 'custom'; readonly parseFn?: (raw: unknown) => unknown };
|
|
26
|
+
|
|
27
|
+
/** Contract asserting which concerns are shared vs. kept separate between flags and args. */
|
|
28
|
+
interface SharedPropertyModelContract {
|
|
29
|
+
/** Only coercion logic is shared; resolution orchestration is not. */
|
|
30
|
+
readonly scope: 'coercion';
|
|
31
|
+
/** The kind discriminants that participate in shared coercion. */
|
|
32
|
+
readonly sharedKinds: readonly SharedPropertyKind[];
|
|
33
|
+
/** Flag and arg precedence chains remain independent. */
|
|
34
|
+
readonly keepsFlagAndArgPrecedenceSeparate: true;
|
|
35
|
+
/** Fallback-on-coercion-error rules remain independent. */
|
|
36
|
+
readonly keepsFallbackRulesSeparate: true;
|
|
37
|
+
/** Required-value validation remains independent. */
|
|
38
|
+
readonly keepsRequiredValueRulesSeparate: true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Runtime-accessible contract instance for property model tests. */
|
|
42
|
+
const sharedPropertyModelContract = {
|
|
43
|
+
scope: 'coercion',
|
|
44
|
+
sharedKinds: SHARED_PROPERTY_MODEL_KINDS,
|
|
45
|
+
keepsFlagAndArgPrecedenceSeparate: true,
|
|
46
|
+
keepsFallbackRulesSeparate: true,
|
|
47
|
+
keepsRequiredValueRulesSeparate: true,
|
|
48
|
+
} satisfies SharedPropertyModelContract;
|
|
49
|
+
|
|
50
|
+
/** Extract the shared coercion slice from a flag schema, or `undefined` for boolean/array (handled separately). */
|
|
51
|
+
function toSharedFlagPropertySchema(schema: FlagSchema): SharedPropertySchema | undefined {
|
|
52
|
+
switch (schema.kind) {
|
|
53
|
+
case 'string':
|
|
54
|
+
return { kind: 'string' };
|
|
55
|
+
case 'number':
|
|
56
|
+
return { kind: 'number' };
|
|
57
|
+
case 'enum':
|
|
58
|
+
return { kind: 'enum', enumValues: schema.enumValues };
|
|
59
|
+
case 'custom':
|
|
60
|
+
return schema.parseFn === undefined
|
|
61
|
+
? { kind: 'custom' }
|
|
62
|
+
: { kind: 'custom', parseFn: schema.parseFn };
|
|
63
|
+
case 'boolean':
|
|
64
|
+
case 'array':
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Extract the shared coercion slice from an arg schema (all arg kinds are shared). */
|
|
70
|
+
function toSharedArgPropertySchema(schema: ArgSchema): SharedPropertySchema {
|
|
71
|
+
switch (schema.kind) {
|
|
72
|
+
case 'string':
|
|
73
|
+
return { kind: 'string' };
|
|
74
|
+
case 'number':
|
|
75
|
+
return { kind: 'number' };
|
|
76
|
+
case 'enum':
|
|
77
|
+
return { kind: 'enum', enumValues: schema.enumValues };
|
|
78
|
+
case 'custom': {
|
|
79
|
+
if (schema.parseFn === undefined) {
|
|
80
|
+
return { kind: 'custom' };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const parseFn = schema.parseFn;
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
kind: 'custom',
|
|
87
|
+
parseFn: (raw: unknown): unknown => parseFn(typeof raw === 'string' ? raw : String(raw)),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type { SharedPropertyKind, SharedPropertyModelContract, SharedPropertySchema };
|
|
94
|
+
export {
|
|
95
|
+
SHARED_PROPERTY_MODEL_KINDS,
|
|
96
|
+
sharedPropertyModelContract,
|
|
97
|
+
toSharedArgPropertySchema,
|
|
98
|
+
toSharedFlagPropertySchema,
|
|
99
|
+
};
|
package/src/core/schema/arg.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Positional argument schema builder with full type inference.
|
|
3
3
|
*
|
|
4
4
|
* Each factory (`arg.string()`, `arg.number()`, `arg.enum()`, `arg.custom()`) returns an
|
|
5
|
-
* immutable
|
|
5
|
+
* immutable {@linkcode ArgBuilder} whose generic parameter tracks the value type,
|
|
6
6
|
* presence state, and variadic flag through the fluent chain.
|
|
7
7
|
*
|
|
8
8
|
* @module dreamcli/core/schema/arg
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
// --- Type-level configuration (phantom state tracked through the chain)
|
|
12
12
|
|
|
13
|
+
/** All arg presence states as a runtime array. */
|
|
14
|
+
const ARG_PRESENCES = ['required', 'optional', 'defaulted'] as const;
|
|
15
|
+
|
|
13
16
|
/**
|
|
14
17
|
* Presence describes whether a positional arg is guaranteed to exist when the
|
|
15
18
|
* action handler runs:
|
|
@@ -18,7 +21,7 @@
|
|
|
18
21
|
* - `'optional'` — may be `undefined` if not supplied
|
|
19
22
|
* - `'defaulted'` — always present (falls back to default value)
|
|
20
23
|
*/
|
|
21
|
-
type ArgPresence =
|
|
24
|
+
type ArgPresence = (typeof ARG_PRESENCES)[number];
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Compile-time state carried through the builder chain.
|
|
@@ -35,7 +38,7 @@ interface ArgConfig {
|
|
|
35
38
|
// --- Type-level helpers
|
|
36
39
|
|
|
37
40
|
/**
|
|
38
|
-
* Advanced type helper used by
|
|
41
|
+
* Advanced type helper used by {@linkcode ArgBuilder} modifiers to replace presence.
|
|
39
42
|
* Most consumers rely on inference and never reference this directly.
|
|
40
43
|
*/
|
|
41
44
|
type WithArgPresence<C extends ArgConfig, P extends ArgPresence> = {
|
|
@@ -45,7 +48,7 @@ type WithArgPresence<C extends ArgConfig, P extends ArgPresence> = {
|
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
/**
|
|
48
|
-
* Advanced type helper used by
|
|
51
|
+
* Advanced type helper used by {@linkcode ArgBuilder.variadic | ArgBuilder.variadic()}.
|
|
49
52
|
* Most consumers rely on inference and never reference this directly.
|
|
50
53
|
*/
|
|
51
54
|
type WithVariadic<C extends ArgConfig> = {
|
|
@@ -71,7 +74,7 @@ type ResolvedArgValue<C extends ArgConfig> = C['variadic'] extends true
|
|
|
71
74
|
? C['valueType'] | undefined
|
|
72
75
|
: C['valueType'];
|
|
73
76
|
|
|
74
|
-
/** Extract the resolved value type from an
|
|
77
|
+
/** Extract the resolved value type from an {@linkcode ArgBuilder}. */
|
|
75
78
|
type InferArg<B> = B extends ArgBuilder<infer C extends ArgConfig> ? ResolvedArgValue<C> : never;
|
|
76
79
|
|
|
77
80
|
/** Extract resolved value types from a record of builders. */
|
|
@@ -81,14 +84,17 @@ type InferArgs<T extends Record<string, ArgBuilder<ArgConfig>>> = {
|
|
|
81
84
|
|
|
82
85
|
// --- Runtime schema data
|
|
83
86
|
|
|
87
|
+
/** All arg kind discriminators as a runtime array. */
|
|
88
|
+
const ARG_KINDS = ['string', 'number', 'enum', 'custom'] as const;
|
|
89
|
+
|
|
84
90
|
/** Discriminator for the kind of value an arg accepts. */
|
|
85
|
-
type ArgKind =
|
|
91
|
+
type ArgKind = (typeof ARG_KINDS)[number];
|
|
86
92
|
|
|
87
93
|
/** Custom parse function for `arg.custom()`. */
|
|
88
94
|
type ArgParseFn<T> = (raw: string) => T;
|
|
89
95
|
|
|
90
96
|
/**
|
|
91
|
-
* The runtime descriptor stored inside every
|
|
97
|
+
* The runtime descriptor stored inside every {@linkcode ArgBuilder}. Consumers (parser,
|
|
92
98
|
* help generator) read this to understand the arg's shape without touching
|
|
93
99
|
* generics.
|
|
94
100
|
*/
|
|
@@ -183,8 +189,11 @@ function createArgSchema(kind: ArgKind, overrides?: Partial<ArgSchema>): ArgSche
|
|
|
183
189
|
* and variadic state through the fluent chain. Each modifier returns a **new**
|
|
184
190
|
* builder — the original is never mutated.
|
|
185
191
|
*
|
|
186
|
-
* @example
|
|
192
|
+
* @example
|
|
187
193
|
* ```ts
|
|
194
|
+
* // Full command with multiple args and modifiers
|
|
195
|
+
* import { command, arg } from '@kjanat/dreamcli';
|
|
196
|
+
*
|
|
188
197
|
* command('deploy')
|
|
189
198
|
* .arg('target', arg.string()
|
|
190
199
|
* .env('DEPLOY_TARGET')
|
|
@@ -204,8 +213,9 @@ function createArgSchema(kind: ArgKind, overrides?: Partial<ArgSchema>): ArgSche
|
|
|
204
213
|
* });
|
|
205
214
|
* ```
|
|
206
215
|
*
|
|
207
|
-
* @example
|
|
216
|
+
* @example
|
|
208
217
|
* ```ts
|
|
218
|
+
* // Type inference
|
|
209
219
|
* const target = arg.string();
|
|
210
220
|
* type T = InferArg<typeof target>; // string
|
|
211
221
|
*
|
|
@@ -222,11 +232,13 @@ class ArgBuilder<C extends ArgConfig> {
|
|
|
222
232
|
|
|
223
233
|
/**
|
|
224
234
|
* @internal Type brand — exists only in the type system (`declare`
|
|
225
|
-
* produces no runtime property). Used by
|
|
235
|
+
* produces no runtime property). Used by {@linkcode InferArg} / {@linkcode InferArgs}.
|
|
226
236
|
*/
|
|
227
237
|
declare readonly _config: C;
|
|
228
238
|
|
|
229
239
|
/**
|
|
240
|
+
* Create an arg builder from a pre-built schema descriptor.
|
|
241
|
+
*
|
|
230
242
|
* @param schema - Runtime descriptor for this positional argument.
|
|
231
243
|
*/
|
|
232
244
|
constructor(schema: ArgSchema) {
|
|
@@ -473,7 +485,7 @@ class ArgBuilder<C extends ArgConfig> {
|
|
|
473
485
|
/**
|
|
474
486
|
* Arg factory functions — the public API for creating positional arguments.
|
|
475
487
|
*
|
|
476
|
-
* Each method returns an
|
|
488
|
+
* Each method returns an {@linkcode ArgBuilder} seeded with the correct {@linkcode ArgKind}
|
|
477
489
|
* and initial type-level config. Chain modifiers (`.optional()`, `.env()`,
|
|
478
490
|
* `.default()`, `.variadic()`, `.stdin()`, `.describe()`, `.deprecated()`) to refine.
|
|
479
491
|
*
|
|
@@ -629,7 +641,7 @@ interface ArgFactory {
|
|
|
629
641
|
* Positional argument schema factory.
|
|
630
642
|
*
|
|
631
643
|
* Entry point for defining args on a command. Use `arg.<kind>()` to create
|
|
632
|
-
* an
|
|
644
|
+
* an {@linkcode ArgBuilder}, then chain modifiers and pass the result to
|
|
633
645
|
* `command().arg(name, builder)`.
|
|
634
646
|
*
|
|
635
647
|
* Four kinds are available:
|
|
@@ -640,7 +652,7 @@ interface ArgFactory {
|
|
|
640
652
|
*
|
|
641
653
|
* @example
|
|
642
654
|
* ```ts
|
|
643
|
-
* import { command, arg } from 'dreamcli';
|
|
655
|
+
* import { command, arg } from '@kjanat/dreamcli';
|
|
644
656
|
*
|
|
645
657
|
* command('deploy')
|
|
646
658
|
* .arg('target', arg.string().env('DEPLOY_TARGET').describe('Where to deploy'))
|
|
@@ -704,4 +716,4 @@ export type {
|
|
|
704
716
|
WithArgPresence,
|
|
705
717
|
WithVariadic,
|
|
706
718
|
};
|
|
707
|
-
export { ArgBuilder, arg, createArgSchema };
|
|
719
|
+
export { ARG_KINDS, ARG_PRESENCES, ArgBuilder, arg, createArgSchema };
|