@unbrained/pm-cli 2026.8.18 → 2026.8.19

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.
Files changed (139) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +16 -2
  3. package/dist/cli/error-guidance.js +3 -2
  4. package/dist/cli/help-content.js +32 -13
  5. package/dist/cli/help-json-payload.d.ts +15 -0
  6. package/dist/cli/help-json-payload.js +101 -23
  7. package/dist/cli/main.js +6 -2
  8. package/dist/cli/register-list-query.js +8 -5
  9. package/dist/cli/register-mutation.js +8 -8
  10. package/dist/cli/register-operations.js +6 -6
  11. package/dist/cli-bundle/bundle-manifest.json +139 -139
  12. package/dist/cli-bundle/chunks/chunk-4NRRH7AM.js +2 -0
  13. package/dist/cli-bundle/chunks/{chunk-UYCLQVL2.js → chunk-4THEB6PD.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-BHYMXLAE.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +197 -0
  16. package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +35 -0
  17. package/dist/cli-bundle/chunks/chunk-OI4XI562.js +5 -0
  18. package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.js → chunk-OIOKV6NO.js} +3 -3
  19. package/dist/cli-bundle/chunks/{chunk-5UZZAJKR.js → chunk-QXSH7BLM.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.js → chunk-TOXJM4WA.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-GNFAFIJI.js → chunk-YBMRWW4E.js} +44 -44
  22. package/dist/cli-bundle/chunks/{register-list-query-I23LALEE.js → register-list-query-Y56KINDU.js} +11 -11
  23. package/dist/cli-bundle/chunks/register-mutation-AUWVCW4M.js +20 -0
  24. package/dist/cli-bundle/chunks/register-operations-PZQPHXW5.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-I4LUHGVW.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-5AF3ZBNB.js → chunk-34QBIYZI.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.js → chunk-BJRYFVSH.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-DKPLYW3L.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-EF6ZS5GH.js} +44 -44
  30. package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-ESISGDAY.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-EXBCLIBU.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JDOMQ7VQ.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-MCZXYZAF.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-ODHQEECS.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-3TKWMNKF.js → chunk-PRHY2IMX.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-US7VEYZG.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-VXDSU5MC.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +16 -0
  41. package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-ZBIQQYMI.js} +2 -2
  43. package/dist/cli-bundle/main.js +13 -13
  44. package/dist/cli-bundle/sdk-authoring.js +1 -1
  45. package/dist/cli-bundle/sdk-contracts.js +2 -1
  46. package/dist/cli-bundle/sdk-core.js +31 -31
  47. package/dist/cli-bundle/sdk-governance.js +1 -1
  48. package/dist/cli-bundle/sdk-graph.js +1 -1
  49. package/dist/cli-bundle/sdk-merge.js +32 -32
  50. package/dist/cli-bundle/sdk-query.js +1 -1
  51. package/dist/cli-bundle/sdk-runtime.js +1 -1
  52. package/dist/cli-bundle/sdk-testing.js +1 -1
  53. package/dist/cli-bundle/sdk.js +5 -4
  54. package/dist/core/shared/errors.d.ts +2 -0
  55. package/dist/core/shared/errors.js +2 -2
  56. package/dist/sdk/agent/refusal-closure.d.ts +41 -0
  57. package/dist/sdk/agent/refusal-closure.js +92 -0
  58. package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
  59. package/dist/sdk/agent-capability-contracts.d.ts +13 -0
  60. package/dist/sdk/agent-capability-contracts.js +104 -7
  61. package/dist/sdk/cli-contracts/command-aliases.js +18 -2
  62. package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
  63. package/dist/sdk/cli-contracts/commander-types.js +5 -4
  64. package/dist/sdk/cli-contracts/flag-contracts.d.ts +5 -0
  65. package/dist/sdk/cli-contracts/flag-contracts.js +75 -8
  66. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +55 -0
  67. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +240 -0
  68. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +81 -0
  69. package/dist/sdk/cli-contracts/grammar-contracts.js +615 -2
  70. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
  71. package/dist/sdk/cli-contracts/runtime-contracts.js +42 -12
  72. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
  73. package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
  74. package/dist/sdk/cli-contracts.d.ts +3 -2
  75. package/dist/sdk/cli-contracts.js +5 -4
  76. package/dist/sdk/context-intent-contracts.d.ts +2 -2
  77. package/dist/sdk/context-intent-contracts.js +22 -7
  78. package/dist/sdk/contracts.d.ts +2 -0
  79. package/dist/sdk/contracts.js +4 -2
  80. package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
  81. package/dist/sdk/flag-invocation-contracts.js +218 -9
  82. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +134 -2
  83. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +154 -22
  84. package/dist/sdk/index.d.ts +7 -5
  85. package/dist/sdk/index.js +7 -5
  86. package/dist/sdk/output-projection.d.ts +2 -0
  87. package/dist/sdk/output-projection.js +11 -5
  88. package/dist/sdk/query/get.js +25 -6
  89. package/dist/sdk/query/list.js +16 -2
  90. package/dist/sdk/query/search-contracts.d.ts +1 -1
  91. package/dist/sdk/query/search-contracts.js +23 -9
  92. package/dist/sdk/query/search.js +3 -3
  93. package/dist/sdk/read-output/continuation.d.ts +1 -1
  94. package/dist/sdk/read-output/continuation.js +7 -24
  95. package/dist/sdk/read-output-contracts.js +55 -6
  96. package/dist/sdk/read-output-rows.d.ts +4 -0
  97. package/dist/sdk/read-output-rows.js +47 -18
  98. package/dist/sdk/runtime.js +9 -5
  99. package/dist/sdk/workspace-snapshot.d.ts +2 -0
  100. package/dist/sdk/workspace-snapshot.js +10 -2
  101. package/docs/COMMANDS.md +16 -4
  102. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
  103. package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
  104. package/docs/SDK.md +6 -0
  105. package/docs/TESTING.md +14 -1
  106. package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
  107. package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
  108. package/marketplace.json +2 -2
  109. package/package.json +5 -3
  110. package/packages/pm-beads/package.json +1 -1
  111. package/packages/pm-calendar/package.json +1 -1
  112. package/packages/pm-command-kit/package.json +1 -1
  113. package/packages/pm-digital-twin/package.json +1 -1
  114. package/packages/pm-governance-audit/package.json +1 -1
  115. package/packages/pm-guide-shell/package.json +1 -1
  116. package/packages/pm-kanban/package.json +1 -1
  117. package/packages/pm-lifecycle-hooks/package.json +1 -1
  118. package/packages/pm-linked-test-adapters/package.json +1 -1
  119. package/packages/pm-search-advanced/package.json +1 -1
  120. package/packages/pm-templates/package.json +1 -1
  121. package/packages/pm-todos/package.json +1 -1
  122. package/packages/pm-vcs/package.json +1 -1
  123. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  124. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  125. package/scripts/generate-agent-capability-surfaces.mjs +20 -14
  126. package/sdk/public-surface.json +576 -12
  127. package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
  128. package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
  129. package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
  130. package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
  131. package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
  132. package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
  133. package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
  134. package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
  135. package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
  136. package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
  137. package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
  138. package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
  139. package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @module sdk/agent/refusal-closure
