pi-lens 3.8.31 → 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 (67) hide show
  1. package/CHANGELOG.md +288 -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 -311
  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 +43 -4
  53. package/clients/runtime-session.ts +0 -6
  54. package/clients/runtime-tool-result.ts +0 -4
  55. package/clients/runtime-turn.ts +64 -0
  56. package/clients/tool-policy.ts +1603 -0
  57. package/clients/tree-sitter-client.ts +80 -31
  58. package/commands/booboo.ts +0 -45
  59. package/index.ts +418 -49
  60. package/package.json +2 -1
  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/lsp-navigation.js +110 -38
  66. package/tools/lsp-navigation.ts +209 -113
  67. package/clients/dispatch/runners/prettier-check.ts +0 -110
package/CHANGELOG.md CHANGED
@@ -4,20 +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
+
7
95
  ## [3.8.31] - 2026-04-23
8
96
 
9
97
  ### Fixed
98
+
10
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
11
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
12
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
13
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`
14
103
 
15
104
  ### Changed
105
+
16
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
17
107
 
18
108
  ## [3.8.30] - 2026-04-22
19
109
 
20
110
  ### Fixed
111
+
21
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`
22
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
23
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
@@ -37,6 +128,7 @@ All notable changes to pi-lens will be documented in this file.
37
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
38
129
 
39
130
  ### Changed
131
+
40
132
  - **Tuned false-positive thresholds across all runners** — reduced noise in `lens-booboo` and dispatch for all users:
41
133
  - Added `FACT_SEVERITY_FILTER` (`error`/`warning` only) and `MIN_TREE_SITTER_HITS_PER_RULE = 3`
42
134
  - Filtered entropy/AI-style warnings from complexity metrics
@@ -46,6 +138,7 @@ All notable changes to pi-lens will be documented in this file.
46
138
  - Unregistered `no-magic-numbers` and `high-entropy-string` fact rules globally
47
139
 
48
140
  ### Removed
141
+
49
142
  - **Dead code across 32 files** — removed 51 sites of unused imports, locals, and parameters flagged by `tsc --noUnusedLocals --noUnusedParameters`:
50
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`
51
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`
@@ -54,6 +147,7 @@ All notable changes to pi-lens will be documented in this file.
54
147
  - `commands/booboo.ts`, `index.ts`
55
148
 
56
149
  ### Tests
150
+
57
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
58
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
59
153
  - **LSP lifecycle tests** — `tests/clients/lsp/lifecycle.test.ts` (4 tests): missing binary error, process spawn, immediate exit detection, process kill
@@ -65,17 +159,20 @@ All notable changes to pi-lens will be documented in this file.
65
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
66
160
 
67
161
  ### Refactored
162
+
68
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
69
164
  - **Export testable pipeline helpers** — exported `hasEslintConfig`, `hasStylelintConfig`, `hasSqlfluffConfig` from `clients/pipeline.ts` so config detection is testable
70
165
  - **Export LSP client internals** — exported `clientWaitForDiagnostics`, `handleNotifyOpen`, `handleNotifyChange`, and `LSPClientState` from `clients/lsp/client.ts` for direct testing with mocks
71
166
  - **Export `isCmdShimValid`** — exported from `clients/lsp/launch.ts` so the npm `.cmd` shim validator is unit-testable
72
167
 
73
168
  ### CI
169
+
74
170
  - **Dead-code gate** — `lint-and-typecheck` job now runs `tsc --noUnusedLocals --noUnusedParameters --noEmit` alongside `--noEmit` so dead code regressions fail CI immediately
75
171
 
76
172
  ## [3.8.29] - 2026-04-21
77
173
 
78
174
  ### Added
175
+
79
176
  - **New diagnostic commands** — added `/lens-tools` and `/lens-health` for system visibility:
80
177
  - `/lens-tools` — shows tool installation status: globally installed, pi-lens auto-installed, or npx fallback
81
178
  - `/lens-health` — shows runtime health: pipeline crashes, slow runners, diagnostic stats
@@ -92,6 +189,7 @@ All notable changes to pi-lens will be documented in this file.
92
189
  - Project-level logs (`{cwd}/.pi-lens/*`) intentionally excluded from cleanup
93
190
 
94
191
  ### Changed
192
+
95
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"
96
194
  - **Simplified agent prompts** — removed verbose prompt sections to reduce token burn:
97
195
  - Removed startup notes about project rules count (now just logged, not shown)
@@ -109,6 +207,7 @@ All notable changes to pi-lens will be documented in this file.
109
207
  - **Cross-platform line ending handling** — all `.split("\n")` changed to `.split(/\r?\n/)` for Windows CRLF compatibility (11 files updated)
110
208
 
111
209
  ### Fixed
210
+
112
211
  - **Biome VCS/ignore file errors eliminated** — disabled VCS integration in biome config to prevent "ignore file not found" errors:
113
212
  - Changed `vcs.enabled: true` → `vcs.enabled: false` in `config/biome/core.jsonc`
114
213
  - Biome was searching for `.gitignore` files that don't exist when running on arbitrary projects via pi-lens
@@ -153,6 +252,7 @@ All notable changes to pi-lens will be documented in this file.
153
252
  - Prevents false positives when env var names are used as placeholder strings
154
253
 
155
254
  ### Changed
255
+
156
256
  - **Biome check performance** — reduced lint latency from ~1.4s to ~100ms per file (92% improvement):
157
257
  - Removed redundant `--version` pre-check spawn (~200ms saved)
158
258
  - Switched from `biome check` to `biome lint` command (skip format validation)
@@ -166,6 +266,7 @@ All notable changes to pi-lens will be documented in this file.
166
266
  ## [3.8.28] - 2026-04-19
167
267
 
168
268
  ### Fixed
