@kjanat/dreamcli 4.2.0 → 5.1.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.
Files changed (45) hide show
  1. package/README.md +3 -1
  2. package/dist/completion-B4oRc2Ae.mjs +59 -0
  3. package/dist/completion.d.mts +11 -11
  4. package/dist/completion.mjs +1 -1
  5. package/dist/config-DSh3QJpX.mjs +1 -0
  6. package/dist/config.d.mts +11 -1
  7. package/dist/config.mjs +1 -1
  8. package/dist/core-BZx351-p.mjs +21 -0
  9. package/dist/dynamic-BK2lQF2M.mjs +1 -0
  10. package/dist/{index-C5CYWtxn.d.mts → index-CLtWJqwn.d.mts} +50 -10
  11. package/dist/{index-B6oD4_8b.d.mts → index-CuhI1Ynv.d.mts} +638 -47
  12. package/dist/{index-B3_9MlHz.d.mts → index-D683D09G.d.mts} +0 -2
  13. package/dist/{index-B_1Dmsdq.d.mts → index-DDhRLoTu.d.mts} +157 -21
  14. package/dist/{index-Cj7kXwQH.d.mts → index-DIWRV_wp.d.mts} +1 -7
  15. package/dist/{index-eF7SkQzQ.d.mts → index-Vjl2_m23.d.mts} +66 -15
  16. package/dist/{index-CaRNJH2R.d.mts → index-aTmg9yfl.d.mts} +14 -12
  17. package/dist/index.d.mts +41 -12
  18. package/dist/index.mjs +1 -1
  19. package/dist/json-schema-CYgq_hFu.mjs +59 -0
  20. package/dist/json-schema.d.mts +10 -2
  21. package/dist/json-schema.mjs +1 -1
  22. package/dist/{package-json-fYhxDdWD.mjs → package-json-hqUWeazy.mjs} +1 -1
  23. package/dist/prompt.d.mts +13 -8
  24. package/dist/prompt.mjs +1 -1
  25. package/dist/rolldown-runtime-DOYBPklu.mjs +1 -0
  26. package/dist/runtime.d.mts +20 -2
  27. package/dist/runtime.mjs +1 -1
  28. package/dist/session-BEKj0yLA.mjs +1 -0
  29. package/dist/{terminal-cbye9mKF.mjs → terminal-Dws_b5UK.mjs} +1 -1
  30. package/dist/test-prompter-euLYzWWO.mjs +1 -0
  31. package/dist/testkit.d.mts +18 -7
  32. package/dist/testkit.mjs +1 -1
  33. package/dist/version.d.mts +1 -3
  34. package/dist/version.mjs +1 -1
  35. package/dreamcli.schema.json +151 -2
  36. package/package.json +11 -11
  37. package/skills/cli-creation/SKILL.md +1 -1
  38. package/dist/adapter-DsmEc0WO.d.mts +0 -285
  39. package/dist/completion-BYhuYn2Q.mjs +0 -6
  40. package/dist/config-BgJZ-X4r.mjs +0 -1
  41. package/dist/core-B4Twhd48.mjs +0 -18
  42. package/dist/json-schema-DVyfq4bA.mjs +0 -52
  43. package/dist/rolldown-runtime-G4Kt5YOX.mjs +0 -1
  44. package/dist/session-CQsnVijE.mjs +0 -1
  45. package/dist/test-prompter-Ddkt9n5A.mjs +0 -1
@@ -1,7 +1,6 @@
1
- import { Kt as FlagPresence, Nn as PromptKind, Pt as DuplicatePolicy, Rn as NumberConstraints, T as ExampleMeta, Ut as FlagKind, b as CommandSchema, rt as ArgPresence, tt as ArgKind, xt as DuplicateKeys } from "./index-B6oD4_8b.mjs";
2
- import "./index-B_1Dmsdq.mjs";
3
- import { o as CLISchema } from "./index-eF7SkQzQ.mjs";
4
- //#region src/core/json-schema/constants.d.ts
1
+ import { A as ExampleMeta, Et as DuplicateKeys, Jt as FlagKind, Rn as PromptKind, T as CommandSchema, Un as NumberConstraints, Zt as FlagPresence, ct as ArgPresence, ot as ArgKind, zt as DuplicatePolicy } from "./index-CuhI1Ynv.mjs";
2
+ import "./index-DDhRLoTu.mjs";
3
+ import { o as CLISchema } from "./index-Vjl2_m23.mjs";
5
4
  /**
6
5
  * Identifiers of the definition document format.
7
6
  *
@@ -24,8 +23,6 @@ declare const DEFINITION_SCHEMA_URL = "https://dreamcli.kjanat.dev/schemas/defin
24
23
  * and `generateCommandSchema()` from `@kjanat/dreamcli/json-schema`.
25
24
  */
