@kjanat/dreamcli 3.0.0-rc.14 → 3.0.0-rc.16

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,32 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.0-rc.16] - 2026-07-20
11
+
12
+ ### Added
13
+
14
+ - **`resolveRenderContext(argv, options?)`** — pre-`run()` probe returning the
15
+ output decisions the framework will make for a given argv: `jsonMode`
16
+ (`--`-aware `--json` detection), `isTTY`, the gated `color` palette, and
17
+ `isHyperlinkSupported`. Computed with the same composition `.execute()`/
18
+ `.run()` feed into the output channel, so content styled before `run()` —
19
+ banners, hand-rendered help — matches the channel that will actually render,
20
+ with zero argv re-parsing.
21
+ - **`includesBeforeSeparator` / `stripBeforeSeparator`** exported from the
22
+ package root — the `--`-aware root-flag primitives, for consumers who only
23
+ need correct flag detection.
24
+
25
+ ## [3.0.0-rc.15] - 2026-07-20
26
+
27
+ ### Added
28
+
29
+ - **Configurable flag order in help** — `.help({ flagOrder })` controls the
30
+ `Flags:` table order: `'alphabetical'` (default, short-aliased flags first
31
+ then alphabetical) or `'declaration'` (the order `.flag()` was called). For
32
+ full control, `.help({ sortFlags: (a, b) => number })` supplies a custom
33
+ comparator over flag names that wins over `flagOrder`. Both are also
34
+ accepted at runtime via `execute`/`run` `help` options.
35
+
10
36
  ## [3.0.0-rc.14] - 2026-07-20
11
37
 
12
38
  ### Added
@@ -1289,7 +1315,9 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1289
1315
  - MIT License.
1290
1316
  - Markdownlint configuration.
1291
1317
 
