@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/index.d.ts CHANGED
@@ -1,97 +1,33 @@
1
1
  /**
2
2
  * Main entry point for the bargs CLI argument parser.
3
3
  *
4
- * This module exports the primary `bargs` and `bargsAsync` functions with
5
- * attached option builder methods (e.g., `bargs.string()`, `bargs.boolean()`),
6
- * allowing both function-call and builder-namespace usage patterns. It also
7
- * re-exports all public types, error classes, help generators, theme utilities,
8
- * and OSC hyperlink functions.
4
+ * Provides a combinator-style API for building type-safe CLIs.
9
5
  *
10
6
  * @example
11
7
  *
12
8
  * ```typescript
13
- * import { bargs } from 'bargs';
9
+ * import { bargs, opt, pos } from '@boneskull/bargs';
14
10
  *
15
- * // Use as function
16
- * const result = bargs({
17
- * name: 'myapp',
18
- * options: { verbose: bargs.boolean({ aliases: ['v'] }) },
19
- * });
20
- *
21
- * // Access builder namespace
22
- * const opts = bargs.options({ name: bargs.string() });
11
+ * await bargs
12
+ * .create('my-app', { version: '1.0.0' })
13
+ * .globals(opt.options({ verbose: opt.boolean({ aliases: ['v'] }) }))
14
+ * .command(
15
+ * 'greet',
16
+ * pos.positionals(pos.string({ name: 'name', required: true })),
17
+ * ({ positionals }) => console.log(`Hello, ${positionals[0]}!`),
18
+ * 'Say hello',
19
+ * )
20
+ * .parseAsync();
23
21
  * ```
24
22
  *
25
23
  * @packageDocumentation
26
24
  */
