politty 0.4.6 → 0.4.8

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 (61) hide show
  1. package/dist/{schema-extractor-CVf0J4An.d.cts → arg-registry-BDybpyo5.d.cts} +170 -90
  2. package/dist/arg-registry-BDybpyo5.d.cts.map +1 -0
  3. package/dist/{schema-extractor-C9APqeSL.d.ts → arg-registry-CHmAzJOM.d.ts} +170 -90
  4. package/dist/arg-registry-CHmAzJOM.d.ts.map +1 -0
  5. package/dist/augment.d.cts +1 -1
  6. package/dist/augment.d.ts +1 -1
  7. package/dist/completion/index.cjs +2 -2
  8. package/dist/completion/index.d.cts +1 -1
  9. package/dist/completion/index.d.ts +1 -1
  10. package/dist/completion/index.js +2 -2
  11. package/dist/{completion-Df0eZ70u.cjs → completion-BADAzqT9.cjs} +3 -3
  12. package/dist/completion-BADAzqT9.cjs.map +1 -0
  13. package/dist/{completion-_AnQsWh9.js → completion-Dj7ytbLu.js} +2 -2
  14. package/dist/completion-Dj7ytbLu.js.map +1 -0
  15. package/dist/docs/index.cjs +3 -3
  16. package/dist/docs/index.d.cts +2 -1
  17. package/dist/docs/index.d.cts.map +1 -1
  18. package/dist/docs/index.d.ts +2 -1
  19. package/dist/docs/index.d.ts.map +1 -1
  20. package/dist/docs/index.js +3 -3
  21. package/dist/{index-BZalbMeu.d.ts → index-DcwMaTvt.d.ts} +3 -2
  22. package/dist/index-DcwMaTvt.d.ts.map +1 -0
  23. package/dist/{index-C5-0RXiH.d.cts → index-DjU9BErU.d.cts} +3 -2
  24. package/dist/index-DjU9BErU.d.cts.map +1 -0
  25. package/dist/index.cjs +3 -3
  26. package/dist/index.d.cts +4 -8
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.ts +4 -8
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +3 -3
  31. package/dist/{lazy-DHlvJiQQ.cjs → lazy-B_E2X0KR.cjs} +27 -4
  32. package/dist/lazy-B_E2X0KR.cjs.map +1 -0
  33. package/dist/{lazy-DSyfzR-F.js → lazy-D6nL_iKJ.js} +26 -3
  34. package/dist/lazy-D6nL_iKJ.js.map +1 -0
  35. package/dist/{runner-DjG0uBxQ.js → runner-BQcd2UEj.js} +118 -7
  36. package/dist/runner-BQcd2UEj.js.map +1 -0
  37. package/dist/{runner-C1Aah5c5.cjs → runner-nKNXknDl.cjs} +118 -7
  38. package/dist/runner-nKNXknDl.cjs.map +1 -0
  39. package/dist/schema-extractor-D1sJW-sc.d.ts +117 -0
  40. package/dist/schema-extractor-D1sJW-sc.d.ts.map +1 -0
  41. package/dist/schema-extractor-RainqdRn.d.cts +117 -0
  42. package/dist/schema-extractor-RainqdRn.d.cts.map +1 -0
  43. package/dist/{subcommand-router-sZHhUP7b.cjs → subcommand-router-BTOzDQnY.cjs} +2 -2
  44. package/dist/{subcommand-router-sZHhUP7b.cjs.map → subcommand-router-BTOzDQnY.cjs.map} +1 -1
  45. package/dist/{subcommand-router-CKuy6D2b.js → subcommand-router-Bu3YTw_f.js} +2 -2
  46. package/dist/{subcommand-router-CKuy6D2b.js.map → subcommand-router-Bu3YTw_f.js.map} +1 -1
  47. package/package.json +1 -1
  48. package/dist/arg-registry-2m40k1Et.d.ts +0 -144
  49. package/dist/arg-registry-2m40k1Et.d.ts.map +0 -1
  50. package/dist/arg-registry-BNoIwnNr.d.cts +0 -144
  51. package/dist/arg-registry-BNoIwnNr.d.cts.map +0 -1
  52. package/dist/completion-Df0eZ70u.cjs.map +0 -1
  53. package/dist/completion-_AnQsWh9.js.map +0 -1
  54. package/dist/index-BZalbMeu.d.ts.map +0 -1
  55. package/dist/index-C5-0RXiH.d.cts.map +0 -1
  56. package/dist/lazy-DHlvJiQQ.cjs.map +0 -1
  57. package/dist/lazy-DSyfzR-F.js.map +0 -1
  58. package/dist/runner-C1Aah5c5.cjs.map +0 -1
  59. package/dist/runner-DjG0uBxQ.js.map +0 -1
  60. package/dist/schema-extractor-C9APqeSL.d.ts.map +0 -1
  61. package/dist/schema-extractor-CVf0J4An.d.cts.map +0 -1
