@unbrained/pm-cli 2026.8.18 → 2026.8.20

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 (186) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +35 -2
  3. package/dist/cli/error-guidance.js +3 -2
  4. package/dist/cli/help-content.js +32 -13
  5. package/dist/cli/help-json-payload.d.ts +15 -0
  6. package/dist/cli/help-json-payload.js +101 -23
  7. package/dist/cli/main.js +6 -2
  8. package/dist/cli/register-list-query.js +18 -13
  9. package/dist/cli/register-mutation.js +8 -8
  10. package/dist/cli/register-operations.js +6 -6
  11. package/dist/cli/register-structured-mutation.d.ts +2 -0
  12. package/dist/cli/register-structured-mutation.js +29 -6
  13. package/dist/cli-bundle/bundle-manifest.json +151 -143
  14. package/dist/cli-bundle/chunks/{chunk-UYCLQVL2.js → chunk-2RDVGYWE.js} +12 -12
  15. package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-4GB2LTOQ.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.js → chunk-7BRF2BX2.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +35 -0
  18. package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +5 -0
  19. package/dist/cli-bundle/chunks/chunk-K3EN3LK2.js +2 -0
  20. package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.js → chunk-L4LGPBJU.js} +49 -49
  21. package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +197 -0
  22. package/dist/cli-bundle/chunks/chunk-TSMWLCHS.js +3 -0
  23. package/dist/cli-bundle/chunks/chunk-US2ZQW2M.js +77 -0
  24. package/dist/cli-bundle/chunks/{chunk-5UZZAJKR.js → chunk-XYDDWBZN.js} +2 -2
  25. package/dist/cli-bundle/chunks/register-list-query-JSAQCVOC.js +11 -0
  26. package/dist/cli-bundle/chunks/register-mutation-XJPAW63D.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-DSOSB2XQ.js +2 -0
  28. package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-QUR6QL2C.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-325UXIO7.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-5L7M4AI7.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-6AHG2YW7.js} +44 -44
  32. package/dist/cli-bundle/focused-chunks/chunk-AZBACT5T.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-BLJCGGID.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-FUREQLQN.js +18 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-G3C5ERXG.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-GXWQBE3T.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JWKEDZJI.js} +3 -3
  38. package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +155 -0
  39. package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-M32HFIQB.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-OM65KHGF.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.js → chunk-RIHDMCUM.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +16 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-TDR5OGG3.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-UGSS4F5X.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +2 -0
  47. package/dist/cli-bundle/main.js +13 -13
  48. package/dist/cli-bundle/sdk-authoring.js +1 -1
  49. package/dist/cli-bundle/sdk-contracts.js +2 -1
  50. package/dist/cli-bundle/sdk-core.js +41 -41
  51. package/dist/cli-bundle/sdk-governance.js +1 -1
  52. package/dist/cli-bundle/sdk-graph.js +1 -1
  53. package/dist/cli-bundle/sdk-merge.js +32 -32
  54. package/dist/cli-bundle/sdk-query.js +1 -1
  55. package/dist/cli-bundle/sdk-runtime.js +1 -1
  56. package/dist/cli-bundle/sdk-testing.js +1 -1
  57. package/dist/cli-bundle/sdk.js +5 -4
  58. package/dist/core/output/mutation-projection.js +26 -2
  59. package/dist/core/shared/constants.d.ts +1 -5
  60. package/dist/core/shared/constants.js +3 -81
  61. package/dist/core/shared/errors.d.ts +2 -0
  62. package/dist/core/shared/errors.js +2 -2
  63. package/dist/core/shared/item-metadata-contract.d.ts +14 -0
  64. package/dist/core/shared/item-metadata-contract.js +90 -0
  65. package/dist/core/store/item-store.d.ts +60 -0
  66. package/dist/core/store/item-store.js +22 -5
  67. package/dist/sdk/agent/closed-domain-contracts.d.ts +25 -0
  68. package/dist/sdk/agent/closed-domain-contracts.js +140 -0
  69. package/dist/sdk/agent/refusal-closure.d.ts +53 -0
  70. package/dist/sdk/agent/refusal-closure.js +134 -0
  71. package/dist/sdk/agent/refusal-reachability.d.ts +27 -1
  72. package/dist/sdk/agent/refusal-reachability.js +26 -2
  73. package/dist/sdk/agent-capability-contracts.d.ts +13 -0
  74. package/dist/sdk/agent-capability-contracts.js +101 -9
  75. package/dist/sdk/cli-contracts/command-aliases.js +18 -2
  76. package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
  77. package/dist/sdk/cli-contracts/commander-types.js +5 -4
  78. package/dist/sdk/cli-contracts/completeness.js +8 -2
  79. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -2
  80. package/dist/sdk/cli-contracts/enum-contracts.js +16 -6
  81. package/dist/sdk/cli-contracts/flag-contracts.d.ts +7 -0
  82. package/dist/sdk/cli-contracts/flag-contracts.js +84 -8
  83. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +72 -0
  84. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +340 -0
  85. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +83 -2
  86. package/dist/sdk/cli-contracts/grammar-contracts.js +618 -2
  87. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
  88. package/dist/sdk/cli-contracts/runtime-contracts.js +47 -13
  89. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
  90. package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
  91. package/dist/sdk/cli-contracts/tool-schema.js +7 -2
  92. package/dist/sdk/cli-contracts.d.ts +4 -3
  93. package/dist/sdk/cli-contracts.js +6 -5
  94. package/dist/sdk/context-intent-contracts.d.ts +2 -2
  95. package/dist/sdk/context-intent-contracts.js +22 -7
  96. package/dist/sdk/contracts.d.ts +3 -0
  97. package/dist/sdk/contracts.js +5 -2
  98. package/dist/sdk/core.d.ts +1 -1
  99. package/dist/sdk/core.js +3 -3
  100. package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
  101. package/dist/sdk/flag-invocation-contracts.js +218 -9
  102. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +206 -2
  103. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +244 -40
  104. package/dist/sdk/index.d.ts +11 -7
  105. package/dist/sdk/index.js +10 -6
  106. package/dist/sdk/init-agent-guidance.d.ts +5 -3
  107. package/dist/sdk/init-agent-guidance.js +69 -9
  108. package/dist/sdk/lifecycle/mcp-actions.d.ts +18 -0
  109. package/dist/sdk/lifecycle/mcp-actions.js +52 -0
  110. package/dist/sdk/lifecycle/reopen.d.ts +44 -0
  111. package/dist/sdk/lifecycle/reopen.js +69 -0
  112. package/dist/sdk/lifecycle/update.d.ts +31 -0
  113. package/dist/sdk/lifecycle/update.js +95 -13
  114. package/dist/sdk/output-projection.d.ts +2 -0
  115. package/dist/sdk/output-projection.js +11 -5
  116. package/dist/sdk/query/get.d.ts +1 -1
  117. package/dist/sdk/query/get.js +34 -49
  118. package/dist/sdk/query/list.d.ts +7 -21
  119. package/dist/sdk/query/list.js +44 -44
  120. package/dist/sdk/query/projection-contracts.d.ts +33 -0
  121. package/dist/sdk/query/projection-contracts.js +185 -0
  122. package/dist/sdk/query/search-contracts.d.ts +3 -2
  123. package/dist/sdk/query/search-contracts.js +30 -85
  124. package/dist/sdk/query/search.d.ts +15 -0
  125. package/dist/sdk/query/search.js +32 -6
  126. package/dist/sdk/read-output/continuation.d.ts +1 -1
  127. package/dist/sdk/read-output/continuation.js +7 -24
  128. package/dist/sdk/read-output-contracts.js +55 -6
  129. package/dist/sdk/read-output-rows.d.ts +4 -0
  130. package/dist/sdk/read-output-rows.js +47 -18
  131. package/dist/sdk/runtime-primitives.d.ts +1 -1
  132. package/dist/sdk/runtime-primitives.js +3 -3
  133. package/dist/sdk/runtime.d.ts +6 -0
  134. package/dist/sdk/runtime.js +25 -17
  135. package/dist/sdk/similarity.d.ts +13 -0
  136. package/dist/sdk/similarity.js +32 -6
  137. package/dist/sdk/workspace-snapshot.d.ts +2 -0
  138. package/dist/sdk/workspace-snapshot.js +10 -2
  139. package/docs/COMMANDS.md +29 -5
  140. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
  141. package/docs/README.md +1 -0
  142. package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
  143. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +114 -0
  144. package/docs/SDK.md +16 -2
  145. package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
  146. package/docs/TESTING.md +14 -1
  147. package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
  148. package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
  149. package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
  150. package/marketplace.json +2 -2
  151. package/package.json +9 -7
  152. package/packages/pm-beads/package.json +1 -1
  153. package/packages/pm-calendar/package.json +1 -1
  154. package/packages/pm-command-kit/package.json +1 -1
  155. package/packages/pm-digital-twin/package.json +1 -1
  156. package/packages/pm-governance-audit/package.json +1 -1
  157. package/packages/pm-guide-shell/package.json +1 -1
  158. package/packages/pm-kanban/package.json +1 -1
  159. package/packages/pm-lifecycle-hooks/package.json +1 -1
  160. package/packages/pm-linked-test-adapters/package.json +1 -1
  161. package/packages/pm-search-advanced/package.json +1 -1
  162. package/packages/pm-templates/package.json +1 -1
  163. package/packages/pm-todos/package.json +1 -1
  164. package/packages/pm-vcs/package.json +1 -1
  165. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  166. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  167. package/scripts/generate-agent-capability-surfaces.mjs +20 -14
  168. package/sdk/public-surface.json +950 -24
  169. package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
  170. package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
  171. package/dist/cli-bundle/chunks/chunk-GNFAFIJI.js +0 -77
  172. package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
  173. package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
  174. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
  175. package/dist/cli-bundle/chunks/register-list-query-I23LALEE.js +0 -11
  176. package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
  177. package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
  178. package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
  179. package/dist/cli-bundle/focused-chunks/chunk-3TKWMNKF.js +0 -18
  180. package/dist/cli-bundle/focused-chunks/chunk-5AF3ZBNB.js +0 -155
  181. package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
  182. package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
  183. package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
  184. package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
  185. package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
  186. package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