1292
- [Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.14...HEAD
1318
+ [Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.16...HEAD
1319
+ [3.0.0-rc.16]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.15...v3.0.0-rc.16
1320
+ [3.0.0-rc.15]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.14...v3.0.0-rc.15
1293
1321
  [3.0.0-rc.14]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.13...v3.0.0-rc.14
1294
1322
  [3.0.0-rc.13]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.12...v3.0.0-rc.13
1295
1323
  [3.0.0-rc.12]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.11...v3.0.0-rc.12
@@ -13,6 +13,7 @@ import { CompletionOptions } from "../completion/shells/shared.mjs";
13
13
  import { Shell } from "../completion/index.mjs";
14
14
  import { FormatLoader } from "../config/index.mjs";
15
15
  import { formatRootHelp } from "./root-help.mjs";
16
+ import { Colors } from "ansispeck";
16
17
  //#region src/core/cli/index.d.ts
17
18
  /**
18
19
  * Runtime descriptor for the CLI program.
@@ -153,6 +154,24 @@ interface HelpConfig {
153
154
  readonly width?: number;
154
155
  /** Emit OSC 8 hyperlinks in the header when supported. */
155
156
  readonly hyperlinks?: boolean;
157
+ /**
158
+ * Order of flags in the `Flags:` table.
159
+ *
160
+ * - `'alphabetical'` — short-aliased flags first, then alphabetical by name.
161
+ * - `'declaration'` — the order `.flag()` was called.
162
+ *
163
+ * Ignored when {@link HelpConfig.sortFlags} is set.
164
+ *
165
+ * @defaultValue `'alphabetical'`
166
+ */
167
+ readonly flagOrder?: 'alphabetical' | 'declaration';
168
+ /**
169
+ * Custom comparator over flag long names for the `Flags:` table. When set,
170
+ * it wins over {@link HelpConfig.flagOrder}.
171
+ *
172
+ * @defaultValue `undefined` (use `flagOrder`)
173
+ */
174
+ readonly sortFlags?: (a: string, b: string) => number;
156
175
  /**
157
176
  * Theme overrides for help output, merged over the built-in theme.
158
177
  *
@@ -269,6 +288,82 @@ interface CLIRunOptions extends Omit<RunOptions, 'meta' | 'mergedSchema'> {
269
288
  */
270
289
  readonly adapter?: RuntimeAdapter;
271
290
  }
291
+ /**
292
+ * Inputs for {@linkcode resolveRenderContext}. Pass the host facts (TTY
293
+ * status, environment) and any explicit overrides; the resolver applies the
294
+ * same gating `.execute()`/`.run()` feed into the output channel.
295
+ */
296
+ interface RenderContextOptions {
297
+ /**
298
+ * Whether stdout is connected to a TTY (e.g. `process.stdout.isTTY`).
299
+ *
300
+ * @defaultValue `false`
301
+ */
302
+ readonly isTTY?: boolean;
303
+ /**
304
+ * Force JSON mode on regardless of argv.
305
+ *
306
+ * @defaultValue detected from a pre-separator `--json` in `argv`
307
+ */
308
+ readonly jsonMode?: boolean;
309
+ /**
310
+ * Explicitly enable or disable colors, winning over the auto-gate.
311
+ *
312
+ * @defaultValue auto — `isTTY && !jsonMode` and environment support
313
+ */
314
+ readonly color?: boolean;
315
+ /**
316
+ * Environment variables consulted for `NO_HYPERLINKS`/`FORCE_HYPERLINKS`
317
+ * (e.g. `process.env`).
318
+ *
319
+ * @defaultValue `{}`
320
+ */
321
+ readonly env?: Readonly<Record<string, string | undefined>>;
322
+ }
323
+ /**
324
+ * The output decisions the framework will make for a given argv, resolved
325
+ * before `.run()`.
326
+ */
327
+ interface RenderContext {
328
+ /** Whether a pre-separator `--json` puts the run in JSON mode. */
329
+ readonly jsonMode: boolean;
330
+ /** The TTY status the output channel will carry. */
331
+ readonly isTTY: boolean;
332
+ /**
333
+ * The gated ANSI palette the output channel will expose as `out.color` —
334
+ * identity formatters when color is off; `color.isColorSupported` is the
335
+ * boolean gate.
336
+ */
337
+ readonly color: Colors;
338
+ /** Whether OSC 8 hyperlinks should be emitted (see `out.isHyperlinkSupported`). */
339
+ readonly isHyperlinkSupported: boolean;
340
+ }
341
+ /**
342
+ * Resolve the render context for content built before `.run()`.
343
+ *
344
+ * Content styled ahead of execution — hand-rendered banners, custom help, or
345
+ * anything else emitted outside an action handler — has no `out` to consult,
346
+ * which pushes consumers into re-deriving the framework's decisions from raw
347
+ * argv (`argv.includes('--json')` misreads a post-`--` literal). This probe
348
+ * runs the same composition `.execute()`/`.run()` feed into the output
349
+ * channel — `--`-aware `--json` detection, the color gate, and the hyperlink
350
+ * override — so pre-run styling matches the channel that will render.
351
+ *
352
+ * @param argv - Raw argv tokens (NOT including the binary/script path,
353
+ * i.e. equivalent to `process.argv.slice(2)`).
354
+ * @param options - Host facts and overrides.
355
+ * @returns The resolved output decisions.
356
+ *
357
+ * @example
358
+ * ```ts
359
+ * const ctx = resolveRenderContext(process.argv.slice(2), {
360
+ * isTTY: process.stdout.isTTY === true,
361
+ * env: process.env,
362
+ * });
363
+ * const banner = ctx.color.bold('mycli');
364
+ * ```
365
+ */
366
+ declare function resolveRenderContext(argv: readonly string[], options?: RenderContextOptions): RenderContext;
272
367
  /**
273
368
  * Options for {@linkcode CLIBuilder.default | .default()}.
274
369
  */
@@ -828,4 +923,4 @@ declare function cli(options: CLIOptions): CLIBuilder;
828
923
  */
829
924
  declare function isMainModule(meta: ImportMeta): boolean;
830
925
  //#endregion
831
- export { type BeforeParseParams, CLIBuilder, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type CompletionsFlagConfig, type ConfigSettings, type DefaultCommandOptions, type HelpConfig, type HelpLinks, type InferNameOption, type ManifestPresetSettings, type ManifestSettings, type PackageJsonSettings, type PluginCommandContext, type ResolvedCommandParams, type ResolvedManifestSettings, cli, formatRootHelp, isMainModule, plugin };
926
+ export { type BeforeParseParams, CLIBuilder, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type CompletionsFlagConfig, type ConfigSettings, type DefaultCommandOptions, type HelpConfig, type HelpLinks, type InferNameOption, type ManifestPresetSettings, type ManifestSettings, type PackageJsonSettings, type PluginCommandContext, type RenderContext, type RenderContextOptions, type ResolvedCommandParams, type ResolvedManifestSettings, cli, formatRootHelp, isMainModule, plugin, resolveRenderContext };
@@ -100,6 +100,45 @@ function eraseCommand(cmd) {
100
100
  };
101
101
  }
