@unbrained/pm-cli 2026.8.6 → 2026.8.8
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 +65 -0
- package/dist/cli/main.js +6 -3
- package/dist/cli/register-annotations.d.ts +11 -0
- package/dist/cli/register-annotations.js +195 -0
- package/dist/cli/register-history-author.js +7 -30
- package/dist/cli/register-mutation.js +25 -206
- package/dist/cli/register-operations.js +11 -2
- package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
- package/dist/cli/runtime-compatibility-boundary.js +43 -0
- package/dist/cli/stats-analytics-json.d.ts +9 -0
- package/dist/cli/stats-analytics-json.js +69 -0
- package/dist/cli-bundle/bundle-manifest.json +156 -692
- package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
- package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
- package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
- package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
- package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
- package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
- package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
- package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
- package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
- package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
- package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-WFZAMJHZ.js} +8 -8
- package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-5FLBTZJQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-ANTMGYLI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-DMKOMTTY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-F5B3HBEZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-FI6DWU2M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-FNOKJG6N.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-FPDYXZBK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-GWI6YIKJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-HCUC62AB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-HGNKPSCB.js} +22 -22
- package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-PL2EYDJK.js} +29 -29
- package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-TCSAPH33.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YSAHYUXX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +2 -0
- 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 +38 -37
- 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 +1 -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 -1
- package/dist/cli.js +14 -4
- package/dist/core/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/workspace-history.d.ts +22 -2
- package/dist/core/history/workspace-history.js +60 -36
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +10 -2
- package/dist/core/sentry/helpers.d.ts +10 -0
- package/dist/core/sentry/helpers.js +59 -4
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/constants.d.ts +2 -0
- package/dist/core/shared/constants.js +4 -2
- package/dist/mcp/tool-definitions.js +6 -2
- package/dist/sdk/annotations.d.ts +40 -0
- package/dist/sdk/annotations.js +61 -9
- package/dist/sdk/author-attribution.d.ts +12 -0
- package/dist/sdk/author-attribution.js +87 -9
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +7 -2
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
- package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
- package/dist/sdk/cli-contracts/completeness.js +54 -5
- package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
- package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +41 -8
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +129 -10
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +22 -3
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/comments.d.ts +7 -0
- package/dist/sdk/comments.js +2 -2
- package/dist/sdk/completion.js +12 -5
- package/dist/sdk/contracts.d.ts +2 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/core.d.ts +3 -1
- package/dist/sdk/core.js +4 -3
- package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
- package/dist/sdk/environment/host-environment-errors.js +124 -0
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
- package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
- package/dist/sdk/environment/source-context.d.ts +23 -0
- package/dist/sdk/environment/source-context.js +29 -0
- package/dist/sdk/error-code-catalog.d.ts +6 -0
- package/dist/sdk/error-code-catalog.js +62 -8
- package/dist/sdk/extension.js +9 -11
- package/dist/sdk/generated-error-code-catalog.js +739 -3
- package/dist/sdk/governance/health.d.ts +11 -3
- package/dist/sdk/governance/health.js +5 -5
- package/dist/sdk/history-analytics.d.ts +141 -0
- package/dist/sdk/history-analytics.js +283 -0
- package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
- package/dist/sdk/improvement-ledger-validation.js +63 -0
- package/dist/sdk/improvement-ledger.d.ts +139 -0
- package/dist/sdk/improvement-ledger.js +261 -0
- package/dist/sdk/index.d.ts +13 -5
- package/dist/sdk/index.js +15 -7
- package/dist/sdk/learnings.d.ts +15 -0
- package/dist/sdk/learnings.js +2 -2
- package/dist/sdk/lifecycle/close-many.d.ts +6 -1
- package/dist/sdk/lifecycle/close-many.js +43 -5
- package/dist/sdk/lifecycle/plan.js +6 -3
- package/dist/sdk/lifecycle/update-many.d.ts +2 -1
- package/dist/sdk/lifecycle/update-many.js +29 -5
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +21 -0
- package/dist/sdk/merge/install.js +58 -20
- package/dist/sdk/notes.d.ts +7 -0
- package/dist/sdk/notes.js +2 -2
- package/dist/sdk/read-output-budget.js +24 -22
- package/dist/sdk/read-output-contracts.d.ts +10 -2
- package/dist/sdk/read-output-contracts.js +204 -66
- package/dist/sdk/read-output-rows.d.ts +29 -0
- package/dist/sdk/read-output-rows.js +100 -0
- package/dist/sdk/read-output-session.d.ts +69 -0
- package/dist/sdk/read-output-session.js +200 -0
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +14 -2
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime-stats-options.d.ts +9 -0
- package/dist/sdk/runtime-stats-options.js +38 -0
- package/dist/sdk/runtime.d.ts +1 -0
- package/dist/sdk/runtime.js +13 -50
- package/dist/sdk/stats.d.ts +40 -0
- package/dist/sdk/stats.js +112 -29
- package/dist/sdk/test/execution.js +4 -2
- package/dist/sdk/test/parsers.js +5 -2
- package/dist/sdk/workspace-snapshot.d.ts +9 -0
- package/dist/sdk/workspace-snapshot.js +48 -16
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
- package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
- package/docs/RELEASING.md +27 -2
- package/docs/SCRIPTING.md +27 -1
- package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
- package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
- package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
- package/docs/TESTING.md +17 -0
- package/marketplace.json +2 -2
- package/package.json +6 -4
- 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/sdk/public-surface.json +875 -827
- package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-343QETLI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3KFVGGRE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3ZJRFYY2.js +0 -23
- package/dist/cli-bundle/chunks/chunk-4AVFKHHC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-4OVGQW22.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5PBP2ZP3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
- package/dist/cli-bundle/chunks/chunk-AOBDLU4T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AYRUGRNS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-BP6EMEDP.js +0 -5
- package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
- package/dist/cli-bundle/chunks/chunk-C3YABSJK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CA3BURYF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D7I3TUGV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DQGJ2RWT.js +0 -3
- package/dist/cli-bundle/chunks/chunk-DWOAOZHZ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-F4NREH3G.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FDBRXV25.js +0 -2
- package/dist/cli-bundle/chunks/chunk-GU3TSEHD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
- package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JFZIS6JF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JQ4NZ5EB.js +0 -2
- package/dist/cli-bundle/chunks/chunk-L6LGKJX3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-M357ZCOR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-M4VEE3FK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-MCS73BKB.js +0 -3
- package/dist/cli-bundle/chunks/chunk-MDTH7SAE.js +0 -19
- package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-OXY3SJ3N.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-Q3VOP62W.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QJ7C3JIW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-R6LSRGPS.js +0 -8
- package/dist/cli-bundle/chunks/chunk-R6RKEYYW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RAFUN7IX.js +0 -2005
- package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +0 -56
- package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SVV3DQES.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SXECIECW.js +0 -5
- package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +0 -8
- package/dist/cli-bundle/chunks/chunk-TPKDJ5WL.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UVVXHGYS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
- package/dist/cli-bundle/chunks/chunk-WSI5KZQJ.js +0 -55
- package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
- package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
- package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
- package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
- package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
- package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
- package/dist/cli-bundle/chunks/create-TG67IVFI.js +0 -2
- package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
- package/dist/cli-bundle/chunks/deps-AJUGP2OH.js +0 -2
- package/dist/cli-bundle/chunks/docs-QOCLDRKJ.js +0 -2
- package/dist/cli-bundle/chunks/files-3ST5TY64.js +0 -2
- package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
- package/dist/cli-bundle/chunks/history-compact-7BJFML4S.js +0 -2
- package/dist/cli-bundle/chunks/history-redact-WJN3HYXR.js +0 -2
- package/dist/cli-bundle/chunks/history-repair-XDNZUB7F.js +0 -2
- package/dist/cli-bundle/chunks/learnings-SZMUPVNA.js +0 -2
- package/dist/cli-bundle/chunks/profile-KL53JIAC.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +0 -2
- package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
- package/dist/cli-bundle/chunks/schema-QJ27OTRV.js +0 -2
- package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
- package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MBBMTDD3.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-ME4XVOBJ.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YHDCGUIW.js +0 -14
|
@@ -52,6 +52,18 @@ export interface AcknowledgeUnknownAuthorEventsOptions {
|
|
|
52
52
|
/** Evidence-backed rationale for the attribution. */
|
|
53
53
|
reason: string;
|
|
54
54
|
}
|
|
55
|
+
/** Resolve the mutually exclusive CLI and SDK acknowledgment selectors. */
|
|
56
|
+
export declare function resolveUnknownAuthorAcknowledgmentSelector(rawEvents: readonly string[], allActionable: boolean): {
|
|
57
|
+
events: UnknownAuthorHistoryEvent[];
|
|
58
|
+
all_actionable: boolean;
|
|
59
|
+
};
|
|
60
|
+
/** Parse user-facing item or workspace history coordinates into SDK events. */
|
|
61
|
+
export declare function parseUnknownAuthorHistoryEventCoordinates(values: readonly string[]): UnknownAuthorHistoryEvent[];
|
|
62
|
+
/** Normalize an untyped transport payload and execute author acknowledgment. */
|
|
63
|
+
export declare function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot: string, input: Record<string, unknown>): Promise<{
|
|
64
|
+
acknowledged: number;
|
|
65
|
+
history_path: string;
|
|
66
|
+
}>;
|
|
55
67
|
/**
|
|
56
68
|
* Append an audited disposition for immutable unknown-author events without
|
|
57
69
|
* rewriting their original streams.
|
|
@@ -4,11 +4,28 @@
|
|
|
4
4
|
* Provides reusable diagnostics for mutation-author provenance in tracker history.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!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
|
+
!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]="4fd16197-979e-5269-bed7-f2fb0e2038c2")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
|
-
import { appendWorkspaceAuditEvent } from "../core/history/workspace-history.js";
|
|
10
|
+
import { appendWorkspaceAuditEvent, WORKSPACE_HISTORY_ID, } from "../core/history/workspace-history.js";
|
|
11
11
|
import { readSettings } from "../core/store/settings.js";
|
|
12
|
+
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
13
|
+
import { PmCliError } from "../core/shared/errors.js";
|
|
14
|
+
import { readRuntimeString, readRuntimeStringArray } from "./runtime-input.js";
|
|
15
|
+
/**
|
|
16
|
+
* Refuse an acknowledgment argument as a classified usage error.
|
|
17
|
+
*
|
|
18
|
+
* Argument validation is an expected outcome of a public mutation surface, not a
|
|
19
|
+
* product failure. Raising a bare `TypeError` left the refusal at exit code 1,
|
|
20
|
+
* which the CLI observability boundary reports as an unclassified handled error
|
|
21
|
+
* and the release gate then reads as a blocking production issue. Carrying
|
|
22
|
+
* {@link EXIT_CODE.USAGE} plus a stable code keeps the refusal teachable and
|
|
23
|
+
* keeps expected validation out of the error channel without masking genuine
|
|
24
|
+
* failures, which retain their own exit codes.
|
|
25
|
+
*/
|
|
26
|
+
function refuseAuthorAcknowledgmentArgument(message, context) {
|
|
27
|
+
throw new PmCliError(message, EXIT_CODE.USAGE, context);
|
|
28
|
+
}
|
|
12
29
|
/** First release-governance anchor after which unknown authors require remediation. */
|
|
13
30
|
export const HISTORY_AUTHOR_ATTRIBUTION_BASELINE = "2026-07-15T06:22:12.276Z";
|
|
14
31
|
/** Parsed epoch for the immutable attribution baseline used by every stream scan. */
|
|
@@ -187,6 +204,63 @@ export const scanHistoryAuthorAttribution = async (pmRoot, sampleLimit = 20, inc
|
|
|
187
204
|
...(includeActionableEvents ? { actionable_events: actionableEvents } : {}),
|
|
188
205
|
};
|
|
189
206
|
};
|
|
207
|
+
/** Resolve the mutually exclusive CLI and SDK acknowledgment selectors. */
|
|
208
|
+
export function resolveUnknownAuthorAcknowledgmentSelector(rawEvents, allActionable) {
|
|
209
|
+
const hasExplicitEvents = rawEvents.length > 0;
|
|
210
|
+
if (hasExplicitEvents && allActionable) {
|
|
211
|
+
refuseAuthorAcknowledgmentArgument("Specify exactly one selector: repeat --event or pass --all-actionable.", {
|
|
212
|
+
code: "history_author_acknowledge_selector_conflict",
|
|
213
|
+
required: "Exactly one of --event or --all-actionable",
|
|
214
|
+
examples: [
|
|
215
|
+
'pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"',
|
|
216
|
+
'pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"',
|
|
217
|
+
],
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
if (!hasExplicitEvents && !allActionable) {
|
|
221
|
+
refuseAuthorAcknowledgmentArgument("Specify exactly one selector: repeat --event or pass --all-actionable.", {
|
|
222
|
+
code: "history_author_acknowledge_selector_required",
|
|
223
|
+
required: "Exactly one of --event or --all-actionable",
|
|
224
|
+
examples: [
|
|
225
|
+
'pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"',
|
|
226
|
+
'pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"',
|
|
227
|
+
],
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
events: parseUnknownAuthorHistoryEventCoordinates(rawEvents),
|
|
232
|
+
all_actionable: allActionable,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** Parse user-facing item or workspace history coordinates into SDK events. */
|
|
236
|
+
export function parseUnknownAuthorHistoryEventCoordinates(values) {
|
|
237
|
+
return values.map((value) => {
|
|
238
|
+
const separator = value.lastIndexOf(":");
|
|
239
|
+
const itemId = value.slice(0, separator).trim();
|
|
240
|
+
const line = Number(value.slice(separator + 1));
|
|
241
|
+
const validItemId = itemId === WORKSPACE_HISTORY_ID || /^[a-z0-9][a-z0-9-]*$/iu.test(itemId);
|
|
242
|
+
if (separator < 1 ||
|
|
243
|
+
!validItemId ||
|
|
244
|
+
!Number.isSafeInteger(line) ||
|
|
245
|
+
line < 1) {
|
|
246
|
+
refuseAuthorAcknowledgmentArgument(`history-author-acknowledge --event expects <item-id>:<one-based-line>, received "${value}".`, { code: "history_author_acknowledge_target_unreadable" });
|
|
247
|
+
}
|
|
248
|
+
return { item_id: itemId, line };
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/** Normalize an untyped transport payload and execute author acknowledgment. */
|
|
252
|
+
export function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot, input) {
|
|
253
|
+
const selector = resolveUnknownAuthorAcknowledgmentSelector(readRuntimeStringArray(input.historyEvent), input.allActionable === true || input.all_actionable === true);
|
|
254
|
+
return acknowledgeUnknownAuthorHistoryEvents(pmRoot, {
|
|
255
|
+
events: selector.events,
|
|
256
|
+
all_actionable: selector.all_actionable,
|
|
257
|
+
attributed_author: readRuntimeString(input, "attributedAuthor") ??
|
|
258
|
+
readRuntimeString(input, "attributed_author") ??
|
|
259
|
+
"",
|
|
260
|
+
reviewer: readRuntimeString(input, "reviewer") ?? "",
|
|
261
|
+
reason: readRuntimeString(input, "reason") ?? "",
|
|
262
|
+
});
|
|
263
|
+
}
|
|
190
264
|
/**
|
|
191
265
|
* Append an audited disposition for immutable unknown-author events without
|
|
192
266
|
* rewriting their original streams.
|
|
@@ -197,8 +271,11 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
197
271
|
const reason = options.reason.trim();
|
|
198
272
|
const explicitEvents = options.events ?? [];
|
|
199
273
|
const selectorCount = Number(options.all_actionable === true) + Number(explicitEvents.length > 0);
|
|
274
|
+
if (selectorCount === 0) {
|
|
275
|
+
refuseAuthorAcknowledgmentArgument("Specify exactly one selector: events or all_actionable.", { code: "history_author_acknowledge_selector_required" });
|
|
276
|
+
}
|
|
200
277
|
if (selectorCount > 1) {
|
|
201
|
-
|
|
278
|
+
refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", { code: "history_author_acknowledge_selector_conflict" });
|
|
202
279
|
}
|
|
203
280
|
const selectedEvents = options.all_actionable === true
|
|
204
281
|
? (await scanHistoryAuthorAttribution(pmRoot, 0, true))
|
|
@@ -213,7 +290,7 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
213
290
|
reason.length > 0,
|
|
214
291
|
].includes(false);
|
|
215
292
|
if (requiredValuesMissing) {
|
|
216
|
-
|
|
293
|
+
refuseAuthorAcknowledgmentArgument("Author acknowledgment requires events, reviewer, attributed_author, and reason.", { code: "history_author_acknowledge_required_values_missing" });
|
|
217
294
|
}
|
|
218
295
|
const uniqueEvents = [
|
|
219
296
|
...new Map(selectedEvents.map((event) => [
|
|
@@ -223,12 +300,13 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
223
300
|
].sort((left, right) => left.item_id.localeCompare(right.item_id) || left.line - right.line);
|
|
224
301
|
for (const event of uniqueEvents) {
|
|
225
302
|
const invalidCoordinate = [
|
|
226
|
-
|
|
303
|
+
event.item_id === WORKSPACE_HISTORY_ID ||
|
|
304
|
+
/^[a-z0-9][a-z0-9-]*$/i.test(event.item_id),
|
|
227
305
|
Number.isSafeInteger(event.line),
|
|
228
306
|
event.line >= 1,
|
|
229
307
|
].includes(false);
|
|
230
308
|
if (invalidCoordinate) {
|
|
231
|
-
|
|
309
|
+
refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
|
|
232
310
|
}
|
|
233
311
|
let parsed;
|
|
234
312
|
try {
|
|
@@ -237,10 +315,10 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
237
315
|
parsed = JSON.parse(line ?? "");
|
|
238
316
|
}
|
|
239
317
|
catch {
|
|
240
|
-
|
|
318
|
+
refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
|
|
241
319
|
}
|
|
242
320
|
if (classifyHistoryAuthorEvent(parsed) !== "actionable_unknown") {
|
|
243
|
-
|
|
321
|
+
refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, { code: "history_author_acknowledge_target_not_actionable" });
|
|
244
322
|
}
|
|
245
323
|
}
|
|
246
324
|
const settings = await readSettings(pmRoot);
|
|
@@ -264,4 +342,4 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
|
|
|
264
342
|
};
|
|
265
343
|
}
|
|
266
344
|
//# sourceMappingURL=author-attribution.js.map
|
|
267
|
-
//# debugId=
|
|
345
|
+
//# debugId=4fd16197-979e-5269-bed7-f2fb0e2038c2
|
|
@@ -29,6 +29,8 @@ export interface BootstrapGlobalOptions {
|
|
|
29
29
|
outputBudget?: string;
|
|
30
30
|
/** Canonical renderer encoding for read output. */
|
|
31
31
|
outputFormat?: "toon" | "json";
|
|
32
|
+
/** Caller-carried cross-call budget and served-item state. */
|
|
33
|
+
outputSession?: string;
|
|
32
34
|
/** Invocation-wide mutation author override. */
|
|
33
35
|
author?: string;
|
|
34
36
|
/** Whether `--author` was present without its required value. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides public bootstrap argument normalization for embedded CLI hosts.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!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
|
+
!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]="1c2ee12c-9a3e-57bc-8336-f6c558458802")}catch(e){}}();
|
|
8
8
|
import { EXECUTABLE_COMMAND_ALIASES, resolveSubcommandFlagContractsForCommand, } from "./cli-contracts.js";
|
|
9
9
|
export { EXECUTABLE_COMMAND_ALIASES };
|
|
10
10
|
import { levenshteinDistanceWithinLimit } from "../core/shared/levenshtein.js";
|
|
@@ -16,12 +16,14 @@ const GLOBAL_VALUE_CONSUMING_FLAGS = new Set([
|
|
|
16
16
|
"--output-limit",
|
|
17
17
|
"--output-budget",
|
|
18
18
|
"--output-format",
|
|
19
|
+
"--output-session",
|
|
19
20
|
]);
|
|
20
21
|
const OUTPUT_VALUE_FLAGS = new Set([
|
|
21
22
|
"--output-include",
|
|
22
23
|
"--output-limit",
|
|
23
24
|
"--output-budget",
|
|
24
25
|
"--output-format",
|
|
26
|
+
"--output-session",
|
|
25
27
|
]);
|
|
26
28
|
/** Whether a global value-consuming flag uses its inline `--flag=value` form. */
|
|
27
29
|
const isInlineGlobalValueToken = (token) => {
|
|
@@ -105,6 +107,9 @@ export function parseBootstrapGlobalOptions(argv) {
|
|
|
105
107
|
outputFormat: state.outputValues.get("--output-format"),
|
|
106
108
|
}
|
|
107
109
|
: {}),
|
|
110
|
+
...(state.outputValues.get("--output-session") === undefined
|
|
111
|
+
? {}
|
|
112
|
+
: { outputSession: state.outputValues.get("--output-session") }),
|
|
108
113
|
...(state.author === ""
|
|
109
114
|
? { authorMissingValue: true }
|
|
110
115
|
: state.author !== undefined
|
|
@@ -866,4 +871,4 @@ export const _testOnly = {
|
|
|
866
871
|
resolveCanonicalFlag,
|
|
867
872
|
};
|
|
868
873
|
//# sourceMappingURL=cli-bootstrap.js.map
|
|
869
|
-
//# debugId=
|
|
874
|
+
//# debugId=1c2ee12c-9a3e-57bc-8336-f6c558458802
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/** Stable numeric exit codes emitted by core pm commands. */
|
|
2
|
+
export type PmCommandExitCode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
3
|
+
/** Effect-oriented outcome vocabulary shared by shells and structured output. */
|
|
4
|
+
export type PmCommandExitOutcome = "effect" | "internal_failure" | "refused_input" | "refused_tracker_state" | "conflict" | "dependency_failed" | "no_effect" | "partial_effect";
|
|
5
|
+
/** Meaning and success semantics for one stable process exit. */
|
|
6
|
+
export interface PmCommandExitOutcomeContract {
|
|
7
|
+
/** Stable process exit visible without parsing stdout. */
|
|
8
|
+
exit_code: PmCommandExitCode;
|
|
9
|
+
/** Effect-oriented result independent of implementation details. */
|
|
10
|
+
outcome: PmCommandExitOutcome;
|
|
11
|
+
/** Whether the command completed its requested control flow successfully. */
|
|
12
|
+
success: boolean;
|
|
13
|
+
/** Concise operator-facing meaning. */
|
|
14
|
+
meaning: string;
|
|
15
|
+
}
|
|
16
|
+
/** Declared numeric exits for one core command path. */
|
|
17
|
+
export interface PmCommandExitContract {
|
|
18
|
+
/** Normalized command path. */
|
|
19
|
+
command: string;
|
|
20
|
+
/** Exhaustive exits the command may emit. */
|
|
21
|
+
exit_codes: readonly PmCommandExitCode[];
|
|
22
|
+
}
|
|
23
|
+
/** One replay observation used to verify command exit declarations. */
|
|
24
|
+
export interface PmCommandExitObservation {
|
|
25
|
+
/** Command path executed by the replay. */
|
|
26
|
+
command: string;
|
|
27
|
+
/** Process exit observed from the real command boundary. */
|
|
28
|
+
exit_code: number;
|
|
29
|
+
/** Stable replay case identifier for diagnostics. */
|
|
30
|
+
replay_id: string;
|
|
31
|
+
}
|
|
32
|
+
/** Drift report produced by exit-contract replay conformance. */
|
|
33
|
+
export interface PmCommandExitConformanceReport {
|
|
34
|
+
/** Whether all declaration and observation checks passed. */
|
|
35
|
+
ok: boolean;
|
|
36
|
+
/** Expected commands without a declaration. */
|
|
37
|
+
missing_commands: string[];
|
|
38
|
+
/** Observations whose command or numeric exit is undeclared. */
|
|
39
|
+
undeclared_observations: PmCommandExitObservation[];
|
|
40
|
+
/** Declared numeric outcomes not reached anywhere in the replay corpus. */
|
|
41
|
+
unreachable_exit_codes: PmCommandExitCode[];
|
|
42
|
+
}
|
|
43
|
+
/** Canonical effect vocabulary for all stable CLI process exits. */
|
|
44
|
+
export declare const PM_COMMAND_EXIT_OUTCOME_CONTRACTS: readonly [{
|
|
45
|
+
readonly exit_code: 0;
|
|
46
|
+
readonly outcome: "effect";
|
|
47
|
+
readonly success: true;
|
|
48
|
+
readonly meaning: "The requested operation completed with its intended effect.";
|
|
49
|
+
}, {
|
|
50
|
+
readonly exit_code: 1;
|
|
51
|
+
readonly outcome: "internal_failure";
|
|
52
|
+
readonly success: false;
|
|
53
|
+
readonly meaning: "An unexpected runtime or internal failure prevented completion.";
|
|
54
|
+
}, {
|
|
55
|
+
readonly exit_code: 2;
|
|
56
|
+
readonly outcome: "refused_input";
|
|
57
|
+
readonly success: false;
|
|
58
|
+
readonly meaning: "The invocation was refused because its input or composition was invalid.";
|
|
59
|
+
}, {
|
|
60
|
+
readonly exit_code: 3;
|
|
61
|
+
readonly outcome: "refused_tracker_state";
|
|
62
|
+
readonly success: false;
|
|
63
|
+
readonly meaning: "The requested tracker, item, or resource was not present.";
|
|
64
|
+
}, {
|
|
65
|
+
readonly exit_code: 4;
|
|
66
|
+
readonly outcome: "conflict";
|
|
67
|
+
readonly success: false;
|
|
68
|
+
readonly meaning: "Current state or concurrency prevented the requested effect.";
|
|
69
|
+
}, {
|
|
70
|
+
readonly exit_code: 5;
|
|
71
|
+
readonly outcome: "dependency_failed";
|
|
72
|
+
readonly success: false;
|
|
73
|
+
readonly meaning: "A required dependency operation failed.";
|
|
74
|
+
}, {
|
|
75
|
+
readonly exit_code: 6;
|
|
76
|
+
readonly outcome: "no_effect";
|
|
77
|
+
readonly success: true;
|
|
78
|
+
readonly meaning: "The request was valid and completed, but matched nothing to change.";
|
|
79
|
+
}, {
|
|
80
|
+
readonly exit_code: 7;
|
|
81
|
+
readonly outcome: "partial_effect";
|
|
82
|
+
readonly success: true;
|
|
83
|
+
readonly meaning: "The request completed and changed some, but not all, selected targets.";
|
|
84
|
+
}];
|
|
85
|
+
/** Exhaustive core command exit declarations generated from the command registry. */
|
|
86
|
+
export declare const PM_COMMAND_EXIT_CONTRACTS: readonly PmCommandExitContract[];
|
|
87
|
+
/** Stable successful process exits, including machine-distinct effect states. */
|
|
88
|
+
export declare const PM_SUCCESS_EXIT_CODES: readonly [0, 6, 7];
|
|
89
|
+
/** Portable success effect reported by command result envelopes. */
|
|
90
|
+
export type PmCommandEffect = "effect" | "no_effect" | "partial_effect" | "dependency_failed";
|
|
91
|
+
/** Shell and envelope representation of one command effect or collected failure. */
|
|
92
|
+
export interface PmCommandEffectReceipt {
|
|
93
|
+
/** Semantic effect observed after command execution. */
|
|
94
|
+
outcome: PmCommandEffect;
|
|
95
|
+
/** Stable shell exit paired with the effect. */
|
|
96
|
+
exit_code: 0 | 5 | 6 | 7;
|
|
97
|
+
}
|
|
98
|
+
/** Counts used to derive one bulk mutation's effect without parsing prose. */
|
|
99
|
+
export interface PmBulkMutationEffectCounts {
|
|
100
|
+
/** Rows that completed the requested mutation. */
|
|
101
|
+
applied: number;
|
|
102
|
+
/** Rows deliberately left unchanged. */
|
|
103
|
+
skipped: number;
|
|
104
|
+
/** Rows whose attempted mutation failed. */
|
|
105
|
+
failed: number;
|
|
106
|
+
/** Explicit requested identifiers that did not exist. */
|
|
107
|
+
unmatched: number;
|
|
108
|
+
}
|
|
109
|
+
/** Return whether an exit represents a successful command outcome. */
|
|
110
|
+
export declare function isPmSuccessfulExitCode(exitCode: number): boolean;
|
|
111
|
+
/** Return whether an exit belongs to the declared pm process vocabulary. */
|
|
112
|
+
export declare function isPmKnownExitCode(exitCode: number): exitCode is PmCommandExitCode;
|
|
113
|
+
/** Resolve an exact command contract, falling back to its declared root path. */
|
|
114
|
+
export declare function resolvePmCommandExitContract(commandPath: string): PmCommandExitContract | undefined;
|
|
115
|
+
/** Verify command coverage, observed exits, and vocabulary reachability for a replay corpus. */
|
|
116
|
+
export declare function analyzePmCommandExitConformance(observations: readonly PmCommandExitObservation[], expectedCommands?: readonly string[], contracts?: readonly PmCommandExitContract[]): PmCommandExitConformanceReport;
|
|
117
|
+
/** Derive deterministic full, empty, partial, or failed semantics for a bulk mutation. */
|
|
118
|
+
export declare function derivePmBulkMutationEffect(counts: PmBulkMutationEffectCounts): PmCommandEffectReceipt;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/command-exit-contracts
|
|
3
|
+
*
|
|
4
|
+
* Declares shell-visible command outcomes and derives effect receipts shared by
|
|
5
|
+
* CLI, SDK, MCP, packages, telemetry, and conformance gates.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
!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]="5bbc21f0-f517-571a-8ecf-45f20f0e793d")}catch(e){}}();
|
|
9
|
+
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
10
|
+
import { PM_CORE_COMMAND_NAMES } from "./enum-contracts.js";
|
|
11
|
+
/** Canonical effect vocabulary for all stable CLI process exits. */
|
|
12
|
+
export const PM_COMMAND_EXIT_OUTCOME_CONTRACTS = [
|
|
13
|
+
{
|
|
14
|
+
exit_code: EXIT_CODE.SUCCESS,
|
|
15
|
+
outcome: "effect",
|
|
16
|
+
success: true,
|
|
17
|
+
meaning: "The requested operation completed with its intended effect.",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
exit_code: EXIT_CODE.GENERIC_FAILURE,
|
|
21
|
+
outcome: "internal_failure",
|
|
22
|
+
success: false,
|
|
23
|
+
meaning: "An unexpected runtime or internal failure prevented completion.",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
exit_code: EXIT_CODE.USAGE,
|
|
27
|
+
outcome: "refused_input",
|
|
28
|
+
success: false,
|
|
29
|
+
meaning: "The invocation was refused because its input or composition was invalid.",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
exit_code: EXIT_CODE.NOT_FOUND,
|
|
33
|
+
outcome: "refused_tracker_state",
|
|
34
|
+
success: false,
|
|
35
|
+
meaning: "The requested tracker, item, or resource was not present.",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
exit_code: EXIT_CODE.CONFLICT,
|
|
39
|
+
outcome: "conflict",
|
|
40
|
+
success: false,
|
|
41
|
+
meaning: "Current state or concurrency prevented the requested effect.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
exit_code: EXIT_CODE.DEPENDENCY_FAILED,
|
|
45
|
+
outcome: "dependency_failed",
|
|
46
|
+
success: false,
|
|
47
|
+
meaning: "A required dependency operation failed.",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
exit_code: EXIT_CODE.NO_EFFECT,
|
|
51
|
+
outcome: "no_effect",
|
|
52
|
+
success: true,
|
|
53
|
+
meaning: "The request was valid and completed, but matched nothing to change.",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
exit_code: EXIT_CODE.PARTIAL_EFFECT,
|
|
57
|
+
outcome: "partial_effect",
|
|
58
|
+
success: true,
|
|
59
|
+
meaning: "The request completed and changed some, but not all, selected targets.",
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
const STANDARD_COMMAND_EXIT_CODES = [
|
|
63
|
+
EXIT_CODE.SUCCESS,
|
|
64
|
+
EXIT_CODE.GENERIC_FAILURE,
|
|
65
|
+
EXIT_CODE.USAGE,
|
|
66
|
+
EXIT_CODE.NOT_FOUND,
|
|
67
|
+
EXIT_CODE.CONFLICT,
|
|
68
|
+
EXIT_CODE.DEPENDENCY_FAILED,
|
|
69
|
+
];
|
|
70
|
+
const EFFECT_AWARE_BULK_COMMANDS = new Set(["close-many", "update-many"]);
|
|
71
|
+
/** Exhaustive core command exit declarations generated from the command registry. */
|
|
72
|
+
export const PM_COMMAND_EXIT_CONTRACTS = PM_CORE_COMMAND_NAMES.map((command) => ({
|
|
73
|
+
command,
|
|
74
|
+
exit_codes: EFFECT_AWARE_BULK_COMMANDS.has(command)
|
|
75
|
+
? [
|
|
76
|
+
...STANDARD_COMMAND_EXIT_CODES,
|
|
77
|
+
EXIT_CODE.NO_EFFECT,
|
|
78
|
+
EXIT_CODE.PARTIAL_EFFECT,
|
|
79
|
+
]
|
|
80
|
+
: [...STANDARD_COMMAND_EXIT_CODES],
|
|
81
|
+
}));
|
|
82
|
+
const COMMAND_EXIT_CONTRACT_BY_PATH = new Map(PM_COMMAND_EXIT_CONTRACTS.map((contract) => [contract.command, contract]));
|
|
83
|
+
/** Stable successful process exits, including machine-distinct effect states. */
|
|
84
|
+
export const PM_SUCCESS_EXIT_CODES = [
|
|
85
|
+
EXIT_CODE.SUCCESS,
|
|
86
|
+
EXIT_CODE.NO_EFFECT,
|
|
87
|
+
EXIT_CODE.PARTIAL_EFFECT,
|
|
88
|
+
];
|
|
89
|
+
/** Return whether an exit represents a successful command outcome. */
|
|
90
|
+
export function isPmSuccessfulExitCode(exitCode) {
|
|
91
|
+
return PM_SUCCESS_EXIT_CODES.includes(exitCode);
|
|
92
|
+
}
|
|
93
|
+
/** Return whether an exit belongs to the declared pm process vocabulary. */
|
|
94
|
+
export function isPmKnownExitCode(exitCode) {
|
|
95
|
+
return PM_COMMAND_EXIT_OUTCOME_CONTRACTS.some((contract) => contract.exit_code === exitCode);
|
|
96
|
+
}
|
|
97
|
+
/** Resolve an exact command contract, falling back to its declared root path. */
|
|
98
|
+
export function resolvePmCommandExitContract(commandPath) {
|
|
99
|
+
const normalized = commandPath
|
|
100
|
+
.trim()
|
|
101
|
+
.toLowerCase()
|
|
102
|
+
.split(/\s+/u)
|
|
103
|
+
.filter(Boolean)
|
|
104
|
+
.join(" ");
|
|
105
|
+
return (COMMAND_EXIT_CONTRACT_BY_PATH.get(normalized) ??
|
|
106
|
+
COMMAND_EXIT_CONTRACT_BY_PATH.get(normalized.split(" ")[0]));
|
|
107
|
+
}
|
|
108
|
+
/** Verify command coverage, observed exits, and vocabulary reachability for a replay corpus. */
|
|
109
|
+
export function analyzePmCommandExitConformance(observations, expectedCommands = PM_CORE_COMMAND_NAMES, contracts = PM_COMMAND_EXIT_CONTRACTS) {
|
|
110
|
+
const contractsByCommand = new Map(contracts.map((contract) => [contract.command, contract]));
|
|
111
|
+
const missingCommands = expectedCommands.filter((command) => !contractsByCommand.has(command));
|
|
112
|
+
const undeclaredObservations = observations.filter((observation) => {
|
|
113
|
+
const contract = contractsByCommand.get(observation.command) ??
|
|
114
|
+
contractsByCommand.get(observation.command.split(" ")[0]);
|
|
115
|
+
return (contract === undefined ||
|
|
116
|
+
!contract.exit_codes.includes(observation.exit_code));
|
|
117
|
+
});
|
|
118
|
+
const observedExitCodes = new Set(observations.map((entry) => entry.exit_code));
|
|
119
|
+
const declaredExitCodes = new Set(contracts.flatMap((contract) => contract.exit_codes));
|
|
120
|
+
const unreachableExitCodes = [...declaredExitCodes]
|
|
121
|
+
.filter((exitCode) => !observedExitCodes.has(exitCode))
|
|
122
|
+
.sort((left, right) => left - right);
|
|
123
|
+
return {
|
|
124
|
+
ok: missingCommands.length === 0 &&
|
|
125
|
+
undeclaredObservations.length === 0 &&
|
|
126
|
+
unreachableExitCodes.length === 0,
|
|
127
|
+
missing_commands: missingCommands,
|
|
128
|
+
undeclared_observations: undeclaredObservations,
|
|
129
|
+
unreachable_exit_codes: unreachableExitCodes,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** Derive deterministic full, empty, partial, or failed semantics for a bulk mutation. */
|
|
133
|
+
export function derivePmBulkMutationEffect(counts) {
|
|
134
|
+
if (counts.applied === 0 && counts.failed > 0) {
|
|
135
|
+
return {
|
|
136
|
+
outcome: "dependency_failed",
|
|
137
|
+
exit_code: EXIT_CODE.DEPENDENCY_FAILED,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (counts.applied === 0) {
|
|
141
|
+
return { outcome: "no_effect", exit_code: EXIT_CODE.NO_EFFECT };
|
|
142
|
+
}
|
|
143
|
+
if (counts.skipped > 0 || counts.failed > 0 || counts.unmatched > 0) {
|
|
144
|
+
return {
|
|
145
|
+
outcome: "partial_effect",
|
|
146
|
+
exit_code: EXIT_CODE.PARTIAL_EFFECT,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return { outcome: "effect", exit_code: EXIT_CODE.SUCCESS };
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=command-exit-contracts.js.map
|
|
152
|
+
//# debugId=5bbc21f0-f517-571a-8ecf-45f20f0e793d
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* a hand-picked test list.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!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]="
|
|
10
|
+
!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]="0fd4d2b0-725f-53ed-8b2b-2eeb19406cb7")}catch(e){}}();
|
|
11
11
|
import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
|
|
12
12
|
import { resolveSubcommandFlagContractsForCommand, } from "./flag-contracts.js";
|
|
13
13
|
import { pmToolActionParameterKeys } from "./tool-schema.js";
|
|
14
|
-
import { PM_READ_OUTPUT_OPTION_FLAGS, resolveReadOutputSurface, } from "../read-output-contracts.js";
|
|
14
|
+
import { PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS, PM_READ_OUTPUT_OPTION_FLAGS, resolveReadOutputSurface, } from "../read-output-contracts.js";
|
|
15
15
|
const CLI_TRANSPORT_FLAGS = new Set([
|
|
16
16
|
"--author",
|
|
17
17
|
"--follow",
|
|
@@ -22,6 +22,7 @@ const CLI_TRANSPORT_FLAGS = new Set([
|
|
|
22
22
|
"--output-limit",
|
|
23
23
|
"--output-budget",
|
|
24
24
|
"--output-format",
|
|
25
|
+
"--output-session",
|
|
25
26
|
"--no-changed-fields",
|
|
26
27
|
"--no-extensions",
|
|
27
28
|
"--no-pager",
|
|
@@ -30,7 +31,10 @@ const CLI_TRANSPORT_FLAGS = new Set([
|
|
|
30
31
|
"--quiet",
|
|
31
32
|
"--interval-ms",
|
|
32
33
|
]);
|
|
33
|
-
const READ_OUTPUT_OPTION_FLAGS = new Set(
|
|
34
|
+
const READ_OUTPUT_OPTION_FLAGS = new Set([
|
|
35
|
+
...PM_READ_OUTPUT_OPTION_FLAGS,
|
|
36
|
+
...PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,
|
|
37
|
+
]);
|
|
34
38
|
const CLI_PRESENTATION_FLAGS = new Set([
|
|
35
39
|
"--brief",
|
|
36
40
|
"--format",
|
|
@@ -116,7 +120,9 @@ const ACTION_FLAG_PARAMETER_OVERRIDES = {
|
|
|
116
120
|
},
|
|
117
121
|
files: { "--note": "addNote" },
|
|
118
122
|
docs: { "--note": "addNote" },
|
|
119
|
-
|
|
123
|
+
comments: { "--full-history": "full" },
|
|
124
|
+
notes: { "--file": "text", "--full-history": "full" },
|
|
125
|
+
learnings: { "--full-history": "full" },
|
|
120
126
|
gc: { "--scope": "gcScope" },
|
|
121
127
|
contracts: { "--action": "contractAction" },
|
|
122
128
|
schema: {
|
|
@@ -137,6 +143,27 @@ const ACTION_FLAG_PARAMETER_OVERRIDES = {
|
|
|
137
143
|
package: { "--gh": "github", "--scaffold": "init" },
|
|
138
144
|
install: { "--gh": "github" },
|
|
139
145
|
};
|
|
146
|
+
const ACTION_STRUCTURED_FLAG_PARAMETERS = {
|
|
147
|
+
stats: {
|
|
148
|
+
"--analytics": [
|
|
149
|
+
"measurements",
|
|
150
|
+
"metric",
|
|
151
|
+
"measurementLimit",
|
|
152
|
+
"observe",
|
|
153
|
+
"improvementDirection",
|
|
154
|
+
"measurementSource",
|
|
155
|
+
"measurementItem",
|
|
156
|
+
"measurementRevision",
|
|
157
|
+
"author",
|
|
158
|
+
"message",
|
|
159
|
+
"provenanceCoverage",
|
|
160
|
+
"fleetAttribution",
|
|
161
|
+
"since",
|
|
162
|
+
"eventLimit",
|
|
163
|
+
"minimumSample",
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
};
|
|
140
167
|
function actionCommand(action) {
|
|
141
168
|
if (action.startsWith("extension-")) {
|
|
142
169
|
return `extension ${action.slice("extension-".length)}`;
|
|
@@ -168,6 +195,17 @@ function aliasTarget(flag, contracts) {
|
|
|
168
195
|
return contracts.find(({ aliases }) => aliases?.includes(flag))?.flag;
|
|
169
196
|
}
|
|
170
197
|
function classifyCliInput(action, contract, contracts, sdkParameters) {
|
|
198
|
+
const structuredParameters = ACTION_STRUCTURED_FLAG_PARAMETERS[action]?.[contract.flag];
|
|
199
|
+
if (structuredParameters !== undefined &&
|
|
200
|
+
structuredParameters.every((parameter) => sdkParameters.has(parameter))) {
|
|
201
|
+
return {
|
|
202
|
+
surface: "cli",
|
|
203
|
+
input: contract.flag,
|
|
204
|
+
counterpart: structuredParameters[0],
|
|
205
|
+
disposition: "shared",
|
|
206
|
+
reason: "The validated CLI JSON object fans out across strict SDK parameters.",
|
|
207
|
+
};
|
|
208
|
+
}
|
|
171
209
|
const parameter = parameterForFlag(action, contract.flag);
|
|
172
210
|
if (sdkParameters.has(parameter)) {
|
|
173
211
|
return {
|
|
@@ -242,6 +280,17 @@ function classifyCliInput(action, contract, contracts, sdkParameters) {
|
|
|
242
280
|
};
|
|
243
281
|
}
|
|
244
282
|
function classifySdkInput(action, parameter, cliEntries) {
|
|
283
|
+
const structuredCounterpart = Object.entries(ACTION_STRUCTURED_FLAG_PARAMETERS[action] ?? {}).find(([flag, parameters]) => parameters.includes(parameter) &&
|
|
284
|
+
cliEntries.some(({ input, disposition }) => input === flag && disposition === "shared"));
|
|
285
|
+
if (structuredCounterpart !== undefined) {
|
|
286
|
+
return {
|
|
287
|
+
surface: "sdk",
|
|
288
|
+
input: parameter,
|
|
289
|
+
counterpart: structuredCounterpart[0],
|
|
290
|
+
disposition: "shared",
|
|
291
|
+
reason: "The strict SDK parameter is reachable through the validated CLI JSON object.",
|
|
292
|
+
};
|
|
293
|
+
}
|
|
245
294
|
const cliCounterpart = cliEntries.find(({ counterpart, disposition }) => counterpart === parameter &&
|
|
246
295
|
(disposition === "shared" ||
|
|
247
296
|
disposition === "compatibility_alias" ||
|
|
@@ -317,4 +366,4 @@ export function analyzeSdkCliParameterCompleteness(source = {}) {
|
|
|
317
366
|
});
|
|
318
367
|
}
|
|
319
368
|
//# sourceMappingURL=completeness.js.map
|
|
320
|
-
//# debugId=
|
|
369
|
+
//# debugId=0fd4d2b0-725f-53ed-8b2b-2eeb19406cb7
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!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]="
|
|
10
|
+
!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]="932a6144-c4b4-5153-b8ff-0ef29e308bd0")}catch(e){}}();
|
|
11
11
|
import { normalizeUniqueStringList } from "./string-lists.js";
|
|
12
12
|
import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
|
|
13
13
|
function normalizeFlagAliasKey(flag) {
|
|
@@ -222,6 +222,7 @@ export const COMMENTS_FLAG_CONTRACTS = [
|
|
|
222
222
|
{ flag: "--edit" },
|
|
223
223
|
{ flag: "--delete" },
|
|
224
224
|
{ flag: "--limit" },
|
|
225
|
+
{ flag: "--full-history" },
|
|
225
226
|
{ flag: "--author" },
|
|
226
227
|
{ flag: "--message" },
|
|
227
228
|
{ flag: "--force" },
|
|
@@ -243,6 +244,7 @@ export const NOTES_FLAG_CONTRACTS = [
|
|
|
243
244
|
{ flag: "--since" },
|
|
244
245
|
{ flag: "--event-type" },
|
|
245
246
|
{ flag: "--include-meta" },
|
|
247
|
+
{ flag: "--full-history" },
|
|
246
248
|
{ flag: "--author" },
|
|
247
249
|
{ flag: "--message" },
|
|
248
250
|
{ flag: "--force" },
|
|
@@ -251,6 +253,7 @@ export const NOTES_FLAG_CONTRACTS = [
|
|
|
251
253
|
export const LEARNINGS_FLAG_CONTRACTS = [
|
|
252
254
|
{ flag: "--add", aliases: ["--learning"] },
|
|
253
255
|
{ flag: "--limit" },
|
|
256
|
+
{ flag: "--full-history" },
|
|
254
257
|
{ flag: "--author" },
|
|
255
258
|
{ flag: "--message" },
|
|
256
259
|
{ flag: "--force" },
|
|
@@ -911,6 +914,7 @@ export const STATS_FLAG_CONTRACTS = [
|
|
|
911
914
|
{ flag: "--by-tag" },
|
|
912
915
|
{ flag: "--by-priority" },
|
|
913
916
|
{ flag: "--tag-prefix" },
|
|
917
|
+
{ flag: "--analytics" },
|
|
914
918
|
];
|
|
915
919
|
/** Public contract for duplicate-cluster discovery flags. */
|
|
916
920
|
export const DUPLICATES_FLAG_CONTRACTS = [
|
|
@@ -1751,4 +1755,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
|
|
|
1751
1755
|
return normalizeUniqueStringList(all).join(" ");
|
|
1752
1756
|
}
|
|
1753
1757
|
//# sourceMappingURL=flag-contracts.js.map
|
|
1754
|
-
//# debugId=
|
|
1758
|
+
//# debugId=932a6144-c4b4-5153-b8ff-0ef29e308bd0
|