politty 0.10.0 → 0.11.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.
- package/dist/{arg-registry-BN3I-XON.d.ts → arg-registry-aHbip9Hs.d.ts} +11 -13
- package/dist/augment.d.ts +1 -1
- package/dist/cli.js +2 -2
- package/dist/completion/index.d.ts +2 -2
- package/dist/completion/index.js +1 -1
- package/dist/{completion-DwTFOtQk.js → completion-CqKX9sCR.js} +28 -18
- package/dist/docs/index.d.ts +1 -1
- package/dist/docs/index.js +2 -2
- package/dist/{index-CtRrTVTL.d.ts → index-dRZSB_t3.d.ts} +7 -8
- package/dist/index.d.ts +7 -7
- package/dist/index.js +3 -3
- package/dist/prompt/clack/index.d.ts +1 -1
- package/dist/prompt/index.d.ts +1 -1
- package/dist/prompt/inquirer/index.d.ts +1 -1
- package/dist/{runner-DZOmYkN0.js → runner-Z7R_XvAV.js} +85 -52
- package/dist/{schema-extractor-CVHWm23M.js → schema-extractor-DnOTAjV_.js} +2 -2
- package/dist/skill/index.d.ts +1 -1
- package/package.json +5 -5
|
@@ -57,8 +57,7 @@ interface ResolvedFieldMeta {
|
|
|
57
57
|
* help, generated docs, and shell completions.
|
|
58
58
|
* - `false`: neither the default `--no-<cliName>` nor any custom name is
|
|
59
59
|
* accepted; the field only responds to the positive flag.
|
|
60
|
-
* - `undefined`:
|
|
61
|
-
* but hidden from help/docs/completions.
|
|
60
|
+
* - `undefined`: no negation form is accepted or shown.
|
|
62
61
|
*
|
|
63
62
|
* Only applies to boolean fields; populated as `undefined` otherwise.
|
|
64
63
|
*/
|
|
@@ -758,18 +757,17 @@ interface BaseArgMeta<TValue = unknown> {
|
|
|
758
757
|
/**
|
|
759
758
|
* Control the boolean negation option.
|
|
760
759
|
*
|
|
761
|
-
* Boolean fields
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
760
|
+
* Boolean fields accept `--no-<cliName>` (and the camelCase `--no<Name>`
|
|
761
|
+
* form) to set the value to `false` only when `negation: true` is set.
|
|
762
|
+
* By default no negation form is accepted. This option lets you customize
|
|
763
|
+
* or expose that behavior:
|
|
765
764
|
*
|
|
766
765
|
* - `string` — replaces the auto-generated `--no-*` form with a custom
|
|
767
766
|
* name. The default `--no-*` is no longer recognized.
|
|
768
|
-
* - `true` —
|
|
769
|
-
* help, generated docs, and shell completions.
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
* nor any custom name is accepted.
|
|
767
|
+
* - `true` — enables the default `--no-<cliName>` form and advertises it
|
|
768
|
+
* in help, generated docs, and shell completions.
|
|
769
|
+
* - `false` — disables negation entirely; same as the default, but explicit.
|
|
770
|
+
* Neither the default `--no-*` nor any custom name is accepted.
|
|
773
771
|
*
|
|
774
772
|
* String values follow the same naming conventions as `cliName`
|
|
775
773
|
* (kebab-case is recommended). Only valid on boolean fields; setting
|
|
@@ -786,7 +784,7 @@ interface BaseArgMeta<TValue = unknown> {
|
|
|
786
784
|
* // Accepts: --cache (true), --disable-cache (false)
|
|
787
785
|
* // No longer accepts: --no-cache
|
|
788
786
|
*
|
|
789
|
-
* //
|
|
787
|
+
* // Enable default `--no-X` in parsing/help/docs/completion
|
|
790
788
|
* verbose: arg(z.boolean().default(false), {
|
|
791
789
|
* negation: true,
|
|
792
790
|
* })
|
|
@@ -941,4 +939,4 @@ declare function arg<T extends z.ZodType>(schema: T): T;
|
|
|
941
939
|
declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M, z.output<T>>): T;
|
|
942
940
|
//#endregion
|
|
943
941
|
export { toKebabCase as $, LogStream as A, SetupContext as B, Example as C, IsEmpty as D, GlobalSetupContext as E, RunCommandOptions as F, isLazyCommand as G, SubCommandsRecord as H, RunResult as I, ResolvedFieldMeta as J, lazy as K, RunResultFailure as L, MainOptions as M, NonRunnableCommand as N, LogEntry as O, PromptResolver as P, toCamelCase as Q, RunResultSuccess as R, CommandBase as S, GlobalCleanupContext as T, UnknownSubcommandHandler as U, SubCommandValue as V, LazyCommand as W, extractFields as X, UnknownKeysMode as Y, getUnknownKeysMode as Z, AnyCommand as _, EffectContext as a, CollectedLogs as b, arg as c, ResolvedExpandCandidate as d, CompletionDirectiveMask as f, DynamicCompletionResult as g, DynamicCompletionResolver as h, CustomCompletion as i, Logger as j, LogLevel as k, ExpandCandidate as l, DynamicCompletionContext as m, CompletionMeta as n, PromptMeta as o, DynamicCompletionCandidate as p, ExtractedFields as q, CompletionType as r, PromptType as s, ArgMeta as t, ExpandCompletion as u, ArgsSchema as v, GlobalArgs as w, Command as x, CleanupContext as y, RunnableCommand as z };
|
|
944
|
-
//# sourceMappingURL=arg-registry-
|
|
942
|
+
//# sourceMappingURL=arg-registry-aHbip9Hs.d.ts.map
|
package/dist/augment.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as runMain } from "./runner-
|
|
2
|
+
import { n as runMain } from "./runner-Z7R_XvAV.js";
|
|
3
3
|
import { t as arg } from "./arg-registry-BeLLAW5-.js";
|
|
4
4
|
import { n as defineCommand } from "./command-B4yA4LXX.js";
|
|
5
|
-
import { p as generateBundledCompletionWorker } from "./completion-
|
|
5
|
+
import { p as generateBundledCompletionWorker } from "./completion-CqKX9sCR.js";
|
|
6
6
|
import "./index.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, m as DynamicCompletionContext, p as DynamicCompletionCandidate } from "../arg-registry-
|
|
2
|
-
import { A as BundledWorkerOptions, C as CandidateResult, D as CompletionContext, E as generateCandidates, F as CompletionMode, I as CompletionOptions, L as CompletionResult, M as CompletableSubcommand, N as CompletionData, O as CompletionType, P as CompletionGenerator, R as ShellType, S as hasCompleteCommand, T as CompletionDirective, _ as extractCompletionData, a as detectShell, b as formatForShell, c as withCompletionCommand, d as GenerateBundledCompletionWorkerOptions, f as GenerateBundledCompletionWorkerResult, g as validateBundledWorkerFile, h as generateBundledCompletionWorker, i as createRefreshCompletionCommand, j as CompletableOption, k as parseCompletionContext, l as ValueCompletionField, m as defaultBundledWorkerOutputPath, n as createCompletionCommand, o as generateCompletion, p as bundledWorkerShellExtension, r as createCompletionWorkerPathCommand, s as getSupportedShells, t as WithCompletionOptions, u as resolveValueCompletion, v as extractPositionals, w as CompletionCandidate, x as createDynamicCompleteCommand, y as ShellFormatOptions } from "../index-
|
|
1
|
+
import { f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, m as DynamicCompletionContext, p as DynamicCompletionCandidate } from "../arg-registry-aHbip9Hs.js";
|
|
2
|
+
import { A as BundledWorkerOptions, C as CandidateResult, D as CompletionContext, E as generateCandidates, F as CompletionMode, I as CompletionOptions, L as CompletionResult, M as CompletableSubcommand, N as CompletionData, O as CompletionType, P as CompletionGenerator, R as ShellType, S as hasCompleteCommand, T as CompletionDirective, _ as extractCompletionData, a as detectShell, b as formatForShell, c as withCompletionCommand, d as GenerateBundledCompletionWorkerOptions, f as GenerateBundledCompletionWorkerResult, g as validateBundledWorkerFile, h as generateBundledCompletionWorker, i as createRefreshCompletionCommand, j as CompletableOption, k as parseCompletionContext, l as ValueCompletionField, m as defaultBundledWorkerOutputPath, n as createCompletionCommand, o as generateCompletion, p as bundledWorkerShellExtension, r as createCompletionWorkerPathCommand, s as getSupportedShells, t as WithCompletionOptions, u as resolveValueCompletion, v as extractPositionals, w as CompletionCandidate, x as createDynamicCompleteCommand, y as ShellFormatOptions } from "../index-dRZSB_t3.js";
|
|
3
3
|
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 };
|
package/dist/completion/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-CqKX9sCR.js";
|
|
2
2
|
|
|
3
3
|
export { CompletionDirective, bundledWorkerShellExtension, createCompletionCommand, createCompletionWorkerPathCommand, createDynamicCompleteCommand, createRefreshCompletionCommand, defaultBundledWorkerOutputPath, detectShell, extractCompletionData, extractPositionals, formatForShell, generateBundledCompletionWorker, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, validateBundledWorkerFile, withCompletionCommand };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as arg } from "./arg-registry-BeLLAW5-.js";
|
|
2
2
|
import { n as defineCommand } from "./command-B4yA4LXX.js";
|
|
3
|
-
import { a as toCamelCase, m as resolveSubCommandMeta, n as getAllAliases, t as extractFields, u as resolveSubCommandAlias } from "./schema-extractor-
|
|
3
|
+
import { a as toCamelCase, m as resolveSubCommandMeta, n as getAllAliases, t as extractFields, u as resolveSubCommandAlias } from "./schema-extractor-DnOTAjV_.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { execFile, execSync, spawn } from "node:child_process";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -316,7 +316,7 @@ function extractOptionsFromSchema(schema) {
|
|
|
316
316
|
takesValue: field.type !== "boolean",
|
|
317
317
|
valueType: field.type,
|
|
318
318
|
required: field.required,
|
|
319
|
-
defaultNegationAccepted: field.type === "boolean" &&
|
|
319
|
+
defaultNegationAccepted: field.type === "boolean" && field.negation === true,
|
|
320
320
|
valueCompletion: resolveRuntimeCompletion(resolveValueCompletion(field))
|
|
321
321
|
};
|
|
322
322
|
});
|
|
@@ -376,7 +376,13 @@ function parsePreSubGlobals(tokens, globalOptions, globalParsedArgs) {
|
|
|
376
376
|
}
|
|
377
377
|
const parsed = parseOption(word);
|
|
378
378
|
const opt = findOption(globalOptions, parsed);
|
|
379
|
-
if (!opt)
|
|
379
|
+
if (!opt) {
|
|
380
|
+
if (isSuppressedDefaultNegation(globalOptions, parsed)) {
|
|
381
|
+
i++;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
380
386
|
if (opt.takesValue) if (hasInlineValue(word)) {
|
|
381
387
|
const eqIdx = word.indexOf("=");
|
|
382
388
|
writeGlobal(opt, word.slice(eqIdx + 1));
|
|
@@ -513,20 +519,18 @@ function hasInlineValue(word) {
|
|
|
513
519
|
return word.includes("=");
|
|
514
520
|
}
|
|
515
521
|
/**
|
|
516
|
-
* For boolean options, the runtime parser accepts the
|
|
517
|
-
* `--no-<cliName>` (and camelCase `--noCliName`) form
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
* being read as a negation.
|
|
522
|
+
* For boolean options, the runtime parser accepts the default
|
|
523
|
+
* `--no-<cliName>` (and camelCase `--noCliName`) form only when the user
|
|
524
|
+
* opts in via `negation: true`. Aliases participate too: a boolean with
|
|
525
|
+
* `alias: "c", negation: true` accepts `--no-c` / `--noC` because the
|
|
526
|
+
* runtime resolves the post-`no-` segment through `aliasMap`. Default
|
|
527
|
+
* negation is LONG-FORM only — `-no-c` is never an accepted negation — so
|
|
528
|
+
* callers must say so via `isLong` to prevent a short option from being read
|
|
529
|
+
* as a negation.
|
|
525
530
|
*/
|
|
526
|
-
function
|
|
531
|
+
function isDefaultBooleanNegationToken(opt, name, isLong) {
|
|
527
532
|
if (!isLong) return false;
|
|
528
533
|
if (opt.valueType !== "boolean") return false;
|
|
529
|
-
if (opt.defaultNegationAccepted === false) return false;
|
|
530
534
|
const candidates = [opt.cliName, ...opt.alias ?? []];
|
|
531
535
|
for (const c of candidates) {
|
|
532
536
|
const hyphenated = `no-${c}`;
|
|
@@ -535,6 +539,12 @@ function isImplicitBooleanNegation(opt, name, isLong) {
|
|
|
535
539
|
}
|
|
536
540
|
return false;
|
|
537
541
|
}
|
|
542
|
+
function isImplicitBooleanNegation(opt, name, isLong) {
|
|
543
|
+
return opt.defaultNegationAccepted === true && isDefaultBooleanNegationToken(opt, name, isLong);
|
|
544
|
+
}
|
|
545
|
+
function isSuppressedDefaultNegation(options, parsed) {
|
|
546
|
+
return options.some((opt) => opt.defaultNegationAccepted !== true && isDefaultBooleanNegationToken(opt, parsed.name, parsed.isLong));
|
|
547
|
+
}
|
|
538
548
|
/** True when `source` is hyphenated and its camelCase form equals `name`. */
|
|
539
549
|
function matchesCamelCase(source, name) {
|
|
540
550
|
return source !== void 0 && source.includes("-") && toCamelCase(source) === name;
|
|
@@ -561,8 +571,8 @@ function writeOptionValue(target, opt, value, arraysSeenInFrame) {
|
|
|
561
571
|
}
|
|
562
572
|
/**
|
|
563
573
|
* True when the typed token is the boolean option's negation form — either
|
|
564
|
-
* the explicit `negation` name (or its camelCase variant) or the
|
|
565
|
-
* `--no-<name>` form. Long-form only; short tokens are never negations.
|
|
574
|
+
* the explicit `negation` name (or its camelCase variant) or the opt-in
|
|
575
|
+
* default `--no-<name>` form. Long-form only; short tokens are never negations.
|
|
566
576
|
*/
|
|
567
577
|
function isNegationOf(opt, parsed) {
|
|
568
578
|
if (!parsed.isLong) return false;
|
|
@@ -1412,7 +1422,7 @@ function getSubNamesWithAliases(subs) {
|
|
|
1412
1422
|
* sibling choices are known.
|
|
1413
1423
|
*/
|
|
1414
1424
|
function fieldToOption(field, pending) {
|
|
1415
|
-
const defaultNegationAccepted = field.type === "boolean" &&
|
|
1425
|
+
const defaultNegationAccepted = field.type === "boolean" && field.negation === true;
|
|
1416
1426
|
const opt = {
|
|
1417
1427
|
name: field.name,
|
|
1418
1428
|
cliName: field.cliName,
|
|
@@ -5596,4 +5606,4 @@ function maybeSpawnRefresh(argv, ctx) {
|
|
|
5596
5606
|
|
|
5597
5607
|
//#endregion
|
|
5598
5608
|
export { CompletionDirective as _, generateCompletion as a, resolveValueCompletion as b, createDynamicCompleteCommand as c, bundledWorkerShellExtension as d, defaultBundledWorkerOutputPath as f, extractPositionals as g, extractCompletionData as h, detectShell as i, hasCompleteCommand as l, validateBundledWorkerFile as m, createCompletionWorkerPathCommand as n, getSupportedShells as o, generateBundledCompletionWorker as p, createRefreshCompletionCommand as r, withCompletionCommand as s, createCompletionCommand as t, formatForShell as u, generateCandidates as v, parseCompletionContext as y };
|
|
5599
|
-
//# sourceMappingURL=completion-
|
|
5609
|
+
//# sourceMappingURL=completion-CqKX9sCR.js.map
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Example, J as ResolvedFieldMeta, V as SubCommandValue, _ as AnyCommand, q as ExtractedFields, v as ArgsSchema } from "../arg-registry-
|
|
1
|
+
import { C as Example, J as ResolvedFieldMeta, V as SubCommandValue, _ as AnyCommand, q as ExtractedFields, v as ArgsSchema } from "../arg-registry-aHbip9Hs.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
|
package/dist/docs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as resolveLazyCommand, r as getExtractedFields, t as extractFields } from "../schema-extractor-
|
|
1
|
+
import { l as resolveLazyCommand, r as getExtractedFields, t as extractFields } from "../schema-extractor-DnOTAjV_.js";
|
|
2
2
|
import { t as createLogCollector } from "../log-collector-DK32-73m.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import * as fs from "node:fs";
|
|
@@ -919,7 +919,7 @@ async function executeSingleExample(example, rootCommand, commandPath) {
|
|
|
919
919
|
collector.start();
|
|
920
920
|
let success = true;
|
|
921
921
|
try {
|
|
922
|
-
const { runCommand } = await import("../runner-
|
|
922
|
+
const { runCommand } = await import("../runner-Z7R_XvAV.js").then((n) => n.r);
|
|
923
923
|
const result = await runCommand(rootCommand, argv);
|
|
924
924
|
success = result.success;
|
|
925
925
|
if (!result.success && result.error) console.error(result.error.message);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as ResolvedFieldMeta, _ as AnyCommand, d as ResolvedExpandCandidate, h as DynamicCompletionResolver, u as ExpandCompletion, v as ArgsSchema, x as Command } from "./arg-registry-
|
|
1
|
+
import { J as ResolvedFieldMeta, _ as AnyCommand, d as ResolvedExpandCandidate, h as DynamicCompletionResolver, u as ExpandCompletion, v as ArgsSchema, x as Command } from "./arg-registry-aHbip9Hs.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/completion/types.d.ts
|
|
@@ -177,12 +177,11 @@ interface CompletableOption {
|
|
|
177
177
|
/** Description for the negation option (when distinct from the main description) */
|
|
178
178
|
negationDescription?: string | undefined;
|
|
179
179
|
/**
|
|
180
|
-
* Whether the runtime parser accepts the
|
|
181
|
-
* camelCase) form for this boolean option.
|
|
182
|
-
* `negation: false
|
|
183
|
-
* custom name
|
|
184
|
-
* dynamic resolvers see the same `parsedArgs` state the runtime would
|
|
185
|
-
* compute.
|
|
180
|
+
* Whether the runtime parser accepts the default `--no-<cliName>` (and
|
|
181
|
+
* camelCase) form for this boolean option. True only when the user set
|
|
182
|
+
* `negation: true`; false when unset, `negation: false`, or
|
|
183
|
+
* `negation: <custom name>`. Used by the completion context parser so
|
|
184
|
+
* dynamic resolvers see the same `parsedArgs` state the runtime would compute.
|
|
186
185
|
*/
|
|
187
186
|
defaultNegationAccepted?: boolean;
|
|
188
187
|
/** Description for completion */
|
|
@@ -660,4 +659,4 @@ interface WithCompletionOptions {
|
|
|
660
659
|
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
661
660
|
//#endregion
|
|
662
661
|
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 };
|
|
663
|
-
//# sourceMappingURL=index-
|
|
662
|
+
//# sourceMappingURL=index-dRZSB_t3.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as toKebabCase, A as LogStream, B as SetupContext, C as Example, D as IsEmpty, E as GlobalSetupContext, F as RunCommandOptions, G as isLazyCommand, H as SubCommandsRecord, I as RunResult, J as ResolvedFieldMeta, K as lazy, L as RunResultFailure, M as MainOptions, N as NonRunnableCommand, O as LogEntry, P as PromptResolver, Q as toCamelCase, R as RunResultSuccess, S as CommandBase, T as GlobalCleanupContext, U as UnknownSubcommandHandler, V as SubCommandValue, W as LazyCommand, X as extractFields, Y as UnknownKeysMode, Z as getUnknownKeysMode, _ as AnyCommand, a as EffectContext, b as CollectedLogs, c as arg, d as ResolvedExpandCandidate, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as Logger, k as LogLevel, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as ExtractedFields, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgsSchema, w as GlobalArgs, x as Command, y as CleanupContext, z as RunnableCommand } from "./arg-registry-
|
|
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-
|
|
1
|
+
import { $ as toKebabCase, A as LogStream, B as SetupContext, C as Example, D as IsEmpty, E as GlobalSetupContext, F as RunCommandOptions, G as isLazyCommand, H as SubCommandsRecord, I as RunResult, J as ResolvedFieldMeta, K as lazy, L as RunResultFailure, M as MainOptions, N as NonRunnableCommand, O as LogEntry, P as PromptResolver, Q as toCamelCase, R as RunResultSuccess, S as CommandBase, T as GlobalCleanupContext, U as UnknownSubcommandHandler, V as SubCommandValue, W as LazyCommand, X as extractFields, Y as UnknownKeysMode, Z as getUnknownKeysMode, _ as AnyCommand, a as EffectContext, b as CollectedLogs, c as arg, d as ResolvedExpandCandidate, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as Logger, k as LogLevel, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as ExtractedFields, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgsSchema, w as GlobalArgs, x as Command, y as CleanupContext, z as RunnableCommand } from "./arg-registry-aHbip9Hs.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-dRZSB_t3.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/case-types.d.ts
|
|
@@ -458,11 +458,11 @@ interface ParserOptions {
|
|
|
458
458
|
*/
|
|
459
459
|
negationMap?: Map<string, string>;
|
|
460
460
|
/**
|
|
461
|
-
* Canonical field names
|
|
462
|
-
*
|
|
463
|
-
*
|
|
461
|
+
* Canonical field names whose default `--no-<name>` / `--no<Name>`
|
|
462
|
+
* negation forms are suppressed. When omitted, every field in
|
|
463
|
+
* `booleanFlags` has default negation suppressed.
|
|
464
464
|
*/
|
|
465
|
-
|
|
465
|
+
defaultNegationDisabledFields?: Set<string>;
|
|
466
466
|
}
|
|
467
467
|
/**
|
|
468
468
|
* Parse argv into a flat record
|
|
@@ -473,7 +473,7 @@ interface ParserOptions {
|
|
|
473
473
|
* - Combined short options: -abc (treated as -a -b -c if all are boolean)
|
|
474
474
|
* - Positional arguments
|
|
475
475
|
* - -- to stop parsing options
|
|
476
|
-
* - Boolean negation: --no-flag, --noFlag (requires `booleanFlags`)
|
|
476
|
+
* - Boolean negation: --no-flag, --noFlag (requires `booleanFlags` and `negation: true`)
|
|
477
477
|
*
|
|
478
478
|
* **Note:** When using negation detection (`--noFlag` / `--no-flag`),
|
|
479
479
|
* supply `definedNames` so that options whose names happen to start with
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as renderMarkdown, S as renderInline, _ as DuplicateFieldError, a as parseArgv, b as ReservedAliasError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as DuplicateAliasError, h as CaseVariantCollisionError, 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 DuplicateNegationError, w as createDualCaseProxy, x as generateHelp, y as PositionalConfigError } from "./runner-
|
|
1
|
+
import { C as renderMarkdown, S as renderInline, _ as DuplicateFieldError, a as parseArgv, b as ReservedAliasError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as DuplicateAliasError, h as CaseVariantCollisionError, 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 DuplicateNegationError, w as createDualCaseProxy, x as generateHelp, y as PositionalConfigError } from "./runner-Z7R_XvAV.js";
|
|
2
2
|
import { t as arg } from "./arg-registry-BeLLAW5-.js";
|
|
3
3
|
import { n as defineCommand, t as createDefineCommand } from "./command-B4yA4LXX.js";
|
|
4
|
-
import { a as toCamelCase, f as isLazyCommand, i as getUnknownKeysMode, o as toKebabCase, p as lazy, t as extractFields } from "./schema-extractor-
|
|
5
|
-
import { a as generateCompletion, p as generateBundledCompletionWorker, s as withCompletionCommand } from "./completion-
|
|
4
|
+
import { a as toCamelCase, f as isLazyCommand, i as getUnknownKeysMode, o as toKebabCase, p as lazy, t as extractFields } from "./schema-extractor-DnOTAjV_.js";
|
|
5
|
+
import { a as generateCompletion, p as generateBundledCompletionWorker, s as withCompletionCommand } from "./completion-CqKX9sCR.js";
|
|
6
6
|
import { a as symbols, i as styles, n as logger, r as setColorEnabled, t as isColorEnabled } from "./logger-DbDkjdfO.js";
|
|
7
7
|
|
|
8
8
|
export { CaseVariantCollisionError, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, PositionalConfigError, ReservedAliasError, 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, withCompletionCommand };
|
package/dist/prompt/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as toCamelCase, c as listSubCommands, d as resolveSubcommandWithAlias, f as isLazyCommand, l as resolveLazyCommand, m as resolveSubCommandMeta, n as getAllAliases, o as toKebabCase, r as getExtractedFields, s as listSubCommandNamesWithAliases, t as extractFields } from "./schema-extractor-
|
|
1
|
+
import { a as toCamelCase, c as listSubCommands, d as resolveSubcommandWithAlias, f as isLazyCommand, l as resolveLazyCommand, m as resolveSubCommandMeta, n as getAllAliases, o as toKebabCase, r as getExtractedFields, s as listSubCommandNamesWithAliases, t as extractFields } from "./schema-extractor-DnOTAjV_.js";
|
|
2
2
|
import { n as emptyLogs, r as mergeLogs, t as createLogCollector } from "./log-collector-DK32-73m.js";
|
|
3
3
|
import { a as symbols, i as styles } from "./logger-DbDkjdfO.js";
|
|
4
4
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -1104,7 +1104,7 @@ function checkDuplicateNegations(extracted, commandPath) {
|
|
|
1104
1104
|
if (camelVariant !== alias) claim(camelVariant, field.name, "alias");
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
|
-
if (field.type === "boolean" && field.negation
|
|
1107
|
+
if (field.type === "boolean" && field.negation === true) {
|
|
1108
1108
|
const defaultKebab = `no-${field.cliName}`;
|
|
1109
1109
|
claim(defaultKebab, field.name, "default negation");
|
|
1110
1110
|
const camelBase = toCamelCase(field.cliName);
|
|
@@ -1443,7 +1443,7 @@ function resolveLongOption(arg, lookup) {
|
|
|
1443
1443
|
if (lookup.booleanFlags.has(resolvedName)) {
|
|
1444
1444
|
const asIsResolved = lookup.aliasMap.get(withoutDashes) ?? withoutDashes;
|
|
1445
1445
|
if (!lookup.definedNames.has(asIsResolved)) {
|
|
1446
|
-
if (lookup.
|
|
1446
|
+
if (lookup.defaultNegationDisabledFields.has(resolvedName)) return {
|
|
1447
1447
|
resolvedName,
|
|
1448
1448
|
withoutDashes,
|
|
1449
1449
|
isNegated: false,
|
|
@@ -1467,7 +1467,7 @@ function resolveLongOption(arg, lookup) {
|
|
|
1467
1467
|
if (lookup.booleanFlags.has(resolvedName)) {
|
|
1468
1468
|
const asIsResolved = lookup.aliasMap.get(withoutDashes) ?? withoutDashes;
|
|
1469
1469
|
if (!lookup.definedNames.has(asIsResolved)) {
|
|
1470
|
-
if (lookup.
|
|
1470
|
+
if (lookup.defaultNegationDisabledFields.has(resolvedName)) return {
|
|
1471
1471
|
resolvedName,
|
|
1472
1472
|
withoutDashes,
|
|
1473
1473
|
isNegated: false,
|
|
@@ -1504,7 +1504,7 @@ function resolveLongOption(arg, lookup) {
|
|
|
1504
1504
|
* - Combined short options: -abc (treated as -a -b -c if all are boolean)
|
|
1505
1505
|
* - Positional arguments
|
|
1506
1506
|
* - -- to stop parsing options
|
|
1507
|
-
* - Boolean negation: --no-flag, --noFlag (requires `booleanFlags`)
|
|
1507
|
+
* - Boolean negation: --no-flag, --noFlag (requires `booleanFlags` and `negation: true`)
|
|
1508
1508
|
*
|
|
1509
1509
|
* **Note:** When using negation detection (`--noFlag` / `--no-flag`),
|
|
1510
1510
|
* supply `definedNames` so that options whose names happen to start with
|
|
@@ -1517,13 +1517,13 @@ function resolveLongOption(arg, lookup) {
|
|
|
1517
1517
|
* @returns Parsed arguments
|
|
1518
1518
|
*/
|
|
1519
1519
|
function parseArgv(argv, options = {}) {
|
|
1520
|
-
const { aliasMap = /* @__PURE__ */ new Map(), booleanFlags = /* @__PURE__ */ new Set(), arrayFlags = /* @__PURE__ */ new Set(), definedNames = /* @__PURE__ */ new Set(), negationMap = /* @__PURE__ */ new Map(),
|
|
1520
|
+
const { aliasMap = /* @__PURE__ */ new Map(), booleanFlags = /* @__PURE__ */ new Set(), arrayFlags = /* @__PURE__ */ new Set(), definedNames = /* @__PURE__ */ new Set(), negationMap = /* @__PURE__ */ new Map(), defaultNegationDisabledFields: configuredDefaultNegationDisabledFields } = options;
|
|
1521
1521
|
const longOptionLookup = {
|
|
1522
1522
|
aliasMap,
|
|
1523
1523
|
booleanFlags,
|
|
1524
1524
|
definedNames,
|
|
1525
1525
|
negationMap,
|
|
1526
|
-
|
|
1526
|
+
defaultNegationDisabledFields: configuredDefaultNegationDisabledFields ?? new Set(booleanFlags)
|
|
1527
1527
|
};
|
|
1528
1528
|
const result = {
|
|
1529
1529
|
options: {},
|
|
@@ -1556,6 +1556,11 @@ function parseArgv(argv, options = {}) {
|
|
|
1556
1556
|
if (arg.startsWith("--")) {
|
|
1557
1557
|
const withoutDashes = arg.slice(2);
|
|
1558
1558
|
const resolution = resolveLongOption(arg, longOptionLookup);
|
|
1559
|
+
if (resolution.isSuppressedNegation) {
|
|
1560
|
+
setOption(resolution.withoutDashes, true);
|
|
1561
|
+
i++;
|
|
1562
|
+
continue;
|
|
1563
|
+
}
|
|
1559
1564
|
if (resolution.isNegated) {
|
|
1560
1565
|
setOption(resolution.resolvedName, false);
|
|
1561
1566
|
i++;
|
|
@@ -1626,7 +1631,7 @@ function buildParserOptions(extracted) {
|
|
|
1626
1631
|
const arrayFlags = /* @__PURE__ */ new Set();
|
|
1627
1632
|
const definedNames = /* @__PURE__ */ new Set();
|
|
1628
1633
|
const negationMap = /* @__PURE__ */ new Map();
|
|
1629
|
-
const
|
|
1634
|
+
const defaultNegationDisabledFields = /* @__PURE__ */ new Set();
|
|
1630
1635
|
for (const field of extracted.fields) definedNames.add(field.name);
|
|
1631
1636
|
for (const field of extracted.fields) {
|
|
1632
1637
|
if (field.cliName !== field.name) aliasMap.set(field.cliName, field.name);
|
|
@@ -1641,8 +1646,8 @@ function buildParserOptions(extracted) {
|
|
|
1641
1646
|
if (camelVariant !== field.name && !definedNames.has(camelVariant) && !aliasMap.has(camelVariant)) aliasMap.set(camelVariant, field.name);
|
|
1642
1647
|
if (field.type === "boolean") booleanFlags.add(field.name);
|
|
1643
1648
|
if (field.type === "array") arrayFlags.add(field.name);
|
|
1644
|
-
if (field.type === "boolean" &&
|
|
1645
|
-
|
|
1649
|
+
if (field.type === "boolean" && field.negation !== true) {
|
|
1650
|
+
defaultNegationDisabledFields.add(field.name);
|
|
1646
1651
|
if (typeof field.negation === "string") {
|
|
1647
1652
|
negationMap.set(field.negation, field.name);
|
|
1648
1653
|
if (field.negation.includes("-")) {
|
|
@@ -1658,7 +1663,7 @@ function buildParserOptions(extracted) {
|
|
|
1658
1663
|
arrayFlags,
|
|
1659
1664
|
definedNames,
|
|
1660
1665
|
negationMap,
|
|
1661
|
-
|
|
1666
|
+
defaultNegationDisabledFields
|
|
1662
1667
|
};
|
|
1663
1668
|
}
|
|
1664
1669
|
/**
|
|
@@ -1689,7 +1694,7 @@ function mergeWithPositionals(parsed, extracted) {
|
|
|
1689
1694
|
* Shared by scanForSubcommand, separateGlobalArgs, and findFirstPositional.
|
|
1690
1695
|
*/
|
|
1691
1696
|
function buildGlobalFlagLookup(globalExtracted) {
|
|
1692
|
-
const { aliasMap = /* @__PURE__ */ new Map(), booleanFlags = /* @__PURE__ */ new Set(), definedNames = /* @__PURE__ */ new Set(), negationMap = /* @__PURE__ */ new Map(),
|
|
1697
|
+
const { aliasMap = /* @__PURE__ */ new Map(), booleanFlags = /* @__PURE__ */ new Set(), definedNames = /* @__PURE__ */ new Set(), negationMap = /* @__PURE__ */ new Map(), defaultNegationDisabledFields = /* @__PURE__ */ new Set() } = buildParserOptions(globalExtracted);
|
|
1693
1698
|
const shortAliases = /* @__PURE__ */ new Set();
|
|
1694
1699
|
for (const field of globalExtracted.fields) for (const alias of getAllAliases(field)) if (alias.length === 1) shortAliases.add(alias);
|
|
1695
1700
|
return {
|
|
@@ -1700,7 +1705,7 @@ function buildGlobalFlagLookup(globalExtracted) {
|
|
|
1700
1705
|
cliNames: new Set(globalExtracted.fields.map((f) => f.cliName)),
|
|
1701
1706
|
aliases: shortAliases,
|
|
1702
1707
|
negationMap,
|
|
1703
|
-
|
|
1708
|
+
defaultNegationDisabledFields
|
|
1704
1709
|
};
|
|
1705
1710
|
}
|
|
1706
1711
|
/**
|
|
@@ -1708,8 +1713,8 @@ function buildGlobalFlagLookup(globalExtracted) {
|
|
|
1708
1713
|
* against global flag lookup. Returns the resolved camelCase name and whether
|
|
1709
1714
|
* it is a known global flag.
|
|
1710
1715
|
*
|
|
1711
|
-
* `isSuppressedNegation` is true when the token matches a default
|
|
1712
|
-
* form
|
|
1716
|
+
* `isSuppressedNegation` is true when the token matches a disabled default
|
|
1717
|
+
* `--no-X` form on the target field.
|
|
1713
1718
|
* The caller may use this to keep argv scanning past such tokens (so a
|
|
1714
1719
|
* trailing subcommand is still detected) even though they no longer negate.
|
|
1715
1720
|
*/
|
|
@@ -1820,7 +1825,7 @@ function scanForSubcommand(argv, subCommandNames, globalExtracted) {
|
|
|
1820
1825
|
suppressedTokens
|
|
1821
1826
|
};
|
|
1822
1827
|
}
|
|
1823
|
-
const BUILTIN_FLAGS = new Set([
|
|
1828
|
+
const BUILTIN_FLAGS = /* @__PURE__ */ new Set([
|
|
1824
1829
|
"--help",
|
|
1825
1830
|
"-h",
|
|
1826
1831
|
"--help-all",
|
|
@@ -1840,7 +1845,8 @@ const BUILTIN_FLAGS = new Set([
|
|
|
1840
1845
|
* Without globalExtracted, no flag is global, so any leading flag halts the
|
|
1841
1846
|
* scan and a positional is only found when it precedes every flag.
|
|
1842
1847
|
*/
|
|
1843
|
-
function findFirstPositionalIndex(argv, globalExtracted) {
|
|
1848
|
+
function findFirstPositionalIndex(argv, globalExtracted, options = {}) {
|
|
1849
|
+
const stopOnSuppressedNegation = options.stopOnSuppressedNegation === true || globalExtracted?.unknownKeysMode === "strict";
|
|
1844
1850
|
const lookup = globalExtracted ? buildGlobalFlagLookup(globalExtracted) : {
|
|
1845
1851
|
aliasMap: /* @__PURE__ */ new Map(),
|
|
1846
1852
|
booleanFlags: /* @__PURE__ */ new Set(),
|
|
@@ -1849,7 +1855,7 @@ function findFirstPositionalIndex(argv, globalExtracted) {
|
|
|
1849
1855
|
cliNames: /* @__PURE__ */ new Set(),
|
|
1850
1856
|
aliases: /* @__PURE__ */ new Set(),
|
|
1851
1857
|
negationMap: /* @__PURE__ */ new Map(),
|
|
1852
|
-
|
|
1858
|
+
defaultNegationDisabledFields: /* @__PURE__ */ new Set()
|
|
1853
1859
|
};
|
|
1854
1860
|
for (let i = 0; i < argv.length; i++) {
|
|
1855
1861
|
const arg = argv[i];
|
|
@@ -1861,7 +1867,10 @@ function findFirstPositionalIndex(argv, globalExtracted) {
|
|
|
1861
1867
|
if (shouldConsumeValue(arg, resolvedName, isNegated, argv[i + 1], lookup.booleanFlags)) i++;
|
|
1862
1868
|
continue;
|
|
1863
1869
|
}
|
|
1864
|
-
if (isSuppressedNegation)
|
|
1870
|
+
if (isSuppressedNegation) {
|
|
1871
|
+
if (stopOnSuppressedNegation) return -1;
|
|
1872
|
+
continue;
|
|
1873
|
+
}
|
|
1865
1874
|
return -1;
|
|
1866
1875
|
}
|
|
1867
1876
|
const withoutDash = arg.includes("=") ? arg.slice(1, arg.indexOf("=")) : arg.slice(1);
|
|
@@ -1914,6 +1923,7 @@ function parseArgs(argv, command, options = {}) {
|
|
|
1914
1923
|
positionals: [],
|
|
1915
1924
|
rest: [],
|
|
1916
1925
|
unknownFlags: scanResult.suppressedTokens,
|
|
1926
|
+
unknownGlobalFlags: scanResult.suppressedTokens,
|
|
1917
1927
|
rawGlobalArgs
|
|
1918
1928
|
};
|
|
1919
1929
|
}
|
|
@@ -1944,6 +1954,15 @@ function parseArgs(argv, command, options = {}) {
|
|
|
1944
1954
|
if (options.globalExtracted) validateCrossSchemaCollisions(options.globalExtracted, extracted);
|
|
1945
1955
|
}
|
|
1946
1956
|
}
|
|
1957
|
+
let commandArgv = argv;
|
|
1958
|
+
let rawGlobalArgs;
|
|
1959
|
+
let suppressedGlobalFlags = [];
|
|
1960
|
+
if (options.globalExtracted) {
|
|
1961
|
+
const { separated, globalParsed, suppressedTokens } = separateGlobalArgs(argv, options.globalExtracted, extracted);
|
|
1962
|
+
commandArgv = separated;
|
|
1963
|
+
rawGlobalArgs = globalParsed;
|
|
1964
|
+
suppressedGlobalFlags = suppressedTokens;
|
|
1965
|
+
}
|
|
1947
1966
|
const ddIdx = argv.indexOf("--");
|
|
1948
1967
|
const flagScanArgv = ddIdx >= 0 ? argv.slice(0, ddIdx) : argv;
|
|
1949
1968
|
const hasUserDefinedH = extracted?.fields.some((f) => f.overrideBuiltinAlias === true && getAllAliases(f).includes("H")) ?? false;
|
|
@@ -1960,15 +1979,10 @@ function parseArgs(argv, command, options = {}) {
|
|
|
1960
1979
|
rawArgs: {},
|
|
1961
1980
|
positionals: [],
|
|
1962
1981
|
rest: [],
|
|
1963
|
-
unknownFlags: []
|
|
1982
|
+
unknownFlags: [],
|
|
1983
|
+
unknownGlobalFlags: suppressedGlobalFlags,
|
|
1984
|
+
rawGlobalArgs
|
|
1964
1985
|
};
|
|
1965
|
-
let commandArgv = argv;
|
|
1966
|
-
let rawGlobalArgs;
|
|
1967
|
-
if (options.globalExtracted) {
|
|
1968
|
-
const { separated, globalParsed } = separateGlobalArgs(argv, options.globalExtracted, extracted);
|
|
1969
|
-
commandArgv = separated;
|
|
1970
|
-
rawGlobalArgs = globalParsed;
|
|
1971
|
-
}
|
|
1972
1986
|
if (!extracted) {
|
|
1973
1987
|
const ddIdx = commandArgv.indexOf("--");
|
|
1974
1988
|
return {
|
|
@@ -1981,6 +1995,7 @@ function parseArgs(argv, command, options = {}) {
|
|
|
1981
1995
|
positionals: ddIdx >= 0 ? commandArgv.slice(0, ddIdx) : commandArgv,
|
|
1982
1996
|
rest: ddIdx >= 0 ? commandArgv.slice(ddIdx + 1) : [],
|
|
1983
1997
|
unknownFlags: [],
|
|
1998
|
+
unknownGlobalFlags: suppressedGlobalFlags,
|
|
1984
1999
|
rawGlobalArgs
|
|
1985
2000
|
};
|
|
1986
2001
|
}
|
|
@@ -2018,6 +2033,7 @@ function parseArgs(argv, command, options = {}) {
|
|
|
2018
2033
|
positionals: parsed.positionals,
|
|
2019
2034
|
rest: parsed.rest,
|
|
2020
2035
|
unknownFlags,
|
|
2036
|
+
unknownGlobalFlags: suppressedGlobalFlags,
|
|
2021
2037
|
extractedFields: extracted,
|
|
2022
2038
|
rawGlobalArgs
|
|
2023
2039
|
};
|
|
@@ -2045,9 +2061,21 @@ function separateGlobalArgs(argv, globalExtracted, localExtracted) {
|
|
|
2045
2061
|
const lookup = buildGlobalFlagLookup(globalExtracted);
|
|
2046
2062
|
const localFieldNames = new Set(localExtracted?.fields.map((f) => f.name) ?? []);
|
|
2047
2063
|
const localCliNames = new Set(localExtracted?.fields.map((f) => f.cliName) ?? []);
|
|
2048
|
-
const
|
|
2064
|
+
const localParserOptions = localExtracted ? buildParserOptions(localExtracted) : void 0;
|
|
2065
|
+
const localAliasMapKeys = new Set(localParserOptions?.aliasMap?.keys() ?? []);
|
|
2066
|
+
const localNegationMapKeys = new Set(localParserOptions?.negationMap?.keys() ?? []);
|
|
2067
|
+
const localDefaultNegationKeys = /* @__PURE__ */ new Set();
|
|
2068
|
+
for (const field of localExtracted?.fields ?? []) {
|
|
2069
|
+
if (field.type !== "boolean" || field.negation !== true) continue;
|
|
2070
|
+
for (const name of [field.cliName, ...getAllAliases(field)]) {
|
|
2071
|
+
const kebab = `no-${name}`;
|
|
2072
|
+
localDefaultNegationKeys.add(kebab);
|
|
2073
|
+
localDefaultNegationKeys.add(toCamelCase(kebab));
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2049
2076
|
const globalTokens = [];
|
|
2050
2077
|
const commandTokens = [];
|
|
2078
|
+
const suppressedTokens = [];
|
|
2051
2079
|
for (let i = 0; i < argv.length; i++) {
|
|
2052
2080
|
const arg = argv[i];
|
|
2053
2081
|
if (arg === "--") {
|
|
@@ -2055,13 +2083,17 @@ function separateGlobalArgs(argv, globalExtracted, localExtracted) {
|
|
|
2055
2083
|
break;
|
|
2056
2084
|
}
|
|
2057
2085
|
if (arg.startsWith("--")) {
|
|
2058
|
-
const { resolvedName, withoutDashes, isNegated, isGlobal } = resolveGlobalLongOption(arg, lookup);
|
|
2086
|
+
const { resolvedName, withoutDashes, isNegated, isGlobal, isSuppressedNegation } = resolveGlobalLongOption(arg, lookup);
|
|
2059
2087
|
const flagName = resolvedName;
|
|
2060
|
-
const isLocalCollision = localFieldNames.has(withoutDashes) || localFieldNames.has(flagName) || localCliNames.has(withoutDashes) || localCliNames.has(flagName) || localAliasMapKeys.has(withoutDashes) || localAliasMapKeys.has(flagName);
|
|
2088
|
+
const isLocalCollision = localFieldNames.has(withoutDashes) || localFieldNames.has(flagName) || localCliNames.has(withoutDashes) || localCliNames.has(flagName) || localAliasMapKeys.has(withoutDashes) || localAliasMapKeys.has(flagName) || localNegationMapKeys.has(withoutDashes) || localNegationMapKeys.has(flagName) || localDefaultNegationKeys.has(withoutDashes);
|
|
2061
2089
|
if (isGlobal && !isLocalCollision) {
|
|
2062
2090
|
i += collectGlobalFlag(argv, i, resolvedName, isNegated, lookup.booleanFlags, globalTokens) - 1;
|
|
2063
2091
|
continue;
|
|
2064
2092
|
}
|
|
2093
|
+
if (isSuppressedNegation && !isLocalCollision) {
|
|
2094
|
+
suppressedTokens.push(arg.includes("=") ? arg.slice(2, arg.indexOf("=")) : arg.slice(2));
|
|
2095
|
+
continue;
|
|
2096
|
+
}
|
|
2065
2097
|
} else if (arg.startsWith("-") && arg.length > 1) {
|
|
2066
2098
|
const withoutDash = arg.includes("=") ? arg.slice(1, arg.indexOf("=")) : arg.slice(1);
|
|
2067
2099
|
if (withoutDash.length === 1) {
|
|
@@ -2076,7 +2108,8 @@ function separateGlobalArgs(argv, globalExtracted, localExtracted) {
|
|
|
2076
2108
|
}
|
|
2077
2109
|
return {
|
|
2078
2110
|
separated: commandTokens,
|
|
2079
|
-
globalParsed: parseGlobalArgs(globalTokens, globalExtracted)
|
|
2111
|
+
globalParsed: parseGlobalArgs(globalTokens, globalExtracted),
|
|
2112
|
+
suppressedTokens
|
|
2080
2113
|
};
|
|
2081
2114
|
}
|
|
2082
2115
|
|
|
@@ -2354,10 +2387,10 @@ async function runMain(command, options = {}) {
|
|
|
2354
2387
|
effectiveOptions = rest;
|
|
2355
2388
|
}
|
|
2356
2389
|
const globalExtracted = extractAndValidateGlobal(effectiveOptions);
|
|
2357
|
-
if (effectiveOptions.onUnknownSubcommand && !isInternalSubcommandInvocation(command, argv, globalExtractedForBypass)) {
|
|
2390
|
+
if (effectiveOptions.onUnknownSubcommand && !command.run && !isInternalSubcommandInvocation(command, argv, globalExtractedForBypass)) {
|
|
2358
2391
|
const knownSubCommands = listSubCommandNamesWithAliases(command);
|
|
2359
2392
|
if (knownSubCommands.size > 0) {
|
|
2360
|
-
const positionalIndex = findFirstPositionalIndex(argv, globalExtracted);
|
|
2393
|
+
const positionalIndex = findFirstPositionalIndex(argv, globalExtracted, { stopOnSuppressedNegation: globalExtracted?.unknownKeysMode !== "passthrough" });
|
|
2361
2394
|
const name = positionalIndex >= 0 ? argv[positionalIndex] : void 0;
|
|
2362
2395
|
if (name && !knownSubCommands.has(name)) {
|
|
2363
2396
|
const forwardArgs = argv.slice(positionalIndex + 1);
|
|
@@ -2447,10 +2480,10 @@ async function runCommandInternal(command, argv, options = {}) {
|
|
|
2447
2480
|
...parseResult.rawGlobalArgs
|
|
2448
2481
|
};
|
|
2449
2482
|
const nestedCommandPath = context.commandPath ?? [];
|
|
2450
|
-
if (options.onUnknownSubcommand && nestedCommandPath.length > 0) {
|
|
2483
|
+
if (options.onUnknownSubcommand && !command.run && nestedCommandPath.length > 0) {
|
|
2451
2484
|
const knownSubCommands = listSubCommandNamesWithAliases(command);
|
|
2452
2485
|
if (knownSubCommands.size > 0) {
|
|
2453
|
-
const positionalIndex = findFirstPositionalIndex(argv, options._globalExtracted);
|
|
2486
|
+
const positionalIndex = findFirstPositionalIndex(argv, options._globalExtracted, { stopOnSuppressedNegation: options._globalExtracted?.unknownKeysMode !== "passthrough" });
|
|
2454
2487
|
const name = positionalIndex >= 0 ? argv[positionalIndex] : void 0;
|
|
2455
2488
|
if (name && !knownSubCommands.has(name)) {
|
|
2456
2489
|
const forwardArgs = argv.slice(positionalIndex + 1);
|
|
@@ -2516,6 +2549,22 @@ async function runCommandInternal(command, argv, options = {}) {
|
|
|
2516
2549
|
logs: getCurrentLogs()
|
|
2517
2550
|
};
|
|
2518
2551
|
}
|
|
2552
|
+
if (parseResult.unknownGlobalFlags && parseResult.unknownGlobalFlags.length > 0) {
|
|
2553
|
+
const globalMode = context.globalExtracted?.unknownKeysMode ?? "strip";
|
|
2554
|
+
if (globalMode === "strict") {
|
|
2555
|
+
collector?.stop();
|
|
2556
|
+
return {
|
|
2557
|
+
success: false,
|
|
2558
|
+
error: /* @__PURE__ */ new Error(`Unknown flags: ${parseResult.unknownGlobalFlags.join(", ")}`),
|
|
2559
|
+
exitCode: 1,
|
|
2560
|
+
logs: getCurrentLogs()
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2563
|
+
if (globalMode === "strip") {
|
|
2564
|
+
const knownGlobalFlags = context.globalExtracted?.fields.map((f) => f.name) ?? [];
|
|
2565
|
+
for (const flag of parseResult.unknownGlobalFlags) logger.error(formatUnknownFlagWarning(flag, knownGlobalFlags));
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2519
2568
|
if (parseResult.versionRequested) {
|
|
2520
2569
|
const version = context.rootVersion;
|
|
2521
2570
|
if (version) logger.log(version);
|
|
@@ -2528,22 +2577,6 @@ async function runCommandInternal(command, argv, options = {}) {
|
|
|
2528
2577
|
};
|
|
2529
2578
|
}
|
|
2530
2579
|
if (parseResult.subCommand) {
|
|
2531
|
-
if (parseResult.unknownFlags.length > 0) {
|
|
2532
|
-
const globalMode = context.globalExtracted?.unknownKeysMode ?? "strip";
|
|
2533
|
-
if (globalMode === "strict") {
|
|
2534
|
-
collector?.stop();
|
|
2535
|
-
return {
|
|
2536
|
-
success: false,
|
|
2537
|
-
error: /* @__PURE__ */ new Error(`Unknown flags: ${parseResult.unknownFlags.join(", ")}`),
|
|
2538
|
-
exitCode: 1,
|
|
2539
|
-
logs: getCurrentLogs()
|
|
2540
|
-
};
|
|
2541
|
-
}
|
|
2542
|
-
if (globalMode === "strip") {
|
|
2543
|
-
const knownGlobalFlags = context.globalExtracted?.fields.map((f) => f.name) ?? [];
|
|
2544
|
-
for (const flag of parseResult.unknownFlags) logger.error(formatUnknownFlagWarning(flag, knownGlobalFlags));
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
2580
|
const resolved = await resolveSubcommandWithAlias(command, parseResult.subCommand);
|
|
2548
2581
|
if (resolved) {
|
|
2549
2582
|
const subContext = {
|
|
@@ -2727,4 +2760,4 @@ function extractAndValidateGlobal(options) {
|
|
|
2727
2760
|
|
|
2728
2761
|
//#endregion
|
|
2729
2762
|
export { renderMarkdown as C, renderInline as S, DuplicateFieldError as _, parseArgv as a, ReservedAliasError as b, validateCommand as c, validateDuplicateFields as d, validateDuplicateNegations as f, DuplicateAliasError as g, CaseVariantCollisionError 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, DuplicateNegationError as v, createDualCaseProxy as w, generateHelp as x, PositionalConfigError as y };
|
|
2730
|
-
//# sourceMappingURL=runner-
|
|
2763
|
+
//# sourceMappingURL=runner-Z7R_XvAV.js.map
|
|
@@ -153,7 +153,7 @@ function getArgMeta(schema) {
|
|
|
153
153
|
* Long flag names reserved for built-in handling (parseArgs / scanForSubcommand
|
|
154
154
|
* intercept these before option parsing), so custom negation names must avoid them.
|
|
155
155
|
*/
|
|
156
|
-
const RESERVED_NEGATION_NAMES = new Set([
|
|
156
|
+
const RESERVED_NEGATION_NAMES = /* @__PURE__ */ new Set([
|
|
157
157
|
"help",
|
|
158
158
|
"help-all",
|
|
159
159
|
"version"
|
|
@@ -597,4 +597,4 @@ function getExtractedFields(command) {
|
|
|
597
597
|
|
|
598
598
|
//#endregion
|
|
599
599
|
export { toCamelCase as a, listSubCommands as c, resolveSubcommandWithAlias as d, isLazyCommand as f, getUnknownKeysMode as i, resolveLazyCommand as l, resolveSubCommandMeta as m, getAllAliases as n, toKebabCase as o, lazy as p, getExtractedFields as r, listSubCommandNamesWithAliases as s, extractFields as t, resolveSubCommandAlias as u };
|
|
600
|
-
//# sourceMappingURL=schema-extractor-
|
|
600
|
+
//# sourceMappingURL=schema-extractor-DnOTAjV_.js.map
|
package/dist/skill/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "politty",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A lightweight CLI framework inspired by citty with zod v4 registry integration for type-safe metadata management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"argument-parser",
|
|
@@ -68,16 +68,16 @@
|
|
|
68
68
|
"@clack/prompts": "1.2.0",
|
|
69
69
|
"@inquirer/prompts": "8.5.2",
|
|
70
70
|
"@quansync/fs": "1.0.0",
|
|
71
|
-
"@types/node": "25.9.
|
|
72
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
71
|
+
"@types/node": "25.9.4",
|
|
72
|
+
"@typescript/native-preview": "7.0.0-dev.20260621.1",
|
|
73
73
|
"@vitest/coverage-v8": "4.1.9",
|
|
74
|
-
"knip": "6.
|
|
74
|
+
"knip": "6.17.1",
|
|
75
75
|
"lefthook": "2.1.9",
|
|
76
76
|
"organize-imports-cli": "1.0.2",
|
|
77
77
|
"oxfmt": "0.55.0",
|
|
78
78
|
"oxlint": "1.70.0",
|
|
79
79
|
"quansync": "1.0.0",
|
|
80
|
-
"tsdown": "0.22.
|
|
80
|
+
"tsdown": "0.22.3",
|
|
81
81
|
"tsx": "4.22.4",
|
|
82
82
|
"typescript": "6.0.3",
|
|
83
83
|
"vitest": "4.1.9",
|