@unbrained/pm-cli 2026.8.19 → 2026.8.21

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 (229) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +41 -0
  3. package/dist/cli/error-guidance.d.ts +20 -0
  4. package/dist/cli/error-guidance.js +29 -30
  5. package/dist/cli/register-list-query.js +12 -10
  6. package/dist/cli/register-structured-mutation.d.ts +2 -0
  7. package/dist/cli/register-structured-mutation.js +29 -6
  8. package/dist/cli-bundle/bundle-manifest.json +156 -148
  9. package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +197 -0
  10. package/dist/cli-bundle/chunks/{chunk-4NRRH7AM.js → chunk-3AFAUHUE.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-7VHZS727.js +5 -0
  12. package/dist/cli-bundle/chunks/chunk-BKYB45NQ.js +2092 -0
  13. package/dist/cli-bundle/chunks/{chunk-BHYMXLAE.js → chunk-BUNIEJNE.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-QXSH7BLM.js → chunk-JSLOFXGA.js} +3 -3
  15. package/dist/cli-bundle/chunks/chunk-LARJJ3RK.js +3 -0
  16. package/dist/cli-bundle/chunks/{chunk-TOXJM4WA.js → chunk-LOVTQ52Z.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-N3DSV4CH.js +77 -0
  18. package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +35 -0
  19. package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +13 -0
  20. package/dist/cli-bundle/chunks/register-list-query-F57EWDEF.js +11 -0
  21. package/dist/cli-bundle/chunks/{register-mutation-AUWVCW4M.js → register-mutation-7IY2D5KO.js} +20 -20
  22. package/dist/cli-bundle/chunks/{register-operations-PZQPHXW5.js → register-operations-FALL3YTU.js} +2 -2
  23. package/dist/cli-bundle/chunks/{register-setup-I4LUHGVW.js → register-setup-HXU7IZZD.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/chunk-2NIY5NKG.js +18 -0
  25. package/dist/cli-bundle/focused-chunks/{chunk-US7VEYZG.js → chunk-4ERLO7QD.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +50 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-MCZXYZAF.js → chunk-CKKQSJNN.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +16 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-ZBIQQYMI.js → chunk-F2A56DHV.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-ESISGDAY.js → chunk-F4YEW5I2.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-ODHQEECS.js → chunk-FH6DYED3.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-FJ22HNRP.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-JEAVFOWM.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-EXBCLIBU.js → chunk-KDNG7TKQ.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +155 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-JDOMQ7VQ.js → chunk-TJ7EMJ46.js} +3 -3
  39. package/dist/cli-bundle/focused-chunks/chunk-UZE7XUZK.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-DKPLYW3L.js → chunk-YKBKIEAJ.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-VXDSU5MC.js → chunk-ZOSEELYJ.js} +2 -2
  42. package/dist/cli-bundle/main.js +12 -12
  43. package/dist/cli-bundle/sdk-authoring.js +1 -1
  44. package/dist/cli-bundle/sdk-contracts.js +2 -2
  45. package/dist/cli-bundle/sdk-core.js +41 -41
  46. package/dist/cli-bundle/sdk-governance.js +1 -1
  47. package/dist/cli-bundle/sdk-graph.js +1 -1
  48. package/dist/cli-bundle/sdk-merge.js +32 -32
  49. package/dist/cli-bundle/sdk-query.js +1 -1
  50. package/dist/cli-bundle/sdk-runtime.js +1 -1
  51. package/dist/cli-bundle/sdk-testing.js +1 -1
  52. package/dist/cli-bundle/sdk.js +5 -5
  53. package/dist/core/output/mutation-projection.js +26 -2
  54. package/dist/core/shared/constants.d.ts +1 -5
  55. package/dist/core/shared/constants.js +3 -81
  56. package/dist/core/shared/errors.d.ts +16 -0
  57. package/dist/core/shared/errors.js +2 -2
  58. package/dist/core/shared/item-metadata-contract.d.ts +14 -0
  59. package/dist/core/shared/item-metadata-contract.js +90 -0
  60. package/dist/core/store/item-store.d.ts +60 -0
  61. package/dist/core/store/item-store.js +26 -94
  62. package/dist/core/store/tracker-preflight.d.ts +7 -0
  63. package/dist/core/store/tracker-preflight.js +142 -0
  64. package/dist/sdk/agent/closed-domain-contracts.d.ts +25 -0
  65. package/dist/sdk/agent/closed-domain-contracts.js +140 -0
  66. package/dist/sdk/agent/refusal-closure.d.ts +13 -1
  67. package/dist/sdk/agent/refusal-closure.js +45 -3
  68. package/dist/sdk/agent/refusal-reachability.d.ts +26 -0
  69. package/dist/sdk/agent/refusal-reachability.js +26 -2
  70. package/dist/sdk/agent/tracker-preflight-contracts.d.ts +63 -0
  71. package/dist/sdk/agent/tracker-preflight-contracts.js +127 -0
  72. package/dist/sdk/agent-capability-contracts.js +6 -11
  73. package/dist/sdk/annotations.js +6 -7
  74. package/dist/sdk/cli-contracts/completeness.js +8 -2
  75. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -2
  76. package/dist/sdk/cli-contracts/enum-contracts.js +16 -6
  77. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  78. package/dist/sdk/cli-contracts/flag-contracts.js +11 -2
  79. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +19 -2
  80. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +105 -5
  81. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +2 -2
  82. package/dist/sdk/cli-contracts/grammar-contracts.js +5 -2
  83. package/dist/sdk/cli-contracts/runtime-contracts.js +7 -3
  84. package/dist/sdk/cli-contracts/tool-schema.js +7 -2
  85. package/dist/sdk/cli-contracts.d.ts +2 -2
  86. package/dist/sdk/cli-contracts.js +4 -4
  87. package/dist/sdk/config.d.ts +5 -0
  88. package/dist/sdk/config.js +5 -5
  89. package/dist/sdk/context-intent-runtime.js +7 -4
  90. package/dist/sdk/contracts.d.ts +2 -0
  91. package/dist/sdk/contracts.js +4 -2
  92. package/dist/sdk/core.d.ts +1 -1
  93. package/dist/sdk/core.js +3 -3
  94. package/dist/sdk/dependencies.js +5 -7
  95. package/dist/sdk/dependency-flag-validation.d.ts +1 -1
  96. package/dist/sdk/dependency-flag-validation.js +10 -4
  97. package/dist/sdk/environment/tracker-preflight.d.ts +6 -0
  98. package/dist/sdk/environment/tracker-preflight.js +10 -0
  99. package/dist/sdk/eval.js +5 -7
  100. package/dist/sdk/files.js +6 -10
  101. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +110 -2
  102. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +179 -46
  103. package/dist/sdk/governance/assurance.d.ts +36 -2
  104. package/dist/sdk/governance/assurance.js +184 -10
  105. package/dist/sdk/governance/gc.js +5 -6
  106. package/dist/sdk/governance/health.js +5 -6
  107. package/dist/sdk/governance/reindex.js +5 -6
  108. package/dist/sdk/governance/validate.d.ts +1 -2
  109. package/dist/sdk/governance/validate.js +6 -12
  110. package/dist/sdk/graph/governance.d.ts +7 -5
  111. package/dist/sdk/graph/governance.js +32 -16
  112. package/dist/sdk/graph/run.js +5 -7
  113. package/dist/sdk/graph/traversal.js +14 -5
  114. package/dist/sdk/history-compact.js +6 -9
  115. package/dist/sdk/history-read.js +5 -7
  116. package/dist/sdk/history-redact.js +5 -6
  117. package/dist/sdk/history-repair.js +6 -9
  118. package/dist/sdk/improvement-ledger.js +7 -10
  119. package/dist/sdk/index.d.ts +7 -3
  120. package/dist/sdk/index.js +8 -4
  121. package/dist/sdk/init-agent-guidance.d.ts +5 -3
  122. package/dist/sdk/init-agent-guidance.js +69 -9
  123. package/dist/sdk/lifecycle/append.d.ts +0 -5
  124. package/dist/sdk/lifecycle/append.js +5 -6
  125. package/dist/sdk/lifecycle/claim.d.ts +0 -5
  126. package/dist/sdk/lifecycle/claim.js +6 -9
  127. package/dist/sdk/lifecycle/close-many.d.ts +0 -5
  128. package/dist/sdk/lifecycle/close-many.js +5 -6
  129. package/dist/sdk/lifecycle/close.d.ts +0 -5
  130. package/dist/sdk/lifecycle/close.js +5 -6
  131. package/dist/sdk/lifecycle/copy.d.ts +0 -5
  132. package/dist/sdk/lifecycle/copy.js +5 -6
  133. package/dist/sdk/lifecycle/create.d.ts +0 -5
  134. package/dist/sdk/lifecycle/create.js +5 -9
  135. package/dist/sdk/lifecycle/delete.js +5 -6
  136. package/dist/sdk/lifecycle/focus.d.ts +0 -5
  137. package/dist/sdk/lifecycle/focus.js +5 -6
  138. package/dist/sdk/lifecycle/mcp-actions.d.ts +18 -0
  139. package/dist/sdk/lifecycle/mcp-actions.js +52 -0
  140. package/dist/sdk/lifecycle/plan.d.ts +0 -5
  141. package/dist/sdk/lifecycle/plan.js +5 -6
  142. package/dist/sdk/lifecycle/reopen.d.ts +44 -0
  143. package/dist/sdk/lifecycle/reopen.js +69 -0
  144. package/dist/sdk/lifecycle/restore.js +5 -6
  145. package/dist/sdk/lifecycle/update-many.d.ts +0 -5
  146. package/dist/sdk/lifecycle/update-many.js +5 -6
  147. package/dist/sdk/lifecycle/update.d.ts +31 -5
  148. package/dist/sdk/lifecycle/update.js +140 -19
  149. package/dist/sdk/linked-artifacts.js +6 -7
  150. package/dist/sdk/merge/install.js +5 -6
  151. package/dist/sdk/mutation-events.js +5 -7
  152. package/dist/sdk/package-import-adapters.js +6 -8
  153. package/dist/sdk/profile.js +6 -7
  154. package/dist/sdk/query/activity.js +5 -6
  155. package/dist/sdk/query/calendar.js +5 -6
  156. package/dist/sdk/query/get.d.ts +1 -6
  157. package/dist/sdk/query/get.js +20 -55
  158. package/dist/sdk/query/history.d.ts +0 -5
  159. package/dist/sdk/query/history.js +5 -6
  160. package/dist/sdk/query/list.d.ts +7 -21
  161. package/dist/sdk/query/list.js +38 -54
  162. package/dist/sdk/query/projection-contracts.d.ts +33 -0
  163. package/dist/sdk/query/projection-contracts.js +185 -0
  164. package/dist/sdk/query/search-contracts.d.ts +2 -1
  165. package/dist/sdk/query/search-contracts.js +18 -87
  166. package/dist/sdk/query/search.d.ts +15 -0
  167. package/dist/sdk/query/search.js +34 -10
  168. package/dist/sdk/relationship-kinds/contract.d.ts +8 -0
  169. package/dist/sdk/relationship-kinds/contract.js +13 -13
  170. package/dist/sdk/relationships.d.ts +1 -1
  171. package/dist/sdk/relationships.js +20 -2
  172. package/dist/sdk/runtime-primitives.d.ts +1 -1
  173. package/dist/sdk/runtime-primitives.js +3 -3
  174. package/dist/sdk/runtime.d.ts +6 -0
  175. package/dist/sdk/runtime.js +18 -14
  176. package/dist/sdk/schema-migration.js +6 -7
  177. package/dist/sdk/schema.js +5 -6
  178. package/dist/sdk/similarity.d.ts +13 -0
  179. package/dist/sdk/similarity.js +32 -6
  180. package/dist/sdk/stats.js +5 -8
  181. package/dist/sdk/templates.js +5 -6
  182. package/dist/sdk/test/batch.js +5 -7
  183. package/dist/sdk/test/execution.js +4 -5
  184. package/dist/sdk/test/runs.js +5 -7
  185. package/docs/AGENT_UX_CONTRACTS.md +8 -1
  186. package/docs/COMMANDS.md +13 -1
  187. package/docs/DEPENDENCY_KIND_CONTRACT.md +12 -1
  188. package/docs/README.md +1 -0
  189. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +151 -0
  190. package/docs/RELATIONSHIP_GRAPH.md +92 -10
  191. package/docs/SDK.md +10 -2
  192. package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
  193. package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
  194. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
  195. package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
  196. package/marketplace.json +2 -2
  197. package/package.json +5 -5
  198. package/packages/pm-beads/package.json +1 -1
  199. package/packages/pm-calendar/package.json +1 -1
  200. package/packages/pm-command-kit/package.json +1 -1
  201. package/packages/pm-digital-twin/package.json +1 -1
  202. package/packages/pm-governance-audit/package.json +1 -1
  203. package/packages/pm-guide-shell/package.json +1 -1
  204. package/packages/pm-kanban/package.json +1 -1
  205. package/packages/pm-lifecycle-hooks/package.json +1 -1
  206. package/packages/pm-linked-test-adapters/package.json +1 -1
  207. package/packages/pm-search-advanced/package.json +1 -1
  208. package/packages/pm-templates/package.json +1 -1
  209. package/packages/pm-todos/package.json +1 -1
  210. package/packages/pm-vcs/package.json +1 -1
  211. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  212. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  213. package/sdk/public-surface.json +640 -44
  214. package/dist/cli-bundle/chunks/chunk-4THEB6PD.js +0 -13
  215. package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +0 -197
  216. package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +0 -35
  217. package/dist/cli-bundle/chunks/chunk-OI4XI562.js +0 -5
  218. package/dist/cli-bundle/chunks/chunk-OIOKV6NO.js +0 -2092
  219. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
  220. package/dist/cli-bundle/chunks/chunk-YBMRWW4E.js +0 -77
  221. package/dist/cli-bundle/chunks/register-list-query-Y56KINDU.js +0 -11
  222. package/dist/cli-bundle/focused-chunks/chunk-34QBIYZI.js +0 -155
  223. package/dist/cli-bundle/focused-chunks/chunk-BJRYFVSH.js +0 -2
  224. package/dist/cli-bundle/focused-chunks/chunk-EF6ZS5GH.js +0 -50
  225. package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +0 -2
  226. package/dist/cli-bundle/focused-chunks/chunk-PRHY2IMX.js +0 -18
  227. package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +0 -2
  228. package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +0 -16
  229. package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +0 -2
@@ -0,0 +1,127 @@
1
+ /**
2
+ * @module sdk/agent/tracker-preflight-contracts
3
+ *
4
+ * Declares and scores executable recovery for tracker filesystem preflight failures.
5
+ */
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]="941a11a9-f756-56b3-9dc1-8afd78bc9328")}catch(e){}}();
8
+ const TRACKER_PREFLIGHT_RECOVERY_CONTRACTS = [
9
+ {
10
+ probe_id: "tracker-root-missing",
11
+ failure_kind: "missing_root",
12
+ expected_error_code: "tracker_root_missing",
13
+ expected_exit_code: 3,
14
+ recovery_kind: "initialize",
15
+ },
16
+ {
17
+ probe_id: "tracker-root-settings-missing",
18
+ failure_kind: "settings_missing",
19
+ expected_error_code: "tracker_not_initialized",
20
+ expected_exit_code: 3,
21
+ recovery_kind: "initialize",
22
+ },
23
+ {
24
+ probe_id: "tracker-root-not-directory",
25
+ failure_kind: "not_directory",
26
+ expected_error_code: "tracker_root_not_directory",
27
+ expected_exit_code: 2,
28
+ recovery_kind: "select_directory",
29
+ },
30
+ {
31
+ probe_id: "tracker-root-unreadable",
32
+ failure_kind: "unreadable_root",
33
+ expected_error_code: "tracker_root_unreadable",
34
+ expected_exit_code: 1,
35
+ recovery_kind: "repair_permissions",
36
+ },
37
+ ];
38
+ /** Return defensive copies of every core tracker preflight recovery contract. */
39
+ export function listTrackerPreflightRecoveryContracts() {
40
+ return TRACKER_PREFLIGHT_RECOVERY_CONTRACTS.map((contract) => ({
41
+ ...contract,
42
+ }));
43
+ }
44
+ function findTrackerPreflightObservationFindings(contract, observation) {
45
+ const findings = [];
46
+ if (observation.error_code !== contract.expected_error_code) {
47
+ findings.push({
48
+ code: "error_code_mismatch",
49
+ probe_id: contract.probe_id,
50
+ detail: `Expected ${contract.expected_error_code}, received ${observation.error_code}.`,
51
+ });
52
+ }
53
+ if (observation.exit_code !== contract.expected_exit_code) {
54
+ findings.push({
55
+ code: "exit_code_mismatch",
56
+ probe_id: contract.probe_id,
57
+ detail: `Expected exit ${contract.expected_exit_code}, received ${observation.exit_code}.`,
58
+ });
59
+ }
60
+ if (observation.recovery_kind !== contract.recovery_kind) {
61
+ findings.push({
62
+ code: "recovery_kind_mismatch",
63
+ probe_id: contract.probe_id,
64
+ detail: `Expected ${contract.recovery_kind}, received ${observation.recovery_kind}.`,
65
+ });
66
+ }
67
+ const initIndex = observation.suggested_retry_args.indexOf("init");
68
+ const validInitCommand = initIndex === 0 ||
69
+ (initIndex === 2 &&
70
+ observation.suggested_retry_args[0] === "--pm-path" &&
71
+ observation.suggested_retry_args[1]?.length > 0);
72
+ if (contract.recovery_kind === "initialize" && !validInitCommand) {
73
+ findings.push({
74
+ code: "missing_init_recovery",
75
+ probe_id: contract.probe_id,
76
+ detail: "Missing and uninitialized roots must emit a tokenized init retry.",
77
+ });
78
+ }
79
+ if (observation.unsafe_init_recommended ||
80
+ (contract.recovery_kind !== "initialize" &&
81
+ observation.suggested_retry_args.includes("init"))) {
82
+ findings.push({
83
+ code: "unsafe_init_recovery",
84
+ probe_id: contract.probe_id,
85
+ detail: "A tracker root that cannot be initialized safely must not recommend initialization.",
86
+ });
87
+ }
88
+ if (!observation.retry_succeeded) {
89
+ findings.push({
90
+ code: "retry_failed",
91
+ probe_id: contract.probe_id,
92
+ detail: "The emitted retry or safe alternate-root recovery did not execute successfully.",
93
+ });
94
+ }
95
+ return findings;
96
+ }
97
+ /** Score runtime observations against the complete tracker preflight recovery corpus. */
98
+ export function scoreTrackerPreflightRecoveryClosure(observations) {
99
+ const observationsByProbe = new Map(observations.map((observation) => [observation.probe_id, observation]));
100
+ const findings = [];
101
+ let closedProbeCount = 0;
102
+ for (const contract of TRACKER_PREFLIGHT_RECOVERY_CONTRACTS) {
103
+ const observation = observationsByProbe.get(contract.probe_id);
104
+ if (observation === undefined) {
105
+ findings.push({
106
+ code: "missing_probe",
107
+ probe_id: contract.probe_id,
108
+ detail: "No runtime observation was supplied for this contract.",
109
+ });
110
+ continue;
111
+ }
112
+ const observationFindings = findTrackerPreflightObservationFindings(contract, observation);
113
+ findings.push(...observationFindings);
114
+ if (observationFindings.length === 0)
115
+ closedProbeCount += 1;
116
+ }
117
+ findings.sort((left, right) => left.probe_id.localeCompare(right.probe_id) ||
118
+ left.code.localeCompare(right.code));
119
+ return {
120
+ ok: findings.length === 0,
121
+ probe_count: TRACKER_PREFLIGHT_RECOVERY_CONTRACTS.length,
122
+ closed_probe_count: closedProbeCount,
123
+ findings,
124
+ };
125
+ }
126
+ //# sourceMappingURL=tracker-preflight-contracts.js.map
127
+ //# debugId=941a11a9-f756-56b3-9dc1-8afd78bc9328
@@ -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]="dd74bc56-9971-59b9-8d2b-a6cc78b0a650")}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]="5e77c121-35a2-57d1-9a3e-f33447535c03")}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",
@@ -87,6 +87,7 @@ const COMMANDS_BY_FAMILY = Object.freeze({
87
87
  "close-task",
88
88
  "delete",
89
89
  "pause-task",
90
+ "item-reopen",
90
91
  "release",
91
92
  "start-task",
92
93
  "update",
@@ -107,13 +108,7 @@ const COMMANDS_BY_FAMILY = Object.freeze({
107
108
  "notes",
108
109
  ]),
109
110
  graph: new Set(["deps", "graph", "plan"]),
110
- quality: new Set([
111
- "assurance",
112
- "contracts",
113
- "test",
114
- "test-all",
115
- "validate",
116
- ]),
111
+ quality: new Set(["assurance", "contracts", "test", "test-all", "validate"]),
117
112
  automation: new Set(["event", "meet", "remind"]),
118
113
  });