269
+
169
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.
170
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`.
171
272
  - **CSS roots and Windows LSP shims tightened** — improved root resolution for CSS language server on Windows.
@@ -177,6 +278,7 @@ All notable changes to pi-lens will be documented in this file.
177
278
  ## [3.8.27] - 2026-04-19
178
279
 
179
280
  ### Added
281
+
180
282
  - **Review graph impact cascade** — turn-end cascade now renders a review-graph impact view showing which files were affected and how diagnostics propagated.
181
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.
182
284
  - **Function facts: depth / CC / calls** — tree-sitter extracts per-function cyclomatic complexity, nesting depth, and outgoing call count for fact-rule evaluation.
@@ -214,6 +316,7 @@ All notable changes to pi-lens will be documented in this file.
214
316
  - **CI: tsx extension load check** — CI verifies that required extensions load correctly to catch missing dependency errors early.
215
317
 
216
318
  ### Changed
319
+
217
320
  - **Promote LSP-backed languages into dispatch** — languages with active LSP servers now route through dispatch's standard pipeline instead of ad-hoc paths.
218
321
  - **Dispatch language fallbacks aligned** — LSP-backed and fallback runner selection now uses consistent language-to-capability mapping.
219
322
  - **CSS / HTML / TOML / Elixir fallback wiring** — dispatch fallbacks now include CSS (stylelint), HTML (htmlhint), TOML (taplo), and Elixir (credo).
@@ -237,6 +340,7 @@ All notable changes to pi-lens will be documented in this file.
237
340
  - **Complexity reduction** — decomposed four highest-complexity functions (CC 75–153 → <20 each) for maintainability.
238
341
 
239
342
  ### Fixed
343
+
240
344
  - **Windows LSP startup fallback** — hardened spawn logic for `.cmd` wrappers, PATH resolution, and process creation on Windows.
241
345
  - **C# launch and secondary language fallbacks** — C# LSP and secondary language servers start reliably in more project layouts.
242
346
  - **Prettier-check / stylelint cwd overshoot** — both runners now find the project root correctly instead of silently skipping.
@@ -264,15 +368,18 @@ All notable changes to pi-lens will be documented in this file.
264
368
  - **Tree-sitter rule false positives** — fixed query syntax, scan scripts, and architect glob patterns that produced incorrect findings.
265
369
 
266
370
  ### Performance
371
+
267
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.
268
373
  - **Defer TypeScript loading in similarity runner** — similarity detection lazily imports the TypeScript parser, eliminating cold-start cost on first call.
269
374
 
270
375
  ### Refactored
376
+
271
377
  - **LSP: collapse resolution into `resolveAndLaunch`** — unified four spawn mechanisms into one function with clear platform-aware fallbacks.
272
378
  - **Booboo: replace bespoke tree-sitter runner** — `/lens-booboo` tree-sitter checks now use the same fact-rule pipeline as dispatch, eliminating code duplication.
273
379
  - **Drop redundant async from LSP spawn** — removed unnecessary `async`/`await` from functions that already return Promises.
274
380
 
275
381
  ### Tests
382
+
276
383
  - **GitHub release asset selection and PATH tests** — installer asset URL construction and PATH resolution covered by unit tests.
277
384
  - **Rust-analyzer Windows .zip asset expectation** — test fixture updated for `.zip` extension on Windows.
278
385
  - **Async-noise test multi-statement function** — test rule updated to match multi-statement function bodies.
@@ -280,38 +387,46 @@ All notable changes to pi-lens will be documented in this file.
280
387
  ## [3.8.26] - 2026-04-15
281
388
 
282
389
  ### Fixed
390
+
283
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.
284
392
 
285
393
  ## [3.8.25] - 2026-04-13
286
394
 
287
395
  ### Changed
396
+
288
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.
289
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.
290
399
 
291
400
  ### Fixed
401
+
292
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.
293
403
 
294
404
  ## [3.8.24] - 2026-04-12
295
405
 
296
406
  ### Changed
407
+
297
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.
298
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.
299
410
  - **Ruby server fallback chain** — Ruby LSP startup now tries `ruby-lsp`, then `solargraph`, then `rubocop --lsp` for broader environment compatibility.
300
411
 
301
412
  ### Fixed
413
+
302
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.
303
415
 
304
416
  ## [3.8.23] - 2026-04-12
305
417
 
306
418
  ### Added
419
+
307
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.
308
421
 
309
422
  ### Changed
423
+
310
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.
311
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.
312
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.
313
427
 
314
428
  ### Fixed
429
+
315
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.
316
431
  - **Pull diagnostics fallback path** — when a server advertises pull diagnostics, `textDocument/diagnostic` is now attempted before push-wait fallback.
317
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.).
@@ -322,23 +437,28 @@ All notable changes to pi-lens will be documented in this file.
322
437
  ## [3.8.22] - 2026-04-09
323
438
 
324
439
  ### Changed
440
+
325
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.
326
442
 
327
443
  ### Fixed
444
+
328
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.
329
446
 
330
447
  ## [3.8.21] - 2026-04-08
331
448
 
332
449
  ### Changed
450
+
333
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.
334
452
  - **Coverage warning dedupe** — "Pi-lens analysis unavailable" warnings are now shown once per file per session and reset on session baseline reset.
335
453
 
336
454
  ### Fixed
455
+
337
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.
338
457
 
339
458
  ## [3.8.20] - 2026-04-08
340
459
 
341
460
  ### Changed
461
+
342
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.
343
463
  - **Turn-end overlap guardrails** — turn-end `knip`/`jscpd` checks now skip when the corresponding startup scan is still in-flight.
344
464
  - **Language-profile centralization** — startup and dispatch now share a centralized project language profile for supported language detection and LSP-capable kind policy.
@@ -346,6 +466,7 @@ All notable changes to pi-lens will be documented in this file.
346
466
  - **Language setup hints** — `session_start` now emits actionable install hints for detected Go/Rust/Ruby projects when key tools are missing.
347
467
 
348
468
  ### Fixed
469
+
349
470
  - **TODO baseline scan resilience** — unreadable files are now skipped safely instead of crashing TODO scanning in cloud-synced projects.
350
471
  - **Startup scan gating consistency** — TODO warmup now respects startup warm-cache gating and avoids unnecessary scan work in restricted startup contexts.
351
472
  - **Path exclusion coverage** — shared exclusion list now includes common agent/tooling directories (`.claude`, `.codex`, `.worktrees`, `.vscode`, and related dirs).
@@ -356,39 +477,47 @@ All notable changes to pi-lens will be documented in this file.
356
477
  ## [3.8.19] - 2026-04-07
357
478
 
358
479
  ### Fixed
480
+
359
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.
360
482
 
361
483
  ## [3.8.18] - 2026-04-07
362
484
 
363
485
  ### Changed
486
+
364
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.
365
488
  - **Dispatch + booboo alignment** — similarity guardrails are now aligned between `/lens-booboo` reporting and the dispatch `similarity` runner.
366
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.
367
490
 
368
491
  ### Tests
492
+
369
493
  - Added similarity runner guardrail assertions in `tests/clients/similarity-runner.test.ts`.
370
494
 
371
495
  ## [3.8.17] - 2026-04-07
372
496
 
373
497
  ### Changed
498
+
374
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.
375
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.
376
501
 
377
502
  ### Tests
503
+
378
504
  - Added dispatch flow coverage for delta-mode unused-value promotion in `tests/clients/dispatch/dispatcher-flow.test.ts`.
379
505
 
380
506
  ## [3.8.16] - 2026-04-07
381
507
 
382
508
  ### Changed
509
+
383
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.
384
511
  - **Rule parser metadata support** — YAML rule parsing now supports top-level `note` and `fix` fields (including multiline values) for agent-facing remediation text.
385
512
 
386
513
  ### Tests
514
+
387
515
  - Added parser coverage for `note`/`fix` extraction in `tests/clients/dispatch/runners/yaml-rule-parser.test.ts`.
388
516
 
389
517
  ## [3.8.15] - 2026-04-07
390
518
 
391
519
  ### Added
520
+
392
521
  - **Security rule: no global eval** — added ast-grep rule to block `eval(...)`, `Function(...)`, and string-based `setTimeout`/`setInterval` execution.
393
522
  - **Security rule: no blank target** — added ast-grep rule to warn on `<a target="_blank">` without `rel=...`.
394
523
  - **Performance rule: no accumulating spread** — added ast-grep rule to warn on reduce patterns that repeatedly spread accumulators.
@@ -396,60 +525,72 @@ All notable changes to pi-lens will be documented in this file.
396
525
  ## [3.8.14] - 2026-04-07
397
526
 
398
527
  ### Added
528
+
399
529
  - **YAML lint runner** — added `yamllint` dispatch support for `.yaml`/`.yml` files, with LSP prepended when enabled.
400
530
  - **SQL lint + format support** — added `sqlfluff` dispatch support for `.sql` files and `sqlfluff` formatter integration.
401
531
  - **SQL file kind support** — introduced `sql` file kind detection and language-id mapping.
402
532
 
403
533
  ### Changed
534
+
404
535
  - **Capability matrix coverage expanded** — YAML and SQL now map to dedicated lint runners in the centralized capability matrix.
405
536
  - **Lazy auto-install expansion** — added lazy-install support for `yamllint` and `sqlfluff` via installer-managed pip tools.
406
537
  - **Runner inventory docs updated** — README runner list now includes `yamllint` and `sqlfluff`.
407
538
 
408
539
  ### Tests
540
+
409
541
  - Added YAML/SQL runner parsing/semantics coverage in `tests/clients/dispatch/runners/yaml-sql-runners.test.ts`.
410
542
  - Updated dispatch plan/integration tests for YAML+SQL capability mapping and group ordering.
411
543
 
412
544
  ## [3.8.13] - 2026-04-07
413
545
 
414
546
  ### Changed
547
+
415
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.
416
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.
417
550
 
418
551
  ### Tests
552
+
419
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`.
420
554
 
421
555
  ## [3.8.12] - 2026-04-07
422
556
 
423
557
  ### Changed
558
+
424
559
  - **Excluded-dir policy consolidated** — scanners now share `isExcludedDirName(...)` matching logic from `file-utils` instead of ad-hoc `EXCLUDED_DIRS.includes(...)` checks.
425
560
  - **Pattern-aware exclusions** — exclusion matching now supports case-insensitive exact matches and lightweight glob patterns (for example `*.dSYM`).
426
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.
427
562
 
428
563
  ### Tests
564
+
429
565
  - Added exclusion matcher coverage in `tests/clients/file-utils.test.ts`.
430
566
  - Expanded source-filter coverage for glob exclusions (`*.dSYM`) and case-insensitive directory exclusion in `tests/source-filter.test.ts`.
431
567
 
432
568
  ## [3.8.11] - 2026-04-07
433
569
 
434
570
  ### Added
571
+
435
572
  - **Experimental git guard flag** — added `--lens-guard` to gate commit/push attempts behind a blocker preflight check.
436
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.
437
574
 
438
575
  ### Changed
576
+
439
577
  - **Guard status tracking** — runtime now tracks blocker state/summary from post-write pipeline output so commit blocking messages stay concise and actionable.
440
578
 
441
579
  ### Tests
580
+
442
581
  - Added focused coverage for git guard command detection and block/allow behavior in `tests/clients/git-guard.test.ts`.
443
582
  - Updated runtime tool-result tests for guard status updates in `tests/clients/runtime-tool-result.test.ts`.
444
583
 
445
584
  ## [3.8.10] - 2026-04-07
446
585
 
447
586
  ### Changed
587
+
448
588
  - **LSP default-on** — `--lens-lsp` is now enabled by default to provide unified LSP diagnostics across supported file kinds.
449
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.
450
590
  - **Fallback safety switch clarified** — `--no-lsp` is documented and wired as the explicit opt-out path to language-specific fallbacks.
451
591
 
452
592
  ### Fixed
593
+
453
594
  - **`--no-lsp` consistency** — LSP sync/reset/navigation and runner gating now respect `--no-lsp` consistently, so fallback behavior is predictable.
454
595
  - **LSP/lint overlap noise** — non-blocking lint diagnostics overlapping with LSP on the same file/line are suppressed to keep inline output focused.
455
596
  - **turn_end actionability** — blocker summaries for jscpd/knip now include direct file hints to reduce path-guessing loops.
@@ -460,16 +601,19 @@ All notable changes to pi-lens will be documented in this file.
460
601
  ## [3.8.9] - 2026-04-07
461
602
 
462
603
  ### Changed
604
+
463
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.
464
606
  - **Test runner strategy improved** — Added hybrid test targeting: rerun known failures first, otherwise run related tests for the edited file.
