cc-safe-setup 28.4.2 → 28.4.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.
- package/README.md +7 -1
- package/index.mjs +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ Claude Code ships with no safety hooks by default. This tool fixes that.
|
|
|
64
64
|
|
|
65
65
|
Each hook exists because a real incident happened without it.
|
|
66
66
|
|
|
67
|
-
## All
|
|
67
|
+
## All 49 Commands
|
|
68
68
|
|
|
69
69
|
| Command | What It Does |
|
|
70
70
|
|---------|-------------|
|
|
@@ -112,6 +112,9 @@ Each hook exists because a real incident happened without it.
|
|
|
112
112
|
| `--test-hook <name>` | Test a specific hook with sample input |
|
|
113
113
|
| `--simulate "cmd"` | Preview how all hooks react to a command |
|
|
114
114
|
| `--protect <path>` | Block edits to a file or directory |
|
|
115
|
+
| `--rules [file]` | Compile YAML rules into hooks |
|
|
116
|
+
| `--validate` | Validate all hook scripts (syntax + structure) |
|
|
117
|
+
| `--safe-mode` | Maximum protection: all safety hooks + strict config |
|
|
115
118
|
| `--changelog` | Show what changed in each version |
|
|
116
119
|
| `--report` | Generate safety report |
|
|
117
120
|
| `--help` | Show help |
|
|
@@ -134,6 +137,9 @@ Each hook exists because a real incident happened without it.
|
|
|
134
137
|
| Diagnose why hooks aren't working | `npx cc-safe-setup --doctor` |
|
|
135
138
|
| Preview how hooks react to a command | `npx cc-safe-setup --simulate "git push origin main"` |
|
|
136
139
|
| Protect a specific file from edits | `npx cc-safe-setup --protect .env` |
|
|
140
|
+
| Define rules in YAML, compile to hooks | `npx cc-safe-setup --rules rules.yaml` |
|
|
141
|
+
| Validate all hook scripts are correct | `npx cc-safe-setup --validate` |
|
|
142
|
+
| Maximum protection mode | `npx cc-safe-setup --safe-mode` |
|
|
137
143
|
| Migrate from Cursor/Windsurf | [Migration Guide](https://yurukusa.github.io/cc-safe-setup/migration-guide.html) |
|
|
138
144
|
|
|
139
145
|
## How It Works
|
package/index.mjs
CHANGED
|
@@ -1573,7 +1573,7 @@ async function guard(description) {
|
|
|
1573
1573
|
if (!settings.hooks) settings.hooks = {};
|
|
1574
1574
|
if (!settings.hooks[trigger]) settings.hooks[trigger] = [];
|
|
1575
1575
|
|
|
1576
|
-
const cmd = `bash ${hookPath}`;
|
|
1576
|
+
const cmd = `bash ${toBashPath(hookPath)}`;
|
|
1577
1577
|
const alreadyExists = JSON.stringify(settings.hooks).includes(hookName);
|
|
1578
1578
|
if (!alreadyExists) {
|
|
1579
1579
|
const existing = settings.hooks[trigger].find(e => e.matcher === matcher);
|
|
@@ -2435,7 +2435,7 @@ async function shield() {
|
|
|
2435
2435
|
|
|
2436
2436
|
for (const f of hookFiles) {
|
|
2437
2437
|
const content = readFileSync(join(HOOKS_DIR, f), 'utf-8');
|
|
2438
|
-
const cmd = `bash ${join(HOOKS_DIR, f)}`;
|
|
2438
|
+
const cmd = `bash ${toBashPath(join(HOOKS_DIR, f))}`;
|
|
2439
2439
|
|
|
2440
2440
|
// Check if already in settings
|
|
2441
2441
|
const alreadyConfigured = JSON.stringify(settings.hooks).includes(f);
|
|
@@ -4557,7 +4557,7 @@ FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
|
|
|
4557
4557
|
if (!settings.hooks) settings.hooks = {};
|
|
4558
4558
|
if (!settings.hooks.PreToolUse) settings.hooks.PreToolUse = [];
|
|
4559
4559
|
|
|
4560
|
-
const hookCmd = `bash ${hookPath}`;
|
|
4560
|
+
const hookCmd = `bash ${toBashPath(hookPath)}`;
|
|
4561
4561
|
|
|
4562
4562
|
// Check all matchers for existing compiled-rules entry
|
|
4563
4563
|
let found = false;
|
|
@@ -4679,7 +4679,7 @@ exit 0
|
|
|
4679
4679
|
if (!settings.hooks.PreToolUse) settings.hooks.PreToolUse = [];
|
|
4680
4680
|
|
|
4681
4681
|
// Register under specific matchers based on rule types (NEVER use "" matcher)
|
|
4682
|
-
const hookCmd = `bash ${hookPath}`;
|
|
4682
|
+
const hookCmd = `bash ${toBashPath(hookPath)}`;
|
|
4683
4683
|
const hasBlocks = rules.some(r => r.type === 'block');
|
|
4684
4684
|
const hasApproves = rules.some(r => r.type === 'approve');
|
|
4685
4685
|
const hasProtects = rules.some(r => r.type === 'protect');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-safe-setup",
|
|
3
|
-
"version": "28.4.
|
|
4
|
-
"description": "One command to make Claude Code safe. 336 hooks (8 built-in + 328 examples). 49 CLI commands.
|
|
3
|
+
"version": "28.4.4",
|
|
4
|
+
"description": "One command to make Claude Code safe. 336 hooks (8 built-in + 328 examples). 49 CLI commands. 980 tests. 5 languages.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cc-safe-setup": "index.mjs"
|