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