webcake-storefront-mcp 1.37.0 → 1.38.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/README.md CHANGED
@@ -100,29 +100,42 @@ Pick **one**. Both hand your AI tool the full storefront toolkit. No coding.
100
100
 
101
101
  ### ① `npx` — runs on your machine (recommended)
102
102
 
103
- Zero install, always the latest version, needs Node.js 18+. **One line** configures your IDE:
103
+ Zero install, always the latest version, needs Node.js 18+. **One line** connects your account and configures your AI apps:
104
104
 
105
105
  ```bash
106
- # Interactive — pick your IDE(s) and paste your credentials
106
+ # Opens the browser — click Connect, your installed IDEs are configured (prod)
107
107
  npx -y webcake-storefront-mcp install
108
108
 
109
- # Non-interactive — configure every supported IDE at once
109
+ # Developers only — step by step: environment, login or token, IDE(s)
110
+ npx -y webcake-storefront-mcp install --dev
111
+
112
+ # Scripts and CI — every supported IDE, even ones not installed yet
110
113
  npx -y webcake-storefront-mcp install --ide all --token <token> --session <session-id>
111
114
 
112
115
  # Remove the server from every IDE config
113
116
  npx -y webcake-storefront-mcp uninstall
114
117
  ```
115
118
 
116
- Targets: `claude-desktop`, `claude-code`, `cursor`, `windsurf`, `vscode`, or `all`.
119
+ **`install` asks nothing.** It connects to production, opens your browser so you can click *Connect*, then adds the server
120
+ to every AI app it finds on this computer. Your other servers are kept, and any config file it changes is backed up next to
121
+ the original as `<file>.webcake-storefront-backup`. No AI app found? It says so and exits with an error: install one and run it again,
122
+ or name it with `--ide`.
123
+
124
+ Need staging or local? `--dev` opens the step-by-step wizard, or skip it with `--env staging` / `--env local`.
125
+
126
+ > **Installed with an older version?** Run `install` again. Older versions wrote VS Code's config under the wrong key, so the
127
+ > server never appeared there, and registered Claude Code for the current folder only.
128
+
129
+ Targets for `--ide`: `claude-desktop`, `claude-code`, `cursor`, `windsurf`, `vscode`, `codex`, `antigravity`, `gemini`, `cline`, `kiro`, `opencode`, or `all`.
117
130
  Just want to run the server (configure by hand)? `npx -y webcake-storefront-mcp`.
118
131
 
119
- ### ② Browser login — no token copy/paste
132
+ ### ② Reconnect your account — no token copy/paste
120
133
 
121
134
  ```bash
122
135
  npx -y webcake-storefront-mcp login
123
136
  ```
124
137
 
125
- Opens the builder's **connect page**; click *Connect* and your token + session are saved locally and picked up automatically.
138
+ `install` already does this the first time. Use `login` when your token expires: it opens the builder's **connect page**, you click *Connect*, and your token + session are saved locally and picked up automatically.
126
139
 
127
140
  ### Remote URL — self-hosted, nothing per-client to install
128
141
 
package/README.vi.md CHANGED
@@ -100,29 +100,41 @@ Chọn **một**. Cả hai đều trao cho AI toàn bộ bộ công cụ storefr
100
100
 
101
101
  ### ① `npx` — chạy trên máy bạn (khuyên dùng)
102
102
 
103
- Không cần cài, luôn mới nhất, cần Node.js 18+. **Một dòng** cấu hình IDE:
103
+ Không cần cài, luôn mới nhất, cần Node.js 18+. **Một dòng** kết nối tài khoản và cấu hình các ứng dụng AI:
104
104
 
105
105
  ```bash
106
- # Tương tác — chọn IDE và dán thông tin
106
+ # Mở trình duyệt — bấm Kết nối, các IDE trên máy được cấu hình tự động (prod)
107
107
  npx -y webcake-storefront-mcp install
108
108
 
109
- # Phi tương tác — cấu hình mọi IDE hỗ trợ cùng lúc
109
+ # Chỉ dành cho dev — từng bước: môi trường, đăng nhập hoặc token, IDE
110
+ npx -y webcake-storefront-mcp install --dev
111
+
112
+ # Script và CI — mọi IDE được hỗ trợ, kể cả IDE chưa cài
110
113
  npx -y webcake-storefront-mcp install --ide all --token <token> --session <session-id>
111
114
 
112
115
  # Gỡ khỏi mọi IDE
113
116
  npx -y webcake-storefront-mcp uninstall
114
117
  ```
115
118
 
116
- Hỗ trợ: `claude-desktop`, `claude-code`, `cursor`, `windsurf`, `vscode`, hoặc `all`.
119
+ **`install` không hỏi gì cả.** Lệnh kết nối tới production, mở trình duyệt để bạn bấm *Kết nối*, rồi thêm server vào mọi ứng dụng AI
120
+ tìm thấy trên máy. Các server khác của bạn được giữ nguyên, và file cấu hình nào bị đổi đều có bản sao lưu ngay cạnh, tên
121
+ `<file>.webcake-storefront-backup`. Không tìm thấy ứng dụng AI nào? Lệnh báo rõ và thoát với lỗi: hãy cài một ứng dụng rồi chạy lại, hoặc chỉ định bằng `--ide`.
122
+
123
+ Cần staging hoặc local? `--dev` mở các bước hỏi lần lượt, hoặc bỏ qua bằng `--env staging` / `--env local`.
124
+
125
+ > **Đã cài bằng bản cũ?** Hãy chạy lại `install`. Bản cũ ghi cấu hình VS Code sai khóa nên server không hiện trong VS Code, và chỉ đăng ký
126
+ > Claude Code cho đúng thư mục lúc chạy lệnh.
127
+
128
+ Giá trị cho `--ide`: `claude-desktop`, `claude-code`, `cursor`, `windsurf`, `vscode`, `codex`, `antigravity`, `gemini`, `cline`, `kiro`, `opencode`, hoặc `all`.
117
129
  Chỉ muốn chạy server (cấu hình tay)? `npx -y webcake-storefront-mcp`.
118
130
 
119
- ### ② Đăng nhập trình duyệt — khỏi copy token
131
+ ### ② Kết nối lại tài khoản — khỏi copy token
120
132
 
121
133
  ```bash
122
134
  npx -y webcake-storefront-mcp login
123
135
  ```
124
136
 
125
- Mở **trang kết nối** của builder; bấm *Kết nối* là token + session được lưu cục bộ và tự nạp.
137
+ `install` đã làm việc này ở lần đầu. Dùng `login` khi token hết hạn: lệnh mở **trang kết nối** của builder, bấm *Kết nối* là token + session được lưu cục bộ và tự nạp.
126
138
 
127
139
  ### Remote URL — tự host, mỗi client khỏi cài gì
128
140
 
@@ -4,7 +4,7 @@
4
4
  import { createServer } from "node:http";
5
5
  import { randomBytes } from "node:crypto";
6
6
  import { spawn, execFile } from "node:child_process";
7
- import { resolveSettings } from "../config.js";
7
+ import { DEFAULT_ENV, resolveSettings } from "../config.js";
8
8
  import { setConfig } from "../db.js";
9
9
  function parseArgs(argv) {
10
10
  const opts = { open: true };
@@ -132,7 +132,8 @@ function pathOf(url) {
132
132
  }
133
133
  export async function runLogin(argv) {
134
134
  const opts = parseArgs(argv);
135
- const settings = resolveSettings({ apiUrl: opts.apiUrl, appUrl: opts.appUrl });
135
+ // Pin the env: a stale saved api_url (an old staging login) must not pair with the prod connect page.
136
+ const settings = resolveSettings({ env: process.env.WEBCAKE_ENV || DEFAULT_ENV, apiUrl: opts.apiUrl, appUrl: opts.appUrl });
136
137
  const appUrl = settings.appUrl.replace(/\/$/, "");
137
138
  const apiUrl = settings.apiUrl.replace(/\/$/, "");
138
139
  const state = randomBytes(16).toString("hex");
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "1.38.0",
4
+ "d": "05/11/2026",
5
+ "type": "Changed",
6
+ "en": "The install command no longer asks any questions: it opens the prod browser connect page and configures every AI app it detects on the machine…",
7
+ "vi": "Lệnh install nay không còn hỏi gì: mở thẳng trang kết nối prod trên trình duyệt và ghi cấu hình vào mọi ứng dụng AI phát hiện được trên máy (Claude…"
8
+ },
2
9
  {
3
10
  "v": "1.37.0",
4
11
  "d": "04/11/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Added",
34
41
  "en": "New get_site_subscription tool reads a site's plan (current/default site): plan_name, status (active | expired | pending_payment | none),…",
35
42
  "vi": "Tool mới get_site_subscription đọc gói cước của site (mặc định site hiện tại): plan_name, status (active | expired | pending_payment | none),…"
36
- },
37
- {
38
- "v": "1.34.1",
39
- "d": "14/10/2026",
40
- "type": "Fixed",
41
- "en": "validate_page's \"not a container\" warning now only fires for true leaf elements (text, image, button, inputs, datasets, etc.); container-like…",
42
- "vi": "Cảnh báo \"not a container\" của validate_page nay chỉ xuất hiện với các element leaf thật sự (text, image, button, các input, dataset...); các…"
43
43
  }
44
44
  ]
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ Usage: npx -y webcake-storefront-mcp [command] [options]
8
8
 
9
9
  Commands:
10
10
  (none) start the stdio MCP server (use this in IDE configs)
11
- install configure the server in your IDE(s) — interactive (env + browser login/token) or via flags
11
+ install connect to prod via the browser and configure your IDE(s) (--dev: step-by-step wizard with env choice)
12
12
  uninstall remove the server from your IDE configs
13
13
  login grab your token via the browser (saved to the local config db)
14
14
  serve [--port N] run the remote Streamable-HTTP server (default 8787; or PORT env)
package/dist/install.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Installer: writes (or removes) this MCP server's entry in the config files of the
2
- // supported IDEs / agents. Flag-driven; falls back to a friendly numbered wizard on a
3
- // TTY. Mirrors webcake-landing-mcp's installer (numbered choices, colours, multi-IDE).
4
- import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ // supported IDEs / agents. A plain run connects to prod via the browser and
3
+ // configures the detected IDEs with no questions; --dev opens the numbered wizard. Mirrors webcake-landing-mcp's installer (numbered choices, colours, multi-IDE).
4
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import { homedir, platform } from "node:os";
6
6
  import { dirname, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
@@ -63,6 +63,8 @@ function parseArgs(argv) {
63
63
  o.launch = "npx";
64
64
  else if (a === "--local")
65
65
  o.launch = "local";
66
+ else if (a === "--dev")
67
+ o.dev = true;
66
68
  }
67
69
  return o;
68
70
  }
@@ -91,7 +93,20 @@ function buildEnv(opts) {
91
93
  return env;
92
94
  }
