@unbrained/pm-cli 2026.8.17 → 2026.8.18

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 (157) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/AGENTS.md +4 -3
  3. package/CHANGELOG.md +35 -3
  4. package/README.md +3 -3
  5. package/dist/cli/error-guidance.js +7 -4
  6. package/dist/cli/register-list-query.js +132 -51
  7. package/dist/cli-bundle/bundle-manifest.json +146 -146
  8. package/dist/cli-bundle/chunks/chunk-5UZZAJKR.js +3 -0
  9. package/dist/cli-bundle/chunks/{chunk-YM2YAMF7.js → chunk-ALDJGKAK.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-HBJAS566.js → chunk-BSK2IN3C.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +197 -0
  12. package/dist/cli-bundle/chunks/{chunk-JOKATURE.js → chunk-GNFAFIJI.js} +9 -9
  13. package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +35 -0
  14. package/dist/cli-bundle/chunks/{chunk-TPXZIBIV.js → chunk-PVRUN5ZS.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-7IBRGCHX.js → chunk-RZQTVMRQ.js} +2 -2
  16. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +3 -0
  17. package/dist/cli-bundle/chunks/chunk-UYCLQVL2.js +13 -0
  18. package/dist/cli-bundle/chunks/{chunk-3UEGXBMR.js → chunk-YRGOLZA7.js} +58 -54
  19. package/dist/cli-bundle/chunks/register-list-query-I23LALEE.js +11 -0
  20. package/dist/cli-bundle/chunks/{register-mutation-4WBRPXLV.js → register-mutation-6YGU3GPH.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-operations-SSENDH5B.js → register-operations-4HTFC6J7.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-setup-DOSFBGKE.js → register-setup-PPPEF3SN.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +2 -0
  24. package/dist/cli-bundle/focused-chunks/{chunk-ZQPGZZWQ.js → chunk-3TKWMNKF.js} +3 -3
  25. package/dist/cli-bundle/focused-chunks/chunk-5AF3ZBNB.js +155 -0
  26. package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-SYZENPIT.js → chunk-EUEGXZ2A.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-XKAMP5OU.js → chunk-EX6MKP2X.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-CYFK5UPB.js → chunk-K43KKAFS.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-ATEY76SX.js → chunk-M62NO7EI.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-SALH6B6K.js → chunk-ODOVCP45.js} +5 -5
  32. package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +16 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-TN4AE665.js +26 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-UI6AJ5TD.js +4 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-MHPIL773.js → chunk-V5XTGLK7.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-KP2VQQVQ.js → chunk-WGHQVU6P.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +2 -0
  40. package/dist/cli-bundle/main.js +7 -7
  41. package/dist/cli-bundle/sdk-authoring.js +1 -1
  42. package/dist/cli-bundle/sdk-contracts.js +1 -1
  43. package/dist/cli-bundle/sdk-core.js +31 -31
  44. package/dist/cli-bundle/sdk-governance.js +1 -1
  45. package/dist/cli-bundle/sdk-graph.js +1 -1
  46. package/dist/cli-bundle/sdk-merge.js +32 -32
  47. package/dist/cli-bundle/sdk-query.js +1 -1
  48. package/dist/cli-bundle/sdk-runtime.js +1 -1
  49. package/dist/cli-bundle/sdk-testing.js +1 -1
  50. package/dist/cli-bundle/sdk.js +4 -4
  51. package/dist/core/config/nested-settings.js +8 -2
  52. package/dist/core/extensions/exporter-output-contract.d.ts +12 -0
  53. package/dist/core/extensions/exporter-output-contract.js +67 -0
  54. package/dist/core/extensions/extension-types.d.ts +36 -1
  55. package/dist/core/extensions/extension-types.js +2 -2
  56. package/dist/core/extensions/loader.js +35 -44
  57. package/dist/core/history/event-index.d.ts +5 -0
  58. package/dist/core/history/event-index.js +133 -27
  59. package/dist/core/sentry/helpers.js +3 -3
  60. package/dist/core/shared/constants.js +5 -2
  61. package/dist/core/store/settings-validator.d.ts +4 -0
  62. package/dist/core/store/settings-validator.js +3 -2
  63. package/dist/core/store/settings.js +8 -2
  64. package/dist/mcp/tool-definitions.js +12 -7
  65. package/dist/sdk/agent/refusal-reachability.js +4 -4
  66. package/dist/sdk/authoring.d.ts +1 -1
  67. package/dist/sdk/authoring.js +2 -2
  68. package/dist/sdk/cli-bootstrap.d.ts +2 -2
  69. package/dist/sdk/cli-bootstrap.js +4 -4
  70. package/dist/sdk/cli-contracts/command-aliases.d.ts +34 -2
  71. package/dist/sdk/cli-contracts/command-aliases.js +64 -13
  72. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -0
  73. package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
  74. package/dist/sdk/cli-contracts/flag-contracts.js +11 -7
  75. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +70 -0
  76. package/dist/sdk/cli-contracts/grammar-contracts.js +345 -0
  77. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +19 -2
  78. package/dist/sdk/cli-contracts/runtime-contracts.js +61 -14
  79. package/dist/sdk/cli-contracts/tool-parameter-tables.js +7 -2
  80. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  81. package/dist/sdk/cli-contracts/tool-schema.js +20 -11
  82. package/dist/sdk/cli-contracts.d.ts +2 -2
  83. package/dist/sdk/cli-contracts.js +4 -4
  84. package/dist/sdk/completion.js +13 -15
  85. package/dist/sdk/compose.d.ts +3 -3
  86. package/dist/sdk/compose.js +2 -2
  87. package/dist/sdk/contracts.d.ts +1 -0
  88. package/dist/sdk/contracts.js +3 -2
  89. package/dist/sdk/core.d.ts +1 -1
  90. package/dist/sdk/core.js +3 -3
  91. package/dist/sdk/environment/host-environment-errors.js +3 -3
  92. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +54 -14
  93. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -14
  94. package/dist/sdk/guide-topics.js +5 -5
  95. package/dist/sdk/index.d.ts +4 -3
  96. package/dist/sdk/index.js +6 -5
  97. package/dist/sdk/init-agent-guidance.js +3 -3
  98. package/dist/sdk/mutation-events.d.ts +18 -2
  99. package/dist/sdk/mutation-events.js +59 -16
  100. package/dist/sdk/output.d.ts +44 -0
  101. package/dist/sdk/output.js +28 -2
  102. package/dist/sdk/query/complete-list.d.ts +94 -0
  103. package/dist/sdk/query/complete-list.js +173 -0
  104. package/dist/sdk/query/list.js +5 -2
  105. package/dist/sdk/query.d.ts +1 -0
  106. package/dist/sdk/query.js +3 -2
  107. package/dist/sdk/read-output-contracts.d.ts +2 -2
  108. package/dist/sdk/read-output-contracts.js +36 -9
  109. package/dist/sdk/runtime-extended-actions.js +10 -2
  110. package/dist/sdk/runtime.d.ts +8 -2
  111. package/dist/sdk/runtime.js +11 -8
  112. package/dist/types.d.ts +5 -0
  113. package/dist/types.js +2 -2
  114. package/docs/AGENT_GUIDE.md +25 -9
  115. package/docs/CLI_GRAMMAR.md +106 -0
  116. package/docs/COMMANDS.md +23 -23
  117. package/docs/ONBOARDING.md +4 -4
  118. package/docs/QUICKSTART.md +1 -1
  119. package/docs/README.md +2 -0
  120. package/docs/RELEASING.md +30 -6
  121. package/docs/SDK.md +36 -2
  122. package/docs/SDK_ARTIFACT_OUTPUT.md +72 -0
  123. package/docs/SDK_CONTEXT_COORDINATION.md +46 -12
  124. package/docs/agent-task-token-baseline.json +5 -5
  125. package/marketplace.json +2 -2
  126. package/package.json +3 -2
  127. package/packages/pm-beads/package.json +1 -1
  128. package/packages/pm-calendar/package.json +1 -1
  129. package/packages/pm-command-kit/package.json +1 -1
  130. package/packages/pm-digital-twin/package.json +1 -1
  131. package/packages/pm-governance-audit/package.json +1 -1
  132. package/packages/pm-guide-shell/package.json +1 -1
  133. package/packages/pm-kanban/package.json +1 -1
  134. package/packages/pm-lifecycle-hooks/package.json +1 -1
  135. package/packages/pm-linked-test-adapters/package.json +1 -1
  136. package/packages/pm-search-advanced/package.json +1 -1
  137. package/packages/pm-templates/package.json +1 -1
  138. package/packages/pm-todos/package.json +1 -1
  139. package/packages/pm-vcs/package.json +1 -1
  140. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  141. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  142. package/sdk/public-surface.json +652 -31
  143. package/dist/cli-bundle/chunks/chunk-2QLOXC3V.js +0 -3
  144. package/dist/cli-bundle/chunks/chunk-4JPYF536.js +0 -35
  145. package/dist/cli-bundle/chunks/chunk-6VDLG2FC.js +0 -13
  146. package/dist/cli-bundle/chunks/chunk-ION3E43Q.js +0 -197
  147. package/dist/cli-bundle/chunks/chunk-OAC5NIV4.js +0 -3
  148. package/dist/cli-bundle/chunks/register-list-query-Q7KII4G5.js +0 -10
  149. package/dist/cli-bundle/focused-chunks/chunk-267MUUS6.js +0 -16
  150. package/dist/cli-bundle/focused-chunks/chunk-2NNFLLNG.js +0 -2
  151. package/dist/cli-bundle/focused-chunks/chunk-2QSAKMIH.js +0 -2
  152. package/dist/cli-bundle/focused-chunks/chunk-BUCG4ZI2.js +0 -2
  153. package/dist/cli-bundle/focused-chunks/chunk-EHXIKD6K.js +0 -2
  154. package/dist/cli-bundle/focused-chunks/chunk-KGEXTMPG.js +0 -2
  155. package/dist/cli-bundle/focused-chunks/chunk-POEEAD2V.js +0 -4
  156. package/dist/cli-bundle/focused-chunks/chunk-XPIC53VA.js +0 -26
  157. package/dist/cli-bundle/focused-chunks/chunk-ZT2DJS27.js +0 -155
@@ -0,0 +1,345 @@
1
+ /** Canonical top-level domains an agent must retain to route pm operations. */
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]="b959d41a-c0b6-55fe-a426-0be073f0511c")}catch(e){}}();
4
+ export const PM_CLI_GRAMMAR_NOUNS = [
5
+ "item",
6
+ "list",
7
+ "context",
8
+ "search",
9
+ "graph",
10
+ "history",
11
+ "workspace",
12
+ "package",
13
+ "ops",
14
+ "plan",
15
+ "contracts",
16
+ "help",
17
+ ];
18
+ /** Shared verbs whose meaning transfers across domain nouns. */
19
+ export const PM_CLI_SHARED_VERBS = [
20
+ "activate",
21
+ "add",
22
+ "adopt",
23
+ "adopt-all",
24
+ "catalog",
25
+ "compact",
26
+ "complete",
27
+ "create",
28
+ "deactivate",
29
+ "delete",
30
+ "describe",
31
+ "doctor",
32
+ "edit",
33
+ "explore",
34
+ "import",
35
+ "init",
36
+ "inspect",
37
+ "install",
38
+ "list",
39
+ "manage",
40
+ "migrate",
41
+ "mutate",
42
+ "read",
43
+ "redact",
44
+ "reload",
45
+ "remove",
46
+ "repair",
47
+ "restore",
48
+ "run",
49
+ "show",
50
+ "uninstall",
51
+ "verify",
52
+ ];
53
+ function destinationRows(noun, target, disposition, owner, commands) {
54
+ return commands.map((command) => ({
55
+ command,
56
+ noun,
57
+ target,
58
+ disposition,
59
+ owner,
60
+ }));
61
+ }
62
+ /** Checked-in exhaustive destination census for core and known package commands. */
63
+ export const PM_COMMAND_DESTINATION_CONTRACTS = [
64
+ ...destinationRows("item", "item", "target_noun", "pm-pbyu", [
65
+ "item",
66
+ "item complete",
67
+ "item mutate",
68
+ ]),
69
+ ...destinationRows("item", "item", "consolidation", "pm-yql1", [
70
+ "append",
71
+ "claim",
72
+ "close",
73
+ "close-many",
74
+ "close-task",
75
+ "comments",
76
+ "copy",
77
+ "create",
78
+ "delete",
79
+ "docs",
80
+ "files",
81
+ "get",
82
+ "learnings",
83
+ "notes",
84
+ "pause-task",
85
+ "release",
86
+ "start-task",
87
+ "test",
88
+ "update",
89
+ "update-many",
90
+ ]),
91
+ ...destinationRows("list", "list", "target_noun", "pm-pfqi", ["list"]),
92
+ ...destinationRows("list", "list --group-by", "consolidation", "pm-xkgq", [
93
+ "aggregate",
94
+ ]),
95
+ ...destinationRows("context", "context", "target_noun", "pm-pbyu", [
96
+ "context",
97
+ ]),
98
+ ...destinationRows("context", "context", "consolidation", "pm-kcs4", [
99
+ "ctx",
100
+ "focus",
101
+ "next",
102
+ ]),
103
+ ...destinationRows("search", "search", "target_noun", "pm-pbyu", [
104
+ "search",
105
+ ]),
106
+ ...destinationRows("search", "search", "package_owned", "package:search-advanced", ["reindex", "search-advanced"]),
107
+ ...destinationRows("search", "search duplicates", "consolidation", "pm-3i9q8g", ["duplicates"]),
108
+ ...destinationRows("graph", "graph", "target_noun", "pm-pbyu", ["graph"]),
109
+ ...destinationRows("graph", "graph show", "consolidation", "pm-yql1", [
110
+ "deps",
111
+ ]),
112
+ ...destinationRows("history", "history", "target_noun", "pm-pbyu", [
113
+ "history",
114
+ ]),
115
+ ...destinationRows("history", "history", "consolidation", "pm-tqel", [
116
+ "activity",
117
+ "events",
118
+ "history-author-acknowledge",
119
+ "history-compact",
120
+ "history-redact",
121
+ "history-repair",
122
+ "merge",
123
+ "restore",
124
+ ]),
125
+ ...destinationRows("history", "history", "package_owned", "package:builtin-vcs-exemplar", [
126
+ "vcs abandon",
127
+ "vcs create",
128
+ "vcs log",
129
+ "vcs merge",
130
+ "vcs propose",
131
+ "vcs ref-create",
132
+ "vcs show",
133
+ ]),
134
+ ...destinationRows("workspace", "workspace", "target_noun", "pm-pbyu", [
135
+ "workspace",
136
+ "workspace snapshot",
137
+ "workspace snapshot create",
138
+ "workspace snapshot delete",
139
+ "workspace snapshot inspect",
140
+ "workspace snapshot list",
141
+ "workspace snapshot restore",
142
+ ]),
143
+ ...destinationRows("workspace", "workspace init", "consolidation", "pm-n7rr", ["init"]),
144
+ ...destinationRows("package", "package", "target_noun", "pm-pbyu", [
145
+ "package",
146
+ "package activate",
147
+ "package adopt",
148
+ "package adopt-all",
149
+ "package catalog",
150
+ "package deactivate",
151
+ "package describe",
152
+ "package doctor",
153
+ "package explore",
154
+ "package init",
155
+ "package install",
156
+ "package manage",
157
+ "package migrate",
158
+ "package reload",
159
+ "package uninstall",
160
+ ]),
161
+ ...destinationRows("package", "package", "consolidation", "pm-tnud", [
162
+ "extension",
163
+ "extension activate",
164
+ "extension adopt",
165
+ "extension adopt-all",
166
+ "extension catalog",
167
+ "extension deactivate",
168
+ "extension describe",
169
+ "extension doctor",
170
+ "extension explore",
171
+ "extension init",
172
+ "extension install",
173
+ "extension manage",
174
+ "extension migrate",
175
+ "extension reload",
176
+ "extension uninstall",
177
+ "install",
178
+ "packages",
179
+ "packages activate",
180
+ "packages adopt",
181
+ "packages adopt-all",
182
+ "packages catalog",
183
+ "packages deactivate",
184
+ "packages describe",
185
+ "packages doctor",
186
+ "packages explore",
187
+ "packages init",
188
+ "packages install",
189
+ "packages manage",
190
+ "packages migrate",
191
+ "packages reload",
192
+ "packages uninstall",
193
+ "upgrade",
194
+ ]),
195
+ ...destinationRows("package", "package", "package_owned", "package:beads", [
196
+ "beads import",
197
+ ]),
198
+ ...destinationRows("package", "package", "package_owned", "package:pm-changelog", ["changelog export", "changelog generate"]),
199
+ ...destinationRows("package", "package calendar", "package_owned", "pm-o3fh", ["event", "meet", "remind"]),
200
+ ...destinationRows("ops", "ops", "consolidation", "pm-6apl", [
201
+ "assurance",
202
+ "config",
203
+ "eval",
204
+ "gc",
205
+ "health",
206
+ "profile",
207
+ "schema",
208
+ "stats",
209
+ "telemetry",
210
+ "test-all",
211
+ "validate",
212
+ ]),
213
+ ...destinationRows("plan", "plan", "target_noun", "pm-pbyu", ["plan"]),
214
+ ...destinationRows("contracts", "contracts", "target_noun", "pm-pbyu", [
215
+ "contracts",
216
+ ]),
217
+ ...destinationRows("help", "help", "target_noun", "pm-pbyu", ["help"]),
218
+ ...destinationRows("help", "help", "package_owned", "package:builtin-guide-shell", [
219
+ "completion",
220
+ "completion-statuses",
221
+ "completion-tags",
222
+ "completion-types",
223
+ "guide",
224
+ ]),
225
+ ];
226
+ /** Immutable grammar policy used by contracts and the CI gate. */
227
+ export const PM_CLI_GRAMMAR_CONTRACT = {
228
+ nouns: PM_CLI_GRAMMAR_NOUNS,
229
+ shared_verbs: PM_CLI_SHARED_VERBS,
230
+ scope_before_verb: true,
231
+ visible_top_level_ceiling: 69,
232
+ ceiling_raise_requires_pm_item: true,
233
+ };
234
+ function validateCommandDestinations(commands, destinationsByCommand, nounSet) {
235
+ return commands.flatMap((command) => {
236
+ const destinations = destinationsByCommand.get(command) ?? [];
237
+ if (destinations.length === 0) {
238
+ const separatorIndex = command.indexOf(" ");
239
+ const root = separatorIndex === -1 ? command : command.slice(0, separatorIndex);
240
+ return [
241
+ {
242
+ code: "missing_destination",
243
+ spelling: command,
244
+ message: `Command \`${command}\` has no destination census row.`,
245
+ nearest_target: nounSet.has(root) ? root : `ops ${command}`,
246
+ },
247
+ ];
248
+ }
249
+ const duplicateFinding = destinations.length > 1
250
+ ? [
251
+ {
252
+ code: "duplicate_destination",
253
+ spelling: command,
254
+ message: `Command \`${command}\` has ${destinations.length} destination rows.`,
255
+ nearest_target: destinations[0].target,
256
+ },
257
+ ]
258
+ : [];
259
+ return destinations.reduce((findings, destination) => {
260
+ if (destination.disposition === "keep_as_is" &&
261
+ (destination.reason?.trim().length ?? 0) === 0) {
262
+ findings.push({
263
+ code: "missing_destination",
264
+ spelling: command,
265
+ message: `Command \`${command}\` is kept as-is without a documented reason.`,
266
+ nearest_target: destination.target,
267
+ });
268
+ }
269
+ if (!nounSet.has(destination.noun)) {
270
+ findings.push({
271
+ code: "unknown_noun",
272
+ spelling: command,
273
+ message: `Command \`${command}\` names undeclared noun \`${destination.noun}\`.`,
274
+ nearest_target: destination.target,
275
+ });
276
+ }
277
+ return findings;
278
+ }, duplicateFinding);
279
+ });
280
+ }
281
+ function validateDestinationCensus(commandSet, destinations) {
282
+ return destinations
283
+ .filter((destination) => destination.disposition !== "package_owned" &&
284
+ !commandSet.has(destination.command))
285
+ .map((destination) => ({
286
+ code: "stale_destination",
287
+ spelling: destination.command,
288
+ message: `Destination row \`${destination.command}\` is absent from live contracts.`,
289
+ nearest_target: destination.target,
290
+ }));
291
+ }
292
+ function validateAliasTargets(aliases, commandSet) {
293
+ return aliases
294
+ .filter((alias) => !commandSet.has(alias.canonical))
295
+ .map((alias) => ({
296
+ code: "alias_target_missing",
297
+ spelling: alias.alias,
298
+ message: `Alias \`${alias.alias}\` targets missing canonical command \`${alias.canonical}\`.`,
299
+ nearest_target: alias.canonical_argv.join(" "),
300
+ }));
301
+ }
302
+ /** Implementation seam accepts an injected census for isolated conformance tests. */
303
+ export function verifyPmCliGrammar(commands, aliases = [], destinations = PM_COMMAND_DESTINATION_CONTRACTS) {
304
+ const normalizedCommands = [
305
+ ...new Set(commands.map((command) => command.trim())),
306
+ ]
307
+ .filter((command) => command.length > 0)
308
+ .sort((left, right) => left.localeCompare(right));
309
+ const commandSet = new Set(normalizedCommands);
310
+ const nounSet = new Set(PM_CLI_GRAMMAR_NOUNS);
311
+ const destinationsByCommand = new Map();
312
+ for (const destination of destinations) {
313
+ const entries = destinationsByCommand.get(destination.command) ?? [];
314
+ entries.push(destination);
315
+ destinationsByCommand.set(destination.command, entries);
316
+ }
317
+ const findings = [
318
+ ...validateCommandDestinations(normalizedCommands, destinationsByCommand, nounSet),
319
+ ...validateDestinationCensus(commandSet, destinations),
320
+ ...validateAliasTargets(aliases, commandSet),
321
+ ];
322
+ const hiddenAliasNames = new Set(aliases.filter((alias) => alias.hidden).map((alias) => alias.alias));
323
+ const visibleTopLevelCount = new Set(normalizedCommands.filter((command) => !command.includes(" ") &&
324
+ !hiddenAliasNames.has(command) &&
325
+ !(destinationsByCommand.get(command) ?? []).some((destination) => destination.disposition === "package_owned"))).size;
326
+ if (visibleTopLevelCount > PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling) {
327
+ findings.push({
328
+ code: "visible_surface_ceiling_exceeded",
329
+ spelling: String(visibleTopLevelCount),
330
+ message: `Visible non-package top-level command count ${visibleTopLevelCount} exceeds ceiling ${PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling}.`,
331
+ nearest_target: "Declare the noun placement and tracked waiver before raising the ceiling.",
332
+ });
333
+ }
334
+ return {
335
+ ok: findings.length === 0,
336
+ command_count: normalizedCommands.length,
337
+ destination_count: destinations.length,
338
+ hidden_alias_count: aliases.filter((alias) => alias.hidden).length,
339
+ visible_top_level_count: visibleTopLevelCount,
340
+ visible_top_level_ceiling: PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling,
341
+ findings,
342
+ };
343
+ }
344
+ //# sourceMappingURL=grammar-contracts.js.map
345
+ //# debugId=b959d41a-c0b6-55fe-a426-0be073f0511c
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { type GlobalOptions, type ExtensionRegistrationRegistry, type RegisteredExtensionCommandDefinition, type RegisteredExtensionFlagDefinitions, type RuntimeFieldRegistry, readSettings } from "../runtime-primitives.js";
7
7
  import { type McpToolContract } from "../../mcp/tool-definitions.js";
