@pmate/cli 0.40.0 → 0.41.1

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
@@ -320,7 +320,7 @@ A registration failure fails the release command, while preserving already uploa
320
320
 
321
321
  ### Android release signing
322
322
 
323
- `pmate service apk release <service> --env prod --variant release` resolves signing credentials from that service's server-side environment (host variables and local signing environment variables are not used). Configure `ANDROID_KEYSTORE_BASE64`, `ANDROID_KEYSTORE_PASSWORD`, `ANDROID_KEY_ALIAS`, and `ANDROID_KEY_PASSWORD` as Service Secrets, plus `ANDROID_SIGNING_CERT_SHA256` as the expected certificate fingerprint. Android SDK `apksigner` must be installed. The CLI signs the Gradle release APK and verifies its certificate before uploading; missing credentials, invalid signatures, or fingerprint mismatches stop publication. Keystore files use restricted temporary storage and are removed after signing. Existing apps must retain their compatible signing key. Debug builds keep their existing Gradle signing behavior.
323
+ `pmate service deploy <ns:android-service>` resolves signing credentials from that service's server-side environment (host variables and local signing environment variables are not used). Configure `ANDROID_KEYSTORE_BASE64`, `ANDROID_KEYSTORE_PASSWORD`, `ANDROID_KEY_ALIAS`, and `ANDROID_KEY_PASSWORD` as Service Secrets, plus `ANDROID_SIGNING_CERT_SHA256` as the expected certificate fingerprint. Android SDK `apksigner` must be installed. The CLI signs the Gradle release APK and verifies its certificate before uploading; missing credentials, invalid signatures, or fingerprint mismatches stop publication. Keystore files use restricted temporary storage and are removed after signing. Existing apps must retain their compatible signing key. Debug builds keep their existing Gradle signing behavior.
324
324
 
325
325
 
326
326
  ### iOS TestFlight builds
@@ -346,7 +346,7 @@ Sequences, retained archives, derived data and logs live in `~/.pmate/ios-builds
346
346
 
347
347
  ### Unified native service deployment
348
348
 
349
- Web, iOS and Electron use separate services. Deploy dispatches by registered type, without --target. For iOS store scheme/team and optional project/workspace under build; existing mobile bundle identity stays unchanged. Native deployment currently supports prod only. Override registered settings with --cwd, --scheme, --team, --project, --workspace or Electron-specific --config, --platform, --arch and --out-dir. Unsupported options fail explicitly. iOS --dry-run resolves the registered plan without running Xcode or uploading.
349
+ Web, iOS and Electron use separate services. Deploy dispatches by registered type, without --target. For iOS store scheme/team and optional project/workspace under build; existing mobile bundle identity stays unchanged. iOS and Electron deployment currently support prod only; Android supports dev/preview/prod. Override registered settings with --cwd, --scheme, --team, --project, --workspace or Electron-specific --config, --platform, --arch and --out-dir. Unsupported options fail explicitly. iOS --dry-run resolves the registered plan without running Xcode or uploading.
350
350
 
351
351
  ```sh
352
352
  pmate service deploy pmate:merry