465
607
 
466
608
  ### Fixed
609
+
467
610
  - **Non-JSON test runner parsing** — Go/Cargo/Dotnet/Gradle/Maven/RSpec/Minitest now use generic parsing instead of returning "Unknown runner".
468
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.
469
612
 
470
613
  ## [3.8.8] - 2026-04-07
471
614
 
472
615
  ### Changed
616
+
473
617
  - **README massively simplified** — Reduced the README to core purpose, install/run, key commands, and concise usage notes.
474
618
  - **Docs trimmed** — Removed deep internal documentation files from `docs/` to keep project docs minimal and focused.
475
619
  - **Positioning text clarified** — Updated wording to describe pi-lens as real-time inline feedback for AI agents.
@@ -477,6 +621,7 @@ All notable changes to pi-lens will be documented in this file.
477
621
  ## [3.8.7] - 2026-04-06
478
622
 
479
623
  ### Fixed
624
+
480
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.
481
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.
482
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.
@@ -484,6 +629,7 @@ All notable changes to pi-lens will be documented in this file.
484
629
  ## [3.8.6] - 2026-04-06
485
630
 
486
631
  ### Changed
632
+
487
633
  - **Remove new-TODO reporting from turn_end** — The agent writes TODOs intentionally;
488
634
  reporting them back at turn-end is noise. Removed the diff-against-baseline TODO
489
635
  injection from turn-end findings.
@@ -491,20 +637,22 @@ All notable changes to pi-lens will be documented in this file.
491
637
  ## [3.8.5] - 2026-04-06
492
638
 
493
639
  ### Fixed
640
+
494
641
  - **Pyright CLI duplicates LSP under `--lens-lsp`** — The Pyright CLI runner now skips
495
642
  itself when `--lens-lsp` is active, mirroring the existing `ts-lsp` behaviour. The
496
643
  `lsp` runner (priority 4, Pyright language server) already covers Python type-checking
497
644
  in that mode; running the CLI in parallel was redundant.
498
645
 
499
-
500
646
  ## [3.8.2] - 2026-04-06
501
647
 
502
648
  ### Fixed
649
+
503
650
  - **npm publish bump** — 3.8.1 was already published with the broken postinstall; 3.8.2 contains the actual fix.
504
651
 
505
652
  ## [3.8.1] - 2026-04-06
506
653
 
507
654
  ### Fixed
655
+
508
656
  - **`console-statement` hijacking `no-console-in-tests`** — The keyword match for
509
657
  `console-statement` (`pattern.includes("console")`) was catching `no-console-in-tests`
510
658
  because both contain "console". The simpler rule always won, so both fired on every
@@ -557,20 +705,24 @@ All notable changes to pi-lens will be documented in this file.
557
705
  ### Added — New Rules (50+)
558
706
 
559
707
  **Structural safety (ast-grep, TypeScript + JavaScript):**
708
+
560
709
  - `unchecked-sync-fs` — `fs.statSync/readFileSync/writeFileSync/...` outside try/catch (error)
561
710
  - `unchecked-throwing-call` — `JSON.parse`, `new URL()`, `execSync` outside try/catch (error)
562
711
  - `no-nan-comparison` — `x === NaN` always false, use `Number.isNaN()` (error)
563
712
  - `no-discarded-error` — `new Error()` as standalone statement without throw (error)
564
713
 
565
714
  **Structural safety (ast-grep, Python):**
715
+
566
716
  - `unchecked-throwing-call-python` — `open()`, `json.loads()`, `os.stat()` etc. outside
567
717
  try/except (error)
568
718
 
569
719
  **Structural safety (ast-grep, Ruby):**
720
+
570
721
  - `unchecked-throwing-call-ruby` — `File.read`, `JSON.parse`, `Integer()` etc. outside
571
722
  begin/rescue (error)
572
723
 
573
724
  **Tree-sitter Python rules (new):**
725
+
574
726
  - `python-mutable-class-attr` — class-level `list`/`dict`/`set` shared across all instances (error)
575
727
  - `python-debugger` — `breakpoint()`, `pdb.set_trace()` left in code (error)
576
728
  - `python-print-statement` — `print()` debug output in production code (warning)
@@ -580,6 +732,7 @@ All notable changes to pi-lens will be documented in this file.
580
732
  - `python-raise-string` — `raise "string"` is TypeError in Python 3 (error)
581
733
 
582
734
  **Tree-sitter Ruby rules (new):**
735
+
583
736
  - `ruby-rescue-exception` — `rescue Exception` catches SystemExit and signals (error)
584
737
  - `ruby-empty-rescue` — rescue with no body silently swallows errors (error)
585
738
  - `ruby-debugger` — `binding.pry` / `binding.irb` left in code (error)
@@ -588,13 +741,14 @@ All notable changes to pi-lens will be documented in this file.
588
741
  - `ruby-unsafe-regex` — `Regexp.new(variable)` ReDoS risk (error)
589
742
 
590
743
  **Tree-sitter Go rules (new):**
744
+
591
745
  - `go-hardcoded-secrets` — hardcoded credentials in short/var/const declarations (error)
592
746
 
593
747
  **JavaScript coverage (38 new rules):**
594
- All runtime-applicable TypeScript ast-grep rules now have JavaScript equivalents:
595
- `strict-equality`, `empty-catch`, `no-throw-string`, `no-cond-assign`,
596
- `no-async-promise-executor`, `toctou`, `no-hardcoded-secrets`, `no-inner-html`,
597
- `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.
598
752
 
599
753
  ### Changed — Severity Upgrades
600
754
 
@@ -671,6 +825,7 @@ All notable changes to pi-lens will be documented in this file.
671
825
  ## [3.7.2] - 2026-04-05
672
826
 
673
827
  ### Added
828
+
674
829
  - **All-clear signal** — When the pipeline runs clean (no blockers, no test failures),
675
830
  the agent now receives a confirmation one-liner instead of silence:
676
831
  `✓ TypeScript clean · 12/12 tests · 847ms`
@@ -678,10 +833,12 @@ All notable changes to pi-lens will be documented in this file.
678
833
  Agents can now distinguish "checks ran clean" from "checks didn't run".
679
834
 
680
835
  ### Fixed
836
+
681
837
  - **Auto-fix message now names the tool** — `✅ Auto-fixed 3 issue(s) (eslint:2, biome:1)`
682
838
  instead of the vague `Auto-fixed 3 issue(s)`. Agents know exactly what was corrected.
683
839
 
684
840
  ### Security
841
+
685
842
  - **Remove `effect` dependency** — Used for 5 trivial `tryPromise` wrappers in one file,
686
843
  never consumed via Effect's runtime. Dead dependency removed.
687
844
  - **`--ignore-scripts` in auto-installer** — `npm install` for auto-installed tools now
@@ -700,12 +857,14 @@ All notable changes to pi-lens will be documented in this file.
700
857
  ## [3.7.2] - 2026-04-05 (previous)
701
858
 
702
859
  ### Added
860
+
703
861
  - **ESLint `--fix` in autofix phase** — Projects with an ESLint config now have fixable
704
862
  issues auto-corrected (import ordering, jsx style, etc.) before dispatch runs, using
705
863
  `--fix-dry-run` to get the accurate fixed count then `--fix` to apply. Availability
706
864
  is cached per session. Only fires on JS/TS files with an ESLint config present.
707
865
 
708
866
  ### Fixed
867
+
709
868
  - **Misleading infinite-loop comment in biome/ruff runners** — The comment incorrectly
710
869
  stated that writing files from runners would trigger infinite loops (formatters already
711
870
  prove this isn't true). Updated to explain the real reason: dispatch runners report
@@ -717,6 +876,7 @@ All notable changes to pi-lens will be documented in this file.
717
876
  ## [3.7.1] - 2026-04-05
718
877
 
719
878
  ### Added
879
+
720
880
  - **ESLint dispatch runner** — Projects with `.eslintrc` / `eslint.config.js` (any variant)
721
881
  now run ESLint automatically on every JS/TS file write. Prefers local
722
882
  `node_modules/.bin/eslint` over global. Skips silently on projects using Biome/OxLint
@@ -739,6 +899,7 @@ All notable changes to pi-lens will be documented in this file.
739
899
  ## [3.7.0] - 2026-04-05
740
900
 
741
901
  ### Added
902
+
742
903
  - **Test runner in pipeline** — After every file write/edit, pi-lens now automatically detects and
743
904
  runs the corresponding test file (vitest, jest, pytest). Results surface inline so the agent sees
744
905
  failures immediately without a separate test step. Supports TypeScript/JS/Python; file-level
@@ -749,6 +910,7 @@ All notable changes to pi-lens will be documented in this file.
749
910
  Typical wall-clock savings: 500–1500ms per file write (`parallelGainMs` logged in latency log).
750
911
 
751
912
  ### Fixed
913
+
752
914
  - **`semantic: "none"` when 0 diagnostics** — LSP, Pyright, and type-safety runners were returning
753
915
  `semantic: "warning"` even when `diagnosticCount` was 0 (clean file). Now correctly returns
754
916
  `"none"` when no diagnostics are present, `"warning"` when warnings exist, `"blocking"` on errors.
@@ -779,6 +941,7 @@ All notable changes to pi-lens will be documented in this file.
779
941
  silent skip.
780
942
 
781
943
  ### Changed
944
+
782
945
  - **`startedAt` added to latency log runner entries** — Every runner entry now records when it
783
946
  started, making wall-clock vs. sequential comparisons accurate. `dispatch_complete` also logs
784
947
  `parallelGainMs = sumMs - wallClockMs` to quantify parallelism benefit.
@@ -787,6 +950,7 @@ All notable changes to pi-lens will be documented in this file.
787
950
  for runner loading; all imports are static, eliminating ~50ms warm-up latency on first dispatch.
788
951
 
789
952
  ### Tests
953
+
790
954
  - Added formatter venv/vendor resolution and interactive-install coverage
791
955
  - Added LSP lifecycle test suite with mock LSP server (process spawn, open/change/close, shutdown)
792
956
 
@@ -795,6 +959,7 @@ All notable changes to pi-lens will be documented in this file.
795
959
  ## [3.6.7] - 2026-04-04
796
960
 
797
961
  ### Fixed
962
+
798
963
  - **LSP `ERR_STREAM_DESTROYED` crash** — When an LSP process (e.g. rust-analyzer) exits, Node.js emits
799
964
  `'error'` events on the destroyed stdio streams. Without listeners these became uncaught exceptions
800
965
  that crashed the extension. Added persistent `error` listeners to `stdin`, `stdout`, and `stderr`
@@ -802,6 +967,7 @@ All notable changes to pi-lens will be documented in this file.
802
967
  Same guard added to `NativeRustCoreClient` stdin writes.
803
968
 
804
969
  ### Added
970
+
805
971
  - **Rust performance core (`pi-lens-core`)** — Optional Rust binary for CPU-intensive operations.
806
972
  All features fall back to TypeScript automatically if the binary is not available (it is **not**
807
973
  built automatically on `npm install` — run `npm run rust:build` once if you have Rust installed).
@@ -819,6 +985,7 @@ All notable changes to pi-lens will be documented in this file.
819
985
  failure. Feature flag `USE_RUST = true` at top of file.
820
986
 
821
987
  ### Changed
988
+
822
989
  - **Similarity threshold raised from 0.75 → 0.90** — Empirical evaluation showed that below 0.90
823
990
  false positives (structurally similar but semantically unrelated functions) outnumber true
824
991
  positives with the current 57×72 matrix resolution. Applies to both the dispatch runner and
@@ -830,6 +997,7 @@ All notable changes to pi-lens will be documented in this file.
830
997
  unnamed tokens no longer pollute named slots.
831
998
 
832
999
  ### Fixed (Rust)
1000
+
833
1001
  - `tree_sitter_rust::language_rust()` → `language()` (correct API for tree-sitter-rust 0.21)
834
1002
  - `FunctionInfo` missing `#[derive(Clone)]` — caused compile error in `find_similar_to`
