@kjanat/dreamcli 3.0.1 → 4.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.
Files changed (137) hide show
  1. package/CHANGELOG.md +962 -1
  2. package/README.md +7 -3
  3. package/dist/core/cli/builtins.d.mts +47 -0
  4. package/dist/core/cli/builtins.mjs +135 -0
  5. package/dist/core/cli/compiled.d.mts +29 -0
  6. package/dist/core/cli/compiled.mjs +76 -0
  7. package/dist/core/cli/dispatch.d.mts +9 -85
  8. package/dist/core/cli/help-links.d.mts +2 -14
  9. package/dist/core/cli/index.d.mts +282 -101
  10. package/dist/core/cli/index.mjs +497 -264
  11. package/dist/core/cli/planner.d.mts +13 -86
  12. package/dist/core/cli/planner.mjs +47 -30
  13. package/dist/core/cli/plugin.d.mts +1 -1
  14. package/dist/core/cli/propagate.mjs +1 -1
  15. package/dist/core/cli/reserved-flags.d.mts +1 -0
  16. package/dist/core/cli/reserved-flags.mjs +158 -0
  17. package/dist/core/cli/root-help.d.mts +1 -47
  18. package/dist/core/cli/root-help.mjs +37 -47
  19. package/dist/core/cli/root-output-flags.d.mts +1 -0
  20. package/dist/core/cli/root-output-flags.mjs +169 -0
  21. package/dist/core/cli/root-surface.d.mts +1 -68
  22. package/dist/core/cli/root-surface.mjs +2 -2
  23. package/dist/core/cli/runtime-preflight.d.mts +1 -199
  24. package/dist/core/cli/runtime-preflight.mjs +67 -17
  25. package/dist/core/completion/index.d.mts +2 -2
  26. package/dist/core/completion/shells/bash.d.mts +0 -1
  27. package/dist/core/completion/shells/bash.mjs +2 -1
  28. package/dist/core/completion/shells/fish.d.mts +0 -1
  29. package/dist/core/completion/shells/fish.mjs +2 -1
  30. package/dist/core/completion/shells/powershell.d.mts +0 -1
  31. package/dist/core/completion/shells/powershell.mjs +2 -1
  32. package/dist/core/completion/shells/shared.d.mts +3 -114
  33. package/dist/core/completion/shells/shared.mjs +9 -39
  34. package/dist/core/completion/shells/zsh.d.mts +0 -1
  35. package/dist/core/completion/shells/zsh.mjs +2 -1
  36. package/dist/core/config/index.d.mts +3 -3
  37. package/dist/core/config/index.mjs +2 -2
  38. package/dist/core/config/package-json.d.mts +2 -33
  39. package/dist/core/config/package-json.mjs +1 -34
  40. package/dist/core/errors/index.d.mts +7 -7
  41. package/dist/core/execution/index.d.mts +1 -48
  42. package/dist/core/execution/index.mjs +42 -27
  43. package/dist/core/help/ansi.d.mts +0 -11
  44. package/dist/core/help/index.d.mts +3 -35
  45. package/dist/core/help/index.mjs +29 -6
  46. package/dist/core/help/theme.d.mts +1 -21
  47. package/dist/core/json-schema/index.d.mts +279 -10
  48. package/dist/core/json-schema/index.mjs +482 -237
  49. package/dist/core/json-schema/meta-descriptions.generated.d.mts +79 -7
  50. package/dist/core/json-schema/meta-descriptions.generated.mjs +40 -6
  51. package/dist/core/output/activity.d.mts +1 -193
  52. package/dist/core/output/activity.mjs +1 -1
  53. package/dist/core/output/bind.d.mts +1 -37
  54. package/dist/core/output/contracts.d.mts +7 -13
  55. package/dist/core/output/contracts.mjs +1 -1
  56. package/dist/core/output/display-value.d.mts +1 -19
  57. package/dist/core/output/index.d.mts +5 -187
  58. package/dist/core/output/index.mjs +44 -9
  59. package/dist/core/output/renderers.d.mts +1 -45
  60. package/dist/core/output/writer.d.mts +0 -1
  61. package/dist/core/parse/index.d.mts +27 -5
  62. package/dist/core/parse/index.mjs +350 -227
  63. package/dist/core/parse/occurrences.d.mts +89 -0
  64. package/dist/core/parse/occurrences.mjs +114 -0
  65. package/dist/core/prompt/index.d.mts +3 -3
  66. package/dist/core/read-flags/index.d.mts +150 -0
  67. package/dist/core/read-flags/index.mjs +217 -0
  68. package/dist/core/resolve/args.d.mts +35 -4
  69. package/dist/core/resolve/args.mjs +132 -55
  70. package/dist/core/resolve/coerce.d.mts +66 -9
  71. package/dist/core/resolve/coerce.mjs +834 -270
  72. package/dist/core/resolve/config.d.mts +1 -10
  73. package/dist/core/resolve/contracts.d.mts +67 -44
  74. package/dist/core/resolve/errors.mjs +29 -21
  75. package/dist/core/resolve/flags.d.mts +36 -9
  76. package/dist/core/resolve/flags.mjs +129 -151
  77. package/dist/core/resolve/index.d.mts +8 -6
  78. package/dist/core/resolve/index.mjs +51 -18
  79. package/dist/core/resolve/path-checks.d.mts +47 -0
  80. package/dist/core/resolve/path-checks.mjs +102 -0
  81. package/dist/core/resolve/redaction.d.mts +12 -0
  82. package/dist/core/resolve/redaction.mjs +14 -0
  83. package/dist/core/resolve/stages.d.mts +85 -0
  84. package/dist/core/resolve/stages.mjs +170 -0
  85. package/dist/core/resolve/standard.d.mts +1 -24
  86. package/dist/core/resolve/standard.mjs +141 -43
  87. package/dist/core/schema/activity.d.mts +16 -16
  88. package/dist/core/schema/arg.d.mts +849 -71
  89. package/dist/core/schema/arg.mjs +727 -54
  90. package/dist/core/schema/brand.d.mts +17 -0
  91. package/dist/core/schema/cardinality.d.mts +301 -0
  92. package/dist/core/schema/cardinality.mjs +514 -0
  93. package/dist/core/schema/command.d.mts +173 -119
  94. package/dist/core/schema/command.mjs +305 -42
  95. package/dist/core/schema/flag.d.mts +515 -173
  96. package/dist/core/schema/flag.mjs +576 -78
  97. package/dist/core/schema/index.d.mts +11 -8
  98. package/dist/core/schema/index.mjs +10 -0
  99. package/dist/core/schema/middleware.d.mts +15 -12
  100. package/dist/core/schema/number-constraints.d.mts +5 -5
  101. package/dist/core/schema/prompt.d.mts +4 -4
  102. package/dist/core/schema/provenance.d.mts +99 -0
  103. package/dist/core/schema/provenance.mjs +28 -0
  104. package/dist/core/schema/run.d.mts +21 -60
  105. package/dist/core/schema/source.d.mts +179 -0
  106. package/dist/core/schema/source.mjs +206 -0
  107. package/dist/core/schema/standard.d.mts +12 -19
  108. package/dist/core/schema/stdin.d.mts +87 -0
  109. package/dist/core/schema/stdin.mjs +91 -0
  110. package/dist/core/schema/string-constraints.d.mts +16 -5
  111. package/dist/core/schema/string-constraints.mjs +18 -1
  112. package/dist/core/schema/value-parsers.d.mts +81 -9
  113. package/dist/core/schema/value-parsers.mjs +19 -1
  114. package/dist/core/schema/value.d.mts +242 -0
  115. package/dist/core/schema/value.mjs +573 -0
  116. package/dist/core/testkit/index.d.mts +30 -3
  117. package/dist/core/testkit/index.mjs +40 -26
  118. package/dist/index.d.mts +21 -16
  119. package/dist/index.mjs +10 -6
  120. package/dist/runtime/adapter.d.mts +3 -3
  121. package/dist/runtime/deno.d.mts +3 -3
  122. package/dist/runtime/detect.d.mts +2 -2
  123. package/dist/runtime/node.d.mts +3 -3
  124. package/dist/runtime/paths.d.mts +1 -31
  125. package/dist/runtime.d.mts +4 -4
  126. package/dist/strings.d.mts +1 -16
  127. package/dist/testkit.d.mts +2 -2
  128. package/dist/testkit.mjs +1 -1
  129. package/dist/version.d.mts +0 -13
  130. package/dist/version.mjs +2 -2
  131. package/dreamcli.schema.json +368 -78
  132. package/examples/interactive.ts +6 -5
  133. package/package.json +12 -11
  134. package/skills/cli-creation/SKILL.md +72 -16
  135. package/skills/cli-creation/references/pattern-cookbook.md +169 -11
  136. package/dist/core/resolve/property.d.mts +0 -51
  137. package/dist/core/resolve/property.mjs +0 -53
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://cdn.jsdelivr.net/npm/@kjanat/dreamcli/dreamcli.schema.json",
3
+ "$id": "https://dreamcli.kjanat.dev/schemas/definition/v1.schema.json",
4
4
  "title": "@kjanat/dreamcli definition schema",
