cc-hook-registry 4.0.0 → 4.1.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.
@@ -0,0 +1,12 @@
1
+ name: Tests
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v4
8
+ - uses: actions/setup-node@v4
9
+ with:
10
+ node-version: '20'
11
+ - name: CLI tests
12
+ run: bash test.sh
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
+ list List all installed hooks with status
116
117
  update [id] Update one or all installed hooks
117
118
  uninstall <id> Remove an installed hook
118
119
  outdated Check installed hooks for updates
@@ -370,6 +371,57 @@ else if (command === 'recommend') {
370
371
  console.log();
371
372
  }
372
373
 
374
+ else if (command === 'list') {
375
+ console.log();
376
+ console.log(c.bold + ' Installed Hooks' + c.reset);
377
+ console.log();
378
+
379
+ if (!existsSync(HOOKS_DIR)) {
380
+ console.log(c.dim + ' No hooks directory.' + c.reset);
381
+ process.exit(0);
382
+ }
383
+
384
+ const { readdirSync, statSync } = await import('fs');
385
+ const files = readdirSync(HOOKS_DIR).filter(f => f.endsWith('.sh')).sort();
386
+
387
+ // Count by trigger
388
+ let byTrigger = {};
389
+ if (existsSync(SETTINGS_PATH)) {
390
+ try {
391
+ const s = JSON.parse(readFileSync(SETTINGS_PATH, 'utf-8'));
392
+ for (const [trigger, entries] of Object.entries(s.hooks || {})) {
393
+ for (const e of entries) {
394
+ for (const h of (e.hooks || [])) {
395
+ const name = (h.command || '').split('/').pop();
396
+ if (name) byTrigger[name] = trigger;
397
+ }
398
+ }
399
+ }
400
+ } catch {}
401
+ }
402
+
403
+ for (const file of files) {
404
+ const path = join(HOOKS_DIR, file);
405
+ const name = file.replace('.sh', '');
406
+ const size = statSync(path).size;
407
+ const mtime = statSync(path).mtime;
408
+ const age = Math.floor((Date.now() - mtime.getTime()) / 86400000);
409
+ const inRegistry = REGISTRY.some(h => h.id === name);
410
+ const trigger = byTrigger[file] || '?';
411
+
412
+ const icon = inRegistry ? c.green + '●' + c.reset : c.dim + '○' + c.reset;
413
+ const ageStr = age === 0 ? 'today' : age + 'd ago';
414
+ const triggerStr = c.dim + trigger.padEnd(16) + c.reset;
415
+
416
+ console.log(' ' + icon + ' ' + file.padEnd(30) + triggerStr + (size/1024).toFixed(1) + 'KB ' + c.dim + ageStr + c.reset);
417
+ }
418
+
419
+ console.log();
420
+ const inReg = files.filter(f => REGISTRY.some(h => h.id === f.replace('.sh', ''))).length;
421
+ console.log(' ' + files.length + ' hooks installed (' + c.green + inReg + ' in registry' + c.reset + ', ' + c.dim + (files.length - inReg) + ' custom' + c.reset + ')');
422
+ console.log();
423
+ }
424
+
373
425
  else if (command === 'update') {
374
426
  const targetId = args[1]; // Optional: update specific hook or all
375
427
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hook-registry",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Search, browse, and install Claude Code hooks from the community. GitHub-based registry, no server needed.",
5
5
  "main": "index.mjs",
6
6
  "bin": {