@boneskull/bargs 1.0.0 → 2.0.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AActC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB;AAEpD;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,KAAc,EAAiC,EAAE,CACnE,KAAK,KAAK,IAAI;IACd,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAQ,KAA4B,CAAC,IAAI,KAAK,UAAU,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,OAAqB,EAAE,MAAS,EAAQ,EAAE;IAC1E,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,UAAU,CAClB,mEAAmE,CACpE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,OAAqB,EACrB,MAAS,EACM,EAAE;IACjB,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC,CAAC;AAmCF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAM/B,UAEa,EACb,MAAiB,EACjB,WAA2B;IAK3B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IACjC,CAAC;IAED,yBAAyB;IACzB,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM;QACzC,CAAC,CAAC,CAAC,GAAG,EAAE;YACJ,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC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AAG,WAAW,CAAC,WAAW,CAAC;IAC/C,CAAC;IAED,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,kBAAkB;QAC/B,MAAM,EAAE,aAAa;KAKtB,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
package/dist/types.d.cts CHANGED
@@ -15,8 +15,21 @@
15
15
  */
16
16
  import type { ThemeInput } from "./theme.cjs";
17
17
  /**
18
- * Any command config (type-erased for collections). Uses a permissive handler
19
- * type to avoid variance issues.
18
+ * Type-erased command config for use in collections and constraints.
19
+ *
20
+ * WARNING: The handler uses `any` which will leak into inline command handlers.
21
+ * For proper type inference in command handlers, use one of these patterns:
22
+ *
23
+ * 1. Use `bargs.command<typeof globalOptions>()({...})` to define commands
24
+ * 2. Define commands in a separate variable with explicit types
25
+ * 3. Add explicit type annotations to handler parameters
26
+ *
27
+ * @example // Option 1: Use bargs.command() (recommended) const myCmd =
28
+ * bargs.command<typeof globalOpts>()({ handler: ({ values }) => { ... } //
29
+ * values is properly typed });
30
+ *
31
+ * // Option 2: Explicit parameter types handler: ({ values }: BargsResult<...>)
32
+ * => { ... }
20
33
  */