5
- "description": "Runtime descriptor for the CLI program.\n\nStores the program name, version, description, and registered commands.\\\nBuilt incrementally by CLIBuilder.",
5
+ "description": "Runtime descriptor for the CLI program.\n\nStores the program name, version, description, and registered command schemas.\\\nSealed by createCLISchema and rebuilt by each CLIBuilder step.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "properties": {
9
9
  "$schema": {
10
- "const": "https://cdn.jsdelivr.net/npm/@kjanat/dreamcli/dreamcli.schema.json"
10
+ "const": "https://dreamcli.kjanat.dev/schemas/definition/v1.schema.json"
11
+ },
12
+ "schemaVersion": {
13
+ "const": 1
11
14
  },
12
15
  "name": {
13
16
  "type": "string",
@@ -23,18 +26,19 @@
23
26
  },
24
27
  "defaultCommand": {
25
28
  "$ref": "#/$defs/command",
26
- "description": "Default command dispatched when no subcommand matches.\n\nWhen set, the CLI root behaves like a hybrid command group: subcommands\ndispatch by name as usual, but empty argv or flags-only argv falls\nthrough to this command instead of showing root help.\n\nSet via the .default() builder method."
29
+ "description": "Schema of the default command dispatched when no subcommand matches.\n\nWhen set, the CLI root behaves like a hybrid command group: subcommands\ndispatch by name as usual, but empty argv or flags-only argv falls\nthrough to this command instead of showing root help.\n\nSet via the .default() builder method\nor the `defaultCommand` field of CLIDefinition."
27
30
  },
