pi-lens 3.0.0 → 3.0.1

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
@@ -1,18 +1,20 @@
1
1
  # pi-lens
2
2
 
3
- Real-time code feedback for [pi](https://github.com/mariozechner/pi-coding-agent) — LSP, linters, formatters, type-checking, structural analysis (ast-grep), TODO scanner, dead code detection, duplicate detection, type coverage, complexity metrics, and AI slop detection.
3
+ **pi extension for real-time code quality.** 31 LSP servers, tree-sitter structural analysis, AST pattern matching, auto-install for TypeScript/Python tooling, duplicate detection, complexity metrics, and inline blockers with comprehensive `/lens-booboo` reports.
4
4
 
5
5
  ## What pi-lens Does
6
6
 
7
7
  **For every file you edit:**
8
8
  1. **Auto-formats** — Detects and runs formatters (Biome, Prettier, Ruff, gofmt, rustfmt, etc.)
9
- 2. **Type-checks** TypeScript, Python, Go, Rust (and 27 more languages with `--lens-lsp`)
10
- 3. **Scans for secrets** — blocks on hardcoded API keys, tokens, passwords
9
+ 2. **Type-checks** TypeScript, Python, Go, Rust (31 languages with `--lens-lsp`)
10
+ 3. **Scans for secrets** — Blocks on hardcoded API keys, tokens, passwords
11
11
  4. **Runs linters** — Biome (TS/JS), Ruff (Python), plus structural analysis
12
- 5. **Detects code smells** — empty catch blocks, debuggers, nested ternaries, etc.
13
- 6. **Only shows NEW issues** — delta-mode tracks baselines and filters pre-existing problems (reduces noise)
12
+ 5. **Tree-sitter analysis** — Deep structural patterns (empty catch, eval, deep nesting, mixed async styles)
13
+ 6. **Auto-installs** — TypeScript, Python, Biome, Ruff tools install automatically on first use
14
+ 7. **Only shows NEW issues** — Delta-mode tracks baselines and filters pre-existing problems
14
15
 
15
- **Blocking issues** (type errors, secrets) appear inline and stop the agent until fixed. **Warnings** are tracked but hidden inline — run `/lens-booboo` to see them all.
16
+ **🔴 Blockers** (type errors, secrets, empty catches) appear inline and stop the agent until fixed.
17
+ **🟡 Warnings** (complexity, code smells) go to `/lens-booboo` — run it to see them all.
16
18
 
17
19
  ## Quick Start
18
20
 
@@ -234,9 +234,11 @@ export class ComplexityClient {
234
234
  if (metrics.maxNestingDepth > 4) {
235
235
  parts.push(` Max nesting: ${metrics.maxNestingDepth} levels (consider extracting)`);
236
236
  }
237
- // Code entropy (in bits, >3.5 = risky AI-induced complexity)
238
- if (metrics.codeEntropy > 3.5) {
239
- parts.push(` Entropy: ${metrics.codeEntropy.toFixed(1)} bits (>3.5 risky AI-induced complexity)`);
237
+ // Code entropy (in bits, >5.5 = risky AI-induced complexity)
238
+ // Threshold increased from 3.5 to 5.5 to reduce false positives in tooling codebases
239
+ // where diverse method/variable names are naturally expected
240
+ if (metrics.codeEntropy > 5.5) {
241
+ parts.push(` Entropy: ${metrics.codeEntropy.toFixed(1)} bits (>5.5 — risky AI-induced complexity)`);
240
242
  }
241
243
  // Function length
242
244
  if (metrics.maxFunctionLength > 50) {
@@ -336,8 +338,8 @@ export class ComplexityClient {
336
338
  if (metrics.maxNestingDepth > 6) {
337
339
  warnings.push(`Deep nesting (${metrics.maxNestingDepth} levels) — extract nested logic into separate functions`);
338
340
  }
339
- // Entropy > 5.0 is high (was > 3.5, too sensitive)
340
- if (metrics.codeEntropy > 5.0) {
341
+ // Entropy > 5.5 is high (was > 3.5 → 5.0, still too sensitive for tooling codebases)
342
+ if (metrics.codeEntropy > 5.5) {
341
343
  warnings.push(`High entropy (${metrics.codeEntropy.toFixed(1)} bits) — follow project conventions`);
342
344
  }
343
345
  // Comments ratio (>60% = excessive, was > 40%)
@@ -576,7 +578,8 @@ export class ComplexityClient {
576
578
  /**
577
579
  * Calculate Shannon entropy of code tokens (in bits)
578
580
  * Uses log2 for entropy measured in bits
579
- * Threshold: >3.5 bits indicates risky AI-induced complexity
581
+ * Threshold: >5.5 bits indicates risky AI-induced complexity
582
+ * (Increased from 3.5 to reduce false positives in tooling codebases)
580
583
  */
581
584
  calculateCodeEntropy(sourceText) {
582
585
  // Tokenize by splitting on whitespace and common delimiters
@@ -331,10 +331,12 @@ export class ComplexityClient {
331
331
  );
332
332
  }
333
333
 
334
- // Code entropy (in bits, >3.5 = risky AI-induced complexity)
335
- if (metrics.codeEntropy > 3.5) {
334
+ // Code entropy (in bits, >5.5 = risky AI-induced complexity)
335
+ // Threshold increased from 3.5 to 5.5 to reduce false positives in tooling codebases
336
+ // where diverse method/variable names are naturally expected
337
+ if (metrics.codeEntropy > 5.5) {
336
338
  parts.push(
337
- ` Entropy: ${metrics.codeEntropy.toFixed(1)} bits (>3.5 — risky AI-induced complexity)`,
339
+ ` Entropy: ${metrics.codeEntropy.toFixed(1)} bits (>5.5 — risky AI-induced complexity)`,
338
340
  );
339
341
  }
340
342
 
@@ -480,8 +482,8 @@ export class ComplexityClient {
480
482
  );
481
483
  }
482
484
 
483
- // Entropy > 5.0 is high (was > 3.5, too sensitive)
484
- if (metrics.codeEntropy > 5.0) {
485
+ // Entropy > 5.5 is high (was > 3.5 → 5.0, still too sensitive for tooling codebases)
486
+ if (metrics.codeEntropy > 5.5) {
485
487
  warnings.push(
486
488
  `High entropy (${metrics.codeEntropy.toFixed(1)} bits) — follow project conventions`,
487
489
  );
@@ -807,7 +809,8 @@ export class ComplexityClient {
807
809
  /**
808
810
  * Calculate Shannon entropy of code tokens (in bits)
809
811
  * Uses log2 for entropy measured in bits
810
- * Threshold: >3.5 bits indicates risky AI-induced complexity
812
+ * Threshold: >5.5 bits indicates risky AI-induced complexity
813
+ * (Increased from 3.5 to reduce false positives in tooling codebases)
811
814
  */
812
815
  private calculateCodeEntropy(sourceText: string): number {
813
816
  // Tokenize by splitting on whitespace and common delimiters
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "pi-lens",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
- "description": "Real-time code feedback for pi LSP, linters, formatters, type-checking, structural analysis (ast-grep), TODO scanner, dead code detection, duplicate detection, type coverage, complexity metrics, and AI slop detection",
5
+ "description": "pi extension for real-time code quality 31 LSP servers, tree-sitter structural analysis, AST pattern matching, auto-install for TypeScript/Python tooling, duplicate detection, complexity metrics, and inline blockers with comprehensive /lens-booboo reports",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/apmantza/pi-lens.git"