cc-safe-setup 1.0.2 → 1.0.4

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 +31 -0
  2. package/index.mjs +23 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # cc-safe-setup
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/cc-safe-setup)](https://www.npmjs.com/package/cc-safe-setup)
4
+ [![npm downloads](https://img.shields.io/npm/dw/cc-safe-setup)](https://www.npmjs.com/package/cc-safe-setup)
5
+
3
6
  **One command to make Claude Code safe for autonomous operation.**
4
7
 
5
8
  ```bash
@@ -8,6 +11,34 @@ npx cc-safe-setup
8
11
 
9
12
  Installs 4 production-tested safety hooks in ~10 seconds. Zero dependencies. No manual configuration.
10
13
 
14
+ ```
15
+ cc-safe-setup
16
+ Make Claude Code safe for autonomous operation
17
+
18
+ Prevents real incidents:
19
+ ✗ rm -rf deleting entire user directories (NTFS junction traversal)
20
+ ✗ Untested code pushed to main at 3am
21
+ ✗ Syntax errors cascading through 30+ files
22
+ ✗ Sessions losing all context with no warning
23
+
24
+ Hooks to install:
25
+
26
+ ● Destructive Command Blocker
27
+ ● Branch Push Protector
28
+ ● Post-Edit Syntax Validator
29
+ ● Context Window Monitor
30
+
31
+ Install all 4 safety hooks? [Y/n] Y
32
+
33
+ ✓ Destructive Command Blocker
34
+ ✓ Branch Push Protector
35
+ ✓ Post-Edit Syntax Validator
36
+ ✓ Context Window Monitor
37
+ ✓ settings.json updated
38
+
39
+ Done. 4 safety hooks installed.
40
+ ```
41
+
11
42
  ## Why This Exists
12
43
 
13
44
  A Claude Code user [lost their entire C:\Users directory](https://github.com/anthropics/claude-code/issues/36339) when `rm -rf` followed NTFS junctions. Another had untested code pushed to main at 3am. Syntax errors cascaded through 30+ files before anyone noticed.
package/index.mjs CHANGED
@@ -49,11 +49,23 @@ function ask(question) {
49
49
  });
50
50
  }
51
51
 
52
+ const DRY_RUN = process.argv.includes('--dry-run') || process.argv.includes('-n');
53
+
52
54
  async function main() {
53
55
  console.log();
54
56
  console.log(c.bold + ' cc-safe-setup' + c.reset);
55
57
  console.log(c.dim + ' Make Claude Code safe for autonomous operation' + c.reset);
56
58
  console.log();
59
+ // Check jq dependency
60
+ try {
61
+ const { execSync } = await import('child_process');
62
+ execSync('which jq', { stdio: 'pipe' });
63
+ } catch(e) {
64
+ console.log(c.yellow + ' Warning: jq is not installed. Hooks require jq for JSON parsing.' + c.reset);
65
+ console.log(c.dim + ' Install: brew install jq (macOS) | apt install jq (Linux)' + c.reset);
66
+ console.log();
67
+ }
68
+
57
69
  console.log(c.dim + ' Prevents real incidents:' + c.reset);
58
70
  console.log(c.red + ' x' + c.reset + ' rm -rf deleting entire user directories (NTFS junction traversal)');
59
71
  console.log(c.red + ' x' + c.reset + ' Untested code pushed to main at 3am');
@@ -69,6 +81,17 @@ async function main() {
69
81
  }
70
82
  console.log();
71
83
 
84
+ if (DRY_RUN) {
85
+ console.log(c.yellow + ' --dry-run: showing what would be installed (no changes made)' + c.reset);
86
+ console.log();
87
+ for (const [id, hook] of Object.entries(HOOKS)) {
88
+ console.log(' ' + c.dim + 'would install: ' + join(HOOKS_DIR, id + '.sh') + c.reset);
89
+ }
90
+ console.log(' ' + c.dim + 'would update: ' + SETTINGS_PATH + c.reset);
91
+ console.log();
92
+ process.exit(0);
93
+ }
94
+
72
95
  const answer = await ask(' Install all ' + Object.keys(HOOKS).length + ' safety hooks? [Y/n] ');
73
96
  if (answer.toLowerCase() === 'n') {
74
97
  console.log('\n ' + c.dim + 'Cancelled.' + c.reset + '\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "One command to make Claude Code safe for autonomous operation. Installs destructive command blockers, branch guards, and syntax checks.",
5
5
  "main": "index.mjs",
6
6
  "bin": {