119
114
  const EXTENSION_COMMANDS = new Set([
@@ -140,7 +135,7 @@ export function resolvePmCommandCapabilityFamily(command) {
140
135
  * by normal help or completion projections.
141
136
  */
142
137
  export const PM_COMMAND_CAPABILITY_CONTRACTS = Object.freeze([
143
- ...PM_CORE_COMMAND_NAMES.map((command) => ({
138
+ ...PM_CORE_COMMAND_NAMES.flatMap((command) => command === "item" ? ["item-reopen"] : [command]).map((command) => ({
144
139
  command,
145
140
  tier: CORE_COMMANDS.has(command)
146
141
  ? "core"
@@ -181,7 +176,7 @@ const TIER_ORDER = {
181
176
  const COMMAND_TIER_BY_NAME = new Map(PM_COMMAND_VISIBILITY_CONTRACTS.map(({ command, tier }) => [command, tier]));
182
177
  /** Resolve one command's declared tier; extension commands default to standard. */
183
178
  export function resolvePmCommandVisibilityTier(command, extensionTier = "standard") {
184
- return COMMAND_TIER_BY_NAME.get(command.trim().toLowerCase()) ?? extensionTier;
179
+ return (COMMAND_TIER_BY_NAME.get(command.trim().toLowerCase()) ?? extensionTier);
185
180
  }
186
181
  /** Return commands visible at a requested tier, preserving contract order. */
187
182
  export function listPmCommandsForTier(tier) {
@@ -327,4 +322,4 @@ export function renderPmCommandVisibilityMarkdown() {
327
322
  ].join("\n");
328
323
  }
329
324
  //# sourceMappingURL=agent-capability-contracts.js.map
330
- //# debugId=dd74bc56-9971-59b9-8d2b-a6cc78b0a650
325
+ //# debugId=5e77c121-35a2-57d1-9a3e-f33447535c03
@@ -4,9 +4,10 @@
4
4
  * Implements the pm annotation command command surface and its agent-facing runtime behavior.
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]="0af9967c-ca72-563a-9518-2e68da0c0fe0")}catch(e){}}();
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]="eac75dc5-80b4-50d2-b615-4f96edca7346")}catch(e){}}();
8
+ import { assertInitializedTracker } from "./environment/tracker-preflight.js";
8
9
  import { readFile } from "node:fs/promises";
9
- import { isFileAbsentError, pathExists } from "../core/fs/fs-utils.js";
10
+ import { isFileAbsentError } from "../core/fs/fs-utils.js";
10
11
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
11
12
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
12
13
  import { createStdinTokenResolver, parseCsvKv } from "../core/item/parse.js";
@@ -16,7 +17,7 @@ import { parseLimit } from "../core/shared/numeric-parsers.js";
16
17
  import { nowIso } from "../core/shared/time.js";
17
18
  import { resolveAuthor } from "../core/shared/author.js";
18
19
  import { locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
19
- import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
20
+ import { resolvePmRoot } from "../core/store/paths.js";
20
21
  import { readSettings } from "../core/store/settings.js";
21
22
  /** Map transport-level `full` onto the SDK annotation history option. */
22
23
  export function normalizeAnnotationTransportOptions(options) {
@@ -215,9 +216,7 @@ function assertAnnotationMessageHasTextSource(config, options) {
215
216
  export async function runAnnotationCommand(id, options, global, config) {
216
217
  assertAnnotationMessageHasTextSource(config, options);
217
218
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
218
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
219
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
220
- }
219
+ await assertInitializedTracker(pmRoot);
221
220
  const settings = await readSettings(pmRoot);
222
221
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
223
222
  const limit = parseLimit(options.limit);
@@ -399,4 +398,4 @@ function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMet
399
398
  };
400
399
  }
401
400
  //# sourceMappingURL=annotations.js.map
402
- //# debugId=0af9967c-ca72-563a-9518-2e68da0c0fe0
401
+ //# debugId=eac75dc5-80b4-50d2-b615-4f96edca7346
@@ -7,7 +7,7 @@
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]="8b227cb2-a30d-5384-b9c2-558603181c67")}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]="f4e5eed5-94c2-536a-8685-e20b735de480")}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";
@@ -63,6 +63,8 @@ const CLI_CONFIG_SHORTHAND_FLAGS = new Set([
63
63
  ]);