835
1003
  - `export function foo()` was missed by the index builder — TypeScript wraps exported functions
@@ -839,6 +1007,7 @@ All notable changes to pi-lens will be documented in this file.
839
1007
  - Deleted orphan `test_lsp.rs` (intentional type errors caused rust-analyzer to crash the LSP stream)
840
1008
 
841
1009
  ### Repository
1010
+
842
1011
  - Rust source (`rust/src/`, `rust/Cargo.toml`) added to npm `files` whitelist so users can build
843
1012
  the binary from an npm-installed package
844
1013
  - Removed stale `src/main.rs` rule from root `.gitignore` (no such file at repo root)
@@ -849,11 +1018,11 @@ All notable changes to pi-lens will be documented in this file.
849
1018
  ## [3.6.3] - 2026-04-03
850
1019
 
851
1020
  ### Removed (Dead Code Cleanup)
1021
+
852
1022
  - **Deleted unused interviewer tool** — Browser-based interview with diff confirmation was never used:
853
1023
  - Removed `clients/interviewer.ts` (290 lines)
854
1024
  - Removed `clients/interviewer-templates.ts` (240 lines)
855
1025
  - Removed initialization from `index.ts`
856
-
857
1026
  - **Deleted deprecated commands** — All were superseded by `/lens-booboo`:
858
1027
  - `/lens-booboo-fix` command (fix-from-booboo.ts, 430 lines) — showed warning to use `/lens-booboo`
859
1028
  - `/lens-fix-simplified` command (fix-simplified.ts, 770 lines) — never registered, unused
@@ -865,13 +1034,13 @@ All notable changes to pi-lens will be documented in this file.
865
1034
  - All imports already used `safe-spawn.ts`, making `safe-spawn-async.ts` pure dead code
866
1035
 
867
1036
  ### Test Suite Overhaul
1037
+
868
1038
  - **Removed ~85 wasteful/broken test files**:
869
1039
  - "Is tool available" tests (8 files) — just checked if external CLIs installed
870
1040
  - Heavy integration tests (2 files) — 5s timeouts, full codebase scans
871
1041
  - Broken LSP tests (7 files) — import path errors
872
1042
  - Broken runner tests (7 files) — thin CLI wrappers with wrong imports
873
1043
  - Trivial utility tests (5 files) — file extension parsing, string sanitization
874
-
875
1044
  - **Added meaningful integration tests**:
876
1045
  - `tests/clients/dispatch/dispatcher-flow.test.ts` — Runner registration, execution, delta mode, conditional runners
877
1046
  - `tests/extension-hooks.test.ts` — pi API: tool/command/flag registration, event handlers
@@ -882,12 +1051,14 @@ All notable changes to pi-lens will be documented in this file.
882
1051
  ## [3.6.2] - 2026-04-02
883
1052
 
884
1053
  ### Added
1054
+
885
1055
  - **Condensed skill auto-loading** — Injects ~70-token tool selection guidance at session start (vs 1,355 for full skills):
886
1056
  - Quick reference for when to use lsp_navigation vs ast_grep_search vs grep
887
1057
  - References full skills for lazy loading (ast-grep, lsp-navigation)
888
1058
  - Prevents common tool selection errors without loading full skill content
889
1059
 
890
1060
  ### Changed
1061
+
891
1062
  - **Streamlined session start injection** — Removed TODO/Knip/jscpd reports from initial context:
892
1063
  - Scans still run and cache for on-demand access via `/lens-booboo`
893
1064
  - Reduces session start noise (only active tools list, error reminder, skill guidance remain)
@@ -896,15 +1067,18 @@ All notable changes to pi-lens will be documented in this file.
896
1067
  ## [3.6.1] - 2026-04-02
897
1068
 
898
1069
  ### Changed
1070
+
899
1071
  - **Updated package description** — More concise: "Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo"
900
1072
 
901
1073
  ### Repository
1074
+
902
1075
  - **AGENTS.md is now local-only** — Removed from git repo and added to `.gitignore` so it stays local to each developer's environment
903
1076
  - **Cleaned up debug files** — Removed old test files (`_debug-*.ts`, `_trigger-test.ts`, `_test-*.ts`) from repo
904
1077
 
905
1078
  ## [3.6.0] - 2026-04-02
906
1079
 
907
1080
  ### Added
1081
+
908
1082
  - **LSP Call Hierarchy Support** — Added 3 new operations to `lsp_navigation` tool:
909
1083
  - `prepareCallHierarchy` — Get callable item at position
910
1084
  - `incomingCalls` — Find all functions/methods that CALL this function
@@ -923,6 +1097,7 @@ All notable changes to pi-lens will be documented in this file.
923
1097
  - New thresholds: MaxCyc >10 bad, >30 critical; Entropy >4.0 bits risky, >7.0 critical
924
1098
 
925
1099
  ### Removed
1100
+
926
1101
  - **TDR (Technical Debt Ratio)** — Removed orphaned metric tracking system:
927
1102
  - Deleted `TDREntry`, `TDRCategory` types, `tdrFindings` Map, `updateTDR()` method
928
1103
  - Removed `convertDiagnosticsToTDREntries()` helper and all `tdrCategory` assignments
@@ -930,6 +1105,7 @@ All notable changes to pi-lens will be documented in this file.
930
1105
  - TDI is sufficient for code health tracking; inline diagnostics provide immediate feedback
931
1106
 
932
1107
  ### Changed
1108
+
933
1109
  - **Updated `/lens-tdi` display** — Shows 5 category breakdown with descriptions:
