@unbrained/pm-cli 2026.7.14 → 2026.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +54 -0
- package/README.md +14 -11
- package/dist/cli/argv-utils.d.ts +1 -4
- package/dist/cli/argv-utils.js +3 -13
- package/dist/cli/argv-utils.js.map +1 -1
- package/dist/cli/bootstrap-args.d.ts +6 -4
- package/dist/cli/bootstrap-args.js +51 -16
- package/dist/cli/bootstrap-args.js.map +1 -1
- package/dist/cli/bundle-integrity.d.ts +49 -0
- package/dist/cli/bundle-integrity.js +111 -0
- package/dist/cli/bundle-integrity.js.map +1 -0
- package/dist/cli/commands/completion.js +7 -2
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/config.d.ts +6 -163
- package/dist/cli/commands/config.js +4 -1133
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/context.d.ts +2 -4
- package/dist/cli/commands/context.js +10 -85
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/create.d.ts +1 -0
- package/dist/cli/commands/create.js +3 -2
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/extension/describe.d.ts +2 -91
- package/dist/cli/commands/extension/describe.js +4 -142
- package/dist/cli/commands/extension/describe.js.map +1 -1
- package/dist/cli/commands/extension/scaffold.d.ts +2 -36
- package/dist/cli/commands/extension/scaffold.js +4 -2435
- package/dist/cli/commands/extension/scaffold.js.map +1 -1
- package/dist/cli/commands/extension/shared.d.ts +2 -28
- package/dist/cli/commands/extension/shared.js +4 -130
- package/dist/cli/commands/extension/shared.js.map +1 -1
- package/dist/cli/commands/extension.d.ts +3 -400
- package/dist/cli/commands/extension.js +4 -2183
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/gc.d.ts +6 -56
- package/dist/cli/commands/gc.js +4 -270
- package/dist/cli/commands/gc.js.map +1 -1
- package/dist/cli/commands/get.d.ts +18 -5
- package/dist/cli/commands/get.js +117 -58
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/health.d.ts +6 -184
- package/dist/cli/commands/health.js +4 -1747
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-compact.d.ts +4 -139
- package/dist/cli/commands/history-compact.js +5 -510
- package/dist/cli/commands/history-compact.js.map +1 -1
- package/dist/cli/commands/history-redact.d.ts +8 -120
- package/dist/cli/commands/history-redact.js +6 -581
- package/dist/cli/commands/history-redact.js.map +1 -1
- package/dist/cli/commands/history-repair.d.ts +7 -89
- package/dist/cli/commands/history-repair.js +5 -257
- package/dist/cli/commands/history-repair.js.map +1 -1
- package/dist/cli/commands/history.d.ts +1 -2
- package/dist/cli/commands/history.js +6 -48
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +3 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init-agent-guidance.d.ts +6 -113
- package/dist/cli/commands/init-agent-guidance.js +4 -431
- package/dist/cli/commands/init-agent-guidance.js.map +1 -1
- package/dist/cli/commands/init.d.ts +6 -181
- package/dist/cli/commands/init.js +4 -690
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/next.js +3 -3
- package/dist/cli/commands/next.js.map +1 -1
- package/dist/cli/commands/profile.d.ts +4 -174
- package/dist/cli/commands/profile.js +4 -425
- package/dist/cli/commands/profile.js.map +1 -1
- package/dist/cli/commands/restore.d.ts +4 -19
- package/dist/cli/commands/restore.js +9 -158
- package/dist/cli/commands/restore.js.map +1 -1
- package/dist/cli/commands/schema.d.ts +7 -507
- package/dist/cli/commands/schema.js +5 -1254
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/test.d.ts +2 -4
- package/dist/cli/commands/test.js +7 -97
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +9 -249
- package/dist/cli/commands/validate.js +9 -2150
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/extension-command-help.js +18 -4
- package/dist/cli/extension-command-help.js.map +1 -1
- package/dist/cli/extension-command-options.js +3 -3
- package/dist/cli/extension-command-options.js.map +1 -1
- package/dist/cli/help-content.js +7 -3
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/main.js +20 -30
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +4 -2
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +11 -3
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-setup.js +4 -2
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.js +3 -2
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/bundle-manifest.json +782 -0
- package/dist/cli-bundle/chunks/{append-PVZJDM6J.js → append-OJQFUQ4T.js} +5 -5
- package/dist/cli-bundle/chunks/append-UZVHUO74.js +11 -0
- package/dist/cli-bundle/chunks/{chunk-MQZ3PLCF.js → chunk-2IFFUZLC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-P6MYFH6K.js → chunk-2JKGO6QX.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-X3GYR4P2.js → chunk-2NCIPMQP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Q7E6OYZK.js → chunk-2VPAVL7O.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DRNJPEPQ.js → chunk-2WSE6PO2.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-FDSBDNYE.js → chunk-34L5OT3Y.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TH7U4KLY.js → chunk-3AUGG2DP.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-NKW36AMT.js → chunk-3CLU2XZO.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-N3CMP4NI.js → chunk-3S5QVM5H.js} +43 -7
- package/dist/cli-bundle/chunks/chunk-3S5QVM5H.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-3U7ZR6M4.js +64 -0
- package/dist/cli-bundle/chunks/chunk-3U7ZR6M4.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ABRCOSDC.js → chunk-3WM75PWC.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-4223PVZT.js +121 -0
- package/dist/cli-bundle/chunks/chunk-4223PVZT.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-5URI7TPJ.js → chunk-4XQ3BDV4.js} +281 -164
- package/dist/cli-bundle/chunks/chunk-4XQ3BDV4.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-X6BVXQ52.js → chunk-5JLUII3O.js} +13 -13
- package/dist/cli-bundle/chunks/{chunk-MKL4CP2I.js → chunk-5ZSLZLDN.js} +631 -246
- package/dist/cli-bundle/chunks/chunk-5ZSLZLDN.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-Q37E63AM.js → chunk-6CFNAVTF.js} +21 -141
- package/dist/cli-bundle/chunks/chunk-6CFNAVTF.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-3TL7WOEF.js → chunk-6N2VXVTQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ERL2YFJ2.js → chunk-6S3YSUYG.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-ZUKSZVBW.js → chunk-7B67ZL4N.js} +8 -7
- package/dist/cli-bundle/chunks/chunk-7B67ZL4N.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-IA3YFTXT.js → chunk-7PIWCHTW.js} +11 -13
- package/dist/cli-bundle/chunks/chunk-7PIWCHTW.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-BPD26E3P.js → chunk-7Z4LKRS4.js} +291 -81
- package/dist/cli-bundle/chunks/chunk-7Z4LKRS4.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-IFZA4VB5.js → chunk-AHVTB5I5.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-DO5RGJXT.js → chunk-APRVSW2O.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-NAQYVWSQ.js → chunk-B7PE22W6.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-MD6ULIPJ.js → chunk-BCOFWYW4.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-KADLSPIU.js → chunk-BEP7WJA2.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-BKVG6XOA.js +1114 -0
- package/dist/cli-bundle/chunks/chunk-BKVG6XOA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-AFWZRL7M.js → chunk-BSEQUTQP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AFWZRL7M.js.map → chunk-BSEQUTQP.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OBDLEQG5.js → chunk-CRVF2JDM.js} +10 -10
- package/dist/cli-bundle/chunks/{chunk-FJZDA6MS.js → chunk-DM4H7FP4.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-DUT67M43.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-44LNIULG.js → chunk-DYH63FX7.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-LWTIRS3Y.js → chunk-E2OJMKML.js} +306 -82
- package/dist/cli-bundle/chunks/chunk-E2OJMKML.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HAMLIWAF.js → chunk-EAB64KLB.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-CIOZ376P.js → chunk-EACOH7AU.js} +10 -10
- package/dist/cli-bundle/chunks/{chunk-HL7V2PHX.js → chunk-EH2OPHBI.js} +10 -10
- package/dist/cli-bundle/chunks/{chunk-HL7V2PHX.js.map → chunk-EH2OPHBI.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-QK2ZN6UL.js → chunk-EJEXHTY5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WQUEHPZB.js → chunk-EYLCSJAI.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-655STMGA.js → chunk-FMBNM2EN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RMF3IOYQ.js → chunk-FNSPG7MU.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-5CT5BW6E.js → chunk-GM5QHQU6.js} +46 -40
- package/dist/cli-bundle/chunks/chunk-GM5QHQU6.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-FTQLW4JD.js → chunk-GOSLKLFE.js} +418 -24
- package/dist/cli-bundle/chunks/chunk-GOSLKLFE.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KB726FMH.js → chunk-H2Z3FYXQ.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-H3EIEWGR.js +162 -0
- package/dist/cli-bundle/chunks/chunk-H3EIEWGR.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-2QIQGYPW.js → chunk-H5APFTHZ.js} +53 -10
- package/dist/cli-bundle/chunks/chunk-H5APFTHZ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-HDH3JUGG.js +118 -0
- package/dist/cli-bundle/chunks/chunk-HDH3JUGG.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-ZAYYDNB3.js → chunk-HO4KXD6I.js} +22 -142
- package/dist/cli-bundle/chunks/chunk-HO4KXD6I.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-ILLUE5DI.js → chunk-HYB5AZ63.js} +203 -62
- package/dist/cli-bundle/chunks/{chunk-ILLUE5DI.js.map → chunk-HYB5AZ63.js.map} +3 -3
- package/dist/cli-bundle/chunks/{chunk-BN62TO2S.js → chunk-IA5FKNII.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JL7WZ4O2.js → chunk-IG3SWA4A.js} +33 -9
- package/dist/cli-bundle/chunks/chunk-IG3SWA4A.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-W6HZ55JO.js → chunk-IJIICKVW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IGED7NH2.js → chunk-ILX33QXL.js} +668 -251
- package/dist/cli-bundle/chunks/chunk-ILX33QXL.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-UGTVWL3E.js → chunk-INU6DKT5.js} +47 -41
- package/dist/cli-bundle/chunks/chunk-INU6DKT5.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-UB2QYSTO.js → chunk-J5AOEGDC.js} +26 -18
- package/dist/cli-bundle/chunks/chunk-J5AOEGDC.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4DY4KPQI.js → chunk-J6364LFM.js} +1330 -937
- package/dist/cli-bundle/chunks/chunk-J6364LFM.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-DVOLZJ3C.js → chunk-J6EY5V4N.js} +1295 -939
- package/dist/cli-bundle/chunks/chunk-J6EY5V4N.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-JFTKLTEF.js +1097 -0
- package/dist/cli-bundle/chunks/chunk-JFTKLTEF.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-M7EWN4TF.js → chunk-JOUQZENX.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-J4NZOP3I.js → chunk-JXQUXVMI.js} +9 -8
- package/dist/cli-bundle/chunks/chunk-JXQUXVMI.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-2FNWQXZ2.js → chunk-JYFOV7FC.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-HLHSQ5CA.js → chunk-K2X6U4UA.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-6OTZMORS.js → chunk-K3WII2ME.js} +27 -27
- package/dist/cli-bundle/chunks/chunk-K3WII2ME.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-M6ASXYCU.js → chunk-KG44YSKD.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-YVKE5ZDM.js → chunk-KPMKHGEA.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-QASRVKUQ.js → chunk-LPYWLWDS.js} +257 -163
- package/dist/cli-bundle/chunks/chunk-LPYWLWDS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-RGXD5JJR.js → chunk-LSG2U345.js} +19 -12
- package/dist/cli-bundle/chunks/chunk-LSG2U345.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-MIQDDLB5.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-UJ4HJYWL.js → chunk-NLDFBC6J.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WRKB56FC.js → chunk-NP22ERDF.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-YQYG2V23.js → chunk-NU3IMIEA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3I3LRT2G.js → chunk-NVPZIJVR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JAF4TUQ7.js → chunk-ODALILG3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CDJYP7OQ.js → chunk-ONG5V5CI.js} +190 -63
- package/dist/cli-bundle/chunks/chunk-ONG5V5CI.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-QZ7LT3XE.js → chunk-ONREO4ST.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-OW4JWD5M.js +61 -0
- package/dist/cli-bundle/chunks/chunk-OW4JWD5M.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-3CMRNVTO.js → chunk-P74IZQ7A.js} +12 -12
- package/dist/cli-bundle/chunks/chunk-PENXZX3U.js +172 -0
- package/dist/cli-bundle/chunks/chunk-PENXZX3U.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ZTRBSABY.js → chunk-PGY23YTC.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-H2QBAKLQ.js → chunk-PMOSXADO.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-PNTULOGU.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-GSEADLRH.js → chunk-Q7A43DS4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QSPARJWF.js → chunk-QEHQ2GVG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VJTAEIPC.js → chunk-QIPLHNP7.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-GXXC7QSK.js → chunk-QKECXBBG.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-GXXC7QSK.js.map → chunk-QKECXBBG.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-K7WNZ7KD.js → chunk-QKJGPFAF.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-F7PSHRNO.js → chunk-QKXHFPYM.js} +27 -10
- package/dist/cli-bundle/chunks/chunk-QKXHFPYM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-ZNP64HOW.js → chunk-RLCHOOHC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IAPHYPRL.js → chunk-RMLWNPH2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UVBA6F5A.js → chunk-RRM5JYJC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6IIVBC56.js → chunk-S6MQESFR.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-QABYZYLU.js → chunk-SDQLJWBO.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-ANSJHDOZ.js → chunk-SELVXEZK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DYEX6NFH.js → chunk-TD3LVC7D.js} +438 -23
- package/dist/cli-bundle/chunks/chunk-TD3LVC7D.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-WD6MSYMP.js → chunk-TKOVBP6C.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TZ2PSLLT.js → chunk-TQSZFPIS.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-WPAWZW7S.js → chunk-TSMHDIW4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TZRTLMWM.js → chunk-UFXU44HV.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-TWLDBKQU.js → chunk-ULTHRDBP.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-OI4S4KCI.js → chunk-UMOPHQSU.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-OI4S4KCI.js.map → chunk-UMOPHQSU.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RA5AIAMP.js → chunk-UOHFKBUV.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-PHKP3AGR.js → chunk-UWQHLMEB.js} +35 -18
- package/dist/cli-bundle/chunks/chunk-UWQHLMEB.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-6TTOHMTB.js → chunk-UXONS674.js} +45 -112
- package/dist/cli-bundle/chunks/chunk-UXONS674.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4RXTMU57.js → chunk-UY2ACEMF.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-6PKA3SJQ.js → chunk-WQPUU7XD.js} +19 -28
- package/dist/cli-bundle/chunks/chunk-WQPUU7XD.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-7TQMR6LK.js → chunk-WT3ZEOGH.js} +70 -20
- package/dist/cli-bundle/chunks/chunk-WT3ZEOGH.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-FIGXOCEQ.js → chunk-WUJQK4YV.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-T4BRCB6Z.js → chunk-XSJUSQAE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6MHSBDGD.js → chunk-XXXF6PAQ.js} +50 -117
- package/dist/cli-bundle/chunks/chunk-XXXF6PAQ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-UKUIIBDW.js → chunk-YAQEBNY7.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-7QDSYUMF.js → chunk-YAROI3PD.js} +44 -21
- package/dist/cli-bundle/chunks/chunk-YAROI3PD.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-E2WC6S4P.js → chunk-YBLZ2VE7.js} +13 -13
- package/dist/cli-bundle/chunks/{chunk-Y72FV7RM.js → chunk-YCQET3OT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-YUSOJDWM.js +9 -0
- package/dist/cli-bundle/chunks/chunk-YXSHIAUJ.js +58 -0
- package/dist/cli-bundle/chunks/chunk-YXSHIAUJ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-FS6UM5WH.js → chunk-ZI6VQWQ7.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-ZKRZY773.js +68 -0
- package/dist/cli-bundle/chunks/chunk-ZKRZY773.js.map +7 -0
- package/dist/cli-bundle/chunks/{close-LZECOMHO.js → close-CWODTPKG.js} +5 -5
- package/dist/cli-bundle/chunks/close-W6LI2PKM.js +12 -0
- package/dist/cli-bundle/chunks/{close-many-ZHI6A5TN.js → close-many-CQFUY7MR.js} +15 -13
- package/dist/cli-bundle/chunks/close-many-DLDDVSH5.js +23 -0
- package/dist/cli-bundle/chunks/comments-E3TNTK24.js +13 -0
- package/dist/cli-bundle/chunks/{comments-AJWRTFZ5.js → comments-WGLHR7LB.js} +7 -7
- package/dist/cli-bundle/chunks/{copy-GMXYKBXT.js → copy-LXVDXH7B.js} +4 -4
- package/dist/cli-bundle/chunks/copy-Q5ZJPUKR.js +9 -0
- package/dist/cli-bundle/chunks/{create-F53OBTOU.js → create-J5U6ND4K.js} +9 -9
- package/dist/cli-bundle/chunks/{create-HU4Q7RJX.js → create-LBVCYMEG.js} +9 -9
- package/dist/cli-bundle/chunks/{delete-GSDZLTRC.js → delete-PMJBNY5G.js} +4 -4
- package/dist/cli-bundle/chunks/delete-WNHB3LYW.js +10 -0
- package/dist/cli-bundle/chunks/{deps-WWB7P2GT.js → deps-JZ7TMVCB.js} +7 -4
- package/dist/cli-bundle/chunks/{deps-U57I7EAK.js → deps-OA26IS25.js} +7 -4
- package/dist/cli-bundle/chunks/{docs-MQIY2ZQS.js → docs-FEWB2DQB.js} +6 -6
- package/dist/cli-bundle/chunks/docs-HA2AIDBB.js +14 -0
- package/dist/cli-bundle/chunks/{files-TBZD7V6H.js → files-6YFBJRBG.js} +6 -6
- package/dist/cli-bundle/chunks/{files-TTY6N2AV.js → files-EFIWKFTM.js} +6 -6
- package/dist/cli-bundle/chunks/{focus-XT6YVFFX.js → focus-4QJR7FOQ.js} +5 -5
- package/dist/cli-bundle/chunks/focus-POIW5LTJ.js +10 -0
- package/dist/cli-bundle/chunks/{history-compact-KKVUWB4V.js → history-compact-CKRPDTJN.js} +6 -10
- package/dist/cli-bundle/chunks/history-compact-FWG2C7FZ.js +16 -0
- package/dist/cli-bundle/chunks/history-redact-BB3TGDAE.js +15 -0
- package/dist/cli-bundle/chunks/{history-redact-3DVZOILD.js → history-redact-D225BHOZ.js} +5 -6
- package/dist/cli-bundle/chunks/history-repair-6GEAM7HE.js +16 -0
- package/dist/cli-bundle/chunks/{history-repair-ITDUMK4N.js → history-repair-RQXKQHL4.js} +6 -8
- package/dist/cli-bundle/chunks/{learnings-FGO3NSFW.js → learnings-JLNLCOL5.js} +7 -7
- package/dist/cli-bundle/chunks/learnings-RSNLSWDC.js +13 -0
- package/dist/cli-bundle/chunks/notes-2WDH6DXU.js +13 -0
- package/dist/cli-bundle/chunks/{notes-NQ6RXVW6.js → notes-GB47XXQQ.js} +7 -7
- package/dist/cli-bundle/chunks/plan-DOVI2VMW.js +24 -0
- package/dist/cli-bundle/chunks/{plan-2NNEO46V.js → plan-VDCJ2PCN.js} +10 -10
- package/dist/cli-bundle/chunks/{profile-AAQUU6T3.js → profile-FAU7NZML.js} +10 -10
- package/dist/cli-bundle/chunks/{profile-U725ATWZ.js → profile-IVXQEL3D.js} +10 -10
- package/dist/cli-bundle/chunks/{register-list-query-BUWCYHBT.js → register-list-query-DKA3EH5D.js} +22 -19
- package/dist/cli-bundle/chunks/register-list-query-DKA3EH5D.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-KTZ6AGE7.js → register-list-query-UL4UKBBN.js} +23 -20
- package/dist/cli-bundle/chunks/register-list-query-UL4UKBBN.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-mutation-UELYYOR7.js → register-mutation-ARFHRW55.js} +36 -32
- package/dist/cli-bundle/chunks/{register-mutation-UELYYOR7.js.map → register-mutation-ARFHRW55.js.map} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-4FMGJJF7.js → register-mutation-RBBJ52DK.js} +37 -33
- package/dist/cli-bundle/chunks/register-mutation-RBBJ52DK.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-JVW24J2Y.js → register-operations-ZIBBRSED.js} +41 -39
- package/dist/cli-bundle/chunks/{register-operations-JVW24J2Y.js.map → register-operations-ZIBBRSED.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-operations-ISUX6LY5.js → register-operations-ZUJ5JWPE.js} +39 -37
- package/dist/cli-bundle/chunks/{register-operations-ISUX6LY5.js.map → register-operations-ZUJ5JWPE.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-setup-5XNGKJ22.js → register-setup-BCVLFEYS.js} +29 -17
- package/dist/cli-bundle/chunks/{register-setup-5XNGKJ22.js.map → register-setup-BCVLFEYS.js.map} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-ZTNY6S7R.js → register-setup-TDCGWIOS.js} +19 -18
- package/dist/cli-bundle/chunks/{register-setup-ZTNY6S7R.js.map → register-setup-TDCGWIOS.js.map} +1 -1
- package/dist/cli-bundle/chunks/{restore-B3BAB6X2.js → restore-25DLT2Q2.js} +6 -6
- package/dist/cli-bundle/chunks/restore-YPMVUUEX.js +14 -0
- package/dist/cli-bundle/chunks/{schema-U7IM2DXV.js → schema-FNU3WE4O.js} +7 -6
- package/dist/cli-bundle/chunks/{schema-LZNUYHDB.js → schema-NBCM3RAD.js} +7 -6
- package/dist/cli-bundle/chunks/update-WWBYOPXO.js +21 -0
- package/dist/cli-bundle/chunks/update-WWBYOPXO.js.map +7 -0
- package/dist/cli-bundle/chunks/{update-Q3UCILNR.js → update-XHSIAIXE.js} +12 -12
- package/dist/cli-bundle/chunks/update-XHSIAIXE.js.map +1 -0
- package/dist/cli-bundle/chunks/update-many-OUGIU5SF.js +32 -0
- package/dist/cli-bundle/chunks/update-many-OUGIU5SF.js.map +7 -0
- package/dist/cli-bundle/chunks/update-many-TA7NGQBO.js +36 -0
- package/dist/cli-bundle/chunks/update-many-TA7NGQBO.js.map +1 -0
- package/dist/cli-bundle/main.js +826 -43
- package/dist/cli-bundle/main.js.map +4 -4
- package/dist/cli-bundle/sdk-runtime.js +70 -57
- package/dist/cli-bundle/sdk-testing.js +6 -6
- package/dist/cli-bundle/sdk.js +876 -74
- package/dist/cli-bundle/sdk.js.map +4 -4
- package/dist/cli.js +5 -4
- package/dist/cli.js.map +1 -1
- package/dist/core/diagnostics/remediation.js +12 -2
- package/dist/core/diagnostics/remediation.js.map +1 -1
- package/dist/core/history/projection.d.ts +39 -0
- package/dist/core/history/projection.js +164 -0
- package/dist/core/history/projection.js.map +1 -0
- package/dist/core/history/read.d.ts +3 -0
- package/dist/core/history/read.js +55 -0
- package/dist/core/history/read.js.map +1 -0
- package/dist/core/output/output-control.d.ts +18 -0
- package/dist/core/output/output-control.js +26 -0
- package/dist/core/output/output-control.js.map +1 -0
- package/dist/core/output/output.js +20 -8
- package/dist/core/output/output.js.map +1 -1
- package/dist/core/sentry/helpers.js +10 -2
- package/dist/core/sentry/helpers.js.map +1 -1
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/command-types.js.map +1 -1
- package/dist/core/shared/errors.d.ts +11 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/errors.js.map +1 -1
- package/dist/mcp/server.d.ts +2 -2
- package/dist/mcp/tool-definitions.js +5 -5
- package/dist/mcp/tool-definitions.js.map +1 -1
- package/dist/sdk/author-attribution.d.ts +35 -0
- package/dist/sdk/author-attribution.js +118 -0
- package/dist/sdk/author-attribution.js.map +1 -0
- package/dist/sdk/cli-contracts/command-aliases.d.ts +7 -0
- package/dist/sdk/cli-contracts/command-aliases.js +17 -0
- package/dist/sdk/cli-contracts/command-aliases.js.map +1 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
- package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +6 -2
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +21 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +3 -3
- package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +1 -0
- package/dist/sdk/cli-contracts.js +3 -2
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/cli-program.d.ts +8 -0
- package/dist/sdk/cli-program.js +39 -0
- package/dist/sdk/cli-program.js.map +1 -0
- package/dist/sdk/command-line.d.ts +11 -0
- package/dist/sdk/command-line.js +40 -0
- package/dist/sdk/command-line.js.map +1 -0
- package/dist/sdk/config.d.ts +163 -0
- package/dist/sdk/config.js +1087 -0
- package/dist/sdk/config.js.map +1 -0
- package/dist/sdk/context-relevance.d.ts +21 -0
- package/dist/sdk/context-relevance.js +70 -2
- package/dist/sdk/context-relevance.js.map +1 -1
- package/dist/sdk/dependencies.d.ts +15 -2
- package/dist/sdk/dependencies.js +97 -8
- package/dist/sdk/dependencies.js.map +1 -1
- package/dist/{cli/commands → sdk}/extension/bundled-catalog.d.ts +1 -1
- package/dist/{cli/commands → sdk}/extension/bundled-catalog.js +12 -12
- package/dist/sdk/extension/bundled-catalog.js.map +1 -0
- package/dist/sdk/extension/concurrency.d.ts +7 -0
- package/dist/sdk/extension/concurrency.js +26 -0
- package/dist/sdk/extension/concurrency.js.map +1 -0
- package/dist/sdk/extension/describe.d.ts +91 -0
- package/dist/sdk/extension/describe.js +144 -0
- package/dist/sdk/extension/describe.js.map +1 -0
- package/dist/{cli/commands → sdk}/extension/doctor.d.ts +3 -3
- package/dist/{cli/commands → sdk}/extension/doctor.js +7 -7
- package/dist/sdk/extension/doctor.js.map +1 -0
- package/dist/sdk/extension/install-runtime.d.ts +26 -0
- package/dist/sdk/extension/install-runtime.js +269 -0
- package/dist/sdk/extension/install-runtime.js.map +1 -0
- package/dist/sdk/extension/install-snapshot.d.ts +23 -0
- package/dist/sdk/extension/install-snapshot.js +66 -0
- package/dist/sdk/extension/install-snapshot.js.map +1 -0
- package/dist/{cli/commands → sdk}/extension/install-sources.d.ts +3 -3
- package/dist/{cli/commands → sdk}/extension/install-sources.js +15 -12
- package/dist/sdk/extension/install-sources.js.map +1 -0
- package/dist/{cli/commands → sdk}/extension/managed-state.js +6 -6
- package/dist/sdk/extension/managed-state.js.map +1 -0
- package/dist/sdk/extension/scaffold.d.ts +36 -0
- package/dist/sdk/extension/scaffold.js +2436 -0
- package/dist/sdk/extension/scaffold.js.map +1 -0
- package/dist/sdk/extension/shared.d.ts +28 -0
- package/dist/sdk/extension/shared.js +140 -0
- package/dist/sdk/extension/shared.js.map +1 -0
- package/dist/sdk/extension/update-check.d.ts +15 -0
- package/dist/sdk/extension/update-check.js +68 -0
- package/dist/sdk/extension/update-check.js.map +1 -0
- package/dist/sdk/extension.d.ts +367 -0
- package/dist/sdk/extension.js +2174 -0
- package/dist/sdk/extension.js.map +1 -0
- package/dist/sdk/governance/gc.d.ts +56 -0
- package/dist/sdk/governance/gc.js +276 -0
- package/dist/sdk/governance/gc.js.map +1 -0
- package/dist/sdk/governance/health.d.ts +187 -0
- package/dist/sdk/governance/health.js +1796 -0
- package/dist/sdk/governance/health.js.map +1 -0
- package/dist/sdk/governance/validate.d.ts +255 -0
- package/dist/sdk/governance/validate.js +2175 -0
- package/dist/sdk/governance/validate.js.map +1 -0
- package/dist/sdk/history-compact.d.ts +142 -0
- package/dist/sdk/history-compact.js +508 -0
- package/dist/sdk/history-compact.js.map +1 -0
- package/dist/sdk/history-mcp.d.ts +17 -0
- package/dist/sdk/history-mcp.js +68 -0
- package/dist/sdk/history-mcp.js.map +1 -0
- package/dist/sdk/history-read.d.ts +31 -0
- package/dist/sdk/history-read.js +58 -0
- package/dist/sdk/history-read.js.map +1 -0
- package/dist/sdk/history-redact.d.ts +120 -0
- package/dist/sdk/history-redact.js +577 -0
- package/dist/sdk/history-redact.js.map +1 -0
- package/dist/sdk/history-repair.d.ts +89 -0
- package/dist/sdk/history-repair.js +263 -0
- package/dist/sdk/history-repair.js.map +1 -0
- package/dist/sdk/index.d.ts +25 -1
- package/dist/sdk/index.js +27 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/init-agent-guidance.d.ts +113 -0
- package/dist/sdk/init-agent-guidance.js +437 -0
- package/dist/sdk/init-agent-guidance.js.map +1 -0
- package/dist/sdk/init.d.ts +186 -0
- package/dist/sdk/init.js +733 -0
- package/dist/sdk/init.js.map +1 -0
- package/dist/sdk/invocation-author.d.ts +2 -0
- package/dist/sdk/invocation-author.js +39 -0
- package/dist/sdk/invocation-author.js.map +1 -0
- package/dist/sdk/item-children.d.ts +45 -0
- package/dist/sdk/item-children.js +75 -0
- package/dist/sdk/item-children.js.map +1 -0
- package/dist/sdk/item-schedule.d.ts +26 -0
- package/dist/sdk/item-schedule.js +28 -0
- package/dist/sdk/item-schedule.js.map +1 -0
- package/dist/sdk/output.d.ts +7 -0
- package/dist/sdk/output.js +11 -0
- package/dist/sdk/output.js.map +1 -0
- package/dist/sdk/pagination.d.ts +4 -1
- package/dist/sdk/pagination.js +13 -5
- package/dist/sdk/pagination.js.map +1 -1
- package/dist/sdk/profile.d.ts +176 -0
- package/dist/sdk/profile.js +431 -0
- package/dist/sdk/profile.js.map +1 -0
- package/dist/sdk/relationship-analytics.d.ts +108 -0
- package/dist/sdk/relationship-analytics.js +292 -0
- package/dist/sdk/relationship-analytics.js.map +1 -0
- package/dist/sdk/relationship-context.d.ts +67 -0
- package/dist/sdk/relationship-context.js +207 -0
- package/dist/sdk/relationship-context.js.map +1 -0
- package/dist/sdk/relationship-history.d.ts +109 -0
- package/dist/sdk/relationship-history.js +401 -0
- package/dist/sdk/relationship-history.js.map +1 -0
- package/dist/sdk/relationships.d.ts +145 -0
- package/dist/sdk/relationships.js +551 -0
- package/dist/sdk/relationships.js.map +1 -0
- package/dist/sdk/runtime-input.d.ts +10 -0
- package/dist/sdk/runtime-input.js +60 -0
- package/dist/sdk/runtime-input.js.map +1 -0
- package/dist/sdk/runtime.d.ts +31 -8
- package/dist/sdk/runtime.js +61 -57
- package/dist/sdk/runtime.js.map +1 -1
- package/dist/sdk/schema.d.ts +507 -0
- package/dist/sdk/schema.js +1269 -0
- package/dist/sdk/schema.js.map +1 -0
- package/dist/{cli/commands → sdk}/templates.d.ts +1 -1
- package/dist/{cli/commands → sdk}/templates.js +9 -9
- package/dist/sdk/templates.js.map +1 -0
- package/dist/{cli/commands → sdk}/test/linked-command-detection.d.ts +10 -2
- package/dist/sdk/test/linked-command-detection.js +525 -0
- package/dist/sdk/test/linked-command-detection.js.map +1 -0
- package/docs/COMMANDS.md +58 -40
- package/docs/EXTENSIONS.md +10 -1
- package/docs/RELATIONSHIP_GRAPH.md +113 -0
- package/docs/RELEASING.md +2 -0
- package/docs/SDK.md +156 -9
- package/docs/SDK_CUSTOMIZATION_PRIMITIVES.md +79 -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/extensions/governance-audit/runtime-utils.ts +76 -16
- package/packages/pm-governance-audit/extensions/governance-audit/sdk.ts +8 -0
- 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/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/bundle-cli.mjs +66 -23
- package/dist/cli/commands/extension/bundled-catalog.js.map +0 -1
- package/dist/cli/commands/extension/doctor.js.map +0 -1
- package/dist/cli/commands/extension/install-sources.js.map +0 -1
- package/dist/cli/commands/extension/managed-state.js.map +0 -1
- package/dist/cli/commands/templates.js.map +0 -1
- package/dist/cli/commands/test/linked-command-detection.js +0 -248
- package/dist/cli/commands/test/linked-command-detection.js.map +0 -1
- package/dist/cli-bundle/chunks/append-DYQWQK2J.js +0 -11
- package/dist/cli-bundle/chunks/chunk-2GA3NK35.js +0 -530
- package/dist/cli-bundle/chunks/chunk-2GA3NK35.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-2QIQGYPW.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4DY4KPQI.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4WREH7RT.js +0 -554
- package/dist/cli-bundle/chunks/chunk-4WREH7RT.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-5CT5BW6E.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-5URI7TPJ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6MHSBDGD.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6OTZMORS.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6PKA3SJQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-6TTOHMTB.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7QDSYUMF.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7TQMR6LK.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-B5DZYTT3.js +0 -312
- package/dist/cli-bundle/chunks/chunk-B5DZYTT3.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-BPD26E3P.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-CDJYP7OQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-DBZVUJTK.js +0 -858
- package/dist/cli-bundle/chunks/chunk-DBZVUJTK.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-DVOLZJ3C.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-DYEX6NFH.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-F7PSHRNO.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-FO7GMJKG.js +0 -875
- package/dist/cli-bundle/chunks/chunk-FO7GMJKG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-FTQLW4JD.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-IA3YFTXT.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-IGED7NH2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-J4NZOP3I.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-JL7WZ4O2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-L24HCJFC.js +0 -309
- package/dist/cli-bundle/chunks/chunk-L24HCJFC.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-LWTIRS3Y.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-MKL4CP2I.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-N3CMP4NI.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-PHKP3AGR.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-Q37E63AM.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-QASRVKUQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-RGXD5JJR.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-UB2QYSTO.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-UGTVWL3E.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-ZAYYDNB3.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-ZUKSZVBW.js.map +0 -7
- package/dist/cli-bundle/chunks/close-RI4JQQHU.js +0 -12
- package/dist/cli-bundle/chunks/close-many-LY2XJ52M.js +0 -21
- package/dist/cli-bundle/chunks/comments-35M273DN.js +0 -13
- package/dist/cli-bundle/chunks/copy-NPYM7M7U.js +0 -9
- package/dist/cli-bundle/chunks/delete-ODRWJWAM.js +0 -10
- package/dist/cli-bundle/chunks/docs-G7N4E2JO.js +0 -14
- package/dist/cli-bundle/chunks/focus-U5TRVCRS.js +0 -10
- package/dist/cli-bundle/chunks/history-compact-M7GHYVFN.js +0 -20
- package/dist/cli-bundle/chunks/history-redact-JIHZLHDP.js +0 -16
- package/dist/cli-bundle/chunks/history-repair-NAFCHLH7.js +0 -18
- package/dist/cli-bundle/chunks/learnings-SONGPSHI.js +0 -13
- package/dist/cli-bundle/chunks/notes-BSD53H2W.js +0 -13
- package/dist/cli-bundle/chunks/plan-AWLYGBNV.js +0 -24
- package/dist/cli-bundle/chunks/register-list-query-BUWCYHBT.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-KTZ6AGE7.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-4FMGJJF7.js.map +0 -1
- package/dist/cli-bundle/chunks/restore-66GLMHIX.js +0 -14
- package/dist/cli-bundle/chunks/update-2XGHIVQ2.js +0 -21
- package/dist/cli-bundle/chunks/update-many-75K57FS3.js +0 -34
- package/dist/cli-bundle/chunks/update-many-U42YA445.js +0 -30
- /package/dist/cli-bundle/chunks/{append-PVZJDM6J.js.map → append-OJQFUQ4T.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-DYQWQK2J.js.map → append-UZVHUO74.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MQZ3PLCF.js.map → chunk-2IFFUZLC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-P6MYFH6K.js.map → chunk-2JKGO6QX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-X3GYR4P2.js.map → chunk-2NCIPMQP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Q7E6OYZK.js.map → chunk-2VPAVL7O.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DRNJPEPQ.js.map → chunk-2WSE6PO2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FDSBDNYE.js.map → chunk-34L5OT3Y.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TH7U4KLY.js.map → chunk-3AUGG2DP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-NKW36AMT.js.map → chunk-3CLU2XZO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ABRCOSDC.js.map → chunk-3WM75PWC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-X6BVXQ52.js.map → chunk-5JLUII3O.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3TL7WOEF.js.map → chunk-6N2VXVTQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ERL2YFJ2.js.map → chunk-6S3YSUYG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IFZA4VB5.js.map → chunk-AHVTB5I5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DO5RGJXT.js.map → chunk-APRVSW2O.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-NAQYVWSQ.js.map → chunk-B7PE22W6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MD6ULIPJ.js.map → chunk-BCOFWYW4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KADLSPIU.js.map → chunk-BEP7WJA2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OBDLEQG5.js.map → chunk-CRVF2JDM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FJZDA6MS.js.map → chunk-DM4H7FP4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-LZECOMHO.js.map → chunk-DUT67M43.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-44LNIULG.js.map → chunk-DYH63FX7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HAMLIWAF.js.map → chunk-EAB64KLB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CIOZ376P.js.map → chunk-EACOH7AU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QK2ZN6UL.js.map → chunk-EJEXHTY5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WQUEHPZB.js.map → chunk-EYLCSJAI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-655STMGA.js.map → chunk-FMBNM2EN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RMF3IOYQ.js.map → chunk-FNSPG7MU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KB726FMH.js.map → chunk-H2Z3FYXQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-BN62TO2S.js.map → chunk-IA5FKNII.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-W6HZ55JO.js.map → chunk-IJIICKVW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-M7EWN4TF.js.map → chunk-JOUQZENX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2FNWQXZ2.js.map → chunk-JYFOV7FC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HLHSQ5CA.js.map → chunk-K2X6U4UA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-M6ASXYCU.js.map → chunk-KG44YSKD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YVKE5ZDM.js.map → chunk-KPMKHGEA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-ZHI6A5TN.js.map → chunk-MIQDDLB5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UJ4HJYWL.js.map → chunk-NLDFBC6J.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WRKB56FC.js.map → chunk-NP22ERDF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YQYG2V23.js.map → chunk-NU3IMIEA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3I3LRT2G.js.map → chunk-NVPZIJVR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JAF4TUQ7.js.map → chunk-ODALILG3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QZ7LT3XE.js.map → chunk-ONREO4ST.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3CMRNVTO.js.map → chunk-P74IZQ7A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZTRBSABY.js.map → chunk-PGY23YTC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-H2QBAKLQ.js.map → chunk-PMOSXADO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-RI4JQQHU.js.map → chunk-PNTULOGU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GSEADLRH.js.map → chunk-Q7A43DS4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QSPARJWF.js.map → chunk-QEHQ2GVG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VJTAEIPC.js.map → chunk-QIPLHNP7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-K7WNZ7KD.js.map → chunk-QKJGPFAF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZNP64HOW.js.map → chunk-RLCHOOHC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IAPHYPRL.js.map → chunk-RMLWNPH2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UVBA6F5A.js.map → chunk-RRM5JYJC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6IIVBC56.js.map → chunk-S6MQESFR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QABYZYLU.js.map → chunk-SDQLJWBO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ANSJHDOZ.js.map → chunk-SELVXEZK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WD6MSYMP.js.map → chunk-TKOVBP6C.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TZ2PSLLT.js.map → chunk-TQSZFPIS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WPAWZW7S.js.map → chunk-TSMHDIW4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TZRTLMWM.js.map → chunk-UFXU44HV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TWLDBKQU.js.map → chunk-ULTHRDBP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RA5AIAMP.js.map → chunk-UOHFKBUV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4RXTMU57.js.map → chunk-UY2ACEMF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FIGXOCEQ.js.map → chunk-WUJQK4YV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-T4BRCB6Z.js.map → chunk-XSJUSQAE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UKUIIBDW.js.map → chunk-YAQEBNY7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-E2WC6S4P.js.map → chunk-YBLZ2VE7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Y72FV7RM.js.map → chunk-YCQET3OT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-LY2XJ52M.js.map → chunk-YUSOJDWM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FS6UM5WH.js.map → chunk-ZI6VQWQ7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-AJWRTFZ5.js.map → close-CWODTPKG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-35M273DN.js.map → close-W6LI2PKM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-GMXYKBXT.js.map → close-many-CQFUY7MR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-NPYM7M7U.js.map → close-many-DLDDVSH5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-F53OBTOU.js.map → comments-E3TNTK24.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-HU4Q7RJX.js.map → comments-WGLHR7LB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-GSDZLTRC.js.map → copy-LXVDXH7B.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-ODRWJWAM.js.map → copy-Q5ZJPUKR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-U57I7EAK.js.map → create-J5U6ND4K.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-WWB7P2GT.js.map → create-LBVCYMEG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-MQIY2ZQS.js.map → delete-PMJBNY5G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-G7N4E2JO.js.map → delete-WNHB3LYW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-TTY6N2AV.js.map → deps-JZ7TMVCB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-TBZD7V6H.js.map → deps-OA26IS25.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{focus-XT6YVFFX.js.map → docs-FEWB2DQB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{focus-U5TRVCRS.js.map → docs-HA2AIDBB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-M7GHYVFN.js.map → files-6YFBJRBG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-KKVUWB4V.js.map → files-EFIWKFTM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-3DVZOILD.js.map → focus-4QJR7FOQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-JIHZLHDP.js.map → focus-POIW5LTJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-ITDUMK4N.js.map → history-compact-CKRPDTJN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-NAFCHLH7.js.map → history-compact-FWG2C7FZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-SONGPSHI.js.map → history-redact-BB3TGDAE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-FGO3NSFW.js.map → history-redact-D225BHOZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-BSD53H2W.js.map → history-repair-6GEAM7HE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-NQ6RXVW6.js.map → history-repair-RQXKQHL4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-2NNEO46V.js.map → learnings-JLNLCOL5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-AWLYGBNV.js.map → learnings-RSNLSWDC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-U725ATWZ.js.map → notes-2WDH6DXU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-AAQUU6T3.js.map → notes-GB47XXQQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-66GLMHIX.js.map → plan-DOVI2VMW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-B3BAB6X2.js.map → plan-VDCJ2PCN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-U7IM2DXV.js.map → profile-FAU7NZML.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-LZNUYHDB.js.map → profile-IVXQEL3D.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-Q3UCILNR.js.map → restore-25DLT2Q2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-2XGHIVQ2.js.map → restore-YPMVUUEX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-75K57FS3.js.map → schema-FNU3WE4O.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-U42YA445.js.map → schema-NBCM3RAD.js.map} +0 -0
- /package/dist/{cli/commands → sdk}/extension/managed-state.d.ts +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HistoryEntry, HistoryPatchOp } from "../../types/index.js";
|
|
2
|
+
import { type ReplayDocument } from "./replay.js";
|
|
3
|
+
/** Describes the normalized version or timestamp selected from a history stream. */
|
|
4
|
+
export interface ResolvedHistoryTarget {
|
|
5
|
+
/** Target syntax selected by the caller. */
|
|
6
|
+
kind: "version" | "timestamp";
|
|
7
|
+
/** Original normalized target text. */
|
|
8
|
+
raw: string;
|
|
9
|
+
/** Zero-based history entry selected for reconstruction. */
|
|
10
|
+
historyIndex: number;
|
|
11
|
+
}
|
|
12
|
+
/** Controls caller-specific target diagnostics and future timestamp policy. */
|
|
13
|
+
export interface ResolveHistoryTargetOptions {
|
|
14
|
+
/** Command concept named in agent-facing validation errors. */
|
|
15
|
+
errorSubject?: "history" | "restore";
|
|
16
|
+
/** Allow a timestamp after the final entry to select that final entry. */
|
|
17
|
+
allowFutureTimestamp?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface PatchFailureContext {
|
|
20
|
+
patchIndex?: number;
|
|
21
|
+
op?: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
from?: string;
|
|
24
|
+
reason?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Extract best-effort JSON Patch position details for replay diagnostics. */
|
|
27
|
+
export declare function extractPatchFailureContext(patch: HistoryPatchOp[], error: unknown): PatchFailureContext;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a one-based version or ISO timestamp into a concrete history entry.
|
|
30
|
+
* Errors include structured valid-range metadata for agent and SDK callers.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveHistoryTarget(target: string, history: readonly HistoryEntry[], options?: ResolveHistoryTargetOptions): ResolvedHistoryTarget;
|
|
33
|
+
/** Apply one normalized JSON Patch entry and retain actionable failure context. */
|
|
34
|
+
export declare function applyHistoryPatch(current: ReplayDocument, patch: HistoryPatchOp[], entryNumber: number, entryOp: string): ReplayDocument;
|
|
35
|
+
/** Replay and hash-verify a history stream through a zero-based target entry. */
|
|
36
|
+
export declare function replayHistoryToTarget(history: readonly HistoryEntry[], targetIndex: number): ReplayDocument;
|
|
37
|
+
/** Reject a version whose reconstructed state represents a deleted item. */
|
|
38
|
+
export declare function ensureMaterializedHistoryTarget(replayDocument: ReplayDocument, target: ResolvedHistoryTarget): ReplayDocument;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/history/projection
|
|
3
|
+
*
|
|
4
|
+
* Reconstructs verified point-in-time item states from hash-chained history.
|
|
5
|
+
* Restore, SDK reads, and future VCS-style integrations share this single
|
|
6
|
+
* replay kernel so read and write paths cannot disagree about a version.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fa3aee60-a6a6-5958-a4e6-c754b07fb607")}catch(e){}}();
|
|
10
|
+
import { EXIT_CODE } from "../shared/constants.js";
|
|
11
|
+
import { PmCliError } from "../shared/errors.js";
|
|
12
|
+
import { EMPTY_REPLAY_DOCUMENT, replayHash, tryApplyReplayPatch, } from "./replay.js";
|
|
13
|
+
/** Find the final history entry recorded at or before a parsed timestamp. */
|
|
14
|
+
function findHistoryIndexAtTimestamp(history, parsedTarget) {
|
|
15
|
+
let historyIndex = -1;
|
|
16
|
+
history.forEach((entry, index) => {
|
|
17
|
+
const entryTimestamp = Date.parse(entry.ts);
|
|
18
|
+
if (!Number.isFinite(entryTimestamp)) {
|
|
19
|
+
throw new PmCliError(`History for this item contains invalid timestamp at entry ${index + 1}.`, EXIT_CODE.GENERIC_FAILURE);
|
|
20
|
+
}
|
|
21
|
+
if (entryTimestamp <= parsedTarget) {
|
|
22
|
+
historyIndex = index;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return historyIndex;
|
|
26
|
+
}
|
|
27
|
+
/** Build structured target-range guidance once for every resolver error path. */
|
|
28
|
+
function buildHistoryTargetGuidance(history) {
|
|
29
|
+
const firstTimestamp = history[0]?.ts ?? null;
|
|
30
|
+
const lastTimestamp = history.at(-1)?.ts ?? null;
|
|
31
|
+
const guidance = {
|
|
32
|
+
code: "history_target_out_of_range",
|
|
33
|
+
required: "Choose a target within the available item history.",
|
|
34
|
+
why: "Point-in-time reads and restores can only reconstruct recorded versions.",
|
|
35
|
+
examples: [],
|
|
36
|
+
nextSteps: [
|
|
37
|
+
"Run pm history <id> to inspect available versions and timestamps.",
|
|
38
|
+
],
|
|
39
|
+
valid_range: {
|
|
40
|
+
first_version: null,
|
|
41
|
+
last_version: null,
|
|
42
|
+
first_timestamp: firstTimestamp,
|
|
43
|
+
last_timestamp: lastTimestamp,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
if (lastTimestamp !== null) {
|
|
47
|
+
guidance.examples = ["1", String(history.length), lastTimestamp];
|
|
48
|
+
guidance.valid_range.first_version = 1;
|
|
49
|
+
guidance.valid_range.last_version = history.length;
|
|
50
|
+
}
|
|
51
|
+
return { guidance, lastTimestamp };
|
|
52
|
+
}
|
|
53
|
+
/** Extract best-effort JSON Patch position details for replay diagnostics. */
|
|
54
|
+
export function extractPatchFailureContext(patch, error) {
|
|
55
|
+
const failure = {};
|
|
56
|
+
if (error instanceof Error && error.message.trim().length > 0) {
|
|
57
|
+
failure.reason = error.message.trim();
|
|
58
|
+
}
|
|
59
|
+
if (typeof error !== "object" || error === null) {
|
|
60
|
+
return failure;
|
|
61
|
+
}
|
|
62
|
+
const candidate = error;
|
|
63
|
+
if (typeof candidate.index === "number" &&
|
|
64
|
+
Number.isInteger(candidate.index) &&
|
|
65
|
+
candidate.index >= 0) {
|
|
66
|
+
failure.patchIndex = candidate.index;
|
|
67
|
+
}
|
|
68
|
+
if (typeof candidate.operation === "object" && candidate.operation !== null) {
|
|
69
|
+
const operation = candidate.operation;
|
|
70
|
+
Object.assign(failure, Object.fromEntries(["op", "path", "from"].flatMap((field) => {
|
|
71
|
+
const value = operation[field];
|
|
72
|
+
return typeof value === "string" ? [[field, value]] : [];
|
|
73
|
+
})));
|
|
74
|
+
}
|
|
75
|
+
if (failure.patchIndex !== undefined) {
|
|
76
|
+
const fallback = patch[failure.patchIndex];
|
|
77
|
+
if (fallback) {
|
|
78
|
+
failure.op ??= fallback.op;
|
|
79
|
+
failure.path ??= fallback.path;
|
|
80
|
+
failure.from ??= fallback.from;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return failure;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Resolve a one-based version or ISO timestamp into a concrete history entry.
|
|
87
|
+
* Errors include structured valid-range metadata for agent and SDK callers.
|
|
88
|
+
*/
|
|
89
|
+
export function resolveHistoryTarget(target, history, options = {}) {
|
|
90
|
+
const trimmed = target.trim();
|
|
91
|
+
const errorSubject = options.errorSubject ?? "history";
|
|
92
|
+
const errorSubjectTitle = errorSubject === "restore" ? "Restore" : "History";
|
|
93
|
+
const { guidance, lastTimestamp } = buildHistoryTargetGuidance(history);
|
|
94
|
+
if (!trimmed) {
|
|
95
|
+
throw new PmCliError(`Missing ${errorSubject} target. Use a timestamp or version number.`, EXIT_CODE.USAGE, guidance);
|
|
96
|
+
}
|
|
97
|
+
if (/^\d+$/.test(trimmed)) {
|
|
98
|
+
const version = Number(trimmed);
|
|
99
|
+
if (!Number.isSafeInteger(version) ||
|
|
100
|
+
version < 1 ||
|
|
101
|
+
version > history.length) {
|
|
102
|
+
throw new PmCliError(`${errorSubjectTitle} version must be between 1 and ${history.length} for this item.`, EXIT_CODE.USAGE, guidance);
|
|
103
|
+
}
|
|
104
|
+
return { kind: "version", raw: trimmed, historyIndex: version - 1 };
|
|
105
|
+
}
|
|
106
|
+
const parsedTarget = Date.parse(trimmed);
|
|
107
|
+
if (!Number.isFinite(parsedTarget)) {
|
|
108
|
+
throw new PmCliError(`Invalid ${errorSubject} target "${target}". Use a positive version number or ISO timestamp.`, EXIT_CODE.USAGE, guidance);
|
|
109
|
+
}
|
|
110
|
+
const historyIndex = findHistoryIndexAtTimestamp(history, parsedTarget);
|
|
111
|
+
if (historyIndex < 0 ||
|
|
112
|
+
(options.allowFutureTimestamp !== true &&
|
|
113
|
+
parsedTarget > Date.parse(lastTimestamp))) {
|
|
114
|
+
throw new PmCliError(errorSubject === "restore"
|
|
115
|
+
? `No history entries exist at or before timestamp ${trimmed}.`
|
|
116
|
+
: `No history entry exists at timestamp ${trimmed}.`, EXIT_CODE.USAGE, guidance);
|
|
117
|
+
}
|
|
118
|
+
return { kind: "timestamp", raw: trimmed, historyIndex };
|
|
119
|
+
}
|
|
120
|
+
/** Apply one normalized JSON Patch entry and retain actionable failure context. */
|
|
121
|
+
export function applyHistoryPatch(current, patch, entryNumber, entryOp) {
|
|
122
|
+
const applied = tryApplyReplayPatch(current, patch);
|
|
123
|
+
if (applied.ok) {
|
|
124
|
+
return applied.document;
|
|
125
|
+
}
|
|
126
|
+
const failure = extractPatchFailureContext(patch, applied.error);
|
|
127
|
+
const tokens = [
|
|
128
|
+
`history_op=${entryOp}`,
|
|
129
|
+
failure.patchIndex === undefined
|
|
130
|
+
? null
|
|
131
|
+
: `patch_index=${failure.patchIndex}`,
|
|
132
|
+
failure.op ? `op=${failure.op}` : null,
|
|
133
|
+
failure.path ? `path=${failure.path}` : null,
|
|
134
|
+
failure.from ? `from=${failure.from}` : null,
|
|
135
|
+
].filter((token) => token !== null);
|
|
136
|
+
throw new PmCliError(`Failed to apply history patch at entry ${entryNumber} (${tokens.join(", ")}). ${failure.reason ?? String(applied.error)}`, EXIT_CODE.GENERIC_FAILURE);
|
|
137
|
+
}
|
|
138
|
+
/** Replay and hash-verify a history stream through a zero-based target entry. */
|
|
139
|
+
export function replayHistoryToTarget(history, targetIndex) {
|
|
140
|
+
let document = structuredClone(EMPTY_REPLAY_DOCUMENT);
|
|
141
|
+
for (let index = 0; index <= targetIndex; index += 1) {
|
|
142
|
+
const entry = history[index];
|
|
143
|
+
if (!entry) {
|
|
144
|
+
throw new PmCliError(`History target entry ${index + 1} does not exist.`, EXIT_CODE.USAGE);
|
|
145
|
+
}
|
|
146
|
+
if (replayHash(document) !== entry.before_hash) {
|
|
147
|
+
throw new PmCliError(`History hash mismatch before replay at entry ${index + 1}.`, EXIT_CODE.GENERIC_FAILURE);
|
|
148
|
+
}
|
|
149
|
+
document = applyHistoryPatch(document, entry.patch, index + 1, entry.op);
|
|
150
|
+
if (replayHash(document) !== entry.after_hash) {
|
|
151
|
+
throw new PmCliError(`History hash mismatch after replay at entry ${index + 1}.`, EXIT_CODE.GENERIC_FAILURE);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return document;
|
|
155
|
+
}
|
|
156
|
+
/** Reject a version whose reconstructed state represents a deleted item. */
|
|
157
|
+
export function ensureMaterializedHistoryTarget(replayDocument, target) {
|
|
158
|
+
if (Object.keys(replayDocument.metadata).length > 0) {
|
|
159
|
+
return replayDocument;
|
|
160
|
+
}
|
|
161
|
+
throw new PmCliError(`History target ${target.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`, EXIT_CODE.USAGE);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=projection.js.map
|
|
164
|
+
//# debugId=fa3aee60-a6a6-5958-a4e6-c754b07fb607
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.js","sources":["core/history/projection.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/history/projection\n *\n * Reconstructs verified point-in-time item states from hash-chained history.\n * Restore, SDK reads, and future VCS-style integrations share this single\n * replay kernel so read and write paths cannot disagree about a version.\n */\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport type { HistoryEntry, HistoryPatchOp } from \"../../types/index.js\";\nimport {\n EMPTY_REPLAY_DOCUMENT,\n replayHash,\n tryApplyReplayPatch,\n type ReplayDocument,\n} from \"./replay.js\";\n\n/** Describes the normalized version or timestamp selected from a history stream. */\nexport interface ResolvedHistoryTarget {\n /** Target syntax selected by the caller. */\n kind: \"version\" | \"timestamp\";\n /** Original normalized target text. */\n raw: string;\n /** Zero-based history entry selected for reconstruction. */\n historyIndex: number;\n}\n\n/** Controls caller-specific target diagnostics and future timestamp policy. */\nexport interface ResolveHistoryTargetOptions {\n /** Command concept named in agent-facing validation errors. */\n errorSubject?: \"history\" | \"restore\";\n /** Allow a timestamp after the final entry to select that final entry. */\n allowFutureTimestamp?: boolean;\n}\n\ninterface PatchFailureContext {\n patchIndex?: number;\n op?: string;\n path?: string;\n from?: string;\n reason?: string;\n}\n\n/** Find the final history entry recorded at or before a parsed timestamp. */\nfunction findHistoryIndexAtTimestamp(\n history: readonly HistoryEntry[],\n parsedTarget: number,\n): number {\n let historyIndex = -1;\n history.forEach((entry, index) => {\n const entryTimestamp = Date.parse(entry.ts);\n if (!Number.isFinite(entryTimestamp)) {\n throw new PmCliError(\n `History for this item contains invalid timestamp at entry ${index + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (entryTimestamp <= parsedTarget) {\n historyIndex = index;\n }\n });\n return historyIndex;\n}\n\n/** Build structured target-range guidance once for every resolver error path. */\nfunction buildHistoryTargetGuidance(history: readonly HistoryEntry[]) {\n const firstTimestamp = history[0]?.ts ?? null;\n const lastTimestamp = history.at(-1)?.ts ?? null;\n const guidance = {\n code: \"history_target_out_of_range\",\n required: \"Choose a target within the available item history.\",\n why: \"Point-in-time reads and restores can only reconstruct recorded versions.\",\n examples: [] as string[],\n nextSteps: [\n \"Run pm history <id> to inspect available versions and timestamps.\",\n ],\n valid_range: {\n first_version: null as number | null,\n last_version: null as number | null,\n first_timestamp: firstTimestamp,\n last_timestamp: lastTimestamp,\n },\n };\n if (lastTimestamp !== null) {\n guidance.examples = [\"1\", String(history.length), lastTimestamp];\n guidance.valid_range.first_version = 1;\n guidance.valid_range.last_version = history.length;\n }\n return { guidance, lastTimestamp };\n}\n\n/** Extract best-effort JSON Patch position details for replay diagnostics. */\nexport function extractPatchFailureContext(\n patch: HistoryPatchOp[],\n error: unknown,\n): PatchFailureContext {\n const failure: PatchFailureContext = {};\n if (error instanceof Error && error.message.trim().length > 0) {\n failure.reason = error.message.trim();\n }\n if (typeof error !== \"object\" || error === null) {\n return failure;\n }\n const candidate = error as { index?: unknown; operation?: unknown };\n if (\n typeof candidate.index === \"number\" &&\n Number.isInteger(candidate.index) &&\n candidate.index >= 0\n ) {\n failure.patchIndex = candidate.index;\n }\n if (typeof candidate.operation === \"object\" && candidate.operation !== null) {\n const operation = candidate.operation as Record<string, unknown>;\n Object.assign(\n failure,\n Object.fromEntries(\n ([\"op\", \"path\", \"from\"] as const).flatMap((field) => {\n const value = operation[field];\n return typeof value === \"string\" ? [[field, value]] : [];\n }),\n ),\n );\n }\n if (failure.patchIndex !== undefined) {\n const fallback = patch[failure.patchIndex];\n if (fallback) {\n failure.op ??= fallback.op;\n failure.path ??= fallback.path;\n failure.from ??= fallback.from;\n }\n }\n return failure;\n}\n\n/**\n * Resolve a one-based version or ISO timestamp into a concrete history entry.\n * Errors include structured valid-range metadata for agent and SDK callers.\n */\nexport function resolveHistoryTarget(\n target: string,\n history: readonly HistoryEntry[],\n options: ResolveHistoryTargetOptions = {},\n): ResolvedHistoryTarget {\n const trimmed = target.trim();\n const errorSubject = options.errorSubject ?? \"history\";\n const errorSubjectTitle = errorSubject === \"restore\" ? \"Restore\" : \"History\";\n const { guidance, lastTimestamp } = buildHistoryTargetGuidance(history);\n if (!trimmed) {\n throw new PmCliError(\n `Missing ${errorSubject} target. Use a timestamp or version number.`,\n EXIT_CODE.USAGE,\n guidance,\n );\n }\n if (/^\\d+$/.test(trimmed)) {\n const version = Number(trimmed);\n if (\n !Number.isSafeInteger(version) ||\n version < 1 ||\n version > history.length\n ) {\n throw new PmCliError(\n `${errorSubjectTitle} version must be between 1 and ${history.length} for this item.`,\n EXIT_CODE.USAGE,\n guidance,\n );\n }\n return { kind: \"version\", raw: trimmed, historyIndex: version - 1 };\n }\n const parsedTarget = Date.parse(trimmed);\n if (!Number.isFinite(parsedTarget)) {\n throw new PmCliError(\n `Invalid ${errorSubject} target \"${target}\". Use a positive version number or ISO timestamp.`,\n EXIT_CODE.USAGE,\n guidance,\n );\n }\n const historyIndex = findHistoryIndexAtTimestamp(history, parsedTarget);\n if (\n historyIndex < 0 ||\n (options.allowFutureTimestamp !== true &&\n parsedTarget > Date.parse(lastTimestamp as string))\n ) {\n throw new PmCliError(\n errorSubject === \"restore\"\n ? `No history entries exist at or before timestamp ${trimmed}.`\n : `No history entry exists at timestamp ${trimmed}.`,\n EXIT_CODE.USAGE,\n guidance,\n );\n }\n return { kind: \"timestamp\", raw: trimmed, historyIndex };\n}\n\n/** Apply one normalized JSON Patch entry and retain actionable failure context. */\nexport function applyHistoryPatch(\n current: ReplayDocument,\n patch: HistoryPatchOp[],\n entryNumber: number,\n entryOp: string,\n): ReplayDocument {\n const applied = tryApplyReplayPatch(current, patch);\n if (applied.ok) {\n return applied.document;\n }\n const failure = extractPatchFailureContext(patch, applied.error);\n const tokens = [\n `history_op=${entryOp}`,\n failure.patchIndex === undefined\n ? null\n : `patch_index=${failure.patchIndex}`,\n failure.op ? `op=${failure.op}` : null,\n failure.path ? `path=${failure.path}` : null,\n failure.from ? `from=${failure.from}` : null,\n ].filter((token): token is string => token !== null);\n throw new PmCliError(\n `Failed to apply history patch at entry ${entryNumber} (${tokens.join(\", \")}). ${failure.reason ?? String(applied.error)}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n}\n\n/** Replay and hash-verify a history stream through a zero-based target entry. */\nexport function replayHistoryToTarget(\n history: readonly HistoryEntry[],\n targetIndex: number,\n): ReplayDocument {\n let document: ReplayDocument = structuredClone(EMPTY_REPLAY_DOCUMENT);\n for (let index = 0; index <= targetIndex; index += 1) {\n const entry = history[index];\n if (!entry) {\n throw new PmCliError(\n `History target entry ${index + 1} does not exist.`,\n EXIT_CODE.USAGE,\n );\n }\n if (replayHash(document) !== entry.before_hash) {\n throw new PmCliError(\n `History hash mismatch before replay at entry ${index + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n document = applyHistoryPatch(document, entry.patch, index + 1, entry.op);\n if (replayHash(document) !== entry.after_hash) {\n throw new PmCliError(\n `History hash mismatch after replay at entry ${index + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n return document;\n}\n\n/** Reject a version whose reconstructed state represents a deleted item. */\nexport function ensureMaterializedHistoryTarget(\n replayDocument: ReplayDocument,\n target: ResolvedHistoryTarget,\n): ReplayDocument {\n if (Object.keys(replayDocument.metadata).length > 0) {\n return replayDocument;\n }\n throw new PmCliError(\n `History target ${target.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,\n EXIT_CODE.USAGE,\n );\n}\n"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AA4BrB,6EAA6E;AAC7E,SAAS,2BAA2B,CAClC,OAAgC,EAChC,YAAoB;IAEpB,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC;IACtB,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC/B,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,UAAU,CAClB,6DAA6D,KAAK,GAAG,CAAC,GAAG,EACzE,SAAS,CAAC,eAAe,CAC1B,CAAC;QACJ,CAAC;QACD,IAAI,cAAc,IAAI,YAAY,EAAE,CAAC;YACnC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,iFAAiF;AACjF,SAAS,0BAA0B,CAAC,OAAgC;IAClE,MAAM,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,IAA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AM,UAAU,+BAA+B,CAC7C,cAA8B,EAC9B,MAA6B;IAE7B,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,MAAM,IAAI,UAAU,CAClB,kBAAkB,MAAM,CAAC,GAAG,oFAAoF,EAChH,SAAS,CAAC,KAAK,CAChB,CAAC;AACJ,CAAC","debugId":"fa3aee60-a6a6-5958-a4e6-c754b07fb607"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/history/read
|
|
3
|
+
*
|
|
4
|
+
* Reads append-only item history streams with conflict-marker detection,
|
|
5
|
+
* extension read hooks, and line-specific JSONL diagnostics. Keeping this
|
|
6
|
+
* storage primitive below both the CLI and SDK prevents public history
|
|
7
|
+
* maintenance APIs from depending on presentation-layer modules.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="20c826eb-6bb4-574b-b395-6787baaff678")}catch(e){}}();
|
|
11
|
+
import { readFileIfExists } from "../fs/fs-utils.js";
|
|
12
|
+
import { runActiveOnReadHooks } from "../extensions/index.js";
|
|
13
|
+
import { EXIT_CODE } from "../shared/constants.js";
|
|
14
|
+
import { findFirstMergeConflictMarker } from "../shared/conflict-markers.js";
|
|
15
|
+
import { PmCliError } from "../shared/errors.js";
|
|
16
|
+
/** Read and validate one item's JSONL history stream without mutating it. */
|
|
17
|
+
export async function readHistoryEntries(historyPath, itemId) {
|
|
18
|
+
const raw = await readFileIfExists(historyPath);
|
|
19
|
+
if (raw === null) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
await runActiveOnReadHooks({ path: historyPath, scope: "project" });
|
|
23
|
+
if (raw.trim() === "") {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const conflictMarker = findFirstMergeConflictMarker(raw);
|
|
27
|
+
if (conflictMarker) {
|
|
28
|
+
throw new PmCliError(`History for ${itemId} contains merge conflict markers at line ${conflictMarker.line} (${conflictMarker.marker}). Resolve <<<<<<< ======= >>>>>>> markers and retry.`, EXIT_CODE.GENERIC_FAILURE, {
|
|
29
|
+
code: "history_merge_conflict_markers_detected",
|
|
30
|
+
required: "Repair the history stream by resolving merge-conflict markers.",
|
|
31
|
+
why: "Conflict markers break JSONL parsing and invalidate deterministic audit history.",
|
|
32
|
+
examples: [
|
|
33
|
+
`pm history ${itemId}`,
|
|
34
|
+
`pm restore ${itemId} <timestamp-or-version>`,
|
|
35
|
+
],
|
|
36
|
+
nextSteps: ["Resolve or restore the history file, then rerun the command."],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const entries = [];
|
|
40
|
+
for (const [index, rawLine] of raw.split(/\r?\n/).entries()) {
|
|
41
|
+
const line = rawLine.trim();
|
|
42
|
+
if (!line) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
entries.push(JSON.parse(line));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new PmCliError(`History for ${itemId} contains invalid JSON at line ${index + 1}. Repair or restore the history stream and retry.`, EXIT_CODE.GENERIC_FAILURE);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return entries;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=read.js.map
|
|
55
|
+
//# debugId=20c826eb-6bb4-574b-b395-6787baaff678
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sources":["core/history/read.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/history/read\n *\n * Reads append-only item history streams with conflict-marker detection,\n * extension read hooks, and line-specific JSONL diagnostics. Keeping this\n * storage primitive below both the CLI and SDK prevents public history\n * maintenance APIs from depending on presentation-layer modules.\n */\nimport { readFileIfExists } from \"../fs/fs-utils.js\";\nimport { runActiveOnReadHooks } from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { findFirstMergeConflictMarker } from \"../shared/conflict-markers.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport type { HistoryEntry } from \"../../types/index.js\";\n\n/** Read and validate one item's JSONL history stream without mutating it. */\nexport async function readHistoryEntries(\n historyPath: string,\n itemId: string,\n): Promise<HistoryEntry[]> {\n const raw = await readFileIfExists(historyPath);\n if (raw === null) {\n return [];\n }\n await runActiveOnReadHooks({ path: historyPath, scope: \"project\" });\n if (raw.trim() === \"\") {\n return [];\n }\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `History for ${itemId} contains merge conflict markers at line ${conflictMarker.line} (${conflictMarker.marker}). Resolve <<<<<<< ======= >>>>>>> markers and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n {\n code: \"history_merge_conflict_markers_detected\",\n required: \"Repair the history stream by resolving merge-conflict markers.\",\n why: \"Conflict markers break JSONL parsing and invalidate deterministic audit history.\",\n examples: [\n `pm history ${itemId}`,\n `pm restore ${itemId} <timestamp-or-version>`,\n ],\n nextSteps: [\"Resolve or restore the history file, then rerun the command.\"],\n },\n );\n }\n\n const entries: HistoryEntry[] = [];\n for (const [index, rawLine] of raw.split(/\\r?\\n/).entries()) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n try {\n entries.push(JSON.parse(line) as HistoryEntry);\n } catch {\n throw new PmCliError(\n `History for ${itemId} contains invalid JSON at line ${index + 1}. Repair or restore the history stream and retry.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n return entries;\n}\n"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAA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EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,SAAS;QACX,CAAC;QACD,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAiB,CAAC,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,UAAU,CAClB,eAAe,MAAM,kCAAkC,KAAK,GAAG,CAAC,mDAAmD,EACnH,SAAS,CAAC,eAAe,CAC1B,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","debugId":"20c826eb-6bb4-574b-b395-6787baaff678"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/output/output-control
|
|
3
|
+
*
|
|
4
|
+
* Defines the structural protocol for commands that own their output stream.
|
|
5
|
+
*/
|
|
6
|
+
/** Collision-resistant wire marker understood by pm hosts when a package already emitted output. */
|
|
7
|
+
export declare const SUPPRESS_HOST_OUTPUT_MARKER = "@unbrained/pm-cli:suppress-host-output:v1";
|
|
8
|
+
/** A handled result that tells a pm host not to render or write another payload. */
|
|
9
|
+
export interface SuppressedHostOutput<TResult = unknown> {
|
|
10
|
+
/** Explicit protocol marker consumed by CLI and SDK-built presentation hosts. */
|
|
11
|
+
readonly __pm_suppress_host_output: typeof SUPPRESS_HOST_OUTPUT_MARKER;
|
|
12
|
+
/** Optional structured result retained for hooks, telemetry, and embedding hosts. */
|
|
13
|
+
readonly result?: TResult;
|
|
14
|
+
}
|
|
15
|
+
/** Return from a command/exporter after it has written its own streaming, binary, or pre-rendered output. */
|
|
16
|
+
export declare function suppressHostOutput<TResult = undefined>(result?: TResult): SuppressedHostOutput<TResult>;
|
|
17
|
+
/** Detect the public suppression result without relying on object identity across package boundaries. */
|
|
18
|
+
export declare function isHostOutputSuppressed(value: unknown): value is SuppressedHostOutput;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/output/output-control
|
|
3
|
+
*
|
|
4
|
+
* Defines the structural protocol for commands that own their output stream.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a087a1e0-b72d-5e9d-bbe2-e292d483f75c")}catch(e){}}();
|
|
8
|
+
const SUPPRESS_HOST_OUTPUT_KEY = "__pm_suppress_host_output";
|
|
9
|
+
/** Collision-resistant wire marker understood by pm hosts when a package already emitted output. */
|
|
10
|
+
export const SUPPRESS_HOST_OUTPUT_MARKER = "@unbrained/pm-cli:suppress-host-output:v1";
|
|
11
|
+
/** Return from a command/exporter after it has written its own streaming, binary, or pre-rendered output. */
|
|
12
|
+
export function suppressHostOutput(result) {
|
|
13
|
+
return result === undefined
|
|
14
|
+
? { __pm_suppress_host_output: SUPPRESS_HOST_OUTPUT_MARKER }
|
|
15
|
+
: { __pm_suppress_host_output: SUPPRESS_HOST_OUTPUT_MARKER, result };
|
|
16
|
+
}
|
|
17
|
+
/** Detect the public suppression result without relying on object identity across package boundaries. */
|
|
18
|
+
export function isHostOutputSuppressed(value) {
|
|
19
|
+
return (typeof value === "object" &&
|
|
20
|
+
value !== null &&
|
|
21
|
+
!Array.isArray(value) &&
|
|
22
|
+
value[SUPPRESS_HOST_OUTPUT_KEY] ===
|
|
23
|
+
SUPPRESS_HOST_OUTPUT_MARKER);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=output-control.js.map
|
|
26
|
+
//# debugId=a087a1e0-b72d-5e9d-bbe2-e292d483f75c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-control.js","sources":["core/output/output-control.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/output/output-control\n *\n * Defines the structural protocol for commands that own their output stream.\n */\n\nconst SUPPRESS_HOST_OUTPUT_KEY = \"__pm_suppress_host_output\";\n\n/** Collision-resistant wire marker understood by pm hosts when a package already emitted output. */\nexport const SUPPRESS_HOST_OUTPUT_MARKER =\n \"@unbrained/pm-cli:suppress-host-output:v1\";\n\n/** A handled result that tells a pm host not to render or write another payload. */\nexport interface SuppressedHostOutput<TResult = unknown> {\n /** Explicit protocol marker consumed by CLI and SDK-built presentation hosts. */\n readonly __pm_suppress_host_output: typeof SUPPRESS_HOST_OUTPUT_MARKER;\n /** Optional structured result retained for hooks, telemetry, and embedding hosts. */\n readonly result?: TResult;\n}\n\n/** Return from a command/exporter after it has written its own streaming, binary, or pre-rendered output. */\nexport function suppressHostOutput<TResult = undefined>(\n result?: TResult,\n): SuppressedHostOutput<TResult> {\n return result === undefined\n ? { __pm_suppress_host_output: SUPPRESS_HOST_OUTPUT_MARKER }\n : { __pm_suppress_host_output: SUPPRESS_HOST_OUTPUT_MARKER, result };\n}\n\n/** Detect the public suppression result without relying on object identity across package boundaries. */\nexport function isHostOutputSuppressed(\n value: unknown,\n): value is SuppressedHostOutput {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n (value as Record<string, unknown>)[SUPPRESS_HOST_OUTPUT_KEY] ===\n SUPPRESS_HOST_OUTPUT_MARKER\n );\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAE7D,oGAAoG;AACpG,MAAM,CAAC,MAAM,2BAA2B,GACtC,2CAA2C,CAAC;AAU9C,6GAA6G;AAC7G,MAAM,UAAU,kBAAkB,CAChC,MAAgB;IAEhB,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,EAAE,yBAAyB,EAAE,2BAA2B,EAAE;QAC5D,CAAC,CAAC,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,EAAE,CAAC;AACzE,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAiC,CAAC,wBAAwB,CAAC;YAC1D,2BAA2B,CAC9B,CAAC;AACJ,CAAC","debugId":"a087a1e0-b72d-5e9d-bbe2-e292d483f75c"}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Formats compact human and machine output for Output.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="839f267a-108f-5093-9f93-4fdda2478f24")}catch(e){}}();
|
|
8
8
|
import { runActiveCommandOverride, runActiveRendererOverride, runActiveServiceOverrideSync, setActiveCommandResult, } from "../extensions/index.js";
|
|
9
9
|
import { EXIT_CODE } from "../shared/constants.js";
|
|
10
|
+
import { isHostOutputSuppressed } from "./output-control.js";
|
|
10
11
|
import { projectMutationResult } from "./mutation-projection.js";
|
|
11
12
|
const NATIVE_OUTPUT_MARKER = "__pm_native_output";
|
|
12
13
|
let streamErrorHandlersInstalled = false;
|
|
@@ -203,12 +204,8 @@ function renderDefaultMarkdownResult(value) {
|
|
|
203
204
|
}
|
|
204
205
|
return `${lines.join("\n")}\n`;
|
|
205
206
|
}
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
const commandOverride = runActiveCommandOverride(result);
|
|
209
|
-
const nativeOutput = shouldUseNativeOutput(commandOverride.result);
|
|
210
|
-
const effectiveResult = stripNativeOutputMarker(commandOverride.result);
|
|
211
|
-
setActiveCommandResult(effectiveResult);
|
|
207
|
+
/** Formats a command result after command-level output ownership is resolved. */
|
|
208
|
+
function formatEffectiveOutput(effectiveResult, nativeOutput, options) {
|
|
212
209
|
const format = options.json === true
|
|
213
210
|
? "json"
|
|
214
211
|
: options.json === false
|
|
@@ -259,6 +256,21 @@ export function formatOutput(result, options) {
|
|
|
259
256
|
}
|
|
260
257
|
return `${renderToonValue(compactedToon, 0)}\n`;
|
|
261
258
|
}
|
|
259
|
+
/** Implements format output for the public runtime surface of this module. */
|
|
260
|
+
export function formatOutput(result, options) {
|
|
261
|
+
const commandOverride = runActiveCommandOverride(result);
|
|
262
|
+
const suppressedOutput = isHostOutputSuppressed(commandOverride.result)
|
|
263
|
+
? commandOverride.result
|
|
264
|
+
: null;
|
|
265
|
+
const nativeOutput = shouldUseNativeOutput(commandOverride.result);
|
|
266
|
+
const effectiveResult = suppressedOutput
|
|
267
|
+
? suppressedOutput.result
|
|
268
|
+
: stripNativeOutputMarker(commandOverride.result);
|
|
269
|
+
setActiveCommandResult(effectiveResult);
|
|
270
|
+
return suppressedOutput
|
|
271
|
+
? ""
|
|
272
|
+
: formatEffectiveOutput(effectiveResult, nativeOutput, options);
|
|
273
|
+
}
|
|
262
274
|
/** Implements print result for the public runtime surface of this module. */
|
|
263
275
|
export function printResult(result, options) {
|
|
264
276
|
const projected = options.idOnly
|
|
@@ -288,4 +300,4 @@ export const outputTestOnly = {
|
|
|
288
300
|
renderToonValue,
|
|
289
301
|
};
|
|
290
302
|
//# sourceMappingURL=output.js.map
|
|
291
|
-
//# debugId=
|
|
303
|
+
//# debugId=839f267a-108f-5093-9f93-4fdda2478f24
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sources":["core/output/output.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/output/output\n *\n * Formats compact human and machine output for Output.\n */\nimport {\n runActiveCommandOverride,\n runActiveRendererOverride,\n runActiveServiceOverrideSync,\n setActiveCommandResult,\n} from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { projectMutationResult } from \"./mutation-projection.js\";\n\n/** Documents the output options payload exchanged by command, SDK, and package integrations. */\nexport interface OutputOptions {\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 /** When true, mutation results drop the verbose changed_fields array (keeps changed_field_count). */\n noChangedFields?: boolean;\n /** When true, single-item mutation results print only id and status. */\n idOnly?: boolean;\n /** Fallback output format used when callers do not provide an override. */\n defaultOutputFormat?: \"toon\" | \"json\";\n /** Value that configures or reports command for this contract. */\n command?: string;\n /** Value that configures or reports command args for this contract. */\n commandArgs?: string[];\n /** Inputs that customize the command operation. */\n commandOptions?: Record<string, unknown>;\n /** Value that configures or reports pm root for this contract. */\n pmRoot?: string;\n}\n\ninterface NodeLikeError {\n code?: string;\n}\n\nconst NATIVE_OUTPUT_MARKER = \"__pm_native_output\";\n\nlet streamErrorHandlersInstalled = false;\ntype OutputStreamTarget = \"stdout\" | \"stderr\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction shouldUseNativeOutput(result: unknown): boolean {\n return isPlainObject(result) && result[NATIVE_OUTPUT_MARKER] === true;\n}\n\nfunction stripNativeOutputMarker<T>(result: T): T {\n if (!isPlainObject(result) || result[NATIVE_OUTPUT_MARKER] !== true) {\n return result;\n }\n const { [NATIVE_OUTPUT_MARKER]: _marker, ...rest } = result;\n return rest as T;\n}\n\nfunction isBrokenPipeError(error: unknown): boolean {\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as NodeLikeError).code === \"EPIPE\"\n );\n}\n\nfunction markStdoutBrokenPipeExitCode(): void {\n if (\n process.exitCode === undefined ||\n process.exitCode === EXIT_CODE.SUCCESS\n ) {\n process.exitCode = EXIT_CODE.SUCCESS;\n }\n}\n\nfunction markStderrBrokenPipeExitCode(): void {\n if (\n process.exitCode === undefined ||\n process.exitCode === EXIT_CODE.SUCCESS\n ) {\n process.exitCode = EXIT_CODE.GENERIC_FAILURE;\n }\n}\n\nfunction markBrokenPipeExitCode(target: OutputStreamTarget): void {\n if (target === \"stdout\") {\n markStdoutBrokenPipeExitCode();\n return;\n }\n markStderrBrokenPipeExitCode();\n}\n\nfunction handleUnhandledStreamError(error: unknown): void {\n const unhandled = error instanceof Error ? error : new Error(String(error));\n setImmediate(() => {\n throw unhandled;\n });\n}\n\nfunction installStreamErrorHandlers(): void {\n if (streamErrorHandlersInstalled) {\n return;\n }\n streamErrorHandlersInstalled = true;\n process.stdout.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stdout\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n process.stderr.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stderr\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n}\n\nfunction writeToStream(target: OutputStreamTarget, text: string): boolean {\n installStreamErrorHandlers();\n try {\n if (target === \"stdout\") {\n process.stdout.write(text);\n } else {\n process.stderr.write(text);\n }\n return true;\n } catch (error: unknown) {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(target);\n return false;\n }\n throw error;\n }\n}\n\n/** Implements write stdout for the public runtime surface of this module. */\nexport function writeStdout(text: string): boolean {\n return writeToStream(\"stdout\", text);\n}\n\n/** Implements write stderr for the public runtime surface of this module. */\nexport function writeStderr(text: string): boolean {\n return writeToStream(\"stderr\", text);\n}\n\nfunction renderScalar(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\" || typeof value === \"boolean\")\n return String(value);\n if (value === null) return \"null\";\n return JSON.stringify(value);\n}\n\nfunction compactToonValue(value: unknown): unknown | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const compactedEntries = value\n .map((entry) => compactToonValue(entry))\n .filter((entry): entry is unknown => entry !== undefined);\n return compactedEntries.length > 0 ? compactedEntries : undefined;\n }\n\n if (isPlainObject(value)) {\n const compacted: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const compactedEntry = compactToonValue(entry);\n if (compactedEntry !== undefined) {\n compacted[key] = compactedEntry;\n }\n }\n return Object.keys(compacted).length > 0 ? compacted : undefined;\n }\n\n return value;\n}\n\nfunction renderToonValue(value: unknown, depth: number): string {\n const indent = \" \".repeat(depth);\n\n if (Array.isArray(value)) {\n if (value.length === 0) return \"[]\";\n return value\n .map((entry) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}- ${renderScalar(entry)}`;\n }\n const rendered = renderToonValue(entry, depth + 1);\n const lines = rendered.split(\"\\n\");\n const [firstLine, ...rest] = lines;\n if (rest.length === 0) {\n return `${indent}- ${firstLine.trimStart()}`;\n }\n return `${indent}- ${firstLine.trimStart()}\\n${rest.join(\"\\n\")}`;\n })\n .join(\"\\n\");\n }\n\n if (isPlainObject(value)) {\n const entries = Object.entries(value);\n if (entries.length === 0) return \"{}\";\n return entries\n .map(([key, entry]) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}${key}: ${renderScalar(entry)}`;\n }\n if (Array.isArray(entry) && entry.length === 0) {\n return `${indent}${key}: []`;\n }\n if (isPlainObject(entry) && Object.keys(entry).length === 0) {\n return `${indent}${key}: {}`;\n }\n return `${indent}${key}:\\n${renderToonValue(entry, depth + 1)}`;\n })\n .join(\"\\n\");\n }\n\n return `${indent}${renderScalar(value)}`;\n}\n\nfunction renderDefaultMarkdownResult(value: unknown): string | null {\n if (!isPlainObject(value) || value.output_default !== \"markdown\") {\n return null;\n }\n if (\n typeof value.view !== \"string\" ||\n !Array.isArray(value.events) ||\n !Array.isArray(value.days)\n ) {\n return null;\n }\n const lines = [`# pm calendar (${value.view})`, \"\"];\n const summary = isPlainObject(value.summary) ? value.summary : {};\n lines.push(`- events: ${String(summary.events ?? 0)}`);\n lines.push(\"\");\n if (value.events.length === 0) {\n lines.push(\"No calendar events matched the selected filters.\");\n return `${lines.join(\"\\n\")}\\n`;\n }\n for (const event of value.events) {\n if (!isPlainObject(event)) {\n continue;\n }\n const kind = typeof event.kind === \"string\" ? event.kind : \"event\";\n const title = typeof event.item_title === \"string\" ? event.item_title : \"\";\n const itemId = typeof event.item_id === \"string\" ? event.item_id : \"\";\n const reminderText =\n typeof event.reminder_text === \"string\" && event.reminder_text.length > 0\n ? ` ${event.reminder_text}`\n : \"\";\n lines.push(`- [${kind}] ${itemId} ${title}${reminderText}`.trim());\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/** Implements format output for the public runtime surface of this module. */\nexport function formatOutput(result: unknown, options: OutputOptions): string {\n const commandOverride = runActiveCommandOverride(result);\n const nativeOutput = shouldUseNativeOutput(commandOverride.result);\n const effectiveResult = stripNativeOutputMarker(commandOverride.result);\n setActiveCommandResult(effectiveResult);\n const format =\n options.json === true\n ? \"json\"\n : options.json === false\n ? \"toon\"\n : options.defaultOutputFormat === \"json\"\n ? \"json\"\n : \"toon\";\n const serviceOverride = nativeOutput\n ? { handled: false, result: effectiveResult }\n : runActiveServiceOverrideSync(\"output_format\", {\n command: options.command,\n args: options.commandArgs,\n command_options: options.commandOptions,\n global: { ...options },\n pm_root: options.pmRoot,\n format,\n options: { ...options },\n result: effectiveResult,\n });\n if (serviceOverride.handled && typeof serviceOverride.result === \"string\") {\n return serviceOverride.result.endsWith(\"\\n\")\n ? serviceOverride.result\n : `${serviceOverride.result}\\n`;\n }\n const outputResult = serviceOverride.handled\n ? serviceOverride.result\n : effectiveResult;\n if (format === \"toon\") {\n const markdownDefault = renderDefaultMarkdownResult(outputResult);\n if (markdownDefault !== null) {\n return markdownDefault;\n }\n }\n const rendererOverride = nativeOutput\n ? { rendered: null }\n : runActiveRendererOverride(format, outputResult);\n if (rendererOverride.rendered !== null) {\n return rendererOverride.rendered.endsWith(\"\\n\")\n ? rendererOverride.rendered\n : `${rendererOverride.rendered}\\n`;\n }\n if (format === \"json\") {\n return `${JSON.stringify(outputResult, null, 2)}\\n`;\n }\n const compactedToon = compactToonValue(outputResult);\n if (compactedToon === undefined) {\n return \"{}\\n\";\n }\n return `${renderToonValue(compactedToon, 0)}\\n`;\n}\n\n/** Implements print result for the public runtime surface of this module. */\nexport function printResult(result: unknown, options: OutputOptions): void {\n const projected = options.idOnly\n ? projectMutationResult(result, { idOnly: true })\n : options.noChangedFields\n ? projectMutationResult(result, { changedFields: \"compact\" })\n : result;\n const rendered = formatOutput(projected, options);\n if (options.quiet) {\n return;\n }\n writeStdout(rendered);\n}\n\n/** Implements print error for the public runtime surface of this module. */\nexport function printError(message: string): void {\n const override = runActiveServiceOverrideSync(\"error_format\", {\n message,\n });\n const rendered =\n override.handled && typeof override.result === \"string\"\n ? override.result\n : message;\n writeStderr(rendered.endsWith(\"\\n\") ? rendered : `${rendered}\\n`);\n}\n\n/** Public contract for output test only, shared by SDK and presentation-layer consumers. */\nexport const outputTestOnly = {\n compactToonValue,\n renderToonValue,\n};\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AA4BjE,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAElD,IAAI,4BAA4B,GAAG,KAAK,CAAC;AAGzC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAe;IAC5C,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,oBAAoB,CAAC,KAAK,IAAI,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AAC,CAAC,GAAG,QAAQ,IAAI,CAAC,CAAC;AACpE,CAAC;AAED,4FAA4F;AAC5F,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,gBAAgB;IAChB,eAAe;CAChB,CAAC","debugId":"55f443b3-a522-5c87-8f87-1f788a11712a"}
|
|
1
|
+
{"version":3,"file":"output.js","sources":["core/output/output.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/output/output\n *\n * Formats compact human and machine output for Output.\n */\nimport {\n runActiveCommandOverride,\n runActiveRendererOverride,\n runActiveServiceOverrideSync,\n setActiveCommandResult,\n} from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { isHostOutputSuppressed } from \"./output-control.js\";\nimport { projectMutationResult } from \"./mutation-projection.js\";\n\n/** Documents the output options payload exchanged by command, SDK, and package integrations. */\nexport interface OutputOptions {\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 /** When true, mutation results drop the verbose changed_fields array (keeps changed_field_count). */\n noChangedFields?: boolean;\n /** When true, single-item mutation results print only id and status. */\n idOnly?: boolean;\n /** Fallback output format used when callers do not provide an override. */\n defaultOutputFormat?: \"toon\" | \"json\";\n /** Value that configures or reports command for this contract. */\n command?: string;\n /** Value that configures or reports command args for this contract. */\n commandArgs?: string[];\n /** Inputs that customize the command operation. */\n commandOptions?: Record<string, unknown>;\n /** Value that configures or reports pm root for this contract. */\n pmRoot?: string;\n}\n\ninterface NodeLikeError {\n code?: string;\n}\n\nconst NATIVE_OUTPUT_MARKER = \"__pm_native_output\";\n\nlet streamErrorHandlersInstalled = false;\ntype OutputStreamTarget = \"stdout\" | \"stderr\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction shouldUseNativeOutput(result: unknown): boolean {\n return isPlainObject(result) && result[NATIVE_OUTPUT_MARKER] === true;\n}\n\nfunction stripNativeOutputMarker<T>(result: T): T {\n if (!isPlainObject(result) || result[NATIVE_OUTPUT_MARKER] !== true) {\n return result;\n }\n const { [NATIVE_OUTPUT_MARKER]: _marker, ...rest } = result;\n return rest as T;\n}\n\nfunction isBrokenPipeError(error: unknown): boolean {\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as NodeLikeError).code === \"EPIPE\"\n );\n}\n\nfunction markStdoutBrokenPipeExitCode(): void {\n if (\n process.exitCode === undefined ||\n process.exitCode === EXIT_CODE.SUCCESS\n ) {\n process.exitCode = EXIT_CODE.SUCCESS;\n }\n}\n\nfunction markStderrBrokenPipeExitCode(): void {\n if (\n process.exitCode === undefined ||\n process.exitCode === EXIT_CODE.SUCCESS\n ) {\n process.exitCode = EXIT_CODE.GENERIC_FAILURE;\n }\n}\n\nfunction markBrokenPipeExitCode(target: OutputStreamTarget): void {\n if (target === \"stdout\") {\n markStdoutBrokenPipeExitCode();\n return;\n }\n markStderrBrokenPipeExitCode();\n}\n\nfunction handleUnhandledStreamError(error: unknown): void {\n const unhandled = error instanceof Error ? error : new Error(String(error));\n setImmediate(() => {\n throw unhandled;\n });\n}\n\nfunction installStreamErrorHandlers(): void {\n if (streamErrorHandlersInstalled) {\n return;\n }\n streamErrorHandlersInstalled = true;\n process.stdout.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stdout\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n process.stderr.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stderr\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n}\n\nfunction writeToStream(target: OutputStreamTarget, text: string): boolean {\n installStreamErrorHandlers();\n try {\n if (target === \"stdout\") {\n process.stdout.write(text);\n } else {\n process.stderr.write(text);\n }\n return true;\n } catch (error: unknown) {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(target);\n return false;\n }\n throw error;\n }\n}\n\n/** Implements write stdout for the public runtime surface of this module. */\nexport function writeStdout(text: string): boolean {\n return writeToStream(\"stdout\", text);\n}\n\n/** Implements write stderr for the public runtime surface of this module. */\nexport function writeStderr(text: string): boolean {\n return writeToStream(\"stderr\", text);\n}\n\nfunction renderScalar(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\" || typeof value === \"boolean\")\n return String(value);\n if (value === null) return \"null\";\n return JSON.stringify(value);\n}\n\nfunction compactToonValue(value: unknown): unknown | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const compactedEntries = value\n .map((entry) => compactToonValue(entry))\n .filter((entry): entry is unknown => entry !== undefined);\n return compactedEntries.length > 0 ? compactedEntries : undefined;\n }\n\n if (isPlainObject(value)) {\n const compacted: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const compactedEntry = compactToonValue(entry);\n if (compactedEntry !== undefined) {\n compacted[key] = compactedEntry;\n }\n }\n return Object.keys(compacted).length > 0 ? compacted : undefined;\n }\n\n return value;\n}\n\nfunction renderToonValue(value: unknown, depth: number): string {\n const indent = \" \".repeat(depth);\n\n if (Array.isArray(value)) {\n if (value.length === 0) return \"[]\";\n return value\n .map((entry) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}- ${renderScalar(entry)}`;\n }\n const rendered = renderToonValue(entry, depth + 1);\n const lines = rendered.split(\"\\n\");\n const [firstLine, ...rest] = lines;\n if (rest.length === 0) {\n return `${indent}- ${firstLine.trimStart()}`;\n }\n return `${indent}- ${firstLine.trimStart()}\\n${rest.join(\"\\n\")}`;\n })\n .join(\"\\n\");\n }\n\n if (isPlainObject(value)) {\n const entries = Object.entries(value);\n if (entries.length === 0) return \"{}\";\n return entries\n .map(([key, entry]) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}${key}: ${renderScalar(entry)}`;\n }\n if (Array.isArray(entry) && entry.length === 0) {\n return `${indent}${key}: []`;\n }\n if (isPlainObject(entry) && Object.keys(entry).length === 0) {\n return `${indent}${key}: {}`;\n }\n return `${indent}${key}:\\n${renderToonValue(entry, depth + 1)}`;\n })\n .join(\"\\n\");\n }\n\n return `${indent}${renderScalar(value)}`;\n}\n\nfunction renderDefaultMarkdownResult(value: unknown): string | null {\n if (!isPlainObject(value) || value.output_default !== \"markdown\") {\n return null;\n }\n if (\n typeof value.view !== \"string\" ||\n !Array.isArray(value.events) ||\n !Array.isArray(value.days)\n ) {\n return null;\n }\n const lines = [`# pm calendar (${value.view})`, \"\"];\n const summary = isPlainObject(value.summary) ? value.summary : {};\n lines.push(`- events: ${String(summary.events ?? 0)}`);\n lines.push(\"\");\n if (value.events.length === 0) {\n lines.push(\"No calendar events matched the selected filters.\");\n return `${lines.join(\"\\n\")}\\n`;\n }\n for (const event of value.events) {\n if (!isPlainObject(event)) {\n continue;\n }\n const kind = typeof event.kind === \"string\" ? event.kind : \"event\";\n const title = typeof event.item_title === \"string\" ? event.item_title : \"\";\n const itemId = typeof event.item_id === \"string\" ? event.item_id : \"\";\n const reminderText =\n typeof event.reminder_text === \"string\" && event.reminder_text.length > 0\n ? ` ${event.reminder_text}`\n : \"\";\n lines.push(`- [${kind}] ${itemId} ${title}${reminderText}`.trim());\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/** Formats a command result after command-level output ownership is resolved. */\nfunction formatEffectiveOutput(\n effectiveResult: unknown,\n nativeOutput: boolean,\n options: OutputOptions,\n): string {\n const format =\n options.json === true\n ? \"json\"\n : options.json === false\n ? \"toon\"\n : options.defaultOutputFormat === \"json\"\n ? \"json\"\n : \"toon\";\n const serviceOverride = nativeOutput\n ? { handled: false, result: effectiveResult }\n : runActiveServiceOverrideSync(\"output_format\", {\n command: options.command,\n args: options.commandArgs,\n command_options: options.commandOptions,\n global: { ...options },\n pm_root: options.pmRoot,\n format,\n options: { ...options },\n result: effectiveResult,\n });\n if (serviceOverride.handled && typeof serviceOverride.result === \"string\") {\n return serviceOverride.result.endsWith(\"\\n\")\n ? serviceOverride.result\n : `${serviceOverride.result}\\n`;\n }\n const outputResult = serviceOverride.handled\n ? serviceOverride.result\n : effectiveResult;\n if (format === \"toon\") {\n const markdownDefault = renderDefaultMarkdownResult(outputResult);\n if (markdownDefault !== null) {\n return markdownDefault;\n }\n }\n const rendererOverride = nativeOutput\n ? { rendered: null }\n : runActiveRendererOverride(format, outputResult);\n if (rendererOverride.rendered !== null) {\n return rendererOverride.rendered.endsWith(\"\\n\")\n ? rendererOverride.rendered\n : `${rendererOverride.rendered}\\n`;\n }\n if (format === \"json\") {\n return `${JSON.stringify(outputResult, null, 2)}\\n`;\n }\n const compactedToon = compactToonValue(outputResult);\n if (compactedToon === undefined) {\n return \"{}\\n\";\n }\n return `${renderToonValue(compactedToon, 0)}\\n`;\n}\n\n/** Implements format output for the public runtime surface of this module. */\nexport function formatOutput(result: unknown, options: OutputOptions): string {\n const commandOverride = runActiveCommandOverride(result);\n const suppressedOutput = isHostOutputSuppressed(commandOverride.result)\n ? commandOverride.result\n : null;\n const nativeOutput = shouldUseNativeOutput(commandOverride.result);\n const effectiveResult = suppressedOutput\n ? suppressedOutput.result\n : stripNativeOutputMarker(commandOverride.result);\n setActiveCommandResult(effectiveResult);\n return suppressedOutput\n ? \"\"\n : formatEffectiveOutput(effectiveResult, nativeOutput, options);\n}\n\n/** Implements print result for the public runtime surface of this module. */\nexport function printResult(result: unknown, options: OutputOptions): void {\n const projected = options.idOnly\n ? projectMutationResult(result, { idOnly: true })\n : options.noChangedFields\n ? projectMutationResult(result, { changedFields: \"compact\" })\n : result;\n const rendered = formatOutput(projected, options);\n if (options.quiet) {\n return;\n }\n writeStdout(rendered);\n}\n\n/** Implements print error for the public runtime surface of this module. */\nexport function printError(message: string): void {\n const override = runActiveServiceOverrideSync(\"error_format\", {\n message,\n });\n const rendered =\n override.handled && typeof override.result === \"string\"\n ? override.result\n : message;\n writeStderr(rendered.endsWith(\"\\n\") ? rendered : `${rendered}\\n`);\n}\n\n/** Public contract for output test only, shared by SDK and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;CAChB,CAAC","debugId":"839f267a-108f-5093-9f93-4fdda2478f24"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Integrates Sentry instrumentation and release diagnostics for Helpers.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d955a7f2-a85b-5200-8108-58c6684cb23a")}catch(e){}}();
|
|
8
8
|
import { getSentry } from "./instrument.js";
|
|
9
9
|
import { PmCliError } from "../shared/errors.js";
|
|
10
10
|
import { EXIT_CODE } from "../shared/constants.js";
|
|
@@ -179,10 +179,18 @@ export function shouldCaptureCliError(error) {
|
|
|
179
179
|
if (error instanceof PmCliError) {
|
|
180
180
|
return false;
|
|
181
181
|
}
|
|
182
|
+
if (error instanceof Error &&
|
|
183
|
+
error.name === "AbortError" &&
|
|
184
|
+
/(?:ctrl\+c|sigint|user[- ]initiated)/i.test(error.message)) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
182
187
|
if (typeof error === "object" &&
|
|
183
188
|
error !== null &&
|
|
184
189
|
"exitCode" in error &&
|
|
185
190
|
typeof error.exitCode === "number") {
|
|
191
|
+
if (error instanceof Error && error.name === "CommandError") {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
186
194
|
const exitCode = Math.trunc(error.exitCode);
|
|
187
195
|
const expectedExitCodes = new Set([
|
|
188
196
|
EXIT_CODE.SUCCESS,
|
|
@@ -207,4 +215,4 @@ export async function sentryFlush(timeoutMs = 3000) {
|
|
|
207
215
|
}
|
|
208
216
|
}
|
|
209
217
|
//# sourceMappingURL=helpers.js.map
|
|
210
|
-
//# debugId=
|
|
218
|
+
//# debugId=d955a7f2-a85b-5200-8108-58c6684cb23a
|