pi-lens 3.8.26 → 3.8.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -1
- package/README.md +182 -48
- package/clients/agent-behavior-client.ts +5 -2
- package/clients/ast-grep-client.ts +1 -1
- package/clients/biome-client.ts +14 -0
- package/clients/diagnostic-logger.ts +4 -3
- package/clients/dispatch/dispatcher.ts +86 -9
- package/clients/dispatch/facts/function-facts.ts +79 -0
- package/clients/dispatch/facts/import-facts.ts +68 -0
- package/clients/dispatch/facts/try-catch-facts.ts +119 -23
- package/clients/dispatch/integration.ts +132 -5
- package/clients/dispatch/plan.ts +126 -5
- package/clients/dispatch/rules/async-noise.ts +8 -1
- package/clients/dispatch/rules/async-unnecessary-wrapper.ts +35 -0
- package/clients/dispatch/rules/high-complexity.ts +44 -0
- package/clients/dispatch/rules/high-fan-out.ts +55 -0
- package/clients/dispatch/rules/missing-error-propagation.ts +71 -0
- package/clients/dispatch/rules/quality-rules.ts +370 -0
- package/clients/dispatch/rules/sonar-rules.ts +500 -0
- package/clients/dispatch/rules/unsafe-boundary.ts +98 -0
- package/clients/dispatch/runner-context.ts +46 -1
- package/clients/dispatch/runners/biome-check.ts +39 -18
- package/clients/dispatch/runners/cpp-check.ts +164 -0
- package/clients/dispatch/runners/credo.ts +99 -0
- package/clients/dispatch/runners/dart-analyze.ts +127 -0
- package/clients/dispatch/runners/dotnet-build.ts +109 -0
- package/clients/dispatch/runners/elixir-check.ts +148 -0
- package/clients/dispatch/runners/fact-rules.ts +44 -0
- package/clients/dispatch/runners/gleam-check.ts +106 -0
- package/clients/dispatch/runners/hadolint.ts +97 -0
- package/clients/dispatch/runners/htmlhint.ts +106 -0
- package/clients/dispatch/runners/index.ts +46 -0
- package/clients/dispatch/runners/javac.ts +94 -0
- package/clients/dispatch/runners/ktlint.ts +159 -0
- package/clients/dispatch/runners/lsp.ts +21 -0
- package/clients/dispatch/runners/markdownlint.ts +99 -0
- package/clients/dispatch/runners/mypy.ts +123 -0
- package/clients/dispatch/runners/php-lint.ts +79 -0
- package/clients/dispatch/runners/phpstan.ts +123 -0
- package/clients/dispatch/runners/prettier-check.ts +110 -0
- package/clients/dispatch/runners/prisma-validate.ts +86 -0
- package/clients/dispatch/runners/psscriptanalyzer.ts +158 -0
- package/clients/dispatch/runners/pyright.ts +1 -1
- package/clients/dispatch/runners/ruff.ts +34 -12
- package/clients/dispatch/runners/shellcheck.ts +12 -8
- package/clients/dispatch/runners/shfmt.ts +96 -0
- package/clients/dispatch/runners/similarity.ts +48 -19
- package/clients/dispatch/runners/stylelint.ts +143 -0
- package/clients/dispatch/runners/taplo.ts +87 -0
- package/clients/dispatch/runners/tflint.ts +100 -0
- package/clients/dispatch/runners/tree-sitter.ts +34 -176
- package/clients/dispatch/runners/ts-lsp.ts +19 -2
- package/clients/dispatch/runners/type-safety.ts +6 -0
- package/clients/dispatch/runners/utils/runner-helpers.ts +6 -7
- package/clients/dispatch/runners/zig-check.ts +113 -0
- package/clients/file-kinds.ts +119 -6
- package/clients/file-role.ts +125 -0
- package/clients/fix-worklog.ts +117 -0
- package/clients/formatters.ts +62 -5
- package/clients/installer/index.ts +822 -70
- package/clients/language-policy.ts +75 -5
- package/clients/language-profile.ts +43 -0
- package/clients/lsp/client.ts +429 -437
- package/clients/lsp/config.ts +60 -19
- package/clients/lsp/index.ts +23 -64
- package/clients/lsp/interactive-install.ts +5 -28
- package/clients/lsp/language.ts +9 -2
- package/clients/lsp/launch.ts +229 -41
- package/clients/lsp/server.ts +670 -490
- package/clients/pipeline.ts +584 -288
- package/clients/project-index.ts +1 -1
- package/clients/review-graph/builder.ts +405 -0
- package/clients/review-graph/format.ts +51 -0
- package/clients/review-graph/query.ts +108 -0
- package/clients/review-graph/service.ts +64 -0
- package/clients/review-graph/types.ts +46 -0
- package/clients/runtime-coordinator.ts +17 -0
- package/clients/runtime-session.ts +373 -304
- package/clients/runtime-tool-result.ts +14 -2
- package/clients/runtime-turn.ts +3 -0
- package/clients/tree-sitter-cache.ts +2 -1
- package/clients/tree-sitter-client.ts +279 -340
- package/clients/tree-sitter-query-loader.ts +17 -3
- package/clients/tree-sitter-symbol-extractor.ts +48 -0
- package/commands/booboo.ts +363 -172
- package/config/ruff/core.toml +25 -0
- package/default-architect.yaml +2 -2
- package/index.ts +7 -3
- package/package.json +3 -5
- package/rules/ast-grep-rules/rules/consistent-existence-index-check-js.yml +15 -0
- package/rules/ast-grep-rules/rules/consistent-existence-index-check.yml +15 -0
- package/rules/ast-grep-rules/rules/empty-catch-js.yml +4 -1
- package/rules/ast-grep-rules/rules/empty-catch.yml +4 -1
- package/rules/ast-grep-rules/rules/enforce-node-protocol-js.yml +11 -0
- package/rules/ast-grep-rules/rules/enforce-node-protocol.yml +11 -0
- package/rules/ast-grep-rules/rules/no-absolute-path-import-js.yml +11 -0
- package/rules/ast-grep-rules/rules/no-absolute-path-import.yml +11 -0
- package/rules/ast-grep-rules/rules/no-array-reverse-mutation-js.yml +8 -0
- package/rules/ast-grep-rules/rules/no-array-reverse-mutation.yml +8 -0
- package/rules/ast-grep-rules/rules/no-array-sort-without-comparator-js.yml +8 -0
- package/rules/ast-grep-rules/rules/no-array-sort-without-comparator.yml +8 -0
- package/rules/ast-grep-rules/rules/no-await-expression-member-js.yml +11 -0
- package/rules/ast-grep-rules/rules/no-await-expression-member.yml +11 -0
- package/rules/ast-grep-rules/rules/no-await-in-loop.yml +17 -1
- package/rules/ast-grep-rules/rules/no-await-in-promise-methods-js.yml +12 -0
- package/rules/ast-grep-rules/rules/no-await-in-promise-methods.yml +12 -0
- package/rules/ast-grep-rules/rules/no-case-declarations-js.yml +5 -0
- package/rules/ast-grep-rules/rules/no-case-declarations.yml +5 -0
- package/rules/ast-grep-rules/rules/no-discarded-error-js.yml +0 -2
- package/rules/ast-grep-rules/rules/no-discarded-error.yml +0 -2
- package/rules/ast-grep-rules/rules/no-dupe-args-js.yml +1 -1
- package/rules/ast-grep-rules/rules/no-hardcoded-secrets.yml +2 -1
- package/rules/ast-grep-rules/rules/no-implied-eval-js.yml +4 -6
- package/rules/ast-grep-rules/rules/no-implied-eval.yml +4 -6
- package/rules/ast-grep-rules/rules/no-instanceof-array-js.yml +9 -0
- package/rules/ast-grep-rules/rules/no-instanceof-array.yml +9 -0
- package/rules/ast-grep-rules/rules/no-instanceof-builtins-js.yml +14 -0
- package/rules/ast-grep-rules/rules/no-instanceof-builtins.yml +14 -0
- package/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +12 -0
- package/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +12 -0
- package/rules/ast-grep-rules/rules/no-single-promise-in-promise-methods-js.yml +12 -0
- package/rules/ast-grep-rules/rules/no-single-promise-in-promise-methods.yml +12 -0
- package/rules/ast-grep-rules/rules/no-typeof-undefined-js.yml +19 -0
- package/rules/ast-grep-rules/rules/no-typeof-undefined.yml +19 -0
- package/rules/ast-grep-rules/rules/no-unnecessary-array-flat-depth-js.yml +8 -0
- package/rules/ast-grep-rules/rules/no-unnecessary-array-flat-depth.yml +8 -0
- package/rules/ast-grep-rules/rules/no-useless-length-check-js.yml +11 -0
- package/rules/ast-grep-rules/rules/no-useless-length-check.yml +11 -0
- package/rules/ast-grep-rules/rules/no-useless-promise-resolve-reject-js.yml +10 -0
- package/rules/ast-grep-rules/rules/no-useless-promise-resolve-reject.yml +10 -0
- package/rules/ast-grep-rules/rules/no-useless-rest-spread-js.yml +10 -0
- package/rules/ast-grep-rules/rules/no-useless-rest-spread.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-array-find-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-array-find.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-array-flat-map-js.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-array-flat-map.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-array-some-js.yml +11 -0
- package/rules/ast-grep-rules/rules/prefer-array-some.yml +11 -0
- package/rules/ast-grep-rules/rules/prefer-async-await-js.yml +13 -0
- package/rules/ast-grep-rules/rules/prefer-async-await.yml +13 -0
- package/rules/ast-grep-rules/rules/prefer-at-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-at.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-date-now-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-date-now.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-dom-node-append-js.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-dom-node-append.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-dom-node-text-content-js.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-dom-node-text-content.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-keyboard-event-key-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-keyboard-event-key.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-math-min-max-js.yml +12 -0
- package/rules/ast-grep-rules/rules/prefer-math-min-max.yml +12 -0
- package/rules/ast-grep-rules/rules/prefer-number-properties-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-number-properties.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-prototype-methods-js.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-prototype-methods.yml +8 -0
- package/rules/ast-grep-rules/rules/prefer-query-selector-js.yml +11 -0
- package/rules/ast-grep-rules/rules/prefer-query-selector.yml +11 -0
- package/rules/ast-grep-rules/rules/prefer-string-slice-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-string-slice.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-string-starts-ends-with-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-string-starts-ends-with.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-string-trim-start-end-js.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-string-trim-start-end.yml +10 -0
- package/rules/ast-grep-rules/rules/prefer-structured-clone-js.yml +9 -0
- package/rules/ast-grep-rules/rules/prefer-structured-clone.yml +9 -0
- package/rules/ast-grep-rules/rules/throw-new-error-js.yml +14 -0
- package/rules/ast-grep-rules/rules/throw-new-error.yml +14 -0
- package/rules/ast-grep-rules/rules/toctou-js.yml +1 -1
- package/rules/ast-grep-rules/rules/toctou.yml +1 -1
- package/rules/ast-grep-rules/rules/unchecked-sync-fs-js.yml +1 -1
- package/rules/ast-grep-rules/rules/unchecked-sync-fs.yml +1 -1
- package/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +0 -2
- package/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +0 -2
- package/rules/ast-grep-rules/rules-disabled/no-this-in-static-js.yml +14 -0
- package/rules/ast-grep-rules/rules-disabled/no-this-in-static.yml +14 -0
- package/rules/ast-grep-rules/rules-disabled/prefer-string-raw-js.yml +9 -0
- package/rules/ast-grep-rules/rules-disabled/prefer-string-raw.yml +9 -0
- package/rules/tree-sitter-queries/go/go-context-background-handler.yml +57 -0
- package/rules/tree-sitter-queries/go/go-defer-in-loop.yml +1 -1
- package/rules/tree-sitter-queries/go/go-direct-panic.yml +1 -1
- package/rules/tree-sitter-queries/go/go-empty-if-err.yml +1 -1
- package/rules/tree-sitter-queries/go/go-goroutine-loop-capture.yml +1 -1
- package/rules/tree-sitter-queries/go/go-hardcoded-secrets.yml +1 -1
- package/rules/tree-sitter-queries/go/go-mutex-copy.yml +57 -0
- package/rules/tree-sitter-queries/go/go-time-sleep-test.yml +50 -0
- package/rules/tree-sitter-queries/python/bare-except.yml +1 -1
- package/rules/tree-sitter-queries/python/eval-exec.yml +1 -1
- package/rules/tree-sitter-queries/python/is-vs-equals.yml +1 -1
- package/rules/tree-sitter-queries/python/mutable-default-arg.yml +1 -1
- package/rules/tree-sitter-queries/python/python-assert-production.yml +49 -0
- package/rules/tree-sitter-queries/python/python-cross-language-method.yml +61 -0
- package/rules/tree-sitter-queries/python/python-debugger.yml +1 -1
- package/rules/tree-sitter-queries/python/python-empty-except.yml +1 -1
- package/rules/tree-sitter-queries/python/python-hallucinated-import.yml +58 -0
- package/rules/tree-sitter-queries/python/python-hardcoded-secrets.yml +1 -1
- package/rules/tree-sitter-queries/python/python-mutable-class-attr.yml +1 -1
- package/rules/tree-sitter-queries/python/python-raise-string.yml +1 -1
- package/rules/tree-sitter-queries/python/python-sleep-in-test.yml +50 -0
- package/rules/tree-sitter-queries/python/python-subprocess-shell.yml +60 -0
- package/rules/tree-sitter-queries/python/python-unsafe-regex.yml +1 -1
- package/rules/tree-sitter-queries/python/unreachable-except.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-debugger.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-dynamic-send.yml +54 -0
- package/rules/tree-sitter-queries/ruby/ruby-empty-rescue.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-eval.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-hardcoded-secrets.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-rescue-exception.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-sleep-in-test.yml +48 -0
- package/rules/tree-sitter-queries/ruby/ruby-string-eval.yml +57 -0
- package/rules/tree-sitter-queries/ruby/ruby-unsafe-regex.yml +1 -1
- package/rules/tree-sitter-queries/rust/rust-expect.yml +47 -0
- package/rules/tree-sitter-queries/rust/rust-todo-unimplemented.yml +47 -0
- package/rules/tree-sitter-queries/rust/rust-unsafe-block.yml +41 -0
- package/rules/tree-sitter-queries/rust/rust-unwrap.yml +1 -1
- package/rules/tree-sitter-queries/typescript/ts-hallucinated-react-import.yml +61 -0
- package/rules/tree-sitter-queries/typescript/ts-insecure-random.yml +9 -5
- package/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +50 -0
- package/rules/tree-sitter-queries/typescript/ts-ssrf.yml +2 -2
- package/rules/tree-sitter-queries/typescript/unsafe-regex.yml +1 -1
- package/scripts/download-grammars.js +4 -0
- package/rules/tree-sitter-queries/typescript/no-dupe-class-members.yml +0 -49
- /package/rules/ast-grep-rules/{rules → rules-disabled}/no-architecture-violation.yml +0 -0
- /package/rules/ast-grep-rules/{rules → rules-disabled}/no-param-reassign.yml +0 -0
- /package/rules/ast-grep-rules/{rules → rules-disabled}/no-shadow.yml +0 -0
- /package/rules/tree-sitter-queries/{typescript → typescript-disabled}/await-in-loop.yml +0 -0
- /package/rules/tree-sitter-queries/{typescript → typescript-disabled}/constructor-super.yml +0 -0
- /package/rules/tree-sitter-queries/{typescript → typescript-disabled}/empty-catch.yml +0 -0
- /package/rules/tree-sitter-queries/{typescript → typescript-disabled}/hardcoded-secrets.yml +0 -0
- /package/rules/tree-sitter-queries/{typescript → typescript-disabled}/long-parameter-list.yml +0 -0
- /package/rules/tree-sitter-queries/{typescript → typescript-disabled}/nested-ternary.yml +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,119 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to pi-lens will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [3.8.28] - 2026-04-19
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Session startup no longer blocks the Node event loop** — tool availability probes (biome, ast-grep, ruff, knip, jscpd, madge) now run via async `ensureAvailable()` in a fire-and-forget IIFE instead of `setImmediate` + `spawnSync`, eliminating ~8–10 s of main-thread freeze on startup.
|
|
9
|
+
- **Biome binary lookup extended** — `getBiomeBinary()` now checks `~/.pi-lens/tools/node_modules/.bin/biome` so the async probe finds the pre-installed binary without falling back to `npx`.
|
|
10
|
+
- **CSS roots and Windows LSP shims tightened** — improved root resolution for CSS language server on Windows.
|
|
11
|
+
- **Zig compile coverage kept active** — LSP availability check no longer incorrectly disables Zig compile diagnostics.
|
|
12
|
+
- **Ruby LSP startup budgets relaxed** — reduced false-negative LSP attach failures on slower machines.
|
|
13
|
+
- **Kotlin and Zig LSP availability improved** — more reliable server detection across platforms.
|
|
14
|
+
- **Standalone Python and Ruby LSP roots fixed** — correct workspace root used when opening files outside a project directory.
|
|
15
|
+
|
|
16
|
+
## [3.8.27] - 2026-04-19
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- **Review graph impact cascade** — turn-end cascade now renders a review-graph impact view showing which files were affected and how diagnostics propagated.
|
|
20
|
+
- **Fact-rule pipeline in dispatch** — new `fact-rules` dispatch runner computes function-level facts (depth, cyclomatic complexity, call counts) and evaluates quality rules inline, replacing the bespoke tree-sitter booboo runner.
|
|
21
|
+
- **Function facts: depth / CC / calls** — tree-sitter extracts per-function cyclomatic complexity, nesting depth, and outgoing call count for fact-rule evaluation.
|
|
22
|
+
- **File role classification** — dispatch classifies files as `source`, `test`, `config`, or `vendor` and adjusts rule severity accordingly.
|
|
23
|
+
- **Inline suppression directives** — sources can suppress diagnostics with `// pi-lens-ignore` or `# pi-lens-ignore` comments; suppressed items are omitted from inline output.
|
|
24
|
+
- **High-complexity fact rule** — flags functions exceeding configurable cyclomatic complexity thresholds.
|
|
25
|
+
- **Unsafe-boundary fact rule** — detects dangerous boundary crossings (unvalidated user input → trusted context).
|
|
26
|
+
- **High-fan-out fact rule** — flags functions with excessive outgoing call count (default threshold 20).
|
|
27
|
+
- **`async-unnecessary-wrapper` ast-grep rule** — detects trivial async wrappers that just await and return.
|
|
28
|
+
- **`missing-error-propagation` ast-grep rule** — detects catch blocks that swallow errors without re-throwing or logging.
|
|
29
|
+
- **36 new ast-grep rules** — expanded coverage for security, correctness, and style across TypeScript, JavaScript, and Python.
|
|
30
|
+
- **5 quality fact rules** — structured quality checks driven by function-level metrics.
|
|
31
|
+
- **8 SonarJS-aligned rules** — try-catch enrichment and 8 rules ported from SonarJS patterns.
|
|
32
|
+
- **Slop-detection rules** — identifies low-signal / boilerplate-heavy code regions with observability log entries.
|
|
33
|
+
- **Dart-analyze dispatch runner** — runs `dart analyze` on `.dart` files.
|
|
34
|
+
- **Ktlint dispatch runner** — runs `ktlint` on `.kt` / `.kts` files.
|
|
35
|
+
- **TFLint dispatch runner** — runs `tflint` on `.tf` / `.tfvars` files.
|
|
36
|
+
- **Taplo dispatch runner + formatter** — runs `taplo` for TOML lint and format.
|
|
37
|
+
- **Credo dispatch runner** — runs `mix credo` on Elixir files (falls back to LSP).
|
|
38
|
+
- **Phpstan dispatch runner** — runs `phpstan` on PHP files (falls back to LSP).
|
|
39
|
+
- **Prettier-check dispatch runner** — runs `prettier --check` as a lint runner (not auto-fix, purely diagnostic).
|
|
40
|
+
- **PSScriptAnalyzer runner** — PowerShell linting via `Invoke-ScriptAnalyzer`, using temp `-File` instead of `-Command` to avoid cmd.exe mangling.
|
|
41
|
+
- **Hadolint dispatch runner** — Dockerfile lint with always-run dispatch gating.
|
|
42
|
+
- **Htmlhint dispatch runner** — HTML lint with tag-pair detection.
|
|
43
|
+
- **Docker / PHP / PowerShell / Prisma FileKind** — new language kind mappings enable LSP and dispatch for Dockerfile, `.php`, `.ps1`/`.psm1`, and `.prisma` files.
|
|
44
|
+
- **GitHub release downloader for installer** — `shellcheck`, `shfmt`, `rust-analyzer`, and `golangci-lint` are now auto-installed from GitHub releases with asset selection across platforms.
|
|
45
|
+
- **Auto-install gopls and ruby-lsp** — `gopls` installed via `go install`; `ruby-lsp` installed via `gem install` when not found.
|
|
46
|
+
- **Biome as default JS/TS linter** — when no ESLint or oxlint config exists, Biome runs as the default linter for write-path dispatch instead of silently skipping.
|
|
47
|
+
- **Bundled ruff config fallback** — Python projects without a `ruff.toml` / `pyproject.toml` ruff section now use a bundled safe-default config so ruff still produces useful findings.
|
|
48
|
+
- **Ruff autofix after diagnostics** — the ruff dispatch runner now applies safe autofixes after capturing diagnostics, mirroring Biome's write-path behavior.
|
|
49
|
+
- **Diagnostic history logging** — tree-sitter warnings and debounced ast-grep findings are now logged to session history for observability and `/lens-booboo` review.
|
|
50
|
+
- **Tree-sitter grammar downloads expanded** — additional grammars downloaded at install time for broader language coverage.
|
|
51
|
+
- **Java and C# fallback analysis** — dispatch includes fallback analysis paths for Java (`.java`) and C# (`.cs`) when LSP is unavailable.
|
|
52
|
+
- **CI: tsc type-check + vitest + install gate** — CI now runs `tsc --noEmit` and `vitest` as separate jobs; install-test is gated on both passing.
|
|
53
|
+
- **CI: tsx extension load check** — CI verifies that required extensions load correctly to catch missing dependency errors early.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
- **Promote LSP-backed languages into dispatch** — languages with active LSP servers now route through dispatch's standard pipeline instead of ad-hoc paths.
|
|
57
|
+
- **Dispatch language fallbacks aligned** — LSP-backed and fallback runner selection now uses consistent language-to-capability mapping.
|
|
58
|
+
- **CSS / HTML / TOML / Elixir fallback wiring** — dispatch fallbacks now include CSS (stylelint), HTML (htmlhint), TOML (taplo), and Elixir (credo).
|
|
59
|
+
- **Prettier-check and stylelint cwd handling** — both runners now resolve project root correctly instead of skipping when the working directory overshoots.
|
|
60
|
+
- **OS portability: vendor/bin and sg resolution** — `vendor/bin` tools resolve with multi-extension support (`.bat`/`.cmd`/no-ext); `sg` candidate list works across platforms.
|
|
61
|
+
- **LSP: live Windows registry PATH** — LSP spawn reads the live `HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path` at launch time so newly installed tools are immediately discoverable.
|
|
62
|
+
- **LSP: unified resolveAndLaunch** — four separate resolution mechanisms (local binary, global, npx, package manager) collapsed into a single `resolveAndLaunch` flow with clear fallback ordering.
|
|
63
|
+
- **LSP: telemetry and logging tightened** — init failures logged to `sessionstart.log`; terminal noise reduced; basename matching improved.
|
|
64
|
+
- **YAML LSP root fallback** — YAML language server uses `RootWithFallback` for seamless multi-root project support.
|
|
65
|
+
- **Dart / Terraform / TOML LSP: RootWithFallback** — same root-fallback pattern applied across these servers for reliable workspace detection.
|
|
66
|
+
- **Terraform-ls HashiCorp install fallback** — improved install path resolution for terraform-ls.
|
|
67
|
+
- **`empty-catch` and `unchecked-sync-fs` downgraded to warning** — too many false positives as errors; now `warning` severity.
|
|
68
|
+
- **High-fan-out threshold raised to 20** — reduced noise from earlier threshold of 10.
|
|
69
|
+
- **High-complexity and unsafe-boundary thresholds tightened** — reduced false positives at the default severity boundaries.
|
|
70
|
+
- **False-positive reduction: 8 rules + 3 error rules** — tuned OAuth/constants-related patterns, removed 3 error-level rules that flagged too broadly, and fixed `ts-ssrf` identifier argument matching.
|
|
71
|
+
- **Removed unused/noisy ast-grep rules** — culled rules that overlapped with tree-sitter coverage or produced excessive noise.
|
|
72
|
+
- **Moved duplicate TS tree-sitter rules** — overlapping rules relocated to `typescript-disabled/` to avoid double-reporting.
|
|
73
|
+
- **LSP crash diagnostics** — startup stderr captured and logged for faster root-cause analysis.
|
|
74
|
+
- **Tool PATH normalization** — cross-platform PATH resolution unified for LSP and dispatch tool spawning.
|
|
75
|
+
- **Cleaned up runtime dependencies** — moved `@ast-grep/napi` and `js-yaml` to `dependencies` (were `devDependencies`); removed unused deps.
|
|
76
|
+
- **Complexity reduction** — decomposed four highest-complexity functions (CC 75–153 → <20 each) for maintainability.
|
|
77
|
+
|
|
78
|
+
### Fixed
|
|
79
|
+
- **Windows LSP startup fallback** — hardened spawn logic for `.cmd` wrappers, PATH resolution, and process creation on Windows.
|
|
80
|
+
- **C# launch and secondary language fallbacks** — C# LSP and secondary language servers start reliably in more project layouts.
|
|
81
|
+
- **Prettier-check / stylelint cwd overshoot** — both runners now find the project root correctly instead of silently skipping.
|
|
82
|
+
- **Hadolint asset name case** — GitHub release downloader resolves case-sensitive asset names.
|
|
83
|
+
- **Htmlhint / hadolint always-run dispatch** — both runners fire correctly regardless of file presence heuristics.
|
|
84
|
+
- **Bash LSP re-spawn** — bash-language-server restarts cleanly after unexpected exit.
|
|
85
|
+
- **HTML dispatch + htmlhint tag-pair detection** — HTML file kind wired into dispatch; htmlhint catches missing closing tags.
|
|
86
|
+
- **Intelephense needs `scripts`** — PHP LSP installed with `--scripts` flag so its postinstall binary is available.
|
|
87
|
+
- **Rust-analyzer: RootWithFallback + Windows .zip asset** — both root detection and Windows asset extraction fixed.
|
|
88
|
+
- **Managed Pyright launch path** — pyright LSP binary resolves correctly when installed as a managed tool.
|
|
89
|
+
- **Terraform / Kotlin / coverage fallback handling** — all three dispatch paths handle missing tools or configs gracefully.
|
|
90
|
+
- **Shellcheck auto-install** — auto-installer works across platforms with GitHub release asset selection.
|
|
91
|
+
- **Ktlint asset names** — ktlint release assets resolved with correct URL patterns.
|
|
92
|
+
- **Coverage notice for mode:all linters** — mode:all linters that can't generate coverage now emit a notice instead of crashing.
|
|
93
|
+
- **npm install 120s timeout** — `ensureTool` npm installs have a hard 120s timeout to prevent indefinite hangs.
|
|
94
|
+
- **npm install ERESOLVE retry** — installer retries npm installs on ERESOLVE dependency conflicts.
|
|
95
|
+
- **Remove spawnSync from `unchecked-throwing-call` rule** — rule no longer flags `spawnSync` calls as unhandled throwing calls.
|
|
96
|
+
- **`flush()` drain before write-complete** — diagnostic history flush now drains pending entries before awaiting write completion, preventing data loss on session end.
|
|
97
|
+
- **Runner checks diagnostics-only** — dispatch runner checks are now diagnostics-only, avoiding stale LSP state mutations.
|
|
98
|
+
- **Biome-lsp server removed** — duplicate `biome-lsp` server entry removed; Biome LSP is accessed through the standard biome binary.
|
|
99
|
+
- **Size guards + path caching for ensureTool** — tool availability checks are cached and sized to avoid re-probing on every call.
|
|
100
|
+
- **Test assertions after runner wiring** — test expectations updated for new runner ordering and diagnostics pipeline.
|
|
101
|
+
- **OS path separator normalization** — path separators and map keys normalized for cross-platform compatibility in diagnostics and LSP.
|
|
102
|
+
- **Drop unnecessary async from `ensureAvailable`** — removed spurious `async` that added nothing and complicated error handling.
|
|
103
|
+
- **Tree-sitter rule false positives** — fixed query syntax, scan scripts, and architect glob patterns that produced incorrect findings.
|
|
104
|
+
|
|
105
|
+
### Performance
|
|
106
|
+
- **Startup: defer npm tool availability probes** — tool availability checks (Biome, ESLint, etc.) now run lazily out of the critical path, reducing session start latency.
|
|
107
|
+
- **Defer TypeScript loading in similarity runner** — similarity detection lazily imports the TypeScript parser, eliminating cold-start cost on first call.
|
|
108
|
+
|
|
109
|
+
### Refactored
|
|
110
|
+
- **LSP: collapse resolution into `resolveAndLaunch`** — unified four spawn mechanisms into one function with clear platform-aware fallbacks.
|
|
111
|
+
- **Booboo: replace bespoke tree-sitter runner** — `/lens-booboo` tree-sitter checks now use the same fact-rule pipeline as dispatch, eliminating code duplication.
|
|
112
|
+
- **Drop redundant async from LSP spawn** — removed unnecessary `async`/`await` from functions that already return Promises.
|
|
113
|
+
|
|
114
|
+
### Tests
|
|
115
|
+
- **GitHub release asset selection and PATH tests** — installer asset URL construction and PATH resolution covered by unit tests.
|
|
116
|
+
- **Rust-analyzer Windows .zip asset expectation** — test fixture updated for `.zip` extension on Windows.
|
|
117
|
+
- **Async-noise test multi-statement function** — test rule updated to match multi-statement function bodies.
|
|
6
118
|
|
|
7
119
|
## [3.8.26] - 2026-04-15
|
|
8
120
|
|
package/README.md
CHANGED
|
@@ -8,14 +8,18 @@ pi-lens focuses on real-time inline code feedback for AI agents.
|
|
|
8
8
|
|
|
9
9
|
On every `write` and `edit`, pi-lens runs a fast, language-aware pipeline (checks depend on file language, project config, and installed tools):
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
1. **Secrets scan** — blocking; aborts the write if credentials are detected
|
|
12
|
+
2. **Auto-format** — language-specific formatters (Biome, Prettier, Ruff, gofmt, rustfmt, and 25+ others)
|
|
13
|
+
3. **Auto-fix** — safe autofixes from 6 tools (Biome `--write`, Ruff `--fix`, ESLint `--fix`, stylelint `--fix`, sqlfluff `fix`, RuboCop `-a`) applied before analysis
|
|
14
|
+
4. **LSP file sync** — opens/updates the file in active language servers
|
|
15
|
+
5. **Dispatch lint** — parallel runner groups: LSP diagnostics, tree-sitter structural rules, ast-grep security/correctness rules, fact rules, language-specific linters, similarity detection, and architect checks
|
|
16
|
+
6. **Test runner** — runs the corresponding test file; reruns known failures first
|
|
17
|
+
7. **Cascade diagnostics** — review-graph impact cascade showing which other files were affected and how diagnostics propagated
|
|
18
|
+
|
|
19
|
+
Results are inline and actionable:
|
|
20
|
+
- **Blocking issues** — stop progress until fixed
|
|
21
|
+
- **Warnings** — summarized inline, detail in `/lens-booboo`
|
|
22
|
+
- **Health/telemetry** — available in `/lens-health`
|
|
19
23
|
|
|
20
24
|
### Session Start
|
|
21
25
|
|
|
@@ -28,7 +32,7 @@ At `session_start`, pi-lens:
|
|
|
28
32
|
- emits missing-tool install hints for detected languages when relevant
|
|
29
33
|
- injects session guidance through internal context (non-user channel) to reduce acknowledgement-only first responses
|
|
30
34
|
|
|
31
|
-
For one-shot print sessions (for example `pi --print ...`), pi-lens auto-uses a quick startup path that skips heavy bootstrap work to reduce startup latency.
|
|
35
|
+
For one-shot print sessions (for example `pi --print ...`), pi-lens auto-uses a quick startup path that skips heavy bootstrap work to reduce startup latency. Override with `PI_LENS_STARTUP_MODE=full|minimal|quick`.
|
|
32
36
|
|
|
33
37
|
### Turn End
|
|
34
38
|
|
|
@@ -37,12 +41,7 @@ At `turn_end`, pi-lens:
|
|
|
37
41
|
- summarizes deferred findings (for example duplicates/circulars)
|
|
38
42
|
- persists turn findings for next context injection
|
|
39
43
|
- updates debt/diagnostic tracking and cleans transient state
|
|
40
|
-
|
|
41
|
-
Inline output is intentionally concise and actionable.
|
|
42
|
-
|
|
43
|
-
- **Blocking issues**: shown inline and stop progress until fixed
|
|
44
|
-
- **Warnings**: summarized, with deeper detail in `/lens-booboo`
|
|
45
|
-
- **Health/telemetry**: available in `/lens-health`
|
|
44
|
+
- renders a review-graph impact cascade showing affected files and diagnostic propagation
|
|
46
45
|
|
|
47
46
|
## Install
|
|
48
47
|
|
|
@@ -59,11 +58,15 @@ pi install git:github.com/apmantza/pi-lens
|
|
|
59
58
|
## Run
|
|
60
59
|
|
|
61
60
|
```bash
|
|
62
|
-
# Standard mode
|
|
61
|
+
# Standard mode (LSP enabled by default)
|
|
63
62
|
pi
|
|
64
63
|
|
|
65
|
-
# Optional
|
|
66
|
-
pi --no-lsp
|
|
64
|
+
# Optional switches
|
|
65
|
+
pi --no-lsp # Disable unified LSP, use language-specific fallbacks
|
|
66
|
+
pi --no-autoformat # Skip auto-formatting
|
|
67
|
+
pi --no-autofix # Skip auto-fix (Biome, Ruff, ESLint, stylelint, sqlfluff, RuboCop)
|
|
68
|
+
pi --no-tests # Skip test runner
|
|
69
|
+
pi --no-shellcheck # Disable shellcheck runner
|
|
67
70
|
```
|
|
68
71
|
|
|
69
72
|
## Key Commands
|
|
@@ -71,50 +74,181 @@ pi --no-lsp
|
|
|
71
74
|
- `/lens-booboo` — full quality report for current project state
|
|
72
75
|
- `/lens-health` — runtime health, latency, and diagnostic telemetry
|
|
73
76
|
|
|
74
|
-
##
|
|
77
|
+
## Language Coverage
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
pi-lens supports **35+ languages** through dispatch runners and LSP integration:
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
|
|
81
|
+
| Language | LSP | Dispatch Runners | Formatter |
|
|
82
|
+
|---|---|---|---|
|
|
83
|
+
| JavaScript/TypeScript | ✓ | lsp, ts-lsp, biome-check-json, tree-sitter, ast-grep-napi, type-safety, similarity, fact-rules, eslint, architect | biome, prettier |
|
|
84
|
+
| Python | ✓ | lsp, pyright, ruff-lint, tree-sitter, python-slop, architect | ruff, black |
|
|
85
|
+
| Go | ✓ | lsp, go-vet, golangci-lint, tree-sitter | gofmt |
|
|
86
|
+
| Rust | ✓ | lsp, rust-clippy, tree-sitter | rustfmt |
|
|
87
|
+
| Ruby | ✓ | lsp, rubocop, tree-sitter | rubocop, standardrb |
|
|
88
|
+
| C/C++ | ✓ | lsp, cpp-check | clang-format |
|
|
89
|
+
| Shell | ✓ | lsp, shellcheck | shfmt |
|
|
90
|
+
| CSS/SCSS/Less | ✓ | lsp, stylelint, prettier-check | biome, prettier |
|
|
91
|
+
| HTML | ✓ | lsp, htmlhint, prettier-check | prettier |
|
|
92
|
+
| YAML | ✓ | lsp, yamllint | prettier |
|
|
93
|
+
| JSON | ✓ | lsp | biome, prettier |
|
|
94
|
+
| SQL | — | sqlfluff | sqlfluff |
|
|
95
|
+
| Markdown | — | spellcheck, markdownlint | prettier |
|
|
96
|
+
| Docker | ✓ | lsp, hadolint | — |
|
|
97
|
+
| PHP | ✓ | lsp, php-lint, phpstan | php-cs-fixer |
|
|
98
|
+
| PowerShell | ✓ | lsp, psscriptanalyzer | — |
|
|
99
|
+
| Prisma | ✓ | lsp, prisma-validate | — |
|
|
100
|
+
| C# | ✓ | lsp, dotnet-build | csharpier |
|
|
101
|
+
| F# | ✓ | lsp | fantomas |
|
|
102
|
+
| Java | ✓ | lsp, javac | — |
|
|
103
|
+
| Kotlin | ✓ | lsp, ktlint | ktlint |
|
|
104
|
+
| Swift | ✓ | lsp | swiftformat |
|
|
105
|
+
| Dart | ✓ | lsp, dart-analyze | dart format |
|
|
106
|
+
| Lua | ✓ | lsp | stylua |
|
|
107
|
+
| Zig | ✓ | lsp, zig-check | zig fmt |
|
|
108
|
+
| Haskell | ✓ | lsp | ormolu |
|
|
109
|
+
| Elixir | ✓ | lsp, elixir-check, credo | mix format |
|
|
110
|
+
| Gleam | ✓ | lsp, gleam-check | gleam format |
|
|
111
|
+
| OCaml | ✓ | lsp | ocamlformat |
|
|
112
|
+
| Clojure | ✓ | lsp | — |
|
|
113
|
+
| Terraform | ✓ | lsp, tflint | terraform fmt |
|
|
114
|
+
| Nix | ✓ | lsp | nixfmt |
|
|
115
|
+
| TOML | ✓ | lsp, taplo | taplo |
|
|
116
|
+
| CMake | ✓ | lsp | — |
|
|
117
|
+
|
|
118
|
+
## Fact Rules Pipeline
|
|
119
|
+
|
|
120
|
+
Dispatch includes a fact-rule engine that extracts function-level metrics (cyclomatic complexity, nesting depth, outgoing calls) and evaluates quality rules inline:
|
|
121
|
+
|
|
122
|
+
- **high-complexity** — flags functions exceeding configurable CC thresholds
|
|
123
|
+
- **unsafe-boundary** — detects dangerous boundary crossings (unvalidated user input → trusted context)
|
|
124
|
+
- **high-fan-out** — flags excessive outgoing call count (default threshold: 20)
|
|
125
|
+
- **comment-facts** — classifies comment quality (TODO density, doc coverage)
|
|
126
|
+
- **try-catch-facts** — flags empty/obscuring catch blocks
|
|
127
|
+
- **import-facts** — detects circular/star/unused imports
|
|
128
|
+
- **file-role** — classifies files as source/test/config/vendor and adjusts severity
|
|
129
|
+
|
|
130
|
+
## Tree-sitter Rules
|
|
131
|
+
|
|
132
|
+
Structural rules are organized by language in `rules/tree-sitter-queries/`:
|
|
133
|
+
|
|
134
|
+
- **TypeScript** (18 rules): console-statement, debugger, deep-nesting, eval, sql-injection, ssrf, weak-hash, unsafe-regex, variable-shadowing, and more
|
|
135
|
+
- **Python** (26 rules): debug statements, hardcoded secrets, mutable class attrs, unsafe regex, empty except, and more
|
|
136
|
+
- **Go** (17 rules): defer-in-loop, hardcoded secrets, unchecked errors, and more
|
|
137
|
+
- **Rust** (6 rules): unsafe blocks, unwrap outside tests, and more
|
|
138
|
+
- **Ruby** (15 rules): empty rescue, rescue Exception, debugger, hardcoded secrets, and more
|
|
139
|
+
|
|
140
|
+
Plus **180+ ast-grep rules** in `rules/ast-grep-rules/` covering security (no-eval, jwt-no-verify, no-hardcoded-secrets, no-insecure-randomness), correctness (strict-equality, empty-catch, no-cond-assign), and style patterns across JS/TS/Python.
|
|
141
|
+
|
|
142
|
+
## Review Graph
|
|
143
|
+
|
|
144
|
+
pi-lens builds a review graph (`file → symbol → dependency`) during session and uses it at turn end to render an impact cascade: which files were affected by a change and how diagnostics propagated through the dependency graph. Nodes track kind, language, and export status; edges track contains/imports/calls/references.
|
|
145
|
+
|
|
146
|
+
## LSP Support
|
|
147
|
+
|
|
148
|
+
pi-lens includes **37 language server definitions**. LSP is **enabled by default** (`--lsp` or no flag). Servers are auto-discovered from PATH, project `node_modules`, and managed installs. When a server is not installed, pi-lens offers an interactive install prompt.
|
|
149
|
+
|
|
150
|
+
LSP servers for: TypeScript, Deno, Python (pyright + pylsp), Go, Rust, Ruby (ruby-lsp + solargraph), PHP, C# (omnisharp), F#, Java, Kotlin, Swift, Dart, Lua, C/C++, Zig, Haskell, Elixir, Gleam, OCaml, Clojure, Terraform, Nix, Bash, Docker, YAML, JSON, HTML, TOML, Prisma, Vue, Svelte, ESLint, CSS.
|
|
84
151
|
|
|
85
|
-
|
|
86
|
-
|
|
152
|
+
## Runners
|
|
153
|
+
|
|
154
|
+
44 registered dispatch runners:
|
|
155
|
+
|
|
156
|
+
| Category | Runners |
|
|
157
|
+
|---|---|
|
|
158
|
+
| LSP | `lsp`, `ts-lsp`, `pyright` |
|
|
159
|
+
| JS/TS | `biome-check-json`, `eslint`, `ast-grep-napi`, `type-safety`, `similarity`, `tree-sitter`, `fact-rules` |
|
|
160
|
+
| Python | `ruff-lint`, `tree-sitter`, `python-slop`, `mypy` |
|
|
161
|
+
| Go | `go-vet`, `golangci-lint` |
|
|
162
|
+
| Rust | `rust-clippy` |
|
|
163
|
+
| Ruby | `rubocop` |
|
|
164
|
+
| PHP | `php-lint`, `phpstan` |
|
|
165
|
+
| C# | `dotnet-build` |
|
|
166
|
+
| Java | `javac` |
|
|
167
|
+
| Kotlin | `ktlint` |
|
|
168
|
+
| Dart | `dart-analyze` |
|
|
169
|
+
| Elixir | `elixir-check`, `credo` |
|
|
170
|
+
| Gleam | `gleam-check` |
|
|
171
|
+
| Zig | `zig-check` |
|
|
172
|
+
| C/C++ | `cpp-check` |
|
|
173
|
+
| Docker | `hadolint` |
|
|
174
|
+
| HTML | `htmlhint` |
|
|
175
|
+
| CSS | `stylelint`, `prettier-check` |
|
|
176
|
+
| Markdown | `markdownlint`, `spellcheck` |
|
|
177
|
+
| Shell | `shellcheck`, `shfmt` |
|
|
178
|
+
| YAML | `yamllint` |
|
|
179
|
+
| SQL | `sqlfluff` |
|
|
180
|
+
| TOML | `taplo` |
|
|
181
|
+
| Terraform | `tflint` |
|
|
182
|
+
| PowerShell | `psscriptanalyzer` |
|
|
183
|
+
| Prisma | `prisma-validate` |
|
|
184
|
+
| Architecture | `architect`, `fact-rules` |
|
|
185
|
+
|
|
186
|
+
Runners are language/config-gated and skip when not applicable. `ast-grep-napi` runs in post-write dispatch for JS/TS with blocker-focused filtering; `/lens-booboo` additionally runs full CLI ast-grep scans.
|
|
187
|
+
|
|
188
|
+
## Formatters
|
|
189
|
+
|
|
190
|
+
pi-lens auto-detects and runs **26 formatters** based on project config:
|
|
191
|
+
|
|
192
|
+
biome, prettier, ruff, black, sqlfluff, gofmt, rustfmt, zig fmt, dart format, shfmt, nixfmt, mix format, ocamlformat, clang-format, ktlint, rubocop, standardrb, gleam format, terraform fmt, php-cs-fixer, csharpier, fantomas, swiftformat, stylua, ormolu, taplo
|
|
193
|
+
|
|
194
|
+
Detection rules:
|
|
195
|
+
- **Config-gated**: only runs when project config indicates usage (e.g. `biome.json`, `.prettierrc`, `ruff.toml`)
|
|
196
|
+
- **Nearest-wins**: when multiple formatter configs exist at different directory levels, the one closest to the edited file wins
|
|
197
|
+
- **Biome-default**: for JS/TS files without Prettier or Biome config, Biome is used as the default formatter
|
|
198
|
+
- **Ruff-default**: for Python files without Black config, Ruff format is used when available
|
|
87
199
|
|
|
88
200
|
## Dependencies
|
|
89
201
|
|
|
90
202
|
Auto-install behavior depends on gate type:
|
|
91
203
|
|
|
92
|
-
- **Config-gated**: installs only when project config/deps indicate usage
|
|
93
|
-
- **Flow/language-gated**: installs when the runtime path needs it for the current file/session flow
|
|
94
|
-
- **Operational prewarm**: installs during session warm scans / turn-end analysis paths
|
|
204
|
+
- **Config-gated**: installs only when project config/deps indicate usage
|
|
205
|
+
- **Flow/language-gated**: installs when the runtime path needs it for the current file/session flow
|
|
206
|
+
- **Operational prewarm**: installs during session warm scans / turn-end analysis paths
|
|
207
|
+
- **GitHub release**: platform-specific binary downloaded from GitHub releases to `~/.pi-lens/bin/`
|
|
95
208
|
|
|
96
209
|
| Tool | Purpose | Auto-installed | Gate |
|
|
97
210
|
|---|---|---|---|
|
|
98
|
-
| `@biomejs/biome` | JS/TS lint/format/autofix | Yes | Config-gated
|
|
99
|
-
| `prettier` | Formatting fallback | Yes | Config-gated
|
|
100
|
-
| `yamllint` | YAML linting | Yes | Config-gated
|
|
101
|
-
| `sqlfluff` | SQL linting/formatting | Yes | Config-gated
|
|
102
|
-
| `ruff` | Python lint/format/autofix | Yes | Language-default + flow-gated
|
|
103
|
-
| `typescript-language-server` | Unified LSP diagnostics | Yes | Language-default
|
|
104
|
-
| `
|
|
105
|
-
|
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
211
|
+
| `@biomejs/biome` | JS/TS lint/format/autofix | Yes | Config-gated |
|
|
212
|
+
| `prettier` | Formatting fallback | Yes | Config-gated |
|
|
213
|
+
| `yamllint` | YAML linting | Yes | Config-gated |
|
|
214
|
+
| `sqlfluff` | SQL linting/formatting | Yes | Config-gated |
|
|
215
|
+
| `ruff` | Python lint/format/autofix | Yes | Language-default + flow-gated |
|
|
216
|
+
| `typescript-language-server` | Unified LSP diagnostics | Yes | Language-default |
|
|
217
|
+
| `typescript` | TypeScript compiler | Yes | Language-default |
|
|
218
|
+
| `pyright` | Python type diagnostics fallback | Yes | Flow/language-gated |
|
|
219
|
+
| `@ast-grep/cli` (sg) | AST scans/search/replace | Yes | Operational prewarm |
|
|
220
|
+
| `knip` | Dead code analysis | Yes | Operational prewarm + config-gated |
|
|
221
|
+
| `jscpd` | Duplicate code detection | Yes | Operational prewarm + config-gated |
|
|
108
222
|
| `madge` | Circular dependency analysis | Yes | Turn-end analysis flow |
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
223
|
+
| `mypy` | Python type checking | Yes | Flow-gated |
|
|
224
|
+
| `stylelint` | CSS/SCSS/Less linting | Yes | Config-gated |
|
|
225
|
+
| `markdownlint-cli2` | Markdown linting | Yes | Config-gated |
|
|
226
|
+
| `shellcheck` | Shell script linting | Yes | GitHub release |
|
|
227
|
+
| `shfmt` | Shell script formatting | Yes | GitHub release |
|
|
228
|
+
| `rust-analyzer` | Rust LSP | Yes | GitHub release |
|
|
229
|
+
| `golangci-lint` | Go linting | Yes | GitHub release |
|
|
230
|
+
| `hadolint` | Dockerfile linting | Yes | GitHub release |
|
|
231
|
+
| `ktlint` | Kotlin linting | Yes | GitHub release |
|
|
232
|
+
| `tflint` | Terraform linting | Yes | GitHub release |
|
|
233
|
+
| `taplo` | TOML linting/formatting | Yes | GitHub release |
|
|
234
|
+
| `terraform-ls` | Terraform LSP | Yes | GitHub release |
|
|
235
|
+
| `htmlhint` | HTML linting | Yes | Config-gated |
|
|
236
|
+
| `@prisma/language-server` | Prisma LSP | Yes | Flow-gated |
|
|
237
|
+
| `dockerfile-language-server-nodejs` | Dockerfile LSP | Yes | Flow-gated |
|
|
238
|
+
| `intelephense` | PHP LSP | Yes | Flow-gated |
|
|
239
|
+
| `bash-language-server` | Bash LSP | Yes | Language-default |
|
|
240
|
+
| `yaml-language-server` | YAML LSP | Yes | Language-default |
|
|
241
|
+
| `vscode-langservers-extracted` | JSON/ESLint/CSS/HTML LSP | Yes | Language-default |
|
|
242
|
+
| `vscode-css-languageserver` | CSS LSP | Yes | Language-default |
|
|
243
|
+
| `vscode-html-languageserver-bin` | HTML LSP | Yes | Language-default |
|
|
244
|
+
| `svelte-language-server` | Svelte LSP | Yes | Flow-gated |
|
|
245
|
+
| `@vue/language-server` | Vue LSP | Yes | Flow-gated |
|
|
246
|
+
| `psscriptanalyzer` | PowerShell linting | Manual | — |
|
|
247
|
+
|
|
248
|
+
Additional language servers (gopls, ruby-lsp, solargraph, etc.) are auto-detected from PATH or installed via native package managers (`go install`, `gem install`) when their language is detected.
|
|
116
249
|
|
|
117
250
|
## Notes
|
|
118
251
|
|
|
119
252
|
- Not every auto-install runs in every project: gate type decides when install is attempted.
|
|
120
253
|
- Rule packs are customizable via project-level rule directories.
|
|
254
|
+
- Inline suppression: `// pi-lens-ignore` or `# pi-lens-ignore` comments suppress diagnostic output for that line.
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* No external dependencies — purely tracks tool call history.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { normalizeMapKey } from "./path-utils.js";
|
|
12
|
+
|
|
11
13
|
// --- Types ---
|
|
12
14
|
|
|
13
15
|
export type BehaviorWarning = {
|
|
@@ -107,9 +109,10 @@ export class AgentBehaviorClient {
|
|
|
107
109
|
|
|
108
110
|
// Track edits per file
|
|
109
111
|
if (filePath) {
|
|
112
|
+
const key = normalizeMapKey(filePath);
|
|
110
113
|
this.fileEditCount.set(
|
|
111
|
-
|
|
112
|
-
(this.fileEditCount.get(
|
|
114
|
+
key,
|
|
115
|
+
(this.fileEditCount.get(key) ?? 0) + 1,
|
|
113
116
|
);
|
|
114
117
|
}
|
|
115
118
|
}
|
package/clients/biome-client.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import * as fs from "node:fs";
|
|
12
|
+
import * as os from "node:os";
|
|
12
13
|
import * as path from "node:path";
|
|
13
14
|
import { isFileKind } from "./file-kinds.js";
|
|
14
15
|
import { safeSpawn, safeSpawnAsync } from "./safe-spawn.js";
|
|
@@ -60,16 +61,29 @@ export class BiomeClient {
|
|
|
60
61
|
if (this.localBinaryPath) return { cmd: this.localBinaryPath, args: [] };
|
|
61
62
|
|
|
62
63
|
// Walk up from cwd looking for node_modules/.bin/biome.
|
|
64
|
+
// Also check ~/.pi-lens/tools (where ensureTool("biome") auto-installs),
|
|
65
|
+
// so we avoid the ~1.5s `npx @biomejs/biome --version` fallback when
|
|
66
|
+
// the tool is already installed but not in the project's node_modules.
|
|
63
67
|
// On Windows prefer .cmd (native batch) over the sh wrapper — 2x faster.
|
|
64
68
|
const isWin = process.platform === "win32";
|
|
69
|
+
const piLensBin = path.join(
|
|
70
|
+
os.homedir(),
|
|
71
|
+
".pi-lens",
|
|
72
|
+
"tools",
|
|
73
|
+
"node_modules",
|
|
74
|
+
".bin",
|
|
75
|
+
);
|
|
65
76
|
const candidates = isWin
|
|
66
77
|
? [
|
|
67
78
|
path.join(process.cwd(), "node_modules", ".bin", "biome.cmd"),
|
|
68
79
|
path.join(process.cwd(), "node_modules", ".bin", "biome"),
|
|
80
|
+
path.join(piLensBin, "biome.cmd"),
|
|
81
|
+
path.join(piLensBin, "biome"),
|
|
69
82
|
]
|
|
70
83
|
: [
|
|
71
84
|
path.join(process.cwd(), "node_modules", ".bin", "biome"),
|
|
72
85
|
path.join(process.cwd(), "node_modules", ".bin", "biome.cmd"),
|
|
86
|
+
path.join(piLensBin, "biome"),
|
|
73
87
|
];
|
|
74
88
|
for (const p of candidates) {
|
|
75
89
|
if (fs.existsSync(p)) {
|
|
@@ -57,7 +57,7 @@ export interface Diagnostic {
|
|
|
57
57
|
message?: string;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
interface LogContext {
|
|
60
|
+
export interface LogContext {
|
|
61
61
|
model: string;
|
|
62
62
|
sessionId: string;
|
|
63
63
|
turnIndex: number;
|
|
@@ -100,7 +100,7 @@ export function createDiagnosticLogger(): DiagnosticLogger {
|
|
|
100
100
|
try {
|
|
101
101
|
await fs.promises.appendFile(getLogFile(), lines);
|
|
102
102
|
} catch (err) {
|
|
103
|
-
//
|
|
103
|
+
// pi-lens-ignore: missing-error-propagation — fire-and-forget log write, must not throw
|
|
104
104
|
console.error("Failed to write diagnostic log:", err);
|
|
105
105
|
}
|
|
106
106
|
writing = false;
|
|
@@ -137,7 +137,8 @@ export function createDiagnosticLogger(): DiagnosticLogger {
|
|
|
137
137
|
},
|
|
138
138
|
|
|
139
139
|
async flush() {
|
|
140
|
-
//
|
|
140
|
+
// Drain any buffered entries, then wait for the write to finish.
|
|
141
|
+
await writePending();
|
|
141
142
|
while (writing) {
|
|
142
143
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
143
144
|
}
|