64
64
  const SDK_TRANSPORT_PARAMETERS = new Set([
65
65
  "action",
66
+ "fullChangedFields",
67
+ "idOnly",
66
68
  "path",
67
69
  "pmExecutable",
68
70
  "timeoutMs",
@@ -87,6 +89,7 @@ const ACTION_POSITIONAL_PARAMETERS = {
87
89
  event: { title: "<title>" },
88
90
  files: { lookupPath: "lookup <path...>" },
89
91
  meet: { title: "<title>" },
92
+ "item-reopen": { id: "<id>", reason: "<reason>" },
90
93
  merge: { subcommand: "<subcommand>" },
91
94
  remind: { title: "<title>" },
92
95
  workspace: {
@@ -188,6 +191,9 @@ function actionCommand(action) {
188
191
  if (action.startsWith("package-")) {
189
192
  return `package ${action.slice("package-".length)}`;
190
193
  }
194
+ if (action.startsWith("item-")) {
195
+ return `item ${action.slice("item-".length)}`;
196
+ }
191
197
  return action;
192
198
  }
193
199
  function parameterForFlag(action, flag) {
@@ -384,4 +390,4 @@ export function analyzeSdkCliParameterCompleteness(source = {}) {
384
390
  });
385
391
  }
386
392
  //# sourceMappingURL=completeness.js.map
387
- //# debugId=8b227cb2-a30d-5384-b9c2-558603181c67
393
+ //# debugId=f4e5eed5-94c2-536a-8685-e20b735de480
@@ -30,17 +30,19 @@ export declare const GRAPH_SUBCOMMAND_VALUES: readonly ["ancestors", "descendant
30
30
  export type GraphSubcommand = (typeof GRAPH_SUBCOMMAND_VALUES)[number];
31
31
  /** Nested lifecycle verbs flattened by SDK and MCP package actions. */
32
32
  export declare const PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS: readonly ["init", "install", "uninstall", "explore", "manage", "describe", "reload", "doctor", "catalog", "adopt", "adopt-all", "activate", "deactivate"];
33
+ /** Noun-first item lifecycle verbs flattened for SDK and MCP dispatch. */
34
+ export declare const PM_ITEM_ACTION_SUBCOMMANDS: readonly ["reopen"];
33
35
  /** CLI-only presentation commands intentionally omitted from programmatic actions. */
34
36
  export declare const PM_CLI_ONLY_TOOL_ACTION_WAIVERS: {
35
37
  readonly help: "Commander help rendering has no SDK operation result.";
36
- readonly item: "The item namespace only groups lifecycle subcommands already exposed as actions.";
37
38
  readonly packages: "The plural package alias only renders package-oriented help.";
38
39
  };
39
40
  type PmCoreCommandName = (typeof PM_CORE_COMMAND_NAMES)[number];
40
41
  type PmCliOnlyToolAction = keyof typeof PM_CLI_ONLY_TOOL_ACTION_WAIVERS;
41
42
  type PmExtensionPackageAction = `${"extension" | "package"}-${(typeof PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS)[number]}`;
43
+ type PmItemAction = `item-${(typeof PM_ITEM_ACTION_SUBCOMMANDS)[number]}`;
42
44
  /** Restricts pm tool action values accepted by command, SDK, and storage contracts. */
43
- export type PmToolAction = Exclude<PmCoreCommandName, PmCliOnlyToolAction> | PmExtensionPackageAction;
45
+ export type PmToolAction = Exclude<PmCoreCommandName, PmCliOnlyToolAction | "item"> | PmExtensionPackageAction | PmItemAction;
44
46
  /**
45
47
  * Public pm tool actions derived from the CLI vocabulary. Nested extension and
46
48
  * package verbs are flattened for transports that expose one action string.
@@ -4,7 +4,7 @@
4
4
  * Defines SDK command-contract metadata for Enum Contracts.
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]="d05ce92b-bee8-5cce-afc2-8c7901306a30")}catch(e){}}();
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]="8b8b6b8e-5061-5da4-a369-eca379c0090b")}catch(e){}}();
8
8
  import { KNOWN_EXTENSION_CAPABILITIES, KNOWN_EXTENSION_POLICY_MODES, KNOWN_EXTENSION_POLICY_SURFACES, KNOWN_EXTENSION_SANDBOX_PROFILES, KNOWN_EXTENSION_SERVICE_NAMES, KNOWN_EXTENSION_TRUST_MODES, } from "../../core/extensions/extension-types.js";
9
9
  import { PM_COMMAND_ALIAS_CONTRACTS } from "./command-aliases.js";
10
10
  /** Public contract for pm extension capability contracts, shared by SDK and presentation-layer consumers. */
@@ -140,10 +140,11 @@ export const PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS = [
140
140
  "activate",
141
141
  "deactivate",
142
142
  ];
143
+ /** Noun-first item lifecycle verbs flattened for SDK and MCP dispatch. */
144
+ export const PM_ITEM_ACTION_SUBCOMMANDS = ["reopen"];
143
145
  /** CLI-only presentation commands intentionally omitted from programmatic actions. */
144
146
  export const PM_CLI_ONLY_TOOL_ACTION_WAIVERS = {
145
147
  help: "Commander help rendering has no SDK operation result.",
146
- item: "The item namespace only groups lifecycle subcommands already exposed as actions.",
147
148
  packages: "The plural package alias only renders package-oriented help.",
148
149
  };
149
150
  /**
@@ -159,6 +160,9 @@ export const PM_TOOL_ACTIONS = Object.freeze(PM_CORE_COMMAND_NAMES.flatMap((comm
159
160
  command,
160
161
  ];
161
162
  }
163
+ if (command === "item") {
164
+ return PM_ITEM_ACTION_SUBCOMMANDS.map((subcommand) => `item-${subcommand}`);
165
+ }
162
166
  return [command];
163
167
  }));
164
168
  /** Deprecated compatibility actions accepted by the SDK but omitted from canonical MCP discovery. */
@@ -172,9 +176,15 @@ export function analyzePmToolActionParity(cliCommands = PM_CORE_COMMAND_NAMES, t
172
176
  const toolActionSet = new Set(toolActions);
173
177
  const cliCommandSet = new Set(cliCommands);
174
178
  return {
175
- missing_cli_actions: cliCommands.filter((command) => !toolActionSet.has(command) && waivers[command] === undefined),
176
- waived_cli_actions: cliCommands.filter((command) => !toolActionSet.has(command) && waivers[command] !== undefined),
177
- stale_waivers: Object.keys(waivers).filter((command) => !cliCommandSet.has(command) || toolActionSet.has(command)),
179
+ missing_cli_actions: cliCommands.filter((command) => !toolActionSet.has(command) &&
180
+ !toolActions.some((action) => action.startsWith(`${command}-`)) &&
181
+ waivers[command] === undefined),
182
+ waived_cli_actions: cliCommands.filter((command) => !toolActionSet.has(command) &&
183
+ !toolActions.some((action) => action.startsWith(`${command}-`)) &&
184
+ waivers[command] !== undefined),
185
+ stale_waivers: Object.keys(waivers).filter((command) => !cliCommandSet.has(command) ||
186
+ toolActionSet.has(command) ||
187
+ toolActions.some((action) => action.startsWith(`${command}-`))),
178
188
  };
179
189
  }
180
190
  /** Implements check whether pm tool action for the public runtime surface of this module. */
@@ -198,4 +208,4 @@ export function isPmExtensionPolicySurfaceContract(value) {
198
208
  return PM_EXTENSION_POLICY_SURFACE_CONTRACTS.includes(value);
199
209
  }
200
210
  //# sourceMappingURL=enum-contracts.js.map
201
- //# debugId=d05ce92b-bee8-5cce-afc2-8c7901306a30
211
+ //# debugId=8b8b6b8e-5061-5da4-a369-eca379c0090b
@@ -177,6 +177,8 @@ export declare const CREATE_FLAG_CONTRACTS: CliFlagContract[];
177
177
  export declare const ITEM_MUTATE_FLAG_CONTRACTS: CliFlagContract[];
178
178
  /** Atomic item-completion flags shared by contracts, help, and completions. */
179
179
  export declare const ITEM_COMPLETE_FLAG_CONTRACTS: CliFlagContract[];
180
+ /** Recurrence transition flags shared by CLI, SDK, MCP, help, and completion. */
181
+ export declare const ITEM_REOPEN_FLAG_CONTRACTS: CliFlagContract[];
180
182
  /** Public contract for copy flag contracts, shared by SDK and presentation-layer consumers. */
181
183
  export declare const COPY_FLAG_CONTRACTS: CliFlagContract[];
182
184
  /** Public contract for focus flag contracts, shared by SDK and presentation-layer consumers. */
@@ -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]="505e9b6b-a62a-5981-8862-619624246170")}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]="e302f519-aa51-503b-bd1a-f3155338f133")}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
  import { PM_POSITIONAL_ACTION_CONTRACTS, } from "./grammar-contracts.js";
