@unbrained/pm-cli 2026.8.21 → 2026.8.23
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 +44 -0
- package/dist/cli/error-guidance.d.ts +22 -4
- package/dist/cli/error-guidance.js +73 -16
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +51 -9
- package/dist/cli/register-mutation.js +6 -6
- package/dist/cli/register-operations.d.ts +73 -0
- package/dist/cli/register-operations.js +39 -14
- package/dist/cli/register-setup.js +3 -3
- package/dist/cli/schema-registration-helpers.d.ts +8 -1
- package/dist/cli/schema-registration-helpers.js +14 -5
- package/dist/cli-bundle/bundle-manifest.json +149 -149
- package/dist/cli-bundle/chunks/chunk-3ENVHX6C.js +36 -0
- package/dist/cli-bundle/chunks/{chunk-LOVTQ52Z.js → chunk-DW2CGEMU.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-EG6CLDZT.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-LARJJ3RK.js → chunk-F3AI2JFL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-N3DSV4CH.js → chunk-HWZ6CELB.js} +8 -8
- package/dist/cli-bundle/chunks/chunk-HZBMLSZI.js +201 -0
- package/dist/cli-bundle/chunks/chunk-JB4KZWBF.js +3 -0
- package/dist/cli-bundle/chunks/chunk-KPH73XXJ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-BKYB45NQ.js → chunk-KXPMB2YL.js} +50 -50
- package/dist/cli-bundle/chunks/{chunk-BUNIEJNE.js → chunk-QDVHNHAQ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TFI5V5N2.js +13 -0
- package/dist/cli-bundle/chunks/{register-list-query-F57EWDEF.js → register-list-query-UJB5FMV2.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-NX5XE4VX.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-RXIJIYXC.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-HXU7IZZD.js → register-setup-GFUZEKRE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-F4YEW5I2.js → chunk-37Z4OEAP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3UPTYG44.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-5S7E72FY.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4ERLO7QD.js → chunk-AUFH5H35.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-E7X25GC3.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FQCSTBWE.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FH6DYED3.js → chunk-FZS4H32O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-IFLWKY2R.js +156 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YKBKIEAJ.js → chunk-JOWDB2MH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-LYVSW5VM.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MRCNF3U6.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-UZE7XUZK.js → chunk-OFVUGTLJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FJ22HNRP.js → chunk-OGLQBL46.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-OY7QAV4Y.js +51 -0
- package/dist/cli-bundle/focused-chunks/chunk-QGFNI65N.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KDNG7TKQ.js → chunk-R27IDGHD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-UYRFYCDQ.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2NIY5NKG.js → chunk-ZHVA42R5.js} +9 -9
- package/dist/cli-bundle/main.js +13 -13
- 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 +40 -40
- 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 +33 -32
- 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 +5 -5
- package/dist/core/config/nested-settings.js +8 -2
- package/dist/core/config/positional-value.d.ts +1 -1
- package/dist/core/config/positional-value.js +5 -2
- package/dist/core/extensions/extension-hook-runtime.js +22 -20
- package/dist/core/extensions/extension-types.d.ts +8 -1
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/loader.js +7 -3
- package/dist/core/extensions/service-ownership.d.ts +8 -0
- package/dist/core/extensions/service-ownership.js +20 -0
- package/dist/core/history/history.js +3 -3
- package/dist/core/item/id.js +20 -5
- package/dist/core/item/item-format.js +81 -2
- package/dist/core/reproducibility/context.d.ts +4 -0
- package/dist/core/reproducibility/context.js +14 -8
- package/dist/core/shared/author.d.ts +55 -1
- package/dist/core/shared/author.js +333 -16
- package/dist/core/shared/constants.js +3 -2
- package/dist/core/shared/errors.d.ts +4 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/settings-validator.d.ts +1 -0
- package/dist/core/store/settings-validator.js +6 -3
- package/dist/core/store/settings.js +5 -2
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +30 -9
- package/dist/sdk/agent/identity-config.d.ts +63 -0
- package/dist/sdk/agent/identity-config.js +107 -0
- package/dist/sdk/agent/refusal-corpus-contracts.d.ts +76 -0
- package/dist/sdk/agent/refusal-corpus-contracts.js +194 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +2 -2
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
- package/dist/sdk/cli-contracts/agent-output-contracts.js +326 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -0
- package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
- package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +4 -4
- package/dist/sdk/cli-contracts/registration-helpers.js +5 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +22 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +14 -3
- package/dist/sdk/cli-contracts.d.ts +4 -4
- package/dist/sdk/cli-contracts.js +5 -5
- package/dist/sdk/config.d.ts +6 -1
- package/dist/sdk/config.js +119 -14
- package/dist/sdk/context-intent-contracts.js +4 -2
- package/dist/sdk/core-governance.d.ts +1 -1
- package/dist/sdk/core-governance.js +3 -3
- package/dist/sdk/extension/install-sources.d.ts +1 -1
- package/dist/sdk/extension/install-sources.js +6 -3
- package/dist/sdk/extension/output-ownership.d.ts +1 -0
- package/dist/sdk/extension/output-ownership.js +3 -2
- package/dist/sdk/extension/scaffold.js +11 -5
- package/dist/sdk/flag-invocation-contracts.js +4 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +74 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +87 -26
- package/dist/sdk/governance/assurance-action.js +30 -10
- package/dist/sdk/governance/health.d.ts +3 -0
- package/dist/sdk/governance/health.js +39 -7
- package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
- package/dist/sdk/governance/hierarchy-validation.js +109 -0
- package/dist/sdk/governance/validate.d.ts +3 -9
- package/dist/sdk/governance/validate.js +84 -111
- package/dist/sdk/graph/assembly.d.ts +6 -1
- package/dist/sdk/graph/assembly.js +16 -22
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance-contracts.js +8 -2
- package/dist/sdk/graph/governance.js +46 -2
- package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
- package/dist/sdk/graph/hierarchy-integrity.js +311 -0
- package/dist/sdk/graph/index.d.ts +2 -1
- package/dist/sdk/graph/index.js +3 -2
- package/dist/sdk/graph/remediation.js +32 -2
- package/dist/sdk/graph/run.d.ts +31 -2
- package/dist/sdk/graph/run.js +80 -31
- package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
- package/dist/sdk/index.d.ts +8 -3
- package/dist/sdk/index.js +9 -4
- package/dist/sdk/item-children.js +21 -8
- package/dist/sdk/lifecycle/create.js +129 -97
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +15 -0
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
- package/dist/sdk/lifecycle/update.d.ts +2 -0
- package/dist/sdk/lifecycle/update.js +174 -84
- package/dist/sdk/merge/three-way.js +105 -26
- package/dist/sdk/query/complete-list.d.ts +3 -3
- package/dist/sdk/query/complete-list.js +46 -3
- package/dist/sdk/query/list.d.ts +4 -3
- package/dist/sdk/query/list.js +89 -49
- package/dist/sdk/read-output-budget.d.ts +21 -0
- package/dist/sdk/read-output-budget.js +39 -2
- package/dist/sdk/read-output-contracts.d.ts +10 -4
- package/dist/sdk/read-output-contracts.js +105 -32
- package/dist/sdk/relationship-context.js +3 -4
- package/dist/sdk/relationships.js +17 -10
- package/dist/sdk/reproducibility/process.d.ts +19 -0
- package/dist/sdk/reproducibility/process.js +88 -0
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.d.ts +3 -2
- package/dist/sdk/runtime.js +7 -5
- package/dist/sdk/test/batch.d.ts +6 -0
- package/dist/sdk/test/batch.js +26 -6
- package/dist/sdk/test/entry.d.ts +1 -1
- package/dist/sdk/test/entry.js +3 -2
- package/dist/sdk/test/execution.d.ts +28 -3
- package/dist/sdk/test/execution.js +201 -34
- package/dist/sdk/test/parsers.d.ts +6 -0
- package/dist/sdk/test/parsers.js +21 -2
- package/dist/sdk/test/trust.d.ts +33 -0
- package/dist/sdk/test/trust.js +207 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_PROVENANCE_ADR.md +41 -5
- package/docs/AGENT_UX_CONTRACTS.md +20 -4
- package/docs/COMMANDS.md +29 -14
- package/docs/CONFIGURATION.md +4 -0
- package/docs/DEPENDENCY_KIND_CONTRACT.md +31 -3
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +115 -0
- package/docs/EXTENSIONS.md +2 -1
- package/docs/MERGE_SAFETY.md +15 -1
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +19 -2
- package/docs/RELATIONSHIP_GRAPH.md +6 -3
- package/docs/REPRODUCIBLE_WORKSPACES.md +42 -8
- package/docs/SDK.md +9 -0
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +6 -4
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +1 -1
- package/docs/TESTING.md +83 -1
- package/docs/agent-task-token-baseline.json +2 -2
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
- package/marketplace.json +2 -2
- package/package.json +2 -2
- 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 +1021 -53
- package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +0 -197
- package/dist/cli-bundle/chunks/chunk-3AFAUHUE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7VHZS727.js +0 -5
- package/dist/cli-bundle/chunks/chunk-JSLOFXGA.js +0 -3
- package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +0 -35
- package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +0 -13
- package/dist/cli-bundle/chunks/register-mutation-7IY2D5KO.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-FALL3YTU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +0 -50
- package/dist/cli-bundle/focused-chunks/chunk-CKKQSJNN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-F2A56DHV.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JEAVFOWM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TJ7EMJ46.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-ZOSEELYJ.js +0 -26
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
|
|
9
|
-
"version": "2026.8.
|
|
9
|
+
"version": "2026.8.23"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "pm-claude",
|
|
14
14
|
"source": "./plugins/pm-claude",
|
|
15
15
|
"description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
|
|
16
|
-
"version": "2026.8.
|
|
16
|
+
"version": "2026.8.23",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "unbrained",
|
|
19
19
|
"url": "https://github.com/unbraind/pm-cli"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.8.23 - 2026-08-23
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Every instruction the product emits about its own next command is an unexecuted claim: the recovery vocabulary is generated, asserted as text, and run by nothing ([pm-h8tpeh](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-h8tpeh.toon))
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Update ESLint to compatible 10.9.0 release ([pm-940mcx](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-940mcx.toon))
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Allow linked tests to opt out of source-workspace injection for self-sandboxing repo-wide gates ([pm-efkvdy](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-efkvdy.toon))
|
|
16
|
+
- Linked-test schema context changes non-PM repository checks, so commands that pass directly fail when recorded and run through pm test ([pm-e97jyf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-e97jyf.toon))
|
|
17
|
+
- GH-1089: expose reproducible execution through supported CLI and MCP process configuration ([pm-gh1089](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1089.toon))
|
|
18
|
+
- Budget recovery can recommend a smaller ceiling than the request that already truncated ([pm-xam9bt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-xam9bt.toon))
|
|
19
|
+
|
|
20
|
+
### Security
|
|
21
|
+
|
|
22
|
+
- Linked-test commands are merge-unioned workspace data executed with shell:true — no provenance, allowlist, or confirmation boundary ([pm-ed28wi](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ed28wi.toon))
|
|
23
|
+
- Cross-harness provenance adapters: automatically resolve native model, version, and effort signals beyond Claude without identity flags ([pm-c0lrdm](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-c0lrdm.toon))
|
|
24
|
+
|
|
25
|
+
### Other
|
|
26
|
+
|
|
27
|
+
- Cross-process reproducibility gate: prove CLI and MCP deterministic runs are byte-identical and fail on ambient time leaks ([pm-vklr99](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-vklr99.toon))
|
|
28
|
+
- Expose agent probe controls and versioned legacy-author vocabulary through pm config and SDK mutation APIs ([pm-yds9dt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-yds9dt.toon))
|
|
29
|
+
- Diagnostic output budget: errors, warnings, and recovery bundles are the output an agent reads most and the only output with no declared ceiling ([pm-cha95z](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-cha95z.toon))
|
|
30
|
+
|
|
31
|
+
## 2026.8.22 - 2026-08-22
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- GH-1078: Complete-list certification accepts absent or contradictory truth receipts and emits stale recovery ([pm-gh1078](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1078.toon))
|
|
36
|
+
- GH-1076: read-only duplicates rejects universal JSON output controls ([pm-gh1076](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1076.toon))
|
|
37
|
+
- GH-1074: package doctor cannot distinguish a safe declining service override from a global interceptor ([pm-gh1074](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1074.toon))
|
|
38
|
+
- GH-1073: pm init accepts a whitespace id prefix that makes later creates fail ([pm-gh1073](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1073.toon))
|
|
39
|
+
- GH-1075: Windows Node 24 nightly validation failed at main 3e7ac007 ([pm-gh1075](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1075.toon))
|
|
40
|
+
- The child hierarchy kind has an unenforced direction and cardinality: 7 of 15 rows are inverted against the registry's own declaration and no channel, validator, or audit finding notices ([pm-vk7zek](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-vk7zek.toon))
|
|
41
|
+
- Hierarchy-canonicalizing dependency kinds bypass every cycle detector: mutual child_of edges leave the graph provably inconsistent while validate, health, and graph analyze all report acyclic ([pm-rggtvd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-rggtvd.toon))
|
|
42
|
+
|
|
43
|
+
### Security
|
|
44
|
+
|
|
45
|
+
- GH-1072: pm install leaks user allow-scripts config into isolated package installs ([pm-gh1072](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1072.toon))
|
|
46
|
+
|
|
3
47
|
## 2026.8.21 - 2026-08-21
|
|
4
48
|
|
|
5
49
|
### Added
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Provides CLI runtime support for Error Guidance.
|
|
5
5
|
*/
|
|
6
6
|
import { type PmCliErrorContext, type PmCliErrorRecoveryPayload } from "../sdk/runtime-primitives.js";
|
|
7
|
+
import { type PmDiagnosticOutputReceipt, type PmProjectedDiagnostic } from "../sdk/cli-contracts/agent-output-contracts.js";
|
|
7
8
|
interface GuidanceMessage {
|
|
8
9
|
code: string;
|
|
9
10
|
type: string;
|
|
@@ -20,6 +21,17 @@ interface GuidanceMessage {
|
|
|
20
21
|
availableDependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
|
|
21
22
|
recovery?: PmCliErrorRecoveryPayload;
|
|
22
23
|
}
|
|
24
|
+
/** Compact refusal identity embedded in every structured error envelope. */
|
|
25
|
+
export interface PmRefusalEnvelope {
|
|
26
|
+
/** Command, flag, or missing operand that rejected the invocation. */
|
|
27
|
+
surface: string;
|
|
28
|
+
/** Supplied scalar rejected by a closed domain, when available. */
|
|
29
|
+
rejected_value?: string;
|
|
30
|
+
/** Complete legal domain advertised by the refusal, when applicable. */
|
|
31
|
+
legal_domain?: string[];
|
|
32
|
+
/** Process exit code paired with the refusal. */
|
|
33
|
+
exit_code: number;
|
|
34
|
+
}
|
|
23
35
|
/** Documents the json error envelope payload exchanged by command, SDK, and package integrations. */
|
|
24
36
|
export interface JsonErrorEnvelope {
|
|
25
37
|
/** Schema type that determines the shape and validation rules for this value. */
|
|
@@ -52,9 +64,15 @@ export interface JsonErrorEnvelope {
|
|
|
52
64
|
available_dependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
|
|
53
65
|
/** Value that configures or reports recovery for this contract. */
|
|
54
66
|
recovery?: PmCliErrorRecoveryPayload;
|
|
67
|
+
/** Stable compact identity of the failing surface and legal recovery domain. */
|
|
68
|
+
refusal: PmRefusalEnvelope;
|
|
69
|
+
/** Binding output-budget receipt for this diagnostic. */
|
|
70
|
+
diagnostic_output?: PmDiagnosticOutputReceipt;
|
|
55
71
|
}
|
|
72
|
+
/** Error envelope after deterministic budget projection. */
|
|
73
|
+
export type ProjectedJsonErrorEnvelope = PmProjectedDiagnostic<JsonErrorEnvelope>;
|
|
56
74
|
/** Compact an error envelope to fields that change the caller's next action. */
|
|
57
|
-
export declare function projectLeanErrorEnvelope(envelope:
|
|
75
|
+
export declare function projectLeanErrorEnvelope(envelope: ProjectedJsonErrorEnvelope): ProjectedJsonErrorEnvelope;
|
|
58
76
|
/** Documents the error classification payload exchanged by command, SDK, and package integrations. */
|
|
59
77
|
export interface ErrorClassification {
|
|
60
78
|
/** Schema type that determines the shape and validation rules for this value. */
|
|
@@ -149,15 +167,15 @@ export declare function formatPmCliErrorForDisplay(rawMessage: string, context?:
|
|
|
149
167
|
/** Implements classify pm cli error for the public runtime surface of this module. */
|
|
150
168
|
export declare function classifyPmCliError(rawMessage: string, context?: PmCliErrorContext): ErrorClassification;
|
|
151
169
|
/** Implements format pm cli error for json for the public runtime surface of this module. */
|
|
152
|
-
export declare function formatPmCliErrorForJson(rawMessage: string, exitCode: number, context?: PmCliErrorContext):
|
|
170
|
+
export declare function formatPmCliErrorForJson(rawMessage: string, exitCode: number, context?: PmCliErrorContext): ProjectedJsonErrorEnvelope;
|
|
153
171
|
/** Implements format commander error for display for the public runtime surface of this module. */
|
|
154
172
|
export declare function formatCommanderErrorForDisplay(rawMessage: string, commandName: string | undefined, allowedTypes: string, context?: CommanderGuidanceContext): string;
|
|
155
173
|
/** Implements classify commander error for the public runtime surface of this module. */
|
|
156
174
|
export declare function classifyCommanderError(rawMessage: string, commandName: string | undefined, allowedTypes: string, context?: CommanderGuidanceContext): ErrorClassification;
|
|
157
175
|
/** Implements format commander error for json for the public runtime surface of this module. */
|
|
158
|
-
export declare function formatCommanderErrorForJson(rawMessage: string, commandName: string | undefined, allowedTypes: string, exitCode: number, context?: CommanderGuidanceContext):
|
|
176
|
+
export declare function formatCommanderErrorForJson(rawMessage: string, commandName: string | undefined, allowedTypes: string, exitCode: number, context?: CommanderGuidanceContext): ProjectedJsonErrorEnvelope;
|
|
159
177
|
/** Implements format unknown error for json for the public runtime surface of this module. */
|
|
160
|
-
export declare function formatUnknownErrorForJson(rawMessage: string, exitCode: number):
|
|
178
|
+
export declare function formatUnknownErrorForJson(rawMessage: string, exitCode: number): ProjectedJsonErrorEnvelope;
|
|
161
179
|
/** Implements classify unknown error for the public runtime surface of this module. */
|
|
162
180
|
export declare function classifyUnknownError(rawMessage: string): ErrorClassification;
|
|
163
181
|
/** Public contract for test only, shared by SDK and presentation-layer consumers. */
|
|
@@ -1,11 +1,12 @@
|
|
|
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]="4bdb7fcf-dd74-57bc-8a0e-07539095462e")}catch(e){}}();
|
|
3
3
|
import { resolveRecoveryCommandName } from "../sdk/agent/command-recovery.js";
|
|
4
|
+
import { projectPmDiagnosticOutput, projectPmDiagnosticText, } from "../sdk/cli-contracts/agent-output-contracts.js";
|
|
4
5
|
import { renderPmCommand } from "./argv-utils.js";
|
|
5
6
|
import { discoverNearbyPmRoot } from "../sdk/tracker-root-discovery.js";
|
|
6
7
|
/** Compact an error envelope to fields that change the caller's next action. */
|
|
7
8
|
export function projectLeanErrorEnvelope(envelope) {
|
|
8
|
-
const {
|
|
9
|
+
const { why: _why, title: _title, ...actionable } = envelope;
|
|
9
10
|
return actionable;
|
|
10
11
|
}
|
|
11
12
|
// JSON/classification payloads are consumed heavily by agents; suppress common
|
|
@@ -249,12 +250,14 @@ export function renderGuidanceMessage(message) {
|
|
|
249
250
|
const lines = [
|
|
250
251
|
`Error: ${message.title}`,
|
|
251
252
|
"",
|
|
252
|
-
"What happened:",
|
|
253
|
-
` ${message.happened}`,
|
|
254
|
-
"",
|
|
255
253
|
"What is required:",
|
|
256
254
|
` ${message.required}`,
|
|
257
255
|
];
|
|
256
|
+
if (message.nextSteps && message.nextSteps.length > 0) {
|
|
257
|
+
lines.push("");
|
|
258
|
+
lines.push(...renderList("Next steps:", message.nextSteps));
|
|
259
|
+
}
|
|
260
|
+
lines.push("", "What happened:", ` ${message.happened}`);
|
|
258
261
|
if (message.why) {
|
|
259
262
|
lines.push("", "Why:");
|
|
260
263
|
lines.push(` ${message.why}`);
|
|
@@ -263,10 +266,6 @@ export function renderGuidanceMessage(message) {
|
|
|
263
266
|
lines.push("");
|
|
264
267
|
lines.push(...renderList("Examples:", message.examples));
|
|
265
268
|
}
|
|
266
|
-
if (message.nextSteps && message.nextSteps.length > 0) {
|
|
267
|
-
lines.push("");
|
|
268
|
-
lines.push(...renderList("Next steps:", message.nextSteps));
|
|
269
|
-
}
|
|
270
269
|
if (message.verificationErrors && message.verificationErrors.length > 0) {
|
|
271
270
|
lines.push("");
|
|
272
271
|
lines.push(...renderList("Verification errors:", message.verificationErrors));
|
|
@@ -305,6 +304,42 @@ function attachStructuredGuidanceDetails(payload, message) {
|
|
|
305
304
|
}
|
|
306
305
|
return payload;
|
|
307
306
|
}
|
|
307
|
+
function resolveRefusalCandidateFlag(message, normalizedArgs) {
|
|
308
|
+
if (message.flag)
|
|
309
|
+
return message.flag;
|
|
310
|
+
return message.recovery?.provided_fields?.find((field) => field !== "--json" &&
|
|
311
|
+
field !== "--quiet" &&
|
|
312
|
+
normalizedArgs.includes(field));
|
|
313
|
+
}
|
|
314
|
+
function resolveRefusalRejectedValue(message, normalizedArgs, candidateFlag) {
|
|
315
|
+
if (message.value !== undefined)
|
|
316
|
+
return message.value;
|
|
317
|
+
if (candidateFlag) {
|
|
318
|
+
return normalizedArgs[normalizedArgs.indexOf(candidateFlag) + 1];
|
|
319
|
+
}
|
|
320
|
+
const allowedValues = message.recovery?.allowed_values;
|
|
321
|
+
if (!allowedValues?.length)
|
|
322
|
+
return undefined;
|
|
323
|
+
return normalizedArgs.find((argument, index) => index > 0 &&
|
|
324
|
+
!argument.startsWith("-") &&
|
|
325
|
+
!allowedValues.includes(argument));
|
|
326
|
+
}
|
|
327
|
+
function buildRefusalEnvelope(message, exitCode) {
|
|
328
|
+
const normalizedArgs = message.recovery?.normalized_args ?? [];
|
|
329
|
+
const candidateFlag = resolveRefusalCandidateFlag(message, normalizedArgs);
|
|
330
|
+
const rejectedValue = resolveRefusalRejectedValue(message, normalizedArgs, candidateFlag);
|
|
331
|
+
return {
|
|
332
|
+
surface: candidateFlag ??
|
|
333
|
+
message.recovery?.missing?.[0] ??
|
|
334
|
+
inferCommandNameFromRecovery(message.recovery) ??
|
|
335
|
+
"command",
|
|
336
|
+
...(rejectedValue !== undefined ? { rejected_value: rejectedValue } : {}),
|
|
337
|
+
...(message.recovery?.allowed_values?.length
|
|
338
|
+
? { legal_domain: message.recovery.allowed_values }
|
|
339
|
+
: {}),
|
|
340
|
+
exit_code: exitCode,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
308
343
|
function guidanceToJsonEnvelope(message, exitCode) {
|
|
309
344
|
return attachStructuredGuidanceDetails({
|
|
310
345
|
type: message.type,
|
|
@@ -313,8 +348,20 @@ function guidanceToJsonEnvelope(message, exitCode) {
|
|
|
313
348
|
detail: message.happened,
|
|
314
349
|
required: message.required,
|
|
315
350
|
exit_code: exitCode,
|
|
351
|
+
refusal: buildRefusalEnvelope(message, exitCode),
|
|
316
352
|
}, message);
|
|
317
353
|
}
|
|
354
|
+
function projectJsonErrorGuidance(guidance, exitCode) {
|
|
355
|
+
const recovery = guidance.recovery;
|
|
356
|
+
const hasActionableRecovery = Boolean(recovery?.suggested_retry) ||
|
|
357
|
+
Boolean(recovery?.suggested_retry_args?.length) ||
|
|
358
|
+
Boolean(recovery?.allowed_values?.length) ||
|
|
359
|
+
Boolean(recovery?.candidate_commands?.length) ||
|
|
360
|
+
Boolean(guidance.nextSteps?.length);
|
|
361
|
+
return projectPmDiagnosticOutput(guidanceToJsonEnvelope(guidance, exitCode), {
|
|
362
|
+
diagnosticClass: hasActionableRecovery ? "recovery_bundle" : "error",
|
|
363
|
+
});
|
|
364
|
+
}
|
|
318
365
|
function guidanceToClassification(message) {
|
|
319
366
|
return attachStructuredGuidanceDetails({
|
|
320
367
|
type: message.type,
|
|
@@ -416,7 +463,10 @@ function applyPmCliErrorContext(guidance, rawMessage, context) {
|
|
|
416
463
|
const fallbackTitle = guidance.code === "command_failed" && context.code
|
|
417
464
|
? buildFallbackTitleFromMessage(normalizedRawMessage)
|
|
418
465
|
: undefined;
|
|
419
|
-
const
|
|
466
|
+
const contextRecovery = normalizeRecoveryPayload(context.recovery);
|
|
467
|
+
const recovery = contextRecovery && guidance.recovery
|
|
468
|
+
? normalizeRecoveryPayload({ ...guidance.recovery, ...contextRecovery })
|
|
469
|
+
: (contextRecovery ?? guidance.recovery);
|
|
420
470
|
return {
|
|
421
471
|
...guidance,
|
|
422
472
|
code,
|
|
@@ -601,6 +651,10 @@ function buildInvalidArgumentGuidance(rawMessage, message, context) {
|
|
|
601
651
|
? `pm ${commandName} --help`
|
|
602
652
|
: "pm <command> --help";
|
|
603
653
|
const allowedValues = inferAllowedValuesFromMessage(message);
|
|
654
|
+
const enrichedRecovery = normalizeRecoveryPayload({
|
|
655
|
+
...recovery,
|
|
656
|
+
allowed_values: recovery?.allowed_values ?? allowedValues,
|
|
657
|
+
});
|
|
604
658
|
const retryExample = buildAllowedValueRetryCommand(recovery, allowedValues);
|
|
605
659
|
const examples = retryExample
|
|
606
660
|
? [retryExample, helpExample]
|
|
@@ -621,6 +675,7 @@ function buildInvalidArgumentGuidance(rawMessage, message, context) {
|
|
|
621
675
|
why: "Validation protects data consistency and deterministic behavior across commands.",
|
|
622
676
|
examples,
|
|
623
677
|
nextSteps,
|
|
678
|
+
recovery: enrichedRecovery,
|
|
624
679
|
}), rawMessage, context);
|
|
625
680
|
}
|
|
626
681
|
function buildPmCliErrorGuidance(rawMessage, context) {
|
|
@@ -1164,7 +1219,8 @@ function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, cont
|
|
|
1164
1219
|
}
|
|
1165
1220
|
/** Implements format pm cli error for display for the public runtime surface of this module. */
|
|
1166
1221
|
export function formatPmCliErrorForDisplay(rawMessage, context) {
|
|
1167
|
-
|
|
1222
|
+
const guidance = buildPmCliErrorGuidance(rawMessage, context);
|
|
1223
|
+
return projectPmDiagnosticText(renderGuidanceMessage(guidance), guidance.required).output;
|
|
1168
1224
|
}
|
|
1169
1225
|
/** Implements classify pm cli error for the public runtime surface of this module. */
|
|
1170
1226
|
export function classifyPmCliError(rawMessage, context) {
|
|
@@ -1172,11 +1228,12 @@ export function classifyPmCliError(rawMessage, context) {
|
|
|
1172
1228
|
}
|
|
1173
1229
|
/** Implements format pm cli error for json for the public runtime surface of this module. */
|
|
1174
1230
|
export function formatPmCliErrorForJson(rawMessage, exitCode, context) {
|
|
1175
|
-
return
|
|
1231
|
+
return projectJsonErrorGuidance(buildPmCliErrorGuidance(rawMessage, context), exitCode);
|
|
1176
1232
|
}
|
|
1177
1233
|
/** Implements format commander error for display for the public runtime surface of this module. */
|
|
1178
1234
|
export function formatCommanderErrorForDisplay(rawMessage, commandName, allowedTypes, context) {
|
|
1179
|
-
|
|
1235
|
+
const guidance = buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context);
|
|
1236
|
+
return projectPmDiagnosticText(renderGuidanceMessage(guidance), guidance.required).output;
|
|
1180
1237
|
}
|
|
1181
1238
|
/** Implements classify commander error for the public runtime surface of this module. */
|
|
1182
1239
|
export function classifyCommanderError(rawMessage, commandName, allowedTypes, context) {
|
|
@@ -1184,12 +1241,12 @@ export function classifyCommanderError(rawMessage, commandName, allowedTypes, co
|
|
|
1184
1241
|
}
|
|
1185
1242
|
/** Implements format commander error for json for the public runtime surface of this module. */
|
|
1186
1243
|
export function formatCommanderErrorForJson(rawMessage, commandName, allowedTypes, exitCode, context) {
|
|
1187
|
-
return
|
|
1244
|
+
return projectJsonErrorGuidance(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context), exitCode);
|
|
1188
1245
|
}
|
|
1189
1246
|
/** Implements format unknown error for json for the public runtime surface of this module. */
|
|
1190
1247
|
export function formatUnknownErrorForJson(rawMessage, exitCode) {
|
|
1191
1248
|
const guidance = buildUnknownErrorGuidance(rawMessage);
|
|
1192
|
-
return
|
|
1249
|
+
return projectJsonErrorGuidance(guidance, exitCode);
|
|
1193
1250
|
}
|
|
1194
1251
|
function buildUnknownErrorGuidance(rawMessage) {
|
|
1195
1252
|
const message = normalizeMessage(rawMessage);
|
|
@@ -1240,4 +1297,4 @@ export const _testOnly = {
|
|
|
1240
1297
|
resolveKnownPackageCommandHint,
|
|
1241
1298
|
};
|
|
1242
1299
|
//# sourceMappingURL=error-guidance.js.map
|
|
1243
|
-
//# debugId=
|
|
1300
|
+
//# debugId=4bdb7fcf-dd74-57bc-8a0e-07539095462e
|
package/dist/cli/main.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { type ExtensionCommandHelpDescriptor } from "./extension-command-help.js
|
|
|
11
11
|
import { normalizeBootstrapInvocation } from "./bootstrap-args.js";
|
|
12
12
|
import { type MandatoryMigrationBlocker } from "./migration-gates.js";
|
|
13
13
|
import { resolveUnknownCommanderToken } from "./commander-usage.js";
|
|
14
|
+
/** Record the exact compatibility flags present in the raw CLI invocation. */
|
|
15
|
+
declare function recordCliReadOutputInvocationProvenance(actionCommand: Command, commandPath: string, commandOptions: Record<string, unknown>): void;
|
|
14
16
|
declare function setActiveExtensionHookContextForTest(context: ActiveExtensionHookContext<MandatoryMigrationBlocker> | null): void;
|
|
15
17
|
declare function setActiveRuntimeExtensionCommandDescriptorsForTest(descriptors: Map<string, ExtensionCommandHelpDescriptor>): void;
|
|
16
18
|
interface RuntimeExtensionSnapshot {
|
|
@@ -292,6 +294,7 @@ export declare const _testOnly: {
|
|
|
292
294
|
readRecordBoolean: typeof readRecordBoolean;
|
|
293
295
|
readRecordNumber: typeof readRecordNumber;
|
|
294
296
|
readRecordString: typeof readRecordString;
|
|
297
|
+
recordCliReadOutputInvocationProvenance: typeof recordCliReadOutputInvocationProvenance;
|
|
295
298
|
registerDynamicExtensionCommandPaths: typeof registerDynamicExtensionCommandPaths;
|
|
296
299
|
registerRuntimeSchemaFieldFlags: typeof registerRuntimeSchemaFieldFlags;
|
|
297
300
|
resolveCoreCommandRegistrationSelection: typeof resolveCoreCommandRegistrationSelection;
|
package/dist/cli/main.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
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]="7289d222-cf1f-5fa5-ac8a-d690b6012e39")}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
|
+
import { runWithReproducibleProcessEnvironment } from "../sdk/reproducibility/process.js";
|
|
9
10
|
import { resolveSubcommandFlagContractsForCommand } from "../sdk/cli-contracts.js";
|
|
10
11
|
import { createExtensionCommandSdk } from "../sdk/extension-command-context.js";
|
|
11
12
|
import { PmClient } from "../sdk/runtime.js";
|
|
@@ -27,10 +28,38 @@ import { loadExtensionRecoveryFailures, loadUnknownCommandRecoveryFailures } fro
|
|
|
27
28
|
import { maybeRenderBootstrapJsonHelp, attachCreateUpdatePolicyHelpText } from "./help-json-payload.js";
|
|
28
29
|
import { attachOutputTokenAccounting } from "../sdk/output-token-accounting.js";
|
|
29
30
|
import { runWithDiscoveredContextIntentContracts } from "../sdk/context-intent-runtime.js";
|
|
30
|
-
import { applyReadOutputIncludeModes, validateReadOutputOptions } from "../sdk/read-output-contracts.js";
|
|
31
|
+
import { PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputIncludeModes, readOutputIncludeModeOptions, resolveReadOutputSurface, validateReadOutputOptions, } from "../sdk/read-output-contracts.js";
|
|
31
32
|
import { loadContextIntentSnapshotForInvocation } from "./context-intent-invocation.js";
|
|
32
33
|
import { isPmSuccessfulExitCode } from "../sdk/cli-contracts/command-exit-contracts.js";
|
|
33
34
|
const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
|
|
35
|
+
const READ_OUTPUT_INVOCATION_PROVENANCE = Symbol.for("pm.readOutputInvocationProvenance");
|
|
36
|
+
/** Carry private read-output provenance across Commander's option rebuilds. */
|
|
37
|
+
function copyReadOutputInvocationProvenance(source, target) {
|
|
38
|
+
const provenance = Reflect.get(source, READ_OUTPUT_INVOCATION_PROVENANCE);
|
|
39
|
+
if (provenance !== undefined) {
|
|
40
|
+
Reflect.set(target, READ_OUTPUT_INVOCATION_PROVENANCE, provenance);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Record the exact compatibility flags present in the raw CLI invocation. */
|
|
44
|
+
function recordCliReadOutputInvocationProvenance(actionCommand, commandPath, commandOptions) {
|
|
45
|
+
const surface = resolveReadOutputSurface(commandPath, commandOptions);
|
|
46
|
+
if (!surface)
|
|
47
|
+
return;
|
|
48
|
+
let rootCommand = actionCommand;
|
|
49
|
+
while (rootCommand.parent)
|
|
50
|
+
rootCommand = rootCommand.parent;
|
|
51
|
+
const rawArgs = rootCommand.rawArgs;
|
|
52
|
+
const providedFlags = new Set(extractProvidedOptionFlags(rawArgs.slice(2)));
|
|
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] : []));
|
|
55
|
+
const previous = Reflect.get(commandOptions, READ_OUTPUT_INVOCATION_PROVENANCE);
|
|
56
|
+
Reflect.set(commandOptions, READ_OUTPUT_INVOCATION_PROVENANCE, {
|
|
57
|
+
canonical_include_modes: previous?.canonical_include_modes ?? [],
|
|
58
|
+
explicit_legacy_aliases: explicitLegacyAliases,
|
|
59
|
+
cli_invocation_observed: true,
|
|
60
|
+
});
|
|
61
|
+
copyReadOutputInvocationProvenance(commandOptions, actionCommand);
|
|
62
|
+
}
|
|
34
63
|
function resolvePmPackageRoot() {
|
|
35
64
|
return resolvePmPackageRootFromModule(import.meta.url, ["../.."]);
|
|
36
65
|
}
|
|
@@ -512,15 +541,18 @@ async function handleGenericRunPmCliError(params) {
|
|
|
512
541
|
* command computes its rows, so it cannot be resolved by the output layer.
|
|
513
542
|
*/
|
|
514
543
|
function forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions) {
|
|
544
|
+
recordCliReadOutputInvocationProvenance(actionCommand, commandPath, commandOptions);
|
|
515
545
|
const requested = globalOptions.outputInclude;
|
|
516
546
|
if (requested === undefined)
|
|
517
547
|
return;
|
|
518
|
-
const
|
|
519
|
-
const { selectors, modes } = applyReadOutputIncludeModes(commandPath, requested, modeOptions);
|
|
548
|
+
const { selectors, modes } = applyReadOutputIncludeModes(commandPath, requested, commandOptions);
|
|
520
549
|
if (modes.length === 0)
|
|
521
550
|
return;
|
|
522
|
-
|
|
523
|
-
|
|
551
|
+
copyReadOutputInvocationProvenance(commandOptions, actionCommand);
|
|
552
|
+
const modeOptions = readOutputIncludeModeOptions(commandPath);
|
|
553
|
+
for (const mode of modes) {
|
|
554
|
+
const key = modeOptions.get(mode);
|
|
555
|
+
const value = commandOptions[key];
|
|
524
556
|
actionCommand.setOptionValueWithSource(key, value, "cli");
|
|
525
557
|
}
|
|
526
558
|
const residual = selectors.length > 0 ? selectors.join(",") : undefined;
|
|
@@ -540,6 +572,7 @@ function forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions
|
|
|
540
572
|
function extractCommandScopedOptions(command, commandArgs, extensionFlagDefinitions = []) {
|
|
541
573
|
const allOptions = command.optsWithGlobals();
|
|
542
574
|
const scoped = { ...allOptions };
|
|
575
|
+
copyReadOutputInvocationProvenance(command, scoped);
|
|
543
576
|
delete scoped.json;
|
|
544
577
|
delete scoped.quiet;
|
|
545
578
|
delete scoped.path;
|
|
@@ -2355,8 +2388,7 @@ async function handleRunPmCliError(params) {
|
|
|
2355
2388
|
emitTelemetryCommandError: context.emitTelemetryCommandError,
|
|
2356
2389
|
});
|
|
2357
2390
|
}
|
|
2358
|
-
|
|
2359
|
-
export async function runPmCli(rawArgv = process.argv.slice(2)) {
|
|
2391
|
+
async function runPmCliInReproducibleContext(rawArgv) {
|
|
2360
2392
|
program = createPmCliProgram(CLI_VERSION);
|
|
2361
2393
|
attachProgramLifecycleHooks(program);
|
|
2362
2394
|
// The runtime-extension snapshot caches dedupe discovery work within a
|
|
@@ -2426,6 +2458,15 @@ export async function runPmCli(rawArgv = process.argv.slice(2)) {
|
|
|
2426
2458
|
restorePmAuthor?.();
|
|
2427
2459
|
}
|
|
2428
2460
|
}
|
|
2461
|
+
/** Implements run pm cli for the public runtime surface of this module. */
|
|
2462
|
+
export async function runPmCli(rawArgv = process.argv.slice(2)) {
|
|
2463
|
+
try {
|
|
2464
|
+
await runWithReproducibleProcessEnvironment(process.env, () => runPmCliInReproducibleContext(rawArgv));
|
|
2465
|
+
}
|
|
2466
|
+
catch (error) {
|
|
2467
|
+
await handleRunPmCliError({ error, invocationArgv: [...rawArgv] });
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2429
2470
|
/** Public contract for test only, shared by SDK and presentation-layer consumers. */
|
|
2430
2471
|
export const _testOnly = {
|
|
2431
2472
|
activationCommandMatchesProbe,
|
|
@@ -2493,6 +2534,7 @@ export const _testOnly = {
|
|
|
2493
2534
|
readRecordBoolean,
|
|
2494
2535
|
readRecordNumber,
|
|
2495
2536
|
readRecordString,
|
|
2537
|
+
recordCliReadOutputInvocationProvenance,
|
|
2496
2538
|
registerDynamicExtensionCommandPaths,
|
|
2497
2539
|
registerRuntimeSchemaFieldFlags,
|
|
2498
2540
|
resolveCoreCommandRegistrationSelection,
|
|
@@ -2516,4 +2558,4 @@ export const _testOnly = {
|
|
|
2516
2558
|
wrapThrownErrorForSentry,
|
|
2517
2559
|
};
|
|
2518
2560
|
//# sourceMappingURL=main.js.map
|
|
2519
|
-
//# debugId=
|
|
2561
|
+
//# debugId=7289d222-cf1f-5fa5-ac8a-d690b6012e39
|
|
@@ -1,7 +1,7 @@
|
|
|
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]="49cddeba-127e-5d6c-a62d-4a63088ce8c6")}catch(e){}}();
|
|
3
3
|
import { resolveBodyFileContent, EXIT_CODE, splitCommaList, PmCliError, createUnknownSubcommandError, } from "../sdk/runtime-primitives.js";
|
|
4
|
-
import { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, } from "../sdk/cli-contracts.js";
|
|
4
|
+
import { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, MERGE_SUBCOMMAND_VALUES, PLAN_CREATE_METADATA_PARAMETER_KEYS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, } from "../sdk/cli-contracts.js";
|
|
5
5
|
import { BUILTIN_ITEM_TYPE_VALUES, PLAN_STEP_LINK_KIND_VALUES, } from "../types/index.js";
|
|
6
6
|
import { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, runMergeInstall, runMergeReconcile, runMergeReceiptReport, } from "./commands/merge.js";
|
|
7
7
|
import { runAppend } from "./commands/append.js";
|
|
@@ -823,7 +823,7 @@ async function runMergeAction(subcommand, artifact, base, ours, theirs, options,
|
|
|
823
823
|
throw createUnknownSubcommandError({
|
|
824
824
|
command_path: "merge",
|
|
825
825
|
token: subcommand,
|
|
826
|
-
allowed:
|
|
826
|
+
allowed: MERGE_SUBCOMMAND_VALUES,
|
|
827
827
|
display_name: "merge",
|
|
828
828
|
});
|
|
829
829
|
}
|
|
@@ -898,7 +898,7 @@ async function runSchemaAction(subcommand, name, options, command) {
|
|
|
898
898
|
assertSchemaSubcommandPresent(normalizedSubcommand, SCHEMA_SUBCOMMANDS);
|
|
899
899
|
if (!SCHEMA_SUBCOMMANDS.includes(normalizedSubcommand) &&
|
|
900
900
|
typeName === undefined &&
|
|
901
|
-
!looksLikeSchemaSubcommandTypo(
|
|
901
|
+
!looksLikeSchemaSubcommandTypo(subcommand)) {
|
|
902
902
|
typeName = subcommand;
|
|
903
903
|
normalizedSubcommand = "add-type";
|
|
904
904
|
}
|
|
@@ -1724,7 +1724,7 @@ export function registerMutationCommands(program, registrationOptions = {}) {
|
|
|
1724
1724
|
.action(runHistoryCompactAction);
|
|
1725
1725
|
program
|
|
1726
1726
|
.command("merge")
|
|
1727
|
-
.argument("<subcommand>",
|
|
1727
|
+
.argument("<subcommand>", `Merge subcommand: ${MERGE_SUBCOMMAND_VALUES.join(", ")}`)
|
|
1728
1728
|
.argument("[artifact]", `driver only: artifact class to merge (${MERGE_DRIVER_ARTIFACT_VALUES.join(", ")})`)
|
|
1729
1729
|
.argument("[base]", "driver only: common-ancestor file path (git %O)")
|
|
1730
1730
|
.argument("[ours]", "driver only: current-branch file path (git %A)")
|
|
@@ -1840,4 +1840,4 @@ export function registerMutationCommands(program, registrationOptions = {}) {
|
|
|
1840
1840
|
.action(runDepsAction);
|
|
1841
1841
|
}
|
|
1842
1842
|
//# sourceMappingURL=register-mutation.js.map
|
|
1843
|
-
//# debugId=
|
|
1843
|
+
//# debugId=49cddeba-127e-5d6c-a62d-4a63088ce8c6
|
|
@@ -4,7 +4,80 @@
|
|
|
4
4
|
* Provides CLI runtime support for Register Operations.
|
|
5
5
|
*/
|
|
6
6
|
import type { Command } from "commander";
|
|
7
|
+
declare function validateBackgroundTestOptions(options: Record<string, unknown>, values: {
|
|
8
|
+
addValues: string[];
|
|
9
|
+
addJsonValues: string[];
|
|
10
|
+
removeValues: string[];
|
|
11
|
+
removeIndexValues: string[];
|
|
12
|
+
}): void;
|
|
13
|
+
declare function buildRunTestOptions(options: Record<string, unknown>, values: {
|
|
14
|
+
addValues: string[];
|
|
15
|
+
addJsonValues: string[];
|
|
16
|
+
removeValues: string[];
|
|
17
|
+
removeIndexValues: string[];
|
|
18
|
+
}): {
|
|
19
|
+
add: string[];
|
|
20
|
+
addJson: string[];
|
|
21
|
+
remove: string[];
|
|
22
|
+
removeIndex: string[];
|
|
23
|
+
list: boolean;
|
|
24
|
+
run: boolean;
|
|
25
|
+
match: string | undefined;
|
|
26
|
+
onlyIndex: string | number | undefined;
|
|
27
|
+
onlyLast: boolean;
|
|
28
|
+
timeout: string | undefined;
|
|
29
|
+
progress: boolean;
|
|
30
|
+
envSet: string[];
|
|
31
|
+
envClear: string[];
|
|
32
|
+
sharedHostSafe: boolean;
|
|
33
|
+
pmContext: string | undefined;
|
|
34
|
+
overrideLinkedPmContext: boolean;
|
|
35
|
+
workspaceContext: string | undefined;
|
|
36
|
+
overrideLinkedWorkspaceContext: boolean;
|
|
37
|
+
allowUntrustedLinkedTests: boolean;
|
|
38
|
+
acknowledgeLinkedTests: boolean;
|
|
39
|
+
failOnContextMismatch: boolean;
|
|
40
|
+
failOnSkipped: boolean;
|
|
41
|
+
failOnEmptyTestRun: boolean;
|
|
42
|
+
requireAssertionsForPm: boolean;
|
|
43
|
+
checkContext: boolean;
|
|
44
|
+
autoPmContext: boolean;
|
|
45
|
+
author: string | undefined;
|
|
46
|
+
message: string | undefined;
|
|
47
|
+
force: boolean;
|
|
48
|
+
measure: string[];
|
|
49
|
+
metricBelow: string | undefined;
|
|
50
|
+
metricDiff: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
/** Public contract for test-only operation adapter coverage. */
|
|
53
|
+
export declare const _testOnlyRegisterOperations: {
|
|
54
|
+
buildRunTestOptions: typeof buildRunTestOptions;
|
|
55
|
+
buildRunTestAllOptions: typeof buildRunTestAllOptions;
|
|
56
|
+
validateBackgroundTestOptions: typeof validateBackgroundTestOptions;
|
|
57
|
+
};
|
|
58
|
+
declare function buildRunTestAllOptions(options: Record<string, unknown>): {
|
|
59
|
+
status: string | undefined;
|
|
60
|
+
limit: string | undefined;
|
|
61
|
+
offset: string | undefined;
|
|
62
|
+
timeout: string | undefined;
|
|
63
|
+
progress: boolean;
|
|
64
|
+
envSet: string[];
|
|
65
|
+
envClear: string[];
|
|
66
|
+
sharedHostSafe: boolean;
|
|
67
|
+
pmContext: string | undefined;
|
|
68
|
+
overrideLinkedPmContext: boolean;
|
|
69
|
+
workspaceContext: string | undefined;
|
|
70
|
+
overrideLinkedWorkspaceContext: boolean;
|
|
71
|
+
allowUntrustedLinkedTests: boolean;
|
|
72
|
+
failOnContextMismatch: boolean;
|
|
73
|
+
failOnSkipped: boolean;
|
|
74
|
+
failOnEmptyTestRun: boolean;
|
|
75
|
+
requireAssertionsForPm: boolean;
|
|
76
|
+
checkContext: boolean;
|
|
77
|
+
autoPmContext: boolean;
|
|
78
|
+
};
|
|
7
79
|
/** Enforces the claim target XOR selection contract before dispatch. */
|
|
8
80
|
export declare function requireClaimTarget(id: string | undefined, next: boolean): void;
|
|
9
81
|
/** Implements register operation commands for the public runtime surface of this module. */
|
|
10
82
|
export declare function registerOperationCommands(program: Command): void;
|
|
83
|
+
export {};
|