@outfitter/cli 0.5.1 → 0.5.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/README.md CHANGED
@@ -363,7 +363,7 @@ if (flags.reset) {
363
363
 
364
364
  ## Conventions
365
365
 
366
- Composable flag presets provide typed, reusable CLI flag definitions. See the [full conventions guide](../../docs/CLI-CONVENTIONS.md) for the complete catalog.
366
+ Composable flag presets provide typed, reusable CLI flag definitions. See the [full conventions guide](../../docs/cli/conventions.md) for the complete catalog.
367
367
 
368
368
  ```typescript
369
369
  import { composePresets, verbosePreset, cwdPreset, forcePreset } from "@outfitter/cli/flags";
package/dist/actions.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { SchemaCommandOptions } from "./shared/@outfitter/cli-n1k0d23k";
2
- import { FlagPreset } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { SchemaCommandOptions } from "./shared/@outfitter/cli-n1k0d23k.js";
2
+ import { FlagPreset } from "./shared/@outfitter/cli-98aa9104.js";
3
3
  import { ActionCliInputContext, ActionCliOption, ActionRegistry, ActionSurface, AnyActionSpec, HandlerContext } from "@outfitter/contracts";
4
4
  import { Command } from "commander";
5
5
  interface BuildCliCommandsOptions {
package/dist/actions.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  createSchemaCommand
4
- } from "./shared/@outfitter/cli-g0sn0r0b.js";
4
+ } from "./shared/@outfitter/cli-0cjts94k.js";
5
5
  import {
6
6
  composePresets
7
7
  } from "./shared/@outfitter/cli-pdb7znbq.js";
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CLI, CLIConfig } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { CLI, CLIConfig } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  /**
3
3
  * Create a new CLI instance with the given configuration.
4
4
  *
@@ -1,2 +1,2 @@
1
- import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-xppg982q";
1
+ import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-j2x88att.js";
2
2
  export { resolveTokenColorEnabled, createTokens, createTheme, applyColor, Tokens, TokenOptions, Theme, ColorName, ANSI };
@@ -1,3 +1,3 @@
1
- import "../shared/@outfitter/cli-qz47jk6d";
2
- import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-xppg982q";
1
+ import "../shared/@outfitter/cli-qz47jk6d.js";
2
+ import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-j2x88att.js";
3
3
  export { resolveTokenColorEnabled, createTokens, createTheme, applyColor, Tokens, TokenOptions, Theme, ColorName, ANSI };
package/dist/command.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CLI, CLIConfig, CommandAction, CommandBuilder, CommandConfig, CommandFlags, FlagPreset } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { CLI, CLIConfig, CommandAction, CommandBuilder, CommandConfig, CommandFlags, FlagPreset } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  /**
3
3
  * Create a CLI instance with a portable return type from this module.
4
4
  */
@@ -3,10 +3,10 @@ import { Command } from "commander";
3
3
  * Configuration for the completion command.
4
4
  */
5
5
  interface CompletionConfig {
6
- /** Supported shells (default: bash, zsh, fish) */
7
- readonly shells?: readonly ("bash" | "zsh" | "fish")[];
8
6
  /** Program name for completion scripts (inferred from CLI name if not provided) */
9
7
  readonly programName?: string;
8
+ /** Supported shells (default: bash, zsh, fish) */
9
+ readonly shells?: readonly ("bash" | "zsh" | "fish")[];
10
10
  }
11
11
  /**
12
12
  * Generate a completion script for the given shell.
package/dist/flags.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BooleanFlagPresetConfig, ColorFlags, ColorMode, ComposedPreset, EnumFlagPresetConfig, ExecutionFlags, ExecutionPresetConfig, FlagPreset, FlagPresetConfig, InteractionFlags, NumberFlagPresetConfig, PaginationFlags, PaginationPresetConfig, ProjectionFlags, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { BooleanFlagPresetConfig, ColorFlags, ColorMode, ComposedPreset, EnumFlagPresetConfig, ExecutionFlags, ExecutionPresetConfig, FlagPreset, FlagPresetConfig, InteractionFlags, NumberFlagPresetConfig, PaginationFlags, PaginationPresetConfig, ProjectionFlags, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  /**
3
3
  * Create a typed flag preset.
4
4
  *
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import "./shared/@outfitter/cli-qz47jk6d";
2
- import { ANSI, Theme, Tokens, createTheme } from "./shared/@outfitter/cli-xppg982q";
3
- import { exitWithError, output } from "./shared/@outfitter/cli-z7mgapx5";
4
- import { OutputMode } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import "./shared/@outfitter/cli-qz47jk6d.js";
2
+ import { ANSI, Theme, Tokens, createTheme } from "./shared/@outfitter/cli-j2x88att.js";
3
+ import { exitWithError, output } from "./shared/@outfitter/cli-xy3gs50c.js";
4
+ import { OutputMode } from "./shared/@outfitter/cli-98aa9104.js";
5
5
  export { output, exitWithError, createTheme, Tokens, Theme, OutputMode, ANSI };
package/dist/input.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CollectIdsOptions, ExpandFileOptions, FilterExpression, KeyValuePair, NormalizeIdOptions, ParseGlobOptions, Range, SortCriteria } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { CollectIdsOptions, ExpandFileOptions, FilterExpression, KeyValuePair, NormalizeIdOptions, ParseGlobOptions, Range, SortCriteria } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  import { ValidationError } from "@outfitter/contracts";
3
3
  import { Result } from "better-result";
4
4
  /**
package/dist/output.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { exitWithError, output, resolveVerbose } from "./shared/@outfitter/cli-z7mgapx5";
2
- import "./shared/@outfitter/cli-7n5zmndx";
1
+ import { exitWithError, output, resolveVerbose } from "./shared/@outfitter/cli-xy3gs50c.js";
2
+ import "./shared/@outfitter/cli-98aa9104.js";
3
3
  export { resolveVerbose, output, exitWithError };
@@ -1,4 +1,4 @@
1
- import { CursorOptions, PaginationState } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { CursorOptions, PaginationState } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  /**
3
3
  * Load persisted pagination state for a command.
4
4
  *
package/dist/query.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { FlagPreset, OutputMode } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { FlagPreset, OutputMode } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  /**
3
3
  * Configuration for the output mode preset.
4
4
  */
5
5
  interface OutputModePresetConfig {
6
- /** Allowed output modes (default: ["human", "json"]) */
7
- readonly modes?: readonly OutputMode[];
8
6
  /** Default mode when not specified (default: "human") */
9
7
  readonly defaultMode?: OutputMode;
10
8
  /** Whether to include "jsonl" in allowed modes (default: false) */
11
9
  readonly includeJsonl?: boolean;
10
+ /** Allowed output modes (default: ["human", "json"]) */
11
+ readonly modes?: readonly OutputMode[];
12
12
  }
13
13
  /**
14
14
  * Resolved output mode from CLI input.
package/dist/schema.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { ActionManifest, ActionManifestEntry, ActionSource, GenerateManifestOptions, SchemaCommandOptions, SurfaceCommandOptions, createSchemaCommand, formatManifestHuman, generateManifest } from "./shared/@outfitter/cli-n1k0d23k";
1
+ import { ActionManifest, ActionManifestEntry, ActionSource, GenerateManifestOptions, SchemaCommandOptions, SurfaceCommandOptions, createSchemaCommand, formatManifestHuman, generateManifest } from "./shared/@outfitter/cli-n1k0d23k.js";
2
2
  export { generateManifest, formatManifestHuman, createSchemaCommand, SurfaceCommandOptions, SchemaCommandOptions, GenerateManifestOptions, ActionSource, ActionManifestEntry, ActionManifest };
package/dist/schema.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createSchemaCommand,
4
4
  formatManifestHuman,
5
5
  generateManifest
6
- } from "./shared/@outfitter/cli-g0sn0r0b.js";
6
+ } from "./shared/@outfitter/cli-0cjts94k.js";
7
7
  export {
8
8
  generateManifest,
9
9
  formatManifestHuman,
@@ -42,9 +42,9 @@ function formatSummary(manifest, programName) {
42
42
  for (const [groupName, groupActions] of grouped.entries()) {
43
43
  lines.push(groupName);
44
44
  for (const action of groupActions) {
45
- const commandPart = action.cli?.command ?? action.id;
45
+ const commandPart = action.cli?.command ?? "";
46
46
  const isBase = !commandPart || commandPart.startsWith("[") || commandPart.startsWith("<");
47
- const displayCommand = isBase ? ` ${groupName} ${commandPart ?? ""}`.trimEnd() : ` ${groupName} ${commandPart}`;
47
+ const displayCommand = isBase ? ` ${groupName} ${commandPart}`.trimEnd() : ` ${groupName} ${commandPart}`;
48
48
  const desc = action.cli?.description ?? action.description ?? "";
49
49
  lines.push(padCommand(displayCommand, desc));
50
50
  }
@@ -76,8 +76,8 @@ function formatActionDetail(manifest, actionId) {
76
76
  lines.push("");
77
77
  if (entry.cli) {
78
78
  const group = entry.cli.group;
79
- const commandPart = entry.cli.command ?? entry.id;
80
- const fullCommand = group ? `${group} ${commandPart}` : commandPart;
79
+ const commandPart = entry.cli.command ?? (group ? "" : entry.id);
80
+ const fullCommand = group ? `${group} ${commandPart}`.trimEnd() : commandPart;
81
81
  lines.push(` Command: ${fullCommand}`);
82
82
  }
83
83
  lines.push(` Surfaces: ${entry.surfaces.join(", ")}`);
@@ -1,4 +1,4 @@
1
- import { OutputOptions } from "./cli-7n5zmndx";
1
+ import { OutputOptions } from "./cli-98aa9104.js";
2
2
  /**
3
3
  * Output data to the console with automatic mode selection.
4
4
  *
@@ -1,2 +1,2 @@
1
- import { TerminalOptions, getEnvValue, getTerminalWidth, hasNoColorEnv, isInteractive, resolveColorEnv, resolveForceColorEnv, supportsColor } from "../shared/@outfitter/cli-8aa1vhdn";
1
+ import { TerminalOptions, getEnvValue, getTerminalWidth, hasNoColorEnv, isInteractive, resolveColorEnv, resolveForceColorEnv, supportsColor } from "../shared/@outfitter/cli-rr1sq5s4.js";
2
2
  export { supportsColor, resolveForceColorEnv, resolveColorEnv, isInteractive, hasNoColorEnv, getTerminalWidth, getEnvValue, TerminalOptions };
@@ -1,2 +1,2 @@
1
- import { TerminalOptions, getEnvValue, getTerminalWidth, hasNoColorEnv, isInteractive, resolveColorEnv, resolveForceColorEnv, supportsColor } from "../shared/@outfitter/cli-8aa1vhdn";
1
+ import { TerminalOptions, getEnvValue, getTerminalWidth, hasNoColorEnv, isInteractive, resolveColorEnv, resolveForceColorEnv, supportsColor } from "../shared/@outfitter/cli-rr1sq5s4.js";
2
2
  export { supportsColor, resolveForceColorEnv, resolveColorEnv, isInteractive, hasNoColorEnv, getTerminalWidth, getEnvValue, TerminalOptions };
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { BooleanFlagPresetConfig, CLI, CLIConfig, CancelledError, CollectIdsOptions, ColorFlags, ColorMode, CommandAction, CommandBuilder, CommandConfig, CommandFlags, ComposedPreset, CursorOptions, DateRange, EnumFlagPresetConfig, ErrorCategory, ExecutionFlags, ExecutionPresetConfig, ExpandFileOptions, FilterExpression, FlagPreset, FlagPresetConfig, InteractionFlags, KeyValuePair, NormalizeIdOptions, NumberFlagPresetConfig, NumericRange, OutputMode, OutputOptions, PaginationFlags, PaginationPresetConfig, PaginationState, ParseGlobOptions, ProjectionFlags, Range, Result, SortCriteria, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig, ValidationError, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { BooleanFlagPresetConfig, CLI, CLIConfig, CancelledError, CollectIdsOptions, ColorFlags, ColorMode, CommandAction, CommandBuilder, CommandConfig, CommandFlags, ComposedPreset, CursorOptions, DateRange, EnumFlagPresetConfig, ErrorCategory, ExecutionFlags, ExecutionPresetConfig, ExpandFileOptions, FilterExpression, FlagPreset, FlagPresetConfig, InteractionFlags, KeyValuePair, NormalizeIdOptions, NumberFlagPresetConfig, NumericRange, OutputMode, OutputOptions, PaginationFlags, PaginationPresetConfig, PaginationState, ParseGlobOptions, ProjectionFlags, Range, Result, SortCriteria, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig, ValidationError, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  export { VerbFamily, VerbConfig, ValidationError, TimeWindowPresetConfig, TimeWindowFlags, StringListFlagPresetConfig, StrictFlags, SortCriteria, Result, Range, ProjectionFlags, ParseGlobOptions, PaginationState, PaginationPresetConfig, PaginationFlags, OutputOptions, OutputMode, NumericRange, NumberFlagPresetConfig, NormalizeIdOptions, KeyValuePair, InteractionFlags, FlagPresetConfig, FlagPreset, FilterExpression, ExpandFileOptions, ExecutionPresetConfig, ExecutionFlags, ErrorCategory, EnumFlagPresetConfig, DateRange, CursorOptions, ComposedPreset, CommandFlags, CommandConfig, CommandBuilder, CommandAction, ColorMode, ColorFlags, CollectIdsOptions, CancelledError, CLIConfig, CLI, BooleanFlagPresetConfig };
package/dist/verbs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommandBuilder, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { CommandBuilder, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  /**
3
3
  * Built-in verb families with standard primary verbs and aliases.
4
4
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outfitter/cli",
3
3
  "description": "Typed CLI runtime with terminal detection, rendering, output contracts, and input parsing",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -119,7 +119,7 @@
119
119
  "prepublishOnly": "bun ../../scripts/check-publish-manifest.ts"
120
120
  },
121
121
  "dependencies": {
122
- "@clack/prompts": "^0.11.0",
122
+ "@clack/prompts": "^1.0.1",
123
123
  "better-result": "^2.5.1",
124
124
  "commander": "^14.0.2"
125
125
  },
@@ -131,15 +131,15 @@
131
131
  "zod": "^4.3.5"
132
132
  },
133
133
  "devDependencies": {
134
- "@outfitter/config": "0.3.2",
135
- "@outfitter/contracts": "0.4.0",
136
- "@outfitter/schema": "0.2.1",
137
- "@types/bun": "^1.3.7",
134
+ "@outfitter/config": "0.3.3",
135
+ "@outfitter/contracts": "0.4.1",
136
+ "@outfitter/schema": "0.2.2",
137
+ "@types/bun": "^1.3.9",
138
138
  "@types/node": "^25.0.10",
139
139
  "typescript": "^5.9.3"
140
140
  },
141
141
  "engines": {
142
- "bun": ">=1.3.7"
142
+ "bun": ">=1.3.9"
143
143
  },
144
144
  "publishConfig": {
145
145
  "access": "public"
@@ -15,40 +15,40 @@ import { Result } from "better-result";
15
15
  * ```
16
16
  */
17
17
  interface CLIConfig {
18
- /** CLI name (used in help output and error messages) */
19
- readonly name: string;
20
- /** CLI version (displayed with --version) */
21
- readonly version: string;
22
18
  /** CLI description (displayed in help output) */
23
19
  readonly description?: string;
20
+ /** CLI name (used in help output and error messages) */
21
+ readonly name: string;
24
22
  /** Custom error handler */
25
23
  readonly onError?: (error: Error) => void;
26
24
  /** Custom exit handler (defaults to process.exit) */
27
25
  readonly onExit?: (code: number) => void | Promise<void>;
26
+ /** CLI version (displayed with --version) */
27
+ readonly version: string;
28
28
  }
29
29
  /**
30
30
  * CLI instance returned by createCLI.
31
31
  */
32
32
  interface CLI {
33
- /** Register a command with the CLI */
34
- register(command: CommandBuilder | Command): this;
35
33
  /** Parse arguments and execute the matched command */
36
34
  parse(argv?: readonly string[]): Promise<void>;
37
35
  /** Get the underlying Commander program */
38
36
  readonly program: Command;
37
+ /** Register a command with the CLI */
38
+ register(command: CommandBuilder | Command): this;
39
39
  }
40
40
  /**
41
41
  * Configuration for a single command.
42
42
  */
43
43
  interface CommandConfig {
44
- /** Command name and argument syntax (e.g., "list" or "get <id>") */
45
- readonly name: string;
46
- /** Command description */
47
- readonly description?: string;
48
44
  /** Command aliases */
49
45
  readonly aliases?: readonly string[];
46
+ /** Command description */
47
+ readonly description?: string;
50
48
  /** Whether to hide from help output */
51
49
  readonly hidden?: boolean;
50
+ /** Command name and argument syntax (e.g., "list" or "get <id>") */
51
+ readonly name: string;
52
52
  }
53
53
  /**
54
54
  * Action function executed when a command is invoked.
@@ -72,44 +72,44 @@ type CommandFlags = Record<string, unknown>;
72
72
  * Builder interface for constructing commands fluently.
73
73
  */
74
74
  interface CommandBuilder {
75
+ /** Set the action handler */
76
+ action<TFlags extends CommandFlags = CommandFlags>(handler: CommandAction<TFlags>): this;
77
+ /** Add command aliases */
78
+ alias(alias: string): this;
79
+ /** Build the underlying Commander command */
80
+ build(): Command;
75
81
  /** Set command description */
76
82
  description(text: string): this;
77
83
  /** Add a command option/flag */
78
84
  option(flags: string, description: string, defaultValue?: unknown): this;
79
- /** Add a required option */
80
- requiredOption(flags: string, description: string, defaultValue?: unknown): this;
81
- /** Add command aliases */
82
- alias(alias: string): this;
83
85
  /** Apply a flag preset (adds its options to the command) */
84
86
  preset(preset: FlagPreset<Record<string, unknown>>): this;
85
- /** Set the action handler */
86
- action<TFlags extends CommandFlags = CommandFlags>(handler: CommandAction<TFlags>): this;
87
- /** Build the underlying Commander command */
88
- build(): Command;
87
+ /** Add a required option */
88
+ requiredOption(flags: string, description: string, defaultValue?: unknown): this;
89
89
  }
90
90
  /**
91
91
  * A family of related command verbs with a primary name and aliases.
92
92
  */
93
93
  interface VerbFamily {
94
- /** Primary verb name */
95
- readonly primary: string;
96
94
  /** Alternative names for this verb */
97
95
  readonly aliases: readonly string[];
98
96
  /** Description of what this verb family does */
99
97
  readonly description: string;
98
+ /** Primary verb name */
99
+ readonly primary: string;
100
100
  }
101
101
  /**
102
102
  * Configuration for resolving a verb family with project-level overrides.
103
103
  */
104
104
  interface VerbConfig {
105
- /** Override the primary verb (e.g., "edit" instead of "modify") */
106
- readonly primary?: string;
107
105
  /** Whether to include aliases (default: true) */
108
106
  readonly aliases?: boolean;
109
- /** Additional aliases beyond defaults */
110
- readonly extraAliases?: readonly string[];
111
107
  /** Aliases to exclude */
112
108
  readonly excludeAliases?: readonly string[];
109
+ /** Additional aliases beyond defaults */
110
+ readonly extraAliases?: readonly string[];
111
+ /** Override the primary verb (e.g., "edit" instead of "modify") */
112
+ readonly primary?: string;
113
113
  }
114
114
  /**
115
115
  * A composable set of CLI flags with typed resolution.
@@ -140,22 +140,22 @@ interface FlagPresetConfig<TResolved extends Record<string, unknown>> {
140
140
  * Configuration for creating a custom boolean flag preset.
141
141
  */
142
142
  interface BooleanFlagPresetConfig<TKey extends string> {
143
+ /** Default resolved value (defaults to false) */
144
+ readonly defaultValue?: boolean;
145
+ /** Help description for the option */
146
+ readonly description: string;
147
+ /** Commander option definition (e.g., "--force" or "--no-codemods") */
148
+ readonly flags: string;
143
149
  /** Unique identifier for deduplication */
144
150
  readonly id: string;
145
151
  /** Resolved output property name */
146
152
  readonly key: TKey;
147
- /** Commander option definition (e.g., "--force" or "--no-codemods") */
148
- readonly flags: string;
149
- /** Help description for the option */
150
- readonly description: string;
151
- /** Default resolved value (defaults to false) */
152
- readonly defaultValue?: boolean;
153
- /** Candidate raw flag keys to read (defaults to [key]) */
154
- readonly sources?: readonly string[];
155
153
  /** Positive keys that should be negated (e.g., "codemods" for --no-codemods) */
156
154
  readonly negatedSources?: readonly string[];
157
155
  /** Whether the option is required */
158
156
  readonly required?: boolean;
157
+ /** Candidate raw flag keys to read (defaults to [key]) */
158
+ readonly sources?: readonly string[];
159
159
  }
160
160
  /**
161
161
  * Configuration for creating a custom enum flag preset.
@@ -164,70 +164,70 @@ interface EnumFlagPresetConfig<
164
164
  TKey extends string,
165
165
  TValue extends string
166
166
  > {
167
+ /** Fallback value when input is missing or invalid */
168
+ readonly defaultValue: TValue;
169
+ /** Help description for the option */
170
+ readonly description: string;
171
+ /** Commander option definition */
172
+ readonly flags: string;
167
173
  /** Unique identifier for deduplication */
168
174
  readonly id: string;
169
175
  /** Resolved output property name */
170
176
  readonly key: TKey;
171
- /** Commander option definition */
172
- readonly flags: string;
173
- /** Help description for the option */
174
- readonly description: string;
175
- /** Allowed enum values */
176
- readonly values: readonly TValue[];
177
- /** Fallback value when input is missing or invalid */
178
- readonly defaultValue: TValue;
179
- /** Candidate raw flag keys to read (defaults to [key]) */
180
- readonly sources?: readonly string[];
181
177
  /** Whether the option is required */
182
178
  readonly required?: boolean;
179
+ /** Candidate raw flag keys to read (defaults to [key]) */
180
+ readonly sources?: readonly string[];
181
+ /** Allowed enum values */
182
+ readonly values: readonly TValue[];
183
183
  }