3
+ *
4
+ * Scores whether a structured refusal contains enough executable context for
5
+ * an agent to recover without another discovery round trip.
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]="65cfaa41-6f53-5339-8b55-c1a4d3660c5d")}catch(e){}}();
9
+ import { EXIT_CODE } from "../../core/shared/constants.js";
10
+ /** Return every closure defect contributed by one unique observation. */
11
+ function listObservationFindings(observation) {
12
+ return [
13
+ observation.exit_code !== EXIT_CODE.USAGE
14
+ ? {
15
+ code: "non_refusal_exit",
16
+ probe_id: observation.probe_id,
17
+ detail: `${observation.entrypoint} returned exit code ${observation.exit_code}; a structured usage refusal must return ${EXIT_CODE.USAGE}.`,
18
+ }
19
+ : undefined,
20
+ observation.allowed_values.length === 0
21
+ ? {
22
+ code: "missing_allowed_values",
23
+ probe_id: observation.probe_id,
24
+ detail: "The refusal omitted its complete accepted value domain.",
25
+ }
26
+ : undefined,
27
+ observation.allowed_values.includes(observation.rejected_value)
28
+ ? {
29
+ code: "accepted_rejected_value",
30
+ probe_id: observation.probe_id,
31
+ detail: `${observation.rejected_value} is both rejected and advertised as allowed.`,
32
+ }
33
+ : undefined,
34
+ observation.suggested_retry.trim().length === 0
35
+ ? {
36
+ code: "missing_suggested_retry",
37
+ probe_id: observation.probe_id,
38
+ detail: "The refusal omitted an executable suggested retry.",
39
+ }
40
+ : undefined,
41
+ !observation.retry_succeeded
42
+ ? {
43
+ code: "retry_failed",
44
+ probe_id: observation.probe_id,
45
+ detail: "The advertised suggested retry did not succeed.",
46
+ }
47
+ : undefined,
48
+ ];
49
+ }
50
+ /** Score structured closed-domain refusals and executable retries. */
51
+ export function scorePmRefusalClosure(observations) {
52
+ const findings = [];
53
+ const seen = new Set();
54
+ let closedProbeCount = 0;
55
+ if (observations.length === 0) {
56
+ findings.push({
57
+ code: "empty_corpus",
58
+ probe_id: "corpus",
59
+ detail: "At least one real refusal observation is required.",
60
+ });
61
+ }
62
+ for (const observation of observations) {
63
+ if (seen.has(observation.probe_id)) {
64
+ findings.push({
65
+ code: "duplicate_probe",
66
+ probe_id: observation.probe_id,
67
+ detail: `${observation.probe_id} was supplied more than once.`,
68
+ });
69
+ continue;
70
+ }
71
+ seen.add(observation.probe_id);
72
+ const findingCount = findings.length;
73
+ for (const finding of listObservationFindings(observation)) {
74
+ if (finding !== undefined)
75
+ findings.push(finding);
76
+ }
77
+ if (findings.length === findingCount)
78
+ closedProbeCount += 1;
79
+ }
80
+ findings.sort((left, right) => left.probe_id !== right.probe_id
81
+ ? left.probe_id.localeCompare(right.probe_id)
82
+ : left.code.localeCompare(right.code));
83
+ return {
84
+ ok: findings.length === 0,
85
+ probe_count: seen.size,
86
+ closed_probe_count: closedProbeCount,
87
+ closure_fraction: seen.size === 0 ? 0 : closedProbeCount / seen.size,
88
+ findings,
89
+ };
90
+ }
91
+ //# sourceMappingURL=refusal-closure.js.map
92
+ //# debugId=65cfaa41-6f53-5339-8b55-c1a4d3660c5d
@@ -37,7 +37,7 @@ export type PmRecoveryReferenceKind = (typeof PM_RECOVERY_REFERENCE_KINDS)[numbe
37
37
  /** Behavioral promise attached to a recovery reference. */
38
38
  export type PmRecoveryReferenceSemantics = "recovery" | "replacement" | "behavior_preserving";
39
39
  /** Literal envelope fields recognized as recovery-reference producers. */
40
- export declare const PM_RECOVERY_REFERENCE_FIELDS: readonly ("restore_with" | "migration_hint" | "migration_hints" | "suggested_retry" | "next_best_command" | "fallback_candidates" | "examples" | "next_steps" | "suggested_next_steps" | "candidate_commands" | "candidate_command" | "example" | "next_step" | "retry_command")[];
40
+ export declare const PM_RECOVERY_REFERENCE_FIELDS: readonly ("restore_with" | "migration_hint" | "migration_hints" | "suggested_retry" | "next_best_command" | "fallback_candidates" | "examples" | "next_steps" | "suggested_next_steps" | "candidate_commands" | "example" | "candidate_command" | "next_step" | "retry_command")[];
41
41
  /** One source file supplied to the producer-census analyzer. */
42
42
  export interface PmRecoveryProducerSource {
43
43
  /** Repository-relative source path. */
@@ -1,5 +1,7 @@
1
1
  /** Visibility tiers shared by CLI help, completions, docs, extensions, and MCP. */
2
2
  export type PmCommandVisibilityTier = "core" | "standard" | "full" | "internal";
3
+ /** Stable capability families shared by every agent-facing command surface. */
4
+ export type PmCommandCapabilityFamily = "workspace" | "intake" | "context" | "lifecycle" | "evidence" | "graph" | "quality" | "automation" | "extensions" | "internal";
3
5
  /** One command's canonical agent-surface visibility declaration. */
4
6
  export interface PmCommandVisibilityContract {
5
7
  /** Canonical command path. */
@@ -7,6 +9,13 @@ export interface PmCommandVisibilityContract {
7
9
  /** Minimum surface tier that advertises the command. */
8
10
  tier: PmCommandVisibilityTier;
9
11
  }
12
+ /** Complete command capability contract with visibility and family ownership. */
13
+ export interface PmCommandCapabilityContract extends PmCommandVisibilityContract {
14
+ /** Exactly one stable capability family used to group the command. */
15
+ family: PmCommandCapabilityFamily;
16
+ }
17
+ /** Resolve one command's stable capability family. */
18
+ export declare function resolvePmCommandCapabilityFamily(command: string): PmCommandCapabilityFamily;
10
19
  /**
11
20
  * Canonical visibility contract for every built-in command.
12
21
  *
@@ -14,11 +23,15 @@ export interface PmCommandVisibilityContract {
14
23
  * surface. Internal worker/helper paths are appended below and never advertised
15
24
  * by normal help or completion projections.
16
25
  */
26
+ export declare const PM_COMMAND_CAPABILITY_CONTRACTS: readonly PmCommandCapabilityContract[];
27
+ /** Backward-compatible tier-only projection of the capability contract. */
17
28
  export declare const PM_COMMAND_VISIBILITY_CONTRACTS: readonly PmCommandVisibilityContract[];
18
29
  /** Resolve one command's declared tier; extension commands default to standard. */
19
30
  export declare function resolvePmCommandVisibilityTier(command: string, extensionTier?: PmCommandVisibilityTier): PmCommandVisibilityTier;
20
31
  /** Return commands visible at a requested tier, preserving contract order. */
21
32
  export declare function listPmCommandsForTier(tier: Exclude<PmCommandVisibilityTier, "internal">): string[];
33
+ /** Return commands in one capability family, preserving contract order. */
34
+ export declare function listPmCommandsForFamily(family: PmCommandCapabilityFamily): string[];
22
35
  /** MCP profile names accepted by the server and embedding hosts. */
23
36
  export type PmMcpToolProfile = "core" | "standard" | "full" | "custom";
24
37
  /** Mapping from one narrow MCP tool to the command contract that tiers it. */
@@ -5,7 +5,7 @@
5
5
  * surfaces from one public SDK contract.
6
6
  */
7
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]="6fc2cd04-2fe4-5a0e-944d-fab0f86509e2")}catch(e){}}();
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]="dd74bc56-9971-59b9-8d2b-a6cc78b0a650")}catch(e){}}();
9
9
  import { PM_CORE_COMMAND_NAMES } from "./cli-contracts/enum-contracts.js";