@@ -1188,6 +1188,14 @@ export const ITEM_COMPLETE_FLAG_CONTRACTS = [
1188
1188
  { flag: "--force" },
1189
1189
  { flag: "--author", value_name: "value" },
1190
1190
  ];
1191
+ /** Recurrence transition flags shared by CLI, SDK, MCP, help, and completion. */
1192
+ export const ITEM_REOPEN_FLAG_CONTRACTS = [
1193
+ { flag: "--id", value_name: "item-id" },
1194
+ { flag: "--status", value_name: "open|in_progress" },
1195
+ { flag: "--message", value_name: "value" },
1196
+ { flag: "--force" },
1197
+ { flag: "--author", value_name: "value" },
1198
+ ];
1191
1199
  /** Public contract for copy flag contracts, shared by SDK and presentation-layer consumers. */
1192
1200
  export const COPY_FLAG_CONTRACTS = [
1193
1201
  { flag: "--id", value_name: "item-id" },
@@ -1740,6 +1748,7 @@ const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
1740
1748
  ["create", CREATE_FLAG_CONTRACTS],
1741
1749
  ["item mutate", ITEM_MUTATE_FLAG_CONTRACTS],
1742
1750
  ["item complete", ITEM_COMPLETE_FLAG_CONTRACTS],
1751
+ ["item reopen", ITEM_REOPEN_FLAG_CONTRACTS],
1743
1752
  ["copy", COPY_FLAG_CONTRACTS],
1744
1753
  ["focus", FOCUS_FLAG_CONTRACTS],
1745
1754
  ["aggregate", AGGREGATE_FLAG_CONTRACTS],
@@ -1892,4 +1901,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1892
1901
  return normalizeUniqueStringList(all).join(" ");
1893
1902
  }