184
184
  /**
185
185
  * Configuration for creating a custom numeric flag preset.
186
186
  */
187
187
  interface NumberFlagPresetConfig<TKey extends string> {
188
+ /** Fallback value when input is missing or invalid */
189
+ readonly defaultValue: number;
190
+ /** Help description for the option */
191
+ readonly description: string;
192
+ /** Commander option definition */
193
+ readonly flags: string;
188
194
  /** Unique identifier for deduplication */
189
195
  readonly id: string;
196
+ /** Floor parsed values (defaults to true) */
197
+ readonly integer?: boolean;
190
198
  /** Resolved output property name */
191
199
  readonly key: TKey;
192
- /** Commander option definition */
193
- readonly flags: string;
194
- /** Help description for the option */
195
- readonly description: string;
196
- /** Fallback value when input is missing or invalid */
197
- readonly defaultValue: number;
198
- /** Candidate raw flag keys to read (defaults to [key]) */
199
- readonly sources?: readonly string[];
200
- /** Lower bound (inclusive) */
201
- readonly min?: number;
202
200
  /** Upper bound (inclusive) */
203
201
  readonly max?: number;
204
- /** Floor parsed values (defaults to true) */
205
- readonly integer?: boolean;
202
+ /** Lower bound (inclusive) */
203
+ readonly min?: number;
206
204
  /** Whether the option is required */
207
205
  readonly required?: boolean;
206
+ /** Candidate raw flag keys to read (defaults to [key]) */
207
+ readonly sources?: readonly string[];
208
208
  }
