Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ The same binary runs as a read-only MCP server (`drift_feed_status`, `pins_repor
rugsnare skills scan # pin all skill files (SKILL.md, .mdc, etc.)
rugsnare skills diff # exit 1 if anything changed
rugsnare skills report # visual report in your browser
rugsnare skills report --json # same report data as JSON to stdout, for CI and other tools
```

Discovers skill files across Claude Code, Cursor, Windsurf, Continue, ZCode, Copilot, Codex, and Cline. When a skill changes after you approved it, the HTML report shows what was added/removed, classifies severity (DANGEROUS / REVIEW / SAFE), and explains in plain language why it matters.
Expand Down
7 changes: 6 additions & 1 deletion product/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -1329,8 +1329,13 @@ async function cmdSkills(flags) {
} catch { /* MCP fetch failed - skills report still works */ }
}

const { auditCurrentSkills } = await import('./skills-pin.js');
const { auditCurrentSkills } = await import('./skills-pin.js');
const currentAudit = auditCurrentSkills(cwd, home);
if (flags.json) {
const { buildSkillsReportJson } = await import('./skills-report.js');
console.log(JSON.stringify(buildSkillsReportJson(results, { mcpResults, currentAudit }), null, 2));
return;
}
const { reportPath, counts } = writeSkillsReport(results, cwd, mcpResults, currentAudit);
console.log(`Report: ${reportPath}`);
const totalBad = counts.dangerous + mcpResults.reduce((n, r) => n + r.verdicts.length, 0);
Expand Down
22 changes: 22 additions & 0 deletions product/src/skills-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,28 @@ ${mcpFindings.join('\n')}`;
return { html, counts: { total: results.length, dangerous: dangerous.length, review: review.length, safe: safe.length, unchanged: unchanged.length, new: allNew.length, removed: removed.length } };
}

/**
* Machine-readable version of the same report data the HTML report uses.
* Returned as a plain object so callers can JSON.stringify it to stdout
* for CI pipelines and other tools.
*/
export function buildSkillsReportJson(results, { generatedAt, mcpResults = [], currentAudit = [] } = {}) {
const { counts } = generateSkillsReport(results, { generatedAt, mcpResults, currentAudit });
return {
generatedAt: new Date(generatedAt ?? Date.now()).toISOString(),
counts,
skills: results.map((r) => ({
key: r.key,
status: r.status,
severity: r.severity ?? null,
changes: r.changes ?? null,
advisory: r.advisory ? { score: r.advisory.score, signals: r.advisory.signals } : null,
})),
mcp: mcpResults,
currentAudit,
};
}

/**
* Write the report to a file and return the path.
*/
Expand Down
24 changes: 24 additions & 0 deletions product/test/skills-pin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,30 @@ test('CLI: scan -> diff clean -> report', async () => {
} finally { cleanup(); }
});

test('CLI: skills report --json outputs valid JSON to stdout', async () => {
const { dir, cleanup } = tmp();
try {
mkdeploy(dir, CLEAN);
const s = await cli(dir, ['skills', 'scan']);
assert.equal(s.code, 0, s.stderr);
const r = await cli(dir, ['skills', 'report', '--json']);
assert.equal(r.code, 0, r.stderr);
const parsed = JSON.parse(r.stdout);
assert.equal(typeof parsed.generatedAt, 'string');
assert.ok(!Number.isNaN(Date.parse(parsed.generatedAt)));
assert.equal(parsed.counts.total, parsed.skills.length);
assert.ok(parsed.skills.length >= 1);
for (const skill of parsed.skills) {
assert.equal(typeof skill.key, 'string');
assert.ok(['UNCHANGED', 'DRIFT', 'NEW', 'REMOVED'].includes(skill.status));
assert.ok('severity' in skill && 'changes' in skill && 'advisory' in skill);
}
assert.ok(Array.isArray(parsed.mcp));
assert.ok(Array.isArray(parsed.currentAudit));
assert.ok(!fs.existsSync(path.join(dir, '.rugsnare', 'skills-report.html')));
} finally { cleanup(); }
});

test('CLI: diff exit 1 on DANGEROUS', async () => {
const { dir, cleanup } = tmp();
try {
Expand Down