pi-lens 3.8.30 → 3.8.32

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 (71) hide show
  1. package/CHANGELOG.md +299 -8
  2. package/README.md +111 -134
  3. package/clients/bootstrap.ts +0 -23
  4. package/clients/dispatch/dispatcher.ts +0 -1
  5. package/clients/dispatch/plan.ts +13 -20
  6. package/clients/dispatch/runners/architect.ts +3 -1
  7. package/clients/dispatch/runners/ast-grep-napi.ts +10 -32
  8. package/clients/dispatch/runners/biome-check.ts +34 -114
  9. package/clients/dispatch/runners/eslint.ts +10 -41
  10. package/clients/dispatch/runners/golangci-lint.ts +24 -37
  11. package/clients/dispatch/runners/hadolint.ts +16 -10
  12. package/clients/dispatch/runners/htmlhint.ts +22 -10
  13. package/clients/dispatch/runners/index.ts +2 -4
  14. package/clients/dispatch/runners/ktlint.ts +19 -5
  15. package/clients/dispatch/runners/lsp.ts +28 -20
  16. package/clients/dispatch/runners/markdownlint.ts +18 -29
  17. package/clients/dispatch/runners/mypy.ts +11 -46
  18. package/clients/dispatch/runners/oxlint.ts +19 -6
  19. package/clients/dispatch/runners/phpstan.ts +11 -22
  20. package/clients/dispatch/runners/rubocop.ts +27 -33
  21. package/clients/dispatch/runners/ruff.ts +28 -36
  22. package/clients/dispatch/runners/shellcheck.ts +2 -0
  23. package/clients/dispatch/runners/shfmt.ts +7 -3
  24. package/clients/dispatch/runners/similarity.ts +12 -0
  25. package/clients/dispatch/runners/spellcheck.ts +16 -10
  26. package/clients/dispatch/runners/sqlfluff.ts +12 -44
  27. package/clients/dispatch/runners/stylelint.ts +18 -52
  28. package/clients/dispatch/runners/taplo.ts +11 -5
  29. package/clients/dispatch/runners/tree-sitter.ts +10 -2
  30. package/clients/dispatch/runners/ts-lsp.ts +11 -6
  31. package/clients/dispatch/runners/utils/diagnostic-parsers.ts +25 -0
  32. package/clients/dispatch/runners/utils/runner-helpers.ts +170 -9
  33. package/clients/dispatch/runners/yamllint.ts +12 -52
  34. package/clients/dispatch/types.ts +5 -1
  35. package/clients/format-service.ts +14 -11
  36. package/clients/formatters.ts +166 -235
  37. package/clients/installer/index.ts +132 -44
  38. package/clients/jscpd-client.ts +40 -3
  39. package/clients/language-policy.ts +2 -2
  40. package/clients/lsp/client.ts +41 -5
  41. package/clients/lsp/config.ts +31 -15
  42. package/clients/lsp/index.ts +110 -20
  43. package/clients/lsp/server.ts +31 -1
  44. package/clients/pipeline.ts +226 -318
  45. package/clients/project-index.ts +42 -34
  46. package/clients/read-guard-logger.ts +38 -0
  47. package/clients/read-guard-tool-lines.ts +128 -0
  48. package/clients/read-guard.ts +522 -0
  49. package/clients/review-graph/builder.ts +5 -1
  50. package/clients/runtime-config.ts +2 -2
  51. package/clients/runtime-context.ts +26 -0
  52. package/clients/runtime-coordinator.ts +50 -4
  53. package/clients/runtime-session.ts +0 -6
  54. package/clients/runtime-tool-result.ts +11 -5
  55. package/clients/runtime-turn.ts +64 -0
  56. package/clients/tool-policy.ts +1603 -0
  57. package/clients/tree-sitter-client.ts +80 -33
  58. package/commands/booboo.ts +0 -45
  59. package/index.ts +418 -49
  60. package/package.json +3 -2
  61. package/rules/ast-grep-rules/rules/no-ellipsis-body.yml +26 -0
  62. package/rules/ast-grep-rules/rules/no-raise-not-implemented.yml +16 -0
  63. package/rules/ast-grep-rules/rules/no-unimplemented-stub-js.yml +11 -0
  64. package/rules/ast-grep-rules/rules/no-unimplemented-stub.yml +11 -0
  65. package/tools/ast-grep-replace.js +1 -1
  66. package/tools/ast-grep-replace.ts +1 -1
  67. package/tools/ast-grep-search.js +1 -1
  68. package/tools/ast-grep-search.ts +1 -1
  69. package/tools/lsp-navigation.js +111 -39
  70. package/tools/lsp-navigation.ts +210 -114
  71. package/clients/dispatch/runners/prettier-check.ts +0 -110