209
209
  /**
210
210
  * Configuration for creating a custom string-list flag preset.
211
211
  */
212
212
  interface StringListFlagPresetConfig<TKey extends string> {
213
+ /** Remove duplicate values while preserving order */
214
+ readonly dedupe?: boolean;
215
+ /** Fallback list when input is missing or invalid */
216
+ readonly defaultValue?: readonly string[];
217
+ /** Help description for the option */
218
+ readonly description: string;
219
+ /** Commander option definition */
220
+ readonly flags: string;
213
221
  /** Unique identifier for deduplication */
214
222
  readonly id: string;
215
223
  /** Resolved output property name */
216
224
  readonly key: TKey;
217
- /** Commander option definition */
218
- readonly flags: string;
219
- /** Help description for the option */
220
- readonly description: string;
221
- /** Candidate raw flag keys to read (defaults to [key]) */
222
- readonly sources?: readonly string[];
223
- /** Fallback list when input is missing or invalid */
224
- readonly defaultValue?: readonly string[];
225
- /** Split string values by this separator (defaults to ",") */
226
- readonly separator?: string;
227
- /** Remove duplicate values while preserving order */
228
- readonly dedupe?: boolean;
229
225
  /** Whether the option is required */
230
226
  readonly required?: boolean;
227
+ /** Split string values by this separator (defaults to ",") */
228
+ readonly separator?: string;
229
+ /** Candidate raw flag keys to read (defaults to [key]) */
230
+ readonly sources?: readonly string[];
231
231
  }
