@ohmaseclaro/fleetwatch 0.1.0 → 0.1.2

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.
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
- import { existsSync } from "node:fs";
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { createRequire } from "node:module";
5
6
  import { loadEnv, envFlag, envString } from "./env.js";
6
7
  // Load .env BEFORE any other module reads process.env.
7
8
  loadEnv();
@@ -15,7 +16,37 @@ import { startTunnel, stopTunnel, activeTunnel } from "./tunnel.js";
15
16
  import { initAuth, isPasswordRequired } from "./auth.js";
16
17
  import { findNgrokAuthtoken } from "./ngrokConfig.js";
17
18
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
- const AGENT_VERSION = "0.1.0";
19
+ /**
20
+ * Resolve the package version at runtime so it's always in sync with
21
+ * package.json — no more hard-coded version drift between npm releases
22
+ * and the CLI banner / `--help` output.
23
+ */
24
+ function readPackageVersion() {
25
+ // Look upward from dist/server for the nearest package.json. When run from
26
+ // an installed location (node_modules/@scope/pkg/dist/server/index.js) this
27
+ // finds the package's own manifest.
28
+ for (const candidate of [
29
+ path.join(__dirname, "..", "..", "package.json"), // dist/server → pkg root
30
+ path.join(__dirname, "..", "package.json"), // when bundled differently
31
+ ]) {
32
+ try {
33
+ const raw = readFileSync(candidate, "utf8");
34
+ const pkg = JSON.parse(raw);
35
+ if (pkg.version)
36
+ return pkg.version;
37
+ }
38
+ catch { }
39
+ }
40
+ // Last-resort fallback: createRequire so users running via tsx still work.
41
+ try {
42
+ const req = createRequire(import.meta.url);
43
+ return req("../../package.json").version;
44
+ }
45
+ catch {
46
+ return "0.0.0";
47
+ }
48
+ }
49
+ const AGENT_VERSION = readPackageVersion();
19
50
  function parseArgs(argv) {
20
51
  const args = {
21
52
  port: parseInt(process.env.PORT ?? "7878", 10),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmaseclaro/fleetwatch",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Watch every Claude Code, Cowork, and Cursor session from your phone — multi-provider agent observability with live updates over LAN or ngrok.",
6
6
  "keywords": [