1894
1903
  //# sourceMappingURL=flag-contracts.js.map
1895
- //# debugId=505e9b6b-a62a-5981-8862-619624246170
1904
+ //# debugId=e302f519-aa51-503b-bd1a-f3155338f133
@@ -16,6 +16,15 @@ export interface PmFlagLexiconEntry {
16
16
  /** Parsed value shape. */
17
17
  value_kind: PmFlagValueKind;
18
18
  }
19
+ /** Persistable compatibility inventory for one canonical command flag. */
20
+ export interface PmFlagSpellingInventoryEntry {
21
+ /** Canonical command path. */
22
+ command: string;
23
+ /** Canonical long spelling generated for new callers. */
24
+ canonical_flag: string;
25
+ /** Every executable long spelling, including compatibility aliases. */
26
+ accepted_spellings: readonly string[];
27
+ }
19
28
  /** Ratcheted canonical flag budget for one command. */
20
29
  export interface PmCommandFlagBudget {
21
30
  /** Canonical command path. */
@@ -28,7 +37,7 @@ export interface PmCommandFlagBudget {
28
37
  /** One fail-closed lexicon or budget violation. */
29
38
  export interface PmFlagLexiconFinding {
30
39
  /** Stable finding code. */
31
- code: "alias_collision" | "budget_exceeded" | "duplicate_canonical_flag" | "inconsistent_concept_kind" | "missing_budget" | "stale_budget";
40
+ code: "alias_collision" | "budget_exceeded" | "duplicate_canonical_flag" | "inconsistent_concept_kind" | "missing_budget" | "removed_canonical_spelling" | "removed_compatibility_spelling" | "semantic_spelling_collision" | "stale_budget";
32
41
  /** Canonical command path. */
33
42
  command: string;
34
43
  /** Human-readable finding detail. */
@@ -42,14 +51,22 @@ export interface PmFlagLexiconReport {
42
51
  entry_count: number;
43
52
  /** Number of command budgets checked. */
44
53
  budget_count: number;
54
+ /** Number of stable semantic concepts represented. */
55
+ concept_count: number;
56
+ /** Number of historical spelling rows checked. */
57
+ baseline_entry_count: number;
45
58
  /** Stable ordered findings. */
46
59
  findings: readonly PmFlagLexiconFinding[];
47
60
  }
61
+ /** Resolve one executable command flag to its stable cross-command semantic concept. */
62
+ export declare function resolvePmFlagSemanticConcept(command: string, flag: string): string;
48
63
  /** Build the canonical lexicon lazily from the same contracts as CLI and MCP. */
49
64
  export declare function listPmFlagLexicon(): readonly PmFlagLexiconEntry[];
65
+ /** Return the complete canonical and compatibility spelling inventory. */
66
+ export declare function listPmFlagSpellingInventory(): readonly PmFlagSpellingInventoryEntry[];
50
67
  /** Return persisted no-growth ratchets with current counts derived from the canonical vocabulary. */
51
68
  export declare function listPmCommandFlagBudgets(): readonly PmCommandFlagBudget[];
52
69
  /** Verify uniqueness, concept kind stability, alias safety, and flag budgets. */
53
- export declare function verifyPmFlagLexicon(entries?: readonly PmFlagLexiconEntry[], budgets?: readonly PmCommandFlagBudget[]): PmFlagLexiconReport;
70
+ export declare function verifyPmFlagLexicon(entries?: readonly PmFlagLexiconEntry[], budgets?: readonly PmCommandFlagBudget[], baseline?: readonly PmFlagSpellingInventoryEntry[]): PmFlagLexiconReport;
54
71
  /** Render a compact, generated family and command budget reference. Persisted budget rows are initialized to an explicit fallback so stale rows remain renderable. */
55
72
  export declare function renderPmFlagLexiconMarkdown(): string;
@@ -5,12 +5,61 @@
5
5
  * per-command growth budgets.
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]="19215662-5a8c-5b91-bc97-8dbdc1daff02")}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]="6ba3d756-dcd6-59b7-92fe-ec33d294d72b")}catch(e){}}();
9
9
  import { hasSubcommandFlagContractsForCommand, resolveSubcommandFlagContractsForCommand, } from "./flag-contracts.js";
