@unbrained/pm-cli 2026.7.14 → 2026.7.15
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 +48 -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
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ensureTypeFolderScaffold
|
|
3
|
+
} from "./chunk-GM5QHQU6.js";
|
|
4
|
+
import {
|
|
3
5
|
normalizeExtensionNameForMatch,
|
|
4
6
|
normalizeManagedDirectoryName,
|
|
5
7
|
normalizeStringList,
|
|
6
8
|
parseExtensionManifest,
|
|
9
|
+
quoteCommandArg,
|
|
7
10
|
renderPmCommand,
|
|
8
11
|
validateExtensionDirectory
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PENXZX3U.js";
|
|
10
13
|
import {
|
|
11
14
|
describeExtensionActivation,
|
|
12
15
|
renderExtensionSurfaceMarkdown
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
ensureTypeFolderScaffold
|
|
16
|
-
} from "./chunk-5CT5BW6E.js";
|
|
16
|
+
} from "./chunk-EYLCSJAI.js";
|
|
17
17
|
import {
|
|
18
18
|
TYPE_PRESET_NAMES,
|
|
19
19
|
normalizeTypePresetName,
|
|
20
20
|
resolveTypePresetDefinitions
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-APRVSW2O.js";
|
|
22
22
|
import {
|
|
23
|
+
EXECUTABLE_COMMAND_ALIASES,
|
|
23
24
|
PM_CORE_COMMAND_NAMES
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-H5APFTHZ.js";
|
|
25
26
|
import {
|
|
26
27
|
parseItemTypesFile,
|
|
27
28
|
serializeItemTypesFile,
|
|
28
29
|
upsertItemType
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-SELVXEZK.js";
|
|
30
31
|
import {
|
|
31
32
|
splitCommaList
|
|
32
33
|
} from "./chunk-D6HZN36B.js";
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
readSettings,
|
|
39
40
|
runActiveOnWriteHooks,
|
|
40
41
|
writeSettings
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-XSJUSQAE.js";
|
|
42
43
|
import {
|
|
43
44
|
DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,
|
|
44
45
|
EXIT_CODE,
|
|
@@ -51,6 +52,7 @@ import {
|
|
|
51
52
|
activateExtensions,
|
|
52
53
|
ensureRuntimeSchemaFileScaffold,
|
|
53
54
|
filePathForSchemaSection,
|
|
55
|
+
getSettingsPath,
|
|
54
56
|
isPathWithinDirectory,
|
|
55
57
|
levenshteinDistanceWithinLimit,
|
|
56
58
|
loadExtensions,
|
|
@@ -67,7 +69,7 @@ import {
|
|
|
67
69
|
resolvePmPackageRootFromModule,
|
|
68
70
|
resolvePmRoot,
|
|
69
71
|
writeFileAtomic
|
|
70
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-BSEQUTQP.js";
|
|
71
73
|
|
|
72
74
|
// dist/core/packages/manifest.js
|
|
73
75
|
import fs from "node:fs/promises";
|
|
@@ -282,13 +284,13 @@ async function collectPackageExtensionDirectories(packageRoot) {
|
|
|
282
284
|
return [...discovered].sort((left, right) => left.localeCompare(right));
|
|
283
285
|
}
|
|
284
286
|
|
|
285
|
-
// dist/
|
|
287
|
+
// dist/sdk/extension/scaffold.js
|
|
286
288
|
import fs2 from "node:fs/promises";
|
|
287
289
|
import path2 from "node:path";
|
|
288
290
|
!(function() {
|
|
289
291
|
try {
|
|
290
292
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
291
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
293
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4ef5886a-ac61-5d1c-9696-f280cbb20abf");
|
|
292
294
|
} catch (e2) {
|
|
293
295
|
}
|
|
294
296
|
})();
|
|
@@ -2447,11 +2449,11 @@ async function scaffoldExtensionProject(target, vocabulary = "extension", capabi
|
|
|
2447
2449
|
};
|
|
2448
2450
|
}
|
|
2449
2451
|
|
|
2450
|
-
// dist/
|
|
2452
|
+
// dist/sdk/extension/describe.js
|
|
2451
2453
|
!(function() {
|
|
2452
2454
|
try {
|
|
2453
2455
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
2454
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
2456
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "fecfae4c-ebb9-5dad-abf6-4c4b147da177");
|
|
2455
2457
|
} catch (e2) {
|
|
2456
2458
|
}
|
|
2457
2459
|
})();
|
|
@@ -2523,21 +2525,17 @@ function renderExtensionDescribeMarkdown(result, noun) {
|
|
|
2523
2525
|
`;
|
|
2524
2526
|
}
|
|
2525
2527
|
|
|
2526
|
-
// dist/
|
|
2527
|
-
import
|
|
2528
|
-
import
|
|
2529
|
-
import os2 from "node:os";
|
|
2530
|
-
import path6 from "node:path";
|
|
2531
|
-
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2532
|
-
import { promisify as promisify2 } from "node:util";
|
|
2528
|
+
// dist/sdk/extension.js
|
|
2529
|
+
import fs8 from "node:fs/promises";
|
|
2530
|
+
import path8 from "node:path";
|
|
2533
2531
|
|
|
2534
|
-
// dist/
|
|
2532
|
+
// dist/sdk/extension/managed-state.js
|
|
2535
2533
|
import fs3 from "node:fs/promises";
|
|
2536
2534
|
import path3 from "node:path";
|
|
2537
2535
|
!(function() {
|
|
2538
2536
|
try {
|
|
2539
2537
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
2540
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
2538
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "34e6fdd1-e124-5995-81aa-0de1092d36f8");
|
|
2541
2539
|
} catch (e2) {
|
|
2542
2540
|
}
|
|
2543
2541
|
})();
|
|
@@ -2709,7 +2707,7 @@ function upsertManagedEntry(state, entry) {
|
|
|
2709
2707
|
};
|
|
2710
2708
|
}
|
|
2711
2709
|
|
|
2712
|
-
// dist/
|
|
2710
|
+
// dist/sdk/extension/install-sources.js
|
|
2713
2711
|
import { execFile } from "node:child_process";
|
|
2714
2712
|
import fs5 from "node:fs/promises";
|
|
2715
2713
|
import os from "node:os";
|
|
@@ -2717,13 +2715,13 @@ import path5 from "node:path";
|
|
|
2717
2715
|
import { fileURLToPath } from "node:url";
|
|
2718
2716
|
import { promisify } from "node:util";
|
|
2719
2717
|
|
|
2720
|
-
// dist/
|
|
2718
|
+
// dist/sdk/extension/bundled-catalog.js
|
|
2721
2719
|
import fs4 from "node:fs/promises";
|
|
2722
2720
|
import path4 from "node:path";
|
|
2723
2721
|
!(function() {
|
|
2724
2722
|
try {
|
|
2725
2723
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
2726
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
2724
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e8aaf48a-a4c9-53db-b2d9-ae0812f07421");
|
|
2727
2725
|
} catch (e2) {
|
|
2728
2726
|
}
|
|
2729
2727
|
})();
|
|
@@ -2745,7 +2743,7 @@ function resolvePackageRootCandidates() {
|
|
|
2745
2743
|
if (typeof envRoot === "string" && envRoot.trim().length > 0) {
|
|
2746
2744
|
candidates.push(path4.resolve(envRoot.trim()));
|
|
2747
2745
|
}
|
|
2748
|
-
candidates.push(resolvePmPackageRootFromModule(import.meta.url, ["
|
|
2746
|
+
candidates.push(resolvePmPackageRootFromModule(import.meta.url, ["../../.."]));
|
|
2749
2747
|
return [...new Set(candidates)];
|
|
2750
2748
|
}
|
|
2751
2749
|
async function resolveBundledExtensionAliasSource(input3) {
|
|
@@ -2973,11 +2971,11 @@ function projectPackageCatalogEntry(entry, fields) {
|
|
|
2973
2971
|
return projected;
|
|
2974
2972
|
}
|
|
2975
2973
|
|
|
2976
|
-
// dist/
|
|
2974
|
+
// dist/sdk/extension/install-sources.js
|
|
2977
2975
|
!(function() {
|
|
2978
2976
|
try {
|
|
2979
2977
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
2980
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
2978
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "38193531-eca3-557b-ab40-d4af159b9192");
|
|
2981
2979
|
} catch (e2) {
|
|
2982
2980
|
}
|
|
2983
2981
|
})();
|
|
@@ -3081,9 +3079,12 @@ function parseExtensionInstallSource(input3, options = {}) {
|
|
|
3081
3079
|
absolute_path: path5.resolve(process.cwd(), normalizedInput)
|
|
3082
3080
|
};
|
|
3083
3081
|
}
|
|
3084
|
-
async function runGitCommand(args, execRunner = execFileAsync) {
|
|
3082
|
+
async function runGitCommand(args, execRunner = execFileAsync, timeoutMs) {
|
|
3085
3083
|
try {
|
|
3086
|
-
const result = await execRunner("git", args, {
|
|
3084
|
+
const result = await execRunner("git", args, {
|
|
3085
|
+
encoding: "utf8",
|
|
3086
|
+
timeout: timeoutMs
|
|
3087
|
+
});
|
|
3087
3088
|
return (result.stdout ?? "").trim();
|
|
3088
3089
|
} catch (error) {
|
|
3089
3090
|
const stderr = typeof error === "object" && error !== null && "stderr" in error ? String(error.stderr) : "";
|
|
@@ -3400,7 +3401,7 @@ function removeHostedPmCliDependency(manifest) {
|
|
|
3400
3401
|
}
|
|
3401
3402
|
async function linkHostedPmCliDependency(packageRoot) {
|
|
3402
3403
|
const hostPackageRoot = resolvePmPackageRootFromModule(import.meta.url, [
|
|
3403
|
-
"
|
|
3404
|
+
"../../.."
|
|
3404
3405
|
]);
|
|
3405
3406
|
const [scope, packageName] = PM_CLI_PACKAGE_NAME.split("/");
|
|
3406
3407
|
const scopedDirectory = path5.join(packageRoot, "node_modules", scope);
|
|
@@ -3585,11 +3586,11 @@ async function areDirectoriesEquivalent(left, right) {
|
|
|
3585
3586
|
return leftRealPath === rightRealPath;
|
|
3586
3587
|
}
|
|
3587
3588
|
|
|
3588
|
-
// dist/
|
|
3589
|
+
// dist/sdk/extension/doctor.js
|
|
3589
3590
|
!(function() {
|
|
3590
3591
|
try {
|
|
3591
3592
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
3592
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
3593
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "cce22256-4d00-5abd-8fb8-c2a1a34ab128");
|
|
3593
3594
|
} catch (e2) {
|
|
3594
3595
|
}
|
|
3595
3596
|
})();
|
|
@@ -4102,19 +4103,382 @@ function buildDoctorConsistencySummary(scope, installedExtensions, loadedExtensi
|
|
|
4102
4103
|
};
|
|
4103
4104
|
}
|
|
4104
4105
|
|
|
4105
|
-
// dist/
|
|
4106
|
+
// dist/sdk/extension/install-runtime.js
|
|
4107
|
+
import { randomUUID } from "node:crypto";
|
|
4108
|
+
import fs6 from "node:fs/promises";
|
|
4109
|
+
import os2 from "node:os";
|
|
4110
|
+
import path6 from "node:path";
|
|
4106
4111
|
!(function() {
|
|
4107
4112
|
try {
|
|
4108
4113
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
4109
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
4114
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "ef5442ae-3385-544e-889f-d4d78ee473c1");
|
|
4110
4115
|
} catch (e2) {
|
|
4111
4116
|
}
|
|
4112
4117
|
})();
|
|
4113
|
-
var execFileAsync2 = promisify2(execFile2);
|
|
4114
4118
|
var EXTENSION_INSTALL_COPY_ATTEMPTS = 3;
|
|
4115
4119
|
var EXTENSION_INSTALL_LOCK_ATTEMPTS = 120;
|
|
4116
4120
|
var EXTENSION_INSTALL_LOCK_DELAY_MS = 250;
|
|
4117
4121
|
var EXTENSION_INSTALL_LOCK_STALE_MS = 12e4;
|
|
4122
|
+
var RETRIABLE_EXTENSION_INSTALL_COPY_CODES = /* @__PURE__ */ new Set([
|
|
4123
|
+
"EEXIST",
|
|
4124
|
+
"ENOTEMPTY",
|
|
4125
|
+
"ENOENT"
|
|
4126
|
+
]);
|
|
4127
|
+
var errnoCode = (error) => typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
4128
|
+
var isRetriableExtensionInstallCopyError = (error) => RETRIABLE_EXTENSION_INSTALL_COPY_CODES.has(String(errnoCode(error)));
|
|
4129
|
+
var isErrnoCode = (error, code) => errnoCode(error) === code;
|
|
4130
|
+
var sleep = (ms) => new Promise((resolve) => {
|
|
4131
|
+
setTimeout(resolve, ms);
|
|
4132
|
+
});
|
|
4133
|
+
var ensureExtensionModuleTypeMarker = async (destinationDirectory) => {
|
|
4134
|
+
const markerPath = path6.join(destinationDirectory, "package.json");
|
|
4135
|
+
if (await pathExists(markerPath)) {
|
|
4136
|
+
return;
|
|
4137
|
+
}
|
|
4138
|
+
await fs6.writeFile(markerPath, `${JSON.stringify({ type: "module" }, null, 2)}
|
|
4139
|
+
`, "utf8");
|
|
4140
|
+
};
|
|
4141
|
+
var resolveCanonicalExtensionInstallDestination = async (destinationDirectory) => {
|
|
4142
|
+
const resolvedDestination = path6.resolve(destinationDirectory);
|
|
4143
|
+
const destinationParent = path6.dirname(resolvedDestination);
|
|
4144
|
+
const destinationRoot = path6.parse(destinationParent).root;
|
|
4145
|
+
let canonicalDestinationParent = await fs6.realpath(destinationRoot).catch(() => destinationRoot);
|
|
4146
|
+
const relativeDestinationParent = path6.relative(destinationRoot, destinationParent);
|
|
4147
|
+
const destinationSegments = relativeDestinationParent === "" ? [] : relativeDestinationParent.split(path6.sep);
|
|
4148
|
+
for (const [index, segment] of destinationSegments.entries()) {
|
|
4149
|
+
const candidate = path6.join(canonicalDestinationParent, segment);
|
|
4150
|
+
try {
|
|
4151
|
+
canonicalDestinationParent = await fs6.realpath(candidate);
|
|
4152
|
+
} catch {
|
|
4153
|
+
canonicalDestinationParent = path6.join(canonicalDestinationParent, ...destinationSegments.slice(index));
|
|
4154
|
+
break;
|
|
4155
|
+
}
|
|
4156
|
+
}
|
|
4157
|
+
return path6.join(canonicalDestinationParent, path6.basename(resolvedDestination));
|
|
4158
|
+
};
|
|
4159
|
+
var copyExtensionDirectoryWithoutSelfNesting = async (sourceDirectory, destinationDirectory, copyDirectory, temporaryDirectory = os2.tmpdir()) => {
|
|
4160
|
+
const resolvedSource = path6.resolve(sourceDirectory);
|
|
4161
|
+
const canonicalSource = await fs6.realpath(resolvedSource).catch(() => resolvedSource);
|
|
4162
|
+
const canonicalDestination = await resolveCanonicalExtensionInstallDestination(destinationDirectory);
|
|
4163
|
+
if (canonicalSource === canonicalDestination) {
|
|
4164
|
+
return;
|
|
4165
|
+
}
|
|
4166
|
+
if (!isPathWithinDirectory(canonicalSource, canonicalDestination)) {
|
|
4167
|
+
await copyDirectory(sourceDirectory, destinationDirectory, {
|
|
4168
|
+
recursive: true,
|
|
4169
|
+
force: true
|
|
4170
|
+
});
|
|
4171
|
+
return;
|
|
4172
|
+
}
|
|
4173
|
+
const systemTempDirectory = path6.resolve(temporaryDirectory);
|
|
4174
|
+
const stagingBase = isPathWithinDirectory(canonicalSource, systemTempDirectory) ? path6.dirname(canonicalSource) : systemTempDirectory;
|
|
4175
|
+
if (isPathWithinDirectory(canonicalSource, stagingBase)) {
|
|
4176
|
+
throw new PmCliError(`Extension source "${sourceDirectory}" contains its install destination and no external staging directory is available. Install a narrower package directory instead.`, EXIT_CODE.USAGE, { code: "extension_install_source_contains_destination" });
|
|
4177
|
+
}
|
|
4178
|
+
const stagingRoot = await fs6.mkdtemp(path6.join(stagingBase, "pm-extension-copy-"));
|
|
4179
|
+
const stagedDirectory = path6.join(stagingRoot, "extension");
|
|
4180
|
+
try {
|
|
4181
|
+
await copyDirectory(sourceDirectory, stagedDirectory, {
|
|
4182
|
+
recursive: true,
|
|
4183
|
+
force: true
|
|
4184
|
+
});
|
|
4185
|
+
await copyDirectory(stagedDirectory, destinationDirectory, {
|
|
4186
|
+
recursive: true,
|
|
4187
|
+
force: true
|
|
4188
|
+
});
|
|
4189
|
+
} finally {
|
|
4190
|
+
await fs6.rm(stagingRoot, { recursive: true, force: true });
|
|
4191
|
+
}
|
|
4192
|
+
};
|
|
4193
|
+
var copyExtensionDirectoryForInstall = async (sourceDirectory, destinationDirectory, copyDirectory = fs6.cp) => {
|
|
4194
|
+
for (let attempt = 1; attempt <= EXTENSION_INSTALL_COPY_ATTEMPTS; attempt += 1) {
|
|
4195
|
+
try {
|
|
4196
|
+
await fs6.rm(destinationDirectory, { recursive: true, force: true });
|
|
4197
|
+
await copyExtensionDirectoryWithoutSelfNesting(sourceDirectory, destinationDirectory, copyDirectory);
|
|
4198
|
+
return;
|
|
4199
|
+
} catch (error) {
|
|
4200
|
+
if (!isRetriableExtensionInstallCopyError(error) || attempt === EXTENSION_INSTALL_COPY_ATTEMPTS) {
|
|
4201
|
+
throw error;
|
|
4202
|
+
}
|
|
4203
|
+
await sleep(EXTENSION_INSTALL_LOCK_DELAY_MS);
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4206
|
+
};
|
|
4207
|
+
var readExtensionInstallLockOwnerToken = async (lockPath) => {
|
|
4208
|
+
let ownerContents;
|
|
4209
|
+
try {
|
|
4210
|
+
ownerContents = await fs6.readFile(path6.join(lockPath, "owner.json"), "utf8");
|
|
4211
|
+
} catch (error) {
|
|
4212
|
+
if (!isErrnoCode(error, "ENOENT"))
|
|
4213
|
+
throw error;
|
|
4214
|
+
return null;
|
|
4215
|
+
}
|
|
4216
|
+
let parsed;
|
|
4217
|
+
try {
|
|
4218
|
+
parsed = JSON.parse(ownerContents);
|
|
4219
|
+
} catch {
|
|
4220
|
+
return null;
|
|
4221
|
+
}
|
|
4222
|
+
if (typeof parsed !== "object" || parsed === null || !("token" in parsed)) {
|
|
4223
|
+
return null;
|
|
4224
|
+
}
|
|
4225
|
+
const token = parsed.token;
|
|
4226
|
+
return typeof token === "string" && token.length > 0 ? token : null;
|
|
4227
|
+
};
|
|
4228
|
+
var removeExtensionInstallLockIfOwned = async (lockPath, ownerToken) => {
|
|
4229
|
+
const currentOwnerToken = await readExtensionInstallLockOwnerToken(lockPath);
|
|
4230
|
+
if (currentOwnerToken !== ownerToken) {
|
|
4231
|
+
return false;
|
|
4232
|
+
}
|
|
4233
|
+
await fs6.rm(lockPath, { recursive: true, force: true });
|
|
4234
|
+
return true;
|
|
4235
|
+
};
|
|
4236
|
+
var reclaimStaleExtensionInstallLock = async (lockPath, staleMs) => {
|
|
4237
|
+
let stat;
|
|
4238
|
+
try {
|
|
4239
|
+
stat = await fs6.stat(lockPath);
|
|
4240
|
+
} catch {
|
|
4241
|
+
return false;
|
|
4242
|
+
}
|
|
4243
|
+
if (Date.now() - stat.mtimeMs <= staleMs) {
|
|
4244
|
+
return false;
|
|
4245
|
+
}
|
|
4246
|
+
const staleOwnerToken = await readExtensionInstallLockOwnerToken(lockPath);
|
|
4247
|
+
if (staleOwnerToken === null) {
|
|
4248
|
+
await fs6.rm(lockPath, { recursive: true, force: true });
|
|
4249
|
+
return true;
|
|
4250
|
+
}
|
|
4251
|
+
return removeExtensionInstallLockIfOwned(lockPath, staleOwnerToken);
|
|
4252
|
+
};
|
|
4253
|
+
var startExtensionInstallLockHeartbeat = (lockPath, ownerToken, intervalMs) => {
|
|
4254
|
+
let heartbeat = Promise.resolve();
|
|
4255
|
+
const timer = setInterval(() => {
|
|
4256
|
+
heartbeat = heartbeat.then(async () => {
|
|
4257
|
+
if (await readExtensionInstallLockOwnerToken(lockPath) !== ownerToken) {
|
|
4258
|
+
return;
|
|
4259
|
+
}
|
|
4260
|
+
const heartbeatAt = /* @__PURE__ */ new Date();
|
|
4261
|
+
await fs6.utimes(lockPath, heartbeatAt, heartbeatAt);
|
|
4262
|
+
}).catch(() => void 0);
|
|
4263
|
+
}, intervalMs);
|
|
4264
|
+
timer.unref();
|
|
4265
|
+
return async () => {
|
|
4266
|
+
clearInterval(timer);
|
|
4267
|
+
await heartbeat;
|
|
4268
|
+
};
|
|
4269
|
+
};
|
|
4270
|
+
var createExtensionInstallLock = async (lockPath, owner) => {
|
|
4271
|
+
await fs6.mkdir(lockPath);
|
|
4272
|
+
try {
|
|
4273
|
+
await fs6.writeFile(path6.join(lockPath, "owner.json"), `${JSON.stringify(owner, null, 2)}
|
|
4274
|
+
`, "utf8");
|
|
4275
|
+
} catch (error) {
|
|
4276
|
+
await fs6.rm(lockPath, { recursive: true, force: true }).catch(() => {
|
|
4277
|
+
});
|
|
4278
|
+
throw error;
|
|
4279
|
+
}
|
|
4280
|
+
};
|
|
4281
|
+
var acquireExtensionInstallLock = async (lockPath, owner, attempts, delayMs, staleMs) => {
|
|
4282
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
4283
|
+
try {
|
|
4284
|
+
await createExtensionInstallLock(lockPath, owner);
|
|
4285
|
+
return true;
|
|
4286
|
+
} catch (error) {
|
|
4287
|
+
if (!isErrnoCode(error, "EEXIST")) {
|
|
4288
|
+
throw error;
|
|
4289
|
+
}
|
|
4290
|
+
if (await reclaimStaleExtensionInstallLock(lockPath, staleMs)) {
|
|
4291
|
+
attempt -= 1;
|
|
4292
|
+
} else {
|
|
4293
|
+
await sleep(delayMs);
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
return false;
|
|
4298
|
+
};
|
|
4299
|
+
var withExtensionInstallLock = async (settingsRoot, destinationDirectoryName, run, options) => {
|
|
4300
|
+
const lockRoot = path6.join(settingsRoot, "runtime", "extension-install-locks");
|
|
4301
|
+
const lockPath = path6.join(lockRoot, "scope.lock");
|
|
4302
|
+
await fs6.mkdir(lockRoot, { recursive: true });
|
|
4303
|
+
const { attempts: rawAttempts = EXTENSION_INSTALL_LOCK_ATTEMPTS, delay_ms: rawDelayMs = EXTENSION_INSTALL_LOCK_DELAY_MS, stale_ms: rawStaleMs = EXTENSION_INSTALL_LOCK_STALE_MS, heartbeat_ms: rawHeartbeatMs } = options ?? {};
|
|
4304
|
+
if (![rawAttempts, rawDelayMs, rawStaleMs, rawHeartbeatMs].filter((value) => value !== void 0).every(Number.isFinite)) {
|
|
4305
|
+
throw new PmCliError("Extension install lock timings must be finite numbers.", EXIT_CODE.USAGE);
|
|
4306
|
+
}
|
|
4307
|
+
const attempts = Math.max(1, Math.floor(rawAttempts));
|
|
4308
|
+
const delayMs = Math.max(0, Math.floor(rawDelayMs));
|
|
4309
|
+
const staleMs = Math.floor(rawStaleMs);
|
|
4310
|
+
const heartbeatMs = Math.floor(rawHeartbeatMs ?? staleMs / 3);
|
|
4311
|
+
if (staleMs <= 0 || heartbeatMs <= 0 || heartbeatMs >= staleMs) {
|
|
4312
|
+
throw new PmCliError("Extension install lock timings require stale_ms > 0 and 0 < heartbeat_ms < stale_ms.", EXIT_CODE.USAGE);
|
|
4313
|
+
}
|
|
4314
|
+
const owner = {
|
|
4315
|
+
pid: process.pid,
|
|
4316
|
+
token: randomUUID(),
|
|
4317
|
+
created_at: nowIso(),
|
|
4318
|
+
destination: destinationDirectoryName
|
|
4319
|
+
};
|
|
4320
|
+
const acquired = await acquireExtensionInstallLock(lockPath, owner, attempts, delayMs, staleMs);
|
|
4321
|
+
if (!acquired) {
|
|
4322
|
+
throw new PmCliError(`Timed out waiting for extension install lock for "${destinationDirectoryName}".`, EXIT_CODE.CONFLICT);
|
|
4323
|
+
}
|
|
4324
|
+
const stopHeartbeat = startExtensionInstallLockHeartbeat(lockPath, owner.token, heartbeatMs);
|
|
4325
|
+
try {
|
|
4326
|
+
return await run();
|
|
4327
|
+
} finally {
|
|
4328
|
+
await stopHeartbeat();
|
|
4329
|
+
await removeExtensionInstallLockIfOwned(lockPath, owner.token).catch(() => false);
|
|
4330
|
+
}
|
|
4331
|
+
};
|
|
4332
|
+
|
|
4333
|
+
// dist/sdk/extension/concurrency.js
|
|
4334
|
+
!(function() {
|
|
4335
|
+
try {
|
|
4336
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
4337
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "7d49c5c0-a9b1-5c10-966d-eac2e2977164");
|
|
4338
|
+
} catch (e2) {
|
|
4339
|
+
}
|
|
4340
|
+
})();
|
|
4341
|
+
var mapWithFixedConcurrency = async (inputs, concurrency, mapper) => {
|
|
4342
|
+
if (!Number.isInteger(concurrency) || concurrency < 1) {
|
|
4343
|
+
throw new RangeError("concurrency must be a positive integer");
|
|
4344
|
+
}
|
|
4345
|
+
const results = new Array(inputs.length);
|
|
4346
|
+
let nextIndex = 0;
|
|
4347
|
+
const workers = Array.from({ length: Math.min(concurrency, inputs.length) }, async () => {
|
|
4348
|
+
while (nextIndex < inputs.length) {
|
|
4349
|
+
const index = nextIndex;
|
|
4350
|
+
nextIndex += 1;
|
|
4351
|
+
results[index] = await mapper(inputs[index]);
|
|
4352
|
+
}
|
|
4353
|
+
});
|
|
4354
|
+
await Promise.all(workers);
|
|
4355
|
+
return results;
|
|
4356
|
+
};
|
|
4357
|
+
|
|
4358
|
+
// dist/sdk/extension/update-check.js
|
|
4359
|
+
!(function() {
|
|
4360
|
+
try {
|
|
4361
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
4362
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "59876183-57e7-59fa-8137-5f86dac61ea5");
|
|
4363
|
+
} catch (e2) {
|
|
4364
|
+
}
|
|
4365
|
+
})();
|
|
4366
|
+
var GITHUB_UPDATE_CHECK_TIMEOUT_MS = 1e4;
|
|
4367
|
+
var resolveGithubUpdateOutput = (output3, installedCommitInput, checkedAt) => {
|
|
4368
|
+
const references = output3.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((line) => {
|
|
4369
|
+
const [commit, ref = ""] = line.split(/\s+/);
|
|
4370
|
+
return { commit, ref };
|
|
4371
|
+
});
|
|
4372
|
+
const remoteReference = references.find((reference) => reference.ref.endsWith("^{}")) ?? references[0];
|
|
4373
|
+
if (!remoteReference) {
|
|
4374
|
+
return {
|
|
4375
|
+
checked_at: checkedAt,
|
|
4376
|
+
available: null,
|
|
4377
|
+
error: "no_remote_reference_found"
|
|
4378
|
+
};
|
|
4379
|
+
}
|
|
4380
|
+
const installedCommit = installedCommitInput?.trim();
|
|
4381
|
+
return installedCommit ? {
|
|
4382
|
+
checked_at: checkedAt,
|
|
4383
|
+
remote_commit: remoteReference.commit,
|
|
4384
|
+
available: remoteReference.commit !== installedCommit
|
|
4385
|
+
} : {
|
|
4386
|
+
checked_at: checkedAt,
|
|
4387
|
+
remote_commit: remoteReference.commit,
|
|
4388
|
+
available: null,
|
|
4389
|
+
error: "missing_installed_commit"
|
|
4390
|
+
};
|
|
4391
|
+
};
|
|
4392
|
+
var checkGithubUpdate = async (source, gitCommandRunner = runGitCommand) => {
|
|
4393
|
+
const checkedAt = nowIso();
|
|
4394
|
+
if (source.kind !== "github" || !source.repository) {
|
|
4395
|
+
return {
|
|
4396
|
+
checked_at: checkedAt,
|
|
4397
|
+
available: null,
|
|
4398
|
+
error: "not_a_github_managed_source"
|
|
4399
|
+
};
|
|
4400
|
+
}
|
|
4401
|
+
try {
|
|
4402
|
+
const ref = [source.ref?.trim(), "HEAD"].find(Boolean);
|
|
4403
|
+
const output3 = await gitCommandRunner(["ls-remote", source.repository, ref, `${ref}^{}`], void 0, GITHUB_UPDATE_CHECK_TIMEOUT_MS);
|
|
4404
|
+
return resolveGithubUpdateOutput(output3, source.commit, checkedAt);
|
|
4405
|
+
} catch (error) {
|
|
4406
|
+
return {
|
|
4407
|
+
checked_at: checkedAt,
|
|
4408
|
+
available: null,
|
|
4409
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4410
|
+
};
|
|
4411
|
+
}
|
|
4412
|
+
};
|
|
4413
|
+
|
|
4414
|
+
// dist/sdk/extension/install-snapshot.js
|
|
4415
|
+
import fs7 from "node:fs/promises";
|
|
4416
|
+
import path7 from "node:path";
|
|
4417
|
+
!(function() {
|
|
4418
|
+
try {
|
|
4419
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
4420
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b131d360-d3d1-54b1-800b-54d0ab0ad282");
|
|
4421
|
+
} catch (e2) {
|
|
4422
|
+
}
|
|
4423
|
+
})();
|
|
4424
|
+
var readOptionalMetadataFile = async (filePath) => fs7.readFile(filePath).catch((error) => {
|
|
4425
|
+
if (isErrnoCode(error, "ENOENT"))
|
|
4426
|
+
return null;
|
|
4427
|
+
throw error;
|
|
4428
|
+
});
|
|
4429
|
+
var captureExtensionInstallSnapshot = async (selectedRoot, settingsRoot, destinationDirectory, destinationExists, backupDirectory) => {
|
|
4430
|
+
const managedStatePath = resolveManagedExtensionStatePath(selectedRoot);
|
|
4431
|
+
const settingsPath = getSettingsPath(settingsRoot);
|
|
4432
|
+
const [managedStateContents, settingsContents] = await Promise.all([
|
|
4433
|
+
readOptionalMetadataFile(managedStatePath),
|
|
4434
|
+
readOptionalMetadataFile(settingsPath)
|
|
4435
|
+
]);
|
|
4436
|
+
if (destinationExists) {
|
|
4437
|
+
await fs7.cp(destinationDirectory, backupDirectory, {
|
|
4438
|
+
recursive: true,
|
|
4439
|
+
force: true
|
|
4440
|
+
});
|
|
4441
|
+
}
|
|
4442
|
+
return {
|
|
4443
|
+
backupDirectory,
|
|
4444
|
+
destinationDirectory,
|
|
4445
|
+
destinationExists,
|
|
4446
|
+
managedStatePath,
|
|
4447
|
+
managedStateContents,
|
|
4448
|
+
settingsPath,
|
|
4449
|
+
settingsContents
|
|
4450
|
+
};
|
|
4451
|
+
};
|
|
4452
|
+
var restoreExtensionInstallSnapshot = async (snapshot) => {
|
|
4453
|
+
await fs7.rm(snapshot.destinationDirectory, { recursive: true, force: true });
|
|
4454
|
+
if (snapshot.destinationExists) {
|
|
4455
|
+
await fs7.cp(snapshot.backupDirectory, snapshot.destinationDirectory, {
|
|
4456
|
+
recursive: true,
|
|
4457
|
+
force: true
|
|
4458
|
+
});
|
|
4459
|
+
}
|
|
4460
|
+
for (const [filePath, contents] of [
|
|
4461
|
+
[snapshot.managedStatePath, snapshot.managedStateContents],
|
|
4462
|
+
[snapshot.settingsPath, snapshot.settingsContents]
|
|
4463
|
+
]) {
|
|
4464
|
+
if (contents === null) {
|
|
4465
|
+
await fs7.rm(filePath, { force: true });
|
|
4466
|
+
} else {
|
|
4467
|
+
await fs7.mkdir(path7.dirname(filePath), { recursive: true });
|
|
4468
|
+
await fs7.writeFile(filePath, contents);
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
};
|
|
4472
|
+
|
|
4473
|
+
// dist/sdk/extension.js
|
|
4474
|
+
!(function() {
|
|
4475
|
+
try {
|
|
4476
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
4477
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "fe21d8bd-795f-5bed-b4fc-e6efe6ee6120");
|
|
4478
|
+
} catch (e2) {
|
|
4479
|
+
}
|
|
4480
|
+
})();
|
|
4481
|
+
var GITHUB_UPDATE_CHECK_CONCURRENCY = 4;
|
|
4118
4482
|
var LIFECYCLE_ACTION_TARGETS = [
|
|
4119
4483
|
["install", "install", "--install"],
|
|
4120
4484
|
["uninstall", "uninstall", "--uninstall"],
|
|
@@ -4176,6 +4540,11 @@ var EXTENSION_POLICY_OVERRIDE_LIST_FIELDS = [
|
|
|
4176
4540
|
"allowed_services",
|
|
4177
4541
|
"blocked_services"
|
|
4178
4542
|
];
|
|
4543
|
+
var EXTENSION_POLICY_OVERRIDE_BOOLEAN_FIELDS = [
|
|
4544
|
+
"disabled",
|
|
4545
|
+
"require_trusted",
|
|
4546
|
+
"require_provenance"
|
|
4547
|
+
];
|
|
4179
4548
|
var DEFAULT_EXTENSION_POLICY_DETAILS = {
|
|
4180
4549
|
mode: "off",
|
|
4181
4550
|
trust_mode: "off",
|
|
@@ -4196,56 +4565,58 @@ var DEFAULT_EXTENSION_POLICY_DETAILS = {
|
|
|
4196
4565
|
blocked_services: [],
|
|
4197
4566
|
extension_overrides: []
|
|
4198
4567
|
};
|
|
4199
|
-
|
|
4568
|
+
var normalizePolicyRootLists = (policy) => {
|
|
4200
4569
|
const safePolicy = policy ?? DEFAULT_EXTENSION_POLICY_DETAILS;
|
|
4201
4570
|
const lists = {};
|
|
4202
4571
|
for (const field of EXTENSION_POLICY_ROOT_LIST_FIELDS) {
|
|
4203
4572
|
lists[field] = normalizeStringList(safePolicy[field] ?? []);
|
|
4204
4573
|
}
|
|
4205
4574
|
return lists;
|
|
4206
|
-
}
|
|
4207
|
-
|
|
4575
|
+
};
|
|
4576
|
+
var appendNonEmptyPolicyLists = (target, lists) => {
|
|
4208
4577
|
for (const field of EXTENSION_POLICY_OVERRIDE_LIST_FIELDS) {
|
|
4209
4578
|
if (lists[field].length > 0) {
|
|
4210
4579
|
target[field] = lists[field];
|
|
4211
4580
|
}
|
|
4212
4581
|
}
|
|
4213
4582
|
return target;
|
|
4214
|
-
}
|
|
4215
|
-
|
|
4216
|
-
const
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
const details = { name };
|
|
4221
|
-
if (override.disabled === true) {
|
|
4222
|
-
details.disabled = true;
|
|
4223
|
-
}
|
|
4224
|
-
if (override.require_trusted === true) {
|
|
4225
|
-
details.require_trusted = true;
|
|
4226
|
-
}
|
|
4227
|
-
if (override.require_provenance === true) {
|
|
4228
|
-
details.require_provenance = true;
|
|
4583
|
+
};
|
|
4584
|
+
var appendEnabledPolicyScalars = (target, override) => {
|
|
4585
|
+
for (const field of EXTENSION_POLICY_OVERRIDE_BOOLEAN_FIELDS) {
|
|
4586
|
+
if (override[field] === true) {
|
|
4587
|
+
target[field] = true;
|
|
4588
|
+
}
|
|
4229
4589
|
}
|
|
4230
4590
|
if (override.sandbox_profile) {
|
|
4231
|
-
|
|
4591
|
+
target.sandbox_profile = override.sandbox_profile;
|
|
4232
4592
|
}
|
|
4593
|
+
return target;
|
|
4594
|
+
};
|
|
4595
|
+
var normalizePolicyOverrideLists = (override) => {
|
|
4233
4596
|
const lists = {};
|
|
4234
4597
|
for (const field of EXTENSION_POLICY_OVERRIDE_LIST_FIELDS) {
|
|
4235
4598
|
lists[field] = normalizeStringList(override[field] ?? []);
|
|
4236
4599
|
}
|
|
4237
|
-
return
|
|
4238
|
-
}
|
|
4239
|
-
|
|
4240
|
-
const
|
|
4600
|
+
return lists;
|
|
4601
|
+
};
|
|
4602
|
+
var buildExtensionPolicyOverrideDetails = (override) => {
|
|
4603
|
+
const name = typeof override.name === "string" ? override.name.trim() : "";
|
|
4604
|
+
if (name.length === 0) {
|
|
4605
|
+
return null;
|
|
4606
|
+
}
|
|
4607
|
+
return appendNonEmptyPolicyLists(appendEnabledPolicyScalars({ name }, override), normalizePolicyOverrideLists(override));
|
|
4608
|
+
};
|
|
4609
|
+
var normalizeExtensionPolicyOverrides = (overrides) => (overrides ?? []).map((override) => buildExtensionPolicyOverrideDetails(override)).filter((override) => override !== null).sort((left, right) => left.name.localeCompare(right.name));
|
|
4610
|
+
var buildExtensionPolicyDetails = (policy) => {
|
|
4611
|
+
const safePolicy = Object.assign({}, DEFAULT_EXTENSION_POLICY_DETAILS, policy ?? {});
|
|
4241
4612
|
const rootLists = normalizePolicyRootLists(policy);
|
|
4242
|
-
const overrides = (safePolicy.extension_overrides
|
|
4613
|
+
const overrides = normalizeExtensionPolicyOverrides(safePolicy.extension_overrides);
|
|
4243
4614
|
return {
|
|
4244
|
-
mode: safePolicy.mode
|
|
4245
|
-
trust_mode: safePolicy.trust_mode
|
|
4615
|
+
mode: safePolicy.mode,
|
|
4616
|
+
trust_mode: safePolicy.trust_mode,
|
|
4246
4617
|
require_provenance: safePolicy.require_provenance === true,
|
|
4247
4618
|
trusted_extensions: rootLists.trusted_extensions,
|
|
4248
|
-
default_sandbox_profile: safePolicy.default_sandbox_profile
|
|
4619
|
+
default_sandbox_profile: safePolicy.default_sandbox_profile,
|
|
4249
4620
|
allowed_extensions: rootLists.allowed_extensions,
|
|
4250
4621
|
blocked_extensions: rootLists.blocked_extensions,
|
|
4251
4622
|
allowed_capabilities: rootLists.allowed_capabilities,
|
|
@@ -4260,137 +4631,29 @@ function buildExtensionPolicyDetails(policy) {
|
|
|
4260
4631
|
blocked_services: rootLists.blocked_services,
|
|
4261
4632
|
extension_overrides: overrides
|
|
4262
4633
|
};
|
|
4263
|
-
}
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4634
|
+
};
|
|
4635
|
+
var resolveInstalledExtensionCandidate = async (installed, extensionTarget) => {
|
|
4636
|
+
const lookupValues = [extensionTarget];
|
|
4637
|
+
const bundledAliasManifestName = await resolveBundledAliasManifestName(extensionTarget);
|
|
4638
|
+
if (bundledAliasManifestName) {
|
|
4639
|
+
lookupValues.push(bundledAliasManifestName);
|
|
4267
4640
|
}
|
|
4268
|
-
const
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
const markerPath = path6.join(destinationDirectory, "package.json");
|
|
4281
|
-
if (await pathExists(markerPath)) {
|
|
4282
|
-
return;
|
|
4283
|
-
}
|
|
4284
|
-
await fs6.writeFile(markerPath, `${JSON.stringify({ type: "module" }, null, 2)}
|
|
4285
|
-
`, "utf8");
|
|
4286
|
-
}
|
|
4287
|
-
async function copyExtensionDirectoryForInstall(sourceDirectory, destinationDirectory, copyDirectory = fs6.cp) {
|
|
4288
|
-
for (let attempt = 1; attempt <= EXTENSION_INSTALL_COPY_ATTEMPTS; attempt += 1) {
|
|
4289
|
-
try {
|
|
4290
|
-
if (await pathExists(destinationDirectory)) {
|
|
4291
|
-
await fs6.rm(destinationDirectory, { recursive: true, force: true });
|
|
4292
|
-
}
|
|
4293
|
-
await copyExtensionDirectoryWithoutSelfNesting(sourceDirectory, destinationDirectory, copyDirectory);
|
|
4294
|
-
return;
|
|
4295
|
-
} catch (error) {
|
|
4296
|
-
if (!isRetriableExtensionInstallCopyError(error) || attempt === EXTENSION_INSTALL_COPY_ATTEMPTS) {
|
|
4297
|
-
throw error;
|
|
4298
|
-
}
|
|
4299
|
-
await sleep(EXTENSION_INSTALL_LOCK_DELAY_MS);
|
|
4300
|
-
}
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
|
-
async function copyExtensionDirectoryWithoutSelfNesting(sourceDirectory, destinationDirectory, copyDirectory) {
|
|
4304
|
-
const resolvedSource = path6.resolve(sourceDirectory);
|
|
4305
|
-
const resolvedDestination = path6.resolve(destinationDirectory);
|
|
4306
|
-
if (resolvedSource === resolvedDestination) {
|
|
4307
|
-
return;
|
|
4308
|
-
}
|
|
4309
|
-
if (!isPathWithinDirectory(resolvedSource, resolvedDestination)) {
|
|
4310
|
-
await copyDirectory(sourceDirectory, destinationDirectory, {
|
|
4311
|
-
recursive: true,
|
|
4312
|
-
force: true
|
|
4313
|
-
});
|
|
4314
|
-
return;
|
|
4315
|
-
}
|
|
4316
|
-
const stagingRoot = await fs6.mkdtemp(path6.join(os2.tmpdir(), "pm-extension-copy-"));
|
|
4317
|
-
const stagedDirectory = path6.join(stagingRoot, "extension");
|
|
4318
|
-
try {
|
|
4319
|
-
await copyDirectory(sourceDirectory, stagedDirectory, {
|
|
4320
|
-
recursive: true,
|
|
4321
|
-
force: true
|
|
4322
|
-
});
|
|
4323
|
-
await copyDirectory(stagedDirectory, destinationDirectory, {
|
|
4324
|
-
recursive: true,
|
|
4325
|
-
force: true
|
|
4326
|
-
});
|
|
4327
|
-
} finally {
|
|
4328
|
-
await fs6.rm(stagingRoot, { recursive: true, force: true });
|
|
4329
|
-
}
|
|
4330
|
-
}
|
|
4331
|
-
async function withExtensionInstallLock(settingsRoot, destinationDirectoryName, run, options) {
|
|
4332
|
-
const lockRoot = path6.join(settingsRoot, "runtime", "extension-install-locks");
|
|
4333
|
-
const lockPath = path6.join(lockRoot, `${destinationDirectoryName}.lock`);
|
|
4334
|
-
await fs6.mkdir(lockRoot, { recursive: true });
|
|
4335
|
-
const attempts = Math.max(1, Math.floor(options?.attempts ?? EXTENSION_INSTALL_LOCK_ATTEMPTS));
|
|
4336
|
-
const delayMs = Math.max(0, Math.floor(options?.delay_ms ?? EXTENSION_INSTALL_LOCK_DELAY_MS));
|
|
4337
|
-
const staleMs = Math.max(0, Math.floor(options?.stale_ms ?? EXTENSION_INSTALL_LOCK_STALE_MS));
|
|
4338
|
-
let acquired = false;
|
|
4339
|
-
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
4340
|
-
try {
|
|
4341
|
-
await fs6.mkdir(lockPath);
|
|
4342
|
-
acquired = true;
|
|
4343
|
-
await fs6.writeFile(path6.join(lockPath, "owner.json"), `${JSON.stringify({ pid: process.pid, created_at: nowIso(), destination: destinationDirectoryName }, null, 2)}
|
|
4344
|
-
`, "utf8");
|
|
4345
|
-
break;
|
|
4346
|
-
} catch (error) {
|
|
4347
|
-
if (!isErrnoCode(error, "EEXIST")) {
|
|
4348
|
-
throw error;
|
|
4349
|
-
}
|
|
4350
|
-
let stat = null;
|
|
4351
|
-
try {
|
|
4352
|
-
stat = await fs6.stat(lockPath);
|
|
4353
|
-
} catch {
|
|
4354
|
-
stat = null;
|
|
4355
|
-
}
|
|
4356
|
-
if (stat && Date.now() - stat.mtimeMs > staleMs) {
|
|
4357
|
-
await fs6.rm(lockPath, { recursive: true, force: true });
|
|
4358
|
-
continue;
|
|
4359
|
-
}
|
|
4360
|
-
await sleep(delayMs);
|
|
4361
|
-
}
|
|
4362
|
-
}
|
|
4363
|
-
if (!acquired) {
|
|
4364
|
-
throw new PmCliError(`Timed out waiting for extension install lock for "${destinationDirectoryName}".`, EXIT_CODE.CONFLICT);
|
|
4365
|
-
}
|
|
4366
|
-
try {
|
|
4367
|
-
return await run();
|
|
4368
|
-
} finally {
|
|
4369
|
-
await fs6.rm(lockPath, { recursive: true, force: true }).catch(() => void 0);
|
|
4370
|
-
}
|
|
4371
|
-
}
|
|
4372
|
-
async function resolveInstalledExtensionCandidate(installed, extensionTarget) {
|
|
4373
|
-
const lookupValues = [extensionTarget];
|
|
4374
|
-
const bundledAliasManifestName = await resolveBundledAliasManifestName(extensionTarget);
|
|
4375
|
-
if (bundledAliasManifestName) {
|
|
4376
|
-
lookupValues.push(bundledAliasManifestName);
|
|
4377
|
-
}
|
|
4378
|
-
const normalizedLookups = [
|
|
4379
|
-
...new Set(lookupValues.map((value) => normalizeExtensionNameForMatch(value)).filter((value) => value.length > 0))
|
|
4380
|
-
];
|
|
4381
|
-
for (const lookup of normalizedLookups) {
|
|
4382
|
-
const byName = installed.find((entry) => normalizeExtensionNameForMatch(entry.name) === lookup);
|
|
4383
|
-
if (byName) {
|
|
4384
|
-
return byName;
|
|
4385
|
-
}
|
|
4386
|
-
const byDirectory = installed.find((entry) => normalizeExtensionNameForMatch(entry.directory) === lookup);
|
|
4387
|
-
if (byDirectory) {
|
|
4388
|
-
return byDirectory;
|
|
4389
|
-
}
|
|
4641
|
+
const normalizedLookups = [
|
|
4642
|
+
...new Set(lookupValues.map((value) => normalizeExtensionNameForMatch(value)).filter((value) => value.length > 0))
|
|
4643
|
+
];
|
|
4644
|
+
for (const lookup of normalizedLookups) {
|
|
4645
|
+
const byName = installed.find((entry) => normalizeExtensionNameForMatch(entry.name) === lookup);
|
|
4646
|
+
if (byName) {
|
|
4647
|
+
return byName;
|
|
4648
|
+
}
|
|
4649
|
+
const byDirectory = installed.find((entry) => normalizeExtensionNameForMatch(entry.directory) === lookup);
|
|
4650
|
+
if (byDirectory) {
|
|
4651
|
+
return byDirectory;
|
|
4652
|
+
}
|
|
4390
4653
|
}
|
|
4391
4654
|
return void 0;
|
|
4392
|
-
}
|
|
4393
|
-
|
|
4655
|
+
};
|
|
4656
|
+
var isExtensionEnabled = (settings, name) => {
|
|
4394
4657
|
const normalizedName = name.trim();
|
|
4395
4658
|
const enabled = new Set(normalizeStringList(settings.extensions.enabled));
|
|
4396
4659
|
const disabled = new Set(normalizeStringList(settings.extensions.disabled));
|
|
@@ -4401,8 +4664,8 @@ function isExtensionEnabled(settings, name) {
|
|
|
4401
4664
|
return true;
|
|
4402
4665
|
}
|
|
4403
4666
|
return enabled.has(normalizedName);
|
|
4404
|
-
}
|
|
4405
|
-
|
|
4667
|
+
};
|
|
4668
|
+
var ensureActivated = (settings, name) => {
|
|
4406
4669
|
const normalizedName = name.trim();
|
|
4407
4670
|
const enabled = new Set(normalizeStringList(settings.extensions.enabled));
|
|
4408
4671
|
const disabled = new Set(normalizeStringList(settings.extensions.disabled));
|
|
@@ -4415,8 +4678,8 @@ function ensureActivated(settings, name) {
|
|
|
4415
4678
|
settings.extensions.enabled = [...enabled].sort((left, right) => left.localeCompare(right));
|
|
4416
4679
|
settings.extensions.disabled = [...disabled].sort((left, right) => left.localeCompare(right));
|
|
4417
4680
|
return settings.extensions.enabled.join("\0") !== previousEnabled.join("\0") || settings.extensions.disabled.join("\0") !== previousDisabled.join("\0");
|
|
4418
|
-
}
|
|
4419
|
-
|
|
4681
|
+
};
|
|
4682
|
+
var ensureDeactivated = (settings, name) => {
|
|
4420
4683
|
const normalizedName = name.trim();
|
|
4421
4684
|
const enabled = new Set(normalizeStringList(settings.extensions.enabled));
|
|
4422
4685
|
const disabled = new Set(normalizeStringList(settings.extensions.disabled));
|
|
@@ -4427,8 +4690,8 @@ function ensureDeactivated(settings, name) {
|
|
|
4427
4690
|
settings.extensions.enabled = [...enabled].sort((left, right) => left.localeCompare(right));
|
|
4428
4691
|
settings.extensions.disabled = [...disabled].sort((left, right) => left.localeCompare(right));
|
|
4429
4692
|
return settings.extensions.enabled.join("\0") !== previousEnabled.join("\0") || settings.extensions.disabled.join("\0") !== previousDisabled.join("\0");
|
|
4430
|
-
}
|
|
4431
|
-
|
|
4693
|
+
};
|
|
4694
|
+
var clearExtensionState = (settings, name) => {
|
|
4432
4695
|
const normalizedName = name.trim();
|
|
4433
4696
|
const enabled = new Set(normalizeStringList(settings.extensions.enabled));
|
|
4434
4697
|
const disabled = new Set(normalizeStringList(settings.extensions.disabled));
|
|
@@ -4439,31 +4702,18 @@ function clearExtensionState(settings, name) {
|
|
|
4439
4702
|
settings.extensions.enabled = [...enabled].sort((left, right) => left.localeCompare(right));
|
|
4440
4703
|
settings.extensions.disabled = [...disabled].sort((left, right) => left.localeCompare(right));
|
|
4441
4704
|
return settings.extensions.enabled.join("\0") !== previousEnabled.join("\0") || settings.extensions.disabled.join("\0") !== previousDisabled.join("\0");
|
|
4442
|
-
}
|
|
4443
|
-
|
|
4705
|
+
};
|
|
4706
|
+
var suggestLifecycleActionTarget = (target) => {
|
|
4444
4707
|
const normalizedTarget = target.trim().toLowerCase();
|
|
4445
|
-
const
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
continue;
|
|
4455
|
-
}
|
|
4456
|
-
if (nearest === null) {
|
|
4457
|
-
nearest = { action, flag, distance };
|
|
4458
|
-
continue;
|
|
4459
|
-
}
|
|
4460
|
-
if (distance < nearest.distance) {
|
|
4461
|
-
nearest = { action, flag, distance };
|
|
4462
|
-
}
|
|
4463
|
-
}
|
|
4464
|
-
return nearest === null ? null : { action: nearest.action, flag: nearest.flag };
|
|
4465
|
-
}
|
|
4466
|
-
function buildUnknownLifecycleActionError(target, options) {
|
|
4708
|
+
const maxDistance = Math.min(2, Math.max(1, Math.ceil(normalizedTarget.length / 4)));
|
|
4709
|
+
const nearest = LIFECYCLE_ACTION_TARGETS.map(([candidate, action, flag]) => ({
|
|
4710
|
+
action,
|
|
4711
|
+
flag,
|
|
4712
|
+
distance: levenshteinDistanceWithinLimit(normalizedTarget, candidate, maxDistance)
|
|
4713
|
+
})).filter((entry) => entry.distance !== null).sort((left, right) => left.distance - right.distance)[0];
|
|
4714
|
+
return nearest ? { action: nearest.action, flag: nearest.flag } : null;
|
|
4715
|
+
};
|
|
4716
|
+
var buildUnknownLifecycleActionError = (target, options) => {
|
|
4467
4717
|
const noun = options.vocabulary === "package" ? "package" : "extension";
|
|
4468
4718
|
const suggestion = suggestLifecycleActionTarget(target);
|
|
4469
4719
|
if (!suggestion) {
|
|
@@ -4486,7 +4736,7 @@ function buildUnknownLifecycleActionError(target, options) {
|
|
|
4486
4736
|
]
|
|
4487
4737
|
}
|
|
4488
4738
|
});
|
|
4489
|
-
}
|
|
4739
|
+
};
|
|
4490
4740
|
var EXTENSION_ACTION_FLAG_SELECTORS = [
|
|
4491
4741
|
["install", "install"],
|
|
4492
4742
|
["uninstall", "uninstall"],
|
|
@@ -4503,31 +4753,19 @@ var EXTENSION_ACTION_FLAG_SELECTORS = [
|
|
|
4503
4753
|
["activate", "activate"],
|
|
4504
4754
|
["deactivate", "deactivate"]
|
|
4505
4755
|
];
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
if (normalizedTarget === "explore") {
|
|
4520
|
-
return "explore";
|
|
4521
|
-
}
|
|
4522
|
-
if (normalizedTarget === "manage") {
|
|
4523
|
-
return "manage";
|
|
4524
|
-
}
|
|
4525
|
-
if (normalizedTarget === "list" || normalizedTarget === "") {
|
|
4526
|
-
return "explore";
|
|
4527
|
-
}
|
|
4528
|
-
return null;
|
|
4529
|
-
}
|
|
4530
|
-
function resolveAction(target, options) {
|
|
4756
|
+
var IMPLICIT_EXTENSION_ACTIONS = {
|
|
4757
|
+
doctor: "doctor",
|
|
4758
|
+
reload: "reload",
|
|
4759
|
+
catalog: "catalog",
|
|
4760
|
+
init: "init",
|
|
4761
|
+
scaffold: "init",
|
|
4762
|
+
explore: "explore",
|
|
4763
|
+
manage: "manage",
|
|
4764
|
+
list: "explore",
|
|
4765
|
+
"": "explore"
|
|
4766
|
+
};
|
|
4767
|
+
var resolveImplicitActionFromTarget = (normalizedTarget) => IMPLICIT_EXTENSION_ACTIONS[normalizedTarget] ?? null;
|
|
4768
|
+
var resolveAction = (target, options) => {
|
|
4531
4769
|
const selected = [
|
|
4532
4770
|
...new Set(EXTENSION_ACTION_FLAG_SELECTORS.filter(([flag]) => options[flag] === true).map(([, mappedAction]) => mappedAction))
|
|
4533
4771
|
];
|
|
@@ -4545,59 +4783,55 @@ function resolveAction(target, options) {
|
|
|
4545
4783
|
throw new PmCliError("Extension action flags are mutually exclusive.", EXIT_CODE.USAGE);
|
|
4546
4784
|
}
|
|
4547
4785
|
return selected[0];
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4786
|
+
};
|
|
4787
|
+
var resolveScope = (options) => {
|
|
4550
4788
|
const projectLike = options.project === true || options.local === true;
|
|
4551
4789
|
const global2 = options.global === true;
|
|
4552
4790
|
if (projectLike && global2) {
|
|
4553
4791
|
throw new PmCliError('Options "--project/--local" and "--global" are mutually exclusive.', EXIT_CODE.USAGE);
|
|
4554
4792
|
}
|
|
4555
4793
|
return global2 ? "global" : "project";
|
|
4556
|
-
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
};
|
|
4569
|
-
}
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
};
|
|
4576
|
-
}
|
|
4577
|
-
if (typeof managedEntry.last_update_check_at === "string" && managedEntry.last_update_check_at.trim().length > 0) {
|
|
4578
|
-
if (managedEntry.update_available === true) {
|
|
4579
|
-
return {
|
|
4580
|
-
status: "checked",
|
|
4581
|
-
reason: "update_available"
|
|
4582
|
-
};
|
|
4794
|
+
};
|
|
4795
|
+
var EXTENSION_UPDATE_CHECK_RESOLVERS = [
|
|
4796
|
+
(managedEntry) => managedEntry ? null : {
|
|
4797
|
+
status: "skipped_unmanaged",
|
|
4798
|
+
reason: "extension_not_managed"
|
|
4799
|
+
},
|
|
4800
|
+
(managedEntry) => managedEntry && managedEntry.source.kind !== "github" ? {
|
|
4801
|
+
status: "skipped_non_github",
|
|
4802
|
+
reason: `managed_source_kind_${managedEntry.source.kind}`
|
|
4803
|
+
} : null,
|
|
4804
|
+
(managedEntry) => {
|
|
4805
|
+
const updateError = typeof managedEntry?.update_error === "string" ? managedEntry.update_error.trim() : "";
|
|
4806
|
+
return updateError.length > 0 ? { status: "failed", reason: updateError } : null;
|
|
4807
|
+
},
|
|
4808
|
+
(managedEntry) => {
|
|
4809
|
+
const entry = managedEntry;
|
|
4810
|
+
const checkedAt = typeof entry.last_update_check_at === "string" ? entry.last_update_check_at.trim() : "";
|
|
4811
|
+
if (checkedAt.length === 0) {
|
|
4812
|
+
return null;
|
|
4583
4813
|
}
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4814
|
+
const reason = {
|
|
4815
|
+
true: "update_available",
|
|
4816
|
+
false: "up_to_date"
|
|
4817
|
+
}[String(entry.update_available)] ?? "checked_without_commit_baseline";
|
|
4818
|
+
return { status: "checked", reason };
|
|
4819
|
+
}
|
|
4820
|
+
];
|
|
4821
|
+
var resolveUpdateCheckResolution = (managedEntry) => {
|
|
4822
|
+
for (const resolve of EXTENSION_UPDATE_CHECK_RESOLVERS) {
|
|
4823
|
+
const resolution = resolve(managedEntry);
|
|
4824
|
+
if (resolution) {
|
|
4825
|
+
return resolution;
|
|
4589
4826
|
}
|
|
4590
|
-
return {
|
|
4591
|
-
status: "checked",
|
|
4592
|
-
reason: "checked_without_commit_baseline"
|
|
4593
|
-
};
|
|
4594
4827
|
}
|
|
4595
4828
|
return {
|
|
4596
4829
|
status: "not_checked",
|
|
4597
4830
|
reason: "no_update_check_recorded"
|
|
4598
4831
|
};
|
|
4599
|
-
}
|
|
4600
|
-
|
|
4832
|
+
};
|
|
4833
|
+
var buildInstalledExtensionSummary = (identity, scope, managedEntry, updateCheck) => {
|
|
4834
|
+
const managed = managedEntry ?? {};
|
|
4601
4835
|
return {
|
|
4602
4836
|
name: identity.name,
|
|
4603
4837
|
directory: identity.directory,
|
|
@@ -4609,92 +4843,106 @@ function buildInstalledExtensionSummary(identity, scope, managedEntry, updateChe
|
|
|
4609
4843
|
runtime_active: null,
|
|
4610
4844
|
activation_status: "unknown",
|
|
4611
4845
|
managed: Boolean(managedEntry),
|
|
4612
|
-
source:
|
|
4613
|
-
update_available:
|
|
4614
|
-
last_update_check_at:
|
|
4615
|
-
last_update_remote_commit:
|
|
4616
|
-
update_error:
|
|
4846
|
+
source: managed.source,
|
|
4847
|
+
update_available: managed.update_available,
|
|
4848
|
+
last_update_check_at: managed.last_update_check_at,
|
|
4849
|
+
last_update_remote_commit: managed.last_update_remote_commit,
|
|
4850
|
+
update_error: managed.update_error,
|
|
4617
4851
|
update_check_status: updateCheck.status,
|
|
4618
4852
|
update_check_reason: updateCheck.reason
|
|
4619
4853
|
};
|
|
4620
|
-
}
|
|
4621
|
-
|
|
4854
|
+
};
|
|
4855
|
+
var buildMissingManifestInspection = (directoryName, scope, settings, managedEntry) => {
|
|
4856
|
+
const managed = Object.assign({
|
|
4857
|
+
name: directoryName,
|
|
4858
|
+
manifest_version: "unknown",
|
|
4859
|
+
manifest_entry: "unknown"
|
|
4860
|
+
}, managedEntry);
|
|
4861
|
+
const enabled = managedEntry ? isExtensionEnabled(settings, managedEntry.name) : false;
|
|
4862
|
+
return {
|
|
4863
|
+
warning: `extension_manifest_missing:${scope}:${directoryName}`,
|
|
4864
|
+
summary: buildInstalledExtensionSummary({
|
|
4865
|
+
name: managed.name,
|
|
4866
|
+
directory: directoryName,
|
|
4867
|
+
version: managed.manifest_version,
|
|
4868
|
+
entry: managed.manifest_entry,
|
|
4869
|
+
enabled
|
|
4870
|
+
}, scope, managedEntry, resolveUpdateCheckResolution(managedEntry))
|
|
4871
|
+
};
|
|
4872
|
+
};
|
|
4873
|
+
var inspectInstalledExtensionDirectory = async (extensionsRoot, directoryName, scope, settings, managedByName, managedByDirectory) => {
|
|
4874
|
+
const extensionDirectory = path8.join(extensionsRoot, directoryName);
|
|
4875
|
+
const manifestPath = path8.join(extensionDirectory, "manifest.json");
|
|
4876
|
+
const managedDirectoryEntry = managedByDirectory.get(normalizeExtensionNameForMatch(directoryName));
|
|
4877
|
+
if (!await pathExists(manifestPath)) {
|
|
4878
|
+
return buildMissingManifestInspection(directoryName, scope, settings, managedDirectoryEntry);
|
|
4879
|
+
}
|
|
4880
|
+
const invalidJson = /* @__PURE__ */ Symbol("invalid-extension-manifest-json");
|
|
4881
|
+
const rawManifest = await fs8.readFile(manifestPath, "utf8").then((contents) => JSON.parse(contents)).catch(() => invalidJson);
|
|
4882
|
+
if (rawManifest === invalidJson) {
|
|
4883
|
+
return {
|
|
4884
|
+
warning: `extension_manifest_invalid_json:${scope}:${directoryName}`
|
|
4885
|
+
};
|
|
4886
|
+
}
|
|
4887
|
+
const manifest = parseExtensionManifest(rawManifest);
|
|
4888
|
+
if (!manifest) {
|
|
4889
|
+
return { warning: `extension_manifest_invalid:${scope}:${directoryName}` };
|
|
4890
|
+
}
|
|
4891
|
+
const managedEntry = managedByName.get(normalizeExtensionNameForMatch(manifest.name)) ?? managedByDirectory.get(normalizeExtensionNameForMatch(directoryName));
|
|
4892
|
+
return {
|
|
4893
|
+
summary: buildInstalledExtensionSummary({
|
|
4894
|
+
name: manifest.name,
|
|
4895
|
+
directory: directoryName,
|
|
4896
|
+
version: manifest.version,
|
|
4897
|
+
entry: manifest.entry,
|
|
4898
|
+
enabled: isExtensionEnabled(settings, manifest.name)
|
|
4899
|
+
}, scope, managedEntry, resolveUpdateCheckResolution(managedEntry))
|
|
4900
|
+
};
|
|
4901
|
+
};
|
|
4902
|
+
var listInstalledExtensions = async (extensionsRoot, scope, settings, state) => {
|
|
4622
4903
|
if (!await pathExists(extensionsRoot)) {
|
|
4623
4904
|
return {
|
|
4624
4905
|
extensions: [],
|
|
4625
4906
|
warnings: []
|
|
4626
4907
|
};
|
|
4627
4908
|
}
|
|
4628
|
-
const entries = await
|
|
4909
|
+
const entries = await fs8.readdir(extensionsRoot, { withFileTypes: true });
|
|
4629
4910
|
const directories = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => left.localeCompare(right));
|
|
4630
|
-
const managedByName =
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4911
|
+
const managedByName = new Map(state.entries.map((managedEntry) => [
|
|
4912
|
+
normalizeExtensionNameForMatch(managedEntry.name),
|
|
4913
|
+
managedEntry
|
|
4914
|
+
]));
|
|
4915
|
+
const managedByDirectory = new Map(state.entries.map((managedEntry) => [
|
|
4916
|
+
normalizeExtensionNameForMatch(managedEntry.directory),
|
|
4917
|
+
managedEntry
|
|
4918
|
+
]));
|
|
4636
4919
|
const warnings = [];
|
|
4637
4920
|
const summaries = [];
|
|
4638
4921
|
for (const directoryName of directories) {
|
|
4639
|
-
const
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
warnings.push(`extension_manifest_missing:${scope}:${directoryName}`);
|
|
4643
|
-
const managedEntry2 = managedByDirectory.get(normalizeExtensionNameForMatch(directoryName));
|
|
4644
|
-
summaries.push(buildInstalledExtensionSummary({
|
|
4645
|
-
name: managedEntry2?.name ?? directoryName,
|
|
4646
|
-
directory: directoryName,
|
|
4647
|
-
version: managedEntry2?.manifest_version ?? "unknown",
|
|
4648
|
-
entry: managedEntry2?.manifest_entry ?? "unknown",
|
|
4649
|
-
enabled: managedEntry2 ? isExtensionEnabled(settings, managedEntry2.name) : false
|
|
4650
|
-
}, scope, managedEntry2, resolveUpdateCheckResolution(managedEntry2)));
|
|
4651
|
-
continue;
|
|
4652
|
-
}
|
|
4653
|
-
let rawManifest;
|
|
4654
|
-
try {
|
|
4655
|
-
rawManifest = JSON.parse(await fs6.readFile(manifestPath, "utf8"));
|
|
4656
|
-
} catch {
|
|
4657
|
-
warnings.push(`extension_manifest_invalid_json:${scope}:${directoryName}`);
|
|
4658
|
-
continue;
|
|
4922
|
+
const inspected = await inspectInstalledExtensionDirectory(extensionsRoot, directoryName, scope, settings, managedByName, managedByDirectory);
|
|
4923
|
+
if (inspected.warning) {
|
|
4924
|
+
warnings.push(inspected.warning);
|
|
4659
4925
|
}
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
warnings.push(`extension_manifest_invalid:${scope}:${directoryName}`);
|
|
4663
|
-
continue;
|
|
4926
|
+
if (inspected.summary) {
|
|
4927
|
+
summaries.push(inspected.summary);
|
|
4664
4928
|
}
|
|
4665
|
-
const managedEntry = managedByName.get(normalizeExtensionNameForMatch(manifest.name)) ?? managedByDirectory.get(normalizeExtensionNameForMatch(directoryName));
|
|
4666
|
-
summaries.push(buildInstalledExtensionSummary({
|
|
4667
|
-
name: manifest.name,
|
|
4668
|
-
directory: directoryName,
|
|
4669
|
-
version: manifest.version,
|
|
4670
|
-
entry: manifest.entry,
|
|
4671
|
-
enabled: isExtensionEnabled(settings, manifest.name)
|
|
4672
|
-
}, scope, managedEntry, resolveUpdateCheckResolution(managedEntry)));
|
|
4673
4929
|
}
|
|
4674
4930
|
return {
|
|
4675
4931
|
extensions: summaries.sort((left, right) => left.name.localeCompare(right.name)),
|
|
4676
4932
|
warnings: warnings.sort((left, right) => left.localeCompare(right))
|
|
4677
4933
|
};
|
|
4678
|
-
}
|
|
4934
|
+
};
|
|
4679
4935
|
var extensionRuntimeProbeQueue = createSerialQueue();
|
|
4680
|
-
|
|
4936
|
+
var summarizeRuntimeCommandPathsForExtension = (extensionName, installed) => {
|
|
4681
4937
|
const normalizedName = normalizeExtensionNameForMatch(extensionName);
|
|
4682
4938
|
const entry = installed.find((candidate) => normalizeExtensionNameForMatch(candidate.name) === normalizedName);
|
|
4683
4939
|
return {
|
|
4684
4940
|
command_paths: [...entry?.command_paths ?? []].sort((left, right) => left.localeCompare(right)),
|
|
4685
4941
|
action_paths: [...entry?.action_paths ?? []].sort((left, right) => left.localeCompare(right))
|
|
4686
4942
|
};
|
|
4687
|
-
}
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
return source.package.trim();
|
|
4691
|
-
}
|
|
4692
|
-
if (source.kind === "builtin" && typeof source.name === "string" && source.name.trim().length > 0) {
|
|
4693
|
-
return source.name.trim();
|
|
4694
|
-
}
|
|
4695
|
-
return extensionName;
|
|
4696
|
-
}
|
|
4697
|
-
function buildInstallCommandDiscovery(extensionName, source, commandSummary, activationFailure) {
|
|
4943
|
+
};
|
|
4944
|
+
var resolveCommandDiscoveryPackageName = (extensionName, source) => [source.package, source.kind === "builtin" ? source.name : void 0].find((candidate) => candidate?.trim())?.trim() ?? extensionName;
|
|
4945
|
+
var buildInstallCommandDiscovery = (extensionName, source, commandSummary, activationFailure) => {
|
|
4698
4946
|
const helpCommands = commandSummary.command_paths.map((commandPath) => `pm ${commandPath} --help`);
|
|
4699
4947
|
const sdkDependencyMissing = activationFailure?.error.toLowerCase().includes("@unbrained/pm-cli") === true;
|
|
4700
4948
|
const nextSteps = commandSummary.command_paths.length > 0 ? [...helpCommands] : [
|
|
@@ -4712,42 +4960,40 @@ function buildInstallCommandDiscovery(extensionName, source, commandSummary, act
|
|
|
4712
4960
|
next_steps: nextSteps,
|
|
4713
4961
|
...sdkDependencyMissing ? { sdk_dependency_status: "missing" } : {}
|
|
4714
4962
|
};
|
|
4715
|
-
}
|
|
4716
|
-
|
|
4717
|
-
const trace = failure.trace
|
|
4718
|
-
|
|
4719
|
-
registration_index: failure.trace.registration_index,
|
|
4720
|
-
expected_schema: failure.trace.expected_schema,
|
|
4721
|
-
...failure.trace.command ? { command: failure.trace.command } : {},
|
|
4722
|
-
...failure.trace.capability ? { capability: failure.trace.capability } : {},
|
|
4723
|
-
...failure.trace.missing_capability ? { missing_capability: failure.trace.missing_capability } : {},
|
|
4724
|
-
...failure.trace.hint ? { hint: failure.trace.hint } : {}
|
|
4725
|
-
} : void 0;
|
|
4726
|
-
return {
|
|
4963
|
+
};
|
|
4964
|
+
var summarizeActivationFailureForDiagnostics = (failure) => {
|
|
4965
|
+
const trace = failure.trace;
|
|
4966
|
+
const summary = {
|
|
4727
4967
|
layer: failure.layer,
|
|
4728
4968
|
name: failure.name,
|
|
4729
4969
|
entry_path: failure.entry_path,
|
|
4730
|
-
error: failure.error
|
|
4731
|
-
...failure.trace?.missing_capability ? { missing_capability: failure.trace.missing_capability } : {},
|
|
4732
|
-
...failure.trace?.hint ? { hint: failure.trace.hint } : {},
|
|
4733
|
-
...trace ? { trace } : {}
|
|
4970
|
+
error: failure.error
|
|
4734
4971
|
};
|
|
4735
|
-
|
|
4736
|
-
|
|
4972
|
+
if (!trace)
|
|
4973
|
+
return summary;
|
|
4974
|
+
summary.trace = Object.fromEntries(Object.entries(trace).filter(([, value]) => value !== void 0));
|
|
4975
|
+
if (trace.missing_capability) {
|
|
4976
|
+
summary.missing_capability = trace.missing_capability;
|
|
4977
|
+
}
|
|
4978
|
+
if (trace.hint)
|
|
4979
|
+
summary.hint = trace.hint;
|
|
4980
|
+
return summary;
|
|
4981
|
+
};
|
|
4982
|
+
var collectActivationFailureDiagnostics = (failures) => {
|
|
4737
4983
|
return failures.map((failure) => summarizeActivationFailureForDiagnostics(failure)).sort((left, right) => `${left.layer}:${left.name}`.localeCompare(`${right.layer}:${right.name}`));
|
|
4738
|
-
}
|
|
4739
|
-
|
|
4984
|
+
};
|
|
4985
|
+
var findActivationFailureByName = (extensionName, failures, layer) => {
|
|
4740
4986
|
const normalizedName = normalizeExtensionNameForMatch(extensionName);
|
|
4741
4987
|
return failures.find((failure) => (layer === void 0 || failure.layer === layer) && normalizeExtensionNameForMatch(failure.name) === normalizedName);
|
|
4742
|
-
}
|
|
4743
|
-
|
|
4988
|
+
};
|
|
4989
|
+
var resolveInstallRuntimeActivationStatus = (extensionName, scope, runtimeInstalled, installActivationFailure) => {
|
|
4744
4990
|
const runtimeInstalledExtension = runtimeInstalled.find((entry) => entry.scope === scope && normalizeExtensionNameForMatch(entry.name) === normalizeExtensionNameForMatch(extensionName));
|
|
4745
4991
|
return runtimeInstalledExtension?.activation_status ?? (installActivationFailure ? "failed" : "unknown");
|
|
4746
|
-
}
|
|
4747
|
-
|
|
4992
|
+
};
|
|
4993
|
+
var probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled, global2) => {
|
|
4748
4994
|
return extensionRuntimeProbeQueue.enqueue(async () => {
|
|
4749
4995
|
const originalPackageRoot = process.env.PM_CLI_PACKAGE_ROOT;
|
|
4750
|
-
process.env.PM_CLI_PACKAGE_ROOT =
|
|
4996
|
+
process.env.PM_CLI_PACKAGE_ROOT = resolvePmPackageRootFromModule(import.meta.url, ["../.."]);
|
|
4751
4997
|
try {
|
|
4752
4998
|
const loadResult = await loadExtensions({
|
|
4753
4999
|
pmRoot,
|
|
@@ -4785,61 +5031,8 @@ async function probeRuntimeCommandPathsForInstall(pmRoot, settings, refreshedIns
|
|
|
4785
5031
|
}
|
|
4786
5032
|
}
|
|
4787
5033
|
});
|
|
4788
|
-
}
|
|
4789
|
-
async
|
|
4790
|
-
const checkedAt = nowIso();
|
|
4791
|
-
if (source.kind !== "github" || !source.repository) {
|
|
4792
|
-
return {
|
|
4793
|
-
checked_at: checkedAt,
|
|
4794
|
-
available: null,
|
|
4795
|
-
error: "not_a_github_managed_source"
|
|
4796
|
-
};
|
|
4797
|
-
}
|
|
4798
|
-
try {
|
|
4799
|
-
const ref = source.ref && source.ref.trim().length > 0 ? source.ref.trim() : "HEAD";
|
|
4800
|
-
const output3 = await gitCommandRunner([
|
|
4801
|
-
"ls-remote",
|
|
4802
|
-
source.repository,
|
|
4803
|
-
ref
|
|
4804
|
-
]);
|
|
4805
|
-
const firstLine = output3.split(/\r?\n/).map((line) => line.trim()).find((line) => line.length > 0);
|
|
4806
|
-
if (!firstLine) {
|
|
4807
|
-
return {
|
|
4808
|
-
checked_at: checkedAt,
|
|
4809
|
-
available: null,
|
|
4810
|
-
error: "no_remote_reference_found"
|
|
4811
|
-
};
|
|
4812
|
-
}
|
|
4813
|
-
const [remoteCommit] = firstLine.split(/\s+/);
|
|
4814
|
-
if (typeof remoteCommit !== "string" || remoteCommit.length === 0) {
|
|
4815
|
-
return {
|
|
4816
|
-
checked_at: checkedAt,
|
|
4817
|
-
available: null,
|
|
4818
|
-
error: "invalid_remote_reference"
|
|
4819
|
-
};
|
|
4820
|
-
}
|
|
4821
|
-
if (typeof source.commit === "string" && source.commit.trim().length > 0) {
|
|
4822
|
-
return {
|
|
4823
|
-
checked_at: checkedAt,
|
|
4824
|
-
remote_commit: remoteCommit,
|
|
4825
|
-
available: remoteCommit !== source.commit.trim()
|
|
4826
|
-
};
|
|
4827
|
-
}
|
|
4828
|
-
return {
|
|
4829
|
-
checked_at: checkedAt,
|
|
4830
|
-
remote_commit: remoteCommit,
|
|
4831
|
-
available: null,
|
|
4832
|
-
error: "missing_installed_commit"
|
|
4833
|
-
};
|
|
4834
|
-
} catch (error) {
|
|
4835
|
-
return {
|
|
4836
|
-
checked_at: checkedAt,
|
|
4837
|
-
available: null,
|
|
4838
|
-
error: error instanceof Error ? error.message : String(error)
|
|
4839
|
-
};
|
|
4840
|
-
}
|
|
4841
|
-
}
|
|
4842
|
-
async function adoptUnmanagedExtensions(extensionsRoot, scope, installedExtensions, state) {
|
|
5034
|
+
};
|
|
5035
|
+
var adoptUnmanagedExtensions = async (extensionsRoot, scope, installedExtensions, state) => {
|
|
4843
5036
|
const unmanagedCandidates = installedExtensions.filter((entry) => !entry.managed);
|
|
4844
5037
|
const sortedCandidates = [...unmanagedCandidates].sort((left, right) => {
|
|
4845
5038
|
const byName = left.name.localeCompare(right.name);
|
|
@@ -4851,7 +5044,7 @@ async function adoptUnmanagedExtensions(extensionsRoot, scope, installedExtensio
|
|
|
4851
5044
|
let nextState = state;
|
|
4852
5045
|
const adoptedEntries = [];
|
|
4853
5046
|
for (const candidate of sortedCandidates) {
|
|
4854
|
-
const extensionDirectory =
|
|
5047
|
+
const extensionDirectory = path8.join(extensionsRoot, candidate.directory);
|
|
4855
5048
|
const validated = await validateExtensionDirectory(extensionDirectory);
|
|
4856
5049
|
const now = nowIso();
|
|
4857
5050
|
const sourceRecord = {
|
|
@@ -4887,8 +5080,8 @@ async function adoptUnmanagedExtensions(extensionsRoot, scope, installedExtensio
|
|
|
4887
5080
|
unmanaged_candidates: sortedCandidates,
|
|
4888
5081
|
already_managed_count: installedExtensions.length - unmanagedCandidates.length
|
|
4889
5082
|
};
|
|
4890
|
-
}
|
|
4891
|
-
|
|
5083
|
+
};
|
|
5084
|
+
var resolveExtensionRootsForScope = (scope, global2) => {
|
|
4892
5085
|
const pmRoot = resolvePmRoot(process.cwd(), global2.path);
|
|
4893
5086
|
const roots = resolveExtensionRoots(pmRoot, process.cwd());
|
|
4894
5087
|
const settingsRoot = scope === "global" ? resolveGlobalPmRoot(process.cwd()) : pmRoot;
|
|
@@ -4900,58 +5093,56 @@ function resolveExtensionRootsForScope(scope, global2) {
|
|
|
4900
5093
|
selected_root: selectedRoot,
|
|
4901
5094
|
roots
|
|
4902
5095
|
};
|
|
4903
|
-
}
|
|
4904
|
-
|
|
4905
|
-
|
|
5096
|
+
};
|
|
5097
|
+
var resolveGithubOption = (options) => {
|
|
5098
|
+
const values = [options.gh, options.github].filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean);
|
|
5099
|
+
const uniqueValues = [...new Set(values)];
|
|
5100
|
+
if (uniqueValues.length > 1) {
|
|
4906
5101
|
throw new PmCliError('Options "--gh" and "--github" must match when both are provided.', EXIT_CODE.USAGE);
|
|
4907
5102
|
}
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
if (typeof options.github === "string" && options.github.trim().length > 0) {
|
|
4912
|
-
return options.github.trim();
|
|
4913
|
-
}
|
|
4914
|
-
return void 0;
|
|
4915
|
-
}
|
|
4916
|
-
function getLifecycleActionFlag(action) {
|
|
5103
|
+
return uniqueValues[0];
|
|
5104
|
+
};
|
|
5105
|
+
var getLifecycleActionFlag = (action) => {
|
|
4917
5106
|
return LIFECYCLE_ACTION_FLAGS[action];
|
|
4918
|
-
}
|
|
4919
|
-
|
|
4920
|
-
const
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
5107
|
+
};
|
|
5108
|
+
var throwMissingLifecycleTarget = (action, options) => {
|
|
5109
|
+
const noun = options.vocabulary === "package" ? "package" : "extension";
|
|
5110
|
+
const targetName = action === "install" ? "source" : "name";
|
|
5111
|
+
const targetLabel = `${noun} ${targetName}`;
|
|
5112
|
+
const actionFlag = getLifecycleActionFlag(action);
|
|
5113
|
+
const commandTarget = `<${targetName}>`;
|
|
5114
|
+
const command = `pm ${noun} ${actionFlag} ${commandTarget}`;
|
|
5115
|
+
throw new PmCliError(`Action "${action}" requires ${targetLabel} input.`, EXIT_CODE.USAGE, {
|
|
5116
|
+
code: "missing_lifecycle_target",
|
|
5117
|
+
required: `Provide a ${targetName} target for ${action}.`,
|
|
5118
|
+
examples: [
|
|
5119
|
+
`pm ${noun} ${action} ${commandTarget}`,
|
|
5120
|
+
command,
|
|
5121
|
+
`pm ${noun} --help`
|
|
5122
|
+
],
|
|
5123
|
+
recovery: {
|
|
5124
|
+
attempted_command: `pm ${noun} ${action}`,
|
|
5125
|
+
suggested_retry: command,
|
|
5126
|
+
fallback_candidates: [
|
|
5127
|
+
{
|
|
5128
|
+
source: "lifecycle_action",
|
|
5129
|
+
command,
|
|
5130
|
+
reason: `flag-form ${action} command with required ${targetName} target`
|
|
5131
|
+
}
|
|
5132
|
+
]
|
|
4924
5133
|
}
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
required: `Provide a ${targetName} target for ${action}.`,
|
|
4934
|
-
examples: [
|
|
4935
|
-
`pm ${noun} ${action} ${commandTarget}`,
|
|
4936
|
-
command,
|
|
4937
|
-
`pm ${noun} --help`
|
|
4938
|
-
],
|
|
4939
|
-
recovery: {
|
|
4940
|
-
attempted_command: `pm ${noun} ${action}`,
|
|
4941
|
-
suggested_retry: command,
|
|
4942
|
-
fallback_candidates: [
|
|
4943
|
-
{
|
|
4944
|
-
source: "lifecycle_action",
|
|
4945
|
-
command,
|
|
4946
|
-
reason: `flag-form ${action} command with required ${targetName} target`
|
|
4947
|
-
}
|
|
4948
|
-
]
|
|
4949
|
-
}
|
|
4950
|
-
});
|
|
5134
|
+
});
|
|
5135
|
+
};
|
|
5136
|
+
var requireTarget = (target, action, options = {}) => {
|
|
5137
|
+
const normalized = target?.trim();
|
|
5138
|
+
if (normalized)
|
|
5139
|
+
return normalized;
|
|
5140
|
+
if (action === "init") {
|
|
5141
|
+
throw new PmCliError('Action "init" requires a scaffold target path (for example: pm package init ./my-package or pm extension init ./my-extension).', EXIT_CODE.USAGE);
|
|
4951
5142
|
}
|
|
4952
|
-
return
|
|
4953
|
-
}
|
|
4954
|
-
|
|
5143
|
+
return throwMissingLifecycleTarget(action, options);
|
|
5144
|
+
};
|
|
5145
|
+
var collectGlobalOutputOverrideDoctorWarnings = (activationResult) => {
|
|
4955
5146
|
const warnings = [];
|
|
4956
5147
|
for (const entry of activationResult.services.overrides) {
|
|
4957
5148
|
if (entry.service !== "output_format") {
|
|
@@ -4963,31 +5154,21 @@ function collectGlobalOutputOverrideDoctorWarnings(activationResult) {
|
|
|
4963
5154
|
warnings.push(`extension_output_renderer_override_global:${entry.format}:${entry.layer}:${entry.name}`);
|
|
4964
5155
|
}
|
|
4965
5156
|
return [...new Set(warnings)].sort((left, right) => left.localeCompare(right));
|
|
4966
|
-
}
|
|
4967
|
-
|
|
4968
|
-
const schemaContributors =
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
}
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
}
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
if ((extension.activation?.commands ?? []).length === 0) {
|
|
4982
|
-
continue;
|
|
4983
|
-
}
|
|
4984
|
-
if (schemaContributors.has(`${extension.layer}:${normalizeExtensionNameForMatch(extension.name)}`)) {
|
|
4985
|
-
warnings.push(`extension_schema_narrow_activation:${extension.layer}:${extension.name}`);
|
|
4986
|
-
}
|
|
4987
|
-
}
|
|
4988
|
-
return [...new Set(warnings)].sort((left, right) => left.localeCompare(right));
|
|
4989
|
-
}
|
|
4990
|
-
function assertExtensionActionOptionScope(action, options) {
|
|
5157
|
+
};
|
|
5158
|
+
var collectSchemaNarrowActivationDoctorWarnings = (loadResult, activationResult) => {
|
|
5159
|
+
const schemaContributors = new Set([
|
|
5160
|
+
...activationResult.registrations.item_types.map((entry) => ({
|
|
5161
|
+
entry,
|
|
5162
|
+
count: entry.types.length
|
|
5163
|
+
})),
|
|
5164
|
+
...activationResult.registrations.item_fields.map((entry) => ({
|
|
5165
|
+
entry,
|
|
5166
|
+
count: entry.fields.length
|
|
5167
|
+
}))
|
|
5168
|
+
].filter(({ count }) => count > 0).map(({ entry }) => `${entry.layer}:${normalizeExtensionNameForMatch(entry.name)}`));
|
|
5169
|
+
return loadResult.loaded.filter((extension) => (extension.activation?.commands ?? []).length > 0).filter((extension) => schemaContributors.has(`${extension.layer}:${normalizeExtensionNameForMatch(extension.name)}`)).map((extension) => `extension_schema_narrow_activation:${extension.layer}:${extension.name}`).filter((warning, index, warnings) => warnings.indexOf(warning) === index).sort((left, right) => left.localeCompare(right));
|
|
5170
|
+
};
|
|
5171
|
+
var assertExtensionActionOptionScope = (action, options) => {
|
|
4991
5172
|
const guards = [
|
|
4992
5173
|
{
|
|
4993
5174
|
triggered: options.strictExit === true || options.failOnWarn === true,
|
|
@@ -5030,86 +5211,115 @@ function assertExtensionActionOptionScope(action, options) {
|
|
|
5030
5211
|
message: "--declarative is only valid with --init/--scaffold."
|
|
5031
5212
|
}
|
|
5032
5213
|
];
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
}
|
|
5037
|
-
}
|
|
5038
|
-
}
|
|
5039
|
-
function resolveNormalizedExtensionTarget(target, action, options) {
|
|
5040
|
-
const normalizedInput = target?.trim().toLowerCase();
|
|
5041
|
-
if (action === "doctor" && normalizedInput === "doctor") {
|
|
5042
|
-
return void 0;
|
|
5214
|
+
const invalidGuard = guards.find((guard) => guard.triggered && !guard.allowed);
|
|
5215
|
+
if (invalidGuard) {
|
|
5216
|
+
throw new PmCliError(invalidGuard.message, EXIT_CODE.USAGE);
|
|
5043
5217
|
}
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5218
|
+
};
|
|
5219
|
+
var resolveNormalizedExtensionTarget = (target, action, options) => {
|
|
5220
|
+
const normalizedInput = String(target ?? "").trim().toLowerCase();
|
|
5221
|
+
const explicitInitAction = [options.init, options.scaffold].includes(true);
|
|
5222
|
+
const aliases = {
|
|
5223
|
+
doctor: ["doctor"],
|
|
5224
|
+
reload: ["reload"],
|
|
5225
|
+
catalog: ["catalog"],
|
|
5226
|
+
init: explicitInitAction ? [] : ["init", "scaffold"]
|
|
5227
|
+
};
|
|
5228
|
+
return (aliases[action] ?? []).includes(normalizedInput) ? void 0 : target;
|
|
5229
|
+
};
|
|
5230
|
+
var resolveExtensionResultRoots = (ctx) => {
|
|
5231
|
+
const projectedCatalog = [
|
|
5232
|
+
ctx.action === "catalog",
|
|
5233
|
+
typeof ctx.options.fields === "string",
|
|
5234
|
+
String(ctx.options.fields).trim().length > 0
|
|
5235
|
+
].every(Boolean);
|
|
5236
|
+
return projectedCatalog ? {
|
|
5237
|
+
project: "project",
|
|
5238
|
+
global: "global",
|
|
5239
|
+
selected: ctx.scope,
|
|
5240
|
+
settings_root: "project"
|
|
5241
|
+
} : {
|
|
5242
|
+
project: ctx.resolvedRoots.roots.project,
|
|
5243
|
+
global: ctx.resolvedRoots.roots.global,
|
|
5244
|
+
selected: ctx.resolvedRoots.selected_root,
|
|
5245
|
+
settings_root: ctx.resolvedRoots.settings_root
|
|
5246
|
+
};
|
|
5247
|
+
};
|
|
5248
|
+
var buildExtensionActionResult = (ctx, details, ok) => {
|
|
5249
|
+
const result = {
|
|
5250
|
+
ok,
|
|
5251
|
+
action: ctx.action,
|
|
5252
|
+
scope: ctx.scope,
|
|
5253
|
+
roots: resolveExtensionResultRoots(ctx),
|
|
5254
|
+
warnings: [...new Set(ctx.warnings)].sort((left, right) => left.localeCompare(right)),
|
|
5255
|
+
details
|
|
5256
|
+
};
|
|
5257
|
+
if (ctx.action === "doctor") {
|
|
5258
|
+
Object.defineProperty(result, NATIVE_OUTPUT_MARKER, {
|
|
5259
|
+
value: true,
|
|
5260
|
+
enumerable: false,
|
|
5261
|
+
configurable: false
|
|
5262
|
+
});
|
|
5053
5263
|
}
|
|
5054
|
-
return
|
|
5055
|
-
}
|
|
5056
|
-
async
|
|
5264
|
+
return result;
|
|
5265
|
+
};
|
|
5266
|
+
var runExtension = async (target, options, global2) => {
|
|
5057
5267
|
const action = resolveAction(target, options);
|
|
5058
5268
|
assertExtensionActionOptionScope(action, options);
|
|
5059
5269
|
const normalizedTarget = resolveNormalizedExtensionTarget(target, action, options);
|
|
5060
5270
|
const scope = resolveScope(options);
|
|
5061
5271
|
const resolvedRoots = resolveExtensionRootsForScope(scope, global2);
|
|
5062
5272
|
const warnings = [];
|
|
5063
|
-
const
|
|
5064
|
-
const result = {
|
|
5065
|
-
ok,
|
|
5066
|
-
action,
|
|
5067
|
-
scope,
|
|
5068
|
-
roots: action === "catalog" && typeof options.fields === "string" && options.fields.trim().length > 0 ? {
|
|
5069
|
-
project: "project",
|
|
5070
|
-
global: "global",
|
|
5071
|
-
selected: scope,
|
|
5072
|
-
settings_root: "project"
|
|
5073
|
-
} : {
|
|
5074
|
-
project: resolvedRoots.roots.project,
|
|
5075
|
-
global: resolvedRoots.roots.global,
|
|
5076
|
-
selected: resolvedRoots.selected_root,
|
|
5077
|
-
settings_root: resolvedRoots.settings_root
|
|
5078
|
-
},
|
|
5079
|
-
warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
|
|
5080
|
-
details
|
|
5081
|
-
};
|
|
5082
|
-
if (action === "doctor") {
|
|
5083
|
-
Object.defineProperty(result, NATIVE_OUTPUT_MARKER, {
|
|
5084
|
-
value: true,
|
|
5085
|
-
enumerable: false,
|
|
5086
|
-
configurable: false
|
|
5087
|
-
});
|
|
5088
|
-
}
|
|
5089
|
-
return result;
|
|
5090
|
-
};
|
|
5091
|
-
const ctx = {
|
|
5273
|
+
const actionContext = {
|
|
5092
5274
|
action,
|
|
5093
5275
|
normalizedTarget,
|
|
5094
5276
|
scope,
|
|
5095
5277
|
resolvedRoots,
|
|
5096
5278
|
warnings,
|
|
5097
5279
|
options,
|
|
5098
|
-
global: global2
|
|
5280
|
+
global: global2
|
|
5281
|
+
};
|
|
5282
|
+
const withResult = (details, ok = true) => buildExtensionActionResult(actionContext, details, ok);
|
|
5283
|
+
const ctx = {
|
|
5284
|
+
...actionContext,
|
|
5099
5285
|
withResult
|
|
5100
5286
|
};
|
|
5101
|
-
return
|
|
5102
|
-
}
|
|
5103
|
-
|
|
5287
|
+
return await dispatchExtensionAction(ctx);
|
|
5288
|
+
};
|
|
5289
|
+
var buildExtensionScaffoldNextSteps = (scaffold, options) => {
|
|
5290
|
+
const vocabulary = options.vocabulary ?? "extension";
|
|
5291
|
+
const shellTargetPath = scaffold.target_path.replace(/\\/g, "/");
|
|
5292
|
+
const quotedShellTargetPath = quoteCommandArg(shellTargetPath);
|
|
5293
|
+
const dependencySteps = {
|
|
5294
|
+
package: `Install dependencies: cd ${quotedShellTargetPath}, then run "npm install"`,
|
|
5295
|
+
extension: `Install type-check dependencies: cd ${quotedShellTargetPath}, then run "npm install -D typescript @types/node @unbrained/pm-cli"`
|
|
5296
|
+
};
|
|
5297
|
+
const validationSteps = {
|
|
5298
|
+
package: `Validate the package: cd ${quotedShellTargetPath}, then run "npm run typecheck" and "npm test"`,
|
|
5299
|
+
extension: `Type-check the source (optional): cd ${quotedShellTargetPath}, then run "npx tsc --noEmit"`
|
|
5300
|
+
};
|
|
5301
|
+
const declarativeGuidance = [];
|
|
5302
|
+
if ([vocabulary === "package", options.declarative === true].every(Boolean)) {
|
|
5303
|
+
declarativeGuidance.push("Ensure the target workspace can resolve @unbrained/pm-cli before installing this declarative package.");
|
|
5304
|
+
}
|
|
5305
|
+
return [
|
|
5306
|
+
dependencySteps[vocabulary],
|
|
5307
|
+
...declarativeGuidance,
|
|
5308
|
+
`Install the scaffold: ${renderPmCommand(vocabulary === "package" ? ["install", "--project", shellTargetPath] : ["extension", "--install", "--project", shellTargetPath])}`,
|
|
5309
|
+
`Smoke-test command path: pm ${scaffold.command_name}`,
|
|
5310
|
+
validationSteps[vocabulary],
|
|
5311
|
+
`Run diagnostics: ${vocabulary === "package" ? "pm package doctor" : "pm extension --doctor"} --project --detail summary`
|
|
5312
|
+
];
|
|
5313
|
+
};
|
|
5314
|
+
var runExtensionInitAction = async (ctx) => {
|
|
5104
5315
|
const { action, normalizedTarget, options, withResult } = ctx;
|
|
5105
5316
|
const githubOption = resolveGithubOption(options);
|
|
5106
|
-
|
|
5317
|
+
const disallowedSourceOptions = [githubOption, options.ref].filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean);
|
|
5318
|
+
if (disallowedSourceOptions.length > 0) {
|
|
5107
5319
|
throw new PmCliError('Action "init" does not accept --gh/--github/--ref options.', EXIT_CODE.USAGE);
|
|
5108
5320
|
}
|
|
5109
5321
|
const scaffoldTarget = requireTarget(normalizedTarget, action, options);
|
|
5110
5322
|
const scaffold = await scaffoldExtensionProject(scaffoldTarget, options.vocabulary ?? "extension", options.capability, options.declarative === true);
|
|
5111
|
-
const quotedTargetPath = JSON.stringify(scaffold.target_path);
|
|
5112
|
-
const quotedShellTargetPath = JSON.stringify(scaffold.target_path.replace(/\\/g, "/"));
|
|
5113
5323
|
return withResult({
|
|
5114
5324
|
scaffolded: scaffold.created_directory || scaffold.files.some((entry) => entry.status === "created"),
|
|
5115
5325
|
extension: {
|
|
@@ -5121,31 +5331,10 @@ async function runExtensionInitAction(ctx) {
|
|
|
5121
5331
|
target_path: scaffold.target_path,
|
|
5122
5332
|
created_directory: scaffold.created_directory,
|
|
5123
5333
|
files: scaffold.files,
|
|
5124
|
-
next_steps:
|
|
5125
|
-
// Extensions are authored AND loaded as TypeScript (ADR pm-2c28 / pm-m1uz):
|
|
5126
|
-
// the manifest entry is ./index.ts and pm strips types on load (Node
|
|
5127
|
-
// >=22.18), so there is no compile/build step — install dependencies, then
|
|
5128
|
-
// install the scaffold directly.
|
|
5129
|
-
...options.vocabulary === "package" ? [
|
|
5130
|
-
`Install dependencies: cd ${quotedShellTargetPath}, then run "npm install"`
|
|
5131
|
-
] : [
|
|
5132
|
-
`Install type-check dependencies: cd ${quotedShellTargetPath}, then run "npm install -D typescript @types/node @unbrained/pm-cli"`
|
|
5133
|
-
],
|
|
5134
|
-
...options.vocabulary === "package" && options.declarative === true ? [
|
|
5135
|
-
"Ensure the target workspace can resolve @unbrained/pm-cli before installing this declarative package."
|
|
5136
|
-
] : [],
|
|
5137
|
-
`Install the scaffold: ${options.vocabulary === "package" ? "pm install --project" : "pm extension --install --project"} ${quotedTargetPath}`,
|
|
5138
|
-
`Smoke-test command path: pm ${scaffold.command_name}`,
|
|
5139
|
-
...options.vocabulary === "package" ? [
|
|
5140
|
-
`Validate the package: cd ${quotedShellTargetPath}, then run "npm run typecheck" and "npm test"`
|
|
5141
|
-
] : [
|
|
5142
|
-
`Type-check the source (optional): cd ${quotedShellTargetPath}, then run "npx tsc --noEmit"`
|
|
5143
|
-
],
|
|
5144
|
-
`Run diagnostics: ${options.vocabulary === "package" ? "pm package doctor" : "pm extension --doctor"} --project --detail summary`
|
|
5145
|
-
]
|
|
5334
|
+
next_steps: buildExtensionScaffoldNextSteps(scaffold, options)
|
|
5146
5335
|
});
|
|
5147
|
-
}
|
|
5148
|
-
async
|
|
5336
|
+
};
|
|
5337
|
+
var runExtensionReloadAction = async (ctx) => {
|
|
5149
5338
|
const { normalizedTarget, resolvedRoots, warnings, options, global: global2, withResult } = ctx;
|
|
5150
5339
|
if (normalizedTarget !== void 0) {
|
|
5151
5340
|
throw new PmCliError('Action "reload" does not accept a target argument.', EXIT_CODE.USAGE);
|
|
@@ -5193,114 +5382,173 @@ async function runExtensionReloadAction(ctx) {
|
|
|
5193
5382
|
warnings.push("extension_reload_watch_hint:watch_mode_requested_non_interactive_single_pass_only");
|
|
5194
5383
|
}
|
|
5195
5384
|
return withResult(details);
|
|
5196
|
-
}
|
|
5197
|
-
async
|
|
5385
|
+
};
|
|
5386
|
+
var runExtensionCatalogAction = async (ctx) => {
|
|
5198
5387
|
const { normalizedTarget, scope, options, global: global2, withResult } = ctx;
|
|
5199
5388
|
if (typeof normalizedTarget === "string" && normalizedTarget.length > 0 && normalizedTarget !== "catalog") {
|
|
5200
5389
|
throw new PmCliError('Action "catalog" does not accept a package target.', EXIT_CODE.USAGE);
|
|
5201
5390
|
}
|
|
5202
5391
|
return withResult(await buildBundledPackageCatalog(scope, global2, options));
|
|
5203
|
-
}
|
|
5204
|
-
|
|
5392
|
+
};
|
|
5393
|
+
var buildBundledInstallManagedSource = (alias, packageName) => ({
|
|
5394
|
+
kind: "builtin",
|
|
5395
|
+
input: alias,
|
|
5396
|
+
location: alias,
|
|
5397
|
+
name: alias,
|
|
5398
|
+
...packageName === null ? {} : { package: packageName }
|
|
5399
|
+
});
|
|
5400
|
+
var buildLocalInstallManagedSource = (source) => ({
|
|
5401
|
+
kind: "local",
|
|
5402
|
+
input: source.input,
|
|
5403
|
+
location: source.absolute_path
|
|
5404
|
+
});
|
|
5405
|
+
var buildNpmInstallManagedSource = (source, resolved) => ({
|
|
5406
|
+
kind: "npm",
|
|
5407
|
+
input: source.input,
|
|
5408
|
+
location: resolved.resolved_subpath ?? ".",
|
|
5409
|
+
package: resolved.npm_package,
|
|
5410
|
+
version: resolved.npm_version
|
|
5411
|
+
});
|
|
5412
|
+
var buildGithubInstallManagedSource = (source, resolved) => ({
|
|
5413
|
+
kind: "github",
|
|
5414
|
+
input: source.input,
|
|
5415
|
+
location: resolved.resolved_subpath ?? source.subpath ?? ".",
|
|
5416
|
+
repository: source.repository,
|
|
5417
|
+
owner: source.owner,
|
|
5418
|
+
repo: source.repo,
|
|
5419
|
+
ref: source.ref,
|
|
5420
|
+
subpath: resolved.resolved_subpath ?? source.subpath,
|
|
5421
|
+
commit: resolved.commit
|
|
5422
|
+
});
|
|
5423
|
+
var buildInstallManagedSource = (bundledAliasName, bundledPackageName, installSource, resolvedSource) => {
|
|
5205
5424
|
if (bundledAliasName) {
|
|
5206
|
-
return
|
|
5207
|
-
kind: "builtin",
|
|
5208
|
-
input: bundledAliasName,
|
|
5209
|
-
location: bundledAliasName,
|
|
5210
|
-
name: bundledAliasName,
|
|
5211
|
-
...bundledPackageName === null ? {} : { package: bundledPackageName }
|
|
5212
|
-
};
|
|
5425
|
+
return buildBundledInstallManagedSource(bundledAliasName, bundledPackageName);
|
|
5213
5426
|
}
|
|
5214
5427
|
if (installSource.kind === "local") {
|
|
5215
|
-
return
|
|
5216
|
-
kind: "local",
|
|
5217
|
-
input: installSource.input,
|
|
5218
|
-
location: installSource.absolute_path
|
|
5219
|
-
};
|
|
5428
|
+
return buildLocalInstallManagedSource(installSource);
|
|
5220
5429
|
}
|
|
5221
5430
|
if (installSource.kind === "npm") {
|
|
5222
|
-
return
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
};
|
|
5431
|
+
return buildNpmInstallManagedSource(installSource, resolvedSource);
|
|
5432
|
+
}
|
|
5433
|
+
return buildGithubInstallManagedSource(installSource, resolvedSource);
|
|
5434
|
+
};
|
|
5435
|
+
var resolveManagedInstallTimestamps = (existing, manifestVersion, source, now) => {
|
|
5436
|
+
if (!existing)
|
|
5437
|
+
return { installed_at: now, updated_at: now };
|
|
5438
|
+
if (existing.manifest_version !== manifestVersion) {
|
|
5439
|
+
return { installed_at: existing.installed_at, updated_at: now };
|
|
5440
|
+
}
|
|
5441
|
+
if (!managedExtensionSourcesEquivalent(existing.source, source)) {
|
|
5442
|
+
return { installed_at: existing.installed_at, updated_at: now };
|
|
5229
5443
|
}
|
|
5230
5444
|
return {
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
location: resolvedSource.resolved_subpath ?? installSource.subpath ?? ".",
|
|
5234
|
-
repository: installSource.repository,
|
|
5235
|
-
owner: installSource.owner,
|
|
5236
|
-
repo: installSource.repo,
|
|
5237
|
-
ref: installSource.ref,
|
|
5238
|
-
subpath: resolvedSource.resolved_subpath ?? installSource.subpath,
|
|
5239
|
-
commit: resolvedSource.commit
|
|
5445
|
+
installed_at: existing.installed_at,
|
|
5446
|
+
updated_at: existing.updated_at
|
|
5240
5447
|
};
|
|
5241
|
-
}
|
|
5242
|
-
async
|
|
5243
|
-
const { scope, resolvedRoots, warnings
|
|
5244
|
-
const { validated, destinationDirectoryName
|
|
5448
|
+
};
|
|
5449
|
+
var persistExtensionInstall = async (ctx, input3) => {
|
|
5450
|
+
const { scope, resolvedRoots, warnings } = ctx;
|
|
5451
|
+
const { validated, destinationDirectoryName } = input3;
|
|
5245
5452
|
const settings = await readSettings(resolvedRoots.settings_root);
|
|
5246
5453
|
const managedStateRead = await readManagedExtensionState(resolvedRoots.selected_root);
|
|
5247
5454
|
warnings.push(...managedStateRead.warnings);
|
|
5248
|
-
const destinationDirectory =
|
|
5455
|
+
const destinationDirectory = path8.join(resolvedRoots.selected_root, destinationDirectoryName);
|
|
5249
5456
|
const destinationExists = await pathExists(destinationDirectory);
|
|
5250
5457
|
const installInPlace = await areDirectoriesEquivalent(validated.directory, destinationDirectory);
|
|
5251
|
-
await
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5458
|
+
await fs8.mkdir(resolvedRoots.selected_root, { recursive: true });
|
|
5459
|
+
const backupRoot = await fs8.mkdtemp(path8.join(resolvedRoots.selected_root, ".pm-extension-install-backup-"));
|
|
5460
|
+
const backupDirectory = path8.join(backupRoot, "destination");
|
|
5461
|
+
try {
|
|
5462
|
+
const snapshot = await captureExtensionInstallSnapshot(resolvedRoots.selected_root, resolvedRoots.settings_root, destinationDirectory, destinationExists, backupDirectory);
|
|
5463
|
+
const sourceRecord = buildInstallManagedSource(input3.bundledAliasName, input3.bundledPackageName, input3.installSource, input3.resolvedSource);
|
|
5464
|
+
const existingManagedEntry = managedStateRead.state.entries.find((entry) => normalizeExtensionNameForMatch(entry.name) === normalizeExtensionNameForMatch(validated.manifest.name));
|
|
5465
|
+
const timestamps = resolveManagedInstallTimestamps(existingManagedEntry, validated.manifest.version, sourceRecord, nowIso());
|
|
5466
|
+
const managedState = upsertManagedEntry(managedStateRead.state, {
|
|
5467
|
+
name: validated.manifest.name,
|
|
5468
|
+
directory: destinationDirectoryName,
|
|
5469
|
+
scope,
|
|
5470
|
+
manifest_version: validated.manifest.version,
|
|
5471
|
+
manifest_entry: validated.manifest.entry,
|
|
5472
|
+
capabilities: [...validated.manifest.capabilities],
|
|
5473
|
+
...timestamps,
|
|
5474
|
+
source: sourceRecord
|
|
5475
|
+
});
|
|
5476
|
+
const activationChanged = ensureActivated(settings, validated.manifest.name);
|
|
5477
|
+
try {
|
|
5478
|
+
if (!installInPlace) {
|
|
5479
|
+
await copyExtensionDirectoryForInstall(validated.directory, destinationDirectory);
|
|
5480
|
+
}
|
|
5481
|
+
await ensureExtensionModuleTypeMarker(destinationDirectory);
|
|
5482
|
+
await writeManagedExtensionState(resolvedRoots.selected_root, managedState);
|
|
5483
|
+
if (activationChanged) {
|
|
5484
|
+
await writeSettings(resolvedRoots.settings_root, settings, "settings:write");
|
|
5485
|
+
}
|
|
5486
|
+
} catch (error) {
|
|
5487
|
+
try {
|
|
5488
|
+
await restoreExtensionInstallSnapshot(snapshot);
|
|
5489
|
+
} catch (rollbackError) {
|
|
5490
|
+
throw new AggregateError([error, rollbackError], `Extension install failed: ${String(error)}; rollback failed: ${String(rollbackError)}`, { cause: rollbackError });
|
|
5491
|
+
}
|
|
5492
|
+
throw error;
|
|
5493
|
+
}
|
|
5494
|
+
return {
|
|
5495
|
+
settings,
|
|
5496
|
+
managedState,
|
|
5497
|
+
sourceRecord,
|
|
5498
|
+
destinationDirectory,
|
|
5499
|
+
destinationExists,
|
|
5500
|
+
installInPlace,
|
|
5501
|
+
activationChanged
|
|
5502
|
+
};
|
|
5503
|
+
} finally {
|
|
5504
|
+
await fs8.rm(backupRoot, { recursive: true, force: true }).catch(() => void 0);
|
|
5275
5505
|
}
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
const
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
if (scope === "project" && installedItemTypeDefinitions.length > 0) {
|
|
5282
|
-
await ensureTypeFolderScaffold(resolvedRoots.pm_root, installedItemTypeDefinitions, warnings, "install:type-folder");
|
|
5506
|
+
};
|
|
5507
|
+
var scaffoldInstalledExtensionItemTypes = async (ctx, extensionName, registrations) => {
|
|
5508
|
+
const definitions = registrations.filter((entry) => normalizeExtensionNameForMatch(entry.name) === normalizeExtensionNameForMatch(extensionName)).flatMap((entry) => entry.types.map((type) => ({ name: type.name, folder: type.folder })));
|
|
5509
|
+
if (ctx.scope === "project" && definitions.length > 0) {
|
|
5510
|
+
await ensureTypeFolderScaffold(ctx.resolvedRoots.pm_root, definitions, ctx.warnings, "install:type-folder");
|
|
5283
5511
|
}
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
const
|
|
5512
|
+
return definitions;
|
|
5513
|
+
};
|
|
5514
|
+
var buildInstalledExtensionActivation = (ctx, extensionName, runtimeProbe, commandSummary, installedItemTypes) => {
|
|
5515
|
+
const failure = findActivationFailureByName(extensionName, runtimeProbe.activation_failures, ctx.scope);
|
|
5516
|
+
const status = resolveInstallRuntimeActivationStatus(extensionName, ctx.scope, runtimeProbe.installed, failure);
|
|
5517
|
+
const activated = [!runtimeProbe.extensions_disabled, status === "ok"].every(Boolean);
|
|
5288
5518
|
if (!activated) {
|
|
5289
|
-
warnings.push(`extension_install_activation_failed:${scope}:${
|
|
5519
|
+
ctx.warnings.push(`extension_install_activation_failed:${ctx.scope}:${extensionName}:${status}`);
|
|
5290
5520
|
}
|
|
5291
|
-
const
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5521
|
+
const healthByActivation = {
|
|
5522
|
+
true: { status: "ok", blocking_failure_count: 0 },
|
|
5523
|
+
false: { status: "degraded", blocking_failure_count: 1 }
|
|
5524
|
+
};
|
|
5525
|
+
return {
|
|
5295
5526
|
activated,
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5527
|
+
status,
|
|
5528
|
+
failure,
|
|
5529
|
+
verification: {
|
|
5530
|
+
status: healthByActivation[String(activated)].status,
|
|
5531
|
+
target_pm_root: ctx.resolvedRoots.pm_root,
|
|
5532
|
+
activation_status: status,
|
|
5533
|
+
activated,
|
|
5534
|
+
registered_commands: commandSummary.command_paths,
|
|
5535
|
+
registered_actions: commandSummary.action_paths,
|
|
5536
|
+
registered_item_types: installedItemTypes,
|
|
5537
|
+
health: healthByActivation[String(activated)]
|
|
5302
5538
|
}
|
|
5303
5539
|
};
|
|
5540
|
+
};
|
|
5541
|
+
var performExtensionInstallUnderLock = async (ctx, input3) => {
|
|
5542
|
+
const { scope, resolvedRoots, warnings, global: global2, withResult } = ctx;
|
|
5543
|
+
const { validated, destinationDirectoryName } = input3;
|
|
5544
|
+
const persisted = await persistExtensionInstall(ctx, input3);
|
|
5545
|
+
const refreshedInstalled = await listInstalledExtensions(resolvedRoots.selected_root, scope, persisted.settings, persisted.managedState);
|
|
5546
|
+
warnings.push(...refreshedInstalled.warnings);
|
|
5547
|
+
const runtimeProbe = await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, persisted.settings, refreshedInstalled.extensions, global2);
|
|
5548
|
+
warnings.push(...runtimeProbe.warnings);
|
|
5549
|
+
const installedItemTypeDefinitions = await scaffoldInstalledExtensionItemTypes(ctx, validated.manifest.name, runtimeProbe.item_type_registrations);
|
|
5550
|
+
const commandSummary = summarizeRuntimeCommandPathsForExtension(validated.manifest.name, runtimeProbe.installed);
|
|
5551
|
+
const activation = buildInstalledExtensionActivation(ctx, validated.manifest.name, runtimeProbe, commandSummary, installedItemTypeDefinitions);
|
|
5304
5552
|
return withResult({
|
|
5305
5553
|
extension: {
|
|
5306
5554
|
name: validated.manifest.name,
|
|
@@ -5309,74 +5557,80 @@ async function performExtensionInstallUnderLock(ctx, input3) {
|
|
|
5309
5557
|
capabilities: validated.manifest.capabilities,
|
|
5310
5558
|
directory: destinationDirectoryName
|
|
5311
5559
|
},
|
|
5312
|
-
source: sourceRecord,
|
|
5313
|
-
destination_path: destinationDirectory,
|
|
5314
|
-
overwritten:
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5560
|
+
source: persisted.sourceRecord,
|
|
5561
|
+
destination_path: persisted.destinationDirectory,
|
|
5562
|
+
overwritten: [
|
|
5563
|
+
persisted.destinationExists,
|
|
5564
|
+
!persisted.installInPlace
|
|
5565
|
+
].every(Boolean),
|
|
5566
|
+
installed_in_place: persisted.installInPlace,
|
|
5567
|
+
activated: activation.activated,
|
|
5568
|
+
settings_changed: persisted.activationChanged,
|
|
5569
|
+
runtime_activation_status: activation.status,
|
|
5319
5570
|
command_paths: commandSummary.command_paths,
|
|
5320
5571
|
action_paths: commandSummary.action_paths,
|
|
5321
|
-
command_discovery: buildInstallCommandDiscovery(validated.manifest.name, sourceRecord, commandSummary,
|
|
5322
|
-
verification,
|
|
5572
|
+
command_discovery: buildInstallCommandDiscovery(validated.manifest.name, persisted.sourceRecord, commandSummary, activation.failure),
|
|
5573
|
+
verification: activation.verification,
|
|
5323
5574
|
activation_diagnostics: {
|
|
5324
5575
|
failed_count: runtimeProbe.activation_failures.length,
|
|
5325
5576
|
failed: runtimeProbe.activation_failures,
|
|
5326
|
-
installed_extension_failed:
|
|
5327
|
-
}
|
|
5328
|
-
}, activated);
|
|
5329
|
-
}
|
|
5330
|
-
async function runExtensionInstallAction(ctx) {
|
|
5331
|
-
const { action, normalizedTarget, resolvedRoots, warnings, options, global: global2, withResult } = ctx;
|
|
5332
|
-
const githubOption = resolveGithubOption(options);
|
|
5333
|
-
const explicitSourceInput = githubOption ?? requireTarget(normalizedTarget, action, options);
|
|
5334
|
-
if (typeof githubOption !== "string" && isBundledPackageInstallAllTarget(explicitSourceInput)) {
|
|
5335
|
-
if (typeof options.ref === "string" && options.ref.trim().length > 0) {
|
|
5336
|
-
throw new PmCliError('Action "install all" does not accept --ref.', EXIT_CODE.USAGE);
|
|
5337
|
-
}
|
|
5338
|
-
const aliases = await listBundledPackageAliases();
|
|
5339
|
-
const packages = [];
|
|
5340
|
-
for (const alias of aliases) {
|
|
5341
|
-
packages.push({
|
|
5342
|
-
alias,
|
|
5343
|
-
result: await runExtension(alias, { ...options, install: true }, global2)
|
|
5344
|
-
});
|
|
5577
|
+
installed_extension_failed: activation.failure ?? null
|
|
5345
5578
|
}
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5579
|
+
}, activation.activated);
|
|
5580
|
+
};
|
|
5581
|
+
var runBundledExtensionInstallAll = async (ctx) => {
|
|
5582
|
+
const { options, global: global2, warnings, withResult } = ctx;
|
|
5583
|
+
if (typeof options.ref === "string" && options.ref.trim().length > 0) {
|
|
5584
|
+
throw new PmCliError('Action "install all" does not accept --ref.', EXIT_CODE.USAGE);
|
|
5585
|
+
}
|
|
5586
|
+
const packages = [];
|
|
5587
|
+
for (const alias of await listBundledPackageAliases()) {
|
|
5588
|
+
packages.push({
|
|
5589
|
+
alias,
|
|
5590
|
+
result: await runExtension(alias, { ...options, install: true }, global2)
|
|
5591
|
+
});
|
|
5592
|
+
}
|
|
5593
|
+
warnings.push(...packages.flatMap((entry) => entry.result.warnings));
|
|
5594
|
+
const installedAll = packages.every((entry) => entry.result.ok);
|
|
5595
|
+
return withResult({
|
|
5596
|
+
installed_all: installedAll,
|
|
5597
|
+
installed_count: packages.filter((entry) => entry.result.ok).length,
|
|
5598
|
+
failed_count: packages.filter((entry) => !entry.result.ok).length,
|
|
5599
|
+
packages: packages.map((entry) => {
|
|
5600
|
+
const details = entry.result.details;
|
|
5601
|
+
return {
|
|
5355
5602
|
alias: entry.alias,
|
|
5356
5603
|
ok: entry.result.ok,
|
|
5357
|
-
extension:
|
|
5358
|
-
source:
|
|
5359
|
-
destination_path:
|
|
5360
|
-
activated:
|
|
5361
|
-
settings_changed:
|
|
5362
|
-
command_paths:
|
|
5363
|
-
action_paths:
|
|
5364
|
-
command_discovery:
|
|
5365
|
-
verification:
|
|
5366
|
-
runtime_activation_status:
|
|
5367
|
-
activation_diagnostics:
|
|
5604
|
+
extension: details.extension,
|
|
5605
|
+
source: details.source,
|
|
5606
|
+
destination_path: details.destination_path,
|
|
5607
|
+
activated: details.activated,
|
|
5608
|
+
settings_changed: details.settings_changed,
|
|
5609
|
+
command_paths: details.command_paths,
|
|
5610
|
+
action_paths: details.action_paths,
|
|
5611
|
+
command_discovery: details.command_discovery,
|
|
5612
|
+
verification: details.verification,
|
|
5613
|
+
runtime_activation_status: details.runtime_activation_status,
|
|
5614
|
+
activation_diagnostics: details.activation_diagnostics,
|
|
5368
5615
|
warnings: entry.result.warnings
|
|
5369
|
-
}
|
|
5370
|
-
}
|
|
5371
|
-
}
|
|
5616
|
+
};
|
|
5617
|
+
})
|
|
5618
|
+
}, installedAll);
|
|
5619
|
+
};
|
|
5620
|
+
var resolveSingleExtensionInstallSource = async (explicitSourceInput, githubOption, ref) => {
|
|
5372
5621
|
const bundledAliasSource = typeof githubOption === "string" ? null : await resolveBundledExtensionAliasSource(explicitSourceInput);
|
|
5373
5622
|
const bundledAliasName = bundledAliasSource === null ? null : explicitSourceInput.trim().toLowerCase();
|
|
5374
5623
|
const bundledPackageName = bundledAliasName === null ? null : await resolveBundledPackageNpmName(bundledAliasName);
|
|
5375
5624
|
const sourceInput = bundledAliasSource ?? explicitSourceInput;
|
|
5376
5625
|
const installSource = parseExtensionInstallSource(sourceInput, {
|
|
5377
5626
|
forceGithub: typeof githubOption === "string",
|
|
5378
|
-
ref
|
|
5627
|
+
ref
|
|
5379
5628
|
});
|
|
5629
|
+
return { bundledAliasName, bundledPackageName, installSource };
|
|
5630
|
+
};
|
|
5631
|
+
var runSingleExtensionInstall = async (ctx, explicitSourceInput, githubOption) => {
|
|
5632
|
+
const { resolvedRoots } = ctx;
|
|
5633
|
+
const { bundledAliasName, bundledPackageName, installSource } = await resolveSingleExtensionInstallSource(explicitSourceInput, githubOption, ctx.options.ref);
|
|
5380
5634
|
const resolvedSource = await resolveInstallSource(installSource);
|
|
5381
5635
|
try {
|
|
5382
5636
|
const validated = await validateExtensionDirectory(resolvedSource.directory);
|
|
@@ -5394,8 +5648,19 @@ async function runExtensionInstallAction(ctx) {
|
|
|
5394
5648
|
await resolvedSource.cleanup();
|
|
5395
5649
|
}
|
|
5396
5650
|
}
|
|
5397
|
-
}
|
|
5398
|
-
async
|
|
5651
|
+
};
|
|
5652
|
+
var runExtensionInstallAction = async (ctx) => {
|
|
5653
|
+
const githubOption = resolveGithubOption(ctx.options);
|
|
5654
|
+
const explicitSourceInput = githubOption ?? requireTarget(ctx.normalizedTarget, ctx.action, ctx.options);
|
|
5655
|
+
if ([
|
|
5656
|
+
githubOption === void 0,
|
|
5657
|
+
isBundledPackageInstallAllTarget(explicitSourceInput)
|
|
5658
|
+
].every(Boolean)) {
|
|
5659
|
+
return runBundledExtensionInstallAll(ctx);
|
|
5660
|
+
}
|
|
5661
|
+
return runSingleExtensionInstall(ctx, explicitSourceInput, githubOption);
|
|
5662
|
+
};
|
|
5663
|
+
var runExtensionAdoptAllAction = async (ctx) => {
|
|
5399
5664
|
const { normalizedTarget, scope, resolvedRoots, warnings, options, withResult } = ctx;
|
|
5400
5665
|
if (normalizedTarget !== void 0) {
|
|
5401
5666
|
throw new PmCliError('Action "adopt-all" does not accept a target argument.', EXIT_CODE.USAGE);
|
|
@@ -5414,14 +5679,18 @@ async function runExtensionAdoptAllAction(ctx) {
|
|
|
5414
5679
|
warnings.push(...refreshedInstalled.warnings);
|
|
5415
5680
|
const triage = buildExtensionTriageSummary(scope, warnings, refreshedInstalled.extensions, options);
|
|
5416
5681
|
warnings.push(...triage.warnings);
|
|
5682
|
+
const refreshedByIdentity = new Map(refreshedInstalled.extensions.map((entry) => [
|
|
5683
|
+
`${normalizeExtensionNameForMatch(entry.name)}:${normalizeExtensionNameForMatch(entry.directory)}`,
|
|
5684
|
+
entry
|
|
5685
|
+
]));
|
|
5686
|
+
const refreshedByDirectory = new Map(refreshedInstalled.extensions.map((entry) => [
|
|
5687
|
+
normalizeExtensionNameForMatch(entry.directory),
|
|
5688
|
+
entry
|
|
5689
|
+
]));
|
|
5417
5690
|
const adoptedDetails = adoption.adopted_entries.map((entry) => {
|
|
5418
|
-
const
|
|
5419
|
-
|
|
5420
|
-
return {
|
|
5421
|
-
...entry,
|
|
5422
|
-
update_check_status: refreshedEntry?.update_check_status ?? null,
|
|
5423
|
-
update_check_reason: refreshedEntry?.update_check_reason ?? null
|
|
5424
|
-
};
|
|
5691
|
+
const normalizedDirectory = normalizeExtensionNameForMatch(entry.directory);
|
|
5692
|
+
const refreshedEntry = refreshedByIdentity.get(`${normalizeExtensionNameForMatch(entry.name)}:${normalizedDirectory}`) ?? refreshedByDirectory.get(normalizedDirectory);
|
|
5693
|
+
return { ...entry, ...projectExtensionUpdateCheck(refreshedEntry) };
|
|
5425
5694
|
});
|
|
5426
5695
|
return withResult({
|
|
5427
5696
|
adopted_all: adoptedDetails.length > 0,
|
|
@@ -5433,8 +5702,40 @@ async function runExtensionAdoptAllAction(ctx) {
|
|
|
5433
5702
|
update_health_partial: triage.update_health_partial,
|
|
5434
5703
|
update_health_coverage: triage.update_health_coverage
|
|
5435
5704
|
});
|
|
5436
|
-
}
|
|
5437
|
-
|
|
5705
|
+
};
|
|
5706
|
+
var projectExtensionUpdateCheck = (entry) => {
|
|
5707
|
+
return {
|
|
5708
|
+
update_check_status: entry?.update_check_status ?? null,
|
|
5709
|
+
update_check_reason: entry?.update_check_reason ?? null
|
|
5710
|
+
};
|
|
5711
|
+
};
|
|
5712
|
+
var buildAdoptedExtensionSource = (githubOption, extensionTarget, extensionDirectory, ref) => {
|
|
5713
|
+
if (githubOption === void 0) {
|
|
5714
|
+
return {
|
|
5715
|
+
kind: "local",
|
|
5716
|
+
input: extensionTarget,
|
|
5717
|
+
location: extensionDirectory
|
|
5718
|
+
};
|
|
5719
|
+
}
|
|
5720
|
+
const parsed = parseExtensionInstallSource(githubOption, {
|
|
5721
|
+
forceGithub: true,
|
|
5722
|
+
ref
|
|
5723
|
+
});
|
|
5724
|
+
if (parsed.kind !== "github") {
|
|
5725
|
+
throw new PmCliError(`Invalid GitHub shorthand "${githubOption}".`, EXIT_CODE.USAGE);
|
|
5726
|
+
}
|
|
5727
|
+
return {
|
|
5728
|
+
kind: "github",
|
|
5729
|
+
input: parsed.input,
|
|
5730
|
+
location: parsed.subpath ?? ".",
|
|
5731
|
+
repository: parsed.repository,
|
|
5732
|
+
owner: parsed.owner,
|
|
5733
|
+
repo: parsed.repo,
|
|
5734
|
+
ref: parsed.ref,
|
|
5735
|
+
subpath: parsed.subpath
|
|
5736
|
+
};
|
|
5737
|
+
};
|
|
5738
|
+
var runExtensionAdoptAction = async (ctx) => {
|
|
5438
5739
|
const { action, normalizedTarget, scope, resolvedRoots, warnings, options, withResult } = ctx;
|
|
5439
5740
|
const extensionTarget = requireTarget(normalizedTarget, action, options);
|
|
5440
5741
|
const githubOption = resolveGithubOption(options);
|
|
@@ -5457,32 +5758,10 @@ async function runExtensionAdoptAction(ctx) {
|
|
|
5457
5758
|
}
|
|
5458
5759
|
});
|
|
5459
5760
|
}
|
|
5460
|
-
const extensionDirectory =
|
|
5761
|
+
const extensionDirectory = path8.join(resolvedRoots.selected_root, candidate.directory);
|
|
5461
5762
|
const validated = await validateExtensionDirectory(extensionDirectory);
|
|
5462
5763
|
const now = nowIso();
|
|
5463
|
-
const sourceRecord = githubOption
|
|
5464
|
-
kind: "local",
|
|
5465
|
-
input: extensionTarget,
|
|
5466
|
-
location: extensionDirectory
|
|
5467
|
-
} : (() => {
|
|
5468
|
-
const parsed = parseExtensionInstallSource(githubOption, {
|
|
5469
|
-
forceGithub: true,
|
|
5470
|
-
ref: options.ref
|
|
5471
|
-
});
|
|
5472
|
-
if (parsed.kind !== "github") {
|
|
5473
|
-
throw new PmCliError(`Invalid GitHub shorthand "${githubOption}".`, EXIT_CODE.USAGE);
|
|
5474
|
-
}
|
|
5475
|
-
return {
|
|
5476
|
-
kind: "github",
|
|
5477
|
-
input: parsed.input,
|
|
5478
|
-
location: parsed.subpath ?? ".",
|
|
5479
|
-
repository: parsed.repository,
|
|
5480
|
-
owner: parsed.owner,
|
|
5481
|
-
repo: parsed.repo,
|
|
5482
|
-
ref: parsed.ref,
|
|
5483
|
-
subpath: parsed.subpath
|
|
5484
|
-
};
|
|
5485
|
-
})();
|
|
5764
|
+
const sourceRecord = buildAdoptedExtensionSource(githubOption, extensionTarget, extensionDirectory, options.ref);
|
|
5486
5765
|
const managedState = upsertManagedEntry(managedStateRead.state, {
|
|
5487
5766
|
name: validated.manifest.name,
|
|
5488
5767
|
directory: candidate.directory,
|
|
@@ -5507,11 +5786,10 @@ async function runExtensionAdoptAction(ctx) {
|
|
|
5507
5786
|
entry: validated.manifest.entry
|
|
5508
5787
|
},
|
|
5509
5788
|
source: sourceRecord,
|
|
5510
|
-
|
|
5511
|
-
update_check_reason: refreshedEntry?.update_check_reason ?? null
|
|
5789
|
+
...projectExtensionUpdateCheck(refreshedEntry)
|
|
5512
5790
|
});
|
|
5513
|
-
}
|
|
5514
|
-
async
|
|
5791
|
+
};
|
|
5792
|
+
var resolveRequiredInstalledExtension = async (ctx) => {
|
|
5515
5793
|
const { action, normalizedTarget, scope, resolvedRoots, warnings, options } = ctx;
|
|
5516
5794
|
const extensionTarget = requireTarget(normalizedTarget, action, options);
|
|
5517
5795
|
const settings = await readSettings(resolvedRoots.settings_root);
|
|
@@ -5524,12 +5802,12 @@ async function resolveRequiredInstalledExtension(ctx) {
|
|
|
5524
5802
|
throw new PmCliError(`Installed extension "${extensionTarget}" was not found in ${scope} scope.`, EXIT_CODE.NOT_FOUND);
|
|
5525
5803
|
}
|
|
5526
5804
|
return { settings, managedStateRead, candidate };
|
|
5527
|
-
}
|
|
5528
|
-
async
|
|
5805
|
+
};
|
|
5806
|
+
var runExtensionUninstallAction = async (ctx) => {
|
|
5529
5807
|
const { resolvedRoots, withResult } = ctx;
|
|
5530
5808
|
const { settings, managedStateRead, candidate } = await resolveRequiredInstalledExtension(ctx);
|
|
5531
|
-
const destinationDirectory =
|
|
5532
|
-
await
|
|
5809
|
+
const destinationDirectory = path8.join(resolvedRoots.selected_root, candidate.directory);
|
|
5810
|
+
await fs8.rm(destinationDirectory, { recursive: true, force: true });
|
|
5533
5811
|
const updatedState = {
|
|
5534
5812
|
...managedStateRead.state,
|
|
5535
5813
|
updated_at: nowIso(),
|
|
@@ -5551,8 +5829,8 @@ async function runExtensionUninstallAction(ctx) {
|
|
|
5551
5829
|
destination_path: destinationDirectory,
|
|
5552
5830
|
settings_changed: stateChanged
|
|
5553
5831
|
});
|
|
5554
|
-
}
|
|
5555
|
-
async
|
|
5832
|
+
};
|
|
5833
|
+
var runExtensionActivateDeactivateAction = async (ctx) => {
|
|
5556
5834
|
const { action, resolvedRoots, withResult } = ctx;
|
|
5557
5835
|
const { settings, candidate } = await resolveRequiredInstalledExtension(ctx);
|
|
5558
5836
|
const settingsChanged = action === "activate" ? ensureActivated(settings, candidate.name) : ensureDeactivated(settings, candidate.name);
|
|
@@ -5571,37 +5849,65 @@ async function runExtensionActivateDeactivateAction(ctx) {
|
|
|
5571
5849
|
disabled: [...settings.extensions.disabled]
|
|
5572
5850
|
}
|
|
5573
5851
|
});
|
|
5574
|
-
}
|
|
5575
|
-
|
|
5852
|
+
};
|
|
5853
|
+
var buildDoctorRemediation = (baseRemediation, loadFailureCount, activationFailureCount, vocabulary, managedStateFix, isolationHint) => {
|
|
5854
|
+
const noun = vocabulary === "package" ? "package" : "extension";
|
|
5855
|
+
const doctorAction = { package: "doctor", extension: "--doctor" }[noun];
|
|
5856
|
+
const adoptedCount = managedStateFix?.adopted_entries.length ?? 0;
|
|
5857
|
+
const conditionalEntries = [
|
|
5858
|
+
[isolationHint !== null, isolationHint ?? ""],
|
|
5859
|
+
[
|
|
5860
|
+
loadFailureCount > 0,
|
|
5861
|
+
`Run pm ${noun} explore --project and pm ${noun} explore --global to inspect load failures.`
|
|
5862
|
+
],
|
|
5863
|
+
[
|
|
5864
|
+
activationFailureCount > 0,
|
|
5865
|
+
`Review activation failures in pm ${noun} ${doctorAction} --detail deep output.`
|
|
5866
|
+
],
|
|
5867
|
+
[
|
|
5868
|
+
adoptedCount > 0,
|
|
5869
|
+
`Managed-state fix adopted ${adoptedCount} extension(s).`
|
|
5870
|
+
]
|
|
5871
|
+
];
|
|
5576
5872
|
return [
|
|
5577
5873
|
...new Set([
|
|
5578
5874
|
...baseRemediation,
|
|
5579
|
-
...
|
|
5580
|
-
/* c8 ignore start -- vocabulary-specific remediation branches are copy-only variants */
|
|
5581
|
-
...loadFailureCount > 0 ? [
|
|
5582
|
-
vocabulary === "package" ? "Run pm package explore --project and pm package explore --global to inspect load failures." : "Run pm extension --explore --project and pm extension --explore --global to inspect load failures."
|
|
5583
|
-
] : [],
|
|
5584
|
-
...activationFailureCount > 0 ? [
|
|
5585
|
-
vocabulary === "package" ? "Review activation failures in pm package doctor --detail deep output." : "Review activation failures in pm extension --doctor --detail deep output."
|
|
5586
|
-
] : [],
|
|
5587
|
-
/* c8 ignore stop */
|
|
5588
|
-
...managedStateFix && managedStateFix.adopted_entries.length > 0 ? [
|
|
5589
|
-
`Managed-state fix adopted ${managedStateFix.adopted_entries.length} extension(s).`
|
|
5590
|
-
] : []
|
|
5875
|
+
...conditionalEntries.filter(([include]) => include).map(([, entry]) => entry)
|
|
5591
5876
|
].map((entry) => entry.trim()).filter((entry) => entry.length > 0))
|
|
5592
5877
|
];
|
|
5593
|
-
}
|
|
5594
|
-
|
|
5878
|
+
};
|
|
5879
|
+
var hasGlobalLayerDiagnostics = (loadResult) => {
|
|
5595
5880
|
return loadResult.loaded.some((entry) => entry.layer === "global") || loadResult.failed.some((entry) => entry.layer === "global") || loadResult.warnings.some((warning) => warning.includes(":global:"));
|
|
5596
|
-
}
|
|
5597
|
-
|
|
5881
|
+
};
|
|
5882
|
+
var buildDoctorIsolationHint = (scope, isolated, vocabulary, loadResult) => {
|
|
5598
5883
|
if (scope !== "project" || isolated || !hasGlobalLayerDiagnostics(loadResult)) {
|
|
5599
5884
|
return null;
|
|
5600
5885
|
}
|
|
5601
5886
|
const noun = vocabulary === "package" ? "package" : "extension";
|
|
5602
5887
|
return `Global ${noun} registrations are included in project diagnostics. For hermetic ${noun} smoke tests, rerun pm ${noun} doctor --project --isolated --detail deep --trace, or set PM_GLOBAL_PATH to a temporary directory for the whole test process.`;
|
|
5603
|
-
}
|
|
5604
|
-
|
|
5888
|
+
};
|
|
5889
|
+
var resolveDoctorInvocationOptions = (target, scope, options) => {
|
|
5890
|
+
if (String(target ?? "").trim().length > 0) {
|
|
5891
|
+
throw new PmCliError('Action "doctor" does not accept a target argument.', EXIT_CODE.USAGE);
|
|
5892
|
+
}
|
|
5893
|
+
const isolated = [options.isolated, options.ignoreGlobal].includes(true);
|
|
5894
|
+
if ([isolated, scope === "global"].every(Boolean)) {
|
|
5895
|
+
throw new PmCliError("--isolated and --ignore-global are only valid with project-scope doctor diagnostics.", EXIT_CODE.USAGE);
|
|
5896
|
+
}
|
|
5897
|
+
const detailMode = parseDoctorDetailMode(options.detail);
|
|
5898
|
+
const includeTrace = options.trace === true;
|
|
5899
|
+
if ([includeTrace, detailMode !== "deep"].every(Boolean)) {
|
|
5900
|
+
throw new PmCliError("--trace requires --detail deep with --doctor.", EXIT_CODE.USAGE);
|
|
5901
|
+
}
|
|
5902
|
+
return { isolated, detailMode, includeTrace };
|
|
5903
|
+
};
|
|
5904
|
+
var applyDoctorManagedStateFix = async (ctx, installed, state) => {
|
|
5905
|
+
if (ctx.options.fixManagedState !== true)
|
|
5906
|
+
return { state, fix: null };
|
|
5907
|
+
const fix = await adoptUnmanagedExtensions(ctx.resolvedRoots.selected_root, ctx.scope, installed, state);
|
|
5908
|
+
return { state: fix.state, fix };
|
|
5909
|
+
};
|
|
5910
|
+
var buildDoctorIsolationMetadata = (scope, isolated, vocabulary, loadResult) => {
|
|
5605
5911
|
const noun = vocabulary === "package" ? "package" : "extension";
|
|
5606
5912
|
if (scope !== "project") {
|
|
5607
5913
|
return {
|
|
@@ -5620,31 +5926,16 @@ function buildDoctorIsolationMetadata(scope, isolated, vocabulary, loadResult) {
|
|
|
5620
5926
|
rerun_command: isolated ? null : isolatedCommand,
|
|
5621
5927
|
pm_global_path_recipe: `PM_GLOBAL_PATH=$(mktemp -d) pm ${noun} doctor --project --detail deep --trace`
|
|
5622
5928
|
};
|
|
5623
|
-
}
|
|
5624
|
-
async
|
|
5929
|
+
};
|
|
5930
|
+
var runExtensionDoctorAction = async (ctx) => {
|
|
5625
5931
|
const { normalizedTarget, scope, resolvedRoots, warnings, options, global: global2, withResult } = ctx;
|
|
5626
|
-
|
|
5627
|
-
throw new PmCliError('Action "doctor" does not accept a target argument.', EXIT_CODE.USAGE);
|
|
5628
|
-
}
|
|
5629
|
-
const isolated = options.isolated === true || options.ignoreGlobal === true;
|
|
5630
|
-
if (isolated && scope === "global") {
|
|
5631
|
-
throw new PmCliError("--isolated and --ignore-global are only valid with project-scope doctor diagnostics.", EXIT_CODE.USAGE);
|
|
5632
|
-
}
|
|
5633
|
-
const detailMode = parseDoctorDetailMode(options.detail);
|
|
5634
|
-
const includeTrace = options.trace === true;
|
|
5635
|
-
if (includeTrace && detailMode !== "deep") {
|
|
5636
|
-
throw new PmCliError("--trace requires --detail deep with --doctor.", EXIT_CODE.USAGE);
|
|
5637
|
-
}
|
|
5932
|
+
const { isolated, detailMode, includeTrace } = resolveDoctorInvocationOptions(normalizedTarget, scope, options);
|
|
5638
5933
|
const settings = await readSettings(resolvedRoots.settings_root);
|
|
5639
5934
|
const managedStateRead = await readManagedExtensionState(resolvedRoots.selected_root);
|
|
5640
5935
|
warnings.push(...managedStateRead.warnings);
|
|
5641
5936
|
const installed = await listInstalledExtensions(resolvedRoots.selected_root, scope, settings, managedStateRead.state);
|
|
5642
5937
|
warnings.push(...installed.warnings);
|
|
5643
|
-
|
|
5644
|
-
const managedStateFix = options.fixManagedState === true ? await adoptUnmanagedExtensions(resolvedRoots.selected_root, scope, installed.extensions, managedStateRead.state) : null;
|
|
5645
|
-
if (managedStateFix) {
|
|
5646
|
-
managedState = managedStateFix.state;
|
|
5647
|
-
}
|
|
5938
|
+
const { state: managedState, fix: managedStateFix } = await applyDoctorManagedStateFix(ctx, installed.extensions, managedStateRead.state);
|
|
5648
5939
|
const refreshedInstalled = await listInstalledExtensions(resolvedRoots.selected_root, scope, settings, managedState);
|
|
5649
5940
|
warnings.push(...refreshedInstalled.warnings);
|
|
5650
5941
|
const loadResult = await loadExtensions({
|
|
@@ -5813,21 +6104,21 @@ async function runExtensionDoctorAction(ctx) {
|
|
|
5813
6104
|
name: entry.name,
|
|
5814
6105
|
entry_path: entry.entry_path,
|
|
5815
6106
|
error: entry.error,
|
|
5816
|
-
method: entry.trace
|
|
5817
|
-
command: entry.trace
|
|
5818
|
-
capability: entry.trace
|
|
5819
|
-
missing_capability: entry.trace
|
|
5820
|
-
registration_index: entry.trace
|
|
5821
|
-
expected_schema: entry.trace
|
|
5822
|
-
hint: entry.trace
|
|
5823
|
-
received: entry.trace
|
|
6107
|
+
method: entry.trace.method,
|
|
6108
|
+
command: entry.trace.command,
|
|
6109
|
+
capability: entry.trace.capability,
|
|
6110
|
+
missing_capability: entry.trace.missing_capability,
|
|
6111
|
+
registration_index: entry.trace.registration_index,
|
|
6112
|
+
expected_schema: entry.trace.expected_schema,
|
|
6113
|
+
hint: entry.trace.hint,
|
|
6114
|
+
received: entry.trace.received
|
|
5824
6115
|
}))
|
|
5825
6116
|
};
|
|
5826
6117
|
}
|
|
5827
6118
|
}
|
|
5828
6119
|
return withResult(details);
|
|
5829
|
-
}
|
|
5830
|
-
async
|
|
6120
|
+
};
|
|
6121
|
+
var runExtensionDescribeAction = async (ctx) => {
|
|
5831
6122
|
const { normalizedTarget, scope, resolvedRoots, warnings, options, global: global2, withResult } = ctx;
|
|
5832
6123
|
const settings = await readSettings(resolvedRoots.settings_root);
|
|
5833
6124
|
const loadResult = await loadExtensions({
|
|
@@ -5854,25 +6145,18 @@ async function runExtensionDescribeAction(ctx) {
|
|
|
5854
6145
|
extensions: describeResult.extensions,
|
|
5855
6146
|
union: describeResult.union
|
|
5856
6147
|
});
|
|
5857
|
-
}
|
|
5858
|
-
async
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
if (managedStateFix) {
|
|
5869
|
-
managedState = managedStateFix.state;
|
|
5870
|
-
}
|
|
5871
|
-
if (action === "manage") {
|
|
5872
|
-
const updates = await Promise.all(managedState.entries.map(async (entry) => {
|
|
5873
|
-
if (entry.source.kind !== "github") {
|
|
6148
|
+
};
|
|
6149
|
+
var prepareExploreManageState = async (ctx, installed, initialState) => {
|
|
6150
|
+
let state = initialState;
|
|
6151
|
+
let fix = null;
|
|
6152
|
+
if ([ctx.action === "manage", ctx.options.fixManagedState === true].every(Boolean)) {
|
|
6153
|
+
fix = await adoptUnmanagedExtensions(ctx.resolvedRoots.selected_root, ctx.scope, installed, initialState);
|
|
6154
|
+
state = fix.state;
|
|
6155
|
+
}
|
|
6156
|
+
if (ctx.action === "manage") {
|
|
6157
|
+
const entries = await mapWithFixedConcurrency(state.entries, GITHUB_UPDATE_CHECK_CONCURRENCY, async (entry) => {
|
|
6158
|
+
if (entry.source.kind !== "github")
|
|
5874
6159
|
return entry;
|
|
5875
|
-
}
|
|
5876
6160
|
const updateStatus = await checkGithubUpdate(entry.source);
|
|
5877
6161
|
return {
|
|
5878
6162
|
...entry,
|
|
@@ -5881,55 +6165,85 @@ async function runExtensionExploreManageAction(ctx) {
|
|
|
5881
6165
|
update_available: updateStatus.available,
|
|
5882
6166
|
update_error: updateStatus.error
|
|
5883
6167
|
};
|
|
5884
|
-
})
|
|
5885
|
-
|
|
5886
|
-
...
|
|
6168
|
+
});
|
|
6169
|
+
state = {
|
|
6170
|
+
...state,
|
|
5887
6171
|
updated_at: nowIso(),
|
|
5888
|
-
entries: sortManagedEntries(
|
|
6172
|
+
entries: sortManagedEntries(entries)
|
|
5889
6173
|
};
|
|
5890
|
-
await writeManagedExtensionState(resolvedRoots.selected_root,
|
|
6174
|
+
await writeManagedExtensionState(ctx.resolvedRoots.selected_root, state);
|
|
5891
6175
|
}
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
6176
|
+
return { state, fix };
|
|
6177
|
+
};
|
|
6178
|
+
var probeExploreManageRuntime = async (ctx, settings, installed) => {
|
|
6179
|
+
const requested = [
|
|
6180
|
+
ctx.action === "explore",
|
|
6181
|
+
ctx.options.runtimeProbe === true
|
|
6182
|
+
].includes(true);
|
|
6183
|
+
if (!requested) {
|
|
6184
|
+
return {
|
|
6185
|
+
installed,
|
|
6186
|
+
failures: void 0,
|
|
6187
|
+
summary: { requested: false, executed: false }
|
|
6188
|
+
};
|
|
5897
6189
|
}
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
warnings.push(...activationResult.warnings);
|
|
5914
|
-
runtimeInstalledExtensions = applyDoctorRuntimeActivationState(refreshedInstalled.extensions, loadResult, activationResult);
|
|
5915
|
-
runtimeActivationFailures = collectActivationFailureDiagnostics(activationResult.failed);
|
|
5916
|
-
runtimeProbeSummary = {
|
|
6190
|
+
const loadResult = await loadExtensions({
|
|
6191
|
+
pmRoot: ctx.resolvedRoots.pm_root,
|
|
6192
|
+
settings,
|
|
6193
|
+
cwd: process.cwd(),
|
|
6194
|
+
noExtensions: ctx.global.noExtensions === true
|
|
6195
|
+
});
|
|
6196
|
+
const activationResult = await activateExtensions({
|
|
6197
|
+
...loadResult,
|
|
6198
|
+
loaded: loadResult.loaded
|
|
6199
|
+
});
|
|
6200
|
+
ctx.warnings.push(...loadResult.warnings, ...activationResult.warnings);
|
|
6201
|
+
return {
|
|
6202
|
+
installed: applyDoctorRuntimeActivationState(installed, loadResult, activationResult),
|
|
6203
|
+
failures: collectActivationFailureDiagnostics(activationResult.failed),
|
|
6204
|
+
summary: {
|
|
5917
6205
|
requested: true,
|
|
5918
6206
|
executed: true,
|
|
5919
|
-
reason: action === "explore" ? "explore_defaults_to_runtime_probe" : "runtime_probe_requested",
|
|
6207
|
+
reason: ctx.action === "explore" ? "explore_defaults_to_runtime_probe" : "runtime_probe_requested",
|
|
5920
6208
|
load_failure_count: loadResult.failed.length,
|
|
5921
6209
|
activation_failure_count: activationResult.failed.length,
|
|
5922
6210
|
warning_count: [
|
|
5923
6211
|
.../* @__PURE__ */ new Set([...loadResult.warnings, ...activationResult.warnings])
|
|
5924
6212
|
].length,
|
|
5925
6213
|
policy: loadResult.policy
|
|
5926
|
-
}
|
|
5927
|
-
}
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
6214
|
+
}
|
|
6215
|
+
};
|
|
6216
|
+
};
|
|
6217
|
+
var projectExploreManageFix = (fix, installed) => fix ? {
|
|
6218
|
+
requested: true,
|
|
6219
|
+
applied: fix.adopted_entries.length > 0,
|
|
6220
|
+
adopted_count: fix.adopted_entries.length,
|
|
6221
|
+
adopted_extensions: fix.adopted_entries.map((entry) => entry.name),
|
|
6222
|
+
already_managed_count: fix.already_managed_count
|
|
6223
|
+
} : {
|
|
6224
|
+
requested: false,
|
|
6225
|
+
applied: false,
|
|
6226
|
+
adopted_count: 0,
|
|
6227
|
+
adopted_extensions: [],
|
|
6228
|
+
already_managed_count: installed.filter((entry) => entry.managed).length
|
|
6229
|
+
};
|
|
6230
|
+
var runExtensionExploreManageAction = async (ctx) => {
|
|
6231
|
+
const { action, scope, resolvedRoots, warnings, options, withResult } = ctx;
|
|
6232
|
+
const settings = await readSettings(resolvedRoots.settings_root);
|
|
6233
|
+
const configuredPolicy = buildExtensionPolicyDetails(settings.extensions.policy);
|
|
6234
|
+
const managedStateRead = await readManagedExtensionState(resolvedRoots.selected_root);
|
|
6235
|
+
warnings.push(...managedStateRead.warnings);
|
|
6236
|
+
const installed = await listInstalledExtensions(resolvedRoots.selected_root, scope, settings, managedStateRead.state);
|
|
6237
|
+
warnings.push(...installed.warnings);
|
|
6238
|
+
const { state: managedState, fix: managedStateFix } = await prepareExploreManageState(ctx, installed.extensions, managedStateRead.state);
|
|
6239
|
+
const refreshedInstalled = await listInstalledExtensions(resolvedRoots.selected_root, scope, settings, managedState);
|
|
6240
|
+
warnings.push(...refreshedInstalled.warnings);
|
|
6241
|
+
if (action === "manage") {
|
|
6242
|
+
const updateWarnings = refreshedInstalled.extensions.filter((entry) => entry.update_check_status === "failed").map((entry) => `extension_update_check_failed:${entry.name}`);
|
|
6243
|
+
warnings.push(...updateWarnings);
|
|
5932
6244
|
}
|
|
6245
|
+
const runtimeProbe = await probeExploreManageRuntime(ctx, settings, refreshedInstalled.extensions);
|
|
6246
|
+
const runtimeInstalledExtensions = runtimeProbe.installed;
|
|
5933
6247
|
const triage = buildExtensionTriageSummary(scope, warnings, runtimeInstalledExtensions, options);
|
|
5934
6248
|
warnings.push(...triage.warnings);
|
|
5935
6249
|
const details = {
|
|
@@ -5941,33 +6255,21 @@ async function runExtensionExploreManageAction(ctx) {
|
|
|
5941
6255
|
triage,
|
|
5942
6256
|
policy: configuredPolicy
|
|
5943
6257
|
};
|
|
5944
|
-
if (
|
|
6258
|
+
if (runtimeProbe.failures !== void 0) {
|
|
5945
6259
|
details.activation_diagnostics = {
|
|
5946
|
-
failed_count:
|
|
5947
|
-
failed:
|
|
6260
|
+
failed_count: runtimeProbe.failures.length,
|
|
6261
|
+
failed: runtimeProbe.failures
|
|
5948
6262
|
};
|
|
5949
6263
|
}
|
|
5950
6264
|
if (action === "explore") {
|
|
5951
|
-
details.runtime_probe =
|
|
6265
|
+
details.runtime_probe = runtimeProbe.summary;
|
|
5952
6266
|
}
|
|
5953
6267
|
if (action === "manage") {
|
|
5954
|
-
details.runtime_probe =
|
|
5955
|
-
details.managed_state_fix = managedStateFix
|
|
5956
|
-
requested: true,
|
|
5957
|
-
applied: managedStateFix.adopted_entries.length > 0,
|
|
5958
|
-
adopted_count: managedStateFix.adopted_entries.length,
|
|
5959
|
-
adopted_extensions: managedStateFix.adopted_entries.map((entry) => entry.name),
|
|
5960
|
-
already_managed_count: managedStateFix.already_managed_count
|
|
5961
|
-
} : {
|
|
5962
|
-
requested: false,
|
|
5963
|
-
applied: false,
|
|
5964
|
-
adopted_count: 0,
|
|
5965
|
-
adopted_extensions: [],
|
|
5966
|
-
already_managed_count: runtimeInstalledExtensions.filter((entry) => entry.managed).length
|
|
5967
|
-
};
|
|
6268
|
+
details.runtime_probe = runtimeProbe.summary;
|
|
6269
|
+
details.managed_state_fix = projectExploreManageFix(managedStateFix, runtimeInstalledExtensions);
|
|
5968
6270
|
}
|
|
5969
6271
|
return withResult(details);
|
|
5970
|
-
}
|
|
6272
|
+
};
|
|
5971
6273
|
var EXTENSION_ACTION_HANDLERS = {
|
|
5972
6274
|
init: runExtensionInitAction,
|
|
5973
6275
|
install: runExtensionInstallAction,
|
|
@@ -5983,10 +6285,20 @@ var EXTENSION_ACTION_HANDLERS = {
|
|
|
5983
6285
|
activate: runExtensionActivateDeactivateAction,
|
|
5984
6286
|
deactivate: runExtensionActivateDeactivateAction
|
|
5985
6287
|
};
|
|
6288
|
+
var requiresExtensionStateLock = (ctx) => [
|
|
6289
|
+
ctx.action === "uninstall",
|
|
6290
|
+
ctx.action === "manage",
|
|
6291
|
+
ctx.action === "adopt",
|
|
6292
|
+
ctx.action === "adopt-all",
|
|
6293
|
+
ctx.action === "activate",
|
|
6294
|
+
ctx.action === "deactivate",
|
|
6295
|
+
[ctx.action === "doctor", ctx.options.fixManagedState === true].every(Boolean)
|
|
6296
|
+
].some(Boolean);
|
|
6297
|
+
var dispatchExtensionAction = (ctx) => requiresExtensionStateLock(ctx) ? withExtensionInstallLock(ctx.resolvedRoots.settings_root, `${ctx.action}-state`, () => EXTENSION_ACTION_HANDLERS[ctx.action](ctx)) : EXTENSION_ACTION_HANDLERS[ctx.action](ctx);
|
|
5986
6298
|
|
|
5987
6299
|
// dist/sdk/workspace.js
|
|
5988
6300
|
import { readFile, writeFile } from "node:fs/promises";
|
|
5989
|
-
import
|
|
6301
|
+
import path9 from "node:path";
|
|
5990
6302
|
!(function() {
|
|
5991
6303
|
try {
|
|
5992
6304
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
@@ -6007,7 +6319,7 @@ function getPmGitignoreBlock() {
|
|
|
6007
6319
|
return PM_GITIGNORE_BLOCK;
|
|
6008
6320
|
}
|
|
6009
6321
|
async function ensurePmGitignore(workspaceRoot) {
|
|
6010
|
-
const gitignorePath =
|
|
6322
|
+
const gitignorePath = path9.join(workspaceRoot, ".gitignore");
|
|
6011
6323
|
let current = "";
|
|
6012
6324
|
try {
|
|
6013
6325
|
current = await readFile(gitignorePath, "utf8");
|
|
@@ -6031,21 +6343,15 @@ async function ensurePmGitignore(workspaceRoot) {
|
|
|
6031
6343
|
return { path: gitignorePath, changed: true };
|
|
6032
6344
|
}
|
|
6033
6345
|
|
|
6034
|
-
// dist/
|
|
6035
|
-
import
|
|
6036
|
-
import
|
|
6037
|
-
import readline2 from "node:readline/promises";
|
|
6038
|
-
import { stdin as input2, stdout as output2 } from "node:process";
|
|
6039
|
-
|
|
6040
|
-
// dist/cli/commands/init-agent-guidance.js
|
|
6041
|
-
import fs7 from "node:fs/promises";
|
|
6042
|
-
import path8 from "node:path";
|
|
6346
|
+
// dist/sdk/init-agent-guidance.js
|
|
6347
|
+
import fs9 from "node:fs/promises";
|
|
6348
|
+
import path10 from "node:path";
|
|
6043
6349
|
import readline from "node:readline/promises";
|
|
6044
6350
|
import { stdin as input, stdout as output } from "node:process";
|
|
6045
6351
|
!(function() {
|
|
6046
6352
|
try {
|
|
6047
6353
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
6048
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
6354
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "af67f5e2-fd83-5ed4-8afb-f45abf7fd893");
|
|
6049
6355
|
} catch (e2) {
|
|
6050
6356
|
}
|
|
6051
6357
|
})();
|
|
@@ -6075,13 +6381,33 @@ var AGENT_GUIDANCE_START_MARKER_PREFIX = "<!-- pm-cli:agent-guidance:start:";
|
|
|
6075
6381
|
var AGENT_GUIDANCE_START_MARKER = `<!-- pm-cli:agent-guidance:start:v${AGENT_GUIDANCE_TEMPLATE_VERSION} -->`;
|
|
6076
6382
|
var AGENT_GUIDANCE_END_MARKER = "<!-- pm-cli:agent-guidance:end -->";
|
|
6077
6383
|
var AGENT_GUIDANCE_ADD_LATER_HINT = "Add workflow guidance later: pm init --agent-guidance add";
|
|
6384
|
+
var _testOnly = {
|
|
6385
|
+
toPortableRelativePath,
|
|
6386
|
+
ensureTrailingNewline,
|
|
6387
|
+
detectLineEnding,
|
|
6388
|
+
findGuidanceBlockRange,
|
|
6389
|
+
buildAgentGuidanceBlock,
|
|
6390
|
+
upsertAgentGuidanceBlock,
|
|
6391
|
+
resolveProjectRoot,
|
|
6392
|
+
resolveTargetGuidancePath,
|
|
6393
|
+
parsePromptChoice,
|
|
6394
|
+
pushUnique,
|
|
6395
|
+
promptForGuidanceWrite,
|
|
6396
|
+
normalizeAgentGuidanceState,
|
|
6397
|
+
applyAgentGuidanceState,
|
|
6398
|
+
writeGuidanceFile,
|
|
6399
|
+
setAgentGuidanceReadlineFactoryForTests
|
|
6400
|
+
};
|
|
6078
6401
|
var createAgentGuidanceReadlineInterface = () => readline.createInterface({ input, output });
|
|
6402
|
+
function setAgentGuidanceReadlineFactoryForTests(factory) {
|
|
6403
|
+
createAgentGuidanceReadlineInterface = factory ?? (() => readline.createInterface({ input, output }));
|
|
6404
|
+
}
|
|
6079
6405
|
function toPortableRelativePath(projectRoot, targetPath) {
|
|
6080
|
-
const relative =
|
|
6406
|
+
const relative = path10.relative(projectRoot, targetPath);
|
|
6081
6407
|
if (relative.length === 0) {
|
|
6082
|
-
return
|
|
6408
|
+
return path10.basename(targetPath);
|
|
6083
6409
|
}
|
|
6084
|
-
return relative.split(
|
|
6410
|
+
return relative.split(path10.sep).join("/");
|
|
6085
6411
|
}
|
|
6086
6412
|
function ensureTrailingNewline(value) {
|
|
6087
6413
|
return value.endsWith("\n") ? value : `${value}
|
|
@@ -6144,14 +6470,14 @@ function upsertAgentGuidanceBlock(existingContent) {
|
|
|
6144
6470
|
};
|
|
6145
6471
|
}
|
|
6146
6472
|
function resolveProjectRoot(pmRoot, cwd) {
|
|
6147
|
-
const parent =
|
|
6148
|
-
if (
|
|
6149
|
-
return
|
|
6473
|
+
const parent = path10.dirname(pmRoot);
|
|
6474
|
+
if (path10.basename(pmRoot) === "pm" && path10.basename(parent) === ".agents") {
|
|
6475
|
+
return path10.dirname(parent);
|
|
6150
6476
|
}
|
|
6151
|
-
return
|
|
6477
|
+
return path10.resolve(cwd, pmRoot);
|
|
6152
6478
|
}
|
|
6153
6479
|
function resolveTargetGuidancePath(scans, projectRoot) {
|
|
6154
|
-
const existingAgents = scans.find((entry) =>
|
|
6480
|
+
const existingAgents = scans.find((entry) => path10.basename(entry.file_path) === "AGENTS.md" && entry.exists);
|
|
6155
6481
|
if (existingAgents) {
|
|
6156
6482
|
return existingAgents.file_path;
|
|
6157
6483
|
}
|
|
@@ -6159,7 +6485,7 @@ function resolveTargetGuidancePath(scans, projectRoot) {
|
|
|
6159
6485
|
if (existingAny) {
|
|
6160
6486
|
return existingAny.file_path;
|
|
6161
6487
|
}
|
|
6162
|
-
return
|
|
6488
|
+
return path10.join(projectRoot, "AGENTS.md");
|
|
6163
6489
|
}
|
|
6164
6490
|
function parsePromptChoice(answer, currentDefault) {
|
|
6165
6491
|
const normalized = answer.trim().toLowerCase();
|
|
@@ -6201,7 +6527,7 @@ function normalizeAgentGuidanceState(settings) {
|
|
|
6201
6527
|
async function scanGuidanceFiles(projectRoot) {
|
|
6202
6528
|
const scans = [];
|
|
6203
6529
|
for (const filename of AGENT_GUIDANCE_TARGET_FILENAMES) {
|
|
6204
|
-
const filePath =
|
|
6530
|
+
const filePath = path10.join(projectRoot, filename);
|
|
6205
6531
|
const exists = await pathExists(filePath);
|
|
6206
6532
|
if (!exists) {
|
|
6207
6533
|
scans.push({
|
|
@@ -6212,7 +6538,7 @@ async function scanGuidanceFiles(projectRoot) {
|
|
|
6212
6538
|
});
|
|
6213
6539
|
continue;
|
|
6214
6540
|
}
|
|
6215
|
-
const content = await
|
|
6541
|
+
const content = await fs9.readFile(filePath, "utf8");
|
|
6216
6542
|
const contentLower = content.toLowerCase();
|
|
6217
6543
|
const tokenHits = AGENT_GUIDANCE_REQUIRED_TOKENS.filter((token) => contentLower.includes(token));
|
|
6218
6544
|
const hasMarker = hasGuidanceMarker(content);
|
|
@@ -6240,12 +6566,12 @@ function applyAgentGuidanceState(settings, currentState) {
|
|
|
6240
6566
|
}
|
|
6241
6567
|
async function writeGuidanceFile(filePath) {
|
|
6242
6568
|
const exists = await pathExists(filePath);
|
|
6243
|
-
const currentContent = exists ? await
|
|
6569
|
+
const currentContent = exists ? await fs9.readFile(filePath, "utf8") : "";
|
|
6244
6570
|
const nextContent = upsertAgentGuidanceBlock(currentContent);
|
|
6245
6571
|
if (!nextContent.changed) {
|
|
6246
6572
|
return { changed: false, warnings: [] };
|
|
6247
6573
|
}
|
|
6248
|
-
await
|
|
6574
|
+
await writeFileAtomic(filePath, nextContent.next_content);
|
|
6249
6575
|
return {
|
|
6250
6576
|
changed: true,
|
|
6251
6577
|
warnings: await runActiveOnWriteHooks({
|
|
@@ -6427,11 +6753,16 @@ async function runInitAgentGuidance(options) {
|
|
|
6427
6753
|
};
|
|
6428
6754
|
}
|
|
6429
6755
|
|
|
6430
|
-
// dist/
|
|
6756
|
+
// dist/sdk/init.js
|
|
6757
|
+
import fs10 from "node:fs/promises";
|
|
6758
|
+
import path11 from "node:path";
|
|
6759
|
+
import readline2 from "node:readline/promises";
|
|
6760
|
+
import { stdin as input2, stdout as output2 } from "node:process";
|
|
6761
|
+
import { hostname, userInfo } from "node:os";
|
|
6431
6762
|
!(function() {
|
|
6432
6763
|
try {
|
|
6433
6764
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
6434
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
6765
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "ed32382f-d4ec-574c-98ac-7d6537090dad");
|
|
6435
6766
|
} catch (e2) {
|
|
6436
6767
|
}
|
|
6437
6768
|
})();
|
|
@@ -6458,7 +6789,28 @@ function summarizeInitResult(result) {
|
|
|
6458
6789
|
hint: "Re-run with --verbose for the full settings tree."
|
|
6459
6790
|
};
|
|
6460
6791
|
}
|
|
6792
|
+
var _testOnly2 = {
|
|
6793
|
+
normalizeInitGovernancePreset,
|
|
6794
|
+
normalizeInitTypePreset,
|
|
6795
|
+
normalizeOptionalInitAuthor,
|
|
6796
|
+
normalizeInitAgentGuidanceMode,
|
|
6797
|
+
isPathLikeInitTarget,
|
|
6798
|
+
resolveInitInvocation,
|
|
6799
|
+
resolveInitPrefixInput,
|
|
6800
|
+
parseYesNoChoice,
|
|
6801
|
+
applyGovernancePreset,
|
|
6802
|
+
runInitWizard,
|
|
6803
|
+
setInitReadlineFactoryForTests,
|
|
6804
|
+
summarizeInstalledPackages,
|
|
6805
|
+
buildInitNextSteps,
|
|
6806
|
+
registerInitTypePreset,
|
|
6807
|
+
assertExplicitTrackerPathIsNotWorkspaceRoot,
|
|
6808
|
+
isLikelyWorkspaceRoot
|
|
6809
|
+
};
|
|
6461
6810
|
var createInitReadlineInterface = () => readline2.createInterface({ input: input2, output: output2 });
|
|
6811
|
+
function setInitReadlineFactoryForTests(factory) {
|
|
6812
|
+
createInitReadlineInterface = factory ?? (() => readline2.createInterface({ input: input2, output: output2 }));
|
|
6813
|
+
}
|
|
6462
6814
|
function cloneDefaults() {
|
|
6463
6815
|
return structuredClone(SETTINGS_DEFAULTS);
|
|
6464
6816
|
}
|
|
@@ -6514,7 +6866,7 @@ function isPathLikeInitTarget(rawValue) {
|
|
|
6514
6866
|
if (trimmed.length === 0) {
|
|
6515
6867
|
return false;
|
|
6516
6868
|
}
|
|
6517
|
-
return
|
|
6869
|
+
return path11.isAbsolute(trimmed) || /^[a-z]:/iu.test(trimmed) || trimmed.startsWith(".") || trimmed.includes("/") || trimmed.includes("\\");
|
|
6518
6870
|
}
|
|
6519
6871
|
function resolveInitInvocation(cwd, global2, prefixArg, workspaceArg) {
|
|
6520
6872
|
const normalizedWorkspace = workspaceArg?.trim();
|
|
@@ -6525,8 +6877,8 @@ function resolveInitInvocation(cwd, global2, prefixArg, workspaceArg) {
|
|
|
6525
6877
|
if (global2.path !== void 0 || isPathLikeInitTarget(prefixArg)) {
|
|
6526
6878
|
throw new PmCliError("--workspace cannot be combined with --pm-path/--path or a path-like positional target.", EXIT_CODE.USAGE);
|
|
6527
6879
|
}
|
|
6528
|
-
const workspaceRoot =
|
|
6529
|
-
const pmRoot2 =
|
|
6880
|
+
const workspaceRoot = path11.resolve(cwd, normalizedWorkspace);
|
|
6881
|
+
const pmRoot2 = path11.join(workspaceRoot, ".agents", "pm");
|
|
6530
6882
|
return {
|
|
6531
6883
|
pmRoot: pmRoot2,
|
|
6532
6884
|
prefixArg,
|
|
@@ -6538,7 +6890,7 @@ function resolveInitInvocation(cwd, global2, prefixArg, workspaceArg) {
|
|
|
6538
6890
|
};
|
|
6539
6891
|
}
|
|
6540
6892
|
if (global2.path === void 0 && isPathLikeInitTarget(prefixArg)) {
|
|
6541
|
-
const positionalTarget =
|
|
6893
|
+
const positionalTarget = path11.resolve(cwd, prefixArg.trim());
|
|
6542
6894
|
return {
|
|
6543
6895
|
pmRoot: positionalTarget,
|
|
6544
6896
|
prefixArg: void 0,
|
|
@@ -6556,6 +6908,35 @@ function resolveInitInvocation(cwd, global2, prefixArg, workspaceArg) {
|
|
|
6556
6908
|
} : { mode: "tracker-path", tracker_root: pmRoot }
|
|
6557
6909
|
};
|
|
6558
6910
|
}
|
|
6911
|
+
function resolveInitPrefixInput(positionalPrefix, flaggedPrefix) {
|
|
6912
|
+
if (flaggedPrefix === void 0) {
|
|
6913
|
+
return positionalPrefix;
|
|
6914
|
+
}
|
|
6915
|
+
if (flaggedPrefix.trim().length === 0) {
|
|
6916
|
+
throw new PmCliError("--id-prefix must not be empty", EXIT_CODE.USAGE);
|
|
6917
|
+
}
|
|
6918
|
+
if (isPathLikeInitTarget(flaggedPrefix)) {
|
|
6919
|
+
throw new PmCliError(`--id-prefix accepts an item ID prefix, not a tracker path: "${flaggedPrefix}".`, EXIT_CODE.USAGE, {
|
|
6920
|
+
code: "init_id_prefix_path_like",
|
|
6921
|
+
required: "Pass the tracker path positionally or with the global --path option.",
|
|
6922
|
+
examples: [
|
|
6923
|
+
`pm init ${flaggedPrefix}`,
|
|
6924
|
+
`pm --path ${flaggedPrefix} init`
|
|
6925
|
+
]
|
|
6926
|
+
});
|
|
6927
|
+
}
|
|
6928
|
+
if (positionalPrefix !== void 0 && normalizePrefix(positionalPrefix) !== normalizePrefix(flaggedPrefix)) {
|
|
6929
|
+
throw new PmCliError(`Conflicting id prefixes: positional "${positionalPrefix}" and --id-prefix "${flaggedPrefix}".`, EXIT_CODE.USAGE, {
|
|
6930
|
+
code: "init_id_prefix_conflict",
|
|
6931
|
+
required: "Use either the positional id prefix or --id-prefix with one value.",
|
|
6932
|
+
examples: [
|
|
6933
|
+
`pm init ${normalizePrefix(positionalPrefix)}`,
|
|
6934
|
+
`pm init --id-prefix ${normalizePrefix(flaggedPrefix)}`
|
|
6935
|
+
]
|
|
6936
|
+
});
|
|
6937
|
+
}
|
|
6938
|
+
return flaggedPrefix;
|
|
6939
|
+
}
|
|
6559
6940
|
function normalizeInitAgentGuidanceMode(rawValue) {
|
|
6560
6941
|
if (rawValue === void 0) {
|
|
6561
6942
|
return "ask";
|
|
@@ -6631,10 +7012,10 @@ async function isLikelyWorkspaceRoot(candidate) {
|
|
|
6631
7012
|
"package.json",
|
|
6632
7013
|
"pnpm-workspace.yaml",
|
|
6633
7014
|
"AGENTS.md",
|
|
6634
|
-
|
|
7015
|
+
path11.join(".agents", "pm")
|
|
6635
7016
|
];
|
|
6636
7017
|
for (const indicator of indicators) {
|
|
6637
|
-
if (await pathExists(
|
|
7018
|
+
if (await pathExists(path11.join(candidate, indicator))) {
|
|
6638
7019
|
return true;
|
|
6639
7020
|
}
|
|
6640
7021
|
}
|
|
@@ -6644,13 +7025,13 @@ async function assertExplicitTrackerPathIsNotWorkspaceRoot(pmRoot, explicitTrack
|
|
|
6644
7025
|
if (!explicitTrackerTarget || force) {
|
|
6645
7026
|
return;
|
|
6646
7027
|
}
|
|
6647
|
-
if (await pathExists(
|
|
7028
|
+
if (await pathExists(path11.join(pmRoot, "settings.json"))) {
|
|
6648
7029
|
return;
|
|
6649
7030
|
}
|
|
6650
7031
|
if (!await isLikelyWorkspaceRoot(pmRoot)) {
|
|
6651
7032
|
return;
|
|
6652
7033
|
}
|
|
6653
|
-
const nestedTracker =
|
|
7034
|
+
const nestedTracker = path11.join(pmRoot, ".agents", "pm");
|
|
6654
7035
|
throw new PmCliError(`Refusing to initialize tracker files directly in workspace root "${pmRoot}".`, EXIT_CODE.USAGE, {
|
|
6655
7036
|
code: "workspace_root_pm_path",
|
|
6656
7037
|
type: "urn:pm-cli:error:workspace_root_pm_path",
|
|
@@ -6674,9 +7055,9 @@ async function ensureInitDirectories(pmRoot, subdirs) {
|
|
|
6674
7055
|
const createdDirs = [];
|
|
6675
7056
|
const warnings = [];
|
|
6676
7057
|
for (const subdir of subdirs) {
|
|
6677
|
-
const target = subdir ?
|
|
7058
|
+
const target = subdir ? path11.join(pmRoot, subdir) : pmRoot;
|
|
6678
7059
|
const existed = await pathExists(target);
|
|
6679
|
-
await
|
|
7060
|
+
await fs10.mkdir(target, { recursive: true });
|
|
6680
7061
|
if (existed) {
|
|
6681
7062
|
warnings.push(`already_exists:${target}`);
|
|
6682
7063
|
} else {
|
|
@@ -6833,9 +7214,8 @@ async function createNewInitSettings(params) {
|
|
|
6833
7214
|
const settings = cloneDefaults();
|
|
6834
7215
|
settings.id_prefix = normalizedPrefix;
|
|
6835
7216
|
applyGovernancePreset(settings, effectivePreset);
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
}
|
|
7217
|
+
const environmentAuthor = process.env.PM_AUTHOR?.trim() || void 0;
|
|
7218
|
+
settings.author_default = params.normalizedOptions.authorFromOption ?? environmentAuthor ?? `${userInfo().username}@${hostname()}`;
|
|
6839
7219
|
if (chosenTelemetryEnabled !== void 0) {
|
|
6840
7220
|
settings.telemetry.enabled = chosenTelemetryEnabled;
|
|
6841
7221
|
settings.telemetry.first_run_prompt_completed = true;
|
|
@@ -6910,10 +7290,10 @@ async function ensureInitTypeDirectories(params) {
|
|
|
6910
7290
|
params.warnings.push(...scaffold.warnings);
|
|
6911
7291
|
}
|
|
6912
7292
|
function resolveInitWorkspaceRoot(target) {
|
|
6913
|
-
const trackerRoot =
|
|
6914
|
-
const agentsRoot =
|
|
6915
|
-
if (
|
|
6916
|
-
return
|
|
7293
|
+
const trackerRoot = path11.resolve(target.tracker_root);
|
|
7294
|
+
const agentsRoot = path11.dirname(trackerRoot);
|
|
7295
|
+
if (path11.basename(trackerRoot) === "pm" && path11.basename(agentsRoot) === ".agents") {
|
|
7296
|
+
return path11.dirname(agentsRoot);
|
|
6917
7297
|
}
|
|
6918
7298
|
return target.workspace_root;
|
|
6919
7299
|
}
|
|
@@ -6962,16 +7342,16 @@ async function runInit(prefixArg, global2, options = {}) {
|
|
|
6962
7342
|
const cwd = process.cwd();
|
|
6963
7343
|
const invocation = resolveInitInvocation(cwd, global2, prefixArg, options.workspace);
|
|
6964
7344
|
const pmRoot = invocation.pmRoot;
|
|
6965
|
-
prefixArg = invocation.prefixArg;
|
|
7345
|
+
prefixArg = resolveInitPrefixInput(invocation.prefixArg, options.idPrefix);
|
|
7346
|
+
const normalizedOptions = normalizeInitCommandOptions(options);
|
|
6966
7347
|
await assertExplicitTrackerPathIsNotWorkspaceRoot(pmRoot, invocation.target.mode === "tracker-path", options.force === true);
|
|
6967
7348
|
const createdDirs = [];
|
|
6968
7349
|
const warnings = [];
|
|
6969
7350
|
const baseDirs = await ensureInitDirectories(pmRoot, PM_REQUIRED_SUBDIRS);
|
|
6970
7351
|
createdDirs.push(...baseDirs.createdDirs);
|
|
6971
7352
|
warnings.push(...baseDirs.warnings);
|
|
6972
|
-
const settingsPath =
|
|
7353
|
+
const settingsPath = path11.join(pmRoot, "settings.json");
|
|
6973
7354
|
const settingsExists = await pathExists(settingsPath);
|
|
6974
|
-
const normalizedOptions = normalizeInitCommandOptions(options);
|
|
6975
7355
|
const settingsResolution = await resolveInitSettings({
|
|
6976
7356
|
pmRoot,
|
|
6977
7357
|
settingsPath,
|
|
@@ -6983,9 +7363,10 @@ async function runInit(prefixArg, global2, options = {}) {
|
|
|
6983
7363
|
warnings
|
|
6984
7364
|
});
|
|
6985
7365
|
let { settings } = settingsResolution;
|
|
7366
|
+
const workspaceRoot = resolveInitWorkspaceRoot(invocation.target);
|
|
6986
7367
|
const agentGuidance = await applyInitAgentGuidance({
|
|
6987
7368
|
pmRoot,
|
|
6988
|
-
cwd,
|
|
7369
|
+
cwd: workspaceRoot ?? cwd,
|
|
6989
7370
|
agentGuidanceMode: normalizedOptions.agentGuidanceMode,
|
|
6990
7371
|
settings,
|
|
6991
7372
|
warnings
|
|
@@ -7003,7 +7384,6 @@ async function runInit(prefixArg, global2, options = {}) {
|
|
|
7003
7384
|
settings = await readSettings(pmRoot);
|
|
7004
7385
|
}
|
|
7005
7386
|
await ensureInitTypeDirectories({ pmRoot, settings, createdDirs, warnings });
|
|
7006
|
-
const workspaceRoot = resolveInitWorkspaceRoot(invocation.target);
|
|
7007
7387
|
if (workspaceRoot) {
|
|
7008
7388
|
const gitignore = await ensurePmGitignore(workspaceRoot);
|
|
7009
7389
|
if (gitignore.changed) {
|
|
@@ -7033,6 +7413,15 @@ async function runInit(prefixArg, global2, options = {}) {
|
|
|
7033
7413
|
};
|
|
7034
7414
|
}
|
|
7035
7415
|
|
|
7416
|
+
// dist/cli/commands/init.js
|
|
7417
|
+
!(function() {
|
|
7418
|
+
try {
|
|
7419
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
7420
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "0d10e7b8-b8f0-5958-87b9-c0f6d73c08c9");
|
|
7421
|
+
} catch (e2) {
|
|
7422
|
+
}
|
|
7423
|
+
})();
|
|
7424
|
+
|
|
7036
7425
|
export {
|
|
7037
7426
|
readManagedExtensionState,
|
|
7038
7427
|
PM_PACKAGE_RESOURCE_KINDS,
|
|
@@ -7049,7 +7438,11 @@ export {
|
|
|
7049
7438
|
PM_GITIGNORE_END,
|
|
7050
7439
|
getPmGitignoreBlock,
|
|
7051
7440
|
ensurePmGitignore,
|
|
7441
|
+
INIT_AGENT_GUIDANCE_MODE_VALUES,
|
|
7442
|
+
_testOnly,
|
|
7443
|
+
runInitAgentGuidance,
|
|
7052
7444
|
summarizeInitResult,
|
|
7445
|
+
_testOnly2,
|
|
7053
7446
|
runInit
|
|
7054
7447
|
};
|
|
7055
|
-
//# sourceMappingURL=chunk-
|
|
7448
|
+
//# sourceMappingURL=chunk-J6364LFM.js.map
|