@wix/himalaya-cli 0.1635.0 → 0.1636.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.
package/dist/cli.mjs CHANGED
@@ -15892,6 +15892,7 @@ function webViewOriginAllowed(url, origins) {
15892
15892
  }
15893
15893
  var init_webview_origin = __esm({
15894
15894
  "../../core/ts/src/webview-origin.ts"() {
15895
+ "use strict";
15895
15896
  init_define_HHP_CATALOG();
15896
15897
  }
15897
15898
  });
@@ -36082,7 +36083,7 @@ async function resolveAccountCredential(auth, fetchImpl) {
36082
36083
  }
36083
36084
  const account = toWixAccount(parsed && typeof parsed === "object" ? parsed.account : void 0);
36084
36085
  if (!account) return { ok: false, reason: "upstream_failed", status: res.status, detail: "no_account" };
36085
- return { ok: true, accounts: [account] };
36086
+ return { ok: true, accounts: [account], accountCredential: true };
36086
36087
  }
36087
36088
  var ACCOUNT_SERVER;
36088
36089
  var init_wix_account = __esm({
@@ -177100,6 +177101,14 @@ async function appDir2(args, deps) {
177100
177101
  function loginResult(s2) {
177101
177102
  switch (s2.state) {
177102
177103
  case "pending":
177104
+ if (s2.via === "wix") {
177105
+ return json4({
177106
+ ok: true,
177107
+ state: "pending",
177108
+ via: "wix",
177109
+ message: "Signing in with the Wix token held in WIX_TOKEN \u2014 no browser. Call himi_login again to confirm, or just retry the push."
177110
+ });
177111
+ }
177103
177112
  return json4({
177104
177113
  ok: true,
177105
177114
  state: "pending",
@@ -177107,9 +177116,9 @@ function loginResult(s2) {
177107
177116
  message: "A browser window opened for the user to sign in to Wix. If it did not open, give them `loginUrl`. Once they have signed in, call himi_login again to confirm, or just retry the push."
177108
177117
  });
177109
177118
  case "signed_in":
177110
- return json4({ ok: true, state: "signed_in", account: s2.account, scope: s2.scope, expiresAt: s2.expiresAt });
177119
+ return json4({ ok: true, state: "signed_in", account: s2.account, scope: s2.scope, expiresAt: s2.expiresAt, ...s2.via ? { via: s2.via } : {} });
177111
177120
  case "failed":
177112
- return { ...json4({ ok: false, state: "failed", error: s2.error, hint: "Call himi_login again to retry, or ask the user to run `himi login --browser` in a terminal." }), isError: true };
177121
+ return { ...json4({ ok: false, state: "failed", error: s2.error, hint: `Call himi_login again to retry, or ask the user to run \`himi login --browser\` in a terminal. ${HELD_TOKEN_ROUTE}` }), isError: true };
177113
177122
  default:
177114
177123
  return json4({ ok: true, state: "idle" });
177115
177124
  }
@@ -177349,7 +177358,7 @@ ${log}` : ""}`, true);
177349
177358
  {
177350
177359
  name: "himi_login",
177351
177360
  title: "Sign in to Wix",
177352
- description: "Open a browser window where the USER signs in to Wix, so himi_push and himi_share can publish. Returns at once with the sign-in link; call again to see whether the sign-in finished. Already signed in: says who, and opens nothing unless `switchAccount` is true. This server never sees the credential \u2014 the sign-in stores a scoped token on this machine.",
177361
+ description: "Open a browser window where the USER signs in to Wix, so himi_push and himi_share can publish. Returns at once with the sign-in link; call again to see whether the sign-in finished. Already signed in: says who, and opens nothing unless `switchAccount` is true. This server never sees the credential \u2014 the sign-in stores a scoped token on this machine. When the server was started with WIX_TOKEN (the owner's Wix token, held by the agent platform), it signs in with that instead and opens no browser.",
177353
177362
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
177354
177363
  inputSchema: z4.object({
177355
177364
  target: z4.string().optional().describe("Serve target. Default: the CLI's default."),
@@ -177496,7 +177505,7 @@ ${log}` : ""}`, true);
177496
177505
  }
177497
177506
  ];
177498
177507
  }
177499
- var MAX_TEXT2, clip2, text7, json4, opt, sw, DIR2, LEARN, CHECK, LOCAL_WRITE, PUBLISH, READ_PLANE, APP_ID, RELEASE_ID, LOG_LEVEL, SINCE, LIMIT, PREVIEW_HINT, LOGIN_HINT, PATH_ARGS;
177508
+ var MAX_TEXT2, clip2, text7, json4, opt, sw, DIR2, LEARN, CHECK, LOCAL_WRITE, PUBLISH, READ_PLANE, APP_ID, RELEASE_ID, LOG_LEVEL, SINCE, LIMIT, PREVIEW_HINT, LOGIN_HINT, HELD_TOKEN_ROUTE, PATH_ARGS;
177500
177509
  var init_tools = __esm({
177501
177510
  "src/mcp/tools.ts"() {
177502
177511
  init_define_HHP_CATALOG();
@@ -177522,6 +177531,7 @@ var init_tools = __esm({
177522
177531
  LIMIT = z4.number().int().min(1).max(2e3).optional().describe("At most this many rows.");
177523
177532
  PREVIEW_HINT = "The preview is already running: open `url` in your built-in browser \u2014 Claude Code desktop's browser pane, Cursor's Browser tool, the Browser in Codex inside the ChatGPT desktop app, VS Code's integrated browser. Do not also start the `himi-preview` launch configuration: it serves the same port, and is the way to start a preview only when none is running. A terminal-only agent should show the owner `himi_render` PNGs instead. `board` (when present) is the build board on the same origin.";
177524
177533
  LOGIN_HINT = "Not signed in to the himi serve plane. Call himi_login: it opens a browser window where the user signs in to Wix (this server never sees the credential). A user with a terminal can run `himi login --browser` instead. Then retry.";
177534
+ HELD_TOKEN_ROUTE = "No browser on this machine (a sandbox, a cloud session)? An agent that holds the owner's Wix token signs in without one: run `printf '%s' \"$TOKEN\" | himi login --wix --wix-token-stdin` in a shell, or restart this MCP server with WIX_TOKEN set and call himi_login again. Never pass the token as a tool argument.";
177525
177535
  PATH_ARGS = ["dir", "parentDir", "file", "out", "manifest", "plan", "merge", "report", "outDir", "plist"];
177526
177536
  }
177527
177537
  });
@@ -177540,8 +177550,10 @@ function createLoginSession(deps) {
177540
177550
  start(target) {
177541
177551
  if (current.state === "pending") return Promise.resolve(current);
177542
177552
  const self2 = deps.selfCommand();
177543
- const args = [...self2.args, "login", "--browser", "--skip-version-check", ...target ? ["--target", target] : []];
177544
- const pending = { state: "pending", startedAt: deps.now() };
177553
+ const env = deps.env ?? process.env;
177554
+ const held = heldWixToken(env) !== void 0;
177555
+ const args = [...self2.args, "login", held ? "--wix" : "--browser", "--skip-version-check", ...target ? ["--target", target] : []];
177556
+ const pending = { state: "pending", startedAt: deps.now(), ...held ? { via: "wix" } : {} };
177545
177557
  current = pending;
177546
177558
  const out2 = [];
177547
177559
  const err = [];
@@ -177554,7 +177566,7 @@ function createLoginSession(deps) {
177554
177566
  };
177555
177567
  let child;
177556
177568
  try {
177557
- child = deps.spawn(self2.cmd, args, { stdio: ["ignore", "pipe", "pipe"], env: { ...process.env, HIMI_NO_UPDATE_CHECK: "1" } });
177569
+ child = deps.spawn(self2.cmd, args, { stdio: ["ignore", "pipe", "pipe"], env: { ...env, HIMI_NO_UPDATE_CHECK: "1" } });
177558
177570
  } catch (e2) {
177559
177571
  current = { state: "failed", error: `could not start himi login: ${e2.message}` };
177560
177572
  answer();
@@ -177576,7 +177588,7 @@ function createLoginSession(deps) {
177576
177588
  child.once("exit", (code) => {
177577
177589
  if (code === 0) {
177578
177590
  const r3 = lastJson([out2.join("")]) ?? {};
177579
- current = { state: "signed_in", account: r3.sub, scope: r3.scope, expiresAt: r3.exp };
177591
+ current = { state: "signed_in", account: r3.sub, scope: r3.scope, expiresAt: r3.exp, ...held ? { via: "wix" } : {} };
177580
177592
  signedInTarget = target;
177581
177593
  } else {
177582
177594
  const e2 = lastJson(err.join("").split("\n"));
@@ -177594,6 +177606,7 @@ var init_login = __esm({
177594
177606
  "src/mcp/login.ts"() {
177595
177607
  init_define_HHP_CATALOG();
177596
177608
  init_cli_bridge();
177609
+ init_wix_owner();
177597
177610
  defaultLoginDeps = {
177598
177611
  spawn: (cmd, args, opts) => nodeSpawn2(cmd, args, opts),
177599
177612
  now: () => Date.now()
@@ -146,9 +146,11 @@ see, so they stay commands a person runs. Publishing needs a sign-in first: `him
146
146
  browser sign-in for the user, or run `himi login --browser` in a terminal. Either way the server
147
147
  never asks for or sees a credential — the browser hands a scoped token to a separate `himi login`
148
148
  process, which stores it on this machine. On a server with no browser, `himi login --wix` is the
149
- exception to that guarantee: the CLI reads a Wix account API key from `WIX_API_KEY` in its own
150
- environment and sends it to the owner plane to mint the token, so keep that key a secret of the
151
- job, not of the MCP client. A tool input that starts with `-` is refused, so nothing
149
+ exception to that guarantee: the CLI reads the owner's held Wix token from `WIX_TOKEN`, or a Wix
150
+ account API key from `WIX_API_KEY`, in its own environment and sends it to the owner plane to mint
151
+ the token, so keep it a secret of the job, not of the MCP client. Started with `WIX_TOKEN` set,
152
+ `himi_login` runs that `himi login --wix` itself instead of opening a browser; the token still
153
+ never passes through a tool input or result. A tool input that starts with `-` is refused, so nothing
152
154
  can be passed through to a flag no tool offers.
153
155
 
154
156
  ## See the app inside your IDE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1635.0",
3
+ "version": "0.1636.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": [
@@ -72,5 +72,5 @@
72
72
  "artifactId": "himalaya-cli"
73
73
  }
74
74
  },
75
- "falconPackageHash": "2eb0ec4acfa6663413f592cc6ba30c8888d6a7e736cb32e119b1f8ca"
75
+ "falconPackageHash": "d6d901ed70b37adf6921bdd9925f1f9318912a9268e2a25230e73f95"
76
76
  }