@kevinrabun/judges 3.45.0 → 3.47.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 +24 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +112 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/adoption-report.d.ts +8 -0
- package/dist/commands/adoption-report.d.ts.map +1 -0
- package/dist/commands/adoption-report.js +219 -0
- package/dist/commands/adoption-report.js.map +1 -0
- package/dist/commands/ai-model-trust.d.ts +17 -0
- package/dist/commands/ai-model-trust.d.ts.map +1 -0
- package/dist/commands/ai-model-trust.js +235 -0
- package/dist/commands/ai-model-trust.js.map +1 -0
- package/dist/commands/ai-prompt-audit.d.ts +23 -0
- package/dist/commands/ai-prompt-audit.d.ts.map +1 -0
- package/dist/commands/ai-prompt-audit.js +255 -0
- package/dist/commands/ai-prompt-audit.js.map +1 -0
- package/dist/commands/audit-bundle.d.ts +29 -0
- package/dist/commands/audit-bundle.d.ts.map +1 -0
- package/dist/commands/audit-bundle.js +235 -0
- package/dist/commands/audit-bundle.js.map +1 -0
- package/dist/commands/code-owner-suggest.d.ts +17 -0
- package/dist/commands/code-owner-suggest.d.ts.map +1 -0
- package/dist/commands/code-owner-suggest.js +215 -0
- package/dist/commands/code-owner-suggest.js.map +1 -0
- package/dist/commands/config-drift.d.ts +25 -0
- package/dist/commands/config-drift.d.ts.map +1 -0
- package/dist/commands/config-drift.js +214 -0
- package/dist/commands/config-drift.js.map +1 -0
- package/dist/commands/cost-forecast.d.ts +19 -0
- package/dist/commands/cost-forecast.d.ts.map +1 -0
- package/dist/commands/cost-forecast.js +194 -0
- package/dist/commands/cost-forecast.js.map +1 -0
- package/dist/commands/dev-score.d.ts +37 -0
- package/dist/commands/dev-score.d.ts.map +1 -0
- package/dist/commands/dev-score.js +204 -0
- package/dist/commands/dev-score.js.map +1 -0
- package/dist/commands/generate.d.ts +8 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +404 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/learn.d.ts +27 -0
- package/dist/commands/learn.d.ts.map +1 -0
- package/dist/commands/learn.js +289 -0
- package/dist/commands/learn.js.map +1 -0
- package/dist/commands/model-risk.d.ts +28 -0
- package/dist/commands/model-risk.d.ts.map +1 -0
- package/dist/commands/model-risk.js +221 -0
- package/dist/commands/model-risk.js.map +1 -0
- package/dist/commands/pr-quality-gate.d.ts +29 -0
- package/dist/commands/pr-quality-gate.d.ts.map +1 -0
- package/dist/commands/pr-quality-gate.js +208 -0
- package/dist/commands/pr-quality-gate.js.map +1 -0
- package/dist/commands/reg-watch.d.ts +21 -0
- package/dist/commands/reg-watch.d.ts.map +1 -0
- package/dist/commands/reg-watch.js +220 -0
- package/dist/commands/reg-watch.js.map +1 -0
- package/dist/commands/retro.d.ts +23 -0
- package/dist/commands/retro.d.ts.map +1 -0
- package/dist/commands/retro.js +217 -0
- package/dist/commands/retro.js.map +1 -0
- package/dist/commands/team-leaderboard.d.ts +25 -0
- package/dist/commands/team-leaderboard.d.ts.map +1 -0
- package/dist/commands/team-leaderboard.js +228 -0
- package/dist/commands/team-leaderboard.js.map +1 -0
- package/dist/commands/team-rules-sync.d.ts +8 -0
- package/dist/commands/team-rules-sync.d.ts.map +1 -0
- package/dist/commands/team-rules-sync.js +251 -0
- package/dist/commands/team-rules-sync.js.map +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cost forecast — projects 30/60/90-day security debt and
|
|
3
|
+
* remediation cost trends from local finding history.
|
|
4
|
+
*
|
|
5
|
+
* All data stays local — no upload or external services.
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
const COST_DIR = ".judges-cost-forecast";
|
|
10
|
+
const COST_FILE = join(COST_DIR, "history.json");
|
|
11
|
+
// Cost per finding by severity (industry averages, configurable)
|
|
12
|
+
const DEFAULT_COST_PER_FINDING = {
|
|
13
|
+
critical: 15000,
|
|
14
|
+
high: 5000,
|
|
15
|
+
medium: 1500,
|
|
16
|
+
low: 300,
|
|
17
|
+
};
|
|
18
|
+
// ─── Core ───────────────────────────────────────────────────────────────────
|
|
19
|
+
function ensureDir() {
|
|
20
|
+
if (!existsSync(COST_DIR))
|
|
21
|
+
mkdirSync(COST_DIR, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
function loadHistory() {
|
|
24
|
+
if (!existsSync(COST_FILE)) {
|
|
25
|
+
return { snapshots: [], projections: [], trend: "stable", updatedAt: new Date().toISOString() };
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(readFileSync(COST_FILE, "utf-8"));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return { snapshots: [], projections: [], trend: "stable", updatedAt: new Date().toISOString() };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function saveHistory(data) {
|
|
35
|
+
ensureDir();
|
|
36
|
+
data.updatedAt = new Date().toISOString();
|
|
37
|
+
writeFileSync(COST_FILE, JSON.stringify(data, null, 2));
|
|
38
|
+
}
|
|
39
|
+
function estimateCost(snap) {
|
|
40
|
+
return (snap.critical * DEFAULT_COST_PER_FINDING.critical +
|
|
41
|
+
snap.high * DEFAULT_COST_PER_FINDING.high +
|
|
42
|
+
snap.medium * DEFAULT_COST_PER_FINDING.medium +
|
|
43
|
+
snap.low * DEFAULT_COST_PER_FINDING.low);
|
|
44
|
+
}
|
|
45
|
+
export function recordSnapshot(critical, high, medium, low) {
|
|
46
|
+
const totalFindings = critical + high + medium + low;
|
|
47
|
+
const estimatedCostVal = estimateCost({ critical, high, medium, low });
|
|
48
|
+
const snapshot = {
|
|
49
|
+
date: new Date().toISOString().slice(0, 10),
|
|
50
|
+
critical,
|
|
51
|
+
high,
|
|
52
|
+
medium,
|
|
53
|
+
low,
|
|
54
|
+
totalFindings,
|
|
55
|
+
estimatedCost: estimatedCostVal,
|
|
56
|
+
};
|
|
57
|
+
const history = loadHistory();
|
|
58
|
+
history.snapshots.push(snapshot);
|
|
59
|
+
if (history.snapshots.length > 365)
|
|
60
|
+
history.snapshots = history.snapshots.slice(-365);
|
|
61
|
+
// Compute trend
|
|
62
|
+
if (history.snapshots.length >= 2) {
|
|
63
|
+
const recent = history.snapshots.slice(-5);
|
|
64
|
+
const first = recent[0].estimatedCost;
|
|
65
|
+
const last = recent[recent.length - 1].estimatedCost;
|
|
66
|
+
if (last < first * 0.9)
|
|
67
|
+
history.trend = "improving";
|
|
68
|
+
else if (last > first * 1.1)
|
|
69
|
+
history.trend = "degrading";
|
|
70
|
+
else
|
|
71
|
+
history.trend = "stable";
|
|
72
|
+
}
|
|
73
|
+
// Project forward
|
|
74
|
+
history.projections = [];
|
|
75
|
+
const avgRate = history.snapshots.length >= 2
|
|
76
|
+
? (history.snapshots[history.snapshots.length - 1].totalFindings - history.snapshots[0].totalFindings) /
|
|
77
|
+
history.snapshots.length
|
|
78
|
+
: 0;
|
|
79
|
+
const currentFindings = totalFindings;
|
|
80
|
+
const currentCost = estimatedCostVal;
|
|
81
|
+
for (const period of [30, 60, 90]) {
|
|
82
|
+
const projFindings = Math.max(0, Math.round(currentFindings + avgRate * period));
|
|
83
|
+
const projCost = Math.round(currentCost * (projFindings / Math.max(1, currentFindings)));
|
|
84
|
+
history.projections.push({
|
|
85
|
+
period: `${period}-day`,
|
|
86
|
+
estimatedCost: projCost,
|
|
87
|
+
findings: projFindings,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
saveHistory(history);
|
|
91
|
+
return snapshot;
|
|
92
|
+
}
|
|
93
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
94
|
+
export function runCostForecast(argv) {
|
|
95
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
96
|
+
console.log(`
|
|
97
|
+
judges cost-forecast — Security debt cost projections
|
|
98
|
+
|
|
99
|
+
Usage:
|
|
100
|
+
judges cost-forecast --record --critical 2 --high 5 --medium 12 --low 20
|
|
101
|
+
judges cost-forecast --report
|
|
102
|
+
judges cost-forecast --projections
|
|
103
|
+
judges cost-forecast --cost-table
|
|
104
|
+
|
|
105
|
+
Options:
|
|
106
|
+
--record Record a new cost snapshot
|
|
107
|
+
--critical <n> Number of critical findings (default: 0)
|
|
108
|
+
--high <n> Number of high findings (default: 0)
|
|
109
|
+
--medium <n> Number of medium findings (default: 0)
|
|
110
|
+
--low <n> Number of low findings (default: 0)
|
|
111
|
+
--report Show full cost history and trends
|
|
112
|
+
--projections Show 30/60/90-day projections
|
|
113
|
+
--cost-table Show cost-per-finding table
|
|
114
|
+
--format json JSON output
|
|
115
|
+
--help, -h Show this help
|
|
116
|
+
`);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
120
|
+
// Cost table
|
|
121
|
+
if (argv.includes("--cost-table")) {
|
|
122
|
+
if (format === "json") {
|
|
123
|
+
console.log(JSON.stringify(DEFAULT_COST_PER_FINDING, null, 2));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log(`\n Cost Per Finding (Industry Averages)\n ──────────────────────────`);
|
|
127
|
+
console.log(` Critical: $${DEFAULT_COST_PER_FINDING.critical.toLocaleString()}`);
|
|
128
|
+
console.log(` High: $${DEFAULT_COST_PER_FINDING.high.toLocaleString()}`);
|
|
129
|
+
console.log(` Medium: $${DEFAULT_COST_PER_FINDING.medium.toLocaleString()}`);
|
|
130
|
+
console.log(` Low: $${DEFAULT_COST_PER_FINDING.low.toLocaleString()}`);
|
|
131
|
+
console.log(`\n Based on: NIST/Ponemon incident cost research\n`);
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// Record snapshot
|
|
136
|
+
if (argv.includes("--record")) {
|
|
137
|
+
const critical = parseInt(argv.find((_a, i) => argv[i - 1] === "--critical") || "0", 10);
|
|
138
|
+
const high = parseInt(argv.find((_a, i) => argv[i - 1] === "--high") || "0", 10);
|
|
139
|
+
const medium = parseInt(argv.find((_a, i) => argv[i - 1] === "--medium") || "0", 10);
|
|
140
|
+
const low = parseInt(argv.find((_a, i) => argv[i - 1] === "--low") || "0", 10);
|
|
141
|
+
const snap = recordSnapshot(critical, high, medium, low);
|
|
142
|
+
if (format === "json") {
|
|
143
|
+
console.log(JSON.stringify(snap, null, 2));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
console.log(`\n ✅ Cost Snapshot Recorded — ${snap.date}`);
|
|
147
|
+
console.log(` Findings: ${snap.totalFindings} (C:${snap.critical} H:${snap.high} M:${snap.medium} L:${snap.low})`);
|
|
148
|
+
console.log(` Estimated cost: $${snap.estimatedCost.toLocaleString()}\n`);
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
// Projections
|
|
153
|
+
if (argv.includes("--projections")) {
|
|
154
|
+
const history = loadHistory();
|
|
155
|
+
if (history.projections.length === 0) {
|
|
156
|
+
console.log(" No data yet. Record snapshots with --record first.");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (format === "json") {
|
|
160
|
+
console.log(JSON.stringify(history.projections, null, 2));
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
console.log(`\n Cost Projections (trend: ${history.trend})\n ──────────────────────────`);
|
|
164
|
+
for (const p of history.projections) {
|
|
165
|
+
console.log(` ${p.period.padEnd(10)} ${p.findings.toString().padEnd(8)} findings $${p.estimatedCost.toLocaleString()}`);
|
|
166
|
+
}
|
|
167
|
+
console.log("");
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
// Full report
|
|
172
|
+
const history = loadHistory();
|
|
173
|
+
if (format === "json") {
|
|
174
|
+
console.log(JSON.stringify(history, null, 2));
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
console.log(`\n Cost Forecast Report\n ──────────────────────────`);
|
|
178
|
+
console.log(` Trend: ${history.trend} | Snapshots: ${history.snapshots.length}`);
|
|
179
|
+
if (history.snapshots.length > 0) {
|
|
180
|
+
console.log(`\n Recent History:`);
|
|
181
|
+
for (const s of history.snapshots.slice(-10)) {
|
|
182
|
+
console.log(` ${s.date} ${s.totalFindings.toString().padEnd(6)} findings $${s.estimatedCost.toLocaleString()}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (history.projections.length > 0) {
|
|
186
|
+
console.log(`\n Projections:`);
|
|
187
|
+
for (const p of history.projections) {
|
|
188
|
+
console.log(` ${p.period.padEnd(10)} ${p.findings.toString().padEnd(6)} findings $${p.estimatedCost.toLocaleString()}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
console.log("");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=cost-forecast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-forecast.js","sourceRoot":"","sources":["../../src/commands/cost-forecast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAqB5B,MAAM,QAAQ,GAAG,uBAAuB,CAAC;AACzC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAEjD,iEAAiE;AACjE,MAAM,wBAAwB,GAA2B;IACvD,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,GAAG,EAAE,GAAG;CACT,CAAC;AAEF,+EAA+E;AAE/E,SAAS,SAAS;IAChB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI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,CAAC,qBAAqB,CAAC,CAAC;YACnC,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC7C,OAAO,CAAC,GAAG,CACT,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,cAAc,EAAE,EAAE,CACxG,CAAC;YACJ,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAChC,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACpC,OAAO,CAAC,GAAG,CACT,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,cAAc,EAAE,EAAE,CAC/G,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Developer growth score — track individual developer improvement
|
|
3
|
+
* based on finding patterns over time.
|
|
4
|
+
*
|
|
5
|
+
* Stored locally in .judges-scores/ directory.
|
|
6
|
+
*/
|
|
7
|
+
interface ScoreEntry {
|
|
8
|
+
date: string;
|
|
9
|
+
findingsCount: number;
|
|
10
|
+
criticalCount: number;
|
|
11
|
+
highCount: number;
|
|
12
|
+
resolvedCount: number;
|
|
13
|
+
commitCount: number;
|
|
14
|
+
}
|
|
15
|
+
interface WeaknessArea {
|
|
16
|
+
rulePrefix: string;
|
|
17
|
+
category: string;
|
|
18
|
+
count: number;
|
|
19
|
+
trend: "improving" | "stable" | "worsening";
|
|
20
|
+
}
|
|
21
|
+
export interface DevScore {
|
|
22
|
+
author: string;
|
|
23
|
+
currentScore: number;
|
|
24
|
+
history: ScoreEntry[];
|
|
25
|
+
weaknesses: WeaknessArea[];
|
|
26
|
+
streak: number;
|
|
27
|
+
totalFindings: number;
|
|
28
|
+
totalResolved: number;
|
|
29
|
+
avgFindingsPerCommit: number;
|
|
30
|
+
trend: "improving" | "stable" | "declining";
|
|
31
|
+
lastUpdated: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function recordScan(author: string, findingsCount: number, criticalCount: number, highCount: number, resolvedCount: number, commitCount: number): DevScore;
|
|
34
|
+
export declare function getScore(author: string): DevScore;
|
|
35
|
+
export declare function runDevScore(argv: string[]): void;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=dev-score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-score.d.ts","sourceRoot":"","sources":["../../src/commands/dev-score.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;CAC7C;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB;AAwED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,QAAQ,CAwBV;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAEjD;AAID,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA+HhD"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Developer growth score — track individual developer improvement
|
|
3
|
+
* based on finding patterns over time.
|
|
4
|
+
*
|
|
5
|
+
* Stored locally in .judges-scores/ directory.
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
const SCORES_DIR = ".judges-scores";
|
|
10
|
+
// ─── Core ───────────────────────────────────────────────────────────────────
|
|
11
|
+
function ensureDir() {
|
|
12
|
+
if (!existsSync(SCORES_DIR))
|
|
13
|
+
mkdirSync(SCORES_DIR, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
function sanitizeFilename(author) {
|
|
16
|
+
return author.replace(/[^a-zA-Z0-9._-]/g, "_").toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
function loadScore(author) {
|
|
19
|
+
ensureDir();
|
|
20
|
+
const file = join(SCORES_DIR, `${sanitizeFilename(author)}.json`);
|
|
21
|
+
if (!existsSync(file)) {
|
|
22
|
+
return {
|
|
23
|
+
author,
|
|
24
|
+
currentScore: 100,
|
|
25
|
+
history: [],
|
|
26
|
+
weaknesses: [],
|
|
27
|
+
streak: 0,
|
|
28
|
+
totalFindings: 0,
|
|
29
|
+
totalResolved: 0,
|
|
30
|
+
avgFindingsPerCommit: 0,
|
|
31
|
+
trend: "stable",
|
|
32
|
+
lastUpdated: new Date().toISOString(),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return JSON.parse(readFileSync(file, "utf-8"));
|
|
36
|
+
}
|
|
37
|
+
function saveScore(score) {
|
|
38
|
+
ensureDir();
|
|
39
|
+
const file = join(SCORES_DIR, `${sanitizeFilename(score.author)}.json`);
|
|
40
|
+
writeFileSync(file, JSON.stringify(score, null, 2));
|
|
41
|
+
}
|
|
42
|
+
function computeScore(history) {
|
|
43
|
+
if (history.length === 0)
|
|
44
|
+
return 100;
|
|
45
|
+
// Score based on recent finding rate and resolution rate
|
|
46
|
+
const recent = history.slice(-10);
|
|
47
|
+
const avgFindings = recent.reduce((s, e) => s + e.findingsCount, 0) / recent.length;
|
|
48
|
+
const avgResolved = recent.reduce((s, e) => s + e.resolvedCount, 0) / recent.length;
|
|
49
|
+
const avgCritical = recent.reduce((s, e) => s + e.criticalCount, 0) / recent.length;
|
|
50
|
+
let score = 100;
|
|
51
|
+
score -= avgFindings * 3; // penalty per finding
|
|
52
|
+
score -= avgCritical * 10; // extra penalty for critical
|
|
53
|
+
score += avgResolved * 2; // bonus for resolving
|
|
54
|
+
score = Math.max(0, Math.min(100, Math.round(score)));
|
|
55
|
+
return score;
|
|
56
|
+
}
|
|
57
|
+
function computeTrend(history) {
|
|
58
|
+
if (history.length < 5)
|
|
59
|
+
return "stable";
|
|
60
|
+
const recent = history.slice(-5);
|
|
61
|
+
const older = history.slice(-10, -5);
|
|
62
|
+
if (older.length < 3)
|
|
63
|
+
return "stable";
|
|
64
|
+
const recentAvg = recent.reduce((s, e) => s + e.findingsCount, 0) / recent.length;
|
|
65
|
+
const olderAvg = older.reduce((s, e) => s + e.findingsCount, 0) / older.length;
|
|
66
|
+
if (recentAvg < olderAvg * 0.8)
|
|
67
|
+
return "improving";
|
|
68
|
+
if (recentAvg > olderAvg * 1.2)
|
|
69
|
+
return "declining";
|
|
70
|
+
return "stable";
|
|
71
|
+
}
|
|
72
|
+
export function recordScan(author, findingsCount, criticalCount, highCount, resolvedCount, commitCount) {
|
|
73
|
+
const score = loadScore(author);
|
|
74
|
+
score.history.push({
|
|
75
|
+
date: new Date().toISOString().split("T")[0],
|
|
76
|
+
findingsCount,
|
|
77
|
+
criticalCount,
|
|
78
|
+
highCount,
|
|
79
|
+
resolvedCount,
|
|
80
|
+
commitCount,
|
|
81
|
+
});
|
|
82
|
+
score.totalFindings += findingsCount;
|
|
83
|
+
score.totalResolved += resolvedCount;
|
|
84
|
+
score.streak = findingsCount === 0 ? score.streak + 1 : 0;
|
|
85
|
+
score.currentScore = computeScore(score.history);
|
|
86
|
+
score.trend = computeTrend(score.history);
|
|
87
|
+
const totalCommits = score.history.reduce((s, e) => s + e.commitCount, 0);
|
|
88
|
+
score.avgFindingsPerCommit = totalCommits > 0 ? Math.round((score.totalFindings / totalCommits) * 100) / 100 : 0;
|
|
89
|
+
score.lastUpdated = new Date().toISOString();
|
|
90
|
+
saveScore(score);
|
|
91
|
+
return score;
|
|
92
|
+
}
|
|
93
|
+
export function getScore(author) {
|
|
94
|
+
return loadScore(author);
|
|
95
|
+
}
|
|
96
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
97
|
+
export function runDevScore(argv) {
|
|
98
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
99
|
+
console.log(`
|
|
100
|
+
judges dev-score — Developer growth and improvement tracking
|
|
101
|
+
|
|
102
|
+
Usage:
|
|
103
|
+
judges dev-score --author "jane@company.com"
|
|
104
|
+
judges dev-score --record "jane@company.com" --findings 3 --critical 0 --high 1 --resolved 5 --commits 12
|
|
105
|
+
judges dev-score --leaderboard
|
|
106
|
+
judges dev-score --author "jane@company.com" --history
|
|
107
|
+
|
|
108
|
+
Options:
|
|
109
|
+
--author <email> Developer email/identifier
|
|
110
|
+
--record <email> Record a scan for a developer
|
|
111
|
+
--findings <n> Number of findings
|
|
112
|
+
--critical <n> Critical findings
|
|
113
|
+
--high <n> High findings
|
|
114
|
+
--resolved <n> Resolved findings
|
|
115
|
+
--commits <n> Commits in period
|
|
116
|
+
--leaderboard Show team leaderboard
|
|
117
|
+
--history Show score history for author
|
|
118
|
+
--format json JSON output
|
|
119
|
+
--help, -h Show this help
|
|
120
|
+
`);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
124
|
+
// Record scan
|
|
125
|
+
const recordAuthor = argv.find((_a, i) => argv[i - 1] === "--record");
|
|
126
|
+
if (recordAuthor) {
|
|
127
|
+
const getNum = (flag) => {
|
|
128
|
+
const val = argv.find((_a, i) => argv[i - 1] === flag);
|
|
129
|
+
return val ? parseInt(val, 10) : 0;
|
|
130
|
+
};
|
|
131
|
+
const score = recordScan(recordAuthor, getNum("--findings"), getNum("--critical"), getNum("--high"), getNum("--resolved"), getNum("--commits"));
|
|
132
|
+
if (format === "json") {
|
|
133
|
+
console.log(JSON.stringify(score, null, 2));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const icon = score.trend === "improving" ? "📈" : score.trend === "declining" ? "📉" : "➡️";
|
|
137
|
+
console.log(` ✅ Scan recorded for ${recordAuthor}`);
|
|
138
|
+
console.log(` Score: ${score.currentScore}/100 ${icon} Streak: ${score.streak} clean scans`);
|
|
139
|
+
}
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// Show author score
|
|
143
|
+
const author = argv.find((_a, i) => argv[i - 1] === "--author");
|
|
144
|
+
if (author) {
|
|
145
|
+
const score = getScore(author);
|
|
146
|
+
if (argv.includes("--history")) {
|
|
147
|
+
if (format === "json") {
|
|
148
|
+
console.log(JSON.stringify(score.history, null, 2));
|
|
149
|
+
}
|
|
150
|
+
else if (score.history.length === 0) {
|
|
151
|
+
console.log(`\n No history for ${author}.\n`);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
console.log(`\n Score History — ${author}\n ────────────────────────`);
|
|
155
|
+
for (const h of score.history.slice(-20)) {
|
|
156
|
+
console.log(` ${h.date} findings: ${h.findingsCount} (C:${h.criticalCount} H:${h.highCount}) resolved: ${h.resolvedCount}`);
|
|
157
|
+
}
|
|
158
|
+
console.log("");
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (format === "json") {
|
|
163
|
+
console.log(JSON.stringify(score, null, 2));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
const icon = score.trend === "improving" ? "📈" : score.trend === "declining" ? "📉" : "➡️";
|
|
167
|
+
console.log(`\n Developer Score — ${author}`);
|
|
168
|
+
console.log(` ──────────────────────────`);
|
|
169
|
+
console.log(` Score: ${score.currentScore}/100 ${icon}`);
|
|
170
|
+
console.log(` Trend: ${score.trend}`);
|
|
171
|
+
console.log(` Clean scan streak: ${score.streak}`);
|
|
172
|
+
console.log(` Total findings: ${score.totalFindings}`);
|
|
173
|
+
console.log(` Total resolved: ${score.totalResolved}`);
|
|
174
|
+
console.log(` Findings/commit: ${score.avgFindingsPerCommit}`);
|
|
175
|
+
console.log(` Scans recorded: ${score.history.length}\n`);
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
// Leaderboard
|
|
180
|
+
if (argv.includes("--leaderboard")) {
|
|
181
|
+
ensureDir();
|
|
182
|
+
const { readdirSync: rds } = require("fs");
|
|
183
|
+
const files = rds(SCORES_DIR).filter((f) => f.endsWith(".json"));
|
|
184
|
+
const scores = files.map((f) => JSON.parse(readFileSync(join(SCORES_DIR, f), "utf-8")));
|
|
185
|
+
scores.sort((a, b) => b.currentScore - a.currentScore);
|
|
186
|
+
if (format === "json") {
|
|
187
|
+
console.log(JSON.stringify(scores.map((s) => ({ author: s.author, score: s.currentScore, trend: s.trend })), null, 2));
|
|
188
|
+
}
|
|
189
|
+
else if (scores.length === 0) {
|
|
190
|
+
console.log("\n No scores recorded. Use --record to start tracking.\n");
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
console.log(`\n Leaderboard (${scores.length} developers)\n ─────────────`);
|
|
194
|
+
scores.forEach((s, i) => {
|
|
195
|
+
const icon = s.trend === "improving" ? "📈" : s.trend === "declining" ? "📉" : "➡️";
|
|
196
|
+
console.log(` ${String(i + 1).padStart(2)}. ${s.author.padEnd(25)} ${String(s.currentScore).padStart(3)}/100 ${icon} streak: ${s.streak}`);
|
|
197
|
+
});
|
|
198
|
+
console.log("");
|
|
199
|
+
}
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
console.log(" Use --author <email> to view a score, or --record to log a scan. --help for usage.");
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=dev-score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-score.js","sourceRoot":"","sources":["../../src/commands/dev-score.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiC5B,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,+EAA+E;AAE/E,SAAS,SAAS;IAChB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc;IACtC,OAAO,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;AAED,SAAS,SAAS,CAAC,MAAc;IAC/B,SAAS,EAAE,CAAC;IACZ,MAAM,IAAI,GAAG,IAAI,CAAC,UA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,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EAC1F,IAAI,EACJ,CAAC,CACF,CACF,CAAC;QACJ,CAAC;aAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QAC3E,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,MAAM,+BAA+B,CAAC,CAAC;YAC9E,MAAM,CAAC,OAAO,CAAC,CAAC,CAAW,EAAE,CAAS,EAAE,EAAE;gBACxC,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBACpF,OAAO,CAAC,GAAG,CACT,OAAO,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,IAAI,YAAY,CAAC,CAAC,MAAM,EAAE,CACjI,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;QACD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,sFAAsF,CAAC,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secure code template generator — pre-hardened templates
|
|
3
|
+
* for common patterns with Judges findings pre-mitigated.
|
|
4
|
+
*
|
|
5
|
+
* All output is generated locally — no data transmitted.
|
|
6
|
+
*/
|
|
7
|
+
export declare function runGenerate(argv: string[]): void;
|
|
8
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwUH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAgGhD"}
|