cc-safe-setup 1.9.2 → 1.9.3
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/examples/README.md +1 -0
- package/examples/git-config-guard.sh +36 -0
- package/index.mjs +3 -0
- package/package.json +2 -2
package/examples/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Custom hooks beyond the 8 built-in ones. Copy any file to `~/.claude/hooks/` and
|
|
|
15
15
|
| **block-database-wipe.sh** | Block destructive DB commands (Laravel, Django, Rails) | [#37405](https://github.com/anthropics/claude-code/issues/37405) |
|
|
16
16
|
| **edit-guard.sh** | Block Edit/Write to protected files | [#37210](https://github.com/anthropics/claude-code/issues/37210) |
|
|
17
17
|
| **enforce-tests.sh** | Warn when source changes without test changes | |
|
|
18
|
+
| **git-config-guard.sh** | Block git config --global modifications | [#37201](https://github.com/anthropics/claude-code/issues/37201) |
|
|
18
19
|
| **notify-waiting.sh** | Desktop notification when Claude waits for input | |
|
|
19
20
|
| **protect-dotfiles.sh** | Block modifications to ~/.bashrc, ~/.aws/, ~/.ssh/ | [#37478](https://github.com/anthropics/claude-code/issues/37478) |
|
|
20
21
|
| **scope-guard.sh** | Block file operations outside project directory | [#36233](https://github.com/anthropics/claude-code/issues/36233) |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# git-config-guard.sh — Block git config --global modifications
|
|
3
|
+
#
|
|
4
|
+
# Solves: Claude modifying global git config (user.email, user.name)
|
|
5
|
+
# without user consent (#37201)
|
|
6
|
+
#
|
|
7
|
+
# Usage: Add to settings.json as a PreToolUse hook
|
|
8
|
+
#
|
|
9
|
+
# {
|
|
10
|
+
# "hooks": {
|
|
11
|
+
# "PreToolUse": [{
|
|
12
|
+
# "matcher": "Bash",
|
|
13
|
+
# "hooks": [{ "type": "command", "command": "~/.claude/hooks/git-config-guard.sh" }]
|
|
14
|
+
# }]
|
|
15
|
+
# }
|
|
16
|
+
# }
|
|
17
|
+
|
|
18
|
+
INPUT=$(cat)
|
|
19
|
+
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty' 2>/dev/null)
|
|
20
|
+
|
|
21
|
+
[[ -z "$COMMAND" ]] && exit 0
|
|
22
|
+
|
|
23
|
+
# Block git config --global (any subcommand)
|
|
24
|
+
if echo "$COMMAND" | grep -qE '\bgit\s+config\s+--global\b'; then
|
|
25
|
+
echo "BLOCKED: git config --global is not allowed" >&2
|
|
26
|
+
echo "Use --local for project-specific config instead" >&2
|
|
27
|
+
exit 2
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Block git config --system
|
|
31
|
+
if echo "$COMMAND" | grep -qE '\bgit\s+config\s+--system\b'; then
|
|
32
|
+
echo "BLOCKED: git config --system is not allowed" >&2
|
|
33
|
+
exit 2
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
exit 0
|
package/index.mjs
CHANGED
|
@@ -290,6 +290,7 @@ function examples() {
|
|
|
290
290
|
'protect-dotfiles.sh': 'Block modifications to ~/.bashrc, ~/.aws/, ~/.ssh/',
|
|
291
291
|
'scope-guard.sh': 'Block file operations outside project directory',
|
|
292
292
|
'auto-checkpoint.sh': 'Auto-commit after edits for rollback protection',
|
|
293
|
+
'git-config-guard.sh': 'Block git config --global modifications',
|
|
293
294
|
};
|
|
294
295
|
|
|
295
296
|
console.log();
|
|
@@ -400,6 +401,8 @@ async function main() {
|
|
|
400
401
|
console.log(c.red + ' x' + c.reset + ' Syntax errors cascading through 30+ files');
|
|
401
402
|
console.log(c.red + ' x' + c.reset + ' Sessions losing all context with no warning');
|
|
402
403
|
console.log(c.red + ' x' + c.reset + ' git checkout --force discarding uncommitted changes');
|
|
404
|
+
console.log(c.red + ' x' + c.reset + ' Remove-Item -Recurse -Force destroying unpushed source code');
|
|
405
|
+
console.log(c.red + ' x' + c.reset + ' prisma migrate reset / migrate:fresh wiping databases');
|
|
403
406
|
console.log();
|
|
404
407
|
|
|
405
408
|
console.log(c.bold + ' Hooks to install:' + c.reset);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-safe-setup",
|
|
3
|
-
"version": "1.9.
|
|
4
|
-
"description": "One command to make Claude Code safe for autonomous operation. 8 hooks
|
|
3
|
+
"version": "1.9.3",
|
|
4
|
+
"description": "One command to make Claude Code safe for autonomous operation. 8 built-in hooks + 14 installable examples. Destructive blocker, branch guard, database wipe protection, dotfile guard, and more.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cc-safe-setup": "index.mjs"
|