@bulletproof-sh/ctrl-daemon 0.0.3 → 0.0.5

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.
Files changed (3) hide show
  1. package/README.md +1 -3
  2. package/dist/index.js +18 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -40,11 +40,9 @@ The [Ctrl web app](https://ctrl.bulletproof.sh) connects here by default. You ca
40
40
 
41
41
  | Variable | Description |
42
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
43
  | `CLAUDE_HOME` | Override the Claude home directory (default: `~/.claude`) |
46
44
 
47
- Analytics are disabled when `VITE_PUBLIC_POSTHOG_KEY` is not set. Crash reports use PostHog Error Tracking (free feature).
45
+ Analytics are always enabled and use a built-in PostHog key — no configuration needed. Crash reports use PostHog Error Tracking.
48
46
 
49
47
  ## Auto-update
50
48
 
package/dist/index.js CHANGED
@@ -16,6 +16,10 @@ import * as path3 from "path";
16
16
  // src/analytics.ts
17
17
  import os from "os";
18
18
 
19
+ // ../shared/src/constants.ts
20
+ var DEFAULT_POSTHOG_KEY = "phc_V3aPfuu7VEWm1u4CEYLIFr8Ksk8nR7qyZzGn8HotO8U";
21
+ var DEFAULT_POSTHOG_HOST = "https://a.bulletproof.sh";
22
+
19
23
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
20
24
  import { dirname, posix, sep } from "path";
21
25
  function createModulerModifier() {
@@ -4210,18 +4214,20 @@ var systemInfo = {
4210
4214
  os_release: os.release(),
4211
4215
  node_version: process.version
4212
4216
  };
4213
- var POSTHOG_API_KEY = process.env.VITE_PUBLIC_POSTHOG_KEY ?? "phc_V3aPfuu7VEWm1u4CEYLIFr8Ksk8nR7qyZzGn8HotO8U";
4214
- var POSTHOG_HOST = process.env.VITE_PUBLIC_POSTHOG_HOST ?? "https://a.bulletproof.sh";
4217
+ var POSTHOG_API_KEY = process.env.VITE_PUBLIC_POSTHOG_KEY ?? DEFAULT_POSTHOG_KEY;
4218
+ var POSTHOG_HOST = process.env.VITE_PUBLIC_POSTHOG_HOST ?? DEFAULT_POSTHOG_HOST;
4219
+ var customKey = !!process.env.VITE_PUBLIC_POSTHOG_KEY;
4220
+ var customHost = !!process.env.VITE_PUBLIC_POSTHOG_HOST;
4215
4221
  var client = null;
4216
4222
  var distinctId = os.hostname();
4217
4223
  function initAnalytics() {
4218
- if (!POSTHOG_API_KEY)
4219
- return;
4220
- client = new PostHog(POSTHOG_API_KEY, { host: POSTHOG_HOST });
4221
- client.on("error", (err) => {
4222
- console.error("[ctrl-daemon] PostHog error:", err);
4223
- });
4224
- console.log("[ctrl-daemon] Analytics enabled");
4224
+ if (POSTHOG_API_KEY) {
4225
+ client = new PostHog(POSTHOG_API_KEY, { host: POSTHOG_HOST });
4226
+ client.on("error", (err) => {
4227
+ console.error("[ctrl-daemon] PostHog error:", err);
4228
+ });
4229
+ }
4230
+ return { customKey, customHost };
4225
4231
  }
4226
4232
  function trackEvent(event, properties) {
4227
4233
  if (!client)
@@ -4929,7 +4935,7 @@ function resolveProjectsRoot(claudeHome) {
4929
4935
  return path3.join(home, "projects");
4930
4936
  }
4931
4937
  async function main() {
4932
- initAnalytics();
4938
+ const analyticsConfig = initAnalytics();
4933
4939
  const [version2] = await Promise.all([getCurrentVersion(), checkForUpdate()]);
4934
4940
  process.on("uncaughtException", async (err) => {
4935
4941
  console.error("[ctrl-daemon] Uncaught exception:", err);
@@ -4968,7 +4974,8 @@ async function main() {
4968
4974
  port,
4969
4975
  host,
4970
4976
  mode: projectDir ? "single" : "all",
4971
- ...systemInfo
4977
+ ...systemInfo,
4978
+ ...analyticsConfig
4972
4979
  });
4973
4980
  const scanAll = !projectDir;
4974
4981
  const scanner = startProjectScanner(scanDirs[0], scanAll, agents, fileWatchers, pollingTimers, waitingTimers, permissionTimers, server.broadcast);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bulletproof-sh/ctrl-daemon",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "WebSocket daemon for ctrl — watches Claude Code sessions and broadcasts agent state",
5
5
  "type": "module",
6
6
  "license": "MIT",