102
102
  /**
103
+ * Resolve the render context for content built before `.run()`.
104
+ *
105
+ * Content styled ahead of execution — hand-rendered banners, custom help, or
106
+ * anything else emitted outside an action handler — has no `out` to consult,
107
+ * which pushes consumers into re-deriving the framework's decisions from raw
108
+ * argv (`argv.includes('--json')` misreads a post-`--` literal). This probe
109
+ * runs the same composition `.execute()`/`.run()` feed into the output
110
+ * channel — `--`-aware `--json` detection, the color gate, and the hyperlink
111
+ * override — so pre-run styling matches the channel that will render.
112
+ *
113
+ * @param argv - Raw argv tokens (NOT including the binary/script path,
114
+ * i.e. equivalent to `process.argv.slice(2)`).
115
+ * @param options - Host facts and overrides.
116
+ * @returns The resolved output decisions.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const ctx = resolveRenderContext(process.argv.slice(2), {
121
+ * isTTY: process.stdout.isTTY === true,
122
+ * env: process.env,
123
+ * });
124
+ * const banner = ctx.color.bold('mycli');
125
+ * ```
126
+ */
127
+ function resolveRenderContext(argv, options) {
128
+ const out = createOutput({
129
+ jsonMode: includesBeforeSeparator(argv, "--json") || options?.jsonMode === true,
130
+ isTTY: options?.isTTY ?? false,
131
+ ...options?.color !== void 0 ? { color: options.color } : {},
132
+ ...hyperlinksOption(resolveHyperlinkOverride(options?.env ?? {}, argv))
133
+ });
134
+ return {
135
+ jsonMode: out.jsonMode,
136
+ isTTY: out.isTTY,
137
+ color: out.color,
138
+ isHyperlinkSupported: out.isHyperlinkSupported
139
+ };
140
+ }
141
+ /**
103
142
  * Conditional-spread wrapper for the output channel's `hyperlinks` option:
104
143
  * omit the key entirely when there is no override so `exactOptionalPropertyTypes`
105
144
  * stays happy and the channel falls back to `isTTY`.
@@ -983,4 +1022,4 @@ function isMainModule(meta) {
983
1022
  return meta.main === true;
984
1023
  }
985
1024
  //#endregion
986
- export { CLIBuilder, cli, formatRootHelp, isMainModule, plugin };
1025
+ export { CLIBuilder, cli, formatRootHelp, isMainModule, plugin, resolveRenderContext };
@@ -12,6 +12,24 @@ interface HelpOptions {
12
12
  readonly binName?: string;
13
13
  /** Program version passed to function-form examples as `meta.version`. */
14
14
  readonly version?: string;
