@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeAddTypeInput
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WWNL6WMH.js";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_RUNTIME_STATUS_DEFINITIONS,
|
|
6
6
|
ITEM_METADATA_KEY_ORDER,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
RUNTIME_FIELD_TYPE_VALUES,
|
|
9
9
|
RUNTIME_STATUS_ROLE_VALUES,
|
|
10
10
|
evictOldestMemoEntries
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7AVEY74G.js";
|
|
12
12
|
|
|
13
13
|
// dist/core/schema/status-defs-file.js
|
|
14
14
|
!(function() {
|
|
@@ -547,4 +547,4 @@ export {
|
|
|
547
547
|
normalizeTypePresetName,
|
|
548
548
|
resolveTypePresetDefinitions
|
|
549
549
|
};
|
|
550
|
-
//# sourceMappingURL=chunk-
|
|
550
|
+
//# sourceMappingURL=chunk-UZLJOEAC.js.map
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
loadMutationCheckpoint,
|
|
4
4
|
restoreCheckpointItems,
|
|
5
5
|
writeMutationCheckpoint
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-72LQ4TKV.js";
|
|
7
7
|
import {
|
|
8
8
|
hasListFilters
|
|
9
9
|
} from "./chunk-KWYX6ZIR.js";
|
|
10
10
|
import {
|
|
11
11
|
runList
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RMF7LMBS.js";
|
|
13
13
|
import {
|
|
14
14
|
runClose
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AF2CCM5U.js";
|
|
16
16
|
import {
|
|
17
17
|
runRestore
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WUVEBQW6.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveAuthor
|
|
21
21
|
} from "./chunk-YRYYFGV3.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
listAllItemMetadataLight,
|
|
26
26
|
nowIso,
|
|
27
27
|
readSettings
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-IY6VZ3IW.js";
|
|
29
29
|
import {
|
|
30
30
|
EXIT_CODE,
|
|
31
31
|
PmCliError,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
resolvePmRoot,
|
|
36
36
|
resolveRuntimeStatusRegistry,
|
|
37
37
|
toErrorMessage
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-7AVEY74G.js";
|
|
39
39
|
|
|
40
40
|
// dist/cli/commands/close-many.js
|
|
41
41
|
!(function() {
|
|
@@ -404,4 +404,4 @@ export {
|
|
|
404
404
|
runCloseMany,
|
|
405
405
|
_testOnly
|
|
406
406
|
};
|
|
407
|
-
//# sourceMappingURL=chunk-
|
|
407
|
+
//# sourceMappingURL=chunk-VDO2JMD4.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
parseAnnotationTextInput,
|
|
5
5
|
resolveAnnotationInput,
|
|
6
6
|
runAnnotationCommand
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HB3P4M52.js";
|
|
8
8
|
|
|
9
9
|
// dist/cli/commands/notes.js
|
|
10
10
|
async function runNotes(id, options, global) {
|
|
@@ -30,6 +30,6 @@ async function runNotes(id, options, global) {
|
|
|
30
30
|
export {
|
|
31
31
|
runNotes
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-VQIHNHMJ.js.map
|
|
34
34
|
|
|
35
35
|
//# debugId=1401c7cc-d6e7-5373-a39e-084832b21dc6
|
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
extractPatchFailureContext,
|
|
5
5
|
readHistoryEntries,
|
|
6
6
|
replayHistoryToTarget,
|
|
7
|
+
resolveHistoryTarget
|
|
8
|
+
} from "./chunk-C3KD7U3T.js";
|
|
9
|
+
import {
|
|
7
10
|
replayToCanonicalItemDocument,
|
|
8
11
|
replayToItemDocument,
|
|
9
|
-
resolveHistoryTarget,
|
|
10
12
|
toReplayDocument
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-E6LEMURX.js";
|
|
12
14
|
import {
|
|
13
15
|
resolveAuthor
|
|
14
16
|
} from "./chunk-YRYYFGV3.js";
|
|
@@ -29,7 +31,7 @@ import {
|
|
|
29
31
|
recordAfterCommandAffectedItem,
|
|
30
32
|
runActiveOnWriteHooks,
|
|
31
33
|
serializeItemDocument
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-IY6VZ3IW.js";
|
|
33
35
|
import {
|
|
34
36
|
EXIT_CODE,
|
|
35
37
|
PmCliError,
|
|
@@ -41,7 +43,7 @@ import {
|
|
|
41
43
|
resolveItemTypeRegistry,
|
|
42
44
|
resolvePmRoot,
|
|
43
45
|
writeFileAtomic
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-7AVEY74G.js";
|
|
45
47
|
|
|
46
48
|
// dist/cli/commands/restore.js
|
|
47
49
|
import jsonPatch from "fast-json-patch";
|
|
@@ -315,4 +317,4 @@ export {
|
|
|
315
317
|
runRestore,
|
|
316
318
|
_testOnlyRestoreCommand
|
|
317
319
|
};
|
|
318
|
-
//# sourceMappingURL=chunk-
|
|
320
|
+
//# sourceMappingURL=chunk-WUVEBQW6.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../cli/commands/restore.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * @module cli/commands/restore\n *\n * Implements the pm restore command surface and its agent-facing runtime behavior.\n */\nimport jsonPatch from \"fast-json-patch\";\nimport fs from \"node:fs/promises\";\nimport {\n pathExists,\n readFileIfExists,\n writeFileAtomic,\n} from \"../../core/fs/fs-utils.js\";\nimport {\n appendHistoryEntry,\n createHistoryEntry,\n} from \"../../core/history/history.js\";\nimport {\n replayToCanonicalItemDocument,\n replayToItemDocument,\n toReplayDocument,\n} from \"../../core/history/replay.js\";\nimport {\n applyHistoryPatch,\n ensureMaterializedHistoryTarget as ensureMaterializedRestoreTarget,\n extractPatchFailureContext,\n readHistoryEntries,\n replayHistoryToTarget as replayToTarget,\n resolveHistoryTarget,\n} from \"../../sdk/history-read.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../../core/history/history-stream-policy.js\";\nimport { normalizeItemId, normalizeRawItemId } from \"../../core/item/id.js\";\nimport {\n canonicalDocument,\n serializeItemDocument,\n} from \"../../core/item/item-format.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { acquireLock } from \"../../core/lock/lock.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport {\n getActiveExtensionRegistrations,\n projectAfterCommandItemSnapshot,\n recordAfterCommandAffectedItem,\n runActiveOnWriteHooks,\n} from \"../../core/extensions/index.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport {\n getHistoryPath,\n getItemPath,\n getSettingsPath,\n resolvePmRoot,\n} from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type {\n HistoryEntry,\n HistoryPatchOp,\n ItemDocument,\n ItemMetadata,\n} from \"../../types/index.js\";\n\ninterface ResolvedRestoreSubject {\n id: string;\n historyPath: string;\n located: Awaited<ReturnType<typeof locateItem>>;\n historyPolicyWarnings: string[];\n}\n\ninterface RestoreCurrentState {\n document: ItemDocument;\n originalRaw: string | null;\n}\n\n/** Documents the restore command options payload exchanged by command, SDK, and package integrations. */\nexport interface RestoreCommandOptions {\n /** Value that configures or reports author for this contract. */\n author?: string;\n /** Human-readable explanation suitable for logs and agent-facing output. */\n message?: string;\n /** Value that configures or reports force for this contract. */\n force?: boolean;\n}\n\n/** Documents the restore result payload exchanged by command, SDK, and package integrations. */\nexport interface RestoreResult {\n /** Value that configures or reports item for this contract. */\n item: ItemMetadata;\n /** Value that configures or reports restored from for this contract. */\n restored_from: {\n kind: \"version\" | \"timestamp\";\n target: string;\n history_index: number;\n entry_ts: string;\n entry_op: string;\n };\n /** Value that configures or reports changed fields for this contract. */\n changed_fields: string[];\n /** Value that configures or reports warnings for this contract. */\n warnings: string[];\n}\n\n/** Resolve restore targets with the command's established wording and at-or-before timestamp semantics. */\nfunction ensureReplayTarget(target: string, history: readonly HistoryEntry[]) {\n return resolveHistoryTarget(target, history, {\n errorSubject: \"restore\",\n allowFutureTimestamp: true,\n });\n}\n\nfunction replayCurrentDocument(history: HistoryEntry[]): ItemDocument {\n const currentReplay = replayToTarget(history, history.length - 1);\n if (Object.keys(currentReplay.metadata).length === 0) {\n return {\n metadata: {} as ItemMetadata,\n body: currentReplay.body,\n };\n }\n return canonicalDocument(replayToItemDocument(currentReplay));\n}\n\nasync function resolveRestoreSubject(\n pmRoot: string,\n id: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n typeToFolder: Record<string, string>,\n): Promise<ResolvedRestoreSubject> {\n const located = await locateItem(\n pmRoot,\n id,\n settings.id_prefix,\n settings.item_format,\n typeToFolder,\n );\n if (located) {\n const historyPath = getHistoryPath(pmRoot, located.id);\n const historyPolicy = await enforceHistoryStreamPolicyForItem({\n pmRoot,\n settings,\n itemId: located.id,\n commandLabel: \"restore\",\n });\n return {\n id: located.id,\n historyPath,\n located,\n historyPolicyWarnings: historyPolicy.warnings,\n };\n }\n\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const rawNormalizedId = normalizeRawItemId(id);\n /* c8 ignore start -- raw-id fallback is covered by normalize-item-id utility tests. */\n const candidateIds =\n normalizedId === rawNormalizedId\n ? [normalizedId]\n : [normalizedId, rawNormalizedId];\n /* c8 ignore stop */\n for (const candidateId of candidateIds) {\n const historyPath = getHistoryPath(pmRoot, candidateId);\n if (await pathExists(historyPath)) {\n return {\n id: candidateId,\n historyPath,\n located: null,\n historyPolicyWarnings: [],\n };\n }\n }\n\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n}\n\nfunction changedFields(\n beforeDocument: ItemDocument,\n afterDocument: ItemDocument,\n): string[] {\n const beforeReplay = toReplayDocument(beforeDocument);\n const afterReplay = toReplayDocument(afterDocument);\n const patch = jsonPatch.compare(\n beforeReplay,\n afterReplay,\n ) as HistoryPatchOp[];\n const fields = new Set<string>();\n\n for (const op of patch) {\n if (op.path === \"/body\" || op.path.startsWith(\"/body/\")) {\n fields.add(\"body\");\n continue;\n }\n const segment = op.path\n .replace(/^\\/(?:metadata|front_matter)\\/?/, \"\")\n .split(\"/\")[0];\n fields.add(segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\"));\n }\n\n return Array.from(fields).sort((a, b) => a.localeCompare(b));\n}\n\nasync function loadRestoreStateUnderLock(params: {\n pmRoot: string;\n resolvedId: string;\n subject: ResolvedRestoreSubject;\n settings: Awaited<ReturnType<typeof readSettings>>;\n typeToFolder: Record<string, string>;\n historyRawBeforeLock: string | null;\n currentItemRawBeforeLock: string | null;\n}): Promise<{\n loadedItemUnderLock: Awaited<ReturnType<typeof readLocatedItem>> | null;\n existingItemPath: string | null;\n}> {\n const historyRawUnderLock = await readFileIfExists(\n params.subject.historyPath,\n );\n if (historyRawUnderLock !== params.historyRawBeforeLock) {\n throw new PmCliError(\n `History for ${params.resolvedId} changed while waiting for lock; retry restore.`,\n EXIT_CODE.CONFLICT,\n );\n }\n const locatedUnderLock = await locateItem(\n params.pmRoot,\n params.resolvedId,\n params.settings.id_prefix,\n params.settings.item_format,\n params.typeToFolder,\n );\n const loadedItemUnderLock = locatedUnderLock\n ? await readLocatedItem(locatedUnderLock, {\n schema: params.settings.schema,\n })\n : null;\n if ((loadedItemUnderLock?.raw ?? null) !== params.currentItemRawBeforeLock) {\n throw new PmCliError(\n `Item ${params.resolvedId} changed while waiting for lock; retry restore.`,\n EXIT_CODE.CONFLICT,\n );\n }\n return {\n loadedItemUnderLock,\n existingItemPath: locatedUnderLock?.itemPath ?? null,\n };\n}\n\nfunction resolveRestoreCurrentState(\n loadedItemUnderLock: Awaited<ReturnType<typeof readLocatedItem>> | null,\n history: HistoryEntry[],\n): RestoreCurrentState {\n if (loadedItemUnderLock) {\n return {\n document: loadedItemUnderLock.document,\n originalRaw: loadedItemUnderLock.raw,\n };\n }\n return { document: replayCurrentDocument(history), originalRaw: null };\n}\n\nfunction collectRestoreOwnershipWarnings(params: {\n document: ItemDocument;\n author: string;\n force: boolean | undefined;\n enforcement: \"strict\" | \"warn\" | \"none\";\n resolvedId: string;\n}): string[] {\n const assigned = params.document.metadata.assignee?.trim();\n const hasOwnershipConflict =\n assigned && assigned !== params.author && !params.force;\n if (!hasOwnershipConflict) {\n return [];\n }\n if (params.enforcement === \"strict\") {\n throw new PmCliError(\n `Item ${params.resolvedId} is assigned to ${assigned}. Use --force to override.`,\n EXIT_CODE.CONFLICT,\n );\n }\n return params.enforcement === \"warn\"\n ? [`ownership_warning:assignee_conflict:${params.resolvedId}:${assigned}`]\n : [];\n}\n\nasync function restorePreviousItemAfterHistoryFailure(params: {\n existingItemPath: string | null;\n resolvedOriginalRaw: string | null;\n restoredItemPath: string;\n}): Promise<void> {\n if (\n params.existingItemPath &&\n params.resolvedOriginalRaw !== null &&\n params.restoredItemPath !== params.existingItemPath\n ) {\n await writeFileAtomic(params.existingItemPath, params.resolvedOriginalRaw);\n await fs.rm(params.restoredItemPath, { force: true });\n return;\n }\n if (params.existingItemPath && params.resolvedOriginalRaw !== null) {\n await writeFileAtomic(params.existingItemPath, params.resolvedOriginalRaw);\n return;\n }\n await fs.rm(params.restoredItemPath, { force: true });\n}\n\nasync function runRestoreWriteHooks(params: {\n restoredItemPath: string;\n historyPath: string;\n before: ItemDocument;\n after: ItemDocument;\n}): Promise<string[]> {\n return [\n ...(await runActiveOnWriteHooks({\n path: params.restoredItemPath,\n scope: \"project\",\n op: \"restore\",\n item_id: params.after.metadata.id,\n item_type: params.after.metadata.type,\n before: params.before,\n after: params.after,\n changed_fields: [\"restored\"],\n })),\n ...(await runActiveOnWriteHooks({\n path: params.historyPath,\n scope: \"project\",\n op: \"restore:history\",\n item_id: params.after.metadata.id,\n item_type: params.after.metadata.type,\n before: params.before,\n after: params.after,\n changed_fields: [\"restored\"],\n })),\n ];\n}\n\n/** Implements run restore for the public runtime surface of this module. */\nexport async function runRestore(\n id: string,\n target: string,\n options: RestoreCommandOptions,\n global: GlobalOptions,\n): Promise<RestoreResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(\n `Tracker is not initialized at ${pmRoot}. Run pm init first.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(\n settings,\n getActiveExtensionRegistrations(),\n );\n const subject = await resolveRestoreSubject(\n pmRoot,\n id,\n settings,\n typeRegistry.type_to_folder,\n );\n const resolvedId = subject.id;\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const history = await readHistoryEntries(subject.historyPath, resolvedId);\n if (history.length === 0) {\n throw new PmCliError(\n `No history exists for ${resolvedId}; restore is unavailable.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n\n const resolvedTarget = ensureReplayTarget(target, history);\n const replayDocument = ensureMaterializedRestoreTarget(\n replayToTarget(history, resolvedTarget.historyIndex),\n resolvedTarget,\n );\n const restoredDocument = replayToCanonicalItemDocument(replayDocument, {\n schema: settings.schema,\n });\n\n if (restoredDocument.metadata.id !== resolvedId) {\n throw new PmCliError(\n `Restore target resolved to item ${restoredDocument.metadata.id}, expected ${resolvedId}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const loadedItemBeforeLock = subject.located\n ? await readLocatedItem(subject.located, { schema: settings.schema })\n : null;\n const currentItemRawBeforeLock = loadedItemBeforeLock?.raw ?? null;\n\n const author = resolveAuthor(options.author, settings.author_default);\n const releaseLock = await acquireLock(\n pmRoot,\n resolvedId,\n settings.locks.ttl_seconds,\n author,\n Boolean(options.force),\n settings.governance.force_required_for_stale_lock,\n settings.locks.wait_ms,\n );\n\n try {\n const { loadedItemUnderLock, existingItemPath } =\n await loadRestoreStateUnderLock({\n pmRoot,\n resolvedId,\n subject,\n settings,\n typeToFolder: typeRegistry.type_to_folder,\n historyRawBeforeLock,\n currentItemRawBeforeLock,\n });\n const itemFormat = \"toon\";\n const currentState = resolveRestoreCurrentState(\n loadedItemUnderLock,\n history,\n );\n const ownershipWarnings = collectRestoreOwnershipWarnings({\n document: currentState.document,\n author,\n force: options.force,\n enforcement: settings.governance.ownership_enforcement,\n resolvedId,\n });\n\n const serializedRestore = serializeItemDocument(restoredDocument, {\n format: itemFormat,\n schema: settings.schema,\n });\n /* c8 ignore next -- restored item path typing is exercised in restore integration workflows. */\n const restoredItemPath = getItemPath(\n pmRoot,\n restoredDocument.metadata.type,\n resolvedId,\n itemFormat,\n typeRegistry.type_to_folder,\n );\n await writeFileAtomic(restoredItemPath, serializedRestore);\n if (existingItemPath && restoredItemPath !== existingItemPath) {\n await fs.rm(existingItemPath);\n }\n\n const historyEntry = createHistoryEntry({\n nowIso: nowIso(),\n author,\n op: \"restore\",\n before: currentState.document,\n after: restoredDocument,\n message: options.message,\n });\n\n try {\n await appendHistoryEntry(subject.historyPath, historyEntry);\n } catch (error: unknown) {\n await restorePreviousItemAfterHistoryFailure({\n existingItemPath,\n resolvedOriginalRaw: currentState.originalRaw,\n restoredItemPath,\n });\n throw error;\n }\n const restoreChangedFields = changedFields(\n currentState.document,\n restoredDocument,\n );\n const hookWarnings = await runRestoreWriteHooks({\n restoredItemPath,\n historyPath: subject.historyPath,\n before: currentState.document,\n after: restoredDocument,\n });\n recordAfterCommandAffectedItem({\n id: restoredDocument.metadata.id,\n op: \"restore\",\n item_type: restoredDocument.metadata.type,\n previous_status: currentState.document.metadata.status,\n status: restoredDocument.metadata.status,\n previous: projectAfterCommandItemSnapshot(\n currentState.document.metadata,\n restoreChangedFields,\n ),\n current: projectAfterCommandItemSnapshot(\n restoredDocument.metadata,\n restoreChangedFields,\n ),\n changed_fields: restoreChangedFields,\n });\n\n const targetEntry = history[resolvedTarget.historyIndex];\n return {\n item: restoredDocument.metadata,\n restored_from: {\n kind: resolvedTarget.kind,\n target: resolvedTarget.raw,\n history_index: resolvedTarget.historyIndex + 1,\n entry_ts: targetEntry.ts,\n entry_op: targetEntry.op,\n },\n changed_fields: restoreChangedFields,\n warnings: [\n ...subject.historyPolicyWarnings,\n ...ownershipWarnings,\n ...hookWarnings,\n ],\n };\n } finally {\n await releaseLock();\n }\n}\n\n/** Public contract for test only restore command, shared by SDK and presentation-layer consumers. */\nexport const _testOnlyRestoreCommand = {\n applyHistoryPatch,\n changedFields,\n ensureMaterializedRestoreTarget,\n ensureReplayTarget,\n extractPatchFailureContext,\n replayCurrentDocument,\n replayToTarget,\n resolveRestoreSubject,\n};\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B,QAAQ,eAAe;QACvB,eAAe,eAAe,eAAe;QAC7C,UAAU,YAAY;QACtB,UAAU,YAAY;;MAExB,gBAAgB;MAChB,UAAU;QACR,GAAG,QAAQ;QACX,GAAG;QACH,GAAG;;;EAGT;AACE,UAAM,YAAW;EACnB;AACF;AAGO,IAAM,0BAA0B;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;",
|
|
6
6
|
"names": ["global"]
|
|
7
7
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EXECUTABLE_COMMAND_ALIASES,
|
|
3
3
|
resolveSubcommandFlagContractsForCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HEWM6CEN.js";
|
|
5
5
|
import {
|
|
6
6
|
writeStdout
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3VY6MIEO.js";
|
|
8
8
|
import {
|
|
9
9
|
EXIT_CODE,
|
|
10
10
|
PmCliError,
|
|
11
11
|
levenshteinDistanceWithinLimit
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7AVEY74G.js";
|
|
13
13
|
|
|
14
14
|
// dist/sdk/tracker-root-discovery.js
|
|
15
15
|
!(function() {
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
!(function() {
|
|
25
25
|
try {
|
|
26
26
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
27
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
27
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "bcccd920-dfec-51d8-8a76-f4d5c6499057");
|
|
28
28
|
} catch (e2) {
|
|
29
29
|
}
|
|
30
30
|
})();
|
|
@@ -857,4 +857,4 @@ export {
|
|
|
857
857
|
applyInvocationAuthorOverride,
|
|
858
858
|
createPmCliProgram
|
|
859
859
|
};
|
|
860
|
-
//# sourceMappingURL=chunk-
|
|
860
|
+
//# sourceMappingURL=chunk-WVA4DVNV.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../sdk/cli-bootstrap.ts", "../../../../../../../../sdk/invocation-author.ts", "../../../../../../../../sdk/cli-program.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @module sdk/cli-bootstrap\n *\n * Provides public bootstrap argument normalization for embedded CLI hosts.\n */\nimport {\n EXECUTABLE_COMMAND_ALIASES,\n resolveSubcommandFlagContractsForCommand,\n type CliFlagContract,\n} from \"./cli-contracts.js\";\nexport { EXECUTABLE_COMMAND_ALIASES };\nimport { levenshteinDistanceWithinLimit } from \"../core/shared/levenshtein.js\";\n\nconst GLOBAL_VALUE_CONSUMING_FLAGS = new Set<string>([\n \"--pm-path\",\n \"--path\",\n \"--author\",\n]);\n\n/** Whether a global value-consuming flag uses its inline `--flag=value` form. */\nconst isInlineGlobalValueToken = (token: string): boolean => {\n const equalsIndex = token.indexOf(\"=\");\n return (\n equalsIndex > 0 &&\n GLOBAL_VALUE_CONSUMING_FLAGS.has(token.slice(0, equalsIndex))\n );\n};\n\n/** Whether optional bootstrap author syntax consumes the following token. */\nconst consumesBootstrapAuthorValue = (next: string | undefined): boolean => {\n return typeof next === \"string\" && !next.startsWith(\"-\");\n};\n\nfunction parseBootstrapPathToken(\n token: string,\n next: string | undefined,\n): { consumed: number; pathValue?: string; preferred: boolean } | null {\n if (token === \"--path\" || token === \"--pm-path\") {\n if (typeof next === \"string\" && next.length > 0) {\n return {\n consumed: 2,\n pathValue: next,\n preferred: token === \"--pm-path\",\n };\n }\n return {\n consumed: 1,\n preferred: token === \"--pm-path\",\n };\n }\n\n const inlinePrefix = token.startsWith(\"--path=\")\n ? \"--path=\"\n : token.startsWith(\"--pm-path=\")\n ? \"--pm-path=\"\n : undefined;\n if (!inlinePrefix) {\n return null;\n }\n\n const value = token.slice(inlinePrefix.length);\n if (value.length > 0) {\n return {\n consumed: 1,\n pathValue: value,\n preferred: inlinePrefix === \"--pm-path=\",\n };\n }\n return {\n consumed: 1,\n preferred: inlinePrefix === \"--pm-path=\",\n };\n}\n\n/** Documents the bootstrap global options payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapGlobalOptions {\n /** Filesystem path used for path resolution. */\n path?: string;\n /** Value that configures or reports no extensions for this contract. */\n noExtensions: boolean;\n /** Value that configures or reports no pager for this contract. */\n noPager: boolean;\n /** Value that configures or reports json for this contract. */\n json: boolean;\n /** Value that configures or reports quiet for this contract. */\n quiet: boolean;\n /** Invocation-wide mutation author override. */\n author?: string;\n /** Whether `--author` was present without its required value. */\n authorMissingValue?: true;\n}\n\n/** Implements parse bootstrap global options for the public runtime surface of this module. */\nexport function parseBootstrapGlobalOptions(\n argv: string[],\n): BootstrapGlobalOptions {\n let legacyPathValue: string | undefined;\n let pmPathValue: string | undefined;\n let noExtensions = false;\n let noPager = false;\n let json = false;\n let quiet = false;\n let author: string | undefined;\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (token === \"--no-extensions\") {\n noExtensions = true;\n index += 1;\n continue;\n }\n if (token === \"--no-pager\") {\n noPager = true;\n index += 1;\n continue;\n }\n if (token === \"--json\") {\n json = true;\n index += 1;\n continue;\n }\n if (token === \"--quiet\") {\n quiet = true;\n index += 1;\n continue;\n }\n const parsedPath = parseBootstrapPathToken(token, argv[index + 1]);\n if (parsedPath) {\n if (parsedPath.pathValue !== undefined) {\n if (parsedPath.preferred) {\n pmPathValue = parsedPath.pathValue;\n } else {\n legacyPathValue = parsedPath.pathValue;\n }\n }\n index += parsedPath.consumed;\n continue;\n }\n if (token === \"--author\") {\n if (consumesBootstrapAuthorValue(argv[index + 1])) {\n author = argv[index + 1];\n index += 2;\n } else {\n author = \"\";\n index += 1;\n }\n continue;\n }\n if (token.startsWith(\"--author=\")) {\n author = token.slice(\"--author=\".length);\n index += 1;\n continue;\n }\n index += 1;\n }\n return {\n path: pmPathValue ?? legacyPathValue,\n noExtensions,\n noPager,\n json,\n quiet,\n ...(author === \"\"\n ? { authorMissingValue: true }\n : author !== undefined\n ? { author }\n : {}),\n };\n}\n\n/** Implements strip global bootstrap tokens for the public runtime surface of this module. */\nexport function stripGlobalBootstrapTokens(argv: string[]): string[] {\n const remaining: string[] = [];\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (\n token === \"--json\" ||\n token === \"--quiet\" ||\n token === \"--no-extensions\" ||\n token === \"--no-pager\" ||\n token === \"--profile\" ||\n token === \"--id-only\" ||\n token === \"--explain\"\n ) {\n index += 1;\n continue;\n }\n if (token === \"--author\") {\n index += consumesBootstrapAuthorValue(argv[index + 1]) ? 2 : 1;\n continue;\n }\n if (GLOBAL_VALUE_CONSUMING_FLAGS.has(token)) {\n index += 2;\n continue;\n }\n if (isInlineGlobalValueToken(token)) {\n index += 1;\n continue;\n }\n remaining.push(token);\n index += 1;\n }\n return remaining;\n}\n\n/** Documents the bootstrap help request payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapHelpRequest {\n /** Value that configures or reports requested for this contract. */\n requested: boolean;\n /** Value that configures or reports command path tokens for this contract. */\n commandPathTokens: string[];\n}\n\n/** Implements parse bootstrap help request for the public runtime surface of this module. */\nexport function parseBootstrapHelpRequest(\n argv: string[],\n): BootstrapHelpRequest {\n const stripped = stripGlobalBootstrapTokens(argv);\n const first = stripped[0]?.trim().toLowerCase();\n if (first === \"help\") {\n const commandPathTokens: string[] = [];\n for (let index = 1; index < stripped.length; index += 1) {\n const token = stripped[index];\n if (token.startsWith(\"-\")) {\n break;\n }\n commandPathTokens.push(token.trim().toLowerCase());\n }\n return {\n requested: true,\n commandPathTokens,\n };\n }\n\n const helpFlagIndex = stripped.findIndex(\n (token) => token === \"--help\" || token === \"-h\",\n );\n if (helpFlagIndex < 0) {\n return {\n requested: false,\n commandPathTokens: [],\n };\n }\n\n const commandPathTokens: string[] = [];\n for (const token of stripped) {\n if (token.startsWith(\"-\")) {\n break;\n }\n commandPathTokens.push(token.trim().toLowerCase());\n }\n return {\n requested: true,\n commandPathTokens,\n };\n}\n\n/**\n * Index of the command token in argv — the first non-flag token, skipping the\n * value-consuming/global bootstrap flags. Returns undefined when there is none\n * (bare invocation, only global flags, or a leading `--`). Single source of truth\n * for command-position scanning shared by {@link parseBootstrapCommandName} and the\n * command-alias rewrite so their precedence rules can never drift apart.\n */\nfunction findCommandTokenIndex(argv: string[]): number | undefined {\n for (let index = 0; index < argv.length; index += 1) {\n const token = argv[index];\n if (token === \"--\") {\n return undefined;\n }\n if (token === \"--author\") {\n index += consumesBootstrapAuthorValue(argv[index + 1]) ? 1 : 0;\n continue;\n }\n if (GLOBAL_VALUE_CONSUMING_FLAGS.has(token)) {\n index += 1;\n continue;\n }\n if (\n isInlineGlobalValueToken(token) ||\n token === \"--json\" ||\n token === \"--quiet\" ||\n token === \"--no-extensions\" ||\n token === \"--no-pager\" ||\n token === \"--profile\" ||\n token === \"--id-only\" ||\n token === \"--explain\"\n ) {\n continue;\n }\n if (token.startsWith(\"-\")) {\n continue;\n }\n return index;\n }\n return undefined;\n}\n\n/** Implements parse bootstrap command name for the public runtime surface of this module. */\nexport function parseBootstrapCommandName(argv: string[]): string | undefined {\n const index = findCommandTokenIndex(argv);\n return index === undefined ? undefined : argv[index].trim().toLowerCase();\n}\n\nfunction shouldDisablePagerForInvocation(\n argv: string[],\n bootstrapGlobal: BootstrapGlobalOptions,\n): boolean {\n if (bootstrapGlobal.noPager) {\n return true;\n }\n if (process.stdout.isTTY === true) {\n return false;\n }\n const helpRequest = parseBootstrapHelpRequest(argv);\n return helpRequest.requested;\n}\n\n/** Implements apply bootstrap pager policy for the public runtime surface of this module. */\nexport function applyBootstrapPagerPolicy(argv: string[]): () => void {\n const pagerEnvironmentKeys = [\n \"PAGER\",\n \"MANPAGER\",\n \"GIT_PAGER\",\n \"LESS\",\n ] as const;\n const previousValues = pagerEnvironmentKeys.map((key) => process.env[key]);\n const restore = (): void => {\n for (const [index, key] of pagerEnvironmentKeys.entries()) {\n const value = previousValues[index];\n if (value === undefined) {\n delete process.env[key];\n } else {\n process.env[key] = value;\n }\n }\n };\n const bootstrapGlobal = parseBootstrapGlobalOptions(argv);\n if (!shouldDisablePagerForInvocation(argv, bootstrapGlobal)) {\n return restore;\n }\n process.env.PAGER = \"cat\";\n process.env.MANPAGER = \"cat\";\n process.env.GIT_PAGER = \"cat\";\n if (\n typeof process.env.LESS !== \"string\" ||\n process.env.LESS.trim().length === 0\n ) {\n process.env.LESS = \"FRX\";\n }\n return restore;\n}\n\ntype ExtensionSubcommandAction =\n | \"init\"\n | \"install\"\n | \"uninstall\"\n | \"explore\"\n | \"manage\"\n | \"doctor\"\n | \"adopt\"\n | \"adopt-all\"\n | \"activate\"\n | \"deactivate\";\n\nconst EXTENSION_ACTION_SYNTAX_TOKENS = new Set<ExtensionSubcommandAction>([\n \"install\",\n \"uninstall\",\n \"explore\",\n \"manage\",\n \"doctor\",\n \"adopt\",\n \"adopt-all\",\n \"activate\",\n \"deactivate\",\n]);\n\n/** Implements normalize legacy extension action syntax for the public runtime surface of this module. */\nexport function normalizeLegacyExtensionActionSyntax(argv: string[]): string[] {\n const extensionIndex = findCommandTokenIndex(argv);\n if (extensionIndex === undefined || argv[extensionIndex] !== \"extension\") {\n return [...argv];\n }\n const actionToken = argv[extensionIndex + 1];\n if (!actionToken || actionToken.startsWith(\"-\")) {\n return [...argv];\n }\n if (\n !EXTENSION_ACTION_SYNTAX_TOKENS.has(\n actionToken as ExtensionSubcommandAction,\n )\n ) {\n return [...argv];\n }\n if (argv.includes(\"--help\") || argv.includes(\"-h\")) {\n return [...argv];\n }\n const forcedActionFlag = `--${actionToken}`;\n if (argv.includes(forcedActionFlag)) {\n return [...argv];\n }\n return [\n ...argv.slice(0, extensionIndex + 1),\n forcedActionFlag,\n ...argv.slice(extensionIndex + 2),\n ];\n}\n\ntype BootstrapNormalizationReason =\n | \"legacy_extension_action\"\n | \"command_alias\"\n | \"flag_alias\"\n | \"flag_typo\"\n | \"bare_key_value\"\n | \"list_merge\";\ntype BootstrapNormalizationConfidence = \"high\" | \"medium\";\n\n/** Executable command aliases: a leading command token here is rewritten to its canonical command BEFORE commander parses, so the alias actually runs instead of merely being suggested. These are the highest-frequency aliases real agents type (telemetry: `pm show <id>` alone is the single most common unknown-command) and each target takes the same positional/flags as the alias (with `--comment`/ `--note`/`--learning` flag-aliased to `--add` on the target command). Keeping this in one place means the alias is consistent across registration, commander dispatch, telemetry, and error handling — all of which read the normalized argv. */\n/**\n * Rewrite a leading command-alias token (e.g. `show` -> `get`) in place. Only the\n * command position is considered — the same token appearing later as an argument\n * (`pm get show`) is left untouched — and only when it is not preceded by `--` or a\n * value-consuming global flag, mirroring {@link parseBootstrapCommandName}.\n */\nfunction rewriteCommandAlias(\n argv: string[],\n trace: BootstrapNormalizationEvent[],\n): string[] {\n const index = findCommandTokenIndex(argv);\n if (index === undefined) {\n return argv;\n }\n const token = argv[index];\n const canonical = EXECUTABLE_COMMAND_ALIASES[token.trim().toLowerCase()];\n if (!canonical) {\n return argv;\n }\n const rewritten = [...argv];\n rewritten[index] = canonical;\n trace.push({\n from: token,\n to: [canonical],\n reason: \"command_alias\",\n confidence: \"high\",\n });\n return rewritten;\n}\n\n/** Documents the bootstrap normalization event payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapNormalizationEvent {\n /** Value that configures or reports from for this contract. */\n from: string;\n /** Value that configures or reports to for this contract. */\n to: string[];\n /** Value that configures or reports reason for this contract. */\n reason: BootstrapNormalizationReason;\n /** Value that configures or reports confidence for this contract. */\n confidence: BootstrapNormalizationConfidence;\n}\n\n/** Documents the bootstrap invocation normalization result payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapInvocationNormalizationResult {\n /** Value that configures or reports argv for this contract. */\n argv: string[];\n /** Value that configures or reports command name for this contract. */\n commandName: string | undefined;\n /** Value that configures or reports trace for this contract. */\n trace: BootstrapNormalizationEvent[];\n}\n\ninterface FlagLookup {\n canonicalByNormalized: Map<string, string | null>;\n canonicalByCompact: Map<string, string | null>;\n canonicalComparables: Array<{ canonicalFlag: string; comparable: string }>;\n listCanonicalFlags: Set<string>;\n}\n\nfunction normalizeFlagKeyToken(raw: string): string {\n const withoutPrefix = raw.replace(/^--?/, \"\");\n return withoutPrefix\n .replace(/_/g, \"-\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n}\n\nfunction toComparableFlagKey(raw: string): string {\n return normalizeFlagKeyToken(raw).replace(/-/g, \"\");\n}\n\nfunction markUnambiguousFlag(\n map: Map<string, string | null>,\n key: string,\n canonicalFlag: string,\n): void {\n const existing = map.get(key);\n if (existing === undefined) {\n map.set(key, canonicalFlag);\n return;\n }\n if (existing !== canonicalFlag) {\n map.set(key, null);\n }\n}\n\nfunction collectLongFlagCandidates(contract: CliFlagContract): string[] {\n const candidates: string[] = [];\n const pushLongFlag = (value: string | undefined): void => {\n if (typeof value !== \"string\") {\n return;\n }\n if (!value.startsWith(\"--\")) {\n return;\n }\n candidates.push(value);\n };\n pushLongFlag(contract.flag);\n for (const alias of contract.aliases ?? []) {\n pushLongFlag(alias);\n }\n return candidates;\n}\n\nfunction buildFlagLookup(\n commandName: string | undefined,\n contractsOverride?: CliFlagContract[],\n): FlagLookup {\n const contracts =\n contractsOverride ?? resolveSubcommandFlagContractsForCommand(commandName);\n const canonicalByNormalized = new Map<string, string | null>();\n const canonicalByCompact = new Map<string, string | null>();\n const canonicalComparablesMap = new Map<string, string>();\n const listCanonicalFlags = new Set<string>();\n for (const contract of contracts) {\n const longCandidates = collectLongFlagCandidates(contract);\n if (longCandidates.length === 0) {\n continue;\n }\n const canonicalFlag = `--${normalizeFlagKeyToken(longCandidates[0])}`;\n for (const candidate of longCandidates) {\n markUnambiguousFlag(\n canonicalByNormalized,\n normalizeFlagKeyToken(candidate),\n canonicalFlag,\n );\n markUnambiguousFlag(\n canonicalByCompact,\n toComparableFlagKey(candidate),\n canonicalFlag,\n );\n }\n const comparable = toComparableFlagKey(canonicalFlag);\n if (!canonicalComparablesMap.has(canonicalFlag)) {\n canonicalComparablesMap.set(canonicalFlag, comparable);\n }\n if (contract.list === true) {\n listCanonicalFlags.add(canonicalFlag);\n }\n }\n return {\n canonicalByNormalized,\n canonicalByCompact,\n canonicalComparables: [...canonicalComparablesMap.entries()].map(\n ([canonicalFlag, comparable]) => ({\n canonicalFlag,\n comparable,\n }),\n ),\n listCanonicalFlags,\n };\n}\n\nfunction resolveCanonicalFlag(\n rawKey: string,\n lookup: FlagLookup,\n): {\n flag: string;\n reason: \"flag_alias\" | \"flag_typo\";\n confidence: BootstrapNormalizationConfidence;\n} | null {\n const normalizedKey = normalizeFlagKeyToken(rawKey);\n const direct = lookup.canonicalByNormalized.get(normalizedKey);\n if (typeof direct === \"string\") {\n return {\n flag: direct,\n reason: \"flag_alias\",\n confidence: \"high\",\n };\n }\n const comparableKey = normalizedKey.replace(/-/g, \"\");\n const compactMatch = lookup.canonicalByCompact.get(comparableKey);\n if (typeof compactMatch === \"string\") {\n return {\n flag: compactMatch,\n reason: \"flag_alias\",\n confidence: \"high\",\n };\n }\n const maxDistance = comparableKey.length >= 8 ? 2 : 1;\n let bestDistance = Number.POSITIVE_INFINITY;\n let bestFlag: string | undefined;\n let tied = false;\n for (const candidate of lookup.canonicalComparables) {\n const distance = levenshteinDistanceWithinLimit(\n comparableKey,\n candidate.comparable,\n maxDistance,\n );\n if (distance === null) {\n continue;\n }\n if (distance < bestDistance) {\n bestDistance = distance;\n bestFlag = candidate.canonicalFlag;\n tied = false;\n continue;\n }\n if (distance === bestDistance && bestFlag !== candidate.canonicalFlag) {\n tied = true;\n }\n }\n if (\n !bestFlag ||\n tied ||\n !Number.isFinite(bestDistance) ||\n bestDistance <= 0\n ) {\n return null;\n }\n return {\n flag: bestFlag,\n reason: \"flag_typo\",\n confidence: bestDistance >= 2 ? \"medium\" : \"high\",\n };\n}\n\n/** Implements list alias plural keys for the public runtime surface of this module. */\nexport function listAliasPluralKeys(normalizedKey: string): string[] {\n const candidates = [`${normalizedKey}s`];\n if (normalizedKey.endsWith(\"y\") && normalizedKey.length > 1) {\n candidates.push(`${normalizedKey.slice(0, -1)}ies`);\n }\n return candidates;\n}\n\nfunction parseBareKeyValueToken(\n token: string,\n preserve = false,\n): { key: string; value: string } | null {\n if (preserve || token.includes(\"://\")) {\n return null;\n }\n const match = token.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);\n if (!match) {\n return null;\n }\n const key = match[1];\n const value = match[3];\n if (value.length === 0) {\n return null;\n }\n return {\n key,\n value,\n };\n}\n\nfunction normalizeLongOptionToken(\n token: string,\n lookup: FlagLookup,\n preserve = false,\n): { tokens: string[]; event?: BootstrapNormalizationEvent } {\n if (preserve || !token.startsWith(\"--\")) {\n return { tokens: [token] };\n }\n const equalsIndex = token.indexOf(\"=\");\n const key = equalsIndex >= 0 ? token.slice(0, equalsIndex) : token;\n const inlineValue =\n equalsIndex >= 0 ? token.slice(equalsIndex + 1) : undefined;\n const resolution = resolveCanonicalFlag(key, lookup);\n if (!resolution) {\n return { tokens: [token] };\n }\n const normalizedToken =\n inlineValue === undefined\n ? resolution.flag\n : `${resolution.flag}=${inlineValue}`;\n if (normalizedToken === token) {\n return { tokens: [token] };\n }\n return {\n tokens: [normalizedToken],\n event: {\n from: token,\n to: [normalizedToken],\n reason: resolution.reason,\n confidence: resolution.confidence,\n },\n };\n}\n\n/** Locate global path-value tokens that normalization must preserve literally. */\nfunction collectBootstrapPathValueIndices(argv: string[]): Set<number> {\n const indices = new Set<number>();\n let expectsValue = false;\n for (let index = 0; index < argv.length; index += 1) {\n if (expectsValue) {\n indices.add(index);\n expectsValue = false;\n continue;\n }\n const token = argv[index];\n expectsValue = token === \"--path\" || token === \"--pm-path\";\n }\n return indices;\n}\n\n// Global option flags whose value may legitimately begin with \"--\" (commander\n// accepts such values). Their value token must not be reinterpreted as a list\n// flag during coalescing. `--pm-path <dir>` and its legacy `--path <dir>`\n// alias are the documented cases; other globals\n// (--json/--quiet/--no-extensions/--no-pager/--profile) are boolean.\nfunction splitCanonicalListToken(\n token: string,\n): { flag: string; inlineValue?: string } | null {\n if (!token.startsWith(\"--\")) {\n return null;\n }\n const equalsIndex = token.indexOf(\"=\");\n if (equalsIndex < 0) {\n return { flag: token };\n }\n return {\n flag: token.slice(0, equalsIndex),\n inlineValue: token.slice(equalsIndex + 1),\n };\n}\n\ninterface ListFlagSlot {\n outputIndex: number;\n originalTokens: string[];\n values: string[];\n occurrences: number;\n}\n\ninterface ListFlagOccurrence {\n originalTokens: string[];\n value: string | undefined;\n consumed: number;\n}\n\ninterface ValuedListFlagOccurrence {\n originalTokens: string[];\n value: string;\n}\n\nfunction copyValueConsumingFlag(\n argv: string[],\n index: number,\n result: (string | null)[],\n): number {\n result.push(argv[index]);\n const next = argv[index + 1];\n if (typeof next === \"string\" && next !== \"--\") {\n result.push(next);\n return index + 2;\n }\n return index + 1;\n}\n\nfunction readListFlagOccurrence(\n argv: string[],\n index: number,\n parsed: { flag: string; inlineValue?: string },\n multiValueListFlags: Set<string>,\n): ListFlagOccurrence {\n if (parsed.inlineValue !== undefined) {\n return {\n originalTokens: [argv[index]],\n value: parsed.inlineValue,\n consumed: 1,\n };\n }\n\n const values: string[] = [];\n let valueIndex = index + 1;\n while (\n valueIndex < argv.length &&\n argv[valueIndex] !== \"--\" &&\n !argv[valueIndex].startsWith(\"-\") &&\n (values.length === 0 || multiValueListFlags.has(parsed.flag))\n ) {\n values.push(argv[valueIndex]);\n valueIndex += 1;\n }\n\n const consumed = values.length === 0 ? 1 : 1 + values.length;\n return {\n originalTokens: argv.slice(index, index + consumed),\n value: values.length === 0 ? undefined : values.join(\",\"),\n consumed,\n };\n}\n\nfunction recordListFlagOccurrence(\n slots: Map<string, ListFlagSlot>,\n result: (string | null)[],\n flag: string,\n occurrence: ValuedListFlagOccurrence,\n): void {\n const existing = slots.get(flag);\n if (existing) {\n existing.values.push(occurrence.value);\n existing.occurrences += 1;\n return;\n }\n\n slots.set(flag, {\n outputIndex: result.length,\n originalTokens: occurrence.originalTokens,\n values: [occurrence.value],\n occurrences: 1,\n });\n // Reserve the anchor position; finalized after the walk so we know the full\n // merged value or can restore the original token form for single uses.\n result.push(null);\n}\n\nfunction buildListFlagCoalescingSplices(\n slots: Map<string, ListFlagSlot>,\n multiValueListFlags: Set<string>,\n): {\n events: BootstrapNormalizationEvent[];\n splices: Array<{ outputIndex: number; tokens: string[] }>;\n} {\n const events: BootstrapNormalizationEvent[] = [];\n const splices: Array<{ outputIndex: number; tokens: string[] }> = [];\n for (const [flag, slot] of slots) {\n const shouldMerge =\n slot.occurrences >= 2 ||\n (multiValueListFlags.has(flag) && slot.originalTokens.length > 2);\n if (!shouldMerge) {\n splices.push({\n outputIndex: slot.outputIndex,\n tokens: slot.originalTokens,\n });\n continue;\n }\n const mergedToken = `${flag}=${slot.values.join(\",\")}`;\n splices.push({ outputIndex: slot.outputIndex, tokens: [mergedToken] });\n events.push({\n from: `${flag} (x${slot.occurrences})`,\n to: [mergedToken],\n reason: \"list_merge\",\n confidence: \"high\",\n });\n }\n return { events, splices };\n}\n\nfunction applyListFlagSplices(\n result: (string | null)[],\n splices: Array<{ outputIndex: number; tokens: string[] }>,\n): void {\n splices.sort((a, b) => b.outputIndex - a.outputIndex);\n for (const splice of splices) {\n result.splice(splice.outputIndex, 1, ...splice.tokens);\n }\n}\n\n/**\n * Coalesce repeated occurrences of comma-separated list flags into a single\n * `--flag=v1,v2,v3` token anchored at the FIRST occurrence. Without this,\n * Commander treats these flags as scalars and silently keeps only the last\n * value (data loss). Both `--flag value` and `--flag=value` forms are merged;\n * a value-less occurrence is preserved untouched, and a `--` terminator stops\n * coalescing (remainder is passed through verbatim).\n *\n * `valueConsumingFlags` lists option flags (e.g. global `--path`) whose value\n * may itself begin with `--`. Their value token is emitted verbatim so a\n * list-flag-looking value (`--path --tags`) is never reinterpreted as a flag\n * nor allowed to swallow the following command/positional token.\n */\nexport function coalesceRepeatedListFlags(\n argv: string[],\n listFlags: Set<string>,\n valueConsumingFlags: Set<string> = new Set(),\n multiValueListFlags: Set<string> = new Set(),\n): { argv: string[]; events: BootstrapNormalizationEvent[] } {\n if (listFlags.size === 0) {\n return { argv: [...argv], events: [] };\n }\n\n const result: (string | null)[] = [];\n const slots = new Map<string, ListFlagSlot>();\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n result.push(...argv.slice(index));\n break;\n }\n // A value-consuming option in space form owns the next token as its value,\n // even when that value begins with \"--\". Emit both verbatim so the value is\n // never misread as a list-flag occurrence.\n if (valueConsumingFlags.has(token)) {\n index = copyValueConsumingFlag(argv, index, result);\n continue;\n }\n const parsed = splitCanonicalListToken(token);\n if (!parsed || !listFlags.has(parsed.flag)) {\n result.push(token);\n index += 1;\n continue;\n }\n\n const occurrence = readListFlagOccurrence(\n argv,\n index,\n parsed,\n multiValueListFlags,\n );\n if (occurrence.value === undefined) {\n // Value-less occurrence: leave untouched, do not coalesce.\n result.push(token);\n index += occurrence.consumed;\n continue;\n }\n\n recordListFlagOccurrence(slots, result, parsed.flag, {\n originalTokens: occurrence.originalTokens,\n value: occurrence.value,\n });\n index += occurrence.consumed;\n }\n\n // Apply anchor splices from the end so earlier indices stay valid when a\n // single-occurrence anchor expands back into two tokens.\n const { events, splices } = buildListFlagCoalescingSplices(\n slots,\n multiValueListFlags,\n );\n applyListFlagSplices(result, splices);\n\n return { argv: result as string[], events };\n}\n\n/** Linked-test entry keys accepted in the two-token form `pm test <id> --add command \"npm test -- parser\"` (GH-191). Only entry-identity keys are merged: `command`/`cmd` name the shell command and `path` names the test file, so a single key=value entry is meaningful for them. Other structured keys (scope, env_set, assertions, ...) cannot form a valid standalone entry and are left for the normal parser to reject. `--remove` matches existing entries by `command=`/`path=` only, so `cmd` is excluded there. Key names mirror STRUCTURED_LINKED_TEST_KEYS in src/cli/commands/linked-test-entry.ts. */\nconst LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG: ReadonlyMap<\n string,\n ReadonlySet<string>\n> = new Map([\n [\"--add\", new Set([\"command\", \"cmd\", \"path\"])],\n [\"--remove\", new Set([\"command\", \"path\"])],\n]);\n\n/** Sandbox-safe linked-test commands legitimately start with env assignments (`PM_PATH=... PM_GLOBAL_PATH=... vitest run -- parser`), which look like bare key=value settings tokens. When the two preceding tokens are a linked-test flag plus a bare two-token key (`--add command <value>`), the value must be left intact for mergeLinkedTestTwoTokenEntries instead of being rewritten into a canonical flag (e.g. PM_PATH= -> --pm-path), which would silently corrupt the command into `--add command --pm-path ...`. */\nfunction isLinkedTestTwoTokenValuePosition(\n commandName: string | undefined,\n emittedTokens: readonly string[],\n): boolean {\n if (commandName !== \"test\" || emittedTokens.length < 2) {\n return false;\n }\n const key = emittedTokens[emittedTokens.length - 1];\n const flag = emittedTokens[emittedTokens.length - 2];\n const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(flag);\n return keys !== undefined && keys.has(key);\n}\n\nfunction shouldPreserveBareKeyValueToken(\n commandName: string | undefined,\n emittedTokens: readonly string[],\n): boolean {\n return (\n commandName === \"search\" ||\n isLinkedTestTwoTokenValuePosition(commandName, emittedTokens)\n );\n}\n\n/** Accept the two-token linked-test form `pm test <id> --add command \"npm test -- parser\"` by merging the bare key token and its single quoted value into the documented `--add command=...` shape. Without this merge Commander binds the bare key as the option value and treats the quoted command as an excess positional, failing with \"too many arguments\" (GH-191). The merge only fires when EXACTLY ONE non-flag token follows the bare key, i.e. the value was quoted into one shell token — an unquoted multi-token value stays ambiguous (it may swallow the item id), still fails fast, and is routed to targeted quoting guidance by the commander error classifier instead. */\nexport function mergeLinkedTestTwoTokenEntries(\n argv: string[],\n commandName: string | undefined,\n trace: BootstrapNormalizationEvent[],\n): string[] {\n if (commandName !== \"test\") {\n return argv;\n }\n const result: string[] = [];\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n result.push(...argv.slice(index));\n return result;\n }\n const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(token);\n const key = keys ? argv[index + 1] : undefined;\n if (!keys || typeof key !== \"string\" || !keys.has(key)) {\n result.push(token);\n index += 1;\n continue;\n }\n let runEnd = index + 2;\n while (runEnd < argv.length && !argv[runEnd].startsWith(\"-\")) {\n runEnd += 1;\n }\n if (runEnd - (index + 2) !== 1) {\n result.push(token);\n index += 1;\n continue;\n }\n const value = argv[index + 2];\n const mergedValue = `${key}=${value}`;\n result.push(token, mergedValue);\n trace.push({\n from: `${token} ${key} ${value}`,\n to: [token, mergedValue],\n reason: \"bare_key_value\",\n confidence: \"high\",\n });\n index += 3;\n }\n return result;\n}\n\n/** Implements normalize bootstrap invocation for the public runtime surface of this module. */\nexport function normalizeBootstrapInvocation(\n argv: string[],\n): BootstrapInvocationNormalizationResult {\n const trace: BootstrapNormalizationEvent[] = [];\n const legacyNormalized = normalizeLegacyExtensionActionSyntax(argv);\n if (\n legacyNormalized.length !== argv.length ||\n legacyNormalized.some((token, index) => token !== argv[index])\n ) {\n trace.push({\n from: argv.join(\" \"),\n to: [...legacyNormalized],\n reason: \"legacy_extension_action\",\n confidence: \"high\",\n });\n }\n const aliasNormalized = rewriteCommandAlias(legacyNormalized, trace);\n const commandName = parseBootstrapCommandName(aliasNormalized);\n const commandPathName = parseBootstrapCommandPathName(aliasNormalized);\n const lookup = buildFlagLookup(commandPathName ?? commandName);\n const normalizedArgv: string[] = [];\n const pathValueIndices = collectBootstrapPathValueIndices(aliasNormalized);\n for (let index = 0; index < aliasNormalized.length; index += 1) {\n const token = aliasNormalized[index];\n if (token === \"--\") {\n normalizedArgv.push(...aliasNormalized.slice(index));\n break;\n }\n const preserveCurrentToken = pathValueIndices.has(index);\n const previous = normalizedArgv[normalizedArgv.length - 1];\n if (token.startsWith(\"--\")) {\n const normalizedToken = normalizeLongOptionToken(\n token,\n lookup,\n preserveCurrentToken,\n );\n normalizedArgv.push(...normalizedToken.tokens);\n if (normalizedToken.event) {\n trace.push(normalizedToken.event);\n }\n continue;\n }\n const bareKeyValue = parseBareKeyValueToken(token, preserveCurrentToken);\n if (\n bareKeyValue &&\n !(typeof previous === \"string\" && previous.startsWith(\"-\")) &&\n !shouldPreserveBareKeyValueToken(commandName, normalizedArgv)\n ) {\n const resolution = resolveCanonicalFlag(bareKeyValue.key, lookup);\n if (resolution) {\n const replacement = [resolution.flag, bareKeyValue.value];\n normalizedArgv.push(...replacement);\n trace.push({\n from: token,\n to: replacement,\n reason: \"bare_key_value\",\n confidence: resolution.confidence,\n });\n continue;\n }\n }\n normalizedArgv.push(token);\n }\n const linkedTestNormalized = mergeLinkedTestTwoTokenEntries(\n normalizedArgv,\n commandName,\n trace,\n );\n const coalesced = coalesceRepeatedListFlags(\n linkedTestNormalized,\n lookup.listCanonicalFlags,\n GLOBAL_VALUE_CONSUMING_FLAGS,\n commandName === \"create\" ? new Set([\"--tags\"]) : new Set(),\n );\n for (const event of coalesced.events) {\n trace.push(event);\n }\n return {\n argv: coalesced.argv,\n commandName,\n trace,\n };\n}\n\nfunction parseBootstrapCommandPathName(argv: string[]): string | undefined {\n const stripped = stripGlobalBootstrapTokens(argv);\n const first = stripped[0]?.trim().toLowerCase();\n const second = stripped[1]?.trim().toLowerCase();\n if (\n (first === \"extension\" || first === \"package\" || first === \"packages\") &&\n typeof second === \"string\" &&\n second.length > 0 &&\n !second.startsWith(\"-\")\n ) {\n return `${first} ${second}`;\n }\n return first;\n}\n\n/** Implements parse bootstrap type value for the public runtime surface of this module. */\nexport function parseBootstrapTypeValue(argv: string[]): string | undefined {\n for (let index = 0; index < argv.length; index += 1) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (token === \"--type\") {\n const candidate = argv[index + 1];\n if (typeof candidate === \"string\" && candidate.trim().length > 0) {\n return candidate.trim();\n }\n continue;\n }\n if (token.startsWith(\"--type=\")) {\n const candidate = token.slice(\"--type=\".length).trim();\n if (candidate.length > 0) {\n return candidate;\n }\n }\n }\n return undefined;\n}\n\n/** Public contract for test only, shared by SDK and presentation-layer consumers. */\nexport const _testOnly = {\n buildFlagLookup,\n collectBootstrapPathValueIndices,\n collectLongFlagCandidates,\n markUnambiguousFlag,\n normalizeLongOptionToken,\n resolveCanonicalFlag,\n};\n", "/**\n * @module sdk/invocation-author\n *\n * Safely scopes invocation-wide mutation authors for one-shot and embedded CLI hosts.\n */\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\n\n/** Apply an optional author override and return an idempotent environment restorer. */\nexport function applyInvocationAuthorOverride(\n author: string | undefined,\n): () => void {\n if (author === undefined) {\n return () => {};\n }\n const normalizedAuthor = author.trim();\n if (normalizedAuthor.length === 0) {\n throw new PmCliError(\n \"--author requires a non-empty value.\",\n EXIT_CODE.USAGE,\n {\n code: \"missing_required_argument\",\n nextSteps: [\"Pass an explicit author identifier with --author <id>.\"],\n },\n );\n }\n const previousAuthor = process.env.PM_AUTHOR;\n process.env.PM_AUTHOR = normalizedAuthor;\n let restored = false;\n return () => {\n if (restored) {\n return;\n }\n restored = true;\n if (previousAuthor === undefined) {\n delete process.env.PM_AUTHOR;\n } else {\n process.env.PM_AUTHOR = previousAuthor;\n }\n };\n}\n", "/**\n * @module sdk/cli-program\n *\n * Builds the reusable Commander root that embeds pm's universal global contracts.\n */\nimport { Command } from \"commander\";\nimport { writeStdout } from \"../core/output/output.js\";\n\n/** Create a fresh pm root program suitable for one-shot CLI or embedded hosts. */\nexport function createPmCliProgram(version: string): Command {\n return new Command()\n .name(\"pm\")\n .description(\n \"Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.\",\n )\n .version(version)\n .showHelpAfterError(false)\n .allowExcessArguments(false)\n .allowUnknownOption(false)\n .configureOutput({\n writeOut: (value) => {\n writeStdout(value);\n },\n writeErr: () => {},\n })\n .option(\"--json\", \"Output JSON instead of TOON\")\n .option(\"--quiet\", \"Suppress stdout output\")\n .option(\n \"--no-changed-fields\",\n \"Omit the changed_fields array from mutation output (keeps changed_field_count)\",\n )\n .option(\n \"--id-only\",\n \"Print only id and status for single-item mutation output\",\n )\n .option(\n \"--pm-path <dir>\",\n \"Explicit tracker storage path for this command (preferred over --path)\",\n )\n .option(\n \"--path <dir>\",\n \"Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd\",\n )\n .option(\"--no-extensions\", \"Disable extension loading\")\n .option(\"--no-pager\", \"Disable pager integration for help and long output\")\n .option(\n \"--explain\",\n \"Render extended rationale and examples in help output\",\n )\n .option(\"--profile\", \"Print deterministic timing diagnostics\")\n .option(\"--author <id>\", \"Override mutation author for this invocation\")\n .exitOverride();\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * @module sdk/cli-bootstrap\n *\n * Provides public bootstrap argument normalization for embedded CLI hosts.\n */\nimport {\n EXECUTABLE_COMMAND_ALIASES,\n resolveSubcommandFlagContractsForCommand,\n type CliFlagContract,\n} from \"./cli-contracts.js\";\nexport { EXECUTABLE_COMMAND_ALIASES };\nimport { levenshteinDistanceWithinLimit } from \"../core/shared/levenshtein.js\";\n\nconst GLOBAL_VALUE_CONSUMING_FLAGS = new Set<string>([\n \"--pm-path\",\n \"--path\",\n \"--author\",\n]);\n\n/** Whether a global value-consuming flag uses its inline `--flag=value` form. */\nconst isInlineGlobalValueToken = (token: string): boolean => {\n const equalsIndex = token.indexOf(\"=\");\n return (\n equalsIndex > 0 &&\n GLOBAL_VALUE_CONSUMING_FLAGS.has(token.slice(0, equalsIndex))\n );\n};\n\n/** Whether optional bootstrap author syntax consumes the following token. */\nconst consumesBootstrapAuthorValue = (next: string | undefined): boolean => {\n return typeof next === \"string\" && !next.startsWith(\"-\");\n};\n\nfunction parseBootstrapPathToken(\n token: string,\n next: string | undefined,\n): { consumed: number; pathValue?: string; preferred: boolean } | null {\n if (token === \"--path\" || token === \"--pm-path\") {\n if (typeof next === \"string\" && next.length > 0) {\n return {\n consumed: 2,\n pathValue: next,\n preferred: token === \"--pm-path\",\n };\n }\n return {\n consumed: 1,\n preferred: token === \"--pm-path\",\n };\n }\n\n const inlinePrefix = token.startsWith(\"--path=\")\n ? \"--path=\"\n : token.startsWith(\"--pm-path=\")\n ? \"--pm-path=\"\n : undefined;\n if (!inlinePrefix) {\n return null;\n }\n\n const value = token.slice(inlinePrefix.length);\n if (value.length > 0) {\n return {\n consumed: 1,\n pathValue: value,\n preferred: inlinePrefix === \"--pm-path=\",\n };\n }\n return {\n consumed: 1,\n preferred: inlinePrefix === \"--pm-path=\",\n };\n}\n\n/** Documents the bootstrap global options payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapGlobalOptions {\n /** Filesystem path used for path resolution. */\n path?: string;\n /** Value that configures or reports no extensions for this contract. */\n noExtensions: boolean;\n /** Value that configures or reports no pager for this contract. */\n noPager: boolean;\n /** Value that configures or reports json for this contract. */\n json: boolean;\n /** Value that configures or reports quiet for this contract. */\n quiet: boolean;\n /** Invocation-wide mutation author override. */\n author?: string;\n /** Whether `--author` was present without its required value. */\n authorMissingValue?: true;\n}\n\n/** Implements parse bootstrap global options for the public runtime surface of this module. */\nexport function parseBootstrapGlobalOptions(\n argv: string[],\n): BootstrapGlobalOptions {\n let legacyPathValue: string | undefined;\n let pmPathValue: string | undefined;\n let noExtensions = false;\n let noPager = false;\n let json = false;\n let quiet = false;\n let author: string | undefined;\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (token === \"--no-extensions\") {\n noExtensions = true;\n index += 1;\n continue;\n }\n if (token === \"--no-pager\") {\n noPager = true;\n index += 1;\n continue;\n }\n if (token === \"--json\") {\n json = true;\n index += 1;\n continue;\n }\n if (token === \"--quiet\") {\n quiet = true;\n index += 1;\n continue;\n }\n const parsedPath = parseBootstrapPathToken(token, argv[index + 1]);\n if (parsedPath) {\n if (parsedPath.pathValue !== undefined) {\n if (parsedPath.preferred) {\n pmPathValue = parsedPath.pathValue;\n } else {\n legacyPathValue = parsedPath.pathValue;\n }\n }\n index += parsedPath.consumed;\n continue;\n }\n if (token === \"--author\") {\n if (consumesBootstrapAuthorValue(argv[index + 1])) {\n author = argv[index + 1];\n index += 2;\n } else {\n author = \"\";\n index += 1;\n }\n continue;\n }\n if (token.startsWith(\"--author=\")) {\n author = token.slice(\"--author=\".length);\n index += 1;\n continue;\n }\n index += 1;\n }\n return {\n path: pmPathValue ?? legacyPathValue,\n noExtensions,\n noPager,\n json,\n quiet,\n ...(author === \"\"\n ? { authorMissingValue: true }\n : author !== undefined\n ? { author }\n : {}),\n };\n}\n\n/** Implements strip global bootstrap tokens for the public runtime surface of this module. */\nexport function stripGlobalBootstrapTokens(argv: string[]): string[] {\n const remaining: string[] = [];\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (\n token === \"--json\" ||\n token === \"--quiet\" ||\n token === \"--no-extensions\" ||\n token === \"--no-pager\" ||\n token === \"--profile\" ||\n token === \"--id-only\" ||\n token === \"--explain\"\n ) {\n index += 1;\n continue;\n }\n if (token === \"--author\") {\n index += consumesBootstrapAuthorValue(argv[index + 1]) ? 2 : 1;\n continue;\n }\n if (GLOBAL_VALUE_CONSUMING_FLAGS.has(token)) {\n index += 2;\n continue;\n }\n if (isInlineGlobalValueToken(token)) {\n index += 1;\n continue;\n }\n remaining.push(token);\n index += 1;\n }\n return remaining;\n}\n\n/** Documents the bootstrap help request payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapHelpRequest {\n /** Value that configures or reports requested for this contract. */\n requested: boolean;\n /** Value that configures or reports command path tokens for this contract. */\n commandPathTokens: string[];\n}\n\n/** Implements parse bootstrap help request for the public runtime surface of this module. */\nexport function parseBootstrapHelpRequest(\n argv: string[],\n): BootstrapHelpRequest {\n const stripped = stripGlobalBootstrapTokens(argv);\n const first = stripped[0]?.trim().toLowerCase();\n if (first === \"help\") {\n const commandPathTokens: string[] = [];\n for (let index = 1; index < stripped.length; index += 1) {\n const token = stripped[index];\n if (token.startsWith(\"-\")) {\n break;\n }\n commandPathTokens.push(token.trim().toLowerCase());\n }\n return {\n requested: true,\n commandPathTokens,\n };\n }\n\n const helpFlagIndex = stripped.findIndex(\n (token) => token === \"--help\" || token === \"-h\",\n );\n if (helpFlagIndex < 0) {\n return {\n requested: false,\n commandPathTokens: [],\n };\n }\n\n const commandPathTokens: string[] = [];\n for (const token of stripped) {\n if (token.startsWith(\"-\")) {\n break;\n }\n commandPathTokens.push(token.trim().toLowerCase());\n }\n return {\n requested: true,\n commandPathTokens,\n };\n}\n\n/**\n * Index of the command token in argv — the first non-flag token, skipping the\n * value-consuming/global bootstrap flags. Returns undefined when there is none\n * (bare invocation, only global flags, or a leading `--`). Single source of truth\n * for command-position scanning shared by {@link parseBootstrapCommandName} and the\n * command-alias rewrite so their precedence rules can never drift apart.\n */\nfunction findCommandTokenIndex(argv: string[]): number | undefined {\n for (let index = 0; index < argv.length; index += 1) {\n const token = argv[index];\n if (token === \"--\") {\n return undefined;\n }\n if (token === \"--author\") {\n index += consumesBootstrapAuthorValue(argv[index + 1]) ? 1 : 0;\n continue;\n }\n if (GLOBAL_VALUE_CONSUMING_FLAGS.has(token)) {\n index += 1;\n continue;\n }\n if (\n isInlineGlobalValueToken(token) ||\n token === \"--json\" ||\n token === \"--quiet\" ||\n token === \"--no-extensions\" ||\n token === \"--no-pager\" ||\n token === \"--profile\" ||\n token === \"--id-only\" ||\n token === \"--explain\"\n ) {\n continue;\n }\n if (token.startsWith(\"-\")) {\n continue;\n }\n return index;\n }\n return undefined;\n}\n\n/** Implements parse bootstrap command name for the public runtime surface of this module. */\nexport function parseBootstrapCommandName(argv: string[]): string | undefined {\n const index = findCommandTokenIndex(argv);\n return index === undefined ? undefined : argv[index].trim().toLowerCase();\n}\n\nfunction shouldDisablePagerForInvocation(\n argv: string[],\n bootstrapGlobal: BootstrapGlobalOptions,\n): boolean {\n if (bootstrapGlobal.noPager) {\n return true;\n }\n if (process.stdout.isTTY === true) {\n return false;\n }\n const helpRequest = parseBootstrapHelpRequest(argv);\n return helpRequest.requested;\n}\n\n/** Implements apply bootstrap pager policy for the public runtime surface of this module. */\nexport function applyBootstrapPagerPolicy(argv: string[]): () => void {\n const pagerEnvironmentKeys = [\n \"PAGER\",\n \"MANPAGER\",\n \"GIT_PAGER\",\n \"LESS\",\n ] as const;\n const previousValues = pagerEnvironmentKeys.map((key) => process.env[key]);\n const restore = (): void => {\n for (const [index, key] of pagerEnvironmentKeys.entries()) {\n const value = previousValues[index];\n if (value === undefined) {\n delete process.env[key];\n } else {\n process.env[key] = value;\n }\n }\n };\n const bootstrapGlobal = parseBootstrapGlobalOptions(argv);\n if (!shouldDisablePagerForInvocation(argv, bootstrapGlobal)) {\n return restore;\n }\n process.env.PAGER = \"cat\";\n process.env.MANPAGER = \"cat\";\n process.env.GIT_PAGER = \"cat\";\n if (\n typeof process.env.LESS !== \"string\" ||\n process.env.LESS.trim().length === 0\n ) {\n process.env.LESS = \"FRX\";\n }\n return restore;\n}\n\ntype ExtensionSubcommandAction =\n | \"init\"\n | \"install\"\n | \"uninstall\"\n | \"explore\"\n | \"manage\"\n | \"doctor\"\n | \"adopt\"\n | \"adopt-all\"\n | \"activate\"\n | \"deactivate\";\n\nconst EXTENSION_ACTION_SYNTAX_TOKENS = new Set<ExtensionSubcommandAction>([\n \"install\",\n \"uninstall\",\n \"explore\",\n \"manage\",\n \"doctor\",\n \"adopt\",\n \"adopt-all\",\n \"activate\",\n \"deactivate\",\n]);\n\n/** Implements normalize legacy extension action syntax for the public runtime surface of this module. */\nexport function normalizeLegacyExtensionActionSyntax(argv: string[]): string[] {\n const extensionIndex = findCommandTokenIndex(argv);\n if (extensionIndex === undefined || argv[extensionIndex] !== \"extension\") {\n return [...argv];\n }\n const actionToken = argv[extensionIndex + 1];\n if (!actionToken || actionToken.startsWith(\"-\")) {\n return [...argv];\n }\n if (\n !EXTENSION_ACTION_SYNTAX_TOKENS.has(\n actionToken as ExtensionSubcommandAction,\n )\n ) {\n return [...argv];\n }\n if (argv.includes(\"--help\") || argv.includes(\"-h\")) {\n return [...argv];\n }\n const forcedActionFlag = `--${actionToken}`;\n if (argv.includes(forcedActionFlag)) {\n return [...argv];\n }\n return [\n ...argv.slice(0, extensionIndex + 1),\n forcedActionFlag,\n ...argv.slice(extensionIndex + 2),\n ];\n}\n\ntype BootstrapNormalizationReason =\n | \"legacy_extension_action\"\n | \"command_alias\"\n | \"flag_alias\"\n | \"flag_typo\"\n | \"bare_key_value\"\n | \"list_merge\";\ntype BootstrapNormalizationConfidence = \"high\" | \"medium\";\n\n/** Executable command aliases: a leading command token here is rewritten to its canonical command BEFORE commander parses, so the alias actually runs instead of merely being suggested. These are the highest-frequency aliases real agents type (telemetry: `pm show <id>` alone is the single most common unknown-command) and each target takes the same positional/flags as the alias (with `--comment`/ `--note`/`--learning` flag-aliased to `--add` on the target command). Keeping this in one place means the alias is consistent across registration, commander dispatch, telemetry, and error handling — all of which read the normalized argv. */\n/**\n * Rewrite a leading command-alias token (e.g. `show` -> `get`) in place. Only the\n * command position is considered — the same token appearing later as an argument\n * (`pm get show`) is left untouched — and only when it is not preceded by `--` or a\n * value-consuming global flag, mirroring {@link parseBootstrapCommandName}.\n */\nfunction rewriteCommandAlias(\n argv: string[],\n trace: BootstrapNormalizationEvent[],\n): string[] {\n const index = findCommandTokenIndex(argv);\n if (index === undefined) {\n return argv;\n }\n const token = argv[index];\n const canonical = EXECUTABLE_COMMAND_ALIASES[token.trim().toLowerCase()];\n if (!canonical) {\n return argv;\n }\n const rewritten = [...argv];\n rewritten[index] = canonical;\n trace.push({\n from: token,\n to: [canonical],\n reason: \"command_alias\",\n confidence: \"high\",\n });\n return rewritten;\n}\n\n/** Documents the bootstrap normalization event payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapNormalizationEvent {\n /** Value that configures or reports from for this contract. */\n from: string;\n /** Value that configures or reports to for this contract. */\n to: string[];\n /** Value that configures or reports reason for this contract. */\n reason: BootstrapNormalizationReason;\n /** Value that configures or reports confidence for this contract. */\n confidence: BootstrapNormalizationConfidence;\n}\n\n/** Documents the bootstrap invocation normalization result payload exchanged by command, SDK, and package integrations. */\nexport interface BootstrapInvocationNormalizationResult {\n /** Value that configures or reports argv for this contract. */\n argv: string[];\n /** Value that configures or reports command name for this contract. */\n commandName: string | undefined;\n /** Value that configures or reports trace for this contract. */\n trace: BootstrapNormalizationEvent[];\n}\n\ninterface FlagLookup {\n canonicalByNormalized: Map<string, string | null>;\n canonicalByCompact: Map<string, string | null>;\n canonicalComparables: Array<{ canonicalFlag: string; comparable: string }>;\n listCanonicalFlags: Set<string>;\n}\n\nfunction normalizeFlagKeyToken(raw: string): string {\n const withoutPrefix = raw.replace(/^--?/, \"\");\n return withoutPrefix\n .replace(/_/g, \"-\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n}\n\nfunction toComparableFlagKey(raw: string): string {\n return normalizeFlagKeyToken(raw).replace(/-/g, \"\");\n}\n\nfunction markUnambiguousFlag(\n map: Map<string, string | null>,\n key: string,\n canonicalFlag: string,\n): void {\n const existing = map.get(key);\n if (existing === undefined) {\n map.set(key, canonicalFlag);\n return;\n }\n if (existing !== canonicalFlag) {\n map.set(key, null);\n }\n}\n\nfunction collectLongFlagCandidates(contract: CliFlagContract): string[] {\n const candidates: string[] = [];\n const pushLongFlag = (value: string | undefined): void => {\n if (typeof value !== \"string\") {\n return;\n }\n if (!value.startsWith(\"--\")) {\n return;\n }\n candidates.push(value);\n };\n pushLongFlag(contract.flag);\n for (const alias of contract.aliases ?? []) {\n pushLongFlag(alias);\n }\n return candidates;\n}\n\nfunction buildFlagLookup(\n commandName: string | undefined,\n contractsOverride?: CliFlagContract[],\n): FlagLookup {\n const contracts =\n contractsOverride ?? resolveSubcommandFlagContractsForCommand(commandName);\n const canonicalByNormalized = new Map<string, string | null>();\n const canonicalByCompact = new Map<string, string | null>();\n const canonicalComparablesMap = new Map<string, string>();\n const listCanonicalFlags = new Set<string>();\n for (const contract of contracts) {\n const longCandidates = collectLongFlagCandidates(contract);\n if (longCandidates.length === 0) {\n continue;\n }\n const canonicalFlag = `--${normalizeFlagKeyToken(longCandidates[0])}`;\n for (const candidate of longCandidates) {\n markUnambiguousFlag(\n canonicalByNormalized,\n normalizeFlagKeyToken(candidate),\n canonicalFlag,\n );\n markUnambiguousFlag(\n canonicalByCompact,\n toComparableFlagKey(candidate),\n canonicalFlag,\n );\n }\n const comparable = toComparableFlagKey(canonicalFlag);\n if (!canonicalComparablesMap.has(canonicalFlag)) {\n canonicalComparablesMap.set(canonicalFlag, comparable);\n }\n if (contract.list === true) {\n listCanonicalFlags.add(canonicalFlag);\n }\n }\n return {\n canonicalByNormalized,\n canonicalByCompact,\n canonicalComparables: [...canonicalComparablesMap.entries()].map(\n ([canonicalFlag, comparable]) => ({\n canonicalFlag,\n comparable,\n }),\n ),\n listCanonicalFlags,\n };\n}\n\nfunction resolveCanonicalFlag(\n rawKey: string,\n lookup: FlagLookup,\n): {\n flag: string;\n reason: \"flag_alias\" | \"flag_typo\";\n confidence: BootstrapNormalizationConfidence;\n} | null {\n const normalizedKey = normalizeFlagKeyToken(rawKey);\n const direct = lookup.canonicalByNormalized.get(normalizedKey);\n if (typeof direct === \"string\") {\n return {\n flag: direct,\n reason: \"flag_alias\",\n confidence: \"high\",\n };\n }\n const comparableKey = normalizedKey.replace(/-/g, \"\");\n const compactMatch = lookup.canonicalByCompact.get(comparableKey);\n if (typeof compactMatch === \"string\") {\n return {\n flag: compactMatch,\n reason: \"flag_alias\",\n confidence: \"high\",\n };\n }\n const maxDistance = comparableKey.length >= 8 ? 2 : 1;\n let bestDistance = Number.POSITIVE_INFINITY;\n let bestFlag: string | undefined;\n let tied = false;\n for (const candidate of lookup.canonicalComparables) {\n const distance = levenshteinDistanceWithinLimit(\n comparableKey,\n candidate.comparable,\n maxDistance,\n );\n if (distance === null) {\n continue;\n }\n if (distance < bestDistance) {\n bestDistance = distance;\n bestFlag = candidate.canonicalFlag;\n tied = false;\n continue;\n }\n if (distance === bestDistance && bestFlag !== candidate.canonicalFlag) {\n tied = true;\n }\n }\n if (\n !bestFlag ||\n tied ||\n !Number.isFinite(bestDistance) ||\n bestDistance <= 0\n ) {\n return null;\n }\n return {\n flag: bestFlag,\n reason: \"flag_typo\",\n confidence: bestDistance >= 2 ? \"medium\" : \"high\",\n };\n}\n\n/** Implements list alias plural keys for the public runtime surface of this module. */\nexport function listAliasPluralKeys(normalizedKey: string): string[] {\n const candidates = [`${normalizedKey}s`];\n if (normalizedKey.endsWith(\"y\") && normalizedKey.length > 1) {\n candidates.push(`${normalizedKey.slice(0, -1)}ies`);\n }\n return candidates;\n}\n\nfunction parseBareKeyValueToken(\n token: string,\n preserve = false,\n): { key: string; value: string } | null {\n if (preserve || token.includes(\"://\")) {\n return null;\n }\n const match = token.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);\n if (!match) {\n return null;\n }\n const key = match[1];\n const value = match[3];\n if (value.length === 0) {\n return null;\n }\n return {\n key,\n value,\n };\n}\n\nfunction normalizeLongOptionToken(\n token: string,\n lookup: FlagLookup,\n preserve = false,\n): { tokens: string[]; event?: BootstrapNormalizationEvent } {\n if (preserve || !token.startsWith(\"--\")) {\n return { tokens: [token] };\n }\n const equalsIndex = token.indexOf(\"=\");\n const key = equalsIndex >= 0 ? token.slice(0, equalsIndex) : token;\n const inlineValue =\n equalsIndex >= 0 ? token.slice(equalsIndex + 1) : undefined;\n const resolution = resolveCanonicalFlag(key, lookup);\n if (!resolution) {\n return { tokens: [token] };\n }\n const normalizedToken =\n inlineValue === undefined\n ? resolution.flag\n : `${resolution.flag}=${inlineValue}`;\n if (normalizedToken === token) {\n return { tokens: [token] };\n }\n return {\n tokens: [normalizedToken],\n event: {\n from: token,\n to: [normalizedToken],\n reason: resolution.reason,\n confidence: resolution.confidence,\n },\n };\n}\n\n/** Locate global path-value tokens that normalization must preserve literally. */\nfunction collectBootstrapPathValueIndices(argv: string[]): Set<number> {\n const indices = new Set<number>();\n let expectsValue = false;\n for (let index = 0; index < argv.length; index += 1) {\n if (expectsValue) {\n indices.add(index);\n expectsValue = false;\n continue;\n }\n const token = argv[index];\n expectsValue = token === \"--path\" || token === \"--pm-path\";\n }\n return indices;\n}\n\n// Global option flags whose value may legitimately begin with \"--\" (commander\n// accepts such values). Their value token must not be reinterpreted as a list\n// flag during coalescing. `--pm-path <dir>` and its legacy `--path <dir>`\n// alias are the documented cases; other globals\n// (--json/--quiet/--no-extensions/--no-pager/--profile) are boolean.\nfunction splitCanonicalListToken(\n token: string,\n): { flag: string; inlineValue?: string } | null {\n if (!token.startsWith(\"--\")) {\n return null;\n }\n const equalsIndex = token.indexOf(\"=\");\n if (equalsIndex < 0) {\n return { flag: token };\n }\n return {\n flag: token.slice(0, equalsIndex),\n inlineValue: token.slice(equalsIndex + 1),\n };\n}\n\ninterface ListFlagSlot {\n outputIndex: number;\n originalTokens: string[];\n values: string[];\n occurrences: number;\n}\n\ninterface ListFlagOccurrence {\n originalTokens: string[];\n value: string | undefined;\n consumed: number;\n}\n\ninterface ValuedListFlagOccurrence {\n originalTokens: string[];\n value: string;\n}\n\nfunction copyValueConsumingFlag(\n argv: string[],\n index: number,\n result: (string | null)[],\n): number {\n result.push(argv[index]);\n const next = argv[index + 1];\n if (typeof next === \"string\" && next !== \"--\") {\n result.push(next);\n return index + 2;\n }\n return index + 1;\n}\n\nfunction readListFlagOccurrence(\n argv: string[],\n index: number,\n parsed: { flag: string; inlineValue?: string },\n multiValueListFlags: Set<string>,\n): ListFlagOccurrence {\n if (parsed.inlineValue !== undefined) {\n return {\n originalTokens: [argv[index]],\n value: parsed.inlineValue,\n consumed: 1,\n };\n }\n\n const values: string[] = [];\n let valueIndex = index + 1;\n while (\n valueIndex < argv.length &&\n argv[valueIndex] !== \"--\" &&\n !argv[valueIndex].startsWith(\"-\") &&\n (values.length === 0 || multiValueListFlags.has(parsed.flag))\n ) {\n values.push(argv[valueIndex]);\n valueIndex += 1;\n }\n\n const consumed = values.length === 0 ? 1 : 1 + values.length;\n return {\n originalTokens: argv.slice(index, index + consumed),\n value: values.length === 0 ? undefined : values.join(\",\"),\n consumed,\n };\n}\n\nfunction recordListFlagOccurrence(\n slots: Map<string, ListFlagSlot>,\n result: (string | null)[],\n flag: string,\n occurrence: ValuedListFlagOccurrence,\n): void {\n const existing = slots.get(flag);\n if (existing) {\n existing.values.push(occurrence.value);\n existing.occurrences += 1;\n return;\n }\n\n slots.set(flag, {\n outputIndex: result.length,\n originalTokens: occurrence.originalTokens,\n values: [occurrence.value],\n occurrences: 1,\n });\n // Reserve the anchor position; finalized after the walk so we know the full\n // merged value or can restore the original token form for single uses.\n result.push(null);\n}\n\nfunction buildListFlagCoalescingSplices(\n slots: Map<string, ListFlagSlot>,\n multiValueListFlags: Set<string>,\n): {\n events: BootstrapNormalizationEvent[];\n splices: Array<{ outputIndex: number; tokens: string[] }>;\n} {\n const events: BootstrapNormalizationEvent[] = [];\n const splices: Array<{ outputIndex: number; tokens: string[] }> = [];\n for (const [flag, slot] of slots) {\n const shouldMerge =\n slot.occurrences >= 2 ||\n (multiValueListFlags.has(flag) && slot.originalTokens.length > 2);\n if (!shouldMerge) {\n splices.push({\n outputIndex: slot.outputIndex,\n tokens: slot.originalTokens,\n });\n continue;\n }\n const mergedToken = `${flag}=${slot.values.join(\",\")}`;\n splices.push({ outputIndex: slot.outputIndex, tokens: [mergedToken] });\n events.push({\n from: `${flag} (x${slot.occurrences})`,\n to: [mergedToken],\n reason: \"list_merge\",\n confidence: \"high\",\n });\n }\n return { events, splices };\n}\n\nfunction applyListFlagSplices(\n result: (string | null)[],\n splices: Array<{ outputIndex: number; tokens: string[] }>,\n): void {\n splices.sort((a, b) => b.outputIndex - a.outputIndex);\n for (const splice of splices) {\n result.splice(splice.outputIndex, 1, ...splice.tokens);\n }\n}\n\n/**\n * Coalesce repeated occurrences of comma-separated list flags into a single\n * `--flag=v1,v2,v3` token anchored at the FIRST occurrence. Without this,\n * Commander treats these flags as scalars and silently keeps only the last\n * value (data loss). Both `--flag value` and `--flag=value` forms are merged;\n * a value-less occurrence is preserved untouched, and a `--` terminator stops\n * coalescing (remainder is passed through verbatim).\n *\n * `valueConsumingFlags` lists option flags (e.g. global `--pm-path`) whose value\n * may itself begin with `--`. Their value token is emitted verbatim so a\n * list-flag-looking value (`--path --tags`) is never reinterpreted as a flag\n * nor allowed to swallow the following command/positional token.\n */\nexport function coalesceRepeatedListFlags(\n argv: string[],\n listFlags: Set<string>,\n valueConsumingFlags: Set<string> = new Set(),\n multiValueListFlags: Set<string> = new Set(),\n): { argv: string[]; events: BootstrapNormalizationEvent[] } {\n if (listFlags.size === 0) {\n return { argv: [...argv], events: [] };\n }\n\n const result: (string | null)[] = [];\n const slots = new Map<string, ListFlagSlot>();\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n result.push(...argv.slice(index));\n break;\n }\n // A value-consuming option in space form owns the next token as its value,\n // even when that value begins with \"--\". Emit both verbatim so the value is\n // never misread as a list-flag occurrence.\n if (valueConsumingFlags.has(token)) {\n index = copyValueConsumingFlag(argv, index, result);\n continue;\n }\n const parsed = splitCanonicalListToken(token);\n if (!parsed || !listFlags.has(parsed.flag)) {\n result.push(token);\n index += 1;\n continue;\n }\n\n const occurrence = readListFlagOccurrence(\n argv,\n index,\n parsed,\n multiValueListFlags,\n );\n if (occurrence.value === undefined) {\n // Value-less occurrence: leave untouched, do not coalesce.\n result.push(token);\n index += occurrence.consumed;\n continue;\n }\n\n recordListFlagOccurrence(slots, result, parsed.flag, {\n originalTokens: occurrence.originalTokens,\n value: occurrence.value,\n });\n index += occurrence.consumed;\n }\n\n // Apply anchor splices from the end so earlier indices stay valid when a\n // single-occurrence anchor expands back into two tokens.\n const { events, splices } = buildListFlagCoalescingSplices(\n slots,\n multiValueListFlags,\n );\n applyListFlagSplices(result, splices);\n\n return { argv: result as string[], events };\n}\n\n/** Linked-test entry keys accepted in the two-token form `pm test <id> --add command \"npm test -- parser\"` (GH-191). Only entry-identity keys are merged: `command`/`cmd` name the shell command and `path` names the test file, so a single key=value entry is meaningful for them. Other structured keys (scope, env_set, assertions, ...) cannot form a valid standalone entry and are left for the normal parser to reject. `--remove` matches existing entries by `command=`/`path=` only, so `cmd` is excluded there. Key names mirror STRUCTURED_LINKED_TEST_KEYS in src/cli/commands/linked-test-entry.ts. */\nconst LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG: ReadonlyMap<\n string,\n ReadonlySet<string>\n> = new Map([\n [\"--add\", new Set([\"command\", \"cmd\", \"path\"])],\n [\"--remove\", new Set([\"command\", \"path\"])],\n]);\n\n/** Sandbox-safe linked-test commands legitimately start with env assignments (`PM_PATH=... PM_GLOBAL_PATH=... vitest run -- parser`), which look like bare key=value settings tokens. When the two preceding tokens are a linked-test flag plus a bare two-token key (`--add command <value>`), the value must be left intact for mergeLinkedTestTwoTokenEntries instead of being rewritten into a canonical flag (e.g. PM_PATH= -> --pm-path), which would silently corrupt the command into `--add command --pm-path ...`. */\nfunction isLinkedTestTwoTokenValuePosition(\n commandName: string | undefined,\n emittedTokens: readonly string[],\n): boolean {\n if (commandName !== \"test\" || emittedTokens.length < 2) {\n return false;\n }\n const key = emittedTokens[emittedTokens.length - 1];\n const flag = emittedTokens[emittedTokens.length - 2];\n const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(flag);\n return keys !== undefined && keys.has(key);\n}\n\nfunction shouldPreserveBareKeyValueToken(\n commandName: string | undefined,\n emittedTokens: readonly string[],\n): boolean {\n return (\n commandName === \"search\" ||\n isLinkedTestTwoTokenValuePosition(commandName, emittedTokens)\n );\n}\n\n/** Accept the two-token linked-test form `pm test <id> --add command \"npm test -- parser\"` by merging the bare key token and its single quoted value into the documented `--add command=...` shape. Without this merge Commander binds the bare key as the option value and treats the quoted command as an excess positional, failing with \"too many arguments\" (GH-191). The merge only fires when EXACTLY ONE non-flag token follows the bare key, i.e. the value was quoted into one shell token — an unquoted multi-token value stays ambiguous (it may swallow the item id), still fails fast, and is routed to targeted quoting guidance by the commander error classifier instead. */\nexport function mergeLinkedTestTwoTokenEntries(\n argv: string[],\n commandName: string | undefined,\n trace: BootstrapNormalizationEvent[],\n): string[] {\n if (commandName !== \"test\") {\n return argv;\n }\n const result: string[] = [];\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n result.push(...argv.slice(index));\n return result;\n }\n const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(token);\n const key = keys ? argv[index + 1] : undefined;\n if (!keys || typeof key !== \"string\" || !keys.has(key)) {\n result.push(token);\n index += 1;\n continue;\n }\n let runEnd = index + 2;\n while (runEnd < argv.length && !argv[runEnd].startsWith(\"-\")) {\n runEnd += 1;\n }\n if (runEnd - (index + 2) !== 1) {\n result.push(token);\n index += 1;\n continue;\n }\n const value = argv[index + 2];\n const mergedValue = `${key}=${value}`;\n result.push(token, mergedValue);\n trace.push({\n from: `${token} ${key} ${value}`,\n to: [token, mergedValue],\n reason: \"bare_key_value\",\n confidence: \"high\",\n });\n index += 3;\n }\n return result;\n}\n\n/** Implements normalize bootstrap invocation for the public runtime surface of this module. */\nexport function normalizeBootstrapInvocation(\n argv: string[],\n): BootstrapInvocationNormalizationResult {\n const trace: BootstrapNormalizationEvent[] = [];\n const legacyNormalized = normalizeLegacyExtensionActionSyntax(argv);\n if (\n legacyNormalized.length !== argv.length ||\n legacyNormalized.some((token, index) => token !== argv[index])\n ) {\n trace.push({\n from: argv.join(\" \"),\n to: [...legacyNormalized],\n reason: \"legacy_extension_action\",\n confidence: \"high\",\n });\n }\n const aliasNormalized = rewriteCommandAlias(legacyNormalized, trace);\n const commandName = parseBootstrapCommandName(aliasNormalized);\n const commandPathName = parseBootstrapCommandPathName(aliasNormalized);\n const lookup = buildFlagLookup(commandPathName ?? commandName);\n const normalizedArgv: string[] = [];\n const pathValueIndices = collectBootstrapPathValueIndices(aliasNormalized);\n for (let index = 0; index < aliasNormalized.length; index += 1) {\n const token = aliasNormalized[index];\n if (token === \"--\") {\n normalizedArgv.push(...aliasNormalized.slice(index));\n break;\n }\n const preserveCurrentToken = pathValueIndices.has(index);\n const previous = normalizedArgv[normalizedArgv.length - 1];\n if (token.startsWith(\"--\")) {\n const normalizedToken = normalizeLongOptionToken(\n token,\n lookup,\n preserveCurrentToken,\n );\n normalizedArgv.push(...normalizedToken.tokens);\n if (normalizedToken.event) {\n trace.push(normalizedToken.event);\n }\n continue;\n }\n const bareKeyValue = parseBareKeyValueToken(token, preserveCurrentToken);\n if (\n bareKeyValue &&\n !(typeof previous === \"string\" && previous.startsWith(\"-\")) &&\n !shouldPreserveBareKeyValueToken(commandName, normalizedArgv)\n ) {\n const resolution = resolveCanonicalFlag(bareKeyValue.key, lookup);\n if (resolution) {\n const replacement = [resolution.flag, bareKeyValue.value];\n normalizedArgv.push(...replacement);\n trace.push({\n from: token,\n to: replacement,\n reason: \"bare_key_value\",\n confidence: resolution.confidence,\n });\n continue;\n }\n }\n normalizedArgv.push(token);\n }\n const linkedTestNormalized = mergeLinkedTestTwoTokenEntries(\n normalizedArgv,\n commandName,\n trace,\n );\n const coalesced = coalesceRepeatedListFlags(\n linkedTestNormalized,\n lookup.listCanonicalFlags,\n GLOBAL_VALUE_CONSUMING_FLAGS,\n commandName === \"create\" ? new Set([\"--tags\"]) : new Set(),\n );\n for (const event of coalesced.events) {\n trace.push(event);\n }\n return {\n argv: coalesced.argv,\n commandName,\n trace,\n };\n}\n\nfunction parseBootstrapCommandPathName(argv: string[]): string | undefined {\n const stripped = stripGlobalBootstrapTokens(argv);\n const first = stripped[0]?.trim().toLowerCase();\n const second = stripped[1]?.trim().toLowerCase();\n if (\n (first === \"extension\" || first === \"package\" || first === \"packages\") &&\n typeof second === \"string\" &&\n second.length > 0 &&\n !second.startsWith(\"-\")\n ) {\n return `${first} ${second}`;\n }\n return first;\n}\n\n/** Implements parse bootstrap type value for the public runtime surface of this module. */\nexport function parseBootstrapTypeValue(argv: string[]): string | undefined {\n for (let index = 0; index < argv.length; index += 1) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (token === \"--type\") {\n const candidate = argv[index + 1];\n if (typeof candidate === \"string\" && candidate.trim().length > 0) {\n return candidate.trim();\n }\n continue;\n }\n if (token.startsWith(\"--type=\")) {\n const candidate = token.slice(\"--type=\".length).trim();\n if (candidate.length > 0) {\n return candidate;\n }\n }\n }\n return undefined;\n}\n\n/** Public contract for test only, shared by SDK and presentation-layer consumers. */\nexport const _testOnly = {\n buildFlagLookup,\n collectBootstrapPathValueIndices,\n collectLongFlagCandidates,\n markUnambiguousFlag,\n normalizeLongOptionToken,\n resolveCanonicalFlag,\n};\n", "/**\n * @module sdk/invocation-author\n *\n * Safely scopes invocation-wide mutation authors for one-shot and embedded CLI hosts.\n */\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\n\n/** Apply an optional author override and return an idempotent environment restorer. */\nexport function applyInvocationAuthorOverride(\n author: string | undefined,\n): () => void {\n if (author === undefined) {\n return () => {};\n }\n const normalizedAuthor = author.trim();\n if (normalizedAuthor.length === 0) {\n throw new PmCliError(\n \"--author requires a non-empty value.\",\n EXIT_CODE.USAGE,\n {\n code: \"missing_required_argument\",\n nextSteps: [\"Pass an explicit author identifier with --author <id>.\"],\n },\n );\n }\n const previousAuthor = process.env.PM_AUTHOR;\n process.env.PM_AUTHOR = normalizedAuthor;\n let restored = false;\n return () => {\n if (restored) {\n return;\n }\n restored = true;\n if (previousAuthor === undefined) {\n delete process.env.PM_AUTHOR;\n } else {\n process.env.PM_AUTHOR = previousAuthor;\n }\n };\n}\n", "/**\n * @module sdk/cli-program\n *\n * Builds the reusable Commander root that embeds pm's universal global contracts.\n */\nimport { Command } from \"commander\";\nimport { writeStdout } from \"../core/output/output.js\";\n\n/** Create a fresh pm root program suitable for one-shot CLI or embedded hosts. */\nexport function createPmCliProgram(version: string): Command {\n return new Command()\n .name(\"pm\")\n .description(\n \"Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.\",\n )\n .version(version)\n .showHelpAfterError(false)\n .allowExcessArguments(false)\n .allowUnknownOption(false)\n .configureOutput({\n writeOut: (value) => {\n writeStdout(value);\n },\n writeErr: () => {},\n })\n .option(\"--json\", \"Output JSON instead of TOON\")\n .option(\"--quiet\", \"Suppress stdout output\")\n .option(\n \"--no-changed-fields\",\n \"Omit the changed_fields array from mutation output (keeps changed_field_count)\",\n )\n .option(\n \"--id-only\",\n \"Print only id and status for single-item mutation output\",\n )\n .option(\n \"--pm-path <dir>\",\n \"Explicit tracker storage path for this command (preferred over --path)\",\n )\n .option(\n \"--path <dir>\",\n \"Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd\",\n )\n .option(\"--no-extensions\", \"Disable extension loading\")\n .option(\"--no-pager\", \"Disable pager integration for help and long output\")\n .option(\n \"--explain\",\n \"Render extended rationale and examples in help output\",\n )\n .option(\"--profile\", \"Print deterministic timing diagnostics\")\n .option(\"--author <id>\", \"Override mutation author for this invocation\")\n .exitOverride();\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAM,+BAA+B,oBAAI,IAAY;EACnD;EACA;EACA;CACD;AAGD,IAAM,2BAA2B,CAAC,UAA0B;AAC1D,QAAM,cAAc,MAAM,QAAQ,GAAG;AACrC,SACE,cAAc,KACd,6BAA6B,IAAI,MAAM,MAAM,GAAG,WAAW,CAAC;AAEhE;AAGA,IAAM,+BAA+B,CAAC,SAAqC;AACzE,SAAO,OAAO,SAAS,YAAY,CAAC,KAAK,WAAW,GAAG;AACzD;AAEA,SAAS,wBACP,OACA,MAAwB;AAExB,MAAI,UAAU,YAAY,UAAU,aAAa;AAC/C,QAAI,OAAO,SAAS,YAAY,KAAK,SAAS,GAAG;AAC/C,aAAO;QACL,UAAU;QACV,WAAW;QACX,WAAW,UAAU;;IAEzB;AACA,WAAO;MACL,UAAU;MACV,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,wBAAwB,EAC1C,OACC,uBACA,gFAAgF,EAEjF,OACC,aACA,0DAA0D,EAE3D,OACC,mBACA,wEAAwE,EAEzE,OACC,gBACA,gGAAgG,EAEjG,OAAO,mBAAmB,2BAA2B,EACrD,OAAO,cAAc,oDAAoD,EACzE,OACC,aACA,uDAAuD,EAExD,OAAO,aAAa,wCAAwC,EAC5D,OAAO,iBAAiB,8CAA8C,EACtE,aAAY;AACjB;",
|
|
6
6
|
"names": ["commandPathTokens"]
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILTIN_ITEM_TYPE_VALUES,
|
|
3
3
|
toDefaultFolder
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7AVEY74G.js";
|
|
5
5
|
|
|
6
6
|
// dist/core/schema/item-types-file.js
|
|
7
7
|
!(function() {
|
|
8
8
|
try {
|
|
9
9
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
10
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
10
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "5884dc7b-f03e-544b-a6bc-28b826f44d2f");
|
|
11
11
|
} catch (e2) {
|
|
12
12
|
}
|
|
13
13
|
})();
|
|
@@ -263,4 +263,4 @@ export {
|
|
|
263
263
|
buildInvalidTypeHint,
|
|
264
264
|
buildInvalidTypeError
|
|
265
265
|
};
|
|
266
|
-
//# sourceMappingURL=chunk-
|
|
266
|
+
//# sourceMappingURL=chunk-WWNL6WMH.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../core/schema/item-types-file.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @module core/schema/item-types-file\n *\n * Resolves configurable schema, fields, statuses, and workflows for Item Types File.\n */\nimport { BUILTIN_ITEM_TYPE_VALUES } from \"../../types/index.js\";\nimport type { ItemTypeDefinition } from \"../../types/index.js\";\nimport { toDefaultFolder } from \"../item/type-registry.js\";\n\nexport type { ItemTypeDefinition } from \"../../types/index.js\";\n\n/** Pure logic for the `pm schema add-type` command and the create/update invalid-type discoverability hint. The CLI command file (schema.ts) handles IO/governance; everything testable and side-effect-free lives here so it can be coverage-gated to 100%. */\n\nconst BUILTIN_NAME_LOOKUP = new Map<string, string>(\n BUILTIN_ITEM_TYPE_VALUES.map((name) => [name.toLowerCase(), name]),\n);\n\n/** The shape persisted at `.agents/pm/schema/types.json`. */\nexport interface ItemTypesFile {\n /** Value that configures or reports definitions for this contract. */\n definitions: ItemTypeDefinition[];\n}\n\n/** Documents the normalized add type input payload exchanged by command, SDK, and package integrations. */\nexport interface NormalizedAddTypeInput {\n /** Value that configures or reports name for this contract. */\n name: string;\n /** Value that configures or reports description for this contract. */\n description?: string;\n /** Default status id newly created items of this type receive. */\n defaultStatus?: string;\n /** Value that configures or reports folder for this contract. */\n folder?: string;\n /** Value that configures or reports aliases for this contract. */\n aliases: string[];\n}\n\n/** Documents the raw add type input payload exchanged by command, SDK, and package integrations. */\nexport interface RawAddTypeInput {\n /** Value that configures or reports name for this contract. */\n name: string | undefined;\n /** Value that configures or reports description for this contract. */\n description?: string;\n /** Default status id newly created items of this type receive. */\n defaultStatus?: string;\n /** Value that configures or reports folder for this contract. */\n folder?: string;\n /** Value that configures or reports aliases for this contract. */\n aliases?: string[];\n}\n\n/** Documents the upsert item type result payload exchanged by command, SDK, and package integrations. */\nexport interface UpsertItemTypeResult {\n /** Value that configures or reports file for this contract. */\n file: ItemTypesFile;\n /** The definition as stored after the upsert (existing fields preserved). */\n definition: ItemTypeDefinition;\n /** True when an existing definition with the same (case-insensitive) name was replaced. */\n replaced: boolean;\n /** The canonical name of the replaced definition (only present when `replaced`). Lets the caller detect a silent recase (e.g. \"Spike\" -> \"spike\") and warn. */\n previousName?: string;\n}\n\n/** Custom item type names (and aliases) must be a single letter-led identifier token: letters, digits, hyphen, or underscore — no whitespace or other punctuation. This keeps names copy-pasteable as shell arguments and folder slugs deterministic, matching the single-token PascalCase shape of every built-in type. Folder/slug overlap between two distinct valid tokens (e.g. \"Spike\"/\"Spikes\", \"code-review\"/\"code_review\") is rejected separately by assertTypeFolderAvailable. */\nconst TYPE_NAME_TOKEN_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/;\n\nfunction assertValidTypeToken(value: string, label: string): void {\n if (!TYPE_NAME_TOKEN_PATTERN.test(value)) {\n throw new Error(\n `${label} \"${value}\" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. \"Spike\" or \"code-review\").`,\n );\n }\n}\n\n/** Documents the remove item type result payload exchanged by command, SDK, and package integrations. */\nexport interface RemoveItemTypeResult {\n /** Value that configures or reports file for this contract. */\n file: ItemTypesFile;\n /** True when a matching definition existed and was dropped from the file. */\n removed: boolean;\n /** The removed definition, when one matched (case-insensitively) the requested name. */\n definition?: ItemTypeDefinition;\n}\n\n/** Returns the canonical built-in name when `name` collides (case-insensitively) with a reserved built-in item type, otherwise undefined. */\nexport function matchBuiltinTypeName(name: string): string | undefined {\n return BUILTIN_NAME_LOOKUP.get(name.trim().toLowerCase());\n}\n\n/** Coerces a persisted `aliases` value into a string array, tolerating malformed data (a non-array, or an array containing non-string entries) without throwing or exploding a stray string into character aliases. */\nfunction coerceAliasArray(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((entry): entry is string => typeof entry === \"string\")\n : [];\n}\n\n/** Escapes a value for safe interpolation inside a double-quoted shell string so suggested copy-pasteable commands stay well-formed for names containing `\"`, `` ` ``, `$`, or `\\`. */\nexport function escapeForDoubleQuotes(value: string): string {\n return value.replace(/[\\\\\"`$]/g, (char) => `\\\\${char}`);\n}\n\nfunction dedupeAliases(values: Iterable<string>): string[] {\n const seen = new Map<string, string>();\n for (const value of values) {\n const trimmed = value.trim();\n if (trimmed.length === 0) {\n continue;\n }\n const key = trimmed.toLowerCase();\n if (!seen.has(key)) {\n seen.set(key, trimmed);\n }\n }\n return [...seen.values()].sort((left, right) => left.localeCompare(right));\n}\n\n/** Validates and normalizes raw add-type CLI input. Throws a plain Error with a stable message when the name is missing/empty or collides with a built-in; the CLI layer maps these to PmCliError exit codes. */\nexport function normalizeAddTypeInput(\n raw: RawAddTypeInput,\n): NormalizedAddTypeInput {\n const name = (raw.name ?? \"\").trim();\n if (name.length === 0) {\n throw new Error(\"Type name must not be empty.\");\n }\n assertValidTypeToken(name, \"Type name\");\n const builtinMatch = matchBuiltinTypeName(name);\n if (builtinMatch) {\n throw new Error(\n `Cannot redefine built-in item type \"${builtinMatch}\". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(\", \")}.`,\n );\n }\n const description = raw.description?.trim();\n const defaultStatus = raw.defaultStatus?.trim();\n const folder = raw.folder?.trim();\n const aliases = dedupeAliases(raw.aliases ?? []);\n for (const alias of aliases) {\n assertValidTypeToken(alias, \"Alias\");\n const aliasBuiltin = matchBuiltinTypeName(alias);\n if (aliasBuiltin) {\n throw new Error(\n `Alias \"${alias}\" collides with built-in item type \"${aliasBuiltin}\". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(\", \")}.`,\n );\n }\n }\n return {\n name,\n description:\n description && description.length > 0 ? description : undefined,\n defaultStatus:\n defaultStatus && defaultStatus.length > 0 ? defaultStatus : undefined,\n folder: folder && folder.length > 0 ? folder : undefined,\n aliases,\n };\n}\n\n/** Throws when the requested name or any alias collides (case-insensitively) with the canonical name or an alias of a DIFFERENT existing definition. Such collisions would make `pm create`/`pm update --type` resolve ambiguously (the runtime registry keys a single lowercase alias map), so they are rejected. Tokens belonging to the same-named definition being upserted are ignored, keeping re-runs idempotent. */\nexport function assertAliasesAvailable(\n input: NormalizedAddTypeInput,\n existing: ItemTypesFile,\n): void {\n const selfLower = input.name.toLowerCase();\n const taken = new Map<string, string>();\n for (const definition of existing.definitions) {\n if (typeof definition.name !== \"string\") {\n continue;\n }\n const definitionName = definition.name.trim();\n if (\n definitionName.length === 0 ||\n definitionName.toLowerCase() === selfLower\n ) {\n continue;\n }\n taken.set(definitionName.toLowerCase(), definitionName);\n for (const alias of coerceAliasArray(definition.aliases)) {\n if (alias.trim().length > 0) {\n taken.set(alias.trim().toLowerCase(), definitionName);\n }\n }\n }\n const nameOwner = taken.get(selfLower);\n if (nameOwner) {\n throw new Error(\n `Type name \"${input.name}\" collides with an alias of existing item type \"${nameOwner}\".`,\n );\n }\n for (const alias of input.aliases) {\n const owner = taken.get(alias.toLowerCase());\n if (owner) {\n throw new Error(\n `Alias \"${alias}\" already maps to existing item type \"${owner}\".`,\n );\n }\n }\n}\n\n/** Resolves the storage folder a definition would use: an explicit non-empty `folder` wins, otherwise the deterministic slug derived from the name (the same derivation the runtime registry applies, single-sourced from type-registry.toDefaultFolder). */\nfunction resolveDefinitionFolder(name: string, folder: unknown): string {\n if (typeof folder === \"string\" && folder.trim().length > 0) {\n return folder.trim().toLowerCase();\n }\n return toDefaultFolder(name).toLowerCase();\n}\n\n/**\n * Throws when the requested type's storage folder would collide with a\n * DIFFERENT existing definition's folder. Two distinct type names can slug to\n * one folder (\"Spike\"/\"Spikes\", \"code-review\"/\"code_review\"), which would make\n * their item files share a directory and silently corrupt the taxonomy. The\n * same-named definition being upserted is ignored (folder reuse on re-run is\n * expected). Resolving the collision is a matter of passing a distinct\n * `--folder`, so the error says so.\n *\n * `reservedFolders` carries the folders already owned by built-in and extension\n * types (folder-slug → owner name); a custom type whose slug matches one of\n * those (e.g. \"Tasks\" → \"tasks\", owned by the built-in Task) is just as\n * corrupting as a custom-vs-custom collision, so both are checked.\n */\nexport function assertTypeFolderAvailable(\n input: NormalizedAddTypeInput,\n existing: ItemTypesFile,\n reservedFolders?: ReadonlyMap<string, string>,\n): void {\n const selfLower = input.name.toLowerCase();\n const inputFolder = resolveDefinitionFolder(input.name, input.folder);\n const fail = (ownerName: string): never => {\n throw new Error(\n `Item type \"${input.name}\" would store items in folder \"${inputFolder}\", which already belongs to existing item type \"${ownerName}\". Pass a distinct --folder to keep their storage separate.`,\n );\n };\n for (const definition of existing.definitions) {\n if (typeof definition.name !== \"string\") {\n continue;\n }\n const definitionName = definition.name.trim();\n if (\n definitionName.length === 0 ||\n definitionName.toLowerCase() === selfLower\n ) {\n continue;\n }\n if (\n resolveDefinitionFolder(definitionName, definition.folder) === inputFolder\n ) {\n fail(definitionName);\n }\n }\n const reservedOwner = reservedFolders?.get(inputFolder);\n if (\n reservedOwner !== undefined &&\n reservedOwner.toLowerCase() !== selfLower\n ) {\n fail(reservedOwner);\n }\n}\n\n/** Coerces an arbitrary parsed value from types.json into an ItemTypesFile. Accepts the canonical `{ definitions: [...] }` shape, a bare array of definitions, or a nested `{ item_types: { definitions: [...] } }` form, and tolerates a missing/invalid file by returning an empty definitions list. */\nexport function parseItemTypesFile(\n raw: string | null | undefined,\n): ItemTypesFile {\n if (raw === null || raw === undefined || raw.trim().length === 0) {\n return { definitions: [] };\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n throw new Error(\"schema/types.json contains invalid JSON.\");\n }\n return { definitions: extractDefinitions(parsed) };\n}\n\nfunction extractDefinitions(parsed: unknown): ItemTypeDefinition[] {\n const candidate = selectDefinitionsArray(parsed);\n if (!candidate) {\n return [];\n }\n const definitions: ItemTypeDefinition[] = [];\n for (const entry of candidate) {\n if (typeof entry !== \"object\" || entry === null || Array.isArray(entry)) {\n continue;\n }\n const record = entry as Record<string, unknown>;\n if (typeof record.name !== \"string\" || record.name.trim().length === 0) {\n continue;\n }\n definitions.push(record as unknown as ItemTypeDefinition);\n }\n return definitions;\n}\n\nfunction selectDefinitionsArray(parsed: unknown): unknown[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed;\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.definitions)) {\n return record.definitions;\n }\n if (typeof record.item_types === \"object\" && record.item_types !== null) {\n const nested = record.item_types as Record<string, unknown>;\n if (Array.isArray(nested.definitions)) {\n return nested.definitions;\n }\n }\n return undefined;\n}\n\n/** Idempotent UPSERT of a custom item type into the parsed file. Matching is case-insensitive by name. When a definition already exists, fields supplied in `input` override the previous values; aliases are merged (deduped); other fields not addressed by add-type flags are preserved untouched. */\nexport function upsertItemType(\n file: ItemTypesFile,\n input: NormalizedAddTypeInput,\n): UpsertItemTypeResult {\n const lowerName = input.name.toLowerCase();\n const definitions = file.definitions.slice();\n const existingIndex = definitions.findIndex(\n (definition) =>\n typeof definition.name === \"string\" &&\n definition.name.trim().toLowerCase() === lowerName,\n );\n const existing = existingIndex >= 0 ? definitions[existingIndex] : undefined;\n\n const mergedAliases = dedupeAliases([\n ...coerceAliasArray(existing?.aliases),\n ...input.aliases,\n ]);\n\n const next: ItemTypeDefinition = {\n ...existing,\n name: input.name,\n };\n if (input.folder !== undefined) {\n next.folder = input.folder;\n }\n if (mergedAliases.length > 0) {\n next.aliases = mergedAliases;\n } else if (next.aliases !== undefined) {\n delete next.aliases;\n }\n applyAttribute(next, \"description\", input.description);\n applyAttribute(next, \"default_status\", input.defaultStatus);\n\n if (existingIndex >= 0) {\n definitions[existingIndex] = next;\n } else {\n definitions.push(next);\n }\n definitions.sort((left, right) => left.name.localeCompare(right.name));\n\n return {\n file: { definitions },\n definition: next,\n replaced: existingIndex >= 0,\n ...(existing && typeof existing.name === \"string\"\n ? { previousName: existing.name }\n : {}),\n };\n}\n\n/** Removes a custom item type definition from the parsed file by name (case-insensitive). Throws a plain Error when `name` is empty or collides with a reserved built-in type (built-ins are not stored in the file and must never be deletable). Returns `removed: false` when no matching custom definition exists so the CLI layer can treat the call as an idempotent no-op. */\nexport function removeItemType(\n file: ItemTypesFile,\n name: string | undefined,\n): RemoveItemTypeResult {\n const trimmed = (name ?? \"\").trim();\n if (trimmed.length === 0) {\n throw new Error(\"Type name must not be empty.\");\n }\n const builtinMatch = matchBuiltinTypeName(trimmed);\n if (builtinMatch) {\n throw new Error(\n `Cannot remove built-in item type \"${builtinMatch}\". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(\", \")}.`,\n );\n }\n const lowerName = trimmed.toLowerCase();\n const definitions = file.definitions.slice();\n const existingIndex = definitions.findIndex(\n (definition) =>\n typeof definition.name === \"string\" &&\n definition.name.trim().toLowerCase() === lowerName,\n );\n if (existingIndex < 0) {\n return { file: { definitions }, removed: false };\n }\n const [definition] = definitions.splice(existingIndex, 1);\n return { file: { definitions }, removed: true, definition };\n}\n\nfunction applyAttribute(\n definition: ItemTypeDefinition,\n key: string,\n value: string | undefined,\n): void {\n const record = definition as unknown as Record<string, unknown>;\n if (value !== undefined) {\n record[key] = value;\n }\n}\n\n/** Serializes the item types file with a trailing newline (matches the rest of the schema scaffold files written by pm). */\nexport function serializeItemTypesFile(file: ItemTypesFile): string {\n return `${JSON.stringify({ definitions: file.definitions }, null, 2)}\\n`;\n}\n\n/** Appends a discoverable hint to the \"Invalid type\" error so agents learn that custom types exist and how to register one. Quotes are chosen so the printed line is copy-pasteable as a shell command. */\nexport function buildInvalidTypeHint(\n name: string,\n typesFilePath?: string,\n): string {\n const safeName = name.trim().length > 0 ? name.trim() : name;\n const target = typesFilePath?.trim() || \".agents/pm/schema/types.json\";\n return `To register a custom type, run: pm schema add-type \"${escapeForDoubleQuotes(safeName)}\" (writes ${target}).`;\n}\n\n/**\n * Builds the full invalid-type error message used by create/update: the\n * existing \"Invalid type ... Allowed: ...\" line plus the discoverable hint.\n * `typesFilePath` should be the resolved schema/types.json path for the active\n * tracker (see {@link resolveItemTypesFilePath}) so the hint reflects a custom\n * `--pm-path` instead of the hardcoded `.agents/pm` default.\n */\nexport function buildInvalidTypeError(\n name: string,\n allowedTypes: readonly string[],\n typesFilePath?: string,\n): string {\n return `Invalid type value \"${name}\". Allowed: ${allowedTypes.join(\", \")}. ${buildInvalidT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