934
1110
  ```
935
1111
  Debt breakdown:
@@ -946,6 +1122,7 @@ All notable changes to pi-lens will be documented in this file.
946
1122
  ## [3.5.0] - 2026-04-02
947
1123
 
948
1124
  ### Added
1125
+
949
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.
950
1127
  - **Rule cache infrastructure** (`clients/cache/`) — New disk-backed cache system with:
951
1128
  - `RuleCache` class for storing compiled artifacts
@@ -954,6 +1131,7 @@ All notable changes to pi-lens will be documented in this file.
954
1131
  - TTL and integrity validation
955
1132
 
956
1133
  ### Fixed
1134
+
957
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.
958
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.
959
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.
@@ -961,6 +1139,7 @@ All notable changes to pi-lens will be documented in this file.
961
1139
  - **Latency logging restored** — Fixed missing latency logging in `tool_result` handler. Runner timing data now correctly flows to `~/.pi-lens/latency.log` again.
962
1140
 
963
1141
  ### Removed
1142
+
964
1143
  - **Broken ast-grep rules** — Removed overlapping rules that were causing false positives or conflicts with tree-sitter coverage.
965
1144
 
966
1145
  ---
@@ -968,10 +1147,12 @@ All notable changes to pi-lens will be documented in this file.
968
1147
  ## [3.4.0] - 2026-04-02
969
1148
 
970
1149
  ### Fixed
1150
+
971
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.
972
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.
973
1153
 
974
1154
  ### Added
1155
+
975
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.
976
1157
  - **Pre-write duplicate detection (two layers):**
977
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.`
@@ -979,6 +1160,7 @@ All notable changes to pi-lens will be documented in this file.
979
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.
980
1161
 
981
1162
  ### Changed
1163
+
982
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.
983
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`.
984
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.
@@ -988,6 +1170,7 @@ All notable changes to pi-lens will be documented in this file.
988
1170
  ## [3.3.1] - 2026-04-02
989
1171
 
990
1172
  ### Fixed
1173
+
991
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.
992
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`.
993
1176
 
@@ -996,11 +1179,13 @@ All notable changes to pi-lens will be documented in this file.
996
1179
  ## [3.3.0] - 2026-04-02
997
1180
 
998
1181
  ### Removed
1182
+
999
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.
1000
1184
  - **`--lens-bus-debug`**: Removed alongside `--lens-bus`.
1001
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.
1002
1186
 
1003
1187
  ### Changed
1188
+
1004
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.
1005
1190
 
1006
1191
  ---
@@ -1008,11 +1193,13 @@ All notable changes to pi-lens will be documented in this file.
1008
1193
  ## [3.2.0] - 2026-04-02
1009
1194
 
1010
1195
  ### Fixed
1196
+
1011
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.
1012
1198
  - **Formatter cwd not passed** — `formatFile` now passes `cwd` to `safeSpawn`, fixing Biome's "nested root configuration" error when formatting files in subdirectories.
1013
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.
1014
1200
 
1015
1201
  ### Changed
1202
+
1016
1203
  - **Go/Rust LSP initialization** — Added server-specific initialization options for better compatibility.
1017
1204
 
1018
1205
  ---
@@ -1020,6 +1207,7 @@ All notable changes to pi-lens will be documented in this file.
1020
1207
  ## [3.1.3] - 2026-04-02
1021
1208
 
1022
1209
  ### Fixed
1210
+
1023
1211
  - **Biome autofix: removed `--unsafe` flag** — `--unsafe` silently deleted unused variables
1024
1212
  and interfaces, removing code the agent was mid-way through writing (e.g. a new interface
1025
1213
  not yet wired up). Only safe fixes (`--write`) are now applied automatically on every write.
@@ -1041,6 +1229,7 @@ All notable changes to pi-lens will be documented in this file.
1041
1229
  of the actual condition. The check is now awaited properly inside `runRunner()`.
1042
1230
 
1043
1231
  ### Performance
1232
+
1044
1233
  - **Biome: local binary instead of npx** — `BiomeClient` now resolves
1045
1234
  `node_modules/.bin/biome.cmd` (Windows) or `node_modules/.bin/biome` before falling back
1046
1235
  to `npx @biomejs/biome`. Eliminates ~1 s npx startup overhead per invocation.
@@ -1063,6 +1252,7 @@ All notable changes to pi-lens will be documented in this file.
1063
1252
  ## [3.1.1] - 2026-04-01
1064
1253
 
1065
1254
  ### Added
1255
+
1066
1256
  - **File-based latency logging** — Performance analysis via `~/.pi-lens/latency.log`
1067
1257
  - New `latency-logger.ts` module for centralized logging
1068
1258
  - Logs every runner's timing (ts-lsp, ast-grep-napi, biome, test-runner, etc.)
@@ -1075,6 +1265,7 @@ All notable changes to pi-lens will be documented in this file.
1075
1265
  ## [3.1.0] - 2026-04-01
1076
1266
 
1077
1267
  ### Changed
1268
+
1078
1269
  - **Consolidated ast-grep runners** — Unified CLI and NAPI runners with shared rule set
1079
1270
  - NAPI runner now primary for dispatch (100x faster than CLI spawn)
1080
1271
  - Merged ts-slop-rules (21 files) into ast-grep-rules/slop-patterns.yml (33 patterns)
@@ -1083,6 +1274,7 @@ All notable changes to pi-lens will be documented in this file.
1083
1274
  - CLI ast-grep kept only for `ast_grep_search` / `ast_grep_replace` tools
1084
1275
 
1085
1276
  ### Fixed
1277
+
1086
1278
  - **ast-grep-napi stability** — Fixed stack overflow crashes in AST traversal
1087
1279
  - Added `_MAX_AST_DEPTH = 50` depth limit to `findByKind()` and `getAllNodes()`
1088
1280
  - Added `_MAX_RULE_DEPTH = 5` recursion limit for structured rules
@@ -1095,12 +1287,14 @@ All notable changes to pi-lens will be documented in this file.
1095
1287
  ## [3.0.1] - 2026-03-31
1096
1288
 
1097
1289
  ### Changed
1290
+
1098
1291
  - **Documentation refresh**: Updated npm and README descriptions for v3.0.0 features
1099
1292
  - New tagline: "pi extension for real-time code quality"
1100
1293
  - Highlights 31 LSP servers, tree-sitter analysis, auto-install capability
1101
1294
  - Clarified blockers vs warnings split (inline vs `/lens-booboo`)
1102
1295
 
1103
1296
  ### Fixed
1297
+
1104
1298
  - **Entropy threshold**: Increased from 3.5 → 5.5 bits to reduce false positives
1105
1299
  - Previous threshold was too sensitive for tooling codebases
1106
1300
  - Eliminates ~70-80% of "High entropy" warnings on legitimate complex code
@@ -1112,7 +1306,9 @@ All notable changes to pi-lens will be documented in this file.
1112
1306
  ### Breaking Changes
1113
1307
 
1114
1308
  #### Removed - Deprecated Commands
1309
+
1115
1310
  The following deprecated commands have been removed:
1311
+
1116
1312
  - `/lens-booboo-fix` → Use `/lens-booboo` with autofix capability
1117
1313
  - `/lens-booboo-delta` → Delta mode now automatic
1118
1314
  - `/lens-booboo-refactor` → Use `/lens-booboo` findings
@@ -1120,20 +1316,25 @@ The following deprecated commands have been removed:
1120
1316
  - `/lens-rate` → Use `/lens-booboo` quality scoring
1121
1317
 
1122
1318
  #### Changed - Blockers vs Warnings Architecture
1319
+
1123
1320
  - **🔴 Blockers** (type errors, secrets, empty catch blocks) → Appear **inline** and stop the agent
1124
1321
  - **🟡 Warnings** (complexity, code smells) → Go to **`/lens-booboo`** only (not inline)
1125
1322
  - Tree-sitter rules with `severity: error` now properly block inline
1126
1323
  - Dispatcher checks individual diagnostic semantic, not just group default
1127
1324
 
1128
1325
  ### Added - Tree-Sitter Runner
1326
+
1129
1327
  New structural analysis runner at priority 14:
1328
+
1130
1329
  - **18 YAML query files** for TypeScript and Python patterns
1131
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
1132
1331
  - Python: bare-except, eval-exec, wildcard-import, is-vs-equals, mutable-default-arg, unreachable-except
1133
1332
  - Blockers appear inline (severity: error), warnings go to `/lens-booboo` (severity: warning)
1134
1333
 
1135
1334
  ### Added - Auto-Install for Core Tools
1335
+
1136
1336
  Four tools now auto-install on first use (no manual setup required):
1337
+
1137
1338
  1. **TypeScript Language Server** (`typescript-language-server`) — TS/JS type checking
1138
1339
  2. **Pyright** — Python type checking (`pip install pyright`)
1139
1340
  3. **Ruff** — Python linting (`pip install ruff`)
@@ -1142,12 +1343,15 @@ Four tools now auto-install on first use (no manual setup required):
1142
1343
  Installs to `.pi-lens/tools/` with verification step (`--version` check).
1143
1344
 
1144
1345
  ### Added - NAPI Security Rules
1346
+
1145
1347
  Migrated 20 critical security rules to NAPI (fast native execution):
1348
+
1146
1349
  - Rules with `weight >= 4` are **blocking** (stop the agent)
1147
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
1148
1351
  - NAPI runs at priority 15 (after tree-sitter, before slop rules)
1149
1352
 
1150
1353
  ### Fixed
1354
+
1151
1355
  - **Tree-sitter query loading**: Added missing `loadQueries()` call before `getAllQueries()`
1152
1356
  - **Windows path handling**: Changed from `lastIndexOf("/")` to `path.dirname()` for cross-platform compatibility
1153
1357
  - **Dispatcher blocker detection**: Now checks if any individual diagnostic has `semantic === "blocking"`