@@ -1,4 +1,3 @@
1
- import { n as CompletionMeta } from "./arg-registry-BNoIwnNr.cjs";
2
1
  import { z } from "zod";
3
2
 
4
3
  //#region src/lazy.d.ts
@@ -58,6 +57,10 @@ declare function lazy<T extends AnyCommand>(meta: T, load: () => Promise<AnyComm
58
57
  * ```
59
58
  */
60
59
  interface GlobalArgs {}
60
+ /**
61
+ * Detect empty interface (used for GlobalArgs declaration merging)
62
+ */
63
+ type IsEmpty<T> = keyof T extends never ? true : false;
61
64
  /**
62
65
  * Example definition for a command
63
66
  */
@@ -99,6 +102,17 @@ interface CleanupContext<TArgs = unknown> {
99
102
  /** Error if command execution failed */
100
103
  error?: Error | undefined;
101
104
  }
105
+ /**
106
+ * Context provided to global setup function (runMain/runCommand level)
107
+ */
108
+ interface GlobalSetupContext {}
109
+ /**
110
+ * Context provided to global cleanup function (runMain/runCommand level)
111
+ */
112
+ interface GlobalCleanupContext {
113
+ /** Error if command execution failed */
114
+ error?: Error | undefined;
115
+ }
102
116
  /**
103
117
  * Base command interface (shared properties)
104
118
  * @template TArgsSchema - The Zod schema type for arguments
@@ -186,6 +200,10 @@ interface MainOptions {
186
200
  logger?: Logger;
187
201
  /** Global args schema (shared across all subcommands) */
188
202
  globalArgs?: ArgsSchema;
203
+ /** Global setup hook (runs before command execution) */
204
+ setup?: ((context: GlobalSetupContext) => void | Promise<void>) | undefined;
205
+ /** Global cleanup hook (runs after command execution, always executes even on error) */
206
+ cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
189
207
  }
190
208
  /**
191
209
  * Options for runCommand (programmatic/test usage)
@@ -201,6 +219,10 @@ interface RunCommandOptions {
201
219
  logger?: Logger;
202
220
  /** Global args schema (shared across all subcommands) */
203
221
  globalArgs?: ArgsSchema;
222
+ /** Global setup hook (runs before command execution) */
223
+ setup?: ((context: GlobalSetupContext) => void | Promise<void>) | undefined;
224
+ /** Global cleanup hook (runs after command execution, always executes even on error) */
225
+ cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
204
226
  }
205
227
  /**
206
228
  * Log level type
@@ -265,115 +287,173 @@ interface RunResultFailure {
265
287
  */
266
288
  type RunResult<T = unknown> = RunResultSuccess<T> | RunResultFailure;
267
289
  //#endregion
268
- //#region src/core/schema-extractor.d.ts
290
+ //#region src/core/arg-registry.d.ts
269
291
  /**
270
- * Resolved metadata for an argument field
292
+ * Built-in completion types
271
293
  */
272
- interface ResolvedFieldMeta {
273
- /** Field name (camelCase, as defined in schema) */
274
- name: string;
275
- /** CLI option name (kebab-case, for command line usage) */
276
- cliName: string;
277
- /** Short alias (e.g., 'v' for --verbose) */
278
- alias?: string | undefined;
294
+ type CompletionType = "file" | "directory" | "none";
295
+ /**
296
+ * Custom completion specification
297
+ */
298
+ interface CustomCompletion {
299
+ /** Static list of choices for completion */
300
+ choices?: string[];
301
+ /** Shell command to execute for dynamic completion */
302
+ shellCommand?: string;
303
+ }
304
+ /**
305
+ * Completion metadata for an argument
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * // File completion with extension filter
310
+ * input: arg(z.string(), {
311
+ * completion: { type: "file", extensions: ["json", "yaml"] }
312
+ * })
313
+ *
314
+ * // Directory completion
315
+ * outputDir: arg(z.string(), {
316
+ * completion: { type: "directory" }
317
+ * })
318
+ *
319
+ * // Custom static choices
320
+ * logLevel: arg(z.string(), {
321
+ * completion: { custom: { choices: ["debug", "info", "warn", "error"] } }
322
+ * })
323
+ *
324
+ * // Dynamic completion from shell command
325
+ * branch: arg(z.string(), {
326
+ * completion: { custom: { shellCommand: "git branch --format='%(refname:short)'" } }
327
+ * })
328
+ *
329
+ * // File completion with glob pattern matcher
330
+ * envFile: arg(z.string(), {
331
+ * completion: { type: "file", matcher: [".env.*"] }
332
+ * })
333
+ * ```
334
+ */
335
+ type CompletionMeta = {
336
+ /** Built-in completion type */type?: CompletionType; /** Custom completion (takes precedence over type if both specified) */
337
+ custom?: CustomCompletion;
338
+ } & ({
339
+ /** File extension filter (only applies when type is "file") */extensions?: string[];
340
+ matcher?: never;
341
+ } | {
342
+ /** Glob patterns for file matching (only applies when type is "file") */matcher?: string[];
343
+ extensions?: never;
344
+ });
345
+ /**
346
+ * Context provided to effect callbacks.
347
+ * When GlobalArgs is extended via declaration merging, `globalArgs` is typed accordingly.
348
+ */
349
+ type EffectContext = {
350
+ /** Field name (camelCase) */name: string; /** Validated args for this schema (global args for global effects, command args for command effects) */
351
+ args: Readonly<Record<string, unknown>>;
352
+ } & (IsEmpty<GlobalArgs> extends true ? {
353
+ globalArgs?: Readonly<Record<string, unknown>>;
354
+ } : {
355
+ globalArgs?: Readonly<GlobalArgs>;
356
+ });
357
+ /**
358
+ * Base metadata shared by all argument types
359
+ */
360
+ interface BaseArgMeta<TValue = unknown> {
279
361
  /** Argument description */
280
- description?: string | undefined;
281
- /** Whether this is a positional argument */
282
- positional: boolean;
362
+ description?: string;
363
+ /** Treat as positional argument */
364
+ positional?: boolean;
283
365
  /** Placeholder for help display */
284
- placeholder?: string | undefined;
366
+ placeholder?: string;
285
367
  /**
286
368
  * Environment variable name(s) to read value from.
287
- * If an array, earlier entries take priority.
369
+ * If an array is provided, earlier entries take priority.
370
+ * CLI arguments always take precedence over environment variables.
371
+ *
372
+ * @example
373
+ * ```ts
374
+ * // Single env var
375
+ * port: arg(z.coerce.number(), { env: "PORT" })
376
+ *
377
+ * // Multiple env vars (PORT takes priority over SERVER_PORT)
378
+ * port: arg(z.coerce.number(), { env: ["PORT", "SERVER_PORT"] })
379
+ * ```
288
380
  */
289
- env?: string | string[] | undefined;
290
- /** Whether this argument is required */
291
- required: boolean;
292
- /** Default value if any */
293
- defaultValue?: unknown;
294
- /** Detected type from schema */
295
- type: "string" | "number" | "boolean" | "array" | "unknown";
296
- /** Original Zod schema */
297
- schema: z.ZodType;
298
- /** True if this overrides built-in aliases (-h, -H) */
299
- overrideBuiltinAlias?: true;
300
- /** Enum values if detected from schema (z.enum) */
301
- enumValues?: string[] | undefined;
302
- /** Completion metadata from arg() */
303
- completion?: CompletionMeta | undefined;
304
- }
305
- /**
306
- * Extracted fields from a schema
307
- */
308
- interface ExtractedFields {
309
- /** All field definitions */
310
- fields: ResolvedFieldMeta[];
311
- /** Original schema for validation */
312
- schema: ArgsSchema;
313
- /** Schema type */
314
- schemaType: "object" | "discriminatedUnion" | "union" | "xor" | "intersection";
315
- /** Discriminator key (for discriminatedUnion) */
316
- discriminator?: string;
317
- /** Variants (for discriminatedUnion) */
318
- variants?: Array<{
319
- discriminatorValue: string;
320
- fields: ResolvedFieldMeta[];
321
- description?: string;
322
- }>;
323
- /** Options (for union) */
324
- unionOptions?: ExtractedFields[];
325
- /** Schema description */
326
- description?: string;
381
+ env?: string | string[];
382
+ /** Completion configuration for shell tab-completion */
383
+ completion?: CompletionMeta;
327
384
  /**
328
- * Unknown keys handling mode
329
- * - "strict": Unknown keys cause validation errors (z.strictObject or z.object().strict())
330
- * - "strip": Unknown keys trigger warnings (default, z.object())
331
- * - "passthrough": Unknown keys are silently ignored (z.looseObject or z.object().passthrough())
385
+ * Side-effect callback executed after argument parsing and validation.
386
+ * Runs before the command lifecycle (setup/run/cleanup).
387
+ * Use Zod .transform() for value transformation instead.
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * verbose: arg(z.boolean().default(false), {
392
+ * alias: "v",
393
+ * effect: (value) => {
394
+ * if (value) logger.setLevel("debug");
395
+ * },
396
+ * })
397
+ * ```
332
398
  */
333
- unknownKeysMode: UnknownKeysMode;
399
+ effect?: (value: TValue, context: EffectContext) => void | PromiseLike<void>;
334
400
  }
335
401
  /**
336
- * Unknown keys handling mode for object schemas
337
- * - "strict": Unknown keys cause validation errors
338
- * - "strip": Unknown keys are silently ignored (default)
339
- * - "passthrough": Unknown keys are passed through
402
+ * Metadata for regular arguments (non-builtin aliases)
340
403
  */
341
- type UnknownKeysMode = "strict" | "strip" | "passthrough";
404
+ interface RegularArgMeta<TValue = unknown> extends BaseArgMeta<TValue> {
405
+ /** Short alias (e.g., 'v' for --verbose) */
406
+ alias?: string;
407
+ }
342
408
  /**
343
- * Detect unknown keys handling mode from a Zod object schema
344
- *
345
- * In Zod v4:
346
- * - Default (strip): _def.catchall is undefined
347
- * - strict: _def.catchall is ZodNever (type = "never")
348
- * - passthrough: _def.catchall is ZodUnknown (type = "unknown")
409
+ * Metadata for overriding built-in aliases (-h, -H)
349
410
  */
350
- declare function getUnknownKeysMode(schema: z.ZodType): UnknownKeysMode;
411
+ interface BuiltinOverrideArgMeta<TValue = unknown> extends BaseArgMeta<TValue> {
412
+ /** Built-in alias to override ('h' or 'H') */
413
+ alias: "h" | "H";
414
+ /** Must be true to override built-in aliases */
415
+ overrideBuiltinAlias: true;
416
+ }
351
417
  /**
352
- * Convert camelCase to kebab-case
353
- * @example toKebabCase("dryRun") => "dry-run"
354
- * @example toKebabCase("outputDir") => "output-dir"
355
- * @example toKebabCase("XMLParser") => "xml-parser"
418
+ * Metadata options for argument definition
356
419
  */
357
- declare function toKebabCase(str: string): string;
420
+ type ArgMeta<TValue = unknown> = RegularArgMeta<TValue> | BuiltinOverrideArgMeta<TValue>;
358
421
  /**
359
- * Convert hyphen-separated sequences to camelCase.
422
+ * Register metadata for a Zod schema
360
423
  *
361
- * Replaces `-x` (hyphen followed by a lowercase letter) with the uppercase
362
- * variant. Non-hyphenated input (e.g., already camelCase) is returned as-is.
424
+ * @param schema - The Zod schema
425
+ * @param meta - Argument metadata
426
+ * @returns The same schema (for chaining)
427
+ *
428
+ * @example
429
+ * ```ts
430
+ * import { z } from "zod";
431
+ * import { arg, defineCommand } from "politty";
363
432
  *
364
- * @param str - A string that may contain hyphens
365
- * @example toCamelCase("dry-run") => "dryRun"
366
- * @example toCamelCase("output-dir") => "outputDir"
367
- * @example toCamelCase("dryRun") => "dryRun"
433
+ * const cmd = defineCommand({
434
+ * args: z.object({
435
+ * name: arg(z.string(), { description: "User name", positional: true }),
436
+ * verbose: arg(z.boolean().default(false), { alias: "v" }),
437
+ * }),
438
+ * run: (args) => {
439
+ * console.log(args.name, args.verbose);
440
+ * },
441
+ * });
442
+ * ```
368
443
  */
369
- declare function toCamelCase(str: string): string;
370
444
  /**
371
- * Extract all fields from a schema
372
- *
373
- * @param schema - The args schema (ZodObject, ZodDiscriminatedUnion, etc.)
374
- * @returns Extracted field information
445
+ * Type helper to validate ArgMeta
446
+ * Forces a type error if alias is "h" or "H" without overrideBuiltinAlias: true
375
447
  */
376
- declare function extractFields(schema: ArgsSchema): ExtractedFields;
448
+ type ValidateArgMeta<M> = M extends {
449
+ alias: "h" | "H";
450
+ } ? M extends {
451
+ overrideBuiltinAlias: true;
452
+ } ? M : { [K in keyof M]: M[K] } & {
453
+ __typeError: "Alias 'h' or 'H' requires overrideBuiltinAlias: true";
454
+ } : M;
455
+ declare function arg<T extends z.ZodType>(schema: T): T;
456
+ declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M>): T;
377
457
  //#endregion
