@wentools/zli 0.2.0-beta.2dc33a43

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 (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -0
  3. package/esm/_dnt.shims.d.ts +6 -0
  4. package/esm/_dnt.shims.d.ts.map +1 -0
  5. package/esm/_dnt.shims.js +61 -0
  6. package/esm/arg.d.ts +9 -0
  7. package/esm/arg.d.ts.map +1 -0
  8. package/esm/arg.js +4 -0
  9. package/esm/create_command.d.ts +28 -0
  10. package/esm/create_command.d.ts.map +1 -0
  11. package/esm/create_command.js +17 -0
  12. package/esm/create_command_directory.d.ts +35 -0
  13. package/esm/create_command_directory.d.ts.map +1 -0
  14. package/esm/create_command_directory.js +31 -0
  15. package/esm/create_flag_arg.d.ts +23 -0
  16. package/esm/create_flag_arg.d.ts.map +1 -0
  17. package/esm/create_flag_arg.js +14 -0
  18. package/esm/create_positional_arg.d.ts +24 -0
  19. package/esm/create_positional_arg.d.ts.map +1 -0
  20. package/esm/create_positional_arg.js +15 -0
  21. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/err/err.d.ts +38 -0
  22. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/err/err.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/err/err.js +38 -0
  24. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/err/index.d.ts +2 -0
  25. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/err/index.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/err/index.js +1 -0
  27. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/index.d.ts +156 -0
  28. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/index.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/index.js +65 -0
  30. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/is_result/index.d.ts +2 -0
  31. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/is_result/index.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/is_result/index.js +1 -0
  33. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/is_result/is_result.d.ts +11 -0
  34. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/is_result/is_result.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/is_result/is_result.js +14 -0
  36. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/index.d.ts +2 -0
  37. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/index.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/index.js +1 -0
  39. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/propagate_err.d.ts +28 -0
  40. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/propagate_err.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/propagate_err.js +30 -0
  42. package/esm/detect_arg_conflicts/detect_arg_conflicts.d.ts +19 -0
  43. package/esm/detect_arg_conflicts/detect_arg_conflicts.d.ts.map +1 -0
  44. package/esm/detect_arg_conflicts/detect_arg_conflicts.js +54 -0
  45. package/esm/detect_arg_conflicts/mod.d.ts +3 -0
  46. package/esm/detect_arg_conflicts/mod.d.ts.map +1 -0
  47. package/esm/detect_arg_conflicts/mod.js +1 -0
  48. package/esm/generate_help_text/generate_help_text.d.ts +13 -0
  49. package/esm/generate_help_text/generate_help_text.d.ts.map +1 -0
  50. package/esm/generate_help_text/generate_help_text.js +54 -0
  51. package/esm/generate_help_text/mod.d.ts +2 -0
  52. package/esm/generate_help_text/mod.d.ts.map +1 -0
  53. package/esm/generate_help_text/mod.js +1 -0
  54. package/esm/infer_args_type.d.ts +29 -0
  55. package/esm/infer_args_type.d.ts.map +1 -0
  56. package/esm/infer_args_type.js +6 -0
  57. package/esm/is_boolean_schema/is_boolean_schema.d.ts +12 -0
  58. package/esm/is_boolean_schema/is_boolean_schema.d.ts.map +1 -0
  59. package/esm/is_boolean_schema/is_boolean_schema.js +21 -0
  60. package/esm/is_boolean_schema/mod.d.ts +2 -0
  61. package/esm/is_boolean_schema/mod.d.ts.map +1 -0
  62. package/esm/is_boolean_schema/mod.js +1 -0
  63. package/esm/mod.d.ts +8 -0
  64. package/esm/mod.d.ts.map +1 -0
  65. package/esm/mod.js +1 -0
  66. package/esm/package.json +3 -0
  67. package/esm/parse_args/mod.d.ts +3 -0
  68. package/esm/parse_args/mod.d.ts.map +1 -0
  69. package/esm/parse_args/mod.js +1 -0
  70. package/esm/parse_args/parse_args.d.ts +24 -0
  71. package/esm/parse_args/parse_args.d.ts.map +1 -0
  72. package/esm/parse_args/parse_args.js +89 -0
  73. package/esm/run.d.ts +19 -0
  74. package/esm/run.d.ts.map +1 -0
  75. package/esm/run.js +152 -0
  76. package/esm/validate_args/mod.d.ts +3 -0
  77. package/esm/validate_args/mod.d.ts.map +1 -0
  78. package/esm/validate_args/mod.js +1 -0
  79. package/esm/validate_args/validate_args.d.ts +20 -0
  80. package/esm/validate_args/validate_args.d.ts.map +1 -0
  81. package/esm/validate_args/validate_args.js +23 -0
  82. package/esm/zli.d.ts +118 -0
  83. package/esm/zli.d.ts.map +1 -0
  84. package/esm/zli.js +124 -0
  85. package/package.json +39 -0
  86. package/script/_dnt.shims.d.ts +6 -0
  87. package/script/_dnt.shims.d.ts.map +1 -0
  88. package/script/_dnt.shims.js +65 -0
  89. package/script/arg.d.ts +9 -0
  90. package/script/arg.d.ts.map +1 -0
  91. package/script/arg.js +5 -0
  92. package/script/create_command.d.ts +28 -0
  93. package/script/create_command.d.ts.map +1 -0
  94. package/script/create_command.js +20 -0
  95. package/script/create_command_directory.d.ts +35 -0
  96. package/script/create_command_directory.d.ts.map +1 -0
  97. package/script/create_command_directory.js +34 -0
  98. package/script/create_flag_arg.d.ts +23 -0
  99. package/script/create_flag_arg.d.ts.map +1 -0
  100. package/script/create_flag_arg.js +17 -0
  101. package/script/create_positional_arg.d.ts +24 -0
  102. package/script/create_positional_arg.d.ts.map +1 -0
  103. package/script/create_positional_arg.js +18 -0
  104. package/script/deps/jsr.io/@wentools/result/0.1.0/src/err/err.d.ts +38 -0
  105. package/script/deps/jsr.io/@wentools/result/0.1.0/src/err/err.d.ts.map +1 -0
  106. package/script/deps/jsr.io/@wentools/result/0.1.0/src/err/err.js +41 -0
  107. package/script/deps/jsr.io/@wentools/result/0.1.0/src/err/index.d.ts +2 -0
  108. package/script/deps/jsr.io/@wentools/result/0.1.0/src/err/index.d.ts.map +1 -0
  109. package/script/deps/jsr.io/@wentools/result/0.1.0/src/err/index.js +5 -0
  110. package/script/deps/jsr.io/@wentools/result/0.1.0/src/index.d.ts +156 -0
  111. package/script/deps/jsr.io/@wentools/result/0.1.0/src/index.d.ts.map +1 -0
  112. package/script/deps/jsr.io/@wentools/result/0.1.0/src/index.js +77 -0
  113. package/script/deps/jsr.io/@wentools/result/0.1.0/src/is_result/index.d.ts +2 -0
  114. package/script/deps/jsr.io/@wentools/result/0.1.0/src/is_result/index.d.ts.map +1 -0
  115. package/script/deps/jsr.io/@wentools/result/0.1.0/src/is_result/index.js +5 -0
  116. package/script/deps/jsr.io/@wentools/result/0.1.0/src/is_result/is_result.d.ts +11 -0
  117. package/script/deps/jsr.io/@wentools/result/0.1.0/src/is_result/is_result.d.ts.map +1 -0
  118. package/script/deps/jsr.io/@wentools/result/0.1.0/src/is_result/is_result.js +17 -0
  119. package/script/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/index.d.ts +2 -0
  120. package/script/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/index.d.ts.map +1 -0
  121. package/script/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/index.js +5 -0
  122. package/script/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/propagate_err.d.ts +28 -0
  123. package/script/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/propagate_err.d.ts.map +1 -0
  124. package/script/deps/jsr.io/@wentools/result/0.1.0/src/propagate_err/propagate_err.js +33 -0
  125. package/script/detect_arg_conflicts/detect_arg_conflicts.d.ts +19 -0
  126. package/script/detect_arg_conflicts/detect_arg_conflicts.d.ts.map +1 -0
  127. package/script/detect_arg_conflicts/detect_arg_conflicts.js +57 -0
  128. package/script/detect_arg_conflicts/mod.d.ts +3 -0
  129. package/script/detect_arg_conflicts/mod.d.ts.map +1 -0
  130. package/script/detect_arg_conflicts/mod.js +5 -0
  131. package/script/generate_help_text/generate_help_text.d.ts +13 -0
  132. package/script/generate_help_text/generate_help_text.d.ts.map +1 -0
  133. package/script/generate_help_text/generate_help_text.js +57 -0
  134. package/script/generate_help_text/mod.d.ts +2 -0
  135. package/script/generate_help_text/mod.d.ts.map +1 -0
  136. package/script/generate_help_text/mod.js +5 -0
  137. package/script/infer_args_type.d.ts +29 -0
  138. package/script/infer_args_type.d.ts.map +1 -0
  139. package/script/infer_args_type.js +7 -0
  140. package/script/is_boolean_schema/is_boolean_schema.d.ts +12 -0
  141. package/script/is_boolean_schema/is_boolean_schema.d.ts.map +1 -0
  142. package/script/is_boolean_schema/is_boolean_schema.js +24 -0
  143. package/script/is_boolean_schema/mod.d.ts +2 -0
  144. package/script/is_boolean_schema/mod.d.ts.map +1 -0
  145. package/script/is_boolean_schema/mod.js +5 -0
  146. package/script/mod.d.ts +8 -0
  147. package/script/mod.d.ts.map +1 -0
  148. package/script/mod.js +5 -0
  149. package/script/package.json +3 -0
  150. package/script/parse_args/mod.d.ts +3 -0
  151. package/script/parse_args/mod.d.ts.map +1 -0
  152. package/script/parse_args/mod.js +5 -0
  153. package/script/parse_args/parse_args.d.ts +24 -0
  154. package/script/parse_args/parse_args.d.ts.map +1 -0
  155. package/script/parse_args/parse_args.js +92 -0
  156. package/script/run.d.ts +19 -0
  157. package/script/run.d.ts.map +1 -0
  158. package/script/run.js +189 -0
  159. package/script/validate_args/mod.d.ts +3 -0
  160. package/script/validate_args/mod.d.ts.map +1 -0
  161. package/script/validate_args/mod.js +5 -0
  162. package/script/validate_args/validate_args.d.ts +20 -0
  163. package/script/validate_args/validate_args.d.ts.map +1 -0
  164. package/script/validate_args/validate_args.js +26 -0
  165. package/script/zli.d.ts +118 -0
  166. package/script/zli.d.ts.map +1 -0
  167. package/script/zli.js +127 -0
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dntGlobalThis = exports.Deno = void 0;
4
+ const shim_deno_1 = require("@deno/shim-deno");
5
+ var shim_deno_2 = require("@deno/shim-deno");
6
+ Object.defineProperty(exports, "Deno", { enumerable: true, get: function () { return shim_deno_2.Deno; } });
7
+ const dntGlobals = {
8
+ Deno: shim_deno_1.Deno,
9
+ };
10
+ exports.dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
11
+ function createMergeProxy(baseObj, extObj) {
12
+ return new Proxy(baseObj, {
13
+ get(_target, prop, _receiver) {
14
+ if (prop in extObj) {
15
+ return extObj[prop];
16
+ }
17
+ else {
18
+ return baseObj[prop];
19
+ }
20
+ },
21
+ set(_target, prop, value) {
22
+ if (prop in extObj) {
23
+ delete extObj[prop];
24
+ }
25
+ baseObj[prop] = value;
26
+ return true;
27
+ },
28
+ deleteProperty(_target, prop) {
29
+ let success = false;
30
+ if (prop in extObj) {
31
+ delete extObj[prop];
32
+ success = true;
33
+ }
34
+ if (prop in baseObj) {
35
+ delete baseObj[prop];
36
+ success = true;
37
+ }
38
+ return success;
39
+ },
40
+ ownKeys(_target) {
41
+ const baseKeys = Reflect.ownKeys(baseObj);
42
+ const extKeys = Reflect.ownKeys(extObj);
43
+ const extKeysSet = new Set(extKeys);
44
+ return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
45
+ },
46
+ defineProperty(_target, prop, desc) {
47
+ if (prop in extObj) {
48
+ delete extObj[prop];
49
+ }
50
+ Reflect.defineProperty(baseObj, prop, desc);
51
+ return true;
52
+ },
53
+ getOwnPropertyDescriptor(_target, prop) {
54
+ if (prop in extObj) {
55
+ return Reflect.getOwnPropertyDescriptor(extObj, prop);
56
+ }
57
+ else {
58
+ return Reflect.getOwnPropertyDescriptor(baseObj, prop);
59
+ }
60
+ },
61
+ has(_target, prop) {
62
+ return prop in extObj || prop in baseObj;
63
+ },
64
+ });
65
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Arg type - union of positional and flag args
3
+ */
4
+ import type { PositionalArg } from './create_positional_arg.js';
5
+ import type { FlagArg } from './create_flag_arg.js';
6
+ import type { ZodSchema } from 'zod';
7
+ type Arg = PositionalArg<ZodSchema> | FlagArg<ZodSchema>;
8
+ export type { Arg };
9
+ //# sourceMappingURL=arg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arg.d.ts","sourceRoot":"","sources":["../src/arg.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,KAAK,GAAG,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAExD,YAAY,EAAE,GAAG,EAAE,CAAA"}
package/script/arg.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * Arg type - union of positional and flag args
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Create a command configuration
3
+ *
4
+ * A command consists of:
5
+ * - Args (positional and flags)
6
+ * - Handler function (sync or async)
7
+ * - Optional description
8
+ *
9
+ * Type inference: The handler args are automatically typed based on the Zod schemas
10
+ * in the args array. This provides full autocomplete and type safety.
11
+ */
12
+ import type { Arg } from './arg.js';
13
+ import type { InferArgsType } from './infer_args_type.js';
14
+ import type { Result } from './deps/jsr.io/@wentools/result/0.1.0/src/index.js';
15
+ type MaybeResult<TValue = void, TError = unknown> = TValue | Result<TValue, TError>;
16
+ type CommandHandler<TArgs> = (args: TArgs) => MaybeResult<void> | Promise<MaybeResult<void>>;
17
+ type Command<TArgs extends readonly Arg[] = readonly Arg[]> = {
18
+ args: TArgs;
19
+ handler: CommandHandler<InferArgsType<TArgs>>;
20
+ description?: string;
21
+ };
22
+ type CommandOptions = {
23
+ description?: string;
24
+ };
25
+ declare const createCommand: <const TArgs extends readonly Arg[]>(args: TArgs, handler: CommandHandler<InferArgsType<TArgs>>, options?: CommandOptions) => Command<TArgs>;
26
+ export { createCommand };
27
+ export type { Command, CommandHandler, CommandOptions, MaybeResult };
28
+ //# sourceMappingURL=create_command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_command.d.ts","sourceRoot":"","sources":["../src/create_command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mDAAmD,CAAA;AAE/E,KAAK,WAAW,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,OAAO,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAEnF,KAAK,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,WAAW,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;AAE5F,KAAK,OAAO,CAAC,KAAK,SAAS,SAAS,GAAG,EAAE,GAAG,SAAS,GAAG,EAAE,IAAI;IAC7D,IAAI,EAAE,KAAK,CAAA;IACX,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,cAAc,GAAG;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,QAAA,MAAM,aAAa,GAAI,KAAK,CAAC,KAAK,SAAS,SAAS,GAAG,EAAE,EACxD,MAAM,KAAK,EACX,SAAS,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAC7C,UAAU,cAAc,KACtB,OAAO,CAAC,KAAK,CAId,CAAA;AAEF,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * Create a command configuration
4
+ *
5
+ * A command consists of:
6
+ * - Args (positional and flags)
7
+ * - Handler function (sync or async)
8
+ * - Optional description
9
+ *
10
+ * Type inference: The handler args are automatically typed based on the Zod schemas
11
+ * in the args array. This provides full autocomplete and type safety.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.createCommand = void 0;
15
+ const createCommand = (args, handler, options) => ({
16
+ args,
17
+ handler,
18
+ description: options?.description,
19
+ });
20
+ exports.createCommand = createCommand;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Create a command directory configuration
3
+ *
4
+ * A command directory can contain both leaf commands and nested directories,
5
+ * allowing for hierarchical CLI organization.
6
+ *
7
+ * Think of it like a file system:
8
+ * - zli.c() = executable file (does work)
9
+ * - zli.d() = directory (organizes commands)
10
+ *
11
+ * @example
12
+ * const collaborators = zli.d('collaborators', {
13
+ * description: 'Manage collaborators',
14
+ * commands: {
15
+ * add: addCommand,
16
+ * remove: removeCommand,
17
+ * }
18
+ * })
19
+ */
20
+ import type { CommandEntry } from './run.js';
21
+ type CommandDirectory = {
22
+ name: string;
23
+ description?: string;
24
+ commands: Record<string, CommandEntry>;
25
+ };
26
+ type CommandDirectoryOptions = {
27
+ description?: string;
28
+ commands: Record<string, CommandEntry>;
29
+ };
30
+ declare const createCommandDirectory: <const TCommands extends Record<string, CommandEntry>>(name: string, options: CommandDirectoryOptions & {
31
+ commands: TCommands;
32
+ }) => CommandDirectory;
33
+ export { createCommandDirectory };
34
+ export type { CommandDirectory, CommandDirectoryOptions };
35
+ //# sourceMappingURL=create_command_directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_command_directory.d.ts","sourceRoot":"","sources":["../src/create_command_directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,KAAK,gBAAgB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CACtC,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CACtC,CAAA;AAED,QAAA,MAAM,sBAAsB,GAAI,KAAK,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACnF,MAAM,MAAM,EACZ,SAAS,uBAAuB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,KACxD,gBAWF,CAAA;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAA;AACjC,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAA"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Create a command directory configuration
4
+ *
5
+ * A command directory can contain both leaf commands and nested directories,
6
+ * allowing for hierarchical CLI organization.
7
+ *
8
+ * Think of it like a file system:
9
+ * - zli.c() = executable file (does work)
10
+ * - zli.d() = directory (organizes commands)
11
+ *
12
+ * @example
13
+ * const collaborators = zli.d('collaborators', {
14
+ * description: 'Manage collaborators',
15
+ * commands: {
16
+ * add: addCommand,
17
+ * remove: removeCommand,
18
+ * }
19
+ * })
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.createCommandDirectory = void 0;
23
+ const createCommandDirectory = (name, options) => {
24
+ // Validation
25
+ if (Object.keys(options.commands).length === 0) {
26
+ throw new Error(`Command directory '${name}' must have at least one command`);
27
+ }
28
+ return {
29
+ name,
30
+ description: options.description,
31
+ commands: options.commands,
32
+ };
33
+ };
34
+ exports.createCommandDirectory = createCommandDirectory;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Create a flag argument configuration
3
+ *
4
+ * Flags are specified with -- or - prefix:
5
+ * - Long name: script.ts --verbose
6
+ * - Short name: script.ts -v
7
+ */
8
+ import type { ZodSchema } from 'zod';
9
+ type FlagArg<TSchema extends ZodSchema> = {
10
+ type: 'flag';
11
+ name: string;
12
+ schema: TSchema;
13
+ short?: string;
14
+ description?: string;
15
+ };
16
+ type FlagArgOptions = {
17
+ short?: string;
18
+ description?: string;
19
+ };
20
+ declare const createFlagArg: <TSchema extends ZodSchema>(name: string, schema: TSchema, options?: FlagArgOptions) => FlagArg<TSchema>;
21
+ export { createFlagArg };
22
+ export type { FlagArg, FlagArgOptions };
23
+ //# sourceMappingURL=create_flag_arg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_flag_arg.d.ts","sourceRoot":"","sources":["../src/create_flag_arg.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,KAAK,OAAO,CAAC,OAAO,SAAS,SAAS,IAAI;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,cAAc,GAAG;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,QAAA,MAAM,aAAa,GAAI,OAAO,SAAS,SAAS,EAC/C,MAAM,MAAM,EACZ,QAAQ,OAAO,EACf,UAAU,cAAc,KACtB,OAAO,CAAC,OAAO,CAKhB,CAAA;AAEF,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Create a flag argument configuration
4
+ *
5
+ * Flags are specified with -- or - prefix:
6
+ * - Long name: script.ts --verbose
7
+ * - Short name: script.ts -v
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.createFlagArg = void 0;
11
+ const createFlagArg = (name, schema, options) => ({
12
+ type: 'flag',
13
+ name,
14
+ schema,
15
+ ...options,
16
+ });
17
+ exports.createFlagArg = createFlagArg;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Create a positional argument configuration
3
+ *
4
+ * Positional args can be specified:
5
+ * - By position: script.ts value
6
+ * - By long name: script.ts --name value
7
+ * - By short name: script.ts -n value
8
+ */
9
+ import type { ZodSchema } from 'zod';
10
+ type PositionalArg<TSchema extends ZodSchema> = {
11
+ type: 'positional';
12
+ name: string;
13
+ schema: TSchema;
14
+ short?: string;
15
+ description?: string;
16
+ };
17
+ type PositionalArgOptions = {
18
+ short?: string;
19
+ description?: string;
20
+ };
21
+ declare const createPositionalArg: <TSchema extends ZodSchema>(name: string, schema: TSchema, options?: PositionalArgOptions) => PositionalArg<TSchema>;
22
+ export { createPositionalArg };
23
+ export type { PositionalArg, PositionalArgOptions };
24
+ //# sourceMappingURL=create_positional_arg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_positional_arg.d.ts","sourceRoot":"","sources":["../src/create_positional_arg.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,KAAK,aAAa,CAAC,OAAO,SAAS,SAAS,IAAI;IAC/C,IAAI,EAAE,YAAY,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,OAAO,SAAS,SAAS,EACrD,MAAM,MAAM,EACZ,QAAQ,OAAO,EACf,UAAU,oBAAoB,KAC5B,aAAa,CAAC,OAAO,CAKtB,CAAA;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAC9B,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * Create a positional argument configuration
4
+ *
5
+ * Positional args can be specified:
6
+ * - By position: script.ts value
7
+ * - By long name: script.ts --name value
8
+ * - By short name: script.ts -n value
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.createPositionalArg = void 0;
12
+ const createPositionalArg = (name, schema, options) => ({
13
+ type: 'positional',
14
+ name,
15
+ schema,
16
+ ...options,
17
+ });
18
+ exports.createPositionalArg = createPositionalArg;
@@ -0,0 +1,38 @@
1
+ import { type Err } from 'neverthrow';
2
+ /**
3
+ * Create an Err Result with automatic literal type preservation
4
+ *
5
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
6
+ * No need for 'as const' - the type parameter is inferred as a literal!
7
+ *
8
+ * Returns Err<never, E> (not Result<never, E>) so .error is directly accessible.
9
+ *
10
+ * @example
11
+ * // ✅ Simple error
12
+ * return err('not_found', 'User not found')
13
+ * // Type: Err<never, { type: 'not_found', message: string }>
14
+ *
15
+ * @example
16
+ * // ✅ Error with additional properties
17
+ * return err('not_found', 'User not found', { userId: '123' })
18
+ * // Type: Err<never, { type: 'not_found', message: string, userId: string }>
19
+ *
20
+ * @example
21
+ * // ✅ Direct .error access (no narrowing needed)
22
+ * const error = err('not_found', 'User not found').error
23
+ * // error.type is 'not_found'
24
+ *
25
+ * @example
26
+ * // ✅ Error with complex additional data
27
+ * return err('validation_failed', 'Invalid input', {
28
+ * field: 'email',
29
+ * errors: ['Invalid format']
30
+ * })
31
+ * // Type: Err<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
32
+ */
33
+ declare const err: <const TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>>(type: TType, message: string, additional?: TAdditional) => Err<never, {
34
+ type: TType;
35
+ message: string;
36
+ } & TAdditional>;
37
+ export { err };
38
+ //# sourceMappingURL=err.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"err.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.0/src/err/err.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,GAAG,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,GAAG,GACR,KAAK,CAAC,KAAK,SAAS,MAAM,EAC1B,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEnE,MAAM,KAAK,EACX,SAAS,MAAM,EACf,aAAa,WAAW,KACtB,GAAG,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAKP,CAAA;AAErD,OAAO,EAAE,GAAG,EAAE,CAAA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.err = void 0;
4
+ const neverthrow_1 = require("neverthrow");
5
+ /**
6
+ * Create an Err Result with automatic literal type preservation
7
+ *
8
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
9
+ * No need for 'as const' - the type parameter is inferred as a literal!
10
+ *
11
+ * Returns Err<never, E> (not Result<never, E>) so .error is directly accessible.
12
+ *
13
+ * @example
14
+ * // ✅ Simple error
15
+ * return err('not_found', 'User not found')
16
+ * // Type: Err<never, { type: 'not_found', message: string }>
17
+ *
18
+ * @example
19
+ * // ✅ Error with additional properties
20
+ * return err('not_found', 'User not found', { userId: '123' })
21
+ * // Type: Err<never, { type: 'not_found', message: string, userId: string }>
22
+ *
23
+ * @example
24
+ * // ✅ Direct .error access (no narrowing needed)
25
+ * const error = err('not_found', 'User not found').error
26
+ * // error.type is 'not_found'
27
+ *
28
+ * @example
29
+ * // ✅ Error with complex additional data
30
+ * return err('validation_failed', 'Invalid input', {
31
+ * field: 'email',
32
+ * errors: ['Invalid format']
33
+ * })
34
+ * // Type: Err<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
35
+ */
36
+ const err = (type, message, additional) => (0, neverthrow_1.err)({
37
+ ...additional,
38
+ type,
39
+ message,
40
+ });
41
+ exports.err = err;
@@ -0,0 +1,2 @@
1
+ export { err } from './err.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.0/src/err/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.err = void 0;
4
+ var err_js_1 = require("./err.js");
5
+ Object.defineProperty(exports, "err", { enumerable: true, get: function () { return err_js_1.err; } });
@@ -0,0 +1,156 @@
1
+ import { err as _Err, ok, type Result, type Err, ResultAsync, okAsync as neverthrowOkAsync } from 'neverthrow';
2
+ /**
3
+ * Create an error object with literal type preservation
4
+ *
5
+ * @example
6
+ * const error = makeErr('not_found', 'User not found')
7
+ * // ✅ Type: { type: 'not_found', message: string }
8
+ *
9
+ * @example
10
+ * const error = makeErr('not_found', 'User not found', { userId: '123' })
11
+ * // ✅ Type: { type: 'not_found', message: string, userId: string }
12
+ */
13
+ declare const makeErr: <const TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>>(type: TType, message: string, additional?: TAdditional) => {
14
+ type: TType;
15
+ message: string;
16
+ } & TAdditional;
17
+ /**
18
+ * Create an async Err ResultAsync with automatic literal type preservation
19
+ *
20
+ * Async version of err() - same signature, returns ResultAsync instead of Result.
21
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
22
+ *
23
+ * @example
24
+ * // ✅ Simple error
25
+ * return errAsync('not_found', 'User not found')
26
+ * // Type: ResultAsync<never, { type: 'not_found', message: string }>
27
+ *
28
+ * @example
29
+ * // ✅ Error with additional properties
30
+ * return errAsync('not_found', 'User not found', { userId: '123' })
31
+ * // Type: ResultAsync<never, { type: 'not_found', message: string, userId: string }>
32
+ *
33
+ * @example
34
+ * // ✅ Error with complex additional data
35
+ * return errAsync('validation_failed', 'Invalid input', {
36
+ * field: 'email',
37
+ * errors: ['Invalid format']
38
+ * })
39
+ * // Type: ResultAsync<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
40
+ */
41
+ declare const errAsync: <const TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>>(type: TType, message: string, additional?: TAdditional) => ResultAsync<never, {
42
+ type: TType;
43
+ message: string;
44
+ } & TAdditional>;
45
+ /**
46
+ * Re-export okAsync from neverthrow for consistency
47
+ * Creates a successful ResultAsync
48
+ */
49
+ declare const okAsync: typeof neverthrowOkAsync;
50
+ /**
51
+ * Utility type for defining error types concisely
52
+ *
53
+ * @example
54
+ * // Instead of:
55
+ * type UserNotFoundError = {
56
+ * type: 'user_not_found'
57
+ * message: string
58
+ * userId: UserId
59
+ * }
60
+ *
61
+ * // Write:
62
+ * type UserNotFoundError = ErrorType<'user_not_found', { userId: UserId }>
63
+ *
64
+ * @example
65
+ * // Error without additional properties:
66
+ * type InvalidOperationError = ErrorType<'invalid_operation'>
67
+ */
68
+ type ErrorType<TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>> = {
69
+ type: TType;
70
+ message: string;
71
+ } & TAdditional;
72
+ /**
73
+ * Extract the error type from a Result or Promise<Result>
74
+ *
75
+ * @example
76
+ * // From async function
77
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
78
+ * type GetUserError = ExtractError<ReturnType<typeof getUser>>
79
+ * // Type: UserNotFoundError
80
+ *
81
+ * @example
82
+ * // From Result type directly
83
+ * type MyResult = Result<User, InvalidError>
84
+ * type MyError = ExtractError<MyResult>
85
+ * // Type: InvalidError
86
+ *
87
+ * @example
88
+ * // Works with composed errors
89
+ * const replaceVersion = async (): Promise<Result<Version, VersionNotFoundError | VersionExistsError>> => { ... }
90
+ * type ReplaceError = ExtractError<ReturnType<typeof replaceVersion>>
91
+ * // Type: VersionNotFoundError | VersionExistsError
92
+ */
93
+ type ExtractError<TResultOrPromise> = TResultOrPromise extends Promise<Result<unknown, infer TError>> ? TError : TResultOrPromise extends Result<unknown, infer TError> ? TError : never;
94
+ /**
95
+ * Extract the error type from a function that returns Result or Promise<Result>
96
+ *
97
+ * @example
98
+ * // Simple extraction
99
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
100
+ * type GetUserError = ExtractFnError<typeof getUser>
101
+ * // Type: UserNotFoundError
102
+ *
103
+ * @example
104
+ * // Compose errors from multiple functions
105
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
106
+ * const getImage = async (id: string): Promise<Result<Image, ImageNotFoundError>> => { ... }
107
+ * type CombinedError = ExtractFnError<typeof getUser> | ExtractFnError<typeof getImage>
108
+ * // Type: UserNotFoundError | ImageNotFoundError
109
+ */
110
+ type ExtractFnError<TFunction extends (...args: unknown[]) => unknown> = ExtractError<ReturnType<TFunction>>;
111
+ /**
112
+ * Extract and combine error types from multiple Result or Promise<Result> types
113
+ *
114
+ * @example
115
+ * type UserResult = Result<User, UserNotFoundError>
116
+ * type ImageResult = Promise<Result<Image, ImageNotFoundError>>
117
+ * type ProductResult = Result<Product, ProductNotFoundError>
118
+ *
119
+ * type CombinedError = ExtractErrors<[UserResult, ImageResult, ProductResult]>
120
+ * // Type: UserNotFoundError | ImageNotFoundError | ProductNotFoundError
121
+ */
122
+ type ExtractErrors<TResults extends readonly unknown[]> = TResults extends readonly [
123
+ infer TFirst,
124
+ ...infer TRest
125
+ ] ? ExtractError<TFirst> | ExtractErrors<TRest> : never;
126
+ /**
127
+ * Extract and combine error types from multiple functions that return Result or Promise<Result>
128
+ *
129
+ * @example
130
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
131
+ * const getImage = async (id: string): Promise<Result<Image, ImageNotFoundError>> => { ... }
132
+ * const deleteProduct = async (id: string): Promise<Result<void, ProductNotFoundError>> => { ... }
133
+ *
134
+ * type CombinedError = ExtractFnsError<[typeof getUser, typeof getImage, typeof deleteProduct]>
135
+ * // Type: UserNotFoundError | ImageNotFoundError | ProductNotFoundError
136
+ */
137
+ type ExtractFnsError<TFunctions extends readonly ((...args: unknown[]) => unknown)[]> = TFunctions extends readonly [
138
+ infer TFirst,
139
+ ...infer TRest extends readonly ((...args: unknown[]) => unknown)[]
140
+ ] ? ExtractFnError<TFirst & ((...args: unknown[]) => unknown)> | ExtractFnsError<TRest> : never;
141
+ /**
142
+ * Raw error function from neverthrow - use for lifting database errors directly
143
+ *
144
+ * @example
145
+ * const seedResult = await songSeeds.get.one.byId(songSeedId)
146
+ * if (seedResult.isErr()) {
147
+ * return rawErr(seedResult.error)
148
+ * }
149
+ */
150
+ declare const rawErr: typeof _Err;
151
+ export { makeErr, errAsync, ok, okAsync, rawErr, _Err, ResultAsync };
152
+ export type { Result, Err, ErrorType, ExtractError, ExtractFnError, ExtractErrors, ExtractFnsError };
153
+ export { err } from './err/index.js';
154
+ export { isResult } from './is_result/index.js';
155
+ export { propagateErr } from './propagate_err/index.js';
156
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@wentools/result/0.1.0/src/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.propagateErr = exports.isResult = exports.err = exports.ResultAsync = exports._Err = exports.rawErr = exports.okAsync = exports.ok = exports.errAsync = exports.makeErr = void 0;
4
+ const neverthrow_1 = require("neverthrow");
5
+ Object.defineProperty(exports, "_Err", { enumerable: true, get: function () { return neverthrow_1.err; } });
6
+ Object.defineProperty(exports, "ok", { enumerable: true, get: function () { return neverthrow_1.ok; } });
7
+ Object.defineProperty(exports, "ResultAsync", { enumerable: true, get: function () { return neverthrow_1.ResultAsync; } });
8
+ /**
9
+ * Create an error object with literal type preservation
10
+ *
11
+ * @example
12
+ * const error = makeErr('not_found', 'User not found')
13
+ * // ✅ Type: { type: 'not_found', message: string }
14
+ *
15
+ * @example
16
+ * const error = makeErr('not_found', 'User not found', { userId: '123' })
17
+ * // ✅ Type: { type: 'not_found', message: string, userId: string }
18
+ */
19
+ const makeErr = (type, message, additional) => ({
20
+ ...additional,
21
+ type,
22
+ message,
23
+ });
24
+ exports.makeErr = makeErr;
25
+ /**
26
+ * Create an async Err ResultAsync with automatic literal type preservation
27
+ *
28
+ * Async version of err() - same signature, returns ResultAsync instead of Result.
29
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
30
+ *
31
+ * @example
32
+ * // ✅ Simple error
33
+ * return errAsync('not_found', 'User not found')
34
+ * // Type: ResultAsync<never, { type: 'not_found', message: string }>
35
+ *
36
+ * @example
37
+ * // ✅ Error with additional properties
38
+ * return errAsync('not_found', 'User not found', { userId: '123' })
39
+ * // Type: ResultAsync<never, { type: 'not_found', message: string, userId: string }>
40
+ *
41
+ * @example
42
+ * // ✅ Error with complex additional data
43
+ * return errAsync('validation_failed', 'Invalid input', {
44
+ * field: 'email',
45
+ * errors: ['Invalid format']
46
+ * })
47
+ * // Type: ResultAsync<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
48
+ */
49
+ const errAsync = (type, message, additional) => (0, neverthrow_1.errAsync)({
50
+ ...additional,
51
+ type,
52
+ message,
53
+ });
54
+ exports.errAsync = errAsync;
55
+ /**
56
+ * Re-export okAsync from neverthrow for consistency
57
+ * Creates a successful ResultAsync
58
+ */
59
+ const okAsync = neverthrow_1.okAsync;
60
+ exports.okAsync = okAsync;
61
+ /**
62
+ * Raw error function from neverthrow - use for lifting database errors directly
63
+ *
64
+ * @example
65
+ * const seedResult = await songSeeds.get.one.byId(songSeedId)
66
+ * if (seedResult.isErr()) {
67
+ * return rawErr(seedResult.error)
68
+ * }
69
+ */
70
+ const rawErr = neverthrow_1.err;
71
+ exports.rawErr = rawErr;
72
+ var index_js_1 = require("./err/index.js");
73
+ Object.defineProperty(exports, "err", { enumerable: true, get: function () { return index_js_1.err; } });
74
+ var index_js_2 = require("./is_result/index.js");
75
+ Object.defineProperty(exports, "isResult", { enumerable: true, get: function () { return index_js_2.isResult; } });
76
+ var index_js_3 = require("./propagate_err/index.js");
77
+ Object.defineProperty(exports, "propagateErr", { enumerable: true, get: function () { return index_js_3.propagateErr; } });
@@ -0,0 +1,2 @@
1
+ export { isResult } from './is_result.js';
2
+ //# sourceMappingURL=index.d.ts.map