@unbrained/pm-cli 2026.7.5 → 2026.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/cli/commands/annotation-command.d.ts +1 -0
  3. package/dist/cli/commands/annotation-command.js +29 -2
  4. package/dist/cli/commands/annotation-command.js.map +1 -1
  5. package/dist/cli/commands/comments.js +3 -4
  6. package/dist/cli/commands/comments.js.map +1 -1
  7. package/dist/cli/commands/extension/bundled-catalog.d.ts +3 -0
  8. package/dist/cli/commands/extension/bundled-catalog.js +38 -28
  9. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
  10. package/dist/cli/commands/extension/install-sources.js +81 -18
  11. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  12. package/dist/cli/commands/health.js +9 -5
  13. package/dist/cli/commands/health.js.map +1 -1
  14. package/dist/cli/commands/learnings.js +5 -3
  15. package/dist/cli/commands/learnings.js.map +1 -1
  16. package/dist/cli/commands/notes.js +5 -3
  17. package/dist/cli/commands/notes.js.map +1 -1
  18. package/dist/cli/commands/reindex.js +4 -3
  19. package/dist/cli/commands/reindex.js.map +1 -1
  20. package/dist/cli/commands/search.js +3 -3
  21. package/dist/cli/commands/search.js.map +1 -1
  22. package/dist/cli/commands/test.d.ts +9 -0
  23. package/dist/cli/commands/test.js +144 -105
  24. package/dist/cli/commands/test.js.map +1 -1
  25. package/dist/cli/extension-command-help.js +10 -2
  26. package/dist/cli/extension-command-help.js.map +1 -1
  27. package/dist/cli/register-list-query.d.ts +1 -1
  28. package/dist/cli/register-list-query.js +18 -27
  29. package/dist/cli/register-list-query.js.map +1 -1
  30. package/dist/cli/register-operations.d.ts +0 -8
  31. package/dist/cli/register-operations.js +41 -46
  32. package/dist/cli/register-operations.js.map +1 -1
  33. package/dist/cli/register-setup.js +113 -13
  34. package/dist/cli/register-setup.js.map +1 -1
  35. package/dist/cli/registration-helpers.d.ts +5 -1
  36. package/dist/cli/registration-helpers.js +14 -2
  37. package/dist/cli/registration-helpers.js.map +1 -1
  38. package/dist/cli-bundle/chunks/append-F7WPGIQL.js +11 -0
  39. package/dist/cli-bundle/chunks/{contracts-OJEXMKVW.js → append-PVCTBVJG.js} +8 -9
  40. package/dist/cli-bundle/chunks/{chunk-PPE4YUQM.js → chunk-2APXX4TZ.js} +17 -28
  41. package/dist/cli-bundle/chunks/chunk-2APXX4TZ.js.map +1 -0
  42. package/dist/cli-bundle/chunks/{docs-S6UTOTO5.js → chunk-2LEJGRQ7.js} +3 -12
  43. package/dist/cli-bundle/chunks/{docs-S6UTOTO5.js.map → chunk-2LEJGRQ7.js.map} +1 -1
  44. package/dist/cli-bundle/chunks/{chunk-T3ABIMGW.js → chunk-2TILG6F2.js} +3 -3
  45. package/dist/cli-bundle/chunks/{chunk-S5AYOUT5.js → chunk-3G6UMXT3.js} +6 -8
  46. package/dist/cli-bundle/chunks/{chunk-S5AYOUT5.js.map → chunk-3G6UMXT3.js.map} +1 -1
  47. package/dist/cli-bundle/chunks/{chunk-RCT3YJOK.js → chunk-3TYOW6RR.js} +8 -8
  48. package/dist/cli-bundle/chunks/{chunk-3JZNEQBA.js → chunk-3X542TEY.js} +7 -7
  49. package/dist/cli-bundle/chunks/{history-repair-EVTO6LIH.js → chunk-42LXP4VO.js} +14 -21
  50. package/dist/cli-bundle/chunks/{history-repair-EVTO6LIH.js.map → chunk-42LXP4VO.js.map} +1 -1
  51. package/dist/cli-bundle/chunks/{chunk-5J2XPTAD.js → chunk-43SIHQND.js} +36 -15
  52. package/dist/cli-bundle/chunks/chunk-43SIHQND.js.map +7 -0
  53. package/dist/cli-bundle/chunks/{history-repair-4N6SDVHK.js → chunk-43UQN754.js} +12 -19
  54. package/dist/cli-bundle/chunks/{history-repair-4N6SDVHK.js.map → chunk-43UQN754.js.map} +1 -1
  55. package/dist/cli-bundle/chunks/{chunk-OWTIRHX4.js → chunk-43YSKY75.js} +4 -6
  56. package/dist/cli-bundle/chunks/{chunk-OWTIRHX4.js.map → chunk-43YSKY75.js.map} +1 -1
  57. package/dist/cli-bundle/chunks/{notes-72YXN5JX.js → chunk-4BKDAEDF.js} +6 -13
  58. package/dist/cli-bundle/chunks/{notes-72YXN5JX.js.map → chunk-4BKDAEDF.js.map} +2 -2
  59. package/dist/cli-bundle/chunks/{close-many-AP4MWU36.js → chunk-4IQKDKGE.js} +18 -32
  60. package/dist/cli-bundle/chunks/{close-many-AP4MWU36.js.map → chunk-4IQKDKGE.js.map} +1 -1
  61. package/dist/cli-bundle/chunks/{chunk-ZCJAA3JK.js → chunk-4MZOKTI2.js} +6 -8
  62. package/dist/cli-bundle/chunks/{chunk-ZCJAA3JK.js.map → chunk-4MZOKTI2.js.map} +1 -1
  63. package/dist/cli-bundle/chunks/{chunk-IJ6CO3JV.js → chunk-52NS7JDP.js} +14 -20
  64. package/dist/cli-bundle/chunks/{chunk-IJ6CO3JV.js.map → chunk-52NS7JDP.js.map} +1 -1
  65. package/dist/cli-bundle/chunks/{chunk-T3F4DF23.js → chunk-565WYS5W.js} +12 -16
  66. package/dist/cli-bundle/chunks/{chunk-T3F4DF23.js.map → chunk-565WYS5W.js.map} +1 -1
  67. package/dist/cli-bundle/chunks/{copy-OTJOWFL6.js → chunk-5FIQ4EX3.js} +13 -19
  68. package/dist/cli-bundle/chunks/{copy-OTJOWFL6.js.map → chunk-5FIQ4EX3.js.map} +1 -1
  69. package/dist/cli-bundle/chunks/{config-V57QD47V.js → chunk-6G6O3OPQ.js} +259 -41
  70. package/dist/cli-bundle/chunks/chunk-6G6O3OPQ.js.map +1 -0
  71. package/dist/cli-bundle/chunks/{chunk-K3AGVXSF.js → chunk-6LCJRGPD.js} +9 -13
  72. package/dist/cli-bundle/chunks/{chunk-K3AGVXSF.js.map → chunk-6LCJRGPD.js.map} +1 -1
  73. package/dist/cli-bundle/chunks/{chunk-7MDXZAZS.js → chunk-6UQCNWFV.js} +6 -8
  74. package/dist/cli-bundle/chunks/{chunk-7MDXZAZS.js.map → chunk-6UQCNWFV.js.map} +1 -1
  75. package/dist/cli-bundle/chunks/{chunk-LEKT4K7I.js → chunk-6XTSYPPO.js} +1216 -387
  76. package/dist/cli-bundle/chunks/chunk-6XTSYPPO.js.map +7 -0
  77. package/dist/cli-bundle/chunks/chunk-7ML7JONU.js +5434 -0
  78. package/dist/cli-bundle/chunks/chunk-7ML7JONU.js.map +1 -0
  79. package/dist/cli-bundle/chunks/{chunk-TSPKZRRW.js → chunk-7PNQA24K.js} +30 -36
  80. package/dist/cli-bundle/chunks/{chunk-TSPKZRRW.js.map → chunk-7PNQA24K.js.map} +1 -1
  81. package/dist/cli-bundle/chunks/{chunk-YOF5VPKM.js → chunk-7VQ3JJN5.js} +2 -2
  82. package/dist/cli-bundle/chunks/{chunk-BFVHCAOO.js → chunk-7Y5N34HX.js} +8 -12
  83. package/dist/cli-bundle/chunks/{chunk-BFVHCAOO.js.map → chunk-7Y5N34HX.js.map} +1 -1
  84. package/dist/cli-bundle/chunks/{chunk-P5TFTLWW.js → chunk-AGAVEDIE.js} +7 -7
  85. package/dist/cli-bundle/chunks/{chunk-YFIE7YK6.js → chunk-AJUON7E6.js} +3 -3
  86. package/dist/cli-bundle/chunks/{close-many-OMZIGZB4.js → chunk-ARKHKYYS.js} +16 -30
  87. package/dist/cli-bundle/chunks/{close-many-OMZIGZB4.js.map → chunk-ARKHKYYS.js.map} +1 -1
  88. package/dist/cli-bundle/chunks/{chunk-7EQNAZX2.js → chunk-C5ACVMOI.js} +99 -51
  89. package/dist/cli-bundle/chunks/chunk-C5ACVMOI.js.map +7 -0
  90. package/dist/cli-bundle/chunks/{chunk-PJ3A56YF.js → chunk-CJQM7O7R.js} +16 -20
  91. package/dist/cli-bundle/chunks/{chunk-PJ3A56YF.js.map → chunk-CJQM7O7R.js.map} +1 -1
  92. package/dist/cli-bundle/chunks/{chunk-WISPVC2E.js → chunk-D2DCTFTL.js} +7 -9
  93. package/dist/cli-bundle/chunks/{chunk-WISPVC2E.js.map → chunk-D2DCTFTL.js.map} +1 -1
  94. package/dist/cli-bundle/chunks/{append-CZGUZ45Q.js → chunk-DDDWVPID.js} +7 -11
  95. package/dist/cli-bundle/chunks/{append-CZGUZ45Q.js.map → chunk-DDDWVPID.js.map} +1 -1
  96. package/dist/cli-bundle/chunks/{learnings-2HTPZNGZ.js → chunk-DG6BSXZ7.js} +6 -13
  97. package/dist/cli-bundle/chunks/{learnings-2HTPZNGZ.js.map → chunk-DG6BSXZ7.js.map} +2 -2
  98. package/dist/cli-bundle/chunks/{chunk-7WYXBPYQ.js → chunk-DR2V5OIV.js} +3 -3
  99. package/dist/cli-bundle/chunks/{chunk-YQMMMONE.js → chunk-E3LWJUGF.js} +4 -6
  100. package/dist/cli-bundle/chunks/{chunk-YQMMMONE.js.map → chunk-E3LWJUGF.js.map} +1 -1
  101. package/dist/cli-bundle/chunks/{chunk-D3UCE7RW.js → chunk-E3YQFSFE.js} +6 -10
  102. package/dist/cli-bundle/chunks/{chunk-D3UCE7RW.js.map → chunk-E3YQFSFE.js.map} +1 -1
  103. package/dist/cli-bundle/chunks/{chunk-PDXT6Q55.js → chunk-EDO7VXSO.js} +2 -2
  104. package/dist/cli-bundle/chunks/{chunk-FDBARR33.js → chunk-EIUBK2LT.js} +12 -18
  105. package/dist/cli-bundle/chunks/{chunk-FDBARR33.js.map → chunk-EIUBK2LT.js.map} +1 -1
  106. package/dist/cli-bundle/chunks/{chunk-HBYZDSK5.js → chunk-EMXPI36L.js} +14 -20
  107. package/dist/cli-bundle/chunks/{chunk-HBYZDSK5.js.map → chunk-EMXPI36L.js.map} +1 -1
  108. package/dist/cli-bundle/chunks/{chunk-4OFLJHX6.js → chunk-EOUVR7JN.js} +13 -8
  109. package/dist/cli-bundle/chunks/chunk-EOUVR7JN.js.map +1 -0
  110. package/dist/cli-bundle/chunks/{chunk-FUM6UMY4.js → chunk-EVEPHNXJ.js} +4 -4
  111. package/dist/cli-bundle/chunks/{deps-L2FPIAD3.js → chunk-F6MT7KKE.js} +6 -10
  112. package/dist/cli-bundle/chunks/{deps-L2FPIAD3.js.map → chunk-F6MT7KKE.js.map} +1 -1
  113. package/dist/cli-bundle/chunks/{chunk-FGQKEDE4.js → chunk-F6YC2A6X.js} +7 -11
  114. package/dist/cli-bundle/chunks/{chunk-FGQKEDE4.js.map → chunk-F6YC2A6X.js.map} +1 -1
  115. package/dist/cli-bundle/chunks/chunk-FILL6BB2.js +5514 -0
  116. package/dist/cli-bundle/chunks/chunk-FILL6BB2.js.map +7 -0
  117. package/dist/cli-bundle/chunks/{chunk-RX3HQSYG.js → chunk-FN6SB4HU.js} +2 -2
  118. package/dist/cli-bundle/chunks/chunk-GH73UOSJ.js +5359 -0
  119. package/dist/cli-bundle/chunks/chunk-GH73UOSJ.js.map +1 -0
  120. package/dist/cli-bundle/chunks/{chunk-JLA7EVYV.js → chunk-GLS6VMWI.js} +37 -16
  121. package/dist/cli-bundle/chunks/chunk-GLS6VMWI.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{files-JPU3FNJ7.js → chunk-GPIDUMMN.js} +10 -17
  123. package/dist/cli-bundle/chunks/{files-JPU3FNJ7.js.map → chunk-GPIDUMMN.js.map} +1 -1
  124. package/dist/cli-bundle/chunks/{history-compact-3F6VELO7.js → chunk-GTM5HQL4.js} +15 -21
  125. package/dist/cli-bundle/chunks/{history-compact-3F6VELO7.js.map → chunk-GTM5HQL4.js.map} +1 -1
  126. package/dist/cli-bundle/chunks/{chunk-DLQ4ZTCU.js → chunk-H2SMKL2N.js} +8 -8
  127. package/dist/cli-bundle/chunks/{chunk-S4APD35C.js → chunk-HHEWQXPD.js} +6 -6
  128. package/dist/cli-bundle/chunks/chunk-HHEWQXPD.js.map +7 -0
  129. package/dist/cli-bundle/chunks/{chunk-C3PMDWGX.js → chunk-HX6QXV5P.js} +2 -2
  130. package/dist/cli-bundle/chunks/{copy-LEE6P6EM.js → chunk-I74FMIWA.js} +11 -17
  131. package/dist/cli-bundle/chunks/{copy-LEE6P6EM.js.map → chunk-I74FMIWA.js.map} +1 -1
  132. package/dist/cli-bundle/chunks/chunk-IDIBF4E2.js +804 -0
  133. package/dist/cli-bundle/chunks/chunk-IDIBF4E2.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{comments-SAG5LSKL.js → chunk-II7R6KD4.js} +9 -13
  135. package/dist/cli-bundle/chunks/{comments-SAG5LSKL.js.map → chunk-II7R6KD4.js.map} +1 -1
  136. package/dist/cli-bundle/chunks/chunk-J2VGADNG.js +10320 -0
  137. package/dist/cli-bundle/chunks/chunk-J2VGADNG.js.map +1 -0
  138. package/dist/cli-bundle/chunks/{chunk-Y76TWC45.js → chunk-J7BOLHAV.js} +5 -7
  139. package/dist/cli-bundle/chunks/{chunk-Y76TWC45.js.map → chunk-J7BOLHAV.js.map} +1 -1
  140. package/dist/cli-bundle/chunks/{chunk-QHZO65XW.js → chunk-KTGJ2CBU.js} +4 -6
  141. package/dist/cli-bundle/chunks/{chunk-QHZO65XW.js.map → chunk-KTGJ2CBU.js.map} +1 -1
  142. package/dist/cli-bundle/chunks/{chunk-5VVUKE3U.js → chunk-LCFJ7XAM.js} +32 -2
  143. package/dist/cli-bundle/chunks/{chunk-5VVUKE3U.js.map → chunk-LCFJ7XAM.js.map} +3 -3
  144. package/dist/cli-bundle/chunks/{chunk-YMABYTNG.js → chunk-LZQU6XJG.js} +28 -34
  145. package/dist/cli-bundle/chunks/{chunk-YMABYTNG.js.map → chunk-LZQU6XJG.js.map} +1 -1
  146. package/dist/cli-bundle/chunks/{chunk-3Y4OESPP.js → chunk-M62RO3XK.js} +10 -14
  147. package/dist/cli-bundle/chunks/{chunk-3Y4OESPP.js.map → chunk-M62RO3XK.js.map} +1 -1
  148. package/dist/cli-bundle/chunks/{chunk-YPPVU5GX.js → chunk-MCEUKJKW.js} +9 -11
  149. package/dist/cli-bundle/chunks/{chunk-YPPVU5GX.js.map → chunk-MCEUKJKW.js.map} +1 -1
  150. package/dist/cli-bundle/chunks/{chunk-T5Y3QSNF.js → chunk-MHNMCDWR.js} +1447 -86
  151. package/dist/cli-bundle/chunks/chunk-MHNMCDWR.js.map +1 -0
  152. package/dist/cli-bundle/chunks/{chunk-HJE4JTKQ.js → chunk-MRFWUSVA.js} +4 -6
  153. package/dist/cli-bundle/chunks/{chunk-HJE4JTKQ.js.map → chunk-MRFWUSVA.js.map} +1 -1
  154. package/dist/cli-bundle/chunks/{chunk-P3VRG72Q.js → chunk-N6ZHDLUY.js} +6 -8
  155. package/dist/cli-bundle/chunks/{chunk-P3VRG72Q.js.map → chunk-N6ZHDLUY.js.map} +1 -1
  156. package/dist/cli-bundle/chunks/{delete-HQKGRNRZ.js → chunk-NWWL22C7.js} +8 -12
  157. package/dist/cli-bundle/chunks/{delete-HQKGRNRZ.js.map → chunk-NWWL22C7.js.map} +1 -1
  158. package/dist/cli-bundle/chunks/{chunk-N6DNM2FA.js → chunk-P3MJJW7P.js} +2 -2
  159. package/dist/cli-bundle/chunks/{chunk-5JE6SMYS.js → chunk-PDXJXEZJ.js} +2 -2
  160. package/dist/cli-bundle/chunks/{append-NSQBCXZJ.js → chunk-Q64AYQYW.js} +9 -13
  161. package/dist/cli-bundle/chunks/{append-NSQBCXZJ.js.map → chunk-Q64AYQYW.js.map} +1 -1
  162. package/dist/cli-bundle/chunks/{update-many-SLLAMHT7.js → chunk-QDABF2RB.js} +26 -47
  163. package/dist/cli-bundle/chunks/{update-many-SLLAMHT7.js.map → chunk-QDABF2RB.js.map} +1 -1
  164. package/dist/cli-bundle/chunks/{chunk-NBFCNJ7Q.js → chunk-QFBSP3NI.js} +529 -46
  165. package/dist/cli-bundle/chunks/chunk-QFBSP3NI.js.map +1 -0
  166. package/dist/cli-bundle/chunks/{focus-LFZ6IDBR.js → chunk-RB3KLPAH.js} +11 -16
  167. package/dist/cli-bundle/chunks/{focus-LFZ6IDBR.js.map → chunk-RB3KLPAH.js.map} +1 -1
  168. package/dist/cli-bundle/chunks/{chunk-YSAH5FY5.js → chunk-RY7PTTUB.js} +94 -53
  169. package/dist/cli-bundle/chunks/chunk-RY7PTTUB.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{chunk-WVSGSZ6J.js → chunk-S547WBYG.js} +1477 -86
  171. package/dist/cli-bundle/chunks/chunk-S547WBYG.js.map +7 -0
  172. package/dist/cli-bundle/chunks/{update-many-DC7X3EWM.js → chunk-S5BNGFN5.js} +24 -45
  173. package/dist/cli-bundle/chunks/{update-many-DC7X3EWM.js.map → chunk-S5BNGFN5.js.map} +1 -1
  174. package/dist/cli-bundle/chunks/{focus-WNMYCVYA.js → chunk-S6VC2A2K.js} +9 -14
  175. package/dist/cli-bundle/chunks/{focus-WNMYCVYA.js.map → chunk-S6VC2A2K.js.map} +1 -1
  176. package/dist/cli-bundle/chunks/{learnings-YBIHY3D6.js → chunk-SIM5JDON.js} +7 -14
  177. package/dist/cli-bundle/chunks/{learnings-YBIHY3D6.js.map → chunk-SIM5JDON.js.map} +1 -1
  178. package/dist/cli-bundle/chunks/{chunk-ZD34OFFQ.js → chunk-SY75LYXR.js} +12 -7
  179. package/dist/cli-bundle/chunks/chunk-SY75LYXR.js.map +7 -0
  180. package/dist/cli-bundle/chunks/{chunk-TT42JUMF.js → chunk-TEISGNSH.js} +7 -7
  181. package/dist/cli-bundle/chunks/chunk-TEISGNSH.js.map +1 -0
  182. package/dist/cli-bundle/chunks/{chunk-AAEQMOC6.js → chunk-TEKZOS7M.js} +2 -2
  183. package/dist/cli-bundle/chunks/{chunk-4QQ6PM7M.js → chunk-TGUK6XN6.js} +14 -18
  184. package/dist/cli-bundle/chunks/{chunk-4QQ6PM7M.js.map → chunk-TGUK6XN6.js.map} +1 -1
  185. package/dist/cli-bundle/chunks/{plan-R4NDQ27E.js → chunk-TNC6MZUD.js} +10 -21
  186. package/dist/cli-bundle/chunks/{plan-R4NDQ27E.js.map → chunk-TNC6MZUD.js.map} +1 -1
  187. package/dist/cli-bundle/chunks/chunk-TZLYO4PP.js +10498 -0
  188. package/dist/cli-bundle/chunks/chunk-TZLYO4PP.js.map +7 -0
  189. package/dist/cli-bundle/chunks/{chunk-YD5FML7K.js → chunk-UO7XAZK6.js} +27 -4
  190. package/dist/cli-bundle/chunks/chunk-UO7XAZK6.js.map +1 -0
  191. package/dist/cli-bundle/chunks/{docs-6CRCSVKK.js → chunk-V5ZWKJNY.js} +5 -14
  192. package/dist/cli-bundle/chunks/{docs-6CRCSVKK.js.map → chunk-V5ZWKJNY.js.map} +1 -1
  193. package/dist/cli-bundle/chunks/{notes-NJ7IQJX4.js → chunk-VGO73OCK.js} +7 -14
  194. package/dist/cli-bundle/chunks/{notes-NJ7IQJX4.js.map → chunk-VGO73OCK.js.map} +1 -1
  195. package/dist/cli-bundle/chunks/{chunk-NER3KUUS.js → chunk-VLEA2UTQ.js} +2 -2
  196. package/dist/cli-bundle/chunks/{files-6P57MRKL.js → chunk-W5HXHC7C.js} +8 -15
  197. package/dist/cli-bundle/chunks/{files-6P57MRKL.js.map → chunk-W5HXHC7C.js.map} +1 -1
  198. package/dist/cli-bundle/chunks/{chunk-ZMD35NYG.js → chunk-WCWVEXGA.js} +2 -2
  199. package/dist/cli-bundle/chunks/chunk-X47MKQXU.js +6690 -0
  200. package/dist/cli-bundle/chunks/chunk-X47MKQXU.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{delete-62JQTYT4.js → chunk-XBX5CBRQ.js} +6 -10
  202. package/dist/cli-bundle/chunks/{delete-62JQTYT4.js.map → chunk-XBX5CBRQ.js.map} +1 -1
  203. package/dist/cli-bundle/chunks/{chunk-MTTXDAK4.js → chunk-XC3X7BQR.js} +541 -44
  204. package/dist/cli-bundle/chunks/chunk-XC3X7BQR.js.map +7 -0
  205. package/dist/cli-bundle/chunks/{history-compact-656Y2TN4.js → chunk-XHCVAZGM.js} +17 -23
  206. package/dist/cli-bundle/chunks/{history-compact-656Y2TN4.js.map → chunk-XHCVAZGM.js.map} +1 -1
  207. package/dist/cli-bundle/chunks/{chunk-ZAHXPXVY.js → chunk-XPMXPR7K.js} +7 -9
  208. package/dist/cli-bundle/chunks/{chunk-ZAHXPXVY.js.map → chunk-XPMXPR7K.js.map} +1 -1
  209. package/dist/cli-bundle/chunks/{deps-55FTG6Z5.js → chunk-XS2TMNXR.js} +8 -12
  210. package/dist/cli-bundle/chunks/{deps-55FTG6Z5.js.map → chunk-XS2TMNXR.js.map} +1 -1
  211. package/dist/cli-bundle/chunks/{plan-XWY5T67S.js → chunk-XXIYUTLK.js} +12 -23
  212. package/dist/cli-bundle/chunks/{plan-XWY5T67S.js.map → chunk-XXIYUTLK.js.map} +1 -1
  213. package/dist/cli-bundle/chunks/{chunk-7QH7DHUB.js → chunk-XZWL7VNE.js} +1220 -398
  214. package/dist/cli-bundle/chunks/chunk-XZWL7VNE.js.map +1 -0
  215. package/dist/cli-bundle/chunks/chunk-Y5IKRUEM.js +6624 -0
  216. package/dist/cli-bundle/chunks/chunk-Y5IKRUEM.js.map +1 -0
  217. package/dist/cli-bundle/chunks/{chunk-ABRA3BHY.js → chunk-Y7KYVCZM.js} +12 -18
  218. package/dist/cli-bundle/chunks/{chunk-ABRA3BHY.js.map → chunk-Y7KYVCZM.js.map} +1 -1
  219. package/dist/cli-bundle/chunks/{chunk-UI5BJ6DO.js → chunk-YCVWWIKY.js} +17 -28
  220. package/dist/cli-bundle/chunks/chunk-YCVWWIKY.js.map +7 -0
  221. package/dist/cli-bundle/chunks/chunk-YH5NBDFA.js +780 -0
  222. package/dist/cli-bundle/chunks/chunk-YH5NBDFA.js.map +1 -0
  223. package/dist/cli-bundle/chunks/chunk-YNCFP5AR.js +5509 -0
  224. package/dist/cli-bundle/chunks/chunk-YNCFP5AR.js.map +7 -0
  225. package/dist/cli-bundle/chunks/{comments-MIW5MZOX.js → chunk-YPD7SQ5P.js} +8 -12
  226. package/dist/cli-bundle/chunks/{comments-MIW5MZOX.js.map → chunk-YPD7SQ5P.js.map} +2 -2
  227. package/dist/cli-bundle/chunks/{chunk-T35XLYZF.js → chunk-YPMZMKN7.js} +2 -2
  228. package/dist/cli-bundle/chunks/{chunk-R3ZBLGTC.js → chunk-YTD5GICJ.js} +4 -4
  229. package/dist/cli-bundle/chunks/{config-DJJKZB5R.js → chunk-ZNEG2UDO.js} +264 -39
  230. package/dist/cli-bundle/chunks/{config-DJJKZB5R.js.map → chunk-ZNEG2UDO.js.map} +4 -4
  231. package/dist/cli-bundle/chunks/{chunk-EEY54JMF.js → chunk-ZO7CLOY2.js} +3 -3
  232. package/dist/cli-bundle/chunks/{close-3YRR3XY6.js → close-3YYQ5OG2.js} +5 -9
  233. package/dist/cli-bundle/chunks/close-Z3Q4U7TS.js +12 -0
  234. package/dist/cli-bundle/chunks/close-many-3L2RXH3M.js +22 -0
  235. package/dist/cli-bundle/chunks/close-many-D366FTIG.js +26 -0
  236. package/dist/cli-bundle/chunks/comments-54XDJNFE.js +17 -0
  237. package/dist/cli-bundle/chunks/comments-HGHC2PN6.js +13 -0
  238. package/dist/cli-bundle/chunks/copy-44RT5GDW.js +13 -0
  239. package/dist/cli-bundle/chunks/copy-UGMUGHZA.js +9 -0
  240. package/dist/cli-bundle/chunks/{create-XWWQFQ6S.js → create-4GWJWPXG.js} +9 -14
  241. package/dist/cli-bundle/chunks/create-AZXCUYKP.js +25 -0
  242. package/dist/cli-bundle/chunks/delete-Y6SXIQ4X.js +10 -0
  243. package/dist/cli-bundle/chunks/delete-YQ2VPXNF.js +14 -0
  244. package/dist/cli-bundle/chunks/deps-BU5EBJDU.js +17 -0
  245. package/dist/cli-bundle/chunks/deps-FMANWFRP.js +13 -0
  246. package/dist/cli-bundle/chunks/docs-OQBSJNIA.js +18 -0
  247. package/dist/cli-bundle/chunks/docs-VNPBZXEL.js +14 -0
  248. package/dist/cli-bundle/chunks/files-72HZEBOE.js +18 -0
  249. package/dist/cli-bundle/chunks/{activity-YKAKZTZ4.js → files-HTSB2KJG.js} +13 -13
  250. package/dist/cli-bundle/chunks/focus-FOG4ALC2.js +14 -0
  251. package/dist/cli-bundle/chunks/focus-SUTMKXGX.js +10 -0
  252. package/dist/cli-bundle/chunks/history-compact-M6IFAMBP.js +25 -0
  253. package/dist/cli-bundle/chunks/history-compact-NEXRPP2O.js +21 -0
  254. package/dist/cli-bundle/chunks/{history-redact-54ICFKXM.js → history-redact-NQX3OGZP.js} +7 -11
  255. package/dist/cli-bundle/chunks/history-redact-WQJBZ3PX.js +17 -0
  256. package/dist/cli-bundle/chunks/history-repair-CBHMHAJO.js +19 -0
  257. package/dist/cli-bundle/chunks/history-repair-NHOJG7WO.js +23 -0
  258. package/dist/cli-bundle/chunks/learnings-M64NTSOR.js +13 -0
  259. package/dist/cli-bundle/chunks/learnings-T63JGKKN.js +17 -0
  260. package/dist/cli-bundle/chunks/notes-73WE2UV2.js +13 -0
  261. package/dist/cli-bundle/chunks/notes-U7L6HQQ2.js +17 -0
  262. package/dist/cli-bundle/chunks/plan-OSCNYFGC.js +24 -0
  263. package/dist/cli-bundle/chunks/plan-OSCNYFGC.js.map +7 -0
  264. package/dist/cli-bundle/chunks/plan-TN537L24.js +28 -0
  265. package/dist/cli-bundle/chunks/plan-TN537L24.js.map +1 -0
  266. package/dist/cli-bundle/chunks/profile-MHAMXMHQ.js +37 -0
  267. package/dist/cli-bundle/chunks/profile-MHAMXMHQ.js.map +1 -0
  268. package/dist/cli-bundle/chunks/profile-TIGLAKJ7.js +33 -0
  269. package/dist/cli-bundle/chunks/profile-TIGLAKJ7.js.map +7 -0
  270. package/dist/cli-bundle/chunks/{register-list-query-5H66WFYF.js → register-list-query-OHXD7G5N.js} +41 -33
  271. package/dist/cli-bundle/chunks/register-list-query-OHXD7G5N.js.map +7 -0
  272. package/dist/cli-bundle/chunks/{register-list-query-FB3FNDLZ.js → register-list-query-ZCRABAPN.js} +42 -34
  273. package/dist/cli-bundle/chunks/register-list-query-ZCRABAPN.js.map +1 -0
  274. package/dist/cli-bundle/chunks/{register-mutation-UJO23C7R.js → register-mutation-P3G4XP6Q.js} +36 -41
  275. package/dist/cli-bundle/chunks/{register-mutation-UJO23C7R.js.map → register-mutation-P3G4XP6Q.js.map} +1 -1
  276. package/dist/cli-bundle/chunks/{register-mutation-Z2ETYHKS.js → register-mutation-XX4H56PE.js} +34 -39
  277. package/dist/cli-bundle/chunks/{register-mutation-Z2ETYHKS.js.map → register-mutation-XX4H56PE.js.map} +1 -1
  278. package/dist/cli-bundle/chunks/{register-operations-A3XAM5J7.js → register-operations-V6PIYEDU.js} +80 -52
  279. package/dist/cli-bundle/chunks/register-operations-V6PIYEDU.js.map +1 -0
  280. package/dist/cli-bundle/chunks/{register-operations-SG7HBSUP.js → register-operations-V6VKTG54.js} +79 -51
  281. package/dist/cli-bundle/chunks/register-operations-V6VKTG54.js.map +7 -0
  282. package/dist/cli-bundle/chunks/{register-setup-K6U3NVY5.js → register-setup-6RVAWT6W.js} +129 -31
  283. package/dist/cli-bundle/chunks/register-setup-6RVAWT6W.js.map +7 -0
  284. package/dist/cli-bundle/chunks/{register-setup-I45OGJUV.js → register-setup-6YVUSQYD.js} +130 -32
  285. package/dist/cli-bundle/chunks/register-setup-6YVUSQYD.js.map +1 -0
  286. package/dist/cli-bundle/chunks/{restore-YJ2ET6AT.js → restore-HC3YSWF7.js} +7 -11
  287. package/dist/cli-bundle/chunks/restore-HC3YSWF7.js.map +1 -0
  288. package/dist/cli-bundle/chunks/restore-LFAMMRYZ.js +15 -0
  289. package/dist/cli-bundle/chunks/restore-LFAMMRYZ.js.map +7 -0
  290. package/dist/cli-bundle/chunks/{schema-2PUXCZ25.js → schema-DAGSYO6E.js} +6 -10
  291. package/dist/cli-bundle/chunks/schema-DAGSYO6E.js.map +7 -0
  292. package/dist/cli-bundle/chunks/{schema-Y6DXXK2F.js → schema-UBXJCQAC.js} +6 -10
  293. package/dist/cli-bundle/chunks/schema-UBXJCQAC.js.map +1 -0
  294. package/dist/cli-bundle/chunks/update-CJGG5WMV.js +21 -0
  295. package/dist/cli-bundle/chunks/update-CJGG5WMV.js.map +7 -0
  296. package/dist/cli-bundle/chunks/update-LKD64AFP.js +25 -0
  297. package/dist/cli-bundle/chunks/update-LKD64AFP.js.map +1 -0
  298. package/dist/cli-bundle/chunks/update-many-G4SM7BHC.js +31 -0
  299. package/dist/cli-bundle/chunks/update-many-G4SM7BHC.js.map +7 -0
  300. package/dist/cli-bundle/chunks/update-many-VLIV3D7R.js +35 -0
  301. package/dist/cli-bundle/chunks/update-many-VLIV3D7R.js.map +1 -0
  302. package/dist/cli-bundle/main.js +29 -31
  303. package/dist/cli-bundle/main.js.map +2 -2
  304. package/dist/cli-bundle/sdk-runtime.js +136 -54
  305. package/dist/cli-bundle/sdk-testing.js +7 -8
  306. package/dist/cli-bundle/sdk.js +132 -84
  307. package/dist/cli-bundle/sdk.js.map +2 -2
  308. package/dist/core/history/drift-scan.js +3 -8
  309. package/dist/core/history/drift-scan.js.map +1 -1
  310. package/dist/core/output/mutation-projection.js +11 -5
  311. package/dist/core/output/mutation-projection.js.map +1 -1
  312. package/dist/core/search/cache.js +3 -3
  313. package/dist/core/search/cache.js.map +1 -1
  314. package/dist/core/search/semantic-defaults.d.ts +2 -0
  315. package/dist/core/search/semantic-defaults.js +11 -4
  316. package/dist/core/search/semantic-defaults.js.map +1 -1
  317. package/dist/core/search/vector-stores.d.ts +1 -1
  318. package/dist/core/search/vector-stores.js +33 -7
  319. package/dist/core/search/vector-stores.js.map +1 -1
  320. package/dist/mcp/server.d.ts +22 -50
  321. package/dist/mcp/server.js +62 -916
  322. package/dist/mcp/server.js.map +1 -1
  323. package/dist/sdk/cli-contracts/flag-contracts.js +7 -7
  324. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  325. package/dist/sdk/cli-contracts/tool-schema.js +9 -7
  326. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  327. package/dist/sdk/index.d.ts +4 -2
  328. package/dist/sdk/index.js +4 -4
  329. package/dist/sdk/index.js.map +1 -1
  330. package/dist/sdk/runtime.d.ts +312 -5
  331. package/dist/sdk/runtime.js +1391 -26
  332. package/dist/sdk/runtime.js.map +1 -1
  333. package/dist/sdk/start-task-status.d.ts +13 -0
  334. package/dist/sdk/start-task-status.js +19 -0
  335. package/dist/sdk/start-task-status.js.map +1 -0
  336. package/dist/sdk/workspace-contracts-cache.d.ts +17 -0
  337. package/dist/sdk/workspace-contracts-cache.js +36 -0
  338. package/dist/sdk/workspace-contracts-cache.js.map +1 -0
  339. package/docs/COMMANDS.md +10 -1
  340. package/docs/RELEASING.md +3 -1
  341. package/docs/SDK.md +81 -0
  342. package/docs/TESTING.md +3 -0
  343. package/docs/examples/sdk-app-embedding/run-embedded-pm.mjs +16 -2
  344. package/docs/examples/sdk-contract-consumer/inspect-contracts.mjs +16 -1
  345. package/package.json +1 -1
  346. package/dist/cli-bundle/chunks/activity-4XQIDNM5.js +0 -18
  347. package/dist/cli-bundle/chunks/aggregate-EQX2RGB7.js +0 -375
  348. package/dist/cli-bundle/chunks/aggregate-EQX2RGB7.js.map +0 -7
  349. package/dist/cli-bundle/chunks/aggregate-PEGZGJXD.js +0 -372
  350. package/dist/cli-bundle/chunks/aggregate-PEGZGJXD.js.map +0 -1
  351. package/dist/cli-bundle/chunks/chunk-37E72CNS.js +0 -217
  352. package/dist/cli-bundle/chunks/chunk-37E72CNS.js.map +0 -1
  353. package/dist/cli-bundle/chunks/chunk-3PL6LEKP.js +0 -1961
  354. package/dist/cli-bundle/chunks/chunk-3PL6LEKP.js.map +0 -1
  355. package/dist/cli-bundle/chunks/chunk-3U3VEWK6.js +0 -1749
  356. package/dist/cli-bundle/chunks/chunk-3U3VEWK6.js.map +0 -7
  357. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js +0 -87
  358. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js.map +0 -7
  359. package/dist/cli-bundle/chunks/chunk-4LRVSBO6.js +0 -822
  360. package/dist/cli-bundle/chunks/chunk-4LRVSBO6.js.map +0 -7
  361. package/dist/cli-bundle/chunks/chunk-4OFLJHX6.js.map +0 -1
  362. package/dist/cli-bundle/chunks/chunk-53BTLLAF.js +0 -2181
  363. package/dist/cli-bundle/chunks/chunk-53BTLLAF.js.map +0 -1
  364. package/dist/cli-bundle/chunks/chunk-57C2RLW5.js +0 -1704
  365. package/dist/cli-bundle/chunks/chunk-57C2RLW5.js.map +0 -1
  366. package/dist/cli-bundle/chunks/chunk-5B3X4Y22.js +0 -2330
  367. package/dist/cli-bundle/chunks/chunk-5B3X4Y22.js.map +0 -7
  368. package/dist/cli-bundle/chunks/chunk-5J2XPTAD.js.map +0 -7
  369. package/dist/cli-bundle/chunks/chunk-5JZ7APJU.js +0 -995
  370. package/dist/cli-bundle/chunks/chunk-5JZ7APJU.js.map +0 -1
  371. package/dist/cli-bundle/chunks/chunk-75U6M5ZD.js +0 -819
  372. package/dist/cli-bundle/chunks/chunk-75U6M5ZD.js.map +0 -1
  373. package/dist/cli-bundle/chunks/chunk-7C2O74AE.js +0 -23
  374. package/dist/cli-bundle/chunks/chunk-7C2O74AE.js.map +0 -7
  375. package/dist/cli-bundle/chunks/chunk-7EQNAZX2.js.map +0 -7
  376. package/dist/cli-bundle/chunks/chunk-7QH7DHUB.js.map +0 -1
  377. package/dist/cli-bundle/chunks/chunk-BVEUCSH2.js +0 -530
  378. package/dist/cli-bundle/chunks/chunk-BVEUCSH2.js.map +0 -7
  379. package/dist/cli-bundle/chunks/chunk-DC3QJQWI.js +0 -275
  380. package/dist/cli-bundle/chunks/chunk-DC3QJQWI.js.map +0 -7
  381. package/dist/cli-bundle/chunks/chunk-DRBV5UC2.js +0 -231
  382. package/dist/cli-bundle/chunks/chunk-DRBV5UC2.js.map +0 -7
  383. package/dist/cli-bundle/chunks/chunk-E2FUG6GD.js +0 -2184
  384. package/dist/cli-bundle/chunks/chunk-E2FUG6GD.js.map +0 -7
  385. package/dist/cli-bundle/chunks/chunk-EZFKWSC7.js +0 -1615
  386. package/dist/cli-bundle/chunks/chunk-EZFKWSC7.js.map +0 -7
  387. package/dist/cli-bundle/chunks/chunk-FJRKQREY.js +0 -228
  388. package/dist/cli-bundle/chunks/chunk-FJRKQREY.js.map +0 -1
  389. package/dist/cli-bundle/chunks/chunk-GIWXVMZ3.js +0 -3237
  390. package/dist/cli-bundle/chunks/chunk-GIWXVMZ3.js.map +0 -7
  391. package/dist/cli-bundle/chunks/chunk-HK72NWAD.js +0 -1570
  392. package/dist/cli-bundle/chunks/chunk-HK72NWAD.js.map +0 -1
  393. package/dist/cli-bundle/chunks/chunk-JFCVQXZX.js +0 -3206
  394. package/dist/cli-bundle/chunks/chunk-JFCVQXZX.js.map +0 -1
  395. package/dist/cli-bundle/chunks/chunk-JINYH2DB.js +0 -371
  396. package/dist/cli-bundle/chunks/chunk-JINYH2DB.js.map +0 -7
  397. package/dist/cli-bundle/chunks/chunk-JLA7EVYV.js.map +0 -1
  398. package/dist/cli-bundle/chunks/chunk-K32L7HZO.js +0 -76
  399. package/dist/cli-bundle/chunks/chunk-K32L7HZO.js.map +0 -1
  400. package/dist/cli-bundle/chunks/chunk-KDZ6K25I.js +0 -79
  401. package/dist/cli-bundle/chunks/chunk-KDZ6K25I.js.map +0 -7
  402. package/dist/cli-bundle/chunks/chunk-KL22PY6L.js +0 -915
  403. package/dist/cli-bundle/chunks/chunk-KL22PY6L.js.map +0 -1
  404. package/dist/cli-bundle/chunks/chunk-KLG4ZULO.js +0 -218
  405. package/dist/cli-bundle/chunks/chunk-KLG4ZULO.js.map +0 -7
  406. package/dist/cli-bundle/chunks/chunk-LEKT4K7I.js.map +0 -7
  407. package/dist/cli-bundle/chunks/chunk-MNZ7DRNC.js +0 -1858
  408. package/dist/cli-bundle/chunks/chunk-MNZ7DRNC.js.map +0 -1
  409. package/dist/cli-bundle/chunks/chunk-MTTXDAK4.js.map +0 -7
  410. package/dist/cli-bundle/chunks/chunk-MZ7VNEVY.js +0 -520
  411. package/dist/cli-bundle/chunks/chunk-MZ7VNEVY.js.map +0 -1
  412. package/dist/cli-bundle/chunks/chunk-N7X4WP6L.js +0 -1041
  413. package/dist/cli-bundle/chunks/chunk-N7X4WP6L.js.map +0 -7
  414. package/dist/cli-bundle/chunks/chunk-NBFCNJ7Q.js.map +0 -1
  415. package/dist/cli-bundle/chunks/chunk-NNHHXJB2.js +0 -20
  416. package/dist/cli-bundle/chunks/chunk-NNHHXJB2.js.map +0 -1
  417. package/dist/cli-bundle/chunks/chunk-OBA2WH65.js +0 -918
  418. package/dist/cli-bundle/chunks/chunk-OBA2WH65.js.map +0 -7
  419. package/dist/cli-bundle/chunks/chunk-OESSOFJ4.js +0 -1985
  420. package/dist/cli-bundle/chunks/chunk-OESSOFJ4.js.map +0 -7
  421. package/dist/cli-bundle/chunks/chunk-OK5NXCZB.js +0 -238
  422. package/dist/cli-bundle/chunks/chunk-OK5NXCZB.js.map +0 -1
  423. package/dist/cli-bundle/chunks/chunk-P5YORJRH.js +0 -1977
  424. package/dist/cli-bundle/chunks/chunk-P5YORJRH.js.map +0 -7
  425. package/dist/cli-bundle/chunks/chunk-PPAJG4GB.js +0 -1031
  426. package/dist/cli-bundle/chunks/chunk-PPAJG4GB.js.map +0 -1
  427. package/dist/cli-bundle/chunks/chunk-PPE4YUQM.js.map +0 -1
  428. package/dist/cli-bundle/chunks/chunk-QZ342C63.js +0 -220
  429. package/dist/cli-bundle/chunks/chunk-QZ342C63.js.map +0 -7
  430. package/dist/cli-bundle/chunks/chunk-R2EMWY7Q.js +0 -368
  431. package/dist/cli-bundle/chunks/chunk-R2EMWY7Q.js.map +0 -1
  432. package/dist/cli-bundle/chunks/chunk-S4APD35C.js.map +0 -7
  433. package/dist/cli-bundle/chunks/chunk-STPSZ2XY.js +0 -1149
  434. package/dist/cli-bundle/chunks/chunk-STPSZ2XY.js.map +0 -1
  435. package/dist/cli-bundle/chunks/chunk-T4MX77AK.js +0 -272
  436. package/dist/cli-bundle/chunks/chunk-T4MX77AK.js.map +0 -1
  437. package/dist/cli-bundle/chunks/chunk-T5Y3QSNF.js.map +0 -1
  438. package/dist/cli-bundle/chunks/chunk-TT42JUMF.js.map +0 -1
  439. package/dist/cli-bundle/chunks/chunk-UHKX7I75.js +0 -165
  440. package/dist/cli-bundle/chunks/chunk-UHKX7I75.js.map +0 -1
  441. package/dist/cli-bundle/chunks/chunk-UI5BJ6DO.js.map +0 -7
  442. package/dist/cli-bundle/chunks/chunk-US3T3W5J.js +0 -1932
  443. package/dist/cli-bundle/chunks/chunk-US3T3W5J.js.map +0 -1
  444. package/dist/cli-bundle/chunks/chunk-UZRDBL6W.js +0 -175
  445. package/dist/cli-bundle/chunks/chunk-UZRDBL6W.js.map +0 -7
  446. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js +0 -84
  447. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js.map +0 -1
  448. package/dist/cli-bundle/chunks/chunk-VZIYHZDX.js +0 -1868
  449. package/dist/cli-bundle/chunks/chunk-VZIYHZDX.js.map +0 -7
  450. package/dist/cli-bundle/chunks/chunk-WVSGSZ6J.js.map +0 -7
  451. package/dist/cli-bundle/chunks/chunk-XQCG2JGW.js +0 -1152
  452. package/dist/cli-bundle/chunks/chunk-XQCG2JGW.js.map +0 -7
  453. package/dist/cli-bundle/chunks/chunk-YD5FML7K.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-YSAH5FY5.js.map +0 -1
  455. package/dist/cli-bundle/chunks/chunk-YZIR4R3U.js +0 -1005
  456. package/dist/cli-bundle/chunks/chunk-YZIR4R3U.js.map +0 -7
  457. package/dist/cli-bundle/chunks/chunk-Z2CRRZYF.js +0 -215
  458. package/dist/cli-bundle/chunks/chunk-Z2CRRZYF.js.map +0 -1
  459. package/dist/cli-bundle/chunks/chunk-ZD34OFFQ.js.map +0 -7
  460. package/dist/cli-bundle/chunks/chunk-ZJB3UV5U.js +0 -2306
  461. package/dist/cli-bundle/chunks/chunk-ZJB3UV5U.js.map +0 -1
  462. package/dist/cli-bundle/chunks/chunk-ZVDL32GJ.js +0 -241
  463. package/dist/cli-bundle/chunks/chunk-ZVDL32GJ.js.map +0 -7
  464. package/dist/cli-bundle/chunks/claim-4DROPSIS.js +0 -144
  465. package/dist/cli-bundle/chunks/claim-4DROPSIS.js.map +0 -1
  466. package/dist/cli-bundle/chunks/claim-VX54TV5U.js +0 -147
  467. package/dist/cli-bundle/chunks/claim-VX54TV5U.js.map +0 -7
  468. package/dist/cli-bundle/chunks/close-OB2Y4QP5.js +0 -16
  469. package/dist/cli-bundle/chunks/config-V57QD47V.js.map +0 -1
  470. package/dist/cli-bundle/chunks/context-4OQGIPSO.js +0 -45
  471. package/dist/cli-bundle/chunks/context-WLA6IAWE.js +0 -49
  472. package/dist/cli-bundle/chunks/contracts-HXJLKCRI.js +0 -12
  473. package/dist/cli-bundle/chunks/create-WKOZKPQR.js +0 -30
  474. package/dist/cli-bundle/chunks/eval-N6UHFWVO.js +0 -288
  475. package/dist/cli-bundle/chunks/eval-N6UHFWVO.js.map +0 -7
  476. package/dist/cli-bundle/chunks/eval-PHOTWYHI.js +0 -278
  477. package/dist/cli-bundle/chunks/eval-PHOTWYHI.js.map +0 -1
  478. package/dist/cli-bundle/chunks/extension-NBAH62ML.js +0 -40
  479. package/dist/cli-bundle/chunks/extension-ZF6ZZPOU.js +0 -44
  480. package/dist/cli-bundle/chunks/gc-AETFKZ44.js +0 -398
  481. package/dist/cli-bundle/chunks/gc-AETFKZ44.js.map +0 -7
  482. package/dist/cli-bundle/chunks/gc-RLBP4QVN.js +0 -388
  483. package/dist/cli-bundle/chunks/gc-RLBP4QVN.js.map +0 -1
  484. package/dist/cli-bundle/chunks/get-NH2MPBCI.js +0 -283
  485. package/dist/cli-bundle/chunks/get-NH2MPBCI.js.map +0 -1
  486. package/dist/cli-bundle/chunks/get-P4ZQXCPZ.js +0 -286
  487. package/dist/cli-bundle/chunks/get-P4ZQXCPZ.js.map +0 -7
  488. package/dist/cli-bundle/chunks/health-3GVPMQBL.js +0 -1612
  489. package/dist/cli-bundle/chunks/health-3GVPMQBL.js.map +0 -1
  490. package/dist/cli-bundle/chunks/health-DNTM72GJ.js +0 -1615
  491. package/dist/cli-bundle/chunks/health-DNTM72GJ.js.map +0 -7
  492. package/dist/cli-bundle/chunks/history-RYKLC72X.js +0 -20
  493. package/dist/cli-bundle/chunks/history-SGPYRAFT.js +0 -24
  494. package/dist/cli-bundle/chunks/history-redact-4H3FCKF3.js +0 -21
  495. package/dist/cli-bundle/chunks/init-RPIPQUNV.js +0 -32
  496. package/dist/cli-bundle/chunks/init-SKQAESQS.js +0 -28
  497. package/dist/cli-bundle/chunks/list-64LHZ3HM.js +0 -32
  498. package/dist/cli-bundle/chunks/list-7LXBTEKI.js +0 -36
  499. package/dist/cli-bundle/chunks/next-7ODPAQ4U.js +0 -306
  500. package/dist/cli-bundle/chunks/next-7ODPAQ4U.js.map +0 -7
  501. package/dist/cli-bundle/chunks/next-ODJUM4ZM.js +0 -303
  502. package/dist/cli-bundle/chunks/next-ODJUM4ZM.js.map +0 -1
  503. package/dist/cli-bundle/chunks/profile-XQWEQKS3.js +0 -397
  504. package/dist/cli-bundle/chunks/profile-XQWEQKS3.js.map +0 -1
  505. package/dist/cli-bundle/chunks/profile-YRDHLMRO.js +0 -400
  506. package/dist/cli-bundle/chunks/profile-YRDHLMRO.js.map +0 -7
  507. package/dist/cli-bundle/chunks/register-list-query-5H66WFYF.js.map +0 -7
  508. package/dist/cli-bundle/chunks/register-list-query-FB3FNDLZ.js.map +0 -1
  509. package/dist/cli-bundle/chunks/register-operations-A3XAM5J7.js.map +0 -1
  510. package/dist/cli-bundle/chunks/register-operations-SG7HBSUP.js.map +0 -7
  511. package/dist/cli-bundle/chunks/register-setup-I45OGJUV.js.map +0 -1
  512. package/dist/cli-bundle/chunks/register-setup-K6U3NVY5.js.map +0 -7
  513. package/dist/cli-bundle/chunks/restore-PXOFL6AM.js +0 -19
  514. package/dist/cli-bundle/chunks/scheduling-shortcuts-SSC4MYWQ.js +0 -91
  515. package/dist/cli-bundle/chunks/scheduling-shortcuts-SSC4MYWQ.js.map +0 -7
  516. package/dist/cli-bundle/chunks/scheduling-shortcuts-ULRG7MNP.js +0 -88
  517. package/dist/cli-bundle/chunks/scheduling-shortcuts-ULRG7MNP.js.map +0 -1
  518. package/dist/cli-bundle/chunks/search-3S72CTD6.js +0 -38
  519. package/dist/cli-bundle/chunks/search-WNUNBQXO.js +0 -34
  520. package/dist/cli-bundle/chunks/stats-IJYTRQGV.js +0 -250
  521. package/dist/cli-bundle/chunks/stats-IJYTRQGV.js.map +0 -7
  522. package/dist/cli-bundle/chunks/stats-L2D5Y2O5.js +0 -240
  523. package/dist/cli-bundle/chunks/stats-L2D5Y2O5.js.map +0 -1
  524. package/dist/cli-bundle/chunks/telemetry-L2CVOKVN.js +0 -309
  525. package/dist/cli-bundle/chunks/telemetry-L2CVOKVN.js.map +0 -7
  526. package/dist/cli-bundle/chunks/telemetry-QBYWQA76.js +0 -306
  527. package/dist/cli-bundle/chunks/telemetry-QBYWQA76.js.map +0 -1
  528. package/dist/cli-bundle/chunks/test-DQ2QFJ7W.js +0 -45
  529. package/dist/cli-bundle/chunks/test-W7QBLVJS.js +0 -41
  530. package/dist/cli-bundle/chunks/test-all-636NTRTT.js +0 -434
  531. package/dist/cli-bundle/chunks/test-all-636NTRTT.js.map +0 -1
  532. package/dist/cli-bundle/chunks/test-all-DWYK3RG6.js +0 -437
  533. package/dist/cli-bundle/chunks/test-all-DWYK3RG6.js.map +0 -7
  534. package/dist/cli-bundle/chunks/test-runs-245OINZR.js +0 -28
  535. package/dist/cli-bundle/chunks/test-runs-ZRD4GCTT.js +0 -24
  536. package/dist/cli-bundle/chunks/update-SFLZPJXX.js +0 -30
  537. package/dist/cli-bundle/chunks/update-SJZ6S77U.js +0 -26
  538. package/dist/cli-bundle/chunks/upgrade-HFFXLZJA.js +0 -290
  539. package/dist/cli-bundle/chunks/upgrade-HFFXLZJA.js.map +0 -7
  540. package/dist/cli-bundle/chunks/upgrade-UYQKM7RF.js +0 -287
  541. package/dist/cli-bundle/chunks/upgrade-UYQKM7RF.js.map +0 -1
  542. package/dist/cli-bundle/chunks/validate-PA4FDTOV.js +0 -2143
  543. package/dist/cli-bundle/chunks/validate-PA4FDTOV.js.map +0 -7
  544. package/dist/cli-bundle/chunks/validate-Z7L75YEJ.js +0 -2105
  545. package/dist/cli-bundle/chunks/validate-Z7L75YEJ.js.map +0 -1
  546. /package/dist/cli-bundle/chunks/{activity-4XQIDNM5.js.map → append-F7WPGIQL.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{activity-YKAKZTZ4.js.map → append-PVCTBVJG.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-T3ABIMGW.js.map → chunk-2TILG6F2.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-RCT3YJOK.js.map → chunk-3TYOW6RR.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-3JZNEQBA.js.map → chunk-3X542TEY.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-YOF5VPKM.js.map → chunk-7VQ3JJN5.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-P5TFTLWW.js.map → chunk-AGAVEDIE.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-YFIE7YK6.js.map → chunk-AJUON7E6.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-7WYXBPYQ.js.map → chunk-DR2V5OIV.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-PDXT6Q55.js.map → chunk-EDO7VXSO.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-FUM6UMY4.js.map → chunk-EVEPHNXJ.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-RX3HQSYG.js.map → chunk-FN6SB4HU.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-DLQ4ZTCU.js.map → chunk-H2SMKL2N.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{chunk-C3PMDWGX.js.map → chunk-HX6QXV5P.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{chunk-N6DNM2FA.js.map → chunk-P3MJJW7P.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{chunk-5JE6SMYS.js.map → chunk-PDXJXEZJ.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-AAEQMOC6.js.map → chunk-TEKZOS7M.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-NER3KUUS.js.map → chunk-VLEA2UTQ.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-ZMD35NYG.js.map → chunk-WCWVEXGA.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-T35XLYZF.js.map → chunk-YPMZMKN7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-R3ZBLGTC.js.map → chunk-YTD5GICJ.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-EEY54JMF.js.map → chunk-ZO7CLOY2.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{close-3YRR3XY6.js.map → close-3YYQ5OG2.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{close-OB2Y4QP5.js.map → close-Z3Q4U7TS.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{context-4OQGIPSO.js.map → close-many-3L2RXH3M.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{context-WLA6IAWE.js.map → close-many-D366FTIG.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{contracts-OJEXMKVW.js.map → comments-54XDJNFE.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{contracts-HXJLKCRI.js.map → comments-HGHC2PN6.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{create-XWWQFQ6S.js.map → copy-44RT5GDW.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{create-WKOZKPQR.js.map → copy-UGMUGHZA.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{extension-ZF6ZZPOU.js.map → create-4GWJWPXG.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{extension-NBAH62ML.js.map → create-AZXCUYKP.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{history-RYKLC72X.js.map → delete-Y6SXIQ4X.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{history-SGPYRAFT.js.map → delete-YQ2VPXNF.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{history-redact-54ICFKXM.js.map → deps-BU5EBJDU.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{history-redact-4H3FCKF3.js.map → deps-FMANWFRP.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{init-RPIPQUNV.js.map → docs-OQBSJNIA.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{init-SKQAESQS.js.map → docs-VNPBZXEL.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{list-64LHZ3HM.js.map → files-72HZEBOE.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{list-7LXBTEKI.js.map → files-HTSB2KJG.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{restore-YJ2ET6AT.js.map → focus-FOG4ALC2.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{restore-PXOFL6AM.js.map → focus-SUTMKXGX.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{schema-Y6DXXK2F.js.map → history-compact-M6IFAMBP.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{schema-2PUXCZ25.js.map → history-compact-NEXRPP2O.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{search-3S72CTD6.js.map → history-redact-NQX3OGZP.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{search-WNUNBQXO.js.map → history-redact-WQJBZ3PX.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{test-W7QBLVJS.js.map → history-repair-CBHMHAJO.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{test-DQ2QFJ7W.js.map → history-repair-NHOJG7WO.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{test-runs-ZRD4GCTT.js.map → learnings-M64NTSOR.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{test-runs-245OINZR.js.map → learnings-T63JGKKN.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{update-SJZ6S77U.js.map → notes-73WE2UV2.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{update-SFLZPJXX.js.map → notes-U7L6HQQ2.js.map} +0 -0
@@ -1,17 +1,7 @@
1
1
  import {
2
2
  renameArtifactsResultKey,
3
3
  runLinkedArtifacts
4
- } from "./chunk-WISPVC2E.js";
5
- import "./chunk-7M2HAZEB.js";
6
- import "./chunk-WW4E2DC3.js";
7
- import "./chunk-T3ABIMGW.js";
8
- import "./chunk-5HIZDR5A.js";
9
- import "./chunk-3U3VEWK6.js";
10
- import "./chunk-EZFKWSC7.js";
11
- import "./chunk-DRBV5UC2.js";
12
- import "./chunk-P5YORJRH.js";
13
- import "./chunk-7C2O74AE.js";
14
- import "./chunk-5VVUKE3U.js";
4
+ } from "./chunk-D2DCTFTL.js";
15
5
 
16
6
  // dist/cli/commands/docs.js
17
7
  !(function() {
@@ -30,7 +20,8 @@ async function runDocs(id, options, global2) {
30
20
  });
31
21
  return renameArtifactsResultKey(result, "docs");
32
22
  }
23
+
33
24
  export {
34
25
  runDocs
35
26
  };
36
- //# sourceMappingURL=docs-S6UTOTO5.js.map
27
+ //# sourceMappingURL=chunk-2LEJGRQ7.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../cli/commands/docs.ts"],
4
4
  "sourcesContent": ["/**\n * @module cli/commands/docs\n *\n * Implements the pm docs command surface and its agent-facing runtime behavior.\n */\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport type { LinkedDoc } from \"../../types/index.js\";\nimport {\n renameArtifactsResultKey,\n runLinkedArtifacts,\n type LinkedArtifactResult,\n type LinkedPathAuditEntry,\n type LinkedPathValidation,\n} from \"./linked-artifacts.js\";\n\n/**\n * Documents the docs command options payload exchanged by command, SDK, and package integrations.\n */\nexport interface DocsCommandOptions {\n add?: string[];\n addGlob?: string[];\n remove?: string[];\n migrate?: string[];\n /** GH-170 (pm-pfnx): standalone note applied to every --add/--add-glob link in this invocation. */\n note?: string;\n list?: boolean;\n validatePaths?: boolean;\n audit?: boolean;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\n/**\n * Documents the docs result payload exchanged by command, SDK, and package integrations.\n */\nexport interface DocsResult {\n id: string;\n docs: LinkedDoc[];\n changed: boolean;\n count: number;\n migrations_applied?: number;\n validation?: LinkedPathValidation;\n audit?: LinkedPathAuditEntry[];\n}\n\n/**\n * Implements run docs for the public runtime surface of this module.\n */\nexport async function runDocs(id: string, options: DocsCommandOptions, global: GlobalOptions): Promise<DocsResult> {\n const result: LinkedArtifactResult = await runLinkedArtifacts(id, options, global, {\n metadataKey: \"docs\",\n op: \"docs_add\",\n bareNoun: \"doc\",\n supportsAppendStable: false,\n });\n return renameArtifactsResultKey(result, \"docs\") as unknown as DocsResult;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAiDA,eAAsB,QAAQ,IAAY,SAA6BA,SAAqB;AAC1F,QAAM,SAA+B,MAAM,mBAAmB,IAAI,SAASA,SAAQ;IACjF,aAAa;IACb,IAAI;IACJ,UAAU;IACV,sBAAsB;GACvB;AACD,SAAO,yBAAyB,QAAQ,MAAM;AAChD;",
5
+ "mappings": ";;;;;;;;;;;;;AAiDA,eAAsB,QAAQ,IAAY,SAA6BA,SAAqB;AAC1F,QAAM,SAA+B,MAAM,mBAAmB,IAAI,SAASA,SAAQ;IACjF,aAAa;IACb,IAAI;IACJ,UAAU;IACV,sBAAsB;GACvB;AACD,SAAO,yBAAyB,QAAQ,MAAM;AAChD;",
6
6
  "names": ["global"]
7
7
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  PmCliError
3
- } from "./chunk-P5YORJRH.js";
3
+ } from "./chunk-YNCFP5AR.js";
4
4
  import {
5
5
  EXIT_CODE
6
- } from "./chunk-5VVUKE3U.js";
6
+ } from "./chunk-LCFJ7XAM.js";
7
7
 
8
8
  // dist/core/item/parse.js
9
9
  !(function() {
@@ -358,4 +358,4 @@ export {
358
358
  createStdinTokenResolver,
359
359
  parseOptionalNumber
360
360
  };
361
- //# sourceMappingURL=chunk-T3ABIMGW.js.map
361
+ //# sourceMappingURL=chunk-2TILG6F2.js.map
@@ -1,17 +1,15 @@
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]="f04ac56e-a146-5aa0-90e2-2c783ad2e6ef")}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]="2da7a3ac-115d-58d6-936c-0d0a1a8a57c8")}catch(e){}}();
3
3
  import {
4
+ PmCliError,
4
5
  nowIso
5
- } from "./chunk-FJRKQREY.js";
6
- import {
7
- PmCliError
8
- } from "./chunk-US3T3W5J.js";
6
+ } from "./chunk-GH73UOSJ.js";
9
7
  import {
10
8
  EXIT_CODE,
11
9
  pathExists,
12
10
  toErrorMessage,
13
11
  writeFileAtomic
14
- } from "./chunk-YD5FML7K.js";
12
+ } from "./chunk-UO7XAZK6.js";
15
13
 
16
14
  // dist/core/checkpoint/mutation-checkpoint.js
17
15
  import { mkdir, readFile } from "node:fs/promises";
@@ -125,6 +123,6 @@ export {
125
123
  loadMutationCheckpoint,
126
124
  restoreCheckpointItems
127
125
  };
128
- //# sourceMappingURL=chunk-S5AYOUT5.js.map
126
+ //# sourceMappingURL=chunk-3G6UMXT3.js.map
129
127
 
130
- //# debugId=f04ac56e-a146-5aa0-90e2-2c783ad2e6ef
128
+ //# debugId=2da7a3ac-115d-58d6-936c-0d0a1a8a57c8
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../core/checkpoint/mutation-checkpoint.ts"],"sourcesContent":["/**\n * @module core/checkpoint/mutation-checkpoint\n *\n * Provides mutation checkpoint primitives for reversible multi-item operations.\n */\nimport { mkdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { nowIso } from \"../shared/time.js\";\n\n// Shared checkpoint + rollback machinery for bulk-mutation commands\n// (`update-many`, `close-many`). Each command owns its own checkpoint payload\n// shape (the extra fields it records) but reuses the common id/path/validation\n// helpers and the restore loop so the durable rollback contract — capture each\n// matched item's pre-mutation updated_at, then restore-to-timestamp on\n// rollback — stays identical across commands and is not duplicated.\n\n/**\n * Documents the mutation checkpoint item payload exchanged by command, SDK, and package integrations.\n */\nexport interface MutationCheckpointItem {\n id: string;\n target_updated_at: string;\n}\n\n/**\n * Documents the loaded mutation checkpoint payload exchanged by command, SDK, and package integrations.\n */\nexport interface LoadedMutationCheckpoint {\n /** The full on-disk record so callers can read their command-specific fields. */\n record: Record<string, unknown>;\n /** Validated item list (id + target_updated_at). */\n items: MutationCheckpointItem[];\n /** Absolute path the checkpoint was read from. */\n path: string;\n id: string;\n created_at: string;\n author: string;\n}\n\n/**\n * Documents the checkpoint rollback row payload exchanged by command, SDK, and package integrations.\n */\nexport interface CheckpointRollbackRow {\n id: string;\n status: \"restored\" | \"failed\";\n changed_fields?: string[];\n warnings?: string[];\n error?: string;\n}\n\n/**\n * Documents the checkpoint rollback result payload exchanged by command, SDK, and package integrations.\n */\nexport interface CheckpointRollbackResult {\n rows: CheckpointRollbackRow[];\n restored_ids: string[];\n failed_count: number;\n}\n\n/** Restore a single item to its captured pre-mutation timestamp. */\nexport type CheckpointRestoreFn = (\n id: string,\n targetUpdatedAt: string,\n) => Promise<{ changed_fields?: string[]; warnings?: string[] }>;\n\n/**\n * Implements normalize checkpoint id for the public runtime surface of this module.\n */\nexport function normalizeCheckpointId(raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) {\n throw new PmCliError(\"--rollback requires a non-empty checkpoint ID\", EXIT_CODE.USAGE);\n }\n if (!/^[a-zA-Z0-9._-]+$/.test(trimmed)) {\n throw new PmCliError(\"--rollback checkpoint ID must match [a-zA-Z0-9._-]+\", EXIT_CODE.USAGE);\n }\n return trimmed;\n}\n\n/**\n * Implements create checkpoint id for the public runtime surface of this module.\n */\nexport function createCheckpointId(prefix: string, nowValue: string): string {\n const compactTimestamp = nowValue.replace(/[-:.TZ]/g, \"\").slice(0, 14);\n const randomSuffix = Math.random().toString(36).slice(2, 8);\n return `${prefix}-${compactTimestamp}-${randomSuffix}`;\n}\n\n/**\n * Implements checkpoint directory path for the public runtime surface of this module.\n */\nexport function checkpointDirectoryPath(pmRoot: string, subdir: string): string {\n return path.join(pmRoot, \"checkpoints\", subdir);\n}\n\n/**\n * Implements checkpoint file path for the public runtime surface of this module.\n */\nexport function checkpointFilePath(pmRoot: string, subdir: string, checkpointId: string): string {\n return path.join(checkpointDirectoryPath(pmRoot, subdir), `${checkpointId}.json`);\n}\n\n/**\n * Implements write mutation checkpoint for the public runtime surface of this module.\n */\nexport async function writeMutationCheckpoint(\n pmRoot: string,\n subdir: string,\n checkpointId: string,\n payload: unknown,\n): Promise<string> {\n const checkpointDir = checkpointDirectoryPath(pmRoot, subdir);\n await mkdir(checkpointDir, { recursive: true });\n const filePath = checkpointFilePath(pmRoot, subdir, checkpointId);\n await writeFileAtomic(filePath, `${JSON.stringify(payload, null, 2)}\\n`);\n return filePath;\n}\n\nfunction parseCheckpointItems(record: Record<string, unknown>, checkpointId: string): MutationCheckpointItem[] {\n if (!Array.isArray(record.items)) {\n throw new PmCliError(`Checkpoint ${checkpointId} is missing items`, EXIT_CODE.GENERIC_FAILURE);\n }\n return record.items.map((entry) => {\n if (!entry || typeof entry !== \"object\") {\n throw new PmCliError(`Checkpoint ${checkpointId} contains an invalid item entry`, EXIT_CODE.GENERIC_FAILURE);\n }\n const row = entry as Record<string, unknown>;\n if (typeof row.id !== \"string\" || row.id.trim().length === 0) {\n throw new PmCliError(`Checkpoint ${checkpointId} contains an item entry without ID`, EXIT_CODE.GENERIC_FAILURE);\n }\n if (typeof row.target_updated_at !== \"string\" || row.target_updated_at.trim().length === 0) {\n throw new PmCliError(\n `Checkpoint ${checkpointId} contains an item entry without target_updated_at`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n return { id: row.id.trim(), target_updated_at: row.target_updated_at.trim() };\n });\n}\n\n/**\n * Implements load mutation checkpoint for the public runtime surface of this module.\n */\nexport async function loadMutationCheckpoint(\n pmRoot: string,\n subdir: string,\n rawCheckpointId: string,\n schemaVersion: number,\n): Promise<LoadedMutationCheckpoint> {\n const normalizedId = normalizeCheckpointId(rawCheckpointId);\n const filePath = checkpointFilePath(pmRoot, subdir, normalizedId);\n if (!(await pathExists(filePath))) {\n throw new PmCliError(`Checkpoint ${normalizedId} not found`, EXIT_CODE.NOT_FOUND);\n }\n const raw = await readFile(filePath, \"utf8\");\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch (error: unknown) {\n throw new PmCliError(\n `Checkpoint ${normalizedId} contains invalid JSON: ${toErrorMessage(error)}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (!parsed || typeof parsed !== \"object\") {\n throw new PmCliError(`Checkpoint ${normalizedId} is invalid`, EXIT_CODE.GENERIC_FAILURE);\n }\n const record = parsed as Record<string, unknown>;\n if (record.schema_version !== schemaVersion) {\n throw new PmCliError(`Checkpoint ${normalizedId} has unsupported schema version`, EXIT_CODE.GENERIC_FAILURE);\n }\n const items = parseCheckpointItems(record, normalizedId);\n return {\n record,\n items,\n path: filePath,\n id: typeof record.id === \"string\" ? record.id : normalizedId,\n // Defensive recovery for malformed checkpoint metadata; normal writes\n // always include these fields, so fallbacks keep rollback inspectable.\n created_at: typeof record.created_at === \"string\" ? record.created_at : nowIso(),\n author: typeof record.author === \"string\" ? record.author : \"unknown\",\n };\n}\n\n/**\n * Restore every checkpointed item to its captured pre-mutation timestamp,\n * collecting per-item rows. A single item's failure is recorded and does not\n * abort the remaining restores.\n */\nexport async function restoreCheckpointItems(\n items: MutationCheckpointItem[],\n restore: CheckpointRestoreFn,\n): Promise<CheckpointRollbackResult> {\n const rows: CheckpointRollbackRow[] = [];\n const restoredIds: string[] = [];\n for (const entry of items) {\n try {\n const restored = await restore(entry.id, entry.target_updated_at);\n rows.push({\n id: entry.id,\n status: \"restored\",\n changed_fields: restored.changed_fields,\n warnings: restored.warnings,\n });\n restoredIds.push(entry.id);\n } catch (error: unknown) {\n rows.push({ id: entry.id, status: \"failed\", error: toErrorMessage(error) });\n }\n }\n return {\n rows,\n restored_ids: restoredIds,\n failed_count: rows.filter((row) => row.status === \"failed\").length,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,SAAS,OAAO,gBAAgB;AAChC,OAAO,UAAU;AAkEX,SAAU,sBAAsB,KAAW;AAC/C,QAAM,UAAU,IAAI,KAAI;AACxB,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,WAAW,iDAAiD,UAAU,KAAK;EACvF;AACA,MAAI,CAAC,oBAAoB,KAAK,OAAO,GAAG;AACtC,UAAM,IAAI,WAAW,uDAAuD,UAAU,KAAK;EAC7F;AACA,SAAO;AACT;AAKM,SAAU,mBAAmB,QAAgB,UAAgB;AACjE,QAAM,mBAAmB,SAAS,QAAQ,YAAY,EAAE,EAAE,MAAM,GAAG,EAAE;AACrE,QAAM,eAAe,KAAK,OAAM,EAAG,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC;AAC1D,SAAO,GAAG,MAAM,IAAI,gBAAgB,IAAI,YAAY;AACtD;AAKM,SAAU,wBAAwB,QAAgB,QAAc;AACpE,SAAO,KAAK,KAAK,QAAQ,eAAe,MAAM;AAChD;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AAEhE","debugId":"f04ac56e-a146-5aa0-90e2-2c783ad2e6ef"}
1
+ {"version":3,"sources":["../../../../../../../../core/checkpoint/mutation-checkpoint.ts"],"sourcesContent":["/**\n * @module core/checkpoint/mutation-checkpoint\n *\n * Provides mutation checkpoint primitives for reversible multi-item operations.\n */\nimport { mkdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { nowIso } from \"../shared/time.js\";\n\n// Shared checkpoint + rollback machinery for bulk-mutation commands\n// (`update-many`, `close-many`). Each command owns its own checkpoint payload\n// shape (the extra fields it records) but reuses the common id/path/validation\n// helpers and the restore loop so the durable rollback contract — capture each\n// matched item's pre-mutation updated_at, then restore-to-timestamp on\n// rollback — stays identical across commands and is not duplicated.\n\n/**\n * Documents the mutation checkpoint item payload exchanged by command, SDK, and package integrations.\n */\nexport interface MutationCheckpointItem {\n id: string;\n target_updated_at: string;\n}\n\n/**\n * Documents the loaded mutation checkpoint payload exchanged by command, SDK, and package integrations.\n */\nexport interface LoadedMutationCheckpoint {\n /** The full on-disk record so callers can read their command-specific fields. */\n record: Record<string, unknown>;\n /** Validated item list (id + target_updated_at). */\n items: MutationCheckpointItem[];\n /** Absolute path the checkpoint was read from. */\n path: string;\n id: string;\n created_at: string;\n author: string;\n}\n\n/**\n * Documents the checkpoint rollback row payload exchanged by command, SDK, and package integrations.\n */\nexport interface CheckpointRollbackRow {\n id: string;\n status: \"restored\" | \"failed\";\n changed_fields?: string[];\n warnings?: string[];\n error?: string;\n}\n\n/**\n * Documents the checkpoint rollback result payload exchanged by command, SDK, and package integrations.\n */\nexport interface CheckpointRollbackResult {\n rows: CheckpointRollbackRow[];\n restored_ids: string[];\n failed_count: number;\n}\n\n/** Restore a single item to its captured pre-mutation timestamp. */\nexport type CheckpointRestoreFn = (\n id: string,\n targetUpdatedAt: string,\n) => Promise<{ changed_fields?: string[]; warnings?: string[] }>;\n\n/**\n * Implements normalize checkpoint id for the public runtime surface of this module.\n */\nexport function normalizeCheckpointId(raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) {\n throw new PmCliError(\"--rollback requires a non-empty checkpoint ID\", EXIT_CODE.USAGE);\n }\n if (!/^[a-zA-Z0-9._-]+$/.test(trimmed)) {\n throw new PmCliError(\"--rollback checkpoint ID must match [a-zA-Z0-9._-]+\", EXIT_CODE.USAGE);\n }\n return trimmed;\n}\n\n/**\n * Implements create checkpoint id for the public runtime surface of this module.\n */\nexport function createCheckpointId(prefix: string, nowValue: string): string {\n const compactTimestamp = nowValue.replace(/[-:.TZ]/g, \"\").slice(0, 14);\n const randomSuffix = Math.random().toString(36).slice(2, 8);\n return `${prefix}-${compactTimestamp}-${randomSuffix}`;\n}\n\n/**\n * Implements checkpoint directory path for the public runtime surface of this module.\n */\nexport function checkpointDirectoryPath(pmRoot: string, subdir: string): string {\n return path.join(pmRoot, \"checkpoints\", subdir);\n}\n\n/**\n * Implements checkpoint file path for the public runtime surface of this module.\n */\nexport function checkpointFilePath(pmRoot: string, subdir: string, checkpointId: string): string {\n return path.join(checkpointDirectoryPath(pmRoot, subdir), `${checkpointId}.json`);\n}\n\n/**\n * Implements write mutation checkpoint for the public runtime surface of this module.\n */\nexport async function writeMutationCheckpoint(\n pmRoot: string,\n subdir: string,\n checkpointId: string,\n payload: unknown,\n): Promise<string> {\n const checkpointDir = checkpointDirectoryPath(pmRoot, subdir);\n await mkdir(checkpointDir, { recursive: true });\n const filePath = checkpointFilePath(pmRoot, subdir, checkpointId);\n await writeFileAtomic(filePath, `${JSON.stringify(payload, null, 2)}\\n`);\n return filePath;\n}\n\nfunction parseCheckpointItems(record: Record<string, unknown>, checkpointId: string): MutationCheckpointItem[] {\n if (!Array.isArray(record.items)) {\n throw new PmCliError(`Checkpoint ${checkpointId} is missing items`, EXIT_CODE.GENERIC_FAILURE);\n }\n return record.items.map((entry) => {\n if (!entry || typeof entry !== \"object\") {\n throw new PmCliError(`Checkpoint ${checkpointId} contains an invalid item entry`, EXIT_CODE.GENERIC_FAILURE);\n }\n const row = entry as Record<string, unknown>;\n if (typeof row.id !== \"string\" || row.id.trim().length === 0) {\n throw new PmCliError(`Checkpoint ${checkpointId} contains an item entry without ID`, EXIT_CODE.GENERIC_FAILURE);\n }\n if (typeof row.target_updated_at !== \"string\" || row.target_updated_at.trim().length === 0) {\n throw new PmCliError(\n `Checkpoint ${checkpointId} contains an item entry without target_updated_at`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n return { id: row.id.trim(), target_updated_at: row.target_updated_at.trim() };\n });\n}\n\n/**\n * Implements load mutation checkpoint for the public runtime surface of this module.\n */\nexport async function loadMutationCheckpoint(\n pmRoot: string,\n subdir: string,\n rawCheckpointId: string,\n schemaVersion: number,\n): Promise<LoadedMutationCheckpoint> {\n const normalizedId = normalizeCheckpointId(rawCheckpointId);\n const filePath = checkpointFilePath(pmRoot, subdir, normalizedId);\n if (!(await pathExists(filePath))) {\n throw new PmCliError(`Checkpoint ${normalizedId} not found`, EXIT_CODE.NOT_FOUND);\n }\n const raw = await readFile(filePath, \"utf8\");\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch (error: unknown) {\n throw new PmCliError(\n `Checkpoint ${normalizedId} contains invalid JSON: ${toErrorMessage(error)}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (!parsed || typeof parsed !== \"object\") {\n throw new PmCliError(`Checkpoint ${normalizedId} is invalid`, EXIT_CODE.GENERIC_FAILURE);\n }\n const record = parsed as Record<string, unknown>;\n if (record.schema_version !== schemaVersion) {\n throw new PmCliError(`Checkpoint ${normalizedId} has unsupported schema version`, EXIT_CODE.GENERIC_FAILURE);\n }\n const items = parseCheckpointItems(record, normalizedId);\n return {\n record,\n items,\n path: filePath,\n id: typeof record.id === \"string\" ? record.id : normalizedId,\n // Defensive recovery for malformed checkpoint metadata; normal writes\n // always include these fields, so fallbacks keep rollback inspectable.\n created_at: typeof record.created_at === \"string\" ? record.created_at : nowIso(),\n author: typeof record.author === \"string\" ? record.author : \"unknown\",\n };\n}\n\n/**\n * Restore every checkpointed item to its captured pre-mutation timestamp,\n * collecting per-item rows. A single item's failure is recorded and does not\n * abort the remaining restores.\n */\nexport async function restoreCheckpointItems(\n items: MutationCheckpointItem[],\n restore: CheckpointRestoreFn,\n): Promise<CheckpointRollbackResult> {\n const rows: CheckpointRollbackRow[] = [];\n const restoredIds: string[] = [];\n for (const entry of items) {\n try {\n const restored = await restore(entry.id, entry.target_updated_at);\n rows.push({\n id: entry.id,\n status: \"restored\",\n changed_fields: restored.changed_fields,\n warnings: restored.warnings,\n });\n restoredIds.push(entry.id);\n } catch (error: unknown) {\n rows.push({ id: entry.id, status: \"failed\", error: toErrorMessage(error) });\n }\n }\n return {\n rows,\n restored_ids: restoredIds,\n failed_count: rows.filter((row) => row.status === \"failed\").length,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAKA,SAAS,OAAO,gBAAgB;AAChC,OAAO,UAAU;AAkEX,SAAU,sBAAsB,KAAW;AAC/C,QAAM,UAAU,IAAI,KAAI;AACxB,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,WAAW,iDAAiD,UAAU,KAAK;EACvF;AACA,MAAI,CAAC,oBAAoB,KAAK,OAAO,GAAG;AACtC,UAAM,IAAI,WAAW,uDAAuD,UAAU,KAAK;EAC7F;AACA,SAAO;AACT;AAKM,SAAU,mBAAmB,QAAgB,UAAgB;AACjE,QAAM,mBAAmB,SAAS,QAAQ,YAAY,EAAE,EAAE,MAAM,GAAG,EAAE;AACrE,QAAM,eAAe,KAAK,OAAM,EAAG,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC;AAC1D,SAAO,GAAG,MAAM,IAAI,gBAAgB,IAAI,YAAY;AACtD;AAKM,SAAU,wBAAwB,QAAgB,QAAc;AACpE,SAAO,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AC,QAAQ,IAAI,WAAW,QAAQ,EAAE;;AAEhE","debugId":"2da7a3ac-115d-58d6-936c-0d0a1a8a57c8"}
@@ -3,23 +3,23 @@
3
3
  import {
4
4
  normalizeStatusToken
5
5
  } from "./chunk-YJIEJRZB.js";
6
- import {
7
- TYPE_PRESET_DEFINITIONS,
8
- normalizeAddFieldInput,
9
- normalizeAddStatusInput
10
- } from "./chunk-ZAHXPXVY.js";
11
6
  import {
12
7
  parseNestedSettingValue,
13
8
  resolveNestedSettingDescriptor
14
9
  } from "./chunk-7LQKVMPA.js";
10
+ import {
11
+ TYPE_PRESET_DEFINITIONS,
12
+ normalizeAddFieldInput,
13
+ normalizeAddStatusInput
14
+ } from "./chunk-XPMXPR7K.js";
15
15
  import {
16
16
  normalizeAddTypeInput
17
- } from "./chunk-NER3KUUS.js";
17
+ } from "./chunk-VLEA2UTQ.js";
18
18
  import {
19
19
  BUILTIN_ITEM_TYPE_VALUES,
20
20
  DEFAULT_RUNTIME_STATUS_DEFINITIONS,
21
21
  toErrorMessage
22
- } from "./chunk-YD5FML7K.js";
22
+ } from "./chunk-UO7XAZK6.js";
23
23
 
24
24
  // dist/core/profile/profile-presets.js
25
25
  var PROFILE_NAMES = ["agile", "ops", "research"];
@@ -619,6 +619,6 @@ export {
619
619
  PROFILE_LINT_CODES,
620
620
  lintProjectProfile
621
621
  };
622
- //# sourceMappingURL=chunk-RCT3YJOK.js.map
622
+ //# sourceMappingURL=chunk-3TYOW6RR.js.map
623
623
 
624
624
  //# debugId=663e65ec-e52a-51b1-86ab-ff162c4166ab
@@ -2,16 +2,16 @@
2
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]="30820bf7-18ff-502d-a376-4f04726e1bec")}catch(e){}}();
3
3
  import {
4
4
  lintProjectProfile
5
- } from "./chunk-RCT3YJOK.js";
5
+ } from "./chunk-3TYOW6RR.js";
6
+ import {
7
+ describeExtensionActivation,
8
+ renderExtensionSurfaceMarkdown
9
+ } from "./chunk-TEKZOS7M.js";
6
10
  import {
7
11
  getMigrationRuntimeDefinition,
8
12
  resolveRegisteredSearchProvider,
9
13
  resolveRegisteredVectorStoreAdapter
10
14
  } from "./chunk-KGHH652T.js";
11
- import {
12
- describeExtensionActivation,
13
- renderExtensionSurfaceMarkdown
14
- } from "./chunk-AAEQMOC6.js";
15
15
  import {
16
16
  activateExtensions,
17
17
  asPropertyRecord,
@@ -35,7 +35,7 @@ import {
35
35
  runPreflightOverride,
36
36
  runRendererOverride,
37
37
  runServiceOverride
38
- } from "./chunk-YD5FML7K.js";
38
+ } from "./chunk-UO7XAZK6.js";
39
39
 
40
40
  // dist/sdk/compose.js
41
41
  function defineExtension(module) {
@@ -1408,6 +1408,6 @@ export {
1408
1408
  assertExtensionPreflight,
1409
1409
  createExtensionTestHarness
1410
1410
  };
1411
- //# sourceMappingURL=chunk-3JZNEQBA.js.map
1411
+ //# sourceMappingURL=chunk-3X542TEY.js.map
1412
1412
 
1413
1413
  //# debugId=30820bf7-18ff-502d-a376-4f04726e1bec
@@ -1,40 +1,32 @@
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]="58c4129e-b488-55d8-a456-40bf96517276")}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]="82206098-4fb2-5ba8-9c57-4eb1ac8e1688")}catch(e){}}();
3
3
  import {
4
4
  scanHistoryDrift
5
- } from "./chunk-TT42JUMF.js";
5
+ } from "./chunk-TEISGNSH.js";
6
6
  import {
7
7
  executeHistoryRewrite,
8
8
  resolveHistorySubject,
9
9
  writeHistoryRawWithRollback
10
- } from "./chunk-IJ6CO3JV.js";
11
- import "./chunk-T5RRNDA7.js";
10
+ } from "./chunk-52NS7JDP.js";
12
11
  import {
13
12
  readHistoryEntries
14
- } from "./chunk-T3F4DF23.js";
13
+ } from "./chunk-565WYS5W.js";
15
14
  import {
16
15
  historyEntriesToRaw,
17
16
  reanchorHistoryEntries,
18
17
  replayHash,
19
18
  toReplayDocument,
20
19
  verifyHistoryChain
21
- } from "./chunk-BFVHCAOO.js";
22
- import "./chunk-YFIE7YK6.js";
23
- import {
24
- listAllFrontMatterWithBody,
25
- readLocatedItem
26
- } from "./chunk-57C2RLW5.js";
27
- import "./chunk-HK72NWAD.js";
28
- import {
29
- nowIso
30
- } from "./chunk-FJRKQREY.js";
20
+ } from "./chunk-7Y5N34HX.js";
31
21
  import {
32
22
  PmCliError,
33
23
  getActiveExtensionRegistrations,
24
+ listAllFrontMatterWithBody,
25
+ nowIso,
26
+ readLocatedItem,
34
27
  readSettings,
35
28
  runActiveOnWriteHooks
36
- } from "./chunk-US3T3W5J.js";
37
- import "./chunk-NNHHXJB2.js";
29
+ } from "./chunk-GH73UOSJ.js";
38
30
  import {
39
31
  EXIT_CODE,
40
32
  getSettingsPath,
@@ -42,7 +34,7 @@ import {
42
34
  readFileIfExists,
43
35
  resolveItemTypeRegistry,
44
36
  resolvePmRoot
45
- } from "./chunk-YD5FML7K.js";
37
+ } from "./chunk-UO7XAZK6.js";
46
38
 
47
39
  // dist/cli/commands/history-repair.js
48
40
  import jsonPatch from "fast-json-patch";
@@ -268,11 +260,12 @@ async function runHistoryRepairAll(options, global) {
268
260
  generated_at: nowIso()
269
261
  };
270
262
  }
263
+
271
264
  export {
272
- assertHistoryRepairTarget,
273
265
  runHistoryRepair,
266
+ assertHistoryRepairTarget,
274
267
  runHistoryRepairAll
275
268
  };
276
- //# sourceMappingURL=history-repair-EVTO6LIH.js.map
269
+ //# sourceMappingURL=chunk-42LXP4VO.js.map
277
270
 
278
- //# debugId=58c4129e-b488-55d8-a456-40bf96517276
271
+ //# debugId=82206098-4fb2-5ba8-9c57-4eb1ac8e1688
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../cli/commands/history-repair.ts"],"sourcesContent":["/**\n * @module cli/commands/history-repair\n *\n * Implements the pm history repair command surface and its agent-facing runtime behavior.\n */\nimport jsonPatch from \"fast-json-patch\";\nimport { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { executeHistoryRewrite, writeHistoryRawWithRollback } from \"../../core/history/history-rewrite.js\";\nimport {\n historyEntriesToRaw,\n reanchorHistoryEntries,\n replayHash,\n toReplayDocument,\n verifyHistoryChain,\n type ReplayDocument,\n} from \"../../core/history/replay.js\";\nimport { scanHistoryDrift } from \"../../core/history/drift-scan.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getActiveExtensionRegistrations, runActiveOnWriteHooks } from \"../../core/extensions/index.js\";\nimport { listAllFrontMatterWithBody, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemMetadata } from \"../../types/index.js\";\nimport { readHistoryEntries } from \"./history.js\";\nimport { resolveHistorySubject } from \"./history-redact.js\";\n\n/**\n * Documents the history repair command options payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairCommandOptions {\n dryRun?: boolean;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\n/**\n * Documents the history repair result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairResult {\n id: string;\n dry_run: boolean;\n changed: boolean;\n history: {\n path: string;\n entries_scanned: number;\n chain_drift_before: boolean;\n entries_rehashed: number;\n entries_patch_repaired: number;\n converted_replace_to_add: number;\n skipped_ops: number;\n reconciled_with_item: boolean;\n audit_entry_added: boolean;\n verify_ok: boolean;\n verify_errors: string[];\n };\n item: {\n exists: boolean;\n path: string | null;\n matched_chain_before: boolean | null;\n };\n warnings: string[];\n generated_at: string;\n}\n\ninterface HistoryRepairItemReplayContext {\n currentItemReplay: ReplayDocument | null;\n currentItemPath: string | null;\n matchedChainBefore: boolean | null;\n currentItemRawBeforeLock: string | null;\n loadedItem: Awaited<ReturnType<typeof readLocatedItem>> | null;\n}\n\nfunction toAuthor(candidate: string | undefined, defaultAuthor: string): string {\n /* c8 ignore next -- PM_AUTHOR fallback branch is environment-dependent in CI. */\n const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;\n const trimmed = resolved.trim();\n return trimmed.length > 0 ? trimmed : \"unknown\";\n}\n\nasync function loadHistoryRepairItemReplay(\n subject: Awaited<ReturnType<typeof resolveHistorySubject>>,\n settings: Awaited<ReturnType<typeof readSettings>>,\n historyEntries: HistoryEntry[],\n): Promise<HistoryRepairItemReplayContext> {\n const currentItemPath = subject.located?.itemPath ?? null;\n const loadedItem = subject.located ? await readLocatedItem(subject.located, { schema: settings.schema }) : null;\n if (!loadedItem) {\n return {\n currentItemReplay: null,\n currentItemPath,\n matchedChainBefore: null,\n currentItemRawBeforeLock: null,\n loadedItem: null,\n };\n }\n const currentItemReplay = toReplayDocument(loadedItem.document);\n const lastOriginalAfterHash = historyEntries[historyEntries.length - 1]?.after_hash;\n return {\n currentItemReplay,\n currentItemPath,\n matchedChainBefore: replayHash(currentItemReplay) === lastOriginalAfterHash,\n currentItemRawBeforeLock: loadedItem.raw,\n loadedItem,\n };\n}\n\nfunction buildHistoryRepairMessage(params: {\n message: string | undefined;\n entriesRehashed: number;\n entriesPatchRepaired: number;\n reconcileNeeded: boolean;\n}): string {\n if (typeof params.message === \"string\" && params.message.trim().length > 0) {\n return params.message;\n }\n /* v8 ignore start -- message suffix/plural variants are deterministic formatting fallbacks around the covered repair outcomes */\n return `history-repair re-anchored ${params.entriesRehashed} entr${\n params.entriesRehashed === 1 ? \"y\" : \"ies\"\n }${params.entriesPatchRepaired > 0 ? `, repaired ${params.entriesPatchRepaired} patch(es)` : \"\"}${\n params.reconcileNeeded ? \", reconciled chain with on-disk item\" : \"\"\n }.`;\n /* v8 ignore stop */\n}\n\nfunction buildHistoryRepairEntries(params: {\n reanchorEntries: HistoryEntry[];\n changed: boolean;\n reconcileNeeded: boolean;\n currentItemReplay: ReplayDocument | null;\n finalReplay: ReplayDocument;\n author: string;\n message: string;\n}): { rewrittenEntries: HistoryEntry[]; auditEntryAdded: boolean } {\n const rewrittenEntries: HistoryEntry[] = [...params.reanchorEntries];\n if (!params.changed) {\n return { rewrittenEntries, auditEntryAdded: false };\n }\n const afterReplay = params.reconcileNeeded && params.currentItemReplay ? params.currentItemReplay : params.finalReplay;\n rewrittenEntries.push({\n ts: nowIso(),\n author: params.author,\n op: \"history_repair\",\n patch: params.reconcileNeeded && params.currentItemReplay\n ? (jsonPatch.compare(params.finalReplay, params.currentItemReplay) as HistoryPatchOp[])\n : [],\n before_hash: replayHash(params.finalReplay),\n after_hash: replayHash(afterReplay),\n message: params.message,\n });\n return { rewrittenEntries, auditEntryAdded: true };\n}\n\nfunction collectHistoryRepairWarnings(changed: boolean, skippedOps: number): string[] {\n const warnings: string[] = [];\n if (!changed) {\n warnings.push(\"history_repair_no_changes\");\n }\n if (skippedOps > 0) {\n warnings.push(`history_repair_skipped_unresolvable_ops:${skippedOps}`);\n }\n return warnings;\n}\n\nasync function applyHistoryRepairRewrite(params: {\n pmRoot: string;\n subject: Awaited<ReturnType<typeof resolveHistorySubject>>;\n settings: Awaited<ReturnType<typeof readSettings>>;\n typeRegistry: ReturnType<typeof resolveItemTypeRegistry>;\n historyRawBeforeLock: string | null;\n currentItemRawBeforeLock: string | null;\n author: string;\n force: boolean | undefined;\n loadedItem: Awaited<ReturnType<typeof readLocatedItem>> | null;\n historyPath: string;\n rewrittenEntries: HistoryEntry[];\n}): Promise<string[]> {\n return executeHistoryRewrite({\n pmRoot: params.pmRoot,\n subject: params.subject,\n settings: params.settings,\n typeRegistry: params.typeRegistry,\n historyRawBeforeLock: params.historyRawBeforeLock,\n currentItemRawBeforeLock: params.currentItemRawBeforeLock,\n operation: \"history-repair\",\n author: params.author,\n force: params.force,\n itemDocument: params.loadedItem?.document ?? null,\n applyRewrite: async ({ historyRawUnderLock }) =>\n writeHistoryRawWithRollback({\n historyPath: params.historyPath,\n nextHistoryRaw: historyEntriesToRaw(params.rewrittenEntries),\n historyRawUnderLock,\n }),\n applyPostRewrite: async () =>\n runActiveOnWriteHooks({\n path: params.historyPath,\n scope: \"project\",\n op: \"history_repair:history\",\n }),\n });\n}\n\n/**\n * Implements run history repair for the public runtime surface of this module.\n */\nexport async function runHistoryRepair(\n id: string,\n options: HistoryRepairCommandOptions,\n global: GlobalOptions,\n): Promise<HistoryRepairResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const subject = await resolveHistorySubject(pmRoot, id, settings, typeRegistry.type_to_folder);\n\n if (!(await pathExists(subject.historyPath))) {\n throw new PmCliError(`No history stream exists for ${subject.id}.`, EXIT_CODE.NOT_FOUND);\n }\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const historyEntries = await readHistoryEntries(subject.historyPath, subject.id);\n if (historyEntries.length === 0) {\n throw new PmCliError(`No history entries exist for ${subject.id}; nothing to repair.`, EXIT_CODE.USAGE);\n }\n\n const chainBefore = verifyHistoryChain(historyEntries);\n const reanchor = reanchorHistoryEntries(historyEntries);\n\n const itemReplayContext = await loadHistoryRepairItemReplay(subject, settings, historyEntries);\n\n const finalReplay = reanchor.finalDocument;\n const reconcileNeeded =\n itemReplayContext.currentItemReplay !== null && replayHash(finalReplay) !== replayHash(itemReplayContext.currentItemReplay);\n\n const changed = reanchor.entriesRehashed > 0 || reanchor.entriesPatchRepaired > 0 || reconcileNeeded;\n const author = toAuthor(options.author, settings.author_default);\n const dryRun = Boolean(options.dryRun);\n\n const repairMessage = buildHistoryRepairMessage({\n message: options.message,\n entriesRehashed: reanchor.entriesRehashed,\n entriesPatchRepaired: reanchor.entriesPatchRepaired,\n reconcileNeeded,\n });\n const { rewrittenEntries, auditEntryAdded } = buildHistoryRepairEntries({\n reanchorEntries: reanchor.entries,\n changed,\n reconcileNeeded,\n currentItemReplay: itemReplayContext.currentItemReplay,\n finalReplay,\n author,\n message: repairMessage,\n });\n\n const historyVerify = verifyHistoryChain(rewrittenEntries);\n if (!historyVerify.ok) {\n throw new PmCliError(\n `history-repair produced an invalid rewritten chain (${historyVerify.errors.join(\", \")}).`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n\n const warnings = collectHistoryRepairWarnings(changed, reanchor.skippedOps);\n\n if (changed && !dryRun) {\n warnings.push(\n ...(await applyHistoryRepairRewrite({\n pmRoot,\n subject,\n settings,\n typeRegistry,\n historyRawBeforeLock,\n currentItemRawBeforeLock: itemReplayContext.currentItemRawBeforeLock,\n author,\n force: options.force,\n loadedItem: itemReplayContext.loadedItem,\n historyPath: subject.historyPath,\n rewrittenEntries,\n })),\n );\n }\n\n return {\n id: subject.id,\n dry_run: dryRun,\n changed,\n history: {\n path: subject.historyPath,\n entries_scanned: historyEntries.length,\n chain_drift_before: !chainBefore.ok,\n entries_rehashed: reanchor.entriesRehashed,\n entries_patch_repaired: reanchor.entriesPatchRepaired,\n converted_replace_to_add: reanchor.convertedReplaceToAdd,\n skipped_ops: reanchor.skippedOps,\n reconciled_with_item: reconcileNeeded,\n audit_entry_added: auditEntryAdded,\n verify_ok: historyVerify.ok,\n verify_errors: historyVerify.errors,\n },\n item: {\n exists: itemReplayContext.currentItemPath !== null,\n path: itemReplayContext.currentItemPath,\n matched_chain_before: itemReplayContext.matchedChainBefore,\n },\n warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),\n generated_at: nowIso(),\n };\n}\n\n/**\n * Documents the history repair all stream result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairAllStreamResult {\n id: string;\n outcome: \"repaired\" | \"skipped_clean\" | \"failed\";\n entries_rehashed?: number;\n entries_patch_repaired?: number;\n reconciled_with_item?: boolean;\n error?: string;\n}\n\n/**\n * Documents the history repair all result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairAllResult {\n all: true;\n dry_run: boolean;\n scanned_streams: number;\n drifted_streams: number;\n /** One compact row per drifted stream (clean streams are summarized by the counts only). */\n streams: HistoryRepairAllStreamResult[];\n totals: { repaired: number; skipped_clean: number; failed: number };\n warnings: string[];\n generated_at: string;\n}\n\n/**\n * Enforce the `pm history-repair` target contract shared by the CLI and MCP\n * surfaces: exactly one of an item `<id>` or `--all` must be provided.\n */\nexport function assertHistoryRepairTarget(id: string | undefined, all: boolean): void {\n if (all && id !== undefined) {\n throw new PmCliError(\n \"history-repair: <id> and --all are mutually exclusive; pass an item id to repair one stream or --all to repair every drifted stream.\",\n EXIT_CODE.USAGE,\n );\n }\n if (!all && id === undefined) {\n throw new PmCliError(\n \"history-repair: provide an item <id> or pass --all to repair every drifted stream.\",\n EXIT_CODE.USAGE,\n );\n }\n}\n\n/**\n * Bulk drift repair: scan every item's history stream with the same drift scan\n * `pm health` uses, then run the audited single-stream repair (ownership check,\n * lock, no-drift verification, audit marker) for each drifted stream. One\n * failing stream never aborts the rest; failures are collected per row and the\n * caller decides the exit code from `totals.failed`.\n */\nexport async function runHistoryRepairAll(\n options: HistoryRepairCommandOptions,\n global: GlobalOptions,\n): Promise<HistoryRepairAllResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const itemReadWarnings: string[] = [];\n const items = await listAllFrontMatterWithBody(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n itemReadWarnings,\n settings.schema,\n );\n const drift = await scanHistoryDrift(pmRoot, items as Array<ItemMetadata & { body: string }>);\n\n const streams: HistoryRepairAllStreamResult[] = [];\n const totals = { repaired: 0, skipped_clean: 0, failed: 0 };\n for (const driftedId of drift.driftedItems) {\n try {\n const result = await runHistoryRepair(driftedId, options, global);\n /* c8 ignore next -- mixed repaired/clean outcomes depend on live drift composition. */\n const outcome = result.changed ? \"repaired\" : \"skipped_clean\";\n totals[outcome] += 1;\n streams.push({\n id: driftedId,\n outcome,\n entries_rehashed: result.history.entries_rehashed,\n entries_patch_repaired: result.history.entries_patch_repaired,\n reconciled_with_item: result.history.reconciled_with_item,\n });\n } catch (error) {\n totals.failed += 1;\n streams.push({\n id: driftedId,\n outcome: \"failed\",\n /* c8 ignore next -- non-Error throws are normalized in defensive fallback. */\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return {\n all: true,\n dry_run: Boolean(options.dryRun),\n scanned_streams: items.length,\n drifted_streams: drift.driftedItems.length,\n streams,\n totals,\n warnings: [...new Set(itemReadWarnings)].sort((left, right) => left.localeCompare(right)),\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,OAAO,eAAe;AAwEtB,SAAS,SAAS,WAA+B,eAAqB;AAEpE,QAAM,WAAW,aAAa,QAAQ,IAAI,aAAa;AACvD,QAAM,UAAU,SAAS,KAAI;AAC7B,SAAO,QAAQ,SAAS,IAAI,UAAU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MAAM;AAEhE,YAAM,UAAU,OAAO,UAAU,aAAa;AAC9C,aAAO,OAAO,KAAK;AACnB,cAAQ,KAAK;QACX,IAAI;QACJ;QACA,kBAAkB,OAAO,QAAQ;QACjC,wBAAwB,OAAO,QAAQ;QACvC,sBAAsB,OAAO,QAAQ;OACtC;IACH,SAAS,OAAO;AACd,aAAO,UAAU;AACjB,cAAQ,KAAK;QACX,IAAI;QACJ,SAAS;;QAET,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;OAC7D;IACH;EACF;AAEA,SAAO;IACL,KAAK;IACL,SAAS,QAAQ,QAAQ,MAAM;IAC/B,iBAAiB,MAAM;IACvB,iBAAiB,MAAM,aAAa;IACpC;IACA;IACA,UAAU,CAAC,GAAG,IAAI,IAAI,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,KAAK,cAAc,KAAK,CAAC;IACxF,cAAc,OAAM;;AAExB","debugId":"58c4129e-b488-55d8-a456-40bf96517276"}
1
+ {"version":3,"sources":["../../../../../../../../cli/commands/history-repair.ts"],"sourcesContent":["/**\n * @module cli/commands/history-repair\n *\n * Implements the pm history repair command surface and its agent-facing runtime behavior.\n */\nimport jsonPatch from \"fast-json-patch\";\nimport { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { executeHistoryRewrite, writeHistoryRawWithRollback } from \"../../core/history/history-rewrite.js\";\nimport {\n historyEntriesToRaw,\n reanchorHistoryEntries,\n replayHash,\n toReplayDocument,\n verifyHistoryChain,\n type ReplayDocument,\n} from \"../../core/history/replay.js\";\nimport { scanHistoryDrift } from \"../../core/history/drift-scan.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getActiveExtensionRegistrations, runActiveOnWriteHooks } from \"../../core/extensions/index.js\";\nimport { listAllFrontMatterWithBody, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemMetadata } from \"../../types/index.js\";\nimport { readHistoryEntries } from \"./history.js\";\nimport { resolveHistorySubject } from \"./history-redact.js\";\n\n/**\n * Documents the history repair command options payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairCommandOptions {\n dryRun?: boolean;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\n/**\n * Documents the history repair result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairResult {\n id: string;\n dry_run: boolean;\n changed: boolean;\n history: {\n path: string;\n entries_scanned: number;\n chain_drift_before: boolean;\n entries_rehashed: number;\n entries_patch_repaired: number;\n converted_replace_to_add: number;\n skipped_ops: number;\n reconciled_with_item: boolean;\n audit_entry_added: boolean;\n verify_ok: boolean;\n verify_errors: string[];\n };\n item: {\n exists: boolean;\n path: string | null;\n matched_chain_before: boolean | null;\n };\n warnings: string[];\n generated_at: string;\n}\n\ninterface HistoryRepairItemReplayContext {\n currentItemReplay: ReplayDocument | null;\n currentItemPath: string | null;\n matchedChainBefore: boolean | null;\n currentItemRawBeforeLock: string | null;\n loadedItem: Awaited<ReturnType<typeof readLocatedItem>> | null;\n}\n\nfunction toAuthor(candidate: string | undefined, defaultAuthor: string): string {\n /* c8 ignore next -- PM_AUTHOR fallback branch is environment-dependent in CI. */\n const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;\n const trimmed = resolved.trim();\n return trimmed.length > 0 ? trimmed : \"unknown\";\n}\n\nasync function loadHistoryRepairItemReplay(\n subject: Awaited<ReturnType<typeof resolveHistorySubject>>,\n settings: Awaited<ReturnType<typeof readSettings>>,\n historyEntries: HistoryEntry[],\n): Promise<HistoryRepairItemReplayContext> {\n const currentItemPath = subject.located?.itemPath ?? null;\n const loadedItem = subject.located ? await readLocatedItem(subject.located, { schema: settings.schema }) : null;\n if (!loadedItem) {\n return {\n currentItemReplay: null,\n currentItemPath,\n matchedChainBefore: null,\n currentItemRawBeforeLock: null,\n loadedItem: null,\n };\n }\n const currentItemReplay = toReplayDocument(loadedItem.document);\n const lastOriginalAfterHash = historyEntries[historyEntries.length - 1]?.after_hash;\n return {\n currentItemReplay,\n currentItemPath,\n matchedChainBefore: replayHash(currentItemReplay) === lastOriginalAfterHash,\n currentItemRawBeforeLock: loadedItem.raw,\n loadedItem,\n };\n}\n\nfunction buildHistoryRepairMessage(params: {\n message: string | undefined;\n entriesRehashed: number;\n entriesPatchRepaired: number;\n reconcileNeeded: boolean;\n}): string {\n if (typeof params.message === \"string\" && params.message.trim().length > 0) {\n return params.message;\n }\n /* v8 ignore start -- message suffix/plural variants are deterministic formatting fallbacks around the covered repair outcomes */\n return `history-repair re-anchored ${params.entriesRehashed} entr${\n params.entriesRehashed === 1 ? \"y\" : \"ies\"\n }${params.entriesPatchRepaired > 0 ? `, repaired ${params.entriesPatchRepaired} patch(es)` : \"\"}${\n params.reconcileNeeded ? \", reconciled chain with on-disk item\" : \"\"\n }.`;\n /* v8 ignore stop */\n}\n\nfunction buildHistoryRepairEntries(params: {\n reanchorEntries: HistoryEntry[];\n changed: boolean;\n reconcileNeeded: boolean;\n currentItemReplay: ReplayDocument | null;\n finalReplay: ReplayDocument;\n author: string;\n message: string;\n}): { rewrittenEntries: HistoryEntry[]; auditEntryAdded: boolean } {\n const rewrittenEntries: HistoryEntry[] = [...params.reanchorEntries];\n if (!params.changed) {\n return { rewrittenEntries, auditEntryAdded: false };\n }\n const afterReplay = params.reconcileNeeded && params.currentItemReplay ? params.currentItemReplay : params.finalReplay;\n rewrittenEntries.push({\n ts: nowIso(),\n author: params.author,\n op: \"history_repair\",\n patch: params.reconcileNeeded && params.currentItemReplay\n ? (jsonPatch.compare(params.finalReplay, params.currentItemReplay) as HistoryPatchOp[])\n : [],\n before_hash: replayHash(params.finalReplay),\n after_hash: replayHash(afterReplay),\n message: params.message,\n });\n return { rewrittenEntries, auditEntryAdded: true };\n}\n\nfunction collectHistoryRepairWarnings(changed: boolean, skippedOps: number): string[] {\n const warnings: string[] = [];\n if (!changed) {\n warnings.push(\"history_repair_no_changes\");\n }\n if (skippedOps > 0) {\n warnings.push(`history_repair_skipped_unresolvable_ops:${skippedOps}`);\n }\n return warnings;\n}\n\nasync function applyHistoryRepairRewrite(params: {\n pmRoot: string;\n subject: Awaited<ReturnType<typeof resolveHistorySubject>>;\n settings: Awaited<ReturnType<typeof readSettings>>;\n typeRegistry: ReturnType<typeof resolveItemTypeRegistry>;\n historyRawBeforeLock: string | null;\n currentItemRawBeforeLock: string | null;\n author: string;\n force: boolean | undefined;\n loadedItem: Awaited<ReturnType<typeof readLocatedItem>> | null;\n historyPath: string;\n rewrittenEntries: HistoryEntry[];\n}): Promise<string[]> {\n return executeHistoryRewrite({\n pmRoot: params.pmRoot,\n subject: params.subject,\n settings: params.settings,\n typeRegistry: params.typeRegistry,\n historyRawBeforeLock: params.historyRawBeforeLock,\n currentItemRawBeforeLock: params.currentItemRawBeforeLock,\n operation: \"history-repair\",\n author: params.author,\n force: params.force,\n itemDocument: params.loadedItem?.document ?? null,\n applyRewrite: async ({ historyRawUnderLock }) =>\n writeHistoryRawWithRollback({\n historyPath: params.historyPath,\n nextHistoryRaw: historyEntriesToRaw(params.rewrittenEntries),\n historyRawUnderLock,\n }),\n applyPostRewrite: async () =>\n runActiveOnWriteHooks({\n path: params.historyPath,\n scope: \"project\",\n op: \"history_repair:history\",\n }),\n });\n}\n\n/**\n * Implements run history repair for the public runtime surface of this module.\n */\nexport async function runHistoryRepair(\n id: string,\n options: HistoryRepairCommandOptions,\n global: GlobalOptions,\n): Promise<HistoryRepairResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const subject = await resolveHistorySubject(pmRoot, id, settings, typeRegistry.type_to_folder);\n\n if (!(await pathExists(subject.historyPath))) {\n throw new PmCliError(`No history stream exists for ${subject.id}.`, EXIT_CODE.NOT_FOUND);\n }\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const historyEntries = await readHistoryEntries(subject.historyPath, subject.id);\n if (historyEntries.length === 0) {\n throw new PmCliError(`No history entries exist for ${subject.id}; nothing to repair.`, EXIT_CODE.USAGE);\n }\n\n const chainBefore = verifyHistoryChain(historyEntries);\n const reanchor = reanchorHistoryEntries(historyEntries);\n\n const itemReplayContext = await loadHistoryRepairItemReplay(subject, settings, historyEntries);\n\n const finalReplay = reanchor.finalDocument;\n const reconcileNeeded =\n itemReplayContext.currentItemReplay !== null && replayHash(finalReplay) !== replayHash(itemReplayContext.currentItemReplay);\n\n const changed = reanchor.entriesRehashed > 0 || reanchor.entriesPatchRepaired > 0 || reconcileNeeded;\n const author = toAuthor(options.author, settings.author_default);\n const dryRun = Boolean(options.dryRun);\n\n const repairMessage = buildHistoryRepairMessage({\n message: options.message,\n entriesRehashed: reanchor.entriesRehashed,\n entriesPatchRepaired: reanchor.entriesPatchRepaired,\n reconcileNeeded,\n });\n const { rewrittenEntries, auditEntryAdded } = buildHistoryRepairEntries({\n reanchorEntries: reanchor.entries,\n changed,\n reconcileNeeded,\n currentItemReplay: itemReplayContext.currentItemReplay,\n finalReplay,\n author,\n message: repairMessage,\n });\n\n const historyVerify = verifyHistoryChain(rewrittenEntries);\n if (!historyVerify.ok) {\n throw new PmCliError(\n `history-repair produced an invalid rewritten chain (${historyVerify.errors.join(\", \")}).`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n\n const warnings = collectHistoryRepairWarnings(changed, reanchor.skippedOps);\n\n if (changed && !dryRun) {\n warnings.push(\n ...(await applyHistoryRepairRewrite({\n pmRoot,\n subject,\n settings,\n typeRegistry,\n historyRawBeforeLock,\n currentItemRawBeforeLock: itemReplayContext.currentItemRawBeforeLock,\n author,\n force: options.force,\n loadedItem: itemReplayContext.loadedItem,\n historyPath: subject.historyPath,\n rewrittenEntries,\n })),\n );\n }\n\n return {\n id: subject.id,\n dry_run: dryRun,\n changed,\n history: {\n path: subject.historyPath,\n entries_scanned: historyEntries.length,\n chain_drift_before: !chainBefore.ok,\n entries_rehashed: reanchor.entriesRehashed,\n entries_patch_repaired: reanchor.entriesPatchRepaired,\n converted_replace_to_add: reanchor.convertedReplaceToAdd,\n skipped_ops: reanchor.skippedOps,\n reconciled_with_item: reconcileNeeded,\n audit_entry_added: auditEntryAdded,\n verify_ok: historyVerify.ok,\n verify_errors: historyVerify.errors,\n },\n item: {\n exists: itemReplayContext.currentItemPath !== null,\n path: itemReplayContext.currentItemPath,\n matched_chain_before: itemReplayContext.matchedChainBefore,\n },\n warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),\n generated_at: nowIso(),\n };\n}\n\n/**\n * Documents the history repair all stream result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairAllStreamResult {\n id: string;\n outcome: \"repaired\" | \"skipped_clean\" | \"failed\";\n entries_rehashed?: number;\n entries_patch_repaired?: number;\n reconciled_with_item?: boolean;\n error?: string;\n}\n\n/**\n * Documents the history repair all result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRepairAllResult {\n all: true;\n dry_run: boolean;\n scanned_streams: number;\n drifted_streams: number;\n /** One compact row per drifted stream (clean streams are summarized by the counts only). */\n streams: HistoryRepairAllStreamResult[];\n totals: { repaired: number; skipped_clean: number; failed: number };\n warnings: string[];\n generated_at: string;\n}\n\n/**\n * Enforce the `pm history-repair` target contract shared by the CLI and MCP\n * surfaces: exactly one of an item `<id>` or `--all` must be provided.\n */\nexport function assertHistoryRepairTarget(id: string | undefined, all: boolean): void {\n if (all && id !== undefined) {\n throw new PmCliError(\n \"history-repair: <id> and --all are mutually exclusive; pass an item id to repair one stream or --all to repair every drifted stream.\",\n EXIT_CODE.USAGE,\n );\n }\n if (!all && id === undefined) {\n throw new PmCliError(\n \"history-repair: provide an item <id> or pass --all to repair every drifted stream.\",\n EXIT_CODE.USAGE,\n );\n }\n}\n\n/**\n * Bulk drift repair: scan every item's history stream with the same drift scan\n * `pm health` uses, then run the audited single-stream repair (ownership check,\n * lock, no-drift verification, audit marker) for each drifted stream. One\n * failing stream never aborts the rest; failures are collected per row and the\n * caller decides the exit code from `totals.failed`.\n */\nexport async function runHistoryRepairAll(\n options: HistoryRepairCommandOptions,\n global: GlobalOptions,\n): Promise<HistoryRepairAllResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const itemReadWarnings: string[] = [];\n const items = await listAllFrontMatterWithBody(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n itemReadWarnings,\n settings.schema,\n );\n const drift = await scanHistoryDrift(pmRoot, items as Array<ItemMetadata & { body: string }>);\n\n const streams: HistoryRepairAllStreamResult[] = [];\n const totals = { repaired: 0, skipped_clean: 0, failed: 0 };\n for (const driftedId of drift.driftedItems) {\n try {\n const result = await runHistoryRepair(driftedId, options, global);\n /* c8 ignore next -- mixed repaired/clean outcomes depend on live drift composition. */\n const outcome = result.changed ? \"repaired\" : \"skipped_clean\";\n totals[outcome] += 1;\n streams.push({\n id: driftedId,\n outcome,\n entries_rehashed: result.history.entries_rehashed,\n entries_patch_repaired: result.history.entries_patch_repaired,\n reconciled_with_item: result.history.reconciled_with_item,\n });\n } catch (error) {\n totals.failed += 1;\n streams.push({\n id: driftedId,\n outcome: \"failed\",\n /* c8 ignore next -- non-Error throws are normalized in defensive fallback. */\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return {\n all: true,\n dry_run: Boolean(options.dryRun),\n scanned_streams: items.length,\n drifted_streams: drift.driftedItems.length,\n streams,\n totals,\n warnings: [...new Set(itemReadWarnings)].sort((left, right) => left.localeCompare(right)),\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,OAAO,eAAe;AAwEtB,SAAS,SAAS,WAA+B,eAAqB;AAEpE,QAAM,WAAW,aAAa,QAAQ,IAAI,aAAa;AACvD,QAAM,UAAU,SAAS,KAAI;AAC7B,SAAO,QAAQ,SAAS,IAAI,UAAU;AACxC;AAEA,eAAe,4BACb,SACA,UACA,gBAA8B;AAE9B,QAAM,kBAAkB,QAAQ,SAAS,YAAY;AACrD,QAAM,aAAa,QAAQ,UAAU,MAAM,gBAAgB,QAAQ,SAAS,EAAE,QAAQ,SAAS,OAAM,CAAE,IAAI;AAC3G,MAAI,CAAC,YAAY;AACf,WAAO;MACL,mBAAmB;MACnB;MACA,oBAAoB;MACpB,0BAA0B;MAC1B,YAAY;;EAEhB;AACA,QAAM,oBAAoB,iBAAiB,WAAW,QAAQ;AAC9D,QAAM,wBAAwB,eAAe,eAAe,SAAS,CAAC,GAAG;AACzE,SAAO;IACL;IACA;IACA,oBAAoB,WAAW,iBAAiB,MAAM;IACtD,0BAA0B,WAAW;IACrC;;AAEJ;AAEA,SAAS,0BAA0B,QAKlC;AACC,MAAI,OAAO,OAAO,YAAY,YAAY,OAAO,QAAQ,KAAI,EAAG,SAAS,GAAG;AAC1E,WAAO,OAAO;EAChB;AAEA,SAAO,8BAA8B,OAAO,eAAe,QACzD,OAAO,oBAAoB,IAAI,MAAM,KACvC,GAAG,OAAO,uBAAuB,IAAI,cAAc,OAAO,oBAAoB,eAAe,EAAE,GAC7F,OAAO,kBAAkB,yCAAyC,EACpE;AAEF;AAEA,SAAS,0BAA0B,QA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AAM,wBAAwB,UAAU,SAAS;EACzG;AAEA,QAAM,WAAW,MAAM,aAAa,MAAM;AAC1C,QAAM,eAAe,wBAAwB,UAAU,gCAA+B,CAAE;AACxF,QAAM,mBAA6B,CAAA;AACnC,QAAM,QAAQ,MAAM,2BAClB,QACA,SAAS,aACT,aAAa,gBACb,kBACA,SAAS,MAAM;AAEjB,QAAM,QAAQ,MAAM,iBAAiB,QAAQ,KAA+C;AAE5F,QAAM,UAA0C,CAAA;AAChD,QAAM,SAAS,EAAE,UAAU,GAAG,eAAe,GAAG,QAAQ,EAAC;AACzD,aAAW,aAAa,MAAM,cAAc;AAC1C,QAAI;AACF,YAAM,SAAS,MAAM,iBAAiB,WAAW,SAAS,MAAM;AAEhE,YAAM,UAAU,OAAO,UAAU,aAAa;AAC9C,aAAO,OAAO,KAAK;AACnB,cAAQ,KAAK;QACX,IAAI;QACJ;QACA,kBAAkB,OAAO,QAAQ;QACjC,wBAAwB,OAAO,QAAQ;QACvC,sBAAsB,OAAO,QAAQ;OACtC;IACH,SAAS,OAAO;AACd,aAAO,UAAU;AACjB,cAAQ,KAAK;QACX,IAAI;QACJ,SAAS;;QAET,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;OAC7D;IACH;EACF;AAEA,SAAO;IACL,KAAK;IACL,SAAS,QAAQ,QAAQ,MAAM;IAC/B,iBAAiB,MAAM;IACvB,iBAAiB,MAAM,aAAa;IACpC;IACA;IACA,UAAU,CAAC,GAAG,IAAI,IAAI,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,KAAK,cAAc,KAAK,CAAC;IACxF,cAAc,OAAM;;AAExB","debugId":"82206098-4fb2-5ba8-9c57-4eb1ac8e1688"}
@@ -1,38 +1,34 @@
1
1
  import {
2
2
  resolveAuthor
3
3
  } from "./chunk-WW4E2DC3.js";
4
- import {
5
- parseCsvKv
6
- } from "./chunk-T3ABIMGW.js";
7
4
  import {
8
5
  parseLimit
9
- } from "./chunk-EEY54JMF.js";
6
+ } from "./chunk-ZO7CLOY2.js";
10
7
  import {
11
- locateItem,
12
- mutateItem,
13
- readLocatedItem
14
- } from "./chunk-3U3VEWK6.js";
15
- import {
16
- nowIso
17
- } from "./chunk-DRBV5UC2.js";
8
+ parseCsvKv
9
+ } from "./chunk-2TILG6F2.js";
18
10
  import {
19
11
  PmCliError,
20
12
  getActiveExtensionRegistrations,
13
+ locateItem,
14
+ mutateItem,
15
+ nowIso,
16
+ readLocatedItem,
21
17
  readSettings
22
- } from "./chunk-P5YORJRH.js";
18
+ } from "./chunk-YNCFP5AR.js";
23
19
  import {
24
20
  EXIT_CODE,
25
21
  getSettingsPath,
26
22
  pathExists,
27
23
  resolveItemTypeRegistry,
28
24
  resolvePmRoot
29
- } from "./chunk-5VVUKE3U.js";
25
+ } from "./chunk-LCFJ7XAM.js";
30
26
 
31
27
  // dist/cli/commands/annotation-command.js
32
28
  !(function() {
33
29
  try {
34
30
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
35
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e64198f6-7323-5f3c-b336-dde5cf28a5fa");
31
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "5fd7e12e-f272-574b-8e22-e4d6d077b280");
36
32
  } catch (e2) {
37
33
  }
38
34
  })();
@@ -84,6 +80,29 @@ function wrapOwnershipConflict(error, guidance) {
84
80
  }
85
81
  throw error;
86
82
  }
