tanuki-telemetry 1.2.0 → 1.3.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/dist/cli.js CHANGED
@@ -1,12 +1,78 @@
1
1
  #!/usr/bin/env node
2
2
  import { setup } from "./setup.js";
3
3
  import { start, stop, status } from "./commands.js";
4
+ import { readFile } from "node:fs/promises";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { execSync } from "node:child_process";
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ async function getLocalVersion() {
10
+ const pkg = JSON.parse(await readFile(join(__dirname, "..", "package.json"), "utf-8"));
11
+ return pkg.version;
12
+ }
13
+ async function getLatestVersion() {
14
+ try {
15
+ const result = execSync("npm view tanuki-telemetry version 2>/dev/null", {
16
+ encoding: "utf-8",
17
+ timeout: 5000,
18
+ }).trim();
19
+ return result || null;
20
+ }
21
+ catch {
22
+ return null;
23
+ }
24
+ }
25
+ async function checkForUpdates() {
26
+ const [local, latest] = await Promise.all([getLocalVersion(), getLatestVersion()]);
27
+ if (!latest)
28
+ return; // Can't reach registry, skip silently
29
+ if (local !== latest) {
30
+ console.log(`\n ⬆ Update available: ${local} → ${latest}`);
31
+ console.log(` Run: npx tanuki-telemetry@latest setup\n`);
32
+ }
33
+ }
34
+ async function update() {
35
+ const local = await getLocalVersion();
36
+ const latest = await getLatestVersion();
37
+ console.log(`\ntanuki-telemetry update`);
38
+ console.log(` Local: ${local}`);
39
+ console.log(` Latest: ${latest ?? "unknown"}\n`);
40
+ if (latest && local === latest) {
41
+ console.log(" Already up to date.\n");
42
+ }
43
+ // 1. Update command templates
44
+ console.log(" Updating command templates...");
45
+ const { installAllTemplateCommands } = await import("./setup.js");
46
+ if (typeof installAllTemplateCommands === "function") {
47
+ await installAllTemplateCommands();
48
+ }
49
+ // 2. Rebuild Docker image
50
+ console.log(" Rebuilding Docker image...");
51
+ try {
52
+ execSync("docker compose -f ~/.claude/mcp-servers/telemetry/docker-compose.yml build --no-cache 2>&1", { stdio: "inherit", timeout: 300000 });
53
+ }
54
+ catch {
55
+ console.log(" Docker rebuild failed — is Docker running?");
56
+ return;
57
+ }
58
+ // 3. Restart container
59
+ console.log(" Restarting dashboard...");
60
+ try {
61
+ execSync("docker compose -f ~/.claude/mcp-servers/telemetry/docker-compose.yml up dashboard -d 2>&1", { stdio: "inherit", timeout: 60000 });
62
+ }
63
+ catch {
64
+ console.log(" Restart failed — try manually: docker compose up dashboard -d");
65
+ return;
66
+ }
67
+ console.log("\n Update complete! Dashboard at http://localhost:3333\n");
68
+ }
4
69
  const command = process.argv[2];
5
70
  const commands = {
6
71
  setup: () => setup(),
7
72
  start: () => start(),
8
73
  stop: () => stop(),
9
74
  status: () => status(),
75
+ update: () => update(),
10
76
  };
11
77
  const handler = commands[command];
12
78
  if (handler) {
@@ -16,17 +82,21 @@ if (handler) {
16
82
  });
17
83
  }
18
84
  else {
19
- console.log(`
20
- @junior/telemetry-mcp Local Telemetry MCP for Claude Code
85
+ // Show help + version check
86
+ checkForUpdates().then(() => {
87
+ console.log(`
88
+ tanuki-telemetry — Telemetry MCP for Claude Code
21
89
 
22
90
  Usage:
23
- npx @junior/telemetry-mcp setup Interactive setup wizard (local Docker)
24
- npx @junior/telemetry-mcp start Start the telemetry dashboard
25
- npx @junior/telemetry-mcp stop Stop the telemetry dashboard
26
- npx @junior/telemetry-mcp status Check container health
91
+ npx tanuki-telemetry setup Interactive setup wizard
92
+ npx tanuki-telemetry start Start the dashboard
93
+ npx tanuki-telemetry stop Stop the dashboard
94
+ npx tanuki-telemetry status Check container health
95
+ npx tanuki-telemetry update Update templates + rebuild Docker
27
96
  `);
28
- if (command && command !== "--help" && command !== "-h") {
29
- console.error(`Unknown command: ${command}`);
30
- process.exit(1);
31
- }
97
+ if (command && command !== "--help" && command !== "-h") {
98
+ console.error(`Unknown command: ${command}`);
99
+ process.exit(1);
100
+ }
101
+ });
32
102
  }
package/dist/setup.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export declare function setup(): Promise<void>;
2
+ export declare function installAllTemplateCommands(): Promise<void>;
package/dist/setup.js CHANGED
@@ -259,7 +259,7 @@ async function installCompareImageCommand() {
259
259
  await writeFile(destPath, template);
260
260
  console.log(" /compare-image command installed");
261
261
  }
262
- async function installAllTemplateCommands() {
262
+ export async function installAllTemplateCommands() {
263
263
  await mkdir(COMMANDS_DIR, { recursive: true });
264
264
  const templatesDir = join(__dirname, "..", "templates");
265
265
  // Commands already handled by dedicated installers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tanuki-telemetry",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Local installer for Telemetry MCP server — setup, start, stop, and status for Claude Code autonomous workflows",
5
5
  "type": "module",
6
6
  "bin": {