@lhi/tdd-audit 1.15.0 → 1.16.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/index.js +4 -3
- package/lib/badge.js +12 -5
- package/lib/config.js +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const {
|
|
|
12
12
|
printFindings,
|
|
13
13
|
} = require('./lib/scanner');
|
|
14
14
|
const { toJson, toSarif, toText } = require('./lib/reporter');
|
|
15
|
-
const { writeInitConfig } = require('./lib/config');
|
|
15
|
+
const { writeInitConfig, loadConfig, parseCliOverrides } = require('./lib/config');
|
|
16
16
|
const { badgeLine, injectBadge } = require('./lib/badge');
|
|
17
17
|
|
|
18
18
|
const args = process.argv.slice(2);
|
|
@@ -35,6 +35,7 @@ const outputFormat = args.includes('--json') ? 'json'
|
|
|
35
35
|
const agentBaseDir = isLocal ? process.cwd() : os.homedir();
|
|
36
36
|
const agentDirName = isClaude ? '.claude' : '.agents';
|
|
37
37
|
const projectDir = process.cwd();
|
|
38
|
+
const config = loadConfig(projectDir, parseCliOverrides(args));
|
|
38
39
|
|
|
39
40
|
const targetSkillDir = path.join(agentBaseDir, agentDirName, 'skills', 'tdd-remediation');
|
|
40
41
|
const targetWorkflowDir = isClaude
|
|
@@ -88,7 +89,7 @@ if (scanOnly) {
|
|
|
88
89
|
process.stdout.write('\n');
|
|
89
90
|
printFindings(findings, exempted);
|
|
90
91
|
}
|
|
91
|
-
injectBadge(projectDir, badgeLine(findings));
|
|
92
|
+
injectBadge(projectDir, badgeLine(findings, config.tdd_site));
|
|
92
93
|
process.exit(0);
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -245,7 +246,7 @@ if (!skipScan) {
|
|
|
245
246
|
const findings = quickScan(projectDir);
|
|
246
247
|
process.stdout.write('\n');
|
|
247
248
|
printFindings(findings);
|
|
248
|
-
const badge = badgeLine(findings);
|
|
249
|
+
const badge = badgeLine(findings, config.tdd_site);
|
|
249
250
|
injectBadge(projectDir, badge);
|
|
250
251
|
console.log('✅ README badge updated');
|
|
251
252
|
}
|
package/lib/badge.js
CHANGED
|
@@ -17,10 +17,16 @@ const NPM_URL = 'https://www.npmjs.com/package/@lhi/tdd-audit';
|
|
|
17
17
|
*
|
|
18
18
|
* likelyFalsePositive findings (test fixtures) are excluded from the count.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* The badge links to `siteUrl` when provided (set via `tdd_site` in
|
|
21
|
+
* .tdd-audit.json). When absent — including all skill-mode invocations where
|
|
22
|
+
* no config file exists — the link falls back to the @lhi/tdd-audit npm page
|
|
23
|
+
* so readers always know where the security tooling came from.
|
|
24
|
+
*
|
|
25
|
+
* @param {Array} findings - findings array returned by quickScan()
|
|
26
|
+
* @param {string} [siteUrl] - optional override link (from config.tdd_site)
|
|
27
|
+
* @returns {string} - single-line markdown badge ending with \n
|
|
22
28
|
*/
|
|
23
|
-
function badgeLine(findings) {
|
|
29
|
+
function badgeLine(findings, siteUrl) {
|
|
24
30
|
// Exclude test-file findings and likely false positives — badge reflects production code only
|
|
25
31
|
const real = (findings || []).filter(f => !f.likelyFalsePositive && !f.inTestFile);
|
|
26
32
|
const criticals = real.filter(f => f.severity === 'CRITICAL').length;
|
|
@@ -38,10 +44,11 @@ function badgeLine(findings) {
|
|
|
38
44
|
color = 'brightgreen';
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
const badgeUrl
|
|
47
|
+
const badgeUrl = `https://img.shields.io/badge/tdd--audit-${message}-${color}`;
|
|
48
|
+
const targetUrl = (siteUrl && siteUrl.trim()) ? siteUrl.trim() : NPM_URL;
|
|
42
49
|
// Embed the marker as a hidden HTML comment after the badge so injectBadge()
|
|
43
50
|
// can locate and replace the line on subsequent runs.
|
|
44
|
-
return `[](${
|
|
51
|
+
return `[](${targetUrl}) <!-- ${BADGE_MARKER} -->\n`;
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
/**
|
package/lib/config.js
CHANGED
|
@@ -17,6 +17,7 @@ const DEFAULTS = {
|
|
|
17
17
|
apiKeyEnv: null, // env var name to read the key from
|
|
18
18
|
serverApiKey: null, // key required on REST API calls
|
|
19
19
|
trustProxy: false, // trust X-Forwarded-For for rate limiting
|
|
20
|
+
tdd_site: null, // custom URL for the README badge link; falls back to npm page
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
// Provider-specific defaults for `tdd-audit init --provider <name>`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lhi/tdd-audit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Security skill installer for Claude Code, Gemini CLI, Cursor, Codex, and OpenCode. Patches vulnerabilities using a Red-Green-Refactor exploit-test protocol.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|