@unbrained/pm-cli 2026.6.5 → 2026.6.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 (596) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/CONTRIBUTING.md +1 -0
  3. package/README.md +17 -5
  4. package/dist/cli/commander-usage.js +74 -4
  5. package/dist/cli/commander-usage.js.map +1 -1
  6. package/dist/cli/commands/aggregate.d.ts +8 -0
  7. package/dist/cli/commands/aggregate.js +84 -7
  8. package/dist/cli/commands/aggregate.js.map +1 -1
  9. package/dist/cli/commands/calendar.js +10 -3
  10. package/dist/cli/commands/calendar.js.map +1 -1
  11. package/dist/cli/commands/close-many.js +13 -10
  12. package/dist/cli/commands/close-many.js.map +1 -1
  13. package/dist/cli/commands/close.d.ts +1 -1
  14. package/dist/cli/commands/close.js +20 -10
  15. package/dist/cli/commands/close.js.map +1 -1
  16. package/dist/cli/commands/completion.js +87 -18
  17. package/dist/cli/commands/completion.js.map +1 -1
  18. package/dist/cli/commands/config.d.ts +5 -4
  19. package/dist/cli/commands/config.js +50 -2
  20. package/dist/cli/commands/config.js.map +1 -1
  21. package/dist/cli/commands/contracts.js +6 -3
  22. package/dist/cli/commands/contracts.js.map +1 -1
  23. package/dist/cli/commands/copy.d.ts +14 -0
  24. package/dist/cli/commands/copy.js +153 -0
  25. package/dist/cli/commands/copy.js.map +1 -0
  26. package/dist/cli/commands/extension/doctor.js +62 -2
  27. package/dist/cli/commands/extension/doctor.js.map +1 -1
  28. package/dist/cli/commands/extension/install-sources.d.ts +8 -0
  29. package/dist/cli/commands/extension/install-sources.js +82 -2
  30. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  31. package/dist/cli/commands/extension.d.ts +29 -0
  32. package/dist/cli/commands/extension.js +61 -2
  33. package/dist/cli/commands/extension.js.map +1 -1
  34. package/dist/cli/commands/gc.d.ts +8 -1
  35. package/dist/cli/commands/gc.js +26 -3
  36. package/dist/cli/commands/gc.js.map +1 -1
  37. package/dist/cli/commands/get.d.ts +9 -0
  38. package/dist/cli/commands/get.js +23 -2
  39. package/dist/cli/commands/get.js.map +1 -1
  40. package/dist/cli/commands/health.js +15 -2
  41. package/dist/cli/commands/health.js.map +1 -1
  42. package/dist/cli/commands/history-compact.d.ts +39 -0
  43. package/dist/cli/commands/history-compact.js +262 -0
  44. package/dist/cli/commands/history-compact.js.map +1 -0
  45. package/dist/cli/commands/history.d.ts +4 -1
  46. package/dist/cli/commands/history.js +12 -24
  47. package/dist/cli/commands/history.js.map +1 -1
  48. package/dist/cli/commands/index.d.ts +3 -0
  49. package/dist/cli/commands/index.js +5 -2
  50. package/dist/cli/commands/index.js.map +1 -1
  51. package/dist/cli/commands/list.d.ts +2 -0
  52. package/dist/cli/commands/list.js +87 -9
  53. package/dist/cli/commands/list.js.map +1 -1
  54. package/dist/cli/commands/reindex.js +8 -4
  55. package/dist/cli/commands/reindex.js.map +1 -1
  56. package/dist/cli/commands/search.d.ts +1 -0
  57. package/dist/cli/commands/search.js +232 -35
  58. package/dist/cli/commands/search.js.map +1 -1
  59. package/dist/cli/commands/stats.d.ts +8 -1
  60. package/dist/cli/commands/stats.js +18 -17
  61. package/dist/cli/commands/stats.js.map +1 -1
  62. package/dist/cli/commands/telemetry.d.ts +8 -0
  63. package/dist/cli/commands/telemetry.js +253 -0
  64. package/dist/cli/commands/telemetry.js.map +1 -0
  65. package/dist/cli/error-guidance.js +26 -2
  66. package/dist/cli/error-guidance.js.map +1 -1
  67. package/dist/cli/extension-command-help.d.ts +1 -0
  68. package/dist/cli/extension-command-help.js +3 -2
  69. package/dist/cli/extension-command-help.js.map +1 -1
  70. package/dist/cli/help-content.js +19 -2
  71. package/dist/cli/help-content.js.map +1 -1
  72. package/dist/cli/main.d.ts +3 -0
  73. package/dist/cli/main.js +13 -21
  74. package/dist/cli/main.js.map +1 -1
  75. package/dist/cli/register-list-query.js +24 -6
  76. package/dist/cli/register-list-query.js.map +1 -1
  77. package/dist/cli/register-mutation.js +52 -17
  78. package/dist/cli/register-mutation.js.map +1 -1
  79. package/dist/cli/register-operations.js +55 -8
  80. package/dist/cli/register-operations.js.map +1 -1
  81. package/dist/cli/register-setup.js +5 -5
  82. package/dist/cli/register-setup.js.map +1 -1
  83. package/dist/cli/registration-helpers.js +21 -3
  84. package/dist/cli/registration-helpers.js.map +1 -1
  85. package/dist/cli-bundle/chunks/activity-5UROHJ3D.js +16 -0
  86. package/dist/cli-bundle/chunks/{activity-3RWRRNOW.js → activity-YVB3QRTE.js} +11 -11
  87. package/dist/cli-bundle/chunks/{aggregate-OOAGKWRG.js → aggregate-LH66F75F.js} +87 -17
  88. package/dist/cli-bundle/chunks/aggregate-LH66F75F.js.map +7 -0
  89. package/dist/cli-bundle/chunks/{aggregate-J35K7WZB.js → aggregate-OHSWFQJM.js} +88 -18
  90. package/dist/cli-bundle/chunks/aggregate-OHSWFQJM.js.map +1 -0
  91. package/dist/cli-bundle/chunks/{append-PNN6UIBZ.js → append-2PPYFAG5.js} +8 -8
  92. package/dist/cli-bundle/chunks/{append-5JE3YGXU.js → append-AUGT5W6J.js} +8 -8
  93. package/dist/cli-bundle/chunks/{chunk-26KTVXJW.js → chunk-2IF7WLB7.js} +2 -2
  94. package/dist/cli-bundle/chunks/{chunk-KA24HME7.js → chunk-2IXCHCLM.js} +5 -6
  95. package/dist/cli-bundle/chunks/chunk-2IXCHCLM.js.map +7 -0
  96. package/dist/cli-bundle/chunks/{chunk-XX5LRINW.js → chunk-2OJHLWBZ.js} +2 -2
  97. package/dist/cli-bundle/chunks/{chunk-ASQM3IF5.js → chunk-3A2CMEM7.js} +5 -4
  98. package/dist/cli-bundle/chunks/{chunk-S3CV7JGJ.js → chunk-3EOBJOF4.js} +5 -4
  99. package/dist/cli-bundle/chunks/{chunk-N5YF3VFN.js → chunk-42LOFGJS.js} +91 -16
  100. package/dist/cli-bundle/chunks/chunk-42LOFGJS.js.map +7 -0
  101. package/dist/cli-bundle/chunks/{chunk-WIKR7KFL.js → chunk-4CHEG6UK.js} +108 -21
  102. package/dist/cli-bundle/chunks/chunk-4CHEG6UK.js.map +7 -0
  103. package/dist/cli-bundle/chunks/{chunk-4QCR4QW3.js → chunk-4GHZR3BA.js} +56 -28
  104. package/dist/cli-bundle/chunks/chunk-4GHZR3BA.js.map +1 -0
  105. package/dist/cli-bundle/chunks/{chunk-B3N4TKNL.js → chunk-5AXMRKN5.js} +8 -8
  106. package/dist/cli-bundle/chunks/{chunk-JQI2HE55.js → chunk-6J4K6JLA.js} +3 -3
  107. package/dist/cli-bundle/chunks/{chunk-V3JQ4IPL.js → chunk-6RZXO5M2.js} +102 -22
  108. package/dist/cli-bundle/chunks/chunk-6RZXO5M2.js.map +1 -0
  109. package/dist/cli-bundle/chunks/{chunk-BNL6S7QH.js → chunk-AVJD6VTA.js} +3 -3
  110. package/dist/cli-bundle/chunks/{chunk-NQP3ECKF.js → chunk-B2KZGPM2.js} +39 -8
  111. package/dist/cli-bundle/chunks/chunk-B2KZGPM2.js.map +1 -0
  112. package/dist/cli-bundle/chunks/{chunk-RQAWLSUU.js → chunk-B5RF3IP7.js} +3 -3
  113. package/dist/cli-bundle/chunks/{chunk-UFCG3SWR.js → chunk-C5W2UH56.js} +3 -3
  114. package/dist/cli-bundle/chunks/{chunk-3OH4DAEB.js → chunk-CKLBZHS7.js} +6 -6
  115. package/dist/cli-bundle/chunks/{chunk-GNHVV4SY.js → chunk-CLD3XNCH.js} +124 -20
  116. package/dist/cli-bundle/chunks/chunk-CLD3XNCH.js.map +1 -0
  117. package/dist/cli-bundle/chunks/{chunk-RANZIID5.js → chunk-FHHBD7PN.js} +38 -7
  118. package/dist/cli-bundle/chunks/chunk-FHHBD7PN.js.map +7 -0
  119. package/dist/cli-bundle/chunks/{chunk-GFWHHMVV.js → chunk-FY6Z3FYY.js} +3 -3
  120. package/dist/cli-bundle/chunks/{chunk-CCUFLH4J.js → chunk-GNIUOLZ2.js} +7 -7
  121. package/dist/cli-bundle/chunks/{chunk-ZRVSMOMR.js → chunk-GPXQBR3H.js} +12 -12
  122. package/dist/cli-bundle/chunks/{chunk-SZQCER6S.js → chunk-GUZBNB3G.js} +27 -5
  123. package/dist/cli-bundle/chunks/chunk-GUZBNB3G.js.map +1 -0
  124. package/dist/cli-bundle/chunks/{chunk-GPGAYASV.js → chunk-H7EO3QA3.js} +5 -5
  125. package/dist/cli-bundle/chunks/{chunk-MISYRLEP.js → chunk-HLC3KTLP.js} +2 -2
  126. package/dist/cli-bundle/chunks/{chunk-KK6YPGH3.js → chunk-HMMMWBK2.js} +2 -2
  127. package/dist/cli-bundle/chunks/{chunk-4PJQSECJ.js → chunk-HRMHZ4RV.js} +26 -4
  128. package/dist/cli-bundle/chunks/chunk-HRMHZ4RV.js.map +7 -0
  129. package/dist/cli-bundle/chunks/{chunk-CJDQB2ED.js → chunk-HV5SSZXF.js} +2 -2
  130. package/dist/cli-bundle/chunks/{chunk-ATBVS6WW.js → chunk-IMCJBN2Q.js} +23 -14
  131. package/dist/cli-bundle/chunks/chunk-IMCJBN2Q.js.map +7 -0
  132. package/dist/cli-bundle/chunks/{chunk-FVXM3GKS.js → chunk-KNGVP5WJ.js} +3 -3
  133. package/dist/cli-bundle/chunks/{chunk-OIQIXTNB.js → chunk-KR6R465K.js} +304 -215
  134. package/dist/cli-bundle/chunks/chunk-KR6R465K.js.map +7 -0
  135. package/dist/cli-bundle/chunks/{chunk-UOVLWB47.js → chunk-LI65XLJR.js} +8 -8
  136. package/dist/cli-bundle/chunks/{chunk-AXXKLVTW.js → chunk-LIN2BPJ7.js} +2 -2
  137. package/dist/cli-bundle/chunks/chunk-LMTOY5HE.js +112 -0
  138. package/dist/cli-bundle/chunks/chunk-LMTOY5HE.js.map +1 -0
  139. package/dist/cli-bundle/chunks/{chunk-Y2AKE2HS.js → chunk-LQHBENVW.js} +3 -3
  140. package/dist/cli-bundle/chunks/{chunk-D5X7N6FI.js → chunk-LXO6V66E.js} +14 -14
  141. package/dist/cli-bundle/chunks/{chunk-TK633IVD.js → chunk-M2PW7EZU.js} +26 -7
  142. package/dist/cli-bundle/chunks/chunk-M2PW7EZU.js.map +7 -0
  143. package/dist/cli-bundle/chunks/{chunk-DFIZGAI5.js → chunk-MOYM2C3J.js} +9 -9
  144. package/dist/cli-bundle/chunks/{chunk-ZQ4F6EC4.js → chunk-MWRS7Z4P.js} +127 -23
  145. package/dist/cli-bundle/chunks/chunk-MWRS7Z4P.js.map +7 -0
  146. package/dist/cli-bundle/chunks/{chunk-5PAOPUZX.js → chunk-NHR2QXXZ.js} +24 -15
  147. package/dist/cli-bundle/chunks/chunk-NHR2QXXZ.js.map +1 -0
  148. package/dist/cli-bundle/chunks/{chunk-OUF3ARDX.js → chunk-NQL32HQ5.js} +12 -12
  149. package/dist/cli-bundle/chunks/{chunk-TBQVUNVH.js → chunk-O7HSSFCC.js} +65 -16
  150. package/dist/cli-bundle/chunks/chunk-O7HSSFCC.js.map +7 -0
  151. package/dist/cli-bundle/chunks/{chunk-GCAVRLGE.js → chunk-OKSKJKHX.js} +9 -9
  152. package/dist/cli-bundle/chunks/chunk-QQL5QSTZ.js +1572 -0
  153. package/dist/cli-bundle/chunks/chunk-QQL5QSTZ.js.map +1 -0
  154. package/dist/cli-bundle/chunks/{chunk-A6PEXMYN.js → chunk-R3V3YCMH.js} +9 -9
  155. package/dist/cli-bundle/chunks/{chunk-T2ORWB6D.js → chunk-RVPTZKBC.js} +9 -9
  156. package/dist/cli-bundle/chunks/{chunk-K47WAYQV.js → chunk-SFFVGNHC.js} +3 -3
  157. package/dist/cli-bundle/chunks/{chunk-DFUSXJDE.js → chunk-SQPKRA54.js} +14 -14
  158. package/dist/cli-bundle/chunks/chunk-THDEID2Z.js +115 -0
  159. package/dist/cli-bundle/chunks/chunk-THDEID2Z.js.map +7 -0
  160. package/dist/cli-bundle/chunks/{chunk-G5BACLYH.js → chunk-TINUJMWN.js} +92 -17
  161. package/dist/cli-bundle/chunks/chunk-TINUJMWN.js.map +1 -0
  162. package/dist/cli-bundle/chunks/{chunk-JB4RGL4V.js → chunk-TNPBPNII.js} +7 -7
  163. package/dist/cli-bundle/chunks/{chunk-XG7RJYHV.js → chunk-TP4DDY27.js} +6 -6
  164. package/dist/cli-bundle/chunks/{chunk-ORTLYVA4.js → chunk-TYJJOTUA.js} +6 -6
  165. package/dist/cli-bundle/chunks/{chunk-HZOS2UG5.js → chunk-UAQOQ7IE.js} +2 -2
  166. package/dist/cli-bundle/chunks/{chunk-D3WUNETC.js → chunk-UEWA73ZZ.js} +5 -5
  167. package/dist/cli-bundle/chunks/{chunk-O5IBJE6S.js → chunk-UIIQC5YO.js} +2 -2
  168. package/dist/cli-bundle/chunks/{chunk-SRVKTWPR.js → chunk-UJUT6AHZ.js} +314 -39
  169. package/dist/cli-bundle/chunks/chunk-UJUT6AHZ.js.map +7 -0
  170. package/dist/cli-bundle/chunks/{chunk-SSFMJCPF.js → chunk-UT6WFXW2.js} +6 -7
  171. package/dist/cli-bundle/chunks/chunk-UT6WFXW2.js.map +1 -0
  172. package/dist/cli-bundle/chunks/{chunk-KBG47ZOY.js → chunk-UYQ7HXH4.js} +10 -6
  173. package/dist/cli-bundle/chunks/chunk-UYQ7HXH4.js.map +1 -0
  174. package/dist/cli-bundle/chunks/{chunk-LDJK7SHN.js → chunk-V6EYFTRL.js} +7 -7
  175. package/dist/cli-bundle/chunks/{chunk-5IRA6IYD.js → chunk-WAA7UI6M.js} +58 -30
  176. package/dist/cli-bundle/chunks/chunk-WAA7UI6M.js.map +7 -0
  177. package/dist/cli-bundle/chunks/{chunk-HPH6X4ZZ.js → chunk-WCQZBDDH.js} +10 -6
  178. package/dist/cli-bundle/chunks/{chunk-HPH6X4ZZ.js.map → chunk-WCQZBDDH.js.map} +2 -2
  179. package/dist/cli-bundle/chunks/chunk-WR5567FH.js +1582 -0
  180. package/dist/cli-bundle/chunks/chunk-WR5567FH.js.map +7 -0
  181. package/dist/cli-bundle/chunks/{chunk-TQ3ZK6VD.js → chunk-WYEXLDDY.js} +3 -3
  182. package/dist/cli-bundle/chunks/{chunk-4LTBNUYT.js → chunk-X4IZKYHP.js} +307 -32
  183. package/dist/cli-bundle/chunks/chunk-X4IZKYHP.js.map +1 -0
  184. package/dist/cli-bundle/chunks/{chunk-KCMIYKTA.js → chunk-X7UHMKPE.js} +3 -3
  185. package/dist/cli-bundle/chunks/{chunk-7K24QB23.js → chunk-XS3O2TFJ.js} +27 -8
  186. package/dist/cli-bundle/chunks/chunk-XS3O2TFJ.js.map +1 -0
  187. package/dist/cli-bundle/chunks/{chunk-EHXPIKKP.js → chunk-XYNT7UFP.js} +303 -207
  188. package/dist/cli-bundle/chunks/chunk-XYNT7UFP.js.map +1 -0
  189. package/dist/cli-bundle/chunks/{chunk-CWT53EYT.js → chunk-YBZW2QQ7.js} +6 -6
  190. package/dist/cli-bundle/chunks/{chunk-VGO2T3TY.js → chunk-YO3THIJF.js} +7 -7
  191. package/dist/cli-bundle/chunks/{chunk-5KB4X7YY.js → chunk-YPH4ESA2.js} +66 -17
  192. package/dist/cli-bundle/chunks/chunk-YPH4ESA2.js.map +1 -0
  193. package/dist/cli-bundle/chunks/{claim-ZFA7HKU4.js → claim-BJ4QMPJC.js} +10 -10
  194. package/dist/cli-bundle/chunks/{claim-AZLP7YFO.js → claim-KW743OSW.js} +10 -10
  195. package/dist/cli-bundle/chunks/close-P4ZBKODL.js +13 -0
  196. package/dist/cli-bundle/chunks/{close-65DFYAVS.js → close-SYHSRZDC.js} +8 -8
  197. package/dist/cli-bundle/chunks/{close-many-UKZSQGM7.js → close-many-DBLEYFOY.js} +29 -26
  198. package/dist/cli-bundle/chunks/close-many-DBLEYFOY.js.map +7 -0
  199. package/dist/cli-bundle/chunks/{close-many-AKPZNSGI.js → close-many-LAC5VR4G.js} +30 -27
  200. package/dist/cli-bundle/chunks/close-many-LAC5VR4G.js.map +1 -0
  201. package/dist/cli-bundle/chunks/{comments-AGBNSJJH.js → comments-JEO6HHVM.js} +10 -10
  202. package/dist/cli-bundle/chunks/{comments-CJWXQI7X.js → comments-YT2PQ5DD.js} +10 -10
  203. package/dist/cli-bundle/chunks/{config-DDPYIA6J.js → config-RZRVS3ZV.js} +127 -11
  204. package/dist/cli-bundle/chunks/config-RZRVS3ZV.js.map +1 -0
  205. package/dist/cli-bundle/chunks/{config-5ON3ADRH.js → config-YJSAAADD.js} +128 -12
  206. package/dist/cli-bundle/chunks/config-YJSAAADD.js.map +7 -0
  207. package/dist/cli-bundle/chunks/{context-E6U3DWVM.js → context-LGYEEKAW.js} +14 -14
  208. package/dist/cli-bundle/chunks/{context-E6U3DWVM.js.map → context-LGYEEKAW.js.map} +2 -2
  209. package/dist/cli-bundle/chunks/{context-ZOJEN5VT.js → context-ZUH5IOOI.js} +15 -15
  210. package/dist/cli-bundle/chunks/context-ZUH5IOOI.js.map +1 -0
  211. package/dist/cli-bundle/chunks/{contracts-CXSFM45B.js → contracts-YXJ6NXKH.js} +11 -5
  212. package/dist/cli-bundle/chunks/contracts-YXJ6NXKH.js.map +7 -0
  213. package/dist/cli-bundle/chunks/{contracts-LCSX5R53.js → contracts-ZIBXROPE.js} +12 -6
  214. package/dist/cli-bundle/chunks/contracts-ZIBXROPE.js.map +1 -0
  215. package/dist/cli-bundle/chunks/copy-BZALX5MQ.js +182 -0
  216. package/dist/cli-bundle/chunks/copy-BZALX5MQ.js.map +1 -0
  217. package/dist/cli-bundle/chunks/copy-YPWEIAPD.js +185 -0
  218. package/dist/cli-bundle/chunks/copy-YPWEIAPD.js.map +7 -0
  219. package/dist/cli-bundle/chunks/create-4DS2QWQC.js +27 -0
  220. package/dist/cli-bundle/chunks/{create-WYFKN2U4.js → create-CF7EVRX7.js} +13 -13
  221. package/dist/cli-bundle/chunks/{delete-ZXWC56WO.js → delete-KR4VBWVE.js} +7 -7
  222. package/dist/cli-bundle/chunks/{delete-RONNH4F4.js → delete-XLZRTRKR.js} +7 -7
  223. package/dist/cli-bundle/chunks/{deps-WII3O4HB.js → deps-2YTXD3VM.js} +7 -7
  224. package/dist/cli-bundle/chunks/{deps-EHXIFOZR.js → deps-GZMFMTGS.js} +7 -7
  225. package/dist/cli-bundle/chunks/{docs-PDREIMLS.js → docs-SLROFEQ4.js} +9 -9
  226. package/dist/cli-bundle/chunks/{docs-JMVCFNHH.js → docs-ZHISRR2D.js} +9 -9
  227. package/dist/cli-bundle/chunks/{extension-G6UXSM5S.js → extension-3C7OOI4F.js} +8 -6
  228. package/dist/cli-bundle/chunks/{extension-B4ROVWJD.js → extension-XYCUXICD.js} +8 -6
  229. package/dist/cli-bundle/chunks/{files-2PN7UM2D.js → files-FUWF2FYJ.js} +9 -9
  230. package/dist/cli-bundle/chunks/{files-MXYS5W4M.js → files-J4I5IU4O.js} +9 -9
  231. package/dist/cli-bundle/chunks/gc-34NXSNSN.js +362 -0
  232. package/dist/cli-bundle/chunks/gc-34NXSNSN.js.map +1 -0
  233. package/dist/cli-bundle/chunks/gc-SPIIZX3A.js +372 -0
  234. package/dist/cli-bundle/chunks/gc-SPIIZX3A.js.map +7 -0
  235. package/dist/cli-bundle/chunks/{get-WXMLRG7M.js → get-SZKNRHMA.js} +34 -12
  236. package/dist/cli-bundle/chunks/get-SZKNRHMA.js.map +1 -0
  237. package/dist/cli-bundle/chunks/{get-CINFEUIY.js → get-VITKYP6S.js} +33 -11
  238. package/dist/cli-bundle/chunks/get-VITKYP6S.js.map +7 -0
  239. package/dist/cli-bundle/chunks/{health-IT5DBPRJ.js → health-4SNTA2TF.js} +27 -13
  240. package/dist/cli-bundle/chunks/health-4SNTA2TF.js.map +7 -0
  241. package/dist/cli-bundle/chunks/{health-5VPOJQ53.js → health-7G3EPM57.js} +28 -14
  242. package/dist/cli-bundle/chunks/health-7G3EPM57.js.map +1 -0
  243. package/dist/cli-bundle/chunks/{history-FLZIP7PM.js → history-SDAWYZR3.js} +10 -10
  244. package/dist/cli-bundle/chunks/history-YDUEILKP.js +20 -0
  245. package/dist/cli-bundle/chunks/history-compact-DMW536VH.js +287 -0
  246. package/dist/cli-bundle/chunks/history-compact-DMW536VH.js.map +1 -0
  247. package/dist/cli-bundle/chunks/history-compact-POTZGG7K.js +290 -0
  248. package/dist/cli-bundle/chunks/history-compact-POTZGG7K.js.map +7 -0
  249. package/dist/cli-bundle/chunks/{history-redact-SSZBAD76.js → history-redact-EPJ7GENL.js} +11 -11
  250. package/dist/cli-bundle/chunks/history-redact-KASLLPE7.js +19 -0
  251. package/dist/cli-bundle/chunks/{history-repair-X7CO5JJZ.js → history-repair-IJ7LLBET.js} +11 -11
  252. package/dist/cli-bundle/chunks/{history-repair-KC5ZOJRZ.js → history-repair-YNESJRT6.js} +11 -11
  253. package/dist/cli-bundle/chunks/init-IGSS4GNH.js +17 -0
  254. package/dist/cli-bundle/chunks/{init-6MRFVOLH.js → init-YHVBTEET.js} +9 -8
  255. package/dist/cli-bundle/chunks/{learnings-DCX55BNX.js → learnings-4YBMIVCZ.js} +10 -10
  256. package/dist/cli-bundle/chunks/{learnings-A3CLB5CO.js → learnings-T4PF24YN.js} +10 -10
  257. package/dist/cli-bundle/chunks/{list-DBRECOG4.js → list-3KEVBOYW.js} +10 -10
  258. package/dist/cli-bundle/chunks/list-E44O2K64.js +20 -0
  259. package/dist/cli-bundle/chunks/{notes-42LIC3UE.js → notes-FLUCNJSH.js} +10 -10
  260. package/dist/cli-bundle/chunks/{notes-P5O3VMQ3.js → notes-GJKALVZM.js} +10 -10
  261. package/dist/cli-bundle/chunks/{plan-HDQXEUKD.js → plan-T5MMZLI3.js} +13 -13
  262. package/dist/cli-bundle/chunks/{plan-IGTE3WOJ.js → plan-YYMIL3HV.js} +13 -13
  263. package/dist/cli-bundle/chunks/{register-list-query-EMNSIUO4.js → register-list-query-I65EZ3HB.js} +33 -27
  264. package/dist/cli-bundle/chunks/register-list-query-I65EZ3HB.js.map +1 -0
  265. package/dist/cli-bundle/chunks/{register-list-query-AG3XKXWL.js → register-list-query-OECMHO4G.js} +32 -26
  266. package/dist/cli-bundle/chunks/register-list-query-OECMHO4G.js.map +7 -0
  267. package/dist/cli-bundle/chunks/{register-mutation-M3YS6XDO.js → register-mutation-2FLXORLR.js} +65 -47
  268. package/dist/cli-bundle/chunks/register-mutation-2FLXORLR.js.map +1 -0
  269. package/dist/cli-bundle/chunks/{register-mutation-RSMT6DPK.js → register-mutation-5GPDEKHR.js} +64 -46
  270. package/dist/cli-bundle/chunks/register-mutation-5GPDEKHR.js.map +7 -0
  271. package/dist/cli-bundle/chunks/{register-operations-KYUOOOOD.js → register-operations-BNGAUMGK.js} +71 -35
  272. package/dist/cli-bundle/chunks/register-operations-BNGAUMGK.js.map +1 -0
  273. package/dist/cli-bundle/chunks/{register-operations-Q54JQZUN.js → register-operations-GQKT35H5.js} +70 -34
  274. package/dist/cli-bundle/chunks/register-operations-GQKT35H5.js.map +7 -0
  275. package/dist/cli-bundle/chunks/{register-setup-DI6P7X75.js → register-setup-DNDCGZ4O.js} +18 -18
  276. package/dist/cli-bundle/chunks/{register-setup-DI6P7X75.js.map → register-setup-DNDCGZ4O.js.map} +1 -1
  277. package/dist/cli-bundle/chunks/{register-setup-YJKIQRKA.js → register-setup-EJY44FPH.js} +17 -17
  278. package/dist/cli-bundle/chunks/{register-setup-YJKIQRKA.js.map → register-setup-EJY44FPH.js.map} +2 -2
  279. package/dist/cli-bundle/chunks/{restore-2XVTBLKQ.js → restore-DDJGVZIN.js} +11 -11
  280. package/dist/cli-bundle/chunks/restore-SJSASGZP.js +17 -0
  281. package/dist/cli-bundle/chunks/{schema-V6BX65Q2.js → schema-B7NQ6XVP.js} +8 -8
  282. package/dist/cli-bundle/chunks/{schema-LVXZWFGY.js → schema-HEGYH6CE.js} +8 -8
  283. package/dist/cli-bundle/chunks/{search-C7NPB7G7.js → search-DVVQ4UO2.js} +421 -42
  284. package/dist/cli-bundle/chunks/search-DVVQ4UO2.js.map +1 -0
  285. package/dist/cli-bundle/chunks/{search-5A3BMFA7.js → search-JNEZJV7H.js} +427 -41
  286. package/dist/cli-bundle/chunks/search-JNEZJV7H.js.map +7 -0
  287. package/dist/cli-bundle/chunks/stats-7JDIJRDH.js +202 -0
  288. package/dist/cli-bundle/chunks/stats-7JDIJRDH.js.map +1 -0
  289. package/dist/cli-bundle/chunks/stats-SYTJRR4Z.js +212 -0
  290. package/dist/cli-bundle/chunks/stats-SYTJRR4Z.js.map +7 -0
  291. package/dist/cli-bundle/chunks/telemetry-4HHWD5Y7.js +251 -0
  292. package/dist/cli-bundle/chunks/telemetry-4HHWD5Y7.js.map +7 -0
  293. package/dist/cli-bundle/chunks/telemetry-EGWP7ZUX.js +248 -0
  294. package/dist/cli-bundle/chunks/telemetry-EGWP7ZUX.js.map +1 -0
  295. package/dist/cli-bundle/chunks/{test-OFYONO3C.js → test-IIELLSZX.js} +14 -13
  296. package/dist/cli-bundle/chunks/test-ML5RLWXE.js +32 -0
  297. package/dist/cli-bundle/chunks/{test-all-EEMKNTGU.js → test-all-7DNCMML7.js} +14 -13
  298. package/dist/cli-bundle/chunks/{test-all-EEMKNTGU.js.map → test-all-7DNCMML7.js.map} +1 -1
  299. package/dist/cli-bundle/chunks/{test-all-OJE6CIO7.js → test-all-IHTUJRRC.js} +16 -15
  300. package/dist/cli-bundle/chunks/{test-all-OJE6CIO7.js.map → test-all-IHTUJRRC.js.map} +1 -1
  301. package/dist/cli-bundle/chunks/{test-runs-IPOPFOAF.js → test-runs-5FEMBV3A.js} +5 -5
  302. package/dist/cli-bundle/chunks/{test-runs-L2M7WKH7.js → test-runs-RNKZ37PS.js} +5 -5
  303. package/dist/cli-bundle/chunks/update-6C67X4KS.js +21 -0
  304. package/dist/cli-bundle/chunks/update-VF26YPT3.js +25 -0
  305. package/dist/cli-bundle/chunks/{update-many-322CCH2L.js → update-many-BSZZZYXY.js} +22 -22
  306. package/dist/cli-bundle/chunks/{update-many-DYWGW57M.js → update-many-BWKJJEBF.js} +22 -22
  307. package/dist/cli-bundle/chunks/{upgrade-3W3RVSNM.js → upgrade-RSE5PC44.js} +7 -6
  308. package/dist/cli-bundle/chunks/{upgrade-3W3RVSNM.js.map → upgrade-RSE5PC44.js.map} +1 -1
  309. package/dist/cli-bundle/chunks/{upgrade-2U727SAM.js → upgrade-YWI5DJFA.js} +5 -4
  310. package/dist/cli-bundle/chunks/{upgrade-2U727SAM.js.map → upgrade-YWI5DJFA.js.map} +1 -1
  311. package/dist/cli-bundle/chunks/{validate-ZFVWPEEN.js → validate-NK3WKB7C.js} +18 -17
  312. package/dist/cli-bundle/chunks/{validate-ZFVWPEEN.js.map → validate-NK3WKB7C.js.map} +1 -1
  313. package/dist/cli-bundle/chunks/{validate-GZ24NYHO.js → validate-UCEOB7S6.js} +20 -19
  314. package/dist/cli-bundle/chunks/{validate-GZ24NYHO.js.map → validate-UCEOB7S6.js.map} +1 -1
  315. package/dist/cli-bundle/main.js +198 -1523
  316. package/dist/cli-bundle/main.js.map +4 -4
  317. package/dist/core/config/nested-settings.d.ts +8 -6
  318. package/dist/core/config/nested-settings.js +71 -5
  319. package/dist/core/config/nested-settings.js.map +1 -1
  320. package/dist/core/config/positional-value.js +4 -2
  321. package/dist/core/config/positional-value.js.map +1 -1
  322. package/dist/core/extensions/extension-types.d.ts +36 -0
  323. package/dist/core/extensions/extension-types.js +2 -2
  324. package/dist/core/extensions/extension-types.js.map +1 -1
  325. package/dist/core/extensions/loader.js +46 -5
  326. package/dist/core/extensions/loader.js.map +1 -1
  327. package/dist/core/history/drift-scan.d.ts +3 -4
  328. package/dist/core/history/drift-scan.js +71 -18
  329. package/dist/core/history/drift-scan.js.map +1 -1
  330. package/dist/core/history/history-diff.d.ts +47 -0
  331. package/dist/core/history/history-diff.js +152 -0
  332. package/dist/core/history/history-diff.js.map +1 -0
  333. package/dist/core/history/history-storage-stats.d.ts +31 -0
  334. package/dist/core/history/history-storage-stats.js +101 -0
  335. package/dist/core/history/history-storage-stats.js.map +1 -0
  336. package/dist/core/item/id.js +4 -5
  337. package/dist/core/item/id.js.map +1 -1
  338. package/dist/core/item/item-format.js +7 -3
  339. package/dist/core/item/item-format.js.map +1 -1
  340. package/dist/core/item/toon-decode.d.ts +7 -0
  341. package/dist/core/item/toon-decode.js +11 -2
  342. package/dist/core/item/toon-decode.js.map +1 -1
  343. package/dist/core/item/type-registry.js +25 -7
  344. package/dist/core/item/type-registry.js.map +1 -1
  345. package/dist/core/lock/lock-gc.d.ts +46 -0
  346. package/dist/core/lock/lock-gc.js +194 -0
  347. package/dist/core/lock/lock-gc.js.map +1 -0
  348. package/dist/core/search/cache.js +5 -3
  349. package/dist/core/search/cache.js.map +1 -1
  350. package/dist/core/search/corpus.d.ts +6 -0
  351. package/dist/core/search/corpus.js +22 -9
  352. package/dist/core/search/corpus.js.map +1 -1
  353. package/dist/core/search/embedding-batches.js +10 -7
  354. package/dist/core/search/embedding-batches.js.map +1 -1
  355. package/dist/core/search/relevance.d.ts +29 -0
  356. package/dist/core/search/relevance.js +226 -0
  357. package/dist/core/search/relevance.js.map +1 -0
  358. package/dist/core/search/vector-stores.d.ts +3 -0
  359. package/dist/core/search/vector-stores.js +23 -10
  360. package/dist/core/search/vector-stores.js.map +1 -1
  361. package/dist/core/shared/constants.js +15 -2
  362. package/dist/core/shared/constants.js.map +1 -1
  363. package/dist/core/shared/errors.d.ts +6 -0
  364. package/dist/core/shared/errors.js +2 -2
  365. package/dist/core/shared/errors.js.map +1 -1
  366. package/dist/core/shared/primitives.d.ts +8 -0
  367. package/dist/core/shared/primitives.js +29 -2
  368. package/dist/core/shared/primitives.js.map +1 -1
  369. package/dist/core/shared/serial-queue.d.ts +12 -0
  370. package/dist/core/shared/serial-queue.js +43 -0
  371. package/dist/core/shared/serial-queue.js.map +1 -0
  372. package/dist/core/shared/time.js +42 -6
  373. package/dist/core/shared/time.js.map +1 -1
  374. package/dist/core/store/paths.js +25 -7
  375. package/dist/core/store/paths.js.map +1 -1
  376. package/dist/core/store/settings-validator.d.ts +11 -0
  377. package/dist/core/store/settings-validator.js +14 -2
  378. package/dist/core/store/settings-validator.js.map +1 -1
  379. package/dist/core/store/settings.d.ts +19 -1
  380. package/dist/core/store/settings.js +199 -17
  381. package/dist/core/store/settings.js.map +1 -1
  382. package/dist/core/telemetry/observability.js +3 -3
  383. package/dist/core/telemetry/observability.js.map +1 -1
  384. package/dist/core/telemetry/runtime.js +99 -6
  385. package/dist/core/telemetry/runtime.js.map +1 -1
  386. package/dist/mcp/server.d.ts +1 -0
  387. package/dist/mcp/server.js +187 -42
  388. package/dist/mcp/server.js.map +1 -1
  389. package/dist/sdk/cli-contracts/commander-types.d.ts +1 -0
  390. package/dist/sdk/cli-contracts/commander-types.js +13 -2
  391. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  392. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  393. package/dist/sdk/cli-contracts/enum-contracts.js +8 -2
  394. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  395. package/dist/sdk/cli-contracts/tool-option-contracts.js +7 -2
  396. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  397. package/dist/sdk/cli-contracts/tool-parameter-tables.js +39 -7
  398. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  399. package/dist/sdk/cli-contracts.d.ts +26 -1
  400. package/dist/sdk/cli-contracts.js +75 -11
  401. package/dist/sdk/cli-contracts.js.map +1 -1
  402. package/dist/sdk/index.d.ts +2 -2
  403. package/dist/sdk/index.js +3 -3
  404. package/dist/sdk/index.js.map +1 -1
  405. package/dist/sdk/testing.d.ts +51 -1
  406. package/dist/sdk/testing.js +93 -2
  407. package/dist/sdk/testing.js.map +1 -1
  408. package/dist/types.d.ts +14 -0
  409. package/dist/types.js +2 -2
  410. package/dist/types.js.map +1 -1
  411. package/docs/AGENT_GUIDE.md +1 -1
  412. package/docs/ARCHITECTURE.md +11 -1
  413. package/docs/CLAUDE_CODE_PLUGIN.md +4 -4
  414. package/docs/CODEX_PLUGIN.md +1 -1
  415. package/docs/COMMANDS.md +42 -4
  416. package/docs/CONFIGURATION.md +31 -2
  417. package/docs/EXTENSIONS.md +28 -8
  418. package/docs/EXTENSION_AUTHOR_CONTRACTS.md +73 -0
  419. package/docs/ONBOARDING.md +165 -0
  420. package/docs/QUICKSTART.md +2 -2
  421. package/docs/README.md +12 -4
  422. package/docs/RELEASING.md +36 -1
  423. package/docs/SDK.md +66 -0
  424. package/docs/TESTING.md +33 -1
  425. package/package.json +6 -2
  426. package/packages/pm-governance-audit/README.md +14 -0
  427. package/packages/pm-governance-audit/extensions/governance-audit/index.js +39 -1
  428. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +40 -2
  429. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +1 -1
  430. package/packages/pm-governance-audit/package.json +4 -2
  431. package/packages/pm-lifecycle-hooks/README.md +21 -0
  432. package/packages/pm-search-advanced/README.md +38 -0
  433. package/packages/pm-search-advanced/extensions/search-advanced/index.js +17 -0
  434. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +17 -0
  435. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +216 -1
  436. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +271 -2
  437. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  438. package/plugins/pm-claude/README.md +11 -8
  439. package/plugins/pm-claude/agents/pm-coordinator.md +1 -1
  440. package/plugins/pm-claude/commands/pm-init.md +1 -1
  441. package/plugins/pm-codex/README.md +1 -1
  442. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js +0 -16
  443. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js.map +0 -1
  444. package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js.map +0 -7
  445. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js.map +0 -1
  446. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js.map +0 -7
  447. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js.map +0 -1
  448. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js.map +0 -7
  449. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js.map +0 -1
  450. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js.map +0 -1
  451. package/dist/cli-bundle/chunks/chunk-7K24QB23.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js.map +0 -7
  453. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js.map +0 -1
  455. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js.map +0 -1
  456. package/dist/cli-bundle/chunks/chunk-KA24HME7.js.map +0 -7
  457. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js.map +0 -1
  458. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js.map +0 -7
  459. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js.map +0 -1
  460. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js.map +0 -7
  461. package/dist/cli-bundle/chunks/chunk-RANZIID5.js.map +0 -7
  462. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js.map +0 -7
  463. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js.map +0 -1
  464. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js.map +0 -1
  465. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js.map +0 -7
  466. package/dist/cli-bundle/chunks/chunk-TK633IVD.js.map +0 -7
  467. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js.map +0 -1
  468. package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js.map +0 -7
  469. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js.map +0 -7
  470. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js +0 -13
  471. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js.map +0 -1
  472. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js.map +0 -7
  473. package/dist/cli-bundle/chunks/config-5ON3ADRH.js.map +0 -7
  474. package/dist/cli-bundle/chunks/config-DDPYIA6J.js.map +0 -1
  475. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js.map +0 -1
  476. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js.map +0 -7
  477. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js.map +0 -1
  478. package/dist/cli-bundle/chunks/create-ATONSAZW.js +0 -27
  479. package/dist/cli-bundle/chunks/gc-GT552UJH.js +0 -178
  480. package/dist/cli-bundle/chunks/gc-GT552UJH.js.map +0 -1
  481. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js +0 -181
  482. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js.map +0 -7
  483. package/dist/cli-bundle/chunks/get-CINFEUIY.js.map +0 -7
  484. package/dist/cli-bundle/chunks/get-WXMLRG7M.js.map +0 -1
  485. package/dist/cli-bundle/chunks/health-5VPOJQ53.js.map +0 -1
  486. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js.map +0 -7
  487. package/dist/cli-bundle/chunks/history-6FC4H6HI.js +0 -20
  488. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js +0 -19
  489. package/dist/cli-bundle/chunks/init-KHX3FEEM.js +0 -16
  490. package/dist/cli-bundle/chunks/list-53LZ2AEO.js +0 -20
  491. package/dist/cli-bundle/chunks/register-list-query-AG3XKXWL.js.map +0 -7
  492. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js.map +0 -1
  493. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js.map +0 -1
  494. package/dist/cli-bundle/chunks/register-mutation-RSMT6DPK.js.map +0 -7
  495. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js.map +0 -1
  496. package/dist/cli-bundle/chunks/register-operations-Q54JQZUN.js.map +0 -7
  497. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js +0 -17
  498. package/dist/cli-bundle/chunks/search-5A3BMFA7.js.map +0 -7
  499. package/dist/cli-bundle/chunks/search-C7NPB7G7.js.map +0 -1
  500. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js +0 -120
  501. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js.map +0 -1
  502. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js +0 -123
  503. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js.map +0 -7
  504. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js +0 -31
  505. package/dist/cli-bundle/chunks/update-6YEHPVXH.js +0 -25
  506. package/dist/cli-bundle/chunks/update-PYLVHMRD.js +0 -21
  507. /package/dist/cli-bundle/chunks/{activity-P5BUMWP3.js.map → activity-5UROHJ3D.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{activity-3RWRRNOW.js.map → activity-YVB3QRTE.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{append-PNN6UIBZ.js.map → append-2PPYFAG5.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{append-5JE3YGXU.js.map → append-AUGT5W6J.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{chunk-26KTVXJW.js.map → chunk-2IF7WLB7.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{chunk-XX5LRINW.js.map → chunk-2OJHLWBZ.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{chunk-ASQM3IF5.js.map → chunk-3A2CMEM7.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{chunk-S3CV7JGJ.js.map → chunk-3EOBJOF4.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{chunk-B3N4TKNL.js.map → chunk-5AXMRKN5.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{chunk-JQI2HE55.js.map → chunk-6J4K6JLA.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{chunk-BNL6S7QH.js.map → chunk-AVJD6VTA.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{chunk-RQAWLSUU.js.map → chunk-B5RF3IP7.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{chunk-UFCG3SWR.js.map → chunk-C5W2UH56.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{chunk-3OH4DAEB.js.map → chunk-CKLBZHS7.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{chunk-GFWHHMVV.js.map → chunk-FY6Z3FYY.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{chunk-CCUFLH4J.js.map → chunk-GNIUOLZ2.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{chunk-ZRVSMOMR.js.map → chunk-GPXQBR3H.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{chunk-GPGAYASV.js.map → chunk-H7EO3QA3.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{chunk-MISYRLEP.js.map → chunk-HLC3KTLP.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{chunk-KK6YPGH3.js.map → chunk-HMMMWBK2.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{chunk-CJDQB2ED.js.map → chunk-HV5SSZXF.js.map} +0 -0
  528. /package/dist/cli-bundle/chunks/{chunk-FVXM3GKS.js.map → chunk-KNGVP5WJ.js.map} +0 -0
  529. /package/dist/cli-bundle/chunks/{chunk-UOVLWB47.js.map → chunk-LI65XLJR.js.map} +0 -0
  530. /package/dist/cli-bundle/chunks/{chunk-AXXKLVTW.js.map → chunk-LIN2BPJ7.js.map} +0 -0
  531. /package/dist/cli-bundle/chunks/{chunk-Y2AKE2HS.js.map → chunk-LQHBENVW.js.map} +0 -0
  532. /package/dist/cli-bundle/chunks/{chunk-D5X7N6FI.js.map → chunk-LXO6V66E.js.map} +0 -0
  533. /package/dist/cli-bundle/chunks/{chunk-DFIZGAI5.js.map → chunk-MOYM2C3J.js.map} +0 -0
  534. /package/dist/cli-bundle/chunks/{chunk-OUF3ARDX.js.map → chunk-NQL32HQ5.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{chunk-GCAVRLGE.js.map → chunk-OKSKJKHX.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{chunk-A6PEXMYN.js.map → chunk-R3V3YCMH.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{chunk-T2ORWB6D.js.map → chunk-RVPTZKBC.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{chunk-K47WAYQV.js.map → chunk-SFFVGNHC.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{chunk-DFUSXJDE.js.map → chunk-SQPKRA54.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{chunk-JB4RGL4V.js.map → chunk-TNPBPNII.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-XG7RJYHV.js.map → chunk-TP4DDY27.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-ORTLYVA4.js.map → chunk-TYJJOTUA.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-HZOS2UG5.js.map → chunk-UAQOQ7IE.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-D3WUNETC.js.map → chunk-UEWA73ZZ.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-O5IBJE6S.js.map → chunk-UIIQC5YO.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-LDJK7SHN.js.map → chunk-V6EYFTRL.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-TQ3ZK6VD.js.map → chunk-WYEXLDDY.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-KCMIYKTA.js.map → chunk-X7UHMKPE.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-CWT53EYT.js.map → chunk-YBZW2QQ7.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-VGO2T3TY.js.map → chunk-YO3THIJF.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{claim-ZFA7HKU4.js.map → claim-BJ4QMPJC.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{claim-AZLP7YFO.js.map → claim-KW743OSW.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{close-RMHQ3KWH.js.map → close-P4ZBKODL.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{close-65DFYAVS.js.map → close-SYHSRZDC.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{comments-AGBNSJJH.js.map → comments-JEO6HHVM.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{comments-CJWXQI7X.js.map → comments-YT2PQ5DD.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{create-ATONSAZW.js.map → create-4DS2QWQC.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{create-WYFKN2U4.js.map → create-CF7EVRX7.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{delete-ZXWC56WO.js.map → delete-KR4VBWVE.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{delete-RONNH4F4.js.map → delete-XLZRTRKR.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{deps-WII3O4HB.js.map → deps-2YTXD3VM.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{deps-EHXIFOZR.js.map → deps-GZMFMTGS.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{docs-PDREIMLS.js.map → docs-SLROFEQ4.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{docs-JMVCFNHH.js.map → docs-ZHISRR2D.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{extension-G6UXSM5S.js.map → extension-3C7OOI4F.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{extension-B4ROVWJD.js.map → extension-XYCUXICD.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{files-2PN7UM2D.js.map → files-FUWF2FYJ.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{files-MXYS5W4M.js.map → files-J4I5IU4O.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{history-FLZIP7PM.js.map → history-SDAWYZR3.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{history-6FC4H6HI.js.map → history-YDUEILKP.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{history-redact-SSZBAD76.js.map → history-redact-EPJ7GENL.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{history-redact-XKYEZDBL.js.map → history-redact-KASLLPE7.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{history-repair-X7CO5JJZ.js.map → history-repair-IJ7LLBET.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{history-repair-KC5ZOJRZ.js.map → history-repair-YNESJRT6.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{init-KHX3FEEM.js.map → init-IGSS4GNH.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{init-6MRFVOLH.js.map → init-YHVBTEET.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{learnings-DCX55BNX.js.map → learnings-4YBMIVCZ.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{learnings-A3CLB5CO.js.map → learnings-T4PF24YN.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{list-DBRECOG4.js.map → list-3KEVBOYW.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{list-53LZ2AEO.js.map → list-E44O2K64.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{notes-42LIC3UE.js.map → notes-FLUCNJSH.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{notes-P5O3VMQ3.js.map → notes-GJKALVZM.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{plan-HDQXEUKD.js.map → plan-T5MMZLI3.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{plan-IGTE3WOJ.js.map → plan-YYMIL3HV.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{restore-2XVTBLKQ.js.map → restore-DDJGVZIN.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{restore-JL5QIH7H.js.map → restore-SJSASGZP.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{schema-V6BX65Q2.js.map → schema-B7NQ6XVP.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{schema-LVXZWFGY.js.map → schema-HEGYH6CE.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{test-OFYONO3C.js.map → test-IIELLSZX.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{test-RJ4ZF35X.js.map → test-ML5RLWXE.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{test-runs-IPOPFOAF.js.map → test-runs-5FEMBV3A.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{test-runs-L2M7WKH7.js.map → test-runs-RNKZ37PS.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{update-PYLVHMRD.js.map → update-6C67X4KS.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{update-6YEHPVXH.js.map → update-VF26YPT3.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{update-many-322CCH2L.js.map → update-many-BSZZZYXY.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{update-many-DYWGW57M.js.map → update-many-BWKJJEBF.js.map} +0 -0
@@ -1,10 +1,11 @@
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]="565baafc-ab35-53fa-93fa-6f3faa4d779c")}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]="02809425-3f94-5445-91ea-bdc968f9f64b")}catch(e){}}();
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { getActiveExtensionRegistrations, runActiveOnReadHooks } from "../../core/extensions/index.js";
6
6
  import { pathExists } from "../../core/fs/fs-utils.js";
7
7
  import { enforceHistoryStreamPolicyForItems } from "../../core/history/history-stream-policy.js";
8
+ import { computeHistoryStorageStats } from "../../core/history/history-storage-stats.js";
8
9
  import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
9
10
  import { resolveRuntimeStatusRegistry } from "../../core/schema/runtime-schema.js";
10
11
  import { EXIT_CODE } from "../../core/shared/constants.js";
@@ -34,13 +35,10 @@ function countNonEmptyLines(raw) {
34
35
  .filter((line) => line.trim().length > 0)
35
36
  .length;
36
37
  }
37
- async function readHistorySummary(pmRoot) {
38
+ async function readHistoryStreamContents(pmRoot) {
38
39
  const historyDir = path.join(pmRoot, "history");
39
40
  if (!(await pathExists(historyDir))) {
40
- return {
41
- history_streams: 0,
42
- history_entries: 0,
43
- };
41
+ return [];
44
42
  }
45
43
  await runActiveOnReadHooks({
46
44
  path: historyDir,
@@ -49,7 +47,7 @@ async function readHistorySummary(pmRoot) {
49
47
  const historyFiles = (await fs.readdir(historyDir))
50
48
  .filter((entry) => entry.endsWith(".jsonl"))
51
49
  .sort((a, b) => a.localeCompare(b));
52
- let historyEntries = 0;
50
+ const streams = [];
53
51
  for (const file of historyFiles) {
54
52
  const historyPath = path.join(historyDir, file);
55
53
  const raw = await fs.readFile(historyPath, "utf8");
@@ -57,14 +55,11 @@ async function readHistorySummary(pmRoot) {
57
55
  path: historyPath,
58
56
  scope: "project",
59
57
  });
60
- historyEntries += countNonEmptyLines(raw);
58
+ streams.push({ id: file.slice(0, -".jsonl".length), raw });
61
59
  }
62
- return {
63
- history_streams: historyFiles.length,
64
- history_entries: historyEntries,
65
- };
60
+ return streams;
66
61
  }
67
- export async function runStats(global) {
62
+ export async function runStats(global, options = {}) {
68
63
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
69
64
  if (!(await pathExists(getSettingsPath(pmRoot)))) {
70
65
  throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
@@ -91,17 +86,23 @@ export async function runStats(global) {
91
86
  }
92
87
  byStatus[item.status] += 1;
93
88
  }
94
- const historySummary = await readHistorySummary(pmRoot);
89
+ const streams = await readHistoryStreamContents(pmRoot);
90
+ let historyEntries = 0;
91
+ for (const stream of streams) {
92
+ historyEntries += countNonEmptyLines(stream.raw);
93
+ }
94
+ const storage = options.storage ? computeHistoryStorageStats(streams) : undefined;
95
95
  return {
96
96
  totals: {
97
97
  items: items.length,
98
- history_streams: historySummary.history_streams,
99
- history_entries: historySummary.history_entries,
98
+ history_streams: streams.length,
99
+ history_entries: historyEntries,
100
100
  },
101
101
  by_type: byType,
102
102
  by_status: byStatus,
103
+ ...(storage ? { storage } : {}),
103
104
  generated_at: nowIso(),
104
105
  };
105
106
  }
106
107
  //# sourceMappingURL=stats.js.map
107
- //# debugId=565baafc-ab35-53fa-93fa-6f3faa4d779c
108
+ //# debugId=02809425-3f94-5445-91ea-bdc968f9f64b
@@ -1 +1 @@
1
- {"version":3,"file":"stats.js","sources":["cli/commands/stats.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getActiveExtensionRegistrations, runActiveOnReadHooks } from \"../../core/extensions/index.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { enforceHistoryStreamPolicyForItems } from \"../../core/history/history-stream-policy.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { listAllFrontMatterLight } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemStatus, ItemType } from \"../../types/index.js\";\n\nexport interface StatsResult {\n totals: {\n items: number;\n history_streams: number;\n history_entries: number;\n };\n by_type: Record<ItemType, number>;\n by_status: Record<ItemStatus, number>;\n generated_at: string;\n}\n\nfunction zeroByType(itemTypes: string[]): Record<ItemType, number> {\n return itemTypes.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemType, number>,\n );\n}\n\nfunction zeroByStatus(statuses: string[]): Record<ItemStatus, number> {\n return statuses.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemStatus, number>,\n );\n}\n\nfunction countNonEmptyLines(raw: string): number {\n if (raw.trim().length === 0) {\n return 0;\n }\n return raw\n .split(/\\r?\\n/u)\n .filter((line) => line.trim().length > 0)\n .length;\n}\n\nasync function readHistorySummary(pmRoot: string): Promise<{ history_streams: number; history_entries: number }> {\n const historyDir = path.join(pmRoot, \"history\");\n if (!(await pathExists(historyDir))) {\n return {\n history_streams: 0,\n history_entries: 0,\n };\n }\n\n await runActiveOnReadHooks({\n path: historyDir,\n scope: \"project\",\n });\n const historyFiles = (await fs.readdir(historyDir))\n .filter((entry) => entry.endsWith(\".jsonl\"))\n .sort((a, b) => a.localeCompare(b));\n\n let historyEntries = 0;\n for (const file of historyFiles) {\n const historyPath = path.join(historyDir, file);\n const raw = await fs.readFile(historyPath, \"utf8\");\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n historyEntries += countNonEmptyLines(raw);\n }\n\n return {\n history_streams: historyFiles.length,\n history_entries: historyEntries,\n };\n}\n\nexport async function runStats(global: GlobalOptions): Promise<StatsResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const items = await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema);\n await enforceHistoryStreamPolicyForItems({\n pmRoot,\n settings,\n itemIds: items.map((item) => item.id),\n commandLabel: \"stats\",\n });\n\n const byType = zeroByType(typeRegistry.types);\n const byStatus = zeroByStatus(statusRegistry.definitions.map((definition) => definition.id));\n for (const item of items) {\n if (byType[item.type] === undefined) {\n byType[item.type] = 0;\n }\n byType[item.type] += 1;\n if (byStatus[item.status] === undefined) {\n byStatus[item.status] = 0;\n }\n byStatus[item.status] += 1;\n }\n\n const historySummary = await readHistorySummary(pmRoot);\n\n return {\n totals: {\n items: items.length,\n history_streams: historySummary.history_streams,\n history_entries: historySummary.history_entries,\n },\n by_type: byType,\n by_status: byStatus,\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACvG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAc5D,SAAS,UAAU,CAAC,SAAmB;IACrC,OAAO,SAAS,CAAC,MAAM,CACrB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACb,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA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fs/promises\";\nimport path from \"node:path\";\nimport { getActiveExtensionRegistrations, runActiveOnReadHooks } from \"../../core/extensions/index.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { enforceHistoryStreamPolicyForItems } from \"../../core/history/history-stream-policy.js\";\nimport { computeHistoryStorageStats, type HistoryStorageStats } from \"../../core/history/history-storage-stats.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { listAllFrontMatterLight } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemStatus, ItemType } from \"../../types/index.js\";\n\nexport interface StatsCommandOptions {\n /** Include aggregate per-stream history storage metrics (sizes, depth, oldest/newest). */\n storage?: boolean;\n}\n\nexport interface StatsResult {\n totals: {\n items: number;\n history_streams: number;\n history_entries: number;\n };\n by_type: Record<ItemType, number>;\n by_status: Record<ItemStatus, number>;\n /** Present only with --storage: aggregate history-stream metrics for compaction/planning. */\n storage?: HistoryStorageStats;\n generated_at: string;\n}\n\nfunction zeroByType(itemTypes: string[]): Record<ItemType, number> {\n return itemTypes.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemType, number>,\n );\n}\n\nfunction zeroByStatus(statuses: string[]): Record<ItemStatus, number> {\n return statuses.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemStatus, number>,\n );\n}\n\nfunction countNonEmptyLines(raw: string): number {\n if (raw.trim().length === 0) {\n return 0;\n }\n return raw\n .split(/\\r?\\n/u)\n .filter((line) => line.trim().length > 0)\n .length;\n}\n\nasync function readHistoryStreamContents(pmRoot: string): Promise<Array<{ id: string; raw: string }>> {\n const historyDir = path.join(pmRoot, \"history\");\n if (!(await pathExists(historyDir))) {\n return [];\n }\n\n await runActiveOnReadHooks({\n path: historyDir,\n scope: \"project\",\n });\n const historyFiles = (await fs.readdir(historyDir))\n .filter((entry) => entry.endsWith(\".jsonl\"))\n .sort((a, b) => a.localeCompare(b));\n\n const streams: Array<{ id: string; raw: string }> = [];\n for (const file of historyFiles) {\n const historyPath = path.join(historyDir, file);\n const raw = await fs.readFile(historyPath, \"utf8\");\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n streams.push({ id: file.slice(0, -\".jsonl\".length), raw });\n }\n\n return streams;\n}\n\nexport async function runStats(global: GlobalOptions, options: StatsCommandOptions = {}): Promise<StatsResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const items = await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema);\n await enforceHistoryStreamPolicyForItems({\n pmRoot,\n settings,\n itemIds: items.map((item) => item.id),\n commandLabel: \"stats\",\n });\n\n const byType = zeroByType(typeRegistry.types);\n const byStatus = zeroByStatus(statusRegistry.definitions.map((definition) => definition.id));\n for (const item of items) {\n if (byType[item.type] === undefined) {\n byType[item.type] = 0;\n }\n byType[item.type] += 1;\n if (byStatus[item.status] === undefined) {\n byStatus[item.status] = 0;\n }\n byStatus[item.status] += 1;\n }\n\n const streams = await readHistoryStreamContents(pmRoot);\n let historyEntries = 0;\n for (const stream of streams) {\n historyEntries += countNonEmptyLines(stream.raw);\n }\n const storage = options.storage ? computeHistoryStorageStats(streams) : undefined;\n\n return {\n totals: {\n items: items.length,\n history_streams: streams.length,\n history_entries: historyEntries,\n },\n by_type: byType,\n by_status: byStatus,\n ...(storage ? { storage } : {}),\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACvG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAA4B,MAAM,6CAA6C,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAqB5D,SAAS,UAAU,CAAC,SAAmB;IACrC,OAAO,SAAS,CAAC,MAAM,CACrB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACb,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA8B,CAC/B,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,QAAkB;IACtC,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACb,GAAG,CAAC,KAAK,CAAC,GAAG,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CAAC,CAAC,EAAE,CAAC;QAC/B,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"02809425-3f94-5445-91ea-bdc968f9f64b"}
@@ -0,0 +1,8 @@
1
+ import type { GlobalOptions } from "../../core/shared/command-types.js";
2
+ export declare const TELEMETRY_SUBCOMMANDS: readonly ["status", "flush", "stats", "clear"];
3
+ export type TelemetrySubcommand = (typeof TELEMETRY_SUBCOMMANDS)[number];
4
+ export interface TelemetryCommandOptions {
5
+ subcommand?: string;
6
+ limit?: string | number;
7
+ }
8
+ export declare function runTelemetry(options: TelemetryCommandOptions, _global: GlobalOptions): Promise<Record<string, unknown>>;
@@ -0,0 +1,253 @@
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]="4d50d256-348c-5406-a377-ea98099b9ec6")}catch(e){}}();
3
+ import fs from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { pathExists, readFileIfExists } from "../../core/fs/fs-utils.js";
6
+ import { EXIT_CODE } from "../../core/shared/constants.js";
7
+ import { PmCliError } from "../../core/shared/errors.js";
8
+ import { nowIso } from "../../core/shared/time.js";
9
+ import { resolveGlobalPmRoot } from "../../core/store/paths.js";
10
+ import { readSettings, writeSettings } from "../../core/store/settings.js";
11
+ import { flushTelemetryQueueNow } from "../../core/telemetry/runtime.js";
12
+ const TELEMETRY_QUEUE_RELATIVE_PATH = path.join("runtime", "telemetry", "events.jsonl");
13
+ const TELEMETRY_STATE_RELATIVE_PATH = path.join("runtime", "telemetry", "state.json");
14
+ const TELEMETRY_RUNTIME_RELATIVE_PATH = path.join("runtime", "telemetry");
15
+ const DEFAULT_STATS_LIMIT = 20;
16
+ export const TELEMETRY_SUBCOMMANDS = ["status", "flush", "stats", "clear"];
17
+ function normalizeTelemetrySubcommand(value) {
18
+ const normalized = (value ?? "status").trim().toLowerCase();
19
+ if (TELEMETRY_SUBCOMMANDS.includes(normalized)) {
20
+ return normalized;
21
+ }
22
+ throw new PmCliError(`Unknown pm telemetry subcommand "${value ?? ""}". Allowed: ${TELEMETRY_SUBCOMMANDS.join(", ")}`, EXIT_CODE.USAGE, {
23
+ code: "unknown_subcommand",
24
+ examples: [
25
+ "pm telemetry status",
26
+ "pm telemetry flush",
27
+ "pm telemetry stats --limit 10",
28
+ "pm telemetry clear",
29
+ ],
30
+ });
31
+ }
32
+ function parseTelemetryStatsLimit(raw) {
33
+ if (raw === undefined) {
34
+ return DEFAULT_STATS_LIMIT;
35
+ }
36
+ if (typeof raw === "number") {
37
+ if (!Number.isFinite(raw) || !Number.isInteger(raw) || raw <= 0) {
38
+ throw new PmCliError("--limit must be a positive integer", EXIT_CODE.USAGE);
39
+ }
40
+ return raw;
41
+ }
42
+ const trimmed = raw.trim();
43
+ if (trimmed.length === 0 || !/^\d+$/.test(trimmed)) {
44
+ throw new PmCliError("--limit must be a positive integer", EXIT_CODE.USAGE);
45
+ }
46
+ const parsed = Number.parseInt(trimmed, 10);
47
+ if (!Number.isFinite(parsed) || parsed <= 0) {
48
+ throw new PmCliError("--limit must be a positive integer", EXIT_CODE.USAGE);
49
+ }
50
+ return parsed;
51
+ }
52
+ function parseTelemetryQueue(raw) {
53
+ if (raw === null || raw.trim().length === 0) {
54
+ return {
55
+ rows_total: 0,
56
+ valid_entries: 0,
57
+ invalid_rows: 0,
58
+ entries: [],
59
+ };
60
+ }
61
+ const entries = [];
62
+ let rowsTotal = 0;
63
+ let invalidRows = 0;
64
+ for (const line of raw.split("\n")) {
65
+ const trimmed = line.trim();
66
+ if (trimmed.length === 0) {
67
+ continue;
68
+ }
69
+ rowsTotal += 1;
70
+ try {
71
+ const parsed = JSON.parse(trimmed);
72
+ if (typeof parsed === "object" &&
73
+ parsed !== null &&
74
+ typeof parsed.attempts === "number" &&
75
+ typeof parsed.event === "object" &&
76
+ parsed.event !== null) {
77
+ entries.push(parsed);
78
+ }
79
+ else {
80
+ invalidRows += 1;
81
+ }
82
+ }
83
+ catch {
84
+ invalidRows += 1;
85
+ }
86
+ }
87
+ return {
88
+ rows_total: rowsTotal,
89
+ valid_entries: entries.length,
90
+ invalid_rows: invalidRows,
91
+ entries,
92
+ };
93
+ }
94
+ async function readTelemetryRuntimeState(statePath) {
95
+ const stateRaw = await readFileIfExists(statePath);
96
+ if (stateRaw === null || stateRaw.trim().length === 0) {
97
+ return {};
98
+ }
99
+ try {
100
+ const parsed = JSON.parse(stateRaw);
101
+ if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
102
+ return parsed;
103
+ }
104
+ }
105
+ catch {
106
+ // Ignore malformed state files; status command is observational.
107
+ }
108
+ return {};
109
+ }
110
+ async function buildTelemetryStatusSummary(globalPmRoot) {
111
+ const settings = await readSettings(globalPmRoot);
112
+ const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);
113
+ const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);
114
+ const queueRaw = await readFileIfExists(queuePath);
115
+ const queue = parseTelemetryQueue(queueRaw);
116
+ const runtimeState = await readTelemetryRuntimeState(statePath);
117
+ return {
118
+ enabled: settings.telemetry.enabled,
119
+ endpoint: settings.telemetry.endpoint,
120
+ queue_path: queuePath,
121
+ state_path: statePath,
122
+ queue_rows_total: queue.rows_total,
123
+ queue_entries: queue.valid_entries,
124
+ queue_invalid_rows: queue.invalid_rows,
125
+ queue_size_bytes: queueRaw === null ? 0 : Buffer.byteLength(queueRaw, "utf8"),
126
+ last_attempted_flush_at: runtimeState.last_attempted_flush_at ?? null,
127
+ last_successful_flush_at: runtimeState.last_successful_flush_at ?? null,
128
+ last_failed_flush_at: runtimeState.last_failed_flush_at ?? null,
129
+ last_failed_flush_error: runtimeState.last_failed_flush_error ?? null,
130
+ };
131
+ }
132
+ function buildTelemetryStatsBuckets(entries) {
133
+ const grouped = new Map();
134
+ for (const entry of entries) {
135
+ const command = typeof entry.event.command === "string" && entry.event.command.trim().length > 0
136
+ ? entry.event.command
137
+ : "<unknown>";
138
+ const eventType = typeof entry.event.event_type === "string" && entry.event.event_type.trim().length > 0
139
+ ? entry.event.event_type
140
+ : "unknown";
141
+ const eventSchemaVersion = typeof entry.event.schema_version === "number" && Number.isFinite(entry.event.schema_version)
142
+ ? Math.trunc(entry.event.schema_version)
143
+ : undefined;
144
+ const clientSchemaVersion = typeof entry.client_schema_version === "number" && Number.isFinite(entry.client_schema_version)
145
+ ? Math.trunc(entry.client_schema_version)
146
+ : undefined;
147
+ const current = grouped.get(command) ?? {
148
+ count: 0,
149
+ max_attempts: 0,
150
+ event_type_counts: {},
151
+ event_schema_versions: new Set(),
152
+ client_schema_versions: new Set(),
153
+ };
154
+ current.count += 1;
155
+ current.max_attempts = Math.max(current.max_attempts, Math.max(0, Math.trunc(entry.attempts)));
156
+ current.event_type_counts[eventType] = (current.event_type_counts[eventType] ?? 0) + 1;
157
+ if (eventSchemaVersion !== undefined) {
158
+ current.event_schema_versions.add(eventSchemaVersion);
159
+ }
160
+ if (clientSchemaVersion !== undefined) {
161
+ current.client_schema_versions.add(clientSchemaVersion);
162
+ }
163
+ grouped.set(command, current);
164
+ }
165
+ return [...grouped.entries()]
166
+ .map(([command, value]) => ({
167
+ command,
168
+ count: value.count,
169
+ event_type_counts: Object.fromEntries(Object.entries(value.event_type_counts).sort((left, right) => left[0].localeCompare(right[0]))),
170
+ max_attempts: value.max_attempts,
171
+ event_schema_versions: [...value.event_schema_versions].sort((left, right) => left - right),
172
+ client_schema_versions: [...value.client_schema_versions].sort((left, right) => left - right),
173
+ }))
174
+ .sort((left, right) => right.count - left.count || left.command.localeCompare(right.command));
175
+ }
176
+ export async function runTelemetry(options, _global) {
177
+ void _global;
178
+ const subcommand = normalizeTelemetrySubcommand(options.subcommand);
179
+ const globalPmRoot = resolveGlobalPmRoot(process.cwd());
180
+ const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);
181
+ const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);
182
+ if (subcommand === "status") {
183
+ return {
184
+ action: "telemetry",
185
+ subcommand,
186
+ status: await buildTelemetryStatusSummary(globalPmRoot),
187
+ generated_at: nowIso(),
188
+ };
189
+ }
190
+ if (subcommand === "flush") {
191
+ const before = await buildTelemetryStatusSummary(globalPmRoot);
192
+ await flushTelemetryQueueNow(globalPmRoot);
193
+ const after = await buildTelemetryStatusSummary(globalPmRoot);
194
+ return {
195
+ action: "telemetry",
196
+ subcommand,
197
+ queue_entries_before: before.queue_entries,
198
+ queue_entries_after: after.queue_entries,
199
+ queue_drained: after.queue_entries < before.queue_entries,
200
+ status: after,
201
+ generated_at: nowIso(),
202
+ };
203
+ }
204
+ if (subcommand === "stats") {
205
+ const limit = parseTelemetryStatsLimit(options.limit);
206
+ const queueRaw = await readFileIfExists(queuePath);
207
+ const queue = parseTelemetryQueue(queueRaw);
208
+ const buckets = buildTelemetryStatsBuckets(queue.entries);
209
+ const selected = buckets.slice(0, limit);
210
+ return {
211
+ action: "telemetry",
212
+ subcommand,
213
+ limit,
214
+ total_commands: buckets.length,
215
+ queue_entries: queue.valid_entries,
216
+ queue_invalid_rows: queue.invalid_rows,
217
+ queue_rows_total: queue.rows_total,
218
+ truncated: buckets.length > selected.length,
219
+ stats: selected,
220
+ generated_at: nowIso(),
221
+ };
222
+ }
223
+ const settings = await readSettings(globalPmRoot);
224
+ const previousEnabled = settings.telemetry.enabled;
225
+ const previousInstallationId = settings.telemetry.installation_id;
226
+ const previousFirstRunPromptCompleted = settings.telemetry.first_run_prompt_completed;
227
+ settings.telemetry.enabled = false;
228
+ settings.telemetry.first_run_prompt_completed = true;
229
+ settings.telemetry.installation_id = "";
230
+ const settingsChanged = previousEnabled !== settings.telemetry.enabled ||
231
+ previousInstallationId !== settings.telemetry.installation_id ||
232
+ previousFirstRunPromptCompleted !== settings.telemetry.first_run_prompt_completed;
233
+ if (settingsChanged) {
234
+ await writeSettings(globalPmRoot, settings, "telemetry:clear");
235
+ }
236
+ const telemetryRuntimePath = path.join(globalPmRoot, TELEMETRY_RUNTIME_RELATIVE_PATH);
237
+ const existed = await pathExists(telemetryRuntimePath);
238
+ await fs.rm(telemetryRuntimePath, { recursive: true, force: true });
239
+ const queueExistsAfter = await pathExists(queuePath);
240
+ const stateExistsAfter = await pathExists(statePath);
241
+ return {
242
+ action: "telemetry",
243
+ subcommand,
244
+ settings_changed: settingsChanged,
245
+ runtime_dir_removed: existed && !(await pathExists(telemetryRuntimePath)),
246
+ queue_exists_after: queueExistsAfter,
247
+ state_exists_after: stateExistsAfter,
248
+ status: await buildTelemetryStatusSummary(globalPmRoot),
249
+ generated_at: nowIso(),
250
+ };
251
+ }
252
+ //# sourceMappingURL=telemetry.js.map
253
+ //# debugId=4d50d256-348c-5406-a377-ea98099b9ec6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.js","sources":["cli/commands/telemetry.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { resolveGlobalPmRoot } from \"../../core/store/paths.js\";\nimport { readSettings, writeSettings } from \"../../core/store/settings.js\";\nimport { flushTelemetryQueueNow } from \"../../core/telemetry/runtime.js\";\n\nconst TELEMETRY_QUEUE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"events.jsonl\");\nconst TELEMETRY_STATE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"state.json\");\nconst TELEMETRY_RUNTIME_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\");\nconst DEFAULT_STATS_LIMIT = 20;\n\nexport const TELEMETRY_SUBCOMMANDS = [\"status\", \"flush\", \"stats\", \"clear\"] as const;\nexport type TelemetrySubcommand = (typeof TELEMETRY_SUBCOMMANDS)[number];\n\ninterface TelemetryRuntimeStateRecord {\n endpoint?: string;\n queue_entries?: number;\n last_attempted_flush_at?: string;\n last_successful_flush_at?: string;\n last_failed_flush_at?: string;\n last_failed_flush_error?: string;\n}\n\ninterface QueuedTelemetryEventRecord {\n attempts: number;\n client_schema_version?: number;\n event: {\n event_id?: string;\n event_type?: string;\n schema_version?: number;\n command?: string;\n };\n}\n\ninterface ParsedTelemetryQueue {\n rows_total: number;\n valid_entries: number;\n invalid_rows: number;\n entries: QueuedTelemetryEventRecord[];\n}\n\ninterface TelemetryStatusSummary {\n enabled: boolean;\n endpoint: string;\n queue_path: string;\n state_path: string;\n queue_rows_total: number;\n queue_entries: number;\n queue_invalid_rows: number;\n queue_size_bytes: number;\n last_attempted_flush_at: string | null;\n last_successful_flush_at: string | null;\n last_failed_flush_at: string | null;\n last_failed_flush_error: string | null;\n}\n\nexport interface TelemetryCommandOptions {\n subcommand?: string;\n limit?: string | number;\n}\n\ninterface TelemetryStatsBucket {\n command: string;\n count: number;\n event_type_counts: Record<string, number>;\n max_attempts: number;\n event_schema_versions: number[];\n client_schema_versions: number[];\n}\n\nfunction normalizeTelemetrySubcommand(value: string | undefined): TelemetrySubcommand {\n const normalized = (value ?? \"status\").trim().toLowerCase();\n if ((TELEMETRY_SUBCOMMANDS as readonly string[]).includes(normalized)) {\n return normalized as TelemetrySubcommand;\n }\n throw new PmCliError(\n `Unknown pm telemetry subcommand \"${value ?? \"\"}\". Allowed: ${TELEMETRY_SUBCOMMANDS.join(\", \")}`,\n EXIT_CODE.USAGE,\n {\n code: \"unknown_subcommand\",\n examples: [\n \"pm telemetry status\",\n \"pm telemetry flush\",\n \"pm telemetry stats --limit 10\",\n \"pm telemetry clear\",\n ],\n },\n );\n}\n\nfunction parseTelemetryStatsLimit(raw: string | number | undefined): number {\n if (raw === undefined) {\n return DEFAULT_STATS_LIMIT;\n }\n if (typeof raw === \"number\") {\n if (!Number.isFinite(raw) || !Number.isInteger(raw) || raw <= 0) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n return raw;\n }\n const trimmed = raw.trim();\n if (trimmed.length === 0 || !/^\\d+$/.test(trimmed)) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n const parsed = Number.parseInt(trimmed, 10);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n return parsed;\n}\n\nfunction parseTelemetryQueue(raw: string | null): ParsedTelemetryQueue {\n if (raw === null || raw.trim().length === 0) {\n return {\n rows_total: 0,\n valid_entries: 0,\n invalid_rows: 0,\n entries: [],\n };\n }\n const entries: QueuedTelemetryEventRecord[] = [];\n let rowsTotal = 0;\n let invalidRows = 0;\n for (const line of raw.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n rowsTotal += 1;\n try {\n const parsed = JSON.parse(trimmed) as QueuedTelemetryEventRecord;\n if (\n typeof parsed === \"object\" &&\n parsed !== null &&\n typeof parsed.attempts === \"number\" &&\n typeof parsed.event === \"object\" &&\n parsed.event !== null\n ) {\n entries.push(parsed);\n } else {\n invalidRows += 1;\n }\n } catch {\n invalidRows += 1;\n }\n }\n return {\n rows_total: rowsTotal,\n valid_entries: entries.length,\n invalid_rows: invalidRows,\n entries,\n };\n}\n\nasync function readTelemetryRuntimeState(statePath: string): Promise<TelemetryRuntimeStateRecord> {\n const stateRaw = await readFileIfExists(statePath);\n if (stateRaw === null || stateRaw.trim().length === 0) {\n return {};\n }\n try {\n const parsed = JSON.parse(stateRaw) as TelemetryRuntimeStateRecord;\n if (typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) {\n return parsed;\n }\n } catch {\n // Ignore malformed state files; status command is observational.\n }\n return {};\n}\n\nasync function buildTelemetryStatusSummary(globalPmRoot: string): Promise<TelemetryStatusSummary> {\n const settings = await readSettings(globalPmRoot);\n const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);\n const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);\n const queueRaw = await readFileIfExists(queuePath);\n const queue = parseTelemetryQueue(queueRaw);\n const runtimeState = await readTelemetryRuntimeState(statePath);\n return {\n enabled: settings.telemetry.enabled,\n endpoint: settings.telemetry.endpoint,\n queue_path: queuePath,\n state_path: statePath,\n queue_rows_total: queue.rows_total,\n queue_entries: queue.valid_entries,\n queue_invalid_rows: queue.invalid_rows,\n queue_size_bytes: queueRaw === null ? 0 : Buffer.byteLength(queueRaw, \"utf8\"),\n last_attempted_flush_at: runtimeState.last_attempted_flush_at ?? null,\n last_successful_flush_at: runtimeState.last_successful_flush_at ?? null,\n last_failed_flush_at: runtimeState.last_failed_flush_at ?? null,\n last_failed_flush_error: runtimeState.last_failed_flush_error ?? null,\n };\n}\n\nfunction buildTelemetryStatsBuckets(entries: QueuedTelemetryEventRecord[]): TelemetryStatsBucket[] {\n const grouped = new Map<\n string,\n {\n count: number;\n max_attempts: number;\n event_type_counts: Record<string, number>;\n event_schema_versions: Set<number>;\n client_schema_versions: Set<number>;\n }\n >();\n for (const entry of entries) {\n const command = typeof entry.event.command === \"string\" && entry.event.command.trim().length > 0\n ? entry.event.command\n : \"<unknown>\";\n const eventType = typeof entry.event.event_type === \"string\" && entry.event.event_type.trim().length > 0\n ? entry.event.event_type\n : \"unknown\";\n const eventSchemaVersion = typeof entry.event.schema_version === \"number\" && Number.isFinite(entry.event.schema_version)\n ? Math.trunc(entry.event.schema_version)\n : undefined;\n const clientSchemaVersion =\n typeof entry.client_schema_version === \"number\" && Number.isFinite(entry.client_schema_version)\n ? Math.trunc(entry.client_schema_version)\n : undefined;\n const current = grouped.get(command) ?? {\n count: 0,\n max_attempts: 0,\n event_type_counts: {},\n event_schema_versions: new Set<number>(),\n client_schema_versions: new Set<number>(),\n };\n current.count += 1;\n current.max_attempts = Math.max(current.max_attempts, Math.max(0, Math.trunc(entry.attempts)));\n current.event_type_counts[eventType] = (current.event_type_counts[eventType] ?? 0) + 1;\n if (eventSchemaVersion !== undefined) {\n current.event_schema_versions.add(eventSchemaVersion);\n }\n if (clientSchemaVersion !== undefined) {\n current.client_schema_versions.add(clientSchemaVersion);\n }\n grouped.set(command, current);\n }\n return [...grouped.entries()]\n .map(([command, value]) => ({\n command,\n count: value.count,\n event_type_counts: Object.fromEntries(\n Object.entries(value.event_type_counts).sort((left, right) => left[0].localeCompare(right[0])),\n ),\n max_attempts: value.max_attempts,\n event_schema_versions: [...value.event_schema_versions].sort((left, right) => left - right),\n client_schema_versions: [...value.client_schema_versions].sort((left, right) => left - right),\n }))\n .sort((left, right) => right.count - left.count || left.command.localeCompare(right.command));\n}\n\nexport async function runTelemetry(options: TelemetryCommandOptions, _global: GlobalOptions): Promise<Record<string, unknown>> {\n void _global;\n const subcommand = normalizeTelemetrySubcommand(options.subcommand);\n const globalPmRoot = resolveGlobalPmRoot(process.cwd());\n const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);\n const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);\n if (subcommand === \"status\") {\n return {\n action: \"telemetry\",\n subcommand,\n status: await buildTelemetryStatusSummary(globalPmRoot),\n generated_at: nowIso(),\n };\n }\n\n if (subcommand === \"flush\") {\n const before = await buildTelemetryStatusSummary(globalPmRoot);\n await flushTelemetryQueueNow(globalPmRoot);\n const after = await buildTelemetryStatusSummary(globalPmRoot);\n return {\n action: \"telemetry\",\n subcommand,\n queue_entries_before: before.queue_entries,\n queue_entries_after: after.queue_entries,\n queue_drained: after.queue_entries < before.queue_entries,\n status: after,\n generated_at: nowIso(),\n };\n }\n\n if (subcommand === \"stats\") {\n const limit = parseTelemetryStatsLimit(options.limit);\n const queueRaw = await readFileIfExists(queuePath);\n const queue = parseTelemetryQueue(queueRaw);\n const buckets = buildTelemetryStatsBuckets(queue.entries);\n const selected = buckets.slice(0, limit);\n return {\n action: \"telemetry\",\n subcommand,\n limit,\n total_commands: buckets.length,\n queue_entries: queue.valid_entries,\n queue_invalid_rows: queue.invalid_rows,\n queue_rows_total: queue.rows_total,\n truncated: buckets.length > selected.length,\n stats: selected,\n generated_at: nowIso(),\n };\n }\n\n const settings = await readSettings(globalPmRoot);\n const previousEnabled = settings.telemetry.enabled;\n const previousInstallationId = settings.telemetry.installation_id;\n const previousFirstRunPromptCompleted = settings.telemetry.first_run_prompt_completed;\n settings.telemetry.enabled = false;\n settings.telemetry.first_run_prompt_completed = true;\n settings.telemetry.installation_id = \"\";\n const settingsChanged =\n previousEnabled !== settings.telemetry.enabled ||\n previousInstallationId !== settings.telemetry.installation_id ||\n previousFirstRunPromptCompleted !== settings.telemetry.first_run_prompt_completed;\n if (settingsChanged) {\n await writeSettings(globalPmRoot, settings, \"telemetry:clear\");\n }\n\n const telemetryRuntimePath = path.join(globalPmRoot, TELEMETRY_RUNTIME_RELATIVE_PATH);\n const existed = await pathExists(telemetryRuntimePath);\n await fs.rm(telemetryRuntimePath, { recursive: true, force: true });\n const queueExistsAfter = await pathExists(queuePath);\n const stateExistsAfter = await pathExists(statePath);\n return {\n action: \"telemetry\",\n subcommand,\n settings_changed: settingsChanged,\n runtime_dir_removed: existed && !(await pathExists(telemetryRuntimePath)),\n queue_exists_after: queueExistsAfter,\n state_exists_after: stateExistsAfter,\n status: await buildTelemetryStatusSummary(globalPmRoot),\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,E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debugId":"4d50d256-348c-5406-a377-ea98099b9ec6"}
@@ -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]="883618a4-a53f-5506-ab97-d734647806e7")}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]="004f0f48-f016-51b6-b587-30101f5bb77f")}catch(e){}}();
3
3
  import { renderPmCommand } from "./argv-utils.js";
4
4
  function errorType(code) {
5
5
  return `urn:pm-cli:error:${code}`;
@@ -63,6 +63,21 @@ function normalizeRecoveryPayload(payload) {
63
63
  if (typeof payload.suggested_retry === "string" && payload.suggested_retry.trim().length > 0) {
64
64
  normalized.suggested_retry = payload.suggested_retry.trim();
65
65
  }
66
+ if (Array.isArray(payload.fallback_candidates)) {
67
+ const fallbackCandidates = payload.fallback_candidates
68
+ .map((entry) => ({
69
+ source: typeof entry?.source === "string" ? entry.source.trim() : "",
70
+ command: typeof entry?.command === "string" ? entry.command.trim() : "",
71
+ reason: typeof entry?.reason === "string" ? entry.reason.trim() : "",
72
+ }))
73
+ .filter((entry) => entry.source.length > 0 && entry.command.length > 0 && entry.reason.length > 0);
74
+ if (fallbackCandidates.length > 0) {
75
+ normalized.fallback_candidates = fallbackCandidates;
76
+ }
77
+ }
78
+ if (typeof payload.next_best_command === "string" && payload.next_best_command.trim().length > 0) {
79
+ normalized.next_best_command = payload.next_best_command.trim();
80
+ }
66
81
  return Object.keys(normalized).length > 0 ? normalized : undefined;
67
82
  }
68
83
  function renderRecoveryBundle(recovery) {
@@ -86,6 +101,15 @@ function renderRecoveryBundle(recovery) {
86
101
  if (normalized.suggested_retry) {
87
102
  lines.push(` suggested_retry: ${normalized.suggested_retry}`);
88
103
  }
104
+ if (normalized.next_best_command) {
105
+ lines.push(` next_best_command: ${normalized.next_best_command}`);
106
+ }
107
+ if (normalized.fallback_candidates && normalized.fallback_candidates.length > 0) {
108
+ lines.push(" fallback_candidates:");
109
+ for (const candidate of normalized.fallback_candidates) {
110
+ lines.push(` - ${candidate.source}: ${candidate.command} (${candidate.reason})`);
111
+ }
112
+ }
89
113
  return lines;
90
114
  }
91
115
  export function renderGuidanceMessage(message) {
@@ -645,4 +669,4 @@ export function classifyUnknownError(rawMessage) {
645
669
  return guidanceToClassification(buildUnknownErrorGuidance(rawMessage));
646
670
  }
647
671
  //# sourceMappingURL=error-guidance.js.map
648
- //# debugId=883618a4-a53f-5506-ab97-d734647806e7
672
+ //# debugId=004f0f48-f016-51b6-b587-30101f5bb77f