@delorenj/claude-notifications
Version:
Delightful Notification for Claude Code
39 lines (33 loc) • 1.4 kB
JavaScript
// Intentionally minimal: we no longer auto-write agent CLI hooks during
// `npm install`. Hook installation is an explicit, user-initiated step via
// `claude-notifications install`. This avoids surprise writes to
// ~/.claude/settings.json (and other CLI configs) every time the package is
// (re)installed.
const { spawn } = require("child_process");
const path = require("path");
console.log("🎵 Claude Notifications installed.");
console.log("");
console.log("Preparing sound assets...");
// Still generate sound files during npm install — that's a self-contained
// asset under ~/.config/claude-notifications/ and causes no side effects
// outside this package's own config dir.
const soundsOnly = spawn(
process.execPath,
[path.join(__dirname, "bin", "claude-notifications.js"), "sounds"],
{ stdio: "inherit" },
);
soundsOnly.on("close", (code) => {
if (code !== 0) {
console.warn(`Warning: sound generation exited with code ${code} (sox may be missing)`);
}
console.log("");
console.log("Next step — wire notification hooks into your agent CLIs:");
console.log("");
console.log(" claude-notifications install");
console.log("");
console.log("This opens an interactive selector. For scripted installs:");
console.log("");
console.log(" claude-notifications install --non-interactive --cli=claude-code");
console.log("");
});