claude-notification-plugin 1.1.57 → 1.1.60
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/.claude-plugin/plugin.json +1 -1
- package/bin/listener-cli.js +65 -4
- package/commit-sha +1 -1
- package/notifier/notifier.js +15 -15
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-notification-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.60",
|
|
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/listener-cli.js
CHANGED
|
@@ -180,7 +180,7 @@ function stopDaemon () {
|
|
|
180
180
|
console.log('Listener stopped');
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
function showStatus () {
|
|
183
|
+
async function showStatus () {
|
|
184
184
|
const pid = readPid();
|
|
185
185
|
if (!pid) {
|
|
186
186
|
console.log('Status: not running');
|
|
@@ -193,11 +193,72 @@ function showStatus () {
|
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
console.log(`Status: running (PID: ${pid})`);
|
|
197
|
+
|
|
198
|
+
// Read config for Telegram info and listener section
|
|
199
|
+
let config = {};
|
|
200
|
+
try {
|
|
201
|
+
config = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf-8'));
|
|
202
|
+
} catch {
|
|
203
|
+
// ignore
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const token = process.env.CLAUDE_NOTIFY_TELEGRAM_TOKEN || config.telegramToken || config.telegram?.token;
|
|
207
|
+
const chatId = process.env.CLAUDE_NOTIFY_TELEGRAM_CHAT_ID || config.telegramChatId || config.telegram?.chatId;
|
|
208
|
+
|
|
209
|
+
// Telegram info
|
|
210
|
+
console.log('\nTelegram:');
|
|
211
|
+
if (token) {
|
|
212
|
+
const masked = token.length > 10
|
|
213
|
+
? token.slice(0, 5) + '...' + token.slice(-4)
|
|
214
|
+
: '***';
|
|
215
|
+
console.log(` Token: ${masked}`);
|
|
216
|
+
|
|
217
|
+
// Fetch bot name
|
|
218
|
+
try {
|
|
219
|
+
const meRes = await fetch(`https://api.telegram.org/bot${token}/getMe`);
|
|
220
|
+
const meData = await meRes.json();
|
|
221
|
+
if (meData.ok) {
|
|
222
|
+
console.log(` Bot: @${meData.result.username} (${meData.result.first_name})`);
|
|
223
|
+
}
|
|
224
|
+
} catch {
|
|
225
|
+
// ignore fetch errors
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
console.log(' Token: not configured');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (chatId) {
|
|
232
|
+
console.log(` Chat ID: ${chatId}`);
|
|
233
|
+
|
|
234
|
+
// Fetch chat name
|
|
235
|
+
if (token) {
|
|
236
|
+
try {
|
|
237
|
+
const chatRes = await fetch(`https://api.telegram.org/bot${token}/getChat?chat_id=${chatId}`);
|
|
238
|
+
const chatData = await chatRes.json();
|
|
239
|
+
if (chatData.ok) {
|
|
240
|
+
const c = chatData.result;
|
|
241
|
+
const name = c.title || c.first_name || c.username || '';
|
|
242
|
+
const type = c.type || '';
|
|
243
|
+
console.log(` Chat: ${name}${type ? ` (${type})` : ''}`);
|
|
244
|
+
}
|
|
245
|
+
} catch {
|
|
246
|
+
// ignore fetch errors
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
console.log(' Chat ID: not configured');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Listener config
|
|
254
|
+
if (config.listener) {
|
|
255
|
+
console.log(`\nListener config:\n${JSON.stringify({ listener: config.listener }, null, 2)}`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Log file and recent lines
|
|
196
259
|
const logFile = getLogFile();
|
|
197
|
-
console.log(
|
|
198
|
-
Log: ${logFile}`);
|
|
260
|
+
console.log(`\nLog: ${logFile}`);
|
|
199
261
|
|
|
200
|
-
// Show last few log lines
|
|
201
262
|
try {
|
|
202
263
|
if (fs.existsSync(logFile)) {
|
|
203
264
|
const content = fs.readFileSync(logFile, 'utf-8');
|
package/commit-sha
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f80a38052530b65482f761ddfab8087fceab2587
|
package/notifier/notifier.js
CHANGED
|
@@ -624,28 +624,28 @@ function numberToWords (n, lang) {
|
|
|
624
624
|
}
|
|
625
625
|
|
|
626
626
|
const voicePhrases = {
|
|
627
|
-
en: (d) => `Claude finished
|
|
628
|
-
ru: (d) => `Клод завершил работу за ${numberToWords(d, 'ru')} ${pluralize(d, ['секунду', 'секунды', 'секунд'])}`,
|
|
629
|
-
de: (d) => `Claude hat die Arbeit in ${d} ${pluralize(d, ['Sekunde', 'Sekunden'])} abgeschlossen`,
|
|
630
|
-
fr: (d) => `Claude a termine en ${d} ${pluralize(d, ['seconde', 'secondes'])}`,
|
|
631
|
-
es: (d) => `Claude termino en ${d} ${pluralize(d, ['segundo', 'segundos'])}`,
|
|
632
|
-
pt: (d) => `Claude terminou em ${d} ${pluralize(d, ['segundo', 'segundos'])}`,
|
|
633
|
-
ja: (d) => `Claudeは${d}
|
|
634
|
-
ko: (d) => `Claude가 ${d}초 만에
|
|
627
|
+
en: (d, p) => `Claude finished working on ${p} in ${numberToWords(d, 'en')} ${pluralize(d, ['second', 'seconds'])}`,
|
|
628
|
+
ru: (d, p) => `Клод завершил работу над проектом ${p} за ${numberToWords(d, 'ru')} ${pluralize(d, ['секунду', 'секунды', 'секунд'])}`,
|
|
629
|
+
de: (d, p) => `Claude hat die Arbeit an ${p} in ${d} ${pluralize(d, ['Sekunde', 'Sekunden'])} abgeschlossen`,
|
|
630
|
+
fr: (d, p) => `Claude a termine ${p} en ${d} ${pluralize(d, ['seconde', 'secondes'])}`,
|
|
631
|
+
es: (d, p) => `Claude termino ${p} en ${d} ${pluralize(d, ['segundo', 'segundos'])}`,
|
|
632
|
+
pt: (d, p) => `Claude terminou ${p} em ${d} ${pluralize(d, ['segundo', 'segundos'])}`,
|
|
633
|
+
ja: (d, p) => `Claudeは${p}の作業を${d}秒で完了しました`,
|
|
634
|
+
ko: (d, p) => `Claude가 ${p} 작업을 ${d}초 만에 완료했습니다`,
|
|
635
635
|
};
|
|
636
636
|
|
|
637
|
-
function getVoicePhrase (duration) {
|
|
637
|
+
function getVoicePhrase (duration, project) {
|
|
638
638
|
const locale = Intl.DateTimeFormat().resolvedOptions().locale || 'en';
|
|
639
639
|
const lang = locale.split('-')[0].toLowerCase();
|
|
640
640
|
const fn = voicePhrases[lang] || voicePhrases.en;
|
|
641
|
-
return fn(duration);
|
|
641
|
+
return fn(duration, project || 'unknown');
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
-
function speakResult (config, duration) {
|
|
644
|
+
function speakResult (config, duration, project) {
|
|
645
645
|
if (!config.voice.enabled) {
|
|
646
646
|
return;
|
|
647
647
|
}
|
|
648
|
-
const text = getVoicePhrase(duration);
|
|
648
|
+
const text = getVoicePhrase(duration, project);
|
|
649
649
|
try {
|
|
650
650
|
switch (PLATFORM) {
|
|
651
651
|
case 'win32': {
|
|
@@ -808,7 +808,7 @@ process.stdin.on('end', async () => {
|
|
|
808
808
|
|
|
809
809
|
if (config.debug) {
|
|
810
810
|
const debugBlockHtml = '\n\n<b>Debug:</b>\n'
|
|
811
|
-
+ (config.voice.enabled ? `\nVoice: ${escapeHtml(getVoicePhrase(duration))}` : '')
|
|
811
|
+
+ (config.voice.enabled ? `\nVoice: ${escapeHtml(getVoicePhrase(duration, project))}` : '')
|
|
812
812
|
+ `\n\nHook input:\n<pre>${escapeHtml(JSON.stringify(event, null, 2))}</pre>`;
|
|
813
813
|
telegramMessage += debugBlockHtml;
|
|
814
814
|
}
|
|
@@ -819,7 +819,7 @@ process.stdin.on('end', async () => {
|
|
|
819
819
|
branch: branch || undefined,
|
|
820
820
|
duration,
|
|
821
821
|
trigger: eventType,
|
|
822
|
-
voicePhrase: config.voice.enabled ? getVoicePhrase(duration) : null,
|
|
822
|
+
voicePhrase: config.voice.enabled ? getVoicePhrase(duration, project) : null,
|
|
823
823
|
hookEvent: event,
|
|
824
824
|
});
|
|
825
825
|
|
|
@@ -833,5 +833,5 @@ process.stdin.on('end', async () => {
|
|
|
833
833
|
|
|
834
834
|
await sendDesktopNotification(config, desktopTitle, desktopMessage);
|
|
835
835
|
playSound(config);
|
|
836
|
-
speakResult(config, duration);
|
|
836
|
+
speakResult(config, duration, project);
|
|
837
837
|
});
|
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.
|
|
4
|
+
"version": "1.1.60",
|
|
5
5
|
"description": "Claude Code task-completion notifications: Telegram, desktop notifications (Windows/macOS/Linux), sound, and voice",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|