232
232
  /**
233
233
  * Result of composing multiple presets together.
@@ -290,10 +290,10 @@ type ExecutionFlags = {
290
290
  * Configuration for the execution flag preset.
291
291
  */
292
292
  interface ExecutionPresetConfig {
293
- /** Default timeout in milliseconds (default: undefined) */
294
- readonly defaultTimeout?: number;
295
293
  /** Default number of retries (default: 0) */
296
294
  readonly defaultRetries?: number;
295
+ /** Default timeout in milliseconds (default: undefined) */
296
+ readonly defaultTimeout?: number;
297
297
  /** Maximum number of retries (default: 10) */
298
298
  readonly maxRetries?: number;
299
299
  }
@@ -338,14 +338,14 @@ type OutputMode = "human" | "json" | "jsonl" | "tree" | "table";
338
338
  * Options for the output() function.
339
339
  */
340
340
  interface OutputOptions {
341
+ /** Exit code to use after output (undefined = don't exit) */
342
+ readonly exitCode?: number;
341
343
  /** Force a specific output mode (overrides flag detection) */
342
344
  readonly mode?: OutputMode;
343
- /** Stream to write to (defaults to stdout) */
344
- readonly stream?: NodeJS.WritableStream;
345
345
  /** Whether to pretty-print JSON output */
346
346
  readonly pretty?: boolean;
347
- /** Exit code to use after output (undefined = don't exit) */
348
- readonly exitCode?: number;
347
+ /** Stream to write to (defaults to stdout) */
348
+ readonly stream?: NodeJS.WritableStream;
349
349
  }
