Closed5
[Scrap] 僕の貧弱な Claude Code 環境を整備する

作業完了時に音が鳴るようにしたい

手始めに下記の script を用意して、hooks に登録してみた。
Notification
#!/bin/bash
# stdinからJSONを読み込む
input=$(cat)
# jqを使ってメッセージを抽出
message=$(echo "$input" | jq -r '.message // "通知があります"')
# メッセージを読み上げる
say -v Kyoko "$message"
# オプション:同時に通知も表示
osascript -e "display notification \"$message\" with title \"Claude Code\""
Stop
#!/bin/bash
# 入力を読み込む
input=$(cat)
# トランスクリプトパスを取得
transcript_path=$(echo "$input" | jq -r '.transcript_path')
# トランスクリプトから最後のアシスタントメッセージを抽出(簡易版)
if [ -f "$transcript_path" ]; then
# 最後の数行から要約を作成
last_message="作業が完了しました"
# より詳細にしたい場合は、トランスクリプトを解析
# last_assistant_msg=$(tail -n 20 "$transcript_path" | jq -r 'select(.role == "assistant") | .content' | tail -n 1)
else
last_message="クロードコードの処理が完了しました"
fi
# 読み上げ
say -v Kyoko "$last_message"

「現状作業が完了しました」 だけ呼んでくれるな。一旦これでいいか

Stop だけ残して Notification の方は消しちゃおう

Playwright MCP を入れる
このスクラップは2ヶ月前にクローズされました