@@ -1158,6 +1362,7 @@ Migrated 20 critical security rules to NAPI (fast native execution):
1158
1362
  - **Biome/Prettier race**: Biome is now default (priority 10), Prettier is fallback only
1159
1363
 
1160
1364
  ### Changed
1365
+
1161
1366
  - **README reorganization**: Removed redundant sections (Architecture, Language Support, Rules, Delta-mode, Slop Detection)
1162
1367
  - **Consolidated Additional Safeguards** into Features section with Runners table
1163
1368
  - **Updated .gitignore**: Local tracking files stay out of repo
@@ -1196,6 +1401,7 @@ Three new lint runners with full test coverage:
1196
1401
  - Flag: `--no-shellcheck` to disable
1197
1402
 
1198
1403
  ### Changed
1404
+
1199
1405
  - Updated README.md with new runners in dispatcher diagram and available runners table
1200
1406
  - Added installation instructions for new tools in Dependent Tools section
1201
1407
  - Added new flags to Flag Reference
@@ -1205,6 +1411,7 @@ Three new lint runners with full test coverage:
1205
1411
  ## [2.6.0] - 2026-03-30
1206
1412
 
1207
1413
  ### Added - Phase 1: Event Bus Architecture
1414
+
1208
1415
  - **Event Bus System** (`clients/bus/`): Decoupled pub/sub for diagnostic events
1209
1416
  - `bus.ts` — Core publish/subscribe with `once()`, `waitFor()`, middleware support
1210
1417
  - `events.ts` — 12 typed event definitions (DiagnosticFound, RunnerStarted, LspDiagnostic, etc.)
@@ -1213,6 +1420,7 @@ Three new lint runners with full test coverage:
1213
1420
  - **New flags**: `--lens-bus`, `--lens-bus-debug` for event system control
1214
1421
 
1215
1422
  ### Added - Phase 2: Effect-TS Service Layer
1423
+
1216
1424
  - **Effect-TS infrastructure** (`clients/services/`): Composable async operations
1217
1425
  - `runner-service.ts` — Concurrent runner execution with timeout handling
1218
1426
  - `effect-integration.ts` — Bus-integrated Effect dispatch
@@ -1221,6 +1429,7 @@ Three new lint runners with full test coverage:
1221
1429
  - **New flag**: `--lens-effect` for concurrent execution
1222
1430
 
1223
1431
  ### Added - Phase 3: Multi-LSP Client (31 Language Servers)
1432
+
1224
1433
  - **LSP Core** (`clients/lsp/`): Full Language Server Protocol support
1225
1434
  - `client.ts` — JSON-RPC client with debounced diagnostics (150ms)
1226
1435
  - `server.ts` — 31 LSP server definitions with root detection
@@ -1242,6 +1451,7 @@ Three new lint runners with full test coverage:
1242
1451
  - **Deprecated**: Old `ts-lsp` runner falls back to built-in TypeScriptClient when `--lens-lsp` not set
1243
1452
 
1244
1453
  ### Added - Phase 4: Auto-Installation System
1454
+
1245
1455
  - **Auto-installer** (`clients/installer/`): Automatic tool installation
1246
1456
  - `index.ts` — Core installation logic for npm/pip packages
1247
1457
  - `isToolInstalled()` — Check global PATH or local `.pi-lens/tools/`
@@ -1253,22 +1463,26 @@ Three new lint runners with full test coverage:
1253
1463
  - **LSP integration**: TypeScript and Python servers now use `ensureTool()` before spawning
1254
1464
 
1255
1465
  ### Changed - Commands
1466
+
1256
1467
  - **Disabled**: `/lens-booboo-fix` — Now shows warning "currently disabled. Use /lens-booboo"
1257
1468
  - **Disabled**: `/lens-booboo-delta` — Now shows warning "currently disabled. Use /lens-booboo"
1258
1469
  - **Disabled**: `/lens-booboo-refactor` — Now shows warning "currently disabled. Use /lens-booboo"
1259
1470
  - **Active**: `/lens-booboo` — Full codebase review (only booboo command now)
1260
1471
 
1261
1472
  ### Changed - Architecture
1473
+
1262
1474
  - **Three-phase system**: Bus → Effect → LSP can be enabled independently
1263
1475
  - **Dispatcher priority**: `lens-effect` > `lens-bus` > default (sequential)
1264
1476
  - **LSP deprecation**: Old built-in TypeScriptClient deprecated, LSP client preferred
1265
1477
 
1266
1478
  ### Documentation
1479
+
1267
1480
  - **LSP configuration guide**: `docs/LSP_CONFIG.md` — How to add custom LSP servers
1268
1481
  - **README updated**: Added LSP section, three-phase architecture, 31 language matrix
1269
1482
  - **CHANGELOG restructured**: Now organized by Phase 1/2/3/4
1270
1483
 
1271
1484
  ### Technical Details
1485
+
1272
1486
  - **New dependencies**: `effect` (Phase 2), `vscode-jsonrpc` (Phase 3)
1273
1487
  - **Lines added**: ~6,000 across 4 phases
1274
1488
  - **Test status**: 617 passing (3 flaky unrelated tests)
@@ -1277,6 +1491,7 @@ Three new lint runners with full test coverage:
1277
1491
  ## [2.5.0] - 2026-03-30
1278
1492
 
1279
1493
  ### Added
1494
+
1280
1495
  - **Python tree-sitter support**: 6 structural patterns for Python code analysis
1281
1496
  - `bare-except` — Detects `except:` that catches SystemExit/KeyboardInterrupt
1282
1497
  - `mutable-default-arg` — Detects mutable defaults like `def f(x=[])`
@@ -1291,10 +1506,12 @@ Three new lint runners with full test coverage:
1291
1506
  - **Query file extraction**: Moved TypeScript patterns from embedded code to `rules/tree-sitter-queries/typescript/*.yml`
1292
1507
 
1293
1508
  ### Changed
1509
+
1294
1510
  - **README updated**: Added Python patterns to structural analysis section
1295
1511
  - **Architect client**: Fixed TypeScript errors (`configPath` property declaration)
1296
1512
 
1297
1513
  ### Technical Details
1514
+
1298
1515
  - Downloaded `tree-sitter-python.wasm` (458KB) for Python AST parsing
1299
1516
  - Post-filters for semantic validation (e.g., distinguishing bare except from specific handlers)
1300
1517
  - ~50ms analysis time per file for Python
@@ -1302,6 +1519,7 @@ Three new lint runners with full test coverage:
1302
1519
  ## [2.4.0] - 2026-03-30
1303
1520
 
1304
1521
  ### Added
1522
+
1305
1523
  - **`safeSpawn` utility**: Cross-platform spawn wrapper that eliminates `DEP0190` deprecation warnings on Windows. Uses command string construction instead of shell+args array.
1306
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 |`.
1307
1525
  - **Shared runner utilities**: Extracted `runner-helpers.ts` with:
@@ -1317,6 +1535,7 @@ Three new lint runners with full test coverage:
1317
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`.
1318
1536
 
1319
1537
  ### Changed
1538
+
1320
1539
  - **26 files refactored to use `safeSpawn`**: Eliminated `shell: process.platform === "win32"` deprecation pattern across all clients and runners.
1321
1540
  - **Updated runners to use shared utilities**:
1322
1541
  - `ruff.ts`, `pyright.ts` → use `createAvailabilityChecker()`
@@ -1330,16 +1549,19 @@ Three new lint runners with full test coverage:
1330
1549
  - **Test cleanup safety**: Fixed all test files to use `fs.existsSync()` before `fs.unlinkSync()` to prevent ENOENT errors.
1331
1550
 
1332
1551
  ### Fixed
1552
+
1333
1553
  - **Circular dependencies**: Eliminated 2 cycles (`ast-grep-client` ↔ `ast-grep-parser`, `ast-grep-client` ↔ `ast-grep-rule-manager`) by extracting shared types.
1334
1554
  - **Test flakiness**: All 70 test files now pass consistently (666 tests total).
1335
1555
 
1336
1556
  ### Code Quality
1557
+
1337
1558
  - **Lines saved**: ~350 lines of duplicated code removed across utilities and parsers.
1338
1559
  - **Architect violations**: Reduced from 404 to ~50-80 (after test file exclusion + relaxed rules).
1339
1560
 
1340
1561
  ## [2.3.0] - 2026-03-30
1341
1562
 
1342
1563
  ### Added
