@boneskull/bargs 2.0.0 → 3.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.
Files changed (58) hide show
  1. package/README.md +305 -299
  2. package/dist/bargs.cjs +465 -135
  3. package/dist/bargs.cjs.map +1 -1
  4. package/dist/bargs.d.cts +35 -17
  5. package/dist/bargs.d.cts.map +1 -1
  6. package/dist/bargs.d.ts +35 -17
  7. package/dist/bargs.d.ts.map +1 -1
  8. package/dist/bargs.js +463 -135
  9. package/dist/bargs.js.map +1 -1
  10. package/dist/help.cjs +1 -2
  11. package/dist/help.cjs.map +1 -1
  12. package/dist/help.d.cts +20 -3
  13. package/dist/help.d.cts.map +1 -1
  14. package/dist/help.d.ts +20 -3
  15. package/dist/help.d.ts.map +1 -1
  16. package/dist/help.js +1 -2
  17. package/dist/help.js.map +1 -1
  18. package/dist/index.cjs +27 -31
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +15 -79
  21. package/dist/index.d.cts.map +1 -1
  22. package/dist/index.d.ts +15 -79
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +20 -30
  25. package/dist/index.js.map +1 -1
  26. package/dist/opt.cjs +148 -122
  27. package/dist/opt.cjs.map +1 -1
  28. package/dist/opt.d.cts +87 -113
  29. package/dist/opt.d.cts.map +1 -1
  30. package/dist/opt.d.ts +87 -113
  31. package/dist/opt.d.ts.map +1 -1
  32. package/dist/opt.js +147 -121
  33. package/dist/opt.js.map +1 -1
  34. package/dist/parser.cjs +3 -230
  35. package/dist/parser.cjs.map +1 -1
  36. package/dist/parser.d.cts +3 -51
  37. package/dist/parser.d.cts.map +1 -1
  38. package/dist/parser.d.ts +3 -51
  39. package/dist/parser.d.ts.map +1 -1
  40. package/dist/parser.js +2 -223
  41. package/dist/parser.js.map +1 -1
  42. package/dist/types.cjs +1 -3
  43. package/dist/types.cjs.map +1 -1
  44. package/dist/types.d.cts +111 -233
  45. package/dist/types.d.cts.map +1 -1
  46. package/dist/types.d.ts +111 -233
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/types.js +1 -3
  49. package/dist/types.js.map +1 -1
  50. package/package.json +2 -2
  51. package/dist/validate.cjs +0 -463
  52. package/dist/validate.cjs.map +0 -1
  53. package/dist/validate.d.cts +0 -28
  54. package/dist/validate.d.cts.map +0 -1
  55. package/dist/validate.d.ts +0 -28
  56. package/dist/validate.d.ts.map +0 -1
  57. package/dist/validate.js +0 -459
  58. package/dist/validate.js.map +0 -1
package/dist/opt.d.cts CHANGED
@@ -1,39 +1,34 @@
1
1
  /**
2
- * Builder functions for defining CLI options, positionals, and commands.
2
+ * Builder functions for defining CLI options and positionals.
3
3
  *
4
4
  * Provides ergonomic helpers with full TypeScript type inference for
5
5
  * constructing option schemas (`opt.string()`, `opt.boolean()`, `opt.enum()`,
6
- * etc.), positional schemas (`opt.stringPos()`, `opt.numberPos()`,
7
- * `opt.variadic()`), and command definitions (`opt.command()`). Includes
8
- * composition utilities for merging schemas (`opt.options()`,
9
- * `opt.positionals()`).
6
+ * etc.) and positional schemas (`opt.stringPos()`, `opt.numberPos()`,
7
+ * `opt.variadic()`).
10
8
  *
11
9
  * @packageDocumentation
12
10
  */