28
31
  "commands": {
29
32
  "type": "array",
30
33
  "items": {
31
34
  "$ref": "#/$defs/command"
32
35
  },
33
- "description": "Registered commands (type-erased for heterogeneous storage)."
36
+ "description": "Schemas of the registered commands, in registration order."
34
37
  }
35
38
  },
36
39
  "required": [
37
40
  "$schema",
41
+ "schemaVersion",
38
42
  "name",
39
43
  "commands"
40
44
  ],
@@ -97,7 +101,72 @@
97
101
  "args",
98
102
  "commands"
99
103
  ],
100
- "description": "Runtime descriptor produced by CommandBuilder.\n\nConsumers (parser, help generator, CLI dispatcher) read this to\nunderstand the command's shape — flags, args, aliases, subcommands,\nmiddleware, and interactive resolver."
104
+ "description": "Runtime descriptor produced by CommandBuilder.\n\nConsumers (parser, help generator, CLI dispatcher) read this to\nunderstand the command's shape — flags, args, aliases, subcommands,\nand interactive resolver."
105
+ },
106
+ "commandDocument": {
107
+ "type": "object",
108
+ "additionalProperties": false,
109
+ "properties": {
110
+ "schemaVersion": {
111
+ "const": 1,
112
+ "description": "Version of the definition document format emitted by generateSchema\nand generateCommandSchema."
113
+ },
114
+ "name": {
115
+ "type": "string",
116
+ "description": "The command name used for dispatch."
117
+ },
118
+ "description": {
119
+ "type": "string",
120
+ "description": "Human-readable description for help text."
121
+ },
122
+ "aliases": {
123
+ "type": "array",
124
+ "items": {
125
+ "type": "string"
126
+ },
127
+ "description": "Alternative names accepted for this command."
128
+ },
129
+ "hidden": {
130
+ "const": true,
131
+ "description": "Whether the command is omitted from help listings."
132
+ },
133
+ "examples": {
134
+ "type": "array",
135
+ "items": {
136
+ "$ref": "#/$defs/example"
137
+ },
138
+ "description": "Usage examples attached to the command."
139
+ },
140
+ "flags": {
141
+ "type": "object",
142
+ "additionalProperties": {
143
+ "$ref": "#/$defs/flag"
144
+ },
145
+ "description": "Named flag definitions keyed by flag name."
146
+ },
147
+ "args": {
148
+ "type": "array",
149
+ "items": {
150
+ "$ref": "#/$defs/arg"
151
+ },
152
+ "description": "Positional argument definitions in CLI order."
153
+ },
154
+ "commands": {
155
+ "type": "array",
156
+ "items": {
157
+ "$ref": "#/$defs/command"
158
+ },
159
+ "description": "Nested subcommand definitions."
160
+ }
161
+ },
162
+ "required": [
163
+ "schemaVersion",
164
+ "name",
165
+ "flags",
166
+ "args",
167
+ "commands"
168
+ ],
169
+ "description": "A single-command definition document, version 1.\n\nProduced by generateCommandSchema. Same shape as a\nCommandDefinitionFragmentV1 plus the `schemaVersion` every standalone\ndocument carries."
101
170
  },
