cc-safe-setup 15.0.0 → 16.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 +1 -1
- package/examples/auto-push-worktree.sh +12 -0
- package/examples/gitignore-check.sh +8 -0
- package/examples/no-root-write.sh +5 -0
- package/examples/package-json-guard.sh +6 -0
- package/examples/protect-commands-dir.sh +12 -0
- package/examples/worktree-cleanup-guard.sh +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**One command to make Claude Code safe for autonomous operation.** [日本語](docs/README.ja.md)
|
|
8
8
|
|
|
9
|
-
8 built-in + 124 examples = **
|
|
9
|
+
8 built-in + 124 examples = **150 hooks**. 44 CLI commands. 561 tests. 5 languages. [**Hub**](https://yurukusa.github.io/cc-safe-setup/hub.html) · [Wizard](https://yurukusa.github.io/cc-safe-setup/wizard.html) · [Cheat Sheet](https://yurukusa.github.io/cc-safe-setup/hooks-cheatsheet.html) · [Builder](https://yurukusa.github.io/cc-safe-setup/builder.html) · [FAQ](https://yurukusa.github.io/cc-safe-setup/faq.html) · [Examples](https://yurukusa.github.io/cc-safe-setup/by-example.html) · [Matrix](https://yurukusa.github.io/cc-safe-setup/matrix.html) · [Playground](https://yurukusa.github.io/cc-hook-registry/playground.html)
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npx cc-safe-setup
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# auto-push-worktree.sh — Auto-push worktree branches before session end
|
|
3
|
+
# TRIGGER: Stop MATCHER: ""
|
|
4
|
+
# Born from: https://github.com/anthropics/claude-code/issues/38287
|
|
5
|
+
BRANCH=$(git branch --show-current 2>/dev/null)
|
|
6
|
+
[[ "$BRANCH" == worktree-* ]] || exit 0
|
|
7
|
+
UNMERGED=$(git log --oneline origin/main..$BRANCH 2>/dev/null | wc -l)
|
|
8
|
+
if [ "$UNMERGED" -gt 0 ]; then
|
|
9
|
+
git push origin $BRANCH 2>/dev/null && \
|
|
10
|
+
echo "Auto-pushed $UNMERGED commit(s) from $BRANCH" >&2
|
|
11
|
+
fi
|
|
12
|
+
exit 0
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
COMMAND=$(cat | jq -r '.tool_input.command // empty' 2>/dev/null)
|
|
2
|
+
[ -z "$COMMAND" ] && exit 0
|
|
3
|
+
echo "$COMMAND" | grep -qE '^\s*git\s+add' || exit 0
|
|
4
|
+
if [ ! -f ".gitignore" ] || [ ! -s ".gitignore" ]; then
|
|
5
|
+
echo "WARNING: .gitignore is missing or empty." >&2
|
|
6
|
+
echo "Create one before staging files." >&2
|
|
7
|
+
fi
|
|
8
|
+
exit 0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# protect-commands-dir.sh — Backup .claude/commands/ on session start
|
|
3
|
+
# TRIGGER: SessionStart MATCHER: ""
|
|
4
|
+
# Born from: https://github.com/anthropics/claude-code/issues/38326
|
|
5
|
+
CMDS=".claude/commands"
|
|
6
|
+
BACKUP=".claude/commands-backup"
|
|
7
|
+
[ -d "$CMDS" ] || exit 0
|
|
8
|
+
mkdir -p "$BACKUP" 2>/dev/null
|
|
9
|
+
cp "$CMDS"/*.md "$BACKUP/" 2>/dev/null
|
|
10
|
+
COUNT=$(ls "$CMDS"/*.md 2>/dev/null | wc -l)
|
|
11
|
+
echo "Backed up $COUNT command files" >&2
|
|
12
|
+
exit 0
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# worktree-cleanup-guard.sh — Warn on worktree removal with unmerged commits
|
|
3
|
+
# TRIGGER: PreToolUse MATCHER: "Bash"
|
|
4
|
+
# Born from: https://github.com/anthropics/claude-code/issues/38287
|
|
5
|
+
COMMAND=$(cat | jq -r '.tool_input.command // empty' 2>/dev/null)
|
|
6
|
+
[ -z "$COMMAND" ] && exit 0
|
|
7
|
+
echo "$COMMAND" | grep -qE 'git\s+worktree\s+(remove|prune)' || exit 0
|
|
8
|
+
for branch in $(git branch --list 'worktree-*' 2>/dev/null); do
|
|
9
|
+
UNMERGED=$(git log --oneline main..$branch 2>/dev/null | wc -l)
|
|
10
|
+
if [ "$UNMERGED" -gt 0 ]; then
|
|
11
|
+
echo "WARNING: $branch has $UNMERGED unmerged commit(s)." >&2
|
|
12
|
+
echo "Push first: git push origin $branch" >&2
|
|
13
|
+
fi
|
|
14
|
+
done
|
|
15
|
+
exit 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-safe-setup",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.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": {
|