@unbrained/pm-cli 2026.8.5 → 2026.8.7

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 (251) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +44 -0
  3. package/dist/cli/main.js +14 -37
  4. package/dist/cli/register-operations.js +11 -2
  5. package/dist/cli/register-setup.d.ts +1 -1
  6. package/dist/cli/register-setup.js +46 -20
  7. package/dist/cli/stats-analytics-json.d.ts +9 -0
  8. package/dist/cli/stats-analytics-json.js +69 -0
  9. package/dist/cli-bundle/bundle-manifest.json +403 -403
  10. package/dist/cli-bundle/chunks/append-7BXBFDGD.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-PMXJEU3F.js → chunk-2AXF3VSK.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-MHK6LIWE.js → chunk-2XS43CCV.js} +2 -2
  13. package/dist/cli-bundle/chunks/chunk-3A6KWB72.js +8 -0
  14. package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +8 -0
  15. package/dist/cli-bundle/chunks/{chunk-45G53IU4.js → chunk-4MTI7XOV.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-7C4PTJG6.js → chunk-6BX5UDCN.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-4YUBDMQM.js → chunk-6QPO7KLR.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-HWRRMBJO.js → chunk-7MXHZHSQ.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-3FTILRJ2.js → chunk-7ZPMJW4U.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-2WFXWAYX.js → chunk-AGYNSNCI.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +5 -0
  22. package/dist/cli-bundle/chunks/{chunk-43HQQI6S.js → chunk-B4KLBBMN.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-VCKLFEUN.js → chunk-CALJHNBL.js} +12 -12
  24. package/dist/cli-bundle/chunks/{chunk-CSI3WS5I.js → chunk-CFIGP5LY.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-V3EUXXOF.js → chunk-CS6MRHG7.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-YSO3YFZ4.js → chunk-CUGNQQKH.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +164 -0
  28. package/dist/cli-bundle/chunks/{chunk-BXQLRKWF.js → chunk-H5Y5YE6A.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-54FNT7U2.js → chunk-H5Y6UV6E.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-UP7DTVMD.js → chunk-H7KGWPDF.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-E2RKBKWB.js → chunk-HFSD77TQ.js} +2 -2
  32. package/dist/cli-bundle/chunks/{chunk-V3774P7D.js → chunk-HX2GTA6L.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-UZBWIUYD.js → chunk-J2IEKAVR.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-HNFD72UK.js → chunk-K44PYFXH.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-5ZBOIPGP.js → chunk-K4KGEEBT.js} +2 -2
  36. package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +21 -0
  37. package/dist/cli-bundle/chunks/{chunk-OMXVBQ2N.js → chunk-KL6IEBV2.js} +2 -2
  38. package/dist/cli-bundle/chunks/{chunk-7A5OT5J2.js → chunk-KWQZDZSS.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-M72BKL5Q.js → chunk-KZ4X3DGU.js} +2 -2
  40. package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +13 -0
  41. package/dist/cli-bundle/chunks/{chunk-VN5VITU3.js → chunk-ME2JJ4LA.js} +2 -2
  42. package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +2 -0
  43. package/dist/cli-bundle/chunks/{chunk-A62CYISG.js → chunk-NG6OXIBR.js} +8 -8
  44. package/dist/cli-bundle/chunks/{chunk-42E7YPLG.js → chunk-NYIGHWQY.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-RKAVWO3O.js → chunk-NZ75GNSA.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-DXDREUXT.js → chunk-PCJWJNC2.js} +2 -2
  47. package/dist/cli-bundle/chunks/{chunk-ZYHOB3SN.js → chunk-PD3225AM.js} +2 -2
  48. package/dist/cli-bundle/chunks/{chunk-OTHLDSFP.js → chunk-PDEGKG7P.js} +2 -2
  49. package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +2 -0
  50. package/dist/cli-bundle/chunks/chunk-PW2H7YJR.js +56 -0
  51. package/dist/cli-bundle/chunks/{chunk-L3AZOELJ.js → chunk-TPKN3S7S.js} +2 -2
  52. package/dist/cli-bundle/chunks/{chunk-LKDGK44W.js → chunk-TPXAXTCO.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +2 -0
  54. package/dist/cli-bundle/chunks/{chunk-R546TPDE.js → chunk-UQLZQVFW.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-BPELKUQD.js → chunk-VT3Z5G7D.js} +2 -2
  56. package/dist/cli-bundle/chunks/chunk-WOD3WWUN.js +2 -0
  57. package/dist/cli-bundle/chunks/{chunk-4VN6GS4U.js → chunk-WSJEIGJF.js} +2 -2
  58. package/dist/cli-bundle/chunks/{chunk-UN66FZRO.js → chunk-WYNUU7ZW.js} +49 -46
  59. package/dist/cli-bundle/chunks/{chunk-NY4T3JWN.js → chunk-YGPNCCXZ.js} +2 -2
  60. package/dist/cli-bundle/chunks/close-CMY3BAUG.js +2 -0
  61. package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +2 -0
  62. package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +2 -0
  63. package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +2 -0
  64. package/dist/cli-bundle/chunks/{create-XLKTXTUF.js → create-I5DVV4YG.js} +2 -2
  65. package/dist/cli-bundle/chunks/delete-RL3JACSW.js +2 -0
  66. package/dist/cli-bundle/chunks/{deps-ITTY3GIC.js → deps-S7UBCECS.js} +2 -2
  67. package/dist/cli-bundle/chunks/{docs-W4OSRTYR.js → docs-ZZNVBBYO.js} +2 -2
  68. package/dist/cli-bundle/chunks/{files-EOK4AZI4.js → files-27C337VT.js} +2 -2
  69. package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +2 -0
  70. package/dist/cli-bundle/chunks/{history-compact-7UGTMLL3.js → history-compact-HJQK67CZ.js} +2 -2
  71. package/dist/cli-bundle/chunks/{history-redact-4DZRMD6Z.js → history-redact-PWC6PDWA.js} +2 -2
  72. package/dist/cli-bundle/chunks/{history-repair-UPOSZW5R.js → history-repair-N3CY4WBF.js} +2 -2
  73. package/dist/cli-bundle/chunks/{learnings-GMRNCBS3.js → learnings-4FH23XDT.js} +2 -2
  74. package/dist/cli-bundle/chunks/{profile-2MUUMHRE.js → profile-5Y5XXH5N.js} +2 -2
  75. package/dist/cli-bundle/chunks/{register-list-query-LR3SQ5ZF.js → register-list-query-FJZCJ67O.js} +2 -2
  76. package/dist/cli-bundle/chunks/{register-mutation-SUOHFVWM.js → register-mutation-YGYPW3BL.js} +3 -3
  77. package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +2 -0
  78. package/dist/cli-bundle/chunks/register-setup-DL7FFABC.js +2 -0
  79. package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +2 -0
  80. package/dist/cli-bundle/chunks/{schema-FJ4EA3XF.js → schema-EQGKBYXJ.js} +2 -2
  81. package/dist/cli-bundle/chunks/update-QVTYOD6I.js +2 -0
  82. package/dist/cli-bundle/chunks/update-many-DJSBU525.js +2 -0
  83. package/dist/cli-bundle/focused-chunks/{chunk-MJ7HWSFK.js → chunk-2ECLECMK.js} +3 -3
  84. package/dist/cli-bundle/focused-chunks/{chunk-A7BJ5SS6.js → chunk-3K4XV2BF.js} +2 -2
  85. package/dist/cli-bundle/focused-chunks/{chunk-PIMMYG7Q.js → chunk-4EX25PXM.js} +2 -2
  86. package/dist/cli-bundle/focused-chunks/chunk-4VJQTS3P.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/chunk-73JUDYXT.js +2 -0
  88. package/dist/cli-bundle/focused-chunks/{chunk-WVIVUWVL.js → chunk-CIXVQPB7.js} +2 -2
  89. package/dist/cli-bundle/focused-chunks/chunk-DLTS3IHM.js +2 -0
  90. package/dist/cli-bundle/focused-chunks/{chunk-FGKY4MBE.js → chunk-DQ6FKGL3.js} +10 -10
  91. package/dist/cli-bundle/focused-chunks/{chunk-QVHKCI4T.js → chunk-HNL6IFGS.js} +2 -2
  92. package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +2 -0
  93. package/dist/cli-bundle/focused-chunks/{chunk-G6ETT4QK.js → chunk-MHMTKV5V.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-7J5TUBUJ.js → chunk-MOTJFQ3F.js} +22 -22
  95. package/dist/cli-bundle/focused-chunks/{chunk-UIL2M2NA.js → chunk-NBJKQP4S.js} +2 -2
  96. package/dist/cli-bundle/focused-chunks/{chunk-RUR5I3TK.js → chunk-QHRTT7WT.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-B7LJWAZE.js → chunk-R2LEMEV5.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-SV3O7TSH.js → chunk-RPNYG5MO.js} +2 -2
  99. package/dist/cli-bundle/focused-chunks/chunk-RW5IYD4J.js +4 -0
  100. package/dist/cli-bundle/focused-chunks/chunk-TIKDBG4D.js +29 -0
  101. package/dist/cli-bundle/focused-chunks/{chunk-IPWSFADF.js → chunk-VZFU2R4M.js} +2 -2
  102. package/dist/cli-bundle/focused-chunks/{chunk-WEM2E2PE.js → chunk-YZEZAPJK.js} +2 -2
  103. package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +2 -0
  104. package/dist/cli-bundle/main.js +13 -13
  105. package/dist/cli-bundle/sdk-authoring.js +1 -1
  106. package/dist/cli-bundle/sdk-contracts.js +1 -1
  107. package/dist/cli-bundle/sdk-core.js +29 -28
  108. package/dist/cli-bundle/sdk-governance.js +1 -1
  109. package/dist/cli-bundle/sdk-graph.js +1 -1
  110. package/dist/cli-bundle/sdk-merge.js +1 -1
  111. package/dist/cli-bundle/sdk-query.js +1 -1
  112. package/dist/cli-bundle/sdk-runtime.js +1 -1
  113. package/dist/cli-bundle/sdk-testing.js +1 -1
  114. package/dist/cli-bundle/sdk.js +1 -1
  115. package/dist/core/extensions/activation-summary.d.ts +4 -0
  116. package/dist/core/extensions/activation-summary.js +5 -2
  117. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  118. package/dist/core/extensions/contribution-inventory.js +35 -2
  119. package/dist/core/extensions/extension-hook-runtime.js +5 -3
  120. package/dist/core/extensions/extension-types.d.ts +18 -1
  121. package/dist/core/extensions/extension-types.js +2 -2
  122. package/dist/core/extensions/loader.js +5 -13
  123. package/dist/core/extensions/preflight-ownership.d.ts +5 -0
  124. package/dist/core/extensions/preflight-ownership.js +42 -0
  125. package/dist/core/extensions/reserved-host-flags.js +3 -2
  126. package/dist/core/history/workspace-history.d.ts +22 -2
  127. package/dist/core/history/workspace-history.js +60 -36
  128. package/dist/core/output/output.d.ts +2 -0
  129. package/dist/core/output/output.js +3 -2
  130. package/dist/core/shared/command-types.d.ts +2 -0
  131. package/dist/core/shared/command-types.js +2 -2
  132. package/dist/mcp/tool-definitions.js +6 -2
  133. package/dist/sdk/author-attribution.js +23 -7
  134. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  135. package/dist/sdk/cli-bootstrap.js +7 -2
  136. package/dist/sdk/cli-contracts/completeness.js +51 -4
  137. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  138. package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
  139. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  140. package/dist/sdk/cli-contracts/runtime-contracts.js +16 -9
  141. package/dist/sdk/cli-contracts/tool-parameter-tables.js +116 -10
  142. package/dist/sdk/cli-contracts/tool-schema.js +18 -2
  143. package/dist/sdk/cli-contracts.d.ts +1 -1
  144. package/dist/sdk/cli-contracts.js +3 -3
  145. package/dist/sdk/cli-program.js +3 -2
  146. package/dist/sdk/completion.js +5 -2
  147. package/dist/sdk/compose.d.ts +2 -2
  148. package/dist/sdk/compose.js +7 -2
  149. package/dist/sdk/contracts.d.ts +1 -0
  150. package/dist/sdk/contracts.js +2 -2
  151. package/dist/sdk/core.d.ts +3 -1
  152. package/dist/sdk/core.js +4 -3
  153. package/dist/sdk/define.d.ts +3 -1
  154. package/dist/sdk/define.js +3 -8
  155. package/dist/sdk/extension/install-sources.d.ts +43 -5
  156. package/dist/sdk/extension/install-sources.js +36 -2
  157. package/dist/sdk/extension/migrations.d.ts +114 -0
  158. package/dist/sdk/extension/migrations.js +175 -0
  159. package/dist/sdk/extension/scaffold.js +14 -9
  160. package/dist/sdk/extension/source-resolution.d.ts +50 -0
  161. package/dist/sdk/extension/source-resolution.js +66 -0
  162. package/dist/sdk/extension.d.ts +5 -1
  163. package/dist/sdk/extension.js +31 -35
  164. package/dist/sdk/generated-error-code-catalog.js +112 -2
  165. package/dist/sdk/governance/health.js +11 -2
  166. package/dist/sdk/history-analytics.d.ts +141 -0
  167. package/dist/sdk/history-analytics.js +283 -0
  168. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  169. package/dist/sdk/improvement-ledger-validation.js +63 -0
  170. package/dist/sdk/improvement-ledger.d.ts +139 -0
  171. package/dist/sdk/improvement-ledger.js +261 -0
  172. package/dist/sdk/index.d.ts +11 -3
  173. package/dist/sdk/index.js +12 -4
  174. package/dist/sdk/lifecycle/plan.js +6 -3
  175. package/dist/sdk/merge/install.js +10 -2
  176. package/dist/sdk/package-migrations.d.ts +10 -0
  177. package/dist/sdk/package-migrations.js +21 -0
  178. package/dist/sdk/read-output-budget.js +24 -22
  179. package/dist/sdk/read-output-contracts.d.ts +10 -2
  180. package/dist/sdk/read-output-contracts.js +124 -65
  181. package/dist/sdk/read-output-rows.d.ts +29 -0
  182. package/dist/sdk/read-output-rows.js +100 -0
  183. package/dist/sdk/read-output-session.d.ts +69 -0
  184. package/dist/sdk/read-output-session.js +200 -0
  185. package/dist/sdk/runtime-input.d.ts +2 -0
  186. package/dist/sdk/runtime-input.js +14 -2
  187. package/dist/sdk/runtime-primitives.d.ts +1 -1
  188. package/dist/sdk/runtime-primitives.js +3 -3
  189. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  190. package/dist/sdk/runtime-stats-options.js +38 -0
  191. package/dist/sdk/runtime.d.ts +3 -0
  192. package/dist/sdk/runtime.js +10 -27
  193. package/dist/sdk/stats.d.ts +40 -0
  194. package/dist/sdk/stats.js +112 -29
  195. package/docs/COMMANDS.md +9 -0
  196. package/docs/EXTENSIONS.md +2 -2
  197. package/docs/EXTENSION_LIFECYCLE.md +46 -0
  198. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  199. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  200. package/docs/README.md +2 -0
  201. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  202. package/docs/RELEASING.md +33 -20
  203. package/docs/SDK.md +31 -3
  204. package/marketplace.json +2 -2
  205. package/package.json +5 -5
  206. package/packages/pm-beads/package.json +1 -1
  207. package/packages/pm-calendar/package.json +1 -1
  208. package/packages/pm-command-kit/package.json +1 -1
  209. package/packages/pm-digital-twin/package.json +1 -1
  210. package/packages/pm-governance-audit/package.json +1 -1
  211. package/packages/pm-guide-shell/package.json +1 -1
  212. package/packages/pm-kanban/package.json +1 -1
  213. package/packages/pm-lifecycle-hooks/package.json +1 -1
  214. package/packages/pm-linked-test-adapters/package.json +1 -1
  215. package/packages/pm-search-advanced/package.json +1 -1
  216. package/packages/pm-templates/package.json +1 -1
  217. package/packages/pm-todos/package.json +1 -1
  218. package/packages/pm-vcs/package.json +1 -1
  219. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  220. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  221. package/sdk/public-surface.json +566 -815
  222. package/dist/cli-bundle/chunks/append-VXXGOXSG.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-6MSQJOTG.js +0 -13
  224. package/dist/cli-bundle/chunks/chunk-EGJ4JTUG.js +0 -55
  225. package/dist/cli-bundle/chunks/chunk-FPBQHMFT.js +0 -8
  226. package/dist/cli-bundle/chunks/chunk-GE4KCSZP.js +0 -164
  227. package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-Q35VBGOQ.js +0 -5
  230. package/dist/cli-bundle/chunks/chunk-SSF4PIUR.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +0 -20
  232. package/dist/cli-bundle/chunks/chunk-XCEZYMNI.js +0 -2
  233. package/dist/cli-bundle/chunks/chunk-YEWNL576.js +0 -2
  234. package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +0 -2
  235. package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +0 -2
  236. package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +0 -2
  237. package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +0 -2
  238. package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +0 -2
  239. package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +0 -2
  240. package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +0 -2
  241. package/dist/cli-bundle/chunks/register-setup-O6AYP6NP.js +0 -2
  242. package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +0 -2
  243. package/dist/cli-bundle/chunks/update-YHV52CSS.js +0 -2
  244. package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +0 -2
  245. package/dist/cli-bundle/focused-chunks/chunk-BIMTMOS7.js +0 -4
  246. package/dist/cli-bundle/focused-chunks/chunk-GJ2TG2CW.js +0 -28
  247. package/dist/cli-bundle/focused-chunks/chunk-N5XU5UVK.js +0 -2
  248. package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-VLYOEYML.js +0 -2
  250. package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +0 -2
  251. package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +0 -2
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
9
- "version": "2026.8.5"
9
+ "version": "2026.8.7"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "pm-claude",
14
14
  "source": "./plugins/pm-claude",
15
15
  "description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
16
- "version": "2026.8.5",
16
+ "version": "2026.8.7",
17
17
  "author": {
18
18
  "name": "unbrained",
19
19
  "url": "https://github.com/unbraind/pm-cli"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.8.7 - 2026-08-07
4
+
5
+ ### Added
6
+
7
+ - Caller-carried output sessions compose token budgets across reads and suppress repeated item facts ([pm-hid9g1](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-hid9g1.toon))
8
+ - Fleet attribution analytics: per-harness and per-model throughput, rework, and defect-escape rates derived from immutable history alone ([pm-gw6uyq](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-gw6uyq.toon))
9
+ - Improvement ledger: measured properties of pm carry a recorded time series, because a ceiling proves a number did not grow and can never prove a change made it smaller ([pm-chahyq](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-chahyq.toon))
10
+
11
+ ### Changed
12
+
13
+ - Update @toon-format/toon to 4.1.1 and verify codec compatibility ([pm-ko35zx](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-ko35zx.toon))
14
+
15
+ ### Fixed
16
+
17
+ - Nested pm test coverage changes repository-root fixtures because outer PM_PATH sandboxing leaks into package-owned run-tests ([pm-ay3l0p](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ay3l0p.toon))
18
+ - Read surfaces have no common row contract: field projection reaches 4 of 11 commands and the row collection sits under a different key on each, so no single shell or jq expression works across pm ([pm-sb0tns](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-sb0tns.toon))
19
+ - Sentry PM-CLI-2W: rejected unknown-author acknowledgments are emitted as high production errors ([pm-c3uru0](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-c3uru0.toon))
20
+ - Expose live bounded provenance coverage over immutable history ([pm-1wiugq](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-1wiugq.toon))
21
+ - GH-915: Windows nightly Vite import portability and shared contract-fixture isolation regressions ([pm-ssd7vv](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ssd7vv.toon))
22
+ - GH-914: macOS extension source identity compares non-canonical /var and /private/var paths ([pm-eu46an](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-eu46an.toon))
23
+ - The coverage gate every contributor is told to run is not a gate: run-tests.mjs coverage prints the shortfall and exits 0, so only CI can fail on coverage ([pm-2qqcgl](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-2qqcgl.toon))
24
+ - The one projection that promises completeness is the one that loses data: pm contracts --full drops all 76 structured command summaries, returns 160 bare name strings, and reports has_omissions false ([pm-x0iv17](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-x0iv17.toon))
25
+ - GH-910: keep extension assets outside item merge-driver patterns ([pm-t9qbmp](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-t9qbmp.toon))
26
+ - GH-911: preserve runtime dependency resolution in post-install activation probes ([pm-pg9599](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-pg9599.toon))
27
+ - GH-912 regression: restore atomic cross-owner seeded Plan creation ([pm-hxuqsa](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-hxuqsa.toon))
28
+
29
+ ### Other
30
+
31
+ - Refresh compatible tooling dependencies: tsx 4.23.8 and pm-changelog 2026.8.6 ([pm-l9fv1e](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-l9fv1e.toon))
32
+
33
+ ## 2026.8.6 - 2026-08-06
34
+
35
+ ### Fixed
36
+
37
+ - GH-909: executable extension migration application and remediation contract ([pm-ig5cfe](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ig5cfe.toon))
38
+ - GH-908: explicit package-source identity and bare-name ambiguity diagnostics ([pm-495lkc](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-495lkc.toon))
39
+ - GH-907: preflight override ownership and statically disjoint command scopes ([pm-miy5k6](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-miy5k6.toon))
40
+ - Release ratchet verdicts are a property of the working copy, not the commit: gitignored installs and clone-local git config decide three populations, so an identical commit passes locally and fails in CI ([pm-fr4dg8](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-fr4dg8.toon))
41
+ - Exact-tag Release recovery must bootstrap tracker gates and publish an unpublished immutable tag from its tagged source ([pm-lwnifd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-lwnifd.toon))
42
+
43
+ ### Other
44
+
45
+ - Refresh compatible 2026-08-05 TypeScript-ESLint and Unicorn quality tooling ([pm-7gxbl8](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-7gxbl8.toon))
46
+
3
47
  ## 2026.8.5 - 2026-08-05
4
48
 
5
49
  ### Fixed
package/dist/cli/main.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * @module cli/main
4
4
  */
5
5
 
6
- !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]="65cd2f79-5d55-542f-94ff-07cb4a913a44")}catch(e){}}();
6
+ !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]="bb6049e8-1185-5702-b8c1-3a30a98db516")}catch(e){}}();
7
7
  import { Command } from "commander";
