@kevinrabun/judges 3.41.0 → 3.43.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +126 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/assign-findings.d.ts +37 -0
  6. package/dist/commands/assign-findings.d.ts.map +1 -0
  7. package/dist/commands/assign-findings.js +178 -0
  8. package/dist/commands/assign-findings.js.map +1 -0
  9. package/dist/commands/auto-triage.d.ts +32 -0
  10. package/dist/commands/auto-triage.d.ts.map +1 -0
  11. package/dist/commands/auto-triage.js +126 -0
  12. package/dist/commands/auto-triage.js.map +1 -0
  13. package/dist/commands/ci-template.d.ts +15 -0
  14. package/dist/commands/ci-template.d.ts.map +1 -0
  15. package/dist/commands/ci-template.js +212 -0
  16. package/dist/commands/ci-template.js.map +1 -0
  17. package/dist/commands/coverage-map.d.ts +23 -0
  18. package/dist/commands/coverage-map.d.ts.map +1 -0
  19. package/dist/commands/coverage-map.js +223 -0
  20. package/dist/commands/coverage-map.js.map +1 -0
  21. package/dist/commands/diff-only.d.ts +34 -0
  22. package/dist/commands/diff-only.d.ts.map +1 -0
  23. package/dist/commands/diff-only.js +152 -0
  24. package/dist/commands/diff-only.js.map +1 -0
  25. package/dist/commands/false-negatives.d.ts +35 -0
  26. package/dist/commands/false-negatives.d.ts.map +1 -0
  27. package/dist/commands/false-negatives.js +166 -0
  28. package/dist/commands/false-negatives.js.map +1 -0
  29. package/dist/commands/group-findings.d.ts +23 -0
  30. package/dist/commands/group-findings.d.ts.map +1 -0
  31. package/dist/commands/group-findings.js +155 -0
  32. package/dist/commands/group-findings.js.map +1 -0
  33. package/dist/commands/hook-install.d.ts +22 -0
  34. package/dist/commands/hook-install.d.ts.map +1 -0
  35. package/dist/commands/hook-install.js +143 -0
  36. package/dist/commands/hook-install.js.map +1 -0
  37. package/dist/commands/policy-audit.d.ts +53 -0
  38. package/dist/commands/policy-audit.d.ts.map +1 -0
  39. package/dist/commands/policy-audit.js +161 -0
  40. package/dist/commands/policy-audit.js.map +1 -0
  41. package/dist/commands/pr-summary.d.ts +26 -0
  42. package/dist/commands/pr-summary.d.ts.map +1 -0
  43. package/dist/commands/pr-summary.js +188 -0
  44. package/dist/commands/pr-summary.js.map +1 -0
  45. package/dist/commands/profile.d.ts +38 -0
  46. package/dist/commands/profile.d.ts.map +1 -0
  47. package/dist/commands/profile.js +102 -0
  48. package/dist/commands/profile.js.map +1 -0
  49. package/dist/commands/regression-alert.d.ts +32 -0
  50. package/dist/commands/regression-alert.d.ts.map +1 -0
  51. package/dist/commands/regression-alert.js +216 -0
  52. package/dist/commands/regression-alert.js.map +1 -0
  53. package/dist/commands/remediation.d.ts +21 -0
  54. package/dist/commands/remediation.d.ts.map +1 -0
  55. package/dist/commands/remediation.js +257 -0
  56. package/dist/commands/remediation.js.map +1 -0
  57. package/dist/commands/sla-track.d.ts +57 -0
  58. package/dist/commands/sla-track.d.ts.map +1 -0
  59. package/dist/commands/sla-track.js +269 -0
  60. package/dist/commands/sla-track.js.map +1 -0
  61. package/dist/commands/smart-select.d.ts +27 -0
  62. package/dist/commands/smart-select.d.ts.map +1 -0
  63. package/dist/commands/smart-select.js +346 -0
  64. package/dist/commands/smart-select.js.map +1 -0
  65. package/dist/commands/ticket-sync.d.ts +26 -0
  66. package/dist/commands/ticket-sync.d.ts.map +1 -0
  67. package/dist/commands/ticket-sync.js +236 -0
  68. package/dist/commands/ticket-sync.js.map +1 -0
  69. package/dist/commands/upload.d.ts +14 -0
  70. package/dist/commands/upload.d.ts.map +1 -0
  71. package/dist/commands/upload.js +173 -0
  72. package/dist/commands/upload.js.map +1 -0
  73. package/dist/commands/validate-config.d.ts +17 -0
  74. package/dist/commands/validate-config.d.ts.map +1 -0
  75. package/dist/commands/validate-config.js +268 -0
  76. package/dist/commands/validate-config.js.map +1 -0
  77. package/dist/commands/warm-cache.d.ts +31 -0
  78. package/dist/commands/warm-cache.d.ts.map +1 -0
  79. package/dist/commands/warm-cache.js +166 -0
  80. package/dist/commands/warm-cache.js.map +1 -0
  81. package/package.json +1 -1
  82. package/server.json +2 -2
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Finding assignment — assign findings to team members for resolution.
3
+ *
4
+ * Uses a local assignment database (.judges-assignments.json) to track
5
+ * who is responsible for fixing each finding, enabling team workflows
6
+ * without requiring an external service.
7
+ */
8
+ import { createHash } from "crypto";
9
+ // ─── Database ───────────────────────────────────────────────────────────────
10
+ const DB_FILE = ".judges-assignments.json";
11
+ function loadDb() {
12
+ const { readFileSync, existsSync } = require("fs");
13
+ if (existsSync(DB_FILE)) {
14
+ try {
15
+ return JSON.parse(readFileSync(DB_FILE, "utf-8"));
16
+ }
17
+ catch {
18
+ /* corrupt */
19
+ }
20
+ }
21
+ return { assignments: [], version: "1.0" };
22
+ }
23
+ function saveDb(db) {
24
+ const { writeFileSync } = require("fs");
25
+ writeFileSync(DB_FILE, JSON.stringify(db, null, 2), "utf-8");
26
+ }
27
+ export function assignFinding(finding, assignee) {
28
+ const db = loadDb();
29
+ const assignment = {
30
+ id: createHash("sha256")
31
+ .update(finding.ruleId + finding.title + Date.now())
32
+ .digest("hex")
33
+ .slice(0, 10),
34
+ findingRuleId: finding.ruleId,
35
+ findingTitle: finding.title,
36
+ severity: finding.severity,
37
+ assignee,
38
+ assignedAt: new Date().toISOString(),
39
+ status: "open",
40
+ };
41
+ db.assignments.push(assignment);
42
+ saveDb(db);
43
+ return assignment;
44
+ }
45
+ export function resolveAssignment(id, status) {
46
+ const db = loadDb();
47
+ const assignment = db.assignments.find((a) => a.id === id);
48
+ if (!assignment)
49
+ return false;
50
+ assignment.status = status;
51
+ assignment.resolvedAt = new Date().toISOString();
52
+ saveDb(db);
53
+ return true;
54
+ }
55
+ export function getAssignmentStats(db) {
56
+ const byAssignee = {};
57
+ const bySeverity = {};
58
+ let open = 0;
59
+ let fixed = 0;
60
+ for (const a of db.assignments) {
61
+ if (a.status === "open" || a.status === "in-progress")
62
+ open++;
63
+ if (a.status === "fixed")
64
+ fixed++;
65
+ bySeverity[a.severity] = (bySeverity[a.severity] || 0) + 1;
66
+ if (!byAssignee[a.assignee])
67
+ byAssignee[a.assignee] = { open: 0, fixed: 0 };
68
+ if (a.status === "open" || a.status === "in-progress")
69
+ byAssignee[a.assignee].open++;
70
+ if (a.status === "fixed")
71
+ byAssignee[a.assignee].fixed++;
72
+ }
73
+ return { total: db.assignments.length, open, fixed, byAssignee, bySeverity };
74
+ }
75
+ // ─── CLI ────────────────────────────────────────────────────────────────────
76
+ export function runAssignFindings(argv) {
77
+ if (argv.includes("--help") || argv.includes("-h")) {
78
+ console.log(`
79
+ judges assign — Assign findings to team members
80
+
81
+ Usage:
82
+ judges assign --input results.json --assignee alice Assign all findings
83
+ judges assign --resolve <id> --status fixed Resolve an assignment
84
+ judges assign --list Show all assignments
85
+ judges assign --stats Show assignment stats
86
+
87
+ Options:
88
+ --input <path> JSON results file to assign findings from
89
+ --assignee <name> Team member to assign to
90
+ --severity <level> Only assign findings of this severity+
91
+ --resolve <id> Resolve an assignment
92
+ --status <status> Resolution status: fixed, wont-fix
93
+ --list List all assignments
94
+ --stats Show assignment statistics
95
+ --format json JSON output
96
+ --help, -h Show this help
97
+ `);
98
+ return;
99
+ }
100
+ const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
101
+ const { readFileSync, existsSync } = require("fs");
102
+ // Resolve
103
+ const resolveId = argv.find((_a, i) => argv[i - 1] === "--resolve");
104
+ if (resolveId) {
105
+ const status = (argv.find((_a, i) => argv[i - 1] === "--status") || "fixed");
106
+ if (resolveAssignment(resolveId, status)) {
107
+ console.log(` ✅ Assignment ${resolveId} marked as ${status}`);
108
+ }
109
+ else {
110
+ console.error(` Error: assignment ${resolveId} not found`);
111
+ }
112
+ return;
113
+ }
114
+ // Stats
115
+ if (argv.includes("--stats")) {
116
+ const db = loadDb();
117
+ const stats = getAssignmentStats(db);
118
+ if (format === "json") {
119
+ console.log(JSON.stringify(stats, null, 2));
120
+ return;
121
+ }
122
+ console.log(`\n Assignment Statistics\n`);
123
+ console.log(` Total: ${stats.total} | Open: ${stats.open} | Fixed: ${stats.fixed}\n`);
124
+ console.log(" By Assignee:");
125
+ for (const [name, counts] of Object.entries(stats.byAssignee)) {
126
+ console.log(` ${name.padEnd(20)} open: ${counts.open} fixed: ${counts.fixed}`);
127
+ }
128
+ console.log("");
129
+ return;
130
+ }
131
+ // List
132
+ if (argv.includes("--list")) {
133
+ const db = loadDb();
134
+ if (format === "json") {
135
+ console.log(JSON.stringify(db.assignments, null, 2));
136
+ return;
137
+ }
138
+ console.log(`\n Assignments (${db.assignments.length})\n`);
139
+ for (const a of db.assignments) {
140
+ const status = a.status === "open" ? "🔴" : a.status === "in-progress" ? "🟡" : "✅";
141
+ console.log(` ${status} ${a.id} ${a.severity.padEnd(8)} ${a.assignee.padEnd(15)} ${a.findingTitle.slice(0, 40)}`);
142
+ }
143
+ console.log("");
144
+ return;
145
+ }
146
+ // Assign
147
+ const inputPath = argv.find((_a, i) => argv[i - 1] === "--input");
148
+ const assignee = argv.find((_a, i) => argv[i - 1] === "--assignee");
149
+ if (!inputPath || !assignee) {
150
+ console.error("Error: --input and --assignee required. Use --help for usage.");
151
+ process.exit(1);
152
+ }
153
+ if (!existsSync(inputPath)) {
154
+ console.error(`Error: file not found: ${inputPath}`);
155
+ process.exit(1);
156
+ }
157
+ const data = JSON.parse(readFileSync(inputPath, "utf-8"));
158
+ const findings = data.evaluations
159
+ ? data.evaluations.flatMap((e) => e.findings || [])
160
+ : data.findings || data;
161
+ const severityFilter = argv.find((_a, i) => argv[i - 1] === "--severity");
162
+ const severityOrder = ["critical", "high", "medium", "low", "info"];
163
+ let filtered = findings;
164
+ if (severityFilter) {
165
+ const idx = severityOrder.indexOf(severityFilter);
166
+ if (idx >= 0) {
167
+ const allowed = new Set(severityOrder.slice(0, idx + 1));
168
+ filtered = findings.filter((f) => allowed.has(f.severity));
169
+ }
170
+ }
171
+ let assigned = 0;
172
+ for (const f of filtered) {
173
+ assignFinding(f, assignee);
174
+ assigned++;
175
+ }
176
+ console.log(` ✅ Assigned ${assigned} findings to ${assignee}`);
177
+ }
178
+ //# sourceMappingURL=assign-findings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assign-findings.js","sourceRoot":"","sources":["../../src/commands/assign-findings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAsBpC,+EAA+E;AAE/E,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAE3C,SAAS,MAAM;IACb,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,aAAa;QACf,CAAC;IACH,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC;AAED,SAAS,MAAM,CAAC,EAAgB;IAC9B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,QAAgB;IAC9D,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACpB,MAAM,UAAU,GAAe;QAC7B,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC;aACrB,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG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1F,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACpE,IAAI,QAAQ,GAAG,QAAQ,CAAC;IACxB,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAClD,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACzD,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,aAAa,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC3B,QAAQ,EAAE,CAAC;IACb,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,QAAQ,gBAAgB,QAAQ,EAAE,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Confidence auto-triage — automatically suppress findings below
3
+ * a configurable confidence threshold, reducing noise for teams
4
+ * that want higher-signal reviews.
5
+ *
6
+ * Findings below the threshold are marked as "auto-suppressed"
7
+ * rather than removed, preserving auditability.
8
+ */
9
+ import type { Finding } from "../types.js";
10
+ export interface TriageConfig {
11
+ /** Minimum confidence to keep (0-1). Default: 0.7 */
12
+ minConfidence: number;
13
+ /** Per-severity overrides: e.g., { critical: 0.3, high: 0.5 } */
14
+ severityThresholds?: Record<string, number>;
15
+ /** Never suppress these rule IDs */
16
+ alwaysKeep?: string[];
17
+ /** Always suppress these rule IDs */
18
+ alwaysSuppress?: string[];
19
+ }
20
+ export interface TriageResult {
21
+ kept: Finding[];
22
+ suppressed: Finding[];
23
+ stats: {
24
+ total: number;
25
+ kept: number;
26
+ suppressed: number;
27
+ byReason: Record<string, number>;
28
+ };
29
+ }
30
+ export declare function autoTriage(findings: Finding[], config?: Partial<TriageConfig>): TriageResult;
31
+ export declare function runAutoTriage(argv: string[]): void;
32
+ //# sourceMappingURL=auto-triage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-triage.d.ts","sourceRoot":"","sources":["../../src/commands/auto-triage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,qCAAqC;IACrC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;CACH;AAMD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,YAAY,CA8ChG;AAID,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA6ElD"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Confidence auto-triage — automatically suppress findings below
3
+ * a configurable confidence threshold, reducing noise for teams
4
+ * that want higher-signal reviews.
5
+ *
6
+ * Findings below the threshold are marked as "auto-suppressed"
7
+ * rather than removed, preserving auditability.
8
+ */
9
+ // ─── Triage Logic ───────────────────────────────────────────────────────────
10
+ const DEFAULT_THRESHOLD = 0.7;
11
+ export function autoTriage(findings, config = {}) {
12
+ const minConfidence = config.minConfidence ?? DEFAULT_THRESHOLD;
13
+ const severityThresholds = config.severityThresholds || {};
14
+ const alwaysKeep = new Set(config.alwaysKeep || []);
15
+ const alwaysSuppress = new Set(config.alwaysSuppress || []);
16
+ const kept = [];
17
+ const suppressed = [];
18
+ const byReason = {};
19
+ for (const f of findings) {
20
+ // Always-keep rules bypass all thresholds
21
+ if (alwaysKeep.has(f.ruleId)) {
22
+ kept.push(f);
23
+ continue;
24
+ }
25
+ // Always-suppress rules
26
+ if (alwaysSuppress.has(f.ruleId)) {
27
+ suppressed.push(f);
28
+ byReason["always-suppress"] = (byReason["always-suppress"] || 0) + 1;
29
+ continue;
30
+ }
31
+ // Determine threshold for this finding
32
+ const threshold = severityThresholds[f.severity] ?? minConfidence;
33
+ const confidence = f.confidence ?? 1.0;
34
+ if (confidence < threshold) {
35
+ suppressed.push(f);
36
+ byReason["below-threshold"] = (byReason["below-threshold"] || 0) + 1;
37
+ }
38
+ else {
39
+ kept.push(f);
40
+ }
41
+ }
42
+ return {
43
+ kept,
44
+ suppressed,
45
+ stats: {
46
+ total: findings.length,
47
+ kept: kept.length,
48
+ suppressed: suppressed.length,
49
+ byReason,
50
+ },
51
+ };
52
+ }
53
+ // ─── CLI ────────────────────────────────────────────────────────────────────
54
+ export function runAutoTriage(argv) {
55
+ if (argv.includes("--help") || argv.includes("-h")) {
56
+ console.log(`
57
+ judges auto-triage — Automatically suppress low-confidence findings
58
+
59
+ Usage:
60
+ judges auto-triage --input results.json Triage with default threshold (0.7)
61
+ judges auto-triage --input results.json --threshold 0.5 Custom threshold
62
+ judges auto-triage --input results.json --keep SEC-001 Always keep specific rules
63
+
64
+ Options:
65
+ --input <path> JSON results file (required)
66
+ --threshold <0-1> Minimum confidence to keep (default: 0.7)
67
+ --keep <rules> Comma-separated rules to always keep
68
+ --suppress <rules> Comma-separated rules to always suppress
69
+ --format json JSON output
70
+ --help, -h Show this help
71
+
72
+ Findings below the confidence threshold are marked as suppressed
73
+ rather than removed, preserving audit trail.
74
+ `);
75
+ return;
76
+ }
77
+ const { readFileSync, existsSync } = require("fs");
78
+ const inputPath = argv.find((_a, i) => argv[i - 1] === "--input");
79
+ if (!inputPath || !existsSync(inputPath)) {
80
+ console.error("Error: --input <path> required");
81
+ process.exit(1);
82
+ }
83
+ const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
84
+ const thresholdStr = argv.find((_a, i) => argv[i - 1] === "--threshold");
85
+ const keepStr = argv.find((_a, i) => argv[i - 1] === "--keep");
86
+ const suppressStr = argv.find((_a, i) => argv[i - 1] === "--suppress");
87
+ const data = JSON.parse(readFileSync(inputPath, "utf-8"));
88
+ const findings = data.evaluations
89
+ ? data.evaluations.flatMap((e) => e.findings || [])
90
+ : data.findings || data;
91
+ const config = {};
92
+ if (thresholdStr)
93
+ config.minConfidence = parseFloat(thresholdStr);
94
+ if (keepStr)
95
+ config.alwaysKeep = keepStr.split(",").map((s) => s.trim());
96
+ if (suppressStr)
97
+ config.alwaysSuppress = suppressStr.split(",").map((s) => s.trim());
98
+ const result = autoTriage(findings, config);
99
+ if (format === "json") {
100
+ console.log(JSON.stringify(result, null, 2));
101
+ return;
102
+ }
103
+ console.log(`\n Auto-Triage Results\n`);
104
+ console.log(` Total: ${result.stats.total}`);
105
+ console.log(` Kept: ${result.stats.kept}`);
106
+ console.log(` Suppressed: ${result.stats.suppressed}\n`);
107
+ if (Object.keys(result.stats.byReason).length > 0) {
108
+ console.log(` By reason:`);
109
+ for (const [reason, count] of Object.entries(result.stats.byReason)) {
110
+ console.log(` ${reason}: ${count}`);
111
+ }
112
+ console.log("");
113
+ }
114
+ if (result.kept.length > 0) {
115
+ console.log(` Kept findings:`);
116
+ for (const f of result.kept.slice(0, 20)) {
117
+ const conf = f.confidence;
118
+ const confStr = conf !== undefined ? ` (${(conf * 100).toFixed(0)}%)` : "";
119
+ console.log(` ${f.severity.padEnd(8)} ${f.ruleId}: ${f.title.slice(0, 70)}${confStr}`);
120
+ }
121
+ if (result.kept.length > 20)
122
+ console.log(` ... and ${result.kept.length - 20} more`);
123
+ console.log("");
124
+ }
125
+ }
126
+ //# sourceMappingURL=auto-triage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-triage.js","sourceRoot":"","sources":["../../src/commands/auto-triage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4BH,+EAA+E;AAE/E,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,UAAU,UAAU,CAAC,QAAmB,EAAE,SAAgC,EAAE;IAChF,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,iBAAiB,CAAC;IAChE,MAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;IAE5D,MAAM,IAAI,GAAc,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAc,EAAE,CAAC;IACjC,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAE5C,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,0CAA0C;QAC1C,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACb,SAAS;QACX,CAAC;QAED,wBAAwB;QACxB,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,MAA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,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,GAAI,CAAuC,CAAC,UAAU,CAAC;YACjE,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3E,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC;QAC5F,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE;YAAE,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;QACxF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CI templates — generate ready-to-use CI/CD pipeline configs for
3
+ * GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines,
4
+ * and CircleCI. Eliminates manual YAML authoring for teams adopting Judges.
5
+ */
6
+ export interface CiTemplate {
7
+ id: string;
8
+ name: string;
9
+ file: string;
10
+ content: string;
11
+ }
12
+ export declare function getTemplate(id: string): CiTemplate | undefined;
13
+ export declare function listTemplates(): CiTemplate[];
14
+ export declare function runCiTemplate(argv: string[]): void;
15
+ //# sourceMappingURL=ci-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-template.d.ts","sourceRoot":"","sources":["../../src/commands/ci-template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8HH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAUD,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE9D;AAED,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAE5C;AAgBD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAiElD"}
@@ -0,0 +1,212 @@
1
+ /**
2
+ * CI templates — generate ready-to-use CI/CD pipeline configs for
3
+ * GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines,
4
+ * and CircleCI. Eliminates manual YAML authoring for teams adopting Judges.
5
+ */
6
+ // ─── Templates ──────────────────────────────────────────────────────────────
7
+ const GITHUB_ACTIONS = `# .github/workflows/judges.yml
8
+ name: Judges Code Review
9
+ on:
10
+ pull_request:
11
+ types: [opened, synchronize]
12
+
13
+ permissions:
14
+ contents: read
15
+ pull-requests: write
16
+ security-events: write
17
+
18
+ jobs:
19
+ judges:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: actions/setup-node@v4
24
+ with:
25
+ node-version: "20"
26
+ - run: npm install -g @kevinrabun/judges
27
+ - name: Run Judges evaluation
28
+ run: |
29
+ judges eval --file "src/**/*.ts" --format sarif --fail-on-findings > judges.sarif
30
+ continue-on-error: true
31
+ - name: Upload SARIF
32
+ if: always()
33
+ run: judges upload --file judges.sarif
34
+ env:
35
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
36
+ - name: Post PR summary
37
+ if: always()
38
+ run: judges pr-summary --sarif judges.sarif --pr \${{ github.event.pull_request.number }}
39
+ env:
40
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
41
+ `;
42
+ const GITLAB_CI = `# .gitlab-ci.yml
43
+ judges-review:
44
+ image: node:20
45
+ stage: test
46
+ script:
47
+ - npm install -g @kevinrabun/judges
48
+ - judges eval --file "src/**/*.ts" --format sarif > judges.sarif
49
+ - judges eval --file "src/**/*.ts" --format codeclimate > codeclimate.json
50
+ artifacts:
51
+ reports:
52
+ sast: judges.sarif
53
+ codequality: codeclimate.json
54
+ rules:
55
+ - if: $CI_MERGE_REQUEST_IID
56
+ `;
57
+ const AZURE_PIPELINES = `# azure-pipelines.yml
58
+ trigger:
59
+ - main
60
+
61
+ pool:
62
+ vmImage: "ubuntu-latest"
63
+
64
+ steps:
65
+ - task: NodeTool@0
66
+ inputs:
67
+ versionSpec: "20.x"
68
+
69
+ - script: npm install -g @kevinrabun/judges
70
+ displayName: "Install Judges"
71
+
72
+ - script: judges eval --file "src/**/*.ts" --format sarif > judges.sarif
73
+ displayName: "Run Judges evaluation"
74
+
75
+ - task: PublishBuildArtifacts@1
76
+ inputs:
77
+ PathtoPublish: judges.sarif
78
+ ArtifactName: judges-results
79
+ condition: always()
80
+ `;
81
+ const BITBUCKET_PIPELINES = `# bitbucket-pipelines.yml
82
+ image: node:20
83
+
84
+ pipelines:
85
+ pull-requests:
86
+ "**":
87
+ - step:
88
+ name: Judges Code Review
89
+ caches:
90
+ - node
91
+ script:
92
+ - npm install -g @kevinrabun/judges
93
+ - judges eval --file "src/**/*.ts" --format json > judges-results.json
94
+ - judges eval --file "src/**/*.ts" --format text
95
+ artifacts:
96
+ - judges-results.json
97
+ `;
98
+ const CIRCLECI = `# .circleci/config.yml
99
+ version: 2.1
100
+
101
+ jobs:
102
+ judges-review:
103
+ docker:
104
+ - image: cimg/node:20.0
105
+ steps:
106
+ - checkout
107
+ - run:
108
+ name: Install Judges
109
+ command: npm install -g @kevinrabun/judges
110
+ - run:
111
+ name: Run evaluation
112
+ command: judges eval --file "src/**/*.ts" --format sarif > judges.sarif
113
+ - store_artifacts:
114
+ path: judges.sarif
115
+ destination: judges-results
116
+
117
+ workflows:
118
+ review:
119
+ jobs:
120
+ - judges-review
121
+ `;
122
+ const TEMPLATES = [
123
+ { id: "github", name: "GitHub Actions", file: ".github/workflows/judges.yml", content: GITHUB_ACTIONS },
124
+ { id: "gitlab", name: "GitLab CI", file: ".gitlab-ci.yml", content: GITLAB_CI },
125
+ { id: "azure", name: "Azure Pipelines", file: "azure-pipelines.yml", content: AZURE_PIPELINES },
126
+ { id: "bitbucket", name: "Bitbucket Pipelines", file: "bitbucket-pipelines.yml", content: BITBUCKET_PIPELINES },
127
+ { id: "circleci", name: "CircleCI", file: ".circleci/config.yml", content: CIRCLECI },
128
+ ];
129
+ export function getTemplate(id) {
130
+ return TEMPLATES.find((t) => t.id === id);
131
+ }
132
+ export function listTemplates() {
133
+ return TEMPLATES;
134
+ }
135
+ // ─── Auto-Detect Platform ──────────────────────────────────────────────────
136
+ function detectPlatform() {
137
+ const { existsSync } = require("fs");
138
+ if (existsSync(".github"))
139
+ return "github";
140
+ if (existsSync(".gitlab-ci.yml"))
141
+ return "gitlab";
142
+ if (existsSync("azure-pipelines.yml"))
143
+ return "azure";
144
+ if (existsSync("bitbucket-pipelines.yml"))
145
+ return "bitbucket";
146
+ if (existsSync(".circleci"))
147
+ return "circleci";
148
+ return undefined;
149
+ }
150
+ // ─── CLI ────────────────────────────────────────────────────────────────────
151
+ export function runCiTemplate(argv) {
152
+ if (argv.includes("--help") || argv.includes("-h")) {
153
+ console.log(`
154
+ judges ci-template — Generate CI/CD pipeline config for Judges
155
+
156
+ Usage:
157
+ judges ci-template --platform github Generate GitHub Actions workflow
158
+ judges ci-template --platform gitlab Generate GitLab CI config
159
+ judges ci-template --platform azure Generate Azure Pipelines config
160
+ judges ci-template --platform bitbucket Generate Bitbucket Pipelines config
161
+ judges ci-template --platform circleci Generate CircleCI config
162
+ judges ci-template --list List available templates
163
+ judges ci-template --auto Auto-detect platform
164
+
165
+ Options:
166
+ --platform <id> CI platform (github, gitlab, azure, bitbucket, circleci)
167
+ --write Write to the appropriate file location
168
+ --list List all available templates
169
+ --auto Auto-detect platform from repo structure
170
+ --help, -h Show this help
171
+ `);
172
+ return;
173
+ }
174
+ if (argv.includes("--list")) {
175
+ console.log("\n Available CI Templates:\n");
176
+ for (const t of TEMPLATES) {
177
+ console.log(` ${t.id.padEnd(12)} ${t.name.padEnd(25)} → ${t.file}`);
178
+ }
179
+ console.log("");
180
+ return;
181
+ }
182
+ let platform = argv.find((_a, i) => argv[i - 1] === "--platform");
183
+ if (argv.includes("--auto")) {
184
+ platform = detectPlatform();
185
+ if (!platform) {
186
+ console.error("Error: could not auto-detect CI platform");
187
+ process.exit(1);
188
+ }
189
+ console.log(` Auto-detected platform: ${platform}`);
190
+ }
191
+ if (!platform) {
192
+ console.error("Error: --platform <id> required. Use --list to see options.");
193
+ process.exit(1);
194
+ }
195
+ const template = getTemplate(platform);
196
+ if (!template) {
197
+ console.error(`Error: unknown platform "${platform}". Use --list to see options.`);
198
+ process.exit(1);
199
+ }
200
+ if (argv.includes("--write")) {
201
+ const { writeFileSync, mkdirSync } = require("fs");
202
+ const { dirname } = require("path");
203
+ const dir = dirname(template.file);
204
+ if (dir !== ".")
205
+ mkdirSync(dir, { recursive: true });
206
+ writeFileSync(template.file, template.content, "utf-8");
207
+ console.log(` ✅ Written ${template.file}`);
208
+ return;
209
+ }
210
+ console.log(template.content);
211
+ }
212
+ //# sourceMappingURL=ci-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-template.js","sourceRoot":"","sources":["../../src/commands/ci-template.ts"],"names":[],"mappings":"AAA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C;IAED,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Rule coverage map — show which rules apply to which languages,
3
+ * helping teams understand their coverage and identify gaps.
4
+ */
5
+ export interface RuleCoverage {
6
+ ruleId: string;
7
+ languages: string[];
8
+ severity: string;
9
+ judge: string;
10
+ }
11
+ export interface CoverageMap {
12
+ languages: string[];
13
+ rules: RuleCoverage[];
14
+ matrix: Record<string, Record<string, boolean>>;
15
+ stats: {
16
+ totalRules: number;
17
+ byLanguage: Record<string, number>;
18
+ byJudge: Record<string, number>;
19
+ };
20
+ }
21
+ export declare function buildCoverageMap(languages?: string[]): CoverageMap;
22
+ export declare function runCoverageMap(argv: string[]): void;
23
+ //# sourceMappingURL=coverage-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-map.d.ts","sourceRoot":"","sources":["../../src/commands/coverage-map.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC,CAAC;CACH;AA2HD,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,CAiDlE;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA8DnD"}