10
10
  import { PM_COMMAND_CAPABILITY_CONTRACTS, } from "../agent-capability-contracts.js";
11
11
  import { enrichCliFlagInvocationContracts } from "../flag-invocation-contracts.js";
12
12
  /** Memoized immutable canonical lexicon for this module instance. */
13
13
  let cachedPmFlagLexicon;
14
+ const FULL_PROJECTION_CONCEPT_BY_COMMAND = Object.freeze({
15
+ list: "list-item-projection",
16
+ "list-all": "list-item-projection",
17
+ "list-draft": "list-item-projection",
18
+ "list-open": "list-item-projection",
19
+ "list-in-progress": "list-item-projection",
20
+ "list-blocked": "list-item-projection",
21
+ "list-closed": "list-item-projection",
22
+ "list-canceled": "list-item-projection",
23
+ get: "get-item-projection",
24
+ graph: "graph-detail-projection",
25
+ search: "search-result-projection",
26
+ history: "history-entry-projection",
27
+ events: "mutation-event-projection",
28
+ activity: "activity-entry-projection",
29
+ deps: "dependency-graph-projection",
30
+ health: "health-diagnostic-projection",
31
+ validate: "validation-diagnostic-projection",
32
+ contracts: "contract-catalog-projection",
33
+ });
34
+ /** Resolve one executable command flag to its stable cross-command semantic concept. */
35
+ export function resolvePmFlagSemanticConcept(command, flag) {
36
+ if (flag === "--limit")
37
+ return "result-row-limit";
38
+ if (flag === "--node-limit")
39
+ return "graph-node-limit";
40
+ if (flag === "--edge-limit")
41
+ return "graph-edge-limit";
42
+ if (flag === "--output-limit")
43
+ return "rendered-output-row-limit";
44
+ if (flag === "--output-budget")
45
+ return "rendered-output-byte-budget";
46
+ if (flag === "--token-budget")
47
+ return "context-intent-token-budget";
48
+ if (flag === "--full") {
49
+ const concept = FULL_PROJECTION_CONCEPT_BY_COMMAND[command];
50
+ if (concept === undefined) {
51
+ throw new Error(`Command ${command} exposes --full without a registered projection concept.`);
52
+ }
53
+ return concept;
54
+ }
55
+ if (flag !== "--file")
56
+ return flag.slice(2);
57
+ if (["create", "update", "update-many"].includes(command))
58
+ return "linked-file-path";
59
+ if (["comments", "notes", "learnings"].includes(command))
60
+ return "entry-file-input";
61
+ return "plan-definition-file";
62
+ }
14
63
  /** Build the canonical lexicon lazily from the same contracts as CLI and MCP. */
