@pmate/cli 0.49.0 → 0.49.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.
Files changed (2) hide show
  1. package/dist/index.js +38 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8884,6 +8884,27 @@ __export(index_exports, {
8884
8884
  });
8885
8885
  module.exports = __toCommonJS(index_exports);
8886
8886
 
8887
+ // src/serviceHelp.ts
8888
+ function serviceHelp(argv) {
8889
+ const end = argv.indexOf("--");
8890
+ const options = end < 0 ? argv : argv.slice(0, end);
8891
+ if (options[0] !== "service" || !options.some((value) => value === "--help" || value === "-h")) return;
8892
+ return `PMate service commands
8893
+ pmate service list [--namespace NS] [--repo OWNER/REPO] [--server NAME] [--json]
8894
+ pmate service get NS:SERVICE [--json]
8895
+ pmate service view NS:SERVICE
8896
+ pmate service create --file FILE [--json]
8897
+ pmate service update NS:SERVICE --file FILE [--json]
8898
+ pmate service deploy NS:SERVICE [--env prod] [--dry-run] [--json]
8899
+ pmate service log NS:SERVICE [--env prod] [--since-ms MS] [--page N] [--follow] [--json]
8900
+ pmate service stop NS:SERVICE [--json]
8901
+ Registry commands support --base-url URL. IDs identify Services, not Apps.
8902
+ Deploy uses the registered release configuration; read the current Service before mutations.
8903
+ Native deploy options: --platform mac|win --arch arm64|x64 --config FILE --scheme NAME --team ID --variant release|debug --bump patch|minor|major.
8904
+ Other service actions: rename, move, delete, init, ssl, env, env-vars, apk. Run pmate --help for their command catalogue.
8905
+ Help performs no login, registry request or deployment.`;
8906
+ }
8907
+
8887
8908
  // src/sessionCommand.ts
8888
8909
  init_sessionStore();
8889
8910
  function sessionCommand(args) {
@@ -21569,7 +21590,7 @@ var ServiceRuntimeRunner = class {
21569
21590
  writeRemoteConfig(server, content, remotePath) {
21570
21591
  return new Promise((resolve, reject) => {
21571
21592
  const target = `pmate@${server}`;
21572
- const child = (0, import_node_child_process15.spawn)("ssh", [target, "sudo", "tee", remotePath], {
21593
+ const child = (0, import_node_child_process15.spawn)("ssh", [...deploySshIdentityArgs(), target, "sudo", "tee", remotePath], {
21573
21594
  stdio: ["pipe", "inherit", "inherit"]
21574
21595
  });
21575
21596
  child.on("error", reject);
@@ -21584,7 +21605,7 @@ var ServiceRuntimeRunner = class {
21584
21605
  reloadNginx(server) {
21585
21606
  return new Promise((resolve, reject) => {
21586
21607
  const target = `pmate@${server}`;
21587
- const child = (0, import_node_child_process15.spawn)("ssh", [target, "sudo", "nginx", "-s", "reload"], {
21608
+ const child = (0, import_node_child_process15.spawn)("ssh", [...deploySshIdentityArgs(), target, "sudo", "nginx", "-s", "reload"], {
21588
21609
  stdio: ["ignore", "inherit", "inherit"]
21589
21610
  });
21590
21611
  child.on("error", reject);
@@ -21796,7 +21817,7 @@ var ServiceRuntimeRunner = class {
21796
21817
  if (server === "local") return this.runCommandWithEnv("bash", ["-c", command], import_node_os15.default.homedir());
21797
21818
  return new Promise((resolve, reject) => {
21798
21819
  const target = `pmate@${server}`;
21799
- const child = (0, import_node_child_process15.spawn)("ssh", [target, "bash -ls"], { stdio: ["pipe", "inherit", "inherit"] });
21820
+ const child = (0, import_node_child_process15.spawn)("ssh", [...deploySshIdentityArgs(), target, "bash -ls"], { stdio: ["pipe", "inherit", "inherit"] });
21800
21821
  child.stdin.on("error", reject);
21801
21822
  child.stdin.end(`${remoteGitAuthorization(command, process.env.PMATE_DEPLOY_GIT_TOKEN)}
21802
21823
  `);
@@ -21857,6 +21878,15 @@ function remoteGitAuthorization(command, token) {
21857
21878
  const values = { GIT_CONFIG_COUNT: "3", GIT_CONFIG_KEY_0: "url.https://github.com/.insteadOf", GIT_CONFIG_VALUE_0: "git@github.com:", GIT_CONFIG_KEY_1: "url.https://github.com/.insteadOf", GIT_CONFIG_VALUE_1: "git@ramroll:", GIT_CONFIG_KEY_2: "http.https://github.com/.extraHeader", GIT_CONFIG_VALUE_2: header };
21858
21879
  return "git() { " + Object.entries(values).map(([key, value]) => key + "=" + shellQuote2(value)).join(" ") + ' command git "$@"; }\n' + command;
21859
21880
  }
21881
+ function deploySshIdentityArgs(env = process.env) {
21882
+ const identity = env.PMATE_DEPLOY_SSH_IDENTITY_FILE?.trim();
21883
+ if (!identity) return [];
21884
+ const file = identity.startsWith("~/") ? import_node_path32.default.join(import_node_os15.default.homedir(), identity.slice(2)) : identity;
21885
+ if (!import_node_path32.default.isAbsolute(file) || !(0, import_node_fs27.existsSync)(file) || !(0, import_node_fs27.statSync)(file).isFile()) {
21886
+ throw new Error("PMATE_DEPLOY_SSH_IDENTITY_FILE must reference an existing absolute local file");
21887
+ }
21888
+ return ["-i", file, "-o", "IdentitiesOnly=yes", "-o", "BatchMode=yes"];
21889
+ }
21860
21890
 
21861
21891
  // src/commands/ServiceCommandHandler.ts
21862
21892
  init_namespacedRef();
@@ -29396,6 +29426,11 @@ async function main() {
29396
29426
  process.stdout.write(JSON.stringify(sessionCommand(process.argv.slice(3))) + "\n");
29397
29427
  return;
29398
29428
  }
29429
+ const help = serviceHelp(process.argv.slice(2));
29430
+ if (help) {
29431
+ ui.plain(help);
29432
+ return;
29433
+ }
29399
29434
  await ensureManagedSession();
29400
29435
  const args = parseArgs(process.argv.slice(2));
29401
29436
  if (args.help) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.49.0",
3
+ "version": "0.49.2",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {