@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,166 @@
1
+ /**
2
+ * @module sdk/merge/driver
3
+ *
4
+ * File-level git merge driver runner for tracker artifacts. Git invokes the
5
+ * driver with the base (%O), ours (%A), and theirs (%B) temporary files; the
6
+ * driver writes the merged content back to the ours path and reports whether
7
+ * unresolvable conflicts remain. Conflicted artifacts are still written as
8
+ * parseable documents (resolved toward the preferred side) so a conflicted
9
+ * merge never corrupts tracker storage the way raw conflict markers do.
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]="dcd2575e-24f4-58db-b4ab-d64277c71d7c")}catch(e){}}();
13
+ import { readFile, writeFile } from "node:fs/promises";
14
+ import path from "node:path";
15
+ import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
16
+ import { collectRegisteredItemFieldNames } from "../../core/extensions/item-fields.js";
17
+ import { pathExists } from "../../core/fs/fs-utils.js";
18
+ import { EXIT_CODE } from "../../core/shared/constants.js";
19
+ import { PmCliError } from "../../core/shared/errors.js";
20
+ import { nowIso } from "../../core/shared/time.js";
21
+ import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
22
+ import { readSettings } from "../../core/store/settings.js";
23
+ import { mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, } from "./three-way.js";
24
+ /** Supported values accepted by the merge driver artifact contract across CLI, SDK, and MCP surfaces. */
25
+ export const MERGE_DRIVER_ARTIFACT_VALUES = [
26
+ "item",
27
+ "history",
28
+ "relationship",
29
+ "json",
30
+ ];
31
+ function resolveArtifact(value) {
32
+ const normalized = value.trim().toLowerCase();
33
+ if (MERGE_DRIVER_ARTIFACT_VALUES.includes(normalized)) {
34
+ return normalized;
35
+ }
36
+ throw new PmCliError(`Unknown merge artifact "${value}". Supported values: ${MERGE_DRIVER_ARTIFACT_VALUES.join(", ")}.`, EXIT_CODE.USAGE);
37
+ }
38
+ function resolvePreferredSide(value) {
39
+ if (value === undefined) {
40
+ return "ours";
41
+ }
42
+ const normalized = value.trim().toLowerCase();
43
+ if (normalized === "ours" || normalized === "theirs") {
44
+ return normalized;
45
+ }
46
+ throw new PmCliError(`Unknown --prefer value "${value}". Supported values: ours, theirs.`, EXIT_CODE.USAGE);
47
+ }
48
+ async function readSideFile(filePath, label) {
49
+ try {
50
+ return await readFile(filePath, "utf8");
51
+ }
52
+ catch {
53
+ throw new PmCliError(`Cannot read merge ${label} file at ${filePath}.`, EXIT_CODE.NOT_FOUND);
54
+ }
55
+ }
56
+ /**
57
+ * Load the workspace settings when a tracker is initialized at the resolved pm
58
+ * root, or fall back to format defaults when the driver runs outside a tracker
59
+ * (git can invoke merge drivers before `pm init`, e.g. while rebasing the
60
+ * commit that introduces the tracker).
61
+ */
62
+ async function loadOptionalSettings(global) {
63
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
64
+ if (!(await pathExists(getSettingsPath(pmRoot)))) {
65
+ return null;
66
+ }
67
+ return readSettings(pmRoot);
68
+ }
69
+ function itemFormatForPath(filePath, settings) {
70
+ if (filePath.endsWith(".md")) {
71
+ return "json_markdown";
72
+ }
73
+ if (filePath.endsWith(".toon")) {
74
+ return "toon";
75
+ }
76
+ return settings?.item_format ?? "toon";
77
+ }
78
+ /**
79
+ * Execute one git merge-driver invocation for a tracker artifact. Reads the
80
+ * three per-side versions, applies the artifact's field-aware merge semantics,
81
+ * writes the merged content (parseable even when conflicted) to the output
82
+ * path, and reports remaining conflicts so the CLI can exit non-zero and let
83
+ * git mark the path unmerged.
84
+ */
85
+ export async function runMergeDriver(options, global) {
86
+ const artifact = resolveArtifact(options.artifact);
87
+ const preferred = resolvePreferredSide(options.prefer);
88
+ const outputPath = path.resolve(options.outputPath ?? options.oursPath);
89
+ const [baseRaw, oursRaw, theirsRaw] = await Promise.all([
90
+ readSideFile(options.basePath, "base"),
91
+ readSideFile(options.oursPath, "ours"),
92
+ readSideFile(options.theirsPath, "theirs"),
93
+ ]);
94
+ let merged;
95
+ const conflicts = [];
96
+ const result = {};
97
+ if (artifact === "history") {
98
+ const historyMerge = mergeHistoryStreams(baseRaw, oursRaw, theirsRaw);
99
+ merged = historyMerge.merged;
100
+ result.history = {
101
+ strategy: historyMerge.strategy,
102
+ common_entries: historyMerge.common_entries,
103
+ entries_from_ours: historyMerge.entries_from_ours,
104
+ entries_from_theirs: historyMerge.entries_from_theirs,
105
+ entries_total: historyMerge.entries_total,
106
+ reanchored: historyMerge.reanchored,
107
+ };
108
+ }
109
+ else if (artifact === "relationship") {
110
+ const relationshipMerge = mergeRelationshipEventStreams(baseRaw, oursRaw, theirsRaw);
111
+ merged = relationshipMerge.merged;
112
+ result.relationship = {
113
+ strategy: relationshipMerge.strategy,
114
+ common_entries: relationshipMerge.common_entries,
115
+ entries_from_ours: relationshipMerge.entries_from_ours,
116
+ entries_from_theirs: relationshipMerge.entries_from_theirs,
117
+ entries_total: relationshipMerge.entries_total,
118
+ reanchored: relationshipMerge.reanchored,
119
+ };
120
+ }
121
+ else if (artifact === "item") {
122
+ const settings = await loadOptionalSettings(global);
123
+ const itemMerge = mergeItemDocuments(baseRaw, oursRaw, theirsRaw, {
124
+ format: itemFormatForPath(options.itemPath ?? outputPath, settings),
125
+ schema: settings?.schema,
126
+ extensionFieldNames: collectRegisteredItemFieldNames(getActiveExtensionRegistrations()),
127
+ preferred,
128
+ });
129
+ merged = itemMerge.merged;
130
+ conflicts.push(...itemMerge.conflict_fields);
131
+ result.item = {
132
+ fields_from_theirs: itemMerge.fields_from_theirs,
133
+ union_fields: itemMerge.union_fields,
134
+ };
135
+ }
136
+ else {
137
+ const jsonMerge = mergeJsonDocuments(baseRaw, oursRaw, theirsRaw, {
138
+ preferred,
139
+ });
140
+ merged = jsonMerge.merged;
141
+ conflicts.push(...jsonMerge.conflict_paths);
142
+ result.json = {
143
+ paths_from_theirs: jsonMerge.paths_from_theirs,
144
+ };
145
+ }
146
+ await writeFile(outputPath, merged, "utf8");
147
+ const guidance = [];
148
+ if (conflicts.length > 0) {
149
+ guidance.push(`Both branches changed ${conflicts.join(", ")}; the ${preferred} value was kept. Review the merged file, re-apply the losing change if needed, then "git add" it.`);
150
+ }
151
+ if (artifact === "history" && result.history?.reanchored) {
152
+ guidance.push('The merged history chain was re-anchored. Run "pm validate --check-history-drift" and "pm history-repair --all" after the merge to reconcile item state with merged history.');
153
+ }
154
+ return {
155
+ ok: conflicts.length === 0,
156
+ artifact,
157
+ output_path: outputPath,
158
+ preferred,
159
+ conflicts,
160
+ ...result,
161
+ guidance,
162
+ generated_at: nowIso(),
163
+ };
164
+ }
165
+ //# sourceMappingURL=driver.js.map
166
+ //# debugId=dcd2575e-24f4-58db-b4ab-d64277c71d7c
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.js","sources":["sdk/merge/driver.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/merge/driver\n *\n * File-level git merge driver runner for tracker artifacts. Git invokes the\n * driver with the base (%O), ours (%A), and theirs (%B) temporary files; the\n * driver writes the merged content back to the ours path and reports whether\n * unresolvable conflicts remain. Conflicted artifacts are still written as\n * parseable documents (resolved toward the preferred side) so a conflicted\n * merge never corrupts tracker storage the way raw conflict markers do.\n */\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getActiveExtensionRegistrations } from \"../../core/extensions/index.js\";\nimport { collectRegisteredItemFieldNames } from \"../../core/extensions/item-fields.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemFormat, PmSettings } from \"../../types/index.js\";\nimport {\n mergeHistoryStreams,\n mergeItemDocuments,\n mergeJsonDocuments,\n mergeRelationshipEventStreams,\n type MergePreferredSide,\n} from \"./three-way.js\";\n\n/** Supported values accepted by the merge driver artifact contract across CLI, SDK, and MCP surfaces. */\nexport const MERGE_DRIVER_ARTIFACT_VALUES = [\n \"item\",\n \"history\",\n \"relationship\",\n \"json\",\n] as const;\n/** Restricts merge driver artifact values accepted by command, SDK, and storage contracts. */\nexport type MergeDriverArtifact = (typeof MERGE_DRIVER_ARTIFACT_VALUES)[number];\n\n/** Documents the merge driver options payload exchanged by command, SDK, and package integrations. */\nexport interface MergeDriverOptions {\n /** Artifact class being merged: item document, history JSONL stream, relationship event JSONL store, or key-level JSON config. */\n artifact: string;\n /** Path to the common-ancestor version (git %O). */\n basePath: string;\n /** Path to the current-branch version (git %A); also the default output path per the git merge-driver protocol. */\n oursPath: string;\n /** Path to the other-branch version (git %B). */\n theirsPath: string;\n /** Optional explicit output path overriding the git default of writing to the ours path. */\n outputPath?: string;\n /** Original repository-relative item path supplied by Git as `%P`, used to detect item format when temporary side paths lack extensions. */\n itemPath?: string;\n /** Side that wins unresolvable conflicts (default \"ours\"). */\n prefer?: string;\n}\n\n/** Documents the merge driver result payload exchanged by command, SDK, and package integrations. */\nexport interface MergeDriverResult {\n /** Whether the merge completed without unresolvable conflicts. */\n ok: boolean;\n /** Artifact class that was merged. */\n artifact: MergeDriverArtifact;\n /** Path the merged content was written to. */\n output_path: string;\n /** Side unresolvable conflicts were resolved toward. */\n preferred: MergePreferredSide;\n /** Unresolvable conflict labels: metadata field names (item), dotted key paths (json). Empty for history merges. */\n conflicts: string[];\n /** History-merge strategy and entry accounting; present only for the history artifact. */\n history?: {\n strategy: string;\n common_entries: number;\n entries_from_ours: number;\n entries_from_theirs: number;\n entries_total: number;\n reanchored: boolean;\n };\n /** Relationship-event-merge strategy and accounting; present only for the relationship artifact. */\n relationship?: {\n strategy: string;\n common_entries: number;\n entries_from_ours: number;\n entries_from_theirs: number;\n entries_total: number;\n reanchored: boolean;\n };\n /** Item-merge field accounting; present only for the item artifact. */\n item?: {\n fields_from_theirs: string[];\n union_fields: string[];\n };\n /** JSON-merge key accounting; present only for the json artifact. */\n json?: {\n paths_from_theirs: string[];\n };\n /** Guidance for resolving remaining conflicts or verifying the merged workspace. */\n guidance: string[];\n /** ISO 8601 timestamp recording when generated occurred. */\n generated_at: string;\n}\n\nfunction resolveArtifact(value: string): MergeDriverArtifact {\n const normalized = value.trim().toLowerCase();\n if (\n (MERGE_DRIVER_ARTIFACT_VALUES as readonly string[]).includes(normalized)\n ) {\n return normalized as MergeDriverArtifact;\n }\n throw new PmCliError(\n `Unknown merge artifact \"${value}\". Supported values: ${MERGE_DRIVER_ARTIFACT_VALUES.join(\", \")}.`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction resolvePreferredSide(value: string | undefined): MergePreferredSide {\n if (value === undefined) {\n return \"ours\";\n }\n const normalized = value.trim().toLowerCase();\n if (normalized === \"ours\" || normalized === \"theirs\") {\n return normalized;\n }\n throw new PmCliError(\n `Unknown --prefer value \"${value}\". Supported values: ours, theirs.`,\n EXIT_CODE.USAGE,\n );\n}\n\nasync function readSideFile(filePath: string, label: string): Promise<string> {\n try {\n return await readFile(filePath, \"utf8\");\n } catch {\n throw new PmCliError(\n `Cannot read merge ${label} file at ${filePath}.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n}\n\n/**\n * Load the workspace settings when a tracker is initialized at the resolved pm\n * root, or fall back to format defaults when the driver runs outside a tracker\n * (git can invoke merge drivers before `pm init`, e.g. while rebasing the\n * commit that introduces the tracker).\n */\nasync function loadOptionalSettings(\n global: GlobalOptions,\n): Promise<PmSettings | null> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n return null;\n }\n return readSettings(pmRoot);\n}\n\nfunction itemFormatForPath(\n filePath: string,\n settings: PmSettings | null,\n): ItemFormat {\n if (filePath.endsWith(\".md\")) {\n return \"json_markdown\";\n }\n if (filePath.endsWith(\".toon\")) {\n return \"toon\";\n }\n return settings?.item_format ?? \"toon\";\n}\n\n/**\n * Execute one git merge-driver invocation for a tracker artifact. Reads the\n * three per-side versions, applies the artifact's field-aware merge semantics,\n * writes the merged content (parseable even when conflicted) to the output\n * path, and reports remaining conflicts so the CLI can exit non-zero and let\n * git mark the path unmerged.\n */\nexport async function runMergeDriver(\n options: MergeDriverOptions,\n global: GlobalOptions,\n): Promise<MergeDriverResult> {\n const artifact = resolveArtifact(options.artifact);\n const preferred = resolvePreferredSide(options.prefer);\n const outputPath = path.resolve(options.outputPath ?? options.oursPath);\n const [baseRaw, oursRaw, theirsRaw] = await Promise.all([\n readSideFile(options.basePath, \"base\"),\n readSideFile(options.oursPath, \"ours\"),\n readSideFile(options.theirsPath, \"theirs\"),\n ]);\n\n let merged: string;\n const conflicts: string[] = [];\n const result: Partial<MergeDriverResult> = {};\n if (artifact === \"history\") {\n const historyMerge = mergeHistoryStreams(baseRaw, oursRaw, theirsRaw);\n merged = historyMerge.merged;\n result.history = {\n strategy: historyMerge.strategy,\n common_entries: historyMerge.common_entries,\n entries_from_ours: historyMerge.entries_from_ours,\n entries_from_theirs: historyMerge.entries_from_theirs,\n entries_total: historyMerge.entries_total,\n reanchored: historyMerge.reanchored,\n };\n } else if (artifact === \"relationship\") {\n const relationshipMerge = mergeRelationshipEventStreams(\n baseRaw,\n oursRaw,\n theirsRaw,\n );\n merged = relationshipMerge.merged;\n result.relationship = {\n strategy: relationshipMerge.strategy,\n common_entries: relationshipMerge.common_entries,\n entries_from_ours: relationshipMerge.entries_from_ours,\n entries_from_theirs: relationshipMerge.entries_from_theirs,\n entries_total: relationshipMerge.entries_total,\n reanchored: relationshipMerge.reanchored,\n };\n } else if (artifact === \"item\") {\n const settings = await loadOptionalSettings(global);\n const itemMerge = mergeItemDocuments(baseRaw, oursRaw, theirsRaw, {\n format: itemFormatForPath(options.itemPath ?? outputPath, settings),\n schema: settings?.schema,\n extensionFieldNames: collectRegisteredItemFieldNames(\n getActiveExtensionRegistrations(),\n ),\n preferred,\n });\n merged = itemMerge.merged;\n conflicts.push(...itemMerge.conflict_fields);\n result.item = {\n fields_from_theirs: itemMerge.fields_from_theirs,\n union_fields: itemMerge.union_fields,\n };\n } else {\n const jsonMerge = mergeJsonDocuments(baseRaw, oursRaw, theirsRaw, {\n preferred,\n });\n merged = jsonMerge.merged;\n conflicts.push(...jsonMerge.conflict_paths);\n result.json = {\n paths_from_theirs: jsonMerge.paths_from_theirs,\n };\n }\n\n await writeFile(outputPath, merged, \"utf8\");\n const guidance: string[] = [];\n if (conflicts.length > 0) {\n guidance.push(\n `Both branches changed ${conflicts.join(\", \")}; the ${preferred} value was kept. Review the merged file, re-apply the losing change if needed, then \"git add\" it.`,\n );\n }\n if (artifact === \"history\" && result.history?.reanchored) {\n guidance.push(\n 'The merged history chain was re-anchored. Run \"pm validate --check-history-drift\" and \"pm history-repair --all\" after the merge to reconcile item state with merged history.',\n );\n }\n return {\n ok: conflicts.length === 0,\n artifact,\n output_path: outputPath,\n preferred,\n conflicts,\n ...result,\n guidance,\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":"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","debugId":"dcd2575e-24f4-58db-b4ab-d64277c71d7c"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @module sdk/merge
3
+ *
4
+ * Public SDK surface for multi-branch tracker merge semantics: field-aware
5
+ * three-way merge primitives, the git merge-driver runner, and the repository
6
+ * merge-configuration installer. The CLI `pm merge` command is a shim over
7
+ * this module so packages and hosts can reuse the same merge behavior.
8
+ */
9
+ export { ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, type HistoryMergeResult, type HistoryMergeStrategy, type ItemDocumentMergeResult, type JsonDocumentMergeResult, type MergePreferredSide, type RelationshipStreamMergeResult, } from "./three-way.js";
10
+ export { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, type MergeDriverArtifact, type MergeDriverOptions, type MergeDriverResult, } from "./driver.js";
11
+ export { auditMergeAttributeFence, buildMergeAttributePatterns, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, refreshMergeAttributeFenceIfInstalled, runMergeInstall, type MergeFenceAuditResult, type MergeFenceRefreshOutcome, type MergeInstallOptions, type MergeInstallResult, } from "./install.js";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @module sdk/merge
3
+ *
4
+ * Public SDK surface for multi-branch tracker merge semantics: field-aware
5
+ * three-way merge primitives, the git merge-driver runner, and the repository
6
+ * merge-configuration installer. The CLI `pm merge` command is a shim over
7
+ * this module so packages and hosts can reuse the same merge behavior.
8
+ */
9
+
10
+ !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]="f3029f43-e4c7-5551-bc13-6c2206239bbd")}catch(e){}}();
11
+ export { ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, } from "./three-way.js";
12
+ export { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, } from "./driver.js";
13
+ export { auditMergeAttributeFence, buildMergeAttributePatterns, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, refreshMergeAttributeFenceIfInstalled, runMergeInstall, } from "./install.js";
14
+ //# sourceMappingURL=index.js.map
15
+ //# debugId=f3029f43-e4c7-5551-bc13-6c2206239bbd
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["sdk/merge/index.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/merge\n *\n * Public SDK surface for multi-branch tracker merge semantics: field-aware\n * three-way merge primitives, the git merge-driver runner, and the repository\n * merge-configuration installer. The CLI `pm merge` command is a shim over\n * this module so packages and hosts can reuse the same merge behavior.\n */\nexport {\n ITEM_LATEST_TIMESTAMP_FIELDS,\n ITEM_UNION_COLLECTION_FIELDS,\n mergeHistoryStreams,\n mergeItemDocuments,\n mergeJsonDocuments,\n mergeRelationshipEventStreams,\n type HistoryMergeResult,\n type HistoryMergeStrategy,\n type ItemDocumentMergeResult,\n type JsonDocumentMergeResult,\n type MergePreferredSide,\n type RelationshipStreamMergeResult,\n} from \"./three-way.js\";\nexport {\n MERGE_DRIVER_ARTIFACT_VALUES,\n runMergeDriver,\n type MergeDriverArtifact,\n type MergeDriverOptions,\n type MergeDriverResult,\n} from \"./driver.js\";\nexport {\n auditMergeAttributeFence,\n buildMergeAttributePatterns,\n PM_GITATTRIBUTES_END,\n PM_GITATTRIBUTES_START,\n refreshMergeAttributeFenceIfInstalled,\n runMergeInstall,\n type MergeFenceAuditResult,\n type MergeFenceRefreshOutcome,\n type MergeInstallOptions,\n type MergeInstallResult,\n} from \"./install.js\";\n"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;AACH,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,6BAA6B,GAO9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,4BAA4B,EAC5B,cAAc,GAIf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,qCAAqC,EACrC,eAAe,GAKhB,MAAM,cAAc,CAAC","debugId":"f3029f43-e4c7-5551-bc13-6c2206239bbd"}
@@ -0,0 +1,90 @@
1
+ import type { GlobalOptions } from "../../core/shared/command-types.js";
2
+ /** Opening marker for the pm-owned merge-driver `.gitattributes` block. */
3
+ export declare const PM_GITATTRIBUTES_START = "# pm-cli:merge-drivers:start";
4
+ /** Closing marker for the pm-owned merge-driver `.gitattributes` block. */
5
+ export declare const PM_GITATTRIBUTES_END = "# pm-cli:merge-drivers:end";
6
+ /** Documents the merge install options payload exchanged by command, SDK, and package integrations. */
7
+ export interface MergeInstallOptions {
8
+ /** Preview the `.gitattributes` and `git config` changes without writing anything. */
9
+ dryRun?: boolean;
10
+ }
11
+ /** Documents the merge install result payload exchanged by command, SDK, and package integrations. */
12
+ export interface MergeInstallResult {
13
+ /** Whether the installation completed (or, for dry runs, would complete) without errors. */
14
+ ok: boolean;
15
+ /** Whether this run was a preview only. */
16
+ dry_run: boolean;
17
+ /** Repository root the merge configuration was installed into. */
18
+ workspace_root: string;
19
+ /** `.gitattributes` reconciliation outcome. */
20
+ gitattributes: {
21
+ path: string;
22
+ changed: boolean;
23
+ patterns: string[];
24
+ };
25
+ /** Local `git config` merge-driver definitions applied (or previewed). */
26
+ git_config: Array<{
27
+ key: string;
28
+ value: string;
29
+ }>;
30
+ /** Guidance for completing the multi-branch workflow setup. */
31
+ guidance: string[];
32
+ /** ISO 8601 timestamp recording when generated occurred. */
33
+ generated_at: string;
34
+ }
35
+ /**
36
+ * Build the complete fenced `.gitattributes` pattern list for a tracker rooted
37
+ * at `trackerRelativeRoot` (git-root-relative POSIX path, empty when the
38
+ * tracker root IS the git root). This is the single coverage contract shared
39
+ * by `pm merge install` (which writes the fence) and the validate
40
+ * merge-fence-drift detection (which compares the committed fence against the
41
+ * active schema's type folders), so schema-added custom types can never
42
+ * silently diverge from the installed fence without a warning.
43
+ */
44
+ export declare function buildMergeAttributePatterns(trackerRelativeRoot: string, typeFolders: string[]): string[];
45
+ /** Result of comparing the committed merge-fence block against the coverage the active schema requires. */
46
+ export interface MergeFenceAuditResult {
47
+ /** Audit outcome: no fence installed (nothing to audit), fence matches, or fence drifted from the active schema/type folders. */
48
+ status: "not_installed" | "ok" | "drift";
49
+ /** `.gitattributes` file containing the fence, when one was found. */
50
+ path?: string;
51
+ /** Expected attribute lines absent from the committed fence (for example a schema-added type folder). */
52
+ missing_patterns: string[];
53
+ /** Committed fence lines no longer produced by the coverage contract (for example a removed type folder). */
54
+ stale_patterns: string[];
55
+ }
56
+ /**
57
+ * Audit the committed `.gitattributes` merge fence against the coverage the
58
+ * active schema requires, without touching git configuration. The fence file
59
+ * is discovered by walking up from the tracker root (bounded), so the audit
60
+ * stays filesystem-only and safe to run inside `pm validate`. A `drift`
61
+ * result means items of some type folder (or a tracker JSONL store) would
62
+ * merge under git's default text driver despite the fence being installed.
63
+ */
64
+ export declare function auditMergeAttributeFence(pmRoot: string, typeFolders: string[]): Promise<MergeFenceAuditResult>;
65
+ /** Outcome of an automatic merge-fence refresh attempted after a schema type mutation. */
66
+ export interface MergeFenceRefreshOutcome {
67
+ /** What happened: the fence was rewritten, already matched, was never installed (actionable hint), or there is no git repository to configure. */
68
+ status: "refreshed" | "unchanged" | "not_installed" | "no_git";
69
+ /** `.gitattributes` path examined, when a git repository was found. */
70
+ path?: string;
71
+ }
72
+ /**
73
+ * Refresh the fenced `.gitattributes` merge-driver block after a schema type
74
+ * mutation, but only when `pm merge install` already ran (the fence markers
75
+ * are present). Without this, custom item types registered after install
76
+ * would write items into folders with no merge attribute — silently
77
+ * reintroducing the whole-file conflict class for exactly those items. Repos
78
+ * that never installed the fence get a `not_installed` outcome so callers can
79
+ * surface an actionable hint instead of mutating git configuration nobody
80
+ * asked for.
81
+ */
82
+ export declare function refreshMergeAttributeFenceIfInstalled(pmRoot: string): Promise<MergeFenceRefreshOutcome>;
83
+ /**
84
+ * Install (or preview) the repository merge configuration for tracker data:
85
+ * writes the fenced merge-driver block into `.gitattributes` (committed and
86
+ * shared with every branch) and defines the `merge.pm-*.driver` entries in the
87
+ * repository-local git config (per-clone, so every collaborator runs this once
88
+ * per checkout). Requires an initialized tracker and a git repository.
89
+ */
90
+ export declare function runMergeInstall(options: MergeInstallOptions, global: GlobalOptions): Promise<MergeInstallResult>;
@@ -0,0 +1,318 @@
1
+ /**
2
+ * @module sdk/merge/install
3
+ *
4
+ * Installs the tracker's git merge configuration into a repository: a fenced
5
+ * `.gitattributes` block mapping every mergeable tracker artifact class to a
6
+ * pm merge driver, plus the local `git config` driver definitions that make
7
+ * those attributes effective. Idempotent and re-runnable; schema type
8
+ * mutations refresh the fenced block automatically once it is installed.
9
+ */
10
+
11
+ !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]="86f1b43a-3b30-5791-ba03-fc362dfe5585")}catch(e){}}();
12
+ import { readFile, writeFile } from "node:fs/promises";
13
+ import { execFile } from "node:child_process";
14
+ import path from "node:path";
15
+ import { promisify } from "node:util";
16
+ import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
17
+ import { pathExists } from "../../core/fs/fs-utils.js";
18
+ import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
19
+ import { acquireLock } from "../../core/lock/lock.js";
20
+ import { EXIT_CODE } from "../../core/shared/constants.js";
21
+ import { PmCliError } from "../../core/shared/errors.js";
22
+ import { nowIso } from "../../core/shared/time.js";
23
+ import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
24
+ import { readSettings, resolveGovernanceKnobs, } from "../../core/store/settings.js";
25
+ import { isPathOutsideRoot } from "../workspace.js";
26
+ const execFileAsync = promisify(execFile);
27
+ /** Opening marker for the pm-owned merge-driver `.gitattributes` block. */
28
+ export const PM_GITATTRIBUTES_START = "# pm-cli:merge-drivers:start";
29
+ /** Closing marker for the pm-owned merge-driver `.gitattributes` block. */
30
+ export const PM_GITATTRIBUTES_END = "# pm-cli:merge-drivers:end";
31
+ const MERGE_FENCE_LOCK_ID = "merge-fence";
32
+ const MERGE_DRIVER_DEFINITIONS = [
33
+ {
34
+ key: "pm-item-toon",
35
+ name: "pm field-aware TOON item document merge",
36
+ artifact: "item",
37
+ itemPath: "item.toon",
38
+ },
39
+ {
40
+ key: "pm-item-markdown",
41
+ name: "pm field-aware JSON-markdown item document merge",
42
+ artifact: "item",
43
+ itemPath: "item.md",
44
+ },
45
+ {
46
+ key: "pm-history",
47
+ name: "pm append-only history stream merge",
48
+ artifact: "history",
49
+ itemPath: undefined,
50
+ },
51
+ {
52
+ key: "pm-relationship",
53
+ name: "pm append-only relationship event store merge",
54
+ artifact: "relationship",
55
+ itemPath: undefined,
56
+ },
57
+ {
58
+ key: "pm-json",
59
+ name: "pm key-level JSON config merge",
60
+ artifact: "json",
61
+ itemPath: undefined,
62
+ },
63
+ ];
64
+ async function resolveGitWorkspaceRoot(cwd) {
65
+ try {
66
+ const { stdout } = await execFileAsync("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8", windowsHide: true, timeout: 10_000 });
67
+ return stdout.trim();
68
+ }
69
+ catch {
70
+ throw new PmCliError("pm merge install requires a git repository (merge drivers are git configuration).", EXIT_CODE.USAGE);
71
+ }
72
+ }
73
+ function toPosixRelative(fromPath, toPath) {
74
+ return path.relative(fromPath, toPath).replaceAll("\\", "/");
75
+ }
76
+ /** Encode one Git attributes pattern with C-style quoting so whitespace, backslashes, and quotation marks remain part of the repository path instead of being parsed as attribute separators. */
77
+ function quoteGitAttributePattern(value) {
78
+ return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
79
+ }
80
+ /**
81
+ * Build the complete fenced `.gitattributes` pattern list for a tracker rooted
82
+ * at `trackerRelativeRoot` (git-root-relative POSIX path, empty when the
83
+ * tracker root IS the git root). This is the single coverage contract shared
84
+ * by `pm merge install` (which writes the fence) and the validate
85
+ * merge-fence-drift detection (which compares the committed fence against the
86
+ * active schema's type folders), so schema-added custom types can never
87
+ * silently diverge from the installed fence without a warning.
88
+ */
89
+ export function buildMergeAttributePatterns(trackerRelativeRoot, typeFolders) {
90
+ const prefix = trackerRelativeRoot.length > 0 ? `${trackerRelativeRoot}/` : "";
91
+ const patterns = [];
92
+ for (const folder of typeFolders) {
93
+ patterns.push(`${quoteGitAttributePattern(`${prefix}${folder}/*.toon`)} merge=pm-item-toon`);
94
+ patterns.push(`${quoteGitAttributePattern(`${prefix}${folder}/*.md`)} merge=pm-item-markdown`);
95
+ }
96
+ // RelationshipEventStore deliberately accepts a caller-chosen relativePath
97
+ // anywhere below the tracker root. Cover all tracker JSONL first, then let
98
+ // the more-specific history rule below override it. This keeps custom event
99
+ // stores protected without guessing package-owned paths.
100
+ patterns.push(`${quoteGitAttributePattern(`${prefix}**/*.jsonl`)} merge=pm-relationship`);
101
+ patterns.push(`${quoteGitAttributePattern(`${prefix}history/*.jsonl`)} merge=pm-history`);
102
+ patterns.push(`${quoteGitAttributePattern(`${prefix}settings.json`)} merge=pm-json`);
103
+ patterns.push(`${quoteGitAttributePattern(`${prefix}schema/*.json`)} merge=pm-json`);
104
+ return patterns;
105
+ }
106
+ async function reconcileGitattributesBlock(workspaceRoot, patterns, dryRun) {
107
+ const gitattributesPath = path.join(workspaceRoot, ".gitattributes");
108
+ let current = "";
109
+ try {
110
+ current = await readFile(gitattributesPath, "utf8");
111
+ }
112
+ catch (error) {
113
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
114
+ throw error;
115
+ }
116
+ }
117
+ const block = [
118
+ PM_GITATTRIBUTES_START,
119
+ ...patterns,
120
+ PM_GITATTRIBUTES_END,
121
+ ].join("\n");
122
+ const start = current.indexOf(PM_GITATTRIBUTES_START);
123
+ const end = current.indexOf(PM_GITATTRIBUTES_END);
124
+ const withoutManagedBlock = start >= 0 && end > start
125
+ ? `${current.slice(0, start)}${current.slice(end + PM_GITATTRIBUTES_END.length)}`
126
+ : current
127
+ .replace(PM_GITATTRIBUTES_START, "")
128
+ .replace(PM_GITATTRIBUTES_END, "");
129
+ const prefix = withoutManagedBlock.trimEnd();
130
+ const next = `${prefix.length > 0 ? `${prefix}\n\n` : ""}${block}\n`;
131
+ if (next === current) {
132
+ return { path: gitattributesPath, changed: false };
133
+ }
134
+ if (!dryRun) {
135
+ await writeFile(gitattributesPath, next, "utf8");
136
+ }
137
+ return { path: gitattributesPath, changed: true };
138
+ }
139
+ /**
140
+ * Audit the committed `.gitattributes` merge fence against the coverage the
141
+ * active schema requires, without touching git configuration. The fence file
142
+ * is discovered by walking up from the tracker root (bounded), so the audit
143
+ * stays filesystem-only and safe to run inside `pm validate`. A `drift`
144
+ * result means items of some type folder (or a tracker JSONL store) would
145
+ * merge under git's default text driver despite the fence being installed.
146
+ */
147
+ export async function auditMergeAttributeFence(pmRoot, typeFolders) {
148
+ const resolvedRoot = path.resolve(pmRoot);
149
+ let fenceDirectory = null;
150
+ let fenceContent = "";
151
+ let directory = resolvedRoot;
152
+ for (let depth = 0; depth < 8; depth += 1) {
153
+ const candidate = path.join(directory, ".gitattributes");
154
+ try {
155
+ const raw = await readFile(candidate, "utf8");
156
+ if (raw.includes(PM_GITATTRIBUTES_START)) {
157
+ fenceDirectory = directory;
158
+ fenceContent = raw;
159
+ break;
160
+ }
161
+ }
162
+ catch {
163
+ // No .gitattributes at this level; keep walking up.
164
+ }
165
+ const parent = path.dirname(directory);
166
+ if (parent === directory) {
167
+ break;
168
+ }
169
+ directory = parent;
170
+ }
171
+ if (fenceDirectory === null) {
172
+ return { status: "not_installed", missing_patterns: [], stale_patterns: [] };
173
+ }
174
+ const fencePath = path.join(fenceDirectory, ".gitattributes");
175
+ const start = fenceContent.indexOf(PM_GITATTRIBUTES_START);
176
+ const end = fenceContent.indexOf(PM_GITATTRIBUTES_END);
177
+ const committed = end > start
178
+ ? fenceContent
179
+ .slice(start + PM_GITATTRIBUTES_START.length, end)
180
+ .split("\n")
181
+ .map((line) => line.trim())
182
+ .filter((line) => line.length > 0)
183
+ : [];
184
+ const expected = buildMergeAttributePatterns(toPosixRelative(fenceDirectory, resolvedRoot), typeFolders);
185
+ const committedSet = new Set(committed);
186
+ const expectedSet = new Set(expected);
187
+ const missing = expected.filter((line) => !committedSet.has(line));
188
+ const stale = committed.filter((line) => !expectedSet.has(line));
189
+ return {
190
+ status: missing.length > 0 || stale.length > 0 ? "drift" : "ok",
191
+ path: fencePath,
192
+ missing_patterns: missing,
193
+ stale_patterns: stale,
194
+ };
195
+ }
196
+ /**
197
+ * Refresh the fenced `.gitattributes` merge-driver block after a schema type
198
+ * mutation, but only when `pm merge install` already ran (the fence markers
199
+ * are present). Without this, custom item types registered after install
200
+ * would write items into folders with no merge attribute — silently
201
+ * reintroducing the whole-file conflict class for exactly those items. Repos
202
+ * that never installed the fence get a `not_installed` outcome so callers can
203
+ * surface an actionable hint instead of mutating git configuration nobody
204
+ * asked for.
205
+ */
206
+ export async function refreshMergeAttributeFenceIfInstalled(pmRoot) {
207
+ let workspaceRoot;
208
+ try {
209
+ workspaceRoot = await resolveGitWorkspaceRoot(path.resolve(pmRoot));
210
+ }
211
+ catch {
212
+ return { status: "no_git" };
213
+ }
214
+ const trackerRelativeRoot = toPosixRelative(workspaceRoot, path.resolve(pmRoot));
215
+ const lockSettings = await readSettings(pmRoot);
216
+ const owner = (process.env.PM_AUTHOR ?? lockSettings.author_default).trim();
217
+ const releaseLock = await acquireLock(pmRoot, MERGE_FENCE_LOCK_ID, lockSettings.locks.ttl_seconds, owner.length > 0 ? owner : "unknown", false, resolveGovernanceKnobs(lockSettings).force_required_for_stale_lock, lockSettings.locks.wait_ms);
218
+ try {
219
+ const gitattributesPath = path.join(workspaceRoot, ".gitattributes");
220
+ let current;
221
+ try {
222
+ current = await readFile(gitattributesPath, "utf8");
223
+ }
224
+ catch (error) {
225
+ if (error instanceof Error &&
226
+ "code" in error &&
227
+ error.code === "ENOENT") {
228
+ return { status: "not_installed", path: gitattributesPath };
229
+ }
230
+ throw error;
231
+ }
232
+ if (!current.includes(PM_GITATTRIBUTES_START)) {
233
+ return { status: "not_installed", path: gitattributesPath };
234
+ }
235
+ // Re-read after acquiring the dedicated fence lock so every concurrent
236
+ // refresher computes from the latest committed type registry.
237
+ const settings = await readSettings(pmRoot);
238
+ const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
239
+ const typeFolders = [
240
+ ...new Set(Object.values(typeRegistry.type_to_folder)),
241
+ ].sort((left, right) => left.localeCompare(right));
242
+ const outcome = await reconcileGitattributesBlock(workspaceRoot, buildMergeAttributePatterns(trackerRelativeRoot, typeFolders), false);
243
+ return {
244
+ status: outcome.changed ? "refreshed" : "unchanged",
245
+ path: outcome.path,
246
+ };
247
+ }
248
+ finally {
249
+ await releaseLock();
250
+ }
251
+ }
252
+ /**
253
+ * Install (or preview) the repository merge configuration for tracker data:
254
+ * writes the fenced merge-driver block into `.gitattributes` (committed and
255
+ * shared with every branch) and defines the `merge.pm-*.driver` entries in the
256
+ * repository-local git config (per-clone, so every collaborator runs this once
257
+ * per checkout). Requires an initialized tracker and a git repository.
258
+ */
259
+ export async function runMergeInstall(options, global) {
260
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
261
+ if (!(await pathExists(getSettingsPath(pmRoot)))) {
262
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
263
+ }
264
+ const dryRun = options.dryRun === true;
265
+ const workspaceRoot = await resolveGitWorkspaceRoot(process.cwd());
266
+ const trackerRelativeRoot = toPosixRelative(workspaceRoot, path.resolve(pmRoot));
267
+ if (isPathOutsideRoot(trackerRelativeRoot)) {
268
+ throw new PmCliError(`Tracker root ${pmRoot} is outside the git repository ${workspaceRoot}; there is nothing to configure for this repository.`, EXIT_CODE.USAGE);
269
+ }
270
+ const settings = await readSettings(pmRoot);
271
+ const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
272
+ const typeFolders = [
273
+ ...new Set(Object.values(typeRegistry.type_to_folder)),
274
+ ].sort((left, right) => left.localeCompare(right));
275
+ const patterns = buildMergeAttributePatterns(trackerRelativeRoot, typeFolders);
276
+ const gitattributes = await reconcileGitattributesBlock(workspaceRoot, patterns, dryRun);
277
+ const gitConfigEntries = [];
278
+ for (const definition of MERGE_DRIVER_DEFINITIONS) {
279
+ gitConfigEntries.push({
280
+ key: `merge.${definition.key}.name`,
281
+ value: definition.name,
282
+ });
283
+ gitConfigEntries.push({
284
+ key: `merge.${definition.key}.driver`,
285
+ value: `pm merge driver ${definition.artifact} "%O" "%A" "%B"${definition.itemPath === undefined ? "" : ` --item-path ${definition.itemPath}`}`,
286
+ });
287
+ }
288
+ if (!dryRun) {
289
+ for (const entry of gitConfigEntries) {
290
+ await execFileAsync("git", ["config", entry.key, entry.value], {
291
+ cwd: workspaceRoot,
292
+ encoding: "utf8",
293
+ windowsHide: true,
294
+ timeout: 10_000,
295
+ });
296
+ }
297
+ }
298
+ return {
299
+ ok: true,
300
+ dry_run: dryRun,
301
+ workspace_root: workspaceRoot,
302
+ gitattributes: {
303
+ path: gitattributes.path,
304
+ changed: gitattributes.changed,
305
+ patterns,
306
+ },
307
+ git_config: gitConfigEntries,
308
+ guidance: [
309
+ "Commit .gitattributes so every branch and collaborator shares the merge mapping.",
310
+ 'git config is per-clone: each collaborator (and each fresh worktree/clone) runs "pm merge install" once.',
311
+ 'After merging branches, run "pm validate" and, if history drift is reported, "pm history-repair --all" to reconcile item state with merged history.',
312
+ "Custom item types registered later refresh this fence automatically (pm schema add-type/remove-type); rerun pm merge install only after out-of-band type-folder edits.",
313
+ ],
314
+ generated_at: nowIso(),
315
+ };
316
+ }
317
+ //# sourceMappingURL=install.js.map
318
+ //# debugId=86f1b43a-3b30-5791-ba03-fc362dfe5585