21
34
  export interface AnyCommandConfig {
22
35
  description: string;
@@ -25,6 +38,14 @@ export interface AnyCommandConfig {
25
38
  positionals?: PositionalsSchema;
26
39
  transforms?: TransformsConfig<any, any, any, any>;
27
40
  }
41
+ /**
42
+ * Command config shape used for type constraints/inference.
43
+ *
44
+ * Intentionally omits `handler` so inline command handlers are not
45
+ * context-typed as `(result: any) => …` before `CommandsInput` can apply the
46
+ * computed handler signature.
47
+ */
48
+ export type AnyCommandConfigInput = Omit<AnyCommandConfig, 'handler'>;
28
49
  /**
29
50
  * Array option definition (--flag value --flag value2).
30
51
  */
@@ -42,7 +63,7 @@ export interface ArrayOption extends OptionBase {
42
63
  * @typeParam TCommands - Commands record type (undefined for simple CLIs)
43
64
  * @typeParam TTransforms - Transforms config type (affects handler input types)
44
65
  */
45
- export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TCommands extends Record<string, AnyCommandConfig> | undefined = undefined, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
66
+ export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TCommands extends Record<string, AnyCommandConfigInput> | undefined = undefined, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
46
67
  args?: string[];
47
68
  commands?: TCommands;
48
69
  description?: string;
@@ -52,12 +73,6 @@ export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPo
52
73
  * string to disable.
53
74
  */
54
75
  epilog?: false | string;
55
- /**
56
- * Handler receives the final transformed values and positionals. When
57
- * transforms are defined, types flow through the transform pipeline. Handler
58
- * arrays are no longer supported - use a single handler function.
59
- */
60
- handler?: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions>, TTransforms>, InferTransformedPositionals<InferPositionals<TPositionals>, TTransforms>, undefined>>;
61
76
  name: string;
62
77
  options?: TOptions;
63
78
  positionals?: TPositionals;
@@ -66,23 +81,12 @@ export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPo
66
81
  * Values transform receives InferOptions<TOptions>, positionals transform
67
82
  * receives InferPositionals<TPositionals>.
68
83
  */
69
- transforms?: [TTransforms] extends [undefined] ? TransformsConfig<any, any, any, any> : TTransforms;
84
+ transforms?: 0 extends 1 & TTransforms ? TransformsConfig<any, any, any, any> : [TTransforms] extends [undefined] ? TransformsInput<InferOptions<TOptions>, InferPositionals<TPositionals>> : TTransforms;
70
85
  version?: string;
71
86
  }
72
- /**
73
- * Bargs config with commands (requires commands, allows defaultHandler).
74
- *
75
- * Commands can be defined in two ways:
76
- *
77
- * 1. Using opt.command() - handler receives local options only (legacy)
78
- * 2. Inline definition - handler can receive both global and local options
79
- *
80
- * Note: Top-level `positionals` is not allowed for command-based CLIs. Each
81
- * command defines its own positionals.
82
- */
83
- export type BargsConfigWithCommands<TOptions extends OptionsSchema = OptionsSchema, TCommands extends Record<string, CommandConfigInput> = Record<string, CommandConfigInput>, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> = Omit<BargsConfig<TOptions, PositionalsSchema, TCommands, TTransforms>, 'handler' | 'positionals'> & {
84
- commands: TCommands;
85
- defaultHandler?: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions>, TTransforms>, readonly [], undefined>> | keyof TCommands;
87
+ export type BargsConfigWithCommands<TOptions extends OptionsSchema = OptionsSchema, TCommands extends Record<string, AnyCommandConfigInput> = Record<string, AnyCommandConfigInput>, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> = Omit<BargsConfig<TOptions, PositionalsSchema, TCommands, TTransforms>, 'commands' | 'positionals'> & {
88
+ commands: CommandsInput<TOptions, TTransforms, TCommands> & TCommands;
89
+ defaultHandler?: CommandNames<TCommands> | Handler<BargsResult<InferTransformedValues<InferOptions<TOptions>, TTransforms>, readonly [], undefined>>;
86
90
  };
87
91
  /**
88
92
  * Runtime options for bargs (separate from parsing config).
@@ -109,30 +113,33 @@ export interface BooleanOption extends OptionBase {
109
113
  /**
110
114
  * Command configuration.
111
115
  *
112
- * The handler receives typed local options plus access to global options (as
113
- * Record<string, unknown>). Global options are available at runtime but require
114
- * type narrowing to access safely.
116
+ * The handler receives typed global options merged with command-specific
117
+ * options, properly transformed. Use `bargs.command<TGlobalOptions,
118
+ * TGlobalTransforms>()` to pass both global options and transforms types for
119
+ * full type inference.
115
120
  *
121
+ * @typeParam TGlobalOptions - Global options schema (from parent config)
122
+ * @typeParam TGlobalTransforms - Global transforms config (from parent config)
116
123
  * @typeParam TOptions - Command-specific options schema
117
124
  * @typeParam TPositionals - Command positionals schema
118
125
  * @typeParam TTransforms - Command-level transforms config
119
126
  */
120
- export interface CommandConfig<TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
127
+ export interface CommandConfig<TGlobalOptions extends OptionsSchema = OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined, TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
121
128
  description: string;
122
- handler: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions> & Record<string, unknown>, TTransforms>, InferTransformedPositionals<InferPositionals<TPositionals>, TTransforms>, string>>;
129
+ handler: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions> & InferTransformedValues<InferOptions<TGlobalOptions>, TGlobalTransforms>, TTransforms>, InferTransformedPositionals<InferPositionals<TPositionals>, TTransforms>, string>>;
123
130
  options?: TOptions;
124
131
  positionals?: TPositionals;
125
132
  /** Command-level transforms run after top-level transforms */
126
- transforms?: TTransforms;
133
+ transforms?: 0 extends 1 & TTransforms ? TransformsConfig<any, any, any, any> : [TTransforms] extends [undefined] ? TransformsInput<InferOptions<TOptions> & InferTransformedValues<InferOptions<TGlobalOptions>, TGlobalTransforms>, InferPositionals<TPositionals>> : TTransforms;
127
134
  }
128
135
  /**
129
- * Command config input type for inline command definitions. The handler type is
130
- * intentionally loose here - it accepts any result type, allowing commands
131
- * defined with opt.command() or inline to work.
136
+ * Command config input type for inline command definitions. Uses `any` for
137
+ * handler result to accept any handler signature. See AnyCommandConfig for
138
+ * workarounds to get proper type inference.
132
139
  */
133
140
  export interface CommandConfigInput {
134
141
  description: string;
135
- handler: Handler<any>;
142
+ handler: (result: any) => Promise<void> | void;
136
143
  options?: OptionsSchema;
137
144
  positionals?: PositionalsSchema;
138
145
  transforms?: TransformsConfig<any, any, any, any>;
@@ -169,6 +176,11 @@ export type Handler<TResult> = HandlerFn<TResult>;
169
176
  * Single handler function signature.
170
177
  */
171
178
  export type HandlerFn<TResult> = (result: TResult) => Promise<void> | void;
179
+ /**
180
+ * Compute the handler result type for a single command. Separating this makes
181
+ * the type easier for TypeScript to evaluate.
182
+ */
183
+ export type InferCommandResult<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TCommandOptions extends OptionsSchema | undefined, TCommandPositionals extends PositionalsSchema | undefined, TCommandTransforms extends TransformsConfig<any, any, any, any> | undefined> = BargsResult<InferTransformedValues<InferTransformedValues<InferOptions<TGlobalOptions> & (TCommandOptions extends OptionsSchema ? InferOptions<TCommandOptions> : Record<string, never>), TGlobalTransforms>, TCommandTransforms>, InferTransformedPositionals<TCommandPositionals extends PositionalsSchema ? InferPositionals<TCommandPositionals> : readonly [], TCommandTransforms>, string>;
172
184
  /**
173
185
  * Infer the TypeScript type from an option definition.
174
186
  */
@@ -191,7 +203,38 @@ export type InferPositional<T extends PositionalDef> = T extends NumberPositiona
191
203
  export type InferPositionals<T extends PositionalsSchema> = T extends readonly [
192
204
  infer First,
193
205
  ...infer Rest
194
- ] ? First extends PositionalDef ? Rest extends PositionalsSchema ? readonly [InferPositional<First>, ...InferPositionals<Rest>] : readonly [InferPositional<First>] : readonly [] : T extends readonly [infer Only] ? Only extends PositionalDef ? readonly [InferPositional<Only>] : readonly [] : readonly [];
206
+ ] ? First extends PositionalDef ? Rest extends PositionalsSchema ? readonly [InferPositional<First>, ...InferPositionals<Rest>] : readonly [InferPositional<First>] : readonly [] : T extends readonly [infer Only] ? Only extends PositionalDef ? readonly [InferPositional<Only>] : readonly [] : T extends readonly [] ? readonly [] : readonly InferPositional<T[number]>[];
207
+ /**
208
+ * Compute proper handler types for each command in a commands record.
209
+ *
210
+ * This mapped type enables type inference for inline command definitions by
211
+ * computing the handler signature from each command's options, positionals, and
212
+ * transforms - plus the global options and transforms from the parent config.
213
+ *
214
+ * The handler receives:
215
+ *
216
+ * - Values: global options + command options, transformed by global then command
217
+ * transforms
218
+ * - Positionals: command positionals, transformed by command transforms
219
+ * - Command: the command name (string)
220
+ *
221
+ * Commands defined with `opt.command()` (returning `CommandConfig`) are passed
222
+ * through unchanged to preserve their existing handler types. Only inline
223
+ * command definitions get the computed handler type.
224
+ *
225
+ * @typeParam TGlobalOptions - Top-level options schema
226
+ * @typeParam TGlobalTransforms - Top-level transforms config
227
+ * @typeParam TCommands - Record of command configurations
228
+ */
229
+ export type InferredCommands<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TCommands extends Record<string, AnyCommandConfigInput>> = {
230
+ [K in keyof TCommands]: TCommands[K] extends CommandConfig<infer _TGlobalOpts, infer _TGlobalTrans, infer _TOpts, infer _TPos, infer _TTrans> ? TCommands[K] : {
231
+ description: TCommands[K]['description'];
232
+ handler: Handler<InferCommandResult<TGlobalOptions, TGlobalTransforms, NonNullable<TCommands[K]['options']> extends OptionsSchema ? NonNullable<TCommands[K]['options']> : undefined, NonNullable<TCommands[K]['positionals']> extends PositionalsSchema ? NonNullable<TCommands[K]['positionals']> : undefined, NonNullable<TCommands[K]['transforms']> extends TransformsConfig<any, any, any, any> ? NonNullable<TCommands[K]['transforms']> : undefined>>;
233
+ options?: TCommands[K]['options'];
234
+ positionals?: TCommands[K]['positionals'];
235
+ transforms?: TCommands[K]['transforms'];
236
+ };
237
+ };
195
238
  /**
196
239
  * Infer the output positionals type from a transforms config. If no positionals
197
240
  * transform, output equals input.
@@ -278,6 +321,51 @@ export interface VariadicPositional extends PositionalBase {
278
321
  items: 'number' | 'string';
279
322
  type: 'variadic';
280
323
  }
324
+ /**
325
+ * Command input type that computes the proper handler signature from the
326
+ * command's own options/positionals schemas. This provides contextual typing
327
+ * for inline command handlers.
328
+ *
329
+ * @typeParam TGlobalOptions - Global options schema from parent config
330
+ * @typeParam TGlobalTransforms - Global transforms from parent config
331
+ * @typeParam TOptions - Command's own options schema
332
+ * @typeParam TPositionals - Command's own positionals schema
333
+ * @typeParam TTransforms - Command's own transforms
334
+ */
335
+ interface CommandInput<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TOptions extends OptionsSchema = Record<string, never>, TPositionals extends PositionalsSchema = [], TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
336
+ description: string;
337
+ handler: Handler<InferCommandResult<TGlobalOptions, TGlobalTransforms, TOptions, TPositionals, TTransforms>>;
338
+ options?: TOptions;
339
+ positionals?: TPositionals;
340
+ transforms?: TTransforms;
341
+ }
342
+ /**
343
+ * Helper type to extract command names from a commands record for
344
+ * defaultHandler typing.
345
+ */
346
+ type CommandNames<T> = T extends Record<infer K, AnyCommandConfigInput> ? K : never;
347
+ /**
348
+ * Bargs config with commands (requires commands, allows defaultHandler).
349
+ *
350
+ * Commands can be defined in two ways:
351
+ *
352
+ * 1. Using opt.command() - handler receives local options only (legacy)
353
+ * 2. Inline definition - handler receives both global and local options
354
+ *
355
+ * Note: Top-level `positionals` is not allowed for command-based CLIs. Each
356
+ * command defines its own positionals.
357
+ *
358
+ * The `commands` property uses `InferredCommands` to compute proper handler
359
+ * types for inline command definitions. Each command's handler type includes
360
+ * global options merged with command options, transformed appropriately.
361
+ */
362
+ /**
363
+ * Mapped type that computes the expected command input type for each command in
364
+ * the record. This provides contextual typing for inline command handlers.
365
+ */
366
+ type CommandsInput<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TCommands extends Record<string, AnyCommandConfigInput>> = {
367
+ [K in keyof TCommands]: TCommands[K] extends CommandConfig<infer _TGlobalOpts, infer _TGlobalTrans, infer _TOpts, infer _TPos, infer _TTrans> ? TCommands[K] : CommandInput<TGlobalOptions, TGlobalTransforms, NonNullable<TCommands[K]['options']> extends OptionsSchema ? NonNullable<TCommands[K]['options']> : Record<string, never>, NonNullable<TCommands[K]['positionals']> extends PositionalsSchema ? NonNullable<TCommands[K]['positionals']> : [], NonNullable<TCommands[K]['transforms']> extends TransformsConfig<any, any, any, any> ? NonNullable<TCommands[K]['transforms']> : undefined>;
368
+ };
281
369
  /**
282
370
  * Base properties shared by all option definitions.
283
371
  */