15
+ /**
16
+ * Order of flags in the `Flags:` table.
17
+ *
18
+ * - `'alphabetical'` — short-aliased flags first, then alphabetical by name.
19
+ * - `'declaration'` — the order `.flag()` was called.
20
+ *
21
+ * Ignored when {@link HelpOptions.sortFlags} is set.
22
+ *
23
+ * @defaultValue `'alphabetical'`
24
+ */
25
+ readonly flagOrder?: 'alphabetical' | 'declaration';
26
+ /**
27
+ * Custom comparator over flag long names for the `Flags:` table. When set,
28
+ * it wins over {@link HelpOptions.flagOrder}.
29
+ *
30
+ * @defaultValue `undefined` (use `flagOrder`)
31
+ */
32
+ readonly sortFlags?: (a: string, b: string) => number;
15
33
  /**
16
34
  * Emit OSC 8 hyperlinks where link metadata is available (currently the
17
35
  * root-help header name/version configured via `CLIBuilder.links()`).
@@ -16,6 +16,8 @@ function resolveOptions(options) {
16
16
  width: options?.width ?? DEFAULT_WIDTH,
17
17
  binName: options?.binName,
18
18
  version: options?.version,
19
+ flagOrder: options?.flagOrder ?? "alphabetical",
20
+ sortFlags: options?.sortFlags,
19
21
  isDefaultHelp: options?.isDefaultHelp ?? false,
20
22
  theme: resolveHelpTheme(options?.colors, options?.theme)
21
23
  };
@@ -98,32 +100,45 @@ function formatFlagDescription(schema, theme) {
98
100
  return parts.join(" ");
99
101
  }
100
102
  /**
101
- * Build the flag entries sorted: short-aliased first, then alphabetical.
103
+ * Default flag order: short-aliased flags first, then alphabetical by name.
104
+ */
105
+ function defaultFlagOrder(a, b, flags) {
106
+ const aSchema = flags[a];
107
+ const bSchema = flags[b];
108
+ if (aSchema === void 0 || bSchema === void 0) return 0;
109
+ const aHasShort = getFlagAliasNames(aSchema, { kind: "short" }).length > 0;
110
+ const bHasShort = getFlagAliasNames(bSchema, { kind: "short" }).length > 0;
111
+ if (aHasShort && !bHasShort) return -1;
112
+ if (!aHasShort && bHasShort) return 1;
113
+ return a.localeCompare(b);
114
+ }
115
+ /**
116
+ * Order flag names for the table: an explicit `sortFlags` comparator wins,
117
+ * then `'declaration'` preserves `.flag()` call order, otherwise the default
118
+ * short-first alphabetical order.
119
+ */
120
+ function orderFlagNames(names, flags, opts) {
121
+ if (opts.sortFlags !== void 0) return [...names].sort(opts.sortFlags);
122
+ if (opts.flagOrder === "declaration") return names;
123
+ return [...names].sort((a, b) => defaultFlagOrder(a, b, flags));
124
+ }
125
+ /**
126
+ * Build the flag entries in the configured order.
102
127
  *
103
128
  * @param flags - Map of flag names to {@link FlagSchema} definitions.
104
- * @param theme - Theme threaded into the per-flag formatters.
105
- * @returns Sorted array of {@link FlagEntry} objects for the flags table.
129
+ * @param opts - Resolved help options (theme + flag ordering).
130
+ * @returns Array of {@link FlagEntry} objects for the flags table.
106
131
  */
