@optique/core 1.2.0-dev.2298 → 1.2.0-dev.2301
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/facade.cjs +47 -8
- package/dist/facade.d.cts +22 -1
- package/dist/facade.d.ts +22 -1
- package/dist/facade.js +47 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +2 -2
- package/skills/optique/SKILL.md +2 -0
package/dist/facade.cjs
CHANGED
|
@@ -539,7 +539,8 @@ function getHelpCommandContext(commandPath, args, helpIndex) {
|
|
|
539
539
|
function classifyParseFailure(failure, helpOptionNames, helpCommandNames, versionOptionNames, versionCommandNames, completionOptionNames, completionCommandNames) {
|
|
540
540
|
if (failure.remainingArgs.length < 1) return {
|
|
541
541
|
type: "error",
|
|
542
|
-
error: failure.error
|
|
542
|
+
error: failure.error,
|
|
543
|
+
commandPath: failure.commandPath
|
|
543
544
|
};
|
|
544
545
|
const hasConsumedPrefix = failure.consumedCount > 0;
|
|
545
546
|
const firstArg = failure.remainingArgs[0];
|
|
@@ -571,7 +572,8 @@ function classifyParseFailure(failure, helpOptionNames, helpCommandNames, versio
|
|
|
571
572
|
if (secondArg == null || isCompletionImmediatelyAfter || lastHelpVersion?.index === 1 && lastHelpVersion.kind === "version") return { type: "version" };
|
|
572
573
|
return {
|
|
573
574
|
type: "error",
|
|
574
|
-
error: failure.error
|
|
575
|
+
error: failure.error,
|
|
576
|
+
commandPath: failure.commandPath
|
|
575
577
|
};
|
|
576
578
|
}
|
|
577
579
|
let commandAction;
|
|
@@ -601,7 +603,8 @@ function classifyParseFailure(failure, helpOptionNames, helpCommandNames, versio
|
|
|
601
603
|
};
|
|
602
604
|
return {
|
|
603
605
|
type: "error",
|
|
604
|
-
error: failure.error
|
|
606
|
+
error: failure.error,
|
|
607
|
+
commandPath: failure.commandPath
|
|
605
608
|
};
|
|
606
609
|
}
|
|
607
610
|
/**
|
|
@@ -949,7 +952,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
949
952
|
options = optionsParam ?? {};
|
|
950
953
|
}
|
|
951
954
|
require_validate.validateProgramName(programName);
|
|
952
|
-
const { colors, maxWidth, showDefault, showChoices, sectionOrder, showUsage, aboveError = "usage", onError = () => {
|
|
955
|
+
const { colors, maxWidth, showDefault, showChoices, sectionOrder, showUsage, commandList = "recursive", aboveError = "usage", onError = () => {
|
|
953
956
|
throw new RunParserError("Failed to parse command line arguments.");
|
|
954
957
|
}, stderr = console.error, stdout = console.log, brief, description, examples, author, bugs, footer } = options;
|
|
955
958
|
const norm = (c) => c === true ? {} : c;
|
|
@@ -1121,7 +1124,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1121
1124
|
const isSubcommandHelp = classified.commands.length > 0;
|
|
1122
1125
|
const isTopLevel = !isSubcommandHelp;
|
|
1123
1126
|
const shouldOverride = !isMetaCommandHelp && !isSubcommandHelp;
|
|
1124
|
-
const augmentedDoc = {
|
|
1127
|
+
const augmentedDoc = maybeCollapseCommandList({
|
|
1125
1128
|
...doc,
|
|
1126
1129
|
brief: shouldOverride ? brief ?? doc.brief : doc.brief,
|
|
1127
1130
|
description: shouldOverride ? description ?? doc.description : doc.description,
|
|
@@ -1129,7 +1132,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1129
1132
|
author: isTopLevel && !isMetaCommandHelp ? author ?? doc.author : void 0,
|
|
1130
1133
|
bugs: isTopLevel && !isMetaCommandHelp ? bugs ?? doc.bugs : void 0,
|
|
1131
1134
|
footer: shouldOverride ? footer ?? doc.footer : doc.footer ?? footer
|
|
1132
|
-
};
|
|
1135
|
+
}, commandList, isTopLevel);
|
|
1133
1136
|
stdout(require_doc.formatDocPage(programName, augmentedDoc, {
|
|
1134
1137
|
colors,
|
|
1135
1138
|
maxWidth,
|
|
@@ -1190,7 +1193,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1190
1193
|
let effectiveAboveError = currentAboveError;
|
|
1191
1194
|
if (effectiveAboveError === "help") if (doc == null) effectiveAboveError = "usage";
|
|
1192
1195
|
else {
|
|
1193
|
-
const augmentedDoc = {
|
|
1196
|
+
const augmentedDoc = maybeCollapseCommandList({
|
|
1194
1197
|
...doc,
|
|
1195
1198
|
brief: brief ?? doc.brief,
|
|
1196
1199
|
description: description ?? doc.description,
|
|
@@ -1198,7 +1201,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1198
1201
|
author: author ?? doc.author,
|
|
1199
1202
|
bugs: bugs ?? doc.bugs,
|
|
1200
1203
|
footer: footer ?? doc.footer
|
|
1201
|
-
};
|
|
1204
|
+
}, commandList, classified.commandPath.length < 1);
|
|
1202
1205
|
stderr(require_doc.formatDocPage(programName, augmentedDoc, {
|
|
1203
1206
|
colors,
|
|
1204
1207
|
maxWidth,
|
|
@@ -1295,6 +1298,42 @@ function runParserAsync(parser, programName, args, options) {
|
|
|
1295
1298
|
const result = runParser(parser, programName, args, options);
|
|
1296
1299
|
return Promise.resolve(result);
|
|
1297
1300
|
}
|
|
1301
|
+
function maybeCollapseCommandList(doc, commandList, isTopLevel) {
|
|
1302
|
+
if (commandList !== "top-level" || !isTopLevel) return doc;
|
|
1303
|
+
return {
|
|
1304
|
+
...doc,
|
|
1305
|
+
sections: doc.sections.map((section) => ({
|
|
1306
|
+
...section,
|
|
1307
|
+
entries: collapseTopLevelCommandEntries(section.entries)
|
|
1308
|
+
}))
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function collapseTopLevelCommandEntries(entries) {
|
|
1312
|
+
const collapsed = [];
|
|
1313
|
+
const commandIndexes = /* @__PURE__ */ new Map();
|
|
1314
|
+
for (const entry of entries) {
|
|
1315
|
+
if (entry.term.type !== "command") {
|
|
1316
|
+
collapsed.push(entry);
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
const topLevelName = getTopLevelCommandName(entry.term.name);
|
|
1320
|
+
const existingIndex = commandIndexes.get(topLevelName);
|
|
1321
|
+
const isTopLevel = entry.term.name === topLevelName;
|
|
1322
|
+
if (existingIndex == null) {
|
|
1323
|
+
commandIndexes.set(topLevelName, collapsed.length);
|
|
1324
|
+
collapsed.push(isTopLevel ? entry : { term: {
|
|
1325
|
+
...entry.term,
|
|
1326
|
+
name: topLevelName
|
|
1327
|
+
} });
|
|
1328
|
+
continue;
|
|
1329
|
+
}
|
|
1330
|
+
if (isTopLevel) collapsed[existingIndex] = entry;
|
|
1331
|
+
}
|
|
1332
|
+
return collapsed;
|
|
1333
|
+
}
|
|
1334
|
+
function getTopLevelCommandName(name) {
|
|
1335
|
+
return name.split(" ", 1)[0] ?? name;
|
|
1336
|
+
}
|
|
1298
1337
|
/**
|
|
1299
1338
|
* An error class used to indicate that the command line arguments
|
|
1300
1339
|
* could not be parsed successfully.
|
package/dist/facade.d.cts
CHANGED
|
@@ -8,6 +8,17 @@ import { Program } from "./program.cjs";
|
|
|
8
8
|
|
|
9
9
|
//#region src/facade.d.ts
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Controls how command lists are rendered in top-level help pages.
|
|
13
|
+
*
|
|
14
|
+
* - `"recursive"`: Shows the full flattened command list, including nested
|
|
15
|
+
* leaf commands such as `remote add`.
|
|
16
|
+
* - `"top-level"`: Shows only first-level command names such as `remote`,
|
|
17
|
+
* letting users drill down with `remote --help`.
|
|
18
|
+
*
|
|
19
|
+
* @since 1.2.0
|
|
20
|
+
*/
|
|
21
|
+
type CommandListMode = "recursive" | "top-level";
|
|
11
22
|
/**
|
|
12
23
|
* Sub-configuration for a meta command's command form.
|
|
13
24
|
*
|
|
@@ -116,6 +127,16 @@ interface RunOptions<THelp, TError> {
|
|
|
116
127
|
* @since 1.2.0
|
|
117
128
|
*/
|
|
118
129
|
readonly showUsage?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* How to render command lists in top-level help pages.
|
|
132
|
+
*
|
|
133
|
+
* Pass `"top-level"` to show only first-level commands in the command menu
|
|
134
|
+
* while keeping nested command help available through `<command> --help`.
|
|
135
|
+
*
|
|
136
|
+
* @default `"recursive"`
|
|
137
|
+
* @since 1.2.0
|
|
138
|
+
*/
|
|
139
|
+
readonly commandList?: CommandListMode;
|
|
119
140
|
/**
|
|
120
141
|
* A custom comparator function to control the order of sections in the
|
|
121
142
|
* help output. When provided, it is used instead of the default smart
|
|
@@ -534,4 +555,4 @@ declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, T
|
|
|
534
555
|
*/
|
|
535
556
|
declare function runWithAsync<TParser extends Parser<Mode, unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ContextOptionsParam<TContexts, InferValue<TParser>>): Promise<InferValue<TParser>>;
|
|
536
557
|
//#endregion
|
|
537
|
-
export { CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, type ParserValuePlaceholder, RunOptions, RunParserError, RunWithOptions, type SourceContext, type SourceContextRequest, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
|
|
558
|
+
export { CommandListMode, CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, type ParserValuePlaceholder, RunOptions, RunParserError, RunWithOptions, type SourceContext, type SourceContextRequest, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
|
package/dist/facade.d.ts
CHANGED
|
@@ -8,6 +8,17 @@ import { Program } from "./program.js";
|
|
|
8
8
|
|
|
9
9
|
//#region src/facade.d.ts
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Controls how command lists are rendered in top-level help pages.
|
|
13
|
+
*
|
|
14
|
+
* - `"recursive"`: Shows the full flattened command list, including nested
|
|
15
|
+
* leaf commands such as `remote add`.
|
|
16
|
+
* - `"top-level"`: Shows only first-level command names such as `remote`,
|
|
17
|
+
* letting users drill down with `remote --help`.
|
|
18
|
+
*
|
|
19
|
+
* @since 1.2.0
|
|
20
|
+
*/
|
|
21
|
+
type CommandListMode = "recursive" | "top-level";
|
|
11
22
|
/**
|
|
12
23
|
* Sub-configuration for a meta command's command form.
|
|
13
24
|
*
|
|
@@ -116,6 +127,16 @@ interface RunOptions<THelp, TError> {
|
|
|
116
127
|
* @since 1.2.0
|
|
117
128
|
*/
|
|
118
129
|
readonly showUsage?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* How to render command lists in top-level help pages.
|
|
132
|
+
*
|
|
133
|
+
* Pass `"top-level"` to show only first-level commands in the command menu
|
|
134
|
+
* while keeping nested command help available through `<command> --help`.
|
|
135
|
+
*
|
|
136
|
+
* @default `"recursive"`
|
|
137
|
+
* @since 1.2.0
|
|
138
|
+
*/
|
|
139
|
+
readonly commandList?: CommandListMode;
|
|
119
140
|
/**
|
|
120
141
|
* A custom comparator function to control the order of sections in the
|
|
121
142
|
* help output. When provided, it is used instead of the default smart
|
|
@@ -534,4 +555,4 @@ declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, T
|
|
|
534
555
|
*/
|
|
535
556
|
declare function runWithAsync<TParser extends Parser<Mode, unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ContextOptionsParam<TContexts, InferValue<TParser>>): Promise<InferValue<TParser>>;
|
|
536
557
|
//#endregion
|
|
537
|
-
export { CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, type ParserValuePlaceholder, RunOptions, RunParserError, RunWithOptions, type SourceContext, type SourceContextRequest, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
|
|
558
|
+
export { CommandListMode, CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, type ParserValuePlaceholder, RunOptions, RunParserError, RunWithOptions, type SourceContext, type SourceContextRequest, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
|
package/dist/facade.js
CHANGED
|
@@ -539,7 +539,8 @@ function getHelpCommandContext(commandPath, args, helpIndex) {
|
|
|
539
539
|
function classifyParseFailure(failure, helpOptionNames, helpCommandNames, versionOptionNames, versionCommandNames, completionOptionNames, completionCommandNames) {
|
|
540
540
|
if (failure.remainingArgs.length < 1) return {
|
|
541
541
|
type: "error",
|
|
542
|
-
error: failure.error
|
|
542
|
+
error: failure.error,
|
|
543
|
+
commandPath: failure.commandPath
|
|
543
544
|
};
|
|
544
545
|
const hasConsumedPrefix = failure.consumedCount > 0;
|
|
545
546
|
const firstArg = failure.remainingArgs[0];
|
|
@@ -571,7 +572,8 @@ function classifyParseFailure(failure, helpOptionNames, helpCommandNames, versio
|
|
|
571
572
|
if (secondArg == null || isCompletionImmediatelyAfter || lastHelpVersion?.index === 1 && lastHelpVersion.kind === "version") return { type: "version" };
|
|
572
573
|
return {
|
|
573
574
|
type: "error",
|
|
574
|
-
error: failure.error
|
|
575
|
+
error: failure.error,
|
|
576
|
+
commandPath: failure.commandPath
|
|
575
577
|
};
|
|
576
578
|
}
|
|
577
579
|
let commandAction;
|
|
@@ -601,7 +603,8 @@ function classifyParseFailure(failure, helpOptionNames, helpCommandNames, versio
|
|
|
601
603
|
};
|
|
602
604
|
return {
|
|
603
605
|
type: "error",
|
|
604
|
-
error: failure.error
|
|
606
|
+
error: failure.error,
|
|
607
|
+
commandPath: failure.commandPath
|
|
605
608
|
};
|
|
606
609
|
}
|
|
607
610
|
/**
|
|
@@ -949,7 +952,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
949
952
|
options = optionsParam ?? {};
|
|
950
953
|
}
|
|
951
954
|
validateProgramName(programName);
|
|
952
|
-
const { colors, maxWidth, showDefault, showChoices, sectionOrder, showUsage, aboveError = "usage", onError = () => {
|
|
955
|
+
const { colors, maxWidth, showDefault, showChoices, sectionOrder, showUsage, commandList = "recursive", aboveError = "usage", onError = () => {
|
|
953
956
|
throw new RunParserError("Failed to parse command line arguments.");
|
|
954
957
|
}, stderr = console.error, stdout = console.log, brief, description, examples, author, bugs, footer } = options;
|
|
955
958
|
const norm = (c) => c === true ? {} : c;
|
|
@@ -1121,7 +1124,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1121
1124
|
const isSubcommandHelp = classified.commands.length > 0;
|
|
1122
1125
|
const isTopLevel = !isSubcommandHelp;
|
|
1123
1126
|
const shouldOverride = !isMetaCommandHelp && !isSubcommandHelp;
|
|
1124
|
-
const augmentedDoc = {
|
|
1127
|
+
const augmentedDoc = maybeCollapseCommandList({
|
|
1125
1128
|
...doc,
|
|
1126
1129
|
brief: shouldOverride ? brief ?? doc.brief : doc.brief,
|
|
1127
1130
|
description: shouldOverride ? description ?? doc.description : doc.description,
|
|
@@ -1129,7 +1132,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1129
1132
|
author: isTopLevel && !isMetaCommandHelp ? author ?? doc.author : void 0,
|
|
1130
1133
|
bugs: isTopLevel && !isMetaCommandHelp ? bugs ?? doc.bugs : void 0,
|
|
1131
1134
|
footer: shouldOverride ? footer ?? doc.footer : doc.footer ?? footer
|
|
1132
|
-
};
|
|
1135
|
+
}, commandList, isTopLevel);
|
|
1133
1136
|
stdout(formatDocPage(programName, augmentedDoc, {
|
|
1134
1137
|
colors,
|
|
1135
1138
|
maxWidth,
|
|
@@ -1190,7 +1193,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1190
1193
|
let effectiveAboveError = currentAboveError;
|
|
1191
1194
|
if (effectiveAboveError === "help") if (doc == null) effectiveAboveError = "usage";
|
|
1192
1195
|
else {
|
|
1193
|
-
const augmentedDoc = {
|
|
1196
|
+
const augmentedDoc = maybeCollapseCommandList({
|
|
1194
1197
|
...doc,
|
|
1195
1198
|
brief: brief ?? doc.brief,
|
|
1196
1199
|
description: description ?? doc.description,
|
|
@@ -1198,7 +1201,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1198
1201
|
author: author ?? doc.author,
|
|
1199
1202
|
bugs: bugs ?? doc.bugs,
|
|
1200
1203
|
footer: footer ?? doc.footer
|
|
1201
|
-
};
|
|
1204
|
+
}, commandList, classified.commandPath.length < 1);
|
|
1202
1205
|
stderr(formatDocPage(programName, augmentedDoc, {
|
|
1203
1206
|
colors,
|
|
1204
1207
|
maxWidth,
|
|
@@ -1295,6 +1298,42 @@ function runParserAsync(parser, programName, args, options) {
|
|
|
1295
1298
|
const result = runParser(parser, programName, args, options);
|
|
1296
1299
|
return Promise.resolve(result);
|
|
1297
1300
|
}
|
|
1301
|
+
function maybeCollapseCommandList(doc, commandList, isTopLevel) {
|
|
1302
|
+
if (commandList !== "top-level" || !isTopLevel) return doc;
|
|
1303
|
+
return {
|
|
1304
|
+
...doc,
|
|
1305
|
+
sections: doc.sections.map((section) => ({
|
|
1306
|
+
...section,
|
|
1307
|
+
entries: collapseTopLevelCommandEntries(section.entries)
|
|
1308
|
+
}))
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function collapseTopLevelCommandEntries(entries) {
|
|
1312
|
+
const collapsed = [];
|
|
1313
|
+
const commandIndexes = /* @__PURE__ */ new Map();
|
|
1314
|
+
for (const entry of entries) {
|
|
1315
|
+
if (entry.term.type !== "command") {
|
|
1316
|
+
collapsed.push(entry);
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
const topLevelName = getTopLevelCommandName(entry.term.name);
|
|
1320
|
+
const existingIndex = commandIndexes.get(topLevelName);
|
|
1321
|
+
const isTopLevel = entry.term.name === topLevelName;
|
|
1322
|
+
if (existingIndex == null) {
|
|
1323
|
+
commandIndexes.set(topLevelName, collapsed.length);
|
|
1324
|
+
collapsed.push(isTopLevel ? entry : { term: {
|
|
1325
|
+
...entry.term,
|
|
1326
|
+
name: topLevelName
|
|
1327
|
+
} });
|
|
1328
|
+
continue;
|
|
1329
|
+
}
|
|
1330
|
+
if (isTopLevel) collapsed[existingIndex] = entry;
|
|
1331
|
+
}
|
|
1332
|
+
return collapsed;
|
|
1333
|
+
}
|
|
1334
|
+
function getTopLevelCommandName(name) {
|
|
1335
|
+
return name.split(" ", 1)[0] ?? name;
|
|
1336
|
+
}
|
|
1298
1337
|
/**
|
|
1299
1338
|
* An error class used to indicate that the command line arguments
|
|
1300
1339
|
* could not be parsed successfully.
|
package/dist/index.d.cts
CHANGED
|
@@ -10,6 +10,6 @@ import { DeferredValue, DeferredValueOptions, DeferredValueSource, FluentParser,
|
|
|
10
10
|
import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, GroupOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, SeqOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, seq, tuple } from "./constructs.cjs";
|
|
11
11
|
import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./context.cjs";
|
|
12
12
|
import { AnyDependencySource, CombineMode, CombinedDependencyMode, DependencyMode, DependencySource, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, dependency, deriveFrom, deriveFromAsync, deriveFromSync, isDependencySource, isDerivedValueParser } from "./internal/dependency.cjs";
|
|
13
|
-
import { CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.cjs";
|
|
13
|
+
import { CommandListMode, CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.cjs";
|
|
14
14
|
import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, fail, flag, negatableFlag, option, passThrough } from "./primitives.cjs";
|
|
15
|
-
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, deferredValue, dependency, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, passThrough, port, portRange, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
|
15
|
+
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandListMode, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, deferredValue, dependency, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, passThrough, port, portRange, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ import { DeferredValue, DeferredValueOptions, DeferredValueSource, FluentParser,
|
|
|
10
10
|
import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, GroupOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, SeqOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, seq, tuple } from "./constructs.js";
|
|
11
11
|
import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./context.js";
|
|
12
12
|
import { AnyDependencySource, CombineMode, CombinedDependencyMode, DependencyMode, DependencySource, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, dependency, deriveFrom, deriveFromAsync, deriveFromSync, isDependencySource, isDerivedValueParser } from "./internal/dependency.js";
|
|
13
|
-
import { CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
|
|
13
|
+
import { CommandListMode, CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
|
|
14
14
|
import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, fail, flag, negatableFlag, option, passThrough } from "./primitives.js";
|
|
15
|
-
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, deferredValue, dependency, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, passThrough, port, portRange, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
|
15
|
+
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, Color, ColorFormat, ColorOptions, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandListMode, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, CronExpression, CronExpressionForOptions, CronOptions, DeferredMap, DeferredValue, DeferredValueOptions, DeferredValueSource, DependencyMode, DependencySource, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FileSizeOptions, FileSizeOptionsBigInt, FileSizeOptionsNumber, FileSizeUnit, FirstOfOptions, FlagErrorOptions, FlagOptions, FloatOptions, FluentParser, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, Json, JsonOptions, KeyValueOptions, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NegatableFlagErrorOptions, NegatableFlagNameList, NegatableFlagNames, NegatableFlagOptions, NegatableFlagState, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserModifiers, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, Result, RunOptions, RunParserError, RunWithOptions, SemVer, SemVerOptionsObject, SemVerOptionsString, SemVerString, SeqOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, color, command, commandLine, concat, conditional, constant, createParserContext, cron, deduplicateDocEntries, deduplicateDocFragments, deferredValue, dependency, deriveFrom, deriveFromAsync, deriveFromSync, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fileSize, firstOf, fish, flag, float, fluent, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredValue, isDependencySource, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isSuggestionHidden, isUsageHidden, isValueParser, json, keyValue, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, negatableFlag, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, passThrough, port, portRange, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, semVer, seq, socketAddress, string, suggest, suggestAsync, suggestSync, text, tuple, url, uuid, value, valueSet, values, withDefault, zsh };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.2.0-dev.
|
|
3
|
+
"version": "1.2.0-dev.2301",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
"fast-check": "^4.7.0",
|
|
226
226
|
"tsdown": "^0.13.0",
|
|
227
227
|
"typescript": "^5.8.3",
|
|
228
|
-
"@optique/env": "1.2.0-dev.
|
|
228
|
+
"@optique/env": "1.2.0-dev.2301+7cd22796"
|
|
229
229
|
},
|
|
230
230
|
"scripts": {
|
|
231
231
|
"build": "tsdown",
|
package/skills/optique/SKILL.md
CHANGED
|
@@ -55,6 +55,8 @@ Core rules
|
|
|
55
55
|
apps. Do not hand-write completion scripts from parser metadata.
|
|
56
56
|
- Use `showUsage: false` in runner options when full help should show the
|
|
57
57
|
brief and command or option sections without the `Usage:` synopsis.
|
|
58
|
+
For deeply nested command trees, add `commandList: "top-level"` when root
|
|
59
|
+
help should list only first-level command groups.
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
Canonical app shape
|