8
- import { PM_TOOL_ACTIONS, type CliFlagContract, type CommanderOptionAliasContract, type PmCommandOutputBudgetContract } from "../cli-contracts.js";
8
+ import { PM_TOOL_ACTIONS, type CliFlagContract, type CommanderOptionAliasContract, type PmCommandOutputBudgetContract, type PmCommandAliasContract } from "../cli-contracts.js";
9
9
  import { type ListCommandName, type ListProjectionMode } from "../query/list.js";
10
10
  import { type PmContextIntentContract } from "../context-intent-contracts.js";
11
11
  import { type PmReadOutputSurfaceContract } from "../read-output-contracts.js";
@@ -14,6 +14,7 @@ import { type PmCommandVisibilityTier } from "../agent-capability-contracts.js";
14
14
  import type { PmErrorCodeContract } from "../error-code-catalog.js";
15
15
  import { type PmCommandOutputEnvelopeContract } from "../output-contracts.js";
16
16
  import { type PmCommandExitContract, type PmCommandExitOutcomeContract } from "./command-exit-contracts.js";
17
+ import { type PmCommandDestinationContract } from "./grammar-contracts.js";
17
18
  /** Documents the contracts command options payload exchanged by command, SDK, and package integrations. */
18
19
  export interface ContractsCommandOptions {
19
20
  /** Value that configures or reports action for this contract. */
@@ -45,9 +46,14 @@ interface CommandFlagSurface {
45
46
  name: string;
46
47
  }>;
47
48
  }