102
171
  "flag": {
103
172
  "type": "object",
@@ -134,6 +203,10 @@
134
203
  },
135
204
  "description": "Short/long aliases (e.g. `[{ name: 'f', hidden: false }]` for `--force`)."
136
205
  },
206
+ "stdin": {
207
+ "$ref": "#/$defs/stdin",
208
+ "description": "Stdin binding set by `.stdin()` (`undefined` when the flag never reads\nstdin). See StdinBinding."
209
+ },
137
210
  "envVar": {
138
211
  "type": "string",
139
212
  "description": "Environment variable name for v0.2+ resolution."
@@ -154,87 +227,34 @@
154
227
  "description": "Allowed literal values when `kind === 'enum'`."
155
228
  },
156
229
  "numberConstraints": {
157
- "type": "object",
158
- "additionalProperties": false,
159
- "properties": {
160
- "min": {
161
- "type": "number"
162
- },
163
- "max": {
164
- "type": "number"
165
- },
166
- "int": {
167
- "type": "boolean"
168
- },
169
- "finite": {
170
- "type": "boolean"
171
- }
172
- }
230
+ "$ref": "#/$defs/numberConstraints"
173
231
  },
174
232
  "stringConstraints": {
175
- "type": "object",
176
- "additionalProperties": false,
177
- "properties": {
178
- "nonEmpty": {
179
- "type": "boolean"
180
- },
181
- "minLength": {
182
- "type": "integer",
183
- "minimum": 0
184
- },
185
- "maxLength": {
186
- "type": "integer",
187
- "minimum": 0
188
- },
189
- "pattern": {
190
- "type": "object",
191
- "additionalProperties": false,
192
- "properties": {
193
- "source": {
194
- "type": "string"
195
- },
196
- "flags": {
197
- "type": "string"
198
- }
199
- },
200
- "required": [
201
- "source",
202
- "flags"
203
- ]
204
- }
205
- }
233
+ "$ref": "#/$defs/stringConstraints"
206
234
  },
