pi-lens 1.3.9 → 1.3.10

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.
@@ -265,6 +265,35 @@ export class ComplexityClient {
265
265
  return parts.length > 0 ? `[Complexity] ${metrics.filePath}\n${parts.join("\n")}` : "";
266
266
  }
267
267
 
268
+ /**
269
+ * Check thresholds and return actionable warnings
270
+ */
271
+ checkThresholds(metrics: FileComplexity): string[] {
272
+ const warnings: string[] = [];
273
+
274
+ if (metrics.maintainabilityIndex < 60) {
275
+ warnings.push(`Maintainability dropped to ${metrics.maintainabilityIndex} — extract logic into helper functions`);
276
+ }
277
+
278
+ if (metrics.cyclomaticComplexity > 10) {
279
+ warnings.push(`High complexity (${metrics.cyclomaticComplexity}) — use early returns or switch expressions`);
280
+ }
281
+
282
+ if (metrics.cognitiveComplexity > 15) {
283
+ warnings.push(`Cognitive complexity (${metrics.cognitiveComplexity}) — simplify logic flow`);
284
+ }
285
+
286
+ if (metrics.maxNestingDepth > 4) {
287
+ warnings.push(`Deep nesting (${metrics.maxNestingDepth} levels) — extract nested logic into separate functions`);
288
+ }
289
+
290
+ if (metrics.codeEntropy > 3.5) {
291
+ warnings.push(`High entropy (${metrics.codeEntropy.toFixed(1)} bits) — follow project conventions`);
292
+ }
293
+
294
+ return warnings;
295
+ }
296
+
268
297
  /**
269
298
  * Format delta for session summary
270
299
  */
package/index.ts CHANGED
@@ -829,6 +829,21 @@ export default function (pi: ExtensionAPI) {
829
829
  }
830
830
  }
831
831
 
832
+ // Complexity threshold warnings (actionable)
833
+ if (complexityClient.isSupportedFile(filePath)) {
834
+ const metrics = complexityClient.analyzeFile(filePath);
835
+ if (metrics) {
836
+ const warnings = complexityClient.checkThresholds(metrics);
837
+ if (warnings.length > 0) {
838
+ let warningReport = `[Complexity Warnings]\n`;
839
+ for (const w of warnings) {
840
+ warningReport += ` ⚠ ${w}\n`;
841
+ }
842
+ lspOutput += `\n\n${warningReport}`;
843
+ }
844
+ }
845
+ }
846
+
832
847
  // Test runner — run tests for the edited file
833
848
  if (!pi.getFlag("no-tests")) {
834
849
  const cwd = process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lens",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "Real-time code feedback for pi — TypeScript LSP, Biome, ast-grep, Ruff, TODO scanner, dead code, duplicate detection, type coverage",
5
5
  "repository": {
6
6
  "type": "git",