350
350
  /**
351
351
  * Options for collectIds() input utility.
@@ -389,10 +389,10 @@ interface ParseGlobOptions {
389
389
  readonly followSymlinks?: boolean;
390
390
  /** Patterns to exclude */
391
391
  readonly ignore?: readonly string[];
392
- /** Only match files (not directories) */
393
- readonly onlyFiles?: boolean;
394
392
  /** Only match directories (not files) */
395
393
  readonly onlyDirectories?: boolean;
394
+ /** Only match files (not directories) */
395
+ readonly onlyFiles?: boolean;
396
396
  }
397
397
  /**
398
398
  * Options for normalizeId().
@@ -400,14 +400,14 @@ interface ParseGlobOptions {
400
400
  interface NormalizeIdOptions {
401
401
  /** Whether to lowercase the ID */
402
402
  readonly lowercase?: boolean;
403
- /** Whether to trim whitespace */
404
- readonly trim?: boolean;
405
- /** Minimum length requirement */
406
- readonly minLength?: number;
407
403
  /** Maximum length requirement */
408
404
  readonly maxLength?: number;
405
+ /** Minimum length requirement */
406
+ readonly minLength?: number;
409
407
  /** Pattern the ID must match */
410
408
  readonly pattern?: RegExp;
409
+ /** Whether to trim whitespace */
410
+ readonly trim?: boolean;
411
411
  }
