diff --git a/docs/notifications.md b/docs/notifications.md index d6926d36..250e11dd 100644 --- a/docs/notifications.md +++ b/docs/notifications.md @@ -58,6 +58,57 @@ cmux notify --title "Done" --tab 0 --panel 1 See the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code) for hook configuration. +### GitHub Copilot CLI + +Copilot CLI supports [hooks](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/use-hooks) that run shell commands at key lifecycle events. Add to `~/.copilot/config.json`: + +```json +{ + "hooks": { + "userPromptSubmitted": [ + { + "type": "command", + "bash": "if command -v cmux &>/dev/null; then cmux set-status copilot_cli Running; fi", + "timeoutSec": 3 + } + ], + "agentStop": [ + { + "type": "command", + "bash": "if command -v cmux &>/dev/null; then cmux notify --title 'Copilot CLI' --body 'Done'; cmux set-status copilot_cli Idle; else osascript -e 'display notification \"Done\" with title \"Copilot CLI\"'; fi", + "timeoutSec": 5 + } + ], + "errorOccurred": [ + { + "type": "command", + "bash": "if command -v cmux &>/dev/null; then cmux notify --title 'Copilot CLI' --subtitle 'Error' --body \"$(cat | jq -r '.errorMessage // \"An error occurred\"' 2>/dev/null | head -c 100)\"; cmux set-status copilot_cli Error; else osascript -e 'display notification \"An error occurred\" with title \"Copilot CLI\"'; fi", + "timeoutSec": 5 + } + ], + "sessionEnd": [ + { + "type": "command", + "bash": "if command -v cmux &>/dev/null; then cmux clear-status copilot_cli; fi", + "timeoutSec": 3 + } + ] + } +} +``` + +Or for repo-level hooks, create `.github/hooks/notify.json`: + +```json +{ + "version": 1, + "hooks": { + "userPromptSubmitted": [ ... ], + "agentStop": [ ... ] + } +} +``` + ### OpenAI Codex Add to `~/.codex/config.toml`: @@ -119,6 +170,8 @@ cmux sets these in child shells: cmux notify --title [--subtitle ] [--body ] [--tab ] [--panel ] cmux list-notifications cmux clear-notifications +cmux set-status +cmux clear-status cmux ping ```