8
8
  import { activateExtensions, clearActiveExtensionHooks, createCoreCommandHookContext, resetActiveExtensionRuntimeState, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, consumeAfterCommandAffectedItems, runActiveCommandHandler, runActiveParserOverride, runActivePreflightOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandResult, setActiveCommandContext, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, pathExists, resolvePmCliVersion, resolvePmPackageRootFromModule, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, EXIT_CODE, resolveTelemetryErrorCategory, PmCliError, asRecordOrNull, printError, printResult, maybeRunFirstUseTelemetryPrompt, emitTelemetryErrorEvent, startTelemetryCommand, deriveTelemetryCommandResolution, sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, ensureSentryInit, getSettingsPath, resolvePmRoot, readSettings, readSettingsWithMetadata, runWithWorkspaceHarnessSignalDescriptors, createLazyModule, } from "../sdk/runtime-primitives.js";
9
9
  import { resolveSubcommandFlagContractsForCommand } from "../sdk/cli-contracts.js";
@@ -20,7 +20,8 @@ import { normalizeExtensionCommandPath, collectDynamicExtensionFlagHelpByCommand
20
20
  import { parseBootstrapGlobalOptions, applyBootstrapPagerPolicy, parseBootstrapHelpRequest, parseBootstrapCommandName, normalizeBootstrapInvocation, stripGlobalBootstrapTokens, } from "./bootstrap-args.js";
21
21
  import { applyInvocationAuthorOverride } from "../sdk/invocation-author.js";
22
22
  import { createPmCliProgram } from "../sdk/cli-program.js";
23
- import { collectMandatoryMigrationBlockers, enforceMandatoryMigrationWriteGate, enforceItemFormatWriteGateAndPreflightMigration, enforceMutationGuardPreflight, resolveMigrationId, resolveNormalizedMigrationStatus, } from "./migration-gates.js";
23
+ import { collectMandatoryMigrationBlockers, enforceMandatoryMigrationWriteGate, enforceItemFormatWriteGateAndPreflightMigration, enforceMutationGuardPreflight, } from "./migration-gates.js";
24
+ import { runExtensionMigrations } from "../sdk/extension/migrations.js";
24
25
  import { appendCommanderExtensionFailures, isKnownHelpCommandPath, formatCommanderUsageMessage, formatCommanderUsageJson, resolveCommanderUsageContext, resolveUnknownCommanderToken, } from "./commander-usage.js";
25
26
  import { loadExtensionRecoveryFailures, loadUnknownCommandRecoveryFailures } from "./extension-recovery.js";
26
27
  import { maybeRenderBootstrapJsonHelp, attachCreateUpdatePolicyHelpText } from "./help-json-payload.js";
@@ -514,6 +515,7 @@ function extractCommandScopedOptions(command, commandArgs, extensionFlagDefiniti
514
515
  delete scoped.outputLimit;
515
516
  delete scoped.outputBudget;
516
517
  delete scoped.outputFormat;
518
+ delete scoped.outputSession;
517
519
  const looseOptions = parseLooseCommandOptions(commandArgs);
518
520
  for (const [key, value] of Object.entries(looseOptions)) {
519
521
  /* c8 ignore next */
@@ -1197,40 +1199,14 @@ async function loadRuntimeExtensionCommandDescriptorsForRecovery(pmRoot) {
1197
1199
  return snapshot ? new Map(snapshot.commandDescriptors) : activeRuntimeExtensionCommandDescriptors;
1198
1200
  }
1199
1201
  async function executeRegisteredRuntimeMigrations(migrations, pmRoot) {
1200
- const warnings = [];
1201
- for (let index = 0; index < migrations.length; index += 1) {
1202
- const migration = migrations[index];
1203
- const status = resolveNormalizedMigrationStatus(migration.definition);
1204
- if (status === "applied") {
1205
- continue;
1206
- }
1207
- const runtimeDefinition = migration.runtime_definition ?? migration.definition;
1208
- const run = runtimeDefinition.run;
1209
- if (typeof run !== "function") {
1210
- continue;
1211
- }
1212
- const migrationId = resolveMigrationId(migration.definition, index);
1213
- try {
1214
- await Promise.resolve(run({
1215
- id: migrationId,
1216
- command: "migration",
1217
- layer: migration.layer,
1218
- extension: migration.name,
1219
- pm_root: pmRoot,
1220
- status,
1221
- }));
1222
- migration.definition.status = "applied";
1223
- delete migration.definition.reason;
1224
- delete migration.definition.error;
1225
- delete migration.definition.message;
1226
- }
1227
- catch (error) {
1228
- migration.definition.status = "failed";
1229
- migration.definition.reason = describeUnknownError(error);
1230
- warnings.push(`extension_migration_failed:${migration.layer}:${migration.name}:${migrationId}`);
1231
- }
1232
- }
1233
- return warnings;
1202
+ const result = await runExtensionMigrations({
1203
+ pmRoot,
1204
+ migrations,
1205
+ author: "pm-extension-migration",
1206
+ });
1207
+ return result.migrations
1208
+ .filter((migration) => migration.outcome === "failed")
1209
+ .map((migration) => `extension_migration_failed:${migration.layer}:${migration.extension}:${migration.id}`);
1234
1210
  }
1235
1211
  /* c8 ignore start */
1236
1212
  /** Build one host-bound extension SDK using the command's resolved author. */
@@ -1566,6 +1542,7 @@ function attachProgramLifecycleHooks(rootProgram) {
1566
1542
  outputLimit: rawGlobalOptions.outputLimit,
1567
1543
  outputBudget: rawGlobalOptions.outputBudget,
1568
1544
  outputFormat: rawGlobalOptions.outputFormat,
1545
+ outputSession: rawGlobalOptions.outputSession,
1569
1546
  });
1570
1547
  await maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions);
1571
1548
  const fallbackPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobalOptions.path);