107
- function buildFlagEntries(flags, theme) {
132
+ function buildFlagEntries(flags, opts) {
108
133
  const names = Object.keys(flags);
109
134
  if (names.length === 0) return [];
110
- const sorted = [...names].sort((a, b) => {
111
- const aSchema = flags[a];
112
- const bSchema = flags[b];
113
- if (aSchema === void 0 || bSchema === void 0) return 0;
114
- const aHasShort = getFlagAliasNames(aSchema, { kind: "short" }).length > 0;
115
- const bHasShort = getFlagAliasNames(bSchema, { kind: "short" }).length > 0;
116
- if (aHasShort && !bHasShort) return -1;
117
- if (!aHasShort && bHasShort) return 1;
118
- return a.localeCompare(b);
119
- });
120
135
  const entries = [];
121
- for (const name of sorted) {
136
+ for (const name of orderFlagNames(names, flags, opts)) {
122
137
  const schema = flags[name];
123
138
  if (schema === void 0) continue;
124
139
  entries.push({
125
- left: formatFlagLeft(name, schema, theme),
126
- description: formatFlagDescription(schema, theme)
140
+ left: formatFlagLeft(name, schema, opts.theme),
141
+ description: formatFlagDescription(schema, opts.theme)
127
142
  });
128
143
  }
129
144
  return entries;
@@ -267,7 +282,7 @@ function formatArgsSection(args, opts) {
267
282
  * @returns Multi-line flags section string.
268
283
  */
269
284
  function formatFlagsSection(flags, opts) {
270
- return formatFlagEntriesBlock(opts.theme.sectionTitle("Flags:"), buildFlagEntries(flags, opts.theme), opts.width);
285
+ return formatFlagEntriesBlock(opts.theme.sectionTitle("Flags:"), buildFlagEntries(flags, opts), opts.width);
271
286
  }
272
287
  /**
273
288
  * Render a titled two-column flag block from pre-built {@link FlagEntry} rows.
package/dist/index.d.mts CHANGED
@@ -21,7 +21,7 @@ import { HelpOptions, formatHelp } from "./core/help/index.mjs";
21
21
  import { RunResult } from "./core/schema/run.mjs";
22
22
  import { ActionHandler, ActionParams, AnyCommandBuilder, CommandArgEntry, CommandBuilder, CommandConfig, CommandExample, CommandMeta, CommandSchema, DeriveHandler, DeriveParams, ExampleCommand, ExampleMeta, InteractiveParams, InteractiveResolver, InteractiveResult, Out, command, group, resolveExampleCommand } from "./core/schema/command.mjs";
23
23
  import "./core/schema/index.mjs";
24
- import { ParseOptions, ParseResult, Token, parse, tokenize } from "./core/parse/index.mjs";
24
+ import { ParseOptions, ParseResult, Token, includesBeforeSeparator, parse, stripBeforeSeparator, tokenize } from "./core/parse/index.mjs";
25
25
  import { ManifestDiscoveryOptions, PackageJsonAdapter, PackageJsonData, PackageRepository, PackageRepositoryUrlOptions, discoverManifest, discoverPackageJson, inferCliName, packageRepositoryUrl } from "./core/config/package-json.mjs";
26
26
  import { HelpLinks } from "./core/cli/help-links.mjs";
27
27
  import { CompletionOptions } from "./core/completion/shells/shared.mjs";
@@ -31,7 +31,7 @@ import { generatePowerShellCompletion } from "./core/completion/shells/powershel
31
31
  import { generateZshCompletion } from "./core/completion/shells/zsh.mjs";
32
32
  import { SHELLS, Shell, generateCompletion } from "./core/completion/index.mjs";
33
33
  import { ConfigAdapter, ConfigDiscoveryOptions, ConfigDiscoveryResult, ConfigFound, ConfigNotFound, FormatLoader, buildConfigSearchPaths, configFormat, discoverConfig } from "./core/config/index.mjs";
34
- import { CLIBuilder, CLIOptions, CLIRunOptions, CLISchema, ConfigSettings, DefaultCommandOptions, InferNameOption, ManifestPresetSettings, ManifestSettings, PackageJsonSettings, ResolvedManifestSettings, cli, isMainModule } from "./core/cli/index.mjs";
34
+ import { CLIBuilder, CLIOptions, CLIRunOptions, CLISchema, ConfigSettings, DefaultCommandOptions, InferNameOption, ManifestPresetSettings, ManifestSettings, PackageJsonSettings, RenderContext, RenderContextOptions, ResolvedManifestSettings, cli, isMainModule, resolveRenderContext } from "./core/cli/index.mjs";
35
35
  import { JsonSchemaOptions, definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
36
36
  import { Colors } from "ansispeck";
37
- 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 ExampleCommand, type ExampleMeta, 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 InferStandardInput, type InferStandardOutput, 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 StandardSchemaV1, type StandardSchemaV1FailureResult, type StandardSchemaV1Issue, type StandardSchemaV1Options, type StandardSchemaV1PathSegment, type StandardSchemaV1Props, type StandardSchemaV1Result, type StandardSchemaV1SuccessResult, type StandardSchemaV1Types, 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, isMainModule, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolveExampleCommand, resolvePromptConfig, tokenize, visibleWidth };
37
+ 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 ExampleCommand, type ExampleMeta, 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 InferStandardInput, type InferStandardOutput, 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 RenderContext, type RenderContextOptions, 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 StandardSchemaV1, type StandardSchemaV1FailureResult, type StandardSchemaV1Issue, type StandardSchemaV1Options, type StandardSchemaV1PathSegment, type StandardSchemaV1Props, type StandardSchemaV1Result, type StandardSchemaV1SuccessResult, type StandardSchemaV1Types, 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, includesBeforeSeparator, inferCliName, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolveExampleCommand, resolvePromptConfig, resolveRenderContext, stripBeforeSeparator, tokenize, visibleWidth };
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { FlagBuilder, createSchema, flag, getFlagNegatedName } from "./core/sche
3
3
  import { ArgBuilder, arg, createArgSchema } from "./core/schema/arg.mjs";
4
4
  import { CommandBuilder, command, group, resolveExampleCommand } from "./core/schema/command.mjs";
5
5
  import { middleware } from "./core/schema/middleware.mjs";
6
- import { parse, tokenize } from "./core/parse/index.mjs";
6
+ import { includesBeforeSeparator, parse, stripBeforeSeparator, tokenize } from "./core/parse/index.mjs";
7
7
  import { generateBashCompletion } from "./core/completion/shells/bash.mjs";
8
8
  import { generateFishCompletion } from "./core/completion/shells/fish.mjs";
9
9
  import { generatePowerShellCompletion } from "./core/completion/shells/powershell.mjs";
@@ -18,5 +18,5 @@ import { resolve } from "./core/resolve/index.mjs";
18
18
  import { discoverManifest, discoverPackageJson, inferCliName, packageRepositoryUrl } from "./core/config/package-json.mjs";
19
19
  import { plugin } from "./core/cli/plugin.mjs";
20
20
  import { buildConfigSearchPaths, configFormat, discoverConfig } from "./core/config/index.mjs";
21
- import { CLIBuilder, cli, isMainModule } from "./core/cli/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, generateCommandSchema, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, inferCliName, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolveExampleCommand, resolvePromptConfig, tokenize, visibleWidth };
21
+ import { CLIBuilder, cli, isMainModule, resolveRenderContext } from "./core/cli/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, generateCommandSchema, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, getFlagNegatedName, group, includesBeforeSeparator, inferCliName, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, packageRepositoryUrl, parse, plugin, resolve, resolveExampleCommand, resolvePromptConfig, resolveRenderContext, stripBeforeSeparator, 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.14";
3
+ const DREAMCLI_VERSION = "3.0.0-rc.16";
4
4
  /** Git short SHA (e.g. `"f9b5f1a"`). `"dev"` when running unbundled. */
5
- const DREAMCLI_REVISION = "8e2235c";
5
+ const DREAMCLI_REVISION = "561f448";
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": "3.0.0-rc.14",
3
+ "version": "3.0.0-rc.16",
4
4
  "description": "Schema-first, fully typed TypeScript CLI framework",
5
5
  "keywords": [
6
6
  "dreamcli",