claude-notification-plugin 1.0.92 → 1.0.93

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-notification-plugin",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "Claude Code task-completion notifications: Telegram, desktop notifications (Windows/macOS/Linux), sound, and voice",
5
5
  "author": {
6
6
  "name": "Viacheslav Makarov",
package/bin/install.js CHANGED
@@ -233,6 +233,20 @@ function registerCli () {
233
233
  // Helpers
234
234
  // ──────────────────────────────────────
235
235
 
236
+ function openTtyInput () {
237
+ // If stdin is already a TTY (e.g. local `npm install`), use it directly
238
+ if (process.stdin.isTTY) {
239
+ return process.stdin;
240
+ }
241
+ // Otherwise try to open the TTY device directly (works even when npm pipes stdin)
242
+ try {
243
+ const ttyPath = process.platform === 'win32' ? '\\\\.\\CON' : '/dev/tty';
244
+ return fs.createReadStream(ttyPath, { encoding: 'utf-8' });
245
+ } catch {
246
+ return null;
247
+ }
248
+ }
249
+
236
250
  function ask (rl, question) {
237
251
  return new Promise((resolve) => {
238
252
  rl.question(question, (answer) => resolve(answer.trim()));
@@ -310,16 +324,6 @@ async function main () {
310
324
  console.log(' Plugin registered.');
311
325
 
312
326
  // 2. Interactive Telegram setup
313
- const rl = readline.createInterface({
314
- input: process.stdin,
315
- output: process.stdout,
316
- });
317
-
318
- console.log('');
319
- console.log('Claude Notification Plugin - Setup');
320
- console.log('==================================');
321
- console.log('');
322
-
323
327
  let existing = {};
324
328
  if (fs.existsSync(configPath)) {
325
329
  try {
@@ -335,41 +339,65 @@ async function main () {
335
339
  let token = existingToken;
336
340
  let chatId = existingChatId;
337
341
 
338
- if (existingToken) {
339
- const masked = existingToken.slice(0, 6) + '...' + existingToken.slice(-4);
340
- console.log(`Telegram token found: ${masked}`);
341
- const reuse = await ask(rl, 'Keep existing token? (Y/n): ');
342
- if (reuse.toLowerCase() === 'n') {
343
- token = await ask(rl, 'New Bot Token: ');
344
- chatId = '';
345
- }
346
- } else {
347
- const useTelegram = await ask(rl, 'Configure Telegram? (y/N): ');
348
- if (useTelegram.toLowerCase() === 'y') {
349
- token = await ask(rl, 'Bot Token: ');
350
- }
351
- }
342
+ const ttyInput = openTtyInput();
343
+ if (ttyInput) {
344
+ const rl = readline.createInterface({
345
+ input: ttyInput,
346
+ output: process.stdout,
347
+ });
352
348
 
353
- if (token && !chatId) {
354
349
  console.log('');
355
- console.log('Send any message to your bot in Telegram, then press Enter.');
356
- await ask(rl, '');
350
+ console.log('Claude Notification Plugin - Setup');
351
+ console.log('==================================');
352
+ console.log('');
357
353
 
358
- console.log('Fetching Chat ID...');
359
- chatId = await fetchChatId(token);
354
+ if (existingToken) {
355
+ const masked = existingToken.slice(0, 6) + '...' + existingToken.slice(-4);
356
+ console.log(`Telegram token found: ${masked}`);
357
+ const reuse = await ask(rl, 'Keep existing token? (Y/n): ');
358
+ if (reuse.toLowerCase() === 'n') {
359
+ token = await ask(rl, 'New Bot Token: ');
360
+ chatId = '';
361
+ }
362
+ } else {
363
+ const useTelegram = await ask(rl, 'Configure Telegram? (y/N): ');
364
+ if (useTelegram.toLowerCase() === 'y') {
365
+ token = await ask(rl, 'Bot Token: ');
366
+ }
367
+ }
360
368
 
361
- if (chatId) {
362
- console.log('Chat ID detected: ' + chatId);
369
+ if (token && !chatId) {
370
+ console.log('');
371
+ console.log('Send any message to your bot in Telegram, then press Enter.');
372
+ await ask(rl, '');
373
+
374
+ console.log('Fetching Chat ID...');
375
+ chatId = await fetchChatId(token);
376
+
377
+ if (chatId) {
378
+ console.log('Chat ID detected: ' + chatId);
379
+ } else {
380
+ console.log('Could not detect Chat ID automatically.');
381
+ chatId = await ask(rl, 'Enter Chat ID manually: ');
382
+ }
383
+ } else if (token && chatId) {
384
+ console.log(`Chat ID: ${chatId}`);
385
+ }
386
+
387
+ rl.close();
388
+ if (ttyInput !== process.stdin) {
389
+ ttyInput.destroy();
390
+ }
391
+ } else {
392
+ console.log('');
393
+ console.log('Non-interactive install (stdin is not a terminal).');
394
+ if (token && chatId) {
395
+ console.log('Telegram: using existing config.');
363
396
  } else {
364
- console.log('Could not detect Chat ID automatically.');
365
- chatId = await ask(rl, 'Enter Chat ID manually: ');
397
+ console.log('Telegram: skipped. Run "claude-notify install" to configure.');
366
398
  }
367
- } else if (token && chatId) {
368
- console.log(`Chat ID: ${chatId}`);
369
399
  }
370
400
 
371
- rl.close();
372
-
373
401
  // 3. Write config
374
402
  fs.mkdirSync(claudeDir, { recursive: true });
375
403
 
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.0.92",
4
+ "version": "1.0.93",
5
5
  "description": "Claude Code task-completion notifications: Telegram, desktop notifications (Windows/macOS/Linux), sound, and voice",
6
6
  "type": "module",
7
7
  "engines": {