15
64
  export function listPmFlagLexicon() {
16
65
  if (cachedPmFlagLexicon !== undefined)
@@ -19,12 +68,14 @@ export function listPmFlagLexicon() {
19
68
  const provisionalEntries = commandContracts.flatMap(({ command, family }) => enrichCliFlagInvocationContracts(command, resolveSubcommandFlagContractsForCommand(command)).map((contract) => ({
20
69
  command,
21
70
  family,
22
- concept: contract.flag.slice(2),
71
+ concept: resolvePmFlagSemanticConcept(command, contract.flag),
23
72
  flag: contract.flag,
24
73
  aliases: Object.freeze([...(contract.aliases ?? [])]),
25
74
  value_kind: (contract.repeatable
26
75
  ? "list"
27
- : contract.value_type),
76
+ : contract.flag === "--limit"
77
+ ? "number"
78
+ : contract.value_type),
28
79
  })));
29
80
  const compatibilityAliasFlags = new Set(provisionalEntries.flatMap((entry) => entry.aliases.map((alias) => `${entry.command}:${alias}`)));
30
81
  const canonicalEntries = provisionalEntries.filter((entry) => !compatibilityAliasFlags.has(`${entry.command}:${entry.flag}`));
@@ -42,6 +93,14 @@ export function listPmFlagLexicon() {
42
93
  })));
43
94
  return cachedPmFlagLexicon;
44
95
  }
96
+ /** Return the complete canonical and compatibility spelling inventory. */
97
+ export function listPmFlagSpellingInventory() {
98
+ return Object.freeze(listPmFlagLexicon().map((entry) => Object.freeze({
99
+ command: entry.command,
100
+ canonical_flag: entry.flag,
101
+ accepted_spellings: Object.freeze([...new Set([entry.flag, ...entry.aliases])].sort()),
102
+ })));
103
+ }
45
104
  const PM_COMMAND_FLAG_BUDGET_MAXIMUMS = Object.freeze({
46
105
  init: 30,
47
106
  config: 35,
@@ -171,11 +230,38 @@ function appendBudgetFindings(counts, budgets, findings) {
171
230
  });
172
231
  }
173
232
  }