@@ -25,7 +25,44 @@ export interface CliFlagInvocationContract extends CliFlagContract {
25
25
  /** Sentinel that redirects the argv value to stdin. */
26
26
  stdin_token?: "-";
27
27
  }
28
+ /** Executable option arity observed from the registered Commander program. */
29
+ export interface CliFlagArityObservation {
30
+ /** Canonical command path owning the option. */
31
+ command: string;
32
+ /** Long option spelling. */
33
+ flag: string;
34
+ /** Whether the option consumes a value token. */
35
+ takes_value: boolean;
36
+ /** Whether the consumed value is mandatory. */
37
+ value_required: boolean;
38
+ /** Whether repeated values accumulate. */
39
+ repeatable: boolean;
40
+ }
41
+ /** One machine-readable mismatch between declared and executable flag arity. */
42
+ export interface CliFlagInvocationParityFinding {
43
+ /** Stable finding code. */
44
+ code: "duplicate_observation" | "missing_observation" | "takes_value_mismatch" | "value_required_mismatch" | "repeatable_mismatch" | "undeclared_observation";
45
+ /** Canonical command path. */
46
+ command: string;
47
+ /** Long option spelling. */
48
+ flag: string;
49
+ /** Human-readable mismatch detail. */
50
+ detail: string;
51
+ }
52
+ /** Complete parity receipt for one command's declared and executable flags. */
53
+ export interface CliFlagInvocationParityReport {
54
+ /** Whether the two surfaces agree exactly. */
55
+ ok: boolean;
56
+ /** Number of declared invocation rows. */
57
+ declared_count: number;
58
+ /** Number of executable observations. */
59
+ observed_count: number;
60
+ /** Stable mismatch list. */
61
+ findings: CliFlagInvocationParityFinding[];
62
+ }
28
63
  /** Enrich one vocabulary row with deterministic invocation and input-channel metadata. */
