claude-code-notify-lite 1.0.3 → 1.0.4
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/cli.js +45 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { program } = require('commander');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
6
7
|
const pkg = require('../package.json');
|
|
7
8
|
|
|
8
9
|
function formatTime() {
|
|
@@ -11,10 +12,29 @@ function formatTime() {
|
|
|
11
12
|
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
function safeRequire(modulePath, moduleName) {
|
|
16
|
+
try {
|
|
17
|
+
return require(modulePath);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.error(chalk.red(`Failed to load ${moduleName}: ${err.message}`));
|
|
20
|
+
console.error(chalk.yellow('Try reinstalling: npm install -g claude-code-notify-lite'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
program
|
|
15
26
|
.name('ccnotify')
|
|
16
27
|
.description('Task completion notifications for Claude Code')
|
|
17
|
-
.version(pkg.version)
|
|
28
|
+
.version(pkg.version)
|
|
29
|
+
.addHelpText('after', `
|
|
30
|
+
Examples:
|
|
31
|
+
$ ccnotify install Install hooks
|
|
32
|
+
$ ccnotify test Test notification
|
|
33
|
+
$ ccnotify status Check status
|
|
34
|
+
$ ccnotify logs View debug logs
|
|
35
|
+
|
|
36
|
+
Version: ${pkg.version}
|
|
37
|
+
`);
|
|
18
38
|
|
|
19
39
|
program
|
|
20
40
|
.command('install')
|
|
@@ -252,4 +272,28 @@ program
|
|
|
252
272
|
}
|
|
253
273
|
});
|
|
254
274
|
|
|
275
|
+
program
|
|
276
|
+
.command('info')
|
|
277
|
+
.description('Show version and installation info')
|
|
278
|
+
.action(() => {
|
|
279
|
+
console.log(chalk.blue('Claude Code Notify Lite\n'));
|
|
280
|
+
console.log(` Version: ${chalk.green(pkg.version)}`);
|
|
281
|
+
console.log(` Node: ${chalk.gray(process.version)}`);
|
|
282
|
+
console.log(` Platform: ${chalk.gray(process.platform)}`);
|
|
283
|
+
console.log(` CLI Path: ${chalk.gray(__dirname)}`);
|
|
284
|
+
|
|
285
|
+
const { getConfigDir, getClaudeConfigDir } = safeRequire('../src/config', 'config');
|
|
286
|
+
console.log(` Config Dir: ${chalk.gray(getConfigDir())}`);
|
|
287
|
+
console.log(` Claude Dir: ${chalk.gray(getClaudeConfigDir())}`);
|
|
288
|
+
|
|
289
|
+
const isNpxCache = __dirname.toLowerCase().includes('npm-cache') ||
|
|
290
|
+
__dirname.toLowerCase().includes('_npx');
|
|
291
|
+
if (isNpxCache) {
|
|
292
|
+
console.log(chalk.yellow('\n Warning: Running from npx cache'));
|
|
293
|
+
console.log(chalk.yellow(' For better reliability, install globally:'));
|
|
294
|
+
console.log(chalk.white(' npm install -g claude-code-notify-lite'));
|
|
295
|
+
}
|
|
296
|
+
console.log('');
|
|
297
|
+
});
|
|
298
|
+
|
|
255
299
|
program.parse();
|