13
- import type { ArrayOption, BooleanOption, CommandConfig, CountOption, EnumOption, EnumPositional, NumberOption, NumberPositional, OptionsSchema, PositionalDef, PositionalsSchema, StringOption, StringPositional, TransformsConfig, VariadicPositional } from "./types.cjs";
11
+ import type { ArrayOption, BooleanOption, CountOption, EnumOption, EnumPositional, InferOptions, InferPositionals, NumberOption, NumberPositional, OptionsSchema, Parser, PositionalDef, StringOption, StringPositional, VariadicPositional } from "./types.cjs";
14
12
  /**
15
- * Command builder interface that supports both direct config and curried global
16
- * options patterns.
13
+ * A Parser that can also be called as a function to merge with another parser.
14
+ * This allows `opt.options()` to work both as:
15
+ *
16
+ * - First arg in pipe: used directly as a Parser
17
+ * - Later arg in pipe: called as function to merge with incoming Parser
17
18
  */
18
- export interface CommandBuilder {
19
- <const TOptions extends OptionsSchema = OptionsSchema, const TPositionals extends PositionalsSchema = PositionalsSchema, const TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined>(config: CommandConfig<Record<string, never>, undefined, TOptions, TPositionals, TTransforms>): CommandConfig<Record<string, never>, undefined, TOptions, TPositionals, TTransforms>;
20
- <TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined>(): <const TOptions extends OptionsSchema = OptionsSchema, const TPositionals extends PositionalsSchema = PositionalsSchema, const TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined>(config: CommandConfig<TGlobalOptions, TGlobalTransforms, TOptions, TPositionals, TTransforms>) => CommandConfig<TGlobalOptions, TGlobalTransforms, TOptions, TPositionals, TTransforms>;
21
- }
19
+ type CallableOptionsParser<V> = (<V2, P2 extends readonly unknown[]>(parser: Parser<V2, P2>) => Parser<V & V2, P2>) & Parser<V, readonly []>;
22
20
  /**
23
21
  * Namespaced option builders.
24
22
  *
25
- * Provides ergonomic helpers for defining CLI options, positionals, and
26
- * commands with full TypeScript type inference.
27
- *
28
23
  * @example
29
24
  *
30
25
  * ```typescript
31
26
  * import { opt } from 'bargs';
32
27
  *
33
- * const options = opt.options({
28
+ * const parser = opt.options({
34
29
  * verbose: opt.boolean({ aliases: ['v'] }),
35
30
  * name: opt.string({ default: 'world' }),
36
- * level: opt.enum(['low', 'medium', 'high'] as const),
31
+ * level: opt.enum(['low', 'medium', 'high']),
37
32
  * });
38
33
  * ```
39
34
  */
@@ -43,143 +38,122 @@ export declare const opt: {
43
38
  */
44
39
  array: (items: "number" | "string", props?: Omit<ArrayOption, "items" | "type">) => ArrayOption;
45
40
  /**
46
- * Define a boolean option. Props type is preserved to enable default
47
- * inference.
41
+ * Define a boolean option.
48
42
  */
49
43
  boolean: <P extends Omit<BooleanOption, "type"> = Omit<BooleanOption, "type">>(props?: P) => BooleanOption & P;
50
- /**
51
- * Define a command with proper type inference.
52
- *
53
- * Three usage patterns:
54
- *
55
- * 1. Simple usage (no global options): `bargs.command({ ... })`
56
- * 2. With global options: `bargs.command<typeof globalOptions>()({ ... })`
57
- * 3. With global options AND transforms: `bargs.command<typeof globalOptions,
58
- * typeof globalTransforms>()({ ... })`
59
- *
60
- * @example
61
- *
62
- * ```typescript
63
- * // Simple usage - no global options typed
64
- * const simpleCmd = bargs.command({
65
- * description: 'Simple command',
66
- * handler: ({ values }) => { ... },
67
- * });
68
- *
69
- * // With global options typed
70
- * const globalOptions = {
71
- * verbose: bargs.boolean({ aliases: ['v'] }),
72
- * } as const;
73
- *
74
- * const greetCmd = bargs.command<typeof globalOptions>()({
75
- * description: 'Greet someone',
76
- * options: { name: bargs.string({ default: 'world' }) },
77
- * handler: ({ values }) => {
78
- * // values.verbose is properly typed as boolean | undefined
79
- * console.log(`Hello, ${values.name}!`);
80
- * },
81
- * });
82
- *
83
- * // With global options AND global transforms typed
84
- * const globalTransforms = {
85
- * values: (v) => ({ ...v, timestamp: Date.now() }),
86
- * } as const;
87
- *
88
- * const timedCmd = bargs.command<typeof globalOptions, typeof globalTransforms>()({
89
- * description: 'Time-aware command',
90
- * handler: ({ values }) => {
91
- * // values.timestamp is properly typed from global transforms
92
- * console.log(`Ran at ${values.timestamp}`);
93
- * },
94
- * });
95
- * ```
96
- */
97
- command: CommandBuilder;
98
44
  /**
99
45
  * Define a count option (--verbose --verbose = 2).
100
46
  */
101
47
  count: (props?: Omit<CountOption, "type">) => CountOption;
102
48
  /**
103
- * Define an enum option with string choices. The choices array is inferred as
104
- * a tuple of literal types automatically. Props type is preserved to enable
105
- * default inference.
49
+ * Define an enum option with string choices.
106
50
  */
107
51
  enum: <const T extends readonly string[], P extends Omit<EnumOption<T[number]>, "choices" | "type"> = Omit<EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => EnumOption<T[number]> & P;
108
52
  /**
109
- * Define an enum positional argument with string choices. The choices array
110
- * is inferred as a tuple of literal types automatically.
53
+ * Define an enum positional argument with string choices.
111
54
  */
112
55
  enumPos: <const T extends readonly string[], P extends Omit<EnumPositional<T[number]>, "choices" | "type"> = Omit<EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => EnumPositional<T[number]> & P;
113
56
  /**
114
- * Define a number option. Props type is preserved to enable default
115
- * inference.
57
+ * Define a number option.
116
58
  */
117
59
  number: <P extends Omit<NumberOption, "type"> = Omit<NumberOption, "type">>(props?: P) => NumberOption & P;
118
60
  /**
119
- * Define a number positional argument. Props type is preserved to enable
120
- * required inference.
61
+ * Define a number positional argument.
121
62
  */
122
63
  numberPos: <P extends Omit<NumberPositional, "type"> = Omit<NumberPositional, "type">>(props?: P) => NumberPositional & P;
123
64
  /**
124
- * Compose multiple option schemas into one. Later schemas override earlier
125
- * ones for duplicate option names. Validates that no alias conflicts exist.
65
+ * Create a Parser from an options schema.
126
66
  *
127
67
  * @example
128
68
  *
129
69
  * ```typescript
130
- * // Single schema (identity, enables reuse)
131
- * const loggingOpts = opt.options({
70
+ * const parser = opt.options({
132
71
  * verbose: opt.boolean({ aliases: ['v'] }),
133
- * quiet: opt.boolean({ aliases: ['q'] }),
134
- * });
135
- *
136
- * // Merge multiple schemas
137
- * const allOpts = opt.options(loggingOpts, ioOpts, {
138
- * format: opt.enum(['json', 'yaml'] as const),
72
+ * name: opt.string({ default: 'world' }),
139
73
  * });
74
+ * // Type: Parser<{ verbose: boolean | undefined, name: string }, []>
140
75
  * ```
141
- *
142
- * @throws BargsError if multiple options use the same alias
143
- */
144
- options: {
145
- <A extends OptionsSchema>(a: A): A;
146
- <A extends OptionsSchema, B extends OptionsSchema>(a: A, b: B): A & B;
147
- <A extends OptionsSchema, B extends OptionsSchema, C extends OptionsSchema>(a: A, b: B, c: C): A & B & C;
148
- <A extends OptionsSchema, B extends OptionsSchema, C extends OptionsSchema, D extends OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
149
- (...schemas: OptionsSchema[]): OptionsSchema;
150
- };
76
+ */
77
+ options: <T extends OptionsSchema>(schema: T) => CallableOptionsParser<InferOptions<T>>;
78
+ /**
79
+ * Define a string option.
80
+ */
81
+ string: <P extends Omit<StringOption, "type"> = Omit<StringOption, "type">>(props?: P) => P & StringOption;
82
+ /**
83
+ * Define a string positional argument.
84
+ */
85
+ stringPos: <P extends Omit<StringPositional, "type"> = Omit<StringPositional, "type">>(props?: P) => P & StringPositional;
86
+ /**
87
+ * Define a variadic positional (rest args).
88
+ */
89
+ variadic: (items: "number" | "string", props?: Omit<VariadicPositional, "items" | "type">) => VariadicPositional;
90
+ };
91
+ /**
92
+ * A Parser that can also be called as a function to merge with another parser.
93
+ * This allows `pos.positionals()` to work both as:
94
+ *
95
+ * - First arg in pipe: used directly as a Parser
96
+ * - Later arg in pipe: called as function to merge with incoming Parser
97
+ *
98
+ * For positionals, we DON'T intersect values - we just pass through V2.
99
+ */
100
+ type CallablePositionalsParser<P extends readonly unknown[]> = (<V2, P2 extends readonly unknown[]>(parser: Parser<V2, P2>) => Parser<V2, readonly [...P2, ...P]>) & Parser<EmptyObject, P>;
101
+ /**
102
+ * Empty object type that works better with intersections than Record<string,
103
+ * never>. {} & T = T, but Record<string, never> & T can be problematic.
104
+ */
105
+ type EmptyObject = {};
106
+ /**
107
+ * Namespaced positional builders.
108
+ *
109
+ * @example
110
+ *
111
+ * ```typescript
112
+ * import { pos } from 'bargs';
113
+ *
114
+ * const parser = pos.positionals(
115
+ * pos.string({ name: 'input', required: true }),
116
+ * pos.string({ name: 'output' }),
117
+ * );
118
+ * ```
119
+ */
120
+ export declare const pos: {
121
+ /**
122
+ * Define an enum positional argument with string choices.
123
+ */
124
+ enum: <const T extends readonly string[], P extends Omit<EnumPositional<T[number]>, "choices" | "type"> = Omit<EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => EnumPositional<T[number]> & P;
125
+ /**
126
+ * Define a number positional argument.
127
+ */
128
+ number: <P extends Omit<NumberPositional, "type"> = Omit<NumberPositional, "type">>(props?: P) => NumberPositional & P;
151
129
  /**
152
- * Create a positionals schema with proper tuple type inference.
130
+ * Create a Parser from positional definitions.
153
131
  *
154
132
  * @example
155
133
  *
156
134
  * ```typescript
157
- * const positionals = opt.positionals(
158
- * opt.stringPos({ description: 'Input file', required: true }),
159
- * opt.stringPos({ description: 'Output file' }),
135
+ * const parser = pos.positionals(
136
+ * pos.string({ name: 'input', required: true }),
137
+ * pos.string({ name: 'output' }),
160
138
  * );
139
+ * // Type: Parser<{}, readonly [string, string | undefined]>
161
140
  * ```
162
141
  */
163
142
  positionals: {
164
- <A extends PositionalDef>(a: A): [A];
165
- <A extends PositionalDef, B extends PositionalDef>(a: A, b: B): [A, B];
166
- <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef>(a: A, b: B, c: C): [A, B, C];
167
- <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef, D extends PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
168
- (...positionals: PositionalDef[]): PositionalsSchema;
143
+ <A extends PositionalDef>(a: A): CallablePositionalsParser<readonly [InferPositionals<readonly [A]>[0]]>;
144
+ <A extends PositionalDef, B extends PositionalDef>(a: A, b: B): CallablePositionalsParser<InferPositionals<readonly [A, B]>>;
145
+ <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef>(a: A, b: B, c: C): CallablePositionalsParser<InferPositionals<readonly [A, B, C]>>;
146
+ <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef, D extends PositionalDef>(a: A, b: B, c: C, d: D): CallablePositionalsParser<InferPositionals<readonly [A, B, C, D]>>;
147
+ (...positionals: PositionalDef[]): CallablePositionalsParser<readonly unknown[]>;
169
148
  };
170
149
  /**
171
- * Define a string option. Props type is preserved to enable default
172
- * inference.
150
+ * Define a string positional argument.
173
151
  */
174
- string: <P extends Omit<StringOption, "type"> = Omit<StringOption, "type">>(props?: P) => P & StringOption;
175
- /**
176
- * Define a string positional argument. Props type is preserved to enable
177
- * required inference.
178
- */
179
- stringPos: <P extends Omit<StringPositional, "type"> = Omit<StringPositional, "type">>(props?: P) => P & StringPositional;
152
+ string: <P extends Omit<StringPositional, "type"> = Omit<StringPositional, "type">>(props?: P) => P & StringPositional;
180
153
  /**
181
154
  * Define a variadic positional (rest args).
182
155
  */
183
156
  variadic: (items: "number" | "string", props?: Omit<VariadicPositional, "items" | "type">) => VariadicPositional;
184
157
  };