412
412
  /**
413
413
  * Numeric or date range parsed from CLI input.
@@ -417,32 +417,32 @@ type Range = NumericRange | DateRange;
417
417
  * Numeric range (e.g., "1-10").
418
418
  */
419
419
  interface NumericRange {
420
- readonly type: "number";
421
- readonly min: number;
422
420
  readonly max: number;
421
+ readonly min: number;
422
+ readonly type: "number";
423
423
  }
424
424
  /**
425
425
  * Date range (e.g., "2024-01-01..2024-12-31").
426
426
  */
427
427
  interface DateRange {
428
- readonly type: "date";
429
- readonly start: Date;
430
428
  readonly end: Date;
429
+ readonly start: Date;
430
+ readonly type: "date";
431
431
  }
432
432
  /**
433
433
  * Filter expression parsed from CLI input.
434
434
  */
435
435
  interface FilterExpression {
436
436
  readonly field: string;
437
- readonly value: string;
438
437
  readonly operator?: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "contains";
438
+ readonly value: string;
439
439
  }
440
440
  /**
441
441
  * Sort criteria parsed from CLI input.
442
442
  */
443
443
  interface SortCriteria {
444
- readonly field: string;
445
444
  readonly direction: "asc" | "desc";
445
+ readonly field: string;
446
446
  }