@@ -302,5 +390,27 @@ interface PositionalBase {
302
390
  name?: string;
303
391
  required?: boolean;
304
392
  }
393
+ /**
394
+ * Partial transform config for inline transforms. Structurally compatible with
395
+ * TransformsConfig while providing contextual typing for callback parameters.
396
+ *
397
+ * Note: Because TypeScript cannot infer return types from inline callbacks and
398
+ * flow them to handlers, using inline transforms without explicit typing means
399
+ * the handler won't know about properties added by transforms. For full type
400
+ * safety, either:
401
+ *
402
+ * 1. Define transforms separately with explicit return types
403
+ * 2. Add type annotations to handler parameters
404
+ *
405
+ * @typeParam TValuesIn - The input values type (from parsed options)
406
+ * @typeParam TPositionalsIn - The input positionals type (from parsed
407
+ * positionals)
408
+ */
409
+ type TransformsInput<TValuesIn, TPositionalsIn extends readonly unknown[]> = {
410
+ /** Transform parsed positionals tuple */
411
+ positionals?: (positionals: TPositionalsIn) => Promise<readonly unknown[]> | readonly unknown[];
412
+ /** Transform parsed option values */
413
+ values?: (values: TValuesIn) => Promise<unknown> | unknown;
414
+ };
305
415
  export {};
