@kevinrabun/judges 3.58.0 → 3.59.0
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 +12 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/api-misuse.d.ts +5 -0
- package/dist/commands/api-misuse.d.ts.map +1 -0
- package/dist/commands/api-misuse.js +261 -0
- package/dist/commands/api-misuse.js.map +1 -0
- package/dist/commands/completion-audit.d.ts +5 -0
- package/dist/commands/completion-audit.d.ts.map +1 -0
- package/dist/commands/completion-audit.js +297 -0
- package/dist/commands/completion-audit.js.map +1 -0
- package/dist/commands/cross-file-consistency.d.ts +5 -0
- package/dist/commands/cross-file-consistency.d.ts.map +1 -0
- package/dist/commands/cross-file-consistency.js +255 -0
- package/dist/commands/cross-file-consistency.js.map +1 -0
- package/dist/commands/example-leak.d.ts +5 -0
- package/dist/commands/example-leak.d.ts.map +1 -0
- package/dist/commands/example-leak.js +233 -0
- package/dist/commands/example-leak.js.map +1 -0
- package/dist/commands/logic-lint.d.ts +5 -0
- package/dist/commands/logic-lint.d.ts.map +1 -0
- package/dist/commands/logic-lint.js +256 -0
- package/dist/commands/logic-lint.js.map +1 -0
- package/dist/commands/phantom-import.d.ts +5 -0
- package/dist/commands/phantom-import.d.ts.map +1 -0
- package/dist/commands/phantom-import.js +261 -0
- package/dist/commands/phantom-import.js.map +1 -0
- package/dist/commands/review-focus.d.ts +5 -0
- package/dist/commands/review-focus.d.ts.map +1 -0
- package/dist/commands/review-focus.js +197 -0
- package/dist/commands/review-focus.js.map +1 -0
- package/dist/commands/spec-conform.d.ts +5 -0
- package/dist/commands/spec-conform.d.ts.map +1 -0
- package/dist/commands/spec-conform.js +305 -0
- package/dist/commands/spec-conform.js.map +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API misuse — detect incorrect API usage patterns that AI commonly generates.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
5
|
+
import { join, extname } from "path";
|
|
6
|
+
// ─── File Collection ────────────────────────────────────────────────────────
|
|
7
|
+
const CODE_EXTS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".java", ".go"]);
|
|
8
|
+
function collectFiles(dir, max = 300) {
|
|
9
|
+
const files = [];
|
|
10
|
+
function walk(d) {
|
|
11
|
+
if (files.length >= max)
|
|
12
|
+
return;
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = readdirSync(d);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const e of entries) {
|
|
21
|
+
if (files.length >= max)
|
|
22
|
+
return;
|
|
23
|
+
if (e.startsWith(".") || e === "node_modules" || e === "dist" || e === "build")
|
|
24
|
+
continue;
|
|
25
|
+
const full = join(d, e);
|
|
26
|
+
try {
|
|
27
|
+
if (statSync(full).isDirectory())
|
|
28
|
+
walk(full);
|
|
29
|
+
else if (CODE_EXTS.has(extname(full)))
|
|
30
|
+
files.push(full);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* skip */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
walk(dir);
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
// ─── Analysis ───────────────────────────────────────────────────────────────
|
|
41
|
+
function analyzeFile(filepath) {
|
|
42
|
+
const issues = [];
|
|
43
|
+
let content;
|
|
44
|
+
try {
|
|
45
|
+
content = readFileSync(filepath, "utf-8");
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return issues;
|
|
49
|
+
}
|
|
50
|
+
const lines = content.split("\n");
|
|
51
|
+
for (let i = 0; i < lines.length; i++) {
|
|
52
|
+
const line = lines[i];
|
|
53
|
+
const trimmed = line.trim();
|
|
54
|
+
// Array.forEach with async callback (doesn't await)
|
|
55
|
+
if (/\.forEach\s*\(\s*async\b/.test(trimmed)) {
|
|
56
|
+
issues.push({
|
|
57
|
+
file: filepath,
|
|
58
|
+
line: i + 1,
|
|
59
|
+
issue: "async forEach (doesn't await)",
|
|
60
|
+
severity: "high",
|
|
61
|
+
detail: "Array.forEach ignores returned promises — use `for...of` with `await` or `Promise.all` with `.map`",
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// JSON.parse without try/catch
|
|
65
|
+
if (/JSON\.parse\s*\(/.test(trimmed)) {
|
|
66
|
+
const block = lines.slice(Math.max(0, i - 5), i + 1).join("\n");
|
|
67
|
+
if (!/try\s*\{|catch|\.catch|safeParse|tryCatch/i.test(block)) {
|
|
68
|
+
issues.push({
|
|
69
|
+
file: filepath,
|
|
70
|
+
line: i + 1,
|
|
71
|
+
issue: "JSON.parse without error handling",
|
|
72
|
+
severity: "medium",
|
|
73
|
+
detail: "JSON.parse throws on invalid input — wrap in try/catch or use a safe parser",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// fetch/axios without error status check
|
|
78
|
+
if (/(?:await\s+)?fetch\s*\(/.test(trimmed) &&
|
|
79
|
+
!/\.ok|\.status|response\.ok|res\.ok/.test(lines.slice(i, Math.min(i + 5, lines.length)).join("\n"))) {
|
|
80
|
+
const block = lines.slice(i, Math.min(i + 8, lines.length)).join("\n");
|
|
81
|
+
if (/\.json\(\)/.test(block) && !/\.ok|\.status|response\.ok|res\.ok|catch|reject/.test(block)) {
|
|
82
|
+
issues.push({
|
|
83
|
+
file: filepath,
|
|
84
|
+
line: i + 1,
|
|
85
|
+
issue: "fetch() without status check",
|
|
86
|
+
severity: "high",
|
|
87
|
+
detail: "fetch() doesn't reject on HTTP errors — check `response.ok` before calling `.json()`",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Array methods on possibly undefined (no optional chaining)
|
|
92
|
+
if (/\.\w+\.(map|filter|reduce|find|forEach|some|every)\s*\(/.test(trimmed)) {
|
|
93
|
+
const dotChain = trimmed.match(/(\w+)\.(\w+)\.(map|filter|reduce|find|forEach|some|every)/);
|
|
94
|
+
if (dotChain && !trimmed.includes("?.") && !/\(/.test(dotChain[2])) {
|
|
95
|
+
// Check if the property could be undefined
|
|
96
|
+
const propName = `${dotChain[1]}.${dotChain[2]}`;
|
|
97
|
+
if (!/\bconst\b/.test(trimmed) && !/length|size/.test(dotChain[2])) {
|
|
98
|
+
issues.push({
|
|
99
|
+
file: filepath,
|
|
100
|
+
line: i + 1,
|
|
101
|
+
issue: "Array method on possibly undefined property",
|
|
102
|
+
severity: "medium",
|
|
103
|
+
detail: `\`${propName}\` might be undefined — use optional chaining or null check before \`.${dotChain[3]}()\``,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// setTimeout/setInterval with string argument
|
|
109
|
+
if (/(?:setTimeout|setInterval)\s*\(\s*['"]/.test(trimmed)) {
|
|
110
|
+
issues.push({
|
|
111
|
+
file: filepath,
|
|
112
|
+
line: i + 1,
|
|
113
|
+
issue: "setTimeout/setInterval with string (eval)",
|
|
114
|
+
severity: "high",
|
|
115
|
+
detail: "String argument to setTimeout/setInterval is evaluated with eval — use a function instead",
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
// RegExp constructor with unescaped user input
|
|
119
|
+
if (/new\s+RegExp\s*\(/.test(trimmed)) {
|
|
120
|
+
const arg = trimmed.match(/new\s+RegExp\s*\(\s*(\w+)/)?.[1];
|
|
121
|
+
if (arg && !/escape|sanitize|literal|fixed|constant|regex/i.test(trimmed)) {
|
|
122
|
+
issues.push({
|
|
123
|
+
file: filepath,
|
|
124
|
+
line: i + 1,
|
|
125
|
+
issue: "RegExp from variable (ReDoS risk)",
|
|
126
|
+
severity: "medium",
|
|
127
|
+
detail: `\`new RegExp(${arg})\` — if ${arg} is user input, this enables ReDoS attacks. Escape special characters first`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Promise constructor anti-pattern
|
|
132
|
+
if (/new\s+Promise\s*\(\s*async\b/.test(trimmed)) {
|
|
133
|
+
issues.push({
|
|
134
|
+
file: filepath,
|
|
135
|
+
line: i + 1,
|
|
136
|
+
issue: "async Promise constructor anti-pattern",
|
|
137
|
+
severity: "medium",
|
|
138
|
+
detail: "async function inside `new Promise()` can swallow rejections — just use async/await directly",
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
// .then().then() chain mixing with await
|
|
142
|
+
if (/\.then\s*\(.*\.then\s*\(/.test(trimmed) ||
|
|
143
|
+
(/\.then\s*\(/.test(trimmed) && /await/.test(lines.slice(Math.max(0, i - 3), i).join("\n")))) {
|
|
144
|
+
if (/await.*\.then\s*\(/.test(lines.slice(Math.max(0, i - 1), i + 1).join("\n"))) {
|
|
145
|
+
issues.push({
|
|
146
|
+
file: filepath,
|
|
147
|
+
line: i + 1,
|
|
148
|
+
issue: "Mixing await with .then() chains",
|
|
149
|
+
severity: "low",
|
|
150
|
+
detail: "Mixing async/await with .then() chains makes code harder to reason about — pick one style",
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Object.keys/values/entries on Map or Set
|
|
155
|
+
if (/Object\.(?:keys|values|entries)\s*\(\s*\w+\s*\)/.test(trimmed)) {
|
|
156
|
+
const varName = trimmed.match(/Object\.(?:keys|values|entries)\s*\(\s*(\w+)\s*\)/)?.[1];
|
|
157
|
+
if (varName) {
|
|
158
|
+
const typeHint = content.match(new RegExp(`(?:Map|Set)\\b[^;]*\\b${varName}\\b|\\b${varName}\\b[^;]*(?:Map|Set)\\b`));
|
|
159
|
+
if (typeHint) {
|
|
160
|
+
issues.push({
|
|
161
|
+
file: filepath,
|
|
162
|
+
line: i + 1,
|
|
163
|
+
issue: "Object.keys/values/entries on Map/Set",
|
|
164
|
+
severity: "high",
|
|
165
|
+
detail: `\`${varName}\` appears to be a Map or Set — use \`.keys()\`, \`.values()\`, or \`.entries()\` methods instead`,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// String.replace without /g flag (replaces only first match)
|
|
171
|
+
if (/\.replace\s*\(\s*['"]/.test(trimmed) && !trimmed.includes("replaceAll")) {
|
|
172
|
+
issues.push({
|
|
173
|
+
file: filepath,
|
|
174
|
+
line: i + 1,
|
|
175
|
+
issue: ".replace() with string (first match only)",
|
|
176
|
+
severity: "low",
|
|
177
|
+
detail: "String.replace with string pattern only replaces the FIRST match — use .replaceAll() or regex with /g flag",
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
// Event listener without passive option for scroll/touch
|
|
181
|
+
if (/addEventListener\s*\(\s*['"](?:scroll|touchstart|touchmove|wheel)['"]/.test(trimmed)) {
|
|
182
|
+
if (!trimmed.includes("passive")) {
|
|
183
|
+
issues.push({
|
|
184
|
+
file: filepath,
|
|
185
|
+
line: i + 1,
|
|
186
|
+
issue: "Scroll/touch listener without passive",
|
|
187
|
+
severity: "low",
|
|
188
|
+
detail: "Add `{ passive: true }` to scroll/touch listeners for better performance",
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Using == instead of === (loose equality)
|
|
193
|
+
if (/[^!=]==[^=]/.test(trimmed) && !/===/.test(trimmed) && !/==\s*null/.test(trimmed)) {
|
|
194
|
+
issues.push({
|
|
195
|
+
file: filepath,
|
|
196
|
+
line: i + 1,
|
|
197
|
+
issue: "Loose equality (==) instead of strict (===)",
|
|
198
|
+
severity: "low",
|
|
199
|
+
detail: "AI often generates `==` — use `===` to avoid type coercion surprises",
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return issues;
|
|
204
|
+
}
|
|
205
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
206
|
+
export function runApiMisuse(argv) {
|
|
207
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
208
|
+
console.log(`
|
|
209
|
+
judges api-misuse — Detect incorrect API usage patterns from AI-generated code
|
|
210
|
+
|
|
211
|
+
Usage:
|
|
212
|
+
judges api-misuse [dir]
|
|
213
|
+
judges api-misuse src/ --format json
|
|
214
|
+
|
|
215
|
+
Options:
|
|
216
|
+
[dir] Directory to scan (default: .)
|
|
217
|
+
--format json JSON output
|
|
218
|
+
--help, -h Show this help
|
|
219
|
+
|
|
220
|
+
Checks: async forEach, unprotected JSON.parse, fetch without status check, setTimeout with string,
|
|
221
|
+
Promise constructor anti-pattern, Object.keys on Map/Set, .replace first-match-only,
|
|
222
|
+
loose equality, RegExp ReDoS, missing passive listeners.
|
|
223
|
+
`);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
227
|
+
const dir = argv.find((a) => !a.startsWith("-") && argv.indexOf(a) > 0) || ".";
|
|
228
|
+
const files = collectFiles(dir);
|
|
229
|
+
const allIssues = [];
|
|
230
|
+
for (const f of files)
|
|
231
|
+
allIssues.push(...analyzeFile(f));
|
|
232
|
+
const highCount = allIssues.filter((i) => i.severity === "high").length;
|
|
233
|
+
const medCount = allIssues.filter((i) => i.severity === "medium").length;
|
|
234
|
+
const score = Math.max(0, 100 - highCount * 10 - medCount * 4);
|
|
235
|
+
if (format === "json") {
|
|
236
|
+
console.log(JSON.stringify({
|
|
237
|
+
issues: allIssues,
|
|
238
|
+
score,
|
|
239
|
+
summary: { high: highCount, medium: medCount, total: allIssues.length },
|
|
240
|
+
timestamp: new Date().toISOString(),
|
|
241
|
+
}, null, 2));
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
const badge = score >= 80 ? "✅ CORRECT" : score >= 50 ? "⚠️ MISUSED" : "❌ BROKEN";
|
|
245
|
+
console.log(`\n API Misuse: ${badge} (${score}/100)\n ─────────────────────────────`);
|
|
246
|
+
if (allIssues.length === 0) {
|
|
247
|
+
console.log(" No API misuse patterns detected.\n");
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
for (const issue of allIssues.slice(0, 25)) {
|
|
251
|
+
const icon = issue.severity === "high" ? "🔴" : issue.severity === "medium" ? "🟡" : "🔵";
|
|
252
|
+
console.log(` ${icon} ${issue.issue}`);
|
|
253
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
254
|
+
console.log(` ${issue.detail}`);
|
|
255
|
+
}
|
|
256
|
+
if (allIssues.length > 25)
|
|
257
|
+
console.log(` ... and ${allIssues.length - 25} more`);
|
|
258
|
+
console.log(`\n Total: ${allIssues.length} | High: ${highCount} | Medium: ${medCount} | Score: ${score}/100\n`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=api-misuse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-misuse.js","sourceRoot":"","sources":["../../src/commands/api-misuse.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAYrC,+EAA+E;AAE/E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAEjF,SAAS,YAAY,CAAC,GAAW,EAAE,GAAG,GAAG,GAAG;IAC1C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,SAAS,IAAI,CAAC,CAAS;QACrB,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG;YAAE,OAAO;QAChC,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,GAAG,WAAW,CAAC,CAAC,CAAwB,CAAC;QAClD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,KAAK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ot":"","sources":["../../src/commands/completion-audit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAqQH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA4DvD"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion audit — verify AI-generated code is complete and not truncated.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
5
|
+
import { join, extname } from "path";
|
|
6
|
+
// ─── File Collection ────────────────────────────────────────────────────────
|
|
7
|
+
const CODE_EXTS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".java", ".go", ".rs", ".cs"]);
|
|
8
|
+
function collectFiles(dir, max = 300) {
|
|
9
|
+
const files = [];
|
|
10
|
+
function walk(d) {
|
|
11
|
+
if (files.length >= max)
|
|
12
|
+
return;
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = readdirSync(d);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const e of entries) {
|
|
21
|
+
if (files.length >= max)
|
|
22
|
+
return;
|
|
23
|
+
if (e.startsWith(".") || e === "node_modules" || e === "dist" || e === "build")
|
|
24
|
+
continue;
|
|
25
|
+
const full = join(d, e);
|
|
26
|
+
try {
|
|
27
|
+
if (statSync(full).isDirectory())
|
|
28
|
+
walk(full);
|
|
29
|
+
else if (CODE_EXTS.has(extname(full)))
|
|
30
|
+
files.push(full);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* skip */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
walk(dir);
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
// ─── Analysis ───────────────────────────────────────────────────────────────
|
|
41
|
+
function analyzeFile(filepath) {
|
|
42
|
+
const issues = [];
|
|
43
|
+
let content;
|
|
44
|
+
try {
|
|
45
|
+
content = readFileSync(filepath, "utf-8");
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return issues;
|
|
49
|
+
}
|
|
50
|
+
const lines = content.split("\n");
|
|
51
|
+
// Check bracket balance (unmatched braces, parens, brackets)
|
|
52
|
+
let braces = 0;
|
|
53
|
+
let parens = 0;
|
|
54
|
+
let brackets = 0;
|
|
55
|
+
let inString = false;
|
|
56
|
+
let stringChar = "";
|
|
57
|
+
for (let i = 0; i < content.length; i++) {
|
|
58
|
+
const ch = content[i];
|
|
59
|
+
const prev = i > 0 ? content[i - 1] : "";
|
|
60
|
+
if (inString) {
|
|
61
|
+
if (ch === stringChar && prev !== "\\")
|
|
62
|
+
inString = false;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (ch === '"' || ch === "'" || ch === "`") {
|
|
66
|
+
inString = true;
|
|
67
|
+
stringChar = ch;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (ch === "/" && (content[i + 1] === "/" || content[i + 1] === "*")) {
|
|
71
|
+
if (content[i + 1] === "/") {
|
|
72
|
+
while (i < content.length && content[i] !== "\n")
|
|
73
|
+
i++;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
i += 2;
|
|
77
|
+
while (i < content.length - 1 && !(content[i] === "*" && content[i + 1] === "/"))
|
|
78
|
+
i++;
|
|
79
|
+
i++;
|
|
80
|
+
}
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (ch === "{")
|
|
84
|
+
braces++;
|
|
85
|
+
if (ch === "}")
|
|
86
|
+
braces--;
|
|
87
|
+
if (ch === "(")
|
|
88
|
+
parens++;
|
|
89
|
+
if (ch === ")")
|
|
90
|
+
parens--;
|
|
91
|
+
if (ch === "[")
|
|
92
|
+
brackets++;
|
|
93
|
+
if (ch === "]")
|
|
94
|
+
brackets--;
|
|
95
|
+
}
|
|
96
|
+
if (braces > 0) {
|
|
97
|
+
issues.push({
|
|
98
|
+
file: filepath,
|
|
99
|
+
line: lines.length,
|
|
100
|
+
issue: "Unmatched opening brace(s)",
|
|
101
|
+
severity: "high",
|
|
102
|
+
detail: `${braces} unclosed \`{\` — code may be truncated mid-block`,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
if (parens > 0) {
|
|
106
|
+
issues.push({
|
|
107
|
+
file: filepath,
|
|
108
|
+
line: lines.length,
|
|
109
|
+
issue: "Unmatched opening parenthesis",
|
|
110
|
+
severity: "high",
|
|
111
|
+
detail: `${parens} unclosed \`(\` — function call or expression may be incomplete`,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (brackets > 0) {
|
|
115
|
+
issues.push({
|
|
116
|
+
file: filepath,
|
|
117
|
+
line: lines.length,
|
|
118
|
+
issue: "Unmatched opening bracket",
|
|
119
|
+
severity: "high",
|
|
120
|
+
detail: `${brackets} unclosed \`[\` — array literal may be truncated`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
for (let i = 0; i < lines.length; i++) {
|
|
124
|
+
const line = lines[i];
|
|
125
|
+
const trimmed = line.trim();
|
|
126
|
+
// "... rest of implementation" style truncation markers
|
|
127
|
+
if (/\/\/\s*\.{3}\s*(?:rest|remaining|more|other|additional|etc|and so on|similar|same as|continue|implement)/i.test(trimmed)) {
|
|
128
|
+
issues.push({
|
|
129
|
+
file: filepath,
|
|
130
|
+
line: i + 1,
|
|
131
|
+
issue: "Truncation marker comment",
|
|
132
|
+
severity: "high",
|
|
133
|
+
detail: 'AI left a "... rest" placeholder — code is incomplete',
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
// TODO/FIXME indicating incomplete implementation
|
|
137
|
+
if (/(?:\/\/|#)\s*TODO:?\s*(?:implement|add|finish|complete|fill|write|handle)/i.test(trimmed)) {
|
|
138
|
+
issues.push({
|
|
139
|
+
file: filepath,
|
|
140
|
+
line: i + 1,
|
|
141
|
+
issue: "TODO indicates unfinished implementation",
|
|
142
|
+
severity: "medium",
|
|
143
|
+
detail: "TODO comment suggests code needs additional implementation",
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// throw new Error("not implemented")
|
|
147
|
+
if (/throw\s+new\s+Error\s*\(\s*['"](?:not implemented|todo|fixme|implement me|unimplemented|stub)/i.test(trimmed)) {
|
|
148
|
+
issues.push({
|
|
149
|
+
file: filepath,
|
|
150
|
+
line: i + 1,
|
|
151
|
+
issue: "Not-implemented error thrown",
|
|
152
|
+
severity: "high",
|
|
153
|
+
detail: "Function throws 'not implemented' — AI left a stub that will crash at runtime",
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// pass/NotImplementedError (Python)
|
|
157
|
+
if (/raise\s+NotImplementedError/.test(trimmed)) {
|
|
158
|
+
issues.push({
|
|
159
|
+
file: filepath,
|
|
160
|
+
line: i + 1,
|
|
161
|
+
issue: "NotImplementedError raised",
|
|
162
|
+
severity: "high",
|
|
163
|
+
detail: "Python function raises NotImplementedError — implementation is missing",
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// Empty function/method bodies
|
|
167
|
+
if (/(?:function|def|fn)\s+\w+/.test(trimmed)) {
|
|
168
|
+
const block = lines
|
|
169
|
+
.slice(i + 1, Math.min(i + 4, lines.length))
|
|
170
|
+
.join("\n")
|
|
171
|
+
.trim();
|
|
172
|
+
if (/^(?:\{[\s]*\}|pass\s*$)/.test(block)) {
|
|
173
|
+
issues.push({
|
|
174
|
+
file: filepath,
|
|
175
|
+
line: i + 1,
|
|
176
|
+
issue: "Empty function body",
|
|
177
|
+
severity: "medium",
|
|
178
|
+
detail: "Function declared but body is empty — may be unfinished stub",
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Ellipsis in code (not in strings or comments)
|
|
183
|
+
if (/^\s*\.{3}\s*$/.test(trimmed) && !/['"]/.test(line)) {
|
|
184
|
+
issues.push({
|
|
185
|
+
file: filepath,
|
|
186
|
+
line: i + 1,
|
|
187
|
+
issue: "Ellipsis placeholder",
|
|
188
|
+
severity: "high",
|
|
189
|
+
detail: "Bare `...` on its own line — indicates truncated AI output",
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
// Comment indicating AI truncation
|
|
193
|
+
if (/\/\*\s*\.\.\.\s*\*\//.test(trimmed) || /\/\/\s*\.\.\.\s*$/.test(trimmed)) {
|
|
194
|
+
issues.push({
|
|
195
|
+
file: filepath,
|
|
196
|
+
line: i + 1,
|
|
197
|
+
issue: "Ellipsis comment",
|
|
198
|
+
severity: "medium",
|
|
199
|
+
detail: "Comment with just `...` — AI may have truncated output here",
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// "your code here" / "add your logic"
|
|
203
|
+
if (/(?:your|add|put|insert|write)\s+(?:code|logic|implementation|handling)\s+here/i.test(trimmed)) {
|
|
204
|
+
issues.push({
|
|
205
|
+
file: filepath,
|
|
206
|
+
line: i + 1,
|
|
207
|
+
issue: "Placeholder instruction comment",
|
|
208
|
+
severity: "high",
|
|
209
|
+
detail: 'AI left a "your code here" placeholder — implementation required',
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
// Interface/type with no usage
|
|
213
|
+
if (/(?:interface|type)\s+(\w+)\s*[={<]/.test(trimmed)) {
|
|
214
|
+
const typeName = trimmed.match(/(?:interface|type)\s+(\w+)/)?.[1];
|
|
215
|
+
if (typeName) {
|
|
216
|
+
const usageCount = (content.match(new RegExp(`\\b${typeName}\\b`, "g")) || []).length;
|
|
217
|
+
if (usageCount <= 1 && !/export/.test(trimmed)) {
|
|
218
|
+
issues.push({
|
|
219
|
+
file: filepath,
|
|
220
|
+
line: i + 1,
|
|
221
|
+
issue: "Declared type never used",
|
|
222
|
+
severity: "low",
|
|
223
|
+
detail: `\`${typeName}\` declared but never referenced — may be leftover scaffold`,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// File ends abruptly (last non-empty line is not a closing bracket/brace)
|
|
230
|
+
const lastNonEmpty = lines.filter((l) => l.trim()).pop() || "";
|
|
231
|
+
if (lastNonEmpty.trim() && !/^[}\])]|^$|^\/\/|^\*\/|^#/.test(lastNonEmpty.trim()) && braces !== 0) {
|
|
232
|
+
issues.push({
|
|
233
|
+
file: filepath,
|
|
234
|
+
line: lines.length,
|
|
235
|
+
issue: "File may end abruptly",
|
|
236
|
+
severity: "medium",
|
|
237
|
+
detail: "File ends with unclosed blocks — output may have been truncated",
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
return issues;
|
|
241
|
+
}
|
|
242
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
243
|
+
export function runCompletionAudit(argv) {
|
|
244
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
245
|
+
console.log(`
|
|
246
|
+
judges completion-audit — Verify AI-generated code is complete and not truncated
|
|
247
|
+
|
|
248
|
+
Usage:
|
|
249
|
+
judges completion-audit [dir]
|
|
250
|
+
judges completion-audit src/ --format json
|
|
251
|
+
|
|
252
|
+
Options:
|
|
253
|
+
[dir] Directory to scan (default: .)
|
|
254
|
+
--format json JSON output
|
|
255
|
+
--help, -h Show this help
|
|
256
|
+
|
|
257
|
+
Checks: unmatched brackets/braces, truncation markers, TODO stubs, NotImplementedError,
|
|
258
|
+
empty function bodies, ellipsis placeholders, "your code here" comments, unused types.
|
|
259
|
+
`);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
263
|
+
const dir = argv.find((a) => !a.startsWith("-") && argv.indexOf(a) > 0) || ".";
|
|
264
|
+
const files = collectFiles(dir);
|
|
265
|
+
const allIssues = [];
|
|
266
|
+
for (const f of files)
|
|
267
|
+
allIssues.push(...analyzeFile(f));
|
|
268
|
+
const highCount = allIssues.filter((i) => i.severity === "high").length;
|
|
269
|
+
const medCount = allIssues.filter((i) => i.severity === "medium").length;
|
|
270
|
+
const score = Math.max(0, 100 - highCount * 15 - medCount * 5);
|
|
271
|
+
if (format === "json") {
|
|
272
|
+
console.log(JSON.stringify({
|
|
273
|
+
issues: allIssues,
|
|
274
|
+
score,
|
|
275
|
+
summary: { high: highCount, medium: medCount, total: allIssues.length },
|
|
276
|
+
timestamp: new Date().toISOString(),
|
|
277
|
+
}, null, 2));
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
const badge = score >= 80 ? "✅ COMPLETE" : score >= 50 ? "⚠️ GAPS" : "❌ INCOMPLETE";
|
|
281
|
+
console.log(`\n Completion Audit: ${badge} (${score}/100)\n ─────────────────────────────`);
|
|
282
|
+
if (allIssues.length === 0) {
|
|
283
|
+
console.log(" No completeness issues detected.\n");
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
for (const issue of allIssues.slice(0, 25)) {
|
|
287
|
+
const icon = issue.severity === "high" ? "🔴" : issue.severity === "medium" ? "🟡" : "🔵";
|
|
288
|
+
console.log(` ${icon} ${issue.issue}`);
|
|
289
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
290
|
+
console.log(` ${issue.detail}`);
|
|
291
|
+
}
|
|
292
|
+
if (allIssues.length > 25)
|
|
293
|
+
console.log(` ... and ${allIssues.length - 25} more`);
|
|
294
|
+
console.log(`\n Total: ${allIssues.length} | High: ${highCount} | Medium: ${medCount} | Score: ${score}/100\n`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=completion-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion-audit.js","sourceRoot":"","sources":["../../src/commands/completion-audit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAYrC,+EAA+E;AAE/E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE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