pi-lens 3.6.2 ā 3.6.4
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/CHANGELOG.md +10 -2
- package/package.json +4 -4
- package/tsconfig.json +1 -1
- package/clients/__tests__/file-time.test.js +0 -216
- package/clients/__tests__/file-time.test.ts +0 -276
- package/clients/__tests__/format-service.test.js +0 -245
- package/clients/__tests__/format-service.test.ts +0 -339
- package/clients/__tests__/formatters.test.js +0 -271
- package/clients/__tests__/formatters.test.ts +0 -401
- package/clients/agent-behavior-client.js +0 -110
- package/clients/agent-behavior-client.test.js +0 -94
- package/clients/agent-behavior-client.test.ts +0 -116
- package/clients/amain-types.js +0 -164
- package/clients/architect-client.js +0 -291
- package/clients/ast-grep-client.js +0 -253
- package/clients/ast-grep-parser.js +0 -84
- package/clients/ast-grep-rule-manager.js +0 -89
- package/clients/ast-grep-types.js +0 -9
- package/clients/auto-loop.js +0 -131
- package/clients/biome-client.js +0 -420
- package/clients/biome-client.test.js +0 -144
- package/clients/biome-client.test.ts +0 -163
- package/clients/cache/rule-cache.js +0 -72
- package/clients/cache-manager.js +0 -245
- package/clients/cache-manager.test.js +0 -197
- package/clients/cache-manager.test.ts +0 -299
- package/clients/complexity-client.js +0 -675
- package/clients/complexity-client.test.js +0 -234
- package/clients/complexity-client.test.ts +0 -255
- package/clients/config-validator.js +0 -465
- package/clients/dependency-checker.js +0 -325
- package/clients/dependency-checker.test.js +0 -60
- package/clients/dependency-checker.test.ts +0 -71
- package/clients/dispatch/__tests__/autofix-integration.test.js +0 -245
- package/clients/dispatch/__tests__/autofix-integration.test.ts +0 -300
- package/clients/dispatch/__tests__/runner-registration.test.js +0 -234
- package/clients/dispatch/__tests__/runner-registration.test.ts +0 -286
- package/clients/dispatch/debug.log +0 -1
- package/clients/dispatch/dispatcher.edge.test.js +0 -82
- package/clients/dispatch/dispatcher.edge.test.ts +0 -100
- package/clients/dispatch/dispatcher.format.test.js +0 -46
- package/clients/dispatch/dispatcher.format.test.ts +0 -58
- package/clients/dispatch/dispatcher.inline.test.js +0 -74
- package/clients/dispatch/dispatcher.inline.test.ts +0 -93
- package/clients/dispatch/dispatcher.js +0 -381
- package/clients/dispatch/dispatcher.test.js +0 -116
- package/clients/dispatch/dispatcher.test.ts +0 -149
- package/clients/dispatch/integration.js +0 -108
- package/clients/dispatch/plan.js +0 -183
- package/clients/dispatch/runners/architect.js +0 -83
- package/clients/dispatch/runners/architect.test.js +0 -138
- package/clients/dispatch/runners/architect.test.ts +0 -162
- package/clients/dispatch/runners/ast-grep-napi.js +0 -405
- package/clients/dispatch/runners/ast-grep-napi.test.js +0 -107
- package/clients/dispatch/runners/ast-grep-napi.test.ts +0 -129
- package/clients/dispatch/runners/ast-grep.js +0 -157
- package/clients/dispatch/runners/biome.js +0 -55
- package/clients/dispatch/runners/config-validation.js +0 -67
- package/clients/dispatch/runners/go-vet.js +0 -48
- package/clients/dispatch/runners/index.js +0 -47
- package/clients/dispatch/runners/lsp.js +0 -102
- package/clients/dispatch/runners/oxlint.js +0 -67
- package/clients/dispatch/runners/oxlint.test.js +0 -230
- package/clients/dispatch/runners/oxlint.test.ts +0 -303
- package/clients/dispatch/runners/pyright.js +0 -100
- package/clients/dispatch/runners/pyright.test.js +0 -98
- package/clients/dispatch/runners/pyright.test.ts +0 -121
- package/clients/dispatch/runners/python-slop.js +0 -97
- package/clients/dispatch/runners/python-slop.test.js +0 -203
- package/clients/dispatch/runners/python-slop.test.ts +0 -298
- package/clients/dispatch/runners/ruff.js +0 -48
- package/clients/dispatch/runners/rust-clippy.js +0 -102
- package/clients/dispatch/runners/scan_codebase.test.js +0 -89
- package/clients/dispatch/runners/scan_codebase.test.ts +0 -105
- package/clients/dispatch/runners/shellcheck.js +0 -147
- package/clients/dispatch/runners/shellcheck.test.js +0 -98
- package/clients/dispatch/runners/shellcheck.test.ts +0 -129
- package/clients/dispatch/runners/similarity.js +0 -230
- package/clients/dispatch/runners/spellcheck.js +0 -106
- package/clients/dispatch/runners/spellcheck.test.js +0 -158
- package/clients/dispatch/runners/spellcheck.test.ts +0 -214
- package/clients/dispatch/runners/tree-sitter.js +0 -246
- package/clients/dispatch/runners/ts-lsp.js +0 -125
- package/clients/dispatch/runners/ts-slop.js +0 -113
- package/clients/dispatch/runners/type-safety.js +0 -142
- package/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -134
- package/clients/dispatch/runners/utils/runner-helpers.js +0 -115
- package/clients/dispatch/runners/utils.js +0 -51
- package/clients/dispatch/runners/yaml-rule-parser.js +0 -360
- package/clients/dispatch/types.js +0 -16
- package/clients/dispatch/utils/format-utils.js +0 -44
- package/clients/dogfood.test.js +0 -201
- package/clients/dogfood.test.ts +0 -269
- package/clients/file-kinds.js +0 -177
- package/clients/file-kinds.test.js +0 -169
- package/clients/file-kinds.test.ts +0 -210
- package/clients/file-time.js +0 -152
- package/clients/file-utils.js +0 -40
- package/clients/fix-scanners.js +0 -204
- package/clients/format-service.js +0 -184
- package/clients/formatters.js +0 -488
- package/clients/go-client.js +0 -203
- package/clients/go-client.test.js +0 -127
- package/clients/go-client.test.ts +0 -143
- package/clients/installer/index.js +0 -403
- package/clients/interviewer-templates.js +0 -75
- package/clients/interviewer.js +0 -173
- package/clients/jscpd-client.js +0 -196
- package/clients/jscpd-client.test.js +0 -127
- package/clients/jscpd-client.test.ts +0 -145
- package/clients/knip-client.js +0 -239
- package/clients/knip-client.test.js +0 -112
- package/clients/knip-client.test.ts +0 -128
- package/clients/latency-logger.js +0 -40
- package/clients/lsp/__tests__/client.test.js +0 -310
- package/clients/lsp/__tests__/client.test.ts +0 -412
- package/clients/lsp/__tests__/config.test.js +0 -167
- package/clients/lsp/__tests__/config.test.ts +0 -217
- package/clients/lsp/__tests__/error-recovery.test.js +0 -213
- package/clients/lsp/__tests__/error-recovery.test.ts +0 -279
- package/clients/lsp/__tests__/integration.test.js +0 -127
- package/clients/lsp/__tests__/integration.test.ts +0 -160
- package/clients/lsp/__tests__/launch.test.js +0 -313
- package/clients/lsp/__tests__/launch.test.ts +0 -394
- package/clients/lsp/__tests__/server.test.js +0 -259
- package/clients/lsp/__tests__/server.test.ts +0 -332
- package/clients/lsp/__tests__/service.test.js +0 -438
- package/clients/lsp/__tests__/service.test.ts +0 -530
- package/clients/lsp/client.js +0 -350
- package/clients/lsp/config.js +0 -112
- package/clients/lsp/index.js +0 -318
- package/clients/lsp/installer/index.js +0 -391
- package/clients/lsp/interactive-install.js +0 -221
- package/clients/lsp/language.js +0 -170
- package/clients/lsp/launch.js +0 -329
- package/clients/lsp/lsp/launch.js +0 -116
- package/clients/lsp/lsp/server.js +0 -532
- package/clients/lsp/lsp-index.js +0 -10
- package/clients/lsp/path-utils.js +0 -5
- package/clients/lsp/server.js +0 -725
- package/clients/lsp/test-py-spawn/requirements.txt +0 -1
- package/clients/lsp/test-py-spawn/test.py +0 -3
- package/clients/lsp/test-py-svc/requirements.txt +0 -1
- package/clients/lsp/test-py-svc/test.py +0 -3
- package/clients/lsp/test-python-project/requirements.txt +0 -1
- package/clients/lsp/test-python-project/test.py +0 -5
- package/clients/metrics-client.js +0 -107
- package/clients/metrics-client.test.js +0 -128
- package/clients/metrics-client.test.ts +0 -163
- package/clients/metrics-history.js +0 -367
- package/clients/path-utils.js +0 -142
- package/clients/pipeline.js +0 -272
- package/clients/production-readiness.js +0 -522
- package/clients/project-index.js +0 -255
- package/clients/project-metadata.js +0 -531
- package/clients/ruff-client.js +0 -325
- package/clients/ruff-client.test.js +0 -132
- package/clients/ruff-client.test.ts +0 -153
- package/clients/rules-scanner.js +0 -97
- package/clients/runner-tracker.js +0 -152
- package/clients/rust-client.js +0 -205
- package/clients/rust-client.test.js +0 -108
- package/clients/rust-client.test.ts +0 -130
- package/clients/safe-spawn-async.js +0 -163
- package/clients/safe-spawn.js +0 -241
- package/clients/sanitize.js +0 -291
- package/clients/sanitize.test.js +0 -177
- package/clients/sanitize.test.ts +0 -223
- package/clients/scan-architectural-debt.js +0 -167
- package/clients/scan-utils.js +0 -83
- package/clients/secrets-scanner.js +0 -119
- package/clients/secrets-scanner.test.js +0 -100
- package/clients/secrets-scanner.test.ts +0 -113
- package/clients/sg-runner.js +0 -292
- package/clients/state-matrix.js +0 -160
- package/clients/subprocess-client.js +0 -65
- package/clients/symbol-types.js +0 -5
- package/clients/test-runner-client.js +0 -523
- package/clients/test-runner-client.test.js +0 -192
- package/clients/test-runner-client.test.ts +0 -253
- package/clients/test-utils.js +0 -27
- package/clients/test-utils.ts +0 -36
- package/clients/todo-scanner.js +0 -200
- package/clients/todo-scanner.test.js +0 -301
- package/clients/todo-scanner.test.ts +0 -352
- package/clients/tool-availability.js +0 -207
- package/clients/tree-sitter-client.js +0 -601
- package/clients/tree-sitter-query-loader.js +0 -355
- package/clients/tree-sitter-symbol-extractor.js +0 -289
- package/clients/ts-service.js +0 -129
- package/clients/type-coverage-client.js +0 -127
- package/clients/type-coverage-client.test.js +0 -105
- package/clients/type-coverage-client.test.ts +0 -125
- package/clients/type-safety-client.js +0 -138
- package/clients/types.js +0 -11
- package/clients/typescript-client.codefix.test.js +0 -157
- package/clients/typescript-client.codefix.test.ts +0 -186
- package/clients/typescript-client.js +0 -509
- package/clients/typescript-client.test.js +0 -105
- package/clients/typescript-client.test.ts +0 -126
- package/commands/booboo.js +0 -1007
- package/commands/fix-from-booboo.js +0 -398
- package/commands/fix-simplified.js +0 -618
- package/commands/rate.js +0 -281
- package/commands/rate.test.js +0 -119
- package/commands/rate.test.ts +0 -131
- package/commands/refactor.js +0 -130
package/commands/rate.js
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* /lens-rate command
|
|
3
|
-
*
|
|
4
|
-
* Provides a visual scoring breakdown of code quality across multiple dimensions.
|
|
5
|
-
* Uses existing scan data to calculate scores.
|
|
6
|
-
*/
|
|
7
|
-
import * as nodeFs from "node:fs";
|
|
8
|
-
import * as path from "node:path";
|
|
9
|
-
import { safeSpawn } from "../clients/safe-spawn.js";
|
|
10
|
-
import { EXCLUDED_DIRS, isTestFile } from "../clients/file-utils.js";
|
|
11
|
-
import { getSourceFiles } from "../clients/scan-utils.js";
|
|
12
|
-
/**
|
|
13
|
-
* Run all scans and calculate scores
|
|
14
|
-
*/
|
|
15
|
-
export async function gatherScores(targetPath, clients) {
|
|
16
|
-
const isTsProject = nodeFs.existsSync(path.join(targetPath, "tsconfig.json"));
|
|
17
|
-
const files = getSourceFiles(targetPath, isTsProject);
|
|
18
|
-
const categories = [];
|
|
19
|
-
// āāā Type Safety āāā
|
|
20
|
-
let typeCoverageScore = 100;
|
|
21
|
-
const typeIssues = [];
|
|
22
|
-
if (clients.typeCoverage.isAvailable()) {
|
|
23
|
-
const result = clients.typeCoverage.scan(targetPath);
|
|
24
|
-
if (result.success) {
|
|
25
|
-
typeCoverageScore = result.percentage;
|
|
26
|
-
if (result.percentage < 90) {
|
|
27
|
-
typeIssues.push(`${result.total - result.typed} untyped identifiers`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
categories.push({
|
|
32
|
-
name: "Type Safety",
|
|
33
|
-
score: Math.round(typeCoverageScore),
|
|
34
|
-
icon: "š·",
|
|
35
|
-
issues: typeIssues,
|
|
36
|
-
});
|
|
37
|
-
// āāā Complexity āāā
|
|
38
|
-
let complexityScore = 100;
|
|
39
|
-
const complexityIssues = [];
|
|
40
|
-
let totalScore = 0;
|
|
41
|
-
let fileCount = 0;
|
|
42
|
-
let worstFile = "";
|
|
43
|
-
let worstScore = 100;
|
|
44
|
-
for (const file of files.slice(0, 50)) {
|
|
45
|
-
if (clients.complexity.isSupportedFile(file)) {
|
|
46
|
-
const metrics = clients.complexity.analyzeFile(file);
|
|
47
|
-
if (metrics) {
|
|
48
|
-
totalScore += metrics.maintainabilityIndex;
|
|
49
|
-
fileCount++;
|
|
50
|
-
if (metrics.maintainabilityIndex < worstScore) {
|
|
51
|
-
worstScore = metrics.maintainabilityIndex;
|
|
52
|
-
worstFile = path.basename(file);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (fileCount > 0) {
|
|
58
|
-
complexityScore = totalScore / fileCount;
|
|
59
|
-
if (complexityScore < 70) {
|
|
60
|
-
complexityIssues.push(`High complexity: ${worstFile}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
categories.push({
|
|
64
|
-
name: "Complexity",
|
|
65
|
-
score: Math.round(complexityScore),
|
|
66
|
-
icon: "š§©",
|
|
67
|
-
issues: complexityIssues,
|
|
68
|
-
});
|
|
69
|
-
// āāā Security āāā
|
|
70
|
-
let securityScore = 100;
|
|
71
|
-
const securityIssues = [];
|
|
72
|
-
let secretsFound = 0;
|
|
73
|
-
// Check for secrets in source files (skip test files)
|
|
74
|
-
const secretPatterns = [
|
|
75
|
-
{ name: "API Key (sk-)", pattern: /sk-[a-zA-Z0-9]{20,}/ },
|
|
76
|
-
{ name: "GitHub Token", pattern: /ghp_[a-zA-Z0-9]{36}/ },
|
|
77
|
-
{ name: "AWS Key", pattern: /AKIA[A-Z0-9]{16}/ },
|
|
78
|
-
{ name: "Anthropic Key", pattern: /sk-ant-[a-zA-Z0-9]{20,}/ },
|
|
79
|
-
{ name: "OpenAI Key", pattern: /sk-proj-[a-zA-Z0-9]{20,}/ },
|
|
80
|
-
{
|
|
81
|
-
name: "Private Key",
|
|
82
|
-
pattern: /-----BEGIN (?:RSA |EC |DSA )?PRIVATE KEY-----/,
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
for (const file of files.slice(0, 100)) {
|
|
86
|
-
// Skip test files
|
|
87
|
-
if (isTestFile(file))
|
|
88
|
-
continue;
|
|
89
|
-
try {
|
|
90
|
-
const content = nodeFs.readFileSync(file, "utf-8");
|
|
91
|
-
for (const line of content.split("\n")) {
|
|
92
|
-
if (line.trim().startsWith("//") || line.trim().startsWith("#"))
|
|
93
|
-
continue;
|
|
94
|
-
for (const { name, pattern } of secretPatterns) {
|
|
95
|
-
if (pattern.test(line)) {
|
|
96
|
-
secretsFound++;
|
|
97
|
-
if (securityIssues.length < 3) {
|
|
98
|
-
securityIssues.push(`${name} in ${path.basename(file)}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (err) {
|
|
105
|
-
// Skip unreadable files
|
|
106
|
-
void err;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
securityScore = Math.max(0, 100 - secretsFound * 15);
|
|
110
|
-
categories.push({
|
|
111
|
-
name: "Security",
|
|
112
|
-
score: securityScore,
|
|
113
|
-
icon: "š",
|
|
114
|
-
issues: securityIssues,
|
|
115
|
-
});
|
|
116
|
-
// āāā Architecture āāā
|
|
117
|
-
let archScore = 100;
|
|
118
|
-
const archIssues = [];
|
|
119
|
-
clients.architect.loadConfig(targetPath);
|
|
120
|
-
if (clients.architect.hasConfig()) {
|
|
121
|
-
let archViolations = 0;
|
|
122
|
-
const scanDir = (dir) => {
|
|
123
|
-
for (const entry of nodeFs.readdirSync(dir, { withFileTypes: true })) {
|
|
124
|
-
const full = path.join(dir, entry.name);
|
|
125
|
-
if (entry.isDirectory()) {
|
|
126
|
-
if (EXCLUDED_DIRS.includes(entry.name))
|
|
127
|
-
continue;
|
|
128
|
-
scanDir(full);
|
|
129
|
-
}
|
|
130
|
-
else if (/\.(ts|tsx|js|jsx|py|go|rs)$/.test(entry.name)) {
|
|
131
|
-
const relPath = path.relative(targetPath, full).replace(/\\/g, "/");
|
|
132
|
-
const content = nodeFs.readFileSync(full, "utf-8");
|
|
133
|
-
const violations = clients.architect.checkFile(relPath, content);
|
|
134
|
-
archViolations += violations.length;
|
|
135
|
-
if (violations.length > 0 && archIssues.length < 3) {
|
|
136
|
-
archIssues.push(`${violations.length} in ${path.basename(full)}`);
|
|
137
|
-
}
|
|
138
|
-
const sizeV = clients.architect.checkFileSize(relPath, content.split("\n").length);
|
|
139
|
-
if (sizeV)
|
|
140
|
-
archViolations++;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
scanDir(targetPath);
|
|
145
|
-
archScore = Math.max(0, 100 - archViolations * 10);
|
|
146
|
-
}
|
|
147
|
-
categories.push({
|
|
148
|
-
name: "Architecture",
|
|
149
|
-
score: archScore,
|
|
150
|
-
icon: "šļø",
|
|
151
|
-
issues: archIssues,
|
|
152
|
-
});
|
|
153
|
-
// āāā Dead Code āāā
|
|
154
|
-
let deadCodeScore = 100;
|
|
155
|
-
const deadCodeIssues = [];
|
|
156
|
-
if (clients.knip.isAvailable()) {
|
|
157
|
-
const result = clients.knip.analyze(targetPath);
|
|
158
|
-
if (result.success) {
|
|
159
|
-
const unusedExports = result.unusedExports.length;
|
|
160
|
-
const unusedFiles = result.unusedFiles.length;
|
|
161
|
-
const total = unusedExports + unusedFiles;
|
|
162
|
-
deadCodeScore = Math.max(0, 100 - total * 3);
|
|
163
|
-
if (unusedExports > 0) {
|
|
164
|
-
deadCodeIssues.push(`${unusedExports} unused export(s)`);
|
|
165
|
-
}
|
|
166
|
-
if (unusedFiles > 0) {
|
|
167
|
-
deadCodeIssues.push(`${unusedFiles} unused file(s)`);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
categories.push({
|
|
172
|
-
name: "Dead Code",
|
|
173
|
-
score: deadCodeScore,
|
|
174
|
-
icon: "šļø",
|
|
175
|
-
issues: deadCodeIssues,
|
|
176
|
-
});
|
|
177
|
-
// āāā Tests āāā
|
|
178
|
-
let testScore = 100;
|
|
179
|
-
const testIssues = [];
|
|
180
|
-
// Quick test run
|
|
181
|
-
try {
|
|
182
|
-
const testResult = safeSpawn("npx", ["vitest", "run", "--reporter=basic"], {
|
|
183
|
-
timeout: 60000,
|
|
184
|
-
cwd: targetPath,
|
|
185
|
-
});
|
|
186
|
-
if (testResult.status !== 0) {
|
|
187
|
-
const output = (testResult.stdout || "") + (testResult.stderr || "");
|
|
188
|
-
if (output.includes("failed")) {
|
|
189
|
-
// Count failing tests
|
|
190
|
-
const failMatch = output.match(/(\d+) failed/);
|
|
191
|
-
testScore = 50;
|
|
192
|
-
testIssues.push(failMatch ? `${failMatch[1]} test(s) failing` : "Some tests failing");
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
testScore = 70;
|
|
196
|
-
testIssues.push("Tests timed out or errored");
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
catch {
|
|
201
|
-
testScore = 70;
|
|
202
|
-
testIssues.push("Could not run tests");
|
|
203
|
-
}
|
|
204
|
-
categories.push({
|
|
205
|
-
name: "Tests",
|
|
206
|
-
score: testScore,
|
|
207
|
-
icon: "ā
",
|
|
208
|
-
issues: testIssues,
|
|
209
|
-
});
|
|
210
|
-
// āāā Calculate Overall āāā
|
|
211
|
-
const overall = Math.round(categories.reduce((sum, c) => sum + c.score, 0) / categories.length);
|
|
212
|
-
return { overall, categories };
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Format score as a bar
|
|
216
|
-
*/
|
|
217
|
-
function scoreBar(score, width = 10) {
|
|
218
|
-
const filled = Math.round((score / 100) * width);
|
|
219
|
-
const empty = width - filled;
|
|
220
|
-
const color = score >= 80 ? "š©" : score >= 60 ? "šØ" : "š„";
|
|
221
|
-
return color.repeat(filled) + "ā¬".repeat(empty);
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Get grade from score
|
|
225
|
-
*/
|
|
226
|
-
function getGrade(score) {
|
|
227
|
-
if (score >= 90)
|
|
228
|
-
return "A";
|
|
229
|
-
if (score >= 80)
|
|
230
|
-
return "B";
|
|
231
|
-
if (score >= 70)
|
|
232
|
-
return "C";
|
|
233
|
-
if (score >= 60)
|
|
234
|
-
return "D";
|
|
235
|
-
return "F";
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Format rate result for terminal
|
|
239
|
-
*/
|
|
240
|
-
export function formatRateResult(result) {
|
|
241
|
-
const lines = [];
|
|
242
|
-
lines.push("āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā");
|
|
243
|
-
const gradeText = ` (${getGrade(result.overall)})`;
|
|
244
|
-
const scoreText = `š CODE QUALITY SCORE: ${result.overall}/100${gradeText}`;
|
|
245
|
-
const padding = Math.max(0, 55 - scoreText.length);
|
|
246
|
-
lines.push(`ā ${scoreText}${" ".repeat(padding)}ā`);
|
|
247
|
-
lines.push("āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤");
|
|
248
|
-
for (const cat of result.categories) {
|
|
249
|
-
const name = cat.name.padEnd(14);
|
|
250
|
-
const bar = scoreBar(cat.score);
|
|
251
|
-
const score = String(cat.score).padStart(3);
|
|
252
|
-
lines.push(`ā ${cat.icon} ${name} ${bar} ${score} ā`);
|
|
253
|
-
}
|
|
254
|
-
lines.push("āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā");
|
|
255
|
-
// Show issues if any
|
|
256
|
-
const allIssues = result.categories
|
|
257
|
-
.filter((c) => c.issues.length > 0)
|
|
258
|
-
.flatMap((c) => c.issues.map((i) => `${c.icon} ${c.name}: ${i}`));
|
|
259
|
-
if (allIssues.length > 0) {
|
|
260
|
-
lines.push("");
|
|
261
|
-
lines.push("Issues to address:");
|
|
262
|
-
for (const issue of allIssues.slice(0, 5)) {
|
|
263
|
-
lines.push(` ⢠${issue}`);
|
|
264
|
-
}
|
|
265
|
-
if (allIssues.length > 5) {
|
|
266
|
-
lines.push(` ... and ${allIssues.length - 5} more`);
|
|
267
|
-
}
|
|
268
|
-
lines.push("");
|
|
269
|
-
lines.push("š” Run /lens-booboo for full details");
|
|
270
|
-
}
|
|
271
|
-
return lines.join("\n");
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Handle /lens-rate command
|
|
275
|
-
*/
|
|
276
|
-
export async function handleRate(args, ctx, clients) {
|
|
277
|
-
const targetPath = args.trim() || ctx.cwd || process.cwd();
|
|
278
|
-
ctx.ui.notify("š Calculating code quality scores...", "info");
|
|
279
|
-
const result = await gatherScores(targetPath, clients);
|
|
280
|
-
return formatRateResult(result);
|
|
281
|
-
}
|
package/commands/rate.test.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { formatRateResult } from "./rate.js";
|
|
3
|
-
// Test the formatting functions directly with mock data
|
|
4
|
-
describe("formatRateResult", () => {
|
|
5
|
-
it("should format a visual score breakdown", () => {
|
|
6
|
-
const result = {
|
|
7
|
-
overall: 75,
|
|
8
|
-
categories: [
|
|
9
|
-
{ name: "Type Safety", score: 85, icon: "š·", issues: [] },
|
|
10
|
-
{ name: "Complexity", score: 70, icon: "š§©", issues: [] },
|
|
11
|
-
{ name: "Security", score: 100, icon: "š", issues: [] },
|
|
12
|
-
{ name: "Architecture", score: 85, icon: "šļø", issues: [] },
|
|
13
|
-
{ name: "Dead Code", score: 100, icon: "šļø", issues: [] },
|
|
14
|
-
{ name: "Tests", score: 100, icon: "ā
", issues: [] },
|
|
15
|
-
],
|
|
16
|
-
};
|
|
17
|
-
const output = formatRateResult(result);
|
|
18
|
-
expect(output).toContain("CODE QUALITY SCORE");
|
|
19
|
-
expect(output).toContain("75/100");
|
|
20
|
-
expect(output).toContain("Type Safety");
|
|
21
|
-
expect(output).toContain("Security");
|
|
22
|
-
expect(output).toContain("Tests");
|
|
23
|
-
});
|
|
24
|
-
it("should show correct grade for A", () => {
|
|
25
|
-
const result = {
|
|
26
|
-
overall: 95,
|
|
27
|
-
categories: Array(6).fill({
|
|
28
|
-
name: "Test",
|
|
29
|
-
score: 95,
|
|
30
|
-
icon: "ā
",
|
|
31
|
-
issues: [],
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
const output = formatRateResult(result);
|
|
35
|
-
expect(output).toContain("A");
|
|
36
|
-
});
|
|
37
|
-
it("should show correct grade for B", () => {
|
|
38
|
-
const result = {
|
|
39
|
-
overall: 85,
|
|
40
|
-
categories: Array(6).fill({
|
|
41
|
-
name: "Test",
|
|
42
|
-
score: 85,
|
|
43
|
-
icon: "ā
",
|
|
44
|
-
issues: [],
|
|
45
|
-
}),
|
|
46
|
-
};
|
|
47
|
-
const output = formatRateResult(result);
|
|
48
|
-
expect(output).toContain("B");
|
|
49
|
-
});
|
|
50
|
-
it("should show correct grade for C", () => {
|
|
51
|
-
const result = {
|
|
52
|
-
overall: 75,
|
|
53
|
-
categories: Array(6).fill({
|
|
54
|
-
name: "Test",
|
|
55
|
-
score: 75,
|
|
56
|
-
icon: "ā
",
|
|
57
|
-
issues: [],
|
|
58
|
-
}),
|
|
59
|
-
};
|
|
60
|
-
const output = formatRateResult(result);
|
|
61
|
-
expect(output).toContain("C");
|
|
62
|
-
});
|
|
63
|
-
it("should show issues section when there are problems", () => {
|
|
64
|
-
const result = {
|
|
65
|
-
overall: 50,
|
|
66
|
-
categories: [
|
|
67
|
-
{
|
|
68
|
-
name: "Type Safety",
|
|
69
|
-
score: 50,
|
|
70
|
-
icon: "š·",
|
|
71
|
-
issues: ["50 untyped identifiers"],
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: "Complexity",
|
|
75
|
-
score: 50,
|
|
76
|
-
icon: "š§©",
|
|
77
|
-
issues: ["High complexity: foo.ts"],
|
|
78
|
-
},
|
|
79
|
-
{ name: "Security", score: 100, icon: "š", issues: [] },
|
|
80
|
-
{ name: "Architecture", score: 100, icon: "šļø", issues: [] },
|
|
81
|
-
{ name: "Dead Code", score: 100, icon: "šļø", issues: [] },
|
|
82
|
-
{ name: "Tests", score: 100, icon: "ā
", issues: [] },
|
|
83
|
-
],
|
|
84
|
-
};
|
|
85
|
-
const output = formatRateResult(result);
|
|
86
|
-
expect(output).toContain("Issues to address");
|
|
87
|
-
expect(output).toContain("Type Safety");
|
|
88
|
-
expect(output).toContain("/lens-booboo");
|
|
89
|
-
});
|
|
90
|
-
it("should not show issues section when clean", () => {
|
|
91
|
-
const result = {
|
|
92
|
-
overall: 100,
|
|
93
|
-
categories: Array(6).fill({
|
|
94
|
-
name: "Test",
|
|
95
|
-
score: 100,
|
|
96
|
-
icon: "ā
",
|
|
97
|
-
issues: [],
|
|
98
|
-
}),
|
|
99
|
-
};
|
|
100
|
-
const output = formatRateResult(result);
|
|
101
|
-
expect(output).not.toContain("Issues to address");
|
|
102
|
-
});
|
|
103
|
-
it("should use colored bars based on score", () => {
|
|
104
|
-
const resultHigh = {
|
|
105
|
-
overall: 90,
|
|
106
|
-
categories: [{ name: "Test", score: 85, icon: "ā
", issues: [] }],
|
|
107
|
-
};
|
|
108
|
-
const resultLow = {
|
|
109
|
-
overall: 50,
|
|
110
|
-
categories: [{ name: "Test", score: 50, icon: "ā
", issues: [] }],
|
|
111
|
-
};
|
|
112
|
-
const outputHigh = formatRateResult(resultHigh);
|
|
113
|
-
const outputLow = formatRateResult(resultLow);
|
|
114
|
-
// High score should have green squares
|
|
115
|
-
expect(outputHigh).toContain("š©");
|
|
116
|
-
// Low score should have red squares
|
|
117
|
-
expect(outputLow).toContain("š„");
|
|
118
|
-
});
|
|
119
|
-
});
|
package/commands/rate.test.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { formatRateResult } from "./rate.js";
|
|
3
|
-
|
|
4
|
-
// Test the formatting functions directly with mock data
|
|
5
|
-
|
|
6
|
-
describe("formatRateResult", () => {
|
|
7
|
-
it("should format a visual score breakdown", () => {
|
|
8
|
-
const result = {
|
|
9
|
-
overall: 75,
|
|
10
|
-
categories: [
|
|
11
|
-
{ name: "Type Safety", score: 85, icon: "š·", issues: [] },
|
|
12
|
-
{ name: "Complexity", score: 70, icon: "š§©", issues: [] },
|
|
13
|
-
{ name: "Security", score: 100, icon: "š", issues: [] },
|
|
14
|
-
{ name: "Architecture", score: 85, icon: "šļø", issues: [] },
|
|
15
|
-
{ name: "Dead Code", score: 100, icon: "šļø", issues: [] },
|
|
16
|
-
{ name: "Tests", score: 100, icon: "ā
", issues: [] },
|
|
17
|
-
],
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const output = formatRateResult(result);
|
|
21
|
-
|
|
22
|
-
expect(output).toContain("CODE QUALITY SCORE");
|
|
23
|
-
expect(output).toContain("75/100");
|
|
24
|
-
expect(output).toContain("Type Safety");
|
|
25
|
-
expect(output).toContain("Security");
|
|
26
|
-
expect(output).toContain("Tests");
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("should show correct grade for A", () => {
|
|
30
|
-
const result = {
|
|
31
|
-
overall: 95,
|
|
32
|
-
categories: Array(6).fill({
|
|
33
|
-
name: "Test",
|
|
34
|
-
score: 95,
|
|
35
|
-
icon: "ā
",
|
|
36
|
-
issues: [],
|
|
37
|
-
}),
|
|
38
|
-
};
|
|
39
|
-
const output = formatRateResult(result);
|
|
40
|
-
expect(output).toContain("A");
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("should show correct grade for B", () => {
|
|
44
|
-
const result = {
|
|
45
|
-
overall: 85,
|
|
46
|
-
categories: Array(6).fill({
|
|
47
|
-
name: "Test",
|
|
48
|
-
score: 85,
|
|
49
|
-
icon: "ā
",
|
|
50
|
-
issues: [],
|
|
51
|
-
}),
|
|
52
|
-
};
|
|
53
|
-
const output = formatRateResult(result);
|
|
54
|
-
expect(output).toContain("B");
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("should show correct grade for C", () => {
|
|
58
|
-
const result = {
|
|
59
|
-
overall: 75,
|
|
60
|
-
categories: Array(6).fill({
|
|
61
|
-
name: "Test",
|
|
62
|
-
score: 75,
|
|
63
|
-
icon: "ā
",
|
|
64
|
-
issues: [],
|
|
65
|
-
}),
|
|
66
|
-
};
|
|
67
|
-
const output = formatRateResult(result);
|
|
68
|
-
expect(output).toContain("C");
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("should show issues section when there are problems", () => {
|
|
72
|
-
const result = {
|
|
73
|
-
overall: 50,
|
|
74
|
-
categories: [
|
|
75
|
-
{
|
|
76
|
-
name: "Type Safety",
|
|
77
|
-
score: 50,
|
|
78
|
-
icon: "š·",
|
|
79
|
-
issues: ["50 untyped identifiers"],
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "Complexity",
|
|
83
|
-
score: 50,
|
|
84
|
-
icon: "š§©",
|
|
85
|
-
issues: ["High complexity: foo.ts"],
|
|
86
|
-
},
|
|
87
|
-
{ name: "Security", score: 100, icon: "š", issues: [] },
|
|
88
|
-
{ name: "Architecture", score: 100, icon: "šļø", issues: [] },
|
|
89
|
-
{ name: "Dead Code", score: 100, icon: "šļø", issues: [] },
|
|
90
|
-
{ name: "Tests", score: 100, icon: "ā
", issues: [] },
|
|
91
|
-
],
|
|
92
|
-
};
|
|
93
|
-
const output = formatRateResult(result);
|
|
94
|
-
expect(output).toContain("Issues to address");
|
|
95
|
-
expect(output).toContain("Type Safety");
|
|
96
|
-
expect(output).toContain("/lens-booboo");
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("should not show issues section when clean", () => {
|
|
100
|
-
const result = {
|
|
101
|
-
overall: 100,
|
|
102
|
-
categories: Array(6).fill({
|
|
103
|
-
name: "Test",
|
|
104
|
-
score: 100,
|
|
105
|
-
icon: "ā
",
|
|
106
|
-
issues: [],
|
|
107
|
-
}),
|
|
108
|
-
};
|
|
109
|
-
const output = formatRateResult(result);
|
|
110
|
-
expect(output).not.toContain("Issues to address");
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("should use colored bars based on score", () => {
|
|
114
|
-
const resultHigh = {
|
|
115
|
-
overall: 90,
|
|
116
|
-
categories: [{ name: "Test", score: 85, icon: "ā
", issues: [] }],
|
|
117
|
-
};
|
|
118
|
-
const resultLow = {
|
|
119
|
-
overall: 50,
|
|
120
|
-
categories: [{ name: "Test", score: 50, icon: "ā
", issues: [] }],
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const outputHigh = formatRateResult(resultHigh);
|
|
124
|
-
const outputLow = formatRateResult(resultLow);
|
|
125
|
-
|
|
126
|
-
// High score should have green squares
|
|
127
|
-
expect(outputHigh).toContain("š©");
|
|
128
|
-
// Low score should have red squares
|
|
129
|
-
expect(outputLow).toContain("š„");
|
|
130
|
-
});
|
|
131
|
-
});
|
package/commands/refactor.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import * as nodeFs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { createAutoLoop } from "../clients/auto-loop.js";
|
|
4
|
-
import { scanArchitectViolations, scanComplexityMetrics, scanSkipViolations, scoreFiles, } from "../clients/scan-architectural-debt.js";
|
|
5
|
-
// Auto-loop singleton for refactor command (initialized at module load)
|
|
6
|
-
let refactorLoop = null;
|
|
7
|
-
export function initRefactorLoop(pi) {
|
|
8
|
-
if (!refactorLoop) {
|
|
9
|
-
refactorLoop = createAutoLoop(pi, {
|
|
10
|
-
name: "refactor",
|
|
11
|
-
maxIterations: 5,
|
|
12
|
-
command: "/lens-booboo-refactor --loop",
|
|
13
|
-
exitPatterns: [
|
|
14
|
-
/ā
No architectural debt found/,
|
|
15
|
-
/No more files to refactor/,
|
|
16
|
-
],
|
|
17
|
-
completionPatterns: [/ā
No architectural debt found/],
|
|
18
|
-
continuePrompt: "Continue to next worst offender with /lens-booboo-refactor --loop",
|
|
19
|
-
});
|
|
20
|
-
// refactor auto-loop initialized silently
|
|
21
|
-
}
|
|
22
|
-
return refactorLoop;
|
|
23
|
-
}
|
|
24
|
-
function getRefactorLoop(pi) {
|
|
25
|
-
if (!refactorLoop) {
|
|
26
|
-
return initRefactorLoop(pi);
|
|
27
|
-
}
|
|
28
|
-
return refactorLoop;
|
|
29
|
-
}
|
|
30
|
-
export async function handleRefactor(args, ctx, clients, pi, skipRules, ruleActions) {
|
|
31
|
-
const loopMode = args.includes("--loop");
|
|
32
|
-
const cleanArgs = args.replace("--loop", "").trim();
|
|
33
|
-
const targetPath = cleanArgs || ctx.cwd || process.cwd();
|
|
34
|
-
// Initialize auto-loop if --loop flag
|
|
35
|
-
const loop = getRefactorLoop(pi);
|
|
36
|
-
if (loopMode && !loop.getState().active) {
|
|
37
|
-
loop.start(ctx);
|
|
38
|
-
}
|
|
39
|
-
ctx.ui.notify("šļø Scanning for architectural debt...", "info");
|
|
40
|
-
const configPath = path.join(process.cwd(), "rules", "ast-grep-rules", ".sgconfig.yml");
|
|
41
|
-
const isTsProject = nodeFs.existsSync(path.join(targetPath, "tsconfig.json"));
|
|
42
|
-
const skipByFile = scanSkipViolations(clients.astGrep, configPath, targetPath, isTsProject, skipRules, ruleActions);
|
|
43
|
-
const metricsByFile = scanComplexityMetrics(clients.complexity, targetPath, isTsProject);
|
|
44
|
-
const architectViolations = clients.architect.hasConfig()
|
|
45
|
-
? scanArchitectViolations(clients.architect, targetPath)
|
|
46
|
-
: new Map();
|
|
47
|
-
const scored = scoreFiles(skipByFile, metricsByFile, architectViolations);
|
|
48
|
-
if (scored.length === 0) {
|
|
49
|
-
ctx.ui.notify("ā
No architectural debt found ā codebase is clean.", "info");
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// --- Write ranked list to TSV for agent reference ---
|
|
53
|
-
const reportDir = path.join(process.cwd(), ".pi-lens", "reports");
|
|
54
|
-
nodeFs.mkdirSync(reportDir, { recursive: true });
|
|
55
|
-
const reportPath = path.join(reportDir, "refactor-ranked.tsv");
|
|
56
|
-
const tsvRows = [
|
|
57
|
-
"rank\tfile\tscore\tmi\tcognitive\tnesting\tviolations",
|
|
58
|
-
];
|
|
59
|
-
scored.slice(0, 50).forEach((f, i) => {
|
|
60
|
-
const m = metricsByFile.get(f.file);
|
|
61
|
-
const skipCount = skipByFile.get(f.file)?.length ?? 0;
|
|
62
|
-
const archCount = architectViolations?.get(f.file)?.length ?? 0;
|
|
63
|
-
const totalViolations = skipCount + archCount;
|
|
64
|
-
const relPath = path.relative(targetPath, f.file).replace(/\\/g, "/");
|
|
65
|
-
tsvRows.push(`${i + 1}\t${relPath}\t${f.score}\t${m?.mi.toFixed(1) ?? "-"}\t${m?.cognitive ?? "-"}\t${m?.nesting ?? "-"}\t${totalViolations}`);
|
|
66
|
-
});
|
|
67
|
-
nodeFs.writeFileSync(reportPath, tsvRows.join("\n"), "utf-8");
|
|
68
|
-
// --- Current worst offender ---
|
|
69
|
-
const { file: worstFile, score } = scored[0];
|
|
70
|
-
const relFile = path.relative(targetPath, worstFile).replace(/\\/g, "/");
|
|
71
|
-
const issues = skipByFile.get(worstFile) ?? [];
|
|
72
|
-
const metrics = metricsByFile.get(worstFile);
|
|
73
|
-
const archIssues = architectViolations.get(worstFile) ?? [];
|
|
74
|
-
const ruleGroups = new Map();
|
|
75
|
-
for (const i of issues)
|
|
76
|
-
ruleGroups.set(i.rule, (ruleGroups.get(i.rule) ?? 0) + 1);
|
|
77
|
-
const issuesSummary = [...ruleGroups.entries()]
|
|
78
|
-
.map(([r, n]) => `- \`${r}\` (Ć${n})${ruleActions[r] ? ` ā ${ruleActions[r].note}` : ""}`)
|
|
79
|
-
.join("\n");
|
|
80
|
-
const archSummary = archIssues.length > 0 ? archIssues.map((m) => `- ${m}`).join("\n") : "None";
|
|
81
|
-
const metricsSummary = metrics
|
|
82
|
-
? `MI: ${metrics.mi.toFixed(1)}, Cognitive: ${metrics.cognitive}, Nesting: ${metrics.nesting}`
|
|
83
|
-
: "";
|
|
84
|
-
// First violation line for quick reference
|
|
85
|
-
const firstViolationLine = issues.length > 0 ? issues[0].line : null;
|
|
86
|
-
// --- Full ranked list in terminal (agent won't read TSV) ---
|
|
87
|
-
const topFiles = scored
|
|
88
|
-
.slice(0, 15)
|
|
89
|
-
.map((f, i) => {
|
|
90
|
-
const name = path.relative(targetPath, f.file).replace(/\\/g, "/");
|
|
91
|
-
const m = metricsByFile.get(f.file);
|
|
92
|
-
const mi = m ? `MI:${m.mi.toFixed(0)}` : "";
|
|
93
|
-
return ` ${i + 1}. ${name} (${f.score} pts${mi ? `, ${mi}` : ""})`;
|
|
94
|
-
})
|
|
95
|
-
.join("\n");
|
|
96
|
-
ctx.ui.notify(`šļø Worst: ${relFile} (score: ${score}) ā ${scored.length} files with debt`, "info");
|
|
97
|
-
console.log(`\nš Ranked by debt score:\n${topFiles}${scored.length > 15 ? `\n ... and ${scored.length - 15} more` : ""}\n`);
|
|
98
|
-
// --- Steer message for agent ---
|
|
99
|
-
const steer = [
|
|
100
|
-
`šļø BOOBOO REFACTOR ā worst offender identified`,
|
|
101
|
-
"",
|
|
102
|
-
`**File**: \`${relFile}\` (debt score: ${score})`,
|
|
103
|
-
"",
|
|
104
|
-
metrics ? `**Complexity**: ${metricsSummary}` : "",
|
|
105
|
-
"",
|
|
106
|
-
issues.length > 0 ? `**Violations**:\n${issuesSummary}` : "",
|
|
107
|
-
archIssues.length > 0
|
|
108
|
-
? `**Architectural rules violated**:\n${archSummary}`
|
|
109
|
-
: "",
|
|
110
|
-
firstViolationLine ? `First violation at line ${firstViolationLine}` : "",
|
|
111
|
-
"",
|
|
112
|
-
`š Read \`${relFile}\` when ready to implement`,
|
|
113
|
-
"",
|
|
114
|
-
"**Your job**:",
|
|
115
|
-
"1. Analyze this code ā what's the most impactful refactoring for this file?",
|
|
116
|
-
"2. Build 3-5 refactoring options. For each, explain *why* it helps and *what* you'd change. Mark one as recommended.",
|
|
117
|
-
"3. For each option, estimate the impact: linesReduced (number), miProjection (e.g. '3.5 ā 8'), cognitiveProjection (e.g. '1533 ā 1400').",
|
|
118
|
-
"4. Include an option to skip to the next worst offender.",
|
|
119
|
-
"5. Call the `interviewer` tool with:",
|
|
120
|
-
" - `question`: what you're asking the user",
|
|
121
|
-
" - `options`: array of { value, label, context, recommended, impact: { linesReduced, miProjection, cognitiveProjection } }",
|
|
122
|
-
"6. The user picks an option or types a free-text response in the browser form.",
|
|
123
|
-
"7. Implement the refactoring. After changes, run `git diff HEAD~1` to capture what was changed.",
|
|
124
|
-
"8. Run a complexity scan on the changed file(s) to compute the metrics delta (before vs after MI, cognitive).",
|
|
125
|
-
"9. Call the `interviewer` tool AGAIN with confirmationMode=true. The plan should contain: what was changed (summary + diff lines), how metrics evolved, and a free-chat option for refinements.",
|
|
126
|
-
"10. If the user describes changes: make further edits, re-run the scan, call interviewer again with an updated report. Repeat until satisfied.",
|
|
127
|
-
"11. CRITICAL: Once the user is satisfied with the current file, you MUST re-scan the project (or re-run /lens-booboo-refactor) and immediately start the process for the NEXT worst offender. Do not stop until all architectural debt is resolved.",
|
|
128
|
-
].join("\n");
|
|
129
|
-
pi.sendUserMessage(steer, { deliverAs: "steer" });
|
|
130
|
-
}
|