@politty/zod 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +561 -0
  3. package/bin/cli.mjs +3 -0
  4. package/dist/arg-registry-YaWTVu_x.d.ts +1025 -0
  5. package/dist/augment.d.ts +15 -0
  6. package/dist/augment.js +1 -0
  7. package/dist/cli-main-Dn88vIyn.js +84 -0
  8. package/dist/cli-run-eibUcgys.js +7 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +16 -0
  11. package/dist/command-k-4yAz4J.js +42 -0
  12. package/dist/compile-cache-Ct41pWGL.js +100 -0
  13. package/dist/compile-cache.d.ts +78 -0
  14. package/dist/compile-cache.js +3 -0
  15. package/dist/completion-gtWX3mwP.js +5608 -0
  16. package/dist/completion.d.ts +242 -0
  17. package/dist/completion.js +4 -0
  18. package/dist/docs.d.ts +770 -0
  19. package/dist/docs.js +3044 -0
  20. package/dist/field-meta-DMy5BcRr.js +146 -0
  21. package/dist/index-CvhsecfS.d.ts +455 -0
  22. package/dist/index.d.ts +799 -0
  23. package/dist/index.js +17 -0
  24. package/dist/log-collector-CoUkLVJB.js +114 -0
  25. package/dist/logger-i_bb-Jhc.js +133 -0
  26. package/dist/prompt-CEIZ-7H1.js +171 -0
  27. package/dist/prompt-clack.d.ts +16 -0
  28. package/dist/prompt-clack.js +32 -0
  29. package/dist/prompt-inquirer.d.ts +16 -0
  30. package/dist/prompt-inquirer.js +47 -0
  31. package/dist/prompt.d.ts +106 -0
  32. package/dist/prompt.js +4 -0
  33. package/dist/register-Bk0K83W2.js +439 -0
  34. package/dist/runner-D72I7wvK.js +2956 -0
  35. package/dist/runner-FvUwOHyE.js +3 -0
  36. package/dist/schema-extractor-DMSozq40.js +250 -0
  37. package/dist/skill.d.ts +608 -0
  38. package/dist/skill.js +1832 -0
  39. package/dist/src-KzC0g5CS.js +191 -0
  40. package/dist/subcommand-router-Cskpofdk.js +134 -0
  41. package/package.json +103 -0
