@unbrained/pm-cli 2026.8.25 → 2026.8.27
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/.agents/skills/HARNESS_COMPATIBILITY.md +32 -0
- package/.agents/skills/README.md +47 -0
- package/.agents/skills/pm-developer/SKILL.md +117 -0
- package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +49 -0
- package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +91 -0
- package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +72 -0
- package/.agents/skills/pm-developer/references/PROMPTS.md +17 -0
- package/.agents/skills/pm-developer/references/SCRIPTING_COMPOSITION.md +82 -0
- package/.agents/skills/pm-developer/references/TOKEN_BUDGETS.md +85 -0
- package/.agents/skills/pm-extensions/SKILL.md +106 -0
- package/.agents/skills/pm-extensions/references/AUTHORING.md +95 -0
- package/.agents/skills/pm-extensions/references/LIFECYCLE.md +40 -0
- package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +25 -0
- package/.agents/skills/pm-sdk/SKILL.md +107 -0
- package/.agents/skills/pm-sdk/references/DOMAIN_MODELING.md +78 -0
- package/.agents/skills/pm-sdk/references/INTEGRATION_CHECKLIST.md +31 -0
- package/.agents/skills/pm-sdk/references/PROMPTS.md +13 -0
- package/.agents/skills/pm-sdk/references/SURFACE_MAP.md +82 -0
- package/.agents/skills/pm-user/SKILL.md +111 -0
- package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +105 -0
- package/.agents/skills/pm-user/references/PROMPTS.md +17 -0
- package/.agents/skills/pm-user/references/WORKFLOWS.md +35 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +58 -3
- package/README.md +8 -5
- package/dist/cli/commander-usage.js +11 -7
- package/dist/cli/error-guidance.js +3 -3
- package/dist/cli/help-content.d.ts +2 -0
- package/dist/cli/help-content.js +53 -17
- package/dist/cli/help-json-payload.d.ts +8 -2
- package/dist/cli/help-json-payload.js +46 -12
- package/dist/cli/main.js +52 -74
- package/dist/cli/register-annotations.js +27 -21
- package/dist/cli/register-setup.js +98 -57
- package/dist/cli-bundle/bundle-manifest.json +156 -156
- package/dist/cli-bundle/chunks/chunk-3OO3W6FW.js +202 -0
- package/dist/cli-bundle/chunks/chunk-52EKTW6V.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-QLUORNIB.js → chunk-CVBBGWW5.js} +62 -44
- package/dist/cli-bundle/chunks/chunk-MFNTKMTI.js +13 -0
- package/dist/cli-bundle/chunks/chunk-OS27HHBN.js +35 -0
- package/dist/cli-bundle/chunks/chunk-QTO7USTH.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-5I5RWIJC.js → chunk-R4ETAOJC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OWHNAR2B.js → chunk-SH6P7FXI.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SHMDY36D.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-244MI4GS.js → chunk-SKXLJIEK.js} +60 -60
- package/dist/cli-bundle/chunks/chunk-TNX6HC54.js +3 -0
- package/dist/cli-bundle/chunks/{register-list-query-XVN2ZLI7.js → register-list-query-EUWM6VII.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-QCKAEGIJ.js → register-mutation-FD4HSAVU.js} +4 -4
- package/dist/cli-bundle/chunks/{register-operations-SDEAXE7E.js → register-operations-HRMNFEC3.js} +2 -2
- package/dist/cli-bundle/chunks/register-setup-33GNICLX.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IBZZZGK3.js → chunk-2AGZ5BRT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4BR5UU52.js +50 -0
- package/dist/cli-bundle/focused-chunks/{chunk-OHIHZ7HS.js → chunk-6GCRSLPG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OVJL6NZE.js → chunk-AD6ULRAF.js} +4 -4
- package/dist/cli-bundle/focused-chunks/{chunk-7YCDTCBC.js → chunk-AQ5IYEZZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YO3ZF3FI.js → chunk-EKX37ZHA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-N7W67YIG.js → chunk-FC2AXLB5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-H5JZEIQV.js → chunk-HC7ODMH3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NOOZGIXP.js → chunk-HVQ22RC4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-A644DUFQ.js → chunk-MEASX544.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RAFKLNZX.js → chunk-MXTYGECH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2UIWOP3O.js → chunk-SUBSWYW3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VXWATRFL.js → chunk-XDPYBQCF.js} +9 -9
- package/dist/cli-bundle/focused-chunks/{chunk-XUQPEKRN.js → chunk-Y3JJXRVK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GQR3WH3F.js → chunk-Y5A7SJJ7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YHWHX6YY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ONYQCALA.js → chunk-YVVZ3LQ6.js} +6 -6
- package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +5 -0
- package/dist/cli-bundle/main.js +15 -14
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +31 -31
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +31 -31
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +32 -6
- package/dist/core/extensions/manifest-schema.d.ts +20 -0
- package/dist/core/extensions/manifest-schema.js +28 -10
- package/dist/core/governance/issue-codes.d.ts +11 -2
- package/dist/core/governance/issue-codes.js +29 -10
- package/dist/core/item/item-format.js +3 -3
- package/dist/core/store/item-store.js +12 -5
- package/dist/mcp/http-server.d.ts +60 -0
- package/dist/mcp/http-server.js +451 -0
- package/dist/mcp/legacy-adapter.d.ts +50 -0
- package/dist/mcp/legacy-adapter.js +64 -0
- package/dist/mcp/server.d.ts +42 -9
- package/dist/mcp/server.js +572 -59
- package/dist/mcp/tool-definitions.d.ts +2 -0
- package/dist/mcp/tool-definitions.js +2 -2
- package/dist/sdk/agent/closed-domain-contracts.d.ts +1 -1
- package/dist/sdk/agent/closed-domain-contracts.js +24 -2
- package/dist/sdk/agent/refusal-closure-census.d.ts +6 -2
- package/dist/sdk/agent/refusal-closure-census.js +16 -8
- package/dist/sdk/agent-capability-contracts.js +6 -2
- package/dist/sdk/cli-bootstrap.js +3 -2
- package/dist/sdk/cli-contracts/command-aliases.js +15 -2
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +7 -2
- package/dist/sdk/cli-contracts/flag-contracts.js +9 -5
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +3 -3
- package/dist/sdk/cli-contracts/grammar-contracts.js +24 -17
- package/dist/sdk/cli-contracts/runtime-contracts.js +13 -11
- package/dist/sdk/cli-contracts/tool-schema.js +18 -15
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/completion.js +40 -13
- package/dist/sdk/compose.d.ts +4 -1
- package/dist/sdk/compose.js +23 -36
- package/dist/sdk/extension/author-manifest.d.ts +22 -0
- package/dist/sdk/extension/author-manifest.js +93 -0
- package/dist/sdk/extension.js +6 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +20 -5
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +18 -3
- package/dist/sdk/governance/health.js +7 -2
- package/dist/sdk/governance/upgrade.d.ts +2 -0
- package/dist/sdk/governance/upgrade.js +30 -8
- package/dist/sdk/governance/validate.js +8 -6
- package/dist/sdk/guide-topics.js +6 -6
- package/dist/sdk/index.d.ts +10 -2
- package/dist/sdk/index.js +11 -3
- package/dist/sdk/mcp/apps.d.ts +70 -0
- package/dist/sdk/mcp/apps.js +154 -0
- package/dist/sdk/mcp/authorization.d.ts +134 -0
- package/dist/sdk/mcp/authorization.js +405 -0
- package/dist/sdk/mcp/interactions.d.ts +118 -0
- package/dist/sdk/mcp/interactions.js +337 -0
- package/dist/sdk/mcp/protocol.d.ts +142 -0
- package/dist/sdk/mcp/protocol.js +174 -0
- package/dist/sdk/mcp/skills.d.ts +127 -0
- package/dist/sdk/mcp/skills.js +390 -0
- package/dist/sdk/mcp/subscriptions.d.ts +65 -0
- package/dist/sdk/mcp/subscriptions.js +212 -0
- package/dist/sdk/mcp/tasks.d.ts +107 -0
- package/dist/sdk/mcp/tasks.js +431 -0
- package/dist/sdk/mcp/transport.d.ts +30 -0
- package/dist/sdk/mcp/transport.js +261 -0
- package/dist/sdk/merge/receipts.d.ts +16 -0
- package/dist/sdk/merge/receipts.js +9 -8
- package/dist/sdk/read-output-contracts.js +16 -3
- package/dist/sdk/runtime-action-aliases.js +7 -3
- package/dist/sdk/runtime-input.js +12 -4
- package/dist/sdk/runtime-primitives.d.ts +2 -2
- package/dist/sdk/runtime-primitives.js +4 -4
- package/dist/sdk/test/execution.d.ts +6 -0
- package/dist/sdk/test/execution.js +32 -3
- package/docs/AGENT_PROVENANCE_ADR.md +6 -4
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +6 -5
- package/docs/CLAUDE_CODE_PLUGIN.md +12 -5
- package/docs/CLI_GRAMMAR.md +7 -1
- package/docs/COMMANDS.md +2 -2
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +8 -0
- package/docs/EXTENSIONS.md +36 -36
- package/docs/MCP_2026_07_28.md +160 -0
- package/docs/MCP_2026_07_28_CONFORMANCE.md +30 -0
- package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +180 -0
- package/docs/MCP_SKILLS_AND_APPS.md +107 -0
- package/docs/QUICKSTART.md +15 -15
- package/docs/README.md +5 -0
- package/docs/RELEASING.md +12 -3
- package/docs/SDK.md +22 -1
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +18 -13
- package/docs/SDK_CONTEXT_INTEGRITY.md +6 -0
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +9 -1
- package/docs/SDK_MCP_INTERACTIONS.md +227 -0
- package/docs/TESTING.md +4 -0
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +13 -11
- package/marketplace.json +2 -2
- package/package.json +15 -11
- package/packages/pm-beads/README.md +12 -6
- package/packages/pm-beads/docs/MIGRATION.md +53 -0
- package/packages/pm-beads/extensions/beads/index.ts +8 -0
- package/packages/pm-beads/extensions/beads/runtime.ts +671 -112
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/finalize-build.mjs +1 -0
- package/sdk/public-surface.json +902 -54
- package/dist/cli-bundle/chunks/chunk-2F3LUFMW.js +0 -8
- package/dist/cli-bundle/chunks/chunk-65MHLHAA.js +0 -2
- package/dist/cli-bundle/chunks/chunk-6C7GIMIL.js +0 -13
- package/dist/cli-bundle/chunks/chunk-QKGMHGEI.js +0 -202
- package/dist/cli-bundle/chunks/chunk-T2ENPRXF.js +0 -3
- package/dist/cli-bundle/chunks/chunk-TPQIBSL2.js +0 -3
- package/dist/cli-bundle/chunks/chunk-YQMYF3YD.js +0 -35
- package/dist/cli-bundle/chunks/register-setup-LXVBRCJ3.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-42S3GGZ7.js +0 -50
- package/dist/cli-bundle/focused-chunks/chunk-7I23XGWO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LMKG3DFE.js +0 -5
|
@@ -31,6 +31,12 @@ export interface HelpSubcommandSummary {
|
|
|
31
31
|
tier: PmCommandVisibilityTier;
|
|
32
32
|
/** Shared command capability family. */
|
|
33
33
|
family: PmCommandCapabilityFamily;
|
|
34
|
+
/** Canonical command path when this row is an executable alias. */
|
|
35
|
+
alias_for?: string;
|
|
36
|
+
/** Compatibility lifecycle declared by the canonical alias contract. */
|
|
37
|
+
alias_lifecycle?: "permanent" | "deprecated";
|
|
38
|
+
/** True when callers should migrate from this executable spelling. */
|
|
39
|
+
deprecated?: true;
|
|
34
40
|
}
|
|
35
41
|
type ExtensionCommandSurface = Pick<ExtensionCommandHelpDescriptor, "tier" | "family">;
|
|
36
42
|
declare function resolveExtensionCommandSurface(commandPath: string, descriptors: ReadonlyMap<string, ExtensionCommandHelpDescriptor>, allowDescendants?: boolean): ExtensionCommandSurface | undefined;
|
|
@@ -40,7 +46,7 @@ declare function buildOptionAliasMap(options: unknown[]): Map<string, string[]>;
|
|
|
40
46
|
declare function buildHelpOptionSummaries(command: Command): HelpOptionSummary[];
|
|
41
47
|
declare function compactHelpOptionAliases(options: HelpOptionSummary[]): HelpOptionSummary[];
|
|
42
48
|
declare function buildHelpArgumentSummaries(command: Command): HelpArgumentSummary[];
|
|
43
|
-
declare function buildHelpSubcommandSummaries(command: Command, extensionDescriptors?: ReadonlyMap<string, ExtensionCommandHelpDescriptor
|
|
49
|
+
declare function buildHelpSubcommandSummaries(command: Command, extensionDescriptors?: ReadonlyMap<string, ExtensionCommandHelpDescriptor>, includeAll?: boolean): HelpSubcommandSummary[];
|
|
44
50
|
interface PositionalActionHelpProjection {
|
|
45
51
|
arguments: HelpArgumentSummary[];
|
|
46
52
|
options: HelpOptionSummary[];
|
|
@@ -48,7 +54,7 @@ interface PositionalActionHelpProjection {
|
|
|
48
54
|
usage: string;
|
|
49
55
|
}
|
|
50
56
|
/** Build the command/action structural view shared by every JSON help field. */
|
|
51
|
-
declare function buildPositionalActionHelpProjection(action: PmPositionalActionContract | undefined, targetCommand: Command, resolvedPath: string, allOptions: HelpOptionSummary[], extensionDescriptors?: ReadonlyMap<string, ExtensionCommandHelpDescriptor
|
|
57
|
+
declare function buildPositionalActionHelpProjection(action: PmPositionalActionContract | undefined, targetCommand: Command, resolvedPath: string, allOptions: HelpOptionSummary[], extensionDescriptors?: ReadonlyMap<string, ExtensionCommandHelpDescriptor>, includeAll?: boolean): PositionalActionHelpProjection;
|
|
52
58
|
declare function buildJsonHelpPayload(rootProgram: Command, targetCommand: Command, argv: string[], requestedPath: string[], extensionDescriptors: ReadonlyMap<string, ExtensionCommandHelpDescriptor>): Record<string, unknown>;
|
|
53
59
|
/** Implements maybe render bootstrap json help for the public runtime surface of this module. */
|
|
54
60
|
export declare function maybeRenderBootstrapJsonHelp(rootProgram: Command, argv: string[], extensionDescriptors: ReadonlyMap<string, ExtensionCommandHelpDescriptor>): Promise<boolean>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { hasSubcommandFlagContractsForCommand, PM_CORE_COMMAND_NAMES, } from "../sdk/cli-contracts.js";
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="43167bb0-7cc0-599f-8587-8583d398f1ad")}catch(e){}}();
|
|
3
|
+
import { hasSubcommandFlagContractsForCommand, PM_COMMAND_ALIAS_CONTRACTS, PM_CORE_COMMAND_NAMES, } from "../sdk/cli-contracts.js";
|
|
4
4
|
import { commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveTypeDefinition, EXIT_CODE, printError, writeStdout, } from "../sdk/runtime-primitives.js";
|
|
5
5
|
import { buildDynamicExtensionHelpOptionSummaries, mergeHelpOptionSummaries, findCommandByPath, findDirectChildCommand, commandAliases, } from "./extension-command-help.js";
|
|
6
|
-
import { getPmCommandHelpVisibilityTier, normalizeHelpCommandPath, resolveHelpDetailMode, resolveHelpNarrative, } from "./help-content.js";
|
|
6
|
+
import { getPmCommandHelpVisibilityTier, isFullHelpDiscovery, normalizeHelpCommandPath, resolveHelpDetailMode, resolveHelpNarrative, } from "./help-content.js";
|
|
7
7
|
import { getCommandPath } from "./registration-helpers.js";
|
|
8
8
|
import { parseBootstrapGlobalOptions, parseBootstrapHelpRequest, parseBootstrapCommandName, parseBootstrapTypeValue, } from "./bootstrap-args.js";
|
|
9
9
|
import { extractProvidedOptionFlags, renderPmCommand } from "./argv-utils.js";
|
|
@@ -206,23 +206,40 @@ function buildHelpArgumentSummaries(command) {
|
|
|
206
206
|
};
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
|
-
function buildHelpSubcommandSummaries(command, extensionDescriptors = new Map()) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
function buildHelpSubcommandSummaries(command, extensionDescriptors = new Map(), includeAll = false) {
|
|
210
|
+
const visible = command.createHelp().visibleCommands(command);
|
|
211
|
+
const candidates = includeAll
|
|
212
|
+
? [...new Set([...visible, ...command.commands])]
|
|
213
|
+
: visible;
|
|
214
|
+
return candidates
|
|
213
215
|
.filter((entry) => entry.name() !== "help" || command.parent === null)
|
|
216
|
+
.filter((entry) => !includeAll ||
|
|
217
|
+
(getPmCommandHelpVisibilityTier(entry) ??
|
|
218
|
+
resolvePmCommandVisibilityTier(entry.name())) !== "internal")
|
|
214
219
|
.map((entry) => {
|
|
215
220
|
const commandPath = normalizeHelpCommandPath(getCommandPath(entry));
|
|
216
221
|
const rootCommand = commandPath.split(" ")[0];
|
|
217
|
-
const
|
|
222
|
+
const declaredTier = getPmCommandHelpVisibilityTier(entry);
|
|
223
|
+
const extensionDescriptor = resolveExtensionCommandSurface(commandPath, extensionDescriptors, declaredTier !== undefined);
|
|
224
|
+
const aliasContract = PM_COMMAND_ALIAS_CONTRACTS.find(({ alias }) => alias === commandPath);
|
|
218
225
|
return {
|
|
219
226
|
name: entry.name().trim(),
|
|
220
227
|
aliases: commandAliases(entry),
|
|
221
228
|
description: entry.description().trim(),
|
|
222
229
|
tier: extensionDescriptor?.tier ??
|
|
230
|
+
declaredTier ??
|
|
223
231
|
resolvePmCommandVisibilityTier(rootCommand),
|
|
224
232
|
family: extensionDescriptor?.family ??
|
|
225
233
|
resolvePmCommandCapabilityFamily(rootCommand),
|
|
234
|
+
...(aliasContract
|
|
235
|
+
? {
|
|
236
|
+
alias_for: aliasContract.canonical,
|
|
237
|
+
alias_lifecycle: aliasContract.lifecycle,
|
|
238
|
+
...(aliasContract.lifecycle === "deprecated"
|
|
239
|
+
? { deprecated: true }
|
|
240
|
+
: {}),
|
|
241
|
+
}
|
|
242
|
+
: {}),
|
|
226
243
|
};
|
|
227
244
|
})
|
|
228
245
|
.sort((left, right) => left.name.localeCompare(right.name));
|
|
@@ -263,11 +280,23 @@ function resolveJsonHelpCapabilityFamily(rootCommandPath, extensionDescriptor) {
|
|
|
263
280
|
return (extensionDescriptor?.family ??
|
|
264
281
|
resolvePmCommandCapabilityFamily(rootCommandPath));
|
|
265
282
|
}
|
|
283
|
+
function projectFullCommandAliases(rootProgram, targetCommand, fullDiscovery) {
|
|
284
|
+
if (targetCommand !== rootProgram || !fullDiscovery)
|
|
285
|
+
return undefined;
|
|
286
|
+
return PM_COMMAND_ALIAS_CONTRACTS.map((contract) => ({
|
|
287
|
+
alias: contract.alias,
|
|
288
|
+
canonical: contract.canonical,
|
|
289
|
+
canonical_argv: [...contract.canonical_argv],
|
|
290
|
+
lifecycle: contract.lifecycle,
|
|
291
|
+
hidden: contract.hidden,
|
|
292
|
+
deprecated: contract.lifecycle === "deprecated",
|
|
293
|
+
}));
|
|
294
|
+
}
|
|
266
295
|
/** Build the command/action structural view shared by every JSON help field. */
|
|
267
|
-
function buildPositionalActionHelpProjection(action, targetCommand, resolvedPath, allOptions, extensionDescriptors = new Map()) {
|
|
296
|
+
function buildPositionalActionHelpProjection(action, targetCommand, resolvedPath, allOptions, extensionDescriptors = new Map(), includeAll = false) {
|
|
268
297
|
if (!action) {
|
|
269
298
|
const argumentsList = buildHelpArgumentSummaries(targetCommand);
|
|
270
|
-
const registeredSubcommands = buildHelpSubcommandSummaries(targetCommand, extensionDescriptors);
|
|
299
|
+
const registeredSubcommands = buildHelpSubcommandSummaries(targetCommand, extensionDescriptors, includeAll);
|
|
271
300
|
const registeredSubcommandNames = new Set(registeredSubcommands.map(({ name }) => name));
|
|
272
301
|
return {
|
|
273
302
|
arguments: argumentsList,
|
|
@@ -316,6 +345,7 @@ function buildPositionalActionHelpProjection(action, targetCommand, resolvedPath
|
|
|
316
345
|
}
|
|
317
346
|
function buildJsonHelpPayload(rootProgram, targetCommand, argv, requestedPath, extensionDescriptors) {
|
|
318
347
|
const detailMode = resolveHelpDetailMode(argv);
|
|
348
|
+
const fullDiscovery = isFullHelpDiscovery(argv);
|
|
319
349
|
const commanderPath = normalizeHelpCommandPath(getCommandPath(targetCommand));
|
|
320
350
|
const requestedCommandPath = normalizeHelpCommandPath(requestedPath.join(" "));
|
|
321
351
|
const resolvedPath = requestedCommandPath.length > commanderPath.length
|
|
@@ -334,7 +364,8 @@ function buildJsonHelpPayload(rootProgram, targetCommand, argv, requestedPath, e
|
|
|
334
364
|
: undefined;
|
|
335
365
|
const narrative = buildJsonHelpNarrative(detailMode, fallbackNarrative, extensionDescriptor);
|
|
336
366
|
const allOptionSummaries = compactHelpOptionAliases(mergeHelpOptionSummaries(buildHelpOptionSummaries(targetCommand), buildDynamicExtensionHelpOptionSummaries(extensionDescriptor)));
|
|
337
|
-
const projection = buildPositionalActionHelpProjection(positionalAction, targetCommand, projectedPath, allOptionSummaries, extensionDescriptors);
|
|
367
|
+
const projection = buildPositionalActionHelpProjection(positionalAction, targetCommand, projectedPath, allOptionSummaries, extensionDescriptors, fullDiscovery);
|
|
368
|
+
const fullCommandAliases = projectFullCommandAliases(rootProgram, targetCommand, fullDiscovery);
|
|
338
369
|
return {
|
|
339
370
|
format: "pm_help_v1",
|
|
340
371
|
detail_mode: detailMode,
|
|
@@ -356,6 +387,9 @@ function buildJsonHelpPayload(rootProgram, targetCommand, argv, requestedPath, e
|
|
|
356
387
|
options: projection.options,
|
|
357
388
|
subcommands: projection.subcommands,
|
|
358
389
|
has_subcommands: projection.subcommands.length > 0,
|
|
390
|
+
...(fullCommandAliases === undefined
|
|
391
|
+
? {}
|
|
392
|
+
: { command_aliases: fullCommandAliases }),
|
|
359
393
|
};
|
|
360
394
|
}
|
|
361
395
|
/** Implements maybe render bootstrap json help for the public runtime surface of this module. */
|
|
@@ -529,4 +563,4 @@ export const _testOnly = {
|
|
|
529
563
|
resolveExtensionCommandSurface,
|
|
530
564
|
};
|
|
531
565
|
//# sourceMappingURL=help-json-payload.js.map
|
|
532
|
-
//# debugId=
|
|
566
|
+
//# debugId=43167bb0-7cc0-599f-8587-8583d398f1ad
|
package/dist/cli/main.js
CHANGED
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* @module cli/main
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
-
import { Command } from "commander";
|
|
6
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f947c7f0-adf8-59da-8bc7-9cd746b05839")}catch(e){}}();
|
|
7
|
+
import { Command, CommanderError } from "commander";
|
|
8
8
|
import { activateExtensions, clearActiveExtensionHooks, createCoreCommandHookContext, resetActiveExtensionRuntimeState, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, consumeAfterCommandAffectedItems, runActiveCommandHandler, runActiveParserOverride, runActivePreflightOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandResult, setActiveCommandContext, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, pathExists, resolvePmCliVersion, resolvePmPackageRootFromModule, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, EXIT_CODE, resolveTelemetryErrorCategory, PmCliError, asRecordOrNull, printError, printResult, maybeRunFirstUseTelemetryPrompt, emitTelemetryErrorEvent, startTelemetryCommand, deriveTelemetryCommandResolution, sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, ensureSentryInit, getSettingsPath, resolvePmRoot, readSettings, readSettingsWithMetadata, runWithWorkspaceHarnessSignalDescriptors, createLazyModule, } from "../sdk/runtime-primitives.js";
|
|
9
9
|
import { runWithReproducibleProcessEnvironment } from "../sdk/reproducibility/process.js";
|
|
10
10
|
import { resolveSubcommandFlagContractsForCommand } from "../sdk/cli-contracts.js";
|
|
11
11
|
import { createExtensionCommandSdk } from "../sdk/extension-command-context.js";
|
|
12
12
|
import { PmClient } from "../sdk/runtime.js";
|
|
13
13
|
import { coerceLooseCommandOptionsWithFlagDefinitions, collectLooseCommandOptionKeysForDefinitions, collectLoosePositionalArgs, parseLooseCommandOptions, stripLooseCommandOptionTokens, validateLooseCommandOptionsWithFlagDefinitions, } from "./extension-command-options.js";
|
|
14
|
-
import { attachRichHelpText, setPmCommandHelpVisibilityTier, } from "./help-content.js";
|
|
14
|
+
import { attachRichHelpText, isFullHelpDiscovery, setPmCommandHelpVisibilityTier, } from "./help-content.js";
|
|
15
15
|
import { finishActiveTelemetryCommand, recordAfterCommandContextUsage } from "./after-command-context-usage.js";
|
|
16
|
-
import { extractProvidedOptionFlags, normalizeLongOptionFlag, redactSensitiveCommandArgs, renderPmCommand
|
|
16
|
+
import { extractProvidedOptionFlags, normalizeLongOptionFlag, redactSensitiveCommandArgs, renderPmCommand } from "./argv-utils.js";
|
|
17
17
|
import { classifyCommanderError, classifyPmCliError, classifyUnknownError, formatPmCliErrorForDisplay, formatPmCliErrorForJson, formatUnknownErrorForJson, projectLeanErrorEnvelope, } from "./error-guidance.js";
|
|
18
18
|
import { describeUnknownError, isCommanderError, normalizeThrownExitCode, readThrownExitCode, wrapThrownErrorForSentry } from "../sdk/error-runtime.js";
|
|
19
19
|
import { applyDefaultOutputFormat, clearResolvedGlobalOptions, collect, formatHookWarnings, getCommandPath, getGlobalOptions, invalidateSearchCachesForMutation, setResolvedGlobalOptions, syncCommanderActionOptions, } from "./registration-helpers.js";
|
|
@@ -51,7 +51,7 @@ function recordCliReadOutputInvocationProvenance(actionCommand, commandPath, com
|
|
|
51
51
|
const rawArgs = rootCommand.rawArgs;
|
|
52
52
|
const providedFlags = new Set(extractProvidedOptionFlags(rawArgs.slice(2)));
|
|
53
53
|
const contract = PM_READ_OUTPUT_SURFACE_CONTRACTS.find((candidate) => candidate.command === surface);
|
|
54
|
-
const explicitLegacyAliases = Object.values(contract.dimensions).flatMap((dimension) => dimension.legacy_aliases.flatMap((alias) => providedFlags.has(alias.flag) ? [alias.flag] : []));
|
|
54
|
+
const explicitLegacyAliases = Object.values(contract.dimensions).flatMap((dimension) => dimension.legacy_aliases.flatMap((alias) => (providedFlags.has(alias.flag) ? [alias.flag] : [])));
|
|
55
55
|
const previous = Reflect.get(commandOptions, READ_OUTPUT_INVOCATION_PROVENANCE);
|
|
56
56
|
Reflect.set(commandOptions, READ_OUTPUT_INVOCATION_PROVENANCE, {
|
|
57
57
|
canonical_include_modes: previous?.canonical_include_modes ?? [],
|
|
@@ -115,18 +115,14 @@ function inferMissingFieldsFromErrorMessage(message) {
|
|
|
115
115
|
return normalized.length > 0 ? normalized : undefined;
|
|
116
116
|
}
|
|
117
117
|
function inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecovery) {
|
|
118
|
-
if (existingRecovery?.suggested_retry ||
|
|
119
|
-
rawMessage.includes("failed in extension handler (") ||
|
|
120
|
-
!/\b(?:missing|required|requires)\b/i.test(rawMessage)) {
|
|
118
|
+
if (existingRecovery?.suggested_retry || rawMessage.includes("failed in extension handler (") || !/\b(?:missing|required|requires)\b/i.test(rawMessage)) {
|
|
121
119
|
return undefined;
|
|
122
120
|
}
|
|
123
121
|
const providedFields = extractProvidedOptionFlags(invocationArgv);
|
|
124
122
|
const providedSet = new Set(providedFields.map((flag) => normalizeLongOptionFlag(flag) ?? flag));
|
|
125
123
|
const rawInferred = inferMissingFieldsFromErrorMessage(rawMessage);
|
|
126
124
|
const commandName = invocationArgv.find((token) => program.commands.some((candidate) => candidate.name() === token));
|
|
127
|
-
const command = commandName
|
|
128
|
-
? program.commands.find((candidate) => candidate.name() === commandName)
|
|
129
|
-
: undefined;
|
|
125
|
+
const command = commandName ? program.commands.find((candidate) => candidate.name() === commandName) : undefined;
|
|
130
126
|
const declaredFlags = new Set([...program.options, ...(command?.options ?? [])].flatMap((option) => option.flags
|
|
131
127
|
.split(/[ ,|]+/)
|
|
132
128
|
.map((flag) => normalizeLongOptionFlag(flag))
|
|
@@ -136,8 +132,7 @@ function inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecov
|
|
|
136
132
|
if (providedSet.has(normalized)) {
|
|
137
133
|
return false;
|
|
138
134
|
}
|
|
139
|
-
return
|
|
140
|
-
extensionFlagTakesValueForInvocation(invocationArgv, commandName, normalized, activeRuntimeExtensionCommandDescriptors) !== undefined);
|
|
135
|
+
return declaredFlags.has(normalized) || extensionFlagTakesValueForInvocation(invocationArgv, commandName, normalized, activeRuntimeExtensionCommandDescriptors) !== undefined;
|
|
141
136
|
});
|
|
142
137
|
return trulyMissing && trulyMissing.length > 0 ? trulyMissing : undefined;
|
|
143
138
|
}
|
|
@@ -151,11 +146,7 @@ function resolveRecoverySuggestedRetry(invocationArgv, attemptedCommand, inferre
|
|
|
151
146
|
const command = commandName ? program.commands.find((candidate) => candidate.name() === commandName) : undefined;
|
|
152
147
|
const missingOption = normalizedMissing ? command?.options.find((option) => option.flags.split(/[ ,|]+/).includes(normalizedMissing)) : undefined;
|
|
153
148
|
const extensionFlagTakesValue = extensionFlagTakesValueForInvocation(invocationArgv, commandName, normalizedMissing, activeRuntimeExtensionCommandDescriptors);
|
|
154
|
-
const missingTokens = normalizedMissing
|
|
155
|
-
? missingOption?.isBoolean() === true || extensionFlagTakesValue === false
|
|
156
|
-
? [normalizedMissing]
|
|
157
|
-
: [normalizedMissing, "<value>"]
|
|
158
|
-
: [];
|
|
149
|
+
const missingTokens = normalizedMissing ? (missingOption?.isBoolean() === true || extensionFlagTakesValue === false ? [normalizedMissing] : [normalizedMissing, "<value>"]) : [];
|
|
159
150
|
const suggestedRetry = normalizedMissing ? renderAttemptedCommand([...invocationArgv, ...missingTokens]) : attemptedCommand;
|
|
160
151
|
return suggestedRetry === attemptedCommand ? undefined : suggestedRetry;
|
|
161
152
|
}
|
|
@@ -203,18 +194,10 @@ function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
|
|
|
203
194
|
const existingRecovery = rawExistingRecovery && safeInvocationArgv.includes("history-redact")
|
|
204
195
|
? {
|
|
205
196
|
...rawExistingRecovery,
|
|
206
|
-
...(rawExistingRecovery.attempted_command
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
...(rawExistingRecovery.
|
|
210
|
-
? { normalized_args: [...safeInvocationArgv] }
|
|
211
|
-
: {}),
|
|
212
|
-
...(rawExistingRecovery.suggested_retry
|
|
213
|
-
? { suggested_retry: renderAttemptedCommand(safeInvocationArgv) }
|
|
214
|
-
: {}),
|
|
215
|
-
...(rawExistingRecovery.suggested_retry_args
|
|
216
|
-
? { suggested_retry_args: [...safeInvocationArgv] }
|
|
217
|
-
: {}),
|
|
197
|
+
...(rawExistingRecovery.attempted_command ? { attempted_command: renderAttemptedCommand(safeInvocationArgv) } : {}),
|
|
198
|
+
...(rawExistingRecovery.normalized_args ? { normalized_args: [...safeInvocationArgv] } : {}),
|
|
199
|
+
...(rawExistingRecovery.suggested_retry ? { suggested_retry: renderAttemptedCommand(safeInvocationArgv) } : {}),
|
|
200
|
+
...(rawExistingRecovery.suggested_retry_args ? { suggested_retry_args: [...safeInvocationArgv] } : {}),
|
|
218
201
|
}
|
|
219
202
|
: rawExistingRecovery;
|
|
220
203
|
if (existingRecovery?.recovery_mode === "compact" && !explainRequested) {
|
|
@@ -372,8 +355,7 @@ function buildPostActionTelemetryOutcome() {
|
|
|
372
355
|
const exitCode = processExitCode ?? resultExitCode ?? EXIT_CODE.SUCCESS;
|
|
373
356
|
const ok = isPmSuccessfulExitCode(exitCode);
|
|
374
357
|
const errorCode = readRecordString(result, "error_code", "errorCode") ?? inferPostActionErrorCode(ok, exitCode);
|
|
375
|
-
const errorCategory = normalizeTelemetryErrorCategory(readRecordString(result, "error_category", "errorCategory")) ??
|
|
376
|
-
(!ok ? resolveTelemetryErrorCategory(errorCode) : undefined);
|
|
358
|
+
const errorCategory = normalizeTelemetryErrorCategory(readRecordString(result, "error_category", "errorCategory")) ?? (!ok ? resolveTelemetryErrorCategory(errorCode) : undefined);
|
|
377
359
|
const errorMessage = !ok ? (inferPostActionFailureMessage(result) ?? `command_exit_${exitCode}`) : undefined;
|
|
378
360
|
const commandResolution = normalizeTelemetryCommandResolution(readRecordString(result, "command_resolution", "commandResolution")) ??
|
|
379
361
|
deriveTelemetryCommandResolution({
|
|
@@ -546,6 +528,9 @@ function forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions
|
|
|
546
528
|
if (requested === undefined)
|
|
547
529
|
return;
|
|
548
530
|
const { selectors, modes } = applyReadOutputIncludeModes(commandPath, requested, commandOptions);
|
|
531
|
+
if (commandPath === "get" && typeof commandOptions.fields === "string") {
|
|
532
|
+
actionCommand.setOptionValueWithSource("fields", commandOptions.fields, "cli");
|
|
533
|
+
}
|
|
549
534
|
if (modes.length === 0)
|
|
550
535
|
return;
|
|
551
536
|
copyReadOutputInvocationProvenance(commandOptions, actionCommand);
|
|
@@ -804,9 +789,7 @@ async function registerRuntimeSchemaFieldFlags(rootProgram, invocationArgv) {
|
|
|
804
789
|
if (!(await pathExists(getSettingsPath(pmRoot)))) {
|
|
805
790
|
return;
|
|
806
791
|
}
|
|
807
|
-
const cachedDiscovery = runtimeExtensionDiscoverySnapshotCache?.key === buildRuntimeExtensionDiscoverySnapshotCacheKey(pmRoot)
|
|
808
|
-
? runtimeExtensionDiscoverySnapshotCache.snapshot
|
|
809
|
-
: null;
|
|
792
|
+
const cachedDiscovery = runtimeExtensionDiscoverySnapshotCache?.key === buildRuntimeExtensionDiscoverySnapshotCacheKey(pmRoot) ? runtimeExtensionDiscoverySnapshotCache.snapshot : null;
|
|
810
793
|
const settings = cachedDiscovery === null ? await readSettings(pmRoot) : cachedDiscovery.settings;
|
|
811
794
|
const fieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
|
|
812
795
|
const mappings = [
|
|
@@ -995,23 +978,19 @@ function extensionProvidesTemplatesRuntime(commands) {
|
|
|
995
978
|
}
|
|
996
979
|
/** Match direct command paths plus the built-in create-template bridge. */
|
|
997
980
|
function matchesStaticExtensionCommand(commands, probe) {
|
|
998
|
-
return
|
|
999
|
-
(commandPathNeedsTemplateExtensions(probe) &&
|
|
1000
|
-
extensionProvidesTemplatesRuntime(commands)));
|
|
981
|
+
return commands.some((command) => activationCommandMatchesProbe(command, probe)) || (commandPathNeedsTemplateExtensions(probe) && extensionProvidesTemplatesRuntime(commands));
|
|
1001
982
|
}
|
|
1002
983
|
/** Identify contribution surfaces that participate in global runtime behavior. */
|
|
1003
984
|
function hasGlobalExtensionContributions(contributions) {
|
|
1004
985
|
const contributionCounts = [
|
|
1005
986
|
entriesOrEmpty(contributions.hooks).length,
|
|
1006
|
-
(contributions.preflight_overrides ?? 0) -
|
|
1007
|
-
entriesOrEmpty(contributions.preflight_ownership).length,
|
|
987
|
+
(contributions.preflight_overrides ?? 0) - entriesOrEmpty(contributions.preflight_ownership).length,
|
|
1008
988
|
entriesOrEmpty(contributions.item_types).length,
|
|
1009
989
|
entriesOrEmpty(contributions.item_fields).length,
|
|
1010
990
|
entriesOrEmpty(contributions.relationship_kinds).length,
|
|
1011
991
|
entriesOrEmpty(contributions.service_overrides).length,
|
|
1012
992
|
entriesOrEmpty(contributions.assurance_providers).length,
|
|
1013
|
-
entriesOrEmpty(contributions.renderer_overrides).length -
|
|
1014
|
-
entriesOrEmpty(contributions.renderer_ownership).length,
|
|
993
|
+
entriesOrEmpty(contributions.renderer_overrides).length - entriesOrEmpty(contributions.renderer_ownership).length,
|
|
1015
994
|
];
|
|
1016
995
|
return contributionCounts.some((count) => count > 0);
|
|
1017
996
|
}
|
|
@@ -1024,8 +1003,7 @@ function resolveStaticExtensionActivationDecision(extension, probe) {
|
|
|
1024
1003
|
const commands = extensionActivationCommands(extension);
|
|
1025
1004
|
if (matchesStaticExtensionCommand(commands, probe))
|
|
1026
1005
|
return true;
|
|
1027
|
-
if (extensionCapabilities(extension).has("search") &&
|
|
1028
|
-
commandPathNeedsSearchExtensions(probe.commandPath)) {
|
|
1006
|
+
if (extensionCapabilities(extension).has("search") && commandPathNeedsSearchExtensions(probe.commandPath)) {
|
|
1029
1007
|
return true;
|
|
1030
1008
|
}
|
|
1031
1009
|
if (extension.contributions) {
|
|
@@ -1220,7 +1198,10 @@ async function loadRuntimeExtensionSnapshot(pmRoot, probe, readSettingsFn = read
|
|
|
1220
1198
|
loadedCount: loadResult.loaded.length,
|
|
1221
1199
|
loadFailedCount: loadResult.failed.length,
|
|
1222
1200
|
activationFailedCount: activationResult.failed.length,
|
|
1223
|
-
contextIntentPackages: loadResult.loaded.map(({ name, module }) => ({
|
|
1201
|
+
contextIntentPackages: loadResult.loaded.map(({ name, module }) => ({
|
|
1202
|
+
name,
|
|
1203
|
+
module,
|
|
1204
|
+
})),
|
|
1224
1205
|
};
|
|
1225
1206
|
runtimeExtensionSnapshotCache = {
|
|
1226
1207
|
key: cacheKey,
|
|
@@ -1353,9 +1334,7 @@ async function runRequiredExtensionCommand(command, options, globalOptions, exte
|
|
|
1353
1334
|
const causeSuffix = cause ? ` ${cause}` : "";
|
|
1354
1335
|
throw new PmCliError(`Command "${commandPath}" failed in extension handler (${warningCode}).${causeSuffix}`, EXIT_CODE.GENERIC_FAILURE, {
|
|
1355
1336
|
code: extensionCommandResult.errorCode ?? "command_failed",
|
|
1356
|
-
nextSteps: extensionCommandResult.remediation
|
|
1357
|
-
? [extensionCommandResult.remediation]
|
|
1358
|
-
: undefined,
|
|
1337
|
+
nextSteps: extensionCommandResult.remediation ? [extensionCommandResult.remediation] : undefined,
|
|
1359
1338
|
});
|
|
1360
1339
|
}
|
|
1361
1340
|
throw new PmCliError(`Command "${commandPath}" is provided by extensions and is not currently available.`, EXIT_CODE.NOT_FOUND);
|
|
@@ -1513,12 +1492,10 @@ function applyDynamicExtensionRootHelpVisibility(rootProgram, preexistingTopLeve
|
|
|
1513
1492
|
const tierRank = { core: 0, standard: 1, full: 2, internal: 3 };
|
|
1514
1493
|
const applyVisibility = (command, pathParts) => {
|
|
1515
1494
|
const commandPath = pathParts.join(" ");
|
|
1516
|
-
const matchingDescriptors = [...descriptors.entries()]
|
|
1517
|
-
.filter(([path]) => path === commandPath || path.startsWith(`${commandPath} `))
|
|
1518
|
-
.map(([, descriptor]) => descriptor);
|
|
1495
|
+
const matchingDescriptors = [...descriptors.entries()].filter(([path]) => path === commandPath || path.startsWith(`${commandPath} `)).map(([, descriptor]) => descriptor);
|
|
1519
1496
|
const tier = matchingDescriptors.length === 0
|
|
1520
1497
|
? "standard"
|
|
1521
|
-
: matchingDescriptors.reduce((selected, descriptor) => tierRank[descriptor.tier] < tierRank[selected] ? descriptor.tier : selected, "internal");
|
|
1498
|
+
: matchingDescriptors.reduce((selected, descriptor) => (tierRank[descriptor.tier] < tierRank[selected] ? descriptor.tier : selected), "internal");
|
|
1522
1499
|
setPmCommandHelpVisibilityTier(command, tier);
|
|
1523
1500
|
for (const child of command.commands) {
|
|
1524
1501
|
applyVisibility(child, [...pathParts, child.name()]);
|
|
@@ -1942,7 +1919,10 @@ function resolveCoreCommandRegistrationSelection(invocationArgv) {
|
|
|
1942
1919
|
return REGISTER_ALL_CORE_COMMAND_FAMILIES;
|
|
1943
1920
|
}
|
|
1944
1921
|
function shouldAttachRichHelpTextForInvocation(invocationArgv) {
|
|
1945
|
-
return invocationArgv.length === 0 ||
|
|
1922
|
+
return (invocationArgv.length === 0 ||
|
|
1923
|
+
parseBootstrapHelpRequest(invocationArgv).requested ||
|
|
1924
|
+
(invocationArgv.includes("--explain") &&
|
|
1925
|
+
parseBootstrapCommandName(invocationArgv) === undefined));
|
|
1946
1926
|
}
|
|
1947
1927
|
const IDEMPOTENT_TOP_LEVEL_REGISTRATION = Symbol("pmCliIdempotentTopLevelRegistration");
|
|
1948
1928
|
/**
|
|
@@ -1988,9 +1968,7 @@ async function registerCoreCommandFamilies(rootProgram, selection) {
|
|
|
1988
1968
|
}
|
|
1989
1969
|
if (selection.listQuery) {
|
|
1990
1970
|
const { registerListQueryCommands } = await loadListQueryRegistrationModule();
|
|
1991
|
-
const commandFilter = typeof selection.targetCommandName === "string" && LIST_QUERY_COMMAND_NAMES.has(selection.targetCommandName)
|
|
1992
|
-
? new Set([selection.targetCommandName])
|
|
1993
|
-
: undefined;
|
|
1971
|
+
const commandFilter = typeof selection.targetCommandName === "string" && LIST_QUERY_COMMAND_NAMES.has(selection.targetCommandName) ? new Set([selection.targetCommandName]) : undefined;
|
|
1994
1972
|
registerListQueryCommands(rootProgram, commandFilter ? { commandFilter } : undefined);
|
|
1995
1973
|
}
|
|
1996
1974
|
if (selection.mutation) {
|
|
@@ -2008,6 +1986,9 @@ function shouldRegisterDynamicExtensionPaths(_rootProgram, invocationArgv) {
|
|
|
2008
1986
|
if (invocationRequestsVersion(invocationArgv)) {
|
|
2009
1987
|
return false;
|
|
2010
1988
|
}
|
|
1989
|
+
if (isFullHelpDiscovery(invocationArgv)) {
|
|
1990
|
+
return true;
|
|
1991
|
+
}
|
|
2011
1992
|
const helpRequest = parseBootstrapHelpRequest(invocationArgv);
|
|
2012
1993
|
if (helpRequest.requested) {
|
|
2013
1994
|
return true;
|
|
@@ -2046,20 +2027,12 @@ function redactSensitiveFlagTypo(params) {
|
|
|
2046
2027
|
? params.argv.map((token) => {
|
|
2047
2028
|
const equalsIndex = token.indexOf("=");
|
|
2048
2029
|
const flag = equalsIndex >= 0 ? token.slice(0, equalsIndex) : token;
|
|
2049
|
-
return flag === rawTypoFlag
|
|
2050
|
-
? equalsIndex >= 0
|
|
2051
|
-
? `${sensitiveCanonicalFlag}${token.slice(equalsIndex)}`
|
|
2052
|
-
: sensitiveCanonicalFlag
|
|
2053
|
-
: token;
|
|
2030
|
+
return flag === rawTypoFlag ? (equalsIndex >= 0 ? `${sensitiveCanonicalFlag}${token.slice(equalsIndex)}` : sensitiveCanonicalFlag) : token;
|
|
2054
2031
|
})
|
|
2055
2032
|
: params.argv;
|
|
2056
2033
|
const safeArgv = redactSensitiveCommandArgs(typoNormalizedArgv);
|
|
2057
|
-
const safeTypoDisplay = sensitiveCanonicalFlag && rawTypoEqualsIndex >= 0
|
|
2058
|
-
|
|
2059
|
-
: rawTypoToken;
|
|
2060
|
-
const safeNormalizedDisplay = sensitiveCanonicalFlag && params.normalizedDisplay.includes("=")
|
|
2061
|
-
? `${sensitiveCanonicalFlag}=[redacted]`
|
|
2062
|
-
: params.normalizedDisplay;
|
|
2034
|
+
const safeTypoDisplay = sensitiveCanonicalFlag && rawTypoEqualsIndex >= 0 ? `${rawTypoFlag}=[redacted]` : rawTypoToken;
|
|
2035
|
+
const safeNormalizedDisplay = sensitiveCanonicalFlag && params.normalizedDisplay.includes("=") ? `${sensitiveCanonicalFlag}=[redacted]` : params.normalizedDisplay;
|
|
2063
2036
|
return {
|
|
2064
2037
|
argv: safeArgv,
|
|
2065
2038
|
normalizedDisplay: safeNormalizedDisplay,
|
|
@@ -2193,9 +2166,7 @@ async function handleRunPmCliKnownError(context, numericExitCode) {
|
|
|
2193
2166
|
? projectLeanErrorEnvelope(formatPmCliErrorForJson(errorMessage, exitCode, enrichedContext))
|
|
2194
2167
|
: formatPmCliErrorForJson(errorMessage, exitCode, enrichedContext);
|
|
2195
2168
|
const renderedError = context.jsonErrors
|
|
2196
|
-
? JSON.stringify(context.bootstrapGlobal.tokenAccounting
|
|
2197
|
-
? attachOutputTokenAccounting(jsonErrorPayload, (value) => `${JSON.stringify(value, null, 2)}\n`)
|
|
2198
|
-
: jsonErrorPayload, null, 2)
|
|
2169
|
+
? JSON.stringify(context.bootstrapGlobal.tokenAccounting ? attachOutputTokenAccounting(jsonErrorPayload, (value) => `${JSON.stringify(value, null, 2)}\n`) : jsonErrorPayload, null, 2)
|
|
2199
2170
|
: formatPmCliErrorForDisplay(errorMessage, enrichedContext);
|
|
2200
2171
|
printError(renderedError);
|
|
2201
2172
|
const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
|
|
@@ -2270,7 +2241,6 @@ async function handleUnknownHelpCommandError(context, code) {
|
|
|
2270
2241
|
error_message: classification.detail,
|
|
2271
2242
|
command_resolution: commandResolution,
|
|
2272
2243
|
resolution_stage: "parse",
|
|
2273
|
-
source_context: activeTelemetryCommandContext?.source_context,
|
|
2274
2244
|
});
|
|
2275
2245
|
const baseRenderedUsage = context.jsonErrors
|
|
2276
2246
|
? await formatCommanderUsageJson({ message: unknownMessage }, program, recoveryCommandDescriptors, context.bootstrapGlobal.lean === true, { failedExtensions })
|
|
@@ -2463,7 +2433,13 @@ async function runPmCliInReproducibleContext(rawArgv) {
|
|
|
2463
2433
|
if (renderedBootstrapJsonHelp) {
|
|
2464
2434
|
return;
|
|
2465
2435
|
}
|
|
2466
|
-
|
|
2436
|
+
const helpRequest = parseBootstrapHelpRequest(invocationArgv);
|
|
2437
|
+
if (helpRequest.requested && !isKnownHelpCommandPath(program, helpRequest.commandPathTokens)) {
|
|
2438
|
+
throw new CommanderError(EXIT_CODE.USAGE, "commander.helpDisplayed", "(outputHelp)");
|
|
2439
|
+
}
|
|
2440
|
+
if (isBareInvocation ||
|
|
2441
|
+
(isFullHelpDiscovery(invocationArgv) &&
|
|
2442
|
+
parseBootstrapCommandName(invocationArgv) === undefined)) {
|
|
2467
2443
|
program.outputHelp();
|
|
2468
2444
|
return;
|
|
2469
2445
|
}
|
|
@@ -2472,7 +2448,9 @@ async function runPmCliInReproducibleContext(rawArgv) {
|
|
|
2472
2448
|
await runWithDiscoveredContextIntentContracts({
|
|
2473
2449
|
pmRoot: resolvePmRoot(process.cwd(), bootstrapGlobal.path),
|
|
2474
2450
|
packages: intentSnapshot?.contextIntentPackages,
|
|
2475
|
-
}, () => runWithWorkspaceHarnessSignalDescriptors(invocationSettings.agent_identity.harness_signals, () => program.parseAsync(invocationProcessArgv), {
|
|
2451
|
+
}, () => runWithWorkspaceHarnessSignalDescriptors(invocationSettings.agent_identity.harness_signals, () => program.parseAsync(invocationProcessArgv), {
|
|
2452
|
+
probesEnabled: invocationSettings.agent_identity?.probes_enabled,
|
|
2453
|
+
}));
|
|
2476
2454
|
}
|
|
2477
2455
|
catch (error) {
|
|
2478
2456
|
await handleRunPmCliError({ error, invocationArgv });
|
|
@@ -2583,4 +2561,4 @@ export const _testOnly = {
|
|
|
2583
2561
|
wrapThrownErrorForSentry,
|
|
2584
2562
|
};
|
|
2585
2563
|
//# sourceMappingURL=main.js.map
|
|
2586
|
-
//# debugId=
|
|
2564
|
+
//# debugId=f947c7f0-adf8-59da-8bc7-9cd746b05839
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="263a15b4-5537-5e11-b0c0-3da453ee0357")}catch(e){}}();
|
|
3
3
|
import { EXIT_CODE, PmCliError, } from "../sdk/runtime-primitives.js";
|
|
4
4
|
import { renderPmCommand } from "../sdk/command-line.js";
|
|
5
5
|
import { runComments } from "./commands/comments.js";
|
|
@@ -11,6 +11,7 @@ function assertNoTransposedAnnotationAction(collection, id, text, options) {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const suppliedText = readOptionString(options, "add") ??
|
|
14
|
+
readOptionString(options, "text") ??
|
|
14
15
|
readOptionString(options, "note") ??
|
|
15
16
|
readOptionString(options, "body") ??
|
|
16
17
|
readOptionString(options, "comment");
|
|
@@ -25,12 +26,7 @@ function assertNoTransposedAnnotationAction(collection, id, text, options) {
|
|
|
25
26
|
else
|
|
26
27
|
retryArgs.push("--add", "-");
|
|
27
28
|
const suggestedRetry = renderPmCommand(retryArgs);
|
|
28
|
-
const stdinRetry = renderPmCommand([
|
|
29
|
-
collection,
|
|
30
|
-
text.trim(),
|
|
31
|
-
"--add",
|
|
32
|
-
"-",
|
|
33
|
-
]);
|
|
29
|
+
const stdinRetry = renderPmCommand([collection, text.trim(), "--add", "-"]);
|
|
34
30
|
throw new PmCliError(`The positional token "add" was parsed as the item id, while "${text.trim()}" was parsed as annotation text. ${collection} does not use an add subcommand.`, EXIT_CODE.USAGE, {
|
|
35
31
|
code: "annotation_transposed_subcommand",
|
|
36
32
|
reason: "noun_verb_object_transposition",
|
|
@@ -47,12 +43,26 @@ function assertNoTransposedAnnotationAction(collection, id, text, options) {
|
|
|
47
43
|
},
|
|
48
44
|
});
|
|
49
45
|
}
|
|
46
|
+
function resolveAnnotationTextAliases(label, options, aliases) {
|
|
47
|
+
const supplied = aliases.flatMap((alias) => {
|
|
48
|
+
const value = readOptionString(options, alias);
|
|
49
|
+
return value === undefined ? [] : [{ alias, value }];
|
|
50
|
+
});
|
|
51
|
+
const distinctValues = [...new Set(supplied.map(({ value }) => value))];
|
|
52
|
+
if (distinctValues.length > 1) {
|
|
53
|
+
throw new PmCliError(`Specify ${label} text with one alias or the same value across aliases: ${supplied.map(({ alias }) => `--${alias}`).join(", ")}`, EXIT_CODE.USAGE, { code: "annotation_alias_conflict" });
|
|
54
|
+
}
|
|
55
|
+
return supplied[0]?.value;
|
|
56
|
+
}
|
|
50
57
|
function resolveCommentSources(text, options) {
|
|
51
58
|
const editIndex = typeof options.edit === "number" ? options.edit : undefined;
|
|
52
59
|
const deleteIndex = typeof options.delete === "number" ? options.delete : undefined;
|
|
53
|
-
const addFromOption =
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
const addFromOption = resolveAnnotationTextAliases("comment", options, [
|
|
61
|
+
"add",
|
|
62
|
+
"text",
|
|
63
|
+
"body",
|
|
64
|
+
"comment",
|
|
65
|
+
]);
|
|
56
66
|
const addFromPositional = typeof text === "string" ? text : undefined;
|
|
57
67
|
const readFromStdin = options.stdin === true;
|
|
58
68
|
const readFromFile = readOptionString(options, "file");
|
|
@@ -84,14 +94,7 @@ function resolveCommentSources(text, options) {
|
|
|
84
94
|
};
|
|
85
95
|
}
|
|
86
96
|
function resolveSingleTextSource(label, positional, options) {
|
|
87
|
-
const
|
|
88
|
-
const aliasAdd = label === "note" ? readOptionString(options, "note") : undefined;
|
|
89
|
-
if (canonicalAdd !== undefined &&
|
|
90
|
-
aliasAdd !== undefined &&
|
|
91
|
-
canonicalAdd !== aliasAdd) {
|
|
92
|
-
throw new PmCliError("Specify note text with either --add or --note, not conflicting values for both aliases", EXIT_CODE.USAGE, { code: "annotation_alias_conflict" });
|
|
93
|
-
}
|
|
94
|
-
const addFromOption = canonicalAdd ?? aliasAdd;
|
|
97
|
+
const addFromOption = resolveAnnotationTextAliases(label, options, label === "note" ? ["add", "text", "note"] : ["add", "text"]);
|
|
95
98
|
const addFromPositional = typeof positional === "string" ? positional : undefined;
|
|
96
99
|
if (addFromOption !== undefined && addFromPositional !== undefined) {
|
|
97
100
|
throw new PmCliError(`Specify ${label} text either as positional [text] or with --add, not both`, EXIT_CODE.USAGE);
|
|
@@ -205,8 +208,9 @@ export function registerAnnotationCommands(program, parsePositiveInteger) {
|
|
|
205
208
|
.description("List, add, edit, or delete comments for an item.")
|
|
206
209
|
.action(runCommentsAction);
|
|
207
210
|
addHiddenOption(commentsCommand, "--body <text>", "Alias for --add", false);
|
|
211
|
+
addHiddenOption(commentsCommand, "--text <text>", "Alias for --add", false);
|
|
208
212
|
addHiddenOption(commentsCommand, "--comment <text>", "Alias for --add", false);
|
|
209
|
-
program
|
|
213
|
+
const notesCommand = program
|
|
210
214
|
.command("notes")
|
|
211
215
|
.argument("<id>", "Item id")
|
|
212
216
|
.argument("[text]", "Optional note text shorthand (equivalent to --add; use - for stdin)")
|
|
@@ -227,7 +231,8 @@ export function registerAnnotationCommands(program, parsePositiveInteger) {
|
|
|
227
231
|
.option("--force", "Force ownership override")
|
|
228
232
|
.description("Manage merge-safe text notes and JSON context events.")
|
|
229
233
|
.action(runNotesAction);
|
|
230
|
-
|
|
234
|
+
addHiddenOption(notesCommand, "--text <text>", "Alias for --add", false);
|
|
235
|
+
const learningsCommand = program
|
|
231
236
|
.command("learnings")
|
|
232
237
|
.argument("<id>", "Item id")
|
|
233
238
|
.argument("[text]", "Optional learning text shorthand (equivalent to --add; use - for stdin)")
|
|
@@ -243,6 +248,7 @@ export function registerAnnotationCommands(program, parsePositiveInteger) {
|
|
|
243
248
|
.option("--force", "Force ownership override")
|
|
244
249
|
.description("List, add, edit, or delete learnings for an item.")
|
|
245
250
|
.action(runLearningsAction);
|
|
251
|
+
addHiddenOption(learningsCommand, "--text <text>", "Alias for --add", false);
|
|
246
252
|
}
|
|
247
253
|
//# sourceMappingURL=register-annotations.js.map
|
|
248
|
-
//# debugId=
|
|
254
|
+
//# debugId=263a15b4-5537-5e11-b0c0-3da453ee0357
|