48
- interface CommandAliasSurface {
49
+ /** Grouped command-alias projection retained for backward-compatible consumers. */
50
+ export interface CommandAliasSurface {
51
+ /** Canonical command path shared by the grouped aliases. */
49
52
  canonical: string;
53
+ /** Accepted alternate spellings for the canonical path. */
50
54
  aliases: string[];
55
+ /** Per-spelling lifecycle, visibility, replacement, and ownership metadata. */
56
+ contracts?: PmCommandAliasContract[];
51
57
  }
52
58
  /** Machine-readable projection behavior for one list command. */
53
59
  interface ListCommandProjectionSurface {
@@ -93,6 +99,15 @@ export interface ContractsResult {
93
99
  list_projections?: ListCommandProjectionSurface[];
94
100
  /** Value that configures or reports command aliases for this contract. */
95
101
  command_aliases?: CommandAliasSurface[];
102
+ /** Noun–verb routing policy and exhaustive current-command destinations. */
103
+ grammar_contracts?: {
104
+ nouns: readonly string[];
105
+ shared_verbs: readonly string[];
106
+ scope_before_verb: boolean;
107
+ visible_top_level_ceiling: number;
108
+ ceiling_raise_requires_pm_item: boolean;
109
+ destinations?: readonly PmCommandDestinationContract[];
110
+ };
96
111
  /** Value that configures or reports commander aliases for this contract. */
97
112
  commander_aliases?: Record<string, CommanderOptionAliasContract[]>;
98
113
  /** Value that configures or reports extension commands for this contract. */
@@ -283,6 +298,8 @@ declare function normalizeCommandForRuntimeFieldFlags(command: string): string;
283
298
  declare function toRuntimeLongFlagToken(token: string): string | null;
284
299
  declare function toRuntimeShortFlagToken(token: string): string | null;
285
300
  declare function buildRuntimeFieldFlagContracts(fieldRegistry: RuntimeFieldRegistry): Map<string, CliFlagContract[]>;
301
+ /** Build the executable alias projection from a command catalog and alias table. */
302
+ export declare function buildCommandAliasSurface(commands: string[], aliasContracts?: readonly PmCommandAliasContract[]): CommandAliasSurface[];
286
303
  declare function attachCreateRequiredOptionContracts(schema: Record<string, unknown>, metadata: Record<string, unknown>): Record<string, unknown>;
287
304
  declare function readContractsSettings(pmRoot: string, readSettingsFn?: typeof readSettings): Promise<Awaited<ReturnType<typeof readSettings>>>;
288
305
  declare function buildCommandSummarySurface(commands: readonly string[], extensionContracts?: readonly ExtensionCommandContract[]): CommandSummarySurface[];
@@ -4,10 +4,10 @@
4
4
  * Implements the pm contracts 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]="8cdd82c3-979e-5f7f-bc72-592c7e55f11c")}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]="9a66a2a0-94be-595b-983d-347ec95af85e")}catch(e){}}();
