pi-lens 2.2.4 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -16,6 +16,72 @@ pi install git:github.com/apmantza/pi-lens
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
### On every write / edit
|
|
22
|
+
|
|
23
|
+
Every file write is automatically checked. Blocking issues appear inline:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
🔴 STOP — 1 issue(s) must be fixed:
|
|
27
|
+
L23: var total = sum(items); — use 'let' or 'const'
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Runners:** TypeScript type-checking, Python type-checking (pyright), linting (ruff, biome), secrets scan, architectural rules.
|
|
31
|
+
|
|
32
|
+
### Code quality scoring
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
/lens-rate
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
📊 CODE QUALITY SCORE: 85/100 (B)
|
|
40
|
+
┌─────────────────────────────────────────────────────────┐
|
|
41
|
+
│ 🔷 Type Safety 🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜ 85 │
|
|
42
|
+
│ 🧩 Complexity 🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜ 82 │
|
|
43
|
+
│ 🔒 Security 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100 │
|
|
44
|
+
│ 🏗️ Architecture 🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜ 80 │
|
|
45
|
+
│ 🗑️ Dead Code 🟩🟩🟩🟩🟩🟩🟩🟩🟩⬜ 90 │
|
|
46
|
+
│ ✅ Tests 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100 │
|
|
47
|
+
└─────────────────────────────────────────────────────────┘
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### On-demand commands
|
|
51
|
+
|
|
52
|
+
| Command | What it does |
|
|
53
|
+
|---------|--------------|
|
|
54
|
+
| `/lens-booboo` | Full codebase review (design smells, complexity, dead code, duplicates, type coverage) |
|
|
55
|
+
| `/lens-booboo-fix` | Automated mechanical fixes for lint issues |
|
|
56
|
+
| `/lens-booboo-refactor` | Interactive architectural refactoring |
|
|
57
|
+
| `/lens-rate` | Code quality score with visual breakdown |
|
|
58
|
+
| `/lens-metrics` | Complexity metrics for all files |
|
|
59
|
+
| `/lens-format` | Apply Biome formatting |
|
|
60
|
+
|
|
61
|
+
### Context-aware rules
|
|
62
|
+
|
|
63
|
+
Rules are automatically skipped for test files — no more `no-console-log` warnings in `*.test.ts`.
|
|
64
|
+
|
|
65
|
+
### Project rules integration
|
|
66
|
+
|
|
67
|
+
Scans for `.claude/rules/`, `.agents/rules/`, `CLAUDE.md`, `AGENTS.md` at session start. Project-specific rules are surfaced in the system prompt.
|
|
68
|
+
|
|
69
|
+
### Secret scanning
|
|
70
|
+
|
|
71
|
+
Catches secrets in ANY file type on write/edit — `.env`, `.yaml`, `.json`, not just TypeScript:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
🔴 STOP — 1 potential secret(s) in src/config.ts:
|
|
75
|
+
L12: Possible Stripe or OpenAI API key (sk-*)
|
|
76
|
+
→ Remove before continuing. Use env vars instead.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Delta-mode feedback
|
|
80
|
+
|
|
81
|
+
First edit: full feedback. Subsequent edits: only NEW issues. Pre-existing issues are tracked and excluded from inline output.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
19
85
|
## Dependent Tools
|
|
20
86
|
|
|
21
87
|
pi-lens works out of the box for TypeScript/JavaScript. For full language support, install these tools — **all are optional and gracefully skip if not installed**:
|
|
@@ -54,395 +120,400 @@ pi-lens works out of the box for TypeScript/JavaScript. For full language suppor
|
|
|
54
120
|
|------|---------|--------------|
|
|
55
121
|
| `@ast-grep/cli` | `npm i -D @ast-grep/cli` | Structural pattern matching (80+ rules) |
|
|
56
122
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# TypeScript tooling
|
|
61
|
-
npm i -D @biomejs/biome knip jscpd type-coverage
|
|
123
|
+
---
|
|
62
124
|
|
|
63
|
-
|
|
64
|
-
pip install ruff pyright
|
|
65
|
-
```
|
|
125
|
+
## Flags
|
|
66
126
|
|
|
67
|
-
|
|
127
|
+
| Flag | Description |
|
|
128
|
+
|------|-------------|
|
|
129
|
+
| `--lens-verbose` | Enable console logging |
|
|
130
|
+
| `--autofix-biome` | Auto-fix lint issues with Biome |
|
|
68
131
|
|
|
69
132
|
---
|
|
70
133
|
|
|
71
|
-
##
|
|
134
|
+
## Rules
|
|
72
135
|
|
|
73
|
-
|
|
136
|
+
pi-lens includes 80+ ast-grep rules for:
|
|
74
137
|
|
|
75
|
-
|
|
138
|
+
## ast-grep rules
|
|
76
139
|
|
|
77
|
-
|
|
78
|
-
┌─────────────────────────────────────────────────────────┐
|
|
79
|
-
│ 📊 CODE QUALITY SCORE: 85/100 (B) │
|
|
80
|
-
├─────────────────────────────────────────────────────────┤
|
|
81
|
-
│ 🔷 Type Safety 🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜ 85 │
|
|
82
|
-
│ 🧩 Complexity 🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜ 82 │
|
|
83
|
-
│ 🔒 Security 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100 │
|
|
84
|
-
│ 🏗️ Architecture 🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜ 80 │
|
|
85
|
-
│ 🗑️ Dead Code 🟩🟩🟩🟩🟩🟩🟩🟩🟩⬜ 90 │
|
|
86
|
-
│ ✅ Tests 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100 │
|
|
87
|
-
└─────────────────────────────────────────────────────────┘
|
|
88
|
-
```
|
|
140
|
+
Rules live in `rules/ast-grep-rules/rules/`. All rules are YAML files you can edit or extend.
|
|
89
141
|
|
|
90
|
-
|
|
142
|
+
Each rule includes a `message` and `note` that are shown in diagnostics, so the agent understands why something violated a rule and how to fix it.
|
|
91
143
|
|
|
92
|
-
|
|
144
|
+
**Security**
|
|
145
|
+
`no-eval`, `no-implied-eval`, `no-hardcoded-secrets`, `no-insecure-randomness`, `no-open-redirect`, `no-sql-in-code`, `no-inner-html`, `no-dangerously-set-inner-html`, `no-javascript-url`
|
|
93
146
|
|
|
94
|
-
|
|
147
|
+
**TypeScript**
|
|
148
|
+
`no-any-type`, `no-as-any`, `no-non-null-assertion`
|
|
95
149
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def add(x: int, y: int) -> int:
|
|
99
|
-
return x + y
|
|
150
|
+
**Style** (Biome handles `no-var`, `prefer-const`, `prefer-template`, `no-useless-concat` natively)
|
|
151
|
+
`prefer-nullish-coalescing`, `prefer-optional-chain`, `nested-ternary`, `no-lonely-if`
|
|
100
152
|
|
|
101
|
-
|
|
102
|
-
|
|
153
|
+
**Correctness**
|
|
154
|
+
`no-debugger`, `no-throw-string`, `no-return-await`, `no-await-in-loop`, `no-await-in-promise-all`, `require-await`, `empty-catch`, `strict-equality`, `strict-inequality`
|
|
103
155
|
|
|
104
|
-
|
|
156
|
+
**Patterns**
|
|
157
|
+
`no-console-log`, `no-alert`, `no-delete-operator`, `no-shadow`, `no-star-imports`, `switch-needs-default`, `switch-without-default`
|
|
105
158
|
|
|
106
|
-
|
|
159
|
+
**Type Safety** (type-aware checks via `type-safety-client.ts`)
|
|
160
|
+
`switch-exhaustiveness` — detects missing cases in union type switches (inline blocker)
|
|
107
161
|
|
|
108
|
-
|
|
162
|
+
**Design Smells**
|
|
163
|
+
`long-method`, `long-parameter-list`, `large-class`
|
|
109
164
|
|
|
110
|
-
|
|
165
|
+
**AI Slop Detection**
|
|
166
|
+
`no-param-reassign`, `no-single-char-var`, `no-process-env`, `no-architecture-violation`
|
|
111
167
|
|
|
112
|
-
|
|
168
|
+
---
|
|
113
169
|
|
|
114
|
-
|
|
115
|
-
🔴 STOP — 1 potential secret(s) in src/config.ts:
|
|
116
|
-
L12: Possible Stripe or OpenAI API key (sk-*)
|
|
117
|
-
→ Remove before continuing. Use env vars instead.
|
|
118
|
-
```
|
|
170
|
+
## TypeScript LSP — tsconfig detection
|
|
119
171
|
|
|
120
|
-
|
|
172
|
+
The LSP walks up from the edited file's directory until it finds a `tsconfig.json`. If found, it uses that project's exact `compilerOptions` (paths, strict settings, lib, etc.). If not found, it falls back to sensible defaults:
|
|
121
173
|
|
|
122
|
-
|
|
174
|
+
- `target: ES2020`
|
|
175
|
+
- `lib: ["es2020", "dom", "dom.iterable"]`
|
|
176
|
+
- `moduleResolution: bundler`
|
|
177
|
+
- `strict: true`
|
|
123
178
|
|
|
124
|
-
|
|
179
|
+
The compiler options are refreshed automatically when you switch between projects within a session.
|
|
125
180
|
|
|
126
|
-
|
|
127
|
-
🔴 STOP — 2 issue(s) must fixed:
|
|
128
|
-
L23: var total = sum(items); — use 'let' or 'const'
|
|
129
|
-
```
|
|
181
|
+
---
|
|
130
182
|
|
|
131
|
-
Warnings are tracked and surfaced via `/lens-booboo`. booboo-fix and booboo-refactor output compacted to summaries with TSV files for full details.
|
|
132
183
|
|
|
133
|
-
|
|
184
|
+
---
|
|
134
185
|
|
|
135
|
-
|
|
186
|
+
## Changelog
|
|
136
187
|
|
|
137
|
-
---
|
|
138
188
|
|
|
139
|
-
##
|
|
189
|
+
## [2.1.1] - 2026-03-29
|
|
140
190
|
|
|
141
|
-
###
|
|
191
|
+
### Added
|
|
192
|
+
- **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.
|
|
193
|
+
- **Project rules integration**: Scans for `.claude/rules/`, `.agents/rules/`, `CLAUDE.md`, `AGENTS.md` at session start and surfaces in system prompt.
|
|
194
|
+
- **Grep-ability rules**: New ast-grep rules for `no-default-export` and `no-relative-cross-package-import` to improve agent searchability.
|
|
142
195
|
|
|
143
|
-
|
|
196
|
+
### Changed
|
|
197
|
+
- **Inline feedback stripped to blocking only**: Warnings no longer shown inline (noise). Only blocking violations and test failures interrupt the agent.
|
|
198
|
+
- **booboo-fix output compacted**: Summary in terminal, full plan in `.pi-lens/reports/fix-plan.tsv`.
|
|
199
|
+
- **booboo-refactor output compacted**: Top 5 worst offenders in terminal, full ranked list in `.pi-lens/reports/refactor-ranked.tsv`.
|
|
200
|
+
- **`ast_grep_search` new params**: Added `selector` (extract specific AST node) and `context` (show surrounding lines).
|
|
201
|
+
- **`ast_grep_replace` mode indicator**: Shows `[DRY-RUN]` or `[APPLIED]` prefix.
|
|
202
|
+
- **no-hardcoded-secrets**: Fixed to only flag actual hardcoded strings (not `process.env` assignments).
|
|
203
|
+
- **no-process-env**: Now only flags secret-related env vars (not PORT, NODE_ENV, etc.).
|
|
204
|
+
- **Removed Factory AI article reference** from architect.yaml.
|
|
144
205
|
|
|
145
|
-
|
|
146
|
-
file → detectFileKind() → getRunnersForKind() → run all runners → aggregate output
|
|
147
|
-
```
|
|
206
|
+
## [2.0.40] - 2026-03-27
|
|
148
207
|
|
|
149
|
-
|
|
150
|
-
- **
|
|
151
|
-
- **
|
|
152
|
-
- **Delta mode built-in**: Each runner supports baseline tracking to show only *new* violations
|
|
153
|
-
- **Conditional execution**: Runners can have `when` conditions (e.g., only run when `--autofix` is enabled)
|
|
208
|
+
### Changed
|
|
209
|
+
- **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.
|
|
210
|
+
- **Skip duplicate snapshots**: Same commit + same MI = no write (reduces noise).
|
|
154
211
|
|
|
155
|
-
|
|
212
|
+
## [2.0.39] - 2026-03-27
|
|
156
213
|
|
|
157
|
-
###
|
|
214
|
+
### Added
|
|
215
|
+
- **Historical metrics tracking**: New `clients/metrics-history.ts` module captures complexity snapshots per commit. Tracks MI, cognitive complexity, and nesting depth across sessions.
|
|
216
|
+
- **Trend analysis in `/lens-metrics`**: New "Trend" column shows 📈/📉/➡️ with MI delta. "Trend Summary" section aggregates improving/stable/regressing counts with worst regressions.
|
|
217
|
+
- **Passive capture**: Snapshots captured on every file edit (tool_call hook) + `/lens-metrics` run. Max 20 snapshots per file (sliding window).
|
|
158
218
|
|
|
159
|
-
|
|
219
|
+
## [2.0.38] - 2026-03-27
|
|
160
220
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
└─ Export scanning (async, for duplicate export detection)
|
|
168
|
-
```
|
|
221
|
+
### Changed
|
|
222
|
+
- **Refactored 4 client files** via `/lens-booboo-refactor` loop:
|
|
223
|
+
- `biome-client.ts`: Extracted `withValidatedPath()` guard pattern (4 methods consolidated)
|
|
224
|
+
- `complexity-client.ts`: Extracted `analyzeFile()` pipeline into `readAndParse()`, `computeMetrics()`, `aggregateFunctionStats()`
|
|
225
|
+
- `dependency-checker.ts`: Simplified `importsChanged()` — replaced 3 for-loops with `setsEqual()` helper
|
|
226
|
+
- `ast-grep-client.ts`: Simplified `groupSimilarFunctions()` with `filter().map()` pattern + `extractFunctionName()` helper
|
|
169
227
|
|
|
170
|
-
|
|
228
|
+
## [2.0.29] - 2026-03-26
|
|
171
229
|
|
|
172
|
-
###
|
|
230
|
+
### Added
|
|
231
|
+
- **`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.
|
|
173
232
|
|
|
174
|
-
|
|
233
|
+
### Removed
|
|
234
|
+
- **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.
|
|
235
|
+
- **`prefer-const` from RULE_ACTIONS** — no longer needed (Biome handles directly).
|
|
175
236
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
content: [...event.content, { type: "text", text: lspOutput }],
|
|
180
|
-
};
|
|
181
|
-
```
|
|
237
|
+
### Changed
|
|
238
|
+
- **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).
|
|
182
239
|
|
|
183
|
-
|
|
184
|
-
| Prefix | Meaning |
|
|
185
|
-
|--------|---------|
|
|
186
|
-
| 🔴 | Blocking error — must fix before continuing |
|
|
187
|
-
| 🟡 | Warning — should fix, but not blocking |
|
|
188
|
-
| ✅ | Auto-fixed issue — no action needed |
|
|
189
|
-
| 📊 | Silent metric — tracked but not shown |
|
|
190
|
-
| 📐 | Architectural rule — reference only |
|
|
240
|
+
## [2.0.27] - 2026-03-26
|
|
191
241
|
|
|
192
|
-
###
|
|
242
|
+
### Added
|
|
243
|
+
- **`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'`.
|
|
244
|
+
- **`clients/type-safety-client.ts`**: New client for type safety checks. Extensible for future checks (null safety, exhaustive type guards).
|
|
193
245
|
|
|
194
|
-
|
|
246
|
+
### Changed
|
|
247
|
+
- **Type safety violations added to inline feedback**: Missing switch cases now block the agent mid-task, same as TypeScript errors.
|
|
248
|
+
- **Type safety violations in `/lens-booboo-fix`**: Marked as agent-fixable (add missing case or default clause).
|
|
195
249
|
|
|
196
|
-
|
|
197
|
-
const kind = detectFileKind(filePath); // "jsts" | "python" | "go" | "rust" | ...
|
|
198
|
-
const runners = getRunnersForKind(kind); // All applicable runners
|
|
199
|
-
```
|
|
250
|
+
## [2.0.26] - 2026-03-26
|
|
200
251
|
|
|
201
|
-
###
|
|
252
|
+
### Added
|
|
253
|
+
- **5 new ast-grep rules** for AI slop detection:
|
|
254
|
+
- `no-process-env`: Block direct `process.env` access (use DI or config module) — error level
|
|
255
|
+
- `no-param-reassign`: Detect function parameter reassignment — warning level
|
|
256
|
+
- `no-single-char-var`: Flag single-character variable names — info level
|
|
257
|
+
- `switch-without-default`: Ensure switch statements have default case — warning level
|
|
258
|
+
- `no-architecture-violation`: Block cross-layer imports (models/db) — error level
|
|
202
259
|
|
|
203
|
-
|
|
260
|
+
### Changed
|
|
261
|
+
- **RULE_ACTIONS updated** for new rules:
|
|
262
|
+
- `agent` type (inline + booboo-fix): `no-param-reassign`, `switch-without-default`, `switch-exhaustiveness`
|
|
263
|
+
- `skip` type (booboo-refactor only): `no-process-env`, `no-single-char-var`, `no-architecture-violation`
|
|
204
264
|
|
|
205
|
-
|
|
265
|
+
## [2.0.24] - 2026-03-26
|
|
206
266
|
|
|
207
|
-
|
|
267
|
+
### Changed
|
|
268
|
+
- **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.
|
|
269
|
+
- **Confirmation screen**: "✅ Looks good — move to next offender" / "💬 Request changes" (chat textarea). Diff display is optional.
|
|
208
270
|
|
|
209
|
-
##
|
|
271
|
+
## [2.0.23] - 2026-03-26
|
|
210
272
|
|
|
211
|
-
###
|
|
273
|
+
### Changed
|
|
274
|
+
- **Extracted interviewer and scan modules from `index.ts`**: `index.ts` reduced by 460 lines.
|
|
275
|
+
- `clients/interviewer.ts` — all browser interview infrastructure (HTML generation, HTTP server, browser launch, option selection, diff confirmation screen)
|
|
276
|
+
- `clients/scan-architectural-debt.ts` — shared scanning utilities (`scanSkipViolations`, `scanComplexityMetrics`, `scoreFiles`, `extractCodeSnippet`)
|
|
277
|
+
- **`/lens-booboo-refactor`** now uses imported scan functions instead of duplicated inline code.
|
|
212
278
|
|
|
213
|
-
|
|
214
|
-
|---|---|
|
|
215
|
-
| **TypeScript LSP** | Type errors and warnings, using the project's `tsconfig.json` (walks up from the file to find it; falls back to `ES2020 + DOM` defaults) |
|
|
216
|
-
| **ast-grep** | 60+ structural rules: `no-var`, `no-eval`, `no-debugger`, `no-as-any`, `prefer-template`, `no-throw-string`, `no-hardcoded-secrets`, `no-return-await`, nested ternaries, strict equality, and more |
|
|
217
|
-
| **Biome** | Lint + format for JS/TS/JSX/TSX/CSS/JSON. Auto-fix disabled by default, use `/lens-format` to apply |
|
|
218
|
-
| **Ruff** | Lint + format for Python. Auto-fixes on every write by default |
|
|
219
|
-
| **Test Runner** | Runs corresponding test file when you edit source code (vitest, jest, pytest). Silent if no test file exists. |
|
|
220
|
-
| **jscpd** | Code duplication detection. Warns when editing a file that has duplicates with other files in the project. |
|
|
221
|
-
| **Duplicate Exports** | Detects when you redefine a function that already exists elsewhere in the codebase. |
|
|
279
|
+
## [2.0.22] - 2026-03-26
|
|
222
280
|
|
|
223
|
-
###
|
|
281
|
+
### Added
|
|
282
|
+
- **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.
|
|
283
|
+
- **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.
|
|
284
|
+
- **Auto-close on confirm**: Browser tab closes automatically after user submits.
|
|
224
285
|
|
|
225
|
-
|
|
286
|
+
## [2.0.21] - 2026-03-26
|
|
226
287
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
288
|
+
### Added
|
|
289
|
+
- **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.
|
|
290
|
+
- **Plan + diff confirmation screen**: Plan rendered as styled markdown, diff rendered with syntax-colored `+`/`-` lines. Line counts (`+N / −N`) shown in diff header.
|
|
230
291
|
|
|
231
|
-
|
|
232
|
-
no-var: Use 'const' or 'let' instead of 'var' (L23)
|
|
233
|
-
→ var has function scope and can lead to unexpected hoisting behavior.
|
|
234
|
-
→ Auto-fixable: check the hints above
|
|
292
|
+
## [2.0.20] - 2026-03-26
|
|
235
293
|
|
|
236
|
-
|
|
294
|
+
### Added
|
|
295
|
+
- **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.
|
|
237
296
|
|
|
238
|
-
|
|
239
|
-
L23:5 [style/useConst] This let declares a variable that is only assigned once.
|
|
240
|
-
→ Auto-fixable: `npx @biomejs/biome check --write utils.ts`
|
|
297
|
+
## [2.0.19] - 2026-03-26
|
|
241
298
|
|
|
242
|
-
|
|
243
|
-
|
|
299
|
+
### Changed
|
|
300
|
+
- **`/lens-booboo-fix` jscpd filter**: Only within-file duplicates shown in actionable section. Cross-file duplicates are architectural — shown in skip section only.
|
|
301
|
+
- **AI slop filter tightened**: Require 2+ signals per file (was 1+). Single-issue flags on small files are noise — skip them.
|
|
244
302
|
|
|
245
|
-
|
|
246
|
-
formatDate (already in helpers.ts)
|
|
247
|
-
→ Import the existing function instead
|
|
303
|
+
## [2.0.18] - 2026-03-26
|
|
248
304
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
→ Fix failing tests before proceeding
|
|
252
|
-
```
|
|
305
|
+
### Fixed
|
|
306
|
+
- **`/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.
|
|
253
307
|
|
|
254
|
-
|
|
308
|
+
## [2.0.17] - 2026-03-26
|
|
255
309
|
|
|
256
|
-
|
|
310
|
+
### Changed
|
|
311
|
+
- **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.
|
|
312
|
+
- **`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`.
|
|
257
313
|
|
|
258
|
-
|
|
259
|
-
⚠ Pre-write: file already has 5 TypeScript error(s) — fix before adding more
|
|
260
|
-
```
|
|
314
|
+
## [2.0.16] - 2026-03-26
|
|
261
315
|
|
|
262
|
-
###
|
|
316
|
+
### Added
|
|
317
|
+
- **`/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.
|
|
263
318
|
|
|
264
|
-
|
|
319
|
+
### Changed
|
|
320
|
+
- **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.
|
|
265
321
|
|
|
266
|
-
|
|
267
|
-
|---|---|
|
|
268
|
-
| **TODO scanner** | `/lens-booboo` reports |
|
|
269
|
-
| **Knip** | Dead code detection in `/lens-booboo` and `/lens-booboo-fix` |
|
|
270
|
-
| **jscpd** | Duplicate detection on write; `/lens-booboo` reports |
|
|
271
|
-
| **type-coverage** | `/lens-booboo` reports |
|
|
272
|
-
| **Complexity baselines** | Regressed/improved delta tracking via `/lens-metrics` |
|
|
273
|
-
| **Project rules** | Scans for `.claude/rules/`, `.agents/rules/`, `CLAUDE.md`, `AGENTS.md` |
|
|
322
|
+
## [2.0.15] - 2026-03-26
|
|
274
323
|
|
|
275
|
-
###
|
|
324
|
+
### Removed
|
|
325
|
+
- **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`.
|
|
326
|
+
- **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.
|
|
327
|
+
- **`/lens-todos`**: Removed (covered by `/lens-booboo`).
|
|
328
|
+
- **`/lens-dead-code`**: Removed (covered by `/lens-booboo`).
|
|
329
|
+
- **`/lens-deps`**: Removed — circular dep scan added to `/lens-booboo` as Part 8.
|
|
276
330
|
|
|
277
|
-
|
|
331
|
+
### Changed
|
|
332
|
+
- **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.
|
|
333
|
+
- **`/lens-booboo` now includes circular dependencies**: Added as Part 8 (after type coverage) using `depChecker.scanProject`.
|
|
278
334
|
|
|
279
|
-
|
|
280
|
-
📋 Project rules found: 2 file(s) in .claude/rules, root. These apply alongside pi-lens defaults.
|
|
281
|
-
```
|
|
335
|
+
## [2.0.14] - 2026-03-26
|
|
282
336
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
| `CLAUDE.md` | Claude Code project context |
|
|
289
|
-
| `AGENTS.md` | Generic agent context |
|
|
337
|
+
### Fixed
|
|
338
|
+
- **`/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.
|
|
339
|
+
- **`raw-strings` rule added to skip list**: 230 false positives in CLI/tooling codebases.
|
|
340
|
+
- **`typescript-client.ts` duplication**: Extracted `resolvePosition()`, `resolveTree()`, and `toLocations()` helpers, deduplicating 6+ LSP methods.
|
|
341
|
+
- **All clients**: `console.log` → `console.error` in verbose loggers (stderr for debug, stdout for data).
|
|
290
342
|
|
|
291
|
-
|
|
343
|
+
## [2.0.13] - 2026-03-26
|
|
292
344
|
|
|
293
|
-
###
|
|
345
|
+
### Removed
|
|
346
|
+
- **`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.
|
|
294
347
|
|
|
295
|
-
|
|
296
|
-
|---|---|
|
|
297
|
-
| `/lens-booboo [path]` | Full code review: TODOs, dead code, duplicates, type coverage, circular dependencies. Saves full report to `.pi-lens/reviews/` |
|
|
298
|
-
| `/lens-booboo-fix [path]` | Iterative automated fix loop. Runs Biome/Ruff autofix, then scans for fixable issues (ast-grep agent rules, dead code). Generates a fix plan for the agent to execute. Re-run for up to 3 iterations, then reset. |
|
|
299
|
-
| `/lens-booboo-refactor [path]` | Interactive architectural refactor. Scans for worst offender by combined debt score (ast-grep skip rules + complexity metrics). Opens a browser interview with impact metrics — agent proposes refactoring options with rationale, user picks one, agent implements and shows a post-change report. |
|
|
300
|
-
| `/lens-format [file\|--all]` | Apply Biome formatting |
|
|
301
|
-
| `/lens-metrics [path]` | Measure complexity metrics for all files. Exports `report.md` with grades (A-F), summary stats, top 10 worst files, and **historical trends** (📈📉 per file) |
|
|
348
|
+
## [2.0.12] - 2026-03-26
|
|
302
349
|
|
|
303
|
-
###
|
|
350
|
+
### Fixed
|
|
351
|
+
- **`/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.
|
|
304
352
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
| **`ast_grep_search`** | Search code patterns using AST-aware matching. Supports meta-variables: `$VAR` (single node), `$$$` (multiple). Optional: `selector` (extract specific AST node), `context` (show surrounding lines). Example: `console.log($MSG)` |
|
|
308
|
-
| **`ast_grep_replace`** | Replace code patterns with AST-aware rewriting. Dry-run by default, use `apply=true` to apply changes. Example: `pattern='console.log($MSG)' rewrite='logger.info($MSG)'` |
|
|
353
|
+
### Changed
|
|
354
|
+
- **Remaining Biome section rephrased**: "These couldn't be auto-fixed even with `--unsafe` — fix each manually."
|
|
309
355
|
|
|
310
|
-
|
|
356
|
+
## [2.0.11] - 2026-03-26
|
|
311
357
|
|
|
312
|
-
|
|
358
|
+
### Added
|
|
359
|
+
- **Circular dependency scan to `/lens-booboo`**: Added as Part 8, using `depChecker.scanProject()` to detect circular chains across the codebase.
|
|
313
360
|
|
|
314
|
-
|
|
361
|
+
### Removed
|
|
362
|
+
- **`/lens-todos`**, **`/lens-dead-code`**, **`/lens-deps`**: Removed standalone commands — all covered by `/lens-booboo`.
|
|
315
363
|
|
|
316
|
-
|
|
317
|
-
# Core (required for JS/TS feedback)
|
|
318
|
-
npm install -D @biomejs/biome @ast-grep/cli
|
|
364
|
+
## [2.0.10] - 2026-03-26
|
|
319
365
|
|
|
320
|
-
|
|
321
|
-
|
|
366
|
+
### Changed
|
|
367
|
+
- **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).
|
|
322
368
|
|
|
323
|
-
|
|
324
|
-
npm install -D madge
|
|
369
|
+
## [2.0.1] - 2026-03-25
|
|
325
370
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
371
|
+
### Fixed
|
|
372
|
+
- **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.
|
|
373
|
+
- **Renamed "Design Smells" to "ast-grep"** in booboo report — the scan runs all 65 rules (security, correctness, style, design), not just design smells.
|
|
329
374
|
|
|
330
|
-
|
|
375
|
+
### Changed
|
|
376
|
+
- **Stronger real-time feedback messages** — all messages now use severity emoji and imperative language:
|
|
377
|
+
- `🔴 Fix N TypeScript error(s) — these must be resolved`
|
|
378
|
+
- `🧹 Remove N unused import(s) — they are dead code`
|
|
379
|
+
- `🔴 You introduced N new structural violation(s) — fix before moving on`
|
|
380
|
+
- `🟠 You introduced N new Biome violation(s) — fix before moving on`
|
|
381
|
+
- `🟡 Complexity issues — refactor when you get a chance`
|
|
382
|
+
- `🟠 This file has N duplicate block(s) — extract to shared utilities`
|
|
383
|
+
- `🔴 Do not redefine — N function(s) already exist elsewhere`
|
|
384
|
+
- **Biome fix command is now a real bash command** — `npx @biomejs/biome check --write <file>` instead of `/lens-format` (which is a pi UI command, not runnable from agent tools).
|
|
385
|
+
- **Complexity warnings skip test files in real-time** — same exclusion as lens-booboo.
|
|
331
386
|
|
|
332
|
-
##
|
|
387
|
+
## [2.0.0] - 2026-03-25
|
|
333
388
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
| `--no-go` | `false` | Disable Go linting |
|
|
345
|
-
| `--no-rust` | `false` | Disable Rust linting |
|
|
346
|
-
| `--lens-verbose` | `false` | Enable verbose logging |
|
|
389
|
+
### Added
|
|
390
|
+
- **`/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.
|
|
391
|
+
- **`/lens-booboo` saves full report**: Results saved to `.pi-lens/reviews/booboo-<timestamp>.md` — no truncation, all issues, agent-readable.
|
|
392
|
+
- **AI slop indicators**: Four new real-time and report-based detectors:
|
|
393
|
+
- `AI-style comments` — emoji and boilerplate comment phrases
|
|
394
|
+
- `Many try/catch blocks` — lazy error handling pattern
|
|
395
|
+
- `Over-abstraction` — single-use helper functions
|
|
396
|
+
- `Long parameter list` — functions with > 6 params
|
|
397
|
+
- **`SubprocessClient` base class**: Shared foundation for CLI tool clients (availability check, logging, command execution).
|
|
398
|
+
- **Shared test utilities**: `createTempFile` and `setupTestEnvironment` extracted to `clients/test-utils.ts`, eliminating copy-paste across 13 test files.
|
|
347
399
|
|
|
348
|
-
|
|
400
|
+
### Changed
|
|
401
|
+
- **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.
|
|
402
|
+
- **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).
|
|
403
|
+
- **Test files excluded from AI slop warnings**: MI/complexity thresholds are inherently low in test files — warnings suppressed for `*.test.ts` / `*.spec.ts`.
|
|
404
|
+
- **Test files excluded from TODO scanner**: Test fixture annotations (`FIXME`, `BUG`, etc.) no longer appear in TODO reports.
|
|
405
|
+
- **ast-grep excludes test files and `.pi-lens/`**: Design smell scan in `/lens-booboo` skips test files (no magic-numbers noise) and internal review reports.
|
|
406
|
+
- **jscpd excludes non-code files**: `.md`, `.json`, `.yaml`, `.yml`, `.toml`, `.lock`, and `.pi-lens/` excluded from duplicate detection — no more false positives from report files.
|
|
407
|
+
- **Removed unused dependencies**: `vscode-languageserver-protocol` and `vscode-languageserver-types` removed; `@sinclair/typebox` added (was unlisted).
|
|
349
408
|
|
|
350
|
-
|
|
409
|
+
### Fixed
|
|
410
|
+
- Removed 3 unconditional `console.log` calls leaking `[scan_exports]` to terminal.
|
|
411
|
+
- Duplicate Biome scan in `tool_call` hook eliminated (was scanning twice for pre-write hint + baseline).
|
|
351
412
|
|
|
352
|
-
|
|
413
|
+
## [1.3.14] - 2026-03-25
|
|
353
414
|
|
|
354
|
-
|
|
415
|
+
### Added
|
|
416
|
+
- **Actionable feedback messages**: All real-time warnings now include specific guidance on what to do.
|
|
417
|
+
- **Code entropy metric**: Shannon entropy in bits (threshold: >3.5 indicates risky AI-induced complexity).
|
|
418
|
+
- **Advanced pattern matching**: `/lens-booboo` now finds structurally similar functions (e.g., `formatDate` and `formatTimestamp`).
|
|
419
|
+
- **Duplicate export detection**: Warns when redefining a function that already exists in the codebase.
|
|
420
|
+
- **Biome formatting noise removed**: Only lint issues shown in real-time; use `/lens-format` for formatting.
|
|
355
421
|
|
|
356
|
-
1.
|
|
357
|
-
2. **jscpd** — within-file duplicate blocks (extract to shared utilities)
|
|
358
|
-
3. **Knip** — dead code (delete unused exports/files)
|
|
359
|
-
4. **ast-grep** — structural violations on surviving code (agent fixes)
|
|
360
|
-
5. **AI slop** — files with 2+ complexity signals
|
|
361
|
-
6. **Remaining Biome** — issues that couldn't be auto-fixed even with `--unsafe`
|
|
422
|
+
## [1.3.10] - 2026-03-25
|
|
362
423
|
|
|
363
|
-
|
|
424
|
+
### Added
|
|
425
|
+
- **Actionable complexity warnings**: Real-time feedback when metrics break limits with specific fix guidance.
|
|
364
426
|
|
|
365
|
-
|
|
366
|
-
📋 BOOBOO FIX PLAN — Iteration 1/3 (44 fixable items remaining)
|
|
367
|
-
✅ Fixed 249 issues since last iteration.
|
|
427
|
+
## [1.3.9] - 2026-03-25
|
|
368
428
|
|
|
369
|
-
|
|
429
|
+
### Fixed
|
|
430
|
+
- **Entropy calculation**: Corrected to use bits with 3.5-bit threshold for AI-induced complexity.
|
|
370
431
|
|
|
371
|
-
##
|
|
432
|
+
## [1.3.8] - 2026-03-25
|
|
372
433
|
|
|
373
|
-
###
|
|
374
|
-
|
|
375
|
-
- `clients/ruff-client.ts:47`
|
|
376
|
-
- `clients/biome-client.ts:48`
|
|
377
|
-
...
|
|
434
|
+
### Added
|
|
435
|
+
- **Code entropy metric**: Shannon entropy to detect repetitive or unpredictable code patterns.
|
|
378
436
|
|
|
379
|
-
##
|
|
380
|
-
- **long-method** (79): Extraction requires understanding the function's purpose.
|
|
381
|
-
- **large-class** (16): Splitting a class requires architectural decisions.
|
|
382
|
-
```
|
|
437
|
+
## [1.3.7] - 2026-03-25
|
|
383
438
|
|
|
384
|
-
###
|
|
439
|
+
### Added
|
|
440
|
+
- **Advanced pattern matching in `/lens-booboo`**: Finds structurally similar functions across the codebase.
|
|
385
441
|
|
|
386
|
-
|
|
442
|
+
## [1.3.6] - 2026-03-25
|
|
387
443
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
2. **Post-change report** — after implementing, agent shows what changed (git diff + line counts) and how metrics evolved. User can say "looks good" or request changes via chat.
|
|
444
|
+
### Added
|
|
445
|
+
- **Duplicate export detection on write**: Warns when defining a function that already exists elsewhere.
|
|
391
446
|
|
|
392
|
-
|
|
393
|
-
🏗️ BOOBOO REFACTOR — worst offender identified
|
|
447
|
+
## [1.3.5] - 2026-03-25
|
|
394
448
|
|
|
395
|
-
|
|
396
|
-
|
|
449
|
+
### Changed
|
|
450
|
+
- **Consistent command prefix**: All commands now start with `lens-`.
|
|
451
|
+
- `/find-todos` → `/lens-todos`
|
|
452
|
+
- `/dead-code` → `/lens-dead-code`
|
|
453
|
+
- `/check-deps` → `/lens-deps`
|
|
454
|
+
- `/format` → `/lens-format`
|
|
455
|
+
- `/design-review` + `/lens-metrics` → `/lens-booboo`
|
|
397
456
|
|
|
398
|
-
|
|
399
|
-
- long-method (×18)
|
|
400
|
-
- long-parameter-list (×6)
|
|
401
|
-
```
|
|
457
|
+
## [1.5.0] - 2026-03-23
|
|
402
458
|
|
|
403
|
-
|
|
459
|
+
### Added
|
|
460
|
+
- **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.
|
|
461
|
+
- **`/lens-review` command**: Combined code review: design smells + complexity metrics in one command.
|
|
404
462
|
|
|
405
|
-
|
|
463
|
+
### Changed
|
|
464
|
+
- **Consistent command prefix**: All commands now start with `lens-`.
|
|
465
|
+
- `/find-todos` → `/lens-todos`
|
|
466
|
+
- `/dead-code` → `/lens-dead-code`
|
|
467
|
+
- `/check-deps` → `/lens-deps`
|
|
468
|
+
- `/format` → `/lens-format`
|
|
469
|
+
- `/design-review` + `/lens-metrics` → `/lens-review`
|
|
406
470
|
|
|
407
|
-
##
|
|
471
|
+
## [1.4.0] - 2026-03-23
|
|
408
472
|
|
|
409
|
-
|
|
473
|
+
### Added
|
|
474
|
+
- **Test runner feedback**: Runs corresponding test file on every write (vitest, jest, pytest). Silent if no test file exists. Disable with `--no-tests`.
|
|
475
|
+
- **Complexity metrics**: AST-based analysis: Maintainability Index, Cyclomatic/Cognitive Complexity, Halstead Volume, nesting depth, function length.
|
|
476
|
+
- **`/lens-metrics` command**: Full project complexity scan.
|
|
477
|
+
- **Design smell rules**: New `long-method`, `long-parameter-list`, and `large-class` rules for structural quality checks.
|
|
478
|
+
- **`/design-review` command**: Analyze files for design smells. Usage: `/design-review [path]`
|
|
479
|
+
- **Go language support**: New Go client for Go projects.
|
|
480
|
+
- **Rust language support**: New Rust client for Rust projects.
|
|
410
481
|
|
|
411
|
-
|
|
482
|
+
### Changed
|
|
483
|
+
- **Improved ast-grep tool descriptions**: Better pattern guidance to prevent overly broad searches.
|
|
412
484
|
|
|
413
|
-
|
|
414
|
-
`no-eval`, `no-implied-eval`, `no-hardcoded-secrets`, `no-insecure-randomness`, `no-open-redirect`, `no-sql-in-code`, `no-inner-html`, `no-dangerously-set-inner-html`, `no-javascript-url`
|
|
485
|
+
## [2.2.1] - 2026-03-29
|
|
415
486
|
|
|
416
|
-
|
|
417
|
-
|
|
487
|
+
### Fixed
|
|
488
|
+
- **No auto-install**: Runners (biome, pyright) now use direct CLI commands instead of `npx`. If not installed, gracefully skip instead of attempting to download.
|
|
418
489
|
|
|
419
|
-
|
|
420
|
-
`prefer-nullish-coalescing`, `prefer-optional-chain`, `nested-ternary`, `no-lonely-if`
|
|
490
|
+
## [2.2.0] - 2026-03-29
|
|
421
491
|
|
|
422
|
-
|
|
423
|
-
|
|
492
|
+
### Added
|
|
493
|
+
- **`/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.
|
|
494
|
+
- **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).
|
|
495
|
+
- **Vitest config**: Increased test timeout to 15s for CLI spawn tests. Fixes flaky test failures when npx downloads packages.
|
|
424
496
|
|
|
425
|
-
|
|
426
|
-
|
|
497
|
+
### Fixed
|
|
498
|
+
- **Test flakiness**: Availability tests (biome, knip, jscpd) no longer timeout when npx is downloading packages.
|
|
427
499
|
|
|
428
|
-
|
|
429
|
-
`switch-exhaustiveness` — detects missing cases in union type switches (inline blocker)
|
|
500
|
+
## [1.3.0] - 2026-03-23
|
|
430
501
|
|
|
431
|
-
|
|
432
|
-
|
|
502
|
+
### Changed
|
|
503
|
+
- **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`.
|
|
433
504
|
|
|
434
|
-
|
|
435
|
-
|
|
505
|
+
### Added
|
|
506
|
+
- **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.
|
|
507
|
+
- **Rule descriptions in diagnostics**: ast-grep violations now include the rule's message and note, making feedback more actionable for the agent.
|
|
436
508
|
|
|
437
|
-
|
|
509
|
+
### Changed
|
|
510
|
+
- **Reduced console noise**: Extension no longer prints to console by default. Enable with `--lens-verbose`.
|
|
438
511
|
|
|
439
|
-
##
|
|
512
|
+
## [1.2.0] - 2026-03-23
|
|
440
513
|
|
|
441
|
-
|
|
514
|
+
### Added
|
|
515
|
+
- GitHub repository link in npm package
|
|
442
516
|
|
|
443
|
-
-
|
|
444
|
-
- `lib: ["es2020", "dom", "dom.iterable"]`
|
|
445
|
-
- `moduleResolution: bundler`
|
|
446
|
-
- `strict: true`
|
|
517
|
+
## [1.1.2] - Previous
|
|
447
518
|
|
|
448
|
-
|
|
519
|
+
- See git history for earlier releases
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* - OutputSemantic: How to display (blocking, warning, silent, etc.)
|
|
14
14
|
* - BaselineStore: Track pre-existing issues for delta mode
|
|
15
15
|
*/
|
|
16
|
-
import * as fs from "node:fs";
|
|
17
16
|
import { detectFileKind } from "../file-kinds.js";
|
|
18
17
|
// --- In-Memory Baseline Store ---
|
|
19
18
|
export function createBaselineStore() {
|
|
@@ -32,8 +31,6 @@ export function createBaselineStore() {
|
|
|
32
31
|
}
|
|
33
32
|
// --- Runner Registry ---
|
|
34
33
|
const globalRegistry = new Map();
|
|
35
|
-
// Track last-run mtime per file+runner to skip unchanged files
|
|
36
|
-
const lastRunMtimes = new Map(); // key: `${runnerId}:${filePath}` -> mtimeMs
|
|
37
34
|
export function registerRunner(runner) {
|
|
38
35
|
if (globalRegistry.has(runner.id)) {
|
|
39
36
|
console.error(`[dispatch] Duplicate runner: ${runner.id}`);
|
|
@@ -223,22 +220,6 @@ export async function dispatchForFile(ctx, groups) {
|
|
|
223
220
|
}
|
|
224
221
|
// --- Run Single Runner ---
|
|
225
222
|
async function runRunner(ctx, runner, defaultSemantic) {
|
|
226
|
-
// Skip if file unchanged (optimization for expensive runners)
|
|
227
|
-
if (runner.skipIfUnchanged) {
|
|
228
|
-
const cacheKey = `${runner.id}:${ctx.filePath}`;
|
|
229
|
-
try {
|
|
230
|
-
const stats = fs.statSync(ctx.filePath);
|
|
231
|
-
const lastMtime = lastRunMtimes.get(cacheKey);
|
|
232
|
-
if (lastMtime && stats.mtimeMs <= lastMtime) {
|
|
233
|
-
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
234
|
-
}
|
|
235
|
-
// Update mtime after run (below)
|
|
236
|
-
lastRunMtimes.set(cacheKey, stats.mtimeMs);
|
|
237
|
-
}
|
|
238
|
-
catch {
|
|
239
|
-
// File doesn't exist or stat failed, continue with run
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
223
|
try {
|
|
243
224
|
const result = await runner.run(ctx);
|
|
244
225
|
return {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* - BaselineStore: Track pre-existing issues for delta mode
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import * as fs from "node:fs";
|
|
18
17
|
import type { FileKind } from "../file-kinds.js";
|
|
19
18
|
import { detectFileKind } from "../file-kinds.js";
|
|
20
19
|
|
|
@@ -52,9 +51,6 @@ export function createBaselineStore(): BaselineStore {
|
|
|
52
51
|
|
|
53
52
|
const globalRegistry = new Map<string, RunnerDefinition>();
|
|
54
53
|
|
|
55
|
-
// Track last-run mtime per file+runner to skip unchanged files
|
|
56
|
-
const lastRunMtimes = new Map<string, number>(); // key: `${runnerId}:${filePath}` -> mtimeMs
|
|
57
|
-
|
|
58
54
|
export function registerRunner(runner: RunnerDefinition): void {
|
|
59
55
|
if (globalRegistry.has(runner.id)) {
|
|
60
56
|
console.error(`[dispatch] Duplicate runner: ${runner.id}`);
|
|
@@ -311,22 +307,6 @@ async function runRunner(
|
|
|
311
307
|
runner: RunnerDefinition,
|
|
312
308
|
defaultSemantic: OutputSemantic,
|
|
313
309
|
): Promise<RunnerResult> {
|
|
314
|
-
// Skip if file unchanged (optimization for expensive runners)
|
|
315
|
-
if (runner.skipIfUnchanged) {
|
|
316
|
-
const cacheKey = `${runner.id}:${ctx.filePath}`;
|
|
317
|
-
try {
|
|
318
|
-
const stats = fs.statSync(ctx.filePath);
|
|
319
|
-
const lastMtime = lastRunMtimes.get(cacheKey);
|
|
320
|
-
if (lastMtime && stats.mtimeMs <= lastMtime) {
|
|
321
|
-
return { status: "skipped", diagnostics: [], semantic: "none" };
|
|
322
|
-
}
|
|
323
|
-
// Update mtime after run (below)
|
|
324
|
-
lastRunMtimes.set(cacheKey, stats.mtimeMs);
|
|
325
|
-
} catch {
|
|
326
|
-
// File doesn't exist or stat failed, continue with run
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
310
|
try {
|
|
331
311
|
const result = await runner.run(ctx);
|
|
332
312
|
return {
|
|
@@ -20,7 +20,6 @@ const typeSafetyRunner: RunnerDefinition = {
|
|
|
20
20
|
appliesTo: ["jsts"],
|
|
21
21
|
priority: 20,
|
|
22
22
|
enabledByDefault: true,
|
|
23
|
-
skipIfUnchanged: true, // Skip type-coverage if file unchanged
|
|
24
23
|
|
|
25
24
|
async run(ctx: DispatchContext): Promise<RunnerResult> {
|
|
26
25
|
// Only check TypeScript files
|
|
@@ -98,8 +98,6 @@ export interface RunnerDefinition {
|
|
|
98
98
|
enabledByDefault: boolean;
|
|
99
99
|
/** Skip this runner for test files (false positive reduction) */
|
|
100
100
|
skipTestFiles?: boolean;
|
|
101
|
-
/** Skip if file unchanged since last run (check mtime) */
|
|
102
|
-
skipIfUnchanged?: boolean;
|
|
103
101
|
/** Check if runner should run */
|
|
104
102
|
when?: (ctx: DispatchContext) => Promise<boolean> | boolean;
|
|
105
103
|
/** Execute the runner */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lens",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Real-time code quality feedback for pi — TypeScript LSP, Biome, ast-grep, Ruff, complexity metrics, duplicate detection. Includes automated fix loop (/lens-booboo-fix) and interactive architectural refactoring (/lens-booboo-refactor) with browser-based interviews.",
|
|
6
6
|
"repository": {
|