@politty/loculus 0.0.0-stage → 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +65 -2
- package/bin/cli.mjs +3 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +1 -0
- package/dist/argv-parser-BRSUT6IV.js +1 -0
- package/dist/cli-main-CoQp6CjD.js +1 -0
- package/dist/cli-main-D4rJTFFd.js +2 -0
- package/dist/cli-run-DABESHM4.js +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2 -0
- package/dist/command-BXsTrIgI.js +1 -0
- package/dist/compile-cache-6u9hgeWu.js +1 -0
- package/dist/compile-cache.d.ts +80 -0
- package/dist/compile-cache.js +1 -0
- package/dist/completion-BGidlN43.js +1 -0
- package/dist/completion-Cyw4RN-l.js +116 -0
- package/dist/completion.d.ts +333 -0
- package/dist/completion.js +1 -0
- package/dist/detect-agent-D7KSeWMh.js +3 -0
- package/dist/detect-agent-EHaSY1KW.d.ts +49 -0
- package/dist/docs.d.ts +770 -0
- package/dist/docs.js +94 -0
- package/dist/dynamic-BbeRdUqR.js +1 -0
- package/dist/dynamic-Hg5BDHzz.js +6 -0
- package/dist/import-meta-resolve-DgKm4LYW.js +3 -0
- package/dist/index.d.ts +1088 -0
- package/dist/index.js +1 -0
- package/dist/log-collector-uhRWYT-z.js +1 -0
- package/dist/logger-CoeDrmRr.js +1 -0
- package/dist/prompt-clack.d.ts +15 -0
- package/dist/prompt-clack.js +1 -0
- package/dist/prompt-fl79dWPz.js +1 -0
- package/dist/prompt-inquirer.d.ts +15 -0
- package/dist/prompt-inquirer.js +1 -0
- package/dist/prompt.d.ts +106 -0
- package/dist/prompt.js +1 -0
- package/dist/register-Ceh-HlVN.js +1 -0
- package/dist/registry-BEz5iex_.js +1 -0
- package/dist/runner-D-n1xa2K.js +33 -0
- package/dist/runner-nPWQnqQ3.js +1 -0
- package/dist/schema--6eHVfwR.js +1 -0
- package/dist/schema-extractor-DFawzmtj.js +1 -0
- package/dist/skill.d.ts +581 -0
- package/dist/skill.js +2 -0
- package/dist/subcommand-router-iqmWGZyU.js +2 -0
- package/dist/types-Dhar1ua6.d.ts +1125 -0
- package/dist/with-completion-command-CARvhYvv.d.ts +384 -0
- package/dist/with-completion-command-yg7HB6Zu.js +3 -0
- package/package.json +101 -3
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { L as UnknownKeysMode, V as ArgMeta, Z as ResolvedExpandCandidate, a as ArgsSchema, r as AnyCommand, tt as DynamicCompletionResolver } from "./types-Dhar1ua6.js";
|
|
2
|
+
//#region ../core/src/adapter/internal-args.d.ts
|
|
3
|
+
/** Runtime brand distinguishing internal descriptors from library schemas. */
|
|
4
|
+
declare const INTERNAL_ARGS_BRAND = "__polittyInternalArgs";
|
|
5
|
+
type InternalFieldKind = "string" | "boolean" | "enum" | "string-array";
|
|
6
|
+
interface InternalFieldSpec {
|
|
7
|
+
kind: InternalFieldKind;
|
|
8
|
+
/** Allowed values (enum kind only) */
|
|
9
|
+
enumValues?: readonly string[] | undefined;
|
|
10
|
+
/** Whether omitting the value is allowed without a default */
|
|
11
|
+
optional: boolean;
|
|
12
|
+
/** Default applied when the value is missing */
|
|
13
|
+
defaultValue?: unknown;
|
|
14
|
+
/**
|
|
15
|
+
* arg()-style metadata (description, positional, alias, ...).
|
|
16
|
+
* Stored as `ArgMeta<any>`: `ArgMeta`'s `effect` callback makes the type
|
|
17
|
+
* contravariant in its value parameter, so the precisely-typed metas the
|
|
18
|
+
* builders accept only unify under `any`.
|
|
19
|
+
*/
|
|
20
|
+
meta?: ArgMeta<any> | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An internal args schema. The `& ArgsSchema` half is a deliberate
|
|
24
|
+
* type-level fiction: the runtime object has none of a schema library's
|
|
25
|
+
* methods, but presenting it as an {@link ArgsSchema} lets internal
|
|
26
|
+
* commands flow through `defineCommand` and `Command<...>` without widening
|
|
27
|
+
* politty's public types. Nothing ever calls schema methods on it — the
|
|
28
|
+
* extract/validate facades check {@link isInternalArgsSchema} first.
|
|
29
|
+
*/
|
|
30
|
+
type InternalArgsSchema<TOut extends Record<string, unknown> = Record<string, unknown>> = {
|
|
31
|
+
readonly [INTERNAL_ARGS_BRAND]: true;
|
|
32
|
+
readonly fields: Record<string, InternalFieldSpec>;
|
|
33
|
+
readonly unknownKeys: UnknownKeysMode;
|
|
34
|
+
readonly __out?: TOut;
|
|
35
|
+
} & ArgsSchema;
|
|
36
|
+
/** Infer the validated output type of an {@link internalArgs} descriptor. */
|
|
37
|
+
type InferInternalArgs<S> = S extends {
|
|
38
|
+
readonly __out?: infer TOut;
|
|
39
|
+
} ? NonNullable<TOut> : never;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../core/src/completion/types.d.ts
|
|
42
|
+
/**
|
|
43
|
+
* A single resolved entry in an "expand" lookup table.
|
|
44
|
+
*
|
|
45
|
+
* `key` is the tuple of `dependsOn` values that triggers this entry, in the
|
|
46
|
+
* same order as the originating `dependsOn` array. `candidates` is the
|
|
47
|
+
* (already deduplicated) list returned by the user's `enumerate` callback
|
|
48
|
+
* for that combination.
|
|
49
|
+
*/
|
|
50
|
+
interface ExpandTableEntry {
|
|
51
|
+
readonly key: readonly string[];
|
|
52
|
+
readonly candidates: readonly ResolvedExpandCandidate[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Supported shell types for completion
|
|
56
|
+
*/
|
|
57
|
+
type ShellType = "bash" | "zsh" | "fish";
|
|
58
|
+
/**
|
|
59
|
+
* Completion script generation mode.
|
|
60
|
+
*
|
|
61
|
+
* - `dispatcher`: small runtime script that resolves the executable visible on
|
|
62
|
+
* PATH at TAB time and delegates to its `__complete` command.
|
|
63
|
+
* - `static`: self-contained script with command metadata baked in at
|
|
64
|
+
* generation time.
|
|
65
|
+
*/
|
|
66
|
+
type CompletionMode = "dispatcher" | "static";
|
|
67
|
+
/**
|
|
68
|
+
* Optional published worker artifact lookup.
|
|
69
|
+
*
|
|
70
|
+
* Paths are resolved relative to the visible executable's real directory.
|
|
71
|
+
* Templates may include `{shell}`, `{ext}`, and `{program}`.
|
|
72
|
+
*/
|
|
73
|
+
interface BundledWorkerOptions {
|
|
74
|
+
/** Disable bundled-worker lookup while keeping cache/dynamic fallbacks. */
|
|
75
|
+
disabled?: boolean | undefined;
|
|
76
|
+
/** Shell-specific worker paths relative to the executable directory. */
|
|
77
|
+
relativePaths?: Partial<Record<ShellType, readonly string[]>> | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Let dispatcher scripts ask the CLI for `__completion-worker-path <shell>`
|
|
80
|
+
* when package-relative lookup misses. Disabled by default because it starts
|
|
81
|
+
* the CLI process on that miss path.
|
|
82
|
+
*/
|
|
83
|
+
queryCommand?: boolean | undefined;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Options for completion generation
|
|
87
|
+
*/
|
|
88
|
+
interface CompletionOptions {
|
|
89
|
+
/** The shell type to generate completion for */
|
|
90
|
+
shell: ShellType;
|
|
91
|
+
/** The command name as it will be invoked */
|
|
92
|
+
programName: string;
|
|
93
|
+
/** Include subcommand completions (default: true) */
|
|
94
|
+
includeSubcommands?: boolean;
|
|
95
|
+
/** Include description in completions where supported (default: true) */
|
|
96
|
+
includeDescriptions?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Completion script mode.
|
|
99
|
+
*
|
|
100
|
+
* `generateCompletion` defaults to `static` when this is omitted. The
|
|
101
|
+
* `completion <shell>` subcommand passes `dispatcher` explicitly by default.
|
|
102
|
+
*/
|
|
103
|
+
mode?: CompletionMode;
|
|
104
|
+
/** Global args schema for deriving global options in completion */
|
|
105
|
+
globalArgsSchema?: ArgsSchema;
|
|
106
|
+
/**
|
|
107
|
+
* Path to the binary whose mtime is the freshness signature.
|
|
108
|
+
* Defaults to `process.argv[1]`.
|
|
109
|
+
*/
|
|
110
|
+
binPath?: string;
|
|
111
|
+
/** Program version to embed in the script header. */
|
|
112
|
+
programVersion?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Cache directory for the loader to write the regenerated script into.
|
|
115
|
+
* Defaults to `${XDG_CACHE_HOME:-$HOME/.cache}/<programName>` at runtime.
|
|
116
|
+
* Setting this hardcodes the location into the generated loader.
|
|
117
|
+
*/
|
|
118
|
+
cacheDir?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Internal static-worker generation hook used by dispatcher caches.
|
|
121
|
+
* Worker scripts define suffixed functions and skip shell registration.
|
|
122
|
+
*/
|
|
123
|
+
staticWorker?: {
|
|
124
|
+
functionSuffix: string;
|
|
125
|
+
};
|
|
126
|
+
/** Published static-worker artifact lookup used by dispatcher mode. */
|
|
127
|
+
bundledWorker?: BundledWorkerOptions | undefined;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Value completion specification for shell scripts.
|
|
131
|
+
*
|
|
132
|
+
* Discriminated by `type`. The `dynamic` variant carries a JS resolver that
|
|
133
|
+
* the static shell scripts delegate to via `<program> __complete`. All
|
|
134
|
+
* variants share the same optional metadata fields (left undefined where
|
|
135
|
+
* inapplicable) so consumers can read `vc.choices`/`vc.extensions`/etc.
|
|
136
|
+
* without narrowing first.
|
|
137
|
+
*/
|
|
138
|
+
type ValueCompletion = ({
|
|
139
|
+
/** Completion type */
|
|
140
|
+
type: "choices" | "file" | "directory" | "command" | "none";
|
|
141
|
+
/** List of valid choices (for "choices" type) */
|
|
142
|
+
choices?: string[];
|
|
143
|
+
/** Shell command for dynamic completion (for "command" type) */
|
|
144
|
+
shellCommand?: string;
|
|
145
|
+
resolve?: never;
|
|
146
|
+
dependsOn?: never;
|
|
147
|
+
table?: never;
|
|
148
|
+
} & ({
|
|
149
|
+
extensions?: string[];
|
|
150
|
+
matcher?: never;
|
|
151
|
+
} | {
|
|
152
|
+
/** Glob patterns for file matching (for "file" type) */ matcher?: string[];
|
|
153
|
+
extensions?: never;
|
|
154
|
+
})) | {
|
|
155
|
+
/** In-process dynamic completion via JS callback. */
|
|
156
|
+
type: "dynamic";
|
|
157
|
+
resolve: DynamicCompletionResolver;
|
|
158
|
+
choices?: never;
|
|
159
|
+
shellCommand?: never;
|
|
160
|
+
extensions?: never;
|
|
161
|
+
matcher?: never;
|
|
162
|
+
dependsOn?: never;
|
|
163
|
+
table?: never;
|
|
164
|
+
} | {
|
|
165
|
+
/**
|
|
166
|
+
* Pre-enumerated completion baked into the generated shell script.
|
|
167
|
+
* The `table` is the cartesian product of the `dependsOn` arg values
|
|
168
|
+
* (each having a static `choices` or enum schema). At completion time
|
|
169
|
+
* the shell dispatches on the runtime values of those args — no Node
|
|
170
|
+
* is spawned.
|
|
171
|
+
*/
|
|
172
|
+
type: "expand";
|
|
173
|
+
dependsOn: readonly string[];
|
|
174
|
+
table: readonly ExpandTableEntry[];
|
|
175
|
+
choices?: never;
|
|
176
|
+
shellCommand?: never;
|
|
177
|
+
resolve?: never;
|
|
178
|
+
extensions?: never;
|
|
179
|
+
matcher?: never;
|
|
180
|
+
} | {
|
|
181
|
+
/**
|
|
182
|
+
* Runtime form of `completion.custom.expand` used by `__complete`.
|
|
183
|
+
* The dispatcher invokes `__complete` at TAB time, so it can call the
|
|
184
|
+
* user's `enumerate` function against the already typed dependency
|
|
185
|
+
* values instead of baking a table into the shell script.
|
|
186
|
+
*/
|
|
187
|
+
type: "runtime-expand";
|
|
188
|
+
dependsOn: readonly string[];
|
|
189
|
+
enumerate: (deps: Readonly<Record<string, string>>) => ReadonlyArray<string | {
|
|
190
|
+
value: string;
|
|
191
|
+
description?: string;
|
|
192
|
+
}>;
|
|
193
|
+
choices?: never;
|
|
194
|
+
shellCommand?: never;
|
|
195
|
+
resolve?: never;
|
|
196
|
+
extensions?: never;
|
|
197
|
+
matcher?: never;
|
|
198
|
+
table?: never;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Information about a completable option
|
|
202
|
+
*/
|
|
203
|
+
interface CompletableOption {
|
|
204
|
+
/** Long option name (e.g., "verbose") */
|
|
205
|
+
name: string;
|
|
206
|
+
/** CLI name (kebab-case, e.g., "dry-run") */
|
|
207
|
+
cliName: string;
|
|
208
|
+
/**
|
|
209
|
+
* Aliases for this option (both short and long).
|
|
210
|
+
* 1-char entries are short (`-v`); multi-char entries are long (`--to-be`).
|
|
211
|
+
*/
|
|
212
|
+
alias?: string[] | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Negation name to advertise in shell completions (no `--` prefix),
|
|
215
|
+
* or `undefined` to hide the negation. Mirrors `ResolvedFieldMeta.negationDisplay`.
|
|
216
|
+
*/
|
|
217
|
+
negation?: string | undefined;
|
|
218
|
+
/** Description for the negation option (when distinct from the main description) */
|
|
219
|
+
negationDescription?: string | undefined;
|
|
220
|
+
/**
|
|
221
|
+
* Whether the runtime parser accepts the default `--no-<cliName>` (and
|
|
222
|
+
* camelCase) form for this boolean option. True only when the user set
|
|
223
|
+
* `negation: true`; false when unset, `negation: false`, or
|
|
224
|
+
* `negation: <custom name>`. Used by the completion context parser so
|
|
225
|
+
* dynamic resolvers see the same `parsedArgs` state the runtime would compute.
|
|
226
|
+
*/
|
|
227
|
+
defaultNegationAccepted?: boolean;
|
|
228
|
+
/** Description for completion */
|
|
229
|
+
description?: string | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* True when this option originates from a `globalArgsSchema` and was
|
|
232
|
+
* propagated into every subcommand frame. The runtime parser keeps
|
|
233
|
+
* global values visible across subcommand descent, so shell generators
|
|
234
|
+
* must keep their tracker buckets separate from per-frame state.
|
|
235
|
+
*/
|
|
236
|
+
isGlobal?: boolean;
|
|
237
|
+
/** Whether this option takes a value */
|
|
238
|
+
takesValue: boolean;
|
|
239
|
+
/** Type of value expected */
|
|
240
|
+
valueType: "string" | "number" | "boolean" | "array" | "unknown";
|
|
241
|
+
/** Whether the option is required */
|
|
242
|
+
required: boolean;
|
|
243
|
+
/** Value completion specification */
|
|
244
|
+
valueCompletion?: ValueCompletion | undefined;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Information about a positional argument for completion
|
|
248
|
+
*/
|
|
249
|
+
interface CompletablePositional {
|
|
250
|
+
/** Field name */
|
|
251
|
+
name: string;
|
|
252
|
+
/** CLI name (kebab-case) */
|
|
253
|
+
cliName: string;
|
|
254
|
+
/** Position index (0-based) */
|
|
255
|
+
position: number;
|
|
256
|
+
/** Description */
|
|
257
|
+
description?: string | undefined;
|
|
258
|
+
/** Whether required */
|
|
259
|
+
required: boolean;
|
|
260
|
+
/** Whether this positional accepts multiple values (array type) */
|
|
261
|
+
variadic?: boolean | undefined;
|
|
262
|
+
/** Value completion specification */
|
|
263
|
+
valueCompletion?: ValueCompletion | undefined;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Information about a subcommand for completion
|
|
267
|
+
*/
|
|
268
|
+
interface CompletableSubcommand {
|
|
269
|
+
/** Subcommand name */
|
|
270
|
+
name: string;
|
|
271
|
+
/** Subcommand description */
|
|
272
|
+
description?: string | undefined;
|
|
273
|
+
/** Alternative names (aliases) for this subcommand */
|
|
274
|
+
aliases?: string[] | undefined;
|
|
275
|
+
/** Nested subcommands */
|
|
276
|
+
subcommands: CompletableSubcommand[];
|
|
277
|
+
/** Options for this subcommand */
|
|
278
|
+
options: CompletableOption[];
|
|
279
|
+
/** Positional arguments */
|
|
280
|
+
positionals: CompletablePositional[];
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Extracted completion data from a command
|
|
284
|
+
*/
|
|
285
|
+
interface CompletionData {
|
|
286
|
+
/** The root command */
|
|
287
|
+
command: CompletableSubcommand;
|
|
288
|
+
/** Program name */
|
|
289
|
+
programName: string;
|
|
290
|
+
/** Global options (available to all subcommands) */
|
|
291
|
+
globalOptions: CompletableOption[];
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Result of completion generation
|
|
295
|
+
*/
|
|
296
|
+
interface CompletionResult {
|
|
297
|
+
/** The generated completion script */
|
|
298
|
+
script: string;
|
|
299
|
+
/** The shell type this script is for */
|
|
300
|
+
shell: ShellType;
|
|
301
|
+
/** Instructions for installing the completion */
|
|
302
|
+
installInstructions: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Generator function type for shell completions
|
|
306
|
+
*/
|
|
307
|
+
type CompletionGenerator = (command: AnyCommand, options: CompletionOptions) => CompletionResult;
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region ../core/src/completion/bundled-worker.d.ts
|
|
310
|
+
interface GenerateBundledCompletionWorkerOptions {
|
|
311
|
+
/** CLI binary or built JS entry file to invoke. */
|
|
312
|
+
bin: string;
|
|
313
|
+
/** Program name embedded in completion metadata. */
|
|
314
|
+
programName: string;
|
|
315
|
+
/** Shell worker to generate. */
|
|
316
|
+
shell: ShellType;
|
|
317
|
+
/** Output path. Defaults to `dist/completion/<shell>-worker.<ext>`. */
|
|
318
|
+
outputPath?: string | undefined;
|
|
319
|
+
/** Verify that `__completion-worker-path <shell>` resolves to the generated file. */
|
|
320
|
+
verify?: boolean | undefined;
|
|
321
|
+
/** Working directory used for relative paths. Defaults to `process.cwd()`. */
|
|
322
|
+
cwd?: string | undefined;
|
|
323
|
+
/** Extra environment passed to the target binary. */
|
|
324
|
+
env?: Readonly<Record<string, string | undefined>> | undefined;
|
|
325
|
+
/** Suppress the success message. */
|
|
326
|
+
quiet?: boolean | undefined;
|
|
327
|
+
}
|
|
328
|
+
interface GenerateBundledCompletionWorkerResult {
|
|
329
|
+
/** Absolute generated worker path. */
|
|
330
|
+
outputPath: string;
|
|
331
|
+
/** Generated file size in bytes. */
|
|
332
|
+
size: number;
|
|
333
|
+
/** Absolute path reported by `__completion-worker-path`, when verified. */
|
|
334
|
+
reportedPath?: string | undefined;
|
|
335
|
+
}
|
|
336
|
+
declare function bundledWorkerShellExtension(shell: ShellType): string;
|
|
337
|
+
declare function defaultBundledWorkerOutputPath(shell: ShellType): string;
|
|
338
|
+
declare function validateBundledWorkerFile(path: string, programName: string, shell: ShellType): void;
|
|
339
|
+
declare function generateBundledCompletionWorker(options: GenerateBundledCompletionWorkerOptions): Promise<GenerateBundledCompletionWorkerResult>;
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region ../core/src/completion/with-completion-command.d.ts
|
|
342
|
+
/**
|
|
343
|
+
* Options for withCompletionCommand
|
|
344
|
+
*/
|
|
345
|
+
interface WithCompletionOptions {
|
|
346
|
+
/** Override the program name (defaults to command.name) */
|
|
347
|
+
programName?: string;
|
|
348
|
+
/** Global args schema for deriving global options in completion */
|
|
349
|
+
globalArgsSchema?: ArgsSchema;
|
|
350
|
+
/**
|
|
351
|
+
* Hardcode the cache directory used by the rc loader and the
|
|
352
|
+
* background refresh. When omitted, the loader derives
|
|
353
|
+
* `${XDG_CACHE_HOME:-$HOME/.cache}/<programName>` at runtime, which
|
|
354
|
+
* is the right answer for almost every CLI.
|
|
355
|
+
*/
|
|
356
|
+
cacheDir?: string;
|
|
357
|
+
/** Program version embedded in the script header. */
|
|
358
|
+
programVersion?: string;
|
|
359
|
+
/** Published worker artifact lookup used by dispatcher mode. */
|
|
360
|
+
bundledWorker?: BundledWorkerOptions;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Wrap a command with a completion subcommand
|
|
364
|
+
*
|
|
365
|
+
* This avoids circular references that occur when a command references itself
|
|
366
|
+
* in its subCommands (e.g., for completion generation).
|
|
367
|
+
*
|
|
368
|
+
* @param command - The command to wrap
|
|
369
|
+
* @param options - Options including programName
|
|
370
|
+
* @returns A new command with the completion subcommand added
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* const mainCommand = withCompletionCommand(
|
|
375
|
+
* defineCommand({
|
|
376
|
+
* name: "mycli",
|
|
377
|
+
* subCommands: { ... },
|
|
378
|
+
* }),
|
|
379
|
+
* );
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
383
|
+
//#endregion
|
|
384
|
+
export { CompletionResult as _, bundledWorkerShellExtension as a, InferInternalArgs as b, validateBundledWorkerFile as c, CompletablePositional as d, CompletableSubcommand as f, CompletionOptions as g, CompletionMode as h, GenerateBundledCompletionWorkerResult as i, BundledWorkerOptions as l, CompletionGenerator as m, withCompletionCommand as n, defaultBundledWorkerOutputPath as o, CompletionData as p, GenerateBundledCompletionWorkerOptions as r, generateBundledCompletionWorker as s, WithCompletionOptions as t, CompletableOption as u, ShellType as v, InternalArgsSchema as x, ValueCompletion as y };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{d as e,u as t}from"./schema-extractor-DFawzmtj.js";import{n}from"./command-BXsTrIgI.js";import{s as r}from"./subcommand-router-iqmWGZyU.js";import{t as i}from"./schema--6eHVfwR.js";import{existsSync as a,readFileSync as o}from"node:fs";import{join as s}from"node:path";import{spawn as c}from"node:child_process";function l(){let e=(process.env.SHELL||``).split(`/`).pop()?.toLowerCase()||``;return e.includes(`bash`)?`bash`:e.includes(`zsh`)?`zsh`:e.includes(`fish`)?`fish`:null}function u(e){return`${process.env.XDG_CACHE_HOME??`${process.env.HOME??``}/.cache`}/${e}`}function d(e,t,n){if(t===`fish`){let t=process.env.XDG_CONFIG_HOME??`${process.env.HOME??``}/.config`;return s(t,`fish`,`completions`,`${e}.fish`)}let r=n??u(e);return s(r,`completion.${t}`)}function f(e){try{if(!a(e))return null;let t=o(e,`utf8`).split(`
|
|
2
|
+
`,6).join(`
|
|
3
|
+
`).match(/^# politty-bin-sig: (\S+)/m);return t?t[1]:null}catch{return null}}function p(e,t){return f(d(e.programName,t,e.cacheDir))!==null}function m(e,t){try{c(process.execPath,[e,`__refresh-completion`,t],{detached:!0,stdio:`ignore`}).unref()}catch{}}const h=t({shell:e.optionalEnum([`bash`,`zsh`,`fish`],{positional:!0,description:`Shell type (bash, zsh, or fish)`,placeholder:`SHELL`}),instructions:e.boolean({alias:`i`,description:`Show installation instructions`}),loader:e.boolean({description:`Print just the rc loader snippet (bash/zsh). Add it to ~/.bashrc or ~/.zshrc; it auto-regenerates the cache when the binary changes.`}),install:e.boolean({description:`Write the completion script to its on-disk cache (bash/zsh) or autoload location (fish) instead of printing it.`}),static:e.boolean({description:`Generate the legacy static completion script with command metadata baked in.`}),dispatcher:e.boolean({description:`Generate the runtime dispatcher completion script. This is the default.`}),worker:e.boolean({description:`Generate an internal static worker artifact for dispatcher mode.`})}),g=t({shell:e.enum([`bash`,`zsh`,`fish`],{positional:!0,description:`Shell to refresh`,placeholder:`SHELL`}),target:e.optionalString({positional:!0,description:`Existing politty-generated completion file to refresh`,placeholder:`TARGET`}),static:e.boolean({description:`Refresh using the legacy static completion script mode.`}),worker:e.boolean({description:`Refresh an internal static worker completion script.`})}),_=t({shell:e.enum([`bash`,`zsh`,`fish`],{positional:!0,description:`Shell worker to locate`,placeholder:`SHELL`})});function v(e,t){let{programName:a,globalArgsSchema:o,cacheDir:s,programVersion:c,bundledWorker:l}=typeof t==`string`?{programName:t}:t??{},u=a??e.name,d={...s!==void 0&&{cacheDir:s},...c!==void 0&&{programVersion:c},...o!==void 0&&{globalArgsSchema:o},...l!==void 0&&{bundledWorker:l}},f={...e};return f.subCommands={...e.subCommands,completion:r(n({name:`completion`,description:`Generate shell completion script`,args:h,run(){}}),()=>import(`./completion-BGidlN43.js`).then(e=>e.createCompletionCommand(f,a,o,d))),__complete:r(n({name:`__complete`,args:i,run(){}}),()=>import(`./dynamic-BbeRdUqR.js`).then(e=>e.createDynamicCompleteCommand(f,a,o))),"__refresh-completion":r(n({name:`__refresh-completion`,description:`(internal) Refresh the on-disk completion cache if stale.`,args:g,run(){}}),()=>import(`./completion-BGidlN43.js`).then(e=>e.createRefreshCompletionCommand(f,u,d))),"__completion-worker-path":r(n({name:`__completion-worker-path`,description:`(internal) Print the bundled completion worker path when available.`,args:_,run(){}}),()=>import(`./completion-BGidlN43.js`).then(e=>e.createCompletionWorkerPathCommand(u,d)))},f.runMainHook=e=>{y(e,{programName:u,...s!==void 0&&{cacheDir:s}})},f}function y(e,t){if(process.env.POLITTY_NO_COMPLETION_REFRESH)return;let n=e.find(e=>!e.startsWith(`-`));if(n===`__complete`||n===`__refresh-completion`||n===`__completion-worker-path`||n===`completion`)return;let r=l();if(!r)return;let i=process.argv[1];i&&p(t,r)&&m(i,r)}export{d as a,_ as i,h as n,f as o,g as r,l as s,v as t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,104 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@politty/loculus",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Politty CLI framework with flat loculus schemas",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"argument-parser",
|
|
7
|
+
"cli",
|
|
8
|
+
"command-line",
|
|
9
|
+
"loculus",
|
|
10
|
+
"type-safe",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "toiroakr",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/toiroakr/politty.git",
|
|
18
|
+
"directory": "packages/loculus"
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"politty": "./bin/cli.mjs"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"bin/cli.mjs",
|
|
25
|
+
"dist/**/*.js",
|
|
26
|
+
"dist/**/*.d.ts",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./compile-cache": {
|
|
38
|
+
"types": "./dist/compile-cache.d.ts",
|
|
39
|
+
"default": "./dist/compile-cache.js"
|
|
40
|
+
},
|
|
41
|
+
"./agent": {
|
|
42
|
+
"types": "./dist/agent.d.ts",
|
|
43
|
+
"default": "./dist/agent.js"
|
|
44
|
+
},
|
|
45
|
+
"./docs": {
|
|
46
|
+
"types": "./dist/docs.d.ts",
|
|
47
|
+
"default": "./dist/docs.js"
|
|
48
|
+
},
|
|
49
|
+
"./completion": {
|
|
50
|
+
"types": "./dist/completion.d.ts",
|
|
51
|
+
"default": "./dist/completion.js"
|
|
52
|
+
},
|
|
53
|
+
"./skill": {
|
|
54
|
+
"types": "./dist/skill.d.ts",
|
|
55
|
+
"default": "./dist/skill.js"
|
|
56
|
+
},
|
|
57
|
+
"./prompt": {
|
|
58
|
+
"types": "./dist/prompt.d.ts",
|
|
59
|
+
"default": "./dist/prompt.js"
|
|
60
|
+
},
|
|
61
|
+
"./prompt/clack": {
|
|
62
|
+
"types": "./dist/prompt-clack.d.ts",
|
|
63
|
+
"default": "./dist/prompt-clack.js"
|
|
64
|
+
},
|
|
65
|
+
"./prompt/inquirer": {
|
|
66
|
+
"types": "./dist/prompt-inquirer.d.ts",
|
|
67
|
+
"default": "./dist/prompt-inquirer.js"
|
|
68
|
+
},
|
|
69
|
+
"./cli": {
|
|
70
|
+
"types": "./dist/cli.d.ts",
|
|
71
|
+
"default": "./dist/cli.js"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"yaml": "^2.9.1"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@politty/core": "0.1.0",
|
|
79
|
+
"@types/node": "25.9.9",
|
|
80
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
81
|
+
"loculus": "0.2.5",
|
|
82
|
+
"tsdown": "0.23.0",
|
|
83
|
+
"typescript": "7.0.2"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"@clack/prompts": "^0.10.0 || ^0.11.0 || ^1.0.0",
|
|
87
|
+
"@inquirer/prompts": "^8.3.2",
|
|
88
|
+
"loculus": "^0.2.5"
|
|
89
|
+
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"@clack/prompts": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@inquirer/prompts": {
|
|
95
|
+
"optional": true
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"engines": {
|
|
99
|
+
"node": ">=22.18.0"
|
|
100
|
+
},
|
|
101
|
+
"scripts": {
|
|
102
|
+
"build": "tsdown"
|
|
103
|
+
}
|
|
6
104
|
}
|