@@ -0,0 +1,242 @@
1
+ import { C as Command, X as ResolvedFieldMeta, _ as DynamicCompletionResult, b as ArgsSchema, d as ExpandCompletion, g as DynamicCompletionResolver, h as DynamicCompletionContext, m as DynamicCompletionCandidate, p as CompletionDirectiveMask, v as AnyCommand } from "./arg-registry-YaWTVu_x.js";
2
+ import { C as CompletionResult, D as InternalArgsSchema, E as InferInternalArgs, S as CompletionOptions, T as ValueCompletion, _ as CompletablePositional, a as detectShell, b as CompletionGenerator, c as withCompletionCommand, d as bundledWorkerShellExtension, f as defaultBundledWorkerOutputPath, g as CompletableOption, h as BundledWorkerOptions, i as createRefreshCompletionCommand, l as GenerateBundledCompletionWorkerOptions, m as validateBundledWorkerFile, n as createCompletionCommand, o as generateCompletion, p as generateBundledCompletionWorker, r as createCompletionWorkerPathCommand, s as getSupportedShells, t as WithCompletionOptions, u as GenerateBundledCompletionWorkerResult, v as CompletableSubcommand, w as ShellType, x as CompletionMode, y as CompletionData } from "./index-CvhsecfS.js";
3
+ //#region ../core/src/completion/dynamic/context-parser.d.ts
4
+ /**
5
+ * Completion type indicates what kind of completion is expected
6
+ */
7
+ type CompletionType = "subcommand" | "option-name" | "option-value" | "positional";
8
+ /**
9
+ * Context for completion at current cursor position
10
+ */
11
+ interface CompletionContext {
12
+ /** Subcommand path from root (e.g., ["plugin", "add"]) */
13
+ subcommandPath: string[];
14
+ /** The resolved command at current path */
15
+ currentCommand: AnyCommand;
16
+ /** Current word being typed (may be partial) */
17
+ currentWord: string;
18
+ /** Previous word (useful for option value detection) */
19
+ previousWord: string;
20
+ /** What type of completion is expected */
21
+ completionType: CompletionType;
22
+ /** Target option when completing option value */
23
+ targetOption?: CompletableOption | undefined;
24
+ /** Positional index when completing positional argument */
25
+ positionalIndex?: number | undefined;
26
+ /** Available options for current command */
27
+ options: CompletableOption[];
28
+ /** Available subcommands */
29
+ subcommands: string[];
30
+ /** Available positionals */
31
+ positionals: CompletablePositional[];
32
+ /** Options already used (to avoid duplicates) */
33
+ usedOptions: Set<string>;
34
+ /** Number of positional arguments already provided */
35
+ providedPositionalCount: number;
36
+ /**
37
+ * Best-effort parsed values for the CURRENT command, keyed by camelCase
38
+ * field name. Includes positionals (single value or string[] for variadic
39
+ * positionals) and options (string for scalars, string[] for array
40
+ * options). Zod validation is NOT applied — values are raw strings.
41
+ */
42
+ parsedArgs: Record<string, unknown>;
43
+ /**
44
+ * Values already supplied for the option/positional currently being
45
+ * completed (for de-duplicating array options and oneof exclusivity in
46
+ * dynamic resolvers).
47
+ */
48
+ previousValues: string[];
49
+ }
50
+ /**
51
+ * Parse completion context from command line arguments
52
+ *
53
+ * @param argv - Arguments after the program name (e.g., ["build", "--fo"])
54
+ * @param rootCommand - The root command
55
+ * @param globalArgsSchema - Optional global args. When provided, options
56
+ * derived from this schema are merged into every command level so dynamic
57
+ * resolvers attached to global options can be reached from any subcommand.
58
+ * @returns Completion context
59
+ */
60
+ declare function parseCompletionContext(argv: string[], rootCommand: AnyCommand, globalArgsSchema?: ArgsSchema): CompletionContext;
61
+ //#endregion
62
+ //#region ../core/src/completion/dynamic/candidate-generator.d.ts
63
+ /**
64
+ * Completion directive flags (bitwise)
65
+ */
66
+ declare const CompletionDirective: {
67
+ /** Default completion behavior */
68
+ readonly Default: 0;
69
+ /** Don't add space after completion */
70
+ readonly NoSpace: 1;
71
+ /** Don't offer file completion (even if no other completions) */
72
+ readonly NoFileCompletion: 2;
73
+ /** Filter completions using current word as prefix */
74
+ readonly FilterPrefix: 4;
75
+ /** Keep the order of completions */
76
+ readonly KeepOrder: 8;
77
+ /** Trigger file completion */
78
+ readonly FileCompletion: 16;
79
+ /** Trigger directory completion */
80
+ readonly DirectoryCompletion: 32;
81
+ /** Error occurred during completion */
82
+ readonly Error: 64;
83
+ };
84
+ /**
85
+ * A completion candidate
86
+ */
87
+ interface CompletionCandidate {
88
+ /** The completion value */
89
+ value: string;
90
+ /** Optional description */
91
+ description?: string | undefined;
92
+ /** Type hint for display purposes */
93
+ type?: "option" | "subcommand" | "value" | "file" | "directory";
94
+ }
95
+ /**
96
+ * Result of candidate generation
97
+ */
98
+ interface CandidateResult {
99
+ /** Completion candidates */
100
+ candidates: CompletionCandidate[];
101
+ /** Directive flags for shell behavior */
102
+ directive: number;
103
+ /** File extensions for shell-native filtering (e.g., ["json", "yaml"]) */
104
+ fileExtensions?: string[] | undefined;
105
+ /** Glob patterns for shell-native file matching (e.g., [".env.*"]) */
106
+ fileMatchers?: string[] | undefined;
107
+ }
108
+ /**
109
+ * Options for candidate generation.
110
+ */
111
+ interface GenerateCandidatesOptions {
112
+ /**
113
+ * Target shell. Forwarded to dynamic resolvers so they can vary output
114
+ * (e.g. include descriptions only for shells that render them).
115
+ */
116
+ shell: ShellType;
117
+ }
118
+ /**
119
+ * Generate completion candidates based on context.
120
+ *
121
+ * Async because dynamic resolvers may return promises. Sync completion
122
+ * sources (choices/file/directory/command/none, subcommand, option name)
123
+ * still resolve synchronously and the await is a no-op for them.
124
+ *
125
+ * Inline option-value prefixes (`--field=foo`) on the option-value path
126
+ * are stripped here so resolvers and post-processing always see the
127
+ * value portion regardless of whether the caller pre-normalized.
128
+ */
129
+ declare function generateCandidates(context: CompletionContext, options: GenerateCandidatesOptions): Promise<CandidateResult>;
130
+ //#endregion
131
+ //#region ../core/src/completion/dynamic/complete-command.d.ts
132
+ /**
133
+ * Schema for the __complete command
134
+ */
135
+ declare const completeArgsSchema: InternalArgsSchema<{
136
+ shell: "bash" | "fish" | "zsh";
137
+ args: string[];
138
+ }>;
139
+ type CompleteArgs = InferInternalArgs<typeof completeArgsSchema>;
140
+ /**
141
+ * Create the dynamic completion command
142
+ *
143
+ * @param rootCommand - The root command to generate completions for
144
+ * @param programName - The program name (optional, defaults to rootCommand.name)
145
+ * @param globalArgsSchema - Global args schema. Forwarded to
146
+ * `parseCompletionContext` so resolvers attached to global options remain
147
+ * reachable at every subcommand level.
148
+ * @returns A command that outputs completion candidates
149
+ */
150
+ declare function createDynamicCompleteCommand(rootCommand: AnyCommand, _programName?: string, globalArgsSchema?: ArgsSchema): Command<typeof completeArgsSchema, CompleteArgs, any>;
151
+ /**
152
+ * Check if a command tree contains the __complete command
153
+ */
154
+ declare function hasCompleteCommand(command: AnyCommand): boolean;
155
+ //#endregion
156
+ //#region ../core/src/completion/dynamic/shell-formatter.d.ts
157
+ /**
158
+ * Options for shell-specific formatting
159
+ */
160
+ interface ShellFormatOptions {
161
+ /** Target shell type */
162
+ shell: ShellType;
163
+ /** Current word being completed (used for prefix filtering) */
164
+ currentWord: string;
165
+ /** For bash: the prefix before '=' in --opt=value completions */
166
+ inlinePrefix?: string | undefined;
167
+ }
168
+ /**
169
+ * Format completion candidates for the specified shell
170
+ *
171
+ * @returns Shell-ready output string (lines separated by newline, last line is :directive)
172
+ */
173
+ declare function formatForShell(result: CandidateResult, options: ShellFormatOptions): string;
174
+ //#endregion
175
+ //#region ../core/src/completion/extractor.d.ts
176
+ /**
177
+ * Extract positional arguments from a command
178
+ */
179
+ declare function extractPositionals(command: AnyCommand): ResolvedFieldMeta[];
180
+ /**
181
+ * Extract completion data from a command tree
182
+ *
183
+ * @param command - The root command
184
+ * @param programName - Program name for completion scripts
185
+ * @param globalArgsSchema - Optional global args schema. When provided, global options
186
+ * are derived from this schema instead of the root command's options.
187
+ */
188
+ declare function extractCompletionData(command: AnyCommand, programName: string, globalArgsSchema?: ArgsSchema, validateOnly?: boolean): CompletionData;
189
+ //#endregion
190
+ //#region ../core/src/completion/value-completion-resolver.d.ts
191
+ /**
192
+ * Sentinel returned when a field uses `completion.custom.expand`. The static
193
+ * extractor recognises this and replaces it with a fully resolved
194
+ * `{ type: "expand", ... }` ValueCompletion after sibling args' static
195
+ * values are known. Internal: never assigned onto `CompletableOption` /
196
+ * `CompletablePositional` directly; callers stash it in a side map keyed by
197
+ * field name and patch the resolved spec in afterwards.
198
+ */
199
+ interface PendingExpandValueCompletion {
200
+ type: "pending-expand";
201
+ spec: ExpandCompletion;
202
+ }
203
+ /**
204
+ * Minimal field interface needed for resolving value completion.
205
+ * Both ResolvedFieldMeta and inline context-parser types satisfy this.
206
+ */
207
+ interface ValueCompletionField {
208
+ completion?: ({
209
+ type?: string;
210
+ custom?: {
211
+ choices?: string[];
212
+ shellCommand?: string;
213
+ resolve?: DynamicCompletionResolver;
214
+ expand?: ExpandCompletion;
215
+ };
216
+ } & ({
217
+ extensions?: string[];
218
+ matcher?: never;
219
+ } | {
220
+ matcher?: string[];
221
+ extensions?: never;
222
+ })) | undefined;
223
+ enumValues?: string[] | undefined;
224
+ /** Field name surfaced in error messages when custom variants are mixed. */
225
+ name?: string;
226
+ }
227
+ /**
228
+ * Resolve value completion from field metadata.
229
+ *
230
+ * Priority (within `custom`): `expand` > `resolve` > `choices` > `shellCommand`.
231
+ * Specifying more than one of these on the same field throws so the
232
+ * misconfiguration surfaces at command-definition time rather than at
233
+ * completion time. The `expand` variant returns a sentinel — the extractor
234
+ * resolves it against sibling fields and replaces the sentinel with a
235
+ * `{ type: "expand", table, dependsOn }` entry.
236
+ *
237
+ * Outside `custom`: explicit `type` (file/directory/none) > auto-detected
238
+ * enum values from the schema.
239
+ */
240
+ declare function resolveValueCompletion(field: ValueCompletionField): ValueCompletion | PendingExpandValueCompletion | undefined;
241
+ //#endregion
242
+ export { type BundledWorkerOptions, type CandidateResult, type CompletableOption, type CompletableSubcommand, type CompletionCandidate, type CompletionContext, type CompletionData, CompletionDirective, type CompletionDirectiveMask, type CompletionGenerator, type CompletionMode, type CompletionOptions, type CompletionResult, type CompletionType, type DynamicCompletionCandidate, type DynamicCompletionContext, type DynamicCompletionResolver, type DynamicCompletionResult, type GenerateBundledCompletionWorkerOptions, type GenerateBundledCompletionWorkerResult, type ShellFormatOptions, type ShellType, type ValueCompletionField, WithCompletionOptions, bundledWorkerShellExtension, createCompletionCommand, createCompletionWorkerPathCommand, createDynamicCompleteCommand, createRefreshCompletionCommand, defaultBundledWorkerOutputPath, detectShell, extractCompletionData, extractPositionals, formatForShell, generateBundledCompletionWorker, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, validateBundledWorkerFile, withCompletionCommand };
@@ -0,0 +1,4 @@
1
+ import "./register-Bk0K83W2.js";
2
+ import { _ as CompletionDirective, a as generateCompletion, b as resolveValueCompletion, c as createDynamicCompleteCommand, d as bundledWorkerShellExtension, f as defaultBundledWorkerOutputPath, g as extractPositionals, h as extractCompletionData, i as detectShell, l as hasCompleteCommand, m as validateBundledWorkerFile, n as createCompletionWorkerPathCommand, o as getSupportedShells, p as generateBundledCompletionWorker, r as createRefreshCompletionCommand, s as withCompletionCommand, t as createCompletionCommand, u as formatForShell, v as generateCandidates, y as parseCompletionContext } from "./completion-gtWX3mwP.js";
3
+
4
+ export { CompletionDirective, bundledWorkerShellExtension, createCompletionCommand, createCompletionWorkerPathCommand, createDynamicCompleteCommand, createRefreshCompletionCommand, defaultBundledWorkerOutputPath, detectShell, extractCompletionData, extractPositionals, formatForShell, generateBundledCompletionWorker, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, validateBundledWorkerFile, withCompletionCommand };