claude-notification-plugin 1.1.6 → 1.1.9

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/bin/install.js CHANGED
@@ -423,6 +423,9 @@ async function main () {
423
423
 
424
424
  // 0. Stop listener if running (before overwriting files)
425
425
  const listenerWasStopped = stopListenerIfRunning();
426
+ if (listenerWasStopped) {
427
+ console.log(' Listener daemon stopped');
428
+ }
426
429
 
427
430
  // 1. Register plugin in Claude Code
428
431
  const version = getVersion();
@@ -578,6 +581,7 @@ Send any message to your bot in Telegram, then press Enter.\x1b[0m`);
578
581
  }
579
582
 
580
583
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
584
+ console.log(` Config saved: ${configPath}`);
581
585
 
582
586
  // 4. Register hooks
583
587
  let settings = {};
@@ -593,6 +597,7 @@ Send any message to your bot in Telegram, then press Enter.\x1b[0m`);
593
597
  // Register plugin as enabled
594
598
  settings.enabledPlugins = settings.enabledPlugins || {};
595
599
  settings.enabledPlugins[PLUGIN_KEY] = true;
600
+ console.log(' Registered plugin in enabledPlugins');
596
601
 
597
602
  // When the plugin is enabled, Claude Code loads hooks from hooks/hooks.json automatically.
598
603
  // Remove any duplicate hooks from settings.json to avoid double notifications.
@@ -600,6 +605,7 @@ Send any message to your bot in Telegram, then press Enter.\x1b[0m`);
600
605
  removeHook(settings, 'UserPromptSubmit');
601
606
  removeHook(settings, 'Stop');
602
607
  removeHook(settings, 'Notification');
608
+ console.log(' Cleaned duplicate hooks from settings.json');
603
609
 
604
610
  // Register marketplace
605
611
  settings.extraKnownMarketplaces = settings.extraKnownMarketplaces || {};
@@ -609,8 +615,10 @@ Send any message to your bot in Telegram, then press Enter.\x1b[0m`);
609
615
  repo: MARKETPLACE_GITHUB,
610
616
  },
611
617
  };
618
+ console.log(' Registered marketplace in extraKnownMarketplaces');
612
619
 
613
620
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
621
+ console.log(` Settings saved: ${settingsPath}`);
614
622
 
615
623
  // 5. Summary
616
624
  const telegramStatus = config.telegram.token && config.telegram.chatId
@@ -626,11 +634,9 @@ Send any message to your bot in Telegram, then press Enter.\x1b[0m`);
626
634
  sudo apt install espeak`;
627
635
  }
628
636
 
629
- const listenerLine = listenerWasStopped ? '\nListener was stopped (restart manually if needed).' : '';
630
-
631
637
  console.log(`
632
638
  Installed!
633
- ${listenerLine}
639
+
634
640
  Plugin hooks (via hooks/hooks.json):
635
641
  - UserPromptSubmit (start timer)
636
642
  - Stop (task finished)
package/bin/uninstall.js CHANGED
@@ -176,12 +176,12 @@ function stopListenerIfRunning () {
176
176
  return stopped;
177
177
  }
178
178
 
179
+ console.log('\nUninstalling Claude Notification Plugin...\n');
180
+
179
181
  // Stop listener daemon if running
180
- const listenerStopped = stopListenerIfRunning();
182
+ stopListenerIfRunning();
181
183
 
182
184
  // Remove hooks from settings.json
183
- let hooksRemoved = false;
184
- let hooksRemoveError = '';
185
185
  if (fs.existsSync(settingsPath)) {
186
186
  try {
187
187
  const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
@@ -215,6 +215,7 @@ if (fs.existsSync(settingsPath)) {
215
215
  if (Object.keys(settings.enabledPlugins).length === 0) {
216
216
  delete settings.enabledPlugins;
217
217
  }
218
+ console.log('Removed plugin from enabledPlugins in settings.json');
218
219
  }
219
220
 
220
221
  // Remove marketplace from extraKnownMarketplaces
@@ -223,6 +224,7 @@ if (fs.existsSync(settingsPath)) {
223
224
  if (Object.keys(settings.extraKnownMarketplaces).length === 0) {
224
225
  delete settings.extraKnownMarketplaces;
225
226
  }
227
+ console.log('Removed marketplace from extraKnownMarketplaces in settings.json');
226
228
  }
227
229
 
228
230
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
@@ -235,12 +237,13 @@ if (fs.existsSync(settingsPath)) {
235
237
  matchers.some((m) => m.hooks?.some((h) => isPluginHookCommand(h.command))),
236
238
  )
237
239
  : false;
238
- hooksRemoved = hadPluginHooks && !remainingPluginHooks;
239
- if (hadPluginHooks && remainingPluginHooks) {
240
- hooksRemoveError = 'Hooks still present in settings.json after removal attempt';
240
+ if (hadPluginHooks && !remainingPluginHooks) {
241
+ console.log('Removed hooks from settings.json');
242
+ } else if (hadPluginHooks && remainingPluginHooks) {
243
+ console.warn('Warning: hooks still present in settings.json after removal attempt');
241
244
  }
242
245
  } catch (err) {
243
- hooksRemoveError = `Failed to update settings.json: ${err.message}`;
246
+ console.error(`Error: failed to update settings.json: ${err.message}`);
244
247
  }
245
248
  }
246
249
 
@@ -250,12 +253,12 @@ const listenerLogFile = path.join(claudeDir, '.cc-n-listener.log');
250
253
  for (const file of [configPath, statePath, resolverPath, pidFile, listenerLogFile]) {
251
254
  if (fs.existsSync(file)) {
252
255
  fs.unlinkSync(file);
256
+ console.log(`Removed ${path.basename(file)}`);
253
257
  }
254
258
  }
255
259
 
256
260
  // Remove CLI wrapper script
257
261
  const WRAPPER_NAMES = ['claude-notify'];
258
- let cliBinsRemoved = false;
259
262
  const ext = process.platform === 'win32' ? '.cmd' : '';
260
263
 
261
264
  // Collect directories to check for wrapper scripts
@@ -278,21 +281,20 @@ for (const dir of wrapperDirs) {
278
281
  const filePath = path.join(dir, `${name}${ext}`);
279
282
  if (fs.existsSync(filePath)) {
280
283
  fs.unlinkSync(filePath);
281
- cliBinsRemoved = true;
284
+ console.log(`Removed CLI wrapper: ${filePath}`);
282
285
  }
283
286
  }
284
287
  }
285
288
 
286
289
  // Remove from installed_plugins.json
287
290
  const installedPluginsPath = path.join(claudeDir, 'plugins', 'installed_plugins.json');
288
- let pluginEntryRemoved = false;
289
291
  if (fs.existsSync(installedPluginsPath)) {
290
292
  try {
291
293
  const data = JSON.parse(fs.readFileSync(installedPluginsPath, 'utf-8'));
292
294
  if (data.plugins?.[PLUGIN_KEY]) {
293
295
  delete data.plugins[PLUGIN_KEY];
294
296
  fs.writeFileSync(installedPluginsPath, JSON.stringify(data, null, 2));
295
- pluginEntryRemoved = true;
297
+ console.log('Removed plugin from installed_plugins.json');
296
298
  }
297
299
  } catch {
298
300
  // ignore
@@ -333,40 +335,16 @@ try {
333
335
 
334
336
  // Remove plugin cache
335
337
  const pluginCacheDir = path.join(claudeDir, 'plugins', 'cache', 'bazilio-plugins', 'claude-notification-plugin');
336
- let cacheRemoved = false;
337
338
  if (fs.existsSync(pluginCacheDir)) {
338
339
  fs.rmSync(pluginCacheDir, { recursive: true, force: true });
339
- cacheRemoved = !fs.existsSync(pluginCacheDir);
340
+ if (fs.existsSync(pluginCacheDir)) {
341
+ console.warn(`Warning: could not fully remove plugin cache directory:\n ${pluginCacheDir}\nPlease remove it manually.`);
342
+ } else {
343
+ console.log('Removed plugin cache');
344
+ }
340
345
  }
341
346
 
342
- const hooksStatus = hooksRemoved
343
- ? 'Hooks removed from settings.json'
344
- : hooksRemoveError
345
- ? `Warning: ${hooksRemoveError}`
346
- : 'No hooks found in settings.json';
347
-
348
- const extras = [
349
- listenerStopped ? 'Listener daemon stopped.' : '',
350
- pluginEntryRemoved || cacheRemoved ? 'Plugin registration cleaned.' : '',
351
- cliBinsRemoved ? 'CLI wrapper scripts removed.' : '',
352
- ].filter(Boolean).join('\n');
353
-
354
- const cacheStillExists = fs.existsSync(pluginCacheDir);
355
- if (cacheStillExists) {
356
- console.log(`
357
- Warning: Could not fully remove plugin cache directory:
358
- ${pluginCacheDir}
359
- Please remove it manually.
360
- ${hooksStatus}
361
- Config files deleted.${extras ? `\n${extras}` : ''}
362
- `);
363
- } else {
364
- console.log(`
365
- Claude Notification Plugin uninstalled.
366
- ${hooksStatus}
367
- Config files deleted.${extras ? `\n${extras}` : ''}
368
- `);
369
- }
347
+ console.log('\nDone.\n');
370
348
 
371
349
  // If run manually (not via npm lifecycle), remove the global npm package too
372
350
  if (!process.env.npm_lifecycle_event) {
package/commit-sha CHANGED
@@ -1 +1 @@
1
- ce8065e53638e41f0ae971030f26f0b556dc287b
1
+ 28f14a4cb1dfe7e6a2089eae6db7a5b05adc1f1e
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "claude-notification-plugin",
3
3
  "productName": "claude-notification-plugin",
4
- "version": "1.1.6",
4
+ "version": "1.1.9",
5
5
  "description": "Claude Code task-completion notifications: Telegram, desktop notifications (Windows/macOS/Linux), sound, and voice",
6
6
  "type": "module",
7
7
  "engines": {
@@ -53,6 +53,7 @@
53
53
  "node-notifier": "^10.0.1"
54
54
  },
55
55
  "devDependencies": {
56
- "eslint-plugin-import": "^2.31.0"
56
+ "eslint-plugin-import": "^2.31.0",
57
+ "eslint-plugin-unused-imports": "^4.4.1"
57
58
  }
58
59
  }