306
416
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAmB;AAE7C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,UAAU,CAAC,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;CACnD;AAED;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D;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,KAAK,eAAe,CAAC,SAAS,EAAE,cAAc,SAAS,SAAS,OAAO,EAAE,IAAI;IAC3E,yCAAyC;IACzC,WAAW,CAAC,EAAE,CACZ,WAAW,EAAE,cAAc,KACxB,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC;IACtD,qCAAqC;IAErC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAC5D,CAAC"}
package/dist/types.d.ts CHANGED
@@ -15,8 +15,21 @@
15
15
  */
16
16
  import type { ThemeInput } from "./theme.js";
17
17
  /**
18
- * Any command config (type-erased for collections). Uses a permissive handler
19
- * type to avoid variance issues.
18
+ * Type-erased command config for use in collections and constraints.
19
+ *
20
+ * WARNING: The handler uses `any` which will leak into inline command handlers.
21
+ * For proper type inference in command handlers, use one of these patterns:
22
+ *
23
+ * 1. Use `bargs.command<typeof globalOptions>()({...})` to define commands
24
+ * 2. Define commands in a separate variable with explicit types
25
+ * 3. Add explicit type annotations to handler parameters
26
+ *
27
+ * @example // Option 1: Use bargs.command() (recommended) const myCmd =
28
+ * bargs.command<typeof globalOpts>()({ handler: ({ values }) => { ... } //
29
+ * values is properly typed });
30
+ *
31
+ * // Option 2: Explicit parameter types handler: ({ values }: BargsResult<...>)
32
+ * => { ... }
20
33
  */
