@pmate/cli 0.29.9 → 0.29.11

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
@@ -2,6 +2,12 @@
2
2
 
3
3
  A TypeScript-powered command-line tool scaffold for future pMate automation.
4
4
 
5
+ ## Deploy from an isolated checkout
6
+
7
+ Local-build services can be released without modifying the conventional `~/dev/pmate` checkout. Use `pmate service deploy pmate:<service> --env prod --cwd /absolute/path/to/repo` for Vite, static or FC services. The registered service directory is resolved relative to that repository root; `--cwd` does not change the service's registered repository or environment.
8
+
9
+ Remote Node/Python/Rust deployments still use the registered repository and reject `--cwd` instead of silently ignoring it. Merge and push the intended release to `main` before deployment. The normal service deploy-history and log flow is unchanged.
10
+
5
11
  ## Development
6
12
 
7
13
  ```bash
package/dist/index.d.ts CHANGED
@@ -942,6 +942,7 @@ type ServiceCommandArgs = {
942
942
  namespace: string;
943
943
  name: string;
944
944
  env?: string;
945
+ cwd?: string;
945
946
  baseUrl?: string;
946
947
  json: boolean;
947
948
  } | {
package/dist/index.js CHANGED
@@ -18866,6 +18866,9 @@ var ServiceRuntimeRunner = class {
18866
18866
  this.envProvider = envProvider;
18867
18867
  }
18868
18868
  async deploy(service, options = {}) {
18869
+ if (options.cwd && !["vite", "static", "fc"].includes(this.getType(service))) {
18870
+ throw new Error("--cwd is only supported for local-build vite, static and fc services; remote deployments use the registered repository");
18871
+ }
18869
18872
  switch (this.getType(service)) {
18870
18873
  case "node-api":
18871
18874
  await this.deployNode(service, options);
@@ -19165,8 +19168,8 @@ var ServiceRuntimeRunner = class {
19165
19168
  async deployFc(service, options = {}) {
19166
19169
  const fc = this.getFc(service);
19167
19170
  this.validateFcConfig(service, fc);
19168
- const repoRoot = this.resolveRepoRoot(service);
19169
- const appDir = this.resolveLocalDir(service);
19171
+ const repoRoot = this.resolveRepoRoot(service, options.cwd);
19172
+ const appDir = this.resolveLocalDir(service, options.cwd);
19170
19173
  const packageJsonPath = import_node_path25.default.join(appDir, "package.json");
19171
19174
  if (!(0, import_node_fs20.existsSync)(packageJsonPath)) {
19172
19175
  throw new Error(`No package.json found at ${packageJsonPath}`);
@@ -19374,7 +19377,7 @@ var ServiceRuntimeRunner = class {
19374
19377
  const gitUrl = this.withToken(repoUrl);
19375
19378
  const scriptPath = script.startsWith("/") || script.startsWith("./") ? script : `./${script}`;
19376
19379
  const envName = options.envName ?? "prod";
19377
- const envSyncCommand = await this.buildScriptEnvSyncCommand(service.id, envName, server);
19380
+ const envSyncCommand = server === "local" ? void 0 : await this.buildScriptEnvSyncCommand(service.id, envName, server);
19378
19381
  const command = [
19379
19382
  `cd "$HOME"`,
19380
19383
  `[ -d "${repoDir}/.git" ] || git clone "${gitUrl}" "${repoDir}"`,
@@ -19409,7 +19412,7 @@ var ServiceRuntimeRunner = class {
19409
19412
  const repoDir = this.getRepoDirName(repository);
19410
19413
  const scriptPath = script.startsWith("/") || script.startsWith("./") ? script : `./${script}`;
19411
19414
  const envName = options.envName ?? "prod";
19412
- const envSyncCommand = await this.buildScriptEnvSyncCommand(service.id, envName, server);
19415
+ const envSyncCommand = server === "local" ? void 0 : await this.buildScriptEnvSyncCommand(service.id, envName, server);
19413
19416
  const command = [
19414
19417
  `cd "$HOME"`,
19415
19418
  `cd "${repoDir}"`,
@@ -20480,7 +20483,7 @@ var ServiceCommandHandler = class {
20480
20483
  const record = await registry.getService(args.namespace, args.name);
20481
20484
  const service = await this.materializeServiceEnv(registry, record, args.env);
20482
20485
  try {
20483
- await runtime.deploy(service, { envName: args.env });
20486
+ await runtime.deploy(service, { envName: args.env, ...args.cwd ? { cwd: args.cwd } : {} });
20484
20487
  await this.appendDeployHistory(registry, record.id, args.env, "success");
20485
20488
  } catch (error) {
20486
20489
  await this.appendDeployHistory(
@@ -23778,7 +23781,7 @@ function parseServiceArgs(tokens) {
23778
23781
  baseUrl = requireValue4(rest, token);
23779
23782
  break;
23780
23783
  case "--cwd":
23781
- if (action !== "init") {
23784
+ if (action !== "init" && action !== "deploy") {
23782
23785
  throw new Error(`Unknown service ${action} option: ${token}`);
23783
23786
  }
23784
23787
  cwd = requireValue4(rest, token);
@@ -23822,7 +23825,7 @@ function parseServiceArgs(tokens) {
23822
23825
  if (action === "deploy" && !env) {
23823
23826
  throw new Error("Missing required option --env for service deploy");
23824
23827
  }
23825
- return { type: "service" /* Service */, action, namespace, name, env, baseUrl, json };
23828
+ return { type: "service" /* Service */, action, namespace, name, env, ...cwd ? { cwd } : {}, baseUrl, json };
23826
23829
  }
23827
23830
  if (action === "init") {
23828
23831
  if (!env) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.29.9",
3
+ "version": "0.29.11",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -11,16 +11,6 @@
11
11
  "files": [
12
12
  "dist"
13
13
  ],
14
- "scripts": {
15
- "build": "npm run clean && tsup --config tsup.config.ts && node scripts/copy-templates.js",
16
- "clean": "rimraf dist",
17
- "dev": "ts-node src/index.ts",
18
- "release": "pnpm publish",
19
- "start": "node dist/index.js",
20
- "test": "vitest run src/tests",
21
- "typecheck": "tsc --noEmit",
22
- "prepare": "npm run build"
23
- },
24
14
  "keywords": [
25
15
  "cli",
26
16
  "typescript",
@@ -67,10 +57,13 @@
67
57
  "typescript": "^5.9.3",
68
58
  "vitest": "^4.0.17"
69
59
  },
70
- "pnpm": {
71
- "overrides": {
72
- "@pmate/meta": "^1.3.1",
73
- "@pmate/utils": "^1.1.4"
74
- }
60
+ "scripts": {
61
+ "build": "npm run clean && tsup --config tsup.config.ts && node scripts/copy-templates.js",
62
+ "clean": "rimraf dist",
63
+ "dev": "ts-node src/index.ts",
64
+ "release": "pnpm publish",
65
+ "start": "node dist/index.js",
66
+ "test": "vitest run src/tests",
67
+ "typecheck": "tsc --noEmit"
75
68
  }
76
- }
69
+ }