@spardutti/claude-skills 1.27.3 → 1.27.5
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 +6 -6
- package/package.json +1 -1
package/lib/setup-hook.mjs
CHANGED
|
@@ -2,14 +2,15 @@ import { mkdir, writeFile, readFile, chmod } from "node:fs/promises";
|
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
|
|
4
4
|
// PreToolUse gate on Write|Edit|MultiEdit. Blocks the tool call unless
|
|
5
|
-
// a per-prompt marker file exists at
|
|
5
|
+
// a per-prompt marker file exists at /tmp/claude-skill-gate-<UUID>,
|
|
6
6
|
// where <UUID> is the uuid of the most recent typed user prompt. The
|
|
7
7
|
// assistant creates the marker via Bash; Bash output is flushed
|
|
8
8
|
// synchronously, so the marker is race-free against the message-buffering
|
|
9
9
|
// behavior that broke the earlier text-sentinel approach (Claude Code
|
|
10
10
|
// writes assistant content blocks to JSONL only after the turn completes,
|
|
11
11
|
// so [skills-checked] text emitted in the same message as a tool_use is
|
|
12
|
-
// invisible to PreToolUse).
|
|
12
|
+
// invisible to PreToolUse). /tmp keeps the marker out of the project
|
|
13
|
+
// directory so it can't leak into commits.
|
|
13
14
|
//
|
|
14
15
|
// LAST_PROMPT_UUID is detected by matching user-role lines whose content
|
|
15
16
|
// is a JSON string ("role":"user","content":"..."), which excludes
|
|
@@ -43,15 +44,14 @@ if [ -z "$LAST_PROMPT_UUID" ]; then
|
|
|
43
44
|
exit 0
|
|
44
45
|
fi
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
MARKER="$MARKER_DIR/.skill-gate-$LAST_PROMPT_UUID"
|
|
47
|
+
MARKER="/tmp/claude-skill-gate-$LAST_PROMPT_UUID"
|
|
48
48
|
if [ -f "$MARKER" ]; then
|
|
49
|
-
find
|
|
49
|
+
find /tmp -maxdepth 1 -name 'claude-skill-gate-*' ! -name "claude-skill-gate-$LAST_PROMPT_UUID" -delete 2>/dev/null
|
|
50
50
|
exit 0
|
|
51
51
|
fi
|
|
52
52
|
|
|
53
53
|
cat <<EOF
|
|
54
|
-
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Skill evaluation required before file edits. (1) List each available skill as ACTIVATE or SKIP with a one-line reason. (2) Call Skill() for any ACTIVATE entries. (3) Run this exact Bash command to record approval:
|
|
54
|
+
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Skill evaluation required before file edits. (1) List each available skill as ACTIVATE or SKIP with a one-line reason. (2) Call Skill() for any ACTIVATE entries. (3) Run this exact Bash command to record approval: touch /tmp/claude-skill-gate-$LAST_PROMPT_UUID (4) Then retry the file edit. The marker is unique to this user prompt and is auto-cleaned on the next prompt."}}
|
|
55
55
|
EOF
|
|
56
56
|
exit 0
|
|
57
57
|
`;
|