ccclub 0.2.13 → 0.2.14
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/dist/index.js +1 -1
- package/package.json +4 -2
- package/scripts/postinstall.cjs +42 -0
package/dist/index.js
CHANGED
|
@@ -825,7 +825,7 @@ async function hookCommand() {
|
|
|
825
825
|
|
|
826
826
|
// src/index.ts
|
|
827
827
|
var program = new Command();
|
|
828
|
-
program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version("0.2.
|
|
828
|
+
program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version("0.2.14");
|
|
829
829
|
program.command("init").description("Initialize CCClub (one-time setup)").action(initCommand);
|
|
830
830
|
program.command("join").description("Join a friend's group").argument("<invite-code>", "6-character invite code").action(joinCommand);
|
|
831
831
|
program.command("sync").description("Sync local usage data to server").option("-s, --silent", "No output (used by auto-sync hook)").option("-f, --full", "Force full re-sync of all data").action(syncCommand);
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccclub",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "See how much Claude Code you and your friends are using",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ccclub": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"scripts"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
15
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
14
16
|
"dev": "tsx src/index.ts",
|
|
15
17
|
"test": "vitest run"
|
|
16
18
|
},
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const os = require("os");
|
|
4
|
+
|
|
5
|
+
const settingsPath = path.join(os.homedir(), ".claude", "settings.json");
|
|
6
|
+
const HOOK_COMMAND = "ccclub sync --silent";
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
// Only install hook if user has Claude Code configured
|
|
10
|
+
if (!fs.existsSync(settingsPath)) process.exit(0);
|
|
11
|
+
|
|
12
|
+
const settings = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
|
|
13
|
+
if (!settings.hooks) settings.hooks = {};
|
|
14
|
+
|
|
15
|
+
const sessionEnd = settings.hooks.SessionEnd || [];
|
|
16
|
+
const hasHook = sessionEnd.some(
|
|
17
|
+
(g) => g.matcher !== undefined && g.hooks?.some((h) => h.command === HOOK_COMMAND),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (hasHook) process.exit(0);
|
|
21
|
+
|
|
22
|
+
// Remove old format entries (missing matcher field)
|
|
23
|
+
settings.hooks.SessionEnd = sessionEnd.filter(
|
|
24
|
+
(g) => !(g.hooks?.some((h) => h.command === HOOK_COMMAND) && g.matcher === undefined),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
settings.hooks.SessionEnd.push({
|
|
28
|
+
matcher: "",
|
|
29
|
+
hooks: [
|
|
30
|
+
{
|
|
31
|
+
type: "command",
|
|
32
|
+
command: HOOK_COMMAND,
|
|
33
|
+
async: true,
|
|
34
|
+
timeout: 30,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
40
|
+
} catch {
|
|
41
|
+
// Silent fail — hook can be installed later via `ccclub hook`
|
|
42
|
+
}
|