@unbrained/pm-cli 2026.6.9 → 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 (506) hide show
  1. package/CHANGELOG.md +43 -0
  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 +51 -2
  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-RUJATACW.js → activity-W6TS5F2L.js} +11 -11
  51. package/dist/cli-bundle/chunks/{aggregate-IQ27NFBI.js → aggregate-NNJLKGEK.js} +64 -23
  52. package/dist/cli-bundle/chunks/aggregate-NNJLKGEK.js.map +7 -0
  53. package/dist/cli-bundle/chunks/{aggregate-TT7OCHHT.js → aggregate-UK2WJ4Z3.js} +65 -24
  54. package/dist/cli-bundle/chunks/aggregate-UK2WJ4Z3.js.map +1 -0
  55. package/dist/cli-bundle/chunks/{append-CWQZBUWV.js → append-7BS36Z2L.js} +8 -8
  56. package/dist/cli-bundle/chunks/{append-E7AJ5RTR.js → append-DHGTLUZW.js} +8 -8
  57. package/dist/cli-bundle/chunks/{chunk-FHUI7AXS.js → chunk-2MKBPWMK.js} +3 -3
  58. package/dist/cli-bundle/chunks/{chunk-42IULX44.js → chunk-344GDQTH.js} +2 -2
  59. package/dist/cli-bundle/chunks/{chunk-5MMLINZB.js → chunk-3VTWCBXL.js} +3 -3
  60. package/dist/cli-bundle/chunks/{chunk-NUGAWYEN.js → chunk-4CYHWHZU.js} +2 -2
  61. package/dist/cli-bundle/chunks/{chunk-T7NWFVOA.js → chunk-4H2NDEGJ.js} +7 -7
  62. package/dist/cli-bundle/chunks/{chunk-FKH7K6YP.js → chunk-5HH6QRH5.js} +9 -9
  63. package/dist/cli-bundle/chunks/{chunk-OPYA2HIU.js → chunk-5OMABP7I.js} +7 -7
  64. package/dist/cli-bundle/chunks/{chunk-RKCJ2JMA.js → chunk-6ADVKPVV.js} +7 -7
  65. package/dist/cli-bundle/chunks/{chunk-EFRHTZO4.js → chunk-6KQS23TX.js} +8 -8
  66. package/dist/cli-bundle/chunks/{chunk-YX5LAKFJ.js → chunk-6N46IM44.js} +2 -2
  67. package/dist/cli-bundle/chunks/{chunk-WQZCEEQN.js → chunk-6OSG3EMX.js} +157 -12
  68. package/dist/cli-bundle/chunks/chunk-6OSG3EMX.js.map +1 -0
  69. package/dist/cli-bundle/chunks/{chunk-CAXUGAAF.js → chunk-73PSHEMT.js} +8 -8
  70. package/dist/cli-bundle/chunks/{chunk-RE2JQJZJ.js → chunk-7DUVDW7C.js} +3 -3
  71. package/dist/cli-bundle/chunks/{chunk-U3Z4OCZC.js → chunk-7GYMMDDW.js} +2 -2
  72. package/dist/cli-bundle/chunks/{chunk-SAUXUI6U.js → chunk-7TW64BS5.js} +2 -2
  73. package/dist/cli-bundle/chunks/{chunk-T7B5VAKD.js → chunk-A6XVYNQJ.js} +13 -6
  74. package/dist/cli-bundle/chunks/chunk-A6XVYNQJ.js.map +7 -0
  75. package/dist/cli-bundle/chunks/{chunk-E7LOIIFP.js → chunk-ANVZCNL5.js} +3 -3
  76. package/dist/cli-bundle/chunks/{chunk-NJRZIJ4N.js → chunk-BE5G7HEL.js} +14 -8
  77. package/dist/cli-bundle/chunks/chunk-BE5G7HEL.js.map +1 -0
  78. package/dist/cli-bundle/chunks/{chunk-RLVI7KDW.js → chunk-CMEHZD6G.js} +163 -11
  79. package/dist/cli-bundle/chunks/chunk-CMEHZD6G.js.map +7 -0
  80. package/dist/cli-bundle/chunks/{chunk-D5D7VKIC.js → chunk-CTW7QAHM.js} +6 -5
  81. package/dist/cli-bundle/chunks/chunk-CTW7QAHM.js.map +1 -0
  82. package/dist/cli-bundle/chunks/{chunk-KTVXLI54.js → chunk-D6JZBUZ6.js} +7 -7
  83. package/dist/cli-bundle/chunks/{chunk-I26E6XA7.js → chunk-DEYNERFX.js} +8 -6
  84. package/dist/cli-bundle/chunks/chunk-DEYNERFX.js.map +1 -0
  85. package/dist/cli-bundle/chunks/{chunk-YI6W2DBN.js → chunk-DMDEC4QP.js} +6 -6
  86. package/dist/cli-bundle/chunks/{chunk-AM2AXVFS.js → chunk-DTRIVUTN.js} +5 -5
  87. package/dist/cli-bundle/chunks/{chunk-I4FGL3K2.js → chunk-EAQLLID6.js} +16 -6
  88. package/dist/cli-bundle/chunks/chunk-EAQLLID6.js.map +1 -0
  89. package/dist/cli-bundle/chunks/{chunk-JEGFLKSI.js → chunk-EIS32UA4.js} +2 -2
  90. package/dist/cli-bundle/chunks/chunk-F2PVV7IX.js +528 -0
  91. package/dist/cli-bundle/chunks/chunk-F2PVV7IX.js.map +7 -0
  92. package/dist/cli-bundle/chunks/{chunk-4LRVXVJK.js → chunk-GF5XIBUH.js} +70 -9
  93. package/dist/cli-bundle/chunks/chunk-GF5XIBUH.js.map +7 -0
  94. package/dist/cli-bundle/chunks/{chunk-PUSOAQCR.js → chunk-GP6SHEAI.js} +5 -5
  95. package/dist/cli-bundle/chunks/{chunk-I3UILOUU.js → chunk-GRHPU6EM.js} +2 -2
  96. package/dist/cli-bundle/chunks/{chunk-WCWIDJII.js → chunk-I2FM2SMO.js} +2 -2
  97. package/dist/cli-bundle/chunks/{chunk-ANKG2JKL.js → chunk-IEQ3N7WP.js} +12 -5
  98. package/dist/cli-bundle/chunks/chunk-IEQ3N7WP.js.map +1 -0
  99. package/dist/cli-bundle/chunks/{chunk-JN3BT7UY.js → chunk-K45NAJV2.js} +9 -9
  100. package/dist/cli-bundle/chunks/{chunk-23WNCJBA.js → chunk-K7SXBA75.js} +2 -2
  101. package/dist/cli-bundle/chunks/{chunk-FJNJEWU4.js → chunk-KHBRV5JU.js} +14 -12
  102. package/dist/cli-bundle/chunks/chunk-KHBRV5JU.js.map +1 -0
  103. package/dist/cli-bundle/chunks/{chunk-7YTWXGE3.js → chunk-KMMUDSSB.js} +112 -7
  104. package/dist/cli-bundle/chunks/chunk-KMMUDSSB.js.map +1 -0
  105. package/dist/cli-bundle/chunks/{chunk-JVMAOD54.js → chunk-KRZQGRVL.js} +14 -7
  106. package/dist/cli-bundle/chunks/chunk-KRZQGRVL.js.map +1 -0
  107. package/dist/cli-bundle/chunks/{chunk-BACSNVWE.js → chunk-LUJQJR7G.js} +71 -69
  108. package/dist/cli-bundle/chunks/{chunk-BACSNVWE.js.map → chunk-LUJQJR7G.js.map} +1 -1
  109. package/dist/cli-bundle/chunks/{chunk-P2NVFE4L.js → chunk-LYL32FT6.js} +3 -3
  110. package/dist/cli-bundle/chunks/{chunk-AVGOVJGV.js → chunk-MF6KSSMF.js} +9 -9
  111. package/dist/cli-bundle/chunks/{chunk-AVGOVJGV.js.map → chunk-MF6KSSMF.js.map} +1 -1
  112. package/dist/cli-bundle/chunks/{chunk-ZPXDD6RQ.js → chunk-O64EYNHF.js} +6 -6
  113. package/dist/cli-bundle/chunks/{chunk-C72IQIBT.js → chunk-OQGJSCZZ.js} +301 -30
  114. package/dist/cli-bundle/chunks/chunk-OQGJSCZZ.js.map +7 -0
  115. package/dist/cli-bundle/chunks/{chunk-44JP4PYY.js → chunk-OROMGSBP.js} +2 -2
  116. package/dist/cli-bundle/chunks/{chunk-LU54Z4QI.js → chunk-OSGWBWLK.js} +76 -74
  117. package/dist/cli-bundle/chunks/{chunk-LU54Z4QI.js.map → chunk-OSGWBWLK.js.map} +3 -3
  118. package/dist/cli-bundle/chunks/{chunk-OT6XAMO5.js → chunk-OVNSQHDG.js} +7 -5
  119. package/dist/cli-bundle/chunks/{chunk-OT6XAMO5.js.map → chunk-OVNSQHDG.js.map} +2 -2
  120. package/dist/cli-bundle/chunks/{chunk-PW7C262O.js → chunk-PYULT32I.js} +2 -2
  121. package/dist/cli-bundle/chunks/{chunk-NHRZSYAA.js → chunk-Q6PSD5DZ.js} +3 -3
  122. package/dist/cli-bundle/chunks/{chunk-A5342JVL.js → chunk-QGIWURY3.js} +12 -12
  123. package/dist/cli-bundle/chunks/{chunk-GPOSGWCN.js → chunk-QJ2OIEOC.js} +68 -7
  124. package/dist/cli-bundle/chunks/chunk-QJ2OIEOC.js.map +1 -0
  125. package/dist/cli-bundle/chunks/{chunk-5ATRWEZO.js → chunk-SNASEDXB.js} +3 -3
  126. package/dist/cli-bundle/chunks/{chunk-KDX6VC3P.js → chunk-T6QLB34N.js} +3 -3
  127. package/dist/cli-bundle/chunks/{chunk-6IGTNFE3.js → chunk-TALBUVWF.js} +2 -2
  128. package/dist/cli-bundle/chunks/{chunk-VDVVOLR6.js → chunk-TV6FZGVK.js} +3 -3
  129. package/dist/cli-bundle/chunks/{chunk-H37YPWLM.js → chunk-TXWMLDMG.js} +13 -7
  130. package/dist/cli-bundle/chunks/chunk-TXWMLDMG.js.map +7 -0
  131. package/dist/cli-bundle/chunks/{chunk-TLD3UYGY.js → chunk-TZLGCTA5.js} +5 -4
  132. package/dist/cli-bundle/chunks/chunk-TZLGCTA5.js.map +7 -0
  133. package/dist/cli-bundle/chunks/{chunk-7CR4GAYN.js → chunk-UDWUDUJI.js} +2 -2
  134. package/dist/cli-bundle/chunks/{chunk-YSANBZAE.js → chunk-UMWF6ZAS.js} +12 -5
  135. package/dist/cli-bundle/chunks/chunk-UMWF6ZAS.js.map +7 -0
  136. package/dist/cli-bundle/chunks/{chunk-F2REA7VW.js → chunk-UNH3KSHG.js} +3 -3
  137. package/dist/cli-bundle/chunks/{chunk-4TJWRPIH.js → chunk-UY26RIBR.js} +2 -2
  138. package/dist/cli-bundle/chunks/{chunk-MNXJ6YDO.js → chunk-VSS3CSTF.js} +9 -9
  139. package/dist/cli-bundle/chunks/{chunk-EQ6N6IDR.js → chunk-WBU257Z4.js} +13 -11
  140. package/dist/cli-bundle/chunks/chunk-WBU257Z4.js.map +7 -0
  141. package/dist/cli-bundle/chunks/{chunk-5JF76OJF.js → chunk-WNMRICXH.js} +289 -25
  142. package/dist/cli-bundle/chunks/chunk-WNMRICXH.js.map +1 -0
  143. package/dist/cli-bundle/chunks/chunk-WSWOQP3Z.js +518 -0
  144. package/dist/cli-bundle/chunks/chunk-WSWOQP3Z.js.map +1 -0
  145. package/dist/cli-bundle/chunks/{chunk-ENCVPOID.js → chunk-WWEFBBVF.js} +12 -12
  146. package/dist/cli-bundle/chunks/{chunk-XEOO6K5J.js → chunk-X3IPJU2O.js} +9 -9
  147. package/dist/cli-bundle/chunks/{chunk-RMTI5R76.js → chunk-X5YC5DZM.js} +111 -6
  148. package/dist/cli-bundle/chunks/chunk-X5YC5DZM.js.map +7 -0
  149. package/dist/cli-bundle/chunks/{chunk-3RHE76G6.js → chunk-XH6RA5A5.js} +15 -15
  150. package/dist/cli-bundle/chunks/chunk-XH6RA5A5.js.map +1 -0
  151. package/dist/cli-bundle/chunks/{chunk-LF2VNLEZ.js → chunk-XRE4CTNP.js} +8 -8
  152. package/dist/cli-bundle/chunks/{chunk-LF2VNLEZ.js.map → chunk-XRE4CTNP.js.map} +2 -2
  153. package/dist/cli-bundle/chunks/{chunk-SD6H3RLA.js → chunk-XSCGU4WT.js} +15 -5
  154. package/dist/cli-bundle/chunks/{chunk-SD6H3RLA.js.map → chunk-XSCGU4WT.js.map} +2 -2
  155. package/dist/cli-bundle/chunks/{chunk-BIRVSIM2.js → chunk-ZH7C7ZVX.js} +14 -14
  156. package/dist/cli-bundle/chunks/chunk-ZH7C7ZVX.js.map +7 -0
  157. package/dist/cli-bundle/chunks/{claim-UXFGCF3P.js → claim-3TY5LE54.js} +10 -10
  158. package/dist/cli-bundle/chunks/{claim-RV6WYUF7.js → claim-LM4YY6QQ.js} +10 -10
  159. package/dist/cli-bundle/chunks/{close-O4JK2JKD.js → close-CSD4LEMT.js} +8 -8
  160. package/dist/cli-bundle/chunks/close-SIQCDOBR.js +13 -0
  161. package/dist/cli-bundle/chunks/{close-many-EQO4TPIE.js → close-many-B5SHDX6W.js} +15 -15
  162. package/dist/cli-bundle/chunks/{close-many-SRDBV3SI.js → close-many-WRXB5KVY.js} +15 -15
  163. package/dist/cli-bundle/chunks/{comments-OMB7YE27.js → comments-A5ALOYTG.js} +10 -10
  164. package/dist/cli-bundle/chunks/{comments-TTZUIB2O.js → comments-BDDEK3VW.js} +10 -10
  165. package/dist/cli-bundle/chunks/{config-5VPR42A6.js → config-W2NHDNQT.js} +8 -8
  166. package/dist/cli-bundle/chunks/{config-NNLXVGVC.js → config-YUYBMJOW.js} +8 -8
  167. package/dist/cli-bundle/chunks/{context-4QK6GRXO.js → context-LRJ74NSU.js} +146 -33
  168. package/dist/cli-bundle/chunks/{context-4QK6GRXO.js.map → context-LRJ74NSU.js.map} +2 -2
  169. package/dist/cli-bundle/chunks/{context-4N7GYTVQ.js → context-R2QLOJCK.js} +147 -34
  170. package/dist/cli-bundle/chunks/context-R2QLOJCK.js.map +1 -0
  171. package/dist/cli-bundle/chunks/{contracts-AOBNEBVT.js → contracts-47X7RYUF.js} +4 -4
  172. package/dist/cli-bundle/chunks/{contracts-DXCWXOSP.js → contracts-HJHR4NCD.js} +4 -4
  173. package/dist/cli-bundle/chunks/{copy-XSYEQTLA.js → copy-B7HFOWFB.js} +7 -7
  174. package/dist/cli-bundle/chunks/{copy-5NM3SVJA.js → copy-P4UVYZ7M.js} +7 -7
  175. package/dist/cli-bundle/chunks/{create-FCCAATQV.js → create-5ERJF64D.js} +13 -13
  176. package/dist/cli-bundle/chunks/create-TXNRPS4K.js +27 -0
  177. package/dist/cli-bundle/chunks/{delete-5JFP6OG7.js → delete-LX3LGBCH.js} +7 -7
  178. package/dist/cli-bundle/chunks/{delete-PQXJQXQ7.js → delete-S3WVK6LP.js} +7 -7
  179. package/dist/cli-bundle/chunks/{deps-XXKBOQUA.js → deps-GWSNH7OZ.js} +7 -7
  180. package/dist/cli-bundle/chunks/{deps-S5322EOQ.js → deps-YSM4LZQD.js} +7 -7
  181. package/dist/cli-bundle/chunks/{docs-DZRPAW5S.js → docs-7RYFBHQD.js} +9 -9
  182. package/dist/cli-bundle/chunks/{docs-C7CCVWAJ.js → docs-TG6JMVMY.js} +9 -9
  183. package/dist/cli-bundle/chunks/{extension-CSHP6FZX.js → extension-R3LUKMX7.js} +5 -5
  184. package/dist/cli-bundle/chunks/{extension-XNNVUVAY.js → extension-VNMRKIHI.js} +5 -5
  185. package/dist/cli-bundle/chunks/{files-OBWYYPKM.js → files-KAKU57OT.js} +9 -9
  186. package/dist/cli-bundle/chunks/{files-UPCNKEIZ.js → files-QB3EYPMO.js} +9 -9
  187. package/dist/cli-bundle/chunks/{gc-KXK6KBRN.js → gc-B747VM4M.js} +3 -3
  188. package/dist/cli-bundle/chunks/{gc-FA2ONELT.js → gc-KNUPLPSW.js} +3 -3
  189. package/dist/cli-bundle/chunks/{get-PNTSONGB.js → get-GMGLIQ5I.js} +11 -11
  190. package/dist/cli-bundle/chunks/{get-FLHYTOBA.js → get-SBL6NHYQ.js} +11 -11
  191. package/dist/cli-bundle/chunks/{health-CS5RNTJX.js → health-IG43Z4KL.js} +47 -19
  192. package/dist/cli-bundle/chunks/health-IG43Z4KL.js.map +1 -0
  193. package/dist/cli-bundle/chunks/{health-KCRVYIYY.js → health-WWZJ5KJS.js} +46 -18
  194. package/dist/cli-bundle/chunks/health-WWZJ5KJS.js.map +7 -0
  195. package/dist/cli-bundle/chunks/history-6UKSZTRT.js +20 -0
  196. package/dist/cli-bundle/chunks/{history-COQTPBEU.js → history-XCWRXBXC.js} +10 -10
  197. package/dist/cli-bundle/chunks/{history-compact-66PSRYL3.js → history-compact-IDH7E7VN.js} +11 -11
  198. package/dist/cli-bundle/chunks/{history-compact-PVS2A3FS.js → history-compact-KICKUCR7.js} +11 -11
  199. package/dist/cli-bundle/chunks/history-redact-HKYBTK6X.js +19 -0
  200. package/dist/cli-bundle/chunks/{history-redact-DCXAWGTF.js → history-redact-JJWH3QWK.js} +11 -11
  201. package/dist/cli-bundle/chunks/{history-repair-TA3NRIFO.js → history-repair-7HWBZKXN.js} +11 -11
  202. package/dist/cli-bundle/chunks/{history-repair-SEQDFTGW.js → history-repair-N5HXKJOI.js} +11 -11
  203. package/dist/cli-bundle/chunks/init-27JLDUO2.js +17 -0
  204. package/dist/cli-bundle/chunks/{init-IQJE3EKJ.js → init-OQA3TWIS.js} +9 -9
  205. package/dist/cli-bundle/chunks/{learnings-XC6EMW5E.js → learnings-L7VQUSVI.js} +10 -10
  206. package/dist/cli-bundle/chunks/{learnings-RJPGH2ME.js → learnings-Z4GAIZQ5.js} +10 -10
  207. package/dist/cli-bundle/chunks/list-6U3CJVXS.js +19 -0
  208. package/dist/cli-bundle/chunks/{list-NJV6WBT4.js → list-W5ROBC5U.js} +10 -10
  209. package/dist/cli-bundle/chunks/{notes-2KWHADK3.js → notes-JJDOEDFK.js} +10 -10
  210. package/dist/cli-bundle/chunks/{notes-FNCDMZW2.js → notes-SDCK7BEN.js} +10 -10
  211. package/dist/cli-bundle/chunks/{plan-MQO5JTSV.js → plan-H5HYHMBB.js} +13 -13
  212. package/dist/cli-bundle/chunks/{plan-CYK2P5PD.js → plan-W2B5RYR3.js} +13 -13
  213. package/dist/cli-bundle/chunks/{register-list-query-IO3RR5K6.js → register-list-query-QGRFMDWA.js} +20 -20
  214. package/dist/cli-bundle/chunks/register-list-query-QGRFMDWA.js.map +7 -0
  215. package/dist/cli-bundle/chunks/{register-list-query-6RA24SIZ.js → register-list-query-V4S23735.js} +21 -21
  216. package/dist/cli-bundle/chunks/register-list-query-V4S23735.js.map +1 -0
  217. package/dist/cli-bundle/chunks/{register-mutation-VV2SC2KL.js → register-mutation-I57PLUHA.js} +36 -35
  218. package/dist/cli-bundle/chunks/register-mutation-I57PLUHA.js.map +1 -0
  219. package/dist/cli-bundle/chunks/{register-mutation-KVFUXCAZ.js → register-mutation-ZPZNJXSA.js} +35 -34
  220. package/dist/cli-bundle/chunks/register-mutation-ZPZNJXSA.js.map +7 -0
  221. package/dist/cli-bundle/chunks/{register-operations-DFNVRSJ5.js → register-operations-KAMLXAF5.js} +42 -37
  222. package/dist/cli-bundle/chunks/register-operations-KAMLXAF5.js.map +1 -0
  223. package/dist/cli-bundle/chunks/{register-operations-TAUUTRJ4.js → register-operations-YEN4YEZ2.js} +41 -36
  224. package/dist/cli-bundle/chunks/register-operations-YEN4YEZ2.js.map +7 -0
  225. package/dist/cli-bundle/chunks/{register-setup-GAQZZRUA.js → register-setup-BZ3TNE3G.js} +15 -15
  226. package/dist/cli-bundle/chunks/{register-setup-X2R5CFDV.js → register-setup-WLFL3OUF.js} +15 -15
  227. package/dist/cli-bundle/chunks/restore-GNI2W5CN.js +17 -0
  228. package/dist/cli-bundle/chunks/{restore-E3GZKRRK.js → restore-RGFSPG4K.js} +11 -11
  229. package/dist/cli-bundle/chunks/{schema-3CPFLDAY.js → schema-CCDU3RLC.js} +8 -8
  230. package/dist/cli-bundle/chunks/{schema-7EHBPNXM.js → schema-KZASL323.js} +8 -8
  231. package/dist/cli-bundle/chunks/{search-OBZVYJJ2.js → search-7KSOLI2E.js} +10 -10
  232. package/dist/cli-bundle/chunks/{search-2T3NCCUR.js → search-DTL7CO22.js} +10 -10
  233. package/dist/cli-bundle/chunks/{stats-ULGQACF7.js → stats-IOXQMGI6.js} +7 -7
  234. package/dist/cli-bundle/chunks/{stats-6LVK4JER.js → stats-QNV7B2CE.js} +7 -7
  235. package/dist/cli-bundle/chunks/{telemetry-6G27FLCP.js → telemetry-IV5C6JOM.js} +4 -4
  236. package/dist/cli-bundle/chunks/{telemetry-HHKRTMZA.js → telemetry-NHR5RFXT.js} +4 -4
  237. package/dist/cli-bundle/chunks/test-4Z37CXW4.js +32 -0
  238. package/dist/cli-bundle/chunks/{test-2PP4YBV6.js → test-PIL2CEEB.js} +14 -14
  239. package/dist/cli-bundle/chunks/{test-all-NETGVNM6.js → test-all-GRLYHBNP.js} +14 -14
  240. package/dist/cli-bundle/chunks/{test-all-6Z272JRI.js → test-all-MFN4MYCV.js} +14 -14
  241. package/dist/cli-bundle/chunks/{test-runs-CRPQVMMG.js → test-runs-7LRFWWCA.js} +5 -5
  242. package/dist/cli-bundle/chunks/{test-runs-M24WA6TI.js → test-runs-7WCSC3TY.js} +5 -5
  243. package/dist/cli-bundle/chunks/update-I4G34LKJ.js +21 -0
  244. package/dist/cli-bundle/chunks/update-VI5DBZ3G.js +25 -0
  245. package/dist/cli-bundle/chunks/{update-many-JSRF5EH5.js → update-many-LOTAYUTN.js} +22 -22
  246. package/dist/cli-bundle/chunks/{update-many-Y3HOL7WA.js → update-many-UYMTVF42.js} +22 -22
  247. package/dist/cli-bundle/chunks/{upgrade-ECB6GH3M.js → upgrade-LT2MLLPS.js} +5 -5
  248. package/dist/cli-bundle/chunks/{upgrade-5RTQVKKE.js → upgrade-ZZSC7CLV.js} +5 -5
  249. package/dist/cli-bundle/chunks/{validate-J6Q444SD.js → validate-3XRORNMP.js} +16 -16
  250. package/dist/cli-bundle/chunks/{validate-MCNMAXVA.js → validate-IQIQSKUX.js} +16 -16
  251. package/dist/cli-bundle/main.js +132 -44
  252. package/dist/cli-bundle/main.js.map +2 -2
  253. package/dist/core/diagnostics/remediation.js +12 -2
  254. package/dist/core/diagnostics/remediation.js.map +1 -1
  255. package/dist/core/extensions/extension-policy.d.ts +14 -1
  256. package/dist/core/extensions/extension-policy.js +38 -3
  257. package/dist/core/extensions/extension-policy.js.map +1 -1
  258. package/dist/core/extensions/extension-types.d.ts +40 -1
  259. package/dist/core/extensions/extension-types.js +28 -2
  260. package/dist/core/extensions/extension-types.js.map +1 -1
  261. package/dist/core/extensions/loader.d.ts +6 -4
  262. package/dist/core/extensions/loader.js +67 -14
  263. package/dist/core/extensions/loader.js.map +1 -1
  264. package/dist/core/history/replay.d.ts +1 -1
  265. package/dist/core/history/replay.js +13 -4
  266. package/dist/core/history/replay.js.map +1 -1
  267. package/dist/core/output/mutation-projection.d.ts +2 -0
  268. package/dist/core/output/mutation-projection.js +9 -2
  269. package/dist/core/output/mutation-projection.js.map +1 -1
  270. package/dist/core/output/output.d.ts +2 -0
  271. package/dist/core/output/output.js +7 -3
  272. package/dist/core/output/output.js.map +1 -1
  273. package/dist/core/shared/command-types.d.ts +1 -0
  274. package/dist/core/shared/command-types.js +2 -2
  275. package/dist/core/shared/command-types.js.map +1 -1
  276. package/dist/core/shared/constants.js +7 -4
  277. package/dist/core/shared/constants.js.map +1 -1
  278. package/dist/core/store/item-store.d.ts +1 -1
  279. package/dist/core/store/item-store.js +3 -3
  280. package/dist/core/store/item-store.js.map +1 -1
  281. package/dist/core/store/settings-read-cache.d.ts +15 -0
  282. package/dist/core/store/settings-read-cache.js +72 -0
  283. package/dist/core/store/settings-read-cache.js.map +1 -0
  284. package/dist/core/store/settings-validator.d.ts +4 -1
  285. package/dist/core/store/settings-validator.js +14 -2
  286. package/dist/core/store/settings-validator.js.map +1 -1
  287. package/dist/core/store/settings.js +166 -16
  288. package/dist/core/store/settings.js.map +1 -1
  289. package/dist/core/telemetry/runtime.d.ts +1 -0
  290. package/dist/core/telemetry/runtime.js +3 -3
  291. package/dist/core/telemetry/runtime.js.map +1 -1
  292. package/dist/core/test/run-selectors.d.ts +27 -0
  293. package/dist/core/test/run-selectors.js +110 -0
  294. package/dist/core/test/run-selectors.js.map +1 -0
  295. package/dist/mcp/server.js +50 -11
  296. package/dist/mcp/server.js.map +1 -1
  297. package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -2
  298. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  299. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  300. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  301. package/dist/sdk/cli-contracts/tool-parameter-tables.js +29 -2
  302. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  303. package/dist/sdk/cli-contracts.js +37 -5
  304. package/dist/sdk/cli-contracts.js.map +1 -1
  305. package/dist/sdk/index.d.ts +1 -1
  306. package/dist/sdk/index.js +2 -2
  307. package/dist/sdk/index.js.map +1 -1
  308. package/dist/sdk/runtime.d.ts +6 -0
  309. package/dist/sdk/runtime.js +51 -3
  310. package/dist/sdk/runtime.js.map +1 -1
  311. package/dist/types.d.ts +4 -1
  312. package/dist/types.js +4 -2
  313. package/dist/types.js.map +1 -1
  314. package/docs/AGENT_GUIDE.md +7 -1
  315. package/docs/ARCHITECTURE.md +7 -0
  316. package/docs/COMMANDS.md +37 -3
  317. package/docs/CONFIGURATION.md +1 -1
  318. package/docs/EXTENSIONS.md +55 -53
  319. package/docs/SDK.md +8 -2
  320. package/docs/TESTING.md +60 -0
  321. package/docs/schemas/extension-manifest.schema.json +120 -0
  322. package/package.json +2 -2
  323. package/packages/pm-beads/extensions/beads/manifest.json +10 -0
  324. package/packages/pm-calendar/extensions/calendar/manifest.json +10 -0
  325. package/packages/pm-command-kit/README.md +72 -0
  326. package/packages/pm-command-kit/extensions/command-kit/index.js +181 -0
  327. package/packages/pm-command-kit/extensions/command-kit/index.ts +176 -0
  328. package/packages/pm-command-kit/extensions/command-kit/manifest.json +22 -0
  329. package/packages/pm-command-kit/package.json +53 -0
  330. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +10 -0
  331. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +10 -0
  332. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +10 -0
  333. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +10 -0
  334. package/packages/pm-search-advanced/extensions/search-advanced/index.js +6 -0
  335. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +6 -0
  336. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +10 -0
  337. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +1 -0
  338. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +1 -0
  339. package/packages/pm-templates/extensions/templates/manifest.json +10 -0
  340. package/packages/pm-todos/extensions/todos/manifest.json +10 -0
  341. package/dist/cli-bundle/chunks/activity-HF3VJYKH.js +0 -16
  342. package/dist/cli-bundle/chunks/aggregate-IQ27NFBI.js.map +0 -7
  343. package/dist/cli-bundle/chunks/aggregate-TT7OCHHT.js.map +0 -1
  344. package/dist/cli-bundle/chunks/chunk-3RHE76G6.js.map +0 -1
  345. package/dist/cli-bundle/chunks/chunk-4LRVXVJK.js.map +0 -7
  346. package/dist/cli-bundle/chunks/chunk-5JF76OJF.js.map +0 -1
  347. package/dist/cli-bundle/chunks/chunk-7YTWXGE3.js.map +0 -1
  348. package/dist/cli-bundle/chunks/chunk-ANKG2JKL.js.map +0 -1
  349. package/dist/cli-bundle/chunks/chunk-BIRVSIM2.js.map +0 -7
  350. package/dist/cli-bundle/chunks/chunk-C72IQIBT.js.map +0 -7
  351. package/dist/cli-bundle/chunks/chunk-D5D7VKIC.js.map +0 -1
  352. package/dist/cli-bundle/chunks/chunk-EQ6N6IDR.js.map +0 -7
  353. package/dist/cli-bundle/chunks/chunk-FJNJEWU4.js.map +0 -1
  354. package/dist/cli-bundle/chunks/chunk-GPOSGWCN.js.map +0 -1
  355. package/dist/cli-bundle/chunks/chunk-H37YPWLM.js.map +0 -7
  356. package/dist/cli-bundle/chunks/chunk-I26E6XA7.js.map +0 -1
  357. package/dist/cli-bundle/chunks/chunk-I4FGL3K2.js.map +0 -1
  358. package/dist/cli-bundle/chunks/chunk-JVMAOD54.js.map +0 -1
  359. package/dist/cli-bundle/chunks/chunk-LU2HE272.js +0 -242
  360. package/dist/cli-bundle/chunks/chunk-LU2HE272.js.map +0 -1
  361. package/dist/cli-bundle/chunks/chunk-NJRZIJ4N.js.map +0 -1
  362. package/dist/cli-bundle/chunks/chunk-O4L7Z6LB.js +0 -252
  363. package/dist/cli-bundle/chunks/chunk-O4L7Z6LB.js.map +0 -7
  364. package/dist/cli-bundle/chunks/chunk-RLVI7KDW.js.map +0 -7
  365. package/dist/cli-bundle/chunks/chunk-RMTI5R76.js.map +0 -7
  366. package/dist/cli-bundle/chunks/chunk-T7B5VAKD.js.map +0 -7
  367. package/dist/cli-bundle/chunks/chunk-TLD3UYGY.js.map +0 -7
  368. package/dist/cli-bundle/chunks/chunk-WQZCEEQN.js.map +0 -1
  369. package/dist/cli-bundle/chunks/chunk-YSANBZAE.js.map +0 -7
  370. package/dist/cli-bundle/chunks/close-JTTGW7TS.js +0 -13
  371. package/dist/cli-bundle/chunks/context-4N7GYTVQ.js.map +0 -1
  372. package/dist/cli-bundle/chunks/create-JAPLFDGJ.js +0 -27
  373. package/dist/cli-bundle/chunks/health-CS5RNTJX.js.map +0 -1
  374. package/dist/cli-bundle/chunks/health-KCRVYIYY.js.map +0 -7
  375. package/dist/cli-bundle/chunks/history-6624XISO.js +0 -20
  376. package/dist/cli-bundle/chunks/history-redact-ZRQTI7NB.js +0 -19
  377. package/dist/cli-bundle/chunks/init-ZVE2HMKK.js +0 -17
  378. package/dist/cli-bundle/chunks/list-OO5P472O.js +0 -19
  379. package/dist/cli-bundle/chunks/register-list-query-6RA24SIZ.js.map +0 -1
  380. package/dist/cli-bundle/chunks/register-list-query-IO3RR5K6.js.map +0 -7
  381. package/dist/cli-bundle/chunks/register-mutation-KVFUXCAZ.js.map +0 -7
  382. package/dist/cli-bundle/chunks/register-mutation-VV2SC2KL.js.map +0 -1
  383. package/dist/cli-bundle/chunks/register-operations-DFNVRSJ5.js.map +0 -1
  384. package/dist/cli-bundle/chunks/register-operations-TAUUTRJ4.js.map +0 -7
  385. package/dist/cli-bundle/chunks/restore-F4ALFV4D.js +0 -17
  386. package/dist/cli-bundle/chunks/test-PPOLRIBA.js +0 -32
  387. package/dist/cli-bundle/chunks/update-MCPCPMHV.js +0 -25
  388. package/dist/cli-bundle/chunks/update-O7TBOUVQ.js +0 -21
  389. /package/dist/cli-bundle/chunks/{activity-HF3VJYKH.js.map → activity-5QLX6DHN.js.map} +0 -0
  390. /package/dist/cli-bundle/chunks/{activity-RUJATACW.js.map → activity-W6TS5F2L.js.map} +0 -0
  391. /package/dist/cli-bundle/chunks/{append-CWQZBUWV.js.map → append-7BS36Z2L.js.map} +0 -0
  392. /package/dist/cli-bundle/chunks/{append-E7AJ5RTR.js.map → append-DHGTLUZW.js.map} +0 -0
  393. /package/dist/cli-bundle/chunks/{chunk-FHUI7AXS.js.map → chunk-2MKBPWMK.js.map} +0 -0
  394. /package/dist/cli-bundle/chunks/{chunk-42IULX44.js.map → chunk-344GDQTH.js.map} +0 -0
  395. /package/dist/cli-bundle/chunks/{chunk-5MMLINZB.js.map → chunk-3VTWCBXL.js.map} +0 -0
  396. /package/dist/cli-bundle/chunks/{chunk-NUGAWYEN.js.map → chunk-4CYHWHZU.js.map} +0 -0
  397. /package/dist/cli-bundle/chunks/{chunk-T7NWFVOA.js.map → chunk-4H2NDEGJ.js.map} +0 -0
  398. /package/dist/cli-bundle/chunks/{chunk-FKH7K6YP.js.map → chunk-5HH6QRH5.js.map} +0 -0
  399. /package/dist/cli-bundle/chunks/{chunk-OPYA2HIU.js.map → chunk-5OMABP7I.js.map} +0 -0
  400. /package/dist/cli-bundle/chunks/{chunk-RKCJ2JMA.js.map → chunk-6ADVKPVV.js.map} +0 -0
  401. /package/dist/cli-bundle/chunks/{chunk-EFRHTZO4.js.map → chunk-6KQS23TX.js.map} +0 -0
  402. /package/dist/cli-bundle/chunks/{chunk-YX5LAKFJ.js.map → chunk-6N46IM44.js.map} +0 -0
  403. /package/dist/cli-bundle/chunks/{chunk-CAXUGAAF.js.map → chunk-73PSHEMT.js.map} +0 -0
  404. /package/dist/cli-bundle/chunks/{chunk-RE2JQJZJ.js.map → chunk-7DUVDW7C.js.map} +0 -0
  405. /package/dist/cli-bundle/chunks/{chunk-U3Z4OCZC.js.map → chunk-7GYMMDDW.js.map} +0 -0
  406. /package/dist/cli-bundle/chunks/{chunk-SAUXUI6U.js.map → chunk-7TW64BS5.js.map} +0 -0
  407. /package/dist/cli-bundle/chunks/{chunk-E7LOIIFP.js.map → chunk-ANVZCNL5.js.map} +0 -0
  408. /package/dist/cli-bundle/chunks/{chunk-KTVXLI54.js.map → chunk-D6JZBUZ6.js.map} +0 -0
  409. /package/dist/cli-bundle/chunks/{chunk-YI6W2DBN.js.map → chunk-DMDEC4QP.js.map} +0 -0
  410. /package/dist/cli-bundle/chunks/{chunk-AM2AXVFS.js.map → chunk-DTRIVUTN.js.map} +0 -0
  411. /package/dist/cli-bundle/chunks/{chunk-JEGFLKSI.js.map → chunk-EIS32UA4.js.map} +0 -0
  412. /package/dist/cli-bundle/chunks/{chunk-PUSOAQCR.js.map → chunk-GP6SHEAI.js.map} +0 -0
  413. /package/dist/cli-bundle/chunks/{chunk-I3UILOUU.js.map → chunk-GRHPU6EM.js.map} +0 -0
  414. /package/dist/cli-bundle/chunks/{chunk-WCWIDJII.js.map → chunk-I2FM2SMO.js.map} +0 -0
  415. /package/dist/cli-bundle/chunks/{chunk-JN3BT7UY.js.map → chunk-K45NAJV2.js.map} +0 -0
  416. /package/dist/cli-bundle/chunks/{chunk-23WNCJBA.js.map → chunk-K7SXBA75.js.map} +0 -0
  417. /package/dist/cli-bundle/chunks/{chunk-P2NVFE4L.js.map → chunk-LYL32FT6.js.map} +0 -0
  418. /package/dist/cli-bundle/chunks/{chunk-ZPXDD6RQ.js.map → chunk-O64EYNHF.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{chunk-44JP4PYY.js.map → chunk-OROMGSBP.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{chunk-PW7C262O.js.map → chunk-PYULT32I.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{chunk-NHRZSYAA.js.map → chunk-Q6PSD5DZ.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{chunk-A5342JVL.js.map → chunk-QGIWURY3.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{chunk-5ATRWEZO.js.map → chunk-SNASEDXB.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{chunk-KDX6VC3P.js.map → chunk-T6QLB34N.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{chunk-6IGTNFE3.js.map → chunk-TALBUVWF.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{chunk-VDVVOLR6.js.map → chunk-TV6FZGVK.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{chunk-7CR4GAYN.js.map → chunk-UDWUDUJI.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{chunk-F2REA7VW.js.map → chunk-UNH3KSHG.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{chunk-4TJWRPIH.js.map → chunk-UY26RIBR.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{chunk-MNXJ6YDO.js.map → chunk-VSS3CSTF.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{chunk-ENCVPOID.js.map → chunk-WWEFBBVF.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{chunk-XEOO6K5J.js.map → chunk-X3IPJU2O.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{claim-UXFGCF3P.js.map → claim-3TY5LE54.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{claim-RV6WYUF7.js.map → claim-LM4YY6QQ.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{close-O4JK2JKD.js.map → close-CSD4LEMT.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{close-JTTGW7TS.js.map → close-SIQCDOBR.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{close-many-EQO4TPIE.js.map → close-many-B5SHDX6W.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{close-many-SRDBV3SI.js.map → close-many-WRXB5KVY.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{comments-OMB7YE27.js.map → comments-A5ALOYTG.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{comments-TTZUIB2O.js.map → comments-BDDEK3VW.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{config-5VPR42A6.js.map → config-W2NHDNQT.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{config-NNLXVGVC.js.map → config-YUYBMJOW.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{contracts-AOBNEBVT.js.map → contracts-47X7RYUF.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{contracts-DXCWXOSP.js.map → contracts-HJHR4NCD.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{copy-XSYEQTLA.js.map → copy-B7HFOWFB.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{copy-5NM3SVJA.js.map → copy-P4UVYZ7M.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{create-FCCAATQV.js.map → create-5ERJF64D.js.map} +0 -0
  448. /package/dist/cli-bundle/chunks/{create-JAPLFDGJ.js.map → create-TXNRPS4K.js.map} +0 -0
  449. /package/dist/cli-bundle/chunks/{delete-5JFP6OG7.js.map → delete-LX3LGBCH.js.map} +0 -0
  450. /package/dist/cli-bundle/chunks/{delete-PQXJQXQ7.js.map → delete-S3WVK6LP.js.map} +0 -0
  451. /package/dist/cli-bundle/chunks/{deps-XXKBOQUA.js.map → deps-GWSNH7OZ.js.map} +0 -0
  452. /package/dist/cli-bundle/chunks/{deps-S5322EOQ.js.map → deps-YSM4LZQD.js.map} +0 -0
  453. /package/dist/cli-bundle/chunks/{docs-DZRPAW5S.js.map → docs-7RYFBHQD.js.map} +0 -0
  454. /package/dist/cli-bundle/chunks/{docs-C7CCVWAJ.js.map → docs-TG6JMVMY.js.map} +0 -0
  455. /package/dist/cli-bundle/chunks/{extension-CSHP6FZX.js.map → extension-R3LUKMX7.js.map} +0 -0
  456. /package/dist/cli-bundle/chunks/{extension-XNNVUVAY.js.map → extension-VNMRKIHI.js.map} +0 -0
  457. /package/dist/cli-bundle/chunks/{files-OBWYYPKM.js.map → files-KAKU57OT.js.map} +0 -0
  458. /package/dist/cli-bundle/chunks/{files-UPCNKEIZ.js.map → files-QB3EYPMO.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{gc-KXK6KBRN.js.map → gc-B747VM4M.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{gc-FA2ONELT.js.map → gc-KNUPLPSW.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{get-PNTSONGB.js.map → get-GMGLIQ5I.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{get-FLHYTOBA.js.map → get-SBL6NHYQ.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{history-6624XISO.js.map → history-6UKSZTRT.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{history-COQTPBEU.js.map → history-XCWRXBXC.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{history-compact-66PSRYL3.js.map → history-compact-IDH7E7VN.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{history-compact-PVS2A3FS.js.map → history-compact-KICKUCR7.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{history-redact-ZRQTI7NB.js.map → history-redact-HKYBTK6X.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{history-redact-DCXAWGTF.js.map → history-redact-JJWH3QWK.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{history-repair-TA3NRIFO.js.map → history-repair-7HWBZKXN.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{history-repair-SEQDFTGW.js.map → history-repair-N5HXKJOI.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{init-ZVE2HMKK.js.map → init-27JLDUO2.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{init-IQJE3EKJ.js.map → init-OQA3TWIS.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{learnings-XC6EMW5E.js.map → learnings-L7VQUSVI.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{learnings-RJPGH2ME.js.map → learnings-Z4GAIZQ5.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{list-OO5P472O.js.map → list-6U3CJVXS.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{list-NJV6WBT4.js.map → list-W5ROBC5U.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{notes-2KWHADK3.js.map → notes-JJDOEDFK.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{notes-FNCDMZW2.js.map → notes-SDCK7BEN.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{plan-MQO5JTSV.js.map → plan-H5HYHMBB.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{plan-CYK2P5PD.js.map → plan-W2B5RYR3.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{register-setup-GAQZZRUA.js.map → register-setup-BZ3TNE3G.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{register-setup-X2R5CFDV.js.map → register-setup-WLFL3OUF.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{restore-F4ALFV4D.js.map → restore-GNI2W5CN.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{restore-E3GZKRRK.js.map → restore-RGFSPG4K.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{schema-3CPFLDAY.js.map → schema-CCDU3RLC.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{schema-7EHBPNXM.js.map → schema-KZASL323.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{search-OBZVYJJ2.js.map → search-7KSOLI2E.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{search-2T3NCCUR.js.map → search-DTL7CO22.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{stats-ULGQACF7.js.map → stats-IOXQMGI6.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{stats-6LVK4JER.js.map → stats-QNV7B2CE.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{telemetry-6G27FLCP.js.map → telemetry-IV5C6JOM.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{telemetry-HHKRTMZA.js.map → telemetry-NHR5RFXT.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{test-PPOLRIBA.js.map → test-4Z37CXW4.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{test-2PP4YBV6.js.map → test-PIL2CEEB.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{test-all-NETGVNM6.js.map → test-all-GRLYHBNP.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{test-all-6Z272JRI.js.map → test-all-MFN4MYCV.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{test-runs-CRPQVMMG.js.map → test-runs-7LRFWWCA.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{test-runs-M24WA6TI.js.map → test-runs-7WCSC3TY.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{update-O7TBOUVQ.js.map → update-I4G34LKJ.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{update-MCPCPMHV.js.map → update-VI5DBZ3G.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{update-many-JSRF5EH5.js.map → update-many-LOTAYUTN.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{update-many-Y3HOL7WA.js.map → update-many-UYMTVF42.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{upgrade-ECB6GH3M.js.map → upgrade-LT2MLLPS.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{upgrade-5RTQVKKE.js.map → upgrade-ZZSC7CLV.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{validate-J6Q444SD.js.map → validate-3XRORNMP.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{validate-MCNMAXVA.js.map → validate-IQIQSKUX.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","sources":["cli/commands/history.ts"],"sourceRoot":"/","sourcesContent":["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 { 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 for (const op of entry.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: entry.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: currentMat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G,YAAY,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3E,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAChD,oBAAoB,GAAG,eAAe,KAAK,eAAe,CAAC;YAC3D,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,MAAM,CAAC,YAAY,GAAG;YACpB,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YACvB,OAAO,EAAE,WAAW,CAAC,MAAM;YAC3B,MAAM;YACN,iBAAiB,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YACtG,iBAAiB,EAAE,eAAe;YAClC,sBAAsB,EAAE,oBAAoB;SAC7C,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","debugId":"50bc01ba-8e6c-54aa-a0f7-81540f1eaddc"}
1
+ {"version":3,"file":"history.js","sources":["cli/commands/history.ts"],"sourceRoot":"/","sourcesContent":["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 }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C,CAAC;QAC9C,MAAM,MAAM,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3E,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAChD,oBAAoB,GAAG,eAAe,KAAK,eAAe,CAAC;YAC3D,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,MAAM,CAAC,YAAY,GAAG;YACpB,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YACvB,OAAO,EAAE,WAAW,CAAC,MAAM;YAC3B,MAAM;YACN,iBAAiB,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YACtG,iBAAiB,EAAE,eAAe;YAClC,sBAAsB,EAAE,oBAAoB;SAC7C,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","debugId":"f01b26e1-3b57-5fac-bb10-e8c7798797e9"}
@@ -26,3 +26,4 @@ export declare function parseLinkedTestRegexList(raw: string | undefined, option
26
26
  export declare function parseLinkedTestMinLines(raw: string | undefined, optionName: string): number | undefined;
27
27
  export declare function parseLinkedTestAssertionEqualsMap(raw: string | undefined, optionName: string): Record<string, string> | undefined;
28
28
  export declare function parseLinkedTestAssertionGteMap(raw: string | undefined, optionName: string): Record<string, number> | undefined;
29
+ export declare function parseLinkedTestJsonEntries(raw: string, optionName: string): LinkedTest[];
@@ -1,9 +1,11 @@
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]="eb90848d-38bb-5b54-86a5-70eaf5ecb5a1")}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]="99dadcea-f21b-5246-8416-e20875abc6d5")}catch(e){}}();
3
3
  import { parseOptionalNumber } from "../../core/item/parse.js";
4
4
  import { EXIT_CODE } from "../../core/shared/constants.js";
5
5
  import { PmCliError } from "../../core/shared/errors.js";
6
6
  import { splitCommaList } from "../../core/shared/split-comma-list.js";
7
+ import { STRUCTURED_LINKED_TEST_KEYS } from "./linked-test-entry.js";
8
+ import { SCOPE_VALUES } from "../../types/index.js";
7
9
  /**
8
10
  * Shared linked-test field parsers used by the `create` and `test` commands.
9
11
  *
@@ -189,5 +191,290 @@ export function parseLinkedTestAssertionGteMap(raw, optionName) {
189
191
  return Object.keys(values).length > 0 ? values : undefined;
190
192
  /* c8 ignore stop */
191
193
  }
194
+ /**
195
+ * Strict JSON linked-test entry parsing for `pm test --add-json` (pm-vcr2).
196
+ *
197
+ * Accepts a JSON object or array of objects whose keys match the structured
198
+ * linked-test fields. Unlike `--add` CSV parsing, command strings are stored
199
+ * verbatim: commas, nested quotes, `--` separators, and shell variables like
200
+ * `$tmp` survive byte-identically.
201
+ */
202
+ const LINKED_TEST_JSON_KEY_SET = new Set(STRUCTURED_LINKED_TEST_KEYS);
203
+ function isPlainObject(value) {
204
+ return typeof value === "object" && value !== null && !Array.isArray(value);
205
+ }
206
+ function normalizeJsonEntryKeys(entry, fail) {
207
+ const normalized = {};
208
+ const unknownKeys = [];
209
+ for (const [key, value] of Object.entries(entry)) {
210
+ const normalizedKey = key.toLowerCase();
211
+ if (!LINKED_TEST_JSON_KEY_SET.has(normalizedKey)) {
212
+ unknownKeys.push(key);
213
+ continue;
214
+ }
215
+ if (Object.hasOwn(normalized, normalizedKey)) {
216
+ throw fail(`provides key "${key}" more than once after case normalization`);
217
+ }
218
+ normalized[normalizedKey] = value;
219
+ }
220
+ if (unknownKeys.length > 0) {
221
+ throw fail(`does not recognize key${unknownKeys.length > 1 ? "s" : ""} ${unknownKeys.map((key) => `"${key}"`).join(", ")}. Allowed keys: ${STRUCTURED_LINKED_TEST_KEYS.join(", ")}.`);
222
+ }
223
+ return normalized;
224
+ }
225
+ function readJsonEntryString(entry, key, fail) {
226
+ if (!Object.hasOwn(entry, key)) {
227
+ return undefined;
228
+ }
229
+ const value = entry[key];
230
+ if (value === undefined) {
231
+ return undefined;
232
+ }
233
+ if (typeof value !== "string") {
234
+ throw fail(`field "${key}" must be a JSON string`);
235
+ }
236
+ return value;
237
+ }
238
+ function readJsonEntryStringList(entry, key, fail) {
239
+ if (!Object.hasOwn(entry, key)) {
240
+ return undefined;
241
+ }
242
+ const value = entry[key];
243
+ if (value === undefined) {
244
+ return undefined;
245
+ }
246
+ const list = typeof value === "string" ? [value] : value;
247
+ if (!Array.isArray(list) || list.some((item) => typeof item !== "string")) {
248
+ throw fail(`field "${key}" must be a string or an array of strings`);
249
+ }
250
+ const values = list.filter((item) => item.length > 0);
251
+ return values.length > 0 ? values : undefined;
252
+ }
253
+ function readJsonEntryRegexList(entry, key, fail) {
254
+ const values = readJsonEntryStringList(entry, key, fail);
255
+ if (!values) {
256
+ return undefined;
257
+ }
258
+ for (const pattern of values) {
259
+ try {
260
+ new RegExp(pattern, "m");
261
+ }
262
+ catch (error) {
263
+ throw fail(
264
+ /* c8 ignore next -- RegExp only throws SyntaxError (an Error); String(error) fallback is defensive. */
265
+ `field "${key}" includes invalid regex "${pattern}": ${error instanceof Error ? error.message : String(error)}`);
266
+ }
267
+ }
268
+ return values;
269
+ }
270
+ function readJsonEntryNumber(value, key, fail) {
271
+ const parsed = typeof value === "number"
272
+ ? value
273
+ : typeof value === "string" && value.trim().length > 0
274
+ ? Number(value.trim())
275
+ : Number.NaN;
276
+ if (typeof value === "boolean" || !Number.isFinite(parsed)) {
277
+ throw fail(`field "${key}" must be a finite number (or numeric string)`);
278
+ }
279
+ return parsed;
280
+ }
281
+ function readJsonEntryTimeoutSeconds(entry, fail) {
282
+ const timeoutSecondsRaw = entry.timeout_seconds;
283
+ const timeoutAliasRaw = entry.timeout;
284
+ if (timeoutSecondsRaw === undefined && timeoutAliasRaw === undefined) {
285
+ return undefined;
286
+ }
287
+ const timeoutSeconds = timeoutSecondsRaw === undefined ? undefined : readJsonEntryNumber(timeoutSecondsRaw, "timeout_seconds", fail);
288
+ const timeoutAlias = timeoutAliasRaw === undefined ? undefined : readJsonEntryNumber(timeoutAliasRaw, "timeout", fail);
289
+ if (timeoutSeconds !== undefined && timeoutAlias !== undefined && timeoutSeconds !== timeoutAlias) {
290
+ throw fail("timeout and timeout_seconds must match when both are provided");
291
+ }
292
+ const timeout = timeoutSeconds ?? timeoutAlias;
293
+ if (!Number.isInteger(timeout) || timeout <= 0) {
294
+ throw fail("timeout_seconds must be a positive integer");
295
+ }
296
+ return timeout;
297
+ }
298
+ function readJsonEntryScope(entry, fail) {
299
+ const value = readJsonEntryString(entry, "scope", fail);
300
+ if (value === undefined) {
301
+ return "project";
302
+ }
303
+ if (!SCOPE_VALUES.includes(value)) {
304
+ throw fail(`field "scope" must be one of: ${SCOPE_VALUES.join(", ")}`);
305
+ }
306
+ return value;
307
+ }
308
+ function readJsonEntryEnvSet(entry, fail) {
309
+ if (!Object.hasOwn(entry, "env_set")) {
310
+ return undefined;
311
+ }
312
+ const value = entry.env_set;
313
+ if (value === undefined) {
314
+ return undefined;
315
+ }
316
+ if (!isPlainObject(value)) {
317
+ throw fail('field "env_set" must be a JSON object mapping environment names to string values');
318
+ }
319
+ const envSet = {};
320
+ for (const [key, entryValue] of Object.entries(value)) {
321
+ if (typeof entryValue !== "string") {
322
+ throw fail(`field "env_set" value for "${key}" must be a string`);
323
+ }
324
+ if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {
325
+ throw fail(`field "env_set" key "${key}" is invalid`);
326
+ }
327
+ if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {
328
+ throw fail(`field "env_set" key "${key}" is reserved for sandbox safety`);
329
+ }
330
+ envSet[key] = entryValue;
331
+ }
332
+ return Object.keys(envSet).length > 0 ? envSet : undefined;
333
+ }
334
+ function readJsonEntryEnvClear(entry, fail) {
335
+ const keys = readJsonEntryStringList(entry, "env_clear", fail);
336
+ if (!keys) {
337
+ return undefined;
338
+ }
339
+ for (const key of keys) {
340
+ if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {
341
+ throw fail(`field "env_clear" key "${key}" is invalid`);
342
+ }
343
+ if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {
344
+ throw fail(`field "env_clear" key "${key}" is reserved for sandbox safety`);
345
+ }
346
+ }
347
+ return keys;
348
+ }
349
+ function readJsonEntryBoolean(entry, key, fail) {
350
+ if (!Object.hasOwn(entry, key)) {
351
+ return undefined;
352
+ }
353
+ const value = entry[key];
354
+ if (value === undefined) {
355
+ return undefined;
356
+ }
357
+ if (typeof value !== "boolean") {
358
+ throw fail(`field "${key}" must be a JSON boolean (true or false)`);
359
+ }
360
+ return value;
361
+ }
362
+ function readJsonEntryMinLines(entry, fail) {
363
+ if (!Object.hasOwn(entry, "assert_stdout_min_lines")) {
364
+ return undefined;
365
+ }
366
+ const value = entry.assert_stdout_min_lines;
367
+ if (value === undefined) {
368
+ return undefined;
369
+ }
370
+ const parsed = readJsonEntryNumber(value, "assert_stdout_min_lines", fail);
371
+ if (!Number.isInteger(parsed) || parsed < 0) {
372
+ throw fail('field "assert_stdout_min_lines" must be an integer >= 0');
373
+ }
374
+ return parsed;
375
+ }
376
+ function readJsonEntryEqualsMap(entry, fail) {
377
+ if (!Object.hasOwn(entry, "assert_json_field_equals")) {
378
+ return undefined;
379
+ }
380
+ const value = entry.assert_json_field_equals;
381
+ if (value === undefined) {
382
+ return undefined;
383
+ }
384
+ if (!isPlainObject(value)) {
385
+ throw fail('field "assert_json_field_equals" must be a JSON object mapping field paths to expected values');
386
+ }
387
+ const values = {};
388
+ for (const [key, entryValue] of Object.entries(value)) {
389
+ if (key.trim().length === 0) {
390
+ throw fail('field "assert_json_field_equals" keys must be non-empty field paths');
391
+ }
392
+ if (typeof entryValue !== "string" && typeof entryValue !== "number" && typeof entryValue !== "boolean") {
393
+ throw fail(`field "assert_json_field_equals" value for "${key}" must be a string, number, or boolean`);
394
+ }
395
+ values[key] = String(entryValue);
396
+ }
397
+ return Object.keys(values).length > 0 ? values : undefined;
398
+ }
399
+ function readJsonEntryGteMap(entry, fail) {
400
+ if (!Object.hasOwn(entry, "assert_json_field_gte")) {
401
+ return undefined;
402
+ }
403
+ const value = entry.assert_json_field_gte;
404
+ if (value === undefined) {
405
+ return undefined;
406
+ }
407
+ if (!isPlainObject(value)) {
408
+ throw fail('field "assert_json_field_gte" must be a JSON object mapping field paths to numeric minimums');
409
+ }
410
+ const values = {};
411
+ for (const [key, entryValue] of Object.entries(value)) {
412
+ if (key.trim().length === 0) {
413
+ throw fail('field "assert_json_field_gte" keys must be non-empty field paths');
414
+ }
415
+ values[key] = readJsonEntryNumber(entryValue, `assert_json_field_gte.${key}`, fail);
416
+ }
417
+ return Object.keys(values).length > 0 ? values : undefined;
418
+ }
419
+ function parseLinkedTestJsonEntry(rawEntry, label, optionName) {
420
+ const fail = (message) => new PmCliError(`${optionName} ${label} ${message}`, EXIT_CODE.USAGE);
421
+ if (!isPlainObject(rawEntry)) {
422
+ throw fail(`must be a JSON object with linked-test fields. Allowed keys: ${STRUCTURED_LINKED_TEST_KEYS.join(", ")}.`);
423
+ }
424
+ const entry = normalizeJsonEntryKeys(rawEntry, fail);
425
+ const commandValue = readJsonEntryString(entry, "command", fail);
426
+ const cmdAlias = readJsonEntryString(entry, "cmd", fail);
427
+ if (commandValue !== undefined && cmdAlias !== undefined && commandValue !== cmdAlias) {
428
+ throw fail("command and cmd must match when both are provided");
429
+ }
430
+ const command = commandValue ?? cmdAlias;
431
+ if (command === undefined || command.trim().length === 0) {
432
+ throw fail('requires a non-empty "command" string');
433
+ }
434
+ const pathValue = readJsonEntryString(entry, "path", fail);
435
+ const pmContextModeValue = readJsonEntryString(entry, "pm_context_mode", fail);
436
+ if (pmContextModeValue !== undefined && !LINKED_TEST_PM_CONTEXT_MODE_VALUES.includes(pmContextModeValue)) {
437
+ throw fail(`field "pm_context_mode" must be one of: ${LINKED_TEST_PM_CONTEXT_MODE_VALUES.join(", ")}`);
438
+ }
439
+ const noteValue = readJsonEntryString(entry, "note", fail);
440
+ return {
441
+ command,
442
+ path: pathValue !== undefined && pathValue.length > 0 ? pathValue : undefined,
443
+ scope: readJsonEntryScope(entry, fail),
444
+ timeout_seconds: readJsonEntryTimeoutSeconds(entry, fail),
445
+ pm_context_mode: pmContextModeValue,
446
+ env_set: readJsonEntryEnvSet(entry, fail),
447
+ env_clear: readJsonEntryEnvClear(entry, fail),
448
+ shared_host_safe: readJsonEntryBoolean(entry, "shared_host_safe", fail),
449
+ assert_stdout_contains: readJsonEntryStringList(entry, "assert_stdout_contains", fail),
450
+ assert_stdout_regex: readJsonEntryRegexList(entry, "assert_stdout_regex", fail),
451
+ assert_stderr_contains: readJsonEntryStringList(entry, "assert_stderr_contains", fail),
452
+ assert_stderr_regex: readJsonEntryRegexList(entry, "assert_stderr_regex", fail),
453
+ assert_stdout_min_lines: readJsonEntryMinLines(entry, fail),
454
+ assert_json_field_equals: readJsonEntryEqualsMap(entry, fail),
455
+ assert_json_field_gte: readJsonEntryGteMap(entry, fail),
456
+ note: noteValue !== undefined && noteValue.trim().length > 0 ? noteValue.trim() : undefined,
457
+ };
458
+ }
459
+ export function parseLinkedTestJsonEntries(raw, optionName) {
460
+ const trimmed = raw.trim();
461
+ if (trimmed.length === 0) {
462
+ throw new PmCliError(`${optionName} requires a JSON object or array of objects describing linked-test entries`, EXIT_CODE.USAGE);
463
+ }
464
+ let parsed;
465
+ try {
466
+ parsed = JSON.parse(trimmed);
467
+ }
468
+ catch (error) {
469
+ throw new PmCliError(
470
+ /* c8 ignore next -- JSON.parse only throws SyntaxError (an Error); String(error) fallback is defensive. */
471
+ `${optionName} value is not valid JSON: ${error instanceof Error ? error.message : String(error)}. Provide a JSON object or array of objects, e.g. '{"command":"node scripts/check.js --flag value, with commas","timeout_seconds":120}'.`, EXIT_CODE.USAGE);
472
+ }
473
+ const entries = Array.isArray(parsed) ? parsed : [parsed];
474
+ if (entries.length === 0) {
475
+ throw new PmCliError(`${optionName} array must include at least one linked-test entry object`, EXIT_CODE.USAGE);
476
+ }
477
+ return entries.map((entry, index) => parseLinkedTestJsonEntry(entry, entries.length > 1 ? `entry ${index + 1}` : "entry", optionName));
478
+ }
192
479
  //# sourceMappingURL=linked-test-parsers.js.map
193
- //# debugId=eb90848d-38bb-5b54-86a5-70eaf5ecb5a1
480
+ //# debugId=99dadcea-f21b-5246-8416-e20875abc6d5
@@ -1 +1 @@
1
- {"version":3,"file":"linked-test-parsers.js","sources":["cli/commands/linked-test-parsers.ts"],"sourceRoot":"/","sourcesContent":["import { parseOptionalNumber } from \"../../core/item/parse.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { splitCommaList } from \"../../core/shared/split-comma-list.js\";\nimport type { LinkedTest } from \"../../types/index.js\";\n\n/**\n * Shared linked-test field parsers used by the `create` and `test` commands.\n *\n * Extracted verbatim from create.ts and test.ts (pm-why9). The two copies were\n * byte-identical apart from their empty-input guard: create called these with\n * raw (untrimmed) values and used `if (!normalized)`; test called them with\n * pre-`.trim()`-ed values and used `if (!raw || raw.trim().length === 0)`.\n *\n * Both reduce to the same observable behaviour when the guard is the plain\n * falsy check used here: create's call sites still pass untrimmed values\n * (behaviour preserved exactly), and test's call sites pre-trim so a\n * whitespace-only value collapses to \"\" and is rejected by `!raw` exactly as\n * before. Error strings and parsing semantics are identical to both originals.\n */\n\nexport const LINKED_TEST_PROTECTED_ENV_KEYS = new Set([\"PM_PATH\", \"PM_GLOBAL_PATH\", \"FORCE_COLOR\"]);\nexport const LINKED_TEST_ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;\nexport const LINKED_TEST_PM_CONTEXT_MODE_VALUES = [\"schema\", \"tracker\", \"auto\"] as const;\nexport type LinkedTestPmContextMode = (typeof LINKED_TEST_PM_CONTEXT_MODE_VALUES)[number];\n\nexport function parseLinkedTestEnvSet(raw: string | undefined, optionName: string): Record<string, string> | undefined {\n if (!raw) {\n return undefined;\n }\n const assignments = raw\n .split(/[;\\n]/)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n if (assignments.length === 0) {\n throw new PmCliError(`${optionName} env_set must include at least one KEY=VALUE assignment`, EXIT_CODE.USAGE);\n }\n const envSet: Record<string, string> = {};\n for (const assignment of assignments) {\n const separatorIndex = assignment.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(\n `${optionName} env_set entries must use KEY=VALUE and be separated by semicolons. Example: env_set=PORT=0;PLAYWRIGHT_BASE_URL=http://127.0.0.1:4173`,\n EXIT_CODE.USAGE,\n );\n }\n const key = assignment.slice(0, separatorIndex).trim();\n const value = assignment.slice(separatorIndex + 1);\n if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {\n throw new PmCliError(`${optionName} env_set key \"${key}\" is invalid`, EXIT_CODE.USAGE);\n }\n if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {\n throw new PmCliError(`${optionName} env_set key \"${key}\" is reserved for sandbox safety`, EXIT_CODE.USAGE);\n }\n envSet[key] = value;\n }\n /* c8 ignore start -- envSet always has >=1 key here (assignments is non-empty and each adds one); the undefined branch is defensive. */\n return Object.keys(envSet).length > 0 ? envSet : undefined;\n /* c8 ignore stop */\n}\n\nexport function parseLinkedTestEnvClear(raw: string | undefined, optionName: string): string[] | undefined {\n if (!raw) {\n return undefined;\n }\n const keys = splitCommaList(raw, { separators: /[;,\\n]/ });\n if (keys.length === 0) {\n throw new PmCliError(`${optionName} env_clear must include at least one environment variable name`, EXIT_CODE.USAGE);\n }\n for (const key of keys) {\n if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {\n throw new PmCliError(`${optionName} env_clear key \"${key}\" is invalid`, EXIT_CODE.USAGE);\n }\n if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {\n throw new PmCliError(`${optionName} env_clear key \"${key}\" is reserved for sandbox safety`, EXIT_CODE.USAGE);\n }\n }\n return keys;\n}\n\nexport function parseLinkedTestBoolean(raw: string | undefined, optionName: string, fieldLabel: string): boolean | undefined {\n if (!raw) {\n return undefined;\n }\n const value = raw.trim().toLowerCase();\n if (value === \"true\" || value === \"1\" || value === \"yes\") {\n return true;\n }\n if (value === \"false\" || value === \"0\" || value === \"no\") {\n return false;\n }\n throw new PmCliError(`${optionName} ${fieldLabel} must be one of true|false|1|0|yes|no`, EXIT_CODE.USAGE);\n}\n\nexport function parseLinkedTestContextMode(\n raw: string | undefined,\n optionName: string,\n): LinkedTest[\"pm_context_mode\"] | undefined {\n if (!raw) {\n return undefined;\n }\n const value = raw.trim().toLowerCase();\n if ((LINKED_TEST_PM_CONTEXT_MODE_VALUES as readonly string[]).includes(value)) {\n return value as LinkedTest[\"pm_context_mode\"];\n }\n throw new PmCliError(\n `${optionName} pm_context_mode must be one of: ${LINKED_TEST_PM_CONTEXT_MODE_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n}\n\nexport function parseLinkedTestStringList(raw: string | undefined): string[] | undefined {\n if (!raw) {\n return undefined;\n }\n const values = splitCommaList(raw, { separators: /[;\\n]/ });\n return values.length > 0 ? values : undefined;\n}\n\nexport function parseLinkedTestRegexList(raw: string | undefined, optionName: string, fieldLabel: string): string[] | undefined {\n const values = parseLinkedTestStringList(raw);\n if (!values || values.length === 0) {\n return undefined;\n }\n for (const pattern of values) {\n try {\n // Validate regex syntax early so malformed assertions fail at parse time.\n // User-provided, per-item patterns only run during local CLI validation.\n new RegExp(pattern, \"m\");\n } catch (error: unknown) {\n throw new PmCliError(\n /* c8 ignore next -- RegExp only throws SyntaxError (an Error); String(error) fallback is defensive. */\n `${optionName} ${fieldLabel} includes invalid regex \"${pattern}\": ${error instanceof Error ? error.message : String(error)}`,\n EXIT_CODE.USAGE,\n );\n }\n }\n return values;\n}\n\nexport function parseLinkedTestMinLines(raw: string | undefined, optionName: string): number | undefined {\n if (!raw) {\n return undefined;\n }\n const parsed = parseOptionalNumber(raw, \"assert_stdout_min_lines\");\n if (!Number.isInteger(parsed) || parsed < 0) {\n throw new PmCliError(`${optionName} assert_stdout_min_lines must be an integer >= 0`, EXIT_CODE.USAGE);\n }\n return parsed;\n}\n\nexport function parseLinkedTestAssertionEqualsMap(raw: string | undefined, optionName: string): Record<string, string> | undefined {\n if (!raw) {\n return undefined;\n }\n const assignments = raw\n .split(/[;\\n]/)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n if (assignments.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_equals must include at least one path=value assignment`, EXIT_CODE.USAGE);\n }\n const values: Record<string, string> = {};\n for (const assignment of assignments) {\n const separatorIndex = assignment.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(\n `${optionName} assert_json_field_equals entries must use path=value and be separated by semicolons`,\n EXIT_CODE.USAGE,\n );\n }\n const key = assignment.slice(0, separatorIndex).trim();\n const value = assignment.slice(separatorIndex + 1).trim();\n if (key.length === 0 || value.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_equals entries must include non-empty path and value`, EXIT_CODE.USAGE);\n }\n values[key] = value;\n }\n /* c8 ignore start -- values always has >=1 key here (assignments is non-empty and each adds one); the undefined branch is defensive. */\n return Object.keys(values).length > 0 ? values : undefined;\n /* c8 ignore stop */\n}\n\nexport function parseLinkedTestAssertionGteMap(raw: string | undefined, optionName: string): Record<string, number> | undefined {\n if (!raw) {\n return undefined;\n }\n const assignments = raw\n .split(/[;\\n]/)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n if (assignments.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_gte must include at least one path=value assignment`, EXIT_CODE.USAGE);\n }\n const values: Record<string, number> = {};\n for (const assignment of assignments) {\n const separatorIndex = assignment.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(\n `${optionName} assert_json_field_gte entries must use path=value and be separated by semicolons`,\n EXIT_CODE.USAGE,\n );\n }\n const key = assignment.slice(0, separatorIndex).trim();\n const valueRaw = assignment.slice(separatorIndex + 1).trim();\n if (key.length === 0 || valueRaw.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_gte entries must include non-empty path and value`, EXIT_CODE.USAGE);\n }\n const value = Number.parseFloat(valueRaw);\n if (!Number.isFinite(value)) {\n throw new PmCliError(`${optionName} assert_json_field_gte value for \"${key}\" must be numeric`, EXIT_CODE.USAGE);\n }\n values[key] = value;\n }\n /* c8 ignore start -- values always has >=1 key here (assignments is non-empty and each adds one); the undefined branch is defensive. */\n return Object.keys(values).length > 0 ? values : undefined;\n /* c8 ignore stop */\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGvE;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC;AACpG,MAAM,CAAC,MAAM,4BAA4B,GAAG,0BAA0B,CAAC;AACvE,MAAM,CAAC,MAAM,kCAAk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AAE,CAAC;YAC9C,MAAM,IAAI,UAAU,CAAC,GAAG,UAAU,sEAAsE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAC7H,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,UAAU,CAAC,GAAG,UAAU,qCAAqC,GAAG,mBAAmB,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAClH,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,wIAAwI;IACxI,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,oBAAoB;AACtB,CAAC","debugId":"eb90848d-38bb-5b54-86a5-70eaf5ecb5a1"}
1
+ {"version":3,"file":"linked-test-parsers.js","sources":["cli/commands/linked-test-parsers.ts"],"sourceRoot":"/","sourcesContent":["import { parseOptionalNumber } from \"../../core/item/parse.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { splitCommaList } from \"../../core/shared/split-comma-list.js\";\nimport { STRUCTURED_LINKED_TEST_KEYS } from \"./linked-test-entry.js\";\nimport { SCOPE_VALUES } from \"../../types/index.js\";\nimport type { LinkedTest, LinkScope } from \"../../types/index.js\";\n\n/**\n * Shared linked-test field parsers used by the `create` and `test` commands.\n *\n * Extracted verbatim from create.ts and test.ts (pm-why9). The two copies were\n * byte-identical apart from their empty-input guard: create called these with\n * raw (untrimmed) values and used `if (!normalized)`; test called them with\n * pre-`.trim()`-ed values and used `if (!raw || raw.trim().length === 0)`.\n *\n * Both reduce to the same observable behaviour when the guard is the plain\n * falsy check used here: create's call sites still pass untrimmed values\n * (behaviour preserved exactly), and test's call sites pre-trim so a\n * whitespace-only value collapses to \"\" and is rejected by `!raw` exactly as\n * before. Error strings and parsing semantics are identical to both originals.\n */\n\nexport const LINKED_TEST_PROTECTED_ENV_KEYS = new Set([\"PM_PATH\", \"PM_GLOBAL_PATH\", \"FORCE_COLOR\"]);\nexport const LINKED_TEST_ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;\nexport const LINKED_TEST_PM_CONTEXT_MODE_VALUES = [\"schema\", \"tracker\", \"auto\"] as const;\nexport type LinkedTestPmContextMode = (typeof LINKED_TEST_PM_CONTEXT_MODE_VALUES)[number];\n\nexport function parseLinkedTestEnvSet(raw: string | undefined, optionName: string): Record<string, string> | undefined {\n if (!raw) {\n return undefined;\n }\n const assignments = raw\n .split(/[;\\n]/)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n if (assignments.length === 0) {\n throw new PmCliError(`${optionName} env_set must include at least one KEY=VALUE assignment`, EXIT_CODE.USAGE);\n }\n const envSet: Record<string, string> = {};\n for (const assignment of assignments) {\n const separatorIndex = assignment.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(\n `${optionName} env_set entries must use KEY=VALUE and be separated by semicolons. Example: env_set=PORT=0;PLAYWRIGHT_BASE_URL=http://127.0.0.1:4173`,\n EXIT_CODE.USAGE,\n );\n }\n const key = assignment.slice(0, separatorIndex).trim();\n const value = assignment.slice(separatorIndex + 1);\n if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {\n throw new PmCliError(`${optionName} env_set key \"${key}\" is invalid`, EXIT_CODE.USAGE);\n }\n if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {\n throw new PmCliError(`${optionName} env_set key \"${key}\" is reserved for sandbox safety`, EXIT_CODE.USAGE);\n }\n envSet[key] = value;\n }\n /* c8 ignore start -- envSet always has >=1 key here (assignments is non-empty and each adds one); the undefined branch is defensive. */\n return Object.keys(envSet).length > 0 ? envSet : undefined;\n /* c8 ignore stop */\n}\n\nexport function parseLinkedTestEnvClear(raw: string | undefined, optionName: string): string[] | undefined {\n if (!raw) {\n return undefined;\n }\n const keys = splitCommaList(raw, { separators: /[;,\\n]/ });\n if (keys.length === 0) {\n throw new PmCliError(`${optionName} env_clear must include at least one environment variable name`, EXIT_CODE.USAGE);\n }\n for (const key of keys) {\n if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {\n throw new PmCliError(`${optionName} env_clear key \"${key}\" is invalid`, EXIT_CODE.USAGE);\n }\n if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {\n throw new PmCliError(`${optionName} env_clear key \"${key}\" is reserved for sandbox safety`, EXIT_CODE.USAGE);\n }\n }\n return keys;\n}\n\nexport function parseLinkedTestBoolean(raw: string | undefined, optionName: string, fieldLabel: string): boolean | undefined {\n if (!raw) {\n return undefined;\n }\n const value = raw.trim().toLowerCase();\n if (value === \"true\" || value === \"1\" || value === \"yes\") {\n return true;\n }\n if (value === \"false\" || value === \"0\" || value === \"no\") {\n return false;\n }\n throw new PmCliError(`${optionName} ${fieldLabel} must be one of true|false|1|0|yes|no`, EXIT_CODE.USAGE);\n}\n\nexport function parseLinkedTestContextMode(\n raw: string | undefined,\n optionName: string,\n): LinkedTest[\"pm_context_mode\"] | undefined {\n if (!raw) {\n return undefined;\n }\n const value = raw.trim().toLowerCase();\n if ((LINKED_TEST_PM_CONTEXT_MODE_VALUES as readonly string[]).includes(value)) {\n return value as LinkedTest[\"pm_context_mode\"];\n }\n throw new PmCliError(\n `${optionName} pm_context_mode must be one of: ${LINKED_TEST_PM_CONTEXT_MODE_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n}\n\nexport function parseLinkedTestStringList(raw: string | undefined): string[] | undefined {\n if (!raw) {\n return undefined;\n }\n const values = splitCommaList(raw, { separators: /[;\\n]/ });\n return values.length > 0 ? values : undefined;\n}\n\nexport function parseLinkedTestRegexList(raw: string | undefined, optionName: string, fieldLabel: string): string[] | undefined {\n const values = parseLinkedTestStringList(raw);\n if (!values || values.length === 0) {\n return undefined;\n }\n for (const pattern of values) {\n try {\n // Validate regex syntax early so malformed assertions fail at parse time.\n // User-provided, per-item patterns only run during local CLI validation.\n new RegExp(pattern, \"m\");\n } catch (error: unknown) {\n throw new PmCliError(\n /* c8 ignore next -- RegExp only throws SyntaxError (an Error); String(error) fallback is defensive. */\n `${optionName} ${fieldLabel} includes invalid regex \"${pattern}\": ${error instanceof Error ? error.message : String(error)}`,\n EXIT_CODE.USAGE,\n );\n }\n }\n return values;\n}\n\nexport function parseLinkedTestMinLines(raw: string | undefined, optionName: string): number | undefined {\n if (!raw) {\n return undefined;\n }\n const parsed = parseOptionalNumber(raw, \"assert_stdout_min_lines\");\n if (!Number.isInteger(parsed) || parsed < 0) {\n throw new PmCliError(`${optionName} assert_stdout_min_lines must be an integer >= 0`, EXIT_CODE.USAGE);\n }\n return parsed;\n}\n\nexport function parseLinkedTestAssertionEqualsMap(raw: string | undefined, optionName: string): Record<string, string> | undefined {\n if (!raw) {\n return undefined;\n }\n const assignments = raw\n .split(/[;\\n]/)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n if (assignments.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_equals must include at least one path=value assignment`, EXIT_CODE.USAGE);\n }\n const values: Record<string, string> = {};\n for (const assignment of assignments) {\n const separatorIndex = assignment.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(\n `${optionName} assert_json_field_equals entries must use path=value and be separated by semicolons`,\n EXIT_CODE.USAGE,\n );\n }\n const key = assignment.slice(0, separatorIndex).trim();\n const value = assignment.slice(separatorIndex + 1).trim();\n if (key.length === 0 || value.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_equals entries must include non-empty path and value`, EXIT_CODE.USAGE);\n }\n values[key] = value;\n }\n /* c8 ignore start -- values always has >=1 key here (assignments is non-empty and each adds one); the undefined branch is defensive. */\n return Object.keys(values).length > 0 ? values : undefined;\n /* c8 ignore stop */\n}\n\nexport function parseLinkedTestAssertionGteMap(raw: string | undefined, optionName: string): Record<string, number> | undefined {\n if (!raw) {\n return undefined;\n }\n const assignments = raw\n .split(/[;\\n]/)\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n if (assignments.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_gte must include at least one path=value assignment`, EXIT_CODE.USAGE);\n }\n const values: Record<string, number> = {};\n for (const assignment of assignments) {\n const separatorIndex = assignment.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(\n `${optionName} assert_json_field_gte entries must use path=value and be separated by semicolons`,\n EXIT_CODE.USAGE,\n );\n }\n const key = assignment.slice(0, separatorIndex).trim();\n const valueRaw = assignment.slice(separatorIndex + 1).trim();\n if (key.length === 0 || valueRaw.length === 0) {\n throw new PmCliError(`${optionName} assert_json_field_gte entries must include non-empty path and value`, EXIT_CODE.USAGE);\n }\n const value = Number.parseFloat(valueRaw);\n if (!Number.isFinite(value)) {\n throw new PmCliError(`${optionName} assert_json_field_gte value for \"${key}\" must be numeric`, EXIT_CODE.USAGE);\n }\n values[key] = value;\n }\n /* c8 ignore start -- values always has >=1 key here (assignments is non-empty and each adds one); the undefined branch is defensive. */\n return Object.keys(values).length > 0 ? values : undefined;\n /* c8 ignore stop */\n}\n\n/**\n * Strict JSON linked-test entry parsing for `pm test --add-json` (pm-vcr2).\n *\n * Accepts a JSON object or array of objects whose keys match the structured\n * linked-test fields. Unlike `--add` CSV parsing, command strings are stored\n * verbatim: commas, nested quotes, `--` separators, and shell variables like\n * `$tmp` survive byte-identically.\n */\n\nconst LINKED_TEST_JSON_KEY_SET = new Set<string>(STRUCTURED_LINKED_TEST_KEYS);\n\ntype JsonRecord = Record<string, unknown>;\n\nfunction isPlainObject(value: unknown): value is JsonRecord {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeJsonEntryKeys(entry: JsonRecord, fail: (message: string) => PmCliError): JsonRecord {\n const normalized: JsonRecord = {};\n const unknownKeys: string[] = [];\n for (const [key, value] of Object.entries(entry)) {\n const normalizedKey = key.toLowerCase();\n if (!LINKED_TEST_JSON_KEY_SET.has(normalizedKey)) {\n unknownKeys.push(key);\n continue;\n }\n if (Object.hasOwn(normalized, normalizedKey)) {\n throw fail(`provides key \"${key}\" more than once after case normalization`);\n }\n normalized[normalizedKey] = value;\n }\n if (unknownKeys.length > 0) {\n throw fail(\n `does not recognize key${unknownKeys.length > 1 ? \"s\" : \"\"} ${unknownKeys.map((key) => `\"${key}\"`).join(\", \")}. Allowed keys: ${STRUCTURED_LINKED_TEST_KEYS.join(\", \")}.`,\n );\n }\n return normalized;\n}\n\nfunction readJsonEntryString(entry: JsonRecord, key: string, fail: (message: string) => PmCliError): string | undefined {\n if (!Object.hasOwn(entry, key)) {\n return undefined;\n }\n const value = entry[key];\n if (value === undefined) {\n return undefined;\n }\n if (typeof value !== \"string\") {\n throw fail(`field \"${key}\" must be a JSON string`);\n }\n return value;\n}\n\nfunction readJsonEntryStringList(entry: JsonRecord, key: string, fail: (message: string) => PmCliError): string[] | undefined {\n if (!Object.hasOwn(entry, key)) {\n return undefined;\n }\n const value = entry[key];\n if (value === undefined) {\n return undefined;\n }\n const list = typeof value === \"string\" ? [value] : value;\n if (!Array.isArray(list) || list.some((item) => typeof item !== \"string\")) {\n throw fail(`field \"${key}\" must be a string or an array of strings`);\n }\n const values = (list as string[]).filter((item) => item.length > 0);\n return values.length > 0 ? values : undefined;\n}\n\nfunction readJsonEntryRegexList(entry: JsonRecord, key: string, fail: (message: string) => PmCliError): string[] | undefined {\n const values = readJsonEntryStringList(entry, key, fail);\n if (!values) {\n return undefined;\n }\n for (const pattern of values) {\n try {\n new RegExp(pattern, \"m\");\n } catch (error: unknown) {\n throw fail(\n /* c8 ignore next -- RegExp only throws SyntaxError (an Error); String(error) fallback is defensive. */\n `field \"${key}\" includes invalid regex \"${pattern}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n return values;\n}\n\nfunction readJsonEntryNumber(value: unknown, key: string, fail: (message: string) => PmCliError): number {\n const parsed =\n typeof value === \"number\"\n ? value\n : typeof value === \"string\" && value.trim().length > 0\n ? Number(value.trim())\n : Number.NaN;\n if (typeof value === \"boolean\" || !Number.isFinite(parsed)) {\n throw fail(`field \"${key}\" must be a finite number (or numeric string)`);\n }\n return parsed;\n}\n\nfunction readJsonEntryTimeoutSeconds(entry: JsonRecord, fail: (message: string) => PmCliError): number | undefined {\n const timeoutSecondsRaw = entry.timeout_seconds;\n const timeoutAliasRaw = entry.timeout;\n if (timeoutSecondsRaw === undefined && timeoutAliasRaw === undefined) {\n return undefined;\n }\n const timeoutSeconds = timeoutSecondsRaw === undefined ? undefined : readJsonEntryNumber(timeoutSecondsRaw, \"timeout_seconds\", fail);\n const timeoutAlias = timeoutAliasRaw === undefined ? undefined : readJsonEntryNumber(timeoutAliasRaw, \"timeout\", fail);\n if (timeoutSeconds !== undefined && timeoutAlias !== undefined && timeoutSeconds !== timeoutAlias) {\n throw fail(\"timeout and timeout_seconds must match when both are provided\");\n }\n const timeout = timeoutSeconds ?? (timeoutAlias as number);\n if (!Number.isInteger(timeout) || timeout <= 0) {\n throw fail(\"timeout_seconds must be a positive integer\");\n }\n return timeout;\n}\n\nfunction readJsonEntryScope(entry: JsonRecord, fail: (message: string) => PmCliError): LinkScope {\n const value = readJsonEntryString(entry, \"scope\", fail);\n if (value === undefined) {\n return \"project\";\n }\n if (!(SCOPE_VALUES as readonly string[]).includes(value)) {\n throw fail(`field \"scope\" must be one of: ${SCOPE_VALUES.join(\", \")}`);\n }\n return value as LinkScope;\n}\n\nfunction readJsonEntryEnvSet(entry: JsonRecord, fail: (message: string) => PmCliError): Record<string, string> | undefined {\n if (!Object.hasOwn(entry, \"env_set\")) {\n return undefined;\n }\n const value = entry.env_set;\n if (value === undefined) {\n return undefined;\n }\n if (!isPlainObject(value)) {\n throw fail('field \"env_set\" must be a JSON object mapping environment names to string values');\n }\n const envSet: Record<string, string> = {};\n for (const [key, entryValue] of Object.entries(value)) {\n if (typeof entryValue !== \"string\") {\n throw fail(`field \"env_set\" value for \"${key}\" must be a string`);\n }\n if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {\n throw fail(`field \"env_set\" key \"${key}\" is invalid`);\n }\n if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {\n throw fail(`field \"env_set\" key \"${key}\" is reserved for sandbox safety`);\n }\n envSet[key] = entryValue;\n }\n return Object.keys(envSet).length > 0 ? envSet : undefined;\n}\n\nfunction readJsonEntryEnvClear(entry: JsonRecord, fail: (message: string) => PmCliError): string[] | undefined {\n const keys = readJsonEntryStringList(entry, \"env_clear\", fail);\n if (!keys) {\n return undefined;\n }\n for (const key of keys) {\n if (!LINKED_TEST_ENV_NAME_PATTERN.test(key)) {\n throw fail(`field \"env_clear\" key \"${key}\" is invalid`);\n }\n if (LINKED_TEST_PROTECTED_ENV_KEYS.has(key.toUpperCase())) {\n throw fail(`field \"env_clear\" key \"${key}\" is reserved for sandbox safety`);\n }\n }\n return keys;\n}\n\nfunction readJsonEntryBoolean(entry: JsonRecord, key: string, fail: (message: string) => PmCliError): boolean | undefined {\n if (!Object.hasOwn(entry, key)) {\n return undefined;\n }\n const value = entry[key];\n if (value === undefined) {\n return undefined;\n }\n if (typeof value !== \"boolean\") {\n throw fail(`field \"${key}\" must be a JSON boolean (true or false)`);\n }\n return value;\n}\n\nfunction readJsonEntryMinLines(entry: JsonRecord, fail: (message: string) => PmCliError): number | undefined {\n if (!Object.hasOwn(entry, \"assert_stdout_min_lines\")) {\n return undefined;\n }\n const value = entry.assert_stdout_min_lines;\n if (value === undefined) {\n return undefined;\n }\n const parsed = readJsonEntryNumber(value, \"assert_stdout_min_lines\", fail);\n if (!Number.isInteger(parsed) || parsed < 0) {\n throw fail('field \"assert_stdout_min_lines\" must be an integer >= 0');\n }\n return parsed;\n}\n\nfunction readJsonEntryEqualsMap(entry: JsonRecord, fail: (message: string) => PmCliError): Record<string, string> | undefined {\n if (!Object.hasOwn(entry, \"assert_json_field_equals\")) {\n return undefined;\n }\n const value = entry.assert_json_field_equals;\n if (value === undefined) {\n return undefined;\n }\n if (!isPlainObject(value)) {\n throw fail('field \"assert_json_field_equals\" must be a JSON object mapping field paths to expected values');\n }\n const values: Record<string, string> = {};\n for (const [key, entryValue] of Object.entries(value)) {\n if (key.trim().length === 0) {\n throw fail('field \"assert_json_field_equals\" keys must be non-empty field paths');\n }\n if (typeof entryValue !== \"string\" && typeof entryValue !== \"number\" && typeof entryValue !== \"boolean\") {\n throw fail(`field \"assert_json_field_equals\" value for \"${key}\" must be a string, number, or boolean`);\n }\n values[key] = String(entryValue);\n }\n return Object.keys(values).length > 0 ? values : undefined;\n}\n\nfunction readJsonEntryGteMap(entry: JsonRecord, fail: (message: string) => PmCliError): Record<string, number> | undefined {\n if (!Object.hasOwn(entry, \"assert_json_field_gte\")) {\n return undefined;\n }\n const value = entry.assert_json_field_gte;\n if (value === undefined) {\n return undefined;\n }\n if (!isPlainObject(value)) {\n throw fail('field \"assert_json_field_gte\" must be a JSON object mapping field paths to numeric minimums');\n }\n const values: Record<string, number> = {};\n for (const [key, entryValue] of Object.entries(value)) {\n if (key.trim().length === 0) {\n throw fail('field \"assert_json_field_gte\" keys must be non-empty field paths');\n }\n values[key] = readJsonEntryNumber(entryValue, `assert_json_field_gte.${key}`, fail);\n }\n return Object.keys(values).length > 0 ? values : undefined;\n}\n\nfunction parseLinkedTestJsonEntry(rawEntry: unknown, label: string, optionName: string): LinkedTest {\n const fail = (message: string): PmCliError => new PmCliError(`${optionName} ${label} ${message}`, EXIT_CODE.USAGE);\n if (!isPlainObject(rawEntry)) {\n throw fail(`must be a JSON object with linked-test fields. Allowed keys: ${STRUCTURED_LINKED_TEST_KEYS.join(\", \")}.`);\n }\n const entry = normalizeJsonEntryKeys(rawEntry, fail);\n const commandValue = readJsonEntryString(entry, \"command\", fail);\n const cmdAlias = readJsonEntryString(entry, \"cmd\", fail);\n if (commandValue !== undefined && cmdAlias !== undefined && commandValue !== cmdAlias) {\n throw fail(\"command and cmd must match when both are provided\");\n }\n const command = commandValue ?? cmdAlias;\n if (command === undefined || command.trim().length === 0) {\n throw fail('requires a non-empty \"command\" string');\n }\n const pathValue = readJsonEntryString(entry, \"path\", fail);\n const pmContextModeValue = readJsonEntryString(entry, \"pm_context_mode\", fail);\n if (pmContextModeValue !== undefined && !(LINKED_TEST_PM_CONTEXT_MODE_VALUES as readonly string[]).includes(pmContextModeValue)) {\n throw fail(`field \"pm_context_mode\" must be one of: ${LINKED_TEST_PM_CONTEXT_MODE_VALUES.join(\", \")}`);\n }\n const noteValue = readJsonEntryString(entry, \"note\", fail);\n return {\n command,\n path: pathValue !== undefined && pathValue.length > 0 ? pathValue : undefined,\n scope: readJsonEntryScope(entry, fail),\n timeout_seconds: readJsonEntryTimeoutSeconds(entry, fail),\n pm_context_mode: pmContextModeValue as LinkedTest[\"pm_context_mode\"],\n env_set: readJsonEntryEnvSet(entry, fail),\n env_clear: readJsonEntryEnvClear(entry, fail),\n shared_host_safe: readJsonEntryBoolean(entry, \"shared_host_safe\", fail),\n assert_stdout_contains: readJsonEntryStringList(entry, \"assert_stdout_contains\", fail),\n assert_stdout_regex: readJsonEntryRegexList(entry, \"assert_stdout_regex\", fail),\n assert_stderr_contains: readJsonEntryStringList(entry, \"assert_stderr_contains\", fail),\n assert_stderr_regex: readJsonEntryRegexList(entry, \"assert_stderr_regex\", fail),\n assert_stdout_min_lines: readJsonEntryMinLines(entry, fail),\n assert_json_field_equals: readJsonEntryEqualsMap(entry, fail),\n assert_json_field_gte: readJsonEntryGteMap(entry, fail),\n note: noteValue !== undefined && noteValue.trim().length > 0 ? noteValue.trim() : undefined,\n };\n}\n\nexport function parseLinkedTestJsonEntries(raw: string, optionName: string): LinkedTest[] {\n const trimmed = raw.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(\n `${optionName} requires a JSON object or array of objects describing linked-test entries`,\n EXIT_CODE.USAGE,\n );\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed) as unknown;\n } catch (error: unknown) {\n throw new PmCliError(\n /* c8 ignore next -- JSON.parse only throws SyntaxError (an Error); String(error) fallback is defensive. */\n `${optionName} value is not valid JSON: ${error instanceof Error ? error.message : String(error)}. Provide a JSON object or array of objects, e.g. '{\"command\":\"node scripts/check.js --flag value, with commas\",\"timeout_seconds\":120}'.`,\n EXIT_CODE.USAGE,\n );\n }\n const entries = Array.isArray(parsed) ? parsed : [parsed];\n if (entries.length === 0) {\n throw new PmCliError(`${optionName} array must include at least one linked-test entry object`, EXIT_CODE.USAGE);\n }\n return entries.map((entry, index) =>\n parseLinkedTestJsonEntry(entry, entries.length > 1 ? `entry ${index + 1}` : \"entry\", optionName),\n );\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC;AACpG,MAAM,CAAC,MAAM,4BAA4B,GAAG,0BAA0B,CAAC;AACvE,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AAGzF,MAAM,UAAU,qBAAqB,CAAC,GAAuB,EAAE,UAAkB;IAC/E,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAA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,2DAA2D,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAClH,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAClC,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,UAAU,CAAC,CACjG,CAAC;AACJ,CAAC","debugId":"99dadcea-f21b-5246-8416-e20875abc6d5"}
@@ -2,6 +2,7 @@ import type { GlobalOptions } from "../../core/shared/command-types.js";
2
2
  export interface ReindexOptions {
3
3
  mode?: string;
4
4
  progress?: boolean;
5
+ full?: boolean;
5
6
  }
6
7
  export interface ReindexResult {
7
8
  ok: boolean;
@@ -1,5 +1,5 @@
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]="f9cdad1c-8776-5598-b28a-e7d0e896bcb4")}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]="8b10a718-9470-5745-96b0-ca5d0e9f6404")}catch(e){}}();
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
@@ -26,6 +26,7 @@ import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
26
26
  import { readSettings } from "../../core/store/settings.js";
27
27
  const MANIFEST_PATH = "index/manifest.json";
28
28
  const EMBEDDINGS_PATH = "search/embeddings.jsonl";
29
+ const EMBEDDING_MIGRATION_REINDEX_HINT = "Provider or model has changed since last index. Run pm reindex --mode semantic to rebuild.";
29
30
  function shouldEmitReindexProgress(options) {
30
31
  return options.progress === true || process.stderr.isTTY === true;
31
32
  }
@@ -306,6 +307,7 @@ async function pruneReindexOrphanVectors(activeVectorStore, extensionVectorAdapt
306
307
  export async function runReindex(options, global) {
307
308
  const requestedMode = parseMode(options.mode);
308
309
  const progressEnabled = shouldEmitReindexProgress(options);
310
+ const forceFullSemantic = options.full === true;
309
311
  emitReindexProgress(progressEnabled, `start mode=${requestedMode}`);
310
312
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
311
313
  if (!(await pathExists(getSettingsPath(pmRoot)))) {
@@ -388,6 +390,27 @@ export async function runReindex(options, global) {
388
390
  vector_upserted: 0,
389
391
  batches_completed: 0,
390
392
  };
393
+ if (mode === "keyword") {
394
+ const ledger = await readVectorizationStatusLedger(pmRoot);
395
+ reindexWarnings.push(...ledger.warnings);
396
+ if (forceFullSemantic) {
397
+ reindexWarnings.push("search_semantic_reindex_full_ignored:mode_keyword");
398
+ }
399
+ if (ledger.embedding) {
400
+ const currentEmbeddingIdentity = (() => {
401
+ try {
402
+ return resolveReindexEmbeddingIdentity(settings, resolveEmbeddingProviders(settings).active, extensionEmbedding);
403
+ }
404
+ catch {
405
+ return null;
406
+ }
407
+ })();
408
+ if (currentEmbeddingIdentity && hasVectorizationEmbeddingIdentityChanged(ledger.embedding, currentEmbeddingIdentity)) {
409
+ reindexWarnings.push("search_semantic_reindex_requires_rebuild:embedding_identity_changed");
410
+ reindexWarnings.push(EMBEDDING_MIGRATION_REINDEX_HINT);
411
+ }
412
+ }
413
+ }
391
414
  if (mode !== "keyword" && metadataDocuments.length > 0) {
392
415
  const ledger = await readVectorizationStatusLedger(pmRoot);
393
416
  semanticWarnings.push(...ledger.warnings);
@@ -395,8 +418,13 @@ export async function runReindex(options, global) {
395
418
  const currentIds = new Set(metadataDocuments.map((document) => document.metadata.id));
396
419
  const orphanIds = collectLedgerOrphanIds(ledger.entries, currentIds);
397
420
  let resetRequired = hasVectorizationEmbeddingIdentityChanged(ledger.embedding, embeddingIdentity);
398
- let staleIds = new Set((resetRequired ? metadataDocuments : metadataDocuments.filter((document) => ledger.entries[document.metadata.id] !== document.metadata.updated_at))
399
- .map((document) => document.metadata.id));
421
+ if (forceFullSemantic && !resetRequired) {
422
+ semanticWarnings.push("search_semantic_reindex_full_rebuild_forced");
423
+ }
424
+ const staleSourceDocuments = forceFullSemantic || resetRequired
425
+ ? metadataDocuments
426
+ : metadataDocuments.filter((document) => ledger.entries[document.metadata.id] !== document.metadata.updated_at);
427
+ let staleIds = new Set(staleSourceDocuments.map((document) => document.metadata.id));
400
428
  let staleDocuments = staleIds.size > 0
401
429
  ? await hydrateDocuments(pmRoot, documentCandidates, settings.schema, reindexWarnings, staleIds)
402
430
  : [];
@@ -406,6 +434,7 @@ export async function runReindex(options, global) {
406
434
  for (const document of metadataDocuments) {
407
435
  vectorizationLedgerEntries[document.metadata.id] = document.metadata.updated_at;
408
436
  }
437
+ emitReindexProgress(progressEnabled, `semantic_stale_items stale=${staleDocuments.length} total=${metadataDocuments.length} unchanged=${freshDocuments} full=${forceFullSemantic || resetRequired}`);
409
438
  if (staleDocuments.length === 0) {
410
439
  emitReindexProgress(progressEnabled, `embedding_skipped unchanged_items=${freshDocuments}`);
411
440
  semanticWarnings.push(`search_semantic_reindex_skipped_unchanged:count=${freshDocuments}`);
@@ -542,4 +571,4 @@ export async function runReindex(options, global) {
542
571
  }
543
572
  }
544
573
  //# sourceMappingURL=reindex.js.map
545
- //# debugId=f9cdad1c-8776-5598-b28a-e7d0e896bcb4
574
+ //# debugId=8b10a718-9470-5745-96b0-ca5d0e9f6404