@kevinrabun/judges 3.28.0 → 3.29.2

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +125 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/calibration-dashboard.d.ts +2 -0
  6. package/dist/commands/calibration-dashboard.d.ts.map +1 -0
  7. package/dist/commands/calibration-dashboard.js +97 -0
  8. package/dist/commands/calibration-dashboard.js.map +1 -0
  9. package/dist/commands/community-patterns.d.ts +2 -0
  10. package/dist/commands/community-patterns.d.ts.map +1 -0
  11. package/dist/commands/community-patterns.js +132 -0
  12. package/dist/commands/community-patterns.js.map +1 -0
  13. package/dist/commands/diff.d.ts.map +1 -1
  14. package/dist/commands/diff.js +91 -0
  15. package/dist/commands/diff.js.map +1 -1
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/config.js +26 -0
  18. package/dist/config.js.map +1 -1
  19. package/dist/evaluators/api-contract.d.ts +10 -0
  20. package/dist/evaluators/api-contract.d.ts.map +1 -0
  21. package/dist/evaluators/api-contract.js +204 -0
  22. package/dist/evaluators/api-contract.js.map +1 -0
  23. package/dist/evaluators/api-design.d.ts.map +1 -1
  24. package/dist/evaluators/api-design.js +2 -2
  25. package/dist/evaluators/api-design.js.map +1 -1
  26. package/dist/evaluators/code-structure.d.ts.map +1 -1
  27. package/dist/evaluators/code-structure.js +8 -2
  28. package/dist/evaluators/code-structure.js.map +1 -1
  29. package/dist/evaluators/index.d.ts.map +1 -1
  30. package/dist/evaluators/index.js +33 -1
  31. package/dist/evaluators/index.js.map +1 -1
  32. package/dist/evaluators/intent-alignment.d.ts +15 -0
  33. package/dist/evaluators/intent-alignment.d.ts.map +1 -0
  34. package/dist/evaluators/intent-alignment.js +243 -0
  35. package/dist/evaluators/intent-alignment.js.map +1 -0
  36. package/dist/evaluators/model-fingerprint.d.ts +3 -0
  37. package/dist/evaluators/model-fingerprint.d.ts.map +1 -0
  38. package/dist/evaluators/model-fingerprint.js +152 -0
  39. package/dist/evaluators/model-fingerprint.js.map +1 -0
  40. package/dist/evaluators/multi-turn-coherence.d.ts +14 -0
  41. package/dist/evaluators/multi-turn-coherence.d.ts.map +1 -0
  42. package/dist/evaluators/multi-turn-coherence.js +150 -0
  43. package/dist/evaluators/multi-turn-coherence.js.map +1 -0
  44. package/dist/index.js +2 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/judges/api-contract.d.ts +3 -0
  47. package/dist/judges/api-contract.d.ts.map +1 -0
  48. package/dist/judges/api-contract.js +28 -0
  49. package/dist/judges/api-contract.js.map +1 -0
  50. package/dist/judges/index.d.ts.map +1 -1
  51. package/dist/judges/index.js +16 -0
  52. package/dist/judges/index.js.map +1 -1
  53. package/dist/judges/intent-alignment.d.ts +3 -0
  54. package/dist/judges/intent-alignment.d.ts.map +1 -0
  55. package/dist/judges/intent-alignment.js +28 -0
  56. package/dist/judges/intent-alignment.js.map +1 -0
  57. package/dist/judges/model-fingerprint.d.ts +3 -0
  58. package/dist/judges/model-fingerprint.d.ts.map +1 -0
  59. package/dist/judges/model-fingerprint.js +30 -0
  60. package/dist/judges/model-fingerprint.js.map +1 -0
  61. package/dist/judges/multi-turn-coherence.d.ts +3 -0
  62. package/dist/judges/multi-turn-coherence.d.ts.map +1 -0
  63. package/dist/judges/multi-turn-coherence.js +27 -0
  64. package/dist/judges/multi-turn-coherence.js.map +1 -0
  65. package/dist/patches/index.d.ts.map +1 -1
  66. package/dist/patches/index.js +372 -0
  67. package/dist/patches/index.js.map +1 -1
  68. package/dist/presets.d.ts.map +1 -1
  69. package/dist/presets.js +76 -0
  70. package/dist/presets.js.map +1 -1
  71. package/dist/types.d.ts +44 -0
  72. package/dist/types.d.ts.map +1 -1
  73. package/package.json +2 -2
  74. package/server.json +3 -3