378
- export { LazyCommand as A, RunResult as C, SetupContext as D, RunnableCommand as E, lazy as M, SubCommandValue as O, RunCommandOptions as S, RunResultSuccess as T, LogLevel as _, getUnknownKeysMode as a, MainOptions as b, AnyCommand as c, CollectedLogs as d, Command as f, LogEntry as g, GlobalArgs as h, extractFields as i, isLazyCommand as j, SubCommandsRecord as k, ArgsSchema as l, Example as m, ResolvedFieldMeta as n, toCamelCase as o, CommandBase as p, UnknownKeysMode as r, toKebabCase as s, ExtractedFields as t, CleanupContext as u, LogStream as v, RunResultFailure as w, NonRunnableCommand as x, Logger as y };
379
- //# sourceMappingURL=schema-extractor-CVf0J4An.d.cts.map
458
+ export { SubCommandValue as A, NonRunnableCommand as C, RunResultSuccess as D, RunResultFailure as E, LazyCommand as M, isLazyCommand as N, RunnableCommand as O, lazy as P, MainOptions as S, RunResult as T, IsEmpty as _, EffectContext as a, LogStream as b, ArgsSchema as c, Command as d, CommandBase as f, GlobalSetupContext as g, GlobalCleanupContext as h, CustomCompletion as i, SubCommandsRecord as j, SetupContext as k, CleanupContext as l, GlobalArgs as m, CompletionMeta as n, arg as o, Example as p, CompletionType as r, AnyCommand as s, ArgMeta as t, CollectedLogs as u, LogEntry as v, RunCommandOptions as w, Logger as x, LogLevel as y };
459
+ //# sourceMappingURL=arg-registry-BDybpyo5.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arg-registry-BDybpyo5.d.cts","names":[],"sources":["../src/lazy.ts","../src/types.ts","../src/core/arg-registry.ts"],"mappings":";;;;;;;;UAgBiB,WAAA,WAAsB,UAAA,GAAa,UAAA;EAAA,SACzC,gBAAA;EAAA,SACA,IAAA,EAAM,CAAA;EAAA,SACN,IAAA,QAAY,OAAA,CAAQ,UAAA;AAAA;;;;iBAMf,aAAA,CAAc,KAAA,YAAiB,KAAA,IAAS,WAAA;;;;;;;AAAxD;;;;;;;;;AAkCA;;;;;;;;;;;;;iBAAgB,IAAA,WAAe,UAAA,CAAA,CAC7B,IAAA,EAAM,CAAA,EACN,IAAA,QAAY,OAAA,CAAQ,UAAA,IACnB,WAAA,CAAY,CAAA;;;;AA9Cf;;;;;;;;;UCDiB,UAAA;;;;KAKL,OAAA,YAAmB,CAAA;;;;UAKd,OAAA;EDNwB;ECQvC,GAAA;EDFc;ECId,IAAA;;EAEA,MAAA;AAAA;;;;;UAOe,MAAA;EDqBG;ECnBlB,GAAA,CAAI,OAAA;EDmByB;ECjB7B,KAAA,CAAM,OAAA;AAAA;;;;KAOI,UAAA,GAAa,CAAA,CAAE,OAAA,CAAQ,MAAA;;;;UAKlB,YAAA;EDMf;ECJA,IAAA,EAAM,KAAA;AAAA;;;;UAMS,cAAA;EDAD;ECEd,IAAA,EAAM,KAAA;;EAEN,KAAA,GAAQ,KAAA;AAAA;;;;UAOO,kBAAA;;;;UAKA,oBAAA;EArDA;EAuDf,KAAA,GAAQ,KAAA;AAAA;;;;;;UAQO,WAAA,qBACK,UAAA;EAnDL;EAuDf,IAAA;;EAEA,WAAA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AA,GAAa,QAAA,CAAS,MAAA;AAAA;EACtB,UAAA,GAAa,QAAA,CAAS,UAAA;AAAA;;;;UAKX,WAAA;EDnDT;ECqDN,WAAA;ED9CqB;ECgDrB,UAAA;EDhDqB;ECkDrB,WAAA;EDhDI;;;;;AASN;;;;;;;;;ECsDE,GAAA;EDjD2B;ECmD3B,UAAA,GAAa,cAAA;EDjDF;;;;;;AAMb;;;;;;;;;EC2DE,MAAA,IAAU,KAAA,EAAO,MAAA,EAAQ,OAAA,EAAS,aAAA,YAAyB,WAAA;AAAA;ADhD7D;;;AAAA,UCsDiB,cAAA,2BAAyC,WAAA,CAAY,MAAA;EDtDnC;ECwDjC,KAAA;AAAA;;;;UAMe,sBAAA,2BAAiD,WAAA,CAAY,MAAA;ED/ClD;ECiD1B,KAAA;EDhDoB;ECkDpB,oBAAA;AAAA;;;;KAMU,OAAA,qBAA4B,cAAA,CAAe,MAAA,IAAU,sBAAA,CAAuB,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;AD7BxF;;;KCgEK,eAAA,MAAqB,CAAA;EAAY,KAAA;AAAA,IAClC,CAAA;EAAY,oBAAA;AAAA,IACV,CAAA,iBAEc,CAAA,GAAI,CAAA,CAAE,CAAA;EAElB,WAAA;AAAA,IAEJ,CAAA;AAAA,iBAEY,GAAA,WAAc,CAAA,CAAE,OAAA,CAAA,CAAS,MAAA,EAAQ,CAAA,GAAI,CAAA;AAAA,iBACrC,GAAA,WAAc,CAAA,CAAE,OAAA,YAAmB,OAAA,CAAQ,CAAA,CAAE,MAAA,CAAO,CAAA,GAAA,CAClE,MAAA,EAAQ,CAAA,EACR,IAAA,EAAM,eAAA,CAAgB,CAAA,IACrB,CAAA"}
@@ -1,4 +1,3 @@
1
- import { n as CompletionMeta } from "./arg-registry-2m40k1Et.js";
2
1
  import { z } from "zod";
