@politty/zod 0.2.3 → 0.3.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 (50) hide show
  1. package/README.md +22 -1
  2. package/dist/{arg-registry-BzQ-y-e0.d.ts → arg-registry-DdEs3jd0.d.ts} +27 -2
  3. package/dist/augment.d.ts +3 -2
  4. package/dist/cli-main-DXoFbgu3.js +1 -0
  5. package/dist/{cli-main-DYdp1fLi.js → cli-main-q4kY1qaL.js} +2 -2
  6. package/dist/cli-run-HJaZHDXb.js +1 -0
  7. package/dist/cli.js +1 -1
  8. package/dist/command-tLHaJHe6.js +1 -0
  9. package/dist/compile-cache-6u9hgeWu.js +1 -0
  10. package/dist/compile-cache.d.ts +5 -6
  11. package/dist/compile-cache.js +1 -1
  12. package/dist/completion-CDwNvtfE.js +1 -0
  13. package/dist/{completion-D8DMrPqg.js → completion-DwBjO-3Q.js} +5 -5
  14. package/dist/completion.d.ts +29 -18
  15. package/dist/completion.js +1 -1
  16. package/dist/docs.d.ts +46 -46
  17. package/dist/docs.js +5 -5
  18. package/dist/dynamic-BBr42fJH.js +1 -0
  19. package/dist/dynamic-BK6Tq_FR.js +6 -0
  20. package/dist/field-meta-D7G8a7IG.js +1 -0
  21. package/dist/index.d.ts +280 -59
  22. package/dist/index.js +1 -1
  23. package/dist/logger-CoeDrmRr.js +1 -0
  24. package/dist/prompt-clack.d.ts +3 -4
  25. package/dist/prompt-clack.js +1 -1
  26. package/dist/prompt-inquirer.d.ts +3 -4
  27. package/dist/prompt-inquirer.js +1 -1
  28. package/dist/prompt.d.ts +7 -7
  29. package/dist/prompt.js +1 -1
  30. package/dist/{register-C1WbbeYH.js → register-D0mDOOyc.js} +1 -1
  31. package/dist/runner-FI1rpYp3.js +1 -0
  32. package/dist/runner-bjKUtqk1.js +29 -0
  33. package/dist/{schema-extractor-DU0Vuhbd.js → schema-extractor-QpSHJvwI.js} +1 -1
  34. package/dist/{schema-BiUP_KyV.js → schema-ohwvrBGz.js} +1 -1
  35. package/dist/skill.d.ts +13 -13
  36. package/dist/skill.js +1 -1
  37. package/dist/{with-completion-command-CmVdHFHX.d.ts → with-completion-command-Bi7v_Wlq.d.ts} +1 -1
  38. package/dist/{with-completion-command-DDohm8U6.js → with-completion-command-CZ9qcezN.js} +2 -2
  39. package/package.json +2 -2
  40. package/dist/cli-main-BzHcRGOO.js +0 -1
  41. package/dist/cli-run-BqCOn4Ag.js +0 -1
  42. package/dist/command-Mbdt0bmN.js +0 -1
  43. package/dist/compile-cache-VuUbFWIo.js +0 -1
  44. package/dist/completion-DUMcvXkT.js +0 -1
  45. package/dist/dynamic-CMtee4tD.js +0 -1
  46. package/dist/dynamic-CrnlveHj.js +0 -6
  47. package/dist/field-meta-COGya7xp.js +0 -1
  48. package/dist/logger-CJsyJ8sb.js +0 -1
  49. package/dist/runner-BBzVbri9.js +0 -29
  50. package/dist/runner-DFyBvEfq.js +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as toCamelCase, A as LogEntry, B as RunResultFailure, C as Command, D as GlobalCleanupContext, E as GlobalArgs, F as NonRunnableCommand, G as SubCommandsRecord, H as RunnableCommand, I as PromptResolver, J as isLazyCommand, K as UnknownSubcommandHandler, L as RunCommandOptions, M as LogStream, N as Logger, O as GlobalSetupContext, P as MainOptions, Q as UnknownKeysMode, R as RunInvocation, S as CollectedLogs, T as Example, U as SetupContext, V as RunResultSuccess, W as SubCommandValue, X as ExtractedFields, Y as lazy, Z as ResolvedFieldMeta, _ as DynamicCompletionResult, a as CustomCompletion, b as ArgsSchema$1, c as PromptType, d as ExpandCompletion, et as toKebabCase, f as ResolvedExpandCandidate, g as DynamicCompletionResolver, h as DynamicCompletionContext, i as CompletionType, j as LogLevel, k as IsEmpty, l as ValidateArgMeta, m as DynamicCompletionCandidate, n as ArgMeta, nt as SchemaLike, o as EffectContext, p as CompletionDirectiveMask, q as LazyCommand, r as CompletionMeta, s as PromptMeta, t as ArgFn, tt as InferSchemaOutput, u as ExpandCandidate, v as AnyCommand, w as CommandBase, x as CleanupContext, y as ArgSource, z as RunResult } from "./arg-registry-BzQ-y-e0.js";
2
- import { _ as CompletionResult, g as CompletionOptions, i as GenerateBundledCompletionWorkerResult, n as withCompletionCommand, r as GenerateBundledCompletionWorkerOptions, t as WithCompletionOptions, x as InternalArgsSchema } from "./with-completion-command-CmVdHFHX.js";
1
+ import { $ as toCamelCase, A as LogEntry, B as RunResultFailure, C as Command, D as GlobalCleanupContext, E as GlobalArgs, F as NonRunnableCommand, G as SubCommandsRecord, H as RunnableCommand, I as PromptResolver, J as isLazyCommand, K as UnknownSubcommandHandler, L as RunCommandOptions, M as LogStream, N as Logger, O as GlobalSetupContext, P as MainOptions, Q as UnknownKeysMode, R as RunInvocation, S as CollectedLogs, T as Example, U as SetupContext, V as RunResultSuccess, W as SubCommandValue, X as ExtractedFields, Y as lazy, Z as ResolvedFieldMeta, _ as DynamicCompletionResult, a as CustomCompletion, b as ArgsSchema$1, c as PromptType, d as ExpandCompletion, et as toKebabCase, f as ResolvedExpandCandidate, g as DynamicCompletionResolver, h as DynamicCompletionContext, i as CompletionType, j as LogLevel, k as IsEmpty, l as ValidateArgMeta, m as DynamicCompletionCandidate, n as ArgMeta, nt as SchemaLike, o as EffectContext, p as CompletionDirectiveMask, q as LazyCommand, r as CompletionMeta, s as PromptMeta, t as ArgFn, tt as InferSchemaOutput, u as ExpandCandidate, v as AnyCommand, w as CommandBase, x as CleanupContext, y as ArgSource, z as RunResult } from "./arg-registry-DdEs3jd0.js";
2
+ import { _ as CompletionResult, g as CompletionOptions, i as GenerateBundledCompletionWorkerResult, n as withCompletionCommand, r as GenerateBundledCompletionWorkerOptions, t as WithCompletionOptions, x as InternalArgsSchema } from "./with-completion-command-Bi7v_Wlq.js";
3
3
  import { z } from "zod";