@@ -0,0 +1,243 @@
1
+ import { isCommentLine } from "./shared.js";
2
+ /**
3
+ * Intent-Alignment evaluator — detects mismatches between code's stated intent
4
+ * (names, comments, docstrings) and its actual implementation.
5
+ *
6
+ * Rules:
7
+ * INTENT-001 Stub function with TODO / not-implemented body
8
+ * INTENT-002 Security-sensitive stub (validate/auth/encrypt/sanitize)
9
+ * INTENT-003 Empty or trivial function body
10
+ * INTENT-004 Placeholder return (hardcoded value despite dynamic name)
11
+ * INTENT-005 Docstring param mismatch
12
+ * INTENT-006 Misleading function name (promises behavior it doesn't perform)
13
+ */
14
+ export function analyzeIntentAlignment(code, _language) {
15
+ const findings = [];
16
+ const lines = code.split("\n");
17
+ const prefix = "INTENT";
18
+ // ── INTENT-001 / INTENT-002: Stub functions ──────────────────────────────
19
+ // Detect function bodies that contain only TODO/FIXME/throw "not implemented"
20
+ const stubPattern = /(?:function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?(?:\([^)]*\)|[^=])\s*=>|(\w+)\s*\([^)]*\)\s*(?::\s*\w[^{]*?)?\{|def\s+(\w+)|fn\s+(\w+)|(?:public|private|protected|internal)\s+(?:(?:static|async|override|virtual)\s+)*\w+\s+(\w+)\s*\()/;
21
+ const todoStubBody = /^\s*(?:\/\/\s*TODO|#\s*TODO|\/\*\s*TODO|throw\s+(?:new\s+)?(?:Error|NotImplementedError|UnsupportedOperationException)\s*\(\s*["'](?:not implemented|todo|fixme|stub)|pass\s*(?:#.*)?$|raise\s+NotImplementedError|unimplemented!\(\)|todo!\(\))/im;
22
+ const securityNames = /^(?:validate|verify|authenticate|authorize|check(?:Auth|Permission|Access|Token)|encrypt|decrypt|sanitize|escape|hash(?:Password)?|signToken|verifyToken|filterXss|checkCsrf)/i;
23
+ for (let i = 0; i < lines.length; i++) {
24
+ if (isCommentLine(lines[i]))
25
+ continue;
26
+ const fnMatch = lines[i].match(stubPattern);
27
+ if (!fnMatch)
28
+ continue;
29
+ const fnName = fnMatch[1] || fnMatch[2] || fnMatch[3] || fnMatch[4] || fnMatch[5] || fnMatch[6];
30
+ if (!fnName)
31
+ continue;
32
+ // Look at the next 5 non-empty lines for stub indicators
33
+ const bodyLines = [];
34
+ for (let j = i + 1; j < Math.min(i + 8, lines.length); j++) {
35
+ const trimmed = lines[j].trim();
36
+ if (trimmed === "{" || trimmed === "")
37
+ continue;
38
+ if (trimmed === "}" || trimmed === "}," || trimmed === "};")
39
+ break;
40
+ bodyLines.push(trimmed);
41
+ }
42
+ if (bodyLines.length === 0)
43
+ continue;
44
+ const bodyText = bodyLines.join("\n");
45
+ if (todoStubBody.test(bodyText)) {
46
+ // Skip explicitly deprecated/legacy functions — stubs are expected there
47
+ if (/^(?:old_|legacy_|deprecated_)/i.test(fnName) || /\bdeprecated\b/i.test(bodyText))
48
+ continue;
49
+ const isSecurity = securityNames.test(fnName);
50
+ findings.push({
51
+ ruleId: `${prefix}-${isSecurity ? "002" : "001"}`,
52
+ severity: isSecurity ? "critical" : "medium",
53
+ title: isSecurity ? `Security-sensitive stub: \`${fnName}()\`` : `Stub function: \`${fnName}()\``,
54
+ description: isSecurity
55
+ ? `Function \`${fnName}()\` has a security-sensitive name but its body is a stub (TODO/throw). ` +
56
+ "This means the security check is not actually performed, leaving the system unprotected."
57
+ : `Function \`${fnName}()\` contains only a TODO comment or throws "not implemented". ` +
58
+ "Stub functions that reach production can cause runtime failures.",
59
+ lineNumbers: [i + 1],
60
+ recommendation: isSecurity
61
+ ? `Implement the ${fnName}() function with proper security logic, or remove it and handle the security concern at a higher level.`
62
+ : `Implement the function body or remove it if it's no longer needed. If it's intentionally deferred, add a tracking issue reference.`,
63
+ reference: "Code Review — Stub & Placeholder Detection",
64
+ confidence: isSecurity ? 0.88 : 0.75,
65
+ provenance: "intent-alignment",
66
+ });
67
+ }
68
+ }
69
+ // ── INTENT-003: Empty / trivial function bodies ──────────────────────────
70
+ const emptyFnPattern = /(?:function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?(?:\([^)]*\)|[^=])\s*=>|(\w+)\s*\([^)]*\)\s*(?::\s*\w[^{]*?)?\{|def\s+(\w+)|fn\s+(\w+))/;
71
+ // Require at least 2 empty functions to reduce false positives — a single
72
+ // empty function (e.g. a default trait method, callback stub, or protocol
73
+ // conformance) is common in otherwise well-written code.
74
+ const emptyFnLines = [];
75
+ for (let i = 0; i < lines.length; i++) {
76
+ if (isCommentLine(lines[i]))
77
+ continue;
78
+ const fnMatch = lines[i].match(emptyFnPattern);
79
+ if (!fnMatch)
80
+ continue;
81
+ const fnName = fnMatch[1] || fnMatch[2] || fnMatch[3] || fnMatch[4] || fnMatch[5];
82
+ if (!fnName)
83
+ continue;
84
+ // Check for empty body: { } or => {} or pass
85
+ const nextLines = [];
86
+ for (let j = i + 1; j < Math.min(i + 4, lines.length); j++) {
87
+ nextLines.push(lines[j].trim());
88
+ }
89
+ const next = nextLines.join(" ").trim();
90
+ // Empty body patterns
91
+ const isEmpty = /^(?:\{?\s*\}|return\s*;?\s*\}|return\s+(?:null|undefined|None|nil|false|"")\s*;?\s*\}|pass\s*$)/.test(next);
92
+ if (isEmpty && fnName.length > 2 && !/^(?:noop|empty|stub|mock|fake|dummy|_)/i.test(fnName)) {
93
+ emptyFnLines.push(i + 1);
94
+ }
95
+ }
96
+ if (emptyFnLines.length > 1) {
97
+ findings.push({
98
+ ruleId: `${prefix}-003`,
99
+ severity: "medium",
100
+ title: `Empty function bodies (${emptyFnLines.length} found)`,
101
+ description: `${emptyFnLines.length} functions have empty or trivial bodies (return null/undefined/false with no logic). ` +
102
+ "If this is intentional, consider naming them with a 'noop' prefix or adding a comment.",
103
+ lineNumbers: emptyFnLines.slice(0, 5),
104
+ recommendation: "Implement the function logic, or if they are deliberate no-ops, rename them to signal intent.",
105
+ reference: "Code Review — Empty Implementation Detection",
106
+ confidence: 0.65,
107
+ provenance: "intent-alignment",
108
+ });
109
+ }
110
+ // ── INTENT-004: Placeholder returns (hardcoded value from dynamic name) ──
111
+ const dynamicNames = /^(?:calculate|compute|get|fetch|find|search|lookup|resolve|determine|derive|parse|extract|generate|build|create|load|read)/i;
112
+ for (let i = 0; i < lines.length; i++) {
113
+ if (isCommentLine(lines[i]))
114
+ continue;
115
+ const fnMatch = lines[i].match(emptyFnPattern);
116
+ if (!fnMatch)
117
+ continue;
118
+ const fnName = fnMatch[1] || fnMatch[2] || fnMatch[3] || fnMatch[4] || fnMatch[5];
119
+ if (!fnName || !dynamicNames.test(fnName))
120
+ continue;
121
+ // Check if body is just a single return of a hardcoded value
122
+ const bodyLines = [];
123
+ for (let j = i + 1; j < Math.min(i + 6, lines.length); j++) {
124
+ const trimmed = lines[j].trim();
125
+ if (trimmed === "{" || trimmed === "")
126
+ continue;
127
+ if (trimmed === "}" || trimmed === "}," || trimmed === "};")
128
+ break;
129
+ bodyLines.push(trimmed);
130
+ }
131
+ if (bodyLines.length === 1 &&
132
+ /^return\s+(?:true|false|null|undefined|None|nil|0|-1|""|\[\]|\{\}|'[^']*'|"[^"]*"|\d+)\s*;?$/.test(bodyLines[0])) {
133
+ findings.push({
134
+ ruleId: `${prefix}-004`,
135
+ severity: "medium",
136
+ title: `Placeholder return in \`${fnName}()\``,
137
+ description: `Function \`${fnName}()\` has a name that implies computation or data retrieval, ` +
138
+ `but its body simply returns a hardcoded value: \`${bodyLines[0].trim()}\`.`,
139
+ lineNumbers: [i + 1],
140
+ recommendation: "Implement the actual logic, or rename the function to indicate it returns a constant " +
141
+ "(e.g., `getDefault${fnName.slice(3)}`).",
142
+ reference: "Code Review — Placeholder Detection",
143
+ confidence: 0.7,
144
+ provenance: "intent-alignment",
145
+ });
146
+ }
147
+ }
148
+ // ── INTENT-005: Docstring param mismatch ─────────────────────────────────
149
+ // Detect @param/@arg JSDoc tags that reference non-existent parameters
150
+ const jsdocBlock = /\/\*\*[\s\S]*?\*\//g;
151
+ let jsdocMatch;
152
+ while ((jsdocMatch = jsdocBlock.exec(code)) !== null) {
153
+ const blockStart = code.slice(0, jsdocMatch.index).split("\n").length;
154
+ const docParams = [];
155
+ for (const m of jsdocMatch[0].matchAll(/@param\s+(?:\{[^}]*\}\s+)?(\w+)/g)) {
156
+ docParams.push(m[1]);
157
+ }
158
+ if (docParams.length === 0)
159
+ continue;
160
+ // Find the function signature after this JSDoc block
161
+ const afterDoc = code.slice(jsdocMatch.index + jsdocMatch[0].length, jsdocMatch.index + jsdocMatch[0].length + 300);
162
+ const sigMatch = afterDoc.match(/(?:function\s+\w+|(?:const|let|var)\s+\w+\s*=\s*(?:async\s+)?)\s*\(([^)]*)\)/);
163
+ if (!sigMatch)
164
+ continue;
165
+ const actualParams = sigMatch[1]
166
+ .split(",")
167
+ .map((p) => p
168
+ .trim()
169
+ .replace(/[:=?].*$/, "")
170
+ .replace(/^\.\.\./, "")
171
+ .trim())
172
+ .filter(Boolean);
173
+ const missing = docParams.filter((dp) => !actualParams.includes(dp));
174
+ if (missing.length > 0) {
175
+ findings.push({
176
+ ruleId: `${prefix}-005`,
177
+ severity: "low",
178
+ title: `Docstring references non-existent parameter(s): ${missing.join(", ")}`,
179
+ description: `JSDoc block documents parameter(s) ${missing.map((p) => `\`${p}\``).join(", ")} ` +
180
+ `but the function signature only has: ${actualParams.map((p) => `\`${p}\``).join(", ") || "(none)"}.`,
181
+ lineNumbers: [blockStart],
182
+ recommendation: "Update the JSDoc to match the actual function signature, or add the missing parameters.",
183
+ reference: "Code Documentation Best Practices",
184
+ confidence: 0.8,
185
+ provenance: "intent-alignment",
186
+ });
187
+ }
188
+ }
189
+ // ── INTENT-006: Misleading name — security function without security logic
190
+ const securityFnPattern = /(?:function\s+(validate\w*|verify\w*|authenticate\w*|authorize\w*|sanitize\w*|escape\w*|encrypt\w*|checkPermission\w*)|(?:const|let|var)\s+(validate\w*|verify\w*|authenticate\w*|authorize\w*|sanitize\w*|escape\w*|encrypt\w*|checkPermission\w*)\s*=)/;
191
+ for (let i = 0; i < lines.length; i++) {
192
+ if (isCommentLine(lines[i]))
193
+ continue;
194
+ const secMatch = lines[i].match(securityFnPattern);
195
+ if (!secMatch)
196
+ continue;
197
+ const fnName = secMatch[1] || secMatch[2];
198
+ if (!fnName)
199
+ continue;
200
+ // Collect body (up to 20 lines)
201
+ const bodyLines = [];
202
+ let braceDepth = 0;
203
+ let foundOpen = false;
204
+ for (let j = i; j < Math.min(i + 25, lines.length); j++) {
205
+ const line = lines[j];
206
+ if (line.includes("{")) {
207
+ foundOpen = true;
208
+ braceDepth += (line.match(/\{/g) || []).length;
209
+ }
210
+ if (line.includes("}")) {
211
+ braceDepth -= (line.match(/\}/g) || []).length;
212
+ }
213
+ if (foundOpen)
214
+ bodyLines.push(line);
215
+ if (foundOpen && braceDepth <= 0)
216
+ break;
217
+ }
218
+ const body = bodyLines.join("\n");
219
+ // Check if the body actually performs the promised operation
220
+ const hasSecurityLogic = /(?:bcrypt|argon2|crypto\.|jwt\.|token|hash|hmac|pbkdf|scrypt|verify|compare|sign|encrypt|decrypt|sanitize|escape|encode|decode|salt|DOMPurify|createCipher|createHash|timingSafeEqual)/i.test(body) || /(?:throw|reject|res\.status\s*\(\s*(?:401|403)|unauthorized|forbidden|invalid)/i.test(body);
221
+ // If the function name promises security but body has none, and body is >3 lines
222
+ if (!hasSecurityLogic && bodyLines.length > 3) {
223
+ // Make sure it's not just returning true (already caught by INTENT-004)
224
+ if (!/^(?:\s*return\s+true\s*;?\s*)$/m.test(body)) {
225
+ findings.push({
226
+ ruleId: `${prefix}-006`,
227
+ severity: "high",
228
+ title: `Misleading name: \`${fnName}()\` lacks security logic`,
229
+ description: `Function \`${fnName}()\` has a name that implies security validation, ` +
230
+ "but its body contains no recognizable security operations (hashing, token verification, sanitization, etc.).",
231
+ lineNumbers: [i + 1],
232
+ recommendation: `Either implement proper ${fnName.replace(/[A-Z]/g, (c) => " " + c.toLowerCase()).trim()} logic, ` +
233
+ "or rename the function to accurately reflect what it does.",
234
+ reference: "Secure Development — Naming Conventions",
235
+ confidence: 0.68,
236
+ provenance: "intent-alignment",
237
+ });
238
+ }
239
+ }
240
+ }
241
+ return findings;
242
+ }
243
+ //# sourceMappingUR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AiC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClD,QAAQ,CAAC,IAAI,CAAC;oBACZ,MAAM,EAAE,GAAG,MAAM,MAAM;oBACvB,QAAQ,EAAE,MAAM;oBAChB,KAAK,EAAE,sBAAsB,MAAM,2BAA2B;oBAC9D,WAAW,EACT,cAAc,MAAM,oDAAoD;wBACxE,8GAA8G;oBAChH,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oBACpB,cAAc,EACZ,2BAA2B,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,UAAU;wBAClG,4DAA4D;oBAC9D,SAAS,EAAE,yCAAyC;oBACpD,UAAU,EAAE,IAAI;oBAChB,UAAU,EAAE,kBAAkB;iBAC/B,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Finding } from "../types.js";
2
+ export declare function analyzeModelFingerprint(code: string, _language: string): Finding[];
3
+ //# sourceMappingURL=model-fingerprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-fingerprint.d.ts","sourceRoot":"","sources":["../../src/evaluators/model-fingerprint.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA6G3C,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAmElF"}
@@ -0,0 +1,152 @@
1
+ // ─── Model-Specific AI Fingerprint Detection ─────────────────────────────────
2
+ // Detects stylistic fingerprints and patterns characteristic of specific AI
3
+ // code generators (ChatGPT/GPT-4, Claude, Copilot, Gemini, etc.). These are
4
+ // not security vulnerabilities — they are signals that code was generated by a
5
+ // particular model and may carry that model's known biases or blind spots.
6
+ // ──────────────────────────────────────────────────────────────────────────────
7
+ import { isCommentLine } from "./shared.js";
8
+ const FINGERPRINT_SIGNALS = [
9
+ // ── ChatGPT / GPT-4 signatures ──────────────────────────────────────────
10
+ {
11
+ pattern: /\/\/\s*(?:Example|Note|Remember|Important):\s/,
12
+ model: "ChatGPT/GPT-4",
13
+ description: 'Imperative tutorial-style comments ("Note:", "Remember:", "Important:")',
14
+ weight: 0.3,
15
+ checkComments: true,
16
+ },
17
+ {
18
+ pattern: /\/\/\s*This\s+(?:function|method|class|variable|constant|module)\s+(?:is|will|does|handles|represents)/,
19
+ model: "ChatGPT/GPT-4",
20
+ description: 'Verbose "This function does X" documentation style in inline comments',
21
+ weight: 0.3,
22
+ checkComments: true,
23
+ },
24
+ {
25
+ pattern: /\/\/ (?:Step \d|First,|Second,|Third,|Next,|Finally,|Then,)/,
26
+ model: "ChatGPT/GPT-4",
27
+ description: 'Sequential step-numbered comments ("Step 1:", "First,", "Then,")',
28
+ weight: 0.4,
29
+ checkComments: true,
30
+ },
31
+ {
32
+ pattern: /console\.log\s*\(\s*['"`](?:Result|Output|Data|Response|Error|Success|Value|Hello):/,
33
+ model: "ChatGPT/GPT-4",
34
+ description: "Demonstration console.log with label-colon pattern",
35
+ weight: 0.2,
36
+ checkComments: true,
37
+ },
38
+ // ── Copilot signatures ───────────────────────────────────────────────────
39
+ {
40
+ pattern: /\/\/\s*TODO:\s*(?:implement|add|handle|fix|replace)\s/i,
41
+ model: "Copilot",
42
+ description: "Placeholder TODO stubs with generic verbs",
43
+ weight: 0.2,
44
+ checkComments: true,
45
+ },
46
+ {
47
+ pattern: /(?:\/\/|#)\s*(?:Copilot|GitHub Copilot|Generated by Copilot)/i,
48
+ model: "Copilot",
49
+ description: "Explicit Copilot attribution comment",
50
+ weight: 0.9,
51
+ checkComments: true,
52
+ },
53
+ // ── Claude / Anthropic signatures ────────────────────────────────────────
54
+ {
55
+ pattern: /\/\/\s*(?:Let me|I'll|Here's|Here is|Let's)\s/,
56
+ model: "Claude",
57
+ description: 'Conversational first-person comments ("Let me", "I\'ll", "Here\'s")',
58
+ weight: 0.4,
59
+ checkComments: true,
60
+ },
61
+ {
62
+ pattern: /\/\*\*\s*\n\s*\*\s*@(?:description|summary)\s+[A-Z][^.]+\.\s*\n\s*\*\s*\n\s*\*\s*@(?:param|returns)/,
63
+ model: "Claude",
64
+ description: "Dense multi-paragraph JSDoc with blank-line separators",
65
+ weight: 0.3,
66
+ checkComments: true,
67
+ },
68
+ // ── Gemini / Google signatures ───────────────────────────────────────────
69
+ {
70
+ pattern: /\/\/\s*(?:See|Refer to|For more information|Documentation):\s*https?:\/\//,
71
+ model: "Gemini",
72
+ description: "Inline URL documentation references",
73
+ weight: 0.3,
74
+ checkComments: true,
75
+ },
76
+ // ── Generic AI code signals (model-agnostic) ────────────────────────────
77
+ {
78
+ pattern: /(?:\/\/|#)\s*(?:Generated by|Auto-generated|AI[ -]generated|Created by AI|Written by AI)/i,
79
+ model: "AI-generated",
80
+ description: "Explicit AI-generation attribution comment",
81
+ weight: 0.9,
82
+ checkComments: true,
83
+ },
84
+ {
85
+ pattern: /\/\/\s*[-─]{3,}\s*\w+.*[-─]{3,}/,
86
+ model: "AI-generated",
87
+ description: "Decorative section-divider comments with dashes",
88
+ weight: 0.2,
89
+ checkComments: true,
90
+ },
91
+ ];
92
+ // ─── Main Analyzer ──────────────────────────────────────────────────────────
93
+ export function analyzeModelFingerprint(code, _language) {
94
+ const findings = [];
95
+ const lines = code.split("\n");
96
+ const prefix = "MFPR";
97
+ // Accumulate signals per model
98
+ const modelSignals = new Map();
99
+ for (const signal of FINGERPRINT_SIGNALS) {
100
+ const matchedLines = [];
101
+ for (let i = 0; i < lines.length; i++) {
102
+ const line = lines[i];
103
+ const isComment = isCommentLine(line);
104
+ // Only check comments for comment-only signals; check non-comments for code signals
105
+ if (signal.checkComments && !isComment)
106
+ continue;
107
+ if (!signal.checkComments && isComment)
108
+ continue;
109
+ signal.pattern.lastIndex = 0;
110
+ if (signal.pattern.test(line)) {
111
+ matchedLines.push(i + 1);
112
+ }
113
+ }
114
+ if (matchedLines.length > 0) {
115
+ const existing = modelSignals.get(signal.model) ?? { lines: [], totalWeight: 0, descriptions: [] };
116
+ existing.lines.push(...matchedLines);
117
+ existing.totalWeight += signal.weight * Math.min(matchedLines.length, 3);
118
+ if (!existing.descriptions.includes(signal.description)) {
119
+ existing.descriptions.push(signal.description);
120
+ }
121
+ modelSignals.set(signal.model, existing);
122
+ }
123
+ }
124
+ // Emit findings for models with sufficient signal accumulation
125
+ let ruleNum = 1;
126
+ for (const [model, data] of modelSignals) {
127
+ // Require at least 2 distinct signal types OR one high-weight signal
128
+ if (data.descriptions.length < 2 && data.totalWeight < 0.8)
129
+ continue;
130
+ const uniqueLines = [...new Set(data.lines)].sort((a, b) => a - b);
131
+ const confidence = Math.min(0.9, 0.4 + data.totalWeight * 0.15);
132
+ findings.push({
133
+ ruleId: `${prefix}-${String(ruleNum++).padStart(3, "0")}`,
134
+ severity: "info",
135
+ title: `Code fingerprint matches ${model} generation patterns`,
136
+ description: `Detected ${data.descriptions.length} stylistic signal(s) characteristic of ${model}-generated code: ` +
137
+ data.descriptions.join("; ") +
138
+ ". This is informational — AI-generated code should receive extra review for hallucinated APIs, " +
139
+ "placeholder security comments, and model-specific blind spots.",
140
+ lineNumbers: uniqueLines.slice(0, 10),
141
+ recommendation: `This code shows patterns typical of ${model}. Review carefully for: ` +
142
+ "(1) hallucinated imports/APIs, (2) placeholder security comments, " +
143
+ "(3) incomplete error handling, (4) overly verbose or missing documentation. " +
144
+ "Consider running the hallucination-detection and ai-code-safety judges specifically.",
145
+ reference: "AI Code Safety — Model Fingerprint Detection",
146
+ confidence,
147
+ provenance: "regex-pattern-match",
148
+ });
149
+ }
150
+ return findings;
151
+ }
152
+ //# sourceMappingURL=model-fingerprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-fingerprint.js","sourceRoot":"","sources":["../../src/evaluators/model-fingerprint.ts"],"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AAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACnE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;QAEhE,QAAQ,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;YACzD,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,4BAA4B,KAAK,sBAAsB;YAC9D,WAAW,EACT,YAAY,IAAI,CAAC,YAAY,CAAC,MAAM,0CAA0C,KAAK,mBAAmB;gBACtG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC5B,iGAAiG;gBACjG,gEAAgE;YAClE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YACrC,cAAc,EACZ,uCAAuC,KAAK,0BAA0B;gBACtE,oEAAoE;gBACpE,8EAA8E;gBAC9E,sFAAsF;YACxF,SAAS,EAAE,8CAA8C;YACzD,UAAU;YACV,UAAU,EAAE,qBAAqB;SAClC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Finding } from "../types.js";
2
+ /**
3
+ * Multi-turn coherence evaluator.
4
+ *
5
+ * Detects self-contradicting patterns within a single code file that suggest
6
+ * incomplete refactoring, copy-paste inconsistencies, or conflicting logic:
7
+ * - Duplicate function definitions with different implementations
8
+ * - Contradictory boolean assignments to the same variable
9
+ * - Dead code after unconditional return/throw
10
+ * - Import statements for unused modules alongside re-implementations
11
+ * - Conflicting configuration values
12
+ */
13
+ export declare function analyzeMultiTurnCoherence(code: string, _language: string): Finding[];
14
+ //# sourceMappingURL=multi-turn-coherence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-turn-coherence.d.ts","sourceRoot":"","sources":["../../src/evaluators/multi-turn-coherence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAkJpF"}
@@ -0,0 +1,150 @@
1
+ import { getLineNumbers } from "./shared.js";
2
+ /**
3
+ * Multi-turn coherence evaluator.
4
+ *
5
+ * Detects self-contradicting patterns within a single code file that suggest
6
+ * incomplete refactoring, copy-paste inconsistencies, or conflicting logic:
7
+ * - Duplicate function definitions with different implementations
8
+ * - Contradictory boolean assignments to the same variable
9
+ * - Dead code after unconditional return/throw
10
+ * - Import statements for unused modules alongside re-implementations
11
+ * - Conflicting configuration values
12
+ */
13
+ export function analyzeMultiTurnCoherence(code, _language) {
14
+ const findings = [];
15
+ const prefix = "COH";
16
+ let ruleNum = 1;
17
+ const lines = code.split("\n");
18
+ // ── COH-001: Contradictory boolean assignments ────────────────────────
19
+ const boolAssignPattern = /\b(\w+)\s*=\s*(true|false)\s*;/g;
20
+ const boolAssignments = new Map();
21
+ let match;
22
+ while ((match = boolAssignPattern.exec(code)) !== null) {
23
+ const varName = match[1];
24
+ const value = match[2];
25
+ const lineNum = code.slice(0, match.index).split("\n").length;
26
+ if (!boolAssignments.has(varName))
27
+ boolAssignments.set(varName, []);
28
+ boolAssignments.get(varName).push({ value, line: lineNum });
29
+ }
30
+ const contradictoryVars = [];
31
+ for (const [, assignments] of boolAssignments) {
32
+ if (assignments.length >= 2) {
33
+ const values = new Set(assignments.map((a) => a.value));
34
+ if (values.size > 1) {
35
+ // Same variable assigned both true and false — check they're at the same scope level
36
+ // (simple heuristic: within 5 lines of each other with no control flow between)
37
+ for (let i = 0; i < assignments.length - 1; i++) {
38
+ const a = assignments[i];
39
+ const b = assignments[i + 1];
40
+ if (a.value !== b.value && b.line - a.line <= 5) {
41
+ const between = lines.slice(a.line - 1, b.line).join("\n");
42
+ if (!/\b(if|else|switch|case|for|while|catch|try)\b/.test(between)) {
43
+ contradictoryVars.push(a.line, b.line);
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ if (contradictoryVars.length > 0) {
51
+ findings.push({
52
+ ruleId: `${prefix}-${String(ruleNum++).padStart(3, "0")}`,
53
+ severity: "medium",
54
+ title: "Contradictory boolean assignments",
55
+ description: "The same variable is assigned both true and false in close proximity without " +
56
+ "intervening control flow, suggesting incomplete refactoring or a logic error.",
57
+ lineNumbers: [...new Set(contradictoryVars)],
58
+ recommendation: "Review the variable assignments and remove the stale one, or add proper " +
59
+ "conditional logic if both assignments are intentional.",
60
+ confidence: 0.7,
61
+ });
62
+ }
63
+ // ── COH-002: Dead code after unconditional return/throw ───────────────
64
+ // Skipped — STRUCT-005 covers dead-code detection with AST-based analysis
65
+ // which correctly handles switch/case, guard clauses, and nested blocks.
66
+ // The regex-based heuristic here produced excessive false positives on
67
+ // returns inside if-blocks, switch cases, and early-return guard patterns.
68
+ ruleNum = 2;
69
+ // ── COH-003: Duplicate function definitions ───────────────────────────
70
+ ruleNum = 3;
71
+ const funcDefPattern = /^(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*\(/gm;
72
+ const funcDefs = new Map();
73
+ while ((match = funcDefPattern.exec(code)) !== null) {
74
+ const name = match[1];
75
+ const lineNum = code.slice(0, match.index).split("\n").length;
76
+ if (!funcDefs.has(name))
77
+ funcDefs.set(name, []);
78
+ funcDefs.get(name).push(lineNum);
79
+ }
80
+ const duplicateFuncLines = [];
81
+ for (const [, defLines] of funcDefs) {
82
+ if (defLines.length >= 2) {
83
+ duplicateFuncLines.push(...defLines);
84
+ }
85
+ }
86
+ if (duplicateFuncLines.length > 0) {
87
+ findings.push({
88
+ ruleId: `${prefix}-${String(ruleNum++).padStart(3, "0")}`,
89
+ severity: "high",
90
+ title: "Duplicate function definitions",
91
+ description: "Multiple functions with the same name are defined in this file. " +
92
+ "Only the last definition will be effective, which may cause unexpected behaviour.",
93
+ lineNumbers: duplicateFuncLines,
94
+ recommendation: "Remove or rename the duplicate function definitions. If they serve " +
95
+ "different purposes, give them distinct names.",
96
+ confidence: 0.85,
97
+ });
98
+ }
99
+ // ── COH-004: Conflicting config values ────────────────────────────────
100
+ ruleNum = 4;
101
+ const configPattern = /(['"])([\w.]+)\1\s*:\s*(['"]?)([^'",}\]\n]+)\3/g;
102
+ const configValues = new Map();
103
+ while ((match = configPattern.exec(code)) !== null) {
104
+ const key = match[2];
105
+ const value = match[4].trim();
106
+ const lineNum = code.slice(0, match.index).split("\n").length;
107
+ if (!configValues.has(key))
108
+ configValues.set(key, []);
109
+ configValues.get(key).push({ value, line: lineNum });
110
+ }
111
+ const conflictLines = [];
112
+ for (const [, vals] of configValues) {
113
+ if (vals.length >= 2) {
114
+ const uniqueValues = new Set(vals.map((v) => v.value));
115
+ if (uniqueValues.size > 1) {
116
+ conflictLines.push(...vals.map((v) => v.line));
117
+ }
118
+ }
119
+ }
120
+ if (conflictLines.length >= 6 && conflictLines.length <= 10) {
121
+ findings.push({
122
+ ruleId: `${prefix}-${String(ruleNum++).padStart(3, "0")}`,
123
+ severity: "low",
124
+ title: "Potentially conflicting configuration values",
125
+ description: "The same configuration key appears multiple times with different values. " +
126
+ "This may indicate a copy-paste error or conflicting settings.",
127
+ lineNumbers: [...new Set(conflictLines)].slice(0, 5),
128
+ recommendation: "Verify that each configuration key has the intended value and remove duplicates.",
129
+ confidence: 0.5,
130
+ });
131
+ }
132
+ // ── COH-005: TODO/FIXME/HACK with contradicting code ─────────────────
133
+ ruleNum = 5;
134
+ const todoLines = getLineNumbers(code, /\/\/\s*(TODO|FIXME|HACK|XXX)\b/i);
135
+ if (todoLines.length >= 5) {
136
+ findings.push({
137
+ ruleId: `${prefix}-${String(ruleNum++).padStart(3, "0")}`,
138
+ severity: "info",
139
+ title: "High density of TODO/FIXME markers",
140
+ description: `${todoLines.length} TODO/FIXME/HACK markers found. High density of unresolved ` +
141
+ "markers suggests incomplete implementation or deferred work that may affect reliability.",
142
+ lineNumbers: todoLines.slice(0, 5),
143
+ recommendation: "Prioritize and address the TODO/FIXME items, or create tracked issues " +
144
+ "for each one and remove stale markers.",
145
+ confidence: 0.8,
146
+ });
147
+ }
148
+ return findings;
149
+ }
150
+ //# sourceMappingURL=multi-turn-coherence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-turn-coherence.js","sourceRoot":"","sources":["../../src/evaluators/multi-turn-coherence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,SAAiB;IACvE,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,KAAK,CAAC;IACrB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,yEAAyE;IACzE,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;IAC5D,MAAM,eAAe,GAAG,IAAI,GAAG,EAA6C,CAAC;IAC7E,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACvD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAC9D,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,eAAe,CA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AAG,CAAC,CAAC;IACZ,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,EAAE,iCAAiC,CAAC,CAAC;IAC1E,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;YACzD,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,oCAAoC;YAC3C,WAAW,EACT,GAAG,SAAS,CAAC,MAAM,6DAA6D;gBAChF,0FAA0F;YAC5F,WAAW,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YAClC,cAAc,EACZ,wEAAwE;gBACxE,wCAAwC;YAC1C,UAAU,EAAE,GAAG;SAChB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/dist/index.js CHANGED
@@ -46,6 +46,8 @@ const cliCommands = new Set([
46
46
  "trend",
47
47
  "doctor",
48
48
  "scaffold-plugin",
49
+ "calibration-dashboard",
50
+ "community-patterns",
49
51
  "lsp",
50
52
  "version",
51
53
  ]);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,+EAA+E;AAC/E,6EAA6E;AAE7E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,MAAM;IACN,MAAM;IACN,UAAU;IACV,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,cAAc;IACd,aAAa;IACb,MAAM;IACN,UAAU;IACV,QAAQ;IACR,WAAW;IACX,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;IACN,K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