3
2
 
4
3
  //#region src/lazy.d.ts
@@ -58,6 +57,10 @@ declare function lazy<T extends AnyCommand>(meta: T, load: () => Promise<AnyComm
58
57
  * ```
59
58
  */
60
59
  interface GlobalArgs {}
60
+ /**
61
+ * Detect empty interface (used for GlobalArgs declaration merging)
62
+ */
63
+ type IsEmpty<T> = keyof T extends never ? true : false;
61
64
  /**
62
65
  * Example definition for a command
63
66
  */
@@ -99,6 +102,17 @@ interface CleanupContext<TArgs = unknown> {
99
102
  /** Error if command execution failed */
100
103
  error?: Error | undefined;
101
104
  }
105
+ /**
106
+ * Context provided to global setup function (runMain/runCommand level)
107
+ */
108
+ interface GlobalSetupContext {}
109
+ /**
110
+ * Context provided to global cleanup function (runMain/runCommand level)
111
+ */
112
+ interface GlobalCleanupContext {
113
+ /** Error if command execution failed */
114
+ error?: Error | undefined;
115
+ }
102
116
  /**
103
117
  * Base command interface (shared properties)
104
118
  * @template TArgsSchema - The Zod schema type for arguments
@@ -186,6 +200,10 @@ interface MainOptions {
186
200
  logger?: Logger;
187
201
  /** Global args schema (shared across all subcommands) */
188
202
  globalArgs?: ArgsSchema;
203
+ /** Global setup hook (runs before command execution) */
204
+ setup?: ((context: GlobalSetupContext) => void | Promise<void>) | undefined;
205
+ /** Global cleanup hook (runs after command execution, always executes even on error) */
206
+ cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
189
207
  }
190
208
  /**
191
209
  * Options for runCommand (programmatic/test usage)
@@ -201,6 +219,10 @@ interface RunCommandOptions {
201
219
  logger?: Logger;
202
220
  /** Global args schema (shared across all subcommands) */
203
221
  globalArgs?: ArgsSchema;
222
+ /** Global setup hook (runs before command execution) */
223
+ setup?: ((context: GlobalSetupContext) => void | Promise<void>) | undefined;
224
+ /** Global cleanup hook (runs after command execution, always executes even on error) */
225
+ cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
204
226
  }
205
227
  /**
206
228
  * Log level type
@@ -265,115 +287,173 @@ interface RunResultFailure {
265
287
  */
266
288
  type RunResult<T = unknown> = RunResultSuccess<T> | RunResultFailure;
267
289
  //#endregion
268
- //#region src/core/schema-extractor.d.ts
290
+ //#region src/core/arg-registry.d.ts
269
291
  /**
270
- * Resolved metadata for an argument field
292
+ * Built-in completion types
271
293
  */
272
- interface ResolvedFieldMeta {
273
- /** Field name (camelCase, as defined in schema) */
274
- name: string;
275
- /** CLI option name (kebab-case, for command line usage) */
276
- cliName: string;
277
- /** Short alias (e.g., 'v' for --verbose) */
278
- alias?: string | undefined;
294
+ type CompletionType = "file" | "directory" | "none";
295
+ /**
296
+ * Custom completion specification
297
+ */
298
+ interface CustomCompletion {
299
+ /** Static list of choices for completion */
300
+ choices?: string[];
301
+ /** Shell command to execute for dynamic completion */
302
+ shellCommand?: string;
303
+ }
304
+ /**
305
+ * Completion metadata for an argument
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * // File completion with extension filter
310
+ * input: arg(z.string(), {
311
+ * completion: { type: "file", extensions: ["json", "yaml"] }
312
+ * })
313
+ *
314
+ * // Directory completion
315
+ * outputDir: arg(z.string(), {
316
+ * completion: { type: "directory" }
317
+ * })
318
+ *
319
+ * // Custom static choices
320
+ * logLevel: arg(z.string(), {
321
+ * completion: { custom: { choices: ["debug", "info", "warn", "error"] } }
322
+ * })
323
+ *
324
+ * // Dynamic completion from shell command
325
+ * branch: arg(z.string(), {
326
+ * completion: { custom: { shellCommand: "git branch --format='%(refname:short)'" } }
327
+ * })
328
+ *
329
+ * // File completion with glob pattern matcher
330
+ * envFile: arg(z.string(), {
331
+ * completion: { type: "file", matcher: [".env.*"] }
332
+ * })
333
+ * ```
334
+ */
335
+ type CompletionMeta = {
336
+ /** Built-in completion type */type?: CompletionType; /** Custom completion (takes precedence over type if both specified) */
337
+ custom?: CustomCompletion;
338
+ } & ({
339
+ /** File extension filter (only applies when type is "file") */extensions?: string[];
340
+ matcher?: never;
341
+ } | {
342
+ /** Glob patterns for file matching (only applies when type is "file") */matcher?: string[];
343
+ extensions?: never;
344
+ });
345
+ /**
346
+ * Context provided to effect callbacks.
347
+ * When GlobalArgs is extended via declaration merging, `globalArgs` is typed accordingly.
348
+ */
349
+ type EffectContext = {
350
+ /** Field name (camelCase) */name: string; /** Validated args for this schema (global args for global effects, command args for command effects) */
351
+ args: Readonly<Record<string, unknown>>;
352
+ } & (IsEmpty<GlobalArgs> extends true ? {
353
+ globalArgs?: Readonly<Record<string, unknown>>;
354
+ } : {
355
+ globalArgs?: Readonly<GlobalArgs>;
356
+ });
357
+ /**
358
+ * Base metadata shared by all argument types
359
+ */
360
+ interface BaseArgMeta<TValue = unknown> {
279
361
  /** Argument description */
280
- description?: string | undefined;
281
- /** Whether this is a positional argument */
282
- positional: boolean;
362
+ description?: string;
363
+ /** Treat as positional argument */
364
+ positional?: boolean;
283
365
  /** Placeholder for help display */
284
- placeholder?: string | undefined;
366
+ placeholder?: string;
285
367
  /**
286
368
  * Environment variable name(s) to read value from.
287
- * If an array, earlier entries take priority.
369
+ * If an array is provided, earlier entries take priority.
370
+ * CLI arguments always take precedence over environment variables.
371
+ *
372
+ * @example
373
+ * ```ts
374
+ * // Single env var
375
+ * port: arg(z.coerce.number(), { env: "PORT" })
376
+ *
377
+ * // Multiple env vars (PORT takes priority over SERVER_PORT)
378
+ * port: arg(z.coerce.number(), { env: ["PORT", "SERVER_PORT"] })
379
+ * ```
288
380
  */
289
- env?: string | string[] | undefined;
290
- /** Whether this argument is required */
291
- required: boolean;
292
- /** Default value if any */
293
- defaultValue?: unknown;
294
- /** Detected type from schema */
295
- type: "string" | "number" | "boolean" | "array" | "unknown";
296
- /** Original Zod schema */
297
- schema: z.ZodType;
298
- /** True if this overrides built-in aliases (-h, -H) */
299
- overrideBuiltinAlias?: true;
300
- /** Enum values if detected from schema (z.enum) */
301
- enumValues?: string[] | undefined;
302
- /** Completion metadata from arg() */
303
- completion?: CompletionMeta | undefined;
304
- }
305
- /**
306
- * Extracted fields from a schema
307
- */
308
- interface ExtractedFields {
309
- /** All field definitions */
310
- fields: ResolvedFieldMeta[];
311
- /** Original schema for validation */
312
- schema: ArgsSchema;
313
- /** Schema type */
314
- schemaType: "object" | "discriminatedUnion" | "union" | "xor" | "intersection";
315
- /** Discriminator key (for discriminatedUnion) */
316
- discriminator?: string;
317
- /** Variants (for discriminatedUnion) */
318
- variants?: Array<{
319
- discriminatorValue: string;
320
- fields: ResolvedFieldMeta[];
321
- description?: string;
322
- }>;
323
- /** Options (for union) */
324
- unionOptions?: ExtractedFields[];
325
- /** Schema description */
326
- description?: string;
381
+ env?: string | string[];
382
+ /** Completion configuration for shell tab-completion */
383
+ completion?: CompletionMeta;
327
384
  /**
328
- * Unknown keys handling mode
329
- * - "strict": Unknown keys cause validation errors (z.strictObject or z.object().strict())
330
- * - "strip": Unknown keys trigger warnings (default, z.object())
331
- * - "passthrough": Unknown keys are silently ignored (z.looseObject or z.object().passthrough())
385
+ * Side-effect callback executed after argument parsing and validation.
386
+ * Runs before the command lifecycle (setup/run/cleanup).
387
+ * Use Zod .transform() for value transformation instead.
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * verbose: arg(z.boolean().default(false), {
392
+ * alias: "v",
393
+ * effect: (value) => {
394
+ * if (value) logger.setLevel("debug");
395
+ * },
396
+ * })
397
+ * ```
332
398
  */
333
- unknownKeysMode: UnknownKeysMode;
399
+ effect?: (value: TValue, context: EffectContext) => void | PromiseLike<void>;
334
400
  }
335
401
  /**
336
- * Unknown keys handling mode for object schemas
337
- * - "strict": Unknown keys cause validation errors
338
- * - "strip": Unknown keys are silently ignored (default)
339
- * - "passthrough": Unknown keys are passed through
402
+ * Metadata for regular arguments (non-builtin aliases)
340
403
  */
341
- type UnknownKeysMode = "strict" | "strip" | "passthrough";
404
+ interface RegularArgMeta<TValue = unknown> extends BaseArgMeta<TValue> {
405
+ /** Short alias (e.g., 'v' for --verbose) */
406
+ alias?: string;
407
+ }
342
408
  /**
343
- * Detect unknown keys handling mode from a Zod object schema
344
- *
345
- * In Zod v4:
346
- * - Default (strip): _def.catchall is undefined
347
- * - strict: _def.catchall is ZodNever (type = "never")
348
- * - passthrough: _def.catchall is ZodUnknown (type = "unknown")
409
+ * Metadata for overriding built-in aliases (-h, -H)
349
410
  */
350
- declare function getUnknownKeysMode(schema: z.ZodType): UnknownKeysMode;
411
+ interface BuiltinOverrideArgMeta<TValue = unknown> extends BaseArgMeta<TValue> {
412
+ /** Built-in alias to override ('h' or 'H') */
413
+ alias: "h" | "H";
414
+ /** Must be true to override built-in aliases */
415
+ overrideBuiltinAlias: true;
416
+ }
351
417
  /**
352
- * Convert camelCase to kebab-case
353
- * @example toKebabCase("dryRun") => "dry-run"
354
- * @example toKebabCase("outputDir") => "output-dir"
355
- * @example toKebabCase("XMLParser") => "xml-parser"
418
+ * Metadata options for argument definition
356
419
  */
357
- declare function toKebabCase(str: string): string;
420
+ type ArgMeta<TValue = unknown> = RegularArgMeta<TValue> | BuiltinOverrideArgMeta<TValue>;
358
421
  /**
359
- * Convert hyphen-separated sequences to camelCase.
422
+ * Register metadata for a Zod schema
360
423
  *
361
- * Replaces `-x` (hyphen followed by a lowercase letter) with the uppercase
362
- * variant. Non-hyphenated input (e.g., already camelCase) is returned as-is.
424
+ * @param schema - The Zod schema
425
+ * @param meta - Argument metadata
426
+ * @returns The same schema (for chaining)
427
+ *
428
+ * @example
429
+ * ```ts
430
+ * import { z } from "zod";
431
+ * import { arg, defineCommand } from "politty";
363
432
  *
364
- * @param str - A string that may contain hyphens
365
- * @example toCamelCase("dry-run") => "dryRun"
366
- * @example toCamelCase("output-dir") => "outputDir"
367
- * @example toCamelCase("dryRun") => "dryRun"
433
+ * const cmd = defineCommand({
434
+ * args: z.object({
435
+ * name: arg(z.string(), { description: "User name", positional: true }),
436
+ * verbose: arg(z.boolean().default(false), { alias: "v" }),
437
+ * }),
438
+ * run: (args) => {
439
+ * console.log(args.name, args.verbose);
440
+ * },
441
+ * });
442
+ * ```
368
443
  */
369
- declare function toCamelCase(str: string): string;
370
444
  /**
371
- * Extract all fields from a schema
372
- *
373
- * @param schema - The args schema (ZodObject, ZodDiscriminatedUnion, etc.)
374
- * @returns Extracted field information
445
+ * Type helper to validate ArgMeta
446
+ * Forces a type error if alias is "h" or "H" without overrideBuiltinAlias: true
375
447
  */
376
- declare function extractFields(schema: ArgsSchema): ExtractedFields;
448
+ type ValidateArgMeta<M> = M extends {
449
+ alias: "h" | "H";
450
+ } ? M extends {
451
+ overrideBuiltinAlias: true;
452
+ } ? M : { [K in keyof M]: M[K] } & {
453
+ __typeError: "Alias 'h' or 'H' requires overrideBuiltinAlias: true";
454
+ } : M;
455
+ declare function arg<T extends z.ZodType>(schema: T): T;
456
+ declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M>): T;
377
457
  //#endregion
