@kjanat/dreamcli 3.0.0-rc.8 → 3.0.0-rc.9

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 CHANGED
@@ -7,6 +7,30 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.0-rc.9] - 2026-07-11
11
+
12
+ ### Added
13
+
14
+ - **JSON help** — `--help` with `--json` emits the CLI's definition document
15
+ (the `generateSchema()` shape, `$schema`-tagged) on stdout instead of help
16
+ text, for root help, `help <command>`, and `<command> --help` alike. New
17
+ `generateCommandSchema(schema)` export produces the per-command document.
18
+
19
+ ### Changed
20
+
21
+ - **`generateSchema()` emits the default command's full definition** — the
22
+ `defaultCommand` field was a name-only string reference while the default
23
+ command's flags/args appeared nowhere in the document (it never lists in
24
+ `commands`). It is now the complete serialized command.
25
+
26
+ - **`flag.array()` rejects non-element builders at compile time** — the
27
+ element position now requires a builder carrying only value-shape settings
28
+ (kind, constraints, enum values, `parseFn`). Flag-level modifiers
29
+ (`.alias()`, `.env()`, `.default()`, `.prompt()`, `.describe()`, …) were
30
+ silently ignored on elements before; passing them is now a type error, as
31
+ is `flag.path()` / `flag.count()` / `flag.keyValue()` / nested arrays.
32
+ Type-level only — no runtime behavior change.
33
+
10
34
  ## [3.0.0-rc.8] - 2026-07-11
11
35
 
12
36
  ### Added
@@ -1174,7 +1198,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1174
1198
  - MIT License.
1175
1199
  - Markdownlint configuration.
1176
1200
 
1177
- [Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.8...HEAD
1201
+ [Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.9...HEAD
1202
+ [3.0.0-rc.9]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.8...v3.0.0-rc.9
1178
1203
  [3.0.0-rc.8]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.7...v3.0.0-rc.8
1179
1204
  [3.0.0-rc.7]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.6...v3.0.0-rc.7
1180
1205
  [3.0.0-rc.6]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.5...v3.0.0-rc.6
@@ -5,6 +5,7 @@ import { command } from "../schema/command.mjs";
5
5
  import { includesBeforeSeparator } from "../parse/index.mjs";
6
6
  import { SHELLS, detectShell, generateCompletion, normalizeShell } from "../completion/index.mjs";
7
7
  import { formatHelp } from "../help/index.mjs";
8
+ import { generateCommandSchema, generateSchema } from "../json-schema/index.mjs";
8
9
  import { clearRequestedExitCode, createCaptureOutput, createOutput } from "../output/index.mjs";
9
10
  import { buildRunResult, executeCommand } from "../execution/index.mjs";
10
11
  import { runCommand } from "../testkit/index.mjs";
@@ -616,14 +617,16 @@ var CLIBuilder = class CLIBuilder {
616
617
  error: void 0
617
618
  }, captured);
618
619
  }
619
- case "root-help": {
620
- const helpText = formatRootHelp(resolveHelpLinksSchema(this.schema), planned.help);
621
- out.log(helpText);
620
+ case "root-help":
621
+ if (jsonMode) out.json(generateSchema(this.schema));
622
+ else {
623
+ const helpText = formatRootHelp(resolveHelpLinksSchema(this.schema), planned.help);
624
+ out.log(helpText);
625
+ }
622
626
  return buildRunResult({
623
627
  exitCode: 0,
624
628
  error: void 0
625
629
  }, captured);
626
- }
627
630
  case "dispatch-error":
628
631
  if (jsonMode) out.json({ error: planned.error.toJSON() });
629
632
  else {
@@ -634,14 +637,16 @@ var CLIBuilder = class CLIBuilder {
634
637
  exitCode: planned.error.exitCode,
635
638
  error: planned.error
636
639
  }, captured);
