@nerviq/cli 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -15
- package/bin/cli.js +86 -4
- package/package.json +2 -2
- package/src/analyze.js +9 -9
- package/src/anti-patterns.js +468 -0
- package/src/benchmark.js +8 -3
- package/src/governance.js +49 -2
- package/src/recommendation-rules.js +84 -0
- package/src/verification-metadata.js +145 -0
package/README.md
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
# Nerviq
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Standardize and govern your AI coding agent setup — score, fix, and align across 8 platforms.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@nerviq/cli)
|
|
6
6
|
[](LICENSE)
|
|
7
|
-
[](https://nerviq.net)
|
|
7
|
+
[](https://github.com/nerviq/nerviq)
|
|
9
8
|
|
|
10
9
|
---
|
|
11
10
|
|
|
12
11
|
### 8 Platforms Supported
|
|
13
12
|
|
|
14
|
-
Nerviq
|
|
13
|
+
Nerviq audits, sets up, and governs AI coding agent configurations for **8 platforms**:
|
|
15
14
|
|
|
16
15
|
| Platform | Checks | Status |
|
|
17
16
|
|----------|--------|--------|
|
|
18
|
-
| Claude Code |
|
|
19
|
-
| Codex (OpenAI) |
|
|
20
|
-
| Gemini CLI (Google) |
|
|
21
|
-
| GitHub Copilot |
|
|
22
|
-
| Cursor |
|
|
23
|
-
| Windsurf |
|
|
24
|
-
| Aider |
|
|
25
|
-
| OpenCode |
|
|
17
|
+
| Claude Code | 393 | Full |
|
|
18
|
+
| Codex (OpenAI) | 272 | Full |
|
|
19
|
+
| Gemini CLI (Google) | 300 | Full |
|
|
20
|
+
| GitHub Copilot | 299 | Full |
|
|
21
|
+
| Cursor | 301 | Full |
|
|
22
|
+
| Windsurf | 297 | Full |
|
|
23
|
+
| Aider | 283 | Full |
|
|
24
|
+
| OpenCode | 286 | Full |
|
|
26
25
|
|
|
27
26
|
### 10 Stack-Specific Languages
|
|
28
27
|
|
|
@@ -78,7 +77,15 @@ npx @nerviq/cli benchmark # Before/after in isolated copy
|
|
|
78
77
|
|
|
79
78
|
No install required. Zero dependencies.
|
|
80
79
|
|
|
81
|
-
##
|
|
80
|
+
## Get Started by Role
|
|
81
|
+
|
|
82
|
+
| You are a... | Start here | Then |
|
|
83
|
+
|--------------|------------|------|
|
|
84
|
+
| **Solo developer** | `nerviq audit` → `nerviq augment` | `nerviq benchmark` |
|
|
85
|
+
| **Team lead / DevEx** | `nerviq governance` → `nerviq audit --json` | CI threshold + `nerviq watch` |
|
|
86
|
+
| **Enterprise / Platform** | `nerviq harmony-audit` → `nerviq harmony-drift` | Policy packs + `nerviq certify` |
|
|
87
|
+
|
|
88
|
+
## 2,431 Checks Across 96 Categories
|
|
82
89
|
|
|
83
90
|
| Category Group | Checks | Examples |
|
|
84
91
|
|----------------|--------|---------|
|
|
@@ -217,7 +224,7 @@ Levels:
|
|
|
217
224
|
|
|
218
225
|
| Command | What it does |
|
|
219
226
|
|---------|-------------|
|
|
220
|
-
| `nerviq audit` | Score 0-100 against 2,
|
|
227
|
+
| `nerviq audit` | Score 0-100 against 2,431 checks |
|
|
221
228
|
| `nerviq audit --lite` | Quick top-3 scan |
|
|
222
229
|
| `nerviq setup` | Generate starter-safe CLAUDE.md + hooks + commands |
|
|
223
230
|
| `nerviq augment` | Repo-aware improvement plan (no writes) |
|
|
@@ -270,7 +277,7 @@ Nerviq is built on the CLAUDEX knowledge engine — the largest verified catalog
|
|
|
270
277
|
|
|
271
278
|
- **448+ research documents** covering all 8 platforms
|
|
272
279
|
- **332+ experiments** with tested, rated results
|
|
273
|
-
- **2,
|
|
280
|
+
- **2,431 checks** across 8 platforms and 10 languages, each with `sourceUrl` and `confidence` level (0.0-1.0)
|
|
274
281
|
- Every check is traceable to primary documentation or verified experiment
|
|
275
282
|
- 90-day freshness cycle: stale findings are re-verified or pruned
|
|
276
283
|
|
|
@@ -287,6 +294,14 @@ Nerviq is built on the CLAUDEX knowledge engine — the largest verified catalog
|
|
|
287
294
|
- **GitHub**: [github.com/nerviq/nerviq](https://github.com/nerviq/nerviq)
|
|
288
295
|
- **Website**: [nerviq.net](https://nerviq.net)
|
|
289
296
|
|
|
297
|
+
## What Nerviq Is — and Isn't
|
|
298
|
+
|
|
299
|
+
**Strongest at:** Agent configuration, workflow governance, repo policy hygiene, cross-platform alignment, and setup standardization.
|
|
300
|
+
|
|
301
|
+
**Not a replacement for:** Deep architectural review of business logic, runtime performance profiling, or security penetration testing. Nerviq focuses on how your AI coding agents are configured and governed — not on what your application code does.
|
|
302
|
+
|
|
303
|
+
**Confidence levels:** Every check includes a `confidence` score (0.0–1.0) and a `sourceUrl` linking to primary documentation. Checks marked `heuristic` are pattern-based and may produce false positives on non-standard project structures.
|
|
304
|
+
|
|
290
305
|
## Previously claudex-setup
|
|
291
306
|
|
|
292
307
|
Nerviq was previously published as `claudex-setup`. If you were using it:
|
package/bin/cli.js
CHANGED
|
@@ -11,6 +11,8 @@ const { collectFeedback } = require('../src/feedback');
|
|
|
11
11
|
const { startServer } = require('../src/server');
|
|
12
12
|
const { auditWorkspaces } = require('../src/workspace');
|
|
13
13
|
const { scanOrg } = require('../src/org');
|
|
14
|
+
const { detectAntiPatterns, printAntiPatterns, printAntiPatternCatalog } = require('../src/anti-patterns');
|
|
15
|
+
const { VERIFICATION_DATES, getVerificationDate, getVerificationStats } = require('../src/verification-metadata');
|
|
14
16
|
const { version } = require('../package.json');
|
|
15
17
|
|
|
16
18
|
const args = process.argv.slice(2);
|
|
@@ -24,7 +26,7 @@ const COMMAND_ALIASES = {
|
|
|
24
26
|
gov: 'governance',
|
|
25
27
|
outcome: 'feedback',
|
|
26
28
|
};
|
|
27
|
-
const KNOWN_COMMANDS = ['audit', 'org', 'setup', 'augment', 'suggest-only', 'plan', 'apply', 'governance', 'benchmark', 'deep-review', 'interactive', 'watch', 'badge', 'insights', 'history', 'compare', 'trend', 'scan', 'feedback', 'doctor', 'convert', 'migrate', 'catalog', 'certify', 'serve', 'harmony-audit', 'harmony-sync', 'harmony-drift', 'harmony-advise', 'harmony-watch', 'harmony-governance', 'harmony-add', 'synergy-report', 'help', 'version'];
|
|
29
|
+
const KNOWN_COMMANDS = ['audit', 'org', 'setup', 'augment', 'suggest-only', 'plan', 'apply', 'governance', 'benchmark', 'deep-review', 'interactive', 'watch', 'badge', 'insights', 'history', 'compare', 'trend', 'scan', 'feedback', 'doctor', 'convert', 'migrate', 'catalog', 'certify', 'serve', 'harmony-audit', 'harmony-sync', 'harmony-drift', 'harmony-advise', 'harmony-watch', 'harmony-governance', 'harmony-add', 'synergy-report', 'anti-patterns', 'rules-export', 'freshness', 'help', 'version'];
|
|
28
30
|
|
|
29
31
|
function levenshtein(a, b) {
|
|
30
32
|
const matrix = Array.from({ length: a.length + 1 }, () => Array(b.length + 1).fill(0));
|
|
@@ -85,11 +87,12 @@ function parseArgs(rawArgs) {
|
|
|
85
87
|
let migrateFrom = null;
|
|
86
88
|
let migrateTo = null;
|
|
87
89
|
let checkVersion = null;
|
|
90
|
+
let external = null;
|
|
88
91
|
|
|
89
92
|
for (let i = 0; i < rawArgs.length; i++) {
|
|
90
93
|
const arg = rawArgs[i];
|
|
91
94
|
|
|
92
|
-
if (arg === '--threshold' || arg === '--out' || arg === '--plan' || arg === '--only' || arg === '--profile' || arg === '--mcp-pack' || arg === '--require' || arg === '--key' || arg === '--status' || arg === '--effect' || arg === '--notes' || arg === '--source' || arg === '--score-delta' || arg === '--platform' || arg === '--format' || arg === '--from' || arg === '--to' || arg === '--port' || arg === '--workspace' || arg === '--check-version' || arg === '--webhook') {
|
|
95
|
+
if (arg === '--threshold' || arg === '--out' || arg === '--plan' || arg === '--only' || arg === '--profile' || arg === '--mcp-pack' || arg === '--require' || arg === '--key' || arg === '--status' || arg === '--effect' || arg === '--notes' || arg === '--source' || arg === '--score-delta' || arg === '--platform' || arg === '--format' || arg === '--from' || arg === '--to' || arg === '--port' || arg === '--workspace' || arg === '--check-version' || arg === '--webhook' || arg === '--external') {
|
|
93
96
|
const value = rawArgs[i + 1];
|
|
94
97
|
if (!value || value.startsWith('--')) {
|
|
95
98
|
throw new Error(`${arg} requires a value`);
|
|
@@ -115,10 +118,16 @@ function parseArgs(rawArgs) {
|
|
|
115
118
|
if (arg === '--workspace') workspace = value.trim();
|
|
116
119
|
if (arg === '--check-version') checkVersion = value.trim();
|
|
117
120
|
if (arg === '--webhook') webhookUrl = value.trim();
|
|
121
|
+
if (arg === '--external') external = value.trim();
|
|
118
122
|
i++;
|
|
119
123
|
continue;
|
|
120
124
|
}
|
|
121
125
|
|
|
126
|
+
if (arg.startsWith('--external=')) {
|
|
127
|
+
external = arg.split('=').slice(1).join('=').trim();
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
|
|
122
131
|
if (arg.startsWith('--require=')) {
|
|
123
132
|
requireChecks = arg.split('=').slice(1).join('=').split(',').map(item => item.trim()).filter(Boolean);
|
|
124
133
|
continue;
|
|
@@ -224,7 +233,7 @@ function parseArgs(rawArgs) {
|
|
|
224
233
|
|
|
225
234
|
const normalizedCommand = COMMAND_ALIASES[command] || command;
|
|
226
235
|
|
|
227
|
-
return { flags, command, normalizedCommand, threshold, out, planFile, only, profile, mcpPacks, requireChecks, feedbackKey, feedbackStatus, feedbackEffect, feedbackNotes, feedbackSource, feedbackScoreDelta, platform, format, port, workspace, extraArgs, convertFrom, convertTo, migrateFrom, migrateTo, checkVersion, webhookUrl };
|
|
236
|
+
return { flags, command, normalizedCommand, threshold, out, planFile, only, profile, mcpPacks, requireChecks, feedbackKey, feedbackStatus, feedbackEffect, feedbackNotes, feedbackSource, feedbackScoreDelta, platform, format, port, workspace, extraArgs, convertFrom, convertTo, migrateFrom, migrateTo, checkVersion, webhookUrl, external };
|
|
228
237
|
}
|
|
229
238
|
|
|
230
239
|
function printWorkspaceSummary(summary, options) {
|
|
@@ -289,6 +298,8 @@ const HELP = `
|
|
|
289
298
|
nerviq org scan dir1 dir2 Aggregate multiple repos into one score table
|
|
290
299
|
nerviq catalog Full check catalog (all 8 platforms)
|
|
291
300
|
nerviq catalog --json Export full check catalog as JSON
|
|
301
|
+
nerviq anti-patterns Detect anti-patterns in current project
|
|
302
|
+
nerviq anti-patterns --all Show full anti-pattern catalog
|
|
292
303
|
|
|
293
304
|
SETUP
|
|
294
305
|
nerviq setup Generate starter-safe baseline config files
|
|
@@ -308,6 +319,8 @@ const HELP = `
|
|
|
308
319
|
nerviq governance Permission profiles + hooks + policy packs
|
|
309
320
|
nerviq governance --json Machine-readable governance summary
|
|
310
321
|
nerviq benchmark Before/after score in isolated temp copy
|
|
322
|
+
nerviq benchmark --external /path Benchmark an external repo
|
|
323
|
+
nerviq freshness Show verification freshness for all checks
|
|
311
324
|
nerviq certify Generate certification badge for your project
|
|
312
325
|
|
|
313
326
|
CROSS-PLATFORM
|
|
@@ -333,6 +346,8 @@ const HELP = `
|
|
|
333
346
|
nerviq deep-review AI-powered config review (opt-in, uses API key)
|
|
334
347
|
nerviq serve --port 3000 Start local Nerviq REST API server
|
|
335
348
|
nerviq badge Generate shields.io badge markdown
|
|
349
|
+
nerviq rules-export Export recommendation rules as JSON
|
|
350
|
+
nerviq rules-export --out F Save rules to file
|
|
336
351
|
|
|
337
352
|
OPTIONS
|
|
338
353
|
--platform NAME Platform: claude (default), codex, cursor, copilot, gemini, windsurf, aider, opencode
|
|
@@ -346,6 +361,7 @@ const HELP = `
|
|
|
346
361
|
--check-version V Pin catalog to a specific version (warn on mismatch)
|
|
347
362
|
--format NAME Output format: json | sarif | otel
|
|
348
363
|
--webhook URL Send audit results to a webhook (Slack/Discord/generic JSON)
|
|
364
|
+
--external PATH Benchmark an external repo instead of cwd
|
|
349
365
|
--port N Port for \`serve\` (default: 3000)
|
|
350
366
|
--workspace GLOBS Audit workspaces separately (e.g. packages/* or apps/web,apps/api)
|
|
351
367
|
--snapshot Save snapshot artifact under .claude/nerviq/snapshots/
|
|
@@ -427,6 +443,7 @@ async function main() {
|
|
|
427
443
|
port: parsed.port !== null ? Number(parsed.port) : null,
|
|
428
444
|
workspace: parsed.workspace || null,
|
|
429
445
|
webhookUrl: parsed.webhookUrl || null,
|
|
446
|
+
external: parsed.external || null,
|
|
430
447
|
dir: process.cwd()
|
|
431
448
|
};
|
|
432
449
|
|
|
@@ -507,7 +524,8 @@ async function main() {
|
|
|
507
524
|
'history', 'compare', 'trend', 'feedback', 'catalog', 'certify', 'serve', 'help', 'version',
|
|
508
525
|
// Harmony + Synergy (cross-platform)
|
|
509
526
|
'harmony-audit', 'harmony-sync', 'harmony-drift', 'harmony-advise',
|
|
510
|
-
'harmony-watch', 'harmony-governance', 'harmony-add', 'synergy-report',
|
|
527
|
+
'harmony-watch', 'harmony-governance', 'harmony-add', 'synergy-report', 'anti-patterns', 'rules-export',
|
|
528
|
+
'freshness',
|
|
511
529
|
]);
|
|
512
530
|
|
|
513
531
|
if (options.platform === 'codex') {
|
|
@@ -987,6 +1005,70 @@ async function main() {
|
|
|
987
1005
|
process.exit(1);
|
|
988
1006
|
}
|
|
989
1007
|
process.exit(0);
|
|
1008
|
+
} else if (normalizedCommand === 'anti-patterns') {
|
|
1009
|
+
const showAll = flags.includes('--all');
|
|
1010
|
+
if (showAll) {
|
|
1011
|
+
printAntiPatternCatalog(options);
|
|
1012
|
+
} else {
|
|
1013
|
+
const { ProjectContext } = require('../src/context');
|
|
1014
|
+
const ctx = new ProjectContext(options.dir);
|
|
1015
|
+
const detected = detectAntiPatterns(ctx);
|
|
1016
|
+
printAntiPatterns(detected, options);
|
|
1017
|
+
}
|
|
1018
|
+
process.exit(0);
|
|
1019
|
+
} else if (normalizedCommand === 'rules-export') {
|
|
1020
|
+
const { generateRecommendationRules } = require('../src/recommendation-rules');
|
|
1021
|
+
const rules = generateRecommendationRules();
|
|
1022
|
+
const output = JSON.stringify(rules, null, 2);
|
|
1023
|
+
if (options.out) {
|
|
1024
|
+
require('fs').writeFileSync(options.out, output, 'utf8');
|
|
1025
|
+
if (!options.json) {
|
|
1026
|
+
console.log(`\n Rules exported to ${options.out} (${rules.totalRules} rules)\n`);
|
|
1027
|
+
} else {
|
|
1028
|
+
console.log(output);
|
|
1029
|
+
}
|
|
1030
|
+
} else {
|
|
1031
|
+
console.log(output);
|
|
1032
|
+
}
|
|
1033
|
+
process.exit(0);
|
|
1034
|
+
} else if (normalizedCommand === 'freshness') {
|
|
1035
|
+
const { TECHNIQUES } = require('../src/techniques');
|
|
1036
|
+
const stats = getVerificationStats();
|
|
1037
|
+
const allKeys = Object.keys(TECHNIQUES);
|
|
1038
|
+
const verifiedKeys = Object.keys(VERIFICATION_DATES);
|
|
1039
|
+
const neverVerified = allKeys.filter(k => !VERIFICATION_DATES[k]);
|
|
1040
|
+
|
|
1041
|
+
if (options.json) {
|
|
1042
|
+
console.log(JSON.stringify({
|
|
1043
|
+
totalChecks: allKeys.length,
|
|
1044
|
+
verifiedChecks: verifiedKeys.length,
|
|
1045
|
+
neverVerifiedCount: neverVerified.length,
|
|
1046
|
+
newestVerification: stats.newest,
|
|
1047
|
+
oldestVerification: stats.oldest,
|
|
1048
|
+
neverVerified,
|
|
1049
|
+
}, null, 2));
|
|
1050
|
+
} else {
|
|
1051
|
+
console.log('');
|
|
1052
|
+
console.log(' nerviq freshness');
|
|
1053
|
+
console.log(' ═══════════════════════════════════════');
|
|
1054
|
+
console.log(` Total checks: ${allKeys.length}`);
|
|
1055
|
+
console.log(` With verification date: ${verifiedKeys.length}`);
|
|
1056
|
+
console.log(` Never verified: ${neverVerified.length}`);
|
|
1057
|
+
console.log(` Newest verification: ${stats.newest}`);
|
|
1058
|
+
console.log(` Oldest verification: ${stats.oldest}`);
|
|
1059
|
+
console.log('');
|
|
1060
|
+
if (neverVerified.length > 0 && options.verbose) {
|
|
1061
|
+
console.log(' Never verified:');
|
|
1062
|
+
for (const key of neverVerified) {
|
|
1063
|
+
console.log(` - ${key}`);
|
|
1064
|
+
}
|
|
1065
|
+
console.log('');
|
|
1066
|
+
} else if (neverVerified.length > 0) {
|
|
1067
|
+
console.log(` Use --verbose to list all ${neverVerified.length} never-verified checks.`);
|
|
1068
|
+
console.log('');
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
process.exit(0);
|
|
990
1072
|
} else if (normalizedCommand === 'synergy-report') {
|
|
991
1073
|
// Placeholder — synergy report is referenced but may not be implemented yet
|
|
992
1074
|
console.log('\n Synergy report: coming soon.\n');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nerviq/cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "The intelligent nervous system for AI coding agents — 2,
|
|
3
|
+
"version": "1.5.1",
|
|
4
|
+
"description": "The intelligent nervous system for AI coding agents — 2,431 checks across 8 platforms, 10 languages, and 62 domain packs. Audit, align, and amplify.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"nerviq": "bin/cli.js",
|
package/src/analyze.js
CHANGED
|
@@ -296,15 +296,16 @@ const STRENGTH_REASONS = {
|
|
|
296
296
|
|
|
297
297
|
function toStrengths(results) {
|
|
298
298
|
return results
|
|
299
|
-
.filter(r => r.passed === true)
|
|
299
|
+
.filter(r => r.passed === true && (r.impact === 'critical' || r.impact === 'high' || r.impact === 'medium'))
|
|
300
300
|
.sort((a, b) => {
|
|
301
301
|
const order = { critical: 3, high: 2, medium: 1, low: 0 };
|
|
302
302
|
return (order[b.impact] || 0) - (order[a.impact] || 0);
|
|
303
303
|
})
|
|
304
|
-
.slice(0,
|
|
304
|
+
.slice(0, 10)
|
|
305
305
|
.map(r => ({
|
|
306
306
|
key: r.key,
|
|
307
307
|
name: r.name,
|
|
308
|
+
impact: r.impact,
|
|
308
309
|
category: r.category,
|
|
309
310
|
why: STRENGTH_REASONS[r.key] || `Already configured and working: ${r.name}.`,
|
|
310
311
|
}));
|
|
@@ -604,12 +605,10 @@ function printAnalysis(report, options = {}) {
|
|
|
604
605
|
console.log('');
|
|
605
606
|
|
|
606
607
|
if (report.strengthsPreserved.length > 0) {
|
|
607
|
-
console.log(c('
|
|
608
|
+
console.log(c(` ${'\u2705'} Strengths Preserved (don't change these)`, 'green'));
|
|
608
609
|
for (const item of report.strengthsPreserved) {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
console.log(c(` ${item.why}`, 'dim'));
|
|
612
|
-
}
|
|
610
|
+
const impactLabel = item.impact ? ` (${item.impact})` : '';
|
|
611
|
+
console.log(` ${c('\u2022', 'green')} ${item.name}${c(impactLabel, 'dim')}`);
|
|
613
612
|
}
|
|
614
613
|
console.log('');
|
|
615
614
|
}
|
|
@@ -730,10 +729,11 @@ function exportMarkdown(report) {
|
|
|
730
729
|
lines.push('');
|
|
731
730
|
|
|
732
731
|
if (report.strengthsPreserved.length > 0) {
|
|
733
|
-
lines.push('## Strengths Preserved');
|
|
732
|
+
lines.push('## Strengths Preserved (don\'t change these)');
|
|
734
733
|
lines.push('');
|
|
735
734
|
for (const item of report.strengthsPreserved) {
|
|
736
|
-
|
|
735
|
+
const impactLabel = item.impact ? ` (${item.impact})` : '';
|
|
736
|
+
lines.push(`- **${item.name}**${impactLabel} — ${item.why || 'Already configured.'}`);
|
|
737
737
|
}
|
|
738
738
|
lines.push('');
|
|
739
739
|
}
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anti-Pattern Catalog — things NOT to do when configuring AI coding agents.
|
|
3
|
+
* Provides a static catalog and a runtime detector that checks a project context.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
const ANTI_PATTERNS = [
|
|
9
|
+
{
|
|
10
|
+
id: 'AP001',
|
|
11
|
+
name: 'bypassPermissions as default',
|
|
12
|
+
severity: 'critical',
|
|
13
|
+
description: 'Setting defaultMode to bypassPermissions removes all safety guardrails.',
|
|
14
|
+
platforms: ['claude'],
|
|
15
|
+
fix: 'Use "default" or "safe-write" mode. Add specific allow rules for trusted operations.',
|
|
16
|
+
detect: (ctx) => {
|
|
17
|
+
const settings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
18
|
+
return settings && settings.permissions && settings.permissions.defaultMode === 'bypassPermissions';
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'AP002',
|
|
23
|
+
name: 'No deny rules configured',
|
|
24
|
+
severity: 'high',
|
|
25
|
+
description: 'Without deny rules, the agent can execute any operation it decides to, including destructive ones.',
|
|
26
|
+
platforms: ['claude'],
|
|
27
|
+
fix: 'Add deny rules in settings.json for dangerous operations like rm -rf, git reset --hard, and reading .env files.',
|
|
28
|
+
detect: (ctx) => {
|
|
29
|
+
const settings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
30
|
+
if (!settings || !settings.permissions) return true;
|
|
31
|
+
return !Array.isArray(settings.permissions.deny) || settings.permissions.deny.length === 0;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'AP003',
|
|
36
|
+
name: 'Secrets in CLAUDE.md',
|
|
37
|
+
severity: 'critical',
|
|
38
|
+
description: 'API keys, tokens, or passwords hardcoded in CLAUDE.md are visible to every session and may leak in outputs.',
|
|
39
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
40
|
+
fix: 'Move secrets to .env files and reference them via environment variables. Add .env to .gitignore.',
|
|
41
|
+
detect: (ctx) => {
|
|
42
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
43
|
+
const patterns = [
|
|
44
|
+
/(?:api[_-]?key|api[_-]?secret|token|password|secret[_-]?key)\s*[:=]\s*['"]?[A-Za-z0-9_\-]{16,}/i,
|
|
45
|
+
/sk-[A-Za-z0-9]{20,}/,
|
|
46
|
+
/ghp_[A-Za-z0-9]{36,}/,
|
|
47
|
+
/AKIA[A-Z0-9]{16}/,
|
|
48
|
+
];
|
|
49
|
+
return patterns.some(p => p.test(content));
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'AP004',
|
|
54
|
+
name: 'Empty CLAUDE.md',
|
|
55
|
+
severity: 'medium',
|
|
56
|
+
description: 'An empty or near-empty instruction file provides no guidance, making the agent guess at project conventions.',
|
|
57
|
+
platforms: ['claude'],
|
|
58
|
+
fix: 'Add project description, architecture overview, verification commands, and coding conventions to CLAUDE.md.',
|
|
59
|
+
detect: (ctx) => {
|
|
60
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
61
|
+
return content.trim().length > 0 && content.trim().length < 50;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'AP005',
|
|
66
|
+
name: 'Too many MCP servers (>10)',
|
|
67
|
+
severity: 'medium',
|
|
68
|
+
description: 'More than 10 MCP servers increases startup latency, context overhead, and potential for tool conflicts.',
|
|
69
|
+
platforms: ['claude'],
|
|
70
|
+
fix: 'Limit MCP servers to essential ones. Remove rarely-used servers and consolidate overlapping functionality.',
|
|
71
|
+
detect: (ctx) => {
|
|
72
|
+
const settings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
73
|
+
if (!settings || !settings.mcpServers) return false;
|
|
74
|
+
return Object.keys(settings.mcpServers).length > 10;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 'AP006',
|
|
79
|
+
name: 'Overly broad allow rules',
|
|
80
|
+
severity: 'high',
|
|
81
|
+
description: 'Allow rules like "Bash(*)" or "Write(**)" grant blanket permission, defeating the purpose of permission controls.',
|
|
82
|
+
platforms: ['claude'],
|
|
83
|
+
fix: 'Scope allow rules to specific commands and paths. Use "Bash(npm test)" instead of "Bash(*)".',
|
|
84
|
+
detect: (ctx) => {
|
|
85
|
+
const settings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
86
|
+
if (!settings || !settings.permissions) return false;
|
|
87
|
+
const allow = settings.permissions.allow || [];
|
|
88
|
+
const broadPatterns = ['Bash(*)', 'Write(**)', 'Edit(**)', 'Read(**)', 'Bash(**)', 'Write(*)', 'Edit(*)', 'Read(*)'];
|
|
89
|
+
return allow.some(rule => broadPatterns.includes(rule));
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'AP007',
|
|
94
|
+
name: 'No verification commands',
|
|
95
|
+
severity: 'medium',
|
|
96
|
+
description: 'Without test, lint, or build commands in CLAUDE.md, the agent cannot self-verify its changes.',
|
|
97
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
98
|
+
fix: 'Add ## Verification Commands section with test, lint, and build commands to your instruction file.',
|
|
99
|
+
detect: (ctx) => {
|
|
100
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
101
|
+
if (!content) return false;
|
|
102
|
+
const hasVerification = /\b(test|lint|build|check|verify)\b/i.test(content) &&
|
|
103
|
+
/\b(npm |yarn |pnpm |pytest|cargo |go |make )/i.test(content);
|
|
104
|
+
return !hasVerification;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 'AP008',
|
|
109
|
+
name: 'Ignoring .gitignore for sensitive files',
|
|
110
|
+
severity: 'high',
|
|
111
|
+
description: 'Not gitignoring .env, credentials, and key files means they can be committed and pushed to remote repos.',
|
|
112
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
113
|
+
fix: 'Add .env, .env.*, credentials.json, *.pem, and *.key to .gitignore.',
|
|
114
|
+
detect: (ctx) => {
|
|
115
|
+
const gitignore = ctx.fileContent('.gitignore') || '';
|
|
116
|
+
return !gitignore.includes('.env');
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 'AP009',
|
|
121
|
+
name: 'No hooks configured',
|
|
122
|
+
severity: 'medium',
|
|
123
|
+
description: 'Without hooks, there is no automated enforcement — all safety depends on instructions alone (80% compliance vs 100%).',
|
|
124
|
+
platforms: ['claude'],
|
|
125
|
+
fix: 'Add at least a protect-secrets PreToolUse hook and a post-edit lint hook in settings.json.',
|
|
126
|
+
detect: (ctx) => {
|
|
127
|
+
const settings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
128
|
+
if (!settings || !settings.hooks) return true;
|
|
129
|
+
const hookEntries = Object.values(settings.hooks).flat();
|
|
130
|
+
return hookEntries.length === 0;
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 'AP010',
|
|
135
|
+
name: 'Duplicated instructions across platforms',
|
|
136
|
+
severity: 'medium',
|
|
137
|
+
description: 'Copy-pasting the same instructions into CLAUDE.md, .cursorrules, and AGENTS.md creates drift when one is updated.',
|
|
138
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
139
|
+
fix: 'Create a shared source of truth (e.g., docs/ai-instructions.md) and reference it from each platform config.',
|
|
140
|
+
detect: (ctx) => {
|
|
141
|
+
const claudeMd = ctx.fileContent('CLAUDE.md') || '';
|
|
142
|
+
const cursorrules = ctx.fileContent('.cursorrules') || '';
|
|
143
|
+
const agentsMd = ctx.fileContent('AGENTS.md') || '';
|
|
144
|
+
if (!claudeMd || claudeMd.length < 100) return false;
|
|
145
|
+
const files = [cursorrules, agentsMd].filter(f => f.length > 100);
|
|
146
|
+
if (files.length === 0) return false;
|
|
147
|
+
// Simple heuristic: check if any significant chunk (100+ chars) appears in both
|
|
148
|
+
const chunk = claudeMd.slice(0, 200).trim();
|
|
149
|
+
return files.some(f => f.includes(chunk));
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'AP011',
|
|
154
|
+
name: 'Conflicting trust postures across platforms',
|
|
155
|
+
severity: 'high',
|
|
156
|
+
description: 'One platform in bypassPermissions while another is read-only creates inconsistent security boundaries.',
|
|
157
|
+
platforms: ['claude', 'codex'],
|
|
158
|
+
fix: 'Align permission profiles across platforms. Use Harmony audit to detect and resolve trust drift.',
|
|
159
|
+
detect: (ctx) => {
|
|
160
|
+
const claudeSettings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
161
|
+
const codexConfig = ctx.fileContent('.codex/config.toml') || '';
|
|
162
|
+
if (!claudeSettings || !codexConfig) return false;
|
|
163
|
+
const claudeMode = claudeSettings.permissions && claudeSettings.permissions.defaultMode;
|
|
164
|
+
const isBypass = claudeMode === 'bypassPermissions';
|
|
165
|
+
const codexHasAutoApprove = /approval_policy\s*=\s*["']auto-edit["']/i.test(codexConfig);
|
|
166
|
+
// Conflict: one is very permissive while the other is restrictive, or vice versa
|
|
167
|
+
return (isBypass && !codexHasAutoApprove) || (!isBypass && codexHasAutoApprove);
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 'AP012',
|
|
172
|
+
name: 'No error handling in hooks',
|
|
173
|
+
severity: 'medium',
|
|
174
|
+
description: 'Hook scripts without error handling can silently fail, giving a false sense of security.',
|
|
175
|
+
platforms: ['claude'],
|
|
176
|
+
fix: 'Add "set -e" to shell hooks and wrap commands in try/catch for JS hooks. Log failures to a known location.',
|
|
177
|
+
detect: (ctx) => {
|
|
178
|
+
if (!ctx.hasDir('.claude/hooks')) return false;
|
|
179
|
+
const hookFiles = ctx.dirFiles('.claude/hooks');
|
|
180
|
+
for (const file of hookFiles) {
|
|
181
|
+
const content = ctx.fileContent(`.claude/hooks/${file}`) || '';
|
|
182
|
+
if (file.endsWith('.sh') && content.length > 0 && !content.includes('set -e')) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: 'AP013',
|
|
191
|
+
name: 'Hardcoded paths in CLAUDE.md',
|
|
192
|
+
severity: 'medium',
|
|
193
|
+
description: 'Absolute paths like /Users/alice/project or C:\\Users break when other developers clone the repo.',
|
|
194
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
195
|
+
fix: 'Use relative paths or environment variables. Replace absolute paths with project-relative references.',
|
|
196
|
+
detect: (ctx) => {
|
|
197
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
198
|
+
if (!content) return false;
|
|
199
|
+
return /(?:\/Users\/[a-zA-Z]|\/home\/[a-zA-Z]|C:\\Users\\[a-zA-Z])/.test(content);
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: 'AP014',
|
|
204
|
+
name: 'No test command defined',
|
|
205
|
+
severity: 'medium',
|
|
206
|
+
description: 'Without a test command, the agent cannot verify its changes work before presenting them for review.',
|
|
207
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
208
|
+
fix: 'Add a test command in your instruction file, e.g., "Test: npm test" or "Test: pytest".',
|
|
209
|
+
detect: (ctx) => {
|
|
210
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
211
|
+
const pkg = ctx.jsonFile('package.json');
|
|
212
|
+
const hasTestInMd = /(?:test|testing)\s*(?:command)?[:\s]+[`"']*(?:npm|yarn|pnpm|pytest|cargo|go|make)\s/i.test(content);
|
|
213
|
+
const hasTestScript = pkg && pkg.scripts && pkg.scripts.test;
|
|
214
|
+
return !hasTestInMd && !hasTestScript;
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: 'AP015',
|
|
219
|
+
name: 'All permissions allowed',
|
|
220
|
+
severity: 'high',
|
|
221
|
+
description: 'Allowing all tool permissions without any deny rules gives the agent unrestricted system access.',
|
|
222
|
+
platforms: ['claude'],
|
|
223
|
+
fix: 'Define deny rules for destructive operations. At minimum deny rm -rf, git reset --hard, and .env reads.',
|
|
224
|
+
detect: (ctx) => {
|
|
225
|
+
const settings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
226
|
+
if (!settings || !settings.permissions) return false;
|
|
227
|
+
const allow = settings.permissions.allow || [];
|
|
228
|
+
const deny = settings.permissions.deny || [];
|
|
229
|
+
return allow.length > 5 && deny.length === 0;
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: 'AP016',
|
|
234
|
+
name: 'Missing architecture diagram',
|
|
235
|
+
severity: 'low',
|
|
236
|
+
description: 'Without an architecture diagram, the agent has to infer project structure from file exploration, wasting tokens.',
|
|
237
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
238
|
+
fix: 'Add a Mermaid diagram in CLAUDE.md showing the main components and data flow.',
|
|
239
|
+
detect: (ctx) => {
|
|
240
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
241
|
+
if (!content) return false;
|
|
242
|
+
return !content.includes('mermaid') && !content.includes('```') && content.length > 200;
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 'AP017',
|
|
247
|
+
name: 'Using deprecated features',
|
|
248
|
+
severity: 'medium',
|
|
249
|
+
description: 'Relying on deprecated features risks breakage when they are removed in future versions.',
|
|
250
|
+
platforms: ['claude'],
|
|
251
|
+
fix: 'Check the platform changelog for deprecated features and migrate to recommended alternatives.',
|
|
252
|
+
detect: (ctx) => {
|
|
253
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
254
|
+
const settings = ctx.jsonFile('.claude/settings.json') || ctx.jsonFile('.claude/settings.local.json');
|
|
255
|
+
// Check for known deprecated patterns
|
|
256
|
+
const deprecatedPatterns = [
|
|
257
|
+
/allowedTools/i,
|
|
258
|
+
/blockedTools/i,
|
|
259
|
+
];
|
|
260
|
+
const hasDeprecatedInMd = deprecatedPatterns.some(p => p.test(content));
|
|
261
|
+
const hasDeprecatedInSettings = settings && deprecatedPatterns.some(p => p.test(JSON.stringify(settings)));
|
|
262
|
+
return hasDeprecatedInMd || hasDeprecatedInSettings;
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: 'AP018',
|
|
267
|
+
name: 'No rules files',
|
|
268
|
+
severity: 'low',
|
|
269
|
+
description: 'Without .claude/rules/ files, all instructions live in one place, making it harder to scope guidance by file type.',
|
|
270
|
+
platforms: ['claude'],
|
|
271
|
+
fix: 'Create .claude/rules/ with scoped rules for different areas (e.g., tests.md, api.md, frontend.md).',
|
|
272
|
+
detect: (ctx) => {
|
|
273
|
+
return !ctx.hasDir('.claude/rules') || (ctx.dirFiles('.claude/rules') || []).length === 0;
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: 'AP019',
|
|
278
|
+
name: 'Overly long CLAUDE.md (>500 lines)',
|
|
279
|
+
severity: 'medium',
|
|
280
|
+
description: 'Instruction files over 500 lines consume excessive context tokens and reduce adherence to individual rules.',
|
|
281
|
+
platforms: ['claude'],
|
|
282
|
+
fix: 'Split into CLAUDE.md (core) + .claude/rules/ (scoped). Use @import for focused modules.',
|
|
283
|
+
detect: (ctx) => {
|
|
284
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
285
|
+
if (!content) return false;
|
|
286
|
+
const lineCount = content.split('\n').length;
|
|
287
|
+
return lineCount > 500;
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: 'AP020',
|
|
292
|
+
name: 'No security review command',
|
|
293
|
+
severity: 'medium',
|
|
294
|
+
description: 'Without a security review command, OWASP Top 10 vulnerabilities go undetected during agent-assisted development.',
|
|
295
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
296
|
+
fix: 'Add a /security-review command or include security scanning in your CI pipeline.',
|
|
297
|
+
detect: (ctx) => {
|
|
298
|
+
const content = ctx.fileContent('CLAUDE.md') || ctx.fileContent('.claude/CLAUDE.md') || '';
|
|
299
|
+
const hasSecurityReview = /security[- ]?review/i.test(content);
|
|
300
|
+
const hasSecurityCommand = ctx.hasDir('.claude/commands') &&
|
|
301
|
+
(ctx.dirFiles('.claude/commands') || []).some(f => /security/i.test(f));
|
|
302
|
+
return !hasSecurityReview && !hasSecurityCommand;
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
id: 'AP021',
|
|
307
|
+
name: 'Inline secrets in hook scripts',
|
|
308
|
+
severity: 'critical',
|
|
309
|
+
description: 'Hardcoded API keys or tokens in hook scripts are executed every session and easily leaked.',
|
|
310
|
+
platforms: ['claude'],
|
|
311
|
+
fix: 'Use environment variables in hooks. Reference secrets via $ENV_VAR instead of hardcoding values.',
|
|
312
|
+
detect: (ctx) => {
|
|
313
|
+
if (!ctx.hasDir('.claude/hooks')) return false;
|
|
314
|
+
const hookFiles = ctx.dirFiles('.claude/hooks');
|
|
315
|
+
const secretPatterns = [
|
|
316
|
+
/(?:api[_-]?key|token|password|secret)\s*=\s*['"][A-Za-z0-9_\-]{16,}['"]/i,
|
|
317
|
+
/sk-[A-Za-z0-9]{20,}/,
|
|
318
|
+
/ghp_[A-Za-z0-9]{36,}/,
|
|
319
|
+
/AKIA[A-Z0-9]{16}/,
|
|
320
|
+
];
|
|
321
|
+
for (const file of hookFiles) {
|
|
322
|
+
const content = ctx.fileContent(`.claude/hooks/${file}`) || '';
|
|
323
|
+
if (secretPatterns.some(p => p.test(content))) {
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return false;
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: 'AP022',
|
|
332
|
+
name: 'Missing .env protection in .gitignore',
|
|
333
|
+
severity: 'high',
|
|
334
|
+
description: 'Without .env in .gitignore, environment files with secrets can be accidentally committed and pushed.',
|
|
335
|
+
platforms: ['claude', 'codex', 'cursor', 'windsurf', 'copilot', 'gemini', 'aider', 'opencode'],
|
|
336
|
+
fix: 'Add .env, .env.*, and .env.local to .gitignore. Verify with "git check-ignore .env".',
|
|
337
|
+
detect: (ctx) => {
|
|
338
|
+
const gitignore = ctx.fileContent('.gitignore') || '';
|
|
339
|
+
if (!gitignore) return true;
|
|
340
|
+
return !gitignore.includes('.env');
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
];
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Return the full anti-pattern catalog.
|
|
347
|
+
* @returns {Array<Object>} All registered anti-patterns.
|
|
348
|
+
*/
|
|
349
|
+
function getAntiPatterns() {
|
|
350
|
+
return ANTI_PATTERNS.map(({ detect, ...rest }) => rest);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Detect anti-patterns present in a project context.
|
|
355
|
+
* @param {Object} ctx - A ProjectContext instance (from src/context.js).
|
|
356
|
+
* @returns {Array<Object>} Detected anti-patterns with id, name, severity, description, and fix.
|
|
357
|
+
*/
|
|
358
|
+
function detectAntiPatterns(ctx) {
|
|
359
|
+
const detected = [];
|
|
360
|
+
for (const pattern of ANTI_PATTERNS) {
|
|
361
|
+
try {
|
|
362
|
+
if (pattern.detect(ctx)) {
|
|
363
|
+
const { detect, ...rest } = pattern;
|
|
364
|
+
detected.push(rest);
|
|
365
|
+
}
|
|
366
|
+
} catch (_err) {
|
|
367
|
+
// Skip patterns that fail to detect (missing files, etc.)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return detected;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Print detected anti-patterns to the console.
|
|
375
|
+
* @param {Array<Object>} patterns - Detected anti-patterns.
|
|
376
|
+
* @param {Object} [options] - Display options.
|
|
377
|
+
* @param {boolean} [options.json] - Output as JSON.
|
|
378
|
+
*/
|
|
379
|
+
function printAntiPatterns(patterns, options = {}) {
|
|
380
|
+
if (options.json) {
|
|
381
|
+
console.log(JSON.stringify(patterns, null, 2));
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const SEVERITY_COLORS = {
|
|
386
|
+
critical: '\x1b[31m',
|
|
387
|
+
high: '\x1b[33m',
|
|
388
|
+
medium: '\x1b[36m',
|
|
389
|
+
low: '\x1b[2m',
|
|
390
|
+
};
|
|
391
|
+
const RESET = '\x1b[0m';
|
|
392
|
+
const BOLD = '\x1b[1m';
|
|
393
|
+
const DIM = '\x1b[2m';
|
|
394
|
+
|
|
395
|
+
console.log('');
|
|
396
|
+
console.log(`${BOLD} nerviq anti-patterns${RESET}`);
|
|
397
|
+
console.log(`${DIM} ${'═'.repeat(39)}${RESET}`);
|
|
398
|
+
|
|
399
|
+
if (patterns.length === 0) {
|
|
400
|
+
console.log(` ${'\\x1b[32m'}No anti-patterns detected. Good job!${RESET}`);
|
|
401
|
+
console.log('');
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
console.log(` ${patterns.length} anti-pattern${patterns.length === 1 ? '' : 's'} detected`);
|
|
406
|
+
console.log('');
|
|
407
|
+
|
|
408
|
+
// Sort by severity: critical > high > medium > low
|
|
409
|
+
const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
410
|
+
const sorted = [...patterns].sort((a, b) => (severityOrder[a.severity] || 9) - (severityOrder[b.severity] || 9));
|
|
411
|
+
|
|
412
|
+
for (const p of sorted) {
|
|
413
|
+
const color = SEVERITY_COLORS[p.severity] || '';
|
|
414
|
+
console.log(` ${color}[${p.severity}]${RESET} ${p.name} (${p.id})`);
|
|
415
|
+
console.log(`${DIM} ${p.description}${RESET}`);
|
|
416
|
+
console.log(`${DIM} Fix: ${p.fix}${RESET}`);
|
|
417
|
+
console.log('');
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Print the full anti-pattern catalog.
|
|
423
|
+
* @param {Object} [options] - Display options.
|
|
424
|
+
* @param {boolean} [options.json] - Output as JSON.
|
|
425
|
+
*/
|
|
426
|
+
function printAntiPatternCatalog(options = {}) {
|
|
427
|
+
const all = getAntiPatterns();
|
|
428
|
+
if (options.json) {
|
|
429
|
+
console.log(JSON.stringify(all, null, 2));
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const SEVERITY_COLORS = {
|
|
434
|
+
critical: '\x1b[31m',
|
|
435
|
+
high: '\x1b[33m',
|
|
436
|
+
medium: '\x1b[36m',
|
|
437
|
+
low: '\x1b[2m',
|
|
438
|
+
};
|
|
439
|
+
const RESET = '\x1b[0m';
|
|
440
|
+
const BOLD = '\x1b[1m';
|
|
441
|
+
const DIM = '\x1b[2m';
|
|
442
|
+
|
|
443
|
+
console.log('');
|
|
444
|
+
console.log(`${BOLD} nerviq anti-pattern catalog${RESET}`);
|
|
445
|
+
console.log(`${DIM} ${'═'.repeat(39)}${RESET}`);
|
|
446
|
+
console.log(` ${all.length} anti-patterns registered`);
|
|
447
|
+
console.log('');
|
|
448
|
+
|
|
449
|
+
const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
450
|
+
const sorted = [...all].sort((a, b) => (severityOrder[a.severity] || 9) - (severityOrder[b.severity] || 9));
|
|
451
|
+
|
|
452
|
+
for (const p of sorted) {
|
|
453
|
+
const color = SEVERITY_COLORS[p.severity] || '';
|
|
454
|
+
console.log(` ${color}[${p.severity}]${RESET} ${p.name} (${p.id})`);
|
|
455
|
+
console.log(`${DIM} ${p.description}${RESET}`);
|
|
456
|
+
console.log(`${DIM} Platforms: ${p.platforms.join(', ')}${RESET}`);
|
|
457
|
+
console.log(`${DIM} Fix: ${p.fix}${RESET}`);
|
|
458
|
+
console.log('');
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
module.exports = {
|
|
463
|
+
ANTI_PATTERNS,
|
|
464
|
+
getAntiPatterns,
|
|
465
|
+
detectAntiPatterns,
|
|
466
|
+
printAntiPatterns,
|
|
467
|
+
printAntiPatternCatalog,
|
|
468
|
+
};
|
package/src/benchmark.js
CHANGED
|
@@ -247,18 +247,23 @@ function renderBenchmarkMarkdown(report) {
|
|
|
247
247
|
* Run a before/after benchmark on an isolated copy of the project.
|
|
248
248
|
* @param {Object} options - Benchmark options.
|
|
249
249
|
* @param {string} options.dir - Project directory to benchmark.
|
|
250
|
+
* @param {string} [options.external] - External repo path to benchmark instead of cwd.
|
|
250
251
|
* @param {string} [options.profile] - Permission profile to use during setup.
|
|
251
252
|
* @param {string[]} [options.mcpPacks] - MCP pack keys to include in setup.
|
|
252
253
|
* @returns {Promise<Object>} Benchmark report with before/after scores, delta, and workflow evidence.
|
|
253
254
|
*/
|
|
254
255
|
async function runBenchmark(options) {
|
|
255
256
|
const platform = options.platform || 'claude';
|
|
256
|
-
const
|
|
257
|
+
const sourceDir = options.external || options.dir;
|
|
258
|
+
if (options.external && !fs.existsSync(options.external)) {
|
|
259
|
+
throw new Error(`External repo path not found: ${options.external}`);
|
|
260
|
+
}
|
|
261
|
+
const before = await audit({ dir: sourceDir, silent: true, platform });
|
|
257
262
|
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'claudex-benchmark-'));
|
|
258
263
|
const sandboxDir = path.join(tempRoot, 'repo');
|
|
259
264
|
|
|
260
265
|
try {
|
|
261
|
-
copyProject(
|
|
266
|
+
copyProject(sourceDir, sandboxDir);
|
|
262
267
|
const applyResult = await setup({
|
|
263
268
|
dir: sandboxDir,
|
|
264
269
|
auto: true,
|
|
@@ -278,7 +283,7 @@ async function runBenchmark(options) {
|
|
|
278
283
|
schemaVersion: 1,
|
|
279
284
|
generatedBy: `nerviq@${version}`,
|
|
280
285
|
createdAt: new Date().toISOString(),
|
|
281
|
-
directory:
|
|
286
|
+
directory: sourceDir,
|
|
282
287
|
platform,
|
|
283
288
|
methodology: [
|
|
284
289
|
'Run a baseline audit on the source repo.',
|
package/src/governance.js
CHANGED
|
@@ -60,6 +60,7 @@ const HOOK_REGISTRY = [
|
|
|
60
60
|
filesTouched: [],
|
|
61
61
|
sideEffects: ['Stops the action and returns a block decision when a secret path is targeted.'],
|
|
62
62
|
risk: 'low',
|
|
63
|
+
riskLevel: 'high',
|
|
63
64
|
dryRunExample: 'Attempt to read `.env` and confirm the hook blocks the request.',
|
|
64
65
|
rollbackPath: 'Remove the PreToolUse registration from settings.json.',
|
|
65
66
|
},
|
|
@@ -72,6 +73,7 @@ const HOOK_REGISTRY = [
|
|
|
72
73
|
filesTouched: ['Working tree files targeted by eslint/ruff fixes'],
|
|
73
74
|
sideEffects: ['May auto-fix formatting or lint issues.', 'Can modify the same files that were just edited.'],
|
|
74
75
|
risk: 'medium',
|
|
76
|
+
riskLevel: 'medium',
|
|
75
77
|
dryRunExample: 'Edit a JS or Python file and inspect whether eslint or ruff would run.',
|
|
76
78
|
rollbackPath: 'Remove the PostToolUse hook entry or delete the script.',
|
|
77
79
|
},
|
|
@@ -84,6 +86,7 @@ const HOOK_REGISTRY = [
|
|
|
84
86
|
filesTouched: ['.claude/logs/file-changes.log'],
|
|
85
87
|
sideEffects: ['Creates the logs directory on first use.', 'Adds a timestamped audit line per file change.'],
|
|
86
88
|
risk: 'low',
|
|
89
|
+
riskLevel: 'low',
|
|
87
90
|
dryRunExample: 'Edit one file and verify the log entry is appended.',
|
|
88
91
|
rollbackPath: 'Remove the PostToolUse hook entry and delete the log file if desired.',
|
|
89
92
|
},
|
|
@@ -96,6 +99,7 @@ const HOOK_REGISTRY = [
|
|
|
96
99
|
filesTouched: [],
|
|
97
100
|
sideEffects: ['Returns a systemMessage warning if duplicates are found.'],
|
|
98
101
|
risk: 'low',
|
|
102
|
+
riskLevel: 'low',
|
|
99
103
|
dryRunExample: 'Edit a catalog file and verify duplicate check runs without blocking.',
|
|
100
104
|
rollbackPath: 'Remove the PostToolUse hook entry from settings.',
|
|
101
105
|
},
|
|
@@ -108,6 +112,7 @@ const HOOK_REGISTRY = [
|
|
|
108
112
|
filesTouched: ['tools/failure-log.txt'],
|
|
109
113
|
sideEffects: ['Logs alerts to failure log.', 'Returns a systemMessage warning if patterns detected.'],
|
|
110
114
|
risk: 'low',
|
|
115
|
+
riskLevel: 'low',
|
|
111
116
|
dryRunExample: 'Run a WebFetch and verify output is scanned for injection patterns.',
|
|
112
117
|
rollbackPath: 'Remove the PostToolUse hook entry from settings.',
|
|
113
118
|
},
|
|
@@ -120,6 +125,7 @@ const HOOK_REGISTRY = [
|
|
|
120
125
|
filesTouched: [],
|
|
121
126
|
sideEffects: ['Returns a systemMessage warning if drift is detected.'],
|
|
122
127
|
risk: 'low',
|
|
128
|
+
riskLevel: 'low',
|
|
123
129
|
dryRunExample: 'Edit a product-facing file and verify drift check runs.',
|
|
124
130
|
rollbackPath: 'Remove the PostToolUse hook entry from settings.',
|
|
125
131
|
},
|
|
@@ -132,11 +138,48 @@ const HOOK_REGISTRY = [
|
|
|
132
138
|
filesTouched: ['tools/change-log.txt', 'tools/failure-log.txt'],
|
|
133
139
|
sideEffects: ['Archives logs over 500KB.', 'Returns a systemMessage with workspace info.'],
|
|
134
140
|
risk: 'low',
|
|
141
|
+
riskLevel: 'low',
|
|
135
142
|
dryRunExample: 'Start a new session and verify log rotation runs.',
|
|
136
143
|
rollbackPath: 'Remove the SessionStart hook entry from settings.',
|
|
137
144
|
},
|
|
138
145
|
];
|
|
139
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Classify the risk level of a hook based on its event type and characteristics.
|
|
149
|
+
* - high: PreToolUse hooks that can block operations (exit 2)
|
|
150
|
+
* - medium: PostToolUse hooks that modify files or warn (exit 1 or write-only)
|
|
151
|
+
* - low: Informational hooks (PostToolUse notification/logging, SessionStart)
|
|
152
|
+
* @param {Object} hook - A hook entry from HOOK_REGISTRY or a custom hook.
|
|
153
|
+
* @returns {string} Risk level: 'high', 'medium', or 'low'.
|
|
154
|
+
*/
|
|
155
|
+
function classifyHookRiskLevel(hook) {
|
|
156
|
+
// PreToolUse hooks can block operations (exit code 2 blocks the tool call)
|
|
157
|
+
if (hook.triggerPoint === 'PreToolUse') {
|
|
158
|
+
return 'high';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// SessionStart hooks are informational — they run once at session init
|
|
162
|
+
if (hook.triggerPoint === 'SessionStart') {
|
|
163
|
+
return 'low';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// PostToolUse hooks that touch files are medium risk (they can modify working tree)
|
|
167
|
+
if (hook.triggerPoint === 'PostToolUse') {
|
|
168
|
+
if (Array.isArray(hook.filesTouched) && hook.filesTouched.length > 0) {
|
|
169
|
+
// Hooks that only write to log files are low risk
|
|
170
|
+
const onlyLogs = hook.filesTouched.every(f =>
|
|
171
|
+
/\blog|\.log\b/i.test(f) || f.includes('logs/')
|
|
172
|
+
);
|
|
173
|
+
if (onlyLogs) return 'low';
|
|
174
|
+
return 'medium';
|
|
175
|
+
}
|
|
176
|
+
return 'low';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Default: unknown trigger points get medium risk
|
|
180
|
+
return 'medium';
|
|
181
|
+
}
|
|
182
|
+
|
|
140
183
|
const POLICY_PACKS = [
|
|
141
184
|
{
|
|
142
185
|
key: 'baseline-engineering',
|
|
@@ -377,7 +420,9 @@ function printGovernanceSummary(summary, options = {}) {
|
|
|
377
420
|
console.log(' Hook Registry');
|
|
378
421
|
for (const hook of summary.hookRegistry) {
|
|
379
422
|
const riskColor = hook.risk === 'low' ? '\x1b[32m' : hook.risk === 'medium' ? '\x1b[33m' : '\x1b[31m';
|
|
380
|
-
|
|
423
|
+
const rl = hook.riskLevel || classifyHookRiskLevel(hook);
|
|
424
|
+
const rlColor = rl === 'low' ? '\x1b[32m' : rl === 'medium' ? '\x1b[33m' : '\x1b[31m';
|
|
425
|
+
console.log(` - ${hook.file} ${riskColor}[${hook.risk} risk]\x1b[0m ${rlColor}[${rl} riskLevel]\x1b[0m`);
|
|
381
426
|
console.log(` ${hook.triggerPoint}${hook.matcher ? ` ${hook.matcher}` : ''} -> ${hook.purpose}`);
|
|
382
427
|
}
|
|
383
428
|
console.log('');
|
|
@@ -448,7 +493,8 @@ function renderGovernanceMarkdown(summary) {
|
|
|
448
493
|
|
|
449
494
|
lines.push('', '## Hook Registry');
|
|
450
495
|
for (const hook of summary.hookRegistry) {
|
|
451
|
-
|
|
496
|
+
const rl = hook.riskLevel || classifyHookRiskLevel(hook);
|
|
497
|
+
lines.push(`- **${hook.key}** \`${hook.triggerPoint}${hook.matcher ? ` ${hook.matcher}` : ''}\` | risk: \`${hook.risk}\` | riskLevel: \`${rl}\``);
|
|
452
498
|
lines.push(` - File: ${hook.file}`);
|
|
453
499
|
lines.push(` - Purpose: ${hook.purpose}`);
|
|
454
500
|
lines.push(` - Dry run: ${hook.dryRunExample}`);
|
|
@@ -520,4 +566,5 @@ module.exports = {
|
|
|
520
566
|
getGovernanceSummary,
|
|
521
567
|
printGovernanceSummary,
|
|
522
568
|
renderGovernanceMarkdown,
|
|
569
|
+
classifyHookRiskLevel,
|
|
523
570
|
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recommendation Rules Export
|
|
3
|
+
*
|
|
4
|
+
* Reads all TECHNIQUES, groups by category, and generates
|
|
5
|
+
* a structured JSON-serializable recommendation rules object.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { TECHNIQUES } = require('./techniques');
|
|
9
|
+
const { version } = require('../package.json');
|
|
10
|
+
|
|
11
|
+
const IMPACT_ORDER = { critical: 4, high: 3, medium: 2, low: 1 };
|
|
12
|
+
|
|
13
|
+
function impactLabel(avg) {
|
|
14
|
+
if (avg >= 3.5) return 'critical';
|
|
15
|
+
if (avg >= 2.5) return 'high';
|
|
16
|
+
if (avg >= 1.5) return 'medium';
|
|
17
|
+
return 'low';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function generateRecommendationRules(options) {
|
|
21
|
+
const opts = options || {};
|
|
22
|
+
const entries = Object.entries(TECHNIQUES);
|
|
23
|
+
|
|
24
|
+
// Group by category
|
|
25
|
+
const grouped = {};
|
|
26
|
+
for (const [key, t] of entries) {
|
|
27
|
+
const cat = t.category;
|
|
28
|
+
if (!grouped[cat]) grouped[cat] = [];
|
|
29
|
+
grouped[cat].push({ key, ...t });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Build categories summary
|
|
33
|
+
const categories = {};
|
|
34
|
+
for (const [cat, checks] of Object.entries(grouped)) {
|
|
35
|
+
const weights = checks.map(c => IMPACT_ORDER[c.impact] || 0);
|
|
36
|
+
const avgWeight = weights.reduce((a, b) => a + b, 0) / weights.length;
|
|
37
|
+
|
|
38
|
+
// Top 5 by impact weight (descending), then by rating (descending)
|
|
39
|
+
const sorted = [...checks].sort((a, b) => {
|
|
40
|
+
const impactDiff = (IMPACT_ORDER[b.impact] || 0) - (IMPACT_ORDER[a.impact] || 0);
|
|
41
|
+
if (impactDiff !== 0) return impactDiff;
|
|
42
|
+
return (b.rating || 0) - (a.rating || 0);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const topChecks = sorted.slice(0, 5).map(c => ({
|
|
46
|
+
key: c.key,
|
|
47
|
+
name: c.name,
|
|
48
|
+
impact: c.impact,
|
|
49
|
+
fix: c.fix,
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
categories[cat] = {
|
|
53
|
+
checkCount: checks.length,
|
|
54
|
+
averageImpact: impactLabel(avgWeight),
|
|
55
|
+
topChecks,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const byRepoType = {
|
|
60
|
+
frontend: ['security', 'design', 'performance-budget', 'accessibility'],
|
|
61
|
+
backend: ['security', 'api-versioning', 'caching', 'rate-limiting', 'observability'],
|
|
62
|
+
fullstack: ['security', 'quality', 'automation', 'observability'],
|
|
63
|
+
mobile: ['flutter', 'swift', 'kotlin', 'security'],
|
|
64
|
+
infrastructure: ['devops', 'supply-chain', 'monitoring'],
|
|
65
|
+
library: ['docs-quality', 'quality', 'git'],
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const byMaturity = {
|
|
69
|
+
'new-project': { focus: ['hygiene', 'security', 'quality'], skipCategories: ['quality-deep', 'enterprise'] },
|
|
70
|
+
growing: { focus: ['automation', 'workflow', 'observability'], skipCategories: [] },
|
|
71
|
+
mature: { focus: ['quality-deep', 'performance-budget', 'governance'], skipCategories: [] },
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
generatedAt: new Date().toISOString(),
|
|
76
|
+
version,
|
|
77
|
+
totalRules: entries.length,
|
|
78
|
+
categories,
|
|
79
|
+
byRepoType,
|
|
80
|
+
byMaturity,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = { generateRecommendationRules };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Last-verified dates for technique checks.
|
|
3
|
+
* Updated when checks are re-tested against live platforms.
|
|
4
|
+
*/
|
|
5
|
+
const VERIFICATION_DATES = {
|
|
6
|
+
// Core checks (verified 2026-04-06 via self-audit on nerviq repo)
|
|
7
|
+
claudeMd: '2026-04-06',
|
|
8
|
+
mermaidArchitecture: '2026-04-06',
|
|
9
|
+
pathRules: '2026-04-06',
|
|
10
|
+
importSyntax: '2026-04-06',
|
|
11
|
+
underlines200: '2026-04-06',
|
|
12
|
+
verificationLoop: '2026-04-06',
|
|
13
|
+
testCommand: '2026-04-06',
|
|
14
|
+
lintCommand: '2026-04-06',
|
|
15
|
+
buildCommand: '2026-04-06',
|
|
16
|
+
gitIgnoreClaudeTracked: '2026-04-06',
|
|
17
|
+
gitIgnoreEnv: '2026-04-06',
|
|
18
|
+
gitIgnoreNodeModules: '2026-04-06',
|
|
19
|
+
noSecretsInClaude: '2026-04-06',
|
|
20
|
+
customCommands: '2026-04-06',
|
|
21
|
+
multipleCommands: '2026-04-06',
|
|
22
|
+
deployCommand: '2026-04-06',
|
|
23
|
+
reviewCommand: '2026-04-06',
|
|
24
|
+
skills: '2026-04-06',
|
|
25
|
+
multipleSkills: '2026-04-06',
|
|
26
|
+
agents: '2026-04-06',
|
|
27
|
+
multipleAgents: '2026-04-06',
|
|
28
|
+
multipleRules: '2026-04-06',
|
|
29
|
+
settingsPermissions: '2026-04-06',
|
|
30
|
+
permissionDeny: '2026-04-06',
|
|
31
|
+
noBypassPermissions: '2026-04-06',
|
|
32
|
+
secretsProtection: '2026-04-06',
|
|
33
|
+
securityReview: '2026-04-06',
|
|
34
|
+
hooks: '2026-04-06',
|
|
35
|
+
hooksInSettings: '2026-04-06',
|
|
36
|
+
preToolUseHook: '2026-04-06',
|
|
37
|
+
postToolUseHook: '2026-04-06',
|
|
38
|
+
sessionStartHook: '2026-04-06',
|
|
39
|
+
ciPipeline: '2026-04-06',
|
|
40
|
+
readme: '2026-04-06',
|
|
41
|
+
changelog: '2026-04-06',
|
|
42
|
+
contributing: '2026-04-06',
|
|
43
|
+
license: '2026-04-06',
|
|
44
|
+
editorconfig: '2026-04-06',
|
|
45
|
+
nvmrc: '2026-04-06',
|
|
46
|
+
compactionAwareness: '2026-04-06',
|
|
47
|
+
contextManagement: '2026-04-06',
|
|
48
|
+
mcpServers: '2026-04-06',
|
|
49
|
+
context7Mcp: '2026-04-06',
|
|
50
|
+
xmlTags: '2026-04-06',
|
|
51
|
+
fewShotExamples: '2026-04-06',
|
|
52
|
+
roleDefinition: '2026-04-06',
|
|
53
|
+
constraintBlocks: '2026-04-06',
|
|
54
|
+
claudeMdFreshness: '2026-04-06',
|
|
55
|
+
claudeMdNoContradictions: '2026-04-06',
|
|
56
|
+
hooksAreSpecific: '2026-04-06',
|
|
57
|
+
commandsUseArguments: '2026-04-06',
|
|
58
|
+
agentsHaveMaxTurns: '2026-04-06',
|
|
59
|
+
securityReviewInWorkflow: '2026-04-06',
|
|
60
|
+
testCoverage: '2026-04-06',
|
|
61
|
+
agentHasAllowedTools: '2026-04-06',
|
|
62
|
+
sandboxAwareness: '2026-04-06',
|
|
63
|
+
denyRulesDepth: '2026-04-06',
|
|
64
|
+
hasSnapshotHistory: '2026-04-06',
|
|
65
|
+
negativeInstructions: '2026-04-06',
|
|
66
|
+
outputStyleGuidance: '2026-04-06',
|
|
67
|
+
githubActionsOrCI: '2026-04-06',
|
|
68
|
+
projectDescriptionInClaudeMd: '2026-04-06',
|
|
69
|
+
directoryStructureInClaudeMd: '2026-04-06',
|
|
70
|
+
multipleHookTypes: '2026-04-06',
|
|
71
|
+
gitIgnoreClaudeLocal: '2026-04-06',
|
|
72
|
+
envExampleExists: '2026-04-06',
|
|
73
|
+
packageJsonHasScripts: '2026-04-06',
|
|
74
|
+
noDeprecatedPatterns: '2026-04-06',
|
|
75
|
+
claudeMdQuality: '2026-04-06',
|
|
76
|
+
mcpJsonProject: '2026-04-06',
|
|
77
|
+
rulesDirectory: '2026-04-06',
|
|
78
|
+
gitignoreClaudeLocal: '2026-04-06',
|
|
79
|
+
pyprojectTomlExists: '2026-04-06',
|
|
80
|
+
pythonSecurityScanner: '2026-04-06',
|
|
81
|
+
pythonAsyncPatterns: '2026-04-06',
|
|
82
|
+
pythonEnvExample: '2026-04-06',
|
|
83
|
+
pythonAPISchema: '2026-04-06',
|
|
84
|
+
pythonMonorepo: '2026-04-06',
|
|
85
|
+
pythonDataValidation: '2026-04-06',
|
|
86
|
+
mcpBudgetHealthy: '2026-04-06',
|
|
87
|
+
hookExitCodesDefined: '2026-04-06',
|
|
88
|
+
consistencyPassAtK: '2026-04-06',
|
|
89
|
+
sseEndpoint: '2026-04-06',
|
|
90
|
+
realtimeAuth: '2026-04-06',
|
|
91
|
+
healthEndpoint: '2026-04-06',
|
|
92
|
+
privacyPolicy: '2026-04-06',
|
|
93
|
+
piiHandling: '2026-04-06',
|
|
94
|
+
gdprCompliance: '2026-04-06',
|
|
95
|
+
dataEncryption: '2026-04-06',
|
|
96
|
+
errorReporting: '2026-04-06',
|
|
97
|
+
sbomExists: '2026-04-06',
|
|
98
|
+
dependencyPinning: '2026-04-06',
|
|
99
|
+
provenanceAttestation: '2026-04-06',
|
|
100
|
+
lockfileIntegrity: '2026-04-06',
|
|
101
|
+
apiVersionHeader: '2026-04-06',
|
|
102
|
+
deprecationNotices: '2026-04-06',
|
|
103
|
+
apiChangelog: '2026-04-06',
|
|
104
|
+
backwardCompat: '2026-04-06',
|
|
105
|
+
cdnConfigured: '2026-04-06',
|
|
106
|
+
cacheHeaders: '2026-04-06',
|
|
107
|
+
rateLimitHeaders: '2026-04-06',
|
|
108
|
+
featureFlagTests: '2026-04-06',
|
|
109
|
+
contributingGuide: '2026-04-06',
|
|
110
|
+
licenseDeclared: '2026-04-06',
|
|
111
|
+
testingStrategyFrameworkDetected: '2026-04-06',
|
|
112
|
+
testingStrategyCoverageConfigExists: '2026-04-06',
|
|
113
|
+
testingStrategySnapshotTestsMentioned: '2026-04-06',
|
|
114
|
+
testingStrategyTestCommandDocumented: '2026-04-06',
|
|
115
|
+
testingStrategyCiRunsTests: '2026-04-06',
|
|
116
|
+
codeQualityLinterConfigured: '2026-04-06',
|
|
117
|
+
codeQualityFormatterConfigured: '2026-04-06',
|
|
118
|
+
codeQualityComplexityAwareness: '2026-04-06',
|
|
119
|
+
codeQualityConsistentNamingDocumented: '2026-04-06',
|
|
120
|
+
codeQualityCodeReviewProcessMentioned: '2026-04-06',
|
|
121
|
+
dependencyManagementLockfilePresent: '2026-04-06',
|
|
122
|
+
dependencyManagementOutdatedDepsAwareness: '2026-04-06',
|
|
123
|
+
dependencyManagementLicenseCompliance: '2026-04-06',
|
|
124
|
+
dependencyManagementNpmAuditConfigured: '2026-04-06',
|
|
125
|
+
dependencyManagementAutoUpdatePolicy: '2026-04-06',
|
|
126
|
+
costOptimizationTokenUsageAwareness: '2026-04-06',
|
|
127
|
+
costOptimizationModelSelectionGuidance: '2026-04-06',
|
|
128
|
+
costOptimizationCachingGuidance: '2026-04-06',
|
|
129
|
+
costOptimizationBudgetGuardrails: '2026-04-06',
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
function getVerificationDate(checkKey) {
|
|
133
|
+
return VERIFICATION_DATES[checkKey] || null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getVerificationStats() {
|
|
137
|
+
const total = Object.keys(VERIFICATION_DATES).length;
|
|
138
|
+
const dates = Object.values(VERIFICATION_DATES);
|
|
139
|
+
const sorted = [...dates].sort();
|
|
140
|
+
const newest = sorted[sorted.length - 1];
|
|
141
|
+
const oldest = sorted[0];
|
|
142
|
+
return { total, newest, oldest };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
module.exports = { VERIFICATION_DATES, getVerificationDate, getVerificationStats };
|