pi-lens 3.8.5 → 3.8.19

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.
Files changed (143) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/README.md +73 -664
  3. package/clients/architect-client.ts +9 -1
  4. package/clients/biome-client.ts +69 -1
  5. package/clients/cache/rule-cache.ts +6 -5
  6. package/clients/cache-manager.ts +24 -1
  7. package/clients/diagnostic-logger.ts +146 -0
  8. package/clients/diagnostic-tracker.ts +163 -0
  9. package/clients/dispatch/diagnostic-taxonomy.ts +55 -0
  10. package/clients/dispatch/dispatcher.ts +246 -33
  11. package/clients/dispatch/integration.ts +84 -9
  12. package/clients/dispatch/plan.ts +123 -160
  13. package/clients/dispatch/runner-context.ts +16 -0
  14. package/clients/dispatch/runners/architect.ts +10 -3
  15. package/clients/dispatch/runners/ast-grep-napi.ts +122 -3
  16. package/clients/dispatch/runners/biome-check.ts +159 -0
  17. package/clients/dispatch/runners/biome.ts +9 -2
  18. package/clients/dispatch/runners/eslint.ts +29 -3
  19. package/clients/dispatch/runners/golangci-lint.ts +10 -2
  20. package/clients/dispatch/runners/index.ts +6 -5
  21. package/clients/dispatch/runners/lsp.ts +45 -17
  22. package/clients/dispatch/runners/oxlint.ts +1 -1
  23. package/clients/dispatch/runners/pyright.ts +12 -1
  24. package/clients/dispatch/runners/rubocop.ts +10 -2
  25. package/clients/dispatch/runners/ruff.ts +10 -2
  26. package/clients/dispatch/runners/rust-clippy.ts +22 -5
  27. package/clients/dispatch/runners/shellcheck.ts +24 -8
  28. package/clients/dispatch/runners/similarity.ts +144 -29
  29. package/clients/dispatch/runners/spellcheck.ts +1 -1
  30. package/clients/dispatch/runners/sqlfluff.ts +133 -0
  31. package/clients/dispatch/runners/tree-sitter.ts +71 -120
  32. package/clients/dispatch/runners/ts-lsp.ts +13 -6
  33. package/clients/dispatch/runners/utils/lazy-installer.ts +54 -0
  34. package/clients/dispatch/runners/utils/runner-helpers.ts +16 -7
  35. package/clients/dispatch/runners/yaml-rule-parser.ts +10 -0
  36. package/clients/dispatch/runners/yamllint.ts +130 -0
  37. package/clients/dispatch/types.ts +16 -6
  38. package/clients/file-kinds.ts +5 -1
  39. package/clients/file-utils.ts +75 -0
  40. package/clients/fix-scanners.ts +2 -2
  41. package/clients/format-service.ts +32 -41
  42. package/clients/formatters.ts +113 -4
  43. package/clients/git-guard.ts +41 -0
  44. package/clients/installer/index.ts +21 -1
  45. package/clients/jscpd-client.ts +61 -10
  46. package/clients/knip-client.ts +72 -9
  47. package/clients/lsp/client.ts +45 -2
  48. package/clients/lsp/index.ts +13 -6
  49. package/clients/metrics-history.ts +1 -1
  50. package/clients/pipeline.ts +283 -75
  51. package/clients/production-readiness.ts +3 -3
  52. package/clients/project-index.ts +2 -0
  53. package/clients/ruff-client.ts +79 -1
  54. package/clients/rules-scanner.ts +34 -4
  55. package/clients/runtime-config.ts +24 -0
  56. package/clients/runtime-context.ts +27 -0
  57. package/clients/runtime-coordinator.ts +195 -0
  58. package/clients/runtime-session.ts +371 -0
  59. package/clients/runtime-tool-result.ts +267 -0
  60. package/clients/runtime-turn.ts +241 -0
  61. package/clients/scan-utils.ts +5 -2
  62. package/clients/secrets-scanner.ts +40 -0
  63. package/clients/session-summary.ts +32 -0
  64. package/clients/source-filter.ts +3 -15
  65. package/clients/startup-scan.ts +2 -2
  66. package/clients/test-runner-client.ts +255 -21
  67. package/clients/tree-sitter-client.ts +132 -54
  68. package/clients/tree-sitter-query-loader.ts +19 -3
  69. package/clients/type-coverage-client.ts +1 -1
  70. package/commands/booboo.ts +84 -53
  71. package/config/biome/core.jsonc +85 -0
  72. package/config/eslint/core.mjs +28 -0
  73. package/index.ts +389 -1357
  74. package/package.json +5 -1
  75. package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +11 -0
  76. package/rules/ast-grep-rules/rules/no-blank-target-js.yml +14 -0
  77. package/rules/ast-grep-rules/rules/no-global-eval-js.yml +14 -0
  78. package/rules/tree-sitter-queries/go/go-bare-error.yml +2 -0
  79. package/rules/tree-sitter-queries/go/go-defer-in-loop.yml +2 -0
  80. package/rules/tree-sitter-queries/go/go-hardcoded-secrets.yml +2 -0
  81. package/rules/tree-sitter-queries/python/bare-except.yml +2 -0
  82. package/rules/tree-sitter-queries/python/eval-exec.yml +2 -0
  83. package/rules/tree-sitter-queries/python/is-vs-equals.yml +2 -0
  84. package/rules/tree-sitter-queries/python/mutable-default-arg.yml +2 -0
  85. package/rules/tree-sitter-queries/python/python-debugger.yml +2 -0
  86. package/rules/tree-sitter-queries/python/python-empty-except.yml +2 -0
  87. package/rules/tree-sitter-queries/python/python-hardcoded-secrets.yml +2 -0
  88. package/rules/tree-sitter-queries/python/python-mutable-class-attr.yml +2 -0
  89. package/rules/tree-sitter-queries/python/python-print-statement.yml +2 -0
  90. package/rules/tree-sitter-queries/python/python-raise-string.yml +2 -0
  91. package/rules/tree-sitter-queries/python/python-unsafe-regex.yml +2 -0
  92. package/rules/tree-sitter-queries/python/unreachable-except.yml +2 -0
  93. package/rules/tree-sitter-queries/python/wildcard-import.yml +2 -0
  94. package/rules/tree-sitter-queries/ruby/ruby-debugger.yml +2 -0
  95. package/rules/tree-sitter-queries/ruby/ruby-empty-rescue.yml +2 -0
  96. package/rules/tree-sitter-queries/ruby/ruby-eval.yml +2 -0
  97. package/rules/tree-sitter-queries/ruby/ruby-hardcoded-secrets.yml +2 -0
  98. package/rules/tree-sitter-queries/ruby/ruby-open-struct.yml +2 -0
  99. package/rules/tree-sitter-queries/ruby/ruby-puts-statement.yml +2 -0
  100. package/rules/tree-sitter-queries/ruby/ruby-rescue-exception.yml +2 -0
  101. package/rules/tree-sitter-queries/ruby/ruby-unsafe-regex.yml +2 -0
  102. package/rules/tree-sitter-queries/rust/rust-clone-in-loop.yml +2 -0
  103. package/rules/tree-sitter-queries/rust/rust-unwrap.yml +2 -0
  104. package/rules/tree-sitter-queries/tsx/dangerously-set-inner-html.yml +2 -0
  105. package/rules/tree-sitter-queries/tsx/no-nested-links.yml +2 -0
  106. package/rules/tree-sitter-queries/typescript/await-in-loop.yml +2 -0
  107. package/rules/tree-sitter-queries/typescript/console-statement.yml +2 -0
  108. package/rules/tree-sitter-queries/typescript/constructor-super.yml +2 -0
  109. package/rules/tree-sitter-queries/typescript/debugger.yml +2 -0
  110. package/rules/tree-sitter-queries/typescript/deep-nesting.yml +2 -0
  111. package/rules/tree-sitter-queries/typescript/deep-promise-chain.yml +2 -0
  112. package/rules/tree-sitter-queries/typescript/empty-catch.yml +2 -0
  113. package/rules/tree-sitter-queries/typescript/eval.yml +2 -0
  114. package/rules/tree-sitter-queries/typescript/hardcoded-secrets.yml +2 -0
  115. package/rules/tree-sitter-queries/typescript/long-parameter-list.yml +2 -0
  116. package/rules/tree-sitter-queries/typescript/mixed-async-styles.yml +2 -0
  117. package/rules/tree-sitter-queries/typescript/nested-ternary.yml +2 -0
  118. package/rules/tree-sitter-queries/typescript/no-console-in-tests.yml +2 -0
  119. package/rules/tree-sitter-queries/typescript/no-dupe-class-members.yml +2 -0
  120. package/rules/tree-sitter-queries/typescript/sql-injection.yml +2 -0
  121. package/rules/tree-sitter-queries/typescript/unsafe-regex.yml +2 -0
  122. package/rules/tree-sitter-queries/typescript/variable-shadowing.yml +2 -0
  123. package/scripts/audit-tree-sitter-rules.mjs +58 -0
  124. package/scripts/check-extensions.mjs +87 -87
  125. package/scripts/download-grammars.js +45 -50
  126. package/tools/ast-grep-replace.js +65 -0
  127. package/tools/ast-grep-replace.ts +102 -0
  128. package/tools/ast-grep-search.js +106 -0
  129. package/tools/ast-grep-search.ts +149 -0
  130. package/tools/lsp-navigation.js +216 -0
  131. package/tools/lsp-navigation.ts +275 -0
  132. package/tools/shared.js +29 -0
  133. package/tools/shared.ts +30 -0
  134. package/clients/dispatch/runners/ast-grep.ts +0 -204
  135. package/clients/dispatch/runners/config-validation.ts +0 -82
  136. package/clients/dispatch/runners/ts-slop.ts +0 -152
  137. package/docs/ARCHITECTURE.md +0 -74
  138. package/docs/AST_GREP_RULES.md +0 -266
  139. package/docs/COMPLEXITY_METRICS.md +0 -120
  140. package/docs/EXCLUSIONS.md +0 -83
  141. package/docs/LSP_CONFIG.md +0 -240
  142. package/docs/TREE_SITTER_RULES.md +0 -340
  143. package/docs/WRITING_NEW_AST_GREP_RULES.md +0 -200