4
4
  //#region ../core/src/core/schema-extractor.d.ts
5
5
  /**
@@ -7,14 +7,14 @@ import { z } from "zod";
7
7
  * schema politty itself attaches to a command (including internal
8
8
  * descriptor-based commands), not just user-provided library schemas.
9
9
  */
10
- declare function getUnknownKeysMode(schema: ArgsSchema$1): UnknownKeysMode;
10
+ export declare function getUnknownKeysMode(schema: ArgsSchema$1): UnknownKeysMode;
11
11
  /**
12
12
  * Extract all fields from a schema
13
13
  *
14
14
  * @param schema - The args schema (ZodObject, ZodDiscriminatedUnion, etc.)
15
15
  * @returns Extracted field information
16
16
  */
17
- declare function extractFields(schema: ArgsSchema$1): ExtractedFields;
17
+ export declare function extractFields(schema: ArgsSchema$1): ExtractedFields;
18
18
  //#endregion
19
19
  //#region ../core/src/adapter/types.d.ts
20
20
  /**
@@ -55,7 +55,7 @@ type ValidationResult<T> = {
55
55
  *
56
56
  * Never returns: it exits the process, like `runMain`.
57
57
  */
58
- declare function runPolittyCli(ownerPackage: string): Promise<never>;
58
+ export declare function runPolittyCli(ownerPackage: string): Promise<never>;
59
59
  //#endregion
60
60
  //#region ../core/src/compile-cache-shim.d.ts
61
61
  /**
@@ -155,7 +155,7 @@ interface GenerateCompileCacheShimResult {
155
155
  * a `bin` path still pointing at the real CLI entry fails loudly instead of
156
156
  * clobbering the build output.
157
157
  */
158
- declare function createCompileCacheShimGenerator(ownerPackage: string): (options?: GenerateCompileCacheShimOptions) => GenerateCompileCacheShimResult[];
158
+ export declare function createCompileCacheShimGenerator(ownerPackage: string): (options?: GenerateCompileCacheShimOptions) => GenerateCompileCacheShimResult[];
159
159
  //#endregion
160
160
  //#region ../core/src/core/case-types.d.ts
161
161
  /**
@@ -223,7 +223,7 @@ type WithCaseVariants<T> = T extends unknown ? T & { [K in keyof T as CamelCase<
223
223
  * - `Object.keys()`, `JSON.stringify()`, and spread return only the original keys.
224
224
  * - The `in` operator detects both case variants.
225
225
  */
226
- declare function createDualCaseProxy<T extends Record<string, unknown>>(obj: T): WithCaseVariants<T>;
226
+ export declare function createDualCaseProxy<T extends Record<string, unknown>>(obj: T): WithCaseVariants<T>;
227
227
  //#endregion
228
228
  //#region ../core/src/core/command.d.ts
229
229
  /**
@@ -266,18 +266,26 @@ type WithRunMeta<T> = T & {
266
266
  * Resolve merged args from schema and global args type
267
267
  */
268
268
  type ResolvedArgs<TArgsSchema, TGlobalArgs> = WithRunMeta<MergedArgs<InferArgs<TArgsSchema>, TGlobalArgs>>;
269
+ /**
270
+ * Resolve the set of subcommand keys usable by `defaultSubCommand`, given the
271
+ * `subCommands` type inferred from a `defineCommand` call's config literal.
272
+ * `never` when no `subCommands` were provided, so `defaultSubCommand` cannot
273
+ * be set on a command without any subcommands.
274
+ */
275
+ type DefaultSubCommandKey<TSubCommands> = TSubCommands extends SubCommandsRecord ? keyof TSubCommands & string : never;
269
276
  /**
270
277
  * Config for defining a command
271
278
  * @template TArgsSchema - The args schema type (from the CLI's schema library)
272
279
  * @template TResult - The return type of run function (void if no run)
273
280
  * @template TGlobalArgs - Global args type (from declaration merging or factory)
281
+ * @template TSubCommands - The `subCommands` record type (inferred from the config literal)
274
282
  */