207
235
  "elementSchema": {
208
236
  "$ref": "#/$defs/flag",
209
- "description": "Element schema when `kind === 'array'`."
237
+ "description": "Element schema when `kind === 'array'` or `kind === 'keyValue'`."
210
238
  },
211
239
  "separator": {
212
240
  "type": "string",
213
241
  "minLength": 1
214
242
  },
243
+ "split": {
244
+ "$ref": "#/$defs/split"
245
+ },
246
+ "duplicateKeys": {
247
+ "enum": [
248
+ "first",
249
+ "last",
250
+ "error"
251
+ ]
252
+ },
215
253
  "unique": {
216
- "type": "boolean"
254
+ "const": true
217
255
  },
218
256
  "pathChecks": {
219
- "type": "object",
220
- "additionalProperties": false,
221
- "properties": {
222
- "mustExist": {
223
- "type": "boolean"
224
- },
225
- "type": {
226
- "enum": [
227
- "file",
228
- "directory"
229
- ]
230
- },
231
- "create": {
232
- "type": "boolean"
233
- }
234
- },
235
- "required": [
236
- "mustExist"
237
- ]
257
+ "$ref": "#/$defs/pathChecks"
238
258
  },
239
259
  "valueHint": {
240
260
  "type": "string"
@@ -277,6 +297,98 @@
277
297
  ],
278
298
  "description": "The runtime descriptor stored inside every FlagBuilder. Consumers (parser,\nhelp generator, resolution chain) read this to understand the flag's shape\nwithout touching generics."
279
299
  },
300
+ "stdin": {
301
+ "type": "object",
302
+ "additionalProperties": false,
303
+ "properties": {
304
+ "when": {
305
+ "enum": [
306
+ "dash",
307
+ "missing",
308
+ "dash-or-missing"
309
+ ],
310
+ "description": "When this input reads the stdin stream."
311
+ },
312
+ "consume": {
313
+ "enum": [
314
+ "exclusive",
315
+ "broadcast"
316
+ ],
317
+ "description": "Whether this input consumes the stream alone."
318
+ },
319
+ "trim": {
320
+ "type": "boolean",
321
+ "description": "Whether one trailing line terminator is dropped from a single value."
322
+ }
323
+ },
324
+ "required": [
325
+ "when",
326
+ "consume"
327
+ ],
328
+ "description": "The normalized stdin axis of a flag or an arg."
329
+ },
330
+ "split": {
331
+ "type": "object",
332
+ "additionalProperties": false,
333
+ "properties": {
334
+ "env": {
335
+ "$ref": "#/$defs/splitPolicy"
336
+ },
337
+ "stdin": {
338
+ "$ref": "#/$defs/splitPolicy"
339
+ }
340
+ }
341
+ },
342
+ "splitPolicy": {
343
+ "type": "object",
344
+ "additionalProperties": false,
345
+ "properties": {
346
+ "format": {
347
+ "enum": [
348
+ "whole",
349
+ "delimiter",
350
+ "lines",
351
+ "json"
352
+ ]
353
+ },
354
+ "delimiter": {
355
+ "type": "string",
356
+ "minLength": 1
357
+ }
358
+ },
359
+ "required": [
360
+ "format"
361
+ ],
362
+ "oneOf": [
363
+ {
364
+ "properties": {
365
+ "format": {
366
+ "const": "delimiter"
367
+ }
368
+ },
369
+ "required": [
370
+ "format",
371
+ "delimiter"
372
+ ]
373
+ },
374
+ {
375
+ "properties": {
376
+ "format": {
377
+ "enum": [
378
+ "whole",
379
+ "lines",
380
+ "json"
381
+ ]
382
+ }
383
+ },
384
+ "not": {
385
+ "required": [
386
+ "delimiter"
387
+ ]
388
+ }
389
+ }
390
+ ]
391
+ },
280
392
  "negation": {
281
393
  "type": "object",
282
394
  "additionalProperties": false,
@@ -292,6 +404,122 @@
292
404
  },
