@wix/himalaya-cli 0.1641.0 → 0.1643.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 (89) hide show
  1. package/dist/cli.mjs +327 -155
  2. package/guides/himi-json-output.md +20 -1
  3. package/guides/qa-builds.md +33 -0
  4. package/package.json +2 -2
  5. package/template-icons/conference.png +0 -0
  6. package/templates/branded-lite/dev/index.ts +152 -88
  7. package/templates/branded-lite/l10n/en.json +1 -1
  8. package/templates/branded-lite/tier5-src/_shared/featured-event.ts +63 -0
  9. package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +93 -11
  10. package/templates/community-club/dev/index.ts +152 -88
  11. package/templates/community-club/tier5-src/_shared/featured-event.ts +63 -0
  12. package/templates/community-club/tier5-src/himi-events-detail/index.ts +93 -11
  13. package/templates/conference/README.md +53 -0
  14. package/templates/conference/config.ts +321 -0
  15. package/templates/conference/dev/index.ts +17252 -0
  16. package/templates/conference/himalaya.content.json +46 -0
  17. package/templates/conference/himalaya.template.json +15 -0
  18. package/templates/conference/icon.png +0 -0
  19. package/templates/conference/platforms.json +1 -0
  20. package/templates/conference/tier5-src/_shared/agenda-stars.ts +64 -0
  21. package/templates/conference/tier5-src/_shared/app-locale.ts +61 -0
  22. package/templates/conference/tier5-src/_shared/branded-lite-hosted.ts +279 -0
  23. package/templates/conference/tier5-src/_shared/branded-load-state.ts +109 -0
  24. package/templates/conference/tier5-src/_shared/business-chat-copy.ts +40 -0
  25. package/templates/conference/tier5-src/_shared/business-chat-history.ts +51 -0
  26. package/templates/conference/tier5-src/_shared/business-chat-message-model.ts +177 -0
  27. package/templates/conference/tier5-src/_shared/business-chat-model.ts +56 -0
  28. package/templates/conference/tier5-src/_shared/business-chat-presenter.ts +576 -0
  29. package/templates/conference/tier5-src/_shared/business-chat-transport.ts +148 -0
  30. package/templates/conference/tier5-src/_shared/collection-contract.ts +229 -0
  31. package/templates/conference/tier5-src/_shared/collection-query.ts +193 -0
  32. package/templates/conference/tier5-src/_shared/collection-service.ts +400 -0
  33. package/templates/conference/tier5-src/_shared/engine-intl.ts +508 -0
  34. package/templates/conference/tier5-src/_shared/event-agenda.ts +122 -0
  35. package/templates/conference/tier5-src/_shared/event-registration.ts +86 -0
  36. package/templates/conference/tier5-src/_shared/featured-event.ts +63 -0
  37. package/templates/conference/tier5-src/_shared/himi-account.ts +164 -0
  38. package/templates/conference/tier5-src/_shared/himi-copy.ts +89 -0
  39. package/templates/conference/tier5-src/_shared/himi-events.ts +65 -0
  40. package/templates/conference/tier5-src/_shared/himi-store.ts +7 -0
  41. package/templates/conference/tier5-src/_shared/hosted-checkout.ts +70 -0
  42. package/templates/conference/tier5-src/_shared/iap-attendance-form.ts +106 -0
  43. package/templates/conference/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
  44. package/templates/conference/tier5-src/_shared/iap-attendance.ts +38 -0
  45. package/templates/conference/tier5-src/_shared/iap-worker.ts +125 -0
  46. package/templates/conference/tier5-src/_shared/inbox-rooms.ts +68 -0
  47. package/templates/conference/tier5-src/_shared/local-preferences.ts +38 -0
  48. package/templates/conference/tier5-src/_shared/member-access.ts +52 -0
  49. package/templates/conference/tier5-src/_shared/member-account-routes.ts +52 -0
  50. package/templates/conference/tier5-src/_shared/member-read.ts +52 -0
  51. package/templates/conference/tier5-src/_shared/member-screen.ts +99 -0
  52. package/templates/conference/tier5-src/_shared/offset-page.ts +10 -0
  53. package/templates/conference/tier5-src/_shared/online-actions.ts +76 -0
  54. package/templates/conference/tier5-src/_shared/owner-load-error.ts +348 -0
  55. package/templates/conference/tier5-src/_shared/payment-setup.ts +6 -0
  56. package/templates/conference/tier5-src/_shared/rich-body.ts +78 -0
  57. package/templates/conference/tier5-src/_shared/rich-content-link.ts +34 -0
  58. package/templates/conference/tier5-src/_shared/sign-in-sheet.ts +18 -0
  59. package/templates/conference/tier5-src/business-chat/index.ts +724 -0
  60. package/templates/conference/tier5-src/himi-conference-agenda/index.ts +183 -0
  61. package/templates/conference/tier5-src/himi-conference-home/index.ts +389 -0
  62. package/templates/conference/tier5-src/himi-events-account/index.ts +219 -0
  63. package/templates/conference/tier5-src/himi-events-detail/index.ts +1304 -0
  64. package/templates/conference/tier5-src/himi-events-list/index.ts +124 -0
  65. package/templates/conference/tier5-src/himi-events-my-events/index.ts +225 -0
  66. package/templates/conference/tier5-src/himi-events-rsvp/index.ts +230 -0
  67. package/templates/conference/tier5-src/himi-store-account/index.ts +998 -0
  68. package/templates/conference/tokens.json +365 -0
  69. package/templates/events-meetups/dev/index.ts +152 -88
  70. package/templates/events-meetups/tier5-src/_shared/featured-event.ts +63 -0
  71. package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +93 -11
  72. package/templates/gym-fitness/dev/index.ts +152 -88
  73. package/templates/gym-fitness/tier5-src/_shared/featured-event.ts +63 -0
  74. package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +93 -11
  75. package/templates/nonprofit-cause/dev/index.ts +152 -88
  76. package/templates/nonprofit-cause/tier5-src/_shared/featured-event.ts +63 -0
  77. package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +93 -11
  78. package/templates/podcast-creator/dev/index.ts +152 -88
  79. package/templates/podcast-creator/tier5-src/_shared/featured-event.ts +63 -0
  80. package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +93 -11
  81. package/templates/portfolio-creative/dev/index.ts +152 -88
  82. package/templates/portfolio-creative/tier5-src/_shared/featured-event.ts +63 -0
  83. package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +93 -11
  84. package/templates/restaurant/dev/index.ts +152 -88
  85. package/templates/restaurant/tier5-src/_shared/featured-event.ts +63 -0
  86. package/templates/restaurant/tier5-src/himi-events-detail/index.ts +93 -11
  87. package/templates/yoga-studio/dev/index.ts +152 -88
  88. package/templates/yoga-studio/tier5-src/_shared/featured-event.ts +63 -0
  89. package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +93 -11
