[追加] Claude Code hooks: ファイル編集前にロック自動チェック (#73 関連)
.claude/settings.json: PreToolUse hook: Edit/Write 前に miyabi gate locks を確認 PostToolUse hook: git commit 後にロック状態をリマインド scripts/hook-check-lock.sh: 他人がロック中のファイルへの書き込みを exit 2 でブロック ロックなしファイルの編集は警告のみ(ブロックしない) scripts/hook-post-bash.sh: git commit 後にロック残数を表示 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3744382d3d
commit
3e3149f7d1
3 changed files with 126 additions and 0 deletions
24
scripts/hook-post-bash.sh
Executable file
24
scripts/hook-post-bash.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# Claude Code PostToolUse Hook: Bash 実行後にロック状態をリマインド
|
||||
#
|
||||
# git commit が実行された場合、post-commit hook が発火するので
|
||||
# ここでは軽い状態表示のみ。
|
||||
|
||||
TOOL_INPUT="$1"
|
||||
MIYABI_BIN="/Users/shunsukehayashi/dev/platform/miyabi-cli-standalone/target/release/miyabi"
|
||||
STORE="/Users/shunsukehayashi/dev/platform/miyabi-cli-standalone/project_memory/tasks.json"
|
||||
|
||||
# miyabi バイナリがなければスキップ
|
||||
if [ ! -x "$MIYABI_BIN" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# git commit を検出した場合にステータス表示
|
||||
if echo "$TOOL_INPUT" | grep -q "git commit"; then
|
||||
ACTIVE=$("$MIYABI_BIN" gate --store-path "$STORE" locks 2>/dev/null | grep -c "->")
|
||||
if [ "$ACTIVE" -gt 0 ]; then
|
||||
echo "ℹ️ POLARIS: $ACTIVE 件のファイルがまだロック中です。作業完了したら miyabi gate merge または miyabi gate manual-complete を実行してください。"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue