politty 0.11.2 → 0.11.3
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/cli.js +2 -2
- package/dist/completion/index.js +1 -1
- package/dist/{completion-B1K87cU5.js → completion-BEGiVJST.js} +3 -2
- package/dist/docs/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{runner-CEDtiI7D.js → runner-cEPqI3qs.js} +3 -2
- package/dist/skill/index.d.ts +28 -0
- package/dist/skill/index.js +34 -9
- package/package.json +5 -5
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-cEPqI3qs.js";
|
|
3
3
|
import { s as arg } from "./schema-extractor-wzJ1cGon.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-BEGiVJST.js";
|
|
6
6
|
import "./index.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
|
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-BEGiVJST.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 };
|
|
@@ -1802,7 +1802,8 @@ function collectTrackedFields(root, specs, globalOptions = []) {
|
|
|
1802
1802
|
return groups;
|
|
1803
1803
|
};
|
|
1804
1804
|
const addGlobalDepTracker = (dep, opt, spec) => {
|
|
1805
|
-
const
|
|
1805
|
+
const allTokens = collectOptionTokens(opt.cliName, opt.alias);
|
|
1806
|
+
const groups = groupGlobalFramesByTokenSet(allTokens, spec.pathStrs, spec.intermediatePathStrs);
|
|
1806
1807
|
for (const [tokenKey, group] of groups) addPath(`g::${dep}::${tokenKey}`, {
|
|
1807
1808
|
fieldName: dep,
|
|
1808
1809
|
isGlobal: true,
|
|
@@ -5606,4 +5607,4 @@ function maybeSpawnRefresh(argv, ctx) {
|
|
|
5606
5607
|
|
|
5607
5608
|
//#endregion
|
|
5608
5609
|
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 };
|
|
5609
|
-
//# sourceMappingURL=completion-
|
|
5610
|
+
//# sourceMappingURL=completion-BEGiVJST.js.map
|
package/dist/docs/index.js
CHANGED
|
@@ -920,7 +920,7 @@ async function executeSingleExample(example, rootCommand, commandPath) {
|
|
|
920
920
|
collector.start();
|
|
921
921
|
let success = true;
|
|
922
922
|
try {
|
|
923
|
-
const { runCommand } = await import("../runner-
|
|
923
|
+
const { runCommand } = await import("../runner-cEPqI3qs.js").then((n) => n.r);
|
|
924
924
|
const result = await runCommand(rootCommand, argv);
|
|
925
925
|
success = result.success;
|
|
926
926
|
if (!result.success && result.error) console.error(result.error.message);
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ReservedFieldNameError, D as createDualCaseProxy, E as renderMarkdown, S as ReservedAliasError, T as renderInline, _ as DuplicateAliasError, a as parseArgv, b as FieldTypeConflictError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as CaseVariantCollisionError, h as validateReservedFieldNames, i as formatValidationErrors, l as validateCrossSchemaCollisions, m as validateReservedAliases, n as runMain, o as formatCommandValidationErrors, p as validatePositionalConfig, s as validateCaseVariantCollisions, t as runCommand, u as validateDuplicateAliases, v as DuplicateFieldError, w as generateHelp, x as PositionalConfigError, y as DuplicateNegationError } from "./runner-
|
|
1
|
+
import { C as ReservedFieldNameError, D as createDualCaseProxy, E as renderMarkdown, S as ReservedAliasError, T as renderInline, _ as DuplicateAliasError, a as parseArgv, b as FieldTypeConflictError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as CaseVariantCollisionError, h as validateReservedFieldNames, i as formatValidationErrors, l as validateCrossSchemaCollisions, m as validateReservedAliases, n as runMain, o as formatCommandValidationErrors, p as validatePositionalConfig, s as validateCaseVariantCollisions, t as runCommand, u as validateDuplicateAliases, v as DuplicateFieldError, w as generateHelp, x as PositionalConfigError, y as DuplicateNegationError } from "./runner-cEPqI3qs.js";
|
|
2
2
|
import { a as toCamelCase, i as getUnknownKeysMode, o as toKebabCase, s as arg, t as extractFields } from "./schema-extractor-wzJ1cGon.js";
|
|
3
3
|
import { n as defineCommand, t as createDefineCommand } from "./command-B4yA4LXX.js";
|
|
4
4
|
import { o as isLazyCommand, s as lazy } from "./subcommand-router-CTzHPGzF.js";
|
|
5
|
-
import { a as generateCompletion, p as generateBundledCompletionWorker, s as withCompletionCommand } from "./completion-
|
|
5
|
+
import { a as generateCompletion, p as generateBundledCompletionWorker, s as withCompletionCommand } from "./completion-BEGiVJST.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, FieldTypeConflictError, PositionalConfigError, ReservedAliasError, ReservedFieldNameError, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateBundledCompletionWorker, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, validateReservedFieldNames, withCompletionCommand };
|
|
@@ -522,7 +522,8 @@ function renderBlock(block) {
|
|
|
522
522
|
`${pipe} ${renderedHeaders.map((h, i) => styles.bold(alignText(h, colWidths[i], block.alignments[i] ?? "left"))).join(` ${pipe} `)} ${pipe}`,
|
|
523
523
|
midBorder,
|
|
524
524
|
...renderedRows.map((row) => {
|
|
525
|
-
|
|
525
|
+
const cells = row.map((cell, i) => alignText(cell, colWidths[i], block.alignments[i] ?? "left"));
|
|
526
|
+
return `${pipe} ${cells.join(` ${pipe} `)} ${pipe}`;
|
|
526
527
|
}),
|
|
527
528
|
botBorder
|
|
528
529
|
].join("\n");
|
|
@@ -2968,4 +2969,4 @@ function extractAndValidateGlobal(options) {
|
|
|
2968
2969
|
|
|
2969
2970
|
//#endregion
|
|
2970
2971
|
export { ReservedFieldNameError as C, createDualCaseProxy as D, renderMarkdown as E, ReservedAliasError as S, renderInline as T, DuplicateAliasError as _, parseArgv as a, FieldTypeConflictError as b, validateCommand as c, validateDuplicateFields as d, validateDuplicateNegations as f, CaseVariantCollisionError as g, validateReservedFieldNames as h, formatValidationErrors as i, validateCrossSchemaCollisions as l, validateReservedAliases as m, runMain as n, formatCommandValidationErrors as o, validatePositionalConfig as p, runner_exports as r, validateCaseVariantCollisions as s, runCommand as t, validateDuplicateAliases as u, DuplicateFieldError as v, generateHelp as w, PositionalConfigError as x, DuplicateNegationError as y };
|
|
2971
|
-
//# sourceMappingURL=runner-
|
|
2972
|
+
//# sourceMappingURL=runner-cEPqI3qs.js.map
|
package/dist/skill/index.d.ts
CHANGED
|
@@ -360,6 +360,34 @@ interface SkillCommandOptions {
|
|
|
360
360
|
/** Primary name + aliases for `skills add`. Default: `["add", "install"]`. */add?: string[]; /** Primary name + aliases for `skills remove`. Default: `["remove", "uninstall"]`. */
|
|
361
361
|
remove?: string[];
|
|
362
362
|
};
|
|
363
|
+
/**
|
|
364
|
+
* Override the description text for the `skills` command and/or its
|
|
365
|
+
* built-in subcommands. Any key left unset keeps politty's default
|
|
366
|
+
* description for that command.
|
|
367
|
+
*
|
|
368
|
+
* Keys refer to the subcommand's *canonical role*, not its dispatched
|
|
369
|
+
* name — e.g. `descriptions.add` still applies after `commandMap.add`
|
|
370
|
+
* renames the subcommand to something else.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```ts
|
|
374
|
+
* withSkillCommand(cmd, {
|
|
375
|
+
* sourceDir, package: "@my-agent/skills",
|
|
376
|
+
* commandMap: { add: ["setup", "add", "install"] },
|
|
377
|
+
* descriptions: {
|
|
378
|
+
* skills: "Manage My Agent skills",
|
|
379
|
+
* add: "Install My Agent skills", // still keyed by "add", not "setup"
|
|
380
|
+
* },
|
|
381
|
+
* });
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
descriptions?: {
|
|
385
|
+
/** Description for the top-level `skills` command. Default: `"Manage agent skills"`. */skills?: string; /** Description for `skills sync`. Default: `"Remove and reinstall all skills from source"`. */
|
|
386
|
+
sync?: string; /** Description for `skills add`. Default: `"Install skills from source"`. */
|
|
387
|
+
add?: string; /** Description for `skills remove`. Default: `"Remove installed skills"`. */
|
|
388
|
+
remove?: string; /** Description for `skills list`. Default: `"List available skills from source"`. */
|
|
389
|
+
list?: string;
|
|
390
|
+
};
|
|
363
391
|
}
|
|
364
392
|
/**
|
|
365
393
|
* Result of wrapping `T` with {@link withSkillCommand} — `T` with a
|
package/dist/skill/index.js
CHANGED
|
@@ -1030,7 +1030,7 @@ function createSkillSyncCommand(resolved) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
if (resolved.verbose.disabled) return defineCommand({
|
|
1032
1032
|
name: "sync",
|
|
1033
|
-
description:
|
|
1033
|
+
description: resolved.descriptions.sync,
|
|
1034
1034
|
args: applyUnknownKeys(z.object({ exclude: arg(z.array(z.string()).default([]), excludeArgMeta(resolved)) }), resolved.unknownKeys),
|
|
1035
1035
|
run(args) {
|
|
1036
1036
|
runSync(args, mergedFlag(args, "verbose"));
|
|
@@ -1038,7 +1038,7 @@ function createSkillSyncCommand(resolved) {
|
|
|
1038
1038
|
});
|
|
1039
1039
|
return defineCommand({
|
|
1040
1040
|
name: "sync",
|
|
1041
|
-
description:
|
|
1041
|
+
description: resolved.descriptions.sync,
|
|
1042
1042
|
args: applyUnknownKeys(z.object({
|
|
1043
1043
|
exclude: arg(z.array(z.string()).default([]), excludeArgMeta(resolved)),
|
|
1044
1044
|
verbose: arg(z.boolean().default(false), verboseArgMeta(resolved))
|
|
@@ -1090,7 +1090,7 @@ function createSkillAddCommand(resolved) {
|
|
|
1090
1090
|
if (resolved.verbose.disabled) return defineCommand({
|
|
1091
1091
|
name: resolved.commandNames.add.name,
|
|
1092
1092
|
...resolved.commandNames.add.aliases.length > 0 ? { aliases: resolved.commandNames.add.aliases } : {},
|
|
1093
|
-
description:
|
|
1093
|
+
description: resolved.descriptions.add,
|
|
1094
1094
|
args: applyUnknownKeys(z.object({ name: arg(z.array(z.string()).default([]), nameArgMeta) }), resolved.unknownKeys),
|
|
1095
1095
|
run(args) {
|
|
1096
1096
|
runAdd(args, mergedFlag(args, "verbose"));
|
|
@@ -1099,7 +1099,7 @@ function createSkillAddCommand(resolved) {
|
|
|
1099
1099
|
return defineCommand({
|
|
1100
1100
|
name: resolved.commandNames.add.name,
|
|
1101
1101
|
...resolved.commandNames.add.aliases.length > 0 ? { aliases: resolved.commandNames.add.aliases } : {},
|
|
1102
|
-
description:
|
|
1102
|
+
description: resolved.descriptions.add,
|
|
1103
1103
|
args: applyUnknownKeys(z.object({
|
|
1104
1104
|
name: arg(z.array(z.string()).default([]), nameArgMeta),
|
|
1105
1105
|
verbose: arg(z.boolean().default(false), verboseArgMeta(resolved))
|
|
@@ -1121,7 +1121,7 @@ function createSkillRemoveCommand(resolved) {
|
|
|
1121
1121
|
return defineCommand({
|
|
1122
1122
|
name: resolved.commandNames.remove.name,
|
|
1123
1123
|
...resolved.commandNames.remove.aliases.length > 0 ? { aliases: resolved.commandNames.remove.aliases } : {},
|
|
1124
|
-
description:
|
|
1124
|
+
description: resolved.descriptions.remove,
|
|
1125
1125
|
args: applyUnknownKeys(z.object({ name: arg(z.string().optional(), {
|
|
1126
1126
|
positional: true,
|
|
1127
1127
|
description: "Skill name to remove (default: all)",
|
|
@@ -1213,7 +1213,7 @@ function createSkillListCommand(resolved) {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
if (resolved.json.disabled) return defineCommand({
|
|
1215
1215
|
name: "list",
|
|
1216
|
-
description:
|
|
1216
|
+
description: resolved.descriptions.list,
|
|
1217
1217
|
args: applyUnknownKeys(z.object({}), resolved.unknownKeys),
|
|
1218
1218
|
run(args) {
|
|
1219
1219
|
runList(mergedFlag(args, "json"));
|
|
@@ -1221,7 +1221,7 @@ function createSkillListCommand(resolved) {
|
|
|
1221
1221
|
});
|
|
1222
1222
|
return defineCommand({
|
|
1223
1223
|
name: "list",
|
|
1224
|
-
description:
|
|
1224
|
+
description: resolved.descriptions.list,
|
|
1225
1225
|
args: applyUnknownKeys(z.object({ json: arg(z.boolean().default(false), { description: "Output as JSON" }) }), resolved.unknownKeys),
|
|
1226
1226
|
run(args) {
|
|
1227
1227
|
runList(args.json);
|
|
@@ -1454,6 +1454,18 @@ const DEFAULT_ADD_NAMES = ["add", "install"];
|
|
|
1454
1454
|
/** Default primary name + aliases for `skills remove`. */
|
|
1455
1455
|
const DEFAULT_REMOVE_NAMES = ["remove", "uninstall"];
|
|
1456
1456
|
/**
|
|
1457
|
+
* Default description text for the `skills` command and each built-in
|
|
1458
|
+
* subcommand, keyed by canonical role. Overridden per-key via
|
|
1459
|
+
* `SkillCommandOptions.descriptions`.
|
|
1460
|
+
*/
|
|
1461
|
+
const DEFAULT_DESCRIPTIONS = {
|
|
1462
|
+
skills: "Manage agent skills",
|
|
1463
|
+
sync: "Remove and reinstall all skills from source",
|
|
1464
|
+
add: "Install skills from source",
|
|
1465
|
+
remove: "Remove installed skills",
|
|
1466
|
+
list: "List available skills from source"
|
|
1467
|
+
};
|
|
1468
|
+
/**
|
|
1457
1469
|
* Same safe-token pattern politty's own command validator enforces for
|
|
1458
1470
|
* subcommand aliases (`checkSubCommandAliasConflicts` in
|
|
1459
1471
|
* src/validator/command-validator.ts). That check only runs when a host
|
|
@@ -1482,6 +1494,8 @@ const PROJECT_ROOT_MARKERS = [".git", "package.json"];
|
|
|
1482
1494
|
* - `unknownKeys` — `"strip"` unless overridden via `options.unknownKeys`.
|
|
1483
1495
|
* - `descriptionAppend` — a one-line hint mentioning the skills
|
|
1484
1496
|
* subcommands. Pass an explicit string to override or `false` to opt out.
|
|
1497
|
+
* - `descriptions` — politty's default text per canonical role, unless
|
|
1498
|
+
* overridden via `options.descriptions`.
|
|
1485
1499
|
*/
|
|
1486
1500
|
function resolveSkillOptions(options, cliName) {
|
|
1487
1501
|
return {
|
|
@@ -1498,7 +1512,18 @@ function resolveSkillOptions(options, cliName) {
|
|
|
1498
1512
|
},
|
|
1499
1513
|
unknownKeys: options.unknownKeys ?? DEFAULT_UNKNOWN_KEYS,
|
|
1500
1514
|
descriptionAppend: resolveDescriptionAppend(options.descriptionAppend, cliName),
|
|
1501
|
-
stamp: `${options.package}:${cliName}
|
|
1515
|
+
stamp: `${options.package}:${cliName}`,
|
|
1516
|
+
descriptions: resolveDescriptions(options.descriptions)
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
/** Fill in {@link DEFAULT_DESCRIPTIONS} for any key the caller left unset. */
|
|
1520
|
+
function resolveDescriptions(value) {
|
|
1521
|
+
return {
|
|
1522
|
+
skills: value?.skills ?? DEFAULT_DESCRIPTIONS.skills,
|
|
1523
|
+
sync: value?.sync ?? DEFAULT_DESCRIPTIONS.sync,
|
|
1524
|
+
add: value?.add ?? DEFAULT_DESCRIPTIONS.add,
|
|
1525
|
+
remove: value?.remove ?? DEFAULT_DESCRIPTIONS.remove,
|
|
1526
|
+
list: value?.list ?? DEFAULT_DESCRIPTIONS.list
|
|
1502
1527
|
};
|
|
1503
1528
|
}
|
|
1504
1529
|
function resolveCwd(override) {
|
|
@@ -1691,7 +1716,7 @@ function withSkillCommand(command, options) {
|
|
|
1691
1716
|
if (duplicate) throw new Error(`withSkillCommand: commandMap produced duplicate subcommand name/alias "${duplicate}".`);
|
|
1692
1717
|
const skillsSubCommand = defineCommand({
|
|
1693
1718
|
name: "skills",
|
|
1694
|
-
description:
|
|
1719
|
+
description: resolved.descriptions.skills,
|
|
1695
1720
|
subCommands: {
|
|
1696
1721
|
sync: createSkillSyncCommand(resolved),
|
|
1697
1722
|
[addName]: createSkillAddCommand(resolved),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "politty",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
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",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@inquirer/prompts": "8.5.2",
|
|
70
70
|
"@quansync/fs": "1.0.0",
|
|
71
71
|
"@types/node": "25.9.4",
|
|
72
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
73
|
-
"@vitest/coverage-v8": "4.1.
|
|
72
|
+
"@typescript/native-preview": "7.0.0-dev.20260705.1",
|
|
73
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
74
74
|
"knip": "6.24.0",
|
|
75
75
|
"lefthook": "2.1.9",
|
|
76
76
|
"organize-imports-cli": "1.0.2",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
"oxlint": "1.72.0",
|
|
79
79
|
"quansync": "1.0.0",
|
|
80
80
|
"tsdown": "0.22.3",
|
|
81
|
-
"tsx": "4.
|
|
81
|
+
"tsx": "4.23.0",
|
|
82
82
|
"typescript": "6.0.3",
|
|
83
|
-
"vitest": "4.1.
|
|
83
|
+
"vitest": "4.1.10",
|
|
84
84
|
"zod": "4.4.3"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|