8
8
  import { EXIT_CODE, SETTINGS_DEFAULTS, PmCliError, activateExtensions, getActiveExtensionRegistrations, loadExtensions, pathExists, commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
9
9
  import { buildMcpToolContracts, } from "../../mcp/tool-definitions.js";
10
- import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, ASSURANCE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_OUTPUT_DEGRADATION_STEPS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, resolvePmCommandOutputBudget, } from "../cli-contracts.js";
10
+ import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, ASSURANCE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_OUTPUT_DEGRADATION_STEPS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_DEPRECATED_TOOL_ACTIONS, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, PM_COMMAND_ALIAS_CONTRACTS, resolvePmCommandOutputBudget, } from "../cli-contracts.js";
11
11
  import { GOVERNANCE_CLOSE_VALIDATION_DEFAULT_VALUES, GOVERNANCE_CREATE_MODE_DEFAULT_VALUES, GOVERNANCE_OWNERSHIP_ENFORCEMENT_VALUES, GOVERNANCE_WORKFLOW_ENFORCEMENT_VALUES, } from "../../types.js";
12
12
  import { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, LIST_COMMAND_DEFAULT_PROJECTIONS, } from "../query/list.js";
13
13
  import { getActiveContextIntentContracts, } from "../context-intent-contracts.js";
