@wix/himalaya-cli 0.835.0 → 0.836.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +84 -49
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -60246,6 +60246,7 @@ function wixPlayerTestflightTarget(requested) {
60246
60246
  }
60247
60247
  var SURFACE_IDS = `${PREVIEW_SURFACES.filter((s) => !s.id.startsWith("widget:")).map((s) => s.id).join("|")}|widget:<family>`;
60248
60248
  var DEVELOPER_PORTAL_URL = `${ADMIN_ORIGIN_BO}/#/developer`;
60249
+ var MAX_APP_SOURCE_BYTES_HELP = "4 MiB (4,194,304 bytes)";
60249
60250
  var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
60250
60251
 
60251
60252
  himi captcha setup|status --app <name> [--site <msid>] [--content <dir>]
@@ -60391,6 +60392,13 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
60391
60392
  Never archives .himi/, .env*, node_modules/, dist/ or key
60392
60393
  material, and REFUSES the push if a file it would archive
60393
60394
  looks like it holds a credential.
60395
+ EVERYTHING ELSE under the content directory IS archived,
60396
+ at any depth \u2014 screenshots, notes, fixtures, tests, l10n.
60397
+ The archive is capped at ${MAX_APP_SOURCE_BYTES_HELP}, measured
60398
+ base64-encoded (~1.33x the zip's own size); over it the
60399
+ push refuses, naming archivedBytes/encodedBytes/files \u2014
60400
+ trim the directory or push with --no-source. Not the
60401
+ same limit as the whole publish body.
60394
60402
  himi pull <app> [--release <id>] [--out <dir>] [--name <new>] [--force|--replace] [--target <t>]
60395
60403
  restore an app's SOURCE from the serve plane into an editable
60396
60404
  content package \u2014 the other half of push, which archives it.
@@ -60919,8 +60927,27 @@ function serveUnreachableError(target, base, cause) {
60919
60927
  }
60920
60928
  function loopbackTargetWarning(base, explicitTarget) {
60921
60929
  if (explicitTarget) return null;
60922
- if (!/^https?:\/\/(127\.0\.0\.1|localhost|0\.0\.0\.0|\[::1\])(:|\/|$)/i.test(base)) return null;
60923
- return `Published to the LOCAL dev serve (${base}). The default target is a local dev plane that only exists in a monorepo checkout, so this release is NOT on the bo.wix.com serve and its preview will 404. Off-repo, publish with \`--target bo\` (after \`himi login --dpx --target bo\`), or set HIMI_TARGET=bo.`;
60930
+ if (!isLoopbackBase(base)) return null;
60931
+ return `Published to the LOCAL dev serve (${base}). The default target is a local dev plane that only exists in a monorepo checkout, so this release is NOT on the bo.wix.com serve and its preview will 404. Off-repo, publish with \`--target bo\` (after \`himi login --dpx --target bo\`), or set HIMI_SERVE_TARGET=bo.`;
60932
+ }
60933
+ function isLoopbackBase(base) {
60934
+ return /^https?:\/\/(127\.0\.0\.1|localhost|0\.0\.0\.0|\[::1\])(:|\/|$)/i.test(base);
60935
+ }
60936
+ function foreignPlaneError(target, base) {
60937
+ return {
60938
+ error: `no himi serve plane is running at ${base} \u2014 something else on this machine answered that port, so its response was NOT shown (port 8200 is also Appium UiAutomator2's default systemPort). ` + serveUnreachableHint(target),
60939
+ code: "no_serve_plane",
60940
+ target,
60941
+ base
60942
+ };
60943
+ }
60944
+ async function servePlaneAnswers(health) {
60945
+ try {
60946
+ const r = await health();
60947
+ return r.ok && r.json?.ok === true;
60948
+ } catch {
60949
+ return false;
60950
+ }
60924
60951
  }
60925
60952
  var PUBLIC_WIX_API_BASE = "https://www.wixapis.com";
60926
60953
  var DOCTOR_TIMEOUT_MS = 4e3;
@@ -61188,7 +61215,8 @@ function isHimalayaMonorepoCheckout(start) {
61188
61215
  }
61189
61216
  }