293
405
  "description": "Negation settings for a boolean flag (set by `.negatable()`).\n\nThe negated spelling and the positive form are two spellings of ONE\nlogical flag: they share duplicate policy, and the last CLI occurrence\nwins across both. The negated spelling is presence-only — `--no-foo=x`\nis rejected."
294
406
  },
407
+ "numberConstraints": {
408
+ "type": "object",
409
+ "additionalProperties": false,
410
+ "properties": {
411
+ "min": {
412
+ "type": "number"
413
+ },
414
+ "max": {
415
+ "type": "number"
416
+ },
417
+ "int": {
418
+ "type": "boolean"
419
+ },
420
+ "finite": {
421
+ "type": "boolean"
422
+ }
423
+ }
424
+ },
425
+ "stringConstraints": {
426
+ "type": "object",
427
+ "additionalProperties": false,
428
+ "properties": {
429
+ "nonEmpty": {
430
+ "type": "boolean"
431
+ },
432
+ "minLength": {
433
+ "type": "integer",
434
+ "minimum": 0
435
+ },
436
+ "maxLength": {
437
+ "type": "integer",
438
+ "minimum": 0
439
+ },
440
+ "pattern": {
441
+ "type": "object",
442
+ "additionalProperties": false,
443
+ "properties": {
444
+ "source": {
445
+ "type": "string"
446
+ },
447
+ "flags": {
448
+ "type": "string"
449
+ }
450
+ },
451
+ "required": [
452
+ "source",
453
+ "flags"
454
+ ]
455
+ }
456
+ }
457
+ },
458
+ "pathChecks": {
459
+ "type": "object",
460
+ "additionalProperties": false,
461
+ "properties": {
462
+ "mustExist": {
463
+ "type": "boolean"
464
+ },
465
+ "type": {
466
+ "enum": [
467
+ "file",
468
+ "directory"
469
+ ]
470
+ },
471
+ "create": {
472
+ "const": true
473
+ }
474
+ },
475
+ "required": [
476
+ "mustExist"
477
+ ]
478
+ },
479
+ "argElement": {
480
+ "type": "object",
481
+ "additionalProperties": false,
482
+ "properties": {
483
+ "kind": {
484
+ "enum": [
485
+ "string",
486
+ "number",
487
+ "boolean",
488
+ "enum",
489
+ "custom"
490
+ ],
491
+ "description": "What kind of value this arg accepts."
492
+ },
493
+ "presence": {
494
+ "const": "required",
495
+ "description": "Entry values are required once their containing key-value argument is present."
496
+ },
497
+ "enumValues": {
498
+ "type": "array",
499
+ "items": {
500
+ "type": "string"
501
+ },
502
+ "description": "Allowed literal values when `kind === 'enum'`."
503
+ },
504
+ "numberConstraints": {
505
+ "$ref": "#/$defs/numberConstraints"
506
+ },
507
+ "stringConstraints": {
508
+ "$ref": "#/$defs/stringConstraints"
509
+ },
510
+ "pathChecks": {
511
+ "$ref": "#/$defs/pathChecks"
512
+ },
513
+ "valueHint": {
514
+ "type": "string"
515
+ }
516
+ },
517
+ "required": [
518
+ "kind",
519
+ "presence"
520
+ ],
521
+ "description": "Element schema when `kind === 'keyValue'`.\n\nDescribes the value of each entry, so `arg.keyValue(arg.number())` decodes\n`A=1` to the number `1`. `undefined` leaves entry values as strings."
522
+ },
295
523
  "arg": {
296
524
  "type": "object",
297
525
  "additionalProperties": false,
@@ -304,8 +532,10 @@
304
532
  "enum": [
305
533
  "string",
306
534
  "number",
535
+ "boolean",
307
536
  "enum",
308
- "custom"
537
+ "custom",
538
+ "keyValue"
309
539
  ],
310
540
  "description": "What kind of value this arg accepts."
311
541
  },
