( channel: string, opts: NotificationOptions, terminal: TerminalNotification, )
| 38 | const DEFAULT_TITLE = 'Claude Code' |
| 39 | |
| 40 | async function sendToChannel( |
| 41 | channel: string, |
| 42 | opts: NotificationOptions, |
| 43 | terminal: TerminalNotification, |
| 44 | ): Promise<string> { |
| 45 | const title = opts.title || DEFAULT_TITLE |
| 46 | |
| 47 | try { |
| 48 | switch (channel) { |
| 49 | case 'auto': |
| 50 | return sendAuto(opts, terminal) |
| 51 | case 'iterm2': |
| 52 | terminal.notifyITerm2(opts) |
| 53 | return 'iterm2' |
| 54 | case 'iterm2_with_bell': |
| 55 | terminal.notifyITerm2(opts) |
| 56 | terminal.notifyBell() |
| 57 | return 'iterm2_with_bell' |
| 58 | case 'kitty': |
| 59 | terminal.notifyKitty({ ...opts, title, id: generateKittyId() }) |
| 60 | return 'kitty' |
| 61 | case 'ghostty': |
| 62 | terminal.notifyGhostty({ ...opts, title }) |
| 63 | return 'ghostty' |
| 64 | case 'terminal_bell': |
| 65 | terminal.notifyBell() |
| 66 | return 'terminal_bell' |
| 67 | case 'notifications_disabled': |
| 68 | return 'disabled' |
| 69 | default: |
| 70 | return 'none' |
| 71 | } |
| 72 | } catch { |
| 73 | return 'error' |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | async function sendAuto( |
| 78 | opts: NotificationOptions, |
no test coverage detected