61190
61217
  function defaultTargetForCommand(command, authoringDir) {
61191
- return (command === "push" || command === "login") && !isHimalayaMonorepoCheckout(authoringDir) ? "wix" : void 0;
61218
+ void command;
61219
+ return isHimalayaMonorepoCheckout(authoringDir) ? void 0 : "wix";
61192
61220
  }
61193
61221
  function renderDataSource(input) {
61194
61222
  if (!input.live) return input.hydrate ? "worker-initial-state" : "static";
@@ -61521,6 +61549,21 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
61521
61549
  })
61522
61550
  );
61523
61551
  const serveBase = () => resolveTarget({ target: str5(flags.target), defaultTarget: contextualDefaultTarget, serveUrl: str5(flags["serve-url"]) }).serve;
61552
+ const foreignPlaneRefusal = async () => {
61553
+ const base = serveBase();
61554
+ if (!isLoopbackBase(base)) return null;
61555
+ if (await servePlaneAnswers(() => client3().health("serve"))) return null;
61556
+ io.error(JSON.stringify(foreignPlaneError(targetName(), base)));
61557
+ return 1;
61558
+ };
61559
+ const printServeFailure = (r, extra) => {
61560
+ print({ ok: false, ...extra, status: r.status, body: r.json ?? r.text });
61561
+ return 1;
61562
+ };
61563
+ const serveFailure = async (r, extra) => {
61564
+ const refusal = await foreignPlaneRefusal();
61565
+ return refusal !== null ? refusal : printServeFailure(r, extra);
61566
+ };
61524
61567
  try {
61525
61568
  switch (command) {
61526
61569
  case "captcha": {
@@ -61611,14 +61654,11 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
61611
61654
  try {
61612
61655
  r = await client3().templates();
61613
61656
  } catch (e) {
61614
- const target = str5(flags.target) ?? "local";
61657
+ const target = targetName();
61615
61658
  print({ ok: true, templates: embedded, remote: false, note: `remote catalog unreachable (${e.message}); showing embedded. ${serveUnreachableHint(target)}` });
61616
61659
  return 0;
61617
61660
  }
61618
- if (!r.ok) {
61619
- print({ ok: false, status: r.status, body: r.json ?? r.text });
61620
- return 1;
61621
- }
61661
+ if (!r.ok) return serveFailure(r);
61622
61662
  const remoteTemplates = (r.json?.templates ?? []).map((t) => {
61623
61663
  const prompt = typeof t.name === "string" ? templateStartPrompt(startPromptSkillUrl("door"), { name: t.name, title: typeof t.title === "string" ? t.title : void 0 }) : null;
61624
61664
  return { ...t, source: "remote", ...prompt ? { prompt } : {} };
@@ -61766,7 +61806,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
61766
61806
  try {
61767
61807
  r = await client3().publishRelease(payload, publishMeta);
61768
61808
  } catch (e) {
61769
- const target = str5(flags.target) ?? "local";
61809
+ const target = targetName();
61770
61810
  io.error(JSON.stringify(serveUnreachableError(target, serveBase(), e.message)));
61771
61811
  return 1;
61772
61812
  }
@@ -62206,7 +62246,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
62206
62246
  }
62207
62247
  jobWix = { clientId: a.clientId };
62208
62248
  }
62209
- const authoringBase = resolveTarget({ target: str5(flags.target), serveUrl: str5(flags["serve-url"]) }).serve;
62249
+ const authoringBase = serveBase();
62210
62250
  try {
62211
62251
  const { report } = await runBrowserAuthoring2({
62212
62252
  authoringBase,
@@ -62423,14 +62463,11 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
62423
62463
  } catch (e) {
62424
62464
  io.error(JSON.stringify({
62425
62465
  error: `cannot reach serve for render --remote: ${e.message}. Pass --target bo.`,
62426
- target: str5(flags.target) ?? "local"
62466
+ target: targetName()
62427
62467
  }));
62428
62468
  return 1;
62429
62469
  }
62430
- if (!r2.ok) {
62431
- print({ ok: false, remote: true, status: r2.status, body: r2.json ?? r2.text });
62432
- return 1;
62433
- }
62470
+ if (!r2.ok) return serveFailure(r2, { remote: true });
62434
62471
  const body = r2.json ?? {};
62435
62472
  if (wantPng2 && typeof body.pngBase64 === "string") {
62436
62473
  const outPath = typeof flags.png === "string" ? flags.png : `${screenId}.png`;
@@ -63629,6 +63666,9 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63629
63666
  if (!previewToken) {
63630
63667
  const target = resolveTarget({
63631
63668
  target: str5(flags.target),
63669
+ // Same default as `client()` (#2483.1) — without it this resolved a DIFFERENT target
63670
+ // than the request that follows, so off-repo the mint was attempted against `local`.
63671
+ defaultTarget: contextualDefaultTarget,
63632
63672
  serveUrl: str5(flags["serve-url"]),
63633
63673
  telemetryUrl: str5(flags["telemetry-url"]),
63634
63674
  controlUrl: str5(flags["control-url"]),
@@ -63707,14 +63747,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63707
63747
  } catch (e) {
63708
63748
  io.error(JSON.stringify({
63709
63749
  error: `cannot reach serve for context: ${e.message}. Pass --target bo.`,
63710
- target: str5(flags.target) ?? "local"
63750
+ target: targetName()
63711
63751
  }));
63712
63752
  return 1;
63713
63753
  }
63714
- if (!r.ok) {
63715
- print({ ok: false, status: r.status, body: r.json ?? r.text });
63716
- return 1;
63717
- }
63754
+ if (!r.ok) return serveFailure(r);
63718
63755
  const body = r.json ?? {};
63719
63756
  print(body);
63720
63757
  return body.ok === false ? 1 : 0;
@@ -63741,13 +63778,10 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63741
63778
  try {
63742
63779
  r = subcommand === "list" ? await client3().authoringDocs(app, release) : await client3().fetchAuthoringDoc(app, docName, release);
63743
63780
  } catch (e) {
63744
- io.error(JSON.stringify({ error: `cannot reach serve for app-docs: ${e.message}`, target: str5(flags.target) ?? "local" }));
63745
- return 1;
63746
- }
63747
- if (!r.ok) {
63748
- print({ ok: false, status: r.status, body: r.json ?? r.text });
63781
+ io.error(JSON.stringify({ error: `cannot reach serve for app-docs: ${e.message}`, target: targetName() }));
63749
63782
  return 1;
63750
63783
  }
63784
+ if (!r.ok) return serveFailure(r);
63751
63785
  if (subcommand === "get" && flags.json !== true) io.log(r.text);
63752
63786
  else print(r.json ?? {});
63753
63787
  return 0;
@@ -63760,7 +63794,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63760
63794
  return 2;
63761
63795
  }
63762
63796
  const c = client3();
63763
- const target = str5(flags.target) ?? "local";
63797
+ const target = targetName();
63764
63798
  const level = str5(flags.level);
63765
63799
  const byLevel = (ls) => level ? ls.filter((l) => l.level === level) : ls;
63766
63800
  const includeEvents = flags["no-events"] !== true;
@@ -63860,14 +63894,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63860
63894
  } catch (e) {
63861
63895
  io.error(JSON.stringify({
63862
63896
  error: `cannot reach serve for screens: ${e.message}. Pass --target bo.`,
63863
- target: str5(flags.target) ?? "local"
63897
+ target: targetName()
63864
63898
  }));
63865
63899
  return 1;
63866
63900
  }
63867
- if (!r.ok) {
63868
- print({ ok: false, status: r.status, body: r.json ?? r.text });
63869
- return 1;
63870
- }
63901
+ if (!r.ok) return serveFailure(r);
63871
63902
  print(r.json ?? {});
63872
63903
  return 0;
63873
63904
  }
@@ -63885,13 +63916,14 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63885
63916
  } catch (e) {
63886
63917
  io.error(JSON.stringify({
63887
63918
  error: `cannot reach serve for diagnose: ${e.message}. Pass --target bo.`,
63888
- target: str5(flags.target) ?? "local"
63919
+ target: targetName()
63889
63920
  }));
63890
63921
  return 1;
63891
63922
  }
63892
- if (!r.ok && r.status !== 422) {
63893
- print({ ok: false, status: r.status, body: r.json ?? r.text });
63894
- return 1;
63923
+ if (!r.ok) {
63924
+ const refusal = await foreignPlaneRefusal();
63925
+ if (refusal !== null) return refusal;
63926
+ if (r.status !== 422) return printServeFailure(r);
63895
63927
  }
63896
63928
  const body = r.json ?? {};
63897
63929
  print(body);
@@ -63910,14 +63942,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63910
63942
  } catch (e) {
63911
63943
  io.error(JSON.stringify({
63912
63944
  error: `cannot reach serve for deeplinks: ${e.message}. Pass --target bo.`,
63913
- target: str5(flags.target) ?? "local"
63945
+ target: targetName()
63914
63946
  }));
63915
63947
  return 1;
63916
63948
  }
63917
- if (!r.ok) {
63918
- print({ ok: false, status: r.status, body: r.json ?? r.text });
63919
- return 1;
63920
- }
63949
+ if (!r.ok) return serveFailure(r);
63921
63950
  print(r.json ?? {});
63922
63951
  return 0;
63923
63952
  }
@@ -63942,7 +63971,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63942
63971
  limit: num2(flags.limit)
63943
63972
  });
63944
63973
  } catch (e) {
63945
- const target = str5(flags.target) ?? "local";
63974
+ const target = targetName();
63946
63975
  io.error(JSON.stringify({
63947
63976
  error: `cannot reach the telemetry plane for target "${target}": ${e.message}. Worker logs live on the prod plane \u2014 off-repo, pass --target bo and authenticate with \`himi login --dpx --target bo\`.`,
63948
63977
  target
@@ -63978,7 +64007,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
63978
64007
  io.error(JSON.stringify({ error: "promote needs --app and --release" }));
63979
64008
  return 2;
63980
64009
  }
63981
- const target = str5(flags.target) ?? "local";
64010
+ const target = targetName();
63982
64011
  const r = await client3().activateRelease(app, release, flags.force === true);
63983
64012
  print({
63984
64013
  status: r.status,
@@ -64003,7 +64032,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
64003
64032
  try {
64004
64033
  r = value === void 0 ? await client3().appSettings(app) : await client3().setVisibility(app, value);
64005
64034
  } catch (e) {
64006
- const target = str5(flags.target) ?? "local";
64035
+ const target = targetName();
64007
64036
  io.error(JSON.stringify(serveUnreachableError(target, serveBase(), e.message)));
64008
64037
  return 1;
64009
64038
  }
@@ -64224,7 +64253,7 @@ ${label2}`);
64224
64253
  if (job.status === "SUCCESS") await printDistQrForJob(job, app);
64225
64254
  }
64226
64255
  };
64227
- const distTarget = str5(flags.target) ?? "local";
64256
+ const distTarget = targetName();
64228
64257
  const distUnreachable = (e) => {
64229
64258
  io.error(JSON.stringify({
64230
64259
  ...serveUnreachableError(distTarget, serveBase(), e.message),
@@ -64636,7 +64665,7 @@ ${label2}`);
64636
64665
  }
64637
64666
  // --- #814 Stage 3: self-serve app ownership + local token introspection -------
64638
64667
  case "apps": {
64639
- const target = str5(flags.target) ?? "local";
64668
+ const target = targetName();
64640
64669
  let ownerIssue;
64641
64670
  try {
64642
64671
  ownerIssue = resolveTarget({ target, ownerIssueUrl: str5(flags["owner-issue-url"]) }).ownerIssue;
@@ -64716,7 +64745,7 @@ ${label2}`);
64716
64745
  }
64717
64746
  }
64718
64747
  case "whoami": {
64719
- const target = str5(flags.target) ?? "local";
64748
+ const target = targetName();
64720
64749
  let tok;
64721
64750
  try {
64722
64751
  tok = resolveTarget({ target }).controlToken;
@@ -64755,7 +64784,7 @@ ${label2}`);
64755
64784
  }
64756
64785
  }
64757
64786
  case "logout": {
64758
- const target = str5(flags.target) ?? "local";
64787
+ const target = targetName();
64759
64788
  let revoked;
64760
64789
  let revokeError;
64761
64790
  try {
@@ -64790,7 +64819,7 @@ ${label2}`);
64790
64819
  return 0;
64791
64820
  }
64792
64821
  case "doctor": {
64793
- const target = str5(flags.target) ?? process.env.HIMI_SERVE_TARGET ?? "local";
64822
+ const target = targetName();
64794
64823
  const timeoutMs = Number(str5(flags.timeout)) > 0 ? Number(str5(flags.timeout)) : DOCTOR_TIMEOUT_MS;
64795
64824
  const dataUrl = str5(flags["data-url"]) ?? process.env.HIMI_DATA_URL ?? PUBLIC_WIX_API_BASE;
64796
64825
  let resolved2;
@@ -64798,7 +64827,10 @@ ${label2}`);
64798
64827
  let targetError;
64799
64828
  try {
64800
64829
  resolved2 = resolveTarget({
64801
- target: str5(flags.target),
64830
+ // The ALREADY-RESOLVED name, so the plane doctor probes is the plane it reports.
64831
+ // Passing `str(flags.target)` re-ran resolution without `defaultTarget`, so off-repo
64832
+ // doctor labelled its report `wix` while probing the `local` URLs.
64833
+ target,
64802
64834
  serveUrl: str5(flags["serve-url"]),
64803
64835
  controlUrl: str5(flags["control-url"]),
64804
64836
  controlToken: str5(flags["control-token"])
@@ -65234,10 +65266,12 @@ export {
65234
65266
  decodeControlTokenClaims,
65235
65267
  defaultTargetForCommand,
65236
65268
  doctorVersionReport,
65269
+ foreignPlaneError,
65237
65270
  formatSdkVersionLine,
65238
65271
  humanDuration,
65239
65272
  inspectControlToken,
65240
65273
  isHimalayaMonorepoCheckout,
65274
+ isLoopbackBase,
65241
65275
  isPublicTarget,
65242
65276
  loopbackTargetWarning,
65243
65277
  nativeConfigAdvisories,
@@ -65264,6 +65298,7 @@ export {
65264
65298
  resolveAppSlug,
65265
65299
  resolvedSdkVersion,
65266
65300
  run,
65301
+ servePlaneAnswers,
65267
65302
  serveUnreachableError,
65268
65303
  serveUnreachableHint,
65269
65304
  templatePreviewAuthError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.835.0",
3
+ "version": "0.836.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -63,5 +63,5 @@
63
63
  "artifactId": "himalaya-cli"
64
64
  }
65
65
  },
66
- "falconPackageHash": "28f3f50cd02d76203d4daf19d83865ed5be46f5158dc74ca6e1764b1"
66
+ "falconPackageHash": "8130a755174e0dd9b32e828e9a5328aa479d90c175f0dfa7057c60f6"
67
67
  }