@unbrained/pm-cli 2026.6.8 → 2026.6.10

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 (527) hide show
  1. package/CHANGELOG.md +74 -11
  2. package/dist/cli/bootstrap-args.js +4 -2
  3. package/dist/cli/bootstrap-args.js.map +1 -1
  4. package/dist/cli/commands/aggregate.d.ts +7 -0
  5. package/dist/cli/commands/aggregate.js +53 -12
  6. package/dist/cli/commands/aggregate.js.map +1 -1
  7. package/dist/cli/commands/close.d.ts +1 -0
  8. package/dist/cli/commands/close.js +106 -3
  9. package/dist/cli/commands/close.js.map +1 -1
  10. package/dist/cli/commands/completion.js +20 -7
  11. package/dist/cli/commands/completion.js.map +1 -1
  12. package/dist/cli/commands/context.d.ts +9 -0
  13. package/dist/cli/commands/context.js +149 -20
  14. package/dist/cli/commands/context.js.map +1 -1
  15. package/dist/cli/commands/create.d.ts +1 -0
  16. package/dist/cli/commands/create.js +5 -3
  17. package/dist/cli/commands/create.js.map +1 -1
  18. package/dist/cli/commands/extension.js +4 -2
  19. package/dist/cli/commands/extension.js.map +1 -1
  20. package/dist/cli/commands/health.js +44 -6
  21. package/dist/cli/commands/health.js.map +1 -1
  22. package/dist/cli/commands/history.js +6 -5
  23. package/dist/cli/commands/history.js.map +1 -1
  24. package/dist/cli/commands/linked-test-parsers.d.ts +1 -0
  25. package/dist/cli/commands/linked-test-parsers.js +289 -2
  26. package/dist/cli/commands/linked-test-parsers.js.map +1 -1
  27. package/dist/cli/commands/reindex.d.ts +1 -0
  28. package/dist/cli/commands/reindex.js +33 -4
  29. package/dist/cli/commands/reindex.js.map +1 -1
  30. package/dist/cli/commands/test.d.ts +6 -0
  31. package/dist/cli/commands/test.js +46 -5
  32. package/dist/cli/commands/test.js.map +1 -1
  33. package/dist/cli/extension-command-help.d.ts +1 -0
  34. package/dist/cli/extension-command-help.js +42 -2
  35. package/dist/cli/extension-command-help.js.map +1 -1
  36. package/dist/cli/extension-command-options.d.ts +2 -0
  37. package/dist/cli/extension-command-options.js +89 -17
  38. package/dist/cli/extension-command-options.js.map +1 -1
  39. package/dist/cli/main.js +26 -26
  40. package/dist/cli/main.js.map +1 -1
  41. package/dist/cli/register-list-query.js +3 -2
  42. package/dist/cli/register-list-query.js.map +1 -1
  43. package/dist/cli/register-mutation.js +4 -2
  44. package/dist/cli/register-mutation.js.map +1 -1
  45. package/dist/cli/register-operations.js +15 -6
  46. package/dist/cli/register-operations.js.map +1 -1
  47. package/dist/cli/registration-helpers.js +9 -2
  48. package/dist/cli/registration-helpers.js.map +1 -1
  49. package/dist/cli-bundle/chunks/activity-5QLX6DHN.js +16 -0
  50. package/dist/cli-bundle/chunks/{activity-Q7XMIZIH.js → activity-W6TS5F2L.js} +11 -11
  51. package/dist/cli-bundle/chunks/{aggregate-GBSHSXOB.js → aggregate-NNJLKGEK.js} +64 -24
  52. package/dist/cli-bundle/chunks/aggregate-NNJLKGEK.js.map +7 -0
  53. package/dist/cli-bundle/chunks/{aggregate-HKQJZUBG.js → aggregate-UK2WJ4Z3.js} +65 -25
  54. package/dist/cli-bundle/chunks/aggregate-UK2WJ4Z3.js.map +1 -0
  55. package/dist/cli-bundle/chunks/{append-3RFOU7P5.js → append-7BS36Z2L.js} +8 -8
  56. package/dist/cli-bundle/chunks/{append-OM74OJVT.js → append-DHGTLUZW.js} +8 -8
  57. package/dist/cli-bundle/chunks/{chunk-SDLEYY6A.js → chunk-2MKBPWMK.js} +6 -8
  58. package/dist/cli-bundle/chunks/{chunk-SDLEYY6A.js.map → chunk-2MKBPWMK.js.map} +1 -1
  59. package/dist/cli-bundle/chunks/{chunk-Z2HXAFFH.js → chunk-344GDQTH.js} +2 -2
  60. package/dist/cli-bundle/chunks/{chunk-AEMKH5WQ.js → chunk-3VTWCBXL.js} +3 -3
  61. package/dist/cli-bundle/chunks/{chunk-XLSQ3QLT.js → chunk-4CYHWHZU.js} +2 -2
  62. package/dist/cli-bundle/chunks/{chunk-JS47EKLP.js → chunk-4H2NDEGJ.js} +7 -7
  63. package/dist/cli-bundle/chunks/{chunk-QF4OPBAG.js → chunk-5HH6QRH5.js} +9 -9
  64. package/dist/cli-bundle/chunks/{chunk-5NVJA7IW.js → chunk-5OMABP7I.js} +7 -7
  65. package/dist/cli-bundle/chunks/{chunk-YEFOCDIK.js → chunk-6ADVKPVV.js} +7 -7
  66. package/dist/cli-bundle/chunks/{chunk-SM3RMWGO.js → chunk-6KQS23TX.js} +8 -8
  67. package/dist/cli-bundle/chunks/{chunk-ETZZU5QF.js → chunk-6N46IM44.js} +2 -2
  68. package/dist/cli-bundle/chunks/{chunk-EPWT7BEA.js → chunk-6OSG3EMX.js} +157 -12
  69. package/dist/cli-bundle/chunks/chunk-6OSG3EMX.js.map +1 -0
  70. package/dist/cli-bundle/chunks/{chunk-5WO2VKFA.js → chunk-73PSHEMT.js} +8 -8
  71. package/dist/cli-bundle/chunks/{chunk-J4DKAGTM.js → chunk-7DUVDW7C.js} +3 -3
  72. package/dist/cli-bundle/chunks/{chunk-2BYKYPWY.js → chunk-7GYMMDDW.js} +2 -2
  73. package/dist/cli-bundle/chunks/{chunk-QFVASU44.js → chunk-7TW64BS5.js} +2 -2
  74. package/dist/cli-bundle/chunks/{chunk-VXBUXLVD.js → chunk-A6XVYNQJ.js} +13 -6
  75. package/dist/cli-bundle/chunks/chunk-A6XVYNQJ.js.map +7 -0
  76. package/dist/cli-bundle/chunks/{chunk-KP4KIUQT.js → chunk-ANVZCNL5.js} +3 -3
  77. package/dist/cli-bundle/chunks/{chunk-HOA3GMB6.js → chunk-BE5G7HEL.js} +14 -8
  78. package/dist/cli-bundle/chunks/chunk-BE5G7HEL.js.map +1 -0
  79. package/dist/cli-bundle/chunks/{chunk-QWNUDGFQ.js → chunk-CMEHZD6G.js} +163 -11
  80. package/dist/cli-bundle/chunks/chunk-CMEHZD6G.js.map +7 -0
  81. package/dist/cli-bundle/chunks/{chunk-7NQIY7Z6.js → chunk-CTW7QAHM.js} +6 -5
  82. package/dist/cli-bundle/chunks/chunk-CTW7QAHM.js.map +1 -0
  83. package/dist/cli-bundle/chunks/{chunk-UEXNNF3K.js → chunk-D6JZBUZ6.js} +7 -7
  84. package/dist/cli-bundle/chunks/{chunk-F33AQIB4.js → chunk-DEYNERFX.js} +19 -7
  85. package/dist/cli-bundle/chunks/chunk-DEYNERFX.js.map +1 -0
  86. package/dist/cli-bundle/chunks/{chunk-R4XIE7NQ.js → chunk-DMDEC4QP.js} +6 -6
  87. package/dist/cli-bundle/chunks/{chunk-KN4WSESY.js → chunk-DTRIVUTN.js} +5 -5
  88. package/dist/cli-bundle/chunks/{chunk-KS2U7BZ3.js → chunk-EAQLLID6.js} +16 -6
  89. package/dist/cli-bundle/chunks/chunk-EAQLLID6.js.map +1 -0
  90. package/dist/cli-bundle/chunks/{chunk-HP35AVFS.js → chunk-EIS32UA4.js} +2 -2
  91. package/dist/cli-bundle/chunks/chunk-F2PVV7IX.js +528 -0
  92. package/dist/cli-bundle/chunks/chunk-F2PVV7IX.js.map +7 -0
  93. package/dist/cli-bundle/chunks/{chunk-DV27WDA7.js → chunk-GF5XIBUH.js} +70 -9
  94. package/dist/cli-bundle/chunks/chunk-GF5XIBUH.js.map +7 -0
  95. package/dist/cli-bundle/chunks/{chunk-BFJPMUF5.js → chunk-GP6SHEAI.js} +5 -5
  96. package/dist/cli-bundle/chunks/{chunk-URJEZOLB.js → chunk-GRHPU6EM.js} +2 -2
  97. package/dist/cli-bundle/chunks/{chunk-K62SNVVE.js → chunk-I2FM2SMO.js} +2 -2
  98. package/dist/cli-bundle/chunks/{chunk-F33VC5EX.js → chunk-IEQ3N7WP.js} +12 -5
  99. package/dist/cli-bundle/chunks/chunk-IEQ3N7WP.js.map +1 -0
  100. package/dist/cli-bundle/chunks/{chunk-AXBUHLW7.js → chunk-K45NAJV2.js} +9 -9
  101. package/dist/cli-bundle/chunks/{chunk-NLVCMVC7.js → chunk-K7SXBA75.js} +2 -2
  102. package/dist/cli-bundle/chunks/{chunk-OVSSE2JP.js → chunk-KHBRV5JU.js} +14 -12
  103. package/dist/cli-bundle/chunks/chunk-KHBRV5JU.js.map +1 -0
  104. package/dist/cli-bundle/chunks/{chunk-D7WK2PKB.js → chunk-KMMUDSSB.js} +112 -7
  105. package/dist/cli-bundle/chunks/chunk-KMMUDSSB.js.map +1 -0
  106. package/dist/cli-bundle/chunks/{chunk-ALSRBNYB.js → chunk-KRZQGRVL.js} +14 -7
  107. package/dist/cli-bundle/chunks/chunk-KRZQGRVL.js.map +1 -0
  108. package/dist/cli-bundle/chunks/{chunk-PQDH3S54.js → chunk-LUJQJR7G.js} +71 -69
  109. package/dist/cli-bundle/chunks/{chunk-PQDH3S54.js.map → chunk-LUJQJR7G.js.map} +1 -1
  110. package/dist/cli-bundle/chunks/{chunk-NDSMKB2I.js → chunk-LYL32FT6.js} +3 -3
  111. package/dist/cli-bundle/chunks/{chunk-ODN53S6H.js → chunk-MF6KSSMF.js} +11 -14
  112. package/dist/cli-bundle/chunks/chunk-MF6KSSMF.js.map +1 -0
  113. package/dist/cli-bundle/chunks/{chunk-Z55JACL2.js → chunk-O64EYNHF.js} +6 -6
  114. package/dist/cli-bundle/chunks/{chunk-3TXWDGPU.js → chunk-OQGJSCZZ.js} +522 -37
  115. package/dist/cli-bundle/chunks/chunk-OQGJSCZZ.js.map +7 -0
  116. package/dist/cli-bundle/chunks/{chunk-FO2TYSQZ.js → chunk-OROMGSBP.js} +2 -2
  117. package/dist/cli-bundle/chunks/{chunk-3E3MDBTB.js → chunk-OSGWBWLK.js} +76 -74
  118. package/dist/cli-bundle/chunks/{chunk-3E3MDBTB.js.map → chunk-OSGWBWLK.js.map} +3 -3
  119. package/dist/cli-bundle/chunks/{chunk-7WXGR44E.js → chunk-OVNSQHDG.js} +19 -7
  120. package/dist/cli-bundle/chunks/chunk-OVNSQHDG.js.map +7 -0
  121. package/dist/cli-bundle/chunks/{chunk-XZS4MV37.js → chunk-PYULT32I.js} +2 -2
  122. package/dist/cli-bundle/chunks/{chunk-M7UBTVFT.js → chunk-Q6PSD5DZ.js} +3 -3
  123. package/dist/cli-bundle/chunks/{chunk-QQPZYP73.js → chunk-QGIWURY3.js} +12 -12
  124. package/dist/cli-bundle/chunks/{chunk-KCGMABHM.js → chunk-QJ2OIEOC.js} +68 -7
  125. package/dist/cli-bundle/chunks/chunk-QJ2OIEOC.js.map +1 -0
  126. package/dist/cli-bundle/chunks/{chunk-XEKZCBCS.js → chunk-SNASEDXB.js} +3 -3
  127. package/dist/cli-bundle/chunks/{chunk-4WYBLB6J.js → chunk-T6QLB34N.js} +3 -3
  128. package/dist/cli-bundle/chunks/{chunk-NGEEXR2R.js → chunk-TALBUVWF.js} +2 -2
  129. package/dist/cli-bundle/chunks/{chunk-FGRJZVXD.js → chunk-TV6FZGVK.js} +3 -3
  130. package/dist/cli-bundle/chunks/{chunk-MSH23UWO.js → chunk-TXWMLDMG.js} +13 -7
  131. package/dist/cli-bundle/chunks/chunk-TXWMLDMG.js.map +7 -0
  132. package/dist/cli-bundle/chunks/{chunk-TXKENAQP.js → chunk-TZLGCTA5.js} +5 -4
  133. package/dist/cli-bundle/chunks/chunk-TZLGCTA5.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{chunk-4TI3532H.js → chunk-UDWUDUJI.js} +2 -2
  135. package/dist/cli-bundle/chunks/{chunk-N4SQZ7L3.js → chunk-UMWF6ZAS.js} +12 -5
  136. package/dist/cli-bundle/chunks/chunk-UMWF6ZAS.js.map +7 -0
  137. package/dist/cli-bundle/chunks/{chunk-BKQMJXWY.js → chunk-UNH3KSHG.js} +4 -6
  138. package/dist/cli-bundle/chunks/{chunk-BKQMJXWY.js.map → chunk-UNH3KSHG.js.map} +1 -1
  139. package/dist/cli-bundle/chunks/{chunk-CBJXWXI5.js → chunk-UY26RIBR.js} +2 -2
  140. package/dist/cli-bundle/chunks/{chunk-TBLBEOEX.js → chunk-VSS3CSTF.js} +9 -9
  141. package/dist/cli-bundle/chunks/{chunk-2YPVCD7T.js → chunk-WBU257Z4.js} +13 -11
  142. package/dist/cli-bundle/chunks/chunk-WBU257Z4.js.map +7 -0
  143. package/dist/cli-bundle/chunks/{chunk-YJAKN2N2.js → chunk-WNMRICXH.js} +489 -32
  144. package/dist/cli-bundle/chunks/chunk-WNMRICXH.js.map +1 -0
  145. package/dist/cli-bundle/chunks/chunk-WSWOQP3Z.js +518 -0
  146. package/dist/cli-bundle/chunks/chunk-WSWOQP3Z.js.map +1 -0
  147. package/dist/cli-bundle/chunks/{chunk-OTY2YEH5.js → chunk-WWEFBBVF.js} +12 -12
  148. package/dist/cli-bundle/chunks/{chunk-UMMJAJB2.js → chunk-X3IPJU2O.js} +9 -9
  149. package/dist/cli-bundle/chunks/{chunk-KBKJVXUS.js → chunk-X5YC5DZM.js} +111 -6
  150. package/dist/cli-bundle/chunks/chunk-X5YC5DZM.js.map +7 -0
  151. package/dist/cli-bundle/chunks/{chunk-KVXIQDJG.js → chunk-XH6RA5A5.js} +15 -15
  152. package/dist/cli-bundle/chunks/chunk-XH6RA5A5.js.map +1 -0
  153. package/dist/cli-bundle/chunks/{chunk-2HMD3JM2.js → chunk-XRE4CTNP.js} +11 -14
  154. package/dist/cli-bundle/chunks/chunk-XRE4CTNP.js.map +7 -0
  155. package/dist/cli-bundle/chunks/{chunk-RISLL7XH.js → chunk-XSCGU4WT.js} +15 -5
  156. package/dist/cli-bundle/chunks/{chunk-RISLL7XH.js.map → chunk-XSCGU4WT.js.map} +2 -2
  157. package/dist/cli-bundle/chunks/{chunk-L3LYL3ID.js → chunk-ZH7C7ZVX.js} +14 -14
  158. package/dist/cli-bundle/chunks/chunk-ZH7C7ZVX.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{claim-NHBIIBOW.js → claim-3TY5LE54.js} +10 -10
  160. package/dist/cli-bundle/chunks/{claim-RNEBQCOO.js → claim-LM4YY6QQ.js} +10 -10
  161. package/dist/cli-bundle/chunks/{close-ZMXL2WDS.js → close-CSD4LEMT.js} +8 -8
  162. package/dist/cli-bundle/chunks/close-SIQCDOBR.js +13 -0
  163. package/dist/cli-bundle/chunks/{close-many-CDPQGQUB.js → close-many-B5SHDX6W.js} +17 -18
  164. package/dist/cli-bundle/chunks/{close-many-CDPQGQUB.js.map → close-many-B5SHDX6W.js.map} +1 -1
  165. package/dist/cli-bundle/chunks/{close-many-IQV5C2SI.js → close-many-WRXB5KVY.js} +15 -16
  166. package/dist/cli-bundle/chunks/{close-many-IQV5C2SI.js.map → close-many-WRXB5KVY.js.map} +1 -1
  167. package/dist/cli-bundle/chunks/{comments-J5Q4IJPH.js → comments-A5ALOYTG.js} +10 -10
  168. package/dist/cli-bundle/chunks/{comments-EFVBHWPT.js → comments-BDDEK3VW.js} +10 -10
  169. package/dist/cli-bundle/chunks/{config-72253M2O.js → config-W2NHDNQT.js} +8 -8
  170. package/dist/cli-bundle/chunks/{config-VFYA6BMI.js → config-YUYBMJOW.js} +8 -8
  171. package/dist/cli-bundle/chunks/{context-AVLO4IFH.js → context-LRJ74NSU.js} +147 -36
  172. package/dist/cli-bundle/chunks/context-LRJ74NSU.js.map +7 -0
  173. package/dist/cli-bundle/chunks/{context-WMSI2D65.js → context-R2QLOJCK.js} +148 -37
  174. package/dist/cli-bundle/chunks/context-R2QLOJCK.js.map +1 -0
  175. package/dist/cli-bundle/chunks/{contracts-D4BN3VSQ.js → contracts-47X7RYUF.js} +4 -4
  176. package/dist/cli-bundle/chunks/{contracts-RGPOBLPL.js → contracts-HJHR4NCD.js} +4 -4
  177. package/dist/cli-bundle/chunks/{copy-H6TXHK7S.js → copy-B7HFOWFB.js} +7 -7
  178. package/dist/cli-bundle/chunks/{copy-WXE3OOLZ.js → copy-P4UVYZ7M.js} +7 -7
  179. package/dist/cli-bundle/chunks/{create-PUAIJEZ7.js → create-5ERJF64D.js} +13 -13
  180. package/dist/cli-bundle/chunks/create-TXNRPS4K.js +27 -0
  181. package/dist/cli-bundle/chunks/{delete-WBME6WG5.js → delete-LX3LGBCH.js} +7 -7
  182. package/dist/cli-bundle/chunks/{delete-PKR2JHLH.js → delete-S3WVK6LP.js} +7 -7
  183. package/dist/cli-bundle/chunks/{deps-4BQEDV4L.js → deps-GWSNH7OZ.js} +7 -7
  184. package/dist/cli-bundle/chunks/{deps-KWHQRO75.js → deps-YSM4LZQD.js} +7 -7
  185. package/dist/cli-bundle/chunks/{docs-SCNBUGSV.js → docs-7RYFBHQD.js} +9 -9
  186. package/dist/cli-bundle/chunks/{docs-364GT3ZR.js → docs-TG6JMVMY.js} +9 -9
  187. package/dist/cli-bundle/chunks/{extension-KK2UPXJD.js → extension-R3LUKMX7.js} +5 -5
  188. package/dist/cli-bundle/chunks/{extension-CRE7JM47.js → extension-VNMRKIHI.js} +5 -5
  189. package/dist/cli-bundle/chunks/{files-66EHM5ZR.js → files-KAKU57OT.js} +9 -9
  190. package/dist/cli-bundle/chunks/{files-3GESQAWL.js → files-QB3EYPMO.js} +9 -9
  191. package/dist/cli-bundle/chunks/{gc-MOQDND5J.js → gc-B747VM4M.js} +3 -3
  192. package/dist/cli-bundle/chunks/{gc-D5IWOKQH.js → gc-KNUPLPSW.js} +3 -3
  193. package/dist/cli-bundle/chunks/{get-7J2ZCBV5.js → get-GMGLIQ5I.js} +11 -11
  194. package/dist/cli-bundle/chunks/{get-WXSLXV3K.js → get-SBL6NHYQ.js} +11 -11
  195. package/dist/cli-bundle/chunks/{health-B6AEM7BV.js → health-IG43Z4KL.js} +47 -19
  196. package/dist/cli-bundle/chunks/health-IG43Z4KL.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{health-YMZGOMVX.js → health-WWZJ5KJS.js} +46 -18
  198. package/dist/cli-bundle/chunks/health-WWZJ5KJS.js.map +7 -0
  199. package/dist/cli-bundle/chunks/history-6UKSZTRT.js +20 -0
  200. package/dist/cli-bundle/chunks/{history-TJTO5GCR.js → history-XCWRXBXC.js} +10 -10
  201. package/dist/cli-bundle/chunks/{history-compact-CKNN6UKW.js → history-compact-IDH7E7VN.js} +11 -11
  202. package/dist/cli-bundle/chunks/{history-compact-N2Q7IR3T.js → history-compact-KICKUCR7.js} +11 -11
  203. package/dist/cli-bundle/chunks/history-redact-HKYBTK6X.js +19 -0
  204. package/dist/cli-bundle/chunks/{history-redact-JUXUOH54.js → history-redact-JJWH3QWK.js} +11 -11
  205. package/dist/cli-bundle/chunks/{history-repair-TDBBSRVK.js → history-repair-7HWBZKXN.js} +11 -11
  206. package/dist/cli-bundle/chunks/{history-repair-CCCPBNTF.js → history-repair-N5HXKJOI.js} +11 -11
  207. package/dist/cli-bundle/chunks/init-27JLDUO2.js +17 -0
  208. package/dist/cli-bundle/chunks/{init-6ZPKD3YN.js → init-OQA3TWIS.js} +9 -9
  209. package/dist/cli-bundle/chunks/{learnings-WYNTYQ5T.js → learnings-L7VQUSVI.js} +10 -10
  210. package/dist/cli-bundle/chunks/{learnings-U7U2FNIO.js → learnings-Z4GAIZQ5.js} +10 -10
  211. package/dist/cli-bundle/chunks/list-6U3CJVXS.js +19 -0
  212. package/dist/cli-bundle/chunks/{list-JGP7ODML.js → list-W5ROBC5U.js} +10 -11
  213. package/dist/cli-bundle/chunks/{notes-P25YVTEG.js → notes-JJDOEDFK.js} +10 -10
  214. package/dist/cli-bundle/chunks/{notes-QIF6A7XS.js → notes-SDCK7BEN.js} +10 -10
  215. package/dist/cli-bundle/chunks/{plan-RACB5PI6.js → plan-H5HYHMBB.js} +13 -13
  216. package/dist/cli-bundle/chunks/{plan-SSBJFWXA.js → plan-W2B5RYR3.js} +13 -13
  217. package/dist/cli-bundle/chunks/{register-list-query-GQAEIG4K.js → register-list-query-QGRFMDWA.js} +20 -20
  218. package/dist/cli-bundle/chunks/register-list-query-QGRFMDWA.js.map +7 -0
  219. package/dist/cli-bundle/chunks/{register-list-query-5IXDPUZ6.js → register-list-query-V4S23735.js} +21 -21
  220. package/dist/cli-bundle/chunks/register-list-query-V4S23735.js.map +1 -0
  221. package/dist/cli-bundle/chunks/{register-mutation-FAS4YG63.js → register-mutation-I57PLUHA.js} +36 -35
  222. package/dist/cli-bundle/chunks/register-mutation-I57PLUHA.js.map +1 -0
  223. package/dist/cli-bundle/chunks/{register-mutation-YZCUILGO.js → register-mutation-ZPZNJXSA.js} +35 -34
  224. package/dist/cli-bundle/chunks/register-mutation-ZPZNJXSA.js.map +7 -0
  225. package/dist/cli-bundle/chunks/{register-operations-S2BOLUPF.js → register-operations-KAMLXAF5.js} +42 -37
  226. package/dist/cli-bundle/chunks/register-operations-KAMLXAF5.js.map +1 -0
  227. package/dist/cli-bundle/chunks/{register-operations-IBYWNJN5.js → register-operations-YEN4YEZ2.js} +41 -36
  228. package/dist/cli-bundle/chunks/register-operations-YEN4YEZ2.js.map +7 -0
  229. package/dist/cli-bundle/chunks/{register-setup-JRZ4UMWZ.js → register-setup-BZ3TNE3G.js} +15 -15
  230. package/dist/cli-bundle/chunks/{register-setup-ABA2JPWO.js → register-setup-WLFL3OUF.js} +15 -15
  231. package/dist/cli-bundle/chunks/restore-GNI2W5CN.js +17 -0
  232. package/dist/cli-bundle/chunks/{restore-K72ZNPEP.js → restore-RGFSPG4K.js} +11 -11
  233. package/dist/cli-bundle/chunks/{schema-UL4B2JX5.js → schema-CCDU3RLC.js} +8 -8
  234. package/dist/cli-bundle/chunks/{schema-3VKRDBLC.js → schema-KZASL323.js} +8 -8
  235. package/dist/cli-bundle/chunks/{search-632WJ7GO.js → search-7KSOLI2E.js} +10 -11
  236. package/dist/cli-bundle/chunks/{search-632WJ7GO.js.map → search-7KSOLI2E.js.map} +1 -1
  237. package/dist/cli-bundle/chunks/{search-EQDHSE4G.js → search-DTL7CO22.js} +12 -13
  238. package/dist/cli-bundle/chunks/{search-EQDHSE4G.js.map → search-DTL7CO22.js.map} +1 -1
  239. package/dist/cli-bundle/chunks/{stats-WLJ3XBF5.js → stats-IOXQMGI6.js} +7 -7
  240. package/dist/cli-bundle/chunks/{stats-O4UTMJMC.js → stats-QNV7B2CE.js} +7 -7
  241. package/dist/cli-bundle/chunks/{telemetry-EUVHFSQU.js → telemetry-IV5C6JOM.js} +4 -4
  242. package/dist/cli-bundle/chunks/{telemetry-NRVWX25E.js → telemetry-NHR5RFXT.js} +4 -4
  243. package/dist/cli-bundle/chunks/test-4Z37CXW4.js +32 -0
  244. package/dist/cli-bundle/chunks/{test-GXUBQNUC.js → test-PIL2CEEB.js} +14 -14
  245. package/dist/cli-bundle/chunks/{test-all-UTFXC7S2.js → test-all-GRLYHBNP.js} +14 -14
  246. package/dist/cli-bundle/chunks/{test-all-XM6OKI3L.js → test-all-MFN4MYCV.js} +14 -14
  247. package/dist/cli-bundle/chunks/{test-runs-IK6E2HNX.js → test-runs-7LRFWWCA.js} +5 -5
  248. package/dist/cli-bundle/chunks/{test-runs-7FHCPEA3.js → test-runs-7WCSC3TY.js} +5 -5
  249. package/dist/cli-bundle/chunks/update-I4G34LKJ.js +21 -0
  250. package/dist/cli-bundle/chunks/{update-U4B4OMHZ.js → update-VI5DBZ3G.js} +15 -15
  251. package/dist/cli-bundle/chunks/{update-many-5KD33MKY.js → update-many-LOTAYUTN.js} +22 -23
  252. package/dist/cli-bundle/chunks/{update-many-5KD33MKY.js.map → update-many-LOTAYUTN.js.map} +1 -1
  253. package/dist/cli-bundle/chunks/{update-many-N3YTM7K4.js → update-many-UYMTVF42.js} +24 -25
  254. package/dist/cli-bundle/chunks/{update-many-N3YTM7K4.js.map → update-many-UYMTVF42.js.map} +1 -1
  255. package/dist/cli-bundle/chunks/{upgrade-FFXGO43H.js → upgrade-LT2MLLPS.js} +5 -5
  256. package/dist/cli-bundle/chunks/{upgrade-5SRFLUNW.js → upgrade-ZZSC7CLV.js} +5 -5
  257. package/dist/cli-bundle/chunks/{validate-T3LPWSZG.js → validate-3XRORNMP.js} +16 -16
  258. package/dist/cli-bundle/chunks/{validate-CRWXZILW.js → validate-IQIQSKUX.js} +16 -16
  259. package/dist/cli-bundle/main.js +157 -62
  260. package/dist/cli-bundle/main.js.map +2 -2
  261. package/dist/core/diagnostics/remediation.js +12 -2
  262. package/dist/core/diagnostics/remediation.js.map +1 -1
  263. package/dist/core/extensions/extension-policy.d.ts +14 -1
  264. package/dist/core/extensions/extension-policy.js +38 -3
  265. package/dist/core/extensions/extension-policy.js.map +1 -1
  266. package/dist/core/extensions/extension-types.d.ts +99 -2
  267. package/dist/core/extensions/extension-types.js +28 -2
  268. package/dist/core/extensions/extension-types.js.map +1 -1
  269. package/dist/core/extensions/flag-value-types.d.ts +29 -0
  270. package/dist/core/extensions/flag-value-types.js +78 -0
  271. package/dist/core/extensions/flag-value-types.js.map +1 -0
  272. package/dist/core/extensions/item-field-types.d.ts +22 -0
  273. package/dist/core/extensions/item-field-types.js +43 -0
  274. package/dist/core/extensions/item-field-types.js.map +1 -0
  275. package/dist/core/extensions/item-fields.js +4 -11
  276. package/dist/core/extensions/item-fields.js.map +1 -1
  277. package/dist/core/extensions/loader.d.ts +16 -1
  278. package/dist/core/extensions/loader.js +202 -18
  279. package/dist/core/extensions/loader.js.map +1 -1
  280. package/dist/core/history/replay.d.ts +1 -1
  281. package/dist/core/history/replay.js +13 -4
  282. package/dist/core/history/replay.js.map +1 -1
  283. package/dist/core/output/mutation-projection.d.ts +2 -0
  284. package/dist/core/output/mutation-projection.js +9 -2
  285. package/dist/core/output/mutation-projection.js.map +1 -1
  286. package/dist/core/output/output.d.ts +2 -0
  287. package/dist/core/output/output.js +7 -3
  288. package/dist/core/output/output.js.map +1 -1
  289. package/dist/core/packages/manifest.d.ts +1 -1
  290. package/dist/core/packages/manifest.js +12 -2
  291. package/dist/core/packages/manifest.js.map +1 -1
  292. package/dist/core/shared/command-types.d.ts +1 -0
  293. package/dist/core/shared/command-types.js +2 -2
  294. package/dist/core/shared/command-types.js.map +1 -1
  295. package/dist/core/shared/constants.js +7 -4
  296. package/dist/core/shared/constants.js.map +1 -1
  297. package/dist/core/store/item-store.d.ts +1 -1
  298. package/dist/core/store/item-store.js +3 -3
  299. package/dist/core/store/item-store.js.map +1 -1
  300. package/dist/core/store/settings-read-cache.d.ts +15 -0
  301. package/dist/core/store/settings-read-cache.js +72 -0
  302. package/dist/core/store/settings-read-cache.js.map +1 -0
  303. package/dist/core/store/settings-validator.d.ts +4 -1
  304. package/dist/core/store/settings-validator.js +14 -2
  305. package/dist/core/store/settings-validator.js.map +1 -1
  306. package/dist/core/store/settings.js +166 -16
  307. package/dist/core/store/settings.js.map +1 -1
  308. package/dist/core/telemetry/runtime.d.ts +1 -0
  309. package/dist/core/telemetry/runtime.js +3 -3
  310. package/dist/core/telemetry/runtime.js.map +1 -1
  311. package/dist/core/test/run-selectors.d.ts +27 -0
  312. package/dist/core/test/run-selectors.js +110 -0
  313. package/dist/core/test/run-selectors.js.map +1 -0
  314. package/dist/mcp/server.js +105 -40
  315. package/dist/mcp/server.js.map +1 -1
  316. package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -2
  317. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  318. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  319. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  320. package/dist/sdk/cli-contracts/tool-parameter-tables.js +29 -2
  321. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  322. package/dist/sdk/cli-contracts.js +37 -5
  323. package/dist/sdk/cli-contracts.js.map +1 -1
  324. package/dist/sdk/index.d.ts +7 -2
  325. package/dist/sdk/index.js +3 -3
  326. package/dist/sdk/index.js.map +1 -1
  327. package/dist/sdk/runtime.d.ts +6 -0
  328. package/dist/sdk/runtime.js +51 -3
  329. package/dist/sdk/runtime.js.map +1 -1
  330. package/dist/sdk/testing.d.ts +55 -1
  331. package/dist/sdk/testing.js +92 -2
  332. package/dist/sdk/testing.js.map +1 -1
  333. package/dist/types.d.ts +4 -1
  334. package/dist/types.js +4 -2
  335. package/dist/types.js.map +1 -1
  336. package/docs/AGENT_GUIDE.md +7 -1
  337. package/docs/ARCHITECTURE.md +7 -0
  338. package/docs/COMMANDS.md +37 -3
  339. package/docs/CONFIGURATION.md +1 -1
  340. package/docs/EXTENSIONS.md +59 -53
  341. package/docs/SDK.md +104 -0
  342. package/docs/TESTING.md +60 -0
  343. package/docs/schemas/extension-manifest.schema.json +120 -0
  344. package/package.json +2 -2
  345. package/packages/pm-beads/extensions/beads/manifest.json +10 -0
  346. package/packages/pm-calendar/extensions/calendar/manifest.json +10 -0
  347. package/packages/pm-command-kit/README.md +72 -0
  348. package/packages/pm-command-kit/extensions/command-kit/index.js +181 -0
  349. package/packages/pm-command-kit/extensions/command-kit/index.ts +176 -0
  350. package/packages/pm-command-kit/extensions/command-kit/manifest.json +22 -0
  351. package/packages/pm-command-kit/package.json +53 -0
  352. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +10 -0
  353. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +10 -0
  354. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +10 -0
  355. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +10 -0
  356. package/packages/pm-search-advanced/extensions/search-advanced/index.js +6 -0
  357. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +6 -0
  358. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +10 -0
  359. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +1 -0
  360. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +1 -0
  361. package/packages/pm-templates/extensions/templates/manifest.json +10 -0
  362. package/packages/pm-todos/extensions/todos/manifest.json +10 -0
  363. package/dist/cli-bundle/chunks/activity-A3QKFSSF.js +0 -16
  364. package/dist/cli-bundle/chunks/aggregate-GBSHSXOB.js.map +0 -7
  365. package/dist/cli-bundle/chunks/aggregate-HKQJZUBG.js.map +0 -1
  366. package/dist/cli-bundle/chunks/chunk-2HMD3JM2.js.map +0 -7
  367. package/dist/cli-bundle/chunks/chunk-2YPVCD7T.js.map +0 -7
  368. package/dist/cli-bundle/chunks/chunk-3TXWDGPU.js.map +0 -7
  369. package/dist/cli-bundle/chunks/chunk-7NQIY7Z6.js.map +0 -1
  370. package/dist/cli-bundle/chunks/chunk-7WXGR44E.js.map +0 -7
  371. package/dist/cli-bundle/chunks/chunk-ALSRBNYB.js.map +0 -1
  372. package/dist/cli-bundle/chunks/chunk-D7WK2PKB.js.map +0 -1
  373. package/dist/cli-bundle/chunks/chunk-DV27WDA7.js.map +0 -7
  374. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +0 -56
  375. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +0 -7
  376. package/dist/cli-bundle/chunks/chunk-EPWT7BEA.js.map +0 -1
  377. package/dist/cli-bundle/chunks/chunk-F33AQIB4.js.map +0 -1
  378. package/dist/cli-bundle/chunks/chunk-F33VC5EX.js.map +0 -1
  379. package/dist/cli-bundle/chunks/chunk-HOA3GMB6.js.map +0 -1
  380. package/dist/cli-bundle/chunks/chunk-KBKJVXUS.js.map +0 -7
  381. package/dist/cli-bundle/chunks/chunk-KCGMABHM.js.map +0 -1
  382. package/dist/cli-bundle/chunks/chunk-KS2U7BZ3.js.map +0 -1
  383. package/dist/cli-bundle/chunks/chunk-KVXIQDJG.js.map +0 -1
  384. package/dist/cli-bundle/chunks/chunk-L3LYL3ID.js.map +0 -7
  385. package/dist/cli-bundle/chunks/chunk-MSH23UWO.js.map +0 -7
  386. package/dist/cli-bundle/chunks/chunk-N4SQZ7L3.js.map +0 -7
  387. package/dist/cli-bundle/chunks/chunk-NUKHZZNM.js +0 -252
  388. package/dist/cli-bundle/chunks/chunk-NUKHZZNM.js.map +0 -7
  389. package/dist/cli-bundle/chunks/chunk-ODN53S6H.js.map +0 -1
  390. package/dist/cli-bundle/chunks/chunk-OVSSE2JP.js.map +0 -1
  391. package/dist/cli-bundle/chunks/chunk-QWNUDGFQ.js.map +0 -7
  392. package/dist/cli-bundle/chunks/chunk-TXKENAQP.js.map +0 -7
  393. package/dist/cli-bundle/chunks/chunk-VXBUXLVD.js.map +0 -7
  394. package/dist/cli-bundle/chunks/chunk-XNGMIVQY.js +0 -242
  395. package/dist/cli-bundle/chunks/chunk-XNGMIVQY.js.map +0 -1
  396. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +0 -53
  397. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +0 -1
  398. package/dist/cli-bundle/chunks/chunk-YJAKN2N2.js.map +0 -1
  399. package/dist/cli-bundle/chunks/close-UNTFXVM3.js +0 -13
  400. package/dist/cli-bundle/chunks/context-AVLO4IFH.js.map +0 -7
  401. package/dist/cli-bundle/chunks/context-WMSI2D65.js.map +0 -1
  402. package/dist/cli-bundle/chunks/create-EZWAMUKR.js +0 -27
  403. package/dist/cli-bundle/chunks/health-B6AEM7BV.js.map +0 -1
  404. package/dist/cli-bundle/chunks/health-YMZGOMVX.js.map +0 -7
  405. package/dist/cli-bundle/chunks/history-ZERISU2L.js +0 -20
  406. package/dist/cli-bundle/chunks/history-redact-GODBYT5A.js +0 -19
  407. package/dist/cli-bundle/chunks/init-CBZHXBR3.js +0 -17
  408. package/dist/cli-bundle/chunks/list-7MTPPZHC.js +0 -20
  409. package/dist/cli-bundle/chunks/register-list-query-5IXDPUZ6.js.map +0 -1
  410. package/dist/cli-bundle/chunks/register-list-query-GQAEIG4K.js.map +0 -7
  411. package/dist/cli-bundle/chunks/register-mutation-FAS4YG63.js.map +0 -1
  412. package/dist/cli-bundle/chunks/register-mutation-YZCUILGO.js.map +0 -7
  413. package/dist/cli-bundle/chunks/register-operations-IBYWNJN5.js.map +0 -7
  414. package/dist/cli-bundle/chunks/register-operations-S2BOLUPF.js.map +0 -1
  415. package/dist/cli-bundle/chunks/restore-3JRX27QW.js +0 -17
  416. package/dist/cli-bundle/chunks/test-XN7RJL5Z.js +0 -32
  417. package/dist/cli-bundle/chunks/update-LFBSEW3N.js +0 -21
  418. /package/dist/cli-bundle/chunks/{activity-A3QKFSSF.js.map → activity-5QLX6DHN.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{activity-Q7XMIZIH.js.map → activity-W6TS5F2L.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{append-3RFOU7P5.js.map → append-7BS36Z2L.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{append-OM74OJVT.js.map → append-DHGTLUZW.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{chunk-Z2HXAFFH.js.map → chunk-344GDQTH.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{chunk-AEMKH5WQ.js.map → chunk-3VTWCBXL.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{chunk-XLSQ3QLT.js.map → chunk-4CYHWHZU.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{chunk-JS47EKLP.js.map → chunk-4H2NDEGJ.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{chunk-QF4OPBAG.js.map → chunk-5HH6QRH5.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{chunk-5NVJA7IW.js.map → chunk-5OMABP7I.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{chunk-YEFOCDIK.js.map → chunk-6ADVKPVV.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{chunk-SM3RMWGO.js.map → chunk-6KQS23TX.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{chunk-ETZZU5QF.js.map → chunk-6N46IM44.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{chunk-5WO2VKFA.js.map → chunk-73PSHEMT.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{chunk-J4DKAGTM.js.map → chunk-7DUVDW7C.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{chunk-2BYKYPWY.js.map → chunk-7GYMMDDW.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{chunk-QFVASU44.js.map → chunk-7TW64BS5.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{chunk-KP4KIUQT.js.map → chunk-ANVZCNL5.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{chunk-UEXNNF3K.js.map → chunk-D6JZBUZ6.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{chunk-R4XIE7NQ.js.map → chunk-DMDEC4QP.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{chunk-KN4WSESY.js.map → chunk-DTRIVUTN.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{chunk-HP35AVFS.js.map → chunk-EIS32UA4.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{chunk-BFJPMUF5.js.map → chunk-GP6SHEAI.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{chunk-URJEZOLB.js.map → chunk-GRHPU6EM.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{chunk-K62SNVVE.js.map → chunk-I2FM2SMO.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{chunk-AXBUHLW7.js.map → chunk-K45NAJV2.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{chunk-NLVCMVC7.js.map → chunk-K7SXBA75.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{chunk-NDSMKB2I.js.map → chunk-LYL32FT6.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{chunk-Z55JACL2.js.map → chunk-O64EYNHF.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{chunk-FO2TYSQZ.js.map → chunk-OROMGSBP.js.map} +0 -0
  448. /package/dist/cli-bundle/chunks/{chunk-XZS4MV37.js.map → chunk-PYULT32I.js.map} +0 -0
  449. /package/dist/cli-bundle/chunks/{chunk-M7UBTVFT.js.map → chunk-Q6PSD5DZ.js.map} +0 -0
  450. /package/dist/cli-bundle/chunks/{chunk-QQPZYP73.js.map → chunk-QGIWURY3.js.map} +0 -0
  451. /package/dist/cli-bundle/chunks/{chunk-XEKZCBCS.js.map → chunk-SNASEDXB.js.map} +0 -0
  452. /package/dist/cli-bundle/chunks/{chunk-4WYBLB6J.js.map → chunk-T6QLB34N.js.map} +0 -0
  453. /package/dist/cli-bundle/chunks/{chunk-NGEEXR2R.js.map → chunk-TALBUVWF.js.map} +0 -0
  454. /package/dist/cli-bundle/chunks/{chunk-FGRJZVXD.js.map → chunk-TV6FZGVK.js.map} +0 -0
  455. /package/dist/cli-bundle/chunks/{chunk-4TI3532H.js.map → chunk-UDWUDUJI.js.map} +0 -0
  456. /package/dist/cli-bundle/chunks/{chunk-CBJXWXI5.js.map → chunk-UY26RIBR.js.map} +0 -0
  457. /package/dist/cli-bundle/chunks/{chunk-TBLBEOEX.js.map → chunk-VSS3CSTF.js.map} +0 -0
  458. /package/dist/cli-bundle/chunks/{chunk-OTY2YEH5.js.map → chunk-WWEFBBVF.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{chunk-UMMJAJB2.js.map → chunk-X3IPJU2O.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{claim-NHBIIBOW.js.map → claim-3TY5LE54.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{claim-RNEBQCOO.js.map → claim-LM4YY6QQ.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{close-ZMXL2WDS.js.map → close-CSD4LEMT.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{close-UNTFXVM3.js.map → close-SIQCDOBR.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{comments-J5Q4IJPH.js.map → comments-A5ALOYTG.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{comments-EFVBHWPT.js.map → comments-BDDEK3VW.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{config-72253M2O.js.map → config-W2NHDNQT.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{config-VFYA6BMI.js.map → config-YUYBMJOW.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{contracts-D4BN3VSQ.js.map → contracts-47X7RYUF.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{contracts-RGPOBLPL.js.map → contracts-HJHR4NCD.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{copy-H6TXHK7S.js.map → copy-B7HFOWFB.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{copy-WXE3OOLZ.js.map → copy-P4UVYZ7M.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{create-PUAIJEZ7.js.map → create-5ERJF64D.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{create-EZWAMUKR.js.map → create-TXNRPS4K.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{delete-WBME6WG5.js.map → delete-LX3LGBCH.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{delete-PKR2JHLH.js.map → delete-S3WVK6LP.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{deps-4BQEDV4L.js.map → deps-GWSNH7OZ.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{deps-KWHQRO75.js.map → deps-YSM4LZQD.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{docs-SCNBUGSV.js.map → docs-7RYFBHQD.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{docs-364GT3ZR.js.map → docs-TG6JMVMY.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{extension-KK2UPXJD.js.map → extension-R3LUKMX7.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{extension-CRE7JM47.js.map → extension-VNMRKIHI.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{files-66EHM5ZR.js.map → files-KAKU57OT.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{files-3GESQAWL.js.map → files-QB3EYPMO.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{gc-MOQDND5J.js.map → gc-B747VM4M.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{gc-D5IWOKQH.js.map → gc-KNUPLPSW.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{get-7J2ZCBV5.js.map → get-GMGLIQ5I.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{get-WXSLXV3K.js.map → get-SBL6NHYQ.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{history-ZERISU2L.js.map → history-6UKSZTRT.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{history-TJTO5GCR.js.map → history-XCWRXBXC.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{history-compact-CKNN6UKW.js.map → history-compact-IDH7E7VN.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{history-compact-N2Q7IR3T.js.map → history-compact-KICKUCR7.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{history-redact-GODBYT5A.js.map → history-redact-HKYBTK6X.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{history-redact-JUXUOH54.js.map → history-redact-JJWH3QWK.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{history-repair-TDBBSRVK.js.map → history-repair-7HWBZKXN.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{history-repair-CCCPBNTF.js.map → history-repair-N5HXKJOI.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{init-CBZHXBR3.js.map → init-27JLDUO2.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{init-6ZPKD3YN.js.map → init-OQA3TWIS.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{learnings-WYNTYQ5T.js.map → learnings-L7VQUSVI.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{learnings-U7U2FNIO.js.map → learnings-Z4GAIZQ5.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{list-7MTPPZHC.js.map → list-6U3CJVXS.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{list-JGP7ODML.js.map → list-W5ROBC5U.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{notes-P25YVTEG.js.map → notes-JJDOEDFK.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{notes-QIF6A7XS.js.map → notes-SDCK7BEN.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{plan-RACB5PI6.js.map → plan-H5HYHMBB.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{plan-SSBJFWXA.js.map → plan-W2B5RYR3.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{register-setup-JRZ4UMWZ.js.map → register-setup-BZ3TNE3G.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{register-setup-ABA2JPWO.js.map → register-setup-WLFL3OUF.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{restore-3JRX27QW.js.map → restore-GNI2W5CN.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{restore-K72ZNPEP.js.map → restore-RGFSPG4K.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{schema-UL4B2JX5.js.map → schema-CCDU3RLC.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{schema-3VKRDBLC.js.map → schema-KZASL323.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{stats-WLJ3XBF5.js.map → stats-IOXQMGI6.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{stats-O4UTMJMC.js.map → stats-QNV7B2CE.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{telemetry-EUVHFSQU.js.map → telemetry-IV5C6JOM.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{telemetry-NRVWX25E.js.map → telemetry-NHR5RFXT.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{test-XN7RJL5Z.js.map → test-4Z37CXW4.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{test-GXUBQNUC.js.map → test-PIL2CEEB.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{test-all-UTFXC7S2.js.map → test-all-GRLYHBNP.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{test-all-XM6OKI3L.js.map → test-all-MFN4MYCV.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{test-runs-IK6E2HNX.js.map → test-runs-7LRFWWCA.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{test-runs-7FHCPEA3.js.map → test-runs-7WCSC3TY.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{update-LFBSEW3N.js.map → update-I4G34LKJ.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{update-U4B4OMHZ.js.map → update-VI5DBZ3G.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{upgrade-FFXGO43H.js.map → upgrade-LT2MLLPS.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{upgrade-5SRFLUNW.js.map → upgrade-ZZSC7CLV.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{validate-T3LPWSZG.js.map → validate-3XRORNMP.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{validate-CRWXZILW.js.map → validate-IQIQSKUX.js.map} +0 -0
@@ -4,16 +4,16 @@ import {
4
4
  import {
5
5
  createStdinTokenResolver,
6
6
  parseCsvKv
7
- } from "./chunk-CBJXWXI5.js";
7
+ } from "./chunk-UY26RIBR.js";
8
8
  import {
9
9
  listAllFrontMatter,
10
10
  locateItem,
11
11
  mutateItem,
12
12
  readLocatedItem
13
- } from "./chunk-2HMD3JM2.js";
13
+ } from "./chunk-XRE4CTNP.js";
14
14
  import {
15
15
  resolveItemTypeRegistry
16
- } from "./chunk-2BYKYPWY.js";
16
+ } from "./chunk-7GYMMDDW.js";
17
17
  import {
18
18
  EXIT_CODE,
19
19
  PmCliError,
@@ -23,7 +23,7 @@ import {
23
23
  pathExists,
24
24
  readSettings,
25
25
  resolvePmRoot
26
- } from "./chunk-3TXWDGPU.js";
26
+ } from "./chunk-OQGJSCZZ.js";
27
27
 
28
28
  // dist/cli/commands/linked-artifacts.js
29
29
  import fs from "node:fs/promises";
@@ -346,4 +346,4 @@ export {
346
346
  runLinkedArtifacts,
347
347
  renameArtifactsResultKey
348
348
  };
349
- //# sourceMappingURL=chunk-BFJPMUF5.js.map
349
+ //# sourceMappingURL=chunk-GP6SHEAI.js.map
@@ -3,7 +3,7 @@ import {
3
3
  PmCliError,
4
4
  isPathWithinDirectory,
5
5
  pathExists
6
- } from "./chunk-3TXWDGPU.js";
6
+ } from "./chunk-OQGJSCZZ.js";
7
7
 
8
8
  // dist/cli/commands/extension/shared.js
9
9
  import fs from "node:fs/promises";
@@ -112,4 +112,4 @@ export {
112
112
  parseExtensionManifest,
113
113
  validateExtensionDirectory
114
114
  };
115
- //# sourceMappingURL=chunk-URJEZOLB.js.map
115
+ //# sourceMappingURL=chunk-GRHPU6EM.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TYPE_TO_FOLDER,
3
3
  pathExists
4
- } from "./chunk-3TXWDGPU.js";
4
+ } from "./chunk-OQGJSCZZ.js";
5
5
 
6
6
  // dist/core/item/id.js
7
7
  import crypto from "node:crypto";
@@ -75,4 +75,4 @@ export {
75
75
  normalizeItemId,
76
76
  generateItemId
77
77
  };
78
- //# sourceMappingURL=chunk-K62SNVVE.js.map
78
+ //# sourceMappingURL=chunk-I2FM2SMO.js.map
@@ -1,12 +1,12 @@
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]="522b0ebd-699c-5123-b28a-4232c08e9e97")}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]="eef197b0-99c4-5e16-b890-90482bb8d6d6")}catch(e){}}();
3
3
  import {
4
4
  EXIT_CODE,
5
5
  runActiveCommandOverride,
6
6
  runActiveRendererOverride,
7
7
  runActiveServiceOverrideSync,
8
8
  setActiveCommandResult
9
- } from "./chunk-YJAKN2N2.js";
9
+ } from "./chunk-WNMRICXH.js";
10
10
 
11
11
  // dist/core/output/mutation-projection.js
12
12
  var CHANGED_FIELDS_KEY = "changed_fields";
@@ -47,6 +47,13 @@ function replaceRows(envelope, rows) {
47
47
  return projected;
48
48
  }
49
49
  function projectMutationResult(result, options = {}) {
50
+ if (options.idOnly === true && isPlainObject(result) && isPlainObject(result.item)) {
51
+ const id = typeof result.item.id === "string" ? result.item.id : void 0;
52
+ const status = typeof result.item.status === "string" ? result.item.status : void 0;
53
+ if (id) {
54
+ return status ? { id, status } : { id };
55
+ }
56
+ }
50
57
  const mode = options.changedFields ?? "full";
51
58
  if (mode === "full" || !isPlainObject(result)) {
52
59
  return result;
@@ -306,7 +313,7 @@ function formatOutput(result, options) {
306
313
  `;
307
314
  }
308
315
  function printResult(result, options) {
309
- const projected = options.noChangedFields ? projectMutationResult(result, { changedFields: "compact" }) : result;
316
+ const projected = options.idOnly ? projectMutationResult(result, { idOnly: true }) : options.noChangedFields ? projectMutationResult(result, { changedFields: "compact" }) : result;
310
317
  const rendered = formatOutput(projected, options);
311
318
  if (options.quiet) {
312
319
  return;
@@ -327,6 +334,6 @@ export {
327
334
  printResult,
328
335
  printError
329
336
  };
330
- //# sourceMappingURL=chunk-F33VC5EX.js.map
337
+ //# sourceMappingURL=chunk-IEQ3N7WP.js.map
331
338
 
332
- //# debugId=522b0ebd-699c-5123-b28a-4232c08e9e97
339
+ //# debugId=eef197b0-99c4-5e16-b890-90482bb8d6d6
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../core/output/mutation-projection.ts","../../../../../../../../core/output/output.ts"],"sourcesContent":["/**\n * Shared projection helper for mutation command results.\n *\n * Mutation commands (create/update/close/append/update-many) return a result\n * envelope that carries a `changed_fields` string array. On create this array simply\n * re-lists every field the command just set, which the item echo above it already\n * shows, so for high-volume agent loops it is ~50% redundant payload. This helper\n * lets the CLI (`--no-changed-fields`) and the MCP agent path trim that array down\n * to a deterministic `changed_field_count` without losing mutation evidence.\n *\n * Compaction is deliberately scoped to the mutation envelope only:\n * - the envelope's own top-level `changed_fields` (create/update/close/append), and\n * - `rows[*].changed_fields` (update-many reports its delta per row).\n * It does NOT recurse into arbitrary nested objects, so unrelated payloads that\n * legitimately carry `changed_fields` (for example `pm history --diff` entries, or a\n * custom runtime metadata field) are left untouched.\n *\n * The helper is pure and side-effect free, reused by both the output layer and the\n * MCP server, and returns the original reference unchanged when nothing is compacted.\n */\n\nexport type ChangedFieldsMode = \"full\" | \"compact\";\n\nexport interface MutationProjectionOptions {\n /** Defaults to \"full\" (unchanged output). \"compact\" drops the array, keeping a count. */\n changedFields?: ChangedFieldsMode;\n /** Return only id/status for single-item mutation envelopes. */\n idOnly?: boolean;\n}\n\nconst CHANGED_FIELDS_KEY = \"changed_fields\";\nconst CHANGED_FIELD_COUNT_KEY = \"changed_field_count\";\nconst ROWS_KEY = \"rows\";\nconst UPDATE_MANY_MUTATION_MODES = new Set([\"apply\", \"rollback\"]);\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n return proto === null || proto === Object.prototype;\n}\n\n/** Replace a single envelope's own top-level `changed_fields` array with a count. */\nfunction compactOwnChangedFields(envelope: Record<string, unknown>): Record<string, unknown> | null {\n const changedFields = envelope[CHANGED_FIELDS_KEY];\n if (!Array.isArray(changedFields)) {\n return null;\n }\n const projected: Record<string, unknown> =\n Object.getPrototypeOf(envelope) === null ? Object.create(null) : {};\n for (const [key, value] of Object.entries(envelope)) {\n if (key !== CHANGED_FIELDS_KEY) {\n projected[key] = value;\n }\n }\n projected[CHANGED_FIELD_COUNT_KEY] = changedFields.length;\n return projected;\n}\n\nfunction isMutationEnvelope(value: Record<string, unknown>): boolean {\n return \"item\" in value && Array.isArray(value[CHANGED_FIELDS_KEY]);\n}\n\nfunction isUpdateManyMutationEnvelope(value: Record<string, unknown>): boolean {\n return (\n typeof value.mode === \"string\" &&\n UPDATE_MANY_MUTATION_MODES.has(value.mode) &&\n Array.isArray(value[ROWS_KEY])\n );\n}\n\nfunction replaceRows(envelope: Record<string, unknown>, rows: unknown[]): Record<string, unknown> {\n const projected: Record<string, unknown> =\n Object.getPrototypeOf(envelope) === null ? Object.create(null) : {};\n Object.assign(projected, envelope);\n projected[ROWS_KEY] = rows;\n return projected;\n}\n\n/**\n * Returns a copy of a mutation result with the envelope `changed_fields` arrays\n * replaced by `changed_field_count` when compact mode is requested. Inputs that are\n * not a mutation envelope (or full mode) are returned unchanged (same reference).\n */\nexport function projectMutationResult(result: unknown, options: MutationProjectionOptions = {}): unknown {\n if (options.idOnly === true && isPlainObject(result) && isPlainObject(result.item)) {\n const id = typeof result.item.id === \"string\" ? result.item.id : undefined;\n const status = typeof result.item.status === \"string\" ? result.item.status : undefined;\n if (id) {\n return status ? { id, status } : { id };\n }\n }\n\n const mode = options.changedFields ?? \"full\";\n if (mode === \"full\" || !isPlainObject(result)) {\n return result;\n }\n\n let changed = false;\n let projected: Record<string, unknown> = result;\n\n const compactedTop = isMutationEnvelope(result) ? compactOwnChangedFields(result) : null;\n if (compactedTop !== null) {\n projected = compactedTop;\n changed = true;\n }\n\n // update-many reports its per-item delta under rows[*].changed_fields.\n const rows = isUpdateManyMutationEnvelope(projected) ? projected[ROWS_KEY] : undefined;\n if (Array.isArray(rows)) {\n let rowsChanged = false;\n const nextRows = rows.map((row) => {\n if (!isPlainObject(row)) {\n return row;\n }\n const compactedRow = compactOwnChangedFields(row);\n if (compactedRow) {\n rowsChanged = true;\n return compactedRow;\n }\n return row;\n });\n if (rowsChanged) {\n projected = replaceRows(projected, nextRows);\n changed = true;\n }\n }\n\n return changed ? projected : result;\n}\n","import {\n runActiveCommandOverride,\n runActiveRendererOverride,\n runActiveServiceOverrideSync,\n setActiveCommandResult,\n} from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { projectMutationResult } from \"./mutation-projection.js\";\n\nexport interface OutputOptions {\n json?: boolean;\n quiet?: boolean;\n /** When true, mutation results drop the verbose changed_fields array (keeps changed_field_count). */\n noChangedFields?: boolean;\n /** When true, single-item mutation results print only id and status. */\n idOnly?: boolean;\n defaultOutputFormat?: \"toon\" | \"json\";\n command?: string;\n commandArgs?: string[];\n commandOptions?: Record<string, unknown>;\n pmRoot?: string;\n}\n\ninterface NodeLikeError {\n code?: string;\n}\n\nconst NATIVE_OUTPUT_MARKER = \"__pm_native_output\";\n\nlet streamErrorHandlersInstalled = false;\ntype OutputStreamTarget = \"stdout\" | \"stderr\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction shouldUseNativeOutput(result: unknown): boolean {\n return isPlainObject(result) && result[NATIVE_OUTPUT_MARKER] === true;\n}\n\nfunction stripNativeOutputMarker<T>(result: T): T {\n if (!isPlainObject(result) || result[NATIVE_OUTPUT_MARKER] !== true) {\n return result;\n }\n const { [NATIVE_OUTPUT_MARKER]: _marker, ...rest } = result;\n return rest as T;\n}\n\nfunction isBrokenPipeError(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && (error as NodeLikeError).code === \"EPIPE\";\n}\n\nfunction markStdoutBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.SUCCESS;\n }\n}\n\nfunction markStderrBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.GENERIC_FAILURE;\n }\n}\n\nfunction markBrokenPipeExitCode(target: OutputStreamTarget): void {\n if (target === \"stdout\") {\n markStdoutBrokenPipeExitCode();\n return;\n }\n markStderrBrokenPipeExitCode();\n}\n\nfunction handleUnhandledStreamError(error: unknown): void {\n const unhandled = error instanceof Error ? error : new Error(String(error));\n setImmediate(() => {\n throw unhandled;\n });\n}\n\nfunction installStreamErrorHandlers(): void {\n if (streamErrorHandlersInstalled) {\n return;\n }\n streamErrorHandlersInstalled = true;\n process.stdout.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stdout\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n process.stderr.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stderr\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n}\n\nfunction writeToStream(target: OutputStreamTarget, text: string): boolean {\n installStreamErrorHandlers();\n try {\n if (target === \"stdout\") {\n process.stdout.write(text);\n } else {\n process.stderr.write(text);\n }\n return true;\n } catch (error: unknown) {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(target);\n return false;\n }\n throw error;\n }\n}\n\nexport function writeStdout(text: string): boolean {\n return writeToStream(\"stdout\", text);\n}\n\nexport function writeStderr(text: string): boolean {\n return writeToStream(\"stderr\", text);\n}\n\nfunction renderScalar(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n if (value === null) return \"null\";\n return JSON.stringify(value);\n}\n\nfunction compactToonValue(value: unknown): unknown | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const compactedEntries = value\n .map((entry) => compactToonValue(entry))\n .filter((entry): entry is unknown => entry !== undefined);\n return compactedEntries.length > 0 ? compactedEntries : undefined;\n }\n\n if (isPlainObject(value)) {\n const compacted: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const compactedEntry = compactToonValue(entry);\n if (compactedEntry !== undefined) {\n compacted[key] = compactedEntry;\n }\n }\n return Object.keys(compacted).length > 0 ? compacted : undefined;\n }\n\n return value;\n}\n\nfunction renderToonValue(value: unknown, depth: number): string {\n const indent = \" \".repeat(depth);\n\n if (Array.isArray(value)) {\n if (value.length === 0) return \"[]\";\n return value\n .map((entry) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}- ${renderScalar(entry)}`;\n }\n const rendered = renderToonValue(entry, depth + 1);\n const lines = rendered.split(\"\\n\");\n const [firstLine, ...rest] = lines;\n if (rest.length === 0) {\n return `${indent}- ${firstLine.trimStart()}`;\n }\n return `${indent}- ${firstLine.trimStart()}\\n${rest.join(\"\\n\")}`;\n })\n .join(\"\\n\");\n }\n\n if (isPlainObject(value)) {\n const entries = Object.entries(value);\n if (entries.length === 0) return \"{}\";\n return entries\n .map(([key, entry]) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}${key}: ${renderScalar(entry)}`;\n }\n if (Array.isArray(entry) && entry.length === 0) {\n return `${indent}${key}: []`;\n }\n if (isPlainObject(entry) && Object.keys(entry).length === 0) {\n return `${indent}${key}: {}`;\n }\n return `${indent}${key}:\\n${renderToonValue(entry, depth + 1)}`;\n })\n .join(\"\\n\");\n }\n\n return `${indent}${renderScalar(value)}`;\n}\n\nfunction renderDefaultMarkdownResult(value: unknown): string | null {\n if (!isPlainObject(value) || value.output_default !== \"markdown\") {\n return null;\n }\n if (typeof value.view !== \"string\" || !Array.isArray(value.events) || !Array.isArray(value.days)) {\n return null;\n }\n const lines = [`# pm calendar (${value.view})`, \"\"];\n const summary = isPlainObject(value.summary) ? value.summary : {};\n lines.push(`- events: ${String(summary.events ?? 0)}`);\n lines.push(\"\");\n if (value.events.length === 0) {\n lines.push(\"No calendar events matched the selected filters.\");\n return `${lines.join(\"\\n\")}\\n`;\n }\n for (const event of value.events) {\n if (!isPlainObject(event)) {\n continue;\n }\n const kind = typeof event.kind === \"string\" ? event.kind : \"event\";\n const title = typeof event.item_title === \"string\" ? event.item_title : \"\";\n const itemId = typeof event.item_id === \"string\" ? event.item_id : \"\";\n const reminderText = typeof event.reminder_text === \"string\" && event.reminder_text.length > 0 ? ` ${event.reminder_text}` : \"\";\n lines.push(`- [${kind}] ${itemId} ${title}${reminderText}`.trim());\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function formatOutput(result: unknown, options: OutputOptions): string {\n const commandOverride = runActiveCommandOverride(result);\n const nativeOutput = shouldUseNativeOutput(commandOverride.result);\n const effectiveResult = stripNativeOutputMarker(commandOverride.result);\n setActiveCommandResult(effectiveResult);\n const format =\n options.json === true\n ? \"json\"\n : options.json === false\n ? \"toon\"\n : options.defaultOutputFormat === \"json\"\n ? \"json\"\n : \"toon\";\n const serviceOverride = nativeOutput ? { handled: false, result: effectiveResult } : runActiveServiceOverrideSync(\"output_format\", {\n command: options.command,\n args: options.commandArgs,\n command_options: options.commandOptions,\n global: { ...options },\n pm_root: options.pmRoot,\n format,\n options: { ...options },\n result: effectiveResult,\n });\n if (serviceOverride.handled && typeof serviceOverride.result === \"string\") {\n return serviceOverride.result.endsWith(\"\\n\") ? serviceOverride.result : `${serviceOverride.result}\\n`;\n }\n const outputResult = serviceOverride.handled ? serviceOverride.result : effectiveResult;\n if (format === \"toon\") {\n const markdownDefault = renderDefaultMarkdownResult(outputResult);\n if (markdownDefault !== null) {\n return markdownDefault;\n }\n }\n const rendererOverride = nativeOutput ? { rendered: null } : runActiveRendererOverride(format, outputResult);\n if (rendererOverride.rendered !== null) {\n return rendererOverride.rendered.endsWith(\"\\n\") ? rendererOverride.rendered : `${rendererOverride.rendered}\\n`;\n }\n if (format === \"json\") {\n return `${JSON.stringify(outputResult, null, 2)}\\n`;\n }\n const compactedToon = compactToonValue(outputResult);\n if (compactedToon === undefined) {\n return \"{}\\n\";\n }\n return `${renderToonValue(compactedToon, 0)}\\n`;\n}\n\nexport function printResult(result: unknown, options: OutputOptions): void {\n const projected = options.idOnly\n ? projectMutationResult(result, { idOnly: true })\n : options.noChangedFields\n ? projectMutationResult(result, { changedFields: \"compact\" })\n : result;\n const rendered = formatOutput(projected, options);\n if (options.quiet) {\n return;\n }\n writeStdout(rendered);\n}\n\nexport function printError(message: string): void {\n const override = runActiveServiceOverrideSync(\"error_format\", {\n message,\n });\n const rendered = override.handled && typeof override.result === \"string\" ? override.result : message;\n writeStderr(rendered.endsWith(\"\\n\") ? rendered : `${rendered}\\n`);\n}\n"],"names":["isPlainObject"],"mappings":";;;;;;;;;;;AA8BA,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAChC,IAAM,WAAW;AACjB,IAAM,6BAA6B,oBAAI,IAAI,CAAC,SAAS,UAAU,CA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from "./chunk-2YPVCD7T.js";
6
+ } from "./chunk-WBU257Z4.js";
7
7
  import {
8
8
  EMPTY_REPLAY_DOCUMENT,
9
9
  normalizeReplayPatchOps,
10
10
  replayHash,
11
11
  toReplayDocument
12
- } from "./chunk-MSH23UWO.js";
12
+ } from "./chunk-TXWMLDMG.js";
13
13
  import {
14
14
  acquireLock,
15
15
  appendHistoryEntry,
@@ -17,21 +17,21 @@ import {
17
17
  enforceHistoryStreamPolicyForItem,
18
18
  locateItem,
19
19
  readLocatedItem
20
- } from "./chunk-2HMD3JM2.js";
20
+ } from "./chunk-XRE4CTNP.js";
21
21
  import {
22
22
  normalizeItemId,
23
23
  normalizeRawItemId
24
- } from "./chunk-K62SNVVE.js";
24
+ } from "./chunk-I2FM2SMO.js";
25
25
  import {
26
26
  canonicalDocument,
27
27
  serializeItemDocument
28
- } from "./chunk-M7UBTVFT.js";
28
+ } from "./chunk-Q6PSD5DZ.js";
29
29
  import {
30
30
  resolveItemTypeRegistry
31
- } from "./chunk-2BYKYPWY.js";
31
+ } from "./chunk-7GYMMDDW.js";
32
32
  import {
33
33
  nowIso
34
- } from "./chunk-QFVASU44.js";
34
+ } from "./chunk-7TW64BS5.js";
35
35
  import {
36
36
  EXIT_CODE,
37
37
  PmCliError,
@@ -47,7 +47,7 @@ import {
47
47
  resolvePmRoot,
48
48
  runActiveOnWriteHooks,
49
49
  writeFileAtomic
50
- } from "./chunk-3TXWDGPU.js";
50
+ } from "./chunk-OQGJSCZZ.js";
51
51
 
52
52
  // dist/cli/commands/restore.js
53
53
  import jsonPatch from "fast-json-patch";
@@ -380,4 +380,4 @@ async function runRestore(id, target, options, global2) {
380
380
  export {
381
381
  runRestore
382
382
  };
383
- //# sourceMappingURL=chunk-AXBUHLW7.js.map
383
+ //# sourceMappingURL=chunk-K45NAJV2.js.map
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  EXIT_CODE,
5
5
  PmCliError
6
- } from "./chunk-YJAKN2N2.js";
6
+ } from "./chunk-WNMRICXH.js";
7
7
 
8
8
  // dist/core/item/parse.js
9
9
  var STDIN_TOKEN = "-";
@@ -333,6 +333,6 @@ export {
333
333
  createStdinTokenResolver,
334
334
  parseOptionalNumber
335
335
  };
336
- //# sourceMappingURL=chunk-NLVCMVC7.js.map
336
+ //# sourceMappingURL=chunk-K7SXBA75.js.map
337
337
 
338
338
  //# debugId=782e6b42-6c10-51ac-b9b8-088e686821d0
@@ -1,29 +1,30 @@
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]="553e38e9-7271-599b-ac5e-73e58e64f044")}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]="7437b359-3800-54d8-9a2f-81395cf0e9a1")}catch(e){}}();
3
3
  import {
4
4
  cloneEmptyReplayDocument,
5
+ normalizeReplayPatchOps,
5
6
  tryApplyReplayPatch,
6
7
  verifyHistoryChain
7
- } from "./chunk-HOA3GMB6.js";
8
+ } from "./chunk-BE5G7HEL.js";
8
9
  import {
9
10
  parseLimit
10
- } from "./chunk-NDSMKB2I.js";
11
+ } from "./chunk-LYL32FT6.js";
11
12
  import {
12
13
  enforceHistoryStreamPolicyForItem,
13
14
  hashDocument,
14
15
  hashEmptyDocument,
15
16
  locateItem,
16
17
  readLocatedItem
17
- } from "./chunk-ODN53S6H.js";
18
+ } from "./chunk-MF6KSSMF.js";
18
19
  import {
19
20
  normalizeItemId
20
- } from "./chunk-4TI3532H.js";
21
+ } from "./chunk-UDWUDUJI.js";
21
22
  import {
22
23
  findFirstMergeConflictMarker
23
- } from "./chunk-XEKZCBCS.js";
24
+ } from "./chunk-SNASEDXB.js";
24
25
  import {
25
26
  resolveItemTypeRegistry
26
- } from "./chunk-Z2HXAFFH.js";
27
+ } from "./chunk-344GDQTH.js";
27
28
  import {
28
29
  EXIT_CODE,
29
30
  PmCliError,
@@ -35,7 +36,7 @@ import {
35
36
  readSettings,
36
37
  resolvePmRoot,
37
38
  runActiveOnReadHooks
38
- } from "./chunk-YJAKN2N2.js";
39
+ } from "./chunk-WNMRICXH.js";
39
40
 
40
41
  // dist/core/history/history-diff.js
41
42
  function decodeJsonPointerSegment(segment) {
@@ -138,7 +139,8 @@ function limitEntries(values, limit) {
138
139
  function buildDiffEntries(entries, startIndex) {
139
140
  return entries.map((entry, index) => {
140
141
  const changedFields = /* @__PURE__ */ new Set();
141
- for (const op of entry.patch) {
142
+ const patch = normalizeReplayPatchOps(entry.patch);
143
+ for (const op of patch) {
142
144
  changedFields.add(patchPathToChangedField(op.path));
143
145
  if (op.from) {
144
146
  changedFields.add(patchPathToChangedField(op.from));
@@ -149,7 +151,7 @@ function buildDiffEntries(entries, startIndex) {
149
151
  ts: entry.ts,
150
152
  op: entry.op,
151
153
  author: entry.author,
152
- patch_ops: entry.patch.length,
154
+ patch_ops: patch.length,
153
155
  changed_fields: [...changedFields].sort((left, right) => left.localeCompare(right))
154
156
  };
155
157
  });
@@ -261,6 +263,6 @@ export {
261
263
  readHistoryEntries,
262
264
  runHistory
263
265
  };
264
- //# sourceMappingURL=chunk-OVSSE2JP.js.map
266
+ //# sourceMappingURL=chunk-KHBRV5JU.js.map
265
267
 
266
- //# debugId=553e38e9-7271-599b-ac5e-73e58e64f044
268
+ //# debugId=7437b359-3800-54d8-9a2f-81395cf0e9a1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../core/history/history-diff.ts","../../../../../../../../cli/commands/history.ts"],"sourcesContent":["import { cloneEmptyReplayDocument, tryApplyReplayPatch, type ReplayDocument } from \"./replay.js\";\nimport type { HistoryEntry } from \"../../types/index.js\";\n\nexport interface HistoryFieldChange {\n field: string;\n // before and after are the raw field values captured by replaying the history chain.\n // `undefined` is intentional: it signals that the field was absent in the document at\n // that point (e.g. after a JSON-Patch `remove` op). JSON serialization will omit\n // undefined values, which correctly communicates \"field did not exist\".\n before: unknown;\n after: unknown;\n}\n\nexport interface HistoryDiffValueEntry {\n /** 1-based position in the FULL stream (fullEntries index + 1). */\n index: number;\n ts: string;\n op: string;\n author: string;\n /** Number of JSON-patch operations in this entry (entry.patch.length). */\n patch_ops: number;\n /** Unique field names touched by this entry, sorted by localeCompare. */\n changed_fields: string[];\n /** Per-field before/after values, sorted by field name (localeCompare). */\n changes: HistoryFieldChange[];\n}\n\n// ---------------------------------------------------------------------------\n// JSON-Pointer helpers (ported from src/cli/commands/history.ts so the\n// orchestrator can replace the private copy there with an import from here).\n// ---------------------------------------------------------------------------\n\nfunction decodeJsonPointerSegment(segment: string): string {\n return segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\");\n}\n\n/**\n * Map a JSON-Patch path string to a human-readable changed-field name.\n *\n * Rules (in priority order):\n * - \"/body\" or \"/body/…\" → \"body\"\n * - \"/metadata/…\" or \"/front_matter/…\"\n * with a first segment → that decoded segment (e.g. \"status\")\n * without a first segment (bare prefix) → \"metadata\"\n * - \"/\" (root pointer, empty segment after strip) → \"root\"\n * - anything else → decoded first path segment\n */\nexport function patchPathToChangedField(path: string): string {\n if (path === \"/body\" || path.startsWith(\"/body/\")) return \"body\";\n if (\n path === \"/metadata\" ||\n path.startsWith(\"/metadata/\") ||\n path === \"/front_matter\" ||\n path.startsWith(\"/front_matter/\")\n ) {\n const segment = path.replace(/^\\/(?:metadata|front_matter)\\/?/, \"\").split(\"/\")[0];\n if (!segment) return \"metadata\";\n return decodeJsonPointerSegment(segment);\n }\n const segment = path.replace(/^\\//, \"\").split(\"/\")[0];\n return segment ? decodeJsonPointerSegment(segment) : \"root\";\n}\n\n// ---------------------------------------------------------------------------\n// Field-value reader\n// ---------------------------------------------------------------------------\n\n/**\n * Extract the before/after value for a logical field from a replay document.\n *\n * - \"body\" → doc.body\n * - \"metadata\" → doc.metadata (the whole object, for a bare /metadata replace)\n * - \"root\" → the whole document (for a bare \"/\" patch op)\n * - other → doc.metadata[field] (may be undefined when the field was absent)\n */\nfunction readFieldValue(doc: ReplayDocument, field: string): unknown {\n if (field === \"body\") return doc.body;\n if (field === \"metadata\") return doc.metadata;\n if (field === \"root\") return doc;\n return doc.metadata[field];\n}\n\n// ---------------------------------------------------------------------------\n// Main export\n// ---------------------------------------------------------------------------\n\n/**\n * Replay a full history entry stream and produce enriched diff entries with\n * per-field before/after values.\n *\n * @param fullEntries The complete ordered history chain to replay.\n * @param options.windowStartIndex 0-based index into fullEntries at which the\n * DISPLAYED window begins. Entries before this index are still replayed (so\n * state is accurate) but are not emitted. Defaults to 0.\n * @param options.field When supplied, only entries that changed this field are\n * emitted, and each emitted entry's `changes` and `changed_fields` are\n * restricted to that single field.\n */\nexport function computeHistoryDiff(\n fullEntries: HistoryEntry[],\n options?: { windowStartIndex?: number; field?: string },\n): HistoryDiffValueEntry[] {\n const windowStartIndex = options?.windowStartIndex ?? 0;\n const fieldFilter = options?.field;\n\n if (fullEntries.length === 0 || windowStartIndex >= fullEntries.length) {\n return [];\n }\n\n let current = cloneEmptyReplayDocument();\n const result: HistoryDiffValueEntry[] = [];\n\n for (let p = 0; p < fullEntries.length; p += 1) {\n const entry = fullEntries[p];\n\n // Capture before state.\n const beforeDoc = current;\n\n // Attempt to apply patch.\n const applied = tryApplyReplayPatch(current, entry.patch);\n let afterDoc: ReplayDocument;\n if (applied.ok) {\n afterDoc = applied.document;\n current = afterDoc;\n } else {\n // Patch failed — use before state as after (cannot trust partial result).\n // Do NOT advance current; keep prior replay state.\n afterDoc = beforeDoc;\n }\n\n // Collect changed field names from patch paths (and from: paths for move/copy).\n const changedFieldSet = new Set<string>();\n for (const patchOp of entry.patch) {\n changedFieldSet.add(patchPathToChangedField(patchOp.path));\n if (patchOp.from !== undefined) {\n changedFieldSet.add(patchPathToChangedField(patchOp.from));\n }\n }\n const sortedFields = [...changedFieldSet].sort((a, b) => a.localeCompare(b));\n\n // Only emit entries in the display window.\n if (p >= windowStartIndex) {\n // Apply field filter: skip this entry entirely if it doesn't touch the\n // requested field; otherwise narrow down to only that field.\n if (fieldFilter !== undefined) {\n if (!changedFieldSet.has(fieldFilter)) {\n // This entry does not touch the requested field — skip it.\n continue;\n }\n // Emit only the filtered field.\n const change: HistoryFieldChange = {\n field: fieldFilter,\n before: readFieldValue(beforeDoc, fieldFilter),\n after: readFieldValue(afterDoc, fieldFilter),\n };\n result.push({\n index: p + 1,\n ts: entry.ts,\n op: entry.op,\n author: entry.author,\n patch_ops: entry.patch.length,\n changed_fields: [fieldFilter],\n changes: [change],\n });\n } else {\n // Emit all changed fields.\n const changes: HistoryFieldChange[] = sortedFields.map((field) => ({\n field,\n before: readFieldValue(beforeDoc, field),\n after: readFieldValue(afterDoc, field),\n }));\n result.push({\n index: p + 1,\n ts: entry.ts,\n op: entry.op,\n author: entry.author,\n patch_ops: entry.patch.length,\n changed_fields: sortedFields,\n changes,\n });\n }\n }\n }\n\n return result;\n}\n","import { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { computeHistoryDiff, patchPathToChangedField, type HistoryDiffValueEntry } from \"../../core/history/history-diff.js\";\nimport { hashDocument, hashEmptyDocument } from \"../../core/history/history.js\";\nimport { normalizeReplayPatchOps, verifyHistoryChain } from \"../../core/history/replay.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../../core/history/history-stream-policy.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { findFirstMergeConflictMarker } from \"../../core/shared/conflict-markers.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { getActiveExtensionRegistrations, runActiveOnReadHooks } from \"../../core/extensions/index.js\";\nimport { normalizeItemId } from \"../../core/item/id.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { parseLimit } from \"../shared-parsers.js\";\nimport type { HistoryEntry } from \"../../types/index.js\";\n\nexport { verifyHistoryChain } from \"../../core/history/replay.js\";\n\nexport interface HistoryCommandOptions {\n limit?: string;\n diff?: boolean;\n /** Restrict --diff to a single field's before/after transitions (implies --diff). */\n field?: string;\n verify?: boolean;\n compact?: boolean;\n}\n\nexport interface HistoryDiffEntry {\n index: number;\n ts: string;\n op: string;\n author: string;\n patch_ops: number;\n changed_fields: string[];\n}\n\nexport interface HistoryVerificationResult {\n ok: boolean;\n entries: number;\n errors: string[];\n latest_after_hash?: string;\n current_item_hash?: string;\n current_matches_latest?: boolean;\n}\n\nexport interface HistoryResult {\n id: string;\n history: HistoryEntry[];\n compact_history?: HistoryDiffEntry[];\n compact: boolean;\n count: number;\n limit: number | null;\n diff?: HistoryDiffValueEntry[];\n verification?: HistoryVerificationResult;\n}\n\nfunction limitEntries<T>(values: T[], limit: number | undefined): T[] {\n if (limit === undefined) return values;\n return values.slice(Math.max(0, values.length - limit));\n}\n\nfunction buildDiffEntries(entries: HistoryEntry[], startIndex: number): HistoryDiffEntry[] {\n return entries.map((entry, index) => {\n const changedFields = new Set<string>();\n const patch = normalizeReplayPatchOps(entry.patch);\n for (const op of patch) {\n changedFields.add(patchPathToChangedField(op.path));\n if (op.from) {\n changedFields.add(patchPathToChangedField(op.from));\n }\n }\n return {\n index: startIndex + index + 1,\n ts: entry.ts,\n op: entry.op,\n author: entry.author,\n patch_ops: patch.length,\n changed_fields: [...changedFields].sort((left, right) => left.localeCompare(right)),\n };\n });\n}\n\nexport async function readHistoryEntries(historyPath: string, itemId: string): Promise<HistoryEntry[]> {\n const raw = await readFileIfExists(historyPath);\n if (raw === null) {\n return [];\n }\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n if (raw.trim() === \"\") {\n return [];\n }\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `History for ${itemId} contains merge conflict markers at line ${conflictMarker.line} (${conflictMarker.marker}). Resolve <<<<<<< ======= >>>>>>> markers and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n {\n code: \"history_merge_conflict_markers_detected\",\n required: \"Repair the history stream by resolving merge-conflict markers.\",\n why: \"Conflict markers break JSONL parsing and invalidate deterministic audit history.\",\n examples: [`pm history ${itemId}`, `pm restore ${itemId} <timestamp-or-version>`],\n nextSteps: [\"Resolve or restore the history file, then rerun the command.\"],\n },\n );\n }\n\n const entries: HistoryEntry[] = [];\n const lines = raw.split(/\\r?\\n/);\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index]?.trim();\n if (!line) continue;\n try {\n entries.push(JSON.parse(line) as HistoryEntry);\n } catch {\n throw new PmCliError(\n `History for ${itemId} contains invalid JSON at line ${index + 1}. Repair or restore the history stream and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n return entries;\n}\n\nexport async function runHistory(id: string, options: HistoryCommandOptions, global: GlobalOptions): Promise<HistoryResult> {\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 limit = parseLimit(options.limit);\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const located = await locateItem(\n pmRoot,\n normalizedId,\n settings.id_prefix,\n settings.item_format,\n typeRegistry.type_to_folder,\n );\n const resolvedId = located?.id ?? normalizedId;\n const historyPath = getHistoryPath(pmRoot, resolvedId);\n if (!located && !(await pathExists(historyPath))) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n if (located) {\n await enforceHistoryStreamPolicyForItem({\n pmRoot,\n settings,\n itemId: located.id,\n commandLabel: \"history\",\n });\n }\n\n const fullHistory = await readHistoryEntries(historyPath, resolvedId);\n const history = limitEntries(fullHistory, limit);\n const compact = options.compact === true;\n const compactHistory = compact ? buildDiffEntries(history, Math.max(0, fullHistory.length - history.length)) : undefined;\n const result: HistoryResult = {\n id: resolvedId,\n history: compact ? [] : history,\n compact_history: compactHistory,\n compact,\n count: history.length,\n limit: limit ?? null,\n };\n\n if (options.diff || options.field !== undefined) {\n // --diff replays the full chain to surface per-field before/after values for\n // the displayed window (the latest --limit entries). --field narrows to a\n // single field's transitions (\"when did status change?\"). Unlike the compact\n // projection above, the value diff is independent of the compact/full toggle.\n result.diff = computeHistoryDiff(fullHistory, {\n windowStartIndex: Math.max(0, fullHistory.length - history.length),\n field: options.field,\n });\n }\n\n if (options.verify) {\n const verification = verifyHistoryChain(fullHistory);\n const latestAfterHash = fullHistory.length > 0 ? fullHistory[fullHistory.length - 1].after_hash : hashEmptyDocument();\n let currentItemHash: string | undefined;\n let currentMatchesLatest: boolean | undefined;\n const errors = [...verification.errors];\n\n if (located) {\n const loaded = await readLocatedItem(located, { schema: settings.schema });\n currentItemHash = hashDocument(loaded.document);\n currentMatchesLatest = currentItemHash === latestAfterHash;\n if (!currentMatchesLatest) {\n errors.push(\"verify_failed:current_item_hash_mismatch\");\n }\n }\n\n result.verification = {\n ok: errors.length === 0,\n entries: fullHistory.length,\n errors,\n latest_after_hash: fullHistory.length > 0 ? fullHistory[fullHistory.length - 1].after_hash : undefined,\n current_item_hash: currentItemHash,\n current_matches_latest: currentMatchesLatest,\n };\n }\n\n return result;\n}\n"],"names":["segment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,yBAAyB,SAAe;AAC/C,SAAO,QAAQ,WAAW,MAAM,GAAG,EAAE,WAAW,MAAM,GAAG;AAC3D;AAaM,SAAU,wBAAwB,M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UAAM,SAAS,CAAC,GAAG,aAAa,MAAM;AAEtC,QAAI,SAAS;AACX,YAAM,SAAS,MAAM,gBAAgB,SAAS,EAAE,QAAQ,SAAS,OAAM,CAAE;AACzE,wBAAkB,aAAa,OAAO,QAAQ;AAC9C,6BAAuB,oBAAoB;AAC3C,UAAI,CAAC,sBAAsB;AACzB,eAAO,KAAK,0CAA0C;MACxD;IACF;AAEA,WAAO,eAAe;MACpB,IAAI,OAAO,WAAW;MACtB,SAAS,YAAY;MACrB;MACA,mBAAmB,YAAY,SAAS,IAAI,YAAY,YAAY,SAAS,CAAC,EAAE,aAAa;MAC7F,mBAAmB;MACnB,wBAAwB;;EAE5B;AAEA,SAAO;AACT","debugId":"7437b359-3800-54d8-9a2f-81395cf0e9a1"}
@@ -1,16 +1,18 @@
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]="d0a74b9e-6c92-5e49-8668-68c79b7185d9")}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]="526cafb3-a405-5c17-a09e-8e3587ec1f24")}catch(e){}}();
3
3
  import {
4
4
  listAllFrontMatterLight,
5
+ locateItem,
5
6
  mutateItem,
7
+ readLocatedItem,
6
8
  toItemRecord
7
- } from "./chunk-ODN53S6H.js";
9
+ } from "./chunk-MF6KSSMF.js";
8
10
  import {
9
11
  isTerminalStatus
10
- } from "./chunk-XEKZCBCS.js";
12
+ } from "./chunk-SNASEDXB.js";
11
13
  import {
12
14
  resolveItemTypeRegistry
13
- } from "./chunk-Z2HXAFFH.js";
15
+ } from "./chunk-344GDQTH.js";
14
16
  import {
15
17
  EXIT_CODE,
16
18
  PmCliError,
@@ -19,7 +21,7 @@ import {
19
21
  readSettings,
20
22
  resolvePmRoot,
21
23
  resolveRuntimeStatusRegistry
22
- } from "./chunk-YJAKN2N2.js";
24
+ } from "./chunk-WNMRICXH.js";
23
25
 
24
26
  // dist/cli/commands/close.js
25
27
  function toAuthor(candidate, defaultAuthor) {
@@ -80,6 +82,77 @@ function findMissingCloseValidationFields(frontMatter) {
80
82
  }
81
83
  return missing;
82
84
  }
85
+ async function duplicateChainReferencesClosingItem(loadItemById, initialDuplicateOf, closingId) {
86
+ const visited = /* @__PURE__ */ new Set();
87
+ let current = initialDuplicateOf;
88
+ while (typeof current === "string" && current.trim().length > 0) {
89
+ const currentId = current.trim();
90
+ if (currentId === closingId) {
91
+ return true;
92
+ }
93
+ if (visited.has(currentId)) {
94
+ return false;
95
+ }
96
+ visited.add(currentId);
97
+ current = (await loadItemById(currentId))?.duplicate_of;
98
+ }
99
+ return false;
100
+ }
101
+ function shouldApplyDuplicateFallback(value) {
102
+ return typeof value !== "string" || value.trim().length === 0;
103
+ }
104
+ async function assertDuplicateTargetExists(pmRoot, settings, duplicateOf, closingId) {
105
+ const rawTarget = duplicateOf?.trim();
106
+ if (!rawTarget) {
107
+ return void 0;
108
+ }
109
+ if (rawTarget === closingId) {
110
+ throw new PmCliError("An item cannot be closed as a duplicate of itself.", EXIT_CODE.USAGE, {
111
+ code: "duplicate_target_self",
112
+ why: "--duplicate-of must identify the canonical item that should remain open or already represent the work."
113
+ });
114
+ }
115
+ const typeRegistry = resolveItemTypeRegistry(settings);
116
+ const itemCache = /* @__PURE__ */ new Map();
117
+ const loadItemById = async (id) => {
118
+ if (itemCache.has(id)) {
119
+ return itemCache.get(id) ?? null;
120
+ }
121
+ const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
122
+ if (!located) {
123
+ itemCache.set(id, null);
124
+ return null;
125
+ }
126
+ const { document } = await readLocatedItem(located, { schema: settings.schema });
127
+ itemCache.set(id, document.metadata);
128
+ return document.metadata;
129
+ };
130
+ const target = await loadItemById(rawTarget);
131
+ if (!target) {
132
+ throw new PmCliError(`Duplicate target "${rawTarget}" was not found. Create or locate the canonical item first.`, EXIT_CODE.USAGE, {
133
+ code: "duplicate_target_missing",
134
+ why: "Duplicate closure should point at a real canonical pm item so future dedupe and changelog tooling can trace the relationship.",
135
+ examples: [`pm close ${closingId} "Duplicate of ${rawTarget}" --duplicate-of ${rawTarget}`],
136
+ nextSteps: ["Run pm search/list to find the canonical item, then retry with --duplicate-of <id>."]
137
+ });
138
+ }
139
+ if (await duplicateChainReferencesClosingItem(loadItemById, target.duplicate_of, closingId)) {
140
+ throw new PmCliError(`Circular duplicate reference detected. Target "${rawTarget}" points back to "${closingId}".`, EXIT_CODE.USAGE, {
141
+ code: "duplicate_target_circular",
142
+ why: "Circular duplicate relationships create loops for dedupe and status propagation tooling.",
143
+ nextSteps: ["Choose the existing canonical item, or clear the target duplicate_of metadata before closing this item as a duplicate."]
144
+ });
145
+ }
146
+ if (typeof target.duplicate_of === "string" && target.duplicate_of.trim().length > 0) {
147
+ throw new PmCliError(`Duplicate target "${rawTarget}" is already marked as a duplicate of "${target.duplicate_of.trim()}".`, EXIT_CODE.USAGE, {
148
+ code: "duplicate_target_is_duplicate",
149
+ why: "Duplicate closure should point directly at the canonical item, not another duplicate.",
150
+ examples: [`pm close ${closingId} "Duplicate of ${target.duplicate_of.trim()}" --duplicate-of ${target.duplicate_of.trim()}`],
151
+ nextSteps: ["Use the canonical item referenced by duplicate_of as the --duplicate-of target."]
152
+ });
153
+ }
154
+ return target.id;
155
+ }
83
156
  async function findActiveChildIds(pmRoot, settings, parentId, statusRegistry) {
84
157
  const typeRegistry = resolveItemTypeRegistry(settings);
85
158
  const items = await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, void 0, settings.schema);
@@ -94,6 +167,7 @@ async function runClose(id, closeReasonText, options, global) {
94
167
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
95
168
  const author = toAuthor(options.author, settings.author_default);
96
169
  const closeReason = normalizeCloseReason(closeReasonText, settings.governance.require_close_reason);
170
+ const duplicateOf = await assertDuplicateTargetExists(pmRoot, settings, options.duplicateOf, id);
97
171
  const validateCloseMode = parseValidateCloseMode(options.validateClose) ?? settings.governance.close_validation_default;
98
172
  const activeChildIds = await findActiveChildIds(pmRoot, settings, id, statusRegistry);
99
173
  const result = await mutateItem({
@@ -114,6 +188,7 @@ async function runClose(id, closeReasonText, options, global) {
114
188
  { option: options.expectedResult, key: "expected_result" },
115
189
  { option: options.actualResult, key: "actual_result" }
116
190
  ];
191
+ const duplicateFallbackFields = [];
117
192
  for (const { option, key } of inlineCloseFields) {
118
193
  if (typeof option !== "string")
119
194
  continue;
@@ -122,6 +197,24 @@ async function runClose(id, closeReasonText, options, global) {
122
197
  continue;
123
198
  document.metadata[key] = trimmed;
124
199
  }
200
+ if (duplicateOf !== void 0) {
201
+ document.metadata.duplicate_of = duplicateOf;
202
+ const duplicateResolution = `Duplicate of ${duplicateOf}`;
203
+ const duplicateExpectedResult = `Canonical item ${duplicateOf} tracks the work.`;
204
+ const duplicateActualResult = `Closed as duplicate of ${duplicateOf}.`;
205
+ if (shouldApplyDuplicateFallback(document.metadata.resolution)) {
206
+ document.metadata.resolution = duplicateResolution;
207
+ duplicateFallbackFields.push("resolution");
208
+ }
209
+ if (shouldApplyDuplicateFallback(document.metadata.expected_result)) {
210
+ document.metadata.expected_result = duplicateExpectedResult;
211
+ duplicateFallbackFields.push("expected_result");
212
+ }
213
+ if (shouldApplyDuplicateFallback(document.metadata.actual_result)) {
214
+ document.metadata.actual_result = duplicateActualResult;
215
+ duplicateFallbackFields.push("actual_result");
216
+ }
217
+ }
125
218
  if (validateCloseMode !== "off") {
126
219
  const missingFields = findMissingCloseValidationFields(document.metadata);
127
220
  if (missingFields.length > 0) {
@@ -153,6 +246,18 @@ async function runClose(id, closeReasonText, options, global) {
153
246
  changedFields.push(key);
154
247
  }
155
248
  }
249
+ if (duplicateOf !== void 0) {
250
+ changedFields.push("duplicate_of");
251
+ if (duplicateFallbackFields.includes("resolution") && !changedFields.includes("resolution")) {
252
+ changedFields.push("resolution");
253
+ }
254
+ if (duplicateFallbackFields.includes("expected_result") && !changedFields.includes("expected_result")) {
255
+ changedFields.push("expected_result");
256
+ }
257
+ if (duplicateFallbackFields.includes("actual_result") && !changedFields.includes("actual_result")) {
258
+ changedFields.push("actual_result");
259
+ }
260
+ }
156
261
  if (document.metadata.assignee !== void 0) {
157
262
  delete document.metadata.assignee;
158
263
  changedFields.push("assignee");
@@ -198,6 +303,6 @@ async function runClose(id, closeReasonText, options, global) {
198
303
  export {
199
304
  runClose
200
305
  };
201
- //# sourceMappingURL=chunk-D7WK2PKB.js.map
306
+ //# sourceMappingURL=chunk-KMMUDSSB.js.map
202
307
 
203
- //# debugId=d0a74b9e-6c92-5e49-8668-68c79b7185d9
308
+ //# debugId=526cafb3-a405-5c17-a09e-8e3587ec1f24
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../cli/commands/close.ts"],"sourcesContent":["import { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { toItemRecord } from \"../../core/item/item-record.js\";\nimport { isTerminalStatus } from \"../../core/item/status.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry, type RuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { listAllFrontMatterLight, 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 type { ItemFrontMatter } from \"../../types/index.js\";\n\nexport interface CloseCommandOptions {\n author?: string;\n message?: string;\n validateClose?: string;\n force?: boolean;\n // pm-fl0c #11 (2026-05-28): allow setting the three closure validation\n // fields inline on `pm close` so agents do not have to issue a prior\n // `pm update` just to satisfy --validate-close warn|strict. These map 1:1\n // to ItemFrontMatter.{resolution,expected_result,actual_result}.\n resolution?: string;\n expectedResult?: string;\n actualResult?: string;\n duplicateOf?: string;\n}\n\nexport interface CloseResult {\n item: Record<string, unknown>;\n changed_fields: string[];\n warnings: string[];\n}\n\nfunction toAuthor(candidate: string | undefined, defaultAuthor: string): string {\n const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;\n const trimmed = resolved.trim();\n return trimmed || \"unknown\";\n}\n\nfunction normalizeCloseReason(reasonText: string | undefined, required: boolean): string | undefined {\n const reason = (reasonText ?? \"\").trim();\n if (reason.length > 0) {\n return reason;\n }\n if (required) {\n throw new PmCliError(\n \"Close reason text is required because governance.require_close_reason is enabled\",\n EXIT_CODE.USAGE,\n {\n code: \"close_reason_required\",\n required: \"Provide a one-line closing summary as the positional text or via --reason.\",\n why: \"governance.require_close_reason is enabled, so every close must record why the item is done.\",\n examples: [\n 'pm close <id> \"Done: <what changed and why>\"',\n 'pm close <id> --reason \"<closing summary>\"',\n ],\n nextSteps: [\n \"Re-run the close with a closing summary.\",\n \"To stop requiring reasons, run: pm config set governance-require-close-reason --policy disabled\",\n ],\n },\n );\n }\n return undefined;\n}\n\ntype ValidateCloseMode = \"off\" | \"warn\" | \"strict\";\n\nconst CLOSE_VALIDATION_FIELDS: Array<{ key: keyof Pick<ItemFrontMatter, \"resolution\" | \"expected_result\" | \"actual_result\">; label: string }> = [\n { key: \"resolution\", label: \"resolution\" },\n { key: \"expected_result\", label: \"expected_result\" },\n { key: \"actual_result\", label: \"actual_result\" },\n];\n\nfunction parseValidateCloseMode(raw: string | undefined): ValidateCloseMode | undefined {\n if (raw === undefined) {\n return undefined;\n }\n const normalized = raw.trim().toLowerCase();\n if (normalized.length === 0 || normalized === \"warn\") {\n return \"warn\";\n }\n if (normalized === \"off\" || normalized === \"none\" || normalized === \"disabled\") {\n return \"off\";\n }\n if (normalized === \"strict\") {\n return \"strict\";\n }\n throw new PmCliError(`Invalid --validate-close mode \"${raw}\" (expected \"off\", \"warn\", or \"strict\")`, EXIT_CODE.USAGE);\n}\n\nfunction findMissingCloseValidationFields(frontMatter: ItemFrontMatter): string[] {\n const missing: string[] = [];\n for (const field of CLOSE_VALIDATION_FIELDS) {\n const rawValue = frontMatter[field.key];\n if (typeof rawValue !== \"string\" || rawValue.trim().length === 0) {\n missing.push(field.label);\n }\n }\n return missing;\n}\n\nasync function duplicateChainReferencesClosingItem(\n loadItemById: (id: string) => Promise<ItemFrontMatter | null>,\n initialDuplicateOf: unknown,\n closingId: string,\n): Promise<boolean> {\n const visited = new Set<string>();\n let current = initialDuplicateOf;\n while (typeof current === \"string\" && current.trim().length > 0) {\n const currentId = current.trim();\n if (currentId === closingId) {\n return true;\n }\n if (visited.has(currentId)) {\n return false;\n }\n visited.add(currentId);\n current = (await loadItemById(currentId))?.duplicate_of;\n }\n return false;\n}\n\nfunction shouldApplyDuplicateFallback(value: unknown): boolean {\n return typeof value !== \"string\" || value.trim().length === 0;\n}\n\nasync function assertDuplicateTargetExists(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n duplicateOf: string | undefined,\n closingId: string,\n): Promise<string | undefined> {\n const rawTarget = duplicateOf?.trim();\n if (!rawTarget) {\n return undefined;\n }\n if (rawTarget === closingId) {\n throw new PmCliError(\"An item cannot be closed as a duplicate of itself.\", EXIT_CODE.USAGE, {\n code: \"duplicate_target_self\",\n why: \"--duplicate-of must identify the canonical item that should remain open or already represent the work.\",\n });\n }\n const typeRegistry = resolveItemTypeRegistry(settings);\n const itemCache = new Map<string, ItemFrontMatter | null>();\n const loadItemById = async (id: string): Promise<ItemFrontMatter | null> => {\n if (itemCache.has(id)) {\n return itemCache.get(id) ?? null;\n }\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);\n if (!located) {\n itemCache.set(id, null);\n return null;\n }\n const { document } = await readLocatedItem(located, { schema: settings.schema });\n itemCache.set(id, document.metadata);\n return document.metadata;\n };\n const target = await loadItemById(rawTarget);\n if (!target) {\n throw new PmCliError(`Duplicate target \"${rawTarget}\" was not found. Create or locate the canonical item first.`, EXIT_CODE.USAGE, {\n code: \"duplicate_target_missing\",\n why: \"Duplicate closure should point at a real canonical pm item so future dedupe and changelog tooling can trace the relationship.\",\n examples: [`pm close ${closingId} \"Duplicate of ${rawTarget}\" --duplicate-of ${rawTarget}`],\n nextSteps: [\"Run pm search/list to find the canonical item, then retry with --duplicate-of <id>.\"],\n });\n }\n if (await duplicateChainReferencesClosingItem(loadItemById, target.duplicate_of, closingId)) {\n throw new PmCliError(`Circular duplicate reference detected. Target \"${rawTarget}\" points back to \"${closingId}\".`, EXIT_CODE.USAGE, {\n code: \"duplicate_target_circular\",\n why: \"Circular duplicate relationships create loops for dedupe and status propagation tooling.\",\n nextSteps: [\"Choose the existing canonical item, or clear the target duplicate_of metadata before closing this item as a duplicate.\"],\n });\n }\n if (typeof target.duplicate_of === \"string\" && target.duplicate_of.trim().length > 0) {\n throw new PmCliError(`Duplicate target \"${rawTarget}\" is already marked as a duplicate of \"${target.duplicate_of.trim()}\".`, EXIT_CODE.USAGE, {\n code: \"duplicate_target_is_duplicate\",\n why: \"Duplicate closure should point directly at the canonical item, not another duplicate.\",\n examples: [`pm close ${closingId} \"Duplicate of ${target.duplicate_of.trim()}\" --duplicate-of ${target.duplicate_of.trim()}`],\n nextSteps: [\"Use the canonical item referenced by duplicate_of as the --duplicate-of target.\"],\n });\n }\n return target.id;\n}\n\nasync function findActiveChildIds(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n parentId: string,\n statusRegistry: RuntimeStatusRegistry,\n): Promise<string[]> {\n const typeRegistry = resolveItemTypeRegistry(settings);\n const items = await listAllFrontMatterLight(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n return items\n .filter((item) => item.parent === parentId && !isTerminalStatus(item.status, statusRegistry))\n .map((item) => item.id)\n .sort((left, right) => left.localeCompare(right));\n}\n\nexport async function runClose(\n id: string,\n closeReasonText: string | undefined,\n options: CloseCommandOptions,\n global: GlobalOptions,\n): Promise<CloseResult> {\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 statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const author = toAuthor(options.author, settings.author_default);\n const closeReason = normalizeCloseReason(closeReasonText, settings.governance.require_close_reason);\n const duplicateOf = await assertDuplicateTargetExists(pmRoot, settings, options.duplicateOf, id);\n const validateCloseMode = parseValidateCloseMode(options.validateClose) ?? settings.governance.close_validation_default;\n // C3 (pm-fu5d): scan for active children even under minimal governance so\n // closing a parent is never silently orphaning — off mode emits an\n // informational note instead of the warn/strict validation warning.\n const activeChildIds = await findActiveChildIds(pmRoot, settings, id, statusRegistry);\n\n const result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: \"close\",\n author,\n message: options.message,\n force: options.force,\n mutate(document) {\n if (isTerminalStatus(document.metadata.status, statusRegistry) && !options.force) {\n throw new PmCliError(`Item ${document.metadata.id} is already terminal; use --force to close again.`, EXIT_CODE.CONFLICT);\n }\n const mutationWarnings: string[] = [];\n // pm-fl0c #11: apply inline closure fields BEFORE the validation pass so\n // a single `pm close <id> \"reason\" --resolution \"...\"` call satisfies\n // strict validation without a prior pm update. Only meaningful trimmed\n // text writes; an empty/whitespace value is a no-op rather than a clear.\n const inlineCloseFields: Array<{ option: string | undefined; key: \"resolution\" | \"expected_result\" | \"actual_result\" }> = [\n { option: options.resolution, key: \"resolution\" },\n { option: options.expectedResult, key: \"expected_result\" },\n { option: options.actualResult, key: \"actual_result\" },\n ];\n const duplicateFallbackFields: Array<\"resolution\" | \"expected_result\" | \"actual_result\"> = [];\n for (const { option, key } of inlineCloseFields) {\n if (typeof option !== \"string\") continue;\n const trimmed = option.trim();\n if (trimmed.length === 0) continue;\n document.metadata[key] = trimmed;\n }\n if (duplicateOf !== undefined) {\n document.metadata.duplicate_of = duplicateOf;\n const duplicateResolution = `Duplicate of ${duplicateOf}`;\n const duplicateExpectedResult = `Canonical item ${duplicateOf} tracks the work.`;\n const duplicateActualResult = `Closed as duplicate of ${duplicateOf}.`;\n if (shouldApplyDuplicateFallback(document.metadata.resolution)) {\n document.metadata.resolution = duplicateResolution;\n duplicateFallbackFields.push(\"resolution\");\n }\n if (shouldApplyDuplicateFallback(document.metadata.expected_result)) {\n document.metadata.expected_result = duplicateExpectedResult;\n duplicateFallbackFields.push(\"expected_result\");\n }\n if (shouldApplyDuplicateFallback(document.metadata.actual_result)) {\n document.metadata.actual_result = duplicateActualResult;\n duplicateFallbackFields.push(\"actual_result\");\n }\n }\n if (validateCloseMode !== \"off\") {\n const missingFields = findMissingCloseValidationFields(document.metadata);\n if (missingFields.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${document.metadata.id}: missing ${missingFields.join(\", \")}. Populate fields or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n mutationWarnings.push(`close_validation_missing_fields:${document.metadata.id}:${missingFields.join(\",\")}`);\n }\n if (activeChildIds.length > 0) {\n if (validateCloseMode === \"strict\") {\n throw new PmCliError(\n `Cannot close item ${document.metadata.id}: active child items remain open (${activeChildIds.join(\", \")}). Close, cancel, or re-parent them first, or use --validate-close warn.`,\n EXIT_CODE.USAGE,\n );\n }\n mutationWarnings.push(`close_validation_active_children:${document.metadata.id}:${activeChildIds.join(\",\")}`);\n }\n } else if (activeChildIds.length > 0) {\n // C3: minimal governance (validate-close off) should still tell the\n // agent it just closed a parent with open children, without blocking.\n mutationWarnings.push(`closed_with_active_children:${document.metadata.id}:${activeChildIds.join(\",\")}`);\n }\n\n document.metadata.status = statusRegistry.close_status;\n const changedFields = [\"status\"];\n if (closeReason !== undefined) {\n document.metadata.close_reason = closeReason;\n changedFields.push(\"close_reason\");\n } else if (document.metadata.close_reason !== undefined) {\n delete document.metadata.close_reason;\n changedFields.push(\"close_reason\");\n }\n for (const { option, key } of inlineCloseFields) {\n if (typeof option === \"string\" && option.trim().length > 0) {\n changedFields.push(key);\n }\n }\n if (duplicateOf !== undefined) {\n changedFields.push(\"duplicate_of\");\n if (duplicateFallbackFields.includes(\"resolution\") && !changedFields.includes(\"resolution\")) {\n changedFields.push(\"resolution\");\n }\n if (duplicateFallbackFields.includes(\"expected_result\") && !changedFields.includes(\"expected_result\")) {\n changedFields.push(\"expected_result\");\n }\n if (duplicateFallbackFields.includes(\"actual_result\") && !changedFields.includes(\"actual_result\")) {\n changedFields.push(\"actual_result\");\n }\n }\n if (document.metadata.assignee !== undefined) {\n delete document.metadata.assignee;\n changedFields.push(\"assignee\");\n }\n\n // C4 (pm-fu5d): a terminal item is no longer blocked. Clear every active\n // blocker signal independently — scalar blocked_by, blocked_reason, and the\n // blocked_by dependency edges (kept consistent with the kyd6 invariant) —\n // even if only some are present (e.g. an orphaned edge or a stale\n // blocked_reason left by manual edits), so closed work stops surfacing in\n // blockers views, and annotate the cleanup.\n const previousBlockedBy =\n typeof document.metadata.blocked_by === \"string\" ? document.metadata.blocked_by.trim() : \"\";\n const existingDeps = document.metadata.dependencies ?? [];\n const blockedByEdge = existingDeps.find((dep) => dep.kind === \"blocked_by\");\n const hadBlockedReason = document.metadata.blocked_reason !== undefined;\n if (previousBlockedBy.length > 0 || blockedByEdge !== undefined || hadBlockedReason) {\n if (previousBlockedBy.length > 0) {\n delete document.metadata.blocked_by;\n changedFields.push(\"blocked_by\");\n }\n if (hadBlockedReason) {\n delete document.metadata.blocked_reason;\n changedFields.push(\"blocked_reason\");\n }\n if (blockedByEdge !== undefined) {\n const remainingDeps = existingDeps.filter((dep) => dep.kind !== \"blocked_by\");\n if (remainingDeps.length > 0) {\n document.metadata.dependencies = remainingDeps;\n } else {\n delete document.metadata.dependencies;\n }\n changedFields.push(\"dependencies\");\n }\n const reportedBlocker = previousBlockedBy || blockedByEdge?.id || \"unknown\";\n mutationWarnings.push(`closed_cleared_blocked_by:${document.metadata.id}:${reportedBlocker}`);\n }\n\n return {\n changedFields,\n ...(mutationWarnings.length > 0 ? { warnings: mutationWarnings } : {}),\n };\n },\n });\n\n return {\n item: toItemRecord(result.item),\n changed_fields: result.changedFields,\n warnings: result.warnings,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,SAAS,WAA+B,eAAqB;AACpE,QAAM,WAAW,aAAa,QAAQ,IAAI,aAAa;AACvD,QAAM,UAAU,SAAS,KAAI;AAC7B,SAAO,WAAW;AACpB;AAEA,SAAS,qBAAqB,YAAgC,UAAiB;AAC7E,QAAM,UAAU,cAAc,IAAI,KAAI;AACtC,MAAI,OAAO,SAAS,GAAG;AACrB,WAAO;EACT;AACA,MAAI,UAAU;AACZ,UAAM,IAAI,WACR,oFACA,UAAU,OACV;MACE,MAAM;MACN,UAAU;MACV,KAAK;MACL,UAAU;QACR;QACA;;MAEF,WAAW;QACT;QACA;;KAEH;EAEL;AACA,SAAO;AACT;AAIA,IAAM,0BAA0I;EAC9I,EAAE,KAAK,cAAc,OAAO,aAAY;EACxC,EAAE,KAAK,mBAAmB,OAAO,kBAAiB;EAClD,EAAE,KAAK,iBAAiB,OAAO,gBAAe;;AAGhD,SAAS,uBAAuB,KAAuB;AACrD,MAAI,QAAQ,QAAW;AACrB,WAAO;EACT;AACA,QAAM,aAAa,IAAI,KAAI,EAAG,YAAW;AACzC,MAAI,WAAW,WAAW,KAAK,eAAe,QAAQ;AACpD,WAAO;EACT;AACA,MAAI,eAAe,SAAS,eAAe,UAAU,eAAe,YAAY;AAC9E,WAAO;EACT;AACA,MAAI,eAAe,UAAU;AAC3B,WAAO;EACT;AACA,QAAM,IAAI,WAAW,kCAA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