package/CHANGELOG.md CHANGED
@@ -4,9 +4,111 @@ All notable changes to pi-lens will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [3.8.32] - 2026-04-26
8
+
9
+ ### Fixed
10
+
11
+ - **`lspExpansionsHelped` counter undercounted in `/lens-health`** — `getSummary` used `reads.find(r => r.timestamp <= record.precedingReads[0]?.timestamp)` which always selected the first ever read for the file, so only sessions where the very first read used LSP expansion were counted. Fixed to `record.precedingReads.some(r => r.expandedByLsp)`, correctly checking all reads that preceded the specific edit.
12
+ - **`preserveDiagnostics` incorrectly set when autofix also ran** — when a formatter and an autofix tool both modified a file, the LSP resync was still called with `preserveDiagnostics: true` because `formatChanged` was set, even though autofix changes can affect code semantics. Fixed by gating on `formatChanged && fixedCount === 0`, ensuring semantics-changing autofix always triggers a fresh diagnostics cycle.
13
+ - **Empty-result message for `workspaceSymbol` had dangling "at"** — `"No results for workspaceSymbol at "` was produced when no `filePath` was given (workspace-scoped query with no file). Fixed by guarding the `" at <filename>"` segment on `filePath` being non-empty.
14
+
15
+ ### Fixed
16
+
17
+ - **TypeScript LSP 5-second pipeline stall on every edit to clean files** — after biome or another formatter rewrote a file, `resyncLspFile` called `lsp.openFile` which deleted the diagnostics cache and sent `textDocument/didChange`. `waitForDiagnostics` then waited the full 5000ms timeout for TypeScript to re-publish what it already knew (formatting doesn't change semantics, so the error set is identical). Added `preserveDiagnostics` option to `openFile`/`handleNotifyOpen`: format-only resyncs no longer clear the cache, so `waitForDiagnostics` fast-paths immediately. For pi-free provider files this cuts per-edit pipeline time from ~12s to ~3-4s.
18
+ - **`ktlint` formatter silently inactive when installed by the linter runner** — `ktlint` is both a smart-default formatter (`.kt`/`.kts`) and a smart-default linter with a managed GitHub-release install. The formatter's `detect()` used only `which("ktlint")`, never `getToolPath("ktlint")`, and the formatter was absent from `AUTO_INSTALLABLE_DEFAULT_FORMATTERS`. When the linter runner auto-installed `ktlint` to `~/.pi-lens/bin/`, the formatter was blind to it — Kotlin files got linted but never formatted. Fixed by adding `ktlint` to `AUTO_INSTALLABLE_DEFAULT_FORMATTERS`, adding `resolveCommand` that calls `ensureTool`, and making `detect` check `getToolPath` as fallback.
19
+ - **Subagent process hangs indefinitely after completing work (issue #22)** — `scheduleLSPIdleReset` created a 240-second `setTimeout` without `.unref()`. Every `turn_end` with no file edits scheduled this timer, keeping the Node.js event loop alive for 4 full minutes. pi-subagents killed the child at the 5-second drain deadline and reported `exit code 1` / SIGTERM even though all work completed successfully. Confirmed: `--no-lsp` exited cleanly because the timer is gated on LSP being enabled. Fixed by calling `.unref()` on the timer (lets the process exit naturally if there is no other pending work) and by registering a `session_shutdown` handler that cancels the timer explicitly and calls `resetLSPService()`.
20
+ - **Read-guard false-blocks multi-chunk reads** — `checkCoverage` checked each `ReadRecord` independently, so reading a 200-line file as two 100-line chunks and then Writing it was falsely blocked because neither chunk alone covered `[1, 200]`. Fixed by adding a second-pass union-merge of all read intervals: overlapping/adjacent ranges are merged in sorted order, and coverage is satisfied if any merged interval contains the edit range.
21
+ - **`requestedLimit` field recorded as `effectiveReadLimit` instead of the agent's actual requested limit** — `ReadRecord.requestedLimit` was always the computed effective limit, not what the agent asked for. Fixed to record the raw requested limit (falling back to effective when not provided).
22
+ - **Read-guard blocks legitimate full-file writes** — `write` tool calls were assigned the range `[1, Number.MAX_SAFE_INTEGER]`, which can never be covered by any prior read, so every full-file write on an existing file was incorrectly blocked with "Edit outside read range … lines 1–9007199254740991". Fixed by passing the file path into `getTouchedLinesForGuard` and using the actual on-disk line count (`countFileLines`) as the end of the write range. An agent that read all N lines of a file can now rewrite it without a false block.
23
+ - **Read-guard false-blocks text replacement edits without explicit line ranges** — `edit` calls using `oldText` / `newText` matching but no `range` metadata were previously inferred as touching line `1`, producing bogus `"🔴 BLOCKED — Edit outside read range"` failures even when the agent had read the correct target region. Fixed touched-line inference so range-less replacement edits return `undefined` instead of defaulting to `1-1`, avoiding fabricated line-1 violations.
24
+ - **`NEEDS_POSTINSTALL` broken for scoped npm packages** — `@biomejs/biome`, `@ast-grep/cli`, and `@ast-grep/napi` were incorrectly checked with `packageName.split("@")[0]` which always yields `""` for scoped packages; the nullish-coalescing fallback never fired. These packages always received `--ignore-scripts`, preventing native binary postinstall scripts from running and silently breaking their auto-installation. Fixed by checking the full package name directly.
25
+ - **Silent formatter failures in pipeline** — when a formatter crashed (binary missing, timeout, or I/O error) the post-write pipeline never emitted a debug log; only `anyChanged` triggered output. Formatter errors are now surfaced via `dbg()` so they appear in debug/latency logs.
26
+ - **`tryLazyInstallFormatterTool` failures logged** — lazy `gem install rubocop` and `rustup component add rustfmt` failures were silently swallowed with no log output anywhere. Both now emit a `[format] lazy-install <tool> failed: <reason>` message to stderr.
27
+ - **`getFormattersByName` broken for hyphenated formatter names** — constructing the export key as `` `${name}Formatter` `` produced `"php-cs-fixerFormatter"` and `"clang-formatFormatter"` instead of the real camelCase exports (`phpCsFixerFormatter`, `clangFormatFormatter`). These formatters were silently filtered out when selected by name via the explicit `options.formatters` API. Fixed by converting hyphenated names to camelCase before appending `Formatter`.
28
+ - **Read-before-edit guard correctness** — fixed `read.path` vs `read.filePath` mismatch, full-file read coverage tracking, read-guard range math, session reset leakage, and guard messaging so edit enforcement now correctly reflects actual reads
29
+ - **First-read LSP warmup behavior** — first `read` now triggers non-blocking async LSP warmup once per file/session window, with retry-safe state tracking and reset handling
30
+ - **Formatter selection bugs and drift** — formatter chooser now reliably selects exactly one formatter, no longer lets registry order accidentally block smart defaults, and keeps explicit config precedence over defaults
31
+ - **Ruby auto-install policy mismatch** — `rubocop` policy and installer behavior are now aligned through managed gem install support
32
+ - **Prettier dispatch redundancy** — removed `prettier-check` from the active dispatch path to avoid re-checking formatting after the authoritative autoformat pipeline has already run
33
+ - **LSP race condition in `initLSPConfig`** — `configInFlight` Map deduplicates concurrent initialization calls for the same workspace; parallel session starts no longer double-initialize and race on `workspaceConfigs`
34
+ - **`lsp_navigation` rejected accidentally quoted `operation` values at schema-validation time** — the tool previously declared `operation` as a `Type.Union` of string literals, so model outputs like `"workspaceDiagnostics"` were rejected before `execute()` ran, causing confusing retry loops with no recovery path. The tool now accepts a string, normalizes accidental surrounding quotes, validates against the allowed operation set inside `execute()`, and returns a clear error listing valid operations when the value is still invalid.
35
+ - **`LSPService` use-after-shutdown** — `isDestroyed` flag added; all public methods (`getClientForFile`, `openFile`, `updateFile`, `waitForDiagnostics`, `getDiagnostics`, `shutdown`) return early once the service has been shut down
36
+ - **`theme.fg` crash during session start** — `updateLspStatus` wraps theme calls in try/catch; theme may not be fully initialized during early session startup events
37
+ - **`isCommandAvailable` hangs on slow tools** — added 5s timeout with `proc.kill()` and a double-resolve guard; probe commands that stall no longer block session startup indefinitely
38
+ - **Tree-sitter `client_unavailable` log spam** — `TreeSitterClient.isAvailable()` now re-evaluates `grammarsDir` when the cached path goes missing, instead of caching an empty string forever. Added `resolveWebTreeSitterAsset()` helper with three strategies: (1) `createRequire` module resolution (hoisted installs — issue #20), (2) `resolvePackagePath(import.meta.url)` fallback (on-the-fly TS compilation by pi), (3) `process.cwd()` fallback. Fixes 108 skipped-runner log lines when the initial grammar probe failed transiently.
39
+ - **Pipeline test assertion drift** — updated `tests/clients/pipeline.test.ts` to match the current auto-format warning text (`File was modified by auto-format/fix...`)
40
+
41
+ ### Added
42
+
43
+ - **Autofix decision/attempt logging** — the post-write pipeline now logs autofix policy selection, preferred tools, attempted tools, explicit skip reasons, and the important distinction between “autofix skipped” vs “autofix ran but applied 0 fixes.” This makes it much easier to understand whether TypeScript files chose Biome or ESLint autofix and why.
44
+ - **Dedicated read-guard trace log** — added `~/.pi-lens/read-guard.log` with structured events for read recording, LSP range expansion, touched-line derivation, edit checks, verdicts, and exemptions. This separates guard-policy debugging from the noisier general `latency.log` stream.
45
+ - **Centralized formatter policy layer** — added normalized per-extension formatter policy with explicit config detection, smart-default selection, and managed-vs-toolchain default handling
46
+ - **Centralized command spec / execution policy layer** — added shared tool command specs, execution policy, and resolver helpers used by dispatch runners and autofix paths
47
+ - **Centralized linter policy layer** — added policy selectors for dispatch lint runner choice so config-first and smart-default lint behavior is now encoded centrally instead of only in individual runners
48
+ - **Centralized autofix policy and capability metadata** — added policy selectors for safe pipeline autofix plus explicit capability metadata separating tool-level fix support from safe automatic post-write autofix
49
+ - **Expanded smart-default formatter coverage** — added smart defaults across web/content formats and additional language ecosystems, including managed smart-default support for `prettier`, `shfmt`, and `taplo`
50
+ - **LSP footer status indicator** — session start and turn end now show `LSP Active (N)` in green or `LSP Inactive` in red; count reflects alive (connected + initialized) clients via `getAliveClientCount()`
51
+ - **Rust monorepo workspace root detection** — `RustServer` walks up from the detected crate root checking parent `Cargo.toml` files for a `[workspace]` section; rust-analyzer now resolves correctly in Cargo workspaces
52
+ - **Opportunistic LSP read range expansion** — single-line `read` tool calls are silently expanded to the full enclosing symbol when a warm LSP client is available; best-effort, no-op if LSP is cold or the lookup doesn't resolve in time
53
+ - **`workspaceSymbol` result filtering and cap** — `lsp_navigation` now filters and caps workspace symbol results at 15 entries to avoid overwhelming the context window
54
+
55
+ ### Performance
56
+
57
+ - **LSP pre-edit touch bounded and file-kind gated** — `edit` / `write` tool calls now skip opportunistic LSP pre-touch for non-LSP-capable files (for example Markdown) and cap the warm-client wait with `PI_LENS_TOOLCALL_TOUCH_MS` (default `750ms`). This avoids pointless `no_clients` touch attempts and reduces edit-path stalls.
58
+ - **Empty aggregate diagnostic waits shortened** — aggregate LSP diagnostics no longer wait the old hardcoded multi-second timeout just to confirm an empty result set. New settle/wait budgets (`PI_LENS_LSP_DIAGNOSTICS_AGGREGATE_WAIT_MS`, `PI_LENS_LSP_DIAGNOSTICS_SEMANTIC_THRESHOLD_MS`, `PI_LENS_LSP_DIAGNOSTICS_SEMANTIC_SETTLE_MS`) make clean-edit loops return faster.
59
+ - **Tool path resolution fast path** — `getToolPath` checks the local managed install (`~/.pi-lens/tools/node_modules/.bin/`) before global PATH probes, npm/pip/GitHub lookups; eliminates 2–5s overhead per tool on session start
60
+ - **`jscpd` availability fast path** — `ensureAvailable()` probes the local install with `fs.existsSync` before spawning a process, and deduplicates concurrent calls via `ensureInFlight`
61
+ - **Concurrent project indexing** — `buildProjectIndex` processes files in batches of 8 with `Promise.all` instead of sequentially; large projects index significantly faster
62
+ - **`buildFunctionMatrixFromNode` avoids re-parse** — walks the existing TypeScript AST directly instead of extracting function source text and creating a new `SourceFile`; removes per-function re-parse overhead from similarity indexing
63
+
64
+ ### Removed
65
+
66
+ - **`prettier-check` runner fully removed** — the dead `clients/dispatch/runners/prettier-check.ts` file is now deleted entirely after its earlier removal from active dispatch plans; formatting remains owned by the autoformat pipeline instead of dispatch re-checks
67
+ - **Worthless `diagnostic-logger` tests** — deleted `tests/clients/diagnostic-logger.test.ts` (5 tests that only asserted mock objects equaled what was just assigned; zero behavior coverage)
68
+ - **Redundant circular-dependency regression tests** — removed 3 no-op import tests from `tests/clients/circular-deps-regression.test.ts` (`expect(module).toBeDefined()` after `await import(...)` adds no value; import failure throws before the assertion)
69
+
70
+ ### Changed
71
+
72
+ - **Normal dispatch no longer runs `similarity` by default** — removed `similarity` from standard JS/TS write and full lint dispatch plans so targeted edits no longer pay its hot-path cost; similarity analysis remains available in explicit workflows like `/lens-booboo` and inline advisory logic.
73
+ - **Cascade diagnostics prune stale cache entries earlier** — LSP diagnostic merging now drops TTL-expired and non-existent file entries before cascade aggregation, reducing stale-path noise and improving cache hygiene during long sessions.
74
+ - **Autoformat policy normalized across supported languages** — formatter behavior is now: exactly one formatter runs, explicit config wins, otherwise smart default applies, and config-first file types do nothing when unconfigured
75
+ - **JS/TS lint fallback normalized** — no-config JavaScript/TypeScript dispatch now consistently prefers `oxlint` with `biome-check-json` fallback, while explicit ESLint/Oxlint/Biome config still wins
76
+ - **Safe autofix remains pipeline-owned** — autofix selection now flows through centralized policy and remains in the post-write pipeline, while dispatch runners stay diagnostics-only
77
+ - **Dispatch runner gating centralized** — major runners (`stylelint`, `yamllint`, `markdownlint`, `htmlhint`, `hadolint`, `sqlfluff`, `rubocop`, `ktlint`, `taplo`, `golangci-lint`, `phpstan`, `ruff`) now consult centralized lint policy before running
78
+ - **Kotlin safe autofix added** — `ktlint -F` is now treated as a safe pipeline autofix path for Kotlin files
79
+ - **Fixability semantics clarified** — dispatch diagnostics now distinguish generic fixability from safe pipeline autofix availability and expected fix mode (`pipeline`, `manual`, `suggestion`), including suggestion/manual-fix runners like LSP, TS-LSP, shellcheck, shfmt, spellcheck, tree-sitter, architect, and ast-grep-napi
80
+ - **Test runner moved to turn_end (non-blocking)** — previously fired inline on every write, blocking the pipeline for up to 60s mid-refactor and producing false failures while the codebase was in an inconsistent state. Tests now run once per turn after all edits complete: unique test targets are collected from modified files, fired concurrently as a fire-and-forget `Promise.allSettled`, and failures are written to cache for injection into the next turn's context. Results are discarded if the agent starts a new turn before tests finish, preventing stale failures from clobbering newer results.
81
+ - **Similarity runner skips small edits** — when `modifiedRanges` total lines is below `MIN_FUNCTION_LINES` (8), the similarity runner exits early; a new function can't fit in fewer lines than that, so the ~1100ms scan is wasted on targeted fixes
82
+ - **Stronger auto-format/fix re-read warning** — message now explicitly tells the agent it MUST re-read the file before any further edits, listing what may have changed (whitespace, indentation, quotes, code)
83
+ - **Turn-end findings cap tightened** — reduced `maxLines` from 24 → 20 and `maxChars` from 1600 → 1000 to stay conservative with context budget
84
+
85
+ ### Tests
86
+
87
+ - **Read-guard touched-line regression tests** — added `tests/clients/read-guard-tool-lines.test.ts` covering full-file writes and range-less text replacement edits so read-guard line inference no longer regresses to bogus `1-1` edits.
88
+ - **Policy normalization regression coverage** — added and updated tests for read-guard fixes, runtime coordinator warm/reset behavior, formatter policy selection, command resolution, linter/autofix policy metadata, dispatch plan exposure, and runner status semantics across the formatter/linter/autofix normalization work
89
+ - **LSP integration tests** — added `tests/clients/lsp/integration.test.ts` with a fake JSON-RPC server (`tests/fixtures/fake-lsp-server.mjs`) covering LSP client lifecycle: initialize handshake, file open/change notifications, diagnostics, and graceful shutdown
90
+ - **Tree-sitter resolution regression tests** — added 3 tests to `tests/clients/tree-sitter-client-init.test.ts`:
91
+ - `TreeSitterClient.isAvailable returns true when grammars are installed` (smoke test)
92
+ - `falls back to resolvePackagePath when require.resolve fails` (on-the-fly compilation scenario)
93
+ - `re-evaluates grammarsDir when isAvailable is called after initial miss` (prevents cached-empty-string bug)
94
+
95
+ ## [3.8.31] - 2026-04-23
96
+
97
+ ### Fixed
98
+
99
+ - **Duplicate inline feedback on edit arrays** — `tool_result` calls for the same file are now deduplicated within a turn using a `reportedThisTurn` set on `RuntimeCoordinator`, cleared on each `turn_start`; previously pi's sequential per-hunk `tool_result` firing caused the pipeline to re-run and feedback to repeat N times per edit array
100
+ - **Double latency logging on pipeline completion** — removed redundant `logLatency` call in `pipeline.ts`; `runtime-tool-result.ts` already logs the outer `tool_result completed` with full duration including format, autofix, and cascade phases
101
+ - **Modified range tracking broken for 3-digit+ line numbers** — `parseDiffRanges` regex changed from `\s+` to `\s*` to handle unpadded line numbers; the diff format right-pads to the file's max digit width so e.g. line 613 in a <1000-line file has no leading space and was silently dropped
102
+ - **Stale gleam grammar entries** — removed dead `LANGUAGE_TO_GRAMMAR` and `getExtensionsForLanguage` entries for gleam; `tree-sitter-gleam.wasm` was never published in `tree-sitter-wasms@0.1.13`
103
+
104
+ ### Changed
105
+
106
+ - **TypeBox 0.34.x → 1.x migration** — updated `package.json` dependency from `@sinclair/typebox` to `typebox ^1.0.0` and updated imports in `tools/lsp-navigation.ts`, `tools/ast-grep-search.ts`, and `tools/ast-grep-replace.ts` to match pi-mono 0.69.0
107
+
7
108
  ## [3.8.30] - 2026-04-22
8
109
 
9
110
  ### Fixed
111
+
10
112
  - **lsp_navigation permanently disabled** — removed stale `lens-lsp` flag check (flag was removed in 3.8.29) that caused every `lsp_navigation` call to short-circuit with `lsp_disabled`; tool now only gates on `--no-lsp`
11
113
  - **ast_grep_search / ast_grep_replace auto-install** — switched availability check from sync `isAvailable()` to async `ensureAvailable()` so the auto-installer triggers when `sg` is missing
12
114
  - **@ast-grep/cli postinstall skipped** — added `@ast-grep/cli` to `NEEDS_POSTINSTALL`; without it `--ignore-scripts` left ASCII stubs in place of `sg.exe` / `ast-grep.exe` on Windows
@@ -26,6 +128,7 @@ All notable changes to pi-lens will be documented in this file.
26
128
  - **Pipeline deduplication** — `handleToolResult` now deduplicates concurrent pipeline calls for the same file; the pi framework fires `tool_result` once per hunk in an Edit array, causing duplicate pipeline runs and doubled agent output
27
129
 
28
130
  ### Changed
131
+
29
132
  - **Tuned false-positive thresholds across all runners** — reduced noise in `lens-booboo` and dispatch for all users:
30
133
  - Added `FACT_SEVERITY_FILTER` (`error`/`warning` only) and `MIN_TREE_SITTER_HITS_PER_RULE = 3`
31
134
  - Filtered entropy/AI-style warnings from complexity metrics
@@ -35,6 +138,7 @@ All notable changes to pi-lens will be documented in this file.
35
138
  - Unregistered `no-magic-numbers` and `high-entropy-string` fact rules globally
36
139
 
37
140
  ### Removed
141
+
38
142
  - **Dead code across 32 files** — removed 51 sites of unused imports, locals, and parameters flagged by `tsc --noUnusedLocals --noUnusedParameters`:
39
143
  - `clients/architect-client.ts`, `ast-grep-client.ts`, `biome-client.ts`, `complexity-client.ts`, `go-client.ts`, `rust-client.ts`, `scan-utils.ts`, `secrets-scanner.ts`, `subprocess-client.ts`, `test-runner-client.ts`, `tool-availability.ts`, `tree-sitter-cache.ts`, `tree-sitter-client.ts`, `type-coverage-client.ts`, `type-safety-client.ts`
40
144
  - `clients/dispatch/dispatcher.ts`, `runners/ast-grep-napi.ts`, `runners/golangci-lint.ts`, `runners/index.ts`, `runners/python-slop.ts`, `runners/ts-lsp.ts`, `runners/utils/diagnostic-parsers.ts`
@@ -43,6 +147,7 @@ All notable changes to pi-lens will be documented in this file.
43
147
  - `commands/booboo.ts`, `index.ts`
44
148
 
45
149
  ### Tests
150
+
46
151
  - **Pipeline regression tests** — `tests/clients/pipeline.test.ts` (11 tests): secrets blocking, format modification, LSP sync, dispatch blockers, autofix output, test runner skip, all-clear output
47
152
  - **Autofix helper tests** — `tests/clients/autofix-helpers.test.ts` (12 tests): config detection (eslint, stylelint, sqlfluff), malformed JSON handling, file change detection after command
48
153
  - **LSP lifecycle tests** — `tests/clients/lsp/lifecycle.test.ts` (4 tests): missing binary error, process spawn, immediate exit detection, process kill
@@ -54,17 +159,20 @@ All notable changes to pi-lens will be documented in this file.
54
159
  - **Tree-sitter hoisted-install tests** — `tests/clients/tree-sitter-client-init.test.ts` (3 tests): wasm resolution via `require.resolve`, `locateFile` directory derivation, `findGrammarsDir` external package resolution
55
160
 
56
161
  ### Refactored
162
+
57
163
  - **Extract `detectFileChangedAfterCommand`** — moved from `clients/pipeline.ts` to `clients/file-utils.ts` and exported for reuse/testing; imported back into `pipeline.ts`; `tests/clients/autofix-helpers.test.ts` now imports the real function instead of reimplementing a copy
58
164
  - **Export testable pipeline helpers** — exported `hasEslintConfig`, `hasStylelintConfig`, `hasSqlfluffConfig` from `clients/pipeline.ts` so config detection is testable
59
165
  - **Export LSP client internals** — exported `clientWaitForDiagnostics`, `handleNotifyOpen`, `handleNotifyChange`, and `LSPClientState` from `clients/lsp/client.ts` for direct testing with mocks
60
166
  - **Export `isCmdShimValid`** — exported from `clients/lsp/launch.ts` so the npm `.cmd` shim validator is unit-testable
61
167
 
62
168
  ### CI
169
+
63
170
  - **Dead-code gate** — `lint-and-typecheck` job now runs `tsc --noUnusedLocals --noUnusedParameters --noEmit` alongside `--noEmit` so dead code regressions fail CI immediately
64
171
 
65
172
  ## [3.8.29] - 2026-04-21
66
173
 
67
174
  ### Added
175
+
68
176
  - **New diagnostic commands** — added `/lens-tools` and `/lens-health` for system visibility:
69
177
  - `/lens-tools` — shows tool installation status: globally installed, pi-lens auto-installed, or npx fallback
70
178
  - `/lens-health` — shows runtime health: pipeline crashes, slow runners, diagnostic stats
@@ -81,6 +189,7 @@ All notable changes to pi-lens will be documented in this file.
81
189
  - Project-level logs (`{cwd}/.pi-lens/*`) intentionally excluded from cleanup
82
190
 
83
191
  ### Changed
192
+
84
193
  - **`/lens-tools` output improved** — added explanatory note when GitHub-release tools are shown as missing: "GitHub-release tools auto-install when you open files of those languages"
85
194
  - **Simplified agent prompts** — removed verbose prompt sections to reduce token burn:
86
195
  - Removed startup notes about project rules count (now just logged, not shown)
@@ -98,6 +207,7 @@ All notable changes to pi-lens will be documented in this file.
98
207
  - **Cross-platform line ending handling** — all `.split("\n")` changed to `.split(/\r?\n/)` for Windows CRLF compatibility (11 files updated)
99
208
 
100
209
  ### Fixed
210
+
101
211
  - **Biome VCS/ignore file errors eliminated** — disabled VCS integration in biome config to prevent "ignore file not found" errors:
102
212
  - Changed `vcs.enabled: true` → `vcs.enabled: false` in `config/biome/core.jsonc`
103
213
  - Biome was searching for `.gitignore` files that don't exist when running on arbitrary projects via pi-lens
@@ -142,6 +252,7 @@ All notable changes to pi-lens will be documented in this file.
142
252
  - Prevents false positives when env var names are used as placeholder strings
143
253
 
144
254
  ### Changed
255
+
145
256
  - **Biome check performance** — reduced lint latency from ~1.4s to ~100ms per file (92% improvement):
146
257
  - Removed redundant `--version` pre-check spawn (~200ms saved)
147
258
  - Switched from `biome check` to `biome lint` command (skip format validation)
@@ -155,6 +266,7 @@ All notable changes to pi-lens will be documented in this file.
155
266
  ## [3.8.28] - 2026-04-19
156
267
 
157
268
  ### Fixed
269
+
158
270
  - **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.
159
271
  - **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`.
160
272
  - **CSS roots and Windows LSP shims tightened** — improved root resolution for CSS language server on Windows.
@@ -166,6 +278,7 @@ All notable changes to pi-lens will be documented in this file.
166
278
  ## [3.8.27] - 2026-04-19
167
279
 
168
280
  ### Added
281
+
169
282
  - **Review graph impact cascade** — turn-end cascade now renders a review-graph impact view showing which files were affected and how diagnostics propagated.
170
283
  - **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.
171
284
  - **Function facts: depth / CC / calls** — tree-sitter extracts per-function cyclomatic complexity, nesting depth, and outgoing call count for fact-rule evaluation.
@@ -203,6 +316,7 @@ All notable changes to pi-lens will be documented in this file.
203
316
  - **CI: tsx extension load check** — CI verifies that required extensions load correctly to catch missing dependency errors early.
204
317
 
205
318
  ### Changed
319
+
206
320
  - **Promote LSP-backed languages into dispatch** — languages with active LSP servers now route through dispatch's standard pipeline instead of ad-hoc paths.
207
321
  - **Dispatch language fallbacks aligned** — LSP-backed and fallback runner selection now uses consistent language-to-capability mapping.
208
322
  - **CSS / HTML / TOML / Elixir fallback wiring** — dispatch fallbacks now include CSS (stylelint), HTML (htmlhint), TOML (taplo), and Elixir (credo).
@@ -226,6 +340,7 @@ All notable changes to pi-lens will be documented in this file.
226
340
  - **Complexity reduction** — decomposed four highest-complexity functions (CC 75–153 → <20 each) for maintainability.
227
341
 
228
342
  ### Fixed
343
+
229
344
  - **Windows LSP startup fallback** — hardened spawn logic for `.cmd` wrappers, PATH resolution, and process creation on Windows.
230
345
  - **C# launch and secondary language fallbacks** — C# LSP and secondary language servers start reliably in more project layouts.
231
346
  - **Prettier-check / stylelint cwd overshoot** — both runners now find the project root correctly instead of silently skipping.
@@ -253,15 +368,18 @@ All notable changes to pi-lens will be documented in this file.
253
368
  - **Tree-sitter rule false positives** — fixed query syntax, scan scripts, and architect glob patterns that produced incorrect findings.
254
369
 
255
370
  ### Performance
371
+
256
372
  - **Startup: defer npm tool availability probes** — tool availability checks (Biome, ESLint, etc.) now run lazily out of the critical path, reducing session start latency.
257
373
  - **Defer TypeScript loading in similarity runner** — similarity detection lazily imports the TypeScript parser, eliminating cold-start cost on first call.
258
374
 
259
375
  ### Refactored
376
+
260
377
  - **LSP: collapse resolution into `resolveAndLaunch`** — unified four spawn mechanisms into one function with clear platform-aware fallbacks.
261
378
  - **Booboo: replace bespoke tree-sitter runner** — `/lens-booboo` tree-sitter checks now use the same fact-rule pipeline as dispatch, eliminating code duplication.
262
379
  - **Drop redundant async from LSP spawn** — removed unnecessary `async`/`await` from functions that already return Promises.
263
380
 
264
381
  ### Tests
382
+
265
383
  - **GitHub release asset selection and PATH tests** — installer asset URL construction and PATH resolution covered by unit tests.
266
384
  - **Rust-analyzer Windows .zip asset expectation** — test fixture updated for `.zip` extension on Windows.
267
385
  - **Async-noise test multi-statement function** — test rule updated to match multi-statement function bodies.
@@ -269,38 +387,46 @@ All notable changes to pi-lens will be documented in this file.
269
387
  ## [3.8.26] - 2026-04-15
270
388
 
271
389
  ### Fixed
390
+
272
391
  - **Silent crash on unhandled promise rejection** — the LSP crash guard's `unhandledRejection` handler was swallowing all non-ignorable rejections without rethrowing, causing silent process exits. The handler now rethrows so non-ignorable rejections surface as `uncaughtException` and are properly reported. Triggered most visibly when editing JSON files while Biome or another LSP server was active.
273
392
 
274
393
  ## [3.8.25] - 2026-04-13
275
394
 
276
395
  ### Changed
396
+
277
397
  - **Go LSP PATH augmentation on Windows** — LSP subprocess PATH now includes common Go install directories (`C:\Program Files\Go\bin`, `C:\Go\bin`) to prevent `gopls` startup/runtime failures when `go` is not in inherited shell PATH.
278
398
  - **Similarity runner cold-start behavior** — similarity now skips fast when no cached project index exists and for tiny/trivial files, reducing write/edit pipeline tail latency and eliminating frequent 30s timeout noise in scratch-file workflows.
279
399
 
280
400
  ### Fixed
401
+
281
402
  - **Non-git workspace commit lookup noise** — metrics snapshot commit detection now pre-checks repository context before invoking Git, preventing `fatal: not a git repository` terminal noise in non-repo folders.
282
403
 
283
404
  ## [3.8.24] - 2026-04-12
284
405
 
285
406
  ### Changed
407
+
286
408
  - **Lazy bootstrap client loading** — startup now defers heavy client initialization behind a shared bootstrap promise, reducing first-turn startup overhead while preserving tool behavior.
287
409
  - **LSP config discovery scope** — `.pi-lens/lsp.json` (and related config paths) are now resolved from the current directory up through parent directories, improving nested-workspace support.
288
410
  - **Ruby server fallback chain** — Ruby LSP startup now tries `ruby-lsp`, then `solargraph`, then `rubocop --lsp` for broader environment compatibility.
289
411
 
290
412
  ### Fixed
413
+
291
414
  - **LSP config activation timing** — LSP server config initialization now runs reliably at `session_start` and before LSP-backed `tool_call` operations, so server enable/disable overrides apply in one-shot and interactive sessions.
292
415
 
293
416
  ## [3.8.23] - 2026-04-12
294
417
 
295
418
  ### Added
419
+
296
420
  - **LSP auto-touch warm-up** — tool-call flow now proactively opens/syncs supported files (`read`/`write`/`edit`/`lsp_navigation`) so LSP clients warm up earlier and first semantic requests are less likely to return cold-start empties.
297
421
 
298
422
  ### Changed
423
+
299
424
  - **Ruby LSP spawn resilience on Windows** — Ruby command discovery now tries `ruby-lsp`/`solargraph` from PATH plus common Ruby install locations before marking servers unavailable.
300
425
  - **LSP diagnostics dedupe strategy** — multi-server diagnostics aggregation now dedupes using a simpler key (`line`, `character`, `message`) to better collapse equivalent findings across servers.
301
426
  - **Windows LSP PATH fallback** — language-server spawns now augment PATH with common user-level tool locations (`.cargo\bin`, `go\bin`, common Ruby bin dirs) to improve server discovery on Windows shells.
302
427
 
303
428
  ### Fixed
429
+
304
430
  - **LSP diagnostics key normalization** — publish diagnostics now store/update using normalized file-path keys, fixing Windows path mismatches that could hide diagnostics in some languages.
305
431
  - **Pull diagnostics fallback path** — when a server advertises pull diagnostics, `textDocument/diagnostic` is now attempted before push-wait fallback.
306
432
  - **Navigation diagnostics/health observability** — `lsp_navigation` and diagnostics aggregation now emit explicit `failureKind`/health metadata to latency logs and tool details for faster root-cause triage (`no_server`, `unsupported`, `empty_result`, `lsp_error`, etc.).
@@ -311,23 +437,28 @@ All notable changes to pi-lens will be documented in this file.
311
437
  ## [3.8.22] - 2026-04-09
312
438
 
313
439
  ### Changed
440
+
314
441
  - **Quick startup path for one-shot print sessions** — `--print`/`-p` now auto-selects quick startup mode to skip heavy bootstrap work and reduce startup latency. Added `PI_LENS_STARTUP_MODE=full|minimal|quick` override for explicit control.
315
442
 
316
443
  ### Fixed
444
+
317
445
  - **Cascade diagnostics formatting clarity** — turn-end cascade entries now render source location as `line <n>, col <m> code=<id>:` so diagnostic codes (for example `TS2322`) are no longer formatted in a way that can be mistaken for file line numbers.
318
446
 
319
447
  ## [3.8.21] - 2026-04-08
320
448
 
321
449
  ### Changed
450
+
322
451
  - **Session guidance channeling** — session-start guidance is now injected as `system` context instead of synthetic `user` context, reducing acknowledgement-only first replies before task execution.
323
452
  - **Coverage warning dedupe** — "Pi-lens analysis unavailable" warnings are now shown once per file per session and reset on session baseline reset.
324
453
 
325
454
  ### Fixed
455
+
326
456
  - **Turn-end read-loop pressure** — turn-end findings now suppress duplicate persisted blocker prompts and avoid imperative "read this file" phrasing that could trigger repeated read loops.
327
457
 
328
458
  ## [3.8.20] - 2026-04-08
329
459
 
330
460
  ### Changed
461
+
331
462
  - **Session startup hardening** — background startup tasks now run with session-generation safety guards and startup in-flight tracking, preventing stale task writes across session boundaries.
332
463
  - **Turn-end overlap guardrails** — turn-end `knip`/`jscpd` checks now skip when the corresponding startup scan is still in-flight.
333
464
  - **Language-profile centralization** — startup and dispatch now share a centralized project language profile for supported language detection and LSP-capable kind policy.
@@ -335,6 +466,7 @@ All notable changes to pi-lens will be documented in this file.
335
466
  - **Language setup hints** — `session_start` now emits actionable install hints for detected Go/Rust/Ruby projects when key tools are missing.
336
467
 
337
468
  ### Fixed
469
+
338
470
  - **TODO baseline scan resilience** — unreadable files are now skipped safely instead of crashing TODO scanning in cloud-synced projects.
339
471
  - **Startup scan gating consistency** — TODO warmup now respects startup warm-cache gating and avoids unnecessary scan work in restricted startup contexts.
340
472
  - **Path exclusion coverage** — shared exclusion list now includes common agent/tooling directories (`.claude`, `.codex`, `.worktrees`, `.vscode`, and related dirs).
@@ -345,39 +477,47 @@ All notable changes to pi-lens will be documented in this file.
345
477
  ## [3.8.19] - 2026-04-07
346
478
 
347
479
  ### Fixed
480
+
348
481
  - **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.
349
482
 
350
483
  ## [3.8.18] - 2026-04-07
351
484
 
352
485
  ### Changed
486
+
353
487
  - **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.
354
488
  - **Dispatch + booboo alignment** — similarity guardrails are now aligned between `/lens-booboo` reporting and the dispatch `similarity` runner.
355
489
  - **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.
356
490
 
357
491
  ### Tests
492
+
358
493
  - Added similarity runner guardrail assertions in `tests/clients/similarity-runner.test.ts`.
359
494
 
360
495
  ## [3.8.17] - 2026-04-07
361
496
 
362
497
  ### Changed
498
+
363
499
  - **Delta-only unused variable blocking** — diagnostics matching unused-value patterns are now promoted to blocking only when they are newly introduced in delta mode.
364
500
  - **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.
365
501
 
366
502
  ### Tests
503
+
367
504
  - Added dispatch flow coverage for delta-mode unused-value promotion in `tests/clients/dispatch/dispatcher-flow.test.ts`.
368
505
 
369
506
  ## [3.8.16] - 2026-04-07
370
507
 
371
508
  ### Changed
509
+
372
510
  - **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.
373
511
  - **Rule parser metadata support** — YAML rule parsing now supports top-level `note` and `fix` fields (including multiline values) for agent-facing remediation text.
374
512
 
375
513
  ### Tests
514
+
376
515
  - Added parser coverage for `note`/`fix` extraction in `tests/clients/dispatch/runners/yaml-rule-parser.test.ts`.
377
516
 
378
517
  ## [3.8.15] - 2026-04-07
379
518
 
380
519
  ### Added
520
+
381
521
  - **Security rule: no global eval** — added ast-grep rule to block `eval(...)`, `Function(...)`, and string-based `setTimeout`/`setInterval` execution.
382
522
  - **Security rule: no blank target** — added ast-grep rule to warn on `<a target="_blank">` without `rel=...`.
383
523
  - **Performance rule: no accumulating spread** — added ast-grep rule to warn on reduce patterns that repeatedly spread accumulators.
@@ -385,60 +525,72 @@ All notable changes to pi-lens will be documented in this file.
385
525
  ## [3.8.14] - 2026-04-07
386
526
 
387
527
  ### Added
528
+
388
529
  - **YAML lint runner** — added `yamllint` dispatch support for `.yaml`/`.yml` files, with LSP prepended when enabled.
389
530
  - **SQL lint + format support** — added `sqlfluff` dispatch support for `.sql` files and `sqlfluff` formatter integration.
390
531
  - **SQL file kind support** — introduced `sql` file kind detection and language-id mapping.
391
532
 
392
533
  ### Changed
534
+
393
535
  - **Capability matrix coverage expanded** — YAML and SQL now map to dedicated lint runners in the centralized capability matrix.
394
536
  - **Lazy auto-install expansion** — added lazy-install support for `yamllint` and `sqlfluff` via installer-managed pip tools.
395
537
  - **Runner inventory docs updated** — README runner list now includes `yamllint` and `sqlfluff`.
396
538
 
397
539
  ### Tests
540
+
398
541
  - Added YAML/SQL runner parsing/semantics coverage in `tests/clients/dispatch/runners/yaml-sql-runners.test.ts`.
399
542
  - Updated dispatch plan/integration tests for YAML+SQL capability mapping and group ordering.
400
543
 
401
544
  ## [3.8.13] - 2026-04-07
402
545
 
403
546
  ### Changed
547
+
404
548
  - **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.
405
549
  - **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.
406
550
 
407
551
  ### Tests
552
+
408
553
  - 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`.
409
554
 
410
555
  ## [3.8.12] - 2026-04-07
411
556
 
412
557
  ### Changed
558
+
413
559
  - **Excluded-dir policy consolidated** — scanners now share `isExcludedDirName(...)` matching logic from `file-utils` instead of ad-hoc `EXCLUDED_DIRS.includes(...)` checks.
414
560
  - **Pattern-aware exclusions** — exclusion matching now supports case-insensitive exact matches and lightweight glob patterns (for example `*.dSYM`).
415
561
  - **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.
416
562
 
417
563
  ### Tests
564
+
418
565
  - Added exclusion matcher coverage in `tests/clients/file-utils.test.ts`.
419
566
  - Expanded source-filter coverage for glob exclusions (`*.dSYM`) and case-insensitive directory exclusion in `tests/source-filter.test.ts`.
420
567
 
421
568
  ## [3.8.11] - 2026-04-07
422
569
 
423
570
  ### Added
571
+
424
572
  - **Experimental git guard flag** — added `--lens-guard` to gate commit/push attempts behind a blocker preflight check.
425
573
  - **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.
426
574
 
427
575
  ### Changed
576
+
428
577
  - **Guard status tracking** — runtime now tracks blocker state/summary from post-write pipeline output so commit blocking messages stay concise and actionable.
429
578
 
430
579
  ### Tests
580
+
431
581
  - Added focused coverage for git guard command detection and block/allow behavior in `tests/clients/git-guard.test.ts`.
432
582
  - Updated runtime tool-result tests for guard status updates in `tests/clients/runtime-tool-result.test.ts`.
433
583
 
434
584
  ## [3.8.10] - 2026-04-07
435
585
 
436
586
  ### Changed
587
+
437
588
  - **LSP default-on** — `--lens-lsp` is now enabled by default to provide unified LSP diagnostics across supported file kinds.
438
589
  - **Capability-driven LSP dispatch** — dispatch now prepends LSP dynamically by file kind/flag state, while still using runtime `hasLSP(file)` checks for safe activation.
439
590
  - **Fallback safety switch clarified** — `--no-lsp` is documented and wired as the explicit opt-out path to language-specific fallbacks.
440
591
 
441
592
  ### Fixed
593
+
442
594
  - **`--no-lsp` consistency** — LSP sync/reset/navigation and runner gating now respect `--no-lsp` consistently, so fallback behavior is predictable.
443
595
  - **LSP/lint overlap noise** — non-blocking lint diagnostics overlapping with LSP on the same file/line are suppressed to keep inline output focused.
444
596
  - **turn_end actionability** — blocker summaries for jscpd/knip now include direct file hints to reduce path-guessing loops.
@@ -449,16 +601,19 @@ All notable changes to pi-lens will be documented in this file.
449
601
  ## [3.8.9] - 2026-04-07
450
602
 
451
603
  ### Changed
604
+
452
605
  - **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.
453
606
  - **Test runner strategy improved** — Added hybrid test targeting: rerun known failures first, otherwise run related tests for the edited file.
454
607
 
455
608
  ### Fixed
609
+
456
610
  - **Non-JSON test runner parsing** — Go/Cargo/Dotnet/Gradle/Maven/RSpec/Minitest now use generic parsing instead of returning "Unknown runner".
457
611
  - **Dispatch delta baseline compatibility** — Baseline lookups now support both normalized absolute and cwd-relative keys to prevent stale/new misclassification in mixed-key scenarios.
458
612
 
459
613
  ## [3.8.8] - 2026-04-07
460
614
 
461
615
  ### Changed
616
+
462
617
  - **README massively simplified** — Reduced the README to core purpose, install/run, key commands, and concise usage notes.
463
618
  - **Docs trimmed** — Removed deep internal documentation files from `docs/` to keep project docs minimal and focused.
464
619
  - **Positioning text clarified** — Updated wording to describe pi-lens as real-time inline feedback for AI agents.
@@ -466,6 +621,7 @@ All notable changes to pi-lens will be documented in this file.
466
621
  ## [3.8.7] - 2026-04-06
467
622
 
468
623
  ### Fixed
624
+
469
625
  - **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.
470
626
  - **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.
471
627
  - **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.
@@ -473,6 +629,7 @@ All notable changes to pi-lens will be documented in this file.
473
629
  ## [3.8.6] - 2026-04-06
474
630
 
475
631
  ### Changed
632
+
476
633
  - **Remove new-TODO reporting from turn_end** — The agent writes TODOs intentionally;
477
634
  reporting them back at turn-end is noise. Removed the diff-against-baseline TODO
478
635
  injection from turn-end findings.
@@ -480,20 +637,22 @@ All notable changes to pi-lens will be documented in this file.
480
637
  ## [3.8.5] - 2026-04-06
481
638
 
482
639
  ### Fixed
640
+
483
641
  - **Pyright CLI duplicates LSP under `--lens-lsp`** — The Pyright CLI runner now skips
484
642
  itself when `--lens-lsp` is active, mirroring the existing `ts-lsp` behaviour. The
485
643
  `lsp` runner (priority 4, Pyright language server) already covers Python type-checking
486
644
  in that mode; running the CLI in parallel was redundant.
487
645
 
488
-
489
646
  ## [3.8.2] - 2026-04-06
490
647
 
491
648
  ### Fixed
649
+
492
650
  - **npm publish bump** — 3.8.1 was already published with the broken postinstall; 3.8.2 contains the actual fix.
493
651
 
494
652
  ## [3.8.1] - 2026-04-06
495
653
 
496
654
  ### Fixed
655
+
497
656
  - **`console-statement` hijacking `no-console-in-tests`** — The keyword match for
498
657
  `console-statement` (`pattern.includes("console")`) was catching `no-console-in-tests`
499
658
  because both contain "console". The simpler rule always won, so both fired on every
@@ -546,20 +705,24 @@ All notable changes to pi-lens will be documented in this file.
546
705
  ### Added — New Rules (50+)
547
706
 
548
707
  **Structural safety (ast-grep, TypeScript + JavaScript):**
708
+
549
709
  - `unchecked-sync-fs` — `fs.statSync/readFileSync/writeFileSync/...` outside try/catch (error)
550
710
  - `unchecked-throwing-call` — `JSON.parse`, `new URL()`, `execSync` outside try/catch (error)
551
711
  - `no-nan-comparison` — `x === NaN` always false, use `Number.isNaN()` (error)
552
712
  - `no-discarded-error` — `new Error()` as standalone statement without throw (error)
553
713
 
554
714
  **Structural safety (ast-grep, Python):**
715
+
555
716
  - `unchecked-throwing-call-python` — `open()`, `json.loads()`, `os.stat()` etc. outside
556
717
  try/except (error)
557
718
 
558
719
  **Structural safety (ast-grep, Ruby):**
720
+
559
721
  - `unchecked-throwing-call-ruby` — `File.read`, `JSON.parse`, `Integer()` etc. outside
560
722
  begin/rescue (error)
561
723
 
562
724
  **Tree-sitter Python rules (new):**
725
+
563
726
  - `python-mutable-class-attr` — class-level `list`/`dict`/`set` shared across all instances (error)
564
727
  - `python-debugger` — `breakpoint()`, `pdb.set_trace()` left in code (error)
565
728
  - `python-print-statement` — `print()` debug output in production code (warning)
@@ -569,6 +732,7 @@ All notable changes to pi-lens will be documented in this file.
569
732
  - `python-raise-string` — `raise "string"` is TypeError in Python 3 (error)
570
733
 
571
734
  **Tree-sitter Ruby rules (new):**
735
+
572
736
  - `ruby-rescue-exception` — `rescue Exception` catches SystemExit and signals (error)
573
737
  - `ruby-empty-rescue` — rescue with no body silently swallows errors (error)
574
738
  - `ruby-debugger` — `binding.pry` / `binding.irb` left in code (error)
@@ -577,13 +741,14 @@ All notable changes to pi-lens will be documented in this file.
577
741
  - `ruby-unsafe-regex` — `Regexp.new(variable)` ReDoS risk (error)
578
742
 
579
743
  **Tree-sitter Go rules (new):**
744
+
580
745
  - `go-hardcoded-secrets` — hardcoded credentials in short/var/const declarations (error)
581
746
 
582
747
  **JavaScript coverage (38 new rules):**
583
- All runtime-applicable TypeScript ast-grep rules now have JavaScript equivalents:
584
- `strict-equality`, `empty-catch`, `no-throw-string`, `no-cond-assign`,
585
- `no-async-promise-executor`, `toctou`, `no-hardcoded-secrets`, `no-inner-html`,
586
- `no-insecure-randomness`, `no-sql-in-code`, `jwt-no-verify`, `weak-rsa-key`, and 26 more.
748
+ All runtime-applicable TypeScript ast-grep rules now have JavaScript equivalents:
749
+ `strict-equality`, `empty-catch`, `no-throw-string`, `no-cond-assign`,
750
+ `no-async-promise-executor`, `toctou`, `no-hardcoded-secrets`, `no-inner-html`,
751
+ `no-insecure-randomness`, `no-sql-in-code`, `jwt-no-verify`, `weak-rsa-key`, and 26 more.
587
752
 
588
753
  ### Changed — Severity Upgrades
589
754
 
@@ -660,6 +825,7 @@ All notable changes to pi-lens will be documented in this file.
660
825
  ## [3.7.2] - 2026-04-05
661
826
 
662
827
  ### Added
828
+
663
829
  - **All-clear signal** — When the pipeline runs clean (no blockers, no test failures),
664
830
  the agent now receives a confirmation one-liner instead of silence:
665
831
  `✓ TypeScript clean · 12/12 tests · 847ms`
@@ -667,10 +833,12 @@ All notable changes to pi-lens will be documented in this file.
667
833
  Agents can now distinguish "checks ran clean" from "checks didn't run".
668
834
 
669
835
  ### Fixed
836
+
670
837
  - **Auto-fix message now names the tool** — `✅ Auto-fixed 3 issue(s) (eslint:2, biome:1)`
671
838
  instead of the vague `Auto-fixed 3 issue(s)`. Agents know exactly what was corrected.
672
839
 
673
840
  ### Security
841
+
674
842
  - **Remove `effect` dependency** — Used for 5 trivial `tryPromise` wrappers in one file,
675
843
  never consumed via Effect's runtime. Dead dependency removed.
676
844
  - **`--ignore-scripts` in auto-installer** — `npm install` for auto-installed tools now
@@ -689,12 +857,14 @@ All notable changes to pi-lens will be documented in this file.
689
857
  ## [3.7.2] - 2026-04-05 (previous)
690
858
 
691
859
  ### Added
860
+
692
861
  - **ESLint `--fix` in autofix phase** — Projects with an ESLint config now have fixable
693
862
  issues auto-corrected (import ordering, jsx style, etc.) before dispatch runs, using
694
863
  `--fix-dry-run` to get the accurate fixed count then `--fix` to apply. Availability
695
864
  is cached per session. Only fires on JS/TS files with an ESLint config present.
696
865
 
697
866
  ### Fixed
867
+
698
868
  - **Misleading infinite-loop comment in biome/ruff runners** — The comment incorrectly
699
869
  stated that writing files from runners would trigger infinite loops (formatters already
700
870
  prove this isn't true). Updated to explain the real reason: dispatch runners report
@@ -706,6 +876,7 @@ All notable changes to pi-lens will be documented in this file.
706
876
  ## [3.7.1] - 2026-04-05
707
877
 
708
878
  ### Added
879
+
709
880
  - **ESLint dispatch runner** — Projects with `.eslintrc` / `eslint.config.js` (any variant)
710
881
  now run ESLint automatically on every JS/TS file write. Prefers local
711
882
  `node_modules/.bin/eslint` over global. Skips silently on projects using Biome/OxLint
@@ -728,6 +899,7 @@ All notable changes to pi-lens will be documented in this file.
728
899
  ## [3.7.0] - 2026-04-05
729
900
 
730
901
  ### Added
902
+
731
903
  - **Test runner in pipeline** — After every file write/edit, pi-lens now automatically detects and
732
904
  runs the corresponding test file (vitest, jest, pytest). Results surface inline so the agent sees
733
905
  failures immediately without a separate test step. Supports TypeScript/JS/Python; file-level
@@ -738,6 +910,7 @@ All notable changes to pi-lens will be documented in this file.
738
910
  Typical wall-clock savings: 500–1500ms per file write (`parallelGainMs` logged in latency log).
739
911
 
740
912
  ### Fixed
913
+
741
914
  - **`semantic: "none"` when 0 diagnostics** — LSP, Pyright, and type-safety runners were returning
742
915
  `semantic: "warning"` even when `diagnosticCount` was 0 (clean file). Now correctly returns
743
916
  `"none"` when no diagnostics are present, `"warning"` when warnings exist, `"blocking"` on errors.
@@ -768,6 +941,7 @@ All notable changes to pi-lens will be documented in this file.
768
941
  silent skip.
769
942
 
770
943
  ### Changed
944
+
771
945
  - **`startedAt` added to latency log runner entries** — Every runner entry now records when it
772
946
  started, making wall-clock vs. sequential comparisons accurate. `dispatch_complete` also logs
773
947
  `parallelGainMs = sumMs - wallClockMs` to quantify parallelism benefit.
@@ -776,6 +950,7 @@ All notable changes to pi-lens will be documented in this file.
776
950
  for runner loading; all imports are static, eliminating ~50ms warm-up latency on first dispatch.
777
951
 
778
952
  ### Tests
953
+
779
954
  - Added formatter venv/vendor resolution and interactive-install coverage
780
955
  - Added LSP lifecycle test suite with mock LSP server (process spawn, open/change/close, shutdown)
781
956
 
@@ -784,6 +959,7 @@ All notable changes to pi-lens will be documented in this file.
784
959
  ## [3.6.7] - 2026-04-04
785
960
 
786
961
  ### Fixed
962
+
787
963
  - **LSP `ERR_STREAM_DESTROYED` crash** — When an LSP process (e.g. rust-analyzer) exits, Node.js emits
788
964
  `'error'` events on the destroyed stdio streams. Without listeners these became uncaught exceptions
789
965
  that crashed the extension. Added persistent `error` listeners to `stdin`, `stdout`, and `stderr`
@@ -791,6 +967,7 @@ All notable changes to pi-lens will be documented in this file.
791
967
  Same guard added to `NativeRustCoreClient` stdin writes.
792
968
 
793
969
  ### Added
970
+
794
971
  - **Rust performance core (`pi-lens-core`)** — Optional Rust binary for CPU-intensive operations.
795
972
  All features fall back to TypeScript automatically if the binary is not available (it is **not**
796
973
  built automatically on `npm install` — run `npm run rust:build` once if you have Rust installed).
@@ -808,6 +985,7 @@ All notable changes to pi-lens will be documented in this file.
808
985
  failure. Feature flag `USE_RUST = true` at top of file.
809
986
 
810
987
  ### Changed
988
+
811
989
  - **Similarity threshold raised from 0.75 → 0.90** — Empirical evaluation showed that below 0.90
812
990
  false positives (structurally similar but semantically unrelated functions) outnumber true
813
991
  positives with the current 57×72 matrix resolution. Applies to both the dispatch runner and
@@ -819,6 +997,7 @@ All notable changes to pi-lens will be documented in this file.
819
997
  unnamed tokens no longer pollute named slots.
820
998
 
821
999
  ### Fixed (Rust)
1000
+
822
1001
  - `tree_sitter_rust::language_rust()` → `language()` (correct API for tree-sitter-rust 0.21)
823
1002
  - `FunctionInfo` missing `#[derive(Clone)]` — caused compile error in `find_similar_to`
824
1003
  - `export function foo()` was missed by the index builder — TypeScript wraps exported functions
@@ -828,6 +1007,7 @@ All notable changes to pi-lens will be documented in this file.
828
1007
  - Deleted orphan `test_lsp.rs` (intentional type errors caused rust-analyzer to crash the LSP stream)
829
1008
 
830
1009
  ### Repository
1010
+
831
1011
  - Rust source (`rust/src/`, `rust/Cargo.toml`) added to npm `files` whitelist so users can build
832
1012
  the binary from an npm-installed package
833
1013
  - Removed stale `src/main.rs` rule from root `.gitignore` (no such file at repo root)
@@ -838,11 +1018,11 @@ All notable changes to pi-lens will be documented in this file.
838
1018
  ## [3.6.3] - 2026-04-03
839
1019
 
840
1020
  ### Removed (Dead Code Cleanup)
1021
+
841
1022
  - **Deleted unused interviewer tool** — Browser-based interview with diff confirmation was never used:
842
1023
  - Removed `clients/interviewer.ts` (290 lines)
843
1024
  - Removed `clients/interviewer-templates.ts` (240 lines)
844
1025
  - Removed initialization from `index.ts`
845
-
846
1026
  - **Deleted deprecated commands** — All were superseded by `/lens-booboo`:
847
1027
  - `/lens-booboo-fix` command (fix-from-booboo.ts, 430 lines) — showed warning to use `/lens-booboo`
848
1028
  - `/lens-fix-simplified` command (fix-simplified.ts, 770 lines) — never registered, unused
@@ -854,13 +1034,13 @@ All notable changes to pi-lens will be documented in this file.
854
1034
  - All imports already used `safe-spawn.ts`, making `safe-spawn-async.ts` pure dead code
855
1035
 
856
1036
  ### Test Suite Overhaul
1037
+
857
1038
  - **Removed ~85 wasteful/broken test files**:
858
1039
  - "Is tool available" tests (8 files) — just checked if external CLIs installed
859
1040
  - Heavy integration tests (2 files) — 5s timeouts, full codebase scans
860
1041
  - Broken LSP tests (7 files) — import path errors
861
1042
  - Broken runner tests (7 files) — thin CLI wrappers with wrong imports
862
1043
  - Trivial utility tests (5 files) — file extension parsing, string sanitization
863
-
864
1044
  - **Added meaningful integration tests**:
865
1045
  - `tests/clients/dispatch/dispatcher-flow.test.ts` — Runner registration, execution, delta mode, conditional runners
866
1046
  - `tests/extension-hooks.test.ts` — pi API: tool/command/flag registration, event handlers
@@ -871,12 +1051,14 @@ All notable changes to pi-lens will be documented in this file.
871
1051
  ## [3.6.2] - 2026-04-02
872
1052
 
873
1053
  ### Added
1054
+
874
1055
  - **Condensed skill auto-loading** — Injects ~70-token tool selection guidance at session start (vs 1,355 for full skills):
875
1056
  - Quick reference for when to use lsp_navigation vs ast_grep_search vs grep
876
1057
  - References full skills for lazy loading (ast-grep, lsp-navigation)
877
1058
  - Prevents common tool selection errors without loading full skill content
878
1059
 
879
1060
  ### Changed
1061
+
880
1062
  - **Streamlined session start injection** — Removed TODO/Knip/jscpd reports from initial context:
881
1063
  - Scans still run and cache for on-demand access via `/lens-booboo`
882
1064
  - Reduces session start noise (only active tools list, error reminder, skill guidance remain)
@@ -885,15 +1067,18 @@ All notable changes to pi-lens will be documented in this file.
885
1067
  ## [3.6.1] - 2026-04-02
886
1068
 
887
1069
  ### Changed
1070
+
888
1071
  - **Updated package description** — More concise: "Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo"
889
1072
 
890
1073
  ### Repository
1074
+
891
1075
  - **AGENTS.md is now local-only** — Removed from git repo and added to `.gitignore` so it stays local to each developer's environment
892
1076
  - **Cleaned up debug files** — Removed old test files (`_debug-*.ts`, `_trigger-test.ts`, `_test-*.ts`) from repo
893
1077
 
894
1078
  ## [3.6.0] - 2026-04-02
895
1079
 
896
1080
  ### Added
1081
+
897
1082
  - **LSP Call Hierarchy Support** — Added 3 new operations to `lsp_navigation` tool:
898
1083
  - `prepareCallHierarchy` — Get callable item at position
899
1084
  - `incomingCalls` — Find all functions/methods that CALL this function
@@ -912,6 +1097,7 @@ All notable changes to pi-lens will be documented in this file.
912
1097
  - New thresholds: MaxCyc >10 bad, >30 critical; Entropy >4.0 bits risky, >7.0 critical
913
1098
 
914
1099
  ### Removed
1100
+
915
1101
  - **TDR (Technical Debt Ratio)** — Removed orphaned metric tracking system:
916
1102
  - Deleted `TDREntry`, `TDRCategory` types, `tdrFindings` Map, `updateTDR()` method
917
1103
  - Removed `convertDiagnosticsToTDREntries()` helper and all `tdrCategory` assignments
@@ -919,6 +1105,7 @@ All notable changes to pi-lens will be documented in this file.
919
1105
  - TDI is sufficient for code health tracking; inline diagnostics provide immediate feedback
920
1106
 
921
1107
  ### Changed
1108
+
922
1109
  - **Updated `/lens-tdi` display** — Shows 5 category breakdown with descriptions:
923
1110
  ```
924
1111
  Debt breakdown:
@@ -935,6 +1122,7 @@ All notable changes to pi-lens will be documented in this file.
935
1122
  ## [3.5.0] - 2026-04-02
936
1123
 
937
1124
  ### Added
1125
+
938
1126
  - **Tree-sitter query compilation cache** — 10× performance improvement for structural analysis. Query files (`.yml`) are compiled to binary `.wasm-cache` format once and cached to disk. Subsequent loads use the compiled cache directly, reducing tree-sitter startup from ~50ms to ~5ms per query. Cache uses mtime-based invalidation — automatically recompiles when source `.yml` changes.
939
1127
  - **Rule cache infrastructure** (`clients/cache/`) — New disk-backed cache system with:
940
1128
  - `RuleCache` class for storing compiled artifacts
@@ -943,6 +1131,7 @@ All notable changes to pi-lens will be documented in this file.
943
1131
  - TTL and integrity validation
944
1132
 
945
1133
  ### Fixed
1134
+
946
1135
  - **YAML parser colon truncation** — Fixed regex-based parser that incorrectly truncated values containing colons. Changed from `split(':', 2)` to `indexOf(':')` for proper value extraction.
947
1136
  - **Tree-sitter rules directory resolution** — Fixed path resolution to use `ctx.cwd` instead of hardcoded `.pi-lens/rules/` path. Rules now load correctly from the actual project root regardless of where pi is invoked.
948
1137
  - **Tree-sitter post_filter support** — Implemented missing `post_filter` functionality for tree-sitter queries. Rules with post-filters (e.g., semantic validation for `bare-except` vs specific exception handlers) now work correctly instead of being silently skipped.
@@ -950,6 +1139,7 @@ All notable changes to pi-lens will be documented in this file.
950
1139
  - **Latency logging restored** — Fixed missing latency logging in `tool_result` handler. Runner timing data now correctly flows to `~/.pi-lens/latency.log` again.
951
1140
 
952
1141
  ### Removed
1142
+
953
1143
  - **Broken ast-grep rules** — Removed overlapping rules that were causing false positives or conflicts with tree-sitter coverage.
954
1144
 
955
1145
  ---
@@ -957,10 +1147,12 @@ All notable changes to pi-lens will be documented in this file.
957
1147
  ## [3.4.0] - 2026-04-02
958
1148
 
959
1149
  ### Fixed
1150
+
960
1151
  - **Delta mode was broken** — `dispatchLint()` created a fresh empty baseline store on every call, making delta filtering a complete no-op. Every issue looked "new" every time. Now uses a persistent session-level baseline store. First write captures baseline, subsequent writes only show NEW issues.
961
1152
  - **Duplicate type-checking with `--lens-lsp`** — Both the `lsp` runner (priority 4) and `ts-lsp` runner (priority 5) were calling the same LSP service for TypeScript files. `ts-lsp` now skips when `--lens-lsp` is active.
962
1153
 
963
1154
  ### Added
1155
+
964
1156
  - **Inline security rules via ast-grep-napi** — Re-enabled the ast-grep-napi runner for real-time blocking on security violations (`no-eval`, `jwt-no-verify`, `no-hardcoded-secrets`, `weak-rsa-key`, `no-open-redirect`, etc.). Only error-severity rules fire inline; warnings remain in `/lens-booboo`. Skips 5 rules already covered by tree-sitter to avoid duplicates. ~9ms execution time.
965
1157
  - **Pre-write duplicate detection (two layers):**
966
1158
  - **Exact name match** — Checks exported names in new content against the session’s cached export index. If a function/class/type already exists in another file, blocks the write: `🔴 STOP — function X already exists in utils.ts. Import instead.`
@@ -968,6 +1160,7 @@ All notable changes to pi-lens will be documented in this file.
968
1160
  - **Project similarity index at session start** — Builds 57×72 state matrices for all TS functions at session start (cached to `.pi-lens/index.json`). Makes pre-write similarity checks ~50ms instead of seconds.
969
1161
 
970
1162
  ### Changed
1163
+
971
1164
  - **Extracted post-write pipeline** — Moved the entire post-write pipeline (secrets, format, autofix, dispatch, tests, cascade diagnostics) from `index.ts` into `clients/pipeline.ts`. `index.ts` reduced from 1764 to 1439 lines.
972
1165
  - **Removed inline complexity warnings** — `⚠️ Complexity increased: +4 cognitive` no longer shown on every write. No agent acts on this mid-task. Complexity data still captured for `/lens-booboo` and `/lens-tdi`.
973
1166
  - **Simplified pre-write handler** — Removed pre-write TypeScript and LSP diagnostics checks (checked old content before write landed — post-write catches everything). Kept only complexity baseline capture and duplicate detection.
@@ -977,6 +1170,7 @@ All notable changes to pi-lens will be documented in this file.
977
1170
  ## [3.3.1] - 2026-04-02
978
1171
 
979
1172
  ### Fixed
1173
+
980
1174
  - **LSP spawn `EINVAL` on Windows** — `.cmd` files (e.g. `vscode-json-language-server.cmd`) found via npm global lookup were spawned without `shell: true`, causing `EINVAL` from `CreateProcess`. The `needsShell` recomputation for npm global paths incorrectly treated `.cmd` the same as `.exe`. Fixed in both primary and fallback spawn paths.
981
1175
  - **Unhandled `EINVAL` rejection** — LSP error handlers only caught `ENOENT` (binary not found). `EINVAL` (binary found but can't execute directly) now caught alongside `ENOENT` in both `launchLSP` and `launchViaPackageManager`.
982
1176
 
@@ -985,11 +1179,13 @@ All notable changes to pi-lens will be documented in this file.
985
1179
  ## [3.3.0] - 2026-04-02
986
1180
 
987
1181
  ### Removed
1182
+
988
1183
  - **`--lens-bus`**: Removed the experimental event bus system (Phase 1). The sequential dispatcher has richer features (delta mode, per-runner latency, baseline tracking) that the bus system never had.
989
1184
  - **`--lens-bus-debug`**: Removed alongside `--lens-bus`.
990
1185
  - **`--lens-effect`**: Removed the Effect-TS concurrent runner execution system (Phase 2). The sequential `dispatchForFile` is the authoritative implementation — it has delta mode, async `when()` handling, and latency tracking that the effect system lacked.
991
1186
 
992
1187
  ### Changed
1188
+
993
1189
  - **LSP client**: `waitForDiagnostics` in `clients/lsp/client.ts` now uses a local `EventEmitter` scoped to the client instance instead of the global bus for internal diagnostic signalling.
994
1190
 
995
1191
  ---
@@ -997,11 +1193,13 @@ All notable changes to pi-lens will be documented in this file.
997
1193
  ## [3.2.0] - 2026-04-02
998
1194
 
999
1195
  ### Fixed
1196
+
1000
1197
  - **LSP server initialization errors** — Fixed `workspaceFolders` capability format that caused gopls and rust-analyzer to crash with JSON RPC parse errors. Changed from object `{supported: true, changeNotifications: true}` to simple boolean `true` for broader compatibility.
1001
1198
  - **Formatter cwd not passed** — `formatFile` now passes `cwd` to `safeSpawn`, fixing Biome's "nested root configuration" error when formatting files in subdirectories.
1002
1199
  - **LSP runner error handling** — Added try-catch around LSP operations to properly detect and report server spawn/connection failures instead of silently returning empty success.
1003
1200
 
1004
1201
  ### Changed
1202
+
1005
1203
  - **Go/Rust LSP initialization** — Added server-specific initialization options for better compatibility.
1006
1204
 
1007
1205
  ---
@@ -1009,6 +1207,7 @@ All notable changes to pi-lens will be documented in this file.
1009
1207
  ## [3.1.3] - 2026-04-02
1010
1208
 
1011
1209
  ### Fixed
1210
+
1012
1211
  - **Biome autofix: removed `--unsafe` flag** — `--unsafe` silently deleted unused variables
1013
1212
  and interfaces, removing code the agent was mid-way through writing (e.g. a new interface
1014
1213
  not yet wired up). Only safe fixes (`--write`) are now applied automatically on every write.
@@ -1030,6 +1229,7 @@ All notable changes to pi-lens will be documented in this file.
1030
1229
  of the actual condition. The check is now awaited properly inside `runRunner()`.
1031
1230
 
1032
1231
  ### Performance
1232
+
1033
1233
  - **Biome: local binary instead of npx** — `BiomeClient` now resolves
1034
1234
  `node_modules/.bin/biome.cmd` (Windows) or `node_modules/.bin/biome` before falling back
1035
1235
  to `npx @biomejs/biome`. Eliminates ~1 s npx startup overhead per invocation.
@@ -1052,6 +1252,7 @@ All notable changes to pi-lens will be documented in this file.
1052
1252
  ## [3.1.1] - 2026-04-01
1053
1253
 
1054
1254
  ### Added
1255
+
1055
1256
  - **File-based latency logging** — Performance analysis via `~/.pi-lens/latency.log`
1056
1257
  - New `latency-logger.ts` module for centralized logging
1057
1258
  - Logs every runner's timing (ts-lsp, ast-grep-napi, biome, test-runner, etc.)
@@ -1064,6 +1265,7 @@ All notable changes to pi-lens will be documented in this file.
1064
1265
  ## [3.1.0] - 2026-04-01
1065
1266
 
1066
1267
  ### Changed
1268
+
1067
1269
  - **Consolidated ast-grep runners** — Unified CLI and NAPI runners with shared rule set
1068
1270
  - NAPI runner now primary for dispatch (100x faster than CLI spawn)
1069
1271
  - Merged ts-slop-rules (21 files) into ast-grep-rules/slop-patterns.yml (33 patterns)
@@ -1072,6 +1274,7 @@ All notable changes to pi-lens will be documented in this file.
1072
1274
  - CLI ast-grep kept only for `ast_grep_search` / `ast_grep_replace` tools
1073
1275
 
1074
1276
  ### Fixed
1277
+
1075
1278
  - **ast-grep-napi stability** — Fixed stack overflow crashes in AST traversal
1076
1279
  - Added `_MAX_AST_DEPTH = 50` depth limit to `findByKind()` and `getAllNodes()`
1077
1280
  - Added `_MAX_RULE_DEPTH = 5` recursion limit for structured rules
@@ -1084,12 +1287,14 @@ All notable changes to pi-lens will be documented in this file.
1084
1287
  ## [3.0.1] - 2026-03-31
1085
1288
 
1086
1289
  ### Changed
1290
+
1087
1291
  - **Documentation refresh**: Updated npm and README descriptions for v3.0.0 features
1088
1292
  - New tagline: "pi extension for real-time code quality"
1089
1293
  - Highlights 31 LSP servers, tree-sitter analysis, auto-install capability
1090
1294
  - Clarified blockers vs warnings split (inline vs `/lens-booboo`)
1091
1295
 
1092
1296
  ### Fixed
1297
+
1093
1298
  - **Entropy threshold**: Increased from 3.5 → 5.5 bits to reduce false positives
1094
1299
  - Previous threshold was too sensitive for tooling codebases
1095
1300
  - Eliminates ~70-80% of "High entropy" warnings on legitimate complex code
@@ -1101,7 +1306,9 @@ All notable changes to pi-lens will be documented in this file.
1101
1306
  ### Breaking Changes
1102
1307
 
1103
1308
  #### Removed - Deprecated Commands
1309
+
1104
1310
  The following deprecated commands have been removed:
1311
+
1105
1312
  - `/lens-booboo-fix` → Use `/lens-booboo` with autofix capability
1106
1313
  - `/lens-booboo-delta` → Delta mode now automatic
1107
1314
  - `/lens-booboo-refactor` → Use `/lens-booboo` findings
@@ -1109,20 +1316,25 @@ The following deprecated commands have been removed:
1109
1316
  - `/lens-rate` → Use `/lens-booboo` quality scoring
1110
1317
 
1111
1318
  #### Changed - Blockers vs Warnings Architecture
1319
+
1112
1320
  - **🔴 Blockers** (type errors, secrets, empty catch blocks) → Appear **inline** and stop the agent
1113
1321
  - **🟡 Warnings** (complexity, code smells) → Go to **`/lens-booboo`** only (not inline)
1114
1322
  - Tree-sitter rules with `severity: error` now properly block inline
1115
1323
  - Dispatcher checks individual diagnostic semantic, not just group default
1116
1324
 
1117
1325
  ### Added - Tree-Sitter Runner
1326
+
1118
1327
  New structural analysis runner at priority 14:
1328
+
1119
1329
  - **18 YAML query files** for TypeScript and Python patterns
1120
1330
  - TypeScript: empty-catch, eval, debugger, console-statement, hardcoded-secrets, deep-nesting, deep-promise-chain, mixed-async-styles, nested-ternary, long-parameter-list, await-in-loop, dangerously-set-inner-html
1121
1331
  - Python: bare-except, eval-exec, wildcard-import, is-vs-equals, mutable-default-arg, unreachable-except
1122
1332
  - Blockers appear inline (severity: error), warnings go to `/lens-booboo` (severity: warning)
1123
1333
 
1124
1334
  ### Added - Auto-Install for Core Tools
1335
+
1125
1336
  Four tools now auto-install on first use (no manual setup required):
1337
+
1126
1338
  1. **TypeScript Language Server** (`typescript-language-server`) — TS/JS type checking
1127
1339
  2. **Pyright** — Python type checking (`pip install pyright`)
1128
1340
  3. **Ruff** — Python linting (`pip install ruff`)
@@ -1131,12 +1343,15 @@ Four tools now auto-install on first use (no manual setup required):
1131
1343
  Installs to `.pi-lens/tools/` with verification step (`--version` check).
1132
1344
 
1133
1345
  ### Added - NAPI Security Rules
1346
+
1134
1347
  Migrated 20 critical security rules to NAPI (fast native execution):
1348
+
1135
1349
  - Rules with `weight >= 4` are **blocking** (stop the agent)
1136
1350
  - Includes: no-eval, no-hardcoded-secrets, no-implied-eval, no-inner-html, no-dangerously-set-inner-html, no-debugger, no-javascript-url, no-open-redirect, no-mutable-default, weak-rsa-key, jwt-no-verify, and more
1137
1351
  - NAPI runs at priority 15 (after tree-sitter, before slop rules)
1138
1352
 
1139
1353
  ### Fixed
1354
+
1140
1355
  - **Tree-sitter query loading**: Added missing `loadQueries()` call before `getAllQueries()`
1141
1356
  - **Windows path handling**: Changed from `lastIndexOf("/")` to `path.dirname()` for cross-platform compatibility
1142
1357
  - **Dispatcher blocker detection**: Now checks if any individual diagnostic has `semantic === "blocking"`
@@ -1147,6 +1362,7 @@ Migrated 20 critical security rules to NAPI (fast native execution):
1147
1362
  - **Biome/Prettier race**: Biome is now default (priority 10), Prettier is fallback only
1148
1363
 
1149
1364
  ### Changed
1365
+
1150
1366
  - **README reorganization**: Removed redundant sections (Architecture, Language Support, Rules, Delta-mode, Slop Detection)
1151
1367
  - **Consolidated Additional Safeguards** into Features section with Runners table
1152
1368
  - **Updated .gitignore**: Local tracking files stay out of repo
@@ -1185,6 +1401,7 @@ Three new lint runners with full test coverage:
1185
1401
  - Flag: `--no-shellcheck` to disable
1186
1402
 
1187
1403
  ### Changed
1404
+
1188
1405
  - Updated README.md with new runners in dispatcher diagram and available runners table
1189
1406
  - Added installation instructions for new tools in Dependent Tools section
1190
1407
  - Added new flags to Flag Reference
@@ -1194,6 +1411,7 @@ Three new lint runners with full test coverage:
1194
1411
  ## [2.6.0] - 2026-03-30
1195
1412
 
1196
1413
  ### Added - Phase 1: Event Bus Architecture
1414
+
1197
1415
  - **Event Bus System** (`clients/bus/`): Decoupled pub/sub for diagnostic events
1198
1416
  - `bus.ts` — Core publish/subscribe with `once()`, `waitFor()`, middleware support
1199
1417
  - `events.ts` — 12 typed event definitions (DiagnosticFound, RunnerStarted, LspDiagnostic, etc.)
@@ -1202,6 +1420,7 @@ Three new lint runners with full test coverage:
1202
1420
  - **New flags**: `--lens-bus`, `--lens-bus-debug` for event system control
1203
1421
 
1204
1422
  ### Added - Phase 2: Effect-TS Service Layer
1423
+
1205
1424
  - **Effect-TS infrastructure** (`clients/services/`): Composable async operations
1206
1425
  - `runner-service.ts` — Concurrent runner execution with timeout handling
1207
1426
  - `effect-integration.ts` — Bus-integrated Effect dispatch
@@ -1210,6 +1429,7 @@ Three new lint runners with full test coverage:
1210
1429
  - **New flag**: `--lens-effect` for concurrent execution
1211
1430
 
1212
1431
  ### Added - Phase 3: Multi-LSP Client (31 Language Servers)
1432
+
1213
1433
  - **LSP Core** (`clients/lsp/`): Full Language Server Protocol support
1214
1434
  - `client.ts` — JSON-RPC client with debounced diagnostics (150ms)
1215
1435
  - `server.ts` — 31 LSP server definitions with root detection
@@ -1231,6 +1451,7 @@ Three new lint runners with full test coverage:
1231
1451
  - **Deprecated**: Old `ts-lsp` runner falls back to built-in TypeScriptClient when `--lens-lsp` not set
1232
1452
 
1233
1453
  ### Added - Phase 4: Auto-Installation System
1454
+
1234
1455
  - **Auto-installer** (`clients/installer/`): Automatic tool installation
1235
1456
  - `index.ts` — Core installation logic for npm/pip packages
1236
1457
  - `isToolInstalled()` — Check global PATH or local `.pi-lens/tools/`
@@ -1242,22 +1463,26 @@ Three new lint runners with full test coverage:
1242
1463
  - **LSP integration**: TypeScript and Python servers now use `ensureTool()` before spawning
1243
1464
 
1244
1465
  ### Changed - Commands
1466
+
1245
1467
  - **Disabled**: `/lens-booboo-fix` — Now shows warning "currently disabled. Use /lens-booboo"
1246
1468
  - **Disabled**: `/lens-booboo-delta` — Now shows warning "currently disabled. Use /lens-booboo"
1247
1469
  - **Disabled**: `/lens-booboo-refactor` — Now shows warning "currently disabled. Use /lens-booboo"
1248
1470
  - **Active**: `/lens-booboo` — Full codebase review (only booboo command now)
1249
1471
 
1250
1472
  ### Changed - Architecture
1473
+
1251
1474
  - **Three-phase system**: Bus → Effect → LSP can be enabled independently
1252
1475
  - **Dispatcher priority**: `lens-effect` > `lens-bus` > default (sequential)
1253
1476
  - **LSP deprecation**: Old built-in TypeScriptClient deprecated, LSP client preferred
1254
1477
 
1255
1478
  ### Documentation
1479
+
1256
1480
  - **LSP configuration guide**: `docs/LSP_CONFIG.md` — How to add custom LSP servers
1257
1481
  - **README updated**: Added LSP section, three-phase architecture, 31 language matrix
1258
1482
  - **CHANGELOG restructured**: Now organized by Phase 1/2/3/4
1259
1483
 
1260
1484
  ### Technical Details
1485
+
1261
1486
  - **New dependencies**: `effect` (Phase 2), `vscode-jsonrpc` (Phase 3)
1262
1487
  - **Lines added**: ~6,000 across 4 phases
1263
1488
  - **Test status**: 617 passing (3 flaky unrelated tests)
@@ -1266,6 +1491,7 @@ Three new lint runners with full test coverage:
1266
1491
  ## [2.5.0] - 2026-03-30
1267
1492
 
1268
1493
  ### Added
1494
+
1269
1495
  - **Python tree-sitter support**: 6 structural patterns for Python code analysis
1270
1496
  - `bare-except` — Detects `except:` that catches SystemExit/KeyboardInterrupt
1271
1497
  - `mutable-default-arg` — Detects mutable defaults like `def f(x=[])`
@@ -1280,10 +1506,12 @@ Three new lint runners with full test coverage:
1280
1506
  - **Query file extraction**: Moved TypeScript patterns from embedded code to `rules/tree-sitter-queries/typescript/*.yml`
1281
1507
 
1282
1508
  ### Changed
1509
+
1283
1510
  - **README updated**: Added Python patterns to structural analysis section
1284
1511
  - **Architect client**: Fixed TypeScript errors (`configPath` property declaration)
1285
1512
 
1286
1513
  ### Technical Details
1514
+
1287
1515
  - Downloaded `tree-sitter-python.wasm` (458KB) for Python AST parsing
1288
1516
  - Post-filters for semantic validation (e.g., distinguishing bare except from specific handlers)
1289
1517
  - ~50ms analysis time per file for Python
@@ -1291,6 +1519,7 @@ Three new lint runners with full test coverage:
1291
1519
  ## [2.4.0] - 2026-03-30
1292
1520
 
1293
1521
  ### Added
1522
+
1294
1523
  - **`safeSpawn` utility**: Cross-platform spawn wrapper that eliminates `DEP0190` deprecation warnings on Windows. Uses command string construction instead of shell+args array.
1295
1524
  - **Runner tracking for `/lens-booboo`**: Each runner now reports execution time and findings count. Summary shows `[1/10] runner name...` progress and final table with `| Runner | Status | Findings | Time |`.
1296
1525
  - **Shared runner utilities**: Extracted `runner-helpers.ts` with:
@@ -1306,6 +1535,7 @@ Three new lint runners with full test coverage:
1306
1535
  - **Type extraction**: Created `clients/ast-grep-types.ts` to break circular dependencies between `ast-grep-client`, `ast-grep-parser`, and `ast-grep-rule-manager`.
1307
1536
 
1308
1537
  ### Changed
1538
+
1309
1539
  - **26 files refactored to use `safeSpawn`**: Eliminated `shell: process.platform === "win32"` deprecation pattern across all clients and runners.
1310
1540
  - **Updated runners to use shared utilities**:
1311
1541
  - `ruff.ts`, `pyright.ts` → use `createAvailabilityChecker()`
@@ -1319,16 +1549,19 @@ Three new lint runners with full test coverage:
1319
1549
  - **Test cleanup safety**: Fixed all test files to use `fs.existsSync()` before `fs.unlinkSync()` to prevent ENOENT errors.
1320
1550
 
1321
1551
  ### Fixed
1552
+
1322
1553
  - **Circular dependencies**: Eliminated 2 cycles (`ast-grep-client` ↔ `ast-grep-parser`, `ast-grep-client` ↔ `ast-grep-rule-manager`) by extracting shared types.
1323
1554
  - **Test flakiness**: All 70 test files now pass consistently (666 tests total).
1324
1555
 
1325
1556
  ### Code Quality
1557
+
1326
1558
  - **Lines saved**: ~350 lines of duplicated code removed across utilities and parsers.
1327
1559
  - **Architect violations**: Reduced from 404 to ~50-80 (after test file exclusion + relaxed rules).
1328
1560
 
1329
1561
  ## [2.3.0] - 2026-03-30
1330
1562
 
1331
1563
  ### Added
1564
+
1332
1565
  - **NAPI-based runner (`ast-grep-napi`)**: 100x faster TypeScript/JavaScript analysis (~9ms vs ~1200ms). Uses `@ast-grep/napi` for native-speed structural pattern matching. Priority 15, applies to TS/JS files only.
1333
1566
  - **Python slop detection (`python-slop`)**: New CLI runner with ~40 AI slop patterns from slop-code-bench research. Detects chained comparisons, manual min/max, redundant if/else, list comprehension opportunities, etc.
1334
1567
  - **TypeScript slop detection (`ts-slop-rules`)**: ~30 patterns for TS/JS slop detection including `for-index-length`, `empty-array-check`, `redundant-filter-map`, `double-negation`, `unnecessary-array-from`.
@@ -1337,29 +1570,35 @@ Three new lint runners with full test coverage:
1337
1570
  - **Codebase self-scan**: `scan_codebase.test.ts` for testing the NAPI runner against the pi-lens codebase itself.
1338
1571
 
1339
1572
  ### Changed
1573
+
1340
1574
  - **Architecture documentation**: Updated README with complete architecture overview, runner system diagram, and language support matrix.
1341
1575
  - **Disabled problematic slop rules**: `ts-for-index-length` and `ts-unnecessary-array-isarray` disabled due to false positives on legitimate index-based operations.
1342
1576
  - **Runner registration**: Updated `clients/dispatch/runners/index.ts` with new runner priorities (ts-lsp/pyright at 5, ast-grep-napi at 15, python-slop at 25).
1343
1577
  - **TS slop runner disabled**: CLI runner `ts-slop.ts` disabled in favor of NAPI-based detection (faster, same rules).
1344
1578
 
1345
1579
  ### Deprecated
1580
+
1346
1581
  - **`/lens-rate` command**: Now shows deprecation warning. Needs re-structuring. Users should use `/lens-booboo` instead.
1347
1582
  - **`/lens-metrics` command**: Now shows deprecation warning. Temporarily disabled, will be restructured. Users should use `/lens-booboo` instead.
1348
1583
 
1349
1584
  ### Removed
1585
+
1350
1586
  - **Old implementations removed**: 259 lines of deprecated command code removed from `index.ts`.
1351
1587
 
1352
1588
  ### Repository Cleanup
1589
+
1353
1590
  - **Local-only files removed from GitHub**: `.pisessionsummaries/` and `refactor.md` removed from repo (still in local `.gitignore`).
1354
1591
 
1355
1592
  ## [2.1.1] - 2026-03-29
1356
1593
 
1357
1594
  ### Added
1595
+
1358
1596
  - **Content-level secret scanning**: Catches secrets in ANY file type on write/edit (`.env`, `.yaml`, `.json`, not just TypeScript). Blocks before save with patterns for `sk-*`, `ghp_*`, `AKIA*`, private keys, hardcoded passwords.
1359
1597
  - **Project rules integration**: Scans for `.claude/rules/`, `.agents/rules/`, `CLAUDE.md`, `AGENTS.md` at session start and surfaces in system prompt.
1360
1598
  - **Grep-ability rules**: New ast-grep rules for `no-default-export` and `no-relative-cross-package-import` to improve agent searchability.
1361
1599
 
1362
1600
  ### Changed
1601
+
1363
1602
  - **Inline feedback stripped to blocking only**: Warnings no longer shown inline (noise). Only blocking violations and test failures interrupt the agent.
1364
1603
  - **booboo-fix output compacted**: Summary in terminal, full plan in `.pi-lens/reports/fix-plan.tsv`.
1365
1604
  - **booboo-refactor output compacted**: Top 5 worst offenders in terminal, full ranked list in `.pi-lens/reports/refactor-ranked.tsv`.
@@ -1372,12 +1611,14 @@ Three new lint runners with full test coverage:
1372
1611
  ## [2.0.40] - 2026-03-27
1373
1612
 
1374
1613
  ### Changed
1614
+
1375
1615
  - **Passive capture on every file edit**: `captureSnapshot()` now called from `tool_call` hook with 5s debounce. Zero latency — reuses complexity metrics already computed for real-time feedback.
1376
1616
  - **Skip duplicate snapshots**: Same commit + same MI = no write (reduces noise).
1377
1617
 
1378
1618
  ## [2.0.39] - 2026-03-27
1379
1619
 
1380
1620
  ### Added
1621
+
1381
1622
  - **Historical metrics tracking**: New `clients/metrics-history.ts` module captures complexity snapshots per commit. Tracks MI, cognitive complexity, and nesting depth across sessions.
1382
1623
  - **Trend analysis in `/lens-metrics`**: New "Trend" column shows 📈/📉/➡️ with MI delta. "Trend Summary" section aggregates improving/stable/regressing counts with worst regressions.
1383
1624
  - **Passive capture**: Snapshots captured on every file edit (tool_call hook) + `/lens-metrics` run. Max 20 snapshots per file (sliding window).
@@ -1385,6 +1626,7 @@ Three new lint runners with full test coverage:
1385
1626
  ## [2.0.38] - 2026-03-27
1386
1627
 
1387
1628
  ### Changed
1629
+
1388
1630
  - **Refactored 4 client files** via `/lens-booboo-refactor` loop:
1389
1631
  - `biome-client.ts`: Extracted `withValidatedPath()` guard pattern (4 methods consolidated)
1390
1632
  - `complexity-client.ts`: Extracted `analyzeFile()` pipeline into `readAndParse()`, `computeMetrics()`, `aggregateFunctionStats()`
@@ -1394,28 +1636,34 @@ Three new lint runners with full test coverage:
1394
1636
  ## [2.0.29] - 2026-03-26
1395
1637
 
1396
1638
  ### Added
1639
+
1397
1640
  - **`clients/ts-service.ts`**: Shared TypeScript service that creates one `ts.Program` per session. Both `complexity-client` and `type-safety-client` now share the same program instead of creating a new one per file. Significant performance improvement on large codebases.
1398
1641
 
1399
1642
  ### Removed
1643
+
1400
1644
  - **3 redundant ast-grep rules** that overlap with Biome: `no-var`, `prefer-template`, `no-useless-concat`. Biome handles these natively with auto-fix. ast-grep no longer duplicates this coverage.
1401
1645
  - **`prefer-const` from RULE_ACTIONS** — no longer needed (Biome handles directly).
1402
1646
 
1403
1647
  ### Changed
1648
+
1404
1649
  - **Consolidated rule overlap**: Biome is now the single source of truth for style/format rules. ast-grep focuses on structural patterns Biome doesn't cover (security, design smells, AI slop).
1405
1650
 
1406
1651
  ## [2.0.27] - 2026-03-26
1407
1652
 
1408
1653
  ### Added
1654
+
1409
1655
  - **`switch-exhaustiveness` check**: New type safety rule detects missing cases in union type switches. Uses TypeScript compiler API for type-aware analysis. Reports as inline blocker: `🔴 STOP — Switch on 'X' is not exhaustive. Missing cases: 'Y'`.
1410
1656
  - **`clients/type-safety-client.ts`**: New client for type safety checks. Extensible for future checks (null safety, exhaustive type guards).
1411
1657
 
1412
1658
  ### Changed
1659
+
1413
1660
  - **Type safety violations added to inline feedback**: Missing switch cases now block the agent mid-task, same as TypeScript errors.
1414
1661
  - **Type safety violations in `/lens-booboo-fix`**: Marked as agent-fixable (add missing case or default clause).
1415
1662
 
1416
1663
  ## [2.0.26] - 2026-03-26
1417
1664
 
1418
1665
  ### Added
1666
+
1419
1667
  - **5 new ast-grep rules** for AI slop detection:
1420
1668
  - `no-process-env`: Block direct `process.env` access (use DI or config module) — error level
1421
1669
  - `no-param-reassign`: Detect function parameter reassignment — warning level
@@ -1424,6 +1672,7 @@ Three new lint runners with full test coverage:
1424
1672
  - `no-architecture-violation`: Block cross-layer imports (models/db) — error level
1425
1673
 
1426
1674
  ### Changed
1675
+
1427
1676
  - **RULE_ACTIONS updated** for new rules:
1428
1677
  - `agent` type (inline + booboo-fix): `no-param-reassign`, `switch-without-default`, `switch-exhaustiveness`
1429
1678
  - `skip` type (booboo-refactor only): `no-process-env`, `no-single-char-var`, `no-architecture-violation`
@@ -1431,12 +1680,14 @@ Three new lint runners with full test coverage:
1431
1680
  ## [2.0.24] - 2026-03-26
1432
1681
 
1433
1682
  ### Changed
1683
+
1434
1684
  - **Simplified `/lens-booboo-refactor` confirmation flow**: Post-change report instead of pre-change gate. Agent implements first, then shows what was changed (git diff + metrics delta). User reviews and can request refinements via chat. No more temp files or dry-run diffs.
1435
1685
  - **Confirmation screen**: "✅ Looks good — move to next offender" / "💬 Request changes" (chat textarea). Diff display is optional.
1436
1686
 
1437
1687
  ## [2.0.23] - 2026-03-26
1438
1688
 
1439
1689
  ### Changed
1690
+
1440
1691
  - **Extracted interviewer and scan modules from `index.ts`**: `index.ts` reduced by 460 lines.
1441
1692
  - `clients/interviewer.ts` — all browser interview infrastructure (HTML generation, HTTP server, browser launch, option selection, diff confirmation screen)
1442
1693
  - `clients/scan-architectural-debt.ts` — shared scanning utilities (`scanSkipViolations`, `scanComplexityMetrics`, `scoreFiles`, `extractCodeSnippet`)
@@ -1445,6 +1696,7 @@ Three new lint runners with full test coverage:
1445
1696
  ## [2.0.22] - 2026-03-26
1446
1697
 
1447
1698
  ### Added
1699
+
1448
1700
  - **Impact metrics in interview options**: Each option now supports an `impact` object (`linesReduced`, `miProjection`, `cognitiveProjection`) rendered as colored badges in the browser form. Agent estimates impact when presenting refactoring options.
1449
1701
  - **Iterative confirmation loop**: Confirmation screen now includes "🔄 Describe a different approach" option with free-text textarea. Agent regenerates plan+diff based on feedback, re-opens confirmation. Repeat until user confirms or cancels.
1450
1702
  - **Auto-close on confirm**: Browser tab closes automatically after user submits.
@@ -1452,42 +1704,50 @@ Three new lint runners with full test coverage:
1452
1704
  ## [2.0.21] - 2026-03-26
1453
1705
 
1454
1706
  ### Added
1707
+
1455
1708
  - **Two-step confirmation for `/lens-booboo-refactor`**: Agent implements changes, then calls `interviewer` with `confirmationMode=true` to show plan (markdown) + unified diff (green/red line coloring) + line counts at the top. User can Confirm, Cancel, or describe a different approach.
1456
1709
  - **Plan + diff confirmation screen**: Plan rendered as styled markdown, diff rendered with syntax-colored `+`/`-` lines. Line counts (`+N / −N`) shown in diff header.
1457
1710
 
1458
1711
  ## [2.0.20] - 2026-03-26
1459
1712
 
1460
1713
  ### Added
1714
+
1461
1715
  - **Impact metrics in interview options**: Structured `impact` field per option with `linesReduced`, `miProjection`, `cognitiveProjection`. Rendered as colored badges (green for lines reduced, blue for metric projections) inside each option card.
1462
1716
 
1463
1717
  ## [2.0.19] - 2026-03-26
1464
1718
 
1465
1719
  ### Changed
1720
+
1466
1721
  - **`/lens-booboo-fix` jscpd filter**: Only within-file duplicates shown in actionable section. Cross-file duplicates are architectural — shown in skip section only.
1467
1722
  - **AI slop filter tightened**: Require 2+ signals per file (was 1+). Single-issue flags on small files are noise — skip them.
1468
1723
 
1469
1724
  ## [2.0.18] - 2026-03-26
1470
1725
 
1471
1726
  ### Fixed
1727
+
1472
1728
  - **`/lens-booboo-fix` max iterations**: Session file auto-deletes when hitting max iterations. Previously blocked with a manual "delete .pi-lens/fix-session.json" message.
1473
1729
 
1474
1730
  ## [2.0.17] - 2026-03-26
1475
1731
 
1476
1732
  ### Changed
1733
+
1477
1734
  - **Agent-driven option generation**: `/lens-booboo-refactor` no longer hardcodes refactoring options per violation type. The command scans and presents the problem + code to the agent; the agent analyzes the actual code and generates 3-5 contextual options with rationale and impact estimates. Calls the `interviewer` tool to present them.
1478
1735
  - **`interviewer` tool**: Generic, reusable browser-based interview mechanism. Accepts `question`, `options` (with `value`, `label`, `context`, `recommended`, `impact`), and `confirmationMode`. Zero dependencies — Node's built-in `http` module + platform CLI `open`/`start`/`xdg-open`.
1479
1736
 
1480
1737
  ## [2.0.16] - 2026-03-26
1481
1738
 
1482
1739
  ### Added
1740
+
1483
1741
  - **`/lens-booboo-refactor`**: Interactive architectural refactor session. Scans for worst offender by combined debt score (ast-grep skip violations + complexity metrics). Opens a browser interview with the problem, code context, and AI-generated options. Steers the agent to propose a plan and wait for user confirmation before making changes.
1484
1742
 
1485
1743
  ### Changed
1744
+
1486
1745
  - **Inline tool_result suppresses skip-category rules**: `long-method`, `large-class`, `long-parameter-list`, `no-shadow`, `no-as-any`, `no-non-null-assertion`, `no-star-imports` no longer show as hard stops in real-time feedback. They are architectural — handled by `/lens-booboo-refactor` instead.
1487
1746
 
1488
1747
  ## [2.0.15] - 2026-03-26
1489
1748
 
1490
1749
  ### Removed
1750
+
1491
1751
  - **Complexity metrics from real-time feedback**: MI, cognitive complexity, nesting depth, try/catch counts, and entropy scores removed from tool_result output. These were always noise — the agent never acted on "MI dropped to 5.6" mid-task. Metrics still available via `/lens-metrics` and `/lens-booboo`.
1492
1752
  - **Session summary injection**: The `[Session Start]` block (TODOs, dead code, jscpd, type-coverage) is no longer injected into the first tool result. Scans still run for caching purposes (exports, clones, baselines). Data surfaced on-demand via explicit commands.
1493
1753
  - **`/lens-todos`**: Removed (covered by `/lens-booboo`).
@@ -1495,12 +1755,14 @@ Three new lint runners with full test coverage:
1495
1755
  - **`/lens-deps`**: Removed — circular dep scan added to `/lens-booboo` as Part 8.
1496
1756
 
1497
1757
  ### Changed
1758
+
1498
1759
  - **Hardened stop signals**: New violations (ast-grep, Biome, jscpd, duplicate exports) now all use `🔴 STOP` framing. The agent is instructed to fix these before continuing.
1499
1760
  - **`/lens-booboo` now includes circular dependencies**: Added as Part 8 (after type coverage) using `depChecker.scanProject`.
1500
1761
 
1501
1762
  ## [2.0.14] - 2026-03-26
1502
1763
 
1503
1764
  ### Fixed
1765
+
1504
1766
  - **`/lens-booboo-fix` excludes `.js` compiled output**: Detects `tsconfig.json` and excludes `*.js` from jscpd, ast-grep, and complexity scans. Prevents double-counting of the same code in `.ts` and `.js` forms.
1505
1767
  - **`raw-strings` rule added to skip list**: 230 false positives in CLI/tooling codebases.
1506
1768
  - **`typescript-client.ts` duplication**: Extracted `resolvePosition()`, `resolveTree()`, and `toLocations()` helpers, deduplicating 6+ LSP methods.
@@ -1509,36 +1771,44 @@ Three new lint runners with full test coverage:
1509
1771
  ## [2.0.13] - 2026-03-26
1510
1772
 
1511
1773
  ### Removed
1774
+
1512
1775
  - **`raw-strings` ast-grep rule**: Not an AI-specific pattern. Humans write magic strings too. Biome handles style. Generated 230 false positives on first real run.
1513
1776
 
1514
1777
  ## [2.0.12] - 2026-03-26
1515
1778
 
1516
1779
  ### Fixed
1780
+
1517
1781
  - **`/lens-booboo-fix` sequential scan order**: Reordered to Biome/Ruff → jscpd (duplicates) → knip (dead code) → ast-grep → AI slop → remaining Biome. Duplicates should be fixed before violations (fixing one fixes both). Dead code should be deleted before fixing violations in it.
1518
1782
 
1519
1783
  ### Changed
1784
+
1520
1785
  - **Remaining Biome section rephrased**: "These couldn't be auto-fixed even with `--unsafe` — fix each manually."
1521
1786
 
1522
1787
  ## [2.0.11] - 2026-03-26
1523
1788
 
1524
1789
  ### Added
1790
+
1525
1791
  - **Circular dependency scan to `/lens-booboo`**: Added as Part 8, using `depChecker.scanProject()` to detect circular chains across the codebase.
1526
1792
 
1527
1793
  ### Removed
1794
+
1528
1795
  - **`/lens-todos`**, **`/lens-dead-code`**, **`/lens-deps`**: Removed standalone commands — all covered by `/lens-booboo`.
1529
1796
 
1530
1797
  ## [2.0.10] - 2026-03-26
1531
1798
 
1532
1799
  ### Changed
1800
+
1533
1801
  - **Session summary injection removed**: The `[Session Start]` block is no longer injected into the first tool result. Scans still run silently for caching (exports for duplicate detection, clones for jscpd, complexity baselines for deltas).
1534
1802
 
1535
1803
  ## [2.0.1] - 2026-03-25
1536
1804
 
1537
1805
  ### Fixed
1806
+
1538
1807
  - **ast-grep in `/lens-booboo` was silently dropping all results** — newer ast-grep versions exit `0` with `--json` even when issues are found; fixed the exit code check.
1539
1808
  - **Renamed "Design Smells" to "ast-grep"** in booboo report — the scan runs all 65 rules (security, correctness, style, design), not just design smells.
1540
1809
 
1541
1810
  ### Changed
1811
+
1542
1812
  - **Stronger real-time feedback messages** — all messages now use severity emoji and imperative language:
1543
1813
  - `🔴 Fix N TypeScript error(s) — these must be resolved`
1544
1814
  - `🧹 Remove N unused import(s) — they are dead code`
@@ -1553,6 +1823,7 @@ Three new lint runners with full test coverage:
1553
1823
  ## [2.0.0] - 2026-03-25
1554
1824
 
1555
1825
  ### Added
1826
+
1556
1827
  - **`/lens-metrics` command**: Measure complexity metrics for all files. Exports a full `report.md` with A-F grades, summary stats, AI slop aggregate table, and top 10 worst files with actionable warnings.
1557
1828
  - **`/lens-booboo` saves full report**: Results saved to `.pi-lens/reviews/booboo-<timestamp>.md` — no truncation, all issues, agent-readable.
1558
1829
  - **AI slop indicators**: Four new real-time and report-based detectors:
@@ -1564,7 +1835,8 @@ Three new lint runners with full test coverage:
1564
1835
  - **Shared test utilities**: `createTempFile` and `setupTestEnvironment` extracted to `clients/test-utils.ts`, eliminating copy-paste across 13 test files.
1565
1836
 
1566
1837
  ### Changed
1567
- - **Delta mode for real-time feedback**: ast-grep and Biome now only show *new* violations introduced by the current edit — not all pre-existing ones. Fixed violations shown as `✓ Fixed: rule-name (-N)`. No change = silent.
1838
+
1839
+ - **Delta mode for real-time feedback**: ast-grep and Biome now only show _new_ violations introduced by the current edit — not all pre-existing ones. Fixed violations shown as `✓ Fixed: rule-name (-N)`. No change = silent.
1568
1840
  - **Removed redundant pre-write hints**: ast-grep and Biome pre-write counts removed (delta mode makes them obsolete). TypeScript pre-write warning kept (blocking errors).
1569
1841
  - **Test files excluded from AI slop warnings**: MI/complexity thresholds are inherently low in test files — warnings suppressed for `*.test.ts` / `*.spec.ts`.
1570
1842
  - **Test files excluded from TODO scanner**: Test fixture annotations (`FIXME`, `BUG`, etc.) no longer appear in TODO reports.
@@ -1573,12 +1845,14 @@ Three new lint runners with full test coverage:
1573
1845
  - **Removed unused dependencies**: `vscode-languageserver-protocol` and `vscode-languageserver-types` removed; `@sinclair/typebox` added (was unlisted).
1574
1846
 
1575
1847
  ### Fixed
1848
+
1576
1849
  - Removed 3 unconditional `console.log` calls leaking `[scan_exports]` to terminal.
1577
1850
  - Duplicate Biome scan in `tool_call` hook eliminated (was scanning twice for pre-write hint + baseline).
1578
1851
 
1579
1852
  ## [1.3.14] - 2026-03-25
1580
1853
 
1581
1854
  ### Added
1855
+
1582
1856
  - **Actionable feedback messages**: All real-time warnings now include specific guidance on what to do.
1583
1857
  - **Code entropy metric**: Shannon entropy in bits (threshold: >3.5 indicates risky AI-induced complexity).
1584
1858
  - **Advanced pattern matching**: `/lens-booboo` now finds structurally similar functions (e.g., `formatDate` and `formatTimestamp`).
@@ -1588,31 +1862,37 @@ Three new lint runners with full test coverage:
1588
1862
  ## [1.3.10] - 2026-03-25
1589
1863
 
1590
1864
  ### Added
1865
+
1591
1866
  - **Actionable complexity warnings**: Real-time feedback when metrics break limits with specific fix guidance.
1592
1867
 
1593
1868
  ## [1.3.9] - 2026-03-25
1594
1869
 
1595
1870
  ### Fixed
1871
+
1596
1872
  - **Entropy calculation**: Corrected to use bits with 3.5-bit threshold for AI-induced complexity.
1597
1873
 
1598
1874
  ## [1.3.8] - 2026-03-25
1599
1875
 
1600
1876
  ### Added
1877
+
1601
1878
  - **Code entropy metric**: Shannon entropy to detect repetitive or unpredictable code patterns.
1602
1879
 
1603
1880
  ## [1.3.7] - 2026-03-25
1604
1881
 
1605
1882
  ### Added
1883
+
1606
1884
  - **Advanced pattern matching in `/lens-booboo`**: Finds structurally similar functions across the codebase.
1607
1885
 
1608
1886
  ## [1.3.6] - 2026-03-25
1609
1887
 
1610
1888
  ### Added
1889
+
1611
1890
  - **Duplicate export detection on write**: Warns when defining a function that already exists elsewhere.
1612
1891
 
1613
1892
  ## [1.3.5] - 2026-03-25
1614
1893
 
1615
1894
  ### Changed
1895
+
1616
1896
  - **Consistent command prefix**: All commands now start with `lens-`.
1617
1897
  - `/find-todos` → `/lens-todos`
1618
1898
  - `/dead-code` → `/lens-dead-code`
@@ -1623,10 +1903,12 @@ Three new lint runners with full test coverage:
1623
1903
  ## [1.5.0] - 2026-03-23
1624
1904
 
1625
1905
  ### Added
1906
+
1626
1907
  - **Real-time jscpd duplicate detection**: Code duplication is now detected on every write. Duplicates involving the edited file are shown to the agent in real-time.
1627
1908
  - **`/lens-review` command**: Combined code review: design smells + complexity metrics in one command.
1628
1909
 
1629
1910
  ### Changed
1911
+
1630
1912
  - **Consistent command prefix**: All commands now start with `lens-`.
1631
1913
  - `/find-todos` → `/lens-todos`
1632
1914
  - `/dead-code` → `/lens-dead-code`
@@ -1637,6 +1919,7 @@ Three new lint runners with full test coverage:
1637
1919
  ## [1.4.0] - 2026-03-23
1638
1920
 
1639
1921
  ### Added
1922
+
1640
1923
  - **Test runner feedback**: Runs corresponding test file on every write (vitest, jest, pytest). Silent if no test file exists. Disable with `--no-tests`.
1641
1924
  - **Complexity metrics**: AST-based analysis: Maintainability Index, Cyclomatic/Cognitive Complexity, Halstead Volume, nesting depth, function length.
1642
1925
  - **`/lens-metrics` command**: Full project complexity scan.
@@ -1646,38 +1929,46 @@ Three new lint runners with full test coverage:
1646
1929
  - **Rust language support**: New Rust client for Rust projects.
1647
1930
 
1648
1931
  ### Changed
1932
+
1649
1933
  - **Improved ast-grep tool descriptions**: Better pattern guidance to prevent overly broad searches.
1650
1934
 
1651
1935
  ## [2.2.1] - 2026-03-29
1652
1936
 
1653
1937
  ### Fixed
1938
+
1654
1939
  - **No auto-install**: Runners (biome, pyright) now use direct CLI commands instead of `npx`. If not installed, gracefully skip instead of attempting to download.
1655
1940
 
1656
1941
  ## [2.2.0] - 2026-03-29
1657
1942
 
1658
1943
  ### Added
1944
+
1659
1945
  - **`/lens-rate` command**: Visual code quality scoring across 6 dimensions (Type Safety, Complexity, Security, Architecture, Dead Code, Tests). Shows grade A-F and colored progress bars.
1660
1946
  - **Pyright runner**: Real Python type-checking via pyright. Catches type errors like `result: str = add(1, 2)` that ruff misses. Runs alongside ruff (pyright for types, ruff for linting).
1661
1947
  - **Vitest config**: Increased test timeout to 15s for CLI spawn tests. Fixes flaky test failures when npx downloads packages.
1662
1948
 
1663
1949
  ### Fixed
1950
+
1664
1951
  - **Test flakiness**: Availability tests (biome, knip, jscpd) no longer timeout when npx is downloading packages.
1665
1952
 
1666
1953
  ## [1.3.0] - 2026-03-23
1667
1954
 
1668
1955
  ### Changed
1956
+
1669
1957
  - **Biome auto-fix disabled by default**: Biome still provides linting feedback, but no longer auto-fixes on write. Use `/format` to apply fixes or enable with `--autofix-biome`.
1670
1958
 
1671
1959
  ### Added
1960
+
1672
1961
  - **ast-grep search/replace tools**: New `ast_grep_search` and `ast_grep_replace` tools for AST-aware code pattern matching. Supports meta-variables and 24 languages.
1673
1962
  - **Rule descriptions in diagnostics**: ast-grep violations now include the rule's message and note, making feedback more actionable for the agent.
1674
1963
 
1675
1964
  ### Changed
1965
+
1676
1966
  - **Reduced console noise**: Extension no longer prints to console by default. Enable with `--lens-verbose`.
1677
1967
 
1678
1968
  ## [1.2.0] - 2026-03-23
1679
1969
 
1680
1970
  ### Added
1971
+
1681
1972
  - GitHub repository link in npm package
1682
1973
 
1683
1974
  ## [1.1.2] - Previous