27
- import { bargsAsync as bargsAsyncBase, bargs as bargsBase } from "./bargs.js";
28
- /**
29
- * Main bargs entry point (sync). Also provides access to all opt builders via
30
- * bargs.string(), bargs.boolean(), etc.
31
- */
32
- export declare const bargs: typeof bargsBase & {
33
- array: (items: "number" | "string", props?: Omit<import("./types.js").ArrayOption, "items" | "type">) => import("./types.js").ArrayOption;
34
- boolean: <P extends Omit<import("./types.js").BooleanOption, "type"> = Omit<import("./types.js").BooleanOption, "type">>(props?: P) => import("./types.js").BooleanOption & P;
35
- command: import("./opt.js").CommandBuilder;
36
- count: (props?: Omit<import("./types.js").CountOption, "type">) => import("./types.js").CountOption;
37
- enum: <const T extends readonly string[], P extends Omit<import("./types.js").EnumOption<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumOption<T[number]> & P;
38
- enumPos: <const T extends readonly string[], P extends Omit<import("./types.js").EnumPositional<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumPositional<T[number]> & P;
39
- number: <P extends Omit<import("./types.js").NumberOption, "type"> = Omit<import("./types.js").NumberOption, "type">>(props?: P) => import("./types.js").NumberOption & P;
40
- numberPos: <P extends Omit<import("./types.js").NumberPositional, "type"> = Omit<import("./types.js").NumberPositional, "type">>(props?: P) => import("./types.js").NumberPositional & P;
41
- options: {
42
- <A extends import("./types.js").OptionsSchema>(a: A): A;
43
- <A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema>(a: A, b: B): A & B;
44
- <A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema>(a: A, b: B, c: C): A & B & C;
45
- <A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema, D extends import("./types.js").OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
46
- (...schemas: import("./types.js").OptionsSchema[]): import("./types.js").OptionsSchema;
47
- };
48
- positionals: {
49
- <A extends import("./types.js").PositionalDef>(a: A): [A];
50
- <A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef>(a: A, b: B): [A, B];
51
- <A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef>(a: A, b: B, c: C): [A, B, C];
52
- <A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef, D extends import("./types.js").PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
53
- (...positionals: import("./types.js").PositionalDef[]): import("./types.js").PositionalsSchema;
54
- };
55
- string: <P extends Omit<import("./types.js").StringOption, "type"> = Omit<import("./types.js").StringOption, "type">>(props?: P) => P & import("./types.js").StringOption;
56
- stringPos: <P extends Omit<import("./types.js").StringPositional, "type"> = Omit<import("./types.js").StringPositional, "type">>(props?: P) => P & import("./types.js").StringPositional;
57
- variadic: (items: "number" | "string", props?: Omit<import("./types.js").VariadicPositional, "items" | "type">) => import("./types.js").VariadicPositional;
58
- };
59
- /**
60
- * Async bargs entry point. Also provides access to all opt builders via
61
- * bargsAsync.string(), etc.
62
- */
63
- export declare const bargsAsync: typeof bargsAsyncBase & {
64
- array: (items: "number" | "string", props?: Omit<import("./types.js").ArrayOption, "items" | "type">) => import("./types.js").ArrayOption;
65
- boolean: <P extends Omit<import("./types.js").BooleanOption, "type"> = Omit<import("./types.js").BooleanOption, "type">>(props?: P) => import("./types.js").BooleanOption & P;
66
- command: import("./opt.js").CommandBuilder;
67
- count: (props?: Omit<import("./types.js").CountOption, "type">) => import("./types.js").CountOption;
68
- enum: <const T extends readonly string[], P extends Omit<import("./types.js").EnumOption<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumOption<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumOption<T[number]> & P;
69
- enumPos: <const T extends readonly string[], P extends Omit<import("./types.js").EnumPositional<T[number]>, "choices" | "type"> = Omit<import("./types.js").EnumPositional<T[number]>, "type" | "choices">>(choices: T, props?: P) => import("./types.js").EnumPositional<T[number]> & P;
70
- number: <P extends Omit<import("./types.js").NumberOption, "type"> = Omit<import("./types.js").NumberOption, "type">>(props?: P) => import("./types.js").NumberOption & P;
71
- numberPos: <P extends Omit<import("./types.js").NumberPositional, "type"> = Omit<import("./types.js").NumberPositional, "type">>(props?: P) => import("./types.js").NumberPositional & P;
72
- options: {
73
- <A extends import("./types.js").OptionsSchema>(a: A): A;
74
- <A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema>(a: A, b: B): A & B;
75
- <A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema>(a: A, b: B, c: C): A & B & C;
76
- <A extends import("./types.js").OptionsSchema, B extends import("./types.js").OptionsSchema, C extends import("./types.js").OptionsSchema, D extends import("./types.js").OptionsSchema>(a: A, b: B, c: C, d: D): A & B & C & D;
77
- (...schemas: import("./types.js").OptionsSchema[]): import("./types.js").OptionsSchema;
78
- };
79
- positionals: {
80
- <A extends import("./types.js").PositionalDef>(a: A): [A];
81
- <A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef>(a: A, b: B): [A, B];
82
- <A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef>(a: A, b: B, c: C): [A, B, C];
83
- <A extends import("./types.js").PositionalDef, B extends import("./types.js").PositionalDef, C extends import("./types.js").PositionalDef, D extends import("./types.js").PositionalDef>(a: A, b: B, c: C, d: D): [A, B, C, D];
84
- (...positionals: import("./types.js").PositionalDef[]): import("./types.js").PositionalsSchema;
85
- };
86
- string: <P extends Omit<import("./types.js").StringOption, "type"> = Omit<import("./types.js").StringOption, "type">>(props?: P) => P & import("./types.js").StringOption;
87
- stringPos: <P extends Omit<import("./types.js").StringPositional, "type"> = Omit<import("./types.js").StringPositional, "type">>(props?: P) => P & import("./types.js").StringPositional;
88
- variadic: (items: "number" | "string", props?: Omit<import("./types.js").VariadicPositional, "items" | "type">) => import("./types.js").VariadicPositional;
89
- };
25
+ export { bargs, handle, map, merge } from "./bargs.js";
90
26
  export { BargsError, HelpError, ValidationError } from "./errors.js";
91
27
  export { generateCommandHelp, generateHelp } from "./help.js";
92
- export type { CommandBuilder } from "./opt.js";
28
+ export { opt, pos } from "./opt.js";
93
29
  export { link, linkifyUrls, supportsHyperlinks } from "./osc.js";
