@unbrained/pm-cli 2026.8.13 → 2026.8.15
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +165 -113
- package/dist/cli/commander-usage.js +17 -4
- package/dist/cli/error-guidance.d.ts +2 -0
- package/dist/cli/error-guidance.js +52 -25
- package/dist/cli/main.js +40 -3
- package/dist/cli/register-mutation.js +4 -2
- package/dist/cli/register-operations.js +5 -5
- package/dist/cli-bundle/bundle-manifest.json +146 -178
- package/dist/cli-bundle/chunks/{chunk-F7FJYGK3.js → chunk-24GAV7XL.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-AIM6VT2N.js +13 -0
- package/dist/cli-bundle/chunks/chunk-DSWDLTDR.js +197 -0
- package/dist/cli-bundle/chunks/{chunk-Q47C67TQ.js → chunk-J42EGKDK.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-KIEGUBYQ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-3ZMOWAFM.js → chunk-KLKYLSDX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QGTUPEU5.js → chunk-LJHOAVGI.js} +59 -59
- package/dist/cli-bundle/chunks/chunk-MEM2ZS3O.js +5 -0
- package/dist/cli-bundle/chunks/chunk-QHPCJWEJ.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-YLBAPY22.js → chunk-WLPDLNEZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-4HIZ7EA3.js → register-list-query-CT3LFDDN.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-W64FZ5HN.js → register-mutation-NWEVA5YS.js} +3 -3
- package/dist/cli-bundle/chunks/register-operations-AHIAG5KM.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-634MFRXU.js → register-setup-ZJZFVAKE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4X57RE4U.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-6XKF3PGV.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-7NJ4QYQ2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-I75MANL7.js → chunk-EXZA4257.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ITAUHSO6.js +50 -0
- package/dist/cli-bundle/focused-chunks/{chunk-OOYYKQWX.js → chunk-KLVUMNXJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2RI2FESN.js → chunk-KT5XMYSX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-E3AVJ655.js → chunk-KTKH4IMG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-M67F5AIN.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3DJSGWVB.js → chunk-NSPYTG6G.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-OKA6ELTL.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-PUISBOPP.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QLNMCESQ.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IIS2FRKL.js → chunk-SLKC6QLJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-U65UC4G3.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-WTSER4WJ.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2JP7W7GO.js → chunk-ZMFXQ7VF.js} +2 -2
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +41 -41
- 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 +110 -1
- 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 +2 -2
- package/dist/core/diagnostics/remediation.js +7 -2
- package/dist/core/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/drift-scan.d.ts +6 -0
- package/dist/core/history/drift-scan.js +74 -50
- package/dist/core/history/replay.d.ts +14 -1
- package/dist/core/history/replay.js +45 -8
- package/dist/core/history/workspace-history.d.ts +59 -0
- package/dist/core/history/workspace-history.js +197 -10
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +13 -4
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/errors.d.ts +12 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/mcp/tool-definitions.js +9 -5
- package/dist/sdk/agent/refusal-reachability.d.ts +61 -0
- package/dist/sdk/agent/refusal-reachability.js +91 -3
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +7 -2
- package/dist/sdk/cli-contracts/completeness.js +3 -2
- package/dist/sdk/cli-contracts/flag-contracts.js +3 -2
- package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +176 -65
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -5
- package/dist/sdk/cli-contracts/tool-schema.js +10 -3
- package/dist/sdk/cli-program.js +4 -3
- package/dist/sdk/context-relevance.js +12 -4
- package/dist/sdk/core.d.ts +2 -2
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -26
- package/dist/sdk/governance/assurance-action.d.ts +7 -1
- package/dist/sdk/governance/assurance-action.js +7 -6
- package/dist/sdk/governance/assurance-mutation-error.d.ts +42 -1
- package/dist/sdk/governance/assurance-mutation-error.js +27 -3
- package/dist/sdk/governance/assurance-runtime.js +12 -11
- package/dist/sdk/governance/assurance.d.ts +9 -0
- package/dist/sdk/governance/assurance.js +82 -16
- package/dist/sdk/governance/extension-host-version.d.ts +25 -0
- package/dist/sdk/governance/extension-host-version.js +105 -0
- package/dist/sdk/governance/health.d.ts +32 -1
- package/dist/sdk/governance/health.js +132 -28
- package/dist/sdk/governance/provenance-health.d.ts +27 -0
- package/dist/sdk/governance/provenance-health.js +95 -3
- package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
- package/dist/sdk/governance/validate-history-drift.js +68 -0
- package/dist/sdk/governance/validate.js +9 -52
- package/dist/sdk/governance.d.ts +6 -0
- package/dist/sdk/governance.js +8 -2
- package/dist/sdk/graph/assembly.d.ts +23 -0
- package/dist/sdk/graph/assembly.js +54 -2
- package/dist/sdk/graph/durable-cache.js +50 -20
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance-contracts.js +4 -2
- package/dist/sdk/graph/governance.d.ts +21 -1
- package/dist/sdk/graph/governance.js +94 -32
- package/dist/sdk/graph/index.d.ts +2 -2
- package/dist/sdk/graph/index.js +4 -4
- package/dist/sdk/graph/mutation-advisory.js +15 -7
- package/dist/sdk/graph/remediation.js +12 -2
- package/dist/sdk/history-read.d.ts +8 -0
- package/dist/sdk/history-read.js +2 -2
- package/dist/sdk/history-repair.d.ts +13 -1
- package/dist/sdk/history-repair.js +62 -18
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/linked-artifacts.js +16 -5
- package/dist/sdk/pagination.d.ts +15 -0
- package/dist/sdk/pagination.js +9 -5
- package/dist/sdk/query/context.d.ts +5 -1
- package/dist/sdk/query/context.js +14 -5
- package/dist/sdk/query/history.js +20 -3
- package/dist/sdk/read-output/continuation.d.ts +11 -0
- package/dist/sdk/read-output/continuation.js +132 -0
- package/dist/sdk/read-output-budget.d.ts +3 -1
- package/dist/sdk/read-output-budget.js +24 -13
- package/dist/sdk/read-output-contracts.d.ts +127 -7
- package/dist/sdk/read-output-contracts.js +381 -35
- package/dist/sdk/read-output-rows.d.ts +13 -0
- package/dist/sdk/read-output-rows.js +60 -2
- package/dist/sdk/runtime-input.js +4 -2
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.js +5 -3
- package/docs/ASSURANCE.md +68 -2
- package/docs/COMMANDS.md +39 -4
- package/docs/READ_OUTPUT_CONTRACTS.md +85 -8
- package/docs/RELATIONSHIP_GRAPH.md +20 -5
- package/docs/RELEASING.md +42 -5
- package/docs/SDK.md +12 -5
- package/docs/SDK_CONTEXT_INTEGRITY.md +94 -1
- package/docs/TESTING.md +23 -1
- package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
- package/marketplace.json +2 -2
- package/package.json +7 -7
- package/packages/pm-beads/extensions/beads/index.ts +1 -0
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
- 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/extensions/linked-test-adapters/index.ts +6 -0
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/extensions/templates/index.ts +4 -0
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/extensions/todos/index.ts +2 -0
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
- 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/bundle-cli.mjs +17 -4
- package/sdk/public-surface.json +1283 -157
- package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +0 -196
- package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +0 -13
- package/dist/cli-bundle/chunks/chunk-HIUZVCMN.js +0 -5
- package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +0 -34
- package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-6MLIRBLV.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EBTNSFYE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HC2OL2H2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +0 -17
- package/dist/cli-bundle/focused-chunks/chunk-PKPOZXLL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-TEZIXMTH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +0 -18
|
@@ -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]="48877bbb-17bf-5a78-91fa-19a2f2f4c2be")}catch(e){}}();
|
|
3
3
|
import { pathExists, resolveItemTypeRegistry, EXIT_CODE, getSettingsPath, resolvePmRoot, readSettings, getActiveExtensionRegistrations, locateItem, runActiveServiceOverride, levenshteinDistanceWithinLimit, } from "../sdk/runtime-primitives.js";
|
|
4
4
|
import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
|
|
5
5
|
import { PM_CORE_COMMAND_NAMES, resolveSubcommandFlagContractsForCommand, } from "../sdk/cli-contracts.js";
|
|
@@ -587,10 +587,20 @@ function resolveUnknownOptionSuggestions(message, commandName) {
|
|
|
587
587
|
...suggestNearestLongFlags(match[1], collectKnownLongFlags(commandName)),
|
|
588
588
|
])
|
|
589
589
|
: undefined;
|
|
590
|
+
const otherCommands = match
|
|
591
|
+
? findOtherCommandsForFlag(match[1], commandName)
|
|
592
|
+
: [];
|
|
593
|
+
const declaredOnPath = match !== null &&
|
|
594
|
+
collectKnownLongFlags(commandName).includes(normalizeLongFlag(match[1]));
|
|
590
595
|
return {
|
|
591
596
|
match,
|
|
592
597
|
suggestions,
|
|
593
|
-
otherCommands
|
|
598
|
+
otherCommands,
|
|
599
|
+
scope: declaredOnPath
|
|
600
|
+
? "declared_on_path"
|
|
601
|
+
: otherCommands.length > 0
|
|
602
|
+
? "declared_elsewhere"
|
|
603
|
+
: "declared_nowhere",
|
|
594
604
|
};
|
|
595
605
|
}
|
|
596
606
|
function resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOptionMatch, unknownOptionSuggestions) {
|
|
@@ -681,6 +691,7 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
|
|
|
681
691
|
? unknownOption.otherCommands.length
|
|
682
692
|
: undefined,
|
|
683
693
|
unknownOptionOtherCommandsTruncated: unknownOption.otherCommands.length > 12 || undefined,
|
|
694
|
+
unknownOptionScope: unknownOption.scope,
|
|
684
695
|
suggestedRetryCommand,
|
|
685
696
|
verifiedCollectionItemId: workspaceUsage.verifiedCollectionItemId,
|
|
686
697
|
...splitSchemaSubcommand,
|
|
@@ -691,7 +702,7 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
|
|
|
691
702
|
/** Implements format commander usage message for the public runtime surface of this module. */
|
|
692
703
|
export async function formatCommanderUsageMessage(error, rootProgram, extensionDescriptors, guidanceOverrides = {}) {
|
|
693
704
|
const usageContext = await resolveCommanderUsageContext(error, rootProgram, extensionDescriptors, guidanceOverrides);
|
|
694
|
-
const { message, commandName, allowedTypes, unknownCommandExamples, unknownCommandNextSteps, attemptedCommand, normalizedInvocationArgs, providedOptionFlags, unknownOptionSuggestions, unknownOptionOtherCommands, unknownOptionOtherCommandsTotal, unknownOptionOtherCommandsTruncated, unknownSubcommandPath, unknownSubcommandToken, unknownSubcommandAllowedValues, suggestedRetryCommand, verifiedCollectionItemId, failedExtensions, } = usageContext;
|
|
705
|
+
const { message, commandName, allowedTypes, unknownCommandExamples, unknownCommandNextSteps, attemptedCommand, normalizedInvocationArgs, providedOptionFlags, unknownOptionSuggestions, unknownOptionOtherCommands, unknownOptionOtherCommandsTotal, unknownOptionOtherCommandsTruncated, unknownOptionScope, unknownSubcommandPath, unknownSubcommandToken, unknownSubcommandAllowedValues, suggestedRetryCommand, verifiedCollectionItemId, failedExtensions, } = usageContext;
|
|
695
706
|
const formatted = formatCommanderErrorForDisplay(message, commandName, allowedTypes, {
|
|
696
707
|
unknownCommandExamples,
|
|
697
708
|
unknownCommandNextSteps,
|
|
@@ -702,6 +713,7 @@ export async function formatCommanderUsageMessage(error, rootProgram, extensionD
|
|
|
702
713
|
unknownOptionOtherCommands,
|
|
703
714
|
unknownOptionOtherCommandsTotal,
|
|
704
715
|
unknownOptionOtherCommandsTruncated,
|
|
716
|
+
unknownOptionScope,
|
|
705
717
|
unknownSubcommandPath,
|
|
706
718
|
unknownSubcommandToken,
|
|
707
719
|
unknownSubcommandAllowedValues,
|
|
@@ -732,6 +744,7 @@ export async function formatCommanderUsageJson(error, rootProgram, extensionDesc
|
|
|
732
744
|
unknownOptionOtherCommands: usageContext.unknownOptionOtherCommands,
|
|
733
745
|
unknownOptionOtherCommandsTotal: usageContext.unknownOptionOtherCommandsTotal,
|
|
734
746
|
unknownOptionOtherCommandsTruncated: usageContext.unknownOptionOtherCommandsTruncated,
|
|
747
|
+
unknownOptionScope: usageContext.unknownOptionScope,
|
|
735
748
|
unknownSubcommandPath: usageContext.unknownSubcommandPath,
|
|
736
749
|
unknownSubcommandToken: usageContext.unknownSubcommandToken,
|
|
737
750
|
unknownSubcommandAllowedValues: usageContext.unknownSubcommandAllowedValues,
|
|
@@ -750,4 +763,4 @@ export const _testOnly = {
|
|
|
750
763
|
suggestNearestLongFlags,
|
|
751
764
|
};
|
|
752
765
|
//# sourceMappingURL=commander-usage.js.map
|
|
753
|
-
//# debugId=
|
|
766
|
+
//# debugId=48877bbb-17bf-5a78-91fa-19a2f2f4c2be
|
|
@@ -81,6 +81,8 @@ export interface CommanderGuidanceContext {
|
|
|
81
81
|
unknownOptionOtherCommandsTotal?: number;
|
|
82
82
|
/** Whether the structured command candidates reached their own ceiling. */
|
|
83
83
|
unknownOptionOtherCommandsTruncated?: boolean;
|
|
84
|
+
/** Declared lexicon membership of the rejected option spelling. */
|
|
85
|
+
unknownOptionScope?: PmCliErrorRecoveryPayload["option_scope"];
|
|
84
86
|
/** Command family whose positional subcommand was split into invalid tokens. */
|
|
85
87
|
unknownSubcommandPath?: string;
|
|
86
88
|
/** Rejected positional subcommand token or token sequence. */
|
|
@@ -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]="6f4c3f5d-9acc-5e2c-9351-12fdcfcdb56a")}catch(e){}}();
|
|
3
3
|
import { resolveRecoveryCommandName } from "../sdk/agent/command-recovery.js";
|
|
4
4
|
import { renderPmCommand } from "./argv-utils.js";
|
|
5
5
|
import { discoverNearbyPmRoot } from "../sdk/tracker-root-discovery.js";
|
|
@@ -171,6 +171,11 @@ function normalizeRecoveryPayload(payload) {
|
|
|
171
171
|
if (payload.candidate_commands_truncated === true) {
|
|
172
172
|
normalized.candidate_commands_truncated = true;
|
|
173
173
|
}
|
|
174
|
+
if (payload.option_scope === "declared_on_path" ||
|
|
175
|
+
payload.option_scope === "declared_elsewhere" ||
|
|
176
|
+
payload.option_scope === "declared_nowhere") {
|
|
177
|
+
normalized.option_scope = payload.option_scope;
|
|
178
|
+
}
|
|
174
179
|
assignRecoveryString(normalized, "suggested_retry", payload.suggested_retry);
|
|
175
180
|
if (typeof payload.retry_after_ms === "number" &&
|
|
176
181
|
Number.isSafeInteger(payload.retry_after_ms) &&
|
|
@@ -221,6 +226,9 @@ function renderRecoveryBundle(recovery) {
|
|
|
221
226
|
if (normalized.candidate_commands_truncated === true) {
|
|
222
227
|
lines.push(" candidate_commands_truncated: true");
|
|
223
228
|
}
|
|
229
|
+
if (normalized.option_scope !== undefined) {
|
|
230
|
+
lines.push(` option_scope: ${normalized.option_scope}`);
|
|
231
|
+
}
|
|
224
232
|
appendRecoveryTextLine(lines, "suggested_retry", normalized.suggested_retry);
|
|
225
233
|
if (typeof normalized.retry_after_ms === "number") {
|
|
226
234
|
lines.push(` retry_after_ms: ${normalized.retry_after_ms}`);
|
|
@@ -826,6 +834,42 @@ function buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions)
|
|
|
826
834
|
}),
|
|
827
835
|
});
|
|
828
836
|
}
|
|
837
|
+
const UNKNOWN_OPTION_REQUIRED_BY_SCOPE = {
|
|
838
|
+
declared_elsewhere: "Use an option declared on this path, or move the declared option to one of its accepting command paths.",
|
|
839
|
+
declared_on_path: "Use the option with the value and syntax declared by this command path.",
|
|
840
|
+
declared_nowhere: "Use a declared option on this command path; this spelling exists nowhere in the command lexicon.",
|
|
841
|
+
};
|
|
842
|
+
function resolveUnknownOptionCandidateContext(context) {
|
|
843
|
+
const otherCommands = normalizeContextList(context.unknownOptionOtherCommands) ?? [];
|
|
844
|
+
return {
|
|
845
|
+
otherCommands,
|
|
846
|
+
optionScope: context.unknownOptionScope ??
|
|
847
|
+
(otherCommands.length > 0 ? "declared_elsewhere" : "declared_nowhere"),
|
|
848
|
+
candidateTotal: context.unknownOptionOtherCommandsTotal ?? otherCommands.length,
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function buildUnknownOptionNextSteps(optionName, commandName, suggestions, candidateContext, retryCommand) {
|
|
852
|
+
const proseCommands = candidateContext.otherCommands.slice(0, 3);
|
|
853
|
+
const proseRemainder = candidateContext.candidateTotal - proseCommands.length;
|
|
854
|
+
const proseRemainderText = proseRemainder > 0
|
|
855
|
+
? ` and ${String(proseRemainder)} more command path(s)`
|
|
856
|
+
: "";
|
|
857
|
+
return [
|
|
858
|
+
"Run command help to confirm the exact option contracts for this command path.",
|
|
859
|
+
suggestions.length
|
|
860
|
+
? `Nearest supported options: ${suggestions.join(", ")}`
|
|
861
|
+
: undefined,
|
|
862
|
+
proseCommands.length
|
|
863
|
+
? `${optionName} is accepted by ${proseCommands.join(", ")}${proseRemainderText}. Inspect those command contracts only if you intended a different operation.`
|
|
864
|
+
: undefined,
|
|
865
|
+
candidateContext.optionScope === "declared_nowhere"
|
|
866
|
+
? `${optionName} is not declared on any command path. Use a nearest supported option on ${commandName ?? "the attempted command"}, or inspect that command's help.`
|
|
867
|
+
: undefined,
|
|
868
|
+
retryCommand
|
|
869
|
+
? `Replay with suggested correction: ${retryCommand}`
|
|
870
|
+
: undefined,
|
|
871
|
+
].filter((entry) => typeof entry === "string");
|
|
872
|
+
}
|
|
829
873
|
function buildUnknownOptionGuidance(message, commandName, context) {
|
|
830
874
|
const unknownOption = message.match(/unknown option '([^']+)'/);
|
|
831
875
|
if (!unknownOption) {
|
|
@@ -839,26 +883,8 @@ function buildUnknownOptionGuidance(message, commandName, context) {
|
|
|
839
883
|
(optionName === "--file" || optionName === "--doc")) {
|
|
840
884
|
return buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions);
|
|
841
885
|
}
|
|
842
|
-
const
|
|
843
|
-
const
|
|
844
|
-
const proseCommands = otherCommands.slice(0, 3);
|
|
845
|
-
const proseRemainder = candidateTotal - proseCommands.length;
|
|
846
|
-
let proseRemainderText = "";
|
|
847
|
-
if (proseRemainder > 0) {
|
|
848
|
-
proseRemainderText = ` and ${String(proseRemainder)} more command path(s)`;
|
|
849
|
-
}
|
|
850
|
-
const nextSteps = [
|
|
851
|
-
"Run command help to confirm the exact option contracts for this command path.",
|
|
852
|
-
suggestions.length
|
|
853
|
-
? `Nearest supported options: ${suggestions.join(", ")}`
|
|
854
|
-
: undefined,
|
|
855
|
-
proseCommands.length
|
|
856
|
-
? `${optionName} is accepted by ${proseCommands.join(", ")}${proseRemainderText}. Inspect those command contracts only if you intended a different operation.`
|
|
857
|
-
: undefined,
|
|
858
|
-
retryCommand
|
|
859
|
-
? `Replay with suggested correction: ${retryCommand}`
|
|
860
|
-
: undefined,
|
|
861
|
-
].filter((entry) => typeof entry === "string");
|
|
886
|
+
const candidateContext = resolveUnknownOptionCandidateContext(guidanceContext);
|
|
887
|
+
const nextSteps = buildUnknownOptionNextSteps(optionName, commandName, suggestions, candidateContext, retryCommand);
|
|
862
888
|
const examples = [
|
|
863
889
|
retryCommand,
|
|
864
890
|
`pm ${commandName ?? "<command>"} --help`,
|
|
@@ -867,15 +893,16 @@ function buildUnknownOptionGuidance(message, commandName, context) {
|
|
|
867
893
|
code: "unknown_option",
|
|
868
894
|
title: `Unknown option ${optionName}`,
|
|
869
895
|
happened: `Commander does not recognize option ${optionName} for this command path.`,
|
|
870
|
-
required:
|
|
896
|
+
required: UNKNOWN_OPTION_REQUIRED_BY_SCOPE[candidateContext.optionScope],
|
|
871
897
|
why: "Option contracts are command-specific and intentionally validated.",
|
|
872
898
|
examples,
|
|
873
899
|
nextSteps,
|
|
874
900
|
recovery: buildCommanderRecoveryPayload(context, {
|
|
875
901
|
suggested_flags: suggestions.length > 0 ? suggestions : undefined,
|
|
876
|
-
candidate_commands: otherCommands,
|
|
877
|
-
candidate_commands_total: candidateTotal || undefined,
|
|
902
|
+
candidate_commands: candidateContext.otherCommands,
|
|
903
|
+
candidate_commands_total: candidateContext.candidateTotal || undefined,
|
|
878
904
|
candidate_commands_truncated: guidanceContext.unknownOptionOtherCommandsTruncated,
|
|
905
|
+
option_scope: candidateContext.optionScope,
|
|
879
906
|
}),
|
|
880
907
|
});
|
|
881
908
|
}
|
|
@@ -1197,4 +1224,4 @@ export const _testOnly = {
|
|
|
1197
1224
|
resolveKnownPackageCommandHint,
|
|
1198
1225
|
};
|
|
1199
1226
|
//# sourceMappingURL=error-guidance.js.map
|
|
1200
|
-
//# debugId=
|
|
1227
|
+
//# debugId=6f4c3f5d-9acc-5e2c-9351-12fdcfcdb56a
|
package/dist/cli/main.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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]="
|
|
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]="cf9d1c78-06f0-5330-8562-ac863c95ee86")}catch(e){}}();
|
|
7
7
|
import { Command } 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 { resolveSubcommandFlagContractsForCommand } from "../sdk/cli-contracts.js";
|
|
@@ -27,7 +27,7 @@ import { loadExtensionRecoveryFailures, loadUnknownCommandRecoveryFailures } fro
|
|
|
27
27
|
import { maybeRenderBootstrapJsonHelp, attachCreateUpdatePolicyHelpText } from "./help-json-payload.js";
|
|
28
28
|
import { attachOutputTokenAccounting } from "../sdk/output-token-accounting.js";
|
|
29
29
|
import { runWithDiscoveredContextIntentContracts } from "../sdk/context-intent-runtime.js";
|
|
30
|
-
import { validateReadOutputOptions } from "../sdk/read-output-contracts.js";
|
|
30
|
+
import { applyReadOutputIncludeModes, validateReadOutputOptions } from "../sdk/read-output-contracts.js";
|
|
31
31
|
import { loadContextIntentSnapshotForInvocation } from "./context-intent-invocation.js";
|
|
32
32
|
import { isPmSuccessfulExitCode } from "../sdk/cli-contracts/command-exit-contracts.js";
|
|
33
33
|
const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
|
|
@@ -499,6 +499,40 @@ async function handleGenericRunPmCliError(params) {
|
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Hand canonical `--output-include` projection modes to the command that owns
|
|
504
|
+
* them, leaving only field selectors for post-execution projection.
|
|
505
|
+
*
|
|
506
|
+
* `--output-include brief` must be the exact behaviour of `--brief`, which the
|
|
507
|
+
* emitted migration hint promises; a mode can only be honoured before the
|
|
508
|
+
* command computes its rows, so it cannot be resolved by the output layer.
|
|
509
|
+
*/
|
|
510
|
+
function forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions) {
|
|
511
|
+
const requested = globalOptions.outputInclude;
|
|
512
|
+
if (requested === undefined)
|
|
513
|
+
return;
|
|
514
|
+
const modeOptions = {};
|
|
515
|
+
const { selectors, modes } = applyReadOutputIncludeModes(commandPath, requested, modeOptions);
|
|
516
|
+
if (modes.length === 0)
|
|
517
|
+
return;
|
|
518
|
+
for (const [key, value] of Object.entries(modeOptions)) {
|
|
519
|
+
commandOptions[key] = value;
|
|
520
|
+
actionCommand.setOptionValueWithSource(key, value, "cli");
|
|
521
|
+
}
|
|
522
|
+
const residual = selectors.length > 0 ? selectors.join(",") : undefined;
|
|
523
|
+
if (residual === undefined) {
|
|
524
|
+
delete globalOptions.outputInclude;
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
globalOptions.outputInclude = residual;
|
|
528
|
+
}
|
|
529
|
+
// The resolved-global cache is cleared and re-read from Commander before the
|
|
530
|
+
// handler runs, so the consumed modes have to leave the parsed option too.
|
|
531
|
+
for (let scope = actionCommand; scope; scope = scope.parent) {
|
|
532
|
+
scope.setOptionValueWithSource("outputInclude", residual, "cli");
|
|
533
|
+
}
|
|
534
|
+
setResolvedGlobalOptions(actionCommand, globalOptions);
|
|
535
|
+
}
|
|
502
536
|
function extractCommandScopedOptions(command, commandArgs, extensionFlagDefinitions = []) {
|
|
503
537
|
const allOptions = command.optsWithGlobals();
|
|
504
538
|
const scoped = { ...allOptions };
|
|
@@ -1564,7 +1598,9 @@ function attachProgramLifecycleHooks(rootProgram) {
|
|
|
1564
1598
|
outputBudget: rawGlobalOptions.outputBudget,
|
|
1565
1599
|
outputFormat: rawGlobalOptions.outputFormat,
|
|
1566
1600
|
outputSession: rawGlobalOptions.outputSession,
|
|
1601
|
+
outputCursor: rawGlobalOptions.outputCursor,
|
|
1567
1602
|
});
|
|
1603
|
+
forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions);
|
|
1568
1604
|
await maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions);
|
|
1569
1605
|
const fallbackPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobalOptions.path);
|
|
1570
1606
|
const runtimeExtensions = await maybeLoadRuntimeExtensions(actionCommand);
|
|
@@ -1602,6 +1638,7 @@ function attachProgramLifecycleHooks(rootProgram) {
|
|
|
1602
1638
|
setActiveExtensionRegistrations(runtimeExtensions.registrations);
|
|
1603
1639
|
const extensionFlagDefinitions = collectExtensionFlagDefinitionsForInvocation(runtimeExtensions.registrations, commandPath, commandArgs);
|
|
1604
1640
|
commandOptions = extractCommandScopedOptions(actionCommand, commandArgs, extensionFlagDefinitions);
|
|
1641
|
+
forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions);
|
|
1605
1642
|
const parserOverride = await runActiveParserOverride({
|
|
1606
1643
|
command: commandPath,
|
|
1607
1644
|
args: commandArgs,
|
|
@@ -2475,4 +2512,4 @@ export const _testOnly = {
|
|
|
2475
2512
|
wrapThrownErrorForSentry,
|
|
2476
2513
|
};
|
|
2477
2514
|
//# sourceMappingURL=main.js.map
|
|
2478
|
-
//# debugId=
|
|
2515
|
+
//# debugId=cf9d1c78-06f0-5330-8562-ac863c95ee86
|
|
@@ -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]="60ee1ab9-00a0-50a7-839e-4938ecc6a48f")}catch(e){}}();
|
|
3
3
|
import { resolveBodyFileContent, EXIT_CODE, splitCommaList, PmCliError, createUnknownSubcommandError, } from "../sdk/runtime-primitives.js";
|
|
4
4
|
import { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, } from "../sdk/cli-contracts.js";
|
|
5
5
|
import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
|
|
@@ -1670,6 +1670,7 @@ export function registerMutationCommands(program, registrationOptions = {}) {
|
|
|
1670
1670
|
.argument("[id]", "Item id (omit with --all)")
|
|
1671
1671
|
.option("--all", "Scan every stream for drift and repair each drifted stream in one audited pass")
|
|
1672
1672
|
.option("--dry-run", "Preview the re-anchor impact without writing the history file")
|
|
1673
|
+
.option("--normalize-provenance", "Remove invalid provenance; return aggregate-only evidence")
|
|
1673
1674
|
.option("--author <value>", "Mutation author")
|
|
1674
1675
|
.option("--message <value>", "Audit history message for the repair marker entry")
|
|
1675
1676
|
.option("--force", "Force ownership/lock override")
|
|
@@ -1684,6 +1685,7 @@ export function registerMutationCommands(program, registrationOptions = {}) {
|
|
|
1684
1685
|
author: typeof options.author === "string" ? options.author : undefined,
|
|
1685
1686
|
message: typeof options.message === "string" ? options.message : undefined,
|
|
1686
1687
|
force: Boolean(options.force),
|
|
1688
|
+
normalizeProvenance: options.normalizeProvenance === true,
|
|
1687
1689
|
};
|
|
1688
1690
|
// history-repair only re-anchors the audit stream; item content is untouched,
|
|
1689
1691
|
// so search caches do not need invalidation.
|
|
@@ -1838,4 +1840,4 @@ export function registerMutationCommands(program, registrationOptions = {}) {
|
|
|
1838
1840
|
.action(runDepsAction);
|
|
1839
1841
|
}
|
|
1840
1842
|
//# sourceMappingURL=register-mutation.js.map
|
|
1841
|
-
//# debugId=
|
|
1843
|
+
//# debugId=60ee1ab9-00a0-50a7-839e-4938ecc6a48f
|
|
@@ -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]="dec5fb7d-416f-5da6-bd97-c05c25dbf769")}catch(e){}}();
|
|
3
3
|
import { resolveRuntimeStatusRegistry, setActiveCommandResult, EXIT_CODE, PmCliError, createUnknownSubcommandError, resolveAuthor, resolvePmRoot, readSettings, } from "../sdk/runtime-primitives.js";
|
|
4
4
|
import { resolveStartTaskInProgressStatus } from "../sdk/start-task-status.js";
|
|
5
5
|
import { parseStatsAnalyticsJson } from "./stats-analytics-json.js";
|
|
@@ -284,6 +284,7 @@ async function runDuplicatesAction(options, command) {
|
|
|
284
284
|
async function runHealthAction(options, command) {
|
|
285
285
|
const globalOptions = getGlobalOptions(command);
|
|
286
286
|
const startedAt = Date.now();
|
|
287
|
+
const strictExit = Boolean(options.strictExit) || Boolean(options.failOnWarn);
|
|
287
288
|
const result = await runHealth(globalOptions, {
|
|
288
289
|
strictDirectories: Boolean(options.strictDirectories),
|
|
289
290
|
requireMergeDrivers: Boolean(options.requireMergeDrivers),
|
|
@@ -294,14 +295,13 @@ async function runHealthAction(options, command) {
|
|
|
294
295
|
verboseStaleItems: Boolean(options.verboseStaleItems),
|
|
295
296
|
verboseAuthorEvents: Boolean(options.verboseAuthorEvents),
|
|
296
297
|
brief: Boolean(options.brief),
|
|
297
|
-
summary: Boolean(options.summary),
|
|
298
|
+
summary: Boolean(options.summary) || strictExit,
|
|
298
299
|
skipVectors: Boolean(options.skipVectors),
|
|
299
300
|
skipIntegrity: Boolean(options.skipIntegrity),
|
|
300
301
|
skipDrift: Boolean(options.skipDrift),
|
|
301
302
|
full: Boolean(options.full),
|
|
302
303
|
});
|
|
303
304
|
printResult(result, globalOptions);
|
|
304
|
-
const strictExit = Boolean(options.strictExit) || Boolean(options.failOnWarn);
|
|
305
305
|
if (strictExit && !result.ok) {
|
|
306
306
|
setActiveCommandResult({
|
|
307
307
|
...result,
|
|
@@ -649,7 +649,7 @@ export function registerOperationCommands(program) {
|
|
|
649
649
|
.option("--skip-integrity", "Skip item/history file integrity check for a faster run")
|
|
650
650
|
.option("--skip-drift", "Skip history drift hash check for a faster run")
|
|
651
651
|
.option("--full", "Run all checks including slow integrity, drift, and vectorization checks")
|
|
652
|
-
.option("--strict-exit", "Return non-zero exit when health is not ok
|
|
652
|
+
.option("--strict-exit", "Return non-zero exit when health is not ok and default to actionable summary output; use --full for complete details")
|
|
653
653
|
.option("--fail-on-warn", "Alias for --strict-exit")
|
|
654
654
|
.action(runHealthAction);
|
|
655
655
|
program
|
|
@@ -873,4 +873,4 @@ function registerSchedulingShortcutCommands(program) {
|
|
|
873
873
|
});
|
|
874
874
|
}
|
|
875
875
|
//# sourceMappingURL=register-operations.js.map
|
|
876
|
-
//# debugId=
|
|
876
|
+
//# debugId=dec5fb7d-416f-5da6-bd97-c05c25dbf769
|