@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.
- package/README.md +72 -1
- package/dist/auth.d.ts +13 -0
- package/dist/auth.js +82 -0
- package/dist/builtin-hooks.d.ts +11 -0
- package/dist/builtin-hooks.js +67 -0
- package/dist/cli.js +131 -2
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +5 -1
- package/dist/deps.d.ts +13 -0
- package/dist/deps.js +83 -0
- package/dist/doctor.js +56 -0
- package/dist/handlers.d.ts +6 -3
- package/dist/handlers.js +81 -46
- package/dist/index.d.ts +10 -5
- package/dist/index.js +23 -1
- package/dist/llm.d.ts +1 -1
- package/dist/llm.js +8 -4
- package/dist/manifest.d.ts +4 -0
- package/dist/manifest.js +24 -0
- package/dist/metrics.d.ts +14 -0
- package/dist/metrics.js +51 -0
- package/dist/migrate.d.ts +9 -0
- package/dist/migrate.js +64 -1
- package/dist/plugin.d.ts +50 -0
- package/dist/plugin.js +279 -0
- package/dist/ratelimit.d.ts +12 -0
- package/dist/ratelimit.js +44 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +119 -5
- package/dist/shortcircuit.d.ts +20 -0
- package/dist/shortcircuit.js +49 -0
- package/dist/types.d.ts +31 -0
- package/hooks/check-update.js +37 -0
- package/package.json +2 -1
|
@@ -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.
|
|
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
|
],
|