29
64
  export declare function enrichCliFlagInvocationContract(command: string, contract: CliFlagContract): CliFlagInvocationContract;
30
65
  /** Enrich a complete command flag table without mutating package-owned rows. */
31
66
  export declare function enrichCliFlagInvocationContracts(command: string, contracts: readonly CliFlagContract[]): CliFlagInvocationContract[];
67
+ /** Compare generated invocation rows with independently observed executable arity. */
68
+ export declare function verifyCliFlagInvocationParity(command: string, declarations: readonly CliFlagInvocationContract[], observations: readonly CliFlagArityObservation[]): CliFlagInvocationParityReport;
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0e2d29be-ff70-5e69-9bba-bef5ecd05fa1")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0f857893-8441-54ad-af99-abaae9af864d")}catch(e){}}();
3
3
  const FLAG_DESCRIPTIONS = Object.freeze({
4
4
  "--body": "Set the item body.",
5
5
  "--body-file": "Read the item body from a file.",
@@ -38,23 +38,156 @@ const BOOLEAN_FLAG_PREFIXES = [
38
38
  "--check-",
39
39
  "--dry-run",
40
40
  "--explain",
41
- "--filter-",
41
+ "--fail-",
42
+ "--fix-",
42
43
  "--full",
43
44
  "--has-",
44
45
  "--include-",
45
46
  "--json",
46
47
  "--no-",
47
- "--only",
48
+ "--prune-",
48
49
  "--quiet",
50
+ "--refresh-",
49
51
  "--require-",
50
52
  "--runtime-only",
51
53
  "--schema-only",
54
+ "--skip-",
52
55
  "--stream",
53
56
  "--strict-",
54
57
  "--summary",
55
58
  "--today",
56
59
  "--verbose",
57
60
  ];
61
+ const BOOLEAN_FLAG_NAMES = new Set([
62
+ "--activate",
63
+ "--active-only",
64
+ "--adopt",
65
+ "--adopt-all",
66
+ "--all",
67
+ "--all-actionable",
68
+ "--all-affected-ids",
69
+ "--all-day",
70
+ "--all-streams",
71
+ "--append-stable",
72
+ "--auto-fix",
73
+ "--auto-pm-context",
74
+ "--availability-only",
75
+ "--background",
76
+ "--brief",
77
+ "--by-assignee",
78
+ "--by-priority",
79
+ "--by-tag",
80
+ "--catalog",
81
+ "--claim",
82
+ "--clear",
83
+ "--clear-comments",
84
+ "--clear-criteria",
85
+ "--clear-deps",
86
+ "--clear-docs",
87
+ "--clear-events",
88
+ "--clear-files",
89
+ "--clear-learnings",
90
+ "--clear-notes",
91
+ "--clear-reminders",
92
+ "--clear-tests",
93
+ "--clear-type-options",
94
+ "--cli-only",
95
+ "--closed",
96
+ "--compact",
97
+ "--completion",
98
+ "--count",
99
+ "--counts",
100
+ "--deactivate",
101
+ "--declarative",
102
+ "--defaults",
103
+ "--describe",
104
+ "--diff",
105
+ "--doctor",
106
+ "--empty-body",
107
+ "--explore",
108
+ "--field-utilization",
109
+ "--filter-empty-body",
110
+ "--flags-only",
111
+ "--follow",
112
+ "--force",
113
+ "--global",
114
+ "--highlight",
115
+ "--hybrid",
116
+ "--id-only",
117
+ "--if-available",
118
+ "--ignore-global",
119
+ "--include_unparented",
120
+ "--infer",
121
+ "--init",
122
+ "--install",
123
+ "--isolated",
124
+ "--lean",
125
+ "--list",
126
+ "--local",
127
+ "--manage",
128
+ "--markdown",
129
+ "--metadata-coverage",
130
+ "--next",
131
+ "--normalize-provenance",
132
+ "--only",
133
+ "--only-last",
134
+ "--output-row-contract",
135
+ "--override-linked-pm-context",
136
+ "--packages-only",
137
+ "--past",
138
+ "--phrase-exact",
139
+ "--profile",
140
+ "--progress",
141
+ "--project",
142
+ "--promote-to-item-dep",
143
+ "--provenance",
144
+ "--provenance-summary",
145
+ "--raw",
146
+ "--ready-only",
147
+ "--ready_only",
148
+ "--rebuild",
149
+ "--recent",
150
+ "--reload",
151
+ "--repair",
152
+ "--replace-deps",
153
+ "--replace-docs",
154
+ "--replace-files",
155
+ "--replace-tests",
156
+ "--required",
157
+ "--required-on-create",
158
+ "--run",
159
+ "--runtime-probe",
160
+ "--save-baseline",
161
+ "--scaffold",
162
+ "--semantic",
163
+ "--shared-host-safe",
164
+ "--storage",
165
+ "--title-exact",
166
+ "--token-accounting",
167
+ "--trace",
168
+ "--tree",
169
+ "--unbounded",
170
+ "--uninstall",
171
+ "--validate-paths",
172
+ "--verify",
173
+ "--watch",
174
+ "--with-packages",
175
+ ]);
176
+ const VALUE_FLAG_NAMES = new Set(["--only-index"]);
177
+ const VALUE_COMMAND_FLAGS = new Set([
178
+ "activity:--stream",
179
+ "eval:--fail-under",
180
+ "validate:--fix-scope",
181
+ ]);
182
+ const OPTIONAL_VALUE_COMMAND_FLAGS = new Set([
183
+ "activity:--stream",
184
+ "close:--validate-close",
185
+ "close-many:--validate-close",
186
+ "comments:--author",
187
+ "learnings:--author",
188
+ "notes:--author",
189
+ ]);
190
+ const OPTIONAL_VALUE_FLAGS = new Set(["--regression"]);
58
191
  function resolveFlagInputSources(command, flag) {
59
192
  if (flag === "--stdin" || flag === "--stdin-json")
60
193
  return ["stdin"];
@@ -65,8 +198,9 @@ function resolveFlagInputSources(command, flag) {
65
198
  }
66
199
  return ["argv"];
67
200
  }
68
- function flagTakesValue(contract) {
69
- const explicitlyValued = contract.value_name !== undefined ||
201
+ function flagTakesValue(command, contract) {
202
+ const explicitlyValued = VALUE_COMMAND_FLAGS.has(`${command}:${contract.flag}`) ||
203
+ contract.value_name !== undefined ||
70
204
  contract.value_type === "string" ||
71
205
  contract.value_type === "number" ||
72
206
  contract.list === true ||
@@ -74,12 +208,18 @@ function flagTakesValue(contract) {
74
208
  const inferredBoolean = contract.value_type === "boolean" ||
75
209
  contract.flag === "--stdin" ||
76
210
  contract.flag === "--stdin-json" ||
211
+ (contract.flag.startsWith("--filter-") &&
212
+ (contract.flag.endsWith("-missing") ||
213
+ contract.flag.startsWith("--filter-has-") ||
214
+ contract.flag.startsWith("--filter-no-"))) ||
77
215
  BOOLEAN_FLAG_PREFIXES.some((prefix) => contract.flag.startsWith(prefix));
78
- return explicitlyValued || !inferredBoolean;
216
+ return (explicitlyValued ||
217
+ VALUE_FLAG_NAMES.has(contract.flag) ||
218
+ (!BOOLEAN_FLAG_NAMES.has(contract.flag) && !inferredBoolean));
79
219
  }
80
220
  /** Enrich one vocabulary row with deterministic invocation and input-channel metadata. */
81
221
  export function enrichCliFlagInvocationContract(command, contract) {
82
- const takesValue = flagTakesValue(contract);
222
+ const takesValue = flagTakesValue(command, contract);
83
223
  const inputSources = resolveFlagInputSources(command, contract.flag);
84
224
  const description = contract.description ??
85
225
  FLAG_DESCRIPTIONS[contract.flag] ??
@@ -88,7 +228,9 @@ export function enrichCliFlagInvocationContract(command, contract) {
88
228
  ...contract,
89
229
  description,
90
230
  takes_value: takesValue,
91
- value_required: takesValue,
231
+ value_required: takesValue &&
232
+ !OPTIONAL_VALUE_FLAGS.has(contract.flag) &&
233
+ !OPTIONAL_VALUE_COMMAND_FLAGS.has(`${command}:${contract.flag}`),
92
234
  ...(takesValue ? { value_name: contract.value_name ?? "value" } : {}),
93
235
  value_type: takesValue ? (contract.value_type ?? "string") : "boolean",
94
236
  required: contract.required === true,
@@ -105,5 +247,72 @@ export function enrichCliFlagInvocationContract(command, contract) {
105
247
  export function enrichCliFlagInvocationContracts(command, contracts) {
106
248
  return contracts.map((contract) => enrichCliFlagInvocationContract(command, contract));
107
249
  }
250
+ /** Compare generated invocation rows with independently observed executable arity. */
251
+ export function verifyCliFlagInvocationParity(command, declarations, observations) {
252
+ const normalizedCommand = command.trim().toLowerCase();
253
+ const findings = [];
254
+ const observedByFlag = new Map();
255
+ let matchingObservationCount = 0;
256
+ for (const observation of observations) {
257
+ if (observation.command.trim().toLowerCase() !== normalizedCommand)
258
+ continue;
259
+ matchingObservationCount += 1;
260
+ if (observedByFlag.has(observation.flag)) {
261
+ findings.push({
262
+ code: "duplicate_observation",
263
+ command: normalizedCommand,
264
+ flag: observation.flag,
265
+ detail: `${normalizedCommand} ${observation.flag} was observed more than once.`,
266
+ });
267
+ continue;
268
+ }
269
+ observedByFlag.set(observation.flag, observation);
270
+ }
271
+ const declaredFlags = new Set(declarations.map(({ flag }) => flag));
272
+ for (const declaration of declarations) {
273
+ const observation = observedByFlag.get(declaration.flag);
274
+ if (!observation) {
275
+ findings.push({
276
+ code: "missing_observation",
277
+ command: normalizedCommand,
278
+ flag: declaration.flag,
279
+ detail: `${normalizedCommand} ${declaration.flag} has no executable option observation.`,
280
+ });
281
+ continue;
282
+ }
283
+ for (const [field, code] of [
284
+ ["takes_value", "takes_value_mismatch"],
285
+ ["value_required", "value_required_mismatch"],
286
+ ["repeatable", "repeatable_mismatch"],
287
+ ]) {
288
+ if (declaration[field] === observation[field])
289
+ continue;
290
+ findings.push({
291
+ code,
292
+ command: normalizedCommand,
293
+ flag: declaration.flag,
294
+ detail: `${normalizedCommand} ${declaration.flag} declares ${field}=${String(declaration[field])} but the executable option reports ${String(observation[field])}.`,
295
+ });
296
+ }
297
+ }
298
+ for (const observation of observedByFlag.values()) {
299
+ if (declaredFlags.has(observation.flag))
300
+ continue;
301
+ findings.push({
302
+ code: "undeclared_observation",
303
+ command: normalizedCommand,
304
+ flag: observation.flag,
305
+ detail: `${normalizedCommand} ${observation.flag} is executable but absent from invocation contracts.`,
306
+ });
307
+ }
308
+ findings.sort((left, right) => left.flag.localeCompare(right.flag) ||
309
+ left.code.localeCompare(right.code));
310
+ return {
311
+ ok: findings.length === 0,
312
+ declared_count: declarations.length,
313
+ observed_count: matchingObservationCount,
314
+ findings,
315
+ };
316
+ }
108
317
  //# sourceMappingURL=flag-invocation-contracts.js.map
109
- //# debugId=0e2d29be-ff70-5e69-9bba-bef5ecd05fa1
318
+ //# debugId=0f857893-8441-54ad-af99-abaae9af864d
@@ -1,6 +1,6 @@
1
1
  /** Generated partition 1 of the exhaustive error-code catalog. */
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]="29cde680-7551-51d1-9c5e-dd9d062d2397")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="145e12fa-839c-59da-840b-e2a0f3f13065")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_1 = [
5
5
  {
6
6
  code: "acceptance_criteria_mutation_conflict",
@@ -38,6 +38,30 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
38
38
  canonical_code: "acceptance_criteria_semicolon_forbidden",
39
39
  aliases: [],
40
40
  },
41
+ {
42
+ code: "accepted_rejected_value",
43
+ meaning: "Accepted rejected value condition.",
44
+ stability: "provisional",
45
+ exit_code: 1,
46
+ class: "generic_failure",
47
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
48
+ sources: ["sdk/agent/refusal-closure.ts"],
49
+ emitting_commands: ["*"],
50
+ canonical_code: "accepted_rejected_value",
51
+ aliases: [],
52
+ },
53
+ {
54
+ code: "alias_collision",
55
+ meaning: "Alias collision condition.",
56
+ stability: "provisional",
57
+ exit_code: 1,
58
+ class: "generic_failure",
59
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
60
+ sources: ["sdk/cli-contracts/flag-lexicon-contracts.ts"],
61
+ emitting_commands: ["*"],
62
+ canonical_code: "alias_collision",
63
+ aliases: [],
64
+ },
41
65
  {
42
66
  code: "alias_target_missing",
43
67
  meaning: "Alias target missing condition.",
@@ -182,6 +206,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
182
206
  canonical_code: "body_file_unreadable",
183
207
  aliases: [],
184
208
  },
209
+ {
210
+ code: "budget_exceeded",
211
+ meaning: "Budget exceeded condition.",
212
+ stability: "provisional",
213
+ exit_code: 1,
214
+ class: "generic_failure",
215
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
216
+ sources: ["sdk/cli-contracts/flag-lexicon-contracts.ts"],
217
+ emitting_commands: ["*"],
218
+ canonical_code: "budget_exceeded",
219
+ aliases: [],
220
+ },
185
221
  {
186
222
  code: "bundle_integrity_torn_install",
187
223
  meaning: "Bundle integrity torn install condition.",
@@ -482,6 +518,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
482
518
  canonical_code: "dependency_temporal_order_invalid",
483
519
  aliases: [],
484
520
  },
521
+ {
522
+ code: "duplicate_canonical_flag",
523
+ meaning: "Duplicate canonical flag condition.",
524
+ stability: "provisional",
525
+ exit_code: 1,
526
+ class: "generic_failure",
527
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
528
+ sources: ["sdk/cli-contracts/flag-lexicon-contracts.ts"],
529
+ emitting_commands: ["*"],
530
+ canonical_code: "duplicate_canonical_flag",
531
+ aliases: [],
532
+ },
485
533
  {
486
534
  code: "duplicate_command",
487
535
  meaning: "Duplicate command condition.",
@@ -518,6 +566,30 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
518
566
  canonical_code: "duplicate_edge",
519
567
  aliases: [],
520
568
  },
569
+ {
570
+ code: "duplicate_observation",
571
+ meaning: "Duplicate observation condition.",
572
+ stability: "provisional",
573
+ exit_code: 1,
574
+ class: "generic_failure",
575
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
576
+ sources: ["sdk/flag-invocation-contracts.ts"],
577
+ emitting_commands: ["*"],
578
+ canonical_code: "duplicate_observation",
579
+ aliases: [],
580
+ },
581
+ {
582
+ code: "duplicate_probe",
583
+ meaning: "Duplicate probe condition.",
584
+ stability: "provisional",
585
+ exit_code: 1,
586
+ class: "generic_failure",
587
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
588
+ sources: ["sdk/agent/refusal-closure.ts"],
589
+ emitting_commands: ["*"],
590
+ canonical_code: "duplicate_probe",
591
+ aliases: [],
592
+ },
521
593
  {
522
594
  code: "duplicate_sweep_cost_limit",
523
595
  meaning: "Duplicate sweep cost limit condition.",
@@ -578,6 +650,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
578
650
  canonical_code: "duplicate_target_self",
579
651
  aliases: [],
580
652
  },
653
+ {
654
+ code: "empty_corpus",
655
+ meaning: "Empty corpus condition.",
656
+ stability: "provisional",
657
+ exit_code: 1,
658
+ class: "generic_failure",
659
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
660
+ sources: ["sdk/agent/refusal-closure.ts"],
661
+ emitting_commands: ["*"],
662
+ canonical_code: "empty_corpus",
663
+ aliases: [],
664
+ },
581
665
  {
582
666
  code: "empty_surface",
583
667
  meaning: "Empty surface condition.",
@@ -590,6 +674,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
590
674
  canonical_code: "empty_surface",
591
675
  aliases: [],
592
676
  },
677
+ {
678
+ code: "error_code_mismatch",
679
+ meaning: "Error code mismatch condition.",
680
+ stability: "provisional",
681
+ exit_code: 1,
682
+ class: "generic_failure",
683
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
684
+ sources: ["sdk/agent/refusal-closure.ts"],
685
+ emitting_commands: ["*"],
686
+ canonical_code: "error_code_mismatch",
687
+ aliases: [],
688
+ },
593
689
  {
594
690
  code: "event_cursor_query_mismatch",
595
691
  meaning: "Event cursor query mismatch condition.",
@@ -1094,6 +1190,30 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
1094
1190
  canonical_code: "improvement_observation_conflict",
1095
1191
  aliases: [],
1096
1192
  },
1193
+ {
1194
+ code: "incomplete_allowed_values",
1195
+ meaning: "Incomplete allowed values condition.",
1196
+ stability: "provisional",
1197
+ exit_code: 1,
1198
+ class: "generic_failure",
1199
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1200
+ sources: ["sdk/agent/refusal-closure.ts"],
1201
+ emitting_commands: ["*"],
1202
+ canonical_code: "incomplete_allowed_values",
1203
+ aliases: [],
1204
+ },
1205
+ {
1206
+ code: "inconsistent_concept_kind",
1207
+ meaning: "Inconsistent concept kind condition.",
1208
+ stability: "provisional",
1209
+ exit_code: 1,
1210
+ class: "generic_failure",
1211
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1212
+ sources: ["sdk/cli-contracts/flag-lexicon-contracts.ts"],
1213
+ emitting_commands: ["*"],
1214
+ canonical_code: "inconsistent_concept_kind",
1215
+ aliases: [],
1216
+ },
1097
1217
  {
1098
1218
  code: "init_existing_settings_requires_force",
1099
1219
  meaning: "Init existing settings requires force condition.",
@@ -1476,6 +1596,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
1476
1596
  canonical_code: "invalid_workspace_snapshot_target",
1477
1597
  aliases: [],
1478
1598
  },
1599
+ {
1600
+ code: "item_already_active",
1601
+ meaning: "Item already active condition.",
1602
+ stability: "provisional",
1603
+ exit_code: 4,
1604
+ class: "conflict",
1605
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1606
+ sources: ["sdk/lifecycle/update.ts"],
1607
+ emitting_commands: ["update"],
1608
+ canonical_code: "item_already_active",
1609
+ aliases: [],
1610
+ },
1479
1611
  {
1480
1612
  code: "item_document_invalid",
1481
1613
  meaning: "Item document invalid condition.",
@@ -1704,6 +1836,78 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
1704
1836
  canonical_code: "merge_decisions_unreviewed",
1705
1837
  aliases: [],
1706
1838
  },
1839
+ {
1840
+ code: "merge_git_config_unwritable",
1841
+ meaning: "Merge git config unwritable condition.",
1842
+ stability: "stable",
1843
+ exit_code: 5,
1844
+ class: "dependency_failed",
1845
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1846
+ sources: ["sdk/merge/install.ts"],
1847
+ emitting_commands: ["*"],
1848
+ canonical_code: "merge_git_config_unwritable",
1849
+ aliases: [],
1850
+ },
1851
+ {
1852
+ code: "merge_reconcile_discards_require_acceptance",
1853
+ meaning: "Merge reconcile discards require acceptance condition.",
1854
+ stability: "provisional",
1855
+ exit_code: 4,
1856
+ class: "conflict",
1857
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1858
+ sources: ["sdk/merge/reconcile.ts"],
1859
+ emitting_commands: ["*"],
1860
+ canonical_code: "merge_reconcile_discards_require_acceptance",
1861
+ aliases: [],
1862
+ },
1863
+ {
1864
+ code: "merge_root_not_found",
1865
+ meaning: "Merge root not found condition.",
1866
+ stability: "stable",
1867
+ exit_code: 3,
1868
+ class: "not_found",
1869
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1870
+ sources: ["sdk/merge/install.ts"],
1871
+ emitting_commands: ["*"],
1872
+ canonical_code: "merge_root_not_found",
1873
+ aliases: [],
1874
+ },
1875
+ {
1876
+ code: "missing_allowed_values",
1877
+ meaning: "Missing allowed values condition.",
1878
+ stability: "provisional",
1879
+ exit_code: 1,
1880
+ class: "generic_failure",
1881
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1882
+ sources: ["sdk/agent/refusal-closure.ts"],
1883
+ emitting_commands: ["*"],
1884
+ canonical_code: "missing_allowed_values",
1885
+ aliases: [],
1886
+ },
1887
+ {
1888
+ code: "missing_budget",
1889
+ meaning: "Missing budget condition.",
1890
+ stability: "provisional",
1891
+ exit_code: 1,
1892
+ class: "generic_failure",
1893
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1894
+ sources: ["sdk/cli-contracts/flag-lexicon-contracts.ts"],
1895
+ emitting_commands: ["*"],
1896
+ canonical_code: "missing_budget",
1897
+ aliases: [],
1898
+ },
1899
+ {
1900
+ code: "missing_cli_flag",
1901
+ meaning: "Missing cli flag condition.",
1902
+ stability: "provisional",
1903
+ exit_code: 1,
1904
+ class: "generic_failure",
1905
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1906
+ sources: ["sdk/cli-contracts/tool-option-contracts.ts"],
1907
+ emitting_commands: ["*"],
1908
+ canonical_code: "missing_cli_flag",
1909
+ aliases: [],
1910
+ },
1707
1911
  ];
1708
1912
  //# sourceMappingURL=generated-error-code-catalog-part-1.js.map
1709
- //# debugId=29cde680-7551-51d1-9c5e-dd9d062d2397
1913
+ //# debugId=145e12fa-839c-59da-840b-e2a0f3f13065