26
25
  declare const DEFINITION_SCHEMA_VERSION = 1;
27
- //#endregion
28
- //#region src/core/json-schema/index.d.ts
29
26
  /**
30
27
  * Options for JSON Schema generation.
31
28
  *
@@ -56,6 +53,17 @@ interface JsonSchemaOptions {
56
53
  * @defaultValue `true`
57
54
  */
58
55
  readonly includePrompts?: boolean;
56
+ /**
57
+ * CLI-wide env namespace recorded on the document, so a reader can tell
58
+ * `envVar: 'TOKEN'` that reads `FOO_TOKEN` from one that reads `TOKEN`.
59
+ *
60
+ * {@link generateSchema} defaults it to the CLI schema's own `envPrefix`.
61
+ * {@link generateCommandSchema} has no CLI to read it from, so pass the
62
+ * namespace the command runs under; `--help --json` does this itself.
63
+ *
64
+ * @defaultValue the CLI's `envPrefix` for {@link generateSchema}, none otherwise
65
+ */
66
+ readonly envPrefix?: string;
59
67
  }
60
68
  /**
61
69
  * A usage example inside a definition document.
@@ -92,13 +100,14 @@ type PromptDefinitionFragmentV1 = { [K in PromptKind]: {
92
100
  /**
93
101
  * Stdin binding of a flag or arg fragment.
94
102
  *
95
- * Every field is always written, so a document states the trigger, the sharing
96
- * mode, and the trimming without a reader having to know the builder's defaults.
103
+ * The trigger, sharing mode, and trimming are always written. `argv` is written
104
+ * only when false, preserving the default command-line behavior of older documents.
97
105
  */
98
106
  type StdinBindingFragmentV1 = {
99
107
  readonly when: 'dash' | 'missing' | 'dash-or-missing';
100
108
  readonly consume: 'exclusive' | 'broadcast';
101
109
  readonly trim: boolean;
110
+ readonly argv?: false;
102
111
  };
103
112
  /**
104
113
  * How one source's text decodes into collection elements.
@@ -143,6 +152,21 @@ type FlagStringConstraintsFragmentV1 = {
143
152
  readonly flags: string;
144
153
  };
145
154
  };
155
+ /**
156
+ * Indexed environment family of a flag or arg fragment, in place of `envVar`.
157
+ *
158
+ * `count` names the variable holding the number of entries. A `value` family
159
+ * reads one variable per entry; a `fields` family reads one variable per record
160
+ * field, in the order written. Every template carries `{index}`, which expands
161
+ * to the zero-based entry index.
162
+ */
163
+ type EnvIndexedFragmentV1 = {
164
+ readonly count: string;
165
+ readonly value: string;
166
+ } | {
167
+ readonly count: string;
168
+ readonly fields: Readonly<Record<string, string>>;
169
+ };
146
170
  /** Filesystem expectations of a flag or arg fragment. */
