@unbrained/pm-cli 2026.8.16 → 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 (225) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/AGENTS.md +4 -3
  3. package/CHANGELOG.md +65 -6
  4. package/README.md +16 -16
  5. package/dist/cli/error-guidance.js +7 -4
  6. package/dist/cli/public.d.ts +2 -0
  7. package/dist/cli/public.js +21 -0
  8. package/dist/cli/register-list-query.js +132 -51
  9. package/dist/cli/register-mutation.js +4 -4
  10. package/dist/cli-bundle/bundle-manifest.json +148 -148
  11. package/dist/cli-bundle/chunks/chunk-5UZZAJKR.js +3 -0
  12. package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +2 -0
  13. package/dist/cli-bundle/chunks/chunk-BSK2IN3C.js +8 -0
  14. package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +197 -0
  15. package/dist/cli-bundle/chunks/{chunk-73UGEBRS.js → chunk-GNFAFIJI.js} +10 -10
  16. package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +35 -0
  17. package/dist/cli-bundle/chunks/{chunk-RIS565OA.js → chunk-PVRUN5ZS.js} +5 -5
  18. package/dist/cli-bundle/chunks/chunk-RZQTVMRQ.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +3 -0
  20. package/dist/cli-bundle/chunks/chunk-UYCLQVL2.js +13 -0
  21. package/dist/cli-bundle/chunks/{chunk-URW4QRMI.js → chunk-YRGOLZA7.js} +59 -55
  22. package/dist/cli-bundle/chunks/register-list-query-I23LALEE.js +11 -0
  23. package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +20 -0
  24. package/dist/cli-bundle/chunks/{register-operations-KGDNRMCL.js → register-operations-4HTFC6J7.js} +2 -2
  25. package/dist/cli-bundle/chunks/{register-setup-NVXBOD5I.js → register-setup-PPPEF3SN.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-C7JUBRFP.js → chunk-3TKWMNKF.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/chunk-5AF3ZBNB.js +155 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-CODV5LUT.js → chunk-EUEGXZ2A.js} +3 -3
  31. package/dist/cli-bundle/focused-chunks/{chunk-4JPEBFFC.js → chunk-EX6MKP2X.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-SSNDYZTM.js → chunk-K43KKAFS.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-6ROKKT4X.js → chunk-M62NO7EI.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-T46KLOIB.js → chunk-ODOVCP45.js} +47 -47
  35. package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +16 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-TN4AE665.js +26 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/chunk-UI6AJ5TD.js +4 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-V5XTGLK7.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +2 -0
  41. package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +2 -0
  43. package/dist/cli-bundle/main.js +7 -7
  44. package/dist/cli-bundle/sdk-authoring.js +1 -1
  45. package/dist/cli-bundle/sdk-contracts.js +1 -1
  46. package/dist/cli-bundle/sdk-core.js +31 -31
  47. package/dist/cli-bundle/sdk-governance.js +1 -1
  48. package/dist/cli-bundle/sdk-graph.js +1 -1
  49. package/dist/cli-bundle/sdk-merge.js +32 -32
  50. package/dist/cli-bundle/sdk-query.js +1 -1
  51. package/dist/cli-bundle/sdk-runtime.js +1 -1
  52. package/dist/cli-bundle/sdk-testing.js +1 -1
  53. package/dist/cli-bundle/sdk.js +4 -2
  54. package/dist/core/config/nested-settings.js +8 -2
  55. package/dist/core/extensions/exporter-output-contract.d.ts +12 -0
  56. package/dist/core/extensions/exporter-output-contract.js +67 -0
  57. package/dist/core/extensions/extension-types.d.ts +36 -1
  58. package/dist/core/extensions/extension-types.js +2 -2
  59. package/dist/core/extensions/loader.js +43 -48
  60. package/dist/core/extensions/manifest-schema.d.ts +20 -0
  61. package/dist/core/extensions/manifest-schema.js +52 -0
  62. package/dist/core/history/event-index.d.ts +5 -0
  63. package/dist/core/history/event-index.js +133 -27
  64. package/dist/core/history/replay.js +32 -14
  65. package/dist/core/schema/fields-file.d.ts +1 -1
  66. package/dist/core/schema/fields-file.js +2 -2
  67. package/dist/core/schema/runtime-field-values.js +115 -9
  68. package/dist/core/schema/runtime-schema.d.ts +3 -1
  69. package/dist/core/schema/runtime-schema.js +124 -3
  70. package/dist/core/sentry/helpers.js +3 -3
  71. package/dist/core/shared/constants.js +5 -2
  72. package/dist/core/shared/errors.d.ts +10 -0
  73. package/dist/core/shared/errors.js +2 -2
  74. package/dist/core/shared/time.d.ts +2 -0
  75. package/dist/core/shared/time.js +27 -2
  76. package/dist/core/store/settings-validator.d.ts +4 -0
  77. package/dist/core/store/settings-validator.js +3 -2
  78. package/dist/core/store/settings.js +8 -2
  79. package/dist/mcp/tool-definitions.js +12 -7
  80. package/dist/sdk/agent/refusal-reachability.d.ts +46 -6
  81. package/dist/sdk/agent/refusal-reachability.js +350 -8
  82. package/dist/sdk/authoring.d.ts +1 -1
  83. package/dist/sdk/authoring.js +2 -2
  84. package/dist/sdk/cli-bootstrap.d.ts +2 -2
  85. package/dist/sdk/cli-bootstrap.js +4 -4
  86. package/dist/sdk/cli-contracts/command-aliases.d.ts +34 -2
  87. package/dist/sdk/cli-contracts/command-aliases.js +64 -13
  88. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -0
  89. package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
  90. package/dist/sdk/cli-contracts/flag-contracts.js +11 -7
  91. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +70 -0
  92. package/dist/sdk/cli-contracts/grammar-contracts.js +345 -0
  93. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +19 -2
  94. package/dist/sdk/cli-contracts/runtime-contracts.js +61 -14
  95. package/dist/sdk/cli-contracts/tool-parameter-tables.js +10 -4
  96. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  97. package/dist/sdk/cli-contracts/tool-schema.js +20 -11
  98. package/dist/sdk/cli-contracts.d.ts +2 -2
  99. package/dist/sdk/cli-contracts.js +4 -4
  100. package/dist/sdk/completion.js +13 -15
  101. package/dist/sdk/compose.d.ts +9 -5
  102. package/dist/sdk/compose.js +33 -3
  103. package/dist/sdk/context-intent-contracts.d.ts +8 -4
  104. package/dist/sdk/context-intent-contracts.js +76 -31
  105. package/dist/sdk/contracts.d.ts +1 -0
  106. package/dist/sdk/contracts.js +3 -2
  107. package/dist/sdk/core.d.ts +1 -1
  108. package/dist/sdk/core.js +3 -3
  109. package/dist/sdk/dependency-flag-validation.d.ts +9 -2
  110. package/dist/sdk/dependency-flag-validation.js +101 -35
  111. package/dist/sdk/environment/host-environment-errors.js +25 -7
  112. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +78 -14
  113. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +62 -14
  114. package/dist/sdk/governance/assurance-action.d.ts +3 -7
  115. package/dist/sdk/governance/assurance-action.js +97 -2
  116. package/dist/sdk/governance/boundary-fixtures.d.ts +86 -0
  117. package/dist/sdk/governance/boundary-fixtures.js +201 -0
  118. package/dist/sdk/governance/defect-recurrence-signals.d.ts +10 -0
  119. package/dist/sdk/governance/defect-recurrence-signals.js +25 -0
  120. package/dist/sdk/governance/defect-recurrence.d.ts +242 -0
  121. package/dist/sdk/governance/defect-recurrence.js +523 -0
  122. package/dist/sdk/governance.d.ts +2 -0
  123. package/dist/sdk/governance.js +4 -2
  124. package/dist/sdk/graph/governance.js +3 -2
  125. package/dist/sdk/guide-topics.js +193 -4
  126. package/dist/sdk/index.d.ts +7 -3
  127. package/dist/sdk/index.js +8 -5
  128. package/dist/sdk/init-agent-guidance.js +3 -3
  129. package/dist/sdk/lifecycle/create.js +4 -2
  130. package/dist/sdk/lifecycle/update-many.js +15 -2
  131. package/dist/sdk/lifecycle/update.js +5 -2
  132. package/dist/sdk/linked-artifacts.js +63 -14
  133. package/dist/sdk/mutation-events.d.ts +18 -2
  134. package/dist/sdk/mutation-events.js +59 -16
  135. package/dist/sdk/output.d.ts +44 -0
  136. package/dist/sdk/output.js +28 -2
  137. package/dist/sdk/query/complete-list.d.ts +94 -0
  138. package/dist/sdk/query/complete-list.js +173 -0
  139. package/dist/sdk/query/get.d.ts +2 -0
  140. package/dist/sdk/query/get.js +32 -7
  141. package/dist/sdk/query/list.js +5 -2
  142. package/dist/sdk/query.d.ts +1 -0
  143. package/dist/sdk/query.js +3 -2
  144. package/dist/sdk/read-output-contracts.d.ts +2 -2
  145. package/dist/sdk/read-output-contracts.js +36 -9
  146. package/dist/sdk/relationship-analytics.js +90 -14
  147. package/dist/sdk/relationship-kinds/contract.d.ts +4 -0
  148. package/dist/sdk/relationship-kinds/contract.js +3 -2
  149. package/dist/sdk/relationships.d.ts +1 -1
  150. package/dist/sdk/relationships.js +11 -2
  151. package/dist/sdk/runtime-extended-actions.js +10 -2
  152. package/dist/sdk/runtime.d.ts +8 -2
  153. package/dist/sdk/runtime.js +11 -8
  154. package/dist/sdk/schema.d.ts +1 -0
  155. package/dist/sdk/schema.js +2 -2
  156. package/dist/sdk/test/execution.d.ts +6 -2
  157. package/dist/sdk/test/execution.js +39 -13
  158. package/dist/types.d.ts +34 -2
  159. package/dist/types.js +4 -2
  160. package/docs/AGENT_GUIDE.md +25 -9
  161. package/docs/CLI_GRAMMAR.md +106 -0
  162. package/docs/COMMANDS.md +23 -23
  163. package/docs/CONFIGURATION.md +58 -1
  164. package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +58 -0
  165. package/docs/DEFECT_RECURRENCE.md +134 -0
  166. package/docs/DEPENDENCY_KIND_CONTRACT.md +12 -2
  167. package/docs/ONBOARDING.md +4 -4
  168. package/docs/QUICKSTART.md +1 -1
  169. package/docs/README.md +4 -0
  170. package/docs/RELATIONSHIP_GRAPH.md +16 -2
  171. package/docs/RELEASING.md +30 -6
  172. package/docs/SDK.md +74 -7
  173. package/docs/SDK_ARTIFACT_OUTPUT.md +72 -0
  174. package/docs/SDK_CONTEXT_COORDINATION.md +46 -12
  175. package/docs/SDK_RUNTIME_BOUNDARIES.md +9 -1
  176. package/docs/TESTING.md +18 -1
  177. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +1 -1
  178. package/docs/agent-task-token-baseline.json +5 -5
  179. package/marketplace.json +2 -2
  180. package/package.json +8 -5
  181. package/packages/pm-beads/package.json +1 -1
  182. package/packages/pm-calendar/package.json +1 -1
  183. package/packages/pm-command-kit/package.json +1 -1
  184. package/packages/pm-digital-twin/package.json +1 -1
  185. package/packages/pm-governance-audit/package.json +1 -1
  186. package/packages/pm-guide-shell/package.json +1 -1
  187. package/packages/pm-kanban/package.json +1 -1
  188. package/packages/pm-lifecycle-hooks/package.json +1 -1
  189. package/packages/pm-linked-test-adapters/package.json +1 -1
  190. package/packages/pm-search-advanced/package.json +1 -1
  191. package/packages/pm-templates/package.json +1 -1
  192. package/packages/pm-todos/package.json +1 -1
  193. package/packages/pm-vcs/package.json +1 -1
  194. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  195. package/plugins/pm-claude/skills/pm-audit/SKILL.md +26 -0
  196. package/plugins/pm-claude/skills/pm-developer/SKILL.md +26 -0
  197. package/plugins/pm-claude/skills/pm-planner/SKILL.md +26 -0
  198. package/plugins/pm-claude/skills/pm-release/SKILL.md +26 -0
  199. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +26 -0
  200. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  201. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +26 -0
  202. package/plugins/pm-codex/skills/pm-native/SKILL.md +26 -0
  203. package/plugins/pm-codex/skills/pm-release/SKILL.md +26 -0
  204. package/sdk/public-surface.json +1243 -54
  205. package/dist/cli-bundle/chunks/chunk-47OQEOQB.js +0 -2
  206. package/dist/cli-bundle/chunks/chunk-HCIYWD6M.js +0 -35
  207. package/dist/cli-bundle/chunks/chunk-I2LUWWR5.js +0 -3
  208. package/dist/cli-bundle/chunks/chunk-IC5W2T34.js +0 -2
  209. package/dist/cli-bundle/chunks/chunk-OAC5NIV4.js +0 -3
  210. package/dist/cli-bundle/chunks/chunk-PANOOBIS.js +0 -13
  211. package/dist/cli-bundle/chunks/chunk-TK6N7HGM.js +0 -8
  212. package/dist/cli-bundle/chunks/chunk-TOFG2URD.js +0 -197
  213. package/dist/cli-bundle/chunks/register-list-query-EYCXHZAG.js +0 -10
  214. package/dist/cli-bundle/chunks/register-mutation-7YVIG54J.js +0 -20
  215. package/dist/cli-bundle/focused-chunks/chunk-5NMFSX26.js +0 -155
  216. package/dist/cli-bundle/focused-chunks/chunk-725JSCMP.js +0 -2
  217. package/dist/cli-bundle/focused-chunks/chunk-DQ6SMTBF.js +0 -2
  218. package/dist/cli-bundle/focused-chunks/chunk-HAACPSUW.js +0 -2
  219. package/dist/cli-bundle/focused-chunks/chunk-J4UFYHOD.js +0 -2
  220. package/dist/cli-bundle/focused-chunks/chunk-JX5Z344Q.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-L4RDYBIQ.js +0 -2
  222. package/dist/cli-bundle/focused-chunks/chunk-NJ5RLEFD.js +0 -26
  223. package/dist/cli-bundle/focused-chunks/chunk-QYZERYR5.js +0 -4
  224. package/dist/cli-bundle/focused-chunks/chunk-TZATVC4G.js +0 -16
  225. package/dist/cli-bundle/focused-chunks/chunk-WY3WRPVN.js +0 -2