83
+ function annotationStdinHint(collectionKey) {
84
+ return collectionKey === "comments" ? "--stdin" : "--add -";
85
+ }
86
+ function assertAnnotationAddValueIsNotFlagLike(raw, config) {
87
+ const emptyFlag = config.input.emptyFlag ?? "--add";
88
+ if (emptyFlag !== "--add") {
89
+ return;
90
+ }
91
+ const trimmed = raw.trim();
92
+ if (!/^-{1,2}[A-Za-z][\w-]*(?:=.*)?$/.test(trimmed)) {
93
+ return;
94
+ }
95
+ const stdinHint = annotationStdinHint(config.collectionKey);
96
+ const commandPrefix = config.input.mode === "edit" ? `pm ${config.collectionKey} <id> --edit <index>` : `pm ${config.collectionKey} <id>`;
97
+ throw new PmCliError(`--add value "${trimmed}" looks like an option, not annotation text. Use ${stdinHint} to read stdin, or use text=${trimmed} for literal dash-leading text.`, EXIT_CODE.USAGE, {
98
+ code: "annotation_flag_like_value",
99
+ required: `Use ${stdinHint} for stdin input, pass plain text, or use text=${trimmed} when the text really starts with "-".`,
100
+ examples: [
101
+ `${commandPrefix} ${stdinHint}`,
102
+ `${commandPrefix} --add text=${trimmed}`
103
+ ]
104
+ });
105
+ }
87
106
  async function runAnnotationCommand(id, options, global2, config) {
88
107
  const pmRoot = resolvePmRoot(process.cwd(), global2.path);
89
108
  if (!await pathExists(getSettingsPath(pmRoot))) {
@@ -129,6 +148,8 @@ async function runAnnotationCommand(id, options, global2, config) {
129
148
  const allEntries2 = readAnnotationEntries(result2.item, config.collectionKey);
130
149
  return renderAnnotationResult(result2.item.id, config.collectionKey, allEntries2, limit, options.includeMeta === true);
131
150
  }
151
+ const rawText = config.input.rawValue ?? config.input.value ?? "";
152
+ assertAnnotationAddValueIsNotFlagLike(rawText, config);
132
153
  const text = config.parseText(config.input.value ?? "");
133
154
  if (!text.trim()) {
134
155
  throw new PmCliError(`${config.input.emptyFlag ?? "--add"} text cannot be empty`, EXIT_CODE.USAGE);
@@ -222,4 +243,4 @@ export {
222
243
  wrapOwnershipConflict,
223
244
  runAnnotationCommand
224
245
  };
225
- //# sourceMappingURL=chunk-5J2XPTAD.js.map
246
+ //# sourceMappingURL=chunk-43SIHQND.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../cli/commands/annotation-command.ts"],
4
+ "sourcesContent": ["/**\n * @module cli/commands/annotation-command\n *\n * Implements the pm annotation command command surface and its agent-facing runtime behavior.\n */\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { getActiveExtensionRegistrations } from \"../../core/extensions/index.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { parseCsvKv } from \"../../core/item/parse.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport { locateItem, mutateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { parseLimit } from \"../shared-parsers.js\";\n\ninterface AnnotationEntry {\n created_at: string;\n author: string;\n text: string;\n edited_at?: string;\n}\n\ninterface AnnotationCommandOptions {\n limit?: string;\n author?: string;\n message?: string;\n force?: boolean;\n includeMeta?: boolean;\n}\n\ninterface AnnotationInput {\n mode: \"list\" | \"add\" | \"stdin\" | \"file\" | \"edit\" | \"delete\";\n value?: string;\n rawValue?: string;\n emptyFlag?: string;\n index?: number;\n}\n\ninterface OwnershipConflictGuidance {\n required: string;\n examples: string[];\n nextSteps: string[];\n}\n\ninterface AnnotationCommandConfig<TKey extends string> {\n input: AnnotationInput;\n collectionKey: TKey;\n op: Parameters<typeof mutateItem>[0][\"op\"];\n editOp?: Parameters<typeof mutateItem>[0][\"op\"];\n deleteOp?: Parameters<typeof mutateItem>[0][\"op\"];\n parseText: (raw: string) => string;\n allowAuditBypass: boolean;\n conflictGuidance: OwnershipConflictGuidance;\n}\n\ntype AnnotationCommandResult<TKey extends string, TEntry extends AnnotationEntry> = {\n id: string;\n count: number;\n} & Record<TKey, TEntry[]> & {\n total_count?: number;\n returned_count?: number;\n has_more?: boolean;\n limit?: number;\n };\n\n/**\n * Implements limit annotation entries for the public runtime surface of this module.\n */\nexport function limitAnnotationEntries<TEntry>(values: TEntry[], limit: number | undefined): TEntry[] {\n if (limit === undefined) return values;\n if (limit === 0) return [];\n return values.slice(Math.max(0, values.length - limit));\n}\n\n/**\n * Implements read annotation entries for the public runtime surface of this module.\n */\nexport function readAnnotationEntries<TEntry>(source: Record<string, unknown>, collectionKey: string): TEntry[] {\n const value = source[collectionKey];\n return Array.isArray(value) ? (value as TEntry[]) : [];\n}\n\n/**\n * Implements parse annotation text input for the public runtime surface of this module.\n */\nexport function parseAnnotationTextInput(raw: string, options: { stripPlainTextPrefix?: boolean } = {}): string {\n const trimmed = raw.trim();\n if (!trimmed) {\n return \"\";\n }\n const textPrefixMatch = /^(?:[-*+]\\s*)?text\\s*[:=]/i.exec(trimmed);\n if (options.stripPlainTextPrefix === true && textPrefixMatch && !trimmed.startsWith(\"```\")) {\n const text = trimmed.slice(textPrefixMatch[0].length).trim();\n return text || trimmed;\n }\n const looksStructured = /^(?:[-*+]\\s*)?text\\s*[:=]/im.test(trimmed) || trimmed.startsWith(\"```\");\n if (!looksStructured) {\n return trimmed;\n }\n try {\n const kv = parseCsvKv(trimmed, \"--add\");\n const keys = Object.keys(kv).map((key) => key.trim().toLowerCase());\n if (keys.some((key) => key !== \"text\")) {\n return trimmed;\n }\n const text = kv.text?.trim();\n return text || trimmed;\n } catch {\n return trimmed;\n }\n}\n\n/**\n * Implements wrap ownership conflict for the public runtime surface of this module.\n */\nexport function wrapOwnershipConflict(error: unknown, guidance: OwnershipConflictGuidance): never {\n if (\n error instanceof PmCliError &&\n error.exitCode === EXIT_CODE.CONFLICT &&\n error.message.includes(\"is assigned to\") &&\n error.message.includes(\"Use --force to override\")\n ) {\n throw new PmCliError(error.message, error.exitCode, {\n code: \"ownership_conflict\",\n required: guidance.required,\n examples: guidance.examples,\n nextSteps: guidance.nextSteps,\n });\n }\n throw error;\n}\n\nfunction annotationStdinHint(collectionKey: string): string {\n return collectionKey === \"comments\" ? \"--stdin\" : \"--add -\";\n}\n\nfunction assertAnnotationAddValueIsNotFlagLike(raw: string, config: AnnotationCommandConfig<string>): void {\n const emptyFlag = config.input.emptyFlag ?? \"--add\";\n if (emptyFlag !== \"--add\") {\n return;\n }\n const trimmed = raw.trim();\n if (!/^-{1,2}[A-Za-z][\\w-]*(?:=.*)?$/.test(trimmed)) {\n return;\n }\n const stdinHint = annotationStdinHint(config.collectionKey);\n const commandPrefix =\n config.input.mode === \"edit\"\n ? `pm ${config.collectionKey} <id> --edit <index>`\n : `pm ${config.collectionKey} <id>`;\n throw new PmCliError(\n `--add value \"${trimmed}\" looks like an option, not annotation text. Use ${stdinHint} to read stdin, or use text=${trimmed} for literal dash-leading text.`,\n EXIT_CODE.USAGE,\n {\n code: \"annotation_flag_like_value\",\n required: `Use ${stdinHint} for stdin input, pass plain text, or use text=${trimmed} when the text really starts with \"-\".`,\n examples: [\n `${commandPrefix} ${stdinHint}`,\n `${commandPrefix} --add text=${trimmed}`,\n ],\n },\n );\n}\n\n/**\n * Implements run annotation command for the public runtime surface of this module.\n */\nexport async function runAnnotationCommand<TKey extends string, TEntry extends AnnotationEntry>(\n id: string,\n options: AnnotationCommandOptions,\n global: GlobalOptions,\n config: AnnotationCommandConfig<TKey>,\n): Promise<AnnotationCommandResult<TKey, TEntry>> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const limit = parseLimit(options.limit);\n\n if (config.input.mode === \"list\") {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);\n if (!located) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n const loaded = await readLocatedItem(located, { schema: settings.schema });\n const allEntries = readAnnotationEntries<TEntry>(loaded.document.metadata, config.collectionKey);\n return renderAnnotationResult(located.id, config.collectionKey, allEntries, limit, options.includeMeta === true);\n }\n\n const author = resolveAuthor(options.author, settings.author_default);\n\n if (config.input.mode === \"delete\") {\n const op = config.deleteOp ?? config.op;\n let result: Awaited<ReturnType<typeof mutateItem>>;\n try {\n result = await mutateItem({\n pmRoot,\n settings,\n id,\n op,\n author,\n message: options.message,\n force: options.force,\n bypassAssigneeConflict: config.allowAuditBypass,\n mutate(document) {\n const entries = readAnnotationEntries<TEntry>(document.metadata, config.collectionKey);\n const arrayIndex = resolveAnnotationIndex(config.input.index, entries.length, config.collectionKey);\n entries.splice(arrayIndex, 1);\n document.metadata[config.collectionKey] = entries as never;\n return { changedFields: [config.collectionKey] };\n },\n });\n } catch (error: unknown) {\n wrapOwnershipConflict(error, config.conflictGuidance);\n }\n const allEntries = readAnnotationEntries<TEntry>(result.item, config.collectionKey);\n return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true);\n }\n\n const rawText = config.input.rawValue ?? config.input.value ?? \"\";\n assertAnnotationAddValueIsNotFlagLike(rawText, config);\n const text = config.parseText(config.input.value ?? \"\");\n if (!text.trim()) {\n throw new PmCliError(`${config.input.emptyFlag ?? \"--add\"} text cannot be empty`, EXIT_CODE.USAGE);\n }\n\n if (config.input.mode === \"edit\") {\n const op = config.editOp ?? config.op;\n let result: Awaited<ReturnType<typeof mutateItem>>;\n try {\n result = await mutateItem({\n pmRoot,\n settings,\n id,\n op,\n author,\n message: options.message,\n force: options.force,\n bypassAssigneeConflict: config.allowAuditBypass,\n mutate(document) {\n const entries = readAnnotationEntries<TEntry>(document.metadata, config.collectionKey);\n const arrayIndex = resolveAnnotationIndex(config.input.index, entries.length, config.collectionKey);\n const existing = entries[arrayIndex];\n entries[arrayIndex] = {\n ...existing,\n text,\n edited_at: nowIso(),\n } as TEntry;\n document.metadata[config.collectionKey] = entries as never;\n return { changedFields: [config.collectionKey] };\n },\n });\n } catch (error: unknown) {\n wrapOwnershipConflict(error, config.conflictGuidance);\n }\n const allEntries = readAnnotationEntries<TEntry>(result.item, config.collectionKey);\n return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true);\n }\n\n let result: Awaited<ReturnType<typeof mutateItem>>;\n try {\n result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: config.op,\n author,\n message: options.message,\n force: options.force,\n bypassAssigneeConflict: config.allowAuditBypass,\n mutate(document) {\n const entries = readAnnotationEntries<TEntry>(document.metadata, config.collectionKey);\n entries.push({\n created_at: nowIso(),\n author,\n text,\n } as TEntry);\n document.metadata[config.collectionKey] = entries as never;\n return { changedFields: [config.collectionKey] };\n },\n });\n } catch (error: unknown) {\n wrapOwnershipConflict(error, config.conflictGuidance);\n }\n\n const allEntries = readAnnotationEntries<TEntry>(result.item, config.collectionKey);\n return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true);\n}\n\n/**\n * Implements resolve annotation index for the public runtime surface of this module.\n */\nexport function resolveAnnotationIndex(\n oneBasedIndex: number | undefined,\n count: number,\n collectionKey: string,\n): number {\n if (oneBasedIndex === undefined || !Number.isInteger(oneBasedIndex) || oneBasedIndex < 1 || oneBasedIndex > count) {\n const singular = collectionKey.replace(/s$/, \"\");\n const label = `${singular.charAt(0).toUpperCase()}${singular.slice(1)}`;\n const noun = count === 1 ? `1 ${singular}` : `${count} ${collectionKey}`;\n throw new PmCliError(\n `${label} index ${oneBasedIndex ?? \"(missing)\"} out of range (item has ${noun})`,\n EXIT_CODE.USAGE,\n );\n }\n return oneBasedIndex - 1;\n}\n\nfunction renderAnnotationResult<TKey extends string, TEntry extends AnnotationEntry>(\n id: string,\n collectionKey: TKey,\n allEntries: TEntry[],\n limit: number | undefined,\n includeMeta: boolean,\n): AnnotationCommandResult<TKey, TEntry> {\n const entries = limitAnnotationEntries(allEntries, limit);\n return {\n id,\n [collectionKey]: entries,\n count: entries.length,\n ...(includeMeta\n ? {\n total_count: allEntries.length,\n returned_count: entries.length,\n has_more: entries.length < allEntries.length,\n ...(limit !== undefined ? { limit } : {}),\n }\n : {}),\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gBAAgB;EACtD;AAEA,QAAM,aAAa,sBAA8B,OAAO,MAAM,OAAO,aAAa;AAClF,SAAO,uBAAuB,OAAO,KAAK,IAAI,OAAO,eAAe,YAAY,OAAO,QAAQ,gBAAgB,IAAI;AACrH;AAKM,SAAU,uBACd,eACA,OACA,eAAqB;AAErB,MAAI,kBAAkB,UAAa,CAAC,OAAO,UAAU,aAAa,KAAK,gBAAgB,KAAK,gBAAgB,OAAO;AACjH,UAAM,WAAW,cAAc,QAAQ,MAAM,EAAE;AAC/C,UAAM,QAAQ,GAAG,SAAS,OAAO,CAAC,EAAE,YAAW,CAAE,GAAG,SAAS,MAAM,CAAC,CAAC;AACrE,UAAM,OAAO,UAAU,IAAI,KAAK,QAAQ,KAAK,GAAG,KAAK,IAAI,aAAa;AACtE,UAAM,IAAI,WACR,GAAG,KAAK,UAAU,iBAAiB,WAAW,2BAA2B,IAAI,KAC7E,UAAU,KAAK;EAEnB;AACA,SAAO,gBAAgB;AACzB;AAEA,SAAS,uBACP,IACA,eACA,YACA,OACA,aAAoB;AAEpB,QAAM,UAAU,uBAAuB,YAAY,KAAK;AACxD,SAAO;IACL;IACA,CAAC,aAAa,GAAG;IACjB,OAAO,QAAQ;IACf,GAAI,cACA;MACE,aAAa,WAAW;MACxB,gBAAgB,QAAQ;MACxB,UAAU,QAAQ,SAAS,WAAW;MACtC,GAAI,UAAU,SAAY,EAAE,MAAK,IAAK,CAAA;QAExC,CAAA;;AAER;",
6
+ "names": ["global", "allEntries", "result"]
7
+ }
@@ -1,38 +1,30 @@
1
1
  import {
2
2
  scanHistoryDrift
3
- } from "./chunk-S4APD35C.js";
3
+ } from "./chunk-HHEWQXPD.js";
4
4
  import {
5
5
  executeHistoryRewrite,
6
6
  resolveHistorySubject,
7
7
  writeHistoryRawWithRollback
8
- } from "./chunk-FDBARR33.js";
9
- import "./chunk-WW4E2DC3.js";
8
+ } from "./chunk-EIUBK2LT.js";
10
9
  import {
11
10
  readHistoryEntries
12
- } from "./chunk-3Y4OESPP.js";
11
+ } from "./chunk-M62RO3XK.js";
13
12
  import {
14
13
  historyEntriesToRaw,
15
14
  reanchorHistoryEntries,
16
15
  replayHash,
17
16
  toReplayDocument,
18
17
  verifyHistoryChain
19
- } from "./chunk-D3UCE7RW.js";
20
- import "./chunk-EEY54JMF.js";
21
- import {
22
- listAllFrontMatterWithBody,
23
- readLocatedItem
24
- } from "./chunk-3U3VEWK6.js";
25
- import "./chunk-EZFKWSC7.js";
26
- import {
27
- nowIso
28
- } from "./chunk-DRBV5UC2.js";
18
+ } from "./chunk-E3YQFSFE.js";
29
19
  import {
30
20
  PmCliError,
31
21
  getActiveExtensionRegistrations,
22
+ listAllFrontMatterWithBody,
23
+ nowIso,
24
+ readLocatedItem,
32
25
  readSettings,
33
26
  runActiveOnWriteHooks
34
- } from "./chunk-P5YORJRH.js";
35
- import "./chunk-7C2O74AE.js";
27
+ } from "./chunk-YNCFP5AR.js";
36
28
  import {
37
29
  EXIT_CODE,
38
30
  getSettingsPath,
@@ -40,7 +32,7 @@ import {
40
32
  readFileIfExists,
41
33
  resolveItemTypeRegistry,
42
34
  resolvePmRoot
43
- } from "./chunk-5VVUKE3U.js";
35
+ } from "./chunk-LCFJ7XAM.js";
44
36
 
45
37
  // dist/cli/commands/history-repair.js
46
38
  import jsonPatch from "fast-json-patch";
@@ -273,9 +265,10 @@ async function runHistoryRepairAll(options, global2) {
273
265
  generated_at: nowIso()
274
266
  };
275
267
  }
268
+
276
269
  export {
277
- assertHistoryRepairTarget,
278
270
  runHistoryRepair,
271
+ assertHistoryRepairTarget,
279
272
  runHistoryRepairAll
280
273
  };
281
- //# sourceMappingURL=history-repair-4N6SDVHK.js.map
274
+ //# sourceMappingURL=chunk-43UQN754.js.map