cc-safe-setup 29.6.6 → 29.6.7
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
|
+
#!/bin/bash
|
|
2
|
+
# ================================================================
|
|
3
|
+
# json-syntax-check.sh — Validate JSON files after editing
|
|
4
|
+
# ================================================================
|
|
5
|
+
# PURPOSE:
|
|
6
|
+
# Claude Code sometimes writes invalid JSON to settings.json,
|
|
7
|
+
# package.json, or tsconfig.json. This hook validates JSON
|
|
8
|
+
# syntax immediately after an edit, before it causes errors.
|
|
9
|
+
#
|
|
10
|
+
# TRIGGER: PostToolUse
|
|
11
|
+
# MATCHER: "Edit|Write"
|
|
12
|
+
# ================================================================
|
|
13
|
+
|
|
14
|
+
INPUT=$(cat)
|
|
15
|
+
TOOL=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
|
|
16
|
+
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
|
|
17
|
+
|
|
18
|
+
[ -z "$FILE" ] && exit 0
|
|
19
|
+
|
|
20
|
+
# Only check JSON files
|
|
21
|
+
echo "$FILE" | grep -qiE '\.json$|\.jsonc$' || exit 0
|
|
22
|
+
|
|
23
|
+
# Skip if file doesn't exist (Write to new file hasn't completed yet)
|
|
24
|
+
[ -f "$FILE" ] || exit 0
|
|
25
|
+
|
|
26
|
+
# Validate JSON
|
|
27
|
+
if ! jq empty "$FILE" 2>/dev/null; then
|
|
28
|
+
echo "⚠ Invalid JSON syntax in: $FILE" >&2
|
|
29
|
+
# Show the specific error
|
|
30
|
+
ERROR=$(jq empty "$FILE" 2>&1)
|
|
31
|
+
echo " Error: $ERROR" >&2
|
|
32
|
+
echo " Fix this before continuing — broken JSON will cause runtime errors." >&2
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
exit 0
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-safe-setup",
|
|
3
|
-
"version": "29.6.
|
|
4
|
-
"description": "One command to make Claude Code safe.
|
|
3
|
+
"version": "29.6.7",
|
|
4
|
+
"description": "One command to make Claude Code safe. 417 example hooks + 8 built-in. 52 CLI commands. 5639 tests. Works with Auto Mode.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cc-safe-setup": "index.mjs"
|