kubeagent 0.1.36 → 0.1.43

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/telemetry.js CHANGED
@@ -1,9 +1,34 @@
1
- import { existsSync, writeFileSync, mkdirSync } from "node:fs";
1
+ import { existsSync, writeFileSync, mkdirSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { homedir, platform, arch } from "node:os";
4
+ import { randomUUID } from "node:crypto";
4
5
  const TELEMETRY_DIR = join(homedir(), ".kubeagent");
5
6
  const SENT_FILE = join(TELEMETRY_DIR, ".telemetry-sent");
7
+ const MACHINE_ID_FILE = join(TELEMETRY_DIR, ".machine-id");
6
8
  const SERVER = "https://api.kubeagent.net";
9
+ /**
10
+ * Stable, anonymous per-machine ID. Used as the PostHog distinct_id for CLI
11
+ * events so install→auth→first-run funnels stitch together across invocations.
12
+ * Not tied to any user identity until the CLI logs in (server-side alias).
13
+ */
14
+ function getOrCreateMachineId() {
15
+ try {
16
+ if (!existsSync(TELEMETRY_DIR))
17
+ mkdirSync(TELEMETRY_DIR, { recursive: true });
18
+ if (existsSync(MACHINE_ID_FILE)) {
19
+ const id = readFileSync(MACHINE_ID_FILE, "utf8").trim();
20
+ if (id)
21
+ return id;
22
+ }
23
+ const id = randomUUID();
24
+ writeFileSync(MACHINE_ID_FILE, id);
25
+ return id;
26
+ }
27
+ catch {
28
+ // If we cannot persist, return an ephemeral id — better than nothing.
29
+ return randomUUID();
30
+ }
31
+ }
7
32
  export function sendTelemetry(cliVersion) {
8
33
  // Only fire once per machine
9
34
  if (existsSync(SENT_FILE))
@@ -24,6 +49,7 @@ export function sendTelemetry(cliVersion) {
24
49
  os: platform(),
25
50
  arch: arch(),
26
51
  nodeVersion: process.version,
52
+ machineId: getOrCreateMachineId(),
27
53
  });
28
54
  fetch(`${SERVER}/telemetry`, {
29
55
  method: "POST",
package/package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "kubeagent",
3
- "version": "0.1.36",
3
+ "version": "0.1.43",
4
4
  "description": "AI-powered Kubernetes management CLI",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kubeagent-net/KubeAgent.git"
9
+ },
10
+ "homepage": "https://kubeagent.net",
11
+ "bugs": {
12
+ "url": "https://github.com/kubeagent-net/KubeAgent/issues"
13
+ },
6
14
  "type": "module",
7
15
  "bin": {
8
16
  "kubeagent": "./dist/cli.js"
@@ -24,6 +32,7 @@
24
32
  "engines": {
25
33
  "node": ">=22"
26
34
  },
35
+ "packageManager": "npm@11.16.0",
27
36
  "dependencies": {
28
37
  "@anthropic-ai/sdk": "^0.81.0",
29
38
  "chalk": "^5.4.0",