@herbertgao/pi-extensions 2026.11.11 → 2026.11.12
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 +20 -0
- package/README.md +10 -10
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -4
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +22 -15
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +22 -8
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +0 -29
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +5 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +60 -39
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +0 -40
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +21 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +15 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- 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 +2 -2
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/animate.md +17 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique-rubric.md +496 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +12 -504
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +3 -3
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-comp.md +24 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-world.md +20 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +5 -34
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/typeset.md +6 -0
- 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 +17 -18
- package/node_modules/pi-antigravity/README.md +58 -9
- package/node_modules/pi-antigravity/docs/reader-guarantees.md +35 -0
- package/node_modules/pi-antigravity/package.json +15 -6
- package/node_modules/pi-antigravity/src/client/client.ts +63 -14
- package/node_modules/pi-antigravity/src/client/enterprise.ts +150 -0
- package/node_modules/pi-antigravity/src/client/index.ts +1 -0
- package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +7 -0
- package/node_modules/pi-antigravity/src/features/generate-image.ts +56 -2
- package/node_modules/pi-antigravity/src/features/read-url-content.ts +124 -0
- package/node_modules/pi-antigravity/src/image/image.ts +16 -2
- package/node_modules/pi-antigravity/src/index.ts +145 -2
- package/node_modules/pi-antigravity/src/models/discovery.ts +3 -4
- package/node_modules/pi-antigravity/src/models/grouping.ts +39 -15
- package/node_modules/pi-antigravity/src/models/models.ts +126 -14
- package/node_modules/pi-antigravity/src/stream/stream.ts +189 -30
- package/node_modules/pi-antigravity/src/types/types.ts +30 -1
- package/node_modules/pi-antigravity/src/usage/usage.ts +58 -0
- package/node_modules/pi-antigravity/src/utils/address.ts +180 -0
- package/node_modules/pi-antigravity/src/utils/credits.ts +149 -0
- package/node_modules/pi-antigravity/src/utils/html.ts +31 -0
- package/node_modules/pi-antigravity/src/utils/index.ts +2 -0
- package/node_modules/pi-antigravity/src/utils/security.ts +172 -13
- package/node_modules/pi-antigravity/src/utils/text.ts +66 -0
- package/node_modules/pi-antigravity/src/utils/util.ts +5 -4
- package/node_modules/pi-antigravity/src/web-fetch/document.ts +83 -0
- package/node_modules/pi-antigravity/src/web-fetch/fences.ts +24 -0
- package/node_modules/pi-antigravity/src/web-fetch/header.ts +97 -0
- package/node_modules/pi-antigravity/src/web-fetch/index.ts +3 -0
- package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +328 -0
- package/node_modules/pi-antigravity/src/web-fetch/limits.ts +4 -0
- package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +744 -0
- package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +164 -0
- package/node_modules/pi-antigravity/src/web-fetch/media.ts +11 -0
- package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +9 -0
- package/node_modules/pi-antigravity/src/web-fetch/representation.ts +93 -0
- package/node_modules/pi-antigravity/src/web-fetch/save.ts +71 -0
- package/node_modules/pi-antigravity/src/web-fetch/sites.ts +138 -0
- package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +9 -0
- package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +957 -0
- package/node_modules/pi-antigravity/tsconfig.json +2 -2
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
- package/node_modules/pi-commandcode-provider/README.md +2 -2
- package/node_modules/pi-commandcode-provider/package.json +1 -1
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +15 -9
- package/node_modules/pi-commandcode-provider/src/oauth.ts +69 -12
- package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
- package/node_modules/pi-lens/CHANGELOG.md +172 -0
- package/node_modules/pi-lens/README.md +103 -217
- package/node_modules/pi-lens/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
- package/node_modules/pi-lens/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
- package/node_modules/pi-lens/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
- package/node_modules/pi-lens/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
- package/node_modules/pi-lens/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
- package/node_modules/pi-lens/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
- package/node_modules/pi-lens/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +56 -0
- package/node_modules/pi-lens/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
- package/node_modules/pi-lens/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
- package/node_modules/pi-lens/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
- package/node_modules/pi-lens/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
- package/node_modules/pi-lens/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
- package/node_modules/pi-lens/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
- package/node_modules/pi-lens/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
- package/node_modules/pi-lens/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
- package/node_modules/pi-lens/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
- package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
- package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
- package/node_modules/pi-lens/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
- package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
- package/node_modules/pi-lens/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
- package/node_modules/pi-lens/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
- package/node_modules/pi-lens/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-LVLPA32Q.js +810 -0
- package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +73 -0
- package/node_modules/pi-lens/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
- package/node_modules/pi-lens/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
- package/node_modules/pi-lens/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
- package/node_modules/pi-lens/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
- package/node_modules/pi-lens/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
- package/node_modules/pi-lens/dist/chunk-PKWEBMCA.js +2957 -0
- package/node_modules/pi-lens/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
- package/node_modules/pi-lens/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
- package/node_modules/pi-lens/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
- package/node_modules/pi-lens/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
- package/node_modules/pi-lens/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
- package/node_modules/pi-lens/dist/chunk-TQWRH25U.js +35 -0
- package/node_modules/pi-lens/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
- package/node_modules/pi-lens/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
- package/node_modules/pi-lens/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
- package/node_modules/pi-lens/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
- package/node_modules/pi-lens/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
- package/node_modules/pi-lens/dist/index.js +6508 -5413
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +9 -9
- package/node_modules/pi-lens/dist/mcp/cli.js +39 -38
- package/node_modules/pi-lens/dist/mcp/server.js +602 -345
- package/node_modules/pi-lens/dist/mcp/worker.js +57 -58
- package/node_modules/pi-lens/dist/probes/installer.js +19 -17
- package/node_modules/pi-lens/docs/architecture.md +113 -0
- package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
- package/node_modules/pi-lens/docs/ci.md +18 -4
- package/node_modules/pi-lens/docs/defect-shapes.md +41 -3
- package/node_modules/pi-lens/docs/dependencies.md +10 -10
- package/node_modules/pi-lens/docs/features.md +3 -3
- package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -1
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +19 -0
- package/node_modules/pi-lens/docs/language-coverage.md +39 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +10 -4
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -5
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +5 -2
- package/node_modules/pi-lens/docs/prose-standard.md +112 -0
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/docs/usage.md +50 -0
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
- package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
- package/node_modules/pi-web-access/CHANGELOG.md +29 -0
- package/node_modules/pi-web-access/README.md +35 -15
- package/node_modules/pi-web-access/anysearch.ts +7 -3
- package/node_modules/pi-web-access/autom.ts +196 -0
- package/node_modules/pi-web-access/cloro.ts +254 -0
- package/node_modules/pi-web-access/curator-page.ts +7 -1
- package/node_modules/pi-web-access/curator-server.ts +3 -0
- package/node_modules/pi-web-access/dist/index.js +12931 -12111
- package/node_modules/pi-web-access/dist/mcp-cli.js +1188 -416
- package/node_modules/pi-web-access/domain-filter-normalization.ts +30 -0
- package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +144 -34
- package/node_modules/pi-web-access/duckduckgo.ts +11 -3
- package/node_modules/pi-web-access/extract.ts +60 -4
- package/node_modules/pi-web-access/gemini-search.ts +25 -5
- package/node_modules/pi-web-access/index.ts +9 -1
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/pi-web-access/page-query.ts +12 -3
- package/node_modules/pi-web-access/specstream.ts +276 -0
- package/node_modules/pi-web-access/tool-activation.ts +21 -6
- package/node_modules/pi-web-access/utils.ts +4 -0
- package/node_modules/pi-web-access/video-extract.ts +2 -2
- package/node_modules/pi-web-access/web-tool-core.ts +24 -5
- package/node_modules/pi-web-access/youtube-extract.ts +2 -2
- package/package.json +10 -7
- package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +0 -72
- package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +0 -28
- package/node_modules/pi-lens/dist/chunk-7M64NTAK.js +0 -38
- package/node_modules/pi-lens/dist/chunk-BEIPWPVR.js +0 -1037
- package/node_modules/pi-lens/dist/chunk-D7OEGXDX.js +0 -2417
- package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +0 -89
- package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +0 -28
- package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +0 -56
- package/node_modules/pi-lens/dist/chunk-YLHJWAQS.js +0 -256
- package/node_modules/pi-lens/dist/chunk-YULIERZW.js +0 -27
|
@@ -1,2417 +0,0 @@
|
|
|
1
|
-
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
loadProjectSnapshotWithoutWordIndex
|
|
4
|
-
} from "./chunk-YLW26OHX.js";
|
|
5
|
-
import {
|
|
6
|
-
hasTomlTable,
|
|
7
|
-
normalizeToml
|
|
8
|
-
} from "./chunk-SUIZOCSY.js";
|
|
9
|
-
import {
|
|
10
|
-
resolvePackagePath
|
|
11
|
-
} from "./chunk-E3PNZDPH.js";
|
|
12
|
-
import {
|
|
13
|
-
TERRAGRUNT_FILENAMES,
|
|
14
|
-
isJstsFactFile
|
|
15
|
-
} from "./chunk-SRXYSLMW.js";
|
|
16
|
-
import {
|
|
17
|
-
recordDegradationOnce
|
|
18
|
-
} from "./chunk-AGEQRJ5A.js";
|
|
19
|
-
import {
|
|
20
|
-
logLatency
|
|
21
|
-
} from "./chunk-K2GV34T2.js";
|
|
22
|
-
import {
|
|
23
|
-
findNearestContaining,
|
|
24
|
-
normalizeMapKey,
|
|
25
|
-
pathsEqual,
|
|
26
|
-
realpathOrResolve,
|
|
27
|
-
walkUpDirs
|
|
28
|
-
} from "./chunk-WLD6BGON.js";
|
|
29
|
-
|
|
30
|
-
// dist/clients/tool-config-presence.js
|
|
31
|
-
import * as fs2 from "node:fs";
|
|
32
|
-
import * as os from "node:os";
|
|
33
|
-
import * as path from "node:path";
|
|
34
|
-
|
|
35
|
-
// dist/clients/dispatch/runners/utils.js
|
|
36
|
-
import * as fs from "node:fs";
|
|
37
|
-
function readFileContent(filePath) {
|
|
38
|
-
try {
|
|
39
|
-
return fs.readFileSync(filePath, "utf-8");
|
|
40
|
-
} catch {
|
|
41
|
-
return void 0;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// dist/clients/tool-config-presence.js
|
|
46
|
-
var TOOL_CONFIG_SPECS = {
|
|
47
|
-
detekt: {
|
|
48
|
-
files: [
|
|
49
|
-
"detekt.yml",
|
|
50
|
-
".detekt.yml",
|
|
51
|
-
path.join("config", "detekt", "detekt.yml"),
|
|
52
|
-
path.join("detekt", "detekt.yml")
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
// tflint ships built-in rules and runs without config, so `.tflint.hcl` is
|
|
56
|
-
// the project electing it, not a prerequisite. It resolves config from its
|
|
57
|
-
// own working directory and never walks parents, so the runner hands the
|
|
58
|
-
// found file over with `--config`.
|
|
59
|
-
tflint: { files: [".tflint.hcl"] },
|
|
60
|
-
black: {
|
|
61
|
-
tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.black` }],
|
|
62
|
-
dependency: { name: "black", files: ["requirements.txt", "Pipfile"] }
|
|
63
|
-
},
|
|
64
|
-
// Ruff ignores a `pyproject.toml` without `[tool.ruff]` (measured, see
|
|
65
|
-
// `python-environment.ts`), so the table is the evidence.
|
|
66
|
-
ruff: {
|
|
67
|
-
files: ["ruff.toml", ".ruff.toml"],
|
|
68
|
-
tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.ruff` }]
|
|
69
|
-
},
|
|
70
|
-
sqlfluff: {
|
|
71
|
-
files: [".sqlfluff"],
|
|
72
|
-
tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.sqlfluff` }],
|
|
73
|
-
iniSections: [
|
|
74
|
-
{ file: "setup.cfg", section: "sqlfluff" },
|
|
75
|
-
{ file: "tox.ini", section: "sqlfluff" }
|
|
76
|
-
],
|
|
77
|
-
dependency: {
|
|
78
|
-
name: "sqlfluff",
|
|
79
|
-
files: ["requirements.txt", "Pipfile", "pyproject.toml"]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
yamllint: {
|
|
83
|
-
files: [".yamllint", ".yamllint.yml", ".yamllint.yaml"],
|
|
84
|
-
tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.yamllint` }],
|
|
85
|
-
iniSections: [
|
|
86
|
-
{ file: "setup.cfg", section: "yamllint" },
|
|
87
|
-
{ file: "tox.ini", section: "yamllint" }
|
|
88
|
-
],
|
|
89
|
-
dependency: {
|
|
90
|
-
name: "yamllint",
|
|
91
|
-
files: ["requirements.txt", "Pipfile", "pyproject.toml"]
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
mypy: {
|
|
95
|
-
files: ["mypy.ini", ".mypy.ini"],
|
|
96
|
-
tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.mypy` }],
|
|
97
|
-
iniSections: [{ file: "setup.cfg", section: "mypy" }]
|
|
98
|
-
},
|
|
99
|
-
// The Mix project descriptor, the evidence credo and `mix compile` need.
|
|
100
|
-
mix: { files: ["mix.exs"], exactDir: true },
|
|
101
|
-
// shfmt's only config source, and the formatters' indentation opt-out.
|
|
102
|
-
editorconfig: { files: [".editorconfig"] }
|
|
103
|
-
};
|
|
104
|
-
function normalizeDistributionName(name) {
|
|
105
|
-
return name.toLowerCase().replace(/[-_.]+/g, "-");
|
|
106
|
-
}
|
|
107
|
-
var REQUIREMENT_NAME = /^\s*([A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)\s*(?:\[[^\]]*\])?\s*(?:$|[<>=!~;@(,\s])/;
|
|
108
|
-
function requirementName(requirement) {
|
|
109
|
-
const match = REQUIREMENT_NAME.exec(requirement);
|
|
110
|
-
return match ? normalizeDistributionName(match[1] ?? "") : void 0;
|
|
111
|
-
}
|
|
112
|
-
function requirementsNames(content) {
|
|
113
|
-
const names = [];
|
|
114
|
-
for (const raw of content.replace(/^/, "").split(/\r?\n/)) {
|
|
115
|
-
const line = raw.replace(/(^|\s)#.*$/, "").trim();
|
|
116
|
-
if (line === "" || line.startsWith("-"))
|
|
117
|
-
continue;
|
|
118
|
-
const name = requirementName(line);
|
|
119
|
-
if (name)
|
|
120
|
-
names.push(name);
|
|
121
|
-
}
|
|
122
|
-
return names;
|
|
123
|
-
}
|
|
124
|
-
var TOML_TABLE_HEADING = /^[ \t]*\[([^[\]]+)\][ \t]*$/;
|
|
125
|
-
var TOML_KEY_LINE = /^[ \t]*("[^"]+"|'[^']+'|[A-Za-z0-9_.-]+)[ \t]*=[ \t]*(.*)$/;
|
|
126
|
-
function bracketDelta(text) {
|
|
127
|
-
let depth = 0;
|
|
128
|
-
let quote;
|
|
129
|
-
for (const ch of text) {
|
|
130
|
-
if (quote) {
|
|
131
|
-
if (ch === quote)
|
|
132
|
-
quote = void 0;
|
|
133
|
-
} else if (ch === '"' || ch === "'")
|
|
134
|
-
quote = ch;
|
|
135
|
-
else if (ch === "[")
|
|
136
|
-
depth += 1;
|
|
137
|
-
else if (ch === "]")
|
|
138
|
-
depth -= 1;
|
|
139
|
-
}
|
|
140
|
-
return depth;
|
|
141
|
-
}
|
|
142
|
-
function tomlEntries(content) {
|
|
143
|
-
const entries = [];
|
|
144
|
-
const lines = normalizeToml(content).split("\n");
|
|
145
|
-
let table = "";
|
|
146
|
-
for (let i = 0; i < lines.length; i++) {
|
|
147
|
-
const line = lines[i] ?? "";
|
|
148
|
-
if (/^[ \t]*\[\[/.test(line)) {
|
|
149
|
-
table = "";
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
const heading = TOML_TABLE_HEADING.exec(line);
|
|
153
|
-
if (heading) {
|
|
154
|
-
table = (heading[1] ?? "").replace(/["'\s]/g, "");
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
const keyLine = TOML_KEY_LINE.exec(line);
|
|
158
|
-
if (!keyLine)
|
|
159
|
-
continue;
|
|
160
|
-
let value = keyLine[2] ?? "";
|
|
161
|
-
let depth = bracketDelta(value);
|
|
162
|
-
while (depth > 0 && i + 1 < lines.length) {
|
|
163
|
-
i += 1;
|
|
164
|
-
value += `
|
|
165
|
-
${lines[i] ?? ""}`;
|
|
166
|
-
depth += bracketDelta(lines[i] ?? "");
|
|
167
|
-
}
|
|
168
|
-
entries.push({
|
|
169
|
-
table,
|
|
170
|
-
key: (keyLine[1] ?? "").replace(/^["']|["']$/g, ""),
|
|
171
|
-
value
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
return entries;
|
|
175
|
-
}
|
|
176
|
-
function quotedStrings(value) {
|
|
177
|
-
return [...value.matchAll(/"((?:[^"\\]|\\.)*)"|'([^']*)'/g)].map((m) => m[1] ?? m[2] ?? "");
|
|
178
|
-
}
|
|
179
|
-
var POETRY_DEPENDENCY_TABLE = /^tool\.poetry(?:\.group\.[^.]+)?\.(?:dev-)?dependencies$/;
|
|
180
|
-
function pyprojectDependencyNames(content) {
|
|
181
|
-
const names = [];
|
|
182
|
-
for (const { table, key, value } of tomlEntries(content)) {
|
|
183
|
-
if (POETRY_DEPENDENCY_TABLE.test(table)) {
|
|
184
|
-
names.push(normalizeDistributionName(key));
|
|
185
|
-
} else if (table === "project" && key === "dependencies" || table === "tool.uv" && key === "dev-dependencies" || table === "project.optional-dependencies" || table === "dependency-groups") {
|
|
186
|
-
for (const text of quotedStrings(value)) {
|
|
187
|
-
const name = requirementName(text);
|
|
188
|
-
if (name)
|
|
189
|
-
names.push(name);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return names;
|
|
194
|
-
}
|
|
195
|
-
function pipfileNames(content) {
|
|
196
|
-
return tomlEntries(content).flatMap(({ table, key }) => table === "packages" || table === "dev-packages" ? [normalizeDistributionName(key)] : []);
|
|
197
|
-
}
|
|
198
|
-
function dependencyNames(file, content) {
|
|
199
|
-
switch (file) {
|
|
200
|
-
case "requirements.txt":
|
|
201
|
-
return requirementsNames(content);
|
|
202
|
-
case "Pipfile":
|
|
203
|
-
return pipfileNames(content);
|
|
204
|
-
case "pyproject.toml":
|
|
205
|
-
return pyprojectDependencyNames(content);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function hasIniSection(content, section) {
|
|
209
|
-
return new RegExp(`^[ \\t]*\\[${section}\\][ \\t]*(?:[#;].*)?$`, "m").test(content);
|
|
210
|
-
}
|
|
211
|
-
function findInDir(spec, dir) {
|
|
212
|
-
for (const name of spec.files ?? []) {
|
|
213
|
-
const candidate = path.join(dir, name);
|
|
214
|
-
if (fs2.existsSync(candidate)) {
|
|
215
|
-
return { file: candidate, dir, source: "file" };
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
for (const { file, table } of spec.tomlTables ?? []) {
|
|
219
|
-
const candidate = path.join(dir, file);
|
|
220
|
-
const content = readFileContent(candidate);
|
|
221
|
-
if (content !== void 0 && hasTomlTable(content, table)) {
|
|
222
|
-
return { file: candidate, dir, source: "toml-table" };
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
for (const { file, section } of spec.iniSections ?? []) {
|
|
226
|
-
const candidate = path.join(dir, file);
|
|
227
|
-
const content = readFileContent(candidate);
|
|
228
|
-
if (content !== void 0 && hasIniSection(content, section)) {
|
|
229
|
-
return { file: candidate, dir, source: "ini-section" };
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
if (spec.dependency) {
|
|
233
|
-
const wanted = normalizeDistributionName(spec.dependency.name);
|
|
234
|
-
for (const file of spec.dependency.files) {
|
|
235
|
-
const candidate = path.join(dir, file);
|
|
236
|
-
const content = readFileContent(candidate);
|
|
237
|
-
if (content !== void 0 && dependencyNames(file, content).includes(wanted)) {
|
|
238
|
-
return { file: candidate, dir, source: "dependency" };
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return void 0;
|
|
243
|
-
}
|
|
244
|
-
function findToolConfig(tool, startDir, options = {}) {
|
|
245
|
-
const spec = TOOL_CONFIG_SPECS[tool];
|
|
246
|
-
if (spec.exactDir)
|
|
247
|
-
return findInDir(spec, realpathOrResolve(startDir));
|
|
248
|
-
const home = realpathOrResolve(options.homeDir ?? os.homedir());
|
|
249
|
-
for (const dir of walkUpDirs(startDir)) {
|
|
250
|
-
const hit = findInDir(spec, dir);
|
|
251
|
-
if (hit)
|
|
252
|
-
return hit;
|
|
253
|
-
if (pathsEqual(dir, home))
|
|
254
|
-
return void 0;
|
|
255
|
-
}
|
|
256
|
-
return void 0;
|
|
257
|
-
}
|
|
258
|
-
function hasToolConfig(tool, startDir, options = {}) {
|
|
259
|
-
return findToolConfig(tool, startDir, options) !== void 0;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// dist/clients/tool-policy.js
|
|
263
|
-
import * as fs3 from "node:fs";
|
|
264
|
-
import * as path2 from "node:path";
|
|
265
|
-
var FORMATTER_POLICY_BY_EXTENSION = /* @__PURE__ */ new Map([
|
|
266
|
-
[
|
|
267
|
-
".js",
|
|
268
|
-
{
|
|
269
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
270
|
-
defaultFormatter: "biome",
|
|
271
|
-
defaultWhenUnconfigured: true,
|
|
272
|
-
gate: "smart-default"
|
|
273
|
-
}
|
|
274
|
-
],
|
|
275
|
-
[
|
|
276
|
-
".jsx",
|
|
277
|
-
{
|
|
278
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
279
|
-
defaultFormatter: "biome",
|
|
280
|
-
defaultWhenUnconfigured: true,
|
|
281
|
-
gate: "smart-default"
|
|
282
|
-
}
|
|
283
|
-
],
|
|
284
|
-
[
|
|
285
|
-
".mjs",
|
|
286
|
-
{
|
|
287
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
288
|
-
defaultFormatter: "biome",
|
|
289
|
-
defaultWhenUnconfigured: true,
|
|
290
|
-
gate: "smart-default"
|
|
291
|
-
}
|
|
292
|
-
],
|
|
293
|
-
[
|
|
294
|
-
".cjs",
|
|
295
|
-
{
|
|
296
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
297
|
-
defaultFormatter: "biome",
|
|
298
|
-
defaultWhenUnconfigured: true,
|
|
299
|
-
gate: "smart-default"
|
|
300
|
-
}
|
|
301
|
-
],
|
|
302
|
-
[
|
|
303
|
-
".ts",
|
|
304
|
-
{
|
|
305
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
306
|
-
defaultFormatter: "biome",
|
|
307
|
-
defaultWhenUnconfigured: true,
|
|
308
|
-
gate: "smart-default"
|
|
309
|
-
}
|
|
310
|
-
],
|
|
311
|
-
[
|
|
312
|
-
".tsx",
|
|
313
|
-
{
|
|
314
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
315
|
-
defaultFormatter: "biome",
|
|
316
|
-
defaultWhenUnconfigured: true,
|
|
317
|
-
gate: "smart-default"
|
|
318
|
-
}
|
|
319
|
-
],
|
|
320
|
-
[
|
|
321
|
-
".mts",
|
|
322
|
-
{
|
|
323
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
324
|
-
defaultFormatter: "biome",
|
|
325
|
-
defaultWhenUnconfigured: true,
|
|
326
|
-
gate: "smart-default"
|
|
327
|
-
}
|
|
328
|
-
],
|
|
329
|
-
[
|
|
330
|
-
".cts",
|
|
331
|
-
{
|
|
332
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
333
|
-
defaultFormatter: "biome",
|
|
334
|
-
defaultWhenUnconfigured: true,
|
|
335
|
-
gate: "smart-default"
|
|
336
|
-
}
|
|
337
|
-
],
|
|
338
|
-
[
|
|
339
|
-
".py",
|
|
340
|
-
{
|
|
341
|
-
formatterNames: ["black", "ruff"],
|
|
342
|
-
defaultFormatter: "ruff",
|
|
343
|
-
defaultWhenUnconfigured: true,
|
|
344
|
-
gate: "smart-default"
|
|
345
|
-
}
|
|
346
|
-
],
|
|
347
|
-
[
|
|
348
|
-
".pyi",
|
|
349
|
-
{
|
|
350
|
-
formatterNames: ["black", "ruff"],
|
|
351
|
-
defaultFormatter: "ruff",
|
|
352
|
-
defaultWhenUnconfigured: true,
|
|
353
|
-
gate: "smart-default"
|
|
354
|
-
}
|
|
355
|
-
],
|
|
356
|
-
[
|
|
357
|
-
".json",
|
|
358
|
-
{
|
|
359
|
-
formatterNames: ["biome", "prettier"],
|
|
360
|
-
defaultFormatter: "biome",
|
|
361
|
-
defaultWhenUnconfigured: false,
|
|
362
|
-
gate: "mixed"
|
|
363
|
-
}
|
|
364
|
-
],
|
|
365
|
-
[
|
|
366
|
-
".jsonc",
|
|
367
|
-
{
|
|
368
|
-
formatterNames: ["biome", "prettier"],
|
|
369
|
-
defaultFormatter: "biome",
|
|
370
|
-
defaultWhenUnconfigured: false,
|
|
371
|
-
gate: "mixed"
|
|
372
|
-
}
|
|
373
|
-
],
|
|
374
|
-
[
|
|
375
|
-
".css",
|
|
376
|
-
{
|
|
377
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
378
|
-
defaultFormatter: "biome",
|
|
379
|
-
defaultWhenUnconfigured: true,
|
|
380
|
-
gate: "smart-default"
|
|
381
|
-
}
|
|
382
|
-
],
|
|
383
|
-
[
|
|
384
|
-
".scss",
|
|
385
|
-
{
|
|
386
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
387
|
-
defaultFormatter: "biome",
|
|
388
|
-
defaultWhenUnconfigured: true,
|
|
389
|
-
gate: "smart-default"
|
|
390
|
-
}
|
|
391
|
-
],
|
|
392
|
-
[
|
|
393
|
-
".sass",
|
|
394
|
-
{
|
|
395
|
-
// #1135: no oxfmt (see map header comment).
|
|
396
|
-
formatterNames: ["biome", "prettier"],
|
|
397
|
-
defaultFormatter: "biome",
|
|
398
|
-
defaultWhenUnconfigured: true,
|
|
399
|
-
gate: "smart-default"
|
|
400
|
-
}
|
|
401
|
-
],
|
|
402
|
-
[
|
|
403
|
-
".less",
|
|
404
|
-
{
|
|
405
|
-
formatterNames: ["prettier"],
|
|
406
|
-
defaultFormatter: "prettier",
|
|
407
|
-
defaultWhenUnconfigured: true,
|
|
408
|
-
gate: "smart-default"
|
|
409
|
-
}
|
|
410
|
-
],
|
|
411
|
-
[
|
|
412
|
-
".html",
|
|
413
|
-
{
|
|
414
|
-
formatterNames: ["prettier"],
|
|
415
|
-
defaultFormatter: "prettier",
|
|
416
|
-
// HTML commonly carries template markers ({{JS}} embeds, Handlebars,
|
|
417
|
-
// Helm-adjacent Go templates). Prettier reinterprets them as code and
|
|
418
|
-
// corrupts them. Opt in via project prettier config; do not run by default.
|
|
419
|
-
defaultWhenUnconfigured: false,
|
|
420
|
-
gate: "smart-default"
|
|
421
|
-
}
|
|
422
|
-
],
|
|
423
|
-
[
|
|
424
|
-
".htm",
|
|
425
|
-
{
|
|
426
|
-
formatterNames: ["prettier"],
|
|
427
|
-
defaultFormatter: "prettier",
|
|
428
|
-
defaultWhenUnconfigured: false,
|
|
429
|
-
gate: "smart-default"
|
|
430
|
-
}
|
|
431
|
-
],
|
|
432
|
-
[
|
|
433
|
-
".yaml",
|
|
434
|
-
{
|
|
435
|
-
formatterNames: ["prettier"],
|
|
436
|
-
defaultFormatter: "prettier",
|
|
437
|
-
// YAML commonly carries template markers (Helm `{{ .Values.x }}`,
|
|
438
|
-
// Ansible `{{ var }}`). Prettier splits `{{` into `{ {` and reindents
|
|
439
|
-
// embedded templates. Opt in via project prettier config.
|
|
440
|
-
defaultWhenUnconfigured: false,
|
|
441
|
-
gate: "smart-default"
|
|
442
|
-
}
|
|
443
|
-
],
|
|
444
|
-
[
|
|
445
|
-
".yml",
|
|
446
|
-
{
|
|
447
|
-
formatterNames: ["prettier"],
|
|
448
|
-
defaultFormatter: "prettier",
|
|
449
|
-
defaultWhenUnconfigured: false,
|
|
450
|
-
gate: "smart-default"
|
|
451
|
-
}
|
|
452
|
-
],
|
|
453
|
-
[
|
|
454
|
-
".md",
|
|
455
|
-
{
|
|
456
|
-
formatterNames: ["prettier"],
|
|
457
|
-
defaultFormatter: "prettier",
|
|
458
|
-
// Prettier's markdown defaults reflow lines, normalize emphasis (* -> _),
|
|
459
|
-
// and restyle lists. Opt-in via project prettier config; do not run by default.
|
|
460
|
-
defaultWhenUnconfigured: false,
|
|
461
|
-
gate: "smart-default"
|
|
462
|
-
}
|
|
463
|
-
],
|
|
464
|
-
[
|
|
465
|
-
".mdx",
|
|
466
|
-
{
|
|
467
|
-
formatterNames: ["prettier"],
|
|
468
|
-
defaultFormatter: "prettier",
|
|
469
|
-
defaultWhenUnconfigured: false,
|
|
470
|
-
gate: "smart-default"
|
|
471
|
-
}
|
|
472
|
-
],
|
|
473
|
-
[
|
|
474
|
-
".graphql",
|
|
475
|
-
{
|
|
476
|
-
formatterNames: ["prettier"],
|
|
477
|
-
defaultFormatter: "prettier",
|
|
478
|
-
defaultWhenUnconfigured: true,
|
|
479
|
-
gate: "smart-default"
|
|
480
|
-
}
|
|
481
|
-
],
|
|
482
|
-
[
|
|
483
|
-
".gql",
|
|
484
|
-
{
|
|
485
|
-
formatterNames: ["prettier"],
|
|
486
|
-
defaultFormatter: "prettier",
|
|
487
|
-
defaultWhenUnconfigured: true,
|
|
488
|
-
gate: "smart-default"
|
|
489
|
-
}
|
|
490
|
-
],
|
|
491
|
-
[
|
|
492
|
-
// ktfmt is offered alongside ktlint but only wins when the project opts in
|
|
493
|
-
// (hasExplicitFormatterConfig("ktfmt")); otherwise ktlint stays the
|
|
494
|
-
// smart-default. #129
|
|
495
|
-
".kt",
|
|
496
|
-
{
|
|
497
|
-
formatterNames: ["ktfmt", "ktlint"],
|
|
498
|
-
defaultFormatter: "ktlint",
|
|
499
|
-
defaultWhenUnconfigured: false,
|
|
500
|
-
gate: "smart-default"
|
|
501
|
-
}
|
|
502
|
-
],
|
|
503
|
-
[
|
|
504
|
-
".kts",
|
|
505
|
-
{
|
|
506
|
-
formatterNames: ["ktfmt", "ktlint"],
|
|
507
|
-
defaultFormatter: "ktlint",
|
|
508
|
-
defaultWhenUnconfigured: false,
|
|
509
|
-
gate: "smart-default"
|
|
510
|
-
}
|
|
511
|
-
],
|
|
512
|
-
[
|
|
513
|
-
".swift",
|
|
514
|
-
{
|
|
515
|
-
formatterNames: ["swiftformat"],
|
|
516
|
-
defaultFormatter: "swiftformat",
|
|
517
|
-
defaultWhenUnconfigured: false,
|
|
518
|
-
gate: "config-first"
|
|
519
|
-
}
|
|
520
|
-
],
|
|
521
|
-
[
|
|
522
|
-
".fs",
|
|
523
|
-
{
|
|
524
|
-
formatterNames: ["fantomas"],
|
|
525
|
-
defaultFormatter: "fantomas",
|
|
526
|
-
defaultWhenUnconfigured: false,
|
|
527
|
-
gate: "config-first"
|
|
528
|
-
}
|
|
529
|
-
],
|
|
530
|
-
[
|
|
531
|
-
".fsi",
|
|
532
|
-
{
|
|
533
|
-
formatterNames: ["fantomas"],
|
|
534
|
-
defaultFormatter: "fantomas",
|
|
535
|
-
defaultWhenUnconfigured: false,
|
|
536
|
-
gate: "config-first"
|
|
537
|
-
}
|
|
538
|
-
],
|
|
539
|
-
[
|
|
540
|
-
".fsx",
|
|
541
|
-
{
|
|
542
|
-
formatterNames: ["fantomas"],
|
|
543
|
-
defaultFormatter: "fantomas",
|
|
544
|
-
defaultWhenUnconfigured: false,
|
|
545
|
-
gate: "config-first"
|
|
546
|
-
}
|
|
547
|
-
],
|
|
548
|
-
[
|
|
549
|
-
".nix",
|
|
550
|
-
{
|
|
551
|
-
formatterNames: ["nixfmt"],
|
|
552
|
-
defaultFormatter: "nixfmt",
|
|
553
|
-
defaultWhenUnconfigured: false,
|
|
554
|
-
gate: "smart-default"
|
|
555
|
-
}
|
|
556
|
-
],
|
|
557
|
-
[
|
|
558
|
-
".ex",
|
|
559
|
-
{
|
|
560
|
-
formatterNames: ["mix"],
|
|
561
|
-
defaultFormatter: "mix",
|
|
562
|
-
defaultWhenUnconfigured: false,
|
|
563
|
-
gate: "config-first"
|
|
564
|
-
}
|
|
565
|
-
],
|
|
566
|
-
[
|
|
567
|
-
".exs",
|
|
568
|
-
{
|
|
569
|
-
formatterNames: ["mix"],
|
|
570
|
-
defaultFormatter: "mix",
|
|
571
|
-
defaultWhenUnconfigured: false,
|
|
572
|
-
gate: "config-first"
|
|
573
|
-
}
|
|
574
|
-
],
|
|
575
|
-
[
|
|
576
|
-
".eex",
|
|
577
|
-
{
|
|
578
|
-
formatterNames: ["mix"],
|
|
579
|
-
defaultFormatter: "mix",
|
|
580
|
-
defaultWhenUnconfigured: false,
|
|
581
|
-
gate: "config-first"
|
|
582
|
-
}
|
|
583
|
-
],
|
|
584
|
-
[
|
|
585
|
-
".heex",
|
|
586
|
-
{
|
|
587
|
-
formatterNames: ["mix"],
|
|
588
|
-
defaultFormatter: "mix",
|
|
589
|
-
defaultWhenUnconfigured: false,
|
|
590
|
-
gate: "config-first"
|
|
591
|
-
}
|
|
592
|
-
],
|
|
593
|
-
[
|
|
594
|
-
".leex",
|
|
595
|
-
{
|
|
596
|
-
formatterNames: ["mix"],
|
|
597
|
-
defaultFormatter: "mix",
|
|
598
|
-
defaultWhenUnconfigured: false,
|
|
599
|
-
gate: "config-first"
|
|
600
|
-
}
|
|
601
|
-
],
|
|
602
|
-
[
|
|
603
|
-
".gleam",
|
|
604
|
-
{
|
|
605
|
-
formatterNames: ["gleam"],
|
|
606
|
-
defaultFormatter: "gleam",
|
|
607
|
-
defaultWhenUnconfigured: true,
|
|
608
|
-
gate: "smart-default"
|
|
609
|
-
}
|
|
610
|
-
],
|
|
611
|
-
[
|
|
612
|
-
".typ",
|
|
613
|
-
{
|
|
614
|
-
formatterNames: ["typstyle"],
|
|
615
|
-
defaultFormatter: "typstyle",
|
|
616
|
-
defaultWhenUnconfigured: true,
|
|
617
|
-
gate: "smart-default"
|
|
618
|
-
}
|
|
619
|
-
],
|
|
620
|
-
[
|
|
621
|
-
".typc",
|
|
622
|
-
{
|
|
623
|
-
formatterNames: ["typstyle"],
|
|
624
|
-
defaultFormatter: "typstyle",
|
|
625
|
-
defaultWhenUnconfigured: true,
|
|
626
|
-
gate: "smart-default"
|
|
627
|
-
}
|
|
628
|
-
],
|
|
629
|
-
[
|
|
630
|
-
".c",
|
|
631
|
-
{
|
|
632
|
-
formatterNames: ["clang-format"],
|
|
633
|
-
defaultFormatter: "clang-format",
|
|
634
|
-
defaultWhenUnconfigured: false,
|
|
635
|
-
gate: "config-first"
|
|
636
|
-
}
|
|
637
|
-
],
|
|
638
|
-
[
|
|
639
|
-
".cc",
|
|
640
|
-
{
|
|
641
|
-
formatterNames: ["clang-format"],
|
|
642
|
-
defaultFormatter: "clang-format",
|
|
643
|
-
defaultWhenUnconfigured: false,
|
|
644
|
-
gate: "config-first"
|
|
645
|
-
}
|
|
646
|
-
],
|
|
647
|
-
[
|
|
648
|
-
".cpp",
|
|
649
|
-
{
|
|
650
|
-
formatterNames: ["clang-format"],
|
|
651
|
-
defaultFormatter: "clang-format",
|
|
652
|
-
defaultWhenUnconfigured: false,
|
|
653
|
-
gate: "config-first"
|
|
654
|
-
}
|
|
655
|
-
],
|
|
656
|
-
[
|
|
657
|
-
".cxx",
|
|
658
|
-
{
|
|
659
|
-
formatterNames: ["clang-format"],
|
|
660
|
-
defaultFormatter: "clang-format",
|
|
661
|
-
defaultWhenUnconfigured: false,
|
|
662
|
-
gate: "config-first"
|
|
663
|
-
}
|
|
664
|
-
],
|
|
665
|
-
[
|
|
666
|
-
".h",
|
|
667
|
-
{
|
|
668
|
-
formatterNames: ["clang-format"],
|
|
669
|
-
defaultFormatter: "clang-format",
|
|
670
|
-
defaultWhenUnconfigured: false,
|
|
671
|
-
gate: "config-first"
|
|
672
|
-
}
|
|
673
|
-
],
|
|
674
|
-
[
|
|
675
|
-
".hpp",
|
|
676
|
-
{
|
|
677
|
-
formatterNames: ["clang-format"],
|
|
678
|
-
defaultFormatter: "clang-format",
|
|
679
|
-
defaultWhenUnconfigured: false,
|
|
680
|
-
gate: "config-first"
|
|
681
|
-
}
|
|
682
|
-
],
|
|
683
|
-
[
|
|
684
|
-
".ino",
|
|
685
|
-
{
|
|
686
|
-
formatterNames: ["clang-format"],
|
|
687
|
-
defaultFormatter: "clang-format",
|
|
688
|
-
defaultWhenUnconfigured: false,
|
|
689
|
-
gate: "config-first"
|
|
690
|
-
}
|
|
691
|
-
],
|
|
692
|
-
[
|
|
693
|
-
".php",
|
|
694
|
-
{
|
|
695
|
-
formatterNames: ["php-cs-fixer"],
|
|
696
|
-
defaultFormatter: "php-cs-fixer",
|
|
697
|
-
defaultWhenUnconfigured: false,
|
|
698
|
-
gate: "config-first"
|
|
699
|
-
}
|
|
700
|
-
],
|
|
701
|
-
[
|
|
702
|
-
".cs",
|
|
703
|
-
{
|
|
704
|
-
formatterNames: ["csharpier"],
|
|
705
|
-
defaultFormatter: "csharpier",
|
|
706
|
-
defaultWhenUnconfigured: false,
|
|
707
|
-
gate: "config-first"
|
|
708
|
-
}
|
|
709
|
-
],
|
|
710
|
-
[
|
|
711
|
-
".lua",
|
|
712
|
-
{
|
|
713
|
-
formatterNames: ["stylua"],
|
|
714
|
-
defaultFormatter: "stylua",
|
|
715
|
-
defaultWhenUnconfigured: false,
|
|
716
|
-
gate: "config-first"
|
|
717
|
-
}
|
|
718
|
-
],
|
|
719
|
-
[
|
|
720
|
-
".hs",
|
|
721
|
-
{
|
|
722
|
-
formatterNames: ["ormolu"],
|
|
723
|
-
defaultFormatter: "ormolu",
|
|
724
|
-
defaultWhenUnconfigured: false,
|
|
725
|
-
gate: "config-first"
|
|
726
|
-
}
|
|
727
|
-
],
|
|
728
|
-
[
|
|
729
|
-
".lhs",
|
|
730
|
-
{
|
|
731
|
-
formatterNames: ["ormolu"],
|
|
732
|
-
defaultFormatter: "ormolu",
|
|
733
|
-
defaultWhenUnconfigured: false,
|
|
734
|
-
gate: "config-first"
|
|
735
|
-
}
|
|
736
|
-
],
|
|
737
|
-
[
|
|
738
|
-
".ml",
|
|
739
|
-
{
|
|
740
|
-
formatterNames: ["ocamlformat"],
|
|
741
|
-
defaultFormatter: "ocamlformat",
|
|
742
|
-
defaultWhenUnconfigured: false,
|
|
743
|
-
gate: "config-first"
|
|
744
|
-
}
|
|
745
|
-
],
|
|
746
|
-
[
|
|
747
|
-
".mli",
|
|
748
|
-
{
|
|
749
|
-
formatterNames: ["ocamlformat"],
|
|
750
|
-
defaultFormatter: "ocamlformat",
|
|
751
|
-
defaultWhenUnconfigured: false,
|
|
752
|
-
gate: "config-first"
|
|
753
|
-
}
|
|
754
|
-
],
|
|
755
|
-
[
|
|
756
|
-
".go",
|
|
757
|
-
{
|
|
758
|
-
formatterNames: ["gofmt"],
|
|
759
|
-
defaultFormatter: "gofmt",
|
|
760
|
-
defaultWhenUnconfigured: true,
|
|
761
|
-
gate: "smart-default"
|
|
762
|
-
}
|
|
763
|
-
],
|
|
764
|
-
[
|
|
765
|
-
".rs",
|
|
766
|
-
{
|
|
767
|
-
formatterNames: ["rustfmt"],
|
|
768
|
-
defaultFormatter: "rustfmt",
|
|
769
|
-
defaultWhenUnconfigured: true,
|
|
770
|
-
gate: "smart-default"
|
|
771
|
-
}
|
|
772
|
-
],
|
|
773
|
-
[
|
|
774
|
-
".sh",
|
|
775
|
-
{
|
|
776
|
-
formatterNames: ["shfmt"],
|
|
777
|
-
defaultFormatter: "shfmt",
|
|
778
|
-
defaultWhenUnconfigured: true,
|
|
779
|
-
gate: "smart-default"
|
|
780
|
-
}
|
|
781
|
-
],
|
|
782
|
-
[
|
|
783
|
-
".bash",
|
|
784
|
-
{
|
|
785
|
-
formatterNames: ["shfmt"],
|
|
786
|
-
defaultFormatter: "shfmt",
|
|
787
|
-
defaultWhenUnconfigured: true,
|
|
788
|
-
gate: "smart-default"
|
|
789
|
-
}
|
|
790
|
-
],
|
|
791
|
-
[
|
|
792
|
-
".toml",
|
|
793
|
-
{
|
|
794
|
-
formatterNames: ["taplo"],
|
|
795
|
-
defaultFormatter: "taplo",
|
|
796
|
-
defaultWhenUnconfigured: false,
|
|
797
|
-
gate: "config-first"
|
|
798
|
-
}
|
|
799
|
-
],
|
|
800
|
-
[
|
|
801
|
-
".tf",
|
|
802
|
-
{
|
|
803
|
-
formatterNames: ["terraform"],
|
|
804
|
-
defaultFormatter: "terraform",
|
|
805
|
-
defaultWhenUnconfigured: false,
|
|
806
|
-
gate: "config-first"
|
|
807
|
-
}
|
|
808
|
-
],
|
|
809
|
-
[
|
|
810
|
-
".tfvars",
|
|
811
|
-
{
|
|
812
|
-
formatterNames: ["terraform"],
|
|
813
|
-
defaultFormatter: "terraform",
|
|
814
|
-
defaultWhenUnconfigured: false,
|
|
815
|
-
gate: "config-first"
|
|
816
|
-
}
|
|
817
|
-
],
|
|
818
|
-
[
|
|
819
|
-
".dart",
|
|
820
|
-
{
|
|
821
|
-
formatterNames: ["dart"],
|
|
822
|
-
defaultFormatter: "dart",
|
|
823
|
-
defaultWhenUnconfigured: true,
|
|
824
|
-
gate: "smart-default"
|
|
825
|
-
}
|
|
826
|
-
],
|
|
827
|
-
[
|
|
828
|
-
".zig",
|
|
829
|
-
{
|
|
830
|
-
formatterNames: ["zig"],
|
|
831
|
-
defaultFormatter: "zig",
|
|
832
|
-
defaultWhenUnconfigured: true,
|
|
833
|
-
gate: "smart-default"
|
|
834
|
-
}
|
|
835
|
-
],
|
|
836
|
-
[
|
|
837
|
-
".zon",
|
|
838
|
-
{
|
|
839
|
-
formatterNames: ["zig"],
|
|
840
|
-
defaultFormatter: "zig",
|
|
841
|
-
defaultWhenUnconfigured: true,
|
|
842
|
-
gate: "smart-default"
|
|
843
|
-
}
|
|
844
|
-
],
|
|
845
|
-
[
|
|
846
|
-
".java",
|
|
847
|
-
{
|
|
848
|
-
formatterNames: ["google-java-format"],
|
|
849
|
-
defaultFormatter: "google-java-format",
|
|
850
|
-
defaultWhenUnconfigured: false,
|
|
851
|
-
gate: "config-first"
|
|
852
|
-
}
|
|
853
|
-
],
|
|
854
|
-
[
|
|
855
|
-
".clj",
|
|
856
|
-
{
|
|
857
|
-
formatterNames: ["cljfmt"],
|
|
858
|
-
defaultFormatter: "cljfmt",
|
|
859
|
-
defaultWhenUnconfigured: false,
|
|
860
|
-
gate: "config-first"
|
|
861
|
-
}
|
|
862
|
-
],
|
|
863
|
-
[
|
|
864
|
-
".cljc",
|
|
865
|
-
{
|
|
866
|
-
formatterNames: ["cljfmt"],
|
|
867
|
-
defaultFormatter: "cljfmt",
|
|
868
|
-
defaultWhenUnconfigured: false,
|
|
869
|
-
gate: "config-first"
|
|
870
|
-
}
|
|
871
|
-
],
|
|
872
|
-
[
|
|
873
|
-
".cljs",
|
|
874
|
-
{
|
|
875
|
-
formatterNames: ["cljfmt"],
|
|
876
|
-
defaultFormatter: "cljfmt",
|
|
877
|
-
defaultWhenUnconfigured: false,
|
|
878
|
-
gate: "config-first"
|
|
879
|
-
}
|
|
880
|
-
],
|
|
881
|
-
[
|
|
882
|
-
".cmake",
|
|
883
|
-
{
|
|
884
|
-
formatterNames: ["cmake-format"],
|
|
885
|
-
defaultFormatter: "cmake-format",
|
|
886
|
-
defaultWhenUnconfigured: false,
|
|
887
|
-
gate: "config-first"
|
|
888
|
-
}
|
|
889
|
-
],
|
|
890
|
-
[
|
|
891
|
-
".ps1",
|
|
892
|
-
{
|
|
893
|
-
formatterNames: ["psscriptanalyzer-format"],
|
|
894
|
-
defaultFormatter: "psscriptanalyzer-format",
|
|
895
|
-
defaultWhenUnconfigured: false,
|
|
896
|
-
gate: "smart-default"
|
|
897
|
-
}
|
|
898
|
-
],
|
|
899
|
-
[
|
|
900
|
-
".psm1",
|
|
901
|
-
{
|
|
902
|
-
formatterNames: ["psscriptanalyzer-format"],
|
|
903
|
-
defaultFormatter: "psscriptanalyzer-format",
|
|
904
|
-
defaultWhenUnconfigured: false,
|
|
905
|
-
gate: "smart-default"
|
|
906
|
-
}
|
|
907
|
-
],
|
|
908
|
-
[
|
|
909
|
-
".psd1",
|
|
910
|
-
{
|
|
911
|
-
formatterNames: ["psscriptanalyzer-format"],
|
|
912
|
-
defaultFormatter: "psscriptanalyzer-format",
|
|
913
|
-
defaultWhenUnconfigured: false,
|
|
914
|
-
gate: "smart-default"
|
|
915
|
-
}
|
|
916
|
-
],
|
|
917
|
-
[
|
|
918
|
-
".cue",
|
|
919
|
-
{
|
|
920
|
-
formatterNames: ["cue"],
|
|
921
|
-
defaultFormatter: "cue",
|
|
922
|
-
defaultWhenUnconfigured: true,
|
|
923
|
-
gate: "smart-default"
|
|
924
|
-
}
|
|
925
|
-
]
|
|
926
|
-
]);
|
|
927
|
-
var OXFMT_SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
928
|
-
".js",
|
|
929
|
-
".jsx",
|
|
930
|
-
".mjs",
|
|
931
|
-
".cjs",
|
|
932
|
-
".ts",
|
|
933
|
-
".tsx",
|
|
934
|
-
".mts",
|
|
935
|
-
".cts",
|
|
936
|
-
".vue",
|
|
937
|
-
".svelte",
|
|
938
|
-
".css",
|
|
939
|
-
".scss",
|
|
940
|
-
".less",
|
|
941
|
-
".html",
|
|
942
|
-
".htm",
|
|
943
|
-
".json",
|
|
944
|
-
".jsonc",
|
|
945
|
-
".yaml",
|
|
946
|
-
".yml",
|
|
947
|
-
".md",
|
|
948
|
-
".mdx",
|
|
949
|
-
".graphql",
|
|
950
|
-
".gql",
|
|
951
|
-
".toml"
|
|
952
|
-
]);
|
|
953
|
-
FORMATTER_POLICY_BY_EXTENSION.set(".vue", {
|
|
954
|
-
formatterNames: ["prettier"],
|
|
955
|
-
defaultFormatter: "prettier",
|
|
956
|
-
defaultWhenUnconfigured: false,
|
|
957
|
-
gate: "config-first"
|
|
958
|
-
});
|
|
959
|
-
FORMATTER_POLICY_BY_EXTENSION.set(".svelte", {
|
|
960
|
-
formatterNames: [],
|
|
961
|
-
defaultFormatter: "oxfmt",
|
|
962
|
-
defaultWhenUnconfigured: false,
|
|
963
|
-
gate: "config-first"
|
|
964
|
-
});
|
|
965
|
-
for (const [ext, policy] of FORMATTER_POLICY_BY_EXTENSION) {
|
|
966
|
-
if (OXFMT_SUPPORTED_EXTENSIONS.has(ext) && !policy.formatterNames.includes("oxfmt")) {
|
|
967
|
-
policy.formatterNames.push("oxfmt");
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
var AUTO_INSTALLABLE_DEFAULT_FORMATTERS = /* @__PURE__ */ new Map([
|
|
971
|
-
["biome", "biome"],
|
|
972
|
-
["ruff", "ruff"],
|
|
973
|
-
["prettier", "prettier"],
|
|
974
|
-
["shfmt", "shfmt"],
|
|
975
|
-
["taplo", "taplo"],
|
|
976
|
-
["ktlint", "ktlint"],
|
|
977
|
-
["typstyle", "typstyle"]
|
|
978
|
-
]);
|
|
979
|
-
var TERRAGRUNT_FORMATTER_POLICY = {
|
|
980
|
-
formatterNames: ["terragrunt-hcl"],
|
|
981
|
-
defaultFormatter: "terragrunt-hcl",
|
|
982
|
-
defaultWhenUnconfigured: true,
|
|
983
|
-
gate: "smart-default"
|
|
984
|
-
};
|
|
985
|
-
var FORMATTER_POLICY_BY_FILENAME = new Map(TERRAGRUNT_FILENAMES.map((name) => [name, TERRAGRUNT_FORMATTER_POLICY]));
|
|
986
|
-
function getFormatterPolicyForExtension(ext) {
|
|
987
|
-
return FORMATTER_POLICY_BY_EXTENSION.get(ext.toLowerCase());
|
|
988
|
-
}
|
|
989
|
-
function getFormatterPolicyForFile(filePath) {
|
|
990
|
-
const byFilename = FORMATTER_POLICY_BY_FILENAME.get(path2.basename(filePath).toLowerCase());
|
|
991
|
-
if (byFilename)
|
|
992
|
-
return byFilename;
|
|
993
|
-
return getFormatterPolicyForExtension(path2.extname(filePath));
|
|
994
|
-
}
|
|
995
|
-
function getSmartDefaultFormatterName(filePath) {
|
|
996
|
-
const policy = getFormatterPolicyForFile(filePath);
|
|
997
|
-
if (!policy?.defaultWhenUnconfigured)
|
|
998
|
-
return void 0;
|
|
999
|
-
return policy.defaultFormatter;
|
|
1000
|
-
}
|
|
1001
|
-
function getAutoInstallToolIdForFormatter(formatterName) {
|
|
1002
|
-
return AUTO_INSTALLABLE_DEFAULT_FORMATTERS.get(formatterName);
|
|
1003
|
-
}
|
|
1004
|
-
function getToolExecutionPolicy(toolId) {
|
|
1005
|
-
return TOOL_EXECUTION_POLICY.get(toolId);
|
|
1006
|
-
}
|
|
1007
|
-
function shouldAutoInstallTool(toolId) {
|
|
1008
|
-
return getToolExecutionPolicy(toolId)?.autoInstall ?? false;
|
|
1009
|
-
}
|
|
1010
|
-
function getAutofixCapability(toolId) {
|
|
1011
|
-
return AUTOFIX_CAPABILITIES.get(toolId);
|
|
1012
|
-
}
|
|
1013
|
-
function getToolCommandSpec(toolId) {
|
|
1014
|
-
return TOOL_COMMAND_SPECS.get(toolId);
|
|
1015
|
-
}
|
|
1016
|
-
var AUTOFIX_CAPABILITIES = /* @__PURE__ */ new Map([
|
|
1017
|
-
[
|
|
1018
|
-
"biome",
|
|
1019
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1020
|
-
],
|
|
1021
|
-
[
|
|
1022
|
-
"eslint",
|
|
1023
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1024
|
-
],
|
|
1025
|
-
[
|
|
1026
|
-
"ruff",
|
|
1027
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1028
|
-
],
|
|
1029
|
-
[
|
|
1030
|
-
"stylelint",
|
|
1031
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1032
|
-
],
|
|
1033
|
-
[
|
|
1034
|
-
"sqlfluff",
|
|
1035
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1036
|
-
],
|
|
1037
|
-
[
|
|
1038
|
-
"rubocop",
|
|
1039
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1040
|
-
],
|
|
1041
|
-
[
|
|
1042
|
-
"ktlint",
|
|
1043
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1044
|
-
],
|
|
1045
|
-
[
|
|
1046
|
-
"ktfmt",
|
|
1047
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1048
|
-
],
|
|
1049
|
-
[
|
|
1050
|
-
"rust-clippy",
|
|
1051
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1052
|
-
],
|
|
1053
|
-
[
|
|
1054
|
-
"dart-analyze",
|
|
1055
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1056
|
-
],
|
|
1057
|
-
[
|
|
1058
|
-
"golangci-lint",
|
|
1059
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1060
|
-
],
|
|
1061
|
-
[
|
|
1062
|
-
"detekt",
|
|
1063
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1064
|
-
],
|
|
1065
|
-
[
|
|
1066
|
-
"markdownlint",
|
|
1067
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1068
|
-
],
|
|
1069
|
-
[
|
|
1070
|
-
"oxlint",
|
|
1071
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
|
|
1072
|
-
]
|
|
1073
|
-
]);
|
|
1074
|
-
var TOOL_EXECUTION_POLICY = /* @__PURE__ */ new Map([
|
|
1075
|
-
// Dispatch/LSP runners use the shared availability/install seam. These
|
|
1076
|
-
// managed tools are missing-command repair candidates; probe failures still
|
|
1077
|
-
// fail closed before this policy is consulted.
|
|
1078
|
-
["pyright", { configEligibility: "smart-default", autoInstall: true }],
|
|
1079
|
-
["shellcheck", { configEligibility: "smart-default", autoInstall: true }],
|
|
1080
|
-
["shfmt", { configEligibility: "smart-default", autoInstall: true }],
|
|
1081
|
-
["tflint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1082
|
-
["terragrunt", { configEligibility: "smart-default", autoInstall: true }],
|
|
1083
|
-
["trivy", { configEligibility: "config-first", autoInstall: true }],
|
|
1084
|
-
["biome", { configEligibility: "smart-default", autoInstall: true }],
|
|
1085
|
-
["ruff", { configEligibility: "smart-default", autoInstall: true }],
|
|
1086
|
-
["jscpd", { configEligibility: "smart-default", autoInstall: true }],
|
|
1087
|
-
["madge", { configEligibility: "smart-default", autoInstall: true }],
|
|
1088
|
-
["knip", { configEligibility: "smart-default", autoInstall: true }],
|
|
1089
|
-
["ast-grep", { configEligibility: "smart-default", autoInstall: true }],
|
|
1090
|
-
["oxlint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1091
|
-
["stylelint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1092
|
-
["sqlfluff", { configEligibility: "smart-default", autoInstall: true }],
|
|
1093
|
-
["rubocop", { configEligibility: "smart-default", autoInstall: true }],
|
|
1094
|
-
["yamllint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1095
|
-
["actionlint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1096
|
-
["markdownlint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1097
|
-
["mypy", { configEligibility: "config-first", autoInstall: true }],
|
|
1098
|
-
["taplo", { configEligibility: "smart-default", autoInstall: true }],
|
|
1099
|
-
["hadolint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1100
|
-
["helm", { configEligibility: "smart-default", autoInstall: true }],
|
|
1101
|
-
["htmlhint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1102
|
-
["ktlint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1103
|
-
// ktfmt is opt-in (a project's explicit formatting choice), so it only runs
|
|
1104
|
-
// when its config marker is present — config-first, but auto-installable via
|
|
1105
|
-
// the maven-JAR strategy once elected (#129).
|
|
1106
|
-
["ktfmt", { configEligibility: "config-first", autoInstall: true }],
|
|
1107
|
-
["golangci-lint", { configEligibility: "config-first", autoInstall: true }],
|
|
1108
|
-
// SpotBugs is opt-in (lens-spotbugs flag) + config-first (needs a Java build
|
|
1109
|
-
// descriptor + compiled .class files), auto-installed via the archive
|
|
1110
|
-
// strategy when elected (#133).
|
|
1111
|
-
["spotbugs", { configEligibility: "config-first", autoInstall: true }],
|
|
1112
|
-
// Opengrep is opt-in (lens-opengrep flag or a discovered rule file) and
|
|
1113
|
-
// config-first, but auto-installable via the GitHub single-binary strategy
|
|
1114
|
-
// once elected — no login/token required, unlike Semgrep (#111).
|
|
1115
|
-
["opengrep", { configEligibility: "config-first", autoInstall: true }],
|
|
1116
|
-
["phpstan", { configEligibility: "config-first", autoInstall: false }],
|
|
1117
|
-
["eslint", { configEligibility: "config-first", autoInstall: false }],
|
|
1118
|
-
["prettier", { configEligibility: "smart-default", autoInstall: true }],
|
|
1119
|
-
["vale", { configEligibility: "config-first", autoInstall: false }],
|
|
1120
|
-
["swiftlint", { configEligibility: "smart-default", autoInstall: true }],
|
|
1121
|
-
// typstyle is the default Typst formatter, so it carries the same
|
|
1122
|
-
// smart-default/auto-install row its AUTO_INSTALLABLE_DEFAULT_FORMATTERS
|
|
1123
|
-
// entry implies. The formatter path in `clients/formatters.ts` is what
|
|
1124
|
-
// installs it; the row exists so the policy table does not disagree with the
|
|
1125
|
-
// formatter table about a tool it names (#5418). The row states what already
|
|
1126
|
-
// runs, and changes no install decision: whether typstyle should auto-install
|
|
1127
|
-
// at all is an open product decision this branch deliberately leaves open.
|
|
1128
|
-
["typstyle", { configEligibility: "smart-default", autoInstall: true }]
|
|
1129
|
-
]);
|
|
1130
|
-
var TOOL_COMMAND_SPECS = /* @__PURE__ */ new Map([
|
|
1131
|
-
[
|
|
1132
|
-
// No managedToolId: the installer registry has no `eslint` entry (the
|
|
1133
|
-
// runner resolves the project's own `node_modules/.bin/eslint` first), so
|
|
1134
|
-
// a pointer here named an install path that does not exist (#5418).
|
|
1135
|
-
"eslint",
|
|
1136
|
-
{
|
|
1137
|
-
command: "eslint",
|
|
1138
|
-
windowsExt: ".cmd",
|
|
1139
|
-
versionArgs: ["--version"]
|
|
1140
|
-
}
|
|
1141
|
-
],
|
|
1142
|
-
[
|
|
1143
|
-
"stylelint",
|
|
1144
|
-
{
|
|
1145
|
-
command: "stylelint",
|
|
1146
|
-
windowsExt: ".cmd",
|
|
1147
|
-
versionArgs: ["--version"],
|
|
1148
|
-
managedToolId: "stylelint"
|
|
1149
|
-
}
|
|
1150
|
-
],
|
|
1151
|
-
[
|
|
1152
|
-
"sqlfluff",
|
|
1153
|
-
{
|
|
1154
|
-
command: "sqlfluff",
|
|
1155
|
-
windowsExt: ".exe",
|
|
1156
|
-
versionArgs: ["--version"],
|
|
1157
|
-
managedToolId: "sqlfluff"
|
|
1158
|
-
}
|
|
1159
|
-
],
|
|
1160
|
-
[
|
|
1161
|
-
"oxlint",
|
|
1162
|
-
{
|
|
1163
|
-
command: "oxlint",
|
|
1164
|
-
windowsExt: ".exe",
|
|
1165
|
-
versionArgs: ["--version"],
|
|
1166
|
-
managedToolId: "oxlint"
|
|
1167
|
-
}
|
|
1168
|
-
],
|
|
1169
|
-
[
|
|
1170
|
-
"ruff",
|
|
1171
|
-
{
|
|
1172
|
-
command: "ruff",
|
|
1173
|
-
windowsExt: ".exe",
|
|
1174
|
-
versionArgs: ["--version"],
|
|
1175
|
-
managedToolId: "ruff"
|
|
1176
|
-
}
|
|
1177
|
-
],
|
|
1178
|
-
[
|
|
1179
|
-
"biome",
|
|
1180
|
-
{
|
|
1181
|
-
command: "biome",
|
|
1182
|
-
windowsExt: ".cmd",
|
|
1183
|
-
versionArgs: ["--version"],
|
|
1184
|
-
managedToolId: "biome"
|
|
1185
|
-
}
|
|
1186
|
-
],
|
|
1187
|
-
[
|
|
1188
|
-
"rubocop",
|
|
1189
|
-
{
|
|
1190
|
-
command: "rubocop",
|
|
1191
|
-
versionArgs: ["--version"],
|
|
1192
|
-
managedToolId: "rubocop"
|
|
1193
|
-
}
|
|
1194
|
-
],
|
|
1195
|
-
[
|
|
1196
|
-
"yamllint",
|
|
1197
|
-
{
|
|
1198
|
-
command: "yamllint",
|
|
1199
|
-
windowsExt: ".exe",
|
|
1200
|
-
versionArgs: ["--version"],
|
|
1201
|
-
managedToolId: "yamllint"
|
|
1202
|
-
}
|
|
1203
|
-
],
|
|
1204
|
-
[
|
|
1205
|
-
"actionlint",
|
|
1206
|
-
{
|
|
1207
|
-
command: "actionlint",
|
|
1208
|
-
windowsExt: ".exe",
|
|
1209
|
-
versionArgs: ["--version"],
|
|
1210
|
-
managedToolId: "actionlint"
|
|
1211
|
-
}
|
|
1212
|
-
],
|
|
1213
|
-
[
|
|
1214
|
-
"markdownlint",
|
|
1215
|
-
{
|
|
1216
|
-
command: "markdownlint-cli2",
|
|
1217
|
-
windowsExt: ".cmd",
|
|
1218
|
-
versionArgs: ["--no-globs", "-"],
|
|
1219
|
-
managedToolId: "markdownlint"
|
|
1220
|
-
}
|
|
1221
|
-
],
|
|
1222
|
-
[
|
|
1223
|
-
"vale",
|
|
1224
|
-
{
|
|
1225
|
-
command: "vale",
|
|
1226
|
-
windowsExt: ".exe",
|
|
1227
|
-
versionArgs: ["--version"],
|
|
1228
|
-
managedToolId: "vale"
|
|
1229
|
-
}
|
|
1230
|
-
],
|
|
1231
|
-
[
|
|
1232
|
-
"swiftlint",
|
|
1233
|
-
{
|
|
1234
|
-
command: "swiftlint",
|
|
1235
|
-
windowsExt: ".exe",
|
|
1236
|
-
versionArgs: ["--version"],
|
|
1237
|
-
managedToolId: "swiftlint"
|
|
1238
|
-
}
|
|
1239
|
-
],
|
|
1240
|
-
[
|
|
1241
|
-
"mypy",
|
|
1242
|
-
{
|
|
1243
|
-
command: "mypy",
|
|
1244
|
-
versionArgs: ["--version"],
|
|
1245
|
-
managedToolId: "mypy"
|
|
1246
|
-
}
|
|
1247
|
-
],
|
|
1248
|
-
[
|
|
1249
|
-
// No managedToolId: no installer entry for `phpstan` exists, so the
|
|
1250
|
-
// pointer resolved to nothing (#5418; auto-install stays an open decision).
|
|
1251
|
-
"phpstan",
|
|
1252
|
-
{
|
|
1253
|
-
command: "phpstan",
|
|
1254
|
-
windowsExt: ".bat",
|
|
1255
|
-
versionArgs: ["--version"]
|
|
1256
|
-
}
|
|
1257
|
-
],
|
|
1258
|
-
[
|
|
1259
|
-
"taplo",
|
|
1260
|
-
{
|
|
1261
|
-
command: "taplo",
|
|
1262
|
-
windowsExt: ".exe",
|
|
1263
|
-
versionArgs: ["--version"],
|
|
1264
|
-
managedToolId: "taplo"
|
|
1265
|
-
}
|
|
1266
|
-
],
|
|
1267
|
-
[
|
|
1268
|
-
"hadolint",
|
|
1269
|
-
{
|
|
1270
|
-
command: "hadolint",
|
|
1271
|
-
windowsExt: ".exe",
|
|
1272
|
-
versionArgs: ["--version"],
|
|
1273
|
-
managedToolId: "hadolint"
|
|
1274
|
-
}
|
|
1275
|
-
],
|
|
1276
|
-
[
|
|
1277
|
-
"htmlhint",
|
|
1278
|
-
{
|
|
1279
|
-
command: "htmlhint",
|
|
1280
|
-
windowsExt: ".cmd",
|
|
1281
|
-
versionArgs: ["--version"],
|
|
1282
|
-
managedToolId: "htmlhint"
|
|
1283
|
-
}
|
|
1284
|
-
],
|
|
1285
|
-
[
|
|
1286
|
-
"ktlint",
|
|
1287
|
-
{
|
|
1288
|
-
command: "ktlint",
|
|
1289
|
-
windowsExt: ".exe",
|
|
1290
|
-
versionArgs: ["--version"],
|
|
1291
|
-
managedToolId: "ktlint"
|
|
1292
|
-
}
|
|
1293
|
-
],
|
|
1294
|
-
[
|
|
1295
|
-
"prettier",
|
|
1296
|
-
{
|
|
1297
|
-
command: "prettier",
|
|
1298
|
-
windowsExt: ".cmd",
|
|
1299
|
-
versionArgs: ["--version"],
|
|
1300
|
-
managedToolId: "prettier"
|
|
1301
|
-
}
|
|
1302
|
-
]
|
|
1303
|
-
]);
|
|
1304
|
-
var STYLELINT_CONFIGS = [
|
|
1305
|
-
".stylelintrc",
|
|
1306
|
-
".stylelintrc.json",
|
|
1307
|
-
".stylelintrc.jsonc",
|
|
1308
|
-
".stylelintrc.yaml",
|
|
1309
|
-
".stylelintrc.yml",
|
|
1310
|
-
".stylelintrc.js",
|
|
1311
|
-
".stylelintrc.cjs",
|
|
1312
|
-
"stylelint.config.js",
|
|
1313
|
-
"stylelint.config.cjs",
|
|
1314
|
-
"stylelint.config.mjs"
|
|
1315
|
-
];
|
|
1316
|
-
var RUBOCOP_CONFIGS = [".rubocop.yml", ".rubocop.yaml"];
|
|
1317
|
-
var MARKDOWNLINT_CONFIGS = [
|
|
1318
|
-
// markdownlint-cli2's built-in config names (keep this list in sync with
|
|
1319
|
-
// the installed CLI's supported configuration file names).
|
|
1320
|
-
".markdownlint-cli2.jsonc",
|
|
1321
|
-
".markdownlint-cli2.yaml",
|
|
1322
|
-
".markdownlint-cli2.yml",
|
|
1323
|
-
".markdownlint-cli2.cjs",
|
|
1324
|
-
".markdownlint-cli2.mjs",
|
|
1325
|
-
".markdownlint.jsonc",
|
|
1326
|
-
".markdownlint.json",
|
|
1327
|
-
".markdownlint.yaml",
|
|
1328
|
-
".markdownlint.yml",
|
|
1329
|
-
".markdownlint.cjs",
|
|
1330
|
-
".markdownlint.mjs",
|
|
1331
|
-
// Retain the legacy detector name for compatibility with existing policy
|
|
1332
|
-
// behavior, even though current markdownlint-cli2 versions do not prefer it.
|
|
1333
|
-
".markdownlintrc"
|
|
1334
|
-
];
|
|
1335
|
-
var PRETTIER_CONFIGS = [
|
|
1336
|
-
".prettierrc",
|
|
1337
|
-
".prettierrc.json",
|
|
1338
|
-
".prettierrc.yml",
|
|
1339
|
-
".prettierrc.yaml",
|
|
1340
|
-
".prettierrc.js",
|
|
1341
|
-
".prettierrc.cjs",
|
|
1342
|
-
".prettierrc.mjs",
|
|
1343
|
-
"prettier.config.js",
|
|
1344
|
-
"prettier.config.cjs",
|
|
1345
|
-
"prettier.config.mjs",
|
|
1346
|
-
"prettier.config.ts"
|
|
1347
|
-
];
|
|
1348
|
-
var GOLANGCI_CONFIGS = [
|
|
1349
|
-
".golangci.yml",
|
|
1350
|
-
".golangci.yaml",
|
|
1351
|
-
".golangci.toml",
|
|
1352
|
-
".golangci.json"
|
|
1353
|
-
];
|
|
1354
|
-
var PHPSTAN_CONFIGS = [
|
|
1355
|
-
"phpstan.neon",
|
|
1356
|
-
"phpstan.neon.dist",
|
|
1357
|
-
"phpstan.dist.neon"
|
|
1358
|
-
];
|
|
1359
|
-
var VITE_CONFIGS = [
|
|
1360
|
-
"vite.config.ts",
|
|
1361
|
-
"vite.config.mts",
|
|
1362
|
-
"vite.config.cts",
|
|
1363
|
-
"vite.config.js",
|
|
1364
|
-
"vite.config.mjs",
|
|
1365
|
-
"vite.config.cjs"
|
|
1366
|
-
];
|
|
1367
|
-
function getLinterPolicyForFile(filePath, context = {}) {
|
|
1368
|
-
const ext = path2.extname(filePath).toLowerCase();
|
|
1369
|
-
if (isJstsFactFile(filePath)) {
|
|
1370
|
-
const policy = getJstsLintPolicy({
|
|
1371
|
-
hasEslintConfig: context.hasEslintConfig,
|
|
1372
|
-
hasOxlintConfig: context.hasOxlintConfig,
|
|
1373
|
-
hasBiomeConfig: context.hasBiomeConfig
|
|
1374
|
-
});
|
|
1375
|
-
return {
|
|
1376
|
-
runnerNames: ["eslint", "oxlint", "biome-check-json"],
|
|
1377
|
-
preferredRunners: policy.preferredRunners,
|
|
1378
|
-
defaultRunner: policy.preferredRunners[0],
|
|
1379
|
-
defaultWhenUnconfigured: !policy.hasEslintConfig && !policy.hasOxlintConfig,
|
|
1380
|
-
gate: policy.hasEslintConfig ? "config-first" : "smart-default"
|
|
1381
|
-
};
|
|
1382
|
-
}
|
|
1383
|
-
if ([".py", ".pyi"].includes(ext)) {
|
|
1384
|
-
const preferredRunners = ["ruff-lint"];
|
|
1385
|
-
if (context.hasMypyConfig)
|
|
1386
|
-
preferredRunners.push("mypy");
|
|
1387
|
-
return {
|
|
1388
|
-
runnerNames: ["ruff-lint", "mypy"],
|
|
1389
|
-
preferredRunners,
|
|
1390
|
-
defaultRunner: "ruff-lint",
|
|
1391
|
-
defaultWhenUnconfigured: true,
|
|
1392
|
-
gate: context.hasMypyConfig ? "mixed" : "smart-default"
|
|
1393
|
-
};
|
|
1394
|
-
}
|
|
1395
|
-
if ([".css", ".scss", ".sass", ".less"].includes(ext)) {
|
|
1396
|
-
return {
|
|
1397
|
-
runnerNames: ["stylelint"],
|
|
1398
|
-
preferredRunners: ["stylelint"],
|
|
1399
|
-
defaultRunner: "stylelint",
|
|
1400
|
-
defaultWhenUnconfigured: true,
|
|
1401
|
-
gate: "smart-default"
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
if (ext === ".sql") {
|
|
1405
|
-
return {
|
|
1406
|
-
runnerNames: ["sqlfluff"],
|
|
1407
|
-
preferredRunners: ["sqlfluff"],
|
|
1408
|
-
defaultRunner: "sqlfluff",
|
|
1409
|
-
defaultWhenUnconfigured: true,
|
|
1410
|
-
gate: "smart-default"
|
|
1411
|
-
};
|
|
1412
|
-
}
|
|
1413
|
-
if ([".rb", ".rake", ".gemspec", ".ru"].includes(ext)) {
|
|
1414
|
-
return {
|
|
1415
|
-
runnerNames: ["rubocop"],
|
|
1416
|
-
preferredRunners: ["rubocop"],
|
|
1417
|
-
defaultRunner: "rubocop",
|
|
1418
|
-
defaultWhenUnconfigured: true,
|
|
1419
|
-
gate: "smart-default"
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
if ([".yaml", ".yml"].includes(ext)) {
|
|
1423
|
-
return {
|
|
1424
|
-
runnerNames: ["yamllint"],
|
|
1425
|
-
preferredRunners: ["yamllint"],
|
|
1426
|
-
defaultRunner: "yamllint",
|
|
1427
|
-
defaultWhenUnconfigured: true,
|
|
1428
|
-
gate: "smart-default"
|
|
1429
|
-
};
|
|
1430
|
-
}
|
|
1431
|
-
if ([".md", ".mdx"].includes(ext)) {
|
|
1432
|
-
return {
|
|
1433
|
-
runnerNames: ["markdownlint"],
|
|
1434
|
-
preferredRunners: ["markdownlint"],
|
|
1435
|
-
defaultRunner: "markdownlint",
|
|
1436
|
-
defaultWhenUnconfigured: true,
|
|
1437
|
-
gate: "smart-default"
|
|
1438
|
-
};
|
|
1439
|
-
}
|
|
1440
|
-
if ([".html", ".htm"].includes(ext)) {
|
|
1441
|
-
return {
|
|
1442
|
-
runnerNames: ["htmlhint"],
|
|
1443
|
-
preferredRunners: ["htmlhint"],
|
|
1444
|
-
defaultRunner: "htmlhint",
|
|
1445
|
-
defaultWhenUnconfigured: true,
|
|
1446
|
-
gate: "smart-default"
|
|
1447
|
-
};
|
|
1448
|
-
}
|
|
1449
|
-
if (path2.basename(filePath).toLowerCase() === "dockerfile") {
|
|
1450
|
-
return {
|
|
1451
|
-
runnerNames: ["hadolint"],
|
|
1452
|
-
preferredRunners: ["hadolint"],
|
|
1453
|
-
defaultRunner: "hadolint",
|
|
1454
|
-
defaultWhenUnconfigured: true,
|
|
1455
|
-
gate: "smart-default"
|
|
1456
|
-
};
|
|
1457
|
-
}
|
|
1458
|
-
if (TERRAGRUNT_FILENAMES.includes(path2.basename(filePath).toLowerCase())) {
|
|
1459
|
-
return {
|
|
1460
|
-
runnerNames: ["terragrunt"],
|
|
1461
|
-
preferredRunners: ["terragrunt"],
|
|
1462
|
-
defaultRunner: "terragrunt",
|
|
1463
|
-
defaultWhenUnconfigured: true,
|
|
1464
|
-
gate: "smart-default"
|
|
1465
|
-
};
|
|
1466
|
-
}
|
|
1467
|
-
if ([".kt", ".kts"].includes(ext)) {
|
|
1468
|
-
const preferredRunners = [];
|
|
1469
|
-
if (!context.hasKtfmtConfig)
|
|
1470
|
-
preferredRunners.push("ktlint");
|
|
1471
|
-
if (context.hasDetektConfig)
|
|
1472
|
-
preferredRunners.push("detekt");
|
|
1473
|
-
return {
|
|
1474
|
-
runnerNames: ["ktlint", "detekt"],
|
|
1475
|
-
preferredRunners,
|
|
1476
|
-
defaultRunner: preferredRunners[0],
|
|
1477
|
-
defaultWhenUnconfigured: true,
|
|
1478
|
-
gate: context.hasKtfmtConfig ? "config-first" : context.hasDetektConfig ? "mixed" : "smart-default"
|
|
1479
|
-
};
|
|
1480
|
-
}
|
|
1481
|
-
if (ext === ".toml") {
|
|
1482
|
-
return {
|
|
1483
|
-
runnerNames: ["taplo"],
|
|
1484
|
-
preferredRunners: ["taplo"],
|
|
1485
|
-
defaultRunner: "taplo",
|
|
1486
|
-
defaultWhenUnconfigured: true,
|
|
1487
|
-
gate: "smart-default"
|
|
1488
|
-
};
|
|
1489
|
-
}
|
|
1490
|
-
if (ext === ".go") {
|
|
1491
|
-
return {
|
|
1492
|
-
runnerNames: ["golangci-lint"],
|
|
1493
|
-
preferredRunners: context.hasGolangciConfig ? ["golangci-lint"] : [],
|
|
1494
|
-
defaultRunner: "golangci-lint",
|
|
1495
|
-
defaultWhenUnconfigured: false,
|
|
1496
|
-
gate: "config-first"
|
|
1497
|
-
};
|
|
1498
|
-
}
|
|
1499
|
-
if (ext === ".php") {
|
|
1500
|
-
return {
|
|
1501
|
-
runnerNames: ["phpstan"],
|
|
1502
|
-
preferredRunners: context.hasPhpstanConfig ? ["phpstan"] : [],
|
|
1503
|
-
defaultRunner: "phpstan",
|
|
1504
|
-
defaultWhenUnconfigured: false,
|
|
1505
|
-
gate: "config-first"
|
|
1506
|
-
};
|
|
1507
|
-
}
|
|
1508
|
-
if (ext === ".rs") {
|
|
1509
|
-
return {
|
|
1510
|
-
runnerNames: ["rust-clippy"],
|
|
1511
|
-
preferredRunners: ["rust-clippy"],
|
|
1512
|
-
defaultRunner: "rust-clippy",
|
|
1513
|
-
defaultWhenUnconfigured: true,
|
|
1514
|
-
gate: "smart-default"
|
|
1515
|
-
};
|
|
1516
|
-
}
|
|
1517
|
-
if ([".sh", ".bash"].includes(ext)) {
|
|
1518
|
-
return {
|
|
1519
|
-
runnerNames: ["shellcheck"],
|
|
1520
|
-
preferredRunners: ["shellcheck"],
|
|
1521
|
-
defaultRunner: "shellcheck",
|
|
1522
|
-
defaultWhenUnconfigured: true,
|
|
1523
|
-
gate: "smart-default"
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1526
|
-
if (ext === ".fish") {
|
|
1527
|
-
return {
|
|
1528
|
-
runnerNames: ["fish-indent"],
|
|
1529
|
-
preferredRunners: ["fish-indent"],
|
|
1530
|
-
defaultRunner: "fish-indent",
|
|
1531
|
-
defaultWhenUnconfigured: true,
|
|
1532
|
-
gate: "smart-default"
|
|
1533
|
-
};
|
|
1534
|
-
}
|
|
1535
|
-
if ([".tf", ".tfvars"].includes(ext)) {
|
|
1536
|
-
return {
|
|
1537
|
-
runnerNames: ["tflint"],
|
|
1538
|
-
preferredRunners: ["tflint"],
|
|
1539
|
-
defaultRunner: "tflint",
|
|
1540
|
-
defaultWhenUnconfigured: true,
|
|
1541
|
-
gate: context.hasTflintConfig ? "config-first" : "smart-default"
|
|
1542
|
-
};
|
|
1543
|
-
}
|
|
1544
|
-
if ([".ex", ".exs", ".eex", ".heex", ".leex"].includes(ext)) {
|
|
1545
|
-
return {
|
|
1546
|
-
runnerNames: ["credo"],
|
|
1547
|
-
preferredRunners: ["credo"],
|
|
1548
|
-
defaultRunner: "credo",
|
|
1549
|
-
defaultWhenUnconfigured: true,
|
|
1550
|
-
gate: "smart-default"
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
|
-
if ([".c", ".cc", ".cpp", ".cxx", ".h", ".hpp", ".ino"].includes(ext)) {
|
|
1554
|
-
return {
|
|
1555
|
-
runnerNames: ["cpp-check"],
|
|
1556
|
-
preferredRunners: ["cpp-check"],
|
|
1557
|
-
defaultRunner: "cpp-check",
|
|
1558
|
-
defaultWhenUnconfigured: true,
|
|
1559
|
-
gate: "smart-default"
|
|
1560
|
-
};
|
|
1561
|
-
}
|
|
1562
|
-
if (ext === ".dart") {
|
|
1563
|
-
return {
|
|
1564
|
-
runnerNames: ["dart-analyze"],
|
|
1565
|
-
preferredRunners: ["dart-analyze"],
|
|
1566
|
-
defaultRunner: "dart-analyze",
|
|
1567
|
-
defaultWhenUnconfigured: true,
|
|
1568
|
-
gate: "smart-default"
|
|
1569
|
-
};
|
|
1570
|
-
}
|
|
1571
|
-
if (ext === ".gleam") {
|
|
1572
|
-
return {
|
|
1573
|
-
runnerNames: ["gleam-check"],
|
|
1574
|
-
preferredRunners: ["gleam-check"],
|
|
1575
|
-
defaultRunner: "gleam-check",
|
|
1576
|
-
defaultWhenUnconfigured: true,
|
|
1577
|
-
gate: "smart-default"
|
|
1578
|
-
};
|
|
1579
|
-
}
|
|
1580
|
-
if ([".ps1", ".psm1", ".psd1"].includes(ext)) {
|
|
1581
|
-
return {
|
|
1582
|
-
runnerNames: ["psscriptanalyzer"],
|
|
1583
|
-
preferredRunners: ["psscriptanalyzer"],
|
|
1584
|
-
defaultRunner: "psscriptanalyzer",
|
|
1585
|
-
defaultWhenUnconfigured: true,
|
|
1586
|
-
gate: "smart-default"
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
if (ext === ".prisma") {
|
|
1590
|
-
return {
|
|
1591
|
-
runnerNames: ["prisma-validate"],
|
|
1592
|
-
preferredRunners: ["prisma-validate"],
|
|
1593
|
-
defaultRunner: "prisma-validate",
|
|
1594
|
-
defaultWhenUnconfigured: true,
|
|
1595
|
-
gate: "smart-default"
|
|
1596
|
-
};
|
|
1597
|
-
}
|
|
1598
|
-
return void 0;
|
|
1599
|
-
}
|
|
1600
|
-
function getCachedProjectConventions(cwd) {
|
|
1601
|
-
const snapshot = loadProjectSnapshotWithoutWordIndex(cwd);
|
|
1602
|
-
return snapshot?.conventions;
|
|
1603
|
-
}
|
|
1604
|
-
function getLinterPolicyForCwd(filePath, cwd) {
|
|
1605
|
-
const context = {
|
|
1606
|
-
hasEslintConfig: hasEslintConfig(cwd),
|
|
1607
|
-
hasOxlintConfig: hasOxlintConfig(cwd),
|
|
1608
|
-
hasBiomeConfig: hasBiomeConfig(cwd),
|
|
1609
|
-
hasStylelintConfig: hasStylelintConfig(cwd),
|
|
1610
|
-
hasSqlfluffConfig: hasSqlfluffConfig(cwd),
|
|
1611
|
-
hasRubocopConfig: hasRubocopConfig(cwd),
|
|
1612
|
-
hasYamllintConfig: hasYamllintConfig(cwd),
|
|
1613
|
-
hasMarkdownlintConfig: hasMarkdownlintConfig(cwd),
|
|
1614
|
-
hasGolangciConfig: hasGolangciConfig(cwd),
|
|
1615
|
-
hasPhpstanConfig: hasPhpstanConfig(cwd),
|
|
1616
|
-
hasMypyConfig: hasMypyConfig(cwd),
|
|
1617
|
-
hasDetektConfig: hasDetektConfig(cwd),
|
|
1618
|
-
hasKtfmtConfig: hasKtfmtConfig(cwd),
|
|
1619
|
-
// From the file's directory, not cwd: a `.tflint.hcl` in a terraform
|
|
1620
|
-
// subdirectory is invisible to an upward walk that starts at the repo root.
|
|
1621
|
-
hasTflintConfig: hasTflintConfig(path2.dirname(path2.resolve(cwd, filePath)))
|
|
1622
|
-
};
|
|
1623
|
-
const policy = getLinterPolicyForFile(filePath, context);
|
|
1624
|
-
if (policy) {
|
|
1625
|
-
const conventions = getCachedProjectConventions(cwd);
|
|
1626
|
-
if (conventions && conventions.frameworks.length > 0) {
|
|
1627
|
-
policy.frameworkHints = conventions.frameworks.map((f) => f.id);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
logLatency({
|
|
1631
|
-
type: "phase",
|
|
1632
|
-
phase: "linter_selected",
|
|
1633
|
-
filePath,
|
|
1634
|
-
durationMs: 0,
|
|
1635
|
-
metadata: {
|
|
1636
|
-
runner: policy?.defaultRunner ?? null,
|
|
1637
|
-
gate: policy?.gate ?? null,
|
|
1638
|
-
cwd,
|
|
1639
|
-
context,
|
|
1640
|
-
frameworkHints: policy?.frameworkHints ?? null
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1643
|
-
return policy;
|
|
1644
|
-
}
|
|
1645
|
-
var ESLINT_FLAT_CONFIGS = [
|
|
1646
|
-
"eslint.config.js",
|
|
1647
|
-
"eslint.config.mjs",
|
|
1648
|
-
"eslint.config.cjs",
|
|
1649
|
-
"eslint.config.ts",
|
|
1650
|
-
"eslint.config.mts",
|
|
1651
|
-
"eslint.config.cts"
|
|
1652
|
-
];
|
|
1653
|
-
var ESLINT_LEGACY_CONFIGS = [
|
|
1654
|
-
".eslintrc",
|
|
1655
|
-
".eslintrc.js",
|
|
1656
|
-
".eslintrc.cjs",
|
|
1657
|
-
".eslintrc.json",
|
|
1658
|
-
".eslintrc.yaml",
|
|
1659
|
-
".eslintrc.yml"
|
|
1660
|
-
];
|
|
1661
|
-
function* walkUpDirsUntilPackageJson(cwd) {
|
|
1662
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1663
|
-
yield dir;
|
|
1664
|
-
if (fs3.existsSync(path2.join(dir, "package.json")))
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
function findNearestPackageJsonPath(cwd) {
|
|
1669
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1670
|
-
const pkgPath = path2.join(dir, "package.json");
|
|
1671
|
-
if (fs3.existsSync(pkgPath))
|
|
1672
|
-
return pkgPath;
|
|
1673
|
-
}
|
|
1674
|
-
return void 0;
|
|
1675
|
-
}
|
|
1676
|
-
function hasNearestPackageJsonDependency(cwd, dependencyName) {
|
|
1677
|
-
const pkgPath = findNearestPackageJsonPath(cwd);
|
|
1678
|
-
if (!pkgPath)
|
|
1679
|
-
return false;
|
|
1680
|
-
try {
|
|
1681
|
-
const pkg = JSON.parse(fs3.readFileSync(pkgPath, "utf-8"));
|
|
1682
|
-
return Boolean(pkg.dependencies?.[dependencyName] ?? pkg.devDependencies?.[dependencyName]);
|
|
1683
|
-
} catch {
|
|
1684
|
-
}
|
|
1685
|
-
return false;
|
|
1686
|
-
}
|
|
1687
|
-
function hasNearestPackageJsonField(cwd, fieldName) {
|
|
1688
|
-
const pkgPath = findNearestPackageJsonPath(cwd);
|
|
1689
|
-
if (!pkgPath)
|
|
1690
|
-
return false;
|
|
1691
|
-
try {
|
|
1692
|
-
const pkg = JSON.parse(fs3.readFileSync(pkgPath, "utf-8"));
|
|
1693
|
-
return pkg[fieldName] !== void 0;
|
|
1694
|
-
} catch {
|
|
1695
|
-
}
|
|
1696
|
-
return false;
|
|
1697
|
-
}
|
|
1698
|
-
function hasEslintConfig(cwd) {
|
|
1699
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1700
|
-
for (const cfg of ESLINT_FLAT_CONFIGS) {
|
|
1701
|
-
if (fs3.existsSync(path2.join(dir, cfg)))
|
|
1702
|
-
return true;
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
for (const dir of walkUpDirsUntilPackageJson(cwd)) {
|
|
1706
|
-
for (const cfg of ESLINT_LEGACY_CONFIGS) {
|
|
1707
|
-
if (fs3.existsSync(path2.join(dir, cfg)))
|
|
1708
|
-
return true;
|
|
1709
|
-
}
|
|
1710
|
-
const pkgPath = path2.join(dir, "package.json");
|
|
1711
|
-
if (fs3.existsSync(pkgPath)) {
|
|
1712
|
-
try {
|
|
1713
|
-
if (JSON.parse(fs3.readFileSync(pkgPath, "utf-8")).eslintConfig)
|
|
1714
|
-
return true;
|
|
1715
|
-
} catch {
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
return false;
|
|
1720
|
-
}
|
|
1721
|
-
function hasBiomeConfig(cwd) {
|
|
1722
|
-
return getBiomeConfigPath(cwd) !== void 0;
|
|
1723
|
-
}
|
|
1724
|
-
function getBiomeConfigPath(cwd) {
|
|
1725
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1726
|
-
const jsoncPath = path2.join(dir, "biome.jsonc");
|
|
1727
|
-
if (fs3.existsSync(jsoncPath))
|
|
1728
|
-
return jsoncPath;
|
|
1729
|
-
const jsonPath = path2.join(dir, "biome.json");
|
|
1730
|
-
if (fs3.existsSync(jsonPath))
|
|
1731
|
-
return jsonPath;
|
|
1732
|
-
}
|
|
1733
|
-
return void 0;
|
|
1734
|
-
}
|
|
1735
|
-
function hasOxfmtConfig(cwd) {
|
|
1736
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1737
|
-
if (fs3.existsSync(path2.join(dir, "oxfmt.toml")))
|
|
1738
|
-
return true;
|
|
1739
|
-
if (fs3.existsSync(path2.join(dir, ".oxfmtrc.json")))
|
|
1740
|
-
return true;
|
|
1741
|
-
if (hasVitePlusConfig(dir))
|
|
1742
|
-
return true;
|
|
1743
|
-
const pkgPath = path2.join(dir, "package.json");
|
|
1744
|
-
if (fs3.existsSync(pkgPath)) {
|
|
1745
|
-
try {
|
|
1746
|
-
const pkg = JSON.parse(fs3.readFileSync(pkgPath, "utf-8"));
|
|
1747
|
-
const deps = {
|
|
1748
|
-
...pkg.dependencies,
|
|
1749
|
-
...pkg.devDependencies
|
|
1750
|
-
};
|
|
1751
|
-
if (deps["oxfmt"] || deps["@oxc-project/oxfmt"])
|
|
1752
|
-
return true;
|
|
1753
|
-
} catch {
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
return false;
|
|
1758
|
-
}
|
|
1759
|
-
var OXFMT_SVELTE_TOML_TRUE = /(^|\n)\s*svelte\s*=\s*true\s*(\s*#.*)?(\r?\n|$)/;
|
|
1760
|
-
function hasOxfmtSvelteConfig(cwd) {
|
|
1761
|
-
if (!hasNearestPackageJsonDependency(cwd, "svelte"))
|
|
1762
|
-
return false;
|
|
1763
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1764
|
-
const rcPath = path2.join(dir, ".oxfmtrc.json");
|
|
1765
|
-
if (fs3.existsSync(rcPath)) {
|
|
1766
|
-
try {
|
|
1767
|
-
const cfg = JSON.parse(fs3.readFileSync(rcPath, "utf-8"));
|
|
1768
|
-
if (cfg.svelte === true)
|
|
1769
|
-
return true;
|
|
1770
|
-
} catch {
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
const tomlPath = path2.join(dir, "oxfmt.toml");
|
|
1774
|
-
if (fs3.existsSync(tomlPath)) {
|
|
1775
|
-
try {
|
|
1776
|
-
const content = fs3.readFileSync(tomlPath, "utf-8");
|
|
1777
|
-
if (OXFMT_SVELTE_TOML_TRUE.test(content))
|
|
1778
|
-
return true;
|
|
1779
|
-
} catch {
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
return false;
|
|
1784
|
-
}
|
|
1785
|
-
function hasStylelintConfig(cwd) {
|
|
1786
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1787
|
-
if (STYLELINT_CONFIGS.some((cfg) => fs3.existsSync(path2.join(dir, cfg)))) {
|
|
1788
|
-
return true;
|
|
1789
|
-
}
|
|
1790
|
-
const pkgPath = path2.join(dir, "package.json");
|
|
1791
|
-
if (fs3.existsSync(pkgPath)) {
|
|
1792
|
-
try {
|
|
1793
|
-
const pkg = JSON.parse(fs3.readFileSync(pkgPath, "utf-8"));
|
|
1794
|
-
if (pkg.stylelint)
|
|
1795
|
-
return true;
|
|
1796
|
-
} catch {
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
return false;
|
|
1801
|
-
}
|
|
1802
|
-
function hasSqlfluffConfig(cwd) {
|
|
1803
|
-
return hasToolConfig("sqlfluff", cwd);
|
|
1804
|
-
}
|
|
1805
|
-
function hasRubocopConfig(cwd) {
|
|
1806
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1807
|
-
for (const cfg of RUBOCOP_CONFIGS) {
|
|
1808
|
-
if (fs3.existsSync(path2.join(dir, cfg)))
|
|
1809
|
-
return true;
|
|
1810
|
-
}
|
|
1811
|
-
const gemfile = path2.join(dir, "Gemfile");
|
|
1812
|
-
if (fs3.existsSync(gemfile)) {
|
|
1813
|
-
try {
|
|
1814
|
-
const content = fs3.readFileSync(gemfile, "utf-8");
|
|
1815
|
-
if (content.includes("rubocop"))
|
|
1816
|
-
return true;
|
|
1817
|
-
} catch {
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
return false;
|
|
1822
|
-
}
|
|
1823
|
-
function hasMypyConfig(cwd) {
|
|
1824
|
-
return hasToolConfig("mypy", cwd);
|
|
1825
|
-
}
|
|
1826
|
-
function hasYamllintConfig(cwd) {
|
|
1827
|
-
return hasToolConfig("yamllint", cwd);
|
|
1828
|
-
}
|
|
1829
|
-
function hasMarkdownlintConfig(cwd) {
|
|
1830
|
-
return findNearestContaining(cwd, MARKDOWNLINT_CONFIGS) !== void 0;
|
|
1831
|
-
}
|
|
1832
|
-
function hasPrettierConfig(cwd) {
|
|
1833
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1834
|
-
if (PRETTIER_CONFIGS.some((cfg) => fs3.existsSync(path2.join(dir, cfg))))
|
|
1835
|
-
return true;
|
|
1836
|
-
const pkgPath = path2.join(dir, "package.json");
|
|
1837
|
-
if (fs3.existsSync(pkgPath)) {
|
|
1838
|
-
try {
|
|
1839
|
-
const pkg = JSON.parse(fs3.readFileSync(pkgPath, "utf-8"));
|
|
1840
|
-
if (Object.hasOwn(pkg, "prettier"))
|
|
1841
|
-
return true;
|
|
1842
|
-
} catch {
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
return false;
|
|
1847
|
-
}
|
|
1848
|
-
function hasBlackConfig(cwd) {
|
|
1849
|
-
return hasToolConfig("black", cwd);
|
|
1850
|
-
}
|
|
1851
|
-
function hasRuffConfig(cwd) {
|
|
1852
|
-
return hasToolConfig("ruff", cwd);
|
|
1853
|
-
}
|
|
1854
|
-
function configArgsWithFallback(hasConfig, toolArgs, packageConfigPath) {
|
|
1855
|
-
return hasConfig ? [] : [...toolArgs, resolvePackagePath(import.meta.url, packageConfigPath)];
|
|
1856
|
-
}
|
|
1857
|
-
function markdownlintConfigArgs(cwd) {
|
|
1858
|
-
return configArgsWithFallback(hasMarkdownlintConfig(cwd), ["--config"], "config/markdownlint/core.json");
|
|
1859
|
-
}
|
|
1860
|
-
function ruffConfigArgs(cwd) {
|
|
1861
|
-
return configArgsWithFallback(hasRuffConfig(cwd), ["--config"], "config/ruff/core.toml");
|
|
1862
|
-
}
|
|
1863
|
-
function biomeConfigArgs(cwd) {
|
|
1864
|
-
if (getBiomeConfigPath(cwd))
|
|
1865
|
-
return [];
|
|
1866
|
-
return [
|
|
1867
|
-
"--config-path=" + resolvePackagePath(import.meta.url, "config/biome/core.jsonc")
|
|
1868
|
-
];
|
|
1869
|
-
}
|
|
1870
|
-
function hasGolangciConfig(cwd) {
|
|
1871
|
-
return findNearestContaining(cwd, GOLANGCI_CONFIGS) !== void 0;
|
|
1872
|
-
}
|
|
1873
|
-
function hasTflintConfig(startDir) {
|
|
1874
|
-
return hasToolConfig("tflint", startDir);
|
|
1875
|
-
}
|
|
1876
|
-
function hasClangFormatConfig(cwd) {
|
|
1877
|
-
return findNearestContaining(cwd, [".clang-format", "_clang-format"]) !== void 0;
|
|
1878
|
-
}
|
|
1879
|
-
function hasPhpCsFixerConfig(cwd) {
|
|
1880
|
-
return findNearestContaining(cwd, [
|
|
1881
|
-
".php-cs-fixer.php",
|
|
1882
|
-
".php-cs-fixer.dist.php"
|
|
1883
|
-
]) !== void 0;
|
|
1884
|
-
}
|
|
1885
|
-
function hasStyluaConfig(cwd) {
|
|
1886
|
-
return findNearestContaining(cwd, ["stylua.toml", ".stylua.toml"]) !== void 0;
|
|
1887
|
-
}
|
|
1888
|
-
function hasOcamlformatConfig(cwd) {
|
|
1889
|
-
return findNearestContaining(cwd, [".ocamlformat"]) !== void 0;
|
|
1890
|
-
}
|
|
1891
|
-
function hasGoogleJavaFormatConfig(cwd) {
|
|
1892
|
-
return findNearestContaining(cwd, [".google-java-format", ".editorconfig"]) !== void 0;
|
|
1893
|
-
}
|
|
1894
|
-
function hasCljfmtConfig(cwd) {
|
|
1895
|
-
return findNearestContaining(cwd, [".cljfmt.edn", "cljfmt.edn", ".cljfmt"]) !== void 0;
|
|
1896
|
-
}
|
|
1897
|
-
function hasCmakeFormatConfig(cwd) {
|
|
1898
|
-
return findNearestContaining(cwd, [
|
|
1899
|
-
".cmake-format",
|
|
1900
|
-
".cmake-format.yaml",
|
|
1901
|
-
".cmake-format.yml",
|
|
1902
|
-
".cmake-format.json",
|
|
1903
|
-
".cmake-format.py",
|
|
1904
|
-
"cmake-format.yaml",
|
|
1905
|
-
"cmake-format.yml"
|
|
1906
|
-
]) !== void 0;
|
|
1907
|
-
}
|
|
1908
|
-
var PSSCRIPTANALYZER_SETTINGS_FILES = [
|
|
1909
|
-
"PSScriptAnalyzerSettings.psd1",
|
|
1910
|
-
"ScriptAnalyzerSettings.psd1"
|
|
1911
|
-
];
|
|
1912
|
-
function findPSScriptAnalyzerConfigPath(cwd) {
|
|
1913
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1914
|
-
for (const name of PSSCRIPTANALYZER_SETTINGS_FILES) {
|
|
1915
|
-
const candidate = path2.join(dir, name);
|
|
1916
|
-
if (fs3.existsSync(candidate))
|
|
1917
|
-
return candidate;
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
return void 0;
|
|
1921
|
-
}
|
|
1922
|
-
function hasPSScriptAnalyzerConfig(cwd) {
|
|
1923
|
-
return findPSScriptAnalyzerConfigPath(cwd) !== void 0;
|
|
1924
|
-
}
|
|
1925
|
-
function hasCsharpierConfig(cwd) {
|
|
1926
|
-
return findNearestContaining(cwd, [
|
|
1927
|
-
".csharpierrc",
|
|
1928
|
-
".csharpierrc.json",
|
|
1929
|
-
".csharpierrc.yaml",
|
|
1930
|
-
".csharpierrc.yml"
|
|
1931
|
-
]) !== void 0;
|
|
1932
|
-
}
|
|
1933
|
-
function hasOrmoluConfig(cwd) {
|
|
1934
|
-
return findNearestContaining(cwd, [".ormolu"]) !== void 0;
|
|
1935
|
-
}
|
|
1936
|
-
function hasTaploConfig(cwd) {
|
|
1937
|
-
return findNearestContaining(cwd, ["taplo.toml", ".taplo.toml"]) !== void 0;
|
|
1938
|
-
}
|
|
1939
|
-
function hasTerraformConfig(cwd) {
|
|
1940
|
-
return findNearestContaining(cwd, [".terraform.lock.hcl"]) !== void 0;
|
|
1941
|
-
}
|
|
1942
|
-
function hasSwiftformatConfig(cwd) {
|
|
1943
|
-
return findNearestContaining(cwd, [".swiftformat"]) !== void 0;
|
|
1944
|
-
}
|
|
1945
|
-
function hasFantomasConfig(cwd) {
|
|
1946
|
-
return findNearestContaining(cwd, [".fantomasignore", ".editorconfig"]) !== void 0;
|
|
1947
|
-
}
|
|
1948
|
-
function hasMixFormatConfig(cwd) {
|
|
1949
|
-
return findNearestContaining(cwd, [".formatter.exs"]) !== void 0;
|
|
1950
|
-
}
|
|
1951
|
-
function hasPhpstanConfig(cwd) {
|
|
1952
|
-
return findNearestContaining(cwd, PHPSTAN_CONFIGS) !== void 0;
|
|
1953
|
-
}
|
|
1954
|
-
function hasDetektConfig(cwd) {
|
|
1955
|
-
return hasToolConfig("detekt", cwd);
|
|
1956
|
-
}
|
|
1957
|
-
var KTFMT_CONFIG_FILES = [".ktfmt", ".ktfmt.kts"];
|
|
1958
|
-
var KTFMT_GRADLE_FILES = [
|
|
1959
|
-
"build.gradle.kts",
|
|
1960
|
-
"build.gradle",
|
|
1961
|
-
"settings.gradle.kts",
|
|
1962
|
-
"settings.gradle"
|
|
1963
|
-
];
|
|
1964
|
-
var KOTLIN_GRADLE_FILES = [
|
|
1965
|
-
"build.gradle.kts",
|
|
1966
|
-
"build.gradle",
|
|
1967
|
-
"settings.gradle.kts",
|
|
1968
|
-
"settings.gradle"
|
|
1969
|
-
];
|
|
1970
|
-
var GRADLE_KTLINT_PLUGIN_PATTERN = /(?:id\s*\(\s*|id\s+|apply\s+plugin\s*:\s*)["']org\.jlleitschuh\.gradle\.ktlint["']/g;
|
|
1971
|
-
var GRADLE_BUILD_LOGIC_DIRS = ["buildSrc", "build-logic"];
|
|
1972
|
-
var GRADLE_BUILD_LOGIC_EXTENSIONS = [".gradle", ".gradle.kts", ".kt"];
|
|
1973
|
-
var GRADLE_INCLUDE_BUILD_PATTERN = /\bincludeBuild\s*\(\s*["']([^"']+)["']/g;
|
|
1974
|
-
var GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES = 1e4;
|
|
1975
|
-
var spotlessKotlinConfigCache = /* @__PURE__ */ new Map();
|
|
1976
|
-
var spotlessGradleReadCount = 0;
|
|
1977
|
-
function stripGradleCommentsAndStrings(source) {
|
|
1978
|
-
let result = "";
|
|
1979
|
-
let state = "code";
|
|
1980
|
-
let quote = "";
|
|
1981
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
1982
|
-
const char = source[index];
|
|
1983
|
-
const next = source[index + 1];
|
|
1984
|
-
if (state === "code") {
|
|
1985
|
-
if (char === "/" && next === "/") {
|
|
1986
|
-
result += " ";
|
|
1987
|
-
index += 1;
|
|
1988
|
-
state = "line-comment";
|
|
1989
|
-
} else if (char === "/" && next === "*") {
|
|
1990
|
-
result += " ";
|
|
1991
|
-
index += 1;
|
|
1992
|
-
state = "block-comment";
|
|
1993
|
-
} else if (char === '"' || char === "'") {
|
|
1994
|
-
result += " ";
|
|
1995
|
-
quote = char;
|
|
1996
|
-
state = "string";
|
|
1997
|
-
} else {
|
|
1998
|
-
result += char;
|
|
1999
|
-
}
|
|
2000
|
-
continue;
|
|
2001
|
-
}
|
|
2002
|
-
if (state === "line-comment") {
|
|
2003
|
-
if (char === "\n" || char === "\r") {
|
|
2004
|
-
result += char;
|
|
2005
|
-
state = "code";
|
|
2006
|
-
} else {
|
|
2007
|
-
result += " ";
|
|
2008
|
-
}
|
|
2009
|
-
continue;
|
|
2010
|
-
}
|
|
2011
|
-
if (state === "block-comment") {
|
|
2012
|
-
if (char === "*" && next === "/") {
|
|
2013
|
-
result += " ";
|
|
2014
|
-
index += 1;
|
|
2015
|
-
state = "code";
|
|
2016
|
-
} else {
|
|
2017
|
-
result += char === "\n" || char === "\r" ? char : " ";
|
|
2018
|
-
}
|
|
2019
|
-
continue;
|
|
2020
|
-
}
|
|
2021
|
-
if (char === "\\") {
|
|
2022
|
-
result += " ";
|
|
2023
|
-
if (index + 1 < source.length) {
|
|
2024
|
-
result += source[index + 1] === "\n" ? "\n" : " ";
|
|
2025
|
-
index += 1;
|
|
2026
|
-
}
|
|
2027
|
-
} else if (char === quote) {
|
|
2028
|
-
result += " ";
|
|
2029
|
-
state = "code";
|
|
2030
|
-
} else {
|
|
2031
|
-
result += char === "\n" || char === "\r" ? char : " ";
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
return result;
|
|
2035
|
-
}
|
|
2036
|
-
var GRADLE_IDENTIFIER_CHAR = /[A-Za-z0-9_$]/;
|
|
2037
|
-
function gradleBlockNameBefore(source, open) {
|
|
2038
|
-
let index = open - 1;
|
|
2039
|
-
while (index >= 0 && /\s/.test(source[index]))
|
|
2040
|
-
index -= 1;
|
|
2041
|
-
const end = index + 1;
|
|
2042
|
-
while (index >= 0 && GRADLE_IDENTIFIER_CHAR.test(source[index]))
|
|
2043
|
-
index -= 1;
|
|
2044
|
-
return source.slice(index + 1, end);
|
|
2045
|
-
}
|
|
2046
|
-
function gradleBlockRanges(source) {
|
|
2047
|
-
const ranges = [];
|
|
2048
|
-
const opens = [];
|
|
2049
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
2050
|
-
const char = source[index];
|
|
2051
|
-
if (char === "{") {
|
|
2052
|
-
opens.push(index);
|
|
2053
|
-
continue;
|
|
2054
|
-
}
|
|
2055
|
-
if (char !== "}")
|
|
2056
|
-
continue;
|
|
2057
|
-
const open = opens.pop();
|
|
2058
|
-
if (open === void 0)
|
|
2059
|
-
continue;
|
|
2060
|
-
ranges.push({
|
|
2061
|
-
name: gradleBlockNameBefore(source, open),
|
|
2062
|
-
start: open + 1,
|
|
2063
|
-
end: index
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
return ranges.sort((a, b) => a.start - b.start);
|
|
2067
|
-
}
|
|
2068
|
-
function namedGradleBlockRanges(source, name) {
|
|
2069
|
-
return gradleBlockRanges(source).filter((range) => range.name === name);
|
|
2070
|
-
}
|
|
2071
|
-
function namedGradleBlockBodies(source, name) {
|
|
2072
|
-
return namedGradleBlockRanges(source, name).map((range) => source.slice(range.start, range.end));
|
|
2073
|
-
}
|
|
2074
|
-
function getSpotlessKotlinFormatter(cwd) {
|
|
2075
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2076
|
-
for (const gradle of KOTLIN_GRADLE_FILES) {
|
|
2077
|
-
const filePath = path2.join(dir, gradle);
|
|
2078
|
-
if (!fs3.existsSync(filePath))
|
|
2079
|
-
continue;
|
|
2080
|
-
try {
|
|
2081
|
-
const mtime = fs3.statSync(filePath).mtimeMs;
|
|
2082
|
-
let config = spotlessKotlinConfigCache.get(filePath);
|
|
2083
|
-
if (!config || config.mtime !== mtime) {
|
|
2084
|
-
const source = stripGradleCommentsAndStrings(fs3.readFileSync(filePath, "utf-8"));
|
|
2085
|
-
spotlessGradleReadCount += 1;
|
|
2086
|
-
const kotlinBodies = namedGradleBlockBodies(source, "spotless").flatMap((spotless) => namedGradleBlockBodies(spotless, "kotlin"));
|
|
2087
|
-
config = {
|
|
2088
|
-
mtime,
|
|
2089
|
-
ktlintConfig: kotlinBodies.some((body) => /\bktlint\s*\(/.test(body)),
|
|
2090
|
-
ktfmtConfig: kotlinBodies.some((body) => /\bktfmt\s*\(/.test(body))
|
|
2091
|
-
};
|
|
2092
|
-
spotlessKotlinConfigCache.set(filePath, config);
|
|
2093
|
-
}
|
|
2094
|
-
if (config.ktlintConfig)
|
|
2095
|
-
return "ktlint";
|
|
2096
|
-
if (config.ktfmtConfig)
|
|
2097
|
-
return "ktfmt";
|
|
2098
|
-
} catch {
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
return void 0;
|
|
2103
|
-
}
|
|
2104
|
-
function hasKtlintConfig(cwd) {
|
|
2105
|
-
return getSpotlessKotlinFormatter(cwd) === "ktlint";
|
|
2106
|
-
}
|
|
2107
|
-
function hasGradleKtlintPlugin(cwd) {
|
|
2108
|
-
const files = /* @__PURE__ */ new Set();
|
|
2109
|
-
const scan = { entries: 0, exceeded: false, indeterminate: false };
|
|
2110
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2111
|
-
for (const gradle of KOTLIN_GRADLE_FILES) {
|
|
2112
|
-
const filePath = path2.join(dir, gradle);
|
|
2113
|
-
if (fs3.existsSync(filePath))
|
|
2114
|
-
files.add(filePath);
|
|
2115
|
-
}
|
|
2116
|
-
for (const buildLogicDir of GRADLE_BUILD_LOGIC_DIRS) {
|
|
2117
|
-
if (!addGradleBuildLogicFiles(path2.join(dir, buildLogicDir), files, scan)) {
|
|
2118
|
-
scan.exceeded = true;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
for (const settings of ["settings.gradle.kts", "settings.gradle"]) {
|
|
2122
|
-
const settingsPath = path2.join(dir, settings);
|
|
2123
|
-
if (!fs3.existsSync(settingsPath))
|
|
2124
|
-
continue;
|
|
2125
|
-
try {
|
|
2126
|
-
const raw = fs3.readFileSync(settingsPath, "utf-8");
|
|
2127
|
-
const stripped = stripGradleCommentsAndStrings(raw);
|
|
2128
|
-
GRADLE_INCLUDE_BUILD_PATTERN.lastIndex = 0;
|
|
2129
|
-
let match;
|
|
2130
|
-
while ((match = GRADLE_INCLUDE_BUILD_PATTERN.exec(raw)) !== null) {
|
|
2131
|
-
const code = stripped.slice(match.index, match.index + match[0].length);
|
|
2132
|
-
const includedBuild = match[1];
|
|
2133
|
-
if (includedBuild && /^\s*includeBuild\s*\(\s*/.test(code)) {
|
|
2134
|
-
if (!addGradleBuildLogicFiles(path2.resolve(dir, includedBuild), files, scan)) {
|
|
2135
|
-
scan.exceeded = true;
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
} catch {
|
|
2140
|
-
scan.indeterminate = true;
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
if (scan.exceeded) {
|
|
2145
|
-
recordDegradationOnce({
|
|
2146
|
-
kind: "gradle-ktlint-scan-budget-exceeded",
|
|
2147
|
-
subject: "ktlint:gradle-build-logic",
|
|
2148
|
-
reason: `Gradle build-logic ownership scan exceeded its ${GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES}-entry budget; ownership cannot be established, so ktlint autofix is declined`
|
|
2149
|
-
});
|
|
2150
|
-
return { kind: "indeterminate" };
|
|
2151
|
-
}
|
|
2152
|
-
if (scan.indeterminate)
|
|
2153
|
-
return { kind: "indeterminate" };
|
|
2154
|
-
for (const filePath of files) {
|
|
2155
|
-
try {
|
|
2156
|
-
const raw = fs3.readFileSync(filePath, "utf-8");
|
|
2157
|
-
const stripped = stripGradleCommentsAndStrings(raw);
|
|
2158
|
-
GRADLE_KTLINT_PLUGIN_PATTERN.lastIndex = 0;
|
|
2159
|
-
let match;
|
|
2160
|
-
while ((match = GRADLE_KTLINT_PLUGIN_PATTERN.exec(raw)) !== null) {
|
|
2161
|
-
const code = stripped.slice(match.index, match.index + match[0].length);
|
|
2162
|
-
if (!/^\s*$/.test(code))
|
|
2163
|
-
return { kind: "owned" };
|
|
2164
|
-
}
|
|
2165
|
-
} catch {
|
|
2166
|
-
return { kind: "indeterminate" };
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
return { kind: "not-owned" };
|
|
2170
|
-
}
|
|
2171
|
-
function addGradleBuildLogicFiles(root, files, scan) {
|
|
2172
|
-
if (!fs3.existsSync(root))
|
|
2173
|
-
return true;
|
|
2174
|
-
const pending = [root];
|
|
2175
|
-
while (pending.length > 0) {
|
|
2176
|
-
const dir = pending.pop();
|
|
2177
|
-
if (!dir)
|
|
2178
|
-
continue;
|
|
2179
|
-
let entries;
|
|
2180
|
-
try {
|
|
2181
|
-
entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
2182
|
-
} catch {
|
|
2183
|
-
scan.indeterminate = true;
|
|
2184
|
-
continue;
|
|
2185
|
-
}
|
|
2186
|
-
for (const entry of entries) {
|
|
2187
|
-
scan.entries += 1;
|
|
2188
|
-
if (scan.entries > GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES)
|
|
2189
|
-
return false;
|
|
2190
|
-
const entryPath = path2.join(dir, entry.name);
|
|
2191
|
-
if (entry.isDirectory()) {
|
|
2192
|
-
pending.push(entryPath);
|
|
2193
|
-
} else if (entry.isFile() && GRADLE_BUILD_LOGIC_EXTENSIONS.some((extension) => entry.name.endsWith(extension))) {
|
|
2194
|
-
files.add(entryPath);
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
return true;
|
|
2199
|
-
}
|
|
2200
|
-
function hasKtfmtConfig(cwd) {
|
|
2201
|
-
const spotlessFormatter = getSpotlessKotlinFormatter(cwd);
|
|
2202
|
-
if (spotlessFormatter)
|
|
2203
|
-
return spotlessFormatter === "ktfmt";
|
|
2204
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2205
|
-
if (KTFMT_CONFIG_FILES.some((cfg) => fs3.existsSync(path2.join(dir, cfg))))
|
|
2206
|
-
return true;
|
|
2207
|
-
for (const gradle of KTFMT_GRADLE_FILES) {
|
|
2208
|
-
const p = path2.join(dir, gradle);
|
|
2209
|
-
if (fs3.existsSync(p)) {
|
|
2210
|
-
try {
|
|
2211
|
-
if (/ktfmt|com\.facebook\.ktfmt/i.test(fs3.readFileSync(p, "utf-8")))
|
|
2212
|
-
return true;
|
|
2213
|
-
} catch {
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
return false;
|
|
2219
|
-
}
|
|
2220
|
-
var JAVA_BUILD_DESCRIPTORS = [
|
|
2221
|
-
"pom.xml",
|
|
2222
|
-
"build.gradle",
|
|
2223
|
-
"build.gradle.kts",
|
|
2224
|
-
"settings.gradle",
|
|
2225
|
-
"settings.gradle.kts"
|
|
2226
|
-
];
|
|
2227
|
-
var COMPILED_CLASSES_DIRS = [
|
|
2228
|
-
path2.join("target", "classes"),
|
|
2229
|
-
path2.join("build", "classes"),
|
|
2230
|
-
path2.join("out", "production"),
|
|
2231
|
-
path2.join("bin", "main")
|
|
2232
|
-
];
|
|
2233
|
-
function hasJavaBuildDescriptor(cwd, ceiling) {
|
|
2234
|
-
const normalizedCeiling = ceiling ? normalizeMapKey(path2.resolve(ceiling)) : void 0;
|
|
2235
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2236
|
-
if (JAVA_BUILD_DESCRIPTORS.some((d) => fs3.existsSync(path2.join(dir, d))))
|
|
2237
|
-
return true;
|
|
2238
|
-
if (normalizedCeiling && normalizeMapKey(path2.resolve(dir)) === normalizedCeiling)
|
|
2239
|
-
break;
|
|
2240
|
-
}
|
|
2241
|
-
return false;
|
|
2242
|
-
}
|
|
2243
|
-
function findCompiledClassesDir(cwd) {
|
|
2244
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2245
|
-
for (const rel of COMPILED_CLASSES_DIRS) {
|
|
2246
|
-
const candidate = path2.join(dir, rel);
|
|
2247
|
-
if (fs3.existsSync(candidate))
|
|
2248
|
-
return candidate;
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
return void 0;
|
|
2252
|
-
}
|
|
2253
|
-
function hasStandardrbConfig(cwd) {
|
|
2254
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2255
|
-
const gemfile = path2.join(dir, "Gemfile");
|
|
2256
|
-
if (fs3.existsSync(gemfile)) {
|
|
2257
|
-
try {
|
|
2258
|
-
if (fs3.readFileSync(gemfile, "utf-8").includes("standard"))
|
|
2259
|
-
return true;
|
|
2260
|
-
} catch {
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
return false;
|
|
2265
|
-
}
|
|
2266
|
-
function getRubocopCommand(cwd) {
|
|
2267
|
-
const gemfile = path2.join(cwd, "Gemfile");
|
|
2268
|
-
if (fs3.existsSync(gemfile)) {
|
|
2269
|
-
try {
|
|
2270
|
-
const content = fs3.readFileSync(gemfile, "utf-8");
|
|
2271
|
-
if (content.includes("rubocop")) {
|
|
2272
|
-
return { cmd: "bundle", args: ["exec", "rubocop"] };
|
|
2273
|
-
}
|
|
2274
|
-
} catch {
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
return { cmd: "rubocop", args: [] };
|
|
2278
|
-
}
|
|
2279
|
-
function hasVitePlusConfig(cwd) {
|
|
2280
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2281
|
-
if (fs3.existsSync(path2.join(dir, "vite-plus.json")))
|
|
2282
|
-
return true;
|
|
2283
|
-
const pkgPath = path2.join(dir, "package.json");
|
|
2284
|
-
if (fs3.existsSync(pkgPath)) {
|
|
2285
|
-
try {
|
|
2286
|
-
const pkg = JSON.parse(fs3.readFileSync(pkgPath, "utf-8"));
|
|
2287
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
2288
|
-
if (deps["vite-plus"] || deps["@voidzero-dev/vite-plus-core"]) {
|
|
2289
|
-
return true;
|
|
2290
|
-
}
|
|
2291
|
-
} catch {
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
for (const cfg of VITE_CONFIGS) {
|
|
2295
|
-
const cfgPath = path2.join(dir, cfg);
|
|
2296
|
-
if (!fs3.existsSync(cfgPath))
|
|
2297
|
-
continue;
|
|
2298
|
-
try {
|
|
2299
|
-
const content = fs3.readFileSync(cfgPath, "utf-8");
|
|
2300
|
-
if (content.includes("vite-plus"))
|
|
2301
|
-
return true;
|
|
2302
|
-
} catch {
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
|
-
return false;
|
|
2307
|
-
}
|
|
2308
|
-
var OXLINT_CONFIGS = [
|
|
2309
|
-
".oxlintrc.json",
|
|
2310
|
-
".oxlintrc.jsonc",
|
|
2311
|
-
"oxlint.json",
|
|
2312
|
-
"oxlint.config.ts",
|
|
2313
|
-
"oxlint.config.mts"
|
|
2314
|
-
];
|
|
2315
|
-
function hasOxlintConfig(cwd) {
|
|
2316
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2317
|
-
for (const cfg of OXLINT_CONFIGS) {
|
|
2318
|
-
if (fs3.existsSync(path2.join(dir, cfg)))
|
|
2319
|
-
return true;
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
return hasVitePlusConfig(cwd);
|
|
2323
|
-
}
|
|
2324
|
-
function getPreferredJstsLintRunners(context) {
|
|
2325
|
-
if (context.hasEslintConfig)
|
|
2326
|
-
return ["eslint"];
|
|
2327
|
-
if (context.hasOxlintConfig)
|
|
2328
|
-
return ["oxlint"];
|
|
2329
|
-
if (context.hasBiomeConfig)
|
|
2330
|
-
return ["biome-check-json"];
|
|
2331
|
-
return ["oxlint", "biome-check-json"];
|
|
2332
|
-
}
|
|
2333
|
-
function getJstsLintPolicy(context) {
|
|
2334
|
-
const hasEslint = !!context.hasEslintConfig;
|
|
2335
|
-
const hasOxlint = !!context.hasOxlintConfig;
|
|
2336
|
-
const hasBiome = !!context.hasBiomeConfig;
|
|
2337
|
-
return {
|
|
2338
|
-
hasEslintConfig: hasEslint,
|
|
2339
|
-
hasOxlintConfig: hasOxlint,
|
|
2340
|
-
hasBiomeConfig: hasBiome,
|
|
2341
|
-
preferredRunners: getPreferredJstsLintRunners({
|
|
2342
|
-
hasEslintConfig: hasEslint,
|
|
2343
|
-
hasOxlintConfig: hasOxlint,
|
|
2344
|
-
hasBiomeConfig: hasBiome
|
|
2345
|
-
}),
|
|
2346
|
-
hasExplicitNonBiomeLinter: hasEslint || hasOxlint
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2349
|
-
function getJstsLintPolicyForCwd(cwd) {
|
|
2350
|
-
return getJstsLintPolicy({
|
|
2351
|
-
hasEslintConfig: hasEslintConfig(cwd),
|
|
2352
|
-
hasOxlintConfig: hasOxlintConfig(cwd),
|
|
2353
|
-
hasBiomeConfig: hasBiomeConfig(cwd)
|
|
2354
|
-
});
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
|
-
export {
|
|
2358
|
-
readFileContent,
|
|
2359
|
-
findToolConfig,
|
|
2360
|
-
hasToolConfig,
|
|
2361
|
-
OXFMT_SUPPORTED_EXTENSIONS,
|
|
2362
|
-
getFormatterPolicyForFile,
|
|
2363
|
-
getSmartDefaultFormatterName,
|
|
2364
|
-
getAutoInstallToolIdForFormatter,
|
|
2365
|
-
shouldAutoInstallTool,
|
|
2366
|
-
getAutofixCapability,
|
|
2367
|
-
getToolCommandSpec,
|
|
2368
|
-
getLinterPolicyForCwd,
|
|
2369
|
-
hasNearestPackageJsonDependency,
|
|
2370
|
-
hasNearestPackageJsonField,
|
|
2371
|
-
hasEslintConfig,
|
|
2372
|
-
hasBiomeConfig,
|
|
2373
|
-
hasOxfmtConfig,
|
|
2374
|
-
hasOxfmtSvelteConfig,
|
|
2375
|
-
hasStylelintConfig,
|
|
2376
|
-
hasSqlfluffConfig,
|
|
2377
|
-
hasRubocopConfig,
|
|
2378
|
-
hasMypyConfig,
|
|
2379
|
-
hasYamllintConfig,
|
|
2380
|
-
hasMarkdownlintConfig,
|
|
2381
|
-
hasPrettierConfig,
|
|
2382
|
-
hasBlackConfig,
|
|
2383
|
-
hasRuffConfig,
|
|
2384
|
-
markdownlintConfigArgs,
|
|
2385
|
-
ruffConfigArgs,
|
|
2386
|
-
biomeConfigArgs,
|
|
2387
|
-
hasGolangciConfig,
|
|
2388
|
-
hasClangFormatConfig,
|
|
2389
|
-
hasPhpCsFixerConfig,
|
|
2390
|
-
hasStyluaConfig,
|
|
2391
|
-
hasOcamlformatConfig,
|
|
2392
|
-
hasGoogleJavaFormatConfig,
|
|
2393
|
-
hasCljfmtConfig,
|
|
2394
|
-
hasCmakeFormatConfig,
|
|
2395
|
-
findPSScriptAnalyzerConfigPath,
|
|
2396
|
-
hasPSScriptAnalyzerConfig,
|
|
2397
|
-
hasCsharpierConfig,
|
|
2398
|
-
hasOrmoluConfig,
|
|
2399
|
-
hasTaploConfig,
|
|
2400
|
-
hasTerraformConfig,
|
|
2401
|
-
hasSwiftformatConfig,
|
|
2402
|
-
hasFantomasConfig,
|
|
2403
|
-
hasMixFormatConfig,
|
|
2404
|
-
hasPhpstanConfig,
|
|
2405
|
-
hasDetektConfig,
|
|
2406
|
-
stripGradleCommentsAndStrings,
|
|
2407
|
-
gradleBlockRanges,
|
|
2408
|
-
hasKtlintConfig,
|
|
2409
|
-
hasGradleKtlintPlugin,
|
|
2410
|
-
hasKtfmtConfig,
|
|
2411
|
-
hasJavaBuildDescriptor,
|
|
2412
|
-
findCompiledClassesDir,
|
|
2413
|
-
hasStandardrbConfig,
|
|
2414
|
-
getRubocopCommand,
|
|
2415
|
-
hasVitePlusConfig,
|
|
2416
|
-
getJstsLintPolicyForCwd
|
|
2417
|
-
};
|