@gajae-gateway/cli 0.1.5 → 0.1.7

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/main.js CHANGED
@@ -2147,7 +2147,7 @@ import { basename, dirname, join as join8 } from "path";
2147
2147
  // package.json
2148
2148
  var package_default = {
2149
2149
  name: "@gajae-gateway/cli",
2150
- version: "0.1.5",
2150
+ version: "0.1.7",
2151
2151
  type: "module",
2152
2152
  description: "Owner CLI for the gajaeway gateway: status, sessions, chat, monitors, and worker lanes over the gateway socket. Requires the Bun runtime (uses Bun.file/Bun.spawn).",
2153
2153
  license: "AGPL-3.0-only",
@@ -2502,20 +2502,20 @@ function isProcessAlive(pid) {
2502
2502
 
2503
2503
  // src/upgrade.ts
2504
2504
  import { readFile as readFile7 } from "fs/promises";
2505
- import { join as join9 } from "path";
2505
+ import { dirname as dirname2, join as join9 } from "path";
2506
2506
  async function readGatewayPinnedGjcVersion(home) {
2507
- try {
2508
- const packageJsonPath = join9(home, "..", "..", "packages", "gateway", "package.json");
2509
- const content = await readFile7(packageJsonPath, "utf-8");
2510
- const pkg = JSON.parse(content);
2511
- const version = pkg.gjc?.version;
2512
- if (!version || typeof version !== "string") {
2513
- throw new Error("gjc.version not found in gateway package.json");
2514
- }
2515
- return version;
2516
- } catch (error) {
2517
- throw new Error(`Failed to read pinned GJC version: ${error instanceof Error ? error.message : String(error)}`);
2507
+ const candidates = [
2508
+ join9(home, "..", "..", "packages", "gateway", "package.json"),
2509
+ join9(dirname2(process.execPath), "package.json")
2510
+ ];
2511
+ for (const path of candidates) {
2512
+ try {
2513
+ const version = JSON.parse(await readFile7(path, "utf-8")).gjc?.version;
2514
+ if (typeof version === "string" && version.length > 0)
2515
+ return version;
2516
+ } catch {}
2518
2517
  }
2518
+ throw new Error(`Failed to read pinned GJC version from any of ${candidates.join(", ")}`);
2519
2519
  }
2520
2520
  async function checkLatestCiStatus(repo) {
2521
2521
  try {
package/dist/upgrade.d.ts CHANGED
@@ -23,7 +23,14 @@ export interface UpgradeOptions {
23
23
  /** Test seam: function to read gateway pinned gjc version */
24
24
  readonly readPinnedVersion?: (home: string) => Promise<string>;
25
25
  }
26
- /** Read the pinned gjc version from the gateway's package.json */
26
+ /**
27
+ * Read the pinned gjc version the installed gateway runs against.
28
+ *
29
+ * The checkout layout is tried first (a source deployment keeps the pin in
30
+ * `packages/gateway/package.json`); an installed binary carries the same file
31
+ * beside itself, which is the only candidate that exists on a host that never
32
+ * had the checkout.
33
+ */
27
34
  export declare function readGatewayPinnedGjcVersion(home: string): Promise<string>;
28
35
  export interface UpgradeResult {
29
36
  readonly status: "ok" | "failed";
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,6DAA6D;IAC7D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/D;AAED,kEAAkE;AAClE,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe/E;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AA2DD,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAwFpF"}
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,6DAA6D;IAC7D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/D;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAc/E;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AA2DD,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAwFpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gajae-gateway/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "Owner CLI for the gajaeway gateway: status, sessions, chat, monitors, and worker lanes over the gateway socket. Requires the Bun runtime (uses Bun.file/Bun.spawn).",
6
6
  "license": "AGPL-3.0-only",
@@ -41,8 +41,8 @@
41
41
  "prepublishOnly": "bun run build"
42
42
  },
43
43
  "dependencies": {
44
- "@gajae-gateway/sdk": "0.1.5",
45
- "@gajae-gateway/protocol": "0.1.5"
44
+ "@gajae-gateway/sdk": "0.1.7",
45
+ "@gajae-gateway/protocol": "0.1.7"
46
46
  },
47
47
  "engines": {
48
48
  "bun": ">=1.4.0"
package/src/upgrade.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { readFile } from "node:fs/promises";
2
- import { join } from "node:path";
2
+ import { dirname, join } from "node:path";
3
3
 
4
4
  /**
5
5
  * `gajaeway ops upgrade [--gjc X.Y.Z]`
@@ -28,22 +28,28 @@ export interface UpgradeOptions {
28
28
  readonly readPinnedVersion?: (home: string) => Promise<string>;
29
29
  }
30
30
 
31
- /** Read the pinned gjc version from the gateway's package.json */
31
+ /**
32
+ * Read the pinned gjc version the installed gateway runs against.
33
+ *
34
+ * The checkout layout is tried first (a source deployment keeps the pin in
35
+ * `packages/gateway/package.json`); an installed binary carries the same file
36
+ * beside itself, which is the only candidate that exists on a host that never
37
+ * had the checkout.
38
+ */
32
39
  export async function readGatewayPinnedGjcVersion(home: string): Promise<string> {
33
- try {
34
- // The gateway package.json should be in the same location as the gateway binary
35
- // For now, we'll look in the gajaeway installation
36
- const packageJsonPath = join(home, "..", "..", "packages", "gateway", "package.json");
37
- const content = await readFile(packageJsonPath, "utf-8");
38
- const pkg = JSON.parse(content);
39
- const version = pkg.gjc?.version;
40
- if (!version || typeof version !== "string") {
41
- throw new Error("gjc.version not found in gateway package.json");
42
- }
43
- return version;
44
- } catch (error) {
45
- throw new Error(`Failed to read pinned GJC version: ${error instanceof Error ? error.message : String(error)}`);
40
+ const candidates = [
41
+ join(home, "..", "..", "packages", "gateway", "package.json"),
42
+ join(dirname(process.execPath), "package.json"),
43
+ ];
44
+ for (const path of candidates) {
45
+ try {
46
+ const version = (JSON.parse(await readFile(path, "utf-8")) as { gjc?: { version?: unknown } }).gjc?.version;
47
+ if (typeof version === "string" && version.length > 0) return version;
48
+ } catch {
49
+ // A missing or malformed candidate is not fatal: a later one may carry the pin.
50
+ }
46
51
  }
52
+ throw new Error(`Failed to read pinned GJC version from any of ${candidates.join(", ")}`);
47
53
  }
48
54
 
49
55
  export interface UpgradeResult {