@unbrained/pm-cli 2026.8.18 → 2026.8.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +16 -2
- package/dist/cli/error-guidance.js +3 -2
- package/dist/cli/help-content.js +32 -13
- package/dist/cli/help-json-payload.d.ts +15 -0
- package/dist/cli/help-json-payload.js +101 -23
- package/dist/cli/main.js +6 -2
- package/dist/cli/register-list-query.js +8 -5
- package/dist/cli/register-mutation.js +8 -8
- package/dist/cli/register-operations.js +6 -6
- package/dist/cli-bundle/bundle-manifest.json +139 -139
- package/dist/cli-bundle/chunks/chunk-4NRRH7AM.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-UYCLQVL2.js → chunk-4THEB6PD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-BHYMXLAE.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +197 -0
- package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +35 -0
- package/dist/cli-bundle/chunks/chunk-OI4XI562.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.js → chunk-OIOKV6NO.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-5UZZAJKR.js → chunk-QXSH7BLM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.js → chunk-TOXJM4WA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GNFAFIJI.js → chunk-YBMRWW4E.js} +44 -44
- package/dist/cli-bundle/chunks/{register-list-query-I23LALEE.js → register-list-query-Y56KINDU.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-AUWVCW4M.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-PZQPHXW5.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-I4LUHGVW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5AF3ZBNB.js → chunk-34QBIYZI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.js → chunk-BJRYFVSH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-DKPLYW3L.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-EF6ZS5GH.js} +44 -44
- package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-ESISGDAY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-EXBCLIBU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JDOMQ7VQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MCZXYZAF.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-ODHQEECS.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3TKWMNKF.js → chunk-PRHY2IMX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-US7VEYZG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-VXDSU5MC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-ZBIQQYMI.js} +2 -2
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -1
- package/dist/cli-bundle/sdk-core.js +31 -31
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +32 -32
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +5 -4
- package/dist/core/shared/errors.d.ts +2 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/sdk/agent/refusal-closure.d.ts +41 -0
- package/dist/sdk/agent/refusal-closure.js +92 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- package/dist/sdk/agent-capability-contracts.d.ts +13 -0
- package/dist/sdk/agent-capability-contracts.js +104 -7
- package/dist/sdk/cli-contracts/command-aliases.js +18 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
- package/dist/sdk/cli-contracts/commander-types.js +5 -4
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +5 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +75 -8
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +55 -0
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +240 -0
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +81 -0
- package/dist/sdk/cli-contracts/grammar-contracts.js +615 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
- package/dist/sdk/cli-contracts/runtime-contracts.js +42 -12
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
- package/dist/sdk/cli-contracts.d.ts +3 -2
- package/dist/sdk/cli-contracts.js +5 -4
- package/dist/sdk/context-intent-contracts.d.ts +2 -2
- package/dist/sdk/context-intent-contracts.js +22 -7
- package/dist/sdk/contracts.d.ts +2 -0
- package/dist/sdk/contracts.js +4 -2
- package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
- package/dist/sdk/flag-invocation-contracts.js +218 -9
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +134 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +154 -22
- package/dist/sdk/index.d.ts +7 -5
- package/dist/sdk/index.js +7 -5
- package/dist/sdk/output-projection.d.ts +2 -0
- package/dist/sdk/output-projection.js +11 -5
- package/dist/sdk/query/get.js +25 -6
- package/dist/sdk/query/list.js +16 -2
- package/dist/sdk/query/search-contracts.d.ts +1 -1
- package/dist/sdk/query/search-contracts.js +23 -9
- package/dist/sdk/query/search.js +3 -3
- package/dist/sdk/read-output/continuation.d.ts +1 -1
- package/dist/sdk/read-output/continuation.js +7 -24
- package/dist/sdk/read-output-contracts.js +55 -6
- package/dist/sdk/read-output-rows.d.ts +4 -0
- package/dist/sdk/read-output-rows.js +47 -18
- package/dist/sdk/runtime.js +9 -5
- package/dist/sdk/workspace-snapshot.d.ts +2 -0
- package/dist/sdk/workspace-snapshot.js +10 -2
- package/docs/COMMANDS.md +16 -4
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
- package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
- package/docs/SDK.md +6 -0
- package/docs/TESTING.md +14 -1
- package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
- package/marketplace.json +2 -2
- package/package.json +5 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/generate-agent-capability-surfaces.mjs +20 -14
- package/sdk/public-surface.json +576 -12
- package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
- package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
- package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
- package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Canonical top-level domains an agent must retain to route pm operations. */
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
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]="686e65f1-bf69-59f6-8e65-db4c4838008b")}catch(e){}}();
|
|
4
4
|
export const PM_CLI_GRAMMAR_NOUNS = [
|
|
5
5
|
"item",
|
|
6
6
|
"list",
|
|
@@ -50,6 +50,494 @@ export const PM_CLI_SHARED_VERBS = [
|
|
|
50
50
|
"uninstall",
|
|
51
51
|
"verify",
|
|
52
52
|
];
|
|
53
|
+
function positionalSlot(name, valueKind, required, options = {}) {
|
|
54
|
+
return {
|
|
55
|
+
name,
|
|
56
|
+
required,
|
|
57
|
+
variadic: options.variadic === true,
|
|
58
|
+
value_kind: valueKind,
|
|
59
|
+
polymorphic: options.polymorphic === true,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Convert a kebab-case positional action into a sentence-leading verb phrase. */
|
|
63
|
+
function positionalActionVerb(action) {
|
|
64
|
+
const phrase = action.replaceAll("-", " ");
|
|
65
|
+
return `${phrase.charAt(0).toUpperCase()}${phrase.slice(1)}`;
|
|
66
|
+
}
|
|
67
|
+
const ITEM_ID = positionalSlot("id", "item_id", true);
|
|
68
|
+
const OPTIONAL_ITEM_ID = positionalSlot("id", "item_id", false);
|
|
69
|
+
const OPTIONAL_TEXT = positionalSlot("text", "string", false);
|
|
70
|
+
const PLAN_ITEM_ID = positionalSlot("plan-id", "item_id", true);
|
|
71
|
+
const PLAN_STEP = positionalSlot("step", "string", true);
|
|
72
|
+
const PLAN_CREATE_FLAGS = [
|
|
73
|
+
"--acceptance-criteria",
|
|
74
|
+
"--actual-result",
|
|
75
|
+
"--affected-version",
|
|
76
|
+
"--assignee",
|
|
77
|
+
"--blocked-by",
|
|
78
|
+
"--blocked-reason",
|
|
79
|
+
"--blocks",
|
|
80
|
+
"--body",
|
|
81
|
+
"--claim",
|
|
82
|
+
"--comment",
|
|
83
|
+
"--component",
|
|
84
|
+
"--confidence",
|
|
85
|
+
"--create-mode",
|
|
86
|
+
"--customer-impact",
|
|
87
|
+
"--deadline",
|
|
88
|
+
"--definition-of-ready",
|
|
89
|
+
"--description",
|
|
90
|
+
"--doc",
|
|
91
|
+
"--environment",
|
|
92
|
+
"--estimate",
|
|
93
|
+
"--event",
|
|
94
|
+
"--expected-result",
|
|
95
|
+
"--fixed-version",
|
|
96
|
+
"--file",
|
|
97
|
+
"--from-search",
|
|
98
|
+
"--goal",
|
|
99
|
+
"--harness",
|
|
100
|
+
"--impact",
|
|
101
|
+
"--learning",
|
|
102
|
+
"--message",
|
|
103
|
+
"--mode",
|
|
104
|
+
"--note",
|
|
105
|
+
"--objective",
|
|
106
|
+
"--order",
|
|
107
|
+
"--outcome",
|
|
108
|
+
"--parent",
|
|
109
|
+
"--priority",
|
|
110
|
+
"--rank",
|
|
111
|
+
"--related",
|
|
112
|
+
"--release",
|
|
113
|
+
"--reminder",
|
|
114
|
+
"--reporter",
|
|
115
|
+
"--repro-steps",
|
|
116
|
+
"--resolution",
|
|
117
|
+
"--resume-context",
|
|
118
|
+
"--reviewer",
|
|
119
|
+
"--risk",
|
|
120
|
+
"--scope",
|
|
121
|
+
"--severity",
|
|
122
|
+
"--sprint",
|
|
123
|
+
"--status",
|
|
124
|
+
"--step",
|
|
125
|
+
"--step-blocked-reason",
|
|
126
|
+
"--step-body",
|
|
127
|
+
"--step-evidence",
|
|
128
|
+
"--step-owner",
|
|
129
|
+
"--step-replacement",
|
|
130
|
+
"--step-status",
|
|
131
|
+
"--step-title",
|
|
132
|
+
"--tags",
|
|
133
|
+
"--template",
|
|
134
|
+
"--test",
|
|
135
|
+
"--title",
|
|
136
|
+
"--type-option",
|
|
137
|
+
"--unblock-note",
|
|
138
|
+
"--value",
|
|
139
|
+
"--why-now",
|
|
140
|
+
];
|
|
141
|
+
const PLAN_STEP_FLAGS = [
|
|
142
|
+
"--allow-multiple-active",
|
|
143
|
+
"--depends-on",
|
|
144
|
+
"--file",
|
|
145
|
+
"--force",
|
|
146
|
+
"--message",
|
|
147
|
+
"--step-blocked-reason",
|
|
148
|
+
"--step-body",
|
|
149
|
+
"--step-evidence",
|
|
150
|
+
"--step-owner",
|
|
151
|
+
"--step-status",
|
|
152
|
+
"--step-title",
|
|
153
|
+
"--test",
|
|
154
|
+
];
|
|
155
|
+
const PLAN_STEP_ACTION_DESCRIPTIONS = {
|
|
156
|
+
"update-step": "Update one declared Plan step.",
|
|
157
|
+
"complete-step": "Complete one declared Plan step.",
|
|
158
|
+
"block-step": "Block one declared Plan step.",
|
|
159
|
+
"remove-step": "Remove one declared Plan step.",
|
|
160
|
+
link: "Link one dependency to a declared Plan step.",
|
|
161
|
+
unlink: "Unlink one dependency from a declared Plan step.",
|
|
162
|
+
};
|
|
163
|
+
/** Virtual action paths dispatched by positional parent commands. */
|
|
164
|
+
export const PM_POSITIONAL_ACTION_CONTRACTS = [
|
|
165
|
+
{
|
|
166
|
+
command: "plan create",
|
|
167
|
+
parent: "plan",
|
|
168
|
+
action: "create",
|
|
169
|
+
slots: [positionalSlot("title", "string", false, { polymorphic: true })],
|
|
170
|
+
accepted_flags: PLAN_CREATE_FLAGS,
|
|
171
|
+
description: "Create a Plan item and optionally seed its ordered steps.",
|
|
172
|
+
example: 'pm plan create --title "Refactor lock retry"',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
command: "plan show",
|
|
176
|
+
parent: "plan",
|
|
177
|
+
action: "show",
|
|
178
|
+
slots: [PLAN_ITEM_ID],
|
|
179
|
+
accepted_flags: ["--depth", "--fields"],
|
|
180
|
+
description: "Read one Plan item with a bounded plan projection.",
|
|
181
|
+
example: "pm plan show pm-a1b2 --depth standard",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
command: "plan add-step",
|
|
185
|
+
parent: "plan",
|
|
186
|
+
action: "add-step",
|
|
187
|
+
slots: [PLAN_ITEM_ID],
|
|
188
|
+
accepted_flags: PLAN_STEP_FLAGS,
|
|
189
|
+
description: "Append one ordered step to a Plan item.",
|
|
190
|
+
example: 'pm plan add-step pm-a1b2 --step-title "Run tests"',
|
|
191
|
+
},
|
|
192
|
+
...Object.entries(PLAN_STEP_ACTION_DESCRIPTIONS).map(([action, description]) => ({
|
|
193
|
+
command: `plan ${action}`,
|
|
194
|
+
parent: "plan",
|
|
195
|
+
action,
|
|
196
|
+
slots: [PLAN_ITEM_ID, PLAN_STEP],
|
|
197
|
+
accepted_flags: PLAN_STEP_FLAGS,
|
|
198
|
+
description,
|
|
199
|
+
example: `pm plan ${action} pm-a1b2 plan-step-001`,
|
|
200
|
+
})),
|
|
201
|
+
{
|
|
202
|
+
command: "plan reorder-step",
|
|
203
|
+
parent: "plan",
|
|
204
|
+
action: "reorder-step",
|
|
205
|
+
slots: [
|
|
206
|
+
PLAN_ITEM_ID,
|
|
207
|
+
PLAN_STEP,
|
|
208
|
+
positionalSlot("new-order", "integer", true),
|
|
209
|
+
],
|
|
210
|
+
accepted_flags: ["--force", "--message"],
|
|
211
|
+
description: "Move one Plan step to a declared integer order.",
|
|
212
|
+
example: "pm plan reorder-step pm-a1b2 plan-step-001 2",
|
|
213
|
+
},
|
|
214
|
+
...[
|
|
215
|
+
"decision",
|
|
216
|
+
"discovery",
|
|
217
|
+
"validation",
|
|
218
|
+
"resume",
|
|
219
|
+
"approve",
|
|
220
|
+
"materialize",
|
|
221
|
+
].map((action) => ({
|
|
222
|
+
command: `plan ${action}`,
|
|
223
|
+
parent: "plan",
|
|
224
|
+
action,
|
|
225
|
+
slots: [PLAN_ITEM_ID],
|
|
226
|
+
accepted_flags: PLAN_STEP_FLAGS,
|
|
227
|
+
description: `${positionalActionVerb(action)} for one Plan item.`,
|
|
228
|
+
example: `pm plan ${action} pm-a1b2`,
|
|
229
|
+
})),
|
|
230
|
+
...["list", "show", "put", "remove"].map((action) => ({
|
|
231
|
+
command: `assurance ${action}`,
|
|
232
|
+
parent: "assurance",
|
|
233
|
+
action,
|
|
234
|
+
slots: [
|
|
235
|
+
positionalSlot("kind", "string", true),
|
|
236
|
+
...(action === "list" ? [] : [positionalSlot("id", "string", true)]),
|
|
237
|
+
],
|
|
238
|
+
accepted_flags: action === "put"
|
|
239
|
+
? ["--author", "--definition", "--message"]
|
|
240
|
+
: action === "remove"
|
|
241
|
+
? ["--author", "--message"]
|
|
242
|
+
: [],
|
|
243
|
+
description: `${positionalActionVerb(action)} assurance declarations by kind.`,
|
|
244
|
+
example: action === "list"
|
|
245
|
+
? "pm assurance list measurement"
|
|
246
|
+
: `pm assurance ${action} measurement example-id`,
|
|
247
|
+
})),
|
|
248
|
+
{
|
|
249
|
+
command: "assurance run",
|
|
250
|
+
parent: "assurance",
|
|
251
|
+
action: "run",
|
|
252
|
+
slots: [positionalSlot("gate-id", "string", true)],
|
|
253
|
+
accepted_flags: ["--dry-run", "--trigger", "--tree"],
|
|
254
|
+
description: "Evaluate one assurance gate for a lifecycle trigger.",
|
|
255
|
+
example: "pm assurance run tracker-context-quality --trigger ci --dry-run",
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
command: "assurance verdicts",
|
|
259
|
+
parent: "assurance",
|
|
260
|
+
action: "verdicts",
|
|
261
|
+
slots: [positionalSlot("gate-id", "string", false)],
|
|
262
|
+
accepted_flags: ["--gate", "--limit"],
|
|
263
|
+
description: "List bounded assurance verdict history.",
|
|
264
|
+
example: "pm assurance verdicts --limit 20",
|
|
265
|
+
},
|
|
266
|
+
...["presets", "apply"].map((action) => ({
|
|
267
|
+
command: `assurance ${action}`,
|
|
268
|
+
parent: "assurance",
|
|
269
|
+
action,
|
|
270
|
+
slots: [positionalSlot("preset", "string", action === "apply")],
|
|
271
|
+
accepted_flags: ["--author", "--message", "--owner"],
|
|
272
|
+
description: action === "apply"
|
|
273
|
+
? "Apply one assurance adoption preset."
|
|
274
|
+
: "List available assurance adoption presets.",
|
|
275
|
+
example: action === "apply"
|
|
276
|
+
? "pm assurance apply software-delivery --owner <pm-item-id>"
|
|
277
|
+
: "pm assurance presets",
|
|
278
|
+
})),
|
|
279
|
+
{
|
|
280
|
+
command: "assurance derive",
|
|
281
|
+
parent: "assurance",
|
|
282
|
+
action: "derive",
|
|
283
|
+
slots: [],
|
|
284
|
+
accepted_flags: ["--apply", "--author", "--message", "--owner"],
|
|
285
|
+
description: "Derive assurance proposals from current project context.",
|
|
286
|
+
example: "pm assurance derive --owner pm-a1b2",
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
command: "assurance promote",
|
|
290
|
+
parent: "assurance",
|
|
291
|
+
action: "promote",
|
|
292
|
+
slots: [positionalSlot("assertion-id", "string", true)],
|
|
293
|
+
accepted_flags: ["--author", "--enforcement", "--message"],
|
|
294
|
+
description: "Promote one assertion into a warning or blocking gate.",
|
|
295
|
+
example: "pm assurance promote assertion-id --enforcement warn",
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
command: "assurance risk",
|
|
299
|
+
parent: "assurance",
|
|
300
|
+
action: "risk",
|
|
301
|
+
slots: [],
|
|
302
|
+
accepted_flags: ["--definition"],
|
|
303
|
+
description: "Analyze bounded defect-recurrence risk for a proposed change.",
|
|
304
|
+
example: 'pm assurance risk --definition \'{"change":{"files":[]}}\'',
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
command: "workspace snapshot create",
|
|
308
|
+
parent: "workspace snapshot",
|
|
309
|
+
action: "create",
|
|
310
|
+
slots: [positionalSlot("name", "string", false)],
|
|
311
|
+
accepted_flags: [],
|
|
312
|
+
description: "Capture authoritative tracker state as an immutable snapshot.",
|
|
313
|
+
example: "pm workspace snapshot create before-migration",
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
command: "workspace snapshot list",
|
|
317
|
+
parent: "workspace snapshot",
|
|
318
|
+
action: "list",
|
|
319
|
+
slots: [],
|
|
320
|
+
accepted_flags: [],
|
|
321
|
+
description: "List immutable workspace snapshots and named references.",
|
|
322
|
+
example: "pm workspace snapshot list",
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
command: "workspace snapshot inspect",
|
|
326
|
+
parent: "workspace snapshot",
|
|
327
|
+
action: "inspect",
|
|
328
|
+
slots: [positionalSlot("target", "string", true)],
|
|
329
|
+
accepted_flags: [],
|
|
330
|
+
description: "Inspect one workspace snapshot target.",
|
|
331
|
+
example: "pm workspace snapshot inspect before-migration",
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
command: "workspace snapshot restore",
|
|
335
|
+
parent: "workspace snapshot",
|
|
336
|
+
action: "restore",
|
|
337
|
+
slots: [positionalSlot("target", "string", true)],
|
|
338
|
+
accepted_flags: ["--author", "--dry-run", "--force", "--message"],
|
|
339
|
+
description: "Restore an immutable workspace snapshot with explicit recovery controls.",
|
|
340
|
+
example: "pm workspace snapshot restore before-migration --dry-run",
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
command: "workspace snapshot delete",
|
|
344
|
+
parent: "workspace snapshot",
|
|
345
|
+
action: "delete",
|
|
346
|
+
slots: [positionalSlot("target", "string", true)],
|
|
347
|
+
accepted_flags: [],
|
|
348
|
+
description: "Delete one workspace snapshot target.",
|
|
349
|
+
example: "pm workspace snapshot delete before-migration",
|
|
350
|
+
},
|
|
351
|
+
];
|
|
352
|
+
const POSITIONAL_ACTION_CONTRACTS_BY_SPECIFICITY = [
|
|
353
|
+
...PM_POSITIONAL_ACTION_CONTRACTS,
|
|
354
|
+
].sort((left, right) => right.command.length - left.command.length);
|
|
355
|
+
const EXPLICIT_POSITIONAL_SLOTS = new Map([
|
|
356
|
+
["append", [ITEM_ID, OPTIONAL_TEXT]],
|
|
357
|
+
[
|
|
358
|
+
"assurance",
|
|
359
|
+
[
|
|
360
|
+
positionalSlot("action", "action", true),
|
|
361
|
+
positionalSlot("kind", "string", false),
|
|
362
|
+
positionalSlot("id", "string", false),
|
|
363
|
+
],
|
|
364
|
+
],
|
|
365
|
+
["beads import", [positionalSlot("file", "string", false)]],
|
|
366
|
+
["changelog export", [positionalSlot("file", "string", false)]],
|
|
367
|
+
["claim", [OPTIONAL_ITEM_ID]],
|
|
368
|
+
["close", [ITEM_ID, OPTIONAL_TEXT]],
|
|
369
|
+
["close-task", [ITEM_ID, positionalSlot("reason", "string", false)]],
|
|
370
|
+
["comments", [ITEM_ID, OPTIONAL_TEXT]],
|
|
371
|
+
["completion", [positionalSlot("shell", "string", false)]],
|
|
372
|
+
[
|
|
373
|
+
"config",
|
|
374
|
+
[
|
|
375
|
+
positionalSlot("scope", "string", false, { polymorphic: true }),
|
|
376
|
+
positionalSlot("action", "action", false),
|
|
377
|
+
positionalSlot("key", "string", false),
|
|
378
|
+
positionalSlot("value", "string", false, { polymorphic: true }),
|
|
379
|
+
],
|
|
380
|
+
],
|
|
381
|
+
["copy", [ITEM_ID]],
|
|
382
|
+
[
|
|
383
|
+
"create",
|
|
384
|
+
[
|
|
385
|
+
positionalSlot("type-or-title", "string", false, { polymorphic: true }),
|
|
386
|
+
positionalSlot("title", "string", false),
|
|
387
|
+
],
|
|
388
|
+
],
|
|
389
|
+
["delete", [ITEM_ID]],
|
|
390
|
+
["deps", [ITEM_ID]],
|
|
391
|
+
["docs", [ITEM_ID]],
|
|
392
|
+
["event", [positionalSlot("title", "string", true)]],
|
|
393
|
+
[
|
|
394
|
+
"extension",
|
|
395
|
+
[positionalSlot("target", "string", false, { polymorphic: true })],
|
|
396
|
+
],
|
|
397
|
+
["extension list", []],
|
|
398
|
+
["extension scaffold", [positionalSlot("target", "string", true)]],
|
|
399
|
+
["files", [ITEM_ID]],
|
|
400
|
+
["files discover", [ITEM_ID]],
|
|
401
|
+
[
|
|
402
|
+
"files lookup",
|
|
403
|
+
[positionalSlot("paths", "string", true, { variadic: true })],
|
|
404
|
+
],
|
|
405
|
+
["focus", [OPTIONAL_ITEM_ID]],
|
|
406
|
+
["get", [ITEM_ID]],
|
|
407
|
+
[
|
|
408
|
+
"graph",
|
|
409
|
+
[
|
|
410
|
+
positionalSlot("subcommand", "action", true),
|
|
411
|
+
OPTIONAL_ITEM_ID,
|
|
412
|
+
positionalSlot("target", "item_id", false),
|
|
413
|
+
],
|
|
414
|
+
],
|
|
415
|
+
["guide", [positionalSlot("topic", "string", false)]],
|
|
416
|
+
["history", [ITEM_ID]],
|
|
417
|
+
["history-compact", [OPTIONAL_ITEM_ID]],
|
|
418
|
+
["history-redact", [ITEM_ID]],
|
|
419
|
+
["history-repair", [OPTIONAL_ITEM_ID]],
|
|
420
|
+
[
|
|
421
|
+
"init",
|
|
422
|
+
[positionalSlot("prefix-or-path", "string", false, { polymorphic: true })],
|
|
423
|
+
],
|
|
424
|
+
["install", [positionalSlot("targets", "string", false, { variadic: true })]],
|
|
425
|
+
["item complete", [ITEM_ID, positionalSlot("reason", "string", false)]],
|
|
426
|
+
["learnings", [ITEM_ID, OPTIONAL_TEXT]],
|
|
427
|
+
["meet", [positionalSlot("title", "string", true)]],
|
|
428
|
+
[
|
|
429
|
+
"merge",
|
|
430
|
+
[
|
|
431
|
+
positionalSlot("subcommand", "action", true),
|
|
432
|
+
positionalSlot("artifact", "string", false),
|
|
433
|
+
positionalSlot("base", "string", false),
|
|
434
|
+
positionalSlot("ours", "string", false),
|
|
435
|
+
positionalSlot("theirs", "string", false),
|
|
436
|
+
],
|
|
437
|
+
],
|
|
438
|
+
["notes", [ITEM_ID, OPTIONAL_TEXT]],
|
|
439
|
+
[
|
|
440
|
+
"package",
|
|
441
|
+
[positionalSlot("target", "string", false, { polymorphic: true })],
|
|
442
|
+
],
|
|
443
|
+
["package list", []],
|
|
444
|
+
["package scaffold", [positionalSlot("target", "string", true)]],
|
|
445
|
+
[
|
|
446
|
+
"packages",
|
|
447
|
+
[positionalSlot("target", "string", false, { polymorphic: true })],
|
|
448
|
+
],
|
|
449
|
+
["packages list", []],
|
|
450
|
+
["packages scaffold", [positionalSlot("target", "string", true)]],
|
|
451
|
+
["pause-task", [ITEM_ID]],
|
|
452
|
+
[
|
|
453
|
+
"plan",
|
|
454
|
+
[
|
|
455
|
+
positionalSlot("subcommand", "action", true),
|
|
456
|
+
positionalSlot("id", "item_id", false, { polymorphic: true }),
|
|
457
|
+
positionalSlot("step", "string", false),
|
|
458
|
+
positionalSlot("new-order", "integer", false),
|
|
459
|
+
],
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
"profile",
|
|
463
|
+
[
|
|
464
|
+
positionalSlot("subcommand", "action", true),
|
|
465
|
+
positionalSlot("name", "string", false),
|
|
466
|
+
],
|
|
467
|
+
],
|
|
468
|
+
["release", [ITEM_ID]],
|
|
469
|
+
["remind", [positionalSlot("title", "string", true)]],
|
|
470
|
+
["restore", [ITEM_ID, positionalSlot("target", "string", true)]],
|
|
471
|
+
[
|
|
472
|
+
"schema",
|
|
473
|
+
[
|
|
474
|
+
positionalSlot("subcommand", "action", true),
|
|
475
|
+
positionalSlot("name", "string", false),
|
|
476
|
+
],
|
|
477
|
+
],
|
|
478
|
+
[
|
|
479
|
+
"search-advanced",
|
|
480
|
+
[positionalSlot("keywords", "string", true, { variadic: true })],
|
|
481
|
+
],
|
|
482
|
+
["search", [positionalSlot("keywords", "string", true, { variadic: true })]],
|
|
483
|
+
["start-task", [ITEM_ID]],
|
|
484
|
+
[
|
|
485
|
+
"telemetry",
|
|
486
|
+
[
|
|
487
|
+
positionalSlot("namespace-or-subcommand", "action", false, {
|
|
488
|
+
polymorphic: true,
|
|
489
|
+
}),
|
|
490
|
+
positionalSlot("subcommand", "action", false),
|
|
491
|
+
],
|
|
492
|
+
],
|
|
493
|
+
["test", [ITEM_ID]],
|
|
494
|
+
["update", [ITEM_ID]],
|
|
495
|
+
["upgrade", [positionalSlot("target", "string", false)]],
|
|
496
|
+
[
|
|
497
|
+
"workspace snapshot",
|
|
498
|
+
[
|
|
499
|
+
positionalSlot("action", "action", true),
|
|
500
|
+
positionalSlot("target", "string", false),
|
|
501
|
+
],
|
|
502
|
+
],
|
|
503
|
+
...["activate", "adopt", "deactivate", "init", "uninstall"].flatMap((action) => ["extension", "package", "packages"].map((root) => [
|
|
504
|
+
`${root} ${action}`,
|
|
505
|
+
[positionalSlot("target", "string", true)],
|
|
506
|
+
])),
|
|
507
|
+
...["describe"].flatMap((action) => ["extension", "package", "packages"].map((root) => [
|
|
508
|
+
`${root} ${action}`,
|
|
509
|
+
[positionalSlot("target", "string", false)],
|
|
510
|
+
])),
|
|
511
|
+
...["install"].flatMap((action) => ["extension", "package", "packages"].map((root) => [
|
|
512
|
+
`${root} ${action}`,
|
|
513
|
+
[positionalSlot("targets", "string", false, { variadic: true })],
|
|
514
|
+
])),
|
|
515
|
+
["vcs abandon", [ITEM_ID]],
|
|
516
|
+
["vcs create", [positionalSlot("title", "string", true)]],
|
|
517
|
+
["vcs merge", [ITEM_ID]],
|
|
518
|
+
["vcs propose", [ITEM_ID]],
|
|
519
|
+
["vcs ref-create", [positionalSlot("name", "string", true)]],
|
|
520
|
+
["vcs show", [ITEM_ID]],
|
|
521
|
+
]);
|
|
522
|
+
/** Normalize a command path for every positional-contract lookup and identity check. */
|
|
523
|
+
function normalizePositionalCommandPath(command) {
|
|
524
|
+
return command.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
525
|
+
}
|
|
526
|
+
/** Resolve one declared signature without treating arbitrary object keys as commands. */
|
|
527
|
+
export function resolvePmCommandPositionalContract(command) {
|
|
528
|
+
const normalized = normalizePositionalCommandPath(command);
|
|
529
|
+
return PM_COMMAND_POSITIONAL_CONTRACTS.find((contract) => contract.command === normalized);
|
|
530
|
+
}
|
|
531
|
+
/** Resolve one action-specific help/contract view. */
|
|
532
|
+
export function resolvePmPositionalActionContract(command) {
|
|
533
|
+
const normalized = normalizePositionalCommandPath(command);
|
|
534
|
+
return POSITIONAL_ACTION_CONTRACTS_BY_SPECIFICITY.find((contract) => contract.command === normalized ||
|
|
535
|
+
normalized.startsWith(`${contract.command} `));
|
|
536
|
+
}
|
|
537
|
+
/** Format the shared action-flag tip rendered by text and structured help. */
|
|
538
|
+
export function formatPmPositionalActionFlagTip(acceptedFlags) {
|
|
539
|
+
return `Applicable flags: ${acceptedFlags.length > 0 ? acceptedFlags.join(", ") : "none"}.`;
|
|
540
|
+
}
|
|
53
541
|
function destinationRows(noun, target, disposition, owner, commands) {
|
|
54
542
|
return commands.map((command) => ({
|
|
55
543
|
command,
|
|
@@ -88,6 +576,10 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
|
|
|
88
576
|
"update",
|
|
89
577
|
"update-many",
|
|
90
578
|
]),
|
|
579
|
+
...destinationRows("item", "item files", "consolidation", "pm-ya7x55", [
|
|
580
|
+
"files discover",
|
|
581
|
+
"files lookup",
|
|
582
|
+
]),
|
|
91
583
|
...destinationRows("list", "list", "target_noun", "pm-pfqi", ["list"]),
|
|
92
584
|
...destinationRows("list", "list --group-by", "consolidation", "pm-xkgq", [
|
|
93
585
|
"aggregate",
|
|
@@ -153,9 +645,11 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
|
|
|
153
645
|
"package explore",
|
|
154
646
|
"package init",
|
|
155
647
|
"package install",
|
|
648
|
+
"package list",
|
|
156
649
|
"package manage",
|
|
157
650
|
"package migrate",
|
|
158
651
|
"package reload",
|
|
652
|
+
"package scaffold",
|
|
159
653
|
"package uninstall",
|
|
160
654
|
]),
|
|
161
655
|
...destinationRows("package", "package", "consolidation", "pm-tnud", [
|
|
@@ -170,9 +664,11 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
|
|
|
170
664
|
"extension explore",
|
|
171
665
|
"extension init",
|
|
172
666
|
"extension install",
|
|
667
|
+
"extension list",
|
|
173
668
|
"extension manage",
|
|
174
669
|
"extension migrate",
|
|
175
670
|
"extension reload",
|
|
671
|
+
"extension scaffold",
|
|
176
672
|
"extension uninstall",
|
|
177
673
|
"install",
|
|
178
674
|
"packages",
|
|
@@ -186,9 +682,11 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
|
|
|
186
682
|
"packages explore",
|
|
187
683
|
"packages init",
|
|
188
684
|
"packages install",
|
|
685
|
+
"packages list",
|
|
189
686
|
"packages manage",
|
|
190
687
|
"packages migrate",
|
|
191
688
|
"packages reload",
|
|
689
|
+
"packages scaffold",
|
|
192
690
|
"packages uninstall",
|
|
193
691
|
"upgrade",
|
|
194
692
|
]),
|
|
@@ -210,7 +708,9 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
|
|
|
210
708
|
"test-all",
|
|
211
709
|
"validate",
|
|
212
710
|
]),
|
|
711
|
+
...destinationRows("ops", "ops assurance", "consolidation", "pm-2tan", PM_POSITIONAL_ACTION_CONTRACTS.filter(({ parent }) => parent === "assurance").map(({ command }) => command)),
|
|
213
712
|
...destinationRows("plan", "plan", "target_noun", "pm-pbyu", ["plan"]),
|
|
713
|
+
...destinationRows("plan", "plan", "target_noun", "pm-2tan", PM_POSITIONAL_ACTION_CONTRACTS.filter(({ parent }) => parent === "plan").map(({ command }) => command)),
|
|
214
714
|
...destinationRows("contracts", "contracts", "target_noun", "pm-pbyu", [
|
|
215
715
|
"contracts",
|
|
216
716
|
]),
|
|
@@ -223,6 +723,15 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
|
|
|
223
723
|
"guide",
|
|
224
724
|
]),
|
|
225
725
|
];
|
|
726
|
+
/** Exhaustive current command and positional-action signature table. */
|
|
727
|
+
export const PM_COMMAND_POSITIONAL_CONTRACTS = [
|
|
728
|
+
...new Set(PM_COMMAND_DESTINATION_CONTRACTS.map(({ command }) => command)),
|
|
729
|
+
].map((command) => ({
|
|
730
|
+
command,
|
|
731
|
+
slots: resolvePmPositionalActionContract(command)?.slots ??
|
|
732
|
+
EXPLICIT_POSITIONAL_SLOTS.get(command) ??
|
|
733
|
+
[],
|
|
734
|
+
}));
|
|
226
735
|
/** Immutable grammar policy used by contracts and the CI gate. */
|
|
227
736
|
export const PM_CLI_GRAMMAR_CONTRACT = {
|
|
228
737
|
nouns: PM_CLI_GRAMMAR_NOUNS,
|
|
@@ -230,7 +739,111 @@ export const PM_CLI_GRAMMAR_CONTRACT = {
|
|
|
230
739
|
scope_before_verb: true,
|
|
231
740
|
visible_top_level_ceiling: 69,
|
|
232
741
|
ceiling_raise_requires_pm_item: true,
|
|
742
|
+
positional_shape_budget: 21,
|
|
233
743
|
};
|
|
744
|
+
/** Report explicit positional entries that no destination command declares. */
|
|
745
|
+
export function verifyExplicitPositionalSlotCensus(explicitCommands, destinationCommands) {
|
|
746
|
+
const destinations = new Set(destinationCommands);
|
|
747
|
+
return [...new Set(explicitCommands)]
|
|
748
|
+
.filter((command) => !destinations.has(command))
|
|
749
|
+
.map((command) => ({
|
|
750
|
+
code: "positional_signature_mismatch",
|
|
751
|
+
command,
|
|
752
|
+
detail: `Positional signature ${command} has no destination declaration.`,
|
|
753
|
+
}));
|
|
754
|
+
}
|
|
755
|
+
/** Return the semantic shape identity used by the positional-shape budget. */
|
|
756
|
+
export function positionalShapeKey(slots) {
|
|
757
|
+
return slots
|
|
758
|
+
.map(({ required, variadic, value_kind: valueKind, polymorphic }) => `${required ? "r" : "o"}:${variadic ? "v" : "s"}:${valueKind}:${polymorphic ? "p" : "m"}`)
|
|
759
|
+
.join("|");
|
|
760
|
+
}
|
|
761
|
+
/** Return the exact canonical identity of an ordered positional signature. */
|
|
762
|
+
export function positionalSignatureKey(slots) {
|
|
763
|
+
return slots
|
|
764
|
+
.map(({ name, required, variadic, value_kind: valueKind, polymorphic }) => `${name}:${required ? "r" : "o"}:${variadic ? "v" : "s"}:${valueKind}:${polymorphic ? "p" : "m"}`)
|
|
765
|
+
.join("|");
|
|
766
|
+
}
|
|
767
|
+
/** Return one deterministic finding for every repeated command path. */
|
|
768
|
+
function duplicatePositionalSignatureFindings(contracts, surface) {
|
|
769
|
+
const counts = new Map();
|
|
770
|
+
for (const { command } of contracts) {
|
|
771
|
+
const normalized = normalizePositionalCommandPath(command);
|
|
772
|
+
counts.set(normalized, (counts.get(normalized) ?? 0) + 1);
|
|
773
|
+
}
|
|
774
|
+
return [...counts.entries()]
|
|
775
|
+
.filter(([, count]) => count > 1)
|
|
776
|
+
.map(([command, count]) => ({
|
|
777
|
+
code: "positional_signature_mismatch",
|
|
778
|
+
command,
|
|
779
|
+
detail: `${count} ${surface} positional signatures exist for ${command}; exactly one is required.`,
|
|
780
|
+
}));
|
|
781
|
+
}
|
|
782
|
+
/** Compare independently observed Commander signatures with the SDK declaration. */
|
|
783
|
+
export function verifyPmCommandPositionalContracts(observed, options = {}) {
|
|
784
|
+
const declared = options.declared ?? PM_COMMAND_POSITIONAL_CONTRACTS;
|
|
785
|
+
const positionalShapeBudget = options.positionalShapeBudget ??
|
|
786
|
+
PM_CLI_GRAMMAR_CONTRACT.positional_shape_budget;
|
|
787
|
+
const declaredByCommand = new Map(declared.map((contract) => [normalizePositionalCommandPath(contract.command), contract]));
|
|
788
|
+
const observedByCommand = new Map(observed.map((contract) => [normalizePositionalCommandPath(contract.command), contract]));
|
|
789
|
+
const findings = [
|
|
790
|
+
...duplicatePositionalSignatureFindings(declared, "declared"),
|
|
791
|
+
...duplicatePositionalSignatureFindings(observed, "observed"),
|
|
792
|
+
...(options.declared === undefined
|
|
793
|
+
? [
|
|
794
|
+
...verifyExplicitPositionalSlotCensus(EXPLICIT_POSITIONAL_SLOTS.keys(), PM_COMMAND_DESTINATION_CONTRACTS.map(({ command }) => command)),
|
|
795
|
+
...verifyExplicitPositionalSlotCensus(PM_POSITIONAL_ACTION_CONTRACTS.map(({ command }) => command), PM_COMMAND_DESTINATION_CONTRACTS.map(({ command }) => command)),
|
|
796
|
+
]
|
|
797
|
+
: []),
|
|
798
|
+
];
|
|
799
|
+
for (const contract of declaredByCommand.values()) {
|
|
800
|
+
const normalizedCommand = normalizePositionalCommandPath(contract.command);
|
|
801
|
+
const actual = observedByCommand.get(normalizedCommand);
|
|
802
|
+
if (!actual) {
|
|
803
|
+
findings.push({
|
|
804
|
+
code: "missing_observed_signature",
|
|
805
|
+
command: contract.command,
|
|
806
|
+
detail: `No observed positional signature exists for ${contract.command}.`,
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
else if (positionalSignatureKey(actual.slots) !==
|
|
810
|
+
positionalSignatureKey(contract.slots)) {
|
|
811
|
+
findings.push({
|
|
812
|
+
code: "positional_signature_mismatch",
|
|
813
|
+
command: contract.command,
|
|
814
|
+
detail: `Observed positional signature for ${contract.command} differs from its declared SDK contract: observed=${positionalSignatureKey(actual.slots) || "<none>"}; declared=${positionalSignatureKey(contract.slots) || "<none>"}.`,
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
for (const contract of observedByCommand.values()) {
|
|
819
|
+
if (!declaredByCommand.has(normalizePositionalCommandPath(contract.command))) {
|
|
820
|
+
findings.push({
|
|
821
|
+
code: "stale_observed_signature",
|
|
822
|
+
command: contract.command,
|
|
823
|
+
detail: `Observed positional signature ${contract.command} has no declaration.`,
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
const positionalShapeCount = new Set(declared.map(({ slots }) => positionalShapeKey(slots))).size;
|
|
828
|
+
if (positionalShapeCount > positionalShapeBudget) {
|
|
829
|
+
findings.push({
|
|
830
|
+
code: "positional_shape_budget_exceeded",
|
|
831
|
+
command: "*",
|
|
832
|
+
detail: `Distinct positional shape count ${positionalShapeCount} exceeds budget ${positionalShapeBudget}.`,
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
findings.sort((left, right) => left.command !== right.command
|
|
836
|
+
? left.command.localeCompare(right.command)
|
|
837
|
+
: left.code.localeCompare(right.code));
|
|
838
|
+
return {
|
|
839
|
+
ok: findings.length === 0,
|
|
840
|
+
declared_command_count: declared.length,
|
|
841
|
+
observed_command_count: observed.length,
|
|
842
|
+
positional_shape_count: positionalShapeCount,
|
|
843
|
+
positional_shape_budget: positionalShapeBudget,
|
|
844
|
+
findings,
|
|
845
|
+
};
|
|
846
|
+
}
|
|
234
847
|
function validateCommandDestinations(commands, destinationsByCommand, nounSet) {
|
|
235
848
|
return commands.flatMap((command) => {
|
|
236
849
|
const destinations = destinationsByCommand.get(command) ?? [];
|
|
@@ -342,4 +955,4 @@ export function verifyPmCliGrammar(commands, aliases = [], destinations = PM_COM
|
|
|
342
955
|
};
|
|
343
956
|
}
|
|
344
957
|
//# sourceMappingURL=grammar-contracts.js.map
|
|
345
|
-
//# debugId=
|
|
958
|
+
//# debugId=686e65f1-bf69-59f6-8e65-db4c4838008b
|