cc-safe-setup 28.3.2 → 28.3.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.
@@ -0,0 +1,35 @@
1
+ COMMAND=$(cat | jq -r '.tool_input.command // empty' 2>/dev/null)
2
+ [ -z "$COMMAND" ] && exit 0
3
+ if echo "$COMMAND" | grep -qE '^\s*(npm\s+test|npm\s+run\s+test|npx\s+(jest|vitest|mocha|ava|tap|playwright\s+test|cypress\s+run)|yarn\s+test|pnpm\s+test|bun\s+test)\b'; then
4
+ echo '{"decision":"approve","reason":"Test runner command"}'
5
+ exit 0
6
+ fi
7
+ if echo "$COMMAND" | grep -qE '^\s*(pytest|python\s+-m\s+(pytest|unittest)|tox)\b'; then
8
+ echo '{"decision":"approve","reason":"Python test runner"}'
9
+ exit 0
10
+ fi
11
+ if echo "$COMMAND" | grep -qE '^\s*go\s+test\b'; then
12
+ echo '{"decision":"approve","reason":"Go test runner"}'
13
+ exit 0
14
+ fi
15
+ if echo "$COMMAND" | grep -qE '^\s*cargo\s+test\b'; then
16
+ echo '{"decision":"approve","reason":"Cargo test runner"}'
17
+ exit 0
18
+ fi
19
+ if echo "$COMMAND" | grep -qE '^\s*(phpunit|vendor/bin/phpunit|php\s+artisan\s+test)\b'; then
20
+ echo '{"decision":"approve","reason":"PHP test runner"}'
21
+ exit 0
22
+ fi
23
+ if echo "$COMMAND" | grep -qE '^\s*(rspec|bundle\s+exec\s+rspec|rake\s+test|rails\s+test)\b'; then
24
+ echo '{"decision":"approve","reason":"Ruby test runner"}'
25
+ exit 0
26
+ fi
27
+ if echo "$COMMAND" | grep -qE '^\s*(mvn\s+test|gradle\s+test|./gradlew\s+test)\b'; then
28
+ echo '{"decision":"approve","reason":"Java test runner"}'
29
+ exit 0
30
+ fi
31
+ if echo "$COMMAND" | grep -qE '^\s*dotnet\s+test\b'; then
32
+ echo '{"decision":"approve","reason":".NET test runner"}'
33
+ exit 0
34
+ fi
35
+ exit 0
@@ -0,0 +1,15 @@
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+push\b' || exit 0
5
+ BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)
6
+ if [ -n "$BASE" ]; then
7
+ BAD_COMMITS=$(git log --oneline "$BASE"..HEAD 2>/dev/null | grep -iE '^[a-f0-9]+ (fixup!|squash!|amend!|WIP:?|wip:?|FIXME:?|TODO:?) ')
8
+ if [ -n "$BAD_COMMITS" ]; then
9
+ echo "WARNING: Branch contains uncommitted fixup/WIP commits:" >&2
10
+ echo "$BAD_COMMITS" | head -5 >&2
11
+ echo "" >&2
12
+ echo "Consider: git rebase -i $BASE to squash these before pushing." >&2
13
+ fi
14
+ fi
15
+ exit 0
@@ -0,0 +1,27 @@
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+push\b' || exit 0
5
+ if [ -f "package.json" ]; then
6
+ HAS_TEST=$(jq -r '.scripts.test // empty' package.json 2>/dev/null)
7
+ if [ -n "$HAS_TEST" ] && [ "$HAS_TEST" != "echo \"Error: no test specified\" && exit 1" ]; then
8
+ RECENT_TEST=0
9
+ for marker in coverage/.last-run.json test-results junit.xml .nyc_output; do
10
+ if [ -e "$marker" ]; then
11
+ AGE=$(( $(date +%s) - $(stat -c %Y "$marker" 2>/dev/null || echo 0) ))
12
+ if [ "$AGE" -lt 600 ]; then
13
+ RECENT_TEST=1
14
+ break
15
+ fi
16
+ fi
17
+ done
18
+ if [ "$RECENT_TEST" -eq 0 ]; then
19
+ echo "WARNING: Pushing without recent test run." >&2
20
+ echo "Run 'npm test' before pushing to verify changes." >&2
21
+ fi
22
+ fi
23
+ fi
24
+ if [ -f "Makefile" ] && grep -q "^test:" Makefile 2>/dev/null; then
25
+ : # Could check make test recency, but keeping it simple
26
+ fi
27
+ exit 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "28.3.2",
4
- "description": "One command to make Claude Code safe. 321 hooks (8 built-in + 313 examples). 45 CLI commands. 941 tests. 5 languages.",
3
+ "version": "28.3.3",
4
+ "description": "One command to make Claude Code safe. 324 hooks (8 built-in + 316 examples). 45 CLI commands. 941 tests. 5 languages.",
5
5
  "main": "index.mjs",
6
6
  "bin": {
7
7
  "cc-safe-setup": "index.mjs"