agentbadge-core 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/dist/badge.d.ts +11 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +54 -0
- package/dist/badge.js.map +1 -0
- package/dist/engine.d.ts +9 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +95 -0
- package/dist/engine.js.map +1 -0
- package/dist/engine.test.d.ts +2 -0
- package/dist/engine.test.d.ts.map +1 -0
- package/dist/engine.test.js +97 -0
- package/dist/engine.test.js.map +1 -0
- package/dist/github-scanner.d.ts +10 -0
- package/dist/github-scanner.d.ts.map +1 -0
- package/dist/github-scanner.js +99 -0
- package/dist/github-scanner.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/remediator.d.ts +8 -0
- package/dist/remediator.d.ts.map +1 -0
- package/dist/remediator.js +92 -0
- package/dist/remediator.js.map +1 -0
- package/dist/rules/context.d.ts +3 -0
- package/dist/rules/context.d.ts.map +1 -0
- package/dist/rules/context.js +158 -0
- package/dist/rules/context.js.map +1 -0
- package/dist/rules/guardrails.d.ts +3 -0
- package/dist/rules/guardrails.d.ts.map +1 -0
- package/dist/rules/guardrails.js +136 -0
- package/dist/rules/guardrails.js.map +1 -0
- package/dist/rules/setup.d.ts +3 -0
- package/dist/rules/setup.d.ts.map +1 -0
- package/dist/rules/setup.js +181 -0
- package/dist/rules/setup.js.map +1 -0
- package/dist/rules/tooling.d.ts +3 -0
- package/dist/rules/tooling.d.ts.map +1 -0
- package/dist/rules/tooling.js +140 -0
- package/dist/rules/tooling.js.map +1 -0
- package/dist/rules/verification.d.ts +3 -0
- package/dist/rules/verification.d.ts.map +1 -0
- package/dist/rules/verification.js +204 -0
- package/dist/rules/verification.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +25 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Emre Ceyhan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReadinessTier } from './types.js';
|
|
2
|
+
export declare function getTierColor(tier: ReadinessTier | 'unknown'): {
|
|
3
|
+
bg: string;
|
|
4
|
+
text: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Generates an SVG badge for README integration
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateSvgBadge(score: number | null, tier: ReadinessTier | 'unknown', grade?: string): string;
|
|
11
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAczG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAgCR"}
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTierColor = getTierColor;
|
|
4
|
+
exports.generateSvgBadge = generateSvgBadge;
|
|
5
|
+
function getTierColor(tier) {
|
|
6
|
+
switch (tier) {
|
|
7
|
+
case 'agent-ready':
|
|
8
|
+
return { bg: '#22c55e', text: '#ffffff', label: 'agent-ready' };
|
|
9
|
+
case 'agent-friendly':
|
|
10
|
+
return { bg: '#3b82f6', text: '#ffffff', label: 'agent-friendly' };
|
|
11
|
+
case 'agent-tolerated':
|
|
12
|
+
return { bg: '#eab308', text: '#000000', label: 'agent-tolerated' };
|
|
13
|
+
case 'agent-hostile':
|
|
14
|
+
return { bg: '#ef4444', text: '#ffffff', label: 'agent-hostile' };
|
|
15
|
+
case 'unknown':
|
|
16
|
+
default:
|
|
17
|
+
return { bg: '#6b7280', text: '#ffffff', label: 'unknown' };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generates an SVG badge for README integration
|
|
22
|
+
*/
|
|
23
|
+
function generateSvgBadge(score, tier, grade) {
|
|
24
|
+
const { bg, text, label } = getTierColor(tier);
|
|
25
|
+
const gradeStr = grade && tier !== 'unknown' ? ` (${grade})` : '';
|
|
26
|
+
const rightText = tier === 'unknown' || score === null ? 'unknown' : `${score}/100 · ${label}${gradeStr}`;
|
|
27
|
+
// Approximate SVG widths
|
|
28
|
+
const leftWidth = 84;
|
|
29
|
+
const rightWidth = Math.max(80, rightText.length * 7 + 16);
|
|
30
|
+
const totalWidth = leftWidth + rightWidth;
|
|
31
|
+
const height = 20;
|
|
32
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${totalWidth}" height="${height}" role="img" aria-label="agentbadge: ${rightText}">
|
|
33
|
+
<title>agentbadge: ${rightText}</title>
|
|
34
|
+
<linearGradient id="s" x2="0" y2="100%">
|
|
35
|
+
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
|
36
|
+
<stop offset="1" stop-opacity=".1"/>
|
|
37
|
+
</linearGradient>
|
|
38
|
+
<clipPath id="r">
|
|
39
|
+
<rect width="${totalWidth}" height="${height}" rx="3" fill="#fff"/>
|
|
40
|
+
</clipPath>
|
|
41
|
+
<g clip-path="url(#r)">
|
|
42
|
+
<rect width="${leftWidth}" height="${height}" fill="#1e293b"/>
|
|
43
|
+
<rect x="${leftWidth}" width="${rightWidth}" height="${height}" fill="${bg}"/>
|
|
44
|
+
<rect width="${totalWidth}" height="${height}" fill="url(#s)"/>
|
|
45
|
+
</g>
|
|
46
|
+
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
|
|
47
|
+
<text aria-hidden="true" x="${(leftWidth / 2) * 10}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="${(leftWidth - 14) * 10}">agentbadge</text>
|
|
48
|
+
<text x="${(leftWidth / 2) * 10}" y="140" fill="#fff" transform="scale(.1)" textLength="${(leftWidth - 14) * 10}">agentbadge</text>
|
|
49
|
+
<text aria-hidden="true" x="${(leftWidth + rightWidth / 2) * 10}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="${(rightWidth - 14) * 10}">${rightText}</text>
|
|
50
|
+
<text x="${(leftWidth + rightWidth / 2) * 10}" y="140" fill="${text}" transform="scale(.1)" textLength="${(rightWidth - 14) * 10}">${rightText}</text>
|
|
51
|
+
</g>
|
|
52
|
+
</svg>`;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../src/badge.ts"],"names":[],"mappings":";;AAEA,oCAcC;AAKD,4CAoCC;AAvDD,SAAgB,YAAY,CAAC,IAA+B;IAC1D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,aAAa;YAChB,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;QAClE,KAAK,gBAAgB;YACnB,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QACrE,KAAK,iBAAiB;YACpB,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;QACtE,KAAK,eAAe;YAClB,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QACpE,KAAK,SAAS,CAAC;QACf;YACE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAChE,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,gB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,CAAC,CAAC,GAAG,EAAE,mBAAmB,IAAI,uCAAuC,CAAC,UAAU,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,SAAS;;OAE3I,CAAC;AACR,CAAC"}
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReadinessTier, ScanResult, RuleContext } from './types.js';
|
|
2
|
+
export declare const ALL_RULES: import("./types.js").Rule[];
|
|
3
|
+
export declare function calculateGrade(score: number): 'A+' | 'A' | 'B' | 'C' | 'F';
|
|
4
|
+
export declare function calculateTier(score: number): ReadinessTier;
|
|
5
|
+
export declare function runScan(ctx: RuleContext, options?: {
|
|
6
|
+
repoPath?: string;
|
|
7
|
+
repoName?: string;
|
|
8
|
+
}): Promise<ScanResult>;
|
|
9
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAOhG,eAAO,MAAM,SAAS,6BAMrB,CAAC;AAUF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAM1E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAK1D;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAyDvH"}
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ALL_RULES = void 0;
|
|
4
|
+
exports.calculateGrade = calculateGrade;
|
|
5
|
+
exports.calculateTier = calculateTier;
|
|
6
|
+
exports.runScan = runScan;
|
|
7
|
+
const context_js_1 = require("./rules/context.js");
|
|
8
|
+
const setup_js_1 = require("./rules/setup.js");
|
|
9
|
+
const verification_js_1 = require("./rules/verification.js");
|
|
10
|
+
const guardrails_js_1 = require("./rules/guardrails.js");
|
|
11
|
+
const tooling_js_1 = require("./rules/tooling.js");
|
|
12
|
+
exports.ALL_RULES = [
|
|
13
|
+
...context_js_1.contextRules,
|
|
14
|
+
...setup_js_1.setupRules,
|
|
15
|
+
...verification_js_1.verificationRules,
|
|
16
|
+
...guardrails_js_1.guardrailsRules,
|
|
17
|
+
...tooling_js_1.toolingRules
|
|
18
|
+
];
|
|
19
|
+
const PILLAR_CONFIG = {
|
|
20
|
+
context: { name: 'Context & Documentation', weight: 25 },
|
|
21
|
+
setup: { name: 'Setup & Environment', weight: 20 },
|
|
22
|
+
verification: { name: 'Verification & Testing', weight: 20 },
|
|
23
|
+
guardrails: { name: 'Guardrails & Safety', weight: 20 },
|
|
24
|
+
tooling: { name: 'Tooling & Schemas', weight: 15 }
|
|
25
|
+
};
|
|
26
|
+
function calculateGrade(score) {
|
|
27
|
+
if (score >= 95)
|
|
28
|
+
return 'A+';
|
|
29
|
+
if (score >= 80)
|
|
30
|
+
return 'A';
|
|
31
|
+
if (score >= 60)
|
|
32
|
+
return 'B';
|
|
33
|
+
if (score >= 40)
|
|
34
|
+
return 'C';
|
|
35
|
+
return 'F';
|
|
36
|
+
}
|
|
37
|
+
function calculateTier(score) {
|
|
38
|
+
if (score >= 80)
|
|
39
|
+
return 'agent-ready';
|
|
40
|
+
if (score >= 60)
|
|
41
|
+
return 'agent-friendly';
|
|
42
|
+
if (score >= 40)
|
|
43
|
+
return 'agent-tolerated';
|
|
44
|
+
return 'agent-hostile';
|
|
45
|
+
}
|
|
46
|
+
async function runScan(ctx, options) {
|
|
47
|
+
const pillarScores = {
|
|
48
|
+
context: { id: 'context', name: PILLAR_CONFIG.context.name, weight: 25, score: 0, maxScore: 0, percentage: 0, findings: [] },
|
|
49
|
+
setup: { id: 'setup', name: PILLAR_CONFIG.setup.name, weight: 20, score: 0, maxScore: 0, percentage: 0, findings: [] },
|
|
50
|
+
verification: { id: 'verification', name: PILLAR_CONFIG.verification.name, weight: 20, score: 0, maxScore: 0, percentage: 0, findings: [] },
|
|
51
|
+
guardrails: { id: 'guardrails', name: PILLAR_CONFIG.guardrails.name, weight: 20, score: 0, maxScore: 0, percentage: 0, findings: [] },
|
|
52
|
+
tooling: { id: 'tooling', name: PILLAR_CONFIG.tooling.name, weight: 15, score: 0, maxScore: 0, percentage: 0, findings: [] }
|
|
53
|
+
};
|
|
54
|
+
const recommendedActions = [];
|
|
55
|
+
let criticalCount = 0;
|
|
56
|
+
for (const rule of exports.ALL_RULES) {
|
|
57
|
+
const finding = await rule.evaluate(ctx);
|
|
58
|
+
const targetPillar = pillarScores[rule.pillar];
|
|
59
|
+
targetPillar.findings.push(finding);
|
|
60
|
+
targetPillar.score += finding.pointsEarned;
|
|
61
|
+
targetPillar.maxScore += finding.maxPoints;
|
|
62
|
+
if (finding.severity === 'critical') {
|
|
63
|
+
criticalCount++;
|
|
64
|
+
}
|
|
65
|
+
if (finding.remediation && finding.pointsEarned < finding.maxPoints) {
|
|
66
|
+
recommendedActions.push(finding.remediation.summary);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
let totalEarned = 0;
|
|
70
|
+
let totalMax = 0;
|
|
71
|
+
for (const pId of Object.keys(pillarScores)) {
|
|
72
|
+
const p = pillarScores[pId];
|
|
73
|
+
p.percentage = p.maxScore > 0 ? Math.round((p.score / p.maxScore) * 100) : 0;
|
|
74
|
+
totalEarned += p.score;
|
|
75
|
+
totalMax += p.maxScore;
|
|
76
|
+
}
|
|
77
|
+
// Raw score is capped between 0 and 100
|
|
78
|
+
const normalizedScore = totalMax > 0 ? Math.min(100, Math.max(0, Math.round((totalEarned / totalMax) * 100))) : 0;
|
|
79
|
+
const grade = calculateGrade(normalizedScore);
|
|
80
|
+
const tier = calculateTier(normalizedScore);
|
|
81
|
+
return {
|
|
82
|
+
score: normalizedScore,
|
|
83
|
+
tier,
|
|
84
|
+
grade,
|
|
85
|
+
scannedAt: new Date().toISOString(),
|
|
86
|
+
repoPath: options?.repoPath || '.',
|
|
87
|
+
repoName: options?.repoName || 'local-repo',
|
|
88
|
+
pillars: pillarScores,
|
|
89
|
+
summary: {
|
|
90
|
+
criticalIssuesCount: criticalCount,
|
|
91
|
+
recommendedActions
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":";;;AAuBA,wCAMC;AAED,sCAKC;AAED,0BAyDC;AA9FD,mDAAkD;AAClD,+CAA8C;AAC9C,6DAA4D;AAC5D,yDAAwD;AACxD,mDAAkD;AAErC,QAAA,SAAS,GAAG;IACvB,GAAG,yBAAY;IACf,GAAG,qBAAU;IACb,GAAG,mCAAiB;IACpB,GAAG,+BAAe;IAClB,GAAG,yBAAY;CAChB,CAAC;AAEF,MAAM,aAAa,GAAuD;IACxE,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,EAAE,EAAE;IACxD,KAAK,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,EAAE,EAAE;IAClD,YAAY,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,EAAE,EAAE,EAAE;IAC5D,UAAU,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,EAAE,EAAE;IACvD,OAAO,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,EAAE,EAAE;CACnD,CAAC;AAEF,SAAgB,cAAc,CAAC,KAAa;IAC1C,I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":[],"mappings":""}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
|
+
const engine_js_1 = require("./engine.js");
|
|
9
|
+
const badge_js_1 = require("./badge.js");
|
|
10
|
+
const remediator_js_1 = require("./remediator.js");
|
|
11
|
+
(0, node_test_1.default)('runScan returns low score for empty repo', async () => {
|
|
12
|
+
const mockCtx = {
|
|
13
|
+
files: [],
|
|
14
|
+
fileExists: () => false,
|
|
15
|
+
readFile: async () => null
|
|
16
|
+
};
|
|
17
|
+
const result = await (0, engine_js_1.runScan)(mockCtx);
|
|
18
|
+
node_assert_1.default.strictEqual(result.tier, 'agent-hostile');
|
|
19
|
+
node_assert_1.default.ok(result.score <= 30);
|
|
20
|
+
node_assert_1.default.strictEqual(result.summary.criticalIssuesCount >= 3, true);
|
|
21
|
+
});
|
|
22
|
+
(0, node_test_1.default)('runScan gives high score for fully prepared repository', async () => {
|
|
23
|
+
const preparedFiles = [
|
|
24
|
+
'AGENTS.md',
|
|
25
|
+
'README.md',
|
|
26
|
+
'docs/ARCHITECTURE.md',
|
|
27
|
+
'CONTRIBUTING.md',
|
|
28
|
+
'pnpm-lock.yaml',
|
|
29
|
+
'.env.example',
|
|
30
|
+
'Dockerfile',
|
|
31
|
+
'Makefile',
|
|
32
|
+
'tsconfig.json',
|
|
33
|
+
'package.json',
|
|
34
|
+
'.eslintrc.json',
|
|
35
|
+
'src/index.test.ts',
|
|
36
|
+
'.github/workflows/ci.yml',
|
|
37
|
+
'.husky',
|
|
38
|
+
'.gitignore',
|
|
39
|
+
'scripts/seed.ts',
|
|
40
|
+
'mcp.json',
|
|
41
|
+
'schema.prisma'
|
|
42
|
+
];
|
|
43
|
+
const mockCtx = {
|
|
44
|
+
files: preparedFiles,
|
|
45
|
+
fileExists: (path) => preparedFiles.includes(path),
|
|
46
|
+
readFile: async (path) => {
|
|
47
|
+
if (path === 'README.md')
|
|
48
|
+
return '# Title\n## Architecture\nRun `npm test` and `pnpm install`';
|
|
49
|
+
if (path === 'package.json')
|
|
50
|
+
return JSON.stringify({ scripts: { test: 'vitest', 'type-check': 'tsc --noEmit', lint: 'eslint', setup: 'pnpm i' } });
|
|
51
|
+
if (path === '.gitignore')
|
|
52
|
+
return 'node_modules\n.env\n.env.local\ndist';
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const result = await (0, engine_js_1.runScan)(mockCtx);
|
|
57
|
+
node_assert_1.default.ok(result.score >= 80, `Expected score >= 80, got ${result.score}`);
|
|
58
|
+
node_assert_1.default.strictEqual(result.tier, 'agent-ready');
|
|
59
|
+
});
|
|
60
|
+
(0, node_test_1.default)('generateSvgBadge creates valid SVG with score and colors', () => {
|
|
61
|
+
const svg = (0, badge_js_1.generateSvgBadge)(92, 'agent-ready', 'A');
|
|
62
|
+
node_assert_1.default.ok(svg.includes('<svg'));
|
|
63
|
+
node_assert_1.default.ok(svg.includes('92/100 · agent-ready (A)'));
|
|
64
|
+
node_assert_1.default.ok(svg.includes('#22c55e')); // Green color for agent-ready
|
|
65
|
+
});
|
|
66
|
+
(0, node_test_1.default)('generateSvgBadge handles unknown / rate-limited state cleanly', () => {
|
|
67
|
+
const svg = (0, badge_js_1.generateSvgBadge)(null, 'unknown');
|
|
68
|
+
node_assert_1.default.ok(svg.includes('<svg'));
|
|
69
|
+
node_assert_1.default.ok(svg.includes('unknown'));
|
|
70
|
+
node_assert_1.default.ok(svg.includes('#6b7280')); // Neutral gray for unknown
|
|
71
|
+
});
|
|
72
|
+
(0, node_test_1.default)('generateRemediationAgentsMd is strictly idempotent', () => {
|
|
73
|
+
const mockScan = {
|
|
74
|
+
score: 65,
|
|
75
|
+
tier: 'agent-friendly',
|
|
76
|
+
grade: 'B',
|
|
77
|
+
scannedAt: new Date().toISOString(),
|
|
78
|
+
repoPath: '.',
|
|
79
|
+
pillars: {
|
|
80
|
+
context: { id: 'context', name: 'Context', weight: 25, score: 20, maxScore: 25, percentage: 80, findings: [] },
|
|
81
|
+
setup: { id: 'setup', name: 'Setup', weight: 20, score: 10, maxScore: 20, percentage: 50, findings: [] },
|
|
82
|
+
verification: { id: 'verification', name: 'Verification', weight: 20, score: 10, maxScore: 20, percentage: 50, findings: [] },
|
|
83
|
+
guardrails: { id: 'guardrails', name: 'Guardrails', weight: 20, score: 15, maxScore: 20, percentage: 75, findings: [] },
|
|
84
|
+
tooling: { id: 'tooling', name: 'Tooling', weight: 15, score: 10, maxScore: 15, percentage: 66, findings: [] }
|
|
85
|
+
},
|
|
86
|
+
summary: { criticalIssuesCount: 0, recommendedActions: [] }
|
|
87
|
+
};
|
|
88
|
+
const initial = '# My Custom Existing AGENTS.md\nRules here.';
|
|
89
|
+
const firstPass = (0, remediator_js_1.generateRemediationAgentsMd)(mockScan, { existingContent: initial, packageManager: 'pnpm' });
|
|
90
|
+
node_assert_1.default.ok(firstPass.includes('Agent Readiness Patch'));
|
|
91
|
+
node_assert_1.default.ok(firstPass.includes('pnpm type-check'));
|
|
92
|
+
const secondPass = (0, remediator_js_1.generateRemediationAgentsMd)(mockScan, { existingContent: firstPass, packageManager: 'pnpm' });
|
|
93
|
+
// Count occurrences of patch header
|
|
94
|
+
const occurrences = (secondPass.match(/## 🤖 Agent Readiness Patch/g) || []).length;
|
|
95
|
+
node_assert_1.default.strictEqual(occurrences, 1, 'Patch header must only exist once (idempotent)');
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=engine.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.test.js","sourceRoot":"","sources":["../src/engine.test.ts"],"names":[],"mappings":";;;;;AAAA,0DAA6B;AAC7B,8D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AM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;SAC/G;QACD,OAAO,EAAE,EAAE,mBAAmB,EAAE,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE;KAC5D,CAAC;IAEF,MAAM,OAAO,GAAG,6CAA6C,CAAC;IAC9D,MAAM,SAAS,GAAG,IAAA,2CAA2B,EAAC,QAAQ,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9G,qBAAM,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACvD,qBAAM,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAEjD,MAAM,UAAU,GAAG,IAAA,2CAA2B,EAAC,QAAQ,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;IAEjH,oCAAoC;IACpC,MAAM,WAAW,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,8BAA8B,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACpF,qBAAM,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,gDAAgD,CAAC,CAAC;AACvF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RuleContext } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a RuleContext backed directly by GitHub's public REST API.
|
|
4
|
+
* Optimized with timeout and selective lazy content fetching.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createGitHubRuleContext(owner: string, repo: string, token?: string, timeoutMs?: number): Promise<{
|
|
7
|
+
ctx: RuleContext;
|
|
8
|
+
totalFiles: number;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=github-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-scanner.d.ts","sourceRoot":"","sources":["../src/github-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA2B9C;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,SAAQ,GAChB,OAAO,CAAC;IAAE,GAAG,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAiGnD"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGitHubRuleContext = createGitHubRuleContext;
|
|
4
|
+
// Rules evaluate these specific high-value files. We only fetch content for these to stay ultra fast.
|
|
5
|
+
const RELEVANT_CONTENT_PATTERNS = [
|
|
6
|
+
/^readme\.md$/i,
|
|
7
|
+
/^package\.json$/i,
|
|
8
|
+
/^\.gitignore$/i,
|
|
9
|
+
/^agents\.md$/i,
|
|
10
|
+
/^claude\.md$/i
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Creates a RuleContext backed directly by GitHub's public REST API.
|
|
14
|
+
* Optimized with timeout and selective lazy content fetching.
|
|
15
|
+
*/
|
|
16
|
+
async function createGitHubRuleContext(owner, repo, token, timeoutMs = 12000) {
|
|
17
|
+
const headers = {
|
|
18
|
+
'User-Agent': 'agentbadge-scanner',
|
|
19
|
+
Accept: 'application/vnd.github.v3+json',
|
|
20
|
+
};
|
|
21
|
+
if (token && token.trim().length > 0) {
|
|
22
|
+
headers['Authorization'] = `token ${token.trim()}`;
|
|
23
|
+
}
|
|
24
|
+
// 1. Fetch repo metadata with timeout
|
|
25
|
+
const controller = new AbortController();
|
|
26
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
27
|
+
let defaultBranch = 'main';
|
|
28
|
+
try {
|
|
29
|
+
const repoRes = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
|
|
30
|
+
headers,
|
|
31
|
+
signal: controller.signal,
|
|
32
|
+
});
|
|
33
|
+
if (!repoRes.ok) {
|
|
34
|
+
throw new Error(`GitHub API error (${repoRes.status}): ${repoRes.statusText}`);
|
|
35
|
+
}
|
|
36
|
+
const repoData = (await repoRes.json());
|
|
37
|
+
defaultBranch = repoData.default_branch || 'main';
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
}
|
|
42
|
+
// 2. Fetch git tree recursively (capped tree)
|
|
43
|
+
const treeController = new AbortController();
|
|
44
|
+
const treeTimer = setTimeout(() => treeController.abort(), timeoutMs);
|
|
45
|
+
let files = [];
|
|
46
|
+
try {
|
|
47
|
+
const treeRes = await fetch(`https://api.github.com/repos/${owner}/${repo}/git/trees/${defaultBranch}?recursive=1`, { headers, signal: treeController.signal });
|
|
48
|
+
if (!treeRes.ok) {
|
|
49
|
+
throw new Error(`Failed to fetch tree for ${owner}/${repo}: HTTP ${treeRes.status}`);
|
|
50
|
+
}
|
|
51
|
+
const treeData = (await treeRes.json());
|
|
52
|
+
files = (treeData.tree || [])
|
|
53
|
+
.filter((item) => item.type === 'blob')
|
|
54
|
+
.map((item) => item.path);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
clearTimeout(treeTimer);
|
|
58
|
+
}
|
|
59
|
+
const fileSet = new Set(files);
|
|
60
|
+
const contentCache = new Map();
|
|
61
|
+
const ctx = {
|
|
62
|
+
files,
|
|
63
|
+
fileExists: (relPath) => fileSet.has(relPath.replace(/\\/g, '/')),
|
|
64
|
+
readFile: async (relPath) => {
|
|
65
|
+
const normalized = relPath.replace(/\\/g, '/');
|
|
66
|
+
if (contentCache.has(normalized)) {
|
|
67
|
+
return contentCache.get(normalized) || null;
|
|
68
|
+
}
|
|
69
|
+
if (!fileSet.has(normalized)) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
// Check if file is worth fetching over network
|
|
73
|
+
const isRelevant = RELEVANT_CONTENT_PATTERNS.some((p) => p.test(normalized));
|
|
74
|
+
if (!isRelevant) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const fetchController = new AbortController();
|
|
79
|
+
const fetchTimer = setTimeout(() => fetchController.abort(), 4000);
|
|
80
|
+
const rawUrl = `https://raw.githubusercontent.com/${owner}/${repo}/${defaultBranch}/${normalized}`;
|
|
81
|
+
const rawRes = await fetch(rawUrl, { headers, signal: fetchController.signal });
|
|
82
|
+
clearTimeout(fetchTimer);
|
|
83
|
+
if (!rawRes.ok) {
|
|
84
|
+
contentCache.set(normalized, null);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const text = await rawRes.text();
|
|
88
|
+
contentCache.set(normalized, text);
|
|
89
|
+
return text;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
contentCache.set(normalized, null);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
return { ctx, totalFiles: files.length };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=github-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-scanner.js","sourceRoot":"","sources":["../src/github-scanner.ts"],"names":[],"mappings":";;AA+BA,0DAsGC;AAnHD,sGAAsG;AACtG,MAAM,yBAAyB,GAAG;IAChC,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,eAAe;IACf,eAAe;CAChB,CAAC;AAEF;;;GAGG;AACI,KAAK,UAAU,uBAAuB,CAC3C,KAAa,EACb,IAAY,EACZ,KAAc,EACd,SAAS,GAAG,KAAK;IAEjB,MAAM,OAAO,GAA2B;QACtC,YAAY,EAAE,oBAAoB;QAClC,MAAM,EAAE,gCAAgC;KACzC,CAAC;IA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+
export * from './engine.js';
|
|
3
|
+
export * from './badge.js';
|
|
4
|
+
export * from './remediator.js';
|
|
5
|
+
export * from './github-scanner.js';
|
|
6
|
+
export * from './rules/context.js';
|
|
7
|
+
export * from './rules/setup.js';
|
|
8
|
+
export * from './rules/verification.js';
|
|
9
|
+
export * from './rules/guardrails.js';
|
|
10
|
+
export * from './rules/tooling.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types.js"), exports);
|
|
18
|
+
__exportStar(require("./engine.js"), exports);
|
|
19
|
+
__exportStar(require("./badge.js"), exports);
|
|
20
|
+
__exportStar(require("./remediator.js"), exports);
|
|
21
|
+
__exportStar(require("./github-scanner.js"), exports);
|
|
22
|
+
__exportStar(require("./rules/context.js"), exports);
|
|
23
|
+
__exportStar(require("./rules/setup.js"), exports);
|
|
24
|
+
__exportStar(require("./rules/verification.js"), exports);
|
|
25
|
+
__exportStar(require("./rules/guardrails.js"), exports);
|
|
26
|
+
__exportStar(require("./rules/tooling.js"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,6CAA2B;AAC3B,kDAAgC;AAChC,sDAAoC;AACpC,qDAAmC;AACnC,mDAAiC;AACjC,0DAAwC;AACxC,wDAAsC;AACtC,qDAAmC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScanResult } from './types.js';
|
|
2
|
+
export interface RemediationOptions {
|
|
3
|
+
existingContent?: string;
|
|
4
|
+
packageManager?: 'pnpm' | 'npm' | 'yarn' | 'bun';
|
|
5
|
+
isMonorepo?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function generateRemediationAgentsMd(scan: ScanResult, options?: RemediationOptions): string;
|
|
8
|
+
//# sourceMappingURL=remediator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remediator.d.ts","sourceRoot":"","sources":["../src/remediator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAID,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CA4FlG"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateRemediationAgentsMd = generateRemediationAgentsMd;
|
|
4
|
+
const PATCH_HEADER = '## 🤖 Agent Readiness Patch (Added by agentbadge audit';
|
|
5
|
+
function generateRemediationAgentsMd(scan, options) {
|
|
6
|
+
const pm = options?.packageManager || 'npm';
|
|
7
|
+
const runPrefix = pm === 'npm' ? 'npm run' : pm;
|
|
8
|
+
const installCmd = pm === 'npm' ? 'npm install' : `${pm} install`;
|
|
9
|
+
// If existing AGENTS.md content is provided, append/replace the patch section idempotently
|
|
10
|
+
if (options?.existingContent && options.existingContent.trim().length > 0) {
|
|
11
|
+
let cleanExisting = options.existingContent.trim();
|
|
12
|
+
// Strip previous agentbadge patch section if already present
|
|
13
|
+
const patchIndex = cleanExisting.indexOf(PATCH_HEADER);
|
|
14
|
+
if (patchIndex !== -1) {
|
|
15
|
+
cleanExisting = cleanExisting.substring(0, patchIndex).trim();
|
|
16
|
+
// Remove trailing horizontal rule if present
|
|
17
|
+
cleanExisting = cleanExisting.replace(/---\s*$/, '').trim();
|
|
18
|
+
}
|
|
19
|
+
const missingItems = [];
|
|
20
|
+
if (scan.pillars.verification.score < scan.pillars.verification.maxScore) {
|
|
21
|
+
missingItems.push(`### Verification Fast Loops
|
|
22
|
+
Add/verify the following execution scripts:
|
|
23
|
+
\`\`\`bash
|
|
24
|
+
${runPrefix} type-check
|
|
25
|
+
${runPrefix} lint
|
|
26
|
+
${pm === 'npm' ? 'npm test' : `${pm} test`}
|
|
27
|
+
\`\`\``);
|
|
28
|
+
}
|
|
29
|
+
if (scan.pillars.setup.score < scan.pillars.setup.maxScore) {
|
|
30
|
+
missingItems.push(`### Setup & Secrets
|
|
31
|
+
Make sure required environment variables are copied from \`.env.example\`:
|
|
32
|
+
\`\`\`bash
|
|
33
|
+
cp .env.example .env
|
|
34
|
+
${installCmd}
|
|
35
|
+
\`\`\``);
|
|
36
|
+
}
|
|
37
|
+
return `${cleanExisting}
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
${PATCH_HEADER} — Score: ${scan.score}/100)
|
|
42
|
+
${missingItems.length > 0 ? missingItems.join('\n\n') : '- Codebase meets core verification and setup guardrails.'}
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
// Generate complete boilerplate if no AGENTS.md exists yet
|
|
46
|
+
return `# AGENTS.md — Repository Operating Instructions for AI Agents
|
|
47
|
+
|
|
48
|
+
> **Auto-generated by agentbadge audit.**
|
|
49
|
+
> This file gives AI coding agents (Claude Code, Cursor, Copilot, Codex, Devin) the direct context required to build, test, and navigate this codebase without hallucination.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 1. Project Overview & Boundaries
|
|
54
|
+
- **Project Name:** ${scan.repoName || 'Project'}
|
|
55
|
+
- **Current Readiness Score:** ${scan.score}/100 (${scan.tier})
|
|
56
|
+
- **Architecture Philosophy:** Maintain strict typing, modular separation of concerns, and clean contracts.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 2. Setup & Environment
|
|
61
|
+
Run these commands to prepare your local development environment:
|
|
62
|
+
\`\`\`bash
|
|
63
|
+
# Bootstrap dependencies
|
|
64
|
+
${installCmd}
|
|
65
|
+
cp .env.example .env
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 3. Verification & Fast Feedback Loops
|
|
71
|
+
Always verify changes locally before committing:
|
|
72
|
+
\`\`\`bash
|
|
73
|
+
# 1. Type Check
|
|
74
|
+
${runPrefix} type-check
|
|
75
|
+
|
|
76
|
+
# 2. Linting
|
|
77
|
+
${runPrefix} lint
|
|
78
|
+
|
|
79
|
+
# 3. Automated Tests
|
|
80
|
+
${pm === 'npm' ? 'npm test' : `${pm} test`}
|
|
81
|
+
\`\`\`
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 4. Key Rules for Agents
|
|
86
|
+
- **Zero \`any\` policy:** Explicit typing only.
|
|
87
|
+
- **Fail fast:** Run verification commands after modifying code.
|
|
88
|
+
- **Do not bypass git hooks or CI checks.**
|
|
89
|
+
- Document all architectural decisions and API models explicitly.
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=remediator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remediator.js","sourceRoot":"","sources":["../src/remediator.ts"],"names":[],"mappings":";;AAUA,kEA4FC;AA9FD,MAAM,YAAY,GAAG,wDAAwD,CAAC;AAE9E,SAAgB,2BAA2B,CAAC,IAAgB,EAAE,OAA4B;IACxF,MAAM,EAAE,GAAG,OAAO,EAAE,cAAc,IAAI,KAAK,CAAC;IAC5C,MAAM,SAAS,GAAG,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,MAAM,UAAU,GAAG,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC;IAElE,2FAA2F;IAC3F,IAAI,OAAO,EAAE,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1E,IAAI,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QACnD,6DAA6D;QAC7D,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,UAAU,KAAK,CAAC,CA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