politty 0.11.2 → 0.11.5

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.
@@ -1,6 +1,5 @@
1
- import { S as Command, Y as ResolvedFieldMeta, _ as AnyCommand, d as ResolvedExpandCandidate, h as DynamicCompletionResolver, u as ExpandCompletion, y as ArgsSchema } from "./arg-registry-D558cYkD.js";
1
+ import { S as Command, Y as ResolvedFieldMeta, _ as AnyCommand, d as ResolvedExpandCandidate, h as DynamicCompletionResolver, u as ExpandCompletion, y as ArgsSchema } from "./arg-registry-SrNIsq-d.js";
2
2
  import { z } from "zod";
3
-
4
3
  //#region src/completion/types.d.ts
5
4
  /**
6
5
  * A single resolved entry in an "expand" lookup table.
@@ -99,8 +98,11 @@ interface CompletionOptions {
99
98
  * without narrowing first.
100
99
  */
101
100
  type ValueCompletion = ({
102
- /** Completion type */type: "choices" | "file" | "directory" | "command" | "none"; /** List of valid choices (for "choices" type) */
103
- choices?: string[]; /** Shell command for dynamic completion (for "command" type) */
101
+ /** Completion type */
102
+ type: "choices" | "file" | "directory" | "command" | "none";
103
+ /** List of valid choices (for "choices" type) */
104
+ choices?: string[];
105
+ /** Shell command for dynamic completion (for "command" type) */
104
106
  shellCommand?: string;
105
107
  resolve?: never;
106
108
  dependsOn?: never;
@@ -109,10 +111,11 @@ type ValueCompletion = ({
109
111
  extensions?: string[];
110
112
  matcher?: never;
111
113
  } | {
112
- /** Glob patterns for file matching (for "file" type) */matcher?: string[];
114
+ /** Glob patterns for file matching (for "file" type) */ matcher?: string[];
113
115
  extensions?: never;
114
116
  })) | {
115
- /** In-process dynamic completion via JS callback. */type: "dynamic";
117
+ /** In-process dynamic completion via JS callback. */
118
+ type: "dynamic";
116
119
  resolve: DynamicCompletionResolver;
117
120
  choices?: never;
118
121
  shellCommand?: never;
@@ -329,13 +332,21 @@ declare function parseCompletionContext(argv: string[], rootCommand: AnyCommand,
329
332
  * Completion directive flags (bitwise)
330
333
  */
331
334
  declare const CompletionDirective: {
332
- /** Default completion behavior */readonly Default: 0; /** Don't add space after completion */
333
- readonly NoSpace: 1; /** Don't offer file completion (even if no other completions) */
334
- readonly NoFileCompletion: 2; /** Filter completions using current word as prefix */
335
- readonly FilterPrefix: 4; /** Keep the order of completions */
336
- readonly KeepOrder: 8; /** Trigger file completion */
337
- readonly FileCompletion: 16; /** Trigger directory completion */
338
- readonly DirectoryCompletion: 32; /** Error occurred during completion */
335
+ /** Default completion behavior */
336
+ readonly Default: 0;
337
+ /** Don't add space after completion */
338
+ readonly NoSpace: 1;
339
+ /** Don't offer file completion (even if no other completions) */
340
+ readonly NoFileCompletion: 2;
341
+ /** Filter completions using current word as prefix */
342
+ readonly FilterPrefix: 4;
343
+ /** Keep the order of completions */
344
+ readonly KeepOrder: 8;
345
+ /** Trigger file completion */
346
+ readonly FileCompletion: 16;
347
+ /** Trigger directory completion */
348
+ readonly DirectoryCompletion: 32;
349
+ /** Error occurred during completion */
339
350
  readonly Error: 64;
340
351
  };
341
352
  /**
@@ -392,8 +403,8 @@ declare function generateCandidates(context: CompletionContext, options: Generat
392
403
  declare const completeArgsSchema: z.ZodObject<{
393
404
  shell: z.ZodEnum<{
394
405
  bash: "bash";
395
- zsh: "zsh";
396
406
  fish: "fish";
407
+ zsh: "zsh";
397
408
  }>;
398
409
  args: z.ZodDefault<z.ZodArray<z.ZodString>>;
399
410
  }, z.core.$strip>;
@@ -551,8 +562,8 @@ declare function detectShell(): ShellType | null;
551
562
  declare const completionArgsSchema: z.ZodObject<{
552
563
  shell: z.ZodOptional<z.ZodEnum<{
553
564
  bash: "bash";
554
- zsh: "zsh";
555
565
  fish: "fish";
566
+ zsh: "zsh";
556
567
  }>>;
557
568
  instructions: z.ZodDefault<z.ZodBoolean>;
558
569
  loader: z.ZodDefault<z.ZodBoolean>;
@@ -565,8 +576,8 @@ type CompletionArgs = z.infer<typeof completionArgsSchema>;
565
576
  declare const refreshArgsSchema: z.ZodObject<{
566
577
  shell: z.ZodEnum<{
567
578
  bash: "bash";
568
- zsh: "zsh";
569
579
  fish: "fish";
580
+ zsh: "zsh";
570
581
  }>;
571
582
  target: z.ZodOptional<z.ZodString>;
572
583
  static: z.ZodDefault<z.ZodBoolean>;
@@ -576,8 +587,8 @@ type RefreshArgs = z.infer<typeof refreshArgsSchema>;
576
587
  declare const workerPathArgsSchema: z.ZodObject<{
577
588
  shell: z.ZodEnum<{
578
589
  bash: "bash";
579
- zsh: "zsh";
580
590
  fish: "fish";
591
+ zsh: "zsh";
581
592
  }>;
582
593
  }, z.core.$strip>;
583
594
  type WorkerPathArgs = z.infer<typeof workerPathArgsSchema>;
@@ -659,4 +670,4 @@ interface WithCompletionOptions {
659
670
  declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
660
671
  //#endregion
661
672
  export { BundledWorkerOptions as A, CandidateResult as C, CompletionContext as D, generateCandidates as E, CompletionMode as F, CompletionOptions as I, CompletionResult as L, CompletableSubcommand as M, CompletionData as N, CompletionType as O, CompletionGenerator as P, ShellType as R, hasCompleteCommand as S, CompletionDirective as T, extractCompletionData as _, detectShell as a, formatForShell as b, withCompletionCommand as c, GenerateBundledCompletionWorkerOptions as d, GenerateBundledCompletionWorkerResult as f, validateBundledWorkerFile as g, generateBundledCompletionWorker as h, createRefreshCompletionCommand as i, CompletableOption as j, parseCompletionContext as k, ValueCompletionField as l, defaultBundledWorkerOutputPath as m, createCompletionCommand as n, generateCompletion as o, bundledWorkerShellExtension as p, createCompletionWorkerPathCommand as r, getSupportedShells as s, WithCompletionOptions as t, resolveValueCompletion as u, extractPositionals as v, CompletionCandidate as w, createDynamicCompleteCommand as x, ShellFormatOptions as y };
662
- //# sourceMappingURL=index-CeZ1yI46.d.ts.map
673
+ //# sourceMappingURL=index-qqwo5WZT.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,7 +1,78 @@
1
- import { $ as toCamelCase, A as LogLevel, B as RunnableCommand, C as CommandBase, D as GlobalSetupContext, E as GlobalCleanupContext, F as PromptResolver, G as LazyCommand, H as SubCommandValue, I as RunCommandOptions, J as ExtractedFields, K as isLazyCommand, L as RunResult, M as Logger, N as MainOptions, O as IsEmpty, P as NonRunnableCommand, Q as getUnknownKeysMode, R as RunResultFailure, S as Command, T as GlobalArgs, U as SubCommandsRecord, V as SetupContext, W as UnknownSubcommandHandler, X as UnknownKeysMode, Y as ResolvedFieldMeta, Z as extractFields, _ as AnyCommand, a as EffectContext, b as CleanupContext, c as arg, d as ResolvedExpandCandidate, et as toKebabCase, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as LogStream, k as LogEntry, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as lazy, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgSource, w as Example, x as CollectedLogs, y as ArgsSchema, z as RunResultSuccess } from "./arg-registry-D558cYkD.js";
2
- import { I as CompletionOptions, L as CompletionResult, c as withCompletionCommand, d as GenerateBundledCompletionWorkerOptions, f as GenerateBundledCompletionWorkerResult, h as generateBundledCompletionWorker, o as generateCompletion, t as WithCompletionOptions } from "./index-CeZ1yI46.js";
1
+ import { $ as toCamelCase, A as LogLevel, B as RunnableCommand, C as CommandBase, D as GlobalSetupContext, E as GlobalCleanupContext, F as PromptResolver, G as LazyCommand, H as SubCommandValue, I as RunCommandOptions, J as ExtractedFields, K as isLazyCommand, L as RunResult, M as Logger, N as MainOptions, O as IsEmpty, P as NonRunnableCommand, Q as getUnknownKeysMode, R as RunResultFailure, S as Command, T as GlobalArgs, U as SubCommandsRecord, V as SetupContext, W as UnknownSubcommandHandler, X as UnknownKeysMode, Y as ResolvedFieldMeta, Z as extractFields, _ as AnyCommand, a as EffectContext, b as CleanupContext, c as arg, d as ResolvedExpandCandidate, et as toKebabCase, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as LogStream, k as LogEntry, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as lazy, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgSource, w as Example, x as CollectedLogs, y as ArgsSchema, z as RunResultSuccess } from "./arg-registry-SrNIsq-d.js";
2
+ import { I as CompletionOptions, L as CompletionResult, c as withCompletionCommand, d as GenerateBundledCompletionWorkerOptions, f as GenerateBundledCompletionWorkerResult, h as generateBundledCompletionWorker, o as generateCompletion, t as WithCompletionOptions } from "./index-qqwo5WZT.js";
3
3
  import { z } from "zod";
4
-
4
+ //#region src/compile-cache-shim.d.ts
5
+ /**
6
+ * Generator for compile-cache bin shims.
7
+ *
8
+ * Emits the minimal entry file described in docs/recipes.md ("Faster
9
+ * Startup"): a shim that enables the Node.js on-disk compile cache via
10
+ * `politty/compile-cache` and then loads the real CLI with a dynamic
11
+ * import. Meant to be wired into a `postbuild` or `prepack` script via
12
+ * `politty generate-shim` so the shim never has to live in source.
13
+ */
14
+ /**
15
+ * Options for {@link generateCompileCacheShim}.
16
+ */
17
+ interface GenerateCompileCacheShimOptions {
18
+ /**
19
+ * Module specifier(s) the shim imports to start the CLI, relative to the
20
+ * generated shim file (e.g. `./cli.js`). Pass one per shim; when `out` is
21
+ * omitted the count must match the package's `bin` entries (paired in
22
+ * order). Defaults to the first of `./cli.js`, `./cli.mjs`, `./index.js`,
23
+ * `./index.mjs` that exists next to each shim.
24
+ */
25
+ entry?: string | string[];
26
+ /**
27
+ * Output path(s) for the generated shim(s) (e.g. `dist/bin.js`). When
28
+ * given, the count must match `entry` (paired in order). Defaults to all
29
+ * `bin` paths in the nearest `package.json` — the places the executables
30
+ * must live.
31
+ */
32
+ out?: string | string[];
33
+ /**
34
+ * Program name used to derive the cache directory, applied to every
35
+ * generated shim. Defaults per shim to the `bin` name whose path is the
36
+ * shim's output, falling back to the first `bin` name and then the
37
+ * package name without its scope. The fallback never happens silently: a
38
+ * warning is printed when an explicit `out` path cannot be matched to a
39
+ * `bin` entry.
40
+ */
41
+ program?: string;
42
+ /**
43
+ * Base directory for resolving paths and locating the nearest
44
+ * `package.json` (default: `process.cwd()`).
45
+ */
46
+ cwd?: string;
47
+ }
48
+ /**
49
+ * One generated shim from {@link generateCompileCacheShim}.
50
+ */
51
+ interface GenerateCompileCacheShimResult {
52
+ /** Absolute path of the generated shim. */
53
+ outputPath: string;
54
+ /** Program name baked into the shim. */
55
+ program: string;
56
+ /** Entry specifier baked into the shim. */
57
+ entry: string;
58
+ }
59
+ /**
60
+ * Generate executable compile-cache bin shims.
61
+ *
62
+ * With no explicit paths, one shim is generated per `bin` entry of the
63
+ * nearest `package.json`, each importing a conventional built module next
64
+ * to it — so a bare `politty generate-shim` in a `postbuild` script is
65
+ * usually enough. Explicit `entry` values are paired in order with the
66
+ * `bin` entries (or with explicit `out` values of the same count).
67
+ *
68
+ * The generated files are ESM (they use top-level `await import`), so `.js`
69
+ * output requires `"type": "module"` in the package; use a `.mjs` extension
70
+ * otherwise. Refuses to overwrite an existing file it did not generate, so
71
+ * a `bin` path still pointing at the real CLI entry fails loudly instead of
72
+ * clobbering the build output.
73
+ */
74
+ declare function generateCompileCacheShim(options?: GenerateCompileCacheShimOptions): GenerateCompileCacheShimResult[];
75
+ //#endregion
5
76
  //#region src/core/case-types.d.ts
6
77
  /**
7
78
  * TypeScript utility types for case conversion between camelCase and kebab-case.
@@ -56,7 +127,7 @@ type KebabCase<S extends string> = StripLeadingHyphen<KebabCaseInner<S>>;
56
127
  * Keys that are identical in both cases (e.g. single-word keys) are not duplicated.
57
128
  * Uses a distributive conditional type so it works correctly with discriminated unions.
58
129
  */
59
- type WithCaseVariants<T> = T extends unknown ? T & { [K in keyof T as CamelCase<K & string>]: T[K] } & { [K in keyof T as KebabCase<K & string>]: T[K] } : never;
130
+ type WithCaseVariants<T> = T extends unknown ? T & { [K in keyof T as CamelCase<K & string>]: T[K]; } & { [K in keyof T as KebabCase<K & string>]: T[K]; } : never;
60
131
  //#endregion
61
132
  //#region src/core/case-proxy.d.ts
62
133
  /**
@@ -743,5 +814,5 @@ type ValidationResult<T> = {
743
814
  */
744
815
  declare function formatValidationErrors(errors: ValidationError[]): string;
745
816
  //#endregion
746
- export { type AnyCommand, type ArgMeta, type ArgSource, type ArgsSchema, 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 CustomCompletion, 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 GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, 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 RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type UnknownSubcommandHandler, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateBundledCompletionWorker, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, validateReservedFieldNames, withCompletionCommand };
817
+ export { type AnyCommand, type ArgMeta, type ArgSource, type ArgsSchema, 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 CustomCompletion, 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 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 RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type UnknownSubcommandHandler, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateBundledCompletionWorker, generateCompileCacheShim, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, validateReservedFieldNames, withCompletionCommand };
747
818
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { C as ReservedFieldNameError, D as createDualCaseProxy, E as renderMarkdown, S as ReservedAliasError, T as renderInline, _ as DuplicateAliasError, a as parseArgv, b as FieldTypeConflictError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as CaseVariantCollisionError, h as validateReservedFieldNames, i as formatValidationErrors, l as validateCrossSchemaCollisions, m as validateReservedAliases, n as runMain, o as formatCommandValidationErrors, p as validatePositionalConfig, s as validateCaseVariantCollisions, t as runCommand, u as validateDuplicateAliases, v as DuplicateFieldError, w as generateHelp, x as PositionalConfigError, y as DuplicateNegationError } from "./runner-CEDtiI7D.js";
1
+ import { n as generateCompileCacheShim } from "./src-BiCtSNrn.js";
2
2
  import { a as toCamelCase, i as getUnknownKeysMode, o as toKebabCase, s as arg, t as extractFields } from "./schema-extractor-wzJ1cGon.js";
3
3
  import { n as defineCommand, t as createDefineCommand } from "./command-B4yA4LXX.js";
4
4
  import { o as isLazyCommand, s as lazy } from "./subcommand-router-CTzHPGzF.js";
5
- import { a as generateCompletion, p as generateBundledCompletionWorker, s as withCompletionCommand } from "./completion-B1K87cU5.js";
5
+ import { a as generateCompletion, p as generateBundledCompletionWorker, s as withCompletionCommand } from "./completion-D9SKGJad.js";
6
+ import { C as generateHelp, E as createDualCaseProxy, S as ReservedFieldNameError, T as renderMarkdown, _ as DuplicateFieldError, a as formatCommandValidationErrors, b as PositionalConfigError, c as validateCrossSchemaCollisions, d as validateDuplicateNegations, f as validatePositionalConfig, g as DuplicateAliasError, h as CaseVariantCollisionError, i as parseArgv, l as validateDuplicateAliases, m as validateReservedFieldNames, n as runMain, o as validateCaseVariantCollisions, p as validateReservedAliases, r as formatValidationErrors, s as validateCommand, t as runCommand, u as validateDuplicateFields, v as DuplicateNegationError, w as renderInline, x as ReservedAliasError, y as FieldTypeConflictError } from "./runner-xN7248Ph.js";
6
7
  import { a as symbols, i as styles, n as logger, r as setColorEnabled, t as isColorEnabled } from "./logger-DbDkjdfO.js";
7
8
 
8
- export { CaseVariantCollisionError, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, FieldTypeConflictError, PositionalConfigError, ReservedAliasError, ReservedFieldNameError, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateBundledCompletionWorker, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, validateReservedFieldNames, withCompletionCommand };
9
+ export { CaseVariantCollisionError, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, FieldTypeConflictError, PositionalConfigError, ReservedAliasError, ReservedFieldNameError, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateBundledCompletionWorker, generateCompileCacheShim, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, validateReservedFieldNames, withCompletionCommand };
@@ -1,5 +1,4 @@
1
- import { F as PromptResolver } from "../../arg-registry-D558cYkD.js";
2
-
1
+ import { F as PromptResolver } from "../../arg-registry-SrNIsq-d.js";
3
2
  //#region src/prompt/clack/index.d.ts
4
3
  /**
5
4
  * Prompt resolver backed by @clack/prompts.
@@ -1,5 +1,4 @@
1
- import { J as ExtractedFields, Y as ResolvedFieldMeta } from "../arg-registry-D558cYkD.js";
2
-
1
+ import { J as ExtractedFields, Y as ResolvedFieldMeta } from "../arg-registry-SrNIsq-d.js";
3
2
  //#region src/prompt/types.d.ts
4
3
  /**
5
4
  * Resolved prompt configuration for a single field
@@ -1,5 +1,4 @@
1
- import { F as PromptResolver } from "../../arg-registry-D558cYkD.js";
2
-
1
+ import { F as PromptResolver } from "../../arg-registry-SrNIsq-d.js";
3
2
  //#region src/prompt/inquirer/index.d.ts
4
3
  /**
5
4
  * Prompt resolver backed by @inquirer/prompts.
@@ -0,0 +1,3 @@
1
+ import { n as runMain, t as runCommand } from "./runner-xN7248Ph.js";
2
+
3
+ export { runCommand };
@@ -1,26 +1,10 @@
1
1
  import { a as toCamelCase, n as getAllAliases, o as toKebabCase, r as getExtractedFields, t as extractFields } from "./schema-extractor-wzJ1cGon.js";
2
2
  import { a as resolveSubcommandWithAlias, c as resolveSubCommandMeta, n as listSubCommands, o as isLazyCommand, r as resolveLazyCommand, t as listSubCommandNamesWithAliases } from "./subcommand-router-CTzHPGzF.js";
3
+ import { n as enableCompileCache } from "./compile-cache-NnTkjJMV.js";
3
4
  import { n as emptyLogs, r as mergeLogs, t as createLogCollector } from "./log-collector-DK32-73m.js";
4
5
  import { a as symbols, i as styles } from "./logger-DbDkjdfO.js";
5
6
  import { stripVTControlCharacters } from "node:util";
6
7
 
7
- //#region \0rolldown/runtime.js
8
- var __defProp = Object.defineProperty;
9
- var __exportAll = (all, no_symbols) => {
10
- let target = {};
11
- for (var name in all) {
12
- __defProp(target, name, {
13
- get: all[name],
14
- enumerable: true
15
- });
16
- }
17
- if (!no_symbols) {
18
- __defProp(target, Symbol.toStringTag, { value: "Module" });
19
- }
20
- return target;
21
- };
22
-
23
- //#endregion
24
8
  //#region src/core/case-proxy.ts
25
9
  /**
26
10
  * Wrap an args object with a Proxy that allows dual-case access.
@@ -522,7 +506,8 @@ function renderBlock(block) {
522
506
  `${pipe} ${renderedHeaders.map((h, i) => styles.bold(alignText(h, colWidths[i], block.alignments[i] ?? "left"))).join(` ${pipe} `)} ${pipe}`,
523
507
  midBorder,
524
508
  ...renderedRows.map((row) => {
525
- return `${pipe} ${row.map((cell, i) => alignText(cell, colWidths[i], block.alignments[i] ?? "left")).join(` ${pipe} `)} ${pipe}`;
509
+ const cells = row.map((cell, i) => alignText(cell, colWidths[i], block.alignments[i] ?? "left"));
510
+ return `${pipe} ${cells.join(` ${pipe} `)} ${pipe}`;
526
511
  }),
527
512
  botBorder
528
513
  ].join("\n");
@@ -1554,8 +1539,13 @@ function formatCommandValidationErrors(errors) {
1554
1539
 
1555
1540
  //#endregion
1556
1541
  //#region src/parser/long-option-resolver.ts
1542
+ /** Return a long option's name without leading dashes or an inline value. */
1543
+ function getLongOptionName(arg) {
1544
+ const equalsIndex = arg.indexOf("=");
1545
+ return equalsIndex >= 0 ? arg.slice(2, equalsIndex) : arg.slice(2);
1546
+ }
1557
1547
  function resolveLongOption(arg, lookup) {
1558
- const withoutDashes = arg.includes("=") ? arg.slice(2, arg.indexOf("=")) : arg.slice(2);
1548
+ const withoutDashes = getLongOptionName(arg);
1559
1549
  if (!arg.includes("=")) {
1560
1550
  const negatedField = lookup.negationMap.get(withoutDashes);
1561
1551
  if (negatedField && lookup.booleanFlags.has(negatedField)) return {
@@ -1950,13 +1940,13 @@ function scanForSubcommand(argv, subCommandNames, globalExtracted) {
1950
1940
  suppressedTokens
1951
1941
  };
1952
1942
  if (arg.startsWith("--")) {
1953
- const { resolvedName, isNegated, isGlobal, isSuppressedNegation } = resolveGlobalLongOption(arg, lookup);
1943
+ const { resolvedName, withoutDashes, isNegated, isGlobal, isSuppressedNegation } = resolveGlobalLongOption(arg, lookup);
1954
1944
  if (isGlobal) {
1955
1945
  i += collectGlobalFlag(argv, i, resolvedName, isNegated, lookup.booleanFlags, globalTokensBefore);
1956
1946
  continue;
1957
1947
  }
1958
1948
  if (isSuppressedNegation) {
1959
- suppressedTokens.push(arg.includes("=") ? arg.slice(2, arg.indexOf("=")) : arg.slice(2));
1949
+ suppressedTokens.push(withoutDashes);
1960
1950
  i++;
1961
1951
  continue;
1962
1952
  }
@@ -2252,7 +2242,7 @@ function separateGlobalArgs(argv, globalExtracted, localExtracted) {
2252
2242
  continue;
2253
2243
  }
2254
2244
  if (isSuppressedNegation && !isLocalCollision) {
2255
- suppressedTokens.push(arg.includes("=") ? arg.slice(2, arg.indexOf("=")) : arg.slice(2));
2245
+ suppressedTokens.push(withoutDashes);
2256
2246
  continue;
2257
2247
  }
2258
2248
  } else if (arg.startsWith("-") && arg.length > 1) {
@@ -2391,10 +2381,6 @@ async function runEffects(validatedArgs, extracted, globalArgs) {
2391
2381
 
2392
2382
  //#endregion
2393
2383
  //#region src/core/runner.ts
2394
- var runner_exports = /* @__PURE__ */ __exportAll({
2395
- runCommand: () => runCommand,
2396
- runMain: () => runMain
2397
- });
2398
2384
  /**
2399
2385
  * Default logger using console
2400
2386
  */
@@ -2546,6 +2532,7 @@ function isInternalSubcommandInvocation(command, argv, globalExtracted) {
2546
2532
  * ```
2547
2533
  */
2548
2534
  async function runMain(command, options = {}) {
2535
+ if (options.compileCache !== false) enableCompileCache(typeof options.compileCache === "string" ? { cacheDir: options.compileCache } : { programName: command.name });
2549
2536
  if (command.runMainHook) try {
2550
2537
  command.runMainHook(process.argv.slice(2));
2551
2538
  } catch {}
@@ -2570,7 +2557,8 @@ async function runMain(command, options = {}) {
2570
2557
  const exitCode = await effectiveOptions.onUnknownSubcommand({
2571
2558
  commandPath: [],
2572
2559
  name,
2573
- args: forwardArgs
2560
+ args: forwardArgs,
2561
+ precedingArgs: argv.slice(0, positionalIndex)
2574
2562
  });
2575
2563
  if (typeof exitCode === "number") {
2576
2564
  await flushStandardStreams();
@@ -2663,7 +2651,8 @@ async function runCommandInternal(command, argv, options = {}) {
2663
2651
  const exitCode = await options.onUnknownSubcommand({
2664
2652
  commandPath: nestedCommandPath,
2665
2653
  name,
2666
- args: forwardArgs
2654
+ args: forwardArgs,
2655
+ precedingArgs: [...options._precedingArgs ?? [], ...argv.slice(0, positionalIndex)]
2667
2656
  });
2668
2657
  if (typeof exitCode === "number") {
2669
2658
  collector?.stop();
@@ -2760,11 +2749,17 @@ async function runCommandInternal(command, argv, options = {}) {
2760
2749
  aliasFor: resolved.aliasFor
2761
2750
  };
2762
2751
  collector?.stop();
2752
+ const suppressedNames = new Set(options._globalExtracted?.unknownKeysMode === "passthrough" ? [] : parseResult.unknownGlobalFlags ?? []);
2753
+ const isSuppressedFlag = (token) => {
2754
+ return token.startsWith("--") && suppressedNames.has(getLongOptionName(token));
2755
+ };
2756
+ const levelPrecedingArgs = argv.slice(0, argv.length - parseResult.remainingArgs.length - 1).filter((token) => !isSuppressedFlag(token));
2763
2757
  return runCommandInternal(resolved.command, parseResult.remainingArgs, {
2764
2758
  ...options,
2765
2759
  _context: subContext,
2766
2760
  _existingLogs: getCurrentLogs(),
2767
- _parsedGlobalArgs: accumulatedGlobalArgs
2761
+ _parsedGlobalArgs: accumulatedGlobalArgs,
2762
+ _precedingArgs: [...options._precedingArgs ?? [], ...levelPrecedingArgs]
2768
2763
  });
2769
2764
  }
2770
2765
  }
@@ -2967,5 +2962,5 @@ function extractAndValidateGlobal(options) {
2967
2962
  }
2968
2963
 
2969
2964
  //#endregion
2970
- export { ReservedFieldNameError as C, createDualCaseProxy as D, renderMarkdown as E, ReservedAliasError as S, renderInline as T, DuplicateAliasError as _, parseArgv as a, FieldTypeConflictError as b, validateCommand as c, validateDuplicateFields as d, validateDuplicateNegations as f, CaseVariantCollisionError as g, validateReservedFieldNames as h, formatValidationErrors as i, validateCrossSchemaCollisions as l, validateReservedAliases as m, runMain as n, formatCommandValidationErrors as o, validatePositionalConfig as p, runner_exports as r, validateCaseVariantCollisions as s, runCommand as t, validateDuplicateAliases as u, DuplicateFieldError as v, generateHelp as w, PositionalConfigError as x, DuplicateNegationError as y };
2971
- //# sourceMappingURL=runner-CEDtiI7D.js.map
2965
+ export { generateHelp as C, createDualCaseProxy as E, ReservedFieldNameError as S, renderMarkdown as T, DuplicateFieldError as _, formatCommandValidationErrors as a, PositionalConfigError as b, validateCrossSchemaCollisions as c, validateDuplicateNegations as d, validatePositionalConfig as f, DuplicateAliasError as g, CaseVariantCollisionError as h, parseArgv as i, validateDuplicateAliases as l, validateReservedFieldNames as m, runMain as n, validateCaseVariantCollisions as o, validateReservedAliases as p, formatValidationErrors as r, validateCommand as s, runCommand as t, validateDuplicateFields as u, DuplicateNegationError as v, renderInline as w, ReservedAliasError as x, FieldTypeConflictError as y };
2966
+ //# sourceMappingURL=runner-xN7248Ph.js.map
@@ -1,6 +1,5 @@
1
- import { X as UnknownKeysMode, _ as AnyCommand, y as ArgsSchema } from "../arg-registry-D558cYkD.js";
1
+ import { X as UnknownKeysMode, _ as AnyCommand, y as ArgsSchema } from "../arg-registry-SrNIsq-d.js";
2
2
  import { z } from "zod";
3
-
4
3
  //#region src/skill/frontmatter.d.ts
5
4
  /**
6
5
  * Zod schema for SKILL.md frontmatter.
@@ -357,9 +356,44 @@ interface SkillCommandOptions {
357
356
  * ```
358
357
  */
359
358
  commandMap?: {
360
- /** Primary name + aliases for `skills add`. Default: `["add", "install"]`. */add?: string[]; /** Primary name + aliases for `skills remove`. Default: `["remove", "uninstall"]`. */
359
+ /** Primary name + aliases for `skills add`. Default: `["add", "install"]`. */
360
+ add?: string[];
361
+ /** Primary name + aliases for `skills remove`. Default: `["remove", "uninstall"]`. */
361
362
  remove?: string[];
362
363
  };
364
+ /**
365
+ * Override the description text for the `skills` command and/or its
366
+ * built-in subcommands. Any key left unset keeps politty's default
367
+ * description for that command.
368
+ *
369
+ * Keys refer to the subcommand's *canonical role*, not its dispatched
370
+ * name — e.g. `descriptions.add` still applies after `commandMap.add`
371
+ * renames the subcommand to something else.
372
+ *
373
+ * @example
374
+ * ```ts
375
+ * withSkillCommand(cmd, {
376
+ * sourceDir, package: "@my-agent/skills",
377
+ * commandMap: { add: ["setup", "add", "install"] },
378
+ * descriptions: {
379
+ * skills: "Manage My Agent skills",
380
+ * add: "Install My Agent skills", // still keyed by "add", not "setup"
381
+ * },
382
+ * });
383
+ * ```
384
+ */
385
+ descriptions?: {
386
+ /** Description for the top-level `skills` command. Default: `"Manage agent skills"`. */
387
+ skills?: string;
388
+ /** Description for `skills sync`. Default: `"Remove and reinstall all skills from source"`. */
389
+ sync?: string;
390
+ /** Description for `skills add`. Default: `"Install skills from source"`. */
391
+ add?: string;
392
+ /** Description for `skills remove`. Default: `"Remove installed skills"`. */
393
+ remove?: string;
394
+ /** Description for `skills list`. Default: `"List available skills from source"`. */
395
+ list?: string;
396
+ };
363
397
  }
364
398
  /**
365
399
  * Result of wrapping `T` with {@link withSkillCommand} — `T` with a
@@ -1,9 +1,9 @@
1
1
  import { s as arg, t as extractFields } from "../schema-extractor-wzJ1cGon.js";
2
2
  import { n as defineCommand } from "../command-B4yA4LXX.js";
3
3
  import { a as symbols, n as logger } from "../logger-DbDkjdfO.js";
4
- import { z } from "zod";
5
4
  import { copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, symlinkSync, unlinkSync } from "node:fs";
6
5
  import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
6
+ import { z } from "zod";
7
7
  import { parse as parse$1 } from "yaml";
8
8
 
9
9
  //#region src/skill/frontmatter.ts
@@ -1030,7 +1030,7 @@ function createSkillSyncCommand(resolved) {
1030
1030
  }
1031
1031
  if (resolved.verbose.disabled) return defineCommand({
1032
1032
  name: "sync",
1033
- description: "Remove and reinstall all skills from source",
1033
+ description: resolved.descriptions.sync,
1034
1034
  args: applyUnknownKeys(z.object({ exclude: arg(z.array(z.string()).default([]), excludeArgMeta(resolved)) }), resolved.unknownKeys),
1035
1035
  run(args) {
1036
1036
  runSync(args, mergedFlag(args, "verbose"));
@@ -1038,7 +1038,7 @@ function createSkillSyncCommand(resolved) {
1038
1038
  });
1039
1039
  return defineCommand({
1040
1040
  name: "sync",
1041
- description: "Remove and reinstall all skills from source",
1041
+ description: resolved.descriptions.sync,
1042
1042
  args: applyUnknownKeys(z.object({
1043
1043
  exclude: arg(z.array(z.string()).default([]), excludeArgMeta(resolved)),
1044
1044
  verbose: arg(z.boolean().default(false), verboseArgMeta(resolved))
@@ -1090,7 +1090,7 @@ function createSkillAddCommand(resolved) {
1090
1090
  if (resolved.verbose.disabled) return defineCommand({
1091
1091
  name: resolved.commandNames.add.name,
1092
1092
  ...resolved.commandNames.add.aliases.length > 0 ? { aliases: resolved.commandNames.add.aliases } : {},
1093
- description: "Install skills from source",
1093
+ description: resolved.descriptions.add,
1094
1094
  args: applyUnknownKeys(z.object({ name: arg(z.array(z.string()).default([]), nameArgMeta) }), resolved.unknownKeys),
1095
1095
  run(args) {
1096
1096
  runAdd(args, mergedFlag(args, "verbose"));
@@ -1099,7 +1099,7 @@ function createSkillAddCommand(resolved) {
1099
1099
  return defineCommand({
1100
1100
  name: resolved.commandNames.add.name,
1101
1101
  ...resolved.commandNames.add.aliases.length > 0 ? { aliases: resolved.commandNames.add.aliases } : {},
1102
- description: "Install skills from source",
1102
+ description: resolved.descriptions.add,
1103
1103
  args: applyUnknownKeys(z.object({
1104
1104
  name: arg(z.array(z.string()).default([]), nameArgMeta),
1105
1105
  verbose: arg(z.boolean().default(false), verboseArgMeta(resolved))
@@ -1121,7 +1121,7 @@ function createSkillRemoveCommand(resolved) {
1121
1121
  return defineCommand({
1122
1122
  name: resolved.commandNames.remove.name,
1123
1123
  ...resolved.commandNames.remove.aliases.length > 0 ? { aliases: resolved.commandNames.remove.aliases } : {},
1124
- description: "Remove installed skills",
1124
+ description: resolved.descriptions.remove,
1125
1125
  args: applyUnknownKeys(z.object({ name: arg(z.string().optional(), {
1126
1126
  positional: true,
1127
1127
  description: "Skill name to remove (default: all)",
@@ -1213,7 +1213,7 @@ function createSkillListCommand(resolved) {
1213
1213
  }
1214
1214
  if (resolved.json.disabled) return defineCommand({
1215
1215
  name: "list",
1216
- description: "List available skills from source",
1216
+ description: resolved.descriptions.list,
1217
1217
  args: applyUnknownKeys(z.object({}), resolved.unknownKeys),
1218
1218
  run(args) {
1219
1219
  runList(mergedFlag(args, "json"));
@@ -1221,7 +1221,7 @@ function createSkillListCommand(resolved) {
1221
1221
  });
1222
1222
  return defineCommand({
1223
1223
  name: "list",
1224
- description: "List available skills from source",
1224
+ description: resolved.descriptions.list,
1225
1225
  args: applyUnknownKeys(z.object({ json: arg(z.boolean().default(false), { description: "Output as JSON" }) }), resolved.unknownKeys),
1226
1226
  run(args) {
1227
1227
  runList(args.json);
@@ -1454,6 +1454,18 @@ const DEFAULT_ADD_NAMES = ["add", "install"];
1454
1454
  /** Default primary name + aliases for `skills remove`. */
1455
1455
  const DEFAULT_REMOVE_NAMES = ["remove", "uninstall"];
1456
1456
  /**
1457
+ * Default description text for the `skills` command and each built-in
1458
+ * subcommand, keyed by canonical role. Overridden per-key via
1459
+ * `SkillCommandOptions.descriptions`.
1460
+ */
1461
+ const DEFAULT_DESCRIPTIONS = {
1462
+ skills: "Manage agent skills",
1463
+ sync: "Remove and reinstall all skills from source",
1464
+ add: "Install skills from source",
1465
+ remove: "Remove installed skills",
1466
+ list: "List available skills from source"
1467
+ };
1468
+ /**
1457
1469
  * Same safe-token pattern politty's own command validator enforces for
1458
1470
  * subcommand aliases (`checkSubCommandAliasConflicts` in
1459
1471
  * src/validator/command-validator.ts). That check only runs when a host
@@ -1482,6 +1494,8 @@ const PROJECT_ROOT_MARKERS = [".git", "package.json"];
1482
1494
  * - `unknownKeys` — `"strip"` unless overridden via `options.unknownKeys`.
1483
1495
  * - `descriptionAppend` — a one-line hint mentioning the skills
1484
1496
  * subcommands. Pass an explicit string to override or `false` to opt out.
1497
+ * - `descriptions` — politty's default text per canonical role, unless
1498
+ * overridden via `options.descriptions`.
1485
1499
  */
1486
1500
  function resolveSkillOptions(options, cliName) {
1487
1501
  return {
@@ -1498,7 +1512,18 @@ function resolveSkillOptions(options, cliName) {
1498
1512
  },
1499
1513
  unknownKeys: options.unknownKeys ?? DEFAULT_UNKNOWN_KEYS,
1500
1514
  descriptionAppend: resolveDescriptionAppend(options.descriptionAppend, cliName),
1501
- stamp: `${options.package}:${cliName}`
1515
+ stamp: `${options.package}:${cliName}`,
1516
+ descriptions: resolveDescriptions(options.descriptions)
1517
+ };
1518
+ }
1519
+ /** Fill in {@link DEFAULT_DESCRIPTIONS} for any key the caller left unset. */
1520
+ function resolveDescriptions(value) {
1521
+ return {
1522
+ skills: value?.skills ?? DEFAULT_DESCRIPTIONS.skills,
1523
+ sync: value?.sync ?? DEFAULT_DESCRIPTIONS.sync,
1524
+ add: value?.add ?? DEFAULT_DESCRIPTIONS.add,
1525
+ remove: value?.remove ?? DEFAULT_DESCRIPTIONS.remove,
1526
+ list: value?.list ?? DEFAULT_DESCRIPTIONS.list
1502
1527
  };
1503
1528
  }
1504
1529
  function resolveCwd(override) {
@@ -1691,7 +1716,7 @@ function withSkillCommand(command, options) {
1691
1716
  if (duplicate) throw new Error(`withSkillCommand: commandMap produced duplicate subcommand name/alias "${duplicate}".`);
1692
1717
  const skillsSubCommand = defineCommand({
1693
1718
  name: "skills",
1694
- description: "Manage agent skills",
1719
+ description: resolved.descriptions.skills,
1695
1720
  subCommands: {
1696
1721
  sync: createSkillSyncCommand(resolved),
1697
1722
  [addName]: createSkillAddCommand(resolved),