claude-notification-plugin 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -5
- package/bin/install.js +2 -1
- package/notifier/notifier.js +25 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@ Notifications for Claude Code task completion. Sends alerts to Telegram and Wind
|
|
|
7
7
|
- Windows desktop notifications (toast)
|
|
8
8
|
- Telegram bot messages
|
|
9
9
|
- Sound alert
|
|
10
|
-
- Voice announcement
|
|
10
|
+
- Voice announcement (TTS)
|
|
11
11
|
- Skips short tasks (< 15s by default)
|
|
12
|
-
-
|
|
12
|
+
- Granular per-channel enable/disable (globally and per-project)
|
|
13
13
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
@@ -30,9 +30,13 @@ Config file: `~/.claude/notifier.config.json`
|
|
|
30
30
|
```json
|
|
31
31
|
{
|
|
32
32
|
"telegram": {
|
|
33
|
+
"enabled": true,
|
|
33
34
|
"token": "YOUR_BOT_TOKEN",
|
|
34
35
|
"chatId": "YOUR_CHAT_ID"
|
|
35
36
|
},
|
|
37
|
+
"windowsNotification": {
|
|
38
|
+
"enabled": true
|
|
39
|
+
},
|
|
36
40
|
"sound": {
|
|
37
41
|
"enabled": true,
|
|
38
42
|
"file": "C:/Windows/Media/notify.wav"
|
|
@@ -44,11 +48,38 @@ Config file: `~/.claude/notifier.config.json`
|
|
|
44
48
|
}
|
|
45
49
|
```
|
|
46
50
|
|
|
51
|
+
Each channel has an `enabled` flag (`true`/`false`) for global control.
|
|
52
|
+
|
|
47
53
|
Environment variables `TELEGRAM_TOKEN` and `TELEGRAM_CHAT_ID` override config file values.
|
|
48
54
|
|
|
49
|
-
###
|
|
55
|
+
### Per-channel environment variables
|
|
56
|
+
|
|
57
|
+
These env vars override the global config per channel (`"1"` = on, `"0"` = off):
|
|
58
|
+
|
|
59
|
+
| Variable | Channel |
|
|
60
|
+
|--------------------------|----------------------------|
|
|
61
|
+
| `CLAUDE_NOTIFY_TELEGRAM` | Telegram messages |
|
|
62
|
+
| `CLAUDE_NOTIFY_WINDOWS` | Windows toast notifications|
|
|
63
|
+
| `CLAUDE_NOTIFY_SOUND` | Sound alert |
|
|
64
|
+
| `CLAUDE_NOTIFY_VOICE` | Voice announcement (TTS) |
|
|
65
|
+
|
|
66
|
+
### Per-project configuration
|
|
67
|
+
|
|
68
|
+
Add to `.claude/settings.local.json` in the project root to control channels per project:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"env": {
|
|
73
|
+
"DISABLE_CLAUDE_NOTIFIER": 0,
|
|
74
|
+
"CLAUDE_NOTIFY_TELEGRAM": 1,
|
|
75
|
+
"CLAUDE_NOTIFY_WINDOWS": 1,
|
|
76
|
+
"CLAUDE_NOTIFY_SOUND": 1,
|
|
77
|
+
"CLAUDE_NOTIFY_VOICE": 1
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
50
81
|
|
|
51
|
-
|
|
82
|
+
To disable all notifications for a project:
|
|
52
83
|
|
|
53
84
|
```json
|
|
54
85
|
{
|
|
@@ -63,7 +94,7 @@ Add to `.claude/settings.local.json` in the project root:
|
|
|
63
94
|
1. Open Telegram, find **@BotFather**
|
|
64
95
|
2. Send `/newbot`, follow prompts, pick a name
|
|
65
96
|
3. Copy the bot token (format: `123456789:ABCdef...`)
|
|
66
|
-
4. Send any message to your new bot
|
|
97
|
+
4. **Send any message to your new bot**
|
|
67
98
|
5. Open `https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates`
|
|
68
99
|
6. Find `"chat":{"id":123456789}` in the response — that's your Chat ID
|
|
69
100
|
7. Run `claude-notify-install` and enter the token and chat ID
|
package/bin/install.js
CHANGED
|
@@ -112,7 +112,8 @@ async function main () {
|
|
|
112
112
|
fs.mkdirSync(claudeDir, { recursive: true });
|
|
113
113
|
|
|
114
114
|
const config = {
|
|
115
|
-
telegram: { token, chatId },
|
|
115
|
+
telegram: { enabled: true, token, chatId },
|
|
116
|
+
windowsNotification: { enabled: true },
|
|
116
117
|
sound: { enabled: true, file: 'C:/Windows/Media/notify.wav' },
|
|
117
118
|
voice: { enabled: true },
|
|
118
119
|
minSeconds: 15,
|
package/notifier/notifier.js
CHANGED
|
@@ -18,7 +18,8 @@ function loadConfig () {
|
|
|
18
18
|
const configPath = path.join(os.homedir(), '.claude', 'notifier.config.json');
|
|
19
19
|
|
|
20
20
|
const config = {
|
|
21
|
-
telegram: { token: '', chatId: '' },
|
|
21
|
+
telegram: { enabled: true, token: '', chatId: '' },
|
|
22
|
+
windowsNotification: { enabled: true },
|
|
22
23
|
sound: { enabled: true, file: 'C:/Windows/Media/notify.wav' },
|
|
23
24
|
voice: { enabled: true },
|
|
24
25
|
minSeconds: 15,
|
|
@@ -31,6 +32,9 @@ function loadConfig () {
|
|
|
31
32
|
if (user.telegram) {
|
|
32
33
|
config.telegram = { ...config.telegram, ...user.telegram };
|
|
33
34
|
}
|
|
35
|
+
if (user.windowsNotification) {
|
|
36
|
+
config.windowsNotification = { ...config.windowsNotification, ...user.windowsNotification };
|
|
37
|
+
}
|
|
34
38
|
if (user.sound) {
|
|
35
39
|
config.sound = { ...config.sound, ...user.sound };
|
|
36
40
|
}
|
|
@@ -52,6 +56,20 @@ function loadConfig () {
|
|
|
52
56
|
config.telegram.chatId = process.env.TELEGRAM_CHAT_ID;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
// Per-channel env overrides (0 = off, 1 = on)
|
|
60
|
+
if (process.env.CLAUDE_NOTIFY_TELEGRAM !== undefined) {
|
|
61
|
+
config.telegram.enabled = process.env.CLAUDE_NOTIFY_TELEGRAM === '1';
|
|
62
|
+
}
|
|
63
|
+
if (process.env.CLAUDE_NOTIFY_WINDOWS !== undefined) {
|
|
64
|
+
config.windowsNotification.enabled = process.env.CLAUDE_NOTIFY_WINDOWS === '1';
|
|
65
|
+
}
|
|
66
|
+
if (process.env.CLAUDE_NOTIFY_SOUND !== undefined) {
|
|
67
|
+
config.sound.enabled = process.env.CLAUDE_NOTIFY_SOUND === '1';
|
|
68
|
+
}
|
|
69
|
+
if (process.env.CLAUDE_NOTIFY_VOICE !== undefined) {
|
|
70
|
+
config.voice.enabled = process.env.CLAUDE_NOTIFY_VOICE === '1';
|
|
71
|
+
}
|
|
72
|
+
|
|
55
73
|
return config;
|
|
56
74
|
}
|
|
57
75
|
|
|
@@ -96,7 +114,7 @@ function saveState (state) {
|
|
|
96
114
|
// ----------------------
|
|
97
115
|
|
|
98
116
|
async function sendTelegram (config, text) {
|
|
99
|
-
if (!config.telegram.token || !config.telegram.chatId) {
|
|
117
|
+
if (!config.telegram.enabled || !config.telegram.token || !config.telegram.chatId) {
|
|
100
118
|
return;
|
|
101
119
|
}
|
|
102
120
|
|
|
@@ -121,7 +139,10 @@ async function sendTelegram (config, text) {
|
|
|
121
139
|
// WINDOWS NOTIFICATION
|
|
122
140
|
// ----------------------
|
|
123
141
|
|
|
124
|
-
function sendWindowsNotification (message) {
|
|
142
|
+
function sendWindowsNotification (config, message) {
|
|
143
|
+
if (!config.windowsNotification.enabled) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
125
146
|
notifier.notify({
|
|
126
147
|
title: 'Claude Code',
|
|
127
148
|
message,
|
|
@@ -225,7 +246,7 @@ process.stdin.on('end', async () => {
|
|
|
225
246
|
`Claude finished coding\n\nProject: ${project}\nDuration: ${duration}s\nStatus: ${status}`;
|
|
226
247
|
|
|
227
248
|
await sendTelegram(config, `\u{1F916} ${message}`);
|
|
228
|
-
sendWindowsNotification(message);
|
|
249
|
+
sendWindowsNotification(config, message);
|
|
229
250
|
playSound(config);
|
|
230
251
|
speakResult(config, duration);
|
|
231
252
|
});
|
package/package.json
CHANGED