cc-safe-setup 11.7.0 → 12.0.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.
package/README.md CHANGED
@@ -87,14 +87,43 @@ Each hook exists because a real incident happened without it.
87
87
  | `--scan [--apply]` | Tech stack detection |
88
88
  | `--export / --import` | Team config sharing |
89
89
  | `--verify` | Test each hook |
90
- | `--install-example <name>` | Install from 75 examples |
90
+ | `--install-example <name>` | Install from 118 examples |
91
91
  | `--examples [filter]` | Browse examples by keyword |
92
92
  | `--full` | All-in-one setup |
93
93
  | `--status` | Check installed hooks |
94
94
  | `--dry-run` | Preview changes |
95
95
  | `--uninstall` | Remove all hooks |
96
+ | `--shield` | Maximum safety in one command |
97
+ | `--guard "rule"` | Instantly enforce a rule from English |
98
+ | `--suggest` | Predict risks from project analysis |
99
+ | `--from-claudemd` | Convert CLAUDE.md rules to hooks |
100
+ | `--team` | Project-level hooks for git sharing |
101
+ | `--profile [level]` | Switch safety profiles |
102
+ | `--save-profile <name>` | Save current hooks as profile |
103
+ | `--analyze` | Session analysis dashboard |
104
+ | `--health` | Hook health table |
105
+ | `--quickfix` | Auto-fix common problems |
106
+ | `--replay` | Visual blocked commands timeline |
107
+ | `--why <hook>` | Show real incident behind hook |
108
+ | `--migrate-from <tool>` | Migrate from other hook tools |
109
+ | `--diff-hooks [path]` | Compare hook configurations |
96
110
  | `--help` | Show help |
97
111
 
112
+ ## Quick Start by Scenario
113
+
114
+ | I want to... | Command |
115
+ |---|---|
116
+ | Make Claude Code safe right now | `npx cc-safe-setup --shield` |
117
+ | Stop permission prompt spam | `npx cc-safe-setup --install-example auto-approve-readonly` |
118
+ | Enforce a rule instantly | `npx cc-safe-setup --guard "never delete production data"` |
119
+ | See what risks my project has | `npx cc-safe-setup --suggest` |
120
+ | Convert CLAUDE.md rules to hooks | `npx cc-safe-setup --from-claudemd` |
121
+ | Share hooks with my team | `npx cc-safe-setup --team && git add .claude/` |
122
+ | Choose a safety level | `npx cc-safe-setup --profile strict` |
123
+ | See what Claude blocked today | `npx cc-safe-setup --replay` |
124
+ | Know why a hook exists | `npx cc-safe-setup --why destructive-guard` |
125
+ | Migrate from Cursor/Windsurf | [Migration Guide](https://yurukusa.github.io/cc-safe-setup/migration-guide.html) |
126
+
98
127
  ## How It Works
99
128
 
100
129
  1. Writes hook scripts to `~/.claude/hooks/`
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+ # ================================================================
3
+ # git-remote-guard.sh — Block push/fetch to unknown git remotes
4
+ # ================================================================
5
+ # PURPOSE:
6
+ # Claude might add a new git remote and push code to it.
7
+ # This hook warns when git push/fetch targets a remote that
8
+ # wasn't in the original repo configuration.
9
+ #
10
+ # TRIGGER: PreToolUse MATCHER: "Bash"
11
+ # ================================================================
12
+
13
+ COMMAND=$(cat | jq -r '.tool_input.command // empty' 2>/dev/null)
14
+ [ -z "$COMMAND" ] && exit 0
15
+
16
+ # Check for git remote add
17
+ if echo "$COMMAND" | grep -qE '\bgit\s+remote\s+add\b'; then
18
+ echo "WARNING: Adding a new git remote." >&2
19
+ echo "Command: $COMMAND" >&2
20
+ echo "Verify this is a trusted repository." >&2
21
+ fi
22
+
23
+ # Check for push to non-origin remote
24
+ if echo "$COMMAND" | grep -qE '\bgit\s+push\s+(?!origin\b)\w'; then
25
+ REMOTE=$(echo "$COMMAND" | grep -oE 'git\s+push\s+(\S+)' | awk '{print $3}')
26
+ if [ -n "$REMOTE" ] && [ "$REMOTE" != "origin" ]; then
27
+ echo "WARNING: Pushing to non-origin remote: $REMOTE" >&2
28
+ echo "Verify this remote is trusted." >&2
29
+ fi
30
+ fi
31
+
32
+ exit 0
@@ -0,0 +1,33 @@
1
+ #!/bin/bash
2
+ # ================================================================
3
+ # subagent-scope-guard.sh — Limit subagent file access scope
4
+ # ================================================================
5
+ # PURPOSE:
6
+ # In multi-agent setups, subagents should only modify files
7
+ # within their assigned directory. This hook reads a scope
8
+ # file (.claude/agent-scope.txt) and blocks writes outside it.
9
+ #
10
+ # TRIGGER: PreToolUse MATCHER: "Edit|Write"
11
+ #
12
+ # Setup: echo "src/auth/" > .claude/agent-scope.txt
13
+ # ================================================================
14
+
15
+ INPUT=$(cat)
16
+ FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
17
+ [ -z "$FILE" ] && exit 0
18
+
19
+ SCOPE_FILE=".claude/agent-scope.txt"
20
+ [ -f "$SCOPE_FILE" ] || exit 0
21
+
22
+ SCOPE=$(cat "$SCOPE_FILE" | head -1 | tr -d '\n')
23
+ [ -z "$SCOPE" ] && exit 0
24
+
25
+ # Check if file is within scope
26
+ case "$FILE" in
27
+ ${SCOPE}*) exit 0 ;; # Within scope
28
+ *)
29
+ echo "BLOCKED: File $FILE is outside agent scope ($SCOPE)." >&2
30
+ echo "This agent should only modify files under $SCOPE" >&2
31
+ exit 2
32
+ ;;
33
+ esac
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "11.7.0",
3
+ "version": "12.0.0",
4
4
  "description": "One command to make Claude Code safe. 59 hooks (8 built-in + 51 examples). 26 CLI commands: dashboard, create, audit, lint, diff, migrate, compare, generate-ci. 284 tests.",
5
5
  "main": "index.mjs",
6
6
  "bin": {
@@ -1,25 +0,0 @@
1
- # Session Snapshot (auto-generated)
2
- Updated: 2026-03-24T22:17:08+09:00
3
-
4
- ## Git
5
- - Branch: `main`
6
- - Uncommitted changes: 1 file(s)
7
- ```
8
- M .claude/session-snapshot.md
9
- ```
10
- - Last commit: 98ecdeb checkpoint: auto-save 22:17:06
11
-
12
- ## Recent Files
13
- ```
14
- ./.claude/session-snapshot.md
15
- ./test.sh
16
- ./README.md
17
- ./examples/crontab-guard.sh
18
- ./examples/api-endpoint-guard.sh
19
- ./examples/dependency-version-pin.sh
20
- ./examples/auto-approve-readonly.sh
21
- ./examples/max-session-duration.sh
22
- ./CHANGELOG.md
23
- ./examples/typosquat-guard.sh
24
- ```
25
-