@herbertgao/pi-extensions 2026.11.6 → 2026.11.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 +9 -0
- package/README.md +6 -6
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +71 -56
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts +1 -4
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +5620 -2946
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/package.json +11 -11
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +5 -0
- package/node_modules/pi-commandcode-provider/README.md +1 -1
- package/node_modules/pi-commandcode-provider/package.json +1 -1
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +5 -4
- package/node_modules/pi-commandcode-provider/src/pricing.ts +8 -2
- package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
- package/node_modules/pi-lens/CHANGELOG.md +182 -0
- package/node_modules/pi-lens/dist/{chunk-NE4EFHJX.js → chunk-2SD2CGVH.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7JX3RNG4.js → chunk-34RXPR7M.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-2LVJQU3I.js → chunk-3C6ZZAB2.js} +33 -27
- package/node_modules/pi-lens/dist/{chunk-WAA63ZJV.js → chunk-3HZ6MNB2.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-IDCTDKIA.js → chunk-3NVGBFJS.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-B2YUE6YD.js → chunk-3QCI3V6C.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-NL5LSKVD.js → chunk-3R3Z54J7.js} +10 -4
- package/node_modules/pi-lens/dist/{chunk-7WJ55KBN.js → chunk-43KD3PPM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-DVRJBQOJ.js → chunk-4HNBY7S7.js} +20 -19
- package/node_modules/pi-lens/dist/chunk-4WWPDMRA.js +22 -0
- package/node_modules/pi-lens/dist/{chunk-QL37SGTS.js → chunk-532X3OCZ.js} +18 -16
- package/node_modules/pi-lens/dist/{chunk-ZZDVGCGG.js → chunk-5RLEDUUE.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-GUGKKGG7.js → chunk-5YTDZ5WP.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-FOEPIX76.js → chunk-6EIV3H7O.js} +158 -61
- package/node_modules/pi-lens/dist/{chunk-E4VXKTBR.js → chunk-6K4X7IIF.js} +164 -172
- package/node_modules/pi-lens/dist/{chunk-HSYFLOZY.js → chunk-6RXMQYNU.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-K6WIBVMK.js → chunk-6XNVY3FW.js} +8 -9
- package/node_modules/pi-lens/dist/{chunk-ACRJ2GZ5.js → chunk-7424ANRU.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-PTSA6QKL.js → chunk-A4HKPAEN.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-RQRKIRFY.js → chunk-AFNPNHJV.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-3FRI5H4T.js → chunk-AGEQRJ5A.js} +24 -10
- package/node_modules/pi-lens/dist/{chunk-MAD4QJTP.js → chunk-AJ62EQIQ.js} +15 -14
- package/node_modules/pi-lens/dist/{chunk-FCQSZQAT.js → chunk-AOQKQWZU.js} +14 -5
- package/node_modules/pi-lens/dist/{chunk-ZOPXB2KK.js → chunk-AVOUHMCS.js} +111 -107
- package/node_modules/pi-lens/dist/{chunk-OTSTS7L2.js → chunk-AYDE7RFV.js} +34 -3
- package/node_modules/pi-lens/dist/{chunk-AWQWXSW4.js → chunk-B4FAFEBP.js} +7 -2
- package/node_modules/pi-lens/dist/{chunk-SKVNHCT5.js → chunk-B4K6OSLL.js} +49 -42
- package/node_modules/pi-lens/dist/{chunk-2ADRLTM2.js → chunk-BBJXIZ3X.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-BJDB7PXU.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-GTTMQ6XB.js → chunk-BLL4VYGZ.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-CZAWWXP6.js → chunk-BMMRLJA4.js} +7 -5
- package/node_modules/pi-lens/dist/{chunk-TN5CWX5D.js → chunk-BN36MQW5.js} +35 -34
- package/node_modules/pi-lens/dist/{chunk-IL6PIV33.js → chunk-C2REOMPO.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-XAFZJEXY.js → chunk-C4ICGFEO.js} +23 -23
- package/node_modules/pi-lens/dist/chunk-CIA7X2PZ.js +26 -0
- package/node_modules/pi-lens/dist/{chunk-SJQUWQR6.js → chunk-D5L7Q57Z.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-XPGH5O74.js → chunk-DBAHJFBU.js} +31 -35
- package/node_modules/pi-lens/dist/{chunk-H65TYP6V.js → chunk-DNB4ZQGN.js} +37 -21
- package/node_modules/pi-lens/dist/chunk-DPDA3ILA.js +108 -0
- package/node_modules/pi-lens/dist/{chunk-QGITU23N.js → chunk-E3PNZDPH.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-KDCIG23C.js → chunk-E6Z3CJT2.js} +13 -9
- package/node_modules/pi-lens/dist/{chunk-V7F7JHS5.js → chunk-ECYUBKYX.js} +557 -551
- package/node_modules/pi-lens/dist/chunk-F37CCZUA.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-KSTQ4VXT.js → chunk-FVEEEEIM.js} +10 -13
- package/node_modules/pi-lens/dist/{chunk-GMC4ZGYR.js → chunk-GL6J5R34.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-C6AODRNU.js → chunk-GTNO6F6K.js} +11 -10
- package/node_modules/pi-lens/dist/{chunk-KJ3AHOCK.js → chunk-HASJPQBC.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-XVB3Q2PG.js → chunk-HGEE5LDW.js} +3 -2
- package/node_modules/pi-lens/dist/{chunk-F6FT6BVQ.js → chunk-HIUVHRLM.js} +35 -34
- package/node_modules/pi-lens/dist/{chunk-BRESRQBE.js → chunk-HTUG7ZFK.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-ALIZWXHZ.js → chunk-IBEYUBCM.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-JZQGRARR.js → chunk-IJ55MYO6.js} +15 -12
- package/node_modules/pi-lens/dist/{chunk-BGLS5SDN.js → chunk-IT7MFVGP.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-AON2QIJF.js → chunk-ITAPXBIB.js} +20 -17
- package/node_modules/pi-lens/dist/{chunk-TLWFZ66Y.js → chunk-JSQK5DH3.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-VCRVNLE7.js → chunk-K2GV34T2.js} +9 -1
- package/node_modules/pi-lens/dist/{chunk-QUQY3IME.js → chunk-KBSC5Z3G.js} +9 -8
- package/node_modules/pi-lens/dist/{chunk-W4CUK5G6.js → chunk-KDGKKK7A.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-YQA34KAF.js → chunk-KDMJ2DJD.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-SG2JQ2YP.js → chunk-KNP4ENFT.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-KX4DF6XX.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-4ITEFRDH.js → chunk-LHCDWFDB.js} +37 -145
- package/node_modules/pi-lens/dist/{chunk-3HM4BUHR.js → chunk-LHU6NG5Z.js} +16 -15
- package/node_modules/pi-lens/dist/{chunk-6I44EDNQ.js → chunk-LIDFFCZZ.js} +17 -15
- package/node_modules/pi-lens/dist/{chunk-KFRDFAOE.js → chunk-LPM6NKVI.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-NBM7PNBP.js → chunk-LXE7JAMV.js} +37 -26
- package/node_modules/pi-lens/dist/{chunk-UY745U35.js → chunk-ME6MF2N2.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-YT2VR4SL.js → chunk-NLRKB32C.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-QHOTTC4A.js → chunk-NQFXN5U7.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-QUPYLQA4.js → chunk-NR4KQOXZ.js} +14 -9
- package/node_modules/pi-lens/dist/{chunk-Y3EHLUPL.js → chunk-NWK7KKNO.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-A5TEJZGJ.js → chunk-O6LCSHHI.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-CTB5BAJI.js → chunk-OC4ZGVMH.js} +17 -14
- package/node_modules/pi-lens/dist/{chunk-VPFRU5IG.js → chunk-OP5BMZKK.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-MN635QYA.js → chunk-OYXD2MOM.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-GVWIU7M7.js → chunk-PSUXESQ5.js} +41 -4
- package/node_modules/pi-lens/dist/{chunk-J6BR5XN2.js → chunk-QAM2Q3VO.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-6MDM5MQT.js → chunk-QBUSONNE.js} +367 -153
- package/node_modules/pi-lens/dist/{chunk-VGTBLTPN.js → chunk-QDZ3ZZMY.js} +18 -66
- package/node_modules/pi-lens/dist/{chunk-LT62P654.js → chunk-QJ4T73J5.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-DOUAWKLO.js → chunk-QUZYRDT6.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-UNBRHPHJ.js → chunk-R2UF54ON.js} +17 -15
- package/node_modules/pi-lens/dist/{chunk-I32RSMH6.js → chunk-R2VUZZPJ.js} +11 -10
- package/node_modules/pi-lens/dist/chunk-R5BNSOIV.js +29 -0
- package/node_modules/pi-lens/dist/chunk-RV5VX2XW.js +29 -0
- package/node_modules/pi-lens/dist/{chunk-QWTHFFU6.js → chunk-SQBDX6IO.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-CZCAZVTD.js → chunk-SRXYSLMW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-WS3UFJOU.js → chunk-SUIZOCSY.js} +3 -2
- package/node_modules/pi-lens/dist/{chunk-NUSXS6YB.js → chunk-T5EGSBM2.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-QMV2APEH.js → chunk-TBE4OLPA.js} +37 -35
- package/node_modules/pi-lens/dist/{chunk-B6HXETWY.js → chunk-TPMBNWHO.js} +28 -26
- package/node_modules/pi-lens/dist/{chunk-CYUJB552.js → chunk-TRYOYWWU.js} +18 -12
- package/node_modules/pi-lens/dist/{chunk-TJQSYX3J.js → chunk-TTGDTNSN.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-S3WFVG5P.js → chunk-UELHWF5I.js} +137 -126
- package/node_modules/pi-lens/dist/chunk-UG4YLCJ5.js +58 -0
- package/node_modules/pi-lens/dist/chunk-UQ6OZYTO.js +91 -0
- package/node_modules/pi-lens/dist/{chunk-QSCZAP24.js → chunk-UY3WWW5R.js} +4 -4
- package/node_modules/pi-lens/dist/chunk-V7IPIAE5.js +74 -0
- package/node_modules/pi-lens/dist/{chunk-4NCDHTFI.js → chunk-VDMF7Q2P.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-TYHOEX4V.js → chunk-VI3BJMZO.js} +35 -34
- package/node_modules/pi-lens/dist/{chunk-UOO4D2TK.js → chunk-VTXJAO5R.js} +34 -35
- package/node_modules/pi-lens/dist/chunk-W6VLB6LL.js +145 -0
- package/node_modules/pi-lens/dist/{chunk-NPNFGYLV.js → chunk-WBXCIRVI.js} +19 -2
- package/node_modules/pi-lens/dist/{chunk-CB7PEVOJ.js → chunk-WLD6BGON.js} +176 -60
- package/node_modules/pi-lens/dist/{chunk-Q2VCKC3X.js → chunk-WMCAEP2K.js} +11 -8
- package/node_modules/pi-lens/dist/{chunk-OPFNQBS5.js → chunk-WXMUGUZV.js} +21 -25
- package/node_modules/pi-lens/dist/{chunk-46TQJSUE.js → chunk-X33QECRJ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-HILZE4BQ.js → chunk-YUF4DRYB.js} +396 -306
- package/node_modules/pi-lens/dist/{chunk-YF4G5NN5.js → chunk-YVPB5YGO.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-W7TY6HYX.js → chunk-ZRQMENT4.js} +5 -27
- package/node_modules/pi-lens/dist/index.js +5573 -4181
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +17 -11
- package/node_modules/pi-lens/dist/mcp/cli.js +43 -42
- package/node_modules/pi-lens/dist/mcp/server.js +1521 -610
- package/node_modules/pi-lens/dist/mcp/worker.js +62 -59
- package/node_modules/pi-lens/dist/probes/installer.js +19 -18
- package/node_modules/pi-lens/docs/agent-guide.md +3 -1
- package/node_modules/pi-lens/docs/agent-tools.md +4 -2
- package/node_modules/pi-lens/docs/alignment-families.md +5 -1
- package/node_modules/pi-lens/docs/ci.md +120 -0
- package/node_modules/pi-lens/docs/configuration.md +21 -3
- package/node_modules/pi-lens/docs/custom-rules.md +1 -0
- package/node_modules/pi-lens/docs/defect-shapes.md +107 -71
- package/node_modules/pi-lens/docs/durable-store-audit-1202.md +1 -1
- package/node_modules/pi-lens/docs/engineering-principles.md +46 -12
- package/node_modules/pi-lens/docs/environment-variables.md +25 -2
- package/node_modules/pi-lens/docs/features.md +1 -1
- package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -0
- package/node_modules/pi-lens/docs/language-coverage.md +1 -1
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +15 -16
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
- package/node_modules/pi-lens/docs/module-report-read-symbol.md +2 -2
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +3 -2
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -0
- package/node_modules/pi-lens/docs/pi-lens-monitor.md +4 -1
- package/node_modules/pi-lens/docs/pi-lens-release.md +19 -0
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +8 -2
- package/node_modules/pi-lens/docs/public-api-stability.md +41 -6
- package/node_modules/pi-lens/docs/rfcs/5138-query-surface.md +121 -0
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/docs/settings.md +9 -0
- package/node_modules/pi-lens/docs/word-index.md +9 -10
- package/node_modules/pi-lens/package.json +3 -3
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/README.md +2 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/dont-call-system-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/file-access-before-action-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/file-stat-before-action-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/insecure-hash-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/libxml2-audit-parser-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/null-library-function-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/sizeof-this-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/small-key-size-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/world-writable-file-c.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/dont-call-system-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/file-access-before-action-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/file-stat-before-action-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/fix-format-security-error-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/insecure-hash-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/libxml2-audit-parser-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/missing-nul-cpp-string-memcpy-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/null-library-function-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/return-c-str-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/sizeof-this-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/small-key-size-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/std-return-data-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/std-vector-invalidation-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/string-view-temporary-string-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/world-writable-file-cpp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/httponly-false-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/insecure-binaryformatter-deserialization-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-decode-without-verify-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-hardcoded-secret-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-tokenvalidationparameters-no-expiry-validation-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/networkcredential-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/npgsqlconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/oracleconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/sqlconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/stacktrace-disclosure-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/use-ecb-mode-csharp.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/avoid-bind-to-all-interfaces-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/gorilla-cookie-store-hardcoded-session-key-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/gorilla-csrf-hardcoded-auth-key-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/grpc-client-insecure-connection-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/jwt-go-none-algorithm-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/missing-ssl-minversion-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/openai-empty-secret-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/openai-hardcoded-secret-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/ssl-v3-is-insecure-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/tls-with-insecure-cipher-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/use-of-weak-rsa-key-go.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/html/security/plaintext-http-link-html.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cbc-padding-oracle-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-httponly-false-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-httponly-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-samesite-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-secure-flag-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-secure-flag-false-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/datanucleus-hardcoded-connection-password-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/des-is-deprecated-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/desede-is-deprecated-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-disallow-doctype-decl-false-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-external-general-entities-true-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-external-parameter-entities-true-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/drivermanager-hardcoded-secret-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/ecb-cipher-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/hardcoded-connection-password-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/hardcoded-secret-in-credentials-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/java-jwt-hardcoded-secret-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/jedis-jedisclientconfig-hardcoded-password-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/jedis-jedisfactory-hardcoded-password-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/missing-httponly-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/missing-secure-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/no-null-cipher-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/passwordauthentication-hardcoded-password-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/rsa-no-padding-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/simple-command-injection-direct-input-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/system-setproperty-hardcoded-secret-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/unencrypted-socket-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-aes-ecb-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-blowfish-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-default-aes-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-md5-digest-utils-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-md5-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-rc2-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-rc4-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-sha1-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/weak-ssl-context-java.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/detect-angular-sce-disabled-javascript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/express-jwt-hardcoded-secret-javascript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/express-session-hardcoded-secret-javascript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/jwt-simple-noverify-javascript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-rsa-weak-key-javascript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-sequelize-empty-password-argument-javascript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-sequelize-hardcoded-secret-argument-javascript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/des-is-deprecated-kotlin.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/desede-is-deprecated-kotlin.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/jwt-hardcode-kotlin.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/rsa-no-padding-kotlin.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/system-setproperty-hardcoded-secret-kotlin.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/php/security/openssl-cbc-static-iv-php.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/php/security/search-active-debug-php.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/avoid-mktemp-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/avoid_app_run_with_bad_host-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/debug-enabled-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/hashids-with-django-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/hashids-with-flask-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/insecure-cipher-algorithm-rc4-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/jwt-python-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/openai-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-cassandra-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-cassandra-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-couchbase-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-couchbase-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-elasticsearch-hardcoded-bearer-auth-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-ldap3-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-ldap3-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mariadb-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mariadb-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysql-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysql-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysqlclient-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysqlclient-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-neo4j-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-neo4j-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-mysql-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-mysql-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-pg-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-pg-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pg8000-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pg8000-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-psycopg2-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-psycopg2-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pyjwt-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymongo-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymongo-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymssql-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymssql-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymysql-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymysql-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-redis-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-redis-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-oauth-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-tormysql-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-tormysql-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-urllib3-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-webrepl-empty-password-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-webrepl-hardcoded-secret-python.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/force-ssl-false-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/hardcoded-http-auth-in-controller-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/hardcoded-secret-rsa-passphrase-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/insufficient-rsa-key-size-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-aws-sdk-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-cassandra-empty-password-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-cassandra-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-excon-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-faraday-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mongo-empty-password-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mongo-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mysql2-empty-password-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mysql2-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-octokit-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-pg-empty-password-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-pg-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-redis-empty-password-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-redis-hardcoded-secret-ruby.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/empty-password-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/hardcoded-password-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/postgres-empty-password-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/reqwest-accept-invalid-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/secrets-reqwest-hardcoded-auth-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/ssl-verify-none-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/tokio-postgres-empty-password-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/tokio-postgres-hardcoded-password-rust.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/scala/security/jwt-scala-hardcode-scala.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/scala/security/scala-jwt-hardcoded-secret-scala.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/aes-hardcoded-secret-swift.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/blowfish-hardcoded-secret-swift.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/chacha20-hardcoded-secret-swift.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/insecure-biometrics-swift.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/rabbit-hardcoded-secret-swift.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/detect-angular-sce-disabled-typescript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/express-session-hardcoded-secret-typescript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/jwt-simple-noverify-typescript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-rsa-weak-key-typescript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-sequelize-empty-password-argument-typescript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-sequelize-hardcoded-secret-argument-typescript.yml +2 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-schema.json +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/c-no-malloc-free.yml +13 -12
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-malloc-free.yml +11 -10
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-printf.yml +10 -9
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-defer-func-call-antipattern.yml +14 -13
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-fmt-println.yml +14 -13
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-panic-in-lib.yml +20 -19
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-underscore-func-name.yml +14 -13
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-errors-is.yml +14 -13
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-string-builder.yml +19 -18
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-test-functions.yml +14 -13
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/hyphenated-svg-attribute.yml +10 -9
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-lateinit.yml +12 -11
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-nullable-boolean.yml +11 -10
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-println.yml +15 -14
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unnecessary-let.yml +10 -9
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unsafe-cast.yml +10 -9
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-var.yml +11 -10
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-data-class.yml +10 -9
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-is-empty.yml +10 -9
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-aws-access-key-literal.yml +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-compile-call.yml +13 -12
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-flask-secret-key-literal.yml +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-hardcoded-password.yml +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-marshal-load.yml +12 -11
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-python-sql-string-concat.yml +12 -11
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-requests-verify-false.yml +13 -12
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-secret-in-env-var-name.yml +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/python-optional-type.yml +9 -8
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/reducible-list-comprehension.yml +8 -7
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/ruby-detect-path-traversal.yml +14 -13
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/ruby-symbol-to-proc-candidate.yml +8 -7
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/rust-no-chars-enumerate.yml +9 -8
- package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/gorm-unbounded-preload.yml +7 -6
- package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/shadow-err-variable.yml +6 -5
- package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +262 -3
- package/node_modules/pi-lens/scripts/lib/latency-log-phases.mjs +125 -0
- package/package.json +6 -6
- package/node_modules/pi-lens/dist/chunk-3QWVOBZJ.js +0 -73
- package/node_modules/pi-lens/dist/chunk-BDR5MEZY.js +0 -25
- package/node_modules/pi-lens/dist/chunk-DBS736MA.js +0 -57
- package/node_modules/pi-lens/dist/chunk-I74RQGKA.js +0 -88
- package/node_modules/pi-lens/dist/chunk-IK4YS3KC.js +0 -25
- package/node_modules/pi-lens/dist/chunk-JKOZ2Z4U.js +0 -20
- package/node_modules/pi-lens/dist/chunk-TQHOKMVZ.js +0 -28
- package/node_modules/pi-lens/dist/chunk-VS2L7QDI.js +0 -25
- package/node_modules/pi-lens/dist/chunk-ZPFLHB3R.js +0 -28
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
deadCodeIssues,
|
|
8
8
|
formatDeadCodeDelta,
|
|
9
9
|
stableFindingKey
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-IBEYUBCM.js";
|
|
11
11
|
import {
|
|
12
12
|
clearFormatterCache
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-VTXJAO5R.js";
|
|
14
14
|
import {
|
|
15
15
|
findNearestProjectRoot,
|
|
16
16
|
isStartupScanVerdictFresh,
|
|
17
17
|
resolveStartupScanContext
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-WMCAEP2K.js";
|
|
19
19
|
import {
|
|
20
20
|
loadCallGraph
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-QAM2Q3VO.js";
|
|
22
22
|
import {
|
|
23
23
|
isHardFailureSummary
|
|
24
24
|
} from "../chunk-7U2IDNXN.js";
|
|
@@ -28,15 +28,15 @@ import {
|
|
|
28
28
|
isCompletedPassResult,
|
|
29
29
|
isExcludedTestTarget,
|
|
30
30
|
isRunnerErrorResult
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-QUZYRDT6.js";
|
|
32
32
|
import {
|
|
33
33
|
GovulncheckClient
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-A4HKPAEN.js";
|
|
35
35
|
import {
|
|
36
36
|
GitleaksClient,
|
|
37
37
|
classifyAndFilterFindings
|
|
38
|
-
} from "../chunk-
|
|
39
|
-
import "../chunk-
|
|
38
|
+
} from "../chunk-TRYOYWWU.js";
|
|
39
|
+
import "../chunk-PSUXESQ5.js";
|
|
40
40
|
import {
|
|
41
41
|
resetManagedToolRefreshSession
|
|
42
42
|
} from "../chunk-UXVNL3D7.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
peekTurnEndFindings,
|
|
56
56
|
snapshotAdvisoryProvenance,
|
|
57
57
|
validateAdvisoryProvenance
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-BMMRLJA4.js";
|
|
59
59
|
import {
|
|
60
60
|
CacheManager,
|
|
61
61
|
DEFAULT_MAX_AGE_MS,
|
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
evaluateAstGrepRules,
|
|
86
86
|
evaluateRules,
|
|
87
87
|
filterFindingsByDisposition,
|
|
88
|
+
findingClassKey,
|
|
88
89
|
forgetCascadePendingNeighbor,
|
|
89
90
|
formatCacheAgeLabel,
|
|
90
91
|
formatCascadeNeighborDiagnostics,
|
|
@@ -106,7 +107,6 @@ import {
|
|
|
106
107
|
owedByContentOnly,
|
|
107
108
|
peekOutstandingCascadeTouches,
|
|
108
109
|
pendingRunnerFindingsSize,
|
|
109
|
-
readFileContent,
|
|
110
110
|
recordDeliveredCascadeNeighbor,
|
|
111
111
|
renderCascadeResult,
|
|
112
112
|
requeueRunnerFindings,
|
|
@@ -117,49 +117,48 @@ import {
|
|
|
117
117
|
resetPsScriptAnalyzerAvailability,
|
|
118
118
|
runProviders,
|
|
119
119
|
stampLineHashes
|
|
120
|
-
} from "../chunk-
|
|
120
|
+
} from "../chunk-ECYUBKYX.js";
|
|
121
121
|
import {
|
|
122
122
|
resetLazyInstallAttempts
|
|
123
|
-
} from "../chunk-
|
|
123
|
+
} from "../chunk-GL6J5R34.js";
|
|
124
124
|
import {
|
|
125
125
|
isTestRoleCollateral
|
|
126
|
-
} from "../chunk-
|
|
127
|
-
import "../chunk-
|
|
126
|
+
} from "../chunk-ME6MF2N2.js";
|
|
127
|
+
import "../chunk-6RXMQYNU.js";
|
|
128
128
|
import {
|
|
129
129
|
resetGoAvailability
|
|
130
|
-
} from "../chunk-
|
|
130
|
+
} from "../chunk-NQFXN5U7.js";
|
|
131
131
|
import {
|
|
132
132
|
TrivyClient,
|
|
133
133
|
trivyEvidenceFiles
|
|
134
|
-
} from "../chunk-
|
|
135
|
-
import "../chunk-
|
|
136
|
-
import "../chunk-
|
|
137
|
-
import
|
|
138
|
-
|
|
139
|
-
hasUsableResult,
|
|
140
|
-
reachedNoVerdict
|
|
141
|
-
} from "../chunk-4ITEFRDH.js";
|
|
134
|
+
} from "../chunk-WXMUGUZV.js";
|
|
135
|
+
import "../chunk-D5L7Q57Z.js";
|
|
136
|
+
import "../chunk-QDZ3ZZMY.js";
|
|
137
|
+
import "../chunk-DPDA3ILA.js";
|
|
138
|
+
import "../chunk-LHCDWFDB.js";
|
|
142
139
|
import {
|
|
143
140
|
resetRustAvailability
|
|
144
|
-
} from "../chunk-
|
|
145
|
-
import "../chunk-
|
|
146
|
-
import "../chunk-
|
|
141
|
+
} from "../chunk-KDGKKK7A.js";
|
|
142
|
+
import "../chunk-UY3WWW5R.js";
|
|
143
|
+
import "../chunk-E6Z3CJT2.js";
|
|
147
144
|
import {
|
|
148
145
|
resetDispatchAvailabilityState,
|
|
149
146
|
resolveManagedToolClient
|
|
150
|
-
} from "../chunk-
|
|
151
|
-
import
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
} from "../chunk-UELHWF5I.js";
|
|
148
|
+
import {
|
|
149
|
+
readFileContent
|
|
150
|
+
} from "../chunk-YUF4DRYB.js";
|
|
151
|
+
import "../chunk-NWK7KKNO.js";
|
|
152
|
+
import "../chunk-BBJXIZ3X.js";
|
|
154
153
|
import "../chunk-ZD4KVFXI.js";
|
|
155
|
-
import "../chunk-
|
|
154
|
+
import "../chunk-BLL4VYGZ.js";
|
|
156
155
|
import {
|
|
157
156
|
SYMBOL_KIND_NAMES,
|
|
158
157
|
captureReviewGraphStructuralIr,
|
|
159
158
|
formatReviewGraphRevisionDriftNote,
|
|
160
159
|
publishReviewGraphFileIr,
|
|
161
160
|
reviewGraphIrContentHash
|
|
162
|
-
} from "../chunk-
|
|
161
|
+
} from "../chunk-3C6ZZAB2.js";
|
|
163
162
|
import {
|
|
164
163
|
buildSymbolId
|
|
165
164
|
} from "../chunk-3MED75HT.js";
|
|
@@ -179,11 +178,15 @@ import {
|
|
|
179
178
|
applyDispositions,
|
|
180
179
|
applyDispositionsMultiFile,
|
|
181
180
|
applyWeakDispositions,
|
|
181
|
+
applyWeakDispositionsMultiFile,
|
|
182
182
|
applyWorkspaceEdit,
|
|
183
183
|
armDeferredLspWork,
|
|
184
184
|
attemptTsserverSyncDiagnostics,
|
|
185
|
+
auxiliaryNotRunSentences,
|
|
186
|
+
auxiliaryServersNotRun,
|
|
185
187
|
beginScope,
|
|
186
188
|
buildProbeScopeKey,
|
|
189
|
+
cachedAnchorMarks,
|
|
187
190
|
canRearmPendingAuxiliary,
|
|
188
191
|
captureRenameExpectedContent,
|
|
189
192
|
classifyDiagnosticTier,
|
|
@@ -202,7 +205,6 @@ import {
|
|
|
202
205
|
drainPendingAuxiliaryCoverage,
|
|
203
206
|
drainRenderedDependencyDriftFilePaths,
|
|
204
207
|
dropExcludedServers,
|
|
205
|
-
enabledOptInAuxiliaryLspServerIds,
|
|
206
208
|
findAuxiliaryProfileForSource,
|
|
207
209
|
getActiveSessionId,
|
|
208
210
|
getDisposition,
|
|
@@ -245,6 +247,7 @@ import {
|
|
|
245
247
|
reconcileStaleWidgetFiles,
|
|
246
248
|
recordLspMutationOutcome,
|
|
247
249
|
recordRunner,
|
|
250
|
+
refuseOutOfRootWrites,
|
|
248
251
|
registerDeferredLspWork,
|
|
249
252
|
resetDeferredDispositions,
|
|
250
253
|
resetLSPService,
|
|
@@ -269,8 +272,9 @@ import {
|
|
|
269
272
|
tryWarmAttachedDiagnostics,
|
|
270
273
|
warmAnswerBinding,
|
|
271
274
|
widgetDiagnosticUri,
|
|
272
|
-
writeOrderToken
|
|
273
|
-
|
|
275
|
+
writeOrderToken,
|
|
276
|
+
writeSourceFile
|
|
277
|
+
} from "../chunk-QBUSONNE.js";
|
|
274
278
|
import {
|
|
275
279
|
ANY_POSITION,
|
|
276
280
|
foldedFindingIdentity,
|
|
@@ -280,7 +284,7 @@ import {
|
|
|
280
284
|
resetMutationAttribution,
|
|
281
285
|
retainRecordedFindings,
|
|
282
286
|
stableFindingId
|
|
283
|
-
} from "../chunk-
|
|
287
|
+
} from "../chunk-AOQKQWZU.js";
|
|
284
288
|
import {
|
|
285
289
|
mapWithConcurrency
|
|
286
290
|
} from "../chunk-XIMYZ3JA.js";
|
|
@@ -306,8 +310,8 @@ import {
|
|
|
306
310
|
resetLSPCaseSensitivityState,
|
|
307
311
|
resolveLspCwdForFile,
|
|
308
312
|
shouldInitializeSessionRoot
|
|
309
|
-
} from "../chunk-
|
|
310
|
-
import "../chunk-
|
|
313
|
+
} from "../chunk-DBAHJFBU.js";
|
|
314
|
+
import "../chunk-2SD2CGVH.js";
|
|
311
315
|
import {
|
|
312
316
|
PROJECT_VENV_DIR_NAMES,
|
|
313
317
|
PYTHON_DECLARATION_CONCURRENCY,
|
|
@@ -319,10 +323,10 @@ import {
|
|
|
319
323
|
partitionOutrankedPythonCompileVerdicts,
|
|
320
324
|
recordPythonCompileVerdictDrop,
|
|
321
325
|
resetBoundedTelemetry
|
|
322
|
-
} from "../chunk-
|
|
326
|
+
} from "../chunk-NLRKB32C.js";
|
|
323
327
|
import {
|
|
324
328
|
scannerReportParentDir
|
|
325
|
-
} from "../chunk-
|
|
329
|
+
} from "../chunk-QJ4T73J5.js";
|
|
326
330
|
import {
|
|
327
331
|
PROJECT_SNAPSHOT_VERSION,
|
|
328
332
|
getProjectSnapshotLegacyPath,
|
|
@@ -337,13 +341,13 @@ import {
|
|
|
337
341
|
readJsonCache,
|
|
338
342
|
readProjectSnapshotMeta,
|
|
339
343
|
saveRuntimeProjectSnapshot
|
|
340
|
-
} from "../chunk-
|
|
344
|
+
} from "../chunk-HTUG7ZFK.js";
|
|
341
345
|
import {
|
|
342
346
|
SWEEP_IDLE_SAFETY_MARGIN_MS,
|
|
343
347
|
getFullScanWallClockMs,
|
|
344
348
|
isWorkspaceSweepActive,
|
|
345
349
|
runWhenWorkspaceSweepIdle
|
|
346
|
-
} from "../chunk-
|
|
350
|
+
} from "../chunk-HGEE5LDW.js";
|
|
347
351
|
import "../chunk-5W3R6LFT.js";
|
|
348
352
|
import {
|
|
349
353
|
DEPENDENCY_DRIFT_MAX_DELIVERIES,
|
|
@@ -355,10 +359,10 @@ import {
|
|
|
355
359
|
resolveImportToFiles,
|
|
356
360
|
sweepInlineBlockerFreshness,
|
|
357
361
|
symbolExtractionGrammar
|
|
358
|
-
} from "../chunk-
|
|
359
|
-
import "../chunk-
|
|
360
|
-
import "../chunk-
|
|
361
|
-
import "../chunk-
|
|
362
|
+
} from "../chunk-532X3OCZ.js";
|
|
363
|
+
import "../chunk-6XNVY3FW.js";
|
|
364
|
+
import "../chunk-7424ANRU.js";
|
|
365
|
+
import "../chunk-SUIZOCSY.js";
|
|
362
366
|
import {
|
|
363
367
|
EXT_TO_LANG,
|
|
364
368
|
classifyTreeSitterWasmError,
|
|
@@ -371,37 +375,45 @@ import {
|
|
|
371
375
|
queryLoader,
|
|
372
376
|
reportBundledResourceDirHealth,
|
|
373
377
|
resolveTreeSitterLanguage
|
|
374
|
-
} from "../chunk-
|
|
378
|
+
} from "../chunk-OC4ZGVMH.js";
|
|
375
379
|
import "../chunk-Z54ZSOBZ.js";
|
|
376
380
|
import {
|
|
377
381
|
getUserRuleRoot
|
|
378
|
-
} from "../chunk-
|
|
382
|
+
} from "../chunk-5YTDZ5WP.js";
|
|
379
383
|
import {
|
|
380
384
|
dump,
|
|
381
385
|
resolvePackagePath
|
|
382
|
-
} from "../chunk-
|
|
383
|
-
import {
|
|
384
|
-
SCAN_LANGUAGE_PRIORITY,
|
|
385
|
-
extensionsForLanguage,
|
|
386
|
-
extensionsForLanguageToken,
|
|
387
|
-
resolveFilenameLanguage,
|
|
388
|
-
resolveLanguage
|
|
389
|
-
} from "../chunk-OTSTS7L2.js";
|
|
386
|
+
} from "../chunk-E3PNZDPH.js";
|
|
390
387
|
import "../chunk-6HWVI6MI.js";
|
|
391
|
-
import "../chunk-
|
|
388
|
+
import "../chunk-KNP4ENFT.js";
|
|
392
389
|
import {
|
|
393
390
|
HOOK_WALL_BUDGET_MS
|
|
394
391
|
} from "../chunk-CKEQFGLT.js";
|
|
395
392
|
import {
|
|
396
393
|
centralityFromReverseDeps,
|
|
397
394
|
getWordIndexBuildStatus,
|
|
395
|
+
isEmptyWordIndexQuery,
|
|
398
396
|
logWordIndex,
|
|
397
|
+
parseWordIndexQuery,
|
|
399
398
|
searchWordIndex,
|
|
400
399
|
triggerBackgroundWordIndexBuild
|
|
401
|
-
} from "../chunk-
|
|
400
|
+
} from "../chunk-LXE7JAMV.js";
|
|
402
401
|
import {
|
|
403
402
|
getProjectDiagnosticsScannerMaxFiles
|
|
404
|
-
} from "../chunk-
|
|
403
|
+
} from "../chunk-IT7MFVGP.js";
|
|
404
|
+
import {
|
|
405
|
+
SCAN_LANGUAGE_PRIORITY,
|
|
406
|
+
extensionsForLanguage,
|
|
407
|
+
resolveLanguage,
|
|
408
|
+
resolveLanguageScope
|
|
409
|
+
} from "../chunk-AYDE7RFV.js";
|
|
410
|
+
import {
|
|
411
|
+
NO_SERVER_REASON,
|
|
412
|
+
findingsResult,
|
|
413
|
+
hasUsableResult,
|
|
414
|
+
reachedNoVerdict,
|
|
415
|
+
verdictUncheckedReason
|
|
416
|
+
} from "../chunk-W6VLB6LL.js";
|
|
405
417
|
import {
|
|
406
418
|
WARM_TURN_END_SCHEMA_VERSION,
|
|
407
419
|
createWarmIpcLineReader,
|
|
@@ -409,40 +421,39 @@ import {
|
|
|
409
421
|
ipcPathForCwd,
|
|
410
422
|
readTurnEndStatus,
|
|
411
423
|
unlinkStaleUnixSocket
|
|
412
|
-
} from "../chunk-
|
|
424
|
+
} from "../chunk-YVPB5YGO.js";
|
|
413
425
|
import {
|
|
414
|
-
hashContentBytes,
|
|
415
426
|
resolveRunnerPath,
|
|
416
427
|
toRunnerDisplayPath
|
|
417
|
-
} from "../chunk-
|
|
428
|
+
} from "../chunk-ZRQMENT4.js";
|
|
418
429
|
import {
|
|
419
430
|
bounded,
|
|
420
431
|
combineAbortSignals,
|
|
421
432
|
untilAborted,
|
|
422
433
|
withBudget,
|
|
423
434
|
withDeadline
|
|
424
|
-
} from "../chunk-
|
|
435
|
+
} from "../chunk-3HZ6MNB2.js";
|
|
425
436
|
import "../chunk-2BEMIWEW.js";
|
|
426
437
|
import "../chunk-IJYGIDF4.js";
|
|
427
438
|
import {
|
|
428
439
|
commitDurableStore,
|
|
429
440
|
resetResolvedPathCache,
|
|
430
441
|
resetZizmorTokenAvailability
|
|
431
|
-
} from "../chunk-
|
|
442
|
+
} from "../chunk-ITAPXBIB.js";
|
|
432
443
|
import {
|
|
433
444
|
resolveToolCwd
|
|
434
|
-
} from "../chunk-
|
|
445
|
+
} from "../chunk-JSQK5DH3.js";
|
|
435
446
|
import {
|
|
436
447
|
_resetPackageManagerCache,
|
|
437
448
|
findGlobalBinary,
|
|
438
449
|
pmBinary,
|
|
439
450
|
resolveNodePackageManager,
|
|
440
451
|
runScriptArgs
|
|
441
|
-
} from "../chunk-
|
|
452
|
+
} from "../chunk-FVEEEEIM.js";
|
|
442
453
|
import {
|
|
443
454
|
getIsolatedNpxSpawnOptions,
|
|
444
455
|
probeToolAsync
|
|
445
|
-
} from "../chunk-
|
|
456
|
+
} from "../chunk-OP5BMZKK.js";
|
|
446
457
|
import "../chunk-UYXV5NIS.js";
|
|
447
458
|
import {
|
|
448
459
|
classifyProbeFailure,
|
|
@@ -451,20 +462,24 @@ import {
|
|
|
451
462
|
logAvailabilityDecision,
|
|
452
463
|
resetInstallRetryLatches,
|
|
453
464
|
startHostStallSampler
|
|
454
|
-
} from "../chunk-
|
|
465
|
+
} from "../chunk-WBXCIRVI.js";
|
|
455
466
|
import {
|
|
456
467
|
canRunStartupHeavyScans,
|
|
457
468
|
detectProjectLanguageProfile,
|
|
458
469
|
getDefaultStartupTools
|
|
459
|
-
} from "../chunk-
|
|
460
|
-
import "../chunk-
|
|
470
|
+
} from "../chunk-TTGDTNSN.js";
|
|
471
|
+
import "../chunk-34RXPR7M.js";
|
|
461
472
|
import {
|
|
473
|
+
DEFAULT_MAX_SCAN_ENTRIES,
|
|
462
474
|
collectSourceFilesWithBudgetAsync,
|
|
463
475
|
getSlowFsVerdict,
|
|
464
476
|
isSlowFs,
|
|
465
477
|
slowFsDegradationNotice
|
|
466
|
-
} from "../chunk-
|
|
467
|
-
import
|
|
478
|
+
} from "../chunk-3NVGBFJS.js";
|
|
479
|
+
import {
|
|
480
|
+
shouldRecurseIntoDir,
|
|
481
|
+
walkTreeStackAsync
|
|
482
|
+
} from "../chunk-C2REOMPO.js";
|
|
468
483
|
import {
|
|
469
484
|
displayProjectDataPath,
|
|
470
485
|
drainProjectDataDirMigrations,
|
|
@@ -494,19 +509,18 @@ import {
|
|
|
494
509
|
sweepDeadEphemeralDataDirs,
|
|
495
510
|
updateHeartbeat,
|
|
496
511
|
withGenerationLockSync
|
|
497
|
-
} from "../chunk-
|
|
512
|
+
} from "../chunk-DNB4ZQGN.js";
|
|
498
513
|
import {
|
|
499
514
|
createSingleFlight
|
|
500
|
-
} from "../chunk-
|
|
515
|
+
} from "../chunk-B4FAFEBP.js";
|
|
501
516
|
import {
|
|
502
517
|
createDeadline,
|
|
503
518
|
yieldIfOverBudget
|
|
504
519
|
} from "../chunk-QYF5S6P6.js";
|
|
505
520
|
import {
|
|
506
|
-
SPECIAL_FILENAMES,
|
|
507
521
|
detectFileKind,
|
|
508
522
|
isJstsFactFile
|
|
509
|
-
} from "../chunk-
|
|
523
|
+
} from "../chunk-SRXYSLMW.js";
|
|
510
524
|
import {
|
|
511
525
|
PathKeyedMap,
|
|
512
526
|
compareKeys,
|
|
@@ -517,12 +531,16 @@ import {
|
|
|
517
531
|
provenanceView,
|
|
518
532
|
resolvePiLensConfig,
|
|
519
533
|
summarizeConfigResolution
|
|
520
|
-
} from "../chunk-
|
|
534
|
+
} from "../chunk-6EIV3H7O.js";
|
|
521
535
|
import {
|
|
522
536
|
LSP_NAMESPACE_KEY,
|
|
523
537
|
getPiLensGlobalConfigPath,
|
|
524
538
|
resetWorkspaceTopology
|
|
525
|
-
} from "../chunk-
|
|
539
|
+
} from "../chunk-3R3Z54J7.js";
|
|
540
|
+
import {
|
|
541
|
+
hashContentBytes,
|
|
542
|
+
hashFileBytes
|
|
543
|
+
} from "../chunk-CIA7X2PZ.js";
|
|
526
544
|
import {
|
|
527
545
|
DEFAULT_MAX_OUTPUT_BYTES,
|
|
528
546
|
createBoundedOutputSink,
|
|
@@ -532,7 +550,7 @@ import {
|
|
|
532
550
|
setProjectTrustState,
|
|
533
551
|
truncatedByOutputCap,
|
|
534
552
|
writeFileAtomic
|
|
535
|
-
} from "../chunk-
|
|
553
|
+
} from "../chunk-43KD3PPM.js";
|
|
536
554
|
import {
|
|
537
555
|
LENS_TOOL_NAMES,
|
|
538
556
|
TOOL_REGISTRY,
|
|
@@ -551,7 +569,7 @@ import {
|
|
|
551
569
|
resolveLensToolName,
|
|
552
570
|
toolRegistryEntryForMcp,
|
|
553
571
|
translateGuidanceToolNames
|
|
554
|
-
} from "../chunk-
|
|
572
|
+
} from "../chunk-AGEQRJ5A.js";
|
|
555
573
|
import {
|
|
556
574
|
freshnessFromMtime
|
|
557
575
|
} from "../chunk-S26LC76R.js";
|
|
@@ -563,13 +581,14 @@ import {
|
|
|
563
581
|
getProcessSingleton,
|
|
564
582
|
isTestMode,
|
|
565
583
|
logLatency,
|
|
584
|
+
nonNegativeIntEnv,
|
|
566
585
|
runLogCleanup,
|
|
567
586
|
setTurnContextSession
|
|
568
|
-
} from "../chunk-
|
|
587
|
+
} from "../chunk-K2GV34T2.js";
|
|
569
588
|
import "../chunk-LJDODBBZ.js";
|
|
570
589
|
import {
|
|
571
590
|
FactStore
|
|
572
|
-
} from "../chunk-
|
|
591
|
+
} from "../chunk-O6LCSHHI.js";
|
|
573
592
|
import {
|
|
574
593
|
BoundedFifoMap,
|
|
575
594
|
BoundedLruCache,
|
|
@@ -591,13 +610,13 @@ import {
|
|
|
591
610
|
uriToDiskPath,
|
|
592
611
|
uriToPath,
|
|
593
612
|
walkUpDirs
|
|
594
|
-
} from "../chunk-
|
|
613
|
+
} from "../chunk-WLD6BGON.js";
|
|
595
614
|
import "../chunk-NXL4FFQQ.js";
|
|
596
615
|
|
|
597
616
|
// dist/mcp/server.js
|
|
598
|
-
import * as
|
|
617
|
+
import * as fs25 from "node:fs";
|
|
599
618
|
import * as net from "node:net";
|
|
600
|
-
import * as
|
|
619
|
+
import * as path43 from "node:path";
|
|
601
620
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
602
621
|
|
|
603
622
|
// dist/tools/render-compact.js
|
|
@@ -853,7 +872,7 @@ var RESET_FG = "\x1B[39m\x1B[22m";
|
|
|
853
872
|
function fullTextOf(result) {
|
|
854
873
|
return (result.content ?? []).filter((c) => c.type === "text" && typeof c.text === "string").map((c) => c.text).join("\n");
|
|
855
874
|
}
|
|
856
|
-
function selectCompactText(result, args, expanded,
|
|
875
|
+
function selectCompactText(result, args, expanded, summarize2) {
|
|
857
876
|
const text = fullTextOf(result);
|
|
858
877
|
if (expanded) {
|
|
859
878
|
return {
|
|
@@ -864,7 +883,7 @@ function selectCompactText(result, args, expanded, summarize) {
|
|
|
864
883
|
const lineCount3 = text ? text.split("\n").length : 0;
|
|
865
884
|
let summary;
|
|
866
885
|
try {
|
|
867
|
-
summary =
|
|
886
|
+
summary = summarize2({
|
|
868
887
|
details: result.details,
|
|
869
888
|
args,
|
|
870
889
|
isError: result.isError === true,
|
|
@@ -883,14 +902,20 @@ function paintCompact(style, text, theme) {
|
|
|
883
902
|
const color = style === "error" ? "error" : "toolOutput";
|
|
884
903
|
return theme.fg(color, text);
|
|
885
904
|
}
|
|
886
|
-
function compactRenderResult(
|
|
905
|
+
function compactRenderResult(summarize2) {
|
|
887
906
|
return (result, options, theme, context) => {
|
|
888
907
|
const component = context.lastComponent instanceof Text ? context.lastComponent : new Text("", 0, 0);
|
|
889
|
-
const { text, style } = selectCompactText(result, context.args ?? {}, options.expanded === true,
|
|
908
|
+
const { text, style } = selectCompactText(result, context.args ?? {}, options.expanded === true, summarize2);
|
|
890
909
|
component.setText(paintCompact(style, text, theme));
|
|
891
910
|
return component;
|
|
892
911
|
};
|
|
893
912
|
}
|
|
913
|
+
function baseName(p) {
|
|
914
|
+
if (typeof p !== "string" || p.length === 0)
|
|
915
|
+
return "";
|
|
916
|
+
const parts = p.split(/[\\/]/);
|
|
917
|
+
return parts[parts.length - 1] || p;
|
|
918
|
+
}
|
|
894
919
|
|
|
895
920
|
// dist/clients/ast-grep-client.js
|
|
896
921
|
import * as fs4 from "node:fs";
|
|
@@ -1532,6 +1557,7 @@ Original error: ${stderr}`;
|
|
|
1532
1557
|
timeout: DEFAULT_EXEC_TIMEOUT_MS,
|
|
1533
1558
|
deadlineAt: options.deadlineAt,
|
|
1534
1559
|
signal: options.signal,
|
|
1560
|
+
ignoreAmbientSignal: options.ignoreAmbientSignal,
|
|
1535
1561
|
maxOutputBytes: MAX_SG_OUTPUT_BYTES
|
|
1536
1562
|
});
|
|
1537
1563
|
const empty = () => ({
|
|
@@ -1549,6 +1575,7 @@ Original error: ${stderr}`;
|
|
|
1549
1575
|
if (spawnFailure) {
|
|
1550
1576
|
return {
|
|
1551
1577
|
...empty(),
|
|
1578
|
+
failure: spawnFailure,
|
|
1552
1579
|
error: spawnFailure === "unavailable" ? "ast-grep CLI not found. Install: npm i -D @ast-grep/cli" : result.error?.message || "ast-grep CLI failed to start"
|
|
1553
1580
|
};
|
|
1554
1581
|
}
|
|
@@ -1719,12 +1746,23 @@ Original error: ${stderr}`;
|
|
|
1719
1746
|
if (!applyFixes) {
|
|
1720
1747
|
const result = await this.spawnResolved(command, scanArgs, spawnOptions);
|
|
1721
1748
|
const scan2 = this.interpretScanResult(result, ["scan"]);
|
|
1722
|
-
return scan2.failure || scan2.error ? {
|
|
1749
|
+
return scan2.failure || scan2.error ? {
|
|
1750
|
+
matches: [],
|
|
1751
|
+
error: scan2.error,
|
|
1752
|
+
...scan2.failure === "aborted" ? { aborted: true } : {}
|
|
1753
|
+
} : { matches: scan2.matches };
|
|
1723
1754
|
}
|
|
1724
1755
|
const jsonResult = await this.spawnResolved(command, scanArgs, spawnOptions);
|
|
1725
1756
|
const scan = this.interpretScanResult(jsonResult, ["scan"]);
|
|
1726
1757
|
if (scan.failure || scan.error) {
|
|
1727
|
-
return {
|
|
1758
|
+
return {
|
|
1759
|
+
matches: [],
|
|
1760
|
+
error: scan.error,
|
|
1761
|
+
...scan.failure === "aborted" ? { aborted: true } : {}
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
if (options.signal?.aborted) {
|
|
1765
|
+
return { matches: [], error: "operation aborted", aborted: true };
|
|
1728
1766
|
}
|
|
1729
1767
|
const applyResult = await this.spawnResolved(command, [
|
|
1730
1768
|
"scan",
|
|
@@ -1733,10 +1771,11 @@ Original error: ${stderr}`;
|
|
|
1733
1771
|
"--update-all",
|
|
1734
1772
|
...sgExcludeArgsForProject(dir),
|
|
1735
1773
|
dir
|
|
1736
|
-
], spawnOptions);
|
|
1774
|
+
], { ...spawnOptions, signal: void 0, ignoreAmbientSignal: true });
|
|
1737
1775
|
if (applyResult.error || applyResult.failure || applyResult.status !== 0) {
|
|
1738
1776
|
return {
|
|
1739
1777
|
matches: [],
|
|
1778
|
+
writeStarted: true,
|
|
1740
1779
|
error: applyResult.error?.message || `ast-grep apply failed with exit code ${applyResult.status}`
|
|
1741
1780
|
};
|
|
1742
1781
|
}
|
|
@@ -1799,6 +1838,9 @@ function reportAstGrepRulesHealth(bundledRuleDir) {
|
|
|
1799
1838
|
});
|
|
1800
1839
|
reportBundledResourceDirHealth("ast-grep-rules-dir-missing", bundledRuleDir, health, "ast-grep rule descriptions");
|
|
1801
1840
|
}
|
|
1841
|
+
function matchedFilePath(file) {
|
|
1842
|
+
return normalizeFilePath(path4.resolve(process.cwd(), file));
|
|
1843
|
+
}
|
|
1802
1844
|
function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
|
|
1803
1845
|
const bridge = getMutationBridge();
|
|
1804
1846
|
if (!bridge || matches.length === 0)
|
|
@@ -1815,7 +1857,7 @@ function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
|
|
|
1815
1857
|
}
|
|
1816
1858
|
const accepted = [];
|
|
1817
1859
|
for (const [filePath, editRanges] of rangesByFile) {
|
|
1818
|
-
const resolved =
|
|
1860
|
+
const resolved = matchedFilePath(filePath);
|
|
1819
1861
|
const recorded = bridge.recordMutation({
|
|
1820
1862
|
filePath: resolved,
|
|
1821
1863
|
kind: "edit",
|
|
@@ -1838,6 +1880,42 @@ function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
|
|
|
1838
1880
|
}
|
|
1839
1881
|
return accepted;
|
|
1840
1882
|
}
|
|
1883
|
+
function missingRootRefusal(options) {
|
|
1884
|
+
return options?.sessionRoot === void 0 ? "ast_grep_replace refused: no session root to check the write against" : void 0;
|
|
1885
|
+
}
|
|
1886
|
+
function outsideRootsText(refused) {
|
|
1887
|
+
return `ast_grep_replace refused: ${refused.join(", ")} ${refused.length === 1 ? "is" : "are"} outside the session's writable roots (a preview with apply: false is still allowed)`;
|
|
1888
|
+
}
|
|
1889
|
+
async function applyRewrite(matches, options, write) {
|
|
1890
|
+
const files = [
|
|
1891
|
+
...new Set(matches.map((match) => matchedFilePath(match.file)))
|
|
1892
|
+
];
|
|
1893
|
+
const hashOf = (file) => {
|
|
1894
|
+
try {
|
|
1895
|
+
return hashFileBytes(file);
|
|
1896
|
+
} catch {
|
|
1897
|
+
return void 0;
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1900
|
+
const refused = refuseOutOfRootWrites(files, options?.sessionRoot ?? "", "ast_grep_replace");
|
|
1901
|
+
if (refused.length > 0)
|
|
1902
|
+
return { refused };
|
|
1903
|
+
const before = /* @__PURE__ */ new Map();
|
|
1904
|
+
let appliedFiles = [];
|
|
1905
|
+
const result = await writeSourceFile({
|
|
1906
|
+
filePaths: files,
|
|
1907
|
+
record: (exit) => {
|
|
1908
|
+
const clean = exit.ok && exit.value.error === void 0;
|
|
1909
|
+
const changed = clean ? files : files.filter((file) => hashOf(file) !== before.get(file));
|
|
1910
|
+
appliedFiles = recordAstGrepApply(matches.filter((match) => changed.includes(matchedFilePath(match.file))), options);
|
|
1911
|
+
}
|
|
1912
|
+
}, async () => {
|
|
1913
|
+
for (const file of files)
|
|
1914
|
+
before.set(file, hashOf(file));
|
|
1915
|
+
return write();
|
|
1916
|
+
});
|
|
1917
|
+
return { result, appliedFiles };
|
|
1918
|
+
}
|
|
1841
1919
|
function extractDebugAst(raw) {
|
|
1842
1920
|
const lines = raw.split(/\r?\n/);
|
|
1843
1921
|
const start = lines.findIndex((line) => /^Debug (?:A|C)ST:/.test(line.trim()));
|
|
@@ -1986,8 +2064,21 @@ var AstGrepClient = class {
|
|
|
1986
2064
|
*/
|
|
1987
2065
|
async replaceWithRule(ruleYaml, paths, apply, options) {
|
|
1988
2066
|
const allMatches = [];
|
|
1989
|
-
const
|
|
2067
|
+
const sg = options?.signal ? { signal: options.signal } : {};
|
|
2068
|
+
if (apply) {
|
|
2069
|
+
const refusal = missingRootRefusal(options);
|
|
2070
|
+
if (refusal !== void 0) {
|
|
2071
|
+
return {
|
|
2072
|
+
matches: [],
|
|
2073
|
+
totalMatches: 0,
|
|
2074
|
+
applied: false,
|
|
2075
|
+
error: refusal
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
const appliedFiles = [];
|
|
1990
2080
|
for (const scanPath of paths) {
|
|
2081
|
+
let previewed = [];
|
|
1991
2082
|
if (apply) {
|
|
1992
2083
|
const preCheck = await this.tempScanDetailed(scanPath, ruleYaml);
|
|
1993
2084
|
if (preCheck.failure || preCheck.error) {
|
|
@@ -1996,7 +2087,8 @@ var AstGrepClient = class {
|
|
|
1996
2087
|
totalMatches: allMatches.length,
|
|
1997
2088
|
applied: false,
|
|
1998
2089
|
error: preCheck.error ?? "ast-grep preview failed",
|
|
1999
|
-
|
|
2090
|
+
...preCheck.failure === "aborted" ? { aborted: true } : {},
|
|
2091
|
+
appliedFiles
|
|
2000
2092
|
};
|
|
2001
2093
|
}
|
|
2002
2094
|
if (preCheck.matches.length === 0) {
|
|
@@ -2005,18 +2097,34 @@ var AstGrepClient = class {
|
|
|
2005
2097
|
totalMatches: 0,
|
|
2006
2098
|
applied: false,
|
|
2007
2099
|
stalePreview: true,
|
|
2008
|
-
appliedFiles
|
|
2100
|
+
appliedFiles
|
|
2009
2101
|
};
|
|
2010
2102
|
}
|
|
2103
|
+
previewed = preCheck.matches;
|
|
2104
|
+
}
|
|
2105
|
+
const scan = () => this.runner.tempScanWithFixAsync(scanPath, "agent-rule", ruleYaml, apply, void 0, sg);
|
|
2106
|
+
const applied = apply ? await applyRewrite(previewed, options, scan) : null;
|
|
2107
|
+
if (applied !== null && "refused" in applied) {
|
|
2108
|
+
return {
|
|
2109
|
+
matches: allMatches,
|
|
2110
|
+
totalMatches: allMatches.length,
|
|
2111
|
+
applied: false,
|
|
2112
|
+
error: outsideRootsText(applied.refused),
|
|
2113
|
+
appliedFiles
|
|
2114
|
+
};
|
|
2011
2115
|
}
|
|
2012
|
-
|
|
2116
|
+
if (applied !== null)
|
|
2117
|
+
appliedFiles.push(...applied.appliedFiles);
|
|
2118
|
+
const result = applied === null ? await scan() : applied.result;
|
|
2013
2119
|
if (result.error) {
|
|
2014
2120
|
return {
|
|
2015
2121
|
matches: allMatches,
|
|
2016
2122
|
totalMatches: allMatches.length,
|
|
2017
2123
|
applied: false,
|
|
2018
2124
|
error: result.error,
|
|
2019
|
-
|
|
2125
|
+
...result.aborted ? { aborted: true } : {},
|
|
2126
|
+
...result.writeStarted ? { writeStarted: true } : {},
|
|
2127
|
+
appliedFiles
|
|
2020
2128
|
};
|
|
2021
2129
|
}
|
|
2022
2130
|
allMatches.push(...result.matches);
|
|
@@ -2025,7 +2133,7 @@ var AstGrepClient = class {
|
|
|
2025
2133
|
matches: allMatches,
|
|
2026
2134
|
totalMatches: allMatches.length,
|
|
2027
2135
|
applied: apply,
|
|
2028
|
-
appliedFiles
|
|
2136
|
+
appliedFiles
|
|
2029
2137
|
};
|
|
2030
2138
|
}
|
|
2031
2139
|
/**
|
|
@@ -2237,32 +2345,38 @@ var AstGrepClient = class {
|
|
|
2237
2345
|
if (options?.strictness) {
|
|
2238
2346
|
baseArgs.push("--strictness", options.strictness);
|
|
2239
2347
|
}
|
|
2348
|
+
const signal = options?.signal;
|
|
2349
|
+
const sg = signal ? { signal } : {};
|
|
2240
2350
|
if (!apply) {
|
|
2241
|
-
const result = await this.runner.exec([
|
|
2242
|
-
...baseArgs,
|
|
2243
|
-
"--json=compact",
|
|
2244
|
-
...paths
|
|
2245
|
-
]);
|
|
2351
|
+
const result = await this.runner.exec([...baseArgs, "--json=compact", ...paths], sg);
|
|
2246
2352
|
return {
|
|
2247
2353
|
matches: result.matches,
|
|
2248
2354
|
totalMatches: result.totalMatches,
|
|
2249
2355
|
truncated: result.truncated,
|
|
2250
2356
|
applied: false,
|
|
2251
|
-
error: result.error
|
|
2357
|
+
error: result.error,
|
|
2358
|
+
...result.failure === "aborted" ? { aborted: true } : {}
|
|
2252
2359
|
};
|
|
2253
2360
|
}
|
|
2254
|
-
const
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2361
|
+
const refusal = missingRootRefusal(options);
|
|
2362
|
+
if (refusal !== void 0) {
|
|
2363
|
+
return {
|
|
2364
|
+
matches: [],
|
|
2365
|
+
totalMatches: 0,
|
|
2366
|
+
truncated: false,
|
|
2367
|
+
applied: false,
|
|
2368
|
+
error: refusal
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
const preCheck = await this.runner.exec([...baseArgs, "--json=compact", ...paths], sg);
|
|
2259
2372
|
if (preCheck.error) {
|
|
2260
2373
|
return {
|
|
2261
2374
|
matches: [],
|
|
2262
2375
|
totalMatches: 0,
|
|
2263
2376
|
truncated: false,
|
|
2264
2377
|
applied: false,
|
|
2265
|
-
error: preCheck.error
|
|
2378
|
+
error: preCheck.error,
|
|
2379
|
+
...preCheck.failure === "aborted" ? { aborted: true } : {}
|
|
2266
2380
|
};
|
|
2267
2381
|
}
|
|
2268
2382
|
if (preCheck.matches.length === 0) {
|
|
@@ -2274,21 +2388,40 @@ var AstGrepClient = class {
|
|
|
2274
2388
|
stalePreview: true
|
|
2275
2389
|
};
|
|
2276
2390
|
}
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2391
|
+
if (signal?.aborted) {
|
|
2392
|
+
return {
|
|
2393
|
+
matches: [],
|
|
2394
|
+
totalMatches: 0,
|
|
2395
|
+
truncated: false,
|
|
2396
|
+
applied: false,
|
|
2397
|
+
error: "operation aborted",
|
|
2398
|
+
aborted: true
|
|
2399
|
+
};
|
|
2400
|
+
}
|
|
2401
|
+
const applied = await applyRewrite(preCheck.matches, options, () => this.runner.exec([...baseArgs, "--update-all", ...paths], {
|
|
2402
|
+
ignoreAmbientSignal: true
|
|
2403
|
+
}));
|
|
2404
|
+
if ("refused" in applied) {
|
|
2405
|
+
return {
|
|
2406
|
+
matches: [],
|
|
2407
|
+
totalMatches: 0,
|
|
2408
|
+
truncated: false,
|
|
2409
|
+
applied: false,
|
|
2410
|
+
error: outsideRootsText(applied.refused)
|
|
2411
|
+
};
|
|
2412
|
+
}
|
|
2413
|
+
const { appliedFiles } = applied;
|
|
2414
|
+
if (applied.result.error) {
|
|
2283
2415
|
return {
|
|
2284
2416
|
matches: [],
|
|
2285
2417
|
totalMatches: 0,
|
|
2286
2418
|
truncated: false,
|
|
2287
2419
|
applied: false,
|
|
2288
|
-
error:
|
|
2420
|
+
error: applied.result.error,
|
|
2421
|
+
writeStarted: true,
|
|
2422
|
+
appliedFiles
|
|
2289
2423
|
};
|
|
2290
2424
|
}
|
|
2291
|
-
const appliedFiles = recordAstGrepApply(preCheck.matches, options);
|
|
2292
2425
|
return {
|
|
2293
2426
|
matches: preCheck.matches,
|
|
2294
2427
|
totalMatches: preCheck.totalMatches,
|
|
@@ -2716,7 +2849,7 @@ async function scanFileMajorRules(cwd, files, signal) {
|
|
|
2716
2849
|
} finally {
|
|
2717
2850
|
facts.dropFileFacts(filePath);
|
|
2718
2851
|
}
|
|
2719
|
-
await new Promise((
|
|
2852
|
+
await new Promise((resolve34) => setImmediate(resolve34));
|
|
2720
2853
|
}
|
|
2721
2854
|
if (wasmAborted) {
|
|
2722
2855
|
astGrep.length = 0;
|
|
@@ -2860,7 +2993,7 @@ function resolveRebuildScript(serverFilePath) {
|
|
|
2860
2993
|
return toPosix(serverFilePath).includes("/dist/") ? "build:dist" : "build";
|
|
2861
2994
|
}
|
|
2862
2995
|
function analyzeFileFresh(workerPath, file, cwd, options = {}, timeoutMs = 12e4) {
|
|
2863
|
-
return new Promise((
|
|
2996
|
+
return new Promise((resolve34) => {
|
|
2864
2997
|
const args = [workerPath, `--file=${file}`, `--cwd=${cwd}`];
|
|
2865
2998
|
if (options.flags)
|
|
2866
2999
|
args.push(`--flags=${JSON.stringify(options.flags)}`);
|
|
@@ -2870,7 +3003,7 @@ function analyzeFileFresh(workerPath, file, cwd, options = {}, timeoutMs = 12e4)
|
|
|
2870
3003
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2871
3004
|
});
|
|
2872
3005
|
} catch (err) {
|
|
2873
|
-
|
|
3006
|
+
resolve34({
|
|
2874
3007
|
error: `failed to fork worker: ${err instanceof Error ? err.message : String(err)}`
|
|
2875
3008
|
});
|
|
2876
3009
|
return;
|
|
@@ -2883,7 +3016,7 @@ function analyzeFileFresh(workerPath, file, cwd, options = {}, timeoutMs = 12e4)
|
|
|
2883
3016
|
return;
|
|
2884
3017
|
settled = true;
|
|
2885
3018
|
clearTimeout(timer);
|
|
2886
|
-
|
|
3019
|
+
resolve34(outcome);
|
|
2887
3020
|
};
|
|
2888
3021
|
const timer = setTimeout(() => {
|
|
2889
3022
|
child.kill();
|
|
@@ -3048,28 +3181,28 @@ async function buildBootstrapClients() {
|
|
|
3048
3181
|
}
|
|
3049
3182
|
}
|
|
3050
3183
|
const [ruffClient, biomeClient, knipClient, todoScanner, jscpdClient, depChecker, testRunnerClient, complexityClient, goClient, govulncheckClient, gitleaksClient, trivyClient, opengrepClient, rustClient, agentBehaviorClient2, deadCodeClients] = await Promise.all([
|
|
3051
|
-
load("ruff", async () => new (await import("../chunk-
|
|
3052
|
-
load("biome", async () => new (await import("../chunk-
|
|
3053
|
-
load("knip", async () => new (await import("../chunk-
|
|
3054
|
-
load("todo", async () => new (await import("../chunk-
|
|
3055
|
-
load("jscpd", async () => new (await import("../chunk-
|
|
3056
|
-
load("dependency-checker", async () => new (await import("../chunk-
|
|
3057
|
-
load("test-runner", async () => new (await import("../chunk-
|
|
3058
|
-
load("complexity", async () => new (await import("../chunk-
|
|
3184
|
+
load("ruff", async () => new (await import("../chunk-HIUVHRLM.js")).RuffClient()),
|
|
3185
|
+
load("biome", async () => new (await import("../chunk-BN36MQW5.js")).BiomeClient()),
|
|
3186
|
+
load("knip", async () => new (await import("../chunk-TBE4OLPA.js")).KnipClient()),
|
|
3187
|
+
load("todo", async () => new (await import("../chunk-VDMF7Q2P.js")).TodoScanner()),
|
|
3188
|
+
load("jscpd", async () => new (await import("../chunk-6K4X7IIF.js")).JscpdClient()),
|
|
3189
|
+
load("dependency-checker", async () => new (await import("../chunk-UG4YLCJ5.js")).DependencyChecker()),
|
|
3190
|
+
load("test-runner", async () => new (await import("../chunk-C4ICGFEO.js")).TestRunnerClient()),
|
|
3191
|
+
load("complexity", async () => new (await import("../chunk-AJ62EQIQ.js")).ComplexityClient()),
|
|
3059
3192
|
// The process-wide singleton, NOT a fresh instance (#2455 fix round 4,
|
|
3060
3193
|
// F2). `handleSessionStart` reads this object for its "Active tools"
|
|
3061
3194
|
// line while `resetGoAvailability` re-arms the singleton's latch; a
|
|
3062
3195
|
// second instance here meant the reset never reached the surface a
|
|
3063
3196
|
// user actually sees.
|
|
3064
|
-
load("go", async () => (await import("../chunk-
|
|
3065
|
-
load("govulncheck", async () => new (await import("../chunk-
|
|
3066
|
-
load("gitleaks", async () => new (await import("../chunk-
|
|
3067
|
-
load("trivy", async () => new (await import("../chunk-
|
|
3068
|
-
load("opengrep", async () => new (await import("../chunk-
|
|
3197
|
+
load("go", async () => (await import("../chunk-BJDB7PXU.js")).goClient),
|
|
3198
|
+
load("govulncheck", async () => new (await import("../chunk-F37CCZUA.js")).GovulncheckClient()),
|
|
3199
|
+
load("gitleaks", async () => new (await import("../chunk-LIDFFCZZ.js")).GitleaksClient()),
|
|
3200
|
+
load("trivy", async () => new (await import("../chunk-R2UF54ON.js")).TrivyClient()),
|
|
3201
|
+
load("opengrep", async () => new (await import("../chunk-AVOUHMCS.js")).OpengrepClient()),
|
|
3069
3202
|
// The process-wide singleton, for the same reason as "go" above.
|
|
3070
|
-
load("rust", async () => (await import("../chunk-
|
|
3071
|
-
load("agent-behavior", async () => (await import("../chunk-
|
|
3072
|
-
loadList("dead-code", async () => (await import("../chunk-
|
|
3203
|
+
load("rust", async () => (await import("../chunk-KX4DF6XX.js")).rustClient),
|
|
3204
|
+
load("agent-behavior", async () => (await import("../chunk-4WWPDMRA.js")).agentBehaviorClient),
|
|
3205
|
+
loadList("dead-code", async () => (await import("../chunk-LHU6NG5Z.js")).getDeadCodeClients())
|
|
3073
3206
|
]);
|
|
3074
3207
|
if (failures.length > 0)
|
|
3075
3208
|
await logBootstrapFailures(failures);
|
|
@@ -3155,7 +3288,7 @@ function resetAnalyzerBootstrapSessionState() {
|
|
|
3155
3288
|
}
|
|
3156
3289
|
|
|
3157
3290
|
// dist/clients/formatters-lazy.js
|
|
3158
|
-
var lazyFormatters = createLazyImport(() => import("../chunk-
|
|
3291
|
+
var lazyFormatters = createLazyImport(() => import("../chunk-TPMBNWHO.js"));
|
|
3159
3292
|
function warmFormatters() {
|
|
3160
3293
|
return lazyFormatters.get();
|
|
3161
3294
|
}
|
|
@@ -4377,8 +4510,8 @@ var RuntimeCoordinator = class {
|
|
|
4377
4510
|
});
|
|
4378
4511
|
return entry;
|
|
4379
4512
|
});
|
|
4380
|
-
const timeout = new Promise((
|
|
4381
|
-
setTimeout(
|
|
4513
|
+
const timeout = new Promise((resolve34) => {
|
|
4514
|
+
setTimeout(resolve34, maxWaitMs).unref?.();
|
|
4382
4515
|
});
|
|
4383
4516
|
await Promise.race([
|
|
4384
4517
|
Promise.allSettled(tracked.map((t) => t.promise)),
|
|
@@ -4503,7 +4636,7 @@ var RuntimeCoordinator = class {
|
|
|
4503
4636
|
const existing = this._pendingInlineBlockers.get(key);
|
|
4504
4637
|
if (existing && !existing.diagnostics)
|
|
4505
4638
|
return 0;
|
|
4506
|
-
const identity = (d) => JSON.stringify([foldedFindingIdentity(d), d.line, d.column]);
|
|
4639
|
+
const identity = (d) => findingClassKey(d) ?? JSON.stringify([foldedFindingIdentity(d), d.line, d.column]);
|
|
4507
4640
|
const known = new Set((existing?.diagnostics ?? []).map(identity));
|
|
4508
4641
|
const added = blocking.flatMap((d) => known.has(identity(d)) ? [] : [d]);
|
|
4509
4642
|
if (added.length === 0)
|
|
@@ -6201,8 +6334,8 @@ async function igniteDominantLanguageWarm(cwd, runtime, sessionGeneration, dbg)
|
|
|
6201
6334
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6202
6335
|
return;
|
|
6203
6336
|
const lspService = (await loadLspService()).getLSPService();
|
|
6204
|
-
const { collectSourceFilesAsync } = await import("../chunk-
|
|
6205
|
-
const { CODE_KINDS, detectFileKind: detectFileKind2 } = await import("../chunk-
|
|
6337
|
+
const { collectSourceFilesAsync } = await import("../chunk-HASJPQBC.js");
|
|
6338
|
+
const { CODE_KINDS, detectFileKind: detectFileKind2 } = await import("../chunk-T5EGSBM2.js");
|
|
6206
6339
|
const files = await collectSourceFilesAsync(cwd, {
|
|
6207
6340
|
inspectGeneratedHeaders: false
|
|
6208
6341
|
});
|
|
@@ -6271,12 +6404,12 @@ function cancelScheduledManagedToolRefresh() {
|
|
|
6271
6404
|
managedToolRefreshTimer = void 0;
|
|
6272
6405
|
}
|
|
6273
6406
|
function scheduleManagedToolRefresh(dbg, rulePack) {
|
|
6274
|
-
const delayMs =
|
|
6407
|
+
const delayMs = nonNegativeIntEnv("PI_LENS_TOOL_REFRESH_DELAY_MS", MANAGED_TOOL_REFRESH_DELAY_MS);
|
|
6275
6408
|
const timer = setTimeout(() => {
|
|
6276
6409
|
managedToolRefreshTimer = void 0;
|
|
6277
6410
|
void (async () => {
|
|
6278
6411
|
try {
|
|
6279
|
-
const refresh = await import("../chunk-
|
|
6412
|
+
const refresh = await import("../chunk-VI3BJMZO.js");
|
|
6280
6413
|
const outcome = await refresh.runManagedToolRefresh(void 0, {
|
|
6281
6414
|
rulePack
|
|
6282
6415
|
});
|
|
@@ -6326,7 +6459,7 @@ function scanOneTodoFile(scanner, filePath, items) {
|
|
|
6326
6459
|
async function collectTodoBaselineItems(scanner, analysisRoot, stillCurrent) {
|
|
6327
6460
|
const items = [];
|
|
6328
6461
|
try {
|
|
6329
|
-
const { getSourceFilesAsync } = await import("../chunk-
|
|
6462
|
+
const { getSourceFilesAsync } = await import("../chunk-3QCI3V6C.js");
|
|
6330
6463
|
const files = await getSourceFilesAsync(analysisRoot, true);
|
|
6331
6464
|
if (!stillCurrent())
|
|
6332
6465
|
return items;
|
|
@@ -6355,7 +6488,7 @@ async function buildOrRefreshWordIndex(args) {
|
|
|
6355
6488
|
const snapshot = loadProjectSnapshot(snapshotRoot);
|
|
6356
6489
|
const snapshotLoadMs = Date.now() - snapshotLoadStartMs;
|
|
6357
6490
|
if (snapshot?.wordIndex) {
|
|
6358
|
-
const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-
|
|
6491
|
+
const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-NR4KQOXZ.js");
|
|
6359
6492
|
const deserializeStartMs = Date.now();
|
|
6360
6493
|
const index = deserializeWordIndex(snapshot.wordIndex);
|
|
6361
6494
|
const deserializeMs = Date.now() - deserializeStartMs;
|
|
@@ -6428,7 +6561,7 @@ async function buildOrRefreshWordIndex(args) {
|
|
|
6428
6561
|
}
|
|
6429
6562
|
}
|
|
6430
6563
|
}
|
|
6431
|
-
const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-
|
|
6564
|
+
const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-NR4KQOXZ.js");
|
|
6432
6565
|
const docs = await collectWordIndexDocs(analysisRoot, () => runtime.isCurrentSession(sessionGeneration), rebuildPreflightFiles);
|
|
6433
6566
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6434
6567
|
return;
|
|
@@ -6513,7 +6646,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6513
6646
|
const delay = STARTUP_TASK_DEFER_MS[name] ?? 0;
|
|
6514
6647
|
dbg(`session_start task ${name}: scheduled deferMs=${delay}`);
|
|
6515
6648
|
runtime.markStartupScanInFlight(name, sessionGeneration);
|
|
6516
|
-
const completion = new Promise((
|
|
6649
|
+
const completion = new Promise((resolve34) => {
|
|
6517
6650
|
const fire = () => {
|
|
6518
6651
|
const startedAt = Date.now();
|
|
6519
6652
|
dbg(`session_start task ${name}: start queuedMs=${startedAt - queuedAt}`);
|
|
@@ -6525,7 +6658,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6525
6658
|
}).finally(() => {
|
|
6526
6659
|
runtime.clearStartupScanInFlight(name, sessionGeneration);
|
|
6527
6660
|
dbg(`session_start task ${name}: end`);
|
|
6528
|
-
|
|
6661
|
+
resolve34();
|
|
6529
6662
|
});
|
|
6530
6663
|
};
|
|
6531
6664
|
if (delay > 0) {
|
|
@@ -6807,9 +6940,9 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6807
6940
|
});
|
|
6808
6941
|
let callGraphIdentity;
|
|
6809
6942
|
const callGraphTask = runTask("call-graph", async () => {
|
|
6810
|
-
const { FactStore: FactStore2 } = await import("../chunk-
|
|
6811
|
-
const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-
|
|
6812
|
-
const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-
|
|
6943
|
+
const { FactStore: FactStore2 } = await import("../chunk-X33QECRJ.js");
|
|
6944
|
+
const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-B4K6OSLL.js");
|
|
6945
|
+
const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-AFNPNHJV.js");
|
|
6813
6946
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6814
6947
|
return;
|
|
6815
6948
|
const startMs = Date.now();
|
|
@@ -6850,7 +6983,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6850
6983
|
return;
|
|
6851
6984
|
if (!runtime.callGraph)
|
|
6852
6985
|
return;
|
|
6853
|
-
const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-
|
|
6986
|
+
const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-KDMJ2DJD.js");
|
|
6854
6987
|
if (!callGraphIdentity)
|
|
6855
6988
|
return;
|
|
6856
6989
|
const model = buildCodebaseModel(runtime.callGraph, analysisRoot, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET, callGraphIdentity);
|
|
@@ -7050,7 +7183,7 @@ async function handleSessionStart(deps) {
|
|
|
7050
7183
|
let warmupOwnSnapshotRead;
|
|
7051
7184
|
if (startupMode === "quick" && !isPrintMode() && process.env.PI_LENS_COLD_START_QUICK !== "0" && !processGlobals.__piLensWarmupScheduled) {
|
|
7052
7185
|
processGlobals.__piLensWarmupScheduled = true;
|
|
7053
|
-
const warmupDelayMs =
|
|
7186
|
+
const warmupDelayMs = nonNegativeIntEnv("PI_LENS_WARMUP_DELAY_MS", 2e3);
|
|
7054
7187
|
const warmupCwd = deps.ctxCwd ?? process.cwd();
|
|
7055
7188
|
const warmupDbg = deps.dbg;
|
|
7056
7189
|
const warmupTimer = setTimeout(() => {
|
|
@@ -7059,8 +7192,8 @@ async function handleSessionStart(deps) {
|
|
|
7059
7192
|
try {
|
|
7060
7193
|
warmupDbg("warmup: starting background warmup");
|
|
7061
7194
|
const scanContextStartedAt = Date.now();
|
|
7062
|
-
const startupScanModule = await import("../chunk-
|
|
7063
|
-
const languageProfileModule = await import("../chunk-
|
|
7195
|
+
const startupScanModule = await import("../chunk-R2VUZZPJ.js");
|
|
7196
|
+
const languageProfileModule = await import("../chunk-SQBDX6IO.js");
|
|
7064
7197
|
const warmupSnapshotRoot = resolveSnapshotRoot(warmupCwd);
|
|
7065
7198
|
const cachedSnapshot = loadProjectSnapshot(warmupSnapshotRoot);
|
|
7066
7199
|
warmupOwnSnapshotRead = cachedSnapshot ? {
|
|
@@ -7960,7 +8093,7 @@ async function buildActionableWarningsReport(args) {
|
|
|
7960
8093
|
}
|
|
7961
8094
|
};
|
|
7962
8095
|
const deferredWork = (async () => {
|
|
7963
|
-
await new Promise((
|
|
8096
|
+
await new Promise((resolve34) => setTimeout(resolve34, 0));
|
|
7964
8097
|
const deferredRecords = [...carried];
|
|
7965
8098
|
const deferredDeadline = Date.now() + ACTIONABLE_WARNINGS_DEFERRED_BUDGET_MS;
|
|
7966
8099
|
deferredDeps.deadlineAt = deferredDeadline;
|
|
@@ -10301,7 +10434,7 @@ async function runTestTargetsBounded(args) {
|
|
|
10301
10434
|
});
|
|
10302
10435
|
void pool.catch(() => {
|
|
10303
10436
|
});
|
|
10304
|
-
await new Promise((
|
|
10437
|
+
await new Promise((resolve34) => {
|
|
10305
10438
|
let settled = false;
|
|
10306
10439
|
const finish = (reason) => {
|
|
10307
10440
|
if (settled)
|
|
@@ -10313,7 +10446,7 @@ async function runTestTargetsBounded(args) {
|
|
|
10313
10446
|
batchAbort.abort();
|
|
10314
10447
|
clearTimeout(timer);
|
|
10315
10448
|
args.signal?.removeEventListener("abort", onAbort);
|
|
10316
|
-
|
|
10449
|
+
resolve34();
|
|
10317
10450
|
};
|
|
10318
10451
|
const onAbort = () => finish("abort");
|
|
10319
10452
|
const timer = setTimeout(() => finish("budget"), budgetMs);
|
|
@@ -11297,9 +11430,23 @@ ${testLines.join("\n")}`;
|
|
|
11297
11430
|
}
|
|
11298
11431
|
}
|
|
11299
11432
|
});
|
|
11300
|
-
const
|
|
11433
|
+
const livePendingErrors = pendingGate.live.flatMap((entry) => entry.errors);
|
|
11434
|
+
const pendingSurvivors = new Set(filterFindingsByDisposition(livePendingErrors, cwd, (stored) => stored).kept);
|
|
11435
|
+
const unresolvedPending = [];
|
|
11436
|
+
const disposedEntries = [];
|
|
11437
|
+
let disposedPendingErrors = 0;
|
|
11438
|
+
for (const entry of pendingGate.live) {
|
|
11439
|
+
const errors = entry.errors.reduce((count, stored) => pendingSurvivors.has(stored) ? count + 1 : count, 0);
|
|
11440
|
+
disposedPendingErrors += entry.errors.length - errors;
|
|
11441
|
+
if (errors < entry.errors.length)
|
|
11442
|
+
disposedEntries.push(entry);
|
|
11443
|
+
if (errors > 0)
|
|
11444
|
+
unresolvedPending.push({ entry, errors });
|
|
11445
|
+
}
|
|
11446
|
+
const undisposedEntries = new Set(unresolvedPending.map((pending2) => pending2.entry));
|
|
11447
|
+
const unresolvedNeighbors = pendingGate.live.flatMap((entry) => undisposedEntries.has(entry) ? [entry] : []);
|
|
11301
11448
|
const changedNeighbors = pendingGate.stale;
|
|
11302
|
-
const gateKept = /* @__PURE__ */ new Set([...
|
|
11449
|
+
const gateKept = /* @__PURE__ */ new Set([...pendingGate.live, ...changedNeighbors]);
|
|
11303
11450
|
const deletedNeighbors = [];
|
|
11304
11451
|
for (const entry of pendingCandidates) {
|
|
11305
11452
|
if (gateKept.has(entry))
|
|
@@ -11312,7 +11459,7 @@ ${testLines.join("\n")}`;
|
|
|
11312
11459
|
const pendingBlocks = [];
|
|
11313
11460
|
let unresolvedShown = 0;
|
|
11314
11461
|
if (unresolvedNeighbors.length > 0) {
|
|
11315
|
-
const lines =
|
|
11462
|
+
const lines = unresolvedPending.slice(-maxShown).reverse().map((pending2) => ` \u2022 ${toRunnerDisplayPath(cwd, pending2.entry.filePath)}: ${pending2.errors} error(s) unresolved (${pendingAge(pending2.entry.checkedAt)})`);
|
|
11316
11463
|
unresolvedShown = lines.length;
|
|
11317
11464
|
const more = unresolvedNeighbors.length - lines.length;
|
|
11318
11465
|
if (more > 0)
|
|
@@ -11356,15 +11503,20 @@ ${lines.join("\n")}`);
|
|
|
11356
11503
|
}
|
|
11357
11504
|
});
|
|
11358
11505
|
}
|
|
11359
|
-
if (changedNeighbors.length + deletedNeighbors.length > 0) {
|
|
11506
|
+
if (changedNeighbors.length + deletedNeighbors.length + disposedPendingErrors > 0) {
|
|
11360
11507
|
logCascade({
|
|
11361
11508
|
phase: "cascade_pending_gated",
|
|
11362
11509
|
filePath: cascadeLogFilePath,
|
|
11363
11510
|
metadata: {
|
|
11364
11511
|
changed: changedNeighbors.length,
|
|
11365
11512
|
deleted: deletedNeighbors.length,
|
|
11513
|
+
// #5344: a pending error the project has marked is dropped from
|
|
11514
|
+
// the line, so the drop stays countable (#1616's suppressed
|
|
11515
|
+
// bucket: a finding must not vanish with no trace).
|
|
11516
|
+
disposed: disposedPendingErrors,
|
|
11366
11517
|
changedPaths: changedNeighbors.slice(0, 10).map((e) => e.filePath),
|
|
11367
|
-
deletedPaths: deletedNeighbors.slice(0, 10).map((e) => e.filePath)
|
|
11518
|
+
deletedPaths: deletedNeighbors.slice(0, 10).map((e) => e.filePath),
|
|
11519
|
+
disposedPaths: disposedEntries.slice(0, 10).map((e) => e.filePath)
|
|
11368
11520
|
}
|
|
11369
11521
|
});
|
|
11370
11522
|
}
|
|
@@ -12758,8 +12910,8 @@ ${lines.join("\n")}`;
|
|
|
12758
12910
|
} else {
|
|
12759
12911
|
const callGraphStart = Date.now();
|
|
12760
12912
|
try {
|
|
12761
|
-
const { impact, formatImpact, parseSymbolKey } = await import("../chunk-
|
|
12762
|
-
const { callGraphImpactToProjectDiagnostics } = await import("../chunk-
|
|
12913
|
+
const { impact, formatImpact, parseSymbolKey } = await import("../chunk-AFNPNHJV.js");
|
|
12914
|
+
const { callGraphImpactToProjectDiagnostics } = await import("../chunk-5RLEDUUE.js");
|
|
12763
12915
|
const impactLines = [];
|
|
12764
12916
|
let callGraphDispositionSuppressed = 0;
|
|
12765
12917
|
const impactFindings = [];
|
|
@@ -13778,10 +13930,10 @@ var TurnEndQueue = class {
|
|
|
13778
13930
|
if (this.pending.length >= 1) {
|
|
13779
13931
|
return Promise.reject(new Error("turn_end queue is busy"));
|
|
13780
13932
|
}
|
|
13781
|
-
return new Promise((
|
|
13933
|
+
return new Promise((resolve34, reject) => {
|
|
13782
13934
|
const item = {
|
|
13783
13935
|
work,
|
|
13784
|
-
resolve:
|
|
13936
|
+
resolve: resolve34,
|
|
13785
13937
|
reject,
|
|
13786
13938
|
timer: setTimeout(() => {
|
|
13787
13939
|
const index = this.pending.indexOf(item);
|
|
@@ -14435,8 +14587,12 @@ var PRESET_AXES = {
|
|
|
14435
14587
|
"full-text": { projection: "full", format: "text" },
|
|
14436
14588
|
"full-json": { projection: "full", format: "json" }
|
|
14437
14589
|
};
|
|
14590
|
+
var PRESET_ALIASES = {
|
|
14591
|
+
json: "full-json"
|
|
14592
|
+
};
|
|
14438
14593
|
function resolveModuleReportPreset(view, maxRefsPerSymbol) {
|
|
14439
|
-
const
|
|
14594
|
+
const name = typeof view === "string" && Object.hasOwn(PRESET_ALIASES, view) ? PRESET_ALIASES[view] : view;
|
|
14595
|
+
const axes = typeof name === "string" && Object.hasOwn(PRESET_AXES, name) ? PRESET_AXES[name] : PRESET_AXES["summary-text"];
|
|
14440
14596
|
if (typeof maxRefsPerSymbol === "number" && Number.isFinite(maxRefsPerSymbol)) {
|
|
14441
14597
|
const format = axes.format;
|
|
14442
14598
|
return {
|
|
@@ -14537,7 +14693,7 @@ function blastReadArgs(graph, normalizedFile) {
|
|
|
14537
14693
|
return { path: normalizedFile, offset: 1, limit };
|
|
14538
14694
|
}
|
|
14539
14695
|
async function computeBlastRadius(graph, normalizedPath, projectRoot, maxDepth) {
|
|
14540
|
-
const { computeTransitiveImpact } = await import("../chunk-
|
|
14696
|
+
const { computeTransitiveImpact } = await import("../chunk-GTNO6F6K.js");
|
|
14541
14697
|
const result = computeTransitiveImpact(graph, normalizedPath, { maxDepth });
|
|
14542
14698
|
const byFile = /* @__PURE__ */ new Map();
|
|
14543
14699
|
for (const hit of result.hits) {
|
|
@@ -15154,7 +15310,7 @@ async function moduleReport(file, cwd, options) {
|
|
|
15154
15310
|
let callGraphIdentity;
|
|
15155
15311
|
let revisionDriftNote;
|
|
15156
15312
|
try {
|
|
15157
|
-
const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-
|
|
15313
|
+
const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-B4K6OSLL.js");
|
|
15158
15314
|
graph = getCachedReviewGraph(cwd);
|
|
15159
15315
|
graphFileCap = getReviewGraphSizeSkipVerdict(cwd)?.maxFileCount;
|
|
15160
15316
|
const drift = graph ? getReviewGraphRevisionDrift(cwd) : void 0;
|
|
@@ -15743,6 +15899,8 @@ async function readEnclosing(file, line, cwd, options) {
|
|
|
15743
15899
|
const startedAt = Date.now();
|
|
15744
15900
|
const absPath = path26.resolve(cwd, file);
|
|
15745
15901
|
const targetLine = Math.max(1, Math.floor(line));
|
|
15902
|
+
const maxLines = options?.maxLines !== void 0 && Number.isFinite(options.maxLines) ? Math.max(1, Math.floor(options.maxLines)) : void 0;
|
|
15903
|
+
const aroundLine = options?.aroundLine !== void 0 && Number.isFinite(options.aroundLine) ? options.aroundLine : void 0;
|
|
15746
15904
|
const log = (found) => {
|
|
15747
15905
|
logLatency({
|
|
15748
15906
|
type: "phase",
|
|
@@ -15837,8 +15995,8 @@ async function readEnclosing(file, line, cwd, options) {
|
|
|
15837
15995
|
}
|
|
15838
15996
|
const lines = content.split(/\r?\n/);
|
|
15839
15997
|
const limit = selected.endLine - selected.startLine + 1;
|
|
15840
|
-
if (
|
|
15841
|
-
const oversize = options
|
|
15998
|
+
if (maxLines !== void 0 && limit > maxLines) {
|
|
15999
|
+
const oversize = options?.onOversize ?? "error";
|
|
15842
16000
|
const base = {
|
|
15843
16001
|
path: absPath,
|
|
15844
16002
|
line: targetLine,
|
|
@@ -15853,7 +16011,7 @@ async function readEnclosing(file, line, cwd, options) {
|
|
|
15853
16011
|
...warnings.length > 0 ? { warnings } : {}
|
|
15854
16012
|
};
|
|
15855
16013
|
if (oversize === "slice") {
|
|
15856
|
-
const sliceLimit = Math.max(1, Math.floor(
|
|
16014
|
+
const sliceLimit = Math.max(1, Math.floor(aroundLine ?? maxLines ?? 80));
|
|
15857
16015
|
const slice = clampSliceRange(targetLine, selected.startLine, selected.endLine, sliceLimit);
|
|
15858
16016
|
const source2 = lines.slice(slice.startLine - 1, slice.endLine).join("\n");
|
|
15859
16017
|
log(true);
|
|
@@ -15882,14 +16040,14 @@ async function readEnclosing(file, line, cwd, options) {
|
|
|
15882
16040
|
confidence: "medium"
|
|
15883
16041
|
},
|
|
15884
16042
|
outline: enclosingOutline(selected, symbols, callbacks, filters, absPath),
|
|
15885
|
-
error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${
|
|
16043
|
+
error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${maxLines}`
|
|
15886
16044
|
};
|
|
15887
16045
|
}
|
|
15888
16046
|
log(false);
|
|
15889
16047
|
return {
|
|
15890
16048
|
...base,
|
|
15891
16049
|
found: false,
|
|
15892
|
-
error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${
|
|
16050
|
+
error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${maxLines}`
|
|
15893
16051
|
};
|
|
15894
16052
|
}
|
|
15895
16053
|
const source = lines.slice(selected.startLine - 1, selected.endLine).join("\n");
|
|
@@ -16063,7 +16221,7 @@ function roleFor(graph, filePath) {
|
|
|
16063
16221
|
return top.length > 0 ? top.map((s) => s.name).join(", ") : void 0;
|
|
16064
16222
|
}
|
|
16065
16223
|
async function computeHubs(graph, degrees, cwd, limit, focusTerms) {
|
|
16066
|
-
const { computeTransitiveImpact } = await import("../chunk-
|
|
16224
|
+
const { computeTransitiveImpact } = await import("../chunk-GTNO6F6K.js");
|
|
16067
16225
|
const ranked = [...graph.fileNodes.entries()].map(([filePath, fileNodeId]) => ({
|
|
16068
16226
|
filePath,
|
|
16069
16227
|
fileNodeId,
|
|
@@ -16314,7 +16472,7 @@ function triggerBackgroundGraphBuild(cwd, deps) {
|
|
|
16314
16472
|
async function projectReport(cwd, options) {
|
|
16315
16473
|
const limit = clampLimit(options?.limit);
|
|
16316
16474
|
const focusTerms = normalizeFocus2(options?.focus);
|
|
16317
|
-
const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-
|
|
16475
|
+
const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-B4K6OSLL.js");
|
|
16318
16476
|
let graph;
|
|
16319
16477
|
try {
|
|
16320
16478
|
graph = getCachedReviewGraph(cwd);
|
|
@@ -16337,7 +16495,7 @@ async function projectReport(cwd, options) {
|
|
|
16337
16495
|
};
|
|
16338
16496
|
}
|
|
16339
16497
|
const previousAttempt = getLastReviewGraphBuildAttempt(cwd);
|
|
16340
|
-
const { FactStore: FactStore2 } = await import("../chunk-
|
|
16498
|
+
const { FactStore: FactStore2 } = await import("../chunk-X33QECRJ.js");
|
|
16341
16499
|
const trigger = triggerBackgroundGraphBuild(cwd, {
|
|
16342
16500
|
buildOrUpdateGraph,
|
|
16343
16501
|
isGraphBuildInFlight,
|
|
@@ -16372,6 +16530,9 @@ async function projectReport(cwd, options) {
|
|
|
16372
16530
|
deadWeight
|
|
16373
16531
|
};
|
|
16374
16532
|
}
|
|
16533
|
+
function projectReportViewIsJson(view) {
|
|
16534
|
+
return resolveModuleReportPreset(view).format === "json";
|
|
16535
|
+
}
|
|
16375
16536
|
function renderTextProjectReport(report) {
|
|
16376
16537
|
if (!report.available) {
|
|
16377
16538
|
const lines2 = [
|
|
@@ -16660,9 +16821,11 @@ async function effectiveConfig(options = {}) {
|
|
|
16660
16821
|
};
|
|
16661
16822
|
return view;
|
|
16662
16823
|
}
|
|
16663
|
-
function toolReason(selected, disabled, kind) {
|
|
16824
|
+
function toolReason(selected, disabled, lacksConfig, kind) {
|
|
16664
16825
|
if (disabled)
|
|
16665
16826
|
return "disabled-by-config";
|
|
16827
|
+
if (selected && lacksConfig)
|
|
16828
|
+
return "no-project-config";
|
|
16666
16829
|
if (selected)
|
|
16667
16830
|
return "selected";
|
|
16668
16831
|
return kind === void 0 ? "no-dispatch-plan" : "not-registered-for-kind";
|
|
@@ -16698,16 +16861,22 @@ async function fileView(absolute, resolution, resolved, homeDir, workspaceCwd, l
|
|
|
16698
16861
|
const planned = kind ? getToolPlan(kind)?.groups.flatMap((group) => group.runnerIds) ?? [] : [];
|
|
16699
16862
|
const disabledRunners = new Map(disabledRunnersOf(resolution).runners.map((runner) => [runner.id, runner]));
|
|
16700
16863
|
const ids = [.../* @__PURE__ */ new Set([...planned, ...available])].sort(compareOrdinal);
|
|
16701
|
-
const
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
|
|
16708
|
-
|
|
16709
|
-
|
|
16710
|
-
|
|
16864
|
+
const runnerCwdOf = (id) => resolveToolCwd("runner", id, absolute, {
|
|
16865
|
+
cwd: workspaceCwd,
|
|
16866
|
+
suppressTelemetry: true
|
|
16867
|
+
}).cwd;
|
|
16868
|
+
const wouldRun = new Set(await getAvailableRunners(absolute, { configCwd: runnerCwdOf }));
|
|
16869
|
+
const tools = ids.map((id) => {
|
|
16870
|
+
const denied2 = disabledRunners.has(id);
|
|
16871
|
+
const lacksConfig = available.has(id) && !wouldRun.has(id);
|
|
16872
|
+
return {
|
|
16873
|
+
id,
|
|
16874
|
+
selected: available.has(id) && !denied2 && !lacksConfig,
|
|
16875
|
+
reason: toolReason(available.has(id), denied2, lacksConfig, kind),
|
|
16876
|
+
...decidedByOrNothing(viewOf(disabledRunners.get(id)?.decidedBy, homeDir)),
|
|
16877
|
+
resolvedCwd: homeRelativePath(runnerCwdOf(id), homeDir)
|
|
16878
|
+
};
|
|
16879
|
+
});
|
|
16711
16880
|
return {
|
|
16712
16881
|
path: homeRelativePath(absolute, homeDir),
|
|
16713
16882
|
...language === void 0 ? {} : { language: language.id },
|
|
@@ -16789,46 +16958,52 @@ function resourceFootprint() {
|
|
|
16789
16958
|
return getResourceFootprint();
|
|
16790
16959
|
}
|
|
16791
16960
|
function symbolSearchFileMatchesLang(file, lang) {
|
|
16792
|
-
const
|
|
16793
|
-
|
|
16794
|
-
if (declared && (declared.id === token || declared.grammar === token)) {
|
|
16795
|
-
return true;
|
|
16796
|
-
}
|
|
16797
|
-
const base = path29.basename(file);
|
|
16798
|
-
if (SPECIAL_FILENAMES.some((entry) => entry.kind === token && entry.pattern.test(base))) {
|
|
16799
|
-
return true;
|
|
16800
|
-
}
|
|
16801
|
-
const exts = extensionsForLanguageToken(token);
|
|
16802
|
-
if (exts.length === 0)
|
|
16803
|
-
return false;
|
|
16804
|
-
return exts.includes(path29.extname(file).toLowerCase());
|
|
16805
|
-
}
|
|
16806
|
-
function fileMatchesPathGlobs(file, cwd, globs) {
|
|
16807
|
-
const rel = path29.relative(cwd, file).split(path29.sep).join("/");
|
|
16808
|
-
const abs = path29.resolve(file).split(path29.sep).join("/");
|
|
16809
|
-
const options = { dot: true, nocase: process.platform === "win32" };
|
|
16810
|
-
const matches = (candidate, pattern) => minimatch(candidate, pattern, options) || minimatch(candidate, `${pattern}/**`, options);
|
|
16811
|
-
return globs.some((raw) => {
|
|
16812
|
-
const within = path29.isAbsolute(raw) ? relativeInside(cwd, raw) : void 0;
|
|
16813
|
-
if (within !== void 0)
|
|
16814
|
-
return matches(rel, toPosix(within) || "**");
|
|
16815
|
-
const pattern = toPosix(raw);
|
|
16816
|
-
return matches(rel, pattern) || abs !== rel && matches(abs, pattern);
|
|
16817
|
-
});
|
|
16961
|
+
const scope = resolveLanguageScope(lang);
|
|
16962
|
+
return "refusal" in scope ? false : scope.matches(file);
|
|
16818
16963
|
}
|
|
16819
16964
|
function buildSymbolSearchFileFilter(cwd, options) {
|
|
16820
16965
|
const paths = options.paths;
|
|
16821
16966
|
const lang = options.lang?.trim();
|
|
16822
16967
|
if (!paths?.length && !lang)
|
|
16823
16968
|
return void 0;
|
|
16969
|
+
const scope = paths?.length ? scopeEntryKeys(cwd, paths) : void 0;
|
|
16824
16970
|
return (file) => {
|
|
16825
|
-
if (
|
|
16971
|
+
if (scope && !fileIsInScope(file, scope))
|
|
16826
16972
|
return false;
|
|
16827
16973
|
if (lang && !symbolSearchFileMatchesLang(file, lang))
|
|
16828
16974
|
return false;
|
|
16829
16975
|
return true;
|
|
16830
16976
|
};
|
|
16831
16977
|
}
|
|
16978
|
+
function scopeEntryKeys(cwd, paths) {
|
|
16979
|
+
return new Set(paths.map((entry) => normalizeEphemeralMapKey(path29.resolve(cwd, entry))));
|
|
16980
|
+
}
|
|
16981
|
+
function fileIsInScope(file, scope) {
|
|
16982
|
+
let key = normalizeEphemeralMapKey(path29.resolve(file));
|
|
16983
|
+
for (; ; ) {
|
|
16984
|
+
if (scope.has(key))
|
|
16985
|
+
return true;
|
|
16986
|
+
const cut = key.lastIndexOf("/");
|
|
16987
|
+
if (cut < 0)
|
|
16988
|
+
return false;
|
|
16989
|
+
key = key.slice(0, cut);
|
|
16990
|
+
if (!key.includes("/"))
|
|
16991
|
+
return scope.has(`${key}/`);
|
|
16992
|
+
}
|
|
16993
|
+
}
|
|
16994
|
+
function unknownLangRefusal(query, lang) {
|
|
16995
|
+
const tokens = lang?.trim() ? [lang] : [];
|
|
16996
|
+
for (const entry of parseWordIndexQuery(query).filters) {
|
|
16997
|
+
if (entry.key === "lang")
|
|
16998
|
+
tokens.push(entry.value);
|
|
16999
|
+
}
|
|
17000
|
+
for (const token of tokens) {
|
|
17001
|
+
const scope = resolveLanguageScope(token);
|
|
17002
|
+
if ("refusal" in scope)
|
|
17003
|
+
return scope.refusal;
|
|
17004
|
+
}
|
|
17005
|
+
return void 0;
|
|
17006
|
+
}
|
|
16832
17007
|
function annotateSymbolSearchHitsWithGraph(hits, centrality, graph) {
|
|
16833
17008
|
for (const hit of hits) {
|
|
16834
17009
|
const normalized = normalizeMapKey(path29.resolve(hit.file));
|
|
@@ -16846,11 +17021,16 @@ function annotateSymbolSearchHitsWithGraph(hits, centrality, graph) {
|
|
|
16846
17021
|
};
|
|
16847
17022
|
}
|
|
16848
17023
|
}
|
|
17024
|
+
var SYMBOL_SEARCH_EMPTY_QUERY_REFUSAL = "Provide a non-empty `query`, or scope the search with `paths`/`lang` or an inline `lang:`/`file:`/`ext:` filter.";
|
|
16849
17025
|
function toSymbolSearchHit(result) {
|
|
17026
|
+
if (result.kind === "file") {
|
|
17027
|
+
return { file: result.file, score: result.score, kind: "file" };
|
|
17028
|
+
}
|
|
16850
17029
|
const line = result.lines[0] ?? 1;
|
|
16851
17030
|
return {
|
|
16852
17031
|
file: result.file,
|
|
16853
17032
|
score: result.score,
|
|
17033
|
+
kind: "symbol",
|
|
16854
17034
|
hits: result.hits,
|
|
16855
17035
|
startLine: line,
|
|
16856
17036
|
endLine: line
|
|
@@ -16858,6 +17038,18 @@ function toSymbolSearchHit(result) {
|
|
|
16858
17038
|
}
|
|
16859
17039
|
async function symbolSearch(query, cwd, limit = 20, options = {}) {
|
|
16860
17040
|
const effectiveLimit = Number.isFinite(limit) ? Math.max(1, Math.floor(limit)) : 20;
|
|
17041
|
+
if (isEmptyWordIndexQuery(query) && !options.paths?.length && !options.lang?.trim()) {
|
|
17042
|
+
return {
|
|
17043
|
+
available: true,
|
|
17044
|
+
query,
|
|
17045
|
+
results: [],
|
|
17046
|
+
refusal: SYMBOL_SEARCH_EMPTY_QUERY_REFUSAL
|
|
17047
|
+
};
|
|
17048
|
+
}
|
|
17049
|
+
const unknownLang = unknownLangRefusal(query, options.lang);
|
|
17050
|
+
if (unknownLang) {
|
|
17051
|
+
return { available: true, query, results: [], refusal: unknownLang };
|
|
17052
|
+
}
|
|
16861
17053
|
const warmLease = acquireWarmWordIndex(cwd);
|
|
16862
17054
|
const snapshot = loadProjectSnapshotWithoutWordIndex(cwd);
|
|
16863
17055
|
const index = warmLease.index;
|
|
@@ -16889,7 +17081,7 @@ async function symbolSearch(query, cwd, limit = 20, options = {}) {
|
|
|
16889
17081
|
warmLease.release();
|
|
16890
17082
|
}
|
|
16891
17083
|
const hits = results.map(toSymbolSearchHit);
|
|
16892
|
-
const { getCachedReviewGraph } = await import("../chunk-
|
|
17084
|
+
const { getCachedReviewGraph } = await import("../chunk-B4K6OSLL.js");
|
|
16893
17085
|
const graph = getCachedReviewGraph(cwd);
|
|
16894
17086
|
if (graph)
|
|
16895
17087
|
annotateSymbolSearchHitsWithGraph(hits, centrality, graph);
|
|
@@ -16907,6 +17099,9 @@ function coverageLine(coverage) {
|
|
|
16907
17099
|
return `Index covers ${coverage.files} files${coverage.truncated ? " (capped \u2014 results may be incomplete)" : ""}.`;
|
|
16908
17100
|
}
|
|
16909
17101
|
function formatSymbolSearchRow(hit, position, cwd) {
|
|
17102
|
+
const file = path29.relative(cwd, hit.file);
|
|
17103
|
+
if (hit.kind === "file")
|
|
17104
|
+
return ` ${position}. ${file}`;
|
|
16910
17105
|
const annotations = hit.annotations;
|
|
16911
17106
|
const detail = [
|
|
16912
17107
|
`score ${hit.score.toFixed(2)}`,
|
|
@@ -16914,7 +17109,7 @@ function formatSymbolSearchRow(hit, position, cwd) {
|
|
|
16914
17109
|
...typeof annotations?.fanIn === "number" ? [`fanIn ${annotations.fanIn}`] : [],
|
|
16915
17110
|
...typeof annotations?.complexity === "number" ? [`complexity ${annotations.complexity}`] : []
|
|
16916
17111
|
];
|
|
16917
|
-
return ` ${position}. ${
|
|
17112
|
+
return ` ${position}. ${file} ${hit.startLine} (${detail.join(", ")})`;
|
|
16918
17113
|
}
|
|
16919
17114
|
function renderCompactSymbolSearch(result, options) {
|
|
16920
17115
|
const hits = result.results;
|
|
@@ -16939,6 +17134,9 @@ function renderCompactSymbolSearch(result, options) {
|
|
|
16939
17134
|
return sections.join("\n\n");
|
|
16940
17135
|
}
|
|
16941
17136
|
|
|
17137
|
+
// dist/tools/ast-grep-replace.js
|
|
17138
|
+
import * as path33 from "node:path";
|
|
17139
|
+
|
|
16942
17140
|
// dist/clients/deps/typebox.js
|
|
16943
17141
|
import { Type } from "typebox";
|
|
16944
17142
|
|
|
@@ -16962,10 +17160,10 @@ function truncate(value, max) {
|
|
|
16962
17160
|
return value;
|
|
16963
17161
|
return `${value.slice(0, max)}\u2026[truncated ${value.length - max} chars]`;
|
|
16964
17162
|
}
|
|
16965
|
-
function classifyAstGrepError(
|
|
16966
|
-
if (!
|
|
17163
|
+
function classifyAstGrepError(errorMessage3) {
|
|
17164
|
+
if (!errorMessage3)
|
|
16967
17165
|
return "other";
|
|
16968
|
-
const lower =
|
|
17166
|
+
const lower = errorMessage3.toLowerCase();
|
|
16969
17167
|
if (lower.includes("multiple ast nodes are detected") || lower.includes("the pattern appears to contain multiple ast nodes")) {
|
|
16970
17168
|
return "multiple_ast_nodes";
|
|
16971
17169
|
}
|
|
@@ -17125,9 +17323,102 @@ function canonicalLanguage(lang) {
|
|
|
17125
17323
|
|
|
17126
17324
|
// dist/tools/shared.js
|
|
17127
17325
|
import * as os4 from "node:os";
|
|
17326
|
+
import * as path32 from "node:path";
|
|
17327
|
+
|
|
17328
|
+
// dist/clients/path-globs.js
|
|
17329
|
+
import * as fs19 from "node:fs";
|
|
17128
17330
|
import * as path31 from "node:path";
|
|
17331
|
+
function fileMatchesPathGlobs(file, cwd, globs) {
|
|
17332
|
+
const rel = path31.relative(cwd, file).split(path31.sep).join("/");
|
|
17333
|
+
const abs = path31.resolve(file).split(path31.sep).join("/");
|
|
17334
|
+
const options = { dot: true, nocase: process.platform === "win32" };
|
|
17335
|
+
const matches = (candidate, pattern) => minimatch(candidate, pattern, options) || minimatch(candidate, `${pattern}/**`, options);
|
|
17336
|
+
return globs.some((raw) => {
|
|
17337
|
+
const within = path31.isAbsolute(raw) ? relativeInside(cwd, raw) : void 0;
|
|
17338
|
+
if (within !== void 0)
|
|
17339
|
+
return matches(rel, toPosix(within) || "**");
|
|
17340
|
+
const pattern = toPosix(raw);
|
|
17341
|
+
return matches(rel, pattern) || abs !== rel && matches(abs, pattern);
|
|
17342
|
+
});
|
|
17343
|
+
}
|
|
17344
|
+
function hasGlobMagic(text) {
|
|
17345
|
+
return /[*?[{]/.test(text);
|
|
17346
|
+
}
|
|
17347
|
+
async function isGlobEntry(resolved, cwd) {
|
|
17348
|
+
const spelled = relativeInside(path31.resolve(cwd), resolved) ?? resolved;
|
|
17349
|
+
if (!hasGlobMagic(spelled))
|
|
17350
|
+
return false;
|
|
17351
|
+
return fs19.promises.lstat(resolved).then(() => false, (refusal) => {
|
|
17352
|
+
return refusal.code === "ENOENT" || refusal.code === "ENOTDIR";
|
|
17353
|
+
});
|
|
17354
|
+
}
|
|
17355
|
+
function literalRoot(cwd, relative8) {
|
|
17356
|
+
let root = cwd;
|
|
17357
|
+
for (const segment of relative8.split("/")) {
|
|
17358
|
+
if (hasGlobMagic(segment))
|
|
17359
|
+
break;
|
|
17360
|
+
root = path31.join(root, segment);
|
|
17361
|
+
}
|
|
17362
|
+
return root;
|
|
17363
|
+
}
|
|
17364
|
+
async function expandPathsEntry(entry, cwd, budget, options = {}) {
|
|
17365
|
+
const cwdAbsolute = path31.resolve(cwd);
|
|
17366
|
+
const absolute = path31.resolve(cwdAbsolute, entry);
|
|
17367
|
+
if (!await isGlobEntry(absolute, cwdAbsolute))
|
|
17368
|
+
return { entries: [absolute], root: cwdAbsolute };
|
|
17369
|
+
const relative8 = relativeInside(cwdAbsolute, absolute);
|
|
17370
|
+
if (relative8 === void 0) {
|
|
17371
|
+
return { entries: [], refusal: "outside", root: cwdAbsolute };
|
|
17372
|
+
}
|
|
17373
|
+
const root = literalRoot(cwdAbsolute, relative8);
|
|
17374
|
+
const { signal } = options;
|
|
17375
|
+
const matcher = getProjectIgnoreMatcher(cwdAbsolute);
|
|
17376
|
+
const policy = { ignoreMatcher: matcher };
|
|
17377
|
+
const pattern = [absolute];
|
|
17378
|
+
const maxVisited = options.maxVisited ?? DEFAULT_MAX_SCAN_ENTRIES;
|
|
17379
|
+
const matches = [];
|
|
17380
|
+
let visited = 0;
|
|
17381
|
+
let walkedTooMuch = false;
|
|
17382
|
+
await walkTreeStackAsync(
|
|
17383
|
+
root,
|
|
17384
|
+
(entry_, fullPath) => {
|
|
17385
|
+
if (signal?.aborted)
|
|
17386
|
+
return "stop";
|
|
17387
|
+
visited += 1;
|
|
17388
|
+
if (visited > maxVisited) {
|
|
17389
|
+
walkedTooMuch = true;
|
|
17390
|
+
return "stop";
|
|
17391
|
+
}
|
|
17392
|
+
if (entry_.isDirectory()) {
|
|
17393
|
+
if (!shouldRecurseIntoDir(entry_, fullPath, policy))
|
|
17394
|
+
return "skip";
|
|
17395
|
+
if (!fileMatchesPathGlobs(fullPath, cwdAbsolute, pattern))
|
|
17396
|
+
return "recurse";
|
|
17397
|
+
} else if (!entry_.isFile() || matcher.isIgnored(fullPath, false) || !fileMatchesPathGlobs(fullPath, cwdAbsolute, pattern)) {
|
|
17398
|
+
return "skip";
|
|
17399
|
+
}
|
|
17400
|
+
matches.push(fullPath);
|
|
17401
|
+
return matches.length > budget ? "stop" : "skip";
|
|
17402
|
+
},
|
|
17403
|
+
// Yield off the event loop per budget slice: a glob can name a whole
|
|
17404
|
+
// workspace, and a tool call must not hold pi's TUI (#1137).
|
|
17405
|
+
{ budgetMs: 8, beforeWalk: () => matcher.ensureTrackedIndex() }
|
|
17406
|
+
);
|
|
17407
|
+
if (signal?.aborted)
|
|
17408
|
+
return { entries: [], refusal: "aborted", root };
|
|
17409
|
+
if (walkedTooMuch)
|
|
17410
|
+
return { entries: [], refusal: "over-walk", root };
|
|
17411
|
+
if (matches.length > budget)
|
|
17412
|
+
return { entries: [], refusal: "over-cap", root };
|
|
17413
|
+
if (matches.length === 0)
|
|
17414
|
+
return { entries: [], refusal: "no-match", root };
|
|
17415
|
+
return { entries: matches, root };
|
|
17416
|
+
}
|
|
17417
|
+
|
|
17418
|
+
// dist/tools/shared.js
|
|
17129
17419
|
var MAX_PATHS_ENTRIES = 100;
|
|
17130
17420
|
var FILE_PATH_KEYS = ["path", "file", "filePath"];
|
|
17421
|
+
var CONSTRAINED_JSON_SCHEMA_SAMPLING = { type: "json_schema", strict: "prefer" };
|
|
17131
17422
|
function readFilePath(params) {
|
|
17132
17423
|
const sent = [];
|
|
17133
17424
|
const blanks = [];
|
|
@@ -17156,6 +17447,14 @@ function readFilePath(params) {
|
|
|
17156
17447
|
}
|
|
17157
17448
|
return { path: first.value, key: first.key };
|
|
17158
17449
|
}
|
|
17450
|
+
var PATHS_GLOB_CLAUSE = "A glob entry (e.g. `src/**/*.ts`) expands to the files it matches; one matching none is refused (`no file matches`).";
|
|
17451
|
+
function overCapRefusal(entry) {
|
|
17452
|
+
const what = entry === void 0 ? "`paths`" : `the glob \`${entry}\``;
|
|
17453
|
+
return {
|
|
17454
|
+
entries: [],
|
|
17455
|
+
refusal: `${what} names more than ${MAX_PATHS_ENTRIES} files \u2014 narrow the pattern, or pass a directory entry`
|
|
17456
|
+
};
|
|
17457
|
+
}
|
|
17159
17458
|
function describeEntryType(value) {
|
|
17160
17459
|
if (value === null)
|
|
17161
17460
|
return "null";
|
|
@@ -17163,11 +17462,11 @@ function describeEntryType(value) {
|
|
|
17163
17462
|
return "an array";
|
|
17164
17463
|
return typeof value;
|
|
17165
17464
|
}
|
|
17166
|
-
function readPathsArgument(raw, options) {
|
|
17465
|
+
async function readPathsArgument(raw, options) {
|
|
17167
17466
|
const base = options.cwd || ".";
|
|
17168
17467
|
const absent = options.absent ?? "none";
|
|
17169
17468
|
if (raw === void 0 || raw === null) {
|
|
17170
|
-
return { entries: absent === "cwd" ? [
|
|
17469
|
+
return { entries: absent === "cwd" ? [path32.resolve(base)] : [] };
|
|
17171
17470
|
}
|
|
17172
17471
|
if (!Array.isArray(raw))
|
|
17173
17472
|
return { entries: [], refusal: "paths must be an array of strings" };
|
|
@@ -17190,8 +17489,40 @@ function readPathsArgument(raw, options) {
|
|
|
17190
17489
|
};
|
|
17191
17490
|
if (!entry.trim())
|
|
17192
17491
|
return { entries: [], refusal: `paths entry ${index + 1} is blank` };
|
|
17193
|
-
|
|
17492
|
+
if (entry.trimStart().startsWith("!"))
|
|
17493
|
+
return {
|
|
17494
|
+
entries: [],
|
|
17495
|
+
refusal: `paths entry ${index + 1} starts with "!": \`paths\` names the entries to include, not the ones to leave out, and a negated entry names every other file. Name the entries you want, or ignore what you do not want through the project ignore config.`
|
|
17496
|
+
};
|
|
17497
|
+
const resolved = resolveHostToolPath(entry, base);
|
|
17498
|
+
const expanded = await expandPathsEntry(resolved, base, options.filterOnly ? Number.POSITIVE_INFINITY : MAX_PATHS_ENTRIES - entries.length, { signal: options.signal });
|
|
17499
|
+
if (expanded.refusal === "no-match") {
|
|
17500
|
+
return {
|
|
17501
|
+
entries: [],
|
|
17502
|
+
refusal: `no file matches \`${entry}\` \u2014 the glob matched no file under ${expanded.root}`
|
|
17503
|
+
};
|
|
17504
|
+
}
|
|
17505
|
+
if (expanded.refusal === "over-cap")
|
|
17506
|
+
return overCapRefusal(entry);
|
|
17507
|
+
if (expanded.refusal === "over-walk") {
|
|
17508
|
+
return {
|
|
17509
|
+
entries: [],
|
|
17510
|
+
refusal: `the glob \`${entry}\` walked more than ${DEFAULT_MAX_SCAN_ENTRIES} entries under ${expanded.root} without finishing \u2014 name a deeper directory, or narrow the pattern`
|
|
17511
|
+
};
|
|
17512
|
+
}
|
|
17513
|
+
if (expanded.refusal === "outside") {
|
|
17514
|
+
return {
|
|
17515
|
+
entries: [],
|
|
17516
|
+
refusal: `the glob \`${entry}\` reaches outside the workspace ${expanded.root} \u2014 a glob expands inside the workspace only; name a file or directory outside it literally`
|
|
17517
|
+
};
|
|
17518
|
+
}
|
|
17519
|
+
if (expanded.refusal === "aborted") {
|
|
17520
|
+
return { entries: [], refusal: "paths expansion aborted" };
|
|
17521
|
+
}
|
|
17522
|
+
entries.push(...expanded.entries);
|
|
17194
17523
|
}
|
|
17524
|
+
if (!options.filterOnly && entries.length > MAX_PATHS_ENTRIES)
|
|
17525
|
+
return overCapRefusal(void 0);
|
|
17195
17526
|
return { entries };
|
|
17196
17527
|
}
|
|
17197
17528
|
function defaultedCwdHomeRefusal(paths, cwd) {
|
|
@@ -17261,7 +17592,7 @@ function lineCount(value) {
|
|
|
17261
17592
|
}
|
|
17262
17593
|
return lines;
|
|
17263
17594
|
}
|
|
17264
|
-
function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
17595
|
+
function createAstGrepReplaceTool(astGrepClient2, captureLineage, getFlag) {
|
|
17265
17596
|
return {
|
|
17266
17597
|
name: "ast_grep_replace",
|
|
17267
17598
|
label: "AST Replace",
|
|
@@ -17278,6 +17609,7 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17278
17609
|
const state = details?.applied ? "applied" : "preview";
|
|
17279
17610
|
return `ast_grep_replace \u2014 ${n} match${n === 1 ? "" : "es"}, ${state}`;
|
|
17280
17611
|
}),
|
|
17612
|
+
constrainedSampling: CONSTRAINED_JSON_SCHEMA_SAMPLING,
|
|
17281
17613
|
parameters: Type.Object({
|
|
17282
17614
|
pattern: Type.String({
|
|
17283
17615
|
description: "AST pattern to match (be specific with context)"
|
|
@@ -17288,7 +17620,9 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17288
17620
|
lang: Type.String({
|
|
17289
17621
|
description: "Language id, e.g. typescript, tsx, python, go."
|
|
17290
17622
|
}),
|
|
17291
|
-
paths: Type.Optional(Type.Array(Type.String(), {
|
|
17623
|
+
paths: Type.Optional(Type.Array(Type.String(), {
|
|
17624
|
+
description: `Specific files/folders. ${PATHS_GLOB_CLAUSE}`
|
|
17625
|
+
})),
|
|
17292
17626
|
insideKind: Type.Optional(Type.String({
|
|
17293
17627
|
description: "Ancestor AST node kind filter."
|
|
17294
17628
|
})),
|
|
@@ -17312,6 +17646,19 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17312
17646
|
}),
|
|
17313
17647
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
17314
17648
|
const lineage = captureLineage?.();
|
|
17649
|
+
const signal = combineAbortSignals(_signal, ctx.signal);
|
|
17650
|
+
const failureText = (failure, written = []) => {
|
|
17651
|
+
const lines = [
|
|
17652
|
+
failure.aborted ? "Error: operation aborted" : errorTextWithHint(failure.error ?? "")
|
|
17653
|
+
];
|
|
17654
|
+
if (written.length > 0) {
|
|
17655
|
+
lines.push(`${written.length} file(s) were already rewritten before it stopped: ${written.join(", ")}`);
|
|
17656
|
+
}
|
|
17657
|
+
if (failure.writeStarted) {
|
|
17658
|
+
lines.push("The write had started, so some files may already be rewritten.");
|
|
17659
|
+
}
|
|
17660
|
+
return lines.join("\n");
|
|
17661
|
+
};
|
|
17315
17662
|
const sessionId = ctx.sessionManager?.getSessionId?.();
|
|
17316
17663
|
const startedAt = Date.now();
|
|
17317
17664
|
const { pattern, rewrite, paths, apply, strictness, insideKind, hasKind, hasDescendantKind, follows, precedes } = params;
|
|
@@ -17348,9 +17695,10 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17348
17695
|
details: {}
|
|
17349
17696
|
};
|
|
17350
17697
|
}
|
|
17351
|
-
const pathsRead = readPathsArgument(paths, {
|
|
17698
|
+
const pathsRead = await readPathsArgument(paths, {
|
|
17352
17699
|
cwd: ctx.cwd,
|
|
17353
|
-
absent: "cwd"
|
|
17700
|
+
absent: "cwd",
|
|
17701
|
+
signal
|
|
17354
17702
|
});
|
|
17355
17703
|
if (pathsRead.refusal) {
|
|
17356
17704
|
logOutcome("error", { errorRaw: pathsRead.refusal });
|
|
@@ -17385,6 +17733,16 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17385
17733
|
};
|
|
17386
17734
|
}
|
|
17387
17735
|
const searchPaths = pathsRead.entries;
|
|
17736
|
+
const sessionRoot = path33.resolve(ctx.cwd ?? process.cwd());
|
|
17737
|
+
if (applyFlag && getFlag?.("no-autofix", sessionRoot)) {
|
|
17738
|
+
const reason = "ast_grep_replace refused: apply is disabled by the no-autofix flag (autofix.enabled=false); a preview with apply: false is still allowed";
|
|
17739
|
+
logOutcome("error", { errorRaw: reason });
|
|
17740
|
+
return {
|
|
17741
|
+
content: [{ type: "text", text: `Error: ${reason}` }],
|
|
17742
|
+
isError: true,
|
|
17743
|
+
details: {}
|
|
17744
|
+
};
|
|
17745
|
+
}
|
|
17388
17746
|
if (hasStructuralIntent({
|
|
17389
17747
|
insideKind,
|
|
17390
17748
|
hasKind,
|
|
@@ -17417,7 +17775,7 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17417
17775
|
details: {}
|
|
17418
17776
|
};
|
|
17419
17777
|
}
|
|
17420
|
-
const ruleResult = await astGrepClient2.replaceWithRule(ruleYaml, searchPaths, applyFlag, { lineage, toolCallId: _toolCallId, sessionId });
|
|
17778
|
+
const ruleResult = await astGrepClient2.replaceWithRule(ruleYaml, searchPaths, applyFlag, { lineage, toolCallId: _toolCallId, sessionId, signal, sessionRoot });
|
|
17421
17779
|
if (ruleResult.stalePreview) {
|
|
17422
17780
|
logOutcome("error", { errorRaw: "stale_preview" });
|
|
17423
17781
|
return {
|
|
@@ -17441,7 +17799,7 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17441
17799
|
content: [
|
|
17442
17800
|
{
|
|
17443
17801
|
type: "text",
|
|
17444
|
-
text:
|
|
17802
|
+
text: failureText(ruleResult, applyFlag ? [...new Set(ruleResult.matches.map((m) => m.file))] : [])
|
|
17445
17803
|
}
|
|
17446
17804
|
],
|
|
17447
17805
|
isError: true,
|
|
@@ -17463,7 +17821,14 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17463
17821
|
}
|
|
17464
17822
|
};
|
|
17465
17823
|
}
|
|
17466
|
-
const result = await astGrepClient2.replace(pattern, rewrite, lang, searchPaths, applyFlag, {
|
|
17824
|
+
const result = await astGrepClient2.replace(pattern, rewrite, lang, searchPaths, applyFlag, {
|
|
17825
|
+
strictness,
|
|
17826
|
+
lineage,
|
|
17827
|
+
toolCallId: _toolCallId,
|
|
17828
|
+
sessionId,
|
|
17829
|
+
signal,
|
|
17830
|
+
sessionRoot
|
|
17831
|
+
});
|
|
17467
17832
|
if (result.stalePreview) {
|
|
17468
17833
|
logOutcome("error", { errorRaw: "stale_preview" });
|
|
17469
17834
|
return {
|
|
@@ -17480,11 +17845,11 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17480
17845
|
if (result.error) {
|
|
17481
17846
|
logOutcome("error", { errorRaw: result.error });
|
|
17482
17847
|
return {
|
|
17483
|
-
content: [
|
|
17484
|
-
{ type: "text", text: errorTextWithHint(result.error) }
|
|
17485
|
-
],
|
|
17848
|
+
content: [{ type: "text", text: failureText(result) }],
|
|
17486
17849
|
isError: true,
|
|
17487
|
-
|
|
17850
|
+
// #5417: an interrupted `--update-all` rewrote files before it
|
|
17851
|
+
// failed; they still dispatch, as the structural path's do.
|
|
17852
|
+
details: { appliedFiles: result.appliedFiles ?? [] }
|
|
17488
17853
|
};
|
|
17489
17854
|
}
|
|
17490
17855
|
const isDryRun = !applyFlag;
|
|
@@ -17745,6 +18110,7 @@ function createAstGrepSearchTool(astGrepClient2) {
|
|
|
17745
18110
|
const applied = details?.applied ? " (applied)" : "";
|
|
17746
18111
|
return `ast_grep_search \u2014 ${count}${ofTotal} match${count === 1 && !ofTotal ? "" : "es"}${applied}`;
|
|
17747
18112
|
}),
|
|
18113
|
+
constrainedSampling: CONSTRAINED_JSON_SCHEMA_SAMPLING,
|
|
17748
18114
|
parameters: Type.Object({
|
|
17749
18115
|
dump: Type.Optional(Type.Boolean()),
|
|
17750
18116
|
pattern: Type.Optional(Type.String({ description: "AST pattern." })),
|
|
@@ -17753,7 +18119,7 @@ function createAstGrepSearchTool(astGrepClient2) {
|
|
|
17753
18119
|
}),
|
|
17754
18120
|
paths: Type.Optional(Type.Array(Type.String(), {
|
|
17755
18121
|
maxItems: MAX_PATHS_ENTRIES,
|
|
17756
|
-
description:
|
|
18122
|
+
description: `Files or directories to search. ${PATHS_GLOB_CLAUSE}`
|
|
17757
18123
|
})),
|
|
17758
18124
|
selector: Type.Optional(Type.String({
|
|
17759
18125
|
description: "AST node kind filter."
|
|
@@ -17855,9 +18221,10 @@ function createAstGrepSearchTool(astGrepClient2) {
|
|
|
17855
18221
|
const hasPattern = Boolean(pattern.trim());
|
|
17856
18222
|
const hasNodeKind = normalizedNodeKind.length > 0;
|
|
17857
18223
|
const rawPaths = params.paths;
|
|
17858
|
-
const pathsRead = readPathsArgument(rawPaths, {
|
|
18224
|
+
const pathsRead = await readPathsArgument(rawPaths, {
|
|
17859
18225
|
cwd: ctx.cwd,
|
|
17860
|
-
absent: "cwd"
|
|
18226
|
+
absent: "cwd",
|
|
18227
|
+
signal: abortSignal
|
|
17861
18228
|
});
|
|
17862
18229
|
if (pathsRead.refusal) {
|
|
17863
18230
|
const errorRaw = pathsRead.refusal;
|
|
@@ -18202,10 +18569,10 @@ ${hint}` : `${output}${paginationNote}`;
|
|
|
18202
18569
|
}
|
|
18203
18570
|
|
|
18204
18571
|
// dist/tools/lens-diagnostics.js
|
|
18205
|
-
import { promises as
|
|
18572
|
+
import { promises as fs23 } from "node:fs";
|
|
18206
18573
|
import * as fsSync from "node:fs";
|
|
18207
18574
|
import * as os7 from "node:os";
|
|
18208
|
-
import * as
|
|
18575
|
+
import * as path40 from "node:path";
|
|
18209
18576
|
|
|
18210
18577
|
// dist/clients/project-diagnostics/extractors.js
|
|
18211
18578
|
var WARM_TRIGGER = {
|
|
@@ -18263,14 +18630,14 @@ function reasonFromAvailabilityVerdict(tool, verdict) {
|
|
|
18263
18630
|
}
|
|
18264
18631
|
|
|
18265
18632
|
// dist/clients/project-diagnostics/fresh-fetch.js
|
|
18266
|
-
import * as
|
|
18633
|
+
import * as fs21 from "node:fs";
|
|
18267
18634
|
import * as os5 from "node:os";
|
|
18268
|
-
import * as
|
|
18635
|
+
import * as path38 from "node:path";
|
|
18269
18636
|
|
|
18270
18637
|
// dist/clients/project-diagnostics/runner-adapters/jscpd.js
|
|
18271
|
-
import * as
|
|
18638
|
+
import * as path34 from "node:path";
|
|
18272
18639
|
function resolveClonePath(cwd, file) {
|
|
18273
|
-
return
|
|
18640
|
+
return path34.isAbsolute(file) ? file : path34.resolve(cwd, file);
|
|
18274
18641
|
}
|
|
18275
18642
|
function jscpdCloneToProjectDiagnostics(cwd, clone) {
|
|
18276
18643
|
const a = resolveClonePath(cwd, clone.fileA);
|
|
@@ -18283,7 +18650,7 @@ function jscpdCloneToProjectDiagnostics(cwd, clone) {
|
|
|
18283
18650
|
tool: "jscpd",
|
|
18284
18651
|
runner: "jscpd",
|
|
18285
18652
|
rule: "jscpd:duplicate",
|
|
18286
|
-
message: `Duplicate code (${clone.lines} lines) \u2014 also at ${
|
|
18653
|
+
message: `Duplicate code (${clone.lines} lines) \u2014 also at ${path34.relative(cwd, otherFile)}:${otherLine}`,
|
|
18287
18654
|
source: "project-scan"
|
|
18288
18655
|
});
|
|
18289
18656
|
return [
|
|
@@ -18298,16 +18665,16 @@ function jscpdResultToProjectDiagnostics(cwd, result) {
|
|
|
18298
18665
|
}
|
|
18299
18666
|
|
|
18300
18667
|
// dist/clients/project-diagnostics/runner-adapters/madge.js
|
|
18301
|
-
import * as
|
|
18668
|
+
import * as path35 from "node:path";
|
|
18302
18669
|
function resolveCyclePath(cwd, file) {
|
|
18303
|
-
return
|
|
18670
|
+
return path35.isAbsolute(file) ? file : path35.resolve(cwd, file);
|
|
18304
18671
|
}
|
|
18305
18672
|
function cycleMembers(dep) {
|
|
18306
18673
|
return dep.path.length > 0 ? dep.path : [dep.file];
|
|
18307
18674
|
}
|
|
18308
18675
|
function circularDepToProjectDiagnostics(cwd, dep) {
|
|
18309
18676
|
const members = cycleMembers(dep);
|
|
18310
|
-
const rendered = `${members.map((f) =>
|
|
18677
|
+
const rendered = `${members.map((f) => path35.basename(f)).join(" \u2192 ")} \u2192 ${path35.basename(members[0] ?? "")}`;
|
|
18311
18678
|
return members.map((file) => ({
|
|
18312
18679
|
filePath: resolveCyclePath(cwd, file),
|
|
18313
18680
|
severity: "warning",
|
|
@@ -18333,7 +18700,7 @@ function circularDepsToProjectDiagnostics(cwd, circular) {
|
|
|
18333
18700
|
}
|
|
18334
18701
|
|
|
18335
18702
|
// dist/clients/project-diagnostics/runner-adapters/opengrep.js
|
|
18336
|
-
import * as
|
|
18703
|
+
import * as path36 from "node:path";
|
|
18337
18704
|
function severityFor(raw) {
|
|
18338
18705
|
switch (raw.toUpperCase()) {
|
|
18339
18706
|
case "ERROR":
|
|
@@ -18348,7 +18715,7 @@ function opengrepFindingToProjectDiagnostic(cwd, finding) {
|
|
|
18348
18715
|
const { severity, blocking } = severityFor(finding.severity);
|
|
18349
18716
|
const cweSuffix = finding.cwe?.length ? ` (${finding.cwe[0]})` : "";
|
|
18350
18717
|
return {
|
|
18351
|
-
filePath:
|
|
18718
|
+
filePath: path36.isAbsolute(finding.path) ? finding.path : path36.resolve(cwd, finding.path),
|
|
18352
18719
|
line: finding.startLine,
|
|
18353
18720
|
column: finding.startCol,
|
|
18354
18721
|
severity,
|
|
@@ -18367,8 +18734,8 @@ function opengrepResultToProjectDiagnostics(cwd, result) {
|
|
|
18367
18734
|
}
|
|
18368
18735
|
|
|
18369
18736
|
// dist/clients/project-diagnostics/runner-adapters/runner-findings.js
|
|
18370
|
-
import * as
|
|
18371
|
-
import * as
|
|
18737
|
+
import * as fs20 from "node:fs";
|
|
18738
|
+
import * as path37 from "node:path";
|
|
18372
18739
|
function failureMessage(failure) {
|
|
18373
18740
|
const firstLine2 = failure.message.split("\n")[0]?.slice(0, 300) ?? "";
|
|
18374
18741
|
return firstLine2 ? `${failure.name}: ${firstLine2}` : failure.name;
|
|
@@ -18434,7 +18801,7 @@ function testRunnerFindingsToProjectDiagnostics(cache, cwd, runtime) {
|
|
|
18434
18801
|
return [];
|
|
18435
18802
|
const validation = cwd ? validateAdvisoryProvenance(cache, cwd, runtime) : { status: "unknown", reasons: ["validation-context-missing"] };
|
|
18436
18803
|
const root = cwd ?? process.cwd();
|
|
18437
|
-
const missingKeys = new Set((cache.provenance?.files ?? []).filter((file) => !
|
|
18804
|
+
const missingKeys = new Set((cache.provenance?.files ?? []).filter((file) => !fs20.existsSync(path37.resolve(root, file.path))).map((file) => advisoryPathKey(file.path, root)));
|
|
18438
18805
|
const historical = cache.superseded === true || cache.stale === true || validation.status !== "current";
|
|
18439
18806
|
return cache.results.filter((result) => !missingKeys.has(advisoryPathKey(result.file, root))).flatMap((result) => testResultToProjectDiagnostics(result, historical)).map((diagnostic) => historical ? {
|
|
18440
18807
|
...diagnostic,
|
|
@@ -18464,15 +18831,15 @@ function laneObservedAtMs(scannedAt, startedAtMs) {
|
|
|
18464
18831
|
return parseScannedAtMs(scannedAt) ?? startedAtMs;
|
|
18465
18832
|
}
|
|
18466
18833
|
async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal, options = {}) {
|
|
18467
|
-
const requestedRoot = options.analysisRoot === void 0 ? cwd :
|
|
18834
|
+
const requestedRoot = options.analysisRoot === void 0 ? cwd : path38.resolve(cwd, options.analysisRoot);
|
|
18468
18835
|
let analysisRoot;
|
|
18469
18836
|
let analysisRootValidation;
|
|
18470
18837
|
if (options.analysisRoot !== void 0) {
|
|
18471
18838
|
try {
|
|
18472
|
-
if (!
|
|
18839
|
+
if (!fs21.statSync(requestedRoot).isDirectory()) {
|
|
18473
18840
|
throw new Error("is not a directory");
|
|
18474
18841
|
}
|
|
18475
|
-
analysisRoot =
|
|
18842
|
+
analysisRoot = fs21.realpathSync(requestedRoot);
|
|
18476
18843
|
} catch (error) {
|
|
18477
18844
|
const detail = error instanceof Error ? error.message : String(error);
|
|
18478
18845
|
const reason = `the explicit analysis root ${requestedRoot} is unavailable or ${detail}`;
|
|
@@ -18631,7 +18998,7 @@ async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal,
|
|
|
18631
18998
|
markCold("jscpd", reasonFromAvailabilityVerdict("jscpd", clients.jscpdClient.getAvailabilityVerdict?.()));
|
|
18632
18999
|
return;
|
|
18633
19000
|
}
|
|
18634
|
-
const isTsProject =
|
|
19001
|
+
const isTsProject = fs21.existsSync(path38.join(analysisRoot, "tsconfig.json"));
|
|
18635
19002
|
const scannerKey = isTsProject ? "jscpd-ts" : "jscpd";
|
|
18636
19003
|
const startMs = Date.now();
|
|
18637
19004
|
const result = await clients.jscpdClient.scan(analysisRoot, void 0, void 0, isTsProject);
|
|
@@ -18656,9 +19023,11 @@ async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal,
|
|
|
18656
19023
|
}
|
|
18657
19024
|
const startMs = Date.now();
|
|
18658
19025
|
const result = await clients.depChecker.scanProject(analysisRoot);
|
|
18659
|
-
|
|
18660
|
-
|
|
18661
|
-
|
|
19026
|
+
if (result.analyzed === true) {
|
|
19027
|
+
cacheManager2.writeCache("madge", result, analysisRoot, {
|
|
19028
|
+
scanDurationMs: Date.now() - startMs
|
|
19029
|
+
});
|
|
19030
|
+
}
|
|
18662
19031
|
record("madge", circularDepsToProjectDiagnostics(analysisRoot, result.circular ?? []), Date.now() - startMs, result.analyzed === true, result, laneObservedAtMs(result.scannedAt, startMs));
|
|
18663
19032
|
}),
|
|
18664
19033
|
// gitleaks — committed-secrets detection. session_start/per-edit stay
|
|
@@ -18936,13 +19305,13 @@ function makeProgressReporter(onUpdate, label, throttleMs = 250) {
|
|
|
18936
19305
|
}
|
|
18937
19306
|
|
|
18938
19307
|
// dist/tools/lsp-diagnostics.js
|
|
18939
|
-
import * as
|
|
18940
|
-
import * as
|
|
19308
|
+
import * as fs22 from "node:fs";
|
|
19309
|
+
import * as path39 from "node:path";
|
|
18941
19310
|
|
|
18942
19311
|
// dist/clients/out-of-band-changes.js
|
|
18943
19312
|
import { promises as fsp } from "node:fs";
|
|
18944
19313
|
import * as os6 from "node:os";
|
|
18945
|
-
import { basename as
|
|
19314
|
+
import { basename as basename7, join as join18 } from "node:path";
|
|
18946
19315
|
|
|
18947
19316
|
// dist/clients/disk-changes.js
|
|
18948
19317
|
var DISK_CHANGE_ORIGINS = [
|
|
@@ -19269,7 +19638,7 @@ var INSTALL_MARKERS = [
|
|
|
19269
19638
|
".yarn-integrity"
|
|
19270
19639
|
];
|
|
19271
19640
|
var VENV_LIB_DIR = "lib";
|
|
19272
|
-
var VENV_WINDOWS_SITE_PACKAGES =
|
|
19641
|
+
var VENV_WINDOWS_SITE_PACKAGES = join18("Lib", "site-packages");
|
|
19273
19642
|
var VENV_INTERPRETER_DIRS_MAX = 4;
|
|
19274
19643
|
var DECLARATION_WALK_MAX_DIRS = 4096;
|
|
19275
19644
|
var DECLARATION_WALK_MAX_FILES = 2048;
|
|
@@ -19277,8 +19646,7 @@ var DECLARATION_WALK_CONCURRENCY = 16;
|
|
|
19277
19646
|
var DECLARATION_FILE = /(?:\.d\.[cm]?ts|\.pyi)$/i;
|
|
19278
19647
|
var MAX_ROOTS = 64;
|
|
19279
19648
|
function declarationLookIntervalMs() {
|
|
19280
|
-
|
|
19281
|
-
return Number.isFinite(raw) && raw >= 0 ? raw : 2e3;
|
|
19649
|
+
return nonNegativeIntEnv("PI_LENS_DECLARATION_LOOK_MS", 2e3);
|
|
19282
19650
|
}
|
|
19283
19651
|
var records = new BoundedFifoMap(MAX_ROOTS);
|
|
19284
19652
|
var looks = createSingleFlight({ coalesceTrailing: true });
|
|
@@ -19292,21 +19660,21 @@ function demandsWalk(trigger, walk) {
|
|
|
19292
19660
|
}
|
|
19293
19661
|
var fingerprint = (stat) => `${stat.ino}:${stat.size}:${stat.mtimeMs}`;
|
|
19294
19662
|
function diffServerConfigs(root, before, after) {
|
|
19295
|
-
return diffDeclarations(new Map([...before].map(([name, print]) => [
|
|
19663
|
+
return diffDeclarations(new Map([...before].map(([name, print]) => [join18(root, name), print])), new Map([...after].map(([name, print]) => [join18(root, name), print])));
|
|
19296
19664
|
}
|
|
19297
19665
|
async function readVenvInstallParts(root, listed) {
|
|
19298
19666
|
const targets = [];
|
|
19299
19667
|
for (const name of PROJECT_VENV_DIR_NAMES) {
|
|
19300
19668
|
if (!listed.has(name))
|
|
19301
19669
|
continue;
|
|
19302
|
-
const venvRoot =
|
|
19670
|
+
const venvRoot = join18(root, name);
|
|
19303
19671
|
targets.push({
|
|
19304
19672
|
label: `${name}/${VENV_WINDOWS_SITE_PACKAGES}`,
|
|
19305
|
-
dir:
|
|
19673
|
+
dir: join18(venvRoot, VENV_WINDOWS_SITE_PACKAGES)
|
|
19306
19674
|
});
|
|
19307
19675
|
let interpreters;
|
|
19308
19676
|
try {
|
|
19309
|
-
interpreters = await fsp.readdir(
|
|
19677
|
+
interpreters = await fsp.readdir(join18(venvRoot, VENV_LIB_DIR), {
|
|
19310
19678
|
withFileTypes: true
|
|
19311
19679
|
});
|
|
19312
19680
|
} catch {
|
|
@@ -19317,7 +19685,7 @@ async function readVenvInstallParts(root, listed) {
|
|
|
19317
19685
|
for (const interpreter of interpreterDirs) {
|
|
19318
19686
|
targets.push({
|
|
19319
19687
|
label: `${name}/${VENV_LIB_DIR}/${interpreter.name}/site-packages`,
|
|
19320
|
-
dir:
|
|
19688
|
+
dir: join18(venvRoot, VENV_LIB_DIR, interpreter.name, "site-packages")
|
|
19321
19689
|
});
|
|
19322
19690
|
}
|
|
19323
19691
|
}
|
|
@@ -19351,7 +19719,7 @@ async function readInstallStamp(root) {
|
|
|
19351
19719
|
names.push(`node_modules/${marker}`);
|
|
19352
19720
|
let link;
|
|
19353
19721
|
try {
|
|
19354
|
-
link = await fsp.lstat(
|
|
19722
|
+
link = await fsp.lstat(join18(root, "node_modules"));
|
|
19355
19723
|
} catch {
|
|
19356
19724
|
link = void 0;
|
|
19357
19725
|
}
|
|
@@ -19367,7 +19735,7 @@ async function readInstallStamp(root) {
|
|
|
19367
19735
|
const [statted, venvParts] = await Promise.all([
|
|
19368
19736
|
Promise.all([...names, ...configNames].map(async (name) => {
|
|
19369
19737
|
try {
|
|
19370
|
-
const stat = await fsp.stat(
|
|
19738
|
+
const stat = await fsp.stat(join18(root, name));
|
|
19371
19739
|
return {
|
|
19372
19740
|
part: `${name}=${fingerprint(stat)}`,
|
|
19373
19741
|
changedAt: stat.mtimeMs
|
|
@@ -19422,9 +19790,9 @@ async function walkDeclarations(root) {
|
|
|
19422
19790
|
for (const entry of entries) {
|
|
19423
19791
|
if (entry.isDirectory()) {
|
|
19424
19792
|
if (!isExcludedDirName(entry.name))
|
|
19425
|
-
queue.push(
|
|
19793
|
+
queue.push(join18(dir, entry.name));
|
|
19426
19794
|
} else if (entry.isFile() && DECLARATION_FILE.test(entry.name)) {
|
|
19427
|
-
found.push(
|
|
19795
|
+
found.push(join18(dir, entry.name));
|
|
19428
19796
|
}
|
|
19429
19797
|
}
|
|
19430
19798
|
if (found.length > DECLARATION_WALK_MAX_FILES)
|
|
@@ -19624,7 +19992,7 @@ async function lookOnce(root, key, trigger, runtime, options, skipWalk) {
|
|
|
19624
19992
|
changed: count(2),
|
|
19625
19993
|
deleted: count(3),
|
|
19626
19994
|
// The server config files this look forwarded (#4532), by name.
|
|
19627
|
-
configs: configChanges.map((change) => `${CHANGE_TYPE[change.type]}:${
|
|
19995
|
+
configs: configChanges.map((change) => `${CHANGE_TYPE[change.type]}:${basename7(change.filePath)}`)
|
|
19628
19996
|
}
|
|
19629
19997
|
});
|
|
19630
19998
|
}
|
|
@@ -19709,7 +20077,7 @@ function lspUnavailableMessage(filePath, health) {
|
|
|
19709
20077
|
return void 0;
|
|
19710
20078
|
}
|
|
19711
20079
|
const candidates = health.candidateServerIds?.length ? ` candidates=${health.candidateServerIds.join(",")}` : "";
|
|
19712
|
-
const reason = (health.serverCountAttempted ?? 0) === 0 ?
|
|
20080
|
+
const reason = (health.serverCountAttempted ?? 0) === 0 ? NO_SERVER_REASON : "no LSP client is currently ready";
|
|
19713
20081
|
const stale = (health.mergedCount ?? 0) > 0 ? " Showing stale last-known diagnostics below." : " No diagnostics were collected.";
|
|
19714
20082
|
return `LSP unavailable for ${filePath}: ${reason}; ready=${health.serverCountReady ?? 0}/${health.serverCountAttempted ?? 0}.${candidates}.${stale}`;
|
|
19715
20083
|
}
|
|
@@ -19734,7 +20102,7 @@ async function collectFiles(dir, extensions, maxFiles, isIgnored = () => false)
|
|
|
19734
20102
|
return;
|
|
19735
20103
|
let entries;
|
|
19736
20104
|
try {
|
|
19737
|
-
entries = await
|
|
20105
|
+
entries = await fs22.promises.readdir(current, { withFileTypes: true });
|
|
19738
20106
|
} catch {
|
|
19739
20107
|
return;
|
|
19740
20108
|
}
|
|
@@ -19743,11 +20111,11 @@ async function collectFiles(dir, extensions, maxFiles, isIgnored = () => false)
|
|
|
19743
20111
|
return;
|
|
19744
20112
|
if (entry.isSymbolicLink())
|
|
19745
20113
|
continue;
|
|
19746
|
-
const full =
|
|
20114
|
+
const full = path39.join(current, entry.name);
|
|
19747
20115
|
if (entry.isDirectory()) {
|
|
19748
20116
|
if (!isExcludedDirName(entry.name) && !isIgnored(full, true))
|
|
19749
20117
|
await walk(full);
|
|
19750
|
-
} else if (entry.isFile() && extensions.includes(
|
|
20118
|
+
} else if (entry.isFile() && extensions.includes(path39.extname(full))) {
|
|
19751
20119
|
if (isIgnored(full, false))
|
|
19752
20120
|
continue;
|
|
19753
20121
|
files.push(full);
|
|
@@ -19780,10 +20148,7 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
|
|
|
19780
20148
|
const concurrency = boundedPositiveInt(typedParams.concurrency, DEFAULT_BATCH_CONCURRENCY, 1, MAX_BATCH_CONCURRENCY);
|
|
19781
20149
|
const waitMs = typeof typedParams.waitMs === "number" && typedParams.waitMs >= 0 ? Math.floor(typedParams.waitMs) : void 0;
|
|
19782
20150
|
const serverScope = typedParams.serverScope === "primary" ? "primary" : "all";
|
|
19783
|
-
const excludeServerIds = getFlag ?
|
|
19784
|
-
...configDisabledAuxiliaryLspServerIds((name) => getFlag(name, cwd)),
|
|
19785
|
-
...enabledOptInAuxiliaryLspServerIds((name) => getFlag(name, cwd))
|
|
19786
|
-
]) : void 0;
|
|
20151
|
+
const excludeServerIds = getFlag ? auxiliaryServersNotRun((name) => getFlag(name, cwd)) : void 0;
|
|
19787
20152
|
const lspService = getService();
|
|
19788
20153
|
if (!lspService) {
|
|
19789
20154
|
return {
|
|
@@ -19825,7 +20190,7 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
|
|
|
19825
20190
|
details: { mode: "batch", filesChecked: 0 }
|
|
19826
20191
|
};
|
|
19827
20192
|
}
|
|
19828
|
-
const expanded = await expandPathsToFiles(cwd, rawPaths);
|
|
20193
|
+
const expanded = await expandPathsToFiles(cwd, rawPaths, typedParams.pathsAlreadyResolved === true);
|
|
19829
20194
|
if (expanded.files.length === 0) {
|
|
19830
20195
|
const { listed, text } = describeDirectoriesWithoutFiles(expanded.directoriesWithoutFiles);
|
|
19831
20196
|
return {
|
|
@@ -19866,7 +20231,7 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
|
|
|
19866
20231
|
const absPath = normalizeMapKey(typedParams.pathAlreadyResolved === true ? rawPath : resolveHostToolPath(rawPath, cwd));
|
|
19867
20232
|
let stat;
|
|
19868
20233
|
try {
|
|
19869
|
-
stat =
|
|
20234
|
+
stat = fs22.statSync(absPath);
|
|
19870
20235
|
} catch {
|
|
19871
20236
|
return {
|
|
19872
20237
|
content: [
|
|
@@ -19898,7 +20263,7 @@ async function collectDiagnosticsForFile(absPath, lspService, scanRoot, waitMs,
|
|
|
19898
20263
|
let content;
|
|
19899
20264
|
let touched;
|
|
19900
20265
|
try {
|
|
19901
|
-
content =
|
|
20266
|
+
content = fs22.readFileSync(absPath, "utf-8");
|
|
19902
20267
|
const contentLimit = explicitQuery ? exceedsExplicitQueryLimits(content) : exceedsLspSyncLimits(content);
|
|
19903
20268
|
if (contentLimit.tooLarge) {
|
|
19904
20269
|
const reason = `file too large for LSP diagnostics (${contentLimit.reason})`;
|
|
@@ -20174,7 +20539,7 @@ async function collectFileDiagnosticResult(file, severity, lspService, waitMs, n
|
|
|
20174
20539
|
const scannedAt = Date.now();
|
|
20175
20540
|
let stat;
|
|
20176
20541
|
try {
|
|
20177
|
-
stat =
|
|
20542
|
+
stat = fs22.statSync(file);
|
|
20178
20543
|
if (!stat.isFile()) {
|
|
20179
20544
|
return { file, diagnostics: [], error: `${file}: not a file` };
|
|
20180
20545
|
}
|
|
@@ -20424,12 +20789,9 @@ async function runFileDiagnostics(absPath, severity, lspService, waitMs, nextWri
|
|
|
20424
20789
|
const suppressedLine = dispositionSuppressedLine(policy.suppressed);
|
|
20425
20790
|
const withheldLine = withheldCompileNote(policy.withheld);
|
|
20426
20791
|
const notRunServerIds = serverScope === "all" && excludeServerIds && excludeServerIds.size > 0 ? getServersForFileWithConfig(absPath).flatMap((server) => excludeServerIds.has(server.id) ? [server.id] : []) : [];
|
|
20427
|
-
const switchedOffServerIds = notRunServerIds.flatMap((id) => isOptInAuxiliaryServerId(id) ? [] : [id]);
|
|
20428
|
-
const optInNotRunServerIds = notRunServerIds.flatMap((id) => isOptInAuxiliaryServerId(id) ? [id] : []);
|
|
20429
20792
|
const noAuxiliaryLine = [
|
|
20430
20793
|
"No auxiliary findings.",
|
|
20431
|
-
...
|
|
20432
|
-
...optInNotRunServerIds.length > 0 ? [`Opt-in, not run by this check: ${optInNotRunServerIds.join(", ")}.`] : []
|
|
20794
|
+
...auxiliaryNotRunSentences(notRunServerIds)
|
|
20433
20795
|
].join(" ");
|
|
20434
20796
|
let text;
|
|
20435
20797
|
if (total === 0) {
|
|
@@ -20718,15 +21080,15 @@ async function collectBatchDiagnostics(files, severity, lspService, options) {
|
|
|
20718
21080
|
incompleteFiles: Math.max(0, files.length - results.length)
|
|
20719
21081
|
};
|
|
20720
21082
|
}
|
|
20721
|
-
async function expandPathsToFiles(cwd, rawPaths) {
|
|
21083
|
+
async function expandPathsToFiles(cwd, rawPaths, pathsAlreadyResolved = false) {
|
|
20722
21084
|
const explicitFiles = [];
|
|
20723
21085
|
const directories = [];
|
|
20724
21086
|
const seenFileKeys = /* @__PURE__ */ new Set();
|
|
20725
21087
|
for (const entry of rawPaths) {
|
|
20726
|
-
const abs = normalizeMapKey(resolveHostToolPath(entry, cwd));
|
|
21088
|
+
const abs = normalizeMapKey(pathsAlreadyResolved ? entry : resolveHostToolPath(entry, cwd));
|
|
20727
21089
|
let stat;
|
|
20728
21090
|
try {
|
|
20729
|
-
stat =
|
|
21091
|
+
stat = fs22.statSync(abs);
|
|
20730
21092
|
} catch {
|
|
20731
21093
|
}
|
|
20732
21094
|
if (stat?.isDirectory()) {
|
|
@@ -20934,7 +21296,7 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
|
|
|
20934
21296
|
reason: batchOutcomeReason(result)
|
|
20935
21297
|
}));
|
|
20936
21298
|
const auxiliaryOnlyLine = auxiliaryOnlyFindingsLine(results);
|
|
20937
|
-
const tooLargeLines = renderBatchOutcomeLines(outcomeDetails, (file) =>
|
|
21299
|
+
const tooLargeLines = renderBatchOutcomeLines(outcomeDetails, (file) => path39.relative(absPath, file));
|
|
20938
21300
|
const withheldDirectory = mergeWithheld(results.map((r) => r.withheldCompile));
|
|
20939
21301
|
const withheldDisclosure = withheldCompileNote(withheldDirectory);
|
|
20940
21302
|
let text;
|
|
@@ -20976,7 +21338,7 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
|
|
|
20976
21338
|
];
|
|
20977
21339
|
const toRelative = (d) => ({
|
|
20978
21340
|
...d,
|
|
20979
|
-
file:
|
|
21341
|
+
file: path39.relative(absPath, d.file)
|
|
20980
21342
|
});
|
|
20981
21343
|
if (primaryDisplay.length > 0) {
|
|
20982
21344
|
lines.push(`Primary findings (${primaryDisplay.length}):`);
|
|
@@ -21009,7 +21371,7 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
|
|
|
21009
21371
|
filesScanned: filesToProcess.length,
|
|
21010
21372
|
capped: wasCapped,
|
|
21011
21373
|
diagnostics: display.map((d) => ({
|
|
21012
|
-
file:
|
|
21374
|
+
file: path39.relative(absPath, d.file),
|
|
21013
21375
|
line: d.line,
|
|
21014
21376
|
character: d.character,
|
|
21015
21377
|
severity: d.severity,
|
|
@@ -21084,7 +21446,7 @@ async function findFullScanBindingMismatches(results) {
|
|
|
21084
21446
|
result.boundToCurrentDisk !== true && result.contentHash !== void 0
|
|
21085
21447
|
) {
|
|
21086
21448
|
try {
|
|
21087
|
-
const content = await
|
|
21449
|
+
const content = await fs23.readFile(result.filePath, "utf-8");
|
|
21088
21450
|
if (hashDiagnosticContent(content) !== result.contentHash) {
|
|
21089
21451
|
mismatched.add(result);
|
|
21090
21452
|
}
|
|
@@ -21094,7 +21456,7 @@ async function findFullScanBindingMismatches(results) {
|
|
|
21094
21456
|
sinceYield += 1;
|
|
21095
21457
|
if (sinceYield >= FULL_SCAN_BINDING_YIELD_EVERY) {
|
|
21096
21458
|
sinceYield = 0;
|
|
21097
|
-
await new Promise((
|
|
21459
|
+
await new Promise((resolve34) => setImmediate(resolve34));
|
|
21098
21460
|
}
|
|
21099
21461
|
}
|
|
21100
21462
|
return mismatched;
|
|
@@ -21144,7 +21506,7 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21144
21506
|
const files2 = details.filesChecked ?? details.filesScanned ?? 0;
|
|
21145
21507
|
const noun = count === 1 ? "diagnostic" : "diagnostics";
|
|
21146
21508
|
const filePath = typeof details?.filePath === "string" ? details.filePath : Array.isArray(args?.paths) && args.paths.length === 1 && typeof args.paths[0] === "string" ? args.paths[0] : void 0;
|
|
21147
|
-
const singleFile = (details?.mode === "file" || files2 === 1) && typeof filePath === "string" ? ` ${
|
|
21509
|
+
const singleFile = (details?.mode === "file" || files2 === 1) && typeof filePath === "string" ? ` ${path40.basename(filePath)}` : "";
|
|
21148
21510
|
const scope = files2 > 1 ? ` across ${files2} files` : singleFile;
|
|
21149
21511
|
if (isError)
|
|
21150
21512
|
return `lens_diagnostics lsp \u2014 ${text.split("\n")[0] ?? "error"}`;
|
|
@@ -21179,8 +21541,10 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21179
21541
|
const aw = details?.actionableWarnings ?? 0;
|
|
21180
21542
|
const cq = details?.qualityIssues ?? 0;
|
|
21181
21543
|
const pd = details?.projectDiagnostics ?? 0;
|
|
21182
|
-
if (aw + cq + pd === 0)
|
|
21183
|
-
|
|
21544
|
+
if (aw + cq + pd === 0) {
|
|
21545
|
+
const uncheckedDelta = details?.uncheckedFileCount ?? 0;
|
|
21546
|
+
return `lens_diagnostics delta \u2014 clean${uncheckedDelta > 0 ? ` \xB7 ${uncheckedDelta} unchecked` : ""}${coldSuffix}${failedSuffix}`;
|
|
21547
|
+
}
|
|
21184
21548
|
return `lens_diagnostics delta \u2014 ${aw} actionable \xB7 ${cq} quality \xB7 ${pd} project${coldSuffix}${failedSuffix}`;
|
|
21185
21549
|
}
|
|
21186
21550
|
const b = details?.totalBlocking ?? 0;
|
|
@@ -21189,16 +21553,21 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21189
21553
|
const adv = details?.totalAdvisories ?? 0;
|
|
21190
21554
|
const files = details?.filesWithIssues ?? details?.filesChecked ?? 0;
|
|
21191
21555
|
const cacheVerdict = details?.validationStatus === "no-matching-findings" ? "no matching cached findings" : details?.validationStatus === "findings" ? void 0 : details?.validationStatus;
|
|
21556
|
+
const unchecked = details?.uncheckedFileCount ?? 0;
|
|
21557
|
+
const uncheckedSuffix = unchecked > 0 ? ` \xB7 ${unchecked} unchecked` : "";
|
|
21192
21558
|
if (b + e + w === 0) {
|
|
21193
21559
|
const advisorySuffix = adv > 0 ? `, ${adv} hint${adv === 1 ? "" : "s"}` : "";
|
|
21194
|
-
|
|
21560
|
+
if (cacheVerdict === void 0 && unchecked > 0 && unchecked >= (details?.filesChecked ?? files))
|
|
21561
|
+
return `lens_diagnostics ${mode} \u2014 unchecked${advisorySuffix} (${files} files)${coldSuffix}${failedSuffix}`;
|
|
21562
|
+
return `lens_diagnostics ${mode} \u2014 ${cacheVerdict ?? "clean"}${advisorySuffix}${uncheckedSuffix} (${files} files)${coldSuffix}${failedSuffix}`;
|
|
21195
21563
|
}
|
|
21196
21564
|
const parts = [`${b} blocking`];
|
|
21197
21565
|
if (b === 0 && e > 0)
|
|
21198
21566
|
parts.push(`${e} errors`);
|
|
21199
21567
|
parts.push(`${w} warnings`);
|
|
21200
|
-
return `lens_diagnostics ${mode} \u2014 ${parts.join(" \xB7 ")}${cacheVerdict === "inconclusive" || cacheVerdict === "unverified" ? ` \xB7 ${cacheVerdict}` : ""} (${files} files)${coldSuffix}${failedSuffix}`;
|
|
21568
|
+
return `lens_diagnostics ${mode} \u2014 ${parts.join(" \xB7 ")}${cacheVerdict === "inconclusive" || cacheVerdict === "unverified" ? ` \xB7 ${cacheVerdict}` : ""}${uncheckedSuffix} (${files} files)${coldSuffix}${failedSuffix}`;
|
|
21201
21569
|
}),
|
|
21570
|
+
constrainedSampling: CONSTRAINED_JSON_SCHEMA_SAMPLING,
|
|
21202
21571
|
parameters: Type.Object({
|
|
21203
21572
|
source: Type.Optional(Type.String({
|
|
21204
21573
|
enum: ["session", "lsp"],
|
|
@@ -21258,7 +21627,7 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21258
21627
|
})),
|
|
21259
21628
|
paths: Type.Optional(Type.Array(Type.String(), {
|
|
21260
21629
|
maxItems: MAX_PATHS_ENTRIES,
|
|
21261
|
-
description:
|
|
21630
|
+
description: `Files or directories to filter. ${PATHS_GLOB_CLAUSE}`
|
|
21262
21631
|
}))
|
|
21263
21632
|
}),
|
|
21264
21633
|
async execute(_toolCallId, params, signal, onUpdate, ctx) {
|
|
@@ -21276,10 +21645,19 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21276
21645
|
details: {}
|
|
21277
21646
|
};
|
|
21278
21647
|
}
|
|
21279
|
-
const
|
|
21280
|
-
|
|
21648
|
+
const pathsSignal = ctx.signal ?? signal;
|
|
21649
|
+
const pathsRead = await readPathsArgument(params.paths, {
|
|
21650
|
+
cwd,
|
|
21651
|
+
signal: pathsSignal
|
|
21652
|
+
});
|
|
21653
|
+
const singleRead = !pathsRead.refusal && singlePath.path ? await readPathsArgument([singlePath.path], {
|
|
21654
|
+
cwd,
|
|
21655
|
+
signal: pathsSignal
|
|
21656
|
+
}) : void 0;
|
|
21657
|
+
const pathsRefusal = pathsRead.refusal ?? singleRead?.refusal;
|
|
21658
|
+
if (pathsRefusal) {
|
|
21281
21659
|
return {
|
|
21282
|
-
content: [{ type: "text", text:
|
|
21660
|
+
content: [{ type: "text", text: pathsRefusal }],
|
|
21283
21661
|
isError: true,
|
|
21284
21662
|
details: { mode: legacyMode ?? "delta", pathsError: true }
|
|
21285
21663
|
};
|
|
@@ -21288,14 +21666,15 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21288
21666
|
...params,
|
|
21289
21667
|
...singlePath.path ? { path: singlePath.path } : {}
|
|
21290
21668
|
};
|
|
21291
|
-
const pathEntries = singlePath.path ? [
|
|
21292
|
-
...pathsRead.entries,
|
|
21293
|
-
...readPathsArgument([singlePath.path], { cwd }).entries
|
|
21294
|
-
] : pathsRead.entries;
|
|
21669
|
+
const pathEntries = singlePath.path ? [...pathsRead.entries, ...singleRead?.entries ?? []] : pathsRead.entries;
|
|
21295
21670
|
if (source === "lsp") {
|
|
21296
21671
|
const lspParams = { ...params };
|
|
21297
21672
|
delete lspParams.source;
|
|
21298
21673
|
delete lspParams.scope;
|
|
21674
|
+
if (pathsRead.entries.length > 0) {
|
|
21675
|
+
lspParams.paths = pathsRead.entries;
|
|
21676
|
+
lspParams.pathsAlreadyResolved = true;
|
|
21677
|
+
}
|
|
21299
21678
|
const hasExplicitPath = typeof lspParams.path === "string" && lspParams.path.length > 0;
|
|
21300
21679
|
const hasExplicitPaths = Array.isArray(lspParams.paths) && lspParams.paths.length > 0;
|
|
21301
21680
|
if (scope === "workspace" && !hasExplicitPath && !hasExplicitPaths) {
|
|
@@ -21392,9 +21771,9 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21392
21771
|
host: ctx.host ?? "pi",
|
|
21393
21772
|
// #4944: the sweep leaves an auxiliary the operator turned off
|
|
21394
21773
|
// (`--no-ast-grep`, `astGrep.enabled=false`) unstarted, as the
|
|
21395
|
-
// `source=lsp` probe does.
|
|
21774
|
+
// `source=lsp` probe does; #5287: and an opt-in one they turned on.
|
|
21396
21775
|
...getFlag && {
|
|
21397
|
-
excludeServerIds:
|
|
21776
|
+
excludeServerIds: auxiliaryServersNotRun((name) => getFlag(name, cwd))
|
|
21398
21777
|
}
|
|
21399
21778
|
});
|
|
21400
21779
|
}
|
|
@@ -21425,7 +21804,7 @@ function appendProjectDiagnosticsDeltaLines(groups, cwd, report, severity, inclu
|
|
|
21425
21804
|
const diagnostics = [...gated.live, ...gated.stale];
|
|
21426
21805
|
const byFile = /* @__PURE__ */ new Map();
|
|
21427
21806
|
for (const diagnostic of diagnostics) {
|
|
21428
|
-
const filePath =
|
|
21807
|
+
const filePath = path40.resolve(diagnostic.filePath);
|
|
21429
21808
|
const bucket = byFile.get(filePath) ?? [];
|
|
21430
21809
|
bucket.push(diagnostic);
|
|
21431
21810
|
byFile.set(filePath, bucket);
|
|
@@ -21462,24 +21841,56 @@ function readContentForAnchors(filePath, stat) {
|
|
|
21462
21841
|
function applyCachedDispositions(cachedDiagnostics, cwd, filePath) {
|
|
21463
21842
|
if (!hasAnyDispositionMarks(cwd))
|
|
21464
21843
|
return cachedDiagnostics;
|
|
21465
|
-
|
|
21466
|
-
|
|
21844
|
+
const anchorOf = (d) => d.citedFile ?? filePath;
|
|
21845
|
+
const strictAnchors = hasStrictDispositionMarks(cwd);
|
|
21846
|
+
if (!strictAnchors && !cachedDiagnostics.some((d) => d.citedFile)) {
|
|
21847
|
+
return applyWeakDispositionsMultiFile(cachedDiagnostics, cwd, anchorOf);
|
|
21467
21848
|
}
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21849
|
+
const groups = /* @__PURE__ */ new Map();
|
|
21850
|
+
for (const d of cachedDiagnostics) {
|
|
21851
|
+
const anchor = anchorOf(d);
|
|
21852
|
+
const group = groups.get(anchor);
|
|
21853
|
+
if (group)
|
|
21854
|
+
group.push(d);
|
|
21855
|
+
else
|
|
21856
|
+
groups.set(anchor, [d]);
|
|
21857
|
+
}
|
|
21858
|
+
if (groups.size <= 1) {
|
|
21859
|
+
const anchor = groups.keys().next().value ?? filePath;
|
|
21860
|
+
const group = groups.values().next().value ?? cachedDiagnostics;
|
|
21861
|
+
return applyCachedStrict(group, cwd, anchor, {
|
|
21862
|
+
cited: anchor !== filePath,
|
|
21863
|
+
strictAnchors
|
|
21864
|
+
});
|
|
21473
21865
|
}
|
|
21474
|
-
const
|
|
21475
|
-
|
|
21476
|
-
|
|
21866
|
+
const kept = /* @__PURE__ */ new Set();
|
|
21867
|
+
for (const [anchor, group] of groups) {
|
|
21868
|
+
for (const d of applyCachedStrict(group, cwd, anchor, {
|
|
21869
|
+
cited: anchor !== filePath,
|
|
21870
|
+
strictAnchors
|
|
21871
|
+
})) {
|
|
21872
|
+
kept.add(d);
|
|
21873
|
+
}
|
|
21477
21874
|
}
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
|
|
21875
|
+
return cachedDiagnostics.filter((d) => kept.has(d));
|
|
21876
|
+
}
|
|
21877
|
+
function applyCachedStrict(group, cwd, anchor, options) {
|
|
21878
|
+
const decision = cachedAnchorMarks({
|
|
21879
|
+
cwd,
|
|
21880
|
+
anchor,
|
|
21881
|
+
rows: group,
|
|
21882
|
+
cited: options.cited,
|
|
21883
|
+
strictAnchors: options.strictAnchors,
|
|
21884
|
+
readContent: readContentForAnchors
|
|
21885
|
+
});
|
|
21886
|
+
switch (decision.marks) {
|
|
21887
|
+
case "refused":
|
|
21888
|
+
return group;
|
|
21889
|
+
case "weak-only":
|
|
21890
|
+
return applyWeakDispositions(group, cwd, anchor);
|
|
21891
|
+
case "strict":
|
|
21892
|
+
return applyDispositions(group, cwd, anchor, decision.content);
|
|
21481
21893
|
}
|
|
21482
|
-
return applyDispositions(cachedDiagnostics, cwd, filePath, content);
|
|
21483
21894
|
}
|
|
21484
21895
|
function filterDeltaReportDispositions(report, cwd, policyMap) {
|
|
21485
21896
|
if (!report?.diagnostics.length)
|
|
@@ -21655,10 +22066,22 @@ function formatDeltaMode(cacheManager2, cwd, severity, pathsScope) {
|
|
|
21655
22066
|
if (carried.length > 0) {
|
|
21656
22067
|
text += ` ${carriedIssues} finding${carriedIssues === 1 ? "" : "s"} across ${carried.length} file${carried.length === 1 ? "" : "s"} carried over from earlier this session \u2014 use mode=all to see them.`;
|
|
21657
22068
|
}
|
|
22069
|
+
const uncheckedSummaries = getFileDiagnosticSummaries().filter((f) => includeFile(f.filePath) && f.uncheckedReason !== void 0);
|
|
22070
|
+
const uncheckedDeltaLine = uncheckedFilesLine(uncheckedSummaries, cwd);
|
|
22071
|
+
if (uncheckedDeltaLine)
|
|
22072
|
+
text += `
|
|
22073
|
+
${uncheckedDeltaLine}`;
|
|
21658
22074
|
text += pathsScopeCacheOnlyNote(pathsScope);
|
|
21659
22075
|
return {
|
|
21660
22076
|
content: [{ type: "text", text }],
|
|
21661
|
-
details: {
|
|
22077
|
+
details: {
|
|
22078
|
+
mode: "delta",
|
|
22079
|
+
warnings: 0,
|
|
22080
|
+
carriedOverFiles: carried.length,
|
|
22081
|
+
...uncheckedSummaries.length > 0 && {
|
|
22082
|
+
uncheckedFileCount: uncheckedSummaries.length
|
|
22083
|
+
}
|
|
22084
|
+
}
|
|
21662
22085
|
};
|
|
21663
22086
|
}
|
|
21664
22087
|
const summary = `
|
|
@@ -21676,7 +22099,7 @@ Summary (turn delta): ${aw} actionable warning${aw === 1 ? "" : "s"} \xB7 ${cq}
|
|
|
21676
22099
|
function createCurrentIgnoreFilter(cwd) {
|
|
21677
22100
|
try {
|
|
21678
22101
|
const matcher = getProjectIgnoreMatcher(cwd);
|
|
21679
|
-
return (filePath) => !matcher.isIgnored(
|
|
22102
|
+
return (filePath) => !matcher.isIgnored(path40.resolve(filePath), false);
|
|
21680
22103
|
} catch {
|
|
21681
22104
|
return () => true;
|
|
21682
22105
|
}
|
|
@@ -21706,9 +22129,9 @@ function resolvePathsScope(entries) {
|
|
|
21706
22129
|
}
|
|
21707
22130
|
const fileKeys = new Set(fileEntries.map((f) => normalizeFilePath(f)));
|
|
21708
22131
|
const dirPrefixes = dirEntries.map((d) => normalizeFilePath(d));
|
|
21709
|
-
const includeExplicitFile = (filePath) => fileKeys.has(normalizeFilePath(
|
|
22132
|
+
const includeExplicitFile = (filePath) => fileKeys.has(normalizeFilePath(path40.resolve(filePath)));
|
|
21710
22133
|
const includeFile = (filePath) => {
|
|
21711
|
-
const key = normalizeFilePath(
|
|
22134
|
+
const key = normalizeFilePath(path40.resolve(filePath));
|
|
21712
22135
|
if (fileKeys.has(key))
|
|
21713
22136
|
return true;
|
|
21714
22137
|
return dirPrefixes.some((prefix) => isWithinForm(key, prefix));
|
|
@@ -21729,7 +22152,7 @@ function pathsScopeCacheOnlyNote(scope) {
|
|
|
21729
22152
|
function pathsScopeMissingNote(scope) {
|
|
21730
22153
|
if (!scope || scope.missing.length === 0)
|
|
21731
22154
|
return "";
|
|
21732
|
-
const shown2 = scope.missing.slice(0, 10).map((p) =>
|
|
22155
|
+
const shown2 = scope.missing.slice(0, 10).map((p) => path40.basename(p));
|
|
21733
22156
|
const more = scope.missing.length > shown2.length ? ` (+${scope.missing.length - shown2.length} more)` : "";
|
|
21734
22157
|
return `
|
|
21735
22158
|
|
|
@@ -21881,7 +22304,7 @@ function runnerRetirementDecision(diagnostic, filePath, authoritativeRunnerIds,
|
|
|
21881
22304
|
}
|
|
21882
22305
|
return "keep";
|
|
21883
22306
|
}
|
|
21884
|
-
function summarizeDiagnostics(filePath, diagnostics, hasFinalSnapshot) {
|
|
22307
|
+
function summarizeDiagnostics(filePath, diagnostics, hasFinalSnapshot, carried) {
|
|
21885
22308
|
let blocking = 0;
|
|
21886
22309
|
let errors = 0;
|
|
21887
22310
|
let warnings = 0;
|
|
@@ -21906,6 +22329,12 @@ function summarizeDiagnostics(filePath, diagnostics, hasFinalSnapshot) {
|
|
|
21906
22329
|
warnings,
|
|
21907
22330
|
advisories,
|
|
21908
22331
|
hasFinalSnapshot,
|
|
22332
|
+
...carried?.uncheckedReason !== void 0 && {
|
|
22333
|
+
uncheckedReason: carried.uncheckedReason
|
|
22334
|
+
},
|
|
22335
|
+
...carried?.uncheckedInapplicable === true && {
|
|
22336
|
+
uncheckedInapplicable: true
|
|
22337
|
+
},
|
|
21909
22338
|
diagnostics
|
|
21910
22339
|
};
|
|
21911
22340
|
}
|
|
@@ -22011,10 +22440,10 @@ function mergeDiagnosticsWithWidgetSummaries(widgetSummaries, lspResults, projec
|
|
|
22011
22440
|
return;
|
|
22012
22441
|
seen.add(key);
|
|
22013
22442
|
diagnostics.push(widgetDiagnostic);
|
|
22014
|
-
byFile.set(fileKey, summarizeDiagnostics(existing?.filePath ?? filePath, diagnostics, existing?.hasFinalSnapshot ?? true));
|
|
22443
|
+
byFile.set(fileKey, summarizeDiagnostics(existing?.filePath ?? filePath, diagnostics, existing?.hasFinalSnapshot ?? true, existing));
|
|
22015
22444
|
};
|
|
22016
22445
|
for (const summary of widgetSummaries) {
|
|
22017
|
-
const filePath =
|
|
22446
|
+
const filePath = path40.resolve(summary.filePath);
|
|
22018
22447
|
const fileKey = normalizeMapKey(summary.filePath);
|
|
22019
22448
|
if (authoritativeLspFiles?.has(fileKey))
|
|
22020
22449
|
continue;
|
|
@@ -22036,14 +22465,14 @@ function mergeDiagnosticsWithWidgetSummaries(widgetSummaries, lspResults, projec
|
|
|
22036
22465
|
// diagnostics that are no longer delivered — full mode rendered
|
|
22037
22466
|
// `main.go 1W … 1 warning` with no row under it. Recompute from what
|
|
22038
22467
|
// survived, and only then (an untouched file keeps its own counts).
|
|
22039
|
-
diagnostics.length === retained.length ? { ...summary, filePath, diagnostics } : summarizeDiagnostics(filePath, diagnostics, summary.hasFinalSnapshot ?? true)
|
|
22468
|
+
diagnostics.length === retained.length ? { ...summary, filePath, diagnostics } : summarizeDiagnostics(filePath, diagnostics, summary.hasFinalSnapshot ?? true, summary)
|
|
22040
22469
|
);
|
|
22041
22470
|
for (const diagnostic of diagnostics) {
|
|
22042
22471
|
seen.add(diagnosticDedupKey(fileKey, diagnostic));
|
|
22043
22472
|
}
|
|
22044
22473
|
}
|
|
22045
22474
|
for (const result of lspResults) {
|
|
22046
|
-
const filePath =
|
|
22475
|
+
const filePath = path40.resolve(result.filePath);
|
|
22047
22476
|
for (const diagnostic of result.diagnostics ?? []) {
|
|
22048
22477
|
addDiagnostic(filePath, {
|
|
22049
22478
|
...lspDiagnosticToWidget(diagnostic),
|
|
@@ -22063,12 +22492,12 @@ function mergeDiagnosticsWithWidgetSummaries(widgetSummaries, lspResults, projec
|
|
|
22063
22492
|
});
|
|
22064
22493
|
}
|
|
22065
22494
|
for (const diagnostic of projectSnapshot?.diagnostics ?? []) {
|
|
22066
|
-
addDiagnostic(
|
|
22495
|
+
addDiagnostic(path40.resolve(diagnostic.filePath), projectDiagnosticToWidget(diagnostic, diagnostic.filePath));
|
|
22067
22496
|
}
|
|
22068
22497
|
for (const diagnostic of deltaDiagnostics) {
|
|
22069
22498
|
const widget = projectDiagnosticToWidget(diagnostic, diagnostic.filePath);
|
|
22070
22499
|
const observedAt = widget.observedAt ?? deltaObservedAt;
|
|
22071
|
-
addDiagnostic(
|
|
22500
|
+
addDiagnostic(path40.resolve(diagnostic.filePath), {
|
|
22072
22501
|
...widget,
|
|
22073
22502
|
...observedAt !== void 0 && { observedAt }
|
|
22074
22503
|
});
|
|
@@ -22081,13 +22510,13 @@ async function applyInlineSuppressionsToSummaries(summaries, cwd, policyMap, dis
|
|
|
22081
22510
|
return summary;
|
|
22082
22511
|
let content;
|
|
22083
22512
|
try {
|
|
22084
|
-
content = await
|
|
22513
|
+
content = await fs23.readFile(summary.filePath, "utf8");
|
|
22085
22514
|
} catch {
|
|
22086
22515
|
const policyKept2 = applyRulePolicy(summary.diagnostics, policyMap, {
|
|
22087
22516
|
root: cwd,
|
|
22088
22517
|
filePath: summary.filePath
|
|
22089
22518
|
});
|
|
22090
|
-
return policyKept2.length === summary.diagnostics.length ? summary : summarizeDiagnostics(summary.filePath, policyKept2, summary.hasFinalSnapshot);
|
|
22519
|
+
return policyKept2.length === summary.diagnostics.length ? summary : summarizeDiagnostics(summary.filePath, policyKept2, summary.hasFinalSnapshot, summary);
|
|
22091
22520
|
}
|
|
22092
22521
|
const { kept: policyKept, inlineKept, disposed } = applyFindingPolicy(summary.diagnostics, {
|
|
22093
22522
|
cwd,
|
|
@@ -22112,7 +22541,7 @@ async function applyInlineSuppressionsToSummaries(summaries, cwd, policyMap, dis
|
|
|
22112
22541
|
if (pythonKept.kept.length === summary.diagnostics.length) {
|
|
22113
22542
|
return summary;
|
|
22114
22543
|
}
|
|
22115
|
-
return summarizeDiagnostics(summary.filePath, pythonKept.kept, summary.hasFinalSnapshot);
|
|
22544
|
+
return summarizeDiagnostics(summary.filePath, pythonKept.kept, summary.hasFinalSnapshot, summary);
|
|
22116
22545
|
}));
|
|
22117
22546
|
}
|
|
22118
22547
|
function shouldUseCachedProjectDiagnostics(value) {
|
|
@@ -22310,7 +22739,7 @@ async function formatFullMode(cwd, severity, lspService, cacheManager2, options
|
|
|
22310
22739
|
unreconciledFiles.add(fileKey);
|
|
22311
22740
|
recordDegradationOnce({
|
|
22312
22741
|
kind: "diagnostic-retained-unreconciled",
|
|
22313
|
-
subject: `${
|
|
22742
|
+
subject: `${path40.resolve(result2.filePath)}:lsp`,
|
|
22314
22743
|
reason: "confirmed diagnostic result could not replace retained widget state"
|
|
22315
22744
|
});
|
|
22316
22745
|
}
|
|
@@ -22318,7 +22747,7 @@ async function formatFullMode(cwd, severity, lspService, cacheManager2, options
|
|
|
22318
22747
|
unreconciledFiles.add(fileKey);
|
|
22319
22748
|
recordDegradationOnce({
|
|
22320
22749
|
kind: "diagnostic-retained-unreconciled",
|
|
22321
|
-
subject: `${
|
|
22750
|
+
subject: `${path40.resolve(result2.filePath)}:lsp`,
|
|
22322
22751
|
reason: "confirmed diagnostic result failed during widget reconciliation"
|
|
22323
22752
|
});
|
|
22324
22753
|
}
|
|
@@ -22385,7 +22814,7 @@ async function formatFullMode(cwd, severity, lspService, cacheManager2, options
|
|
|
22385
22814
|
const dispositionDropped = [];
|
|
22386
22815
|
let summaries = await applyInlineSuppressionsToSummaries(mergeDiagnosticsWithWidgetSummaries(getFileDiagnosticSummaries().filter((summary) => includeFile(summary.filePath)), confirmedLspResults, projectSnapshot, projectDelta, authoritativeLspFiles, authoritativeRunnerIds, authoritativeRunnerCoverage), cwd, policyMap, dispositionDropped);
|
|
22387
22816
|
if (unreconciledFiles.size > 0) {
|
|
22388
|
-
summaries = summaries.map((summary) => unreconciledFiles.has(normalizeMapKey(summary.filePath)) ? summarizeDiagnostics(summary.filePath, markUnreconciledFindings(summary.diagnostics), summary.hasFinalSnapshot) : summary);
|
|
22817
|
+
summaries = summaries.map((summary) => unreconciledFiles.has(normalizeMapKey(summary.filePath)) ? summarizeDiagnostics(summary.filePath, markUnreconciledFindings(summary.diagnostics), summary.hasFinalSnapshot, summary) : summary);
|
|
22389
22818
|
}
|
|
22390
22819
|
const parsedProjectScanObservedAt = projectSnapshot?.scannedAt ? Date.parse(projectSnapshot.scannedAt) : void 0;
|
|
22391
22820
|
const projectScanObservedAt = parsedProjectScanObservedAt !== void 0 && Number.isFinite(parsedProjectScanObservedAt) ? parsedProjectScanObservedAt : void 0;
|
|
@@ -22446,10 +22875,10 @@ ${withheldText}`
|
|
|
22446
22875
|
const auxiliaryCoverageNote = uncoveredScannerIds.length > 0 ? `
|
|
22447
22876
|
|
|
22448
22877
|
\u26A0 Auxiliary coverage incomplete: ${uncoveredScannerIds.join(", ")} did not answer for ${partiallyCoveredLspResults.length} file(s). Findings from answering servers are included; this is not a clean verdict for the named scanner lane(s).` : "";
|
|
22449
|
-
const
|
|
22450
|
-
const switchedOffNote =
|
|
22878
|
+
const notRunSentences = auxiliaryNotRunSentences([...options.excludeServerIds ?? []].sort((a, b) => Number(a > b) - Number(a < b)), "Switched off, not run (auxiliary LSP)");
|
|
22879
|
+
const switchedOffNote = notRunSentences.length > 0 ? `
|
|
22451
22880
|
|
|
22452
|
-
|
|
22881
|
+
${notRunSentences.join(" ")}` : "";
|
|
22453
22882
|
const lspPrimaryVsAuxiliary = tallyLspPrimaryVsAuxiliary(confirmedLspResults);
|
|
22454
22883
|
logExtension({
|
|
22455
22884
|
subsystem: "lsp-diagnostics",
|
|
@@ -22622,6 +23051,15 @@ async function projectResolvedCwd(summary, cwd) {
|
|
|
22622
23051
|
diagnostics: summary.diagnostics ?? []
|
|
22623
23052
|
};
|
|
22624
23053
|
}
|
|
23054
|
+
var MAX_UNCHECKED_NAMED = 5;
|
|
23055
|
+
function uncheckedFilesLine(summaries, cwd) {
|
|
23056
|
+
const unchecked = summaries.filter((s) => s.uncheckedReason !== void 0);
|
|
23057
|
+
if (unchecked.length === 0)
|
|
23058
|
+
return "";
|
|
23059
|
+
const named = unchecked.slice(0, MAX_UNCHECKED_NAMED).map((s) => `${toProjectRelativePath(s.filePath, cwd)}: ${s.uncheckedReason}`);
|
|
23060
|
+
const more = unchecked.length - named.length;
|
|
23061
|
+
return `\u26A0 ${unchecked.length} file${unchecked.length === 1 ? "" : "s"} not checked, so no findings is not a clean result: ${named.join("; ")}${more > 0 ? `; +${more} more` : ""}.`;
|
|
23062
|
+
}
|
|
22625
23063
|
async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummaries(), detailOverrides = { mode: "all" }, staleDropped = 0, pathsScope, fullModeDisposition = { dropped: [], analyzers: 0, analyzersByLane: {} }, sessionEvidence) {
|
|
22626
23064
|
const isFullMode = detailOverrides.mode === "full";
|
|
22627
23065
|
const includeFile = createScopedFileFilter(cwd, pathsScope);
|
|
@@ -22647,7 +23085,7 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
|
|
|
22647
23085
|
}
|
|
22648
23086
|
if (policyKept.length === kept.length && kept.length === diagnostics.length)
|
|
22649
23087
|
return s;
|
|
22650
|
-
return summarizeDiagnostics(s.filePath, policyKept, s.hasFinalSnapshot);
|
|
23088
|
+
return summarizeDiagnostics(s.filePath, policyKept, s.hasFinalSnapshot, s);
|
|
22651
23089
|
});
|
|
22652
23090
|
const eofGated = dispositioned.map((s) => {
|
|
22653
23091
|
const { diagnostics, demotedCount } = demotePastEofDiagnostics({
|
|
@@ -22659,7 +23097,7 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
|
|
|
22659
23097
|
});
|
|
22660
23098
|
if (demotedCount === 0)
|
|
22661
23099
|
return s;
|
|
22662
|
-
return summarizeDiagnostics(s.filePath, diagnostics, s.hasFinalSnapshot);
|
|
23100
|
+
return summarizeDiagnostics(s.filePath, diagnostics, s.hasFinalSnapshot, s);
|
|
22663
23101
|
});
|
|
22664
23102
|
const visibleSummaries = eofGated.filter((s) => includeFile(s.filePath));
|
|
22665
23103
|
const visibleDiagnostics = visibleSummaries.flatMap((s) => s.diagnostics ?? []);
|
|
@@ -22673,6 +23111,13 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
|
|
|
22673
23111
|
return s.blocking > 0 || s.errors > 0 || s.warnings > 0;
|
|
22674
23112
|
return s.blocking > 0 || s.errors > 0 || s.warnings > 0 || s.advisories > 0 || (s.diagnostics ?? []).some((d) => d.stale);
|
|
22675
23113
|
});
|
|
23114
|
+
const uncheckedLine = uncheckedFilesLine(visibleSummaries, cwd);
|
|
23115
|
+
const uncheckedNote = uncheckedLine ? `
|
|
23116
|
+
${uncheckedLine}` : "";
|
|
23117
|
+
const uncheckedCount = visibleSummaries.filter((s) => s.uncheckedReason !== void 0).length;
|
|
23118
|
+
const coverableUnchecked = visibleSummaries.filter((s) => s.uncheckedReason !== void 0 && s.uncheckedInapplicable !== true);
|
|
23119
|
+
const checkedCount = visibleSummaries.length - uncheckedCount;
|
|
23120
|
+
const uncheckedDetails = uncheckedCount > 0 ? { uncheckedFileCount: uncheckedCount } : {};
|
|
22676
23121
|
let validationStatus;
|
|
22677
23122
|
let validationNote = "";
|
|
22678
23123
|
let evidenceDetails = {};
|
|
@@ -22694,10 +23139,17 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
|
|
|
22694
23139
|
...sessionEvidence?.stalePaths ?? [],
|
|
22695
23140
|
...pending2.map((s) => s.filePath),
|
|
22696
23141
|
...stale.map((s) => s.filePath),
|
|
22697
|
-
...unverified
|
|
23142
|
+
...unverified,
|
|
23143
|
+
...coverableUnchecked.map((s) => s.filePath)
|
|
22698
23144
|
])
|
|
22699
23145
|
];
|
|
22700
|
-
validationStatus = staleDropped > 0 || staleDiagnosticCount > 0 || pending2.length > 0 ? "inconclusive" : visibleSummaries.length === 0 || unverified.length > 0 ? "unverified" : withIssues.length > 0 ? "findings" :
|
|
23146
|
+
validationStatus = staleDropped > 0 || staleDiagnosticCount > 0 || pending2.length > 0 ? "inconclusive" : visibleSummaries.length === 0 || unverified.length > 0 ? "unverified" : withIssues.length > 0 ? "findings" : (
|
|
23147
|
+
// #5287: no finding in a file a check can cover but did not is not
|
|
23148
|
+
// the ✓ status, nor is a session in which nothing was checked. A
|
|
23149
|
+
// file no check can ever cover is named by the report's line and
|
|
23150
|
+
// does not hold the others back (the #5285 footer policy).
|
|
23151
|
+
coverableUnchecked.length > 0 || checkedCount === 0 ? "unverified" : "no-matching-findings"
|
|
23152
|
+
);
|
|
22701
23153
|
const nextTool = resolveLensToolName("lens_diagnostics", sessionEvidence?.host ?? "pi");
|
|
22702
23154
|
const nextPaths = rescanPaths.slice(0, MAX_PATHS_ENTRIES);
|
|
22703
23155
|
const remainingRescanPathCount = rescanPaths.length - nextPaths.length;
|
|
@@ -22717,7 +23169,7 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
|
|
|
22717
23169
|
} : {}
|
|
22718
23170
|
};
|
|
22719
23171
|
const omittedClause = staleDropped > 0 ? `, ${staleDropped} changed file${staleDropped === 1 ? "" : "s"} omitted as stale` : "";
|
|
22720
|
-
validationNote = validationStatus === "inconclusive" || validationStatus === "unverified" ? `Session cache ${validationStatus} \u2014 not a clean verdict: ${pending2.length} pending file(s), ${staleDiagnosticCount} stale finding(s), ${unverified.length} requested file(s) without cached evidence${omittedClause}. Not active validation.
|
|
23172
|
+
validationNote = validationStatus === "inconclusive" || validationStatus === "unverified" ? `Session cache ${validationStatus} \u2014 not a clean verdict: ${pending2.length} pending file(s), ${staleDiagnosticCount} stale finding(s), ${unverified.length} requested file(s) without cached evidence, ${coverableUnchecked.length} file(s) no check completed on${omittedClause}. Not active validation.
|
|
22721
23173
|
Next check: ${nextTool ?? "diagnostics"} source=lsp scope=paths${nextPaths.length > 0 ? ` paths=${JSON.stringify(nextPaths)}` : " with the changed paths"}.` + (remainingRescanPathCount > 0 ? ` ${remainingRescanPathCount} more path(s) need a check; narrow or batch the remaining paths.` : "") + " LSP may not cover these files; use a file-appropriate validator for unsupported or missing files.\n" : "Session cache only; not active validation.\n";
|
|
22722
23174
|
logLatency({
|
|
22723
23175
|
type: "phase",
|
|
@@ -22741,8 +23193,9 @@ Next check: ${nextTool ?? "diagnostics"} source=lsp scope=paths${nextPaths.lengt
|
|
|
22741
23193
|
${suppressedLine}` : "";
|
|
22742
23194
|
const suppressedDetails = dispositionSuppressed > 0 ? { dispositionSuppressed } : {};
|
|
22743
23195
|
if (withIssues.length === 0) {
|
|
22744
|
-
const text = (visibleSummaries.length === 0 ? "No files diagnosed yet this session.\n" : validationStatus === "inconclusive" || validationStatus === "unverified" ? "" : `No ${severity === "all" ? "" : severity + " "}issues across ${
|
|
22745
|
-
`) +
|
|
23196
|
+
const text = (visibleSummaries.length === 0 ? "No files diagnosed yet this session.\n" : validationStatus === "inconclusive" || validationStatus === "unverified" || checkedCount === 0 ? "" : `No ${severity === "all" ? "" : severity + " "}issues across ${checkedCount} file${checkedCount === 1 ? "" : "s"} diagnosed this session. \u2713
|
|
23197
|
+
`) + (uncheckedLine ? `${uncheckedLine}
|
|
23198
|
+
` : "") + validationNote + staleNote + suppressedNote + pathsNote;
|
|
22746
23199
|
return {
|
|
22747
23200
|
content: [{ type: "text", text }],
|
|
22748
23201
|
details: {
|
|
@@ -22750,7 +23203,8 @@ ${suppressedLine}` : "";
|
|
|
22750
23203
|
...evidenceDetails,
|
|
22751
23204
|
filesChecked: visibleSummaries.length,
|
|
22752
23205
|
staleDropped,
|
|
22753
|
-
...suppressedDetails
|
|
23206
|
+
...suppressedDetails,
|
|
23207
|
+
...uncheckedDetails
|
|
22754
23208
|
}
|
|
22755
23209
|
};
|
|
22756
23210
|
}
|
|
@@ -22816,49 +23270,631 @@ Summary (${visibleSummaries.length} files diagnosed this session):`,
|
|
|
22816
23270
|
content: [
|
|
22817
23271
|
{
|
|
22818
23272
|
type: "text",
|
|
22819
|
-
text: validationNote + lines.join("\n") + summary + staleNote + suppressedNote
|
|
23273
|
+
text: validationNote + lines.join("\n") + summary + uncheckedNote + staleNote + suppressedNote
|
|
22820
23274
|
}
|
|
22821
23275
|
],
|
|
22822
23276
|
details: {
|
|
22823
23277
|
...detailOverrides,
|
|
22824
23278
|
...evidenceDetails,
|
|
22825
23279
|
filesWithIssues: withIssues.length,
|
|
23280
|
+
filesChecked: visibleSummaries.length,
|
|
22826
23281
|
totalBlocking,
|
|
22827
23282
|
totalErrors,
|
|
22828
23283
|
totalWarnings,
|
|
22829
23284
|
totalAdvisories,
|
|
22830
23285
|
staleDropped,
|
|
22831
|
-
...suppressedDetails
|
|
23286
|
+
...suppressedDetails,
|
|
23287
|
+
...uncheckedDetails
|
|
22832
23288
|
}
|
|
22833
23289
|
};
|
|
22834
23290
|
}
|
|
22835
23291
|
|
|
22836
|
-
// dist/tools/
|
|
22837
|
-
|
|
22838
|
-
|
|
22839
|
-
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
22840
|
-
|
|
22841
|
-
// dist/tools/lsp-structured-output.js
|
|
22842
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
22843
|
-
function asRecord(value) {
|
|
22844
|
-
return typeof value === "object" && value !== null ? value : void 0;
|
|
22845
|
-
}
|
|
22846
|
-
function finiteNumber(value) {
|
|
22847
|
-
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
23292
|
+
// dist/tools/project-report.js
|
|
23293
|
+
function errorMessage(err) {
|
|
23294
|
+
return err instanceof Error ? err.message : String(err);
|
|
22848
23295
|
}
|
|
22849
|
-
function
|
|
22850
|
-
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
23296
|
+
function createProjectReportTool(getProjectRoot) {
|
|
23297
|
+
return {
|
|
23298
|
+
name: "project_report",
|
|
23299
|
+
label: "Project Report",
|
|
23300
|
+
description: 'Orient in a project from its review graph, with ranked hubs and entry points. Returns a line-oriented TEXT report by default; pass view:"json" for the full JSON payload. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use project_report before module_report when the target file is unknown.',
|
|
23301
|
+
promptSnippet: "Orient in a project before choosing a file",
|
|
23302
|
+
renderResult: compactRenderResult(({ details, isError }) => {
|
|
23303
|
+
if (isError || details?.available === false) {
|
|
23304
|
+
return `project_report \u2014 unavailable${details?.hint ? `: ${details.hint}` : ""}`;
|
|
23305
|
+
}
|
|
23306
|
+
const parts = [
|
|
23307
|
+
`${details?.hubs ?? 0} hub(s)`,
|
|
23308
|
+
`${details?.entryPoints ?? 0} entry point(s)`
|
|
23309
|
+
];
|
|
23310
|
+
const view = details?.view && details.view !== "default" ? ` [${details.view}]` : "";
|
|
23311
|
+
return `project_report ${parts.join(" \xB7 ")}${view}`;
|
|
23312
|
+
}),
|
|
23313
|
+
parameters: Type.Object({
|
|
23314
|
+
limit: Type.Optional(Type.Number({
|
|
23315
|
+
description: "Scales every ranked section's cap (default 10) \u2014 a single knob for all sections."
|
|
23316
|
+
})),
|
|
23317
|
+
focus: Type.Optional(Type.String({
|
|
23318
|
+
description: "Optional task hint used only to re-rank sections toward relevant subsystems (does not expand scope or trigger scans)."
|
|
23319
|
+
})),
|
|
23320
|
+
view: Type.Optional(Type.String({
|
|
23321
|
+
// Plain string, no enum: "json" (or any "*-json" preset name,
|
|
23322
|
+
// #5372) is the JSON hatch; anything else is text.
|
|
23323
|
+
description: 'Payload tier. "json" (or any "*-json" preset name) returns the full JSON report; any other value (or omitting view) returns the default line-oriented TEXT rendering.'
|
|
23324
|
+
}))
|
|
23325
|
+
}),
|
|
23326
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
23327
|
+
const cwd = getProjectRoot() || ctx.cwd || ".";
|
|
23328
|
+
let report;
|
|
23329
|
+
try {
|
|
23330
|
+
report = await projectReport(cwd, {
|
|
23331
|
+
limit: params.limit,
|
|
23332
|
+
focus: params.focus
|
|
23333
|
+
});
|
|
23334
|
+
} catch (err) {
|
|
23335
|
+
return {
|
|
23336
|
+
...renderToolText(`Project report failed: ${errorMessage(err)}`),
|
|
23337
|
+
isError: true,
|
|
23338
|
+
details: { available: false }
|
|
23339
|
+
};
|
|
23340
|
+
}
|
|
23341
|
+
if (!report.available) {
|
|
23342
|
+
return {
|
|
23343
|
+
content: [
|
|
23344
|
+
{ type: "text", text: renderTextProjectReport(report) }
|
|
23345
|
+
],
|
|
23346
|
+
isError: true,
|
|
23347
|
+
details: { available: false, hint: report.hint }
|
|
23348
|
+
};
|
|
23349
|
+
}
|
|
23350
|
+
const jsonView = projectReportViewIsJson(params.view);
|
|
23351
|
+
const text = jsonView ? JSON.stringify(report) : renderTextProjectReport(report);
|
|
23352
|
+
return {
|
|
23353
|
+
content: [{ type: "text", text }],
|
|
23354
|
+
isError: false,
|
|
23355
|
+
details: {
|
|
23356
|
+
available: true,
|
|
23357
|
+
hubs: report.hubs?.length ?? 0,
|
|
23358
|
+
entryPoints: report.entryPoints?.length ?? 0,
|
|
23359
|
+
view: jsonView ? "json" : "default",
|
|
23360
|
+
[JSON_CELL_DETAILS_KEY]: jsonView
|
|
23361
|
+
}
|
|
23362
|
+
};
|
|
23363
|
+
}
|
|
23364
|
+
};
|
|
23365
|
+
}
|
|
23366
|
+
|
|
23367
|
+
// dist/tools/effective-config.js
|
|
23368
|
+
function countDenied(entries) {
|
|
23369
|
+
return entries.filter((entry) => entry.reason === "disabled-by-config").length;
|
|
23370
|
+
}
|
|
23371
|
+
function summarize(view) {
|
|
23372
|
+
const documents = `${view.documents.length} config file(s)`;
|
|
23373
|
+
if (!view.file)
|
|
23374
|
+
return `effective_config \u2014 ${documents}`;
|
|
23375
|
+
if (isEffectiveFileViewError(view.file)) {
|
|
23376
|
+
return `effective_config \u2014 ${documents} \xB7 ${view.file.error}`;
|
|
23377
|
+
}
|
|
23378
|
+
const selected = view.file.servers.filter((entry) => entry.selected).length;
|
|
23379
|
+
const denied = countDenied(view.file.servers);
|
|
23380
|
+
const tools = view.file.tools.filter((entry) => entry.selected).length;
|
|
23381
|
+
const deniedTools = countDenied(view.file.tools);
|
|
23382
|
+
const deniedClause = denied > 0 ? `, ${denied} denied by config` : "";
|
|
23383
|
+
const deniedToolsClause = deniedTools > 0 ? `, ${deniedTools} denied by config` : "";
|
|
23384
|
+
return `effective_config ${view.file.path} \u2014 ${documents} \xB7 ${selected} server(s) selected${deniedClause} \xB7 ${tools} tool(s)${deniedToolsClause}`;
|
|
23385
|
+
}
|
|
23386
|
+
function createEffectiveConfigTool(getProjectRoot, getNoTools) {
|
|
23387
|
+
return {
|
|
23388
|
+
name: "effective_config",
|
|
23389
|
+
label: "Effective Config",
|
|
23390
|
+
description: "Explain resolved configuration and provenance. Response is redacted by construction: it contains no environment values, no command arguments beyond the binary, and home-relative paths; a tier-denied LSP decision cannot be lifted by a nearer config. Example: pass `path` to see why its LSP server is selected.",
|
|
23391
|
+
promptSnippet: "Explain resolved configuration",
|
|
23392
|
+
renderResult: compactRenderResult(({ details, isError }) => isError ? "effective_config \u2014 failed" : details?.summary ?? "effective_config"),
|
|
23393
|
+
parameters: Type.Object({
|
|
23394
|
+
path: Type.Optional(Type.String({
|
|
23395
|
+
description: "Path to explain: adds the resolved language plus the per-server and per-runner selection decisions for it. Must resolve inside `cwd` (a sibling package in the same monorepo does not count) \u2014 a file outside it is rejected with the `cwd` it was measured against; re-query with `cwd` set to that file's own workspace instead."
|
|
23396
|
+
}))
|
|
23397
|
+
}),
|
|
23398
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
23399
|
+
const cwd = getProjectRoot() || ctx.cwd || ".";
|
|
23400
|
+
const fileRead = readFilePath(params);
|
|
23401
|
+
if (fileRead.refusal) {
|
|
23402
|
+
return {
|
|
23403
|
+
content: [{ type: "text", text: fileRead.refusal }],
|
|
23404
|
+
isError: true,
|
|
23405
|
+
details: { summary: "effective_config \u2014 failed" }
|
|
23406
|
+
};
|
|
23407
|
+
}
|
|
23408
|
+
const view = await effectiveConfig({
|
|
23409
|
+
cwd,
|
|
23410
|
+
...fileRead.path ? { file: fileRead.path } : {},
|
|
23411
|
+
redact: true,
|
|
23412
|
+
noTools: getNoTools?.()
|
|
23413
|
+
});
|
|
23414
|
+
const summary = summarize(view);
|
|
23415
|
+
return {
|
|
23416
|
+
content: [
|
|
23417
|
+
{
|
|
23418
|
+
type: "text",
|
|
23419
|
+
text: `${summary}
|
|
23420
|
+
|
|
23421
|
+
${JSON.stringify(view)}`
|
|
23422
|
+
}
|
|
23423
|
+
],
|
|
23424
|
+
// Summary-shaped, like `symbol_search`'s: the full view is already
|
|
23425
|
+
// in `content[0].text`, and `details` exists for the renderer.
|
|
23426
|
+
// Duplicating a whole provenance dump into it would double the
|
|
23427
|
+
// payload of every call for one line of output.
|
|
23428
|
+
details: {
|
|
23429
|
+
summary,
|
|
23430
|
+
documents: view.documents.length,
|
|
23431
|
+
provenance: view.provenance.length,
|
|
23432
|
+
...view.file === void 0 ? {} : isEffectiveFileViewError(view.file) ? { fileError: view.file.error } : {
|
|
23433
|
+
file: view.file.path,
|
|
23434
|
+
selectedServers: view.file.servers.filter((entry) => entry.selected).length
|
|
23435
|
+
}
|
|
23436
|
+
}
|
|
23437
|
+
};
|
|
23438
|
+
}
|
|
23439
|
+
};
|
|
23440
|
+
}
|
|
23441
|
+
|
|
23442
|
+
// dist/tools/module-report.js
|
|
23443
|
+
import * as path41 from "node:path";
|
|
23444
|
+
function resolveFile(filePath, cwd) {
|
|
23445
|
+
return resolveHostToolPath(filePath, cwd || ".");
|
|
23446
|
+
}
|
|
23447
|
+
function errorMessage2(err) {
|
|
23448
|
+
return err instanceof Error ? err.message : String(err);
|
|
23449
|
+
}
|
|
23450
|
+
function createModuleReportTool(getProjectRoot) {
|
|
23451
|
+
return {
|
|
23452
|
+
name: "module_report",
|
|
23453
|
+
label: "Module Report",
|
|
23454
|
+
description: "Return a navigable source-module outline with symbols, references, and read handles. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use module_report on `src/app.ts` before read_symbol.",
|
|
23455
|
+
promptSnippet: "Outline a source module before reading a body",
|
|
23456
|
+
renderResult: compactRenderResult(({ details, args, isError }) => {
|
|
23457
|
+
const base = baseName(args.path) || "module";
|
|
23458
|
+
if (isError || details?.available === false) {
|
|
23459
|
+
return `module_report ${base} \u2014 unavailable`;
|
|
23460
|
+
}
|
|
23461
|
+
const parts = [
|
|
23462
|
+
`${details?.symbols ?? 0} symbols`,
|
|
23463
|
+
`${details?.exports ?? 0} exports`
|
|
23464
|
+
];
|
|
23465
|
+
if (details?.callbacks)
|
|
23466
|
+
parts.push(`${details.callbacks} callbacks`);
|
|
23467
|
+
const view = details?.view && details.view !== "summary-text" ? ` [${details.view}]` : "";
|
|
23468
|
+
return `module_report ${base} ${parts.join(" \xB7 ")}${view}`;
|
|
23469
|
+
}),
|
|
23470
|
+
parameters: Type.Object({
|
|
23471
|
+
path: Type.String({
|
|
23472
|
+
description: "Source file, e.g. `src/app.ts`."
|
|
23473
|
+
}),
|
|
23474
|
+
maxRefsPerSymbol: Type.Optional(Type.Number({
|
|
23475
|
+
description: "Cap on who-uses-this entries per symbol (default 10)."
|
|
23476
|
+
})),
|
|
23477
|
+
focus: Type.Optional(Type.String({
|
|
23478
|
+
description: "Optional task hint used only to rank recommendedReads (does not expand scope or trigger scans)."
|
|
23479
|
+
})),
|
|
23480
|
+
view: Type.Optional(Type.String({
|
|
23481
|
+
description: 'Output preset: projection \xD7 format. "summary-text" (default) = metric fields off (no usedBy/fanout/complexity fields), text. "summary-json" = same fields, JSON. "full-text" = every field, text. "full-json" = every field, JSON (byte-identical to the pre-#5137 default). Metrics render as a cx:/fan: suffix and flags as [flag]; every field appears in the text cell, `kind` prints raw so it can be reused as read_symbol\'s kind filter, and an unavailable module still renders its callbacks and recommended reads. A summary cell states the omission in its PROVENANCE footer. A maxRefsPerSymbol argument promotes the projection to full and keeps the format.'
|
|
23482
|
+
})),
|
|
23483
|
+
blastRadius: Type.Optional(Type.Boolean({
|
|
23484
|
+
description: "Include the cross-file blast-radius section: transitive dependents aggregated to ranked file reads. Read-only over the cached graph (omitted when cold)."
|
|
23485
|
+
})),
|
|
23486
|
+
blastRadiusDepth: Type.Optional(Type.Number({
|
|
23487
|
+
description: "Max hops for the blast-radius walk (default 3). Only used with blastRadius."
|
|
23488
|
+
})),
|
|
23489
|
+
callGraph: Type.Optional(Type.Boolean({
|
|
23490
|
+
description: "Include bounded derived callers/callees from the cached FunctionCallGraph; cold or stale cache state is explicit."
|
|
23491
|
+
})),
|
|
23492
|
+
maxCallGraphEntries: Type.Optional(Type.Number({
|
|
23493
|
+
description: "Per-direction cap for call-graph relations (default 20)."
|
|
23494
|
+
}))
|
|
23495
|
+
}),
|
|
23496
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
23497
|
+
const absFile = resolveFile(params.path, ctx.cwd);
|
|
23498
|
+
const cwd = getProjectRoot() || ctx.cwd || ".";
|
|
23499
|
+
let report;
|
|
23500
|
+
try {
|
|
23501
|
+
report = await moduleReport(absFile, cwd, {
|
|
23502
|
+
maxRefsPerSymbol: params.maxRefsPerSymbol,
|
|
23503
|
+
view: params.view,
|
|
23504
|
+
focus: params.focus,
|
|
23505
|
+
blastRadius: params.blastRadius,
|
|
23506
|
+
blastRadiusDepth: params.blastRadiusDepth,
|
|
23507
|
+
callGraph: params.callGraph,
|
|
23508
|
+
maxCallGraphEntries: params.maxCallGraphEntries
|
|
23509
|
+
});
|
|
23510
|
+
} catch (err) {
|
|
23511
|
+
return {
|
|
23512
|
+
content: [
|
|
23513
|
+
{
|
|
23514
|
+
type: "text",
|
|
23515
|
+
text: `Module report failed for ${path41.basename(absFile)}: ${errorMessage2(err)}`
|
|
23516
|
+
}
|
|
23517
|
+
],
|
|
23518
|
+
isError: true,
|
|
23519
|
+
details: { available: false }
|
|
23520
|
+
};
|
|
23521
|
+
}
|
|
23522
|
+
const choice = resolveModuleReportPreset(params.view, params.maxRefsPerSymbol);
|
|
23523
|
+
const text = renderModuleReportPreset(report, choice);
|
|
23524
|
+
return {
|
|
23525
|
+
content: [{ type: "text", text }],
|
|
23526
|
+
isError: !report.available,
|
|
23527
|
+
details: {
|
|
23528
|
+
available: report.available,
|
|
23529
|
+
staleness: report.staleness,
|
|
23530
|
+
symbols: report.summary.symbols,
|
|
23531
|
+
exports: report.summary.exports,
|
|
23532
|
+
callbacks: report.callbacks.length,
|
|
23533
|
+
callbackSupport: report.callbackSupport,
|
|
23534
|
+
view: choice.preset,
|
|
23535
|
+
[JSON_CELL_DETAILS_KEY]: choice.format === "json"
|
|
23536
|
+
}
|
|
23537
|
+
};
|
|
23538
|
+
}
|
|
23539
|
+
};
|
|
23540
|
+
}
|
|
23541
|
+
function recordReadCoverage(recordSymbolRead, result, phase, toolCallId, ctx) {
|
|
23542
|
+
if (!result.name || !result.kind || typeof result.startLine !== "number" || typeof result.endLine !== "number") {
|
|
23543
|
+
return false;
|
|
23544
|
+
}
|
|
23545
|
+
try {
|
|
23546
|
+
recordSymbolRead(result.path, {
|
|
23547
|
+
name: result.name,
|
|
23548
|
+
kind: result.kind,
|
|
23549
|
+
startLine: result.startLine,
|
|
23550
|
+
endLine: result.endLine
|
|
23551
|
+
}, toolCallId, ctx);
|
|
23552
|
+
return true;
|
|
23553
|
+
} catch (err) {
|
|
23554
|
+
logLatency({
|
|
23555
|
+
type: "phase",
|
|
23556
|
+
phase,
|
|
23557
|
+
filePath: result.path,
|
|
23558
|
+
durationMs: 0,
|
|
23559
|
+
metadata: { error: errorMessage2(err) }
|
|
23560
|
+
});
|
|
23561
|
+
return false;
|
|
23562
|
+
}
|
|
23563
|
+
}
|
|
23564
|
+
function createReadSymbolTool(getProjectRoot, recordSymbolRead) {
|
|
23565
|
+
return {
|
|
23566
|
+
name: "read_symbol",
|
|
23567
|
+
label: "Read Symbol",
|
|
23568
|
+
description: "Return one symbol's verbatim source. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use read_symbol after module_report identifies `parseConfig`.",
|
|
23569
|
+
promptSnippet: "Read one symbol's body instead of the whole file",
|
|
23570
|
+
renderResult: compactRenderResult(({ details, args, isError, lineCount: lineCount3 }) => {
|
|
23571
|
+
const base = baseName(args.path);
|
|
23572
|
+
if (isError || details?.found === false) {
|
|
23573
|
+
const sym = typeof args.symbol === "string" ? args.symbol : "?";
|
|
23574
|
+
return `read_symbol "${sym}" ${base} \u2014 not found`;
|
|
23575
|
+
}
|
|
23576
|
+
const range = details?.startLine && details?.endLine ? `:${details.startLine}-${details.endLine} (${details.endLine - details.startLine + 1} lines)` : ` (${lineCount3} lines)`;
|
|
23577
|
+
return `read_symbol ${details?.kind ?? ""} ${details?.name ?? ""} ${base}${range}`.replace(/\s+/g, " ");
|
|
23578
|
+
}),
|
|
23579
|
+
parameters: Type.Object({
|
|
23580
|
+
path: Type.String({
|
|
23581
|
+
description: "Absolute or workspace-relative path to the source file."
|
|
23582
|
+
}),
|
|
23583
|
+
symbol: Type.String({
|
|
23584
|
+
description: "Exact symbol name or callback handle to read (e.g. a function, class, type, or module_report callbacks[].name). Accepts a dotted `Class.method` name to resolve a member."
|
|
23585
|
+
}),
|
|
23586
|
+
kind: Type.Optional(Type.String({
|
|
23587
|
+
description: "Optional kind filter (e.g. function, interface, class) to disambiguate when multiple same-file symbols share the requested name. Omitting it returns the first match, same as today."
|
|
23588
|
+
}))
|
|
23589
|
+
}),
|
|
23590
|
+
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
23591
|
+
const absFile = resolveFile(params.path, ctx.cwd);
|
|
23592
|
+
const cwd = getProjectRoot() || ctx.cwd || ".";
|
|
23593
|
+
let result;
|
|
23594
|
+
try {
|
|
23595
|
+
result = await readSymbol(absFile, params.symbol, cwd, {
|
|
23596
|
+
kind: params.kind
|
|
23597
|
+
});
|
|
23598
|
+
} catch (err) {
|
|
23599
|
+
return {
|
|
23600
|
+
content: [
|
|
23601
|
+
{
|
|
23602
|
+
type: "text",
|
|
23603
|
+
text: `Read symbol failed for ${path41.basename(absFile)}: ${errorMessage2(err)}`
|
|
23604
|
+
}
|
|
23605
|
+
],
|
|
23606
|
+
isError: true,
|
|
23607
|
+
details: { found: false }
|
|
23608
|
+
};
|
|
23609
|
+
}
|
|
23610
|
+
if (!result.found) {
|
|
23611
|
+
const warningSuffix = result.warnings?.length ? ` Warnings: ${result.warnings.join("; ")}` : "";
|
|
23612
|
+
const suggestionSuffix = result.suggestions?.length ? ` Did you mean: ${result.suggestions.join(", ")}?` : " Use module_report to list available symbols.";
|
|
23613
|
+
const text = result.error ? `Could not inspect ${path41.basename(absFile)}: ${result.error}${warningSuffix}` : `Symbol "${params.symbol}" not found in ${path41.basename(absFile)}.${suggestionSuffix}${warningSuffix}`;
|
|
23614
|
+
return {
|
|
23615
|
+
content: [{ type: "text", text }],
|
|
23616
|
+
isError: true,
|
|
23617
|
+
details: {
|
|
23618
|
+
found: false,
|
|
23619
|
+
...result.error ? { error: result.error } : {},
|
|
23620
|
+
...result.warnings ? { warnings: result.warnings } : {},
|
|
23621
|
+
...result.suggestions ? { suggestions: result.suggestions } : {}
|
|
23622
|
+
}
|
|
23623
|
+
};
|
|
23624
|
+
}
|
|
23625
|
+
const readRecorded = recordReadCoverage(recordSymbolRead, result, "read_symbol_guard_error", toolCallId, ctx);
|
|
23626
|
+
const ambiguityNote = result.ambiguous ? ` (${result.ambiguous.count} matches \u2014 returned the ${result.kind}; pass \`kind\` to disambiguate: ${result.ambiguous.kinds.join(", ")})` : "";
|
|
23627
|
+
const header = `${result.kind} ${result.name}${ambiguityNote} ${path41.basename(result.path)}:${result.startLine}-${result.endLine}`;
|
|
23628
|
+
const guardWarning = readRecorded ? "" : "\n\nWarning: read coverage recording failed; the returned body may not satisfy the edit guard.";
|
|
23629
|
+
return {
|
|
23630
|
+
content: [
|
|
23631
|
+
{
|
|
23632
|
+
type: "text",
|
|
23633
|
+
text: `${header}${guardWarning}
|
|
23634
|
+
|
|
23635
|
+
${result.source ?? ""}`
|
|
23636
|
+
}
|
|
23637
|
+
],
|
|
23638
|
+
details: {
|
|
23639
|
+
found: true,
|
|
23640
|
+
name: result.name,
|
|
23641
|
+
kind: result.kind,
|
|
23642
|
+
startLine: result.startLine,
|
|
23643
|
+
endLine: result.endLine,
|
|
23644
|
+
readRecorded,
|
|
23645
|
+
...result.ambiguous ? { ambiguous: result.ambiguous } : {}
|
|
23646
|
+
}
|
|
23647
|
+
};
|
|
23648
|
+
}
|
|
23649
|
+
};
|
|
23650
|
+
}
|
|
23651
|
+
function createReadEnclosingTool(getProjectRoot, recordSymbolRead) {
|
|
23652
|
+
return {
|
|
23653
|
+
name: "read_enclosing",
|
|
23654
|
+
label: "Read Enclosing",
|
|
23655
|
+
description: "Return the smallest symbol or callback enclosing a line. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use read_enclosing after a diagnostic points to line 42.",
|
|
23656
|
+
promptSnippet: "Read the enclosing symbol or callback body for a line",
|
|
23657
|
+
renderResult: compactRenderResult(({ details, args, isError }) => {
|
|
23658
|
+
const base = baseName(args.path);
|
|
23659
|
+
if (isError || details?.found === false) {
|
|
23660
|
+
const ln = typeof args.line === "number" ? args.line : "?";
|
|
23661
|
+
return `read_enclosing ${base}:${ln} \u2014 no enclosing symbol`;
|
|
23662
|
+
}
|
|
23663
|
+
const range = details?.startLine && details?.endLine ? `:${details.startLine}-${details.endLine}` : "";
|
|
23664
|
+
return `read_enclosing ${details?.kind ?? ""} ${details?.name ?? ""} ${base}${range}`.replace(/\s+/g, " ");
|
|
23665
|
+
}),
|
|
23666
|
+
constrainedSampling: CONSTRAINED_JSON_SCHEMA_SAMPLING,
|
|
23667
|
+
parameters: Type.Object({
|
|
23668
|
+
path: Type.String({
|
|
23669
|
+
description: "Absolute or workspace-relative path to the source file."
|
|
23670
|
+
}),
|
|
23671
|
+
line: Type.Number({
|
|
23672
|
+
description: "1-based line number inside the desired symbol/callback."
|
|
23673
|
+
}),
|
|
23674
|
+
kinds: Type.Optional(Type.Array(Type.String(), {
|
|
23675
|
+
description: "Optional kind filter, e.g. function, method, callback, class, object_property_callback."
|
|
23676
|
+
})),
|
|
23677
|
+
maxLines: Type.Optional(Type.Number({
|
|
23678
|
+
description: "Optional maximum body size to return. Oversized matches obey onOversize."
|
|
23679
|
+
})),
|
|
23680
|
+
onOversize: Type.Optional(Type.String({
|
|
23681
|
+
enum: ["error", "slice", "outline"],
|
|
23682
|
+
description: "Behavior when the enclosing body exceeds maxLines. error (default) returns metadata only; slice returns a bounded partial read around line; outline returns nested symbols/callbacks with read handles."
|
|
23683
|
+
})),
|
|
23684
|
+
aroundLine: Type.Optional(Type.Number({
|
|
23685
|
+
description: "Maximum lines for onOversize=slice; defaults to maxLines, then 80."
|
|
23686
|
+
}))
|
|
23687
|
+
}),
|
|
23688
|
+
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
23689
|
+
const absFile = resolveFile(params.path, ctx.cwd);
|
|
23690
|
+
const cwd = getProjectRoot() || ctx.cwd || ".";
|
|
23691
|
+
let result;
|
|
23692
|
+
try {
|
|
23693
|
+
result = await readEnclosing(absFile, params.line, cwd, {
|
|
23694
|
+
kinds: params.kinds,
|
|
23695
|
+
maxLines: params.maxLines,
|
|
23696
|
+
onOversize: params.onOversize,
|
|
23697
|
+
aroundLine: params.aroundLine
|
|
23698
|
+
});
|
|
23699
|
+
} catch (err) {
|
|
23700
|
+
return {
|
|
23701
|
+
content: [
|
|
23702
|
+
{
|
|
23703
|
+
type: "text",
|
|
23704
|
+
text: `Read enclosing failed for ${path41.basename(absFile)}:${params.line}: ${errorMessage2(err)}`
|
|
23705
|
+
}
|
|
23706
|
+
],
|
|
23707
|
+
isError: true,
|
|
23708
|
+
details: { found: false }
|
|
23709
|
+
};
|
|
23710
|
+
}
|
|
23711
|
+
if (!result.found) {
|
|
23712
|
+
const warningSuffix = result.warnings?.length ? ` Warnings: ${result.warnings.join("; ")}` : "";
|
|
23713
|
+
const outlineSuffix = result.outline?.length ? `
|
|
23714
|
+
|
|
23715
|
+
Nested outline:
|
|
23716
|
+
${JSON.stringify(result.outline)}` : "";
|
|
23717
|
+
const text = result.error ? `Could not read enclosing range in ${path41.basename(absFile)}:${result.line}: ${result.error}${warningSuffix}${outlineSuffix}` : `No enclosing symbol/callback found in ${path41.basename(absFile)}:${result.line}.${warningSuffix}`;
|
|
23718
|
+
return {
|
|
23719
|
+
content: [{ type: "text", text }],
|
|
23720
|
+
isError: true,
|
|
23721
|
+
details: {
|
|
23722
|
+
found: false,
|
|
23723
|
+
line: result.line,
|
|
23724
|
+
...result.name ? { name: result.name } : {},
|
|
23725
|
+
...result.kind ? { kind: result.kind } : {},
|
|
23726
|
+
...result.startLine ? { startLine: result.startLine } : {},
|
|
23727
|
+
...result.endLine ? { endLine: result.endLine } : {},
|
|
23728
|
+
...result.enclosingStartLine ? { enclosingStartLine: result.enclosingStartLine } : {},
|
|
23729
|
+
...result.enclosingEndLine ? { enclosingEndLine: result.enclosingEndLine } : {},
|
|
23730
|
+
...result.selection ? { selection: result.selection } : {},
|
|
23731
|
+
...result.outline ? { outline: result.outline } : {},
|
|
23732
|
+
...result.error ? { error: result.error } : {},
|
|
23733
|
+
...result.warnings ? { warnings: result.warnings } : {}
|
|
23734
|
+
}
|
|
23735
|
+
};
|
|
23736
|
+
}
|
|
23737
|
+
const readRecorded = recordReadCoverage(recordSymbolRead, result, "read_enclosing_guard_error", toolCallId, ctx);
|
|
23738
|
+
const range = result.partial ? `${result.startLine}-${result.endLine} (partial of ${result.enclosingStartLine}-${result.enclosingEndLine})` : `${result.startLine}-${result.endLine}`;
|
|
23739
|
+
const header = `${result.kind} ${result.name} ${path41.basename(result.path)}:${range}`;
|
|
23740
|
+
const guardWarning = readRecorded ? "" : "\n\nWarning: read coverage recording failed; the returned body may not satisfy the edit guard.";
|
|
23741
|
+
return {
|
|
23742
|
+
content: [
|
|
23743
|
+
{
|
|
23744
|
+
type: "text",
|
|
23745
|
+
text: `${header}${guardWarning}
|
|
23746
|
+
|
|
23747
|
+
${result.source ?? ""}`
|
|
23748
|
+
}
|
|
23749
|
+
],
|
|
23750
|
+
details: {
|
|
23751
|
+
found: true,
|
|
23752
|
+
name: result.name,
|
|
23753
|
+
kind: result.kind,
|
|
23754
|
+
line: result.line,
|
|
23755
|
+
startLine: result.startLine,
|
|
23756
|
+
endLine: result.endLine,
|
|
23757
|
+
enclosingStartLine: result.enclosingStartLine,
|
|
23758
|
+
enclosingEndLine: result.enclosingEndLine,
|
|
23759
|
+
parentChain: result.parentChain,
|
|
23760
|
+
partial: result.partial,
|
|
23761
|
+
selection: result.selection,
|
|
23762
|
+
readRecorded,
|
|
23763
|
+
...result.warnings ? { warnings: result.warnings } : {}
|
|
23764
|
+
}
|
|
23765
|
+
};
|
|
23766
|
+
}
|
|
23767
|
+
};
|
|
23768
|
+
}
|
|
23769
|
+
|
|
23770
|
+
// dist/tools/symbol-search.js
|
|
23771
|
+
function createSymbolSearchTool(getProjectRoot) {
|
|
23772
|
+
return {
|
|
23773
|
+
name: "symbol_search",
|
|
23774
|
+
label: "Symbol Search",
|
|
23775
|
+
description: "Find relevant files by ranked identifier search. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: search `authenticate user` before module_report. Read a listed line with offset=<line>, limit=1. An `ext:` filter matches a path suffix, so `ext:test.ts` matches `foo.test.ts`.",
|
|
23776
|
+
promptSnippet: "Find files by identifier",
|
|
23777
|
+
renderResult: compactRenderResult(({ details, isError }) => {
|
|
23778
|
+
if (isError || details?.available === false) {
|
|
23779
|
+
return `symbol_search "${details?.query ?? ""}" \u2014 unavailable${details?.hint ? `: ${details.hint}` : ""}`;
|
|
23780
|
+
}
|
|
23781
|
+
return `symbol_search "${details?.query ?? ""}" ${details?.count ?? 0} file(s)`;
|
|
23782
|
+
}),
|
|
23783
|
+
parameters: Type.Object({
|
|
23784
|
+
query: Type.String({
|
|
23785
|
+
description: "Identifier-ish query, e.g. 'authenticate user'. Scope hits before ranking with composable prefix filters: lang:<kind|id> (e.g. lang:jsts, lang:typescript), file:<substr> (path substring), ext:<ext> (e.g. ext:ts or ext:.ts), each optionally negated with a leading '-' (-file:test). An unknown key: prefix is a literal search term, not an error; an unknown lang value refuses with the supported list. A scope with no terms lists the scoped files."
|
|
23786
|
+
}),
|
|
23787
|
+
limit: Type.Optional(Type.Number({
|
|
23788
|
+
description: "Max files to return (default 20)."
|
|
23789
|
+
})),
|
|
23790
|
+
paths: Type.Optional(Type.Array(Type.String(), {
|
|
23791
|
+
description: `Files, directories or globs scoping hits to matching files (a bare directory entry scopes its whole subtree). ${PATHS_GLOB_CLAUSE} Filters before ranking, so scores within the scoped set are unaffected.`
|
|
23792
|
+
})),
|
|
23793
|
+
lang: Type.Optional(Type.String({
|
|
23794
|
+
description: "Restrict hits to one language, using the same identifiers as ast_grep_search's `lang` param (e.g. 'typescript', 'python', 'go')."
|
|
23795
|
+
}))
|
|
23796
|
+
}),
|
|
23797
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
23798
|
+
const cwd = getProjectRoot() || ctx.cwd || ".";
|
|
23799
|
+
const pathsRead = await readPathsArgument(params.paths, {
|
|
23800
|
+
cwd,
|
|
23801
|
+
filterOnly: true,
|
|
23802
|
+
signal: _signal
|
|
23803
|
+
});
|
|
23804
|
+
if (pathsRead.refusal) {
|
|
23805
|
+
return {
|
|
23806
|
+
content: [{ type: "text", text: pathsRead.refusal }],
|
|
23807
|
+
isError: true,
|
|
23808
|
+
details: { available: true, query: params.query }
|
|
23809
|
+
};
|
|
23810
|
+
}
|
|
23811
|
+
let result;
|
|
23812
|
+
try {
|
|
23813
|
+
result = await symbolSearch(params.query, cwd, params.limit, {
|
|
23814
|
+
...pathsRead.entries.length > 0 ? { paths: pathsRead.entries } : {},
|
|
23815
|
+
lang: params.lang
|
|
23816
|
+
});
|
|
23817
|
+
} catch (err) {
|
|
23818
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
23819
|
+
return {
|
|
23820
|
+
content: [
|
|
23821
|
+
{
|
|
23822
|
+
type: "text",
|
|
23823
|
+
text: `Symbol search failed for "${params.query}": ${message}`
|
|
23824
|
+
}
|
|
23825
|
+
],
|
|
23826
|
+
isError: true,
|
|
23827
|
+
details: { available: false, query: params.query }
|
|
23828
|
+
};
|
|
23829
|
+
}
|
|
23830
|
+
if (result.refusal) {
|
|
23831
|
+
return {
|
|
23832
|
+
content: [{ type: "text", text: result.refusal }],
|
|
23833
|
+
isError: true,
|
|
23834
|
+
details: { available: true, query: result.query }
|
|
23835
|
+
};
|
|
23836
|
+
}
|
|
23837
|
+
if (!result.available) {
|
|
23838
|
+
return {
|
|
23839
|
+
content: [
|
|
23840
|
+
{
|
|
23841
|
+
type: "text",
|
|
23842
|
+
text: result.hint ?? "No word index for this workspace yet \u2014 retry shortly."
|
|
23843
|
+
}
|
|
23844
|
+
],
|
|
23845
|
+
isError: true,
|
|
23846
|
+
details: {
|
|
23847
|
+
available: false,
|
|
23848
|
+
query: result.query,
|
|
23849
|
+
hint: result.hint,
|
|
23850
|
+
unavailableReason: result.unavailableReason
|
|
23851
|
+
}
|
|
23852
|
+
};
|
|
23853
|
+
}
|
|
23854
|
+
return {
|
|
23855
|
+
content: [
|
|
23856
|
+
{
|
|
23857
|
+
type: "text",
|
|
23858
|
+
text: renderCompactSymbolSearch(result, { cwd })
|
|
23859
|
+
}
|
|
23860
|
+
],
|
|
23861
|
+
details: {
|
|
23862
|
+
available: true,
|
|
23863
|
+
query: result.query,
|
|
23864
|
+
count: result.results.length,
|
|
23865
|
+
coverage: result.coverage
|
|
23866
|
+
}
|
|
23867
|
+
};
|
|
23868
|
+
}
|
|
23869
|
+
};
|
|
23870
|
+
}
|
|
23871
|
+
|
|
23872
|
+
// dist/tools/lsp-navigation.js
|
|
23873
|
+
import * as nodeFs4 from "node:fs";
|
|
23874
|
+
import * as path42 from "node:path";
|
|
23875
|
+
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
23876
|
+
|
|
23877
|
+
// dist/tools/lsp-structured-output.js
|
|
23878
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
23879
|
+
function asRecord(value) {
|
|
23880
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
23881
|
+
}
|
|
23882
|
+
function finiteNumber(value) {
|
|
23883
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
23884
|
+
}
|
|
23885
|
+
function lspStatusFromFailureKind(failureKind) {
|
|
23886
|
+
if (failureKind === "success" || failureKind === "fallback_success" || failureKind === "fallback_after_timeout") {
|
|
23887
|
+
return "success";
|
|
23888
|
+
}
|
|
23889
|
+
if (failureKind === "empty_result")
|
|
23890
|
+
return "empty";
|
|
23891
|
+
if (failureKind === "unsupported")
|
|
23892
|
+
return "unsupported";
|
|
23893
|
+
if (failureKind === "bad_input" || failureKind === "invalid_operation" || failureKind === "missing_file_path") {
|
|
23894
|
+
return "bad_input";
|
|
23895
|
+
}
|
|
23896
|
+
if (failureKind === "no_server")
|
|
23897
|
+
return "no_server";
|
|
22862
23898
|
if (failureKind === "lsp_disabled")
|
|
22863
23899
|
return "lsp_disabled";
|
|
22864
23900
|
if (failureKind === "filepath_is_directory")
|
|
@@ -23658,7 +24694,7 @@ function noServerAnsweredText(filePath) {
|
|
|
23658
24694
|
const { disabledServerIds, fallbackServerIds } = disabledPrimaries(filePath);
|
|
23659
24695
|
const cause = primaryUnavailableCause([...fallbackServerIds, ...disabledServerIds], disabledServerIds, fallbackServerIds);
|
|
23660
24696
|
const who = disabledServerIds.length > 0 ? `Primary LSP (${disabledServerIds.join(", ")}) did not answer` : "no language server answered";
|
|
23661
|
-
return `No LSP server available for ${
|
|
24697
|
+
return `No LSP server available for ${path42.basename(filePath)}: ${who} (${PRIMARY_UNAVAILABLE_CAUSE[cause]}).`;
|
|
23662
24698
|
}
|
|
23663
24699
|
function emptyReasonForOperation(operation) {
|
|
23664
24700
|
if (operation === "signatureHelp")
|
|
@@ -24007,7 +25043,7 @@ function collectSearchReadsForOperation(operation, result, callHierarchyItem) {
|
|
|
24007
25043
|
}
|
|
24008
25044
|
function formatCapabilities(snapshots, filePath) {
|
|
24009
25045
|
if (snapshots.length === 0) {
|
|
24010
|
-
return filePath ? `No active LSP server for ${
|
|
25046
|
+
return filePath ? `No active LSP server for ${path42.basename(filePath)}. Open/touch the file first or run another LSP operation to start the server.` : "No active LSP servers in this session.";
|
|
24011
25047
|
}
|
|
24012
25048
|
const rows = [
|
|
24013
25049
|
["definition", (s) => !!s.operationSupport.definition],
|
|
@@ -24037,7 +25073,7 @@ function formatCapabilities(snapshots, filePath) {
|
|
|
24037
25073
|
];
|
|
24038
25074
|
const lines = [];
|
|
24039
25075
|
for (const snapshot of snapshots) {
|
|
24040
|
-
const label = filePath ? `${snapshot.serverId} (${
|
|
25076
|
+
const label = filePath ? `${snapshot.serverId} (${path42.basename(filePath)})` : `${snapshot.serverId} (${snapshot.root})`;
|
|
24041
25077
|
lines.push(label);
|
|
24042
25078
|
for (const [name, supported, note] of rows) {
|
|
24043
25079
|
const suffix = note ? ` (${note})` : "";
|
|
@@ -24102,6 +25138,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
24102
25138
|
}
|
|
24103
25139
|
return `lsp_navigation ${op} \u2014 ${n} result${n === 1 ? "" : "s"}`;
|
|
24104
25140
|
}),
|
|
25141
|
+
constrainedSampling: CONSTRAINED_JSON_SCHEMA_SAMPLING,
|
|
24105
25142
|
parameters: Type.Object({
|
|
24106
25143
|
operation: Type.String({
|
|
24107
25144
|
enum: [...VALID_OPERATIONS],
|
|
@@ -24405,7 +25442,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
24405
25442
|
content: [
|
|
24406
25443
|
{
|
|
24407
25444
|
type: "text",
|
|
24408
|
-
text: `No LSP server available for ${
|
|
25445
|
+
text: `No LSP server available for ${path42.basename(filePath)}: ${NO_SERVER_REASON}.`
|
|
24409
25446
|
}
|
|
24410
25447
|
],
|
|
24411
25448
|
isError: true
|
|
@@ -24570,7 +25607,7 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24570
25607
|
content: [
|
|
24571
25608
|
{
|
|
24572
25609
|
type: "text",
|
|
24573
|
-
text: disabledPrimaries(filePath).disabledServerIds.length > 0 ? noServerAnsweredText(filePath) : `No LSP server available for ${
|
|
25610
|
+
text: disabledPrimaries(filePath).disabledServerIds.length > 0 ? noServerAnsweredText(filePath) : `No LSP server available for ${path42.basename(filePath)}: ${NO_SERVER_REASON}.`
|
|
24574
25611
|
}
|
|
24575
25612
|
],
|
|
24576
25613
|
isError: true
|
|
@@ -24590,7 +25627,7 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24590
25627
|
content: [
|
|
24591
25628
|
{
|
|
24592
25629
|
type: "text",
|
|
24593
|
-
text: `LSP server for ${
|
|
25630
|
+
text: `LSP server for ${path42.basename(filePath)} does not advertise support for ${operation}`
|
|
24594
25631
|
}
|
|
24595
25632
|
],
|
|
24596
25633
|
isError: true,
|
|
@@ -24644,7 +25681,7 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24644
25681
|
const msg = err instanceof Error ? err.message : String(err);
|
|
24645
25682
|
if (rawPath && /No Project/i.test(msg)) {
|
|
24646
25683
|
await openFileBestEffort(lspService, filePath);
|
|
24647
|
-
await new Promise((
|
|
25684
|
+
await new Promise((resolve34) => setTimeout(resolve34, 120));
|
|
24648
25685
|
const retryRaw = await lspService.workspaceSymbol(query ?? "", filePath);
|
|
24649
25686
|
const retrySymbols = (Array.isArray(retryRaw) ? retryRaw : [retryRaw]).filter((s) => typeof s === "object" && s !== null);
|
|
24650
25687
|
return dedupeWorkspaceSymbols(retrySymbols);
|
|
@@ -24899,7 +25936,7 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24899
25936
|
isError: true
|
|
24900
25937
|
}, { operation, filePath, failureKind: "no_server", resultCount: 0 });
|
|
24901
25938
|
}
|
|
24902
|
-
const fileCtx = filePath ? " at " +
|
|
25939
|
+
const fileCtx = filePath ? " at " + path42.basename(filePath) : "";
|
|
24903
25940
|
const lineCtx = line ? ":" + line + ":" + character : "";
|
|
24904
25941
|
let output = isEmpty ? "No results for " + operation + fileCtx + lineCtx : JSON.stringify(result);
|
|
24905
25942
|
if (isEmpty && operation === "workspaceSymbol" && !rawPath) {
|
|
@@ -24944,9 +25981,6 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24944
25981
|
};
|
|
24945
25982
|
}
|
|
24946
25983
|
|
|
24947
|
-
// dist/tools/symbol-search.js
|
|
24948
|
-
var SYMBOL_SEARCH_DESCRIPTION = "Find relevant files by ranked identifier search. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: search `authenticate user` before module_report. Read a listed line with offset=<line>, limit=1. An `ext:` filter matches a path suffix, so `ext:test.ts` matches `foo.test.ts`.";
|
|
24949
|
-
|
|
24950
25984
|
// dist/mcp/tool-arguments.js
|
|
24951
25985
|
var MAX_REPORTED_KEYS = 8;
|
|
24952
25986
|
var MAX_REPORTED_KEY_CHARS = 64;
|
|
@@ -25092,10 +26126,10 @@ Not run: ${reasons.join("; ")}.`
|
|
|
25092
26126
|
}
|
|
25093
26127
|
|
|
25094
26128
|
// dist/mcp/build-staleness.js
|
|
25095
|
-
import * as
|
|
26129
|
+
import * as fs24 from "node:fs";
|
|
25096
26130
|
var realStat = (targetPath) => {
|
|
25097
26131
|
try {
|
|
25098
|
-
return
|
|
26132
|
+
return fs24.statSync(targetPath);
|
|
25099
26133
|
} catch {
|
|
25100
26134
|
return void 0;
|
|
25101
26135
|
}
|
|
@@ -25164,6 +26198,30 @@ var WARN_ONLY_STALE_TOOLS = /* @__PURE__ */ new Set([
|
|
|
25164
26198
|
"pilens_effective_config"
|
|
25165
26199
|
]);
|
|
25166
26200
|
|
|
26201
|
+
// dist/mcp/input-schema.js
|
|
26202
|
+
function schemaWithCwd(parameters) {
|
|
26203
|
+
const p = parameters;
|
|
26204
|
+
const properties = {};
|
|
26205
|
+
for (const [key, value] of Object.entries(p.properties ?? {})) {
|
|
26206
|
+
const property = value;
|
|
26207
|
+
properties[key] = typeof property.description === "string" ? {
|
|
26208
|
+
...property,
|
|
26209
|
+
description: translateGuidanceToolNames(property.description, "mcp")
|
|
26210
|
+
} : value;
|
|
26211
|
+
}
|
|
26212
|
+
return {
|
|
26213
|
+
type: "object",
|
|
26214
|
+
properties: {
|
|
26215
|
+
...properties,
|
|
26216
|
+
cwd: {
|
|
26217
|
+
type: "string",
|
|
26218
|
+
description: "Project root (defaults to the server workspace)."
|
|
26219
|
+
}
|
|
26220
|
+
},
|
|
26221
|
+
...p.required ? { required: p.required } : {}
|
|
26222
|
+
};
|
|
26223
|
+
}
|
|
26224
|
+
|
|
25167
26225
|
// dist/mcp/server.js
|
|
25168
26226
|
console.log = (...args) => {
|
|
25169
26227
|
console.error(...args);
|
|
@@ -25175,11 +26233,11 @@ function resolveDefaultCwd() {
|
|
|
25175
26233
|
const fromArg = process.argv.find((arg) => arg.startsWith("--cwd="))?.slice("--cwd=".length);
|
|
25176
26234
|
return fromArg ?? process.env.PI_LENS_MCP_CWD ?? process.cwd();
|
|
25177
26235
|
}
|
|
25178
|
-
var DEFAULT_CWD =
|
|
26236
|
+
var DEFAULT_CWD = path43.resolve(resolveDefaultCwd());
|
|
25179
26237
|
var lspReadyCwds = /* @__PURE__ */ new Set();
|
|
25180
26238
|
var SERVER_FILE = fileURLToPath3(import.meta.url);
|
|
25181
|
-
var SERVER_DIR =
|
|
25182
|
-
var WORKER_PATH =
|
|
26239
|
+
var SERVER_DIR = path43.dirname(SERVER_FILE);
|
|
26240
|
+
var WORKER_PATH = path43.join(SERVER_DIR, "worker.js");
|
|
25183
26241
|
var REBUILD_SCRIPT = resolveRebuildScript(SERVER_FILE);
|
|
25184
26242
|
var STALENESS_STAT_PATH = process.env.PI_LENS_MCP_STALENESS_STAT_PATH ?? SERVER_FILE;
|
|
25185
26243
|
var BUILD_STAMP = computeBuildStamp(STALENESS_STAT_PATH);
|
|
@@ -25200,21 +26258,21 @@ function isWarmBuildStale() {
|
|
|
25200
26258
|
}
|
|
25201
26259
|
function findRepoRoot(start) {
|
|
25202
26260
|
for (const dir of walkUpDirs(start, { maxDepth: 6 })) {
|
|
25203
|
-
const pkgPath =
|
|
25204
|
-
if (
|
|
26261
|
+
const pkgPath = path43.join(dir, "package.json");
|
|
26262
|
+
if (fs25.existsSync(pkgPath)) {
|
|
25205
26263
|
try {
|
|
25206
|
-
const pkg = JSON.parse(
|
|
26264
|
+
const pkg = JSON.parse(fs25.readFileSync(pkgPath, "utf8"));
|
|
25207
26265
|
if (pkg.name === "pi-lens")
|
|
25208
26266
|
return dir;
|
|
25209
26267
|
} catch {
|
|
25210
26268
|
}
|
|
25211
26269
|
}
|
|
25212
26270
|
}
|
|
25213
|
-
return
|
|
26271
|
+
return path43.resolve(start, "..", "..");
|
|
25214
26272
|
}
|
|
25215
|
-
var REPO_ROOT = process.env.PI_LENS_MCP_REPO_ROOT ?
|
|
26273
|
+
var REPO_ROOT = process.env.PI_LENS_MCP_REPO_ROOT ? path43.resolve(process.env.PI_LENS_MCP_REPO_ROOT) : findRepoRoot(SERVER_DIR);
|
|
25216
26274
|
async function ensureReady(cwd) {
|
|
25217
|
-
const normalized =
|
|
26275
|
+
const normalized = path43.resolve(cwd);
|
|
25218
26276
|
if (!shouldInitializeSessionRoot(normalized, lspReadyCwds)) {
|
|
25219
26277
|
return;
|
|
25220
26278
|
}
|
|
@@ -25260,12 +26318,12 @@ function getAutoSessionStatus() {
|
|
|
25260
26318
|
}
|
|
25261
26319
|
var IPC_PATH = ipcPathForCwd(DEFAULT_CWD);
|
|
25262
26320
|
function rejectForeignTurnCwd(route, cwd) {
|
|
25263
|
-
const message = `${route} cwd outside this server's workspace: ${
|
|
26321
|
+
const message = `${route} cwd outside this server's workspace: ${path43.resolve(cwd)} not within ${DEFAULT_CWD}`;
|
|
25264
26322
|
console.error(`[pi-lens-mcp] rejected ${message}`);
|
|
25265
26323
|
return message;
|
|
25266
26324
|
}
|
|
25267
26325
|
function isWithinServerWorkspace(cwd) {
|
|
25268
|
-
return isUnderDir(
|
|
26326
|
+
return isUnderDir(path43.resolve(cwd), DEFAULT_CWD);
|
|
25269
26327
|
}
|
|
25270
26328
|
function startIpcServer() {
|
|
25271
26329
|
unlinkStaleUnixSocket(IPC_PATH);
|
|
@@ -25438,22 +26496,21 @@ var lensDiagnosticsTool = createLensDiagnosticsTool(
|
|
|
25438
26496
|
);
|
|
25439
26497
|
var astGrepClient = new AstGrepClient();
|
|
25440
26498
|
var astGrepSearchTool = createAstGrepSearchTool(astGrepClient);
|
|
25441
|
-
var astGrepReplaceTool = createAstGrepReplaceTool(
|
|
26499
|
+
var astGrepReplaceTool = createAstGrepReplaceTool(
|
|
26500
|
+
astGrepClient,
|
|
26501
|
+
void 0,
|
|
26502
|
+
// #5417: resolved against the call's own project, like `lspNavigationTool`.
|
|
26503
|
+
(name, cwd) => createMcpHost(void 0, cwd ?? DEFAULT_CWD).getFlag(name)
|
|
26504
|
+
);
|
|
25442
26505
|
var lspNavigationTool = createLspNavigationTool((name, cwd) => createMcpHost(void 0, cwd ?? DEFAULT_CWD).getFlag(name));
|
|
25443
|
-
|
|
25444
|
-
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
25451
|
-
description: "Project root (defaults to the server workspace)."
|
|
25452
|
-
}
|
|
25453
|
-
},
|
|
25454
|
-
...p.required ? { required: p.required } : {}
|
|
25455
|
-
};
|
|
25456
|
-
}
|
|
26506
|
+
var symbolSearchTool = createSymbolSearchTool(() => DEFAULT_CWD);
|
|
26507
|
+
var projectReportTool = createProjectReportTool(() => DEFAULT_CWD);
|
|
26508
|
+
var moduleReportTool = createModuleReportTool(() => DEFAULT_CWD);
|
|
26509
|
+
var effectiveConfigTool = createEffectiveConfigTool(() => DEFAULT_CWD);
|
|
26510
|
+
var noReadCoverage = () => {
|
|
26511
|
+
};
|
|
26512
|
+
var readSymbolTool = createReadSymbolTool(() => DEFAULT_CWD, noReadCoverage);
|
|
26513
|
+
var readEnclosingTool = createReadEnclosingTool(() => DEFAULT_CWD, noReadCoverage);
|
|
25457
26514
|
var ALL_TOOLS = [
|
|
25458
26515
|
{
|
|
25459
26516
|
name: "pilens_analyze",
|
|
@@ -25527,168 +26584,28 @@ var ALL_TOOLS = [
|
|
|
25527
26584
|
},
|
|
25528
26585
|
{
|
|
25529
26586
|
name: "pilens_symbol_search",
|
|
25530
|
-
description: translateGuidanceToolNames(
|
|
25531
|
-
inputSchema:
|
|
25532
|
-
type: "object",
|
|
25533
|
-
properties: {
|
|
25534
|
-
query: {
|
|
25535
|
-
type: "string",
|
|
25536
|
-
description: "Identifier-ish query, e.g. 'authenticate user'. Mix in composable prefix filters: lang:<kind> (e.g. lang:jsts, lang:python \u2014 kinds from file-kinds.ts), file:<substr> (path substring), ext:<ext> (e.g. ext:ts or ext:.ts), each optionally negated with a leading '-' (-file:test). Filters apply before ranking; e.g. 'lang:jsts file:clients/ -file:test rank'. Unknown prefixes/kinds error with the supported list."
|
|
25537
|
-
},
|
|
25538
|
-
cwd: { type: "string" },
|
|
25539
|
-
limit: {
|
|
25540
|
-
type: "number",
|
|
25541
|
-
description: "Max files to return (default 20)."
|
|
25542
|
-
},
|
|
25543
|
-
paths: {
|
|
25544
|
-
type: "array",
|
|
25545
|
-
items: { type: "string" },
|
|
25546
|
-
description: "Glob array scoping hits to matching files \u2014 same shape/semantics as pilens_ast_grep_search's `paths` (a bare directory/file entry scopes its whole subtree). Filters before ranking, so scores within the scoped set are unaffected."
|
|
25547
|
-
},
|
|
25548
|
-
lang: {
|
|
25549
|
-
type: "string",
|
|
25550
|
-
description: "Restrict hits to one language, using the same identifiers as pilens_ast_grep_search's `lang` param (e.g. 'typescript', 'python', 'go')."
|
|
25551
|
-
}
|
|
25552
|
-
},
|
|
25553
|
-
required: ["query"]
|
|
25554
|
-
}
|
|
26587
|
+
description: translateGuidanceToolNames(symbolSearchTool.description, "mcp"),
|
|
26588
|
+
inputSchema: schemaWithCwd(symbolSearchTool.parameters)
|
|
25555
26589
|
},
|
|
25556
26590
|
{
|
|
25557
26591
|
name: "pilens_module_report",
|
|
25558
|
-
description: translateGuidanceToolNames(
|
|
25559
|
-
inputSchema:
|
|
25560
|
-
type: "object",
|
|
25561
|
-
properties: {
|
|
25562
|
-
file: {
|
|
25563
|
-
type: "string",
|
|
25564
|
-
description: "File to report on (absolute or relative to cwd)."
|
|
25565
|
-
},
|
|
25566
|
-
path: {
|
|
25567
|
-
type: "string",
|
|
25568
|
-
description: "File to report on (the canonical spelling of `file`)."
|
|
25569
|
-
},
|
|
25570
|
-
filePath: { type: "string", description: "Alias for `path`." },
|
|
25571
|
-
cwd: { type: "string" },
|
|
25572
|
-
maxRefsPerSymbol: {
|
|
25573
|
-
type: "number",
|
|
25574
|
-
description: "Cap who-uses-this entries per symbol (default 10)."
|
|
25575
|
-
},
|
|
25576
|
-
focus: {
|
|
25577
|
-
type: "string",
|
|
25578
|
-
description: "Optional task hint used only to rank recommendedReads (does not expand scope or trigger scans)."
|
|
25579
|
-
},
|
|
25580
|
-
view: {
|
|
25581
|
-
type: "string",
|
|
25582
|
-
description: 'Output preset: projection \xD7 format. "summary-text" (default) = metric fields off (no usedBy/fanout/complexity fields), text. "summary-json" = same fields, JSON. "full-text" = every field, text. "full-json" = every field, JSON (byte-identical to the pre-#5137 default). Metrics render as a cx:/fan: suffix and flags as [flag]; every field appears in the text cell, `kind` prints raw so it can be reused as read_symbol\'s kind filter, and an unavailable module still renders its callbacks and recommended reads. A summary cell states the omission in its PROVENANCE footer. A maxRefsPerSymbol argument promotes the projection to full and keeps the format.'
|
|
25583
|
-
},
|
|
25584
|
-
blastRadius: {
|
|
25585
|
-
type: "boolean",
|
|
25586
|
-
description: "Include the cross-file blast radius: transitive dependents aggregated to ranked file reads. Read-only over the cached graph (omitted when cold)."
|
|
25587
|
-
},
|
|
25588
|
-
blastRadiusDepth: {
|
|
25589
|
-
type: "number",
|
|
25590
|
-
description: "Max hops for the blast-radius walk (default 3). Only used with blastRadius."
|
|
25591
|
-
},
|
|
25592
|
-
callGraph: {
|
|
25593
|
-
type: "boolean",
|
|
25594
|
-
description: "Include bounded derived callers/callees from the cached FunctionCallGraph; cold or stale cache state is explicit."
|
|
25595
|
-
},
|
|
25596
|
-
maxCallGraphEntries: {
|
|
25597
|
-
type: "number",
|
|
25598
|
-
description: "Per-direction cap for call-graph relations (default 20)."
|
|
25599
|
-
}
|
|
25600
|
-
}
|
|
25601
|
-
}
|
|
26592
|
+
description: translateGuidanceToolNames(moduleReportTool.description, "mcp"),
|
|
26593
|
+
inputSchema: schemaWithCwd(moduleReportTool.parameters)
|
|
25602
26594
|
},
|
|
25603
26595
|
{
|
|
25604
26596
|
name: "pilens_project_report",
|
|
25605
|
-
description: translateGuidanceToolNames(
|
|
25606
|
-
inputSchema:
|
|
25607
|
-
type: "object",
|
|
25608
|
-
properties: {
|
|
25609
|
-
cwd: { type: "string" },
|
|
25610
|
-
limit: {
|
|
25611
|
-
type: "number",
|
|
25612
|
-
description: "Scales every ranked section's cap (default 10) \u2014 a single knob for all sections."
|
|
25613
|
-
},
|
|
25614
|
-
focus: {
|
|
25615
|
-
type: "string",
|
|
25616
|
-
description: "Optional task hint used only to re-rank sections toward relevant subsystems (does not expand scope or trigger scans)."
|
|
25617
|
-
},
|
|
25618
|
-
view: {
|
|
25619
|
-
type: "string",
|
|
25620
|
-
// Plain string, no enum: "json" is the JSON hatch; anything else is text.
|
|
25621
|
-
description: 'Payload tier. "json" returns the full JSON report; any other value (or omitting view) returns the default line-oriented TEXT rendering.'
|
|
25622
|
-
}
|
|
25623
|
-
}
|
|
25624
|
-
}
|
|
26597
|
+
description: translateGuidanceToolNames(projectReportTool.description, "mcp"),
|
|
26598
|
+
inputSchema: schemaWithCwd(projectReportTool.parameters)
|
|
25625
26599
|
},
|
|
25626
26600
|
{
|
|
25627
26601
|
name: "pilens_read_symbol",
|
|
25628
|
-
description: translateGuidanceToolNames(
|
|
25629
|
-
inputSchema:
|
|
25630
|
-
type: "object",
|
|
25631
|
-
properties: {
|
|
25632
|
-
file: { type: "string", description: "File containing the symbol." },
|
|
25633
|
-
path: {
|
|
25634
|
-
type: "string",
|
|
25635
|
-
description: "File containing the symbol (the canonical spelling of `file`)."
|
|
25636
|
-
},
|
|
25637
|
-
filePath: { type: "string", description: "Alias for `path`." },
|
|
25638
|
-
symbol: {
|
|
25639
|
-
type: "string",
|
|
25640
|
-
description: "Exact symbol name to read, or a dotted `Class.method` to disambiguate a member."
|
|
25641
|
-
},
|
|
25642
|
-
kind: {
|
|
25643
|
-
type: "string",
|
|
25644
|
-
description: "Optional kind filter (e.g. function, interface, class) to disambiguate when multiple same-file symbols share the requested name."
|
|
25645
|
-
},
|
|
25646
|
-
cwd: { type: "string" }
|
|
25647
|
-
},
|
|
25648
|
-
required: ["symbol"]
|
|
25649
|
-
}
|
|
26602
|
+
description: translateGuidanceToolNames(readSymbolTool.description, "mcp"),
|
|
26603
|
+
inputSchema: schemaWithCwd(readSymbolTool.parameters)
|
|
25650
26604
|
},
|
|
25651
26605
|
{
|
|
25652
26606
|
name: "pilens_read_enclosing",
|
|
25653
|
-
description: translateGuidanceToolNames(
|
|
25654
|
-
inputSchema:
|
|
25655
|
-
type: "object",
|
|
25656
|
-
properties: {
|
|
25657
|
-
file: {
|
|
25658
|
-
type: "string",
|
|
25659
|
-
description: "Absolute or workspace-relative path to the source file."
|
|
25660
|
-
},
|
|
25661
|
-
path: {
|
|
25662
|
-
type: "string",
|
|
25663
|
-
description: "Absolute or workspace-relative path to the source file (the canonical spelling of `file`)."
|
|
25664
|
-
},
|
|
25665
|
-
filePath: { type: "string", description: "Alias for `path`." },
|
|
25666
|
-
line: {
|
|
25667
|
-
type: "number",
|
|
25668
|
-
description: "1-based line number inside the desired symbol/callback."
|
|
25669
|
-
},
|
|
25670
|
-
cwd: { type: "string" },
|
|
25671
|
-
kinds: {
|
|
25672
|
-
type: "array",
|
|
25673
|
-
items: { type: "string" },
|
|
25674
|
-
description: "Optional kind filter, e.g. function, method, callback, class."
|
|
25675
|
-
},
|
|
25676
|
-
maxLines: {
|
|
25677
|
-
type: "number",
|
|
25678
|
-
description: "Optional maximum body size to return. Oversized matches obey onOversize."
|
|
25679
|
-
},
|
|
25680
|
-
onOversize: {
|
|
25681
|
-
type: "string",
|
|
25682
|
-
enum: ["error", "slice", "outline"],
|
|
25683
|
-
description: "Behavior when the enclosing body exceeds maxLines. error (default) returns metadata only; slice returns a bounded partial read around line; outline returns nested symbols/callbacks with read handles."
|
|
25684
|
-
},
|
|
25685
|
-
aroundLine: {
|
|
25686
|
-
type: "number",
|
|
25687
|
-
description: "Maximum lines for onOversize=slice; defaults to maxLines, then 80."
|
|
25688
|
-
}
|
|
25689
|
-
},
|
|
25690
|
-
required: ["line"]
|
|
25691
|
-
}
|
|
26607
|
+
description: translateGuidanceToolNames(readEnclosingTool.description, "mcp"),
|
|
26608
|
+
inputSchema: schemaWithCwd(readEnclosingTool.parameters)
|
|
25692
26609
|
},
|
|
25693
26610
|
{
|
|
25694
26611
|
name: "pilens_health",
|
|
@@ -25697,22 +26614,8 @@ var ALL_TOOLS = [
|
|
|
25697
26614
|
},
|
|
25698
26615
|
{
|
|
25699
26616
|
name: "pilens_effective_config",
|
|
25700
|
-
description:
|
|
25701
|
-
inputSchema:
|
|
25702
|
-
type: "object",
|
|
25703
|
-
properties: {
|
|
25704
|
-
cwd: { type: "string" },
|
|
25705
|
-
file: {
|
|
25706
|
-
type: "string",
|
|
25707
|
-
description: "Path to explain: adds the resolved language plus the per-server and per-runner selection decisions for it. Must resolve inside `cwd` (a sibling package in the same monorepo does not count) \u2014 a file outside it is rejected with the `cwd` it was measured against; re-query with `cwd` set to that file's own workspace instead."
|
|
25708
|
-
},
|
|
25709
|
-
path: {
|
|
25710
|
-
type: "string",
|
|
25711
|
-
description: "Path to explain (the canonical spelling of `file`)."
|
|
25712
|
-
},
|
|
25713
|
-
filePath: { type: "string", description: "Alias for `path`." }
|
|
25714
|
-
}
|
|
25715
|
-
}
|
|
26617
|
+
description: translateGuidanceToolNames(effectiveConfigTool.description, "mcp"),
|
|
26618
|
+
inputSchema: schemaWithCwd(effectiveConfigTool.parameters)
|
|
25716
26619
|
},
|
|
25717
26620
|
{
|
|
25718
26621
|
name: "pilens_session_start",
|
|
@@ -25772,7 +26675,12 @@ function enabledToolsForCwd(cwd) {
|
|
|
25772
26675
|
}
|
|
25773
26676
|
function formatAnalyze(result, cwd, mode, servedBy) {
|
|
25774
26677
|
const lspNote = result.lsp ? ` \xB7 lsp ${result.lsp.diagnosticCount} (${result.lsp.status}${result.lsp.failureKind ? `: ${result.lsp.failureKind}` : ""}, ${result.lsp.durationMs}ms)` : "";
|
|
25775
|
-
const
|
|
26678
|
+
const notChecked = verdictUncheckedReason(result.verdict);
|
|
26679
|
+
const summary = `${path43.relative(cwd, result.filePath) || result.filePath} [${mode}] \u2014 ${result.counts.blockers} blocking, ${result.counts.warnings} warning(s), ${result.counts.advisories} advisory(ies), ${result.counts.diagnostics} total` + // #5287: zero counts beside a check that never completed are not a clean
|
|
26680
|
+
// file, so the summary says so beside them.
|
|
26681
|
+
// A worker reply from an older build carries no verdict (the facade casts
|
|
26682
|
+
// it unvalidated), which the shared reader also treats as unchecked.
|
|
26683
|
+
(notChecked === void 0 ? "" : ` \xB7 not checked: ${notChecked}`) + (result.latency ? ` \xB7 ${result.latency.totalDurationMs}ms` : "") + lspNote + (result.counts.fixed > 0 ? ` \xB7 ${result.counts.fixed} auto-fixed` : "") + (servedBy ? `
|
|
25776
26684
|
|
|
25777
26685
|
servedBy: ${servedBy}` : "");
|
|
25778
26686
|
return renderToolText(summary, servedBy ? { ...result, servedBy } : result);
|
|
@@ -25909,7 +26817,7 @@ ${outcome.output}`, {
|
|
|
25909
26817
|
}
|
|
25910
26818
|
const { deduped, byRule, byFile } = summarizeScan(snapshot.diagnostics);
|
|
25911
26819
|
const topRules = Object.entries(byRule).sort((a, b) => b[1] - a[1]);
|
|
25912
|
-
const topFiles = Object.entries(byFile).sort((a, b) => b[1] - a[1]).slice(0, 15).map(([file, count]) => ({ file:
|
|
26820
|
+
const topFiles = Object.entries(byFile).sort((a, b) => b[1] - a[1]).slice(0, 15).map(([file, count]) => ({ file: path43.relative(cwd, file), count }));
|
|
25913
26821
|
const summaryLines = [
|
|
25914
26822
|
`Scanned ${snapshot.filesScanned} file(s) [${snapshot.runners.join(", ")}] \u2192 ${deduped.length} unique diagnostic(s)` + (snapshot.diagnostics.length !== deduped.length ? ` (${snapshot.diagnostics.length} raw, ${snapshot.diagnostics.length - deduped.length} duplicate)` : ""),
|
|
25915
26823
|
...topRules.slice(0, 12).map(([rule, count]) => ` ${count}\xD7 ${rule}`)
|
|
@@ -25942,16 +26850,19 @@ ${outcome.output}`, {
|
|
|
25942
26850
|
}
|
|
25943
26851
|
if (name === "pilens_symbol_search") {
|
|
25944
26852
|
const query = typeof args.query === "string" ? args.query : "";
|
|
25945
|
-
if (!query.trim())
|
|
25946
|
-
return renderToolText("Provide a non-empty `query`.");
|
|
25947
26853
|
const cwd = typeof args.cwd === "string" ? args.cwd : DEFAULT_CWD;
|
|
25948
|
-
const pathsRead = readPathsArgument(args.paths, {
|
|
26854
|
+
const pathsRead = await readPathsArgument(args.paths, {
|
|
26855
|
+
cwd,
|
|
26856
|
+
filterOnly: true
|
|
26857
|
+
});
|
|
25949
26858
|
if (pathsRead.refusal)
|
|
25950
26859
|
return { ...renderToolText(pathsRead.refusal), isError: true };
|
|
25951
26860
|
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : void 0;
|
|
25952
26861
|
const paths = pathsRead.entries.length > 0 ? pathsRead.entries : void 0;
|
|
25953
26862
|
const lang = typeof args.lang === "string" ? args.lang : void 0;
|
|
25954
26863
|
const result = await symbolSearch(query, cwd, limit, { paths, lang });
|
|
26864
|
+
if (result.refusal)
|
|
26865
|
+
return { ...renderToolText(result.refusal), isError: true };
|
|
25955
26866
|
if (!result.available) {
|
|
25956
26867
|
return renderToolText(result.hint ?? "No word index for this workspace yet \u2014 run pilens_session_start first.");
|
|
25957
26868
|
}
|
|
@@ -26016,7 +26927,7 @@ ${graphStaleness}` : rendered;
|
|
|
26016
26927
|
isError: true
|
|
26017
26928
|
};
|
|
26018
26929
|
}
|
|
26019
|
-
if (args.view
|
|
26930
|
+
if (projectReportViewIsJson(args.view)) {
|
|
26020
26931
|
return {
|
|
26021
26932
|
content: [{ type: "text", text: JSON.stringify(report) }],
|
|
26022
26933
|
details: { [JSON_CELL_DETAILS_KEY]: true }
|
|
@@ -26042,7 +26953,7 @@ ${graphStaleness}` : rendered;
|
|
|
26042
26953
|
const result = await readSymbol(file, symbol, cwd, { kind });
|
|
26043
26954
|
if (!result.found && result.error) {
|
|
26044
26955
|
return {
|
|
26045
|
-
...renderToolText(`Could not inspect ${
|
|
26956
|
+
...renderToolText(`Could not inspect ${path43.basename(file)}: ${result.error}`, {
|
|
26046
26957
|
found: false,
|
|
26047
26958
|
error: result.error,
|
|
26048
26959
|
...result.warnings ? { warnings: result.warnings } : {}
|
|
@@ -26053,7 +26964,7 @@ ${graphStaleness}` : rendered;
|
|
|
26053
26964
|
if (!result.found) {
|
|
26054
26965
|
const suggestionSuffix = result.suggestions?.length ? ` Did you mean: ${result.suggestions.join(", ")}?` : " Use pilens_module_report to list symbols.";
|
|
26055
26966
|
return {
|
|
26056
|
-
...renderToolText(`Symbol "${symbol}" not found in ${
|
|
26967
|
+
...renderToolText(`Symbol "${symbol}" not found in ${path43.basename(file)}.${suggestionSuffix}`, {
|
|
26057
26968
|
found: false,
|
|
26058
26969
|
...result.suggestions ? { suggestions: result.suggestions } : {},
|
|
26059
26970
|
...result.warnings ? { warnings: result.warnings } : {}
|
|
@@ -26063,7 +26974,7 @@ ${graphStaleness}` : rendered;
|
|
|
26063
26974
|
}
|
|
26064
26975
|
const sigSuffix = result.signature ? ` ${result.signature}` : "";
|
|
26065
26976
|
const ambiguityNote = result.ambiguous ? ` (${result.ambiguous.count} matches \u2014 returned the ${result.kind}; pass \`kind\` to disambiguate: ${result.ambiguous.kinds.join(", ")})` : "";
|
|
26066
|
-
const header = `${result.kind} ${result.name}${ambiguityNote}${sigSuffix} ${
|
|
26977
|
+
const header = `${result.kind} ${result.name}${ambiguityNote}${sigSuffix} ${path43.relative(cwd, result.path)}:${result.startLine}-${result.endLine}`;
|
|
26067
26978
|
return {
|
|
26068
26979
|
content: [
|
|
26069
26980
|
{
|
|
@@ -26089,9 +27000,9 @@ ${result.source ?? ""}`
|
|
|
26089
27000
|
}
|
|
26090
27001
|
const cwd = typeof args.cwd === "string" ? args.cwd : DEFAULT_CWD;
|
|
26091
27002
|
const kinds = Array.isArray(args.kinds) ? args.kinds.filter((k) => typeof k === "string") : void 0;
|
|
26092
|
-
const maxLines = typeof args.maxLines === "number"
|
|
27003
|
+
const maxLines = typeof args.maxLines === "number" ? args.maxLines : void 0;
|
|
26093
27004
|
const onOversize = args.onOversize === "error" || args.onOversize === "slice" || args.onOversize === "outline" ? args.onOversize : void 0;
|
|
26094
|
-
const aroundLine = typeof args.aroundLine === "number"
|
|
27005
|
+
const aroundLine = typeof args.aroundLine === "number" ? args.aroundLine : void 0;
|
|
26095
27006
|
const result = await readEnclosing(file, line, cwd, {
|
|
26096
27007
|
kinds,
|
|
26097
27008
|
maxLines,
|
|
@@ -26104,14 +27015,14 @@ ${result.source ?? ""}`
|
|
|
26104
27015
|
|
|
26105
27016
|
Nested outline:
|
|
26106
27017
|
${JSON.stringify(result.outline)}` : "";
|
|
26107
|
-
const text = result.error ? `Could not read enclosing range in ${
|
|
27018
|
+
const text = result.error ? `Could not read enclosing range in ${path43.basename(file)}:${result.line}: ${result.error}${warningSuffix}${outlineSuffix}` : `No enclosing symbol/callback found in ${path43.basename(file)}:${result.line}.${warningSuffix}`;
|
|
26108
27019
|
return {
|
|
26109
27020
|
...renderToolText(text, { found: false, line: result.line }),
|
|
26110
27021
|
isError: true
|
|
26111
27022
|
};
|
|
26112
27023
|
}
|
|
26113
27024
|
const range = result.partial ? `${result.startLine}-${result.endLine} (partial of ${result.enclosingStartLine}-${result.enclosingEndLine})` : `${result.startLine}-${result.endLine}`;
|
|
26114
|
-
const header = `${result.kind} ${result.name} ${
|
|
27025
|
+
const header = `${result.kind} ${result.name} ${path43.relative(cwd, result.path)}:${range}`;
|
|
26115
27026
|
return {
|
|
26116
27027
|
content: [
|
|
26117
27028
|
{
|
|
@@ -26146,7 +27057,7 @@ ${result.source ?? ""}`
|
|
|
26146
27057
|
]),
|
|
26147
27058
|
...renderLspBrokenStatusLines(brokenServers),
|
|
26148
27059
|
...renderDegradationLines(degradations),
|
|
26149
|
-
last ? `Last dispatch: ${
|
|
27060
|
+
last ? `Last dispatch: ${path43.basename(last.filePath)} \u2014 ${last.totalDurationMs}ms, ${last.totalDiagnostics} diagnostic(s)` : "Last dispatch: none yet",
|
|
26150
27061
|
`Diagnostics this session: ${stats.totalShown} shown \xB7 ${stats.totalAutoFixed} auto-fixed \xB7 ${stats.totalUnresolved} unresolved`,
|
|
26151
27062
|
autoSession ? `Auto session_start: ${autoSession.succeeded ? "succeeded" : autoSession.error ? "FAILED" : autoSession.attempted ? "in progress" : "not yet attempted"}${autoSession.firedAt ? ` (fired ${autoSession.firedAt})` : ""}${autoSession.error ? ` \u2014 ${autoSession.error}` : ""}` : "Auto session_start: disabled (PI_LENS_MCP_AUTO_SESSION not set)",
|
|
26152
27063
|
turnEnd ? `Stop-hook turn-end: ${turnEnd.ran} ran \xB7 ${turnEnd.skipped} skipped${turnEnd.lastRunAt ? ` (last ran ${turnEnd.lastRunAt})` : ""}${turnEnd.lastSkipReason ? ` \u2014 last skip: ${turnEnd.lastSkipReason}${turnEnd.lastSkipAt ? ` at ${turnEnd.lastSkipAt}` : ""}` : ""}` : "Stop-hook turn-end: no activity recorded (hook not installed, or no Stop yet)",
|
|
@@ -26215,7 +27126,7 @@ ${result.source ?? ""}`
|
|
|
26215
27126
|
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? Math.max(1, Math.floor(args.limit)) : 5;
|
|
26216
27127
|
const fileFilter = typeof args.file === "string" ? args.file : void 0;
|
|
26217
27128
|
const recent = recentLatency(limit, fileFilter);
|
|
26218
|
-
const summary = recent.length === 0 ? "No dispatch latency reports yet." : recent.map((report) => `${
|
|
27129
|
+
const summary = recent.length === 0 ? "No dispatch latency reports yet." : recent.map((report) => `${path43.basename(report.filePath)}: ${report.totalDurationMs}ms (${report.totalDiagnostics} diag${report.stoppedEarly ? ", stopped early" : ""})`).join("\n");
|
|
26219
27130
|
return renderToolText(summary, recent);
|
|
26220
27131
|
}
|
|
26221
27132
|
if (name === "pilens_session_start") {
|