93
95
  // ── generic JSON config (Claude Desktop/Code, Cursor, Windsurf, VS Code, …) ───
94
- function mergeJson(file, launch, env) {
96
+ // These are the user's own files: an unchanged one isn't touched, a changed one keeps
97
+ // its previous version alongside so the install can be undone.
98
+ function writeConfig(file, next) {
99
+ if (existsSync(file)) {
100
+ if (readFileSync(file, "utf8") === next)
101
+ return;
102
+ const backup = `${file}.${NAME}-backup`;
103
+ copyFileSync(file, backup);
104
+ info(`Previous file saved as ${backup}`);
105
+ }
106
+ writeFileSync(file, next);
107
+ }
108
+ // VS Code is the one client that keeps servers under `servers` (and requires `type`).
109
+ function mergeJson(file, launch, env, key = "mcpServers") {
95
110
  mkdirSync(dirname(file), { recursive: true });
96
111
  let cfg = {};
97
112
  if (existsSync(file)) {
@@ -106,14 +121,15 @@ function mergeJson(file, launch, env) {
106
121
  }
107
122
  }
108
123
  }
109
- if (typeof cfg.mcpServers !== "object" || !cfg.mcpServers)
110
- cfg.mcpServers = {};
111
- cfg.mcpServers[NAME] = {
124
+ if (typeof cfg[key] !== "object" || !cfg[key])
125
+ cfg[key] = {};
126
+ cfg[key][NAME] = {
127
+ ...(key === "servers" ? { type: "stdio" } : {}),
112
128
  command: launch.command,
113
129
  args: launch.args,
114
130
  ...(Object.keys(env).length ? { env } : {}),
115
131
  };
116
- writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
132
+ writeConfig(file, JSON.stringify(cfg, null, 2) + "\n");
117
133
  return true;
118
134
  }
119
135
  // ── OpenCode config (its own shape, not mcpServers) ──────────────────────────
@@ -141,7 +157,7 @@ function mergeOpencodeJson(file, launch, env) {
141
157
  enabled: true,
142
158
  ...(Object.keys(env).length ? { environment: env } : {}),
143
159
  };
144
- writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
160
+ writeConfig(file, JSON.stringify(cfg, null, 2) + "\n");
145
161
  return true;
146
162
  }
147
163
  // ── TOML config (Codex) ──────────────────────────────────────────────────────
@@ -149,16 +165,15 @@ function configureCodex(launch, env) {
149
165
  const dir = join(HOME, ".codex");
150
166
  const cfg = join(dir, "config.toml");
151
167
  mkdirSync(dir, { recursive: true });
152
- const argsToml = launch.args.map((a) => `"${a}"`).join(", ");
168
+ const argsToml = launch.args.map((a) => JSON.stringify(a)).join(", ");
153
169
  const envParts = Object.entries(env)
154
- .map(([k, v]) => `"${k}" = "${v}"`)
170
+ .map(([k, v]) => `${JSON.stringify(k)} = ${JSON.stringify(v)}`)
155
171
  .join(", ");
156
172
  const envLine = envParts ? `env = { ${envParts} }\n` : "";
157
- const block = `\n[mcp_servers.${NAME}]\ncommand = "${launch.command}"\nargs = [${argsToml}]\n${envLine}`;
173
+ const block = `\n[mcp_servers.${NAME}]\ncommand = ${JSON.stringify(launch.command)}\nargs = [${argsToml}]\n${envLine}`;
158
174
  let content = existsSync(cfg) ? readFileSync(cfg, "utf8") : "# WebCake Storefront MCP\n";
159
175
  content = content.replace(new RegExp(`\\n?\\[mcp_servers\\.${NAME}\\][\\s\\S]*?(?=\\n\\[|$)`), "");
160
- content = content.trimEnd() + "\n" + block;
161
- writeFileSync(cfg, content);
176
+ writeConfig(cfg, content.trimEnd() + "\n" + block);
162
177
  }
163
178
  // ── IDE config-file locations ────────────────────────────────────────────────