158
+ export {};
185
159
  //# sourceMappingURL=opt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"opt.d.ts","sourceRoot":"","sources":["../src/opt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,oBAAmB;AAIpB;;;GAGG;AACH,MAAM,WAAW,cAAc;IAE7B,CACE,KAAK,CAAC,QAAQ,SAAS,aAAa,GAAG,aAAa,EACpD,KAAK,CAAC,YAAY,SAAS,iBAAiB,GAAG,iBAAiB,EAChE,KAAK,CAAC,WAAW,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,GACxE,SAAS,EAEX,MAAM,EAAE,aAAa,CACnB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,WAAW,CACZ,GACA,aAAa,CACd,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,WAAW,CACZ,CAAC;IAGF,CACE,cAAc,SAAS,aAAa,EACpC,iBAAiB,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,GACxE,SAAS,KACR,CACH,KAAK,CAAC,QAAQ,SAAS,aAAa,GAAG,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,GAAG,QAAQ,UACnB,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,MAAM,CAAC,KAChD,kBAAkB;CAKtB,CAAC"}
package/dist/opt.d.ts CHANGED
@@ -1,39 +1,34 @@
1
1
  /**
2
- * Builder functions for defining CLI options, positionals, and commands.
2
+ * Builder functions for defining CLI options and positionals.
3
3
  *
4
4
  * Provides ergonomic helpers with full TypeScript type inference for
5
5
  * constructing option schemas (`opt.string()`, `opt.boolean()`, `opt.enum()`,
6
- * etc.), positional schemas (`opt.stringPos()`, `opt.numberPos()`,
7
- * `opt.variadic()`), and command definitions (`opt.command()`). Includes
8
- * composition utilities for merging schemas (`opt.options()`,
9
- * `opt.positionals()`).
6
+ * etc.) and positional schemas (`opt.stringPos()`, `opt.numberPos()`,
7
+ * `opt.variadic()`).
10
8
  *
11
9
  * @packageDocumentation
12
10
  */
