@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.
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +2 -0
- package/CHANGELOG.md +36 -0
- package/dist/cli/commands/append.js +13 -6
- package/dist/cli/commands/append.js.map +1 -1
- package/dist/cli/commands/calendar.d.ts +1 -1
- package/dist/cli/commands/calendar.js +2 -2
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/comments.js +2 -5
- package/dist/cli/commands/comments.js.map +1 -1
- package/dist/cli/commands/completion.js +11 -3
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/context.d.ts +1 -1
- package/dist/cli/commands/context.js +2 -2
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.js +4 -3
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/copy.js +5 -3
- package/dist/cli/commands/copy.js.map +1 -1
- package/dist/cli/commands/create.d.ts +3 -1
- package/dist/cli/commands/create.js +5 -3
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/merge.d.ts +8 -0
- package/dist/cli/commands/merge.js +12 -0
- package/dist/cli/commands/merge.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +1 -1
- package/dist/cli/commands/plan.js +2 -2
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/update-many.d.ts +5 -0
- package/dist/cli/commands/update-many.js +81 -6
- package/dist/cli/commands/update-many.js.map +1 -1
- package/dist/cli/commands/update.d.ts +5 -1
- package/dist/cli/commands/update.js +50 -4
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/register-list-query.js +14 -2
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +61 -2
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +5 -3
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/registration-helpers.js +4 -2
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/bundle-manifest.json +365 -333
- package/dist/cli-bundle/chunks/{append-MBXHNWSX.js → append-E6V54WOQ.js} +5 -5
- package/dist/cli-bundle/chunks/append-NNJ3EFIT.js +11 -0
- package/dist/cli-bundle/chunks/{chunk-M4B4RK4J.js → chunk-2BO4CA46.js} +14 -238
- package/dist/cli-bundle/chunks/{chunk-M4B4RK4J.js.map → chunk-2BO4CA46.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-MQOSMBWV.js → chunk-3AO5VSDR.js} +25 -6
- package/dist/cli-bundle/chunks/chunk-3AO5VSDR.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ODEIDKGW.js → chunk-3LPFHE3P.js} +596 -154
- package/dist/cli-bundle/chunks/chunk-3LPFHE3P.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-YGEA4CLH.js → chunk-3MCTMJXI.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-N7FCFJ76.js → chunk-3P7UJQOX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7B7IHMLH.js → chunk-3VY6MIEO.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-3EZZTFL2.js → chunk-4F6BWJ4J.js} +51 -43
- package/dist/cli-bundle/chunks/chunk-4F6BWJ4J.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VA3H7VVC.js → chunk-4L23AGQ7.js} +9 -7
- package/dist/cli-bundle/chunks/chunk-4L23AGQ7.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-5S6IZXK7.js → chunk-4U4Z6AHI.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-UOIFZ66L.js → chunk-4XGJLADW.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-SUNZKVAH.js → chunk-5IZJWSDB.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-QQ77W23U.js → chunk-5NTE36LD.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-EVAN5VJA.js → chunk-5OK4UGFV.js} +5 -8
- package/dist/cli-bundle/chunks/{chunk-EVAN5VJA.js.map → chunk-5OK4UGFV.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-H3YKUVDR.js → chunk-5UX66S6U.js} +26 -7
- package/dist/cli-bundle/chunks/chunk-5UX66S6U.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KGPLSHJD.js → chunk-6C2ZZX5Z.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Q5NHJ6RO.js → chunk-6JUTHVQS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NTS2RKHN.js → chunk-6VIJ7UA5.js} +15 -15
- package/dist/cli-bundle/chunks/{chunk-BBGR4FKQ.js → chunk-6XMUURSS.js} +6 -6
- package/dist/cli-bundle/chunks/chunk-6XMUURSS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XVB6BATY.js → chunk-72LQ4TKV.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-WCBB6VI3.js → chunk-7AVEY74G.js} +8 -5
- package/dist/cli-bundle/chunks/chunk-7AVEY74G.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-YG56M3NE.js → chunk-7DOJC3HS.js} +8 -8
- package/dist/cli-bundle/chunks/chunk-7DOJC3HS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KZ5AC6B5.js → chunk-7WCE6Y64.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VQOG2ETB.js → chunk-AF2CCM5U.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-P24ZU5QV.js → chunk-AOEOYL3S.js} +49 -12
- package/dist/cli-bundle/chunks/chunk-AOEOYL3S.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-BZKE2O5V.js → chunk-BKIAH72N.js} +8 -6
- package/dist/cli-bundle/chunks/chunk-BKIAH72N.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-RWAIRGBC.js → chunk-C3KD7U3T.js} +12 -243
- package/dist/cli-bundle/chunks/chunk-C3KD7U3T.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js +334 -0
- package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-TELI67UP.js → chunk-CQTQKUUV.js} +6 -9
- package/dist/cli-bundle/chunks/{chunk-TELI67UP.js.map → chunk-CQTQKUUV.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-ZUCBPXNA.js → chunk-D6NXDNP3.js} +5 -5
- package/dist/cli-bundle/chunks/chunk-D6NXDNP3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-EAV3P54W.js → chunk-DAQ45GCS.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-6V4T4RD3.js → chunk-DVDBQA3B.js} +79 -22
- package/dist/cli-bundle/chunks/chunk-DVDBQA3B.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-E6LEMURX.js +249 -0
- package/dist/cli-bundle/chunks/chunk-E6LEMURX.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ZF52NVRT.js → chunk-E7ICD63T.js} +131 -179
- package/dist/cli-bundle/chunks/chunk-E7ICD63T.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-RX53WHFI.js → chunk-EJDGV4GR.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-IXG5CMBR.js → chunk-FDHPAVVB.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-KAE727L2.js → chunk-FSRHYUDA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-FSRHYUDA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-46Z6FAVP.js → chunk-G3COA6GS.js} +51 -43
- package/dist/cli-bundle/chunks/chunk-G3COA6GS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-A4FVWFZY.js → chunk-GFQP7HAZ.js} +8 -6
- package/dist/cli-bundle/chunks/chunk-GFQP7HAZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-2XPDCXK5.js → chunk-GIQSU6S2.js} +6 -6
- package/dist/cli-bundle/chunks/chunk-GIQSU6S2.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-V4QHAMI5.js → chunk-GROYI4RB.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-77XFQRTD.js → chunk-GSJSM5BJ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-QYGK2XQ3.js → chunk-GTLCVJOE.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-VSQE43NO.js → chunk-GV2262OF.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-N2TEEOXJ.js → chunk-GVI6FAFG.js} +8 -6
- package/dist/cli-bundle/chunks/chunk-GVI6FAFG.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-A5EQPNV7.js → chunk-GVT754PX.js} +44 -3
- package/dist/cli-bundle/chunks/chunk-GVT754PX.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-Y2VSGFT4.js → chunk-HB3P4M52.js} +22 -7
- package/dist/cli-bundle/chunks/chunk-HB3P4M52.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-STBCBDKF.js → chunk-HCEBZNC3.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-EEECAV5M.js → chunk-HEWM6CEN.js} +80 -25
- package/dist/cli-bundle/chunks/chunk-HEWM6CEN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GKCEEXMA.js → chunk-HQ3SB4CN.js} +21 -6
- package/dist/cli-bundle/chunks/{chunk-GKCEEXMA.js.map → chunk-HQ3SB4CN.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-U6RYD446.js → chunk-HRW7GF6T.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-D35WYXWC.js → chunk-HYW67VJ5.js} +6 -3
- package/dist/cli-bundle/chunks/chunk-HYW67VJ5.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-OKWJUL6F.js → chunk-I577UHC7.js} +16 -9
- package/dist/cli-bundle/chunks/{chunk-OKWJUL6F.js.map → chunk-I577UHC7.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XDWXPG2E.js → chunk-IAQE32BI.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-66SRNEBK.js → chunk-IJNK6WW2.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js +623 -0
- package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-A3GAQLBH.js → chunk-IX677TRO.js} +75 -12
- package/dist/cli-bundle/chunks/chunk-IX677TRO.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-RLLOZAM2.js → chunk-IY6VZ3IW.js} +29 -8
- package/dist/cli-bundle/chunks/chunk-IY6VZ3IW.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-SVAWG7EE.js → chunk-J4FBIFU6.js} +45 -4
- package/dist/cli-bundle/chunks/chunk-J4FBIFU6.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-AGEBQRBG.js → chunk-JAPE62Y5.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-UWAQI3B7.js → chunk-JGUKMMRS.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UU6EP25G.js → chunk-JH2ZSLO3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GRDK25BN.js → chunk-JHJSFOAM.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-FQO5THHM.js → chunk-JM6YAXTR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-E7KBMWEF.js → chunk-JSLT7WVE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FIUTBFC6.js → chunk-K4CI6Y45.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IEMXESIS.js → chunk-KSPWRNVP.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-3QNUDDY2.js → chunk-KZEANWJS.js} +14 -12
- package/dist/cli-bundle/chunks/{chunk-3QNUDDY2.js.map → chunk-KZEANWJS.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BFJP4VYC.js → chunk-L7BH7IWU.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-2UCG5H6B.js → chunk-LPEYZRUR.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-FQF6VVPH.js → chunk-MYSS5H2A.js} +9 -7
- package/dist/cli-bundle/chunks/{chunk-FQF6VVPH.js.map → chunk-MYSS5H2A.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-IR3GOO6E.js → chunk-NHT3F4WZ.js} +15 -15
- package/dist/cli-bundle/chunks/{chunk-6BNV3G6C.js → chunk-NLR32VFS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BDC4TW4B.js → chunk-OV7MSW3I.js} +15 -13
- package/dist/cli-bundle/chunks/chunk-OV7MSW3I.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-EI3UIMZM.js → chunk-OWXOPDHD.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js +246 -0
- package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-AQUNTB7G.js → chunk-PEQGTJ5Q.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-QFG4MB7P.js → chunk-POG76WWZ.js} +28 -7
- package/dist/cli-bundle/chunks/chunk-POG76WWZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-MI3346YW.js → chunk-QANSTTC7.js} +129 -170
- package/dist/cli-bundle/chunks/chunk-QANSTTC7.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-T6MOTLOJ.js → chunk-QJKL5PHS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SBW7EQC4.js → chunk-QLZ643FM.js} +76 -13
- package/dist/cli-bundle/chunks/chunk-QLZ643FM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XKVHL3MB.js → chunk-QWRVBJ4D.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-R3EWPG4A.js +106 -0
- package/dist/cli-bundle/chunks/chunk-R3EWPG4A.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js +344 -0
- package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VFA5EIEN.js → chunk-R7QV7ICM.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-NPEYH6CE.js → chunk-RDV4ZFYS.js} +12 -10
- package/dist/cli-bundle/chunks/{chunk-NPEYH6CE.js.map → chunk-RDV4ZFYS.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-K2L6FZBX.js → chunk-RJO3YAFM.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-YIC5NGXF.js → chunk-RMF7LMBS.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-YIC5NGXF.js.map → chunk-RMF7LMBS.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MRXAHR4B.js → chunk-RZJLNXFG.js} +50 -13
- package/dist/cli-bundle/chunks/chunk-RZJLNXFG.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-DJAGYYCQ.js → chunk-SC2HMDGB.js} +19 -3
- package/dist/cli-bundle/chunks/chunk-SC2HMDGB.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-SGJB6PXA.js → chunk-SF3DT5HJ.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-SG74J6MV.js +604 -0
- package/dist/cli-bundle/chunks/chunk-SG74J6MV.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-Q3K5XPAQ.js → chunk-SR3JOATZ.js} +18 -2
- package/dist/cli-bundle/chunks/chunk-SR3JOATZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-DUDLSQFG.js → chunk-SSKOQNMS.js} +14 -12
- package/dist/cli-bundle/chunks/{chunk-DUDLSQFG.js.map → chunk-SSKOQNMS.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-UNNCT5QY.js → chunk-SZVB53Y3.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-JBW2S2C6.js → chunk-T44FMVRL.js} +613 -157
- package/dist/cli-bundle/chunks/chunk-T44FMVRL.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GFZB5CLP.js → chunk-T6PPNM7V.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-UE7LK3RE.js → chunk-THAOZG4U.js} +9 -7
- package/dist/cli-bundle/chunks/chunk-THAOZG4U.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-IGBBTPM5.js → chunk-TOBGV45Y.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-TOBGV45Y.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-W6IEJXNC.js → chunk-TVYYO5A7.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TYHJDFYW.js +109 -0
- package/dist/cli-bundle/chunks/chunk-TYHJDFYW.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-DOASIOQR.js → chunk-UQLXSG72.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IDUTGRDM.js → chunk-URXVHN3L.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-URXVHN3L.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-7CHWLT2J.js → chunk-UVN66B3M.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Q6JPYR7I.js → chunk-UX6SSO2I.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JPWUZOMR.js → chunk-UZDQXNUB.js} +75 -20
- package/dist/cli-bundle/chunks/chunk-UZDQXNUB.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-OK7VSX3N.js → chunk-UZLJOEAC.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-4PSJVGRE.js → chunk-VDO2JMD4.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-IRJ6F23W.js → chunk-VQIHNHMJ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FQODDTE7.js → chunk-WUVEBQW6.js} +7 -5
- package/dist/cli-bundle/chunks/{chunk-FQODDTE7.js.map → chunk-WUVEBQW6.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-Q4PSG2GV.js → chunk-WVA4DVNV.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-Q4PSG2GV.js.map → chunk-WVA4DVNV.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-4M6RZJXF.js → chunk-WWNL6WMH.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-WWNL6WMH.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-3KPNOZOH.js → chunk-X6K5XTTN.js} +78 -21
- package/dist/cli-bundle/chunks/chunk-X6K5XTTN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-G33XIMRT.js → chunk-XJF7CDNH.js} +17 -10
- package/dist/cli-bundle/chunks/{chunk-G33XIMRT.js.map → chunk-XJF7CDNH.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-AR24KW26.js → chunk-YBT7O4KT.js} +17 -112
- package/dist/cli-bundle/chunks/chunk-YBT7O4KT.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-CZA2DXCV.js → chunk-YQQNAKW3.js} +17 -105
- package/dist/cli-bundle/chunks/chunk-YQQNAKW3.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-OKPZDH43.js → chunk-YQWCZ5AC.js} +7 -5
- package/dist/cli-bundle/chunks/{chunk-OKPZDH43.js.map → chunk-YQWCZ5AC.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LT5UWU7H.js → chunk-ZOJ3LR7O.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3HSRP6T2.js → chunk-ZOY5K4D3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XXWDEQ6O.js → chunk-ZV2NTVMJ.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-UW6HCMP2.js → chunk-ZYPFOO3L.js} +9 -9
- package/dist/cli-bundle/chunks/close-O5QVZ6ET.js +12 -0
- package/dist/cli-bundle/chunks/{close-7NWA3GLA.js → close-QEMOYZN3.js} +5 -5
- package/dist/cli-bundle/chunks/close-many-SDA426VT.js +24 -0
- package/dist/cli-bundle/chunks/{close-many-YALQ7AXS.js → close-many-UTZANOCQ.js} +15 -14
- package/dist/cli-bundle/chunks/{comments-SQIQ5WYR.js → comments-LZN6FXXC.js} +7 -7
- package/dist/cli-bundle/chunks/comments-VBQ345ND.js +13 -0
- package/dist/cli-bundle/chunks/{copy-YDAMENCP.js → copy-DKTSSCK7.js} +4 -4
- package/dist/cli-bundle/chunks/copy-M7DDI6LS.js +9 -0
- package/dist/cli-bundle/chunks/{create-JSL6CXU3.js → create-GG4RBCGC.js} +11 -11
- package/dist/cli-bundle/chunks/create-JBC5KUW6.js +29 -0
- package/dist/cli-bundle/chunks/{delete-IGVOZEU2.js → delete-LCS3VPDH.js} +4 -4
- package/dist/cli-bundle/chunks/delete-MD7YXQLH.js +10 -0
- package/dist/cli-bundle/chunks/{deps-BQAXUQAK.js → deps-DELOO4TL.js} +6 -6
- package/dist/cli-bundle/chunks/{deps-CBPPSS6J.js → deps-FI4O6NQS.js} +6 -6
- package/dist/cli-bundle/chunks/docs-2UYBP5D6.js +14 -0
- package/dist/cli-bundle/chunks/{docs-NS2AZWCN.js → docs-6Z2MP526.js} +6 -6
- package/dist/cli-bundle/chunks/{files-XUUBQ76I.js → files-HEUGSJZL.js} +6 -6
- package/dist/cli-bundle/chunks/{files-PVWEPT5J.js → files-HKEAN5MA.js} +6 -6
- package/dist/cli-bundle/chunks/{focus-DHBHKK3E.js → focus-7SOUT5PZ.js} +5 -5
- package/dist/cli-bundle/chunks/focus-DRQ6FQH6.js +10 -0
- package/dist/cli-bundle/chunks/history-compact-65YVN5DB.js +17 -0
- package/dist/cli-bundle/chunks/{history-compact-3TNPYVFG.js → history-compact-7NDVP3PT.js} +7 -6
- package/dist/cli-bundle/chunks/{history-redact-KKFDICCF.js → history-redact-7YBL4XSG.js} +5 -4
- package/dist/cli-bundle/chunks/{history-redact-ELRL73XN.js → history-redact-IZGNJBU4.js} +5 -4
- package/dist/cli-bundle/chunks/{history-repair-J7WKZFAG.js → history-repair-7M4PYQUH.js} +8 -6
- package/dist/cli-bundle/chunks/history-repair-GNGETJLI.js +18 -0
- package/dist/cli-bundle/chunks/learnings-3YXDRWFT.js +13 -0
- package/dist/cli-bundle/chunks/{learnings-X4D6JCCG.js → learnings-ALC6IMNL.js} +7 -7
- package/dist/cli-bundle/chunks/notes-7JMLQ447.js +13 -0
- package/dist/cli-bundle/chunks/{notes-UQC6VS6N.js → notes-JFCLTC5C.js} +7 -7
- package/dist/cli-bundle/chunks/plan-KOIPWVOZ.js +26 -0
- package/dist/cli-bundle/chunks/{plan-5GKRBJJO.js → plan-T3XB3WTK.js} +12 -12
- package/dist/cli-bundle/chunks/{profile-5PQAPCLF.js → profile-OILJHKUW.js} +12 -11
- package/dist/cli-bundle/chunks/{profile-CW4BD3FO.js → profile-RJXA7PGS.js} +12 -11
- package/dist/cli-bundle/chunks/{register-list-query-PHIPDFP2.js → register-list-query-CFVG75P3.js} +30 -21
- package/dist/cli-bundle/chunks/{register-list-query-PHIPDFP2.js.map → register-list-query-CFVG75P3.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-list-query-HTDQE6VI.js → register-list-query-E7UVY4TN.js} +29 -20
- package/dist/cli-bundle/chunks/{register-list-query-HTDQE6VI.js.map → register-list-query-E7UVY4TN.js.map} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-BLEWM5I6.js → register-mutation-4VJTXBZW.js} +86 -32
- package/dist/cli-bundle/chunks/register-mutation-4VJTXBZW.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-OTYHR7J6.js → register-mutation-IQ55E25C.js} +78 -33
- package/dist/cli-bundle/chunks/register-mutation-IQ55E25C.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-AMCUFYEW.js → register-operations-AR7RMX4W.js} +42 -38
- package/dist/cli-bundle/chunks/register-operations-AR7RMX4W.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-MRLHOZYR.js → register-operations-NOLZGORC.js} +41 -37
- package/dist/cli-bundle/chunks/register-operations-NOLZGORC.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-setup-ZVKTDL4G.js → register-setup-BB77VUEE.js} +17 -16
- package/dist/cli-bundle/chunks/{register-setup-ZVKTDL4G.js.map → register-setup-BB77VUEE.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-setup-N2FOSWAG.js → register-setup-EYZ7VTPZ.js} +15 -14
- package/dist/cli-bundle/chunks/{register-setup-N2FOSWAG.js.map → register-setup-EYZ7VTPZ.js.map} +1 -1
- package/dist/cli-bundle/chunks/restore-L6IAGOD7.js +15 -0
- package/dist/cli-bundle/chunks/{restore-HEQAG6EK.js → restore-ZH65GZFB.js} +7 -6
- package/dist/cli-bundle/chunks/{schema-Q5DAWJ2S.js → schema-4ERWM5QJ.js} +7 -6
- package/dist/cli-bundle/chunks/{schema-MAXAIHEC.js → schema-55DL3Q52.js} +7 -6
- package/dist/cli-bundle/chunks/{update-DWFXXJKP.js → update-FW6FKDOP.js} +15 -15
- package/dist/cli-bundle/chunks/update-TJHSPRPT.js +23 -0
- package/dist/cli-bundle/chunks/update-many-NNALYQCN.js +35 -0
- package/dist/cli-bundle/chunks/update-many-PWXX5WHO.js +39 -0
- package/dist/cli-bundle/main.js +62 -59
- package/dist/cli-bundle/main.js.map +1 -1
- package/dist/cli-bundle/sdk-runtime.js +62 -59
- package/dist/cli-bundle/sdk-testing.js +8 -8
- package/dist/cli-bundle/sdk.js +327 -57
- package/dist/cli-bundle/sdk.js.map +4 -4
- package/dist/core/config/nested-settings.d.ts +2 -0
- package/dist/core/config/nested-settings.js +18 -2
- package/dist/core/config/nested-settings.js.map +1 -1
- package/dist/core/diagnostics/remediation.js +38 -2
- package/dist/core/diagnostics/remediation.js.map +1 -1
- package/dist/core/extensions/extension-types.d.ts +1 -1
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/extension-types.js.map +1 -1
- package/dist/core/item/id.d.ts +19 -2
- package/dist/core/item/id.js +27 -6
- package/dist/core/item/id.js.map +1 -1
- package/dist/core/item/parse.d.ts +7 -0
- package/dist/core/item/parse.js +48 -2
- package/dist/core/item/parse.js.map +1 -1
- package/dist/core/schema/item-types-file.d.ts +2 -2
- package/dist/core/schema/item-types-file.js +2 -2
- package/dist/core/schema/item-types-file.js.map +1 -1
- package/dist/core/schema/runtime-schema.d.ts +3 -3
- package/dist/core/schema/runtime-schema.js +2 -2
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/schema/type-workflows.d.ts +2 -2
- package/dist/core/schema/type-workflows.js +2 -2
- package/dist/core/schema/type-workflows.js.map +1 -1
- package/dist/core/shared/constants.js +5 -2
- package/dist/core/shared/constants.js.map +1 -1
- package/dist/core/store/settings-validator.d.ts +4 -0
- package/dist/core/store/settings-validator.js +8 -2
- package/dist/core/store/settings-validator.js.map +1 -1
- package/dist/core/store/settings.js +8 -2
- package/dist/core/store/settings.js.map +1 -1
- package/dist/sdk/annotations.js +24 -2
- package/dist/sdk/annotations.js.map +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +1 -1
- package/dist/sdk/cli-bootstrap.js +3 -3
- package/dist/sdk/cli-bootstrap.js.map +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.js +22 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
- package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +17 -2
- package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +512 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +21 -11
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +13 -3
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -0
- package/dist/sdk/cli-contracts/tool-schema.js +14 -10
- package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +69 -0
- package/dist/sdk/cli-contracts/typed-action-inputs.js +5 -0
- package/dist/sdk/cli-contracts/typed-action-inputs.js.map +1 -0
- package/dist/sdk/cli-contracts.d.ts +4 -3
- package/dist/sdk/cli-contracts.js +5 -5
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/extension/describe.d.ts +1 -1
- package/dist/sdk/extension/describe.js +2 -2
- package/dist/sdk/extension/describe.js.map +1 -1
- package/dist/sdk/extension/install-runtime.js +5 -3
- package/dist/sdk/extension/install-runtime.js.map +1 -1
- package/dist/sdk/extension.d.ts +2 -2
- package/dist/sdk/extension.js +2 -2
- package/dist/sdk/extension.js.map +1 -1
- package/dist/sdk/governance/gc.d.ts +14 -1
- package/dist/sdk/governance/gc.js +38 -2
- package/dist/sdk/governance/gc.js.map +1 -1
- package/dist/sdk/governance/storage-integrity.d.ts +84 -0
- package/dist/sdk/governance/storage-integrity.js +240 -0
- package/dist/sdk/governance/storage-integrity.js.map +1 -0
- package/dist/sdk/governance/validate.d.ts +3 -1
- package/dist/sdk/governance/validate.js +56 -2
- package/dist/sdk/governance/validate.js.map +1 -1
- package/dist/sdk/history-read.d.ts +1 -1
- package/dist/sdk/history-read.js +2 -2
- package/dist/sdk/history-read.js.map +1 -1
- package/dist/sdk/history-repair.d.ts +36 -0
- package/dist/sdk/history-repair.js +69 -4
- package/dist/sdk/history-repair.js.map +1 -1
- package/dist/sdk/index.d.ts +5 -2
- package/dist/sdk/index.js +5 -2
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/init.js +3 -3
- package/dist/sdk/init.js.map +1 -1
- package/dist/sdk/item-transaction.d.ts +131 -0
- package/dist/sdk/item-transaction.js +280 -0
- package/dist/sdk/item-transaction.js.map +1 -0
- package/dist/sdk/merge/driver.d.ts +75 -0
- package/dist/sdk/merge/driver.js +166 -0
- package/dist/sdk/merge/driver.js.map +1 -0
- package/dist/sdk/merge/index.d.ts +11 -0
- package/dist/sdk/merge/index.js +15 -0
- package/dist/sdk/merge/index.js.map +1 -0
- package/dist/sdk/merge/install.d.ts +90 -0
- package/dist/sdk/merge/install.js +318 -0
- package/dist/sdk/merge/install.js.map +1 -0
- package/dist/sdk/merge/three-way.d.ts +126 -0
- package/dist/sdk/merge/three-way.js +545 -0
- package/dist/sdk/merge/three-way.js.map +1 -0
- package/dist/sdk/query/list.d.ts +19 -2
- package/dist/sdk/query/list.js +5 -2
- package/dist/sdk/query/list.js.map +1 -1
- package/dist/sdk/runtime.d.ts +17 -14
- package/dist/sdk/runtime.js +5 -5
- package/dist/sdk/runtime.js.map +1 -1
- package/dist/sdk/schema.d.ts +2 -2
- package/dist/sdk/schema.js +29 -2
- package/dist/sdk/schema.js.map +1 -1
- package/dist/sdk/stats.d.ts +1 -1
- package/dist/sdk/stats.js +2 -2
- package/dist/sdk/stats.js.map +1 -1
- package/dist/sdk/workspace-transaction-gc.d.ts +46 -0
- package/dist/sdk/workspace-transaction-gc.js +155 -0
- package/dist/sdk/workspace-transaction-gc.js.map +1 -0
- package/dist/sdk/workspace.d.ts +28 -4
- package/dist/sdk/workspace.js +61 -15
- package/dist/sdk/workspace.js.map +1 -1
- package/dist/types.d.ts +11 -7
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/docs/AGENT_GUIDE.md +58 -47
- package/docs/COMMANDS.md +7 -0
- package/docs/CONFIGURATION.md +2 -0
- package/docs/MERGE_SAFETY.md +99 -0
- package/docs/README.md +1 -0
- package/docs/SDK.md +56 -0
- package/marketplace.json +2 -2
- package/package.json +3 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/dist/cli-bundle/chunks/append-XUYF7NON.js +0 -11
- package/dist/cli-bundle/chunks/chunk-2XPDCXK5.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-3EZZTFL2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-3KPNOZOH.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-46Z6FAVP.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-4M6RZJXF.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6V4T4RD3.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-A3GAQLBH.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-A4FVWFZY.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-A5EQPNV7.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-AR24KW26.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-BBGR4FKQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-BDC4TW4B.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-BZKE2O5V.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-CZA2DXCV.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-D35WYXWC.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-DJAGYYCQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-EEECAV5M.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-H3YKUVDR.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-IDUTGRDM.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-IGBBTPM5.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-JBW2S2C6.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-JPWUZOMR.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-KAE727L2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-MI3346YW.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-MQOSMBWV.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-MRXAHR4B.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-N2TEEOXJ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-ODEIDKGW.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-P24ZU5QV.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-Q3K5XPAQ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-QFG4MB7P.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-RLLOZAM2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-RWAIRGBC.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SBW7EQC4.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SVAWG7EE.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-UE7LK3RE.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-VA3H7VVC.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-WCBB6VI3.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-Y2VSGFT4.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-YG56M3NE.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-ZF52NVRT.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-ZUCBPXNA.js.map +0 -7
- package/dist/cli-bundle/chunks/close-ZZCDDWJT.js +0 -12
- package/dist/cli-bundle/chunks/close-many-QCZHFCON.js +0 -23
- package/dist/cli-bundle/chunks/comments-FMQNYPSZ.js +0 -13
- package/dist/cli-bundle/chunks/copy-GI3RCVZP.js +0 -9
- package/dist/cli-bundle/chunks/create-LXMLYJNM.js +0 -29
- package/dist/cli-bundle/chunks/delete-5DFAXJNI.js +0 -10
- package/dist/cli-bundle/chunks/docs-KCWPLQOV.js +0 -14
- package/dist/cli-bundle/chunks/focus-3EJVFI3D.js +0 -10
- package/dist/cli-bundle/chunks/history-compact-JHYVDYLW.js +0 -16
- package/dist/cli-bundle/chunks/history-repair-REMI7DDI.js +0 -16
- package/dist/cli-bundle/chunks/learnings-O6V5WDCV.js +0 -13
- package/dist/cli-bundle/chunks/notes-ZSZREWZA.js +0 -13
- package/dist/cli-bundle/chunks/plan-EZW2YDDY.js +0 -26
- package/dist/cli-bundle/chunks/register-mutation-BLEWM5I6.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-OTYHR7J6.js.map +0 -1
- package/dist/cli-bundle/chunks/register-operations-AMCUFYEW.js.map +0 -1
- package/dist/cli-bundle/chunks/register-operations-MRLHOZYR.js.map +0 -7
- package/dist/cli-bundle/chunks/restore-A55MLFAI.js +0 -14
- package/dist/cli-bundle/chunks/update-5DTSCWVF.js +0 -23
- package/dist/cli-bundle/chunks/update-many-6T4ZLZS7.js +0 -34
- package/dist/cli-bundle/chunks/update-many-MYRK6VBJ.js +0 -38
- /package/dist/cli-bundle/chunks/{append-MBXHNWSX.js.map → append-E6V54WOQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-XUYF7NON.js.map → append-NNJ3EFIT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YGEA4CLH.js.map → chunk-3MCTMJXI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-N7FCFJ76.js.map → chunk-3P7UJQOX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7B7IHMLH.js.map → chunk-3VY6MIEO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5S6IZXK7.js.map → chunk-4U4Z6AHI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UOIFZ66L.js.map → chunk-4XGJLADW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-SUNZKVAH.js.map → chunk-5IZJWSDB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QQ77W23U.js.map → chunk-5NTE36LD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KGPLSHJD.js.map → chunk-6C2ZZX5Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Q5NHJ6RO.js.map → chunk-6JUTHVQS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-NTS2RKHN.js.map → chunk-6VIJ7UA5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XVB6BATY.js.map → chunk-72LQ4TKV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KZ5AC6B5.js.map → chunk-7WCE6Y64.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VQOG2ETB.js.map → chunk-AF2CCM5U.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EAV3P54W.js.map → chunk-DAQ45GCS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RX53WHFI.js.map → chunk-EJDGV4GR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IXG5CMBR.js.map → chunk-FDHPAVVB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-V4QHAMI5.js.map → chunk-GROYI4RB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-77XFQRTD.js.map → chunk-GSJSM5BJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QYGK2XQ3.js.map → chunk-GTLCVJOE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VSQE43NO.js.map → chunk-GV2262OF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-STBCBDKF.js.map → chunk-HCEBZNC3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-U6RYD446.js.map → chunk-HRW7GF6T.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XDWXPG2E.js.map → chunk-IAQE32BI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-66SRNEBK.js.map → chunk-IJNK6WW2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-AGEBQRBG.js.map → chunk-JAPE62Y5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UWAQI3B7.js.map → chunk-JGUKMMRS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UU6EP25G.js.map → chunk-JH2ZSLO3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GRDK25BN.js.map → chunk-JHJSFOAM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FQO5THHM.js.map → chunk-JM6YAXTR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-E7KBMWEF.js.map → chunk-JSLT7WVE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FIUTBFC6.js.map → chunk-K4CI6Y45.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IEMXESIS.js.map → chunk-KSPWRNVP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-BFJP4VYC.js.map → chunk-L7BH7IWU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2UCG5H6B.js.map → chunk-LPEYZRUR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IR3GOO6E.js.map → chunk-NHT3F4WZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6BNV3G6C.js.map → chunk-NLR32VFS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EI3UIMZM.js.map → chunk-OWXOPDHD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-AQUNTB7G.js.map → chunk-PEQGTJ5Q.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-T6MOTLOJ.js.map → chunk-QJKL5PHS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XKVHL3MB.js.map → chunk-QWRVBJ4D.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VFA5EIEN.js.map → chunk-R7QV7ICM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-K2L6FZBX.js.map → chunk-RJO3YAFM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-SGJB6PXA.js.map → chunk-SF3DT5HJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UNNCT5QY.js.map → chunk-SZVB53Y3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GFZB5CLP.js.map → chunk-T6PPNM7V.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-W6IEJXNC.js.map → chunk-TVYYO5A7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DOASIOQR.js.map → chunk-UQLXSG72.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7CHWLT2J.js.map → chunk-UVN66B3M.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Q6JPYR7I.js.map → chunk-UX6SSO2I.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OK7VSX3N.js.map → chunk-UZLJOEAC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4PSJVGRE.js.map → chunk-VDO2JMD4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IRJ6F23W.js.map → chunk-VQIHNHMJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LT5UWU7H.js.map → chunk-ZOJ3LR7O.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3HSRP6T2.js.map → chunk-ZOY5K4D3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XXWDEQ6O.js.map → chunk-ZV2NTVMJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UW6HCMP2.js.map → chunk-ZYPFOO3L.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-ZZCDDWJT.js.map → close-O5QVZ6ET.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-7NWA3GLA.js.map → close-QEMOYZN3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-QCZHFCON.js.map → close-many-SDA426VT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-YALQ7AXS.js.map → close-many-UTZANOCQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-SQIQ5WYR.js.map → comments-LZN6FXXC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-FMQNYPSZ.js.map → comments-VBQ345ND.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-YDAMENCP.js.map → copy-DKTSSCK7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-GI3RCVZP.js.map → copy-M7DDI6LS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-JSL6CXU3.js.map → create-GG4RBCGC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-LXMLYJNM.js.map → create-JBC5KUW6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-IGVOZEU2.js.map → delete-LCS3VPDH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-5DFAXJNI.js.map → delete-MD7YXQLH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-BQAXUQAK.js.map → deps-DELOO4TL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-CBPPSS6J.js.map → deps-FI4O6NQS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-KCWPLQOV.js.map → docs-2UYBP5D6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-NS2AZWCN.js.map → docs-6Z2MP526.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-XUUBQ76I.js.map → files-HEUGSJZL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-PVWEPT5J.js.map → files-HKEAN5MA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{focus-DHBHKK3E.js.map → focus-7SOUT5PZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{focus-3EJVFI3D.js.map → focus-DRQ6FQH6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-JHYVDYLW.js.map → history-compact-65YVN5DB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-3TNPYVFG.js.map → history-compact-7NDVP3PT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-KKFDICCF.js.map → history-redact-7YBL4XSG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-ELRL73XN.js.map → history-redact-IZGNJBU4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-J7WKZFAG.js.map → history-repair-7M4PYQUH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-REMI7DDI.js.map → history-repair-GNGETJLI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-O6V5WDCV.js.map → learnings-3YXDRWFT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-X4D6JCCG.js.map → learnings-ALC6IMNL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-ZSZREWZA.js.map → notes-7JMLQ447.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-UQC6VS6N.js.map → notes-JFCLTC5C.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-EZW2YDDY.js.map → plan-KOIPWVOZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-5GKRBJJO.js.map → plan-T3XB3WTK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-5PQAPCLF.js.map → profile-OILJHKUW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-CW4BD3FO.js.map → profile-RJXA7PGS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-A55MLFAI.js.map → restore-L6IAGOD7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-HEQAG6EK.js.map → restore-ZH65GZFB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-Q5DAWJ2S.js.map → schema-4ERWM5QJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-MAXAIHEC.js.map → schema-55DL3Q52.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-DWFXXJKP.js.map → update-FW6FKDOP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-5DTSCWVF.js.map → update-TJHSPRPT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-6T4ZLZS7.js.map → update-many-NNALYQCN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-MYRK6VBJ.js.map → update-many-PWXX5WHO.js.map} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type PmClientFullMutationOptions } from "./runtime.js";
|
|
2
|
+
import { type CommitWorkspaceTransactionOptions, type WorkspaceTransactionJsonValue, type WorkspaceTransactionStep } from "./workspace-transaction.js";
|
|
3
|
+
/**
|
|
4
|
+
* One atomic item creation inside a bulk mutation batch. The explicit `id`
|
|
5
|
+
* doubles as the idempotency key: recovery treats an existing item with this id
|
|
6
|
+
* as the already-applied result, so ids must be stable and transaction-owned.
|
|
7
|
+
*/
|
|
8
|
+
export interface BulkItemCreateMutation {
|
|
9
|
+
/** Discriminates the creation operation. */
|
|
10
|
+
op: "create";
|
|
11
|
+
/** Explicit stable item id (normalized with the configured id_prefix). */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Creation options forwarded to the public `create` runtime primitive. */
|
|
14
|
+
options: PmClientFullMutationOptions;
|
|
15
|
+
}
|
|
16
|
+
/** One atomic item update inside a bulk mutation batch. */
|
|
17
|
+
export interface BulkItemUpdateMutation {
|
|
18
|
+
/** Discriminates the update operation. */
|
|
19
|
+
op: "update";
|
|
20
|
+
/** Target item id. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Update options forwarded to the public `update` runtime primitive. */
|
|
23
|
+
options: PmClientFullMutationOptions;
|
|
24
|
+
}
|
|
25
|
+
/** One atomic item closure inside a bulk mutation batch. */
|
|
26
|
+
export interface BulkItemCloseMutation {
|
|
27
|
+
/** Discriminates the close operation. */
|
|
28
|
+
op: "close";
|
|
29
|
+
/** Target item id. */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Close reason recorded on the item. */
|
|
32
|
+
reason: string;
|
|
33
|
+
/** Close options forwarded to the public `close` runtime primitive. */
|
|
34
|
+
options?: PmClientFullMutationOptions;
|
|
35
|
+
}
|
|
36
|
+
/** Union of the item mutations a bulk transaction batch can carry. */
|
|
37
|
+
export type BulkItemMutation = BulkItemCreateMutation | BulkItemUpdateMutation | BulkItemCloseMutation;
|
|
38
|
+
/** Options accepted by the bulk item-mutation transaction helper. */
|
|
39
|
+
export interface CommitItemMutationsOptions {
|
|
40
|
+
/** Tracker root that owns the journal and workspace-wide writer lock. */
|
|
41
|
+
pmRoot: string;
|
|
42
|
+
/** Stable idempotency key reused to recover an interrupted batch. */
|
|
43
|
+
transactionId: string;
|
|
44
|
+
/** Attributable actor recorded in the journal and forwarded to mutations. */
|
|
45
|
+
author: string;
|
|
46
|
+
/** Ordered item mutations; compensations run in reverse order. */
|
|
47
|
+
mutations: readonly BulkItemMutation[];
|
|
48
|
+
/**
|
|
49
|
+
* Compensation strategy for created items: `close` (default) preserves the
|
|
50
|
+
* item and its history with an explanatory close reason, `delete` removes
|
|
51
|
+
* the item document (its history stream is retained by `pm delete`).
|
|
52
|
+
*/
|
|
53
|
+
createCompensation?: "close" | "delete";
|
|
54
|
+
/** Lock lifetime in seconds; size this above the longest expected attempt. */
|
|
55
|
+
lockTtlSeconds?: number;
|
|
56
|
+
/** Maximum time to wait for the workspace writer lock. */
|
|
57
|
+
lockWaitMs?: number;
|
|
58
|
+
/** Optional transition observer used by telemetry and deterministic crash tests. */
|
|
59
|
+
onTransition?: CommitWorkspaceTransactionOptions["onTransition"];
|
|
60
|
+
}
|
|
61
|
+
/** Journal-safe outcome recorded for one committed bulk item mutation. */
|
|
62
|
+
export interface BulkItemMutationOutcome {
|
|
63
|
+
/** Canonical id of the mutated item. */
|
|
64
|
+
id: string;
|
|
65
|
+
/** Operation the batch applied for this item. */
|
|
66
|
+
op: BulkItemMutation["op"];
|
|
67
|
+
}
|
|
68
|
+
/** Successful durable result of a bulk item-mutation transaction. */
|
|
69
|
+
export interface CommitItemMutationsResult {
|
|
70
|
+
/** Stable transaction identifier. */
|
|
71
|
+
transactionId: string;
|
|
72
|
+
/** Final durable state. */
|
|
73
|
+
status: "committed";
|
|
74
|
+
/** Whether an interrupted journal was resumed. */
|
|
75
|
+
recovered: boolean;
|
|
76
|
+
/** One outcome per mutation, keyed by the derived transaction step id. */
|
|
77
|
+
results: Record<string, BulkItemMutationOutcome>;
|
|
78
|
+
}
|
|
79
|
+
interface LocatedItemSnapshot {
|
|
80
|
+
id: string;
|
|
81
|
+
closedAt: string | undefined;
|
|
82
|
+
updatedAt: string;
|
|
83
|
+
}
|
|
84
|
+
/** Read one item's transaction-relevant fields, mapping not-found to undefined. */
|
|
85
|
+
declare function readItemSnapshot(pmRoot: string, id: string): Promise<LocatedItemSnapshot | undefined>;
|
|
86
|
+
/** Derive a journal-safe step id from one mutation's position and target. */
|
|
87
|
+
declare function deriveStepId(mutation: BulkItemMutation, index: number): string;
|
|
88
|
+
/** Build the durable history-message marker for one bulk mutation phase. */
|
|
89
|
+
declare function bulkHistoryMarker(transactionId: string, stepId: string, phase: "apply" | "compensate"): string;
|
|
90
|
+
/**
|
|
91
|
+
* Report whether an update step's forward mutation is durably applied. Updates
|
|
92
|
+
* cannot be inferred from field values (a moving target), so the applied apply
|
|
93
|
+
* marker in the item's immutable history is the source of truth; a later
|
|
94
|
+
* compensate marker means the mutation was rolled back and must re-apply.
|
|
95
|
+
*/
|
|
96
|
+
declare function isUpdateMarkerApplied(pmRoot: string, canonicalId: string, transactionId: string, stepId: string): Promise<boolean>;
|
|
97
|
+
/** Idempotently restore an item to its captured pre-mutation version. */
|
|
98
|
+
declare function compensateByRestore(config: {
|
|
99
|
+
pmRoot: string;
|
|
100
|
+
author: string;
|
|
101
|
+
transactionId: string;
|
|
102
|
+
}, itemId: string, stepId: string, data: WorkspaceTransactionJsonValue | undefined): Promise<void>;
|
|
103
|
+
/** Build the workspace-transaction step for one item creation. */
|
|
104
|
+
declare function buildCreateStep(config: {
|
|
105
|
+
pmRoot: string;
|
|
106
|
+
author: string;
|
|
107
|
+
transactionId: string;
|
|
108
|
+
createCompensation: "close" | "delete";
|
|
109
|
+
}, mutation: BulkItemCreateMutation, stepId: string): WorkspaceTransactionStep;
|
|
110
|
+
/**
|
|
111
|
+
* Commit an ordered batch of item create/update/close mutations atomically
|
|
112
|
+
* (all-or-nothing) in one durable workspace transaction. This is the
|
|
113
|
+
* high-level companion to `commitWorkspaceTransaction`: instead of
|
|
114
|
+
* hand-writing `inspect`/`prepareCompensation`/`apply`/`compensate` for the
|
|
115
|
+
* ubiquitous bulk import/sync case, callers describe the mutations and the
|
|
116
|
+
* helper wires the crash-consistency contract — exists-by-id inspection for
|
|
117
|
+
* creates, version-restore compensation for updates and closes, and
|
|
118
|
+
* close-or-delete compensation for creates. A stable `transactionId` makes
|
|
119
|
+
* interrupted batches resumable across processes and agents.
|
|
120
|
+
*/
|
|
121
|
+
export declare function commitItemMutations(options: CommitItemMutationsOptions): Promise<CommitItemMutationsResult>;
|
|
122
|
+
/** Public contract for test only item transaction internals, shared with white-box specs. */
|
|
123
|
+
export declare const _testOnlyItemTransaction: {
|
|
124
|
+
buildCreateStep: typeof buildCreateStep;
|
|
125
|
+
bulkHistoryMarker: typeof bulkHistoryMarker;
|
|
126
|
+
compensateByRestore: typeof compensateByRestore;
|
|
127
|
+
deriveStepId: typeof deriveStepId;
|
|
128
|
+
isUpdateMarkerApplied: typeof isUpdateMarkerApplied;
|
|
129
|
+
readItemSnapshot: typeof readItemSnapshot;
|
|
130
|
+
};
|
|
131
|
+
export {};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/item-transaction
|
|
3
|
+
*
|
|
4
|
+
* Provides the bulk item-mutation convenience layer over
|
|
5
|
+
* `commitWorkspaceTransaction`: atomic, resumable create/update/close batches
|
|
6
|
+
* with correct-by-construction inspection and compensation wiring.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
!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]="2f005f55-4b5d-5f78-b688-132457f22f99")}catch(e){}}();
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
12
|
+
import { PmCliError } from "../core/shared/errors.js";
|
|
13
|
+
import { readHistoryEntries } from "./history-read.js";
|
|
14
|
+
import { close, create, deleteItem, get, restore, update, } from "./runtime.js";
|
|
15
|
+
import { commitWorkspaceTransaction, } from "./workspace-transaction.js";
|
|
16
|
+
/** Read one item's transaction-relevant fields, mapping not-found to undefined. */
|
|
17
|
+
async function readItemSnapshot(pmRoot, id) {
|
|
18
|
+
try {
|
|
19
|
+
const located = await get(id, {}, { pmRoot });
|
|
20
|
+
const item = located.item;
|
|
21
|
+
return {
|
|
22
|
+
id: item.id,
|
|
23
|
+
closedAt: item.closed_at,
|
|
24
|
+
updatedAt: item.updated_at,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (error instanceof PmCliError &&
|
|
29
|
+
error.exitCode === EXIT_CODE.NOT_FOUND) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Derive a journal-safe step id from one mutation's position and target. */
|
|
36
|
+
function deriveStepId(mutation, index) {
|
|
37
|
+
const sanitizedTarget = mutation.id.replaceAll(/[^a-zA-Z0-9._-]/gu, "_");
|
|
38
|
+
return `${index + 1}-${mutation.op}-${sanitizedTarget}`;
|
|
39
|
+
}
|
|
40
|
+
/** Build the durable history-message marker for one bulk mutation phase. */
|
|
41
|
+
function bulkHistoryMarker(transactionId, stepId, phase) {
|
|
42
|
+
return `bulk-item-transaction ${transactionId} ${stepId} ${phase}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Report whether an update step's forward mutation is durably applied. Updates
|
|
46
|
+
* cannot be inferred from field values (a moving target), so the applied apply
|
|
47
|
+
* marker in the item's immutable history is the source of truth; a later
|
|
48
|
+
* compensate marker means the mutation was rolled back and must re-apply.
|
|
49
|
+
*/
|
|
50
|
+
async function isUpdateMarkerApplied(pmRoot, canonicalId, transactionId, stepId) {
|
|
51
|
+
const entries = await readHistoryEntries(path.join(pmRoot, "history", `${canonicalId}.jsonl`), canonicalId);
|
|
52
|
+
const applyMarker = bulkHistoryMarker(transactionId, stepId, "apply");
|
|
53
|
+
const compensateMarker = bulkHistoryMarker(transactionId, stepId, "compensate");
|
|
54
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
55
|
+
const message = entries[index].message;
|
|
56
|
+
if (message === applyMarker) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (message === compensateMarker) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
/** Capture the restore target used to compensate an update or close mutation. */
|
|
66
|
+
async function prepareRestoreCompensation(pmRoot, mutation) {
|
|
67
|
+
const snapshot = await readItemSnapshot(pmRoot, mutation.id);
|
|
68
|
+
if (snapshot?.updatedAt === undefined) {
|
|
69
|
+
throw new PmCliError(`Bulk ${mutation.op} target ${mutation.id} does not exist or has no restorable version`, EXIT_CODE.NOT_FOUND);
|
|
70
|
+
}
|
|
71
|
+
return { target_updated_at: snapshot.updatedAt };
|
|
72
|
+
}
|
|
73
|
+
/** Idempotently restore an item to its captured pre-mutation version. */
|
|
74
|
+
async function compensateByRestore(config, itemId, stepId, data) {
|
|
75
|
+
const target = data !== null && typeof data === "object" && !Array.isArray(data)
|
|
76
|
+
? data.target_updated_at
|
|
77
|
+
: undefined;
|
|
78
|
+
if (typeof target !== "string") {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if ((await readItemSnapshot(config.pmRoot, itemId)) === undefined) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
await restore(itemId, target, {
|
|
85
|
+
force: true,
|
|
86
|
+
author: config.author,
|
|
87
|
+
message: bulkHistoryMarker(config.transactionId, stepId, "compensate"),
|
|
88
|
+
}, { pmRoot: config.pmRoot });
|
|
89
|
+
}
|
|
90
|
+
/** Build the workspace-transaction step for one item creation. */
|
|
91
|
+
function buildCreateStep(config, mutation, stepId) {
|
|
92
|
+
return {
|
|
93
|
+
id: stepId,
|
|
94
|
+
async inspect() {
|
|
95
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
96
|
+
if (snapshot === undefined) {
|
|
97
|
+
return { state: "pending" };
|
|
98
|
+
}
|
|
99
|
+
return { state: "applied", result: { id: snapshot.id, op: "create" } };
|
|
100
|
+
},
|
|
101
|
+
async apply() {
|
|
102
|
+
const created = await create({ ...mutation.options, author: config.author, id: mutation.id }, { pmRoot: config.pmRoot });
|
|
103
|
+
const createdItem = created.item;
|
|
104
|
+
return { id: String(createdItem.id), op: "create" };
|
|
105
|
+
},
|
|
106
|
+
async compensate() {
|
|
107
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
108
|
+
if (snapshot === undefined) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (config.createCompensation === "delete") {
|
|
112
|
+
await deleteItem(mutation.id, {
|
|
113
|
+
force: true,
|
|
114
|
+
author: config.author,
|
|
115
|
+
message: `Compensate interrupted bulk transaction ${config.transactionId}`,
|
|
116
|
+
}, { pmRoot: config.pmRoot });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (snapshot.closedAt !== undefined) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
await close(mutation.id, `Compensated: interrupted bulk transaction ${config.transactionId}`, { force: true, author: config.author }, { pmRoot: config.pmRoot });
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/** Build the workspace-transaction step for one item update. */
|
|
127
|
+
function buildUpdateStep(config, mutation, stepId) {
|
|
128
|
+
return {
|
|
129
|
+
id: stepId,
|
|
130
|
+
async inspect() {
|
|
131
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
132
|
+
if (snapshot === undefined) {
|
|
133
|
+
return { state: "pending" };
|
|
134
|
+
}
|
|
135
|
+
const applied = await isUpdateMarkerApplied(config.pmRoot, snapshot.id, config.transactionId, stepId);
|
|
136
|
+
if (!applied) {
|
|
137
|
+
return { state: "pending" };
|
|
138
|
+
}
|
|
139
|
+
return { state: "applied", result: { id: snapshot.id, op: "update" } };
|
|
140
|
+
},
|
|
141
|
+
async prepareCompensation() {
|
|
142
|
+
return prepareRestoreCompensation(config.pmRoot, mutation);
|
|
143
|
+
},
|
|
144
|
+
async apply() {
|
|
145
|
+
const updated = await update(mutation.id, {
|
|
146
|
+
...mutation.options,
|
|
147
|
+
author: config.author,
|
|
148
|
+
message: bulkHistoryMarker(config.transactionId, stepId, "apply"),
|
|
149
|
+
}, { pmRoot: config.pmRoot });
|
|
150
|
+
const updatedItem = updated.item;
|
|
151
|
+
return { id: String(updatedItem.id), op: "update" };
|
|
152
|
+
},
|
|
153
|
+
async compensate(data) {
|
|
154
|
+
await compensateByRestore(config, mutation.id, stepId, data);
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** Build the workspace-transaction step for one item closure. */
|
|
159
|
+
function buildCloseStep(config, mutation, stepId) {
|
|
160
|
+
return {
|
|
161
|
+
id: stepId,
|
|
162
|
+
// An already-terminal target counts as applied: closing it again would
|
|
163
|
+
// fight legitimate prior closure, and recovery must adopt completed work.
|
|
164
|
+
async inspect() {
|
|
165
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
166
|
+
if (snapshot?.closedAt === undefined) {
|
|
167
|
+
return { state: "pending" };
|
|
168
|
+
}
|
|
169
|
+
return { state: "applied", result: { id: snapshot.id, op: "close" } };
|
|
170
|
+
},
|
|
171
|
+
async prepareCompensation() {
|
|
172
|
+
return prepareRestoreCompensation(config.pmRoot, mutation);
|
|
173
|
+
},
|
|
174
|
+
async apply() {
|
|
175
|
+
const closed = await close(mutation.id, mutation.reason, { ...mutation.options, author: config.author }, { pmRoot: config.pmRoot });
|
|
176
|
+
const closedItem = closed.item;
|
|
177
|
+
return { id: String(closedItem.id), op: "close" };
|
|
178
|
+
},
|
|
179
|
+
async compensate(data) {
|
|
180
|
+
await compensateByRestore(config, mutation.id, stepId, data);
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/** Convert one validated bulk mutation into its workspace-transaction step. */
|
|
185
|
+
function buildStepForMutation(config, mutation, index) {
|
|
186
|
+
const stepId = deriveStepId(mutation, index);
|
|
187
|
+
if (mutation.op === "create") {
|
|
188
|
+
return buildCreateStep(config, mutation, stepId);
|
|
189
|
+
}
|
|
190
|
+
if (mutation.op === "update") {
|
|
191
|
+
return buildUpdateStep(config, mutation, stepId);
|
|
192
|
+
}
|
|
193
|
+
return buildCloseStep(config, mutation, stepId);
|
|
194
|
+
}
|
|
195
|
+
/** Reject malformed bulk mutation rows before any journal or lock work. */
|
|
196
|
+
function assertValidBulkMutation(mutation, index) {
|
|
197
|
+
if (mutation === null ||
|
|
198
|
+
typeof mutation !== "object" ||
|
|
199
|
+
Array.isArray(mutation)) {
|
|
200
|
+
throw new TypeError(`Bulk mutation ${index + 1} must be an object`);
|
|
201
|
+
}
|
|
202
|
+
if (!["create", "update", "close"].includes(mutation.op)) {
|
|
203
|
+
throw new TypeError(`Bulk mutation ${index + 1} op must be create, update, or close`);
|
|
204
|
+
}
|
|
205
|
+
if (typeof mutation.id !== "string" || mutation.id.trim().length === 0) {
|
|
206
|
+
throw new TypeError(`Bulk mutation ${index + 1} requires a non-empty id`);
|
|
207
|
+
}
|
|
208
|
+
if (mutation.op === "close" &&
|
|
209
|
+
(typeof mutation.reason !== "string" || mutation.reason.trim().length === 0)) {
|
|
210
|
+
throw new TypeError(`Bulk close mutation ${index + 1} requires a non-empty reason`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Commit an ordered batch of item create/update/close mutations atomically
|
|
215
|
+
* (all-or-nothing) in one durable workspace transaction. This is the
|
|
216
|
+
* high-level companion to `commitWorkspaceTransaction`: instead of
|
|
217
|
+
* hand-writing `inspect`/`prepareCompensation`/`apply`/`compensate` for the
|
|
218
|
+
* ubiquitous bulk import/sync case, callers describe the mutations and the
|
|
219
|
+
* helper wires the crash-consistency contract — exists-by-id inspection for
|
|
220
|
+
* creates, version-restore compensation for updates and closes, and
|
|
221
|
+
* close-or-delete compensation for creates. A stable `transactionId` makes
|
|
222
|
+
* interrupted batches resumable across processes and agents.
|
|
223
|
+
*/
|
|
224
|
+
export async function commitItemMutations(options) {
|
|
225
|
+
const mutations = [...options.mutations];
|
|
226
|
+
if (mutations.length === 0) {
|
|
227
|
+
throw new TypeError("Bulk item transaction requires at least one mutation");
|
|
228
|
+
}
|
|
229
|
+
for (const [index, mutation] of mutations.entries()) {
|
|
230
|
+
assertValidBulkMutation(mutation, index);
|
|
231
|
+
}
|
|
232
|
+
const createCompensation = options.createCompensation ?? "close";
|
|
233
|
+
if (!["close", "delete"].includes(createCompensation)) {
|
|
234
|
+
throw new TypeError("Bulk item transaction createCompensation must be close or delete");
|
|
235
|
+
}
|
|
236
|
+
const stepConfig = {
|
|
237
|
+
pmRoot: options.pmRoot,
|
|
238
|
+
author: options.author,
|
|
239
|
+
transactionId: options.transactionId,
|
|
240
|
+
createCompensation,
|
|
241
|
+
};
|
|
242
|
+
const committed = await commitWorkspaceTransaction({
|
|
243
|
+
pmRoot: options.pmRoot,
|
|
244
|
+
transactionId: options.transactionId,
|
|
245
|
+
author: options.author,
|
|
246
|
+
steps: mutations.map((mutation, index) => buildStepForMutation(stepConfig, mutation, index)),
|
|
247
|
+
...(options.lockTtlSeconds === undefined
|
|
248
|
+
? {}
|
|
249
|
+
: { lockTtlSeconds: options.lockTtlSeconds }),
|
|
250
|
+
...(options.lockWaitMs === undefined
|
|
251
|
+
? {}
|
|
252
|
+
: { lockWaitMs: options.lockWaitMs }),
|
|
253
|
+
...(options.onTransition === undefined
|
|
254
|
+
? {}
|
|
255
|
+
: { onTransition: options.onTransition }),
|
|
256
|
+
});
|
|
257
|
+
const results = {};
|
|
258
|
+
for (const [stepId, value] of Object.entries(committed.results)) {
|
|
259
|
+
// Journal values round-trip this module's own step outputs, which are
|
|
260
|
+
// always {id, op} objects — the cast restores the concrete outcome shape.
|
|
261
|
+
results[stepId] = value;
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
transactionId: committed.transactionId,
|
|
265
|
+
status: "committed",
|
|
266
|
+
recovered: committed.recovered,
|
|
267
|
+
results,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/** Public contract for test only item transaction internals, shared with white-box specs. */
|
|
271
|
+
export const _testOnlyItemTransaction = {
|
|
272
|
+
buildCreateStep,
|
|
273
|
+
bulkHistoryMarker,
|
|
274
|
+
compensateByRestore,
|
|
275
|
+
deriveStepId,
|
|
276
|
+
isUpdateMarkerApplied,
|
|
277
|
+
readItemSnapshot,
|
|
278
|
+
};
|
|
279
|
+
//# sourceMappingURL=item-transaction.js.map
|
|
280
|
+
//# debugId=2f005f55-4b5d-5f78-b688-132457f22f99
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-transaction.js","sources":["sdk/item-transaction.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/item-transaction\n *\n * Provides the bulk item-mutation convenience layer over\n * `commitWorkspaceTransaction`: atomic, resumable create/update/close batches\n * with correct-by-construction inspection and compensation wiring.\n */\nimport path from \"node:path\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { readHistoryEntries } from \"./history-read.js\";\nimport {\n close,\n create,\n deleteItem,\n get,\n restore,\n update,\n type PmClientFullMutationOptions,\n} from \"./runtime.js\";\nimport {\n commitWorkspaceTransaction,\n type CommitWorkspaceTransactionOptions,\n type WorkspaceTransactionJsonValue,\n type WorkspaceTransactionStep,\n type WorkspaceTransactionStepInspection,\n} from \"./workspace-transaction.js\";\n\n/**\n * One atomic item creation inside a bulk mutation batch. The explicit `id`\n * doubles as the idempotency key: recovery treats an existing item with this id\n * as the already-applied result, so ids must be stable and transaction-owned.\n */\nexport interface BulkItemCreateMutation {\n /** Discriminates the creation operation. */\n op: \"create\";\n /** Explicit stable item id (normalized with the configured id_prefix). */\n id: string;\n /** Creation options forwarded to the public `create` runtime primitive. */\n options: PmClientFullMutationOptions;\n}\n\n/** One atomic item update inside a bulk mutation batch. */\nexport interface BulkItemUpdateMutation {\n /** Discriminates the update operation. */\n op: \"update\";\n /** Target item id. */\n id: string;\n /** Update options forwarded to the public `update` runtime primitive. */\n options: PmClientFullMutationOptions;\n}\n\n/** One atomic item closure inside a bulk mutation batch. */\nexport interface BulkItemCloseMutation {\n /** Discriminates the close operation. */\n op: \"close\";\n /** Target item id. */\n id: string;\n /** Close reason recorded on the item. */\n reason: string;\n /** Close options forwarded to the public `close` runtime primitive. */\n options?: PmClientFullMutationOptions;\n}\n\n/** Union of the item mutations a bulk transaction batch can carry. */\nexport type BulkItemMutation =\n | BulkItemCreateMutation\n | BulkItemUpdateMutation\n | BulkItemCloseMutation;\n\n/** Options accepted by the bulk item-mutation transaction helper. */\nexport interface CommitItemMutationsOptions {\n /** Tracker root that owns the journal and workspace-wide writer lock. */\n pmRoot: string;\n /** Stable idempotency key reused to recover an interrupted batch. */\n transactionId: string;\n /** Attributable actor recorded in the journal and forwarded to mutations. */\n author: string;\n /** Ordered item mutations; compensations run in reverse order. */\n mutations: readonly BulkItemMutation[];\n /**\n * Compensation strategy for created items: `close` (default) preserves the\n * item and its history with an explanatory close reason, `delete` removes\n * the item document (its history stream is retained by `pm delete`).\n */\n createCompensation?: \"close\" | \"delete\";\n /** Lock lifetime in seconds; size this above the longest expected attempt. */\n lockTtlSeconds?: number;\n /** Maximum time to wait for the workspace writer lock. */\n lockWaitMs?: number;\n /** Optional transition observer used by telemetry and deterministic crash tests. */\n onTransition?: CommitWorkspaceTransactionOptions[\"onTransition\"];\n}\n\n/** Journal-safe outcome recorded for one committed bulk item mutation. */\nexport interface BulkItemMutationOutcome {\n /** Canonical id of the mutated item. */\n id: string;\n /** Operation the batch applied for this item. */\n op: BulkItemMutation[\"op\"];\n}\n\n/** Successful durable result of a bulk item-mutation transaction. */\nexport interface CommitItemMutationsResult {\n /** Stable transaction identifier. */\n transactionId: string;\n /** Final durable state. */\n status: \"committed\";\n /** Whether an interrupted journal was resumed. */\n recovered: boolean;\n /** One outcome per mutation, keyed by the derived transaction step id. */\n results: Record<string, BulkItemMutationOutcome>;\n}\n\ninterface LocatedItemSnapshot {\n id: string;\n closedAt: string | undefined;\n updatedAt: string;\n}\n\n/** Read one item's transaction-relevant fields, mapping not-found to undefined. */\nasync function readItemSnapshot(\n pmRoot: string,\n id: string,\n): Promise<LocatedItemSnapshot | undefined> {\n try {\n const located = await get(id, {}, { pmRoot });\n const item = located.item as {\n id: string;\n closed_at?: string;\n updated_at: string;\n };\n return {\n id: item.id,\n closedAt: item.closed_at,\n updatedAt: item.updated_at,\n };\n } catch (error) {\n if (\n error instanceof PmCliError &&\n error.exitCode === EXIT_CODE.NOT_FOUND\n ) {\n return undefined;\n }\n throw error;\n }\n}\n\n/** Derive a journal-safe step id from one mutation's position and target. */\nfunction deriveStepId(mutation: BulkItemMutation, index: number): string {\n const sanitizedTarget = mutation.id.replaceAll(/[^a-zA-Z0-9._-]/gu, \"_\");\n return `${index + 1}-${mutation.op}-${sanitizedTarget}`;\n}\n\n/** Build the durable history-message marker for one bulk mutation phase. */\nfunction bulkHistoryMarker(\n transactionId: string,\n stepId: string,\n phase: \"apply\" | \"compensate\",\n): string {\n return `bulk-item-transaction ${transactionId} ${stepId} ${phase}`;\n}\n\n/**\n * Report whether an update step's forward mutation is durably applied. Updates\n * cannot be inferred from field values (a moving target), so the applied apply\n * marker in the item's immutable history is the source of truth; a later\n * compensate marker means the mutation was rolled back and must re-apply.\n */\nasync function isUpdateMarkerApplied(\n pmRoot: string,\n canonicalId: string,\n transactionId: string,\n stepId: string,\n): Promise<boolean> {\n const entries = await readHistoryEntries(\n path.join(pmRoot, \"history\", `${canonicalId}.jsonl`),\n canonicalId,\n );\n const applyMarker = bulkHistoryMarker(transactionId, stepId, \"apply\");\n const compensateMarker = bulkHistoryMarker(transactionId, stepId, \"compensate\");\n for (let index = entries.length - 1; index >= 0; index -= 1) {\n const message = entries[index].message;\n if (message === applyMarker) {\n return true;\n }\n if (message === compensateMarker) {\n return false;\n }\n }\n return false;\n}\n\n/** Capture the restore target used to compensate an update or close mutation. */\nasync function prepareRestoreCompensation(\n pmRoot: string,\n mutation: BulkItemMutation,\n): Promise<WorkspaceTransactionJsonValue> {\n const snapshot = await readItemSnapshot(pmRoot, mutation.id);\n if (snapshot?.updatedAt === undefined) {\n throw new PmCliError(\n `Bulk ${mutation.op} target ${mutation.id} does not exist or has no restorable version`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n return { target_updated_at: snapshot.updatedAt };\n}\n\n/** Idempotently restore an item to its captured pre-mutation version. */\nasync function compensateByRestore(\n config: { pmRoot: string; author: string; transactionId: string },\n itemId: string,\n stepId: string,\n data: WorkspaceTransactionJsonValue | undefined,\n): Promise<void> {\n const target =\n data !== null && typeof data === \"object\" && !Array.isArray(data)\n ? data.target_updated_at\n : undefined;\n if (typeof target !== \"string\") {\n return;\n }\n if ((await readItemSnapshot(config.pmRoot, itemId)) === undefined) {\n return;\n }\n await restore(\n itemId,\n target,\n {\n force: true,\n author: config.author,\n message: bulkHistoryMarker(config.transactionId, stepId, \"compensate\"),\n },\n { pmRoot: config.pmRoot },\n );\n}\n\n/** Build the workspace-transaction step for one item creation. */\nfunction buildCreateStep(\n config: {\n pmRoot: string;\n author: string;\n transactionId: string;\n createCompensation: \"close\" | \"delete\";\n },\n mutation: BulkItemCreateMutation,\n stepId: string,\n): WorkspaceTransactionStep {\n return {\n id: stepId,\n async inspect(): Promise<WorkspaceTransactionStepInspection> {\n const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);\n if (snapshot === undefined) {\n return { state: \"pending\" };\n }\n return { state: \"applied\", result: { id: snapshot.id, op: \"create\" } };\n },\n async apply(): Promise<WorkspaceTransactionJsonValue> {\n const created = await create(\n { ...mutation.options, author: config.author, id: mutation.id },\n { pmRoot: config.pmRoot },\n );\n const createdItem = created.item as Record<string, unknown>;\n return { id: String(createdItem.id), op: \"create\" };\n },\n async compensate(): Promise<void> {\n const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);\n if (snapshot === undefined) {\n return;\n }\n if (config.createCompensation === \"delete\") {\n await deleteItem(\n mutation.id,\n {\n force: true,\n author: config.author,\n message: `Compensate interrupted bulk transaction ${config.transactionId}`,\n },\n { pmRoot: config.pmRoot },\n );\n return;\n }\n if (snapshot.closedAt !== undefined) {\n return;\n }\n await close(\n mutation.id,\n `Compensated: interrupted bulk transaction ${config.transactionId}`,\n { force: true, author: config.author },\n { pmRoot: config.pmRoot },\n );\n },\n };\n}\n\n/** Build the workspace-transaction step for one item update. */\nfunction buildUpdateStep(\n config: { pmRoot: string; author: string; transactionId: string },\n mutation: BulkItemUpdateMutation,\n stepId: string,\n): WorkspaceTransactionStep {\n return {\n id: stepId,\n async inspect(): Promise<WorkspaceTransactionStepInspection> {\n const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);\n if (snapshot === undefined) {\n return { state: \"pending\" };\n }\n const applied = await isUpdateMarkerApplied(\n config.pmRoot,\n snapshot.id,\n config.transactionId,\n stepId,\n );\n if (!applied) {\n return { state: \"pending\" };\n }\n return { state: \"applied\", result: { id: snapshot.id, op: \"update\" } };\n },\n async prepareCompensation(): Promise<WorkspaceTransactionJsonValue> {\n return prepareRestoreCompensation(config.pmRoot, mutation);\n },\n async apply(): Promise<WorkspaceTransactionJsonValue> {\n const updated = await update(\n mutation.id,\n {\n ...mutation.options,\n author: config.author,\n message: bulkHistoryMarker(config.transactionId, stepId, \"apply\"),\n },\n { pmRoot: config.pmRoot },\n );\n const updatedItem = updated.item as Record<string, unknown>;\n return { id: String(updatedItem.id), op: \"update\" };\n },\n async compensate(\n data?: WorkspaceTransactionJsonValue,\n ): Promise<void> {\n await compensateByRestore(config, mutation.id, stepId, data);\n },\n };\n}\n\n/** Build the workspace-transaction step for one item closure. */\nfunction buildCloseStep(\n config: { pmRoot: string; author: string; transactionId: string },\n mutation: BulkItemCloseMutation,\n stepId: string,\n): WorkspaceTransactionStep {\n return {\n id: stepId,\n // An already-terminal target counts as applied: closing it again would\n // fight legitimate prior closure, and recovery must adopt completed work.\n async inspect(): Promise<WorkspaceTransactionStepInspection> {\n const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);\n if (snapshot?.closedAt === undefined) {\n return { state: \"pending\" };\n }\n return { state: \"applied\", result: { id: snapshot.id, op: \"close\" } };\n },\n async prepareCompensation(): Promise<WorkspaceTransactionJsonValue> {\n return prepareRestoreCompensation(config.pmRoot, mutation);\n },\n async apply(): Promise<WorkspaceTransactionJsonValue> {\n const closed = await close(\n mutation.id,\n mutation.reason,\n { ...mutation.options, author: config.author },\n { pmRoot: config.pmRoot },\n );\n const closedItem = closed.item as Record<string, unknown>;\n return { id: String(closedItem.id), op: \"close\" };\n },\n async compensate(\n data?: WorkspaceTransactionJsonValue,\n ): Promise<void> {\n await compensateByRestore(config, mutation.id, stepId, data);\n },\n };\n}\n\n/** Convert one validated bulk mutation into its workspace-transaction step. */\nfunction buildStepForMutation(\n config: {\n pmRoot: string;\n author: string;\n transactionId: string;\n createCompensation: \"close\" | \"delete\";\n },\n mutation: BulkItemMutation,\n index: number,\n): WorkspaceTransactionStep {\n const stepId = deriveStepId(mutation, index);\n if (mutation.op === \"create\") {\n return buildCreateStep(config, mutation, stepId);\n }\n if (mutation.op === \"update\") {\n return buildUpdateStep(config, mutation, stepId);\n }\n return buildCloseStep(config, mutation, stepId);\n}\n\n/** Reject malformed bulk mutation rows before any journal or lock work. */\nfunction assertValidBulkMutation(\n mutation: BulkItemMutation,\n index: number,\n): void {\n if (\n mutation === null ||\n typeof mutation !== \"object\" ||\n Array.isArray(mutation)\n ) {\n throw new TypeError(`Bulk mutation ${index + 1} must be an object`);\n }\n if (![\"create\", \"update\", \"close\"].includes(mutation.op)) {\n throw new TypeError(\n `Bulk mutation ${index + 1} op must be create, update, or close`,\n );\n }\n if (typeof mutation.id !== \"string\" || mutation.id.trim().length === 0) {\n throw new TypeError(`Bulk mutation ${index + 1} requires a non-empty id`);\n }\n if (\n mutation.op === \"close\" &&\n (typeof mutation.reason !== \"string\" || mutation.reason.trim().length === 0)\n ) {\n throw new TypeError(\n `Bulk close mutation ${index + 1} requires a non-empty reason`,\n );\n }\n}\n\n/**\n * Commit an ordered batch of item create/update/close mutations atomically\n * (all-or-nothing) in one durable workspace transaction. This is the\n * high-level companion to `commitWorkspaceTransaction`: instead of\n * hand-writing `inspect`/`prepareCompensation`/`apply`/`compensate` for the\n * ubiquitous bulk import/sync case, callers describe the mutations and the\n * helper wires the crash-consistency contract — exists-by-id inspection for\n * creates, version-restore compensation for updates and closes, and\n * close-or-delete compensation for creates. A stable `transactionId` makes\n * interrupted batches resumable across processes and agents.\n */\nexport async function commitItemMutations(\n options: CommitItemMutationsOptions,\n): Promise<CommitItemMutationsResult> {\n const mutations = [...options.mutations];\n if (mutations.length === 0) {\n throw new TypeError(\"Bulk item transaction requires at least one mutation\");\n }\n for (const [index, mutation] of mutations.entries()) {\n assertValidBulkMutation(mutation, index);\n }\n const createCompensation = options.createCompensation ?? \"close\";\n if (![\"close\", \"delete\"].includes(createCompensation)) {\n throw new TypeError(\n \"Bulk item transaction createCompensation must be close or delete\",\n );\n }\n const stepConfig = {\n pmRoot: options.pmRoot,\n author: options.author,\n transactionId: options.transactionId,\n createCompensation,\n };\n const committed = await commitWorkspaceTransaction({\n pmRoot: options.pmRoot,\n transactionId: options.transactionId,\n author: options.author,\n steps: mutations.map((mutation, index) =>\n buildStepForMutation(stepConfig, mutation, index),\n ),\n ...(options.lockTtlSeconds === undefined\n ? {}\n : { lockTtlSeconds: options.lockTtlSeconds }),\n ...(options.lockWaitMs === undefined\n ? {}\n : { lockWaitMs: options.lockWaitMs }),\n ...(options.onTransition === undefined\n ? {}\n : { onTransition: options.onTransition }),\n });\n const results: Record<string, BulkItemMutationOutcome> = {};\n for (const [stepId, value] of Object.entries(committed.results)) {\n // Journal values round-trip this module's own step outputs, which are\n // always {id, op} objects — the cast restores the concrete outcome shape.\n results[stepId] = value as unknown as BulkItemMutationOutcome;\n }\n return {\n transactionId: committed.transactionId,\n status: \"committed\",\n recovered: committed.recovered,\n results,\n };\n}\n\n/** Public contract for test only item transaction internals, shared with white-box specs. */\nexport const _testOnlyItemTransaction = {\n buildCreateStep,\n bulkHistoryMarker,\n compensateByRestore,\n deriveStepId,\n isUpdateMarkerApplied,\n readItemSnapshot,\n};\n"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,GAAG,EACH,OAAO,EACP,MAAM,GAEP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BAAoB,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,CAClD;QACD,GAAG,CAAC,OAAO,CAAC,cAAc,KAAK,SAAS;YACtC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;QAC/C,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS;YAClC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QACvC,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS;YACpC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;KAC5C,CAAC,CAAC;IACH,MAAM,OAAO,GAA4C,EAAE,CAAC;IAC5D,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAChE,sEAAsE;QACtE,0EAA0E;QAC1E,OAAO,CAAC,MAAM,CAAC,GAAG,KAA2C,CAAC;IAChE,CAAC;IACD,OAAO;QACL,aAAa,EAAE,SAAS,CAAC,aAAa;QACtC,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,OAAO;KACR,CAAC;AACJ,CAAC;AAED,6FAA6F;AAC7F,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,qBAAqB;IACrB,gBAAgB;CACjB,CAAC","debugId":"2f005f55-4b5d-5f78-b688-132457f22f99"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
2
|
+
import { type MergePreferredSide } from "./three-way.js";
|
|
3
|
+
/** Supported values accepted by the merge driver artifact contract across CLI, SDK, and MCP surfaces. */
|
|
4
|
+
export declare const MERGE_DRIVER_ARTIFACT_VALUES: readonly ["item", "history", "relationship", "json"];
|
|
5
|
+
/** Restricts merge driver artifact values accepted by command, SDK, and storage contracts. */
|
|
6
|
+
export type MergeDriverArtifact = (typeof MERGE_DRIVER_ARTIFACT_VALUES)[number];
|
|
7
|
+
/** Documents the merge driver options payload exchanged by command, SDK, and package integrations. */
|
|
8
|
+
export interface MergeDriverOptions {
|
|
9
|
+
/** Artifact class being merged: item document, history JSONL stream, relationship event JSONL store, or key-level JSON config. */
|
|
10
|
+
artifact: string;
|
|
11
|
+
/** Path to the common-ancestor version (git %O). */
|
|
12
|
+
basePath: string;
|
|
13
|
+
/** Path to the current-branch version (git %A); also the default output path per the git merge-driver protocol. */
|
|
14
|
+
oursPath: string;
|
|
15
|
+
/** Path to the other-branch version (git %B). */
|
|
16
|
+
theirsPath: string;
|
|
17
|
+
/** Optional explicit output path overriding the git default of writing to the ours path. */
|
|
18
|
+
outputPath?: string;
|
|
19
|
+
/** Original repository-relative item path supplied by Git as `%P`, used to detect item format when temporary side paths lack extensions. */
|
|
20
|
+
itemPath?: string;
|
|
21
|
+
/** Side that wins unresolvable conflicts (default "ours"). */
|
|
22
|
+
prefer?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Documents the merge driver result payload exchanged by command, SDK, and package integrations. */
|
|
25
|
+
export interface MergeDriverResult {
|
|
26
|
+
/** Whether the merge completed without unresolvable conflicts. */
|
|
27
|
+
ok: boolean;
|
|
28
|
+
/** Artifact class that was merged. */
|
|
29
|
+
artifact: MergeDriverArtifact;
|
|
30
|
+
/** Path the merged content was written to. */
|
|
31
|
+
output_path: string;
|
|
32
|
+
/** Side unresolvable conflicts were resolved toward. */
|
|
33
|
+
preferred: MergePreferredSide;
|
|
34
|
+
/** Unresolvable conflict labels: metadata field names (item), dotted key paths (json). Empty for history merges. */
|
|
35
|
+
conflicts: string[];
|
|
36
|
+
/** History-merge strategy and entry accounting; present only for the history artifact. */
|
|
37
|
+
history?: {
|
|
38
|
+
strategy: string;
|
|
39
|
+
common_entries: number;
|
|
40
|
+
entries_from_ours: number;
|
|
41
|
+
entries_from_theirs: number;
|
|
42
|
+
entries_total: number;
|
|
43
|
+
reanchored: boolean;
|
|
44
|
+
};
|
|
45
|
+
/** Relationship-event-merge strategy and accounting; present only for the relationship artifact. */
|
|
46
|
+
relationship?: {
|
|
47
|
+
strategy: string;
|
|
48
|
+
common_entries: number;
|
|
49
|
+
entries_from_ours: number;
|
|
50
|
+
entries_from_theirs: number;
|
|
51
|
+
entries_total: number;
|
|
52
|
+
reanchored: boolean;
|
|
53
|
+
};
|
|
54
|
+
/** Item-merge field accounting; present only for the item artifact. */
|
|
55
|
+
item?: {
|
|
56
|
+
fields_from_theirs: string[];
|
|
57
|
+
union_fields: string[];
|
|
58
|
+
};
|
|
59
|
+
/** JSON-merge key accounting; present only for the json artifact. */
|
|
60
|
+
json?: {
|
|
61
|
+
paths_from_theirs: string[];
|
|
62
|
+
};
|
|
63
|
+
/** Guidance for resolving remaining conflicts or verifying the merged workspace. */
|
|
64
|
+
guidance: string[];
|
|
65
|
+
/** ISO 8601 timestamp recording when generated occurred. */
|
|
66
|
+
generated_at: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Execute one git merge-driver invocation for a tracker artifact. Reads the
|
|
70
|
+
* three per-side versions, applies the artifact's field-aware merge semantics,
|
|
71
|
+
* writes the merged content (parseable even when conflicted) to the output
|
|
72
|
+
* path, and reports remaining conflicts so the CLI can exit non-zero and let
|
|
73
|
+
* git mark the path unmerged.
|
|
74
|
+
*/
|
|
75
|
+
export declare function runMergeDriver(options: MergeDriverOptions, global: GlobalOptions): Promise<MergeDriverResult>;
|