@@ -19,6 +19,7 @@ import { resolvePmCommandOutputEnvelope, } from "../output-contracts.js";
19
19
  import { PM_COMMAND_EXIT_OUTCOME_CONTRACTS, resolvePmCommandExitContract, } from "./command-exit-contracts.js";
20
20
  import { BUILTIN_RELATIONSHIP_KINDS } from "../relationship-kinds/contract.js";
21
21
  import { ASSURANCE_GATE_TRIGGERS, ASSURANCE_MEASUREMENT_SOURCE_KINDS, } from "../governance/assurance.js";
22
+ import { PM_CLI_GRAMMAR_CONTRACT, PM_COMMAND_DESTINATION_CONTRACTS, } from "./grammar-contracts.js";
22
23
  const AGENT_BOOTSTRAP_FLAGS = new Map([
23
24
  [
24
25
  "claim",
@@ -1192,12 +1193,40 @@ function buildCommandFlagSurface(commands, extensionFlagMap, runtimeFieldFlagMap
1192
1193
  })
1193
1194
  .sort((left, right) => left.command.localeCompare(right.command));
1194
1195
  }
1195
- function buildCommandAliasSurface(commands) {
1196
+ /** Build the executable alias projection from a command catalog and alias table. */
1197
+ export function buildCommandAliasSurface(commands, aliasContracts = PM_COMMAND_ALIAS_CONTRACTS) {
1196
1198
  const commandSet = new Set(commands);
1197
- return CANONICAL_COMMAND_ALIASES.map((entry) => ({
1198
- canonical: entry.canonical,
1199
- aliases: entry.aliases.filter((alias) => commandSet.has(alias)),
1200
- })).filter((entry) => commandSet.has(entry.canonical) && entry.aliases.length > 0);
1199
+ const grouped = new Map();
1200
+ for (const entry of CANONICAL_COMMAND_ALIASES) {
1201
+ const aliases = entry.aliases.filter((alias) => commandSet.has(alias));
1202
+ grouped.set(entry.canonical, {
1203
+ canonical: entry.canonical,
1204
+ aliases,
1205
+ contracts: [],
1206
+ });
1207
+ }
1208
+ for (const contract of aliasContracts) {
1209
+ if (!commandSet.has(contract.canonical)) {
1210
+ continue;
1211
+ }
1212
+ if (contract.registration === "commander" &&
1213
+ !commandSet.has(contract.alias)) {
1214
+ continue;
1215
+ }
1216
+ const entry = grouped.get(contract.canonical) ?? {
1217
+ canonical: contract.canonical,
1218
+ aliases: [],
1219
+ contracts: [],
1220
+ };
1221
+ if (!entry.aliases.includes(contract.alias)) {
1222
+ entry.aliases.push(contract.alias);
1223
+ }
1224
+ entry.contracts.push(contract);
1225
+ grouped.set(contract.canonical, entry);
1226
+ }
1227
+ return [...grouped.values()]
1228
+ .map(({ contracts, ...entry }) => contracts.length === 0 ? entry : { ...entry, contracts })
1229
+ .sort((left, right) => left.canonical.localeCompare(right.canonical));
1201
1230
  }
1202
1231
  function buildCommanderAliasSurface() {
1203
1232
  return {
@@ -1382,6 +1411,11 @@ function collectContractsActionDescriptors(selection, mergedExtensionContracts)
1382
1411
  const actionDescriptors = collectActionContractDescriptors(mergedExtensionContracts, {
1383
1412
  includePackageOwnedActions: shouldIncludePackageOwnedActions(selection),
1384
1413
  });
1414
+ if (selection.selectedAction === undefined &&
1415
+ selection.selectedCommand === undefined) {
1416
+ const deprecatedActions = new Set(PM_DEPRECATED_TOOL_ACTIONS);
1417
+ return actionDescriptors.filter((descriptor) => !deprecatedActions.has(descriptor.action));
1418
+ }
1385
1419
  if (shouldIncludePackageOwnedActions(selection) &&
1386
1420
  selection.selectedCommand !== undefined &&
1387
1421
  PACKAGE_OWNED_COMMANDS.has(selection.selectedCommand) &&
@@ -1604,8 +1638,13 @@ function resolveContractsCommands(selection, actionContext) {
1604
1638
  }
1605
1639
  return actionContext.commandCatalog;
1606
1640
  }
1607
- function resolveOutputCommands(_selection, commands) {
1608
- return commands;
1641
+ function resolveOutputCommands(selection, commands) {
1642
+ if (selection.selectedCommand !== undefined ||
1643
+ selection.selectedAction !== undefined) {
1644
+ return commands;
1645
+ }
1646
+ const hiddenAliases = new Set(PM_COMMAND_ALIAS_CONTRACTS.filter((contract) => contract.hidden && contract.lifecycle === "deprecated").map((contract) => contract.alias));
1647
+ return commands.filter((command) => !hiddenAliases.has(command));
1609
1648
  }
1610
1649
  function canonicalSummaryCommand(command) {
1611
1650
  const rootCommand = command.split(" ")[0];
@@ -1871,9 +1910,7 @@ function attachFlagContractsResult(result, selection, runtime, outputCommands, c
1871
1910
  else {
1872
1911
  result.command_flags_omitted_reason = "unfiltered_default_brief";
1873
1912
  }
1874
- if (commandAliases.length > 0) {
1875
- result.command_aliases = commandAliases;
1876
- }
1913
+ result.command_aliases = commandAliases;
1877
1914
  }
1878
1915
  function attachCommanderAliasContractsResult(result, selection) {
1879
1916
  if (selection.schemaOnly ||
@@ -1897,6 +1934,13 @@ function attachAgentCommandContractsResult(result, outputCommands, extensionComm
1897
1934
  degradation_ladder: [...PM_OUTPUT_DEGRADATION_STEPS],
1898
1935
  allows_unbounded_opt_out: true,
1899
1936
  };
1937
+ result.grammar_contracts = {
1938
+ nouns: PM_CLI_GRAMMAR_CONTRACT.nouns,
1939
+ shared_verbs: PM_CLI_GRAMMAR_CONTRACT.shared_verbs,
1940
+ scope_before_verb: PM_CLI_GRAMMAR_CONTRACT.scope_before_verb,
1941
+ visible_top_level_ceiling: PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling,
1942
+ ceiling_raise_requires_pm_item: PM_CLI_GRAMMAR_CONTRACT.ceiling_raise_requires_pm_item,
1943
+ };
1900
1944
  }
1901
1945
  /** Implements run contracts for the public runtime surface of this module. */
1902
1946
  export async function runContracts(options, global) {
@@ -1916,7 +1960,7 @@ export async function runContracts(options, global) {
1916
1960
  if (selection.summary) {
1917
1961
  return result;
1918
1962
  }
1919
- const commandAliases = buildCommandAliasSurface(commands);
1963
+ const commandAliases = buildCommandAliasSurface(actionContext.commandCatalog);
1920
1964
  if (!(selection.flagsOnly && !selection.fullOutput)) {
1921
1965
  attachRuntimeContractsResult(result, runtime, selection);
1922
1966
  }
@@ -1929,6 +1973,9 @@ export async function runContracts(options, global) {
1929
1973
  gate_triggers: [...ASSURANCE_GATE_TRIGGERS],
1930
1974
  };
1931
1975
  }
1976
+ if (selection.fullOutput && result.grammar_contracts) {
1977
+ result.grammar_contracts.destinations = PM_COMMAND_DESTINATION_CONTRACTS;
1978
+ }
1932
1979
  // pm-4os2: snapshot the static MCP tool surface in the full projection so
1933
1980
  // `pnpm contracts:check` (CI static gate) fails on unintended inputSchema
1934
1981
  // drift in src/mcp/tool-definitions.ts.
@@ -1983,4 +2030,4 @@ export const _testOnlyContractsCommand = {
1983
2030
  toRuntimeShortFlagToken,
1984
2031
  };
1985
2032
  //# sourceMappingURL=runtime-contracts.js.map
1986
- //# debugId=8cdd82c3-979e-5f7f-bc72-592c7e55f11c
2033
+ //# debugId=9a66a2a0-94be-595b-983d-347ec95af85e
@@ -4,7 +4,7 @@
4
4
  * Defines SDK command-contract metadata for Tool Parameter Tables.
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]="4749819e-f2af-5a17-9d32-2e2770c497c3")}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]="e0314840-0dac-5966-8c4f-3a3e5db15688")}catch(e){}}();
8
8
  import { PLAN_HARNESS_VALUES, PLAN_MODE_VALUES, PLAN_STEP_LINK_KIND_VALUES, PLAN_STEP_STATUS_VALUES, } from "../../types/index.js";
9
9
  import { PM_READ_OUTPUT_SESSION_MAX_SEEN_ITEM_IDS } from "../read-output-session.js";
10
10
  import { ASSURANCE_DEFINITION_SCHEMA } from "./schemas/assurance-definition.js";
@@ -191,6 +191,7 @@ export const PM_TOOL_PARAMETER_PROPERTIES = {
191
191
  schedulePreset: { type: "string", enum: ["lightweight"] },
192
192
  status: { type: "string" },
193
193
  since: { type: "string", format: "date-time" },
194
+ cursorMode: { type: "string", enum: ["batch", "row"] },
194
195
  threshold: { type: "number", minimum: 0, maximum: 1 },
195
196
  filterStatus: { type: "string" },
196
197
  filterType: { type: "string" },
@@ -1951,6 +1952,10 @@ export const PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA = {
1951
1952
  description: "Maximum mutation events returned, from 0 through 1000.",
1952
1953
  examples: [0, 100],
1953
1954
  },
1955
+ cursorMode: {
1956
+ description: "Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event.",
1957
+ examples: ["batch", "row"],
1958
+ },
1954
1959
  },
1955
1960
  remind: {
1956
1961
  at: {
@@ -2067,4 +2072,4 @@ export const PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA = {
2067
2072
  },
2068
2073
  };
2069
2074
  //# sourceMappingURL=tool-parameter-tables.js.map
2070
- //# debugId=4749819e-f2af-5a17-9d32-2e2770c497c3
2075
+ //# debugId=e0314840-0dac-5966-8c4f-3a3e5db15688
@@ -91,14 +91,14 @@ export interface PmActionToolInputSchemaOptions {
91
91
  */
92
92
  export declare function buildPmActionToolInputSchema(action: PmToolAction, options?: PmActionToolInputSchemaOptions): Record<string, unknown>;
93
93
  /** Canonical version of the action-scoped strict MCP tool-parameters schema (`PM_TOOL_PARAMETERS_SCHEMA`). Exported as the single source of truth so the MCP server, the `pm contracts` command, SDK consumers, and contract tests bind to one version constant. Bump the patch/minor for additive, backward-compatible schema changes; bump the MAJOR for breaking changes — the major also drives the `$id` `tool-parameters-v{major}` slug, so the two never drift. */
94
- export declare const PM_TOOL_PARAMETERS_SCHEMA_VERSION: "4.7.0";
94
+ export declare const PM_TOOL_PARAMETERS_SCHEMA_VERSION: "4.8.0";
95
95
  /**
96
96
  * Major component of {@link PM_TOOL_PARAMETERS_SCHEMA_VERSION}, used to build the
97
97
  * schema `$id` slug so a breaking version bump renames the document in lockstep.
98
98
  */
99
99
  export declare const PM_TOOL_PARAMETERS_SCHEMA_MAJOR: string;
100
100
  /** Version of the provider-compatible flat tool-parameters schema (`PM_PROVIDER_TOOL_PARAMETERS_SCHEMA`). Tracked separately from the strict schema because the flat projection evolves independently. */
101
- export declare const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION: "1.3.0";
101
+ export declare const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION: "1.4.0";
102
102
  /** Public contract for pm tool parameters schema, shared by SDK and presentation-layer consumers. */
103
103
  export declare const PM_TOOL_PARAMETERS_SCHEMA: Record<string, unknown>;
104
104
  declare function toProviderCompatibleParameterDefinition(key: string, definition: unknown): Record<string, unknown>;