@bulletproof-sh/ctrl-daemon 0.0.1 → 0.0.3
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 +74 -0
- package/bin/ctrl-daemon.js +1 -1
- package/dist/index.js +4326 -3
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @bulletproof-sh/ctrl-daemon
|
|
2
|
+
|
|
3
|
+
WebSocket daemon for [Ctrl / Cubicles](https://bulletproof.sh) — watches Claude Code sessions on disk and broadcasts live agent state to connected web clients.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- [Bun](https://bun.sh) — required at runtime (`curl -fsSL https://bun.sh/install | bash`)
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
# Watch all Claude Code projects (default)
|
|
13
|
+
npx @bulletproof-sh/ctrl-daemon
|
|
14
|
+
|
|
15
|
+
# Watch a single project directory
|
|
16
|
+
npx @bulletproof-sh/ctrl-daemon --project-dir /path/to/your/project
|
|
17
|
+
|
|
18
|
+
# Custom port / host
|
|
19
|
+
npx @bulletproof-sh/ctrl-daemon --port 3001 --host 127.0.0.1
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Options
|
|
23
|
+
|
|
24
|
+
| Flag | Default | Description |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `--port <number>` | `3001` | Port to listen on |
|
|
27
|
+
| `--host <address>` | `0.0.0.0` | Host/address to bind to |
|
|
28
|
+
| `--project-dir <path>` | — | Watch a single project; omit to watch all projects |
|
|
29
|
+
| `--help`, `-h` | — | Print usage |
|
|
30
|
+
|
|
31
|
+
Without `--project-dir`, the daemon scans `~/.claude/projects/` and watches every session it finds there.
|
|
32
|
+
|
|
33
|
+
## WebSocket API
|
|
34
|
+
|
|
35
|
+
Connect to `ws://localhost:3001/ws`. The daemon broadcasts JSON messages whenever agent state changes — the same message format used by the VS Code extension's internal webview protocol.
|
|
36
|
+
|
|
37
|
+
The [Ctrl web app](https://ctrl.bulletproof.sh) connects here by default. You can change the URL in the app's Settings modal or by setting `VITE_DAEMON_WS_URL` at build time.
|
|
38
|
+
|
|
39
|
+
## Environment Variables
|
|
40
|
+
|
|
41
|
+
| Variable | Description |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `VITE_PUBLIC_POSTHOG_KEY` | PostHog API key for analytics (optional) |
|
|
44
|
+
| `VITE_PUBLIC_POSTHOG_HOST` | PostHog host (default: `https://us.i.posthog.com`) |
|
|
45
|
+
| `CLAUDE_HOME` | Override the Claude home directory (default: `~/.claude`) |
|
|
46
|
+
|
|
47
|
+
Analytics are disabled when `VITE_PUBLIC_POSTHOG_KEY` is not set. Crash reports use PostHog Error Tracking (free feature).
|
|
48
|
+
|
|
49
|
+
## Auto-update
|
|
50
|
+
|
|
51
|
+
On startup the daemon checks npm for a newer version and prints a notice if one is available:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
[ctrl-daemon] Update available: v0.0.2 → v0.0.3
|
|
55
|
+
Run: npm install -g @bulletproof-sh/ctrl-daemon@latest
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The check is non-blocking and fails silently if the registry is unreachable.
|
|
59
|
+
|
|
60
|
+
> **Note:** If you're running via `npx`, you already get the latest version on every invocation — no manual update needed.
|
|
61
|
+
|
|
62
|
+
## Development
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
bun install
|
|
66
|
+
bun run dev # watch mode
|
|
67
|
+
bun run build # compile to dist/
|
|
68
|
+
bun run check # biome lint + format
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
|
74
|
+
|
package/bin/ctrl-daemon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execFileSync } from "node:child_process";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
3
|
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
const entry = join(__dirname, "..", "dist", "index.js");
|