package/CHANGELOG.md CHANGED
@@ -2,6 +2,150 @@
2
2
 
3
3
  All notable changes to pi-lens will be documented in this file.
4
4
 
5
+ ## [3.8.19] - 2026-04-07
6
+
7
+ ### Fixed
8
+ - **Biome autofix gating** — Biome autofix/auto-install now runs only when the project has Biome configuration (`biome.json`/`biome.jsonc`) or `@biomejs/biome` in `devDependencies`, preventing unwanted Biome installs in non-Biome JS/TS projects.
9
+
10
+ ## [3.8.18] - 2026-04-07
11
+
12
+ ### Changed
13
+ - **Similarity calibration tightened** — raised semantic similarity threshold to `0.96`, raised minimum transition signal to `40`, and added transition-ratio filtering to reduce boilerplate-wrapper false positives.
14
+ - **Dispatch + booboo alignment** — similarity guardrails are now aligned between `/lens-booboo` reporting and the dispatch `similarity` runner.
15
+ - **Tree-sitter structural dedupe in booboo** — advanced structural findings now dedupe repeated line-level matches by normalized matched scope so deep nesting/promise chain reports collapse to one representative issue.
16
+
17
+ ### Tests
18
+ - Added similarity runner guardrail assertions in `tests/clients/similarity-runner.test.ts`.
19
+
20
+ ## [3.8.17] - 2026-04-07
21
+
22
+ ### Changed
23
+ - **Delta-only unused variable blocking** — diagnostics matching unused-value patterns are now promoted to blocking only when they are newly introduced in delta mode.
24
+ - **Unused diagnostic heuristics** — improved detection covers TypeScript unused codes/messages and `no-unused*` rule identifiers, while preserving non-blocking behavior for pre-existing baseline debt.
25
+
26
+ ### Tests
27
+ - Added dispatch flow coverage for delta-mode unused-value promotion in `tests/clients/dispatch/dispatcher-flow.test.ts`.
28
+
29
+ ## [3.8.16] - 2026-04-07
30
+
31
+ ### Changed
32
+ - **Ast-grep fix guidance upgraded** — ast-grep diagnostics now prefer explicit rule-level guidance from YAML (`fix` first, then `note`) before falling back to generic defect-class suggestions.
33
+ - **Rule parser metadata support** — YAML rule parsing now supports top-level `note` and `fix` fields (including multiline values) for agent-facing remediation text.
34
+
35
+ ### Tests
36
+ - Added parser coverage for `note`/`fix` extraction in `tests/clients/dispatch/runners/yaml-rule-parser.test.ts`.
37
+
38
+ ## [3.8.15] - 2026-04-07
39
+
40
+ ### Added
41
+ - **Security rule: no global eval** — added ast-grep rule to block `eval(...)`, `Function(...)`, and string-based `setTimeout`/`setInterval` execution.
42
+ - **Security rule: no blank target** — added ast-grep rule to warn on `<a target="_blank">` without `rel=...`.
43
+ - **Performance rule: no accumulating spread** — added ast-grep rule to warn on reduce patterns that repeatedly spread accumulators.
44
+
45
+ ## [3.8.14] - 2026-04-07
46
+
47
+ ### Added
48
+ - **YAML lint runner** — added `yamllint` dispatch support for `.yaml`/`.yml` files, with LSP prepended when enabled.
49
+ - **SQL lint + format support** — added `sqlfluff` dispatch support for `.sql` files and `sqlfluff` formatter integration.
50
+ - **SQL file kind support** — introduced `sql` file kind detection and language-id mapping.
51
+
52
+ ### Changed
53
+ - **Capability matrix coverage expanded** — YAML and SQL now map to dedicated lint runners in the centralized capability matrix.
54
+ - **Lazy auto-install expansion** — added lazy-install support for `yamllint` and `sqlfluff` via installer-managed pip tools.
55
+ - **Runner inventory docs updated** — README runner list now includes `yamllint` and `sqlfluff`.
56
+
57
+ ### Tests
58
+ - Added YAML/SQL runner parsing/semantics coverage in `tests/clients/dispatch/runners/yaml-sql-runners.test.ts`.
59
+ - Updated dispatch plan/integration tests for YAML+SQL capability mapping and group ordering.
60
+
61
+ ## [3.8.13] - 2026-04-07
62
+
63
+ ### Changed
64
+ - **Centralized capability matrix** — dispatch planning now derives from `LANGUAGE_CAPABILITY_MATRIX`, which defines per-language capability dimensions and write/full runner groups in one place.
65
+ - **Plan generation simplified** — `TOOL_PLANS` (write path) and `FULL_LINT_PLANS` (full scans) are generated from matrix entries instead of duplicated hand-maintained plan objects.
66
+
67
+ ### Tests
68
+ - Extended dispatch plan exposure coverage to assert capability dimensions for main languages (`jsts`, `python`, `go`, `rust`, `ruby`) in `tests/clients/dispatch/plan-exposure.test.ts`.
69
+
70
+ ## [3.8.12] - 2026-04-07
71
+
72
+ ### Changed
73
+ - **Excluded-dir policy consolidated** — scanners now share `isExcludedDirName(...)` matching logic from `file-utils` instead of ad-hoc `EXCLUDED_DIRS.includes(...)` checks.
74
+ - **Pattern-aware exclusions** — exclusion matching now supports case-insensitive exact matches and lightweight glob patterns (for example `*.dSYM`).
75
+ - **Cross-scanner consistency** — startup scan, source filter, jscpd precheck, tree-sitter file collection, slop scan, production-readiness scan, and legacy scan-utils path checks now use the same exclusion semantics.
76
+
77
+ ### Tests
78
+ - Added exclusion matcher coverage in `tests/clients/file-utils.test.ts`.
79
+ - Expanded source-filter coverage for glob exclusions (`*.dSYM`) and case-insensitive directory exclusion in `tests/source-filter.test.ts`.
80
+
81
+ ## [3.8.11] - 2026-04-07
82
+
83
+ ### Added
84
+ - **Experimental git guard flag** — added `--lens-guard` to gate commit/push attempts behind a blocker preflight check.
85
+ - **Git guard commit preflight** — when enabled, `bash` calls containing `git commit` or `git push` are blocked if unresolved inline blockers or pending turn-end blockers exist.
86
+
87
+ ### Changed
88
+ - **Guard status tracking** — runtime now tracks blocker state/summary from post-write pipeline output so commit blocking messages stay concise and actionable.
89
+
90
+ ### Tests
91
+ - Added focused coverage for git guard command detection and block/allow behavior in `tests/clients/git-guard.test.ts`.
92
+ - Updated runtime tool-result tests for guard status updates in `tests/clients/runtime-tool-result.test.ts`.
93
+
94
+ ## [3.8.10] - 2026-04-07
95
+
96
+ ### Changed
97
+ - **LSP default-on** — `--lens-lsp` is now enabled by default to provide unified LSP diagnostics across supported file kinds.
98
+ - **Capability-driven LSP dispatch** — dispatch now prepends LSP dynamically by file kind/flag state, while still using runtime `hasLSP(file)` checks for safe activation.
99
+ - **Fallback safety switch clarified** — `--no-lsp` is documented and wired as the explicit opt-out path to language-specific fallbacks.
100
+
101
+ ### Fixed
102
+ - **`--no-lsp` consistency** — LSP sync/reset/navigation and runner gating now respect `--no-lsp` consistently, so fallback behavior is predictable.
103
+ - **LSP/lint overlap noise** — non-blocking lint diagnostics overlapping with LSP on the same file/line are suppressed to keep inline output focused.
104
+ - **turn_end actionability** — blocker summaries for jscpd/knip now include direct file hints to reduce path-guessing loops.
105
+ - **Architect invalid regex resilience** — malformed `must_not.pattern` expressions in `architect.yaml` are now logged and skipped instead of throwing during checks.
106
+ - **Architect runner path/cache stability** — cwd cache keys are now normalized and relative paths use `path.relative(...)`, preventing stale cache misses and Windows path edge cases.
107
+ - **`/lens-booboo` target-root consistency** — architectural checks now always reload config for the requested target path so scans don’t drift to a previous working directory.
108
+
109
+ ## [3.8.9] - 2026-04-07
110
+
111
+ ### Changed
112
+ - **README restructured** — Expanded the "What It Does" section with write/edit, session_start, and turn_end behavior; added a complete runner list and a dependency table with auto-installed vs manual tools.
113
+ - **Test runner strategy improved** — Added hybrid test targeting: rerun known failures first, otherwise run related tests for the edited file.
114
+
115
+ ### Fixed
116
+ - **Non-JSON test runner parsing** — Go/Cargo/Dotnet/Gradle/Maven/RSpec/Minitest now use generic parsing instead of returning "Unknown runner".
117
+ - **Dispatch delta baseline compatibility** — Baseline lookups now support both normalized absolute and cwd-relative keys to prevent stale/new misclassification in mixed-key scenarios.
118
+
119
+ ## [3.8.8] - 2026-04-07
120
+
121
+ ### Changed
122
+ - **README massively simplified** — Reduced the README to core purpose, install/run, key commands, and concise usage notes.
123
+ - **Docs trimmed** — Removed deep internal documentation files from `docs/` to keep project docs minimal and focused.
124
+ - **Positioning text clarified** — Updated wording to describe pi-lens as real-time inline feedback for AI agents.
125
+
126
+ ## [3.8.7] - 2026-04-06
127
+
128
+ ### Fixed
129
+ - **Baseline duplication in dispatch delta mode** — `ctx.baselines.set()` was called with `[...allDiagnostics, ...diagnostics]`, but `allDiagnostics` already contained `diagnostics` from the push below. Baseline inflated by N items per dispatch, causing `filterDelta` to misidentify issues on subsequent writes.
130
+ - **No delta on warnings** — `DispatchResult.warnings` was cumulative (total warning count across all runs), so the `N warning(s) -> /lens-booboo` message never decreased even when the agent fixed warnings. Added `baselineWarningCount` to track the baseline separately. Message now shows `3 new (15 total) warning(s)` so the agent sees progress.
131
+ - **LSP sync fire-and-forget** — Phase 3 (LSP file sync) was attached via `.then()` without being awaited, so dispatch lint (phase 5) and cascade diagnostics (phase 7) ran against stale LSP state. Now properly `await`ed before subsequent phases.
132
+
133
+ ## [3.8.6] - 2026-04-06
134
+
135
+ ### Changed
136
+ - **Remove new-TODO reporting from turn_end** — The agent writes TODOs intentionally;
137
+ reporting them back at turn-end is noise. Removed the diff-against-baseline TODO
138
+ injection from turn-end findings.
139
+
140
+ ## [3.8.5] - 2026-04-06
141
+
142
+ ### Fixed
143
+ - **Pyright CLI duplicates LSP under `--lens-lsp`** — The Pyright CLI runner now skips
144
+ itself when `--lens-lsp` is active, mirroring the existing `ts-lsp` behaviour. The
145
+ `lsp` runner (priority 4, Pyright language server) already covers Python type-checking
146
+ in that mode; running the CLI in parallel was redundant.
147
+
148
+
5
149
  ## [3.8.2] - 2026-04-06
6
150
 
7
151
  ### Fixed