@unbrained/pm-cli 2026.6.6 → 2026.6.8

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 (600) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +79 -0
  4. package/CONTRIBUTING.md +1 -1
  5. package/README.md +6 -2
  6. package/dist/cli/bootstrap-args.js +30 -13
  7. package/dist/cli/bootstrap-args.js.map +1 -1
  8. package/dist/cli/commander-usage.js +74 -4
  9. package/dist/cli/commander-usage.js.map +1 -1
  10. package/dist/cli/commands/aggregate.d.ts +8 -0
  11. package/dist/cli/commands/aggregate.js +84 -7
  12. package/dist/cli/commands/aggregate.js.map +1 -1
  13. package/dist/cli/commands/calendar.js +10 -3
  14. package/dist/cli/commands/calendar.js.map +1 -1
  15. package/dist/cli/commands/close-many.js +20 -11
  16. package/dist/cli/commands/close-many.js.map +1 -1
  17. package/dist/cli/commands/close.d.ts +1 -1
  18. package/dist/cli/commands/close.js +32 -10
  19. package/dist/cli/commands/close.js.map +1 -1
  20. package/dist/cli/commands/comments-audit.js +4 -3
  21. package/dist/cli/commands/comments-audit.js.map +1 -1
  22. package/dist/cli/commands/completion.js +105 -43
  23. package/dist/cli/commands/completion.js.map +1 -1
  24. package/dist/cli/commands/config.d.ts +5 -4
  25. package/dist/cli/commands/config.js +50 -2
  26. package/dist/cli/commands/config.js.map +1 -1
  27. package/dist/cli/commands/contracts.js +4 -3
  28. package/dist/cli/commands/contracts.js.map +1 -1
  29. package/dist/cli/commands/copy.d.ts +14 -0
  30. package/dist/cli/commands/copy.js +153 -0
  31. package/dist/cli/commands/copy.js.map +1 -0
  32. package/dist/cli/commands/extension/doctor.js +62 -2
  33. package/dist/cli/commands/extension/doctor.js.map +1 -1
  34. package/dist/cli/commands/extension/install-sources.d.ts +8 -0
  35. package/dist/cli/commands/extension/install-sources.js +82 -2
  36. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  37. package/dist/cli/commands/extension/scaffold.js +6 -14
  38. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  39. package/dist/cli/commands/extension.d.ts +29 -0
  40. package/dist/cli/commands/extension.js +61 -2
  41. package/dist/cli/commands/extension.js.map +1 -1
  42. package/dist/cli/commands/gc.js +10 -2
  43. package/dist/cli/commands/gc.js.map +1 -1
  44. package/dist/cli/commands/get.d.ts +9 -0
  45. package/dist/cli/commands/get.js +23 -2
  46. package/dist/cli/commands/get.js.map +1 -1
  47. package/dist/cli/commands/health.js +10 -2
  48. package/dist/cli/commands/health.js.map +1 -1
  49. package/dist/cli/commands/history-compact.d.ts +39 -0
  50. package/dist/cli/commands/history-compact.js +262 -0
  51. package/dist/cli/commands/history-compact.js.map +1 -0
  52. package/dist/cli/commands/index.d.ts +3 -1
  53. package/dist/cli/commands/index.js +5 -3
  54. package/dist/cli/commands/index.js.map +1 -1
  55. package/dist/cli/commands/init.d.ts +1 -0
  56. package/dist/cli/commands/init.js +48 -2
  57. package/dist/cli/commands/init.js.map +1 -1
  58. package/dist/cli/commands/list.d.ts +13 -2
  59. package/dist/cli/commands/list.js +189 -9
  60. package/dist/cli/commands/list.js.map +1 -1
  61. package/dist/cli/commands/normalize.js +6 -4
  62. package/dist/cli/commands/normalize.js.map +1 -1
  63. package/dist/cli/commands/reindex.js +8 -4
  64. package/dist/cli/commands/reindex.js.map +1 -1
  65. package/dist/cli/commands/schema.d.ts +13 -2
  66. package/dist/cli/commands/schema.js +66 -12
  67. package/dist/cli/commands/schema.js.map +1 -1
  68. package/dist/cli/commands/search.d.ts +11 -2
  69. package/dist/cli/commands/search.js +321 -35
  70. package/dist/cli/commands/search.js.map +1 -1
  71. package/dist/cli/commands/upgrade.js +4 -12
  72. package/dist/cli/commands/upgrade.js.map +1 -1
  73. package/dist/cli/error-guidance.js +26 -2
  74. package/dist/cli/error-guidance.js.map +1 -1
  75. package/dist/cli/extension-command-help.d.ts +1 -0
  76. package/dist/cli/extension-command-help.js +3 -2
  77. package/dist/cli/extension-command-help.js.map +1 -1
  78. package/dist/cli/help-content.js +10 -2
  79. package/dist/cli/help-content.js.map +1 -1
  80. package/dist/cli/main.d.ts +3 -0
  81. package/dist/cli/main.js +18 -37
  82. package/dist/cli/main.js.map +1 -1
  83. package/dist/cli/register-list-query.js +22 -5
  84. package/dist/cli/register-list-query.js.map +1 -1
  85. package/dist/cli/register-mutation.js +83 -39
  86. package/dist/cli/register-mutation.js.map +1 -1
  87. package/dist/cli/register-operations.js +31 -7
  88. package/dist/cli/register-operations.js.map +1 -1
  89. package/dist/cli/register-setup.js +7 -5
  90. package/dist/cli/register-setup.js.map +1 -1
  91. package/dist/cli/registration-helpers.js +26 -4
  92. package/dist/cli/registration-helpers.js.map +1 -1
  93. package/dist/cli-bundle/chunks/activity-A3QKFSSF.js +16 -0
  94. package/dist/cli-bundle/chunks/{activity-JM6DTDND.js → activity-Q7XMIZIH.js} +11 -11
  95. package/dist/cli-bundle/chunks/{aggregate-VNAHUNNF.js → aggregate-GBSHSXOB.js} +87 -17
  96. package/dist/cli-bundle/chunks/aggregate-GBSHSXOB.js.map +7 -0
  97. package/dist/cli-bundle/chunks/{aggregate-GI7WSZPH.js → aggregate-HKQJZUBG.js} +88 -18
  98. package/dist/cli-bundle/chunks/aggregate-HKQJZUBG.js.map +1 -0
  99. package/dist/cli-bundle/chunks/{append-WMKRXKCE.js → append-3RFOU7P5.js} +8 -8
  100. package/dist/cli-bundle/chunks/{append-7H5N64R2.js → append-OM74OJVT.js} +8 -8
  101. package/dist/cli-bundle/chunks/{chunk-KJE2FOS4.js → chunk-2BYKYPWY.js} +26 -4
  102. package/dist/cli-bundle/chunks/chunk-2BYKYPWY.js.map +7 -0
  103. package/dist/cli-bundle/chunks/{chunk-XTGLRY2Y.js → chunk-2HMD3JM2.js} +6 -6
  104. package/dist/cli-bundle/chunks/{chunk-PRJCELV4.js → chunk-2YPVCD7T.js} +8 -8
  105. package/dist/cli-bundle/chunks/{chunk-3FI4SEFT.js → chunk-3E3MDBTB.js} +62 -38
  106. package/dist/cli-bundle/chunks/chunk-3E3MDBTB.js.map +7 -0
  107. package/dist/cli-bundle/chunks/{chunk-U5SXYXSY.js → chunk-3TXWDGPU.js} +287 -45
  108. package/dist/cli-bundle/chunks/chunk-3TXWDGPU.js.map +7 -0
  109. package/dist/cli-bundle/chunks/{chunk-HZGUAH22.js → chunk-4TI3532H.js} +6 -7
  110. package/dist/cli-bundle/chunks/chunk-4TI3532H.js.map +1 -0
  111. package/dist/cli-bundle/chunks/{chunk-2HVRUSQA.js → chunk-4WYBLB6J.js} +3 -3
  112. package/dist/cli-bundle/chunks/{chunk-R6UFP2GE.js → chunk-5NVJA7IW.js} +7 -7
  113. package/dist/cli-bundle/chunks/{chunk-Q7SPNHLW.js → chunk-5WO2VKFA.js} +190 -16
  114. package/dist/cli-bundle/chunks/chunk-5WO2VKFA.js.map +7 -0
  115. package/dist/cli-bundle/chunks/{chunk-IOR7LGF4.js → chunk-7NQIY7Z6.js} +89 -7
  116. package/dist/cli-bundle/chunks/chunk-7NQIY7Z6.js.map +1 -0
  117. package/dist/cli-bundle/chunks/{chunk-ECCMVXGM.js → chunk-7WXGR44E.js} +305 -216
  118. package/dist/cli-bundle/chunks/chunk-7WXGR44E.js.map +7 -0
  119. package/dist/cli-bundle/chunks/{chunk-XSJCLN2R.js → chunk-AEMKH5WQ.js} +3 -3
  120. package/dist/cli-bundle/chunks/{chunk-WOPXVEZP.js → chunk-ALSRBNYB.js} +28 -9
  121. package/dist/cli-bundle/chunks/chunk-ALSRBNYB.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{chunk-6ER6DXH5.js → chunk-AXBUHLW7.js} +9 -9
  123. package/dist/cli-bundle/chunks/{chunk-BQHUILZS.js → chunk-BFJPMUF5.js} +5 -5
  124. package/dist/cli-bundle/chunks/{chunk-I6BNFU5X.js → chunk-BKQMJXWY.js} +3 -3
  125. package/dist/cli-bundle/chunks/{chunk-XLTD2HN3.js → chunk-CBJXWXI5.js} +2 -2
  126. package/dist/cli-bundle/chunks/{chunk-FRAUKRU2.js → chunk-D7WK2PKB.js} +36 -15
  127. package/dist/cli-bundle/chunks/chunk-D7WK2PKB.js.map +1 -0
  128. package/dist/cli-bundle/chunks/{chunk-PROOHX4K.js → chunk-DV27WDA7.js} +104 -21
  129. package/dist/cli-bundle/chunks/chunk-DV27WDA7.js.map +7 -0
  130. package/dist/cli-bundle/chunks/{chunk-3BWOVLTH.js → chunk-EPWT7BEA.js} +8 -8
  131. package/dist/cli-bundle/chunks/chunk-ETZZU5QF.js +112 -0
  132. package/dist/cli-bundle/chunks/chunk-ETZZU5QF.js.map +1 -0
  133. package/dist/cli-bundle/chunks/{chunk-TPH5XEVD.js → chunk-F33AQIB4.js} +303 -207
  134. package/dist/cli-bundle/chunks/chunk-F33AQIB4.js.map +1 -0
  135. package/dist/cli-bundle/chunks/{chunk-NUZ5HKR4.js → chunk-F33VC5EX.js} +2 -2
  136. package/dist/cli-bundle/chunks/{chunk-WKY2IBOQ.js → chunk-FGRJZVXD.js} +3 -3
  137. package/dist/cli-bundle/chunks/{chunk-77GFDHGF.js → chunk-FO2TYSQZ.js} +2 -2
  138. package/dist/cli-bundle/chunks/{chunk-GXSUPCBV.js → chunk-HOA3GMB6.js} +4 -4
  139. package/dist/cli-bundle/chunks/{chunk-OVQCEJPG.js → chunk-HP35AVFS.js} +2 -2
  140. package/dist/cli-bundle/chunks/{chunk-KJ33AOCY.js → chunk-J4DKAGTM.js} +3 -3
  141. package/dist/cli-bundle/chunks/{chunk-ME2YH6FN.js → chunk-JS47EKLP.js} +7 -7
  142. package/dist/cli-bundle/chunks/{chunk-T3LC5LKB.js → chunk-K62SNVVE.js} +5 -6
  143. package/dist/cli-bundle/chunks/chunk-K62SNVVE.js.map +7 -0
  144. package/dist/cli-bundle/chunks/{chunk-GU2ZJ2VV.js → chunk-KBKJVXUS.js} +35 -14
  145. package/dist/cli-bundle/chunks/chunk-KBKJVXUS.js.map +7 -0
  146. package/dist/cli-bundle/chunks/{chunk-KWU6HG75.js → chunk-KCGMABHM.js} +101 -18
  147. package/dist/cli-bundle/chunks/chunk-KCGMABHM.js.map +1 -0
  148. package/dist/cli-bundle/chunks/{chunk-I2HSTRJF.js → chunk-KN4WSESY.js} +5 -5
  149. package/dist/cli-bundle/chunks/{chunk-RZN6VURO.js → chunk-KP4KIUQT.js} +3 -3
  150. package/dist/cli-bundle/chunks/{chunk-5FDATVEZ.js → chunk-KS2U7BZ3.js} +71 -17
  151. package/dist/cli-bundle/chunks/chunk-KS2U7BZ3.js.map +1 -0
  152. package/dist/cli-bundle/chunks/{chunk-MITFDD35.js → chunk-KVXIQDJG.js} +12 -12
  153. package/dist/cli-bundle/chunks/{chunk-IJGCZSIQ.js → chunk-L3LYL3ID.js} +12 -12
  154. package/dist/cli-bundle/chunks/{chunk-AO442XLN.js → chunk-M7UBTVFT.js} +10 -6
  155. package/dist/cli-bundle/chunks/{chunk-AO442XLN.js.map → chunk-M7UBTVFT.js.map} +2 -2
  156. package/dist/cli-bundle/chunks/{chunk-UM2GBHS4.js → chunk-MSH23UWO.js} +4 -4
  157. package/dist/cli-bundle/chunks/{chunk-LCM63IXU.js → chunk-N4SQZ7L3.js} +2 -2
  158. package/dist/cli-bundle/chunks/{chunk-3VAM3NNM.js → chunk-NDSMKB2I.js} +3 -3
  159. package/dist/cli-bundle/chunks/{chunk-6P6GGMOG.js → chunk-NGEEXR2R.js} +2 -2
  160. package/dist/cli-bundle/chunks/{chunk-PO3GSVFV.js → chunk-NLVCMVC7.js} +2 -2
  161. package/dist/cli-bundle/chunks/{chunk-N7ACFE26.js → chunk-NUKHZZNM.js} +3 -3
  162. package/dist/cli-bundle/chunks/{chunk-GGYWB3Y2.js → chunk-ODN53S6H.js} +6 -6
  163. package/dist/cli-bundle/chunks/{chunk-23YFZ3IG.js → chunk-OTY2YEH5.js} +14 -14
  164. package/dist/cli-bundle/chunks/{chunk-2RSPZI5H.js → chunk-OVSSE2JP.js} +8 -8
  165. package/dist/cli-bundle/chunks/{chunk-4LL6TK5B.js → chunk-PQDH3S54.js} +59 -35
  166. package/dist/cli-bundle/chunks/chunk-PQDH3S54.js.map +1 -0
  167. package/dist/cli-bundle/chunks/{chunk-2VVCGBNV.js → chunk-QF4OPBAG.js} +9 -9
  168. package/dist/cli-bundle/chunks/{chunk-QO7EBBOM.js → chunk-QFVASU44.js} +38 -7
  169. package/dist/cli-bundle/chunks/chunk-QFVASU44.js.map +7 -0
  170. package/dist/cli-bundle/chunks/{chunk-WSMOSYRD.js → chunk-QQPZYP73.js} +14 -14
  171. package/dist/cli-bundle/chunks/{chunk-OZ7NSQHL.js → chunk-QWNUDGFQ.js} +8 -8
  172. package/dist/cli-bundle/chunks/{chunk-AY43SBIN.js → chunk-R4XIE7NQ.js} +54 -8
  173. package/dist/cli-bundle/chunks/chunk-R4XIE7NQ.js.map +1 -0
  174. package/dist/cli-bundle/chunks/{chunk-52MAOQ6J.js → chunk-RISLL7XH.js} +71 -17
  175. package/dist/cli-bundle/chunks/chunk-RISLL7XH.js.map +7 -0
  176. package/dist/cli-bundle/chunks/{chunk-GCOQW437.js → chunk-SDLEYY6A.js} +3 -3
  177. package/dist/cli-bundle/chunks/{chunk-W7XABV4H.js → chunk-SM3RMWGO.js} +191 -17
  178. package/dist/cli-bundle/chunks/chunk-SM3RMWGO.js.map +1 -0
  179. package/dist/cli-bundle/chunks/{chunk-PIU6RSL3.js → chunk-TBLBEOEX.js} +9 -9
  180. package/dist/cli-bundle/chunks/{chunk-SKJWX3QB.js → chunk-TXKENAQP.js} +88 -6
  181. package/dist/cli-bundle/chunks/chunk-TXKENAQP.js.map +7 -0
  182. package/dist/cli-bundle/chunks/{chunk-YL2DJGYS.js → chunk-UEXNNF3K.js} +7 -7
  183. package/dist/cli-bundle/chunks/{chunk-UBOPJT3S.js → chunk-UMMJAJB2.js} +9 -9
  184. package/dist/cli-bundle/chunks/chunk-URJEZOLB.js +115 -0
  185. package/dist/cli-bundle/chunks/chunk-URJEZOLB.js.map +7 -0
  186. package/dist/cli-bundle/chunks/{chunk-PDDFYW4X.js → chunk-VXBUXLVD.js} +27 -8
  187. package/dist/cli-bundle/chunks/chunk-VXBUXLVD.js.map +7 -0
  188. package/dist/cli-bundle/chunks/{chunk-LB3RUL2N.js → chunk-XEKZCBCS.js} +10 -6
  189. package/dist/cli-bundle/chunks/chunk-XEKZCBCS.js.map +1 -0
  190. package/dist/cli-bundle/chunks/{chunk-KAG77BY3.js → chunk-XLSQ3QLT.js} +2 -2
  191. package/dist/cli-bundle/chunks/{chunk-E5FJNAZA.js → chunk-XNGMIVQY.js} +3 -3
  192. package/dist/cli-bundle/chunks/{chunk-TCD3R2PF.js → chunk-XZS4MV37.js} +39 -8
  193. package/dist/cli-bundle/chunks/chunk-XZS4MV37.js.map +1 -0
  194. package/dist/cli-bundle/chunks/{chunk-RWPSOIEE.js → chunk-YEFOCDIK.js} +7 -7
  195. package/dist/cli-bundle/chunks/{chunk-5SFCOO6B.js → chunk-YJAKN2N2.js} +277 -35
  196. package/dist/cli-bundle/chunks/chunk-YJAKN2N2.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{chunk-2VBQ6ZXS.js → chunk-Z2HXAFFH.js} +27 -5
  198. package/dist/cli-bundle/chunks/chunk-Z2HXAFFH.js.map +1 -0
  199. package/dist/cli-bundle/chunks/{chunk-3LB74A67.js → chunk-Z55JACL2.js} +53 -7
  200. package/dist/cli-bundle/chunks/chunk-Z55JACL2.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{claim-4DBF6RVG.js → claim-NHBIIBOW.js} +10 -10
  202. package/dist/cli-bundle/chunks/{claim-X2P4IB7J.js → claim-RNEBQCOO.js} +10 -10
  203. package/dist/cli-bundle/chunks/close-UNTFXVM3.js +13 -0
  204. package/dist/cli-bundle/chunks/{close-PTYFA45H.js → close-ZMXL2WDS.js} +8 -8
  205. package/dist/cli-bundle/chunks/{close-many-ERFO6LHR.js → close-many-CDPQGQUB.js} +37 -28
  206. package/dist/cli-bundle/chunks/close-many-CDPQGQUB.js.map +1 -0
  207. package/dist/cli-bundle/chunks/{close-many-7CGIDPTJ.js → close-many-IQV5C2SI.js} +36 -27
  208. package/dist/cli-bundle/chunks/close-many-IQV5C2SI.js.map +7 -0
  209. package/dist/cli-bundle/chunks/{comments-QKBYCWKD.js → comments-EFVBHWPT.js} +10 -10
  210. package/dist/cli-bundle/chunks/{comments-OONGABK5.js → comments-J5Q4IJPH.js} +10 -10
  211. package/dist/cli-bundle/chunks/{config-6FXCQKIF.js → config-72253M2O.js} +127 -12
  212. package/dist/cli-bundle/chunks/config-72253M2O.js.map +1 -0
  213. package/dist/cli-bundle/chunks/{config-U4RZ4CQB.js → config-VFYA6BMI.js} +128 -13
  214. package/dist/cli-bundle/chunks/config-VFYA6BMI.js.map +7 -0
  215. package/dist/cli-bundle/chunks/{context-FYYJGFWS.js → context-AVLO4IFH.js} +14 -14
  216. package/dist/cli-bundle/chunks/{context-FYYJGFWS.js.map → context-AVLO4IFH.js.map} +2 -2
  217. package/dist/cli-bundle/chunks/{context-YMJ3Z2HQ.js → context-WMSI2D65.js} +15 -15
  218. package/dist/cli-bundle/chunks/context-WMSI2D65.js.map +1 -0
  219. package/dist/cli-bundle/chunks/{contracts-RFSPGVVJ.js → contracts-D4BN3VSQ.js} +7 -5
  220. package/dist/cli-bundle/chunks/contracts-D4BN3VSQ.js.map +7 -0
  221. package/dist/cli-bundle/chunks/{contracts-QDB6OMLQ.js → contracts-RGPOBLPL.js} +8 -6
  222. package/dist/cli-bundle/chunks/contracts-RGPOBLPL.js.map +1 -0
  223. package/dist/cli-bundle/chunks/copy-H6TXHK7S.js +185 -0
  224. package/dist/cli-bundle/chunks/copy-H6TXHK7S.js.map +7 -0
  225. package/dist/cli-bundle/chunks/copy-WXE3OOLZ.js +182 -0
  226. package/dist/cli-bundle/chunks/copy-WXE3OOLZ.js.map +1 -0
  227. package/dist/cli-bundle/chunks/create-EZWAMUKR.js +27 -0
  228. package/dist/cli-bundle/chunks/{create-I5L4EYYZ.js → create-PUAIJEZ7.js} +13 -13
  229. package/dist/cli-bundle/chunks/{delete-7HPGI4GZ.js → delete-PKR2JHLH.js} +7 -7
  230. package/dist/cli-bundle/chunks/{delete-VXUPH5RS.js → delete-WBME6WG5.js} +7 -7
  231. package/dist/cli-bundle/chunks/{deps-JSRRWC3Z.js → deps-4BQEDV4L.js} +7 -7
  232. package/dist/cli-bundle/chunks/{deps-SCZIFK2Z.js → deps-KWHQRO75.js} +7 -7
  233. package/dist/cli-bundle/chunks/{docs-GJK6K4VP.js → docs-364GT3ZR.js} +9 -9
  234. package/dist/cli-bundle/chunks/{docs-WW4N3MBM.js → docs-SCNBUGSV.js} +9 -9
  235. package/dist/cli-bundle/chunks/{extension-VDY2U33M.js → extension-CRE7JM47.js} +8 -6
  236. package/dist/cli-bundle/chunks/{extension-J7IBMFTD.js → extension-KK2UPXJD.js} +8 -6
  237. package/dist/cli-bundle/chunks/{files-ISZJGILQ.js → files-3GESQAWL.js} +9 -9
  238. package/dist/cli-bundle/chunks/{files-WKOD326U.js → files-66EHM5ZR.js} +9 -9
  239. package/dist/cli-bundle/chunks/{gc-JDVJ6OQ2.js → gc-D5IWOKQH.js} +13 -5
  240. package/dist/cli-bundle/chunks/gc-D5IWOKQH.js.map +1 -0
  241. package/dist/cli-bundle/chunks/{gc-ULPVWMTN.js → gc-MOQDND5J.js} +12 -4
  242. package/dist/cli-bundle/chunks/gc-MOQDND5J.js.map +7 -0
  243. package/dist/cli-bundle/chunks/{get-RV37HT3G.js → get-7J2ZCBV5.js} +34 -12
  244. package/dist/cli-bundle/chunks/get-7J2ZCBV5.js.map +1 -0
  245. package/dist/cli-bundle/chunks/{get-WXU6WI5P.js → get-WXSLXV3K.js} +33 -11
  246. package/dist/cli-bundle/chunks/get-WXSLXV3K.js.map +7 -0
  247. package/dist/cli-bundle/chunks/{health-LOI2HHKB.js → health-B6AEM7BV.js} +21 -13
  248. package/dist/cli-bundle/chunks/health-B6AEM7BV.js.map +1 -0
  249. package/dist/cli-bundle/chunks/{health-6L6EH4WR.js → health-YMZGOMVX.js} +20 -12
  250. package/dist/cli-bundle/chunks/health-YMZGOMVX.js.map +7 -0
  251. package/dist/cli-bundle/chunks/{history-PKN67D5O.js → history-TJTO5GCR.js} +10 -10
  252. package/dist/cli-bundle/chunks/history-ZERISU2L.js +20 -0
  253. package/dist/cli-bundle/chunks/history-compact-CKNN6UKW.js +290 -0
  254. package/dist/cli-bundle/chunks/history-compact-CKNN6UKW.js.map +7 -0
  255. package/dist/cli-bundle/chunks/history-compact-N2Q7IR3T.js +287 -0
  256. package/dist/cli-bundle/chunks/history-compact-N2Q7IR3T.js.map +1 -0
  257. package/dist/cli-bundle/chunks/history-redact-GODBYT5A.js +19 -0
  258. package/dist/cli-bundle/chunks/{history-redact-V4FOJGS7.js → history-redact-JUXUOH54.js} +11 -11
  259. package/dist/cli-bundle/chunks/{history-repair-HIBCBIKK.js → history-repair-CCCPBNTF.js} +11 -11
  260. package/dist/cli-bundle/chunks/{history-repair-SDMHR7JT.js → history-repair-TDBBSRVK.js} +11 -11
  261. package/dist/cli-bundle/chunks/{init-P56QYWJF.js → init-6ZPKD3YN.js} +9 -8
  262. package/dist/cli-bundle/chunks/init-CBZHXBR3.js +17 -0
  263. package/dist/cli-bundle/chunks/{learnings-MIXSESLK.js → learnings-U7U2FNIO.js} +10 -10
  264. package/dist/cli-bundle/chunks/{learnings-GDFRG5J7.js → learnings-WYNTYQ5T.js} +10 -10
  265. package/dist/cli-bundle/chunks/list-7MTPPZHC.js +20 -0
  266. package/dist/cli-bundle/chunks/{list-FGOWQMSM.js → list-JGP7ODML.js} +10 -10
  267. package/dist/cli-bundle/chunks/{notes-5UK3GEH2.js → notes-P25YVTEG.js} +10 -10
  268. package/dist/cli-bundle/chunks/{notes-4XVSH2AZ.js → notes-QIF6A7XS.js} +10 -10
  269. package/dist/cli-bundle/chunks/{plan-DUMBV3QB.js → plan-RACB5PI6.js} +13 -13
  270. package/dist/cli-bundle/chunks/{plan-SLMODHWX.js → plan-SSBJFWXA.js} +13 -13
  271. package/dist/cli-bundle/chunks/{register-list-query-POCFZ5JW.js → register-list-query-5IXDPUZ6.js} +31 -25
  272. package/dist/cli-bundle/chunks/register-list-query-5IXDPUZ6.js.map +1 -0
  273. package/dist/cli-bundle/chunks/{register-list-query-WST76HSQ.js → register-list-query-GQAEIG4K.js} +30 -24
  274. package/dist/cli-bundle/chunks/register-list-query-GQAEIG4K.js.map +7 -0
  275. package/dist/cli-bundle/chunks/{register-mutation-N5GSUZJV.js → register-mutation-FAS4YG63.js} +72 -50
  276. package/dist/cli-bundle/chunks/register-mutation-FAS4YG63.js.map +1 -0
  277. package/dist/cli-bundle/chunks/{register-mutation-OA675SOU.js → register-mutation-YZCUILGO.js} +71 -49
  278. package/dist/cli-bundle/chunks/register-mutation-YZCUILGO.js.map +7 -0
  279. package/dist/cli-bundle/chunks/{register-operations-N3PMHXH5.js → register-operations-IBYWNJN5.js} +57 -34
  280. package/dist/cli-bundle/chunks/register-operations-IBYWNJN5.js.map +7 -0
  281. package/dist/cli-bundle/chunks/{register-operations-GNHBE5I3.js → register-operations-S2BOLUPF.js} +58 -35
  282. package/dist/cli-bundle/chunks/register-operations-S2BOLUPF.js.map +1 -0
  283. package/dist/cli-bundle/chunks/{register-setup-ZHJI2DI3.js → register-setup-ABA2JPWO.js} +20 -19
  284. package/dist/cli-bundle/chunks/{register-setup-ZHJI2DI3.js.map → register-setup-ABA2JPWO.js.map} +2 -2
  285. package/dist/cli-bundle/chunks/{register-setup-JIMPKJKV.js → register-setup-JRZ4UMWZ.js} +21 -20
  286. package/dist/cli-bundle/chunks/register-setup-JRZ4UMWZ.js.map +1 -0
  287. package/dist/cli-bundle/chunks/restore-3JRX27QW.js +17 -0
  288. package/dist/cli-bundle/chunks/{restore-PBL6T5TW.js → restore-K72ZNPEP.js} +11 -11
  289. package/dist/cli-bundle/chunks/{schema-2NOO6NGB.js → schema-3VKRDBLC.js} +76 -20
  290. package/dist/cli-bundle/chunks/schema-3VKRDBLC.js.map +7 -0
  291. package/dist/cli-bundle/chunks/{schema-EBI4NLUO.js → schema-UL4B2JX5.js} +77 -21
  292. package/dist/cli-bundle/chunks/schema-UL4B2JX5.js.map +1 -0
  293. package/dist/cli-bundle/chunks/{search-OA6JX27A.js → search-632WJ7GO.js} +516 -41
  294. package/dist/cli-bundle/chunks/search-632WJ7GO.js.map +7 -0
  295. package/dist/cli-bundle/chunks/{search-JPUQTVCY.js → search-EQDHSE4G.js} +510 -42
  296. package/dist/cli-bundle/chunks/search-EQDHSE4G.js.map +1 -0
  297. package/dist/cli-bundle/chunks/{stats-XYB6KTFG.js → stats-O4UTMJMC.js} +7 -7
  298. package/dist/cli-bundle/chunks/{stats-CV54BAWY.js → stats-WLJ3XBF5.js} +7 -7
  299. package/dist/cli-bundle/chunks/{telemetry-LMJ7PFUO.js → telemetry-EUVHFSQU.js} +4 -4
  300. package/dist/cli-bundle/chunks/{telemetry-NCMEPJNR.js → telemetry-NRVWX25E.js} +4 -4
  301. package/dist/cli-bundle/chunks/{test-WBROAJIE.js → test-GXUBQNUC.js} +14 -13
  302. package/dist/cli-bundle/chunks/test-XN7RJL5Z.js +32 -0
  303. package/dist/cli-bundle/chunks/{test-all-N6NSRDTV.js → test-all-UTFXC7S2.js} +16 -15
  304. package/dist/cli-bundle/chunks/{test-all-N6NSRDTV.js.map → test-all-UTFXC7S2.js.map} +1 -1
  305. package/dist/cli-bundle/chunks/{test-all-NTOZ7C3M.js → test-all-XM6OKI3L.js} +14 -13
  306. package/dist/cli-bundle/chunks/{test-all-NTOZ7C3M.js.map → test-all-XM6OKI3L.js.map} +1 -1
  307. package/dist/cli-bundle/chunks/{test-runs-V6A7LPWZ.js → test-runs-7FHCPEA3.js} +5 -5
  308. package/dist/cli-bundle/chunks/{test-runs-WMVTQU3Y.js → test-runs-IK6E2HNX.js} +5 -5
  309. package/dist/cli-bundle/chunks/update-LFBSEW3N.js +21 -0
  310. package/dist/cli-bundle/chunks/update-U4B4OMHZ.js +25 -0
  311. package/dist/cli-bundle/chunks/{update-many-KGGEYABR.js → update-many-5KD33MKY.js} +22 -22
  312. package/dist/cli-bundle/chunks/{update-many-EM6OXYGO.js → update-many-N3YTM7K4.js} +22 -22
  313. package/dist/cli-bundle/chunks/{upgrade-BLI7XBAJ.js → upgrade-5SRFLUNW.js} +8 -14
  314. package/dist/cli-bundle/chunks/upgrade-5SRFLUNW.js.map +7 -0
  315. package/dist/cli-bundle/chunks/{upgrade-LXPOQKFV.js → upgrade-FFXGO43H.js} +9 -15
  316. package/dist/cli-bundle/chunks/upgrade-FFXGO43H.js.map +1 -0
  317. package/dist/cli-bundle/chunks/{validate-L5J6A7YO.js → validate-CRWXZILW.js} +20 -19
  318. package/dist/cli-bundle/chunks/{validate-L5J6A7YO.js.map → validate-CRWXZILW.js.map} +1 -1
  319. package/dist/cli-bundle/chunks/{validate-AGOAUOVW.js → validate-T3LPWSZG.js} +18 -17
  320. package/dist/cli-bundle/chunks/{validate-AGOAUOVW.js.map → validate-T3LPWSZG.js.map} +1 -1
  321. package/dist/cli-bundle/main.js +160 -87
  322. package/dist/cli-bundle/main.js.map +3 -3
  323. package/dist/core/config/nested-settings.d.ts +8 -8
  324. package/dist/core/config/nested-settings.js +71 -7
  325. package/dist/core/config/nested-settings.js.map +1 -1
  326. package/dist/core/config/positional-value.js +4 -2
  327. package/dist/core/config/positional-value.js.map +1 -1
  328. package/dist/core/diagnostics/remediation.js +7 -2
  329. package/dist/core/diagnostics/remediation.js.map +1 -1
  330. package/dist/core/extensions/extension-types.d.ts +36 -0
  331. package/dist/core/extensions/extension-types.js +2 -2
  332. package/dist/core/extensions/extension-types.js.map +1 -1
  333. package/dist/core/extensions/loader.js +46 -5
  334. package/dist/core/extensions/loader.js.map +1 -1
  335. package/dist/core/fs/fs-utils.js +29 -4
  336. package/dist/core/fs/fs-utils.js.map +1 -1
  337. package/dist/core/history/drift-scan.d.ts +3 -4
  338. package/dist/core/history/drift-scan.js +71 -18
  339. package/dist/core/history/drift-scan.js.map +1 -1
  340. package/dist/core/item/id.js +4 -5
  341. package/dist/core/item/id.js.map +1 -1
  342. package/dist/core/item/item-format.js +7 -3
  343. package/dist/core/item/item-format.js.map +1 -1
  344. package/dist/core/item/toon-decode.d.ts +7 -0
  345. package/dist/core/item/toon-decode.js +11 -2
  346. package/dist/core/item/toon-decode.js.map +1 -1
  347. package/dist/core/item/type-registry.js +25 -7
  348. package/dist/core/item/type-registry.js.map +1 -1
  349. package/dist/core/packages/root.d.ts +10 -0
  350. package/dist/core/packages/root.js +24 -2
  351. package/dist/core/packages/root.js.map +1 -1
  352. package/dist/core/schema/runtime-schema.js +3 -6
  353. package/dist/core/schema/runtime-schema.js.map +1 -1
  354. package/dist/core/search/background-refresh.d.ts +0 -8
  355. package/dist/core/search/background-refresh.js +2 -9
  356. package/dist/core/search/background-refresh.js.map +1 -1
  357. package/dist/core/search/cache.js +5 -3
  358. package/dist/core/search/cache.js.map +1 -1
  359. package/dist/core/search/corpus.d.ts +6 -0
  360. package/dist/core/search/corpus.js +22 -9
  361. package/dist/core/search/corpus.js.map +1 -1
  362. package/dist/core/search/embedding-batches.js +10 -7
  363. package/dist/core/search/embedding-batches.js.map +1 -1
  364. package/dist/core/search/relevance.d.ts +29 -0
  365. package/dist/core/search/relevance.js +226 -0
  366. package/dist/core/search/relevance.js.map +1 -0
  367. package/dist/core/search/vector-stores.d.ts +3 -0
  368. package/dist/core/search/vector-stores.js +27 -16
  369. package/dist/core/search/vector-stores.js.map +1 -1
  370. package/dist/core/sentry/instrument.js +4 -17
  371. package/dist/core/sentry/instrument.js.map +1 -1
  372. package/dist/core/shared/constants.js +15 -2
  373. package/dist/core/shared/constants.js.map +1 -1
  374. package/dist/core/shared/errors.d.ts +6 -0
  375. package/dist/core/shared/errors.js +2 -2
  376. package/dist/core/shared/errors.js.map +1 -1
  377. package/dist/core/shared/primitives.d.ts +8 -0
  378. package/dist/core/shared/primitives.js +29 -2
  379. package/dist/core/shared/primitives.js.map +1 -1
  380. package/dist/core/shared/time.js +42 -6
  381. package/dist/core/shared/time.js.map +1 -1
  382. package/dist/core/store/paths.js +40 -8
  383. package/dist/core/store/paths.js.map +1 -1
  384. package/dist/core/store/settings-validator.d.ts +11 -0
  385. package/dist/core/store/settings-validator.js +14 -2
  386. package/dist/core/store/settings-validator.js.map +1 -1
  387. package/dist/core/store/settings.js +109 -12
  388. package/dist/core/store/settings.js.map +1 -1
  389. package/dist/core/telemetry/runtime.d.ts +1 -0
  390. package/dist/core/telemetry/runtime.js +86 -5
  391. package/dist/core/telemetry/runtime.js.map +1 -1
  392. package/dist/mcp/server.js +109 -19
  393. package/dist/mcp/server.js.map +1 -1
  394. package/dist/sdk/cli-contracts/commander-types.d.ts +1 -0
  395. package/dist/sdk/cli-contracts/commander-types.js +15 -4
  396. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  397. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  398. package/dist/sdk/cli-contracts/enum-contracts.js +6 -2
  399. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  400. package/dist/sdk/cli-contracts/tool-option-contracts.js +7 -2
  401. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  402. package/dist/sdk/cli-contracts/tool-parameter-tables.js +32 -3
  403. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  404. package/dist/sdk/cli-contracts.d.ts +3 -1
  405. package/dist/sdk/cli-contracts.js +44 -12
  406. package/dist/sdk/cli-contracts.js.map +1 -1
  407. package/dist/sdk/index.d.ts +2 -2
  408. package/dist/sdk/index.js +3 -3
  409. package/dist/sdk/index.js.map +1 -1
  410. package/dist/sdk/testing.d.ts +51 -1
  411. package/dist/sdk/testing.js +93 -2
  412. package/dist/sdk/testing.js.map +1 -1
  413. package/dist/types.d.ts +14 -0
  414. package/dist/types.js +2 -2
  415. package/dist/types.js.map +1 -1
  416. package/docs/AGENT_GUIDE.md +3 -1
  417. package/docs/CLAUDE_CODE_PLUGIN.md +4 -4
  418. package/docs/CODEX_PLUGIN.md +1 -1
  419. package/docs/COMMANDS.md +14 -5
  420. package/docs/CONFIGURATION.md +28 -1
  421. package/docs/EXTENSIONS.md +17 -9
  422. package/docs/QUICKSTART.md +1 -1
  423. package/docs/RELEASING.md +17 -0
  424. package/docs/SDK.md +66 -0
  425. package/docs/TESTING.md +14 -0
  426. package/marketplace.json +1 -1
  427. package/package.json +2 -1
  428. package/packages/pm-governance-audit/README.md +14 -0
  429. package/packages/pm-governance-audit/extensions/governance-audit/index.js +39 -1
  430. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +40 -2
  431. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +1 -1
  432. package/packages/pm-governance-audit/package.json +4 -2
  433. package/packages/pm-lifecycle-hooks/README.md +21 -0
  434. package/packages/pm-search-advanced/README.md +38 -0
  435. package/packages/pm-search-advanced/extensions/search-advanced/index.js +17 -0
  436. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +17 -0
  437. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +216 -1
  438. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +271 -2
  439. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  440. package/plugins/pm-claude/README.md +7 -7
  441. package/plugins/pm-claude/commands/pm-init.md +1 -1
  442. package/plugins/pm-codex/README.md +1 -1
  443. package/dist/cli-bundle/chunks/activity-CVXTCHYY.js +0 -16
  444. package/dist/cli-bundle/chunks/aggregate-GI7WSZPH.js.map +0 -1
  445. package/dist/cli-bundle/chunks/aggregate-VNAHUNNF.js.map +0 -7
  446. package/dist/cli-bundle/chunks/chunk-2VBQ6ZXS.js.map +0 -1
  447. package/dist/cli-bundle/chunks/chunk-3FI4SEFT.js.map +0 -7
  448. package/dist/cli-bundle/chunks/chunk-3LB74A67.js.map +0 -7
  449. package/dist/cli-bundle/chunks/chunk-4LL6TK5B.js.map +0 -1
  450. package/dist/cli-bundle/chunks/chunk-52MAOQ6J.js.map +0 -7
  451. package/dist/cli-bundle/chunks/chunk-5FDATVEZ.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-5SFCOO6B.js.map +0 -1
  453. package/dist/cli-bundle/chunks/chunk-AY43SBIN.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-ECCMVXGM.js.map +0 -7
  455. package/dist/cli-bundle/chunks/chunk-FRAUKRU2.js.map +0 -1
  456. package/dist/cli-bundle/chunks/chunk-GU2ZJ2VV.js.map +0 -7
  457. package/dist/cli-bundle/chunks/chunk-HZGUAH22.js.map +0 -1
  458. package/dist/cli-bundle/chunks/chunk-IOR7LGF4.js.map +0 -1
  459. package/dist/cli-bundle/chunks/chunk-KJE2FOS4.js.map +0 -7
  460. package/dist/cli-bundle/chunks/chunk-KWU6HG75.js.map +0 -1
  461. package/dist/cli-bundle/chunks/chunk-LB3RUL2N.js.map +0 -1
  462. package/dist/cli-bundle/chunks/chunk-PDDFYW4X.js.map +0 -7
  463. package/dist/cli-bundle/chunks/chunk-PROOHX4K.js.map +0 -7
  464. package/dist/cli-bundle/chunks/chunk-Q7SPNHLW.js.map +0 -7
  465. package/dist/cli-bundle/chunks/chunk-QO7EBBOM.js.map +0 -7
  466. package/dist/cli-bundle/chunks/chunk-SKJWX3QB.js.map +0 -7
  467. package/dist/cli-bundle/chunks/chunk-T3LC5LKB.js.map +0 -7
  468. package/dist/cli-bundle/chunks/chunk-TCD3R2PF.js.map +0 -1
  469. package/dist/cli-bundle/chunks/chunk-TPH5XEVD.js.map +0 -1
  470. package/dist/cli-bundle/chunks/chunk-U5SXYXSY.js.map +0 -7
  471. package/dist/cli-bundle/chunks/chunk-W7XABV4H.js.map +0 -1
  472. package/dist/cli-bundle/chunks/chunk-WOPXVEZP.js.map +0 -1
  473. package/dist/cli-bundle/chunks/close-3HDWDA3L.js +0 -13
  474. package/dist/cli-bundle/chunks/close-many-7CGIDPTJ.js.map +0 -7
  475. package/dist/cli-bundle/chunks/close-many-ERFO6LHR.js.map +0 -1
  476. package/dist/cli-bundle/chunks/config-6FXCQKIF.js.map +0 -1
  477. package/dist/cli-bundle/chunks/config-U4RZ4CQB.js.map +0 -7
  478. package/dist/cli-bundle/chunks/context-YMJ3Z2HQ.js.map +0 -1
  479. package/dist/cli-bundle/chunks/contracts-QDB6OMLQ.js.map +0 -1
  480. package/dist/cli-bundle/chunks/contracts-RFSPGVVJ.js.map +0 -7
  481. package/dist/cli-bundle/chunks/create-JTZNCTQC.js +0 -27
  482. package/dist/cli-bundle/chunks/gc-JDVJ6OQ2.js.map +0 -1
  483. package/dist/cli-bundle/chunks/gc-ULPVWMTN.js.map +0 -7
  484. package/dist/cli-bundle/chunks/get-RV37HT3G.js.map +0 -1
  485. package/dist/cli-bundle/chunks/get-WXU6WI5P.js.map +0 -7
  486. package/dist/cli-bundle/chunks/health-6L6EH4WR.js.map +0 -7
  487. package/dist/cli-bundle/chunks/health-LOI2HHKB.js.map +0 -1
  488. package/dist/cli-bundle/chunks/history-2BA3T5AE.js +0 -20
  489. package/dist/cli-bundle/chunks/history-redact-JBZNXHGR.js +0 -19
  490. package/dist/cli-bundle/chunks/init-HIVSNX3O.js +0 -16
  491. package/dist/cli-bundle/chunks/list-MUSQNMTD.js +0 -20
  492. package/dist/cli-bundle/chunks/register-list-query-POCFZ5JW.js.map +0 -1
  493. package/dist/cli-bundle/chunks/register-list-query-WST76HSQ.js.map +0 -7
  494. package/dist/cli-bundle/chunks/register-mutation-N5GSUZJV.js.map +0 -1
  495. package/dist/cli-bundle/chunks/register-mutation-OA675SOU.js.map +0 -7
  496. package/dist/cli-bundle/chunks/register-operations-GNHBE5I3.js.map +0 -1
  497. package/dist/cli-bundle/chunks/register-operations-N3PMHXH5.js.map +0 -7
  498. package/dist/cli-bundle/chunks/register-setup-JIMPKJKV.js.map +0 -1
  499. package/dist/cli-bundle/chunks/restore-D4RGNX33.js +0 -17
  500. package/dist/cli-bundle/chunks/schema-2NOO6NGB.js.map +0 -7
  501. package/dist/cli-bundle/chunks/schema-EBI4NLUO.js.map +0 -1
  502. package/dist/cli-bundle/chunks/search-JPUQTVCY.js.map +0 -1
  503. package/dist/cli-bundle/chunks/search-OA6JX27A.js.map +0 -7
  504. package/dist/cli-bundle/chunks/test-MXX3E5JL.js +0 -31
  505. package/dist/cli-bundle/chunks/update-OSV3NAQB.js +0 -25
  506. package/dist/cli-bundle/chunks/update-YRXSUGYQ.js +0 -21
  507. package/dist/cli-bundle/chunks/upgrade-BLI7XBAJ.js.map +0 -7
  508. package/dist/cli-bundle/chunks/upgrade-LXPOQKFV.js.map +0 -1
  509. /package/dist/cli-bundle/chunks/{activity-CVXTCHYY.js.map → activity-A3QKFSSF.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{activity-JM6DTDND.js.map → activity-Q7XMIZIH.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{append-WMKRXKCE.js.map → append-3RFOU7P5.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{append-7H5N64R2.js.map → append-OM74OJVT.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{chunk-XTGLRY2Y.js.map → chunk-2HMD3JM2.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{chunk-PRJCELV4.js.map → chunk-2YPVCD7T.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{chunk-2HVRUSQA.js.map → chunk-4WYBLB6J.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{chunk-R6UFP2GE.js.map → chunk-5NVJA7IW.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{chunk-XSJCLN2R.js.map → chunk-AEMKH5WQ.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{chunk-6ER6DXH5.js.map → chunk-AXBUHLW7.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{chunk-BQHUILZS.js.map → chunk-BFJPMUF5.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{chunk-I6BNFU5X.js.map → chunk-BKQMJXWY.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{chunk-XLTD2HN3.js.map → chunk-CBJXWXI5.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{chunk-3BWOVLTH.js.map → chunk-EPWT7BEA.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{chunk-NUZ5HKR4.js.map → chunk-F33VC5EX.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{chunk-WKY2IBOQ.js.map → chunk-FGRJZVXD.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{chunk-77GFDHGF.js.map → chunk-FO2TYSQZ.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{chunk-GXSUPCBV.js.map → chunk-HOA3GMB6.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{chunk-OVQCEJPG.js.map → chunk-HP35AVFS.js.map} +0 -0
  528. /package/dist/cli-bundle/chunks/{chunk-KJ33AOCY.js.map → chunk-J4DKAGTM.js.map} +0 -0
  529. /package/dist/cli-bundle/chunks/{chunk-ME2YH6FN.js.map → chunk-JS47EKLP.js.map} +0 -0
  530. /package/dist/cli-bundle/chunks/{chunk-I2HSTRJF.js.map → chunk-KN4WSESY.js.map} +0 -0
  531. /package/dist/cli-bundle/chunks/{chunk-RZN6VURO.js.map → chunk-KP4KIUQT.js.map} +0 -0
  532. /package/dist/cli-bundle/chunks/{chunk-MITFDD35.js.map → chunk-KVXIQDJG.js.map} +0 -0
  533. /package/dist/cli-bundle/chunks/{chunk-IJGCZSIQ.js.map → chunk-L3LYL3ID.js.map} +0 -0
  534. /package/dist/cli-bundle/chunks/{chunk-UM2GBHS4.js.map → chunk-MSH23UWO.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{chunk-LCM63IXU.js.map → chunk-N4SQZ7L3.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{chunk-3VAM3NNM.js.map → chunk-NDSMKB2I.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{chunk-6P6GGMOG.js.map → chunk-NGEEXR2R.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{chunk-PO3GSVFV.js.map → chunk-NLVCMVC7.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{chunk-N7ACFE26.js.map → chunk-NUKHZZNM.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{chunk-GGYWB3Y2.js.map → chunk-ODN53S6H.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-23YFZ3IG.js.map → chunk-OTY2YEH5.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-2RSPZI5H.js.map → chunk-OVSSE2JP.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-2VVCGBNV.js.map → chunk-QF4OPBAG.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-WSMOSYRD.js.map → chunk-QQPZYP73.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-OZ7NSQHL.js.map → chunk-QWNUDGFQ.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-GCOQW437.js.map → chunk-SDLEYY6A.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-PIU6RSL3.js.map → chunk-TBLBEOEX.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-YL2DJGYS.js.map → chunk-UEXNNF3K.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-UBOPJT3S.js.map → chunk-UMMJAJB2.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-KAG77BY3.js.map → chunk-XLSQ3QLT.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-E5FJNAZA.js.map → chunk-XNGMIVQY.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-RWPSOIEE.js.map → chunk-YEFOCDIK.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{claim-4DBF6RVG.js.map → claim-NHBIIBOW.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{claim-X2P4IB7J.js.map → claim-RNEBQCOO.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{close-3HDWDA3L.js.map → close-UNTFXVM3.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{close-PTYFA45H.js.map → close-ZMXL2WDS.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{comments-QKBYCWKD.js.map → comments-EFVBHWPT.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{comments-OONGABK5.js.map → comments-J5Q4IJPH.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{create-JTZNCTQC.js.map → create-EZWAMUKR.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{create-I5L4EYYZ.js.map → create-PUAIJEZ7.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{delete-7HPGI4GZ.js.map → delete-PKR2JHLH.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{delete-VXUPH5RS.js.map → delete-WBME6WG5.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{deps-JSRRWC3Z.js.map → deps-4BQEDV4L.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{deps-SCZIFK2Z.js.map → deps-KWHQRO75.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{docs-GJK6K4VP.js.map → docs-364GT3ZR.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{docs-WW4N3MBM.js.map → docs-SCNBUGSV.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{extension-VDY2U33M.js.map → extension-CRE7JM47.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{extension-J7IBMFTD.js.map → extension-KK2UPXJD.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{files-ISZJGILQ.js.map → files-3GESQAWL.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{files-WKOD326U.js.map → files-66EHM5ZR.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{history-PKN67D5O.js.map → history-TJTO5GCR.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{history-2BA3T5AE.js.map → history-ZERISU2L.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{history-redact-JBZNXHGR.js.map → history-redact-GODBYT5A.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{history-redact-V4FOJGS7.js.map → history-redact-JUXUOH54.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{history-repair-HIBCBIKK.js.map → history-repair-CCCPBNTF.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{history-repair-SDMHR7JT.js.map → history-repair-TDBBSRVK.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{init-P56QYWJF.js.map → init-6ZPKD3YN.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{init-HIVSNX3O.js.map → init-CBZHXBR3.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{learnings-MIXSESLK.js.map → learnings-U7U2FNIO.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{learnings-GDFRG5J7.js.map → learnings-WYNTYQ5T.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{list-MUSQNMTD.js.map → list-7MTPPZHC.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{list-FGOWQMSM.js.map → list-JGP7ODML.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{notes-5UK3GEH2.js.map → notes-P25YVTEG.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{notes-4XVSH2AZ.js.map → notes-QIF6A7XS.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{plan-DUMBV3QB.js.map → plan-RACB5PI6.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{plan-SLMODHWX.js.map → plan-SSBJFWXA.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{restore-D4RGNX33.js.map → restore-3JRX27QW.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{restore-PBL6T5TW.js.map → restore-K72ZNPEP.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{stats-XYB6KTFG.js.map → stats-O4UTMJMC.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{stats-CV54BAWY.js.map → stats-WLJ3XBF5.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{telemetry-LMJ7PFUO.js.map → telemetry-EUVHFSQU.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{telemetry-NCMEPJNR.js.map → telemetry-NRVWX25E.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{test-WBROAJIE.js.map → test-GXUBQNUC.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{test-MXX3E5JL.js.map → test-XN7RJL5Z.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{test-runs-V6A7LPWZ.js.map → test-runs-7FHCPEA3.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{test-runs-WMVTQU3Y.js.map → test-runs-IK6E2HNX.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{update-YRXSUGYQ.js.map → update-LFBSEW3N.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{update-OSV3NAQB.js.map → update-U4B4OMHZ.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{update-many-KGGEYABR.js.map → update-many-5KD33MKY.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{update-many-EM6OXYGO.js.map → update-many-N3YTM7K4.js.map} +0 -0
@@ -12,27 +12,27 @@ import {
12
12
  parseLinkedTestMinLines,
13
13
  parseLinkedTestRegexList,
14
14
  parseLinkedTestStringList
15
- } from "./chunk-N7ACFE26.js";
15
+ } from "./chunk-NUKHZZNM.js";
16
16
  import {
17
17
  createStdinTokenResolver,
18
18
  parseCsvKv,
19
19
  parseOptionalNumber
20
- } from "./chunk-XLTD2HN3.js";
20
+ } from "./chunk-CBJXWXI5.js";
21
21
  import {
22
22
  runInit
23
- } from "./chunk-3LB74A67.js";
23
+ } from "./chunk-Z55JACL2.js";
24
24
  import {
25
25
  locateItem,
26
26
  mutateItem,
27
27
  readLocatedItem
28
- } from "./chunk-XTGLRY2Y.js";
28
+ } from "./chunk-2HMD3JM2.js";
29
29
  import {
30
30
  resolveItemTypeRegistry
31
- } from "./chunk-KJE2FOS4.js";
31
+ } from "./chunk-2BYKYPWY.js";
32
32
  import {
33
33
  compareTimestampStrings,
34
34
  nowIso
35
- } from "./chunk-QO7EBBOM.js";
35
+ } from "./chunk-QFVASU44.js";
36
36
  import {
37
37
  EXIT_CODE,
38
38
  ITEM_FILE_EXTENSIONS,
@@ -45,7 +45,7 @@ import {
45
45
  resolveGlobalPmRoot,
46
46
  resolvePmRoot,
47
47
  stableValueEquals
48
- } from "./chunk-U5SXYXSY.js";
48
+ } from "./chunk-3TXWDGPU.js";
49
49
 
50
50
  // dist/cli/commands/test.js
51
51
  import { spawn } from "node:child_process";
@@ -1678,4 +1678,4 @@ export {
1678
1678
  runLinkedTests,
1679
1679
  runTest
1680
1680
  };
1681
- //# sourceMappingURL=chunk-OZ7NSQHL.js.map
1681
+ //# sourceMappingURL=chunk-QWNUDGFQ.js.map
@@ -1,20 +1,20 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="256a39f4-fc97-5137-9150-eb04dce607f8")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4142e7c6-57b9-534b-8af8-0398662732fe")}catch(e){}}();
3
3
  import {
4
4
  normalizeAddTypeInput,
5
5
  parseItemTypesFile,
6
6
  serializeItemTypesFile,
7
7
  upsertItemType
8
- } from "./chunk-6P6GGMOG.js";
8
+ } from "./chunk-NGEEXR2R.js";
9
9
  import {
10
10
  runExtension
11
- } from "./chunk-TPH5XEVD.js";
11
+ } from "./chunk-F33AQIB4.js";
12
12
  import {
13
13
  normalizePrefix
14
- } from "./chunk-HZGUAH22.js";
14
+ } from "./chunk-4TI3532H.js";
15
15
  import {
16
16
  resolveItemTypeRegistry
17
- } from "./chunk-2VBQ6ZXS.js";
17
+ } from "./chunk-Z2HXAFFH.js";
18
18
  import {
19
19
  DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,
20
20
  EXIT_CODE,
@@ -33,7 +33,7 @@ import {
33
33
  runActiveOnWriteHooks,
34
34
  writeFileAtomic,
35
35
  writeSettings
36
- } from "./chunk-5SFCOO6B.js";
36
+ } from "./chunk-YJAKN2N2.js";
37
37
 
38
38
  // dist/cli/commands/init.js
39
39
  import fs2 from "node:fs/promises";
@@ -542,6 +542,51 @@ async function registerInitTypePreset(pmRoot, settings, preset) {
542
542
  file: typesPath
543
543
  };
544
544
  }
545
+ async function isLikelyWorkspaceRoot(candidate) {
546
+ const indicators = [
547
+ ".git",
548
+ "package.json",
549
+ "pnpm-workspace.yaml",
550
+ "AGENTS.md",
551
+ path2.join(".agents", "pm")
552
+ ];
553
+ for (const indicator of indicators) {
554
+ if (await pathExists(path2.join(candidate, indicator))) {
555
+ return true;
556
+ }
557
+ }
558
+ return false;
559
+ }
560
+ async function assertExplicitTrackerPathIsNotWorkspaceRoot(pmRoot, global, force) {
561
+ if (global.path === void 0 || force) {
562
+ return;
563
+ }
564
+ if (await pathExists(path2.join(pmRoot, "settings.json"))) {
565
+ return;
566
+ }
567
+ if (!await isLikelyWorkspaceRoot(pmRoot)) {
568
+ return;
569
+ }
570
+ const nestedTracker = path2.join(pmRoot, ".agents", "pm");
571
+ throw new PmCliError(`Refusing to initialize tracker files directly in workspace root "${pmRoot}".`, EXIT_CODE.USAGE, {
572
+ code: "workspace_root_pm_path",
573
+ type: "urn:pm-cli:error:workspace_root_pm_path",
574
+ why: "--pm-path/--path points at the tracker storage directory itself, not the repository workspace. Point it at .agents/pm or pass --force if you intentionally want root-level tracker files.",
575
+ examples: [
576
+ `pm --pm-path ${nestedTracker} init --yes`,
577
+ "pm init --yes",
578
+ `pm --pm-path ${pmRoot} init --yes --force`
579
+ ],
580
+ nextSteps: [
581
+ "Use --pm-path <repo>/.agents/pm for repository-local tracker storage.",
582
+ "Use PM_PATH only for sandboxed tests or explicit tracker roots.",
583
+ "Pass --force only when root-level tracker files are intentional."
584
+ ],
585
+ recovery: {
586
+ next_best_command: `pm --pm-path ${nestedTracker} init --yes`
587
+ }
588
+ });
589
+ }
545
590
  async function runInitWizard(initialPrefix, telemetryDefault) {
546
591
  const rl = readline2.createInterface({ input: input2, output: output2 });
547
592
  try {
@@ -575,6 +620,7 @@ async function runInitWizard(initialPrefix, telemetryDefault) {
575
620
  async function runInit(prefixArg, global, options = {}) {
576
621
  const cwd = process.cwd();
577
622
  const pmRoot = resolvePmRoot(cwd, global.path);
623
+ await assertExplicitTrackerPathIsNotWorkspaceRoot(pmRoot, global, options.force === true);
578
624
  const createdDirs = [];
579
625
  const warnings = [];
580
626
  let wizardUsed = false;
@@ -746,6 +792,6 @@ export {
746
792
  summarizeInitResult,
747
793
  runInit
748
794
  };
749
- //# sourceMappingURL=chunk-AY43SBIN.js.map
795
+ //# sourceMappingURL=chunk-R4XIE7NQ.js.map
750
796
 
751
- //# debugId=256a39f4-fc97-5137-9150-eb04dce607f8
797
+ //# debugId=4142e7c6-57b9-534b-8af8-0398662732fe
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../cli/commands/init.ts","../../../../../../../../cli/commands/init-agent-guidance.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport readline from \"node:readline/promises\";\nimport { stdin as input, stdout as output } from \"node:process\";\nimport { getActiveExtensionRegistrations, runActiveOnWriteHooks } from \"../../core/extensions/index.js\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { normalizePrefix } from \"../../core/item/id.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport {\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,\n ensureRuntimeSchemaFileScaffold,\n filePathForSchemaSection,\n normalizeRuntimeSchemaSettings,\n} from \"../../core/schema/runtime-schema.js\";\nimport {\n normalizeAddTypeInput,\n parseItemTypesFile,\n serializeItemTypesFile,\n upsertItemType,\n} from \"../../core/schema/item-types-file.js\";\nimport { EXIT_CODE, GOVERNANCE_PRESET_DEFAULTS, PM_REQUIRED_SUBDIRS, SETTINGS_DEFAULTS } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings, writeSettings } from \"../../core/store/settings.js\";\nimport type { GovernancePreset, PmSettings } from \"../../types/index.js\";\nimport { runExtension, type ExtensionCommandResult } from \"./extension.js\";\nimport {\n INIT_AGENT_GUIDANCE_MODE_VALUES,\n runInitAgentGuidance,\n type InitAgentGuidanceMode,\n type InitAgentGuidanceSummary,\n} from \"./init-agent-guidance.js\";\n\nexport interface InitInstalledPackagesSummary {\n installed_all: boolean;\n installed_count: number;\n packages: Array<{\n alias: string;\n ok: boolean;\n }>;\n}\n\nexport type InitTypePresetName = \"agile\" | \"ops\" | \"research\";\n\nexport interface InitRegisteredTypePresetSummary {\n name: InitTypePresetName;\n registered: string[];\n updated: string[];\n file: string;\n}\n\nexport interface InitResult {\n ok: boolean;\n path: string;\n settings: PmSettings;\n created_dirs: string[];\n warnings: string[];\n governance_preset: GovernancePreset;\n wizard_used: boolean;\n registered_type_preset?: InitRegisteredTypePresetSummary;\n installed_packages?: InitInstalledPackagesSummary;\n next_steps: string[];\n agent_guidance: InitAgentGuidanceSummary;\n}\n\nexport interface InitCommandOptions {\n preset?: string;\n defaults?: boolean;\n author?: string;\n withPackages?: boolean;\n agentGuidance?: string;\n typePreset?: string;\n force?: boolean;\n}\n\n/**\n * Concise projection of an InitResult for the default (toon) renderer. It keeps\n * every piece of information that only init can surface — the resolved path, id\n * prefix, governance preset, telemetry capture level, created-directory count,\n * the full warnings list (including `already_exists:` markers), agent-guidance\n * summary, and next steps — but replaces the verbose full settings tree (~190\n * lines) with a compact `settings` summary. Use --verbose for the full tree.\n */\nexport interface InitConciseResult {\n ok: boolean;\n path: string;\n id_prefix: string;\n governance_preset: GovernancePreset;\n telemetry: {\n enabled: boolean;\n capture_level: string;\n };\n output_format: string;\n created_dirs_count: number;\n created_dirs: string[];\n warnings: string[];\n wizard_used: boolean;\n registered_type_preset?: InitRegisteredTypePresetSummary;\n installed_packages?: InitInstalledPackagesSummary;\n next_steps: string[];\n agent_guidance: InitAgentGuidanceSummary;\n hint: string;\n}\n\nexport function summarizeInitResult(result: InitResult): InitConciseResult {\n return {\n ok: result.ok,\n path: result.path,\n id_prefix: result.settings.id_prefix,\n governance_preset: result.governance_preset,\n telemetry: {\n enabled: result.settings.telemetry.enabled,\n capture_level: result.settings.telemetry.capture_level,\n },\n output_format: result.settings.output.default_format,\n created_dirs_count: result.created_dirs.length,\n created_dirs: result.created_dirs,\n warnings: result.warnings,\n wizard_used: result.wizard_used,\n ...(result.registered_type_preset ? { registered_type_preset: result.registered_type_preset } : {}),\n ...(result.installed_packages ? { installed_packages: result.installed_packages } : {}),\n next_steps: result.next_steps,\n agent_guidance: result.agent_guidance,\n hint: \"Re-run with --verbose for the full settings tree.\",\n };\n}\n\nfunction cloneDefaults(): PmSettings {\n return structuredClone(SETTINGS_DEFAULTS);\n}\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\nconst BUILTIN_GOVERNANCE_PRESETS: BuiltinGovernancePreset[] = [\"minimal\", \"default\", \"strict\"];\nconst INIT_TYPE_PRESET_NAMES: InitTypePresetName[] = [\"agile\", \"ops\", \"research\"];\n\nconst INIT_TYPE_PRESET_DEFINITIONS: Record<InitTypePresetName, Array<Parameters<typeof normalizeAddTypeInput>[0]>> = {\n agile: [\n {\n name: \"Story\",\n description: \"User-facing outcome or capability slice expressed from a stakeholder perspective.\",\n defaultStatus: \"open\",\n folder: \"stories\",\n aliases: [\"user-story\"],\n },\n {\n name: \"Spike\",\n description: \"Time-boxed investigation used to reduce uncertainty before implementation.\",\n defaultStatus: \"open\",\n folder: \"spikes\",\n aliases: [\"research-spike\"],\n },\n ],\n ops: [\n {\n name: \"Incident\",\n description: \"Operational disruption, degradation, or support escalation with recovery tracking.\",\n defaultStatus: \"open\",\n folder: \"incidents\",\n aliases: [\"outage\"],\n },\n {\n name: \"Runbook\",\n description: \"Repeatable operational procedure, diagnostic path, or response playbook.\",\n defaultStatus: \"open\",\n folder: \"runbooks\",\n aliases: [\"playbook\"],\n },\n ],\n research: [\n {\n name: \"Experiment\",\n description: \"Validated-learning activity with hypothesis, method, and outcome tracking.\",\n defaultStatus: \"open\",\n folder: \"experiments\",\n aliases: [\"study\"],\n },\n {\n name: \"Hypothesis\",\n description: \"Testable claim or assumption that should be supported, rejected, or refined.\",\n defaultStatus: \"open\",\n folder: \"hypotheses\",\n aliases: [\"assumption\"],\n },\n ],\n};\n\nfunction normalizeInitGovernancePreset(rawValue: string | undefined): BuiltinGovernancePreset | undefined {\n if (rawValue === undefined) {\n return undefined;\n }\n const normalized = rawValue.trim().toLowerCase().replaceAll(\"-\", \"_\");\n if (normalized.length === 0) {\n throw new PmCliError(\"--preset must not be empty\", EXIT_CODE.USAGE);\n }\n if (normalized === \"minimal\" || normalized === \"default\" || normalized === \"strict\") {\n return normalized;\n }\n if (normalized === \"lite\" || normalized === \"minimum\") {\n return \"minimal\";\n }\n throw new PmCliError(\n `Invalid --preset value \"${rawValue}\". Allowed: ${BUILTIN_GOVERNANCE_PRESETS.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction normalizeInitTypePreset(rawValue: string | undefined): InitTypePresetName | undefined {\n if (rawValue === undefined) {\n return undefined;\n }\n const normalized = rawValue.trim().toLowerCase().replaceAll(\"-\", \"_\");\n if (normalized.length === 0) {\n throw new PmCliError(\"--type-preset must not be empty\", EXIT_CODE.USAGE);\n }\n if (normalized === \"agile\" || normalized === \"ops\" || normalized === \"research\") {\n return normalized;\n }\n throw new PmCliError(\n `Invalid --type-preset value \"${rawValue}\". Allowed: ${INIT_TYPE_PRESET_NAMES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction normalizeOptionalInitAuthor(rawValue: string | undefined): string | undefined {\n if (rawValue === undefined) {\n return undefined;\n }\n const normalized = rawValue.trim();\n if (normalized.length === 0) {\n throw new PmCliError(\"--author must not be empty\", EXIT_CODE.USAGE);\n }\n return normalized;\n}\n\nfunction normalizeInitAgentGuidanceMode(rawValue: string | undefined): InitAgentGuidanceMode {\n if (rawValue === undefined) {\n return \"ask\";\n }\n const normalized = rawValue.trim().toLowerCase().replaceAll(\"-\", \"_\");\n if (normalized.length === 0) {\n throw new PmCliError(\"--agent-guidance must not be empty\", EXIT_CODE.USAGE);\n }\n if (normalized === \"ask\" || normalized === \"add\" || normalized === \"skip\" || normalized === \"status\") {\n return normalized;\n }\n throw new PmCliError(\n `Invalid --agent-guidance value \"${rawValue}\". Allowed: ${INIT_AGENT_GUIDANCE_MODE_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction parseYesNoChoice(answer: string, currentDefault: boolean): boolean {\n const normalized = answer.trim().toLowerCase();\n if (normalized.length === 0) {\n return currentDefault;\n }\n if (normalized === \"y\" || normalized === \"yes\") {\n return true;\n }\n if (normalized === \"n\" || normalized === \"no\") {\n return false;\n }\n return currentDefault;\n}\n\nfunction applyGovernancePreset(settings: PmSettings, preset: BuiltinGovernancePreset): void {\n const knobs = GOVERNANCE_PRESET_DEFAULTS[preset];\n settings.governance = {\n preset,\n ...knobs,\n };\n settings.validation.parent_reference = knobs.parent_reference;\n settings.validation.metadata_profile = knobs.metadata_profile;\n}\n\nfunction summarizeInstalledPackages(result: ExtensionCommandResult): InitInstalledPackagesSummary {\n const details = result.details as {\n installed_all?: unknown;\n installed_count?: unknown;\n packages?: Array<{\n alias?: unknown;\n ok?: unknown;\n }>;\n };\n return {\n installed_all: details.installed_all === true,\n installed_count: typeof details.installed_count === \"number\" ? details.installed_count : 0,\n packages: Array.isArray(details.packages)\n ? details.packages.map((entry) => ({\n alias: typeof entry.alias === \"string\" ? entry.alias : \"\",\n ok: entry.ok === true,\n }))\n : [],\n };\n}\n\nasync function registerInitTypePreset(\n pmRoot: string,\n settings: PmSettings,\n preset: InitTypePresetName,\n): Promise<InitRegisteredTypePresetSummary> {\n const schema = normalizeRuntimeSchemaSettings(settings.schema);\n const typesPath = filePathForSchemaSection(pmRoot, schema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);\n const parsed = parseItemTypesFile(await readFileIfExists(typesPath));\n let nextFile = parsed;\n const registered: string[] = [];\n const updated: string[] = [];\n for (const rawDefinition of INIT_TYPE_PRESET_DEFINITIONS[preset]) {\n const normalized = normalizeAddTypeInput(rawDefinition);\n const upsert = upsertItemType(nextFile, normalized);\n nextFile = upsert.file;\n (upsert.replaced ? updated : registered).push(upsert.definition.name);\n }\n await writeFileAtomic(typesPath, serializeItemTypesFile(nextFile));\n return {\n name: preset,\n registered,\n updated,\n file: typesPath,\n };\n}\n\nasync function isLikelyWorkspaceRoot(candidate: string): Promise<boolean> {\n const indicators = [\n \".git\",\n \"package.json\",\n \"pnpm-workspace.yaml\",\n \"AGENTS.md\",\n path.join(\".agents\", \"pm\"),\n ];\n for (const indicator of indicators) {\n if (await pathExists(path.join(candidate, indicator))) {\n return true;\n }\n }\n return false;\n}\n\nasync function assertExplicitTrackerPathIsNotWorkspaceRoot(pmRoot: string, global: GlobalOptions, force: boolean): Promise<void> {\n if (global.path === undefined || force) {\n return;\n }\n if (await pathExists(path.join(pmRoot, \"settings.json\"))) {\n return;\n }\n if (!(await isLikelyWorkspaceRoot(pmRoot))) {\n return;\n }\n const nestedTracker = path.join(pmRoot, \".agents\", \"pm\");\n throw new PmCliError(\n `Refusing to initialize tracker files directly in workspace root \"${pmRoot}\".`,\n EXIT_CODE.USAGE,\n {\n code: \"workspace_root_pm_path\",\n type: \"urn:pm-cli:error:workspace_root_pm_path\",\n why: \"--pm-path/--path points at the tracker storage directory itself, not the repository workspace. Point it at .agents/pm or pass --force if you intentionally want root-level tracker files.\",\n examples: [\n `pm --pm-path ${nestedTracker} init --yes`,\n \"pm init --yes\",\n `pm --pm-path ${pmRoot} init --yes --force`,\n ],\n nextSteps: [\n \"Use --pm-path <repo>/.agents/pm for repository-local tracker storage.\",\n \"Use PM_PATH only for sandboxed tests or explicit tracker roots.\",\n \"Pass --force only when root-level tracker files are intentional.\",\n ],\n recovery: {\n next_best_command: `pm --pm-path ${nestedTracker} init --yes`,\n },\n },\n );\n}\n\nasync function runInitWizard(initialPrefix: string, telemetryDefault: boolean): Promise<{\n prefix: string;\n preset: BuiltinGovernancePreset;\n telemetry_enabled: boolean;\n}> {\n const rl = readline.createInterface({ input, output });\n try {\n output.write(\"pm init setup wizard (agent-optimized)\\n\");\n output.write(\"This walkthrough is non-destructive and each choice can be changed later with pm config.\\n\\n\");\n\n output.write(\"1/3 Item ID prefix\\n\");\n output.write(\"Prefix is prepended to generated IDs (for example pm-a1b2).\\n\");\n const prefixAnswer = await rl.question(`Item ID prefix [${initialPrefix}]: `);\n const resolvedPrefix = prefixAnswer.trim().length > 0 ? normalizePrefix(prefixAnswer) : initialPrefix;\n\n output.write(\"\\n2/3 Governance preset\\n\");\n output.write(\"minimal: no ownership blocking, progressive create defaults, close validation off.\\n\");\n output.write(\"default: ownership conflict warnings, progressive create defaults, close validation warn.\\n\");\n output.write(\"strict: ownership blocking, strict create defaults, close validation strict.\\n\");\n const presetAnswer = await rl.question(\"Governance preset [minimal/default/strict] (default: minimal): \");\n const resolvedPreset = normalizeInitGovernancePreset(presetAnswer.trim().length > 0 ? presetAnswer : \"minimal\") ?? \"minimal\";\n\n output.write(\"\\n3/3 Project telemetry\\n\");\n output.write(\"Telemetry helps improve reliability and can be disabled anytime via pm config.\\n\");\n const telemetryLabel = telemetryDefault ? \"Y/n\" : \"y/N\";\n const telemetryAnswer = await rl.question(`Enable telemetry for this project? [${telemetryLabel}] `);\n const telemetryEnabled = parseYesNoChoice(telemetryAnswer, telemetryDefault);\n\n output.write(\"\\n\");\n return {\n prefix: resolvedPrefix,\n preset: resolvedPreset,\n telemetry_enabled: telemetryEnabled,\n };\n } finally {\n rl.close();\n }\n}\n\nexport async function runInit(\n prefixArg: string | undefined,\n global: GlobalOptions,\n options: InitCommandOptions = {},\n): Promise<InitResult> {\n const cwd = process.cwd();\n const pmRoot = resolvePmRoot(cwd, global.path);\n await assertExplicitTrackerPathIsNotWorkspaceRoot(pmRoot, global, options.force === true);\n const createdDirs: string[] = [];\n const warnings: string[] = [];\n let wizardUsed = false;\n\n for (const subdir of PM_REQUIRED_SUBDIRS) {\n const target = subdir ? path.join(pmRoot, subdir) : pmRoot;\n const existed = await pathExists(target);\n await fs.mkdir(target, { recursive: true });\n if (existed) {\n warnings.push(`already_exists:${target}`);\n } else {\n createdDirs.push(target);\n }\n warnings.push(\n ...(await runActiveOnWriteHooks({\n path: target,\n scope: \"project\",\n op: \"init:ensure_dir\",\n })),\n );\n }\n\n const settingsPath = path.join(pmRoot, \"settings.json\");\n const settingsExists = await pathExists(settingsPath);\n let normalizedPrefix = normalizePrefix(prefixArg);\n const presetFromOption = normalizeInitGovernancePreset(options.preset);\n const useDefaults = options.defaults === true;\n const authorFromOption = normalizeOptionalInitAuthor(options.author);\n const installBundledPackages = options.withPackages === true;\n const agentGuidanceMode = normalizeInitAgentGuidanceMode(options.agentGuidance);\n const typePreset = normalizeInitTypePreset(options.typePreset);\n let chosenPreset = presetFromOption;\n let chosenTelemetryEnabled: boolean | undefined;\n\n let settings: PmSettings;\n if (settingsExists) {\n settings = await readSettings(pmRoot);\n warnings.push(`already_exists:${settingsPath}`);\n let changed = false;\n if (prefixArg !== undefined && settings.id_prefix !== normalizedPrefix) {\n settings.id_prefix = normalizedPrefix;\n warnings.push(`updated:id_prefix:${normalizedPrefix}`);\n changed = true;\n }\n if (presetFromOption !== undefined && settings.governance.preset !== presetFromOption) {\n applyGovernancePreset(settings, presetFromOption);\n warnings.push(`updated:governance_preset:${presetFromOption}`);\n changed = true;\n }\n if (authorFromOption !== undefined && settings.author_default !== authorFromOption) {\n settings.author_default = authorFromOption;\n warnings.push(`updated:author_default:${authorFromOption}`);\n changed = true;\n }\n if (changed) {\n await writeSettings(pmRoot, settings);\n }\n } else {\n if (presetFromOption === undefined && !useDefaults && process.stdin.isTTY === true && process.stdout.isTTY === true) {\n const wizardChoices = await runInitWizard(normalizedPrefix, SETTINGS_DEFAULTS.telemetry.enabled);\n normalizedPrefix = wizardChoices.prefix;\n chosenPreset = wizardChoices.preset;\n chosenTelemetryEnabled = wizardChoices.telemetry_enabled;\n wizardUsed = true;\n }\n const effectivePreset = chosenPreset ?? \"minimal\";\n settings = cloneDefaults();\n settings.id_prefix = normalizedPrefix;\n applyGovernancePreset(settings, effectivePreset);\n if (authorFromOption !== undefined) {\n settings.author_default = authorFromOption;\n }\n if (chosenTelemetryEnabled !== undefined) {\n settings.telemetry.enabled = chosenTelemetryEnabled;\n settings.telemetry.first_run_prompt_completed = true;\n }\n await writeSettings(pmRoot, settings);\n }\n\n const agentGuidanceResult = await runInitAgentGuidance({\n pm_root: pmRoot,\n cwd,\n mode: agentGuidanceMode,\n interactive: process.stdin.isTTY === true && process.stdout.isTTY === true,\n settings,\n });\n warnings.push(...agentGuidanceResult.warnings);\n if (agentGuidanceResult.settings_changed) {\n await writeSettings(pmRoot, settings);\n }\n\n const runtimeSchemaScaffold = await ensureRuntimeSchemaFileScaffold(pmRoot, settings.schema);\n for (const createdPath of runtimeSchemaScaffold.created_paths) {\n createdDirs.push(createdPath);\n warnings.push(\n ...(await runActiveOnWriteHooks({\n path: createdPath,\n scope: \"project\",\n op: \"init:runtime_schema_file\",\n })),\n );\n }\n\n let registeredTypePreset: InitRegisteredTypePresetSummary | undefined;\n if (typePreset !== undefined) {\n registeredTypePreset = await registerInitTypePreset(pmRoot, settings, typePreset);\n warnings.push(`registered_type_preset:${typePreset}`);\n warnings.push(\n ...(await runActiveOnWriteHooks({\n path: registeredTypePreset.file,\n scope: \"project\",\n op: \"init:type_preset\",\n })),\n );\n settings = await readSettings(pmRoot);\n }\n\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n for (const typeFolder of typeRegistry.folders) {\n if ((PM_REQUIRED_SUBDIRS as readonly string[]).includes(typeFolder)) {\n continue;\n }\n const target = path.join(pmRoot, typeFolder);\n const existed = await pathExists(target);\n await fs.mkdir(target, { recursive: true });\n if (existed) {\n warnings.push(`already_exists:${target}`);\n } else {\n createdDirs.push(target);\n }\n warnings.push(\n ...(await runActiveOnWriteHooks({\n path: target,\n scope: \"project\",\n op: \"init:ensure_dir\",\n })),\n );\n }\n\n let installedPackages: InitInstalledPackagesSummary | undefined;\n if (installBundledPackages) {\n const packageInstallResult = await runExtension(\"all\", { install: true, project: true }, global);\n warnings.push(...packageInstallResult.warnings);\n installedPackages = summarizeInstalledPackages(packageInstallResult);\n if (!installedPackages.installed_all || installedPackages.packages.some((entry) => !entry.ok)) {\n throw new PmCliError(\"pm init --with-packages did not install all bundled packages successfully.\", EXIT_CODE.GENERIC_FAILURE);\n }\n }\n\n const nextSteps: string[] = [\n 'Create your first item: pm create --type Task --title \"<title>\"',\n 'List active items: pm list',\n 'Get agent-friendly project context: pm context',\n ];\n if (!installBundledPackages) {\n nextSteps.push(\n \"Add optional packages for richer workflows: pm install calendar --project, pm install templates --project, pm install guide-shell --project\",\n );\n nextSteps.push(\"Or install everything bundled: pm init --with-packages (idempotent on re-run)\");\n } else {\n nextSteps.push(\"Explore newly-available commands: pm cal, pm templates, pm guide\");\n }\n if (registeredTypePreset) {\n nextSteps.push(`Inspect registered preset types: pm schema list, pm schema show ${registeredTypePreset.registered[0] ?? registeredTypePreset.updated[0]}`);\n }\n nextSteps.push(\"Set PM_AUTHOR=<your-agent-id> so mutations attribute to the right caller.\");\n for (const guidanceNextStep of agentGuidanceResult.next_steps) {\n if (!nextSteps.includes(guidanceNextStep)) {\n nextSteps.push(guidanceNextStep);\n }\n }\n\n return {\n ok: true,\n path: pmRoot,\n settings,\n created_dirs: createdDirs,\n warnings,\n governance_preset: settings.governance.preset,\n wizard_used: wizardUsed,\n ...(registeredTypePreset ? { registered_type_preset: registeredTypePreset } : {}),\n ...(installedPackages ? { installed_packages: installedPackages } : {}),\n next_steps: nextSteps,\n agent_guidance: agentGuidanceResult.summary,\n };\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport readline from \"node:readline/promises\";\nimport { stdin as input, stdout as output } from \"node:process\";\nimport { runActiveOnWriteHooks } from \"../../core/extensions/index.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport type { PmSettings } from \"../../types/index.js\";\n\nexport type InitAgentGuidanceMode = \"ask\" | \"add\" | \"skip\" | \"status\";\n\nexport const INIT_AGENT_GUIDANCE_MODE_VALUES: InitAgentGuidanceMode[] = [\"ask\", \"add\", \"skip\", \"status\"];\n\nconst AGENT_GUIDANCE_TARGET_FILENAMES = [\"AGENTS.md\", \"CLAUDE.md\"] as const;\nconst AGENT_GUIDANCE_REQUIRED_TOKENS = [\n \"pm init\",\n \"pm context\",\n \"pm search\",\n \"pm create\",\n \"pm claim\",\n \"pm files\",\n \"pm docs\",\n \"pm test --run\",\n \"pm close\",\n \"pm release\",\n \"pm_author\",\n] as const;\nconst AGENT_GUIDANCE_REQUIRED_TOKEN_THRESHOLD = 8;\nconst AGENT_GUIDANCE_TEMPLATE_VERSION = 1;\nconst AGENT_GUIDANCE_START_MARKER_PREFIX = \"<!-- pm-cli:agent-guidance:start:\";\nconst AGENT_GUIDANCE_START_MARKER = `<!-- pm-cli:agent-guidance:start:v${AGENT_GUIDANCE_TEMPLATE_VERSION} -->`;\nconst AGENT_GUIDANCE_END_MARKER = \"<!-- pm-cli:agent-guidance:end -->\";\n\ninterface AgentGuidanceFileScan {\n file_path: string;\n exists: boolean;\n has_guidance: boolean;\n has_marker: boolean;\n}\n\ninterface AgentGuidanceBlockRange {\n start_index: number;\n end_index: number;\n}\n\nexport interface InitAgentGuidanceSummary {\n mode: InitAgentGuidanceMode;\n present: boolean;\n prompted: boolean;\n applied: boolean;\n skipped: boolean;\n declined: boolean;\n prompt_completed: boolean;\n template_version: number;\n target_file: string;\n checked_files: string[];\n files_with_guidance: string[];\n missing_files: string[];\n}\n\nexport interface RunInitAgentGuidanceOptions {\n pm_root: string;\n cwd: string;\n mode: InitAgentGuidanceMode;\n interactive: boolean;\n settings: PmSettings;\n}\n\nexport interface RunInitAgentGuidanceResult {\n summary: InitAgentGuidanceSummary;\n warnings: string[];\n next_steps: string[];\n settings_changed: boolean;\n}\n\nfunction toPortableRelativePath(projectRoot: string, targetPath: string): string {\n const relative = path.relative(projectRoot, targetPath);\n if (relative.length === 0) {\n return path.basename(targetPath);\n }\n return relative.split(path.sep).join(\"/\");\n}\n\nfunction ensureTrailingNewline(value: string): string {\n return value.endsWith(\"\\n\") ? value : `${value}\\n`;\n}\n\nfunction detectLineEnding(value: string): \"\\n\" | \"\\r\\n\" {\n return value.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n}\n\nfunction findGuidanceBlockRange(content: string): AgentGuidanceBlockRange | null {\n const startIndex = content.indexOf(AGENT_GUIDANCE_START_MARKER_PREFIX);\n if (startIndex === -1) {\n return null;\n }\n const endMarkerIndex = content.indexOf(AGENT_GUIDANCE_END_MARKER, startIndex);\n if (endMarkerIndex === -1) {\n return null;\n }\n return {\n start_index: startIndex,\n end_index: endMarkerIndex + AGENT_GUIDANCE_END_MARKER.length,\n };\n}\n\nfunction hasGuidanceMarker(content: string): boolean {\n return findGuidanceBlockRange(content) !== null;\n}\n\nfunction buildAgentGuidanceBlock(lineEnding: \"\\n\" | \"\\r\\n\"): string {\n const lines = [\n AGENT_GUIDANCE_START_MARKER,\n \"## pm Workflow (Agent Quickstart)\",\n \"\",\n \"- Orient before mutate: `pm context --limit 10`, `pm search \\\"<keywords>\\\" --limit 10`, `pm list-open --limit 20`.\",\n \"- Claim and execute: `pm claim <id>` then `pm update <id> --status in_progress`.\",\n \"- Link evidence while coding: `pm files <id> --add ...`, `pm docs <id> --add ...`, `pm test <id> --add command=\\\"node scripts/run-tests.mjs test -- ...\\\"`.\",\n \"- Verify and close: `pm test <id> --run --progress`, `pm close <id> \\\"<evidence>\\\" --validate-close warn`, `pm release <id>`.\",\n \"- Set `PM_AUTHOR=<stable-agent-id>` before mutation commands.\",\n \"\",\n AGENT_GUIDANCE_END_MARKER,\n \"\",\n ];\n return lines.join(lineEnding);\n}\n\nfunction upsertAgentGuidanceBlock(existingContent: string): { next_content: string; changed: boolean } {\n const lineEnding = detectLineEnding(existingContent);\n const nextBlock = buildAgentGuidanceBlock(lineEnding);\n const existingRange = findGuidanceBlockRange(existingContent);\n if (existingRange) {\n const nextContent = ensureTrailingNewline(\n `${existingContent.slice(0, existingRange.start_index)}${nextBlock}${existingContent.slice(existingRange.end_index)}`,\n );\n return {\n next_content: nextContent,\n changed: nextContent !== existingContent,\n };\n }\n const separator = existingContent.length === 0 ? \"\" : existingContent.endsWith(\"\\n\") ? \"\\n\" : \"\\n\\n\";\n const nextContent = ensureTrailingNewline(`${existingContent}${separator}${nextBlock}`);\n return {\n next_content: nextContent,\n changed: nextContent !== existingContent,\n };\n}\n\nfunction resolveProjectRoot(pmRoot: string, cwd: string): string {\n const parent = path.dirname(pmRoot);\n if (path.basename(pmRoot) === \"pm\" && path.basename(parent) === \".agents\") {\n return path.dirname(parent);\n }\n return path.resolve(cwd, pmRoot);\n}\n\nfunction resolveTargetGuidancePath(scans: AgentGuidanceFileScan[], projectRoot: string): string {\n const existingAgents = scans.find((entry) => path.basename(entry.file_path) === \"AGENTS.md\" && entry.exists);\n if (existingAgents) {\n return existingAgents.file_path;\n }\n const existingAny = scans.find((entry) => entry.exists);\n if (existingAny) {\n return existingAny.file_path;\n }\n return path.join(projectRoot, \"AGENTS.md\");\n}\n\nfunction parsePromptChoice(answer: string, currentDefault: boolean): boolean {\n const normalized = answer.trim().toLowerCase();\n if (normalized.length === 0) {\n return currentDefault;\n }\n if (normalized === \"y\" || normalized === \"yes\") {\n return true;\n }\n if (normalized === \"n\" || normalized === \"no\") {\n return false;\n }\n return currentDefault;\n}\n\nasync function promptForGuidanceWrite(targetRelativePath: string): Promise<boolean> {\n const rl = readline.createInterface({ input, output });\n try {\n output.write(\"\\nAgent guidance check\\n\");\n output.write(\"No AGENTS.md/CLAUDE.md file currently contains compact pm workflow guidance.\\n\");\n const answer = await rl.question(`Add a compact pm workflow section to ${targetRelativePath}? [Y/n] `);\n output.write(\"\\n\");\n return parsePromptChoice(answer, true);\n } finally {\n rl.close();\n }\n}\n\nfunction normalizeAgentGuidanceState(settings: PmSettings): PmSettings[\"agent_guidance\"] {\n const current = settings.agent_guidance;\n return {\n prompt_completed: current?.prompt_completed === true,\n declined: current?.declined === true,\n declined_at: typeof current?.declined_at === \"string\" ? current.declined_at : \"\",\n template_version:\n typeof current?.template_version === \"number\" && Number.isInteger(current.template_version) && current.template_version > 0\n ? current.template_version\n : AGENT_GUIDANCE_TEMPLATE_VERSION,\n last_checked_files: Array.isArray(current?.last_checked_files)\n ? [...new Set(current.last_checked_files.map((value) => value.trim()).filter((value) => value.length > 0))].sort(\n (left, right) => left.localeCompare(right),\n )\n : [],\n };\n}\n\nasync function scanGuidanceFiles(projectRoot: string): Promise<AgentGuidanceFileScan[]> {\n const scans: AgentGuidanceFileScan[] = [];\n for (const filename of AGENT_GUIDANCE_TARGET_FILENAMES) {\n const filePath = path.join(projectRoot, filename);\n const exists = await pathExists(filePath);\n if (!exists) {\n scans.push({\n file_path: filePath,\n exists,\n has_guidance: false,\n has_marker: false,\n });\n continue;\n }\n const content = await fs.readFile(filePath, \"utf8\");\n const contentLower = content.toLowerCase();\n const tokenHits = AGENT_GUIDANCE_REQUIRED_TOKENS.filter((token) => contentLower.includes(token));\n const hasMarker = hasGuidanceMarker(content);\n scans.push({\n file_path: filePath,\n exists,\n has_guidance: hasMarker || tokenHits.length >= AGENT_GUIDANCE_REQUIRED_TOKEN_THRESHOLD,\n has_marker: hasMarker,\n });\n }\n return scans;\n}\n\nfunction pushUnique(target: string[], value: string): void {\n if (!target.includes(value)) {\n target.push(value);\n }\n}\n\nfunction applyAgentGuidanceState(\n settings: PmSettings,\n currentState: PmSettings[\"agent_guidance\"],\n): { changed: boolean; state: PmSettings[\"agent_guidance\"] } {\n const existing = normalizeAgentGuidanceState(settings);\n const changed = JSON.stringify(existing) !== JSON.stringify(currentState);\n if (changed) {\n settings.agent_guidance = currentState;\n }\n return { changed, state: currentState };\n}\n\nasync function writeGuidanceFile(filePath: string): Promise<{ changed: boolean; warnings: string[] }> {\n const exists = await pathExists(filePath);\n const currentContent = exists ? await fs.readFile(filePath, \"utf8\") : \"\";\n const nextContent = upsertAgentGuidanceBlock(currentContent);\n if (!nextContent.changed) {\n return { changed: false, warnings: [] };\n }\n await fs.writeFile(filePath, nextContent.next_content, \"utf8\");\n return {\n changed: true,\n warnings: await runActiveOnWriteHooks({\n path: filePath,\n scope: \"project\",\n op: \"init:agent_guidance_file\",\n }),\n };\n}\n\nexport async function runInitAgentGuidance(options: RunInitAgentGuidanceOptions): Promise<RunInitAgentGuidanceResult> {\n const warnings: string[] = [];\n const nextSteps: string[] = [];\n const projectRoot = resolveProjectRoot(options.pm_root, options.cwd);\n let scans = await scanGuidanceFiles(projectRoot);\n const targetPath = resolveTargetGuidancePath(scans, projectRoot);\n const targetRelativePath = toPortableRelativePath(projectRoot, targetPath);\n const addLaterHint = \"Add workflow guidance later: pm init --agent-guidance add\";\n let prompted = false;\n let applied = false;\n let skipped = false;\n let state = normalizeAgentGuidanceState(options.settings);\n const checkedFiles = scans.map((entry) => toPortableRelativePath(projectRoot, entry.file_path));\n const presentBefore = scans.some((entry) => entry.has_guidance);\n\n const markState = (partial: Partial<PmSettings[\"agent_guidance\"]>): void => {\n state = {\n ...state,\n ...partial,\n template_version: AGENT_GUIDANCE_TEMPLATE_VERSION,\n last_checked_files: checkedFiles,\n };\n };\n\n if (options.mode === \"status\") {\n if (!presentBefore) {\n warnings.push(\"agent_guidance:missing\");\n pushUnique(nextSteps, addLaterHint);\n }\n } else if (options.mode === \"skip\") {\n skipped = true;\n markState({\n prompt_completed: true,\n declined: true,\n declined_at: state.declined_at.length > 0 ? state.declined_at : new Date().toISOString(),\n });\n warnings.push(\"agent_guidance:explicit_skip\");\n pushUnique(nextSteps, addLaterHint);\n } else if (options.mode === \"add\") {\n if (!presentBefore) {\n const writeResult = await writeGuidanceFile(targetPath);\n warnings.push(...writeResult.warnings);\n if (writeResult.changed) {\n applied = true;\n warnings.push(`agent_guidance:added:${targetRelativePath}`);\n }\n }\n markState({\n prompt_completed: true,\n declined: false,\n declined_at: \"\",\n });\n } else if (presentBefore) {\n if (state.declined) {\n markState({\n prompt_completed: true,\n declined: false,\n declined_at: \"\",\n });\n }\n } else if (state.prompt_completed && state.declined) {\n skipped = true;\n warnings.push(\"agent_guidance:skipped_declined\");\n pushUnique(nextSteps, addLaterHint);\n } else if (options.interactive) {\n prompted = true;\n const approved = await promptForGuidanceWrite(targetRelativePath);\n if (approved) {\n const writeResult = await writeGuidanceFile(targetPath);\n warnings.push(...writeResult.warnings);\n if (writeResult.changed) {\n applied = true;\n warnings.push(`agent_guidance:added:${targetRelativePath}`);\n }\n markState({\n prompt_completed: true,\n declined: false,\n declined_at: \"\",\n });\n } else {\n skipped = true;\n markState({\n prompt_completed: true,\n declined: true,\n declined_at: new Date().toISOString(),\n });\n warnings.push(\"agent_guidance:declined\");\n pushUnique(nextSteps, addLaterHint);\n }\n } else {\n warnings.push(\"agent_guidance:missing_non_interactive\");\n pushUnique(nextSteps, addLaterHint);\n }\n\n const stateUpdate = applyAgentGuidanceState(options.settings, state);\n if (applied) {\n scans = await scanGuidanceFiles(projectRoot);\n }\n\n const summary: InitAgentGuidanceSummary = {\n mode: options.mode,\n present: scans.some((entry) => entry.has_guidance),\n prompted,\n applied,\n skipped,\n declined: state.declined,\n prompt_completed: state.prompt_completed,\n template_version: state.template_version,\n target_file: targetRelativePath,\n checked_files: scans.map((entry) => toPortableRelativePath(projectRoot, entry.file_path)),\n files_with_guidance: scans\n .filter((entry) => entry.has_guidance)\n .map((entry) => toPortableRelativePath(projectRoot, entry.file_path)),\n missing_files: scans\n .filter((entry) => !entry.exists)\n .map((entry) => toPortableRelativePath(projectRoot, entry.file_path)),\n };\n\n return {\n summary,\n warnings,\n next_steps: nextSteps,\n settings_changed: stateUpdate.changed,\n };\n}\n"],"names":["fs","path","readline","input","output","nextContent","path","readline","input","output","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAOC,eAAc;AACrB,SAAS,SAASC,QAAO,UAAUC,eAAc;;;ACHjD,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,SAAS,SAAS,OAAO,UAAU,cAAc;AAO1C,IAAM,kCAA2D,CAAC,OAAO,OAAO,QAAQ,QAAQ;AAEvG,IAAM,kCAAkC,CAAC,aAAa,WAAW;AACjE,IAAM,iCAAiC;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF,IAAM,0CAA0C;AAChD,IAAM,kCAAkC;AACxC,IAAM,qCAAqC;AAC3C,IAAM,8BAA8B,qCAAqC,+BAA+B;AACxG,IAAM,4BAA4B;AA4ClC,SAAS,uBAAuB,aAAqB,YAAkB;AACrE,QAAM,WAAW,KAAK,SAAS,aAAa,UAAU;AACtD,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO,KAAK,SAAS,UAAU;EACjC;AACA,SAAO,SAAS,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG;AAC1C;AAEA,SAAS,sBAAsB,OAAa;AAC1C,SAAO,MAAM,SAAS,IAAI,IAAI,QA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AgB;IACjC;EACF;AAEA,SAAO;IACL,IAAI;IACJ,MAAM;IACN;IACA,cAAc;IACd;IACA,mBAAmB,SAAS,WAAW;IACvC,aAAa;IACb,GAAI,uBAAuB,EAAE,wBAAwB,qBAAoB,IAAK,CAAA;IAC9E,GAAI,oBAAoB,EAAE,oBAAoB,kBAAiB,IAAK,CAAA;IACpE,YAAY;IACZ,gBAAgB,oBAAoB;;AAExC","debugId":"4142e7c6-57b9-534b-8af8-0398662732fe"}
@@ -1,25 +1,26 @@
1
1
  import {
2
2
  verifyHistoryChain
3
- } from "./chunk-UM2GBHS4.js";
3
+ } from "./chunk-MSH23UWO.js";
4
4
  import {
5
5
  hashDocument
6
- } from "./chunk-XTGLRY2Y.js";
6
+ } from "./chunk-2HMD3JM2.js";
7
7
  import {
8
8
  getHistoryPath,
9
9
  writeFileAtomic
10
- } from "./chunk-U5SXYXSY.js";
10
+ } from "./chunk-3TXWDGPU.js";
11
11
 
12
12
  // dist/core/history/drift-scan.js
13
13
  import fs from "fs/promises";
14
+ import { createHash } from "node:crypto";
14
15
  import path from "node:path";
15
16
  !(function() {
16
17
  try {
17
18
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
18
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e8559b46-0199-506f-bf98-8f92a4474215");
19
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "0dd4c4e6-9086-5afb-814b-38d0b36d4283");
19
20
  } catch (e2) {
20
21
  }
21
22
  })();
22
- var DRIFT_CACHE_VERSION = 1;
23
+ var DRIFT_CACHE_VERSION = 2;
23
24
  var DRIFT_CACHE_FILENAME = "history-drift-cache.json";
24
25
  function getDriftCachePath(pmRoot) {
25
26
  return path.join(pmRoot, "runtime", DRIFT_CACHE_FILENAME);
@@ -39,8 +40,16 @@ async function loadDriftCache(pmRoot) {
39
40
  function isErrno(error, code) {
40
41
  return typeof error === "object" && error !== null && "code" in error && error.code === code;
41
42
  }
43
+ function hashContent(raw) {
44
+ return createHash("sha256").update(raw).digest("hex");
45
+ }
46
+ async function readHistoryContentHash(historyPath) {
47
+ const raw = await fs.readFile(historyPath, "utf8");
48
+ return hashContent(raw);
49
+ }
42
50
  async function verifyHistoryStream(historyPath) {
43
51
  const raw = await fs.readFile(historyPath, "utf8");
52
+ const contentHash = hashContent(raw);
44
53
  if (raw.trim().length === 0) {
45
54
  return null;
46
55
  }
@@ -61,7 +70,11 @@ async function verifyHistoryStream(historyPath) {
61
70
  if (!latestAfterHash) {
62
71
  return null;
63
72
  }
64
- return { latestAfterHash, chainOk: verifyHistoryChain(entries).ok };
73
+ return {
74
+ latestAfterHash,
75
+ chainOk: verifyHistoryChain(entries).ok,
76
+ contentHash
77
+ };
65
78
  }
66
79
  async function scanHistoryDrift(pmRoot, items) {
67
80
  const missingStreams = [];
@@ -85,24 +98,59 @@ async function scanHistoryDrift(pmRoot, items) {
85
98
  }
86
99
  continue;
87
100
  }
101
+ const loadStreamVerification = async () => {
102
+ try {
103
+ return await verifyHistoryStream(historyPath);
104
+ } catch {
105
+ return "unreadable";
106
+ }
107
+ };
108
+ const loadFreshVerification = async () => {
109
+ const loaded = await loadStreamVerification();
110
+ if (loaded === "unreadable") {
111
+ unreadableStreams.push(item.id);
112
+ return null;
113
+ }
114
+ if (!loaded) {
115
+ missingStreams.push(item.id);
116
+ return null;
117
+ }
118
+ return loaded;
119
+ };
88
120
  const cached = previousEntries[item.id];
89
121
  let verification;
90
- if (cached && cached.mtime_ms === stat.mtimeMs && cached.ctime_ms === stat.ctimeMs && cached.size === stat.size) {
91
- verification = { latestAfterHash: cached.latest_after_hash, chainOk: cached.chain_ok };
92
- } else {
93
- cacheDirty = true;
94
- let result;
122
+ const metadataMatchesCache = cached !== void 0 && cached.mtime_ms === stat.mtimeMs && cached.ctime_ms === stat.ctimeMs && cached.size === stat.size;
123
+ const cachedContentHash = typeof cached?.content_hash === "string" && cached.content_hash.length > 0 ? cached.content_hash : void 0;
124
+ const canUseCache = metadataMatchesCache && cachedContentHash !== void 0;
125
+ if (canUseCache && cached) {
126
+ let currentContentHash;
95
127
  try {
96
- result = await verifyHistoryStream(historyPath);
128
+ currentContentHash = await readHistoryContentHash(historyPath);
97
129
  } catch {
98
130
  unreadableStreams.push(item.id);
99
131
  continue;
100
132
  }
101
- if (!result) {
102
- missingStreams.push(item.id);
133
+ if (currentContentHash === cachedContentHash) {
134
+ verification = {
135
+ latestAfterHash: cached.latest_after_hash,
136
+ chainOk: cached.chain_ok,
137
+ contentHash: currentContentHash
138
+ };
139
+ } else {
140
+ cacheDirty = true;
141
+ const refreshed = await loadFreshVerification();
142
+ if (!refreshed) {
143
+ continue;
144
+ }
145
+ verification = refreshed;
146
+ }
147
+ } else {
148
+ cacheDirty = true;
149
+ const refreshed = await loadFreshVerification();
150
+ if (!refreshed) {
103
151
  continue;
104
152
  }
105
- verification = result;
153
+ verification = refreshed;
106
154
  }
107
155
  if (!verification.chainOk) {
108
156
  chainMismatches.push(item.id);
@@ -111,6 +159,7 @@ async function scanHistoryDrift(pmRoot, items) {
111
159
  mtime_ms: stat.mtimeMs,
112
160
  ctime_ms: stat.ctimeMs,
113
161
  size: stat.size,
162
+ content_hash: verification.contentHash,
114
163
  latest_after_hash: verification.latestAfterHash,
115
164
  chain_ok: verification.chainOk
116
165
  };
@@ -139,7 +188,7 @@ async function scanHistoryDrift(pmRoot, items) {
139
188
  !(function() {
140
189
  try {
141
190
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
142
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e7af63b5-6c1c-55f2-bafc-027531d5725f");
191
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "88ac4364-7d22-5199-8b9b-c6f40eb50d8b");
143
192
  } catch (e2) {
144
193
  }
145
194
  })();
@@ -203,6 +252,11 @@ var REMEDIATION_REGISTRY = Object.freeze([
203
252
  command: "pm health --check-telemetry",
204
253
  summary: "The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only."
205
254
  },
255
+ {
256
+ code: "telemetry_schema_version_behind",
257
+ command: "pm health --check-telemetry",
258
+ summary: "Client schema is behind server; upgrade pm-cli to emit the latest event shape."
259
+ },
206
260
  // --- pm health: integrity ---
207
261
  {
208
262
  code: "integrity_item_unreadable",
@@ -419,4 +473,4 @@ export {
419
473
  buildRemediationMap,
420
474
  buildRemediationCommands
421
475
  };
422
- //# sourceMappingURL=chunk-52MAOQ6J.js.map
476
+ //# sourceMappingURL=chunk-RISLL7XH.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../core/history/drift-scan.ts", "../../../../../../../../core/diagnostics/remediation.ts"],
4
+ "sourcesContent": ["import fs from \"fs/promises\";\nimport { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport { getHistoryPath } from \"../store/paths.js\";\nimport { writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { hashDocument } from \"./history.js\";\nimport { verifyHistoryChain } from \"./replay.js\";\nimport type { HistoryEntry, ItemMetadata } from \"../../types/index.js\";\n\nexport interface DriftScanResult {\n missingStreams: string[];\n unreadableStreams: string[];\n hashMismatches: string[];\n chainMismatches: string[];\n driftedItems: string[];\n}\n\nconst DRIFT_CACHE_VERSION = 2;\nconst DRIFT_CACHE_FILENAME = \"history-drift-cache.json\";\n\ninterface DriftCacheEntry {\n mtime_ms: number;\n ctime_ms: number;\n size: number;\n content_hash: string;\n latest_after_hash: string;\n chain_ok: boolean;\n}\n\ninterface DriftCacheEnvelope {\n version: number;\n entries: Record<string, DriftCacheEntry>;\n}\n\nfunction getDriftCachePath(pmRoot: string): string {\n return path.join(pmRoot, \"runtime\", DRIFT_CACHE_FILENAME);\n}\n\nasync function loadDriftCache(pmRoot: string): Promise<DriftCacheEnvelope | null> {\n try {\n const raw = await fs.readFile(getDriftCachePath(pmRoot), \"utf8\");\n const parsed = JSON.parse(raw) as DriftCacheEnvelope;\n if (parsed.version !== DRIFT_CACHE_VERSION || typeof parsed.entries !== \"object\" || parsed.entries === null) {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n\ninterface StreamVerification {\n latestAfterHash: string;\n chainOk: boolean;\n contentHash: string;\n}\n\nfunction hashContent(raw: string): string {\n return createHash(\"sha256\").update(raw).digest(\"hex\");\n}\n\nasync function readHistoryContentHash(historyPath: string): Promise<string> {\n const raw = await fs.readFile(historyPath, \"utf8\");\n return hashContent(raw);\n}\n\n/**\n * Read and fully verify one history stream's hash chain. Returns null for an\n * empty/missing stream (caller records it as a missing stream).\n */\nasync function verifyHistoryStream(historyPath: string): Promise<StreamVerification | null> {\n const raw = await fs.readFile(historyPath, \"utf8\");\n const contentHash = hashContent(raw);\n if (raw.trim().length === 0) {\n return null;\n }\n const entries: HistoryEntry[] = [];\n let latestAfterHash: string | null = null;\n for (const line of raw.split(/\\r?\\n/)) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n const parsed = JSON.parse(trimmed) as HistoryEntry;\n if (typeof parsed.after_hash !== \"string\" || parsed.after_hash.trim().length === 0) {\n throw new Error(\"missing after_hash\");\n }\n entries.push(parsed);\n latestAfterHash = parsed.after_hash;\n }\n /* c8 ignore start -- defensive guard for future history schema changes. */\n if (!latestAfterHash) {\n return null;\n }\n /* c8 ignore stop */\n return {\n latestAfterHash,\n chainOk: verifyHistoryChain(entries).ok,\n contentHash,\n };\n}\n\n/**\n * Scan every item's history stream for drift (missing/unreadable streams, broken\n * hash chains, and item/history hash mismatches).\n *\n * Full chain re-verification of a 17MB+ history tree is the dominant cost of\n * `pm health`. We cache the per-stream verification keyed by the history file's\n * mtime/ctime/size + content hash: metadata-stable replacements (same stat tuple)\n * can still happen, so each metadata hit recomputes a content hash guard before\n * trusting the cached chain/hash verification.\n */\nexport async function scanHistoryDrift(\n pmRoot: string,\n items: Array<ItemMetadata & { body: string }>,\n): Promise<DriftScanResult> {\n const missingStreams: string[] = [];\n const unreadableStreams: string[] = [];\n const hashMismatches: string[] = [];\n const chainMismatches: string[] = [];\n\n const cache = await loadDriftCache(pmRoot);\n const previousEntries: Record<string, DriftCacheEntry> = cache?.entries ?? {};\n const nextEntries: Record<string, DriftCacheEntry> = {};\n let cacheDirty = false;\n\n for (const item of items) {\n const historyPath = getHistoryPath(pmRoot, item.id);\n\n let stat: Awaited<ReturnType<typeof fs.stat>>;\n try {\n stat = await fs.stat(historyPath);\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n missingStreams.push(item.id);\n } else {\n unreadableStreams.push(item.id);\n }\n continue;\n }\n\n const loadStreamVerification = async (): Promise<StreamVerification | null | \"unreadable\"> => {\n try {\n return await verifyHistoryStream(historyPath);\n } catch {\n return \"unreadable\";\n }\n };\n\n const loadFreshVerification = async (): Promise<StreamVerification | null> => {\n const loaded = await loadStreamVerification();\n if (loaded === \"unreadable\") {\n unreadableStreams.push(item.id);\n return null;\n }\n if (!loaded) {\n missingStreams.push(item.id);\n return null;\n }\n return loaded;\n };\n\n const cached = previousEntries[item.id];\n let verification: StreamVerification;\n const metadataMatchesCache =\n cached !== undefined &&\n cached.mtime_ms === stat.mtimeMs &&\n cached.ctime_ms === stat.ctimeMs &&\n cached.size === stat.size;\n const cachedContentHash =\n typeof cached?.content_hash === \"string\" && cached.content_hash.length > 0 ? cached.content_hash : undefined;\n const canUseCache = metadataMatchesCache && cachedContentHash !== undefined;\n if (canUseCache && cached) {\n let currentContentHash: string;\n try {\n currentContentHash = await readHistoryContentHash(historyPath);\n } catch {\n unreadableStreams.push(item.id);\n continue;\n }\n if (currentContentHash === cachedContentHash) {\n verification = {\n latestAfterHash: cached.latest_after_hash,\n chainOk: cached.chain_ok,\n contentHash: currentContentHash,\n };\n } else {\n cacheDirty = true;\n const refreshed = await loadFreshVerification();\n if (!refreshed) {\n continue;\n }\n verification = refreshed;\n }\n } else {\n cacheDirty = true;\n const refreshed = await loadFreshVerification();\n if (!refreshed) {\n continue;\n }\n verification = refreshed;\n }\n\n if (!verification.chainOk) {\n chainMismatches.push(item.id);\n }\n nextEntries[item.id] = {\n mtime_ms: stat.mtimeMs,\n ctime_ms: stat.ctimeMs,\n size: stat.size,\n content_hash: verification.contentHash,\n latest_after_hash: verification.latestAfterHash,\n chain_ok: verification.chainOk,\n };\n\n const { body, ...frontMatter } = item;\n const currentHash = hashDocument({\n metadata: frontMatter as ItemMetadata,\n body,\n });\n if (currentHash !== verification.latestAfterHash) {\n hashMismatches.push(item.id);\n }\n }\n\n if (cacheDirty || Object.keys(previousEntries).length !== Object.keys(nextEntries).length) {\n const cachePath = getDriftCachePath(pmRoot);\n try {\n await fs.mkdir(path.dirname(cachePath), { recursive: true });\n await writeFileAtomic(cachePath, JSON.stringify({ version: DRIFT_CACHE_VERSION, entries: nextEntries }));\n } catch {\n // Best-effort cache write: a failed persist must never fail a health scan.\n }\n }\n\n const driftedItems = [...new Set([...missingStreams, ...unreadableStreams, ...hashMismatches, ...chainMismatches])].sort((a, b) =>\n a.localeCompare(b),\n );\n return { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems };\n}\n", "/**\n * Shared machine-executable remediation registry.\n *\n * `pm health` and `pm validate` both emit stable, colon-delimited warning tokens\n * (for example `history_drift_missing_stream:pm-abcd` or\n * `validate_resolution_missing_fields:3`). Agents that gate on these commands\n * previously had to hardcode the mapping from a warning code to the `pm` command\n * that fixes it. This module is the single source of truth for that mapping so\n * `pm health --json` (per-check `remediation_map`) and `pm validate --fix-hints`\n * (per-check `fix_hints`) can both surface executable remediation without any\n * duplicated, drift-prone lookup tables.\n *\n * Semantics of {@link RemediationEntry.command}: the suggested next `pm` command\n * an operator/agent should run to resolve findings with that code. Per-item\n * findings use an `<id>` placeholder (callers that have the concrete id may\n * substitute it); findings whose only fix is a manual file edit point at the\n * most useful diagnostic/repair command and describe the manual step in\n * {@link RemediationEntry.summary}.\n */\n\nexport interface RemediationEntry {\n /**\n * Stable warning-code prefix this entry resolves. A warning matches when it\n * equals this code or begins with `<code>:`. Registry codes are mutually\n * exclusive under that colon-boundary rule (no code is a `:`-delimited prefix\n * of another — e.g. `settings:id_prefix_empty` is distinct from a bare\n * `settings`, which is intentionally not registered), so `resolveRemediation`\n * uses first-match with no ordering dependency.\n */\n readonly code: string;\n /** Executable `pm` command (or imperative) that resolves the finding. May contain an `<id>` placeholder. */\n readonly command: string;\n /** One-line description of what the command does / which manual step it covers. */\n readonly summary: string;\n}\n\n/**\n * Registry of every non-extension `pm health` / `pm validate` warning code and\n * its remediation. Extension findings keep their richer, contextual\n * `details.triage.remediation` produced by the extension health triage and are\n * intentionally excluded here (see pm-0hnu: \"all non-extension checks\").\n */\nexport const REMEDIATION_REGISTRY: readonly RemediationEntry[] = Object.freeze([\n // --- pm health: directories ---\n {\n code: \"missing_directory\",\n command: \"pm init\",\n summary: \"Recreate missing tracker directories (pm init is idempotent and restores the scaffold).\",\n },\n // --- pm health: settings (read/parse) ---\n {\n code: \"settings_read_invalid_json\",\n command: \"pm config list --json\",\n summary:\n \"settings.json is not valid JSON and pm fell back to defaults; fix the syntax error in the reported path, then re-run.\",\n },\n {\n code: \"settings_read_invalid_schema\",\n command: \"pm config list --json\",\n summary:\n \"settings.json failed schema validation and pm fell back to defaults; correct the reported key in the file, then re-run.\",\n },\n {\n code: \"settings_read_merge_failed\",\n command: \"pm config list --json\",\n summary: \"Global/project settings could not be merged; reconcile the conflicting keys in the reported settings files.\",\n },\n // --- pm health: settings_values ---\n {\n code: \"settings:id_prefix_empty\",\n command: \"pm config list --json\",\n summary: 'id_prefix is empty; set a non-empty \"id_prefix\" in settings.json so generated item ids are well-formed.',\n },\n {\n code: \"settings:locks_ttl_non_positive\",\n command: \"pm config list --json\",\n summary: 'locks.ttl_seconds must be positive; set a positive \"locks.ttl_seconds\" in settings.json.',\n },\n // --- pm health: telemetry (advisory) ---\n {\n code: \"telemetry_state_invalid_json\",\n command: \"pm health --check-telemetry\",\n summary: \"Local telemetry state file is corrupt; pm recreates it on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_invalid_rows\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry queue has unparseable rows; they are skipped on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_pending\",\n command: \"pm health --check-telemetry\",\n summary: \"Telemetry events are queued; they flush automatically on the next reachable command. Advisory only.\",\n },\n {\n code: \"telemetry_endpoint_probe_failed\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint is unreachable; events stay queued until it recovers. Advisory only.\",\n },\n {\n code: \"telemetry_endpoint_probe_http_status\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only.\",\n },\n {\n code: \"telemetry_schema_version_behind\",\n command: \"pm health --check-telemetry\",\n summary: \"Client schema is behind server; upgrade pm-cli to emit the latest event shape.\",\n },\n // --- pm health: integrity ---\n {\n code: \"integrity_item_unreadable\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file could not be read; restore or repair the file at the reported path.\",\n },\n {\n code: \"integrity_item_parse_failed\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file failed to parse; fix the malformed front matter at the reported path.\",\n },\n {\n code: \"integrity_item_conflict_marker\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file contains Git conflict markers; resolve the <<<<<<< / >>>>>>> markers at the reported line.\",\n },\n {\n code: \"integrity_history_unreadable\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream could not be read; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_invalid_json\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains invalid JSON; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_conflict_marker\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains Git conflict markers; resolve the markers, then re-anchor the chain.\",\n },\n // --- pm health: history_drift ---\n {\n code: \"history_drift_missing_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item has no history stream; re-anchor the chain to rebuild it.\",\n },\n {\n code: \"history_drift_unreadable_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history stream is unreadable; re-anchor the chain.\",\n },\n {\n code: \"history_drift_hash_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's content hash no longer matches its history; re-anchor the chain.\",\n },\n {\n code: \"history_drift_chain_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history chain is broken; re-anchor the chain.\",\n },\n // --- pm health: vectorization ---\n {\n code: \"vectorization_stale_items_remaining\",\n command: \"pm health --refresh-vectors\",\n summary: \"Some items have stale embeddings; refresh vectors so semantic search results stay current.\",\n },\n // --- pm validate: metadata ---\n // Note: validate_metadata_missing_author has no entry on purpose. `pm update\n // --author` sets the mutation/audit author (history), not the item's\n // `metadata.author` front-matter field, and there is no CLI flag that writes\n // that field — so emitting a command here would record an audit entry without\n // clearing the finding. A missing item author must be restored at the source.\n {\n code: \"validate_metadata_missing_acceptance_criteria\",\n command: 'pm update <id> --acceptance-criteria \"<criteria>\"',\n summary: \"Backfill the missing acceptance criteria on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_estimate\",\n command: 'pm update <id> --estimate \"<estimate>\"',\n summary: \"Backfill the missing estimate on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_close_reason\",\n command: 'pm update <id> --close-reason \"<reason>\"',\n summary: \"Backfill the missing close reason on the reported closed item(s).\",\n },\n {\n code: \"validate_metadata_missing_reviewer\",\n command: 'pm update <id> --reviewer \"<name>\"',\n summary: \"Backfill the missing reviewer on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_risk\",\n command: 'pm update <id> --risk \"<level>\"',\n summary: \"Backfill the missing risk on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_confidence\",\n command: 'pm update <id> --confidence \"<level>\"',\n summary: \"Backfill the missing confidence on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_sprint\",\n command: 'pm update <id> --sprint \"<sprint>\"',\n summary: \"Backfill the missing sprint on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_release\",\n command: 'pm update <id> --release \"<release>\"',\n summary: \"Backfill the missing release on the reported item(s).\",\n },\n {\n code: \"validate_metadata_custom_profile_missing_required_fields\",\n command: 'pm config set metadata-required-fields --criterion \"<field>\"',\n summary:\n \"Config-driven finding: the custom metadata profile has no required fields configured and falls back to core, so configure the fields rather than mutating items.\",\n },\n // --- pm validate: resolution ---\n {\n code: \"validate_resolution_missing_fields\",\n command: 'pm update <id> --resolution \"<how resolved>\"',\n summary: \"Backfill resolution / expected_result / actual_result on the reported closed item(s).\",\n },\n // --- pm validate: lifecycle ---\n {\n code: \"validate_lifecycle_active_closure_like_metadata\",\n command: \"pm update <id> --unset <closure-like-field>\",\n summary:\n \"Clear the closure-like field the validator flags on this active item — the detail row names it (resolution / actual-result / blocked-reason) — or close the item if it is actually done.\",\n },\n {\n code: \"validate_lifecycle_active_terminal_parent\",\n command: \"pm update <id> --parent <active-parent-id>\",\n summary: \"Reopen the terminal parent or move the active child under a non-terminal parent.\",\n },\n {\n code: \"validate_lifecycle_stale_blockers\",\n command: \"pm update <id> --unset blocked-by --unset blocked-reason\",\n summary:\n \"Resolve the stale blocker the validator flags: clear blocked-by/blocked-reason when they linger on a non-blocked item or report a resolved blocker; if instead a blocked item is missing blocker context, add the context or move it out of a blocked status.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles_error\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n // --- pm validate: files ---\n {\n code: \"validate_files_missing_linked_paths\",\n command: \"pm <files|docs> <id> --remove <path>\",\n summary:\n \"The check spans both item.files and item.docs under one code: restore the missing linked artifact, or unlink it with pm files (linked file) or pm docs (linked doc).\",\n },\n {\n code: \"validate_files_orphaned_paths\",\n command: \"pm <files|docs> <id> --add <path>\",\n summary:\n \"Link the orphaned artifact with pm files (file) or pm docs (doc), or remove it from the workspace.\",\n },\n {\n code: \"validate_files_tracked_all_strict_forces_pm_internals\",\n command: \"pm validate --check-files --include-pm-internals\",\n summary: \"tracked-all-strict scan flagged pm internals; re-run with --include-pm-internals or a softer --scan-mode.\",\n },\n // --- pm validate: history_drift ---\n {\n code: \"validate_history_drift_missing_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items missing a history stream.\",\n },\n {\n code: \"validate_history_drift_unreadable_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with an unreadable history stream.\",\n },\n {\n code: \"validate_history_drift_hash_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items whose content hash drifted.\",\n },\n {\n code: \"validate_history_drift_chain_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with a broken history chain.\",\n },\n // --- pm validate: command_references ---\n {\n code: \"validate_command_references_stale_pm_ids\",\n command: 'pm update <id> --replace-tests --test \"command=<corrected-command>\" [--test ...]',\n summary:\n \"Correct the stale pm-ID inside the item's linked test command (the check scans tests[].command, not the body). --replace-tests overwrites the entire tests list, so re-include the item's other linked tests in the same call.\",\n },\n]);\n\n/**\n * Resolve the remediation entry for a warning token, or `undefined` when no\n * entry is registered. A warning matches an entry when it equals the entry code\n * or begins with `<code>:` (the colon boundary keeps sibling codes such as\n * `validate_lifecycle_dependency_cycles` and\n * `validate_lifecycle_dependency_cycles_error` disjoint).\n *\n * First match is intentional and correct: registry codes are mutually exclusive\n * under the colon-boundary rule, so at most one entry can ever match a warning\n * and order is irrelevant. That invariant is enforced by a test (see\n * remediation-registry.spec.ts \"keeps every registry code mutually exclusive\"),\n * which is why this stays a simple linear scan rather than a longest-prefix\n * search — a longest-prefix tie-break is unreachable with disjoint codes.\n *\n * Accepts unknown input defensively (this is an exported helper SDK consumers\n * may call from untyped JS): a non-string `warning` resolves to `undefined`.\n */\nexport function resolveRemediation(warning: string): RemediationEntry | undefined {\n if (typeof warning !== \"string\") {\n return undefined;\n }\n const normalized = warning.trim();\n for (const entry of REMEDIATION_REGISTRY) {\n if (normalized === entry.code || normalized.startsWith(`${entry.code}:`)) {\n return entry;\n }\n }\n return undefined;\n}\n\n/**\n * Build a compact `remediation_map` (code -> command) for a set of warning\n * tokens. First match wins per code; unknown codes are skipped. Used by\n * `pm health --json` per-check details and as the source of deduped executable\n * commands for `pm validate --fix-hints`.\n */\nexport function buildRemediationMap(warnings: Iterable<string>): Record<string, string> {\n const map: Record<string, string> = {};\n for (const warning of warnings) {\n const entry = resolveRemediation(warning);\n if (entry !== undefined && !Object.prototype.hasOwnProperty.call(map, entry.code)) {\n map[entry.code] = entry.command;\n }\n }\n return map;\n}\n\n/**\n * Build a deduped, ordered list of executable remediation commands for a set of\n * warning tokens (one command per distinct matched code). Used by\n * `pm validate --fix-hints` for checks that do not already emit per-row\n * remediation commands.\n */\nexport function buildRemediationCommands(warnings: Iterable<string>): string[] {\n return Object.values(buildRemediationMap(warnings));\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,SAAS,kBAAkB;AAC3B,OAAO,UAAU;;;;;;;;AAejB,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAgB7B,SAAS,kBAAkB,QAAc;AACvC,SAAO,KAAK,KAAK,QAAQ,WAAW,oBAAoB;AAC1D;AAEA,eAAe,eAAe,QAAc;AAC1C,MAAI;AACF,UAAM,MAAM,MAAM,GAAG,SAAS,kBAAkB,MAAM,GAAG,MAAM;AAC/D,UAAM,SAAS,KA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
9
  readRuntimeFieldOptionValue
10
- } from "./chunk-LB3RUL2N.js";
10
+ } from "./chunk-XEKZCBCS.js";
11
11
  import {
12
12
  EXIT_CODE,
13
13
  PmCliError,
14
14
  stableValueEquals
15
- } from "./chunk-5SFCOO6B.js";
15
+ } from "./chunk-YJAKN2N2.js";
16
16
 
17
17
  // dist/core/item/status-filter.js
18
18
  var STATUS_GROUP_ALIASES = {
@@ -125,6 +125,6 @@ export {
125
125
  collectRuntimeFilterValues,
126
126
  matchesRuntimeFilters
127
127
  };
128
- //# sourceMappingURL=chunk-GCOQW437.js.map
128
+ //# sourceMappingURL=chunk-SDLEYY6A.js.map
129
129
 
130
130
  //# debugId=18d2c948-3f43-54ab-a773-8289b2d0d9ec