447
447
  /**
448
448
  * Key-value pair parsed from CLI input.
@@ -455,16 +455,16 @@ interface KeyValuePair {
455
455
  * State for paginated command results.
456
456
  */
457
457
  interface PaginationState {
458
- /** Cursor for the next page */
459
- readonly cursor: string;
460
458
  /** Command that generated this state */
461
459
  readonly command: string;
462
460
  /** Context key for scoping pagination */
463
461
  readonly context?: string;
464
- /** Timestamp when state was created */
465
- readonly timestamp: number;
462
+ /** Cursor for the next page */
463
+ readonly cursor: string;
466
464
  /** Whether there are more results */
467
465
  readonly hasMore: boolean;
466
+ /** Timestamp when state was created */
467
+ readonly timestamp: number;
468
468
  /** Total count (if known) */
469
469
  readonly total?: number;
470
470
  }
@@ -476,12 +476,12 @@ interface CursorOptions {
476
476
  readonly command: string;
477
477
  /** Context key for additional scoping */
478
478
  readonly context?: string;
479
- /** Tool name for XDG path resolution */
480
- readonly toolName: string;
481
- /** Maximum age in milliseconds before a cursor is treated as expired */
482
- readonly maxAgeMs?: number;
483
479
  /** Whether there are more results (defaults to true) */
484
480
  readonly hasMore?: boolean;
481
+ /** Maximum age in milliseconds before a cursor is treated as expired */
482
+ readonly maxAgeMs?: number;
483
+ /** Tool name for XDG path resolution */
484
+ readonly toolName: string;
485
485
  /** Total count of results (if known) */
486
486
  readonly total?: number;
487
487
  }