94
30
  export { ansi, createStyler, defaultTheme, stripAnsi, themes, } from "./theme.js";
95
31
  export type { StyleFn, Styler, Theme, ThemeColors, ThemeInput, } from "./theme.js";
96
- export type { AnyCommandConfig, ArrayOption, BargsConfig, BargsConfigWithCommands, BargsOptions, BargsResult, BooleanOption, CommandConfig, CommandConfigInput, CountOption, EnumOption, EnumPositional, Handler, HandlerFn, InferCommandResult, InferOption, InferOptions, InferPositional, InferPositionals, InferredCommands, InferTransformedPositionals, InferTransformedValues, NumberOption, NumberPositional, OptionDef, OptionsSchema, PositionalDef, PositionalsSchema, PositionalsTransformFn, StringOption, StringPositional, TransformsConfig, ValuesTransformFn, VariadicPositional, } from "./types.js";
32
+ export type { ArrayOption, BooleanOption, CliBuilder, CliResult, Command, CommandDef, CountOption, CreateOptions, EnumOption, EnumPositional, HandlerFn, InferOption, InferOptions, InferPositional, InferPositionals, InferTransformedPositionals, InferTransformedValues, NumberOption, NumberPositional, OptionDef, OptionsSchema, Parser, ParseResult, PositionalDef, PositionalsSchema, PositionalsTransformFn, StringOption, StringPositional, TransformsConfig, ValuesTransformFn, VariadicPositional, } from "./types.js";
97
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,KAAK,IAAI,SAAS,EAAE,mBAAmB;AAG9E;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;SA2EuxQ,GAAG;;;;;;;SAAo1B,GAAG;;;;;CA3EjlS,CAAC;AAEnD;;;GAGG;AACH,eAA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AG9D,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB;AAGpC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB;AAGjE,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,GACP,mBAAmB;AAGpB,YAAY,EACV,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,UAAU,GACX,mBAAmB;AAGpB,YAAY,EAEV,WAAW,EACX,aAAa,EAEb,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,aAAa,EACb,UAAU,EAEV,cAAc,EACd,SAAS,EAET,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EAEjB,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,mBAAmB"}
package/dist/index.js CHANGED
@@ -1,47 +1,37 @@
1
1
  /**
2
2
  * Main entry point for the bargs CLI argument parser.
3
3
  *
4
- * This module exports the primary `bargs` and `bargsAsync` functions with
5
- * attached option builder methods (e.g., `bargs.string()`, `bargs.boolean()`),
6
- * allowing both function-call and builder-namespace usage patterns. It also
7
- * re-exports all public types, error classes, help generators, theme utilities,
8
- * and OSC hyperlink functions.
4
+ * Provides a combinator-style API for building type-safe CLIs.
9
5
  *
10
6
  * @example
11
7
  *
12
8
  * ```typescript
13
- * import { bargs } from 'bargs';
9
+ * import { bargs, opt, pos } from '@boneskull/bargs';
14
10
  *
15
- * // Use as function
16
- * const result = bargs({
17
- * name: 'myapp',
18
- * options: { verbose: bargs.boolean({ aliases: ['v'] }) },
19
- * });
20
- *
21
- * // Access builder namespace
22
- * const opts = bargs.options({ name: bargs.string() });
11
+ * await bargs
12
+ * .create('my-app', { version: '1.0.0' })
13
+ * .globals(opt.options({ verbose: opt.boolean({ aliases: ['v'] }) }))
14
+ * .command(
15
+ * 'greet',
16
+ * pos.positionals(pos.string({ name: 'name', required: true })),
17
+ * ({ positionals }) => console.log(`Hello, ${positionals[0]}!`),
18
+ * 'Say hello',
19
+ * )
20
+ * .parseAsync();
23
21
  * ```
24
22
  *
25
23
  * @packageDocumentation
26
24
  */
