@kevinrabun/judges 3.40.0 → 3.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +63 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/auto-calibrate.d.ts +15 -0
- package/dist/commands/auto-calibrate.d.ts.map +1 -0
- package/dist/commands/auto-calibrate.js +107 -0
- package/dist/commands/auto-calibrate.js.map +1 -0
- package/dist/commands/config-migrate.d.ts +44 -0
- package/dist/commands/config-migrate.d.ts.map +1 -0
- package/dist/commands/config-migrate.js +241 -0
- package/dist/commands/config-migrate.js.map +1 -0
- package/dist/commands/dedup-report.d.ts +13 -0
- package/dist/commands/dedup-report.d.ts.map +1 -0
- package/dist/commands/dedup-report.js +138 -0
- package/dist/commands/dedup-report.js.map +1 -0
- package/dist/commands/dep-audit.d.ts +53 -0
- package/dist/commands/dep-audit.d.ts.map +1 -0
- package/dist/commands/dep-audit.js +278 -0
- package/dist/commands/dep-audit.js.map +1 -0
- package/dist/commands/deprecated.d.ts +48 -0
- package/dist/commands/deprecated.d.ts.map +1 -0
- package/dist/commands/deprecated.js +202 -0
- package/dist/commands/deprecated.js.map +1 -0
- package/dist/commands/fix-pr.d.ts +23 -0
- package/dist/commands/fix-pr.d.ts.map +1 -0
- package/dist/commands/fix-pr.js +323 -0
- package/dist/commands/fix-pr.js.map +1 -0
- package/dist/commands/interactive-fix.d.ts +23 -0
- package/dist/commands/interactive-fix.d.ts.map +1 -0
- package/dist/commands/interactive-fix.js +140 -0
- package/dist/commands/interactive-fix.js.map +1 -0
- package/dist/commands/monorepo.d.ts +38 -0
- package/dist/commands/monorepo.d.ts.map +1 -0
- package/dist/commands/monorepo.js +233 -0
- package/dist/commands/monorepo.js.map +1 -0
- package/dist/commands/notify.d.ts +79 -0
- package/dist/commands/notify.d.ts.map +1 -0
- package/dist/commands/notify.js +325 -0
- package/dist/commands/notify.js.map +1 -0
- package/dist/commands/quality-gate.d.ts +70 -0
- package/dist/commands/quality-gate.d.ts.map +1 -0
- package/dist/commands/quality-gate.js +264 -0
- package/dist/commands/quality-gate.js.map +1 -0
- package/dist/evaluators/framework-rules.d.ts +59 -0
- package/dist/evaluators/framework-rules.d.ts.map +1 -0
- package/dist/evaluators/framework-rules.js +292 -0
- package/dist/evaluators/framework-rules.js.map +1 -0
- package/dist/parallel.d.ts +53 -0
- package/dist/parallel.d.ts.map +1 -0
- package/dist/parallel.js +170 -0
- package/dist/parallel.js.map +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `judges config-migrate` — Configuration migration assistant.
|
|
3
|
+
*
|
|
4
|
+
* Helps users upgrade their .judgesrc configs between Judges versions.
|
|
5
|
+
* Detects deprecated fields, renamed keys, and structural changes,
|
|
6
|
+
* then applies automatic or guided migrations.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* judges config-migrate # Analyze current .judgesrc
|
|
10
|
+
* judges config-migrate --apply # Apply migrations in place
|
|
11
|
+
* judges config-migrate --dry-run # Show changes without writing
|
|
12
|
+
* judges config-migrate --config path # Specify config path
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
15
|
+
import { resolve } from "path";
|
|
16
|
+
// ─── Migration Rules ────────────────────────────────────────────────────────
|
|
17
|
+
const MIGRATIONS = [
|
|
18
|
+
{
|
|
19
|
+
id: "M001-severity-rename",
|
|
20
|
+
since: "3.0.0",
|
|
21
|
+
description: 'Rename "warning" severity to "medium" (severity levels: critical, high, medium, low, info)',
|
|
22
|
+
level: "error",
|
|
23
|
+
detect: (config) => {
|
|
24
|
+
const overrides = config.ruleOverrides;
|
|
25
|
+
if (!overrides)
|
|
26
|
+
return false;
|
|
27
|
+
return Object.values(overrides).some((o) => o.severity === "warning");
|
|
28
|
+
},
|
|
29
|
+
apply: (config) => {
|
|
30
|
+
const overrides = config.ruleOverrides;
|
|
31
|
+
for (const [key, val] of Object.entries(overrides)) {
|
|
32
|
+
if (val.severity === "warning") {
|
|
33
|
+
overrides[key] = { ...val, severity: "medium" };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { ...config, ruleOverrides: overrides };
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "M002-min-severity-string",
|
|
41
|
+
since: "3.0.0",
|
|
42
|
+
description: "Numeric minSeverity (1-5) should be replaced with string value (critical/high/medium/low/info)",
|
|
43
|
+
level: "error",
|
|
44
|
+
detect: (config) => typeof config.minSeverity === "number",
|
|
45
|
+
apply: (config) => {
|
|
46
|
+
const mapping = { 5: "critical", 4: "high", 3: "medium", 2: "low", 1: "info" };
|
|
47
|
+
const newSev = mapping[config.minSeverity] || "medium";
|
|
48
|
+
return { ...config, minSeverity: newSev };
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "M003-disabled-rules-object",
|
|
53
|
+
since: "3.10.0",
|
|
54
|
+
description: "disabledRules should be an array of strings, not an object",
|
|
55
|
+
level: "error",
|
|
56
|
+
detect: (config) => config.disabledRules !== undefined && !Array.isArray(config.disabledRules),
|
|
57
|
+
apply: (config) => {
|
|
58
|
+
const obj = config.disabledRules;
|
|
59
|
+
return { ...config, disabledRules: Object.keys(obj) };
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "M004-ignorePatterns-to-exclude",
|
|
64
|
+
since: "3.15.0",
|
|
65
|
+
description: 'Renamed "ignorePatterns" to "exclude" for consistency',
|
|
66
|
+
level: "warning",
|
|
67
|
+
detect: (config) => "ignorePatterns" in config,
|
|
68
|
+
apply: (config) => {
|
|
69
|
+
const { ignorePatterns, ...rest } = config;
|
|
70
|
+
const existing = rest.exclude || [];
|
|
71
|
+
const patterns = Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns];
|
|
72
|
+
return { ...rest, exclude: [...existing, ...patterns] };
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "M005-level-to-preset",
|
|
77
|
+
since: "3.20.0",
|
|
78
|
+
description: 'Renamed "level" to "preset" for config profiles',
|
|
79
|
+
level: "warning",
|
|
80
|
+
detect: (config) => "level" in config && !("preset" in config),
|
|
81
|
+
apply: (config) => {
|
|
82
|
+
const { level, ...rest } = config;
|
|
83
|
+
return { ...rest, preset: level };
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "M006-whitelist-to-include",
|
|
88
|
+
since: "3.15.0",
|
|
89
|
+
description: 'Renamed "whitelist" to "include" for inclusive terminology',
|
|
90
|
+
level: "warning",
|
|
91
|
+
detect: (config) => "whitelist" in config,
|
|
92
|
+
apply: (config) => {
|
|
93
|
+
const { whitelist, ...rest } = config;
|
|
94
|
+
const existing = rest.include || [];
|
|
95
|
+
const patterns = Array.isArray(whitelist) ? whitelist : [whitelist];
|
|
96
|
+
return { ...rest, include: [...existing, ...patterns] };
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "M007-output-to-format",
|
|
101
|
+
since: "3.20.0",
|
|
102
|
+
description: 'Renamed "output" to "format" for output format specification',
|
|
103
|
+
level: "warning",
|
|
104
|
+
detect: (config) => "output" in config && !("format" in config),
|
|
105
|
+
apply: (config) => {
|
|
106
|
+
const { output, ...rest } = config;
|
|
107
|
+
return { ...rest, format: output };
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "M008-judges-to-disabledJudges",
|
|
112
|
+
since: "3.25.0",
|
|
113
|
+
description: '"skipJudges" array should be "disabledJudges"',
|
|
114
|
+
level: "warning",
|
|
115
|
+
detect: (config) => "skipJudges" in config,
|
|
116
|
+
apply: (config) => {
|
|
117
|
+
const { skipJudges, ...rest } = config;
|
|
118
|
+
const existing = rest.disabledJudges || [];
|
|
119
|
+
const skip = Array.isArray(skipJudges) ? skipJudges : [skipJudges];
|
|
120
|
+
return { ...rest, disabledJudges: [...existing, ...skip] };
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "M009-data-adapter-string",
|
|
125
|
+
since: "3.35.0",
|
|
126
|
+
description: "dataAdapter should be an object { type, url?, headers? }, not a string",
|
|
127
|
+
level: "warning",
|
|
128
|
+
detect: (config) => typeof config.dataAdapter === "string",
|
|
129
|
+
apply: (config) => {
|
|
130
|
+
const da = config.dataAdapter;
|
|
131
|
+
if (da.startsWith("http")) {
|
|
132
|
+
return { ...config, dataAdapter: { type: "http", url: da } };
|
|
133
|
+
}
|
|
134
|
+
return { ...config, dataAdapter: { type: "filesystem" } };
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "M010-custom-rules-flat",
|
|
139
|
+
since: "3.30.0",
|
|
140
|
+
description: 'customRules entries require "id" field (previously auto-generated from index)',
|
|
141
|
+
level: "info",
|
|
142
|
+
detect: (config) => {
|
|
143
|
+
const rules = config.customRules;
|
|
144
|
+
if (!rules || !Array.isArray(rules))
|
|
145
|
+
return false;
|
|
146
|
+
return rules.some((r) => !r.id);
|
|
147
|
+
},
|
|
148
|
+
apply: (config) => {
|
|
149
|
+
const rules = config.customRules;
|
|
150
|
+
const patched = rules.map((r, i) => (r.id ? r : { ...r, id: `CUSTOM-${String(i + 1).padStart(3, "0")}` }));
|
|
151
|
+
return { ...config, customRules: patched };
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
// ─── Analysis ───────────────────────────────────────────────────────────────
|
|
156
|
+
export function analyzeConfig(config) {
|
|
157
|
+
const applied = [];
|
|
158
|
+
let migratedConfig = { ...config };
|
|
159
|
+
let hasChanges = false;
|
|
160
|
+
for (const rule of MIGRATIONS) {
|
|
161
|
+
if (rule.detect(config)) {
|
|
162
|
+
applied.push({ id: rule.id, description: rule.description, level: rule.level });
|
|
163
|
+
migratedConfig = rule.apply(migratedConfig);
|
|
164
|
+
hasChanges = true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { configPath: "", applied, hasChanges, migratedConfig: hasChanges ? migratedConfig : undefined };
|
|
168
|
+
}
|
|
169
|
+
// ─── CLI Runner ─────────────────────────────────────────────────────────────
|
|
170
|
+
export function runConfigMigrate(argv) {
|
|
171
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
172
|
+
console.log(`
|
|
173
|
+
judges config-migrate — Configuration migration assistant
|
|
174
|
+
|
|
175
|
+
Usage:
|
|
176
|
+
judges config-migrate Analyze .judgesrc for issues
|
|
177
|
+
judges config-migrate --apply Apply migrations in place
|
|
178
|
+
judges config-migrate --dry-run Show changes without writing
|
|
179
|
+
judges config-migrate --config <path> Specify config file path
|
|
180
|
+
|
|
181
|
+
Detects and fixes:
|
|
182
|
+
• Renamed fields (ignorePatterns→exclude, output→format, etc.)
|
|
183
|
+
• Deprecated value types (numeric severity → string)
|
|
184
|
+
• Structural changes (object → array for disabledRules)
|
|
185
|
+
• Missing required fields (customRules.id)
|
|
186
|
+
• Terminology updates (whitelist→include, skipJudges→disabledJudges)
|
|
187
|
+
|
|
188
|
+
Options:
|
|
189
|
+
--apply Apply migrations and write updated config
|
|
190
|
+
--dry-run Show what would change (default behavior)
|
|
191
|
+
--config <path> Path to .judgesrc file (default: ./.judgesrc)
|
|
192
|
+
--format json JSON output
|
|
193
|
+
--help, -h Show this help
|
|
194
|
+
`);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const configPath = resolve(argv.find((_a, i) => argv[i - 1] === "--config") || ".judgesrc");
|
|
198
|
+
const shouldApply = argv.includes("--apply");
|
|
199
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
200
|
+
if (!existsSync(configPath)) {
|
|
201
|
+
console.log(`\n No config file found at ${configPath}\n`);
|
|
202
|
+
console.log(" Run 'judges init' to create a .judgesrc, or specify --config <path>\n");
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
let config;
|
|
206
|
+
try {
|
|
207
|
+
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
208
|
+
}
|
|
209
|
+
catch (err) {
|
|
210
|
+
console.error(`\n Error parsing ${configPath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const result = analyzeConfig(config);
|
|
214
|
+
result.configPath = configPath;
|
|
215
|
+
if (format === "json") {
|
|
216
|
+
console.log(JSON.stringify(result, null, 2));
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
console.log(`\n Config Migration Analysis: ${configPath}\n`);
|
|
220
|
+
if (result.applied.length === 0) {
|
|
221
|
+
console.log(" ✅ No migrations needed — config is up to date.\n");
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const icons = { error: "❌", warning: "⚠️", info: "ℹ️" };
|
|
225
|
+
for (const m of result.applied) {
|
|
226
|
+
const icon = icons[m.level] || "•";
|
|
227
|
+
console.log(` ${icon} [${m.id}] ${m.description}`);
|
|
228
|
+
}
|
|
229
|
+
const errors = result.applied.filter((m) => m.level === "error").length;
|
|
230
|
+
const warnings = result.applied.filter((m) => m.level === "warning").length;
|
|
231
|
+
const infos = result.applied.filter((m) => m.level === "info").length;
|
|
232
|
+
console.log(`\n Summary: ${errors} error(s), ${warnings} warning(s), ${infos} info(s)\n`);
|
|
233
|
+
if (shouldApply && result.migratedConfig) {
|
|
234
|
+
writeFileSync(configPath, JSON.stringify(result.migratedConfig, null, 2) + "\n", "utf-8");
|
|
235
|
+
console.log(` ✅ Migrated config written to ${configPath}\n`);
|
|
236
|
+
}
|
|
237
|
+
else if (result.hasChanges) {
|
|
238
|
+
console.log(" Run with --apply to write the migrated config.\n");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=config-migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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DAAoD,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `judges dedup-report` — Cross-run finding deduplication report.
|
|
3
|
+
*
|
|
4
|
+
* Shows which findings are new vs recurring vs fixed across runs.
|
|
5
|
+
* Built on the existing finding-lifecycle tracking infrastructure.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* judges dedup-report # Show finding delta report
|
|
9
|
+
* judges dedup-report --format json # JSON output
|
|
10
|
+
* judges dedup-report --stats # Summary statistics only
|
|
11
|
+
*/
|
|
12
|
+
export declare function runDedupReport(argv: string[]): void;
|
|
13
|
+
//# sourceMappingURL=dedup-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup-report.d.ts","sourceRoot":"","sources":["../../src/commands/dedup-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA0HnD"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `judges dedup-report` — Cross-run finding deduplication report.
|
|
3
|
+
*
|
|
4
|
+
* Shows which findings are new vs recurring vs fixed across runs.
|
|
5
|
+
* Built on the existing finding-lifecycle tracking infrastructure.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* judges dedup-report # Show finding delta report
|
|
9
|
+
* judges dedup-report --format json # JSON output
|
|
10
|
+
* judges dedup-report --stats # Summary statistics only
|
|
11
|
+
*/
|
|
12
|
+
import { loadFindingStore, getFindingStats } from "../finding-lifecycle.js";
|
|
13
|
+
import { resolve } from "path";
|
|
14
|
+
// ─── CLI Runner ─────────────────────────────────────────────────────────────
|
|
15
|
+
export function runDedupReport(argv) {
|
|
16
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
17
|
+
console.log(`
|
|
18
|
+
judges dedup-report — Cross-run finding deduplication report
|
|
19
|
+
|
|
20
|
+
Usage:
|
|
21
|
+
judges dedup-report [dir] Show finding delta report
|
|
22
|
+
judges dedup-report --stats Summary statistics only
|
|
23
|
+
judges dedup-report --recurring Show only recurring findings
|
|
24
|
+
judges dedup-report --new Show only new findings since last run
|
|
25
|
+
judges dedup-report --fixed Show recently fixed findings
|
|
26
|
+
judges dedup-report --format json JSON output
|
|
27
|
+
|
|
28
|
+
Reads .judges-findings.json from the project directory to show:
|
|
29
|
+
• New findings introduced since last run
|
|
30
|
+
• Recurring findings (persistent across runs)
|
|
31
|
+
• Fixed findings (no longer detected)
|
|
32
|
+
• Trend analysis (improving / stable / degrading)
|
|
33
|
+
|
|
34
|
+
Options:
|
|
35
|
+
--dir <path> Project directory (default: current)
|
|
36
|
+
--stats Show summary statistics only
|
|
37
|
+
--recurring Filter to recurring findings
|
|
38
|
+
--new Filter to newly introduced findings
|
|
39
|
+
--fixed Filter to fixed findings
|
|
40
|
+
--format <fmt> Output format: text, json
|
|
41
|
+
--help, -h Show this help
|
|
42
|
+
`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const dir = resolve(argv.find((_a, i) => argv[i - 1] === "--dir") ||
|
|
46
|
+
argv.find((a, i) => i > 1 && !a.startsWith("-") && argv[i - 1] !== "--format" && argv[i - 1] !== "--dir") ||
|
|
47
|
+
".");
|
|
48
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
49
|
+
const statsOnly = argv.includes("--stats");
|
|
50
|
+
const showRecurring = argv.includes("--recurring");
|
|
51
|
+
const showNew = argv.includes("--new");
|
|
52
|
+
const showFixed = argv.includes("--fixed");
|
|
53
|
+
const store = loadFindingStore(dir);
|
|
54
|
+
if (store.findings.length === 0) {
|
|
55
|
+
console.log("\n No finding history found. Run 'judges eval' first to build the finding store.\n");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const stats = getFindingStats(store);
|
|
59
|
+
if (format === "json") {
|
|
60
|
+
const data = { stats, runNumber: store.runNumber, lastRunAt: store.lastRunAt };
|
|
61
|
+
if (!statsOnly) {
|
|
62
|
+
const openFindings = store.findings.filter((f) => f.status === "open");
|
|
63
|
+
const fixedFindings = store.findings.filter((f) => f.status === "fixed");
|
|
64
|
+
const newFindings = openFindings.filter((f) => f.runCount === 1);
|
|
65
|
+
const recurringFindings = openFindings.filter((f) => f.runCount > 1);
|
|
66
|
+
if (showNew)
|
|
67
|
+
data.findings = newFindings;
|
|
68
|
+
else if (showRecurring)
|
|
69
|
+
data.findings = recurringFindings;
|
|
70
|
+
else if (showFixed)
|
|
71
|
+
data.findings = fixedFindings;
|
|
72
|
+
else
|
|
73
|
+
data.findings = { new: newFindings, recurring: recurringFindings, fixed: fixedFindings };
|
|
74
|
+
}
|
|
75
|
+
console.log(JSON.stringify(data, null, 2));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Text output
|
|
79
|
+
console.log(`\n Finding Deduplication Report — Run #${store.runNumber} (${store.lastRunAt})\n`);
|
|
80
|
+
// Stats
|
|
81
|
+
console.log(` Total tracked: ${stats.totalOpen + stats.totalFixed}`);
|
|
82
|
+
console.log(` Open: ${stats.totalOpen}`);
|
|
83
|
+
console.log(` Fixed: ${stats.totalFixed}`);
|
|
84
|
+
console.log(` Triaged: ${stats.totalTriaged}`);
|
|
85
|
+
console.log(` Avg age (days): ${Math.round(stats.avgAge)}`);
|
|
86
|
+
console.log("");
|
|
87
|
+
// Severity breakdown
|
|
88
|
+
console.log(" By severity:");
|
|
89
|
+
for (const [sev, count] of Object.entries(stats.bySeverity)) {
|
|
90
|
+
if (count > 0) {
|
|
91
|
+
console.log(` ${sev.toUpperCase().padEnd(10)} ${count}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
console.log("");
|
|
95
|
+
if (statsOnly)
|
|
96
|
+
return;
|
|
97
|
+
const openFindings = store.findings.filter((f) => f.status === "open");
|
|
98
|
+
const fixedFindings = store.findings.filter((f) => f.status === "fixed");
|
|
99
|
+
const newFindings = openFindings.filter((f) => f.runCount === 1);
|
|
100
|
+
const recurringFindings = openFindings.filter((f) => f.runCount > 1);
|
|
101
|
+
// New findings
|
|
102
|
+
if (!showRecurring && !showFixed && newFindings.length > 0) {
|
|
103
|
+
console.log(` ─── New Findings (${newFindings.length}) ───\n`);
|
|
104
|
+
printFindings(newFindings);
|
|
105
|
+
}
|
|
106
|
+
// Recurring
|
|
107
|
+
if (!showNew && !showFixed && recurringFindings.length > 0) {
|
|
108
|
+
console.log(` ─── Recurring Findings (${recurringFindings.length}) ───\n`);
|
|
109
|
+
printFindings(recurringFindings, true);
|
|
110
|
+
}
|
|
111
|
+
// Fixed
|
|
112
|
+
if (!showNew && !showRecurring && fixedFindings.length > 0) {
|
|
113
|
+
const recentFixed = fixedFindings.filter((f) => {
|
|
114
|
+
if (!f.fixedAt)
|
|
115
|
+
return false;
|
|
116
|
+
const fixedDate = new Date(f.fixedAt);
|
|
117
|
+
const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
|
|
118
|
+
return fixedDate >= weekAgo;
|
|
119
|
+
});
|
|
120
|
+
if (recentFixed.length > 0) {
|
|
121
|
+
console.log(` ─── Recently Fixed (${recentFixed.length}) ───\n`);
|
|
122
|
+
printFindings(recentFixed);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
console.log("");
|
|
126
|
+
}
|
|
127
|
+
function printFindings(findings, showRunCount = false) {
|
|
128
|
+
for (const f of findings.slice(0, 20)) {
|
|
129
|
+
const runInfo = showRunCount ? ` (${f.runCount} runs)` : "";
|
|
130
|
+
console.log(` • [${f.severity.toUpperCase()}] ${f.ruleId}: ${f.title}${runInfo}`);
|
|
131
|
+
console.log(` ${f.filePath}`);
|
|
132
|
+
}
|
|
133
|
+
if (findings.length > 20) {
|
|
134
|
+
console.log(` ... and ${findings.length - 20} more`);
|
|
135
|
+
}
|
|
136
|
+
console.log("");
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL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C,aAAa,QAAQ,CAAC,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `judges dep-audit` — Dependency vulnerability correlation.
|
|
3
|
+
*
|
|
4
|
+
* Correlates code-level findings with known vulnerabilities in project
|
|
5
|
+
* dependencies. Uses npm audit / pip audit output to enrich findings
|
|
6
|
+
* with CVE data, adding urgency context to code review.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* judges dep-audit # Audit current directory
|
|
10
|
+
* judges dep-audit --format json # JSON output
|
|
11
|
+
* judges dep-audit --correlate results.json # Correlate with findings
|
|
12
|
+
*/
|
|
13
|
+
import type { Finding, Severity } from "../types.js";
|
|
14
|
+
export interface VulnerablePackage {
|
|
15
|
+
/** Package name */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Installed version */
|
|
18
|
+
version: string;
|
|
19
|
+
/** Vulnerability severity */
|
|
20
|
+
severity: Severity;
|
|
21
|
+
/** CVE identifier(s) */
|
|
22
|
+
cves: string[];
|
|
23
|
+
/** CWE identifier(s) */
|
|
24
|
+
cwes: string[];
|
|
25
|
+
/** Advisory title */
|
|
26
|
+
title: string;
|
|
27
|
+
/** URL for more information */
|
|
28
|
+
url?: string;
|
|
29
|
+
/** Fixed version (if known) */
|
|
30
|
+
fixedIn?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DepAuditResult {
|
|
33
|
+
/** Detected package manager */
|
|
34
|
+
packageManager: "npm" | "pip" | "unknown";
|
|
35
|
+
/** Vulnerable packages found */
|
|
36
|
+
vulnerabilities: VulnerablePackage[];
|
|
37
|
+
/** Total vulnerability count */
|
|
38
|
+
totalVulnerabilities: number;
|
|
39
|
+
/** Counts by severity */
|
|
40
|
+
severityCounts: Record<Severity, number>;
|
|
41
|
+
/** Correlations with code findings */
|
|
42
|
+
correlations: Array<{
|
|
43
|
+
vulnerability: VulnerablePackage;
|
|
44
|
+
relatedFindings: Array<{
|
|
45
|
+
ruleId: string;
|
|
46
|
+
title: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
export declare function runDepAudit(dir: string, findings?: Finding[]): DepAuditResult;
|
|
52
|
+
export declare function runDepAuditCommand(argv: string[]): void;
|
|
53
|
+
//# sourceMappingURL=dep-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dep-audit.d.ts","sourceRoot":"","sources":["../../src/commands/dep-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIrD,MAAM,WAAW,iBAAiB;IAChC,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,wBAAwB;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,wBAAwB;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,cAAc,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IAC1C,gCAAgC;IAChC,eAAe,EAAE,iBAAiB,EAAE,CAAC;IACrC,gCAAgC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yBAAyB;IACzB,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzC,sCAAsC;IACtC,YAAY,EAA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