@spardutti/claude-skills 1.27.0 → 1.27.2
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 +8 -4
- package/package.json +1 -1
package/lib/setup-hook.mjs
CHANGED
|
@@ -11,8 +11,12 @@ import { join, resolve } from "node:path";
|
|
|
11
11
|
// - transcript_path missing or unreadable
|
|
12
12
|
// - no user prompt found in transcript
|
|
13
13
|
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
14
|
+
// LAST_PROMPT is detected by matching user-role lines whose content is
|
|
15
|
+
// a JSON string ("role":"user","content":"..."), which excludes
|
|
16
|
+
// tool_results, skill loads, task notifications, and slash-command
|
|
17
|
+
// payloads (all of which use array content). The sentinel scan also
|
|
18
|
+
// excludes tool_result lines so the gate's own deny message — which
|
|
19
|
+
// embeds the literal sentinel — cannot self-satisfy.
|
|
16
20
|
const GATE_SCRIPT = `#!/bin/bash
|
|
17
21
|
# PreToolUse gate: forces skill evaluation before file-writing tools run.
|
|
18
22
|
|
|
@@ -30,12 +34,12 @@ if [ -z "$TRANSCRIPT" ] || [ ! -f "$TRANSCRIPT" ]; then
|
|
|
30
34
|
exit 0
|
|
31
35
|
fi
|
|
32
36
|
|
|
33
|
-
LAST_PROMPT=$(grep -
|
|
37
|
+
LAST_PROMPT=$(grep -nE '"role":"user","content":"' "$TRANSCRIPT" 2>/dev/null | tail -1 | cut -d: -f1)
|
|
34
38
|
if [ -z "$LAST_PROMPT" ]; then
|
|
35
39
|
exit 0
|
|
36
40
|
fi
|
|
37
41
|
|
|
38
|
-
if tail -n +"$LAST_PROMPT" "$TRANSCRIPT" | grep -v '
|
|
42
|
+
if tail -n +"$LAST_PROMPT" "$TRANSCRIPT" | grep -v '"type":"tool_result"' | grep -qF '[skills-checked]'; then
|
|
39
43
|
exit 0
|
|
40
44
|
fi
|
|
41
45
|
|