feat: Add native OS notifications for Claude Code CLI completion#105
Conversation
Implement a notification system that alerts users when Claude Code CLI completes tasks or asks questions while the app is in the background. Key features: - Native OS notifications (macOS, Windows, Linux supported) - Session-based state tracking in main process (avoids React lifecycle issues) - State detection from terminal output (completion/question patterns) - System notification permission checking (macOS ncprefs.plist integration) - Separated APIs: notification:* (general) and claude-notification:* (Claude-specific) New components: - NotificationManager: Core notification logic and session tracking - NotificationSettingsTab: Settings UI with permission status - GlobalSettings: General app settings dialog with tabs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for notification-settings.ts: - Settings persistence and loading - Default settings initialization - Settings update and save - Reset to defaults - Corrupted file handling - Single initialization enforcement Expand notification-manager.test.ts: - ANSI stripping (escape codes, OSC sequences) - Completion patterns (send, ↵ send, case insensitivity) - Question patterns ([Y/n], [y/N], yes/no, Tab/Arrow navigation) - Permission status checking - Test notification functionality - Multiple session independence - Edge cases (non-existent sessions) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive tests for the notification settings UI: - Rendering with different visibility states - Permission status display (authorized, blocked, not supported, unknown) - Enable/disable toggle functionality - Test notification button behavior - Refresh permission status button - Open system settings button - Error handling for API failures - Toast notifications for user feedback Update test setup with notification API mocks for both general notification APIs and Claude-specific notification APIs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add listener in ProjectContext to handle claude-notification:clicked event: - Find the project containing the clicked worktree path - Switch to that project tab - Select the correct worktree Add comprehensive tests for ProjectContext: - Notification click handler tests (switch project, select worktree) - Basic project operations tests (add, remove, switch, update worktrees) Update test setup with additional mocks: - recentProjects API - shell.terminateForWorktree API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Hi @sahithvibudhi , hope you're doing well! I wanted to follow up on this PR which adds native OS notifications for Claude Code CLI completion. It's been open for about a week now, and I wanted to check if you've had a chance to review it. If there are any concerns, changes needed, or if this feature doesn't align with the project's direction, I'd appreciate any feedback. I'm happy to iterate on it based on your input. Thanks for your time! |
|
@phamvmnhut can you explain this PR with screenshots/video? |
|
I can see if I can merge it if @sahithvibudhi is not around, given the benefit is explained clearly |
|
@phuongnd08 , Here's a brief explanation of this feature: When Claude Code CLI completes tasks or asks questions, it should show a notification in the macOS notification center to help you easily keep track of all running Claude Code instances regardless of which tab or tree you're in, with a toggle button to enable or disable this notification feature for each task. |

Summary
notification:*(general) andclaude-notification:*(Claude-specific)Key Features
New Components
NotificationManagerNotificationSettingsTabGlobalSettingsAPI Design
notification:*- General notification APIs (settings, permissions, test)claude-notification:*- Claude-specific APIs (session enable/disable, user input tracking)Files Changed (22 files, +2847 lines)
notification-manager.ts,notification-settings.ts,GlobalSettings.tsx,NotificationSettingsTab.tsxipc-handlers.ts,preload/index.ts,ClaudeTerminal.tsx,shell-manager.ts,ProjectContext.tsxnotification-manager.test.ts,notification-settings.test.ts,NotificationSettingsTab.test.tsx,ProjectContext.test.tsxTest plan
🤖 Generated with Claude Code