10
10
  const CORE_COMMANDS = new Set([
11
11
  "claim",
@@ -46,6 +46,92 @@ const STANDARD_COMMANDS = new Set([
46
46
  "schema",
47
47
  "test",
48
48
  ]);
49
+ const COMMANDS_BY_FAMILY = Object.freeze({
50
+ workspace: new Set([
51
+ "config",
52
+ "gc",
53
+ "health",
54
+ "init",
55
+ "merge",
56
+ "profile",
57
+ "schema",
58
+ "telemetry",
59
+ "workspace",
60
+ ]),
61
+ intake: new Set(["copy", "create", "focus", "item", "restore"]),
62
+ context: new Set([
63
+ "activity",
64
+ "aggregate",
65
+ "context",
66
+ "ctx",
67
+ "duplicates",
68
+ "eval",
69
+ "get",
70
+ "help",
71
+ "list",
72
+ "list-all",
73
+ "list-blocked",
74
+ "list-canceled",
75
+ "list-closed",
76
+ "list-draft",
77
+ "list-in-progress",
78
+ "list-open",
79
+ "next",
80
+ "search",
81
+ "stats",
82
+ ]),
83
+ lifecycle: new Set([
84
+ "claim",
85
+ "close",
86
+ "close-many",
87
+ "close-task",
88
+ "delete",
89
+ "pause-task",
90
+ "release",
91
+ "start-task",
92
+ "update",
93
+ "update-many",
94
+ ]),
95
+ evidence: new Set([
96
+ "append",
97
+ "comments",
98
+ "docs",
99
+ "events",
100
+ "files",
101
+ "history",
102
+ "history-author-acknowledge",
103
+ "history-compact",
104
+ "history-redact",
105
+ "history-repair",
106
+ "learnings",
107
+ "notes",
108
+ ]),
109
+ graph: new Set(["deps", "graph", "plan"]),
110
+ quality: new Set([
111
+ "assurance",
112
+ "contracts",
113
+ "test",
114
+ "test-all",
115
+ "validate",
116
+ ]),
117
+ automation: new Set(["event", "meet", "remind"]),
118
+ });
119
+ const EXTENSION_COMMANDS = new Set([
120
+ "extension",
121
+ "install",
122
+ "package",
123
+ "packages",
124
+ "upgrade",
125
+ ]);
126
+ /** Resolve one command's stable capability family. */
127
+ export function resolvePmCommandCapabilityFamily(command) {
128
+ const normalized = command.trim().toLowerCase();
129
+ for (const [family, commands] of Object.entries(COMMANDS_BY_FAMILY)) {
130
+ if (commands.has(normalized))
131
+ return family;
132
+ }
133
+ return EXTENSION_COMMANDS.has(normalized) ? "extensions" : "internal";
134
+ }
49
135
  /**
50
136
  * Canonical visibility contract for every built-in command.
51
137
  *
@@ -53,7 +139,7 @@ const STANDARD_COMMANDS = new Set([
53
139
  * surface. Internal worker/helper paths are appended below and never advertised
54
140
  * by normal help or completion projections.
55
141
  */
56
- export const PM_COMMAND_VISIBILITY_CONTRACTS = Object.freeze([
142
+ export const PM_COMMAND_CAPABILITY_CONTRACTS = Object.freeze([
57
143
  ...PM_CORE_COMMAND_NAMES.map((command) => ({
58
144
  command,
59
145
  tier: CORE_COMMANDS.has(command)
@@ -61,24 +147,31 @@ export const PM_COMMAND_VISIBILITY_CONTRACTS = Object.freeze([
61
147
  : STANDARD_COMMANDS.has(command)
62
148
  ? "standard"
63
149
  : "full",
150
+ family: resolvePmCommandCapabilityFamily(command),
64
151
  })),
65
152
  {
66
153
  command: "completion-statuses",
67
154
  tier: "internal",
155
+ family: "internal",
68
156
  },
69
157
  {
70
158
  command: "completion-tags",
71
159
  tier: "internal",
160
+ family: "internal",
72
161
  },
73
162
  {
74
163
  command: "completion-types",
75
164
  tier: "internal",
165
+ family: "internal",
76
166
  },
77
167
  {
78
168
  command: "test-runs-worker",
79
169
  tier: "internal",
170
+ family: "internal",
80
171
  },
81
172
  ]);
173
+ /** Backward-compatible tier-only projection of the capability contract. */
174
+ export const PM_COMMAND_VISIBILITY_CONTRACTS = PM_COMMAND_CAPABILITY_CONTRACTS;
82
175
  const TIER_ORDER = {
83
176
  core: 0,
84
177
  standard: 1,
@@ -95,6 +188,10 @@ export function listPmCommandsForTier(tier) {
95
188
  const maximum = TIER_ORDER[tier];
96
189
  return PM_COMMAND_VISIBILITY_CONTRACTS.filter((entry) => entry.tier !== "internal" && TIER_ORDER[entry.tier] <= maximum).map((entry) => entry.command);
97
190
  }
191
+ /** Return commands in one capability family, preserving contract order. */
192
+ export function listPmCommandsForFamily(family) {
193
+ return PM_COMMAND_CAPABILITY_CONTRACTS.filter((entry) => entry.family === family).map((entry) => entry.command);
194
+ }
98
195
  /** Mapping from one narrow MCP tool to the command contract that tiers it. */
99
196
  export const PM_MCP_TOOL_COMMAND_CONTRACTS = Object.freeze({
100
197
  pm_append: "append",
@@ -217,17 +314,17 @@ export const PM_MCP_PROMPT_CONTRACTS = Object.freeze([
217
314
  ]);
218
315
  /** Render the generated command visibility reference used by docs drift gates. */
219
316
  export function renderPmCommandVisibilityMarkdown() {
220
- const rows = PM_COMMAND_VISIBILITY_CONTRACTS.map(({ command, tier }) => `| \`${command}\` | ${tier} |`);
317
+ const rows = PM_COMMAND_CAPABILITY_CONTRACTS.map(({ command, tier, family }) => `| \`${command}\` | ${tier} | ${family} |`);
221
318
  return [
222
319
  "# Generated agent command surface",
223
320
  "",
224
- "This file is generated from `PM_COMMAND_VISIBILITY_CONTRACTS`. Do not edit it manually.",
321
+ "This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.",
225
322
  "",
226
- "| Command | Minimum visibility tier |",
227
- "| --- | --- |",
323
+ "| Command | Minimum visibility tier | Capability family |",
324
+ "| --- | --- | --- |",
228
325
  ...rows,
229
326
  "",
230
327
  ].join("\n");
231
328
  }
232
329
  //# sourceMappingURL=agent-capability-contracts.js.map
233
- //# debugId=6fc2cd04-2fe4-5a0e-944d-fab0f86509e2
330
+ //# debugId=dd74bc56-9971-59b9-8d2b-a6cc78b0a650
@@ -10,7 +10,7 @@
10
10
  * are intentionally absent from default help and completion discovery.
11
11
  */
12
12
 
13
- !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]="cde15ba9-270e-5e05-baba-7dafbe1bd5da")}catch(e){}}();
13
+ !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]="9afc5057-afcd-5d6c-a4c1-c2883640fc50")}catch(e){}}();
14
14
  export const PM_COMMAND_ALIAS_CONTRACTS = [
15
15
  ...[
16
16
  ["fetch", "get"],
@@ -29,6 +29,22 @@ export const PM_COMMAND_ALIAS_CONTRACTS = [
29
29
  registration: "bootstrap",
30
30
  owner: "pm-pbyu",
31
31
  })),
32
+ ...[
33
+ ["extension list", "extension catalog"],
34
+ ["extension scaffold", "extension init"],
35
+ ["package list", "package catalog"],
36
+ ["package scaffold", "package init"],
37
+ ["packages list", "packages catalog"],
38
+ ["packages scaffold", "packages init"],
39
+ ].map(([alias, canonical]) => ({
40
+ alias,
41
+ canonical,
42
+ canonical_argv: canonical.split(" "),
43
+ lifecycle: "permanent",
44
+ hidden: false,
45
+ registration: "commander",
46
+ owner: "pm-ya7x55",
47
+ })),
32
48
  {
33
49
  alias: "list-all",
34
50
  canonical: "list",
@@ -67,4 +83,4 @@ export function renderPmCommandAliasMigrationHint(contract) {
67
83
  return `Deprecated command \`${contract.alias}\`; use \`pm ${contract.canonical_argv.join(" ")}\`.`;
68
84
  }
69
85
  //# sourceMappingURL=command-aliases.js.map
70
- //# debugId=cde15ba9-270e-5e05-baba-7dafbe1bd5da
86
+ //# debugId=9afc5057-afcd-5d6c-a4c1-c2883640fc50
@@ -1,6 +1,6 @@
1
1
  /** Creates commander option registration contracts using the validated operation inputs. */
2
2
 
3
- !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]="f7e87e15-b5f3-53ab-86e2-768e94d5d329")}catch(e){}}();
3
+ !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]="93ce68bd-3140-5361-a6d0-bc60c7304a29")}catch(e){}}();
4
4
  export const CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS = [
5
5
  {
6
6
  target: "title",
@@ -501,17 +501,29 @@ export const CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS = [
501
501
  },
502
502
  {
503
503
  target: "file",
504
- keys: ["file"],
504
+ keys: ["file", "linkedFile"],
505
505
  option: "--file <value>",
506
506
  description: "Seed linked file entry (CSV/markdown pairs or - for stdin; repeatable)",
507
507
  repeatable: true,
508
+ aliasOptions: [
509
+ {
510
+ option: "--linked-file <value>",
511
+ description: "Alias for --file (cross-surface name)",
512
+ },
513
+ ],
508
514
  },
509
515
  {
510
516
  target: "test",
511
- keys: ["test"],
517
+ keys: ["test", "linkedTest"],
512
518
  option: "--test <value>",
513
519
  description: "Seed linked test entry (CSV/markdown pairs or - for stdin; repeatable)",
514
520
  repeatable: true,
521
+ aliasOptions: [
522
+ {
523
+ option: "--linked-test <value>",
524
+ description: "Alias for --test (cross-surface name)",
525
+ },
526
+ ],
515
527
  },
516
528
  {
517
529
  target: "doc",
@@ -989,17 +1001,29 @@ export const UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS = [
989
1001
  },
990
1002
  {
991
1003
  target: "file",
992
- keys: ["file"],
1004
+ keys: ["file", "linkedFile"],
993
1005
  option: "--file <value>",
994
1006
  description: "Append linked file path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",
995
1007
  repeatable: true,
1008
+ aliasOptions: [
1009
+ {
1010
+ option: "--linked-file <value>",
1011
+ description: "Alias for --file (cross-surface name)",
1012
+ },
1013
+ ],
996
1014
  },
997
1015
  {
998
1016
  target: "test",
999
- keys: ["test"],
1017
+ keys: ["test", "linkedTest"],
1000
1018
  option: "--test <value>",
1001
1019
  description: "Append linked test command=<value>,path=<value>,scope=<project|global>,timeout_seconds=<n>,pm_context_mode=<schema|tracker|auto> (also accepts markdown pairs and - for stdin; repeatable)",
1002
1020
  repeatable: true,
1021
+ aliasOptions: [
1022
+ {
1023
+ option: "--linked-test <value>",
1024
+ description: "Alias for --test (cross-surface name)",
1025
+ },
1026
+ ],
1003
1027
  },
1004
1028
  {
1005
1029
  target: "doc",
@@ -1055,4 +1079,4 @@ export const UPDATE_COMMANDER_STRING_OPTION_CONTRACTS = UPDATE_COMMANDER_OPTION_
1055
1079
  /** Public contract for update commander repeatable option contracts, shared by SDK and presentation-layer consumers. */
1056
1080
  export const UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS = UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS.filter((entry) => entry.repeatable === true).map((entry) => ({ target: entry.target, keys: entry.keys }));
1057
1081
  //# sourceMappingURL=commander-mutation-options.js.map
1058
- //# debugId=f7e87e15-b5f3-53ab-86e2-768e94d5d329
1082
+ //# debugId=93ce68bd-3140-5361-a6d0-bc60c7304a29
@@ -1,6 +1,6 @@
1
1
  /** Public contract for list commander string option contracts, shared by SDK and presentation-layer consumers. */
2
2
 
3
- !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]="3b9b9ebe-8d98-5983-8257-b7b77c7e6194")}catch(e){}}();
3
+ !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]="5f56c4ef-58e1-5cf6-a10e-dfa29b9ad3e8")}catch(e){}}();
4
4
  export const LIST_COMMANDER_STRING_OPTION_CONTRACTS = [
5
5
  { target: "status", keys: ["status"] },
6
6
  { target: "type", keys: ["type"] },
@@ -147,13 +147,14 @@ export function readFirstValueFromCommanderOptions(options, contract) {
147
147
  }
148
148
  /** Implements read string array from commander options for the public runtime surface of this module. */
149
149
  export function readStringArrayFromCommanderOptions(options, contract) {
150
+ const values = [];
150
151
  for (const key of contract.keys) {
151
152
  const candidate = options[key];
152
153
  if (Array.isArray(candidate)) {
153
- return candidate;
154
+ values.push(...candidate.filter((value) => typeof value === "string"));
154
155
  }
155
156
  }
156
- return undefined;
157
+ return values.length > 0 ? values : undefined;
157
158
  }
158
159
  //# sourceMappingURL=commander-types.js.map
159
- //# debugId=3b9b9ebe-8d98-5983-8257-b7b77c7e6194
160
+ //# debugId=5f56c4ef-58e1-5cf6-a10e-dfa29b9ad3e8
@@ -1,3 +1,4 @@
1
+ import { type PmPositionalActionContract } from "./grammar-contracts.js";
1
2
  /** A single CLI flag's contract: its canonical `--flag`, optional short form, aliases, value metadata, and repeat/list semantics. One source of truth shared by Commander registration, argv normalization, shell completion, and the `pm contracts` command so every surface agrees on the flag vocabulary. */
2
3
  export interface CliFlagContract {
3
4
  /** Value that configures or reports flag for this contract. */
@@ -214,6 +215,10 @@ export declare const CONTRACTS_FLAG_CONTRACTS: CliFlagContract[];
214
215
  export declare const COMPLETION_FLAG_CONTRACTS: CliFlagContract[];
215
216
  /** Deduplicates flag contracts by their `flag`/`short`/`aliases` identity, preserving first-seen order. Used when merging the shared subcommand-global flags into a command's own contracts so a flag declared by both surfaces is registered only once. */
216
217
  export declare function toUniqueFlagContracts(contracts: CliFlagContract[]): CliFlagContract[];
218
+ /** Resolve every positional action's accepted flags against one parent contract. */
219
+ export declare function resolvePmPositionalActionFlagContracts(actions?: readonly PmPositionalActionContract[]): Array<readonly [string, CliFlagContract[]]>;
220
+ /** Validated positional action flag entries shared by registration and contracts. */
221
+ export declare const PM_POSITIONAL_ACTION_FLAG_CONTRACTS: (readonly [string, CliFlagContract[]])[];
217
222
  /** Returns whether a normalized command path owns a concrete core flag-contract row. Surface-less commands such as `help` intentionally return false, while positional virtual paths such as `workspace snapshot create` return true. */
218
223
  export declare function hasSubcommandFlagContractsForCommand(commandName: string | undefined): boolean;
219
224
  /** Resolves the flag contracts a given command (or list/extension subcommand) accepts, merged with the shared subcommand-global flags. Returns the global set for unknown or surface-less commands so completion and validation degrade gracefully. */
@@ -7,9 +7,10 @@
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]="1d9df714-a6dc-5dc3-b2ff-c9325f91a443")}catch(e){}}();
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]="505e9b6b-a62a-5981-8862-619624246170")}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
+ import { PM_POSITIONAL_ACTION_CONTRACTS, } from "./grammar-contracts.js";
13
14
  function normalizeFlagAliasKey(flag) {
14
15
  if (!flag.startsWith("--")) {
15
16
  return flag;
@@ -1139,8 +1140,8 @@ export const CREATE_FLAG_CONTRACTS = [
1139
1140
  { flag: "--comment" },
1140
1141
  { flag: "--note" },
1141
1142
  { flag: "--learning" },
1142
- { flag: "--file" },
1143
- { flag: "--test" },
1143
+ { flag: "--file", aliases: ["--linked-file"] },
1144
+ { flag: "--test", aliases: ["--linked-test"] },
1144
1145
  { flag: "--doc" },
1145
1146
  { flag: "--unset" },
1146
1147
  { flag: "--clear-deps" },
@@ -1240,8 +1241,8 @@ export const UPDATE_FLAG_CONTRACTS = [
1240
1241
  { flag: "--comment" },
1241
1242
  { flag: "--note" },
1242
1243
  { flag: "--learning" },
1243
- { flag: "--file" },
1244
- { flag: "--test" },
1244
+ { flag: "--file", aliases: ["--linked-file"] },
1245
+ { flag: "--test", aliases: ["--linked-test"] },
1245
1246
  { flag: "--doc" },
1246
1247
  { flag: "--reminder" },
1247
1248
  { flag: "--event" },
@@ -1636,7 +1637,33 @@ export function toUniqueFlagContracts(contracts) {
1636
1637
  return unique;
1637
1638
  }
1638
1639
  function withSubcommandGlobalFlags(contracts) {
1639
- return withFlagAliasMetadata(toUniqueFlagContracts([...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, ...contracts]));
1640
+ const byCanonicalFlag = new Map();
1641
+ for (const contract of [...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, ...contracts]) {
1642
+ const canonicalFlag = normalizeFlagAliasKey(contract.flag);
1643
+ const prior = byCanonicalFlag.get(canonicalFlag);
1644
+ const { aliases: declaredAliases, ...contractWithoutAliases } = contract;
1645
+ const aliases = normalizeUniqueStringList([
1646
+ ...(declaredAliases ?? []),
1647
+ ...(contract.flag === canonicalFlag ? [] : [contract.flag]),
1648
+ ]).filter((alias) => alias !== canonicalFlag);
1649
+ const normalizedContract = {
1650
+ ...contractWithoutAliases,
1651
+ flag: canonicalFlag,
1652
+ ...(aliases.length > 0 ? { aliases } : {}),
1653
+ };
1654
+ const mergedAliases = normalizeUniqueStringList([
1655
+ ...(prior?.aliases ?? []),
1656
+ ...(normalizedContract.aliases ?? []),
1657
+ ]);
1658
+ byCanonicalFlag.set(canonicalFlag, prior === undefined
1659
+ ? normalizedContract
1660
+ : {
1661
+ ...prior,
1662
+ ...normalizedContract,
1663
+ ...(mergedAliases.length > 0 ? { aliases: mergedAliases } : {}),
1664
+ });
1665
+ }
1666
+ return withFlagAliasMetadata([...byCanonicalFlag.values()]);
1640
1667
  }
1641
1668
  const FIXED_STATUS_LIST_COMMAND_ALIASES = [
1642
1669
  "list-draft",
@@ -1648,6 +1675,43 @@ const FIXED_STATUS_LIST_COMMAND_ALIASES = [
1648
1675
  ];
1649
1676
  const FIXED_STATUS_LIST_FLAG_CONTRACTS = LIST_FILTER_FLAG_CONTRACTS.filter((contract) => contract.flag !== "--status" && contract.flag !== "--all");
1650
1677
  const ALL_STATUS_LIST_FLAG_CONTRACTS = LIST_FILTER_FLAG_CONTRACTS.filter((contract) => contract.flag !== "--status");
1678
+ function indexCliFlagContracts(contracts) {
1679
+ const index = new Map();
1680
+ for (const contract of contracts) {
1681
+ for (const spelling of [contract.flag, ...(contract.aliases ?? [])]) {
1682
+ const matches = index.get(spelling) ?? [];
1683
+ matches.push(contract);
1684
+ index.set(spelling, matches);
1685
+ }
1686
+ }
1687
+ return index;
1688
+ }
1689
+ const PLAN_FLAG_CONTRACT_INDEX = indexCliFlagContracts(PLAN_FLAG_CONTRACTS);
1690
+ const ASSURANCE_FLAG_CONTRACT_INDEX = indexCliFlagContracts(ASSURANCE_FLAG_CONTRACTS);
1691
+ const POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT = new Map([
1692
+ ["assurance", ASSURANCE_FLAG_CONTRACT_INDEX],
1693
+ ["plan", PLAN_FLAG_CONTRACT_INDEX],
1694
+ ["workspace snapshot", indexCliFlagContracts(WORKSPACE_FLAG_CONTRACTS)],
1695
+ ]);
1696
+ /** Resolve every positional action's accepted flags against one parent contract. */
1697
+ export function resolvePmPositionalActionFlagContracts(actions = PM_POSITIONAL_ACTION_CONTRACTS) {
1698
+ return actions.map(({ command, parent, accepted_flags: acceptedFlags }) => {
1699
+ const parentFlagIndex = POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT.get(parent);
1700
+ if (!parentFlagIndex) {
1701
+ throw new Error(`Positional action ${command} has no flag-contract index for ${parent}.`);
1702
+ }
1703
+ const selected = acceptedFlags.map((acceptedFlag) => {
1704
+ const matches = parentFlagIndex.get(acceptedFlag) ?? [];
1705
+ if (matches.length !== 1) {
1706
+ throw new Error(`Positional action ${command} accepted flag ${acceptedFlag} does not resolve to exactly one ${parent} flag contract.`);
1707
+ }
1708
+ return matches[0];
1709
+ });
1710
+ return [command, selected];
1711
+ });
1712
+ }
1713
+ /** Validated positional action flag entries shared by registration and contracts. */
1714
+ export const PM_POSITIONAL_ACTION_FLAG_CONTRACTS = resolvePmPositionalActionFlagContracts();
1651
1715
  // Single-token command (plus the `list`/`cal`/`ctx`/`templates` aliases) → its
1652
1716
  // dedicated flag-contract table. Lookups fall back to the subcommand-global set,
1653
1717
  // so tokens absent here (`reindex`, `help`, or any unknown command) degrade to
@@ -1723,6 +1787,7 @@ const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
1723
1787
  ["telemetry", TELEMETRY_FLAG_CONTRACTS],
1724
1788
  ["health", HEALTH_FLAG_CONTRACTS],
1725
1789
  ["assurance", ASSURANCE_FLAG_CONTRACTS],
1790
+ ...PM_POSITIONAL_ACTION_FLAG_CONTRACTS,
1726
1791
  ["validate", VALIDATE_FLAG_CONTRACTS],
1727
1792
  ["gc", GC_FLAG_CONTRACTS],
1728
1793
  ["stats", STATS_FLAG_CONTRACTS],
@@ -1751,6 +1816,7 @@ const EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND = new Map([
1751
1816
  ["reload", EXTENSION_RELOAD_FLAG_CONTRACTS],
1752
1817
  ["doctor", EXTENSION_DOCTOR_FLAG_CONTRACTS],
1753
1818
  ["catalog", EXTENSION_CATALOG_FLAG_CONTRACTS],
1819
+ ["list", EXTENSION_CATALOG_FLAG_CONTRACTS],
1754
1820
  ["adopt", EXTENSION_ADOPT_FLAG_CONTRACTS],
1755
1821
  ["adopt-all", EXTENSION_ADOPT_ALL_FLAG_CONTRACTS],
1756
1822
  ["activate", EXTENSION_ACTIVATE_FLAG_CONTRACTS],
@@ -1776,11 +1842,12 @@ export function hasSubcommandFlagContractsForCommand(commandName) {
1776
1842
  lifecycleSubcommand !== undefined &&
1777
1843
  extraParts.length === 0 &&
1778
1844
  (lifecycleSubcommand === "init" ||
1845
+ lifecycleSubcommand === "scaffold" ||
1779
1846
  EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND.has(lifecycleSubcommand)));
1780
1847
  }
1781
1848
  /** Resolves the flag contracts an `extension`/`package <subcommand>` lifecycle invocation accepts. `init` carries the package-only `--declarative` flag, so `package`/`packages init` resolve to the package init table while `extension init` resolves to the extension init table; every other lifecycle subcommand shares one table, and an unknown subcommand falls back to globals-only. */
1782
1849
  function resolveExtensionLifecycleFlagContracts(rootCommand, lifecycleSubcommand) {
1783
- if (lifecycleSubcommand === "init") {
1850
+ if (lifecycleSubcommand === "init" || lifecycleSubcommand === "scaffold") {
1784
1851
  // `--declarative` is package-only, so `package init` / `packages init` carry it.
1785
1852
  return rootCommand === "extension"
1786
1853
  ? EXTENSION_INIT_FLAG_CONTRACTS
@@ -1825,4 +1892,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1825
1892
  return normalizeUniqueStringList(all).join(" ");
1826
1893
  }
1827
1894
  //# sourceMappingURL=flag-contracts.js.map
1828
- //# debugId=1d9df714-a6dc-5dc3-b2ff-c9325f91a443
1895
+ //# debugId=505e9b6b-a62a-5981-8862-619624246170