@unbrained/pm-cli 2026.7.20 → 2026.7.21
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/CHANGELOG.md +11 -0
- package/dist/cli/commander-usage.d.ts +1 -1
- package/dist/cli/commander-usage.js +5 -5
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/completion.js +13 -5
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/contracts.js +4 -3
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/error-guidance.d.ts +2 -0
- package/dist/cli/error-guidance.js +7 -2
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/main.d.ts +1 -5
- package/dist/cli/main.js +12 -50
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +13 -3
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +45 -3
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-structured-mutation.d.ts +14 -0
- package/dist/cli/register-structured-mutation.js +62 -0
- package/dist/cli/register-structured-mutation.js.map +1 -0
- package/dist/cli/registration-helpers.js +5 -3
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/bundle-manifest.json +280 -296
- package/dist/cli-bundle/chunks/{append-E6V54WOQ.js → append-7OVFYR3C.js} +3 -3
- package/dist/cli-bundle/chunks/{append-NNJ3EFIT.js → append-DFETHAZL.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-C3KD7U3T.js → chunk-2L6ZP22J.js} +241 -10
- package/dist/cli-bundle/chunks/chunk-2L6ZP22J.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-KZEANWJS.js → chunk-4PUUNQDV.js} +98 -30
- package/dist/cli-bundle/chunks/chunk-4PUUNQDV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-RDV4ZFYS.js → chunk-4QOB7L7I.js} +7 -9
- package/dist/cli-bundle/chunks/{chunk-RDV4ZFYS.js.map → chunk-4QOB7L7I.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-3LPFHE3P.js → chunk-4QSQ6XDK.js} +62 -20
- package/dist/cli-bundle/chunks/chunk-4QSQ6XDK.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-QJKL5PHS.js → chunk-7656MAUL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3AO5VSDR.js → chunk-7RW4JCU2.js} +328 -6
- package/dist/cli-bundle/chunks/chunk-7RW4JCU2.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-X6K5XTTN.js → chunk-7W2UAXXT.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-SSKOQNMS.js → chunk-ABWCF646.js} +9 -11
- package/dist/cli-bundle/chunks/{chunk-SSKOQNMS.js.map → chunk-ABWCF646.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-WVA4DVNV.js → chunk-ADBTSVGK.js} +71 -33
- package/dist/cli-bundle/chunks/chunk-ADBTSVGK.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-J4FBIFU6.js → chunk-AELMUANP.js} +12 -6
- package/dist/cli-bundle/chunks/chunk-AELMUANP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4F6BWJ4J.js → chunk-AMJPSANK.js} +57 -36
- package/dist/cli-bundle/chunks/chunk-AMJPSANK.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-6VIJ7UA5.js → chunk-AS4SAZ5R.js} +850 -819
- package/dist/cli-bundle/chunks/chunk-AS4SAZ5R.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-SG74J6MV.js → chunk-ATBCUC7Y.js} +574 -5
- package/dist/cli-bundle/chunks/chunk-ATBCUC7Y.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-5OK4UGFV.js → chunk-BXNDKOR2.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-KSPWRNVP.js → chunk-CPX275C6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JH2ZSLO3.js → chunk-DZRV2OPA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-L7BH7IWU.js → chunk-E5XMKOSB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CQTQKUUV.js → chunk-EWJWSNRU.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-DAQ45GCS.js → chunk-F2LBF7XJ.js} +22 -15
- package/dist/cli-bundle/chunks/chunk-F2LBF7XJ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-6XMUURSS.js → chunk-FJIFFBJX.js} +64 -33
- package/dist/cli-bundle/chunks/chunk-FJIFFBJX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-E7ICD63T.js → chunk-FO6OSVEN.js} +4 -6
- package/dist/cli-bundle/chunks/{chunk-E7ICD63T.js.map → chunk-FO6OSVEN.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-3MCTMJXI.js → chunk-FPBMLYPI.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UZDQXNUB.js → chunk-FSE2IKJQ.js} +46 -5
- package/dist/cli-bundle/chunks/chunk-FSE2IKJQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-IX677TRO.js → chunk-GKX4NJ7U.js} +8 -10
- package/dist/cli-bundle/chunks/{chunk-IX677TRO.js.map → chunk-GKX4NJ7U.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-DVDBQA3B.js → chunk-GTK4DTEW.js} +5 -5
- package/dist/cli-bundle/chunks/chunk-H7EAER5L.js +974 -0
- package/dist/cli-bundle/chunks/chunk-H7EAER5L.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-5UX66S6U.js → chunk-ICDAQ4TD.js} +316 -8
- package/dist/cli-bundle/chunks/chunk-ICDAQ4TD.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-YQQNAKW3.js → chunk-JFD5LPMI.js} +6 -8
- package/dist/cli-bundle/chunks/{chunk-YQQNAKW3.js.map → chunk-JFD5LPMI.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-QANSTTC7.js → chunk-JXCW2TI2.js} +6 -8
- package/dist/cli-bundle/chunks/{chunk-QANSTTC7.js.map → chunk-JXCW2TI2.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-GSJSM5BJ.js → chunk-K36WV5J6.js} +76 -13
- package/dist/cli-bundle/chunks/chunk-K36WV5J6.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GVI6FAFG.js → chunk-K55VMLSS.js} +7 -5
- package/dist/cli-bundle/chunks/chunk-K55VMLSS.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GIQSU6S2.js → chunk-KBLZ3AA5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XJF7CDNH.js → chunk-KH44WBAT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GV2262OF.js → chunk-LAV26CQG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VDO2JMD4.js → chunk-LVC72YRD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3VY6MIEO.js → chunk-LZYP423P.js} +35 -6
- package/dist/cli-bundle/chunks/chunk-LZYP423P.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ZYPFOO3L.js → chunk-MATHDCGG.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-OV7MSW3I.js → chunk-MWQ2HC2A.js} +99 -31
- package/dist/cli-bundle/chunks/chunk-MWQ2HC2A.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-NHT3F4WZ.js → chunk-NUF7ROFH.js} +840 -816
- package/dist/cli-bundle/chunks/chunk-NUF7ROFH.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-AOEOYL3S.js → chunk-O4BCOJTZ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-RJO3YAFM.js → chunk-OCUBRA6D.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5IZJWSDB.js → chunk-OG5DVFMA.js} +22 -15
- package/dist/cli-bundle/chunks/chunk-OG5DVFMA.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-I577UHC7.js → chunk-OR42SO64.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZOJ3LR7O.js → chunk-OY7DMU5P.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HEWM6CEN.js → chunk-P7MTHPJQ.js} +50 -9
- package/dist/cli-bundle/chunks/chunk-P7MTHPJQ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-2BO4CA46.js → chunk-PFNHX655.js} +236 -12
- package/dist/cli-bundle/chunks/{chunk-2BO4CA46.js.map → chunk-PFNHX655.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-ZV2NTVMJ.js → chunk-PONKZPCJ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-THAOZG4U.js → chunk-PQSEQD6E.js} +8 -6
- package/dist/cli-bundle/chunks/chunk-PQSEQD6E.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-PWDEHT3L.js +991 -0
- package/dist/cli-bundle/chunks/chunk-PWDEHT3L.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-UX6SSO2I.js → chunk-PZC2FUOQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WUVEBQW6.js → chunk-QG4GFLQ6.js} +3 -5
- package/dist/cli-bundle/chunks/{chunk-WUVEBQW6.js.map → chunk-QG4GFLQ6.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-VQIHNHMJ.js → chunk-QIH77CAG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-R3EWPG4A.js → chunk-QJIKE24M.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QLZ643FM.js → chunk-QOOTOD3W.js} +10 -12
- package/dist/cli-bundle/chunks/{chunk-QLZ643FM.js.map → chunk-QOOTOD3W.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-MYSS5H2A.js → chunk-R3P6FZJW.js} +5 -7
- package/dist/cli-bundle/chunks/{chunk-MYSS5H2A.js.map → chunk-R3P6FZJW.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-G3COA6GS.js → chunk-RNPZYNHS.js} +56 -35
- package/dist/cli-bundle/chunks/chunk-RNPZYNHS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-T44FMVRL.js → chunk-RPESLSO5.js} +62 -20
- package/dist/cli-bundle/chunks/chunk-RPESLSO5.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-INSTSQNZ.js → chunk-SY4SFZSD.js} +595 -3
- package/dist/cli-bundle/chunks/chunk-SY4SFZSD.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HB3P4M52.js → chunk-TRSHFPRZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HRW7GF6T.js → chunk-UCBDQI5E.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4U4Z6AHI.js → chunk-V22ZPOKN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JM6YAXTR.js → chunk-VHXHVTUU.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LPEYZRUR.js → chunk-VJQG4BIM.js} +35 -6
- package/dist/cli-bundle/chunks/chunk-VJQG4BIM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-D6NXDNP3.js → chunk-VLRGDBLY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JAPE62Y5.js → chunk-VNTCM3VW.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-FDHPAVVB.js → chunk-VXOOB6YX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GFQP7HAZ.js → chunk-VZIZB6QH.js} +3 -5
- package/dist/cli-bundle/chunks/{chunk-GFQP7HAZ.js.map → chunk-VZIZB6QH.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-HQ3SB4CN.js → chunk-X3W65QK3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RZJLNXFG.js → chunk-XJTABV3X.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-GVT754PX.js → chunk-YCIUJJOD.js} +11 -5
- package/dist/cli-bundle/chunks/chunk-YCIUJJOD.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-IJNK6WW2.js → chunk-Z75ONV25.js} +75 -12
- package/dist/cli-bundle/chunks/chunk-Z75ONV25.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-4L23AGQ7.js → chunk-Z7VWXXJM.js} +5 -7
- package/dist/cli-bundle/chunks/{chunk-4L23AGQ7.js.map → chunk-Z7VWXXJM.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-YBT7O4KT.js → chunk-ZTVA4KLN.js} +4 -6
- package/dist/cli-bundle/chunks/{chunk-YBT7O4KT.js.map → chunk-ZTVA4KLN.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-TYHJDFYW.js → chunk-ZVZGXPQ5.js} +2 -2
- package/dist/cli-bundle/chunks/{close-many-SDA426VT.js → close-many-5RZXVN4J.js} +5 -6
- package/dist/cli-bundle/chunks/{close-many-UTZANOCQ.js → close-many-RZVTUGBG.js} +5 -6
- package/dist/cli-bundle/chunks/{comments-LZN6FXXC.js → comments-TPU7QRBL.js} +4 -4
- package/dist/cli-bundle/chunks/{comments-VBQ345ND.js → comments-Z4KV6FU3.js} +4 -4
- package/dist/cli-bundle/chunks/{create-GG4RBCGC.js → create-EIFBIVNQ.js} +6 -6
- package/dist/cli-bundle/chunks/{create-JBC5KUW6.js → create-RGSPN5GD.js} +6 -6
- package/dist/cli-bundle/chunks/{deps-FI4O6NQS.js → deps-UH5EQQUY.js} +3 -3
- package/dist/cli-bundle/chunks/{deps-DELOO4TL.js → deps-YG7UF3VR.js} +3 -3
- package/dist/cli-bundle/chunks/{docs-6Z2MP526.js → docs-G32TK6XS.js} +4 -4
- package/dist/cli-bundle/chunks/{docs-2UYBP5D6.js → docs-JWWNRC27.js} +4 -4
- package/dist/cli-bundle/chunks/{files-HKEAN5MA.js → files-3H32UQ4K.js} +4 -4
- package/dist/cli-bundle/chunks/{files-HEUGSJZL.js → files-4ALMCSKB.js} +4 -4
- package/dist/cli-bundle/chunks/{history-compact-7NDVP3PT.js → history-compact-77BT2LUB.js} +3 -4
- package/dist/cli-bundle/chunks/{history-compact-65YVN5DB.js → history-compact-VCKGTX64.js} +3 -4
- package/dist/cli-bundle/chunks/{history-redact-7YBL4XSG.js → history-redact-LJPZPNFA.js} +2 -3
- package/dist/cli-bundle/chunks/{history-redact-IZGNJBU4.js → history-redact-PWTTJ3XS.js} +2 -3
- package/dist/cli-bundle/chunks/{history-repair-7M4PYQUH.js → history-repair-I7CBNCV3.js} +5 -6
- package/dist/cli-bundle/chunks/{history-repair-GNGETJLI.js → history-repair-YTDZRK5E.js} +5 -6
- package/dist/cli-bundle/chunks/{learnings-3YXDRWFT.js → learnings-CYNOICKR.js} +4 -4
- package/dist/cli-bundle/chunks/{learnings-ALC6IMNL.js → learnings-KTYW3AL7.js} +4 -4
- package/dist/cli-bundle/chunks/{notes-7JMLQ447.js → notes-FGO63FXL.js} +4 -4
- package/dist/cli-bundle/chunks/{notes-JFCLTC5C.js → notes-ZERD3KB2.js} +4 -4
- package/dist/cli-bundle/chunks/{plan-T3XB3WTK.js → plan-OFJUBIM5.js} +7 -7
- package/dist/cli-bundle/chunks/{plan-KOIPWVOZ.js → plan-SGCDDTYR.js} +7 -7
- package/dist/cli-bundle/chunks/{profile-OILJHKUW.js → profile-3THJPIQY.js} +4 -5
- package/dist/cli-bundle/chunks/{profile-RJXA7PGS.js → profile-XEZAMMBW.js} +4 -5
- package/dist/cli-bundle/chunks/{register-list-query-CFVG75P3.js → register-list-query-BR435Q2H.js} +19 -16
- package/dist/cli-bundle/chunks/register-list-query-BR435Q2H.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-E7UVY4TN.js → register-list-query-RWTWLOBE.js} +18 -15
- package/dist/cli-bundle/chunks/register-list-query-RWTWLOBE.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-IQ55E25C.js → register-mutation-HLWC2WNP.js} +167 -31
- package/dist/cli-bundle/chunks/register-mutation-HLWC2WNP.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-mutation-4VJTXBZW.js → register-mutation-ZJX5AZM5.js} +173 -30
- package/dist/cli-bundle/chunks/register-mutation-ZJX5AZM5.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-operations-AR7RMX4W.js → register-operations-744YBJMV.js} +23 -25
- package/dist/cli-bundle/chunks/{register-operations-AR7RMX4W.js.map → register-operations-744YBJMV.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-operations-NOLZGORC.js → register-operations-UEBJH6AN.js} +21 -23
- package/dist/cli-bundle/chunks/{register-operations-NOLZGORC.js.map → register-operations-UEBJH6AN.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-setup-EYZ7VTPZ.js → register-setup-5DA4UZXI.js} +7 -8
- package/dist/cli-bundle/chunks/{register-setup-EYZ7VTPZ.js.map → register-setup-5DA4UZXI.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-setup-BB77VUEE.js → register-setup-6H25M3BH.js} +9 -10
- package/dist/cli-bundle/chunks/{register-setup-BB77VUEE.js.map → register-setup-6H25M3BH.js.map} +1 -1
- package/dist/cli-bundle/chunks/{restore-ZH65GZFB.js → restore-6TDVSATY.js} +4 -5
- package/dist/cli-bundle/chunks/{restore-L6IAGOD7.js → restore-RSL7C7LO.js} +4 -5
- package/dist/cli-bundle/chunks/{schema-4ERWM5QJ.js → schema-HFXFSGPG.js} +2 -3
- package/dist/cli-bundle/chunks/{schema-55DL3Q52.js → schema-TPVTIJPO.js} +2 -3
- package/dist/cli-bundle/chunks/{update-FW6FKDOP.js → update-LJZCL5SI.js} +7 -7
- package/dist/cli-bundle/chunks/{update-TJHSPRPT.js → update-SIA7LH5Y.js} +7 -7
- package/dist/cli-bundle/chunks/{update-many-PWXX5WHO.js → update-many-BDBZVGQL.js} +11 -12
- package/dist/cli-bundle/chunks/{update-many-NNALYQCN.js → update-many-MOY3A5B3.js} +11 -12
- package/dist/cli-bundle/main.js +60 -85
- package/dist/cli-bundle/main.js.map +2 -2
- package/dist/cli-bundle/sdk-runtime.js +37 -37
- package/dist/cli-bundle/sdk.js +126 -291
- package/dist/cli-bundle/sdk.js.map +4 -4
- package/dist/core/item/parse.d.ts +1 -1
- package/dist/core/item/parse.js +13 -7
- package/dist/core/item/parse.js.map +1 -1
- package/dist/core/output/mutation-projection.d.ts +2 -0
- package/dist/core/output/mutation-projection.js +33 -2
- package/dist/core/output/mutation-projection.js.map +1 -1
- package/dist/core/output/output.d.ts +4 -0
- package/dist/core/output/output.js +18 -13
- package/dist/core/output/output.js.map +1 -1
- package/dist/core/shared/command-types.d.ts +4 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/command-types.js.map +1 -1
- package/dist/mcp/server.js +39 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-definitions.js +45 -4
- package/dist/mcp/tool-definitions.js.map +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +20 -27
- package/dist/sdk/cli-bootstrap.js.map +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts/enum-contracts.js +7 -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 +21 -2
- package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +10 -2
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +16 -3
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +6 -2
- package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/cli-program.js +4 -2
- package/dist/sdk/cli-program.js.map +1 -1
- package/dist/sdk/dependencies.d.ts +3 -2
- package/dist/sdk/dependencies.js +13 -12
- package/dist/sdk/dependencies.js.map +1 -1
- package/dist/sdk/error-runtime.d.ts +10 -0
- package/dist/sdk/error-runtime.js +59 -0
- package/dist/sdk/error-runtime.js.map +1 -0
- package/dist/sdk/graph/analytics.d.ts +9 -0
- package/dist/sdk/graph/analytics.js +24 -13
- package/dist/sdk/graph/analytics.js.map +1 -1
- package/dist/sdk/graph/assembly.d.ts +39 -0
- package/dist/sdk/graph/assembly.js +92 -12
- package/dist/sdk/graph/assembly.js.map +1 -1
- package/dist/sdk/graph/cache.d.ts +4 -1
- package/dist/sdk/graph/cache.js +17 -4
- package/dist/sdk/graph/cache.js.map +1 -1
- package/dist/sdk/graph/centrality.d.ts +82 -0
- package/dist/sdk/graph/centrality.js +259 -0
- package/dist/sdk/graph/centrality.js.map +1 -0
- package/dist/sdk/graph/durable-cache.d.ts +71 -0
- package/dist/sdk/graph/durable-cache.js +205 -0
- package/dist/sdk/graph/durable-cache.js.map +1 -0
- package/dist/sdk/graph/governance.d.ts +69 -1
- package/dist/sdk/graph/governance.js +143 -35
- package/dist/sdk/graph/governance.js.map +1 -1
- package/dist/sdk/graph/index.d.ts +7 -4
- package/dist/sdk/graph/index.js +8 -5
- package/dist/sdk/graph/index.js.map +1 -1
- package/dist/sdk/graph/mutation-advisory.d.ts +35 -4
- package/dist/sdk/graph/mutation-advisory.js +124 -35
- package/dist/sdk/graph/mutation-advisory.js.map +1 -1
- package/dist/sdk/graph/remediation.js +12 -2
- package/dist/sdk/graph/remediation.js.map +1 -1
- package/dist/sdk/graph/run.d.ts +133 -2
- package/dist/sdk/graph/run.js +217 -8
- package/dist/sdk/graph/run.js.map +1 -1
- package/dist/sdk/graph/scheduling.d.ts +59 -0
- package/dist/sdk/graph/scheduling.js +125 -0
- package/dist/sdk/graph/scheduling.js.map +1 -0
- package/dist/sdk/graph/traversal.d.ts +11 -0
- package/dist/sdk/graph/traversal.js +16 -2
- package/dist/sdk/graph/traversal.js.map +1 -1
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.js +6 -2
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/runtime-input.js +7 -2
- package/dist/sdk/runtime-input.js.map +1 -1
- package/dist/sdk/runtime-primitives.d.ts +10 -0
- package/dist/sdk/runtime-primitives.js +14 -0
- package/dist/sdk/runtime-primitives.js.map +1 -0
- package/dist/sdk/runtime.d.ts +15 -0
- package/dist/sdk/runtime.js +16 -3
- package/dist/sdk/runtime.js.map +1 -1
- package/dist/sdk/structured-mutations.d.ts +21 -0
- package/dist/sdk/structured-mutations.js +375 -0
- package/dist/sdk/structured-mutations.js.map +1 -0
- package/docs/COMMANDS.md +85 -5
- package/docs/RELATIONSHIP_GRAPH.md +48 -7
- package/docs/SDK.md +78 -3
- package/marketplace.json +2 -2
- package/package.json +1 -1
- 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-claude/README.md +5 -3
- package/plugins/pm-claude/commands/pm-init.md +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-3AO5VSDR.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-3LPFHE3P.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-3VY6MIEO.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4F6BWJ4J.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-5IZJWSDB.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-5UX66S6U.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-6C2ZZX5Z.js +0 -286
- package/dist/cli-bundle/chunks/chunk-6C2ZZX5Z.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-6VIJ7UA5.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6XMUURSS.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-C3KD7U3T.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js +0 -334
- package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-DAQ45GCS.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-E6LEMURX.js +0 -249
- package/dist/cli-bundle/chunks/chunk-E6LEMURX.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-G3COA6GS.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-GSJSM5BJ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-GVI6FAFG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-GVT754PX.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HEWM6CEN.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-IJNK6WW2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-J4FBIFU6.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-KZEANWJS.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-LPEYZRUR.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-NHT3F4WZ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-OV7MSW3I.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js +0 -246
- package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js +0 -344
- package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SG74J6MV.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-T44FMVRL.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-THAOZG4U.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-UQLXSG72.js +0 -289
- package/dist/cli-bundle/chunks/chunk-UQLXSG72.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-UZDQXNUB.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-WVA4DVNV.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-CFVG75P3.js.map +0 -1
- package/dist/cli-bundle/chunks/register-list-query-E7UVY4TN.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-4VJTXBZW.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-IQ55E25C.js.map +0 -1
- /package/dist/cli-bundle/chunks/{append-E6V54WOQ.js.map → append-7OVFYR3C.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-NNJ3EFIT.js.map → append-DFETHAZL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QJKL5PHS.js.map → chunk-7656MAUL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-X6K5XTTN.js.map → chunk-7W2UAXXT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5OK4UGFV.js.map → chunk-BXNDKOR2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KSPWRNVP.js.map → chunk-CPX275C6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JH2ZSLO3.js.map → chunk-DZRV2OPA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-L7BH7IWU.js.map → chunk-E5XMKOSB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CQTQKUUV.js.map → chunk-EWJWSNRU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3MCTMJXI.js.map → chunk-FPBMLYPI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DVDBQA3B.js.map → chunk-GTK4DTEW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GIQSU6S2.js.map → chunk-KBLZ3AA5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XJF7CDNH.js.map → chunk-KH44WBAT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GV2262OF.js.map → chunk-LAV26CQG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VDO2JMD4.js.map → chunk-LVC72YRD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZYPFOO3L.js.map → chunk-MATHDCGG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-AOEOYL3S.js.map → chunk-O4BCOJTZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RJO3YAFM.js.map → chunk-OCUBRA6D.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-I577UHC7.js.map → chunk-OR42SO64.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZOJ3LR7O.js.map → chunk-OY7DMU5P.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZV2NTVMJ.js.map → chunk-PONKZPCJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UX6SSO2I.js.map → chunk-PZC2FUOQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VQIHNHMJ.js.map → chunk-QIH77CAG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-R3EWPG4A.js.map → chunk-QJIKE24M.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HB3P4M52.js.map → chunk-TRSHFPRZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HRW7GF6T.js.map → chunk-UCBDQI5E.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4U4Z6AHI.js.map → chunk-V22ZPOKN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JM6YAXTR.js.map → chunk-VHXHVTUU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-D6NXDNP3.js.map → chunk-VLRGDBLY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JAPE62Y5.js.map → chunk-VNTCM3VW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FDHPAVVB.js.map → chunk-VXOOB6YX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HQ3SB4CN.js.map → chunk-X3W65QK3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RZJLNXFG.js.map → chunk-XJTABV3X.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TYHJDFYW.js.map → chunk-ZVZGXPQ5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-SDA426VT.js.map → close-many-5RZXVN4J.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-UTZANOCQ.js.map → close-many-RZVTUGBG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-LZN6FXXC.js.map → comments-TPU7QRBL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-VBQ345ND.js.map → comments-Z4KV6FU3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-GG4RBCGC.js.map → create-EIFBIVNQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-JBC5KUW6.js.map → create-RGSPN5GD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-FI4O6NQS.js.map → deps-UH5EQQUY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-DELOO4TL.js.map → deps-YG7UF3VR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-6Z2MP526.js.map → docs-G32TK6XS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-2UYBP5D6.js.map → docs-JWWNRC27.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-HKEAN5MA.js.map → files-3H32UQ4K.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-HEUGSJZL.js.map → files-4ALMCSKB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-7NDVP3PT.js.map → history-compact-77BT2LUB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-65YVN5DB.js.map → history-compact-VCKGTX64.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-7YBL4XSG.js.map → history-redact-LJPZPNFA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-IZGNJBU4.js.map → history-redact-PWTTJ3XS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-7M4PYQUH.js.map → history-repair-I7CBNCV3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-GNGETJLI.js.map → history-repair-YTDZRK5E.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-3YXDRWFT.js.map → learnings-CYNOICKR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-ALC6IMNL.js.map → learnings-KTYW3AL7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-7JMLQ447.js.map → notes-FGO63FXL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-JFCLTC5C.js.map → notes-ZERD3KB2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-T3XB3WTK.js.map → plan-OFJUBIM5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-KOIPWVOZ.js.map → plan-SGCDDTYR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-OILJHKUW.js.map → profile-3THJPIQY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-RJXA7PGS.js.map → profile-XEZAMMBW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-ZH65GZFB.js.map → restore-6TDVSATY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-L6IAGOD7.js.map → restore-RSL7C7LO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-4ERWM5QJ.js.map → schema-HFXFSGPG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-55DL3Q52.js.map → schema-TPVTIJPO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-FW6FKDOP.js.map → update-LJZCL5SI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-TJHSPRPT.js.map → update-SIA7LH5Y.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-PWXX5WHO.js.map → update-many-BDBZVGQL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-NNALYQCN.js.map → update-many-MOY3A5B3.js.map} +0 -0
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="69f422b7-7912-5517-91f9-247ad58bd84c")}catch(e){}}();
|
|
3
|
+
import {
|
|
4
|
+
close,
|
|
5
|
+
commitWorkspaceTransaction,
|
|
6
|
+
create,
|
|
7
|
+
deleteItem,
|
|
8
|
+
get,
|
|
9
|
+
restore,
|
|
10
|
+
update
|
|
11
|
+
} from "./chunk-RNPZYNHS.js";
|
|
12
|
+
import {
|
|
13
|
+
CLOSE_FLAG_CONTRACTS,
|
|
14
|
+
CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,
|
|
15
|
+
UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS
|
|
16
|
+
} from "./chunk-FSE2IKJQ.js";
|
|
3
17
|
import {
|
|
4
18
|
historyEntriesToRaw,
|
|
19
|
+
readHistoryEntries,
|
|
5
20
|
reanchorHistoryEntries
|
|
6
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PFNHX655.js";
|
|
7
22
|
import {
|
|
8
23
|
canonicalDocument,
|
|
9
24
|
compareTimestampStrings,
|
|
@@ -20,6 +35,7 @@ import {
|
|
|
20
35
|
PmCliError,
|
|
21
36
|
collectRegisteredItemFieldNames,
|
|
22
37
|
getSettingsPath,
|
|
38
|
+
levenshteinDistanceWithinLimit,
|
|
23
39
|
pathExists,
|
|
24
40
|
resolvePmRoot
|
|
25
41
|
} from "./chunk-HYW67VJ5.js";
|
|
@@ -589,6 +605,553 @@ async function runMergeDriver(options, global) {
|
|
|
589
605
|
};
|
|
590
606
|
}
|
|
591
607
|
|
|
608
|
+
// dist/sdk/structured-mutations.js
|
|
609
|
+
var MUTATION_ROW_KEYS = ["op", "id", "reason", "options"];
|
|
610
|
+
var ITEM_ENVELOPE_KEYS = [
|
|
611
|
+
"item",
|
|
612
|
+
"linked",
|
|
613
|
+
"schedule",
|
|
614
|
+
"claim_state",
|
|
615
|
+
"children"
|
|
616
|
+
];
|
|
617
|
+
var READ_ONLY_ITEM_KEYS = /* @__PURE__ */ new Set([
|
|
618
|
+
"created_at",
|
|
619
|
+
"updated_at",
|
|
620
|
+
"closed_at",
|
|
621
|
+
"version",
|
|
622
|
+
"format_version",
|
|
623
|
+
"path",
|
|
624
|
+
"author"
|
|
625
|
+
]);
|
|
626
|
+
var UPDATE_READ_ONLY_ITEM_KEYS = /* @__PURE__ */ new Set([...READ_ONLY_ITEM_KEYS, "id"]);
|
|
627
|
+
var ITEM_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
628
|
+
"id",
|
|
629
|
+
"title",
|
|
630
|
+
"description",
|
|
631
|
+
"type",
|
|
632
|
+
"status",
|
|
633
|
+
"priority",
|
|
634
|
+
"tags",
|
|
635
|
+
"body",
|
|
636
|
+
"deadline",
|
|
637
|
+
"estimated_minutes",
|
|
638
|
+
"acceptance_criteria",
|
|
639
|
+
"definition_of_ready",
|
|
640
|
+
"order",
|
|
641
|
+
"rank",
|
|
642
|
+
"goal",
|
|
643
|
+
"objective",
|
|
644
|
+
"value",
|
|
645
|
+
"impact",
|
|
646
|
+
"outcome",
|
|
647
|
+
"why_now",
|
|
648
|
+
"assignee",
|
|
649
|
+
"parent",
|
|
650
|
+
"reviewer",
|
|
651
|
+
"risk",
|
|
652
|
+
"confidence",
|
|
653
|
+
"sprint",
|
|
654
|
+
"release",
|
|
655
|
+
"blocked_by",
|
|
656
|
+
"blocked_reason",
|
|
657
|
+
"unblock_note",
|
|
658
|
+
"reporter",
|
|
659
|
+
"severity",
|
|
660
|
+
"environment",
|
|
661
|
+
"repro_steps",
|
|
662
|
+
"resolution",
|
|
663
|
+
"expected_result",
|
|
664
|
+
"actual_result",
|
|
665
|
+
"affected_version",
|
|
666
|
+
"fixed_version",
|
|
667
|
+
"component",
|
|
668
|
+
"regression",
|
|
669
|
+
"customer_impact",
|
|
670
|
+
"close_reason",
|
|
671
|
+
"dependencies",
|
|
672
|
+
"comments",
|
|
673
|
+
"notes",
|
|
674
|
+
"learnings",
|
|
675
|
+
"files",
|
|
676
|
+
"tests",
|
|
677
|
+
"docs",
|
|
678
|
+
"reminders",
|
|
679
|
+
"events",
|
|
680
|
+
"type_options"
|
|
681
|
+
]);
|
|
682
|
+
var MUTATION_OPTION_KEYS = {
|
|
683
|
+
create: CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS.map((contract) => contract.target),
|
|
684
|
+
update: UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS.map((contract) => contract.target),
|
|
685
|
+
close: CLOSE_FLAG_CONTRACTS.map((contract) => contract.flag.slice(2).replaceAll(/-([a-z])/gu, (_match, letter) => letter.toUpperCase())).filter((key) => key !== "reason")
|
|
686
|
+
};
|
|
687
|
+
function parseAtomicMutationControls(value) {
|
|
688
|
+
const controls = {};
|
|
689
|
+
const compensation = value.createCompensation;
|
|
690
|
+
if (compensation !== void 0) {
|
|
691
|
+
if (compensation !== "close" && compensation !== "delete") {
|
|
692
|
+
throw new PmCliError("createCompensation must be close or delete.", EXIT_CODE.USAGE);
|
|
693
|
+
}
|
|
694
|
+
controls.createCompensation = compensation;
|
|
695
|
+
}
|
|
696
|
+
for (const key of ["lockTtlSeconds", "lockWaitMs"]) {
|
|
697
|
+
const raw = value[key];
|
|
698
|
+
if (raw === void 0)
|
|
699
|
+
continue;
|
|
700
|
+
const parsed = typeof raw === "number" || typeof raw === "string" && raw.trim().length > 0 ? Number(raw) : Number.NaN;
|
|
701
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
702
|
+
throw new PmCliError(`${key} must be a positive safe integer.`, EXIT_CODE.USAGE);
|
|
703
|
+
}
|
|
704
|
+
controls[key] = parsed;
|
|
705
|
+
}
|
|
706
|
+
return controls;
|
|
707
|
+
}
|
|
708
|
+
function isPlainObject2(value) {
|
|
709
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
const prototype = Object.getPrototypeOf(value);
|
|
713
|
+
return prototype === Object.prototype || prototype === null;
|
|
714
|
+
}
|
|
715
|
+
function nearestKey(key, candidates) {
|
|
716
|
+
const limit = Math.max(1, Math.min(3, Math.floor(key.length / 4) + 1));
|
|
717
|
+
let best;
|
|
718
|
+
for (const candidate of candidates) {
|
|
719
|
+
const distance = levenshteinDistanceWithinLimit(key, candidate, limit);
|
|
720
|
+
if (distance !== null && (best === void 0 || distance < best.distance)) {
|
|
721
|
+
best = { key: candidate, distance };
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return best?.key;
|
|
725
|
+
}
|
|
726
|
+
function unknownKeyError(scope, key, candidates) {
|
|
727
|
+
const suggestion = nearestKey(key, candidates);
|
|
728
|
+
return new PmCliError(suggestion === void 0 ? `${scope} does not recognize key "${key}". Allowed keys: ${candidates.join(", ")}.` : `${scope} does not recognize key "${key}". Did you mean "${suggestion}"?`, EXIT_CODE.USAGE, {
|
|
729
|
+
code: "stdin_json_unknown_key",
|
|
730
|
+
required: `Use documented ${scope} keys only.`,
|
|
731
|
+
why: "Strict structured input prevents silent typos from creating incomplete or unintended mutations.",
|
|
732
|
+
nextSteps: [
|
|
733
|
+
suggestion === void 0 ? `Remove or correct "${key}".` : `Replace "${key}" with "${suggestion}".`
|
|
734
|
+
]
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
function parseJsonValue(input, label) {
|
|
738
|
+
try {
|
|
739
|
+
return JSON.parse(input);
|
|
740
|
+
} catch (error) {
|
|
741
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
742
|
+
throw new PmCliError(`${label} must be valid JSON: ${detail}`, EXIT_CODE.USAGE, {
|
|
743
|
+
code: "stdin_json_invalid",
|
|
744
|
+
required: `Pipe one valid JSON ${label.toLowerCase()} into stdin.`,
|
|
745
|
+
why: "Structured mutation input must parse deterministically before any tracker write begins."
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function validateMutationObject(value, index) {
|
|
750
|
+
if (!isPlainObject2(value)) {
|
|
751
|
+
throw new PmCliError(`Mutation ${index + 1} must be an object.`, EXIT_CODE.USAGE);
|
|
752
|
+
}
|
|
753
|
+
for (const key of Object.keys(value)) {
|
|
754
|
+
if (!MUTATION_ROW_KEYS.includes(key)) {
|
|
755
|
+
throw unknownKeyError(`mutation ${index + 1}`, key, MUTATION_ROW_KEYS);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return value;
|
|
759
|
+
}
|
|
760
|
+
function validateMutationOptions(options, op, index) {
|
|
761
|
+
if (options === void 0)
|
|
762
|
+
return void 0;
|
|
763
|
+
if (!isPlainObject2(options)) {
|
|
764
|
+
throw new PmCliError(`Mutation ${index + 1} options must be an object.`, EXIT_CODE.USAGE);
|
|
765
|
+
}
|
|
766
|
+
for (const key of Object.keys(options)) {
|
|
767
|
+
if (!MUTATION_OPTION_KEYS[op].includes(key)) {
|
|
768
|
+
throw unknownKeyError(`mutation ${index + 1} ${op} options`, key, MUTATION_OPTION_KEYS[op]);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return options;
|
|
772
|
+
}
|
|
773
|
+
function validateMutationRow(value, index) {
|
|
774
|
+
const mutation = validateMutationObject(value, index);
|
|
775
|
+
const { op, id, reason } = mutation;
|
|
776
|
+
if (op !== "create" && op !== "update" && op !== "close") {
|
|
777
|
+
throw new PmCliError(`Mutation ${index + 1} op must be create, update, or close.`, EXIT_CODE.USAGE);
|
|
778
|
+
}
|
|
779
|
+
const options = validateMutationOptions(mutation.options, op, index);
|
|
780
|
+
if (typeof id !== "string" || id.trim().length === 0) {
|
|
781
|
+
throw new PmCliError(`Mutation ${index + 1} requires a non-empty id.`, EXIT_CODE.USAGE);
|
|
782
|
+
}
|
|
783
|
+
const normalizedId = id.trim();
|
|
784
|
+
if (op === "close") {
|
|
785
|
+
if (typeof reason !== "string" || reason.trim().length === 0) {
|
|
786
|
+
throw new PmCliError(`Mutation ${index + 1} close requires a non-empty reason.`, EXIT_CODE.USAGE);
|
|
787
|
+
}
|
|
788
|
+
return {
|
|
789
|
+
op,
|
|
790
|
+
id: normalizedId,
|
|
791
|
+
reason: reason.trim(),
|
|
792
|
+
...options === void 0 ? {} : { options }
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
if (!isPlainObject2(options)) {
|
|
796
|
+
throw new PmCliError(`Mutation ${index + 1} ${op} requires an options object.`, EXIT_CODE.USAGE);
|
|
797
|
+
}
|
|
798
|
+
return {
|
|
799
|
+
op,
|
|
800
|
+
id: normalizedId,
|
|
801
|
+
options
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function parseItemMutationBatch(input) {
|
|
805
|
+
const parsed = parseJsonValue(input, "Mutation batch");
|
|
806
|
+
const rows = Array.isArray(parsed) ? parsed : isPlainObject2(parsed) && Array.isArray(parsed.mutations) ? parsed.mutations : void 0;
|
|
807
|
+
if (rows === void 0 || rows.length === 0) {
|
|
808
|
+
throw new PmCliError("Mutation batch must be a non-empty JSON array or an object with a non-empty mutations array.", EXIT_CODE.USAGE);
|
|
809
|
+
}
|
|
810
|
+
return rows.map((row, index) => validateMutationRow(row, index));
|
|
811
|
+
}
|
|
812
|
+
function serializePairs(value, keys) {
|
|
813
|
+
return keys.filter((key) => value[key] !== void 0 && value[key] !== null).map((key) => {
|
|
814
|
+
const rendered = String(value[key]);
|
|
815
|
+
return `${key}=${/[",\n\r\\]/u.test(rendered) ? JSON.stringify(rendered) : rendered}`;
|
|
816
|
+
}).join(",");
|
|
817
|
+
}
|
|
818
|
+
function serializeObjectArray(value, keys, label) {
|
|
819
|
+
if (value === void 0)
|
|
820
|
+
return void 0;
|
|
821
|
+
if (!Array.isArray(value) || !value.every(isPlainObject2)) {
|
|
822
|
+
throw new PmCliError(`${label} must be an array of objects.`, EXIT_CODE.USAGE);
|
|
823
|
+
}
|
|
824
|
+
return value.map((entry) => serializePairs(entry, keys));
|
|
825
|
+
}
|
|
826
|
+
function scalarItemOption(key, value) {
|
|
827
|
+
if (key === "tags" && Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
|
|
828
|
+
return JSON.stringify(value);
|
|
829
|
+
}
|
|
830
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
831
|
+
return String(value);
|
|
832
|
+
}
|
|
833
|
+
return value;
|
|
834
|
+
}
|
|
835
|
+
function appendFacetOptions(target, source, skipPersistedAnnotations = false) {
|
|
836
|
+
const mappings = [
|
|
837
|
+
["dependencies", "dep", ["id", "kind", "created_at", "author"]],
|
|
838
|
+
["comments", "comment", ["text", "created_at", "author"]],
|
|
839
|
+
["notes", "note", ["text", "created_at", "author"]],
|
|
840
|
+
["learnings", "learning", ["text", "created_at", "author"]],
|
|
841
|
+
["files", "file", ["path", "scope", "note"]],
|
|
842
|
+
["tests", "test", ["command", "scope", "timeout_seconds"]],
|
|
843
|
+
["docs", "doc", ["path", "scope", "note"]],
|
|
844
|
+
["reminders", "reminder", ["at", "text", "created_at"]],
|
|
845
|
+
["events", "event", ["start_at", "end_at", "title", "location"]],
|
|
846
|
+
["type_options", "typeOption", ["key", "value"]]
|
|
847
|
+
];
|
|
848
|
+
for (const [sourceKey, targetKey, keys] of mappings) {
|
|
849
|
+
const sourceValue = source[sourceKey];
|
|
850
|
+
const serialized = serializeObjectArray(skipPersistedAnnotations && ["comments", "notes", "learnings"].includes(sourceKey) && Array.isArray(sourceValue) ? sourceValue.filter((entry) => !isPlainObject2(entry) || entry.created_at === void 0) : sourceValue, keys, sourceKey);
|
|
851
|
+
if (serialized !== void 0 && serialized.length > 0)
|
|
852
|
+
target[targetKey] = serialized;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
function validateItemDocumentKeys(parsed, envelope) {
|
|
856
|
+
for (const key of Object.keys(parsed)) {
|
|
857
|
+
if (envelope) {
|
|
858
|
+
if (!ITEM_ENVELOPE_KEYS.includes(key))
|
|
859
|
+
throw unknownKeyError("item envelope", key, ITEM_ENVELOPE_KEYS);
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
if (!ITEM_FIELD_KEYS.has(key) && nearestKey(key, [...ITEM_FIELD_KEYS]) === void 0 && nearestKey(key, ITEM_ENVELOPE_KEYS) === "item")
|
|
863
|
+
throw unknownKeyError("item envelope", key, ITEM_ENVELOPE_KEYS);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
function resolveItemDocument(parsed) {
|
|
867
|
+
const envelope = Object.hasOwn(parsed, "item");
|
|
868
|
+
validateItemDocumentKeys(parsed, envelope);
|
|
869
|
+
const item = envelope ? parsed.item : parsed;
|
|
870
|
+
if (!isPlainObject2(item)) {
|
|
871
|
+
throw new PmCliError("Item document item must be an object.", EXIT_CODE.USAGE);
|
|
872
|
+
}
|
|
873
|
+
return {
|
|
874
|
+
item,
|
|
875
|
+
...envelope && isPlainObject2(parsed.linked) ? { linked: parsed.linked } : {}
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
function appendItemDocumentEntry(documentOptions, key, value, mode) {
|
|
879
|
+
const readOnlyKeys = mode === "update" ? UPDATE_READ_ONLY_ITEM_KEYS : READ_ONLY_ITEM_KEYS;
|
|
880
|
+
if (readOnlyKeys.has(key))
|
|
881
|
+
return;
|
|
882
|
+
if (!ITEM_FIELD_KEYS.has(key)) {
|
|
883
|
+
const suggestion = nearestKey(key, [...ITEM_FIELD_KEYS]);
|
|
884
|
+
if (suggestion !== void 0)
|
|
885
|
+
throw unknownKeyError("item document", key, [...ITEM_FIELD_KEYS]);
|
|
886
|
+
const fields = Array.isArray(documentOptions.field) ? documentOptions.field : [];
|
|
887
|
+
fields.push(serializePairs({
|
|
888
|
+
key,
|
|
889
|
+
value: typeof value === "string" ? value : JSON.stringify(value)
|
|
890
|
+
}, ["key", "value"]));
|
|
891
|
+
documentOptions.field = fields;
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
if ([
|
|
895
|
+
"dependencies",
|
|
896
|
+
"comments",
|
|
897
|
+
"notes",
|
|
898
|
+
"learnings",
|
|
899
|
+
"files",
|
|
900
|
+
"tests",
|
|
901
|
+
"docs",
|
|
902
|
+
"reminders",
|
|
903
|
+
"events",
|
|
904
|
+
"type_options"
|
|
905
|
+
].includes(key))
|
|
906
|
+
return;
|
|
907
|
+
documentOptions[key.replaceAll(/_([a-z])/gu, (_match, letter) => letter.toUpperCase())] = scalarItemOption(key, value);
|
|
908
|
+
}
|
|
909
|
+
function itemDocumentToMutationOptions(input, mode, explicitOptions = {}) {
|
|
910
|
+
const parsed = parseJsonValue(input, "Item document");
|
|
911
|
+
if (!isPlainObject2(parsed)) {
|
|
912
|
+
throw new PmCliError("Item document must be a JSON object.", EXIT_CODE.USAGE);
|
|
913
|
+
}
|
|
914
|
+
const { item, linked } = resolveItemDocument(parsed);
|
|
915
|
+
const documentOptions = {};
|
|
916
|
+
for (const [key, value] of Object.entries(item)) {
|
|
917
|
+
appendItemDocumentEntry(documentOptions, key, value, mode);
|
|
918
|
+
}
|
|
919
|
+
appendFacetOptions(documentOptions, item, mode === "update");
|
|
920
|
+
if (linked !== void 0)
|
|
921
|
+
appendFacetOptions(documentOptions, linked);
|
|
922
|
+
return {
|
|
923
|
+
...documentOptions,
|
|
924
|
+
...Object.fromEntries(Object.entries(explicitOptions).filter(([, value]) => value !== void 0)),
|
|
925
|
+
stdinJson: void 0
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
function validateItemMutationRows(value) {
|
|
929
|
+
return parseItemMutationBatch(JSON.stringify(value));
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// dist/sdk/item-transaction.js
|
|
933
|
+
import path2 from "node:path";
|
|
934
|
+
async function readItemSnapshot(pmRoot, id) {
|
|
935
|
+
try {
|
|
936
|
+
const located = await get(id, {}, { pmRoot });
|
|
937
|
+
const item = located.item;
|
|
938
|
+
return {
|
|
939
|
+
id: item.id,
|
|
940
|
+
closedAt: item.closed_at,
|
|
941
|
+
updatedAt: item.updated_at
|
|
942
|
+
};
|
|
943
|
+
} catch (error) {
|
|
944
|
+
if (error instanceof PmCliError && error.exitCode === EXIT_CODE.NOT_FOUND) {
|
|
945
|
+
return void 0;
|
|
946
|
+
}
|
|
947
|
+
throw error;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
function deriveStepId(mutation, index) {
|
|
951
|
+
const sanitizedTarget = mutation.id.replaceAll(/[^a-zA-Z0-9._-]/gu, "_");
|
|
952
|
+
return `${index + 1}-${mutation.op}-${sanitizedTarget}`;
|
|
953
|
+
}
|
|
954
|
+
function bulkHistoryMarker(transactionId, stepId, phase) {
|
|
955
|
+
return `bulk-item-transaction ${transactionId} ${stepId} ${phase}`;
|
|
956
|
+
}
|
|
957
|
+
async function isUpdateMarkerApplied(pmRoot, canonicalId, transactionId, stepId) {
|
|
958
|
+
const entries = await readHistoryEntries(path2.join(pmRoot, "history", `${canonicalId}.jsonl`), canonicalId);
|
|
959
|
+
const applyMarker = bulkHistoryMarker(transactionId, stepId, "apply");
|
|
960
|
+
const compensateMarker = bulkHistoryMarker(transactionId, stepId, "compensate");
|
|
961
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
962
|
+
const message = entries[index].message;
|
|
963
|
+
if (message === applyMarker) {
|
|
964
|
+
return true;
|
|
965
|
+
}
|
|
966
|
+
if (message === compensateMarker) {
|
|
967
|
+
return false;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return false;
|
|
971
|
+
}
|
|
972
|
+
async function prepareRestoreCompensation(pmRoot, mutation) {
|
|
973
|
+
const snapshot = await readItemSnapshot(pmRoot, mutation.id);
|
|
974
|
+
if (snapshot?.updatedAt === void 0) {
|
|
975
|
+
throw new PmCliError(`Bulk ${mutation.op} target ${mutation.id} does not exist or has no restorable version`, EXIT_CODE.NOT_FOUND);
|
|
976
|
+
}
|
|
977
|
+
return { target_updated_at: snapshot.updatedAt };
|
|
978
|
+
}
|
|
979
|
+
async function compensateByRestore(config, itemId, stepId, data) {
|
|
980
|
+
const target = data !== null && typeof data === "object" && !Array.isArray(data) ? data.target_updated_at : void 0;
|
|
981
|
+
if (typeof target !== "string") {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
if (await readItemSnapshot(config.pmRoot, itemId) === void 0) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
await restore(itemId, target, {
|
|
988
|
+
force: true,
|
|
989
|
+
author: config.author,
|
|
990
|
+
message: bulkHistoryMarker(config.transactionId, stepId, "compensate")
|
|
991
|
+
}, { pmRoot: config.pmRoot });
|
|
992
|
+
}
|
|
993
|
+
function buildCreateStep(config, mutation, stepId) {
|
|
994
|
+
return {
|
|
995
|
+
id: stepId,
|
|
996
|
+
async inspect() {
|
|
997
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
998
|
+
if (snapshot === void 0) {
|
|
999
|
+
return { state: "pending" };
|
|
1000
|
+
}
|
|
1001
|
+
return { state: "applied", result: { id: snapshot.id, op: "create" } };
|
|
1002
|
+
},
|
|
1003
|
+
async apply() {
|
|
1004
|
+
const created = await create({ ...mutation.options, author: config.author, id: mutation.id }, { pmRoot: config.pmRoot });
|
|
1005
|
+
const createdItem = created.item;
|
|
1006
|
+
return { id: String(createdItem.id), op: "create" };
|
|
1007
|
+
},
|
|
1008
|
+
async compensate() {
|
|
1009
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
1010
|
+
if (snapshot === void 0) {
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
if (config.createCompensation === "delete") {
|
|
1014
|
+
await deleteItem(mutation.id, {
|
|
1015
|
+
force: true,
|
|
1016
|
+
author: config.author,
|
|
1017
|
+
message: `Compensate interrupted bulk transaction ${config.transactionId}`
|
|
1018
|
+
}, { pmRoot: config.pmRoot });
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
if (snapshot.closedAt !== void 0) {
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
await close(mutation.id, `Compensated: interrupted bulk transaction ${config.transactionId}`, { force: true, author: config.author }, { pmRoot: config.pmRoot });
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
function buildUpdateStep(config, mutation, stepId) {
|
|
1029
|
+
return {
|
|
1030
|
+
id: stepId,
|
|
1031
|
+
async inspect() {
|
|
1032
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
1033
|
+
if (snapshot === void 0) {
|
|
1034
|
+
return { state: "pending" };
|
|
1035
|
+
}
|
|
1036
|
+
const applied = await isUpdateMarkerApplied(config.pmRoot, snapshot.id, config.transactionId, stepId);
|
|
1037
|
+
if (!applied) {
|
|
1038
|
+
return { state: "pending" };
|
|
1039
|
+
}
|
|
1040
|
+
return { state: "applied", result: { id: snapshot.id, op: "update" } };
|
|
1041
|
+
},
|
|
1042
|
+
async prepareCompensation() {
|
|
1043
|
+
return prepareRestoreCompensation(config.pmRoot, mutation);
|
|
1044
|
+
},
|
|
1045
|
+
async apply() {
|
|
1046
|
+
const updated = await update(mutation.id, {
|
|
1047
|
+
...mutation.options,
|
|
1048
|
+
author: config.author,
|
|
1049
|
+
message: bulkHistoryMarker(config.transactionId, stepId, "apply")
|
|
1050
|
+
}, { pmRoot: config.pmRoot });
|
|
1051
|
+
const updatedItem = updated.item;
|
|
1052
|
+
return { id: String(updatedItem.id), op: "update" };
|
|
1053
|
+
},
|
|
1054
|
+
async compensate(data) {
|
|
1055
|
+
await compensateByRestore(config, mutation.id, stepId, data);
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
function buildCloseStep(config, mutation, stepId) {
|
|
1060
|
+
return {
|
|
1061
|
+
id: stepId,
|
|
1062
|
+
// An already-terminal target counts as applied: closing it again would
|
|
1063
|
+
// fight legitimate prior closure, and recovery must adopt completed work.
|
|
1064
|
+
async inspect() {
|
|
1065
|
+
const snapshot = await readItemSnapshot(config.pmRoot, mutation.id);
|
|
1066
|
+
if (snapshot?.closedAt === void 0) {
|
|
1067
|
+
return { state: "pending" };
|
|
1068
|
+
}
|
|
1069
|
+
return { state: "applied", result: { id: snapshot.id, op: "close" } };
|
|
1070
|
+
},
|
|
1071
|
+
async prepareCompensation() {
|
|
1072
|
+
return prepareRestoreCompensation(config.pmRoot, mutation);
|
|
1073
|
+
},
|
|
1074
|
+
async apply() {
|
|
1075
|
+
const closed = await close(mutation.id, mutation.reason, { ...mutation.options, author: config.author }, { pmRoot: config.pmRoot });
|
|
1076
|
+
const closedItem = closed.item;
|
|
1077
|
+
return { id: String(closedItem.id), op: "close" };
|
|
1078
|
+
},
|
|
1079
|
+
async compensate(data) {
|
|
1080
|
+
await compensateByRestore(config, mutation.id, stepId, data);
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
function buildStepForMutation(config, mutation, index) {
|
|
1085
|
+
const stepId = deriveStepId(mutation, index);
|
|
1086
|
+
if (mutation.op === "create") {
|
|
1087
|
+
return buildCreateStep(config, mutation, stepId);
|
|
1088
|
+
}
|
|
1089
|
+
if (mutation.op === "update") {
|
|
1090
|
+
return buildUpdateStep(config, mutation, stepId);
|
|
1091
|
+
}
|
|
1092
|
+
return buildCloseStep(config, mutation, stepId);
|
|
1093
|
+
}
|
|
1094
|
+
function assertValidBulkMutation(mutation, index) {
|
|
1095
|
+
if (mutation === null || typeof mutation !== "object" || Array.isArray(mutation)) {
|
|
1096
|
+
throw new TypeError(`Bulk mutation ${index + 1} must be an object`);
|
|
1097
|
+
}
|
|
1098
|
+
if (!["create", "update", "close"].includes(mutation.op)) {
|
|
1099
|
+
throw new TypeError(`Bulk mutation ${index + 1} op must be create, update, or close`);
|
|
1100
|
+
}
|
|
1101
|
+
if (typeof mutation.id !== "string" || mutation.id.trim().length === 0) {
|
|
1102
|
+
throw new TypeError(`Bulk mutation ${index + 1} requires a non-empty id`);
|
|
1103
|
+
}
|
|
1104
|
+
if (mutation.op === "close" && (typeof mutation.reason !== "string" || mutation.reason.trim().length === 0)) {
|
|
1105
|
+
throw new TypeError(`Bulk close mutation ${index + 1} requires a non-empty reason`);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
async function commitItemMutations(options) {
|
|
1109
|
+
const mutations = [...options.mutations];
|
|
1110
|
+
if (mutations.length === 0) {
|
|
1111
|
+
throw new TypeError("Bulk item transaction requires at least one mutation");
|
|
1112
|
+
}
|
|
1113
|
+
for (const [index, mutation] of mutations.entries()) {
|
|
1114
|
+
assertValidBulkMutation(mutation, index);
|
|
1115
|
+
}
|
|
1116
|
+
const createCompensation = options.createCompensation ?? "close";
|
|
1117
|
+
if (!["close", "delete"].includes(createCompensation)) {
|
|
1118
|
+
throw new TypeError("Bulk item transaction createCompensation must be close or delete");
|
|
1119
|
+
}
|
|
1120
|
+
const stepConfig = {
|
|
1121
|
+
pmRoot: options.pmRoot,
|
|
1122
|
+
author: options.author,
|
|
1123
|
+
transactionId: options.transactionId,
|
|
1124
|
+
createCompensation
|
|
1125
|
+
};
|
|
1126
|
+
const committed = await commitWorkspaceTransaction({
|
|
1127
|
+
pmRoot: options.pmRoot,
|
|
1128
|
+
transactionId: options.transactionId,
|
|
1129
|
+
author: options.author,
|
|
1130
|
+
steps: mutations.map((mutation, index) => buildStepForMutation(stepConfig, mutation, index)),
|
|
1131
|
+
...options.lockTtlSeconds === void 0 ? {} : { lockTtlSeconds: options.lockTtlSeconds },
|
|
1132
|
+
...options.lockWaitMs === void 0 ? {} : { lockWaitMs: options.lockWaitMs },
|
|
1133
|
+
...options.onTransition === void 0 ? {} : { onTransition: options.onTransition }
|
|
1134
|
+
});
|
|
1135
|
+
const results = {};
|
|
1136
|
+
for (const [stepId, value] of Object.entries(committed.results)) {
|
|
1137
|
+
results[stepId] = value;
|
|
1138
|
+
}
|
|
1139
|
+
return {
|
|
1140
|
+
transactionId: committed.transactionId,
|
|
1141
|
+
status: "committed",
|
|
1142
|
+
recovered: committed.recovered,
|
|
1143
|
+
results
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
var _testOnlyItemTransaction = {
|
|
1147
|
+
buildCreateStep,
|
|
1148
|
+
bulkHistoryMarker,
|
|
1149
|
+
compensateByRestore,
|
|
1150
|
+
deriveStepId,
|
|
1151
|
+
isUpdateMarkerApplied,
|
|
1152
|
+
readItemSnapshot
|
|
1153
|
+
};
|
|
1154
|
+
|
|
592
1155
|
export {
|
|
593
1156
|
mergeHistoryStreams,
|
|
594
1157
|
mergeRelationshipEventStreams,
|
|
@@ -597,8 +1160,14 @@ export {
|
|
|
597
1160
|
mergeItemDocuments,
|
|
598
1161
|
mergeJsonDocuments,
|
|
599
1162
|
MERGE_DRIVER_ARTIFACT_VALUES,
|
|
600
|
-
runMergeDriver
|
|
1163
|
+
runMergeDriver,
|
|
1164
|
+
parseAtomicMutationControls,
|
|
1165
|
+
parseItemMutationBatch,
|
|
1166
|
+
itemDocumentToMutationOptions,
|
|
1167
|
+
validateItemMutationRows,
|
|
1168
|
+
commitItemMutations,
|
|
1169
|
+
_testOnlyItemTransaction
|
|
601
1170
|
};
|
|
602
|
-
//# sourceMappingURL=chunk-
|
|
1171
|
+
//# sourceMappingURL=chunk-ATBCUC7Y.js.map
|
|
603
1172
|
|
|
604
|
-
//# debugId=
|
|
1173
|
+
//# debugId=69f422b7-7912-5517-91f9-247ad58bd84c
|