@landienzla/claude-code-notify 1.0.4 → 1.0.5
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/README.md +1 -4
- package/bin/cli.js +0 -19
- package/hooks/scripts/notify.sh +8 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ The hook fires on all notification types:
|
|
|
81
81
|
|
|
82
82
|
## Requirements
|
|
83
83
|
|
|
84
|
-
- **
|
|
84
|
+
- **Node.js** — already installed if you're using npm
|
|
85
85
|
- **Linux:** `libnotify-bin` for `notify-send`
|
|
86
86
|
```bash
|
|
87
87
|
# Debian/Ubuntu
|
|
@@ -119,9 +119,6 @@ npx @landienzla/claude-code-notify uninstall
|
|
|
119
119
|
- Install `libnotify-bin` (see Requirements)
|
|
120
120
|
- Ensure a notification daemon is running (e.g. `dunst`, `mako`, GNOME/KDE built-in)
|
|
121
121
|
|
|
122
|
-
**Generic "Needs your attention" message instead of context:**
|
|
123
|
-
- Ensure Python 3 is installed and on your PATH
|
|
124
|
-
|
|
125
122
|
## License
|
|
126
123
|
|
|
127
124
|
[MIT](LICENSE)
|
package/bin/cli.js
CHANGED
|
@@ -49,16 +49,6 @@ function dryRun() {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// Check python3
|
|
53
|
-
const { spawnSync } = require('child_process');
|
|
54
|
-
const py = spawnSync('python3', ['--version'], { stdio: 'pipe' });
|
|
55
|
-
if (py.status !== 0) {
|
|
56
|
-
console.log('\n Warning: Python 3 not found. Notifications will work but show');
|
|
57
|
-
console.log(' generic messages instead of contextual ones.');
|
|
58
|
-
} else {
|
|
59
|
-
console.log(`\n Python 3: ${py.stdout.toString().trim()}`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
52
|
console.log('\nRun "claude-code-notify setup" to apply these changes.');
|
|
63
53
|
}
|
|
64
54
|
|
|
@@ -68,15 +58,6 @@ function setup() {
|
|
|
68
58
|
process.exit(1);
|
|
69
59
|
}
|
|
70
60
|
|
|
71
|
-
// Check python3 availability
|
|
72
|
-
const { spawnSync } = require('child_process');
|
|
73
|
-
const py = spawnSync('python3', ['--version'], { stdio: 'pipe' });
|
|
74
|
-
if (py.status !== 0) {
|
|
75
|
-
console.log(' Warning: Python 3 not found. Notifications will work but show');
|
|
76
|
-
console.log(' generic messages instead of contextual ones.');
|
|
77
|
-
console.log(' Install Python 3 for full functionality.\n');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
61
|
// Copy notify.sh
|
|
81
62
|
fs.mkdirSync(SCRIPTS_DIR, { recursive: true });
|
|
82
63
|
fs.copyFileSync(NOTIFY_SRC, NOTIFY_DEST);
|
package/hooks/scripts/notify.sh
CHANGED
|
@@ -7,13 +7,14 @@ INPUT=$(cat)
|
|
|
7
7
|
# Parse JSON and sanitize for safe shell usage
|
|
8
8
|
# - Strip characters that could break shell/PowerShell/XML/AppleScript interpolation
|
|
9
9
|
# - Truncate to 200 chars (OS notification display limit)
|
|
10
|
-
MESSAGE=$(printf '%s' "$INPUT" |
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
MESSAGE=$(printf '%s' "$INPUT" | node -e "
|
|
11
|
+
let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{
|
|
12
|
+
try{const o=JSON.parse(d);
|
|
13
|
+
let m=o.notification_message||o.message||'Needs your attention';
|
|
14
|
+
m=m.replace(/[^\w\s.,!?:;()\[\]{}\/\\@#%+=\-]/g,'').slice(0,200);
|
|
15
|
+
process.stdout.write(m);
|
|
16
|
+
}catch(e){process.stdout.write('Needs your attention')}
|
|
17
|
+
});
|
|
17
18
|
" 2>/dev/null)
|
|
18
19
|
|
|
19
20
|
# Fallback if python3 parsing fails
|
package/package.json
CHANGED