Add Claude Code hooks and release skill
- 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>
This commit is contained in:
parent
101c91c4d8
commit
1f216243f0
4 changed files with 68 additions and 0 deletions
16
.claude/hooks/block-cargo-lock.sh
Executable file
16
.claude/hooks/block-cargo-lock.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/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
|
||||
8
.claude/hooks/format-rs.sh
Executable file
8
.claude/hooks/format-rs.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
# Auto-format Rust files after Edit/Write
|
||||
INPUT=$(cat)
|
||||
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
||||
|
||||
if [[ "$FILE_PATH" == *.rs ]]; then
|
||||
rustfmt --edition 2021 "$FILE_PATH" 2>/dev/null || true
|
||||
fi
|
||||
27
.claude/settings.json
Normal file
27
.claude/settings.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/format-rs.sh",
|
||||
"statusMessage": "Formatting Rust code..."
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/block-cargo-lock.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
17
.claude/skills/release/SKILL.md
Normal file
17
.claude/skills/release/SKILL.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
name: release
|
||||
description: Build claudify .deb package and show build info
|
||||
disable-model-invocation: true
|
||||
---
|
||||
|
||||
# Release
|
||||
|
||||
Build the claudify .deb package and verify the output.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Run `cargo tauri build` from the project root
|
||||
2. Show the build output path and file size
|
||||
3. Inspect the .deb package metadata with `dpkg-deb --info`
|
||||
4. List the .deb package contents with `dpkg-deb --contents`
|
||||
5. Report the package name, version, architecture, and installed size
|
||||
Loading…
Add table
Add a link
Reference in a new issue