@unbrained/pm-cli 2026.5.30 → 2026.6.5

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 (578) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/dist/cli/argv-utils.js +7 -3
  3. package/dist/cli/argv-utils.js.map +1 -1
  4. package/dist/cli/bootstrap-args.d.ts +1 -0
  5. package/dist/cli/bootstrap-args.js +23 -3
  6. package/dist/cli/bootstrap-args.js.map +1 -1
  7. package/dist/cli/commands/calendar.js +96 -10
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/close-many.d.ts +63 -0
  10. package/dist/cli/commands/close-many.js +302 -0
  11. package/dist/cli/commands/close-many.js.map +1 -0
  12. package/dist/cli/commands/completion.d.ts +1 -0
  13. package/dist/cli/commands/completion.js +241 -27
  14. package/dist/cli/commands/completion.js.map +1 -1
  15. package/dist/cli/commands/config.d.ts +4 -4
  16. package/dist/cli/commands/config.js +115 -3
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/contracts.js +191 -162
  19. package/dist/cli/commands/contracts.js.map +1 -1
  20. package/dist/cli/commands/create.d.ts +1 -0
  21. package/dist/cli/commands/create.js +109 -116
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/extension/doctor.d.ts +12 -0
  24. package/dist/cli/commands/extension/doctor.js +97 -2
  25. package/dist/cli/commands/extension/doctor.js.map +1 -1
  26. package/dist/cli/commands/extension/install-sources.d.ts +2 -0
  27. package/dist/cli/commands/extension/install-sources.js +11 -4
  28. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  29. package/dist/cli/commands/extension/scaffold.js +49 -48
  30. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  31. package/dist/cli/commands/extension.js +51 -23
  32. package/dist/cli/commands/extension.js.map +1 -1
  33. package/dist/cli/commands/get.js +7 -7
  34. package/dist/cli/commands/get.js.map +1 -1
  35. package/dist/cli/commands/health.js +38 -3
  36. package/dist/cli/commands/health.js.map +1 -1
  37. package/dist/cli/commands/index.d.ts +2 -1
  38. package/dist/cli/commands/index.js +4 -3
  39. package/dist/cli/commands/index.js.map +1 -1
  40. package/dist/cli/commands/init.d.ts +10 -0
  41. package/dist/cli/commands/init.js +107 -4
  42. package/dist/cli/commands/init.js.map +1 -1
  43. package/dist/cli/commands/list.d.ts +5 -0
  44. package/dist/cli/commands/list.js +58 -26
  45. package/dist/cli/commands/list.js.map +1 -1
  46. package/dist/cli/commands/reindex.js +164 -48
  47. package/dist/cli/commands/reindex.js.map +1 -1
  48. package/dist/cli/commands/repeatable-metadata-parsers.d.ts +15 -0
  49. package/dist/cli/commands/repeatable-metadata-parsers.js +120 -0
  50. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -0
  51. package/dist/cli/commands/restore.js +25 -4
  52. package/dist/cli/commands/restore.js.map +1 -1
  53. package/dist/cli/commands/schema.d.ts +122 -1
  54. package/dist/cli/commands/schema.js +536 -6
  55. package/dist/cli/commands/schema.js.map +1 -1
  56. package/dist/cli/commands/search.d.ts +18 -0
  57. package/dist/cli/commands/search.js +56 -12
  58. package/dist/cli/commands/search.js.map +1 -1
  59. package/dist/cli/commands/test.js +4 -3
  60. package/dist/cli/commands/test.js.map +1 -1
  61. package/dist/cli/commands/update-many.js +69 -140
  62. package/dist/cli/commands/update-many.js.map +1 -1
  63. package/dist/cli/commands/update.d.ts +2 -0
  64. package/dist/cli/commands/update.js +138 -119
  65. package/dist/cli/commands/update.js.map +1 -1
  66. package/dist/cli/commands/validate.d.ts +1 -0
  67. package/dist/cli/commands/validate.js +63 -33
  68. package/dist/cli/commands/validate.js.map +1 -1
  69. package/dist/cli/error-guidance.js +26 -3
  70. package/dist/cli/error-guidance.js.map +1 -1
  71. package/dist/cli/help-content.js +82 -3
  72. package/dist/cli/help-content.js.map +1 -1
  73. package/dist/cli/main.js +377 -23
  74. package/dist/cli/main.js.map +1 -1
  75. package/dist/cli/register-list-query.js +16 -12
  76. package/dist/cli/register-list-query.js.map +1 -1
  77. package/dist/cli/register-mutation.js +217 -47
  78. package/dist/cli/register-mutation.js.map +1 -1
  79. package/dist/cli/register-operations.js +34 -25
  80. package/dist/cli/register-operations.js.map +1 -1
  81. package/dist/cli/register-setup.js +8 -8
  82. package/dist/cli/register-setup.js.map +1 -1
  83. package/dist/cli/registration-helpers.js +35 -5
  84. package/dist/cli/registration-helpers.js.map +1 -1
  85. package/dist/cli/search-refresh.d.ts +2 -0
  86. package/dist/cli/search-refresh.js +13 -0
  87. package/dist/cli/search-refresh.js.map +1 -0
  88. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js +20 -0
  89. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js.map +1 -0
  90. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js +16 -0
  91. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js.map +7 -0
  92. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js +206 -0
  93. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js.map +1 -0
  94. package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js +209 -0
  95. package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js.map +7 -0
  96. package/dist/cli-bundle/chunks/append-5JE3YGXU.js +72 -0
  97. package/dist/cli-bundle/chunks/append-5JE3YGXU.js.map +7 -0
  98. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js +69 -0
  99. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js.map +1 -0
  100. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js +218 -0
  101. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js.map +1 -0
  102. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
  103. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
  104. package/dist/cli-bundle/chunks/chunk-3OH4DAEB.js +761 -0
  105. package/dist/cli-bundle/chunks/chunk-3OH4DAEB.js.map +7 -0
  106. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js +5553 -0
  107. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js.map +1 -0
  108. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js +634 -0
  109. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js.map +7 -0
  110. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js +1832 -0
  111. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js.map +1 -0
  112. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js +1891 -0
  113. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js.map +7 -0
  114. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js +412 -0
  115. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js.map +1 -0
  116. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js +182 -0
  117. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js.map +1 -0
  118. package/dist/cli-bundle/chunks/chunk-7K24QB23.js +698 -0
  119. package/dist/cli-bundle/chunks/chunk-7K24QB23.js.map +1 -0
  120. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js +380 -0
  121. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js.map +1 -0
  122. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js +230 -0
  123. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js.map +1 -0
  124. package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js +185 -0
  125. package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js.map +7 -0
  126. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js +332 -0
  127. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js.map +1 -0
  128. package/dist/cli-bundle/chunks/chunk-B3N4TKNL.js +1681 -0
  129. package/dist/cli-bundle/chunks/chunk-B3N4TKNL.js.map +7 -0
  130. package/dist/cli-bundle/chunks/{chunk-PB2YU2E3.js → chunk-BNL6S7QH.js} +28 -70
  131. package/dist/cli-bundle/chunks/chunk-BNL6S7QH.js.map +7 -0
  132. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js +154 -0
  133. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js.map +1 -0
  134. package/dist/cli-bundle/chunks/chunk-CJDQB2ED.js +341 -0
  135. package/dist/cli-bundle/chunks/chunk-CJDQB2ED.js.map +7 -0
  136. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js +1340 -0
  137. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js.map +1 -0
  138. package/dist/cli-bundle/chunks/chunk-D3WUNETC.js +349 -0
  139. package/dist/cli-bundle/chunks/chunk-D3WUNETC.js.map +7 -0
  140. package/dist/cli-bundle/chunks/chunk-D5X7N6FI.js +1714 -0
  141. package/dist/cli-bundle/chunks/chunk-D5X7N6FI.js.map +7 -0
  142. package/dist/cli-bundle/chunks/chunk-DFIZGAI5.js +550 -0
  143. package/dist/cli-bundle/chunks/chunk-DFIZGAI5.js.map +7 -0
  144. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js +1704 -0
  145. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js.map +1 -0
  146. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
  147. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
  148. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js +2988 -0
  149. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js.map +1 -0
  150. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js +128 -0
  151. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js.map +1 -0
  152. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js +454 -0
  153. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js.map +1 -0
  154. package/dist/cli-bundle/chunks/chunk-GCAVRLGE.js +383 -0
  155. package/dist/cli-bundle/chunks/chunk-GCAVRLGE.js.map +7 -0
  156. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js +57 -0
  157. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js.map +1 -0
  158. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js +3860 -0
  159. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js.map +1 -0
  160. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js +346 -0
  161. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js.map +1 -0
  162. package/dist/cli-bundle/chunks/chunk-HPH6X4ZZ.js +1356 -0
  163. package/dist/cli-bundle/chunks/chunk-HPH6X4ZZ.js.map +7 -0
  164. package/dist/cli-bundle/chunks/chunk-HZOS2UG5.js +342 -0
  165. package/dist/cli-bundle/chunks/chunk-HZOS2UG5.js.map +7 -0
  166. package/dist/cli-bundle/chunks/chunk-IUV734HF.js +17 -0
  167. package/dist/cli-bundle/chunks/chunk-IUV734HF.js.map +1 -0
  168. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js +15 -0
  169. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js.map +1 -0
  170. package/dist/cli-bundle/chunks/chunk-JB4RGL4V.js +185 -0
  171. package/dist/cli-bundle/chunks/chunk-JB4RGL4V.js.map +7 -0
  172. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js +130 -0
  173. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js.map +1 -0
  174. package/dist/cli-bundle/chunks/chunk-K47WAYQV.js +60 -0
  175. package/dist/cli-bundle/chunks/chunk-K47WAYQV.js.map +7 -0
  176. package/dist/cli-bundle/chunks/chunk-KA24HME7.js +79 -0
  177. package/dist/cli-bundle/chunks/chunk-KA24HME7.js.map +7 -0
  178. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js +1325 -0
  179. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js.map +1 -0
  180. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js +242 -0
  181. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js.map +1 -0
  182. package/dist/cli-bundle/chunks/chunk-KK6YPGH3.js +221 -0
  183. package/dist/cli-bundle/chunks/chunk-KK6YPGH3.js.map +7 -0
  184. package/dist/cli-bundle/chunks/chunk-LDJK7SHN.js +157 -0
  185. package/dist/cli-bundle/chunks/chunk-LDJK7SHN.js.map +7 -0
  186. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js +24 -0
  187. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js.map +1 -0
  188. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js +80 -0
  189. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js.map +1 -0
  190. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js +457 -0
  191. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js.map +7 -0
  192. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js +173 -0
  193. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js.map +1 -0
  194. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js +338 -0
  195. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js.map +1 -0
  196. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
  197. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
  198. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js +3040 -0
  199. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js.map +7 -0
  200. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js +751 -0
  201. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js.map +1 -0
  202. package/dist/cli-bundle/chunks/chunk-OUF3ARDX.js +1861 -0
  203. package/dist/cli-bundle/chunks/chunk-OUF3ARDX.js.map +7 -0
  204. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
  205. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
  206. package/dist/cli-bundle/chunks/chunk-RANZIID5.js +176 -0
  207. package/dist/cli-bundle/chunks/chunk-RANZIID5.js.map +7 -0
  208. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js +140 -0
  209. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js.map +7 -0
  210. package/dist/cli-bundle/chunks/chunk-S3CV7JGJ.js +233 -0
  211. package/dist/cli-bundle/chunks/chunk-S3CV7JGJ.js.map +7 -0
  212. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js +5705 -0
  213. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js.map +7 -0
  214. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js +76 -0
  215. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js.map +1 -0
  216. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js +631 -0
  217. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js.map +1 -0
  218. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js +540 -0
  219. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js.map +1 -0
  220. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js +422 -0
  221. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js.map +7 -0
  222. package/dist/cli-bundle/chunks/{chunk-RJONRNXN.js → chunk-TK633IVD.js} +51 -32
  223. package/dist/cli-bundle/chunks/chunk-TK633IVD.js.map +7 -0
  224. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js +131 -0
  225. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js.map +7 -0
  226. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js +119 -0
  227. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js.map +1 -0
  228. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js +1664 -0
  229. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js.map +1 -0
  230. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js +186 -0
  231. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js.map +1 -0
  232. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js +182 -0
  233. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js.map +1 -0
  234. package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js +189 -0
  235. package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js.map +7 -0
  236. package/dist/cli-bundle/chunks/chunk-XG7RJYHV.js +1385 -0
  237. package/dist/cli-bundle/chunks/chunk-XG7RJYHV.js.map +7 -0
  238. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +53 -0
  239. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +1 -0
  240. package/dist/cli-bundle/chunks/chunk-XX5LRINW.js +90 -0
  241. package/dist/cli-bundle/chunks/chunk-XX5LRINW.js.map +7 -0
  242. package/dist/cli-bundle/chunks/chunk-Y2AKE2HS.js +252 -0
  243. package/dist/cli-bundle/chunks/chunk-Y2AKE2HS.js.map +7 -0
  244. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js +3898 -0
  245. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js.map +7 -0
  246. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js +1809 -0
  247. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js.map +1 -0
  248. package/dist/cli-bundle/chunks/claim-AZLP7YFO.js +132 -0
  249. package/dist/cli-bundle/chunks/claim-AZLP7YFO.js.map +7 -0
  250. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js +129 -0
  251. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js.map +1 -0
  252. package/dist/cli-bundle/chunks/close-65DFYAVS.js +17 -0
  253. package/dist/cli-bundle/chunks/close-65DFYAVS.js.map +1 -0
  254. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js +13 -0
  255. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js.map +7 -0
  256. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js +311 -0
  257. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js.map +1 -0
  258. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js +314 -0
  259. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js.map +7 -0
  260. package/dist/cli-bundle/chunks/comments-AGBNSJJH.js +103 -0
  261. package/dist/cli-bundle/chunks/comments-AGBNSJJH.js.map +7 -0
  262. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js +100 -0
  263. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js.map +1 -0
  264. package/dist/cli-bundle/chunks/config-5ON3ADRH.js +1688 -0
  265. package/dist/cli-bundle/chunks/config-5ON3ADRH.js.map +7 -0
  266. package/dist/cli-bundle/chunks/config-DDPYIA6J.js +1671 -0
  267. package/dist/cli-bundle/chunks/config-DDPYIA6J.js.map +1 -0
  268. package/dist/cli-bundle/chunks/context-E6U3DWVM.js +1471 -0
  269. package/dist/cli-bundle/chunks/context-E6U3DWVM.js.map +7 -0
  270. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js +1461 -0
  271. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js.map +1 -0
  272. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js +1277 -0
  273. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js.map +7 -0
  274. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js +1274 -0
  275. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js.map +1 -0
  276. package/dist/cli-bundle/chunks/create-ATONSAZW.js +27 -0
  277. package/dist/cli-bundle/chunks/create-ATONSAZW.js.map +7 -0
  278. package/dist/cli-bundle/chunks/create-WYFKN2U4.js +31 -0
  279. package/dist/cli-bundle/chunks/create-WYFKN2U4.js.map +1 -0
  280. package/dist/cli-bundle/chunks/delete-RONNH4F4.js +58 -0
  281. package/dist/cli-bundle/chunks/delete-RONNH4F4.js.map +7 -0
  282. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js +55 -0
  283. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js.map +1 -0
  284. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js +225 -0
  285. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js.map +1 -0
  286. package/dist/cli-bundle/chunks/deps-WII3O4HB.js +228 -0
  287. package/dist/cli-bundle/chunks/deps-WII3O4HB.js.map +7 -0
  288. package/dist/cli-bundle/chunks/docs-JMVCFNHH.js +34 -0
  289. package/dist/cli-bundle/chunks/docs-JMVCFNHH.js.map +7 -0
  290. package/dist/cli-bundle/chunks/docs-PDREIMLS.js +31 -0
  291. package/dist/cli-bundle/chunks/docs-PDREIMLS.js.map +1 -0
  292. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js +28 -0
  293. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js.map +1 -0
  294. package/dist/cli-bundle/chunks/extension-G6UXSM5S.js +24 -0
  295. package/dist/cli-bundle/chunks/extension-G6UXSM5S.js.map +7 -0
  296. package/dist/cli-bundle/chunks/files-2PN7UM2D.js +282 -0
  297. package/dist/cli-bundle/chunks/files-2PN7UM2D.js.map +1 -0
  298. package/dist/cli-bundle/chunks/files-MXYS5W4M.js +285 -0
  299. package/dist/cli-bundle/chunks/files-MXYS5W4M.js.map +7 -0
  300. package/dist/cli-bundle/chunks/gc-GT552UJH.js +178 -0
  301. package/dist/cli-bundle/chunks/gc-GT552UJH.js.map +1 -0
  302. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js +181 -0
  303. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js.map +7 -0
  304. package/dist/cli-bundle/chunks/get-CINFEUIY.js +197 -0
  305. package/dist/cli-bundle/chunks/get-CINFEUIY.js.map +7 -0
  306. package/dist/cli-bundle/chunks/get-WXMLRG7M.js +194 -0
  307. package/dist/cli-bundle/chunks/get-WXMLRG7M.js.map +1 -0
  308. package/dist/cli-bundle/chunks/health-5VPOJQ53.js +1258 -0
  309. package/dist/cli-bundle/chunks/health-5VPOJQ53.js.map +1 -0
  310. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js +1261 -0
  311. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js.map +7 -0
  312. package/dist/cli-bundle/chunks/history-6FC4H6HI.js +20 -0
  313. package/dist/cli-bundle/chunks/history-6FC4H6HI.js.map +7 -0
  314. package/dist/cli-bundle/chunks/history-FLZIP7PM.js +24 -0
  315. package/dist/cli-bundle/chunks/history-FLZIP7PM.js.map +1 -0
  316. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js +23 -0
  317. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js.map +1 -0
  318. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js +19 -0
  319. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js.map +7 -0
  320. package/dist/cli-bundle/chunks/history-repair-KC5ZOJRZ.js +196 -0
  321. package/dist/cli-bundle/chunks/history-repair-KC5ZOJRZ.js.map +7 -0
  322. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js +193 -0
  323. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js.map +1 -0
  324. package/dist/cli-bundle/chunks/init-6MRFVOLH.js +20 -0
  325. package/dist/cli-bundle/chunks/init-6MRFVOLH.js.map +1 -0
  326. package/dist/cli-bundle/chunks/init-KHX3FEEM.js +16 -0
  327. package/dist/cli-bundle/chunks/init-KHX3FEEM.js.map +7 -0
  328. package/dist/cli-bundle/chunks/learnings-A3CLB5CO.js +47 -0
  329. package/dist/cli-bundle/chunks/learnings-A3CLB5CO.js.map +7 -0
  330. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js +44 -0
  331. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js.map +1 -0
  332. package/dist/cli-bundle/chunks/list-53LZ2AEO.js +20 -0
  333. package/dist/cli-bundle/chunks/list-53LZ2AEO.js.map +7 -0
  334. package/dist/cli-bundle/chunks/list-DBRECOG4.js +24 -0
  335. package/dist/cli-bundle/chunks/list-DBRECOG4.js.map +1 -0
  336. package/dist/cli-bundle/chunks/notes-42LIC3UE.js +47 -0
  337. package/dist/cli-bundle/chunks/notes-42LIC3UE.js.map +7 -0
  338. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js +44 -0
  339. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js.map +1 -0
  340. package/dist/cli-bundle/chunks/plan-HDQXEUKD.js +1174 -0
  341. package/dist/cli-bundle/chunks/plan-HDQXEUKD.js.map +7 -0
  342. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js +1171 -0
  343. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js.map +1 -0
  344. package/dist/cli-bundle/chunks/{register-list-query-EIVQ5FMR.js → register-list-query-AG3XKXWL.js} +25 -18
  345. package/dist/cli-bundle/chunks/register-list-query-AG3XKXWL.js.map +7 -0
  346. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js +227 -0
  347. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js.map +1 -0
  348. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js +813 -0
  349. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js.map +1 -0
  350. package/dist/cli-bundle/chunks/{register-mutation-RSZNPSGI.js → register-mutation-RSMT6DPK.js} +160 -39
  351. package/dist/cli-bundle/chunks/register-mutation-RSMT6DPK.js.map +7 -0
  352. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js +370 -0
  353. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js.map +1 -0
  354. package/dist/cli-bundle/chunks/{register-operations-APUSYDMR.js → register-operations-Q54JQZUN.js} +50 -32
  355. package/dist/cli-bundle/chunks/register-operations-Q54JQZUN.js.map +7 -0
  356. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js +242 -0
  357. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js.map +1 -0
  358. package/dist/cli-bundle/chunks/{register-setup-OZOKSMPJ.js → register-setup-YJKIQRKA.js} +21 -13
  359. package/dist/cli-bundle/chunks/register-setup-YJKIQRKA.js.map +7 -0
  360. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js +21 -0
  361. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js.map +1 -0
  362. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js +17 -0
  363. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js.map +7 -0
  364. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js +770 -0
  365. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js.map +1 -0
  366. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js +780 -0
  367. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js.map +7 -0
  368. package/dist/cli-bundle/chunks/search-5A3BMFA7.js +1144 -0
  369. package/dist/cli-bundle/chunks/search-5A3BMFA7.js.map +7 -0
  370. package/dist/cli-bundle/chunks/search-C7NPB7G7.js +1127 -0
  371. package/dist/cli-bundle/chunks/search-C7NPB7G7.js.map +1 -0
  372. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js +120 -0
  373. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js.map +1 -0
  374. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js +123 -0
  375. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js.map +7 -0
  376. package/dist/cli-bundle/chunks/test-OFYONO3C.js +35 -0
  377. package/dist/cli-bundle/chunks/test-OFYONO3C.js.map +1 -0
  378. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js +31 -0
  379. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js.map +7 -0
  380. package/dist/cli-bundle/chunks/test-all-EEMKNTGU.js +331 -0
  381. package/dist/cli-bundle/chunks/test-all-EEMKNTGU.js.map +7 -0
  382. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js +328 -0
  383. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js.map +1 -0
  384. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js +929 -0
  385. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js.map +1 -0
  386. package/dist/cli-bundle/chunks/test-runs-L2M7WKH7.js +939 -0
  387. package/dist/cli-bundle/chunks/test-runs-L2M7WKH7.js.map +7 -0
  388. package/dist/cli-bundle/chunks/update-6YEHPVXH.js +25 -0
  389. package/dist/cli-bundle/chunks/update-6YEHPVXH.js.map +1 -0
  390. package/dist/cli-bundle/chunks/update-PYLVHMRD.js +21 -0
  391. package/dist/cli-bundle/chunks/update-PYLVHMRD.js.map +7 -0
  392. package/dist/cli-bundle/chunks/update-many-322CCH2L.js +608 -0
  393. package/dist/cli-bundle/chunks/update-many-322CCH2L.js.map +7 -0
  394. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js +605 -0
  395. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js.map +1 -0
  396. package/dist/cli-bundle/chunks/upgrade-2U727SAM.js +269 -0
  397. package/dist/cli-bundle/chunks/upgrade-2U727SAM.js.map +7 -0
  398. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js +266 -0
  399. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js.map +1 -0
  400. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js +1120 -0
  401. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js.map +1 -0
  402. package/dist/cli-bundle/chunks/validate-ZFVWPEEN.js +1123 -0
  403. package/dist/cli-bundle/chunks/validate-ZFVWPEEN.js.map +7 -0
  404. package/dist/cli-bundle/main.js +615 -121
  405. package/dist/cli-bundle/main.js.map +4 -4
  406. package/dist/core/checkpoint/mutation-checkpoint.d.ts +44 -0
  407. package/dist/core/checkpoint/mutation-checkpoint.js +119 -0
  408. package/dist/core/checkpoint/mutation-checkpoint.js.map +1 -0
  409. package/dist/core/config/positional-value.js +4 -2
  410. package/dist/core/config/positional-value.js.map +1 -1
  411. package/dist/core/diagnostics/remediation.d.ts +73 -0
  412. package/dist/core/diagnostics/remediation.js +328 -0
  413. package/dist/core/diagnostics/remediation.js.map +1 -0
  414. package/dist/core/extensions/extension-hook-runtime.js +9 -2
  415. package/dist/core/extensions/extension-hook-runtime.js.map +1 -1
  416. package/dist/core/extensions/extension-types.d.ts +60 -4
  417. package/dist/core/extensions/extension-types.js +2 -2
  418. package/dist/core/extensions/extension-types.js.map +1 -1
  419. package/dist/core/extensions/index.d.ts +5 -1
  420. package/dist/core/extensions/index.js +61 -2
  421. package/dist/core/extensions/index.js.map +1 -1
  422. package/dist/core/extensions/item-fields.d.ts +5 -1
  423. package/dist/core/extensions/item-fields.js +126 -4
  424. package/dist/core/extensions/item-fields.js.map +1 -1
  425. package/dist/core/extensions/loader.js +283 -8
  426. package/dist/core/extensions/loader.js.map +1 -1
  427. package/dist/core/item/item-format.d.ts +3 -2
  428. package/dist/core/item/item-format.js +15 -10
  429. package/dist/core/item/item-format.js.map +1 -1
  430. package/dist/core/item/item-type-definition.js +6 -2
  431. package/dist/core/item/item-type-definition.js.map +1 -1
  432. package/dist/core/item/status-filter.d.ts +29 -0
  433. package/dist/core/item/status-filter.js +97 -0
  434. package/dist/core/item/status-filter.js.map +1 -0
  435. package/dist/core/item/type-registry.d.ts +4 -0
  436. package/dist/core/item/type-registry.js +12 -2
  437. package/dist/core/item/type-registry.js.map +1 -1
  438. package/dist/core/output/output.js +17 -5
  439. package/dist/core/output/output.js.map +1 -1
  440. package/dist/core/schema/item-types-file.d.ts +15 -0
  441. package/dist/core/schema/item-types-file.js +27 -2
  442. package/dist/core/schema/item-types-file.js.map +1 -1
  443. package/dist/core/schema/runtime-field-filters.js +4 -3
  444. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  445. package/dist/core/schema/runtime-field-values.d.ts +1 -1
  446. package/dist/core/schema/runtime-field-values.js +10 -4
  447. package/dist/core/schema/runtime-field-values.js.map +1 -1
  448. package/dist/core/schema/runtime-schema.js +75 -2
  449. package/dist/core/schema/runtime-schema.js.map +1 -1
  450. package/dist/core/schema/status-defs-file.d.ts +113 -0
  451. package/dist/core/schema/status-defs-file.js +260 -0
  452. package/dist/core/schema/status-defs-file.js.map +1 -0
  453. package/dist/core/schema/type-workflows.d.ts +64 -0
  454. package/dist/core/schema/type-workflows.js +98 -0
  455. package/dist/core/schema/type-workflows.js.map +1 -0
  456. package/dist/core/search/background-refresh.d.ts +53 -0
  457. package/dist/core/search/background-refresh.js +286 -0
  458. package/dist/core/search/background-refresh.js.map +1 -0
  459. package/dist/core/search/cache.d.ts +23 -2
  460. package/dist/core/search/cache.js +135 -30
  461. package/dist/core/search/cache.js.map +1 -1
  462. package/dist/core/search/http-client.d.ts +2 -2
  463. package/dist/core/search/http-client.js +2 -2
  464. package/dist/core/search/http-client.js.map +1 -1
  465. package/dist/core/search/vector-stores.d.ts +1 -0
  466. package/dist/core/search/vector-stores.js +69 -15
  467. package/dist/core/search/vector-stores.js.map +1 -1
  468. package/dist/core/search/vectorization-metadata.d.ts +13 -0
  469. package/dist/core/search/vectorization-metadata.js +65 -0
  470. package/dist/core/search/vectorization-metadata.js.map +1 -0
  471. package/dist/core/shared/constants.d.ts +2 -2
  472. package/dist/core/shared/constants.js +2 -3
  473. package/dist/core/shared/constants.js.map +1 -1
  474. package/dist/core/shared/serialization.d.ts +1 -0
  475. package/dist/core/shared/serialization.js +86 -2
  476. package/dist/core/shared/serialization.js.map +1 -1
  477. package/dist/core/store/front-matter-cache.js +14 -5
  478. package/dist/core/store/front-matter-cache.js.map +1 -1
  479. package/dist/core/store/item-format-migration.js +25 -15
  480. package/dist/core/store/item-format-migration.js.map +1 -1
  481. package/dist/core/store/item-store.d.ts +2 -0
  482. package/dist/core/store/item-store.js +61 -6
  483. package/dist/core/store/item-store.js.map +1 -1
  484. package/dist/core/store/settings-validator.js +22 -2
  485. package/dist/core/store/settings-validator.js.map +1 -1
  486. package/dist/core/store/settings.js +40 -5
  487. package/dist/core/store/settings.js.map +1 -1
  488. package/dist/core/telemetry/consent.js +3 -3
  489. package/dist/core/telemetry/consent.js.map +1 -1
  490. package/dist/core/telemetry/observability.js +4 -3
  491. package/dist/core/telemetry/observability.js.map +1 -1
  492. package/dist/core/telemetry/runtime.d.ts +10 -0
  493. package/dist/core/telemetry/runtime.js +86 -2
  494. package/dist/core/telemetry/runtime.js.map +1 -1
  495. package/dist/mcp/server.js +221 -12
  496. package/dist/mcp/server.js.map +1 -1
  497. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -2
  498. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  499. package/dist/sdk/cli-contracts/commander-types.js +7 -2
  500. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  501. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  502. package/dist/sdk/cli-contracts/enum-contracts.js +4 -2
  503. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  504. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -0
  505. package/dist/sdk/cli-contracts/tool-option-contracts.js +53 -3
  506. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  507. package/dist/sdk/cli-contracts/tool-parameter-tables.js +37 -8
  508. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  509. package/dist/sdk/cli-contracts.d.ts +19 -1
  510. package/dist/sdk/cli-contracts.js +211 -18
  511. package/dist/sdk/cli-contracts.js.map +1 -1
  512. package/dist/sdk/errors.d.ts +22 -0
  513. package/dist/sdk/errors.js +46 -0
  514. package/dist/sdk/errors.js.map +1 -0
  515. package/dist/sdk/index.d.ts +2 -1
  516. package/dist/sdk/index.js +3 -2
  517. package/dist/sdk/index.js.map +1 -1
  518. package/dist/sdk/package-import-adapters.js +14 -3
  519. package/dist/sdk/package-import-adapters.js.map +1 -1
  520. package/dist/sdk/runtime.d.ts +1 -0
  521. package/dist/sdk/runtime.js +3 -2
  522. package/dist/sdk/runtime.js.map +1 -1
  523. package/dist/sdk/testing.d.ts +77 -0
  524. package/dist/sdk/testing.js +239 -0
  525. package/dist/sdk/testing.js.map +1 -0
  526. package/dist/types.d.ts +26 -1
  527. package/dist/types.js +3 -2
  528. package/dist/types.js.map +1 -1
  529. package/docs/AGENT_GUIDE.md +21 -2
  530. package/docs/COMMANDS.md +85 -5
  531. package/docs/CONFIGURATION.md +49 -2
  532. package/docs/EXTENSIONS.md +118 -6
  533. package/docs/QUICKSTART.md +2 -0
  534. package/docs/RELEASING.md +3 -3
  535. package/docs/SDK.md +273 -1
  536. package/docs/TESTING.md +17 -0
  537. package/docs/examples/policy-restricted-extension/manifest.json +1 -0
  538. package/docs/examples/starter-extension/index.js +9 -1
  539. package/docs/examples/starter-extension/manifest.json +1 -0
  540. package/package.json +12 -7
  541. package/packages/pm-beads/extensions/beads/index.js +2 -4
  542. package/packages/pm-beads/extensions/beads/index.ts +43 -33
  543. package/packages/pm-beads/extensions/beads/manifest.json +12 -1
  544. package/packages/pm-calendar/README.md +6 -0
  545. package/packages/pm-calendar/extensions/calendar/index.js +6 -1
  546. package/packages/pm-calendar/extensions/calendar/index.ts +6 -1
  547. package/packages/pm-calendar/extensions/calendar/manifest.json +6 -1
  548. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +6 -1
  549. package/packages/pm-guide-shell/README.md +4 -0
  550. package/packages/pm-guide-shell/extensions/guide-shell/index.js +22 -0
  551. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +22 -0
  552. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +6 -1
  553. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +74 -3
  554. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +84 -4
  555. package/packages/pm-lifecycle-hooks/README.md +29 -0
  556. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +18 -0
  557. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +20 -0
  558. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +9 -0
  559. package/packages/pm-lifecycle-hooks/package.json +52 -0
  560. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +13 -1
  561. package/packages/pm-search-advanced/extensions/search-advanced/index.js +69 -1
  562. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +91 -2
  563. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +13 -1
  564. package/packages/pm-templates/extensions/templates/manifest.json +6 -1
  565. package/packages/pm-todos/extensions/todos/index.js +3 -7
  566. package/packages/pm-todos/extensions/todos/index.ts +55 -42
  567. package/packages/pm-todos/extensions/todos/manifest.json +13 -1
  568. package/scripts/bundle-cli.mjs +121 -17
  569. package/dist/cli-bundle/chunks/chunk-PB2YU2E3.js.map +0 -7
  570. package/dist/cli-bundle/chunks/chunk-RJONRNXN.js.map +0 -7
  571. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js +0 -13864
  572. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js.map +0 -7
  573. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js +0 -24225
  574. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js.map +0 -7
  575. package/dist/cli-bundle/chunks/register-list-query-EIVQ5FMR.js.map +0 -7
  576. package/dist/cli-bundle/chunks/register-mutation-RSZNPSGI.js.map +0 -7
  577. package/dist/cli-bundle/chunks/register-operations-APUSYDMR.js.map +0 -7
  578. package/dist/cli-bundle/chunks/register-setup-OZOKSMPJ.js.map +0 -7