@@ -7,7 +7,7 @@
7
7
  * flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c82d9b50-274f-585d-be0e-9a0c5067b9e9")}catch(e){}}();
10
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1d9df714-a6dc-5dc3-b2ff-c9325f91a443")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
13
13
  function normalizeFlagAliasKey(flag) {
@@ -136,6 +136,7 @@ export const LIST_FILTER_FLAG_CONTRACTS = withCursorSemantics([
136
136
  { flag: "--for", value_name: "intent" },
137
137
  { flag: "--token-budget", aliases: ["--token_budget"] },
138
138
  { flag: "--status", list: true },
139
+ { flag: "--all", value_type: "boolean" },
139
140
  { flag: "--type", list: true },
140
141
  { flag: "--tag", aliases: ["--tags"], list: true },
141
142
  { flag: "--priority", list: true },
@@ -1416,6 +1417,7 @@ export const EVENTS_FLAG_CONTRACTS = [
1416
1417
  { flag: "--author", repeatable: true },
1417
1418
  { flag: "--item", repeatable: true },
1418
1419
  { flag: "--limit", value_type: "number" },
1420
+ { flag: "--cursor-mode", value_name: "batch|row" },
1419
1421
  { flag: "--full" },
1420
1422
  { flag: "--provenance" },
1421
1423
  { flag: "--provenance-summary" },
@@ -1636,9 +1638,7 @@ export function toUniqueFlagContracts(contracts) {
1636
1638
  function withSubcommandGlobalFlags(contracts) {
1637
1639
  return withFlagAliasMetadata(toUniqueFlagContracts([...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, ...contracts]));
1638
1640
  }
1639
- const LIST_COMMAND_FLAG_ALIASES = [
1640
- "list",
1641
- "list-all",
1641
+ const FIXED_STATUS_LIST_COMMAND_ALIASES = [
1642
1642
  "list-draft",
1643
1643
  "list-open",
1644
1644
  "list-in-progress",
@@ -1646,6 +1646,8 @@ const LIST_COMMAND_FLAG_ALIASES = [
1646
1646
  "list-closed",
1647
1647
  "list-canceled",
1648
1648
  ];
1649
+ const FIXED_STATUS_LIST_FLAG_CONTRACTS = LIST_FILTER_FLAG_CONTRACTS.filter((contract) => contract.flag !== "--status" && contract.flag !== "--all");
1650
+ const ALL_STATUS_LIST_FLAG_CONTRACTS = LIST_FILTER_FLAG_CONTRACTS.filter((contract) => contract.flag !== "--status");
1649
1651
  // Single-token command (plus the `list`/`cal`/`ctx`/`templates` aliases) → its
1650
1652
  // dedicated flag-contract table. Lookups fall back to the subcommand-global set,
1651
1653
  // so tokens absent here (`reindex`, `help`, or any unknown command) degrade to
@@ -1653,9 +1655,11 @@ const LIST_COMMAND_FLAG_ALIASES = [
1653
1655
  // plain object) keeps an untrusted command token from ever resolving an inherited
1654
1656
  // member such as `constructor` or `toString`.
1655
1657
  const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
1656
- ...LIST_COMMAND_FLAG_ALIASES.map((command) => [
1658
+ ["list", LIST_FILTER_FLAG_CONTRACTS],
1659
+ ["list-all", ALL_STATUS_LIST_FLAG_CONTRACTS],
1660
+ ...FIXED_STATUS_LIST_COMMAND_ALIASES.map((command) => [
1657
1661
  command,
1658
- LIST_FILTER_FLAG_CONTRACTS,
1662
+ FIXED_STATUS_LIST_FLAG_CONTRACTS,
1659
1663
  ]),
1660
1664
  ["templates", CREATE_FLAG_CONTRACTS],
1661
1665
  ["cal", CALENDAR_FLAG_CONTRACTS],
@@ -1821,4 +1825,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1821
1825
  return normalizeUniqueStringList(all).join(" ");
1822
1826
  }
1823
1827
  //# sourceMappingURL=flag-contracts.js.map
1824
- //# debugId=c82d9b50-274f-585d-be0e-9a0c5067b9e9
1828
+ //# debugId=1d9df714-a6dc-5dc3-b2ff-c9325f91a443
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @module sdk/cli-contracts/grammar-contracts
3
+ *
4
+ * Declares and verifies the agent-facing noun–verb grammar. The destination
5
+ * census is intentionally exact: live command contracts are compared with
6
+ * this checked-in table in both directions so adding or removing a command
7
+ * cannot silently bypass the architecture decision.
8
+ */
9
+ import type { PmCommandAliasContract } from "./command-aliases.js";
10
+ /** Canonical top-level domains an agent must retain to route pm operations. */
11
+ export declare const PM_CLI_GRAMMAR_NOUNS: readonly ["item", "list", "context", "search", "graph", "history", "workspace", "package", "ops", "plan", "contracts", "help"];
12
+ /** Shared verbs whose meaning transfers across domain nouns. */
13
+ export declare const PM_CLI_SHARED_VERBS: readonly ["activate", "add", "adopt", "adopt-all", "catalog", "compact", "complete", "create", "deactivate", "delete", "describe", "doctor", "edit", "explore", "import", "init", "inspect", "install", "list", "manage", "migrate", "mutate", "read", "redact", "reload", "remove", "repair", "restore", "run", "show", "uninstall", "verify"];
14
+ /** Why a current command is permitted while the grammar migration proceeds. */
15
+ export type PmCommandDestinationDisposition = "target_noun" | "consolidation" | "package_owned" | "keep_as_is";
16
+ /** Exact destination decision for one command emitted by runtime contracts. */
17
+ export interface PmCommandDestinationContract {
18
+ /** Current executable command path. */
19
+ command: string;
20
+ /** Canonical noun that owns the capability. */
21
+ noun: (typeof PM_CLI_GRAMMAR_NOUNS)[number];
22
+ /** Canonical noun-first invocation or family destination. */
23
+ target: string;
24
+ /** Why the current spelling remains in the executable surface. */
25
+ disposition: PmCommandDestinationDisposition;
26
+ /** PM item or package identifier owning the disposition. */
27
+ owner: string;
28
+ /** Reason required only for a deliberate keep-as-is exception. */
29
+ reason?: string;
30
+ }
31
+ /** Checked-in exhaustive destination census for core and known package commands. */
32
+ export declare const PM_COMMAND_DESTINATION_CONTRACTS: readonly PmCommandDestinationContract[];
33
+ /** Immutable grammar policy used by contracts and the CI gate. */
34
+ export declare const PM_CLI_GRAMMAR_CONTRACT: {
35
+ readonly nouns: readonly ["item", "list", "context", "search", "graph", "history", "workspace", "package", "ops", "plan", "contracts", "help"];
36
+ readonly shared_verbs: readonly ["activate", "add", "adopt", "adopt-all", "catalog", "compact", "complete", "create", "deactivate", "delete", "describe", "doctor", "edit", "explore", "import", "init", "inspect", "install", "list", "manage", "migrate", "mutate", "read", "redact", "reload", "remove", "repair", "restore", "run", "show", "uninstall", "verify"];
37
+ readonly scope_before_verb: true;
38
+ readonly visible_top_level_ceiling: 69;
39
+ readonly ceiling_raise_requires_pm_item: true;
40
+ };
41
+ /** One self-correcting grammar-gate finding. */
42
+ export interface PmCliGrammarFinding {
43
+ /** Stable diagnostic category suitable for automated remediation. */
44
+ code: "alias_target_missing" | "duplicate_destination" | "missing_destination" | "stale_destination" | "unknown_noun" | "visible_surface_ceiling_exceeded";
45
+ /** Exact command or alias spelling that violated the contract. */
46
+ spelling: string;
47
+ /** Human-readable explanation of the violated invariant. */
48
+ message: string;
49
+ /** Closest canonical invocation or corrective policy action. */
50
+ nearest_target: string;
51
+ }
52
+ /** Deterministic conformance report for the live command and alias surfaces. */
53
+ export interface PmCliGrammarReport {
54
+ /** Whether every checked grammar invariant passed. */
55
+ ok: boolean;
56
+ /** Number of normalized live command paths evaluated. */
57
+ command_count: number;
58
+ /** Number of checked-in destination-census rows. */
59
+ destination_count: number;
60
+ /** Number of declared aliases omitted from default discovery. */
61
+ hidden_alias_count: number;
62
+ /** Number of distinct visible non-package single-token command paths. */
63
+ visible_top_level_count: number;
64
+ /** Maximum visible single-token command paths permitted by the ADR. */
65
+ visible_top_level_ceiling: number;
66
+ /** Self-correcting conformance diagnostics, empty when `ok` is true. */
67
+ findings: PmCliGrammarFinding[];
68
+ }
69
+ /** Verify exhaustive census parity, noun ownership, alias targets, and growth. */
70
+ export declare function verifyPmCliGrammar(commands: readonly string[], aliases?: readonly PmCommandAliasContract[]): PmCliGrammarReport;
@@ -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[];