378
- export { LazyCommand as A, RunResult as C, SetupContext as D, RunnableCommand as E, lazy as M, SubCommandValue as O, RunCommandOptions as S, RunResultSuccess as T, LogLevel as _, getUnknownKeysMode as a, MainOptions as b, AnyCommand as c, CollectedLogs as d, Command as f, LogEntry as g, GlobalArgs as h, extractFields as i, isLazyCommand as j, SubCommandsRecord as k, ArgsSchema as l, Example as m, ResolvedFieldMeta as n, toCamelCase as o, CommandBase as p, UnknownKeysMode as r, toKebabCase as s, ExtractedFields as t, CleanupContext as u, LogStream as v, RunResultFailure as w, NonRunnableCommand as x, Logger as y };
379
- //# sourceMappingURL=schema-extractor-C9APqeSL.d.ts.map
458
+ export { SubCommandValue as A, NonRunnableCommand as C, RunResultSuccess as D, RunResultFailure as E, LazyCommand as M, isLazyCommand as N, RunnableCommand as O, lazy as P, MainOptions as S, RunResult as T, IsEmpty as _, EffectContext as a, LogStream as b, ArgsSchema as c, Command as d, CommandBase as f, GlobalSetupContext as g, GlobalCleanupContext as h, CustomCompletion as i, SubCommandsRecord as j, SetupContext as k, CleanupContext as l, GlobalArgs as m, CompletionMeta as n, arg as o, Example as p, CompletionType as r, AnyCommand as s, ArgMeta as t, CollectedLogs as u, LogEntry as v, RunCommandOptions as w, Logger as x, LogLevel as y };
459
+ //# sourceMappingURL=arg-registry-CHmAzJOM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,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