@unbrained/pm-cli 2026.6.11 → 2026.6.13

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 (447) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +1 -1
  3. package/dist/cli/commands/completion.js +20 -8
  4. package/dist/cli/commands/completion.js.map +1 -1
  5. package/dist/cli/commands/create.js +13 -3
  6. package/dist/cli/commands/create.js.map +1 -1
  7. package/dist/cli/commands/docs.d.ts +2 -0
  8. package/dist/cli/commands/docs.js +2 -2
  9. package/dist/cli/commands/docs.js.map +1 -1
  10. package/dist/cli/commands/files.d.ts +2 -0
  11. package/dist/cli/commands/files.js +2 -2
  12. package/dist/cli/commands/files.js.map +1 -1
  13. package/dist/cli/commands/health.d.ts +1 -1
  14. package/dist/cli/commands/health.js +77 -2
  15. package/dist/cli/commands/health.js.map +1 -1
  16. package/dist/cli/commands/history-repair.d.ts +36 -0
  17. package/dist/cli/commands/history-repair.js +68 -3
  18. package/dist/cli/commands/history-repair.js.map +1 -1
  19. package/dist/cli/commands/index.d.ts +1 -1
  20. package/dist/cli/commands/index.js +3 -3
  21. package/dist/cli/commands/index.js.map +1 -1
  22. package/dist/cli/commands/linked-artifacts.d.ts +18 -0
  23. package/dist/cli/commands/linked-artifacts.js +26 -3
  24. package/dist/cli/commands/linked-artifacts.js.map +1 -1
  25. package/dist/cli/commands/plan.d.ts +6 -0
  26. package/dist/cli/commands/plan.js +93 -32
  27. package/dist/cli/commands/plan.js.map +1 -1
  28. package/dist/cli/commands/validate.d.ts +20 -0
  29. package/dist/cli/commands/validate.js +292 -28
  30. package/dist/cli/commands/validate.js.map +1 -1
  31. package/dist/cli/error-guidance.js +29 -2
  32. package/dist/cli/error-guidance.js.map +1 -1
  33. package/dist/cli/help-content.js +7 -3
  34. package/dist/cli/help-content.js.map +1 -1
  35. package/dist/cli/main.js +13 -3
  36. package/dist/cli/main.js.map +1 -1
  37. package/dist/cli/register-mutation.js +47 -16
  38. package/dist/cli/register-mutation.js.map +1 -1
  39. package/dist/cli/register-operations.js +10 -2
  40. package/dist/cli/register-operations.js.map +1 -1
  41. package/dist/cli/register-setup.js +16 -16
  42. package/dist/cli/register-setup.js.map +1 -1
  43. package/dist/cli-bundle/chunks/{activity-XADJOG6G.js → activity-PPO7QWJF.js} +11 -11
  44. package/dist/cli-bundle/chunks/activity-XIOTGZMU.js +16 -0
  45. package/dist/cli-bundle/chunks/{aggregate-6OTS3AOO.js → aggregate-IRHJWEKG.js} +10 -10
  46. package/dist/cli-bundle/chunks/{aggregate-OD36DJU5.js → aggregate-XEBW22UQ.js} +10 -10
  47. package/dist/cli-bundle/chunks/{append-JYWO4P7W.js → append-N2AWXKZC.js} +8 -8
  48. package/dist/cli-bundle/chunks/{append-KG55G7S3.js → append-NL67JNJU.js} +8 -8
  49. package/dist/cli-bundle/chunks/{chunk-IH4MBKK7.js → chunk-2ANTZBYF.js} +5 -5
  50. package/dist/cli-bundle/chunks/{chunk-F75JSIOZ.js → chunk-2J2AH4V5.js} +6 -6
  51. package/dist/cli-bundle/chunks/{chunk-CCX4RSYZ.js → chunk-32XSW44C.js} +2 -2
  52. package/dist/cli-bundle/chunks/{chunk-DY6C42S6.js → chunk-36BCSMKP.js} +9 -9
  53. package/dist/cli-bundle/chunks/{chunk-XUC4C4PT.js → chunk-3CQPVBK3.js} +3 -3
  54. package/dist/cli-bundle/chunks/{chunk-SXKNJPQ7.js → chunk-3FMQMHAG.js} +3 -3
  55. package/dist/cli-bundle/chunks/{chunk-I7NYDZDV.js → chunk-3VULHQNS.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-HHHJ2GI3.js → chunk-4FHLNNW7.js} +8 -8
  57. package/dist/cli-bundle/chunks/{chunk-RXAP6JL5.js → chunk-4JHJ7YG2.js} +9 -9
  58. package/dist/cli-bundle/chunks/{chunk-P5BJOMBB.js → chunk-4TPFXE2R.js} +9 -9
  59. package/dist/cli-bundle/chunks/{chunk-XJDGS74Y.js → chunk-4ZKKZMLH.js} +8 -8
  60. package/dist/cli-bundle/chunks/{chunk-XJDGS74Y.js.map → chunk-4ZKKZMLH.js.map} +1 -1
  61. package/dist/cli-bundle/chunks/{chunk-3SLOMKCJ.js → chunk-5HSAHRYA.js} +12 -12
  62. package/dist/cli-bundle/chunks/{chunk-ZLMIWZUG.js → chunk-5LMF75Q7.js} +2 -2
  63. package/dist/cli-bundle/chunks/{chunk-TK5VZFHY.js → chunk-6TBR5AZ2.js} +7 -7
  64. package/dist/cli-bundle/chunks/{chunk-ATEES5SX.js → chunk-6ZFTM65G.js} +2 -2
  65. package/dist/cli-bundle/chunks/{chunk-P2PSODAQ.js → chunk-7CRFV6JR.js} +111 -10
  66. package/dist/cli-bundle/chunks/chunk-7CRFV6JR.js.map +7 -0
  67. package/dist/cli-bundle/chunks/{chunk-VFUZV5EB.js → chunk-7SM7VA5I.js} +5 -5
  68. package/dist/cli-bundle/chunks/{chunk-GKIZW7SM.js → chunk-AAUYXSFF.js} +3 -3
  69. package/dist/cli-bundle/chunks/{chunk-FXRU333M.js → chunk-AGG32LKL.js} +111 -10
  70. package/dist/cli-bundle/chunks/chunk-AGG32LKL.js.map +1 -0
  71. package/dist/cli-bundle/chunks/{chunk-OASDW5UI.js → chunk-AUDDXKNX.js} +7 -7
  72. package/dist/cli-bundle/chunks/{chunk-ZMW77VWV.js → chunk-BVL5KGVA.js} +9 -9
  73. package/dist/cli-bundle/chunks/{chunk-4JCSYR6F.js → chunk-C24PWDFG.js} +3 -3
  74. package/dist/cli-bundle/chunks/{chunk-4HFU4UO2.js → chunk-CEGUH2E5.js} +3 -3
  75. package/dist/cli-bundle/chunks/{chunk-Y3YKK7CY.js → chunk-DWG4FHPY.js} +2 -2
  76. package/dist/cli-bundle/chunks/chunk-EKS6O2IR.js +217 -0
  77. package/dist/cli-bundle/chunks/chunk-EKS6O2IR.js.map +1 -0
  78. package/dist/cli-bundle/chunks/{chunk-YW6Q3RYZ.js → chunk-GFBEXDCQ.js} +7 -7
  79. package/dist/cli-bundle/chunks/{chunk-XMBI6TNW.js → chunk-GOO4UXBI.js} +4 -4
  80. package/dist/cli-bundle/chunks/{chunk-IGVJRZ6H.js → chunk-GRZGHGRG.js} +8 -8
  81. package/dist/cli-bundle/chunks/{chunk-E5DUIJA4.js → chunk-HLEGAQXT.js} +20 -7
  82. package/dist/cli-bundle/chunks/chunk-HLEGAQXT.js.map +7 -0
  83. package/dist/cli-bundle/chunks/chunk-HWHONML5.js +190 -0
  84. package/dist/cli-bundle/chunks/chunk-HWHONML5.js.map +7 -0
  85. package/dist/cli-bundle/chunks/{chunk-TNAP7EJX.js → chunk-HZOX5BYD.js} +2 -2
  86. package/dist/cli-bundle/chunks/{chunk-VSRZRLG3.js → chunk-IIOIBAQW.js} +3 -3
  87. package/dist/cli-bundle/chunks/{chunk-IUKD4W6Z.js → chunk-IXVSSHGV.js} +2 -2
  88. package/dist/cli-bundle/chunks/{chunk-WUNFKP7M.js → chunk-IZHCCG4S.js} +2 -2
  89. package/dist/cli-bundle/chunks/{chunk-VAOUX6TK.js → chunk-JCTZV7TO.js} +2 -2
  90. package/dist/cli-bundle/chunks/{chunk-ZYNJNPYD.js → chunk-JE5IZXDS.js} +4 -4
  91. package/dist/cli-bundle/chunks/{chunk-QNJSITCX.js → chunk-JW7D6437.js} +7 -7
  92. package/dist/cli-bundle/chunks/{chunk-B65UUCGQ.js → chunk-JWXTOYBI.js} +5 -5
  93. package/dist/cli-bundle/chunks/{chunk-7RIT3OCD.js → chunk-KHGTYCJ6.js} +12 -12
  94. package/dist/cli-bundle/chunks/{chunk-HI7STVF2.js → chunk-L6YQONLM.js} +11 -27
  95. package/dist/cli-bundle/chunks/chunk-L6YQONLM.js.map +1 -0
  96. package/dist/cli-bundle/chunks/{chunk-FY4SPXSC.js → chunk-LFW5NQUP.js} +59 -86
  97. package/dist/cli-bundle/chunks/chunk-LFW5NQUP.js.map +7 -0
  98. package/dist/cli-bundle/chunks/{chunk-VPEAS7PS.js → chunk-LGOXXQUW.js} +2 -2
  99. package/dist/cli-bundle/chunks/{chunk-I2IJY2NL.js → chunk-LOAR5TKX.js} +2 -2
  100. package/dist/cli-bundle/chunks/{chunk-S26FESD4.js → chunk-LSSTKL3Y.js} +3 -3
  101. package/dist/cli-bundle/chunks/{chunk-CW6E4NAT.js → chunk-LYNQ3NGI.js} +8 -8
  102. package/dist/cli-bundle/chunks/{chunk-4YFAGDRH.js → chunk-M3SI2REU.js} +8 -8
  103. package/dist/cli-bundle/chunks/{chunk-73ZPG2I3.js → chunk-MACCNKSZ.js} +3 -3
  104. package/dist/cli-bundle/chunks/{chunk-IKOH24GZ.js → chunk-MGAQ6KZG.js} +20 -15
  105. package/dist/cli-bundle/chunks/{chunk-IKOH24GZ.js.map → chunk-MGAQ6KZG.js.map} +2 -2
  106. package/dist/cli-bundle/chunks/chunk-NAWVUHXH.js +220 -0
  107. package/dist/cli-bundle/chunks/chunk-NAWVUHXH.js.map +7 -0
  108. package/dist/cli-bundle/chunks/{chunk-P5U5EOMA.js → chunk-NN6RKGFW.js} +3 -3
  109. package/dist/cli-bundle/chunks/{chunk-GWZSYR6X.js → chunk-O3YCJOVX.js} +2 -2
  110. package/dist/cli-bundle/chunks/{chunk-7UGSRQCL.js → chunk-PEH7SZD2.js} +7 -7
  111. package/dist/cli-bundle/chunks/{chunk-7UGSRQCL.js.map → chunk-PEH7SZD2.js.map} +2 -2
  112. package/dist/cli-bundle/chunks/{chunk-UOO6BYIA.js → chunk-PNYAAB4S.js} +21 -188
  113. package/dist/cli-bundle/chunks/chunk-PNYAAB4S.js.map +1 -0
  114. package/dist/cli-bundle/chunks/{chunk-UUWGCWBU.js → chunk-QQG4HEX7.js} +3 -3
  115. package/dist/cli-bundle/chunks/{chunk-XTKJSVWH.js → chunk-QU3OPNVV.js} +2 -2
  116. package/dist/cli-bundle/chunks/{chunk-LCSCXBGT.js → chunk-R4VWYWRN.js} +19 -193
  117. package/dist/cli-bundle/chunks/chunk-R4VWYWRN.js.map +7 -0
  118. package/dist/cli-bundle/chunks/{chunk-PSD7F7DX.js → chunk-RFR2YQGO.js} +21 -8
  119. package/dist/cli-bundle/chunks/chunk-RFR2YQGO.js.map +1 -0
  120. package/dist/cli-bundle/chunks/{chunk-EWFY7SLA.js → chunk-RHYBR6G7.js} +8 -8
  121. package/dist/cli-bundle/chunks/{chunk-A6LXQFO7.js → chunk-S2CDTRJ6.js} +52 -79
  122. package/dist/cli-bundle/chunks/chunk-S2CDTRJ6.js.map +1 -0
  123. package/dist/cli-bundle/chunks/{chunk-J3GD64J2.js → chunk-SGMGMCIF.js} +21 -16
  124. package/dist/cli-bundle/chunks/{chunk-J3GD64J2.js.map → chunk-SGMGMCIF.js.map} +1 -1
  125. package/dist/cli-bundle/chunks/{chunk-S2ZLDYGS.js → chunk-SOHXUA2Q.js} +4 -4
  126. package/dist/cli-bundle/chunks/{chunk-KWAXVAXX.js → chunk-SQDKAEKG.js} +4 -4
  127. package/dist/cli-bundle/chunks/{chunk-7IYFN5R7.js → chunk-TOX7YQ7X.js} +3 -3
  128. package/dist/cli-bundle/chunks/{chunk-FDH2X65L.js → chunk-TSXWFN3L.js} +2 -2
  129. package/dist/cli-bundle/chunks/{chunk-OLKBSY4N.js → chunk-UCVJP4JL.js} +2 -2
  130. package/dist/cli-bundle/chunks/{chunk-AVGHVVF7.js → chunk-V4KP3TCN.js} +3 -3
  131. package/dist/cli-bundle/chunks/{chunk-QKW5D45B.js → chunk-VNC2HBL4.js} +5 -5
  132. package/dist/cli-bundle/chunks/{chunk-QJMGRZO2.js → chunk-VYZNX4C5.js} +3 -3
  133. package/dist/cli-bundle/chunks/{chunk-5SCT2JCT.js → chunk-W6KNFAMZ.js} +2 -2
  134. package/dist/cli-bundle/chunks/{chunk-I53JBTJW.js → chunk-WLH7X4RN.js} +6 -6
  135. package/dist/cli-bundle/chunks/{chunk-ESANVZF4.js → chunk-XOYHMHFF.js} +3 -3
  136. package/dist/cli-bundle/chunks/{chunk-HGLC63AU.js → chunk-XWDZVCBJ.js} +8 -8
  137. package/dist/cli-bundle/chunks/{chunk-3KLPFWZ4.js → chunk-XXLMJDUB.js} +10 -26
  138. package/dist/cli-bundle/chunks/chunk-XXLMJDUB.js.map +7 -0
  139. package/dist/cli-bundle/chunks/chunk-Z647PYLD.js +187 -0
  140. package/dist/cli-bundle/chunks/chunk-Z647PYLD.js.map +1 -0
  141. package/dist/cli-bundle/chunks/{claim-MJ7DZFC3.js → claim-HE6KEGJW.js} +10 -10
  142. package/dist/cli-bundle/chunks/{claim-2RDYMCTP.js → claim-QJOQBH7J.js} +10 -10
  143. package/dist/cli-bundle/chunks/{close-XLEKIQSW.js → close-SPUFW5QR.js} +8 -8
  144. package/dist/cli-bundle/chunks/close-WOG5WTMZ.js +13 -0
  145. package/dist/cli-bundle/chunks/{close-many-AOD4HSAZ.js → close-many-GKAJX54X.js} +15 -15
  146. package/dist/cli-bundle/chunks/{close-many-XKAQY5CQ.js → close-many-GL6NRUU5.js} +15 -15
  147. package/dist/cli-bundle/chunks/{comments-RN5TG4ZN.js → comments-5FPT6L7N.js} +10 -10
  148. package/dist/cli-bundle/chunks/{comments-B4RWWDJT.js → comments-TOLOYWNI.js} +10 -10
  149. package/dist/cli-bundle/chunks/{config-3JXJ3XZ7.js → config-4MN45TIH.js} +8 -8
  150. package/dist/cli-bundle/chunks/{config-FZ4UDC4B.js → config-7N6D7YJE.js} +8 -8
  151. package/dist/cli-bundle/chunks/{context-QBPO3BFM.js → context-AQSLE7DZ.js} +13 -13
  152. package/dist/cli-bundle/chunks/{context-L36PIN35.js → context-U3PUJMVN.js} +13 -13
  153. package/dist/cli-bundle/chunks/{contracts-MIXBWJIB.js → contracts-H7KCQXLY.js} +4 -4
  154. package/dist/cli-bundle/chunks/{contracts-3NKWYKKU.js → contracts-ITSJXO3O.js} +4 -4
  155. package/dist/cli-bundle/chunks/{copy-ALU5WMHA.js → copy-C4W522JM.js} +7 -7
  156. package/dist/cli-bundle/chunks/{copy-FWIVTLBO.js → copy-EB3MUCSW.js} +7 -7
  157. package/dist/cli-bundle/chunks/{create-IFA26O2I.js → create-4EQNELMY.js} +13 -13
  158. package/dist/cli-bundle/chunks/create-NW3K7LVG.js +27 -0
  159. package/dist/cli-bundle/chunks/{delete-IYTIYAJS.js → delete-X5QLXIQX.js} +7 -7
  160. package/dist/cli-bundle/chunks/{delete-Y2SGJBGY.js → delete-ZLGUYIXU.js} +7 -7
  161. package/dist/cli-bundle/chunks/{deps-CZ4PTVXU.js → deps-GPB3LGWN.js} +7 -7
  162. package/dist/cli-bundle/chunks/{deps-6TSPOSGU.js → deps-HV2C2L46.js} +7 -7
  163. package/dist/cli-bundle/chunks/{docs-5WMBVQT2.js → docs-RJQPLROO.js} +11 -11
  164. package/dist/cli-bundle/chunks/docs-RJQPLROO.js.map +1 -0
  165. package/dist/cli-bundle/chunks/{docs-MB53UJAJ.js → docs-SRTLCQOL.js} +10 -10
  166. package/dist/cli-bundle/chunks/docs-SRTLCQOL.js.map +7 -0
  167. package/dist/cli-bundle/chunks/{extension-Q34OEWO5.js → extension-MM3TVWOO.js} +5 -5
  168. package/dist/cli-bundle/chunks/{extension-WH2FOIOZ.js → extension-WKPVPNCC.js} +5 -5
  169. package/dist/cli-bundle/chunks/{files-GVMNVLCB.js → files-LIFDKNCN.js} +10 -10
  170. package/dist/cli-bundle/chunks/files-LIFDKNCN.js.map +7 -0
  171. package/dist/cli-bundle/chunks/{files-DLB5LJEP.js → files-OIFN3DQX.js} +11 -11
  172. package/dist/cli-bundle/chunks/files-OIFN3DQX.js.map +1 -0
  173. package/dist/cli-bundle/chunks/{gc-4Z3IKHAZ.js → gc-DL6AVOX5.js} +12 -181
  174. package/dist/cli-bundle/chunks/gc-DL6AVOX5.js.map +7 -0
  175. package/dist/cli-bundle/chunks/{gc-2WEPW6D6.js → gc-NRFHLVFT.js} +14 -176
  176. package/dist/cli-bundle/chunks/gc-NRFHLVFT.js.map +1 -0
  177. package/dist/cli-bundle/chunks/{get-QARTE6BL.js → get-K7UULTQF.js} +11 -11
  178. package/dist/cli-bundle/chunks/{get-PCHS7RA6.js → get-SAB7CRBG.js} +11 -11
  179. package/dist/cli-bundle/chunks/{health-4ZYB3IYQ.js → health-NUVZYIEV.js} +83 -16
  180. package/dist/cli-bundle/chunks/health-NUVZYIEV.js.map +1 -0
  181. package/dist/cli-bundle/chunks/{health-YO5LRWN4.js → health-VJWH3ZFK.js} +82 -15
  182. package/dist/cli-bundle/chunks/health-VJWH3ZFK.js.map +7 -0
  183. package/dist/cli-bundle/chunks/{history-7WUAEWHW.js → history-GYFD2DJW.js} +10 -10
  184. package/dist/cli-bundle/chunks/history-IUVN4NTN.js +20 -0
  185. package/dist/cli-bundle/chunks/{history-compact-3EJ3L2O7.js → history-compact-SLL6ESXH.js} +11 -11
  186. package/dist/cli-bundle/chunks/{history-compact-LW27IPFK.js → history-compact-WQZQ6KXM.js} +11 -11
  187. package/dist/cli-bundle/chunks/history-redact-75KIIJUJ.js +19 -0
  188. package/dist/cli-bundle/chunks/{history-redact-G72A4EJ4.js → history-redact-SDTDR6WM.js} +11 -11
  189. package/dist/cli-bundle/chunks/{history-repair-RUGKD3YR.js → history-repair-BJCGM6Q3.js} +72 -14
  190. package/dist/cli-bundle/chunks/history-repair-BJCGM6Q3.js.map +1 -0
  191. package/dist/cli-bundle/chunks/{history-repair-KVPFJKOS.js → history-repair-UCYS55ZX.js} +71 -13
  192. package/dist/cli-bundle/chunks/history-repair-UCYS55ZX.js.map +7 -0
  193. package/dist/cli-bundle/chunks/init-JJFYRUKG.js +17 -0
  194. package/dist/cli-bundle/chunks/{init-S5WEGUJY.js → init-MXV57LKL.js} +9 -9
  195. package/dist/cli-bundle/chunks/{learnings-HQXSSKZ5.js → learnings-L6KTZGOT.js} +10 -10
  196. package/dist/cli-bundle/chunks/{learnings-XK3P4ZDR.js → learnings-QKJOKEAO.js} +10 -10
  197. package/dist/cli-bundle/chunks/{list-6CL3XFT6.js → list-GGVPXEV6.js} +10 -10
  198. package/dist/cli-bundle/chunks/list-VOQDQHA4.js +19 -0
  199. package/dist/cli-bundle/chunks/{notes-5T6P7C5V.js → notes-3NLK7WTZ.js} +10 -10
  200. package/dist/cli-bundle/chunks/{notes-U5FZCSBT.js → notes-HMCB7TK6.js} +10 -10
  201. package/dist/cli-bundle/chunks/{plan-VNUG3WZZ.js → plan-DWBYI5C6.js} +63 -23
  202. package/dist/cli-bundle/chunks/plan-DWBYI5C6.js.map +1 -0
  203. package/dist/cli-bundle/chunks/{plan-FQLMJRLZ.js → plan-NANUWH4T.js} +62 -22
  204. package/dist/cli-bundle/chunks/plan-NANUWH4T.js.map +7 -0
  205. package/dist/cli-bundle/chunks/{register-list-query-VHDXWEPP.js → register-list-query-PWQ5F2VI.js} +18 -18
  206. package/dist/cli-bundle/chunks/{register-list-query-NPE3ECJQ.js → register-list-query-SMMMLSWW.js} +18 -18
  207. package/dist/cli-bundle/chunks/{register-mutation-EAYNLGOS.js → register-mutation-QKFPTIZG.js} +64 -47
  208. package/dist/cli-bundle/chunks/{register-mutation-EAYNLGOS.js.map → register-mutation-QKFPTIZG.js.map} +2 -2
  209. package/dist/cli-bundle/chunks/{register-mutation-DG53FCBV.js → register-mutation-ZYJQ4DVP.js} +65 -48
  210. package/dist/cli-bundle/chunks/{register-mutation-DG53FCBV.js.map → register-mutation-ZYJQ4DVP.js.map} +1 -1
  211. package/dist/cli-bundle/chunks/{register-operations-FWFE64JG.js → register-operations-2FMZ6WEF.js} +37 -33
  212. package/dist/cli-bundle/chunks/{register-operations-FWFE64JG.js.map → register-operations-2FMZ6WEF.js.map} +2 -2
  213. package/dist/cli-bundle/chunks/{register-operations-AM6KTWB6.js → register-operations-BAFQURZG.js} +38 -34
  214. package/dist/cli-bundle/chunks/register-operations-BAFQURZG.js.map +1 -0
  215. package/dist/cli-bundle/chunks/{register-setup-G4QYI3RX.js → register-setup-DQEIKBIP.js} +30 -30
  216. package/dist/cli-bundle/chunks/register-setup-DQEIKBIP.js.map +7 -0
  217. package/dist/cli-bundle/chunks/{register-setup-IKX5524L.js → register-setup-QN2XV7UL.js} +31 -31
  218. package/dist/cli-bundle/chunks/register-setup-QN2XV7UL.js.map +1 -0
  219. package/dist/cli-bundle/chunks/restore-DRBNXJJH.js +17 -0
  220. package/dist/cli-bundle/chunks/{restore-M6AFHMV4.js → restore-FJQWXMPY.js} +11 -11
  221. package/dist/cli-bundle/chunks/{schema-AINZ2IMM.js → schema-RNVJ55V2.js} +8 -8
  222. package/dist/cli-bundle/chunks/{schema-76HDZJCC.js → schema-ZZ7ZDM2X.js} +8 -8
  223. package/dist/cli-bundle/chunks/{search-JMLFQEPJ.js → search-BJ457C2A.js} +10 -10
  224. package/dist/cli-bundle/chunks/{search-NL3TSCYB.js → search-FQDZXX7P.js} +10 -10
  225. package/dist/cli-bundle/chunks/{stats-UBD56TGK.js → stats-CUG3ZHOI.js} +7 -7
  226. package/dist/cli-bundle/chunks/{stats-BKXCBIGT.js → stats-DUQWCVOS.js} +7 -7
  227. package/dist/cli-bundle/chunks/{telemetry-ZJXK3H7X.js → telemetry-33MRGX4Z.js} +4 -4
  228. package/dist/cli-bundle/chunks/{telemetry-N454RHG5.js → telemetry-RK2VX75A.js} +4 -4
  229. package/dist/cli-bundle/chunks/test-SDMYEQHH.js +32 -0
  230. package/dist/cli-bundle/chunks/{test-BQAKIXAT.js → test-Y3CTFMEC.js} +14 -14
  231. package/dist/cli-bundle/chunks/{test-all-7LV3I6S5.js → test-all-ANYQ33O2.js} +14 -14
  232. package/dist/cli-bundle/chunks/{test-all-TDYCCBA4.js → test-all-ARSMX33Q.js} +14 -14
  233. package/dist/cli-bundle/chunks/{test-runs-E64M6XS3.js → test-runs-5URSD34O.js} +5 -5
  234. package/dist/cli-bundle/chunks/{test-runs-LXZLULCI.js → test-runs-XNACGSNQ.js} +5 -5
  235. package/dist/cli-bundle/chunks/update-PD46VOXI.js +21 -0
  236. package/dist/cli-bundle/chunks/update-U235A7WP.js +25 -0
  237. package/dist/cli-bundle/chunks/{update-many-V4LA3C4H.js → update-many-6B7PJ33I.js} +22 -22
  238. package/dist/cli-bundle/chunks/{update-many-TUGU5YXQ.js → update-many-724JCVDE.js} +22 -22
  239. package/dist/cli-bundle/chunks/{upgrade-37F7JKES.js → upgrade-ALBEZAI7.js} +5 -5
  240. package/dist/cli-bundle/chunks/{upgrade-L32JA4TZ.js → upgrade-QHRGDBSA.js} +5 -5
  241. package/dist/cli-bundle/chunks/{validate-EQTT6WVX.js → validate-IQRYFXIV.js} +462 -50
  242. package/dist/cli-bundle/chunks/validate-IQRYFXIV.js.map +1 -0
  243. package/dist/cli-bundle/chunks/{validate-XN4I4DPL.js → validate-UY6DRCG5.js} +482 -49
  244. package/dist/cli-bundle/chunks/validate-UY6DRCG5.js.map +7 -0
  245. package/dist/cli-bundle/main.js +72 -24
  246. package/dist/cli-bundle/main.js.map +3 -3
  247. package/dist/core/diagnostics/remediation.js +19 -6
  248. package/dist/core/diagnostics/remediation.js.map +1 -1
  249. package/dist/core/extensions/extension-capability-aliases.js +7 -33
  250. package/dist/core/extensions/extension-capability-aliases.js.map +1 -1
  251. package/dist/core/lock/lock-gc.d.ts +31 -0
  252. package/dist/core/lock/lock-gc.js +120 -62
  253. package/dist/core/lock/lock-gc.js.map +1 -1
  254. package/dist/core/search/background-refresh.js +3 -3
  255. package/dist/core/search/background-refresh.js.map +1 -1
  256. package/dist/core/shared/errors.d.ts +3 -0
  257. package/dist/core/shared/errors.js +2 -2
  258. package/dist/core/shared/errors.js.map +1 -1
  259. package/dist/core/store/item-store.js +6 -22
  260. package/dist/core/store/item-store.js.map +1 -1
  261. package/dist/core/telemetry/consent.js +18 -3
  262. package/dist/core/telemetry/consent.js.map +1 -1
  263. package/dist/core/validate/fix-planning.d.ts +130 -0
  264. package/dist/core/validate/fix-planning.js +202 -0
  265. package/dist/core/validate/fix-planning.js.map +1 -0
  266. package/dist/core/validate/missing-by-type.d.ts +21 -0
  267. package/dist/core/validate/missing-by-type.js +39 -0
  268. package/dist/core/validate/missing-by-type.js.map +1 -0
  269. package/dist/core/validate/stale-file-classification.d.ts +41 -0
  270. package/dist/core/validate/stale-file-classification.js +73 -0
  271. package/dist/core/validate/stale-file-classification.js.map +1 -0
  272. package/dist/mcp/server.d.ts +1 -0
  273. package/dist/mcp/server.js +62 -9
  274. package/dist/mcp/server.js.map +1 -1
  275. package/dist/sdk/cli-contracts/tool-parameter-tables.js +38 -2
  276. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  277. package/dist/sdk/cli-contracts.d.ts +6 -1
  278. package/dist/sdk/cli-contracts.js +74 -7
  279. package/dist/sdk/cli-contracts.js.map +1 -1
  280. package/docs/AGENT_GUIDE.md +6 -1
  281. package/docs/COMMANDS.md +23 -1
  282. package/package.json +1 -1
  283. package/plugins/pm-claude/README.md +4 -12
  284. package/dist/cli-bundle/chunks/activity-XZIUPGZH.js +0 -16
  285. package/dist/cli-bundle/chunks/chunk-3KLPFWZ4.js.map +0 -7
  286. package/dist/cli-bundle/chunks/chunk-A6LXQFO7.js.map +0 -1
  287. package/dist/cli-bundle/chunks/chunk-E5DUIJA4.js.map +0 -7
  288. package/dist/cli-bundle/chunks/chunk-FXRU333M.js.map +0 -1
  289. package/dist/cli-bundle/chunks/chunk-FY4SPXSC.js.map +0 -7
  290. package/dist/cli-bundle/chunks/chunk-HI7STVF2.js.map +0 -1
  291. package/dist/cli-bundle/chunks/chunk-LCSCXBGT.js.map +0 -7
  292. package/dist/cli-bundle/chunks/chunk-P2PSODAQ.js.map +0 -7
  293. package/dist/cli-bundle/chunks/chunk-PSD7F7DX.js.map +0 -1
  294. package/dist/cli-bundle/chunks/chunk-UOO6BYIA.js.map +0 -1
  295. package/dist/cli-bundle/chunks/close-4FMAPEMY.js +0 -13
  296. package/dist/cli-bundle/chunks/create-JVXYHYH4.js +0 -27
  297. package/dist/cli-bundle/chunks/docs-5WMBVQT2.js.map +0 -1
  298. package/dist/cli-bundle/chunks/docs-MB53UJAJ.js.map +0 -7
  299. package/dist/cli-bundle/chunks/files-DLB5LJEP.js.map +0 -1
  300. package/dist/cli-bundle/chunks/files-GVMNVLCB.js.map +0 -7
  301. package/dist/cli-bundle/chunks/gc-2WEPW6D6.js.map +0 -1
  302. package/dist/cli-bundle/chunks/gc-4Z3IKHAZ.js.map +0 -7
  303. package/dist/cli-bundle/chunks/health-4ZYB3IYQ.js.map +0 -1
  304. package/dist/cli-bundle/chunks/health-YO5LRWN4.js.map +0 -7
  305. package/dist/cli-bundle/chunks/history-L2FQFRTU.js +0 -20
  306. package/dist/cli-bundle/chunks/history-redact-QWQCX5DZ.js +0 -19
  307. package/dist/cli-bundle/chunks/history-repair-KVPFJKOS.js.map +0 -7
  308. package/dist/cli-bundle/chunks/history-repair-RUGKD3YR.js.map +0 -1
  309. package/dist/cli-bundle/chunks/init-4BKRHGWW.js +0 -17
  310. package/dist/cli-bundle/chunks/list-BYNN4ZEO.js +0 -19
  311. package/dist/cli-bundle/chunks/plan-FQLMJRLZ.js.map +0 -7
  312. package/dist/cli-bundle/chunks/plan-VNUG3WZZ.js.map +0 -1
  313. package/dist/cli-bundle/chunks/register-operations-AM6KTWB6.js.map +0 -1
  314. package/dist/cli-bundle/chunks/register-setup-G4QYI3RX.js.map +0 -7
  315. package/dist/cli-bundle/chunks/register-setup-IKX5524L.js.map +0 -1
  316. package/dist/cli-bundle/chunks/restore-CHIOQAQL.js +0 -17
  317. package/dist/cli-bundle/chunks/test-O74JFUH5.js +0 -32
  318. package/dist/cli-bundle/chunks/update-2EVXOC7V.js +0 -21
  319. package/dist/cli-bundle/chunks/update-5A2B6QYB.js +0 -25
  320. package/dist/cli-bundle/chunks/validate-EQTT6WVX.js.map +0 -1
  321. package/dist/cli-bundle/chunks/validate-XN4I4DPL.js.map +0 -7
  322. /package/dist/cli-bundle/chunks/{activity-XADJOG6G.js.map → activity-PPO7QWJF.js.map} +0 -0
  323. /package/dist/cli-bundle/chunks/{activity-XZIUPGZH.js.map → activity-XIOTGZMU.js.map} +0 -0
  324. /package/dist/cli-bundle/chunks/{aggregate-6OTS3AOO.js.map → aggregate-IRHJWEKG.js.map} +0 -0
  325. /package/dist/cli-bundle/chunks/{aggregate-OD36DJU5.js.map → aggregate-XEBW22UQ.js.map} +0 -0
  326. /package/dist/cli-bundle/chunks/{append-JYWO4P7W.js.map → append-N2AWXKZC.js.map} +0 -0
  327. /package/dist/cli-bundle/chunks/{append-KG55G7S3.js.map → append-NL67JNJU.js.map} +0 -0
  328. /package/dist/cli-bundle/chunks/{chunk-IH4MBKK7.js.map → chunk-2ANTZBYF.js.map} +0 -0
  329. /package/dist/cli-bundle/chunks/{chunk-F75JSIOZ.js.map → chunk-2J2AH4V5.js.map} +0 -0
  330. /package/dist/cli-bundle/chunks/{chunk-CCX4RSYZ.js.map → chunk-32XSW44C.js.map} +0 -0
  331. /package/dist/cli-bundle/chunks/{chunk-DY6C42S6.js.map → chunk-36BCSMKP.js.map} +0 -0
  332. /package/dist/cli-bundle/chunks/{chunk-XUC4C4PT.js.map → chunk-3CQPVBK3.js.map} +0 -0
  333. /package/dist/cli-bundle/chunks/{chunk-SXKNJPQ7.js.map → chunk-3FMQMHAG.js.map} +0 -0
  334. /package/dist/cli-bundle/chunks/{chunk-I7NYDZDV.js.map → chunk-3VULHQNS.js.map} +0 -0
  335. /package/dist/cli-bundle/chunks/{chunk-HHHJ2GI3.js.map → chunk-4FHLNNW7.js.map} +0 -0
  336. /package/dist/cli-bundle/chunks/{chunk-RXAP6JL5.js.map → chunk-4JHJ7YG2.js.map} +0 -0
  337. /package/dist/cli-bundle/chunks/{chunk-P5BJOMBB.js.map → chunk-4TPFXE2R.js.map} +0 -0
  338. /package/dist/cli-bundle/chunks/{chunk-3SLOMKCJ.js.map → chunk-5HSAHRYA.js.map} +0 -0
  339. /package/dist/cli-bundle/chunks/{chunk-ZLMIWZUG.js.map → chunk-5LMF75Q7.js.map} +0 -0
  340. /package/dist/cli-bundle/chunks/{chunk-TK5VZFHY.js.map → chunk-6TBR5AZ2.js.map} +0 -0
  341. /package/dist/cli-bundle/chunks/{chunk-ATEES5SX.js.map → chunk-6ZFTM65G.js.map} +0 -0
  342. /package/dist/cli-bundle/chunks/{chunk-VFUZV5EB.js.map → chunk-7SM7VA5I.js.map} +0 -0
  343. /package/dist/cli-bundle/chunks/{chunk-GKIZW7SM.js.map → chunk-AAUYXSFF.js.map} +0 -0
  344. /package/dist/cli-bundle/chunks/{chunk-OASDW5UI.js.map → chunk-AUDDXKNX.js.map} +0 -0
  345. /package/dist/cli-bundle/chunks/{chunk-ZMW77VWV.js.map → chunk-BVL5KGVA.js.map} +0 -0
  346. /package/dist/cli-bundle/chunks/{chunk-4JCSYR6F.js.map → chunk-C24PWDFG.js.map} +0 -0
  347. /package/dist/cli-bundle/chunks/{chunk-4HFU4UO2.js.map → chunk-CEGUH2E5.js.map} +0 -0
  348. /package/dist/cli-bundle/chunks/{chunk-Y3YKK7CY.js.map → chunk-DWG4FHPY.js.map} +0 -0
  349. /package/dist/cli-bundle/chunks/{chunk-YW6Q3RYZ.js.map → chunk-GFBEXDCQ.js.map} +0 -0
  350. /package/dist/cli-bundle/chunks/{chunk-XMBI6TNW.js.map → chunk-GOO4UXBI.js.map} +0 -0
  351. /package/dist/cli-bundle/chunks/{chunk-IGVJRZ6H.js.map → chunk-GRZGHGRG.js.map} +0 -0
  352. /package/dist/cli-bundle/chunks/{chunk-TNAP7EJX.js.map → chunk-HZOX5BYD.js.map} +0 -0
  353. /package/dist/cli-bundle/chunks/{chunk-VSRZRLG3.js.map → chunk-IIOIBAQW.js.map} +0 -0
  354. /package/dist/cli-bundle/chunks/{chunk-IUKD4W6Z.js.map → chunk-IXVSSHGV.js.map} +0 -0
  355. /package/dist/cli-bundle/chunks/{chunk-WUNFKP7M.js.map → chunk-IZHCCG4S.js.map} +0 -0
  356. /package/dist/cli-bundle/chunks/{chunk-VAOUX6TK.js.map → chunk-JCTZV7TO.js.map} +0 -0
  357. /package/dist/cli-bundle/chunks/{chunk-ZYNJNPYD.js.map → chunk-JE5IZXDS.js.map} +0 -0
  358. /package/dist/cli-bundle/chunks/{chunk-QNJSITCX.js.map → chunk-JW7D6437.js.map} +0 -0
  359. /package/dist/cli-bundle/chunks/{chunk-B65UUCGQ.js.map → chunk-JWXTOYBI.js.map} +0 -0
  360. /package/dist/cli-bundle/chunks/{chunk-7RIT3OCD.js.map → chunk-KHGTYCJ6.js.map} +0 -0
  361. /package/dist/cli-bundle/chunks/{chunk-VPEAS7PS.js.map → chunk-LGOXXQUW.js.map} +0 -0
  362. /package/dist/cli-bundle/chunks/{chunk-I2IJY2NL.js.map → chunk-LOAR5TKX.js.map} +0 -0
  363. /package/dist/cli-bundle/chunks/{chunk-S26FESD4.js.map → chunk-LSSTKL3Y.js.map} +0 -0
  364. /package/dist/cli-bundle/chunks/{chunk-CW6E4NAT.js.map → chunk-LYNQ3NGI.js.map} +0 -0
  365. /package/dist/cli-bundle/chunks/{chunk-4YFAGDRH.js.map → chunk-M3SI2REU.js.map} +0 -0
  366. /package/dist/cli-bundle/chunks/{chunk-73ZPG2I3.js.map → chunk-MACCNKSZ.js.map} +0 -0
  367. /package/dist/cli-bundle/chunks/{chunk-P5U5EOMA.js.map → chunk-NN6RKGFW.js.map} +0 -0
  368. /package/dist/cli-bundle/chunks/{chunk-GWZSYR6X.js.map → chunk-O3YCJOVX.js.map} +0 -0
  369. /package/dist/cli-bundle/chunks/{chunk-UUWGCWBU.js.map → chunk-QQG4HEX7.js.map} +0 -0
  370. /package/dist/cli-bundle/chunks/{chunk-XTKJSVWH.js.map → chunk-QU3OPNVV.js.map} +0 -0
  371. /package/dist/cli-bundle/chunks/{chunk-EWFY7SLA.js.map → chunk-RHYBR6G7.js.map} +0 -0
  372. /package/dist/cli-bundle/chunks/{chunk-S2ZLDYGS.js.map → chunk-SOHXUA2Q.js.map} +0 -0
  373. /package/dist/cli-bundle/chunks/{chunk-KWAXVAXX.js.map → chunk-SQDKAEKG.js.map} +0 -0
  374. /package/dist/cli-bundle/chunks/{chunk-7IYFN5R7.js.map → chunk-TOX7YQ7X.js.map} +0 -0
  375. /package/dist/cli-bundle/chunks/{chunk-FDH2X65L.js.map → chunk-TSXWFN3L.js.map} +0 -0
  376. /package/dist/cli-bundle/chunks/{chunk-OLKBSY4N.js.map → chunk-UCVJP4JL.js.map} +0 -0
  377. /package/dist/cli-bundle/chunks/{chunk-AVGHVVF7.js.map → chunk-V4KP3TCN.js.map} +0 -0
  378. /package/dist/cli-bundle/chunks/{chunk-QKW5D45B.js.map → chunk-VNC2HBL4.js.map} +0 -0
  379. /package/dist/cli-bundle/chunks/{chunk-QJMGRZO2.js.map → chunk-VYZNX4C5.js.map} +0 -0
  380. /package/dist/cli-bundle/chunks/{chunk-5SCT2JCT.js.map → chunk-W6KNFAMZ.js.map} +0 -0
  381. /package/dist/cli-bundle/chunks/{chunk-I53JBTJW.js.map → chunk-WLH7X4RN.js.map} +0 -0
  382. /package/dist/cli-bundle/chunks/{chunk-ESANVZF4.js.map → chunk-XOYHMHFF.js.map} +0 -0
  383. /package/dist/cli-bundle/chunks/{chunk-HGLC63AU.js.map → chunk-XWDZVCBJ.js.map} +0 -0
  384. /package/dist/cli-bundle/chunks/{claim-MJ7DZFC3.js.map → claim-HE6KEGJW.js.map} +0 -0
  385. /package/dist/cli-bundle/chunks/{claim-2RDYMCTP.js.map → claim-QJOQBH7J.js.map} +0 -0
  386. /package/dist/cli-bundle/chunks/{close-XLEKIQSW.js.map → close-SPUFW5QR.js.map} +0 -0
  387. /package/dist/cli-bundle/chunks/{close-4FMAPEMY.js.map → close-WOG5WTMZ.js.map} +0 -0
  388. /package/dist/cli-bundle/chunks/{close-many-AOD4HSAZ.js.map → close-many-GKAJX54X.js.map} +0 -0
  389. /package/dist/cli-bundle/chunks/{close-many-XKAQY5CQ.js.map → close-many-GL6NRUU5.js.map} +0 -0
  390. /package/dist/cli-bundle/chunks/{comments-RN5TG4ZN.js.map → comments-5FPT6L7N.js.map} +0 -0
  391. /package/dist/cli-bundle/chunks/{comments-B4RWWDJT.js.map → comments-TOLOYWNI.js.map} +0 -0
  392. /package/dist/cli-bundle/chunks/{config-3JXJ3XZ7.js.map → config-4MN45TIH.js.map} +0 -0
  393. /package/dist/cli-bundle/chunks/{config-FZ4UDC4B.js.map → config-7N6D7YJE.js.map} +0 -0
  394. /package/dist/cli-bundle/chunks/{context-QBPO3BFM.js.map → context-AQSLE7DZ.js.map} +0 -0
  395. /package/dist/cli-bundle/chunks/{context-L36PIN35.js.map → context-U3PUJMVN.js.map} +0 -0
  396. /package/dist/cli-bundle/chunks/{contracts-MIXBWJIB.js.map → contracts-H7KCQXLY.js.map} +0 -0
  397. /package/dist/cli-bundle/chunks/{contracts-3NKWYKKU.js.map → contracts-ITSJXO3O.js.map} +0 -0
  398. /package/dist/cli-bundle/chunks/{copy-ALU5WMHA.js.map → copy-C4W522JM.js.map} +0 -0
  399. /package/dist/cli-bundle/chunks/{copy-FWIVTLBO.js.map → copy-EB3MUCSW.js.map} +0 -0
  400. /package/dist/cli-bundle/chunks/{create-IFA26O2I.js.map → create-4EQNELMY.js.map} +0 -0
  401. /package/dist/cli-bundle/chunks/{create-JVXYHYH4.js.map → create-NW3K7LVG.js.map} +0 -0
  402. /package/dist/cli-bundle/chunks/{delete-IYTIYAJS.js.map → delete-X5QLXIQX.js.map} +0 -0
  403. /package/dist/cli-bundle/chunks/{delete-Y2SGJBGY.js.map → delete-ZLGUYIXU.js.map} +0 -0
  404. /package/dist/cli-bundle/chunks/{deps-CZ4PTVXU.js.map → deps-GPB3LGWN.js.map} +0 -0
  405. /package/dist/cli-bundle/chunks/{deps-6TSPOSGU.js.map → deps-HV2C2L46.js.map} +0 -0
  406. /package/dist/cli-bundle/chunks/{extension-Q34OEWO5.js.map → extension-MM3TVWOO.js.map} +0 -0
  407. /package/dist/cli-bundle/chunks/{extension-WH2FOIOZ.js.map → extension-WKPVPNCC.js.map} +0 -0
  408. /package/dist/cli-bundle/chunks/{get-QARTE6BL.js.map → get-K7UULTQF.js.map} +0 -0
  409. /package/dist/cli-bundle/chunks/{get-PCHS7RA6.js.map → get-SAB7CRBG.js.map} +0 -0
  410. /package/dist/cli-bundle/chunks/{history-7WUAEWHW.js.map → history-GYFD2DJW.js.map} +0 -0
  411. /package/dist/cli-bundle/chunks/{history-L2FQFRTU.js.map → history-IUVN4NTN.js.map} +0 -0
  412. /package/dist/cli-bundle/chunks/{history-compact-3EJ3L2O7.js.map → history-compact-SLL6ESXH.js.map} +0 -0
  413. /package/dist/cli-bundle/chunks/{history-compact-LW27IPFK.js.map → history-compact-WQZQ6KXM.js.map} +0 -0
  414. /package/dist/cli-bundle/chunks/{history-redact-QWQCX5DZ.js.map → history-redact-75KIIJUJ.js.map} +0 -0
  415. /package/dist/cli-bundle/chunks/{history-redact-G72A4EJ4.js.map → history-redact-SDTDR6WM.js.map} +0 -0
  416. /package/dist/cli-bundle/chunks/{init-4BKRHGWW.js.map → init-JJFYRUKG.js.map} +0 -0
  417. /package/dist/cli-bundle/chunks/{init-S5WEGUJY.js.map → init-MXV57LKL.js.map} +0 -0
  418. /package/dist/cli-bundle/chunks/{learnings-HQXSSKZ5.js.map → learnings-L6KTZGOT.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{learnings-XK3P4ZDR.js.map → learnings-QKJOKEAO.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{list-6CL3XFT6.js.map → list-GGVPXEV6.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{list-BYNN4ZEO.js.map → list-VOQDQHA4.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{notes-5T6P7C5V.js.map → notes-3NLK7WTZ.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{notes-U5FZCSBT.js.map → notes-HMCB7TK6.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{register-list-query-VHDXWEPP.js.map → register-list-query-PWQ5F2VI.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{register-list-query-NPE3ECJQ.js.map → register-list-query-SMMMLSWW.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{restore-CHIOQAQL.js.map → restore-DRBNXJJH.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{restore-M6AFHMV4.js.map → restore-FJQWXMPY.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{schema-AINZ2IMM.js.map → schema-RNVJ55V2.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{schema-76HDZJCC.js.map → schema-ZZ7ZDM2X.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{search-JMLFQEPJ.js.map → search-BJ457C2A.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{search-NL3TSCYB.js.map → search-FQDZXX7P.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{stats-UBD56TGK.js.map → stats-CUG3ZHOI.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{stats-BKXCBIGT.js.map → stats-DUQWCVOS.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{telemetry-ZJXK3H7X.js.map → telemetry-33MRGX4Z.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{telemetry-N454RHG5.js.map → telemetry-RK2VX75A.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{test-O74JFUH5.js.map → test-SDMYEQHH.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{test-BQAKIXAT.js.map → test-Y3CTFMEC.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{test-all-7LV3I6S5.js.map → test-all-ANYQ33O2.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{test-all-TDYCCBA4.js.map → test-all-ARSMX33Q.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{test-runs-E64M6XS3.js.map → test-runs-5URSD34O.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{test-runs-LXZLULCI.js.map → test-runs-XNACGSNQ.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{update-2EVXOC7V.js.map → update-PD46VOXI.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{update-5A2B6QYB.js.map → update-U235A7WP.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{update-many-V4LA3C4H.js.map → update-many-6B7PJ33I.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{update-many-TUGU5YXQ.js.map → update-many-724JCVDE.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{upgrade-37F7JKES.js.map → upgrade-ALBEZAI7.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{upgrade-L32JA4TZ.js.map → upgrade-QHRGDBSA.js.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../cli/commands/linked-artifacts.ts"],
4
+ "sourcesContent": ["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport fg from \"fast-glob\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { getActiveExtensionRegistrations } from \"../../core/extensions/index.js\";\nimport { createStdinTokenResolver, parseCsvKv } from \"../../core/item/parse.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { listAllFrontMatter, 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 { SCOPE_VALUES } from \"../../types/index.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type { LinkScope } from \"../../types/index.js\";\n\nexport type LinkedArtifact = {\n path: string;\n scope: LinkScope;\n note?: string;\n};\n\nexport interface LinkedArtifactCommandOptions {\n add?: string[];\n addGlob?: string[];\n remove?: string[];\n migrate?: string[];\n /**\n * GH-170 (pm-pfnx): standalone note applied to every link added by --add /\n * --add-glob in the same invocation. A per-entry embedded note (the\n * `path=...,note=...` pair syntax) takes precedence over this flag.\n * Requires at least one --add/--add-glob; rejected otherwise.\n */\n note?: string;\n list?: boolean;\n appendStable?: boolean;\n validatePaths?: boolean;\n audit?: boolean;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\nexport interface PathMigration {\n from: string;\n to: string;\n}\n\nexport interface AddGlobEntry {\n pattern: string;\n scope: LinkScope;\n note?: string;\n}\n\nexport interface LinkedPathValidation {\n checked: number;\n existing_files: string[];\n missing_paths: string[];\n non_file_paths: string[];\n}\n\nexport interface LinkedPathAuditEntry {\n path: string;\n linked_by_count: number;\n linked_item_ids: string[];\n}\n\nexport interface LinkedArtifactResult {\n id: string;\n changed: boolean;\n count: number;\n migrations_applied?: number;\n validation?: LinkedPathValidation;\n audit?: LinkedPathAuditEntry[];\n artifacts: LinkedArtifact[];\n}\n\n/**\n * Configuration that adapts the shared linked-artifact command core to a\n * specific resource kind (files or docs) while preserving every behavioral\n * detail of the original twin implementations.\n */\nexport interface LinkedArtifactKindConfig {\n /** Metadata key under which the artifacts are stored (e.g. \"files\" | \"docs\"). */\n metadataKey: \"files\" | \"docs\";\n /** Mutation op recorded in history (e.g. \"files_add\" | \"docs_add\"). */\n op: \"files_add\" | \"docs_add\";\n /** Noun used in the \"bare <noun> path\" --add usage error (e.g. \"file\" | \"doc\"). */\n bareNoun: \"file\" | \"doc\";\n /**\n * Whether this kind honors the append-stable option. files supports it;\n * docs always sorts and must never expose append-stable behavior.\n */\n supportsAppendStable: boolean;\n}\n\nexport function ensureScope(raw: string | undefined): LinkScope {\n const value = (raw ?? \"project\") as LinkScope;\n if (!SCOPE_VALUES.includes(value)) {\n throw new PmCliError(\n `Invalid scope \"${raw}\". Valid scopes: ${SCOPE_VALUES.join(\", \")} (default: project).`,\n EXIT_CODE.USAGE,\n );\n }\n return value;\n}\n\nexport function looksLikeStructuredPathEntry(raw: string): boolean {\n if (raw.startsWith(\"```\") || raw.includes(\"\\n\")) {\n return true;\n }\n return /^(?:[-*+]\\s+)?(?:path|scope|note)\\s*[:=]/i.test(raw);\n}\n\nexport function parseAddEntries(raw: string[] | undefined, bareNoun: \"file\" | \"doc\"): LinkedArtifact[] {\n if (!raw) return [];\n return raw.map((entry) => {\n const trimmed = entry.trim();\n const kv = looksLikeStructuredPathEntry(trimmed) ? parseCsvKv(entry, \"--add\") : { path: trimmed };\n if (!kv.path) {\n throw new PmCliError(`--add requires path=<value> or a bare ${bareNoun} path`, EXIT_CODE.USAGE);\n }\n return {\n path: kv.path,\n scope: ensureScope(kv.scope),\n note: kv.note?.trim() || undefined,\n };\n });\n}\n\nexport function parseAddGlobEntries(raw: string[] | undefined): AddGlobEntry[] {\n if (!raw) return [];\n return raw.map((entry) => {\n const trimmed = entry.trim();\n if (!trimmed) {\n throw new PmCliError(\"--add-glob requires a glob pattern value\", EXIT_CODE.USAGE);\n }\n if (trimmed.includes(\"=\") || /^(?:[-*+]\\s+)?(?:pattern|glob|path)\\s*[:=]/i.test(trimmed) || trimmed.startsWith(\"```\")) {\n const kv = parseCsvKv(trimmed, \"--add-glob\");\n const pattern = kv.pattern?.trim() || kv.glob?.trim() || kv.path?.trim();\n if (!pattern) {\n throw new PmCliError(\"--add-glob key/value form requires pattern=<glob>\", EXIT_CODE.USAGE);\n }\n return {\n pattern,\n scope: ensureScope(kv.scope),\n note: kv.note?.trim() || undefined,\n };\n }\n return {\n pattern: trimmed,\n scope: \"project\",\n };\n });\n}\n\nexport function parseRemoveEntries(raw: string[] | undefined): string[] {\n if (!raw) return [];\n return raw.map((entry) => {\n const trimmed = entry.trim();\n if (!trimmed) {\n throw new PmCliError(\"--remove requires a path value\", EXIT_CODE.USAGE);\n }\n if (trimmed.includes(\"=\") || /^(?:[-*+]\\s+)?path\\s*[:=]/i.test(trimmed) || trimmed.startsWith(\"```\")) {\n const kv = parseCsvKv(trimmed, \"--remove\");\n if (!kv.path) {\n throw new PmCliError(\"--remove key/value form requires path=<value>\", EXIT_CODE.USAGE);\n }\n return kv.path;\n }\n return trimmed;\n });\n}\n\nexport function parseMigrateEntries(raw: string[] | undefined): PathMigration[] {\n if (!raw) return [];\n return raw.map((entry) => {\n const kv = parseCsvKv(entry, \"--migrate\");\n const from = kv.from?.trim();\n const to = kv.to?.trim();\n if (!from || !to) {\n throw new PmCliError(\"--migrate requires from=<value> and to=<value>\", EXIT_CODE.USAGE);\n }\n return { from, to };\n });\n}\n\nexport function applyPathMigrations(artifactPath: string, migrations: PathMigration[]): string {\n let next = artifactPath;\n for (const migration of migrations) {\n if (next.startsWith(migration.from)) {\n next = `${migration.to}${next.slice(migration.from.length)}`;\n }\n }\n return next;\n}\n\nexport function normalizeLinkedPath(value: string): string {\n return value.split(path.sep).join(\"/\");\n}\n\nexport async function expandAddGlobEntries(entries: AddGlobEntry[]): Promise<LinkedArtifact[]> {\n const expanded: LinkedArtifact[] = [];\n for (const entry of entries) {\n const absolutePattern = path.isAbsolute(entry.pattern);\n const matches = await fg(entry.pattern, {\n cwd: process.cwd(),\n absolute: absolutePattern,\n onlyFiles: true,\n dot: true,\n unique: true,\n followSymbolicLinks: true,\n });\n const sortedMatches = [...new Set(matches.map((match) => normalizeLinkedPath(path.normalize(match))))].sort((left, right) =>\n left.localeCompare(right),\n );\n for (const matchedPath of sortedMatches) {\n expanded.push({\n path: matchedPath,\n scope: entry.scope,\n note: entry.note,\n });\n }\n }\n return expanded;\n}\n\n/**\n * GH-170 (pm-pfnx): apply a standalone --note to the links added in this\n * invocation. Semantics (documented on pm-pfnx): the note is attached to EVERY\n * entry added via --add/--add-glob so a single flag annotates the whole batch\n * predictably; a per-entry embedded `note=` wins over the standalone flag; and\n * --note without any --add/--add-glob flag is a usage error because there is\n * nothing to annotate (it never retro-edits existing links). `hasAddFlags`\n * reflects flag presence, not match count, so a glob that legitimately matches\n * zero files is not an error.\n */\nexport function applyStandaloneNote(\n adds: LinkedArtifact[],\n note: string | undefined,\n hasAddFlags: boolean,\n): LinkedArtifact[] {\n if (note === undefined) {\n return adds;\n }\n if (!hasAddFlags) {\n throw new PmCliError(\n \"--note requires --add or --add-glob in the same invocation (the note annotates the links being added)\",\n EXIT_CODE.USAGE,\n );\n }\n const trimmed = note.trim();\n if (trimmed.length === 0) {\n return adds;\n }\n return adds.map((entry) => (entry.note === undefined ? { ...entry, note: trimmed } : entry));\n}\n\nexport function artifactKey(value: Pick<LinkedArtifact, \"path\" | \"scope\">): string {\n return `${value.path}::${value.scope}`;\n}\n\nexport function sortLinkedArtifacts(artifacts: LinkedArtifact[]): LinkedArtifact[] {\n return [...artifacts].sort((left, right) => {\n const byPath = left.path.localeCompare(right.path);\n if (byPath !== 0) return byPath;\n return left.scope.localeCompare(right.scope);\n });\n}\n\nexport function dedupeLinkedArtifacts(artifacts: LinkedArtifact[]): LinkedArtifact[] {\n return [...new Map(artifacts.map((entry) => [artifactKey(entry), entry])).values()].map((entry) => ({\n ...entry,\n note: entry.note?.trim() || undefined,\n }));\n}\n\nexport async function validateLinkedPaths(paths: string[]): Promise<LinkedPathValidation> {\n const uniquePaths = [...new Set(paths)].sort((left, right) => left.localeCompare(right));\n const existingFiles: string[] = [];\n const missingPaths: string[] = [];\n const nonFilePaths: string[] = [];\n for (const relativePath of uniquePaths) {\n const resolvedPath = path.isAbsolute(relativePath) ? relativePath : path.resolve(process.cwd(), relativePath);\n try {\n const stats = await fs.stat(resolvedPath);\n if (stats.isFile()) {\n existingFiles.push(relativePath);\n } else {\n nonFilePaths.push(relativePath);\n }\n } catch (error: unknown) {\n if (typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === \"ENOENT\") {\n missingPaths.push(relativePath);\n continue;\n }\n nonFilePaths.push(relativePath);\n }\n }\n return {\n checked: uniquePaths.length,\n existing_files: existingFiles,\n missing_paths: missingPaths,\n non_file_paths: nonFilePaths,\n };\n}\n\nexport function buildLinkedPathAudit(\n paths: string[],\n allItems: Array<{ id: string; artifacts?: LinkedArtifact[] }>,\n): LinkedPathAuditEntry[] {\n const index = new Map<string, Set<string>>();\n for (const item of allItems) {\n for (const linkedArtifact of item.artifacts ?? []) {\n const seen = index.get(linkedArtifact.path) ?? new Set<string>();\n seen.add(item.id);\n index.set(linkedArtifact.path, seen);\n }\n }\n return [...new Set(paths)]\n .sort((left, right) => left.localeCompare(right))\n .map((linkedPath) => {\n const linkedIds = [...(index.get(linkedPath) ?? new Set<string>())].sort((left, right) => left.localeCompare(right));\n return {\n path: linkedPath,\n linked_by_count: linkedIds.length,\n linked_item_ids: linkedIds,\n };\n });\n}\n\n/**\n * Shared linked-artifact list/mutate command core used by runFiles and runDocs.\n * The kind config selects metadata key, op, bare-path noun, and whether\n * append-stable ordering is honored, preserving each twin's exact semantics.\n */\nexport async function runLinkedArtifacts(\n id: string,\n options: LinkedArtifactCommandOptions,\n global: GlobalOptions,\n config: LinkedArtifactKindConfig,\n): Promise<LinkedArtifactResult> {\n const { metadataKey } = config;\n const stdinResolver = createStdinTokenResolver();\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const resolvedAdds = await stdinResolver.resolveList(options.add, \"--add\");\n const resolvedAddGlobs = await stdinResolver.resolveList(options.addGlob, \"--add-glob\");\n const resolvedRemoves = await stdinResolver.resolveList(options.remove, \"--remove\");\n const resolvedMigrations = await stdinResolver.resolveList(options.migrate, \"--migrate\");\n const parsedAdds = parseAddEntries(resolvedAdds, config.bareNoun);\n const addGlobs = parseAddGlobEntries(resolvedAddGlobs);\n const expandedGlobAdds = await expandAddGlobEntries(addGlobs);\n const adds = applyStandaloneNote(\n [...parsedAdds, ...expandedGlobAdds],\n options.note,\n parsedAdds.length > 0 || addGlobs.length > 0,\n );\n const removes = parseRemoveEntries(resolvedRemoves);\n const migrations = parseMigrateEntries(resolvedMigrations);\n const shouldMutate = adds.length > 0 || removes.length > 0 || migrations.length > 0;\n\n const collectAuditItems = async (): Promise<Array<{ id: string; artifacts?: LinkedArtifact[] }>> =>\n (await listAllFrontMatter(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema)).map((entry) => ({\n id: entry.id,\n artifacts: (entry as Record<string, unknown>)[metadataKey] as LinkedArtifact[] | undefined,\n }));\n\n if (!shouldMutate) {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);\n if (!located) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n const loaded = await readLocatedItem(located, { schema: settings.schema });\n const artifacts = ((loaded.document.metadata as Record<string, unknown>)[metadataKey] as LinkedArtifact[] | undefined) ?? [];\n return {\n id: located.id,\n artifacts,\n changed: false,\n count: artifacts.length,\n validation: options.validatePaths ? await validateLinkedPaths(artifacts.map((entry) => entry.path)) : undefined,\n audit: options.audit ? buildLinkedPathAudit(artifacts.map((entry) => entry.path), await collectAuditItems()) : undefined,\n };\n }\n\n const author = resolveAuthor(options.author, settings.author_default);\n const result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: config.op,\n author,\n message: options.message,\n force: options.force,\n mutate(document) {\n const metadata = document.metadata as Record<string, unknown>;\n const next = [...((metadata[metadataKey] as LinkedArtifact[] | undefined) ?? [])];\n let migrationCount = 0;\n if (migrations.length > 0) {\n for (let index = 0; index < next.length; index += 1) {\n const migratedPath = applyPathMigrations(next[index].path, migrations);\n if (migratedPath !== next[index].path) {\n next[index] = { ...next[index], path: migratedPath };\n migrationCount += 1;\n }\n }\n }\n const migratedAdds = adds.map((entry) => {\n const migratedPath = applyPathMigrations(entry.path, migrations);\n if (migratedPath !== entry.path) {\n migrationCount += 1;\n }\n return {\n ...entry,\n path: migratedPath,\n };\n });\n const migratedRemoves = removes.map((entry) => applyPathMigrations(entry, migrations));\n for (const add of migratedAdds) {\n const exists = next.some((entry) => entry.path === add.path && entry.scope === add.scope);\n if (!exists) {\n next.push(add);\n }\n }\n if (migratedRemoves.length > 0) {\n for (let i = next.length - 1; i >= 0; i -= 1) {\n if (migratedRemoves.includes(next[i].path)) {\n next.splice(i, 1);\n }\n }\n }\n const deduped = dedupeLinkedArtifacts(next);\n const normalized = config.supportsAppendStable && options.appendStable ? deduped : sortLinkedArtifacts(deduped);\n if (normalized.length > 0) {\n metadata[metadataKey] = normalized;\n } else {\n delete metadata[metadataKey];\n }\n return { changedFields: [metadataKey], warnings: migrationCount > 0 ? [`path_migrations_applied:${migrationCount}`] : [] };\n },\n });\n\n const artifacts = ((result.item as Record<string, unknown>)[metadataKey] as LinkedArtifact[] | undefined) ?? [];\n const migrationWarning = result.warnings.find((warning) => warning.startsWith(\"path_migrations_applied:\"));\n const migrationCount = migrationWarning ? Number(migrationWarning.slice(\"path_migrations_applied:\".length)) : 0;\n const allItems = options.audit ? await collectAuditItems() : [];\n return {\n id: result.item.id,\n artifacts,\n changed: true,\n count: artifacts.length,\n migrations_applied: migrationCount > 0 ? migrationCount : undefined,\n validation: options.validatePaths ? await validateLinkedPaths(artifacts.map((entry) => entry.path)) : undefined,\n audit: options.audit ? buildLinkedPathAudit(artifacts.map((entry) => entry.path), allItems) : undefined,\n };\n}\n\n/**\n * Re-key the generic `artifacts` field to the resource-specific name (files/docs)\n * while preserving the original key order and presence so kind-specific result\n * shapes (and their deterministic JSON key ordering) stay byte-identical.\n */\nexport function renameArtifactsResultKey(result: LinkedArtifactResult, key: \"files\" | \"docs\"): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(result)) {\n out[field === \"artifacts\" ? key : field] = value;\n }\n return out;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;;;;;;;;AA+FT,SAAU,YAAY,KAAuB;AACjD,QAAM,QAAS,OAAO;AACtB,MAAI,CAAC,aAAa,SAAS,KAAK,GAAG;AACjC,UAAM,IAAI,WACR,k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AW,QAAQ,QAAQ,MAAM,kBAAiB,IAAK,CAAA;AAC7D,SAAO;IACL,IAAI,OAAO,KAAK;IAChB;IACA,SAAS;IACT,OAAO,UAAU;IACjB,oBAAoB,iBAAiB,IAAI,iBAAiB;IAC1D,YAAY,QAAQ,gBAAgB,MAAM,oBAAoB,UAAU,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC,IAAI;IACtG,OAAO,QAAQ,QAAQ,qBAAqB,UAAU,IAAI,CAAC,UAAU,MAAM,IAAI,GAAG,QAAQ,IAAI;;AAElG;AAOM,SAAU,yBAAyB,QAA8B,KAAqB;AAC1F,QAAM,MAA+B,CAAA;AACrC,aAAW,CAAC,OAAO,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACnD,QAAI,UAAU,cAAc,MAAM,KAAK,IAAI;EAC7C;AACA,SAAO;AACT;",
6
+ "names": ["global", "artifacts", "migrationCount"]
7
+ }
@@ -0,0 +1,190 @@
1
+ import {
2
+ verifyHistoryChain
3
+ } from "./chunk-GOO4UXBI.js";
4
+ import {
5
+ hashDocument
6
+ } from "./chunk-XXLMJDUB.js";
7
+ import {
8
+ getHistoryPath,
9
+ writeFileAtomic
10
+ } from "./chunk-LFW5NQUP.js";
11
+
12
+ // dist/core/history/drift-scan.js
13
+ import fs from "fs/promises";
14
+ import { createHash } from "node:crypto";
15
+ import path from "node:path";
16
+ !(function() {
17
+ try {
18
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
19
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "0dd4c4e6-9086-5afb-814b-38d0b36d4283");
20
+ } catch (e2) {
21
+ }
22
+ })();
23
+ var DRIFT_CACHE_VERSION = 2;
24
+ var DRIFT_CACHE_FILENAME = "history-drift-cache.json";
25
+ function getDriftCachePath(pmRoot) {
26
+ return path.join(pmRoot, "runtime", DRIFT_CACHE_FILENAME);
27
+ }
28
+ async function loadDriftCache(pmRoot) {
29
+ try {
30
+ const raw = await fs.readFile(getDriftCachePath(pmRoot), "utf8");
31
+ const parsed = JSON.parse(raw);
32
+ if (parsed.version !== DRIFT_CACHE_VERSION || typeof parsed.entries !== "object" || parsed.entries === null) {
33
+ return null;
34
+ }
35
+ return parsed;
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+ function isErrno(error, code) {
41
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
42
+ }
43
+ function hashContent(raw) {
44
+ return createHash("sha256").update(raw).digest("hex");
45
+ }
46
+ async function readHistoryContentHash(historyPath) {
47
+ const raw = await fs.readFile(historyPath, "utf8");
48
+ return hashContent(raw);
49
+ }
50
+ async function verifyHistoryStream(historyPath) {
51
+ const raw = await fs.readFile(historyPath, "utf8");
52
+ const contentHash = hashContent(raw);
53
+ if (raw.trim().length === 0) {
54
+ return null;
55
+ }
56
+ const entries = [];
57
+ let latestAfterHash = null;
58
+ for (const line of raw.split(/\r?\n/)) {
59
+ const trimmed = line.trim();
60
+ if (trimmed.length === 0) {
61
+ continue;
62
+ }
63
+ const parsed = JSON.parse(trimmed);
64
+ if (typeof parsed.after_hash !== "string" || parsed.after_hash.trim().length === 0) {
65
+ throw new Error("missing after_hash");
66
+ }
67
+ entries.push(parsed);
68
+ latestAfterHash = parsed.after_hash;
69
+ }
70
+ if (!latestAfterHash) {
71
+ return null;
72
+ }
73
+ return {
74
+ latestAfterHash,
75
+ chainOk: verifyHistoryChain(entries).ok,
76
+ contentHash
77
+ };
78
+ }
79
+ async function scanHistoryDrift(pmRoot, items) {
80
+ const missingStreams = [];
81
+ const unreadableStreams = [];
82
+ const hashMismatches = [];
83
+ const chainMismatches = [];
84
+ const cache = await loadDriftCache(pmRoot);
85
+ const previousEntries = cache?.entries ?? {};
86
+ const nextEntries = {};
87
+ let cacheDirty = false;
88
+ for (const item of items) {
89
+ const historyPath = getHistoryPath(pmRoot, item.id);
90
+ let stat;
91
+ try {
92
+ stat = await fs.stat(historyPath);
93
+ } catch (error) {
94
+ if (isErrno(error, "ENOENT")) {
95
+ missingStreams.push(item.id);
96
+ } else {
97
+ unreadableStreams.push(item.id);
98
+ }
99
+ continue;
100
+ }
101
+ const loadStreamVerification = async () => {
102
+ try {
103
+ return await verifyHistoryStream(historyPath);
104
+ } catch {
105
+ return "unreadable";
106
+ }
107
+ };
108
+ const loadFreshVerification = async () => {
109
+ const loaded = await loadStreamVerification();
110
+ if (loaded === "unreadable") {
111
+ unreadableStreams.push(item.id);
112
+ return null;
113
+ }
114
+ if (!loaded) {
115
+ missingStreams.push(item.id);
116
+ return null;
117
+ }
118
+ return loaded;
119
+ };
120
+ const cached = previousEntries[item.id];
121
+ let verification;
122
+ const metadataMatchesCache = cached !== void 0 && cached.mtime_ms === stat.mtimeMs && cached.ctime_ms === stat.ctimeMs && cached.size === stat.size;
123
+ const cachedContentHash = typeof cached?.content_hash === "string" && cached.content_hash.length > 0 ? cached.content_hash : void 0;
124
+ const canUseCache = metadataMatchesCache && cachedContentHash !== void 0;
125
+ if (canUseCache && cached) {
126
+ let currentContentHash;
127
+ try {
128
+ currentContentHash = await readHistoryContentHash(historyPath);
129
+ } catch {
130
+ unreadableStreams.push(item.id);
131
+ continue;
132
+ }
133
+ if (currentContentHash === cachedContentHash) {
134
+ verification = {
135
+ latestAfterHash: cached.latest_after_hash,
136
+ chainOk: cached.chain_ok,
137
+ contentHash: currentContentHash
138
+ };
139
+ } else {
140
+ cacheDirty = true;
141
+ const refreshed = await loadFreshVerification();
142
+ if (!refreshed) {
143
+ continue;
144
+ }
145
+ verification = refreshed;
146
+ }
147
+ } else {
148
+ cacheDirty = true;
149
+ const refreshed = await loadFreshVerification();
150
+ if (!refreshed) {
151
+ continue;
152
+ }
153
+ verification = refreshed;
154
+ }
155
+ if (!verification.chainOk) {
156
+ chainMismatches.push(item.id);
157
+ }
158
+ nextEntries[item.id] = {
159
+ mtime_ms: stat.mtimeMs,
160
+ ctime_ms: stat.ctimeMs,
161
+ size: stat.size,
162
+ content_hash: verification.contentHash,
163
+ latest_after_hash: verification.latestAfterHash,
164
+ chain_ok: verification.chainOk
165
+ };
166
+ const { body, ...frontMatter } = item;
167
+ const currentHash = hashDocument({
168
+ metadata: frontMatter,
169
+ body
170
+ });
171
+ if (currentHash !== verification.latestAfterHash) {
172
+ hashMismatches.push(item.id);
173
+ }
174
+ }
175
+ if (cacheDirty || Object.keys(previousEntries).length !== Object.keys(nextEntries).length) {
176
+ const cachePath = getDriftCachePath(pmRoot);
177
+ try {
178
+ await fs.mkdir(path.dirname(cachePath), { recursive: true });
179
+ await writeFileAtomic(cachePath, JSON.stringify({ version: DRIFT_CACHE_VERSION, entries: nextEntries }));
180
+ } catch {
181
+ }
182
+ }
183
+ const driftedItems = [.../* @__PURE__ */ new Set([...missingStreams, ...unreadableStreams, ...hashMismatches, ...chainMismatches])].sort((a, b) => a.localeCompare(b));
184
+ return { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems };
185
+ }
186
+
187
+ export {
188
+ scanHistoryDrift
189
+ };
190
+ //# sourceMappingURL=chunk-HWHONML5.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../core/history/drift-scan.ts"],
4
+ "sourcesContent": ["import fs from \"fs/promises\";\nimport { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport { getHistoryPath } from \"../store/paths.js\";\nimport { writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { hashDocument } from \"./history.js\";\nimport { verifyHistoryChain } from \"./replay.js\";\nimport type { HistoryEntry, ItemMetadata } from \"../../types/index.js\";\n\nexport interface DriftScanResult {\n missingStreams: string[];\n unreadableStreams: string[];\n hashMismatches: string[];\n chainMismatches: string[];\n driftedItems: string[];\n}\n\nconst DRIFT_CACHE_VERSION = 2;\nconst DRIFT_CACHE_FILENAME = \"history-drift-cache.json\";\n\ninterface DriftCacheEntry {\n mtime_ms: number;\n ctime_ms: number;\n size: number;\n content_hash: string;\n latest_after_hash: string;\n chain_ok: boolean;\n}\n\ninterface DriftCacheEnvelope {\n version: number;\n entries: Record<string, DriftCacheEntry>;\n}\n\nfunction getDriftCachePath(pmRoot: string): string {\n return path.join(pmRoot, \"runtime\", DRIFT_CACHE_FILENAME);\n}\n\nasync function loadDriftCache(pmRoot: string): Promise<DriftCacheEnvelope | null> {\n try {\n const raw = await fs.readFile(getDriftCachePath(pmRoot), \"utf8\");\n const parsed = JSON.parse(raw) as DriftCacheEnvelope;\n if (parsed.version !== DRIFT_CACHE_VERSION || typeof parsed.entries !== \"object\" || parsed.entries === null) {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n\ninterface StreamVerification {\n latestAfterHash: string;\n chainOk: boolean;\n contentHash: string;\n}\n\nfunction hashContent(raw: string): string {\n return createHash(\"sha256\").update(raw).digest(\"hex\");\n}\n\nasync function readHistoryContentHash(historyPath: string): Promise<string> {\n const raw = await fs.readFile(historyPath, \"utf8\");\n return hashContent(raw);\n}\n\n/**\n * Read and fully verify one history stream's hash chain. Returns null for an\n * empty/missing stream (caller records it as a missing stream).\n */\nasync function verifyHistoryStream(historyPath: string): Promise<StreamVerification | null> {\n const raw = await fs.readFile(historyPath, \"utf8\");\n const contentHash = hashContent(raw);\n if (raw.trim().length === 0) {\n return null;\n }\n const entries: HistoryEntry[] = [];\n let latestAfterHash: string | null = null;\n for (const line of raw.split(/\\r?\\n/)) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n const parsed = JSON.parse(trimmed) as HistoryEntry;\n if (typeof parsed.after_hash !== \"string\" || parsed.after_hash.trim().length === 0) {\n throw new Error(\"missing after_hash\");\n }\n entries.push(parsed);\n latestAfterHash = parsed.after_hash;\n }\n /* c8 ignore start -- defensive guard for future history schema changes. */\n if (!latestAfterHash) {\n return null;\n }\n /* c8 ignore stop */\n return {\n latestAfterHash,\n chainOk: verifyHistoryChain(entries).ok,\n contentHash,\n };\n}\n\n/**\n * Scan every item's history stream for drift (missing/unreadable streams, broken\n * hash chains, and item/history hash mismatches).\n *\n * Full chain re-verification of a 17MB+ history tree is the dominant cost of\n * `pm health`. We cache the per-stream verification keyed by the history file's\n * mtime/ctime/size + content hash: metadata-stable replacements (same stat tuple)\n * can still happen, so each metadata hit recomputes a content hash guard before\n * trusting the cached chain/hash verification.\n */\nexport async function scanHistoryDrift(\n pmRoot: string,\n items: Array<ItemMetadata & { body: string }>,\n): Promise<DriftScanResult> {\n const missingStreams: string[] = [];\n const unreadableStreams: string[] = [];\n const hashMismatches: string[] = [];\n const chainMismatches: string[] = [];\n\n const cache = await loadDriftCache(pmRoot);\n const previousEntries: Record<string, DriftCacheEntry> = cache?.entries ?? {};\n const nextEntries: Record<string, DriftCacheEntry> = {};\n let cacheDirty = false;\n\n for (const item of items) {\n const historyPath = getHistoryPath(pmRoot, item.id);\n\n let stat: Awaited<ReturnType<typeof fs.stat>>;\n try {\n stat = await fs.stat(historyPath);\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n missingStreams.push(item.id);\n } else {\n unreadableStreams.push(item.id);\n }\n continue;\n }\n\n const loadStreamVerification = async (): Promise<StreamVerification | null | \"unreadable\"> => {\n try {\n return await verifyHistoryStream(historyPath);\n } catch {\n return \"unreadable\";\n }\n };\n\n const loadFreshVerification = async (): Promise<StreamVerification | null> => {\n const loaded = await loadStreamVerification();\n if (loaded === \"unreadable\") {\n unreadableStreams.push(item.id);\n return null;\n }\n if (!loaded) {\n missingStreams.push(item.id);\n return null;\n }\n return loaded;\n };\n\n const cached = previousEntries[item.id];\n let verification: StreamVerification;\n const metadataMatchesCache =\n cached !== undefined &&\n cached.mtime_ms === stat.mtimeMs &&\n cached.ctime_ms === stat.ctimeMs &&\n cached.size === stat.size;\n const cachedContentHash =\n typeof cached?.content_hash === \"string\" && cached.content_hash.length > 0 ? cached.content_hash : undefined;\n const canUseCache = metadataMatchesCache && cachedContentHash !== undefined;\n if (canUseCache && cached) {\n let currentContentHash: string;\n try {\n currentContentHash = await readHistoryContentHash(historyPath);\n } catch {\n unreadableStreams.push(item.id);\n continue;\n }\n if (currentContentHash === cachedContentHash) {\n verification = {\n latestAfterHash: cached.latest_after_hash,\n chainOk: cached.chain_ok,\n contentHash: currentContentHash,\n };\n } else {\n cacheDirty = true;\n const refreshed = await loadFreshVerification();\n if (!refreshed) {\n continue;\n }\n verification = refreshed;\n }\n } else {\n cacheDirty = true;\n const refreshed = await loadFreshVerification();\n if (!refreshed) {\n continue;\n }\n verification = refreshed;\n }\n\n if (!verification.chainOk) {\n chainMismatches.push(item.id);\n }\n nextEntries[item.id] = {\n mtime_ms: stat.mtimeMs,\n ctime_ms: stat.ctimeMs,\n size: stat.size,\n content_hash: verification.contentHash,\n latest_after_hash: verification.latestAfterHash,\n chain_ok: verification.chainOk,\n };\n\n const { body, ...frontMatter } = item;\n const currentHash = hashDocument({\n metadata: frontMatter as ItemMetadata,\n body,\n });\n if (currentHash !== verification.latestAfterHash) {\n hashMismatches.push(item.id);\n }\n }\n\n if (cacheDirty || Object.keys(previousEntries).length !== Object.keys(nextEntries).length) {\n const cachePath = getDriftCachePath(pmRoot);\n try {\n await fs.mkdir(path.dirname(cachePath), { recursive: true });\n await writeFileAtomic(cachePath, JSON.stringify({ version: DRIFT_CACHE_VERSION, entries: nextEntries }));\n } catch {\n // Best-effort cache write: a failed persist must never fail a health scan.\n }\n }\n\n const driftedItems = [...new Set([...missingStreams, ...unreadableStreams, ...hashMismatches, ...chainMismatches])].sort((a, b) =>\n a.localeCompare(b),\n );\n return { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,SAAS,kBAAkB;AAC3B,OAAO,UAAU;;;;;;;;AAejB,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAgB7B,SAA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AAE,cAAc,CAAC,CAAC;AAEpB,SAAO,EAAE,gBAAgB,mBAAmB,gBAAgB,iBAAiB,aAAY;AAC3F;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXIT_CODE,
3
3
  PmCliError
4
- } from "./chunk-FY4SPXSC.js";
4
+ } from "./chunk-LFW5NQUP.js";
5
5
 
6
6
  // dist/core/item/parse.js
7
7
  !(function() {
@@ -338,4 +338,4 @@ export {
338
338
  createStdinTokenResolver,
339
339
  parseOptionalNumber
340
340
  };
341
- //# sourceMappingURL=chunk-TNAP7EJX.js.map
341
+ //# sourceMappingURL=chunk-HZOX5BYD.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parseItemDocument,
3
3
  serializeItemDocument
4
- } from "./chunk-73ZPG2I3.js";
4
+ } from "./chunk-MACCNKSZ.js";
5
5
  import {
6
6
  TYPE_TO_FOLDER,
7
7
  getItemFormatFromPath,
@@ -10,7 +10,7 @@ import {
10
10
  removeFileIfExists,
11
11
  runActiveOnWriteHooks,
12
12
  writeFileAtomic
13
- } from "./chunk-FY4SPXSC.js";
13
+ } from "./chunk-LFW5NQUP.js";
14
14
 
15
15
  // dist/core/store/item-format-migration.js
16
16
  import fs from "node:fs/promises";
@@ -119,4 +119,4 @@ async function migrateItemFilesToFormat(pmRoot, targetFormat, op = "item_format:
119
119
  export {
120
120
  migrateItemFilesToFormat
121
121
  };
122
- //# sourceMappingURL=chunk-VSRZRLG3.js.map
122
+ //# sourceMappingURL=chunk-IIOIBAQW.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXIT_CODE,
3
3
  PmCliError
4
- } from "./chunk-FY4SPXSC.js";
4
+ } from "./chunk-LFW5NQUP.js";
5
5
 
6
6
  // dist/core/shared/time.js
7
7
  !(function() {
@@ -204,4 +204,4 @@ export {
204
204
  compareTimestampStrings,
205
205
  resolveIsoOrRelative
206
206
  };
207
- //# sourceMappingURL=chunk-IUKD4W6Z.js.map
207
+ //# sourceMappingURL=chunk-IXVSSHGV.js.map
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  EXIT_CODE,
5
5
  PmCliError
6
- } from "./chunk-A6LXQFO7.js";
6
+ } from "./chunk-S2CDTRJ6.js";
7
7
 
8
8
  // dist/core/shared/time.js
9
9
  var RELATIVE_DEADLINE = /^([+-]?)(\d+)([hdwm])$/i;
@@ -199,6 +199,6 @@ export {
199
199
  compareTimestampStrings,
200
200
  resolveIsoOrRelative
201
201
  };
202
- //# sourceMappingURL=chunk-WUNFKP7M.js.map
202
+ //# sourceMappingURL=chunk-IZHCCG4S.js.map
203
203
 
204
204
  //# debugId=849dc628-ad6f-57cc-974c-36ea67ca2d07
@@ -5,7 +5,7 @@ import {
5
5
  PmCliError,
6
6
  isPathWithinDirectory,
7
7
  pathExists
8
- } from "./chunk-A6LXQFO7.js";
8
+ } from "./chunk-S2CDTRJ6.js";
9
9
 
10
10
  // dist/cli/commands/extension/shared.js
11
11
  import fs from "node:fs/promises";
@@ -107,6 +107,6 @@ export {
107
107
  parseExtensionManifest,
108
108
  validateExtensionDirectory
109
109
  };
110
- //# sourceMappingURL=chunk-VAOUX6TK.js.map
110
+ //# sourceMappingURL=chunk-JCTZV7TO.js.map
111
111
 
112
112
  //# debugId=537a6d63-6806-5bdc-ae0f-3e84cf25eb7e
@@ -3,16 +3,16 @@
3
3
  import {
4
4
  hashDocument,
5
5
  toItemRecord
6
- } from "./chunk-HI7STVF2.js";
6
+ } from "./chunk-L6YQONLM.js";
7
7
  import {
8
8
  canonicalDocument
9
- } from "./chunk-UUWGCWBU.js";
9
+ } from "./chunk-QQG4HEX7.js";
10
10
  import {
11
11
  FRONT_MATTER_KEY_ORDER,
12
12
  orderObject,
13
13
  sha256Hex,
14
14
  stableStringify
15
- } from "./chunk-A6LXQFO7.js";
15
+ } from "./chunk-S2CDTRJ6.js";
16
16
 
17
17
  // dist/core/history/replay.js
18
18
  import jsonPatch from "fast-json-patch";
@@ -232,6 +232,6 @@ export {
232
232
  reanchorHistoryEntries,
233
233
  historyEntriesToRaw
234
234
  };
235
- //# sourceMappingURL=chunk-ZYNJNPYD.js.map
235
+ //# sourceMappingURL=chunk-JE5IZXDS.js.map
236
236
 
237
237
  //# debugId=eaf45328-2532-5e1c-9570-442b894b03d3
@@ -2,22 +2,22 @@
2
2
  !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ede3cf3f-6ca9-5eb0-aeb7-cd997702397f")}catch(e){}}();
3
3
  import {
4
4
  readHistoryEntries
5
- } from "./chunk-HGLC63AU.js";
5
+ } from "./chunk-XWDZVCBJ.js";
6
6
  import {
7
7
  parseLimit
8
- } from "./chunk-P5U5EOMA.js";
8
+ } from "./chunk-NN6RKGFW.js";
9
9
  import {
10
10
  enforceHistoryStreamPolicyForItems,
11
11
  listAllFrontMatterLight
12
- } from "./chunk-HI7STVF2.js";
12
+ } from "./chunk-L6YQONLM.js";
13
13
  import {
14
14
  resolveItemTypeRegistry
15
- } from "./chunk-CCX4RSYZ.js";
15
+ } from "./chunk-32XSW44C.js";
16
16
  import {
17
17
  compareTimestampStrings,
18
18
  nowIso,
19
19
  resolveIsoOrRelative
20
- } from "./chunk-WUNFKP7M.js";
20
+ } from "./chunk-IZHCCG4S.js";
21
21
  import {
22
22
  EXIT_CODE,
23
23
  PmCliError,
@@ -27,7 +27,7 @@ import {
27
27
  readSettings,
28
28
  resolvePmRoot,
29
29
  runActiveOnReadHooks
30
- } from "./chunk-A6LXQFO7.js";
30
+ } from "./chunk-S2CDTRJ6.js";
31
31
 
32
32
  // dist/cli/commands/activity.js
33
33
  import fs from "node:fs/promises";
@@ -177,6 +177,6 @@ async function runActivity(options, global) {
177
177
  export {
178
178
  runActivity
179
179
  };
180
- //# sourceMappingURL=chunk-QNJSITCX.js.map
180
+ //# sourceMappingURL=chunk-JW7D6437.js.map
181
181
 
182
182
  //# debugId=ede3cf3f-6ca9-5eb0-aeb7-cd997702397f
@@ -10,15 +10,15 @@ import {
10
10
  readFirstStringFromCommanderOptions,
11
11
  readFirstValueFromCommanderOptions,
12
12
  readStringArrayFromCommanderOptions
13
- } from "./chunk-P2PSODAQ.js";
13
+ } from "./chunk-7CRFV6JR.js";
14
14
  import {
15
15
  refreshSearchArtifactsForMutation,
16
16
  shouldRunSearchRefreshInForeground
17
- } from "./chunk-7UGSRQCL.js";
17
+ } from "./chunk-PEH7SZD2.js";
18
18
  import {
19
19
  printError,
20
20
  writeStdout
21
- } from "./chunk-GWZSYR6X.js";
21
+ } from "./chunk-O3YCJOVX.js";
22
22
  import {
23
23
  EXIT_CODE,
24
24
  PmCliError,
@@ -27,7 +27,7 @@ import {
27
27
  readSettings,
28
28
  resolvePmRoot,
29
29
  setActiveCommandResult
30
- } from "./chunk-FY4SPXSC.js";
30
+ } from "./chunk-LFW5NQUP.js";
31
31
 
32
32
  // dist/cli/registration-helpers.js
33
33
  !(function() {
@@ -724,4 +724,4 @@ export {
724
724
  normalizeContextOptions,
725
725
  invalidateSearchCachesForMutation
726
726
  };
727
- //# sourceMappingURL=chunk-B65UUCGQ.js.map
727
+ //# sourceMappingURL=chunk-JWXTOYBI.js.map
@@ -2,7 +2,7 @@
2
2
  !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bc69cde3-7c0d-5ce3-a6fa-8ccd67d46d4b")}catch(e){}}();
3
3
  import {
4
4
  runClose
5
- } from "./chunk-QKW5D45B.js";
5
+ } from "./chunk-VNC2HBL4.js";
6
6
  import {
7
7
  assertNoLegacyNoneToken,
8
8
  assertNoLegacyNoneTokens,
@@ -20,7 +20,7 @@ import {
20
20
  parseTests,
21
21
  parseTypeOptionEntries,
22
22
  resolvePriority
23
- } from "./chunk-J3GD64J2.js";
23
+ } from "./chunk-SGMGMCIF.js";
24
24
  import {
25
25
  applyTagRemovals,
26
26
  createStdinTokenResolver,
@@ -28,15 +28,15 @@ import {
28
28
  parseCsvKv,
29
29
  parseOptionalNumber,
30
30
  parseTags
31
- } from "./chunk-I7NYDZDV.js";
31
+ } from "./chunk-3VULHQNS.js";
32
32
  import {
33
33
  normalizeParentReferenceValue,
34
34
  validateMissingParentReference,
35
35
  validateSprintOrReleaseValue
36
- } from "./chunk-Y3YKK7CY.js";
36
+ } from "./chunk-DWG4FHPY.js";
37
37
  import {
38
38
  buildInvalidTypeError
39
- } from "./chunk-FDH2X65L.js";
39
+ } from "./chunk-TSXWFN3L.js";
40
40
  import {
41
41
  applyRegisteredItemFieldDefaultsAndValidation,
42
42
  buildItemNotFoundError,
@@ -46,14 +46,14 @@ import {
46
46
  parseRegisteredItemFieldAssignments,
47
47
  readLocatedItem,
48
48
  toItemRecord
49
- } from "./chunk-HI7STVF2.js";
49
+ } from "./chunk-L6YQONLM.js";
50
50
  import {
51
51
  normalizeItemId
52
- } from "./chunk-ATEES5SX.js";
52
+ } from "./chunk-6ZFTM65G.js";
53
53
  import {
54
54
  collectRuntimeUpdateFieldValues,
55
55
  normalizeStatusInput
56
- } from "./chunk-UUWGCWBU.js";
56
+ } from "./chunk-QQG4HEX7.js";
57
57
  import {
58
58
  canonicalizeCommandOptionKey,
59
59
  commandOptionFlagLabel,
@@ -62,10 +62,10 @@ import {
62
62
  resolveTypeDefinition,
63
63
  resolveTypeName,
64
64
  validateTypeOptions
65
- } from "./chunk-CCX4RSYZ.js";
65
+ } from "./chunk-32XSW44C.js";
66
66
  import {
67
67
  resolveIsoOrRelative
68
- } from "./chunk-WUNFKP7M.js";
68
+ } from "./chunk-IZHCCG4S.js";
69
69
  import {
70
70
  DEPENDENCY_KIND_VALUES,
71
71
  EXIT_CODE,
@@ -80,7 +80,7 @@ import {
80
80
  resolveRuntimeFieldRegistry,
81
81
  resolveRuntimeStatusRegistry,
82
82
  stableValueEquals
83
- } from "./chunk-A6LXQFO7.js";
83
+ } from "./chunk-S2CDTRJ6.js";
84
84
 
85
85
  // dist/core/schema/type-workflows.js
86
86
  function normalizeStatusToken(value) {
@@ -1699,6 +1699,6 @@ async function runUpdate(id, options, global) {
1699
1699
  export {
1700
1700
  runUpdate
1701
1701
  };
1702
- //# sourceMappingURL=chunk-7RIT3OCD.js.map
1702
+ //# sourceMappingURL=chunk-KHGTYCJ6.js.map
1703
1703
 
1704
1704
  //# debugId=bc69cde3-7c0d-5ce3-a6fa-8ccd67d46d4b
@@ -1,20 +1,20 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="63baf38c-b0be-5f1c-9e7b-60c3a6a50d3b")}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]="46c683b0-8c69-530c-9011-0969f6a182bb")}catch(e){}}();
3
3
  import {
4
4
  normalizeItemId,
5
5
  normalizeRawItemId
6
- } from "./chunk-ATEES5SX.js";
6
+ } from "./chunk-6ZFTM65G.js";
7
7
  import {
8
8
  canonicalDocument,
9
9
  parseItemDocument,
10
10
  serializeItemDocument
11
- } from "./chunk-UUWGCWBU.js";
11
+ } from "./chunk-QQG4HEX7.js";
12
12
  import {
13
13
  resolveItemTypeRegistry
14
- } from "./chunk-CCX4RSYZ.js";
14
+ } from "./chunk-32XSW44C.js";
15
15
  import {
16
16
  nowIso
17
- } from "./chunk-WUNFKP7M.js";
17
+ } from "./chunk-IZHCCG4S.js";
18
18
  import {
19
19
  EMPTY_CANONICAL_DOCUMENT,
20
20
  EXIT_CODE,
@@ -30,6 +30,7 @@ import {
30
30
  getItemPath,
31
31
  getLockPath,
32
32
  hasActiveOnReadHooks,
33
+ levenshteinDistanceWithinLimit,
33
34
  normalizeItemFieldType,
34
35
  orderObject,
35
36
  pathExists,
@@ -43,7 +44,7 @@ import {
43
44
  stableStringify,
44
45
  toErrorMessage,
45
46
  writeFileAtomic
46
- } from "./chunk-A6LXQFO7.js";
47
+ } from "./chunk-S2CDTRJ6.js";
47
48
 
48
49
  // dist/core/extensions/item-fields.js
49
50
  var RESERVED_ITEM_FIELD_NAMES = new Set(FRONT_MATTER_KEY_ORDER);
@@ -985,30 +986,13 @@ async function listKnownItemIds(pmRoot, typeToFolder) {
985
986
  }));
986
987
  return allIds;
987
988
  }
988
- function levenshtein(a, b) {
989
- if (a === b)
990
- return 0;
991
- if (a.length === 0)
992
- return b.length;
993
- if (b.length === 0)
994
- return a.length;
995
- let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
996
- for (let i = 1; i <= a.length; i++) {
997
- const curr = [i];
998
- for (let j = 1; j <= b.length; j++) {
999
- const cost = a[i - 1] === b[j - 1] ? 0 : 1;
1000
- curr.push(Math.min(curr[j - 1] + 1, prev[j] + 1, prev[j - 1] + cost));
1001
- }
1002
- prev = curr;
1003
- }
1004
- return prev[b.length];
1005
- }
1006
989
  async function buildDidYouMeanSuggestions(pmRoot, badId, idPrefix, typeToFolder) {
1007
990
  const normalized = normalizeItemId(badId, idPrefix);
1008
991
  const ids = await listKnownItemIds(pmRoot, typeToFolder);
1009
992
  if (ids.length === 0)
1010
993
  return [];
1011
- const scored = ids.map((id) => ({ id, distance: levenshtein(id, normalized) })).filter((entry) => entry.distance <= Math.max(3, Math.floor(normalized.length / 2))).sort((left, right) => left.distance - right.distance).slice(0, 3).map((entry) => entry.id);
994
+ const limit = Math.max(3, Math.floor(normalized.length / 2));
995
+ const scored = ids.map((id) => ({ id, distance: levenshteinDistanceWithinLimit(id, normalized, limit) })).filter((entry) => entry.distance !== null).sort((left, right) => left.distance - right.distance).slice(0, 3).map((entry) => entry.id);
1012
996
  return scored;
1013
997
  }
1014
998
  async function buildItemNotFoundError(pmRoot, badId, idPrefix, typeToFolder) {
@@ -1332,6 +1316,6 @@ export {
1332
1316
  mutateItem,
1333
1317
  deleteItem
1334
1318
  };
1335
- //# sourceMappingURL=chunk-HI7STVF2.js.map
1319
+ //# sourceMappingURL=chunk-L6YQONLM.js.map
1336
1320
 
1337
- //# debugId=63baf38c-b0be-5f1c-9e7b-60c3a6a50d3b
1321
+ //# debugId=46c683b0-8c69-530c-9011-0969f6a182bb