@pmate/cli 0.50.3 → 0.50.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.
package/README.md CHANGED
@@ -444,3 +444,5 @@ The response remains a JSON array with `account`, `profiles`, and `nickNames`. B
444
444
  Migration: callers relying on the old aggregated `roles`, `session`, full profiles or implicit mobile must use the appropriate resource API or explicitly request private fields. Account list and app-users remain privileged administration commands and retain their existing contracts. Deploy the updated auth API before using these CLI options.
445
445
 
446
446
  For `ssh-pm2` environments, optional `runtime.cwd` is the dedicated remote repository checkout root (the service `dir` remains relative to it). Use a separate path per service/environment, for example `/home/pmate/.pmate/service-deploy/deneb-api-preview`. It must be an absolute path without traversal. This opt-in flow refuses dirty checkouts and fast-forwards to published `origin/main`; it never resets or cleans local edits. Environments without `runtime.cwd` retain their existing deployment behavior.
447
+
448
+ Registry versions that omit `runtime.cwd` for ssh-pm2 can select the same isolated checkout using an absolute `runtime.ecosystemFile`, ending in `/<service dir>/ecosystem.config.cjs`. The CLI derives the repository root from this exact suffix. Read back the registered environment before deployment; never assume a submitted optional field was retained.
package/dist/index.js CHANGED
@@ -18724,6 +18724,15 @@ function readNamespaceFromPayload(payload) {
18724
18724
  return namespace.trim().toLowerCase();
18725
18725
  }
18726
18726
 
18727
+ // src/services/ManualInfraRouting.ts
18728
+ function usesManualInfraRouting(service) {
18729
+ const id = service.id ?? `${service.namespace}:${service.name}`;
18730
+ if (/^pmate:(?:blockchain|(?:[a-z0-9-]+-)?indexer|qablk01|qaidx)$/.test(id)) return true;
18731
+ const repository = service.repository ?? service.network?.repository;
18732
+ return repository === "parrot-mate/pmate-rust" && /(?:^|\/)infra\/scripts\/(?:blockchain|(?:[a-z0-9-]+-)?indexer)(?:\.[a-z0-9-]+)?$/.test(service.runner?.script ?? "");
18733
+ }
18734
+ var MANUAL_INFRA_ROUTING_MESSAGE = "Indexer/Blockchain ingress is managed manually. Edit the versioned Nginx configuration, run nginx -t, then reload Nginx separately.";
18735
+
18727
18736
  // src/commands/ServiceCommandHandler.ts
18728
18737
  var import_node_fs29 = require("fs");
18729
18738
  var import_promises5 = require("fs/promises");
@@ -21226,6 +21235,10 @@ var ServiceRuntimeRunner = class {
21226
21235
  return site;
21227
21236
  }
21228
21237
  async initServerApp(service, options, config) {
21238
+ if (usesManualInfraRouting(service)) {
21239
+ ui.info(MANUAL_INFRA_ROUTING_MESSAGE);
21240
+ return;
21241
+ }
21229
21242
  const network = this.getNetwork(service);
21230
21243
  const subdomain = "subdomain" in network ? network.subdomain?.trim() : void 0;
21231
21244
  const port = network.port;
@@ -22463,6 +22476,9 @@ var ServiceCommandHandler = class {
22463
22476
  return;
22464
22477
  }
22465
22478
  case "service-env-expose": {
22479
+ const [namespace, name] = args.appId.split(":");
22480
+ const service = await registry.getService(namespace, name);
22481
+ if (usesManualInfraRouting(service)) throw new Error(MANUAL_INFRA_ROUTING_MESSAGE);
22466
22482
  const payload = await this.request(
22467
22483
  baseUrl2,
22468
22484
  "POST",
@@ -22526,6 +22542,10 @@ var ServiceCommandHandler = class {
22526
22542
  };
22527
22543
  }
22528
22544
  if (runtime.type === "ssh-pm2") {
22545
+ const ecosystem = runtime.ecosystemFile?.trim();
22546
+ const suffix = `/${dir}/ecosystem.config.cjs`;
22547
+ const checkoutDir = runtime.cwd?.trim() || (ecosystem?.startsWith("/") && ecosystem.endsWith(suffix) ? ecosystem.slice(0, -suffix.length) : void 0);
22548
+ if (ecosystem?.startsWith("/") && !checkoutDir) throw new Error("Absolute ecosystemFile must match the service dir and ecosystem.config.cjs");
22529
22549
  return {
22530
22550
  id: service.id,
22531
22551
  namespace: service.namespace,
@@ -22536,7 +22556,7 @@ var ServiceCommandHandler = class {
22536
22556
  exposeType: env.network?.type === "websocket" ? "websocket" : env.network?.type === "mixed" ? "mixed" : env.network ? "rest" : "internal",
22537
22557
  repository,
22538
22558
  dir,
22539
- ...runtime.cwd?.trim() ? { checkoutDir: runtime.cwd.trim() } : {},
22559
+ ...checkoutDir ? { checkoutDir } : {},
22540
22560
  server: requireString(runtime.server, `runtime.server for ${service.id} ${env.name}`),
22541
22561
  ...runtime.port !== void 0 ? { port: runtime.port } : {},
22542
22562
  ...splitPrimaryDomain(env.network?.domain)
@@ -23005,6 +23025,10 @@ var ServiceCommandHandler = class {
23005
23025
  }
23006
23026
  }
23007
23027
  async deleteServerResources(service) {
23028
+ if (usesManualInfraRouting(service)) {
23029
+ ui.info(MANUAL_INFRA_ROUTING_MESSAGE);
23030
+ return;
23031
+ }
23008
23032
  const network = this.getNetworkConfig(service);
23009
23033
  const subdomain = network.subdomain?.trim();
23010
23034
  if (!subdomain) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.50.3",
3
+ "version": "0.50.5",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {