cc-hook-registry 3.1.0 → 3.2.0
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/index.mjs +37 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -113,6 +113,7 @@ if (!command || command === '--help' || command === '-h') {
|
|
|
113
113
|
install <id> Install a hook
|
|
114
114
|
info <id> Show hook details
|
|
115
115
|
recommend Recommend hooks for current project
|
|
116
|
+
uninstall <id> Remove an installed hook
|
|
116
117
|
outdated Check installed hooks for updates
|
|
117
118
|
stats Registry statistics
|
|
118
119
|
|
|
@@ -368,6 +369,42 @@ else if (command === 'recommend') {
|
|
|
368
369
|
console.log();
|
|
369
370
|
}
|
|
370
371
|
|
|
372
|
+
else if (command === 'uninstall') {
|
|
373
|
+
const id = args[1];
|
|
374
|
+
if (!id) { console.log(c.red + ' Usage: cc-hook-registry uninstall <id>' + c.reset); process.exit(1); }
|
|
375
|
+
|
|
376
|
+
const hookPath = join(HOOKS_DIR, id + '.sh');
|
|
377
|
+
console.log();
|
|
378
|
+
|
|
379
|
+
if (!existsSync(hookPath)) {
|
|
380
|
+
console.log(c.red + ' Hook not installed: ' + id + c.reset);
|
|
381
|
+
process.exit(1);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Remove script
|
|
385
|
+
const { unlinkSync } = await import('fs');
|
|
386
|
+
unlinkSync(hookPath);
|
|
387
|
+
console.log(c.green + ' ✓ Removed: ' + hookPath + c.reset);
|
|
388
|
+
|
|
389
|
+
// Remove from settings.json
|
|
390
|
+
if (existsSync(SETTINGS_PATH)) {
|
|
391
|
+
try {
|
|
392
|
+
const settings = JSON.parse(readFileSync(SETTINGS_PATH, 'utf-8'));
|
|
393
|
+
for (const trigger of Object.keys(settings.hooks || {})) {
|
|
394
|
+
settings.hooks[trigger] = settings.hooks[trigger].filter(entry =>
|
|
395
|
+
!(entry.hooks || []).some(h => (h.command || '').includes(id))
|
|
396
|
+
);
|
|
397
|
+
if (settings.hooks[trigger].length === 0) delete settings.hooks[trigger];
|
|
398
|
+
}
|
|
399
|
+
writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2));
|
|
400
|
+
console.log(c.green + ' ✓ Removed from settings.json' + c.reset);
|
|
401
|
+
} catch {}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
console.log(c.dim + ' Restart Claude Code to take effect.' + c.reset);
|
|
405
|
+
console.log();
|
|
406
|
+
}
|
|
407
|
+
|
|
371
408
|
else if (command === 'outdated') {
|
|
372
409
|
console.log();
|
|
373
410
|
console.log(c.bold + ' Checking installed hooks for updates...' + c.reset);
|