@unbrained/pm-cli 2026.7.19 → 2026.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (600) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/AGENTS.md +2 -0
  3. package/CHANGELOG.md +36 -0
  4. package/dist/cli/commands/append.js +13 -6
  5. package/dist/cli/commands/append.js.map +1 -1
  6. package/dist/cli/commands/calendar.d.ts +1 -1
  7. package/dist/cli/commands/calendar.js +2 -2
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/comments.js +2 -5
  10. package/dist/cli/commands/comments.js.map +1 -1
  11. package/dist/cli/commands/completion.js +11 -3
  12. package/dist/cli/commands/completion.js.map +1 -1
  13. package/dist/cli/commands/context.d.ts +1 -1
  14. package/dist/cli/commands/context.js +2 -2
  15. package/dist/cli/commands/context.js.map +1 -1
  16. package/dist/cli/commands/contracts.js +4 -3
  17. package/dist/cli/commands/contracts.js.map +1 -1
  18. package/dist/cli/commands/copy.js +5 -3
  19. package/dist/cli/commands/copy.js.map +1 -1
  20. package/dist/cli/commands/create.d.ts +3 -1
  21. package/dist/cli/commands/create.js +5 -3
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/merge.d.ts +8 -0
  24. package/dist/cli/commands/merge.js +12 -0
  25. package/dist/cli/commands/merge.js.map +1 -0
  26. package/dist/cli/commands/plan.d.ts +1 -1
  27. package/dist/cli/commands/plan.js +2 -2
  28. package/dist/cli/commands/plan.js.map +1 -1
  29. package/dist/cli/commands/update-many.d.ts +5 -0
  30. package/dist/cli/commands/update-many.js +81 -6
  31. package/dist/cli/commands/update-many.js.map +1 -1
  32. package/dist/cli/commands/update.d.ts +5 -1
  33. package/dist/cli/commands/update.js +50 -4
  34. package/dist/cli/commands/update.js.map +1 -1
  35. package/dist/cli/register-list-query.js +14 -2
  36. package/dist/cli/register-list-query.js.map +1 -1
  37. package/dist/cli/register-mutation.js +61 -2
  38. package/dist/cli/register-mutation.js.map +1 -1
  39. package/dist/cli/register-operations.js +5 -3
  40. package/dist/cli/register-operations.js.map +1 -1
  41. package/dist/cli/registration-helpers.js +4 -2
  42. package/dist/cli/registration-helpers.js.map +1 -1
  43. package/dist/cli-bundle/bundle-manifest.json +365 -333
  44. package/dist/cli-bundle/chunks/{append-MBXHNWSX.js → append-E6V54WOQ.js} +5 -5
  45. package/dist/cli-bundle/chunks/append-NNJ3EFIT.js +11 -0
  46. package/dist/cli-bundle/chunks/{chunk-M4B4RK4J.js → chunk-2BO4CA46.js} +14 -238
  47. package/dist/cli-bundle/chunks/{chunk-M4B4RK4J.js.map → chunk-2BO4CA46.js.map} +1 -1
  48. package/dist/cli-bundle/chunks/{chunk-MQOSMBWV.js → chunk-3AO5VSDR.js} +25 -6
  49. package/dist/cli-bundle/chunks/chunk-3AO5VSDR.js.map +7 -0
  50. package/dist/cli-bundle/chunks/{chunk-ODEIDKGW.js → chunk-3LPFHE3P.js} +596 -154
  51. package/dist/cli-bundle/chunks/chunk-3LPFHE3P.js.map +1 -0
  52. package/dist/cli-bundle/chunks/{chunk-YGEA4CLH.js → chunk-3MCTMJXI.js} +4 -4
  53. package/dist/cli-bundle/chunks/{chunk-N7FCFJ76.js → chunk-3P7UJQOX.js} +2 -2
  54. package/dist/cli-bundle/chunks/{chunk-7B7IHMLH.js → chunk-3VY6MIEO.js} +3 -3
  55. package/dist/cli-bundle/chunks/{chunk-3EZZTFL2.js → chunk-4F6BWJ4J.js} +51 -43
  56. package/dist/cli-bundle/chunks/chunk-4F6BWJ4J.js.map +7 -0
  57. package/dist/cli-bundle/chunks/{chunk-VA3H7VVC.js → chunk-4L23AGQ7.js} +9 -7
  58. package/dist/cli-bundle/chunks/chunk-4L23AGQ7.js.map +1 -0
  59. package/dist/cli-bundle/chunks/{chunk-5S6IZXK7.js → chunk-4U4Z6AHI.js} +7 -7
  60. package/dist/cli-bundle/chunks/{chunk-UOIFZ66L.js → chunk-4XGJLADW.js} +3 -3
  61. package/dist/cli-bundle/chunks/{chunk-SUNZKVAH.js → chunk-5IZJWSDB.js} +5 -5
  62. package/dist/cli-bundle/chunks/{chunk-QQ77W23U.js → chunk-5NTE36LD.js} +4 -4
  63. package/dist/cli-bundle/chunks/{chunk-EVAN5VJA.js → chunk-5OK4UGFV.js} +5 -8
  64. package/dist/cli-bundle/chunks/{chunk-EVAN5VJA.js.map → chunk-5OK4UGFV.js.map} +2 -2
  65. package/dist/cli-bundle/chunks/{chunk-H3YKUVDR.js → chunk-5UX66S6U.js} +26 -7
  66. package/dist/cli-bundle/chunks/chunk-5UX66S6U.js.map +1 -0
  67. package/dist/cli-bundle/chunks/{chunk-KGPLSHJD.js → chunk-6C2ZZX5Z.js} +2 -2
  68. package/dist/cli-bundle/chunks/{chunk-Q5NHJ6RO.js → chunk-6JUTHVQS.js} +2 -2
  69. package/dist/cli-bundle/chunks/{chunk-NTS2RKHN.js → chunk-6VIJ7UA5.js} +15 -15
  70. package/dist/cli-bundle/chunks/{chunk-BBGR4FKQ.js → chunk-6XMUURSS.js} +6 -6
  71. package/dist/cli-bundle/chunks/chunk-6XMUURSS.js.map +1 -0
  72. package/dist/cli-bundle/chunks/{chunk-XVB6BATY.js → chunk-72LQ4TKV.js} +3 -3
  73. package/dist/cli-bundle/chunks/{chunk-WCBB6VI3.js → chunk-7AVEY74G.js} +8 -5
  74. package/dist/cli-bundle/chunks/chunk-7AVEY74G.js.map +7 -0
  75. package/dist/cli-bundle/chunks/{chunk-YG56M3NE.js → chunk-7DOJC3HS.js} +8 -8
  76. package/dist/cli-bundle/chunks/chunk-7DOJC3HS.js.map +1 -0
  77. package/dist/cli-bundle/chunks/{chunk-KZ5AC6B5.js → chunk-7WCE6Y64.js} +2 -2
  78. package/dist/cli-bundle/chunks/{chunk-VQOG2ETB.js → chunk-AF2CCM5U.js} +4 -4
  79. package/dist/cli-bundle/chunks/{chunk-P24ZU5QV.js → chunk-AOEOYL3S.js} +49 -12
  80. package/dist/cli-bundle/chunks/chunk-AOEOYL3S.js.map +7 -0
  81. package/dist/cli-bundle/chunks/{chunk-BZKE2O5V.js → chunk-BKIAH72N.js} +8 -6
  82. package/dist/cli-bundle/chunks/chunk-BKIAH72N.js.map +1 -0
  83. package/dist/cli-bundle/chunks/{chunk-RWAIRGBC.js → chunk-C3KD7U3T.js} +12 -243
  84. package/dist/cli-bundle/chunks/chunk-C3KD7U3T.js.map +7 -0
  85. package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js +334 -0
  86. package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js.map +1 -0
  87. package/dist/cli-bundle/chunks/{chunk-TELI67UP.js → chunk-CQTQKUUV.js} +6 -9
  88. package/dist/cli-bundle/chunks/{chunk-TELI67UP.js.map → chunk-CQTQKUUV.js.map} +1 -1
  89. package/dist/cli-bundle/chunks/{chunk-ZUCBPXNA.js → chunk-D6NXDNP3.js} +5 -5
  90. package/dist/cli-bundle/chunks/chunk-D6NXDNP3.js.map +7 -0
  91. package/dist/cli-bundle/chunks/{chunk-EAV3P54W.js → chunk-DAQ45GCS.js} +5 -5
  92. package/dist/cli-bundle/chunks/{chunk-6V4T4RD3.js → chunk-DVDBQA3B.js} +79 -22
  93. package/dist/cli-bundle/chunks/chunk-DVDBQA3B.js.map +1 -0
  94. package/dist/cli-bundle/chunks/chunk-E6LEMURX.js +249 -0
  95. package/dist/cli-bundle/chunks/chunk-E6LEMURX.js.map +7 -0
  96. package/dist/cli-bundle/chunks/{chunk-ZF52NVRT.js → chunk-E7ICD63T.js} +131 -179
  97. package/dist/cli-bundle/chunks/chunk-E7ICD63T.js.map +7 -0
  98. package/dist/cli-bundle/chunks/{chunk-RX53WHFI.js → chunk-EJDGV4GR.js} +3 -3
  99. package/dist/cli-bundle/chunks/{chunk-IXG5CMBR.js → chunk-FDHPAVVB.js} +4 -4
  100. package/dist/cli-bundle/chunks/{chunk-KAE727L2.js → chunk-FSRHYUDA.js} +2 -2
  101. package/dist/cli-bundle/chunks/chunk-FSRHYUDA.js.map +7 -0
  102. package/dist/cli-bundle/chunks/{chunk-46Z6FAVP.js → chunk-G3COA6GS.js} +51 -43
  103. package/dist/cli-bundle/chunks/chunk-G3COA6GS.js.map +1 -0
  104. package/dist/cli-bundle/chunks/{chunk-A4FVWFZY.js → chunk-GFQP7HAZ.js} +8 -6
  105. package/dist/cli-bundle/chunks/chunk-GFQP7HAZ.js.map +7 -0
  106. package/dist/cli-bundle/chunks/{chunk-2XPDCXK5.js → chunk-GIQSU6S2.js} +6 -6
  107. package/dist/cli-bundle/chunks/chunk-GIQSU6S2.js.map +1 -0
  108. package/dist/cli-bundle/chunks/{chunk-V4QHAMI5.js → chunk-GROYI4RB.js} +3 -3
  109. package/dist/cli-bundle/chunks/{chunk-77XFQRTD.js → chunk-GSJSM5BJ.js} +3 -3
  110. package/dist/cli-bundle/chunks/{chunk-QYGK2XQ3.js → chunk-GTLCVJOE.js} +3 -3
  111. package/dist/cli-bundle/chunks/{chunk-VSQE43NO.js → chunk-GV2262OF.js} +4 -4
  112. package/dist/cli-bundle/chunks/{chunk-N2TEEOXJ.js → chunk-GVI6FAFG.js} +8 -6
  113. package/dist/cli-bundle/chunks/chunk-GVI6FAFG.js.map +7 -0
  114. package/dist/cli-bundle/chunks/{chunk-A5EQPNV7.js → chunk-GVT754PX.js} +44 -3
  115. package/dist/cli-bundle/chunks/chunk-GVT754PX.js.map +7 -0
  116. package/dist/cli-bundle/chunks/{chunk-Y2VSGFT4.js → chunk-HB3P4M52.js} +22 -7
  117. package/dist/cli-bundle/chunks/chunk-HB3P4M52.js.map +1 -0
  118. package/dist/cli-bundle/chunks/{chunk-STBCBDKF.js → chunk-HCEBZNC3.js} +6 -6
  119. package/dist/cli-bundle/chunks/{chunk-EEECAV5M.js → chunk-HEWM6CEN.js} +80 -25
  120. package/dist/cli-bundle/chunks/chunk-HEWM6CEN.js.map +7 -0
  121. package/dist/cli-bundle/chunks/{chunk-GKCEEXMA.js → chunk-HQ3SB4CN.js} +21 -6
  122. package/dist/cli-bundle/chunks/{chunk-GKCEEXMA.js.map → chunk-HQ3SB4CN.js.map} +2 -2
  123. package/dist/cli-bundle/chunks/{chunk-U6RYD446.js → chunk-HRW7GF6T.js} +7 -7
  124. package/dist/cli-bundle/chunks/{chunk-D35WYXWC.js → chunk-HYW67VJ5.js} +6 -3
  125. package/dist/cli-bundle/chunks/chunk-HYW67VJ5.js.map +1 -0
  126. package/dist/cli-bundle/chunks/{chunk-OKWJUL6F.js → chunk-I577UHC7.js} +16 -9
  127. package/dist/cli-bundle/chunks/{chunk-OKWJUL6F.js.map → chunk-I577UHC7.js.map} +2 -2
  128. package/dist/cli-bundle/chunks/{chunk-XDWXPG2E.js → chunk-IAQE32BI.js} +4 -4
  129. package/dist/cli-bundle/chunks/{chunk-66SRNEBK.js → chunk-IJNK6WW2.js} +3 -3
  130. package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js +623 -0
  131. package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js.map +7 -0
  132. package/dist/cli-bundle/chunks/{chunk-A3GAQLBH.js → chunk-IX677TRO.js} +75 -12
  133. package/dist/cli-bundle/chunks/chunk-IX677TRO.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{chunk-RLLOZAM2.js → chunk-IY6VZ3IW.js} +29 -8
  135. package/dist/cli-bundle/chunks/chunk-IY6VZ3IW.js.map +7 -0
  136. package/dist/cli-bundle/chunks/{chunk-SVAWG7EE.js → chunk-J4FBIFU6.js} +45 -4
  137. package/dist/cli-bundle/chunks/chunk-J4FBIFU6.js.map +1 -0
  138. package/dist/cli-bundle/chunks/{chunk-AGEBQRBG.js → chunk-JAPE62Y5.js} +9 -9
  139. package/dist/cli-bundle/chunks/{chunk-UWAQI3B7.js → chunk-JGUKMMRS.js} +3 -3
  140. package/dist/cli-bundle/chunks/{chunk-UU6EP25G.js → chunk-JH2ZSLO3.js} +2 -2
  141. package/dist/cli-bundle/chunks/{chunk-GRDK25BN.js → chunk-JHJSFOAM.js} +6 -6
  142. package/dist/cli-bundle/chunks/{chunk-FQO5THHM.js → chunk-JM6YAXTR.js} +2 -2
  143. package/dist/cli-bundle/chunks/{chunk-E7KBMWEF.js → chunk-JSLT7WVE.js} +2 -2
  144. package/dist/cli-bundle/chunks/{chunk-FIUTBFC6.js → chunk-K4CI6Y45.js} +2 -2
  145. package/dist/cli-bundle/chunks/{chunk-IEMXESIS.js → chunk-KSPWRNVP.js} +7 -7
  146. package/dist/cli-bundle/chunks/{chunk-3QNUDDY2.js → chunk-KZEANWJS.js} +14 -12
  147. package/dist/cli-bundle/chunks/{chunk-3QNUDDY2.js.map → chunk-KZEANWJS.js.map} +2 -2
  148. package/dist/cli-bundle/chunks/{chunk-BFJP4VYC.js → chunk-L7BH7IWU.js} +4 -4
  149. package/dist/cli-bundle/chunks/{chunk-2UCG5H6B.js → chunk-LPEYZRUR.js} +3 -3
  150. package/dist/cli-bundle/chunks/{chunk-FQF6VVPH.js → chunk-MYSS5H2A.js} +9 -7
  151. package/dist/cli-bundle/chunks/{chunk-FQF6VVPH.js.map → chunk-MYSS5H2A.js.map} +1 -1
  152. package/dist/cli-bundle/chunks/{chunk-IR3GOO6E.js → chunk-NHT3F4WZ.js} +15 -15
  153. package/dist/cli-bundle/chunks/{chunk-6BNV3G6C.js → chunk-NLR32VFS.js} +2 -2
  154. package/dist/cli-bundle/chunks/{chunk-BDC4TW4B.js → chunk-OV7MSW3I.js} +15 -13
  155. package/dist/cli-bundle/chunks/chunk-OV7MSW3I.js.map +1 -0
  156. package/dist/cli-bundle/chunks/{chunk-EI3UIMZM.js → chunk-OWXOPDHD.js} +4 -4
  157. package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js +246 -0
  158. package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js.map +1 -0
  159. package/dist/cli-bundle/chunks/{chunk-AQUNTB7G.js → chunk-PEQGTJ5Q.js} +3 -3
  160. package/dist/cli-bundle/chunks/{chunk-QFG4MB7P.js → chunk-POG76WWZ.js} +28 -7
  161. package/dist/cli-bundle/chunks/chunk-POG76WWZ.js.map +1 -0
  162. package/dist/cli-bundle/chunks/{chunk-MI3346YW.js → chunk-QANSTTC7.js} +129 -170
  163. package/dist/cli-bundle/chunks/chunk-QANSTTC7.js.map +1 -0
  164. package/dist/cli-bundle/chunks/{chunk-T6MOTLOJ.js → chunk-QJKL5PHS.js} +2 -2
  165. package/dist/cli-bundle/chunks/{chunk-SBW7EQC4.js → chunk-QLZ643FM.js} +76 -13
  166. package/dist/cli-bundle/chunks/chunk-QLZ643FM.js.map +1 -0
  167. package/dist/cli-bundle/chunks/{chunk-XKVHL3MB.js → chunk-QWRVBJ4D.js} +2 -2
  168. package/dist/cli-bundle/chunks/chunk-R3EWPG4A.js +106 -0
  169. package/dist/cli-bundle/chunks/chunk-R3EWPG4A.js.map +1 -0
  170. package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js +344 -0
  171. package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js.map +7 -0
  172. package/dist/cli-bundle/chunks/{chunk-VFA5EIEN.js → chunk-R7QV7ICM.js} +4 -4
  173. package/dist/cli-bundle/chunks/{chunk-NPEYH6CE.js → chunk-RDV4ZFYS.js} +12 -10
  174. package/dist/cli-bundle/chunks/{chunk-NPEYH6CE.js.map → chunk-RDV4ZFYS.js.map} +1 -1
  175. package/dist/cli-bundle/chunks/{chunk-K2L6FZBX.js → chunk-RJO3YAFM.js} +4 -4
  176. package/dist/cli-bundle/chunks/{chunk-YIC5NGXF.js → chunk-RMF7LMBS.js} +7 -7
  177. package/dist/cli-bundle/chunks/{chunk-YIC5NGXF.js.map → chunk-RMF7LMBS.js.map} +2 -2
  178. package/dist/cli-bundle/chunks/{chunk-MRXAHR4B.js → chunk-RZJLNXFG.js} +50 -13
  179. package/dist/cli-bundle/chunks/chunk-RZJLNXFG.js.map +1 -0
  180. package/dist/cli-bundle/chunks/{chunk-DJAGYYCQ.js → chunk-SC2HMDGB.js} +19 -3
  181. package/dist/cli-bundle/chunks/chunk-SC2HMDGB.js.map +1 -0
  182. package/dist/cli-bundle/chunks/{chunk-SGJB6PXA.js → chunk-SF3DT5HJ.js} +3 -3
  183. package/dist/cli-bundle/chunks/chunk-SG74J6MV.js +604 -0
  184. package/dist/cli-bundle/chunks/chunk-SG74J6MV.js.map +1 -0
  185. package/dist/cli-bundle/chunks/{chunk-Q3K5XPAQ.js → chunk-SR3JOATZ.js} +18 -2
  186. package/dist/cli-bundle/chunks/chunk-SR3JOATZ.js.map +7 -0
  187. package/dist/cli-bundle/chunks/{chunk-DUDLSQFG.js → chunk-SSKOQNMS.js} +14 -12
  188. package/dist/cli-bundle/chunks/{chunk-DUDLSQFG.js.map → chunk-SSKOQNMS.js.map} +1 -1
  189. package/dist/cli-bundle/chunks/{chunk-UNNCT5QY.js → chunk-SZVB53Y3.js} +3 -3
  190. package/dist/cli-bundle/chunks/{chunk-JBW2S2C6.js → chunk-T44FMVRL.js} +613 -157
  191. package/dist/cli-bundle/chunks/chunk-T44FMVRL.js.map +7 -0
  192. package/dist/cli-bundle/chunks/{chunk-GFZB5CLP.js → chunk-T6PPNM7V.js} +4 -4
  193. package/dist/cli-bundle/chunks/{chunk-UE7LK3RE.js → chunk-THAOZG4U.js} +9 -7
  194. package/dist/cli-bundle/chunks/chunk-THAOZG4U.js.map +1 -0
  195. package/dist/cli-bundle/chunks/{chunk-IGBBTPM5.js → chunk-TOBGV45Y.js} +4 -4
  196. package/dist/cli-bundle/chunks/chunk-TOBGV45Y.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{chunk-W6IEJXNC.js → chunk-TVYYO5A7.js} +2 -2
  198. package/dist/cli-bundle/chunks/chunk-TYHJDFYW.js +109 -0
  199. package/dist/cli-bundle/chunks/chunk-TYHJDFYW.js.map +7 -0
  200. package/dist/cli-bundle/chunks/{chunk-DOASIOQR.js → chunk-UQLXSG72.js} +2 -2
  201. package/dist/cli-bundle/chunks/{chunk-IDUTGRDM.js → chunk-URXVHN3L.js} +3 -3
  202. package/dist/cli-bundle/chunks/chunk-URXVHN3L.js.map +1 -0
  203. package/dist/cli-bundle/chunks/{chunk-7CHWLT2J.js → chunk-UVN66B3M.js} +2 -2
  204. package/dist/cli-bundle/chunks/{chunk-Q6JPYR7I.js → chunk-UX6SSO2I.js} +2 -2
  205. package/dist/cli-bundle/chunks/{chunk-JPWUZOMR.js → chunk-UZDQXNUB.js} +75 -20
  206. package/dist/cli-bundle/chunks/chunk-UZDQXNUB.js.map +1 -0
  207. package/dist/cli-bundle/chunks/{chunk-OK7VSX3N.js → chunk-UZLJOEAC.js} +3 -3
  208. package/dist/cli-bundle/chunks/{chunk-4PSJVGRE.js → chunk-VDO2JMD4.js} +7 -7
  209. package/dist/cli-bundle/chunks/{chunk-IRJ6F23W.js → chunk-VQIHNHMJ.js} +2 -2
  210. package/dist/cli-bundle/chunks/{chunk-FQODDTE7.js → chunk-WUVEBQW6.js} +7 -5
  211. package/dist/cli-bundle/chunks/{chunk-FQODDTE7.js.map → chunk-WUVEBQW6.js.map} +1 -1
  212. package/dist/cli-bundle/chunks/{chunk-Q4PSG2GV.js → chunk-WVA4DVNV.js} +5 -5
  213. package/dist/cli-bundle/chunks/{chunk-Q4PSG2GV.js.map → chunk-WVA4DVNV.js.map} +1 -1
  214. package/dist/cli-bundle/chunks/{chunk-4M6RZJXF.js → chunk-WWNL6WMH.js} +3 -3
  215. package/dist/cli-bundle/chunks/chunk-WWNL6WMH.js.map +7 -0
  216. package/dist/cli-bundle/chunks/{chunk-3KPNOZOH.js → chunk-X6K5XTTN.js} +78 -21
  217. package/dist/cli-bundle/chunks/chunk-X6K5XTTN.js.map +7 -0
  218. package/dist/cli-bundle/chunks/{chunk-G33XIMRT.js → chunk-XJF7CDNH.js} +17 -10
  219. package/dist/cli-bundle/chunks/{chunk-G33XIMRT.js.map → chunk-XJF7CDNH.js.map} +1 -1
  220. package/dist/cli-bundle/chunks/{chunk-AR24KW26.js → chunk-YBT7O4KT.js} +17 -112
  221. package/dist/cli-bundle/chunks/chunk-YBT7O4KT.js.map +7 -0
  222. package/dist/cli-bundle/chunks/{chunk-CZA2DXCV.js → chunk-YQQNAKW3.js} +17 -105
  223. package/dist/cli-bundle/chunks/chunk-YQQNAKW3.js.map +1 -0
  224. package/dist/cli-bundle/chunks/{chunk-OKPZDH43.js → chunk-YQWCZ5AC.js} +7 -5
  225. package/dist/cli-bundle/chunks/{chunk-OKPZDH43.js.map → chunk-YQWCZ5AC.js.map} +2 -2
  226. package/dist/cli-bundle/chunks/{chunk-LT5UWU7H.js → chunk-ZOJ3LR7O.js} +2 -2
  227. package/dist/cli-bundle/chunks/{chunk-3HSRP6T2.js → chunk-ZOY5K4D3.js} +2 -2
  228. package/dist/cli-bundle/chunks/{chunk-XXWDEQ6O.js → chunk-ZV2NTVMJ.js} +4 -4
  229. package/dist/cli-bundle/chunks/{chunk-UW6HCMP2.js → chunk-ZYPFOO3L.js} +9 -9
  230. package/dist/cli-bundle/chunks/close-O5QVZ6ET.js +12 -0
  231. package/dist/cli-bundle/chunks/{close-7NWA3GLA.js → close-QEMOYZN3.js} +5 -5
  232. package/dist/cli-bundle/chunks/close-many-SDA426VT.js +24 -0
  233. package/dist/cli-bundle/chunks/{close-many-YALQ7AXS.js → close-many-UTZANOCQ.js} +15 -14
  234. package/dist/cli-bundle/chunks/{comments-SQIQ5WYR.js → comments-LZN6FXXC.js} +7 -7
  235. package/dist/cli-bundle/chunks/comments-VBQ345ND.js +13 -0
  236. package/dist/cli-bundle/chunks/{copy-YDAMENCP.js → copy-DKTSSCK7.js} +4 -4
  237. package/dist/cli-bundle/chunks/copy-M7DDI6LS.js +9 -0
  238. package/dist/cli-bundle/chunks/{create-JSL6CXU3.js → create-GG4RBCGC.js} +11 -11
  239. package/dist/cli-bundle/chunks/create-JBC5KUW6.js +29 -0
  240. package/dist/cli-bundle/chunks/{delete-IGVOZEU2.js → delete-LCS3VPDH.js} +4 -4
  241. package/dist/cli-bundle/chunks/delete-MD7YXQLH.js +10 -0
  242. package/dist/cli-bundle/chunks/{deps-BQAXUQAK.js → deps-DELOO4TL.js} +6 -6
  243. package/dist/cli-bundle/chunks/{deps-CBPPSS6J.js → deps-FI4O6NQS.js} +6 -6
  244. package/dist/cli-bundle/chunks/docs-2UYBP5D6.js +14 -0
  245. package/dist/cli-bundle/chunks/{docs-NS2AZWCN.js → docs-6Z2MP526.js} +6 -6
  246. package/dist/cli-bundle/chunks/{files-XUUBQ76I.js → files-HEUGSJZL.js} +6 -6
  247. package/dist/cli-bundle/chunks/{files-PVWEPT5J.js → files-HKEAN5MA.js} +6 -6
  248. package/dist/cli-bundle/chunks/{focus-DHBHKK3E.js → focus-7SOUT5PZ.js} +5 -5
  249. package/dist/cli-bundle/chunks/focus-DRQ6FQH6.js +10 -0
  250. package/dist/cli-bundle/chunks/history-compact-65YVN5DB.js +17 -0
  251. package/dist/cli-bundle/chunks/{history-compact-3TNPYVFG.js → history-compact-7NDVP3PT.js} +7 -6
  252. package/dist/cli-bundle/chunks/{history-redact-KKFDICCF.js → history-redact-7YBL4XSG.js} +5 -4
  253. package/dist/cli-bundle/chunks/{history-redact-ELRL73XN.js → history-redact-IZGNJBU4.js} +5 -4
  254. package/dist/cli-bundle/chunks/{history-repair-J7WKZFAG.js → history-repair-7M4PYQUH.js} +8 -6
  255. package/dist/cli-bundle/chunks/history-repair-GNGETJLI.js +18 -0
  256. package/dist/cli-bundle/chunks/learnings-3YXDRWFT.js +13 -0
  257. package/dist/cli-bundle/chunks/{learnings-X4D6JCCG.js → learnings-ALC6IMNL.js} +7 -7
  258. package/dist/cli-bundle/chunks/notes-7JMLQ447.js +13 -0
  259. package/dist/cli-bundle/chunks/{notes-UQC6VS6N.js → notes-JFCLTC5C.js} +7 -7
  260. package/dist/cli-bundle/chunks/plan-KOIPWVOZ.js +26 -0
  261. package/dist/cli-bundle/chunks/{plan-5GKRBJJO.js → plan-T3XB3WTK.js} +12 -12
  262. package/dist/cli-bundle/chunks/{profile-5PQAPCLF.js → profile-OILJHKUW.js} +12 -11
  263. package/dist/cli-bundle/chunks/{profile-CW4BD3FO.js → profile-RJXA7PGS.js} +12 -11
  264. package/dist/cli-bundle/chunks/{register-list-query-PHIPDFP2.js → register-list-query-CFVG75P3.js} +30 -21
  265. package/dist/cli-bundle/chunks/{register-list-query-PHIPDFP2.js.map → register-list-query-CFVG75P3.js.map} +1 -1
  266. package/dist/cli-bundle/chunks/{register-list-query-HTDQE6VI.js → register-list-query-E7UVY4TN.js} +29 -20
  267. package/dist/cli-bundle/chunks/{register-list-query-HTDQE6VI.js.map → register-list-query-E7UVY4TN.js.map} +2 -2
  268. package/dist/cli-bundle/chunks/{register-mutation-BLEWM5I6.js → register-mutation-4VJTXBZW.js} +86 -32
  269. package/dist/cli-bundle/chunks/register-mutation-4VJTXBZW.js.map +7 -0
  270. package/dist/cli-bundle/chunks/{register-mutation-OTYHR7J6.js → register-mutation-IQ55E25C.js} +78 -33
  271. package/dist/cli-bundle/chunks/register-mutation-IQ55E25C.js.map +1 -0
  272. package/dist/cli-bundle/chunks/{register-operations-AMCUFYEW.js → register-operations-AR7RMX4W.js} +42 -38
  273. package/dist/cli-bundle/chunks/register-operations-AR7RMX4W.js.map +1 -0
  274. package/dist/cli-bundle/chunks/{register-operations-MRLHOZYR.js → register-operations-NOLZGORC.js} +41 -37
  275. package/dist/cli-bundle/chunks/register-operations-NOLZGORC.js.map +7 -0
  276. package/dist/cli-bundle/chunks/{register-setup-ZVKTDL4G.js → register-setup-BB77VUEE.js} +17 -16
  277. package/dist/cli-bundle/chunks/{register-setup-ZVKTDL4G.js.map → register-setup-BB77VUEE.js.map} +1 -1
  278. package/dist/cli-bundle/chunks/{register-setup-N2FOSWAG.js → register-setup-EYZ7VTPZ.js} +15 -14
  279. package/dist/cli-bundle/chunks/{register-setup-N2FOSWAG.js.map → register-setup-EYZ7VTPZ.js.map} +1 -1
  280. package/dist/cli-bundle/chunks/restore-L6IAGOD7.js +15 -0
  281. package/dist/cli-bundle/chunks/{restore-HEQAG6EK.js → restore-ZH65GZFB.js} +7 -6
  282. package/dist/cli-bundle/chunks/{schema-Q5DAWJ2S.js → schema-4ERWM5QJ.js} +7 -6
  283. package/dist/cli-bundle/chunks/{schema-MAXAIHEC.js → schema-55DL3Q52.js} +7 -6
  284. package/dist/cli-bundle/chunks/{update-DWFXXJKP.js → update-FW6FKDOP.js} +15 -15
  285. package/dist/cli-bundle/chunks/update-TJHSPRPT.js +23 -0
  286. package/dist/cli-bundle/chunks/update-many-NNALYQCN.js +35 -0
  287. package/dist/cli-bundle/chunks/update-many-PWXX5WHO.js +39 -0
  288. package/dist/cli-bundle/main.js +62 -59
  289. package/dist/cli-bundle/main.js.map +1 -1
  290. package/dist/cli-bundle/sdk-runtime.js +62 -59
  291. package/dist/cli-bundle/sdk-testing.js +8 -8
  292. package/dist/cli-bundle/sdk.js +327 -57
  293. package/dist/cli-bundle/sdk.js.map +4 -4
  294. package/dist/core/config/nested-settings.d.ts +2 -0
  295. package/dist/core/config/nested-settings.js +18 -2
  296. package/dist/core/config/nested-settings.js.map +1 -1
  297. package/dist/core/diagnostics/remediation.js +38 -2
  298. package/dist/core/diagnostics/remediation.js.map +1 -1
  299. package/dist/core/extensions/extension-types.d.ts +1 -1
  300. package/dist/core/extensions/extension-types.js +2 -2
  301. package/dist/core/extensions/extension-types.js.map +1 -1
  302. package/dist/core/item/id.d.ts +19 -2
  303. package/dist/core/item/id.js +27 -6
  304. package/dist/core/item/id.js.map +1 -1
  305. package/dist/core/item/parse.d.ts +7 -0
  306. package/dist/core/item/parse.js +48 -2
  307. package/dist/core/item/parse.js.map +1 -1
  308. package/dist/core/schema/item-types-file.d.ts +2 -2
  309. package/dist/core/schema/item-types-file.js +2 -2
  310. package/dist/core/schema/item-types-file.js.map +1 -1
  311. package/dist/core/schema/runtime-schema.d.ts +3 -3
  312. package/dist/core/schema/runtime-schema.js +2 -2
  313. package/dist/core/schema/runtime-schema.js.map +1 -1
  314. package/dist/core/schema/type-workflows.d.ts +2 -2
  315. package/dist/core/schema/type-workflows.js +2 -2
  316. package/dist/core/schema/type-workflows.js.map +1 -1
  317. package/dist/core/shared/constants.js +5 -2
  318. package/dist/core/shared/constants.js.map +1 -1
  319. package/dist/core/store/settings-validator.d.ts +4 -0
  320. package/dist/core/store/settings-validator.js +8 -2
  321. package/dist/core/store/settings-validator.js.map +1 -1
  322. package/dist/core/store/settings.js +8 -2
  323. package/dist/core/store/settings.js.map +1 -1
  324. package/dist/sdk/annotations.js +24 -2
  325. package/dist/sdk/annotations.js.map +1 -1
  326. package/dist/sdk/cli-bootstrap.d.ts +1 -1
  327. package/dist/sdk/cli-bootstrap.js +3 -3
  328. package/dist/sdk/cli-bootstrap.js.map +1 -1
  329. package/dist/sdk/cli-contracts/commander-mutation-options.js +22 -2
  330. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  331. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  332. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  333. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  334. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  335. package/dist/sdk/cli-contracts/flag-contracts.js +17 -2
  336. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  337. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +512 -0
  338. package/dist/sdk/cli-contracts/tool-option-contracts.js +21 -11
  339. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  340. package/dist/sdk/cli-contracts/tool-parameter-tables.js +13 -3
  341. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  342. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -0
  343. package/dist/sdk/cli-contracts/tool-schema.js +14 -10
  344. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  345. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +69 -0
  346. package/dist/sdk/cli-contracts/typed-action-inputs.js +5 -0
  347. package/dist/sdk/cli-contracts/typed-action-inputs.js.map +1 -0
  348. package/dist/sdk/cli-contracts.d.ts +4 -3
  349. package/dist/sdk/cli-contracts.js +5 -5
  350. package/dist/sdk/cli-contracts.js.map +1 -1
  351. package/dist/sdk/extension/describe.d.ts +1 -1
  352. package/dist/sdk/extension/describe.js +2 -2
  353. package/dist/sdk/extension/describe.js.map +1 -1
  354. package/dist/sdk/extension/install-runtime.js +5 -3
  355. package/dist/sdk/extension/install-runtime.js.map +1 -1
  356. package/dist/sdk/extension.d.ts +2 -2
  357. package/dist/sdk/extension.js +2 -2
  358. package/dist/sdk/extension.js.map +1 -1
  359. package/dist/sdk/governance/gc.d.ts +14 -1
  360. package/dist/sdk/governance/gc.js +38 -2
  361. package/dist/sdk/governance/gc.js.map +1 -1
  362. package/dist/sdk/governance/storage-integrity.d.ts +84 -0
  363. package/dist/sdk/governance/storage-integrity.js +240 -0
  364. package/dist/sdk/governance/storage-integrity.js.map +1 -0
  365. package/dist/sdk/governance/validate.d.ts +3 -1
  366. package/dist/sdk/governance/validate.js +56 -2
  367. package/dist/sdk/governance/validate.js.map +1 -1
  368. package/dist/sdk/history-read.d.ts +1 -1
  369. package/dist/sdk/history-read.js +2 -2
  370. package/dist/sdk/history-read.js.map +1 -1
  371. package/dist/sdk/history-repair.d.ts +36 -0
  372. package/dist/sdk/history-repair.js +69 -4
  373. package/dist/sdk/history-repair.js.map +1 -1
  374. package/dist/sdk/index.d.ts +5 -2
  375. package/dist/sdk/index.js +5 -2
  376. package/dist/sdk/index.js.map +1 -1
  377. package/dist/sdk/init.js +3 -3
  378. package/dist/sdk/init.js.map +1 -1
  379. package/dist/sdk/item-transaction.d.ts +131 -0
  380. package/dist/sdk/item-transaction.js +280 -0
  381. package/dist/sdk/item-transaction.js.map +1 -0
  382. package/dist/sdk/merge/driver.d.ts +75 -0
  383. package/dist/sdk/merge/driver.js +166 -0
  384. package/dist/sdk/merge/driver.js.map +1 -0
  385. package/dist/sdk/merge/index.d.ts +11 -0
  386. package/dist/sdk/merge/index.js +15 -0
  387. package/dist/sdk/merge/index.js.map +1 -0
  388. package/dist/sdk/merge/install.d.ts +90 -0
  389. package/dist/sdk/merge/install.js +318 -0
  390. package/dist/sdk/merge/install.js.map +1 -0
  391. package/dist/sdk/merge/three-way.d.ts +126 -0
  392. package/dist/sdk/merge/three-way.js +545 -0
  393. package/dist/sdk/merge/three-way.js.map +1 -0
  394. package/dist/sdk/query/list.d.ts +19 -2
  395. package/dist/sdk/query/list.js +5 -2
  396. package/dist/sdk/query/list.js.map +1 -1
  397. package/dist/sdk/runtime.d.ts +17 -14
  398. package/dist/sdk/runtime.js +5 -5
  399. package/dist/sdk/runtime.js.map +1 -1
  400. package/dist/sdk/schema.d.ts +2 -2
  401. package/dist/sdk/schema.js +29 -2
  402. package/dist/sdk/schema.js.map +1 -1
  403. package/dist/sdk/stats.d.ts +1 -1
  404. package/dist/sdk/stats.js +2 -2
  405. package/dist/sdk/stats.js.map +1 -1
  406. package/dist/sdk/workspace-transaction-gc.d.ts +46 -0
  407. package/dist/sdk/workspace-transaction-gc.js +155 -0
  408. package/dist/sdk/workspace-transaction-gc.js.map +1 -0
  409. package/dist/sdk/workspace.d.ts +28 -4
  410. package/dist/sdk/workspace.js +61 -15
  411. package/dist/sdk/workspace.js.map +1 -1
  412. package/dist/types.d.ts +11 -7
  413. package/dist/types.js +2 -2
  414. package/dist/types.js.map +1 -1
  415. package/docs/AGENT_GUIDE.md +58 -47
  416. package/docs/COMMANDS.md +7 -0
  417. package/docs/CONFIGURATION.md +2 -0
  418. package/docs/MERGE_SAFETY.md +99 -0
  419. package/docs/README.md +1 -0
  420. package/docs/SDK.md +56 -0
  421. package/marketplace.json +2 -2
  422. package/package.json +3 -2
  423. package/packages/pm-beads/package.json +1 -1
  424. package/packages/pm-calendar/package.json +1 -1
  425. package/packages/pm-command-kit/package.json +1 -1
  426. package/packages/pm-governance-audit/package.json +1 -1
  427. package/packages/pm-guide-shell/package.json +1 -1
  428. package/packages/pm-kanban/package.json +1 -1
  429. package/packages/pm-lifecycle-hooks/package.json +1 -1
  430. package/packages/pm-linked-test-adapters/package.json +1 -1
  431. package/packages/pm-search-advanced/package.json +1 -1
  432. package/packages/pm-templates/package.json +1 -1
  433. package/packages/pm-todos/package.json +1 -1
  434. package/packages/pm-vcs/package.json +1 -1
  435. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  436. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  437. package/dist/cli-bundle/chunks/append-XUYF7NON.js +0 -11
  438. package/dist/cli-bundle/chunks/chunk-2XPDCXK5.js.map +0 -1
  439. package/dist/cli-bundle/chunks/chunk-3EZZTFL2.js.map +0 -7
  440. package/dist/cli-bundle/chunks/chunk-3KPNOZOH.js.map +0 -7
  441. package/dist/cli-bundle/chunks/chunk-46Z6FAVP.js.map +0 -1
  442. package/dist/cli-bundle/chunks/chunk-4M6RZJXF.js.map +0 -7
  443. package/dist/cli-bundle/chunks/chunk-6V4T4RD3.js.map +0 -1
  444. package/dist/cli-bundle/chunks/chunk-A3GAQLBH.js.map +0 -7
  445. package/dist/cli-bundle/chunks/chunk-A4FVWFZY.js.map +0 -7
  446. package/dist/cli-bundle/chunks/chunk-A5EQPNV7.js.map +0 -7
  447. package/dist/cli-bundle/chunks/chunk-AR24KW26.js.map +0 -7
  448. package/dist/cli-bundle/chunks/chunk-BBGR4FKQ.js.map +0 -1
  449. package/dist/cli-bundle/chunks/chunk-BDC4TW4B.js.map +0 -1
  450. package/dist/cli-bundle/chunks/chunk-BZKE2O5V.js.map +0 -1
  451. package/dist/cli-bundle/chunks/chunk-CZA2DXCV.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-D35WYXWC.js.map +0 -1
  453. package/dist/cli-bundle/chunks/chunk-DJAGYYCQ.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-EEECAV5M.js.map +0 -7
  455. package/dist/cli-bundle/chunks/chunk-H3YKUVDR.js.map +0 -1
  456. package/dist/cli-bundle/chunks/chunk-IDUTGRDM.js.map +0 -1
  457. package/dist/cli-bundle/chunks/chunk-IGBBTPM5.js.map +0 -1
  458. package/dist/cli-bundle/chunks/chunk-JBW2S2C6.js.map +0 -7
  459. package/dist/cli-bundle/chunks/chunk-JPWUZOMR.js.map +0 -1
  460. package/dist/cli-bundle/chunks/chunk-KAE727L2.js.map +0 -7
  461. package/dist/cli-bundle/chunks/chunk-MI3346YW.js.map +0 -1
  462. package/dist/cli-bundle/chunks/chunk-MQOSMBWV.js.map +0 -7
  463. package/dist/cli-bundle/chunks/chunk-MRXAHR4B.js.map +0 -1
  464. package/dist/cli-bundle/chunks/chunk-N2TEEOXJ.js.map +0 -7
  465. package/dist/cli-bundle/chunks/chunk-ODEIDKGW.js.map +0 -1
  466. package/dist/cli-bundle/chunks/chunk-P24ZU5QV.js.map +0 -7
  467. package/dist/cli-bundle/chunks/chunk-Q3K5XPAQ.js.map +0 -7
  468. package/dist/cli-bundle/chunks/chunk-QFG4MB7P.js.map +0 -1
  469. package/dist/cli-bundle/chunks/chunk-RLLOZAM2.js.map +0 -7
  470. package/dist/cli-bundle/chunks/chunk-RWAIRGBC.js.map +0 -7
  471. package/dist/cli-bundle/chunks/chunk-SBW7EQC4.js.map +0 -1
  472. package/dist/cli-bundle/chunks/chunk-SVAWG7EE.js.map +0 -1
  473. package/dist/cli-bundle/chunks/chunk-UE7LK3RE.js.map +0 -1
  474. package/dist/cli-bundle/chunks/chunk-VA3H7VVC.js.map +0 -1
  475. package/dist/cli-bundle/chunks/chunk-WCBB6VI3.js.map +0 -7
  476. package/dist/cli-bundle/chunks/chunk-Y2VSGFT4.js.map +0 -1
  477. package/dist/cli-bundle/chunks/chunk-YG56M3NE.js.map +0 -1
  478. package/dist/cli-bundle/chunks/chunk-ZF52NVRT.js.map +0 -7
  479. package/dist/cli-bundle/chunks/chunk-ZUCBPXNA.js.map +0 -7
  480. package/dist/cli-bundle/chunks/close-ZZCDDWJT.js +0 -12
  481. package/dist/cli-bundle/chunks/close-many-QCZHFCON.js +0 -23
  482. package/dist/cli-bundle/chunks/comments-FMQNYPSZ.js +0 -13
  483. package/dist/cli-bundle/chunks/copy-GI3RCVZP.js +0 -9
  484. package/dist/cli-bundle/chunks/create-LXMLYJNM.js +0 -29
  485. package/dist/cli-bundle/chunks/delete-5DFAXJNI.js +0 -10
  486. package/dist/cli-bundle/chunks/docs-KCWPLQOV.js +0 -14
  487. package/dist/cli-bundle/chunks/focus-3EJVFI3D.js +0 -10
  488. package/dist/cli-bundle/chunks/history-compact-JHYVDYLW.js +0 -16
  489. package/dist/cli-bundle/chunks/history-repair-REMI7DDI.js +0 -16
  490. package/dist/cli-bundle/chunks/learnings-O6V5WDCV.js +0 -13
  491. package/dist/cli-bundle/chunks/notes-ZSZREWZA.js +0 -13
  492. package/dist/cli-bundle/chunks/plan-EZW2YDDY.js +0 -26
  493. package/dist/cli-bundle/chunks/register-mutation-BLEWM5I6.js.map +0 -7
  494. package/dist/cli-bundle/chunks/register-mutation-OTYHR7J6.js.map +0 -1
  495. package/dist/cli-bundle/chunks/register-operations-AMCUFYEW.js.map +0 -1
  496. package/dist/cli-bundle/chunks/register-operations-MRLHOZYR.js.map +0 -7
  497. package/dist/cli-bundle/chunks/restore-A55MLFAI.js +0 -14
  498. package/dist/cli-bundle/chunks/update-5DTSCWVF.js +0 -23
  499. package/dist/cli-bundle/chunks/update-many-6T4ZLZS7.js +0 -34
  500. package/dist/cli-bundle/chunks/update-many-MYRK6VBJ.js +0 -38
  501. /package/dist/cli-bundle/chunks/{append-MBXHNWSX.js.map → append-E6V54WOQ.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{append-XUYF7NON.js.map → append-NNJ3EFIT.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{chunk-YGEA4CLH.js.map → chunk-3MCTMJXI.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{chunk-N7FCFJ76.js.map → chunk-3P7UJQOX.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{chunk-7B7IHMLH.js.map → chunk-3VY6MIEO.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{chunk-5S6IZXK7.js.map → chunk-4U4Z6AHI.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{chunk-UOIFZ66L.js.map → chunk-4XGJLADW.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{chunk-SUNZKVAH.js.map → chunk-5IZJWSDB.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{chunk-QQ77W23U.js.map → chunk-5NTE36LD.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{chunk-KGPLSHJD.js.map → chunk-6C2ZZX5Z.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{chunk-Q5NHJ6RO.js.map → chunk-6JUTHVQS.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{chunk-NTS2RKHN.js.map → chunk-6VIJ7UA5.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{chunk-XVB6BATY.js.map → chunk-72LQ4TKV.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{chunk-KZ5AC6B5.js.map → chunk-7WCE6Y64.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{chunk-VQOG2ETB.js.map → chunk-AF2CCM5U.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{chunk-EAV3P54W.js.map → chunk-DAQ45GCS.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{chunk-RX53WHFI.js.map → chunk-EJDGV4GR.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{chunk-IXG5CMBR.js.map → chunk-FDHPAVVB.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{chunk-V4QHAMI5.js.map → chunk-GROYI4RB.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{chunk-77XFQRTD.js.map → chunk-GSJSM5BJ.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{chunk-QYGK2XQ3.js.map → chunk-GTLCVJOE.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{chunk-VSQE43NO.js.map → chunk-GV2262OF.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{chunk-STBCBDKF.js.map → chunk-HCEBZNC3.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{chunk-U6RYD446.js.map → chunk-HRW7GF6T.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{chunk-XDWXPG2E.js.map → chunk-IAQE32BI.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{chunk-66SRNEBK.js.map → chunk-IJNK6WW2.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{chunk-AGEBQRBG.js.map → chunk-JAPE62Y5.js.map} +0 -0
  528. /package/dist/cli-bundle/chunks/{chunk-UWAQI3B7.js.map → chunk-JGUKMMRS.js.map} +0 -0
  529. /package/dist/cli-bundle/chunks/{chunk-UU6EP25G.js.map → chunk-JH2ZSLO3.js.map} +0 -0
  530. /package/dist/cli-bundle/chunks/{chunk-GRDK25BN.js.map → chunk-JHJSFOAM.js.map} +0 -0
  531. /package/dist/cli-bundle/chunks/{chunk-FQO5THHM.js.map → chunk-JM6YAXTR.js.map} +0 -0
  532. /package/dist/cli-bundle/chunks/{chunk-E7KBMWEF.js.map → chunk-JSLT7WVE.js.map} +0 -0
  533. /package/dist/cli-bundle/chunks/{chunk-FIUTBFC6.js.map → chunk-K4CI6Y45.js.map} +0 -0
  534. /package/dist/cli-bundle/chunks/{chunk-IEMXESIS.js.map → chunk-KSPWRNVP.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{chunk-BFJP4VYC.js.map → chunk-L7BH7IWU.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{chunk-2UCG5H6B.js.map → chunk-LPEYZRUR.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{chunk-IR3GOO6E.js.map → chunk-NHT3F4WZ.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{chunk-6BNV3G6C.js.map → chunk-NLR32VFS.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{chunk-EI3UIMZM.js.map → chunk-OWXOPDHD.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{chunk-AQUNTB7G.js.map → chunk-PEQGTJ5Q.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-T6MOTLOJ.js.map → chunk-QJKL5PHS.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-XKVHL3MB.js.map → chunk-QWRVBJ4D.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-VFA5EIEN.js.map → chunk-R7QV7ICM.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-K2L6FZBX.js.map → chunk-RJO3YAFM.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-SGJB6PXA.js.map → chunk-SF3DT5HJ.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-UNNCT5QY.js.map → chunk-SZVB53Y3.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-GFZB5CLP.js.map → chunk-T6PPNM7V.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-W6IEJXNC.js.map → chunk-TVYYO5A7.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-DOASIOQR.js.map → chunk-UQLXSG72.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-7CHWLT2J.js.map → chunk-UVN66B3M.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-Q6JPYR7I.js.map → chunk-UX6SSO2I.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-OK7VSX3N.js.map → chunk-UZLJOEAC.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-4PSJVGRE.js.map → chunk-VDO2JMD4.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-IRJ6F23W.js.map → chunk-VQIHNHMJ.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-LT5UWU7H.js.map → chunk-ZOJ3LR7O.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-3HSRP6T2.js.map → chunk-ZOY5K4D3.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-XXWDEQ6O.js.map → chunk-ZV2NTVMJ.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-UW6HCMP2.js.map → chunk-ZYPFOO3L.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{close-ZZCDDWJT.js.map → close-O5QVZ6ET.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{close-7NWA3GLA.js.map → close-QEMOYZN3.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{close-many-QCZHFCON.js.map → close-many-SDA426VT.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{close-many-YALQ7AXS.js.map → close-many-UTZANOCQ.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{comments-SQIQ5WYR.js.map → comments-LZN6FXXC.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{comments-FMQNYPSZ.js.map → comments-VBQ345ND.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{copy-YDAMENCP.js.map → copy-DKTSSCK7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{copy-GI3RCVZP.js.map → copy-M7DDI6LS.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{create-JSL6CXU3.js.map → create-GG4RBCGC.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{create-LXMLYJNM.js.map → create-JBC5KUW6.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{delete-IGVOZEU2.js.map → delete-LCS3VPDH.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{delete-5DFAXJNI.js.map → delete-MD7YXQLH.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{deps-BQAXUQAK.js.map → deps-DELOO4TL.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{deps-CBPPSS6J.js.map → deps-FI4O6NQS.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{docs-KCWPLQOV.js.map → docs-2UYBP5D6.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{docs-NS2AZWCN.js.map → docs-6Z2MP526.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{files-XUUBQ76I.js.map → files-HEUGSJZL.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{files-PVWEPT5J.js.map → files-HKEAN5MA.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{focus-DHBHKK3E.js.map → focus-7SOUT5PZ.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{focus-3EJVFI3D.js.map → focus-DRQ6FQH6.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{history-compact-JHYVDYLW.js.map → history-compact-65YVN5DB.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{history-compact-3TNPYVFG.js.map → history-compact-7NDVP3PT.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{history-redact-KKFDICCF.js.map → history-redact-7YBL4XSG.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{history-redact-ELRL73XN.js.map → history-redact-IZGNJBU4.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{history-repair-J7WKZFAG.js.map → history-repair-7M4PYQUH.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{history-repair-REMI7DDI.js.map → history-repair-GNGETJLI.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{learnings-O6V5WDCV.js.map → learnings-3YXDRWFT.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{learnings-X4D6JCCG.js.map → learnings-ALC6IMNL.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{notes-ZSZREWZA.js.map → notes-7JMLQ447.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{notes-UQC6VS6N.js.map → notes-JFCLTC5C.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{plan-EZW2YDDY.js.map → plan-KOIPWVOZ.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{plan-5GKRBJJO.js.map → plan-T3XB3WTK.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{profile-5PQAPCLF.js.map → profile-OILJHKUW.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{profile-CW4BD3FO.js.map → profile-RJXA7PGS.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{restore-A55MLFAI.js.map → restore-L6IAGOD7.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{restore-HEQAG6EK.js.map → restore-ZH65GZFB.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{schema-Q5DAWJ2S.js.map → schema-4ERWM5QJ.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{schema-MAXAIHEC.js.map → schema-55DL3Q52.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{update-DWFXXJKP.js.map → update-FW6FKDOP.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{update-5DTSCWVF.js.map → update-TJHSPRPT.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{update-many-6T4ZLZS7.js.map → update-many-NNALYQCN.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{update-many-MYRK6VBJ.js.map → update-many-PWXX5WHO.js.map} +0 -0
@@ -0,0 +1,545 @@
1
+ /**
2
+ * @module sdk/merge/three-way
3
+ *
4
+ * Field-aware three-way merge primitives for every mergeable tracker artifact
5
+ * class: append-only history JSONL streams, item documents (TOON or
6
+ * JSON+Markdown), and key-level JSON configuration/schema files. These
7
+ * primitives are pure (content in, content out) so the CLI merge driver, the
8
+ * MCP surface, and package integrations all share one merge semantics
9
+ * definition for multi-branch agent workflows.
10
+ */
11
+
12
+ !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]="fa427b53-b1ae-53d0-acec-dfc1eb22bfd1")}catch(e){}}();
13
+ import { historyEntriesToRaw, reanchorHistoryEntries, } from "../../core/history/replay.js";
14
+ import { canonicalDocument, parseItemDocument, serializeItemDocument, } from "../../core/item/item-format.js";
15
+ import { EXIT_CODE } from "../../core/shared/constants.js";
16
+ import { findFirstMergeConflictMarker } from "../../core/shared/conflict-markers.js";
17
+ import { PmCliError } from "../../core/shared/errors.js";
18
+ import { stableStringify } from "../../core/shared/serialization.js";
19
+ import { compareTimestampStrings } from "../../core/shared/time.js";
20
+ function parseHistoryJsonl(raw, label) {
21
+ const conflictMarker = findFirstMergeConflictMarker(raw);
22
+ if (conflictMarker) {
23
+ throw new PmCliError(`History merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`, EXIT_CODE.GENERIC_FAILURE);
24
+ }
25
+ const entries = [];
26
+ for (const [index, rawLine] of raw.split(/\r?\n/).entries()) {
27
+ const line = rawLine.trim();
28
+ if (!line) {
29
+ continue;
30
+ }
31
+ try {
32
+ const parsed = JSON.parse(line);
33
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
34
+ throw new TypeError("history entry must be an object");
35
+ }
36
+ entries.push(parsed);
37
+ }
38
+ catch {
39
+ throw new PmCliError(`History merge input (${label}) contains invalid JSON at line ${index + 1}.`, EXIT_CODE.GENERIC_FAILURE);
40
+ }
41
+ }
42
+ return entries;
43
+ }
44
+ function historyEntryIdentity(entry) {
45
+ return stableStringify({
46
+ ts: entry.ts,
47
+ author: entry.author,
48
+ op: entry.op,
49
+ patch: entry.patch,
50
+ message: entry.message ?? null,
51
+ });
52
+ }
53
+ function commonHistoryPrefixLength(ours, theirs) {
54
+ const limit = Math.min(ours.length, theirs.length);
55
+ let shared = 0;
56
+ while (shared < limit &&
57
+ historyEntryIdentity(ours[shared]) === historyEntryIdentity(theirs[shared])) {
58
+ shared += 1;
59
+ }
60
+ return shared;
61
+ }
62
+ /**
63
+ * Deterministically merge two diverged versions of one append-only history
64
+ * JSONL stream. Identical streams and one-sided fast-forwards keep the winning
65
+ * side byte-for-byte; genuinely diverged streams are merged as the shared
66
+ * prefix plus both suffixes ordered by timestamp (ours-first on ties), then
67
+ * hash re-anchored so the resulting chain verifies again. No side's events are
68
+ * ever discarded: content divergence is preserved for the post-merge
69
+ * reconciliation pass (`pm validate` + `pm history-repair`) instead of being
70
+ * silently resolved by last-writer-wins.
71
+ */
72
+ export function mergeHistoryStreams(baseRaw, oursRaw, theirsRaw) {
73
+ parseHistoryJsonl(baseRaw, "base");
74
+ const ours = parseHistoryJsonl(oursRaw, "ours");
75
+ const theirs = parseHistoryJsonl(theirsRaw, "theirs");
76
+ const shared = commonHistoryPrefixLength(ours, theirs);
77
+ if (shared === ours.length && shared === theirs.length) {
78
+ return {
79
+ merged: historyEntriesToRaw(ours),
80
+ strategy: "identical",
81
+ common_entries: shared,
82
+ entries_from_ours: 0,
83
+ entries_from_theirs: 0,
84
+ entries_total: ours.length,
85
+ reanchored: false,
86
+ };
87
+ }
88
+ if (shared === theirs.length) {
89
+ return {
90
+ merged: historyEntriesToRaw(ours),
91
+ strategy: "fast_forward_ours",
92
+ common_entries: shared,
93
+ entries_from_ours: ours.length - shared,
94
+ entries_from_theirs: 0,
95
+ entries_total: ours.length,
96
+ reanchored: false,
97
+ };
98
+ }
99
+ if (shared === ours.length) {
100
+ return {
101
+ merged: historyEntriesToRaw(theirs),
102
+ strategy: "fast_forward_theirs",
103
+ common_entries: shared,
104
+ entries_from_ours: 0,
105
+ entries_from_theirs: theirs.length - shared,
106
+ entries_total: theirs.length,
107
+ reanchored: false,
108
+ };
109
+ }
110
+ const oursSuffix = ours.slice(shared);
111
+ const seenIdentities = new Set(oursSuffix.map(historyEntryIdentity));
112
+ const theirsSuffix = theirs
113
+ .slice(shared)
114
+ .filter((entry) => !seenIdentities.has(historyEntryIdentity(entry)));
115
+ const mergedSuffix = [...oursSuffix, ...theirsSuffix].sort((left, right) => {
116
+ const byTs = compareTimestampStrings(left.ts, right.ts);
117
+ if (byTs !== 0) {
118
+ return byTs;
119
+ }
120
+ const leftFromOurs = seenIdentities.has(historyEntryIdentity(left));
121
+ const rightFromOurs = seenIdentities.has(historyEntryIdentity(right));
122
+ if (leftFromOurs !== rightFromOurs) {
123
+ return Number(rightFromOurs) - Number(leftFromOurs);
124
+ }
125
+ return historyEntryIdentity(left).localeCompare(historyEntryIdentity(right));
126
+ });
127
+ const reanchored = reanchorHistoryEntries([
128
+ ...ours.slice(0, shared),
129
+ ...mergedSuffix,
130
+ ]);
131
+ return {
132
+ merged: historyEntriesToRaw(reanchored.entries),
133
+ strategy: "union_reanchor",
134
+ common_entries: shared,
135
+ entries_from_ours: oursSuffix.length,
136
+ entries_from_theirs: theirsSuffix.length,
137
+ entries_total: reanchored.entries.length,
138
+ reanchored: true,
139
+ };
140
+ }
141
+ function parseRelationshipJsonl(raw, label) {
142
+ const conflictMarker = findFirstMergeConflictMarker(raw);
143
+ if (conflictMarker) {
144
+ throw new PmCliError(`Relationship merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`, EXIT_CODE.GENERIC_FAILURE);
145
+ }
146
+ const events = [];
147
+ for (const [index, rawLine] of raw.split(/\r?\n/).entries()) {
148
+ const line = rawLine.trim();
149
+ if (!line) {
150
+ continue;
151
+ }
152
+ let parsed;
153
+ try {
154
+ parsed = JSON.parse(line);
155
+ }
156
+ catch {
157
+ throw new PmCliError(`Relationship merge input (${label}) contains invalid JSON at line ${index + 1}.`, EXIT_CODE.GENERIC_FAILURE);
158
+ }
159
+ if (typeof parsed !== "object" ||
160
+ parsed === null ||
161
+ Array.isArray(parsed) ||
162
+ typeof parsed.eventId !== "string" ||
163
+ typeof parsed.sequence !== "number") {
164
+ throw new PmCliError(`Relationship merge input (${label}) line ${index + 1} is not a relationship event (eventId + sequence required).`, EXIT_CODE.GENERIC_FAILURE);
165
+ }
166
+ events.push(parsed);
167
+ }
168
+ return events;
169
+ }
170
+ function relationshipEventsToRaw(events) {
171
+ return events.length === 0
172
+ ? ""
173
+ : `${events.map((event) => JSON.stringify(event)).join("\n")}\n`;
174
+ }
175
+ function renumberRelationshipEvents(events) {
176
+ return events.map((event, index) => ({ ...event, sequence: index + 1 }));
177
+ }
178
+ /**
179
+ * Deterministically merge two diverged versions of one append-only
180
+ * relationship event JSONL store. The store's loader enforces strictly
181
+ * consecutive one-based `sequence` values, so a plain text union of two
182
+ * diverged streams is always unreadable; this merge keeps the shared prefix,
183
+ * unions both divergent suffixes by `eventId` (ordered by event timestamp,
184
+ * ours-first on ties), and renumbers every merged sequence consecutively so
185
+ * the resulting stream loads again. No side's events are ever discarded.
186
+ */
187
+ export function mergeRelationshipEventStreams(baseRaw, oursRaw, theirsRaw) {
188
+ parseRelationshipJsonl(baseRaw, "base");
189
+ const ours = parseRelationshipJsonl(oursRaw, "ours");
190
+ const theirs = parseRelationshipJsonl(theirsRaw, "theirs");
191
+ const limit = Math.min(ours.length, theirs.length);
192
+ let shared = 0;
193
+ while (shared < limit && ours[shared].eventId === theirs[shared].eventId) {
194
+ shared += 1;
195
+ }
196
+ if (shared === ours.length && shared === theirs.length) {
197
+ return {
198
+ merged: relationshipEventsToRaw(ours),
199
+ strategy: "identical",
200
+ common_entries: shared,
201
+ entries_from_ours: 0,
202
+ entries_from_theirs: 0,
203
+ entries_total: ours.length,
204
+ reanchored: false,
205
+ };
206
+ }
207
+ if (shared === theirs.length) {
208
+ return {
209
+ merged: relationshipEventsToRaw(ours),
210
+ strategy: "fast_forward_ours",
211
+ common_entries: shared,
212
+ entries_from_ours: ours.length - shared,
213
+ entries_from_theirs: 0,
214
+ entries_total: ours.length,
215
+ reanchored: false,
216
+ };
217
+ }
218
+ if (shared === ours.length) {
219
+ return {
220
+ merged: relationshipEventsToRaw(theirs),
221
+ strategy: "fast_forward_theirs",
222
+ common_entries: shared,
223
+ entries_from_ours: 0,
224
+ entries_from_theirs: theirs.length - shared,
225
+ entries_total: theirs.length,
226
+ reanchored: false,
227
+ };
228
+ }
229
+ const oursSuffix = ours.slice(shared);
230
+ const oursEventIds = new Set(oursSuffix.map((event) => event.eventId));
231
+ const theirsSuffix = theirs
232
+ .slice(shared)
233
+ .filter((event) => !oursEventIds.has(event.eventId));
234
+ const mergedSuffix = [...oursSuffix, ...theirsSuffix].sort((left, right) => {
235
+ if (left.timestamp !== undefined && right.timestamp !== undefined) {
236
+ const byTs = compareTimestampStrings(left.timestamp, right.timestamp);
237
+ if (byTs !== 0) {
238
+ return byTs;
239
+ }
240
+ }
241
+ else if (left.timestamp === undefined && right.timestamp !== undefined) {
242
+ return 1;
243
+ }
244
+ else if (left.timestamp !== undefined) {
245
+ return -1;
246
+ }
247
+ const leftFromOurs = oursEventIds.has(left.eventId);
248
+ const rightFromOurs = oursEventIds.has(right.eventId);
249
+ if (leftFromOurs !== rightFromOurs) {
250
+ return Number(rightFromOurs) - Number(leftFromOurs);
251
+ }
252
+ // Array.prototype.sort is stable: returning zero preserves each side's
253
+ // original append order when its events share a timestamp.
254
+ return 0;
255
+ });
256
+ const merged = renumberRelationshipEvents([
257
+ ...ours.slice(0, shared),
258
+ ...mergedSuffix,
259
+ ]);
260
+ return {
261
+ merged: relationshipEventsToRaw(merged),
262
+ strategy: "union_reanchor",
263
+ common_entries: shared,
264
+ entries_from_ours: oursSuffix.length,
265
+ entries_from_theirs: theirsSuffix.length,
266
+ entries_total: merged.length,
267
+ reanchored: true,
268
+ };
269
+ }
270
+ /**
271
+ * Item metadata collections merged by element-identity set semantics instead
272
+ * of whole-field three-way comparison: concurrent commutative appends from two
273
+ * branches (notes on A, tags on B, a test run on each) must merge cleanly.
274
+ * Element identity is the stable serialization of the normalized element, so
275
+ * an element edited on one side counts as remove-old + add-new and both sides'
276
+ * contributions survive. Plan collections are deliberately excluded: plan
277
+ * steps carry cross-element ordering invariants that set-union would corrupt,
278
+ * so they stay under scalar three-way semantics with explicit conflicts.
279
+ */
280
+ export const ITEM_UNION_COLLECTION_FIELDS = [
281
+ "tags",
282
+ "dependencies",
283
+ "comments",
284
+ "notes",
285
+ "learnings",
286
+ "files",
287
+ "tests",
288
+ "test_runs",
289
+ "docs",
290
+ "reminders",
291
+ "events",
292
+ ];
293
+ /** Item metadata fields resolved by deterministic latest-timestamp-wins instead of three-way conflict, so disjoint-field edits never conflict on the shared freshness scalar every mutation rewrites. */
294
+ export const ITEM_LATEST_TIMESTAMP_FIELDS = ["updated_at"];
295
+ function jsonEquals(left, right) {
296
+ return stableStringify(left ?? null) === stableStringify(right ?? null);
297
+ }
298
+ function unionCollection(base, ours, theirs) {
299
+ const toEntries = (value) => Array.isArray(value) ? value : [];
300
+ const baseIds = new Set(toEntries(base).map((entry) => stableStringify(entry)));
301
+ const oursEntries = toEntries(ours);
302
+ const oursIds = new Set(oursEntries.map((entry) => stableStringify(entry)));
303
+ const theirsEntries = toEntries(theirs);
304
+ const theirsIds = new Set(theirsEntries.map((entry) => stableStringify(entry)));
305
+ const merged = oursEntries.filter((entry) => {
306
+ const identity = stableStringify(entry);
307
+ // An element kept by ours survives unless theirs deleted it (present in
308
+ // base, absent from theirs).
309
+ return !baseIds.has(identity) || theirsIds.has(identity);
310
+ });
311
+ for (const entry of theirsEntries) {
312
+ const identity = stableStringify(entry);
313
+ if (!oursIds.has(identity) && !baseIds.has(identity)) {
314
+ merged.push(entry);
315
+ }
316
+ }
317
+ return merged;
318
+ }
319
+ function latestTimestamp(ours, theirs) {
320
+ return compareTimestampStrings(String(ours), String(theirs)) >= 0
321
+ ? ours
322
+ : theirs;
323
+ }
324
+ function mergeScalarThreeWay(base, ours, theirs, preferred) {
325
+ if (jsonEquals(ours, theirs)) {
326
+ return { value: ours, from_theirs: false, conflict: false };
327
+ }
328
+ if (jsonEquals(base, ours)) {
329
+ return { value: theirs, from_theirs: true, conflict: false };
330
+ }
331
+ if (jsonEquals(base, theirs)) {
332
+ return { value: ours, from_theirs: false, conflict: false };
333
+ }
334
+ return {
335
+ value: preferred === "theirs" ? theirs : ours,
336
+ from_theirs: preferred === "theirs",
337
+ conflict: true,
338
+ };
339
+ }
340
+ function toMetadataRecord(document) {
341
+ return { ...document.metadata };
342
+ }
343
+ function parseItemMergeSide(raw, label, options) {
344
+ try {
345
+ return canonicalDocument(parseItemDocument(raw, options), options);
346
+ }
347
+ catch (error) {
348
+ throw new PmCliError(`Item merge input (${label}) is not a readable item document: ${String(error)}`, EXIT_CODE.GENERIC_FAILURE);
349
+ }
350
+ }
351
+ function mergeItemMetadataRecords(baseRecord, oursRecord, theirsRecord, preferred) {
352
+ const unionFieldSet = new Set(ITEM_UNION_COLLECTION_FIELDS);
353
+ const latestFieldSet = new Set(ITEM_LATEST_TIMESTAMP_FIELDS);
354
+ const fieldNames = [
355
+ ...new Set([...Object.keys(oursRecord), ...Object.keys(theirsRecord)]),
356
+ ].sort((left, right) => left.localeCompare(right));
357
+ const accumulator = {
358
+ merged: {},
359
+ conflictFields: [],
360
+ fieldsFromTheirs: [],
361
+ unionFields: [],
362
+ };
363
+ for (const field of fieldNames) {
364
+ const baseValue = baseRecord[field];
365
+ const oursValue = oursRecord[field];
366
+ const theirsValue = theirsRecord[field];
367
+ if (unionFieldSet.has(field)) {
368
+ const union = unionCollection(baseValue, oursValue, theirsValue);
369
+ // `fieldNames` is derived from both records' own keys, so a collection
370
+ // reached here is declared by at least one side. Preserve even an empty
371
+ // result (`tags` is required) so serialization never drops it.
372
+ accumulator.merged[field] = union;
373
+ if (!jsonEquals(union, oursValue)) {
374
+ accumulator.unionFields.push(field);
375
+ }
376
+ continue;
377
+ }
378
+ if (latestFieldSet.has(field)) {
379
+ accumulator.merged[field] = latestTimestamp(oursValue, theirsValue);
380
+ continue;
381
+ }
382
+ const outcome = mergeScalarThreeWay(baseValue, oursValue, theirsValue, preferred);
383
+ if (outcome.value !== undefined) {
384
+ accumulator.merged[field] = outcome.value;
385
+ }
386
+ if (outcome.conflict) {
387
+ accumulator.conflictFields.push(field);
388
+ }
389
+ else if (outcome.from_theirs) {
390
+ accumulator.fieldsFromTheirs.push(field);
391
+ }
392
+ }
393
+ return accumulator;
394
+ }
395
+ /**
396
+ * Field-aware three-way merge of one tracker item document. Commutative
397
+ * collections (notes, tags, tests, ...) union by element identity so
398
+ * concurrent appends never conflict; `updated_at` resolves to the latest
399
+ * timestamp so disjoint-field edits never collide on the shared freshness
400
+ * scalar; every other metadata field and the body use classic three-way
401
+ * resolution. Unresolvable both-sides-changed conflicts are resolved toward
402
+ * the preferred side but reported in `conflict_fields`, and the merged output
403
+ * is always canonically serialized — count-prefixed TOON array headers are
404
+ * recomputed, so the hand-resolution corruption class (stale `notes[N]`
405
+ * headers) cannot be produced by this merge.
406
+ */
407
+ export function mergeItemDocuments(baseRaw, oursRaw, theirsRaw, options = {}) {
408
+ const preferred = options.preferred ?? "ours";
409
+ // An empty base means both branches created the file independently
410
+ // (add/add); three-way falls back to treating every differing field as an
411
+ // ours/theirs decision, which the scalar resolver already models.
412
+ const hasBase = baseRaw.trim().length > 0;
413
+ const ours = parseItemMergeSide(oursRaw, "ours", options);
414
+ const theirs = parseItemMergeSide(theirsRaw, "theirs", options);
415
+ const base = hasBase ? parseItemMergeSide(baseRaw, "base", options) : ours;
416
+ const baseRecord = hasBase
417
+ ? toMetadataRecord(base)
418
+ : {};
419
+ const oursRecord = toMetadataRecord(ours);
420
+ const theirsRecord = toMetadataRecord(theirs);
421
+ const { merged, conflictFields, fieldsFromTheirs, unionFields } = mergeItemMetadataRecords(baseRecord, oursRecord, theirsRecord, preferred);
422
+ const bodyOutcome = mergeScalarThreeWay(hasBase ? base.body : "", ours.body, theirs.body, preferred);
423
+ if (bodyOutcome.conflict) {
424
+ conflictFields.push("body");
425
+ }
426
+ else if (bodyOutcome.from_theirs) {
427
+ fieldsFromTheirs.push("body");
428
+ }
429
+ const mergedRaw = serializeItemDocument({
430
+ metadata: merged,
431
+ body: bodyOutcome.value,
432
+ }, options);
433
+ return {
434
+ merged: mergedRaw,
435
+ conflict_fields: conflictFields,
436
+ fields_from_theirs: fieldsFromTheirs,
437
+ union_fields: unionFields,
438
+ preferred,
439
+ };
440
+ }
441
+ function isPlainObject(value) {
442
+ return (typeof value === "object" &&
443
+ value !== null &&
444
+ !Array.isArray(value));
445
+ }
446
+ function parseJsonSide(raw, label) {
447
+ const conflictMarker = findFirstMergeConflictMarker(raw);
448
+ if (conflictMarker) {
449
+ throw new PmCliError(`JSON merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}.`, EXIT_CODE.GENERIC_FAILURE);
450
+ }
451
+ if (raw.trim().length === 0) {
452
+ return undefined;
453
+ }
454
+ try {
455
+ return JSON.parse(raw);
456
+ }
457
+ catch {
458
+ throw new PmCliError(`JSON merge input (${label}) is not valid JSON.`, EXIT_CODE.GENERIC_FAILURE);
459
+ }
460
+ }
461
+ function mergeJsonValue(base, ours, theirs, preferred, pathPrefix, conflictPaths, pathsFromTheirs) {
462
+ if (jsonEquals(ours, theirs)) {
463
+ return ours;
464
+ }
465
+ if (isPlainObject(ours) && isPlainObject(theirs)) {
466
+ const baseObject = isPlainObject(base) ? base : {};
467
+ const merged = {};
468
+ const keys = [
469
+ ...new Set([...Object.keys(ours), ...Object.keys(theirs)]),
470
+ ].sort((left, right) => left.localeCompare(right));
471
+ for (const key of keys) {
472
+ const childPath = pathPrefix.length > 0 ? `${pathPrefix}.${key}` : key;
473
+ const child = mergeJsonKey(baseObject, ours, theirs, key, preferred, childPath, conflictPaths, pathsFromTheirs);
474
+ if (child !== undefined) {
475
+ merged[key] = child;
476
+ }
477
+ }
478
+ return merged;
479
+ }
480
+ const outcome = mergeScalarThreeWay(base, ours, theirs, preferred);
481
+ if (outcome.conflict) {
482
+ conflictPaths.push(pathPrefix);
483
+ }
484
+ else if (outcome.from_theirs) {
485
+ pathsFromTheirs.push(pathPrefix);
486
+ }
487
+ return outcome.value;
488
+ }
489
+ function mergeJsonKey(base, ours, theirs, key, preferred, childPath, conflictPaths, pathsFromTheirs) {
490
+ const inOurs = Object.prototype.hasOwnProperty.call(ours, key);
491
+ const inTheirs = Object.prototype.hasOwnProperty.call(theirs, key);
492
+ const inBase = Object.prototype.hasOwnProperty.call(base, key);
493
+ if (inOurs && inTheirs) {
494
+ return mergeJsonValue(base[key], ours[key], theirs[key], preferred, childPath, conflictPaths, pathsFromTheirs);
495
+ }
496
+ if (inOurs) {
497
+ // Present only in ours: either ours added it (keep) or theirs deleted it
498
+ // (honor the delete when ours left it untouched from base).
499
+ if (inBase && jsonEquals(base[key], ours[key])) {
500
+ pathsFromTheirs.push(childPath);
501
+ return undefined;
502
+ }
503
+ if (inBase) {
504
+ conflictPaths.push(childPath);
505
+ return preferred === "theirs" ? undefined : ours[key];
506
+ }
507
+ return ours[key];
508
+ }
509
+ // Present only in theirs (mirror of the branch above).
510
+ if (inBase && jsonEquals(base[key], theirs[key])) {
511
+ return undefined;
512
+ }
513
+ if (inBase) {
514
+ conflictPaths.push(childPath);
515
+ return preferred === "theirs" ? theirs[key] : undefined;
516
+ }
517
+ pathsFromTheirs.push(childPath);
518
+ return theirs[key];
519
+ }
520
+ /**
521
+ * Key-level three-way merge for the tracker's single-file JSON configuration
522
+ * artifacts (`settings.json`, `schema/*.json`). Nested objects merge
523
+ * recursively per key so two branches editing disjoint settings never
524
+ * conflict; both-sides-changed leaf values resolve toward the preferred side
525
+ * and are reported in `conflict_paths`. The output is always valid JSON, so a
526
+ * merged configuration can never regress into the silent-defaults fallback
527
+ * that raw conflict markers cause.
528
+ */
529
+ export function mergeJsonDocuments(baseRaw, oursRaw, theirsRaw, options = {}) {
530
+ const preferred = options.preferred ?? "ours";
531
+ const base = parseJsonSide(baseRaw, "base");
532
+ const ours = parseJsonSide(oursRaw, "ours");
533
+ const theirs = parseJsonSide(theirsRaw, "theirs");
534
+ const conflictPaths = [];
535
+ const pathsFromTheirs = [];
536
+ const merged = mergeJsonValue(base, ours, theirs, preferred, "", conflictPaths, pathsFromTheirs);
537
+ return {
538
+ merged: `${JSON.stringify(merged ?? null, null, 2)}\n`,
539
+ conflict_paths: conflictPaths,
540
+ paths_from_theirs: pathsFromTheirs,
541
+ preferred,
542
+ };
543
+ }
544
+ //# sourceMappingURL=three-way.js.map
545
+ //# debugId=fa427b53-b1ae-53d0-acec-dfc1eb22bfd1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"three-way.js","sources":["sdk/merge/three-way.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/merge/three-way\n *\n * Field-aware three-way merge primitives for every mergeable tracker artifact\n * class: append-only history JSONL streams, item documents (TOON or\n * JSON+Markdown), and key-level JSON configuration/schema files. These\n * primitives are pure (content in, content out) so the CLI merge driver, the\n * MCP surface, and package integrations all share one merge semantics\n * definition for multi-branch agent workflows.\n */\nimport {\n historyEntriesToRaw,\n reanchorHistoryEntries,\n} from \"../../core/history/replay.js\";\nimport {\n canonicalDocument,\n parseItemDocument,\n serializeItemDocument,\n type ItemDocumentFormatOptions,\n} from \"../../core/item/item-format.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { findFirstMergeConflictMarker } from \"../../core/shared/conflict-markers.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { stableStringify } from \"../../core/shared/serialization.js\";\nimport { compareTimestampStrings } from \"../../core/shared/time.js\";\nimport type {\n HistoryEntry,\n ItemDocument,\n ItemMetadata,\n} from \"../../types/index.js\";\n\n/** Restricts which side of a three-way merge wins an unresolvable conflict. */\nexport type MergePreferredSide = \"ours\" | \"theirs\";\n\n/** Restricts the strategy labels reported by the history stream merge. */\nexport type HistoryMergeStrategy =\n | \"identical\"\n | \"fast_forward_ours\"\n | \"fast_forward_theirs\"\n | \"union_reanchor\";\n\n/** Documents the history stream merge result payload exchanged by command, SDK, and package integrations. */\nexport interface HistoryMergeResult {\n /** Merged JSONL content ready to be written as the resolved history stream. */\n merged: string;\n /** Strategy the merge used: identical inputs, one-sided fast-forward, or a deterministic union with a re-anchored hash chain. */\n strategy: HistoryMergeStrategy;\n /** Number of entries shared by both sides before their streams diverged. */\n common_entries: number;\n /** Number of divergent entries contributed by the ours side. */\n entries_from_ours: number;\n /** Number of divergent entries contributed by the theirs side. */\n entries_from_theirs: number;\n /** Total entries in the merged stream. */\n entries_total: number;\n /** Whether the merged chain required hash re-anchoring (true for every union merge). */\n reanchored: boolean;\n}\n\nfunction parseHistoryJsonl(raw: string, label: string): HistoryEntry[] {\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `History merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const entries: HistoryEntry[] = [];\n for (const [index, rawLine] of raw.split(/\\r?\\n/).entries()) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n try {\n const parsed = JSON.parse(line) as unknown;\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new TypeError(\"history entry must be an object\");\n }\n entries.push(parsed as HistoryEntry);\n } catch {\n throw new PmCliError(\n `History merge input (${label}) contains invalid JSON at line ${index + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n return entries;\n}\n\nfunction historyEntryIdentity(entry: HistoryEntry): string {\n return stableStringify({\n ts: entry.ts,\n author: entry.author,\n op: entry.op,\n patch: entry.patch,\n message: entry.message ?? null,\n });\n}\n\nfunction commonHistoryPrefixLength(\n ours: HistoryEntry[],\n theirs: HistoryEntry[],\n): number {\n const limit = Math.min(ours.length, theirs.length);\n let shared = 0;\n while (\n shared < limit &&\n historyEntryIdentity(ours[shared]) === historyEntryIdentity(theirs[shared])\n ) {\n shared += 1;\n }\n return shared;\n}\n\n/**\n * Deterministically merge two diverged versions of one append-only history\n * JSONL stream. Identical streams and one-sided fast-forwards keep the winning\n * side byte-for-byte; genuinely diverged streams are merged as the shared\n * prefix plus both suffixes ordered by timestamp (ours-first on ties), then\n * hash re-anchored so the resulting chain verifies again. No side's events are\n * ever discarded: content divergence is preserved for the post-merge\n * reconciliation pass (`pm validate` + `pm history-repair`) instead of being\n * silently resolved by last-writer-wins.\n */\nexport function mergeHistoryStreams(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n): HistoryMergeResult {\n parseHistoryJsonl(baseRaw, \"base\");\n const ours = parseHistoryJsonl(oursRaw, \"ours\");\n const theirs = parseHistoryJsonl(theirsRaw, \"theirs\");\n const shared = commonHistoryPrefixLength(ours, theirs);\n\n if (shared === ours.length && shared === theirs.length) {\n return {\n merged: historyEntriesToRaw(ours),\n strategy: \"identical\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === theirs.length) {\n return {\n merged: historyEntriesToRaw(ours),\n strategy: \"fast_forward_ours\",\n common_entries: shared,\n entries_from_ours: ours.length - shared,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === ours.length) {\n return {\n merged: historyEntriesToRaw(theirs),\n strategy: \"fast_forward_theirs\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: theirs.length - shared,\n entries_total: theirs.length,\n reanchored: false,\n };\n }\n\n const oursSuffix = ours.slice(shared);\n const seenIdentities = new Set(oursSuffix.map(historyEntryIdentity));\n const theirsSuffix = theirs\n .slice(shared)\n .filter((entry) => !seenIdentities.has(historyEntryIdentity(entry)));\n const mergedSuffix = [...oursSuffix, ...theirsSuffix].sort((left, right) => {\n const byTs = compareTimestampStrings(left.ts, right.ts);\n if (byTs !== 0) {\n return byTs;\n }\n const leftFromOurs = seenIdentities.has(historyEntryIdentity(left));\n const rightFromOurs = seenIdentities.has(historyEntryIdentity(right));\n if (leftFromOurs !== rightFromOurs) {\n return Number(rightFromOurs) - Number(leftFromOurs);\n }\n return historyEntryIdentity(left).localeCompare(historyEntryIdentity(right));\n });\n const reanchored = reanchorHistoryEntries([\n ...ours.slice(0, shared),\n ...mergedSuffix,\n ]);\n return {\n merged: historyEntriesToRaw(reanchored.entries),\n strategy: \"union_reanchor\",\n common_entries: shared,\n entries_from_ours: oursSuffix.length,\n entries_from_theirs: theirsSuffix.length,\n entries_total: reanchored.entries.length,\n reanchored: true,\n };\n}\n\n/** Documents the relationship event stream merge result payload exchanged by command, SDK, and package integrations. */\nexport interface RelationshipStreamMergeResult {\n /** Merged JSONL content with consecutively renumbered `sequence` values, ready to be written as the resolved event store. */\n merged: string;\n /** Strategy the merge used: identical inputs, one-sided fast-forward, or a deterministic union with renumbered sequences. */\n strategy: HistoryMergeStrategy;\n /** Number of events shared by both sides before their streams diverged. */\n common_entries: number;\n /** Number of divergent events contributed by the ours side. */\n entries_from_ours: number;\n /** Number of divergent events contributed by the theirs side. */\n entries_from_theirs: number;\n /** Total events in the merged stream. */\n entries_total: number;\n /** Whether merged events required sequence renumbering (true for every union merge). */\n reanchored: boolean;\n}\n\ninterface RelationshipStreamEvent {\n /** Globally unique event identity used for prefix detection and suffix deduplication. */\n eventId: string;\n /** One-based append sequence; rewritten consecutively in the merged stream. */\n sequence: number;\n /** ISO timestamp used to order divergent suffixes deterministically. */\n timestamp?: string;\n /** Remaining event payload fields, preserved verbatim. */\n [key: string]: unknown;\n}\n\nfunction parseRelationshipJsonl(\n raw: string,\n label: string,\n): RelationshipStreamEvent[] {\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `Relationship merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const events: RelationshipStreamEvent[] = [];\n for (const [index, rawLine] of raw.split(/\\r?\\n/).entries()) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(line) as unknown;\n } catch {\n throw new PmCliError(\n `Relationship merge input (${label}) contains invalid JSON at line ${index + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n Array.isArray(parsed) ||\n typeof (parsed as { eventId?: unknown }).eventId !== \"string\" ||\n typeof (parsed as { sequence?: unknown }).sequence !== \"number\"\n ) {\n throw new PmCliError(\n `Relationship merge input (${label}) line ${index + 1} is not a relationship event (eventId + sequence required).`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n events.push(parsed as RelationshipStreamEvent);\n }\n return events;\n}\n\nfunction relationshipEventsToRaw(events: RelationshipStreamEvent[]): string {\n return events.length === 0\n ? \"\"\n : `${events.map((event) => JSON.stringify(event)).join(\"\\n\")}\\n`;\n}\n\nfunction renumberRelationshipEvents(\n events: RelationshipStreamEvent[],\n): RelationshipStreamEvent[] {\n return events.map((event, index) => ({ ...event, sequence: index + 1 }));\n}\n\n/**\n * Deterministically merge two diverged versions of one append-only\n * relationship event JSONL store. The store's loader enforces strictly\n * consecutive one-based `sequence` values, so a plain text union of two\n * diverged streams is always unreadable; this merge keeps the shared prefix,\n * unions both divergent suffixes by `eventId` (ordered by event timestamp,\n * ours-first on ties), and renumbers every merged sequence consecutively so\n * the resulting stream loads again. No side's events are ever discarded.\n */\nexport function mergeRelationshipEventStreams(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n): RelationshipStreamMergeResult {\n parseRelationshipJsonl(baseRaw, \"base\");\n const ours = parseRelationshipJsonl(oursRaw, \"ours\");\n const theirs = parseRelationshipJsonl(theirsRaw, \"theirs\");\n const limit = Math.min(ours.length, theirs.length);\n let shared = 0;\n while (shared < limit && ours[shared].eventId === theirs[shared].eventId) {\n shared += 1;\n }\n\n if (shared === ours.length && shared === theirs.length) {\n return {\n merged: relationshipEventsToRaw(ours),\n strategy: \"identical\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === theirs.length) {\n return {\n merged: relationshipEventsToRaw(ours),\n strategy: \"fast_forward_ours\",\n common_entries: shared,\n entries_from_ours: ours.length - shared,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === ours.length) {\n return {\n merged: relationshipEventsToRaw(theirs),\n strategy: \"fast_forward_theirs\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: theirs.length - shared,\n entries_total: theirs.length,\n reanchored: false,\n };\n }\n\n const oursSuffix = ours.slice(shared);\n const oursEventIds = new Set(oursSuffix.map((event) => event.eventId));\n const theirsSuffix = theirs\n .slice(shared)\n .filter((event) => !oursEventIds.has(event.eventId));\n const mergedSuffix = [...oursSuffix, ...theirsSuffix].sort((left, right) => {\n if (left.timestamp !== undefined && right.timestamp !== undefined) {\n const byTs = compareTimestampStrings(left.timestamp, right.timestamp);\n if (byTs !== 0) {\n return byTs;\n }\n } else if (left.timestamp === undefined && right.timestamp !== undefined) {\n return 1;\n } else if (left.timestamp !== undefined) {\n return -1;\n }\n const leftFromOurs = oursEventIds.has(left.eventId);\n const rightFromOurs = oursEventIds.has(right.eventId);\n if (leftFromOurs !== rightFromOurs) {\n return Number(rightFromOurs) - Number(leftFromOurs);\n }\n // Array.prototype.sort is stable: returning zero preserves each side's\n // original append order when its events share a timestamp.\n return 0;\n });\n const merged = renumberRelationshipEvents([\n ...ours.slice(0, shared),\n ...mergedSuffix,\n ]);\n return {\n merged: relationshipEventsToRaw(merged),\n strategy: \"union_reanchor\",\n common_entries: shared,\n entries_from_ours: oursSuffix.length,\n entries_from_theirs: theirsSuffix.length,\n entries_total: merged.length,\n reanchored: true,\n };\n}\n\n/**\n * Item metadata collections merged by element-identity set semantics instead\n * of whole-field three-way comparison: concurrent commutative appends from two\n * branches (notes on A, tags on B, a test run on each) must merge cleanly.\n * Element identity is the stable serialization of the normalized element, so\n * an element edited on one side counts as remove-old + add-new and both sides'\n * contributions survive. Plan collections are deliberately excluded: plan\n * steps carry cross-element ordering invariants that set-union would corrupt,\n * so they stay under scalar three-way semantics with explicit conflicts.\n */\nexport const ITEM_UNION_COLLECTION_FIELDS = [\n \"tags\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"reminders\",\n \"events\",\n] as const;\n\n/** Item metadata fields resolved by deterministic latest-timestamp-wins instead of three-way conflict, so disjoint-field edits never conflict on the shared freshness scalar every mutation rewrites. */\nexport const ITEM_LATEST_TIMESTAMP_FIELDS = [\"updated_at\"] as const;\n\n/** Documents the item document merge result payload exchanged by command, SDK, and package integrations. */\nexport interface ItemDocumentMergeResult {\n /** Serialized merged item document (always parseable; count headers recomputed by canonical serialization). */\n merged: string;\n /** Metadata fields (plus `body`) where both sides changed to different values; resolved toward the preferred side. */\n conflict_fields: string[];\n /** Fields taken from the theirs side by clean three-way resolution. */\n fields_from_theirs: string[];\n /** Collection fields that merged by element-identity union. */\n union_fields: string[];\n /** Which side unresolvable conflicts were resolved toward. */\n preferred: MergePreferredSide;\n}\n\nfunction jsonEquals(left: unknown, right: unknown): boolean {\n return stableStringify(left ?? null) === stableStringify(right ?? null);\n}\n\nfunction unionCollection(\n base: unknown,\n ours: unknown,\n theirs: unknown,\n): unknown[] {\n const toEntries = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : [];\n const baseIds = new Set(toEntries(base).map((entry) => stableStringify(entry)));\n const oursEntries = toEntries(ours);\n const oursIds = new Set(oursEntries.map((entry) => stableStringify(entry)));\n const theirsEntries = toEntries(theirs);\n const theirsIds = new Set(\n theirsEntries.map((entry) => stableStringify(entry)),\n );\n const merged = oursEntries.filter((entry) => {\n const identity = stableStringify(entry);\n // An element kept by ours survives unless theirs deleted it (present in\n // base, absent from theirs).\n return !baseIds.has(identity) || theirsIds.has(identity);\n });\n for (const entry of theirsEntries) {\n const identity = stableStringify(entry);\n if (!oursIds.has(identity) && !baseIds.has(identity)) {\n merged.push(entry);\n }\n }\n return merged;\n}\n\nfunction latestTimestamp(ours: unknown, theirs: unknown): unknown {\n return compareTimestampStrings(String(ours), String(theirs)) >= 0\n ? ours\n : theirs;\n}\n\ninterface ScalarMergeOutcome {\n value: unknown;\n from_theirs: boolean;\n conflict: boolean;\n}\n\nfunction mergeScalarThreeWay(\n base: unknown,\n ours: unknown,\n theirs: unknown,\n preferred: MergePreferredSide,\n): ScalarMergeOutcome {\n if (jsonEquals(ours, theirs)) {\n return { value: ours, from_theirs: false, conflict: false };\n }\n if (jsonEquals(base, ours)) {\n return { value: theirs, from_theirs: true, conflict: false };\n }\n if (jsonEquals(base, theirs)) {\n return { value: ours, from_theirs: false, conflict: false };\n }\n return {\n value: preferred === \"theirs\" ? theirs : ours,\n from_theirs: preferred === \"theirs\",\n conflict: true,\n };\n}\n\nfunction toMetadataRecord(document: ItemDocument): Record<string, unknown> {\n return { ...(document.metadata as unknown as Record<string, unknown>) };\n}\n\nfunction parseItemMergeSide(\n raw: string,\n label: string,\n options: ItemDocumentFormatOptions,\n): ItemDocument {\n try {\n return canonicalDocument(parseItemDocument(raw, options), options);\n } catch (error) {\n throw new PmCliError(\n `Item merge input (${label}) is not a readable item document: ${String(error)}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\ninterface ItemMetadataMergeAccumulator {\n /** Merged metadata values keyed by canonical field name. */\n merged: Record<string, unknown>;\n /** Scalar fields where both sides diverged from the base. */\n conflictFields: string[];\n /** Scalar fields cleanly selected from the other branch. */\n fieldsFromTheirs: string[];\n /** Collection fields whose final union differs from ours. */\n unionFields: string[];\n}\n\nfunction mergeItemMetadataRecords(\n baseRecord: Record<string, unknown>,\n oursRecord: Record<string, unknown>,\n theirsRecord: Record<string, unknown>,\n preferred: MergePreferredSide,\n): ItemMetadataMergeAccumulator {\n const unionFieldSet = new Set<string>(ITEM_UNION_COLLECTION_FIELDS);\n const latestFieldSet = new Set<string>(ITEM_LATEST_TIMESTAMP_FIELDS);\n const fieldNames = [\n ...new Set([...Object.keys(oursRecord), ...Object.keys(theirsRecord)]),\n ].sort((left, right) => left.localeCompare(right));\n const accumulator: ItemMetadataMergeAccumulator = {\n merged: {},\n conflictFields: [],\n fieldsFromTheirs: [],\n unionFields: [],\n };\n\n for (const field of fieldNames) {\n const baseValue = baseRecord[field];\n const oursValue = oursRecord[field];\n const theirsValue = theirsRecord[field];\n if (unionFieldSet.has(field)) {\n const union = unionCollection(baseValue, oursValue, theirsValue);\n // `fieldNames` is derived from both records' own keys, so a collection\n // reached here is declared by at least one side. Preserve even an empty\n // result (`tags` is required) so serialization never drops it.\n accumulator.merged[field] = union;\n if (!jsonEquals(union, oursValue)) {\n accumulator.unionFields.push(field);\n }\n continue;\n }\n if (latestFieldSet.has(field)) {\n accumulator.merged[field] = latestTimestamp(oursValue, theirsValue);\n continue;\n }\n const outcome = mergeScalarThreeWay(\n baseValue,\n oursValue,\n theirsValue,\n preferred,\n );\n if (outcome.value !== undefined) {\n accumulator.merged[field] = outcome.value;\n }\n if (outcome.conflict) {\n accumulator.conflictFields.push(field);\n } else if (outcome.from_theirs) {\n accumulator.fieldsFromTheirs.push(field);\n }\n }\n return accumulator;\n}\n\n/**\n * Field-aware three-way merge of one tracker item document. Commutative\n * collections (notes, tags, tests, ...) union by element identity so\n * concurrent appends never conflict; `updated_at` resolves to the latest\n * timestamp so disjoint-field edits never collide on the shared freshness\n * scalar; every other metadata field and the body use classic three-way\n * resolution. Unresolvable both-sides-changed conflicts are resolved toward\n * the preferred side but reported in `conflict_fields`, and the merged output\n * is always canonically serialized — count-prefixed TOON array headers are\n * recomputed, so the hand-resolution corruption class (stale `notes[N]`\n * headers) cannot be produced by this merge.\n */\nexport function mergeItemDocuments(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n options: ItemDocumentFormatOptions & {\n /** Side that wins unresolvable conflicts (default \"ours\"). */\n preferred?: MergePreferredSide;\n } = {},\n): ItemDocumentMergeResult {\n const preferred: MergePreferredSide = options.preferred ?? \"ours\";\n // An empty base means both branches created the file independently\n // (add/add); three-way falls back to treating every differing field as an\n // ours/theirs decision, which the scalar resolver already models.\n const hasBase = baseRaw.trim().length > 0;\n const ours = parseItemMergeSide(oursRaw, \"ours\", options);\n const theirs = parseItemMergeSide(theirsRaw, \"theirs\", options);\n const base = hasBase ? parseItemMergeSide(baseRaw, \"base\", options) : ours;\n\n const baseRecord = hasBase\n ? toMetadataRecord(base)\n : ({} as Record<string, unknown>);\n const oursRecord = toMetadataRecord(ours);\n const theirsRecord = toMetadataRecord(theirs);\n const { merged, conflictFields, fieldsFromTheirs, unionFields } =\n mergeItemMetadataRecords(baseRecord, oursRecord, theirsRecord, preferred);\n\n const bodyOutcome = mergeScalarThreeWay(\n hasBase ? base.body : \"\",\n ours.body,\n theirs.body,\n preferred,\n );\n if (bodyOutcome.conflict) {\n conflictFields.push(\"body\");\n } else if (bodyOutcome.from_theirs) {\n fieldsFromTheirs.push(\"body\");\n }\n\n const mergedRaw = serializeItemDocument(\n {\n metadata: merged as unknown as ItemMetadata,\n body: bodyOutcome.value as string,\n },\n options,\n );\n return {\n merged: mergedRaw,\n conflict_fields: conflictFields,\n fields_from_theirs: fieldsFromTheirs,\n union_fields: unionFields,\n preferred,\n };\n}\n\n/** Documents the JSON document merge result payload exchanged by command, SDK, and package integrations. */\nexport interface JsonDocumentMergeResult {\n /** Serialized merged JSON document (two-space indent, trailing newline — the tracker's canonical config style). */\n merged: string;\n /** Dotted key paths where both sides changed to different values; resolved toward the preferred side. */\n conflict_paths: string[];\n /** Dotted key paths taken from the theirs side by clean three-way resolution. */\n paths_from_theirs: string[];\n /** Which side unresolvable conflicts were resolved toward. */\n preferred: MergePreferredSide;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value)\n );\n}\n\nfunction parseJsonSide(raw: string, label: string): unknown {\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `JSON merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (raw.trim().length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(raw) as unknown;\n } catch {\n throw new PmCliError(\n `JSON merge input (${label}) is not valid JSON.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\nfunction mergeJsonValue(\n base: unknown,\n ours: unknown,\n theirs: unknown,\n preferred: MergePreferredSide,\n pathPrefix: string,\n conflictPaths: string[],\n pathsFromTheirs: string[],\n): unknown {\n if (jsonEquals(ours, theirs)) {\n return ours;\n }\n if (isPlainObject(ours) && isPlainObject(theirs)) {\n const baseObject = isPlainObject(base) ? base : {};\n const merged: Record<string, unknown> = {};\n const keys = [\n ...new Set([...Object.keys(ours), ...Object.keys(theirs)]),\n ].sort((left, right) => left.localeCompare(right));\n for (const key of keys) {\n const childPath = pathPrefix.length > 0 ? `${pathPrefix}.${key}` : key;\n const child = mergeJsonKey(\n baseObject,\n ours,\n theirs,\n key,\n preferred,\n childPath,\n conflictPaths,\n pathsFromTheirs,\n );\n if (child !== undefined) {\n merged[key] = child;\n }\n }\n return merged;\n }\n const outcome = mergeScalarThreeWay(base, ours, theirs, preferred);\n if (outcome.conflict) {\n conflictPaths.push(pathPrefix);\n } else if (outcome.from_theirs) {\n pathsFromTheirs.push(pathPrefix);\n }\n return outcome.value;\n}\n\nfunction mergeJsonKey(\n base: Record<string, unknown>,\n ours: Record<string, unknown>,\n theirs: Record<string, unknown>,\n key: string,\n preferred: MergePreferredSide,\n childPath: string,\n conflictPaths: string[],\n pathsFromTheirs: string[],\n): unknown {\n const inOurs = Object.prototype.hasOwnProperty.call(ours, key);\n const inTheirs = Object.prototype.hasOwnProperty.call(theirs, key);\n const inBase = Object.prototype.hasOwnProperty.call(base, key);\n if (inOurs && inTheirs) {\n return mergeJsonValue(\n base[key],\n ours[key],\n theirs[key],\n preferred,\n childPath,\n conflictPaths,\n pathsFromTheirs,\n );\n }\n if (inOurs) {\n // Present only in ours: either ours added it (keep) or theirs deleted it\n // (honor the delete when ours left it untouched from base).\n if (inBase && jsonEquals(base[key], ours[key])) {\n pathsFromTheirs.push(childPath);\n return undefined;\n }\n if (inBase) {\n conflictPaths.push(childPath);\n return preferred === \"theirs\" ? undefined : ours[key];\n }\n return ours[key];\n }\n // Present only in theirs (mirror of the branch above).\n if (inBase && jsonEquals(base[key], theirs[key])) {\n return undefined;\n }\n if (inBase) {\n conflictPaths.push(childPath);\n return preferred === \"theirs\" ? theirs[key] : undefined;\n }\n pathsFromTheirs.push(childPath);\n return theirs[key];\n}\n\n/**\n * Key-level three-way merge for the tracker's single-file JSON configuration\n * artifacts (`settings.json`, `schema/*.json`). Nested objects merge\n * recursively per key so two branches editing disjoint settings never\n * conflict; both-sides-changed leaf values resolve toward the preferred side\n * and are reported in `conflict_paths`. The output is always valid JSON, so a\n * merged configuration can never regress into the silent-defaults fallback\n * that raw conflict markers cause.\n */\nexport function mergeJsonDocuments(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n options: {\n /** Side that wins unresolvable conflicts (default \"ours\"). */\n preferred?: MergePreferredSide;\n } = {},\n): JsonDocumentMergeResult {\n const preferred: MergePreferredSide = options.preferred ?? \"ours\";\n const base = parseJsonSide(baseRaw, \"base\");\n const ours = parseJsonSide(oursRaw, \"ours\");\n const theirs = parseJsonSide(theirsRaw, \"theirs\");\n const conflictPaths: string[] = [];\n const pathsFromTheirs: string[] = [];\n const merged = mergeJsonValue(\n base,\n ours,\n theirs,\n preferred,\n \"\",\n conflictPaths,\n pathsFromTheirs,\n );\n return {\n merged: `${JSON.stringify(merged ?? null, null, 2)}\\n`,\n conflict_paths: conflictPaths,\n paths_from_theirs: pathsFromTheirs,\n preferred,\n };\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;;AACH,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,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