mergegate/scripts/hook-post-bash.sh
林 駿甫 (Shunsuke Hayashi) 3e3149f7d1 [追加] 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>
2026-04-10 08:58:58 +09:00

24 lines
950 B
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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