@@ -356,3 +356,13 @@ pmate service deploy pmate:merry-electron --local --unsigned
356
356
  ```
357
357
 
358
358
  app build and service ios build were removed; use service deploy. Local and dry-run runs do not create successful deploy-history entries. iOS upload success is recorded as uploaded-processing, not TestFlight availability.
359
+
360
+ ### Android through service deploy
361
+
362
+ Android services use `pmate service deploy pmate:merry-android`. The primary service is pmate:merry-android. Its build.artifactServiceId is pmate:factory-android: APK paths and the legacy update manifest remain compatible with installed clients, which also restrict APK downloads to the old path. Production publishes identical latest.json to both the new service and legacy artifact identity. Package factory.pmate.app and signing identity are unchanged. Copy the existing signing secrets server-side when migrating. Service build settings accept variant (release/debug) and bump (patch/minor/major); defaults are release and patch. Production rejects debug variants. Android supports dev/preview/prod; preview does not update the production latest.json.
363
+
364
+ Use --variant, --bump, --force, --release-notes or --minimum-version-code to override release options. --dry-run prints the plan without incrementing versions, resolving signing secrets, building or uploading. Android currently does not support --local/--unsigned. service apk release was removed; service apk list remains a query.
365
+
366
+ HarmonyOS NEXT projects exist in parrot-native (apps/pmate-app-harmony and apps/time-duck-harmony). They currently use signed build scripts and a GitHub Actions workflow, not a registered PMate service type or automatic AppGallery submission.
367
+
368
+ Android production releases check the existing current and compatibility update manifests before changing source versions or loading signing secrets. A candidate versionCode must exceed every published versionCode; stale checkouts are rejected and must be updated explicitly. APK package identity must match the registered service before upload.
package/dist/index.d.ts CHANGED
@@ -954,6 +954,11 @@ type ServiceCommandArgs = {
954
954
  project?: string;
955
955
  workspace?: string;
956
956
  lastBuild?: number;
957
+ variant?: string;
958
+ bump?: "patch" | "minor" | "major";
959
+ force?: boolean;
960
+ releaseNotes?: string;
961
+ minimumVersionCode?: number;
957
962
  namespace: string;
958
963
  name: string;
959
964
  env?: string;
@@ -1004,20 +1009,6 @@ type ServiceCommandArgs = {
1004
1009
  dryRun: boolean;
1005
1010
  baseUrl?: string;
1006
1011
  json: boolean;
1007
- } | {
1008
- type: Command.Service;
1009
- action: "apk-release";
1010
- namespace: string;
1011
- name: string;
1012
- env: string;
1013
- variant: "debug" | "release" | string;
1014
- bump: "patch" | "minor" | "major";
1015
- cwd?: string;
1016
- force: boolean;
1017
- releaseNotes?: string;
1018
- minimumVersionCode?: number;
1019
- baseUrl?: string;
1020
- json: boolean;
1021
1012
  } | {
1022
1013
  type: Command.Service;
1023
1014
  action: "apk-list";
package/dist/index.js CHANGED
@@ -18500,16 +18500,39 @@ async function signAndroidApk(apkPath, signing) {
18500
18500
  process.removeListener("SIGTERM", interrupted);
18501
18501
  }
18502
18502
  }
18503
+ function androidArtifactIdentity(service) {
18504
+ const id = "type" in service ? service.build?.artifactServiceId : void 0;
18505
+ if (!id) return { namespace: service.namespace, name: service.name };
18506
+ const match = /^([A-Za-z0-9_-]+):([A-Za-z0-9_.-]+)$/.exec(id);
18507
+ if (!match || match[1] !== service.namespace || [".", ".."].includes(match[2])) throw new Error("Android artifactServiceId must be a valid service ID in the same namespace");
18508
+ return { namespace: match[1], name: match[2] };
18509
+ }
18510
+ function androidUpdateManifestKeys(service) {
18511
+ const identity = androidArtifactIdentity(service);
18512
+ return [.../* @__PURE__ */ new Set([buildAndroidLatestManifestObjectKey(service.namespace, service.name), buildAndroidLatestManifestObjectKey(identity.namespace, identity.name)])];
18513
+ }
18503
18514
  var AndroidApkReleaseService = class {
18504
18515
  constructor(registry) {
18505
18516
  this.registry = registry;
18506
18517
  }
18507
18518
  async release(service, options) {
18508
18519
  this.assertAndroidService(service);
18520
+ const identity = androidArtifactIdentity(service);
18509
18521
  const repoRoot = this.resolveRepoRoot(service, options.cwd);
18510
18522
  const appDir = this.resolveAppDir(service, repoRoot);
18523
+ let publishedFloor = 0;
18524
+ if (options.env === "prod" && options.variant.toLowerCase() === "release") {
18525
+ const expectedPackage2 = "type" in service && service.mobile && "packageName" in service.mobile ? service.mobile.packageName : void 0;
18526
+ for (const key of androidUpdateManifestKeys(service)) {
18527
+ const latest = await AliyunService.readJsonObject(ANDROID_APK_BUCKET, key);
18528
+ if (latest === null) continue;
18529
+ if (!expectedPackage2 || latest.applicationId !== expectedPackage2 || !Number.isSafeInteger(latest.versionCode) || latest.versionCode <= 0) throw new Error("Published Android manifest identity/version is invalid; release stopped");
18530
+ publishedFloor = Math.max(publishedFloor, latest.versionCode);
18531
+ }
18532
+ }
18533
+ const bump = planAndroidProjectVersion(appDir, options.bump, publishedFloor);
18511
18534
  const signing = options.variant.toLowerCase() === "release" ? await this.loadSigning(service.id, options.env) : void 0;
18512
- const bump = bumpAndroidProjectVersion(appDir, options.bump);
18535
+ (0, import_node_fs22.writeFileSync)(bump.filePath, bump.source);
18513
18536
  ui.info("Bumped Android version", {
18514
18537
  file: bump.filePath,
18515
18538
  from: `${bump.previousVersionName} (${bump.previousVersionCode})`,
@@ -18518,12 +18541,14 @@ var AndroidApkReleaseService = class {
18518
18541
  const builtApkPath = await this.runGradleAssembleAndFindApk(repoRoot, appDir, options.variant);
18519
18542
  const apkPath = signing ? await signAndroidApk(builtApkPath, signing) : builtApkPath;
18520
18543
  const metadata = await this.readApkMetadata(apkPath);
18544
+ const expectedPackage = "type" in service && service.mobile && "packageName" in service.mobile ? service.mobile.packageName : void 0;
18545
+ if (expectedPackage && metadata.applicationId !== expectedPackage) throw new Error("APK applicationId does not match registered Android service; upload stopped");
18521
18546
  if (metadata.versionName !== bump.versionName || metadata.versionCode !== bump.versionCode) {
18522
18547
  throw new Error(
18523
18548
  `APK metadata ${metadata.versionName} (${metadata.versionCode}) does not match bumped version ${bump.versionName} (${bump.versionCode}).`
18524
18549
  );
18525
18550
  }
18526
- const objectKey = buildAndroidApkObjectKey(service.namespace, service.name, metadata.versionName);
18551
+ const objectKey = buildAndroidApkObjectKey(identity.namespace, identity.name, metadata.versionName);
18527
18552
  const existing = await this.findExistingObject(objectKey);
18528
18553
  if (existing && !options.force) {
18529
18554
  throw new Error(`APK already exists at ${ANDROID_APK_PUBLIC_BASE_URL}/${objectKey}. Re-run with --force to overwrite it.`);
@@ -18547,7 +18572,7 @@ var AndroidApkReleaseService = class {
18547
18572
  size,
18548
18573
  gitCommit: await this.readGitCommit(repoRoot)
18549
18574
  };
18550
- const catalogKey = service.namespace === "pmate" && service.name === "factory-android" && options.env === "preview" ? "apks/pmate/factory-android/releases.json" : null;
18575
+ const catalogKey = identity.namespace === "pmate" && identity.name === "factory-android" && options.env === "preview" ? "apks/pmate/factory-android/releases.json" : null;
18551
18576
  const nextCatalog = catalogKey ? mergeFactoryApkCatalog(await AliyunService.readJsonObject(ANDROID_APK_BUCKET, catalogKey), artifact) : null;
18552
18577
  await AliyunService.uploadFile(apkPath, ANDROID_APK_BUCKET, objectKey);
18553
18578
  if (this.registry) {
@@ -18581,14 +18606,16 @@ var AndroidApkReleaseService = class {
18581
18606
  releaseNotes: options.releaseNotes,
18582
18607
  minimumVersionCode: options.minimumVersionCode
18583
18608
  });
18584
- const objectKey = buildAndroidLatestManifestObjectKey(service.namespace, service.name);
18609
+ const objectKeys = androidUpdateManifestKeys(service);
18585
18610
  const tempDir = (0, import_node_fs22.mkdtempSync)(import_node_path27.default.join(import_node_os11.default.tmpdir(), "pmate-apk-latest-"));
18586
18611
  const manifestPath = import_node_path27.default.join(tempDir, "latest.json");
18587
18612
  try {
18588
18613
  (0, import_node_fs22.writeFileSync)(manifestPath, `${JSON.stringify(manifest, null, 2)}