637
- case "needs-subcommand": {
638
- const helpText = formatHelp(planned.command.schema, planned.help);
639
- out.log(helpText);
640
+ case "needs-subcommand":
641
+ if (jsonMode) out.json(generateCommandSchema(planned.command.schema));
642
+ else {
643
+ const helpText = formatHelp(planned.command.schema, planned.help);
644
+ out.log(helpText);
645
+ }
640
646
  return buildRunResult({
641
647
  exitCode: 0,
642
648
  error: void 0
643
649
  }, captured);
644
- }
645
650
  case "match": {
646
651
  const commandRunOptions = buildCommandRunOptions(effectiveOptions, planned.plan.help ?? helpOptions, planned.plan.meta);
647
652
  if (planned.plan.command._command === void 0) return planned.plan.command._execute(planned.plan.argv, {
@@ -1,6 +1,7 @@
1
1
  import { CLIError } from "../errors/index.mjs";
2
2
  import { includesBeforeSeparator, parse } from "../parse/index.mjs";
3
3
  import { formatHelp } from "../help/index.mjs";
4
+ import { generateCommandSchema } from "../json-schema/index.mjs";
4
5
  import { clearRequestedExitCode, getRequestedExitCode } from "../output/index.mjs";
5
6
  import { createTestPrompter } from "../prompt/index.mjs";
6
7
  import { resolve } from "../resolve/index.mjs";
@@ -17,6 +18,13 @@ async function executeCommand(request) {
17
18
  clearRequestedExitCode(out);
18
19
  try {
19
20
  if (includesBeforeSeparator(argv, "--help") || includesBeforeSeparator(argv, "-h")) {
21
+ if (out.jsonMode || options?.jsonMode === true) {
22
+ out.json(generateCommandSchema(schema));
23
+ return {
24
+ exitCode: 0,
25
+ error: void 0
26
+ };
27
+ }
20
28
  const helpText = formatHelp(schema, options?.help?.colors !== void 0 ? options.help : {
21
29
  ...options?.help,
22
30
  colors: out.color
@@ -53,6 +53,19 @@ interface JsonSchemaOptions {
53
53
  * ```
54
54
  */
55
55
  declare function generateSchema(schema: CLISchema, options?: JsonSchemaOptions): Record<string, unknown>;
56
+ /**
57
+ * Generate the definition metadata document for a single command.
58
+ *
59
+ * The per-command counterpart of {@link generateSchema}: the same
60
+ * JSON-serializable shape as one entry of its `commands` array (flags, args,
61
+ * subcommands, examples). Powers `--help` in `--json` mode and is useful for
62
+ * embedding one command's definition into custom tooling.
63
+ *
64
+ * @param schema - The command schema to serialize.
65
+ * @param options - Generation options.
66
+ * @returns A plain object suitable for `JSON.stringify()`.
67
+ */
68
+ declare function generateCommandSchema(schema: CommandSchema, options?: JsonSchemaOptions): Record<string, unknown>;
56
69
  /**
57
70
  * Generate a JSON Schema (draft 2020-12) for validating CLI input as JSON.
58
71
  *
@@ -106,4 +119,4 @@ declare function generateInputSchema(schema: CLISchema | CommandSchema, options?
106
119
  */
107
120
  declare const definitionMetaSchema: Record<string, unknown>;
108
121
  //#endregion
109
- export { type JsonSchemaOptions, definitionMetaSchema, generateInputSchema, generateSchema };
122
+ export { type JsonSchemaOptions, definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema };
@@ -55,11 +55,26 @@ function generateSchema(schema, options) {
55
55
  };
56
56
  if (schema.version !== void 0) result.version = schema.version;
57
57
  if (schema.description !== void 0) result.description = schema.description;
58
- if (schema.defaultCommand !== void 0 && (opts.includeHidden || !schema.defaultCommand.schema.hidden)) result.defaultCommand = schema.defaultCommand.schema.name;
58
+ if (schema.defaultCommand !== void 0 && (opts.includeHidden || !schema.defaultCommand.schema.hidden)) result.defaultCommand = serializeCommand(schema.defaultCommand.schema, opts);
59
59
  result.commands = schema.commands.filter((cmd) => opts.includeHidden || !cmd.schema.hidden).map((cmd) => serializeCommand(cmd.schema, opts));
60
60
  return result;
61
61
  }
62
62
  /**
63
+ * Generate the definition metadata document for a single command.
64
+ *
65
+ * The per-command counterpart of {@link generateSchema}: the same
66
+ * JSON-serializable shape as one entry of its `commands` array (flags, args,
67
+ * subcommands, examples). Powers `--help` in `--json` mode and is useful for
68
+ * embedding one command's definition into custom tooling.
69
+ *
70
+ * @param schema - The command schema to serialize.
71
+ * @param options - Generation options.
72
+ * @returns A plain object suitable for `JSON.stringify()`.
73
+ */
74
+ function generateCommandSchema(schema, options) {
75
+ return serializeCommand(schema, resolveOptions(options));
76
+ }
77
+ /**
63
78
  * Serialize a single {@link CommandSchema} into a plain object.
64
79
  *
65
80
  * @param schema - The command schema to serialize.
@@ -495,7 +510,7 @@ const definitionMetaSchema = withDefinitionMetaSchemaDescriptions({
495
510
  name: string;
496
511
  version?: string;
497
512
  description?: string;
498
- defaultCommand?: string;
513
+ defaultCommand?: @command;
499
514
  commands: @command[]
500
515
  }`),
501
516
  $defs: {
@@ -561,4 +576,4 @@ const definitionMetaSchema = withDefinitionMetaSchemaDescriptions({
561
576
  }
562
577
  }, definitionMetaSchemaDescriptions);
563
578
  //#endregion
564
- export { definitionMetaSchema, generateInputSchema, generateSchema };
579
+ export { definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema };
@@ -37,6 +37,16 @@ interface FlagConfig {
37
37
  readonly optionalFallback: OptionalFallback;
38
38
  /** The runtime kind discriminator, mirroring {@link FlagKind}. */
39
39
  readonly flagKind: FlagKind;
40
+ /**
41
+ * Whether this builder may still be passed to `flag.array()` as the
42
+ * element schema.
43
+ *
44
+ * Factories producing element-meaningful kinds start `true`. Flag-level
45
+ * modifiers (`.alias()`, `.env()`, `.prompt()`, `.default()`, …) flip it
46
+ * to `false` — those settings describe the *flag*, are never read from an
47
+ * element schema, and would otherwise be silently ignored.
48
+ */
49
+ readonly elementEligible: boolean;
40
50
  }
41
51
  /**
42
52
  * Advanced type helper used by {@linkcode FlagBuilder} modifiers to replace presence.
@@ -47,6 +57,18 @@ type WithPresence<C extends FlagConfig, P extends FlagPresence> = {
47
57
  readonly presence: P;
48
58
  readonly optionalFallback: C['optionalFallback'];
49
59
  readonly flagKind: C['flagKind'];
60
+ readonly elementEligible: false;
61
+ };
62
+ /**
63
+ * Advanced type helper: marks a builder as no longer usable as an array
64
+ * element (returned by flag-level modifiers whose settings elements ignore).
65
+ */
66
+ type WithoutElementEligibility<C extends FlagConfig> = {
67
+ readonly valueType: C['valueType'];
68
+ readonly presence: C['presence'];
69
+ readonly optionalFallback: C['optionalFallback'];
70
+ readonly flagKind: C['flagKind'];
71
+ readonly elementEligible: false;
50
72
  };
51
73
  /**
52
74
  * Compute the final value type from config — this is what handlers receive.
@@ -427,7 +449,7 @@ declare class FlagBuilder<C extends FlagConfig> {
427
449
  */
428
450
  alias(name: string, options?: {
429
451
  hidden?: boolean;
430
- }): FlagBuilder<C>;
452
+ }): FlagBuilder<WithoutElementEligibility<C>>;
431
453
  /**
432
454
  * Bind to an environment variable (resolved in v0.2+).
433
455
  *
@@ -442,7 +464,7 @@ declare class FlagBuilder<C extends FlagConfig> {
442
464
  * // $ mycli request --api-key sk-456 → apiKey = 'sk-456' (CLI wins)
443
465
  * ```
444
466
  */
445
- env(varName: string): FlagBuilder<C>;
467
+ env(varName: string): FlagBuilder<WithoutElementEligibility<C>>;
446
468
  /**
447
469
  * Bind to a dotted config path (resolved in v0.2+).
448
470
  *
@@ -459,14 +481,14 @@ declare class FlagBuilder<C extends FlagConfig> {
459
481
  * // # → CLI flag wins
460
482
  * ```
461
483
  */
462
- config(path: string): FlagBuilder<C>;
484
+ config(path: string): FlagBuilder<WithoutElementEligibility<C>>;
463
485
  /**
464
486
  * Human-readable description shown in help output.
465
487
  *
466
488
  * @param description - Text displayed next to the flag in `--help`.
467
489
  * @returns The builder (for chaining).
468
490
  */
469
- describe(description: string): FlagBuilder<C>;
491
+ describe(description: string): FlagBuilder<WithoutElementEligibility<C>>;
470
492
  /**
471
493
  * Attach interactive prompt configuration for v0.3+ resolution.
472
494
  *
@@ -486,7 +508,7 @@ declare class FlagBuilder<C extends FlagConfig> {
486
508
  * // $ mycli init --name foo → skips prompt, uses CLI value
487
509
  * ```
488
510
  */
489
- prompt(config: AllowedPromptConfig<C>): FlagBuilder<C>;
511
+ prompt(config: AllowedPromptConfig<C>): FlagBuilder<WithoutElementEligibility<C>>;
490
512
  /**
491
513
  * Mark this flag as deprecated.
492
514
  *
@@ -506,7 +528,7 @@ declare class FlagBuilder<C extends FlagConfig> {
506
528
  * // ⚠ --dest is deprecated: Use --target instead
507
529
  * ```
508
530
  */
509
- deprecated(message?: string): FlagBuilder<C>;
531
+ deprecated(message?: string): FlagBuilder<WithoutElementEligibility<C>>;
510
532
  /**
511
533
  * Mark this flag as propagated to subcommands.
512
534
  *
@@ -528,7 +550,7 @@ declare class FlagBuilder<C extends FlagConfig> {
528
550
  * // # → same, inherited from parent
529
551
  * ```
530
552
  */
531
- propagate(): FlagBuilder<C>;
553
+ propagate(): FlagBuilder<WithoutElementEligibility<C>>;
532
554
  /**
533
555
  * Require an integer value. Composes with other numeric constraints.
534
556
  *
@@ -716,7 +738,7 @@ declare class FlagBuilder<C extends FlagConfig> {
716
738
  }>, options?: {
717
739
  alias?: string;
718
740
  hidden?: boolean;
719
- }): FlagBuilder<C>;
741
+ }): FlagBuilder<WithoutElementEligibility<C>>;
720
742
  /**
721
743
  * Set how repeated CLI occurrences of this flag combine.
722
744
  *
@@ -737,7 +759,7 @@ declare class FlagBuilder<C extends FlagConfig> {
737
759
  */
738
760
  duplicates(this: FlagBuilder<C & {
739
761
  readonly flagKind: 'boolean' | 'string' | 'number' | 'enum' | 'custom';
740
- }>, policy: DuplicatePolicy): FlagBuilder<C>;
762
+ }>, policy: DuplicatePolicy): FlagBuilder<WithoutElementEligibility<C>>;
741
763
  }
742
764
  /**
743
765
  * Factory that creates {@link FlagBuilder} instances seeded with the correct
@@ -768,6 +790,7 @@ interface FlagFactory {
768
790
  readonly presence: 'optional';
769
791
  readonly optionalFallback: 'undefined';
770
792
  readonly flagKind: 'string';
793
+ readonly elementEligible: true;
771
794
  }>;
772
795
  /**
773
796
  * Number-valued flag, with optional numeric constraints.
@@ -796,6 +819,7 @@ interface FlagFactory {
796
819
  readonly presence: 'optional';
797
820
  readonly optionalFallback: 'undefined';
798
821
  readonly flagKind: 'number';
822
+ readonly elementEligible: true;
799
823
  }>;
800
824
  /**
801
825
  * Boolean flag. Implicitly defaults to `false` — the only flag kind where
@@ -808,6 +832,7 @@ interface FlagFactory {
808
832
  readonly presence: 'defaulted';
809
833
  readonly optionalFallback: 'undefined';
810
834
  readonly flagKind: 'boolean';
835
+ readonly elementEligible: true;
811
836
  }>;
812
837
  /**
813
838
  * Enum flag with literal type inference.
@@ -829,6 +854,7 @@ interface FlagFactory {
829
854
  readonly presence: 'optional';
830
855
  readonly optionalFallback: 'undefined';
831
856
  readonly flagKind: 'enum';
857
+ readonly elementEligible: true;
832
858
  }>;
833
859
  /**
834
860
  * Array flag — collects multiple values of the same element type.
@@ -842,11 +868,14 @@ interface FlagFactory {
842
868
  * @param element - {@link FlagBuilder} describing the element type.
843
869
  * @returns A {@link FlagBuilder} for arrays of the element type.
844
870
  */
845
- array<E extends FlagConfig>(element: FlagBuilder<E>): FlagBuilder<{
871
+ array<E extends FlagConfig & {
872
+ readonly elementEligible: true;
873
+ }>(element: FlagBuilder<E>): FlagBuilder<{
846
874
  readonly valueType: E['valueType'][];
847
875
  readonly presence: 'optional';
848
876
  readonly optionalFallback: 'empty-array';
849
877
  readonly flagKind: 'array';
878
+ readonly elementEligible: false;
850
879
  }>;
851
880
  /**
852
881
  * Custom-parsed flag. The parse function receives the raw value and must
@@ -882,6 +911,7 @@ interface FlagFactory {
882
911
  readonly presence: 'optional';
883
912
  readonly optionalFallback: 'undefined';
884
913
  readonly flagKind: 'custom';
914
+ readonly elementEligible: true;
885
915
  }>;
886
916
  /**
887
917
  * URL-valued flag. Parses into a `URL`; invalid URLs are rejected with an
@@ -901,6 +931,7 @@ interface FlagFactory {
901
931
  readonly presence: 'optional';
902
932
  readonly optionalFallback: 'undefined';
903
933
  readonly flagKind: 'custom';
934
+ readonly elementEligible: true;
904
935
  }>;
905
936
  /**
906
937
  * Path-valued flag. The value stays a `string`; optional filesystem
@@ -923,6 +954,7 @@ interface FlagFactory {
923
954
  readonly presence: 'optional';
924
955
  readonly optionalFallback: 'undefined';
925
956
  readonly flagKind: 'string';
957
+ readonly elementEligible: false;
926
958
  }>;
927
959
  /**
928
960
  * Date-valued flag. Accepts strict ISO-8601 (`2026-07-10`,
@@ -948,6 +980,7 @@ interface FlagFactory {
948
980
  readonly presence: 'optional';
949
981
  readonly optionalFallback: 'undefined';
950
982
  readonly flagKind: 'custom';
983
+ readonly elementEligible: true;
951
984
  }>;
952
985
  /**
953
986
  * Duration flag. Accepts `'30s'`, `'5m'`, `'1.5h'`, `'250ms'`, `'2d'`,
@@ -966,6 +999,7 @@ interface FlagFactory {
966
999
  readonly presence: 'optional';
967
1000
  readonly optionalFallback: 'undefined';
968
1001
  readonly flagKind: 'custom';
1002
+ readonly elementEligible: true;
969
1003
  }>;
970
1004
  /**
971
1005
  * Byte-size flag. Accepts `'512mb'`, `'1.5gb'`, `'64kb'`, `'100b'` or a
@@ -984,6 +1018,7 @@ interface FlagFactory {
984
1018
  readonly presence: 'optional';
985
1019
  readonly optionalFallback: 'undefined';
986
1020
  readonly flagKind: 'custom';
1021
+ readonly elementEligible: true;
987
1022
  }>;
988
1023
  /**
989
1024
  * Count flag — resolves to how many times the flag appears. `-vvv`,
@@ -1006,6 +1041,7 @@ interface FlagFactory {
1006
1041
  readonly presence: 'defaulted';
1007
1042
  readonly optionalFallback: 'undefined';
1008
1043
  readonly flagKind: 'count';
1044
+ readonly elementEligible: false;
1009
1045
  }>;
1010
1046
  /**
1011
1047
  * Key-value flag — repeated `KEY=VALUE` occurrences merge into a
@@ -1029,6 +1065,7 @@ interface FlagFactory {
1029
1065
  readonly presence: 'optional';
1030
1066
  readonly optionalFallback: 'empty-object';
1031
1067
  readonly flagKind: 'keyValue';
1068
+ readonly elementEligible: false;
1032
1069
  }>;
1033
1070
  }
1034
1071
  /**
package/dist/index.d.mts CHANGED
@@ -31,6 +31,6 @@ import { generateZshCompletion } from "./core/completion/shells/zsh.mjs";
31
31
  import { SHELLS, Shell, generateCompletion } from "./core/completion/index.mjs";
32
32
  import { ConfigAdapter, ConfigDiscoveryOptions, ConfigDiscoveryResult, ConfigFound, ConfigNotFound, FormatLoader, buildConfigSearchPaths, configFormat, discoverConfig } from "./core/config/index.mjs";
33
33
  import { CLIBuilder, CLIOptions, CLIRunOptions, CLISchema, ConfigSettings, DefaultCommandOptions, InferNameOption, ManifestPresetSettings, ManifestSettings, PackageJsonSettings, ResolvedManifestSettings, cli } from "./core/cli/index.mjs";
34
- import { JsonSchemaOptions, definitionMetaSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
34
+ import { JsonSchemaOptions, definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
35
35
  import { Colors } from "ansispeck";
36
- export { type ActionHandler, type ActionParams, type ActivityEvent, type AnyCommandBuilder, ArgBuilder, type ArgConfig, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type BeforeParseParams, CLIBuilder, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type Colors, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type CompletionOptions, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSettings, type ConfirmPromptConfig, type DateFlagOptions, type DefaultCommandOptions, type DeprecationWarning, type DeriveHandler, type DeriveParams, type DuplicatePolicy, type ErrorCode, type Fallback, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagNegation, type FlagParseFn, type FlagPresence, type FlagSchema, type FormatLoader, type HelpLinks, type HelpOptions, type HelpTheme, type HelpThemeFactory, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferNameOption, type InputPromptConfig, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type ManifestDiscoveryOptions, type ManifestPresetSettings, type ManifestSettings, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberConstraintViolation, type NumberConstraints, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageJsonSettings, type PackageRepository, type PackageRepositoryUrlOptions, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseOptions, type ParseResult, type PathChecks, type PathFlagOptions, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptConfig, type PromptConfigBase, type PromptEngine, type PromptKind, type PromptResult, type ReadFn, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedManifestSettings, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, type SelectChoice, type SelectPromptConfig, type Shell, type SpinnerHandle, type SpinnerOptions, type StringConstraintViolation, type StringConstraints, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, type UrlFlagOptions, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WriteFn, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, inferCliName, isCLIError, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolvePromptConfig, tokenize, visibleWidth };
36
+ export { type ActionHandler, type ActionParams, type ActivityEvent, type AnyCommandBuilder, ArgBuilder, type ArgConfig, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type BeforeParseParams, CLIBuilder, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type Colors, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type CompletionOptions, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSettings, type ConfirmPromptConfig, type DateFlagOptions, type DefaultCommandOptions, type DeprecationWarning, type DeriveHandler, type DeriveParams, type DuplicatePolicy, type ErrorCode, type Fallback, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagNegation, type FlagParseFn, type FlagPresence, type FlagSchema, type FormatLoader, type HelpLinks, type HelpOptions, type HelpTheme, type HelpThemeFactory, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferNameOption, type InputPromptConfig, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type ManifestDiscoveryOptions, type ManifestPresetSettings, type ManifestSettings, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberConstraintViolation, type NumberConstraints, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageJsonSettings, type PackageRepository, type PackageRepositoryUrlOptions, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseOptions, type ParseResult, type PathChecks, type PathFlagOptions, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptConfig, type PromptConfigBase, type PromptEngine, type PromptKind, type PromptResult, type ReadFn, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedManifestSettings, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, type SelectChoice, type SelectPromptConfig, type Shell, type SpinnerHandle, type SpinnerOptions, type StringConstraintViolation, type StringConstraints, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, type UrlFlagOptions, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WriteFn, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCommandSchema, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, inferCliName, isCLIError, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolvePromptConfig, tokenize, visibleWidth };
package/dist/index.mjs CHANGED
@@ -11,6 +11,7 @@ import { generateZshCompletion } from "./core/completion/shells/zsh.mjs";
11
11
  import { SHELLS, generateCompletion } from "./core/completion/index.mjs";
12
12
  import { osc8, visibleWidth } from "./core/help/ansi.mjs";
13
13
  import { formatHelp } from "./core/help/index.mjs";
14
+ import { definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
14
15
  import { createOutput } from "./core/output/index.mjs";
15
16
  import { createTerminalPrompter, resolvePromptConfig } from "./core/prompt/index.mjs";
16
17
  import { resolve } from "./core/resolve/index.mjs";
@@ -18,5 +19,4 @@ import { discoverManifest, discoverPackageJson, inferCliName, packageRepositoryU
18
19
  import { plugin } from "./core/cli/plugin.mjs";
19
20
  import { buildConfigSearchPaths, configFormat, discoverConfig } from "./core/config/index.mjs";
20
21
  import { CLIBuilder, cli } from "./core/cli/index.mjs";
21
- import { definitionMetaSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
22
- export { ArgBuilder, CLIBuilder, CLIError, CommandBuilder, FlagBuilder, ParseError, SHELLS, ValidationError, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, inferCliName, isCLIError, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolvePromptConfig, tokenize, visibleWidth };
22
+ export { ArgBuilder, CLIBuilder, CLIError, CommandBuilder, FlagBuilder, ParseError, SHELLS, ValidationError, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverManifest, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCommandSchema, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, inferCliName, isCLIError, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolvePromptConfig, tokenize, visibleWidth };
package/dist/version.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  //#region src/version.ts
2
2
  /** Package version (e.g. `"0.9.1"`). `"dev"` when running unbundled. */
3
- const DREAMCLI_VERSION = "3.0.0-rc.8";
3
+ const DREAMCLI_VERSION = "3.0.0-rc.9";
4
4
  /** Git short SHA (e.g. `"f9b5f1a"`). `"dev"` when running unbundled. */
5
- const DREAMCLI_REVISION = "e934880";
5
+ const DREAMCLI_REVISION = "6a62e80";
6
6
  //#endregion
7
7
  export { DREAMCLI_REVISION, DREAMCLI_VERSION };
@@ -22,7 +22,7 @@
22
22
  "description": "Program description (shown in root help)."
23
23
  },
24
24
  "defaultCommand": {
25
- "type": "string",
25
+ "$ref": "#/$defs/command",
26
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."
27
27
  },
28
28
  "commands": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kjanat/dreamcli",
3
- "version": "3.0.0-rc.8",
3
+ "version": "3.0.0-rc.9",
4
4
  "description": "Schema-first, fully typed TypeScript CLI framework",
5
5
  "keywords": [
6
6
  "dreamcli",