vibecoder-discord-presence 1.0.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/LICENSE +21 -0
- package/README.md +87 -0
- package/assets/README.md +0 -0
- package/assets/logo.jpg +0 -0
- package/assets/profile.png +0 -0
- package/dist/chunk-2A7GKQFO.js +108 -0
- package/dist/chunk-4V354UFY.js +90 -0
- package/dist/chunk-CEWLOUQO.js +97 -0
- package/dist/chunk-FRGALQ5R.js +39 -0
- package/dist/chunk-KDLAS6ED.js +126 -0
- package/dist/chunk-LKE6H3YG.js +28 -0
- package/dist/chunk-XYXO7VLI.js +65 -0
- package/dist/claude-code-Y5EVVTMQ.js +114 -0
- package/dist/config-GLQUOMQ6.js +245 -0
- package/dist/daemon-UR7HFYY7.js +276 -0
- package/dist/install-PS6R32NO.js +45 -0
- package/dist/restart-4QW7NSWI.js +28 -0
- package/dist/status-4L4TX5GV.js +62 -0
- package/dist/stop-GI5PLZ4I.js +20 -0
- package/dist/uninstall-APXX4WCS.js +42 -0
- package/dist/vdp.js +66 -0
- package/package.json +61 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HOOK_EVENTS,
|
|
3
|
+
isOurEntry,
|
|
4
|
+
readSettings
|
|
5
|
+
} from "./chunk-CEWLOUQO.js";
|
|
6
|
+
import {
|
|
7
|
+
readUserConfig,
|
|
8
|
+
resolveClientId
|
|
9
|
+
} from "./chunk-2A7GKQFO.js";
|
|
10
|
+
import {
|
|
11
|
+
ui
|
|
12
|
+
} from "./chunk-LKE6H3YG.js";
|
|
13
|
+
import {
|
|
14
|
+
aggregate,
|
|
15
|
+
readMarkers
|
|
16
|
+
} from "./chunk-4V354UFY.js";
|
|
17
|
+
import {
|
|
18
|
+
DAEMON_STATUS_STALE_MS,
|
|
19
|
+
isProcessAlive,
|
|
20
|
+
readDaemonStatus,
|
|
21
|
+
readLock
|
|
22
|
+
} from "./chunk-KDLAS6ED.js";
|
|
23
|
+
import {
|
|
24
|
+
configPath
|
|
25
|
+
} from "./chunk-FRGALQ5R.js";
|
|
26
|
+
|
|
27
|
+
// src/commands/status.ts
|
|
28
|
+
var mark = (b) => b ? ui.check : ui.cross;
|
|
29
|
+
async function status(_args = []) {
|
|
30
|
+
const settings = await readSettings();
|
|
31
|
+
const installed = HOOK_EVENTS.filter((e) => (settings.hooks?.[e.name] ?? []).some(isOurEntry));
|
|
32
|
+
const hooksOk = installed.length === HOOK_EVENTS.length;
|
|
33
|
+
const clientId = resolveClientId(readUserConfig(configPath()));
|
|
34
|
+
const clientIdOk = clientId.length > 0;
|
|
35
|
+
const lock = readLock();
|
|
36
|
+
const daemonRunning = lock !== null && isProcessAlive(lock.pid);
|
|
37
|
+
const now = Date.now();
|
|
38
|
+
const ds = readDaemonStatus();
|
|
39
|
+
const dsFresh = ds !== null && now - ds.updatedAt <= DAEMON_STATUS_STALE_MS;
|
|
40
|
+
const discordConnected = dsFresh && ds.connected;
|
|
41
|
+
const live = aggregate(readMarkers(), now);
|
|
42
|
+
const sessionCount = live?.sessionCount ?? 0;
|
|
43
|
+
console.log(`${ui.title("vibecoder-discord-presence")} ${ui.dim("\u2014 status")}
|
|
44
|
+
`);
|
|
45
|
+
console.log(
|
|
46
|
+
` ${mark(hooksOk)} hooks installed ${hooksOk ? ui.dim(`(${installed.length}/${HOOK_EVENTS.length})`) : ui.warn(`(${installed.length}/${HOOK_EVENTS.length} \u2014 run \`vdp install\`)`)}`
|
|
47
|
+
);
|
|
48
|
+
console.log(
|
|
49
|
+
` ${mark(clientIdOk)} Discord app id ${clientIdOk ? ui.dim("(configured)") : ui.warn("(not set \u2014 set VDP_DISCORD_CLIENT_ID or clientId in config.json)")}`
|
|
50
|
+
);
|
|
51
|
+
console.log(
|
|
52
|
+
` ${mark(daemonRunning)} daemon running ${daemonRunning ? ui.dim(`(pid ${lock?.pid})`) : ui.dim("(not running)")}`
|
|
53
|
+
);
|
|
54
|
+
console.log(
|
|
55
|
+
` ${mark(discordConnected)} Discord connected ${discordConnected ? "" : ui.dim(dsFresh ? "(Discord not reachable)" : "(unknown \u2014 daemon idle)")}`
|
|
56
|
+
);
|
|
57
|
+
console.log(` ${ui.bullet} live sessions ${ui.bold(String(sessionCount))}`);
|
|
58
|
+
if (live?.activity) console.log(` ${ui.bullet} current activity ${ui.accent(live.activity)}`);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
status
|
|
62
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ui
|
|
3
|
+
} from "./chunk-LKE6H3YG.js";
|
|
4
|
+
import {
|
|
5
|
+
stopDaemon
|
|
6
|
+
} from "./chunk-KDLAS6ED.js";
|
|
7
|
+
import "./chunk-FRGALQ5R.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/stop.ts
|
|
10
|
+
async function stop(_args = []) {
|
|
11
|
+
const pid = await stopDaemon();
|
|
12
|
+
if (pid) {
|
|
13
|
+
console.log(`${ui.check} ${ui.bold("daemon stopped")} ${ui.dim(`(pid ${pid})`)}`);
|
|
14
|
+
} else {
|
|
15
|
+
console.log(ui.dim("daemon not running"));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
stop
|
|
20
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readSettings,
|
|
3
|
+
stripOurHooks,
|
|
4
|
+
writeSettings
|
|
5
|
+
} from "./chunk-CEWLOUQO.js";
|
|
6
|
+
import {
|
|
7
|
+
ui
|
|
8
|
+
} from "./chunk-LKE6H3YG.js";
|
|
9
|
+
import {
|
|
10
|
+
stopDaemon
|
|
11
|
+
} from "./chunk-KDLAS6ED.js";
|
|
12
|
+
import {
|
|
13
|
+
presenceDir
|
|
14
|
+
} from "./chunk-FRGALQ5R.js";
|
|
15
|
+
|
|
16
|
+
// src/commands/uninstall.ts
|
|
17
|
+
import { rm } from "fs/promises";
|
|
18
|
+
async function uninstall(args = []) {
|
|
19
|
+
const purge = args.includes("--purge") || args.includes("--all");
|
|
20
|
+
const settings = await readSettings();
|
|
21
|
+
const { cleaned, removed } = stripOurHooks(settings);
|
|
22
|
+
await writeSettings(cleaned);
|
|
23
|
+
console.log(`${ui.check} ${ui.bold("vibecoder-discord-presence uninstalled")}`);
|
|
24
|
+
console.log(
|
|
25
|
+
ui.dim(` removed ${removed} hook ${removed === 1 ? "entry" : "entries"} from settings.json`)
|
|
26
|
+
);
|
|
27
|
+
const stopped = await stopDaemon();
|
|
28
|
+
console.log(ui.dim(stopped ? ` stopped daemon (pid ${stopped})` : " daemon not running"));
|
|
29
|
+
if (!purge) {
|
|
30
|
+
console.log(ui.dim(" (config kept; run `vdp uninstall --purge` to also delete all vdp data)"));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
await rm(presenceDir(), { recursive: true, force: true });
|
|
34
|
+
console.log(ui.dim(` deleted ${presenceDir()}`));
|
|
35
|
+
console.log(
|
|
36
|
+
`
|
|
37
|
+
${ui.check} ${ui.bold("fully purged")} ${ui.dim("\u2014 settings backups (*.bak) were left as a safety net.")}`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
uninstall
|
|
42
|
+
};
|
package/dist/vdp.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
ui
|
|
4
|
+
} from "./chunk-LKE6H3YG.js";
|
|
5
|
+
|
|
6
|
+
// src/cli.ts
|
|
7
|
+
var VERSION = "1.0.0";
|
|
8
|
+
function helpText() {
|
|
9
|
+
const row = (cmd, desc) => ` ${ui.accent(`vdp ${cmd}`.padEnd(16))} ${ui.dim(desc)}`;
|
|
10
|
+
return [
|
|
11
|
+
`${ui.title("vdp")} ${ui.dim("\u2014 vibecoder-discord-presence")}`,
|
|
12
|
+
"",
|
|
13
|
+
ui.bold("Usage:"),
|
|
14
|
+
row("install", "Add Claude Code hooks (~/.claude/settings.json)"),
|
|
15
|
+
row("stop", "Stop the running daemon"),
|
|
16
|
+
row("restart", "Restart the daemon"),
|
|
17
|
+
row("uninstall", "Remove hooks, stop the daemon, restore settings"),
|
|
18
|
+
row("uninstall --purge", "Also delete all vdp data (config, markers)"),
|
|
19
|
+
row("config", "Customize your Discord presence (interactive)"),
|
|
20
|
+
row("status", "Show install, daemon, and Discord connection state"),
|
|
21
|
+
row("--version", "Print version"),
|
|
22
|
+
row("--help", "Show this help"),
|
|
23
|
+
""
|
|
24
|
+
].join("\n");
|
|
25
|
+
}
|
|
26
|
+
async function run(argv) {
|
|
27
|
+
const [command, ...rest] = argv;
|
|
28
|
+
switch (command) {
|
|
29
|
+
case "install":
|
|
30
|
+
return (await import("./install-PS6R32NO.js")).install(rest);
|
|
31
|
+
case "stop":
|
|
32
|
+
return (await import("./stop-GI5PLZ4I.js")).stop(rest);
|
|
33
|
+
case "restart":
|
|
34
|
+
return (await import("./restart-4QW7NSWI.js")).restart(rest);
|
|
35
|
+
case "uninstall":
|
|
36
|
+
return (await import("./uninstall-APXX4WCS.js")).uninstall(rest);
|
|
37
|
+
case "config":
|
|
38
|
+
return (await import("./config-GLQUOMQ6.js")).config(rest);
|
|
39
|
+
case "status":
|
|
40
|
+
return (await import("./status-4L4TX5GV.js")).status(rest);
|
|
41
|
+
case "hook":
|
|
42
|
+
return (await import("./claude-code-Y5EVVTMQ.js")).runHook(rest);
|
|
43
|
+
case "daemon":
|
|
44
|
+
return (await import("./daemon-UR7HFYY7.js")).startDaemon(rest);
|
|
45
|
+
case "--version":
|
|
46
|
+
case "-v":
|
|
47
|
+
console.log(VERSION);
|
|
48
|
+
return;
|
|
49
|
+
case void 0:
|
|
50
|
+
case "--help":
|
|
51
|
+
case "-h":
|
|
52
|
+
console.log(helpText());
|
|
53
|
+
return;
|
|
54
|
+
default:
|
|
55
|
+
console.error(`${ui.err("Unknown command:")} ${command}
|
|
56
|
+
`);
|
|
57
|
+
console.log(helpText());
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// bin/vdp.ts
|
|
63
|
+
run(process.argv.slice(2)).catch((err) => {
|
|
64
|
+
console.error(err instanceof Error ? err.message : err);
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vibecoder-discord-presence",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Show your Claude Code activity on Discord as Rich Presence — privacy-first and themeable.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vdp": "dist/vdp.js"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=18"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"assets",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"dev": "tsx bin/vdp.ts",
|
|
21
|
+
"start": "node dist/vdp.js",
|
|
22
|
+
"test": "node --import tsx --test \"test/**/*.test.ts\"",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"lint": "eslint .",
|
|
25
|
+
"format": "prettier --write .",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"discord",
|
|
30
|
+
"rich-presence",
|
|
31
|
+
"claude-code",
|
|
32
|
+
"claude",
|
|
33
|
+
"cli",
|
|
34
|
+
"presence",
|
|
35
|
+
"vibecoder"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"author": "Younesfdj",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/younesfdj/vibecoder-discord-presence.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/younesfdj/vibecoder-discord-presence#readme",
|
|
44
|
+
"bugs": "https://github.com/younesfdj/vibecoder-discord-presence/issues",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@inquirer/prompts": "^8.5.2",
|
|
47
|
+
"@xhayper/discord-rpc": "^1.3.1",
|
|
48
|
+
"picocolors": "^1.1.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@eslint/js": "^9.0.0",
|
|
52
|
+
"@types/node": "^25.9.1",
|
|
53
|
+
"eslint": "^9.0.0",
|
|
54
|
+
"globals": "^15.0.0",
|
|
55
|
+
"prettier": "^3.0.0",
|
|
56
|
+
"tsup": "^8.5.1",
|
|
57
|
+
"tsx": "^4.22.4",
|
|
58
|
+
"typescript": "^6.0.3",
|
|
59
|
+
"typescript-eslint": "^8.60.1"
|
|
60
|
+
}
|
|
61
|
+
}
|