@spardutti/claude-skills 2.26.0 → 2.27.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/lib/setup-hook.mjs +13 -5
- package/package.json +1 -1
package/lib/setup-hook.mjs
CHANGED
|
@@ -57,7 +57,9 @@ if [ "$TOOL" != "Bash" ]; then
|
|
|
57
57
|
TARGET=$(printf '%s' "$INPUT" | grep -o '"file_path":[[:space:]]*"[^"]*"' | head -1 | sed 's/.*:[[:space:]]*"//; s/"$//')
|
|
58
58
|
case "$TARGET" in
|
|
59
59
|
# The settings file that configures the escape hatch cannot sit behind the
|
|
60
|
-
# gate, or a denied ack has no way to be un-denied.
|
|
60
|
+
# gate, or a denied ack has no way to be un-denied. The bare relative form
|
|
61
|
+
# matters: a skill claiming **/* gated it, and nothing could re-open it.
|
|
62
|
+
.claude/settings.json|.claude/settings.local.json) exit 0 ;;
|
|
61
63
|
*/.claude/settings.json|*/.claude/settings.local.json) exit 0 ;;
|
|
62
64
|
*.*) printf '%s' "$TARGET" | grep -qiE "\.($PROSE_EXT)$" && exit 0 ;;
|
|
63
65
|
esac
|
|
@@ -90,8 +92,9 @@ if [ "$TOOL" = "Bash" ]; then
|
|
|
90
92
|
*"<<"*|*python*" -c"*|*node*" -e"*|*perl*" -e"*|*ruby*" -e"*) WRITES=1 ;;
|
|
91
93
|
esac
|
|
92
94
|
[ -z "$WRITES" ] && exit 0
|
|
93
|
-
# A Bash write names its files in the command itself.
|
|
94
|
-
|
|
95
|
+
# A Bash write names its files in the command itself. Dockerfile and
|
|
96
|
+
# .dockerignore carry no extension, so they are matched by name.
|
|
97
|
+
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)
|
|
95
98
|
fi
|
|
96
99
|
|
|
97
100
|
# --- mandatory skills -------------------------------------------------------
|
|
@@ -106,10 +109,11 @@ fi
|
|
|
106
109
|
# without both fields keep the old behaviour, so this tightens nothing that was
|
|
107
110
|
# not deliberately declared.
|
|
108
111
|
MISSING=""
|
|
112
|
+
MANIFESTS=""
|
|
109
113
|
if [ -n "$TARGETS" ]; then
|
|
110
114
|
MANIFESTS=$(find "$PROJECT_DIR" -maxdepth 4 \\( -name node_modules -o -name .git -o -name .venv -o -name dist \\) -prune -o \\( -name package.json -o -name pyproject.toml -o -name requirements.txt \\) -print 2>/dev/null)
|
|
111
115
|
fi
|
|
112
|
-
if [ -n "$TARGETS" ]
|
|
116
|
+
if [ -n "$TARGETS" ]; then
|
|
113
117
|
for SKILL_FILE in $(find "$PROJECT_DIR" -path '*/.claude/skills/*/SKILL.md' 2>/dev/null); do
|
|
114
118
|
# paths: must be quoted in YAML — a scalar opening with * is an alias.
|
|
115
119
|
UNQUOTE='s/^["'"'"']//; s/["'"'"']$//'
|
|
@@ -117,7 +121,6 @@ if [ -n "$TARGETS" ] && [ -n "$MANIFESTS" ]; then
|
|
|
117
121
|
STRACKS=$(sed -n 's/^tracks:[[:space:]]*//p' "$SKILL_FILE" | head -1 | sed "$UNQUOTE")
|
|
118
122
|
SNAME=$(sed -n 's/^name:[[:space:]]*//p' "$SKILL_FILE" | head -1 | sed "$UNQUOTE")
|
|
119
123
|
[ -z "$SPATHS" ] && continue
|
|
120
|
-
[ -z "$STRACKS" ] && continue
|
|
121
124
|
[ -z "$SNAME" ] && continue
|
|
122
125
|
|
|
123
126
|
HIT=""
|
|
@@ -134,9 +137,14 @@ if [ -n "$TARGETS" ] && [ -n "$MANIFESTS" ]; then
|
|
|
134
137
|
|
|
135
138
|
# A .tsx file is not proof of React — it could be Astro, Solid or Preact.
|
|
136
139
|
# The packages the skill tracks are the proof, so the manifests decide.
|
|
140
|
+
#
|
|
141
|
+
# Some skills need no such proof: a .sql file is SQL and a Dockerfile is a
|
|
142
|
+
# Dockerfile, and no package declares either. A skill that names paths and
|
|
143
|
+
# no tracks is taken at its word.
|
|
137
144
|
PY=""
|
|
138
145
|
case "$STRACKS" in *pypi*) PY=1 ;; esac
|
|
139
146
|
DEP=""
|
|
147
|
+
[ -z "$STRACKS" ] && DEP=1
|
|
140
148
|
for P in $(printf '%s' "$STRACKS" | tr ',' ' '); do
|
|
141
149
|
case "$P" in *@*) ;; *) continue ;; esac
|
|
142
150
|
PKG=$(printf '%s' "$P" | sed 's/@[^@]*$//')
|