cc-safe-setup 28.3.4 → 28.3.5

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.
@@ -0,0 +1,18 @@
1
+ INPUT=$(cat)
2
+ COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty' 2>/dev/null)
3
+ [ -z "$COMMAND" ] && exit 0
4
+ echo "$COMMAND" | grep -qE '(git\s+commit|git\s+push|husky|lint-staged|pre-commit)' || exit 0
5
+ if [ -d ".git/hooks" ]; then
6
+ ACTIVE=$(find .git/hooks -maxdepth 1 -type f -executable ! -name "*.sample" 2>/dev/null | wc -l)
7
+ if [ "$ACTIVE" -gt 0 ]; then
8
+ echo "NOTE: $ACTIVE active git hooks found in .git/hooks/" >&2
9
+ echo "Ensure CC hooks and git hooks don't duplicate checks." >&2
10
+ fi
11
+ fi
12
+ if [ -d ".husky" ]; then
13
+ HUSKY=$(find .husky -maxdepth 1 -type f -executable 2>/dev/null | wc -l)
14
+ if [ "$HUSKY" -gt 0 ]; then
15
+ echo "NOTE: Husky detected with $HUSKY hooks. CC hooks run separately." >&2
16
+ fi
17
+ fi
18
+ exit 0
@@ -0,0 +1,14 @@
1
+ INPUT=$(cat)
2
+ COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty' 2>/dev/null)
3
+ [ -z "$COMMAND" ] && exit 0
4
+ echo "$COMMAND" | grep -qE '^\s*git\s+commit\b' || exit 0
5
+ STAGED=$(git diff --cached --name-only 2>/dev/null | wc -l)
6
+ MAX=${CC_MAX_COMMIT_FILES:-20}
7
+ if [ "$STAGED" -gt "$MAX" ]; then
8
+ echo "WARNING: Committing $STAGED files (threshold: $MAX)." >&2
9
+ echo "Consider splitting into smaller, focused commits." >&2
10
+ echo "Staged files:" >&2
11
+ git diff --cached --name-only 2>/dev/null | head -10 >&2
12
+ [ "$STAGED" -gt 10 ] && echo "... and $((STAGED - 10)) more" >&2
13
+ fi
14
+ exit 0
@@ -0,0 +1,14 @@
1
+ INPUT=$(cat)
2
+ FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
3
+ [ -z "$FILE" ] && exit 0
4
+ case "$FILE" in
5
+ */.claude/hooks/*.sh|*/hooks/*.sh) ;;
6
+ *) exit 0 ;;
7
+ esac
8
+ [ ! -f "$FILE" ] && exit 0
9
+ if grep -qE '^\s*sleep\s+[0-9]' "$FILE" 2>/dev/null; then
10
+ echo "WARNING: Hook contains sleep command: $FILE" >&2
11
+ echo "Sleep in hooks causes Claude Code to hang or timeout." >&2
12
+ echo "Remove sleep calls or use non-blocking alternatives." >&2
13
+ fi
14
+ exit 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "28.3.4",
4
- "description": "One command to make Claude Code safe. 324 hooks (8 built-in + 316 examples). 45 CLI commands. 941 tests. 5 languages.",
3
+ "version": "28.3.5",
4
+ "description": "One command to make Claude Code safe. 327 hooks (8 built-in + 319 examples). 45 CLI commands. 941 tests. 5 languages.",
5
5
  "main": "index.mjs",
6
6
  "bin": {
7
7
  "cc-safe-setup": "index.mjs"