164
179
  function claudeDesktopPath() {
@@ -188,10 +203,7 @@ function vscodeUserDir() {
188
203
  const mac = join(HOME, "Library", "Application Support", "Code", "User");
189
204
  if (existsSync(mac))
190
205
  return mac;
191
- const lin = join(HOME, ".config", "Code", "User");
192
- if (existsSync(lin))
193
- return lin;
194
- return join(HOME, ".vscode");
206
+ return join(HOME, ".config", "Code", "User");
195
207
  }
196
208
  const vscodeUserPath = () => join(vscodeUserDir(), "mcp.json");
197
209
  const cursorPath = () => join(HOME, ".cursor", "mcp.json");
@@ -206,13 +218,31 @@ function hasClaudeCli() {
206
218
  const probe = spawnSync(PLAT === "win32" ? "where" : "which", ["claude"], { stdio: "ignore" });
207
219
  return probe.status === 0;
208
220
  }
221
+ // Installed = its config dir exists (Claude Code: also the CLI on PATH), so a normal
222
+ // install needs no IDE question and never creates config for an app the user lacks.
223
+ function detectIdes() {
224
+ const marks = {
225
+ "claude-desktop": dirname(claudeDesktopPath()),
226
+ "claude-code": claudeJsonPath(),
227
+ cursor: join(HOME, ".cursor"),
228
+ windsurf: join(HOME, ".codeium", "windsurf"),
229
+ augment: vscodeUserDir(),
230
+ codex: join(HOME, ".codex"),
231
+ antigravity: dirname(antigravityPath()),
232
+ gemini: geminiPath(),
233
+ cline: dirname(dirname(clinePath())),
234
+ kiro: join(HOME, ".kiro"),
235
+ opencode: dirname(opencodePath()),
236
+ };
237
+ return Object.keys(marks).filter((id) => existsSync(marks[id]) || (id === "claude-code" && hasClaudeCli()));
238
+ }
209
239
  // ── per-IDE configure ────────────────────────────────────────────────────────
210
240
  function configureClaudeCode(launch, env) {
211
241
  info("Claude Code…");
212
242
  if (hasClaudeCli()) {
213
243
  spawnSync("claude", ["mcp", "remove", NAME], { stdio: "ignore" });
214
244
  const envFlags = Object.entries(env).flatMap(([k, v]) => ["-e", `${k}=${v}`]);
215
- const r = spawnSync("claude", ["mcp", "add", NAME, ...envFlags, "--", launch.command, ...launch.args], {
245
+ const r = spawnSync("claude", ["mcp", "add", "--scope", "user", NAME, ...envFlags, "--", launch.command, ...launch.args], {
216
246
  stdio: "inherit",
217
247
  });
218
248
  if (r.status === 0) {
@@ -243,7 +273,7 @@ function configureWindsurf(launch, env) {
243
273
  }
244
274
  function configureAugment(launch, env) {
245
275
  info("Augment / VS Code…");
246
- if (mergeJson(vscodeUserPath(), launch, env))
276
+ if (mergeJson(vscodeUserPath(), launch, env, "servers"))
247
277
  ok(`VS Code configured (${vscodeUserPath()})`);
248
278
  }
249
279
  function configureCodexIde(launch, env) {
@@ -329,10 +359,17 @@ function normalizeIdes(ides) {
329
359
  function runConfigure(ides, launch, env) {
330
360
  for (const id of ides) {
331
361
  const conf = CONFIGURATORS[id];
332
- if (conf)
333
- conf.run(launch, env);
334
- else
362
+ if (!conf) {
335
363
  warn(`Unknown IDE: ${id}`);
364
+ continue;
365
+ }
366
+ // One broken client must not leave the others unconfigured.
367
+ try {
368
+ conf.run(launch, env);
369
+ }
370
+ catch (e) {
371
+ warn(`${conf.label} skipped: ${e?.message ?? e}`);
372
+ }
336
373
  }
337
374
  }
338
375
  // ── uninstall ────────────────────────────────────────────────────────────────
@@ -341,8 +378,10 @@ function removeFromJson(file) {
341
378
  return;
342
379
  try {
343
380
  const cfg = JSON.parse(readFileSync(file, "utf8"));
344
- if (cfg.mcpServers && cfg.mcpServers[NAME]) {
345
- delete cfg.mcpServers[NAME];
381
+ const holders = [cfg.mcpServers, cfg.servers].filter((s) => s && s[NAME]);
382
+ if (holders.length) {
383
+ for (const s of holders)
384
+ delete s[NAME];
346
385
  writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
347
386
  ok(`Cleaned ${file}`);
348
387
  }
@@ -362,6 +401,7 @@ function uninstall() {
362
401
  cursorPath(),
363
402
  windsurfPath(),
364
403
  vscodeUserPath(),
404
+ join(HOME, ".vscode", "mcp.json"), // older versions wrote here; nothing reads it
365
405
  antigravityPath(),
366
406
  geminiPath(),
367
407
  clinePath(),
@@ -392,18 +432,19 @@ function uninstall() {
392
432
  log(`\n${c.green}${c.bold} ✓ Removed. Restart your IDE.${c.reset}\n`);
393
433
  }
394
434
  /**
395
- * Interactive numbered wizard (TTY only): pick environment → authenticate (browser
396
- * login, recommended, or paste a token) → pick IDEs by number. Returns whether a
397
- * browser login completed (token then lives in the local config db, so it is NOT
435
+ * Default: prod, straight to the browser connect page, every detected IDE — never a
436
+ * question, TTY or not (only a scripted --ide run without a TTY skips the browser).
437
+ * --dev on a TTY: the numbered wizard (environment → login or pasted token → IDEs). Returns whether a browser
438
+ * login completed (token then lives in the local config db, so it is NOT
398
439
  * written into the IDE env block) and a short auth note for the summary.
399
440
  */
400
441
  async function promptInteractive(opts) {
401
442
  let loggedIn = false;
402
443
  let authNote = opts.token ? "token (from flag)" : "";
403
- if (!process.stdin.isTTY || !process.stdout.isTTY)
404
- return { loggedIn, authNote };
444
+ const tty = process.stdin.isTTY && process.stdout.isTTY;
445
+ const wizard = opts.dev && tty;
405
446
  // 1) Environment — one choice sets the API + app base URLs (default prod).
406
- if (!opts.env && !process.env.WEBCAKE_ENV) {
447
+ if (wizard && !opts.env && !process.env.WEBCAKE_ENV) {
407
448
  log(`\n${c.bold}1) Environment${c.reset} ${c.gray}(sets the WebCake API + app URLs)${c.reset}`);
408
449
  log(` ${c.bold}1${c.reset}) prod ${c.gray}api.storefront.webcake.io${c.reset} ${c.gray}(default)${c.reset}`);
409
450
  log(` ${c.bold}2${c.reset}) staging ${c.gray}api.staging.storecake.io${c.reset}`);
@@ -411,15 +452,18 @@ async function promptInteractive(opts) {
411
452
  const pick = (await ask(` ${c.cyan}Select [1=prod, Enter to accept]:${c.reset} `)).trim();
412
453
  opts.env = { "1": "prod", "2": "staging", "3": "local" }[pick] ?? "prod";
413
454
  }
414
- if (opts.env)
415
- process.env.WEBCAKE_ENV = opts.env; // so the login flow opens the right app
455
+ opts.env ||= process.env.WEBCAKE_ENV || "prod";
456
+ process.env.WEBCAKE_ENV = opts.env; // so the login flow opens the right app
416
457
  // 2) Authentication — browser login (recommended), paste a token, or skip.
417
- if (!opts.token && !process.env.WEBCAKE_TOKEN) {
418
- log(`\n${c.bold}2) Connect your WebCake account${c.reset}`);
419
- log(` ${c.bold}1${c.reset}) Log in via browser ${c.gray}(recommended — opens WebCake, saves a token)${c.reset}`);
420
- log(` ${c.bold}2${c.reset}) Paste a token manually`);
421
- log(` ${c.bold}3${c.reset}) Skip for now ${c.gray}(set credentials later with the login command)${c.reset}`);
422
- const choice = (await ask(` ${c.cyan}Select [1]:${c.reset} `)).trim() || "1";
458
+ if (!opts.token && !process.env.WEBCAKE_TOKEN && (tty || !opts.ides.length)) {
459
+ let choice = "1";
460
+ if (wizard) {
461
+ log(`\n${c.bold}2) Connect your WebCake account${c.reset}`);
462
+ log(` ${c.bold}1${c.reset}) Log in via browser ${c.gray}(recommended — opens WebCake, saves a token)${c.reset}`);
463
+ log(` ${c.bold}2${c.reset}) Paste a token manually`);
464
+ log(` ${c.bold}3${c.reset}) Skip for now ${c.gray}(set credentials later with the login command)${c.reset}`);
465
+ choice = (await ask(` ${c.cyan}Select [1]:${c.reset} `)).trim() || "1";
466
+ }
423
467
  if (choice === "1") {
424
468
  info("Opening your browser to log in…");
425
469
  try {
@@ -428,13 +472,15 @@ async function promptInteractive(opts) {
428
472
  authNote = "browser login (saved to local config)";
429
473
  }
430
474
  catch (e) {
431
- warn(`Login didn't complete (${e?.message ?? e}). Paste a token now, or run \`npx -y ${PKG} login\` later.`);
432
- const t = (await ask(` ${c.cyan}Token (paste JWT, or Enter to skip):${c.reset} `)).trim();
433
- if (t)
434
- opts.token = t;
435
- const s = t ? (await ask(` ${c.cyan}Session id (x-session-id):${c.reset} `)).trim() : "";
436
- if (s)
437
- opts.sessionId = s;
475
+ warn(`Login didn't complete (${e?.message ?? e}). Run \`npx -y ${PKG} login\` to connect later.`);
476
+ if (wizard) {
477
+ const t = (await ask(` ${c.cyan}Token (paste JWT, or Enter to skip):${c.reset} `)).trim();
478
+ if (t)
479
+ opts.token = t;
480
+ const s = t ? (await ask(` ${c.cyan}Session id (x-session-id):${c.reset} `)).trim() : "";
481
+ if (s)
482
+ opts.sessionId = s;
483
+ }
438
484
  }
439
485
  }
440
486
  else if (choice === "2") {
@@ -450,7 +496,9 @@ async function promptInteractive(opts) {
450
496
  if (!authNote)
451
497
  authNote = opts.token || process.env.WEBCAKE_TOKEN ? "token" : "none — log in later";
452
498
  // 3) IDEs to configure — numbered, comma-separated (e.g. 1,2 or the "All" number).
453
- if (!opts.ides.length) {
499
+ if (!opts.ides.length && !wizard)
500
+ opts.ides = detectIdes();
501
+ else if (!opts.ides.length) {
454
502
  log(`\n${c.bold}3) Which IDE(s) / agent(s) to configure?${c.reset}`);
455
503
  IDE_ORDER.forEach((id, i) => {
456
504
  const n = `${c.bold}${String(i + 1).padStart(2)}${c.reset}`;
@@ -483,13 +531,13 @@ export async function runInstaller(argv) {
483
531
  // promptInteractive returns early without touching opts.ides.
484
532
  const ides = normalizeIdes(opts.ides);
485
533
  if (!ides.length) {
486
- if (!process.stdin.isTTY) {
487
- warn("No --ide given (or not a TTY). Nothing to configure.");
488
- log(`${c.gray} Try: npx -y ${PKG} install --ide all${c.reset}\n`);
489
- }
490
- else {
534
+ if (opts.dev) {
491
535
  warn("No IDE selected — nothing to configure.");
536
+ return;
492
537
  }
538
+ warn("No AI app found on this computer (Claude, Cursor, VS Code…).");
539
+ log(`${c.gray} Install one and run this again, or name it: npx -y ${PKG} install --ide <name>${c.reset}\n`);
540
+ process.exitCode = 1;
493
541
  return;
494
542
  }
495
543
  const launch = resolveLaunch(opts);
@@ -0,0 +1,611 @@
1
+ /**
2
+ * Liquid-glass skin + the 3D "how MCP works" scene for the marketing page.
3
+ *
4
+ * - GLASS_CSS is appended to the page's <style>, so it wins over the base rules.
5
+ * - sceneHtml(lang) is plain, readable steps; without WebGL (or if the CDN fails) that
6
+ * list stays on its own and nothing is lost.
7
+ * - SCENE_JS loads three.js from jsDelivr only when the section nears the viewport, so
8
+ * the page itself stays one light HTML response. T (0..5) is the single timeline:
9
+ * every visual is a pure function of T, so clicking a step can jump either way.
10
+ *
11
+ * Kept identical in webcake-storefront-mcp and webcake-landing-mcp except COPY/ON_ACCENT.
12
+ * No backticks or dollar-brace inside SCENE_JS: it is pasted into a template literal.
13
+ */
14
+ const THREE_URL = "https://cdn.jsdelivr.net/npm/three@0.186.1/build/three.module.min.js";
15
+ const ON_ACCENT = "#ffffff"; // text on the brand button
16
+ const TEXT_ACCENT = "#0a5f46"; // brand-coloured text on light glass, dark enough for 4.5:1
17
+ const COPY = {
18
+ "vi": {
19
+ "aria": "Cách MCP hoạt động, từng bước",
20
+ "pause": "Tạm dừng",
21
+ "resume": "Tiếp tục",
22
+ "replay": "Xem lại",
23
+ "tags": [
24
+ {
25
+ "t": "Bạn nói",
26
+ "s": "mô tả trang bạn muốn"
27
+ },
28
+ {
29
+ "t": "Trợ lý AI",
30
+ "s": "Claude · Cursor · Windsurf…"
31
+ },
32
+ {
33
+ "t": "WebCake MCP",
34
+ "s": "lưu &amp; kiểm tra trang"
35
+ },
36
+ {
37
+ "t": "Cửa hàng của bạn",
38
+ "s": "trang web thật, live"
39
+ }
40
+ ],
41
+ "steps": [
42
+ {
43
+ "t": "Bạn nói điều mình muốn",
44
+ "d": "Nhắn trong Claude, Cursor… như nhắn cho đồng nghiệp: “Tạo trang sản phẩm áo thun có nút mua ngay.”"
45
+ },
46
+ {
47
+ "t": "AI tìm đúng công cụ qua MCP",
48
+ "d": "MCP là cầu nối cho AI biết WebCake làm được những gì, như thêm sản phẩm hay tạo trang, và phải yêu cầu thế nào."
49
+ },
50
+ {
51
+ "t": "WebCake làm bằng tài khoản của bạn",
52
+ "d": "Bạn chỉ cần bấm Kết nối một lần. AI không cần biết mật khẩu của bạn."
53
+ },
54
+ {
55
+ "t": "Trang được dựng lên từng phần",
56
+ "d": "Sản phẩm, nội dung, nút mua lần lượt được lưu vào cửa hàng. Đây là trang thật, bạn vẫn sửa được trong trình dựng."
57
+ },
58
+ {
59
+ "t": "AI gửi link cho bạn xem",
60
+ "d": "Chưa ưng chỗ nào thì nói tiếp, AI sửa đúng chỗ đó rồi gửi lại."
61
+ }
62
+ ]
63
+ },
64
+ "en": {
65
+ "aria": "How MCP works, step by step",
66
+ "pause": "Pause",
67
+ "resume": "Resume",
68
+ "replay": "Replay",
69
+ "tags": [
70
+ {
71
+ "t": "You describe",
72
+ "s": "what you want the page to be"
73
+ },
74
+ {
75
+ "t": "AI assistant",
76
+ "s": "Claude · Cursor · Windsurf…"
77
+ },
78
+ {
79
+ "t": "WebCake MCP",
80
+ "s": "saves &amp; checks the page"
81
+ },
82
+ {
83
+ "t": "Your store",
84
+ "s": "a real, live page"
85
+ }
86
+ ],
87
+ "steps": [
88
+ {
89
+ "t": "You say what you want",
90
+ "d": "Type in Claude, Cursor… like messaging a colleague: “Build a T-shirt product page with a buy button.”"
91
+ },
92
+ {
93
+ "t": "The AI finds the right tool through MCP",
94
+ "d": "MCP is the bridge that tells the AI what WebCake can do, like adding a product or creating a page, and how to ask for it."
95
+ },
96
+ {
97
+ "t": "WebCake does the work on your account",
98
+ "d": "You only click Connect once. The AI never needs your password."
99
+ },
100
+ {
101
+ "t": "The page goes up section by section",
102
+ "d": "Products, content and the buy button are saved to your store one by one. It is a real page you can keep editing yourself."
103
+ },
104
+ {
105
+ "t": "The AI sends you the link",
106
+ "d": "Not quite right? Say so, and the AI changes just that part and sends it back."
107
+ }
108
+ ]
109
+ }
110
+ };
111
+ export function sceneHtml(lang) {
112
+ const c = COPY[lang];
113
+ return `<section class="sc" id="scene" aria-label="${c.aria}" data-pause="${c.pause}" data-resume="${c.resume}" data-replay="${c.replay}">
114
+ <div class="sc-stage" aria-hidden="true">
115
+ <canvas></canvas>
116
+ ${c.tags.map((t) => `<span class="sc-tag"><b>${t.t}</b><small>${t.s}</small></span>`).join("")}
117
+ </div>
118
+ <div class="sc-panel glass">
119
+ <ol class="sc-steps">
120
+ ${c.steps
121
+ .map((s, i) => `<li${i === 0 ? ' class="cur"' : ""}><button type="button" class="sc-step"><span class="sc-n">${i + 1}</span><span>${s.t}</span></button><div class="sc-dw"><p>${s.d}</p></div></li>`)
122
+ .join("\n ")}
123
+ </ol>
124
+ <button type="button" class="sc-ctl" hidden></button>
125
+ </div>
126
+ </section>`;
127
+ }
128
+ export const GLASS_CSS = `
129
+ /* ── Liquid glass ─────────────────────────────────────────────────────────
130
+ The page-builder grid and colour field sit behind everything, so the glass has
131
+ something to bend. Refraction itself is added by SCENE_JS on Chromium; other
132
+ browsers keep the blur + bright rim, which is still legible glass. */
133
+ :root{--on-g:${ON_ACCENT};--btn-a:color-mix(in srgb,var(--g) 94%,#000);--btn-b:color-mix(in srgb,var(--g) 84%,#000);--g7:${TEXT_ACCENT};--ic-fg:${TEXT_ACCENT};--ink:#0d1c15;--mut:#3b4942;--glass:rgba(255,255,255,.74);--glass-strong:rgba(255,255,255,.9);
134
+ --rim:rgba(255,255,255,.9);--rim-soft:rgba(255,255,255,.4);--glow:rgba(255,255,255,.55);--amber:#f5a524;
135
+ --drop:0 1px 1px rgba(16,40,30,.04),0 22px 44px -26px rgba(16,40,30,.38);--navbg:transparent}
136
+ @media(prefers-color-scheme:dark){:root:not([data-theme="light"]){--on-g:#04241a;--btn-a:var(--g);--btn-b:color-mix(in srgb,var(--g) 94%,#000);--mut:#bccbc3;--glass:rgba(17,25,21,.76);--glass-strong:rgba(14,21,18,.9);
137
+ --rim:rgba(255,255,255,.24);--rim-soft:rgba(255,255,255,.08);--glow:rgba(255,255,255,.1);
138
+ --drop:0 1px 1px rgba(0,0,0,.3),0 24px 48px -26px rgba(0,0,0,.85)}}
139
+ :root[data-theme="dark"]{--on-g:#04241a;--btn-a:var(--g);--btn-b:color-mix(in srgb,var(--g) 94%,#000);--mut:#bccbc3;--glass:rgba(17,25,21,.76);--glass-strong:rgba(14,21,18,.9);
140
+ --rim:rgba(255,255,255,.24);--rim-soft:rgba(255,255,255,.08);--glow:rgba(255,255,255,.1);
141
+ --drop:0 1px 1px rgba(0,0,0,.3),0 24px 48px -26px rgba(0,0,0,.85)}
142
+ body::after{content:"";position:fixed;inset:0;z-index:-2;pointer-events:none;
143
+ background-image:linear-gradient(var(--line) 1px,transparent 1px),linear-gradient(90deg,var(--line) 1px,transparent 1px);
144
+ background-size:46px 46px;-webkit-mask:none;mask:none;opacity:.45}
145
+ .blobs b{filter:blur(80px);opacity:.26}
146
+ .blobs b:nth-child(1){width:760px;height:760px;right:4%;top:-220px}
147
+ .blobs b:nth-child(2){width:680px;height:680px;left:6%;bottom:-200px}
148
+ .blobs b:nth-child(3){width:520px;height:520px;left:30%;top:30%;opacity:.16;
149
+ background:radial-gradient(circle,var(--amber),transparent 70%);animation:drift1 56s ease-in-out infinite}
150
+ .glass,.iconbtn,.langsw,.btn.ghost,.btn.ghost:hover,.nav{background-color:var(--glass);border:1px solid var(--rim-soft);
151
+ -webkit-backdrop-filter:blur(20px) saturate(175%);backdrop-filter:blur(20px) saturate(175%);
152
+ box-shadow:inset 0 1px 0 var(--rim),inset 0 -1px 0 var(--rim-soft),var(--drop)}
153
+ .glass{border-radius:22px;background-image:none}
154
+ .glass.card:hover,.uses li.glass:hover,.glass:hover{transform:none;border-color:var(--rim-soft);
155
+ box-shadow:inset 0 1px 0 var(--rim),inset 0 -1px 0 var(--rim-soft),var(--drop)}
156
+ /* The highlight follows the pointer (--mx/--my from SCENE_JS): light moving on a surface. */
157
+ @media(hover:hover){.glass:hover{background-image:radial-gradient(280px circle at var(--mx,50%) var(--my,0%),var(--glow),transparent 72%)}}
158
+ .tip{background:var(--glass);border-color:var(--rim-soft);border-radius:16px}
159
+ /* A long command scrolls inside its own box instead of stretching the steps past the phone screen. */
160
+ .steps{grid-template-columns:minmax(0,1fr)}
161
+ .btn{color:var(--on-g);border-radius:999px;border:0;background:linear-gradient(180deg,var(--btn-a),var(--btn-b));
162
+ box-shadow:inset 0 1px 0 rgba(255,255,255,.45),inset 0 -8px 12px -8px rgba(0,0,0,.28),0 12px 24px -14px var(--g)}
163
+ .btn:hover{transform:none;filter:brightness(1.07);background:linear-gradient(180deg,var(--btn-a),var(--btn-b))}
164
+ .btn:active{transform:scale(.97)}
165
+ .btn.ghost,.btn.ghost:hover{background-image:none;color:var(--ink);filter:none}
166
+ .btn:focus-visible,.langsw:focus-visible,.iconbtn:focus-visible,.nav a:focus-visible{outline:2px solid var(--g);outline-offset:2px}
167
+ .iconbtn{border-radius:50%}
168
+ .new{color:var(--on-g);background:var(--btn-a);animation:none}
169
+ .nav{position:sticky;top:10px;margin:18px 0 6px;padding:6px;border-radius:999px}
170
+ /* ── The scene: wider than the text column, panel floats over the canvas ── */
171
+ .sc{position:relative;width:min(1180px,calc(100vw - 32px));margin-left:calc(50% - min(590px,calc(50vw - 16px)))}
172
+ .sc-stage{display:none;position:relative;overflow:hidden;height:clamp(440px,46vw,600px)}
173
+ .js .sc.on .sc-stage{display:block}
174
+ .sc-stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
175
+ .sc-tag{position:absolute;left:0;top:0;padding:5px 13px 6px;border-radius:14px;text-align:center;white-space:nowrap;line-height:1.25;
176
+ color:var(--ink);background:var(--glass-strong);box-shadow:inset 0 1px 0 var(--rim),0 8px 18px -12px rgba(0,0,0,.5);
177
+ -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);pointer-events:none;will-change:transform;transition:color .25s ease}
178
+ .sc-tag b{display:block;font-size:.84rem}
179
+ .sc-tag small{display:block;font-size:.72rem;font-weight:500;color:var(--mut)}
180
+ .sc-tag.on b{color:var(--g7)}
181
+ .sc-panel{padding:12px;margin-top:12px}
182
+ @media(min-width:1040px){.js .sc.on .sc-panel{position:absolute;left:0;top:26px;width:372px;margin:0;z-index:2}}
183
+ @media(max-width:1039px){.sc{width:100%;margin-left:0}}
184
+ .sc-steps{list-style:none;margin:0;padding:0;display:grid;gap:2px}
185
+ .sc-step{display:flex;gap:11px;align-items:center;width:100%;padding:8px;border:0;border-radius:13px;background:none;color:inherit;
186
+ font:inherit;font-weight:700;font-size:.95rem;line-height:1.3;text-align:left;cursor:pointer;transition:background .15s ease,color .15s ease}
187
+ .sc-step:hover{background:rgba(127,160,140,.14)}
188
+ .sc-step:focus-visible,.sc-ctl:focus-visible{outline:2px solid var(--g);outline-offset:1px}
189
+ html:not(.js) .sc-step,.sc.off .sc-step{pointer-events:none}
190
+ .sc-n{flex:0 0 auto;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;font-size:.84rem;font-weight:800;
191
+ color:var(--ic-fg);background:rgba(127,160,140,.18);transition:background .2s ease,color .2s ease}
192
+ .js .sc.on .cur .sc-step{color:var(--g7)}
193
+ .js .sc.on .cur .sc-n{background:var(--btn-a);color:var(--on-g)}
194
+ .sc-dw{display:grid;grid-template-rows:1fr;transition:grid-template-rows .3s cubic-bezier(.2,.7,.2,1)}
195
+ .js .sc.on li:not(.cur) .sc-dw{grid-template-rows:0fr}
196
+ .sc-dw p{overflow:hidden;min-height:0;margin:0;padding-left:47px;padding-right:8px;font-size:.9rem;color:var(--mut)}
197
+ .sc-dw p::after{content:"";display:block;height:8px}
198
+ .sc-ctl{display:block;margin:4px 8px 2px auto;padding:5px 10px;border:0;border-radius:999px;background:none;cursor:pointer;
199
+ color:var(--g7);font:inherit;font-size:.84rem;font-weight:700}
200
+ .sc-ctl:hover{background:rgba(127,160,140,.14)}
201
+ .sc-ctl[hidden]{display:none}
202
+ @media(max-width:639px){.sc-stage{height:520px}.sc-tag small{font-size:.68rem}.nav{margin-left:0;margin-right:0}}
203
+ @media(prefers-reduced-motion:reduce){.sc-dw,.sc-step,.sc-n,.sc-tag{transition:none}}
204
+ @media(prefers-reduced-transparency:reduce){
205
+ .glass,.iconbtn,.langsw,.btn.ghost,.btn.ghost:hover,.nav,.tip,.sc-tag{background-color:var(--card);background-image:none;
206
+ -webkit-backdrop-filter:none;backdrop-filter:none}
207
+ }
208
+ @supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
209
+ .glass,.iconbtn,.langsw,.btn.ghost,.btn.ghost:hover,.nav,.tip,.sc-tag{background-color:var(--card)}
210
+ }
211
+ `;
212
+ export const SCENE_JS = String.raw `
213
+ (function(){
214
+ var html=document.documentElement;
215
+ function mq(q){return !!(window.matchMedia&&matchMedia(q).matches);}
216
+
217
+ // ── Glass light: the highlight follows the pointer ──
218
+ document.addEventListener('pointermove',function(e){
219
+ var g=e.target&&e.target.closest&&e.target.closest('.glass');
220
+ if(!g)return;
221
+ var r=g.getBoundingClientRect();
222
+ g.style.setProperty('--mx',(e.clientX-r.left)+'px');
223
+ g.style.setProperty('--my',(e.clientY-r.top)+'px');
224
+ },{passive:true});
225
+
226
+ // ── Glass refraction: an edge-lens displacement map per element ──
227
+ // Only Chromium applies an SVG filter inside backdrop-filter; userAgentData is Chromium-only.
228
+ var chromium=!!(navigator.userAgentData&&navigator.userAgentData.brands&&navigator.userAgentData.brands.some(function(b){return /Chromium/.test(b.brand);}));
229
+ function lens(el,n){
230
+ var NS='http://www.w3.org/2000/svg',id='lg-lens-'+n;
231
+ var svg=document.createElementNS(NS,'svg');
232
+ svg.setAttribute('aria-hidden','true');svg.style.cssText='position:absolute;width:0;height:0';
233
+ var f=document.createElementNS(NS,'filter');
234
+ f.setAttribute('id',id);f.setAttribute('filterUnits','userSpaceOnUse');f.setAttribute('color-interpolation-filters','sRGB');
235
+ f.setAttribute('x','0');f.setAttribute('y','0');
236
+ var im=document.createElementNS(NS,'feImage');im.setAttribute('x','0');im.setAttribute('y','0');im.setAttribute('preserveAspectRatio','none');im.setAttribute('result','map');
237
+ var d=document.createElementNS(NS,'feDisplacementMap');d.setAttribute('in','SourceGraphic');d.setAttribute('in2','map');
238
+ d.setAttribute('xChannelSelector','R');d.setAttribute('yChannelSelector','G');d.setAttribute('scale','46');
239
+ f.appendChild(im);f.appendChild(d);svg.appendChild(f);document.body.appendChild(svg);
240
+ var pw=0,ph=0;
241
+ function draw(){
242
+ var w=el.offsetWidth,h=el.offsetHeight;
243
+ if(!w||!h||(w===pw&&h===ph))return;
244
+ pw=w;ph=h;
245
+ var cw=Math.ceil(w/2),ch=Math.ceil(h/2),cv=document.createElement('canvas');cv.width=cw;cv.height=ch;
246
+ var c=cv.getContext('2d'),img=c.createImageData(cw,ch),D=img.data;
247
+ var r=Math.min(parseFloat(getComputedStyle(el).borderTopLeftRadius)||0,h/2)/2,band=Math.min(16,ch/2);
248
+ for(var y=0;y<ch;y++)for(var x=0;x<cw;x++){
249
+ // Rounded-rect signed distance: strongest bend at the rim, none past the band.
250
+ var ax=x+.5-cw/2,ay=y+.5-ch/2,qx=Math.abs(ax)-cw/2+r,qy=Math.abs(ay)-ch/2+r;
251
+ var dist=Math.hypot(Math.max(qx,0),Math.max(qy,0))+Math.min(Math.max(qx,qy),0)-r;
252
+ var t=Math.max(0,Math.min(1,1+dist/band)),m=t*t,nx=0,ny=0;
253
+ if(qx>0&&qy>0){var l=Math.hypot(qx,qy)||1;nx=qx/l;ny=qy/l;}else if(qx>qy){nx=1;}else{ny=1;}
254
+ nx*=ax<0?-1:1;ny*=ay<0?-1:1;
255
+ var i=(y*cw+x)*4;
256
+ D[i]=128-nx*m*127;D[i+1]=128-ny*m*127;D[i+2]=128;D[i+3]=255;
257
+ }
258
+ c.putImageData(img,0,0);
259
+ f.setAttribute('width',w);f.setAttribute('height',h);
260
+ im.setAttribute('width',w);im.setAttribute('height',h);im.setAttribute('href',cv.toDataURL());
261
+ }
262
+ draw();
263
+ var bf='url(#'+id+') blur(14px) saturate(160%)';
264
+ el.style.backdropFilter=bf;
265
+ if(window.ResizeObserver)new ResizeObserver(draw).observe(el);
266
+ }
267
+ if(chromium&&!mq('(prefers-reduced-transparency: reduce)')){
268
+ var lensEls=document.querySelectorAll('.nav,.sc-panel');
269
+ for(var li=0;li<lensEls.length;li++)lens(lensEls[li],li);
270
+ }
271
+
272
+ // ── The scene ──
273
+ var root=document.getElementById('scene');
274
+ if(!root||!window.IntersectionObserver)return;
275
+ function hasGL(){try{return !!document.createElement('canvas').getContext('webgl2');}catch(e){return false;}}
276
+ if(!hasGL()){root.classList.add('off');return;}
277
+ root.classList.add('on'); // reserved now so nothing jumps when three.js arrives
278
+ var stage=root.querySelector('.sc-stage'),canvas=root.querySelector('canvas'),ctl=root.querySelector('.sc-ctl');
279
+ var tags=[].slice.call(root.querySelectorAll('.sc-tag')),items=[].slice.call(root.querySelectorAll('.sc-steps li'));
280
+ var loader=new IntersectionObserver(function(es){
281
+ if(!es[0].isIntersecting)return;
282
+ loader.disconnect();
283
+ import('${THREE_URL}').then(start).catch(function(){root.classList.remove('on');root.classList.add('off');});
284
+ },{rootMargin:'320px'});
285
+ loader.observe(root);
286
+
287
+ function start(THREE){
288
+ var reduced=mq('(prefers-reduced-motion: reduce)');
289
+ var lite=(navigator.hardwareConcurrency||8)<=4||window.innerWidth<640;
290
+ var STEP=3.2,T=reduced?5:0,hold=5,playing=false,visible=false,touched=false,raf=0,last=0,curStep=-1;
291
+ var css=getComputedStyle(html),ACCENT=new THREE.Color((css.getPropertyValue('--g')||'#1DB954').trim()),AMBER=new THREE.Color(0xf5a524);
292
+
293
+ var renderer=new THREE.WebGLRenderer({canvas:canvas,antialias:true,alpha:true});
294
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio||1,lite?1.5:2));
295
+ renderer.toneMapping=THREE.ACESFilmicToneMapping;
296
+ var scene=new THREE.Scene(),camera=new THREE.PerspectiveCamera(34,2,.1,60);
297
+ camera.position.set(0,0,11);
298
+
299
+ // Soft studio lighting, built here so there is no HDR file to download.
300
+ var envScene=new THREE.Scene();
301
+ function softbox(hex,power,w,h,p){
302
+ var c=new THREE.Color(hex).multiplyScalar(power);
303
+ var m=new THREE.Mesh(new THREE.PlaneGeometry(w,h),new THREE.MeshBasicMaterial({color:c,side:THREE.DoubleSide}));
304
+ m.position.set(p[0],p[1],p[2]);m.lookAt(0,0,0);envScene.add(m);
305
+ }
306
+ envScene.add(new THREE.Mesh(new THREE.SphereGeometry(30,16,12),new THREE.MeshBasicMaterial({color:0x26362f,side:THREE.BackSide})));
307
+ softbox(0xffffff,9,14,5,[0,12,6]);softbox(0xffffff,5,4,12,[-12,0,6]);softbox(0xffe2b0,5,4,10,[12,2,5]);softbox(ACCENT.getHex(),4,12,4,[0,-11,3]);
308
+ var pmrem=new THREE.PMREMGenerator(renderer);
309
+ scene.environment=pmrem.fromScene(envScene,.03).texture;pmrem.dispose();
310
+ var sun=new THREE.DirectionalLight(0xffffff,1.1);sun.position.set(3,6,8);scene.add(sun);
311
+
312
+ // Clear in the middle, bright at the edges, like real glass seen against a page. three's
313
+ // transmission can't see the page behind a transparent canvas (it turned grey), so edge
314
+ // opacity comes from a Fresnel term instead; also far cheaper on phones.
315
+ function glass(){
316
+ var m=new THREE.MeshPhysicalMaterial({color:ACCENT.clone().lerp(new THREE.Color(0xffffff),.72),transparent:true,opacity:.14,roughness:.06,clearcoat:1,clearcoatRoughness:.05,depthWrite:false,envMapIntensity:1.5});
317
+ m.onBeforeCompile=function(sh){
318
+ sh.fragmentShader=sh.fragmentShader.replace('#include <opaque_fragment>',
319
+ 'diffuseColor.a=mix(diffuseColor.a,.8,pow(1.0-saturate(dot(normalize(vViewPosition),normal)),2.6));\n#include <opaque_fragment>');
320
+ };
321
+ return m;
322
+ }
323
+ function solid(color,rough){return new THREE.MeshStandardMaterial({color:color,emissive:color,emissiveIntensity:.12,roughness:rough==null?.32:rough});}
324
+ function rrShape(w,h,r,tail){
325
+ var s=new THREE.Shape(),x=-w/2,y=-h/2;
326
+ s.moveTo(x+r,y);
327
+ if(tail){s.lineTo(x+r+.02,y-.3);s.lineTo(x+r+.42,y);}
328
+ s.lineTo(x+w-r,y);s.quadraticCurveTo(x+w,y,x+w,y+r);s.lineTo(x+w,y+h-r);s.quadraticCurveTo(x+w,y+h,x+w-r,y+h);
329
+ s.lineTo(x+r,y+h);s.quadraticCurveTo(x,y+h,x,y+h-r);s.lineTo(x,y+r);s.quadraticCurveTo(x,y,x+r,y);return s;
330
+ }
331
+ function slab(w,h,r,d,tail){
332
+ var b=Math.min(.07,d*.5+.015);
333
+ return new THREE.ExtrudeGeometry(rrShape(w-2*b,h-2*b,Math.max(.01,r-b),tail),{depth:d,bevelEnabled:true,bevelSize:b,bevelThickness:b,bevelSegments:5,curveSegments:14}).center();
334
+ }
335
+ function mesh(g,m,p,parent){var o=new THREE.Mesh(g,m);if(p)o.position.set(p[0],p[1],p[2]);(parent||scene).add(o);return o;}
336
+
337
+ // The four stops are the ones the page has always named: you, the AI, MCP, Webcake.
338
+ // Stop 1: you, the idea. A glass light bulb that lights up.
339
+ var bulb=new THREE.Group();scene.add(bulb);
340
+ var bp=[new THREE.Vector2(.001,.84)];
341
+ for(var bi=1;bi<=18;bi++){var ba=Math.PI/2-bi/18*(Math.PI/2+.85);bp.push(new THREE.Vector2(.64*Math.cos(ba),.2+.64*Math.sin(ba)));}
342
+ bp.push(new THREE.Vector2(.3,-.5),new THREE.Vector2(.3,-.62));
343
+ mesh(new THREE.LatheGeometry(bp.reverse(),48),glass(),[0,0,0],bulb);
344
+ var capM=solid(0x9fb0a9,.45),fil=solid(AMBER,.2);
345
+ mesh(new THREE.CylinderGeometry(.29,.29,.1,32),capM,[0,-.68,0],bulb);
346
+ mesh(new THREE.CylinderGeometry(.25,.25,.1,32),capM,[0,-.8,0],bulb);
347
+ mesh(new THREE.CylinderGeometry(.13,.06,.1,24),capM,[0,-.91,0],bulb);
348
+ mesh(new THREE.CylinderGeometry(.025,.05,.7,12),capM,[0,-.2,0],bulb);
349
+ mesh(new THREE.SphereGeometry(.14,24,16),fil,[0,.2,0],bulb);
350
+
351
+ // Stop 2: the AI assistant, the brain icon drawn in tubes, inside a chat bubble.
352
+ var bubble=new THREE.Group();scene.add(bubble);
353
+ mesh(slab(1.95,1.5,.46,.3,true),glass(),[0,0,0],bubble);
354
+ var brainM=solid(ACCENT);
355
+ function iconTube(d,k,rad,mat,parent){
356
+ // The browser walks the SVG path, so arcs need no parser of ours.
357
+ var p=document.createElementNS('http://www.w3.org/2000/svg','path');p.setAttribute('d',d);
358
+ var L=p.getTotalLength(),pts=[];
359
+ for(var i=0;i<90;i++){var q=p.getPointAtLength(L*i/90);pts.push(new THREE.Vector3((q.x-12)*k,(12-q.y)*k,0));}
360
+ return mesh(new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts,true),240,rad,8,true),mat,[0,.14,.04],parent);
361
+ }
362
+ iconTube('M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z',.054,.034,brainM,bubble);
363
+ iconTube('M12 5a3 3 0 1 1 5.997.142 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z',.054,.034,brainM,bubble);
364
+
365
+ // Stop 3: Webcake MCP, the bridge: a ring of tools the AI can reach for, around the server icon.
366
+ var ringG=new THREE.Group();scene.add(ringG);
367
+ mesh(new THREE.TorusGeometry(.92,.14,32,96),glass(),[0,0,0],ringG);
368
+ var srvM=solid(ACCENT);
369
+ [.17,-.17].forEach(function(y){
370
+ mesh(slab(.92,.27,.08,.1),srvM,[0,y,0],ringG);
371
+ mesh(new THREE.SphereGeometry(.04,12,8),new THREE.MeshBasicMaterial({color:0xffffff,toneMapped:false}),[-.3,y,.11],ringG);
372
+ });
373
+ var toolM=solid(ACCENT.clone().lerp(new THREE.Color(0xffffff),.28)),pick=solid(AMBER);
374
+ var tools=[0,1,2,3,4,5].map(function(i){return mesh(slab(.24,.24,.07,.07),i===0?pick:toolM,[0,0,0],ringG);});
375
+
376
+ // Stop 4: Webcake and the real page. The page is built below; this is the logo in 3D on its
377
+ // corner: the official W and peach dot on a green tile inside clear glass.
378
+ var page=new THREE.Group();scene.add(page);page.rotation.y=-.22;
379
+ var W_PATH='M14.3011 11.3523C14.395 12.3191 14.4157 12.0816 15.0571 13.6768C15.0571 21.9423 13.5334 16.5399 12.2589 13.6732C11.4363 11.7505 10.7943 9.30526 8.74858 9.1988C7.57201 9.1623 6.51244 9.98392 6.47107 11.062C6.44377 11.4475 6.49804 11.8319 6.64075 12.191C7.2016 13.6024 8.65083 17.1402 8.92789 17.7945C9.36942 18.8396 9.77116 19.8691 10.1854 20.8761C10.6124 21.9109 11.0522 22.8274 12.5529 22.8274H12.8564C13.9412 22.8274 15.026 21.8587 15.4402 21.1763C16.0707 20.1346 15.8417 17.4106 16.1743 16.3166C16.2961 16.756 17.7389 20.1485 17.9731 20.6986C18.3873 21.6795 18.8071 22.8271 20.23 22.8271H20.686C21.8473 22.8271 22.8155 21.7767 22.8155 20.6483V20.5753C22.7647 19.951 20.713 15.1116 20.3587 14.2785C19.9081 13.2212 19.5137 12.2125 19.0666 11.1569C18.6251 10.1118 18.1725 9.17255 16.6572 9.17255H16.4281C15.2651 9.17255 14.3004 10.209 14.3004 11.3513L14.3011 11.3523Z';
380
+ function svgShape(d){
381
+ // Just the commands this path uses. y flips because SVG grows downward; the logo is 32 units wide.
382
+ var sh=new THREE.Shape(),m=d.match(/[MCHVLZ]|-?[0-9.]+/g),i=0,x=0,y=0;
383
+ function n(){return parseFloat(m[i++])-16;}
384
+ while(i<m.length){
385
+ var c=m[i++];
386
+ if(c==='M'){x=n();y=n();sh.moveTo(x,-y);}
387
+ else if(c==='L'){x=n();y=n();sh.lineTo(x,-y);}
388
+ else if(c==='H'){x=n();sh.lineTo(x,-y);}
389
+ else if(c==='V'){y=n();sh.lineTo(x,-y);}
390
+ else if(c==='C'){var a1=n(),b1=n(),a2=n(),b2=n();x=n();y=n();sh.bezierCurveTo(a1,-b1,a2,-b2,x,-y);}
391
+ }
392
+ return sh;
393
+ }
394
+ var logo=new THREE.Group();page.add(logo);logo.position.set(-.86,1.02,.34);logo.scale.setScalar(.62);
395
+ mesh(slab(1.98,1.98,.48,.3),glass(),[0,0,0],logo);
396
+ var tileG=slab(1.72,1.72,.4,.1),tileP=tileG.attributes.position,tileC=new Float32Array(tileP.count*3);
397
+ var topC=new THREE.Color(0x3FBB57),botC=new THREE.Color(0x108B67),mixC=new THREE.Color();
398
+ for(var ti=0;ti<tileP.count;ti++){mixC.copy(botC).lerp(topC,(tileP.getY(ti)+.86)/1.72);mixC.toArray(tileC,ti*3);}
399
+ tileG.setAttribute('color',new THREE.BufferAttribute(tileC,3));
400
+ var tileM=new THREE.MeshStandardMaterial({vertexColors:true,roughness:.28,emissive:0x108B67,emissiveIntensity:.12});
401
+ mesh(tileG,tileM,[0,0,0],logo);
402
+ var mark=new THREE.Group(),K=1.78/32;mark.scale.setScalar(K);mark.position.z=.15;logo.add(mark);
403
+ var wM=new THREE.MeshStandardMaterial({color:0xffffff,emissive:0xffffff,emissiveIntensity:.6,roughness:.22});
404
+ mesh(new THREE.ExtrudeGeometry(svgShape(W_PATH),{depth:1.3,bevelEnabled:true,bevelSize:.22,bevelThickness:.4,bevelSegments:5,curveSegments:16}),wM,[0,0,0],mark);
405
+ var dotP=solid(0xFFD591,.2),peach=mesh(new THREE.SphereGeometry(2.16,32,24),dotP,[23.4118-16,16-11.3277,1.1],mark);peach.scale.z=.62;
406
+
407
+ // The page itself, with sections that arrive one by one.
408
+ mesh(slab(1.9,2.3,.2,.1),glass(),[0,0,0],page);
409
+ mesh(slab(1.5,.09,.04,.015),solid(0x9fb0a9,.5),[0,.94,.1],page);
410
+ var soft=solid(ACCENT.clone().lerp(new THREE.Color(0xffffff),.45));
411
+ var built=[
412
+ {o:mesh(slab(1.5,.68,.1,.035),solid(ACCENT),[0,.43,.1],page),a:0,b:.38},
413
+ {o:mesh(slab(.45,.45,.08,.035),soft,[-.52,-.27,.1],page),a:.22,b:.54},
414
+ {o:mesh(slab(.45,.45,.08,.035),soft,[0,-.27,.1],page),a:.3,b:.62},
415
+ {o:mesh(slab(.45,.45,.08,.035),soft,[.52,-.27,.1],page),a:.38,b:.7},
416
+ {o:mesh(slab(.86,.22,.11,.035),solid(AMBER),[0,-.8,.1],page),a:.62,b:.95}
417
+ ];
418
+ built.forEach(function(s){s.z=s.o.position.z;});
419
+
420
+ // The route the request travels, and the part of it already lit.
421
+ var wireBase=new THREE.MeshStandardMaterial({color:0x7f9a8c,transparent:true,opacity:.34,roughness:.3});
422
+ var wireLit=new THREE.MeshBasicMaterial({color:ACCENT,toneMapped:false}),wireRet=new THREE.MeshBasicMaterial({color:AMBER,toneMapped:false});
423
+ var base=mesh(new THREE.BufferGeometry(),wireBase),lit=mesh(new THREE.BufferGeometry(),wireLit),ret=mesh(new THREE.BufferGeometry(),wireRet);
424
+ var curve,lengths,stations=[bulb,bubble,ringG,page];
425
+
426
+ var sprite=(function(){
427
+ var c=document.createElement('canvas');c.width=c.height=64;
428
+ var g=c.getContext('2d'),r=g.createRadialGradient(32,32,0,32,32,32);
429
+ r.addColorStop(0,'rgba(255,255,255,1)');r.addColorStop(.25,'rgba(255,255,255,.55)');r.addColorStop(1,'rgba(255,255,255,0)');
430
+ g.fillStyle=r;g.fillRect(0,0,64,64);return new THREE.CanvasTexture(c);
431
+ })();
432
+ var haloM=new THREE.SpriteMaterial({map:sprite,color:ACCENT,transparent:true,depthWrite:false}),halo=new THREE.Sprite(haloM);halo.scale.setScalar(.62);scene.add(halo);
433
+ var bulbHaloM=new THREE.SpriteMaterial({map:sprite,color:AMBER,transparent:true,depthWrite:false,opacity:0}),bulbHalo=new THREE.Sprite(bulbHaloM);
434
+ bulbHalo.scale.setScalar(1.9);bulbHalo.position.y=.2;bulb.add(bulbHalo);
435
+ var headM=new THREE.MeshBasicMaterial({color:0xffffff,toneMapped:false}),head=mesh(new THREE.SphereGeometry(.085,24,16),headM);
436
+ var trailM=new THREE.MeshBasicMaterial({color:ACCENT,toneMapped:false,transparent:true,opacity:.6});
437
+ var trail=[1,2,3,4,5].map(function(k){return mesh(new THREE.SphereGeometry(.06-.008*k,12,8),trailM);});
438
+
439
+ var mode='',W=0,H=0,panelW=0,scaleS=1;
440
+ var LAYOUT={
441
+ wide:{z:11,p:[[-1,.95,0],[-.38,-1,.2],[.24,1.05,-.2],[1,-.55,0]]},
442
+ tall:{z:13.4,p:[[-1,2.95,0],[1.05,1.15,.2],[-1.05,-.65,-.2],[1,-2.3,0]]}
443
+ };
444
+ function layout(m){
445
+ mode=m;var L=LAYOUT[m],pts=[],at=[];
446
+ // World width left of the panel at the stage's depth: stations spread to fit it.
447
+ var vis=2*L.z*Math.tan(camera.fov*Math.PI/360)*(W/H),free=vis*(W-panelW)/W;
448
+ scaleS=m==='wide'?Math.min(1,free/9.4):.72;
449
+ var half=free/2-1.12*scaleS;
450
+ stations.forEach(function(g,i){
451
+ var x=m==='wide'?L.p[i][0]*half:L.p[i][0];
452
+ at.push(new THREE.Vector3(x,L.p[i][1],L.p[i][2]));
453
+ g.position.copy(at[i]);g.scale.setScalar(scaleS);
454
+ });
455
+ for(var i=0;i<4;i++){
456
+ // Behind the object, so the lit wire is seen through the glass.
457
+ var v=at[i].clone();v.z-=.5*scaleS;pts.push(v);
458
+ if(i<3)pts.push(v.clone().lerp(at[i+1],.5).add(new THREE.Vector3(0,0,-.45)));
459
+ }
460
+ curve=new THREE.CatmullRomCurve3(pts,false,'centripetal');
461
+ lengths=curve.getLengths(240);
462
+ [[base,.038],[lit,.03],[ret,.031]].forEach(function(e){
463
+ e[0].geometry.dispose();e[0].geometry=new THREE.TubeGeometry(curve,200,e[1],10,false);
464
+ });
465
+ camera.position.z=L.z;
466
+ }
467
+ function frac(t){return lengths[Math.round(t*240)]/lengths[240];}
468
+ function smooth(a,b,x){var t=Math.max(0,Math.min(1,(x-a)/(b-a)));return t*t*(3-2*t);}
469
+ function band(a,b){return smooth(a-.2,a+.08,T)*(1-smooth(b-.08,b+.2,T));}
470
+
471
+ function resize(){
472
+ W=stage.clientWidth;H=stage.clientHeight;
473
+ if(!W||!H)return;
474
+ renderer.setSize(W,H,false);
475
+ camera.aspect=W/H;
476
+ var panel=root.querySelector('.sc-panel');
477
+ panelW=getComputedStyle(panel).position==='absolute'?panel.offsetWidth:0;
478
+ layout(W<640?'tall':'wide');
479
+ if(panelW)camera.setViewOffset(W,H,-panelW/2,0,W,H);else camera.clearViewOffset();
480
+ camera.updateProjectionMatrix();
481
+ wake();
482
+ }
483
+
484
+ var par={x:0,y:0},parT={x:0,y:0},v3=new THREE.Vector3();
485
+ function draw(){
486
+ camera.position.x=par.x*.4;camera.position.y=-par.y*.3;camera.lookAt(0,0,0);
487
+
488
+ // Where the request is along the route (t), per step.
489
+ var t,idx=Math.min(4,Math.floor(T)),p=T-idx,e=p*p*(3-2*p);
490
+ if(idx===0)t=e/3;else if(idx===1)t=1/3+e/3;else if(idx===2)t=2/3+e/3;else if(idx===3)t=1;else t=1-e;
491
+ var f=frac(t),back=T>=4,on=T>.02&&T<4.98&&(T<2.98||back);
492
+ var count=lit.geometry.index.count,cut=Math.floor(count*f/6)*6;
493
+ lit.geometry.setDrawRange(0,back?count:cut);
494
+ ret.visible=back;ret.geometry.setDrawRange(cut,count-cut);
495
+
496
+ var pos=curve.getPoint(t);
497
+ head.visible=halo.visible=on;
498
+ head.position.copy(pos);halo.position.copy(pos);
499
+ var col=back?AMBER:ACCENT;haloM.color.copy(col);trailM.color.copy(col);
500
+ trail.forEach(function(s,k){
501
+ var tt=Math.max(0,Math.min(1,t+(back?1:-1)*(k+1)*.009));
502
+ s.visible=on;s.position.copy(curve.getPoint(tt));
503
+ });
504
+
505
+ // Each station wakes up in its own step.
506
+ var a0=Math.max(band(0,.7),smooth(4.7,4.95,T)),a1=Math.max(band(.7,1.3),band(4.4,4.7)),a2=band(1.7,2.3),a3=band(2.7,4.4);
507
+ fil.emissiveIntensity=.2+a0*1.6;bulbHaloM.opacity=a0*.75;bulbHalo.visible=a0>.01;
508
+ brainM.emissiveIntensity=.12+a1*.8;srvM.emissiveIntensity=.12+a2*.7;
509
+ tools.forEach(function(o,i){
510
+ var a=i/6*Math.PI*2+T*.9;
511
+ o.position.set(Math.cos(a)*.92,Math.sin(a)*.92,0);o.rotation.z=a;
512
+ o.scale.setScalar(i===0?1+a2*.55:1);
513
+ });
514
+ toolM.emissiveIntensity=.12+a2*.5;pick.emissiveIntensity=.2+a2;
515
+ ringG.rotation.y=Math.sin(T*.8)*.3;
516
+ tileM.emissiveIntensity=.12+a3*.22;wM.emissiveIntensity=.6+a3*.3;dotP.emissiveIntensity=.55+a3*.4;
517
+ // A full turn during its own step, so it reads as an object, resting slightly angled.
518
+ logo.rotation.y=.24+smooth(2,3,T)*Math.PI*2;logo.rotation.x=-.1;
519
+ built.forEach(function(s){
520
+ var k=smooth(s.a,s.b,T-3);
521
+ s.o.visible=k>.001;
522
+ s.o.scale.setScalar(.6+.4*k);
523
+ s.o.position.z=s.z+(1-k)*.9;
524
+ });
525
+ bubble.rotation.y=.22+Math.sin(T*.6)*.06;
526
+ [a0,a1,a2,a3].forEach(function(a,i){stations[i].scale.setScalar(scaleS*(1+a*.05));});
527
+
528
+ // Labels sit just under each station.
529
+ var drop=mode==='wide'?[1.36,1.32,1.46,1.56]:[1,.98,1.06,1.16];
530
+ stations.forEach(function(g,i){
531
+ v3.copy(g.position);v3.y-=drop[i]*(mode==='wide'?scaleS:1);v3.project(camera);
532
+ var x=(v3.x+1)/2*W,y=(1-v3.y)/2*H;
533
+ tags[i].style.transform='translate('+Math.round(x)+'px,'+Math.round(y)+'px) translate(-50%,-50%)';
534
+ tags[i].classList.toggle('on',[a0,a1,a2,a3][i]>.5);
535
+ });
536
+
537
+ var s=Math.max(0,Math.min(4,Math.ceil(T)-1));
538
+ if(s!==curStep){
539
+ curStep=s;
540
+ items.forEach(function(li,i){
541
+ li.classList.toggle('cur',i===s);
542
+ var b=li.querySelector('.sc-step');
543
+ if(i===s)b.setAttribute('aria-current','step');else b.removeAttribute('aria-current');
544
+ });
545
+ }
546
+ syncCtl();
547
+ renderer.render(scene,camera);
548
+ }
549
+ function syncCtl(){
550
+ if(reduced)return;
551
+ var label=playing?root.dataset.pause:(T>=5?root.dataset.replay:root.dataset.resume);
552
+ if(ctl.textContent!==label)ctl.textContent=label;
553
+ }
554
+ function frame(now){
555
+ raf=0;
556
+ var dt=Math.min((now-last)/1000,.05);last=now;
557
+ if(playing&&T<hold){T=Math.min(hold,T+dt/STEP);if(T>=hold)playing=false;}
558
+ par.x+=(parT.x-par.x)*.08;par.y+=(parT.y-par.y)*.08;
559
+ var settling=Math.abs(parT.x-par.x)>.002||Math.abs(parT.y-par.y)>.002;
560
+ draw();
561
+ if((playing||settling)&&visible)raf=requestAnimationFrame(frame);
562
+ }
563
+ function wake(){if(!raf&&visible&&W){last=performance.now();raf=requestAnimationFrame(frame);}}
564
+
565
+ items.forEach(function(li,i){
566
+ li.querySelector('.sc-step').addEventListener('click',function(){
567
+ touched=true;
568
+ if(reduced){T=i+1;hold=T;playing=false;}else{T=i;hold=i+1;playing=true;}
569
+ wake();
570
+ });
571
+ });
572
+ if(!reduced){
573
+ ctl.hidden=false;
574
+ ctl.addEventListener('click',function(){
575
+ touched=true;
576
+ if(playing)playing=false;
577
+ else{if(T>=5)T=0;hold=5;playing=true;}
578
+ syncCtl();wake();
579
+ });
580
+ stage.addEventListener('pointermove',function(e){
581
+ if(e.pointerType==='touch')return;
582
+ var r=stage.getBoundingClientRect();
583
+ parT.x=(e.clientX-r.left)/r.width-.5;parT.y=(e.clientY-r.top)/r.height-.5;wake();
584
+ },{passive:true});
585
+ stage.addEventListener('pointerleave',function(){parT.x=parT.y=0;wake();});
586
+ }
587
+
588
+ function paintTheme(){
589
+ var dark=html.getAttribute('data-theme')==='dark'||(!html.getAttribute('data-theme')&&mq('(prefers-color-scheme: dark)'));
590
+ wireBase.color.set(dark?0x9fc4b2:0x4f7263);wireBase.opacity=dark?.3:.42;
591
+ scene.environmentIntensity=dark?.85:1.05;
592
+ wake();
593
+ }
594
+ new MutationObserver(paintTheme).observe(html,{attributes:true,attributeFilter:['data-theme']});
595
+ if(window.matchMedia)matchMedia('(prefers-color-scheme: dark)').addEventListener('change',paintTheme);
596
+
597
+ new IntersectionObserver(function(es){visible=es[0].isIntersecting;if(visible)wake();},{threshold:0}).observe(stage);
598
+ // Plays through once, the first time most of it is on screen; then it rests.
599
+ var starter=new IntersectionObserver(function(es){
600
+ if(!es[0].isIntersecting)return;
601
+ starter.disconnect();
602
+ if(!touched&&!reduced){playing=true;wake();}
603
+ },{threshold:.45});
604
+ starter.observe(stage);
605
+
606
+ if(window.ResizeObserver)new ResizeObserver(resize).observe(stage);else window.addEventListener('resize',resize);
607
+ resize();paintTheme();
608
+ visible=true;wake();
609
+ }
610
+ })();
611
+ `;
package/dist/web-guide.js CHANGED
@@ -12,9 +12,12 @@
12
12
  * SoftwareApplication + WebSite + FAQPage so links unfurl nicely and the page
13
13
  * can be indexed. ogImageSvg() is served at /og.svg; /og.png if you rasterize it.
14
14
  *
15
- * Self-contained (inline CSS + JS, no external fonts/trackers) so it loads instantly.
15
+ * Inline CSS + JS, no fonts or trackers, so it loads instantly. The only extra download
16
+ * is three.js from jsDelivr for the 3D scene, fetched when that section nears the
17
+ * viewport (see web-guide-scene.ts).
16
18
  */
17
19
  import { readFileSync } from "node:fs";
20
+ import { GLASS_CSS, SCENE_JS, sceneHtml } from "./web-guide-scene.js";
18
21
  // The SPA page (on the builder app) that shows the user their personal remote
19
22
  // connector link with login already built in — see builderx_spa McpRemoteStore.vue
20
23
  // (/mcp-remote-store). The raw MCP endpoint itself is {ENDPOINT} = <origin>/mcp.
@@ -146,14 +149,7 @@ const T = {
146
149
  leadPost: ". Không kéo-thả, không học gì thêm — nhanh hơn thuê người làm web cả tuần.",
147
150
  ctaStart: "Bắt đầu ngay",
148
151
  ctaStar: "Tặng sao trên GitHub",
149
- flowH2: "Chỉ 4 bước đơn giản",
150
- flow: [
151
- { icon: "bulb", t: "Bạn nói", s: "mô tả trang bạn muốn" },
152
- { icon: "brain", t: "Trợ lý AI", s: "Claude · Cursor · Windsurf…" },
153
- { icon: "server", t: "WebCake", s: "lưu & kiểm tra trang" },
154
- { icon: "window", t: "Cửa hàng của bạn", s: "trang web thật, live" },
155
- ],
156
- flowCap: "① Bạn nói mong muốn → ② Trợ lý AI dựng trang → ③ Bạn xem trước, chỉnh nếu thích → ④ Đăng lên là xong. Không cần biết lập trình, không cần kéo-thả block.",
152
+ flowH2: "Từ một câu nói đến trang web thật",
157
153
  howH2: "Tại sao dùng được ngay, không lo hỏng",
158
154
  how: [
159
155
  {
@@ -226,10 +222,10 @@ const T = {
226
222
  m1Steps: [
227
223
  "<b>Cài Node.js 18+</b> (miễn phí) nếu máy chưa có — tải tại <b>nodejs.org</b>.",
228
224
  "<b>Mở Terminal</b> (hoặc Command Prompt), dán lệnh sau và nhấn Enter:<pre>" + INSTALL_CMD + "</pre>",
229
- "<b>Làm theo hướng dẫn hiện ra:</b> chọn ứng dụng bạn dùng (Claude, Cursor, Windsurf…) → đăng nhập tài khoản WebCake khi được hỏi.",
225
+ "<b>Bấm “Kết nối” trên trang vừa mở ra</b> trong trình duyệt (đăng nhập WebCake nếu được hỏi). Công cụ tự cài vào ứng dụng AI có trên máy bạn (Claude, Cursor, Windsurf…).",
230
226
  '<b>Mở lại ứng dụng AI.</b> Khi thấy <code class="inl">webcake-storefront</code> xuất hiện trong danh sách công cụ là bạn đã kết nối thành công — hãy thử nói "Tạo cho tôi trang sản phẩm…"',
231
227
  ],
232
- m1Note: "Muốn cài cho nhiều ứng dụng cùng lúc — dùng lệnh này:",
228
+ m1Note: "Cần cài cho mọi ứng dụng, kể cả ứng dụng chưa có trên máy, hoặc chạy bằng script? Dùng lệnh này:",
233
229
  m2Tag: "Cách ② · Dùng link — không cần cài gì",
234
230
  m2Sub: "Phù hợp khi bạn dùng Claude trên web (claude.ai), máy không cài được phần mềm, hoặc dùng theo nhóm.",
235
231
  m2Steps: [
@@ -308,14 +304,7 @@ const T = {
308
304
  leadPost: ". No dragging blocks, nothing to learn — faster than waiting weeks for a web agency.",
309
305
  ctaStart: "Get started",
310
306
  ctaStar: "Star on GitHub",
311
- flowH2: "Just 4 simple steps",
312
- flow: [
313
- { icon: "bulb", t: "You describe", s: "what you want the page to be" },
314
- { icon: "brain", t: "AI assistant", s: "Claude · Cursor · Windsurf…" },
315
- { icon: "server", t: "WebCake", s: "saves & checks the page" },
316
- { icon: "window", t: "Your store", s: "a real, live page" },
317
- ],
318
- flowCap: "① You say what you want → ② The AI builds the page → ③ You preview it, tweak if you like → ④ Publish and you're done. No coding, no drag-and-drop.",
307
+ flowH2: "From one sentence to a live page",
319
308
  howH2: "Why you can trust it straight away",
320
309
  how: [
321
310
  {
@@ -388,10 +377,10 @@ const T = {
388
377
  m1Steps: [
389
378
  "<b>Install Node.js 18+</b> (free) if you don't have it yet — get it at <b>nodejs.org</b>.",
390
379
  "<b>Open Terminal</b> (or Command Prompt), paste the command below and press Enter:<pre>" + INSTALL_CMD + "</pre>",
391
- "<b>Follow the prompts that appear:</b> pick your app (Claude, Cursor, Windsurf…) → sign in to your WebCake account when asked.",
380
+ "<b>Click “Connect” on the page that opens</b> in your browser (sign in to WebCake if asked). The tool sets itself up in the AI apps on your computer (Claude, Cursor, Windsurf…).",
392
381
  '<b>Reopen your AI app.</b> When you see <code class="inl">webcake-storefront</code> in the tools list, you\'re connected — try saying "Create a product page for…"',
393
382
  ],
394
- m1Note: "Want to set up multiple apps at once — use this command:",
383
+ m1Note: "Need every app configured, even ones not on this computer yet, or running from a script? Use this command:",
395
384
  m2Tag: "Way ② · Use a link — nothing to install",
396
385
  m2Sub: "Best if you use Claude on the web (claude.ai), can't install software, or work as a team.",
397
386
  m2Steps: [
@@ -675,26 +664,7 @@ export function guideHtml(origin, lang = "vi") {
675
664
  .feat li{display:flex;gap:13px;align-items:center;font-size:.97rem;padding:13px 16px}
676
665
  .feat li b{color:var(--ink)}
677
666
  .cta-row{display:flex;gap:12px;flex-wrap:wrap;margin:22px 0 6px}
678
- .flow{display:flex;align-items:flex-start;gap:0;padding:24px 18px 18px;overflow-x:auto}
679
- .flow .node{flex:0 0 auto;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;width:104px}
680
- .flow .node .ic{width:54px;height:54px;border-radius:16px}
681
- .flow .node .ic .i{width:27px;height:27px}
682
- .flow .node b{font-size:.93rem}
683
- .flow .node span{font-size:.75rem;color:var(--mut)}
684
- .flow .wire{flex:1 1 auto;min-width:30px;position:relative;height:2px;margin-top:27px;
685
- background:linear-gradient(90deg,var(--line),rgba(16,139,103,.45),var(--line))}
686
- .flow .wire .pkt{position:absolute;top:50%;left:0;width:9px;height:9px;margin:-5px 0 0 -4px;border-radius:50%;
687
- background:var(--g);box-shadow:0 0 9px 1px rgba(16,139,103,.7)}
688
- .flow .wire::after{content:"";position:absolute;right:-1px;top:50%;width:7px;height:7px;margin-top:-4px;
689
- border-top:2px solid var(--g7);border-right:2px solid var(--g7);transform:rotate(45deg)}
690
667
  .flow-cap{color:var(--mut);font-size:.9rem;margin:2px 2px 0;max-width:68ch}
691
- @media(prefers-reduced-motion:no-preference){
692
- .flow .wire .pkt{animation:pkt 2.4s ease-in-out infinite}
693
- @keyframes pkt{0%{left:0;opacity:0}12%{opacity:1}88%{opacity:1}100%{left:100%;opacity:0}}
694
- .flow .node .ic{animation:nodepop 2.4s ease-in-out infinite}
695
- }
696
- @media(prefers-reduced-motion:reduce){.flow .wire .pkt{display:none}}
697
- @keyframes nodepop{0%,100%{box-shadow:none}50%{box-shadow:0 0 0 4px rgba(16,139,103,.12)}}
698
668
  .btn{display:inline-flex;align-items:center;gap:9px;padding:11px 19px;border-radius:11px;cursor:pointer;
699
669
  background:var(--g);color:#fff;text-decoration:none;font-weight:700;font-size:.93rem;
700
670
  box-shadow:0 4px 12px -4px rgba(16,139,103,.5);transition:transform .15s ease,background .15s ease}
@@ -788,16 +758,6 @@ export function guideHtml(origin, lang = "vi") {
788
758
  .cl-wrap{padding:18px 16px 10px}
789
759
  .langsw{padding:6px 10px}
790
760
  .uses li,.feat li{padding:14px}
791
- .flow{flex-direction:column;align-items:stretch;overflow:visible;padding:16px}
792
- .flow .node{flex-direction:row;width:auto;align-items:center;gap:13px;text-align:left}
793
- .flow .node .ic{width:44px;height:44px;border-radius:13px}
794
- .flow .node .ic .i{width:22px;height:22px}
795
- .flow .node b{font-size:.95rem}
796
- .flow .node span{font-size:.8rem}
797
- .flow .wire{flex:0 0 auto;width:2px;height:20px;min-width:0;margin:3px 0 3px 21px;
798
- background:linear-gradient(var(--line),var(--g))}
799
- .flow .wire::after{content:none}
800
- .flow .wire .pkt{display:none}
801
761
  }
802
762
  @media(prefers-reduced-motion:no-preference){
803
763
  .js .reveal{opacity:0;transform:translateY(24px);
@@ -806,6 +766,7 @@ export function guideHtml(origin, lang = "vi") {
806
766
  .hero-in{animation:rise2 .8s cubic-bezier(.2,.7,.2,1) both}
807
767
  @keyframes rise2{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:none}}
808
768
  }
769
+ ${GLASS_CSS}
809
770
  </style></head>
810
771
  <body>
811
772
  <div class="blobs"><b></b><b></b><b></b></div>
@@ -837,15 +798,7 @@ export function guideHtml(origin, lang = "vi") {
837
798
  </nav>
838
799
 
839
800
  <h2 id="flow" class="reveal">${t.flowH2}</h2>
840
- <div class="glass flow reveal">
841
- ${t.flow
842
- .map((n, i) => `<div class="node"><span class="ic" style="animation-delay:${(i * 0.8).toFixed(1)}s">${icon(n.icon)}</span><b>${n.t}</b><span>${n.s}</span></div>` +
843
- (i < t.flow.length - 1
844
- ? `<div class="wire"><i class="pkt" style="animation-delay:${(i * 0.8).toFixed(1)}s"></i></div>`
845
- : ""))
846
- .join("\n ")}
847
- </div>
848
- <p class="flow-cap reveal">${t.flowCap}</p>
801
+ ${sceneHtml(L)}
849
802
 
850
803
  <h2 id="how" class="reveal">${t.howH2}</h2>
851
804
  <div class="grid">
@@ -987,6 +940,7 @@ export function guideHtml(origin, lang = "vi") {
987
940
  }
988
941
  })();
989
942
  </script>
943
+ <script>${SCENE_JS}</script>
990
944
  </body></html>`;
991
945
  }
992
946
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-storefront-mcp",
3
- "version": "1.37.0",
3
+ "version": "1.38.0",
4
4
  "description": "MCP server for the WebCake/StoreCake storefront builder — page CRUD, page authoring, products, orders, and more",
5
5
  "mcpName": "io.github.vuluu2k/webcake-storefront-mcp",
6
6
  "license": "MIT",