@@ -2476,4 +2453,4 @@ export const _testOnly = {
2476
2453
  wrapThrownErrorForSentry,
2477
2454
  };
2478
2455
  //# sourceMappingURL=main.js.map
2479
- //# debugId=65cd2f79-5d55-542f-94ff-07cb4a913a44
2456
+ //# debugId=bb6049e8-1185-5702-b8c1-3a30a98db516
@@ -1,7 +1,8 @@
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]="f8f29a82-44af-5354-9880-335ec177bae3")}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]="4856ec1e-7841-5ad0-95e3-6e3057ed999c")}catch(e){}}();
3
3
  import { resolveRuntimeStatusRegistry, setActiveCommandResult, EXIT_CODE, PmCliError, resolveAuthor, resolvePmRoot, readSettings, } from "../sdk/runtime-primitives.js";
4
4
  import { resolveStartTaskInProgressStatus } from "../sdk/start-task-status.js";
5
+ import { parseStatsAnalyticsJson } from "./stats-analytics-json.js";
5
6
  import { createWorkspaceSnapshot, deleteWorkspaceSnapshot, inspectWorkspaceSnapshot, listWorkspaceSnapshots, planWorkspaceSnapshotRestore, restoreWorkspaceSnapshotWithRecovery, } from "../sdk/workspace-snapshot.js";