1564
+
1343
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.
1344
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.
1345
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`.
@@ -1348,29 +1570,35 @@ Three new lint runners with full test coverage:
1348
1570
  - **Codebase self-scan**: `scan_codebase.test.ts` for testing the NAPI runner against the pi-lens codebase itself.
1349
1571
 
1350
1572
  ### Changed
1573
+
1351
1574
  - **Architecture documentation**: Updated README with complete architecture overview, runner system diagram, and language support matrix.
1352
1575
  - **Disabled problematic slop rules**: `ts-for-index-length` and `ts-unnecessary-array-isarray` disabled due to false positives on legitimate index-based operations.
1353
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).
1354
1577
  - **TS slop runner disabled**: CLI runner `ts-slop.ts` disabled in favor of NAPI-based detection (faster, same rules).
1355
1578
 
1356
1579
  ### Deprecated
1580
+
1357
1581
  - **`/lens-rate` command**: Now shows deprecation warning. Needs re-structuring. Users should use `/lens-booboo` instead.
1358
1582
  - **`/lens-metrics` command**: Now shows deprecation warning. Temporarily disabled, will be restructured. Users should use `/lens-booboo` instead.
1359
1583
 
1360
1584
  ### Removed
1585
+
1361
1586
  - **Old implementations removed**: 259 lines of deprecated command code removed from `index.ts`.
1362
1587
 
1363
1588
  ### Repository Cleanup
1589
+
1364
1590
  - **Local-only files removed from GitHub**: `.pisessionsummaries/` and `refactor.md` removed from repo (still in local `.gitignore`).
1365
1591
 
1366
1592
  ## [2.1.1] - 2026-03-29
1367
1593
 
1368
1594
  ### Added
1595
+
1369
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.
1370
1597
  - **Project rules integration**: Scans for `.claude/rules/`, `.agents/rules/`, `CLAUDE.md`, `AGENTS.md` at session start and surfaces in system prompt.
1371
1598
  - **Grep-ability rules**: New ast-grep rules for `no-default-export` and `no-relative-cross-package-import` to improve agent searchability.
1372
1599
 
1373
1600
  ### Changed
1601
+
1374
1602
  - **Inline feedback stripped to blocking only**: Warnings no longer shown inline (noise). Only blocking violations and test failures interrupt the agent.
1375
1603
  - **booboo-fix output compacted**: Summary in terminal, full plan in `.pi-lens/reports/fix-plan.tsv`.
1376
1604
  - **booboo-refactor output compacted**: Top 5 worst offenders in terminal, full ranked list in `.pi-lens/reports/refactor-ranked.tsv`.
@@ -1383,12 +1611,14 @@ Three new lint runners with full test coverage:
1383
1611
  ## [2.0.40] - 2026-03-27
1384
1612
 
1385
1613
  ### Changed
1614
+
1386
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.
1387
1616
  - **Skip duplicate snapshots**: Same commit + same MI = no write (reduces noise).
1388
1617
 
1389
1618
  ## [2.0.39] - 2026-03-27
1390
1619
 
1391
1620
  ### Added
1621
+
1392
1622
  - **Historical metrics tracking**: New `clients/metrics-history.ts` module captures complexity snapshots per commit. Tracks MI, cognitive complexity, and nesting depth across sessions.
1393
1623
  - **Trend analysis in `/lens-metrics`**: New "Trend" column shows 📈/📉/➡️ with MI delta. "Trend Summary" section aggregates improving/stable/regressing counts with worst regressions.
1394
1624
  - **Passive capture**: Snapshots captured on every file edit (tool_call hook) + `/lens-metrics` run. Max 20 snapshots per file (sliding window).
@@ -1396,6 +1626,7 @@ Three new lint runners with full test coverage:
1396
1626
  ## [2.0.38] - 2026-03-27
1397
1627
 
1398
1628
  ### Changed
1629
+
1399
1630
  - **Refactored 4 client files** via `/lens-booboo-refactor` loop:
1400
1631
  - `biome-client.ts`: Extracted `withValidatedPath()` guard pattern (4 methods consolidated)
1401
1632
  - `complexity-client.ts`: Extracted `analyzeFile()` pipeline into `readAndParse()`, `computeMetrics()`, `aggregateFunctionStats()`
@@ -1405,28 +1636,34 @@ Three new lint runners with full test coverage:
1405
1636
  ## [2.0.29] - 2026-03-26
1406
1637
 
1407
1638
  ### Added
1639
+
1408
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.
1409
1641
 
1410
1642
  ### Removed
1643
+
1411
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.
1412
1645
  - **`prefer-const` from RULE_ACTIONS** — no longer needed (Biome handles directly).
1413
1646
 
1414
1647
  ### Changed
1648
+
1415
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).
1416
1650
 
1417
1651
  ## [2.0.27] - 2026-03-26
1418
1652
 
1419
1653
  ### Added
1654
+
1420
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'`.
1421
1656
  - **`clients/type-safety-client.ts`**: New client for type safety checks. Extensible for future checks (null safety, exhaustive type guards).
1422
1657
 
1423
1658
  ### Changed
1659
+
1424
1660
  - **Type safety violations added to inline feedback**: Missing switch cases now block the agent mid-task, same as TypeScript errors.
1425
1661
  - **Type safety violations in `/lens-booboo-fix`**: Marked as agent-fixable (add missing case or default clause).
1426
1662
 
1427
1663
  ## [2.0.26] - 2026-03-26
1428
1664
 
1429
1665
  ### Added
1666
+
1430
1667
  - **5 new ast-grep rules** for AI slop detection:
1431
1668
  - `no-process-env`: Block direct `process.env` access (use DI or config module) — error level
1432
1669
  - `no-param-reassign`: Detect function parameter reassignment — warning level
@@ -1435,6 +1672,7 @@ Three new lint runners with full test coverage:
1435
1672
  - `no-architecture-violation`: Block cross-layer imports (models/db) — error level
1436
1673
 
1437
1674
  ### Changed
1675
+
1438
1676
  - **RULE_ACTIONS updated** for new rules:
1439
1677
  - `agent` type (inline + booboo-fix): `no-param-reassign`, `switch-without-default`, `switch-exhaustiveness`
1440
1678
  - `skip` type (booboo-refactor only): `no-process-env`, `no-single-char-var`, `no-architecture-violation`
@@ -1442,12 +1680,14 @@ Three new lint runners with full test coverage:
1442
1680
  ## [2.0.24] - 2026-03-26
1443
1681
 
1444
1682
  ### Changed
1683
+
1445
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.
1446
1685
  - **Confirmation screen**: "✅ Looks good — move to next offender" / "💬 Request changes" (chat textarea). Diff display is optional.
1447
1686
 
1448
1687
  ## [2.0.23] - 2026-03-26
1449
1688
 
1450
1689
  ### Changed
1690
+
1451
1691
  - **Extracted interviewer and scan modules from `index.ts`**: `index.ts` reduced by 460 lines.
1452
1692
  - `clients/interviewer.ts` — all browser interview infrastructure (HTML generation, HTTP server, browser launch, option selection, diff confirmation screen)
1453
1693
  - `clients/scan-architectural-debt.ts` — shared scanning utilities (`scanSkipViolations`, `scanComplexityMetrics`, `scoreFiles`, `extractCodeSnippet`)
@@ -1456,6 +1696,7 @@ Three new lint runners with full test coverage:
1456
1696
  ## [2.0.22] - 2026-03-26
1457
1697
 
1458
1698
  ### Added
1699
+
1459
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.
1460
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.
1461
1702
  - **Auto-close on confirm**: Browser tab closes automatically after user submits.
@@ -1463,42 +1704,50 @@ Three new lint runners with full test coverage:
1463
1704
  ## [2.0.21] - 2026-03-26
1464
1705
 
1465
1706
  ### Added
1707
+
1466
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.
1467
1709
  - **Plan + diff confirmation screen**: Plan rendered as styled markdown, diff rendered with syntax-colored `+`/`-` lines. Line counts (`+N / −N`) shown in diff header.
1468
1710
 
1469
1711
  ## [2.0.20] - 2026-03-26
1470
1712
 
1471
1713
  ### Added
1714
+
1472
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.
1473
1716
 
1474
1717
  ## [2.0.19] - 2026-03-26
1475
1718
 
1476
1719
  ### Changed
1720
+
1477
1721
  - **`/lens-booboo-fix` jscpd filter**: Only within-file duplicates shown in actionable section. Cross-file duplicates are architectural — shown in skip section only.
1478
1722
  - **AI slop filter tightened**: Require 2+ signals per file (was 1+). Single-issue flags on small files are noise — skip them.
1479
1723
 
1480
1724
  ## [2.0.18] - 2026-03-26
1481
1725
 
1482
1726
  ### Fixed
1727
+
1483
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.
1484
1729
 
1485
1730
  ## [2.0.17] - 2026-03-26
1486
1731
 
1487
1732
  ### Changed
1733
+
1488
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.
1489
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`.
1490
1736
 
1491
1737
  ## [2.0.16] - 2026-03-26
1492
1738
 
1493
1739
  ### Added
1740
+
1494
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.
1495
1742
 
1496
1743
  ### Changed
1744
+
1497
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.
1498
1746
 
1499
1747
  ## [2.0.15] - 2026-03-26
1500
1748
 
1501
1749
  ### Removed
1750
+
1502
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`.
1503
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.
1504
1753
  - **`/lens-todos`**: Removed (covered by `/lens-booboo`).
@@ -1506,12 +1755,14 @@ Three new lint runners with full test coverage:
1506
1755
  - **`/lens-deps`**: Removed — circular dep scan added to `/lens-booboo` as Part 8.
1507
1756
 
1508
1757
  ### Changed
1758
+
1509
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.
1510
1760
  - **`/lens-booboo` now includes circular dependencies**: Added as Part 8 (after type coverage) using `depChecker.scanProject`.
1511
1761
 
1512
1762
  ## [2.0.14] - 2026-03-26
1513
1763
 
1514
1764
  ### Fixed