13
- import type { ArrayOption, BooleanOption, CommandConfig, CountOption, EnumOption, EnumPositional, NumberOption, NumberPositional, OptionsSchema, PositionalDef, PositionalsSchema, StringOption, StringPositional, TransformsConfig, VariadicPositional } from "./types.js";
11
+ import type { ArrayOption, BooleanOption, CountOption, EnumOption, EnumPositional, InferOptions, InferPositionals, NumberOption, NumberPositional, OptionsSchema, Parser, PositionalDef, StringOption, StringPositional, VariadicPositional } from "./types.js";
14
12
  /**
15
- * Command builder interface that supports both direct config and curried global
16
- * options patterns.
13
+ * A Parser that can also be called as a function to merge with another parser.
14
+ * This allows `opt.options()` to work both as:
15
+ *
16
+ * - First arg in pipe: used directly as a Parser
17
+ * - Later arg in pipe: called as function to merge with incoming Parser
17
18
  */
18
- export interface CommandBuilder {
19
- <const TOptions extends OptionsSchema = OptionsSchema, const TPositionals extends PositionalsSchema = PositionalsSchema, const TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined>(config: CommandConfig<Record<string, never>, undefined, TOptions, TPositionals, TTransforms>): CommandConfig<Record<string, never>, undefined, TOptions, TPositionals, TTransforms>;
20
- <TGlobalOptions extends OptionsSchema, TGlobalTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined>(): <const TOptions extends OptionsSchema = OptionsSchema, const TPositionals extends PositionalsSchema = PositionalsSchema, const TTransforms extends TransformsConfig<any, any, any, any> | undefined = undefined>(config: CommandConfig<TGlobalOptions, TGlobalTransforms, TOptions, TPositionals, TTransforms>) => CommandConfig<TGlobalOptions, TGlobalTransforms, TOptions, TPositionals, TTransforms>;
21
- }
19
+ type CallableOptionsParser<V> = (<V2, P2 extends readonly unknown[]>(parser: Parser<V2, P2>) => Parser<V & V2, P2>) & Parser<V, readonly []>;
22
20
  /**
23
21
  * Namespaced option builders.
24
22
  *
25
- * Provides ergonomic helpers for defining CLI options, positionals, and
26
- * commands with full TypeScript type inference.
27
- *
28
23
  * @example
29
24
  *
30
25
  * ```typescript
31
26
  * import { opt } from 'bargs';
32
27
  *
33
- * const options = opt.options({
28
+ * const parser = opt.options({
34
29
  * verbose: opt.boolean({ aliases: ['v'] }),
35
30
  * name: opt.string({ default: 'world' }),
36
- * level: opt.enum(['low', 'medium', 'high'] as const),
31
+ * level: opt.enum(['low', 'medium', 'high']),
37
32
  * });
38
33
  * ```
39
34
  */