6
7
  import { runClaim, runClaimNext, runRelease } from "./commands/claim.js";
7
8
  import { runClose } from "./commands/close.js";
@@ -232,6 +233,7 @@ async function runTelemetryAction(namespaceOrSubcommand, subcommand, options, co
232
233
  async function runStatsAction(options, command) {
233
234
  const globalOptions = getGlobalOptions(command);
234
235
  const startedAt = Date.now();
236
+ const analytics = parseStatsAnalyticsJson(readOptionString(options, "analytics"));
235
237
  const result = await runStats(globalOptions, {
236
238
  storage: options.storage === true,
237
239
  metadataCoverage: options.metadataCoverage === true,
@@ -240,7 +242,13 @@ async function runStatsAction(options, command) {
240
242
  byPriority: options.byPriority === true,
241
243
  tagPrefix: readOptionString(options, "tagPrefix"),
242
244
  fieldUtilization: options.fieldUtilization === true,
245
+ ...analytics,
243
246
  });
247
+ if (result.recorded_observations?.some((entry) => entry.changed) === true) {
248
+ await invalidateSearchCachesForMutation(globalOptions, {
249
+ ids: result.recorded_observations?.flatMap((entry) => entry.observation.item_id ? [entry.observation.item_id] : []),
250
+ });
251
+ }
244
252
  printResult(result, globalOptions);
245
253
  if (globalOptions.profile) {
246
254
  printError(`profile:command=stats took_ms=${Date.now() - startedAt}`);
@@ -607,6 +615,7 @@ export function registerOperationCommands(program) {
607
615
  .option("--by-priority", "Include a lifecycle-bucketed item breakdown grouped by priority")
608
616
  .option("--tag-prefix <value>", "With --by-tag: only count tags starting with this prefix (e.g. domain:)")
609
617
  .option("--field-utilization", "Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis")
618
+ .option("--analytics <json>", "Improvement ledger/history analytics JSON")
610
619
  .action(runStatsAction);
611
620
  program
612
621
  .command("health")
@@ -849,4 +858,4 @@ function registerSchedulingShortcutCommands(program) {
849
858
  });
850
859
  }
851
860
  //# sourceMappingURL=register-operations.js.map
852
- //# debugId=f8f29a82-44af-5354-9880-335ec177bae3
861
+ //# debugId=4856ec1e-7841-5ad0-95e3-6e3057ed999c
@@ -4,7 +4,7 @@
4
4
  * Provides CLI runtime support for Register Setup.
5
5
  */
6
6
  import type { Command } from "commander";
7
- type ExtensionSubcommandAction = "init" | "install" | "uninstall" | "explore" | "manage" | "describe" | "reload" | "doctor" | "catalog" | "adopt" | "adopt-all" | "activate" | "deactivate";
7
+ type ExtensionSubcommandAction = "init" | "install" | "uninstall" | "explore" | "manage" | "describe" | "reload" | "doctor" | "catalog" | "adopt" | "adopt-all" | "activate" | "deactivate" | "migrate";
8
8
  type LifecycleCommandVocabulary = "extension" | "package";
9
9
  declare function normalizeExtensionOptions(options: Record<string, unknown>, forcedAction?: ExtensionSubcommandAction, vocabulary?: LifecycleCommandVocabulary): Record<string, unknown>;
10
10
  /** Internal setup helpers exposed only for deterministic unit coverage. */
@@ -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]="a99184b6-e7cb-5d46-9737-87be7a1b1968")}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]="d498a64c-9680-52a9-981d-4ce86949784d")}catch(e){}}();
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { EXIT_CODE, PmCliError, } from "../sdk/runtime-primitives.js";
@@ -10,6 +10,22 @@ import { renderExtensionDescribeMarkdown, } from "./commands/extension/describe.
10
10
  import { runConfig } from "./commands/config.js";