21
34
  export interface AnyCommandConfig {
22
35
  description: string;
@@ -25,6 +38,14 @@ export interface AnyCommandConfig {
25
38
  positionals?: PositionalsSchema;
26
39
  transforms?: TransformsConfig<any, any, any, any>;
27
40
  }
41
+ /**
42
+ * Command config shape used for type constraints/inference.
43
+ *
44
+ * Intentionally omits `handler` so inline command handlers are not
45
+ * context-typed as `(result: any) => …` before `CommandsInput` can apply the
46
+ * computed handler signature.
47
+ */
48
+ export type AnyCommandConfigInput = Omit<AnyCommandConfig, 'handler'>;
28
49
  /**
29
50
  * Array option definition (--flag value --flag value2).
30
51
  */
@@ -42,7 +63,7 @@ export interface ArrayOption extends OptionBase {
42
63
  * @typeParam TCommands - Commands record type (undefined for simple CLIs)
43
64
  * @typeParam TTransforms - Transforms config type (affects handler input types)
44
65
  */
45
- export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TCommands extends Record<string, AnyCommandConfig> | undefined = undefined, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
66
+ export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TCommands extends Record<string, AnyCommandConfigInput> | undefined = undefined, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
46
67
  args?: string[];
47
68
  commands?: TCommands;
48
69
  description?: string;
@@ -52,12 +73,6 @@ export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPo
52
73
  * string to disable.
53
74
  */
54
75
  epilog?: false | string;
55
- /**
56
- * Handler receives the final transformed values and positionals. When
57
- * transforms are defined, types flow through the transform pipeline. Handler
58
- * arrays are no longer supported - use a single handler function.
59
- */
60
- handler?: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions>, TTransforms>, InferTransformedPositionals<InferPositionals<TPositionals>, TTransforms>, undefined>>;
61
76
  name: string;
62
77
  options?: TOptions;
63
78
  positionals?: TPositionals;
@@ -66,23 +81,12 @@ export interface BargsConfig<TOptions extends OptionsSchema = OptionsSchema, TPo
66
81
  * Values transform receives InferOptions<TOptions>, positionals transform
67
82
  * receives InferPositionals<TPositionals>.
68
83
  */
69
- transforms?: [TTransforms] extends [undefined] ? TransformsConfig<any, any, any, any> : TTransforms;
84
+ transforms?: 0 extends 1 & TTransforms ? TransformsConfig<any, any, any, any> : [TTransforms] extends [undefined] ? TransformsInput<InferOptions<TOptions>, InferPositionals<TPositionals>> : TTransforms;
70
85
  version?: string;
71
86
  }
72
- /**
73
- * Bargs config with commands (requires commands, allows defaultHandler).
74
- *
75
- * Commands can be defined in two ways:
76
- *
77
- * 1. Using opt.command() - handler receives local options only (legacy)
78
- * 2. Inline definition - handler can receive both global and local options
79
- *
80
- * Note: Top-level `positionals` is not allowed for command-based CLIs. Each
81
- * command defines its own positionals.
82
- */
83
- export type BargsConfigWithCommands<TOptions extends OptionsSchema = OptionsSchema, TCommands extends Record<string, CommandConfigInput> = Record<string, CommandConfigInput>, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> = Omit<BargsConfig<TOptions, PositionalsSchema, TCommands, TTransforms>, 'handler' | 'positionals'> & {
84
- commands: TCommands;
85
- defaultHandler?: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions>, TTransforms>, readonly [], undefined>> | keyof TCommands;
87
+ export type BargsConfigWithCommands<TOptions extends OptionsSchema = OptionsSchema, TCommands extends Record<string, AnyCommandConfigInput> = Record<string, AnyCommandConfigInput>, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> = Omit<BargsConfig<TOptions, PositionalsSchema, TCommands, TTransforms>, 'commands' | 'positionals'> & {
88
+ commands: CommandsInput<TOptions, TTransforms, TCommands> & TCommands;
89
+ defaultHandler?: CommandNames<TCommands> | Handler<BargsResult<InferTransformedValues<InferOptions<TOptions>, TTransforms>, readonly [], undefined>>;
86
90
  };
87
91
  /**
88
92
  * Runtime options for bargs (separate from parsing config).
@@ -109,30 +113,33 @@ export interface BooleanOption extends OptionBase {
109
113
  /**
110
114
  * Command configuration.
111
115
  *
112
- * The handler receives typed local options plus access to global options (as
113
- * Record<string, unknown>). Global options are available at runtime but require
114
- * type narrowing to access safely.
116
+ * The handler receives typed global options merged with command-specific
117
+ * options, properly transformed. Use `bargs.command<TGlobalOptions,
118
+ * TGlobalTransforms>()` to pass both global options and transforms types for
119
+ * full type inference.
115
120
  *
121
+ * @typeParam TGlobalOptions - Global options schema (from parent config)
122
+ * @typeParam TGlobalTransforms - Global transforms config (from parent config)
116
123
  * @typeParam TOptions - Command-specific options schema
117
124
  * @typeParam TPositionals - Command positionals schema
118
125
  * @typeParam TTransforms - Command-level transforms config
119
126
  */
120
- export interface CommandConfig<TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
127
+ export interface CommandConfig<TGlobalOptions extends OptionsSchema = OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined, TOptions extends OptionsSchema = OptionsSchema, TPositionals extends PositionalsSchema = PositionalsSchema, TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
121
128
  description: string;
122
- handler: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions> & Record<string, unknown>, TTransforms>, InferTransformedPositionals<InferPositionals<TPositionals>, TTransforms>, string>>;
129
+ handler: Handler<BargsResult<InferTransformedValues<InferOptions<TOptions> & InferTransformedValues<InferOptions<TGlobalOptions>, TGlobalTransforms>, TTransforms>, InferTransformedPositionals<InferPositionals<TPositionals>, TTransforms>, string>>;
123
130
  options?: TOptions;
124
131
  positionals?: TPositionals;
125
132
  /** Command-level transforms run after top-level transforms */
126
- transforms?: TTransforms;
133
+ transforms?: 0 extends 1 & TTransforms ? TransformsConfig<any, any, any, any> : [TTransforms] extends [undefined] ? TransformsInput<InferOptions<TOptions> & InferTransformedValues<InferOptions<TGlobalOptions>, TGlobalTransforms>, InferPositionals<TPositionals>> : TTransforms;
127
134
  }
128
135
  /**
129
- * Command config input type for inline command definitions. The handler type is
130
- * intentionally loose here - it accepts any result type, allowing commands
131
- * defined with opt.command() or inline to work.
136
+ * Command config input type for inline command definitions. Uses `any` for
137
+ * handler result to accept any handler signature. See AnyCommandConfig for
138
+ * workarounds to get proper type inference.
132
139
  */
133
140
  export interface CommandConfigInput {
134
141
  description: string;
135
- handler: Handler<any>;
142
+ handler: (result: any) => Promise<void> | void;
136
143
  options?: OptionsSchema;
137
144
  positionals?: PositionalsSchema;
138
145
  transforms?: TransformsConfig<any, any, any, any>;
@@ -169,6 +176,11 @@ export type Handler<TResult> = HandlerFn<TResult>;
169
176
  * Single handler function signature.
170
177
  */
171
178
  export type HandlerFn<TResult> = (result: TResult) => Promise<void> | void;
179
+ /**
180
+ * Compute the handler result type for a single command. Separating this makes
181
+ * the type easier for TypeScript to evaluate.
182
+ */
183
+ export type InferCommandResult<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TCommandOptions extends OptionsSchema | undefined, TCommandPositionals extends PositionalsSchema | undefined, TCommandTransforms extends TransformsConfig<any, any, any, any> | undefined> = BargsResult<InferTransformedValues<InferTransformedValues<InferOptions<TGlobalOptions> & (TCommandOptions extends OptionsSchema ? InferOptions<TCommandOptions> : Record<string, never>), TGlobalTransforms>, TCommandTransforms>, InferTransformedPositionals<TCommandPositionals extends PositionalsSchema ? InferPositionals<TCommandPositionals> : readonly [], TCommandTransforms>, string>;
172
184
  /**
173
185
  * Infer the TypeScript type from an option definition.
174
186
  */
@@ -191,7 +203,38 @@ export type InferPositional<T extends PositionalDef> = T extends NumberPositiona
191
203
  export type InferPositionals<T extends PositionalsSchema> = T extends readonly [
192
204
  infer First,
193
205
  ...infer Rest
194
- ] ? First extends PositionalDef ? Rest extends PositionalsSchema ? readonly [InferPositional<First>, ...InferPositionals<Rest>] : readonly [InferPositional<First>] : readonly [] : T extends readonly [infer Only] ? Only extends PositionalDef ? readonly [InferPositional<Only>] : readonly [] : readonly [];
206
+ ] ? First extends PositionalDef ? Rest extends PositionalsSchema ? readonly [InferPositional<First>, ...InferPositionals<Rest>] : readonly [InferPositional<First>] : readonly [] : T extends readonly [infer Only] ? Only extends PositionalDef ? readonly [InferPositional<Only>] : readonly [] : T extends readonly [] ? readonly [] : readonly InferPositional<T[number]>[];
207
+ /**
208
+ * Compute proper handler types for each command in a commands record.
209
+ *
210
+ * This mapped type enables type inference for inline command definitions by
211
+ * computing the handler signature from each command's options, positionals, and
212
+ * transforms - plus the global options and transforms from the parent config.
213
+ *
214
+ * The handler receives:
215
+ *
216
+ * - Values: global options + command options, transformed by global then command
217
+ * transforms
218
+ * - Positionals: command positionals, transformed by command transforms
219
+ * - Command: the command name (string)
220
+ *
221
+ * Commands defined with `opt.command()` (returning `CommandConfig`) are passed
222
+ * through unchanged to preserve their existing handler types. Only inline
223
+ * command definitions get the computed handler type.
224
+ *
225
+ * @typeParam TGlobalOptions - Top-level options schema
226
+ * @typeParam TGlobalTransforms - Top-level transforms config
227
+ * @typeParam TCommands - Record of command configurations
228
+ */
229
+ export type InferredCommands<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TCommands extends Record<string, AnyCommandConfigInput>> = {
230
+ [K in keyof TCommands]: TCommands[K] extends CommandConfig<infer _TGlobalOpts, infer _TGlobalTrans, infer _TOpts, infer _TPos, infer _TTrans> ? TCommands[K] : {
231
+ description: TCommands[K]['description'];
232
+ handler: Handler<InferCommandResult<TGlobalOptions, TGlobalTransforms, NonNullable<TCommands[K]['options']> extends OptionsSchema ? NonNullable<TCommands[K]['options']> : undefined, NonNullable<TCommands[K]['positionals']> extends PositionalsSchema ? NonNullable<TCommands[K]['positionals']> : undefined, NonNullable<TCommands[K]['transforms']> extends TransformsConfig<any, any, any, any> ? NonNullable<TCommands[K]['transforms']> : undefined>>;
233
+ options?: TCommands[K]['options'];
234
+ positionals?: TCommands[K]['positionals'];
235
+ transforms?: TCommands[K]['transforms'];
236
+ };
237
+ };
195
238
  /**
196
239
  * Infer the output positionals type from a transforms config. If no positionals
197
240
  * transform, output equals input.
@@ -278,6 +321,51 @@ export interface VariadicPositional extends PositionalBase {
278
321
  items: 'number' | 'string';
279
322
  type: 'variadic';
280
323
  }
324
+ /**
325
+ * Command input type that computes the proper handler signature from the
326
+ * command's own options/positionals schemas. This provides contextual typing
327
+ * for inline command handlers.
328
+ *
329
+ * @typeParam TGlobalOptions - Global options schema from parent config
330
+ * @typeParam TGlobalTransforms - Global transforms from parent config
331
+ * @typeParam TOptions - Command's own options schema
332
+ * @typeParam TPositionals - Command's own positionals schema
333
+ * @typeParam TTransforms - Command's own transforms
334
+ */
335
+ interface CommandInput<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TOptions extends OptionsSchema = Record<string, never>, TPositionals extends PositionalsSchema = [], TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined> {
336
+ description: string;
337
+ handler: Handler<InferCommandResult<TGlobalOptions, TGlobalTransforms, TOptions, TPositionals, TTransforms>>;
338
+ options?: TOptions;
339
+ positionals?: TPositionals;
340
+ transforms?: TTransforms;
341
+ }
342
+ /**
343
+ * Helper type to extract command names from a commands record for
344
+ * defaultHandler typing.
345
+ */
346
+ type CommandNames<T> = T extends Record<infer K, AnyCommandConfigInput> ? K : never;
347
+ /**
348
+ * Bargs config with commands (requires commands, allows defaultHandler).
349
+ *
350
+ * Commands can be defined in two ways:
351
+ *
352
+ * 1. Using opt.command() - handler receives local options only (legacy)
353
+ * 2. Inline definition - handler receives both global and local options
354
+ *
355
+ * Note: Top-level `positionals` is not allowed for command-based CLIs. Each
356
+ * command defines its own positionals.
357
+ *
358
+ * The `commands` property uses `InferredCommands` to compute proper handler
359
+ * types for inline command definitions. Each command's handler type includes
360
+ * global options merged with command options, transformed appropriately.
361
+ */
362
+ /**
363
+ * Mapped type that computes the expected command input type for each command in
364
+ * the record. This provides contextual typing for inline command handlers.
365
+ */
366
+ type CommandsInput<TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined, TCommands extends Record<string, AnyCommandConfigInput>> = {
367
+ [K in keyof TCommands]: TCommands[K] extends CommandConfig<infer _TGlobalOpts, infer _TGlobalTrans, infer _TOpts, infer _TPos, infer _TTrans> ? TCommands[K] : CommandInput<TGlobalOptions, TGlobalTransforms, NonNullable<TCommands[K]['options']> extends OptionsSchema ? NonNullable<TCommands[K]['options']> : Record<string, never>, NonNullable<TCommands[K]['positionals']> extends PositionalsSchema ? NonNullable<TCommands[K]['positionals']> : [], NonNullable<TCommands[K]['transforms']> extends TransformsConfig<any, any, any, any> ? NonNullable<TCommands[K]['transforms']> : undefined>;
368
+ };
281
369
  /**
282
370
  * Base properties shared by all option definitions.
283
371
  */
@@ -302,5 +390,27 @@ interface PositionalBase {
302
390
  name?: string;
303
391
  required?: boolean;
304
392
  }
393
+ /**
394
+ * Partial transform config for inline transforms. Structurally compatible with
395
+ * TransformsConfig while providing contextual typing for callback parameters.
396
+ *
397
+ * Note: Because TypeScript cannot infer return types from inline callbacks and
398
+ * flow them to handlers, using inline transforms without explicit typing means
399
+ * the handler won't know about properties added by transforms. For full type
400
+ * safety, either:
401
+ *
402
+ * 1. Define transforms separately with explicit return types
403
+ * 2. Add type annotations to handler parameters
404
+ *
405
+ * @typeParam TValuesIn - The input values type (from parsed options)
406
+ * @typeParam TPositionalsIn - The input positionals type (from parsed
407
+ * positionals)
408
+ */
409
+ type TransformsInput<TValuesIn, TPositionalsIn extends readonly unknown[]> = {
410
+ /** Transform parsed positionals tuple */
411
+ positionals?: (positionals: TPositionalsIn) => Promise<readonly unknown[]> | readonly unknown[];
412
+ /** Transform parsed option values */
413
+ values?: (values: TValuesIn) => Promise<unknown> | unknown;
414
+ };
305
415
  export {};
306
416
  //# sourceMappingURL=types.d.ts.map