@@ -0,0 +1,1261 @@
1
+ import {
2
+ buildRemediationMap,
3
+ scanHistoryDrift
4
+ } from "./chunk-TBQVUNVH.js";
5
+ import {
6
+ collectStaleVectorizationIds
7
+ } from "./chunk-QAJBIGRA.js";
8
+ import "./chunk-S3CV7JGJ.js";
9
+ import {
10
+ buildRegistrationCollisionRemediation,
11
+ readManagedExtensionState
12
+ } from "./chunk-OIQIXTNB.js";
13
+ import {
14
+ readVectorizationStatusLedger,
15
+ refreshSemanticEmbeddingsForMutatedItems,
16
+ resolveEmbeddingProviders,
17
+ resolveSettingsWithSemanticRuntimeDefaults,
18
+ resolveVectorStores
19
+ } from "./chunk-5IRA6IYD.js";
20
+ import "./chunk-3HUE7XOF.js";
21
+ import {
22
+ collectRegisteredItemFieldNames,
23
+ enforceHistoryStreamPolicyForItems,
24
+ listAllFrontMatter,
25
+ listAllFrontMatterWithBody
26
+ } from "./chunk-XG7RJYHV.js";
27
+ import "./chunk-KA24HME7.js";
28
+ import {
29
+ findFirstMergeConflictMarker,
30
+ parseItemDocument
31
+ } from "./chunk-HPH6X4ZZ.js";
32
+ import {
33
+ resolveItemTypeRegistry
34
+ } from "./chunk-4PJQSECJ.js";
35
+ import {
36
+ nowIso
37
+ } from "./chunk-RANZIID5.js";
38
+ import {
39
+ EXIT_CODE,
40
+ EXTENSION_CAPABILITY_CONTRACT,
41
+ ITEM_FILE_EXTENSIONS,
42
+ KNOWN_EXTENSION_CAPABILITIES,
43
+ PM_CORE_REQUIRED_SUBDIRS,
44
+ PM_OPTIONAL_TYPE_SUBDIRS,
45
+ PmCliError,
46
+ activateExtensions,
47
+ getActiveExtensionRegistrations,
48
+ getItemFormatFromPath,
49
+ getSettingsPath,
50
+ loadExtensions,
51
+ parseLegacyExtensionCapabilityAliasWarning,
52
+ parseUnknownExtensionCapabilityWarning,
53
+ pathExists,
54
+ readFileIfExists,
55
+ readSettingsWithMetadata,
56
+ resolveGlobalPmRoot,
57
+ resolvePmRoot,
58
+ runActiveOnReadHooks,
59
+ toNonEmptyStringOrUndefined
60
+ } from "./chunk-SRVKTWPR.js";
61
+
62
+ // dist/cli/commands/health.js
63
+ import fs from "node:fs/promises";
64
+ import path from "node:path";
65
+ !(function() {
66
+ try {
67
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
68
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b3e623d5-2959-599f-8790-cf31386eee4e");
69
+ } catch (e2) {
70
+ }
71
+ })();
72
+ var STALE_VECTORIZATION_SUMMARY_LIMIT = 25;
73
+ var BRIEF_HEALTH_DETAIL_LIMIT = 8;
74
+ var TELEMETRY_QUEUE_RELATIVE_PATH = path.join("runtime", "telemetry", "events.jsonl");
75
+ var TELEMETRY_STATE_RELATIVE_PATH = path.join("runtime", "telemetry", "state.json");
76
+ var TELEMETRY_ENDPOINT_PROBE_TIMEOUT_MS = 2500;
77
+ var TELEMETRY_QUEUE_HIGH_WATER_MARK = 500;
78
+ function isAdvisoryHealthWarning(warning) {
79
+ return warning.startsWith("telemetry_");
80
+ }
81
+ function warningCode(value) {
82
+ const normalized = value.trim();
83
+ const separator = normalized.indexOf(":");
84
+ if (separator === -1) {
85
+ return normalized;
86
+ }
87
+ return normalized.slice(0, separator);
88
+ }
89
+ function collectUnknownCapabilityGuidance(warnings) {
90
+ const seen = /* @__PURE__ */ new Set();
91
+ const guidance = [];
92
+ for (const warning of warnings) {
93
+ const parsedDetails = (() => {
94
+ const unknownWarning = parseUnknownExtensionCapabilityWarning(warning);
95
+ if (unknownWarning) {
96
+ return [unknownWarning];
97
+ }
98
+ return parseLegacyExtensionCapabilityAliasWarning(warning);
99
+ })();
100
+ for (const parsed of parsedDetails) {
101
+ const key = `${parsed.layer}:${parsed.name}:${parsed.capability}`;
102
+ if (seen.has(key)) {
103
+ continue;
104
+ }
105
+ seen.add(key);
106
+ guidance.push(parsed);
107
+ }
108
+ }
109
+ return guidance;
110
+ }
111
+ function buildCapabilityContractMetadata() {
112
+ return {
113
+ version: EXTENSION_CAPABILITY_CONTRACT.version,
114
+ capabilities: [...EXTENSION_CAPABILITY_CONTRACT.capabilities],
115
+ legacy_aliases: { ...EXTENSION_CAPABILITY_CONTRACT.legacy_aliases }
116
+ };
117
+ }
118
+ function normalizeExtensionNameForMatch(value) {
119
+ return value.trim().toLowerCase();
120
+ }
121
+ function isExpectedUnmanagedExtension(name, directory) {
122
+ const normalizedName = normalizeExtensionNameForMatch(name);
123
+ const normalizedDirectory = normalizeExtensionNameForMatch(directory);
124
+ if (normalizedName.startsWith("builtin-")) {
125
+ return true;
126
+ }
127
+ return normalizedDirectory === "beads" || normalizedDirectory === "todos";
128
+ }
129
+ async function isDirectory(targetPath) {
130
+ try {
131
+ const stats = await fs.stat(targetPath);
132
+ return stats.isDirectory();
133
+ } catch {
134
+ return false;
135
+ }
136
+ }
137
+ async function countHistoryStreams(pmRoot) {
138
+ const historyDir = path.join(pmRoot, "history");
139
+ if (!await isDirectory(historyDir)) {
140
+ return {
141
+ count: 0,
142
+ warnings: []
143
+ };
144
+ }
145
+ const historyFiles = (await fs.readdir(historyDir)).filter((entry) => entry.endsWith(".jsonl")).sort((left, right) => left.localeCompare(right));
146
+ const warnings = [];
147
+ for (const fileName of historyFiles) {
148
+ warnings.push(...await runActiveOnReadHooks({
149
+ path: path.join(historyDir, fileName),
150
+ scope: "project"
151
+ }));
152
+ }
153
+ return {
154
+ count: historyFiles.length,
155
+ warnings
156
+ };
157
+ }
158
+ function normalizeRelativePath(pmRoot, targetPath) {
159
+ return path.relative(pmRoot, targetPath).replaceAll("\\", "/");
160
+ }
161
+ async function listItemDocumentPaths(pmRoot, typeToFolder) {
162
+ const folders = [...new Set(Object.values(typeToFolder))].sort((left, right) => left.localeCompare(right));
163
+ const itemPaths = [];
164
+ for (const folder of folders) {
165
+ const directoryPath = path.join(pmRoot, folder);
166
+ let entries = [];
167
+ try {
168
+ entries = await fs.readdir(directoryPath);
169
+ } catch (error) {
170
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
171
+ continue;
172
+ }
173
+ continue;
174
+ }
175
+ for (const entry of entries) {
176
+ if (!ITEM_FILE_EXTENSIONS.some((extension) => entry.toLowerCase().endsWith(extension))) {
177
+ continue;
178
+ }
179
+ itemPaths.push(path.join(directoryPath, entry));
180
+ }
181
+ }
182
+ itemPaths.sort((left, right) => normalizeRelativePath(pmRoot, left).localeCompare(normalizeRelativePath(pmRoot, right)));
183
+ return itemPaths;
184
+ }
185
+ async function buildIntegrityCheck(pmRoot, typeToFolder, schema) {
186
+ const itemPaths = await listItemDocumentPaths(pmRoot, typeToFolder);
187
+ const itemUnreadable = [];
188
+ const itemConflictMarkers = [];
189
+ const itemParseFailures = [];
190
+ const extensionFieldNames = collectRegisteredItemFieldNames(getActiveExtensionRegistrations());
191
+ for (const itemPath of itemPaths) {
192
+ const relativePath = normalizeRelativePath(pmRoot, itemPath);
193
+ let raw = "";
194
+ try {
195
+ raw = await fs.readFile(itemPath, "utf8");
196
+ } catch {
197
+ itemUnreadable.push(relativePath);
198
+ continue;
199
+ }
200
+ const conflictMarker = findFirstMergeConflictMarker(raw);
201
+ if (conflictMarker) {
202
+ itemConflictMarkers.push({
203
+ path: relativePath,
204
+ line: conflictMarker.line,
205
+ marker: conflictMarker.marker
206
+ });
207
+ continue;
208
+ }
209
+ try {
210
+ parseItemDocument(raw, { format: getItemFormatFromPath(itemPath), schema, extensionFieldNames });
211
+ } catch {
212
+ itemParseFailures.push(relativePath);
213
+ }
214
+ }
215
+ const historyDir = path.join(pmRoot, "history");
216
+ const historyUnreadable = [];
217
+ const historyConflictMarkers = [];
218
+ const historyInvalidJson = [];
219
+ let historyFiles = [];
220
+ try {
221
+ historyFiles = (await fs.readdir(historyDir)).filter((entry) => entry.endsWith(".jsonl")).sort((left, right) => left.localeCompare(right));
222
+ } catch (error) {
223
+ if (!(typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")) {
224
+ historyUnreadable.push("history");
225
+ }
226
+ }
227
+ for (const fileName of historyFiles) {
228
+ const itemId = fileName.slice(0, -".jsonl".length);
229
+ const historyPath = path.join(historyDir, fileName);
230
+ let raw = "";
231
+ try {
232
+ raw = await fs.readFile(historyPath, "utf8");
233
+ } catch {
234
+ historyUnreadable.push(itemId);
235
+ continue;
236
+ }
237
+ const conflictMarker = findFirstMergeConflictMarker(raw);
238
+ if (conflictMarker) {
239
+ historyConflictMarkers.push({
240
+ id: itemId,
241
+ line: conflictMarker.line,
242
+ marker: conflictMarker.marker
243
+ });
244
+ continue;
245
+ }
246
+ const lines = raw.split(/\r?\n/);
247
+ for (let index = 0; index < lines.length; index += 1) {
248
+ const line = lines[index]?.trim();
249
+ if (!line) {
250
+ continue;
251
+ }
252
+ try {
253
+ JSON.parse(line);
254
+ } catch {
255
+ historyInvalidJson.push({
256
+ id: itemId,
257
+ line: index + 1
258
+ });
259
+ }
260
+ }
261
+ }
262
+ const warnings = [
263
+ ...itemUnreadable.map((entry) => `integrity_item_unreadable:${entry}`),
264
+ ...itemConflictMarkers.map((entry) => `integrity_item_conflict_marker:${entry.path}:L${entry.line}`),
265
+ ...itemParseFailures.map((entry) => `integrity_item_parse_failed:${entry}`),
266
+ ...historyUnreadable.map((entry) => `integrity_history_unreadable:${entry}`),
267
+ ...historyConflictMarkers.map((entry) => `integrity_history_conflict_marker:${entry.id}:L${entry.line}`),
268
+ ...historyInvalidJson.map((entry) => `integrity_history_invalid_json:${entry.id}:L${entry.line}`)
269
+ ];
270
+ const normalizedWarnings = [...new Set(warnings)].sort((left, right) => left.localeCompare(right));
271
+ return {
272
+ check: {
273
+ name: "integrity",
274
+ status: normalizedWarnings.length === 0 ? "ok" : "warn",
275
+ details: {
276
+ checked_item_files: itemPaths.length,
277
+ checked_history_streams: historyFiles.length,
278
+ counts: {
279
+ item_unreadable: itemUnreadable.length,
280
+ item_conflict_markers: itemConflictMarkers.length,
281
+ item_parse_failures: itemParseFailures.length,
282
+ history_unreadable: historyUnreadable.length,
283
+ history_conflict_markers: historyConflictMarkers.length,
284
+ history_invalid_json: historyInvalidJson.length
285
+ },
286
+ item_unreadable: itemUnreadable,
287
+ item_conflict_markers: itemConflictMarkers,
288
+ item_parse_failures: itemParseFailures,
289
+ history_unreadable: historyUnreadable,
290
+ history_conflict_markers: historyConflictMarkers,
291
+ history_invalid_json: historyInvalidJson
292
+ }
293
+ },
294
+ warnings: normalizedWarnings
295
+ };
296
+ }
297
+ function hasActivateExport(moduleRecord) {
298
+ if (typeof moduleRecord.activate === "function") {
299
+ return true;
300
+ }
301
+ const defaultExport = moduleRecord.default;
302
+ if (typeof defaultExport !== "object" || defaultExport === null) {
303
+ return false;
304
+ }
305
+ return typeof defaultExport.activate === "function";
306
+ }
307
+ function summarizeLoadedExtension(extension) {
308
+ const summary = {
309
+ layer: extension.layer,
310
+ directory: extension.directory,
311
+ manifest_path: extension.manifest_path,
312
+ name: extension.name,
313
+ version: extension.version,
314
+ entry: extension.entry,
315
+ priority: extension.priority,
316
+ entry_path: extension.entry_path,
317
+ has_activate: hasActivateExport(extension.module)
318
+ };
319
+ if (Array.isArray(extension.capabilities)) {
320
+ summary.capabilities = [...extension.capabilities];
321
+ }
322
+ return summary;
323
+ }
324
+ function resolveMigrationId(definition, fallbackIndex) {
325
+ const explicitId = toNonEmptyStringOrUndefined(definition.id);
326
+ if (explicitId) {
327
+ return explicitId;
328
+ }
329
+ return `migration-${String(fallbackIndex + 1).padStart(3, "0")}`;
330
+ }
331
+ function resolveMigrationStatus(definition) {
332
+ const rawStatus = toNonEmptyStringOrUndefined(definition.status);
333
+ const normalized = rawStatus?.toLowerCase();
334
+ if (normalized === "failed") {
335
+ return "failed";
336
+ }
337
+ if (normalized === "applied") {
338
+ return "applied";
339
+ }
340
+ return "pending";
341
+ }
342
+ function resolveMigrationFailureReason(definition) {
343
+ return toNonEmptyStringOrUndefined(definition.reason) ?? toNonEmptyStringOrUndefined(definition.error) ?? toNonEmptyStringOrUndefined(definition.message);
344
+ }
345
+ function compareMigrationEntries(left, right) {
346
+ const byLayer = (left.layer ?? "").localeCompare(right.layer ?? "");
347
+ if (byLayer !== 0) {
348
+ return byLayer;
349
+ }
350
+ const byName = (left.name ?? "").localeCompare(right.name ?? "");
351
+ if (byName !== 0) {
352
+ return byName;
353
+ }
354
+ return (left.id ?? "").localeCompare(right.id ?? "");
355
+ }
356
+ function summarizeMigrationStatuses(migrations) {
357
+ const applied = [];
358
+ const pending = [];
359
+ const failed = [];
360
+ migrations.forEach((migration, index) => {
361
+ const id = resolveMigrationId(migration.definition, index);
362
+ const status = resolveMigrationStatus(migration.definition);
363
+ if (status === "applied") {
364
+ applied.push({
365
+ layer: migration.layer,
366
+ name: migration.name,
367
+ id,
368
+ status
369
+ });
370
+ return;
371
+ }
372
+ if (status === "failed") {
373
+ failed.push({
374
+ layer: migration.layer,
375
+ name: migration.name,
376
+ id,
377
+ status,
378
+ reason: resolveMigrationFailureReason(migration.definition)
379
+ });
380
+ return;
381
+ }
382
+ pending.push({
383
+ layer: migration.layer,
384
+ name: migration.name,
385
+ id,
386
+ status
387
+ });
388
+ });
389
+ applied.sort(compareMigrationEntries);
390
+ pending.sort(compareMigrationEntries);
391
+ failed.sort(compareMigrationEntries);
392
+ const warnings = [
393
+ ...failed.map((entry) => `extension_migration_failed:${entry.layer}:${entry.name}:${entry.id}`),
394
+ ...pending.map((entry) => `extension_migration_pending:${entry.layer}:${entry.name}:${entry.id}`)
395
+ ];
396
+ return {
397
+ summary: {
398
+ applied,
399
+ pending,
400
+ failed,
401
+ applied_count: applied.length,
402
+ pending_count: pending.length,
403
+ failed_count: failed.length
404
+ },
405
+ warnings
406
+ };
407
+ }
408
+ function buildExtensionHealthTriageSummary(warnings, loadFailureCount, activationFailureCount, migrationStatus, managedStateWarningCount, managedExtensionEntriesCount, unmanagedLoadedExtensions, unmanagedExpectedExtensions, unmanagedActionRequiredExtensions) {
409
+ const normalizedWarnings = [...new Set(warnings)].sort((left, right) => left.localeCompare(right));
410
+ const warningCodes = [...new Set(normalizedWarnings.map((value) => warningCode(value)))].sort((left, right) => left.localeCompare(right));
411
+ const unknownCapabilityCount = normalizedWarnings.filter((warning) => warning.startsWith("extension_capability_unknown:")).length;
412
+ const updateHealthPartial = unmanagedActionRequiredExtensions.length > 0;
413
+ const updateHealthCoverage = updateHealthPartial ? "partial" : "full";
414
+ const remediation = [];
415
+ const registrationCollisionRemediation = buildRegistrationCollisionRemediation(normalizedWarnings, {
416
+ deactivate: "pm extension --deactivate <name> --project/--global",
417
+ doctor: "pm extension --doctor --project/--global --detail deep --trace"
418
+ });
419
+ if (registrationCollisionRemediation) {
420
+ remediation.push(registrationCollisionRemediation);
421
+ }
422
+ if (loadFailureCount > 0) {
423
+ remediation.push("Run pm extension --explore --project and pm extension --explore --global to inspect load failures.");
424
+ }
425
+ if (activationFailureCount > 0) {
426
+ remediation.push("Review checks[name=extensions].details.activation.failed in pm health --json for activation error details.");
427
+ }
428
+ if (migrationStatus.failed_count > 0 || migrationStatus.pending_count > 0) {
429
+ remediation.push("Resolve pending/failed extension migrations before write commands; use --force only when policy allows.");
430
+ }
431
+ if (managedStateWarningCount > 0) {
432
+ remediation.push("Run pm extension --manage --project and pm extension --manage --global to refresh managed-state diagnostics.");
433
+ }
434
+ if (unknownCapabilityCount > 0) {
435
+ remediation.push(`Unknown extension capabilities detected. Allowed capabilities: ${KNOWN_EXTENSION_CAPABILITIES.join(", ")}. Review extension_capability_unknown warning details for suggested replacements.`);
436
+ }
437
+ if (normalizedWarnings.some((warning) => warning.startsWith("extension_capability_legacy_alias:"))) {
438
+ remediation.push("Legacy extension capability aliases were auto-remapped to canonical capabilities. Update manifests to canonical names (migration/validation -> schema).");
439
+ }
440
+ if (normalizedWarnings.some((warning) => warning.startsWith("extension_command_definition_legacy_handler_alias:"))) {
441
+ remediation.push("Extension command definitions using legacy handler were auto-remapped. Update command definitions to use run: (context) => ... for forward compatibility.");
442
+ }
443
+ if (updateHealthPartial) {
444
+ remediation.push("Update-check coverage is partial because unmanaged extensions need adoption. Adopt existing installs via pm extension --manage --project/--global --fix-managed-state, pm extension --adopt-all --project/--global, or pm extension --adopt <name>.");
445
+ } else if (unmanagedLoadedExtensions.length > 0) {
446
+ remediation.push("Loaded unmanaged extensions are currently treated as informational. Use pm extension --manage --project/--global --fix-managed-state to adopt them for update checks.");
447
+ }
448
+ if (remediation.length === 0) {
449
+ remediation.push("No immediate action required. Re-run pm health after extension configuration changes.");
450
+ }
451
+ return {
452
+ status: normalizedWarnings.length === 0 ? "ok" : "warn",
453
+ warning_count: normalizedWarnings.length,
454
+ warning_codes: warningCodes,
455
+ load_failure_count: loadFailureCount,
456
+ activation_failure_count: activationFailureCount,
457
+ migration_failed_count: migrationStatus.failed_count,
458
+ migration_pending_count: migrationStatus.pending_count,
459
+ managed_state_warning_count: managedStateWarningCount,
460
+ managed_extension_entries_count: managedExtensionEntriesCount,
461
+ unmanaged_loaded_extension_count: unmanagedLoadedExtensions.length,
462
+ unmanaged_loaded_extensions: unmanagedLoadedExtensions,
463
+ unmanaged_expected_extension_count: unmanagedExpectedExtensions.length,
464
+ unmanaged_expected_extensions: unmanagedExpectedExtensions,
465
+ unmanaged_action_required_extension_count: unmanagedActionRequiredExtensions.length,
466
+ unmanaged_action_required_extensions: unmanagedActionRequiredExtensions,
467
+ update_health_coverage: updateHealthCoverage,
468
+ update_health_partial: updateHealthPartial,
469
+ unknown_capability_count: unknownCapabilityCount,
470
+ top_warnings: normalizedWarnings.slice(0, 8),
471
+ remediation
472
+ };
473
+ }
474
+ async function buildExtensionCheck(pmRoot, settings, noExtensionsFlag) {
475
+ const loadResult = await loadExtensions({
476
+ pmRoot,
477
+ settings,
478
+ cwd: process.cwd(),
479
+ noExtensions: noExtensionsFlag
480
+ });
481
+ const loadedSummaries = loadResult.loaded.map((extension) => summarizeLoadedExtension(extension));
482
+ const activationResult = await activateExtensions({
483
+ ...loadResult,
484
+ loaded: loadResult.loaded
485
+ });
486
+ const [projectManagedState, globalManagedState] = await Promise.all([
487
+ readManagedExtensionState(loadResult.roots.project),
488
+ readManagedExtensionState(loadResult.roots.global)
489
+ ]);
490
+ const migrationStatus = summarizeMigrationStatuses(activationResult.registrations.migrations);
491
+ const activationDetails = {
492
+ failed: activationResult.failed,
493
+ warnings: activationResult.warnings,
494
+ hook_counts: activationResult.hook_counts,
495
+ command_override_count: activationResult.command_override_count,
496
+ command_handler_count: activationResult.command_handler_count,
497
+ parser_override_count: activationResult.parser_override_count,
498
+ preflight_override_count: activationResult.preflight_override_count,
499
+ service_override_count: activationResult.service_override_count,
500
+ renderer_override_count: activationResult.renderer_override_count,
501
+ registration_counts: activationResult.registration_counts,
502
+ registrations: activationResult.registrations,
503
+ migration_status: migrationStatus.summary,
504
+ managed_extensions: {
505
+ project: {
506
+ path: projectManagedState.path,
507
+ count: projectManagedState.state.entries.length,
508
+ entries: projectManagedState.state.entries
509
+ },
510
+ global: {
511
+ path: globalManagedState.path,
512
+ count: globalManagedState.state.entries.length,
513
+ entries: globalManagedState.state.entries
514
+ }
515
+ }
516
+ };
517
+ const managedProjectNames = new Set(projectManagedState.state.entries.map((entry) => normalizeExtensionNameForMatch(entry.name)));
518
+ const managedGlobalNames = new Set(globalManagedState.state.entries.map((entry) => normalizeExtensionNameForMatch(entry.name)));
519
+ const unmanagedLoadedEntries = [
520
+ ...new Map(loadResult.loaded.filter((entry) => {
521
+ const managedNames = entry.layer === "project" ? managedProjectNames : managedGlobalNames;
522
+ return !managedNames.has(normalizeExtensionNameForMatch(entry.name));
523
+ }).map((entry) => [
524
+ `${entry.layer}:${entry.name}`,
525
+ {
526
+ layer: entry.layer,
527
+ name: entry.name,
528
+ directory: entry.directory
529
+ }
530
+ ])).values()
531
+ ].sort((left, right) => {
532
+ const leftKey = `${left.layer}:${left.name}`;
533
+ const rightKey = `${right.layer}:${right.name}`;
534
+ return leftKey.localeCompare(rightKey);
535
+ });
536
+ const unmanagedLoadedExtensions = unmanagedLoadedEntries.map((entry) => `${entry.layer}:${entry.name}`).sort((left, right) => left.localeCompare(right));
537
+ const unmanagedExpectedExtensions = unmanagedLoadedEntries.filter((entry) => isExpectedUnmanagedExtension(entry.name, entry.directory)).map((entry) => `${entry.layer}:${entry.name}`).sort((left, right) => left.localeCompare(right));
538
+ const unmanagedActionRequiredExtensions = unmanagedLoadedEntries.filter((entry) => !isExpectedUnmanagedExtension(entry.name, entry.directory)).map((entry) => `${entry.layer}:${entry.name}`).sort((left, right) => left.localeCompare(right));
539
+ const updateCoverageWarnings = unmanagedActionRequiredExtensions.length > 0 ? [`extension_update_health_partial_coverage:skipped_unmanaged:${unmanagedActionRequiredExtensions.length}`] : [];
540
+ const extensionWarnings = [
541
+ ...loadResult.warnings,
542
+ ...activationDetails.warnings,
543
+ ...migrationStatus.warnings,
544
+ ...projectManagedState.warnings,
545
+ ...globalManagedState.warnings,
546
+ ...updateCoverageWarnings
547
+ ];
548
+ const capabilityGuidance = collectUnknownCapabilityGuidance(extensionWarnings);
549
+ const capabilityContract = buildCapabilityContractMetadata();
550
+ const extensionTriage = buildExtensionHealthTriageSummary(extensionWarnings, loadResult.failed.length, activationResult.failed.length, migrationStatus.summary, projectManagedState.warnings.length + globalManagedState.warnings.length, projectManagedState.state.entries.length + globalManagedState.state.entries.length, unmanagedLoadedExtensions, unmanagedExpectedExtensions, unmanagedActionRequiredExtensions);
551
+ return {
552
+ check: {
553
+ name: "extensions",
554
+ status: extensionWarnings.length === 0 ? "ok" : "warn",
555
+ details: {
556
+ ...loadResult,
557
+ loaded: loadedSummaries,
558
+ warnings: extensionWarnings,
559
+ activation: activationDetails,
560
+ triage: extensionTriage,
561
+ capability_contract: capabilityContract,
562
+ capability_guidance: capabilityGuidance
563
+ }
564
+ },
565
+ warnings: extensionWarnings
566
+ };
567
+ }
568
+ function summarizeList(values, limit) {
569
+ if (values.length <= limit) {
570
+ return { values, truncated: false };
571
+ }
572
+ return {
573
+ values: values.slice(0, limit),
574
+ truncated: true
575
+ };
576
+ }
577
+ function summarizeRecordList(value, limit) {
578
+ if (!Array.isArray(value)) {
579
+ return {
580
+ count: 0,
581
+ sample: [],
582
+ truncated: false
583
+ };
584
+ }
585
+ return {
586
+ count: value.length,
587
+ sample: value.slice(0, limit),
588
+ truncated: value.length > limit
589
+ };
590
+ }
591
+ function summarizeExtensionRecord(value) {
592
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
593
+ return {};
594
+ }
595
+ const record = value;
596
+ return {
597
+ layer: record.layer,
598
+ directory: record.directory,
599
+ name: record.name,
600
+ version: record.version,
601
+ enabled: record.enabled,
602
+ status: record.status,
603
+ has_activate: record.has_activate,
604
+ capabilities: record.capabilities
605
+ };
606
+ }
607
+ function summarizeExtensionList(value, limit) {
608
+ const summary = summarizeRecordList(value, limit);
609
+ return {
610
+ ...summary,
611
+ sample: summary.sample.map((entry) => summarizeExtensionRecord(entry))
612
+ };
613
+ }
614
+ function summarizeStringList(value, limit) {
615
+ if (!Array.isArray(value)) {
616
+ return {
617
+ count: 0,
618
+ sample: [],
619
+ truncated: false
620
+ };
621
+ }
622
+ const strings = value.filter((entry) => typeof entry === "string");
623
+ return {
624
+ count: strings.length,
625
+ sample: strings.slice(0, limit),
626
+ truncated: strings.length > limit
627
+ };
628
+ }
629
+ function summarizeHealthCheckDetails(check, limit) {
630
+ const details = check.details;
631
+ if (check.name === "settings") {
632
+ return {
633
+ version: details.version,
634
+ id_prefix: details.id_prefix,
635
+ locks_ttl_seconds: details.locks_ttl_seconds,
636
+ warnings: summarizeStringList(details.warnings, limit)
637
+ };
638
+ }
639
+ if (check.name === "directories") {
640
+ return {
641
+ required_count: Array.isArray(details.required) ? details.required.length : 0,
642
+ optional_count: Array.isArray(details.optional) ? details.optional.length : 0,
643
+ missing_required: summarizeStringList(details.missing_required, limit),
644
+ missing_optional: summarizeStringList(details.missing_optional, limit),
645
+ missing: summarizeStringList(details.missing, limit),
646
+ strict_directories: details.strict_directories
647
+ };
648
+ }
649
+ if (check.name === "settings_values") {
650
+ return {
651
+ warnings: summarizeStringList(details.warnings, limit)
652
+ };
653
+ }
654
+ if (check.name === "telemetry") {
655
+ return {
656
+ enabled: details.enabled,
657
+ capture_level: details.capture_level,
658
+ endpoint: details.endpoint,
659
+ queue_exists: details.queue_exists,
660
+ queue_entries: details.queue_entries,
661
+ queue_draining: details.queue_draining,
662
+ queue_invalid_rows: details.queue_invalid_rows,
663
+ queue_rows_total: details.queue_rows_total,
664
+ last_successful_flush_at: details.last_successful_flush_at,
665
+ last_failed_flush_at: details.last_failed_flush_at,
666
+ endpoint_probe: details.endpoint_probe,
667
+ env_overrides: details.env_overrides
668
+ };
669
+ }
670
+ if (check.name === "extensions") {
671
+ const activation = typeof details.activation === "object" && details.activation !== null ? details.activation : {};
672
+ return {
673
+ disabled_by_flag: details.disabled_by_flag,
674
+ discovered: summarizeExtensionList(details.discovered, limit),
675
+ effective: summarizeExtensionList(details.effective, limit),
676
+ loaded: summarizeExtensionList(details.loaded, limit),
677
+ failed: summarizeRecordList(details.failed, limit),
678
+ warnings: summarizeStringList(details.warnings, limit),
679
+ activation: {
680
+ failed: summarizeRecordList(activation.failed, limit),
681
+ warnings: summarizeStringList(activation.warnings, limit),
682
+ hook_counts: activation.hook_counts,
683
+ command_handler_count: activation.command_handler_count,
684
+ service_override_count: activation.service_override_count,
685
+ renderer_override_count: activation.renderer_override_count,
686
+ registration_counts: activation.registration_counts,
687
+ migration_status: typeof activation.migration_status === "object" && activation.migration_status !== null ? {
688
+ applied_count: activation.migration_status.applied_count,
689
+ pending_count: activation.migration_status.pending_count,
690
+ failed_count: activation.migration_status.failed_count
691
+ } : null
692
+ },
693
+ triage: details.triage,
694
+ capability_contract: details.capability_contract,
695
+ capability_guidance: summarizeRecordList(details.capability_guidance, limit)
696
+ };
697
+ }
698
+ if (check.name === "storage") {
699
+ return details;
700
+ }
701
+ if (check.name === "integrity") {
702
+ return {
703
+ checked_item_files: details.checked_item_files,
704
+ checked_history_streams: details.checked_history_streams,
705
+ counts: details.counts,
706
+ item_unreadable: summarizeStringList(details.item_unreadable, limit),
707
+ item_conflict_markers: summarizeRecordList(details.item_conflict_markers, limit),
708
+ item_parse_failures: summarizeStringList(details.item_parse_failures, limit),
709
+ history_unreadable: summarizeStringList(details.history_unreadable, limit),
710
+ history_conflict_markers: summarizeRecordList(details.history_conflict_markers, limit),
711
+ history_invalid_json: summarizeRecordList(details.history_invalid_json, limit),
712
+ skipped: details.skipped
713
+ };
714
+ }
715
+ if (check.name === "history_drift") {
716
+ return {
717
+ checked_items: details.checked_items,
718
+ counts: details.counts,
719
+ drifted_items: summarizeStringList(details.drifted_items, limit),
720
+ missing_streams: summarizeStringList(details.missing_streams, limit),
721
+ unreadable_streams: summarizeStringList(details.unreadable_streams, limit),
722
+ hash_mismatches: summarizeStringList(details.hash_mismatches, limit),
723
+ chain_mismatches: summarizeStringList(details.chain_mismatches, limit),
724
+ skipped: details.skipped
725
+ };
726
+ }
727
+ if (check.name === "vectorization") {
728
+ return {
729
+ semantic_runtime_available: details.semantic_runtime_available,
730
+ compatibility_mode_auto_defaults: details.compatibility_mode_auto_defaults,
731
+ auto_ollama_defaults_applied: details.auto_ollama_defaults_applied,
732
+ refresh_policy: details.refresh_policy,
733
+ provider_active: details.provider_active,
734
+ vector_store_active: details.vector_store_active,
735
+ items: details.items,
736
+ ledger_entries_before: details.ledger_entries_before,
737
+ stale_items_before_total: details.stale_items_before_total,
738
+ stale_items_before: summarizeStringList(details.stale_items_before, limit),
739
+ refresh_attempted: details.refresh_attempted,
740
+ refresh_skipped_reason: details.refresh_skipped_reason,
741
+ refresh_result: details.refresh_result,
742
+ ledger_entries_after: details.ledger_entries_after,
743
+ stale_items_after_total: details.stale_items_after_total,
744
+ stale_items_after: summarizeStringList(details.stale_items_after, limit),
745
+ skipped: details.skipped
746
+ };
747
+ }
748
+ return details;
749
+ }
750
+ function applyBriefHealthProjection(result) {
751
+ const warningsSummary = summarizeStringList(result.warnings, BRIEF_HEALTH_DETAIL_LIMIT);
752
+ return {
753
+ ok: result.ok,
754
+ checks: result.checks.map((check) => ({
755
+ name: check.name,
756
+ status: check.status,
757
+ details: summarizeHealthCheckDetails(check, BRIEF_HEALTH_DETAIL_LIMIT)
758
+ })),
759
+ warnings: warningsSummary.sample,
760
+ projection: {
761
+ mode: "brief",
762
+ warning_count: warningsSummary.count,
763
+ warnings_truncated: warningsSummary.truncated,
764
+ detail_limit: BRIEF_HEALTH_DETAIL_LIMIT
765
+ },
766
+ generated_at: result.generated_at
767
+ };
768
+ }
769
+ function isSkippedHealthCheck(check) {
770
+ return check.details.skipped === true;
771
+ }
772
+ function applySummaryHealthProjection(result) {
773
+ const warningsSummary = summarizeStringList(result.warnings, BRIEF_HEALTH_DETAIL_LIMIT);
774
+ const omittedChecks = result.checks.filter(isSkippedHealthCheck).map((check) => check.name);
775
+ return {
776
+ ok: result.ok,
777
+ checks: result.checks.filter((check) => !isSkippedHealthCheck(check)).map((check) => ({
778
+ name: check.name,
779
+ status: check.status,
780
+ details: {}
781
+ })),
782
+ warning_count: warningsSummary.count,
783
+ warnings: warningsSummary.sample,
784
+ projection: {
785
+ mode: "summary",
786
+ warning_count: warningsSummary.count,
787
+ warnings_truncated: warningsSummary.truncated,
788
+ detail_limit: BRIEF_HEALTH_DETAIL_LIMIT,
789
+ omitted_checks: omittedChecks
790
+ },
791
+ generated_at: result.generated_at
792
+ };
793
+ }
794
+ function selectStaleItemDetail(values, verboseStaleItems) {
795
+ if (verboseStaleItems) {
796
+ return {
797
+ values,
798
+ truncated: false,
799
+ total: values.length
800
+ };
801
+ }
802
+ const summary = summarizeList(values, STALE_VECTORIZATION_SUMMARY_LIMIT);
803
+ return {
804
+ values: summary.values,
805
+ truncated: summary.truncated,
806
+ total: values.length
807
+ };
808
+ }
809
+ function telemetryEnvFlagEnabled(envKey) {
810
+ const value = (process.env[envKey] ?? "").trim().toLowerCase();
811
+ return value === "1" || value === "true" || value === "yes" || value === "on";
812
+ }
813
+ function normalizeEndpointForDisplay(rawEndpoint) {
814
+ const trimmed = rawEndpoint.trim();
815
+ if (trimmed.length === 0) {
816
+ return "";
817
+ }
818
+ try {
819
+ const parsed = new URL(trimmed);
820
+ parsed.username = "";
821
+ parsed.password = "";
822
+ parsed.search = "";
823
+ parsed.hash = "";
824
+ return parsed.toString();
825
+ } catch {
826
+ return trimmed;
827
+ }
828
+ }
829
+ function parseTelemetryQueue(raw) {
830
+ let validEntries = 0;
831
+ let invalidRows = 0;
832
+ let totalRows = 0;
833
+ for (const line of raw.split("\n")) {
834
+ const trimmed = line.trim();
835
+ if (trimmed.length === 0) {
836
+ continue;
837
+ }
838
+ totalRows += 1;
839
+ try {
840
+ const parsed = JSON.parse(trimmed);
841
+ if (typeof parsed === "object" && parsed !== null && typeof parsed.attempts === "number") {
842
+ validEntries += 1;
843
+ } else {
844
+ invalidRows += 1;
845
+ }
846
+ } catch {
847
+ invalidRows += 1;
848
+ }
849
+ }
850
+ return {
851
+ validEntries,
852
+ invalidRows,
853
+ totalRows
854
+ };
855
+ }
856
+ async function probeTelemetryEndpointHealth(endpoint) {
857
+ let probeUrl = endpoint;
858
+ try {
859
+ const parsed = new URL(endpoint);
860
+ parsed.pathname = "/healthz";
861
+ parsed.search = "";
862
+ parsed.hash = "";
863
+ probeUrl = parsed.toString();
864
+ } catch {
865
+ }
866
+ try {
867
+ const response = await fetch(probeUrl, {
868
+ method: "GET",
869
+ signal: AbortSignal.timeout(TELEMETRY_ENDPOINT_PROBE_TIMEOUT_MS)
870
+ });
871
+ return {
872
+ probe_url: normalizeEndpointForDisplay(probeUrl),
873
+ ok: response.ok,
874
+ status: response.status
875
+ };
876
+ } catch (error) {
877
+ return {
878
+ probe_url: normalizeEndpointForDisplay(probeUrl),
879
+ ok: false,
880
+ error: error instanceof Error ? error.message : "probe_failed"
881
+ };
882
+ }
883
+ }
884
+ async function buildTelemetryCheck(settings, options) {
885
+ const globalPmRoot = resolveGlobalPmRoot(process.cwd());
886
+ const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);
887
+ const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);
888
+ const queueRaw = await readFileIfExists(queuePath);
889
+ const queueExists = queueRaw !== null;
890
+ const queueSizeBytes = queueRaw ? Buffer.byteLength(queueRaw, "utf8") : 0;
891
+ const queueSummary = queueRaw ? parseTelemetryQueue(queueRaw) : { validEntries: 0, invalidRows: 0, totalRows: 0 };
892
+ const stateRaw = await readFileIfExists(statePath);
893
+ let runtimeState = {};
894
+ let stateParseFailed = false;
895
+ if (stateRaw && stateRaw.trim().length > 0) {
896
+ try {
897
+ const parsed = JSON.parse(stateRaw);
898
+ if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
899
+ runtimeState = parsed;
900
+ } else {
901
+ stateParseFailed = true;
902
+ }
903
+ } catch {
904
+ stateParseFailed = true;
905
+ }
906
+ }
907
+ const endpoint = settings.telemetry.endpoint.trim();
908
+ const endpointDisplay = normalizeEndpointForDisplay(endpoint);
909
+ let endpointProbe;
910
+ if (options.checkTelemetry && settings.telemetry.enabled && endpoint.length > 0) {
911
+ const probe = await probeTelemetryEndpointHealth(endpoint);
912
+ endpointProbe = {
913
+ attempted: true,
914
+ ...probe
915
+ };
916
+ }
917
+ const warnings = [];
918
+ if (stateParseFailed) {
919
+ warnings.push("telemetry_state_invalid_json");
920
+ }
921
+ if (queueSummary.invalidRows > 0) {
922
+ warnings.push(`telemetry_queue_invalid_rows:${queueSummary.invalidRows}`);
923
+ }
924
+ const queueHasEntries = settings.telemetry.enabled && queueSummary.validEntries > 0;
925
+ if (queueHasEntries) {
926
+ const lastSuccess = runtimeState.last_successful_flush_at;
927
+ const lastFailure = runtimeState.last_failed_flush_at;
928
+ const activeFailure = lastFailure && (!lastSuccess || lastFailure > lastSuccess);
929
+ const neverFlushed = !lastSuccess;
930
+ const highWater = queueSummary.validEntries >= TELEMETRY_QUEUE_HIGH_WATER_MARK;
931
+ if (activeFailure || neverFlushed || highWater) {
932
+ warnings.push(`telemetry_queue_pending:${queueSummary.validEntries}`);
933
+ }
934
+ }
935
+ if (endpointProbe && !endpointProbe.ok) {
936
+ if (typeof endpointProbe.status === "number") {
937
+ warnings.push(`telemetry_endpoint_probe_http_status:${endpointProbe.status}`);
938
+ } else {
939
+ warnings.push("telemetry_endpoint_probe_failed");
940
+ }
941
+ }
942
+ return {
943
+ check: {
944
+ name: "telemetry",
945
+ status: warnings.length === 0 ? "ok" : "warn",
946
+ details: {
947
+ enabled: settings.telemetry.enabled,
948
+ capture_level: settings.telemetry.capture_level,
949
+ endpoint: endpointDisplay,
950
+ global_pm_root: globalPmRoot,
951
+ queue_path: queuePath,
952
+ queue_exists: queueExists,
953
+ queue_entries: queueSummary.validEntries,
954
+ queue_draining: queueHasEntries && warnings.every((w) => !w.startsWith("telemetry_queue_pending:")),
955
+ queue_invalid_rows: queueSummary.invalidRows,
956
+ queue_rows_total: queueSummary.totalRows,
957
+ queue_size_bytes: queueSizeBytes,
958
+ runtime_state_path: statePath,
959
+ last_attempted_flush_at: runtimeState.last_attempted_flush_at ?? null,
960
+ last_successful_flush_at: runtimeState.last_successful_flush_at ?? null,
961
+ last_failed_flush_at: runtimeState.last_failed_flush_at ?? null,
962
+ last_failed_flush_error: runtimeState.last_failed_flush_error ?? null,
963
+ endpoint_probe: endpointProbe ?? {
964
+ attempted: false
965
+ },
966
+ env_overrides: {
967
+ telemetry_disabled: telemetryEnvFlagEnabled("PM_TELEMETRY_DISABLED") || telemetryEnvFlagEnabled("PM_NO_TELEMETRY"),
968
+ pm_no_telemetry: telemetryEnvFlagEnabled("PM_NO_TELEMETRY"),
969
+ telemetry_otel_disabled: telemetryEnvFlagEnabled("PM_TELEMETRY_OTEL_DISABLED")
970
+ }
971
+ }
972
+ },
973
+ warnings
974
+ };
975
+ }
976
+ async function buildHistoryDriftCheck(pmRoot, items) {
977
+ const { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems } = await scanHistoryDrift(pmRoot, items);
978
+ const warnings = [
979
+ ...missingStreams.map((id) => `history_drift_missing_stream:${id}`),
980
+ ...unreadableStreams.map((id) => `history_drift_unreadable_stream:${id}`),
981
+ ...hashMismatches.map((id) => `history_drift_hash_mismatch:${id}`),
982
+ ...chainMismatches.map((id) => `history_drift_chain_mismatch:${id}`)
983
+ ];
984
+ return {
985
+ check: {
986
+ name: "history_drift",
987
+ status: warnings.length === 0 ? "ok" : "warn",
988
+ details: {
989
+ checked_items: items.length,
990
+ drifted_items: driftedItems,
991
+ counts: {
992
+ drifted: driftedItems.length,
993
+ missing_streams: missingStreams.length,
994
+ unreadable_streams: unreadableStreams.length,
995
+ hash_mismatches: hashMismatches.length,
996
+ chain_mismatches: chainMismatches.length
997
+ },
998
+ missing_streams: missingStreams,
999
+ unreadable_streams: unreadableStreams,
1000
+ hash_mismatches: hashMismatches,
1001
+ chain_mismatches: chainMismatches
1002
+ }
1003
+ },
1004
+ warnings
1005
+ };
1006
+ }
1007
+ async function buildVectorizationCheck(pmRoot, settings, items, refreshPolicy, verboseStaleItems) {
1008
+ const runtimeDefaults = resolveSettingsWithSemanticRuntimeDefaults(settings);
1009
+ const providerResolution = resolveEmbeddingProviders(runtimeDefaults.settings);
1010
+ const vectorStoreResolution = resolveVectorStores(runtimeDefaults.settings);
1011
+ const semanticRuntimeAvailable = Boolean(providerResolution.active && vectorStoreResolution.active);
1012
+ const ledgerBefore = await readVectorizationStatusLedger(pmRoot);
1013
+ const staleBefore = semanticRuntimeAvailable ? collectStaleVectorizationIds(items, ledgerBefore.entries) : [];
1014
+ let refreshResult = {
1015
+ refreshed: [],
1016
+ skipped: [],
1017
+ warnings: []
1018
+ };
1019
+ if (refreshPolicy.enabled && semanticRuntimeAvailable && staleBefore.length > 0) {
1020
+ refreshResult = await refreshSemanticEmbeddingsForMutatedItems(pmRoot, staleBefore, {
1021
+ settings: runtimeDefaults.settings,
1022
+ apply_runtime_defaults: false
1023
+ });
1024
+ }
1025
+ const ledgerAfter = await readVectorizationStatusLedger(pmRoot);
1026
+ const staleAfter = semanticRuntimeAvailable ? collectStaleVectorizationIds(items, ledgerAfter.entries) : [];
1027
+ const strictVectorizationWarnings = !runtimeDefaults.auto_ollama_defaults_applied;
1028
+ const warningSet = /* @__PURE__ */ new Set([...ledgerBefore.warnings, ...ledgerAfter.warnings]);
1029
+ if (strictVectorizationWarnings) {
1030
+ for (const warning of refreshResult.warnings) {
1031
+ warningSet.add(warning);
1032
+ }
1033
+ }
1034
+ if (strictVectorizationWarnings && semanticRuntimeAvailable && staleAfter.length > 0) {
1035
+ warningSet.add(`vectorization_stale_items_remaining:${staleAfter.length}`);
1036
+ }
1037
+ const warnings = [...warningSet].sort((left, right) => left.localeCompare(right));
1038
+ const staleBeforeDetail = selectStaleItemDetail(staleBefore, verboseStaleItems);
1039
+ const staleAfterDetail = selectStaleItemDetail(staleAfter, verboseStaleItems);
1040
+ return {
1041
+ check: {
1042
+ name: "vectorization",
1043
+ status: warnings.length === 0 ? "ok" : "warn",
1044
+ details: {
1045
+ semantic_runtime_available: semanticRuntimeAvailable,
1046
+ compatibility_mode_auto_defaults: runtimeDefaults.auto_ollama_defaults_applied,
1047
+ auto_ollama_defaults_applied: runtimeDefaults.auto_ollama_defaults_applied,
1048
+ refresh_policy: {
1049
+ enabled: refreshPolicy.enabled,
1050
+ check_only: refreshPolicy.checkOnly,
1051
+ no_refresh: refreshPolicy.noRefresh,
1052
+ refresh_vectors: refreshPolicy.refreshVectors
1053
+ },
1054
+ provider_active: providerResolution.active?.name ?? null,
1055
+ vector_store_active: vectorStoreResolution.active?.name ?? null,
1056
+ items: items.length,
1057
+ ledger_entries_before: Object.keys(ledgerBefore.entries).length,
1058
+ stale_items_detail_mode: verboseStaleItems ? "full" : "summary",
1059
+ stale_items_summary_limit: STALE_VECTORIZATION_SUMMARY_LIMIT,
1060
+ stale_items_before_total: staleBeforeDetail.total,
1061
+ stale_items_before: staleBeforeDetail.values,
1062
+ stale_items_before_truncated: staleBeforeDetail.truncated,
1063
+ refresh_attempted: refreshPolicy.enabled && staleBefore.length > 0 && semanticRuntimeAvailable,
1064
+ refresh_skipped_reason: refreshPolicy.enabled && semanticRuntimeAvailable && staleBefore.length > 0 ? null : !refreshPolicy.enabled ? "refresh_disabled" : !semanticRuntimeAvailable ? "semantic_runtime_unavailable" : "no_stale_items",
1065
+ refresh_result: refreshResult,
1066
+ ledger_entries_after: Object.keys(ledgerAfter.entries).length,
1067
+ stale_items_after_total: staleAfterDetail.total,
1068
+ stale_items_after: staleAfterDetail.values,
1069
+ stale_items_after_truncated: staleAfterDetail.truncated
1070
+ }
1071
+ },
1072
+ warnings
1073
+ };
1074
+ }
1075
+ function validateSettingsValues(settings) {
1076
+ const warnings = [];
1077
+ if (settings.id_prefix.trim().length === 0) {
1078
+ warnings.push("settings:id_prefix_empty");
1079
+ }
1080
+ if (settings.locks.ttl_seconds <= 0) {
1081
+ warnings.push("settings:locks_ttl_non_positive");
1082
+ }
1083
+ return warnings;
1084
+ }
1085
+ function resolveVectorRefreshPolicy(options) {
1086
+ const checkOnly = options.checkOnly === true;
1087
+ const noRefresh = options.noRefresh === true || checkOnly;
1088
+ const refreshVectors = options.refreshVectors === true;
1089
+ if (refreshVectors && checkOnly) {
1090
+ throw new PmCliError("--check-only cannot be combined with --refresh-vectors", EXIT_CODE.USAGE);
1091
+ }
1092
+ if (refreshVectors && options.noRefresh === true) {
1093
+ throw new PmCliError("--no-refresh cannot be combined with --refresh-vectors", EXIT_CODE.USAGE);
1094
+ }
1095
+ return {
1096
+ enabled: refreshVectors || !noRefresh,
1097
+ checkOnly,
1098
+ noRefresh,
1099
+ refreshVectors
1100
+ };
1101
+ }
1102
+ async function runHealth(global2, options = {}) {
1103
+ const pmRoot = resolvePmRoot(process.cwd(), global2.path);
1104
+ const settingsPath = getSettingsPath(pmRoot);
1105
+ if (!await pathExists(settingsPath)) {
1106
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
1107
+ }
1108
+ const { settings, warnings: settingsReadWarnings } = await readSettingsWithMetadata(pmRoot);
1109
+ const normalizedSettingsReadWarnings = [...new Set(settingsReadWarnings)];
1110
+ const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
1111
+ const strictDirectories = options.strictDirectories === true;
1112
+ const refreshPolicy = resolveVectorRefreshPolicy(options);
1113
+ const optionalBuiltinDirs = new Set(PM_OPTIONAL_TYPE_SUBDIRS.filter((entry) => entry.length > 0));
1114
+ const requiredDirSet = new Set(PM_CORE_REQUIRED_SUBDIRS.filter((entry) => entry.length > 0));
1115
+ const optionalDirSet = /* @__PURE__ */ new Set();
1116
+ for (const folder of typeRegistry.folders) {
1117
+ if (optionalBuiltinDirs.has(folder)) {
1118
+ optionalDirSet.add(folder);
1119
+ continue;
1120
+ }
1121
+ requiredDirSet.add(folder);
1122
+ }
1123
+ const requiredDirs = [...requiredDirSet].sort((left, right) => left.localeCompare(right));
1124
+ const optionalDirs = [...optionalDirSet].sort((left, right) => left.localeCompare(right));
1125
+ const missingRequiredDirs = [];
1126
+ const missingOptionalDirs = [];
1127
+ const hookWarnings = [];
1128
+ for (const relativeDir of [...requiredDirs, ...optionalDirs]) {
1129
+ const directoryPath = path.join(pmRoot, relativeDir);
1130
+ hookWarnings.push(...await runActiveOnReadHooks({
1131
+ path: directoryPath,
1132
+ scope: "project"
1133
+ }));
1134
+ if (!await isDirectory(directoryPath)) {
1135
+ if (optionalDirSet.has(relativeDir)) {
1136
+ missingOptionalDirs.push(relativeDir);
1137
+ } else {
1138
+ missingRequiredDirs.push(relativeDir);
1139
+ }
1140
+ }
1141
+ }
1142
+ const missingDirs = strictDirectories ? [...missingRequiredDirs, ...missingOptionalDirs] : [...missingRequiredDirs];
1143
+ const settingWarnings = validateSettingsValues(settings);
1144
+ const telemetryCheck = await buildTelemetryCheck(settings, {
1145
+ checkTelemetry: options.checkTelemetry === true
1146
+ });
1147
+ const extensionCheck = await buildExtensionCheck(pmRoot, settings, Boolean(global2.noExtensions));
1148
+ const summaryMode = options.summary === true && options.full !== true;
1149
+ const fastProjectionCheckOnly = options.checkOnly === true && (options.brief === true || options.summary === true) && options.full !== true;
1150
+ const skipIntegrity = (options.skipIntegrity === true || fastProjectionCheckOnly) && options.full !== true;
1151
+ const skipDrift = (options.skipDrift === true || fastProjectionCheckOnly) && options.full !== true;
1152
+ const skipVectors = (options.skipVectors === true || fastProjectionCheckOnly) && options.full !== true;
1153
+ const itemReadWarnings = [];
1154
+ const items = skipDrift && skipVectors ? await listAllFrontMatter(pmRoot, settings.item_format, typeRegistry.type_to_folder, itemReadWarnings, settings.schema) : await listAllFrontMatterWithBody(pmRoot, settings.item_format, typeRegistry.type_to_folder, itemReadWarnings, settings.schema);
1155
+ const itemsWithBody = items;
1156
+ const normalizedItemReadWarnings = [...new Set(itemReadWarnings)];
1157
+ const historyPolicy = skipDrift ? { warnings: [] } : await enforceHistoryStreamPolicyForItems({
1158
+ pmRoot,
1159
+ settings,
1160
+ itemIds: items.map((item) => item.id),
1161
+ commandLabel: "health"
1162
+ });
1163
+ const historySummary = await countHistoryStreams(pmRoot);
1164
+ const integrityCheck = skipIntegrity ? { check: { name: "integrity", status: "ok", details: { skipped: true } }, warnings: [] } : await buildIntegrityCheck(pmRoot, typeRegistry.type_to_folder, settings.schema);
1165
+ const historyDriftCheck = skipDrift ? { check: { name: "history_drift", status: "ok", details: { skipped: true } }, warnings: [] } : await buildHistoryDriftCheck(pmRoot, itemsWithBody);
1166
+ const vectorizationCheck = skipVectors ? { check: { name: "vectorization", status: "ok", details: { skipped: true } }, warnings: [] } : await buildVectorizationCheck(pmRoot, settings, itemsWithBody, refreshPolicy, options.verboseStaleItems === true);
1167
+ const checks = [
1168
+ {
1169
+ name: "settings",
1170
+ status: normalizedSettingsReadWarnings.length === 0 ? "ok" : "warn",
1171
+ details: {
1172
+ path: settingsPath,
1173
+ version: settings.version,
1174
+ id_prefix: settings.id_prefix,
1175
+ locks_ttl_seconds: settings.locks.ttl_seconds,
1176
+ warnings: normalizedSettingsReadWarnings
1177
+ }
1178
+ },
1179
+ {
1180
+ name: "directories",
1181
+ status: missingDirs.length === 0 ? "ok" : "warn",
1182
+ details: {
1183
+ required: requiredDirs,
1184
+ optional: optionalDirs,
1185
+ missing_required: missingRequiredDirs,
1186
+ missing_optional: missingOptionalDirs,
1187
+ missing: missingDirs,
1188
+ strict_directories: strictDirectories
1189
+ }
1190
+ },
1191
+ {
1192
+ name: "settings_values",
1193
+ status: settingWarnings.length === 0 ? "ok" : "warn",
1194
+ details: {
1195
+ warnings: settingWarnings
1196
+ }
1197
+ },
1198
+ telemetryCheck.check,
1199
+ extensionCheck.check,
1200
+ {
1201
+ name: "storage",
1202
+ status: "ok",
1203
+ details: {
1204
+ items: items.length,
1205
+ history_streams: historySummary.count
1206
+ }
1207
+ },
1208
+ integrityCheck.check,
1209
+ historyDriftCheck.check,
1210
+ vectorizationCheck.check
1211
+ ];
1212
+ const warnings = [
1213
+ ...missingDirs.map((dir) => `missing_directory:${dir}`),
1214
+ ...normalizedSettingsReadWarnings,
1215
+ ...settingWarnings,
1216
+ ...normalizedItemReadWarnings,
1217
+ ...telemetryCheck.warnings,
1218
+ ...extensionCheck.warnings,
1219
+ ...historyPolicy.warnings,
1220
+ ...historySummary.warnings,
1221
+ ...integrityCheck.warnings,
1222
+ ...historyDriftCheck.warnings,
1223
+ ...vectorizationCheck.warnings,
1224
+ ...hookWarnings
1225
+ ];
1226
+ const normalizedWarnings = [...new Set(warnings)];
1227
+ const checkRemediationSources = {
1228
+ settings: normalizedSettingsReadWarnings,
1229
+ directories: missingDirs.map((dir) => `missing_directory:${dir}`),
1230
+ settings_values: settingWarnings,
1231
+ telemetry: telemetryCheck.warnings,
1232
+ integrity: integrityCheck.warnings,
1233
+ history_drift: historyDriftCheck.warnings,
1234
+ vectorization: vectorizationCheck.warnings
1235
+ };
1236
+ for (const check of checks) {
1237
+ const sources = checkRemediationSources[check.name];
1238
+ if (sources === void 0) {
1239
+ continue;
1240
+ }
1241
+ const remediationMap = buildRemediationMap(sources);
1242
+ if (Object.keys(remediationMap).length > 0) {
1243
+ check.details = { ...check.details, remediation_map: remediationMap };
1244
+ }
1245
+ }
1246
+ const blockingWarnings = normalizedWarnings.filter((warning) => !isAdvisoryHealthWarning(warning));
1247
+ const result = {
1248
+ ok: blockingWarnings.length === 0,
1249
+ checks,
1250
+ warnings: normalizedWarnings,
1251
+ generated_at: nowIso()
1252
+ };
1253
+ if (summaryMode) {
1254
+ return applySummaryHealthProjection(result);
1255
+ }
1256
+ return options.brief === true ? applyBriefHealthProjection(result) : result;
1257
+ }
1258
+ export {
1259
+ runHealth
1260
+ };
1261
+ //# sourceMappingURL=health-IT5DBPRJ.js.map