@mauribadnights/clooks 0.2.2 → 0.3.1

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,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ // clooks built-in: check for updates on session start
4
+ // Runs in background, non-blocking. Injects a notice if update available.
5
+
6
+ const { execSync } = require('child_process');
7
+
8
+ try {
9
+ // Get installed version
10
+ const pkgPath = require.resolve('@mauribadnights/clooks/package.json');
11
+ const pkg = JSON.parse(require('fs').readFileSync(pkgPath, 'utf-8'));
12
+ const current = pkg.version;
13
+
14
+ // Check npm (with short timeout to not block session start)
15
+ const latest = execSync('npm view @mauribadnights/clooks version 2>/dev/null', {
16
+ encoding: 'utf-8',
17
+ timeout: 5000,
18
+ }).trim();
19
+
20
+ if (latest && latest !== current && isNewer(latest, current)) {
21
+ // Output as additionalContext so it's injected into Claude's context
22
+ const msg = `[clooks] Update available: ${current} \u2192 ${latest}. Run: clooks update`;
23
+ process.stdout.write(JSON.stringify({ additionalContext: msg }));
24
+ }
25
+ } catch {
26
+ // Silently fail — update checks should never block sessions
27
+ }
28
+
29
+ function isNewer(a, b) {
30
+ const pa = a.split('.').map(Number);
31
+ const pb = b.split('.').map(Number);
32
+ for (let i = 0; i < 3; i++) {
33
+ if ((pa[i] || 0) > (pb[i] || 0)) return true;
34
+ if ((pa[i] || 0) < (pb[i] || 0)) return false;
35
+ }
36
+ return false;
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mauribadnights/clooks",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "Persistent hook runtime for Claude Code — eliminates process spawning overhead and gives you observability",
5
5
  "bin": {
6
6
  "clooks": "./dist/cli.js"
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "files": [
34
34
  "dist",
35
+ "hooks",
35
36
  "README.md",
36
37
  "LICENSE"
37
38
  ],