@@ -37,40 +37,40 @@ declare const ANSI: {
37
37
  * ```
38
38
  */
39
39
  interface Theme {
40
- /** Applies green color for success messages */
41
- success: (text: string) => string;
42
- /** Applies yellow color for warning messages */
43
- warning: (text: string) => string;
40
+ /** Applies cyan color for interactive elements and highlights */
41
+ accent: (text: string) => string;
42
+ /** Applies bold styling */
43
+ bold: (text: string) => string;
44
+ /** Applies bright red for dangerous actions */
45
+ destructive: (text: string) => string;
46
+ /** Applies dim styling (alias for muted style) */
47
+ dim: (text: string) => string;
44
48
  /** Applies red color for error messages */
45
49
  error: (text: string) => string;
50
+ /** Applies bold for strong emphasis */
51
+ highlight: (text: string) => string;
46
52
  /** Applies blue color for informational messages */
47
53
  info: (text: string) => string;
54
+ /** Applies inverse styling (swaps foreground/background) */
55
+ inverse: (text: string) => string;
56
+ /** Applies italic styling */
57
+ italic: (text: string) => string;
58
+ /** Applies cyan + underline for URLs and clickable references */
59
+ link: (text: string) => string;
60
+ /** Applies dim styling for de-emphasized text */
61
+ muted: (text: string) => string;
48
62
  /** Returns text unchanged (primary/default text) */
49
63
  primary: (text: string) => string;
50
64
  /** Applies gray color for secondary text */
51
65
  secondary: (text: string) => string;
52
- /** Applies dim styling for de-emphasized text */
53
- muted: (text: string) => string;
54
- /** Applies cyan color for interactive elements and highlights */
55
- accent: (text: string) => string;
56
- /** Applies bold for strong emphasis */
57
- highlight: (text: string) => string;
58
- /** Applies cyan + underline for URLs and clickable references */
59
- link: (text: string) => string;
60
- /** Applies bright red for dangerous actions */
61
- destructive: (text: string) => string;
62
66
  /** Applies dim gray for less prominent text than muted */
63
67
  subtle: (text: string) => string;
64
- /** Applies bold styling */
65
- bold: (text: string) => string;
66
- /** Applies italic styling */
67
- italic: (text: string) => string;
68
+ /** Applies green color for success messages */
69
+ success: (text: string) => string;
68
70
  /** Applies underline styling */
69
71
  underline: (text: string) => string;
70
- /** Applies dim styling (alias for muted style) */
71
- dim: (text: string) => string;
72
- /** Applies inverse styling (swaps foreground/background) */
73
- inverse: (text: string) => string;
72
+ /** Applies yellow color for warning messages */
73
+ warning: (text: string) => string;
74
74
  }
75
75
  /**
76
76
  * Available color names for the {@link applyColor} function.
@@ -104,40 +104,40 @@ type ColorName = "green" | "yellow" | "red" | "blue" | "cyan" | "magenta" | "whi
104
104
  * ```
105
105
  */
106
106
  interface Tokens {
107
- /** Green color for success messages */
108
- success: string;
109
- /** Yellow color for warning messages */
110
- warning: string;
107
+ /** Cyan color for interactive elements and highlights */
108
+ accent: string;
109
+ /** Bold styling */
110
+ bold: string;
111
+ /** Bright red for dangerous actions */
112
+ destructive: string;
113
+ /** Dim styling */
114
+ dim: string;
111
115
  /** Red color for error messages */
112
116
  error: string;
117
+ /** Bold for strong emphasis */
118
+ highlight: string;
113
119
  /** Blue color for informational messages */
114
120
  info: string;
121
+ /** Inverse styling (swaps foreground/background) */
122
+ inverse: string;
123
+ /** Italic styling */
124
+ italic: string;
125
+ /** Cyan + underline for URLs and clickable references */
126
+ link: string;
127
+ /** Dim/gray color for de-emphasized text */
128
+ muted: string;
115
129
  /** Default text color (typically empty string) */
116
130
  primary: string;
117
131
  /** Subdued color for secondary text */
118
132
  secondary: string;
119
- /** Dim/gray color for de-emphasized text */
120
- muted: string;
121
- /** Cyan color for interactive elements and highlights */
122
- accent: string;
123
- /** Bold for strong emphasis */
124
- highlight: string;
125
- /** Cyan + underline for URLs and clickable references */
126
- link: string;
127
- /** Bright red for dangerous actions */
128
- destructive: string;
129
133
  /** Dim gray for less prominent text than muted */
130
134
  subtle: string;
131
- /** Bold styling */
132
- bold: string;
133
- /** Italic styling */
134
- italic: string;
135
+ /** Green color for success messages */
136
+ success: string;
135
137
  /** Underline styling */
136
138
  underline: string;
137
- /** Dim styling */
138
- dim: string;
139
- /** Inverse styling (swaps foreground/background) */
140
- inverse: string;
139
+ /** Yellow color for warning messages */
140
+ warning: string;
141
141
  }
142
142
  /**
143
143
  * Configuration options for {@link createTokens}.
@@ -152,11 +152,6 @@ interface Tokens {
152
152
  * ```
153
153
  */
154
154
  interface TokenOptions {
155
- /**
156
- * Override NO_COLOR environment variable.
157
- * When true, colors are enabled regardless of NO_COLOR.
158
- */
159
- forceColor?: boolean;
160
155
  /**
161
156
  * Color support level:
162
157
  * - 0: No color support (all tokens are empty strings)
@@ -167,6 +162,11 @@ interface TokenOptions {
167
162
  * When not specified, level is auto-detected from environment.
168
163
  */
169
164
  colorLevel?: 0 | 1 | 2 | 3;
165
+ /**
166
+ * Override NO_COLOR environment variable.
167
+ * When true, colors are enabled regardless of NO_COLOR.
168
+ */
169
+ forceColor?: boolean;
170
170
  }
171
171
  /**
172
172
  * Creates a theme with semantic and text color functions.
@@ -14,10 +14,10 @@
14
14
  * ```
15
15
  */
16
16
  interface TerminalOptions {
17
- /** Override TTY detection (uses process.stdout.isTTY if not specified) */
18
- isTTY?: boolean;
19
17
  /** Override CI detection (uses CI env variable if not specified) */
20
18
  isCI?: boolean;
19
+ /** Override TTY detection (uses process.stdout.isTTY if not specified) */
20
+ isTTY?: boolean;
21
21
  }
22
22
  /**
23
23
  * Gets the value of an environment variable.