27
- import { bargsAsync as bargsAsyncBase, bargs as bargsBase } from "./bargs.js";
28
- import { opt } from "./opt.js";
29
- /**
30
- * Main bargs entry point (sync). Also provides access to all opt builders via
31
- * bargs.string(), bargs.boolean(), etc.
32
- */
33
- export const bargs = Object.assign(bargsBase, opt);
34
- /**
35
- * Async bargs entry point. Also provides access to all opt builders via
36
- * bargsAsync.string(), etc.
37
- */
38
- export const bargsAsync = Object.assign(bargsAsyncBase, opt);
39
- // Re-export errors
25
+ // Main API
26
+ export { bargs, handle, map, merge } from "./bargs.js";
27
+ // Errors
40
28
  export { BargsError, HelpError, ValidationError } from "./errors.js";
41
- // Re-export help generators
29
+ // Help generators
42
30
  export { generateCommandHelp, generateHelp } from "./help.js";
43
- // Re-export OSC utilities for terminal hyperlinks
31
+ // Option and positional builders
32
+ export { opt, pos } from "./opt.js";
33
+ // OSC utilities for terminal hyperlinks
44
34
  export { link, linkifyUrls, supportsHyperlinks } from "./osc.js";
45
- // Re-export theme utilities
35
+ // Theme utilities
46
36
  export { ansi, createStyler, defaultTheme, stripAnsi, themes, } from "./theme.js";
47
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,KAAK,IAAI,SAAS,EAAE,mBAAmB;AAC9E,OAAO,EAAE,GAAG,EAAE,iBAAiB;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;AAE7D,mBAAmB;AACnB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB;AAErE,4BAA4B;AAC5B,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,kBAAkB;AAK9D,kDAAkD;AAClD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB;AAEjE,4BAA4B;AAC5B,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,GACP,mBAAmB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,mBAAmB;AAEvD,SAAS;AACT,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB;AAErE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,kBAAkB;AAE9D,iCAAiC;AACjC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB;AAEpC,wCAAwC;AACxC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB;AAEjE,kBAAkB;AAClB,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,GACP,mBAAmB"}
package/dist/opt.cjs CHANGED
@@ -1,34 +1,19 @@
1
1
  "use strict";
2
2
  /**
3
- * Builder functions for defining CLI options, positionals, and commands.
3
+ * Builder functions for defining CLI options and positionals.
4
4
  *
5
5
  * Provides ergonomic helpers with full TypeScript type inference for
6
6
  * constructing option schemas (`opt.string()`, `opt.boolean()`, `opt.enum()`,
7
- * etc.), positional schemas (`opt.stringPos()`, `opt.numberPos()`,
8
- * `opt.variadic()`), and command definitions (`opt.command()`). Includes
9
- * composition utilities for merging schemas (`opt.options()`,
10
- * `opt.positionals()`).
7
+ * etc.) and positional schemas (`opt.stringPos()`, `opt.numberPos()`,
8
+ * `opt.variadic()`).
11
9
  *
12
10
  * @packageDocumentation
13
11
  */
14
12
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.opt = void 0;
13
+ exports.pos = exports.opt = void 0;
16
14
  const errors_js_1 = require("./errors.cjs");
17
15
  /**
18
- * Implementation of command builder that detects whether it's called with
19
- * config (direct) or without args (curried for global options).
20
- */
21
- const commandBuilder = (configOrNothing) => {
22
- if (configOrNothing === undefined) {
23
- // Curried usage: return function that accepts config
24
- return (config) => config;
25
- }
26
- // Direct usage: return config as-is
27
- return configOrNothing;
28
- };
29
- /**
30
- * Validate that no alias conflicts exist in a merged options schema. Throws
31
- * BargsError if the same alias is used by multiple options.
16
+ * Validate that no alias conflicts exist in a merged options schema.
32
17
  */
33
18
  const validateAliasConflicts = (schema) => {
34
19
  const aliasToOption = new Map();
@@ -46,32 +31,56 @@ const validateAliasConflicts = (schema) => {
46
31
  }
47
32
  };
48
33
  /**
49
- * Compose multiple option schemas into one.
34
+ * Create a Parser from an options schema that can also merge with existing
35
+ * parsers.
36
+ *
37
+ * Supports two usage patterns:
38
+ *
39
+ * 1. Standalone: `opt.options({ ... })` - returns a Parser
40
+ * 2. Merging: `pos.positionals(...)(opt.options(...))` - merges positionals into
41
+ * options
50
42
  */