11
11
  import { runInit, summarizeInitResult } from "./commands/init.js";
12
12
  import { runUpgrade } from "./commands/upgrade.js";
13
+ const EXTENSION_ACTION_OPTION_KEYS = {
14
+ init: "init",
15
+ install: "install",
16
+ uninstall: "uninstall",
17
+ explore: "explore",
18
+ manage: "manage",
19
+ describe: "describe",
20
+ reload: "reload",
21
+ doctor: "doctor",
22
+ catalog: "catalog",
23
+ adopt: "adopt",
24
+ "adopt-all": "adoptAll",
25
+ activate: "activate",
26
+ deactivate: "deactivate",
27
+ migrate: "migrate",
28
+ };
13
29
  /** Normalize the repeatable scaffold capability selector without losing conflicting intent. */
14
30
  function resolveScaffoldCapability(options) {
15
31
  const rawCapability = options.capability;
@@ -29,33 +45,36 @@ function resolveScaffoldCapability(options) {
29
45
  return capabilities[0];
30
46
  }
31
47
  function normalizeExtensionOptions(options, forcedAction, vocabulary = "extension") {
32
- const isForcedAction = (action) => forcedAction === action;
33
- const readBoolean = (...keys) => keys.some((key) => options[key] === true);
48
+ const normalizedOptions = { ...options };
49
+ if (forcedAction !== undefined) {
50
+ normalizedOptions[EXTENSION_ACTION_OPTION_KEYS[forcedAction]] = true;
51
+ }
52
+ const readBoolean = (...keys) => keys.some((key) => normalizedOptions[key] === true);
34
53
  const readString = (...keys) => {
35
54
  for (const key of keys) {
36
- if (typeof options[key] === "string") {
37
- return options[key];
55
+ if (typeof normalizedOptions[key] === "string") {
56
+ return normalizedOptions[key];
38
57
  }
39
58
  }
40
59
  return undefined;
41
60
  };
42
61
  return {
43
- init: isForcedAction("init") || readBoolean("init"),
62
+ init: readBoolean("init"),
44
63
  scaffold: readBoolean("scaffold"),
45
- install: isForcedAction("install") || readBoolean("install"),
46
- uninstall: isForcedAction("uninstall") || readBoolean("uninstall"),
47
- explore: isForcedAction("explore") || readBoolean("explore", "list"),
48
- manage: isForcedAction("manage") || readBoolean("manage"),
49
- describe: isForcedAction("describe") || readBoolean("describe"),
64
+ install: readBoolean("install"),
65
+ uninstall: readBoolean("uninstall"),
66
+ explore: readBoolean("explore", "list"),
67
+ manage: readBoolean("manage"),
68
+ describe: readBoolean("describe"),
50
69
  markdown: readBoolean("markdown"),
51
- reload: isForcedAction("reload") || readBoolean("reload"),
52
- doctor: isForcedAction("doctor") || readBoolean("doctor"),
53
- catalog: isForcedAction("catalog") || readBoolean("catalog"),
54
- adopt: isForcedAction("adopt") || readBoolean("adopt"),
55
- adoptAll: isForcedAction("adopt-all") ||
56
- readBoolean("adoptAll", "adopt_all", "adopt-all"),
57
- activate: isForcedAction("activate") || readBoolean("activate"),
58
- deactivate: isForcedAction("deactivate") || readBoolean("deactivate"),
70
+ reload: readBoolean("reload"),
71
+ doctor: readBoolean("doctor"),
72
+ catalog: readBoolean("catalog"),
73
+ adopt: readBoolean("adopt"),
74
+ adoptAll: readBoolean("adoptAll", "adopt_all", "adopt-all"),
75
+ activate: readBoolean("activate"),
76
+ deactivate: readBoolean("deactivate"),
77
+ migrate: readBoolean("migrate"),
59
78
  project: readBoolean("project"),
60
79
  local: readBoolean("local"),
61
80
  global: readBoolean("global"),
@@ -75,6 +94,7 @@ function normalizeExtensionOptions(options, forcedAction, vocabulary = "extensio
75
94
  ignoreGlobal: readBoolean("ignoreGlobal", "ignore_global", "ignore-global"),
76
95
  strictExit: readBoolean("strictExit", "strict_exit", "strict-exit"),
77
96
  failOnWarn: readBoolean("failOnWarn", "fail_on_warn", "fail-on-warn"),
97
+ dryRun: readBoolean("dryRun", "dry_run", "dry-run"),
78
98
  vocabulary,
79
99
  };
80
100
  }
@@ -461,6 +481,12 @@ function registerLifecycleCommand(program, vocabulary) {
461
481
  .description(`Adopt all unmanaged ${plural} into managed metadata.`), vocabulary).action(async (_options, command) => {
462
482
  await executeExtensionCommand(undefined, command.optsWithGlobals(), command, "adopt-all", vocabulary);
463
483
  });
484
+ addLifecycleScopeOptions(lifecycleCommand
485
+ .command("migrate")
486
+ .option("--dry-run", "Plan active migrations without invoking extension code")
487
+ .description(`Plan or apply active ${noun} migrations with durable receipts.`), vocabulary).action(async (_options, command) => {
488
+ await executeExtensionCommand(undefined, command.optsWithGlobals(), command, "migrate", vocabulary);
489
+ });
464
490
  addLifecycleScopeOptions(lifecycleCommand
465
491
  .command("activate")
466
492
  .argument("<target>", `${noun[0].toUpperCase()}${noun.slice(1)} name`)
@@ -647,4 +673,4 @@ export function registerSetupCommands(program) {
647
673
  });
648
674
  }
649
675
  //# sourceMappingURL=register-setup.js.map
650
- //# debugId=a99184b6-e7cb-5d46-9737-87be7a1b1968
676
+ //# debugId=d498a64c-9680-52a9-981d-4ce86949784d
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @module cli/stats-analytics-json
3
+ *
4
+ * Validates the compact JSON adapter used to keep the agent-facing stats CLI
5
+ * contract bounded while preserving the fully typed SDK and MCP primitives.
6
+ */
7
+ import type { StatsCommandOptions } from "./commands/stats.js";
8
+ /** Parse and strictly validate the compact CLI improvement-analytics payload. */
9
+ export declare function parseStatsAnalyticsJson(input: string | undefined): StatsCommandOptions;
@@ -0,0 +1,69 @@
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]="13159f49-7756-58b8-ac32-7ddd571e7d09")}catch(e){}}();
3
+ import { EXIT_CODE, PmCliError } from "../sdk/runtime-primitives.js";
4
+ const STATS_ANALYTICS_JSON_FIELDS = new Map([
5
+ ["measurements", "boolean"],
6
+ ["metric", "string"],
7
+ ["measurementLimit", "number"],
8
+ ["observe", "string_array"],
9
+ ["direction", "direction"],
10
+ ["measurementSource", "string"],
11
+ ["measurementItem", "string"],
12
+ ["measurementRevision", "string"],
13
+ ["author", "string"],
14
+ ["message", "string"],
15
+ ["provenanceCoverage", "boolean"],
16
+ ["fleetAttribution", "boolean"],
17
+ ["since", "string"],
18
+ ["eventLimit", "number"],
19
+ ["minimumSample", "number"],
20
+ ]);
21
+ const IMPROVEMENT_DIRECTIONS = new Set([
22
+ "higher",
23
+ "lower",
24
+ "target",
25
+ ]);
26
+ const ACCEPTED_STATS_ANALYTICS_JSON_FIELDS = [
27
+ ...STATS_ANALYTICS_JSON_FIELDS.keys(),
28
+ ]
29
+ .sort((left, right) => left.localeCompare(right))
30
+ .join(", ");
31
+ /** Validate one field against the compact analytics JSON type contract. */
32
+ function isStatsAnalyticsValue(expected, value) {
33
+ if (expected === "boolean")
34
+ return typeof value === "boolean";
35
+ if (expected === "string")
36
+ return typeof value === "string";
37
+ if (expected === "number")
38
+ return typeof value === "number";
39
+ if (expected === "string_array") {
40
+ return (Array.isArray(value) && value.every((entry) => typeof entry === "string"));
41
+ }
42
+ return expected === "direction" && IMPROVEMENT_DIRECTIONS.has(value);
43
+ }
44
+ /** Parse and strictly validate the compact CLI improvement-analytics payload. */
45
+ export function parseStatsAnalyticsJson(input) {
46
+ if (input === undefined)
47
+ return {};
48
+ let parsed;
49
+ try {
50
+ parsed = JSON.parse(input);
51
+ }
52
+ catch (error) {
53
+ throw new PmCliError(`--analytics must be valid JSON: ${String(error)}`, EXIT_CODE.USAGE);
54
+ }
55
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
56
+ throw new PmCliError("--analytics must be a JSON object.", EXIT_CODE.USAGE);
57
+ }
58
+ for (const [key, value] of Object.entries(parsed)) {
59
+ const expected = STATS_ANALYTICS_JSON_FIELDS.get(key);
60
+ if (!isStatsAnalyticsValue(expected, value)) {
61
+ throw new PmCliError(expected === undefined
62
+ ? `Unknown --analytics field "${key}". Accepted fields: ${ACCEPTED_STATS_ANALYTICS_JSON_FIELDS}.`
63
+ : `--analytics field "${key}" must be ${expected.replace("_", " ")}.`, EXIT_CODE.USAGE);
64
+ }
65
+ }
66
+ return parsed;
67
+ }
68
+ //# sourceMappingURL=stats-analytics-json.js.map
69
+ //# debugId=13159f49-7756-58b8-ac32-7ddd571e7d09