@herbertgao/pi-extensions 2026.10.1 → 2026.10.2
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/README.md +13 -9
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-audit.md +2 -2
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +2 -2
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-gain.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-help.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-review.md +2 -2
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail.md +1 -1
- package/node_modules/@dietrichgebert/ponytail/.qoder/rules/ponytail.md +21 -21
- package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +1 -1
- package/node_modules/@dietrichgebert/ponytail/AGENTS.md +21 -21
- package/node_modules/@dietrichgebert/ponytail/README.md +68 -72
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +7 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-instructions.js +30 -30
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-map.js +103 -0
- package/node_modules/@dietrichgebert/ponytail/package.json +2 -2
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail/SKILL.md +33 -101
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-audit/SKILL.md +89 -32
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +13 -12
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-gain/SKILL.md +17 -16
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-help/SKILL.md +9 -10
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-review/SKILL.md +96 -57
- package/node_modules/@herbertgao/pi-agency/LICENSE +21 -0
- package/node_modules/@herbertgao/pi-agency/README.md +40 -0
- package/node_modules/@herbertgao/pi-agency/package.json +53 -0
- package/node_modules/@herbertgao/pi-agency/src/index.ts +441 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +12 -12
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +30 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +15 -9
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +27 -9
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +2 -2
- package/node_modules/@narumitw/pi-caffeinate/package.json +3 -3
- package/node_modules/@tifan/pi-mermaid-open/package.json +5 -1
- package/node_modules/@tifan/pi-mermaid-open/src/index.ts +26 -9
- package/node_modules/@tifan/pi-recap/package.json +1 -1
- package/node_modules/@tifan/pi-recap/src/index.ts +104 -20
- package/node_modules/@tifan/pi-recap/src/models.ts +46 -4
- package/node_modules/pi-antigravity/README.md +23 -2
- package/node_modules/pi-antigravity/package.json +5 -3
- package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +3 -2
- package/node_modules/pi-antigravity/src/features/generate-image.ts +72 -0
- package/node_modules/pi-antigravity/src/features/google-search.ts +71 -0
- package/node_modules/pi-antigravity/src/image/image.ts +86 -47
- package/node_modules/pi-antigravity/src/image/native.ts +69 -0
- package/node_modules/pi-antigravity/src/index.ts +52 -137
- package/node_modules/pi-antigravity/src/search/search.ts +130 -31
- package/node_modules/pi-antigravity/src/stream/stream.ts +162 -113
- package/node_modules/pi-antigravity/src/types/enums.ts +1 -0
- package/node_modules/pi-antigravity/src/types/types.ts +1 -1
- package/node_modules/pi-antigravity/src/utils/security.ts +47 -1
- package/node_modules/pi-antigravity/src/utils/util.ts +38 -6
- package/node_modules/pi-lens/CHANGELOG.md +1064 -0
- package/node_modules/pi-lens/README.md +115 -25
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +6 -2
- package/node_modules/pi-lens/dist/chunk-22AVIGXS.js +560 -0
- package/node_modules/pi-lens/dist/chunk-27BBHSZC.js +106 -0
- package/node_modules/pi-lens/dist/chunk-2BEMIWEW.js +51 -0
- package/node_modules/pi-lens/dist/chunk-2EECBNC5.js +89 -0
- package/node_modules/pi-lens/dist/chunk-34U7PLGE.js +23 -0
- package/node_modules/pi-lens/dist/chunk-3I5QFT3N.js +181 -0
- package/node_modules/pi-lens/dist/chunk-3MED75HT.js +37 -0
- package/node_modules/pi-lens/dist/chunk-47D2BO4S.js +87 -0
- package/node_modules/pi-lens/dist/chunk-4RERDEXR.js +348 -0
- package/node_modules/pi-lens/dist/chunk-4W2PLC4J.js +27 -0
- package/node_modules/pi-lens/dist/chunk-52H5B5TC.js +202 -0
- package/node_modules/pi-lens/dist/chunk-54B42YRX.js +27 -0
- package/node_modules/pi-lens/dist/chunk-5RXBNSW2.js +266 -0
- package/node_modules/pi-lens/dist/chunk-5THXD6X5.js +201 -0
- package/node_modules/pi-lens/dist/chunk-5W3R6LFT.js +24 -0
- package/node_modules/pi-lens/dist/chunk-5ZEJHV35.js +341 -0
- package/node_modules/pi-lens/dist/chunk-6P62QVEA.js +118 -0
- package/node_modules/pi-lens/dist/chunk-6QIUX4EP.js +459 -0
- package/node_modules/pi-lens/dist/chunk-6VCD4VKZ.js +78 -0
- package/node_modules/pi-lens/dist/chunk-7F72PXY2.js +326 -0
- package/node_modules/pi-lens/dist/chunk-7FBF7NPR.js +998 -0
- package/node_modules/pi-lens/dist/chunk-7U2IDNXN.js +37 -0
- package/node_modules/pi-lens/dist/chunk-ABBOA7UD.js +157 -0
- package/node_modules/pi-lens/dist/chunk-AHDW3GPE.js +50 -0
- package/node_modules/pi-lens/dist/chunk-AJ3QXTRQ.js +756 -0
- package/node_modules/pi-lens/dist/chunk-AJVLWNFN.js +1610 -0
- package/node_modules/pi-lens/dist/chunk-AJXODZY6.js +112 -0
- package/node_modules/pi-lens/dist/chunk-ARFCXG7S.js +84 -0
- package/node_modules/pi-lens/dist/chunk-AS44CFQ4.js +708 -0
- package/node_modules/pi-lens/dist/chunk-AWE5TMPO.js +38 -0
- package/node_modules/pi-lens/dist/chunk-B3I2UUT4.js +4692 -0
- package/node_modules/pi-lens/dist/chunk-BRJKOBZP.js +331 -0
- package/node_modules/pi-lens/dist/chunk-BW5KFIQC.js +59 -0
- package/node_modules/pi-lens/dist/chunk-C2AUYXQH.js +149 -0
- package/node_modules/pi-lens/dist/chunk-CGGAIP7J.js +29 -0
- package/node_modules/pi-lens/dist/chunk-D6QS3U6M.js +30 -0
- package/node_modules/pi-lens/dist/chunk-DFVMIKMQ.js +349 -0
- package/node_modules/pi-lens/dist/chunk-DIULIWKU.js +169 -0
- package/node_modules/pi-lens/dist/chunk-DQ2NZ7C4.js +2317 -0
- package/node_modules/pi-lens/dist/chunk-E2WFBRHM.js +213 -0
- package/node_modules/pi-lens/dist/chunk-E4MAEDPM.js +50 -0
- package/node_modules/pi-lens/dist/chunk-EOKRQ3SA.js +30 -0
- package/node_modules/pi-lens/dist/chunk-F3AU2TMM.js +2626 -0
- package/node_modules/pi-lens/dist/chunk-F3P7VQ7H.js +170 -0
- package/node_modules/pi-lens/dist/chunk-FC4RP4I2.js +12 -0
- package/node_modules/pi-lens/dist/chunk-FJNKANOS.js +32 -0
- package/node_modules/pi-lens/dist/chunk-GUOGVTCQ.js +146 -0
- package/node_modules/pi-lens/dist/chunk-GVXA6CCE.js +18 -0
- package/node_modules/pi-lens/dist/chunk-HHYAELLJ.js +2334 -0
- package/node_modules/pi-lens/dist/chunk-HMFXILPV.js +83 -0
- package/node_modules/pi-lens/dist/chunk-HVUZXSWK.js +421 -0
- package/node_modules/pi-lens/dist/chunk-HWBZIGMJ.js +62 -0
- package/node_modules/pi-lens/dist/chunk-I3R7GKDR.js +17 -0
- package/node_modules/pi-lens/dist/chunk-I7SPGOWI.js +55 -0
- package/node_modules/pi-lens/dist/chunk-IIXOAGHR.js +38 -0
- package/node_modules/pi-lens/dist/chunk-IVP5KAB7.js +2250 -0
- package/node_modules/pi-lens/dist/chunk-IXEBJSUE.js +22 -0
- package/node_modules/pi-lens/dist/chunk-JOLITGCC.js +27 -0
- package/node_modules/pi-lens/dist/chunk-K6VYLB2U.js +145 -0
- package/node_modules/pi-lens/dist/chunk-LJDODBBZ.js +78 -0
- package/node_modules/pi-lens/dist/chunk-LNAKEO63.js +78 -0
- package/node_modules/pi-lens/dist/chunk-LSMJ6KBE.js +4139 -0
- package/node_modules/pi-lens/dist/chunk-LW6XKDZQ.js +5565 -0
- package/node_modules/pi-lens/dist/chunk-N3YQJI6O.js +899 -0
- package/node_modules/pi-lens/dist/chunk-NABLC7W3.js +148 -0
- package/node_modules/pi-lens/dist/chunk-NKOUFPQF.js +659 -0
- package/node_modules/pi-lens/dist/chunk-NL5GLMFI.js +211 -0
- package/node_modules/pi-lens/dist/chunk-NMABWBZN.js +327 -0
- package/node_modules/pi-lens/dist/chunk-NTHH2J74.js +27 -0
- package/node_modules/pi-lens/dist/chunk-NTUJEGDZ.js +59 -0
- package/node_modules/pi-lens/dist/chunk-NXL4FFQQ.js +47 -0
- package/node_modules/pi-lens/dist/chunk-NXPS2L6U.js +466 -0
- package/node_modules/pi-lens/dist/chunk-O5WILGMI.js +42 -0
- package/node_modules/pi-lens/dist/chunk-O6TQT6RI.js +48 -0
- package/node_modules/pi-lens/dist/chunk-OAXNDZJ7.js +323 -0
- package/node_modules/pi-lens/dist/chunk-ODEEOXPH.js +44 -0
- package/node_modules/pi-lens/dist/chunk-OQGFCZJ4.js +4533 -0
- package/node_modules/pi-lens/dist/chunk-ORTMY4Q4.js +282 -0
- package/node_modules/pi-lens/dist/chunk-OS32RNR2.js +442 -0
- package/node_modules/pi-lens/dist/chunk-PAK6IDME.js +189 -0
- package/node_modules/pi-lens/dist/chunk-PWFHBTSF.js +406 -0
- package/node_modules/pi-lens/dist/chunk-Q5U6FMDI.js +2352 -0
- package/node_modules/pi-lens/dist/chunk-QOZXJ4NA.js +3364 -0
- package/node_modules/pi-lens/dist/chunk-QYF5S6P6.js +45 -0
- package/node_modules/pi-lens/dist/chunk-RIISMHKN.js +36 -0
- package/node_modules/pi-lens/dist/chunk-RPD4ZSB7.js +25 -0
- package/node_modules/pi-lens/dist/chunk-RPD5K5NC.js +79 -0
- package/node_modules/pi-lens/dist/chunk-RUOG5D2C.js +262 -0
- package/node_modules/pi-lens/dist/chunk-T4ERT73Y.js +599 -0
- package/node_modules/pi-lens/dist/chunk-T6D4Q4AQ.js +54 -0
- package/node_modules/pi-lens/dist/chunk-TGPXLY2J.js +391 -0
- package/node_modules/pi-lens/dist/chunk-TLGFBM3F.js +12116 -0
- package/node_modules/pi-lens/dist/chunk-TO6WL3GM.js +88 -0
- package/node_modules/pi-lens/dist/chunk-TT22N74J.js +517 -0
- package/node_modules/pi-lens/dist/chunk-TVN5N6GY.js +21216 -0
- package/node_modules/pi-lens/dist/chunk-U3VGR4VU.js +308 -0
- package/node_modules/pi-lens/dist/chunk-UK3CMEAL.js +1250 -0
- package/node_modules/pi-lens/dist/chunk-UOPVJQ4N.js +103 -0
- package/node_modules/pi-lens/dist/chunk-UXVNL3D7.js +23 -0
- package/node_modules/pi-lens/dist/chunk-UY752QSN.js +45 -0
- package/node_modules/pi-lens/dist/chunk-V5PXFSZK.js +188 -0
- package/node_modules/pi-lens/dist/chunk-V7R425XG.js +398 -0
- package/node_modules/pi-lens/dist/chunk-VCSRSYLF.js +81 -0
- package/node_modules/pi-lens/dist/chunk-VD4JQCQC.js +162 -0
- package/node_modules/pi-lens/dist/chunk-VDBPVIKD.js +62 -0
- package/node_modules/pi-lens/dist/chunk-VHQLPIRJ.js +114 -0
- package/node_modules/pi-lens/dist/chunk-VN2AXLEX.js +5414 -0
- package/node_modules/pi-lens/dist/chunk-VNMT7C64.js +478 -0
- package/node_modules/pi-lens/dist/chunk-WONERJTP.js +309 -0
- package/node_modules/pi-lens/dist/chunk-XECLWQZN.js +85 -0
- package/node_modules/pi-lens/dist/chunk-XIMYZ3JA.js +27 -0
- package/node_modules/pi-lens/dist/chunk-XK4CIILI.js +144 -0
- package/node_modules/pi-lens/dist/chunk-Y4T27COV.js +562 -0
- package/node_modules/pi-lens/dist/chunk-YGVYKNSN.js +1860 -0
- package/node_modules/pi-lens/dist/chunk-YLF3PPT5.js +308 -0
- package/node_modules/pi-lens/dist/chunk-YSNFMJKN.js +14 -0
- package/node_modules/pi-lens/dist/chunk-Z3CCVDUB.js +76 -0
- package/node_modules/pi-lens/dist/chunk-Z54ZSOBZ.js +61 -0
- package/node_modules/pi-lens/dist/chunk-ZAWW3AF6.js +97 -0
- package/node_modules/pi-lens/dist/chunk-ZMOL6RQC.js +167 -0
- package/node_modules/pi-lens/dist/index.js +16456 -8335
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +186 -232
- package/node_modules/pi-lens/dist/mcp/cli.js +137 -98
- package/node_modules/pi-lens/dist/mcp/server.js +22589 -1573
- package/node_modules/pi-lens/dist/mcp/worker.js +97 -38
- package/node_modules/pi-lens/dist/probes/installer.js +135 -0
- package/node_modules/pi-lens/dist/workers/project-snapshot-persist-worker.js +22 -0
- package/node_modules/pi-lens/dist/workers/review-graph-persist-worker.js +15 -0
- package/node_modules/pi-lens/docs/agent-guide.md +13 -4
- package/node_modules/pi-lens/docs/agent-tools.md +42 -0
- package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +3 -2
- package/node_modules/pi-lens/docs/configuration.md +20 -1
- package/node_modules/pi-lens/docs/environment-variables.md +52 -2
- package/node_modules/pi-lens/docs/features.md +8 -4
- package/node_modules/pi-lens/docs/globalconfig.md +1 -0
- package/node_modules/pi-lens/docs/io-bridge-v2-migration.md +94 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +36 -4
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +124 -0
- package/node_modules/pi-lens/docs/mcp.md +21 -5
- package/node_modules/pi-lens/docs/merge-queue-rollout.md +77 -0
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +156 -88
- package/node_modules/pi-lens/docs/pi-lens-investigator.md +74 -26
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +694 -0
- package/node_modules/pi-lens/docs/pi-lens-monitor.md +73 -7
- package/node_modules/pi-lens/docs/pi-lens-retro.md +6 -4
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +188 -48
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +246 -45
- package/node_modules/pi-lens/docs/pi-lens-warden.md +18 -7
- package/node_modules/pi-lens/docs/public-api-stability.md +55 -0
- package/node_modules/pi-lens/docs/release-qa-baseline.md +84 -17
- package/node_modules/pi-lens/docs/rfcs/3654-unified-io-bridge-v2.md +316 -0
- package/node_modules/pi-lens/docs/servercapabilities.md +53 -49
- package/node_modules/pi-lens/docs/settings.md +1 -0
- package/node_modules/pi-lens/docs/usage.md +5 -1
- package/node_modules/pi-lens/grammars/tree-sitter-bash.wasm +0 -0
- package/node_modules/pi-lens/grammars/tree-sitter-bash.wasm.json +3 -3
- package/node_modules/pi-lens/package.json +18 -6
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/advisory-registry-subset-test.yml +41 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/advisory-registry-subset.yml +50 -0
- package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +1275 -62
- package/node_modules/pi-lens/scripts/download-grammars.js +5 -0
- package/node_modules/pi-lens/scripts/grammars.lock.json +6 -1
- package/node_modules/pi-lens/scripts/install-selftest.mjs +33 -34
- package/node_modules/pi-lens/scripts/lib/host-provided-deps.mjs +13 -4
- package/node_modules/pi-lens/scripts/lib/web-tree-sitter-dir.mjs +18 -0
- package/package.json +15 -10
- package/node_modules/@dietrichgebert/ponytail/README.es.md +0 -212
- package/node_modules/@dietrichgebert/ponytail/README.ja.md +0 -212
- package/node_modules/@dietrichgebert/ponytail/README.ko.md +0 -212
- package/node_modules/@dietrichgebert/ponytail/README.zh-CN.md +0 -212
- package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +0 -35
- package/node_modules/pi-lens/dist/clients/actionable-warnings.js +0 -1610
- package/node_modules/pi-lens/dist/clients/advisory-provenance.js +0 -593
- package/node_modules/pi-lens/dist/clients/agent-behavior-client.js +0 -147
- package/node_modules/pi-lens/dist/clients/agent-nudge.js +0 -325
- package/node_modules/pi-lens/dist/clients/analysed-root.js +0 -1
- package/node_modules/pi-lens/dist/clients/ast-grep-client.js +0 -731
- package/node_modules/pi-lens/dist/clients/ast-grep-rule-manager.js +0 -146
- package/node_modules/pi-lens/dist/clients/ast-grep-tool-logger.js +0 -118
- package/node_modules/pi-lens/dist/clients/ast-grep-types.js +0 -10
- package/node_modules/pi-lens/dist/clients/ast-grep-yaml-synth.js +0 -154
- package/node_modules/pi-lens/dist/clients/atomic-write-staging.js +0 -75
- package/node_modules/pi-lens/dist/clients/atomic-write.js +0 -189
- package/node_modules/pi-lens/dist/clients/availability-probe-flight.js +0 -12
- package/node_modules/pi-lens/dist/clients/bash-file-access.js +0 -1056
- package/node_modules/pi-lens/dist/clients/biome-client.js +0 -357
- package/node_modules/pi-lens/dist/clients/blocker-freshness.js +0 -837
- package/node_modules/pi-lens/dist/clients/blocker-past-eof.js +0 -129
- package/node_modules/pi-lens/dist/clients/bootstrap.js +0 -569
- package/node_modules/pi-lens/dist/clients/bounded-cache.js +0 -190
- package/node_modules/pi-lens/dist/clients/bounded-pid-file-lock.js +0 -202
- package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +0 -295
- package/node_modules/pi-lens/dist/clients/build-identity.js +0 -95
- package/node_modules/pi-lens/dist/clients/bundled-resource-health.js +0 -113
- package/node_modules/pi-lens/dist/clients/bus-events-logger.js +0 -105
- package/node_modules/pi-lens/dist/clients/bus-publish.js +0 -171
- package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +0 -190
- package/node_modules/pi-lens/dist/clients/cache-manager.js +0 -524
- package/node_modules/pi-lens/dist/clients/cache-observability.js +0 -1313
- package/node_modules/pi-lens/dist/clients/call-graph.js +0 -852
- package/node_modules/pi-lens/dist/clients/cargo-manifest.js +0 -422
- package/node_modules/pi-lens/dist/clients/cascade-budget.js +0 -196
- package/node_modules/pi-lens/dist/clients/cascade-format.js +0 -315
- package/node_modules/pi-lens/dist/clients/cascade-logger.js +0 -31
- package/node_modules/pi-lens/dist/clients/cascade-types.js +0 -9
- package/node_modules/pi-lens/dist/clients/child-unref.js +0 -124
- package/node_modules/pi-lens/dist/clients/code-quality-warnings.js +0 -286
- package/node_modules/pi-lens/dist/clients/codebase-model.js +0 -173
- package/node_modules/pi-lens/dist/clients/collateral-test-role.js +0 -40
- package/node_modules/pi-lens/dist/clients/complexity-client.js +0 -462
- package/node_modules/pi-lens/dist/clients/config-core/deny.js +0 -221
- package/node_modules/pi-lens/dist/clients/config-core/index.js +0 -50
- package/node_modules/pi-lens/dist/clients/config-core/merge.js +0 -357
- package/node_modules/pi-lens/dist/clients/config-core/normalize.js +0 -340
- package/node_modules/pi-lens/dist/clients/config-core/process-spec.js +0 -248
- package/node_modules/pi-lens/dist/clients/config-core/provenance.js +0 -164
- package/node_modules/pi-lens/dist/clients/config-core/records.js +0 -218
- package/node_modules/pi-lens/dist/clients/config-core/resolve.js +0 -125
- package/node_modules/pi-lens/dist/clients/config-core/safe-object.js +0 -78
- package/node_modules/pi-lens/dist/clients/config-core/schema.js +0 -165
- package/node_modules/pi-lens/dist/clients/config-diagnostic-codes.js +0 -285
- package/node_modules/pi-lens/dist/clients/config-locations.js +0 -388
- package/node_modules/pi-lens/dist/clients/config-resolve.js +0 -798
- package/node_modules/pi-lens/dist/clients/config-schema.js +0 -251
- package/node_modules/pi-lens/dist/clients/config-warn.js +0 -407
- package/node_modules/pi-lens/dist/clients/console-guard-install.js +0 -26
- package/node_modules/pi-lens/dist/clients/cooperative-budget.js +0 -42
- package/node_modules/pi-lens/dist/clients/dead-code-client.js +0 -510
- package/node_modules/pi-lens/dist/clients/dead-code-logger.js +0 -30
- package/node_modules/pi-lens/dist/clients/deadline-utils.js +0 -280
- package/node_modules/pi-lens/dist/clients/debug-handles.js +0 -211
- package/node_modules/pi-lens/dist/clients/debug-heap.js +0 -174
- package/node_modules/pi-lens/dist/clients/deferred-lsp-work.js +0 -106
- package/node_modules/pi-lens/dist/clients/degradation-ledger.js +0 -426
- package/node_modules/pi-lens/dist/clients/demoted-finding-render.js +0 -169
- package/node_modules/pi-lens/dist/clients/dependency-checker.js +0 -885
- package/node_modules/pi-lens/dist/clients/deps/ast-grep-napi.js +0 -22
- package/node_modules/pi-lens/dist/clients/deps/js-yaml.js +0 -9
- package/node_modules/pi-lens/dist/clients/deps/minimatch.js +0 -4
- package/node_modules/pi-lens/dist/clients/deps/pi-tui.js +0 -14
- package/node_modules/pi-lens/dist/clients/deps/typebox.js +0 -14
- package/node_modules/pi-lens/dist/clients/deps/vscode-jsonrpc.js +0 -1
- package/node_modules/pi-lens/dist/clients/deps/web-tree-sitter.js +0 -24
- package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +0 -630
- package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +0 -305
- package/node_modules/pi-lens/dist/clients/diagnostic-logger.js +0 -73
- package/node_modules/pi-lens/dist/clients/diagnostic-tracker.js +0 -105
- package/node_modules/pi-lens/dist/clients/diagnostics-publish.js +0 -230
- package/node_modules/pi-lens/dist/clients/dispatch/ast-grep-catalog.js +0 -65
- package/node_modules/pi-lens/dist/clients/dispatch/auxiliary-lsp.js +0 -343
- package/node_modules/pi-lens/dist/clients/dispatch/collect-later-tier.js +0 -35
- package/node_modules/pi-lens/dist/clients/dispatch/diagnostic-taxonomy.js +0 -66
- package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +0 -1269
- package/node_modules/pi-lens/dist/clients/dispatch/fact-provider-types.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/fact-rule-runner.js +0 -17
- package/node_modules/pi-lens/dist/clients/dispatch/fact-runner.js +0 -30
- package/node_modules/pi-lens/dist/clients/dispatch/fact-scheduler.js +0 -68
- package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +0 -377
- package/node_modules/pi-lens/dist/clients/dispatch/facts/comment-facts.js +0 -22
- package/node_modules/pi-lens/dist/clients/dispatch/facts/file-content.js +0 -19
- package/node_modules/pi-lens/dist/clients/dispatch/facts/function-facts.js +0 -348
- package/node_modules/pi-lens/dist/clients/dispatch/facts/import-facts.js +0 -204
- package/node_modules/pi-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +0 -34
- package/node_modules/pi-lens/dist/clients/dispatch/facts/try-catch-facts.js +0 -119
- package/node_modules/pi-lens/dist/clients/dispatch/finding-policy.js +0 -339
- package/node_modules/pi-lens/dist/clients/dispatch/indent-detect.js +0 -417
- package/node_modules/pi-lens/dist/clients/dispatch/inline-suppressions.js +0 -89
- package/node_modules/pi-lens/dist/clients/dispatch/integration.js +0 -2377
- package/node_modules/pi-lens/dist/clients/dispatch/lazy.js +0 -11
- package/node_modules/pi-lens/dist/clients/dispatch/pending-runner-findings.js +0 -87
- package/node_modules/pi-lens/dist/clients/dispatch/plan.js +0 -278
- package/node_modules/pi-lens/dist/clients/dispatch/priorities.js +0 -20
- package/node_modules/pi-lens/dist/clients/dispatch/rule-id-normalize.js +0 -50
- package/node_modules/pi-lens/dist/clients/dispatch/rule-ignores.js +0 -69
- package/node_modules/pi-lens/dist/clients/dispatch/rule-policy.js +0 -135
- package/node_modules/pi-lens/dist/clients/dispatch/rules/async-noise.js +0 -40
- package/node_modules/pi-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +0 -27
- package/node_modules/pi-lens/dist/clients/dispatch/rules/cors-wildcard.js +0 -54
- package/node_modules/pi-lens/dist/clients/dispatch/rules/error-obscuring.js +0 -32
- package/node_modules/pi-lens/dist/clients/dispatch/rules/error-swallowing.js +0 -31
- package/node_modules/pi-lens/dist/clients/dispatch/rules/framework-call-noise.js +0 -67
- package/node_modules/pi-lens/dist/clients/dispatch/rules/high-complexity.js +0 -72
- package/node_modules/pi-lens/dist/clients/dispatch/rules/high-fan-out.js +0 -74
- package/node_modules/pi-lens/dist/clients/dispatch/rules/high-import-coupling.js +0 -37
- package/node_modules/pi-lens/dist/clients/dispatch/rules/missing-error-propagation.js +0 -62
- package/node_modules/pi-lens/dist/clients/dispatch/rules/no-commented-credentials.js +0 -52
- package/node_modules/pi-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +0 -42
- package/node_modules/pi-lens/dist/clients/dispatch/rules/placeholder-comments.js +0 -40
- package/node_modules/pi-lens/dist/clients/dispatch/rules/unsafe-boundary.js +0 -126
- package/node_modules/pi-lens/dist/clients/dispatch/runner-context.js +0 -52
- package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +0 -111
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +0 -1196
- package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +0 -296
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +0 -219
- package/node_modules/pi-lens/dist/clients/dispatch/runners/credo.js +0 -82
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cue-vet.js +0 -416
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -183
- package/node_modules/pi-lens/dist/clients/dispatch/runners/detekt.js +0 -176
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -164
- package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +0 -195
- package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +0 -137
- package/node_modules/pi-lens/dist/clients/dispatch/runners/fact-rules.js +0 -29
- package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +0 -69
- package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +0 -167
- package/node_modules/pi-lens/dist/clients/dispatch/runners/go-vet.js +0 -104
- package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -135
- package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +0 -91
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +0 -171
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +0 -940
- package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +0 -117
- package/node_modules/pi-lens/dist/clients/dispatch/runners/index.js +0 -108
- package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +0 -99
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +0 -110
- package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +0 -379
- package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +0 -167
- package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +0 -102
- package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +0 -414
- package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +0 -85
- package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +0 -120
- package/node_modules/pi-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -62
- package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -445
- package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +0 -169
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rubocop.js +0 -99
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ruff.js +0 -88
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +0 -256
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +0 -173
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +0 -102
- package/node_modules/pi-lens/dist/clients/dispatch/runners/spellcheck.js +0 -128
- package/node_modules/pi-lens/dist/clients/dispatch/runners/spotbugs.js +0 -259
- package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -183
- package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +0 -166
- package/node_modules/pi-lens/dist/clients/dispatch/runners/swiftlint.js +0 -163
- package/node_modules/pi-lens/dist/clients/dispatch/runners/taplo.js +0 -174
- package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +0 -168
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +0 -125
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -643
- package/node_modules/pi-lens/dist/clients/dispatch/runners/trivy-config.js +0 -253
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/availability-policy.js +0 -496
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +0 -90
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -95
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +0 -274
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +0 -1701
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +0 -101
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/tool-failure.js +0 -235
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +0 -169
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils.js +0 -15
- package/node_modules/pi-lens/dist/clients/dispatch/runners/vale.js +0 -128
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +0 -242
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +0 -95
- package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +0 -79
- package/node_modules/pi-lens/dist/clients/dispatch/suppress-writer.js +0 -79
- package/node_modules/pi-lens/dist/clients/dispatch/tool-profile.js +0 -30
- package/node_modules/pi-lens/dist/clients/dispatch/types.js +0 -21
- package/node_modules/pi-lens/dist/clients/dispatch/utils/format-utils.js +0 -45
- package/node_modules/pi-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +0 -35
- package/node_modules/pi-lens/dist/clients/disposition-logger.js +0 -32
- package/node_modules/pi-lens/dist/clients/disposition-publish.js +0 -124
- package/node_modules/pi-lens/dist/clients/durable-store.js +0 -97
- package/node_modules/pi-lens/dist/clients/effective-config.js +0 -415
- package/node_modules/pi-lens/dist/clients/env-utils.js +0 -83
- package/node_modules/pi-lens/dist/clients/error-class.js +0 -23
- package/node_modules/pi-lens/dist/clients/eval-timestamp.js +0 -17
- package/node_modules/pi-lens/dist/clients/event-loop-hold.js +0 -274
- package/node_modules/pi-lens/dist/clients/event-loop-monitor.js +0 -250
- package/node_modules/pi-lens/dist/clients/extension-log.js +0 -504
- package/node_modules/pi-lens/dist/clients/extension-mode.js +0 -73
- package/node_modules/pi-lens/dist/clients/feature-hints.js +0 -103
- package/node_modules/pi-lens/dist/clients/file-kinds.js +0 -412
- package/node_modules/pi-lens/dist/clients/file-role.js +0 -134
- package/node_modules/pi-lens/dist/clients/file-time.js +0 -160
- package/node_modules/pi-lens/dist/clients/file-utils.js +0 -1032
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +0 -494
- package/node_modules/pi-lens/dist/clients/finding-identity.js +0 -88
- package/node_modules/pi-lens/dist/clients/fix-worklog.js +0 -103
- package/node_modules/pi-lens/dist/clients/format-events-publish.js +0 -343
- package/node_modules/pi-lens/dist/clients/format-service.js +0 -222
- package/node_modules/pi-lens/dist/clients/formatters-lazy.js +0 -9
- package/node_modules/pi-lens/dist/clients/formatters.js +0 -2032
- package/node_modules/pi-lens/dist/clients/freshness-cadence.js +0 -17
- package/node_modules/pi-lens/dist/clients/freshness.js +0 -38
- package/node_modules/pi-lens/dist/clients/generated-artifacts.js +0 -394
- package/node_modules/pi-lens/dist/clients/generation-guard.js +0 -215
- package/node_modules/pi-lens/dist/clients/git-guard.js +0 -1136
- package/node_modules/pi-lens/dist/clients/git-tracked-ignore.js +0 -243
- package/node_modules/pi-lens/dist/clients/gitleaks-client.js +0 -509
- package/node_modules/pi-lens/dist/clients/go-client.js +0 -104
- package/node_modules/pi-lens/dist/clients/govulncheck-client.js +0 -605
- package/node_modules/pi-lens/dist/clients/gradle-ktfmt-style.js +0 -348
- package/node_modules/pi-lens/dist/clients/grammar-source.js +0 -465
- package/node_modules/pi-lens/dist/clients/gzip-stage-write.js +0 -135
- package/node_modules/pi-lens/dist/clients/hashline-anchor.js +0 -424
- package/node_modules/pi-lens/dist/clients/hook-budgets.js +0 -76
- package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +0 -140
- package/node_modules/pi-lens/dist/clients/host-ports.js +0 -39
- package/node_modules/pi-lens/dist/clients/indent-retarget.js +0 -154
- package/node_modules/pi-lens/dist/clients/inline-blocker-dispositions.js +0 -186
- package/node_modules/pi-lens/dist/clients/install-diagnostics.js +0 -156
- package/node_modules/pi-lens/dist/clients/installer/index.js +0 -5416
- package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh-session.js +0 -58
- package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh.js +0 -783
- package/node_modules/pi-lens/dist/clients/instance-reaper-state.js +0 -7
- package/node_modules/pi-lens/dist/clients/instance-reaper.js +0 -1137
- package/node_modules/pi-lens/dist/clients/instance-registry-lock.js +0 -145
- package/node_modules/pi-lens/dist/clients/instance-registry.js +0 -773
- package/node_modules/pi-lens/dist/clients/jscpd-client.js +0 -378
- package/node_modules/pi-lens/dist/clients/json-cache-read.js +0 -65
- package/node_modules/pi-lens/dist/clients/knip-client.js +0 -788
- package/node_modules/pi-lens/dist/clients/language-policy.js +0 -252
- package/node_modules/pi-lens/dist/clients/language-profile.js +0 -361
- package/node_modules/pi-lens/dist/clients/language-registry.js +0 -603
- package/node_modules/pi-lens/dist/clients/latency-logger.js +0 -727
- package/node_modules/pi-lens/dist/clients/lazy-import.js +0 -21
- package/node_modules/pi-lens/dist/clients/ledger-bounds.js +0 -54
- package/node_modules/pi-lens/dist/clients/lens-config.js +0 -404
- package/node_modules/pi-lens/dist/clients/lens-engine.js +0 -358
- package/node_modules/pi-lens/dist/clients/lens-events.js +0 -125
- package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +0 -467
- package/node_modules/pi-lens/dist/clients/lens-map.js +0 -1156
- package/node_modules/pi-lens/dist/clients/live-bus-emitter.js +0 -74
- package/node_modules/pi-lens/dist/clients/log-cleanup.js +0 -222
- package/node_modules/pi-lens/dist/clients/lsp/aggregation.js +0 -178
- package/node_modules/pi-lens/dist/clients/lsp/cascade-tier.js +0 -421
- package/node_modules/pi-lens/dist/clients/lsp/client.js +0 -4593
- package/node_modules/pi-lens/dist/clients/lsp/config.js +0 -691
- package/node_modules/pi-lens/dist/clients/lsp/content-limits.js +0 -41
- package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +0 -225
- package/node_modules/pi-lens/dist/clients/lsp/document-drift.js +0 -467
- package/node_modules/pi-lens/dist/clients/lsp/edits.js +0 -1219
- package/node_modules/pi-lens/dist/clients/lsp/index.js +0 -8305
- package/node_modules/pi-lens/dist/clients/lsp/inferred-project.js +0 -216
- package/node_modules/pi-lens/dist/clients/lsp/jvm-runtime.js +0 -298
- package/node_modules/pi-lens/dist/clients/lsp/language.js +0 -63
- package/node_modules/pi-lens/dist/clients/lsp/launch.js +0 -746
- package/node_modules/pi-lens/dist/clients/lsp/lombok.js +0 -158
- package/node_modules/pi-lens/dist/clients/lsp/path-utils.js +0 -5
- package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +0 -251
- package/node_modules/pi-lens/dist/clients/lsp/position-encoding.js +0 -61
- package/node_modules/pi-lens/dist/clients/lsp/ruby-drive-dirs.js +0 -83
- package/node_modules/pi-lens/dist/clients/lsp/server.js +0 -3290
- package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +0 -192
- package/node_modules/pi-lens/dist/clients/lsp/spawn-history.js +0 -17
- package/node_modules/pi-lens/dist/clients/lsp/sync-kind.js +0 -56
- package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +0 -332
- package/node_modules/pi-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +0 -1
- package/node_modules/pi-lens/dist/clients/lsp/wait-policy/classification.js +0 -85
- package/node_modules/pi-lens/dist/clients/lsp/wait-policy/index.js +0 -10
- package/node_modules/pi-lens/dist/clients/lsp/wait-policy/strategies.js +0 -392
- package/node_modules/pi-lens/dist/clients/lsp/watch-queue.js +0 -61
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +0 -639
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-session.js +0 -30
- package/node_modules/pi-lens/dist/clients/lsp/workspace-sweep-hold.js +0 -184
- package/node_modules/pi-lens/dist/clients/lsp-budget.js +0 -186
- package/node_modules/pi-lens/dist/clients/lsp-document-symbols.js +0 -110
- package/node_modules/pi-lens/dist/clients/lsp-lazy.js +0 -9
- package/node_modules/pi-lens/dist/clients/lsp-mutation.js +0 -396
- package/node_modules/pi-lens/dist/clients/lsp-status.js +0 -59
- package/node_modules/pi-lens/dist/clients/map-with-concurrency.js +0 -40
- package/node_modules/pi-lens/dist/clients/mcp/analyze.js +0 -420
- package/node_modules/pi-lens/dist/clients/mcp/host-shim.js +0 -31
- package/node_modules/pi-lens/dist/clients/mcp/ipc.js +0 -523
- package/node_modules/pi-lens/dist/clients/mcp/review.js +0 -197
- package/node_modules/pi-lens/dist/clients/mcp/session.js +0 -412
- package/node_modules/pi-lens/dist/clients/memory-sampler.js +0 -208
- package/node_modules/pi-lens/dist/clients/message-end-attribution.js +0 -30
- package/node_modules/pi-lens/dist/clients/metrics-client.js +0 -107
- package/node_modules/pi-lens/dist/clients/metrics-history.js +0 -327
- package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +0 -263
- package/node_modules/pi-lens/dist/clients/model-provider.js +0 -53
- package/node_modules/pi-lens/dist/clients/module-report-lsp.js +0 -189
- package/node_modules/pi-lens/dist/clients/module-report.js +0 -2150
- package/node_modules/pi-lens/dist/clients/mutating-tool.js +0 -651
- package/node_modules/pi-lens/dist/clients/mutation-attribution.js +0 -368
- package/node_modules/pi-lens/dist/clients/mutation-bridge.js +0 -240
- package/node_modules/pi-lens/dist/clients/ndjson-logger.js +0 -734
- package/node_modules/pi-lens/dist/clients/observed-mutation-sources.js +0 -101
- package/node_modules/pi-lens/dist/clients/observed-mutation.js +0 -1253
- package/node_modules/pi-lens/dist/clients/oldtext-autopatch.js +0 -128
- package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +0 -496
- package/node_modules/pi-lens/dist/clients/opengrep-client.js +0 -333
- package/node_modules/pi-lens/dist/clients/opengrep-config.js +0 -76
- package/node_modules/pi-lens/dist/clients/package-manager.js +0 -607
- package/node_modules/pi-lens/dist/clients/package-root.js +0 -38
- package/node_modules/pi-lens/dist/clients/partial-edit-apply.js +0 -439
- package/node_modules/pi-lens/dist/clients/path-attribution-telemetry.js +0 -43
- package/node_modules/pi-lens/dist/clients/path-keyed-map.js +0 -108
- package/node_modules/pi-lens/dist/clients/path-utils.js +0 -1244
- package/node_modules/pi-lens/dist/clients/performance-report.js +0 -331
- package/node_modules/pi-lens/dist/clients/persist-debounce.js +0 -70
- package/node_modules/pi-lens/dist/clients/persistent-reverify.js +0 -271
- package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +0 -119
- package/node_modules/pi-lens/dist/clients/pipeline.js +0 -1480
- package/node_modules/pi-lens/dist/clients/post-autofix-notice.js +0 -37
- package/node_modules/pi-lens/dist/clients/print-mode.js +0 -21
- package/node_modules/pi-lens/dist/clients/probe-home-state.js +0 -228
- package/node_modules/pi-lens/dist/clients/process-bridge.js +0 -66
- package/node_modules/pi-lens/dist/clients/process-singletons.js +0 -210
- package/node_modules/pi-lens/dist/clients/process-snapshot.js +0 -68
- package/node_modules/pi-lens/dist/clients/project-changes.js +0 -181
- package/node_modules/pi-lens/dist/clients/project-conventions.js +0 -171
- package/node_modules/pi-lens/dist/clients/project-diagnostics/cache.js +0 -137
- package/node_modules/pi-lens/dist/clients/project-diagnostics/extractors.js +0 -109
- package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +0 -668
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +0 -118
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +0 -47
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +0 -40
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +0 -34
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +0 -38
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +0 -47
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +0 -48
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +0 -40
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +0 -127
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +0 -81
- package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +0 -520
- package/node_modules/pi-lens/dist/clients/project-diagnostics/types.js +0 -1
- package/node_modules/pi-lens/dist/clients/project-lens-config.js +0 -807
- package/node_modules/pi-lens/dist/clients/project-report.js +0 -701
- package/node_modules/pi-lens/dist/clients/project-scale.js +0 -237
- package/node_modules/pi-lens/dist/clients/project-scan-policy.js +0 -11
- package/node_modules/pi-lens/dist/clients/project-snapshot-fingerprint.js +0 -48
- package/node_modules/pi-lens/dist/clients/project-snapshot-persist-worker.js +0 -20
- package/node_modules/pi-lens/dist/clients/project-snapshot.js +0 -1653
- package/node_modules/pi-lens/dist/clients/project-trust.js +0 -181
- package/node_modules/pi-lens/dist/clients/python-environment.js +0 -217
- package/node_modules/pi-lens/dist/clients/python-provenance.js +0 -639
- package/node_modules/pi-lens/dist/clients/quiet-window-config.js +0 -47
- package/node_modules/pi-lens/dist/clients/quiet-window.js +0 -236
- package/node_modules/pi-lens/dist/clients/read-bridge.js +0 -139
- package/node_modules/pi-lens/dist/clients/read-expansion.js +0 -266
- package/node_modules/pi-lens/dist/clients/read-guard-logger.js +0 -251
- package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +0 -1306
- package/node_modules/pi-lens/dist/clients/read-guard.js +0 -1561
- package/node_modules/pi-lens/dist/clients/recent-touches.js +0 -240
- package/node_modules/pi-lens/dist/clients/redact/secrets.js +0 -449
- package/node_modules/pi-lens/dist/clients/resource-sampler.js +0 -628
- package/node_modules/pi-lens/dist/clients/reverse-deps.js +0 -270
- package/node_modules/pi-lens/dist/clients/review-graph/builder.js +0 -5126
- package/node_modules/pi-lens/dist/clients/review-graph/format.js +0 -33
- package/node_modules/pi-lens/dist/clients/review-graph/git-identity.js +0 -163
- package/node_modules/pi-lens/dist/clients/review-graph/import-resolvers.js +0 -481
- package/node_modules/pi-lens/dist/clients/review-graph/persist-worker.js +0 -10
- package/node_modules/pi-lens/dist/clients/review-graph/query.js +0 -244
- package/node_modules/pi-lens/dist/clients/review-graph/revision-drift.js +0 -21
- package/node_modules/pi-lens/dist/clients/review-graph/service.js +0 -96
- package/node_modules/pi-lens/dist/clients/review-graph/shared-extraction-ir.js +0 -82
- package/node_modules/pi-lens/dist/clients/review-graph/symbol-id.js +0 -103
- package/node_modules/pi-lens/dist/clients/review-graph/tsconfig-paths.js +0 -299
- package/node_modules/pi-lens/dist/clients/review-graph/types.js +0 -1
- package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +0 -449
- package/node_modules/pi-lens/dist/clients/review-graph-logger.js +0 -81
- package/node_modules/pi-lens/dist/clients/ruff-client.js +0 -179
- package/node_modules/pi-lens/dist/clients/rules-scanner.js +0 -131
- package/node_modules/pi-lens/dist/clients/run-duration.js +0 -55
- package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +0 -746
- package/node_modules/pi-lens/dist/clients/runtime-config.js +0 -77
- package/node_modules/pi-lens/dist/clients/runtime-context.js +0 -211
- package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +0 -1324
- package/node_modules/pi-lens/dist/clients/runtime-session.js +0 -2485
- package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +0 -1295
- package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +0 -2049
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +0 -3767
- package/node_modules/pi-lens/dist/clients/rust-client.js +0 -97
- package/node_modules/pi-lens/dist/clients/safe-spawn.js +0 -2357
- package/node_modules/pi-lens/dist/clients/sanitize.js +0 -286
- package/node_modules/pi-lens/dist/clients/scan-utils.js +0 -25
- package/node_modules/pi-lens/dist/clients/scratch-tree-policy.js +0 -165
- package/node_modules/pi-lens/dist/clients/search-read-registration.js +0 -94
- package/node_modules/pi-lens/dist/clients/secret-findings.js +0 -114
- package/node_modules/pi-lens/dist/clients/security-scan-client.js +0 -352
- package/node_modules/pi-lens/dist/clients/session-event-guard.js +0 -297
- package/node_modules/pi-lens/dist/clients/session-lifecycle.js +0 -484
- package/node_modules/pi-lens/dist/clients/session-start-observability.js +0 -94
- package/node_modules/pi-lens/dist/clients/session-state-store.js +0 -101
- package/node_modules/pi-lens/dist/clients/session-summary.js +0 -15
- package/node_modules/pi-lens/dist/clients/sessionstart-logger.js +0 -27
- package/node_modules/pi-lens/dist/clients/sg-runner.js +0 -876
- package/node_modules/pi-lens/dist/clients/sgconfig.js +0 -347
- package/node_modules/pi-lens/dist/clients/shared-checkout-guard.js +0 -338
- package/node_modules/pi-lens/dist/clients/single-flight.js +0 -158
- package/node_modules/pi-lens/dist/clients/situational-tool-telemetry.js +0 -108
- package/node_modules/pi-lens/dist/clients/skills-resolver.js +0 -141
- package/node_modules/pi-lens/dist/clients/slow-fs.js +0 -138
- package/node_modules/pi-lens/dist/clients/smells-rollup.js +0 -231
- package/node_modules/pi-lens/dist/clients/source-filter.js +0 -596
- package/node_modules/pi-lens/dist/clients/source-walker.js +0 -211
- package/node_modules/pi-lens/dist/clients/spawn-output-cap.js +0 -120
- package/node_modules/pi-lens/dist/clients/spawn-timeout-cooldown.js +0 -110
- package/node_modules/pi-lens/dist/clients/stale-marker.js +0 -17
- package/node_modules/pi-lens/dist/clients/startup-scan.js +0 -400
- package/node_modules/pi-lens/dist/clients/startup-timing.js +0 -130
- package/node_modules/pi-lens/dist/clients/string-utils.js +0 -33
- package/node_modules/pi-lens/dist/clients/subagent-mode.js +0 -111
- package/node_modules/pi-lens/dist/clients/symbol-containment.js +0 -24
- package/node_modules/pi-lens/dist/clients/symbol-types.js +0 -5
- package/node_modules/pi-lens/dist/clients/test-runner-client.js +0 -2507
- package/node_modules/pi-lens/dist/clients/test-runner-delivery.js +0 -287
- package/node_modules/pi-lens/dist/clients/todo-scanner.js +0 -229
- package/node_modules/pi-lens/dist/clients/tool-agreement.js +0 -423
- package/node_modules/pi-lens/dist/clients/tool-config.js +0 -249
- package/node_modules/pi-lens/dist/clients/tool-cwd.js +0 -270
- package/node_modules/pi-lens/dist/clients/tool-definition.js +0 -47
- package/node_modules/pi-lens/dist/clients/tool-event.js +0 -105
- package/node_modules/pi-lens/dist/clients/tool-policy.js +0 -2755
- package/node_modules/pi-lens/dist/clients/tool-probe.js +0 -53
- package/node_modules/pi-lens/dist/clients/tool-render.js +0 -156
- package/node_modules/pi-lens/dist/clients/tool-set-policy.js +0 -118
- package/node_modules/pi-lens/dist/clients/tree-sitter-cache.js +0 -364
- package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +0 -4195
- package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +0 -100
- package/node_modules/pi-lens/dist/clients/tree-sitter-navigator.js +0 -269
- package/node_modules/pi-lens/dist/clients/tree-sitter-query-loader.js +0 -569
- package/node_modules/pi-lens/dist/clients/tree-sitter-shared.js +0 -158
- package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +0 -1265
- package/node_modules/pi-lens/dist/clients/trivy-client.js +0 -467
- package/node_modules/pi-lens/dist/clients/tui-fit.js +0 -50
- package/node_modules/pi-lens/dist/clients/turn-context.js +0 -52
- package/node_modules/pi-lens/dist/clients/turn-end/lane.js +0 -51
- package/node_modules/pi-lens/dist/clients/turn-end/lanes/govulncheck.js +0 -112
- package/node_modules/pi-lens/dist/clients/turn-end/lanes/secrets.js +0 -204
- package/node_modules/pi-lens/dist/clients/turn-summary-render.js +0 -72
- package/node_modules/pi-lens/dist/clients/turn-summary.js +0 -132
- package/node_modules/pi-lens/dist/clients/typos-config.js +0 -29
- package/node_modules/pi-lens/dist/clients/user-notify.js +0 -51
- package/node_modules/pi-lens/dist/clients/vanished-instance-marker.js +0 -57
- package/node_modules/pi-lens/dist/clients/warm-attach.js +0 -305
- package/node_modules/pi-lens/dist/clients/widget-state.js +0 -1808
- package/node_modules/pi-lens/dist/clients/word-index-logger.js +0 -49
- package/node_modules/pi-lens/dist/clients/word-index-store.js +0 -459
- package/node_modules/pi-lens/dist/clients/word-index.js +0 -2080
- package/node_modules/pi-lens/dist/clients/workspace-topology.js +0 -443
- package/node_modules/pi-lens/dist/clients/write-ordering-guard.js +0 -65
- package/node_modules/pi-lens/dist/clients/zizmor-config.js +0 -340
- package/node_modules/pi-lens/dist/i18n.js +0 -69
- package/node_modules/pi-lens/dist/mcp/build-staleness.js +0 -124
- package/node_modules/pi-lens/dist/scripts/lib/process-scan.mjs +0 -583
- package/node_modules/pi-lens/dist/scripts/lib/skills-predicate.mjs +0 -129
- package/node_modules/pi-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +0 -123
- package/node_modules/pi-lens/dist/tools/activate-tools.js +0 -87
- package/node_modules/pi-lens/dist/tools/ast-grep-outline.js +0 -137
- package/node_modules/pi-lens/dist/tools/ast-grep-replace.js +0 -244
- package/node_modules/pi-lens/dist/tools/ast-grep-search.js +0 -762
- package/node_modules/pi-lens/dist/tools/effective-config.js +0 -90
- package/node_modules/pi-lens/dist/tools/lens-diagnostic-mark.js +0 -375
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +0 -2571
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +0 -1745
- package/node_modules/pi-lens/dist/tools/lsp-navigation.js +0 -1367
- package/node_modules/pi-lens/dist/tools/lsp-structured-output.js +0 -294
- package/node_modules/pi-lens/dist/tools/module-report.js +0 -382
- package/node_modules/pi-lens/dist/tools/project-report.js +0 -86
- package/node_modules/pi-lens/dist/tools/render-compact.js +0 -374
- package/node_modules/pi-lens/dist/tools/scan-progress.js +0 -53
- package/node_modules/pi-lens/dist/tools/shared.js +0 -29
- package/node_modules/pi-lens/dist/tools/symbol-search.js +0 -155
|
@@ -1,2755 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { TERRAGRUNT_FILENAMES } from "./file-kinds.js";
|
|
4
|
-
import { recordDegradationOnce } from "./degradation-ledger.js";
|
|
5
|
-
import { logLatency } from "./latency-logger.js";
|
|
6
|
-
import { resolvePackagePath } from "./package-root.js";
|
|
7
|
-
import { findNearestContaining, normalizeMapKey, walkUpDirs, } from "./path-utils.js";
|
|
8
|
-
import { loadProjectSnapshotWithoutWordIndex } from "./project-snapshot.js";
|
|
9
|
-
// Extension → formatter policy. This map, `FORMATTER_POLICY_BY_FILENAME`, and
|
|
10
|
-
// `AUTO_INSTALLABLE_DEFAULT_FORMATTERS` are the inverse of the formatter
|
|
11
|
-
// definitions in `clients/formatters.ts` (formatter → extensions). The two are
|
|
12
|
-
// bound by `tests/clients/formatter-policy-consistency.test.ts` (#1135, the
|
|
13
|
-
// #883/#209 single-source-of-truth class) so they cannot drift silently. All
|
|
14
|
-
// three are re-exported (read-only intent) via a single `export {}` below —
|
|
15
|
-
// deliberately NOT inline on these declarations, to keep the pre-existing,
|
|
16
|
-
// structural lookup-table duplication out of the PR's "new code" (SonarCloud).
|
|
17
|
-
//
|
|
18
|
-
// Two deliberate #1135 decisions live in the entries below, documented here so
|
|
19
|
-
// the rationale sits outside the duplicated run:
|
|
20
|
-
// - `.sass` offers ["biome", "prettier"] only — NOT oxfmt: oxfmt is absent
|
|
21
|
-
// from OXFMT_SUPPORTED_EXTENSIONS (oxfmt/prettier handle .css/.scss/.less,
|
|
22
|
-
// not the indented `.sass` syntax). It was previously hand-listed here,
|
|
23
|
-
// diverging from the oxfmt definition (inert, because `matching` filtered
|
|
24
|
-
// it out); dropped to bind the two.
|
|
25
|
-
// - `.fish` intentionally has NO entry. `fish-indent` is a LINT runner
|
|
26
|
-
// (getLinterPolicyForFile), not a FormatterInfo — a formatter policy naming
|
|
27
|
-
// it was a dead, unsatisfiable entry; fish reformatting runs via the
|
|
28
|
-
// linter/autofix path. Removed to keep extension→formatter consistent.
|
|
29
|
-
const FORMATTER_POLICY_BY_EXTENSION = new Map([
|
|
30
|
-
[
|
|
31
|
-
".js",
|
|
32
|
-
{
|
|
33
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
34
|
-
defaultFormatter: "biome",
|
|
35
|
-
defaultWhenUnconfigured: true,
|
|
36
|
-
gate: "smart-default",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
[
|
|
40
|
-
".jsx",
|
|
41
|
-
{
|
|
42
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
43
|
-
defaultFormatter: "biome",
|
|
44
|
-
defaultWhenUnconfigured: true,
|
|
45
|
-
gate: "smart-default",
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
[
|
|
49
|
-
".mjs",
|
|
50
|
-
{
|
|
51
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
52
|
-
defaultFormatter: "biome",
|
|
53
|
-
defaultWhenUnconfigured: true,
|
|
54
|
-
gate: "smart-default",
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
".cjs",
|
|
59
|
-
{
|
|
60
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
61
|
-
defaultFormatter: "biome",
|
|
62
|
-
defaultWhenUnconfigured: true,
|
|
63
|
-
gate: "smart-default",
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
[
|
|
67
|
-
".ts",
|
|
68
|
-
{
|
|
69
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
70
|
-
defaultFormatter: "biome",
|
|
71
|
-
defaultWhenUnconfigured: true,
|
|
72
|
-
gate: "smart-default",
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
[
|
|
76
|
-
".tsx",
|
|
77
|
-
{
|
|
78
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
79
|
-
defaultFormatter: "biome",
|
|
80
|
-
defaultWhenUnconfigured: true,
|
|
81
|
-
gate: "smart-default",
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
".mts",
|
|
86
|
-
{
|
|
87
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
88
|
-
defaultFormatter: "biome",
|
|
89
|
-
defaultWhenUnconfigured: true,
|
|
90
|
-
gate: "smart-default",
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
".cts",
|
|
95
|
-
{
|
|
96
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
97
|
-
defaultFormatter: "biome",
|
|
98
|
-
defaultWhenUnconfigured: true,
|
|
99
|
-
gate: "smart-default",
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
[
|
|
103
|
-
".py",
|
|
104
|
-
{
|
|
105
|
-
formatterNames: ["black", "ruff"],
|
|
106
|
-
defaultFormatter: "ruff",
|
|
107
|
-
defaultWhenUnconfigured: true,
|
|
108
|
-
gate: "smart-default",
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
".pyi",
|
|
113
|
-
{
|
|
114
|
-
formatterNames: ["black", "ruff"],
|
|
115
|
-
defaultFormatter: "ruff",
|
|
116
|
-
defaultWhenUnconfigured: true,
|
|
117
|
-
gate: "smart-default",
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
[
|
|
121
|
-
".json",
|
|
122
|
-
{
|
|
123
|
-
formatterNames: ["biome", "prettier"],
|
|
124
|
-
defaultFormatter: "biome",
|
|
125
|
-
defaultWhenUnconfigured: false,
|
|
126
|
-
gate: "mixed",
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
[
|
|
130
|
-
".jsonc",
|
|
131
|
-
{
|
|
132
|
-
formatterNames: ["biome", "prettier"],
|
|
133
|
-
defaultFormatter: "biome",
|
|
134
|
-
defaultWhenUnconfigured: false,
|
|
135
|
-
gate: "mixed",
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
[
|
|
139
|
-
".css",
|
|
140
|
-
{
|
|
141
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
142
|
-
defaultFormatter: "biome",
|
|
143
|
-
defaultWhenUnconfigured: true,
|
|
144
|
-
gate: "smart-default",
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
[
|
|
148
|
-
".scss",
|
|
149
|
-
{
|
|
150
|
-
formatterNames: ["biome", "prettier", "oxfmt"],
|
|
151
|
-
defaultFormatter: "biome",
|
|
152
|
-
defaultWhenUnconfigured: true,
|
|
153
|
-
gate: "smart-default",
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
[
|
|
157
|
-
".sass",
|
|
158
|
-
{
|
|
159
|
-
// #1135: no oxfmt (see map header comment).
|
|
160
|
-
formatterNames: ["biome", "prettier"],
|
|
161
|
-
defaultFormatter: "biome",
|
|
162
|
-
defaultWhenUnconfigured: true,
|
|
163
|
-
gate: "smart-default",
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
[
|
|
167
|
-
".less",
|
|
168
|
-
{
|
|
169
|
-
formatterNames: ["prettier"],
|
|
170
|
-
defaultFormatter: "prettier",
|
|
171
|
-
defaultWhenUnconfigured: true,
|
|
172
|
-
gate: "smart-default",
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
[
|
|
176
|
-
".html",
|
|
177
|
-
{
|
|
178
|
-
formatterNames: ["prettier"],
|
|
179
|
-
defaultFormatter: "prettier",
|
|
180
|
-
// HTML commonly carries template markers ({{JS}} embeds, Handlebars,
|
|
181
|
-
// Helm-adjacent Go templates). Prettier reinterprets them as code and
|
|
182
|
-
// corrupts them. Opt in via project prettier config; do not run by default.
|
|
183
|
-
defaultWhenUnconfigured: false,
|
|
184
|
-
gate: "smart-default",
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
[
|
|
188
|
-
".htm",
|
|
189
|
-
{
|
|
190
|
-
formatterNames: ["prettier"],
|
|
191
|
-
defaultFormatter: "prettier",
|
|
192
|
-
defaultWhenUnconfigured: false,
|
|
193
|
-
gate: "smart-default",
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
[
|
|
197
|
-
".yaml",
|
|
198
|
-
{
|
|
199
|
-
formatterNames: ["prettier"],
|
|
200
|
-
defaultFormatter: "prettier",
|
|
201
|
-
// YAML commonly carries template markers (Helm `{{ .Values.x }}`,
|
|
202
|
-
// Ansible `{{ var }}`). Prettier splits `{{` into `{ {` and reindents
|
|
203
|
-
// embedded templates. Opt in via project prettier config.
|
|
204
|
-
defaultWhenUnconfigured: false,
|
|
205
|
-
gate: "smart-default",
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
[
|
|
209
|
-
".yml",
|
|
210
|
-
{
|
|
211
|
-
formatterNames: ["prettier"],
|
|
212
|
-
defaultFormatter: "prettier",
|
|
213
|
-
defaultWhenUnconfigured: false,
|
|
214
|
-
gate: "smart-default",
|
|
215
|
-
},
|
|
216
|
-
],
|
|
217
|
-
[
|
|
218
|
-
".md",
|
|
219
|
-
{
|
|
220
|
-
formatterNames: ["prettier"],
|
|
221
|
-
defaultFormatter: "prettier",
|
|
222
|
-
// Prettier's markdown defaults reflow lines, normalize emphasis (* -> _),
|
|
223
|
-
// and restyle lists. Opt-in via project prettier config; do not run by default.
|
|
224
|
-
defaultWhenUnconfigured: false,
|
|
225
|
-
gate: "smart-default",
|
|
226
|
-
},
|
|
227
|
-
],
|
|
228
|
-
[
|
|
229
|
-
".mdx",
|
|
230
|
-
{
|
|
231
|
-
formatterNames: ["prettier"],
|
|
232
|
-
defaultFormatter: "prettier",
|
|
233
|
-
defaultWhenUnconfigured: false,
|
|
234
|
-
gate: "smart-default",
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
[
|
|
238
|
-
".graphql",
|
|
239
|
-
{
|
|
240
|
-
formatterNames: ["prettier"],
|
|
241
|
-
defaultFormatter: "prettier",
|
|
242
|
-
defaultWhenUnconfigured: true,
|
|
243
|
-
gate: "smart-default",
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
[
|
|
247
|
-
".gql",
|
|
248
|
-
{
|
|
249
|
-
formatterNames: ["prettier"],
|
|
250
|
-
defaultFormatter: "prettier",
|
|
251
|
-
defaultWhenUnconfigured: true,
|
|
252
|
-
gate: "smart-default",
|
|
253
|
-
},
|
|
254
|
-
],
|
|
255
|
-
[
|
|
256
|
-
// ktfmt is offered alongside ktlint but only wins when the project opts in
|
|
257
|
-
// (hasExplicitFormatterConfig("ktfmt")); otherwise ktlint stays the
|
|
258
|
-
// smart-default. #129
|
|
259
|
-
".kt",
|
|
260
|
-
{
|
|
261
|
-
formatterNames: ["ktfmt", "ktlint"],
|
|
262
|
-
defaultFormatter: "ktlint",
|
|
263
|
-
defaultWhenUnconfigured: false,
|
|
264
|
-
gate: "smart-default",
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
[
|
|
268
|
-
".kts",
|
|
269
|
-
{
|
|
270
|
-
formatterNames: ["ktfmt", "ktlint"],
|
|
271
|
-
defaultFormatter: "ktlint",
|
|
272
|
-
defaultWhenUnconfigured: false,
|
|
273
|
-
gate: "smart-default",
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
[
|
|
277
|
-
".swift",
|
|
278
|
-
{
|
|
279
|
-
formatterNames: ["swiftformat"],
|
|
280
|
-
defaultFormatter: "swiftformat",
|
|
281
|
-
defaultWhenUnconfigured: false,
|
|
282
|
-
gate: "config-first",
|
|
283
|
-
},
|
|
284
|
-
],
|
|
285
|
-
[
|
|
286
|
-
".fs",
|
|
287
|
-
{
|
|
288
|
-
formatterNames: ["fantomas"],
|
|
289
|
-
defaultFormatter: "fantomas",
|
|
290
|
-
defaultWhenUnconfigured: false,
|
|
291
|
-
gate: "config-first",
|
|
292
|
-
},
|
|
293
|
-
],
|
|
294
|
-
[
|
|
295
|
-
".fsi",
|
|
296
|
-
{
|
|
297
|
-
formatterNames: ["fantomas"],
|
|
298
|
-
defaultFormatter: "fantomas",
|
|
299
|
-
defaultWhenUnconfigured: false,
|
|
300
|
-
gate: "config-first",
|
|
301
|
-
},
|
|
302
|
-
],
|
|
303
|
-
[
|
|
304
|
-
".fsx",
|
|
305
|
-
{
|
|
306
|
-
formatterNames: ["fantomas"],
|
|
307
|
-
defaultFormatter: "fantomas",
|
|
308
|
-
defaultWhenUnconfigured: false,
|
|
309
|
-
gate: "config-first",
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
[
|
|
313
|
-
".nix",
|
|
314
|
-
{
|
|
315
|
-
formatterNames: ["nixfmt"],
|
|
316
|
-
defaultFormatter: "nixfmt",
|
|
317
|
-
defaultWhenUnconfigured: false,
|
|
318
|
-
gate: "smart-default",
|
|
319
|
-
},
|
|
320
|
-
],
|
|
321
|
-
[
|
|
322
|
-
".ex",
|
|
323
|
-
{
|
|
324
|
-
formatterNames: ["mix"],
|
|
325
|
-
defaultFormatter: "mix",
|
|
326
|
-
defaultWhenUnconfigured: false,
|
|
327
|
-
gate: "config-first",
|
|
328
|
-
},
|
|
329
|
-
],
|
|
330
|
-
[
|
|
331
|
-
".exs",
|
|
332
|
-
{
|
|
333
|
-
formatterNames: ["mix"],
|
|
334
|
-
defaultFormatter: "mix",
|
|
335
|
-
defaultWhenUnconfigured: false,
|
|
336
|
-
gate: "config-first",
|
|
337
|
-
},
|
|
338
|
-
],
|
|
339
|
-
[
|
|
340
|
-
".eex",
|
|
341
|
-
{
|
|
342
|
-
formatterNames: ["mix"],
|
|
343
|
-
defaultFormatter: "mix",
|
|
344
|
-
defaultWhenUnconfigured: false,
|
|
345
|
-
gate: "config-first",
|
|
346
|
-
},
|
|
347
|
-
],
|
|
348
|
-
[
|
|
349
|
-
".heex",
|
|
350
|
-
{
|
|
351
|
-
formatterNames: ["mix"],
|
|
352
|
-
defaultFormatter: "mix",
|
|
353
|
-
defaultWhenUnconfigured: false,
|
|
354
|
-
gate: "config-first",
|
|
355
|
-
},
|
|
356
|
-
],
|
|
357
|
-
[
|
|
358
|
-
".leex",
|
|
359
|
-
{
|
|
360
|
-
formatterNames: ["mix"],
|
|
361
|
-
defaultFormatter: "mix",
|
|
362
|
-
defaultWhenUnconfigured: false,
|
|
363
|
-
gate: "config-first",
|
|
364
|
-
},
|
|
365
|
-
],
|
|
366
|
-
[
|
|
367
|
-
".gleam",
|
|
368
|
-
{
|
|
369
|
-
formatterNames: ["gleam"],
|
|
370
|
-
defaultFormatter: "gleam",
|
|
371
|
-
defaultWhenUnconfigured: true,
|
|
372
|
-
gate: "smart-default",
|
|
373
|
-
},
|
|
374
|
-
],
|
|
375
|
-
[
|
|
376
|
-
".typ",
|
|
377
|
-
{
|
|
378
|
-
formatterNames: ["typstyle"],
|
|
379
|
-
defaultFormatter: "typstyle",
|
|
380
|
-
defaultWhenUnconfigured: true,
|
|
381
|
-
gate: "smart-default",
|
|
382
|
-
},
|
|
383
|
-
],
|
|
384
|
-
[
|
|
385
|
-
".typc",
|
|
386
|
-
{
|
|
387
|
-
formatterNames: ["typstyle"],
|
|
388
|
-
defaultFormatter: "typstyle",
|
|
389
|
-
defaultWhenUnconfigured: true,
|
|
390
|
-
gate: "smart-default",
|
|
391
|
-
},
|
|
392
|
-
],
|
|
393
|
-
[
|
|
394
|
-
".c",
|
|
395
|
-
{
|
|
396
|
-
formatterNames: ["clang-format"],
|
|
397
|
-
defaultFormatter: "clang-format",
|
|
398
|
-
defaultWhenUnconfigured: false,
|
|
399
|
-
gate: "config-first",
|
|
400
|
-
},
|
|
401
|
-
],
|
|
402
|
-
[
|
|
403
|
-
".cc",
|
|
404
|
-
{
|
|
405
|
-
formatterNames: ["clang-format"],
|
|
406
|
-
defaultFormatter: "clang-format",
|
|
407
|
-
defaultWhenUnconfigured: false,
|
|
408
|
-
gate: "config-first",
|
|
409
|
-
},
|
|
410
|
-
],
|
|
411
|
-
[
|
|
412
|
-
".cpp",
|
|
413
|
-
{
|
|
414
|
-
formatterNames: ["clang-format"],
|
|
415
|
-
defaultFormatter: "clang-format",
|
|
416
|
-
defaultWhenUnconfigured: false,
|
|
417
|
-
gate: "config-first",
|
|
418
|
-
},
|
|
419
|
-
],
|
|
420
|
-
[
|
|
421
|
-
".cxx",
|
|
422
|
-
{
|
|
423
|
-
formatterNames: ["clang-format"],
|
|
424
|
-
defaultFormatter: "clang-format",
|
|
425
|
-
defaultWhenUnconfigured: false,
|
|
426
|
-
gate: "config-first",
|
|
427
|
-
},
|
|
428
|
-
],
|
|
429
|
-
[
|
|
430
|
-
".h",
|
|
431
|
-
{
|
|
432
|
-
formatterNames: ["clang-format"],
|
|
433
|
-
defaultFormatter: "clang-format",
|
|
434
|
-
defaultWhenUnconfigured: false,
|
|
435
|
-
gate: "config-first",
|
|
436
|
-
},
|
|
437
|
-
],
|
|
438
|
-
[
|
|
439
|
-
".hpp",
|
|
440
|
-
{
|
|
441
|
-
formatterNames: ["clang-format"],
|
|
442
|
-
defaultFormatter: "clang-format",
|
|
443
|
-
defaultWhenUnconfigured: false,
|
|
444
|
-
gate: "config-first",
|
|
445
|
-
},
|
|
446
|
-
],
|
|
447
|
-
[
|
|
448
|
-
".ino",
|
|
449
|
-
{
|
|
450
|
-
formatterNames: ["clang-format"],
|
|
451
|
-
defaultFormatter: "clang-format",
|
|
452
|
-
defaultWhenUnconfigured: false,
|
|
453
|
-
gate: "config-first",
|
|
454
|
-
},
|
|
455
|
-
],
|
|
456
|
-
[
|
|
457
|
-
".php",
|
|
458
|
-
{
|
|
459
|
-
formatterNames: ["php-cs-fixer"],
|
|
460
|
-
defaultFormatter: "php-cs-fixer",
|
|
461
|
-
defaultWhenUnconfigured: false,
|
|
462
|
-
gate: "config-first",
|
|
463
|
-
},
|
|
464
|
-
],
|
|
465
|
-
[
|
|
466
|
-
".cs",
|
|
467
|
-
{
|
|
468
|
-
formatterNames: ["csharpier"],
|
|
469
|
-
defaultFormatter: "csharpier",
|
|
470
|
-
defaultWhenUnconfigured: false,
|
|
471
|
-
gate: "config-first",
|
|
472
|
-
},
|
|
473
|
-
],
|
|
474
|
-
[
|
|
475
|
-
".lua",
|
|
476
|
-
{
|
|
477
|
-
formatterNames: ["stylua"],
|
|
478
|
-
defaultFormatter: "stylua",
|
|
479
|
-
defaultWhenUnconfigured: false,
|
|
480
|
-
gate: "config-first",
|
|
481
|
-
},
|
|
482
|
-
],
|
|
483
|
-
[
|
|
484
|
-
".hs",
|
|
485
|
-
{
|
|
486
|
-
formatterNames: ["ormolu"],
|
|
487
|
-
defaultFormatter: "ormolu",
|
|
488
|
-
defaultWhenUnconfigured: false,
|
|
489
|
-
gate: "config-first",
|
|
490
|
-
},
|
|
491
|
-
],
|
|
492
|
-
[
|
|
493
|
-
".lhs",
|
|
494
|
-
{
|
|
495
|
-
formatterNames: ["ormolu"],
|
|
496
|
-
defaultFormatter: "ormolu",
|
|
497
|
-
defaultWhenUnconfigured: false,
|
|
498
|
-
gate: "config-first",
|
|
499
|
-
},
|
|
500
|
-
],
|
|
501
|
-
[
|
|
502
|
-
".ml",
|
|
503
|
-
{
|
|
504
|
-
formatterNames: ["ocamlformat"],
|
|
505
|
-
defaultFormatter: "ocamlformat",
|
|
506
|
-
defaultWhenUnconfigured: false,
|
|
507
|
-
gate: "config-first",
|
|
508
|
-
},
|
|
509
|
-
],
|
|
510
|
-
[
|
|
511
|
-
".mli",
|
|
512
|
-
{
|
|
513
|
-
formatterNames: ["ocamlformat"],
|
|
514
|
-
defaultFormatter: "ocamlformat",
|
|
515
|
-
defaultWhenUnconfigured: false,
|
|
516
|
-
gate: "config-first",
|
|
517
|
-
},
|
|
518
|
-
],
|
|
519
|
-
[
|
|
520
|
-
".go",
|
|
521
|
-
{
|
|
522
|
-
formatterNames: ["gofmt"],
|
|
523
|
-
defaultFormatter: "gofmt",
|
|
524
|
-
defaultWhenUnconfigured: true,
|
|
525
|
-
gate: "smart-default",
|
|
526
|
-
},
|
|
527
|
-
],
|
|
528
|
-
[
|
|
529
|
-
".rs",
|
|
530
|
-
{
|
|
531
|
-
formatterNames: ["rustfmt"],
|
|
532
|
-
defaultFormatter: "rustfmt",
|
|
533
|
-
defaultWhenUnconfigured: true,
|
|
534
|
-
gate: "smart-default",
|
|
535
|
-
},
|
|
536
|
-
],
|
|
537
|
-
[
|
|
538
|
-
".sh",
|
|
539
|
-
{
|
|
540
|
-
formatterNames: ["shfmt"],
|
|
541
|
-
defaultFormatter: "shfmt",
|
|
542
|
-
defaultWhenUnconfigured: true,
|
|
543
|
-
gate: "smart-default",
|
|
544
|
-
},
|
|
545
|
-
],
|
|
546
|
-
[
|
|
547
|
-
".bash",
|
|
548
|
-
{
|
|
549
|
-
formatterNames: ["shfmt"],
|
|
550
|
-
defaultFormatter: "shfmt",
|
|
551
|
-
defaultWhenUnconfigured: true,
|
|
552
|
-
gate: "smart-default",
|
|
553
|
-
},
|
|
554
|
-
],
|
|
555
|
-
[
|
|
556
|
-
".toml",
|
|
557
|
-
{
|
|
558
|
-
formatterNames: ["taplo"],
|
|
559
|
-
defaultFormatter: "taplo",
|
|
560
|
-
defaultWhenUnconfigured: false,
|
|
561
|
-
gate: "config-first",
|
|
562
|
-
},
|
|
563
|
-
],
|
|
564
|
-
[
|
|
565
|
-
".tf",
|
|
566
|
-
{
|
|
567
|
-
formatterNames: ["terraform"],
|
|
568
|
-
defaultFormatter: "terraform",
|
|
569
|
-
defaultWhenUnconfigured: false,
|
|
570
|
-
gate: "config-first",
|
|
571
|
-
},
|
|
572
|
-
],
|
|
573
|
-
[
|
|
574
|
-
".tfvars",
|
|
575
|
-
{
|
|
576
|
-
formatterNames: ["terraform"],
|
|
577
|
-
defaultFormatter: "terraform",
|
|
578
|
-
defaultWhenUnconfigured: false,
|
|
579
|
-
gate: "config-first",
|
|
580
|
-
},
|
|
581
|
-
],
|
|
582
|
-
[
|
|
583
|
-
".dart",
|
|
584
|
-
{
|
|
585
|
-
formatterNames: ["dart"],
|
|
586
|
-
defaultFormatter: "dart",
|
|
587
|
-
defaultWhenUnconfigured: true,
|
|
588
|
-
gate: "smart-default",
|
|
589
|
-
},
|
|
590
|
-
],
|
|
591
|
-
[
|
|
592
|
-
".zig",
|
|
593
|
-
{
|
|
594
|
-
formatterNames: ["zig"],
|
|
595
|
-
defaultFormatter: "zig",
|
|
596
|
-
defaultWhenUnconfigured: true,
|
|
597
|
-
gate: "smart-default",
|
|
598
|
-
},
|
|
599
|
-
],
|
|
600
|
-
[
|
|
601
|
-
".zon",
|
|
602
|
-
{
|
|
603
|
-
formatterNames: ["zig"],
|
|
604
|
-
defaultFormatter: "zig",
|
|
605
|
-
defaultWhenUnconfigured: true,
|
|
606
|
-
gate: "smart-default",
|
|
607
|
-
},
|
|
608
|
-
],
|
|
609
|
-
[
|
|
610
|
-
".java",
|
|
611
|
-
{
|
|
612
|
-
formatterNames: ["google-java-format"],
|
|
613
|
-
defaultFormatter: "google-java-format",
|
|
614
|
-
defaultWhenUnconfigured: false,
|
|
615
|
-
gate: "config-first",
|
|
616
|
-
},
|
|
617
|
-
],
|
|
618
|
-
[
|
|
619
|
-
".clj",
|
|
620
|
-
{
|
|
621
|
-
formatterNames: ["cljfmt"],
|
|
622
|
-
defaultFormatter: "cljfmt",
|
|
623
|
-
defaultWhenUnconfigured: false,
|
|
624
|
-
gate: "config-first",
|
|
625
|
-
},
|
|
626
|
-
],
|
|
627
|
-
[
|
|
628
|
-
".cljc",
|
|
629
|
-
{
|
|
630
|
-
formatterNames: ["cljfmt"],
|
|
631
|
-
defaultFormatter: "cljfmt",
|
|
632
|
-
defaultWhenUnconfigured: false,
|
|
633
|
-
gate: "config-first",
|
|
634
|
-
},
|
|
635
|
-
],
|
|
636
|
-
[
|
|
637
|
-
".cljs",
|
|
638
|
-
{
|
|
639
|
-
formatterNames: ["cljfmt"],
|
|
640
|
-
defaultFormatter: "cljfmt",
|
|
641
|
-
defaultWhenUnconfigured: false,
|
|
642
|
-
gate: "config-first",
|
|
643
|
-
},
|
|
644
|
-
],
|
|
645
|
-
[
|
|
646
|
-
".cmake",
|
|
647
|
-
{
|
|
648
|
-
formatterNames: ["cmake-format"],
|
|
649
|
-
defaultFormatter: "cmake-format",
|
|
650
|
-
defaultWhenUnconfigured: false,
|
|
651
|
-
gate: "config-first",
|
|
652
|
-
},
|
|
653
|
-
],
|
|
654
|
-
[
|
|
655
|
-
".ps1",
|
|
656
|
-
{
|
|
657
|
-
formatterNames: ["psscriptanalyzer-format"],
|
|
658
|
-
defaultFormatter: "psscriptanalyzer-format",
|
|
659
|
-
defaultWhenUnconfigured: false,
|
|
660
|
-
gate: "smart-default",
|
|
661
|
-
},
|
|
662
|
-
],
|
|
663
|
-
[
|
|
664
|
-
".psm1",
|
|
665
|
-
{
|
|
666
|
-
formatterNames: ["psscriptanalyzer-format"],
|
|
667
|
-
defaultFormatter: "psscriptanalyzer-format",
|
|
668
|
-
defaultWhenUnconfigured: false,
|
|
669
|
-
gate: "smart-default",
|
|
670
|
-
},
|
|
671
|
-
],
|
|
672
|
-
[
|
|
673
|
-
".psd1",
|
|
674
|
-
{
|
|
675
|
-
formatterNames: ["psscriptanalyzer-format"],
|
|
676
|
-
defaultFormatter: "psscriptanalyzer-format",
|
|
677
|
-
defaultWhenUnconfigured: false,
|
|
678
|
-
gate: "smart-default",
|
|
679
|
-
},
|
|
680
|
-
],
|
|
681
|
-
[
|
|
682
|
-
".cue",
|
|
683
|
-
{
|
|
684
|
-
formatterNames: ["cue"],
|
|
685
|
-
defaultFormatter: "cue",
|
|
686
|
-
defaultWhenUnconfigured: true,
|
|
687
|
-
gate: "smart-default",
|
|
688
|
-
},
|
|
689
|
-
],
|
|
690
|
-
]);
|
|
691
|
-
// oxfmt supports these extensions — registered as a candidate formatter for each.
|
|
692
|
-
// Using a post-processing pass avoids repeating the same modification across
|
|
693
|
-
// many map entries (and keeps SonarCloud's duplication gate happy).
|
|
694
|
-
// This is the SINGLE SOURCE OF TRUTH for oxfmt's supported extensions — do not
|
|
695
|
-
// hand-maintain a second copy; `clients/formatters.ts`'s `oxfmtFormatter.extensions`
|
|
696
|
-
// imports and spreads this same Set (#1134; previously two parallel hand-maintained
|
|
697
|
-
// lists, the #883 single-source-of-truth class).
|
|
698
|
-
export const OXFMT_SUPPORTED_EXTENSIONS = new Set([
|
|
699
|
-
".js",
|
|
700
|
-
".jsx",
|
|
701
|
-
".mjs",
|
|
702
|
-
".cjs",
|
|
703
|
-
".ts",
|
|
704
|
-
".tsx",
|
|
705
|
-
".mts",
|
|
706
|
-
".cts",
|
|
707
|
-
".vue",
|
|
708
|
-
".svelte",
|
|
709
|
-
".css",
|
|
710
|
-
".scss",
|
|
711
|
-
".less",
|
|
712
|
-
".html",
|
|
713
|
-
".htm",
|
|
714
|
-
".json",
|
|
715
|
-
".jsonc",
|
|
716
|
-
".yaml",
|
|
717
|
-
".yml",
|
|
718
|
-
".md",
|
|
719
|
-
".mdx",
|
|
720
|
-
".graphql",
|
|
721
|
-
".gql",
|
|
722
|
-
".toml",
|
|
723
|
-
]);
|
|
724
|
-
// Add .vue entry (no prior formatter policy existed for this extension)
|
|
725
|
-
FORMATTER_POLICY_BY_EXTENSION.set(".vue", {
|
|
726
|
-
formatterNames: ["prettier"],
|
|
727
|
-
defaultFormatter: "prettier",
|
|
728
|
-
defaultWhenUnconfigured: false,
|
|
729
|
-
gate: "config-first",
|
|
730
|
-
});
|
|
731
|
-
// Add .svelte entry (no prior formatter policy existed for this extension —
|
|
732
|
-
// docs/language-coverage.md previously listed no formatter). oxfmt is the only
|
|
733
|
-
// candidate; the loop below appends it since ".svelte" is in
|
|
734
|
-
// OXFMT_SUPPORTED_EXTENSIONS. Unlike the other oxfmt extensions, oxfmt's
|
|
735
|
-
// .svelte support is conditional on more than "a config file exists" — see
|
|
736
|
-
// `hasOxfmtSvelteConfig` below, gated in `formatters.ts`'s
|
|
737
|
-
// `hasExplicitFormatterConfig` (verified empirically against the real oxfmt
|
|
738
|
-
// npm binary; oxfmt exits non-zero on .svelte without BOTH the `svelte`
|
|
739
|
-
// package installed and the config's `svelte` flag enabled — an unconditional
|
|
740
|
-
// offer would guarantee a formatter failure, not a no-op).
|
|
741
|
-
FORMATTER_POLICY_BY_EXTENSION.set(".svelte", {
|
|
742
|
-
formatterNames: [],
|
|
743
|
-
defaultFormatter: "oxfmt",
|
|
744
|
-
defaultWhenUnconfigured: false,
|
|
745
|
-
gate: "config-first",
|
|
746
|
-
});
|
|
747
|
-
for (const [ext, policy] of FORMATTER_POLICY_BY_EXTENSION) {
|
|
748
|
-
if (OXFMT_SUPPORTED_EXTENSIONS.has(ext) &&
|
|
749
|
-
!policy.formatterNames.includes("oxfmt")) {
|
|
750
|
-
policy.formatterNames.push("oxfmt");
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
const AUTO_INSTALLABLE_DEFAULT_FORMATTERS = new Map([
|
|
754
|
-
["biome", "biome"],
|
|
755
|
-
["ruff", "ruff"],
|
|
756
|
-
["prettier", "prettier"],
|
|
757
|
-
["shfmt", "shfmt"],
|
|
758
|
-
["taplo", "taplo"],
|
|
759
|
-
["ktlint", "ktlint"],
|
|
760
|
-
["typstyle", "typstyle"],
|
|
761
|
-
]);
|
|
762
|
-
// `gate: "smart-default"` so a matched file is formatted only when nothing else
|
|
763
|
-
// claims it. Misdetection edge: `root.hcl` is filename-detected as terragrunt, so
|
|
764
|
-
// a non-terragrunt `root.hcl` gets smart-default formatted with `terragrunt hcl
|
|
765
|
-
// fmt`'s generic HCL canonicalization — a soft outcome (canonical HCL, no config
|
|
766
|
-
// semantics assumed), not a hard failure.
|
|
767
|
-
const TERRAGRUNT_FORMATTER_POLICY = {
|
|
768
|
-
formatterNames: ["terragrunt-hcl"],
|
|
769
|
-
defaultFormatter: "terragrunt-hcl",
|
|
770
|
-
defaultWhenUnconfigured: true,
|
|
771
|
-
gate: "smart-default",
|
|
772
|
-
};
|
|
773
|
-
const FORMATTER_POLICY_BY_FILENAME = new Map(TERRAGRUNT_FILENAMES.map((name) => [name, TERRAGRUNT_FORMATTER_POLICY]));
|
|
774
|
-
// Re-exported (read-only intent) for the #1135 drift guard. Kept as a single
|
|
775
|
-
// separate statement — NOT inline on the declarations above — so the touched
|
|
776
|
-
// lines don't fall at the head of the pre-existing lookup-table duplication and
|
|
777
|
-
// get counted as new duplicated code. Bindings are live, so position is safe.
|
|
778
|
-
export { AUTO_INSTALLABLE_DEFAULT_FORMATTERS, FORMATTER_POLICY_BY_EXTENSION, FORMATTER_POLICY_BY_FILENAME, };
|
|
779
|
-
function getFormatterPolicyForExtension(ext) {
|
|
780
|
-
return FORMATTER_POLICY_BY_EXTENSION.get(ext.toLowerCase());
|
|
781
|
-
}
|
|
782
|
-
export function getFormatterPolicyForFile(filePath) {
|
|
783
|
-
const byFilename = FORMATTER_POLICY_BY_FILENAME.get(path.basename(filePath).toLowerCase());
|
|
784
|
-
if (byFilename)
|
|
785
|
-
return byFilename;
|
|
786
|
-
return getFormatterPolicyForExtension(path.extname(filePath));
|
|
787
|
-
}
|
|
788
|
-
export function getSmartDefaultFormatterName(filePath) {
|
|
789
|
-
const policy = getFormatterPolicyForFile(filePath);
|
|
790
|
-
if (!policy?.defaultWhenUnconfigured)
|
|
791
|
-
return undefined;
|
|
792
|
-
return policy.defaultFormatter;
|
|
793
|
-
}
|
|
794
|
-
export function getAutoInstallToolIdForFormatter(formatterName) {
|
|
795
|
-
return AUTO_INSTALLABLE_DEFAULT_FORMATTERS.get(formatterName);
|
|
796
|
-
}
|
|
797
|
-
export function getToolExecutionPolicy(toolId) {
|
|
798
|
-
return TOOL_EXECUTION_POLICY.get(toolId);
|
|
799
|
-
}
|
|
800
|
-
export function shouldAutoInstallTool(toolId) {
|
|
801
|
-
return getToolExecutionPolicy(toolId)?.autoInstall ?? false;
|
|
802
|
-
}
|
|
803
|
-
export function getAutofixCapability(toolId) {
|
|
804
|
-
return AUTOFIX_CAPABILITIES.get(toolId);
|
|
805
|
-
}
|
|
806
|
-
/** Tool ids declared as safe pipeline-autofix capable (for consistency guards). */
|
|
807
|
-
export function listSafePipelineAutofixTools() {
|
|
808
|
-
return [...AUTOFIX_CAPABILITIES.entries()]
|
|
809
|
-
.filter(([, cap]) => cap.safePipelineAutofix)
|
|
810
|
-
.map(([id]) => id);
|
|
811
|
-
}
|
|
812
|
-
export function canToolAutoFix(toolId) {
|
|
813
|
-
return getAutofixCapability(toolId)?.toolSupportsFix ?? false;
|
|
814
|
-
}
|
|
815
|
-
export function isSafePipelineAutofixTool(toolId) {
|
|
816
|
-
return getAutofixCapability(toolId)?.safePipelineAutofix ?? false;
|
|
817
|
-
}
|
|
818
|
-
export function getToolCommandSpec(toolId) {
|
|
819
|
-
return TOOL_COMMAND_SPECS.get(toolId);
|
|
820
|
-
}
|
|
821
|
-
const AUTOFIX_CAPABILITIES = new Map([
|
|
822
|
-
[
|
|
823
|
-
"biome",
|
|
824
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
825
|
-
],
|
|
826
|
-
[
|
|
827
|
-
"eslint",
|
|
828
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
829
|
-
],
|
|
830
|
-
[
|
|
831
|
-
"ruff",
|
|
832
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
833
|
-
],
|
|
834
|
-
[
|
|
835
|
-
"stylelint",
|
|
836
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
837
|
-
],
|
|
838
|
-
[
|
|
839
|
-
"sqlfluff",
|
|
840
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
841
|
-
],
|
|
842
|
-
[
|
|
843
|
-
"rubocop",
|
|
844
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
845
|
-
],
|
|
846
|
-
[
|
|
847
|
-
"ktlint",
|
|
848
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
849
|
-
],
|
|
850
|
-
[
|
|
851
|
-
"ktfmt",
|
|
852
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
853
|
-
],
|
|
854
|
-
[
|
|
855
|
-
"rust-clippy",
|
|
856
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
857
|
-
],
|
|
858
|
-
[
|
|
859
|
-
"dart-analyze",
|
|
860
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
861
|
-
],
|
|
862
|
-
[
|
|
863
|
-
"golangci-lint",
|
|
864
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
865
|
-
],
|
|
866
|
-
[
|
|
867
|
-
"detekt",
|
|
868
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
869
|
-
],
|
|
870
|
-
[
|
|
871
|
-
"markdownlint",
|
|
872
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
873
|
-
],
|
|
874
|
-
[
|
|
875
|
-
"oxlint",
|
|
876
|
-
{ toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" },
|
|
877
|
-
],
|
|
878
|
-
]);
|
|
879
|
-
const TOOL_EXECUTION_POLICY = new Map([
|
|
880
|
-
// Dispatch/LSP runners use the shared availability/install seam. These
|
|
881
|
-
// managed tools are missing-command repair candidates; probe failures still
|
|
882
|
-
// fail closed before this policy is consulted.
|
|
883
|
-
["pyright", { gate: "smart-default", autoInstall: true }],
|
|
884
|
-
["shellcheck", { gate: "smart-default", autoInstall: true }],
|
|
885
|
-
["shfmt", { gate: "smart-default", autoInstall: true }],
|
|
886
|
-
["tflint", { gate: "smart-default", autoInstall: true }],
|
|
887
|
-
["terragrunt", { gate: "smart-default", autoInstall: true }],
|
|
888
|
-
["trivy", { gate: "config-first", autoInstall: true }],
|
|
889
|
-
["biome", { gate: "smart-default", autoInstall: true }],
|
|
890
|
-
["ruff", { gate: "smart-default", autoInstall: true }],
|
|
891
|
-
["jscpd", { gate: "smart-default", autoInstall: true }],
|
|
892
|
-
["madge", { gate: "smart-default", autoInstall: true }],
|
|
893
|
-
["knip", { gate: "smart-default", autoInstall: true }],
|
|
894
|
-
["ast-grep", { gate: "smart-default", autoInstall: true }],
|
|
895
|
-
["oxlint", { gate: "smart-default", autoInstall: true }],
|
|
896
|
-
["stylelint", { gate: "smart-default", autoInstall: true }],
|
|
897
|
-
["sqlfluff", { gate: "smart-default", autoInstall: true }],
|
|
898
|
-
["rubocop", { gate: "smart-default", autoInstall: true }],
|
|
899
|
-
["yamllint", { gate: "smart-default", autoInstall: true }],
|
|
900
|
-
["actionlint", { gate: "smart-default", autoInstall: true }],
|
|
901
|
-
["markdownlint", { gate: "smart-default", autoInstall: true }],
|
|
902
|
-
["mypy", { gate: "config-first", autoInstall: true }],
|
|
903
|
-
["taplo", { gate: "smart-default", autoInstall: true }],
|
|
904
|
-
["hadolint", { gate: "smart-default", autoInstall: true }],
|
|
905
|
-
["helm", { gate: "smart-default", autoInstall: true }],
|
|
906
|
-
["htmlhint", { gate: "smart-default", autoInstall: true }],
|
|
907
|
-
["ktlint", { gate: "smart-default", autoInstall: true }],
|
|
908
|
-
// ktfmt is opt-in (a project's explicit formatting choice), so it only runs
|
|
909
|
-
// when its config marker is present — config-first, but auto-installable via
|
|
910
|
-
// the maven-JAR strategy once elected (#129).
|
|
911
|
-
["ktfmt", { gate: "config-first", autoInstall: true }],
|
|
912
|
-
["golangci-lint", { gate: "config-first", autoInstall: true }],
|
|
913
|
-
// SpotBugs is opt-in (lens-spotbugs flag) + config-first (needs a Java build
|
|
914
|
-
// descriptor + compiled .class files), auto-installed via the archive
|
|
915
|
-
// strategy when elected (#133).
|
|
916
|
-
["spotbugs", { gate: "config-first", autoInstall: true }],
|
|
917
|
-
// Opengrep is opt-in (lens-opengrep flag or a discovered rule file) and
|
|
918
|
-
// config-first, but auto-installable via the GitHub single-binary strategy
|
|
919
|
-
// once elected — no login/token required, unlike Semgrep (#111).
|
|
920
|
-
["opengrep", { gate: "config-first", autoInstall: true }],
|
|
921
|
-
["phpstan", { gate: "config-first", autoInstall: false }],
|
|
922
|
-
["eslint", { gate: "config-first", autoInstall: false }],
|
|
923
|
-
["prettier", { gate: "smart-default", autoInstall: true }],
|
|
924
|
-
["vale", { gate: "config-first", autoInstall: false }],
|
|
925
|
-
["swiftlint", { gate: "smart-default", autoInstall: true }],
|
|
926
|
-
]);
|
|
927
|
-
const TOOL_COMMAND_SPECS = new Map([
|
|
928
|
-
[
|
|
929
|
-
"eslint",
|
|
930
|
-
{
|
|
931
|
-
command: "eslint",
|
|
932
|
-
windowsExt: ".cmd",
|
|
933
|
-
versionArgs: ["--version"],
|
|
934
|
-
managedToolId: "eslint",
|
|
935
|
-
},
|
|
936
|
-
],
|
|
937
|
-
[
|
|
938
|
-
"stylelint",
|
|
939
|
-
{
|
|
940
|
-
command: "stylelint",
|
|
941
|
-
windowsExt: ".cmd",
|
|
942
|
-
versionArgs: ["--version"],
|
|
943
|
-
managedToolId: "stylelint",
|
|
944
|
-
},
|
|
945
|
-
],
|
|
946
|
-
[
|
|
947
|
-
"sqlfluff",
|
|
948
|
-
{
|
|
949
|
-
command: "sqlfluff",
|
|
950
|
-
windowsExt: ".exe",
|
|
951
|
-
versionArgs: ["--version"],
|
|
952
|
-
managedToolId: "sqlfluff",
|
|
953
|
-
},
|
|
954
|
-
],
|
|
955
|
-
[
|
|
956
|
-
"oxlint",
|
|
957
|
-
{
|
|
958
|
-
command: "oxlint",
|
|
959
|
-
windowsExt: ".exe",
|
|
960
|
-
versionArgs: ["--version"],
|
|
961
|
-
managedToolId: "oxlint",
|
|
962
|
-
},
|
|
963
|
-
],
|
|
964
|
-
[
|
|
965
|
-
"ruff",
|
|
966
|
-
{
|
|
967
|
-
command: "ruff",
|
|
968
|
-
windowsExt: ".exe",
|
|
969
|
-
versionArgs: ["--version"],
|
|
970
|
-
managedToolId: "ruff",
|
|
971
|
-
},
|
|
972
|
-
],
|
|
973
|
-
[
|
|
974
|
-
"biome",
|
|
975
|
-
{
|
|
976
|
-
command: "biome",
|
|
977
|
-
windowsExt: ".cmd",
|
|
978
|
-
versionArgs: ["--version"],
|
|
979
|
-
managedToolId: "biome",
|
|
980
|
-
},
|
|
981
|
-
],
|
|
982
|
-
[
|
|
983
|
-
"rubocop",
|
|
984
|
-
{
|
|
985
|
-
command: "rubocop",
|
|
986
|
-
versionArgs: ["--version"],
|
|
987
|
-
managedToolId: "rubocop",
|
|
988
|
-
},
|
|
989
|
-
],
|
|
990
|
-
[
|
|
991
|
-
"yamllint",
|
|
992
|
-
{
|
|
993
|
-
command: "yamllint",
|
|
994
|
-
windowsExt: ".exe",
|
|
995
|
-
versionArgs: ["--version"],
|
|
996
|
-
managedToolId: "yamllint",
|
|
997
|
-
},
|
|
998
|
-
],
|
|
999
|
-
[
|
|
1000
|
-
"actionlint",
|
|
1001
|
-
{
|
|
1002
|
-
command: "actionlint",
|
|
1003
|
-
windowsExt: ".exe",
|
|
1004
|
-
versionArgs: ["--version"],
|
|
1005
|
-
managedToolId: "actionlint",
|
|
1006
|
-
},
|
|
1007
|
-
],
|
|
1008
|
-
[
|
|
1009
|
-
"markdownlint",
|
|
1010
|
-
{
|
|
1011
|
-
command: "markdownlint-cli2",
|
|
1012
|
-
windowsExt: ".cmd",
|
|
1013
|
-
versionArgs: ["--no-globs", "-"],
|
|
1014
|
-
managedToolId: "markdownlint",
|
|
1015
|
-
},
|
|
1016
|
-
],
|
|
1017
|
-
[
|
|
1018
|
-
"vale",
|
|
1019
|
-
{
|
|
1020
|
-
command: "vale",
|
|
1021
|
-
windowsExt: ".exe",
|
|
1022
|
-
versionArgs: ["--version"],
|
|
1023
|
-
managedToolId: "vale",
|
|
1024
|
-
},
|
|
1025
|
-
],
|
|
1026
|
-
[
|
|
1027
|
-
"swiftlint",
|
|
1028
|
-
{
|
|
1029
|
-
command: "swiftlint",
|
|
1030
|
-
versionArgs: ["--version"],
|
|
1031
|
-
managedToolId: "swiftlint",
|
|
1032
|
-
},
|
|
1033
|
-
],
|
|
1034
|
-
[
|
|
1035
|
-
"mypy",
|
|
1036
|
-
{
|
|
1037
|
-
command: "mypy",
|
|
1038
|
-
versionArgs: ["--version"],
|
|
1039
|
-
managedToolId: "mypy",
|
|
1040
|
-
},
|
|
1041
|
-
],
|
|
1042
|
-
[
|
|
1043
|
-
"phpstan",
|
|
1044
|
-
{
|
|
1045
|
-
command: "phpstan",
|
|
1046
|
-
windowsExt: ".bat",
|
|
1047
|
-
versionArgs: ["--version"],
|
|
1048
|
-
managedToolId: "phpstan",
|
|
1049
|
-
},
|
|
1050
|
-
],
|
|
1051
|
-
[
|
|
1052
|
-
"taplo",
|
|
1053
|
-
{
|
|
1054
|
-
command: "taplo",
|
|
1055
|
-
windowsExt: ".exe",
|
|
1056
|
-
versionArgs: ["--version"],
|
|
1057
|
-
managedToolId: "taplo",
|
|
1058
|
-
},
|
|
1059
|
-
],
|
|
1060
|
-
[
|
|
1061
|
-
"hadolint",
|
|
1062
|
-
{
|
|
1063
|
-
command: "hadolint",
|
|
1064
|
-
windowsExt: ".exe",
|
|
1065
|
-
versionArgs: ["--version"],
|
|
1066
|
-
managedToolId: "hadolint",
|
|
1067
|
-
},
|
|
1068
|
-
],
|
|
1069
|
-
[
|
|
1070
|
-
"htmlhint",
|
|
1071
|
-
{
|
|
1072
|
-
command: "htmlhint",
|
|
1073
|
-
versionArgs: ["--version"],
|
|
1074
|
-
managedToolId: "htmlhint",
|
|
1075
|
-
},
|
|
1076
|
-
],
|
|
1077
|
-
[
|
|
1078
|
-
"ktlint",
|
|
1079
|
-
{
|
|
1080
|
-
command: "ktlint",
|
|
1081
|
-
windowsExt: ".exe",
|
|
1082
|
-
versionArgs: ["--version"],
|
|
1083
|
-
managedToolId: "ktlint",
|
|
1084
|
-
},
|
|
1085
|
-
],
|
|
1086
|
-
[
|
|
1087
|
-
"prettier",
|
|
1088
|
-
{
|
|
1089
|
-
command: "prettier",
|
|
1090
|
-
windowsExt: ".cmd",
|
|
1091
|
-
versionArgs: ["--version"],
|
|
1092
|
-
managedToolId: "prettier",
|
|
1093
|
-
},
|
|
1094
|
-
],
|
|
1095
|
-
]);
|
|
1096
|
-
const STYLELINT_CONFIGS = [
|
|
1097
|
-
".stylelintrc",
|
|
1098
|
-
".stylelintrc.json",
|
|
1099
|
-
".stylelintrc.jsonc",
|
|
1100
|
-
".stylelintrc.yaml",
|
|
1101
|
-
".stylelintrc.yml",
|
|
1102
|
-
".stylelintrc.js",
|
|
1103
|
-
".stylelintrc.cjs",
|
|
1104
|
-
"stylelint.config.js",
|
|
1105
|
-
"stylelint.config.cjs",
|
|
1106
|
-
"stylelint.config.mjs",
|
|
1107
|
-
];
|
|
1108
|
-
const SQLFLUFF_CONFIGS = [
|
|
1109
|
-
".sqlfluff",
|
|
1110
|
-
"pyproject.toml",
|
|
1111
|
-
"setup.cfg",
|
|
1112
|
-
"tox.ini",
|
|
1113
|
-
];
|
|
1114
|
-
const RUBOCOP_CONFIGS = [".rubocop.yml", ".rubocop.yaml"];
|
|
1115
|
-
const MYPY_CONFIGS = ["mypy.ini", ".mypy.ini", "setup.cfg", "pyproject.toml"];
|
|
1116
|
-
const YAMLLINT_CONFIGS = [
|
|
1117
|
-
".yamllint",
|
|
1118
|
-
".yamllint.yml",
|
|
1119
|
-
".yamllint.yaml",
|
|
1120
|
-
"pyproject.toml",
|
|
1121
|
-
"setup.cfg",
|
|
1122
|
-
"tox.ini",
|
|
1123
|
-
];
|
|
1124
|
-
const MARKDOWNLINT_CONFIGS = [
|
|
1125
|
-
// markdownlint-cli2's built-in config names (keep this list in sync with
|
|
1126
|
-
// the installed CLI's supported configuration file names).
|
|
1127
|
-
".markdownlint-cli2.jsonc",
|
|
1128
|
-
".markdownlint-cli2.yaml",
|
|
1129
|
-
".markdownlint-cli2.yml",
|
|
1130
|
-
".markdownlint-cli2.cjs",
|
|
1131
|
-
".markdownlint-cli2.mjs",
|
|
1132
|
-
".markdownlint.jsonc",
|
|
1133
|
-
".markdownlint.json",
|
|
1134
|
-
".markdownlint.yaml",
|
|
1135
|
-
".markdownlint.yml",
|
|
1136
|
-
".markdownlint.cjs",
|
|
1137
|
-
".markdownlint.mjs",
|
|
1138
|
-
// Retain the legacy detector name for compatibility with existing policy
|
|
1139
|
-
// behavior, even though current markdownlint-cli2 versions do not prefer it.
|
|
1140
|
-
".markdownlintrc",
|
|
1141
|
-
];
|
|
1142
|
-
const PRETTIER_CONFIGS = [
|
|
1143
|
-
".prettierrc",
|
|
1144
|
-
".prettierrc.json",
|
|
1145
|
-
".prettierrc.yml",
|
|
1146
|
-
".prettierrc.yaml",
|
|
1147
|
-
".prettierrc.js",
|
|
1148
|
-
".prettierrc.cjs",
|
|
1149
|
-
".prettierrc.mjs",
|
|
1150
|
-
"prettier.config.js",
|
|
1151
|
-
"prettier.config.cjs",
|
|
1152
|
-
"prettier.config.mjs",
|
|
1153
|
-
"prettier.config.ts",
|
|
1154
|
-
];
|
|
1155
|
-
const RUFF_PROJECT_CONFIGS = ["ruff.toml", ".ruff.toml"];
|
|
1156
|
-
const GOLANGCI_CONFIGS = [
|
|
1157
|
-
".golangci.yml",
|
|
1158
|
-
".golangci.yaml",
|
|
1159
|
-
".golangci.toml",
|
|
1160
|
-
".golangci.json",
|
|
1161
|
-
];
|
|
1162
|
-
const PHPSTAN_CONFIGS = [
|
|
1163
|
-
"phpstan.neon",
|
|
1164
|
-
"phpstan.neon.dist",
|
|
1165
|
-
"phpstan.dist.neon",
|
|
1166
|
-
];
|
|
1167
|
-
const VITE_CONFIGS = [
|
|
1168
|
-
"vite.config.ts",
|
|
1169
|
-
"vite.config.mts",
|
|
1170
|
-
"vite.config.cts",
|
|
1171
|
-
"vite.config.js",
|
|
1172
|
-
"vite.config.mjs",
|
|
1173
|
-
"vite.config.cjs",
|
|
1174
|
-
];
|
|
1175
|
-
export function getLinterPolicyForFile(filePath, context = {}) {
|
|
1176
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
1177
|
-
if ([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"].includes(ext)) {
|
|
1178
|
-
const policy = getJstsLintPolicy({
|
|
1179
|
-
hasEslintConfig: context.hasEslintConfig,
|
|
1180
|
-
hasOxlintConfig: context.hasOxlintConfig,
|
|
1181
|
-
hasBiomeConfig: context.hasBiomeConfig,
|
|
1182
|
-
});
|
|
1183
|
-
return {
|
|
1184
|
-
runnerNames: ["eslint", "oxlint", "biome-check-json"],
|
|
1185
|
-
preferredRunners: policy.preferredRunners,
|
|
1186
|
-
defaultRunner: policy.preferredRunners[0],
|
|
1187
|
-
defaultWhenUnconfigured: !policy.hasEslintConfig && !policy.hasOxlintConfig,
|
|
1188
|
-
gate: policy.hasEslintConfig ? "config-first" : "smart-default",
|
|
1189
|
-
};
|
|
1190
|
-
}
|
|
1191
|
-
if ([".py", ".pyi"].includes(ext)) {
|
|
1192
|
-
const preferredRunners = ["ruff-lint"];
|
|
1193
|
-
if (context.hasMypyConfig)
|
|
1194
|
-
preferredRunners.push("mypy");
|
|
1195
|
-
return {
|
|
1196
|
-
runnerNames: ["ruff-lint", "mypy"],
|
|
1197
|
-
preferredRunners,
|
|
1198
|
-
defaultRunner: "ruff-lint",
|
|
1199
|
-
defaultWhenUnconfigured: true,
|
|
1200
|
-
gate: context.hasMypyConfig ? "mixed" : "smart-default",
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
|
-
if ([".css", ".scss", ".sass", ".less"].includes(ext)) {
|
|
1204
|
-
return {
|
|
1205
|
-
runnerNames: ["stylelint"],
|
|
1206
|
-
preferredRunners: ["stylelint"],
|
|
1207
|
-
defaultRunner: "stylelint",
|
|
1208
|
-
defaultWhenUnconfigured: true,
|
|
1209
|
-
gate: "smart-default",
|
|
1210
|
-
};
|
|
1211
|
-
}
|
|
1212
|
-
if (ext === ".sql") {
|
|
1213
|
-
return {
|
|
1214
|
-
runnerNames: ["sqlfluff"],
|
|
1215
|
-
preferredRunners: ["sqlfluff"],
|
|
1216
|
-
defaultRunner: "sqlfluff",
|
|
1217
|
-
defaultWhenUnconfigured: false,
|
|
1218
|
-
gate: "config-first",
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
if ([".rb", ".rake", ".gemspec", ".ru"].includes(ext)) {
|
|
1222
|
-
return {
|
|
1223
|
-
runnerNames: ["rubocop"],
|
|
1224
|
-
preferredRunners: ["rubocop"],
|
|
1225
|
-
defaultRunner: "rubocop",
|
|
1226
|
-
defaultWhenUnconfigured: true,
|
|
1227
|
-
gate: "smart-default",
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
if ([".yaml", ".yml"].includes(ext)) {
|
|
1231
|
-
return {
|
|
1232
|
-
runnerNames: ["yamllint"],
|
|
1233
|
-
preferredRunners: ["yamllint"],
|
|
1234
|
-
defaultRunner: "yamllint",
|
|
1235
|
-
defaultWhenUnconfigured: true,
|
|
1236
|
-
gate: "smart-default",
|
|
1237
|
-
};
|
|
1238
|
-
}
|
|
1239
|
-
if ([".md", ".mdx"].includes(ext)) {
|
|
1240
|
-
return {
|
|
1241
|
-
runnerNames: ["markdownlint"],
|
|
1242
|
-
preferredRunners: ["markdownlint"],
|
|
1243
|
-
defaultRunner: "markdownlint",
|
|
1244
|
-
defaultWhenUnconfigured: true,
|
|
1245
|
-
gate: "smart-default",
|
|
1246
|
-
};
|
|
1247
|
-
}
|
|
1248
|
-
if ([".html", ".htm"].includes(ext)) {
|
|
1249
|
-
return {
|
|
1250
|
-
runnerNames: ["htmlhint"],
|
|
1251
|
-
preferredRunners: ["htmlhint"],
|
|
1252
|
-
defaultRunner: "htmlhint",
|
|
1253
|
-
defaultWhenUnconfigured: true,
|
|
1254
|
-
gate: "smart-default",
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
if (path.basename(filePath).toLowerCase() === "dockerfile") {
|
|
1258
|
-
return {
|
|
1259
|
-
runnerNames: ["hadolint"],
|
|
1260
|
-
preferredRunners: ["hadolint"],
|
|
1261
|
-
defaultRunner: "hadolint",
|
|
1262
|
-
defaultWhenUnconfigured: true,
|
|
1263
|
-
gate: "smart-default",
|
|
1264
|
-
};
|
|
1265
|
-
}
|
|
1266
|
-
if (TERRAGRUNT_FILENAMES.includes(path.basename(filePath).toLowerCase())) {
|
|
1267
|
-
return {
|
|
1268
|
-
runnerNames: ["terragrunt"],
|
|
1269
|
-
preferredRunners: ["terragrunt"],
|
|
1270
|
-
defaultRunner: "terragrunt",
|
|
1271
|
-
defaultWhenUnconfigured: true,
|
|
1272
|
-
gate: "smart-default",
|
|
1273
|
-
};
|
|
1274
|
-
}
|
|
1275
|
-
if ([".kt", ".kts"].includes(ext)) {
|
|
1276
|
-
// When the project opts into ktfmt, ktfmt (a pure formatter wired as a safe
|
|
1277
|
-
// autofix) owns Kotlin formatting; ktlint's lint steps aside so its style
|
|
1278
|
-
// suggestions don't conflict with ktfmt's output. detekt's *semantic* lint
|
|
1279
|
-
// still runs when configured. #129
|
|
1280
|
-
const preferredRunners = [];
|
|
1281
|
-
if (!context.hasKtfmtConfig)
|
|
1282
|
-
preferredRunners.push("ktlint");
|
|
1283
|
-
if (context.hasDetektConfig)
|
|
1284
|
-
preferredRunners.push("detekt");
|
|
1285
|
-
return {
|
|
1286
|
-
runnerNames: ["ktlint", "detekt"],
|
|
1287
|
-
preferredRunners,
|
|
1288
|
-
defaultRunner: preferredRunners[0],
|
|
1289
|
-
defaultWhenUnconfigured: true,
|
|
1290
|
-
gate: context.hasKtfmtConfig
|
|
1291
|
-
? "config-first"
|
|
1292
|
-
: context.hasDetektConfig
|
|
1293
|
-
? "mixed"
|
|
1294
|
-
: "smart-default",
|
|
1295
|
-
};
|
|
1296
|
-
}
|
|
1297
|
-
if (ext === ".toml") {
|
|
1298
|
-
return {
|
|
1299
|
-
runnerNames: ["taplo"],
|
|
1300
|
-
preferredRunners: ["taplo"],
|
|
1301
|
-
defaultRunner: "taplo",
|
|
1302
|
-
defaultWhenUnconfigured: true,
|
|
1303
|
-
gate: "smart-default",
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
if (ext === ".go") {
|
|
1307
|
-
return {
|
|
1308
|
-
runnerNames: ["golangci-lint"],
|
|
1309
|
-
preferredRunners: context.hasGolangciConfig ? ["golangci-lint"] : [],
|
|
1310
|
-
defaultRunner: "golangci-lint",
|
|
1311
|
-
defaultWhenUnconfigured: false,
|
|
1312
|
-
gate: "config-first",
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
if (ext === ".php") {
|
|
1316
|
-
return {
|
|
1317
|
-
runnerNames: ["phpstan"],
|
|
1318
|
-
preferredRunners: context.hasPhpstanConfig ? ["phpstan"] : [],
|
|
1319
|
-
defaultRunner: "phpstan",
|
|
1320
|
-
defaultWhenUnconfigured: false,
|
|
1321
|
-
gate: "config-first",
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
|
-
if (ext === ".rs") {
|
|
1325
|
-
return {
|
|
1326
|
-
runnerNames: ["rust-clippy"],
|
|
1327
|
-
preferredRunners: ["rust-clippy"],
|
|
1328
|
-
defaultRunner: "rust-clippy",
|
|
1329
|
-
defaultWhenUnconfigured: true,
|
|
1330
|
-
gate: "smart-default",
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
if ([".sh", ".bash"].includes(ext)) {
|
|
1334
|
-
return {
|
|
1335
|
-
runnerNames: ["shellcheck"],
|
|
1336
|
-
preferredRunners: ["shellcheck"],
|
|
1337
|
-
defaultRunner: "shellcheck",
|
|
1338
|
-
defaultWhenUnconfigured: true,
|
|
1339
|
-
gate: "smart-default",
|
|
1340
|
-
};
|
|
1341
|
-
}
|
|
1342
|
-
if (ext === ".fish") {
|
|
1343
|
-
return {
|
|
1344
|
-
runnerNames: ["fish-indent"],
|
|
1345
|
-
preferredRunners: ["fish-indent"],
|
|
1346
|
-
defaultRunner: "fish-indent",
|
|
1347
|
-
defaultWhenUnconfigured: true,
|
|
1348
|
-
gate: "smart-default",
|
|
1349
|
-
};
|
|
1350
|
-
}
|
|
1351
|
-
if ([".tf", ".tfvars"].includes(ext)) {
|
|
1352
|
-
return {
|
|
1353
|
-
runnerNames: ["tflint"],
|
|
1354
|
-
preferredRunners: ["tflint"],
|
|
1355
|
-
defaultRunner: "tflint",
|
|
1356
|
-
defaultWhenUnconfigured: true,
|
|
1357
|
-
gate: context.hasTflintConfig ? "config-first" : "smart-default",
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
if ([".ex", ".exs", ".eex", ".heex", ".leex"].includes(ext)) {
|
|
1361
|
-
return {
|
|
1362
|
-
runnerNames: ["credo"],
|
|
1363
|
-
preferredRunners: ["credo"],
|
|
1364
|
-
defaultRunner: "credo",
|
|
1365
|
-
defaultWhenUnconfigured: true,
|
|
1366
|
-
gate: "smart-default",
|
|
1367
|
-
};
|
|
1368
|
-
}
|
|
1369
|
-
if ([".c", ".cc", ".cpp", ".cxx", ".h", ".hpp", ".ino"].includes(ext)) {
|
|
1370
|
-
return {
|
|
1371
|
-
runnerNames: ["cpp-check"],
|
|
1372
|
-
preferredRunners: ["cpp-check"],
|
|
1373
|
-
defaultRunner: "cpp-check",
|
|
1374
|
-
defaultWhenUnconfigured: true,
|
|
1375
|
-
gate: "smart-default",
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
if (ext === ".dart") {
|
|
1379
|
-
return {
|
|
1380
|
-
runnerNames: ["dart-analyze"],
|
|
1381
|
-
preferredRunners: ["dart-analyze"],
|
|
1382
|
-
defaultRunner: "dart-analyze",
|
|
1383
|
-
defaultWhenUnconfigured: true,
|
|
1384
|
-
gate: "smart-default",
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1387
|
-
if (ext === ".gleam") {
|
|
1388
|
-
return {
|
|
1389
|
-
runnerNames: ["gleam-check"],
|
|
1390
|
-
preferredRunners: ["gleam-check"],
|
|
1391
|
-
defaultRunner: "gleam-check",
|
|
1392
|
-
defaultWhenUnconfigured: true,
|
|
1393
|
-
gate: "smart-default",
|
|
1394
|
-
};
|
|
1395
|
-
}
|
|
1396
|
-
if ([".ps1", ".psm1", ".psd1"].includes(ext)) {
|
|
1397
|
-
return {
|
|
1398
|
-
runnerNames: ["psscriptanalyzer"],
|
|
1399
|
-
preferredRunners: ["psscriptanalyzer"],
|
|
1400
|
-
defaultRunner: "psscriptanalyzer",
|
|
1401
|
-
defaultWhenUnconfigured: true,
|
|
1402
|
-
gate: "smart-default",
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
if (ext === ".prisma") {
|
|
1406
|
-
return {
|
|
1407
|
-
runnerNames: ["prisma-validate"],
|
|
1408
|
-
preferredRunners: ["prisma-validate"],
|
|
1409
|
-
defaultRunner: "prisma-validate",
|
|
1410
|
-
defaultWhenUnconfigured: true,
|
|
1411
|
-
gate: "smart-default",
|
|
1412
|
-
};
|
|
1413
|
-
}
|
|
1414
|
-
return undefined;
|
|
1415
|
-
}
|
|
1416
|
-
/**
|
|
1417
|
-
* Returns the cached `ProjectConventions` for `cwd` if a project snapshot
|
|
1418
|
-
* exists, otherwise `undefined`. Reads from the snapshot file rather than
|
|
1419
|
-
* re-running the detector so the hot path (per-file dispatch) stays cheap.
|
|
1420
|
-
*
|
|
1421
|
-
* The snapshot is refreshed by `saveRuntimeProjectSnapshot` during the
|
|
1422
|
-
* normal runtime lifecycle, so consumers see a value updated at session-
|
|
1423
|
-
* start / project-seq bumps rather than on every read.
|
|
1424
|
-
*/
|
|
1425
|
-
export function getCachedProjectConventions(cwd) {
|
|
1426
|
-
const snapshot = loadProjectSnapshotWithoutWordIndex(cwd);
|
|
1427
|
-
return snapshot?.conventions;
|
|
1428
|
-
}
|
|
1429
|
-
export function getLinterPolicyForCwd(filePath, cwd) {
|
|
1430
|
-
const context = {
|
|
1431
|
-
hasEslintConfig: hasEslintConfig(cwd),
|
|
1432
|
-
hasOxlintConfig: hasOxlintConfig(cwd),
|
|
1433
|
-
hasBiomeConfig: hasBiomeConfig(cwd),
|
|
1434
|
-
hasStylelintConfig: hasStylelintConfig(cwd),
|
|
1435
|
-
hasSqlfluffConfig: hasSqlfluffConfig(cwd),
|
|
1436
|
-
hasRubocopConfig: hasRubocopConfig(cwd),
|
|
1437
|
-
hasYamllintConfig: hasYamllintConfig(cwd),
|
|
1438
|
-
hasMarkdownlintConfig: hasMarkdownlintConfig(cwd),
|
|
1439
|
-
hasGolangciConfig: hasGolangciConfig(cwd),
|
|
1440
|
-
hasPhpstanConfig: hasPhpstanConfig(cwd),
|
|
1441
|
-
hasMypyConfig: hasMypyConfig(cwd),
|
|
1442
|
-
hasDetektConfig: hasDetektConfig(cwd),
|
|
1443
|
-
hasKtfmtConfig: hasKtfmtConfig(cwd),
|
|
1444
|
-
// From the file's directory, not cwd: a `.tflint.hcl` in a terraform
|
|
1445
|
-
// subdirectory is invisible to an upward walk that starts at the repo root.
|
|
1446
|
-
hasTflintConfig: hasTflintConfig(path.dirname(path.resolve(cwd, filePath))),
|
|
1447
|
-
};
|
|
1448
|
-
const policy = getLinterPolicyForFile(filePath, context);
|
|
1449
|
-
if (policy) {
|
|
1450
|
-
const conventions = getCachedProjectConventions(cwd);
|
|
1451
|
-
if (conventions && conventions.frameworks.length > 0) {
|
|
1452
|
-
policy.frameworkHints = conventions.frameworks.map((f) => f.id);
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
logLatency({
|
|
1456
|
-
type: "phase",
|
|
1457
|
-
phase: "linter_selected",
|
|
1458
|
-
filePath,
|
|
1459
|
-
durationMs: 0,
|
|
1460
|
-
metadata: {
|
|
1461
|
-
runner: policy?.defaultRunner ?? null,
|
|
1462
|
-
gate: policy?.gate ?? null,
|
|
1463
|
-
cwd,
|
|
1464
|
-
context,
|
|
1465
|
-
frameworkHints: policy?.frameworkHints ?? null,
|
|
1466
|
-
},
|
|
1467
|
-
});
|
|
1468
|
-
return policy;
|
|
1469
|
-
}
|
|
1470
|
-
export function getAutofixPolicyForFile(filePath, context = {}) {
|
|
1471
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
1472
|
-
if ([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"].includes(ext)) {
|
|
1473
|
-
// Mirror the JS/TS lint policy's precedence: eslint (config-first) →
|
|
1474
|
-
// oxlint (config-first) → biome (smart-default). oxlint is config-gated so
|
|
1475
|
-
// it never conflicts with the biome default.
|
|
1476
|
-
if (context.hasEslintConfig) {
|
|
1477
|
-
return {
|
|
1478
|
-
toolNames: ["eslint", "oxlint", "biome"],
|
|
1479
|
-
preferredTools: ["eslint"],
|
|
1480
|
-
defaultTool: "eslint",
|
|
1481
|
-
defaultWhenUnconfigured: false,
|
|
1482
|
-
gate: "config-first",
|
|
1483
|
-
safe: true,
|
|
1484
|
-
};
|
|
1485
|
-
}
|
|
1486
|
-
if (context.hasOxlintConfig) {
|
|
1487
|
-
return {
|
|
1488
|
-
toolNames: ["eslint", "oxlint", "biome"],
|
|
1489
|
-
preferredTools: ["oxlint"],
|
|
1490
|
-
defaultTool: "oxlint",
|
|
1491
|
-
defaultWhenUnconfigured: false,
|
|
1492
|
-
// Mirror the JS lint policy, which gates on eslint only (oxlint vs
|
|
1493
|
-
// biome are both "smart-default" there).
|
|
1494
|
-
gate: "smart-default",
|
|
1495
|
-
safe: true,
|
|
1496
|
-
};
|
|
1497
|
-
}
|
|
1498
|
-
return {
|
|
1499
|
-
toolNames: ["eslint", "oxlint", "biome"],
|
|
1500
|
-
preferredTools: ["biome"],
|
|
1501
|
-
defaultTool: "biome",
|
|
1502
|
-
defaultWhenUnconfigured: true,
|
|
1503
|
-
gate: "smart-default",
|
|
1504
|
-
safe: true,
|
|
1505
|
-
scope: "cargo-project",
|
|
1506
|
-
};
|
|
1507
|
-
}
|
|
1508
|
-
if ([".json", ".jsonc"].includes(ext)) {
|
|
1509
|
-
if (!context.hasBiomeConfig) {
|
|
1510
|
-
return undefined;
|
|
1511
|
-
}
|
|
1512
|
-
return {
|
|
1513
|
-
toolNames: ["biome"],
|
|
1514
|
-
preferredTools: ["biome"],
|
|
1515
|
-
defaultTool: "biome",
|
|
1516
|
-
defaultWhenUnconfigured: false,
|
|
1517
|
-
gate: "config-first",
|
|
1518
|
-
safe: true,
|
|
1519
|
-
};
|
|
1520
|
-
}
|
|
1521
|
-
if ([".py", ".pyi"].includes(ext)) {
|
|
1522
|
-
return {
|
|
1523
|
-
toolNames: ["ruff"],
|
|
1524
|
-
preferredTools: ["ruff"],
|
|
1525
|
-
defaultTool: "ruff",
|
|
1526
|
-
defaultWhenUnconfigured: true,
|
|
1527
|
-
gate: "smart-default",
|
|
1528
|
-
safe: true,
|
|
1529
|
-
};
|
|
1530
|
-
}
|
|
1531
|
-
if ([".css", ".scss", ".sass", ".less"].includes(ext)) {
|
|
1532
|
-
return {
|
|
1533
|
-
toolNames: ["stylelint"],
|
|
1534
|
-
preferredTools: ["stylelint"],
|
|
1535
|
-
defaultTool: "stylelint",
|
|
1536
|
-
defaultWhenUnconfigured: true,
|
|
1537
|
-
gate: "smart-default",
|
|
1538
|
-
safe: true,
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1541
|
-
if (ext === ".sql") {
|
|
1542
|
-
return {
|
|
1543
|
-
toolNames: ["sqlfluff"],
|
|
1544
|
-
preferredTools: ["sqlfluff"],
|
|
1545
|
-
defaultTool: "sqlfluff",
|
|
1546
|
-
defaultWhenUnconfigured: false,
|
|
1547
|
-
gate: "config-first",
|
|
1548
|
-
safe: true,
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
|
-
if ([".rb", ".rake", ".gemspec", ".ru"].includes(ext)) {
|
|
1552
|
-
return {
|
|
1553
|
-
toolNames: ["rubocop"],
|
|
1554
|
-
preferredTools: ["rubocop"],
|
|
1555
|
-
defaultTool: "rubocop",
|
|
1556
|
-
defaultWhenUnconfigured: true,
|
|
1557
|
-
gate: "smart-default",
|
|
1558
|
-
safe: true,
|
|
1559
|
-
};
|
|
1560
|
-
}
|
|
1561
|
-
if ([".kt", ".kts"].includes(ext)) {
|
|
1562
|
-
if (context.hasKtlintConfig) {
|
|
1563
|
-
return {
|
|
1564
|
-
toolNames: ["ktlint", "ktfmt", "detekt"],
|
|
1565
|
-
preferredTools: ["ktlint"],
|
|
1566
|
-
defaultTool: "ktlint",
|
|
1567
|
-
defaultWhenUnconfigured: false,
|
|
1568
|
-
gate: "config-first",
|
|
1569
|
-
safe: true,
|
|
1570
|
-
};
|
|
1571
|
-
}
|
|
1572
|
-
// ktfmt is config-first and the project's explicit formatting choice, so it
|
|
1573
|
-
// wins over both detekt and the ktlint smart-default when opted in (#129).
|
|
1574
|
-
if (context.hasKtfmtConfig) {
|
|
1575
|
-
return {
|
|
1576
|
-
toolNames: ["ktfmt", "detekt", "ktlint"],
|
|
1577
|
-
preferredTools: ["ktfmt"],
|
|
1578
|
-
defaultTool: "ktfmt",
|
|
1579
|
-
defaultWhenUnconfigured: false,
|
|
1580
|
-
gate: "config-first",
|
|
1581
|
-
safe: true,
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1584
|
-
// detekt --auto-correct is config-first; with a detekt config present it
|
|
1585
|
-
// wins over the ktlint smart-default (and is the autofix path on Windows,
|
|
1586
|
-
// where ktlint's install is currently broken, #218).
|
|
1587
|
-
if (context.hasDetektConfig) {
|
|
1588
|
-
return {
|
|
1589
|
-
toolNames: ["detekt", "ktlint"],
|
|
1590
|
-
preferredTools: ["detekt"],
|
|
1591
|
-
defaultTool: "detekt",
|
|
1592
|
-
defaultWhenUnconfigured: false,
|
|
1593
|
-
gate: "config-first",
|
|
1594
|
-
safe: true,
|
|
1595
|
-
};
|
|
1596
|
-
}
|
|
1597
|
-
return {
|
|
1598
|
-
toolNames: ["ktlint", "detekt"],
|
|
1599
|
-
preferredTools: ["ktlint"],
|
|
1600
|
-
defaultTool: "ktlint",
|
|
1601
|
-
defaultWhenUnconfigured: true,
|
|
1602
|
-
gate: "smart-default",
|
|
1603
|
-
safe: true,
|
|
1604
|
-
};
|
|
1605
|
-
}
|
|
1606
|
-
if (ext === ".go") {
|
|
1607
|
-
// golangci-lint run --fix is config-first: only apply when the project
|
|
1608
|
-
// opted in with a .golangci.* config.
|
|
1609
|
-
return {
|
|
1610
|
-
toolNames: ["golangci-lint"],
|
|
1611
|
-
preferredTools: context.hasGolangciConfig ? ["golangci-lint"] : [],
|
|
1612
|
-
defaultTool: "golangci-lint",
|
|
1613
|
-
defaultWhenUnconfigured: false,
|
|
1614
|
-
gate: "config-first",
|
|
1615
|
-
safe: true,
|
|
1616
|
-
};
|
|
1617
|
-
}
|
|
1618
|
-
if ([".md", ".mdx"].includes(ext)) {
|
|
1619
|
-
// markdownlint --fix is a smart-default (deterministic MD### fixes run with
|
|
1620
|
-
// built-in rules; config optional) — matches the markdownlint lint policy.
|
|
1621
|
-
return {
|
|
1622
|
-
toolNames: ["markdownlint"],
|
|
1623
|
-
preferredTools: ["markdownlint"],
|
|
1624
|
-
defaultTool: "markdownlint",
|
|
1625
|
-
defaultWhenUnconfigured: true,
|
|
1626
|
-
gate: "smart-default",
|
|
1627
|
-
safe: true,
|
|
1628
|
-
};
|
|
1629
|
-
}
|
|
1630
|
-
if (ext === ".rs") {
|
|
1631
|
-
return {
|
|
1632
|
-
toolNames: ["rust-clippy"],
|
|
1633
|
-
preferredTools: ["rust-clippy"],
|
|
1634
|
-
defaultTool: "rust-clippy",
|
|
1635
|
-
defaultWhenUnconfigured: true,
|
|
1636
|
-
gate: "smart-default",
|
|
1637
|
-
safe: true,
|
|
1638
|
-
};
|
|
1639
|
-
}
|
|
1640
|
-
if (ext === ".dart") {
|
|
1641
|
-
return {
|
|
1642
|
-
toolNames: ["dart-analyze"],
|
|
1643
|
-
preferredTools: ["dart-analyze"],
|
|
1644
|
-
defaultTool: "dart-analyze",
|
|
1645
|
-
defaultWhenUnconfigured: true,
|
|
1646
|
-
gate: "smart-default",
|
|
1647
|
-
safe: true,
|
|
1648
|
-
scope: "dart-project",
|
|
1649
|
-
};
|
|
1650
|
-
}
|
|
1651
|
-
return undefined;
|
|
1652
|
-
}
|
|
1653
|
-
export function getPreferredAutofixTools(filePath, context) {
|
|
1654
|
-
return getAutofixPolicyForFile(filePath, context)?.preferredTools ?? [];
|
|
1655
|
-
}
|
|
1656
|
-
// Flat-config filenames resolve like ESLint itself: upward from cwd without
|
|
1657
|
-
// stopping at an intermediate package.json (#3017, shape 39). Legacy
|
|
1658
|
-
// `.eslintrc.*` names and the `package.json#eslintConfig` field keep the
|
|
1659
|
-
// historic per-package boundary below.
|
|
1660
|
-
const ESLINT_FLAT_CONFIGS = [
|
|
1661
|
-
"eslint.config.js",
|
|
1662
|
-
"eslint.config.mjs",
|
|
1663
|
-
"eslint.config.cjs",
|
|
1664
|
-
"eslint.config.ts",
|
|
1665
|
-
"eslint.config.mts",
|
|
1666
|
-
"eslint.config.cts",
|
|
1667
|
-
];
|
|
1668
|
-
const ESLINT_LEGACY_CONFIGS = [
|
|
1669
|
-
".eslintrc",
|
|
1670
|
-
".eslintrc.js",
|
|
1671
|
-
".eslintrc.cjs",
|
|
1672
|
-
".eslintrc.json",
|
|
1673
|
-
".eslintrc.yaml",
|
|
1674
|
-
".eslintrc.yml",
|
|
1675
|
-
];
|
|
1676
|
-
function* walkUpDirsUntilPackageJson(cwd) {
|
|
1677
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1678
|
-
yield dir;
|
|
1679
|
-
if (fs.existsSync(path.join(dir, "package.json")))
|
|
1680
|
-
return;
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
function findNearestPackageJsonPath(cwd) {
|
|
1684
|
-
let dir = cwd;
|
|
1685
|
-
const root = path.parse(dir).root;
|
|
1686
|
-
while (true) {
|
|
1687
|
-
const pkgPath = path.join(dir, "package.json");
|
|
1688
|
-
if (fs.existsSync(pkgPath))
|
|
1689
|
-
return pkgPath;
|
|
1690
|
-
if (dir === root)
|
|
1691
|
-
break;
|
|
1692
|
-
const parent = path.dirname(dir);
|
|
1693
|
-
if (parent === dir)
|
|
1694
|
-
break;
|
|
1695
|
-
dir = parent;
|
|
1696
|
-
}
|
|
1697
|
-
return undefined;
|
|
1698
|
-
}
|
|
1699
|
-
export function hasNearestPackageJsonDependency(cwd, dependencyName) {
|
|
1700
|
-
const pkgPath = findNearestPackageJsonPath(cwd);
|
|
1701
|
-
if (!pkgPath)
|
|
1702
|
-
return false;
|
|
1703
|
-
try {
|
|
1704
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
1705
|
-
return Boolean(pkg.dependencies?.[dependencyName] ??
|
|
1706
|
-
pkg.devDependencies?.[dependencyName]);
|
|
1707
|
-
}
|
|
1708
|
-
catch { }
|
|
1709
|
-
return false;
|
|
1710
|
-
}
|
|
1711
|
-
export function hasNearestPackageJsonField(cwd, fieldName) {
|
|
1712
|
-
const pkgPath = findNearestPackageJsonPath(cwd);
|
|
1713
|
-
if (!pkgPath)
|
|
1714
|
-
return false;
|
|
1715
|
-
try {
|
|
1716
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
1717
|
-
return pkg[fieldName] !== undefined;
|
|
1718
|
-
}
|
|
1719
|
-
catch { }
|
|
1720
|
-
return false;
|
|
1721
|
-
}
|
|
1722
|
-
export function hasEslintConfig(cwd) {
|
|
1723
|
-
// Flat configs mirror ESLint's own discovery: every ancestor dir up to
|
|
1724
|
-
// the filesystem root, ignoring intermediate package.json boundaries, so
|
|
1725
|
-
// a monorepo root config stays visible from inside a nested package.
|
|
1726
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1727
|
-
for (const cfg of ESLINT_FLAT_CONFIGS) {
|
|
1728
|
-
if (fs.existsSync(path.join(dir, cfg)))
|
|
1729
|
-
return true;
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
// Legacy `.eslintrc.*` and `package.json#eslintConfig` keep per-package
|
|
1733
|
-
// semantics: the walk stops at the nearest package.json.
|
|
1734
|
-
for (const dir of walkUpDirsUntilPackageJson(cwd)) {
|
|
1735
|
-
for (const cfg of ESLINT_LEGACY_CONFIGS) {
|
|
1736
|
-
if (fs.existsSync(path.join(dir, cfg)))
|
|
1737
|
-
return true;
|
|
1738
|
-
}
|
|
1739
|
-
const pkgPath = path.join(dir, "package.json");
|
|
1740
|
-
if (fs.existsSync(pkgPath)) {
|
|
1741
|
-
try {
|
|
1742
|
-
if (JSON.parse(fs.readFileSync(pkgPath, "utf-8")).eslintConfig)
|
|
1743
|
-
return true;
|
|
1744
|
-
}
|
|
1745
|
-
catch { }
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
return false;
|
|
1749
|
-
}
|
|
1750
|
-
export function hasBiomeConfig(cwd) {
|
|
1751
|
-
return getBiomeConfigPath(cwd) !== undefined;
|
|
1752
|
-
}
|
|
1753
|
-
export function getBiomeConfigPath(cwd) {
|
|
1754
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1755
|
-
const jsoncPath = path.join(dir, "biome.jsonc");
|
|
1756
|
-
if (fs.existsSync(jsoncPath))
|
|
1757
|
-
return jsoncPath;
|
|
1758
|
-
const jsonPath = path.join(dir, "biome.json");
|
|
1759
|
-
if (fs.existsSync(jsonPath))
|
|
1760
|
-
return jsonPath;
|
|
1761
|
-
}
|
|
1762
|
-
return undefined;
|
|
1763
|
-
}
|
|
1764
|
-
export function hasOxfmtConfig(cwd) {
|
|
1765
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1766
|
-
if (fs.existsSync(path.join(dir, "oxfmt.toml")))
|
|
1767
|
-
return true;
|
|
1768
|
-
if (fs.existsSync(path.join(dir, ".oxfmtrc.json")))
|
|
1769
|
-
return true;
|
|
1770
|
-
if (hasVitePlusConfig(dir))
|
|
1771
|
-
return true;
|
|
1772
|
-
const pkgPath = path.join(dir, "package.json");
|
|
1773
|
-
if (fs.existsSync(pkgPath)) {
|
|
1774
|
-
try {
|
|
1775
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
1776
|
-
const deps = {
|
|
1777
|
-
...pkg.dependencies,
|
|
1778
|
-
...pkg.devDependencies,
|
|
1779
|
-
};
|
|
1780
|
-
// Published package is `oxfmt`; the scoped name does not exist on npm.
|
|
1781
|
-
if (deps["oxfmt"] || deps["@oxc-project/oxfmt"])
|
|
1782
|
-
return true;
|
|
1783
|
-
}
|
|
1784
|
-
catch { }
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
return false;
|
|
1788
|
-
}
|
|
1789
|
-
// Empirically verified against the real `oxfmt` npm package (0.62.0), a
|
|
1790
|
-
// scratch fixture, and a plain `Component.svelte` — see PR body for the full
|
|
1791
|
-
// four-cell matrix. Both conditions are required; either alone always fails:
|
|
1792
|
-
// - no `svelte` package, no config flag -> exit 2 ("excluded by ignore rules")
|
|
1793
|
-
// - no `svelte` package, config flag on -> exit 2 ("Cannot find module 'svelte/compiler'")
|
|
1794
|
-
// - `svelte` package installed, no flag -> exit 2 ("excluded by ignore rules")
|
|
1795
|
-
// - `svelte` package installed, flag on -> exit 0, formats the file
|
|
1796
|
-
// Per https://oxc.rs/docs/guide/usage/formatter/language-support.html, oxfmt
|
|
1797
|
-
// also requires the npm-distributed binary (not the standalone GitHub-release
|
|
1798
|
-
// binary) for `.svelte` — pi-lens already resolves oxfmt via `findInNodeModules`/
|
|
1799
|
-
// `which`, which favors the npm-installed binary, so that requirement is not
|
|
1800
|
-
// separately re-checked here.
|
|
1801
|
-
//
|
|
1802
|
-
// Known limits of this line-match heuristic (#1134 P3 tail 1): it tolerates a
|
|
1803
|
-
// trailing `#`-comment after the value (`svelte = true # enable`), but it is
|
|
1804
|
-
// NOT a real TOML parser — a `svelte = true` occurrence nested under a
|
|
1805
|
-
// `[table]` section, or one embedded inside a multi-line/triple-quoted string
|
|
1806
|
-
// value, would still match and false-positive. Both are considered acceptable
|
|
1807
|
-
// risk: an oxfmt.toml sectioning `svelte` under a table is not a realistic
|
|
1808
|
-
// config shape for this single top-level boolean key, and a false positive
|
|
1809
|
-
// here only causes oxfmt to be OFFERED (still gated by oxfmt actually running
|
|
1810
|
-
// and the `svelte` package check above), never a silent formatter failure.
|
|
1811
|
-
const OXFMT_SVELTE_TOML_TRUE = /(^|\n)\s*svelte\s*=\s*true\s*(\s*#.*)?(\r?\n|$)/;
|
|
1812
|
-
export function hasOxfmtSvelteConfig(cwd) {
|
|
1813
|
-
// Monorepo asymmetry (#1134 P3 tail 2): this dependency check stops at the
|
|
1814
|
-
// NEAREST package.json (`hasNearestPackageJsonDependency`), while the
|
|
1815
|
-
// config walk below (`walkUpDirs`) continues all the way to the repo root.
|
|
1816
|
-
// A root-level `svelte` dependency combined with an oxfmt config at the
|
|
1817
|
-
// root, but invoked with a sub-package `cwd` that has its own
|
|
1818
|
-
// (svelte-less) package.json, under-offers oxfmt for that sub-package —
|
|
1819
|
-
// the same nearest-vs-root-walk asymmetry as the `.tflint.hcl` note in
|
|
1820
|
-
// `getLinterPolicyForCwd` above. This is untested/deliberately unfixed:
|
|
1821
|
-
// failing to offer a valid formatter is safe (never mis-offers one that
|
|
1822
|
-
// then fails at runtime), unlike the inverse.
|
|
1823
|
-
if (!hasNearestPackageJsonDependency(cwd, "svelte"))
|
|
1824
|
-
return false;
|
|
1825
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1826
|
-
const rcPath = path.join(dir, ".oxfmtrc.json");
|
|
1827
|
-
if (fs.existsSync(rcPath)) {
|
|
1828
|
-
try {
|
|
1829
|
-
const cfg = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
|
|
1830
|
-
if (cfg.svelte === true)
|
|
1831
|
-
return true;
|
|
1832
|
-
}
|
|
1833
|
-
catch { }
|
|
1834
|
-
}
|
|
1835
|
-
// oxfmt.toml is TOML; pi-lens has no TOML parser dependency, so this is
|
|
1836
|
-
// a targeted line match for the single boolean key rather than a full
|
|
1837
|
-
// parse (same pragmatic style as hasVitePlusConfig's content.includes
|
|
1838
|
-
// check above) — presence of the file alone is NOT sufficient, since a
|
|
1839
|
-
// TOML config can omit `svelte` or set it false.
|
|
1840
|
-
const tomlPath = path.join(dir, "oxfmt.toml");
|
|
1841
|
-
if (fs.existsSync(tomlPath)) {
|
|
1842
|
-
try {
|
|
1843
|
-
const content = fs.readFileSync(tomlPath, "utf-8");
|
|
1844
|
-
if (OXFMT_SVELTE_TOML_TRUE.test(content))
|
|
1845
|
-
return true;
|
|
1846
|
-
}
|
|
1847
|
-
catch { }
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
return false;
|
|
1851
|
-
}
|
|
1852
|
-
export function hasStylelintConfig(cwd) {
|
|
1853
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1854
|
-
if (STYLELINT_CONFIGS.some((cfg) => fs.existsSync(path.join(dir, cfg)))) {
|
|
1855
|
-
return true;
|
|
1856
|
-
}
|
|
1857
|
-
const pkgPath = path.join(dir, "package.json");
|
|
1858
|
-
if (fs.existsSync(pkgPath)) {
|
|
1859
|
-
try {
|
|
1860
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
1861
|
-
if (pkg.stylelint)
|
|
1862
|
-
return true;
|
|
1863
|
-
}
|
|
1864
|
-
catch { }
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
return false;
|
|
1868
|
-
}
|
|
1869
|
-
export function hasSqlfluffConfig(cwd) {
|
|
1870
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1871
|
-
for (const cfg of SQLFLUFF_CONFIGS) {
|
|
1872
|
-
const cfgPath = path.join(dir, cfg);
|
|
1873
|
-
if (!fs.existsSync(cfgPath))
|
|
1874
|
-
continue;
|
|
1875
|
-
if (cfg === "pyproject.toml") {
|
|
1876
|
-
try {
|
|
1877
|
-
const content = fs.readFileSync(cfgPath, "utf-8");
|
|
1878
|
-
if (content.includes("[tool.sqlfluff]"))
|
|
1879
|
-
return true;
|
|
1880
|
-
}
|
|
1881
|
-
catch { }
|
|
1882
|
-
continue;
|
|
1883
|
-
}
|
|
1884
|
-
if (cfg === "setup.cfg" || cfg === "tox.ini") {
|
|
1885
|
-
try {
|
|
1886
|
-
const content = fs.readFileSync(cfgPath, "utf-8");
|
|
1887
|
-
if (content.includes("[sqlfluff]"))
|
|
1888
|
-
return true;
|
|
1889
|
-
}
|
|
1890
|
-
catch { }
|
|
1891
|
-
continue;
|
|
1892
|
-
}
|
|
1893
|
-
return true;
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1897
|
-
for (const depFile of ["requirements.txt", "Pipfile", "pyproject.toml"]) {
|
|
1898
|
-
const depPath = path.join(dir, depFile);
|
|
1899
|
-
if (!fs.existsSync(depPath))
|
|
1900
|
-
continue;
|
|
1901
|
-
try {
|
|
1902
|
-
const content = fs.readFileSync(depPath, "utf-8").toLowerCase();
|
|
1903
|
-
if (content.includes("sqlfluff"))
|
|
1904
|
-
return true;
|
|
1905
|
-
}
|
|
1906
|
-
catch { }
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
return false;
|
|
1910
|
-
}
|
|
1911
|
-
export function hasRubocopConfig(cwd) {
|
|
1912
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1913
|
-
for (const cfg of RUBOCOP_CONFIGS) {
|
|
1914
|
-
if (fs.existsSync(path.join(dir, cfg)))
|
|
1915
|
-
return true;
|
|
1916
|
-
}
|
|
1917
|
-
const gemfile = path.join(dir, "Gemfile");
|
|
1918
|
-
if (fs.existsSync(gemfile)) {
|
|
1919
|
-
try {
|
|
1920
|
-
const content = fs.readFileSync(gemfile, "utf-8");
|
|
1921
|
-
if (content.includes("rubocop"))
|
|
1922
|
-
return true;
|
|
1923
|
-
}
|
|
1924
|
-
catch { }
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
return false;
|
|
1928
|
-
}
|
|
1929
|
-
export function hasMypyConfig(cwd) {
|
|
1930
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1931
|
-
for (const cfg of MYPY_CONFIGS) {
|
|
1932
|
-
const cfgPath = path.join(dir, cfg);
|
|
1933
|
-
if (!fs.existsSync(cfgPath))
|
|
1934
|
-
continue;
|
|
1935
|
-
if (cfg === "setup.cfg") {
|
|
1936
|
-
try {
|
|
1937
|
-
if (fs.readFileSync(cfgPath, "utf-8").includes("[mypy]"))
|
|
1938
|
-
return true;
|
|
1939
|
-
}
|
|
1940
|
-
catch { }
|
|
1941
|
-
continue;
|
|
1942
|
-
}
|
|
1943
|
-
if (cfg === "pyproject.toml") {
|
|
1944
|
-
try {
|
|
1945
|
-
if (fs.readFileSync(cfgPath, "utf-8").includes("[tool.mypy]"))
|
|
1946
|
-
return true;
|
|
1947
|
-
}
|
|
1948
|
-
catch { }
|
|
1949
|
-
continue;
|
|
1950
|
-
}
|
|
1951
|
-
return true;
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
return false;
|
|
1955
|
-
}
|
|
1956
|
-
export function hasYamllintConfig(cwd) {
|
|
1957
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1958
|
-
for (const cfg of YAMLLINT_CONFIGS) {
|
|
1959
|
-
const cfgPath = path.join(dir, cfg);
|
|
1960
|
-
if (!fs.existsSync(cfgPath))
|
|
1961
|
-
continue;
|
|
1962
|
-
if (cfg === "pyproject.toml") {
|
|
1963
|
-
try {
|
|
1964
|
-
const content = fs.readFileSync(cfgPath, "utf-8");
|
|
1965
|
-
if (content.includes("[tool.yamllint]"))
|
|
1966
|
-
return true;
|
|
1967
|
-
}
|
|
1968
|
-
catch { }
|
|
1969
|
-
continue;
|
|
1970
|
-
}
|
|
1971
|
-
if (cfg === "setup.cfg" || cfg === "tox.ini") {
|
|
1972
|
-
try {
|
|
1973
|
-
const content = fs.readFileSync(cfgPath, "utf-8");
|
|
1974
|
-
if (content.includes("[yamllint]"))
|
|
1975
|
-
return true;
|
|
1976
|
-
}
|
|
1977
|
-
catch { }
|
|
1978
|
-
continue;
|
|
1979
|
-
}
|
|
1980
|
-
return true;
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
1984
|
-
for (const depFile of ["requirements.txt", "Pipfile", "pyproject.toml"]) {
|
|
1985
|
-
const depPath = path.join(dir, depFile);
|
|
1986
|
-
if (!fs.existsSync(depPath))
|
|
1987
|
-
continue;
|
|
1988
|
-
try {
|
|
1989
|
-
const content = fs.readFileSync(depPath, "utf-8").toLowerCase();
|
|
1990
|
-
if (content.includes("yamllint"))
|
|
1991
|
-
return true;
|
|
1992
|
-
}
|
|
1993
|
-
catch { }
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
return false;
|
|
1997
|
-
}
|
|
1998
|
-
export function hasMarkdownlintConfig(cwd) {
|
|
1999
|
-
return findNearestContaining(cwd, MARKDOWNLINT_CONFIGS) !== undefined;
|
|
2000
|
-
}
|
|
2001
|
-
export function hasPrettierConfig(cwd) {
|
|
2002
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2003
|
-
if (PRETTIER_CONFIGS.some((cfg) => fs.existsSync(path.join(dir, cfg))))
|
|
2004
|
-
return true;
|
|
2005
|
-
const pkgPath = path.join(dir, "package.json");
|
|
2006
|
-
if (fs.existsSync(pkgPath)) {
|
|
2007
|
-
try {
|
|
2008
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
2009
|
-
if (Object.hasOwn(pkg, "prettier"))
|
|
2010
|
-
return true;
|
|
2011
|
-
}
|
|
2012
|
-
catch { }
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
return false;
|
|
2016
|
-
}
|
|
2017
|
-
export function hasBlackConfig(cwd) {
|
|
2018
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2019
|
-
const pyproject = path.join(dir, "pyproject.toml");
|
|
2020
|
-
if (fs.existsSync(pyproject)) {
|
|
2021
|
-
try {
|
|
2022
|
-
if (fs.readFileSync(pyproject, "utf-8").includes("[tool.black]"))
|
|
2023
|
-
return true;
|
|
2024
|
-
}
|
|
2025
|
-
catch { }
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2029
|
-
for (const depFile of ["requirements.txt", "Pipfile"]) {
|
|
2030
|
-
const depPath = path.join(dir, depFile);
|
|
2031
|
-
if (!fs.existsSync(depPath))
|
|
2032
|
-
continue;
|
|
2033
|
-
try {
|
|
2034
|
-
if (fs.readFileSync(depPath, "utf-8").toLowerCase().includes("black"))
|
|
2035
|
-
return true;
|
|
2036
|
-
}
|
|
2037
|
-
catch { }
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
return false;
|
|
2041
|
-
}
|
|
2042
|
-
export function hasRuffConfig(cwd) {
|
|
2043
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2044
|
-
for (const cfg of RUFF_PROJECT_CONFIGS) {
|
|
2045
|
-
if (fs.existsSync(path.join(dir, cfg)))
|
|
2046
|
-
return true;
|
|
2047
|
-
}
|
|
2048
|
-
const pyproject = path.join(dir, "pyproject.toml");
|
|
2049
|
-
if (fs.existsSync(pyproject)) {
|
|
2050
|
-
try {
|
|
2051
|
-
if (fs.readFileSync(pyproject, "utf-8").includes("[tool.ruff]"))
|
|
2052
|
-
return true;
|
|
2053
|
-
}
|
|
2054
|
-
catch { }
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
return false;
|
|
2058
|
-
}
|
|
2059
|
-
/**
|
|
2060
|
-
* Shared config-args seam for the markdownlint lint AND autofix surfaces
|
|
2061
|
-
* (#1247). The lint runner (`markdownlint.ts`) and the autofix path
|
|
2062
|
-
* (`pipeline.ts` `tryMarkdownlintFix`) MUST both consume this builder so the
|
|
2063
|
-
* package-owned sensible-defaults config (`config/markdownlint/core.json`) can
|
|
2064
|
-
* never drift apart from the bare `--fix` invocation again.
|
|
2065
|
-
*/
|
|
2066
|
-
/**
|
|
2067
|
-
* Shared fallback shape for the config-args builders (#1247): when the
|
|
2068
|
-
* project has its own config the lint/autofix surfaces pass NO args (the
|
|
2069
|
-
* tool discovers it); otherwise both surfaces point at the package-owned
|
|
2070
|
-
* fallback so the tool never silently runs its default ruleset. One shape
|
|
2071
|
-
* here means the per-tool builders cannot drift from each other.
|
|
2072
|
-
*/
|
|
2073
|
-
function configArgsWithFallback(hasConfig, toolArgs, packageConfigPath) {
|
|
2074
|
-
return hasConfig
|
|
2075
|
-
? []
|
|
2076
|
-
: [...toolArgs, resolvePackagePath(import.meta.url, packageConfigPath)];
|
|
2077
|
-
}
|
|
2078
|
-
export function markdownlintConfigArgs(cwd) {
|
|
2079
|
-
return configArgsWithFallback(hasMarkdownlintConfig(cwd), ["--config"], "config/markdownlint/core.json");
|
|
2080
|
-
}
|
|
2081
|
-
/**
|
|
2082
|
-
* Shared config-args seam for the ruff lint AND autofix surfaces (#1247).
|
|
2083
|
-
* The lint runner (`ruff.ts`) and `ruffClient.fixFileAsync` MUST both consume
|
|
2084
|
-
* this builder so `config/ruff/core.toml` applies on `--fix` too.
|
|
2085
|
-
*/
|
|
2086
|
-
export function ruffConfigArgs(cwd) {
|
|
2087
|
-
return configArgsWithFallback(hasRuffConfig(cwd), ["--config"], "config/ruff/core.toml");
|
|
2088
|
-
}
|
|
2089
|
-
/**
|
|
2090
|
-
* Shared config-args seam for the biome lint AND autofix surfaces (#1247).
|
|
2091
|
-
* The lint runner (`biome-check.ts`) and `biomeClient.fixFileAsync` MUST both
|
|
2092
|
-
* consume this builder so the user's `biome.json(c)` — or the package-owned
|
|
2093
|
-
* `config/biome/core.jsonc` fallback — applies on `lint --write` too.
|
|
2094
|
-
*/
|
|
2095
|
-
export function biomeConfigArgs(cwd) {
|
|
2096
|
-
// A project config wins outright (#1731, discipline A): passing
|
|
2097
|
-
// `--config-path` even when the project ships `biome.json(c)` pinned
|
|
2098
|
-
// biome's config resolution to that ONE file, so a monorepo package
|
|
2099
|
-
// underneath `cwd` with its own `biome.json` never got to extend/override
|
|
2100
|
-
// the root config the way biome's own nested-config resolution allows. No
|
|
2101
|
-
// flag at all lets biome discover it unaided, exactly like the ruff/
|
|
2102
|
-
// markdownlint fallbacks above skip `--config` under the same condition.
|
|
2103
|
-
if (getBiomeConfigPath(cwd))
|
|
2104
|
-
return [];
|
|
2105
|
-
return [
|
|
2106
|
-
"--config-path=" +
|
|
2107
|
-
resolvePackagePath(import.meta.url, "config/biome/core.jsonc"),
|
|
2108
|
-
];
|
|
2109
|
-
}
|
|
2110
|
-
export function hasGolangciConfig(cwd) {
|
|
2111
|
-
return findNearestContaining(cwd, GOLANGCI_CONFIGS) !== undefined;
|
|
2112
|
-
}
|
|
2113
|
-
// tflint ships built-in rules and runs without config, so `.tflint.hcl` is not
|
|
2114
|
-
// a prerequisite — it is the project electing tflint as its terraform linter,
|
|
2115
|
-
// which promotes the policy from smart-default to config-first. Takes a start
|
|
2116
|
-
// directory rather than the project cwd because tflint resolves config
|
|
2117
|
-
// per-directory: callers pass the EDITED FILE's directory so this agrees with
|
|
2118
|
-
// what the runner will actually hand tflint via `--config`.
|
|
2119
|
-
export function hasTflintConfig(startDir) {
|
|
2120
|
-
return findNearestContaining(startDir, [".tflint.hcl"]) !== undefined;
|
|
2121
|
-
}
|
|
2122
|
-
export function hasClangFormatConfig(cwd) {
|
|
2123
|
-
return (findNearestContaining(cwd, [".clang-format", "_clang-format"]) !== undefined);
|
|
2124
|
-
}
|
|
2125
|
-
export function hasPhpCsFixerConfig(cwd) {
|
|
2126
|
-
return (findNearestContaining(cwd, [
|
|
2127
|
-
".php-cs-fixer.php",
|
|
2128
|
-
".php-cs-fixer.dist.php",
|
|
2129
|
-
]) !== undefined);
|
|
2130
|
-
}
|
|
2131
|
-
export function hasStyluaConfig(cwd) {
|
|
2132
|
-
return (findNearestContaining(cwd, ["stylua.toml", ".stylua.toml"]) !== undefined);
|
|
2133
|
-
}
|
|
2134
|
-
export function hasOcamlformatConfig(cwd) {
|
|
2135
|
-
return findNearestContaining(cwd, [".ocamlformat"]) !== undefined;
|
|
2136
|
-
}
|
|
2137
|
-
export function hasGoogleJavaFormatConfig(cwd) {
|
|
2138
|
-
// google-java-format has no standard config file — gate on .editorconfig
|
|
2139
|
-
// with indent_size defined (common Java project signal) or explicit opt-in marker.
|
|
2140
|
-
return (findNearestContaining(cwd, [".google-java-format", ".editorconfig"]) !==
|
|
2141
|
-
undefined);
|
|
2142
|
-
}
|
|
2143
|
-
export function hasCljfmtConfig(cwd) {
|
|
2144
|
-
return (findNearestContaining(cwd, [".cljfmt.edn", "cljfmt.edn", ".cljfmt"]) !==
|
|
2145
|
-
undefined);
|
|
2146
|
-
}
|
|
2147
|
-
export function hasCmakeFormatConfig(cwd) {
|
|
2148
|
-
return (findNearestContaining(cwd, [
|
|
2149
|
-
".cmake-format",
|
|
2150
|
-
".cmake-format.yaml",
|
|
2151
|
-
".cmake-format.yml",
|
|
2152
|
-
".cmake-format.json",
|
|
2153
|
-
".cmake-format.py",
|
|
2154
|
-
"cmake-format.yaml",
|
|
2155
|
-
"cmake-format.yml",
|
|
2156
|
-
]) !== undefined);
|
|
2157
|
-
}
|
|
2158
|
-
// PSScriptAnalyzerSettings.psd1 is the conventional settings file PowerShell
|
|
2159
|
-
// projects use to configure `Invoke-Formatter`/`Invoke-ScriptAnalyzer` (passed
|
|
2160
|
-
// via `-Settings`); `ScriptAnalyzerSettings.psd1` is the same convention minus
|
|
2161
|
-
// the "PS" prefix and shows up in some repos too. Either one opting a project
|
|
2162
|
-
// into explicit PSScriptAnalyzer config is enough to select the formatter
|
|
2163
|
-
// (#1572 — `psscriptanalyzer-format` had no case here at all, so it could
|
|
2164
|
-
// never be selected regardless of project config).
|
|
2165
|
-
const PSSCRIPTANALYZER_SETTINGS_FILES = [
|
|
2166
|
-
"PSScriptAnalyzerSettings.psd1",
|
|
2167
|
-
"ScriptAnalyzerSettings.psd1",
|
|
2168
|
-
];
|
|
2169
|
-
/**
|
|
2170
|
-
* The nearest PSScriptAnalyzer settings file's full path, or `undefined`.
|
|
2171
|
-
* `formatters.ts`'s `resolveCommand` passes this straight to
|
|
2172
|
-
* `Invoke-Formatter -Settings` (#1572 review F2) — gating on the file's
|
|
2173
|
-
* PRESENCE without ever reading its RULES would run the project's file
|
|
2174
|
-
* through the stock `CodeFormatting` ruleset regardless of what it declared,
|
|
2175
|
-
* the same stock-style imposition #1144 banned for the other formatters.
|
|
2176
|
-
*/
|
|
2177
|
-
export function findPSScriptAnalyzerConfigPath(cwd) {
|
|
2178
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2179
|
-
for (const name of PSSCRIPTANALYZER_SETTINGS_FILES) {
|
|
2180
|
-
const candidate = path.join(dir, name);
|
|
2181
|
-
if (fs.existsSync(candidate))
|
|
2182
|
-
return candidate;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
return undefined;
|
|
2186
|
-
}
|
|
2187
|
-
export function hasPSScriptAnalyzerConfig(cwd) {
|
|
2188
|
-
return findPSScriptAnalyzerConfigPath(cwd) !== undefined;
|
|
2189
|
-
}
|
|
2190
|
-
// #1595 sweep — 7 of the 8 formatters #1572 left unreachable (038cd1df flipped
|
|
2191
|
-
// defaultWhenUnconfigured to false for these without adding an explicit-config
|
|
2192
|
-
// check; see EXPLICIT_FORMATTER_CONFIG_CHECKS in formatters.ts). nixfmt is the
|
|
2193
|
-
// 8th and stays unreachable: it is deliberately unconfigurable (no rc file,
|
|
2194
|
-
// no CLI flag surface) and has no project-level manifest marker analogous to
|
|
2195
|
-
// `terraform init`'s lock file, so there is no honest "explicit opt-in" signal
|
|
2196
|
-
// to gate on — see the KNOWN_UNREACHABLE_FORMATTERS comment in
|
|
2197
|
-
// formatter-policy-consistency.test.ts.
|
|
2198
|
-
export function hasCsharpierConfig(cwd) {
|
|
2199
|
-
return (findNearestContaining(cwd, [
|
|
2200
|
-
".csharpierrc",
|
|
2201
|
-
".csharpierrc.json",
|
|
2202
|
-
".csharpierrc.yaml",
|
|
2203
|
-
".csharpierrc.yml",
|
|
2204
|
-
]) !== undefined);
|
|
2205
|
-
}
|
|
2206
|
-
// Ormolu has no general settings file, but it does read a project `.ormolu`
|
|
2207
|
-
// file for custom operator fixity declarations (the only file-based config
|
|
2208
|
-
// surface Ormolu supports) — real, if narrow, per its own docs.
|
|
2209
|
-
export function hasOrmoluConfig(cwd) {
|
|
2210
|
-
return findNearestContaining(cwd, [".ormolu"]) !== undefined;
|
|
2211
|
-
}
|
|
2212
|
-
export function hasTaploConfig(cwd) {
|
|
2213
|
-
return (findNearestContaining(cwd, ["taplo.toml", ".taplo.toml"]) !== undefined);
|
|
2214
|
-
}
|
|
2215
|
-
// `terraform fmt` itself is deliberately unconfigurable (no rc file, no
|
|
2216
|
-
// per-project options — HashiCorp's own docs call this out). The nearest
|
|
2217
|
-
// thing to an explicit per-project opt-in is `.terraform.lock.hcl`, written
|
|
2218
|
-
// only by `terraform init`: it marks a directory the user has deliberately
|
|
2219
|
-
// set up as a Terraform root, as opposed to a stray `.tf`/`.tfvars` file
|
|
2220
|
-
// dropped into an unrelated repo. A manifest marker, per #1595's own guidance
|
|
2221
|
-
// for formatters with no dedicated config-file convention.
|
|
2222
|
-
export function hasTerraformConfig(cwd) {
|
|
2223
|
-
return findNearestContaining(cwd, [".terraform.lock.hcl"]) !== undefined;
|
|
2224
|
-
}
|
|
2225
|
-
export function hasSwiftformatConfig(cwd) {
|
|
2226
|
-
return findNearestContaining(cwd, [".swiftformat"]) !== undefined;
|
|
2227
|
-
}
|
|
2228
|
-
// Fantomas has no dedicated rc file; its documented config surface is
|
|
2229
|
-
// `.editorconfig` (fsharp_*-prefixed keys) or a `.fantomasignore` file (the
|
|
2230
|
-
// one Fantomas-specific marker it does ship). Mirrors hasGoogleJavaFormatConfig's
|
|
2231
|
-
// precedent for formatters whose only config surface is .editorconfig.
|
|
2232
|
-
export function hasFantomasConfig(cwd) {
|
|
2233
|
-
return (findNearestContaining(cwd, [".fantomasignore", ".editorconfig"]) !==
|
|
2234
|
-
undefined);
|
|
2235
|
-
}
|
|
2236
|
-
// `.formatter.exs` is THE convention `mix format` reads project config from
|
|
2237
|
-
// (inputs, line_length, plugins) — universal in Elixir projects that use it.
|
|
2238
|
-
export function hasMixFormatConfig(cwd) {
|
|
2239
|
-
return findNearestContaining(cwd, [".formatter.exs"]) !== undefined;
|
|
2240
|
-
}
|
|
2241
|
-
export function hasPhpstanConfig(cwd) {
|
|
2242
|
-
return findNearestContaining(cwd, PHPSTAN_CONFIGS) !== undefined;
|
|
2243
|
-
}
|
|
2244
|
-
const DETEKT_CONFIGS = [
|
|
2245
|
-
"detekt.yml",
|
|
2246
|
-
".detekt.yml",
|
|
2247
|
-
path.join("config", "detekt", "detekt.yml"),
|
|
2248
|
-
path.join("detekt", "detekt.yml"),
|
|
2249
|
-
];
|
|
2250
|
-
export function hasDetektConfig(cwd) {
|
|
2251
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2252
|
-
if (DETEKT_CONFIGS.some((cfg) => fs.existsSync(path.join(dir, cfg))))
|
|
2253
|
-
return true;
|
|
2254
|
-
}
|
|
2255
|
-
return false;
|
|
2256
|
-
}
|
|
2257
|
-
// ktfmt has no native config file format; these are pi-lens opt-in markers plus
|
|
2258
|
-
// the gradle-plugin signal, so a project that uses ktfmt elects it as its Kotlin
|
|
2259
|
-
// formatter instead of the ktlint smart-default (#129).
|
|
2260
|
-
const KTFMT_CONFIG_FILES = [".ktfmt", ".ktfmt.kts"];
|
|
2261
|
-
const KTFMT_GRADLE_FILES = [
|
|
2262
|
-
"build.gradle.kts",
|
|
2263
|
-
"build.gradle",
|
|
2264
|
-
"settings.gradle.kts",
|
|
2265
|
-
"settings.gradle",
|
|
2266
|
-
];
|
|
2267
|
-
const KOTLIN_GRADLE_FILES = [
|
|
2268
|
-
"build.gradle.kts",
|
|
2269
|
-
"build.gradle",
|
|
2270
|
-
"settings.gradle.kts",
|
|
2271
|
-
"settings.gradle",
|
|
2272
|
-
];
|
|
2273
|
-
const GRADLE_KTLINT_PLUGIN_PATTERN = /(?:id\s*\(\s*|id\s+|apply\s+plugin\s*:\s*)["']org\.jlleitschuh\.gradle\.ktlint["']/g;
|
|
2274
|
-
const GRADLE_BUILD_LOGIC_DIRS = ["buildSrc", "build-logic"];
|
|
2275
|
-
const GRADLE_BUILD_LOGIC_EXTENSIONS = [".gradle", ".gradle.kts", ".kt"];
|
|
2276
|
-
const GRADLE_INCLUDE_BUILD_PATTERN = /\bincludeBuild\s*\(\s*["']([^"']+)["']/g;
|
|
2277
|
-
/**
|
|
2278
|
-
* Bound the synchronous ownership probe so a large convention tree cannot
|
|
2279
|
-
* stall every autofix. Exceeding it is an unknown ownership result, not proof
|
|
2280
|
-
* of no owner, and callers must decline the write (#3004).
|
|
2281
|
-
*/
|
|
2282
|
-
export const GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES = 10_000;
|
|
2283
|
-
const spotlessKotlinConfigCache = new Map();
|
|
2284
|
-
let spotlessGradleReadCount = 0;
|
|
2285
|
-
/** Test-only observability for asserting the hot-path I/O bound. */
|
|
2286
|
-
export function _getSpotlessGradleReadCountForTests() {
|
|
2287
|
-
return spotlessGradleReadCount;
|
|
2288
|
-
}
|
|
2289
|
-
/**
|
|
2290
|
-
* Blank comments and quoted strings while preserving braces and newlines in
|
|
2291
|
-
* executable Gradle source. This is deliberately a small lexical pre-pass,
|
|
2292
|
-
* not a Groovy/Kotlin parser. In particular, statically disabled constructs
|
|
2293
|
-
* such as `if (false) { ktlint() }` remain a documented false-positive.
|
|
2294
|
-
*
|
|
2295
|
-
* Exported (with `gradleBlockRanges` below) so `clients/gradle-ktfmt-
|
|
2296
|
-
* style.ts` (#2468) reuses this exact pre-pass for the `ktfmt { }` extension
|
|
2297
|
-
* block instead of a second hand-rolled Gradle lexer — the same
|
|
2298
|
-
* single-source-of-truth reuse `clients/cargo-manifest.ts` did for TOML
|
|
2299
|
-
* parsing (#2466).
|
|
2300
|
-
*/
|
|
2301
|
-
export function stripGradleCommentsAndStrings(source) {
|
|
2302
|
-
let result = "";
|
|
2303
|
-
let state = "code";
|
|
2304
|
-
let quote = "";
|
|
2305
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
2306
|
-
const char = source[index];
|
|
2307
|
-
const next = source[index + 1];
|
|
2308
|
-
if (state === "code") {
|
|
2309
|
-
if (char === "/" && next === "/") {
|
|
2310
|
-
result += " ";
|
|
2311
|
-
index += 1;
|
|
2312
|
-
state = "line-comment";
|
|
2313
|
-
}
|
|
2314
|
-
else if (char === "/" && next === "*") {
|
|
2315
|
-
result += " ";
|
|
2316
|
-
index += 1;
|
|
2317
|
-
state = "block-comment";
|
|
2318
|
-
}
|
|
2319
|
-
else if (char === '"' || char === "'") {
|
|
2320
|
-
result += " ";
|
|
2321
|
-
quote = char;
|
|
2322
|
-
state = "string";
|
|
2323
|
-
}
|
|
2324
|
-
else {
|
|
2325
|
-
result += char;
|
|
2326
|
-
}
|
|
2327
|
-
continue;
|
|
2328
|
-
}
|
|
2329
|
-
if (state === "line-comment") {
|
|
2330
|
-
if (char === "\n" || char === "\r") {
|
|
2331
|
-
result += char;
|
|
2332
|
-
state = "code";
|
|
2333
|
-
}
|
|
2334
|
-
else {
|
|
2335
|
-
result += " ";
|
|
2336
|
-
}
|
|
2337
|
-
continue;
|
|
2338
|
-
}
|
|
2339
|
-
if (state === "block-comment") {
|
|
2340
|
-
if (char === "*" && next === "/") {
|
|
2341
|
-
result += " ";
|
|
2342
|
-
index += 1;
|
|
2343
|
-
state = "code";
|
|
2344
|
-
}
|
|
2345
|
-
else {
|
|
2346
|
-
result += char === "\n" || char === "\r" ? char : " ";
|
|
2347
|
-
}
|
|
2348
|
-
continue;
|
|
2349
|
-
}
|
|
2350
|
-
if (char === "\\") {
|
|
2351
|
-
result += " ";
|
|
2352
|
-
if (index + 1 < source.length) {
|
|
2353
|
-
result += source[index + 1] === "\n" ? "\n" : " ";
|
|
2354
|
-
index += 1;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
else if (char === quote) {
|
|
2358
|
-
result += " ";
|
|
2359
|
-
state = "code";
|
|
2360
|
-
}
|
|
2361
|
-
else {
|
|
2362
|
-
result += char === "\n" || char === "\r" ? char : " ";
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
return result;
|
|
2366
|
-
}
|
|
2367
|
-
const GRADLE_IDENTIFIER_CHAR = /[A-Za-z0-9_$]/;
|
|
2368
|
-
/**
|
|
2369
|
-
* The identifier immediately preceding a `{`, or `""`. Mirrors the
|
|
2370
|
-
* `\b<name>\s*\{` shape the named lookup used before it became a filter over
|
|
2371
|
-
* this scanner: whitespace (including newlines) between the name and the
|
|
2372
|
-
* brace is skipped, and `.` ends the identifier so `com.ncorti.ktfmt { }`
|
|
2373
|
-
* still reads as `ktfmt` while `something_ktfmt { }` does not.
|
|
2374
|
-
*/
|
|
2375
|
-
function gradleBlockNameBefore(source, open) {
|
|
2376
|
-
let index = open - 1;
|
|
2377
|
-
while (index >= 0 && /\s/.test(source[index]))
|
|
2378
|
-
index -= 1;
|
|
2379
|
-
const end = index + 1;
|
|
2380
|
-
while (index >= 0 && GRADLE_IDENTIFIER_CHAR.test(source[index]))
|
|
2381
|
-
index -= 1;
|
|
2382
|
-
return source.slice(index + 1, end);
|
|
2383
|
-
}
|
|
2384
|
-
/**
|
|
2385
|
-
* Body ranges of EVERY brace pair in `source`, in source order, each labelled
|
|
2386
|
-
* with the identifier that introduced it.
|
|
2387
|
-
*
|
|
2388
|
-
* This is the repo's only Gradle brace scanner: `namedGradleBlockRanges` and
|
|
2389
|
-
* `namedGradleBlockBodies` are filters over it. Scanning every pair — rather
|
|
2390
|
-
* than only the pairs whose name a caller thought to ask about — is what lets
|
|
2391
|
-
* `clients/gradle-ktfmt-style.ts` (#2468 review round 3) answer "what block
|
|
2392
|
-
* ENCLOSES this one?" instead of only "is it inside the one name I checked?".
|
|
2393
|
-
* The distinction is load-bearing there: `configure(subprojects.filter { … })
|
|
2394
|
-
* { ktfmt { } }`, `project(":app") { ktfmt { } }` and a convention-plugin
|
|
2395
|
-
* wrapper all have to be recognized as *some* enclosing scope the resolver
|
|
2396
|
-
* cannot evaluate, so it can fail closed rather than treat the block as
|
|
2397
|
-
* top-level.
|
|
2398
|
-
*
|
|
2399
|
-
* Unbalanced braces are best-effort: an unmatched `}` is ignored and an
|
|
2400
|
-
* unclosed `{` yields no range, exactly as the previous per-name depth scan
|
|
2401
|
-
* behaved.
|
|
2402
|
-
*/
|
|
2403
|
-
export function gradleBlockRanges(source) {
|
|
2404
|
-
const ranges = [];
|
|
2405
|
-
const opens = [];
|
|
2406
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
2407
|
-
const char = source[index];
|
|
2408
|
-
if (char === "{") {
|
|
2409
|
-
opens.push(index);
|
|
2410
|
-
continue;
|
|
2411
|
-
}
|
|
2412
|
-
if (char !== "}")
|
|
2413
|
-
continue;
|
|
2414
|
-
const open = opens.pop();
|
|
2415
|
-
if (open === undefined)
|
|
2416
|
-
continue;
|
|
2417
|
-
ranges.push({
|
|
2418
|
-
name: gradleBlockNameBefore(source, open),
|
|
2419
|
-
start: open + 1,
|
|
2420
|
-
end: index,
|
|
2421
|
-
});
|
|
2422
|
-
}
|
|
2423
|
-
// Pairs are completed innermost-first; callers want source order.
|
|
2424
|
-
return ranges.sort((a, b) => a.start - b.start);
|
|
2425
|
-
}
|
|
2426
|
-
/**
|
|
2427
|
-
* Body ranges of every `<name> { ... }` block, in source order.
|
|
2428
|
-
*
|
|
2429
|
-
* The offsets exist so a caller can ask where a block sits RELATIVE to
|
|
2430
|
-
* another one — `clients/gradle-ktfmt-style.ts` (#2468) needs to know which
|
|
2431
|
-
* block encloses a `ktfmt { }` one, because Gradle's `subprojects { }`
|
|
2432
|
-
* applies it to the children and NOT to the project declaring it, while
|
|
2433
|
-
* `allprojects { }` applies to both. Containment of two ranges is the only
|
|
2434
|
-
* reliable way to answer that; matching body TEXT would collide whenever two
|
|
2435
|
-
* blocks happen to have identical bodies. `namedGradleBlockBodies` stays the
|
|
2436
|
-
* ergonomic form for callers that only need the text.
|
|
2437
|
-
*/
|
|
2438
|
-
function namedGradleBlockRanges(source, name) {
|
|
2439
|
-
return gradleBlockRanges(source).filter((range) => range.name === name);
|
|
2440
|
-
}
|
|
2441
|
-
function namedGradleBlockBodies(source, name) {
|
|
2442
|
-
return namedGradleBlockRanges(source, name).map((range) => source.slice(range.start, range.end));
|
|
2443
|
-
}
|
|
2444
|
-
/**
|
|
2445
|
-
* Resolve the formatter elected by a Spotless `kotlin { ... }` block.
|
|
2446
|
-
* ktlint is the deterministic tie-break if a malformed project names both.
|
|
2447
|
-
*/
|
|
2448
|
-
export function getSpotlessKotlinFormatter(cwd) {
|
|
2449
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2450
|
-
for (const gradle of KOTLIN_GRADLE_FILES) {
|
|
2451
|
-
const filePath = path.join(dir, gradle);
|
|
2452
|
-
if (!fs.existsSync(filePath))
|
|
2453
|
-
continue;
|
|
2454
|
-
try {
|
|
2455
|
-
const mtime = fs.statSync(filePath).mtimeMs;
|
|
2456
|
-
let config = spotlessKotlinConfigCache.get(filePath);
|
|
2457
|
-
if (!config || config.mtime !== mtime) {
|
|
2458
|
-
const source = stripGradleCommentsAndStrings(fs.readFileSync(filePath, "utf-8"));
|
|
2459
|
-
spotlessGradleReadCount += 1;
|
|
2460
|
-
const kotlinBodies = namedGradleBlockBodies(source, "spotless").flatMap((spotless) => namedGradleBlockBodies(spotless, "kotlin"));
|
|
2461
|
-
config = {
|
|
2462
|
-
mtime,
|
|
2463
|
-
ktlintConfig: kotlinBodies.some((body) => /\bktlint\s*\(/.test(body)),
|
|
2464
|
-
ktfmtConfig: kotlinBodies.some((body) => /\bktfmt\s*\(/.test(body)),
|
|
2465
|
-
};
|
|
2466
|
-
spotlessKotlinConfigCache.set(filePath, config);
|
|
2467
|
-
}
|
|
2468
|
-
if (config.ktlintConfig)
|
|
2469
|
-
return "ktlint";
|
|
2470
|
-
if (config.ktfmtConfig)
|
|
2471
|
-
return "ktfmt";
|
|
2472
|
-
}
|
|
2473
|
-
catch { }
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
return undefined;
|
|
2477
|
-
}
|
|
2478
|
-
export function hasKtlintConfig(cwd) {
|
|
2479
|
-
return getSpotlessKotlinFormatter(cwd) === "ktlint";
|
|
2480
|
-
}
|
|
2481
|
-
/**
|
|
2482
|
-
* Whether Gradle build logic applies the ktlint Gradle plugin. The plugin
|
|
2483
|
-
* establishes project ownership of ktlint, but its plugin version is not a
|
|
2484
|
-
* ktlint CLI version and must never be used as one (#3000).
|
|
2485
|
-
*/
|
|
2486
|
-
export function hasGradleKtlintPlugin(cwd) {
|
|
2487
|
-
const files = new Set();
|
|
2488
|
-
const scan = { entries: 0, exceeded: false, indeterminate: false };
|
|
2489
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2490
|
-
for (const gradle of KOTLIN_GRADLE_FILES) {
|
|
2491
|
-
const filePath = path.join(dir, gradle);
|
|
2492
|
-
if (fs.existsSync(filePath))
|
|
2493
|
-
files.add(filePath);
|
|
2494
|
-
}
|
|
2495
|
-
for (const buildLogicDir of GRADLE_BUILD_LOGIC_DIRS) {
|
|
2496
|
-
if (!addGradleBuildLogicFiles(path.join(dir, buildLogicDir), files, scan)) {
|
|
2497
|
-
scan.exceeded = true;
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
for (const settings of ["settings.gradle.kts", "settings.gradle"]) {
|
|
2501
|
-
const settingsPath = path.join(dir, settings);
|
|
2502
|
-
if (!fs.existsSync(settingsPath))
|
|
2503
|
-
continue;
|
|
2504
|
-
try {
|
|
2505
|
-
const raw = fs.readFileSync(settingsPath, "utf-8");
|
|
2506
|
-
const stripped = stripGradleCommentsAndStrings(raw);
|
|
2507
|
-
GRADLE_INCLUDE_BUILD_PATTERN.lastIndex = 0;
|
|
2508
|
-
let match;
|
|
2509
|
-
while ((match = GRADLE_INCLUDE_BUILD_PATTERN.exec(raw)) !== null) {
|
|
2510
|
-
const code = stripped.slice(match.index, match.index + match[0].length);
|
|
2511
|
-
const includedBuild = match[1];
|
|
2512
|
-
if (includedBuild && /^\s*includeBuild\s*\(\s*/.test(code)) {
|
|
2513
|
-
if (!addGradleBuildLogicFiles(path.resolve(dir, includedBuild), files, scan)) {
|
|
2514
|
-
scan.exceeded = true;
|
|
2515
|
-
}
|
|
2516
|
-
}
|
|
2517
|
-
}
|
|
2518
|
-
}
|
|
2519
|
-
catch {
|
|
2520
|
-
scan.indeterminate = true;
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
}
|
|
2524
|
-
if (scan.exceeded) {
|
|
2525
|
-
recordDegradationOnce({
|
|
2526
|
-
kind: "gradle-ktlint-scan-budget-exceeded",
|
|
2527
|
-
subject: "ktlint:gradle-build-logic",
|
|
2528
|
-
reason: `Gradle build-logic ownership scan exceeded its ${GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES}-entry budget; ` +
|
|
2529
|
-
"ownership cannot be established, so ktlint autofix is declined",
|
|
2530
|
-
});
|
|
2531
|
-
return { kind: "indeterminate" };
|
|
2532
|
-
}
|
|
2533
|
-
if (scan.indeterminate)
|
|
2534
|
-
return { kind: "indeterminate" };
|
|
2535
|
-
for (const filePath of files) {
|
|
2536
|
-
try {
|
|
2537
|
-
const raw = fs.readFileSync(filePath, "utf-8");
|
|
2538
|
-
const stripped = stripGradleCommentsAndStrings(raw);
|
|
2539
|
-
GRADLE_KTLINT_PLUGIN_PATTERN.lastIndex = 0;
|
|
2540
|
-
let match;
|
|
2541
|
-
while ((match = GRADLE_KTLINT_PLUGIN_PATTERN.exec(raw)) !== null) {
|
|
2542
|
-
const code = stripped.slice(match.index, match.index + match[0].length);
|
|
2543
|
-
if (!/^\s*$/.test(code))
|
|
2544
|
-
return { kind: "owned" };
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
catch {
|
|
2548
|
-
return { kind: "indeterminate" };
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
return { kind: "not-owned" };
|
|
2552
|
-
}
|
|
2553
|
-
function addGradleBuildLogicFiles(root, files, scan) {
|
|
2554
|
-
if (!fs.existsSync(root))
|
|
2555
|
-
return true;
|
|
2556
|
-
const pending = [root];
|
|
2557
|
-
while (pending.length > 0) {
|
|
2558
|
-
const dir = pending.pop();
|
|
2559
|
-
if (!dir)
|
|
2560
|
-
continue;
|
|
2561
|
-
let entries;
|
|
2562
|
-
try {
|
|
2563
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
2564
|
-
}
|
|
2565
|
-
catch {
|
|
2566
|
-
scan.indeterminate = true;
|
|
2567
|
-
continue;
|
|
2568
|
-
}
|
|
2569
|
-
for (const entry of entries) {
|
|
2570
|
-
scan.entries += 1;
|
|
2571
|
-
if (scan.entries > GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES)
|
|
2572
|
-
return false;
|
|
2573
|
-
const entryPath = path.join(dir, entry.name);
|
|
2574
|
-
if (entry.isDirectory()) {
|
|
2575
|
-
pending.push(entryPath);
|
|
2576
|
-
}
|
|
2577
|
-
else if (entry.isFile() &&
|
|
2578
|
-
GRADLE_BUILD_LOGIC_EXTENSIONS.some((extension) => entry.name.endsWith(extension))) {
|
|
2579
|
-
files.add(entryPath);
|
|
2580
|
-
}
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
return true;
|
|
2584
|
-
}
|
|
2585
|
-
export function hasKtfmtConfig(cwd) {
|
|
2586
|
-
const spotlessFormatter = getSpotlessKotlinFormatter(cwd);
|
|
2587
|
-
if (spotlessFormatter)
|
|
2588
|
-
return spotlessFormatter === "ktfmt";
|
|
2589
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2590
|
-
if (KTFMT_CONFIG_FILES.some((cfg) => fs.existsSync(path.join(dir, cfg))))
|
|
2591
|
-
return true;
|
|
2592
|
-
for (const gradle of KTFMT_GRADLE_FILES) {
|
|
2593
|
-
const p = path.join(dir, gradle);
|
|
2594
|
-
if (fs.existsSync(p)) {
|
|
2595
|
-
try {
|
|
2596
|
-
// Match the gradle plugin id / artifact, not a stray substring.
|
|
2597
|
-
if (/ktfmt|com\.facebook\.ktfmt/i.test(fs.readFileSync(p, "utf-8")))
|
|
2598
|
-
return true;
|
|
2599
|
-
}
|
|
2600
|
-
catch { }
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
return false;
|
|
2605
|
-
}
|
|
2606
|
-
// SpotBugs (#133) analyzes compiled bytecode, so it needs BOTH a Java build
|
|
2607
|
-
// descriptor AND a compiled-classes dir. These two helpers gate the runner.
|
|
2608
|
-
const JAVA_BUILD_DESCRIPTORS = [
|
|
2609
|
-
"pom.xml",
|
|
2610
|
-
"build.gradle",
|
|
2611
|
-
"build.gradle.kts",
|
|
2612
|
-
"settings.gradle",
|
|
2613
|
-
"settings.gradle.kts",
|
|
2614
|
-
];
|
|
2615
|
-
// Common compiled-output dirs: Maven (target/classes), Gradle (build/classes),
|
|
2616
|
-
// IntelliJ (out/production), Eclipse (bin/main).
|
|
2617
|
-
const COMPILED_CLASSES_DIRS = [
|
|
2618
|
-
path.join("target", "classes"),
|
|
2619
|
-
path.join("build", "classes"),
|
|
2620
|
-
path.join("out", "production"),
|
|
2621
|
-
path.join("bin", "main"),
|
|
2622
|
-
];
|
|
2623
|
-
export function hasJavaBuildDescriptor(cwd, ceiling) {
|
|
2624
|
-
const normalizedCeiling = ceiling
|
|
2625
|
-
? normalizeMapKey(path.resolve(ceiling))
|
|
2626
|
-
: undefined;
|
|
2627
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2628
|
-
if (JAVA_BUILD_DESCRIPTORS.some((d) => fs.existsSync(path.join(dir, d))))
|
|
2629
|
-
return true;
|
|
2630
|
-
if (normalizedCeiling &&
|
|
2631
|
-
normalizeMapKey(path.resolve(dir)) === normalizedCeiling)
|
|
2632
|
-
break;
|
|
2633
|
-
}
|
|
2634
|
-
return false;
|
|
2635
|
-
}
|
|
2636
|
-
/** First existing compiled-classes dir at/above cwd, or undefined. */
|
|
2637
|
-
export function findCompiledClassesDir(cwd) {
|
|
2638
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2639
|
-
for (const rel of COMPILED_CLASSES_DIRS) {
|
|
2640
|
-
const candidate = path.join(dir, rel);
|
|
2641
|
-
if (fs.existsSync(candidate))
|
|
2642
|
-
return candidate;
|
|
2643
|
-
}
|
|
2644
|
-
}
|
|
2645
|
-
return undefined;
|
|
2646
|
-
}
|
|
2647
|
-
export function hasStandardrbConfig(cwd) {
|
|
2648
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2649
|
-
const gemfile = path.join(dir, "Gemfile");
|
|
2650
|
-
if (fs.existsSync(gemfile)) {
|
|
2651
|
-
try {
|
|
2652
|
-
if (fs.readFileSync(gemfile, "utf-8").includes("standard"))
|
|
2653
|
-
return true;
|
|
2654
|
-
}
|
|
2655
|
-
catch { }
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
return false;
|
|
2659
|
-
}
|
|
2660
|
-
export function getRubocopCommand(cwd) {
|
|
2661
|
-
const gemfile = path.join(cwd, "Gemfile");
|
|
2662
|
-
if (fs.existsSync(gemfile)) {
|
|
2663
|
-
try {
|
|
2664
|
-
const content = fs.readFileSync(gemfile, "utf-8");
|
|
2665
|
-
if (content.includes("rubocop")) {
|
|
2666
|
-
return { cmd: "bundle", args: ["exec", "rubocop"] };
|
|
2667
|
-
}
|
|
2668
|
-
}
|
|
2669
|
-
catch { }
|
|
2670
|
-
}
|
|
2671
|
-
return { cmd: "rubocop", args: [] };
|
|
2672
|
-
}
|
|
2673
|
-
export function hasVitePlusConfig(cwd) {
|
|
2674
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2675
|
-
if (fs.existsSync(path.join(dir, "vite-plus.json")))
|
|
2676
|
-
return true;
|
|
2677
|
-
const pkgPath = path.join(dir, "package.json");
|
|
2678
|
-
if (fs.existsSync(pkgPath)) {
|
|
2679
|
-
try {
|
|
2680
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
2681
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
2682
|
-
if (deps["vite-plus"] || deps["@voidzero-dev/vite-plus-core"]) {
|
|
2683
|
-
return true;
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
catch { }
|
|
2687
|
-
}
|
|
2688
|
-
for (const cfg of VITE_CONFIGS) {
|
|
2689
|
-
const cfgPath = path.join(dir, cfg);
|
|
2690
|
-
if (!fs.existsSync(cfgPath))
|
|
2691
|
-
continue;
|
|
2692
|
-
try {
|
|
2693
|
-
const content = fs.readFileSync(cfgPath, "utf-8");
|
|
2694
|
-
if (content.includes("vite-plus"))
|
|
2695
|
-
return true;
|
|
2696
|
-
}
|
|
2697
|
-
catch { }
|
|
2698
|
-
}
|
|
2699
|
-
}
|
|
2700
|
-
return false;
|
|
2701
|
-
}
|
|
2702
|
-
// Per https://oxc.rs/docs/guide/usage/linter/config.html, oxlint auto-discovers
|
|
2703
|
-
// `.oxlintrc.json`, `.oxlintrc.jsonc`, `oxlint.config.ts`, and `oxlint.config.mts`
|
|
2704
|
-
// (in addition to the legacy `oxlint.json` name pi-lens already recognized).
|
|
2705
|
-
const OXLINT_CONFIGS = [
|
|
2706
|
-
".oxlintrc.json",
|
|
2707
|
-
".oxlintrc.jsonc",
|
|
2708
|
-
"oxlint.json",
|
|
2709
|
-
"oxlint.config.ts",
|
|
2710
|
-
"oxlint.config.mts",
|
|
2711
|
-
];
|
|
2712
|
-
export function hasOxlintConfig(cwd) {
|
|
2713
|
-
// Oxlint auto-discovers the nearest config by file location, so the walk
|
|
2714
|
-
// ignores intermediate package.json boundaries just like the flat
|
|
2715
|
-
// ESLint branch above (#3017).
|
|
2716
|
-
for (const dir of walkUpDirs(cwd)) {
|
|
2717
|
-
for (const cfg of OXLINT_CONFIGS) {
|
|
2718
|
-
if (fs.existsSync(path.join(dir, cfg)))
|
|
2719
|
-
return true;
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
return hasVitePlusConfig(cwd);
|
|
2723
|
-
}
|
|
2724
|
-
export function getPreferredJstsLintRunners(context) {
|
|
2725
|
-
if (context.hasEslintConfig)
|
|
2726
|
-
return ["eslint"];
|
|
2727
|
-
if (context.hasOxlintConfig)
|
|
2728
|
-
return ["oxlint"];
|
|
2729
|
-
if (context.hasBiomeConfig)
|
|
2730
|
-
return ["biome-check-json"];
|
|
2731
|
-
return ["oxlint", "biome-check-json"];
|
|
2732
|
-
}
|
|
2733
|
-
export function getJstsLintPolicy(context) {
|
|
2734
|
-
const hasEslint = !!context.hasEslintConfig;
|
|
2735
|
-
const hasOxlint = !!context.hasOxlintConfig;
|
|
2736
|
-
const hasBiome = !!context.hasBiomeConfig;
|
|
2737
|
-
return {
|
|
2738
|
-
hasEslintConfig: hasEslint,
|
|
2739
|
-
hasOxlintConfig: hasOxlint,
|
|
2740
|
-
hasBiomeConfig: hasBiome,
|
|
2741
|
-
preferredRunners: getPreferredJstsLintRunners({
|
|
2742
|
-
hasEslintConfig: hasEslint,
|
|
2743
|
-
hasOxlintConfig: hasOxlint,
|
|
2744
|
-
hasBiomeConfig: hasBiome,
|
|
2745
|
-
}),
|
|
2746
|
-
hasExplicitNonBiomeLinter: hasEslint || hasOxlint,
|
|
2747
|
-
};
|
|
2748
|
-
}
|
|
2749
|
-
export function getJstsLintPolicyForCwd(cwd) {
|
|
2750
|
-
return getJstsLintPolicy({
|
|
2751
|
-
hasEslintConfig: hasEslintConfig(cwd),
|
|
2752
|
-
hasOxlintConfig: hasOxlintConfig(cwd),
|
|
2753
|
-
hasBiomeConfig: hasBiomeConfig(cwd),
|
|
2754
|
-
});
|
|
2755
|
-
}
|