275
- interface DefineCommandConfig<TArgsSchema extends ArgsSchema$1 | undefined, TResult, TGlobalArgs> {
283
+ interface DefineCommandConfig<TArgsSchema extends ArgsSchema$1 | undefined, TResult, TGlobalArgs, TSubCommands extends SubCommandsRecord | undefined = undefined> {
276
284
  name: string;
277
285
  description?: string;
278
286
  aliases?: string[];
279
287
  args?: TArgsSchema;
280
- subCommands?: SubCommandsRecord;
288
+ subCommands?: TSubCommands;
281
289
  setup?: (context: {
282
290
  args: ResolvedArgs<TArgsSchema, TGlobalArgs>;
283
291
  }) => void | Promise<void>;
@@ -298,8 +306,8 @@ interface DefineCommandConfig<TArgsSchema extends ArgsSchema$1 | undefined, TRes
298
306
  * level instead of failing at runtime in the registered adapter.
299
307
  */
300
308
  interface DefineCommandFn<TArgsBase extends ArgsSchema$1 = ArgsSchema$1> {
301
- <TArgsSchema extends TArgsBase | undefined = undefined, TResult = void, TGlobalArgs = GlobalArgs>(config: RunnableConfig<TArgsSchema, TResult, TGlobalArgs>): RunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>, TResult>;
302
- <TArgsSchema extends TArgsBase | undefined = undefined, TGlobalArgs = GlobalArgs>(config: NonRunnableConfig<TArgsSchema, TGlobalArgs>): NonRunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>>;
309
+ <TArgsSchema extends TArgsBase | undefined = undefined, TResult = void, TGlobalArgs = GlobalArgs, TSubCommands extends SubCommandsRecord | undefined = undefined>(config: RunnableConfig<TArgsSchema, TResult, TGlobalArgs, TSubCommands>): RunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>, TResult>;
310
+ <TArgsSchema extends TArgsBase | undefined = undefined, TGlobalArgs = GlobalArgs, TSubCommands extends SubCommandsRecord | undefined = undefined>(config: NonRunnableConfig<TArgsSchema, TGlobalArgs, TSubCommands>): NonRunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>>;
303
311
  }
304
312
  /**
305
313
  * `defineCommand` with a pre-bound global args type — the shape returned by
@@ -307,8 +315,8 @@ interface DefineCommandFn<TArgsBase extends ArgsSchema$1 = ArgsSchema$1> {
307
315
  * for the same adapter re-pinning as {@link DefineCommandFn}.
308
316
  */
309
317
  interface BoundDefineCommandFn<TGlobalArgs, TArgsBase extends ArgsSchema$1 = ArgsSchema$1> {
310
- <TArgsSchema extends TArgsBase | undefined = undefined, TResult = void>(config: RunnableConfig<TArgsSchema, TResult, TGlobalArgs>): RunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>, TResult>;
311
- <TArgsSchema extends TArgsBase | undefined = undefined>(config: NonRunnableConfig<TArgsSchema, TGlobalArgs>): NonRunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>>;
318
+ <TArgsSchema extends TArgsBase | undefined = undefined, TResult = void, TSubCommands extends SubCommandsRecord | undefined = undefined>(config: RunnableConfig<TArgsSchema, TResult, TGlobalArgs, TSubCommands>): RunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>, TResult>;
319
+ <TArgsSchema extends TArgsBase | undefined = undefined, TSubCommands extends SubCommandsRecord | undefined = undefined>(config: NonRunnableConfig<TArgsSchema, TGlobalArgs, TSubCommands>): NonRunnableCommand<TArgsSchema, ResolvedArgs<TArgsSchema, TGlobalArgs>>;
312
320
  }
313
321
  /**
314
322
  * The `createDefineCommand` signature, parameterized by the args-schema
@@ -320,14 +328,23 @@ interface CreateDefineCommandFn<TArgsBase extends ArgsSchema$1 = ArgsSchema$1> {
320
328
  /**
321
329
  * Config with run function (runnable command)
322
330
  */
323
- interface RunnableConfig<TArgsSchema extends ArgsSchema$1 | undefined, TResult, TGlobalArgs> extends DefineCommandConfig<TArgsSchema, TResult, TGlobalArgs> {
331
+ interface RunnableConfig<TArgsSchema extends ArgsSchema$1 | undefined, TResult, TGlobalArgs, TSubCommands extends SubCommandsRecord | undefined = undefined> extends DefineCommandConfig<TArgsSchema, TResult, TGlobalArgs, TSubCommands> {
324
332
  run: (args: ResolvedArgs<TArgsSchema, TGlobalArgs>) => TResult;
333
+ /** Not settable alongside `run` (see `NonRunnableConfig.defaultSubCommand`) */
334
+ defaultSubCommand?: undefined;
325
335
  }
326
336
  /**
327
337
  * Config without run function (non-runnable command)
328
338
  */
329
- interface NonRunnableConfig<TArgsSchema extends ArgsSchema$1 | undefined, TGlobalArgs> extends Omit<DefineCommandConfig<TArgsSchema, void, TGlobalArgs>, "run"> {
339
+ interface NonRunnableConfig<TArgsSchema extends ArgsSchema$1 | undefined, TGlobalArgs, TSubCommands extends SubCommandsRecord | undefined = undefined> extends Omit<DefineCommandConfig<TArgsSchema, void, TGlobalArgs, TSubCommands>, "run"> {
330
340
  run?: undefined;
341
+ /**
342
+ * Name of a `subCommands` entry to run when this command is invoked with
343
+ * no subcommand specified, instead of showing help. Must be a key of
344
+ * `subCommands` (checked at compile time). See
345
+ * `NonRunnableCommand.defaultSubCommand`.
346
+ */
347
+ defaultSubCommand?: DefaultSubCommandKey<TSubCommands> | undefined;
331
348
  }
332
349
  //#endregion
333
350
  //#region ../core/src/core/runner.d.ts
@@ -357,7 +374,7 @@ interface NonRunnableConfig<TArgsSchema extends ArgsSchema$1 | undefined, TGloba
357
374
  * expect(result.exitCode).toBe(0);
358
375
  * ```
359
376
  */
360
- declare function runCommand<TResult = unknown>(command: AnyCommand, argv: string[], options?: RunCommandOptions): Promise<RunResult<TResult>>;
377
+ export declare function runCommand<TResult = unknown>(command: AnyCommand, argv: string[], options?: RunCommandOptions): Promise<RunResult<TResult>>;
361
378
  /**
362
379
  * Run a CLI command as the main entry point
363
380
  *
@@ -386,7 +403,7 @@ declare function runCommand<TResult = unknown>(command: AnyCommand, argv: string
386
403
  * runMain(command, { version: "1.0.0" });
387
404
  * ```
388
405
  */
389
- declare function runMain(command: AnyCommand, options?: MainOptions): Promise<never>;
406
+ export declare function runMain(command: AnyCommand, options?: MainOptions): Promise<never>;
390
407
  //#endregion
391
408
  //#region ../core/src/output/help-generator.d.ts
392
409
  /**
@@ -397,6 +414,8 @@ interface BuiltinOptionDescriptions {
397
414
  help?: string;
398
415
  /** Description for --help-all option */
399
416
  helpAll?: string;
417
+ /** Description for --help-json option */
418
+ helpJson?: string;
400
419
  /** Description for --version option */
401
420
  version?: string;
402
421
  }
@@ -428,6 +447,166 @@ interface HelpOptions {
428
447
  /** Command hierarchy context */
429
448
  context?: CommandContext | undefined;
430
449
  }
450
+ /**
451
+ * Serializable representation of a single argument (positional or option),
452
+ * whitelisted from {@link ResolvedFieldMeta} down to JSON-safe fields.
453
+ * `schema`, `completion`, `prompt`, and `effect` are intentionally omitted:
454
+ * they carry library-specific schema objects and callbacks that cannot
455
+ * round-trip through JSON, and text help never surfaces them either.
456
+ */
457
+ interface HelpFieldData {
458
+ /** Field name (camelCase, as defined in the schema) */
459
+ name: string;
460
+ /** CLI option name (kebab-case) */
461
+ cliName: string;
462
+ /** Whether this is a positional argument */
463
+ positional: boolean;
464
+ /** Whether this argument is required */
465
+ required: boolean;
466
+ /** Detected type from schema */
467
+ type: "string" | "number" | "boolean" | "array" | "unknown";
468
+ /** Aliases for this option (short: 1 char, long: multi-char) */
469
+ alias?: string[] | undefined;
470
+ /** Argument description */
471
+ description?: string | undefined;
472
+ /** Placeholder shown in help */
473
+ placeholder?: string | undefined;
474
+ /** Environment variable name(s) to read value from */
475
+ env?: string | string[] | undefined;
476
+ /** Default value, if any */
477
+ defaultValue?: unknown;
478
+ /** Enum values, if detected from schema */
479
+ enumValues?: string[] | undefined;
480
+ /** Negation configuration (see {@link ResolvedFieldMeta.negation}) */
481
+ negation?: string | boolean | undefined;
482
+ /** Derived negation flag name (no `--` prefix), or undefined when hidden */
483
+ negationDisplay?: string | undefined;
484
+ /** Description shown for the negation option */
485
+ negationDescription?: string | undefined;
486
+ }
487
+ /**
488
+ * A named group of fields sharing a discriminated-union variant or a plain
489
+ * union option (see {@link ExtractedFields.variants} / `.unionOptions`).
490
+ */
491
+ interface HelpVariantData {
492
+ /** Discriminator value this variant matches (discriminated unions only) */
493
+ discriminatorValue?: string | undefined;
494
+ /** Variant/option description */
495
+ description?: string | undefined;
496
+ /**
497
+ * Fields unique to this variant/option (common fields are not repeated
498
+ * here). Positional fields unique to this variant/option are included too,
499
+ * duplicated from the flat top-level {@link HelpData.positionals}, so JSON
500
+ * consumers can attribute a positional to the variant/option it belongs to.
501
+ */
502
+ fields: HelpFieldData[];
503
+ }
504
+ /**
505
+ * Structured usage information, equivalent in content to {@link renderUsageLine}
506
+ * but free of ANSI styling and rendering order decisions, so JSON consumers
507
+ * can format it however they like.
508
+ */
509
+ interface HelpUsageData {
510
+ /** Command name as shown in usage (includes root name for subcommands) */
511
+ commandName: string;
512
+ /** Whether global options are defined */
513
+ hasGlobalOptions: boolean;
514
+ /** Whether this command defines any (non-positional) options */
515
+ hasOptions: boolean;
516
+ /**
517
+ * Whether a subcommand token is expected: "required" when the command has
518
+ * no `run` of its own, "optional" when it does. Undefined when the
519
+ * command has no (visible) subcommands.
520
+ */
521
+ subcommand?: "required" | "optional" | undefined;
522
+ /** Positional arguments in order */
523
+ positionals: Array<{
524
+ name: string;
525
+ required: boolean;
526
+ }>;
527
+ }
528
+ /**
529
+ * A subcommand entry in {@link HelpData.subcommands}.
530
+ */
531
+ interface HelpSubcommandData {
532
+ /** Subcommand name (key under `subCommands`) */
533
+ name: string;
534
+ /** Subcommand aliases */
535
+ aliases?: string[] | undefined;
536
+ /**
537
+ * Set when this subcommand is a legacy async factory (`() => Promise<Command>`)
538
+ * registered without {@link lazy}, so no synchronous metadata is available
539
+ * and `data` cannot be produced. `lazy()` subcommands are always resolved
540
+ * (their `meta` is synchronous) and never hit this case.
541
+ */
542
+ unresolved?: true | undefined;
543
+ /** Full structured help for this subcommand, recursively. Absent when `unresolved` is true. */
544
+ data?: HelpData | undefined;
545
+ }
546
+ /**
547
+ * Structured, JSON-serializable representation of a command's help.
548
+ * Produced by {@link generateHelpData}; the machine-readable counterpart of
549
+ * {@link generateHelp}'s formatted text.
550
+ */
551
+ interface HelpData {
552
+ /** Command name (command.name) */
553
+ name: string;
554
+ /**
555
+ * Full path from the root command. Empty at the true root; also empty
556
+ * when generateHelpData is called directly on a non-root command without
557
+ * a context.commandPath (there is no root to compute the path from).
558
+ */
559
+ commandPath: string[];
560
+ /**
561
+ * Root command name. Always set when produced through `runMain`/`runCommand`
562
+ * (equal to `name` itself at the root); `undefined` whenever
563
+ * `context.rootName` is not supplied to `generateHelpData` -- whether
564
+ * because no `context` was given at all, or because the given `context`
565
+ * simply omits `rootName`.
566
+ */
567
+ rootName?: string | undefined;
568
+ /** Root command version, when provided to runMain/runCommand */
569
+ version?: string | undefined;
570
+ /** Canonical subcommand name, set only when this command was reached via an alias */
571
+ aliasFor?: string | undefined;
572
+ /** Command description */
573
+ description?: string | undefined;
574
+ /** Command aliases (as a subcommand) */
575
+ aliases?: string[] | undefined;
576
+ /** Structured usage line */
577
+ usage: HelpUsageData;
578
+ /** Descriptions of the built-in --help/--help-all/--help-json/--version options */
579
+ builtinOptions: {
580
+ help: string;
581
+ helpAll: string;
582
+ helpJson: string;
583
+ version?: string | undefined;
584
+ };
585
+ /** Args schema shape: a plain object, or a union/discriminated-union of variants */
586
+ schemaType?: "object" | "discriminatedUnion" | "union" | "xor" | "intersection" | undefined;
587
+ /** Positional arguments */
588
+ positionals: HelpFieldData[];
589
+ /**
590
+ * Non-positional options. For `discriminatedUnion`/`union`/`xor` schemas,
591
+ * this holds only the fields common to every variant/option; the rest are
592
+ * under `variants`/`unionOptions`.
593
+ */
594
+ options: HelpFieldData[];
595
+ /** Discriminator field name (discriminatedUnion schemas only) */
596
+ discriminator?: string | undefined;
597
+ /** Per-variant fields (discriminatedUnion schemas only) */
598
+ variants?: HelpVariantData[] | undefined;
599
+ /** Per-option fields (union/xor schemas only) */
600
+ unionOptions?: HelpVariantData[] | undefined;
601
+ /** Global options shared across all commands, when a global args schema is defined */
602
+ globalOptions?: HelpFieldData[] | undefined;
603
+ /** Subcommands, recursively resolved */
604
+ subcommands?: HelpSubcommandData[] | undefined;
605
+ /** Example usages */
606
+ examples?: Example[] | undefined;
607
+ /** Additional notes (raw Markdown, unrendered) */
608
+ notes?: string | undefined;
609
+ }
431
610
  /**
432
611
  * Generate help text for a command
433
612
  *
@@ -435,21 +614,43 @@ interface HelpOptions {
435
614
  * @param options - Help generation options
436
615
  * @returns Formatted help text
437
616
  */
438
- declare function generateHelp(command: AnyCommand, options: HelpOptions): string;
617
+ export declare function generateHelp(command: AnyCommand, options: HelpOptions): string;
618
+ /**
619
+ * Options for {@link generateHelpData}
620
+ */
621
+ interface HelpDataOptions {
622
+ /** Custom descriptions for the --help/--help-all/--help-json/--version built-in options */
623
+ descriptions?: BuiltinOptionDescriptions | undefined;
624
+ /** Command hierarchy context */
625
+ context?: CommandContext | undefined;
626
+ }
627
+ /**
628
+ * Generate a structured, JSON-serializable representation of a command's help.
629
+ *
630
+ * The machine-readable counterpart of {@link generateHelp}: same underlying
631
+ * field metadata, but as plain data (no ANSI styling, no fixed layout) and
632
+ * always including the full recursive subcommand tree (there is no
633
+ * `--help`/`--help-all` depth distinction here).
634
+ *
635
+ * @param command - The command to generate help data for
636
+ * @param options - Help data generation options
637
+ * @returns Structured help data
638
+ */
639
+ export declare function generateHelpData(command: AnyCommand, options?: HelpDataOptions): HelpData;
439
640
  //#endregion
440
641
  //#region ../core/src/output/logger.d.ts
441
642
  /**
442
643
  * Enable or disable color output programmatically
443
644
  */
444
- declare function setColorEnabled(enabled: boolean): void;
645
+ export declare function setColorEnabled(enabled: boolean): void;
445
646
  /**
446
647
  * Check if color output is currently enabled
447
648
  */
448
- declare function isColorEnabled(): boolean;
649
+ export declare function isColorEnabled(): boolean;
449
650
  /**
450
651
  * Semantic style functions for inline text styling
451
652
  */
452
- declare const styles: {
653
+ export declare const styles: {
453
654
  success: (text: string) => string;
454
655
  error: (text: string) => string;
455
656
  warning: (text: string) => string;
@@ -480,7 +681,7 @@ declare const styles: {
480
681
  /**
481
682
  * Standardized symbols for CLI output
482
683
  */
483
- declare const symbols: {
684
+ export declare const symbols: {
484
685
  success: string;
485
686
  error: string;
486
687
  warning: string;
@@ -491,7 +692,7 @@ declare const symbols: {
491
692
  /**
492
693
  * Logger for CLI output
493
694
  */
494
- declare const logger: {
695
+ export declare const logger: {
495
696
  /**
496
697
  * Log informational message
497
698
  */
@@ -540,7 +741,7 @@ declare const logger: {
540
741
  * 3. Italic (*text* or _text_)
541
742
  * 4. Links [text](url)
542
743
  */
543
- declare function renderInline(text: string): string;
744
+ export declare function renderInline(text: string): string;
544
745
  /**
545
746
  * Render a Markdown string to styled terminal output.
546
747
  *
@@ -549,7 +750,7 @@ declare function renderInline(text: string): string;
549
750
  * - Detects headings, horizontal rules, blockquotes, lists, code blocks, and paragraphs
550
751
  * - Applies inline formatting within each block
551
752
  */
552
- declare function renderMarkdown(markdown: string): string;
753
+ export declare function renderMarkdown(markdown: string): string;
553
754
  //#endregion
554
755
  //#region ../core/src/parser/argv-parser.d.ts
555
756
  /**
@@ -614,43 +815,43 @@ interface ParserOptions {
614
815
  * @param options - Parser options
615
816
  * @returns Parsed arguments
616
817
  */
617
- declare function parseArgv(argv: string[], options?: ParserOptions): ParsedArgv;
818
+ export declare function parseArgv(argv: string[], options?: ParserOptions): ParsedArgv;
618
819
  //#endregion
619
820
  //#region ../core/src/validator/args-validator.d.ts
620
821
  /**
621
822
  * Format validation errors for display
622
823
  */
623
- declare function formatValidationErrors(errors: ValidationError[]): string;
824
+ export declare function formatValidationErrors(errors: ValidationError[]): string;
624
825
  //#endregion
625
826
  //#region ../core/src/validator/validation-errors.d.ts
626
827
  /**
627
828
  * Error thrown when positional argument configuration is invalid
628
829
  */
629
- declare class PositionalConfigError extends Error {
830
+ export declare class PositionalConfigError extends Error {
630
831
  constructor(message: string);
631
832
  }
632
833
  /**
633
834
  * Error thrown when a reserved alias is used
634
835
  */
635
- declare class ReservedAliasError extends Error {
836
+ export declare class ReservedAliasError extends Error {
636
837
  constructor(message: string);
637
838
  }
638
839
  /**
639
840
  * Error thrown when duplicate field names are detected
640
841
  */
641
- declare class DuplicateFieldError extends Error {
842
+ export declare class DuplicateFieldError extends Error {
642
843
  constructor(message: string);
643
844
  }
644
845
  /**
645
846
  * Error thrown when duplicate aliases are detected
646
847
  */
647
- declare class DuplicateAliasError extends Error {
848
+ export declare class DuplicateAliasError extends Error {
648
849
  constructor(message: string);
649
850
  }
650
851
  /**
651
852
  * Error thrown when fields are case variants of each other (e.g. "my-option" and "myOption")
652
853
  */
653
- declare class CaseVariantCollisionError extends Error {
854
+ export declare class CaseVariantCollisionError extends Error {
654
855
  constructor(message: string);
655
856
  }
656
857
  /**
@@ -658,14 +859,22 @@ declare class CaseVariantCollisionError extends Error {
658
859
  * field's name, cliName, alias, or another field's negation (including
659
860
  * derived camelCase variants).
660
861
  */
661
- declare class DuplicateNegationError extends Error {
862
+ export declare class DuplicateNegationError extends Error {
662
863
  constructor(message: string);
663
864
  }
664
865
  /**
665
866
  * Error thrown when a field name collides with a reserved, framework-injected
666
867
  * key on the final args object (e.g. `$source`).
667
868
  */
668
- declare class ReservedFieldNameError extends Error {
869
+ export declare class ReservedFieldNameError extends Error {
870
+ constructor(message: string);
871
+ }
872
+ /**
873
+ * Error thrown when a command's `defaultSubCommand` is misconfigured: set
874
+ * together with `run`, or pointing at a name that isn't a registered
875
+ * `subCommands` key.
876
+ */
877
+ export declare class DefaultSubCommandError extends Error {
669
878
  constructor(message: string);
670
879
  }
671
880
  /**
@@ -676,7 +885,7 @@ declare class ReservedFieldNameError extends Error {
676
885
  * is rejected at validation time rather than risking a value from one
677
886
  * schema silently flowing into the other.
678
887
  */
679
- declare class FieldTypeConflictError extends Error {
888
+ export declare class FieldTypeConflictError extends Error {
680
889
  constructor(message: string);
681
890
  }
682
891
  //#endregion
@@ -688,7 +897,7 @@ interface CommandValidationError {
688
897
  /** Path to the command (e.g., ["cli", "build", "watch"]) */
689
898
  commandPath: string[];
690
899
  /** Error type */
691
- type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "reserved_field_name" | "case_variant_collision" | "duplicate_negation" | "field_type_conflict" | "subcommand_key_name_mismatch";
900
+ type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "reserved_field_name" | "case_variant_collision" | "duplicate_negation" | "field_type_conflict" | "subcommand_key_name_mismatch" | "default_subcommand_conflict" | "default_subcommand_not_found";
692
901
  /** Error message */
693
902
  message: string;
694
903
  /** Related field name (if applicable) */
@@ -724,7 +933,7 @@ interface ValidateCommandOptions {
724
933
  * @param extracted - Extracted fields from schema
725
934
  * @throws {DuplicateFieldError} If duplicate field names are found
726
935
  */
727
- declare function validateDuplicateFields(extracted: ExtractedFields): void;
936
+ export declare function validateDuplicateFields(extracted: ExtractedFields): void;
728
937
  /**
729
938
  * Validate that no duplicate aliases exist
730
939
  *
@@ -733,7 +942,7 @@ declare function validateDuplicateFields(extracted: ExtractedFields): void;
733
942
  * @param extracted - Extracted fields from schema
734
943
  * @throws {DuplicateAliasError} If duplicate aliases are found or alias conflicts with field name
735
944
  */
736
- declare function validateDuplicateAliases(extracted: ExtractedFields): void;
945
+ export declare function validateDuplicateAliases(extracted: ExtractedFields): void;
737
946
  /**
738
947
  * Validate positional argument configuration
739
948
  *
@@ -746,21 +955,25 @@ declare function validateDuplicateAliases(extracted: ExtractedFields): void;
746
955
  * @param extracted - Extracted fields from schema
747
956
  * @throws {PositionalConfigError} If configuration is invalid
748
957
  */
749
- declare function validatePositionalConfig(extracted: ExtractedFields): void;
958
+ export declare function validatePositionalConfig(extracted: ExtractedFields): void;
750
959
  /**
751
- * Validate that no reserved aliases are used without explicit override
960
+ * Validate that no reserved names are used without explicit override
752
961
  *
753
- * Reserved aliases:
754
- * - 'h' is reserved for --help
755
- * - 'H' is reserved for --help-all
756
- *
757
- * Users can override these by setting overrideBuiltinAlias: true
962
+ * Reserved names:
963
+ * - 'h' is reserved for --help, 'H' for --help-all (short aliases). Users
964
+ * can override this by setting overrideBuiltinAlias: true on the field.
965
+ * - a field's `cliName` or any long alias matching `help`, `help-all`,
966
+ * `help-json`, or `version` collides with the matching built-in long
967
+ * flag. This has no override: `overrideBuiltinAlias: true` does not
968
+ * suppress it (see {@link checkReservedAliases}).
758
969
  *
759
970
  * @param extracted - Extracted fields from schema
760
971
  * @param _hasSubCommands - Whether the command has subcommands (reserved for future use)
761
- * @throws {ReservedAliasError} If a reserved alias is used without override flag
972
+ * @throws {ReservedAliasError} If `h`/`H` is used without `overrideBuiltinAlias: true`,
973
+ * or if a field's `cliName`/long alias collides with `help`/`help-all`/`help-json`/`version`
974
+ * (this second case is never suppressed by `overrideBuiltinAlias`)
762
975
  */
763
- declare function validateReservedAliases(extracted: ExtractedFields, _hasSubCommands: boolean): void;
976
+ export declare function validateReservedAliases(extracted: ExtractedFields, _hasSubCommands: boolean): void;
764
977
  /**
765
978
  * Validate that no field name starts with `$`
766
979
  *
@@ -776,21 +989,21 @@ declare function validateReservedAliases(extracted: ExtractedFields, _hasSubComm
776
989
  * @param extracted - Extracted fields from schema
777
990
  * @throws {ReservedFieldNameError} If a field name starts with "$"
778
991
  */
779
- declare function validateReservedFieldNames(extracted: ExtractedFields): void;
992
+ export declare function validateReservedFieldNames(extracted: ExtractedFields): void;
780
993
  /**
781
994
  * Validate that custom boolean negation names do not collide with anything
782
995
  *
783
996
  * @param extracted - Extracted fields from schema
784
997
  * @throws {DuplicateNegationError} If a colliding negation is found
785
998
  */
786
- declare function validateDuplicateNegations(extracted: ExtractedFields): void;
999
+ export declare function validateDuplicateNegations(extracted: ExtractedFields): void;
787
1000
  /**
788
1001
  * Validate that no case-variant collisions exist
789
1002
  *
790
1003
  * @param extracted - Extracted fields from schema
791
1004
  * @throws {CaseVariantCollisionError} If case-variant collisions are found
792
1005
  */
793
- declare function validateCaseVariantCollisions(extracted: ExtractedFields): void;
1006
+ export declare function validateCaseVariantCollisions(extracted: ExtractedFields): void;
794
1007
  /**
795
1008
  * Validate that no cross-schema collisions exist between two schemas
796
1009
  * (e.g., global args and command args): neither a case-variant collision
@@ -803,7 +1016,15 @@ declare function validateCaseVariantCollisions(extracted: ExtractedFields): void
803
1016
  * @throws {CaseVariantCollisionError} If cross-schema case-variant collisions are found
804
1017
  * @throws {FieldTypeConflictError} If a same-named field has a different definition on each schema
805
1018
  */
806
- declare function validateCrossSchemaCollisions(extractedA: ExtractedFields, extractedB: ExtractedFields): void;
1019
+ export declare function validateCrossSchemaCollisions(extractedA: ExtractedFields, extractedB: ExtractedFields): void;
1020
+ /**
1021
+ * Validate that a command's `defaultSubCommand` (if set) is not combined
1022
+ * with `run` and points at a registered `subCommands` key.
1023
+ *
1024
+ * @param command - The command to validate
1025
+ * @throws {DefaultSubCommandError} If the configuration is invalid
1026
+ */
1027
+ export declare function validateDefaultSubCommand(command: AnyCommand): void;
807
1028
  /**
808
1029
  * Validate a command and all its subcommands recursively
809
1030
  *
@@ -822,14 +1043,14 @@ declare function validateCrossSchemaCollisions(extractedA: ExtractedFields, extr
822
1043
  * }
823
1044
  * ```
824
1045
  */
825
- declare function validateCommand(command: AnyCommand, options?: ValidateCommandOptions): Promise<CommandValidationResult>;
1046
+ export declare function validateCommand(command: AnyCommand, options?: ValidateCommandOptions): Promise<CommandValidationResult>;
826
1047
  /**
827
1048
  * Format command validation errors for display
828
1049
  *
829
1050
  * @param errors - Array of validation errors
830
1051
  * @returns Formatted error message
831
1052
  */
832
- declare function formatCommandValidationErrors(errors: CommandValidationError[]): string;
1053
+ export declare function formatCommandValidationErrors(errors: CommandValidationError[]): string;
833
1054
  //#endregion
834
1055
  //#region src/index.d.ts
835
1056
  /**
@@ -840,15 +1061,15 @@ declare function formatCommandValidationErrors(errors: CommandValidationError[])
840
1061
  * the caller's `package.json`: reaching this function means `@politty/zod` is
841
1062
  * installed, so the shim it writes into your package can resolve it.
842
1063
  */
843
- declare const generateCompileCacheShim: (options?: GenerateCompileCacheShimOptions) => GenerateCompileCacheShimResult[];
1064
+ export declare const generateCompileCacheShim: (options?: GenerateCompileCacheShimOptions) => GenerateCompileCacheShimResult[];
844
1065
  /**
845
1066
  * Supported schema types for args in this package: zod schemas whose
846
1067
  * output is an object. Narrows `@politty/core`'s Standard-Schema-based
847
1068
  * `ArgsSchema` back to politty's historical zod-typed public surface.
848
1069
  */
849
- type ArgsSchema = z.ZodType<Record<string, any>>;
850
- declare const defineCommand: DefineCommandFn<ArgsSchema>;
851
- declare const createDefineCommand: CreateDefineCommandFn<ArgsSchema>;
852
- declare const arg: ArgFn<z.ZodType>;
1070
+ export type ArgsSchema = z.ZodType<Record<string, any>>;
1071
+ export declare const defineCommand: DefineCommandFn<ArgsSchema>;
1072
+ export declare const createDefineCommand: CreateDefineCommandFn<ArgsSchema>;
1073
+ export declare const arg: ArgFn<z.ZodType>;
853
1074
  //#endregion
854
- export { type AnyCommand, type ArgFn, type ArgMeta, type ArgSource, ArgsSchema, type BoundDefineCommandFn, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionDirectiveMask, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CreateDefineCommandFn, type CustomCompletion, type DefineCommandFn, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, type DynamicCompletionCandidate, type DynamicCompletionContext, type DynamicCompletionResolver, type DynamicCompletionResult, type EffectContext, type Example, type ExpandCandidate, type ExpandCompletion, type ExtractedFields, FieldTypeConflictError, type GenerateBundledCompletionWorkerOptions, type GenerateBundledCompletionWorkerResult, type GenerateCompileCacheShimOptions, type GenerateCompileCacheShimResult, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type InferSchemaOutput, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, ReservedFieldNameError, type ResolvedExpandCandidate, type ResolvedFieldMeta, type RunCommandOptions, type RunInvocation, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SchemaLike, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type UnknownSubcommandHandler, type ValidateArgMeta, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createCompileCacheShimGenerator, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompileCacheShim, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, runPolittyCli, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, validateReservedFieldNames, withCompletionCommand };
1075
+ export { type AnyCommand, type ArgFn, type ArgMeta, type ArgSource, type BoundDefineCommandFn, type BuiltinOptionDescriptions, type CamelCase, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionDirectiveMask, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CreateDefineCommandFn, type CustomCompletion, type DefineCommandFn, type DynamicCompletionCandidate, type DynamicCompletionContext, type DynamicCompletionResolver, type DynamicCompletionResult, type EffectContext, type Example, type ExpandCandidate, type ExpandCompletion, type ExtractedFields, type GenerateBundledCompletionWorkerOptions, type GenerateBundledCompletionWorkerResult, type GenerateCompileCacheShimOptions, type GenerateCompileCacheShimResult, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpData, type HelpDataOptions, type HelpFieldData, type HelpOptions, type HelpSubcommandData, type HelpUsageData, type HelpVariantData, type InferSchemaOutput, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, type PromptMeta, type PromptResolver, type PromptType, type ResolvedExpandCandidate, type ResolvedFieldMeta, type RunCommandOptions, type RunInvocation, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SchemaLike, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type UnknownSubcommandHandler, type ValidateArgMeta, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, isLazyCommand, lazy, toCamelCase, toKebabCase, withCompletionCommand };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{i as e,r as t}from"./field-meta-COGya7xp.js";import{t as n}from"./register-C1WbbeYH.js";import{r,t as i}from"./schema-extractor-DU0Vuhbd.js";import{n as a,t as o}from"./cli-main-DYdp1fLi.js";import{n as s,t as c}from"./command-Mbdt0bmN.js";import{C as l,E as u,S as d,T as f,_ as p,a as m,b as h,c as g,d as _,f as v,g as y,h as b,i as x,l as S,m as C,n as w,o as T,p as E,r as D,s as O,t as k,u as A,v as j,w as M,x as N,y as P}from"./runner-BBzVbri9.js";import{o as F,s as I}from"./subcommand-router-D8GTMXYL.js";import{a as L,i as R,n as z,r as B,t as V}from"./logger-CJsyJ8sb.js";import{t as H}from"./with-completion-command-DDohm8U6.js";const U=a(`@politty/zod`),W=s,G=c,K=n;export{y as CaseVariantCollisionError,p as DuplicateAliasError,j as DuplicateFieldError,P as DuplicateNegationError,h as FieldTypeConflictError,N as PositionalConfigError,d as ReservedAliasError,l as ReservedFieldNameError,K as arg,a as createCompileCacheShimGenerator,G as createDefineCommand,D as createDualCaseProxy,W as defineCommand,i as extractFields,T as formatCommandValidationErrors,x as formatValidationErrors,U as generateCompileCacheShim,M as generateHelp,r as getUnknownKeysMode,V as isColorEnabled,F as isLazyCommand,I as lazy,z as logger,m as parseArgv,f as renderInline,u as renderMarkdown,k as runCommand,w as runMain,o as runPolittyCli,B as setColorEnabled,R as styles,L as symbols,t as toCamelCase,e as toKebabCase,O as validateCaseVariantCollisions,g as validateCommand,S as validateCrossSchemaCollisions,A as validateDuplicateAliases,_ as validateDuplicateFields,v as validateDuplicateNegations,E as validatePositionalConfig,C as validateReservedAliases,b as validateReservedFieldNames,H as withCompletionCommand};
1
+ import{a as e,i as t}from"./field-meta-D7G8a7IG.js";import{t as n}from"./register-D0mDOOyc.js";import{r,t as i}from"./schema-extractor-QpSHJvwI.js";import{n as a,t as o}from"./cli-main-q4kY1qaL.js";import{n as s,t as c}from"./command-tLHaJHe6.js";import{C as l,D as u,E as d,O as f,S as p,T as m,_ as h,a as g,b as _,c as v,d as y,f as b,g as x,h as S,i as C,k as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N,v as P,w as F,x as I,y as L}from"./runner-bjKUtqk1.js";import{o as R,s as z}from"./subcommand-router-D8GTMXYL.js";import{a as B,i as V,n as H,r as U,t as W}from"./logger-CoeDrmRr.js";import{t as G}from"./with-completion-command-CZ9qcezN.js";const K=a(`@politty/zod`),q=s,J=c,Y=n;export{h as CaseVariantCollisionError,P as DefaultSubCommandError,L as DuplicateAliasError,_ as DuplicateFieldError,I as DuplicateNegationError,p as FieldTypeConflictError,l as PositionalConfigError,F as ReservedAliasError,m as ReservedFieldNameError,Y as arg,a as createCompileCacheShimGenerator,J as createDefineCommand,A as createDualCaseProxy,q as defineCommand,i as extractFields,O as formatCommandValidationErrors,C as formatValidationErrors,K as generateCompileCacheShim,d as generateHelp,u as generateHelpData,r as getUnknownKeysMode,W as isColorEnabled,R as isLazyCommand,z as lazy,H as logger,g as parseArgv,f as renderInline,w as renderMarkdown,M as runCommand,D as runMain,o as runPolittyCli,U as setColorEnabled,V as styles,B as symbols,t as toCamelCase,e as toKebabCase,j as validateCaseVariantCollisions,v as validateCommand,T as validateCrossSchemaCollisions,N as validateDefaultSubCommand,y as validateDuplicateAliases,b as validateDuplicateFields,k as validateDuplicateNegations,E as validatePositionalConfig,S as validateReservedAliases,x as validateReservedFieldNames,G as withCompletionCommand};
@@ -0,0 +1 @@
1
+ import{styleText as e}from"node:util";function t(){return process.env.NO_COLOR!==void 0||process.env.FORCE_COLOR===`0`||!process.env.FORCE_COLOR&&!(!process.env.CI&&process.stdout.isTTY)}let n=t();function r(e){n=!e}function i(){return!n}function a(...t){return r=>{if(n)return r;let i=r;for(let n of t)i=e(n,i);return i}}const o={success:a(`green`),error:a(`red`),warning:a(`yellow`),info:a(`cyan`),bold:a(`bold`),dim:a(`dim`),italic:a(`italic`),underline:a(`underline`),red:a(`red`),green:a(`green`),yellow:a(`yellow`),blue:a(`blue`),magenta:a(`magenta`),cyan:a(`cyan`),white:a(`white`),gray:a(`gray`),command:a(`bold`),commandName:a(`bold`,`underline`,`cyan`),option:a(`cyan`),optionName:a(`bold`),placeholder:a(`dim`),defaultValue:a(`dim`),required:a(`yellow`),description:e=>e,sectionHeader:a(`bold`,`underline`),version:a(`dim`)},s={success:o.green(`✓`),error:o.red(`✖`),warning:o.yellow(`⚠`),info:o.cyan(`ℹ`),bullet:o.gray(`•`),arrow:o.gray(`→`)},c={info(e){console.log(e)},success(e){console.log(`${s.success} ${o.success(e)}`)},warn(e){console.warn(`${s.warning} ${o.warning(e)}`)},error(e){console.error(`${s.error} ${o.error(e)}`)},log(e){console.log(e)},newline(){console.log(``)},debug(e){console.log(o.dim(e))}};export{s as a,o as i,c as n,r,i as t};