51
- const optionsImpl = (...schemas) => {
52
- const merged = Object.assign({}, ...schemas);
53
- validateAliasConflicts(merged);
54
- return merged;
43
+ const optionsImpl = (schema) => {
44
+ validateAliasConflicts(schema);
45
+ // Create the merge function
46
+ const merger = (parser) => {
47
+ const mergedSchema = { ...parser.__optionsSchema, ...schema };
48
+ validateAliasConflicts(mergedSchema);
49
+ // Preserve transforms from the incoming parser
50
+ const transformed = parser;
51
+ const result = {
52
+ ...parser,
53
+ __brand: 'Parser',
54
+ __optionsSchema: mergedSchema,
55
+ __values: {},
56
+ };
57
+ if (transformed.__transform) {
58
+ result.__transform = transformed.__transform;
59
+ }
60
+ return result;
61
+ };
62
+ // Add Parser properties to the function
63
+ const parserProps = {
64
+ __brand: 'Parser',
65
+ __optionsSchema: schema,
66
+ __positionals: [],
67
+ __positionalsSchema: [],
68
+ __values: {},
69
+ };
70
+ return Object.assign(merger, parserProps);
55
71
  };
56
- /**
57
- * Create a positionals schema from positional definitions.
58
- */
59
- const positionalsImpl = (...positionals) => positionals;
60
72
  /**
61
73
  * Namespaced option builders.
62
74
  *
63
- * Provides ergonomic helpers for defining CLI options, positionals, and
64
- * commands with full TypeScript type inference.
65
- *
66
75
  * @example
67
76
  *
68
77
  * ```typescript
69
78
  * import { opt } from 'bargs';
70
79
  *
71
- * const options = opt.options({
80
+ * const parser = opt.options({
72
81
  * verbose: opt.boolean({ aliases: ['v'] }),
73
82
  * name: opt.string({ default: 'world' }),
74
- * level: opt.enum(['low', 'medium', 'high'] as const),
83
+ * level: opt.enum(['low', 'medium', 'high']),
75
84
  * });
76
85
  * ```
77
86
  */
@@ -86,61 +95,12 @@ exports.opt = {
86
95
  ...props,
87
96
  }),
88
97
  /**
89
- * Define a boolean option. Props type is preserved to enable default
90
- * inference.
98
+ * Define a boolean option.
91
99
  */
92
100
  boolean: (props = {}) => ({
93
101
  type: 'boolean',
94
102
  ...props,
95
103
  }),
96
- /**
97
- * Define a command with proper type inference.
98
- *
99
- * Three usage patterns:
100
- *
101
- * 1. Simple usage (no global options): `bargs.command({ ... })`
102
- * 2. With global options: `bargs.command<typeof globalOptions>()({ ... })`
103
- * 3. With global options AND transforms: `bargs.command<typeof globalOptions,
104
- * typeof globalTransforms>()({ ... })`
105
- *
106
- * @example
107
- *
108
- * ```typescript
109
- * // Simple usage - no global options typed
110
- * const simpleCmd = bargs.command({
111
- * description: 'Simple command',
112
- * handler: ({ values }) => { ... },
113
- * });
114
- *
115
- * // With global options typed
116
- * const globalOptions = {
117
- * verbose: bargs.boolean({ aliases: ['v'] }),
118
- * } as const;
119
- *
120
- * const greetCmd = bargs.command<typeof globalOptions>()({
121
- * description: 'Greet someone',
122
- * options: { name: bargs.string({ default: 'world' }) },
123
- * handler: ({ values }) => {
124
- * // values.verbose is properly typed as boolean | undefined
125
- * console.log(`Hello, ${values.name}!`);
126
- * },
127
- * });
128
- *
129
- * // With global options AND global transforms typed
130
- * const globalTransforms = {
131
- * values: (v) => ({ ...v, timestamp: Date.now() }),
132
- * } as const;
133
- *
134
- * const timedCmd = bargs.command<typeof globalOptions, typeof globalTransforms>()({
135
- * description: 'Time-aware command',
136
- * handler: ({ values }) => {
137
- * // values.timestamp is properly typed from global transforms
138
- * console.log(`Ran at ${values.timestamp}`);
139
- * },
140
- * });
141
- * ```
142
- */
143
- command: commandBuilder,
144
104
  /**
145
105
  * Define a count option (--verbose --verbose = 2).
146
106
  */