@@ -321,9 +551,9 @@
321
551
  "const": true,
322
552
  "description": "Whether this arg consumes all remaining positionals."
323
553
  },
324
- "stdinMode": {
325
- "const": true,
326
- "description": "Whether this arg may read from stdin during resolution.\n\nDefault: `false`"
554
+ "stdin": {
555
+ "$ref": "#/$defs/stdin",
556
+ "description": "Stdin binding set by `.stdin()` (`undefined` when the arg never reads\nstdin). See StdinBinding."
327
557
  },
328
558
  "defaultValue": {
329
559
  "description": "Runtime default value (if any)."
@@ -336,6 +566,10 @@
336
566
  "type": "string",
337
567
  "description": "Environment variable name for env resolution.\n\nWhen set and the CLI value is absent, the resolver reads this env var\nand coerces the string to the arg's declared kind."
338
568
  },
569
+ "configPath": {
570
+ "type": "string",
571
+ "description": "Dotted config path for config resolution (e.g. `'deploy.region'`)."
572
+ },
339
573
  "enumValues": {
340
574
  "type": "array",
341
575
  "items": {
@@ -343,6 +577,43 @@
343
577
  },
344
578
  "description": "Allowed literal values when `kind === 'enum'`."
345
579
  },
580
+ "elementSchema": {
581
+ "$ref": "#/$defs/argElement",
582
+ "description": "Element schema when `kind === 'keyValue'`.\n\nDescribes the value of each entry, so `arg.keyValue(arg.number())` decodes\n`A=1` to the number `1`. `undefined` leaves entry values as strings."
583
+ },
584
+ "numberConstraints": {
585
+ "$ref": "#/$defs/numberConstraints"
586
+ },
587
+ "stringConstraints": {
588
+ "$ref": "#/$defs/stringConstraints"
589
+ },
590
+ "pathChecks": {
591
+ "$ref": "#/$defs/pathChecks"
592
+ },
593
+ "valueHint": {
594
+ "type": "string"
595
+ },
596
+ "separator": {
597
+ "type": "string",
598
+ "minLength": 1
599
+ },
600
+ "split": {
601
+ "$ref": "#/$defs/split"
602
+ },
603
+ "duplicateKeys": {
604
+ "enum": [
605
+ "first",
606
+ "last",
607
+ "error"
608
+ ]
609
+ },
610
+ "unique": {
611
+ "const": true
612
+ },
613
+ "prompt": {
614
+ "$ref": "#/$defs/prompt",
615
+ "description": "Interactive prompt configuration."
616
+ },
346
617
  "deprecated": {
347
618
  "oneOf": [
348
619
  {
@@ -360,6 +631,25 @@
360
631
  "kind",
361
632
  "presence"
362
633
  ],
634
+ "anyOf": [
635
+ {
636
+ "not": {
637
+ "required": [
638
+ "elementSchema"
639
+ ]
640
+ }
641
+ },
642
+ {
643
+ "properties": {
644
+ "kind": {
645
+ "const": "keyValue"
646
+ }
647
+ },
648
+ "required": [
649
+ "kind"
650
+ ]
651
+ }
652
+ ],
363
653
  "description": "The runtime descriptor stored inside every ArgBuilder. Consumers (parser,\nhelp generator) read this to understand the arg's shape without touching\ngenerics."
364
654
  },
365
655
  "prompt": {
@@ -3,14 +3,15 @@
3
3
  * Interactive prompts with config file fallback.
4
4
  *
5
5
  * Demonstrates: per-flag `.prompt()`, `.env()`, `.config()`, and the full
6
- * resolution chain (CLI → env → config → prompt → default).
6
+ * resolution chain (CLI → stdin → env → config → prompt → default).
7
7
  *
8
8
  * The resolution chain means:
9
9
  * 1. Explicit CLI flag wins: --region eu
10
- * 2. Then environment variable: DEPLOY_REGION=eu
11
- * 3. Then config file value: { "deploy": { "region": "eu" } }
12
- * 4. Then interactive prompt: prompts user to select
13
- * 5. Then default value: "us"
10
+ * 2. Then piped stdin: only for an input declaring `.stdin()`
11
+ * 3. Then environment variable: DEPLOY_REGION=eu
12
+ * 4. Then config file value: { "deploy": { "region": "eu" } }
13
+ * 5. Then interactive prompt: prompts user to select
14
+ * 6. Then default value: "us"
14
15
  *
15
16
  * Usage:
16
17
  * npx tsx examples/interactive.ts # prompts for everything
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kjanat/dreamcli",
3
- "version": "3.0.1",
3
+ "version": "4.0.0-rc.2",
4
4
  "description": "Schema-first, fully typed TypeScript CLI framework",
5
5
  "keywords": [
6
6
  "dreamcli",
@@ -65,7 +65,7 @@
65
65
  ],
66
66
  "workspaces": ["./examples/*", "./docs"],
67
67
  "scripts": {
68
- "bd": "run build",
68
+ "bd": "run -s build typecheck:dist",
69
69
  "build": "bun --bun tsdown",
70
70
  "build:watch": "run build --watch",
71
71
  "ci": "run -pk typecheck lint format:check meta-descriptions:check test docs:build bd",
@@ -103,7 +103,8 @@
103
103
  "test:gh": "run --dir examples/gh test",
104
104
  "test:node": "npx -y vitest run",
105
105
  "test:watch": "vitest",
106
- "typecheck": "bunx @typescript/native --noEmit",
106
+ "typecheck": "run -q @typescript/native --noEmit",
107
+ "typecheck:dist": "run -q @typescript/native --ignoreConfig --noEmit --module preserve --moduleResolution bundler --target ESNext --types bun,node,vitest --skipLibCheck examples/testing.ts",
107
108
  "typecheck:gh": "run --dir examples/gh typecheck",
108
109
  "upgrade": "bun update --latest && bun --cwd docs add -D vitepress@next",
109
110
  "version:check": "bun scripts/check-version-sync.ts"
@@ -116,16 +117,16 @@
116
117
  "@iarna/toml": "^2.2.5",
117
118
  "@types/bun": "^1.3.14",
118
119
  "@types/deno": "^2.7.0",
119
- "@types/node": ">=26.1.1",
120
+ "@types/node": ">=26.2.0",
120
121
  "@typescript/native": "npm:typescript@^7",
121
122
  "@vitest/coverage-v8": "^4.1.10",
122
- "biome": "npm:@biomejs/biome@^2.5.4",
123
+ "biome": "npm:@biomejs/biome@^2.5.8",
123
124
  "dprint": "^0.55.1",
124
- "importmapify": "1.6.0",
125
- "knip": "^6.25.0",
126
- "publint": "^0.3.21",
127
- "runner-run": "0.20.0",
128
- "tsdown": "^0.22.12",
125
+ "importmapify": "1.7.0",
126
+ "knip": "^6.32.2",
127
+ "publint": "^0.3.23",
128
+ "runner-run": "0.25.1",
129
+ "tsdown": "^0.22.14",
129
130
  "typescript": ">=6,<7",
130
131
  "vitest": "^4.1.10",
131
132
  "yaml": "^2.9.0"
@@ -155,7 +156,7 @@
155
156
  },
156
157
  "catalog": {
157
158
  "@types/bun": "^1.3.14",
158
- "@types/node": ">=26.1.1",
159
+ "@types/node": ">=26.2.0",
159
160
  "@typescript/native": "npm:typescript@^7",
160
161
  "typescript": ">=6,<7",
161
162
  "vitest": "^4.1.10"