@unbrained/pm-cli 2026.6.5 → 2026.6.7
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/CHANGELOG.md +77 -0
- package/CONTRIBUTING.md +1 -0
- package/README.md +17 -5
- package/dist/cli/commander-usage.js +74 -4
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/aggregate.d.ts +8 -0
- package/dist/cli/commands/aggregate.js +84 -7
- package/dist/cli/commands/aggregate.js.map +1 -1
- package/dist/cli/commands/calendar.js +10 -3
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/close-many.js +13 -10
- package/dist/cli/commands/close-many.js.map +1 -1
- package/dist/cli/commands/close.d.ts +1 -1
- package/dist/cli/commands/close.js +20 -10
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/completion.js +87 -18
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/config.d.ts +5 -4
- package/dist/cli/commands/config.js +50 -2
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/contracts.js +6 -3
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/copy.d.ts +14 -0
- package/dist/cli/commands/copy.js +153 -0
- package/dist/cli/commands/copy.js.map +1 -0
- package/dist/cli/commands/extension/doctor.js +62 -2
- package/dist/cli/commands/extension/doctor.js.map +1 -1
- package/dist/cli/commands/extension/install-sources.d.ts +8 -0
- package/dist/cli/commands/extension/install-sources.js +82 -2
- package/dist/cli/commands/extension/install-sources.js.map +1 -1
- package/dist/cli/commands/extension.d.ts +29 -0
- package/dist/cli/commands/extension.js +61 -2
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/gc.d.ts +8 -1
- package/dist/cli/commands/gc.js +26 -3
- package/dist/cli/commands/gc.js.map +1 -1
- package/dist/cli/commands/get.d.ts +9 -0
- package/dist/cli/commands/get.js +23 -2
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/health.js +15 -2
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-compact.d.ts +39 -0
- package/dist/cli/commands/history-compact.js +262 -0
- package/dist/cli/commands/history-compact.js.map +1 -0
- package/dist/cli/commands/history.d.ts +4 -1
- package/dist/cli/commands/history.js +12 -24
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/index.d.ts +3 -0
- package/dist/cli/commands/index.js +5 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/list.d.ts +2 -0
- package/dist/cli/commands/list.js +87 -9
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/reindex.js +8 -4
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/search.d.ts +1 -0
- package/dist/cli/commands/search.js +232 -35
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/stats.d.ts +8 -1
- package/dist/cli/commands/stats.js +18 -17
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/telemetry.d.ts +8 -0
- package/dist/cli/commands/telemetry.js +253 -0
- package/dist/cli/commands/telemetry.js.map +1 -0
- package/dist/cli/error-guidance.js +26 -2
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/extension-command-help.d.ts +1 -0
- package/dist/cli/extension-command-help.js +3 -2
- package/dist/cli/extension-command-help.js.map +1 -1
- package/dist/cli/help-content.js +19 -2
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +13 -21
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +24 -6
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +52 -17
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +55 -8
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +5 -5
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.js +21 -3
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/chunks/activity-5UROHJ3D.js +16 -0
- package/dist/cli-bundle/chunks/{activity-3RWRRNOW.js → activity-YVB3QRTE.js} +11 -11
- package/dist/cli-bundle/chunks/{aggregate-OOAGKWRG.js → aggregate-LH66F75F.js} +87 -17
- package/dist/cli-bundle/chunks/aggregate-LH66F75F.js.map +7 -0
- package/dist/cli-bundle/chunks/{aggregate-J35K7WZB.js → aggregate-OHSWFQJM.js} +88 -18
- package/dist/cli-bundle/chunks/aggregate-OHSWFQJM.js.map +1 -0
- package/dist/cli-bundle/chunks/{append-PNN6UIBZ.js → append-2PPYFAG5.js} +8 -8
- package/dist/cli-bundle/chunks/{append-5JE3YGXU.js → append-AUGT5W6J.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-26KTVXJW.js → chunk-2IF7WLB7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KA24HME7.js → chunk-2IXCHCLM.js} +5 -6
- package/dist/cli-bundle/chunks/chunk-2IXCHCLM.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-XX5LRINW.js → chunk-2OJHLWBZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ASQM3IF5.js → chunk-3A2CMEM7.js} +5 -4
- package/dist/cli-bundle/chunks/{chunk-S3CV7JGJ.js → chunk-3EOBJOF4.js} +5 -4
- package/dist/cli-bundle/chunks/{chunk-N5YF3VFN.js → chunk-42LOFGJS.js} +91 -16
- package/dist/cli-bundle/chunks/chunk-42LOFGJS.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-WIKR7KFL.js → chunk-4CHEG6UK.js} +108 -21
- package/dist/cli-bundle/chunks/chunk-4CHEG6UK.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-4QCR4QW3.js → chunk-4GHZR3BA.js} +56 -28
- package/dist/cli-bundle/chunks/chunk-4GHZR3BA.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-B3N4TKNL.js → chunk-5AXMRKN5.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-JQI2HE55.js → chunk-6J4K6JLA.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-V3JQ4IPL.js → chunk-6RZXO5M2.js} +102 -22
- package/dist/cli-bundle/chunks/chunk-6RZXO5M2.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-BNL6S7QH.js → chunk-AVJD6VTA.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-NQP3ECKF.js → chunk-B2KZGPM2.js} +39 -8
- package/dist/cli-bundle/chunks/chunk-B2KZGPM2.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-RQAWLSUU.js → chunk-B5RF3IP7.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UFCG3SWR.js → chunk-C5W2UH56.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-3OH4DAEB.js → chunk-CKLBZHS7.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-GNHVV4SY.js → chunk-CLD3XNCH.js} +124 -20
- package/dist/cli-bundle/chunks/chunk-CLD3XNCH.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-RANZIID5.js → chunk-FHHBD7PN.js} +38 -7
- package/dist/cli-bundle/chunks/chunk-FHHBD7PN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GFWHHMVV.js → chunk-FY6Z3FYY.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-CCUFLH4J.js → chunk-GNIUOLZ2.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-ZRVSMOMR.js → chunk-GPXQBR3H.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-SZQCER6S.js → chunk-GUZBNB3G.js} +27 -5
- package/dist/cli-bundle/chunks/chunk-GUZBNB3G.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GPGAYASV.js → chunk-H7EO3QA3.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-MISYRLEP.js → chunk-HLC3KTLP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KK6YPGH3.js → chunk-HMMMWBK2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4PJQSECJ.js → chunk-HRMHZ4RV.js} +26 -4
- package/dist/cli-bundle/chunks/chunk-HRMHZ4RV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-CJDQB2ED.js → chunk-HV5SSZXF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ATBVS6WW.js → chunk-IMCJBN2Q.js} +23 -14
- package/dist/cli-bundle/chunks/chunk-IMCJBN2Q.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-FVXM3GKS.js → chunk-KNGVP5WJ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-OIQIXTNB.js → chunk-KR6R465K.js} +304 -215
- package/dist/cli-bundle/chunks/chunk-KR6R465K.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-UOVLWB47.js → chunk-LI65XLJR.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-AXXKLVTW.js → chunk-LIN2BPJ7.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LMTOY5HE.js +112 -0
- package/dist/cli-bundle/chunks/chunk-LMTOY5HE.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-Y2AKE2HS.js → chunk-LQHBENVW.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-D5X7N6FI.js → chunk-LXO6V66E.js} +14 -14
- package/dist/cli-bundle/chunks/{chunk-TK633IVD.js → chunk-M2PW7EZU.js} +26 -7
- package/dist/cli-bundle/chunks/chunk-M2PW7EZU.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-DFIZGAI5.js → chunk-MOYM2C3J.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-ZQ4F6EC4.js → chunk-MWRS7Z4P.js} +127 -23
- package/dist/cli-bundle/chunks/chunk-MWRS7Z4P.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-5PAOPUZX.js → chunk-NHR2QXXZ.js} +24 -15
- package/dist/cli-bundle/chunks/chunk-NHR2QXXZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-OUF3ARDX.js → chunk-NQL32HQ5.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-TBQVUNVH.js → chunk-O7HSSFCC.js} +65 -16
- package/dist/cli-bundle/chunks/chunk-O7HSSFCC.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GCAVRLGE.js → chunk-OKSKJKHX.js} +9 -9
- package/dist/cli-bundle/chunks/chunk-QQL5QSTZ.js +1572 -0
- package/dist/cli-bundle/chunks/chunk-QQL5QSTZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-A6PEXMYN.js → chunk-R3V3YCMH.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-T2ORWB6D.js → chunk-RVPTZKBC.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-K47WAYQV.js → chunk-SFFVGNHC.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-DFUSXJDE.js → chunk-SQPKRA54.js} +14 -14
- package/dist/cli-bundle/chunks/chunk-THDEID2Z.js +115 -0
- package/dist/cli-bundle/chunks/chunk-THDEID2Z.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-G5BACLYH.js → chunk-TINUJMWN.js} +92 -17
- package/dist/cli-bundle/chunks/chunk-TINUJMWN.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-JB4RGL4V.js → chunk-TNPBPNII.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-XG7RJYHV.js → chunk-TP4DDY27.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-ORTLYVA4.js → chunk-TYJJOTUA.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-HZOS2UG5.js → chunk-UAQOQ7IE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-D3WUNETC.js → chunk-UEWA73ZZ.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-O5IBJE6S.js → chunk-UIIQC5YO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SRVKTWPR.js → chunk-UJUT6AHZ.js} +314 -39
- package/dist/cli-bundle/chunks/chunk-UJUT6AHZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-SSFMJCPF.js → chunk-UT6WFXW2.js} +6 -7
- package/dist/cli-bundle/chunks/chunk-UT6WFXW2.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KBG47ZOY.js → chunk-UYQ7HXH4.js} +10 -6
- package/dist/cli-bundle/chunks/chunk-UYQ7HXH4.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-LDJK7SHN.js → chunk-V6EYFTRL.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-5IRA6IYD.js → chunk-WAA7UI6M.js} +58 -30
- package/dist/cli-bundle/chunks/chunk-WAA7UI6M.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HPH6X4ZZ.js → chunk-WCQZBDDH.js} +10 -6
- package/dist/cli-bundle/chunks/{chunk-HPH6X4ZZ.js.map → chunk-WCQZBDDH.js.map} +2 -2
- package/dist/cli-bundle/chunks/chunk-WR5567FH.js +1582 -0
- package/dist/cli-bundle/chunks/chunk-WR5567FH.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-TQ3ZK6VD.js → chunk-WYEXLDDY.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-4LTBNUYT.js → chunk-X4IZKYHP.js} +307 -32
- package/dist/cli-bundle/chunks/chunk-X4IZKYHP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KCMIYKTA.js → chunk-X7UHMKPE.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-7K24QB23.js → chunk-XS3O2TFJ.js} +27 -8
- package/dist/cli-bundle/chunks/chunk-XS3O2TFJ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-EHXPIKKP.js → chunk-XYNT7UFP.js} +303 -207
- package/dist/cli-bundle/chunks/chunk-XYNT7UFP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-CWT53EYT.js → chunk-YBZW2QQ7.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-VGO2T3TY.js → chunk-YO3THIJF.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-5KB4X7YY.js → chunk-YPH4ESA2.js} +66 -17
- package/dist/cli-bundle/chunks/chunk-YPH4ESA2.js.map +1 -0
- package/dist/cli-bundle/chunks/{claim-ZFA7HKU4.js → claim-BJ4QMPJC.js} +10 -10
- package/dist/cli-bundle/chunks/{claim-AZLP7YFO.js → claim-KW743OSW.js} +10 -10
- package/dist/cli-bundle/chunks/close-P4ZBKODL.js +13 -0
- package/dist/cli-bundle/chunks/{close-65DFYAVS.js → close-SYHSRZDC.js} +8 -8
- package/dist/cli-bundle/chunks/{close-many-UKZSQGM7.js → close-many-DBLEYFOY.js} +29 -26
- package/dist/cli-bundle/chunks/close-many-DBLEYFOY.js.map +7 -0
- package/dist/cli-bundle/chunks/{close-many-AKPZNSGI.js → close-many-LAC5VR4G.js} +30 -27
- package/dist/cli-bundle/chunks/close-many-LAC5VR4G.js.map +1 -0
- package/dist/cli-bundle/chunks/{comments-AGBNSJJH.js → comments-JEO6HHVM.js} +10 -10
- package/dist/cli-bundle/chunks/{comments-CJWXQI7X.js → comments-YT2PQ5DD.js} +10 -10
- package/dist/cli-bundle/chunks/{config-DDPYIA6J.js → config-RZRVS3ZV.js} +127 -11
- package/dist/cli-bundle/chunks/config-RZRVS3ZV.js.map +1 -0
- package/dist/cli-bundle/chunks/{config-5ON3ADRH.js → config-YJSAAADD.js} +128 -12
- package/dist/cli-bundle/chunks/config-YJSAAADD.js.map +7 -0
- package/dist/cli-bundle/chunks/{context-E6U3DWVM.js → context-LGYEEKAW.js} +14 -14
- package/dist/cli-bundle/chunks/{context-E6U3DWVM.js.map → context-LGYEEKAW.js.map} +2 -2
- package/dist/cli-bundle/chunks/{context-ZOJEN5VT.js → context-ZUH5IOOI.js} +15 -15
- package/dist/cli-bundle/chunks/context-ZUH5IOOI.js.map +1 -0
- package/dist/cli-bundle/chunks/{contracts-CXSFM45B.js → contracts-YXJ6NXKH.js} +11 -5
- package/dist/cli-bundle/chunks/contracts-YXJ6NXKH.js.map +7 -0
- package/dist/cli-bundle/chunks/{contracts-LCSX5R53.js → contracts-ZIBXROPE.js} +12 -6
- package/dist/cli-bundle/chunks/contracts-ZIBXROPE.js.map +1 -0
- package/dist/cli-bundle/chunks/copy-BZALX5MQ.js +182 -0
- package/dist/cli-bundle/chunks/copy-BZALX5MQ.js.map +1 -0
- package/dist/cli-bundle/chunks/copy-YPWEIAPD.js +185 -0
- package/dist/cli-bundle/chunks/copy-YPWEIAPD.js.map +7 -0
- package/dist/cli-bundle/chunks/create-4DS2QWQC.js +27 -0
- package/dist/cli-bundle/chunks/{create-WYFKN2U4.js → create-CF7EVRX7.js} +13 -13
- package/dist/cli-bundle/chunks/{delete-ZXWC56WO.js → delete-KR4VBWVE.js} +7 -7
- package/dist/cli-bundle/chunks/{delete-RONNH4F4.js → delete-XLZRTRKR.js} +7 -7
- package/dist/cli-bundle/chunks/{deps-WII3O4HB.js → deps-2YTXD3VM.js} +7 -7
- package/dist/cli-bundle/chunks/{deps-EHXIFOZR.js → deps-GZMFMTGS.js} +7 -7
- package/dist/cli-bundle/chunks/{docs-PDREIMLS.js → docs-SLROFEQ4.js} +9 -9
- package/dist/cli-bundle/chunks/{docs-JMVCFNHH.js → docs-ZHISRR2D.js} +9 -9
- package/dist/cli-bundle/chunks/{extension-G6UXSM5S.js → extension-3C7OOI4F.js} +8 -6
- package/dist/cli-bundle/chunks/{extension-B4ROVWJD.js → extension-XYCUXICD.js} +8 -6
- package/dist/cli-bundle/chunks/{files-2PN7UM2D.js → files-FUWF2FYJ.js} +9 -9
- package/dist/cli-bundle/chunks/{files-MXYS5W4M.js → files-J4I5IU4O.js} +9 -9
- package/dist/cli-bundle/chunks/gc-34NXSNSN.js +362 -0
- package/dist/cli-bundle/chunks/gc-34NXSNSN.js.map +1 -0
- package/dist/cli-bundle/chunks/gc-SPIIZX3A.js +372 -0
- package/dist/cli-bundle/chunks/gc-SPIIZX3A.js.map +7 -0
- package/dist/cli-bundle/chunks/{get-WXMLRG7M.js → get-SZKNRHMA.js} +34 -12
- package/dist/cli-bundle/chunks/get-SZKNRHMA.js.map +1 -0
- package/dist/cli-bundle/chunks/{get-CINFEUIY.js → get-VITKYP6S.js} +33 -11
- package/dist/cli-bundle/chunks/get-VITKYP6S.js.map +7 -0
- package/dist/cli-bundle/chunks/{health-IT5DBPRJ.js → health-4SNTA2TF.js} +27 -13
- package/dist/cli-bundle/chunks/health-4SNTA2TF.js.map +7 -0
- package/dist/cli-bundle/chunks/{health-5VPOJQ53.js → health-7G3EPM57.js} +28 -14
- package/dist/cli-bundle/chunks/health-7G3EPM57.js.map +1 -0
- package/dist/cli-bundle/chunks/{history-FLZIP7PM.js → history-SDAWYZR3.js} +10 -10
- package/dist/cli-bundle/chunks/history-YDUEILKP.js +20 -0
- package/dist/cli-bundle/chunks/history-compact-DMW536VH.js +287 -0
- package/dist/cli-bundle/chunks/history-compact-DMW536VH.js.map +1 -0
- package/dist/cli-bundle/chunks/history-compact-POTZGG7K.js +290 -0
- package/dist/cli-bundle/chunks/history-compact-POTZGG7K.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-redact-SSZBAD76.js → history-redact-EPJ7GENL.js} +11 -11
- package/dist/cli-bundle/chunks/history-redact-KASLLPE7.js +19 -0
- package/dist/cli-bundle/chunks/{history-repair-X7CO5JJZ.js → history-repair-IJ7LLBET.js} +11 -11
- package/dist/cli-bundle/chunks/{history-repair-KC5ZOJRZ.js → history-repair-YNESJRT6.js} +11 -11
- package/dist/cli-bundle/chunks/init-IGSS4GNH.js +17 -0
- package/dist/cli-bundle/chunks/{init-6MRFVOLH.js → init-YHVBTEET.js} +9 -8
- package/dist/cli-bundle/chunks/{learnings-DCX55BNX.js → learnings-4YBMIVCZ.js} +10 -10
- package/dist/cli-bundle/chunks/{learnings-A3CLB5CO.js → learnings-T4PF24YN.js} +10 -10
- package/dist/cli-bundle/chunks/{list-DBRECOG4.js → list-3KEVBOYW.js} +10 -10
- package/dist/cli-bundle/chunks/list-E44O2K64.js +20 -0
- package/dist/cli-bundle/chunks/{notes-42LIC3UE.js → notes-FLUCNJSH.js} +10 -10
- package/dist/cli-bundle/chunks/{notes-P5O3VMQ3.js → notes-GJKALVZM.js} +10 -10
- package/dist/cli-bundle/chunks/{plan-HDQXEUKD.js → plan-T5MMZLI3.js} +13 -13
- package/dist/cli-bundle/chunks/{plan-IGTE3WOJ.js → plan-YYMIL3HV.js} +13 -13
- package/dist/cli-bundle/chunks/{register-list-query-EMNSIUO4.js → register-list-query-I65EZ3HB.js} +33 -27
- package/dist/cli-bundle/chunks/register-list-query-I65EZ3HB.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-AG3XKXWL.js → register-list-query-OECMHO4G.js} +32 -26
- package/dist/cli-bundle/chunks/register-list-query-OECMHO4G.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-M3YS6XDO.js → register-mutation-2FLXORLR.js} +65 -47
- package/dist/cli-bundle/chunks/register-mutation-2FLXORLR.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-mutation-RSMT6DPK.js → register-mutation-5GPDEKHR.js} +64 -46
- package/dist/cli-bundle/chunks/register-mutation-5GPDEKHR.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-operations-KYUOOOOD.js → register-operations-BNGAUMGK.js} +71 -35
- package/dist/cli-bundle/chunks/register-operations-BNGAUMGK.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-Q54JQZUN.js → register-operations-GQKT35H5.js} +70 -34
- package/dist/cli-bundle/chunks/register-operations-GQKT35H5.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-setup-DI6P7X75.js → register-setup-DNDCGZ4O.js} +18 -18
- package/dist/cli-bundle/chunks/{register-setup-DI6P7X75.js.map → register-setup-DNDCGZ4O.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-setup-YJKIQRKA.js → register-setup-EJY44FPH.js} +17 -17
- package/dist/cli-bundle/chunks/{register-setup-YJKIQRKA.js.map → register-setup-EJY44FPH.js.map} +2 -2
- package/dist/cli-bundle/chunks/{restore-2XVTBLKQ.js → restore-DDJGVZIN.js} +11 -11
- package/dist/cli-bundle/chunks/restore-SJSASGZP.js +17 -0
- package/dist/cli-bundle/chunks/{schema-V6BX65Q2.js → schema-B7NQ6XVP.js} +8 -8
- package/dist/cli-bundle/chunks/{schema-LVXZWFGY.js → schema-HEGYH6CE.js} +8 -8
- package/dist/cli-bundle/chunks/{search-C7NPB7G7.js → search-DVVQ4UO2.js} +421 -42
- package/dist/cli-bundle/chunks/search-DVVQ4UO2.js.map +1 -0
- package/dist/cli-bundle/chunks/{search-5A3BMFA7.js → search-JNEZJV7H.js} +427 -41
- package/dist/cli-bundle/chunks/search-JNEZJV7H.js.map +7 -0
- package/dist/cli-bundle/chunks/stats-7JDIJRDH.js +202 -0
- package/dist/cli-bundle/chunks/stats-7JDIJRDH.js.map +1 -0
- package/dist/cli-bundle/chunks/stats-SYTJRR4Z.js +212 -0
- package/dist/cli-bundle/chunks/stats-SYTJRR4Z.js.map +7 -0
- package/dist/cli-bundle/chunks/telemetry-4HHWD5Y7.js +251 -0
- package/dist/cli-bundle/chunks/telemetry-4HHWD5Y7.js.map +7 -0
- package/dist/cli-bundle/chunks/telemetry-EGWP7ZUX.js +248 -0
- package/dist/cli-bundle/chunks/telemetry-EGWP7ZUX.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-OFYONO3C.js → test-IIELLSZX.js} +14 -13
- package/dist/cli-bundle/chunks/test-ML5RLWXE.js +32 -0
- package/dist/cli-bundle/chunks/{test-all-EEMKNTGU.js → test-all-7DNCMML7.js} +14 -13
- package/dist/cli-bundle/chunks/{test-all-EEMKNTGU.js.map → test-all-7DNCMML7.js.map} +1 -1
- package/dist/cli-bundle/chunks/{test-all-OJE6CIO7.js → test-all-IHTUJRRC.js} +16 -15
- package/dist/cli-bundle/chunks/{test-all-OJE6CIO7.js.map → test-all-IHTUJRRC.js.map} +1 -1
- package/dist/cli-bundle/chunks/{test-runs-IPOPFOAF.js → test-runs-5FEMBV3A.js} +5 -5
- package/dist/cli-bundle/chunks/{test-runs-L2M7WKH7.js → test-runs-RNKZ37PS.js} +5 -5
- package/dist/cli-bundle/chunks/update-6C67X4KS.js +21 -0
- package/dist/cli-bundle/chunks/update-VF26YPT3.js +25 -0
- package/dist/cli-bundle/chunks/{update-many-322CCH2L.js → update-many-BSZZZYXY.js} +22 -22
- package/dist/cli-bundle/chunks/{update-many-DYWGW57M.js → update-many-BWKJJEBF.js} +22 -22
- package/dist/cli-bundle/chunks/{upgrade-3W3RVSNM.js → upgrade-RSE5PC44.js} +7 -6
- package/dist/cli-bundle/chunks/{upgrade-3W3RVSNM.js.map → upgrade-RSE5PC44.js.map} +1 -1
- package/dist/cli-bundle/chunks/{upgrade-2U727SAM.js → upgrade-YWI5DJFA.js} +5 -4
- package/dist/cli-bundle/chunks/{upgrade-2U727SAM.js.map → upgrade-YWI5DJFA.js.map} +1 -1
- package/dist/cli-bundle/chunks/{validate-ZFVWPEEN.js → validate-NK3WKB7C.js} +18 -17
- package/dist/cli-bundle/chunks/{validate-ZFVWPEEN.js.map → validate-NK3WKB7C.js.map} +1 -1
- package/dist/cli-bundle/chunks/{validate-GZ24NYHO.js → validate-UCEOB7S6.js} +20 -19
- package/dist/cli-bundle/chunks/{validate-GZ24NYHO.js.map → validate-UCEOB7S6.js.map} +1 -1
- package/dist/cli-bundle/main.js +198 -1523
- package/dist/cli-bundle/main.js.map +4 -4
- package/dist/core/config/nested-settings.d.ts +8 -6
- package/dist/core/config/nested-settings.js +71 -5
- package/dist/core/config/nested-settings.js.map +1 -1
- package/dist/core/config/positional-value.js +4 -2
- package/dist/core/config/positional-value.js.map +1 -1
- package/dist/core/extensions/extension-types.d.ts +36 -0
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/extension-types.js.map +1 -1
- package/dist/core/extensions/loader.js +46 -5
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/history/drift-scan.d.ts +3 -4
- package/dist/core/history/drift-scan.js +71 -18
- package/dist/core/history/drift-scan.js.map +1 -1
- package/dist/core/history/history-diff.d.ts +47 -0
- package/dist/core/history/history-diff.js +152 -0
- package/dist/core/history/history-diff.js.map +1 -0
- package/dist/core/history/history-storage-stats.d.ts +31 -0
- package/dist/core/history/history-storage-stats.js +101 -0
- package/dist/core/history/history-storage-stats.js.map +1 -0
- package/dist/core/item/id.js +4 -5
- package/dist/core/item/id.js.map +1 -1
- package/dist/core/item/item-format.js +7 -3
- package/dist/core/item/item-format.js.map +1 -1
- package/dist/core/item/toon-decode.d.ts +7 -0
- package/dist/core/item/toon-decode.js +11 -2
- package/dist/core/item/toon-decode.js.map +1 -1
- package/dist/core/item/type-registry.js +25 -7
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/lock/lock-gc.d.ts +46 -0
- package/dist/core/lock/lock-gc.js +194 -0
- package/dist/core/lock/lock-gc.js.map +1 -0
- package/dist/core/search/cache.js +5 -3
- package/dist/core/search/cache.js.map +1 -1
- package/dist/core/search/corpus.d.ts +6 -0
- package/dist/core/search/corpus.js +22 -9
- package/dist/core/search/corpus.js.map +1 -1
- package/dist/core/search/embedding-batches.js +10 -7
- package/dist/core/search/embedding-batches.js.map +1 -1
- package/dist/core/search/relevance.d.ts +29 -0
- package/dist/core/search/relevance.js +226 -0
- package/dist/core/search/relevance.js.map +1 -0
- package/dist/core/search/vector-stores.d.ts +3 -0
- package/dist/core/search/vector-stores.js +23 -10
- package/dist/core/search/vector-stores.js.map +1 -1
- package/dist/core/shared/constants.js +15 -2
- package/dist/core/shared/constants.js.map +1 -1
- package/dist/core/shared/errors.d.ts +6 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/errors.js.map +1 -1
- package/dist/core/shared/primitives.d.ts +8 -0
- package/dist/core/shared/primitives.js +29 -2
- package/dist/core/shared/primitives.js.map +1 -1
- package/dist/core/shared/serial-queue.d.ts +12 -0
- package/dist/core/shared/serial-queue.js +43 -0
- package/dist/core/shared/serial-queue.js.map +1 -0
- package/dist/core/shared/time.js +42 -6
- package/dist/core/shared/time.js.map +1 -1
- package/dist/core/store/paths.js +25 -7
- package/dist/core/store/paths.js.map +1 -1
- package/dist/core/store/settings-validator.d.ts +11 -0
- package/dist/core/store/settings-validator.js +14 -2
- package/dist/core/store/settings-validator.js.map +1 -1
- package/dist/core/store/settings.d.ts +19 -1
- package/dist/core/store/settings.js +199 -17
- package/dist/core/store/settings.js.map +1 -1
- package/dist/core/telemetry/observability.js +3 -3
- package/dist/core/telemetry/observability.js.map +1 -1
- package/dist/core/telemetry/runtime.js +99 -6
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +187 -42
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/cli-contracts/commander-types.d.ts +1 -0
- package/dist/sdk/cli-contracts/commander-types.js +13 -2
- package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts/enum-contracts.js +8 -2
- package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +7 -2
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +39 -7
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +26 -1
- package/dist/sdk/cli-contracts.js +75 -11
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/testing.d.ts +51 -1
- package/dist/sdk/testing.js +93 -2
- package/dist/sdk/testing.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/docs/AGENT_GUIDE.md +1 -1
- package/docs/ARCHITECTURE.md +11 -1
- package/docs/CLAUDE_CODE_PLUGIN.md +4 -4
- package/docs/CODEX_PLUGIN.md +1 -1
- package/docs/COMMANDS.md +42 -4
- package/docs/CONFIGURATION.md +31 -2
- package/docs/EXTENSIONS.md +28 -8
- package/docs/EXTENSION_AUTHOR_CONTRACTS.md +73 -0
- package/docs/ONBOARDING.md +165 -0
- package/docs/QUICKSTART.md +2 -2
- package/docs/README.md +12 -4
- package/docs/RELEASING.md +36 -1
- package/docs/SDK.md +66 -0
- package/docs/TESTING.md +33 -1
- package/package.json +6 -2
- package/packages/pm-governance-audit/README.md +14 -0
- package/packages/pm-governance-audit/extensions/governance-audit/index.js +39 -1
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +40 -2
- package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +1 -1
- package/packages/pm-governance-audit/package.json +4 -2
- package/packages/pm-lifecycle-hooks/README.md +21 -0
- package/packages/pm-search-advanced/README.md +38 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.js +17 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +17 -0
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +216 -1
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +271 -2
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +11 -8
- package/plugins/pm-claude/agents/pm-coordinator.md +1 -1
- package/plugins/pm-claude/commands/pm-init.md +1 -1
- package/plugins/pm-codex/README.md +1 -1
- package/dist/cli-bundle/chunks/activity-P5BUMWP3.js +0 -16
- package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js.map +0 -1
- package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7K24QB23.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-G5BACLYH.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-KA24HME7.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-RANZIID5.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SZQCER6S.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-TK633IVD.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js.map +0 -7
- package/dist/cli-bundle/chunks/close-RMHQ3KWH.js +0 -13
- package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js.map +0 -1
- package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js.map +0 -7
- package/dist/cli-bundle/chunks/config-5ON3ADRH.js.map +0 -7
- package/dist/cli-bundle/chunks/config-DDPYIA6J.js.map +0 -1
- package/dist/cli-bundle/chunks/context-ZOJEN5VT.js.map +0 -1
- package/dist/cli-bundle/chunks/contracts-CXSFM45B.js.map +0 -7
- package/dist/cli-bundle/chunks/contracts-LCSX5R53.js.map +0 -1
- package/dist/cli-bundle/chunks/create-ATONSAZW.js +0 -27
- package/dist/cli-bundle/chunks/gc-GT552UJH.js +0 -178
- package/dist/cli-bundle/chunks/gc-GT552UJH.js.map +0 -1
- package/dist/cli-bundle/chunks/gc-QNBRJG6H.js +0 -181
- package/dist/cli-bundle/chunks/gc-QNBRJG6H.js.map +0 -7
- package/dist/cli-bundle/chunks/get-CINFEUIY.js.map +0 -7
- package/dist/cli-bundle/chunks/get-WXMLRG7M.js.map +0 -1
- package/dist/cli-bundle/chunks/health-5VPOJQ53.js.map +0 -1
- package/dist/cli-bundle/chunks/health-IT5DBPRJ.js.map +0 -7
- package/dist/cli-bundle/chunks/history-6FC4H6HI.js +0 -20
- package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js +0 -19
- package/dist/cli-bundle/chunks/init-KHX3FEEM.js +0 -16
- package/dist/cli-bundle/chunks/list-53LZ2AEO.js +0 -20
- package/dist/cli-bundle/chunks/register-list-query-AG3XKXWL.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-RSMT6DPK.js.map +0 -7
- package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js.map +0 -1
- package/dist/cli-bundle/chunks/register-operations-Q54JQZUN.js.map +0 -7
- package/dist/cli-bundle/chunks/restore-JL5QIH7H.js +0 -17
- package/dist/cli-bundle/chunks/search-5A3BMFA7.js.map +0 -7
- package/dist/cli-bundle/chunks/search-C7NPB7G7.js.map +0 -1
- package/dist/cli-bundle/chunks/stats-FNLYVXTB.js +0 -120
- package/dist/cli-bundle/chunks/stats-FNLYVXTB.js.map +0 -1
- package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js +0 -123
- package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js.map +0 -7
- package/dist/cli-bundle/chunks/test-RJ4ZF35X.js +0 -31
- package/dist/cli-bundle/chunks/update-6YEHPVXH.js +0 -25
- package/dist/cli-bundle/chunks/update-PYLVHMRD.js +0 -21
- /package/dist/cli-bundle/chunks/{activity-P5BUMWP3.js.map → activity-5UROHJ3D.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-3RWRRNOW.js.map → activity-YVB3QRTE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-PNN6UIBZ.js.map → append-2PPYFAG5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-5JE3YGXU.js.map → append-AUGT5W6J.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-26KTVXJW.js.map → chunk-2IF7WLB7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XX5LRINW.js.map → chunk-2OJHLWBZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ASQM3IF5.js.map → chunk-3A2CMEM7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-S3CV7JGJ.js.map → chunk-3EOBJOF4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-B3N4TKNL.js.map → chunk-5AXMRKN5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JQI2HE55.js.map → chunk-6J4K6JLA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-BNL6S7QH.js.map → chunk-AVJD6VTA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RQAWLSUU.js.map → chunk-B5RF3IP7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UFCG3SWR.js.map → chunk-C5W2UH56.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3OH4DAEB.js.map → chunk-CKLBZHS7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GFWHHMVV.js.map → chunk-FY6Z3FYY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CCUFLH4J.js.map → chunk-GNIUOLZ2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZRVSMOMR.js.map → chunk-GPXQBR3H.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GPGAYASV.js.map → chunk-H7EO3QA3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MISYRLEP.js.map → chunk-HLC3KTLP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KK6YPGH3.js.map → chunk-HMMMWBK2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CJDQB2ED.js.map → chunk-HV5SSZXF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FVXM3GKS.js.map → chunk-KNGVP5WJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UOVLWB47.js.map → chunk-LI65XLJR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-AXXKLVTW.js.map → chunk-LIN2BPJ7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Y2AKE2HS.js.map → chunk-LQHBENVW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-D5X7N6FI.js.map → chunk-LXO6V66E.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DFIZGAI5.js.map → chunk-MOYM2C3J.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OUF3ARDX.js.map → chunk-NQL32HQ5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GCAVRLGE.js.map → chunk-OKSKJKHX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-A6PEXMYN.js.map → chunk-R3V3YCMH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-T2ORWB6D.js.map → chunk-RVPTZKBC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-K47WAYQV.js.map → chunk-SFFVGNHC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DFUSXJDE.js.map → chunk-SQPKRA54.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JB4RGL4V.js.map → chunk-TNPBPNII.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XG7RJYHV.js.map → chunk-TP4DDY27.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ORTLYVA4.js.map → chunk-TYJJOTUA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HZOS2UG5.js.map → chunk-UAQOQ7IE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-D3WUNETC.js.map → chunk-UEWA73ZZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-O5IBJE6S.js.map → chunk-UIIQC5YO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LDJK7SHN.js.map → chunk-V6EYFTRL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TQ3ZK6VD.js.map → chunk-WYEXLDDY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KCMIYKTA.js.map → chunk-X7UHMKPE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CWT53EYT.js.map → chunk-YBZW2QQ7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VGO2T3TY.js.map → chunk-YO3THIJF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-ZFA7HKU4.js.map → claim-BJ4QMPJC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-AZLP7YFO.js.map → claim-KW743OSW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-RMHQ3KWH.js.map → close-P4ZBKODL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-65DFYAVS.js.map → close-SYHSRZDC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-AGBNSJJH.js.map → comments-JEO6HHVM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-CJWXQI7X.js.map → comments-YT2PQ5DD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-ATONSAZW.js.map → create-4DS2QWQC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-WYFKN2U4.js.map → create-CF7EVRX7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-ZXWC56WO.js.map → delete-KR4VBWVE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-RONNH4F4.js.map → delete-XLZRTRKR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-WII3O4HB.js.map → deps-2YTXD3VM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-EHXIFOZR.js.map → deps-GZMFMTGS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-PDREIMLS.js.map → docs-SLROFEQ4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-JMVCFNHH.js.map → docs-ZHISRR2D.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-G6UXSM5S.js.map → extension-3C7OOI4F.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-B4ROVWJD.js.map → extension-XYCUXICD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-2PN7UM2D.js.map → files-FUWF2FYJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{files-MXYS5W4M.js.map → files-J4I5IU4O.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-FLZIP7PM.js.map → history-SDAWYZR3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-6FC4H6HI.js.map → history-YDUEILKP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-SSZBAD76.js.map → history-redact-EPJ7GENL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-XKYEZDBL.js.map → history-redact-KASLLPE7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-X7CO5JJZ.js.map → history-repair-IJ7LLBET.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-repair-KC5ZOJRZ.js.map → history-repair-YNESJRT6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-KHX3FEEM.js.map → init-IGSS4GNH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-6MRFVOLH.js.map → init-YHVBTEET.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-DCX55BNX.js.map → learnings-4YBMIVCZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-A3CLB5CO.js.map → learnings-T4PF24YN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-DBRECOG4.js.map → list-3KEVBOYW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-53LZ2AEO.js.map → list-E44O2K64.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-42LIC3UE.js.map → notes-FLUCNJSH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-P5O3VMQ3.js.map → notes-GJKALVZM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-HDQXEUKD.js.map → plan-T5MMZLI3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-IGTE3WOJ.js.map → plan-YYMIL3HV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-2XVTBLKQ.js.map → restore-DDJGVZIN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-JL5QIH7H.js.map → restore-SJSASGZP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-V6BX65Q2.js.map → schema-B7NQ6XVP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-LVXZWFGY.js.map → schema-HEGYH6CE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-OFYONO3C.js.map → test-IIELLSZX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-RJ4ZF35X.js.map → test-ML5RLWXE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-IPOPFOAF.js.map → test-runs-5FEMBV3A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-L2M7WKH7.js.map → test-runs-RNKZ37PS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-PYLVHMRD.js.map → update-6C67X4KS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-6YEHPVXH.js.map → update-VF26YPT3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-322CCH2L.js.map → update-many-BSZZZYXY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-DYWGW57M.js.map → update-many-BWKJJEBF.js.map} +0 -0
package/dist/cli-bundle/main.js
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
deriveTelemetryCommandResolution,
|
|
4
|
+
deriveTelemetryCommandTaxonomy,
|
|
5
|
+
emitTelemetryErrorEvent,
|
|
6
|
+
finishTelemetryCommand,
|
|
7
|
+
startTelemetryCommand
|
|
8
|
+
} from "./chunks/chunk-WR5567FH.js";
|
|
2
9
|
import {
|
|
3
10
|
migrateItemFilesToFormat
|
|
4
|
-
} from "./chunks/chunk-
|
|
11
|
+
} from "./chunks/chunk-AVJD6VTA.js";
|
|
12
|
+
import {
|
|
13
|
+
normalizeExtensionNameForMatch
|
|
14
|
+
} from "./chunks/chunk-THDEID2Z.js";
|
|
5
15
|
import {
|
|
6
16
|
applyDefaultOutputFormat,
|
|
7
17
|
clearResolvedGlobalOptions,
|
|
@@ -11,38 +21,35 @@ import {
|
|
|
11
21
|
getGlobalOptions,
|
|
12
22
|
invalidateSearchCachesForMutation,
|
|
13
23
|
setResolvedGlobalOptions
|
|
14
|
-
} from "./chunks/chunk-
|
|
24
|
+
} from "./chunks/chunk-M2PW7EZU.js";
|
|
15
25
|
import {
|
|
16
26
|
PM_CORE_COMMAND_NAMES,
|
|
17
27
|
resolveSubcommandFlagContractsForCommand
|
|
18
|
-
} from "./chunks/chunk-
|
|
19
|
-
import "./chunks/chunk-
|
|
28
|
+
} from "./chunks/chunk-MWRS7Z4P.js";
|
|
29
|
+
import "./chunks/chunk-WAA7UI6M.js";
|
|
20
30
|
import {
|
|
21
31
|
printError,
|
|
22
32
|
printResult,
|
|
23
33
|
writeStdout
|
|
24
|
-
} from "./chunks/chunk-
|
|
34
|
+
} from "./chunks/chunk-UAQOQ7IE.js";
|
|
25
35
|
import {
|
|
26
36
|
levenshteinDistanceWithinLimit
|
|
27
37
|
} from "./chunks/chunk-EAOG77HM.js";
|
|
28
|
-
import "./chunks/chunk-
|
|
29
|
-
import "./chunks/chunk-
|
|
30
|
-
import "./chunks/chunk-
|
|
38
|
+
import "./chunks/chunk-TP4DDY27.js";
|
|
39
|
+
import "./chunks/chunk-2IXCHCLM.js";
|
|
40
|
+
import "./chunks/chunk-WCQZBDDH.js";
|
|
31
41
|
import {
|
|
32
42
|
commandOptionFlagLabel,
|
|
33
43
|
resolveCommandOptionPolicyState,
|
|
34
44
|
resolveItemTypeRegistry,
|
|
35
45
|
resolveTypeDefinition
|
|
36
|
-
} from "./chunks/chunk-
|
|
37
|
-
import
|
|
38
|
-
nowIso
|
|
39
|
-
} from "./chunks/chunk-RANZIID5.js";
|
|
46
|
+
} from "./chunks/chunk-HRMHZ4RV.js";
|
|
47
|
+
import "./chunks/chunk-FHHBD7PN.js";
|
|
40
48
|
import {
|
|
41
49
|
BUILTIN_ITEM_TYPE_VALUES,
|
|
42
50
|
EXIT_CODE,
|
|
43
51
|
PmCliError,
|
|
44
52
|
activateExtensions,
|
|
45
|
-
appendLineAtomic,
|
|
46
53
|
asRecordOrNull,
|
|
47
54
|
clearActiveExtensionHooks,
|
|
48
55
|
consumeAfterCommandAffectedItems,
|
|
@@ -53,7 +60,6 @@ import {
|
|
|
53
60
|
getSettingsPath,
|
|
54
61
|
loadExtensions,
|
|
55
62
|
pathExists,
|
|
56
|
-
readFileIfExists,
|
|
57
63
|
readSettings,
|
|
58
64
|
readSettingsWithMetadata,
|
|
59
65
|
resolveGlobalPmRoot,
|
|
@@ -77,13 +83,12 @@ import {
|
|
|
77
83
|
setActiveExtensionRenderers,
|
|
78
84
|
setActiveExtensionServices,
|
|
79
85
|
toNonEmptyStringOrUndefined,
|
|
80
|
-
writeFileAtomic,
|
|
81
86
|
writeSettings
|
|
82
|
-
} from "./chunks/chunk-
|
|
87
|
+
} from "./chunks/chunk-UJUT6AHZ.js";
|
|
83
88
|
|
|
84
89
|
// dist/cli/main.js
|
|
85
90
|
import fs2 from "node:fs";
|
|
86
|
-
import
|
|
91
|
+
import path2 from "node:path";
|
|
87
92
|
import { Command } from "commander";
|
|
88
93
|
|
|
89
94
|
// dist/core/telemetry/consent.js
|
|
@@ -91,1506 +96,86 @@ import readline from "node:readline/promises";
|
|
|
91
96
|
import { stdin as input, stdout as output } from "node:process";
|
|
92
97
|
!(function() {
|
|
93
98
|
try {
|
|
94
|
-
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
95
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c965da5d-6609-5258-ba49-a57475f7f2ef");
|
|
96
|
-
} catch (e2) {
|
|
97
|
-
}
|
|
98
|
-
})();
|
|
99
|
-
var TELEMETRY_PROMPT_DISABLE_ENV = "PM_TELEMETRY_PROMPT";
|
|
100
|
-
var TELEMETRY_PROMPT_DISABLE_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
101
|
-
var TELEMETRY_PROMPT_SKIPPED_COMMANDS = /* @__PURE__ */ new Set(["init", "completion", "completion-statuses", "completion-tags", "completion-types"]);
|
|
102
|
-
function parseBooleanLike(value) {
|
|
103
|
-
if (typeof value !== "string") {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
return TELEMETRY_PROMPT_DISABLE_VALUES.has(value.trim().toLowerCase());
|
|
107
|
-
}
|
|
108
|
-
function shouldSkipTelemetryPrompt(commandPath, globalOptions) {
|
|
109
|
-
if (globalOptions.json === true || globalOptions.quiet === true) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
if (process.stdin.isTTY !== true || process.stdout.isTTY !== true) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
if (parseBooleanLike(process.env[TELEMETRY_PROMPT_DISABLE_ENV])) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
if (parseBooleanLike(process.env.CI)) {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
const normalizedCommandPath = commandPath.trim().toLowerCase();
|
|
122
|
-
if (normalizedCommandPath.length === 0) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return TELEMETRY_PROMPT_SKIPPED_COMMANDS.has(normalizedCommandPath);
|
|
126
|
-
}
|
|
127
|
-
function parseTelemetryPromptAnswer(answer) {
|
|
128
|
-
const normalized = answer.trim().toLowerCase();
|
|
129
|
-
if (normalized === "n" || normalized === "no") {
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
async function promptTelemetryConsent(currentDefault) {
|
|
135
|
-
const defaultLabel = currentDefault ? "Y/n" : "y/N";
|
|
136
|
-
const prompt = `pm telemetry helps improve reliability and usage diagnostics.
|
|
137
|
-
It is enabled by default and can be changed anytime via:
|
|
138
|
-
pm config global set telemetry-tracking --policy disabled
|
|
139
|
-
Enable telemetry now? [${defaultLabel}] `;
|
|
140
|
-
const rl = readline.createInterface({ input, output });
|
|
141
|
-
try {
|
|
142
|
-
const answer = await rl.question(prompt);
|
|
143
|
-
if (answer.trim().length === 0) {
|
|
144
|
-
return currentDefault;
|
|
145
|
-
}
|
|
146
|
-
return parseTelemetryPromptAnswer(answer);
|
|
147
|
-
} finally {
|
|
148
|
-
rl.close();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
async function maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions) {
|
|
152
|
-
if (shouldSkipTelemetryPrompt(commandPath, globalOptions)) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
const globalPmRoot = resolveGlobalPmRoot(process.cwd());
|
|
157
|
-
const settings = await readSettings(globalPmRoot);
|
|
158
|
-
if (settings.telemetry.first_run_prompt_completed) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const enabled = await promptTelemetryConsent(settings.telemetry.enabled);
|
|
162
|
-
settings.telemetry.enabled = enabled;
|
|
163
|
-
settings.telemetry.first_run_prompt_completed = true;
|
|
164
|
-
await writeSettings(globalPmRoot, settings, "telemetry:first_run_prompt");
|
|
165
|
-
output.write(`Telemetry ${enabled ? "enabled" : "disabled"} for this CLI install. Update any time with pm config global set telemetry-tracking --policy ${enabled ? "disabled" : "enabled"}.
|
|
166
|
-
`);
|
|
167
|
-
} catch {
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// dist/core/telemetry/runtime.js
|
|
172
|
-
import crypto from "node:crypto";
|
|
173
|
-
import { spawn } from "node:child_process";
|
|
174
|
-
import { mkdirSync, rmSync, statSync } from "node:fs";
|
|
175
|
-
import { mkdir, readdir, rm, stat } from "node:fs/promises";
|
|
176
|
-
import os from "node:os";
|
|
177
|
-
import path from "node:path";
|
|
178
|
-
|
|
179
|
-
// dist/core/telemetry/observability.js
|
|
180
|
-
!(function() {
|
|
181
|
-
try {
|
|
182
|
-
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
183
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "ad10a6ab-5a76-55e1-9750-1613c8210700");
|
|
184
|
-
} catch (e2) {
|
|
185
|
-
}
|
|
186
|
-
})();
|
|
187
|
-
var SETUP_ROOT_COMMANDS = /* @__PURE__ */ new Set(["init", "config", "completion", "completion-statuses", "completion-tags", "completion-types"]);
|
|
188
|
-
var QUERY_ROOT_COMMANDS = /* @__PURE__ */ new Set([
|
|
189
|
-
"list",
|
|
190
|
-
"list-all",
|
|
191
|
-
"list-open",
|
|
192
|
-
"list-in-progress",
|
|
193
|
-
"list-blocked",
|
|
194
|
-
"list-closed",
|
|
195
|
-
"list-canceled",
|
|
196
|
-
"list-draft",
|
|
197
|
-
"search",
|
|
198
|
-
"get",
|
|
199
|
-
"context",
|
|
200
|
-
"calendar",
|
|
201
|
-
"history",
|
|
202
|
-
"activity",
|
|
203
|
-
"aggregate",
|
|
204
|
-
"deps",
|
|
205
|
-
"contracts",
|
|
206
|
-
"stats",
|
|
207
|
-
"dedupe-audit"
|
|
208
|
-
]);
|
|
209
|
-
var MUTATION_ROOT_COMMANDS = /* @__PURE__ */ new Set([
|
|
210
|
-
"create",
|
|
211
|
-
"update",
|
|
212
|
-
"update-many",
|
|
213
|
-
"close-many",
|
|
214
|
-
"append",
|
|
215
|
-
"close",
|
|
216
|
-
"delete",
|
|
217
|
-
"restore",
|
|
218
|
-
"claim",
|
|
219
|
-
"release",
|
|
220
|
-
"comments",
|
|
221
|
-
"notes",
|
|
222
|
-
"learnings",
|
|
223
|
-
"files",
|
|
224
|
-
"docs",
|
|
225
|
-
"start-task",
|
|
226
|
-
"pause-task",
|
|
227
|
-
"close-task"
|
|
228
|
-
]);
|
|
229
|
-
var TESTING_ROOT_COMMANDS = /* @__PURE__ */ new Set(["test", "test-all", "test-runs", "test-verify", "trace-test", "test-ping"]);
|
|
230
|
-
var DIAGNOSTICS_ROOT_COMMANDS = /* @__PURE__ */ new Set(["health", "validate", "normalize", "reindex", "gc", "extension-doctor"]);
|
|
231
|
-
function normalizeCommandPath(commandPath) {
|
|
232
|
-
return commandPath.trim().replaceAll(/\s+/g, " ").toLowerCase();
|
|
233
|
-
}
|
|
234
|
-
function normalizeErrorCode(errorCode2) {
|
|
235
|
-
const normalized = errorCode2?.trim().toLowerCase();
|
|
236
|
-
return normalized && normalized.length > 0 ? normalized : void 0;
|
|
237
|
-
}
|
|
238
|
-
function deriveTelemetryCommandTaxonomy(commandPath) {
|
|
239
|
-
const normalizedPath = normalizeCommandPath(commandPath);
|
|
240
|
-
const tokens = normalizedPath.length > 0 ? normalizedPath.split(" ") : ["<unknown>"];
|
|
241
|
-
const root = tokens[0] ?? "<unknown>";
|
|
242
|
-
const leaf = tokens[tokens.length - 1] ?? root;
|
|
243
|
-
let family = "other";
|
|
244
|
-
if (SETUP_ROOT_COMMANDS.has(root)) {
|
|
245
|
-
family = "setup";
|
|
246
|
-
} else if (QUERY_ROOT_COMMANDS.has(root)) {
|
|
247
|
-
family = "query";
|
|
248
|
-
} else if (MUTATION_ROOT_COMMANDS.has(root)) {
|
|
249
|
-
family = "mutation";
|
|
250
|
-
} else if (TESTING_ROOT_COMMANDS.has(root)) {
|
|
251
|
-
family = "testing";
|
|
252
|
-
} else if (root === "extension") {
|
|
253
|
-
family = "extension";
|
|
254
|
-
} else if (DIAGNOSTICS_ROOT_COMMANDS.has(root)) {
|
|
255
|
-
family = "diagnostics";
|
|
256
|
-
}
|
|
257
|
-
return {
|
|
258
|
-
command_path: normalizedPath.length > 0 ? normalizedPath : "<unknown>",
|
|
259
|
-
command_root: root,
|
|
260
|
-
command_leaf: leaf,
|
|
261
|
-
command_depth: tokens.length,
|
|
262
|
-
command_family: family
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
function inferTelemetryErrorCode(params) {
|
|
266
|
-
if (params.ok) {
|
|
267
|
-
return void 0;
|
|
268
|
-
}
|
|
269
|
-
const explicit = normalizeErrorCode(params.errorCode);
|
|
270
|
-
if (explicit) {
|
|
271
|
-
return explicit;
|
|
272
|
-
}
|
|
273
|
-
const message = (params.errorMessage ?? "").trim().toLowerCase();
|
|
274
|
-
if (message.includes("unknown command")) {
|
|
275
|
-
return "unknown_command";
|
|
276
|
-
}
|
|
277
|
-
if (message.includes("unknown option")) {
|
|
278
|
-
return "unknown_option";
|
|
279
|
-
}
|
|
280
|
-
if (message.includes("missing required options") || message.includes("missing required option")) {
|
|
281
|
-
return "missing_required_option";
|
|
282
|
-
}
|
|
283
|
-
if (message.includes("missing required argument")) {
|
|
284
|
-
return "missing_required_argument";
|
|
285
|
-
}
|
|
286
|
-
if (message.includes("no update flags provided")) {
|
|
287
|
-
return "no_update_fields";
|
|
288
|
-
}
|
|
289
|
-
if (message.includes("is assigned to") && message.includes("use --force")) {
|
|
290
|
-
return "ownership_conflict";
|
|
291
|
-
}
|
|
292
|
-
if (message.includes("is locked")) {
|
|
293
|
-
return "lock_conflict";
|
|
294
|
-
}
|
|
295
|
-
if (message.includes("already terminal") && message.includes("use --force")) {
|
|
296
|
-
return "terminal_state_conflict";
|
|
297
|
-
}
|
|
298
|
-
if (message.includes("tracker is not initialized")) {
|
|
299
|
-
return "tracker_not_initialized";
|
|
300
|
-
}
|
|
301
|
-
if (message.includes(" not found")) {
|
|
302
|
-
return "item_not_found";
|
|
303
|
-
}
|
|
304
|
-
if (message.includes('use "pm close <id> <text>" to close an item') || message.includes("invalid --status value") && message.includes('"closed"')) {
|
|
305
|
-
return "close_through_update";
|
|
306
|
-
}
|
|
307
|
-
if (message.startsWith("invalid ") || message.includes(" must be ") || message.includes(" requires ")) {
|
|
308
|
-
return "invalid_argument_value";
|
|
309
|
-
}
|
|
310
|
-
if (message.includes("strict create mode requires concrete values for --")) {
|
|
311
|
-
return "missing_required_option";
|
|
312
|
-
}
|
|
313
|
-
if (message.includes("either as positional") && message.includes("not both")) {
|
|
314
|
-
return "invalid_command_usage";
|
|
315
|
-
}
|
|
316
|
-
const exitCode = Number.isFinite(params.exitCode) ? Math.max(0, Math.trunc(params.exitCode ?? 0)) : void 0;
|
|
317
|
-
if (exitCode === EXIT_CODE.USAGE) {
|
|
318
|
-
return "invalid_command_usage";
|
|
319
|
-
}
|
|
320
|
-
if (exitCode === EXIT_CODE.NOT_FOUND) {
|
|
321
|
-
return "item_not_found";
|
|
322
|
-
}
|
|
323
|
-
if (exitCode === EXIT_CODE.CONFLICT) {
|
|
324
|
-
return "lock_conflict";
|
|
325
|
-
}
|
|
326
|
-
if (exitCode === EXIT_CODE.DEPENDENCY_FAILED) {
|
|
327
|
-
return "dependency_failed";
|
|
328
|
-
}
|
|
329
|
-
return "command_failed";
|
|
330
|
-
}
|
|
331
|
-
function deriveTelemetryCommandResolution(params) {
|
|
332
|
-
if (params.ok) {
|
|
333
|
-
return "success";
|
|
334
|
-
}
|
|
335
|
-
const normalizedCode = normalizeErrorCode(params.errorCode);
|
|
336
|
-
if (normalizedCode === "unknown_command") {
|
|
337
|
-
return "nonexistent_command";
|
|
338
|
-
}
|
|
339
|
-
if (normalizedCode === "unknown_option") {
|
|
340
|
-
return "invalid_option";
|
|
341
|
-
}
|
|
342
|
-
if (normalizedCode === "missing_required_option") {
|
|
343
|
-
return "missing_required_option";
|
|
344
|
-
}
|
|
345
|
-
if (normalizedCode === "missing_required_argument") {
|
|
346
|
-
return "missing_required_argument";
|
|
347
|
-
}
|
|
348
|
-
if (normalizedCode === "health_findings") {
|
|
349
|
-
return "health_findings";
|
|
350
|
-
}
|
|
351
|
-
if (normalizedCode === "validation_findings") {
|
|
352
|
-
return "validation_findings";
|
|
353
|
-
}
|
|
354
|
-
if (params.errorCategory === "usage") {
|
|
355
|
-
return "invalid_usage";
|
|
356
|
-
}
|
|
357
|
-
if (params.errorCategory === "validation") {
|
|
358
|
-
return "validation_failed";
|
|
359
|
-
}
|
|
360
|
-
if (params.errorCategory === "conflict") {
|
|
361
|
-
return "conflict";
|
|
362
|
-
}
|
|
363
|
-
if (params.errorCategory === "runtime") {
|
|
364
|
-
return "runtime_failed";
|
|
365
|
-
}
|
|
366
|
-
return "unknown_failed";
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// dist/core/telemetry/runtime.js
|
|
370
|
-
!(function() {
|
|
371
|
-
try {
|
|
372
|
-
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
373
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b2cd9110-8de0-5e79-a029-c0902f862999");
|
|
374
|
-
} catch (e2) {
|
|
375
|
-
}
|
|
376
|
-
})();
|
|
377
|
-
var TELEMETRY_QUEUE_RELATIVE_PATH = path.join("runtime", "telemetry", "events.jsonl");
|
|
378
|
-
var TELEMETRY_STATE_RELATIVE_PATH = path.join("runtime", "telemetry", "state.json");
|
|
379
|
-
var TELEMETRY_SCHEMA_VERSION = 1;
|
|
380
|
-
var TELEMETRY_FLUSH_BATCH_SIZE = 100;
|
|
381
|
-
var TELEMETRY_MAX_RETRY_DELAY_MS = 36e5;
|
|
382
|
-
var TELEMETRY_RETRY_BASE_DELAY_MS = 3e4;
|
|
383
|
-
var TELEMETRY_HTTP_TIMEOUT_MS = 5e3;
|
|
384
|
-
var MILLISECONDS_PER_DAY = 864e5;
|
|
385
|
-
var TELEMETRY_MAX_EVENT_BYTES = 65536;
|
|
386
|
-
var TELEMETRY_SANITIZE_MAX_DEPTH = 6;
|
|
387
|
-
var TELEMETRY_SANITIZE_MAX_ARRAY_ITEMS = 20;
|
|
388
|
-
var TELEMETRY_MAX_QUEUE_ENTRY_ATTEMPTS = 15;
|
|
389
|
-
var TELEMETRY_RESULT_PREVIEW_MAX_BYTES = 8192;
|
|
390
|
-
var TELEMETRY_QUEUE_REWRITE_RETRY_DELAYS_MS = [25, 50, 100, 200];
|
|
391
|
-
var TELEMETRY_QUEUE_TMP_ORPHAN_MAX_AGE_MS = 60 * 60 * 1e3;
|
|
392
|
-
var TELEMETRY_FLUSH_LOCK_STALE_MS = 6e4;
|
|
393
|
-
var TELEMETRY_FLUSH_SPAWN_LOCK_STALE_MS = 6e4;
|
|
394
|
-
var OTEL_TRACES_ENDPOINT_ENV = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT";
|
|
395
|
-
var OTEL_BASE_ENDPOINT_ENV = "OTEL_EXPORTER_OTLP_ENDPOINT";
|
|
396
|
-
var OTEL_SERVICE_NAME_ENV = "OTEL_SERVICE_NAME";
|
|
397
|
-
var PM_TELEMETRY_DISABLED_ENV = "PM_TELEMETRY_DISABLED";
|
|
398
|
-
var PM_NO_TELEMETRY_ENV = "PM_NO_TELEMETRY";
|
|
399
|
-
var PM_TELEMETRY_DISABLED_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
400
|
-
var PM_TELEMETRY_OTEL_DISABLED_ENV = "PM_TELEMETRY_OTEL_DISABLED";
|
|
401
|
-
var PM_TELEMETRY_OTEL_DISABLED_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
402
|
-
var PM_TELEMETRY_INLINE_FLUSH_ENV = "PM_TELEMETRY_INLINE_FLUSH";
|
|
403
|
-
var PM_TELEMETRY_FLUSH_CHILD_ENV = "PM_TELEMETRY_FLUSH_CHILD";
|
|
404
|
-
var PM_TELEMETRY_SOURCE_CONTEXT_ENV = "PM_TELEMETRY_SOURCE_CONTEXT";
|
|
405
|
-
var PM_TELEMETRY_SOURCE_CONTEXT_VALUES = ["user", "automation", "test", "dogfood", "audit_smoke"];
|
|
406
|
-
var _lastFlushPromise = Promise.resolve();
|
|
407
|
-
var _queueMutationPromise = Promise.resolve();
|
|
408
|
-
var PM_TELEMETRY_SOURCE_CONTEXT_SET = new Set(PM_TELEMETRY_SOURCE_CONTEXT_VALUES);
|
|
409
|
-
var BOOLEAN_TRUE_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
410
|
-
var PROCESS_SESSION_ID = crypto.randomUUID();
|
|
411
|
-
var SENSITIVE_KEYWORDS = [
|
|
412
|
-
"token",
|
|
413
|
-
"secret",
|
|
414
|
-
"password",
|
|
415
|
-
"passwd",
|
|
416
|
-
"api_key",
|
|
417
|
-
"apikey",
|
|
418
|
-
"authorization",
|
|
419
|
-
"cookie",
|
|
420
|
-
"session",
|
|
421
|
-
"credentials",
|
|
422
|
-
"bearer"
|
|
423
|
-
];
|
|
424
|
-
var SENSITIVE_INLINE_KEY_PATTERN = "(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|session|credentials|bearer)";
|
|
425
|
-
var INLINE_SENSITIVE_ASSIGNMENT_PATTERN = new RegExp(`\\b(${SENSITIVE_INLINE_KEY_PATTERN})\\s*([:=])\\s*([^\\s,;]+)`, "giu");
|
|
426
|
-
var INLINE_SENSITIVE_FLAG_PATTERN = new RegExp(`(--${SENSITIVE_INLINE_KEY_PATTERN})(=|\\s+)([^\\s,;]+)`, "giu");
|
|
427
|
-
var ABSOLUTE_PATH_TOKEN_PATTERN = /(^|[\s"'`(=])\/(?:[^\s"'`),;]+)/g;
|
|
428
|
-
var EMAIL_PATTERN = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/giu;
|
|
429
|
-
var BEARER_TOKEN_PATTERN = /bearer\s+[a-z0-9._=-]+/giu;
|
|
430
|
-
var PRIVATE_IP_PATTERN = /\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g;
|
|
431
|
-
function queuePath(globalPmRoot) {
|
|
432
|
-
return path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);
|
|
433
|
-
}
|
|
434
|
-
function telemetryRuntimeDirectory(globalPmRoot) {
|
|
435
|
-
return path.dirname(queuePath(globalPmRoot));
|
|
436
|
-
}
|
|
437
|
-
function runtimeStatePath(globalPmRoot) {
|
|
438
|
-
return path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);
|
|
439
|
-
}
|
|
440
|
-
function flushLockPath(globalPmRoot) {
|
|
441
|
-
return path.join(globalPmRoot, "runtime", "telemetry", "flush.lock");
|
|
442
|
-
}
|
|
443
|
-
function flushSpawnLockPath(globalPmRoot) {
|
|
444
|
-
return path.join(globalPmRoot, "runtime", "telemetry", "flush.spawn.lock");
|
|
445
|
-
}
|
|
446
|
-
function telemetryFlushRunnerPath() {
|
|
447
|
-
return path.join(resolvePmPackageRootFromModule(import.meta.url, ["../../.."]), "dist", "cli", "telemetry-flush.js");
|
|
448
|
-
}
|
|
449
|
-
function shouldFlushInline() {
|
|
450
|
-
if (parseBooleanTrueLike(process.env[PM_TELEMETRY_INLINE_FLUSH_ENV])) {
|
|
451
|
-
return true;
|
|
452
|
-
}
|
|
453
|
-
if (parseBooleanTrueLike(process.env[PM_TELEMETRY_FLUSH_CHILD_ENV])) {
|
|
454
|
-
return true;
|
|
455
|
-
}
|
|
456
|
-
const nodeEnv = (process.env.NODE_ENV ?? "").trim().toLowerCase();
|
|
457
|
-
return typeof process.env.VITEST === "string" || typeof process.env.VITEST_WORKER_ID === "string" || nodeEnv === "test";
|
|
458
|
-
}
|
|
459
|
-
async function readRuntimeState(globalPmRoot) {
|
|
460
|
-
const raw = await readFileIfExists(runtimeStatePath(globalPmRoot));
|
|
461
|
-
if (!raw || raw.trim().length === 0) {
|
|
462
|
-
return {};
|
|
463
|
-
}
|
|
464
|
-
try {
|
|
465
|
-
const parsed = JSON.parse(raw);
|
|
466
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
467
|
-
return {};
|
|
468
|
-
}
|
|
469
|
-
return parsed;
|
|
470
|
-
} catch {
|
|
471
|
-
return {};
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
async function writeRuntimeState(globalPmRoot, patch) {
|
|
475
|
-
try {
|
|
476
|
-
const current = await readRuntimeState(globalPmRoot);
|
|
477
|
-
const next = {
|
|
478
|
-
...current,
|
|
479
|
-
...patch
|
|
480
|
-
};
|
|
481
|
-
const normalized = Object.fromEntries(Object.entries(next).filter(([, value]) => value !== void 0).sort((left, right) => left[0].localeCompare(right[0])));
|
|
482
|
-
await writeFileAtomic(runtimeStatePath(globalPmRoot), `${JSON.stringify(normalized, null, 2)}
|
|
483
|
-
`);
|
|
484
|
-
} catch {
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
function isSensitiveKey(key) {
|
|
488
|
-
const normalized = key.trim().toLowerCase().replaceAll("-", "_").replaceAll(/[^a-z0-9_]+/g, "_");
|
|
489
|
-
const tokens = normalized.split("_").filter((token) => token.length > 0);
|
|
490
|
-
return SENSITIVE_KEYWORDS.some((keyword) => normalized === keyword || normalized.endsWith(`_${keyword}`) || tokens.includes(keyword));
|
|
491
|
-
}
|
|
492
|
-
function redactInlineSensitiveAssignments(input2) {
|
|
493
|
-
const withoutAssignments = input2.replaceAll(INLINE_SENSITIVE_ASSIGNMENT_PATTERN, (_match, key, delimiter) => `${key}${delimiter}[redacted]`);
|
|
494
|
-
return withoutAssignments.replaceAll(INLINE_SENSITIVE_FLAG_PATTERN, (_match, flag, delimiter) => `${flag}${delimiter}[redacted]`);
|
|
495
|
-
}
|
|
496
|
-
function redactAbsolutePathTokens(input2) {
|
|
497
|
-
return input2.replaceAll(ABSOLUTE_PATH_TOKEN_PATTERN, (_match, prefix) => `${prefix}[redacted_path]`);
|
|
498
|
-
}
|
|
499
|
-
function sanitizeCommonSensitiveTokens(input2) {
|
|
500
|
-
const withoutEmails = input2.replaceAll(EMAIL_PATTERN, "[redacted_email]");
|
|
501
|
-
const withoutBearer = withoutEmails.replaceAll(BEARER_TOKEN_PATTERN, "bearer [redacted_token]");
|
|
502
|
-
return withoutBearer.replaceAll(PRIVATE_IP_PATTERN, "[redacted_ip]");
|
|
503
|
-
}
|
|
504
|
-
function sanitizeStringRedacted(input2) {
|
|
505
|
-
const withoutCommonSensitiveTokens = sanitizeCommonSensitiveTokens(input2);
|
|
506
|
-
const withoutInlineSecrets = redactInlineSensitiveAssignments(withoutCommonSensitiveTokens);
|
|
507
|
-
const withoutAbsolutePaths = redactAbsolutePathTokens(withoutInlineSecrets);
|
|
508
|
-
const trimmed = withoutAbsolutePaths.trim();
|
|
509
|
-
if (trimmed.startsWith("/") && trimmed.length > 1) {
|
|
510
|
-
return "[redacted_path]";
|
|
511
|
-
}
|
|
512
|
-
if (withoutAbsolutePaths.length > 512) {
|
|
513
|
-
return `${withoutAbsolutePaths.slice(0, 509)}...`;
|
|
514
|
-
}
|
|
515
|
-
return withoutAbsolutePaths;
|
|
516
|
-
}
|
|
517
|
-
function sanitizeStringMax(input2) {
|
|
518
|
-
const withoutCommonSensitiveTokens = sanitizeCommonSensitiveTokens(input2);
|
|
519
|
-
const withoutInlineSecrets = redactInlineSensitiveAssignments(withoutCommonSensitiveTokens);
|
|
520
|
-
const withoutAbsolutePaths = redactAbsolutePathTokens(withoutInlineSecrets);
|
|
521
|
-
const trimmed = withoutAbsolutePaths.trim();
|
|
522
|
-
if (trimmed.startsWith("/") && trimmed.length > 1) {
|
|
523
|
-
return "[redacted_path]";
|
|
524
|
-
}
|
|
525
|
-
if (withoutAbsolutePaths.length > 2048) {
|
|
526
|
-
return `${withoutAbsolutePaths.slice(0, 2045)}...`;
|
|
527
|
-
}
|
|
528
|
-
return withoutAbsolutePaths;
|
|
529
|
-
}
|
|
530
|
-
function sanitizeString(input2, captureLevel = "redacted") {
|
|
531
|
-
if (captureLevel === "max") {
|
|
532
|
-
return sanitizeStringMax(input2);
|
|
533
|
-
}
|
|
534
|
-
return sanitizeStringRedacted(input2);
|
|
535
|
-
}
|
|
536
|
-
function sanitizeValue(value, keyHint, captureLevel = "redacted", depth = 0) {
|
|
537
|
-
if (keyHint && isSensitiveKey(keyHint)) {
|
|
538
|
-
return "[redacted]";
|
|
539
|
-
}
|
|
540
|
-
if (value === null || value === void 0) {
|
|
541
|
-
return value;
|
|
542
|
-
}
|
|
543
|
-
if (typeof value === "string") {
|
|
544
|
-
return sanitizeString(value, captureLevel);
|
|
545
|
-
}
|
|
546
|
-
if (typeof value === "number" || typeof value === "boolean") {
|
|
547
|
-
return value;
|
|
548
|
-
}
|
|
549
|
-
if (depth >= TELEMETRY_SANITIZE_MAX_DEPTH) {
|
|
550
|
-
return "[depth_truncated]";
|
|
551
|
-
}
|
|
552
|
-
if (Array.isArray(value)) {
|
|
553
|
-
return value.slice(0, TELEMETRY_SANITIZE_MAX_ARRAY_ITEMS).map((entry) => sanitizeValue(entry, void 0, captureLevel, depth + 1));
|
|
554
|
-
}
|
|
555
|
-
if (typeof value === "object") {
|
|
556
|
-
const record = value;
|
|
557
|
-
const sanitized = {};
|
|
558
|
-
for (const [key, nested] of Object.entries(record)) {
|
|
559
|
-
sanitized[key] = sanitizeValue(nested, key, captureLevel, depth + 1);
|
|
560
|
-
}
|
|
561
|
-
return sanitized;
|
|
562
|
-
}
|
|
563
|
-
return String(value);
|
|
564
|
-
}
|
|
565
|
-
function sanitizeCommandArgs(args, captureLevel = "redacted") {
|
|
566
|
-
const sanitized = [];
|
|
567
|
-
let nextIsSensitiveValue = false;
|
|
568
|
-
for (const rawArg of args) {
|
|
569
|
-
const arg = sanitizeString(rawArg, captureLevel);
|
|
570
|
-
if (nextIsSensitiveValue) {
|
|
571
|
-
sanitized.push("[redacted]");
|
|
572
|
-
nextIsSensitiveValue = false;
|
|
573
|
-
continue;
|
|
574
|
-
}
|
|
575
|
-
if (arg.startsWith("--")) {
|
|
576
|
-
const withoutPrefix = arg.slice(2);
|
|
577
|
-
const delimiterIndex = withoutPrefix.indexOf("=");
|
|
578
|
-
if (delimiterIndex >= 0) {
|
|
579
|
-
const key = withoutPrefix.slice(0, delimiterIndex);
|
|
580
|
-
const value = withoutPrefix.slice(delimiterIndex + 1);
|
|
581
|
-
if (isSensitiveKey(key)) {
|
|
582
|
-
sanitized.push(`--${key}=[redacted]`);
|
|
583
|
-
} else {
|
|
584
|
-
sanitized.push(`--${key}=${sanitizeString(value, captureLevel)}`);
|
|
585
|
-
}
|
|
586
|
-
continue;
|
|
587
|
-
}
|
|
588
|
-
if (isSensitiveKey(withoutPrefix)) {
|
|
589
|
-
sanitized.push(`--${withoutPrefix}`);
|
|
590
|
-
nextIsSensitiveValue = true;
|
|
591
|
-
continue;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
sanitized.push(arg);
|
|
595
|
-
}
|
|
596
|
-
return sanitized;
|
|
597
|
-
}
|
|
598
|
-
function normalizeCaptureLevel(value) {
|
|
599
|
-
const normalized = value?.trim().toLowerCase();
|
|
600
|
-
if (normalized === "minimal" || normalized === "redacted" || normalized === "max") {
|
|
601
|
-
return normalized;
|
|
602
|
-
}
|
|
603
|
-
return "redacted";
|
|
604
|
-
}
|
|
605
|
-
function parseBooleanTrueLike(value) {
|
|
606
|
-
return BOOLEAN_TRUE_VALUES.has((value ?? "").trim().toLowerCase());
|
|
607
|
-
}
|
|
608
|
-
function normalizePmVersion(value) {
|
|
609
|
-
const trimmed = value?.trim() ?? "";
|
|
610
|
-
return trimmed.length > 0 ? trimmed : "0.0.0";
|
|
611
|
-
}
|
|
612
|
-
function normalizeTelemetryErrorCode(value) {
|
|
613
|
-
const normalized = value?.trim();
|
|
614
|
-
return normalized && normalized.length > 0 ? normalized : void 0;
|
|
615
|
-
}
|
|
616
|
-
function normalizeTelemetryExitCode(exitCode, ok) {
|
|
617
|
-
if (Number.isFinite(exitCode)) {
|
|
618
|
-
return Math.max(0, Math.trunc(exitCode ?? 0));
|
|
619
|
-
}
|
|
620
|
-
return ok ? 0 : 1;
|
|
621
|
-
}
|
|
622
|
-
function normalizeTelemetryErrorCategory(params) {
|
|
623
|
-
if (params.ok) {
|
|
624
|
-
return void 0;
|
|
625
|
-
}
|
|
626
|
-
if (typeof params.errorCategory === "string" && params.errorCategory.trim().length > 0) {
|
|
627
|
-
return params.errorCategory;
|
|
628
|
-
}
|
|
629
|
-
if (typeof params.errorCode === "string" && params.errorCode.trim().length > 0) {
|
|
630
|
-
return resolveTelemetryErrorCategory(params.errorCode);
|
|
631
|
-
}
|
|
632
|
-
return "unknown";
|
|
633
|
-
}
|
|
634
|
-
function resolveTelemetrySourceContext(globalOptions) {
|
|
635
|
-
const override = (process.env[PM_TELEMETRY_SOURCE_CONTEXT_ENV] ?? "").trim().toLowerCase();
|
|
636
|
-
if (PM_TELEMETRY_SOURCE_CONTEXT_SET.has(override)) {
|
|
637
|
-
return {
|
|
638
|
-
source_context: override,
|
|
639
|
-
source_context_source: "env_override"
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
const nodeEnv = (process.env.NODE_ENV ?? "").trim().toLowerCase();
|
|
643
|
-
if (typeof process.env.VITEST === "string" || typeof process.env.VITEST_WORKER_ID === "string" || nodeEnv === "test") {
|
|
644
|
-
return {
|
|
645
|
-
source_context: "test",
|
|
646
|
-
source_context_source: "inferred"
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
const nonTty = process.stdin.isTTY !== true || process.stdout.isTTY !== true;
|
|
650
|
-
const ci = parseBooleanTrueLike(process.env.CI);
|
|
651
|
-
const scriptLikeMode = globalOptions.json === true || globalOptions.quiet === true;
|
|
652
|
-
if (nonTty || ci || scriptLikeMode) {
|
|
653
|
-
return {
|
|
654
|
-
source_context: "automation",
|
|
655
|
-
source_context_source: "inferred"
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
return {
|
|
659
|
-
source_context: "user",
|
|
660
|
-
source_context_source: "inferred"
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
function hashWithInstallationId(installationId, value) {
|
|
664
|
-
return crypto.createHash("sha256").update(`${installationId}:${value}`).digest("hex");
|
|
665
|
-
}
|
|
666
|
-
function normalizeForHash(value, depth = 0) {
|
|
667
|
-
if (value === null || value === void 0) {
|
|
668
|
-
return value;
|
|
669
|
-
}
|
|
670
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
671
|
-
return value;
|
|
672
|
-
}
|
|
673
|
-
if (depth >= TELEMETRY_SANITIZE_MAX_DEPTH) {
|
|
674
|
-
return "[depth_truncated]";
|
|
675
|
-
}
|
|
676
|
-
if (Array.isArray(value)) {
|
|
677
|
-
return value.slice(0, TELEMETRY_SANITIZE_MAX_ARRAY_ITEMS).map((entry) => normalizeForHash(entry, depth + 1));
|
|
678
|
-
}
|
|
679
|
-
if (typeof value === "object") {
|
|
680
|
-
const record = value;
|
|
681
|
-
const normalized = {};
|
|
682
|
-
const sortedKeys = Object.keys(record).sort((left, right) => left.localeCompare(right));
|
|
683
|
-
for (const key of sortedKeys) {
|
|
684
|
-
normalized[key] = normalizeForHash(record[key], depth + 1);
|
|
685
|
-
}
|
|
686
|
-
return normalized;
|
|
687
|
-
}
|
|
688
|
-
return String(value);
|
|
689
|
-
}
|
|
690
|
-
function hashTelemetryValue(installationId, value) {
|
|
691
|
-
return hashWithInstallationId(installationId, JSON.stringify(normalizeForHash(value)));
|
|
692
|
-
}
|
|
693
|
-
function hashCommandArgs(installationId, args) {
|
|
694
|
-
return {
|
|
695
|
-
hashes: args.map((arg) => hashWithInstallationId(installationId, arg)),
|
|
696
|
-
digest: hashWithInstallationId(installationId, args.join("\0"))
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
function hashTelemetryErrorFingerprint(installationId, command, errorCode2, errorMessage) {
|
|
700
|
-
const normalizedMessage = sanitizeString(errorMessage ?? "", "redacted");
|
|
701
|
-
const fingerprintSource = `${command}\0${errorCode2 ?? "unknown_error"}\0${normalizedMessage}`;
|
|
702
|
-
return hashWithInstallationId(installationId, fingerprintSource);
|
|
703
|
-
}
|
|
704
|
-
function telemetryDisabledByEnvironment() {
|
|
705
|
-
return PM_TELEMETRY_DISABLED_VALUES.has((process.env[PM_TELEMETRY_DISABLED_ENV] ?? "").trim().toLowerCase()) || PM_TELEMETRY_DISABLED_VALUES.has((process.env[PM_NO_TELEMETRY_ENV] ?? "").trim().toLowerCase());
|
|
706
|
-
}
|
|
707
|
-
function resolveOtelTracesEndpoint() {
|
|
708
|
-
if (PM_TELEMETRY_OTEL_DISABLED_VALUES.has((process.env[PM_TELEMETRY_OTEL_DISABLED_ENV] ?? "").trim().toLowerCase())) {
|
|
709
|
-
return null;
|
|
710
|
-
}
|
|
711
|
-
const directEndpoint = (process.env[OTEL_TRACES_ENDPOINT_ENV] ?? "").trim();
|
|
712
|
-
if (directEndpoint.length > 0) {
|
|
713
|
-
try {
|
|
714
|
-
return new URL(directEndpoint).toString();
|
|
715
|
-
} catch {
|
|
716
|
-
return null;
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
const baseEndpoint = (process.env[OTEL_BASE_ENDPOINT_ENV] ?? "").trim();
|
|
720
|
-
if (baseEndpoint.length === 0) {
|
|
721
|
-
return null;
|
|
722
|
-
}
|
|
723
|
-
try {
|
|
724
|
-
const url = new URL(baseEndpoint);
|
|
725
|
-
const normalizedPath = url.pathname.replace(/\/+$/, "");
|
|
726
|
-
if (!normalizedPath.endsWith("/v1/traces")) {
|
|
727
|
-
url.pathname = `${normalizedPath.length === 0 ? "" : normalizedPath}/v1/traces`;
|
|
728
|
-
}
|
|
729
|
-
return url.toString();
|
|
730
|
-
} catch {
|
|
731
|
-
return null;
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
function isoToUnixNano(iso) {
|
|
735
|
-
const parsedMs = Date.parse(iso);
|
|
736
|
-
const epochMs = Number.isNaN(parsedMs) ? Date.now() : parsedMs;
|
|
737
|
-
return `${BigInt(epochMs) * 1000000n}`;
|
|
738
|
-
}
|
|
739
|
-
function otlpStringAttribute(key, value) {
|
|
740
|
-
return {
|
|
741
|
-
key,
|
|
742
|
-
value: { stringValue: value }
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
function otlpBoolAttribute(key, value) {
|
|
746
|
-
return {
|
|
747
|
-
key,
|
|
748
|
-
value: { boolValue: value }
|
|
749
|
-
};
|
|
750
|
-
}
|
|
751
|
-
function otlpIntAttribute(key, value) {
|
|
752
|
-
return {
|
|
753
|
-
key,
|
|
754
|
-
value: { intValue: String(Math.max(0, Math.trunc(value))) }
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
async function exportLocalOtelSpan(activeCommand, outcome, finishedAtIso, durationMs) {
|
|
758
|
-
if (typeof activeCommand.otel_traces_endpoint !== "string" || activeCommand.otel_traces_endpoint.trim().length === 0 || typeof activeCommand.otel_trace_id !== "string" || activeCommand.otel_trace_id.length === 0 || typeof activeCommand.otel_span_id !== "string" || activeCommand.otel_span_id.length === 0) {
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
const serviceNameCandidate = sanitizeString((process.env[OTEL_SERVICE_NAME_ENV] ?? "").trim());
|
|
762
|
-
const serviceName = serviceNameCandidate.length > 0 ? serviceNameCandidate : "pm-cli";
|
|
763
|
-
const normalizedExitCode = normalizeTelemetryExitCode(outcome.exit_code, outcome.ok);
|
|
764
|
-
const normalizedErrorCode = normalizeTelemetryErrorCode(outcome.error_code);
|
|
765
|
-
const normalizedErrorCategory = normalizeTelemetryErrorCategory({
|
|
766
|
-
ok: outcome.ok,
|
|
767
|
-
errorCode: normalizedErrorCode,
|
|
768
|
-
errorCategory: outcome.error_category
|
|
769
|
-
});
|
|
770
|
-
const attributes = [
|
|
771
|
-
otlpStringAttribute("pm.command", sanitizeString(activeCommand.command)),
|
|
772
|
-
otlpStringAttribute("pm.version", activeCommand.pm_version),
|
|
773
|
-
otlpStringAttribute("pm.source_context", activeCommand.source_context),
|
|
774
|
-
otlpStringAttribute("pm.source_context_source", activeCommand.source_context_source),
|
|
775
|
-
otlpStringAttribute("pm.installation_id", activeCommand.installation_id),
|
|
776
|
-
otlpStringAttribute("pm.session_id", PROCESS_SESSION_ID),
|
|
777
|
-
otlpStringAttribute("pm.pm_root_hash", activeCommand.pm_root_hash),
|
|
778
|
-
otlpStringAttribute("pm.cwd_hash", activeCommand.cwd_hash),
|
|
779
|
-
otlpBoolAttribute("pm.ok", outcome.ok),
|
|
780
|
-
otlpIntAttribute("pm.exit_code", normalizedExitCode),
|
|
781
|
-
otlpIntAttribute("pm.duration_ms", durationMs)
|
|
782
|
-
];
|
|
783
|
-
if (typeof normalizedErrorCode === "string") {
|
|
784
|
-
attributes.push(otlpStringAttribute("pm.error_code", normalizedErrorCode));
|
|
785
|
-
}
|
|
786
|
-
if (typeof normalizedErrorCategory === "string") {
|
|
787
|
-
attributes.push(otlpStringAttribute("pm.error_category", normalizedErrorCategory));
|
|
788
|
-
}
|
|
789
|
-
if (typeof outcome.error === "string" && outcome.error.trim().length > 0) {
|
|
790
|
-
attributes.push(otlpStringAttribute("pm.error", sanitizeString(outcome.error)));
|
|
791
|
-
}
|
|
792
|
-
const payload = {
|
|
793
|
-
resourceSpans: [
|
|
794
|
-
{
|
|
795
|
-
resource: {
|
|
796
|
-
attributes: [otlpStringAttribute("service.name", serviceName)]
|
|
797
|
-
},
|
|
798
|
-
scopeSpans: [
|
|
799
|
-
{
|
|
800
|
-
scope: {
|
|
801
|
-
name: "pm-cli.telemetry",
|
|
802
|
-
version: "1"
|
|
803
|
-
},
|
|
804
|
-
spans: [
|
|
805
|
-
{
|
|
806
|
-
traceId: activeCommand.otel_trace_id,
|
|
807
|
-
spanId: activeCommand.otel_span_id,
|
|
808
|
-
name: `pm.command.${sanitizeString(activeCommand.command)}`,
|
|
809
|
-
kind: 1,
|
|
810
|
-
startTimeUnixNano: isoToUnixNano(activeCommand.started_at),
|
|
811
|
-
endTimeUnixNano: isoToUnixNano(finishedAtIso),
|
|
812
|
-
attributes,
|
|
813
|
-
status: {
|
|
814
|
-
code: outcome.ok ? 1 : 2,
|
|
815
|
-
message: outcome.ok ? "" : sanitizeString(outcome.error ?? "command_failed")
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
]
|
|
819
|
-
}
|
|
820
|
-
]
|
|
821
|
-
}
|
|
822
|
-
]
|
|
823
|
-
};
|
|
824
|
-
const response = await fetch(activeCommand.otel_traces_endpoint, {
|
|
825
|
-
method: "POST",
|
|
826
|
-
headers: {
|
|
827
|
-
"content-type": "application/json"
|
|
828
|
-
},
|
|
829
|
-
body: JSON.stringify(payload),
|
|
830
|
-
signal: AbortSignal.timeout(TELEMETRY_HTTP_TIMEOUT_MS)
|
|
831
|
-
});
|
|
832
|
-
if (!response.ok) {
|
|
833
|
-
throw new Error(`local_otel_export_http_${response.status}`);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
function summarizeResult(result, captureLevel = "redacted") {
|
|
837
|
-
if (result === null || result === void 0) {
|
|
838
|
-
return { type: "nullish" };
|
|
839
|
-
}
|
|
840
|
-
if (typeof result === "string") {
|
|
841
|
-
return { type: "string", value: sanitizeString(result, captureLevel) };
|
|
842
|
-
}
|
|
843
|
-
if (typeof result === "number" || typeof result === "boolean") {
|
|
844
|
-
return { type: typeof result, value: result };
|
|
845
|
-
}
|
|
846
|
-
if (Array.isArray(result)) {
|
|
847
|
-
return {
|
|
848
|
-
type: "array",
|
|
849
|
-
length: result.length,
|
|
850
|
-
sample: result.slice(0, 5).map((entry) => sanitizeValue(entry, void 0, captureLevel))
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
if (typeof result === "object") {
|
|
854
|
-
const record = result;
|
|
855
|
-
const keys = Object.keys(record).sort((left, right) => left.localeCompare(right));
|
|
856
|
-
const sanitized = {};
|
|
857
|
-
let previewBytes = 0;
|
|
858
|
-
for (const key of keys.slice(0, 25)) {
|
|
859
|
-
const sanitizedValue = sanitizeValue(record[key], key, captureLevel);
|
|
860
|
-
const entrySize = JSON.stringify(sanitizedValue)?.length ?? 0;
|
|
861
|
-
if (previewBytes + entrySize > TELEMETRY_RESULT_PREVIEW_MAX_BYTES) {
|
|
862
|
-
sanitized[key] = "[preview_truncated]";
|
|
863
|
-
break;
|
|
864
|
-
}
|
|
865
|
-
previewBytes += entrySize;
|
|
866
|
-
sanitized[key] = sanitizedValue;
|
|
867
|
-
}
|
|
868
|
-
return {
|
|
869
|
-
type: "object",
|
|
870
|
-
key_count: keys.length,
|
|
871
|
-
keys_preview: keys.slice(0, 50),
|
|
872
|
-
preview: sanitized
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
return { type: typeof result, value: String(result) };
|
|
876
|
-
}
|
|
877
|
-
function buildCommandStartPayload(params) {
|
|
878
|
-
const { captureLevel, context, pmVersion, sourceContext, pmRootHash, cwdHash, installationId } = params;
|
|
879
|
-
const commandTaxonomy = deriveTelemetryCommandTaxonomy(context.command);
|
|
880
|
-
const hashedArgs = hashCommandArgs(installationId, context.args);
|
|
881
|
-
const commandInvocationDigest = hashWithInstallationId(installationId, `${context.command}\0${context.args.join("\0")}`);
|
|
882
|
-
const commandOptionsDigest = hashTelemetryValue(installationId, context.options);
|
|
883
|
-
const globalOptionsDigest = hashTelemetryValue(installationId, context.global);
|
|
884
|
-
if (captureLevel === "minimal") {
|
|
885
|
-
return {
|
|
886
|
-
capture_level: captureLevel,
|
|
887
|
-
pm_version: pmVersion,
|
|
888
|
-
source_context: sourceContext.source_context,
|
|
889
|
-
source_context_source: sourceContext.source_context_source,
|
|
890
|
-
command_taxonomy: commandTaxonomy,
|
|
891
|
-
command_args_digest: hashedArgs.digest,
|
|
892
|
-
command_invocation_digest: commandInvocationDigest,
|
|
893
|
-
command_options_digest: commandOptionsDigest,
|
|
894
|
-
global_options_digest: globalOptionsDigest
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
return {
|
|
898
|
-
pm_version: pmVersion,
|
|
899
|
-
source_context: sourceContext.source_context,
|
|
900
|
-
source_context_source: sourceContext.source_context_source,
|
|
901
|
-
command_taxonomy: commandTaxonomy,
|
|
902
|
-
command_args: sanitizeCommandArgs(context.args, captureLevel),
|
|
903
|
-
command_args_hashes: hashedArgs.hashes,
|
|
904
|
-
command_args_digest: hashedArgs.digest,
|
|
905
|
-
command_invocation_digest: commandInvocationDigest,
|
|
906
|
-
command_options: sanitizeValue(context.options, void 0, captureLevel),
|
|
907
|
-
command_options_digest: commandOptionsDigest,
|
|
908
|
-
global_options: sanitizeValue(context.global, void 0, captureLevel),
|
|
909
|
-
global_options_digest: globalOptionsDigest,
|
|
910
|
-
pm_root_hash: pmRootHash,
|
|
911
|
-
cwd_hash: cwdHash,
|
|
912
|
-
capture_level: captureLevel,
|
|
913
|
-
runtime: {
|
|
914
|
-
node: process.version,
|
|
915
|
-
platform: process.platform,
|
|
916
|
-
arch: process.arch,
|
|
917
|
-
hostname_hash: hashWithInstallationId(installationId, os.hostname()),
|
|
918
|
-
stdin_tty: process.stdin.isTTY === true,
|
|
919
|
-
stdout_tty: process.stdout.isTTY === true
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
function buildCommandFinishPayload(params) {
|
|
924
|
-
const { captureLevel, pmVersion, sourceContext, outcome, durationMs, startedAt, command, installationId, commandTaxonomy, exitCode, errorCode: errorCode2, errorCategory, commandResolution, resolutionStage } = params;
|
|
925
|
-
const errorFingerprint = outcome.ok === false ? hashTelemetryErrorFingerprint(installationId, command, errorCode2, outcome.error) : void 0;
|
|
926
|
-
if (captureLevel === "minimal") {
|
|
927
|
-
return {
|
|
928
|
-
capture_level: captureLevel,
|
|
929
|
-
pm_version: pmVersion,
|
|
930
|
-
source_context: sourceContext.source_context,
|
|
931
|
-
source_context_source: sourceContext.source_context_source,
|
|
932
|
-
command_taxonomy: commandTaxonomy,
|
|
933
|
-
command_resolution: commandResolution,
|
|
934
|
-
resolution_stage: resolutionStage,
|
|
935
|
-
ok: outcome.ok,
|
|
936
|
-
exit_code: exitCode,
|
|
937
|
-
error_code: errorCode2,
|
|
938
|
-
error_category: errorCategory,
|
|
939
|
-
error: outcome.error ? sanitizeString(outcome.error, "redacted") : void 0,
|
|
940
|
-
error_fingerprint: errorFingerprint,
|
|
941
|
-
duration_ms: durationMs
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
return {
|
|
945
|
-
capture_level: captureLevel,
|
|
946
|
-
pm_version: pmVersion,
|
|
947
|
-
source_context: sourceContext.source_context,
|
|
948
|
-
source_context_source: sourceContext.source_context_source,
|
|
949
|
-
command_taxonomy: commandTaxonomy,
|
|
950
|
-
command_resolution: commandResolution,
|
|
951
|
-
resolution_stage: resolutionStage,
|
|
952
|
-
ok: outcome.ok,
|
|
953
|
-
exit_code: exitCode,
|
|
954
|
-
error_code: errorCode2,
|
|
955
|
-
error_category: errorCategory,
|
|
956
|
-
error: outcome.error ? sanitizeString(outcome.error, captureLevel) : void 0,
|
|
957
|
-
error_fingerprint: errorFingerprint,
|
|
958
|
-
duration_ms: durationMs,
|
|
959
|
-
started_at: startedAt,
|
|
960
|
-
result_summary: summarizeResult(outcome.result, captureLevel)
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
function buildCommandErrorPayload(params) {
|
|
964
|
-
const { captureLevel, pmVersion, sourceContext, command, commandTaxonomy, commandResolution, resolutionStage, args, options, pmRootHash, cwdHash, installationId, errorCode: errorCode2, errorMessage, errorCategory, exitCode } = params;
|
|
965
|
-
const attemptedArgHashes = hashCommandArgs(installationId, args);
|
|
966
|
-
const attemptedCommandDigest = hashWithInstallationId(installationId, command);
|
|
967
|
-
const attemptedOptionsDigest = hashTelemetryValue(installationId, options);
|
|
968
|
-
const errorFingerprint = hashTelemetryErrorFingerprint(installationId, command, errorCode2, errorMessage);
|
|
969
|
-
if (captureLevel === "minimal") {
|
|
970
|
-
return {
|
|
971
|
-
capture_level: captureLevel,
|
|
972
|
-
pm_version: pmVersion,
|
|
973
|
-
source_context: sourceContext.source_context,
|
|
974
|
-
source_context_source: sourceContext.source_context_source,
|
|
975
|
-
command_taxonomy: commandTaxonomy,
|
|
976
|
-
command_resolution: commandResolution,
|
|
977
|
-
resolution_stage: resolutionStage,
|
|
978
|
-
attempted_command_digest: attemptedCommandDigest,
|
|
979
|
-
attempted_args_digest: attemptedArgHashes.digest,
|
|
980
|
-
attempted_options_digest: attemptedOptionsDigest,
|
|
981
|
-
error_code: errorCode2,
|
|
982
|
-
error_category: errorCategory,
|
|
983
|
-
exit_code: exitCode,
|
|
984
|
-
error: sanitizeString(errorMessage, "redacted"),
|
|
985
|
-
error_fingerprint: errorFingerprint
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
return {
|
|
989
|
-
capture_level: captureLevel,
|
|
990
|
-
pm_version: pmVersion,
|
|
991
|
-
source_context: sourceContext.source_context,
|
|
992
|
-
source_context_source: sourceContext.source_context_source,
|
|
993
|
-
command_taxonomy: commandTaxonomy,
|
|
994
|
-
command_resolution: commandResolution,
|
|
995
|
-
resolution_stage: resolutionStage,
|
|
996
|
-
attempted_command: sanitizeString(command, captureLevel),
|
|
997
|
-
attempted_command_digest: attemptedCommandDigest,
|
|
998
|
-
attempted_args: sanitizeCommandArgs(args, captureLevel),
|
|
999
|
-
attempted_args_hashes: attemptedArgHashes.hashes,
|
|
1000
|
-
attempted_args_digest: attemptedArgHashes.digest,
|
|
1001
|
-
attempted_options: sanitizeValue(options, void 0, captureLevel),
|
|
1002
|
-
attempted_options_digest: attemptedOptionsDigest,
|
|
1003
|
-
error_code: errorCode2,
|
|
1004
|
-
error_category: errorCategory,
|
|
1005
|
-
exit_code: exitCode,
|
|
1006
|
-
error: sanitizeString(errorMessage, captureLevel),
|
|
1007
|
-
error_fingerprint: errorFingerprint,
|
|
1008
|
-
pm_root_hash: pmRootHash,
|
|
1009
|
-
cwd_hash: cwdHash,
|
|
1010
|
-
runtime: {
|
|
1011
|
-
node: process.version,
|
|
1012
|
-
platform: process.platform,
|
|
1013
|
-
arch: process.arch,
|
|
1014
|
-
hostname_hash: hashWithInstallationId(installationId, os.hostname()),
|
|
1015
|
-
stdin_tty: process.stdin.isTTY === true,
|
|
1016
|
-
stdout_tty: process.stdout.isTTY === true
|
|
1017
|
-
}
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
async function ensureInstallationId(globalPmRoot) {
|
|
1021
|
-
const settings = await readSettings(globalPmRoot);
|
|
1022
|
-
let changed = false;
|
|
1023
|
-
if (settings.telemetry.installation_id.trim().length === 0) {
|
|
1024
|
-
settings.telemetry.installation_id = crypto.randomUUID();
|
|
1025
|
-
changed = true;
|
|
1026
|
-
}
|
|
1027
|
-
if (changed) {
|
|
1028
|
-
await writeSettings(globalPmRoot, settings, "telemetry:install_id");
|
|
99
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
100
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c965da5d-6609-5258-ba49-a57475f7f2ef");
|
|
101
|
+
} catch (e2) {
|
|
1029
102
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const queued = {
|
|
1038
|
-
event,
|
|
1039
|
-
attempts: 0
|
|
1040
|
-
};
|
|
1041
|
-
let serialized = JSON.stringify(queued);
|
|
1042
|
-
if (serialized.length > TELEMETRY_MAX_EVENT_BYTES) {
|
|
1043
|
-
const trimmed = { ...event, payload: { ...event.payload, result_summary: { truncated: true, reason: "payload_size_exceeded", original_bytes: serialized.length } } };
|
|
1044
|
-
const trimmedQueued = { event: trimmed, attempts: 0 };
|
|
1045
|
-
serialized = JSON.stringify(trimmedQueued);
|
|
1046
|
-
}
|
|
1047
|
-
await withQueueMutation(async () => {
|
|
1048
|
-
await appendLineAtomic(queuePath(globalPmRoot), serialized);
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
function parseQueueLines(raw) {
|
|
1052
|
-
const entries = [];
|
|
1053
|
-
for (const line of raw.split("\n")) {
|
|
1054
|
-
const trimmed = line.trim();
|
|
1055
|
-
if (trimmed.length === 0) {
|
|
1056
|
-
continue;
|
|
1057
|
-
}
|
|
1058
|
-
try {
|
|
1059
|
-
const parsed = JSON.parse(trimmed);
|
|
1060
|
-
if (parsed && typeof parsed === "object" && parsed.event && typeof parsed.event === "object" && typeof parsed.attempts === "number") {
|
|
1061
|
-
entries.push(parsed);
|
|
1062
|
-
}
|
|
1063
|
-
} catch {
|
|
1064
|
-
}
|
|
103
|
+
})();
|
|
104
|
+
var TELEMETRY_PROMPT_DISABLE_ENV = "PM_TELEMETRY_PROMPT";
|
|
105
|
+
var TELEMETRY_PROMPT_DISABLE_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
106
|
+
var TELEMETRY_PROMPT_SKIPPED_COMMANDS = /* @__PURE__ */ new Set(["init", "completion", "completion-statuses", "completion-tags", "completion-types"]);
|
|
107
|
+
function parseBooleanLike(value) {
|
|
108
|
+
if (typeof value !== "string") {
|
|
109
|
+
return false;
|
|
1065
110
|
}
|
|
1066
|
-
return
|
|
1067
|
-
}
|
|
1068
|
-
function nextRetryIso(attempts) {
|
|
1069
|
-
const delay = Math.min(TELEMETRY_RETRY_BASE_DELAY_MS * 2 ** Math.max(attempts - 1, 0), TELEMETRY_MAX_RETRY_DELAY_MS);
|
|
1070
|
-
return new Date(Date.now() + delay).toISOString();
|
|
111
|
+
return TELEMETRY_PROMPT_DISABLE_VALUES.has(value.trim().toLowerCase());
|
|
1071
112
|
}
|
|
1072
|
-
function
|
|
1073
|
-
if (
|
|
113
|
+
function shouldSkipTelemetryPrompt(commandPath, globalOptions) {
|
|
114
|
+
if (globalOptions.json === true || globalOptions.quiet === true) {
|
|
1074
115
|
return true;
|
|
1075
116
|
}
|
|
1076
|
-
|
|
1077
|
-
if (Number.isNaN(dueAtMs)) {
|
|
117
|
+
if (process.stdin.isTTY !== true || process.stdout.isTTY !== true) {
|
|
1078
118
|
return true;
|
|
1079
119
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
function retentionCutoffMs(retentionDays) {
|
|
1083
|
-
const normalizedDays = Number.isFinite(retentionDays) ? Math.max(1, Math.trunc(retentionDays)) : 1;
|
|
1084
|
-
return Date.now() - normalizedDays * MILLISECONDS_PER_DAY;
|
|
1085
|
-
}
|
|
1086
|
-
function isExpiredQueueEntry(entry, cutoffMs) {
|
|
1087
|
-
const occurredAt = entry.event?.occurred_at;
|
|
1088
|
-
if (typeof occurredAt !== "string" || occurredAt.trim().length === 0) {
|
|
1089
|
-
return false;
|
|
1090
|
-
}
|
|
1091
|
-
const occurredAtMs = Date.parse(occurredAt);
|
|
1092
|
-
if (Number.isNaN(occurredAtMs)) {
|
|
1093
|
-
return false;
|
|
1094
|
-
}
|
|
1095
|
-
return occurredAtMs < cutoffMs;
|
|
1096
|
-
}
|
|
1097
|
-
function pruneExpiredQueueEntries(entries, retentionDays) {
|
|
1098
|
-
const cutoffMs = retentionCutoffMs(retentionDays);
|
|
1099
|
-
const retained = [];
|
|
1100
|
-
let prunedCount = 0;
|
|
1101
|
-
for (const entry of entries) {
|
|
1102
|
-
const serializedSize = JSON.stringify(entry).length;
|
|
1103
|
-
const oversized = serializedSize > TELEMETRY_MAX_EVENT_BYTES;
|
|
1104
|
-
if (oversized || isExpiredQueueEntry(entry, cutoffMs) || entry.attempts >= TELEMETRY_MAX_QUEUE_ENTRY_ATTEMPTS) {
|
|
1105
|
-
prunedCount += 1;
|
|
1106
|
-
continue;
|
|
1107
|
-
}
|
|
1108
|
-
retained.push(entry);
|
|
1109
|
-
}
|
|
1110
|
-
return { entries: retained, prunedCount };
|
|
1111
|
-
}
|
|
1112
|
-
async function rewriteQueue(globalPmRoot, entries) {
|
|
1113
|
-
const serialized = entries.map((entry) => JSON.stringify(entry)).join("\n");
|
|
1114
|
-
const contents = serialized.length > 0 ? `${serialized}
|
|
1115
|
-
` : "";
|
|
1116
|
-
for (let attempt = 0; ; attempt += 1) {
|
|
1117
|
-
try {
|
|
1118
|
-
await writeFileAtomic(queuePath(globalPmRoot), contents);
|
|
1119
|
-
return;
|
|
1120
|
-
} catch (error) {
|
|
1121
|
-
const retryDelay = TELEMETRY_QUEUE_REWRITE_RETRY_DELAYS_MS[attempt];
|
|
1122
|
-
if (retryDelay === void 0 || !isRetryableQueueRewriteError(error)) {
|
|
1123
|
-
throw error;
|
|
1124
|
-
}
|
|
1125
|
-
await sleep(retryDelay);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
function isRetryableQueueRewriteError(error) {
|
|
1130
|
-
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
1131
|
-
return false;
|
|
1132
|
-
}
|
|
1133
|
-
const code = error.code;
|
|
1134
|
-
return code === "EACCES" || code === "EBUSY" || code === "EPERM";
|
|
1135
|
-
}
|
|
1136
|
-
function sleep(milliseconds) {
|
|
1137
|
-
return new Promise((resolve) => {
|
|
1138
|
-
setTimeout(resolve, milliseconds);
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
async function cleanupTelemetryQueueTempOrphans(globalPmRoot, maxAgeMs = TELEMETRY_QUEUE_TMP_ORPHAN_MAX_AGE_MS) {
|
|
1142
|
-
try {
|
|
1143
|
-
const dirPath = telemetryRuntimeDirectory(globalPmRoot);
|
|
1144
|
-
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
1145
|
-
const cutoffMs = Date.now() - Math.max(0, maxAgeMs);
|
|
1146
|
-
await Promise.all(entries.filter((entry) => entry.isFile() && /^\.events\.jsonl\.\d+\.\d+\.[a-f0-9]+\.tmp$/.test(entry.name)).map(async (entry) => {
|
|
1147
|
-
const candidate = path.join(dirPath, entry.name);
|
|
1148
|
-
const candidateStats = await stat(candidate);
|
|
1149
|
-
if (candidateStats.mtimeMs < cutoffMs) {
|
|
1150
|
-
await rm(candidate, { force: true });
|
|
1151
|
-
}
|
|
1152
|
-
}));
|
|
1153
|
-
} catch {
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
async function withQueueMutation(operation) {
|
|
1157
|
-
const run = _queueMutationPromise.catch(() => {
|
|
1158
|
-
}).then(operation);
|
|
1159
|
-
_queueMutationPromise = run.catch(() => {
|
|
1160
|
-
});
|
|
1161
|
-
return run;
|
|
1162
|
-
}
|
|
1163
|
-
async function readCurrentQueueEntries(globalPmRoot) {
|
|
1164
|
-
const raw = await readFileIfExists(queuePath(globalPmRoot));
|
|
1165
|
-
if (raw === null || raw.trim().length === 0) {
|
|
1166
|
-
return [];
|
|
1167
|
-
}
|
|
1168
|
-
return parseQueueLines(raw);
|
|
1169
|
-
}
|
|
1170
|
-
async function removeFlushedEntriesFromCurrentQueue(globalPmRoot, flushedIds, retentionDays) {
|
|
1171
|
-
return withQueueMutation(async () => {
|
|
1172
|
-
const currentEntries = await readCurrentQueueEntries(globalPmRoot);
|
|
1173
|
-
const { entries: retainedEntries } = pruneExpiredQueueEntries(currentEntries, retentionDays);
|
|
1174
|
-
const remaining = retainedEntries.filter((entry) => !flushedIds.has(entry.event.event_id));
|
|
1175
|
-
await rewriteQueue(globalPmRoot, remaining);
|
|
1176
|
-
return remaining;
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
|
-
async function markFailedEntriesInCurrentQueue(globalPmRoot, failedIds, attemptTime, retentionDays) {
|
|
1180
|
-
return withQueueMutation(async () => {
|
|
1181
|
-
const currentEntries = await readCurrentQueueEntries(globalPmRoot);
|
|
1182
|
-
const { entries: retainedEntries } = pruneExpiredQueueEntries(currentEntries, retentionDays);
|
|
1183
|
-
const retried = retainedEntries.map((entry) => {
|
|
1184
|
-
if (!failedIds.has(entry.event.event_id)) {
|
|
1185
|
-
return entry;
|
|
1186
|
-
}
|
|
1187
|
-
const attempts = entry.attempts + 1;
|
|
1188
|
-
return {
|
|
1189
|
-
...entry,
|
|
1190
|
-
attempts,
|
|
1191
|
-
last_attempt_at: attemptTime,
|
|
1192
|
-
next_attempt_after: nextRetryIso(attempts)
|
|
1193
|
-
};
|
|
1194
|
-
});
|
|
1195
|
-
await rewriteQueue(globalPmRoot, retried);
|
|
1196
|
-
return retried;
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
async function flushQueue(globalPmRoot, endpoint, retentionDays) {
|
|
1200
|
-
await cleanupTelemetryQueueTempOrphans(globalPmRoot);
|
|
1201
|
-
const normalizedEndpoint = endpoint.trim();
|
|
1202
|
-
if (normalizedEndpoint.length === 0) {
|
|
1203
|
-
return;
|
|
1204
|
-
}
|
|
1205
|
-
const raw = await readFileIfExists(queuePath(globalPmRoot));
|
|
1206
|
-
if (raw === null || raw.trim().length === 0) {
|
|
1207
|
-
await writeRuntimeState(globalPmRoot, {
|
|
1208
|
-
endpoint: normalizedEndpoint,
|
|
1209
|
-
queue_entries: 0
|
|
1210
|
-
});
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
const queueEntries = parseQueueLines(raw);
|
|
1214
|
-
if (queueEntries.length === 0) {
|
|
1215
|
-
await writeRuntimeState(globalPmRoot, {
|
|
1216
|
-
endpoint: normalizedEndpoint,
|
|
1217
|
-
queue_entries: 0
|
|
1218
|
-
});
|
|
1219
|
-
return;
|
|
1220
|
-
}
|
|
1221
|
-
const { entries: retainedEntries, prunedCount } = pruneExpiredQueueEntries(queueEntries, retentionDays);
|
|
1222
|
-
if (retainedEntries.length === 0) {
|
|
1223
|
-
if (prunedCount > 0) {
|
|
1224
|
-
await rewriteQueue(globalPmRoot, []);
|
|
1225
|
-
}
|
|
1226
|
-
await writeRuntimeState(globalPmRoot, {
|
|
1227
|
-
endpoint: normalizedEndpoint,
|
|
1228
|
-
queue_entries: 0
|
|
1229
|
-
});
|
|
1230
|
-
return;
|
|
1231
|
-
}
|
|
1232
|
-
const dueEntries = retainedEntries.filter((entry) => isDueForRetry(entry)).slice(0, TELEMETRY_FLUSH_BATCH_SIZE);
|
|
1233
|
-
if (dueEntries.length === 0) {
|
|
1234
|
-
if (prunedCount > 0) {
|
|
1235
|
-
await rewriteQueue(globalPmRoot, retainedEntries);
|
|
1236
|
-
}
|
|
1237
|
-
await writeRuntimeState(globalPmRoot, {
|
|
1238
|
-
endpoint: normalizedEndpoint,
|
|
1239
|
-
queue_entries: retainedEntries.length
|
|
1240
|
-
});
|
|
1241
|
-
return;
|
|
1242
|
-
}
|
|
1243
|
-
const dueIds = new Set(dueEntries.map((entry) => entry.event.event_id));
|
|
1244
|
-
const attemptTime = nowIso();
|
|
1245
|
-
const requestHeaders = {
|
|
1246
|
-
"content-type": "application/json"
|
|
1247
|
-
};
|
|
1248
|
-
const ingestKey = process.env.PM_TELEMETRY_INGEST_KEY?.trim();
|
|
1249
|
-
if (ingestKey) {
|
|
1250
|
-
requestHeaders["x-pm-telemetry-key"] = ingestKey;
|
|
1251
|
-
}
|
|
1252
|
-
try {
|
|
1253
|
-
const response = await fetch(normalizedEndpoint, {
|
|
1254
|
-
method: "POST",
|
|
1255
|
-
headers: requestHeaders,
|
|
1256
|
-
body: JSON.stringify({
|
|
1257
|
-
schema_version: TELEMETRY_SCHEMA_VERSION,
|
|
1258
|
-
events: dueEntries.map((entry) => entry.event)
|
|
1259
|
-
}),
|
|
1260
|
-
signal: AbortSignal.timeout(TELEMETRY_HTTP_TIMEOUT_MS)
|
|
1261
|
-
});
|
|
1262
|
-
if (!response.ok) {
|
|
1263
|
-
throw new Error(`telemetry_flush_http_${response.status}`);
|
|
1264
|
-
}
|
|
1265
|
-
} catch (error) {
|
|
1266
|
-
const retried = await markFailedEntriesInCurrentQueue(globalPmRoot, dueIds, attemptTime, retentionDays);
|
|
1267
|
-
const errorMessage = (() => {
|
|
1268
|
-
if (error instanceof Error) {
|
|
1269
|
-
return sanitizeString(error.message, "redacted");
|
|
1270
|
-
}
|
|
1271
|
-
return "telemetry_flush_failed";
|
|
1272
|
-
})();
|
|
1273
|
-
await writeRuntimeState(globalPmRoot, {
|
|
1274
|
-
endpoint: normalizedEndpoint,
|
|
1275
|
-
queue_entries: retried.length,
|
|
1276
|
-
last_attempted_flush_at: attemptTime,
|
|
1277
|
-
last_failed_flush_at: attemptTime,
|
|
1278
|
-
last_failed_flush_error: errorMessage
|
|
1279
|
-
});
|
|
1280
|
-
return;
|
|
1281
|
-
}
|
|
1282
|
-
try {
|
|
1283
|
-
const remaining = await removeFlushedEntriesFromCurrentQueue(globalPmRoot, dueIds, retentionDays);
|
|
1284
|
-
await writeRuntimeState(globalPmRoot, {
|
|
1285
|
-
endpoint: normalizedEndpoint,
|
|
1286
|
-
queue_entries: remaining.length,
|
|
1287
|
-
last_attempted_flush_at: attemptTime,
|
|
1288
|
-
last_successful_flush_at: attemptTime,
|
|
1289
|
-
last_failed_flush_at: void 0,
|
|
1290
|
-
last_failed_flush_error: void 0
|
|
1291
|
-
});
|
|
1292
|
-
} catch (error) {
|
|
1293
|
-
const errorMessage = (() => {
|
|
1294
|
-
if (error instanceof Error) {
|
|
1295
|
-
return sanitizeString(error.message, "redacted");
|
|
1296
|
-
}
|
|
1297
|
-
return "telemetry_flush_failed";
|
|
1298
|
-
})();
|
|
1299
|
-
const currentEntries = await readCurrentQueueEntries(globalPmRoot).catch(() => retainedEntries);
|
|
1300
|
-
await writeRuntimeState(globalPmRoot, {
|
|
1301
|
-
endpoint: normalizedEndpoint,
|
|
1302
|
-
queue_entries: currentEntries.length,
|
|
1303
|
-
last_attempted_flush_at: attemptTime,
|
|
1304
|
-
last_failed_flush_at: attemptTime,
|
|
1305
|
-
last_failed_flush_error: errorMessage
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
function isFreshDirectoryLock(lockPath, staleMs) {
|
|
1310
|
-
try {
|
|
1311
|
-
return Date.now() - statSync(lockPath).mtimeMs < staleMs;
|
|
1312
|
-
} catch {
|
|
1313
|
-
return false;
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
function removeDirectoryLockBestEffort(lockPath) {
|
|
1317
|
-
try {
|
|
1318
|
-
rmSync(lockPath, { recursive: true, force: true });
|
|
1319
|
-
} catch {
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
function errorCode(error) {
|
|
1323
|
-
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
1324
|
-
return void 0;
|
|
120
|
+
if (parseBooleanLike(process.env[TELEMETRY_PROMPT_DISABLE_ENV])) {
|
|
121
|
+
return true;
|
|
1325
122
|
}
|
|
1326
|
-
|
|
1327
|
-
return typeof code === "string" ? code : void 0;
|
|
1328
|
-
}
|
|
1329
|
-
function createDirectoryLock(lockPath) {
|
|
1330
|
-
try {
|
|
1331
|
-
mkdirSync(lockPath);
|
|
123
|
+
if (parseBooleanLike(process.env.CI)) {
|
|
1332
124
|
return true;
|
|
1333
|
-
} catch (error) {
|
|
1334
|
-
const code = errorCode(error);
|
|
1335
|
-
if (code === "EEXIST") {
|
|
1336
|
-
return false;
|
|
1337
|
-
}
|
|
1338
|
-
if (code !== "ENOENT") {
|
|
1339
|
-
return false;
|
|
1340
|
-
}
|
|
1341
125
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
mkdirSync(lockPath);
|
|
126
|
+
const normalizedCommandPath = commandPath.trim().toLowerCase();
|
|
127
|
+
if (normalizedCommandPath.length === 0) {
|
|
1345
128
|
return true;
|
|
1346
|
-
} catch {
|
|
1347
|
-
return false;
|
|
1348
129
|
}
|
|
130
|
+
return TELEMETRY_PROMPT_SKIPPED_COMMANDS.has(normalizedCommandPath);
|
|
1349
131
|
}
|
|
1350
|
-
function
|
|
1351
|
-
|
|
132
|
+
function parseTelemetryPromptAnswer(answer) {
|
|
133
|
+
const normalized = answer.trim().toLowerCase();
|
|
134
|
+
if (normalized === "n" || normalized === "no") {
|
|
1352
135
|
return false;
|
|
1353
136
|
}
|
|
1354
|
-
|
|
1355
|
-
try {
|
|
1356
|
-
if (Date.now() - statSync(lockPath).mtimeMs < TELEMETRY_FLUSH_SPAWN_LOCK_STALE_MS) {
|
|
1357
|
-
return false;
|
|
1358
|
-
}
|
|
1359
|
-
removeDirectoryLockBestEffort(lockPath);
|
|
1360
|
-
} catch (error) {
|
|
1361
|
-
if (errorCode(error) !== "ENOENT") {
|
|
1362
|
-
return false;
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
return createDirectoryLock(lockPath);
|
|
1366
|
-
}
|
|
1367
|
-
function releaseTelemetryFlushSpawnGate(globalPmRoot) {
|
|
1368
|
-
removeDirectoryLockBestEffort(flushSpawnLockPath(globalPmRoot));
|
|
1369
|
-
}
|
|
1370
|
-
function scheduleTelemetryFlush(globalPmRoot, endpoint, retentionDays) {
|
|
1371
|
-
if (shouldFlushInline()) {
|
|
1372
|
-
const previousFlush = _lastFlushPromise;
|
|
1373
|
-
const nextFlush = flushQueue(globalPmRoot, endpoint, retentionDays).catch(() => {
|
|
1374
|
-
});
|
|
1375
|
-
_lastFlushPromise = Promise.allSettled([previousFlush, nextFlush]).then(() => {
|
|
1376
|
-
});
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
try {
|
|
1380
|
-
const acquiredSpawnGate = acquireTelemetryFlushSpawnGate(globalPmRoot);
|
|
1381
|
-
if (!acquiredSpawnGate) {
|
|
1382
|
-
return;
|
|
1383
|
-
}
|
|
1384
|
-
const child = spawn(process.execPath, [telemetryFlushRunnerPath()], {
|
|
1385
|
-
detached: true,
|
|
1386
|
-
stdio: "ignore",
|
|
1387
|
-
env: {
|
|
1388
|
-
...process.env,
|
|
1389
|
-
PM_GLOBAL_PATH: globalPmRoot,
|
|
1390
|
-
[PM_TELEMETRY_FLUSH_CHILD_ENV]: "1"
|
|
1391
|
-
}
|
|
1392
|
-
});
|
|
1393
|
-
child.unref();
|
|
1394
|
-
} catch {
|
|
1395
|
-
releaseTelemetryFlushSpawnGate(globalPmRoot);
|
|
1396
|
-
}
|
|
137
|
+
return true;
|
|
1397
138
|
}
|
|
1398
|
-
async function
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
139
|
+
async function promptTelemetryConsent(currentDefault) {
|
|
140
|
+
const defaultLabel = currentDefault ? "Y/n" : "y/N";
|
|
141
|
+
const prompt = `pm telemetry helps improve reliability and usage diagnostics.
|
|
142
|
+
It is enabled by default and can be changed anytime via:
|
|
143
|
+
pm config global set telemetry-tracking --policy disabled
|
|
144
|
+
Enable telemetry now? [${defaultLabel}] `;
|
|
145
|
+
const rl = readline.createInterface({ input, output });
|
|
1402
146
|
try {
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
return null;
|
|
147
|
+
const answer = await rl.question(prompt);
|
|
148
|
+
if (answer.trim().length === 0) {
|
|
149
|
+
return currentDefault;
|
|
1407
150
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
const sourceContext = resolveTelemetrySourceContext(context.global);
|
|
1412
|
-
const pmRootHash = hashWithInstallationId(installationId, context.pm_root);
|
|
1413
|
-
const cwdHash = hashWithInstallationId(installationId, process.cwd());
|
|
1414
|
-
const otelTracesEndpoint = resolveOtelTracesEndpoint();
|
|
1415
|
-
const occurredAt = nowIso();
|
|
1416
|
-
const event = {
|
|
1417
|
-
schema_version: TELEMETRY_SCHEMA_VERSION,
|
|
1418
|
-
event_id: crypto.randomUUID(),
|
|
1419
|
-
event_type: "command_start",
|
|
1420
|
-
occurred_at: occurredAt,
|
|
1421
|
-
installation_id: installationId,
|
|
1422
|
-
session_id: PROCESS_SESSION_ID,
|
|
1423
|
-
command: context.command,
|
|
1424
|
-
payload: buildCommandStartPayload({
|
|
1425
|
-
captureLevel,
|
|
1426
|
-
context,
|
|
1427
|
-
pmVersion,
|
|
1428
|
-
sourceContext,
|
|
1429
|
-
pmRootHash,
|
|
1430
|
-
cwdHash,
|
|
1431
|
-
installationId
|
|
1432
|
-
})
|
|
1433
|
-
};
|
|
1434
|
-
await enqueueTelemetryEvent(globalPmRoot, event);
|
|
1435
|
-
scheduleTelemetryFlush(globalPmRoot, endpoint, retentionDays);
|
|
1436
|
-
const commandTaxonomy = deriveTelemetryCommandTaxonomy(context.command);
|
|
1437
|
-
return {
|
|
1438
|
-
started_at: occurredAt,
|
|
1439
|
-
started_at_ms: Date.now(),
|
|
1440
|
-
command: context.command,
|
|
1441
|
-
command_taxonomy: commandTaxonomy,
|
|
1442
|
-
pm_version: pmVersion,
|
|
1443
|
-
source_context: sourceContext.source_context,
|
|
1444
|
-
source_context_source: sourceContext.source_context_source,
|
|
1445
|
-
installation_id: installationId,
|
|
1446
|
-
pm_root_hash: pmRootHash,
|
|
1447
|
-
cwd_hash: cwdHash,
|
|
1448
|
-
endpoint,
|
|
1449
|
-
retention_days: retentionDays,
|
|
1450
|
-
global_pm_root: globalPmRoot,
|
|
1451
|
-
capture_level: captureLevel,
|
|
1452
|
-
otel_traces_endpoint: otelTracesEndpoint ?? void 0,
|
|
1453
|
-
otel_trace_id: otelTracesEndpoint ? crypto.randomBytes(16).toString("hex") : void 0,
|
|
1454
|
-
otel_span_id: otelTracesEndpoint ? crypto.randomBytes(8).toString("hex") : void 0
|
|
1455
|
-
};
|
|
1456
|
-
} catch {
|
|
1457
|
-
return null;
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
async function finishTelemetryCommand(activeCommand, outcome) {
|
|
1461
|
-
if (!activeCommand) {
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
1464
|
-
try {
|
|
1465
|
-
const finishedAt = nowIso();
|
|
1466
|
-
const durationMs = Math.max(0, Date.now() - activeCommand.started_at_ms);
|
|
1467
|
-
const normalizedErrorCode = normalizeTelemetryErrorCode(inferTelemetryErrorCode({
|
|
1468
|
-
ok: outcome.ok,
|
|
1469
|
-
errorCode: outcome.error_code,
|
|
1470
|
-
errorMessage: outcome.error,
|
|
1471
|
-
exitCode: outcome.exit_code
|
|
1472
|
-
}));
|
|
1473
|
-
const normalizedErrorCategory = normalizeTelemetryErrorCategory({
|
|
1474
|
-
ok: outcome.ok,
|
|
1475
|
-
errorCode: normalizedErrorCode,
|
|
1476
|
-
errorCategory: outcome.error_category
|
|
1477
|
-
});
|
|
1478
|
-
const normalizedExitCode = normalizeTelemetryExitCode(outcome.exit_code, outcome.ok);
|
|
1479
|
-
const commandResolution = outcome.command_resolution ?? deriveTelemetryCommandResolution({
|
|
1480
|
-
ok: outcome.ok,
|
|
1481
|
-
errorCode: normalizedErrorCode,
|
|
1482
|
-
errorCategory: normalizedErrorCategory
|
|
1483
|
-
});
|
|
1484
|
-
const resolutionStage = outcome.resolution_stage ?? "execute";
|
|
1485
|
-
const event = {
|
|
1486
|
-
schema_version: TELEMETRY_SCHEMA_VERSION,
|
|
1487
|
-
event_id: crypto.randomUUID(),
|
|
1488
|
-
event_type: "command_finish",
|
|
1489
|
-
occurred_at: finishedAt,
|
|
1490
|
-
installation_id: activeCommand.installation_id,
|
|
1491
|
-
session_id: PROCESS_SESSION_ID,
|
|
1492
|
-
command: activeCommand.command,
|
|
1493
|
-
payload: buildCommandFinishPayload({
|
|
1494
|
-
captureLevel: activeCommand.capture_level,
|
|
1495
|
-
pmVersion: activeCommand.pm_version,
|
|
1496
|
-
sourceContext: {
|
|
1497
|
-
source_context: activeCommand.source_context,
|
|
1498
|
-
source_context_source: activeCommand.source_context_source
|
|
1499
|
-
},
|
|
1500
|
-
outcome,
|
|
1501
|
-
durationMs,
|
|
1502
|
-
startedAt: activeCommand.started_at,
|
|
1503
|
-
command: activeCommand.command,
|
|
1504
|
-
installationId: activeCommand.installation_id,
|
|
1505
|
-
commandTaxonomy: activeCommand.command_taxonomy,
|
|
1506
|
-
exitCode: normalizedExitCode,
|
|
1507
|
-
errorCode: normalizedErrorCode,
|
|
1508
|
-
errorCategory: normalizedErrorCategory,
|
|
1509
|
-
commandResolution,
|
|
1510
|
-
resolutionStage
|
|
1511
|
-
})
|
|
1512
|
-
};
|
|
1513
|
-
await enqueueTelemetryEvent(activeCommand.global_pm_root, event);
|
|
1514
|
-
scheduleTelemetryFlush(activeCommand.global_pm_root, activeCommand.endpoint, activeCommand.retention_days);
|
|
1515
|
-
void exportLocalOtelSpan(activeCommand, {
|
|
1516
|
-
...outcome,
|
|
1517
|
-
exit_code: normalizedExitCode,
|
|
1518
|
-
error_code: normalizedErrorCode,
|
|
1519
|
-
error_category: normalizedErrorCategory
|
|
1520
|
-
}, finishedAt, durationMs).catch(() => {
|
|
1521
|
-
});
|
|
1522
|
-
} catch {
|
|
151
|
+
return parseTelemetryPromptAnswer(answer);
|
|
152
|
+
} finally {
|
|
153
|
+
rl.close();
|
|
1523
154
|
}
|
|
1524
155
|
}
|
|
1525
|
-
async function
|
|
1526
|
-
if (
|
|
156
|
+
async function maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions) {
|
|
157
|
+
if (shouldSkipTelemetryPrompt(commandPath, globalOptions)) {
|
|
1527
158
|
return;
|
|
1528
159
|
}
|
|
1529
160
|
try {
|
|
1530
161
|
const globalPmRoot = resolveGlobalPmRoot(process.cwd());
|
|
1531
162
|
const settings = await readSettings(globalPmRoot);
|
|
1532
|
-
if (
|
|
163
|
+
if (settings.telemetry.first_run_prompt_completed) {
|
|
1533
164
|
return;
|
|
1534
165
|
}
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
const occurredAt = nowIso();
|
|
1542
|
-
const normalizedErrorCode = normalizeTelemetryErrorCode(inferTelemetryErrorCode({
|
|
1543
|
-
ok: false,
|
|
1544
|
-
errorCode: context.error_code,
|
|
1545
|
-
errorMessage: context.error_message,
|
|
1546
|
-
exitCode: context.exit_code
|
|
1547
|
-
})) ?? "unknown_error";
|
|
1548
|
-
const normalizedErrorCategory = context.error_category ?? resolveTelemetryErrorCategory(normalizedErrorCode);
|
|
1549
|
-
const normalizedExitCode = normalizeTelemetryExitCode(context.exit_code, false);
|
|
1550
|
-
const normalizedCommand = context.command.trim().length > 0 ? context.command : "<unknown>";
|
|
1551
|
-
const commandTaxonomy = deriveTelemetryCommandTaxonomy(normalizedCommand);
|
|
1552
|
-
const commandResolution = context.command_resolution ?? deriveTelemetryCommandResolution({
|
|
1553
|
-
ok: false,
|
|
1554
|
-
errorCode: normalizedErrorCode,
|
|
1555
|
-
errorCategory: normalizedErrorCategory
|
|
1556
|
-
});
|
|
1557
|
-
const resolutionStage = context.resolution_stage ?? "unknown";
|
|
1558
|
-
const event = {
|
|
1559
|
-
schema_version: TELEMETRY_SCHEMA_VERSION,
|
|
1560
|
-
event_id: crypto.randomUUID(),
|
|
1561
|
-
event_type: "command_error",
|
|
1562
|
-
occurred_at: occurredAt,
|
|
1563
|
-
installation_id: installationId,
|
|
1564
|
-
session_id: PROCESS_SESSION_ID,
|
|
1565
|
-
command: sanitizeString(normalizedCommand, "redacted"),
|
|
1566
|
-
payload: buildCommandErrorPayload({
|
|
1567
|
-
captureLevel,
|
|
1568
|
-
pmVersion,
|
|
1569
|
-
sourceContext,
|
|
1570
|
-
command: normalizedCommand,
|
|
1571
|
-
commandTaxonomy,
|
|
1572
|
-
commandResolution,
|
|
1573
|
-
resolutionStage,
|
|
1574
|
-
args: context.args,
|
|
1575
|
-
options: context.options,
|
|
1576
|
-
pmRootHash,
|
|
1577
|
-
cwdHash,
|
|
1578
|
-
installationId,
|
|
1579
|
-
errorCode: normalizedErrorCode,
|
|
1580
|
-
errorCategory: normalizedErrorCategory,
|
|
1581
|
-
exitCode: normalizedExitCode,
|
|
1582
|
-
errorMessage: context.error_message
|
|
1583
|
-
})
|
|
1584
|
-
};
|
|
1585
|
-
await enqueueTelemetryEvent(globalPmRoot, event);
|
|
1586
|
-
scheduleTelemetryFlush(globalPmRoot, endpoint, retentionDays);
|
|
166
|
+
const enabled = await promptTelemetryConsent(settings.telemetry.enabled);
|
|
167
|
+
settings.telemetry.enabled = enabled;
|
|
168
|
+
settings.telemetry.first_run_prompt_completed = true;
|
|
169
|
+
await writeSettings(globalPmRoot, settings, "telemetry:first_run_prompt");
|
|
170
|
+
output.write(`Telemetry ${enabled ? "enabled" : "disabled"} for this CLI install. Update any time with pm config global set telemetry-tracking --policy ${enabled ? "disabled" : "enabled"}.
|
|
171
|
+
`);
|
|
1587
172
|
} catch {
|
|
1588
173
|
}
|
|
1589
174
|
}
|
|
1590
175
|
|
|
1591
176
|
// dist/core/sentry/instrument.js
|
|
1592
177
|
import fs from "node:fs";
|
|
1593
|
-
import
|
|
178
|
+
import path from "node:path";
|
|
1594
179
|
!(function() {
|
|
1595
180
|
try {
|
|
1596
181
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
@@ -1737,7 +322,7 @@ function isKnownNoisyConsoleBreadcrumb(breadcrumb) {
|
|
|
1737
322
|
}
|
|
1738
323
|
function resolveCliVersion() {
|
|
1739
324
|
try {
|
|
1740
|
-
const candidate =
|
|
325
|
+
const candidate = path.join(resolvePmPackageRootFromModule(import.meta.url, ["../../.."]), "package.json");
|
|
1741
326
|
if (fs.existsSync(candidate)) {
|
|
1742
327
|
const parsed = JSON.parse(fs.readFileSync(candidate, "utf8"));
|
|
1743
328
|
if (typeof parsed.version === "string")
|
|
@@ -2345,7 +930,7 @@ function parseLooseCommandOptions(args) {
|
|
|
2345
930
|
!(function() {
|
|
2346
931
|
try {
|
|
2347
932
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
2348
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
933
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "ad4ec245-86cd-551a-814a-482b7a2442b8");
|
|
2349
934
|
} catch (e2) {
|
|
2350
935
|
}
|
|
2351
936
|
})();
|
|
@@ -2804,6 +1389,14 @@ var HELP_BY_COMMAND_PATH = {
|
|
|
2804
1389
|
why: "Inspects item mutation timeline and audit trail.",
|
|
2805
1390
|
examples: ["pm history pm-a1b2 --limit 20", "pm history pm-a1b2 --full --verify"]
|
|
2806
1391
|
},
|
|
1392
|
+
"history-compact": {
|
|
1393
|
+
why: "Compacts long history streams into a synthetic checkpoint while preserving replay integrity.",
|
|
1394
|
+
examples: [
|
|
1395
|
+
"pm history-compact pm-a1b2 --dry-run",
|
|
1396
|
+
'pm history-compact pm-a1b2 --before 25 --author codex-agent --message "Compact early history"',
|
|
1397
|
+
"pm history-compact pm-a1b2 --before 2026-06-01T00:00:00.000Z"
|
|
1398
|
+
]
|
|
1399
|
+
},
|
|
2807
1400
|
activity: {
|
|
2808
1401
|
why: "Reviews recent tracker-wide activity across items.",
|
|
2809
1402
|
examples: [
|
|
@@ -2937,6 +1530,15 @@ var HELP_BY_COMMAND_PATH = {
|
|
|
2937
1530
|
why: "Reports tracker-level totals and distribution by type/status.",
|
|
2938
1531
|
examples: ["pm stats", "pm stats --json"]
|
|
2939
1532
|
},
|
|
1533
|
+
telemetry: {
|
|
1534
|
+
why: "Inspects and manages local telemetry queue/runtime state for observability diagnostics.",
|
|
1535
|
+
examples: [
|
|
1536
|
+
"pm telemetry status",
|
|
1537
|
+
"pm telemetry stats --limit 10",
|
|
1538
|
+
"pm telemetry flush",
|
|
1539
|
+
"pm telemetry clear"
|
|
1540
|
+
]
|
|
1541
|
+
},
|
|
2940
1542
|
health: {
|
|
2941
1543
|
why: "Validates tracker/runtime health including extension triage, migration, and integrity diagnostics.",
|
|
2942
1544
|
examples: [
|
|
@@ -3102,7 +1704,7 @@ function renderPmCommand(argv) {
|
|
|
3102
1704
|
!(function() {
|
|
3103
1705
|
try {
|
|
3104
1706
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
3105
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
1707
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "004f0f48-f016-51b6-b587-30101f5bb77f");
|
|
3106
1708
|
} catch (e2) {
|
|
3107
1709
|
}
|
|
3108
1710
|
})();
|
|
@@ -3163,6 +1765,19 @@ function normalizeRecoveryPayload(payload) {
|
|
|
3163
1765
|
if (typeof payload.suggested_retry === "string" && payload.suggested_retry.trim().length > 0) {
|
|
3164
1766
|
normalized.suggested_retry = payload.suggested_retry.trim();
|
|
3165
1767
|
}
|
|
1768
|
+
if (Array.isArray(payload.fallback_candidates)) {
|
|
1769
|
+
const fallbackCandidates = payload.fallback_candidates.map((entry) => ({
|
|
1770
|
+
source: typeof entry?.source === "string" ? entry.source.trim() : "",
|
|
1771
|
+
command: typeof entry?.command === "string" ? entry.command.trim() : "",
|
|
1772
|
+
reason: typeof entry?.reason === "string" ? entry.reason.trim() : ""
|
|
1773
|
+
})).filter((entry) => entry.source.length > 0 && entry.command.length > 0 && entry.reason.length > 0);
|
|
1774
|
+
if (fallbackCandidates.length > 0) {
|
|
1775
|
+
normalized.fallback_candidates = fallbackCandidates;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
if (typeof payload.next_best_command === "string" && payload.next_best_command.trim().length > 0) {
|
|
1779
|
+
normalized.next_best_command = payload.next_best_command.trim();
|
|
1780
|
+
}
|
|
3166
1781
|
return Object.keys(normalized).length > 0 ? normalized : void 0;
|
|
3167
1782
|
}
|
|
3168
1783
|
function renderRecoveryBundle(recovery) {
|
|
@@ -3186,6 +1801,15 @@ function renderRecoveryBundle(recovery) {
|
|
|
3186
1801
|
if (normalized.suggested_retry) {
|
|
3187
1802
|
lines.push(` suggested_retry: ${normalized.suggested_retry}`);
|
|
3188
1803
|
}
|
|
1804
|
+
if (normalized.next_best_command) {
|
|
1805
|
+
lines.push(` next_best_command: ${normalized.next_best_command}`);
|
|
1806
|
+
}
|
|
1807
|
+
if (normalized.fallback_candidates && normalized.fallback_candidates.length > 0) {
|
|
1808
|
+
lines.push(" fallback_candidates:");
|
|
1809
|
+
for (const candidate of normalized.fallback_candidates) {
|
|
1810
|
+
lines.push(` - ${candidate.source}: ${candidate.command} (${candidate.reason})`);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
3189
1813
|
return lines;
|
|
3190
1814
|
}
|
|
3191
1815
|
function renderGuidanceMessage(message) {
|
|
@@ -3737,7 +2361,7 @@ function createLazyModule(importer) {
|
|
|
3737
2361
|
!(function() {
|
|
3738
2362
|
try {
|
|
3739
2363
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
3740
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
2364
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b2d550e5-da06-5832-85f4-a3c40208d78d");
|
|
3741
2365
|
} catch (e2) {
|
|
3742
2366
|
}
|
|
3743
2367
|
})();
|
|
@@ -3876,7 +2500,8 @@ function collectExtensionCommandHelpDescriptors(commandHandlers, commandDefiniti
|
|
|
3876
2500
|
flags: [],
|
|
3877
2501
|
source: {
|
|
3878
2502
|
layer: definition.layer,
|
|
3879
|
-
name: definition.name
|
|
2503
|
+
name: definition.name,
|
|
2504
|
+
package: definition.source_package
|
|
3880
2505
|
}
|
|
3881
2506
|
});
|
|
3882
2507
|
}
|
|
@@ -4844,7 +3469,7 @@ async function enforceItemFormatWriteGateAndPreflightMigration(commandPath, opti
|
|
|
4844
3469
|
!(function() {
|
|
4845
3470
|
try {
|
|
4846
3471
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
4847
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
3472
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "591ae949-391a-5ede-8e92-15df7e3264df");
|
|
4848
3473
|
} catch (e2) {
|
|
4849
3474
|
}
|
|
4850
3475
|
})();
|
|
@@ -4985,6 +3610,42 @@ function resolveOptionalPackageInstallHint(commandPath) {
|
|
|
4985
3610
|
}
|
|
4986
3611
|
return `If this command comes from an optional package, install it with: pm install ${packageAlias}`;
|
|
4987
3612
|
}
|
|
3613
|
+
function normalizePackageCommandAliasToken(value) {
|
|
3614
|
+
let normalized = normalizeExtensionNameForMatch(value);
|
|
3615
|
+
for (const prefix of ["@unbraind/", "@unbrained/", "builtin-", "pm-"]) {
|
|
3616
|
+
if (normalized.startsWith(prefix)) {
|
|
3617
|
+
normalized = normalized.slice(prefix.length);
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
return normalized;
|
|
3621
|
+
}
|
|
3622
|
+
function collectInstalledPackageCommandPathHints(unknownToken, extensionDescriptors) {
|
|
3623
|
+
const normalizedUnknown = normalizePackageCommandAliasToken(unknownToken);
|
|
3624
|
+
if (normalizedUnknown.length === 0) {
|
|
3625
|
+
return [];
|
|
3626
|
+
}
|
|
3627
|
+
const hints = [];
|
|
3628
|
+
for (const descriptor of extensionDescriptors.values()) {
|
|
3629
|
+
const identifiers = /* @__PURE__ */ new Set();
|
|
3630
|
+
const source = descriptor.source;
|
|
3631
|
+
if (source) {
|
|
3632
|
+
for (const identifier of [source.name, source.package]) {
|
|
3633
|
+
const normalizedIdentifier = normalizePackageCommandAliasToken(identifier ?? "");
|
|
3634
|
+
if (normalizedIdentifier.length > 0) {
|
|
3635
|
+
identifiers.add(normalizedIdentifier);
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
if (identifiers.size === 0) {
|
|
3640
|
+
continue;
|
|
3641
|
+
}
|
|
3642
|
+
const matches = [...identifiers].some((identifier) => identifier === normalizedUnknown || identifier.includes(normalizedUnknown) || normalizedUnknown.includes(identifier));
|
|
3643
|
+
if (matches) {
|
|
3644
|
+
hints.push(descriptor.command);
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
return [...new Set(hints)].sort((left, right) => left.localeCompare(right));
|
|
3648
|
+
}
|
|
4988
3649
|
function collectKnownLongFlags(commandName) {
|
|
4989
3650
|
const flags = /* @__PURE__ */ new Set();
|
|
4990
3651
|
const contracts = resolveSubcommandFlagContractsForCommand(commandName);
|
|
@@ -5122,11 +3783,12 @@ function buildUnknownCommandGuidanceFromRuntime(rawMessage, root, extensionDescr
|
|
|
5122
3783
|
return left.commandPath.localeCompare(right.commandPath);
|
|
5123
3784
|
}).map((entry) => entry.commandPath);
|
|
5124
3785
|
const aliasCandidates = (COMMON_COMMAND_ALIASES[primaryToken] ?? []).filter((aliasPath) => commandPaths.includes(aliasPath));
|
|
5125
|
-
const
|
|
3786
|
+
const installedPackageCandidates = collectInstalledPackageCommandPathHints(primaryToken, extensionDescriptors).filter((commandPath) => commandPaths.includes(commandPath));
|
|
3787
|
+
const combinedCandidates = dedupeStrings2([...aliasCandidates, ...rankedCandidates, ...installedPackageCandidates]);
|
|
5126
3788
|
const fallbackTopLevel = [...new Set(commandPaths.map((commandPath) => commandPath.split(" ")[0]).filter((segment) => segment.length > 0))];
|
|
5127
3789
|
fallbackTopLevel.sort((left, right) => left.localeCompare(right));
|
|
5128
3790
|
const suggestedPaths = (combinedCandidates.length > 0 ? combinedCandidates : fallbackTopLevel).slice(0, 3);
|
|
5129
|
-
const examples = [.../* @__PURE__ */ new Set(["pm --help", ...suggestedPaths.map((
|
|
3791
|
+
const examples = [.../* @__PURE__ */ new Set(["pm --help", ...suggestedPaths.map((path3) => `pm ${path3} --help`)])];
|
|
5130
3792
|
const optionalPackageHint = resolveOptionalPackageInstallHint(normalizedUnknown);
|
|
5131
3793
|
const didYouMean = combinedCandidates.length > 0 ? `Did you mean: ${combinedCandidates.slice(0, 3).join(", ")}?` : null;
|
|
5132
3794
|
return {
|
|
@@ -5142,6 +3804,27 @@ function buildUnknownCommandGuidanceFromRuntime(rawMessage, root, extensionDescr
|
|
|
5142
3804
|
function dedupeStrings2(values) {
|
|
5143
3805
|
return Array.from(new Set(values));
|
|
5144
3806
|
}
|
|
3807
|
+
function firstWhitespaceSeparatedToken(input2) {
|
|
3808
|
+
let token = "";
|
|
3809
|
+
for (const character of input2) {
|
|
3810
|
+
if (character === " " || character === " " || character === "\n" || character === "\r" || character === "\f" || character === "\v") {
|
|
3811
|
+
break;
|
|
3812
|
+
}
|
|
3813
|
+
token += character;
|
|
3814
|
+
}
|
|
3815
|
+
return token;
|
|
3816
|
+
}
|
|
3817
|
+
function trimTrailingPunctuationToken(token) {
|
|
3818
|
+
let end = token.length;
|
|
3819
|
+
while (end > 0) {
|
|
3820
|
+
const character = token[end - 1];
|
|
3821
|
+
if (character !== "," && character !== ":" && character !== ";") {
|
|
3822
|
+
break;
|
|
3823
|
+
}
|
|
3824
|
+
end -= 1;
|
|
3825
|
+
}
|
|
3826
|
+
return token.slice(0, end);
|
|
3827
|
+
}
|
|
5145
3828
|
function resolveChildCommandByToken(parent, token) {
|
|
5146
3829
|
const normalizedToken = token.trim().toLowerCase();
|
|
5147
3830
|
return parent.commands.find((candidate) => {
|
|
@@ -5204,7 +3887,7 @@ async function resolveCommanderUsageContext(error, rootProgram, extensionDescrip
|
|
|
5204
3887
|
}
|
|
5205
3888
|
if (!suggestedRetryCommand) {
|
|
5206
3889
|
const missingRequiredOption = message.match(/required option '([^']+)' not specified/i);
|
|
5207
|
-
const requiredOptionToken = missingRequiredOption?.[1]
|
|
3890
|
+
const requiredOptionToken = missingRequiredOption?.[1] ? trimTrailingPunctuationToken(firstWhitespaceSeparatedToken(missingRequiredOption[1].trim())) : void 0;
|
|
5208
3891
|
if (requiredOptionToken?.startsWith("--")) {
|
|
5209
3892
|
const hasFlag = invocationArgv.some((token) => token.startsWith(requiredOptionToken));
|
|
5210
3893
|
if (!hasFlag) {
|
|
@@ -5541,7 +4224,7 @@ function attachCreateUpdatePolicyHelpText(rootProgram, typeRegistry, argv) {
|
|
|
5541
4224
|
!(function() {
|
|
5542
4225
|
try {
|
|
5543
4226
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
5544
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
4227
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "2b36a331-5896-50c4-a43a-b885bd2ad354");
|
|
5545
4228
|
} catch (e2) {
|
|
5546
4229
|
}
|
|
5547
4230
|
})();
|
|
@@ -5580,10 +4263,10 @@ var EXPECTED_HANDLED_ERROR_EXIT_CODES = /* @__PURE__ */ new Set([
|
|
|
5580
4263
|
EXIT_CODE.CONFLICT
|
|
5581
4264
|
]);
|
|
5582
4265
|
var TRUE_LIKE_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
5583
|
-
var loadSetupRegistrationModule = createLazyModule(() => import("./chunks/register-setup-
|
|
5584
|
-
var loadListQueryRegistrationModule = createLazyModule(() => import("./chunks/register-list-query-
|
|
5585
|
-
var loadMutationRegistrationModule = createLazyModule(() => import("./chunks/register-mutation-
|
|
5586
|
-
var loadOperationRegistrationModule = createLazyModule(() => import("./chunks/register-operations-
|
|
4266
|
+
var loadSetupRegistrationModule = createLazyModule(() => import("./chunks/register-setup-EJY44FPH.js"));
|
|
4267
|
+
var loadListQueryRegistrationModule = createLazyModule(() => import("./chunks/register-list-query-OECMHO4G.js"));
|
|
4268
|
+
var loadMutationRegistrationModule = createLazyModule(() => import("./chunks/register-mutation-5GPDEKHR.js"));
|
|
4269
|
+
var loadOperationRegistrationModule = createLazyModule(() => import("./chunks/register-operations-GQKT35H5.js"));
|
|
5587
4270
|
function describeUnknownError(error) {
|
|
5588
4271
|
if (error instanceof PmCliError) {
|
|
5589
4272
|
return error.message;
|
|
@@ -5656,7 +4339,9 @@ function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
|
|
|
5656
4339
|
normalized_args: existingRecovery?.normalized_args ?? [...invocationArgv],
|
|
5657
4340
|
provided_fields: existingRecovery?.provided_fields ?? (providedFields.length > 0 ? providedFields : void 0),
|
|
5658
4341
|
missing: existingRecovery?.missing ?? inferredMissing,
|
|
5659
|
-
...suggestedRetry ? { suggested_retry: suggestedRetry } : {}
|
|
4342
|
+
...suggestedRetry ? { suggested_retry: suggestedRetry } : {},
|
|
4343
|
+
...existingRecovery?.fallback_candidates ? { fallback_candidates: existingRecovery.fallback_candidates } : {},
|
|
4344
|
+
...existingRecovery?.next_best_command ? { next_best_command: existingRecovery.next_best_command } : {}
|
|
5660
4345
|
};
|
|
5661
4346
|
return {
|
|
5662
4347
|
...context ?? {},
|
|
@@ -5722,7 +4407,7 @@ function normalizeTelemetryResolutionStage(value) {
|
|
|
5722
4407
|
}
|
|
5723
4408
|
return normalized;
|
|
5724
4409
|
}
|
|
5725
|
-
function
|
|
4410
|
+
function normalizeTelemetryErrorCategory(value) {
|
|
5726
4411
|
if (!value) {
|
|
5727
4412
|
return void 0;
|
|
5728
4413
|
}
|
|
@@ -5788,12 +4473,12 @@ function buildPostActionTelemetryOutcome() {
|
|
|
5788
4473
|
const resultExitCode = readRecordNumber(result, "exit_code", "exitCode");
|
|
5789
4474
|
const exitCode = processExitCode ?? resultExitCode ?? EXIT_CODE.SUCCESS;
|
|
5790
4475
|
const ok = exitCode === EXIT_CODE.SUCCESS;
|
|
5791
|
-
const
|
|
5792
|
-
const errorCategory =
|
|
4476
|
+
const errorCode = readRecordString(result, "error_code", "errorCode") ?? inferPostActionErrorCode(ok, exitCode);
|
|
4477
|
+
const errorCategory = normalizeTelemetryErrorCategory(readRecordString(result, "error_category", "errorCategory")) ?? (!ok ? resolveTelemetryErrorCategory(errorCode) : void 0);
|
|
5793
4478
|
const errorMessage = !ok ? inferPostActionFailureMessage(result) ?? `command_exit_${exitCode}` : void 0;
|
|
5794
4479
|
const commandResolution = normalizeTelemetryCommandResolution(readRecordString(result, "command_resolution", "commandResolution")) ?? deriveTelemetryCommandResolution({
|
|
5795
4480
|
ok,
|
|
5796
|
-
errorCode
|
|
4481
|
+
errorCode,
|
|
5797
4482
|
errorCategory
|
|
5798
4483
|
});
|
|
5799
4484
|
const resolutionStage = normalizeTelemetryResolutionStage(readRecordString(result, "resolution_stage", "resolutionStage")) ?? "execute";
|
|
@@ -5801,7 +4486,7 @@ function buildPostActionTelemetryOutcome() {
|
|
|
5801
4486
|
ok,
|
|
5802
4487
|
error: errorMessage,
|
|
5803
4488
|
exit_code: exitCode,
|
|
5804
|
-
error_code:
|
|
4489
|
+
error_code: errorCode,
|
|
5805
4490
|
error_category: errorCategory,
|
|
5806
4491
|
command_resolution: commandResolution,
|
|
5807
4492
|
resolution_stage: resolutionStage
|
|
@@ -6264,14 +4949,6 @@ async function loadRuntimeExtensionDiscoverySnapshot(pmRoot) {
|
|
|
6264
4949
|
if (runtimeExtensionDiscoverySnapshotCache?.key === cacheKey) {
|
|
6265
4950
|
return runtimeExtensionDiscoverySnapshotCache.snapshot;
|
|
6266
4951
|
}
|
|
6267
|
-
const settingsPath = getSettingsPath(pmRoot);
|
|
6268
|
-
if (!await pathExists(settingsPath)) {
|
|
6269
|
-
runtimeExtensionDiscoverySnapshotCache = {
|
|
6270
|
-
key: cacheKey,
|
|
6271
|
-
snapshot: null
|
|
6272
|
-
};
|
|
6273
|
-
return null;
|
|
6274
|
-
}
|
|
6275
4952
|
try {
|
|
6276
4953
|
const startedAt = Date.now();
|
|
6277
4954
|
const { settings, warnings: settingsReadWarnings } = await readSettingsWithMetadata(pmRoot);
|
|
@@ -6306,14 +4983,6 @@ async function loadRuntimeExtensionSnapshot(pmRoot) {
|
|
|
6306
4983
|
if (runtimeExtensionSnapshotCache?.key === cacheKey) {
|
|
6307
4984
|
return runtimeExtensionSnapshotCache.snapshot;
|
|
6308
4985
|
}
|
|
6309
|
-
const settingsPath = getSettingsPath(pmRoot);
|
|
6310
|
-
if (!await pathExists(settingsPath)) {
|
|
6311
|
-
runtimeExtensionSnapshotCache = {
|
|
6312
|
-
key: cacheKey,
|
|
6313
|
-
snapshot: null
|
|
6314
|
-
};
|
|
6315
|
-
return null;
|
|
6316
|
-
}
|
|
6317
4986
|
try {
|
|
6318
4987
|
const settings = await readSettings(pmRoot);
|
|
6319
4988
|
const loadResult = await loadExtensions({
|
|
@@ -6400,6 +5069,10 @@ async function maybeLoadRuntimeExtensions(command) {
|
|
|
6400
5069
|
pmRoot
|
|
6401
5070
|
};
|
|
6402
5071
|
}
|
|
5072
|
+
async function loadRuntimeExtensionCommandDescriptorsForRecovery(pmRoot) {
|
|
5073
|
+
const snapshot = await loadRuntimeExtensionSnapshot(pmRoot);
|
|
5074
|
+
return snapshot ? new Map(snapshot.commandDescriptors) : activeRuntimeExtensionCommandDescriptors;
|
|
5075
|
+
}
|
|
6403
5076
|
async function executeRegisteredRuntimeMigrations(migrations, pmRoot) {
|
|
6404
5077
|
const warnings = [];
|
|
6405
5078
|
for (let index = 0; index < migrations.length; index += 1) {
|
|
@@ -6665,7 +5338,7 @@ async function registerDynamicExtensionCommandPaths(rootProgram, invocationArgv)
|
|
|
6665
5338
|
}
|
|
6666
5339
|
function resolveCliVersion2() {
|
|
6667
5340
|
try {
|
|
6668
|
-
const packageJsonPath =
|
|
5341
|
+
const packageJsonPath = path2.join(resolvePmPackageRoot(), "package.json");
|
|
6669
5342
|
const raw = fs2.readFileSync(packageJsonPath, "utf8");
|
|
6670
5343
|
const parsed = JSON.parse(raw);
|
|
6671
5344
|
return typeof parsed.version === "string" ? parsed.version : "0.0.0";
|
|
@@ -7188,7 +5861,8 @@ async function runPmCli(rawArgv = process.argv.slice(2)) {
|
|
|
7188
5861
|
if (helpRequest.requested && !isKnownHelpCommandPath(program, helpRequest.commandPathTokens)) {
|
|
7189
5862
|
const unknownToken = helpRequest.commandPathTokens[0] ?? parseBootstrapCommandName(invocationArgv) ?? "<command>";
|
|
7190
5863
|
const unknownMessage = `unknown command '${unknownToken}'`;
|
|
7191
|
-
const
|
|
5864
|
+
const recoveryCommandDescriptors = await loadRuntimeExtensionCommandDescriptorsForRecovery(resolvePmRoot(process.cwd(), bootstrapGlobal.path));
|
|
5865
|
+
const usageContext = await resolveCommanderUsageContext({ message: unknownMessage }, program, recoveryCommandDescriptors);
|
|
7192
5866
|
const classification2 = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
|
|
7193
5867
|
unknownCommandExamples: usageContext.unknownCommandExamples,
|
|
7194
5868
|
unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
|
|
@@ -7219,7 +5893,7 @@ async function runPmCli(rawArgv = process.argv.slice(2)) {
|
|
|
7219
5893
|
resolution_stage: "parse",
|
|
7220
5894
|
source_context: activeTelemetryCommandContext?.source_context
|
|
7221
5895
|
});
|
|
7222
|
-
const renderedUsage = jsonErrors ? await formatCommanderUsageJson({ message: unknownMessage }, program,
|
|
5896
|
+
const renderedUsage = jsonErrors ? await formatCommanderUsageJson({ message: unknownMessage }, program, recoveryCommandDescriptors) : await formatCommanderUsageMessage({ message: unknownMessage }, program, recoveryCommandDescriptors);
|
|
7223
5897
|
sentryFinishCommandSpan(false, unknownMessage, {
|
|
7224
5898
|
error_code: classification2.code,
|
|
7225
5899
|
error_category: errorCategory2,
|
|
@@ -7377,6 +6051,7 @@ async function runPmCli(rawArgv = process.argv.slice(2)) {
|
|
|
7377
6051
|
}
|
|
7378
6052
|
}
|
|
7379
6053
|
var _testOnly = {
|
|
6054
|
+
buildPmCliRecoveryContext,
|
|
7380
6055
|
isCommanderError,
|
|
7381
6056
|
normalizeThrownExitCode,
|
|
7382
6057
|
readThrownExitCode,
|