@@ -149,9 +109,7 @@ exports.opt = {
149
109
  ...props,
150
110
  }),
151
111
  /**
152
- * Define an enum option with string choices. The choices array is inferred as
153
- * a tuple of literal types automatically. Props type is preserved to enable
154
- * default inference.
112
+ * Define an enum option with string choices.
155
113
  */
156
114
  enum: (choices, props = {}) => ({
157
115
  choices,
@@ -159,8 +117,7 @@ exports.opt = {
159
117
  ...props,
160
118
  }),
161
119
  /**
162
- * Define an enum positional argument with string choices. The choices array
163
- * is inferred as a tuple of literal types automatically.
120
+ * Define an enum positional argument with string choices.
164
121
  */
165
122
  enumPos: (choices, props = {}) => ({
166
123
  choices,
@@ -168,75 +125,144 @@ exports.opt = {
168
125
  ...props,
169
126
  }),
170
127
  /**
171
- * Define a number option. Props type is preserved to enable default
172
- * inference.
128
+ * Define a number option.
173
129
  */
174
130
  number: (props = {}) => ({
175
131
  type: 'number',
176
132
  ...props,
177
133
  }),
178
- // ─── Positional Builders ───────────────────────────────────────────
179
134
  /**
180
- * Define a number positional argument. Props type is preserved to enable
181
- * required inference.
135
+ * Define a number positional argument.
182
136
  */
183
137
  numberPos: (props = {}) => ({
184
138
  type: 'number',
185
139
  ...props,
186
140
  }),
187
141
  /**
188
- * Compose multiple option schemas into one. Later schemas override earlier
189
- * ones for duplicate option names. Validates that no alias conflicts exist.
142
+ * Create a Parser from an options schema.
190
143
  *
191
144
  * @example
192
145
  *
193
146
  * ```typescript
194
- * // Single schema (identity, enables reuse)
195
- * const loggingOpts = opt.options({
147
+ * const parser = opt.options({
196
148
  * verbose: opt.boolean({ aliases: ['v'] }),
197
- * quiet: opt.boolean({ aliases: ['q'] }),
198
- * });
199
- *
200
- * // Merge multiple schemas
201
- * const allOpts = opt.options(loggingOpts, ioOpts, {
202
- * format: opt.enum(['json', 'yaml'] as const),
149
+ * name: opt.string({ default: 'world' }),
203
150
  * });
151
+ * // Type: Parser<{ verbose: boolean | undefined, name: string }, []>
204
152
  * ```
205
- *
206
- * @throws BargsError if multiple options use the same alias
207
153
  */
208
154
  options: optionsImpl,
209
155
  /**
210
- * Create a positionals schema with proper tuple type inference.
156
+ * Define a string option.
157
+ */
158
+ string: (props = {}) => ({
159
+ type: 'string',
160
+ ...props,
161
+ }),
162
+ /**
163
+ * Define a string positional argument.
164
+ */
165
+ stringPos: (props = {}) => ({
166
+ type: 'string',
167
+ ...props,
168
+ }),
169
+ /**
170
+ * Define a variadic positional (rest args).
171
+ */
172
+ variadic: (items, props = {}) => ({
173
+ items,
174
+ type: 'variadic',
175
+ ...props,
176
+ }),
177
+ };
178
+ /**
179
+ * Create a Parser from positional definitions that can also merge with existing
180
+ * parsers.
181
+ *
182
+ * Supports two usage patterns:
183
+ *
184
+ * 1. Standalone: `pos.positionals(...)` - returns a Parser
185
+ * 2. Merging: `pos.positionals(...)(opt.options(...))` - merges positionals into
186
+ * options
187
+ */
188
+ const positionalsImpl = (...positionals) => {
189
+ // Create the merge function - just passes through V2, no intersection needed
190
+ const merger = (parser) => {
191
+ // Preserve transforms from the incoming parser
192
+ const transformed = parser;
193
+ const result = {
194
+ ...parser,
195
+ __brand: 'Parser',
196
+ __positionals: [],
197
+ __positionalsSchema: [...parser.__positionalsSchema, ...positionals],
198
+ };
199
+ if (transformed.__transform) {
200
+ result.__transform = transformed.__transform;
201
+ }
202
+ return result;
203
+ };
204
+ // Add Parser properties to the function
205
+ // Use empty object {} instead of Record<string, never> for better intersection behavior
206
+ const parserProps = {
207
+ __brand: 'Parser',
208
+ __optionsSchema: {},
209
+ __positionals: [],
210
+ __positionalsSchema: positionals,
211
+ __values: {},
212
+ };
213
+ return Object.assign(merger, parserProps);
214
+ };
215
+ /**
216
+ * Namespaced positional builders.
217
+ *
218
+ * @example
219
+ *
220
+ * ```typescript
221
+ * import { pos } from 'bargs';
222
+ *
223
+ * const parser = pos.positionals(
224
+ * pos.string({ name: 'input', required: true }),
225
+ * pos.string({ name: 'output' }),
226
+ * );
227
+ * ```
228
+ */
229
+ exports.pos = {
230
+ /**
231
+ * Define an enum positional argument with string choices.
232
+ */
233
+ enum: (choices, props = {}) => ({
234
+ choices,
235
+ type: 'enum',
236
+ ...props,
237
+ }),
238
+ /**
239
+ * Define a number positional argument.
240
+ */
241
+ number: (props = {}) => ({
242
+ type: 'number',
243
+ ...props,
244
+ }),
245
+ /**
246
+ * Create a Parser from positional definitions.
211
247
  *
212
248
  * @example
213
249
  *
214
250
  * ```typescript
215
- * const positionals = opt.positionals(
216
- * opt.stringPos({ description: 'Input file', required: true }),
217
- * opt.stringPos({ description: 'Output file' }),
251
+ * const parser = pos.positionals(
252
+ * pos.string({ name: 'input', required: true }),
253
+ * pos.string({ name: 'output' }),
218
254
  * );
255
+ * // Type: Parser<{}, readonly [string, string | undefined]>
219
256
  * ```
220
257
  */
221
258
  positionals: positionalsImpl,
222
259
  /**
223
- * Define a string option. Props type is preserved to enable default
224
- * inference.
260
+ * Define a string positional argument.
225
261
  */
226
262
  string: (props = {}) => ({
227
263
  type: 'string',
228
264
  ...props,
229
265
  }),
230
- // ─── Composition ───────────────────────────────────────────────────
231
- /**
232
- * Define a string positional argument. Props type is preserved to enable
233
- * required inference.
234
- */
235
- stringPos: (props = {}) => ({
236
- type: 'string',
237
- ...props,
238
- }),
239
- // ─── Command Builder ───────────────────────────────────────────────
240
266
  /**
241
267
  * Define a variadic positional (rest args).
242
268
  */
package/dist/opt.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"opt.js","sourceRoot":"","sources":["../src/opt.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAoBH,4CAAyC;AAwDzC;;;GAGG;AACH,MAAM,cAAc,GAAG,CAUrB,eAMC,EA6BG,EAAE;IACN,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAClC,qDAAqD;QACrD,OAAO,CAOL,MAMC,EACD,EAAE,CAAC,MAAM,CAAC;IACd,CAAC;IACD,oCAAoC;IACpC,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,sBAAsB,GAAG,CAAC,MAAqB,EAAQ,EAAE;IAC7D,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,KAAK,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,SAAS;QACX,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,QAAQ,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;gBACxC,MAAM,IAAI,sBAAU,CAClB,qBAAqB,KAAK,wBAAwB,QAAQ,YAAY,UAAU,GAAG,CACpF,CAAC;YACJ,CAAC;YACD,aAAa,CAA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