@kjanat/dreamcli 4.0.0-rc.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.
package/CHANGELOG.md CHANGED
@@ -23,6 +23,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
23
23
  - [ ] Confirm the exact `v<version>` tag does not already exist and npm and JSR
24
24
  do not already contain that version before publishing the GitHub release.
25
25
 
26
+ ## [4.0.0-rc.2] - 2026-08-17
27
+
28
+ ### Fixed
29
+
30
+ - **Published testkit declarations accept command builders again**
31
+ (https://github.com/kjanat/dreamcli/issues/122). `runCommand()` now exposes a declaration-safe
32
+ generic `CommandBuilder` parameter while keeping its execution pipeline type-erased internally.
33
+ Package builds also compile the public testing example against the emitted declarations so
34
+ internal-member stripping cannot silently break this contract again.
35
+
26
36
  ## [4.0.0-rc.1] - 2026-08-12
27
37
 
28
38
  ### Added
@@ -2395,7 +2405,8 @@ sections that follow. Upgrading from 2.x is covered by the new
2395
2405
  - MIT License.
2396
2406
  - Markdownlint configuration.
2397
2407
 
2398
- [Unreleased]: https://github.com/kjanat/dreamcli/compare/v4.0.0-rc.1...HEAD
2408
+ [Unreleased]: https://github.com/kjanat/dreamcli/compare/v4.0.0-rc.2...HEAD
2409
+ [4.0.0-rc.2]: https://github.com/kjanat/dreamcli/compare/v4.0.0-rc.1...v4.0.0-rc.2
2399
2410
  [4.0.0-rc.1]: https://github.com/kjanat/dreamcli/compare/v3.0.1...v4.0.0-rc.1
2400
2411
  [3.0.1]: https://github.com/kjanat/dreamcli/compare/v3.0.0...v3.0.1
2401
2412
  [3.0.0]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.20...v3.0.0
@@ -587,21 +587,6 @@ interface CommandDefinition {
587
587
  * ```
588
588
  */
589
589
  declare function createCommandSchema(definition: CommandDefinition): CommandSchema;
590
- /**
591
- * Structural subset of {@linkcode CommandBuilder} accepted by `runCommand()`.
592
- *
593
- * Avoids generic type parameters so any `CommandBuilder<F, A, C>` satisfies
594
- * this interface structurally — no variance constraints, no inference needed.
595
- * The testkit reads `handler` and `_executionSteps` off it and hands them to
596
- * the shared executor, so TypeScript never has to resolve
597
- * {@linkcode CommandBuilder}'s full generic signature.
598
- *
599
- */
600
- interface RunnableCommand {
601
- readonly schema: CommandSchema;
602
- readonly handler: ErasedActionHandler | undefined;
603
- readonly _executionSteps: readonly ExecutionStep[];
604
- }
605
590
  /**
606
591
  * Type-erased {@link CommandBuilder} for heterogeneous subcommand storage.
607
592
  *
@@ -1098,4 +1083,4 @@ declare function command(name: string): CommandBuilder;
1098
1083
  */
1099
1084
  declare function group(name: string): CommandBuilder;
1100
1085
  //#endregion
1101
- export { type ActionHandler, type ActionParams, type AnyCommandBuilder, type CommandArgEntry, type CommandArgEntryDefinition, CommandBuilder, type CommandDefinition, type CommandExample, type CommandMeta, type CommandSchema, type DeriveHandler, type DeriveParams, type ErasedActionHandler, type ErasedDeriveHandler, type ErasedInputSources, type ErasedInteractiveResolver, type ExampleCommand, type ExampleMeta, type ExecutionStep, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type Out, type RunnableCommand, type WidenContext, type WidenDerivedContext, command, createCommandSchema, group, resolveExampleCommand };
1086
+ export { type ActionHandler, type ActionParams, type AnyCommandBuilder, type CommandArgEntry, type CommandArgEntryDefinition, CommandBuilder, type CommandDefinition, type CommandExample, type CommandMeta, type CommandSchema, type DeriveHandler, type DeriveParams, type ErasedActionHandler, type ErasedDeriveHandler, type ErasedInputSources, type ErasedInteractiveResolver, type ExampleCommand, type ExampleMeta, type ExecutionStep, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type Out, type WidenContext, type WidenDerivedContext, command, createCommandSchema, group, resolveExampleCommand };
@@ -1,5 +1,7 @@
1
1
  import { BuiltinsConfig } from "../cli/builtins.mjs";
2
- import { RunnableCommand } from "../schema/command.mjs";
2
+ import { FlagBuilder, FlagConfig } from "../schema/flag.mjs";
3
+ import { ArgBuilder, ArgConfig } from "../schema/arg.mjs";
4
+ import { CommandBuilder } from "../schema/command.mjs";
3
5
  import { RunOptions, RunResult } from "../schema/run.mjs";
4
6
  //#region src/core/testkit/index.d.ts
5
7
  /**
@@ -49,6 +51,6 @@ interface RunCommandOptions extends RunOptions {
49
51
  * @param options - Injectable runtime state
50
52
  * @returns Structured run result with exit code and captured output
51
53
  */
52
- declare function runCommand(cmd: RunnableCommand, argv: readonly string[], options?: RunCommandOptions): Promise<RunResult>;
54
+ declare function runCommand<F extends Record<string, FlagBuilder<FlagConfig>>, A extends Record<string, ArgBuilder<ArgConfig>>, C extends Record<string, unknown> = Record<string, never>>(cmd: CommandBuilder<F, A, C>, argv: readonly string[], options?: RunCommandOptions): Promise<RunResult>;
53
55
  //#endregion
54
56
  export { type RunCommandOptions, type RunOptions, type RunResult, runCommand };
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 = "4.0.0-rc.1";
3
+ const DREAMCLI_VERSION = "4.0.0-rc.2";
4
4
  /** Git short SHA (e.g. `"f9b5f1a"`). `"dev"` when running unbundled. */
5
- const DREAMCLI_REVISION = "503d197";
5
+ const DREAMCLI_REVISION = "879b2b8";
6
6
  //#endregion
7
7
  export { DREAMCLI_REVISION, DREAMCLI_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kjanat/dreamcli",
3
- "version": "4.0.0-rc.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"
@@ -124,7 +125,7 @@
124
125
  "importmapify": "1.7.0",
125
126
  "knip": "^6.32.2",
126
127
  "publint": "^0.3.23",
127
- "runner-run": "0.25.0",
128
+ "runner-run": "0.25.1",
128
129
  "tsdown": "^0.22.14",
129
130
  "typescript": ">=6,<7",
130
131
  "vitest": "^4.1.10",
@@ -52,7 +52,7 @@ deno doc --filter=CLIBuilder jsr:@kjanat/dreamcli 2>/dev/null # one symbol
52
52
  `2>/dev/null` matters: deno writes download and type-check progress to stderr,
53
53
  which otherwise swamps the documentation output.
54
54
 
55
- Pin a version with `jsr:@kjanat/dreamcli@4.0.0-rc.1` when the project is not on
55
+ Pin a version with `jsr:@kjanat/dreamcli@4.0.0-rc.2` when the project is not on
56
56
  latest. `--filter` takes a declaration name; it prints nothing for a name that
57
57
  does not exist, which is itself a useful signal.
58
58