1765
+
1515
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.
1516
1767
  - **`raw-strings` rule added to skip list**: 230 false positives in CLI/tooling codebases.
1517
1768
  - **`typescript-client.ts` duplication**: Extracted `resolvePosition()`, `resolveTree()`, and `toLocations()` helpers, deduplicating 6+ LSP methods.
@@ -1520,36 +1771,44 @@ Three new lint runners with full test coverage:
1520
1771
  ## [2.0.13] - 2026-03-26
1521
1772
 
1522
1773
  ### Removed
1774
+
1523
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.
1524
1776
 
1525
1777
  ## [2.0.12] - 2026-03-26
1526
1778
 
1527
1779
  ### Fixed
1780
+
1528
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.
1529
1782
 
1530
1783
  ### Changed
1784
+
1531
1785
  - **Remaining Biome section rephrased**: "These couldn't be auto-fixed even with `--unsafe` — fix each manually."
1532
1786
 
1533
1787
  ## [2.0.11] - 2026-03-26
1534
1788
 
1535
1789
  ### Added
1790
+
1536
1791
  - **Circular dependency scan to `/lens-booboo`**: Added as Part 8, using `depChecker.scanProject()` to detect circular chains across the codebase.
1537
1792
 
1538
1793
  ### Removed
1794
+
1539
1795
  - **`/lens-todos`**, **`/lens-dead-code`**, **`/lens-deps`**: Removed standalone commands — all covered by `/lens-booboo`.
1540
1796
 
1541
1797
  ## [2.0.10] - 2026-03-26
1542
1798
 
1543
1799
  ### Changed
1800
+
1544
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).
1545
1802
 
1546
1803
  ## [2.0.1] - 2026-03-25
1547
1804
 
1548
1805
  ### Fixed
1806
+
1549
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.
1550
1808
  - **Renamed "Design Smells" to "ast-grep"** in booboo report — the scan runs all 65 rules (security, correctness, style, design), not just design smells.
1551
1809
 
1552
1810
  ### Changed
1811
+
1553
1812
  - **Stronger real-time feedback messages** — all messages now use severity emoji and imperative language:
1554
1813
  - `🔴 Fix N TypeScript error(s) — these must be resolved`
1555
1814
  - `🧹 Remove N unused import(s) — they are dead code`
@@ -1564,6 +1823,7 @@ Three new lint runners with full test coverage:
1564
1823
  ## [2.0.0] - 2026-03-25
1565
1824
 
1566
1825
  ### Added
1826
+
1567
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.
1568
1828
  - **`/lens-booboo` saves full report**: Results saved to `.pi-lens/reviews/booboo-<timestamp>.md` — no truncation, all issues, agent-readable.
1569
1829
  - **AI slop indicators**: Four new real-time and report-based detectors:
@@ -1575,7 +1835,8 @@ Three new lint runners with full test coverage:
1575
1835
  - **Shared test utilities**: `createTempFile` and `setupTestEnvironment` extracted to `clients/test-utils.ts`, eliminating copy-paste across 13 test files.
1576
1836
 
1577
1837
  ### Changed
1578
- - **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.
1579
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).
1580
1841
  - **Test files excluded from AI slop warnings**: MI/complexity thresholds are inherently low in test files — warnings suppressed for `*.test.ts` / `*.spec.ts`.
1581
1842
  - **Test files excluded from TODO scanner**: Test fixture annotations (`FIXME`, `BUG`, etc.) no longer appear in TODO reports.
@@ -1584,12 +1845,14 @@ Three new lint runners with full test coverage:
1584
1845
  - **Removed unused dependencies**: `vscode-languageserver-protocol` and `vscode-languageserver-types` removed; `@sinclair/typebox` added (was unlisted).
1585
1846
 
1586
1847
  ### Fixed
1848
+
1587
1849
  - Removed 3 unconditional `console.log` calls leaking `[scan_exports]` to terminal.
1588
1850
  - Duplicate Biome scan in `tool_call` hook eliminated (was scanning twice for pre-write hint + baseline).
1589
1851
 
1590
1852
  ## [1.3.14] - 2026-03-25
1591
1853
 
1592
1854
  ### Added
1855
+
1593
1856
  - **Actionable feedback messages**: All real-time warnings now include specific guidance on what to do.
1594
1857
  - **Code entropy metric**: Shannon entropy in bits (threshold: >3.5 indicates risky AI-induced complexity).
1595
1858
  - **Advanced pattern matching**: `/lens-booboo` now finds structurally similar functions (e.g., `formatDate` and `formatTimestamp`).
@@ -1599,31 +1862,37 @@ Three new lint runners with full test coverage:
1599
1862
  ## [1.3.10] - 2026-03-25
1600
1863
 
1601
1864
  ### Added
1865
+
1602
1866
  - **Actionable complexity warnings**: Real-time feedback when metrics break limits with specific fix guidance.
1603
1867
 
1604
1868
  ## [1.3.9] - 2026-03-25
1605
1869
 
1606
1870
  ### Fixed
1871
+
1607
1872
  - **Entropy calculation**: Corrected to use bits with 3.5-bit threshold for AI-induced complexity.
1608
1873
 
1609
1874
  ## [1.3.8] - 2026-03-25
1610
1875
 
1611
1876
  ### Added
1877
+
1612
1878
  - **Code entropy metric**: Shannon entropy to detect repetitive or unpredictable code patterns.
1613
1879
 
1614
1880
  ## [1.3.7] - 2026-03-25
1615
1881
 
1616
1882
  ### Added
1883
+
1617
1884
  - **Advanced pattern matching in `/lens-booboo`**: Finds structurally similar functions across the codebase.
1618
1885
 
1619
1886
  ## [1.3.6] - 2026-03-25
1620
1887
 
1621
1888
  ### Added
1889
+
1622
1890
  - **Duplicate export detection on write**: Warns when defining a function that already exists elsewhere.
1623
1891
 
1624
1892
  ## [1.3.5] - 2026-03-25
1625
1893
 
1626
1894
  ### Changed
1895
+
1627
1896
  - **Consistent command prefix**: All commands now start with `lens-`.
1628
1897
  - `/find-todos` → `/lens-todos`
1629
1898
  - `/dead-code` → `/lens-dead-code`
@@ -1634,10 +1903,12 @@ Three new lint runners with full test coverage:
1634
1903
  ## [1.5.0] - 2026-03-23
1635
1904
 
1636
1905
  ### Added
1906
+
1637
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.
1638
1908
  - **`/lens-review` command**: Combined code review: design smells + complexity metrics in one command.
1639
1909
 
1640
1910
  ### Changed
1911
+
1641
1912
  - **Consistent command prefix**: All commands now start with `lens-`.
1642
1913
  - `/find-todos` → `/lens-todos`
1643
1914
  - `/dead-code` → `/lens-dead-code`
@@ -1648,6 +1919,7 @@ Three new lint runners with full test coverage:
1648
1919
  ## [1.4.0] - 2026-03-23
1649
1920
 
1650
1921
  ### Added
1922
+
1651
1923
  - **Test runner feedback**: Runs corresponding test file on every write (vitest, jest, pytest). Silent if no test file exists. Disable with `--no-tests`.
1652
1924
  - **Complexity metrics**: AST-based analysis: Maintainability Index, Cyclomatic/Cognitive Complexity, Halstead Volume, nesting depth, function length.
1653
1925
  - **`/lens-metrics` command**: Full project complexity scan.
@@ -1657,38 +1929,46 @@ Three new lint runners with full test coverage:
1657
1929
  - **Rust language support**: New Rust client for Rust projects.
1658
1930
 
1659
1931
  ### Changed
1932
+
1660
1933
  - **Improved ast-grep tool descriptions**: Better pattern guidance to prevent overly broad searches.
1661
1934
 
1662
1935
  ## [2.2.1] - 2026-03-29
1663
1936
 
1664
1937
  ### Fixed
1938
+
1665
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.
1666
1940
 
1667
1941
  ## [2.2.0] - 2026-03-29
1668
1942
 
1669
1943
  ### Added
1944
+
1670
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.
1671
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).
1672
1947
  - **Vitest config**: Increased test timeout to 15s for CLI spawn tests. Fixes flaky test failures when npx downloads packages.
1673
1948
 
1674
1949
  ### Fixed
1950
+
1675
1951
  - **Test flakiness**: Availability tests (biome, knip, jscpd) no longer timeout when npx is downloading packages.
1676
1952
 
1677
1953
  ## [1.3.0] - 2026-03-23
1678
1954
 
1679
1955
  ### Changed
1956
+
1680
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`.
1681
1958
 
1682
1959
  ### Added
1960
+
1683
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.
1684
1962
  - **Rule descriptions in diagnostics**: ast-grep violations now include the rule's message and note, making feedback more actionable for the agent.
1685
1963
 
1686
1964
  ### Changed
1965
+
1687
1966
  - **Reduced console noise**: Extension no longer prints to console by default. Enable with `--lens-verbose`.
1688
1967
 
1689
1968
  ## [1.2.0] - 2026-03-23
1690
1969
 
1691
1970
  ### Added
1971
+
1692
1972
  - GitHub repository link in npm package
1693
1973
 
1694
1974
  ## [1.1.2] - Previous