147
171
  type FlagPathChecksFragmentV1 = {
148
172
  readonly mustExist: boolean;
@@ -157,6 +181,8 @@ type FlagElementFragmentV1 = {
157
181
  readonly aliases?: readonly string[];
158
182
  readonly stdin?: StdinBindingFragmentV1;
159
183
  readonly envVar?: string;
184
+ readonly envIndexed?: EnvIndexedFragmentV1;
185
+ readonly envAbsolute?: true;
160
186
  readonly configPath?: string;
161
187
  readonly description?: string;
162
188
  readonly enumValues?: readonly string[];
@@ -218,6 +244,8 @@ type ArgDefinitionFragmentV1 = {
218
244
  readonly sensitive?: true;
219
245
  readonly description?: string;
220
246
  readonly envVar?: string;
247
+ readonly envIndexed?: EnvIndexedFragmentV1;
248
+ readonly envAbsolute?: true;
221
249
  readonly configPath?: string;
222
250
  readonly enumValues?: readonly string[];
223
251
  readonly elementSchema?: ArgElementFragmentV1;
@@ -243,6 +271,8 @@ type CommandDefinitionFragmentV1 = {
243
271
  readonly name: string;
244
272
  /** Human-readable description for help text. */
245
273
  readonly description?: string;
274
+ /** Longer explanation shown only in this command's help. */
275
+ readonly details?: string;
246
276
  /** Alternative names accepted for this command. */
247
277
  readonly aliases?: readonly string[];
248
278
  /** Whether the command is omitted from help listings. */
@@ -268,6 +298,12 @@ type DefinitionDocumentV1 = {
268
298
  readonly name: string;
269
299
  readonly version?: string;
270
300
  readonly description?: string;
301
+ /**
302
+ * CLI-wide env namespace. Each relative `envVar`, and each count and
303
+ * template of a relative `envIndexed`, reads with this prefix prepended; a
304
+ * fragment marked `envAbsolute` reads its names as written.
305
+ */
306
+ readonly envPrefix?: string;
271
307
  readonly defaultCommand?: CommandDefinitionFragmentV1;
272
308
  readonly commands: readonly CommandDefinitionFragmentV1[];
273
309
  };
@@ -281,6 +317,11 @@ type DefinitionDocumentV1 = {
281
317
  type CommandDefinitionDocumentV1 = CommandDefinitionFragmentV1 & {
282
318
  /** Definition document format version. */
283
319
  readonly schemaVersion: 1;
320
+ /**
321
+ * CLI-wide env namespace the command runs under, read the same way as
322
+ * {@link DefinitionDocumentV1.envPrefix}.
323
+ */
324
+ readonly envPrefix?: string;
284
325
  };
285
326
  /** The current whole-CLI definition document. */
286
327
  type DefinitionDocument = DefinitionDocumentV1;
@@ -398,5 +439,4 @@ declare function generateInputSchema(schema: CLISchema | CommandSchema, options?
398
439
  * ```
399
440
  */
400
441
  declare const definitionMetaSchema: Record<string, unknown>;
401
- //#endregion
402
- export { definitionMetaSchema as C, DEFINITION_SCHEMA_URL as D, generateSchema as E, DEFINITION_SCHEMA_VERSION as O, StdinBindingFragmentV1 as S, generateInputSchema as T, JsonSchemaOptions as _, CommandDefinitionFragmentV1 as a, SourceSplitFragmentV1 as b, ExampleDefinitionFragmentV1 as c, FlagNegationFragmentV1 as d, FlagPathChecksFragmentV1 as f, InputSchemaProperty as g, InputSchemaDocument as h, CommandDefinitionDocumentV1 as i, FlagDefinitionFragmentV1 as l, InputSchemaBranch as m, ArgElementFragmentV1 as n, DefinitionDocument as o, FlagStringConstraintsFragmentV1 as p, CommandDefinitionDocument as r, DefinitionDocumentV1 as s, ArgDefinitionFragmentV1 as t, FlagElementFragmentV1 as u, PromptChoiceFragmentV1 as v, generateCommandSchema as w, SplitPolicyFragmentV1 as x, PromptDefinitionFragmentV1 as y };
442
+ export { StdinBindingFragmentV1 as C, generateSchema as D, generateInputSchema as E, DEFINITION_SCHEMA_URL as O, SplitPolicyFragmentV1 as S, generateCommandSchema as T, InputSchemaProperty as _, CommandDefinitionFragmentV1 as a, PromptDefinitionFragmentV1 as b, EnvIndexedFragmentV1 as c, FlagElementFragmentV1 as d, FlagNegationFragmentV1 as f, InputSchemaDocument as g, InputSchemaBranch as h, CommandDefinitionDocumentV1 as i, DEFINITION_SCHEMA_VERSION as k, ExampleDefinitionFragmentV1 as l, FlagStringConstraintsFragmentV1 as m, ArgElementFragmentV1 as n, DefinitionDocument as o, FlagPathChecksFragmentV1 as p, CommandDefinitionDocument as r, DefinitionDocumentV1 as s, ArgDefinitionFragmentV1 as t, FlagDefinitionFragmentV1 as u, JsonSchemaOptions as v, definitionMetaSchema as w, SourceSplitFragmentV1 as x, PromptChoiceFragmentV1 as y };