claude-notification-plugin 1.0.28 → 1.0.33

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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "claude-notification-plugin",
3
+ "version": "1.0.33",
4
+ "description": "Telegram, Windows toast, sound, and voice notifications for Claude Code task completion",
5
+ "author": {
6
+ "name": "Viacheslav Makarov",
7
+ "email": "npmjs@bazilio.ru"
8
+ },
9
+ "homepage": "https://github.com/Bazilio-san/claude-notification-plugin#readme",
10
+ "repository": "https://github.com/Bazilio-san/claude-notification-plugin",
11
+ "license": "MIT",
12
+ "keywords": ["notification", "telegram", "windows", "sound", "voice", "hooks"],
13
+ "hooks": "./hooks/hooks.json",
14
+ "commands": "./commands/"
15
+ }
package/README.md CHANGED
@@ -5,25 +5,51 @@ Notifications for Claude Code task completion. Sends alerts to Telegram and Wind
5
5
  ## Features
6
6
 
7
7
  - Windows desktop notifications (toast)
8
- - Telegram bot messages
9
- - Sound alert
10
- - Voice announcement (TTS)
8
+ - Telegram bot messages with auto-delete
9
+ - Sound alert (hidden PowerShell, no popup windows)
10
+ - Voice announcement with number-to-words and pluralization (EN, RU)
11
11
  - Separate notifications for task completion and waiting-for-input events
12
12
  - Skips short tasks (< 15s by default)
13
13
  - Granular per-channel enable/disable (globally and per-project)
14
+ - Debug mode with full hook event dump
14
15
 
15
16
  ## Install
16
17
 
18
+ ### Option A: Claude Code Plugin (recommended)
19
+
20
+ Add the marketplace and install:
21
+
22
+ ```shell
23
+ /plugin marketplace add Bazilio-san/claude-plugins
24
+ /plugin install claude-notification-plugin@bazilio-plugins
25
+ ```
26
+
27
+ Or load directly for testing:
28
+
29
+ ```bash
30
+ claude --plugin-dir /path/to/claude-notification-plugin
31
+ ```
32
+
33
+ Hooks are registered automatically. To configure Telegram credentials, run:
34
+
35
+ ```shell
36
+ /claude-notification-plugin:setup
37
+ ```
38
+
39
+ ### Option B: npm global package
40
+
17
41
  ```bash
18
42
  npm install -g claude-notification-plugin
19
43
  claude-notify-install
20
44
  ```
21
45
 
22
46
  The installer will:
23
- 1. Ask for Telegram bot credentials (optional)
24
- 2. Create config at `~/.claude/notifier.config.json`
47
+ 1. Ask for Telegram bot credentials (or keep existing ones on re-run)
48
+ 2. Create/update config at `~/.claude/notifier.config.json`
25
49
  3. Register hooks in `~/.claude/settings.json`
26
50
 
51
+ Re-running `claude-notify-install` after an update merges new config options without overwriting your existing settings.
52
+
27
53
  ## Configuration
28
54
 
29
55
  Config file: `~/.claude/notifier.config.json`
@@ -58,7 +84,7 @@ Each channel has an `enabled` flag (`true`/`false`) for global control.
58
84
 
59
85
  `notifyOnWaiting` — send notifications when Claude is waiting for user input, e.g. permission prompts (default: `false`, set `true` to enable).
60
86
 
61
- `debug` — include extra info in notifications for troubleshooting: voice phrase text when voice is enabled (default: `false`).
87
+ `debug` — include extra info in notifications: voice phrase text, full hook event JSON (formatted as code block in Telegram). Default: `false`.
62
88
 
63
89
  Environment variables `TELEGRAM_TOKEN` and `TELEGRAM_CHAT_ID` override config file values.
64
90
 
@@ -103,6 +129,28 @@ To disable all notifications for a project:
103
129
  }
104
130
  ```
105
131
 
132
+ ## Notification format
133
+
134
+ Notifications include project name, duration, and the trigger event:
135
+
136
+ ```
137
+ 🤖 Claude finished coding
138
+
139
+ Project: my-project
140
+ Duration: 45s
141
+ Trigger: Stop
142
+ ```
143
+
144
+ When Claude is waiting for input (and `notifyOnWaiting` is enabled):
145
+
146
+ ```
147
+ 🤖 Claude waiting for input
148
+
149
+ Project: my-project
150
+ Duration: 30s
151
+ Trigger: Notification
152
+ ```
153
+
106
154
  ## Telegram Setup
107
155
 
108
156
  1. Open Telegram, find **@BotFather**
@@ -117,6 +165,12 @@ Alternative for Chat ID: add **@userinfobot** to a chat and it will reply with t
117
165
 
118
166
  ## Uninstall
119
167
 
168
+ ### Plugin install
169
+
170
+ Uninstall via the plugin manager or remove `--plugin-dir` flag.
171
+
172
+ ### npm install
173
+
120
174
  ```bash
121
175
  claude-notify-uninstall