@@ -43,143 +38,122 @@ export declare const opt: {
43
38
  */
44
39
  array: (items: "number" | "string", props?: Omit<ArrayOption, "items" | "type">) => ArrayOption;
45
40
  /**
46
- * Define a boolean option. Props type is preserved to enable default
47
- * inference.
41
+ * Define a boolean option.
48
42
  */
49
43
  boolean: <P extends Omit<BooleanOption, "type"> = Omit<BooleanOption, "type">>(props?: P) => BooleanOption & P;
50
- /**
51
- * Define a command with proper type inference.
52
- *
53
- * Three usage patterns:
54
- *
55
- * 1. Simple usage (no global options): `bargs.command({ ... })`
56
- * 2. With global options: `bargs.command<typeof globalOptions>()({ ... })`
57
- * 3. With global options AND transforms: `bargs.command<typeof globalOptions,
58
- * typeof globalTransforms>()({ ... })`
59
- *
60
- * @example
61
- *
62
- * ```typescript
63
- * // Simple usage - no global options typed
64
- * const simpleCmd = bargs.command({
65
- * description: 'Simple command',
66
- * handler: ({ values }) => { ... },
67
- * });
68
- *
69
- * // With global options typed
70
- * const globalOptions = {
71
- * verbose: bargs.boolean({ aliases: ['v'] }),
72
- * } as const;
73
- *
74
- * const greetCmd = bargs.command<typeof globalOptions>()({
75
- * description: 'Greet someone',
76
- * options: { name: bargs.string({ default: 'world' }) },
77
- * handler: ({ values }) => {
78
- * // values.verbose is properly typed as boolean | undefined
79
- * console.log(`Hello, ${values.name}!`);
80
- * },
81
- * });
82
- *
83
- * // With global options AND global transforms typed
84
- * const globalTransforms = {
85
- * values: (v) => ({ ...v, timestamp: Date.now() }),
86
- * } as const;
87
- *
88
- * const timedCmd = bargs.command<typeof globalOptions, typeof globalTransforms>()({
89
- * description: 'Time-aware command',
90
- * handler: ({ values }) => {
91
- * // values.timestamp is properly typed from global transforms
92
- * console.log(`Ran at ${values.timestamp}`);
93
- * },
94
- * });
95
- * ```
96
- */
97
- command: CommandBuilder;
98
44
  /**
99
45
  * Define a count option (--verbose --verbose = 2).
100
46
  */
101
47
  count: (props?: Omit<CountOption, "type">) => CountOption;
102
48
  /**
103
- * Define an enum option with string choices. The choices array is inferred as
104
- * a tuple of literal types automatically. Props type is preserved to enable
105
- * default inference.
49
+ * Define an enum option with string choices.
106
50
  */
107
51
  enum: <const T extends readonly string[], P extends Omit<EnumOption<T[number]>, "choices" | "type"> = Omit<EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => EnumOption<T[number]> & P;
108
52
  /**
109
- * Define an enum positional argument with string choices. The choices array
110
- * is inferred as a tuple of literal types automatically.
53
+ * Define an enum positional argument with string choices.
111
54
  */
112
55
  enumPos: <const T extends readonly string[], P extends Omit<EnumPositional<T[number]>, "choices" | "type"> = Omit<EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => EnumPositional<T[number]> & P;
113
56
  /**
114
- * Define a number option. Props type is preserved to enable default
115
- * inference.
57
+ * Define a number option.
116
58
  */
117
59
  number: <P extends Omit<NumberOption, "type"> = Omit<NumberOption, "type">>(props?: P) => NumberOption & P;
118
60
  /**
119
- * Define a number positional argument. Props type is preserved to enable
120
- * required inference.
61
+ * Define a number positional argument.
121
62
  */
122
63
  numberPos: <P extends Omit<NumberPositional, "type"> = Omit<NumberPositional, "type">>(props?: P) => NumberPositional & P;
123
64
  /**
124
- * Compose multiple option schemas into one. Later schemas override earlier
125
- * ones for duplicate option names. Validates that no alias conflicts exist.
65
+ * Create a Parser from an options schema.
126
66
  *
127
67
  * @example
128
68
  *
129
69
  * ```typescript
130
- * // Single schema (identity, enables reuse)
131
- * const loggingOpts = opt.options({
70
+ * const parser = opt.options({
132
71
  * verbose: opt.boolean({ aliases: ['v'] }),
133
- * quiet: opt.boolean({ aliases: ['q'] }),
134
- * });
135
- *
136
- * // Merge multiple schemas
137
- * const allOpts = opt.options(loggingOpts, ioOpts, {
138
- * format: opt.enum(['json', 'yaml'] as const),
72
+ * name: opt.string({ default: 'world' }),
139
73
  * });
74
+ * // Type: Parser<{ verbose: boolean | undefined, name: string }, []>
140
75
  * ```
141
- *
142
- * @throws BargsError if multiple options use the same alias
143
- */
144
- options: {
145
- <A extends OptionsSchema>(a: A): A;
146
- <A extends OptionsSchema, B extends OptionsSchema>(a: A, b: B): A & B;
147
- <A extends OptionsSchema, B extends OptionsSchema, C extends OptionsSchema>(a: A, b: B, c: C): A & B & C;
148
- <A extends OptionsSchema, B extends OptionsSchema, C extends OptionsSchema, D extends OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
149
- (...schemas: OptionsSchema[]): OptionsSchema;
150
- };
76
+ */
77
+ options: <T extends OptionsSchema>(schema: T) => CallableOptionsParser<InferOptions<T>>;
78
+ /**
79
+ * Define a string option.
80
+ */
81
+ string: <P extends Omit<StringOption, "type"> = Omit<StringOption, "type">>(props?: P) => P & StringOption;
82
+ /**
83
+ * Define a string positional argument.
84
+ */
85
+ stringPos: <P extends Omit<StringPositional, "type"> = Omit<StringPositional, "type">>(props?: P) => P & StringPositional;
86
+ /**
87
+ * Define a variadic positional (rest args).
88
+ */
89
+ variadic: (items: "number" | "string", props?: Omit<VariadicPositional, "items" | "type">) => VariadicPositional;
90
+ };
91
+ /**
92
+ * A Parser that can also be called as a function to merge with another parser.
93
+ * This allows `pos.positionals()` to work both as:
94
+ *
95
+ * - First arg in pipe: used directly as a Parser
96
+ * - Later arg in pipe: called as function to merge with incoming Parser
97
+ *
98
+ * For positionals, we DON'T intersect values - we just pass through V2.
99
+ */
100
+ type CallablePositionalsParser<P extends readonly unknown[]> = (<V2, P2 extends readonly unknown[]>(parser: Parser<V2, P2>) => Parser<V2, readonly [...P2, ...P]>) & Parser<EmptyObject, P>;
101
+ /**
102
+ * Empty object type that works better with intersections than Record<string,
103
+ * never>. {} & T = T, but Record<string, never> & T can be problematic.
104
+ */
105
+ type EmptyObject = {};
106
+ /**
107
+ * Namespaced positional builders.
108
+ *
109
+ * @example
110
+ *
111
+ * ```typescript
112
+ * import { pos } from 'bargs';
113
+ *
114
+ * const parser = pos.positionals(
115
+ * pos.string({ name: 'input', required: true }),
116
+ * pos.string({ name: 'output' }),
117
+ * );
118
+ * ```
119
+ */
120
+ export declare const pos: {
121
+ /**
122
+ * Define an enum positional argument with string choices.
123
+ */
124
+ enum: <const T extends readonly string[], P extends Omit<EnumPositional<T[number]>, "choices" | "type"> = Omit<EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => EnumPositional<T[number]> & P;
125
+ /**
126
+ * Define a number positional argument.
127
+ */
128
+ number: <P extends Omit<NumberPositional, "type"> = Omit<NumberPositional, "type">>(props?: P) => NumberPositional & P;
151
129
  /**
152
- * Create a positionals schema with proper tuple type inference.
130
+ * Create a Parser from positional definitions.
153
131
  *
154
132
  * @example
155
133
  *
156
134
  * ```typescript
157
- * const positionals = opt.positionals(
158
- * opt.stringPos({ description: 'Input file', required: true }),
159
- * opt.stringPos({ description: 'Output file' }),
135
+ * const parser = pos.positionals(
136
+ * pos.string({ name: 'input', required: true }),
137
+ * pos.string({ name: 'output' }),
160
138
  * );
139
+ * // Type: Parser<{}, readonly [string, string | undefined]>
161
140
  * ```
162
141
  */
163
142
  positionals: {
164
- <A extends PositionalDef>(a: A): [A];
165
- <A extends PositionalDef, B extends PositionalDef>(a: A, b: B): [A, B];
166
- <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef>(a: A, b: B, c: C): [A, B, C];
167
- <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef, D extends PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
168
- (...positionals: PositionalDef[]): PositionalsSchema;
143
+ <A extends PositionalDef>(a: A): CallablePositionalsParser<readonly [InferPositionals<readonly [A]>[0]]>;
144
+ <A extends PositionalDef, B extends PositionalDef>(a: A, b: B): CallablePositionalsParser<InferPositionals<readonly [A, B]>>;
145
+ <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef>(a: A, b: B, c: C): CallablePositionalsParser<InferPositionals<readonly [A, B, C]>>;
146
+ <A extends PositionalDef, B extends PositionalDef, C extends PositionalDef, D extends PositionalDef>(a: A, b: B, c: C, d: D): CallablePositionalsParser<InferPositionals<readonly [A, B, C, D]>>;
147
+ (...positionals: PositionalDef[]): CallablePositionalsParser<readonly unknown[]>;
169
148
  };
170
149
  /**
171
- * Define a string option. Props type is preserved to enable default
172
- * inference.
150
+ * Define a string positional argument.
173
151
  */
174
- string: <P extends Omit<StringOption, "type"> = Omit<StringOption, "type">>(props?: P) => P & StringOption;
175
- /**
176
- * Define a string positional argument. Props type is preserved to enable
177
- * required inference.
178
- */
179
- stringPos: <P extends Omit<StringPositional, "type"> = Omit<StringPositional, "type">>(props?: P) => P & StringPositional;
152
+ string: <P extends Omit<StringPositional, "type"> = Omit<StringPositional, "type">>(props?: P) => P & StringPositional;
180
153
  /**
181
154
  * Define a variadic positional (rest args).
182
155
  */
183
156
  variadic: (items: "number" | "string", props?: Omit<VariadicPositional, "items" | "type">) => VariadicPositional;
184
157
  };
158
+ export {};
185
159
  //# sourceMappingURL=op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