@wix/himalaya-cli 0.1769.0 → 0.1770.0

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/cli.mjs +287 -51
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -40184,6 +40184,7 @@ function resolveIdiom(tokens2, ctx = {}) {
40184
40184
  var IDIOM_CONTEXTS, UNSAFE_KEYS;
40185
40185
  var init_idiom = __esm({
40186
40186
  "../../core/ts/src/idiom.ts"() {
40187
+ "use strict";
40187
40188
  init_define_HHP_CATALOG();
40188
40189
  IDIOM_CONTEXTS = {
40189
40190
  ios: { native: ["ios"] },
@@ -41919,6 +41920,7 @@ function shouldRevealError(args) {
41919
41920
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
41920
41921
  var init_validation = __esm({
41921
41922
  "../../core/ts/src/validation.ts"() {
41923
+ "use strict";
41922
41924
  init_define_HHP_CATALOG();
41923
41925
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
41924
41926
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -177565,13 +177567,13 @@ function newestSourceChangeMs(dir) {
177565
177567
  const roots2 = renderInputRootDirs(dir);
177566
177568
  const inRead = (hostRel) => !roots2 || roots2.has(hostRel.split(sep18)[0]);
177567
177569
  const counts = (hostRel) => !hostRel.includes(sep18) || inRead(hostRel);
177568
- let newest = 0;
177570
+ let newest2 = 0;
177569
177571
  walkSourceTree(
177570
177572
  dir,
177571
177573
  (archivePath, hostRel) => {
177572
177574
  if (/\.md$/i.test(archivePath) || !counts(hostRel)) return;
177573
177575
  const m2 = lstatSync20(join56(dir, hostRel)).mtimeMs;
177574
- if (m2 > newest) newest = m2;
177576
+ if (m2 > newest2) newest2 = m2;
177575
177577
  },
177576
177578
  () => {
177577
177579
  },
@@ -177583,10 +177585,10 @@ function newestSourceChangeMs(dir) {
177583
177585
  (hostRel) => {
177584
177586
  if (hostRel === "" || !inRead(hostRel)) return;
177585
177587
  const m2 = lstatSync20(join56(dir, hostRel)).mtimeMs;
177586
- if (m2 > newest) newest = m2;
177588
+ if (m2 > newest2) newest2 = m2;
177587
177589
  }
177588
177590
  );
177589
- return newest;
177591
+ return newest2;
177590
177592
  }
177591
177593
  function sourceFingerprint(dir) {
177592
177594
  const files = [];
@@ -179590,6 +179592,43 @@ var init_car = __esm({
179590
179592
  }
179591
179593
  });
179592
179594
 
179595
+ // ../../core/schema/frozen-renderers.json
179596
+ var frozen_renderers_default;
179597
+ var init_frozen_renderers = __esm({
179598
+ "../../core/schema/frozen-renderers.json"() {
179599
+ frozen_renderers_default = {
179600
+ description: "Renderers that are FROZEN: their code stays in the tree, but nothing runs, tests, builds or requires it \u2014 no CI lane, no pre-PR lane, no parity arm, no platforms.json opt-in. A new component or behaviour does NOT have to be implemented in a frozen renderer. Read by tools/ci/frozen-renderers.mjs (the only reader); every gate that used to require the renderer asks that module instead. To see what a revival would have to fix, run the suite with HIMALAYA_UNFREEZE=<key> \u2014 every frozen arm turns back on and its failures are the catch-up list. See docs/react-native-frozen.md.",
179601
+ frozen: {
179602
+ rn: {
179603
+ name: "React Native",
179604
+ paths: ["core/react-native/", "apps/demo-app/rn/", "samples/embed-host-rn/"],
179605
+ since: "2026-11-18",
179606
+ freezeCommit: "9625c66e6d",
179607
+ doc: "docs/react-native-frozen.md",
179608
+ rfc: "core/schema/RFC/0045-react-native-renderer.md"
179609
+ }
179610
+ }
179611
+ };
179612
+ }
179613
+ });
179614
+
179615
+ // ../ci/frozen-renderers.mjs
179616
+ function isFrozen(key4) {
179617
+ return Object.hasOwn(frozen_renderers_default.frozen, key4) && !unfrozen.has(key4);
179618
+ }
179619
+ var unfrozen, FROZEN_RECORD, RN_FROZEN;
179620
+ var init_frozen_renderers2 = __esm({
179621
+ "../ci/frozen-renderers.mjs"() {
179622
+ init_define_HHP_CATALOG();
179623
+ init_frozen_renderers();
179624
+ unfrozen = new Set(
179625
+ (process.env.HIMALAYA_UNFREEZE ?? "").split(",").map((s5) => s5.trim()).filter(Boolean)
179626
+ );
179627
+ FROZEN_RECORD = frozen_renderers_default.frozen;
179628
+ RN_FROZEN = isFrozen("rn");
179629
+ }
179630
+ });
179631
+
179593
179632
  // src/surface-lint.ts
179594
179633
  import { existsSync as existsSync67, readFileSync as readFileSync73 } from "node:fs";
179595
179634
  import { join as join63 } from "node:path";
@@ -179619,6 +179658,9 @@ function surfaceIssues(dir, surfaceNav, strict) {
179619
179658
  error(key4 === "ios" || key4 === "android" ? `platforms.json: unknown key "${key4}" \u2014 iOS and Android are always on \u2014 remove this key (valid keys: ${valid3})` : `platforms.json: unknown key "${key4}" \u2014 valid keys: ${valid3}`);
179620
179659
  } else if (typeof value2 !== "boolean") {
179621
179660
  error(`platforms.json: "${key4}" must be a boolean (got ${JSON.stringify(value2)}) \u2014 the server silently drops non-boolean values`);
179661
+ } else if (value2 && isFrozen(key4)) {
179662
+ const r3 = FROZEN_RECORD[key4];
179663
+ error(`platforms.json: "${key4}" is frozen \u2014 the ${r3.name} renderer has not been supported since ${r3.since}; remove the key or set it to false`);
179622
179664
  }
179623
179665
  }
179624
179666
  }
@@ -179673,6 +179715,7 @@ var init_surface_lint = __esm({
179673
179715
  init_define_HHP_CATALOG();
179674
179716
  init_car();
179675
179717
  init_preview_surfaces();
179718
+ init_frozen_renderers2();
179676
179719
  VALID_PLATFORM_KEYS2 = /* @__PURE__ */ new Set([
179677
179720
  ...PREVIEW_SURFACES.map((s5) => s5.platformKey).filter((k3) => k3 !== null),
179678
179721
  ...PREVIEW_EXEMPT_PLATFORM_KEYS
@@ -207365,10 +207408,10 @@ var init_store_record = __esm({
207365
207408
  if (files.length === 0)
207366
207409
  continue;
207367
207410
  const stores = new Set(files.filter((f2) => f2.includes("/") && STORES.has(f2.split("/")[0])).map((f2) => f2.split("/")[0]));
207368
- let newest = 0;
207411
+ let newest2 = 0;
207369
207412
  for (const f2 of files)
207370
- newest = Math.max(newest, (await stat9(recordFile(this.root, app2, f2)).catch(() => void 0))?.mtimeMs ?? 0);
207371
- index.apps[app2] = { stores: [...stores].sort(), updatedAt: new Date(newest).toISOString() };
207413
+ newest2 = Math.max(newest2, (await stat9(recordFile(this.root, app2, f2)).catch(() => void 0))?.mtimeMs ?? 0);
207414
+ index.apps[app2] = { stores: [...stores].sort(), updatedAt: new Date(newest2).toISOString() };
207372
207415
  }
207373
207416
  return index;
207374
207417
  }
@@ -208390,8 +208433,8 @@ async function tracksPart(deps, record5, app2, packageName) {
208390
208433
  const releases = list5.map(liveRelease);
208391
208434
  if (!releases.length && !held.has(name))
208392
208435
  continue;
208393
- const newest = releases.filter((r3) => typeof r3.versionCode === "number").sort((a3, b3) => b3.versionCode - a3.versionCode)[0] ?? null;
208394
- writes.push({ path: trackPath(name), schema: "google.track@1", merge: true, read: "tracks", data: { track: name, release: newest, releases } });
208436
+ const newest2 = releases.filter((r3) => typeof r3.versionCode === "number").sort((a3, b3) => b3.versionCode - a3.versionCode)[0] ?? null;
208437
+ writes.push({ path: trackPath(name), schema: "google.track@1", merge: true, read: "tracks", data: { track: name, release: newest2, releases } });
208395
208438
  }
208396
208439
  return { writes, notes: [] };
208397
208440
  }
@@ -218874,8 +218917,8 @@ var init_commerce = __esm({
218874
218917
  }
218875
218918
  /** Version-scoped localizations of the group's newest version, else the legacy product-scoped list upstream's validate reads. */
218876
218919
  async groupLocalizations(groupId) {
218877
- const newest = newestVersion(await this.groupVersions(groupId));
218878
- const scoped = newest ? flatList((await this.t.list(`/v1/subscriptionGroupVersions/${encodeURIComponent(newest.id)}/localizations`)).data) : [];
218920
+ const newest2 = newestVersion(await this.groupVersions(groupId));
218921
+ const scoped = newest2 ? flatList((await this.t.list(`/v1/subscriptionGroupVersions/${encodeURIComponent(newest2.id)}/localizations`)).data) : [];
218879
218922
  return scoped.length ? scoped : flatList((await this.t.list(`/v1/subscriptionGroups/${encodeURIComponent(groupId)}/subscriptionGroupLocalizations`)).data);
218880
218923
  }
218881
218924
  /** Creates or updates a locale's text on the group's editable version, creating that version when there is none. */
@@ -218934,8 +218977,8 @@ var init_commerce = __esm({
218934
218977
  }
218935
218978
  /** Version-scoped text of the newest version, else the legacy product-scoped list upstream's validate reads. */
218936
218979
  async localizations(id) {
218937
- const newest = newestVersion(await this.versions(id));
218938
- const scoped = newest ? flatList((await this.t.list(`/v1/subscriptionVersions/${encodeURIComponent(newest.id)}/localizations`)).data) : [];
218980
+ const newest2 = newestVersion(await this.versions(id));
218981
+ const scoped = newest2 ? flatList((await this.t.list(`/v1/subscriptionVersions/${encodeURIComponent(newest2.id)}/localizations`)).data) : [];
218939
218982
  return scoped.length ? scoped : flatList((await this.t.list(`/v1/subscriptions/${encodeURIComponent(id)}/subscriptionLocalizations`)).data);
218940
218983
  }
218941
218984
  /** The legacy product-scoped write; `setLocalization` is the one Apple keeps (API 4.4.1, version-scoped). */
@@ -219388,8 +219431,8 @@ async function iapChecks(api4, appId3) {
219388
219431
  const unverified = (id, what, reason) => ({ ...base2, id: `iap.diagnostics.${id}_unverified`, severity: "info", message: `Could not verify ${what} of ${label4}`, remediation: reason });
219389
219432
  const set3 = `asc-node iap localize --app ${appId3} --iap ${iap.id} --locale en-US --name NAME --description TEXT`;
219390
219433
  const text32 = await attempt(async () => {
219391
- const newest = [...await api4.iap.versions(iap.id)].sort((a3, b3) => (b3.version ?? 0) - (a3.version ?? 0))[0];
219392
- return newest ? api4.iap.localizations(newest.id) : [];
219434
+ const newest2 = [...await api4.iap.versions(iap.id)].sort((a3, b3) => (b3.version ?? 0) - (a3.version ?? 0))[0];
219435
+ return newest2 ? api4.iap.localizations(newest2.id) : [];
219393
219436
  });
219394
219437
  checks.push(..."reason" in text32 ? [unverified("localization", "the localizations", text32.reason)] : textChecks("iap", "inAppPurchaseV2", iap.id, label4, text32.value, set3));
219395
219438
  checks.push(...screenshotChecks("iap", "inAppPurchaseV2", iap.id, label4, await attempt(() => api4.iap.reviewScreenshots.read(iap.id)), `asc-node iap review-screenshot upload --app ${appId3} --iap ${iap.id} --file review.png`, `asc-node iap review-screenshot delete --app ${appId3} --iap ${iap.id}`));
@@ -242303,18 +242346,18 @@ function noteRecordPush(root, key4, note) {
242303
242346
  }
242304
242347
  }
242305
242348
  function readRecordPushNote(root, keys2) {
242306
- let newest;
242349
+ let newest2;
242307
242350
  for (const key4 of new Set(keys2.filter((k3) => !!k3))) {
242308
242351
  try {
242309
242352
  const v2 = JSON.parse(readFileSync126(pushNoteFile(root, key4), "utf8"));
242310
242353
  if (v2.schema !== PUSH_NOTE_SCHEMA || typeof v2.at !== "string") continue;
242311
242354
  const { schema: _schema, ...note } = v2;
242312
242355
  void _schema;
242313
- if (!newest || note.at >= newest.at) newest = note;
242356
+ if (!newest2 || note.at >= newest2.at) newest2 = note;
242314
242357
  } catch {
242315
242358
  }
242316
242359
  }
242317
- return newest;
242360
+ return newest2;
242318
242361
  }
242319
242362
  async function linkStorePackage(root, identity) {
242320
242363
  if (!identity.packageName || !identity.himiAppId) return void 0;
@@ -253113,10 +253156,78 @@ stderr with a code.`;
253113
253156
  }
253114
253157
  });
253115
253158
 
253159
+ // src/store-google-pool-ready.ts
253160
+ async function planReady(runner2, input, view, actor) {
253161
+ const steps = [];
253162
+ const skipped = [];
253163
+ const countries2 = await runner2.plan("gplay.console.countries", { packageName: input.packageName, appId: input.appId, track: input.track, countries: input.countries }, actor);
253164
+ const cp = planProblem(countries2, countries2.plan.changes.map((c2) => c2.resource).filter((r3) => r3.startsWith("countries/")), /^testers in those countries can install the closed test/);
253165
+ if (cp) throw new ReadyRefusal(`countries: ${cp}`, countries2);
253166
+ if (isNoop(countries2)) skipped.push(`countries: ${countries2.plan.changes[0]?.summary ?? "already targeted"}`);
253167
+ else steps.push({ step: "countries", job: countries2 });
253168
+ const versionCode = newest(view.from);
253169
+ if (!versionCode) {
253170
+ skipped.push(`release: ${input.from} has no release to put on ${input.track}`);
253171
+ return { steps, skipped };
253172
+ }
253173
+ if (newest(view.to) >= versionCode) {
253174
+ skipped.push(`release: ${input.track} already carries version ${newest(view.to)}`);
253175
+ return { steps, skipped, versionCode };
253176
+ }
253177
+ const replace3 = (view.to ?? []).some((r3) => (r3.versionCodes ?? []).length > 0);
253178
+ const promote = await runner2.plan("gplay.release.promote", { packageName: input.packageName, versionCode, from: input.from, to: input.track, ...replace3 ? { replace: true } : {} }, actor);
253179
+ const pp = planProblem(promote, [`tracks/${input.track}`], /^$/);
253180
+ if (pp) throw new ReadyRefusal(`release: ${pp}`, promote);
253181
+ if (isNoop(promote)) skipped.push(`release: ${promote.plan.changes[0]?.summary ?? "already on the track"}`);
253182
+ else steps.push({ step: "release", job: promote });
253183
+ return { steps, skipped, versionCode };
253184
+ }
253185
+ async function applySteps(runner2, plan, person, actor, now) {
253186
+ const applied = [];
253187
+ for (const s5 of plan.steps) {
253188
+ const job = await approveAndApply(runner2, s5.job, person, actor, now);
253189
+ if (job.status !== "verified") throw new ReadyRefusal(`${s5.step}: job ${job.id} is ${job.status}: ${job.error ?? "not read back"}`, job);
253190
+ applied.push({ step: s5.step, jobId: job.id, status: job.status, ...job.result?.detail ? { detail: job.result.detail } : {} });
253191
+ }
253192
+ return applied;
253193
+ }
253194
+ async function applyReview(runner2, input, person, actor, now, planned2) {
253195
+ let review = planned2 ?? await planReview(runner2, input, actor);
253196
+ if (!isNoop(review)) {
253197
+ review = await approveAndApply(runner2, review, person, actor, now);
253198
+ if (review.status !== "verified") throw new ReadyRefusal(`review: job ${review.id} is ${review.status}: ${review.error ?? "not read back"}`, review);
253199
+ }
253200
+ return { step: "review", jobId: review.id, status: isNoop(review) ? "noop" : review.status, detail: review.result?.detail ?? review.plan.changes.map((c2) => c2.summary).join("; ") };
253201
+ }
253202
+ var POOL_DEFAULT_COUNTRIES, POOL_DEFAULT_FROM, isNoop, newest, ReadyRefusal, readyLines, planReview;
253203
+ var init_store_google_pool_ready = __esm({
253204
+ "src/store-google-pool-ready.ts"() {
253205
+ init_define_HHP_CATALOG();
253206
+ init_store_relops_google();
253207
+ POOL_DEFAULT_COUNTRIES = ["Israel", "United States"];
253208
+ POOL_DEFAULT_FROM = "alpha";
253209
+ isNoop = (job) => job.plan.changes.every((c2) => c2.op === "noop");
253210
+ newest = (releases = []) => Math.max(0, ...releases.flatMap((r3) => (r3.versionCodes ?? []).map(Number)).filter(Number.isFinite));
253211
+ ReadyRefusal = class extends Error {
253212
+ constructor(message5, job) {
253213
+ super(message5);
253214
+ this.job = job;
253215
+ }
253216
+ };
253217
+ readyLines = (plan, input) => [
253218
+ ...plan.steps.flatMap((s5) => changesOf2(s5.job)),
253219
+ `then send the app's changes on "${input.track}" to Google's review (Play Console), unless Play already sent them`
253220
+ ];
253221
+ planReview = (runner2, input, actor) => runner2.plan("gplay.console.sendReview", { packageName: input.packageName, appId: input.appId, track: input.track }, actor);
253222
+ }
253223
+ });
253224
+
253116
253225
  // src/store-google-testers.ts
253117
253226
  var store_google_testers_exports = {};
253118
253227
  __export(store_google_testers_exports, {
253228
+ POOL_CONSENT_COVERS: () => POOL_CONSENT_COVERS,
253119
253229
  POOL_CONSENT_DAYS: () => POOL_CONSENT_DAYS,
253230
+ POOL_COUNTRIES_ENV: () => POOL_COUNTRIES_ENV,
253120
253231
  POOL_DEFAULT_TRACK: () => POOL_DEFAULT_TRACK,
253121
253232
  POOL_GROUP_ENV: () => POOL_GROUP_ENV,
253122
253233
  STORE_GOOGLE_TESTERS_CODES: () => STORE_GOOGLE_TESTERS_CODES,
@@ -253152,7 +253263,28 @@ function parse7(pos, flags, cwd, env) {
253152
253263
  if (!PACKAGE_RE3.test(packageName)) throw new UsageError9(`"${packageName}" is not an Android package name`);
253153
253264
  const developer = text22(flags.developer) ?? text22(facts?.developerId);
253154
253265
  if (developer && !DEVELOPER_RE3.test(developer)) throw new UsageError9("--developer is your Play developer account id: the number in your Play Console URL");
253155
- return { op, ...consentOp ? { consentOp } : {}, track: track2, group, packageName, ...developer ? { developer } : {} };
253266
+ const groupOnly = flags["group-only"] === true || flags["group-only"] === "true";
253267
+ for (const f2 of ["countries", "from", "app-id", "group-only"]) {
253268
+ if (flags[f2] !== void 0 && op !== "pool-add") throw new UsageError9(`--${f2} is for pool-add`);
253269
+ }
253270
+ const countries2 = (text22(flags.countries) ?? text22(env[POOL_COUNTRIES_ENV]) ?? POOL_DEFAULT_COUNTRIES.join(",")).split(/[,;]/).map((c2) => c2.trim()).filter(Boolean);
253271
+ if (!countries2.length) throw new UsageError9("--countries is a comma-separated list of country names as Play Console lists them");
253272
+ const from = (text22(flags.from) ?? POOL_DEFAULT_FROM).toLowerCase();
253273
+ if (text22(flags.from) && from === track2) throw new UsageError9(`--from ${from} is the pool track itself; name the track the release comes from (default ${POOL_DEFAULT_FROM})`);
253274
+ const appId3 = text22(flags["app-id"]) ?? text22(facts?.appId);
253275
+ if (appId3 && !/^\d{6,25}$/.test(appId3)) throw new UsageError9("--app-id is the number after /app/ in the app's Play Console URL");
253276
+ return {
253277
+ op,
253278
+ ...consentOp ? { consentOp } : {},
253279
+ track: track2,
253280
+ group,
253281
+ packageName,
253282
+ ...developer ? { developer } : {},
253283
+ ready: op === "pool-add" && !groupOnly,
253284
+ countries: countries2,
253285
+ from,
253286
+ ...appId3 ? { appId: appId3 } : {}
253287
+ };
253156
253288
  }
253157
253289
  async function runStoreGoogleTesters(pos, flags, io2, deps = {}) {
253158
253290
  const env = deps.env ?? process.env;
@@ -253225,11 +253357,13 @@ async function consentCommand(p2, io2, ask4, stateDir2, now) {
253225
253357
  track: p2.track,
253226
253358
  grantedAt: at2.toISOString(),
253227
253359
  expiresAt: new Date(at2.getTime() + POOL_CONSENT_DAYS * DAY_MS6).toISOString(),
253228
- osUser: osUser2()
253360
+ osUser: osUser2(),
253361
+ covers: [...POOL_CONSENT_COVERS]
253229
253362
  };
253230
253363
  for (const line of [
253231
253364
  `This records your consent, for ${POOL_CONSENT_DAYS} days (until ${record5.expiresAt.slice(0, 10)}), for himi to add or remove Wix's closed-test pool group ${p2.group}`,
253232
- `on the testers of ${p2.packageName}${developerId ? ` (developer account ${developerId})` : ""} without asking you each time. Every change is still planned, checked and logged as a job.`,
253365
+ `on the testers of ${p2.packageName}${developerId ? ` (developer account ${developerId})` : ""} without asking you each time, and, on pool-add, to add the pool's countries to "${p2.track}",`,
253366
+ `put your newest ${POOL_DEFAULT_FROM} release on it and send the app's changes to Google's review. Every change is still planned, checked and logged as a job.`,
253233
253367
  `Withdraw it any time: himi store google testers consent revoke`
253234
253368
  ]) io2.error(line);
253235
253369
  if ((await ask4(`Type "yes" to agree:`)).trim().toLowerCase() !== "yes") return fail13(io2, "consent_declined", "not confirmed; no consent was recorded", base2);
@@ -253279,71 +253413,169 @@ async function run3(c2) {
253279
253413
  return 0;
253280
253414
  }
253281
253415
  const adding = p2.op === "pool-add";
253282
- if (adding === onTrack) {
253283
- io2.log(JSON.stringify({ ok: true, ...base2, onTrack, changed: false, groups, nothingToDo: `${p2.group} is ${onTrack ? "already" : "not"} on ${p2.track}` }));
253416
+ const groupNeeded = adding !== onTrack;
253417
+ const ready = adding && p2.ready ? await prepareReady(c2, developerId) : void 0;
253418
+ if (!groupNeeded && !ready?.input) {
253419
+ io2.log(JSON.stringify({ ok: true, ...base2, onTrack, changed: false, groups, nothingToDo: `${p2.group} is ${onTrack ? "already" : "not"} on ${p2.track}`, ...ready?.note ? { ready: { skipped: [ready.note] } } : {} }));
253284
253420
  return 0;
253285
253421
  }
253286
253422
  const wanted = adding ? [...groups, p2.group] : groups.filter((g2) => !same5(g2, p2.group));
253287
- if (!wanted.length) {
253423
+ if (groupNeeded && !wanted.length) {
253288
253424
  return fail13(io2, "pool_group_last", `${p2.group} is the only Google Group on ${p2.track}, and Google Play's API cannot set an empty list (it would leave the testers as they are). Remove it by hand: in Google Play Console, open ${p2.packageName} > Test and release > Testing > Closed testing > track "${p2.track}" > Testers, untick or remove ${p2.group} and save. Nothing was changed.`, base2);
253289
253425
  }
253290
253426
  const runner2 = await c2.google.runner(developerId);
253291
253427
  let job;
253292
- try {
253293
- job = await runner2.plan("gplay.closedTest.setup", { packageName: p2.packageName, track: p2.track, groups: wanted }, c2.actor);
253294
- const problem = planProblem(job, [`tracks/${p2.track}`, `testers/${p2.track}`], /^Google's closed-test rule/) ?? (job.plan.changes.some((ch2) => ch2.resource === `tracks/${p2.track}` && ch2.op !== (creating ? "create" : "noop")) ? creating ? `the plan does not create the missing track ${p2.track}` : `the plan also changes the track ${p2.track} itself` : void 0) ?? (JSON.stringify(job.plan.facts?.groups ?? null) !== JSON.stringify([...groups].sort()) ? `the track's groups changed since they were read (${job.plan.facts?.groups?.join(", ") ?? "unknown"})` : void 0);
253295
- if (problem) return fail13(io2, "plan_unexpected", `${problem}; nothing was approved`, { ...base2, jobId: job.id, status: job.status, changes: changesOf2(job) });
253428
+ let readyPlan;
253429
+ let review;
253430
+ let reviewSkipped;
253431
+ const readyRunner = ready?.input ? await c2.google.runner(developerId, { console: true }) : void 0;
253432
+ const readyOut = {};
253433
+ try {
253434
+ if (groupNeeded) {
253435
+ job = await runner2.plan("gplay.closedTest.setup", { packageName: p2.packageName, track: p2.track, groups: wanted }, c2.actor);
253436
+ const problem = planProblem(job, [`tracks/${p2.track}`, `testers/${p2.track}`], /^Google's closed-test rule/) ?? (job.plan.changes.some((ch2) => ch2.resource === `tracks/${p2.track}` && ch2.op !== (creating ? "create" : "noop")) ? creating ? `the plan does not create the missing track ${p2.track}` : `the plan also changes the track ${p2.track} itself` : void 0) ?? (JSON.stringify(job.plan.facts?.groups ?? null) !== JSON.stringify([...groups].sort()) ? `the track's groups changed since they were read (${job.plan.facts?.groups?.join(", ") ?? "unknown"})` : void 0);
253437
+ if (problem) return fail13(io2, "plan_unexpected", `${problem}; nothing was approved`, { ...base2, jobId: job.id, status: job.status, changes: changesOf2(job) });
253438
+ }
253439
+ if (ready?.input && readyRunner) {
253440
+ readyPlan = creating ? void 0 : await planReady(readyRunner, ready.input, ready.view, c2.actor);
253441
+ if (readyPlan) try {
253442
+ const probe2 = await planReview(readyRunner, ready.input, c2.actor);
253443
+ if (readyPlan && !job && !readyPlan.steps.length) review = probe2;
253444
+ } catch (e2) {
253445
+ const why = `${e2.message ?? ""} ${e2.job?.error ?? ""}`;
253446
+ if (!/productionOwnerApprovalId/.test(why)) throw e2;
253447
+ reviewSkipped = `review: sending for review now would also send this app's pending production or beta changes, which pool-add never does; send them yourself in Play Console (Publishing overview), then run pool-add again`;
253448
+ }
253449
+ if (readyPlan && !job && !readyPlan.steps.length && !reviewSkipped) {
253450
+ review ??= await planReview(readyRunner, ready.input, c2.actor);
253451
+ if (isNoop(review)) {
253452
+ io2.log(JSON.stringify({ ok: true, ...base2, onTrack, changed: false, groups, nothingToDo: `${p2.group} is on ${p2.track}, which targets ${ready.input.countries.join(", ")}, carries its release and is in review or published`, ready: { skipped: readyPlan.skipped, review: review.plan.changes.map((ch2) => ch2.summary).join("; ") } }));
253453
+ return 0;
253454
+ }
253455
+ }
253456
+ }
253296
253457
  for (const line of [
253297
- `${adding ? "This adds" : "This removes"} Wix's closed-test pool group ${p2.group} ${adding ? "to" : "from"} the testers of closed track "${p2.track}" on ${p2.packageName} (developer account ${developerId})${creating ? `, creating the custom closed track "${p2.track}"` : ""}:`,
253298
- ...changesOf2(job).map((l3) => ` - ${l3}`),
253299
- adding ? " - Every other group stays. The pool's phones can opt in to the closed test after this." : " - Every other group stays. The pool's phones lose access to the closed test.",
253300
- ` - Job ${job.id}, plan ${job.planHash.slice(0, 8)}.`
253458
+ job ? `${adding ? "This adds" : "This removes"} Wix's closed-test pool group ${p2.group} ${adding ? "to" : "from"} the testers of closed track "${p2.track}" on ${p2.packageName} (developer account ${developerId})${creating ? `, creating the custom closed track "${p2.track}"` : ""}:` : `${p2.group} is already on "${p2.track}" (${p2.packageName}, developer account ${developerId}). This readies the track for the pool's phones:`,
253459
+ ...(job ? changesOf2(job) : []).map((l3) => ` - ${l3}`),
253460
+ ...ready?.input ? (readyPlan ? readyLines(readyPlan, ready.input).slice(0, reviewSkipped ? -1 : void 0) : [`add ${ready.input.countries.join(", ")} to "${p2.track}", put the newest release on ${ready.input.from} onto it, then send the app's changes to Google's review`]).map((l3) => ` - ${l3}`) : [],
253461
+ ...(readyPlan?.skipped ?? []).map((l3) => ` - already done: ${l3}`),
253462
+ ...ready?.note ? [` - not done: ${ready.note}`] : [],
253463
+ ...reviewSkipped ? [` - not done: ${reviewSkipped}`] : [],
253464
+ !job ? " - The track's groups stay as they are." : adding ? " - Every other group stays. The pool's phones can opt in to the closed test after this." : " - Every other group stays. The pool's phones lose access to the closed test.",
253465
+ ...job ? [` - Job ${job.id}, plan ${job.planHash.slice(0, 8)}.`] : []
253301
253466
  ]) io2.error(line);
253302
253467
  if (c2.consent) io2.error(`consent: ${c2.consent.grantedAt} (recorded by ${c2.consent.osUser}, until ${c2.consent.expiresAt}); applying without a prompt`);
253303
- else if (!c2.ask) return fail13(io2, "confirmation_required", "no terminal and no recorded consent: run himi store google testers consent grant in your own terminal", { ...base2, jobId: job.id });
253468
+ else if (!c2.ask) return fail13(io2, "confirmation_required", "no terminal and no recorded consent: run himi store google testers consent grant in your own terminal", { ...base2, ...job ? { jobId: job.id } : {} });
253304
253469
  else {
253305
253470
  const agreed = (await c2.ask(`Type "yes" to agree:`)).trim().toLowerCase() === "yes";
253306
- if (!agreed) return fail13(io2, "consent_declined", "not confirmed; nothing was approved or changed", { ...base2, jobId: job.id });
253471
+ if (!agreed) return fail13(io2, "consent_declined", "not confirmed; nothing was approved or changed", { ...base2, ...job ? { jobId: job.id } : {} });
253307
253472
  }
253308
- const latest = await readGroups(c2, developerId);
253309
- const moved = creating ? latest !== void 0 : !latest || latest.length !== groups.length || !latest.every((g2) => groups.some((o2) => same5(o2, g2)));
253310
- if (moved) {
253311
- return fail13(io2, "groups_changed", `the track's groups changed while you were deciding (now: ${latest?.join(", ") || "none"}); nothing was approved or written. Run the command again.`, { ...base2, jobId: job.id });
253473
+ if (job) {
253474
+ const latest = await readGroups(c2, developerId);
253475
+ const moved = creating ? latest !== void 0 : !latest || latest.length !== groups.length || !latest.every((g2) => groups.some((o2) => same5(o2, g2)));
253476
+ if (moved) {
253477
+ return fail13(io2, "groups_changed", `the track's groups changed while you were deciding (now: ${latest?.join(", ") || "none"}); nothing was approved or written. Run the command again.`, { ...base2, jobId: job.id });
253478
+ }
253479
+ }
253480
+ if (readyPlan && readyRunner) readyOut.applied = await applySteps(readyRunner, readyPlan, c2.person, c2.actor, c2.now);
253481
+ if (job) {
253482
+ if (readyOut.applied) {
253483
+ const latest = await readGroups(c2, developerId);
253484
+ const moved = creating ? latest !== void 0 : !latest || latest.length !== groups.length || !latest.every((g2) => groups.some((o2) => same5(o2, g2)));
253485
+ if (moved) {
253486
+ return fail13(io2, "groups_changed", `the track's groups changed while the countries and release were applied (now: ${latest?.join(", ") || "none"}); those were applied, the pool group was not written. Run the command again.`, { ...base2, jobId: job.id, ...readyOut });
253487
+ }
253488
+ }
253489
+ job = await approveAndApply(runner2, job, c2.person, c2.actor, c2.now);
253312
253490
  }
253313
- job = await approveAndApply(runner2, job, c2.person, c2.actor, c2.now);
253314
253491
  } catch (e2) {
253315
- const failed3 = e2 instanceof JobFailure ? e2.job : e2.job;
253492
+ const failed3 = e2 instanceof JobFailure || e2 instanceof ReadyRefusal ? e2.job : e2.job;
253316
253493
  const upgraded = upgradedRefusal(io2, p2, `${e2.message ?? ""} ${failed3?.error ?? ""}`, { ...base2, ...failed3 ? { jobId: failed3.id, status: failed3.status } : {} });
253317
253494
  if (upgraded !== void 0) return upgraded;
253318
- return fail13(io2, "job_failed", e2.message ?? String(e2), { ...base2, ...failed3 ? { jobId: failed3.id, status: failed3.status, next: `gplay-node jobs show ${failed3.id}` } : {} });
253495
+ return fail13(io2, "job_failed", e2.message ?? String(e2), { ...base2, ...readyOut, ...failed3 ? { jobId: failed3.id, status: failed3.status, next: `gplay-node jobs show ${failed3.id}` } : {} });
253319
253496
  }
253320
- if (job.status !== "verified") {
253497
+ if (job && job.status !== "verified") {
253321
253498
  const upgraded = upgradedRefusal(io2, p2, String(job.error ?? ""), { ...base2, jobId: job.id, status: job.status });
253322
253499
  if (upgraded !== void 0) return upgraded;
253500
+ return fail13(io2, "job_failed", `job ${job.id} is ${job.status}: ${job.error ?? "not read back"}`, { ...base2, ...readyOut, jobId: job.id, status: job.status, next: `gplay-node jobs show ${job.id}` });
253323
253501
  }
253324
- if (job.status !== "verified") return fail13(io2, "job_failed", `job ${job.id} is ${job.status}: ${job.error ?? "not read back"}`, { ...base2, jobId: job.id, status: job.status, next: `gplay-node jobs show ${job.id}` });
253325
253502
  await rememberDeveloper(host.stateDir, p2.packageName, developerId);
253326
253503
  const readBack4 = await readGroups(c2, developerId);
253327
- if (readBack4 === void 0) return fail13(io2, "job_failed", `the job reads ${job.status}, but track ${p2.track} was not found on read-back`, { ...base2, jobId: job.id, status: job.status });
253504
+ if (readBack4 === void 0) return fail13(io2, "job_failed", `the track ${p2.track} was not found on read-back`, { ...base2, ...readyOut, ...job ? { jobId: job.id, status: job.status } : {} });
253328
253505
  const after = readBack4;
253329
253506
  const nowOn = after.some((g2) => same5(g2, p2.group));
253330
- if (nowOn !== adding) return fail13(io2, "job_failed", `the job reads verified, but ${p2.track}'s groups read back as ${after.join(", ") || "none"}`, { ...base2, jobId: job.id, status: job.status });
253507
+ if (nowOn !== adding) return fail13(io2, "job_failed", `${p2.track}'s groups read back as ${after.join(", ") || "none"}`, { ...base2, ...readyOut, ...job ? { jobId: job.id, status: job.status } : {} });
253508
+ if (ready?.input && readyRunner) {
253509
+ try {
253510
+ if (!readyPlan) {
253511
+ readyPlan = await planReady(readyRunner, ready.input, await readReleases(c2, developerId, ready.input.from), c2.actor);
253512
+ readyOut.applied = await applySteps(readyRunner, readyPlan, c2.person, c2.actor, c2.now);
253513
+ }
253514
+ readyOut.skipped = readyPlan.skipped;
253515
+ if (reviewSkipped) readyOut.skipped = [...readyPlan.skipped, reviewSkipped];
253516
+ else {
253517
+ try {
253518
+ readyOut.review = await applyReview(readyRunner, ready.input, c2.person, c2.actor, c2.now, review);
253519
+ } catch (e2) {
253520
+ if (!/productionOwnerApprovalId/.test(`${e2.message ?? ""} ${e2.job?.error ?? ""}`)) throw e2;
253521
+ readyOut.skipped = [...readyPlan.skipped, "review: sending for review now would also send this app's pending production or beta changes, which pool-add never does; send them yourself in Play Console (Publishing overview), then run pool-add again"];
253522
+ }
253523
+ }
253524
+ } catch (e2) {
253525
+ const failed3 = e2 instanceof ReadyRefusal || e2 instanceof JobFailure ? e2.job : e2.job;
253526
+ return fail13(
253527
+ io2,
253528
+ "job_failed",
253529
+ `the pool group is ${adding ? "on" : "off"} the track, but readying it stopped: ${e2.message ?? String(e2)}`,
253530
+ { ...base2, groups: after, ...readyOut, ...failed3 ? { jobId: failed3.id, status: failed3.status, next: `gplay-node jobs show ${failed3.id}` } : {} }
253531
+ );
253532
+ }
253533
+ }
253331
253534
  io2.log(JSON.stringify({
253332
253535
  ok: true,
253333
253536
  ...base2,
253334
- jobId: job.id,
253335
- status: job.status,
253537
+ ...job ? { jobId: job.id, status: job.status, changes: changesOf2(job) } : {},
253336
253538
  onTrack: nowOn,
253337
253539
  changed: true,
253338
253540
  ...creating ? { createdTrack: true } : {},
253339
253541
  groups: after,
253340
- changes: changesOf2(job),
253542
+ ...ready ? { ready: { ...readyOut, ...ready.note ? { skipped: [...readyOut.skipped ?? [], ready.note] } : {} } } : {},
253341
253543
  ...c2.consent ? { consent: c2.consent.grantedAt } : {},
253342
- next: adding ? "tell Wix RelOps the group is on; after the test, run: himi store google testers pool-remove" : "the pool's group is off the track"
253544
+ next: adding ? ready?.input ? "once Google approves the review, the pool's phones can opt in; tell Wix RelOps. After the test, run: himi store google testers pool-remove" : "tell Wix RelOps the group is on; after the test, run: himi store google testers pool-remove" : "the pool's group is off the track"
253343
253545
  }));
253344
253546
  return 0;
253345
253547
  }
253346
- var POOL_GROUP_ENV, POOL_DEFAULT_TRACK, POOL_CONSENT_DAYS, DAY_MS6, UPGRADED_RE, STORE_GOOGLE_TESTERS_USAGE, STORE_GOOGLE_TESTERS_CODES, text22, GROUP_RE, DEVELOPER_RE3, PACKAGE_RE3, NOT_CLOSED, UsageError9, consentPath, same5;
253548
+ async function readReleases(c2, developerId, from) {
253549
+ const host = c2.google.host;
253550
+ const stored = (await host.store.load())?.account;
253551
+ const account2 = { kind: "google", developerId, principal: stored ?? `the gplay-node sign-in (${host.store.id})` };
253552
+ const jobs = await Promise.resolve().then(() => (init_dist2(), dist_exports2));
253553
+ const googleFor = host.googleFor ?? jobs.googleClientsFor({ stateDir: host.stateDir, store: host.store });
253554
+ const clients = await googleFor(account2, { readOnly: true });
253555
+ return clients.api.readEdit(c2.p.packageName, async (edit) => {
253556
+ const tracks = await edit.listTracks();
253557
+ const of2 = (name) => tracks.find((t2) => t2.track === name)?.releases ?? (tracks.some((t2) => t2.track === name) ? [] : void 0);
253558
+ return { from: of2(from), to: of2(c2.p.track) };
253559
+ });
253560
+ }
253561
+ async function prepareReady(c2, developerId) {
253562
+ const { p: p2 } = c2;
253563
+ if (c2.consent && !(c2.consent.covers ?? []).includes("ready")) {
253564
+ return { note: "countries, release and review: your recorded consent covers only the pool group; run himi store google testers consent grant again in your own terminal to cover them" };
253565
+ }
253566
+ let appId3 = p2.appId;
253567
+ if (!appId3) {
253568
+ try {
253569
+ appId3 = (await (await Promise.resolve().then(() => (init_dist(), dist_exports))).readPlanRecord(c2.google.host.stateDir, p2.packageName)).appId;
253570
+ } catch {
253571
+ appId3 = void 0;
253572
+ }
253573
+ }
253574
+ if (!appId3) return { note: `countries, release and review need the app's Play Console id: pass --app-id <the number after /app/ in its Console URL> or set appId in ${GOOGLE_FACTS_FILE}` };
253575
+ const input = { packageName: p2.packageName, track: p2.track, appId: appId3, countries: p2.countries, from: p2.from };
253576
+ return { input, view: await readReleases(c2, developerId, p2.from) };
253577
+ }
253578
+ var POOL_GROUP_ENV, POOL_DEFAULT_TRACK, POOL_COUNTRIES_ENV, POOL_CONSENT_COVERS, POOL_CONSENT_DAYS, DAY_MS6, UPGRADED_RE, STORE_GOOGLE_TESTERS_USAGE, STORE_GOOGLE_TESTERS_CODES, text22, GROUP_RE, DEVELOPER_RE3, PACKAGE_RE3, NOT_CLOSED, UsageError9, consentPath, same5;
253347
253579
  var init_store_google_testers = __esm({
253348
253580
  "src/store-google-testers.ts"() {
253349
253581
  init_define_HHP_CATALOG();
@@ -253351,12 +253583,15 @@ var init_store_google_testers = __esm({
253351
253583
  init_store_host();
253352
253584
  init_store_google_host();
253353
253585
  init_store_relops_google();
253586
+ init_store_google_pool_ready();
253354
253587
  POOL_GROUP_ENV = "HIMI_POOL_TESTER_GROUP";
253355
253588
  POOL_DEFAULT_TRACK = "himi-pool";
253589
+ POOL_COUNTRIES_ENV = "HIMI_POOL_COUNTRIES";
253590
+ POOL_CONSENT_COVERS = ["group", "ready"];
253356
253591
  POOL_CONSENT_DAYS = 90;
253357
253592
  DAY_MS6 = 24 * 60 * 60 * 1e3;
253358
253593
  UPGRADED_RE = /upgraded to use open or closed testing/i;
253359
- STORE_GOOGLE_TESTERS_USAGE = "himi store google testers pool-add|pool-remove|pool-check|consent grant|consent revoke|consent status [--dir <app>] [--track himi-pool] [--android-package <package>] [--developer <id>]";
253594
+ STORE_GOOGLE_TESTERS_USAGE = "himi store google testers pool-add|pool-remove|pool-check|consent grant|consent revoke|consent status [--dir <app>] [--track himi-pool] [--android-package <package>] [--developer <id>] [--app-id <console id>] [--countries <names>] [--from alpha] [--group-only]";
253360
253595
  STORE_GOOGLE_TESTERS_CODES = [
253361
253596
  "invalid_usage",
253362
253597
  "node_too_old",
@@ -280928,6 +281163,7 @@ init_define_HHP_CATALOG();
280928
281163
  var REPEATABLE_FLAGS = /* @__PURE__ */ new Set(["data", "image", "set", "attach"]);
280929
281164
  var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
280930
281165
  "no-network",
281166
+ "group-only",
280931
281167
  "unpin",
280932
281168
  "browser",
280933
281169
  "no-open",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1769.0",
3
+ "version": "0.1770.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "0e2351fdae217cbddf92fe3d19a6b6f465477cf2cb4b8b1654ad5dc1"
85
+ "falconPackageHash": "4c460ddf9692370e4501364882164e192dfde78b4dc718d48470bba5"
86
86
  }