122
176
  npm uninstall -g claude-notification-plugin
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Configure Telegram credentials and notification settings
3
+ ---
4
+
5
+ # Setup claude-notification-plugin
6
+
7
+ Help the user configure the notification plugin. The config file is `~/.claude/notifier.config.json`.
8
+
9
+ ## Steps
10
+
11
+ 1. **Read existing config** (if it exists) from `~/.claude/notifier.config.json` to preserve current settings.
12
+
13
+ 2. **Ask for Telegram bot token**. If a token already exists in the config, show a masked version (first 6 and last 4 characters) and ask if the user wants to keep it. If they want a new one, ask them to provide it.
14
+
15
+ 3. **Get the Chat ID**. If the token is available and Chat ID is missing:
16
+ - Ask the user to send any message to their bot in Telegram.
17
+ - Fetch `https://api.telegram.org/bot<TOKEN>/getUpdates` to auto-detect the Chat ID.
18
+ - If auto-detection fails, ask the user to enter the Chat ID manually.
19
+ - If Chat ID already exists, show it and ask if the user wants to keep it.
20
+
21
+ 4. **Write the config** to `~/.claude/notifier.config.json`. Merge with existing config — do NOT overwrite settings that already exist (`minSeconds`, `notifyOnWaiting`, `debug`, channel `enabled` flags, etc.). Only update `telegram.token` and `telegram.chatId` with the values from this session.
22
+
23
+ Default config structure (for new installs):
24
+ ```json
25
+ {
26
+ "telegram": {
27
+ "enabled": true,
28
+ "token": "<TOKEN>",
29
+ "chatId": "<CHAT_ID>",
30
+ "deleteAfterHours": 24
31
+ },
32
+ "windowsNotification": { "enabled": true },
33
+ "sound": { "enabled": true, "file": "C:/Windows/Media/notify.wav" },
34
+ "voice": { "enabled": true },
35
+ "minSeconds": 15,
36
+ "notifyOnWaiting": false,
37
+ "debug": false
38
+ }
39
+ ```
40
+
41
+ 5. **Confirm** — show the user a summary of what was saved.
42
+
43
+ ## Important
44
+
45
+ - NEVER log or display the full token. Always mask it.
46
+ - Preserve all existing config values when writing — only update token and chatId.
@@ -0,0 +1,34 @@
1
+ {
2
+ "hooks": {
3
+ "UserPromptSubmit": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/notifier/notifier.js"
9
+ }
10
+ ]
11
+ }
12
+ ],
13
+ "Stop": [
14
+ {
15
+ "hooks": [
16
+ {
17
+ "type": "command",
18
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/notifier/notifier.js"
19
+ }
20
+ ]
21
+ }
22
+ ],
23
+ "Notification": [
24
+ {
25
+ "hooks": [
26
+ {
27
+ "type": "command",
28
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/notifier/notifier.js"
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ }
34
+ }
@@ -145,13 +145,17 @@ async function sendTelegram (config, state) {
145
145
 
146
146
  // Send new message and store its id
147
147
  try {
148
+ const body = {
149
+ chat_id: config.telegram.chatId,
150
+ text: state._telegramText,
151
+ };
152
+ if (config.debug) {
153
+ body.parse_mode = 'Markdown';
154
+ }
148
155
  const res = await fetch(`${baseUrl}/sendMessage`, {
149
156
  method: 'POST',
150
157
  headers: { 'Content-Type': 'application/json' },
151
- body: JSON.stringify({
152
- chat_id: config.telegram.chatId,
153
- text: state._telegramText,
154
- }),
158
+ body: JSON.stringify(body),
155
159
  });
156
160
  const data = await res.json();
157
161
  if (data.ok && data.result?.message_id) {
@@ -449,8 +453,12 @@ process.stdin.on('end', async () => {
449
453
  let message =
450
454
  `${title}\n\nProject: ${project}\nDuration: ${duration}s\nTrigger: ${eventType}`;
451
455
 
452
- if (config.debug && config.voice.enabled) {
453
- message += `\nVoice: ${getVoicePhrase(duration)}`;
456
+ if (config.debug) {
457
+ message += '\n\n*Debug:*\n';
458
+ if (config.voice.enabled) {
459
+ message += `\nVoice: ${getVoicePhrase(duration)}`;
460
+ }
461
+ message += `\n\nHook input:\n\`\`\`json\n${JSON.stringify(event, null, 2)}\n\`\`\``;
454
462
  }
455
463
 
456
464
  state._telegramText = `\u{1F916} ${message}`;
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "claude-notification-plugin",
3
3
  "productName": "claude-notification-plugin",
4
- "version": "1.0.28",
5
- "description": "Telegram and Windows notifications for Claude Code task completion",
4
+ "version": "1.0.33",
5
+ "description": "Telegram, Windows toast, sound, and voice notifications for Claude Code task completion",
6
6
  "type": "module",
7
7
  "engines": {
8
8
  "node": ">=18.0.0"
9
9
  },
10
10
  "files": [
11
+ ".claude-plugin/",
11
12
  "bin/",
13
+ "commands/",
14
+ "hooks/",
12
15
  "notifier/",
13
16
  "README.md",
14
17
  "LICENSE"