package/dist/cli.mjs CHANGED
@@ -22044,13 +22044,13 @@ function createQuickJsWorkerRealm(options = {}) {
22044
22044
  function retire(thread, reason) {
22045
22045
  if (worker !== thread) return;
22046
22046
  worker = null;
22047
- const fail7 = failInFlight;
22047
+ const fail8 = failInFlight;
22048
22048
  failInFlight = null;
22049
22049
  try {
22050
22050
  void thread.terminate();
22051
22051
  } catch {
22052
22052
  }
22053
- fail7?.(reason);
22053
+ fail8?.(reason);
22054
22054
  }
22055
22055
  function ensureWorker() {
22056
22056
  if (worker) return worker;
@@ -22260,12 +22260,12 @@ function createQuickJsWorkerRealm(options = {}) {
22260
22260
  async dispose() {
22261
22261
  const w2 = worker;
22262
22262
  worker = null;
22263
- const fail7 = failInFlight;
22263
+ const fail8 = failInFlight;
22264
22264
  failInFlight = null;
22265
22265
  if (w2) {
22266
22266
  await w2.terminate();
22267
22267
  }
22268
- fail7?.(new Error("the realm was disposed while this operation was still in flight"));
22268
+ fail8?.(new Error("the realm was disposed while this operation was still in flight"));
22269
22269
  }
22270
22270
  };
22271
22271
  }
@@ -41321,7 +41321,7 @@ function newRicosRequestId() {
41321
41321
  async function runRicosImageUpload(o2) {
41322
41322
  const { session, uploadService: svc, requestId: requestId2, file: file2, deps } = o2;
41323
41323
  const t2 = deps.timers ?? { setTimeout: (fn2, ms2) => setTimeout(fn2, ms2), clearTimeout: (h2) => clearTimeout(h2) };
41324
- const fail7 = (reason) => {
41324
+ const fail8 = (reason) => {
41325
41325
  session.failMedia(requestId2);
41326
41326
  return { ok: false, reason };
41327
41327
  };
@@ -41347,32 +41347,32 @@ async function runRicosImageUpload(o2) {
41347
41347
  });
41348
41348
  deps.dispatch({ actionId: `tier5.${svc}.genUpload`, args: { requestId: requestId2, mimeType: file2.mimeType, fileName: file2.fileName, ...file2.sizeBytes !== void 0 ? { sizeBytes: file2.sizeBytes } : {} } });
41349
41349
  });
41350
- if (!entry) return fail7("timeout");
41351
- if (entry.status !== "ready" || !entry.uploadUrl || !/^https:\/\//i.test(entry.uploadUrl)) return fail7("gen_upload");
41350
+ if (!entry) return fail8("timeout");
41351
+ if (entry.status !== "ready" || !entry.uploadUrl || !/^https:\/\//i.test(entry.uploadUrl)) return fail8("gen_upload");
41352
41352
  let body;
41353
41353
  try {
41354
41354
  body = typeof file2.body === "function" ? await file2.body() : file2.body;
41355
41355
  } catch {
41356
- return fail7("read");
41356
+ return fail8("read");
41357
41357
  }
41358
41358
  const sep26 = entry.uploadUrl.includes("?") ? "&" : "?";
41359
41359
  let res;
41360
41360
  try {
41361
41361
  res = await deps.fetch(`${entry.uploadUrl}${sep26}filename=${encodeURIComponent(file2.fileName)}`, { method: "PUT", headers: { "Content-Type": file2.mimeType }, body });
41362
41362
  } catch {
41363
- return fail7("put");
41363
+ return fail8("put");
41364
41364
  }
41365
- if (!res.ok) return fail7("put");
41365
+ if (!res.ok) return fail8("put");
41366
41366
  let json9;
41367
41367
  try {
41368
41368
  json9 = await res.json();
41369
41369
  } catch {
41370
- return fail7("bad_descriptor");
41370
+ return fail8("bad_descriptor");
41371
41371
  }
41372
41372
  const root = json9 && typeof json9 === "object" ? json9 : {};
41373
41373
  const d2 = root.file && typeof root.file === "object" ? root.file : root;
41374
41374
  const id = typeof d2.id === "string" ? d2.id : "";
41375
- if (!id) return fail7("bad_descriptor");
41375
+ if (!id) return fail8("bad_descriptor");
41376
41376
  const ok3 = session.resolveMedia(requestId2, {
41377
41377
  id,
41378
41378
  url: typeof d2.url === "string" ? d2.url : "",
@@ -143246,7 +143246,7 @@ async function crawlScreenJourney(opts) {
143246
143246
  async function crawlSingleScreenJourney(opts) {
143247
143247
  return withSwallowedRejections(async () => {
143248
143248
  const findings = [];
143249
- const fail7 = (message2, step) => {
143249
+ const fail8 = (message2, step) => {
143250
143250
  findings.push({
143251
143251
  screen: opts.screenId,
143252
143252
  trigger: step ? { tap: step.component ?? null, key: "journey", action: step.action } : "boot",
@@ -143257,11 +143257,11 @@ async function crawlSingleScreenJourney(opts) {
143257
143257
  });
143258
143258
  };
143259
143259
  if (!opts.journey.expectText.length || opts.journey.expectText.some((text15) => !text15.trim())) {
143260
- fail7(`journey "${opts.journey.name}" needs non-empty expectText values that prove a visible result`);
143260
+ fail8(`journey "${opts.journey.name}" needs non-empty expectText values that prove a visible result`);
143261
143261
  return { screen: opts.screenId, journey: opts.journey.name, stepsExercised: 0, findings };
143262
143262
  }
143263
143263
  if (!opts.bundleJs) {
143264
- fail7(`journey "${opts.journey.name}" targets a screen without a worker bundle`);
143264
+ fail8(`journey "${opts.journey.name}" targets a screen without a worker bundle`);
143265
143265
  return { screen: opts.screenId, journey: opts.journey.name, stepsExercised: 0, findings };
143266
143266
  }
143267
143267
  const { call: wixCall } = layeredTransport({ rules: opts.rules, cmsSeed: opts.cmsSeed, canned: opts.canned });
@@ -143284,7 +143284,7 @@ async function crawlSingleScreenJourney(opts) {
143284
143284
  try {
143285
143285
  if (worker.deadLifecycle) {
143286
143286
  const dead = worker.deadLifecycle;
143287
- fail7(`journey "${opts.journey.name}" cannot run root onAppear ${dead.actionId}: ${dead.reason} (declared: ${dead.declared.join(", ") || "none"})`);
143287
+ fail8(`journey "${opts.journey.name}" cannot run root onAppear ${dead.actionId}: ${dead.reason} (declared: ${dead.declared.join(", ") || "none"})`);
143288
143288
  }
143289
143289
  const sites = actionSitesForDescriptor(opts.descriptor);
143290
143290
  let stepsExercised = 0;
@@ -143309,7 +143309,7 @@ async function crawlSingleScreenJourney(opts) {
143309
143309
  const declared = sites.find((site2) => site2.actionId === step.action && (step.component === void 0 || site2.componentId === step.component));
143310
143310
  if (!declared) {
143311
143311
  receipt.reason = "not-declared";
143312
- fail7(`journey "${opts.journey.name}" cannot find ${step.component ? `${step.component} \u2192 ` : ""}${step.action} in this screen`, step);
143312
+ fail8(`journey "${opts.journey.name}" cannot find ${step.component ? `${step.component} \u2192 ` : ""}${step.action} in this screen`, step);
143313
143313
  continue;
143314
143314
  }
143315
143315
  receipt.scope = { screen: opts.screenId, componentId: declared.componentId, actionId: declared.actionId, hookKey: declared.key, control: declared.control?.type ?? null };
@@ -143318,20 +143318,20 @@ async function crawlSingleScreenJourney(opts) {
143318
143318
  const site = effectiveSiteFor(declared, state);
143319
143319
  if (!site) {
143320
143320
  receipt.reason = "no-row-value";
143321
- fail7(`journey "${opts.journey.name}" cannot dispatch ${step.action}: its list has no rendered row`, step);
143321
+ fail8(`journey "${opts.journey.name}" cannot dispatch ${step.action}: its list has no rendered row`, step);
143322
143322
  continue;
143323
143323
  }
143324
143324
  if (opts.captureInputEvidence) receipt.descriptorPayload = JSON.parse(JSON.stringify({ ...site.params ?? {}, ...site.args ?? {} }));
143325
143325
  const parsed = parseWorkerAction(site.actionId);
143326
143326
  if (!parsed) {
143327
143327
  receipt.reason = "not-worker-action";
143328
- fail7(`journey "${opts.journey.name}" step ${step.action} is not a worker action; cross-screen navigation belongs in the regular edge pass`, step);
143328
+ fail8(`journey "${opts.journey.name}" step ${step.action} is not a worker action; cross-screen navigation belongs in the regular edge pass`, step);
143329
143329
  continue;
143330
143330
  }
143331
143331
  const handle = worker.handles[parsed.service];
143332
143332
  if (!handle || !handle.actionNames().includes(parsed.action)) {
143333
143333
  receipt.reason = "worker-action-missing";
143334
- fail7(`journey "${opts.journey.name}" names unavailable worker action ${step.action}`, step);
143334
+ fail8(`journey "${opts.journey.name}" names unavailable worker action ${step.action}`, step);
143335
143335
  continue;
143336
143336
  }
143337
143337
  const mark = { wix: worker.calls.length, host: worker.hostCalls.length };
@@ -143345,7 +143345,7 @@ async function crawlSingleScreenJourney(opts) {
143345
143345
  receipt.status = "executed";
143346
143346
  } catch (error) {
143347
143347
  receipt.status = "threw";
143348
- fail7(`journey "${opts.journey.name}" step ${step.action} threw: ${errText(error)}`, step);
143348
+ fail8(`journey "${opts.journey.name}" step ${step.action} threw: ${errText(error)}`, step);
143349
143349
  }
143350
143350
  if (opts.captureInputEvidence) {
143351
143351
  stepFrames.push({ receipt, before: beforeState, after: JSON.stringify(snapshot3(worker).state) });
@@ -143355,7 +143355,7 @@ async function crawlSingleScreenJourney(opts) {
143355
143355
  }
143356
143356
  const settled = snapshot3(worker);
143357
143357
  if (worker.errors.length) {
143358
- for (const error of worker.errors) fail7(`journey "${opts.journey.name}" worker error: ${error.service}: ${error.message}`);
143358
+ for (const error of worker.errors) fail8(`journey "${opts.journey.name}" worker error: ${error.service}: ${error.message}`);
143359
143359
  }
143360
143360
  const observations = collectObservations(opts.descriptor, settled.state);
143361
143361
  const values = observations.join("\n");
@@ -143373,10 +143373,10 @@ async function crawlSingleScreenJourney(opts) {
143373
143373
  });
143374
143374
  continue;
143375
143375
  }
143376
- fail7(`journey "${opts.journey.name}" never rendered its expected visible result: ${JSON.stringify(expected)}`);
143376
+ fail8(`journey "${opts.journey.name}" never rendered its expected visible result: ${JSON.stringify(expected)}`);
143377
143377
  }
143378
143378
  for (const absent of opts.journey.absentText ?? []) {
143379
- if (values.includes(absent)) fail7(`journey "${opts.journey.name}" still rendered text that should be absent: ${JSON.stringify(absent)}`);
143379
+ if (values.includes(absent)) fail8(`journey "${opts.journey.name}" still rendered text that should be absent: ${JSON.stringify(absent)}`);
143380
143380
  }
143381
143381
  await Promise.all(stepFrames.map(async ({ receipt, before, after }) => {
143382
143382
  [receipt.beforeStateHash, receipt.afterStateHash] = await Promise.all([inputStateHash(before), inputStateHash(after)]);
@@ -176624,30 +176624,30 @@ function logicalCollection(spec, app) {
176624
176624
  }
176625
176625
  function assertFieldValue(type2, key3, value2) {
176626
176626
  if (value2 === null) return;
176627
- const fail7 = () => {
176627
+ const fail8 = () => {
176628
176628
  throw new Error(`field "${key3}" must be ${type2}`);
176629
176629
  };
176630
176630
  if (type2 === "NUMBER") {
176631
- if (typeof value2 !== "number" || !Number.isFinite(value2)) fail7();
176631
+ if (typeof value2 !== "number" || !Number.isFinite(value2)) fail8();
176632
176632
  return;
176633
176633
  }
176634
176634
  if (type2 === "BOOLEAN") {
176635
- if (typeof value2 !== "boolean") fail7();
176635
+ if (typeof value2 !== "boolean") fail8();
176636
176636
  return;
176637
176637
  }
176638
176638
  if (type2 === "ARRAY_STRING") {
176639
- if (!Array.isArray(value2) || value2.some((item) => typeof item !== "string")) fail7();
176639
+ if (!Array.isArray(value2) || value2.some((item) => typeof item !== "string")) fail8();
176640
176640
  return;
176641
176641
  }
176642
176642
  if (type2 === "ADDRESS" || type2 === "RICH_CONTENT") {
176643
- if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) fail7();
176643
+ if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) fail8();
176644
176644
  return;
176645
176645
  }
176646
176646
  if (type2 === "MEDIA_GALLERY") {
176647
- if (!Array.isArray(value2)) fail7();
176647
+ if (!Array.isArray(value2)) fail8();
176648
176648
  return;
176649
176649
  }
176650
- if (typeof value2 !== "string") fail7();
176650
+ if (typeof value2 !== "string") fail8();
176651
176651
  }
176652
176652
  function createFunctionDataCapability(options) {
176653
176653
  const declaredKv = new Map((options.data?.kv ?? []).map((spec) => [spec.name, spec]));
@@ -188745,6 +188745,151 @@ var init_apple_keys = __esm({
188745
188745
  }
188746
188746
  });
188747
188747
 
188748
+ // ../../core/serve-control/src/containers-builder.ts
188749
+ function isAndroidPackageName(value2) {
188750
+ return typeof value2 === "string" && value2.length <= ANDROID_PACKAGE_NAME_MAX && ANDROID_PACKAGE_NAME_RE.test(value2);
188751
+ }
188752
+ function hasStorePackagePrefix(value2) {
188753
+ return typeof value2 === "string" && value2.startsWith(`${STORE_PACKAGE_PREFIX}.`);
188754
+ }
188755
+ function isStorePackageName(value2) {
188756
+ return hasStorePackagePrefix(value2) && value2.length <= ANDROID_PACKAGE_NAME_MAX && STORE_PACKAGE_TAIL_RE.test(value2.slice(STORE_PACKAGE_PREFIX.length + 1));
188757
+ }
188758
+ function isWixPackageName(value2) {
188759
+ if (typeof value2 !== "string") return false;
188760
+ const name = value2.toLowerCase();
188761
+ return WIX_RESERVED_PACKAGE_NAMESPACES.some((ns2) => name === ns2 || name.startsWith(`${ns2}.`));
188762
+ }
188763
+ function storePackageNameProblem(value2) {
188764
+ if (isWixPackageName(value2)) return "package_name_reserved";
188765
+ if (typeof value2 === "string" && value2 !== "" && !hasStorePackagePrefix(value2)) return "package_name_prefix_required";
188766
+ if (!isAndroidPackageName(value2) || !isStorePackageName(value2)) return "invalid_package_name";
188767
+ return null;
188768
+ }
188769
+ var ANDROID_PACKAGE_NAME_RE, ANDROID_PACKAGE_NAME_MAX, STORE_PACKAGE_PREFIX, STORE_PACKAGE_TAIL_RE, WIX_RESERVED_PACKAGE_NAMESPACES;
188770
+ var init_containers_builder = __esm({
188771
+ "../../core/serve-control/src/containers-builder.ts"() {
188772
+ init_define_HHP_CATALOG();
188773
+ ANDROID_PACKAGE_NAME_RE = /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/;
188774
+ ANDROID_PACKAGE_NAME_MAX = 100;
188775
+ STORE_PACKAGE_PREFIX = "himi";
188776
+ STORE_PACKAGE_TAIL_RE = /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/;
188777
+ WIX_RESERVED_PACKAGE_NAMESPACES = ["branded", "com.webshell", "com.harmony", "com.wix", "com.wixpress"];
188778
+ }
188779
+ });
188780
+
188781
+ // src/store-app.ts
188782
+ var store_app_exports = {};
188783
+ __export(store_app_exports, {
188784
+ STORE_APP_CODES: () => STORE_APP_CODES,
188785
+ STORE_APP_USAGE: () => STORE_APP_USAGE,
188786
+ runStoreApp: () => runStoreApp
188787
+ });
188788
+ function codeFor(status) {
188789
+ if (status === 401) return "unauthorized";
188790
+ if (status === 403) return "forbidden";
188791
+ if (status >= 400 && status < 500) return "refused";
188792
+ return "request_failed";
188793
+ }
188794
+ async function runStoreApp(input, deps = {}) {
188795
+ const op = input.op;
188796
+ if (op !== "set" && op !== "show") {
188797
+ return fail6("invalid_usage", op ? `unknown store app op "${op}"` : "store app needs an op: set | show", { usage: STORE_APP_USAGE });
188798
+ }
188799
+ if (!input.app || !isValidAppId(input.app)) return fail6("invalid_usage", input.app ? `--app "${input.app}" is not a valid app id` : "--app <id> is required", { usage: STORE_APP_USAGE });
188800
+ if (!input.site || !SITE_RE2.test(input.site)) return fail6("invalid_usage", "--site <msid> (the site's metaSiteId, a UUID) is required", { usage: STORE_APP_USAGE });
188801
+ if (op === "set" && !input.androidPackage) return fail6("invalid_usage", "set needs --android-package himi.<name>", { usage: STORE_APP_USAGE });
188802
+ const problem = op === "set" ? storePackageNameProblem(input.androidPackage) : null;
188803
+ if (problem) {
188804
+ return fail6("invalid_usage", PACKAGE_PROBLEMS[problem], { usage: STORE_APP_USAGE, reason: problem });
188805
+ }
188806
+ let target;
188807
+ try {
188808
+ target = (deps.resolve ?? resolveTarget)({ target: input.target, defaultTarget: input.defaultTarget, controlUrl: input.controlUrl, controlToken: input.controlToken });
188809
+ } catch (err) {
188810
+ return fail6("invalid_usage", err.message);
188811
+ }
188812
+ const insecure = credentialHostRefusal(target.control);
188813
+ if (insecure) return fail6("insecure_target", insecure);
188814
+ if (!target.controlToken) return fail6("control_token_required", "no control token \u2014 run `himi login` (or pass --control-token)");
188815
+ let wixToken;
188816
+ try {
188817
+ wixToken = await (deps.wixToken ?? accountToken)();
188818
+ } catch {
188819
+ return fail6("wix_token_unavailable", "could not mint the account's Wix token (`wix token`) \u2014 the publishing service needs it to verify you own the site");
188820
+ }
188821
+ const fetchImpl = deps.fetchImpl ?? fetch;
188822
+ const control = target.control.replace(/\/+$/, "");
188823
+ const query = `?app=${encodeURIComponent(input.app)}&site=${encodeURIComponent(input.site)}`;
188824
+ const url = op === "set" ? `${control}/v1/admin/site/store-app` : `${control}/v1/admin/site/store-build-check${query}`;
188825
+ let status;
188826
+ let body;
188827
+ try {
188828
+ const response = await fetchImpl(url, {
188829
+ method: op === "set" ? "PUT" : "GET",
188830
+ redirect: "error",
188831
+ signal: AbortSignal.timeout(3e4),
188832
+ headers: {
188833
+ "content-type": "application/json",
188834
+ "x-control-token": target.controlToken,
188835
+ Authorization: wixToken,
188836
+ ...target.previewRoute ? { "x-wix-route-serve": target.previewRoute } : {}
188837
+ },
188838
+ ...op === "set" ? { body: JSON.stringify({ app: input.app, site: input.site, android: { packageName: input.androidPackage } }) } : {}
188839
+ });
188840
+ status = response.status;
188841
+ body = await response.json().catch(() => ({}));
188842
+ } catch {
188843
+ return fail6("control_unreachable", `could not reach the publishing service at ${control}`);
188844
+ }
188845
+ if (status < 200 || status >= 300) {
188846
+ const serverError = typeof body.code === "string" ? body.code : typeof body.error === "string" ? body.error : void 0;
188847
+ return fail6(
188848
+ codeFor(status),
188849
+ typeof body.message === "string" ? body.message : serverError ?? `HTTP ${status}`,
188850
+ { status, ...serverError ? { serverError } : {} }
188851
+ );
188852
+ }
188853
+ if (op === "set") {
188854
+ return { ok: true, ...body, next: `himi store app show --app ${input.app} --site ${input.site}` };
188855
+ }
188856
+ return {
188857
+ ok: true,
188858
+ ...body,
188859
+ next: `himi dist --app ${input.app} --platform android --shell branded-lite --aab --app-name "<name>" --app-icon-url <https url>`
188860
+ };
188861
+ }
188862
+ var PACKAGE_PROBLEMS, STORE_APP_USAGE, STORE_APP_CODES, SITE_RE2, fail6;
188863
+ var init_store_app = __esm({
188864
+ "src/store-app.ts"() {
188865
+ init_define_HHP_CATALOG();
188866
+ init_config();
188867
+ init_credential_hosts();
188868
+ init_contract();
188869
+ init_containers_builder();
188870
+ init_wix_owner();
188871
+ PACKAGE_PROBLEMS = {
188872
+ package_name_reserved: "--android-package is in a namespace reserved for Wix's own apps",
188873
+ package_name_prefix_required: `--android-package must start with "${STORE_PACKAGE_PREFIX}." (himi.<name>)`,
188874
+ invalid_package_name: `--android-package must be ${STORE_PACKAGE_PREFIX}. then dot-separated segments of a lowercase letter followed by lowercase letters, digits or _, at most 100 characters`
188875
+ };
188876
+ STORE_APP_USAGE = "himi store app set --app <id> --site <msid> --android-package himi.<name> | show --app <id> --site <msid> [--target <name>] [--control-url <url>] [--control-token <t>]";
188877
+ STORE_APP_CODES = [
188878
+ "invalid_usage",
188879
+ "insecure_target",
188880
+ "control_token_required",
188881
+ "wix_token_unavailable",
188882
+ "unauthorized",
188883
+ "forbidden",
188884
+ "refused",
188885
+ "control_unreachable",
188886
+ "request_failed"
188887
+ ];
188888
+ SITE_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
188889
+ fail6 = (code, error, extra = {}) => ({ ok: false, code, error, ...extra });
188890
+ }
188891
+ });
188892
+
188748
188893
  // src/iap-catalog-client.ts
188749
188894
  function assertCatalogRoute(prefix) {
188750
188895
  if (!/^\/(?!\/)[^\s?#]+$/.test(prefix)) throw new IapCatalogError("catalog_route_unavailable", "IAP Catalog requires an explicit gateway path");
@@ -193723,19 +193868,19 @@ async function runWixMobileRelease(pos, flags, io2, deps) {
193723
193868
  const invokedAs = pos[0];
193724
193869
  const app = invokedAs === "testflight" ? pos[1] : pos[2];
193725
193870
  const print = (value2) => io2.log(JSON.stringify(value2, null, 2));
193726
- const fail7 = (error, extra = {}) => {
193871
+ const fail8 = (error, extra = {}) => {
193727
193872
  io2.error(JSON.stringify({ error, provider: "wix-mobile-release", ...extra }));
193728
193873
  return 2;
193729
193874
  };
193730
- if (invokedAs !== "testflight" && !(invokedAs === "store" && pos[1] === "upload")) return fail7("Wix Mobile Release only supports `himi testflight <app>` or `himi store upload <app>`");
193731
- if (app !== "himi-player") return fail7("Wix Mobile Release is reserved for the Wix-owned Himi Player binary", { app });
193732
- if (str9(flags.artifact)) return fail7("--artifact is not accepted for Himi Player; pass --release so deployed serve can validate the Job Service IPA and call MRE with its service identity");
193733
- if (on2(flags["no-wait"])) return fail7("--no-wait is not supported for Himi Player TestFlight releases; wait for MRE processing to complete");
193875
+ if (invokedAs !== "testflight" && !(invokedAs === "store" && pos[1] === "upload")) return fail8("Wix Mobile Release only supports `himi testflight <app>` or `himi store upload <app>`");
193876
+ if (app !== "himi-player") return fail8("Wix Mobile Release is reserved for the Wix-owned Himi Player binary", { app });
193877
+ if (str9(flags.artifact)) return fail8("--artifact is not accepted for Himi Player; pass --release so deployed serve can validate the Job Service IPA and call MRE with its service identity");
193878
+ if (on2(flags["no-wait"])) return fail8("--no-wait is not supported for Himi Player TestFlight releases; wait for MRE processing to complete");
193734
193879
  const release2 = str9(flags.release);
193735
193880
  const version5 = str9(flags.version);
193736
- if (!release2) return fail7("--release is required for a Himi Player TestFlight release");
193737
- if (!version5 || !/^\d+(?:\.\d+){0,2}$/.test(version5)) return fail7("--version needs the Player marketing version (for example 1.0.0)");
193738
- if (str9(flags.track) && str9(flags.track) !== "testflight" && str9(flags.track) !== "internal") return fail7("Wix Mobile Release only supports TestFlight upload; public App Store release remains a separate human step");
193881
+ if (!release2) return fail8("--release is required for a Himi Player TestFlight release");
193882
+ if (!version5 || !/^\d+(?:\.\d+){0,2}$/.test(version5)) return fail8("--version needs the Player marketing version (for example 1.0.0)");
193883
+ if (str9(flags.track) && str9(flags.track) !== "testflight" && str9(flags.track) !== "internal") return fail8("Wix Mobile Release only supports TestFlight upload; public App Store release remains a separate human step");
193739
193884
  const plan = {
193740
193885
  ok: true,
193741
193886
  dryRun: on2(flags["dry-run"]),
@@ -193750,9 +193895,9 @@ async function runWixMobileRelease(pos, flags, io2, deps) {
193750
193895
  print(plan);
193751
193896
  return 0;
193752
193897
  }
193753
- if (!deps.releasePlayerJob) return fail7("this Himi CLI cannot create a service-side Himi Player TestFlight job; target deployed serve");
193898
+ if (!deps.releasePlayerJob) return fail8("this Himi CLI cannot create a service-side Himi Player TestFlight job; target deployed serve");
193754
193899
  if (!on2(flags.yes)) {
193755
- if (io2.isTTY !== true) return fail7("refusing to dispatch a Wix TestFlight release without --yes in a non-interactive shell");
193900
+ if (io2.isTTY !== true) return fail8("refusing to dispatch a Wix TestFlight release without --yes in a non-interactive shell");
193756
193901
  if (!await deps.confirm(` Dispatch Himi Player ${version5} to Wix TestFlight?`)) {
193757
193902
  io2.log(" aborted \u2014 no release was dispatched.");
193758
193903
  return 1;
@@ -193761,11 +193906,11 @@ async function runWixMobileRelease(pos, flags, io2, deps) {
193761
193906
  try {
193762
193907
  const released = await deps.releasePlayerJob(release2, version5);
193763
193908
  const status = released.status.toUpperCase();
193764
- if (mreStatusKind(status) !== "completed") return fail7(`Himi Player TestFlight job ${status || "FAILED"}`, { jobId: released.jobId, ...released.requestId ? { requestId: released.requestId } : {}, ...released.error ? { error: released.error } : {} });
193909
+ if (mreStatusKind(status) !== "completed") return fail8(`Himi Player TestFlight job ${status || "FAILED"}`, { jobId: released.jobId, ...released.requestId ? { requestId: released.requestId } : {}, ...released.error ? { error: released.error } : {} });
193765
193910
  print({ ok: true, provider: "wix-mobile-release", app, jobId: released.jobId, ...released.requestId ? { requestId: released.requestId } : {}, status, ...released.url ? { url: released.url } : {} });
193766
193911
  return 0;
193767
193912
  } catch (error) {
193768
- return fail7(`could not complete the Himi Player TestFlight Job Service release: ${error.message}`);
193913
+ return fail8(`could not complete the Himi Player TestFlight Job Service release: ${error.message}`);
193769
193914
  }
193770
193915
  }
193771
193916
  var str9, on2;
@@ -193822,23 +193967,23 @@ async function runStore(pos, flags, io2, deps) {
193822
193967
  const app = invokedAs === "testflight" ? pos[1] : pos[2];
193823
193968
  const json9 = on3(flags.json);
193824
193969
  const print = (o2) => io2.log(JSON.stringify(o2, null, 2));
193825
- const fail7 = (error, extra = {}) => {
193970
+ const fail8 = (error, extra = {}) => {
193826
193971
  io2.error(JSON.stringify({ error, ...extra }));
193827
193972
  return 2;
193828
193973
  };
193829
193974
  if (!sub || !["preflight", "upload", "status"].includes(sub)) {
193830
- return fail7(`unknown store subcommand ${sub ? `"${sub}"` : ""}`.trim(), {
193975
+ return fail8(`unknown store subcommand ${sub ? `"${sub}"` : ""}`.trim(), {
193831
193976
  usage: "himi store preflight|upload|status <app> \xB7 himi testflight <app>"
193832
193977
  });
193833
193978
  }
193834
- if (!app) return fail7(`store ${sub} needs an <app>`);
193979
+ if (!app) return fail8(`store ${sub} needs an <app>`);
193835
193980
  if (flags.provider !== void 0) {
193836
- return fail7(`unknown release provider "${String(flags.provider)}"`, {
193981
+ return fail8(`unknown release provider "${String(flags.provider)}"`, {
193837
193982
  known: ["wix-mobile-release"]
193838
193983
  });
193839
193984
  }
193840
193985
  if (!deps.hasRepoCheckout()) {
193841
- return fail7(
193986
+ return fail8(
193842
193987
  "himi store needs a Himalaya monorepo checkout \u2014 it builds and signs apps/<app>'s native target, which does not exist off-repo. Content changes (screens, Tier-5 bundles, tokens, app-config) ship over the air with `himi push` and need no binary.",
193843
193988
  { app }
193844
193989
  );
@@ -193847,7 +193992,7 @@ async function runStore(pos, flags, io2, deps) {
193847
193992
  try {
193848
193993
  cfg = deps.loadStoreConfig(app);
193849
193994
  } catch (e2) {
193850
- if (sub === "status") return fail7(e2.message);
193995
+ if (sub === "status") return fail8(e2.message);
193851
193996
  let findings2;
193852
193997
  try {
193853
193998
  findings2 = await deps.preflightApp(app, { profileFlag: str10(flags.profile) });
@@ -193855,14 +194000,14 @@ async function runStore(pos, flags, io2, deps) {
193855
194000
  findings2 = [{ level: "error", message: preflightError.message }];
193856
194001
  }
193857
194002
  if (!json9) for (const f2 of findings2) io2.log(` ${f2.level === "error" ? "\u2717" : "!"} ${f2.message}`);
193858
- return fail7(e2.message, { code: "store_config_unavailable", findings: findings2 });
194003
+ return fail8(e2.message, { code: "store_config_unavailable", findings: findings2 });
193859
194004
  }
193860
194005
  if (sub === "status") {
193861
194006
  let creds2;
193862
194007
  try {
193863
194008
  creds2 = deps.resolveCredentials({ app, cfg, profileFlag: str10(flags.profile) });
193864
194009
  } catch (e2) {
193865
- return fail7(e2.message);
194010
+ return fail8(e2.message);
193866
194011
  }
193867
194012
  try {
193868
194013
  const s2 = await deps.ascStatus(app, credsToEnv(creds2));
@@ -193875,14 +194020,14 @@ async function runStore(pos, flags, io2, deps) {
193875
194020
  }
193876
194021
  return 0;
193877
194022
  } catch (e2) {
193878
- return fail7(`could not read App Store Connect status: ${e2.message}`);
194023
+ return fail8(`could not read App Store Connect status: ${e2.message}`);
193879
194024
  }
193880
194025
  }
193881
194026
  let findings;
193882
194027
  try {
193883
194028
  findings = await deps.preflightApp(app, { profileFlag: str10(flags.profile) });
193884
194029
  } catch (e2) {
193885
- return fail7(e2.message);
194030
+ return fail8(e2.message);
193886
194031
  }
193887
194032
  const { errors, warnings } = partitionFindings(findings);
193888
194033
  if (sub === "preflight") {
@@ -193899,12 +194044,12 @@ async function runStore(pos, flags, io2, deps) {
193899
194044
  const configTrack = cfg.review?.defaultTrackIos;
193900
194045
  const track = explicitTrack ?? (invokedAs === "testflight" ? "testflight" : configTrack ?? "testflight");
193901
194046
  if (track === "appstore") {
193902
- return fail7(
194047
+ return fail8(
193903
194048
  "himi store does not submit for public App Store review \u2014 that stays a human step. Use TestFlight here, then /submit-ios-app when you mean to go public." + (explicitTrack ? "" : ` (inherited from review.defaultTrackIos; pass --track testflight to upload.)`)
193904
194049
  );
193905
194050
  }
193906
194051
  if (!TRACKS.has(track)) {
193907
- return fail7(`unknown --track "${track}"`, { known: [...TRACKS] });
194052
+ return fail8(`unknown --track "${track}"`, { known: [...TRACKS] });
193908
194053
  }
193909
194054
  const bundleId = cfg.ios?.bundleId ?? "(unset)";
193910
194055
  let creds;
@@ -193913,10 +194058,10 @@ async function runStore(pos, flags, io2, deps) {
193913
194058
  creds = deps.resolveCredentials({ app, cfg, profileFlag: str10(flags.profile) });
193914
194059
  version5 = deps.readVersion(app);
193915
194060
  } catch (e2) {
193916
- return fail7(e2.message);
194061
+ return fail8(e2.message);
193917
194062
  }
193918
194063
  if (!Number.isInteger(version5.build)) {
193919
- return fail7(
194064
+ return fail8(
193920
194065
  `${app} has a non-integer CFBundleVersion (${JSON.stringify(version5.build)}) \u2014 this command bumps and matches build numbers arithmetically. Use an integer CFBundleVersion.`,
193921
194066
  { app, marketing: version5.marketing }
193922
194067
  );
@@ -193931,7 +194076,7 @@ async function runStore(pos, flags, io2, deps) {
193931
194076
  for (const f2 of findings) io2.log(` ${f2.level === "error" ? "\u2717" : "!"} ${f2.message}`);
193932
194077
  }
193933
194078
  if (errors.length) {
193934
- return fail7(`${app} is not ready to upload \u2014 ${errors.length} blocking preflight issue(s).`, {
194079
+ return fail8(`${app} is not ready to upload \u2014 ${errors.length} blocking preflight issue(s).`, {
193935
194080
  findings: errors,
193936
194081
  hint: "himi store preflight " + app
193937
194082
  });
@@ -193962,7 +194107,7 @@ async function runStore(pos, flags, io2, deps) {
193962
194107
  }
193963
194108
  if (!on3(flags.yes)) {
193964
194109
  if (io2.isTTY !== true) {
193965
- return fail7(
194110
+ return fail8(
193966
194111
  "refusing to upload without confirmation in a non-interactive shell. Pass --yes if you really mean to publish this build, or --dry-run to see the plan.",
193967
194112
  { app, track, team: creds.team }
193968
194113
  );
@@ -193977,7 +194122,7 @@ async function runStore(pos, flags, io2, deps) {
193977
194122
  try {
193978
194123
  uploaded = reuseExisting ? version5 : deps.bumpBuild(app);
193979
194124
  } catch (e2) {
193980
- return fail7(`could not bump the build number: ${e2.message}`);
194125
+ return fail8(`could not bump the build number: ${e2.message}`);
193981
194126
  }
193982
194127
  const rollback = () => {
193983
194128
  if (reuseExisting) return;
@@ -193993,11 +194138,11 @@ async function runStore(pos, flags, io2, deps) {
193993
194138
  r3 = await deps.exec(step, env);
193994
194139
  } catch (e2) {
193995
194140
  rollback();
193996
- return fail7(`${step} failed: ${e2.message}`, { app, step, build: uploaded.build, buildNumberRestored: !reuseExisting });
194141
+ return fail8(`${step} failed: ${e2.message}`, { app, step, build: uploaded.build, buildNumberRestored: !reuseExisting });
193997
194142
  }
193998
194143
  if (r3.code !== 0) {
193999
194144
  if (step !== "upload") rollback();
194000
- return fail7(`${step} failed (exit ${r3.code})`, {
194145
+ return fail8(`${step} failed (exit ${r3.code})`, {
194001
194146
  app,
194002
194147
  step,
194003
194148
  build: uploaded.build,
@@ -194021,7 +194166,7 @@ async function runStore(pos, flags, io2, deps) {
194021
194166
  try {
194022
194167
  s2 = await deps.ascStatus(app, env);
194023
194168
  } catch (e2) {
194024
- return fail7(`uploaded build ${uploaded.build}, but could not read processing status: ${e2.message}`, {
194169
+ return fail8(`uploaded build ${uploaded.build}, but could not read processing status: ${e2.message}`, {
194025
194170
  app,
194026
194171
  build: uploaded.build,
194027
194172
  uploaded: true
@@ -194037,7 +194182,7 @@ async function runStore(pos, flags, io2, deps) {
194037
194182
  return 0;
194038
194183
  }
194039
194184
  if (mine && (mine.processingState === "FAILED" || mine.processingState === "INVALID")) {
194040
- return fail7(`build ${uploaded.build} is ${mine.processingState} in App Store Connect`, {
194185
+ return fail8(`build ${uploaded.build} is ${mine.processingState} in App Store Connect`, {
194041
194186
  app,
194042
194187
  build: uploaded.build,
194043
194188
  processingState: mine.processingState,
@@ -194045,7 +194190,7 @@ async function runStore(pos, flags, io2, deps) {
194045
194190
  });
194046
194191
  }
194047
194192
  if (waited >= deadline) {
194048
- return fail7(
194193
+ return fail8(
194049
194194
  `build ${uploaded.build} never appeared in App Store Connect after ${Math.round(deadline / 6e4)} minutes. A binary rejected during processing leaves no record and the reason is emailed, not exposed by the API \u2014 check the Apple ID inbox for team ${creds.team}.`,
194050
194195
  { app, build: uploaded.build, uploaded: true, processed: false }
194051
194196
  );
@@ -198591,7 +198736,7 @@ async function ownerPass(appId2, ports, sample) {
198591
198736
  const gaps = [];
198592
198737
  const r3 = { identity: {}, entities: [], functions: [], agents: [], connectors: [], secrets: [], routes: [], sourceFiles: [], gaps };
198593
198738
  const client2 = api(ports, appId2);
198594
- const fail7 = (chapter, e2) => {
198739
+ const fail8 = (chapter, e2) => {
198595
198740
  gaps.push({ chapter, reason: e2.message });
198596
198741
  };
198597
198742
  try {
@@ -198607,7 +198752,7 @@ async function ownerPass(appId2, ports, sample) {
198607
198752
  source: "rest"
198608
198753
  };
198609
198754
  } catch (e2) {
198610
- fail7("auth", e2);
198755
+ fail8("auth", e2);
198611
198756
  }
198612
198757
  let files = /* @__PURE__ */ new Map();
198613
198758
  if (!ports.downloadSource) {
@@ -198624,7 +198769,7 @@ async function ownerPass(appId2, ports, sample) {
198624
198769
  files = new Map(kept.map((e2) => [e2.path, e2.bytes.toString("utf8")]));
198625
198770
  r3.source = { root: "source", files: kept.length, denied: skipped.map((p2) => p2.split("\\").join("/")), secretFlagged: flagged };
198626
198771
  } catch (e2) {
198627
- fail7("source", e2);
198772
+ fail8("source", e2);
198628
198773
  } finally {
198629
198774
  dl2?.cleanup();
198630
198775
  }
@@ -198658,13 +198803,13 @@ async function ownerPass(appId2, ports, sample) {
198658
198803
  if (typeof f2.name !== "string" || r3.functions.some((x2) => x2.name === f2.name)) continue;
198659
198804
  r3.functions.push({ name: f2.name, kind: "unknown", invoke: invokeOf(f2.name), ...typeof f2.entry === "string" ? { sourcePath: f2.entry } : {}, source: "rest" });
198660
198805
  }
198661
- } else if (!r3.functions.length) fail7("functions", fnList.reason);
198806
+ } else if (!r3.functions.length) fail8("functions", fnList.reason);
198662
198807
  if (agentList.status === "fulfilled") {
198663
198808
  for (const cfg of agentList.value.items ?? []) {
198664
198809
  const a2 = agentFromConfig(cfg, "rest");
198665
198810
  if (a2 && !r3.agents.some((x2) => x2.name === a2.name)) r3.agents.push(a2);
198666
198811
  }
198667
- } else if (!r3.agents.length) fail7("agents", agentList.reason);
198812
+ } else if (!r3.agents.length) fail8("agents", agentList.reason);
198668
198813
  if (connList.status === "fulfilled") {
198669
198814
  for (const c2 of connList.value.integrations ?? []) {
198670
198815
  const type2 = typeof c2.integration_type === "string" ? c2.integration_type : void 0;
@@ -198677,9 +198822,9 @@ async function ownerPass(appId2, ports, sample) {
198677
198822
  if (!existing.scopes.length) existing.scopes = scopes;
198678
198823
  } else r3.connectors.push({ type: type2, scopes, ...status ? { status } : {}, source: "rest" });
198679
198824
  }
198680
- } else if (!r3.connectors.length) fail7("connectors", connList.reason);
198825
+ } else if (!r3.connectors.length) fail8("connectors", connList.reason);
198681
198826
  if (secretMap.status === "fulfilled") r3.secrets = Object.keys(secretMap.value ?? {}).sort();
198682
- else fail7("secrets", secretMap.reason);
198827
+ else fail8("secrets", secretMap.reason);
198683
198828
  if (sample > 0 && samples.status === "fulfilled") {
198684
198829
  const refused2 = [];
198685
198830
  samples.value.forEach((settled, i2) => {
@@ -204967,7 +205112,7 @@ async function runOneAppIdentityValidation(args, io2) {
204967
205112
  }
204968
205113
  const values = /* @__PURE__ */ new Map();
204969
205114
  let fix = false;
204970
- const fail7 = (code, error) => {
205115
+ const fail8 = (code, error) => {
204971
205116
  io2.error(JSON.stringify({ ok: false, code, error }));
204972
205117
  return 1;
204973
205118
  };
@@ -204992,7 +205137,7 @@ async function runOneAppIdentityValidation(args, io2) {
204992
205137
  try {
204993
205138
  identity = sourceIdentity(resolve88(values.get("--evidence-dir")));
204994
205139
  } catch (e2) {
204995
- return fail7("identity_source_unverified", e2 instanceof Error ? e2.message : String(e2));
205140
+ return fail8("identity_source_unverified", e2 instanceof Error ? e2.message : String(e2));
204996
205141
  }
204997
205142
  try {
204998
205143
  const content = resolve88(values.get("--content"));
@@ -205033,7 +205178,7 @@ async function runOneAppIdentityValidation(args, io2) {
205033
205178
  (result.ok ? io2.log : io2.error)(JSON.stringify(result));
205034
205179
  return result.ok ? 0 : 1;
205035
205180
  } catch (e2) {
205036
- return fail7("identity_target_unverified", e2 instanceof Error ? e2.message : String(e2));
205181
+ return fail8("identity_target_unverified", e2 instanceof Error ? e2.message : String(e2));
205037
205182
  }
205038
205183
  }
205039
205184
  var obj7, pointer2, USAGE4, DISPLAY_KEYS;
@@ -206456,23 +206601,23 @@ function runPaymentReview(args, io2) {
206456
206601
  return 0;
206457
206602
  }
206458
206603
  let evidenceDir;
206459
- const fail7 = (code, issues, exit) => {
206604
+ const fail8 = (code, issues, exit) => {
206460
206605
  io2.error(JSON.stringify({ ok: false, code, issues, usage: PAYMENT_REVIEW_USAGE }));
206461
206606
  return exit;
206462
206607
  };
206463
206608
  for (let i2 = 0; i2 < args.length; i2++) {
206464
206609
  if (args[i2] === "--json" || args[i2] === "--skip-version-check") continue;
206465
- if (args[i2] !== "--evidence-dir" || evidenceDir || !args[i2 + 1] || args[i2 + 1].startsWith("--")) return fail7("invalid_usage", ["Pass --evidence-dir once."], 2);
206610
+ if (args[i2] !== "--evidence-dir" || evidenceDir || !args[i2 + 1] || args[i2 + 1].startsWith("--")) return fail8("invalid_usage", ["Pass --evidence-dir once."], 2);
206466
206611
  evidenceDir = resolve92(args[++i2]);
206467
206612
  }
206468
- if (!evidenceDir) return fail7("invalid_usage", ["Pass --evidence-dir."], 2);
206613
+ if (!evidenceDir) return fail8("invalid_usage", ["Pass --evidence-dir."], 2);
206469
206614
  try {
206470
206615
  const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
206471
206616
  const metaSiteId = obj10(manifest2.source).metaSiteId;
206472
206617
  if (typeof metaSiteId !== "string") throw Error("Missing site binding");
206473
206618
  const review = JSON.parse(readFileSync143(join133(evidenceDir, "payment-review.json"), "utf8"));
206474
206619
  const issues = paymentReviewIssues(review, metaSiteId);
206475
- if (issues.length) return fail7("payment_decision_required", issues, 1);
206620
+ if (issues.length) return fail8("payment_decision_required", issues, 1);
206476
206621
  const warnings = obj10(review).flows.map(obj10).filter(preservesUnverifiedFlow).map((flow) => ({
206477
206622
  code: "payment_readiness_unverified",
206478
206623
  flowId: flow.id,
@@ -206481,7 +206626,7 @@ function runPaymentReview(args, io2) {
206481
206626
  io2.log(JSON.stringify({ ok: true, stage: "payment-decisions-reviewed", evidenceDir, warnings, verification: "Recorded evidence and decisions checked; merchant readiness is not independently verified by this command." }));
206482
206627
  return 0;
206483
206628
  } catch {
206484
- return fail7("payment_review_unreadable", ["Read the collected manifest and source evidence, then prepare payment-review.json for that site."], 1);
206629
+ return fail8("payment_review_unreadable", ["Read the collected manifest and source evidence, then prepare payment-review.json for that site."], 1);
206485
206630
  }
206486
206631
  }
206487
206632
  var obj10, text14, sameSite, PAYMENT_REVIEW_USAGE;
@@ -207410,7 +207555,7 @@ __export(site_member_app_exports, {
207410
207555
  memberAppVerdict: () => memberAppVerdict,
207411
207556
  runSiteMemberApp: () => runSiteMemberApp
207412
207557
  });
207413
- function codeFor(status, serverError) {
207558
+ function codeFor2(status, serverError) {
207414
207559
  if (serverError === "forbidden_site" || serverError === "forbidden_app" || serverError === "app_bound_to_other_site") return serverError;
207415
207560
  if (status === 401) return "unauthorized";
207416
207561
  return "request_failed";
@@ -207434,29 +207579,29 @@ function memberAppVerdict(appId2, release2, shell) {
207434
207579
  async function runSiteMemberApp(input, deps = {}) {
207435
207580
  const op = input.op;
207436
207581
  if (op !== "set" && op !== "clear" && op !== "show") {
207437
- return fail6("invalid_usage", op ? `unknown site member-app op "${op}"` : "site member-app needs an op: set | clear | show", { usage: SITE_MEMBER_APP_USAGE });
207582
+ return fail7("invalid_usage", op ? `unknown site member-app op "${op}"` : "site member-app needs an op: set | clear | show", { usage: SITE_MEMBER_APP_USAGE });
207438
207583
  }
207439
207584
  const site = input.site;
207440
- if (!site || !SITE_RE2.test(site)) return fail6("invalid_usage", "a metaSiteId (UUID) is required", { usage: SITE_MEMBER_APP_USAGE });
207441
- if (op === "set" && !input.app) return fail6("invalid_usage", "set needs --app <id>", { usage: SITE_MEMBER_APP_USAGE });
207442
- if (op === "set" && !isValidAppId(input.app)) return fail6("invalid_usage", `--app "${input.app}" is not a valid app id`, { usage: SITE_MEMBER_APP_USAGE });
207585
+ if (!site || !SITE_RE3.test(site)) return fail7("invalid_usage", "a metaSiteId (UUID) is required", { usage: SITE_MEMBER_APP_USAGE });
207586
+ if (op === "set" && !input.app) return fail7("invalid_usage", "set needs --app <id>", { usage: SITE_MEMBER_APP_USAGE });
207587
+ if (op === "set" && !isValidAppId(input.app)) return fail7("invalid_usage", `--app "${input.app}" is not a valid app id`, { usage: SITE_MEMBER_APP_USAGE });
207443
207588
  if (input.shell !== void 0 && input.shell !== "ios" && input.shell !== "android") {
207444
- return fail6("invalid_usage", `--platform must be ios or android (got "${input.shell}")`, { usage: SITE_MEMBER_APP_USAGE });
207589
+ return fail7("invalid_usage", `--platform must be ios or android (got "${input.shell}")`, { usage: SITE_MEMBER_APP_USAGE });
207445
207590
  }
207446
207591
  let target;
207447
207592
  try {
207448
207593
  target = (deps.resolve ?? resolveTarget)({ target: input.target, defaultTarget: input.defaultTarget, controlUrl: input.controlUrl, controlToken: input.controlToken });
207449
207594
  } catch (err) {
207450
- return fail6("invalid_usage", err.message);
207595
+ return fail7("invalid_usage", err.message);
207451
207596
  }
207452
207597
  const insecure = credentialHostRefusal(target.control);
207453
- if (insecure) return fail6("insecure_target", insecure);
207454
- if (!target.controlToken) return fail6("control_token_required", "no control token \u2014 run `himi login` (or pass --control-token)");
207598
+ if (insecure) return fail7("insecure_target", insecure);
207599
+ if (!target.controlToken) return fail7("control_token_required", "no control token \u2014 run `himi login` (or pass --control-token)");
207455
207600
  let wixToken;
207456
207601
  try {
207457
207602
  wixToken = await (deps.wixToken ?? accountToken)();
207458
207603
  } catch {
207459
- return fail6("wix_token_unavailable", "could not mint the account's Wix token (`wix token`) \u2014 the publishing service needs it to verify you own the site");
207604
+ return fail7("wix_token_unavailable", "could not mint the account's Wix token (`wix token`) \u2014 the publishing service needs it to verify you own the site");
207460
207605
  }
207461
207606
  const fetchImpl = deps.fetchImpl ?? fetch;
207462
207607
  const control = target.control.replace(/\/+$/, "");
@@ -207479,11 +207624,11 @@ async function runSiteMemberApp(input, deps = {}) {
207479
207624
  status = response.status;
207480
207625
  body = await response.json().catch(() => ({}));
207481
207626
  } catch {
207482
- return fail6("control_unreachable", `could not reach the publishing service at ${control}`);
207627
+ return fail7("control_unreachable", `could not reach the publishing service at ${control}`);
207483
207628
  }
207484
207629
  if (status < 200 || status >= 300) {
207485
- return fail6(
207486
- codeFor(status, body.error),
207630
+ return fail7(
207631
+ codeFor2(status, body.error),
207487
207632
  typeof body.error === "string" ? body.error : `HTTP ${status}`,
207488
207633
  { status, ...typeof body.error === "string" ? { serverError: body.error } : {} }
207489
207634
  );
@@ -207508,7 +207653,7 @@ async function runSiteMemberApp(input, deps = {}) {
207508
207653
  const verdict = body.invalid ? { opens: SPACES_DEFAULT_APP, compatible: false, reason: `The pick is no longer valid (${String(body.invalid)}): the site resolves to Branded Lite` } : memberAppVerdict(appId2, release2, input.shell);
207509
207654
  return { ok: true, ...body, ...verdict, host: { name: "Spaces", version: SPACES_HOST_MANIFEST.version, ...input.shell ? { shell: input.shell } : {} } };
207510
207655
  }
207511
- var SPACES_DEFAULT_APP, SITE_MEMBER_APP_USAGE, SITE_MEMBER_APP_CODES, SITE_RE2, fail6;
207656
+ var SPACES_DEFAULT_APP, SITE_MEMBER_APP_USAGE, SITE_MEMBER_APP_CODES, SITE_RE3, fail7;
207512
207657
  var init_site_member_app = __esm({
207513
207658
  "src/site-member-app.ts"() {
207514
207659
  init_define_HHP_CATALOG();
@@ -207532,8 +207677,8 @@ var init_site_member_app = __esm({
207532
207677
  "control_unreachable",
207533
207678
  "request_failed"
207534
207679
  ];
207535
- SITE_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
207536
- fail6 = (code, error, extra = {}) => ({ ok: false, code, error, ...extra });
207680
+ SITE_RE3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
207681
+ fail7 = (code, error, extra = {}) => ({ ok: false, code, error, ...extra });
207537
207682
  }
207538
207683
  });
207539
207684
 
@@ -212183,12 +212328,12 @@ function runId(now = /* @__PURE__ */ new Date()) {
212183
212328
  return now.toISOString().replace(/[-:]/g, "").replace(/\..*/, "").replace("T", "-");
212184
212329
  }
212185
212330
  function rowStatus(row2, thresholds) {
212186
- const fail7 = [], warn3 = [];
212331
+ const fail8 = [], warn3 = [];
212187
212332
  if (row2.error) warn3.push(`${row2.error.code}: ${row2.error.message}`);
212188
212333
  const parityExpected = row2.frames.some((f2) => (f2.surface === "ios" || f2.surface === "android") && f2.file);
212189
212334
  const questions = [["design (web vs mockup)", row2.judge.design], ...parityExpected ? [["parity (native vs web)", row2.judge.parity]] : []];
212190
212335
  for (const [question, v2] of questions) {
212191
- if (v2 === "mismatch") fail7.push(`judge: ${question} mismatch`);
212336
+ if (v2 === "mismatch") fail8.push(`judge: ${question} mismatch`);
212192
212337
  else if (v2 === "partial") warn3.push(`judge: ${question} partial`);
212193
212338
  }
212194
212339
  if (row2.judge.design === "cannot_tell" || row2.judge.parity === "cannot_tell" && parityExpected) {
@@ -212198,9 +212343,9 @@ function rowStatus(row2, thresholds) {
212198
212343
  if (row2.frames.some((f2) => f2.noReference)) warn3.push("no_reference: the mockup does not style this variant");
212199
212344
  const design = row2.scores.find((s2) => s2.a === "mockup" && s2.b === "web");
212200
212345
  if (!thresholds || !design) {
212201
- } else if (design.global < thresholds.fail) fail7.push(`score: mockup\u2194web ${design.global} < fail ${thresholds.fail}`);
212346
+ } else if (design.global < thresholds.fail) fail8.push(`score: mockup\u2194web ${design.global} < fail ${thresholds.fail}`);
212202
212347
  else if (design.global < thresholds.warn) warn3.push(`score: mockup\u2194web ${design.global} < warn ${thresholds.warn}`);
212203
- return fail7.length ? { status: "fail", reasons: [...fail7, ...warn3] } : warn3.length ? { status: "warn", reasons: warn3 } : { status: "pass", reasons: [] };
212348
+ return fail8.length ? { status: "fail", reasons: [...fail8, ...warn3] } : warn3.length ? { status: "warn", reasons: warn3 } : { status: "pass", reasons: [] };
212204
212349
  }
212205
212350
  async function runFidelity(root, opts = {}) {
212206
212351
  const manifest2 = readHhpManifest(root);
@@ -212847,31 +212992,31 @@ __export(publish_size_exports2, {
212847
212992
  });
212848
212993
  async function publishSizeCommand(ctx) {
212849
212994
  const { flags, pos, print } = ctx;
212850
- const fail7 = (code, error, extra = {}, exit = 1) => {
212995
+ const fail8 = (code, error, extra = {}, exit = 1) => {
212851
212996
  print({ ok: false, code, error, pushed: false, claimed: false, ...extra });
212852
212997
  return exit;
212853
212998
  };
212854
212999
  const allowed2 = /* @__PURE__ */ new Set(["content", "app", "reserve-bytes", "source", "binary", "json", "skip-version-check"]);
212855
213000
  if (pos.length !== 1 || Object.keys(flags).some((key3) => !allowed2.has(key3))) {
212856
- return fail7("invalid_usage", "publish-size accepts --content, --app, --reserve-bytes and --binary/--source; it never publishes", {}, 2);
213001
+ return fail8("invalid_usage", "publish-size accepts --content, --app, --reserve-bytes and --binary/--source; it never publishes", {}, 2);
212857
213002
  }
212858
213003
  for (const key3 of allowed2) {
212859
213004
  if (ctx.argv.filter((arg) => arg === `--${key3}` || arg.startsWith(`--${key3}=`)).length > 1) {
212860
- return fail7("invalid_usage", `--${key3} may be supplied only once`, {}, 2);
213005
+ return fail8("invalid_usage", `--${key3} may be supplied only once`, {}, 2);
212861
213006
  }
212862
213007
  }
212863
213008
  for (const key3 of ["content", "app", "reserve-bytes"]) {
212864
- if (flags[key3] !== void 0 && typeof flags[key3] !== "string") return fail7("invalid_usage", `--${key3} needs one value`, {}, 2);
213009
+ if (flags[key3] !== void 0 && typeof flags[key3] !== "string") return fail8("invalid_usage", `--${key3} needs one value`, {}, 2);
212865
213010
  }
212866
213011
  for (const key3 of ["source", "binary", "json", "skip-version-check"]) {
212867
- if (flags[key3] !== void 0 && typeof flags[key3] !== "boolean") return fail7("invalid_usage", `--${key3} must be one switch`, {}, 2);
213012
+ if (flags[key3] !== void 0 && typeof flags[key3] !== "boolean") return fail8("invalid_usage", `--${key3} must be one switch`, {}, 2);
212868
213013
  }
212869
- if (typeof flags.content === "string" && !flags.content.trim()) return fail7("invalid_usage", "--content needs a directory", {}, 2);
213014
+ if (typeof flags.content === "string" && !flags.content.trim()) return fail8("invalid_usage", "--content needs a directory", {}, 2);
212870
213015
  const reserveText = flags["reserve-bytes"];
212871
213016
  const reserveBytes = reserveText === void 0 ? DEFAULT_RESERVE_BYTES : /^\d+$/.test(String(reserveText)) ? Number(reserveText) : NaN;
212872
- if (!Number.isSafeInteger(reserveBytes) || reserveBytes < 0) return fail7("invalid_usage", "--reserve-bytes must be a nonnegative integer", {}, 2);
212873
- if (typeof flags.app === "string" && !isValidAppId(flags.app)) return fail7("invalid_usage", "--app must be a valid publish ID: 1-63 lowercase letters, digits or hyphens, with at most one interior dot", {}, 2);
212874
- if (flags.binary === true && flags.source === true) return fail7("invalid_usage", "choose only one of --binary and --source", {}, 2);
213017
+ if (!Number.isSafeInteger(reserveBytes) || reserveBytes < 0) return fail8("invalid_usage", "--reserve-bytes must be a nonnegative integer", {}, 2);
213018
+ if (typeof flags.app === "string" && !isValidAppId(flags.app)) return fail8("invalid_usage", "--app must be a valid publish ID: 1-63 lowercase letters, digits or hyphens, with at most one interior dot", {}, 2);
213019
+ if (flags.binary === true && flags.source === true) return fail8("invalid_usage", "choose only one of --binary and --source", {}, 2);
212875
213020
  if (process.env.HIMI_PUBLISH_SIZE_WORKER !== "1") {
212876
213021
  const { execFile: execFile3 } = await import("node:child_process");
212877
213022
  const entry = import.meta.url.endsWith("/commands/publish-size.ts") ? new URL("../cli.ts", import.meta.url) : new URL(import.meta.url);
@@ -212900,7 +213045,7 @@ async function publishSizeCommand(ctx) {
212900
213045
  print(JSON.parse(result.stdout));
212901
213046
  return result.code;
212902
213047
  } catch {
212903
- return fail7("build_failed", "isolated size build did not return a measurement", { detail: result.stderr.slice(-2e3) });
213048
+ return fail8("build_failed", "isolated size build did not return a measurement", { detail: result.stderr.slice(-2e3) });
212904
213049
  }
212905
213050
  }
212906
213051
  try {
@@ -212908,24 +213053,24 @@ async function publishSizeCommand(ctx) {
212908
213053
  const { collectAppSource: collectAppSource2, secretFindings: secretFindings2, zipAppSource: zipAppSource2, MAX_APP_SOURCE_BYTES: MAX_APP_SOURCE_BYTES2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
212909
213054
  const { composeReleasePayload: composeReleasePayload2, loadReleaseFromDir: loadReleaseFromDir2 } = await Promise.resolve().then(() => (init_release(), release_exports));
212910
213055
  const { publishReleaseBodyBytes: publishReleaseBodyBytes2, MAX_PUBLISH_BODY_BYTES: MAX_PUBLISH_BODY_BYTES2 } = await Promise.resolve().then(() => (init_client(), client_exports));
212911
- if (reserveBytes > MAX_PUBLISH_BODY_BYTES2) return fail7("invalid_usage", "--reserve-bytes exceeds the entire publish budget", {}, 2);
213056
+ if (reserveBytes > MAX_PUBLISH_BODY_BYTES2) return fail8("invalid_usage", "--reserve-bytes exceeds the entire publish budget", {}, 2);
212912
213057
  const { installContainedDevModuleRealm: installContainedDevModuleRealm2 } = await Promise.resolve().then(() => (init_contained_dev_module(), contained_dev_module_exports));
212913
213058
  const { installContainedAppConfigRealm: installContainedAppConfigRealm2 } = await Promise.resolve().then(() => (init_app_config_loader(), app_config_loader_exports));
212914
213059
  if (!await installContainedDevModuleRealm2() || !await installContainedAppConfigRealm2()) {
212915
- return fail7("build_failed", "publish-size requires the contained authoring runtime; host-realm overrides are unavailable");
213060
+ return fail8("build_failed", "publish-size requires the contained authoring runtime; host-realm overrides are unavailable");
212916
213061
  }
212917
213062
  const dir = contentDir2(flags);
212918
213063
  const { existsSync: existsSync131 } = await import("node:fs");
212919
213064
  const { join: join144 } = await import("node:path");
212920
- if (!existsSync131(join144(dir, "dev", "index.ts"))) return fail7("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
213065
+ if (!existsSync131(join144(dir, "dev", "index.ts"))) return fail8("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
212921
213066
  const declared = await appId2(dir);
212922
213067
  const app = typeof flags.app === "string" ? flags.app : declared;
212923
- if (!isValidAppId(app)) return fail7("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app }, 2);
213068
+ if (!isValidAppId(app)) return fail8("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app }, 2);
212924
213069
  const secrets = secretFindings2(collectAppSource2(dir).entries);
212925
- if (secrets.length) return fail7("app_source_contains_secrets", "source archive contains a possible credential", { files: secrets.map((s2) => s2.path) });
213070
+ if (secrets.length) return fail8("app_source_contains_secrets", "source archive contains a possible credential", { files: secrets.map((s2) => s2.path) });
212926
213071
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring2();
212927
213072
  const build3 = await buildContentBundles2(dir, { resolution: resolutionFlag2(flags) });
212928
- if (build3.compileErrors.length) return fail7("build_failed", "worker compilation failed", { compileErrors: build3.compileErrors });
213073
+ if (build3.compileErrors.length) return fail8("build_failed", "worker compilation failed", { compileErrors: build3.compileErrors });
212929
213074
  const out2 = commandScratchDir2("himi-publish-size-");
212930
213075
  const release2 = await buildReleaseFromContent2(dir, out2, {
212931
213076
  ...build3.built.length ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -212937,11 +213082,11 @@ async function publishSizeCommand(ctx) {
212937
213082
  const { readContentManifest: readContentManifest2 } = await Promise.resolve().then(() => (init_content_manifest(), content_manifest_exports));
212938
213083
  const declaredIcon = readContentManifest2(dir)?.icon;
212939
213084
  if (typeof declaredIcon === "string" && declaredIcon.trim() && !release2.manifest.iconHash) {
212940
- return fail7("build_failed", "declared launcher icon could not be included; restore its readable file before measuring", { icon: declaredIcon });
213085
+ return fail8("build_failed", "declared launcher icon could not be included; restore its readable file before measuring", { icon: declaredIcon });
212941
213086
  }
212942
213087
  const tokensFailure = release2.tokensSnapshotFailure?.status === 404 ? void 0 : release2.tokensSnapshotFailure;
212943
213088
  if (release2.failedToBuild.length || release2.missingBundles.length || release2.fontWarnings?.length || release2.widgetBakeFailures?.length || tokensFailure) {
212944
- return fail7("build_failed", "release is incomplete; fix the reported screen, bundle, font, widget or token failures before measuring", {
213089
+ return fail8("build_failed", "release is incomplete; fix the reported screen, bundle, font, widget or token failures before measuring", {
212945
213090
  failedToBuild: release2.failedToBuild,
212946
213091
  missingBundles: release2.missingBundles,
212947
213092
  ...release2.fontWarnings?.length ? { fontWarnings: release2.fontWarnings } : {},
@@ -212951,7 +213096,7 @@ async function publishSizeCommand(ctx) {
212951
213096
  }
212952
213097
  const collected = collectAppSource2(dir);
212953
213098
  const afterSecrets = secretFindings2(collected.entries);
212954
- if (afterSecrets.length) return fail7("app_source_contains_secrets", "built source contains a possible credential", { files: afterSecrets.map((s2) => s2.path) });
213099
+ if (afterSecrets.length) return fail8("app_source_contains_secrets", "built source contains a possible credential", { files: afterSecrets.map((s2) => s2.path) });
212955
213100
  const archive = zipAppSource2(collected.entries);
212956
213101
  const encoded3 = archive.toString("base64");
212957
213102
  const payload = await loadReleaseFromDir2(declared, out2);
@@ -212982,12 +213127,12 @@ async function publishSizeCommand(ctx) {
212982
213127
  readiness: "Not validated for publication: lint, source coverage, headless and native UX evidence gates were not run.",
212983
213128
  buildMode: "Contained local build: explicit config and static seed IDs only. Host environment substitutions and live catalog enumeration are not final-envelope evidence."
212984
213129
  };
212985
- if (encoded3.length > MAX_APP_SOURCE_BYTES2) return fail7("app_source_too_large", "encoded source archive exceeds its limit", report7);
212986
- if (planningBytes > MAX_PUBLISH_BODY_BYTES2) return fail7("publish_body_too_large", "measured draft plus planning reserve exceeds the publish budget", report7);
213130
+ if (encoded3.length > MAX_APP_SOURCE_BYTES2) return fail8("app_source_too_large", "encoded source archive exceeds its limit", report7);
213131
+ if (planningBytes > MAX_PUBLISH_BODY_BYTES2) return fail8("publish_body_too_large", "measured draft plus planning reserve exceeds the publish budget", report7);
212987
213132
  print({ ok: true, ...report7 });
212988
213133
  return 0;
212989
213134
  } catch (error) {
212990
- return fail7("build_failed", error instanceof Error ? error.message : String(error));
213135
+ return fail8("build_failed", error instanceof Error ? error.message : String(error));
212991
213136
  }
212992
213137
  }
212993
213138
  var DEFAULT_RESERVE_BYTES;
@@ -213748,6 +213893,16 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
213748
213893
  team (guideline 4.2.6), declared per-app as
213749
213894
  ios.credentialProfile in store.config.yaml and resolved
213750
213895
  from ~/.himalaya/store-credentials/<name>.json.
213896
+ himi store app set --app <id> --site <msid> --android-package himi.<name>
213897
+ give an app YOUR account owns the Google Play store app of
213898
+ a Wix site your account owns: LINKS the app to the site (it
213899
+ stays your account's app; himi login keeps working) and
213900
+ saves the package name, so himi dist --aab makes its
213901
+ WixOne-signed store build. Sends your control token plus
213902
+ the account wix token, which proves you own both.
213903
+ himi store app show --app <id> --site <msid>
213904
+ the store build's checks without building: saved package
213905
+ name, the site's store app, the plan (premium_plan_required).
213751
213906
  himi store iap draft --site <msid> ${IAP_CREDENTIAL_OPTIONS} --apple-app <id> --bundle <id> --base-territory <ISO3>
213752
213907
  --out <manifest.json> [--territories <a,b>] [--locale <l>] [--mode per-item|tiers]
213753
213908
  [--merge <manifest.json>] [--report <file>] [--json]
@@ -214082,7 +214237,7 @@ var COMMANDS = [
214082
214237
  { name: "visibility", summary: "read (no value) or set whether the public registry (/v1/apps + the Himi Player picker) LISTS the app. `public` lists it for everyone; `unlisted` hides it from listings while direct reads by app id \u2014 deep links, previews \u2014 keep working. App from --app or the content dir. Setting it needs no republish.", required: "[public|unlisted] [--app <a>] [--content <dir>] (--control-token)" },
214083
214238
  { name: "dist", summary: "build an INSTALLABLE QA binary (signed IPA / APK) on the Wix Job Service Mac pool and return an install link \u2014 the serve plane brokers the job, the pool builds it. WAITS for the build by default (~4 min) and prints the install link; `--no-wait` returns a jobId immediately instead. Omitting `--release` builds whatever is LIVE for the app. A named draft is refused unless `--allow-draft` makes that exceptional build explicit. `status <jobId>` / `watch <jobId>` / `list --app <a>` / `cancel <jobId>` inspect and stop builds (`watch` reports up front whether the job mints its own signing identity or borrows one, so a doomed iOS build is cancellable in seconds rather than after the archive). Off-repo, name a target \u2014 `--target wix` for a self-serve Wix login or `--target bo` for the internal employee path (the in-repo default is a local dev plane that isn't reachable off-repo); self-serve callers may build their OWN apps under a tighter budget (2 in flight / 5 per 24h), while a manage-only owner-role credential is refused. `--shell` picks the native host to sign into (branded-lite | owner-lite | brandy | base44 | player | demo-app) and defaults to the content package's himalaya.content.json `shell` (templates carry the one they were written for), else branded-lite. The per-app shells ADD the release's declared capabilities to the binary, while Himi Player and demo-app refuse a release declaring one they lack; `--plan` previews it without building; `brandy` is the site shell \u2014 the customer's own website as native-framed tabs. `--signing` defaults to `wix-managed` \u2014 the Wix Apple account mints a per-app signing identity for the build, so the caller provisions no Apple credentials of their own; `--signing byo --site <id>` reuses an existing customer ad-hoc profile and certificate for iOS; requires an owned site and a completed personal signing binding. `--android-signing` is the Android counterpart and a SEPARATE axis (a keystore, not an Apple account): `qa-keystore` (default \u2014 the repo's committed QA key, identical on every pool machine, so a build installs over the previous one), `wix-keystore` (the Wix key the pool machine carries; the build FAILS naming the paths searched if it carries none, rather than quietly signing with something else), or `debug` (the old per-machine key \u2014 QA must uninstall any previous build first). `--aab` builds an Android App Bundle (.aab) for the owner to upload to Google Play AND an APK from the same build \u2014 a download link for the .aab, an install link and QR for the APK; Android only; the bundle is signed with the Wix production key (`wix-keystore`, the upload key Branded apps use) \u2014 any other `--android-signing` is refused \u2014 and the APK with the committed QA key; a self-serve caller gets one only as the store build of its own Containers app (it must own the app's site, and `--aab` sends your Wix login); any other self-serve `--aab` gets 403 android_format_not_allowed. `--app-name <name> --app-icon-url <url>` (together; the icon a `https://static.wixstatic.com/media/<file>` URL) give the binary a name and icon in place of the release's, and a Containers app's store build (`--aab`, or its TestFlight build) needs both. NOT the normal way to ship: screens, Tier-5 bundles, tokens and app-config all go over the air with `himi push` in seconds \u2014 a binary trip is only needed for a NATIVE delta (a new SDUI component, a new declared capability/entitlement, a new bundle id, or a minBinaryVersion floor bump). Refuses to build an app whose launcher icon is missing, a placeholder, or one a store would reject \u2014 the one thing a binary carries that no later OTA push can fix; `--force` builds anyway. Also refuses a release whose member login (WixConsumerAuthProvider) names no siteId, or not in lower case, when Wix says its site requires a member CAPTCHA \u2014 such a binary ships without the CAPTCHA key and every member sign-in fails; whatever it cannot read (the release, the site's setting) only warns and builds; `--skip-captcha-check` builds anyway", required: "[--app <a>] [--platform ios,android] [--release <id>] [--allow-draft] [--target <t>] [--shell branded-lite|owner-lite|brandy|base44|player|demo-app] [--signing wix-managed|byo] [--site <id>] [--android-signing qa-keystore|wix-keystore|debug] [--aab] [--app-name <name> --app-icon-url <url>] [--borrow-ios-id <bundleId>] [--no-wait] [--force] [--skip-captcha-check] [--plan] | status <jobId> [--target <t>] | watch <jobId> [--target <t>] [--interval <ms>] | list --app <a> [--target <t>] | cancel <jobId> [--target <t>]" },
214084
214239
  { name: "testflight", summary: 'build, sign and upload an app to TestFlight (internal testers \u2014 no Beta App Review), then WAIT until App Store Connect finishes processing it. Sugar for `store upload --track testflight`. Prompts first: a build number is consumed permanently on a real Apple account and cannot be reused \u2014 `--yes` for CI, `--dry-run` to see the plan without touching anything. The wait is the real check, not a nicety: fastlane prints "Successfully uploaded" for a binary App Store Connect then rejects in processing, and a rejected binary leaves NO build record at all (the reason is emailed). Public App Store review is deliberately NOT automatable here \u2014 `--track appstore` is refused; use /submit-ios-app when you mean to go public', required: "<app> [--track testflight|internal] [--profile <name>] [--yes] [--dry-run] [--skip-build] [--no-wait] [--json]" },
214085
- { name: "store", summary: "`apple-keys setup|status` onboards the owner\u2019s ASC and In-App Purchase keys independently of push and signing profiles. The App Store Connect group behind `testflight`. `preflight <app>` checks readiness offline (icon, entitlements, encryption flag, version, store.config ids, listing + review record); `upload <app>` is what `testflight` runs; `status <app>` reads live build + processing state. `--profile` selects WHICH App Store Connect account: an app built for a Wix customer ships under the CUSTOMER's Apple team (Apple guideline 4.2.6 forbids an app-generation service submitting on a client's behalf), declared per-app as ios.credentialProfile in store.config.yaml and resolved from ~/.himalaya/store-credentials/<name>.json \u2014 the .p8 itself never enters the repo. `iap draft|plan|apply|status|connect|screenshots|check|mappings` registers an app owner's digital products as in-app purchases (non-consumables, or consumable price tiers): draft reads the Wix catalog and writes the manifest, plan and status only read, apply is the one App Store mutation boundary, connect readies the Wix site to sell them (purchases app, In-App Purchase key, appleIAP provider, product mappings; --preview-tag routes only its Serve calls to a deploy preview), legacy screenshots --profile renders each product's purchase screen from the app (--content) as a bound iPhone shows it to a signed-in member and names the 1290\xD72796 PNG as the item's App Review screenshot, and none of them builds, signs or needs a checkout (`himi docs iap-products`) IAP provisioning defaults to Catalog; managed apply generates screenshots on the server with no local .p8 or profile fallback; --managed is optional and --profile selects legacy mode; --catalog-route or HIMI_IAP_CATALOG_ROUTE has no default.", required: "apple-keys setup|status --app <slug> --site <metaSiteId> --bundle-id <id> [--asc-key-file <p8> --asc-key-id <id> --asc-issuer-id <issuer>] [--iap-key <p8> --iap-key-id <id> --iap-issuer-id <issuer>] [--yes|--dry-run] [--json] | preflight <app> [--profile <n>] | upload <app> [--track <t>] [--profile <n>] [--yes] [--dry-run] | status <app> [--profile <n>] | iap draft --site <msid> " + IAP_CREDENTIAL_OPTIONS + " --apple-app <id> --bundle <id> --base-territory <t> --out <f> [--territories <a,b>] [--locale <l>] [--mode per-item|tiers] [--merge <f>] [--report <f>] [--json] | iap plan --manifest <f> " + IAP_CREDENTIAL_OPTIONS + " --out <f> [--json] | iap apply --plan <f> " + IAP_CREDENTIAL_OPTIONS + " --out <f> [--yes] [--limit <n>] [--no-submit] [--json] | iap status --manifest <f> " + IAP_CREDENTIAL_OPTIONS + " [--out <f>] [--json] | iap connect --manifest <f> [--profile <n>] [--catalog-route <prefix>] [--iap-key <AuthKey.p8> --iap-key-id <id>] [--content <dir>] [--preview-tag dp-<tag>] [--dry-run] [--yes] [--out <f>] [--json] | iap screenshots --manifest <f> --content <dir> --profile <n> [--out-dir <d>] [--only <id,\u2026>] [--force] [--dry-run] [--json] | iap check --manifest <f> --catalog-route <prefix> [--purchases-app <id>] [--content <dir>] [--plist <file>] [--visitor-client <id>] [--json] | iap mappings --site <msid> --purchases-app <id> --catalog-route <prefix> [--product <id> --active true|false --yes] [--json]" },
214240
+ { name: "store", summary: "`app set --app <id> --site <msid> --android-package himi.<name>` gives an app YOUR account owns (one made with `himi init`) the Google Play store app of a Wix site your account also owns, so `himi dist --aab` makes its Wix-signed (WixOne) Play bundle: the app is LINKED to the site, never converted into a site app, so your `himi login` token keeps working for push and the rest. One site per app and one app per site; the package name is permanent once a build locks it. `app show --app <id> --site <msid>` runs the store build's checks without building (saved package name, the site's Premium plan). Both send your `himi login` control token plus the account `wix token`, which the plane uses to verify your account owns the app and the site (`himi docs qa-builds`). `apple-keys setup|status` onboards the owner\u2019s ASC and In-App Purchase keys independently of push and signing profiles. The App Store Connect group behind `testflight`. `preflight <app>` checks readiness offline (icon, entitlements, encryption flag, version, store.config ids, listing + review record); `upload <app>` is what `testflight` runs; `status <app>` reads live build + processing state. `--profile` selects WHICH App Store Connect account: an app built for a Wix customer ships under the CUSTOMER's Apple team (Apple guideline 4.2.6 forbids an app-generation service submitting on a client's behalf), declared per-app as ios.credentialProfile in store.config.yaml and resolved from ~/.himalaya/store-credentials/<name>.json \u2014 the .p8 itself never enters the repo. `iap draft|plan|apply|status|connect|screenshots|check|mappings` registers an app owner's digital products as in-app purchases (non-consumables, or consumable price tiers): draft reads the Wix catalog and writes the manifest, plan and status only read, apply is the one App Store mutation boundary, connect readies the Wix site to sell them (purchases app, In-App Purchase key, appleIAP provider, product mappings; --preview-tag routes only its Serve calls to a deploy preview), legacy screenshots --profile renders each product's purchase screen from the app (--content) as a bound iPhone shows it to a signed-in member and names the 1290\xD72796 PNG as the item's App Review screenshot, and none of them builds, signs or needs a checkout (`himi docs iap-products`) IAP provisioning defaults to Catalog; managed apply generates screenshots on the server with no local .p8 or profile fallback; --managed is optional and --profile selects legacy mode; --catalog-route or HIMI_IAP_CATALOG_ROUTE has no default.", required: "app set --app <id> --site <msid> --android-package himi.<name> | app show --app <id> --site <msid> | apple-keys setup|status --app <slug> --site <metaSiteId> --bundle-id <id> [--asc-key-file <p8> --asc-key-id <id> --asc-issuer-id <issuer>] [--iap-key <p8> --iap-key-id <id> --iap-issuer-id <issuer>] [--yes|--dry-run] [--json] | preflight <app> [--profile <n>] | upload <app> [--track <t>] [--profile <n>] [--yes] [--dry-run] | status <app> [--profile <n>] | iap draft --site <msid> " + IAP_CREDENTIAL_OPTIONS + " --apple-app <id> --bundle <id> --base-territory <t> --out <f> [--territories <a,b>] [--locale <l>] [--mode per-item|tiers] [--merge <f>] [--report <f>] [--json] | iap plan --manifest <f> " + IAP_CREDENTIAL_OPTIONS + " --out <f> [--json] | iap apply --plan <f> " + IAP_CREDENTIAL_OPTIONS + " --out <f> [--yes] [--limit <n>] [--no-submit] [--json] | iap status --manifest <f> " + IAP_CREDENTIAL_OPTIONS + " [--out <f>] [--json] | iap connect --manifest <f> [--profile <n>] [--catalog-route <prefix>] [--iap-key <AuthKey.p8> --iap-key-id <id>] [--content <dir>] [--preview-tag dp-<tag>] [--dry-run] [--yes] [--out <f>] [--json] | iap screenshots --manifest <f> --content <dir> --profile <n> [--out-dir <d>] [--only <id,\u2026>] [--force] [--dry-run] [--json] | iap check --manifest <f> --catalog-route <prefix> [--purchases-app <id>] [--content <dir>] [--plist <file>] [--visitor-client <id>] [--json] | iap mappings --site <msid> --purchases-app <id> --catalog-route <prefix> [--product <id> --active true|false --yes] [--json]" },
214086
214241
  { name: "guide", summary: "print the Himalaya overview + headless dev loop + available topics (offline)", required: "[--json]" },
214087
214242
  { name: "docs", summary: "print bundled/verified cached guides offline; status reports kit identity; refresh downloads compatible reference content independently of CLI without changing app source", required: "[<topic>|catalog [kind]|status|refresh] [--pin <version|digest>] [--unpin] [--no-network] [--json]" },
214088
214243
  { name: "components", summary: "print the SDUI component vocabulary + props; a name = that component (offline)", required: "[<Name>] [--json]" },
@@ -219373,6 +219528,23 @@ async function testflightCommand(ctx) {
219373
219528
  const { runAppleKeys: runAppleKeys2 } = await Promise.resolve().then(() => (init_apple_keys(), apple_keys_exports));
219374
219529
  return runAppleKeys2(pos, flags, io2);
219375
219530
  }
219531
+ if (command === "store" && pos[1] === "app") {
219532
+ const { runStoreApp: runStoreApp2 } = await Promise.resolve().then(() => (init_store_app(), store_app_exports));
219533
+ const r3 = await runStoreApp2({
219534
+ op: pos[2],
219535
+ app: str3(flags.app),
219536
+ site: str3(flags.site),
219537
+ androidPackage: str3(flags["android-package"]),
219538
+ target: str3(flags.target),
219539
+ // Off-repo, `himi login` stores its token under `wix`; resolve where it did.
219540
+ defaultTarget: ctx.contextualDefaultTarget,
219541
+ controlUrl: str3(flags["control-url"]),
219542
+ controlToken: str3(flags["control-token"])
219543
+ });
219544
+ if (r3.ok) ctx.print(r3);
219545
+ else io2.error(JSON.stringify(r3));
219546
+ return r3.ok ? 0 : r3.code === "invalid_usage" ? 2 : 1;
219547
+ }
219376
219548
  if (command === "store" && pos[1] === "iap") {
219377
219549
  const { runStoreIap: runStoreIap2, defaultStoreIapDeps: defaultStoreIapDeps2 } = await Promise.resolve().then(() => (init_store_iap(), store_iap_exports));
219378
219550
  return runStoreIap2(pos, flags, io2, { ...defaultStoreIapDeps2(), validateConfig: createTrimValidator(deps) });
@@ -222341,26 +222513,26 @@ function writeCatalog(path2, text15) {
222341
222513
  }
222342
222514
  async function l10nCommand(ctx) {
222343
222515
  const { io: io2, pos, flags, print } = ctx;
222344
- const fail7 = (code, fields, exit) => {
222516
+ const fail8 = (code, fields, exit) => {
222345
222517
  io2.error(JSON.stringify({ ok: false, code, usage: L10N_USAGE, ...fields }));
222346
222518
  return exit;
222347
222519
  };
222348
222520
  if (pos[1] !== "import") {
222349
- return fail7("invalid_usage", { error: pos[1] ? `unknown l10n subcommand "${pos[1]}" \u2014 use import` : "l10n needs a subcommand: import" }, 2);
222521
+ return fail8("invalid_usage", { error: pos[1] ? `unknown l10n subcommand "${pos[1]}" \u2014 use import` : "l10n needs a subcommand: import" }, 2);
222350
222522
  }
222351
222523
  const format = str3(flags.format);
222352
222524
  if (format !== "oneapp") {
222353
- return fail7("unsupported_format", {
222525
+ return fail8("unsupported_format", {
222354
222526
  error: format ? `unsupported --format "${format}"` : "--format is required",
222355
222527
  formats: ["oneapp"]
222356
222528
  }, 2);
222357
222529
  }
222358
222530
  for (const name of ["locales", "source"]) {
222359
- if (flags[name] === true) return fail7("invalid_usage", { error: `--${name} needs a value` }, 2);
222531
+ if (flags[name] === true) return fail8("invalid_usage", { error: `--${name} needs a value` }, 2);
222360
222532
  }
222361
222533
  const dirArg = pos[2];
222362
222534
  if (!dirArg) {
222363
- return fail7("invalid_usage", { error: "missing <dir> \u2014 the directory holding messages_<locale>.json files" }, 2);
222535
+ return fail8("invalid_usage", { error: "missing <dir> \u2014 the directory holding messages_<locale>.json files" }, 2);
222364
222536
  }
222365
222537
  const slug = str3(flags.app);
222366
222538
  let appDir3;
@@ -222370,44 +222542,44 @@ async function l10nCommand(ctx) {
222370
222542
  appLabel2 = appDir3;
222371
222543
  } else if (slug) {
222372
222544
  if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) {
222373
- return fail7("app_not_found", { error: `--app ${slug}: an app slug, not a path`, hint: "pass --content <app dir> to target a directory" }, 2);
222545
+ return fail8("app_not_found", { error: `--app ${slug}: an app slug, not a path`, hint: "pass --content <app dir> to target a directory" }, 2);
222374
222546
  }
222375
222547
  const dir = resolve82("apps", slug);
222376
222548
  if (!existsSync109(join117(dir, "config.ts")) && !existsSync109(join117(dir, "config.js")) && !existsSync109(join117(dir, "config.mjs"))) {
222377
- return fail7("app_not_found", { error: `--app ${slug}: no apps/${slug}/config.ts under ${process.cwd()}`, hint: "run from the repo root, or pass --content <app dir>" }, 2);
222549
+ return fail8("app_not_found", { error: `--app ${slug}: no apps/${slug}/config.ts under ${process.cwd()}`, hint: "run from the repo root, or pass --content <app dir>" }, 2);
222378
222550
  }
222379
222551
  appDir3 = dir;
222380
222552
  appLabel2 = slug;
222381
222553
  } else {
222382
- return fail7("invalid_usage", { error: "name the app: --app <slug> (in a checkout) or --content <app dir>" }, 2);
222554
+ return fail8("invalid_usage", { error: "name the app: --app <slug> (in a checkout) or --content <app dir>" }, 2);
222383
222555
  }
222384
222556
  const messagesDir = resolve82(dirArg);
222385
222557
  if (!existsSync109(messagesDir) || !statSync31(messagesDir).isDirectory()) {
222386
- return fail7("messages_dir_not_found", { error: `${dirArg} is not a directory`, dir: messagesDir }, 1);
222558
+ return fail8("messages_dir_not_found", { error: `${dirArg} is not a directory`, dir: messagesDir }, 1);
222387
222559
  }
222388
222560
  const fileByTag = /* @__PURE__ */ new Map();
222389
222561
  let names2;
222390
222562
  try {
222391
222563
  names2 = readdirSync45(messagesDir).sort();
222392
222564
  } catch (e2) {
222393
- return fail7("messages_unreadable", { error: `${dirArg} cannot be listed: ${e2.message}`, dir: messagesDir }, 1);
222565
+ return fail8("messages_unreadable", { error: `${dirArg} cannot be listed: ${e2.message}`, dir: messagesDir }, 1);
222394
222566
  }
222395
222567
  for (const name of names2) {
222396
222568
  const m2 = MESSAGES_FILE.exec(name);
222397
222569
  if (m2) fileByTag.set(m2[1], join117(messagesDir, name));
222398
222570
  }
222399
222571
  if (fileByTag.size === 0) {
222400
- return fail7("no_messages_found", { error: `no messages_<locale>.json files in ${dirArg}`, dir: messagesDir }, 1);
222572
+ return fail8("no_messages_found", { error: `no messages_<locale>.json files in ${dirArg}`, dir: messagesDir }, 1);
222401
222573
  }
222402
222574
  const found = [...fileByTag.keys()].sort();
222403
222575
  const source = str3(flags.source) ?? "en";
222404
222576
  const requestedRaw = str3(flags.locales);
222405
222577
  const requested = requestedRaw === void 0 ? found : [...new Set(requestedRaw.split(",").map((t2) => t2.trim()).filter(Boolean))].sort();
222406
222578
  if (requested.length === 0) {
222407
- return fail7("invalid_usage", { error: "--locales names no locale" }, 2);
222579
+ return fail8("invalid_usage", { error: "--locales names no locale" }, 2);
222408
222580
  }
222409
222581
  if (!fileByTag.has(source)) {
222410
- return fail7("source_locale_missing", {
222582
+ return fail8("source_locale_missing", {
222411
222583
  error: `no messages_${source}.json in ${dirArg} \u2014 the source locale supplies every row's \`source\` string`,
222412
222584
  source,
222413
222585
  found,
@@ -222416,7 +222588,7 @@ async function l10nCommand(ctx) {
222416
222588
  }
222417
222589
  const absent = requested.filter((t2) => !fileByTag.has(t2));
222418
222590
  if (absent.length > 0) {
222419
- return fail7("locale_file_missing", { error: `no messages_<tag>.json for: ${absent.join(", ")}`, missing: absent, found }, 1);
222591
+ return fail8("locale_file_missing", { error: `no messages_<tag>.json for: ${absent.join(", ")}`, missing: absent, found }, 1);
222420
222592
  }
222421
222593
  const files = {};
222422
222594
  for (const tag of [.../* @__PURE__ */ new Set([source, ...requested])]) {
@@ -222426,27 +222598,27 @@ async function l10nCommand(ctx) {
222426
222598
  buf = readRegularFile(path2);
222427
222599
  } catch (e2) {
222428
222600
  if (isUnsafe2(e2)) {
222429
- return fail7("unsafe_path", { error: `${relative25(process.cwd(), path2)} is a symbolic link \u2014 the import does not follow links in the messages directory`, file: path2, hint: "copy the real file into the directory, or point <dir> at where the files actually live" }, 1);
222601
+ return fail8("unsafe_path", { error: `${relative25(process.cwd(), path2)} is a symbolic link \u2014 the import does not follow links in the messages directory`, file: path2, hint: "copy the real file into the directory, or point <dir> at where the files actually live" }, 1);
222430
222602
  }
222431
- return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)}: ${e2.message}`, file: path2 }, 1);
222603
+ return fail8("messages_unreadable", { error: `${relative25(process.cwd(), path2)}: ${e2.message}`, file: path2 }, 1);
222432
222604
  }
222433
222605
  const text15 = buf.toString("utf8");
222434
222606
  const utf16Bom = buf.length >= 2 && (buf[0] === 255 && buf[1] === 254 || buf[0] === 254 && buf[1] === 255);
222435
222607
  if (utf16Bom || buf.includes(0) || Buffer.compare(Buffer.from(text15, "utf8"), buf) !== 0) {
222436
- return fail7("messages_not_utf8", { error: `${relative25(process.cwd(), path2)} is not valid UTF-8`, file: path2, hint: "re-encode the file as UTF-8 (UTF-16 exports are the usual cause)" }, 1);
222608
+ return fail8("messages_not_utf8", { error: `${relative25(process.cwd(), path2)} is not valid UTF-8`, file: path2, hint: "re-encode the file as UTF-8 (UTF-16 exports are the usual cause)" }, 1);
222437
222609
  }
222438
222610
  let parsed;
222439
222611
  try {
222440
222612
  parsed = JSON.parse(text15.replace(/^\uFEFF/, ""));
222441
222613
  } catch (e2) {
222442
- return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)}: ${e2.message}`, file: path2 }, 1);
222614
+ return fail8("messages_unreadable", { error: `${relative25(process.cwd(), path2)}: ${e2.message}`, file: path2 }, 1);
222443
222615
  }
222444
222616
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
222445
- return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)} is not an object of key \u2192 message`, file: path2 }, 1);
222617
+ return fail8("messages_unreadable", { error: `${relative25(process.cwd(), path2)} is not an object of key \u2192 message`, file: path2 }, 1);
222446
222618
  }
222447
222619
  const bad2 = Object.entries(parsed).filter(([, v2]) => typeof v2 !== "string").map(([k2]) => k2);
222448
222620
  if (bad2.length > 0) {
222449
- return fail7("messages_unreadable", { error: `${relative25(process.cwd(), path2)} has non-string values`, file: path2, keys: bad2.slice(0, 5) }, 1);
222621
+ return fail8("messages_unreadable", { error: `${relative25(process.cwd(), path2)} has non-string values`, file: path2, keys: bad2.slice(0, 5) }, 1);
222450
222622
  }
222451
222623
  files[tag] = parsed;
222452
222624
  }
@@ -222456,10 +222628,10 @@ async function l10nCommand(ctx) {
222456
222628
  try {
222457
222629
  unsafe2 = unsafeDestination(appDir3, requested);
222458
222630
  } catch (e2) {
222459
- return fail7("catalog_write_failed", { error: `cannot inspect ${relative25(process.cwd(), join117(appDir3, "l10n"))}: ${e2.message}`, written: [] }, 1);
222631
+ return fail8("catalog_write_failed", { error: `cannot inspect ${relative25(process.cwd(), join117(appDir3, "l10n"))}: ${e2.message}`, written: [] }, 1);
222460
222632
  }
222461
222633
  if (unsafe2 !== void 0) {
222462
- return fail7("unsafe_path", { error: `${unsafe2} \u2014 the import does not read or write through links`, hint: "replace the link with a real directory/file inside the app, then re-run" }, 1);
222634
+ return fail8("unsafe_path", { error: `${unsafe2} \u2014 the import does not read or write through links`, hint: "replace the link with a real directory/file inside the app, then re-run" }, 1);
222463
222635
  }
222464
222636
  for (const tag of requested) {
222465
222637
  const path2 = join117(appDir3, "l10n", `${tag}.json`);
@@ -222471,7 +222643,7 @@ async function l10nCommand(ctx) {
222471
222643
  if (badRow) throw new Error(`message "${badRow[0]}" is not an object`);
222472
222644
  existing[tag] = parsed;
222473
222645
  } catch (e2) {
222474
- return fail7("catalog_unreadable", {
222646
+ return fail8("catalog_unreadable", {
222475
222647
  error: `existing catalog ${relative25(process.cwd(), path2)} cannot be parsed \u2014 refusing to overwrite it`,
222476
222648
  file: path2,
222477
222649
  cause: e2.message
@@ -222482,7 +222654,7 @@ async function l10nCommand(ctx) {
222482
222654
  try {
222483
222655
  result = convertOneApp2({ source, tags: requested, files, existing, overwrite: flags.overwrite === true });
222484
222656
  } catch (e2) {
222485
- return fail7("import_failed", { error: e2.message, hint: "nothing was written" }, 1);
222657
+ return fail8("import_failed", { error: e2.message, hint: "nothing was written" }, 1);
222486
222658
  }
222487
222659
  const warnings = [];
222488
222660
  const unsupportedTags = undeclaredLocales2(void 0, requested)?.unsupported ?? [];
@@ -222543,8 +222715,8 @@ async function l10nCommand(ctx) {
222543
222715
  written.push({ tag, path: relative25(process.cwd(), path2), count: Object.keys(catalogs[tag].messages).length });
222544
222716
  }
222545
222717
  } catch (e2) {
222546
- if (isUnsafe2(e2)) return fail7("unsafe_path", { error: `${e2.message} \u2014 nothing more was written`, written }, 1);
222547
- return fail7("catalog_write_failed", { error: e2.message, written }, 1);
222718
+ if (isUnsafe2(e2)) return fail8("unsafe_path", { error: `${e2.message} \u2014 nothing more was written`, written }, 1);
222719
+ return fail8("catalog_write_failed", { error: e2.message, written }, 1);
222548
222720
  }
222549
222721
  const envelope = {
222550
222722
  ok: true,
@@ -222646,14 +222818,14 @@ async function base44Command(ctx) {
222646
222818
  }
222647
222819
  if (sub === "screens") {
222648
222820
  const dir = contentDir(flags);
222649
- const fail7 = (code, error, extra = {}) => {
222821
+ const fail8 = (code, error, extra = {}) => {
222650
222822
  io2.error(JSON.stringify({ ok: false, code, error, ...extra }));
222651
222823
  return 1;
222652
222824
  };
222653
222825
  const gen = await Promise.resolve().then(() => (init_generate(), generate_exports));
222654
222826
  const missing3 = gen.ENGINE_FILES.filter((f2) => !existsSync117(join126(dir, f2)));
222655
222827
  if (missing3.length) {
222656
- return fail7("content_dir_not_base44_starter", `${dir} is not a base44-starter content package: the generated screens import a shared engine it does not have (${missing3.join(", ")})`, { missing: missing3, hint: "scaffold one with `himi init <name> --template base44-starter --base44-app-id <id>`" });
222828
+ return fail8("content_dir_not_base44_starter", `${dir} is not a base44-starter content package: the generated screens import a shared engine it does not have (${missing3.join(", ")})`, { missing: missing3, hint: "scaffold one with `himi init <name> --template base44-starter --base44-app-id <id>`" });
222657
222829
  }
222658
222830
  const app = await appId(dir);
222659
222831
  let base44;
@@ -222669,11 +222841,11 @@ async function base44Command(ctx) {
222669
222841
  io2.error(JSON.stringify({ ok: false, code: "invalid_config", app, issues: [{ severity: "error", ...finding2 }], hint: '`himi validate` reports these with pass: "base44"' }));
222670
222842
  return 1;
222671
222843
  }
222672
- return fail7("config_unloadable", e2.message, { app, hint: "fix the config so it imports cleanly, then re-run. `himi validate` shows the underlying error." });
222844
+ return fail8("config_unloadable", e2.message, { app, hint: "fix the config so it imports cleanly, then re-run. `himi validate` shows the underlying error." });
222673
222845
  }
222674
222846
  const specs = base44 && typeof base44 === "object" && Array.isArray(base44.entities) ? base44.entities : [];
222675
222847
  if (!specs.length) {
222676
- return fail7("no_entities_block", "config.ts declares no `base44.entities` \u2014 nothing to generate", { app, hint: "declare the entities first (`himi base44 adopt --write`, himi docs base44-entities), then re-run" });
222848
+ return fail8("no_entities_block", "config.ts declares no `base44.entities` \u2014 nothing to generate", { app, hint: "declare the entities first (`himi base44 adopt --write`, himi docs base44-entities), then re-run" });
222677
222849
  }
222678
222850
  const { validateBase44Entities: validateBase44Entities2 } = await Promise.resolve().then(() => (init_base44_schema(), base44_schema_exports));
222679
222851
  const errors = validateBase44Entities2(base44, app).filter((i2) => i2.severity === "error");
@@ -222686,7 +222858,7 @@ async function base44Command(ctx) {
222686
222858
  try {
222687
222859
  sp = planEntityScreens2(specs, app);
222688
222860
  } catch (e2) {
222689
- if (e2 instanceof PlanError2) return fail7(e2.code, e2.message, { app, ...e2.extra });
222861
+ if (e2 instanceof PlanError2) return fail8(e2.code, e2.message, { app, ...e2.extra });
222690
222862
  throw e2;
222691
222863
  }
222692
222864
  const { catalogKey: catalogKey2, expandCapabilities: expandCapabilities2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
@@ -222694,7 +222866,7 @@ async function base44Command(ctx) {
222694
222866
  const missingCaps = missingCapabilities2(sp, declaredCaps);
222695
222867
  if (missingCaps.length) {
222696
222868
  const [first] = missingCaps;
222697
- return fail7("missing_capability", `config.ts capabilities does not declare "${first.capability}", which the generated screens need (${first.entities.join(", ")})`, {
222869
+ return fail8("missing_capability", `config.ts capabilities does not declare "${first.capability}", which the generated screens need (${first.entities.join(", ")})`, {
222698
222870
  app,
222699
222871
  capability: first.capability,
222700
222872
  missing: missingCaps,