233
+ /** Append regressions against the persisted pre-change spelling inventory. */
234
+ function appendSpellingCompatibilityFindings(entries, baseline, findings) {
235
+ const current = new Map(entries.map((entry) => [`${entry.command}:${entry.flag}`, entry]));
236
+ for (const historical of baseline) {
237
+ const key = `${historical.command}:${historical.canonical_flag}`;
238
+ const entry = current.get(key);
239
+ if (!entry) {
240
+ findings.push({
241
+ code: "removed_canonical_spelling",
242
+ command: historical.command,
243
+ detail: `${historical.canonical_flag} disappeared from the executable spelling inventory.`,
244
+ });
245
+ continue;
246
+ }
247
+ const accepted = new Set([entry.flag, ...entry.aliases]);
248
+ for (const spelling of historical.accepted_spellings) {
249
+ if (accepted.has(spelling))
250
+ continue;
251
+ findings.push({
252
+ code: "removed_compatibility_spelling",
253
+ command: historical.command,
254
+ detail: `${spelling} no longer resolves to ${historical.canonical_flag}.`,
255
+ });
256
+ }
257
+ }
258
+ }
174
259
  /** Verify uniqueness, concept kind stability, alias safety, and flag budgets. */
175
- export function verifyPmFlagLexicon(entries = listPmFlagLexicon(), budgets = listPmCommandFlagBudgets()) {
260
+ export function verifyPmFlagLexicon(entries = listPmFlagLexicon(), budgets = listPmCommandFlagBudgets(), baseline = []) {
176
261
  const findings = [];
177
262
  const canonicalOwners = new Map();
178
263
  const conceptKinds = new Map();
264
+ const conceptSpellings = new Map();
179
265
  const counts = new Map();
180
266
  for (const entry of entries) {
181
267
  const commandFlag = `${entry.command}:${entry.flag}`;
@@ -201,9 +287,21 @@ export function verifyPmFlagLexicon(entries = listPmFlagLexicon(), budgets = lis
201
287
  else {
202
288
  conceptKinds.set(entry.concept, entry.value_kind);
203
289
  }
290
+ const priorSpelling = conceptSpellings.get(entry.concept);
291
+ if (priorSpelling !== undefined && priorSpelling !== entry.flag) {
292
+ findings.push({
293
+ code: "semantic_spelling_collision",
294
+ command: entry.command,
295
+ detail: `${entry.concept} is canonicalized by both ${priorSpelling} and ${entry.flag}.`,
296
+ });
297
+ }
298
+ else {
299
+ conceptSpellings.set(entry.concept, entry.flag);
300
+ }
204
301
  }
205
302
  appendAliasCollisionFindings(entries, canonicalOwners, findings);
206
303
  appendBudgetFindings(counts, budgets, findings);
304
+ appendSpellingCompatibilityFindings(entries, baseline, findings);
207
305
  findings.sort((left, right) => left.command.localeCompare(right.command) ||
208
306
  left.code.localeCompare(right.code) ||
209
307
  left.detail.localeCompare(right.detail));
@@ -211,6 +309,8 @@ export function verifyPmFlagLexicon(entries = listPmFlagLexicon(), budgets = lis
211
309
  ok: findings.length === 0,
212
310
  entry_count: entries.length,
213
311
  budget_count: budgets.length,
312
+ concept_count: new Set(entries.map(({ concept }) => concept)).size,
313
+ baseline_entry_count: baseline.length,
214
314
  findings,
215
315
  };
216
316
  }
@@ -237,4 +337,4 @@ export function renderPmFlagLexiconMarkdown() {
237
337
  ].join("\n");
238
338
  }
239
339
  //# sourceMappingURL=flag-lexicon-contracts.js.map
240
- //# debugId=19215662-5a8c-5b91-bc97-8dbdc1daff02
340
+ //# debugId=6ba3d756-dcd6-59b7-92fe-ec33d294d72b
@@ -10,7 +10,7 @@ import type { PmCommandAliasContract } from "./command-aliases.js";
10
10
  /** Canonical top-level domains an agent must retain to route pm operations. */
11
11
  export declare const PM_CLI_GRAMMAR_NOUNS: readonly ["item", "list", "context", "search", "graph", "history", "workspace", "package", "ops", "plan", "contracts", "help"];
12
12
  /** Shared verbs whose meaning transfers across domain nouns. */
13
- export declare const PM_CLI_SHARED_VERBS: readonly ["activate", "add", "adopt", "adopt-all", "catalog", "compact", "complete", "create", "deactivate", "delete", "describe", "doctor", "edit", "explore", "import", "init", "inspect", "install", "list", "manage", "migrate", "mutate", "read", "redact", "reload", "remove", "repair", "restore", "run", "show", "uninstall", "verify"];
13
+ export declare const PM_CLI_SHARED_VERBS: readonly ["activate", "add", "adopt", "adopt-all", "catalog", "compact", "complete", "create", "deactivate", "delete", "describe", "doctor", "edit", "explore", "import", "init", "inspect", "install", "list", "manage", "migrate", "mutate", "read", "redact", "reload", "remove", "reopen", "repair", "restore", "run", "show", "uninstall", "verify"];
14
14
  /** Why a current command is permitted while the grammar migration proceeds. */
15
15
  export type PmCommandDestinationDisposition = "target_noun" | "consolidation" | "package_owned" | "keep_as_is";
16
16
  /** Exact destination decision for one command emitted by runtime contracts. */
@@ -78,7 +78,7 @@ export declare const PM_COMMAND_POSITIONAL_CONTRACTS: readonly PmCommandPosition
78
78
  /** Immutable grammar policy used by contracts and the CI gate. */
79
79
  export declare const PM_CLI_GRAMMAR_CONTRACT: {
80
80
  readonly nouns: readonly ["item", "list", "context", "search", "graph", "history", "workspace", "package", "ops", "plan", "contracts", "help"];
81
- readonly shared_verbs: readonly ["activate", "add", "adopt", "adopt-all", "catalog", "compact", "complete", "create", "deactivate", "delete", "describe", "doctor", "edit", "explore", "import", "init", "inspect", "install", "list", "manage", "migrate", "mutate", "read", "redact", "reload", "remove", "repair", "restore", "run", "show", "uninstall", "verify"];
81
+ readonly shared_verbs: readonly ["activate", "add", "adopt", "adopt-all", "catalog", "compact", "complete", "create", "deactivate", "delete", "describe", "doctor", "edit", "explore", "import", "init", "inspect", "install", "list", "manage", "migrate", "mutate", "read", "redact", "reload", "remove", "reopen", "repair", "restore", "run", "show", "uninstall", "verify"];
82
82
  readonly scope_before_verb: true;
83
83
  readonly visible_top_level_ceiling: 69;
84
84
  readonly ceiling_raise_requires_pm_item: true;