Add toasty --install to auto-detect AI CLI agents and configure their hooks to show toast notifications.
| Agent | Config Path | Hook Event | Scope |
|---|---|---|---|
| Claude Code | ~/.claude/settings.json |
Stop |
User |
| Gemini CLI | ~/.gemini/settings.json |
AfterAgent |
User |
| GitHub Copilot | .github/hooks/toasty.json |
sessionEnd |
Repo |
- Check if
%USERPROFILE%\.claudefolder exists - Or check if
claudecommand is in PATH
- Check if
%USERPROFILE%\.geminifolder exists - Or check if
geminicommand is in PATH
- Check if
.githubfolder exists in current directory - Check if
gh copilotextension is installed (gh extension list)
- Use a JSON library (nlohmann/json or similar)
- Or use Windows JSON APIs (JsonObject from WinRT)
- Read existing config, preserve other settings
- Merge our hook config with existing hooks
- Don't duplicate if already installed
- Pretty-print output
Claude Code (~/.claude/settings.json):
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "C:\\path\\to\\toasty.exe \"Claude finished\" -t \"Claude Code\"",
"timeout": 5000
}
]
}
]
}
}Gemini CLI (~/.gemini/settings.json):
{
"hooks": {
"AfterAgent": [
{
"hooks": [
{
"type": "command",
"command": "C:\\path\\to\\toasty.exe \"Gemini finished\" -t \"Gemini\"",
"timeout": 5000
}
]
}
]
}
}GitHub Copilot (.github/hooks/toasty.json):
{
"version": 1,
"hooks": {
"sessionEnd": [
{
"type": "command",
"bash": "toasty 'Copilot finished' -t 'GitHub Copilot'",
"powershell": "toasty.exe 'Copilot finished' -t 'GitHub Copilot'",
"timeoutSec": 5
}
]
}
}toasty --install # Auto-detect and install all found
toasty --install claude # Install only for Claude
toasty --install gemini # Install only for Gemini
toasty --install copilot # Install only for Copilot
toasty --uninstall # Remove hooks from all
toasty --status # Show what's installed
Detecting AI CLI agents...
✓ Claude Code found
✓ Gemini CLI found
✗ GitHub Copilot CLI not found (not in a git repo)
Installing toasty hooks...
✓ Claude Code: Added Stop hook to ~/.claude/settings.json
✓ Gemini CLI: Added AfterAgent hook to ~/.gemini/settings.json
Done! You'll get notifications when AI agents finish.
Options:
- nlohmann/json - Header-only, easy to integrate
- WinRT JsonObject - Already using WinRT, no extra deps
- RapidJSON - Fast, header-only
Recommendation: Use WinRT Windows.Data.Json since we're already using WinRT.
- May need to add JSON library if not using WinRT
- Update build for new source files if splitting
- Fresh install (no existing config)
- Existing config with other settings (preserve them)
- Existing config with other hooks (merge, don't overwrite)
- Already installed (don't duplicate)
- Uninstall removes only our hook
- Invalid JSON in existing config (error gracefully)
- Install for Claude, verify notification works
- Install for Gemini, verify notification works
- Install for Copilot, verify notification works
- Add JSON support - WinRT JsonObject or nlohmann/json
- Implement detection - Check for each agent's config folder
- Implement Claude install - Simplest, we know it works
- Implement Gemini install - Same format as Claude
- Implement Copilot install - Different format, repo-level
- Add --uninstall - Remove our hooks
- Add --status - Show current state
- Update help text - Document new commands
- Test all combinations
- Update README
-
Self-path detection: How does toasty know its own exe path for the hook command?
- Use
GetModuleFileName()to get current exe path - Store absolute path in hook config
- Use
-
Copilot repo-level: Should we warn user this only affects current repo?
- Yes, print clear message about scope
-
Backup configs?: Should we backup before modifying?
- Good idea: copy to
.json.bakbefore first modification
- Good idea: copy to
-
Cross-platform paths: Copilot needs both bash and powershell paths
- Use forward slashes or escape backslashes appropriately