@spardutti/claude-skills 2.41.2 → 2.41.4
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.
|
@@ -62,8 +62,10 @@ if [ "$TOOL" = "Bash" ]; then
|
|
|
62
62
|
STRIPPED=$(printf '%s' "$CMD" | sed 's![12]*>>*[[:space:]]*/dev/null!!g')
|
|
63
63
|
WRITES=""
|
|
64
64
|
case "$STRIPPED" in
|
|
65
|
-
*">"*|*"
|
|
65
|
+
*">"*|*"sed -i"*) WRITES=1 ;;
|
|
66
66
|
esac
|
|
67
|
+
# Whole words only: "git add api/x.py" contains "dd ".
|
|
68
|
+
printf '%s' "$STRIPPED" | grep -qE '(^|[[:space:];|&(])(tee|cp|mv|truncate|dd)[[:space:]]' && WRITES=1
|
|
67
69
|
case "$CMD" in
|
|
68
70
|
*"<<"*|*python*" -c"*|*node*" -e"*|*perl*" -e"*|*ruby*" -e"*) WRITES=1 ;;
|
|
69
71
|
esac
|
|
@@ -24,7 +24,9 @@ SKILL_NAME=$(printf '%s' "$INPUT" | grep -o '"skill":"[^"]*"' | head -1 | sed 's
|
|
|
24
24
|
if [ -n "$SKILL_NAME" ]; then
|
|
25
25
|
# Sanitize: only allow [A-Za-z0-9_-] in the marker filename.
|
|
26
26
|
SAFE_NAME=$(printf '%s' "$SKILL_NAME" | tr -cd 'A-Za-z0-9_-')
|
|
27
|
-
|
|
27
|
+
# Only skills the CLI installed get acked; built-ins and hand-made skills have no rules for us.
|
|
28
|
+
MANIFEST="$(dirname "$(cd "$(dirname "$0")" && pwd)")/.claude-skills.json"
|
|
29
|
+
if [ -n "$SAFE_NAME" ] && tr -d ' \n' 2>/dev/null < "$MANIFEST" | grep -o '"skills":\[[^]]*\]' | grep -q "\"$SAFE_NAME\""; then
|
|
28
30
|
touch "/tmp/claude-skill-loaded-$KEY-$SAFE_NAME"
|
|
29
31
|
# The ack path holds a key the model cannot know, so without this line its
|
|
30
32
|
# first write is always denied just to learn it.
|
package/hooks/skill-gate.sh
CHANGED
|
@@ -63,7 +63,8 @@ if [ "$TOOL" != "Bash" ]; then
|
|
|
63
63
|
*/.claude/settings.json|*/.claude/settings.local.json) exit 0 ;;
|
|
64
64
|
# /optimize's benchmark lives outside the repo so no round can edit it; it is not project code.
|
|
65
65
|
/tmp/claude-optimize-*) exit 0 ;;
|
|
66
|
-
|
|
66
|
+
/tmp/claude-*/scratchpad/*) exit 0 ;;
|
|
67
|
+
*.*) printf '%s' "$TARGET" | grep -qiE "\.($PROSE_EXT)$" && exit 0 ;;
|
|
67
68
|
esac
|
|
68
69
|
TARGETS="$TARGET"
|
|
69
70
|
fi
|
|
@@ -76,17 +77,19 @@ if [ "$TOOL" = "Bash" ]; then
|
|
|
76
77
|
*.claude/settings.json*|*.claude/settings.local.json*) exit 0 ;;
|
|
77
78
|
esac
|
|
78
79
|
|
|
79
|
-
# /dev/null redirects are not file writes; drop them before looking for one.
|
|
80
|
+
# /dev/null redirects and 2>&1 are not file writes; drop them before looking for one.
|
|
80
81
|
|
|
81
82
|
# A command that names a prose file and no code file is writing prose.
|
|
82
|
-
if printf '%s' "$CMD" | grep -qiE "
|
|
83
|
+
if printf '%s' "$CMD" | grep -qiE "\.($PROSE_EXT)([^A-Za-z0-9]|$)" && ! printf '%s' "$CMD" | grep -qiE "\.($CODE_EXT)([^A-Za-z0-9]|$)"; then
|
|
83
84
|
exit 0
|
|
84
85
|
fi
|
|
85
|
-
STRIPPED=$(printf '%s' "$CMD" | sed 's![12]*>>*[[:space:]]*/dev/null!!g')
|
|
86
|
+
STRIPPED=$(printf '%s' "$CMD" | sed 's![12]*>>*[[:space:]]*/dev/null!!g; s/[0-9]*>&[0-9]//g')
|
|
86
87
|
WRITES=""
|
|
87
88
|
case "$STRIPPED" in
|
|
88
|
-
*">"*|*"
|
|
89
|
+
*">"*|*"sed -i"*) WRITES=1 ;;
|
|
89
90
|
esac
|
|
91
|
+
# Whole words only: "git add api/x.py" contains "dd ".
|
|
92
|
+
printf '%s' "$STRIPPED" | grep -qE '(^|[[:space:];|&(])(tee|cp|mv|truncate|dd)[[:space:]]' && WRITES=1
|
|
90
93
|
# An interpreter given inline code or a heredoc can write anything, and the
|
|
91
94
|
# shell shows no redirect at all — this is the shape that got past the gate.
|
|
92
95
|
case "$CMD" in
|
|
@@ -95,7 +98,7 @@ if [ "$TOOL" = "Bash" ]; then
|
|
|
95
98
|
[ -z "$WRITES" ] && exit 0
|
|
96
99
|
# A Bash write names its files in the command itself. Dockerfile and
|
|
97
100
|
# .dockerignore carry no extension, so they are matched by name.
|
|
98
|
-
TARGETS=$(printf '%s' "$CMD" | grep -oiE "[A-Za-z0-9_./-]
|
|
101
|
+
TARGETS=$(printf '%s' "$CMD" | grep -oiE "[A-Za-z0-9_./-]+\.($CODE_EXT)|[A-Za-z0-9_./-]*(Dockerfile[A-Za-z0-9_.-]*|.dockerignore)" 2>/dev/null)
|
|
99
102
|
fi
|
|
100
103
|
|
|
101
104
|
# --- mandatory skills -------------------------------------------------------
|