cc-safe-setup 2.9.0 → 2.10.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 (2) hide show
  1. package/index.mjs +15 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -78,6 +78,7 @@ const EXPORT = process.argv.includes('--export');
78
78
  const IMPORT_IDX = process.argv.findIndex(a => a === '--import');
79
79
  const IMPORT_FILE = IMPORT_IDX !== -1 ? process.argv[IMPORT_IDX + 1] : null;
80
80
  const STATS = process.argv.includes('--stats');
81
+ const JSON_OUTPUT = process.argv.includes('--json');
81
82
 
82
83
  if (HELP) {
83
84
  console.log(`
@@ -94,6 +95,7 @@ if (HELP) {
94
95
  npx cc-safe-setup --full Complete setup: hooks + scan + audit + badge
95
96
  npx cc-safe-setup --audit Safety score (0-100) with fixes
96
97
  npx cc-safe-setup --audit --fix Auto-fix missing protections
98
+ npx cc-safe-setup --audit --json Machine-readable output for CI/CD
97
99
  npx cc-safe-setup --scan Detect tech stack, recommend hooks
98
100
  npx cc-safe-setup --learn Learn from your block history
99
101
  npx cc-safe-setup --doctor Diagnose why hooks aren't working
@@ -596,7 +598,20 @@ async function audit() {
596
598
  console.log(c.dim + ' Paste this into your README.md' + c.reset);
597
599
  }
598
600
 
601
+ // JSON output (for CI/CD integration)
602
+ if (JSON_OUTPUT) {
603
+ const output = {
604
+ score,
605
+ grade: score >= 80 ? 'A' : score >= 60 ? 'B' : score >= 40 ? 'C' : 'F',
606
+ risks: risks.map(r => ({ severity: r.severity, issue: r.issue, fix: r.fix })),
607
+ passing: good,
608
+ timestamp: new Date().toISOString(),
609
+ };
610
+ console.log(JSON.stringify(output, null, 2));
611
+ }
612
+
599
613
  console.log();
614
+ process.exit(score < (parseInt(process.env.CC_AUDIT_THRESHOLD) || 0) ? 1 : 0);
600
615
  }
601
616
 
602
617
  function learn() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "One command to make Claude Code safe for autonomous operation. 8 built-in hooks + 26 installable examples. Destructive blocker, branch guard, database wipe protection, case-insensitive FS guard, and more.",
5
5
  "main": "index.mjs",
6
6
  "bin": {