- PostToolUse hook: auto-format .rs files with rustfmt after edit - PreToolUse hook: block direct edits to Cargo.lock - /release skill: build .deb and inspect package metadata Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 lines
481 B
Bash
Executable file
16 lines
481 B
Bash
Executable file
#!/bin/bash
|
|
# Block direct edits to Cargo.lock — it should only change via cargo
|
|
INPUT=$(cat)
|
|
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
|
|
|
if [[ "$FILE_PATH" == *"Cargo.lock" ]]; then
|
|
echo '{
|
|
"hookSpecificOutput": {
|
|
"hookEventName": "PreToolUse",
|
|
"permissionDecision": "deny",
|
|
"permissionDecisionReason": "Cargo.lock is auto-generated. Use cargo to update dependencies."
|
|
}
|
|
}'
|
|
else
|
|
exit 0
|
|
fi
|