{"id":29610515,"url":"https://github.com/foxytanuki/ccnotify","last_synced_at":"2026-01-20T16:48:47.660Z","repository":{"id":304927985,"uuid":"1020113988","full_name":"foxytanuki/ccnotify","owner":"foxytanuki","description":"A CLI tool for creating Claude Code Stop Hooks with Discord, ntfy, and macOS notifications.","archived":false,"fork":false,"pushed_at":"2025-07-17T06:41:48.000Z","size":1123,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-17T07:28:01.178Z","etag":null,"topics":["claude","claude-code","notifications"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foxytanuki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-15T11:07:55.000Z","updated_at":"2025-07-17T06:41:52.000Z","dependencies_parsed_at":"2025-07-17T12:09:09.768Z","dependency_job_id":"7c81fe7f-d5fb-43aa-af8f-ea226a4b76d0","html_url":"https://github.com/foxytanuki/ccnotify","commit_stats":null,"previous_names":["foxytanuki/ccnotify"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/foxytanuki/ccnotify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fccnotify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fccnotify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fccnotify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fccnotify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foxytanuki","download_url":"https://codeload.github.com/foxytanuki/ccnotify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fccnotify/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266189677,"owners_count":23890065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude","claude-code","notifications"],"created_at":"2025-07-20T20:08:03.958Z","updated_at":"2025-09-21T00:23:27.140Z","avatar_url":"https://github.com/foxytanuki.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ccnotify\n\n[![CI](https://github.com/foxytanuki/ccnotify/actions/workflows/ci.yml/badge.svg)](https://github.com/foxytanuki/ccnotify/actions/workflows/ci.yml)\n[![npm version](https://badge.fury.io/js/ccnotify.svg)](https://badge.fury.io/js/ccnotify)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n![ccnotify](./docs/assets/images/readme01.png)\n\nA CLI tool for creating Claude Code Stop Hooks with Discord, ntfy, and macOS notifications.\n\n[日本語ドキュメントはこちら](./docs/ja/index.md)\n\n## Overview\n\n`ccnotify` simplifies the creation of Stop Hooks for Claude Code by automatically generating or updating the configuration file (`.claude/settings.local.json` for local projects or `~/.claude/settings.json` for global settings). This eliminates the manual process of writing hook configurations and provides a streamlined way to set up notifications when Claude Code operations complete.\n\n## Features\n\n- **Discord Notifications**: Send rich embed notifications to Discord webhooks\n- **ntfy Push Notifications**: Send push notifications through ntfy.sh service\n- **macOS Native Notifications**: Display native macOS notifications with sound\n- **Global Configuration**: Support for both local and global configuration modes\n- **Safe Configuration Management**: Preserves existing settings and creates backups\n- **Cross-Platform**: Works on macOS, Linux, and Windows\n\n## Installation\n\n### ⚠️ Important: Git Security\n\n**It is strongly recommended to add `.claude/settings.local.json` to your `.gitignore` file** to prevent accidentally committing sensitive information such as:\n- Discord webhook URLs containing tokens\n- Personal notification preferences\n- Other potentially sensitive configuration data\n\nAdd this line to your `.gitignore`:\n```gitignore\n# Claude Code local settings (may contain sensitive data)\n.claude/settings.local.json\n```\n\n### Using npx (Recommended)\n\nAlways use the latest version without global installation:\n\n```bash\nnpx ccnotify discord https://discord.com/api/webhooks/123/abc\nnpx ccnotify ntfy my-topic\nnpx ccnotify macos \"Notification Title\"\n```\n\n### Global Installation\n\nIf you prefer to install globally:\n\n#### Using npm\n\n```bash\nnpm install -g ccnotify\n```\n\n#### Using yarn\n\n```bash\nyarn global add ccnotify\n```\n\n#### Using pnpm\n\n```bash\npnpm add -g ccnotify\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/foxytanuki/ccnotify.git\ncd ccnotify\npnpm install\npnpm run build\npnpm link --global\n```\n\n## Usage\n\n### Quick Start with npx\n\n```bash\n# Discord notifications\nnpx ccnotify discord https://discord.com/api/webhooks/123456789/your-webhook-token\n\n# ntfy notifications\nnpx ccnotify ntfy my-topic-name\n\n# macOS notifications\nnpx ccnotify macos \"Claude Code Completed\"\n\n# Global configuration\nnpx ccnotify discord https://discord.com/api/webhooks/123/abc --global\n```\n\n### Basic Commands\n\n#### Discord Notifications\n\nCreate a Discord webhook notification hook:\n\n```bash\nccnotify discord https://discord.com/api/webhooks/123456789/your-webhook-token\n```\n\n#### ntfy Push Notifications\n\nCreate an ntfy push notification hook:\n\n```bash\nccnotify ntfy my-topic-name\n```\n\n#### macOS Native Notifications\n\nCreate a macOS native notification hook:\n\n```bash\n# Use default title (script will use \"Claude Code\")\nccnotify macos\n\n# Use custom title\nccnotify macos \"My Custom Title\"\n```\n\n#### Notification Logging\n\nView and manage notification logs:\n\n```bash\n# View recent logs\nccnotify logs\n\n# Show only failed notifications\nccnotify logs --failed\n\n# View statistics\nccnotify logs --stats\n\n# Export logs to file\nccnotify logs --export logs.json\n\n# Filter by notification type\nccnotify logs --type discord\nccnotify logs --type ntfy\nccnotify logs --type macos\n```\n\n#### Configuration Management\n\nManage notification logging settings:\n\n```bash\n# Show current configuration\nccnotify config --show\n\n# Enable debug logging\nccnotify config --log-level DEBUG\n\n# Include transcript content in logs\nccnotify config --include-transcripts\n```\n\n### Global Configuration\n\nUse the `--global` or `-g` flag to create hooks in your global Claude configuration (`~/.claude/settings.json`):\n\n```bash\nccnotify discord https://discord.com/api/webhooks/123/abc --global\nccnotify ntfy my-topic --global\nccnotify macos \"Global Notifications\" --global\n```\n\n### Help and Version\n\n```bash\n# Show help\nccnotify --help\nccnotify discord --help\nccnotify ntfy --help\nccnotify macos --help\n\n# Show version\nccnotify --version\n```\n\n## Configuration\n\n### Local vs Global\n\n- **Local**: Creates/updates `.claude/settings.local.json` in the current directory\n- **Global**: Creates/updates `~/.claude/settings.json` in your home directory\n\n### Configuration File Structure\n\nThe tool creates Stop Hooks in your Claude configuration file and generates executable shell scripts in the XDG data directory:\n\n```json\n{\n  \"hooks\": {\n    \"Stop\": [\n      {\n        \"matcher\": \"discord-notification\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"/home/user/.local/share/ccnotify/discord-notification.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Dynamic Configuration\n\nAll generated scripts support dynamic configuration through command arguments:\n\n#### Discord\n```bash\n# Use default webhook URL embedded in script\n/path/to/discord-notification.sh\n\n# Override webhook URL dynamically\n/path/to/discord-notification.sh \"https://discord.com/api/webhooks/123/abc\"\n\n# In Claude settings.json\n\"command\": \"/path/to/discord-notification.sh https://discord.com/api/webhooks/123/abc\"\n```\n\n#### ntfy\n```bash\n# Use default topic embedded in script\n/path/to/ntfy-notification.sh\n\n# Override topic dynamically\n/path/to/ntfy-notification.sh \"my-custom-topic\"\n\n# Also supports NTFY_TOPIC environment variable\nNTFY_TOPIC=\"my-topic\" /path/to/ntfy-notification.sh\n```\n\n#### macOS\n```bash\n# Use default title embedded in script\n/path/to/macos-notification.sh\n\n# Override title dynamically\n/path/to/macos-notification.sh \"Custom Title\"\n\n# In Claude settings.json\n\"command\": \"/path/to/macos-notification.sh \\\"My Custom Title\\\"\"\n```\n\n#### XDG Base Directory Support\n\nccnotify follows the XDG Base Directory Specification for configuration and data storage:\n\n- **Executable scripts**: `$XDG_DATA_HOME/ccnotify/` (default: `~/.local/share/ccnotify/`)\n- **Notification logs**: `$XDG_DATA_HOME/ccnotify/` (default: `~/.local/share/ccnotify/`)\n\nYou can customize these locations using environment variables:\n- `XDG_CONFIG_HOME`: Custom configuration directory\n- `XDG_DATA_HOME`: Custom data directory\n\n### ⚠️ Important: Git Security\n\n**It is strongly recommended to add `.claude/settings.local.json` to your `.gitignore` file** to prevent accidentally committing sensitive information such as:\n- Discord webhook URLs containing tokens\n- Personal notification preferences\n- Other potentially sensitive configuration data\n\nAdd this line to your `.gitignore`:\n```gitignore\n# Claude Code local settings (may contain sensitive data)\n.claude/settings.local.json\n```\n\n## Notification Types\n\n### Discord\n\n- Sends rich embed notifications with:\n  - Operation completion title\n  - User message as description\n  - Assistant response as a field\n  - Timestamp\n  - Color coding\n\n### ntfy\n\n- Sends push notifications with:\n  - User message as title\n  - Assistant response as body (truncated to 500 chars)\n  - Supports custom topic names\n\n### macOS\n\n- Displays native macOS notifications with:\n  - Custom or default title\n  - User message as subtitle\n  - Assistant response as body\n  - System sound (Pop.aiff)\n\n## Requirements\n\n- Node.js 20.0.0 or higher\n- Claude Code installed and configured\n- For Discord: Valid Discord webhook URL\n- For ntfy: Valid topic name (alphanumeric, hyphens, underscores)\n- For macOS: macOS system with notification permissions\n\n## Examples\n\n### Complete Workflow\n\n```bash\n# Set up Discord notifications for current project\nccnotify discord https://discord.com/api/webhooks/123456789/your-token\n\n# Add ntfy notifications as well\nccnotify ntfy my-project-notifications\n\n# Add macOS notifications with custom title\nccnotify macos \"Project Notifications\"\n\n# Set up global notifications for all projects\nccnotify discord https://discord.com/api/webhooks/987654321/global-token --global\n```\n\n### Webhook URL Format\n\nDiscord webhook URLs should follow this format:\n```\nhttps://discord.com/api/webhooks/{webhook_id}/{webhook_token}\n```\n\n### ntfy Topic Names\n\nTopic names should be:\n- Alphanumeric characters\n- Hyphens and underscores allowed\n- No spaces or special characters\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Permission Denied**: Ensure you have write permissions to the target directory\n2. **Invalid Webhook URL**: Verify your Discord webhook URL is correct\n3. **Invalid Topic Name**: Use only alphanumeric characters, hyphens, and underscores\n4. **JSON Parse Error**: Existing configuration file may be corrupted (backup will be created)\n\n### Error Messages\n\nThe tool provides clear error messages for common issues:\n- Invalid webhook URLs\n- Invalid topic names\n- File permission errors\n- JSON parsing errors\n\n### Backup and Recovery\n\nThe tool automatically creates backups of existing configuration files before making changes. Backups are stored with timestamps:\n- `.claude/settings.local.json.backup.YYYY-MM-DDTHH-MM-SS-sssZ` (for local configurations)\n- `~/.claude/settings.json.backup.YYYY-MM-DDTHH-MM-SS-sssZ` (for global configurations)\n\n### Notification Logging\n\nWhen notifications don't work as expected, use the built-in logging system to diagnose issues:\n\n```bash\n# View recent notification logs\nccnotify logs\n\n# Show only failed notifications\nccnotify logs --failed\n\n# View statistics\nccnotify logs --stats\n\n# Export logs for analysis\nccnotify logs --export logs.json\n\n# Filter by notification type\nccnotify logs --type discord\nccnotify logs --type ntfy\nccnotify logs --type macos\n```\n\nLogs are automatically saved to `$XDG_DATA_HOME/ccnotify/notifications.log` (default: `~/.local/share/ccnotify/notifications.log`) and include:\n- Execution timestamps\n- Success/failure status\n- HTTP response codes\n- Execution times\n- Error messages\n- Configuration details (with sensitive data masked)\n\n#### Script Management\n\nThe generated shell scripts are stored in `$XDG_DATA_HOME/ccnotify/` and are automatically made executable. These scripts handle:\n- Transcript parsing and message extraction\n- Notification formatting and sending\n- Error handling and logging\n- Cross-platform compatibility\n\n## Development\n\n### Building from Source\n\n```bash\ngit clone https://github.com/foxytanuki/ccnotify.git\ncd ccnotify\npnpm install\npnpm run build\n```\n\n### Running Tests\n\n```bash\npnpm test\npnpm run test:coverage\n```\n\n### Development Mode\n\n```bash\npnpm run dev -- discord https://example.com/webhook\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Run the test suite\n6. Submit a pull request\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Support\n\nFor issues and questions:\n- GitHub Issues: https://github.com/foxytanuki/ccnotify/issues\n- Documentation: https://github.com/foxytanuki/ccnotify/wiki\n\n## Changelog\n\n### v0.1.1\n- Fix CI\n\n### v0.1.0\n- Add notification logging system with `logs` and `config` commands\n- Add XDG Base Directory support for script and log storage\n- Improve message handling with proper JSON encoding\n- Add comprehensive test coverage\n- Update Node.js requirement to v20.0.0+\n\n### v0.0.3\n- Update docs\n\n### v0.0.1 \u0026 v0.0.2\n- Initial release\n- Discord webhook notifications\n- ntfy push notifications\n- macOS native notifications\n- Global and local configuration support\n- Comprehensive error handling and validation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxytanuki%2Fccnotify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxytanuki%2Fccnotify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxytanuki%2Fccnotify/lists"}