18589
18614
  `);
18590
- await AliyunService.uploadFile(manifestPath, ANDROID_APK_BUCKET, objectKey);
18591
- ui.success(`Published Android update manifest ${ANDROID_APK_PUBLIC_BASE_URL}/${objectKey}`);
18615
+ for (const objectKey of objectKeys) {
18616
+ await AliyunService.uploadFile(manifestPath, ANDROID_APK_BUCKET, objectKey);
18617
+ ui.success(`Published Android update manifest ${ANDROID_APK_PUBLIC_BASE_URL}/${objectKey}`);
18618
+ }
18592
18619
  } finally {
18593
18620
  (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
18594
18621
  }
@@ -18603,7 +18630,8 @@ var AndroidApkReleaseService = class {
18603
18630
  ui.warn("Falling back to OSS object listing for APK versions", error instanceof Error ? error.message : String(error));
18604
18631
  }
18605
18632
  }
18606
- const prefix = `apks/${service.namespace}/${service.name}`;
18633
+ const identity = androidArtifactIdentity(service);
18634
+ const prefix = `apks/${identity.namespace}/${identity.name}`;
18607
18635
  const objects = await AliyunService.listObjects(ANDROID_APK_BUCKET, prefix);
18608
18636
  return objects.filter((item) => item.name.endsWith(".apk")).map((item) => {
18609
18637
  const versionName = import_node_path27.default.basename(item.name, ".apk");
@@ -18830,7 +18858,7 @@ function parseGradleOutputMetadata(source, apkFileName) {
18830
18858
  }
18831
18859
  return { applicationId, versionName, versionCode };
18832
18860
  }
18833
- function bumpAndroidProjectVersion(appDir, bump) {
18861
+ function planAndroidProjectVersion(appDir, bump, publishedFloor = 0) {
18834
18862
  const candidates = [
18835
18863
  import_node_path27.default.join(appDir, "app", "build.gradle.kts"),
18836
18864
  import_node_path27.default.join(appDir, "app", "build.gradle"),
@@ -18840,7 +18868,7 @@ function bumpAndroidProjectVersion(appDir, bump) {
18840
18868
  for (const candidate of candidates) {
18841
18869
  if (!(0, import_node_fs22.existsSync)(candidate)) continue;
18842
18870
  const result = bumpAndroidGradleVersionText((0, import_node_fs22.readFileSync)(candidate, "utf8"), bump);
18843
- (0, import_node_fs22.writeFileSync)(candidate, result.source);
18871
+ if (!Number.isSafeInteger(result.versionCode) || result.versionCode <= publishedFloor) throw new Error(`Android source is behind published versionCode ${publishedFloor}; update the checkout before releasing`);
18844
18872
  return { filePath: candidate, ...result };
18845
18873
  }
18846
18874
  throw new Error(`No Android Gradle version file found under ${appDir}`);
@@ -19094,19 +19122,21 @@ async function readPlist(input) {
19094
19122
 
19095
19123
  // src/services/NativeServiceDeploy.ts
19096
19124
  var electronKeys = ["config", "platform", "arch", "outDir", "unsigned", "signed", "dir"];
19125
+ var androidKeys = ["variant", "bump", "force", "releaseNotes", "minimumVersionCode"];
19097
19126
  var iosKeys = ["scheme", "team", "project", "workspace", "lastBuild"];
19098
19127
  function rejectNativeOverrides(args, allowed = []) {
19099
- for (const key of [...electronKeys, ...iosKeys, "local", "dryRun"]) {
19128
+ for (const key of [...electronKeys, ...iosKeys, ...androidKeys, "local", "dryRun"]) {
19100
19129
  if (args[key] !== void 0 && !allowed.includes(key)) throw new Error(`--${key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)} is not supported for this service type`);
19101
19130
  }
19102
19131
  }
19103
19132
  var NativeServiceDeploy = class {
19104
- constructor(deps = { desktop: buildDesktop, ios: new IosBuildService() }) {
19133
+ constructor(deps = {}, registry) {
19105
19134
  this.deps = deps;
19135
+ this.registry = registry;
19106
19136
  }
19107
19137
  async deploy(service, args) {
19108
- if (!("type" in service) || !["electron", "ios"].includes(service.type)) throw new Error("Native deployment requires an electron or ios service");
19109
- if ((args.env ?? "prod") !== "prod") throw new Error("Native deployment currently supports only --env prod");
19138
+ if (!("type" in service) || !["electron", "ios", "android"].includes(service.type)) throw new Error("Native deployment requires an electron, ios or android service");
19139
+ if (service.type !== "android" && (args.env ?? "prod") !== "prod") throw new Error("Native deployment currently supports only --env prod");
19110
19140
  const repository = service.repository ?? service.mobile?.repository;
19111
19141
  const dir = service.dir ?? service.mobile?.dir;
19112
19142
  if (!dir || !repository && !args.cwd) throw new Error("Native service requires repository and dir");
@@ -19114,6 +19144,27 @@ var NativeServiceDeploy = class {
19114
19144
  const appDir = import_node_path29.default.resolve(root, dir);
19115
19145
  if (!(0, import_node_fs24.existsSync)(appDir)) throw new Error(`Service source directory not found: ${appDir}`);
19116
19146
  const settings = service.build ?? {};
19147
+ if (service.type === "android") {
19148
+ rejectNativeOverrides(args, [...androidKeys, "dryRun"]);
19149
+ const artifactIdentity = androidArtifactIdentity(service);
19150
+ const updateManifests = androidUpdateManifestKeys(service);
19151
+ const options2 = {
19152
+ cwd: root,
19153
+ env: args.env ?? "prod",
19154
+ variant: args.variant ?? settings.variant ?? "release",
19155
+ bump: args.bump ?? settings.bump ?? "patch",
19156
+ force: !!args.force,
19157
+ releaseNotes: args.releaseNotes,
19158
+ minimumVersionCode: args.minimumVersionCode
19159
+ };
19160
+ if (!["dev", "preview", "prod"].includes(options2.env)) throw new Error("Android deployment requires env dev, preview or prod");
19161
+ if (!["release", "debug"].includes(options2.variant)) throw new Error("Android variant must be release or debug");
19162
+ if (options2.env === "prod" && options2.variant !== "release") throw new Error("Android production deployment requires a signed release variant");
19163
+ if (!["patch", "minor", "major"].includes(options2.bump)) throw new Error("Android bump must be patch, minor or major");
19164
+ if (args.dryRun) return { serviceId: service.id, status: "dry-run", type: "android", appDir, artifactIdentity, updateManifests, packageName: service.mobile && "packageName" in service.mobile ? service.mobile.packageName : void 0, ...options2 };
19165
+ const artifact = await (this.deps.android ?? new AndroidApkReleaseService(this.registry)).release(service, options2);
19166
+ return { ...artifact, status: "published" };
19167
+ }
19117
19168
  if (service.type === "electron") {
19118
19169
  rejectNativeOverrides(args, [...electronKeys, "local", "dryRun"]);
19119
19170
  if (service.appIds?.length !== 1) throw new Error("Electron service requires exactly one appIds application identity");
@@ -19131,7 +19182,7 @@ var NativeServiceDeploy = class {
19131
19182
  local: !!args.local,
19132
19183
  json: args.json
19133
19184
  };
19134
- await this.deps.desktop(options2);
19185
+ await (this.deps.desktop ?? buildDesktop)(options2);
19135
19186
  return { serviceId: service.id, appId: app, status: args.dryRun ? "dry-run" : args.local ? "local" : "published", platform: options2.platform, arch: options2.arch, output: options2.outDir };
19136
19187
  }
19137
19188
  rejectNativeOverrides(args, [...iosKeys, "dryRun"]);
@@ -19146,7 +19197,7 @@ var NativeServiceDeploy = class {
19146
19197
  if (!options.scheme.trim()) throw new Error("iOS service requires build.scheme; update the service configuration or pass --scheme");
19147
19198
  if (options.project && options.workspace) throw new Error("Use only one project or workspace");
19148
19199
  if (args.dryRun) return { serviceId: service.id, status: "dry-run", type: "ios", appDir, ...options };
19149
- return { ...await this.deps.ios.build(service, options) };
19200
+ return { ...await (this.deps.ios ?? new IosBuildService()).build(service, options) };
19150
19201
  }
19151
19202
  };
19152
19203
 
@@ -21135,9 +21186,9 @@ var ServiceCommandHandler = class {
21135
21186
  }
21136
21187
  case "deploy": {
21137
21188
  const record = await registry.getService(args.namespace, args.name);
21138
- if ("type" in record && (record.type === "electron" || record.type === "ios")) {
21189
+ if ("type" in record && (record.type === "electron" || record.type === "ios" || record.type === "android")) {
21139
21190
  try {
21140
- const result = await new NativeServiceDeploy().deploy(record, args);
21191
+ const result = await new NativeServiceDeploy({}, registry).deploy(record, args);
21141
21192
  if (!args.dryRun && !args.local) await this.appendDeployHistory(registry, record.id, args.env ?? "prod", "success", String(result.status));
21142
21193
  this.renderJson(result, true);
21143
21194
  } catch (error) {
@@ -21217,21 +21268,6 @@ var ServiceCommandHandler = class {
21217
21268
  );
21218
21269
  return;
21219
21270
  }
21220
- case "apk-release": {
21221
- const record = await registry.getService(args.namespace, args.name);
21222
- const apkRelease = new AndroidApkReleaseService(registry);
21223
- const artifact = await apkRelease.release(record, {
21224
- env: args.env,
21225
- variant: args.variant,
21226
- bump: args.bump,
21227
- cwd: args.cwd,
21228
- force: args.force,
21229
- releaseNotes: args.releaseNotes,
21230
- minimumVersionCode: args.minimumVersionCode
21231
- });
21232
- this.renderApkArtifacts([artifact], args.json);
21233
- return;
21234
- }
21235
21271
  case "apk-list": {
21236
21272
  const record = await registry.getService(args.namespace, args.name);
21237
21273
  const apkRelease = new AndroidApkReleaseService(registry);
@@ -24447,8 +24483,8 @@ function parseServiceArgs(tokens) {
24447
24483
  throw new Error(`Usage: service ${action} <ns:objectId> [--base-url <url>] [--json]`);
24448
24484
  }
24449
24485
  const native = {};
24450
- const buildValues = ["--config", "--platform", "--arch", "--out-dir", "--scheme", "--team", "--project", "--workspace", "--last-build"];
24451
- const buildFlags = ["--dry-run", "--local", "--unsigned", "--signed", "--dir"];
24486
+ const buildValues = ["--config", "--platform", "--arch", "--out-dir", "--scheme", "--team", "--project", "--workspace", "--last-build", "--variant", "--bump", "--release-notes", "--minimum-version-code"];
24487
+ const buildFlags = ["--dry-run", "--local", "--unsigned", "--signed", "--dir", "--force"];
24452
24488
  let cwd;
24453
24489
  let page = 0;
24454
24490
  let app;
@@ -24558,6 +24594,11 @@ function parseServiceArgs(tokens) {
24558
24594
  if (native.platform && !["mac", "win"].includes(String(native.platform))) throw new Error("Supported platform: mac|win");
24559
24595
  if (native.arch && !["arm64", "x64"].includes(String(native.arch))) throw new Error("Supported architecture: arm64|x64");
24560
24596
  if (native.project && native.workspace) throw new Error("Use only one of --project or --workspace");
24597
+ if (native.bump && !["patch", "minor", "major"].includes(String(native.bump))) throw new Error("--bump must be patch, minor or major");
24598
+ if (native.minimumVersionCode !== void 0) {
24599
+ if (!/^(0|[1-9]\d*)$/.test(String(native.minimumVersionCode)) || !Number.isSafeInteger(Number(native.minimumVersionCode))) throw new Error("--minimum-version-code must be a non-negative safe integer");
24600
+ native.minimumVersionCode = Number(native.minimumVersionCode);
24601
+ }
24561
24602
  if (native.lastBuild !== void 0) {
24562
24603
  if (!/^(0|[1-9]\d*)$/.test(String(native.lastBuild)) || !Number.isSafeInteger(Number(native.lastBuild))) throw new Error("--last-build must be a non-negative safe integer");
24563
24604
  native.lastBuild = Number(native.lastBuild);
@@ -24739,111 +24780,21 @@ function looksLikeNamespacedRef(value) {
24739
24780
  }
24740
24781
  function parseServiceApkArgs(tokens, defaults) {
24741
24782
  const rest = [...tokens];
24742
- const apkAction = rest.shift();
24743
- if (apkAction !== "release" && apkAction !== "list") {
24744
- throw new Error("Usage: service apk release|list <ns:service> [--env <env>] [--json]");
24745
- }
24746
- const ref = rest.shift();
24747
- if (!ref || ref.startsWith("-")) {
24748
- throw new Error(`Usage: service apk ${apkAction} <ns:service> [--env <env>] [--json]`);
24749
- }
24750
- const parsedRef = parseNamespacedRef(ref, { entityLabel: "service ref" });
24783
+ const action = rest.shift();
24784
+ if (action === "release") throw new Error("service apk release was removed; use pmate service deploy <ns:android-service>");
24785
+ if (action !== "list") throw new Error("Usage: service apk list <ns:service> [--env <env>] [--json]");
24786
+ const parsed = parseNamespacedRef(rest.shift() ?? "", { entityLabel: "service ref" });
24787
+ let env;
24751
24788
  let baseUrl = defaults.baseUrl;
24752
24789
  let json = defaults.json;
24753
- let env;
24754
- let variant = "debug";
24755
- let cwd;
24756
- let force = false;
24757
- let major = false;
24758
- let minor = false;
24759
- let releaseNotes;
24760
- let minimumVersionCode;
24761
- while (rest.length > 0) {
24762
- const token = rest.shift();
24763
- switch (token) {
24764
- case "--env":
24765
- env = requireValue4(rest, token);
24766
- break;
24767
- case "--variant":
24768
- if (apkAction !== "release") {
24769
- throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24770
- }
24771
- variant = requireValue4(rest, token);
24772
- break;
24773
- case "--cwd":
24774
- if (apkAction !== "release") {
24775
- throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24776
- }
24777
- cwd = requireValue4(rest, token);
24778
- break;
24779
- case "--force":
24780
- if (apkAction !== "release") {
24781
- throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24782
- }
24783
- force = true;
24784
- break;
24785
- case "--major":
24786
- if (apkAction !== "release") {
24787
- throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24788
- }
24789
- major = true;
24790
- break;
24791
- case "--minor":
24792
- if (apkAction !== "release") {
24793
- throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24794
- }
24795
- minor = true;
24796
- break;
24797
- case "--release-notes":
24798
- if (apkAction !== "release") throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24799
- releaseNotes = requireValue4(rest, token);
24800
- break;
24801
- case "--minimum-version-code": {
24802
- if (apkAction !== "release") throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24803
- const value = Number(requireValue4(rest, token));
24804
- if (!Number.isInteger(value) || value < 0) throw new Error("--minimum-version-code must be a non-negative integer");
24805
- minimumVersionCode = value;
24806
- break;
24807
- }
24808
- case "--base-url":
24809
- baseUrl = requireValue4(rest, token);
24810
- break;
24811
- case "--json":
24812
- json = true;
24813
- break;
24814
- default:
24815
- throw new Error(`Unknown service apk ${apkAction} option: ${token}`);
24816
- }
24817
- }
24818
- if (major && minor) {
24819
- throw new Error("Use only one of --major or --minor for service apk release");
24820
- }
24821
- if (apkAction === "list") {
24822
- return {
24823
- type: "service" /* Service */,
24824
- action: "apk-list",
24825
- namespace: parsedRef.namespace,
24826
- name: parsedRef.objectId,
24827
- env,
24828
- baseUrl,
24829
- json
24830
- };
24790
+ while (rest.length) {
24791
+ const flag = rest.shift();
24792
+ if (flag === "--env") env = requireValue4(rest, flag);
24793
+ else if (flag === "--base-url") baseUrl = requireValue4(rest, flag);
24794
+ else if (flag === "--json") json = true;
24795
+ else throw new Error(`Unknown service apk list option: ${flag}`);
24831
24796
  }
24832
- return {
24833
- type: "service" /* Service */,
24834
- action: "apk-release",
24835
- namespace: parsedRef.namespace,
24836
- name: parsedRef.objectId,
24837
- env: env ?? "preview",
24838
- variant,
24839
- bump: major ? "major" : minor ? "minor" : "patch",
24840
- cwd,
24841
- force,
24842
- releaseNotes,
24843
- minimumVersionCode,
24844
- baseUrl,
24845
- json
24846
- };
24797
+ return { type: "service" /* Service */, action: "apk-list", namespace: parsed.namespace, name: parsed.objectId, env, baseUrl, json };
24847
24798
  }
24848
24799
  function parseServiceEnvDefinitionArgs(appId, tokens) {
24849
24800
  const rest = [...tokens];
@@ -26858,7 +26809,7 @@ var HELP_TEXT = [
26858
26809
  ` ${import_chalk4.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
26859
26810
  ` ${import_chalk4.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
26860
26811
  ` ${import_chalk4.default.cyan("service")} Manage service registry entries via apps-api`,
26861
- " deploy <ns:service> [--env prod] [--cwd <repo>] [--dry-run] [--local] [--unsigned] [--platform mac|win] [--arch arm64|x64] [--config <file>] [--out-dir <dir>] [--scheme <name>] [--team <id>]",
26812
+ " deploy <ns:service> [--env prod] [--cwd <repo>] [--dry-run] [--local] [--unsigned] [--platform mac|win] [--arch arm64|x64] [--config <file>] [--out-dir <dir>] [--scheme <name>] [--team <id>] [--variant release|debug] [--bump patch|minor|major]",
26862
26813
  ` ${import_chalk4.default.gray(" list [--namespace <ns>] [--repo <owner/name|https://github.com/owner/name>] [--server <name>] [--base-url <url>] [--json]")}`,
26863
26814
  ` ${import_chalk4.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
26864
26815
  ` ${import_chalk4.default.gray(" view <ns:objectId> [--base-url <url>]")}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.40.0",
3
+ "version": "0.41.1",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {