cc-safe-setup 2.1.0 → 2.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.
Files changed (3) hide show
  1. package/README.md +12 -0
  2. package/index.mjs +24 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -128,6 +128,18 @@ Or start with the free hooks: [claude-code-hooks](https://github.com/yurukusa/cl
128
128
 
129
129
  ## Examples
130
130
 
131
+ ## Safety Audit
132
+
133
+ Check what's missing in your setup:
134
+
135
+ ```bash
136
+ npx cc-safe-setup --audit
137
+ ```
138
+
139
+ Analyzes 9 safety dimensions and gives you a score (0-100) with one-command fixes for each risk.
140
+
141
+ ## Examples
142
+
131
143
  Need custom hooks beyond the 8 built-in ones? Install any example with one command:
132
144
 
133
145
  ```bash
package/index.mjs CHANGED
@@ -398,7 +398,7 @@ async function installExample(name) {
398
398
  console.log();
399
399
  }
400
400
 
401
- function audit() {
401
+ async function audit() {
402
402
  console.log();
403
403
  console.log(c.bold + ' cc-safe-setup --audit' + c.reset);
404
404
  console.log(c.dim + ' Analyzing your Claude Code safety setup...' + c.reset);
@@ -543,6 +543,29 @@ function audit() {
543
543
  return sum + 5;
544
544
  }, 0));
545
545
  console.log(c.bold + ' Safety Score: ' + (score >= 80 ? c.green : score >= 50 ? c.yellow : c.red) + score + '/100' + c.reset);
546
+
547
+ // --audit --fix: auto-fix what we can
548
+ if (process.argv.includes('--fix') && risks.length > 0) {
549
+ console.log();
550
+ console.log(c.bold + ' Applying fixes...' + c.reset);
551
+ const { execSync } = await import('child_process');
552
+ for (const r of risks) {
553
+ if (r.fix.startsWith('npx cc-safe-setup')) {
554
+ try {
555
+ const cmd = r.fix.replace('npx cc-safe-setup', 'node ' + process.argv[1]);
556
+ console.log(' ' + c.dim + '→ ' + r.fix + c.reset);
557
+ execSync(cmd, { stdio: 'inherit' });
558
+ } catch(e) {
559
+ console.log(' ' + c.red + ' Failed: ' + e.message + c.reset);
560
+ }
561
+ }
562
+ }
563
+ console.log();
564
+ console.log(c.green + ' Re-run --audit to verify fixes.' + c.reset);
565
+ } else if (risks.length > 0) {
566
+ console.log();
567
+ console.log(c.dim + ' Run with --fix to auto-apply: npx cc-safe-setup --audit --fix' + c.reset);
568
+ }
546
569
  console.log();
547
570
  }
548
571
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "One command to make Claude Code safe for autonomous operation. 8 built-in hooks + 25 installable examples. Destructive blocker, branch guard, database wipe protection, dotfile guard, and more.",
5
5
  "main": "index.mjs",
6
6
  "bin": {