webcake-landing-mcp 1.6.2 → 1.7.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
@@ -101,19 +101,32 @@ Pick **one**. Both hand your AI tool (Claude, Cursor, …) the full Webcake land
101
101
  Zero install, always the latest version, needs Node.js 18+. **One line** grabs your token *and* writes the IDE config:
102
102
 
103
103
  ```bash
104
- # Interactive — pick environment, log in via browser (or paste a JWT), pick IDE(s)
104
+ # Opens the browser — click Connect, your installed IDEs are configured (prod)
105
105
  npx -y webcake-landing-mcp install
106
106
 
107
- # Non-interactive — configure every supported IDE at once (env + token via flags)
108
- npx -y webcake-landing-mcp install --ide all --env prod --jwt <your-jwt>
107
+ # Developers only — step by step: environment, login or JWT, org, IDE(s)
108
+ npx -y webcake-landing-mcp install --dev
109
+
110
+ # Scripts and CI — every supported IDE, even ones not installed yet
111
+ npx -y webcake-landing-mcp install --ide all --jwt <your-jwt>
109
112
 
110
113
  # Remove the server from every IDE config
111
114
  npx -y webcake-landing-mcp uninstall
112
115
  ```
113
116
 
117
+ **`install` asks nothing.** It connects to production, opens your browser so you can click *Connect*, then adds the server
118
+ 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
119
+ the original as `<file>.webcake-landing-backup`. No AI app found? It says so and exits with an error: install one and run it again,
120
+ or name it with `--ide`.
121
+
122
+ Need staging or local? `--dev` opens the step-by-step wizard, or skip it with `--env staging` / `--env local`.
123
+
124
+ > **Installed with an older version?** Run `install` again. Older versions wrote VS Code's config under the wrong key, so the
125
+ > server never appeared there, and registered Claude Code for the current folder only.
126
+
114
127
  It writes a `webcake-landing` entry into the right config file for each target: `claude-desktop`,
115
128
  `claude-code`, `cursor`, `windsurf`, `augment` (VS Code), `codex`, `antigravity`, `gemini` (Gemini CLI),
116
- `cline`, `kiro`, `opencode`, or `all`. Flags: `--ide`, `--env`, `--jwt`, `--org-id`,
129
+ `cline`, `kiro`, `opencode`, or `all`. Flags: `--dev`, `--ide`, `--env`, `--jwt`, `--org-id`,
117
130
  `--api-base`/`--app-base`, `--npx`/`--local`, `-y` — see `install --help`.
118
131
 
119
132
  Just want to run the server (configure by hand later)? `npx -y webcake-landing-mcp`
package/README.vi.md CHANGED
@@ -101,19 +101,31 @@ Chọn **một** trong hai. Cả hai đều đưa toàn bộ bộ công cụ d
101
101
  Không cần cài đặt, luôn bản mới nhất, cần Node.js 18+. **Một dòng** vừa lấy token vừa ghi cấu hình IDE:
102
102
 
103
103
  ```bash
104
- # Tương tác — chọn môi trường, đăng nhập qua trình duyệt (hoặc dán JWT), chọn IDE
104
+ # 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)
105
105
  npx -y webcake-landing-mcp install
106
106
 
107
- # Không tương tác — cấu hình mọi IDE hỗ trợ cùng lúc (env + token qua cờ)
108
- npx -y webcake-landing-mcp install --ide all --env prod --jwt <your-jwt>
107
+ # Chỉ dành cho dev — từng bước: môi trường, đăng nhập hoặc JWT, org, IDE
108
+ npx -y webcake-landing-mcp install --dev
109
+
110
+ # Script và CI — mọi IDE được hỗ trợ, kể cả IDE chưa cài
111
+ npx -y webcake-landing-mcp install --ide all --jwt <your-jwt>
109
112
 
110
113
  # Gỡ server khỏi mọi cấu hình IDE
111
114
  npx -y webcake-landing-mcp uninstall
112
115
  ```
113
116
 
117
+ **`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
118
+ 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
119
+ `<file>.webcake-landing-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`.
120
+
121
+ 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`.
122
+
123
+ > **Đã 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ý
124
+ > Claude Code cho đúng thư mục lúc chạy lệnh.
125
+
114
126
  Nó ghi entry `webcake-landing` vào đúng file cấu hình của từng IDE: `claude-desktop`, `claude-code`,
115
127
  `cursor`, `windsurf`, `augment` (VS Code), `codex`, `antigravity`, `gemini` (Gemini CLI), `cline`,
116
- `kiro`, `opencode`, hoặc `all`. Cờ: `--ide`, `--env`, `--jwt`, `--org-id`, `--api-base`/`--app-base`,
128
+ `kiro`, `opencode`, hoặc `all`. Cờ: `--dev`, `--ide`, `--env`, `--jwt`, `--org-id`, `--api-base`/`--app-base`,
117
129
  `--npx`/`--local`, `-y` — xem `install --help`.
118
130
 
119
131
  Chỉ muốn chạy server (tự cấu hình sau)? `npx -y webcake-landing-mcp`
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "1.7.0",
4
+ "d": "05/11/2026",
5
+ "type": "Added",
6
+ "en": "install gained a --dev flag that reopens the old step-by-step wizard (choose environment, log in or paste a JWT, pick an organization, pick IDEs)…",
7
+ "vi": "install nay có thêm cờ --dev để mở lại wizard từng bước kiểu cũ (chọn environment, đăng nhập hoặc dán JWT, chọn organization, chọn IDE) cho ai vẫn…"
8
+ },
2
9
  {
3
10
  "v": "1.6.2",
4
11
  "d": "27/10/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Changed",
34
41
  "en": "Rewrote every tool and parameter description (new_element, new_page_skeleton, validate_page, layout, ingest_html, ingest_url, search_images,…",
35
42
  "vi": "Viết lại toàn bộ mô tả tool và tham số (new_element, new_page_skeleton, validate_page, layout, ingest_html, ingest_url, search_images, get_icon_svg,…"
36
- },
37
- {
38
- "v": "1.5.9",
39
- "d": "13/10/2026",
40
- "type": "Fixed",
41
- "en": "The HTTP server now answers a request carrying an unknown mcp-session-id with 404 instead of 400, so clients re-initialize instead of staying stuck…",
42
- "vi": "HTTP server nay trả về 404 (thay vì 400) khi nhận request với mcp-session-id không xác định, giúp client tự re-initialize thay vì bị kẹt ở trạng…"
43
43
  }
44
44
  ]
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ function printHelp() {
58
58
  "",
59
59
  "Commands:",
60
60
  " (none) start the stdio MCP server (use this in IDE configs)",
61
- " install configure the server in your IDE(s) — interactive (env + login/JWT)",
61
+ " install connect to prod via the browser and configure your IDE(s) (--dev: wizard with env choice)",
62
62
  " uninstall remove the server from your IDE configs",
63
63
  " login grab your Webcake token via the browser (saved to ~/.webcake-landing-mcp/auth.json)",
64
64
  " serve [--port N] run the remote Streamable-HTTP server (default port 8787; or PORT env)",
package/dist/install.js CHANGED
@@ -8,15 +8,16 @@
8
8
  * to clone anything.
9
9
  *
10
10
  * Two modes:
11
- * - Interactive (a TTY and no --ide flag): asks step by step.
12
- * - Flag-driven (--ide present, or no TTY): non-interactive.
11
+ * - Default (no --ide flag, TTY or not): no questions — prod, browser connect, every detected IDE.
12
+ * - --dev on a TTY: the step-by-step wizard (environment, login/JWT, org, IDEs).
13
+ * - Flag-driven (--ide present): non-interactive, no browser.
13
14
  *
14
15
  * The launch command written into configs is `npx -y webcake-landing-mcp` when
15
16
  * this installer itself was run via npx (path-independent), or
16
17
  * `node <abs path>/dist/index.js` when run from a local clone. Override with
17
18
  * --npx / --local.
18
19
  */
19
- import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
20
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
20
21
  import { homedir, platform } from "node:os";
21
22
  import { dirname, join } from "node:path";
22
23
  import { fileURLToPath } from "node:url";
@@ -59,6 +60,8 @@ function parseArgs(argv) {
59
60
  o.npx = true;
60
61
  else if (a === "--local")
61
62
  o.local = true;
63
+ else if (a === "--dev")
64
+ o.dev = true;
62
65
  else if (is("--ide"))
63
66
  o.ide = next();
64
67
  else if (is("--api-base"))
@@ -96,7 +99,20 @@ function resolveLaunch(o) {
96
99
  return { command: "npx", args: ["-y", PKG] };
97
100
  }
98
101
  // ── JSON config (Claude Desktop, Claude Code, Cursor, Windsurf, VS Code) ──────
99
- function mergeJson(file, launch, env) {
102
+ // These are the user's own files: an unchanged one isn't touched, a changed one keeps
103
+ // its previous version alongside so the install can be undone.
104
+ function writeConfig(file, next) {
105
+ if (existsSync(file)) {
106
+ if (readFileSync(file, "utf8") === next)
107
+ return;
108
+ const backup = `${file}.${NAME}-backup`;
109
+ copyFileSync(file, backup);
110
+ info(`Previous file saved as ${backup}`);
111
+ }
112
+ writeFileSync(file, next);
113
+ }
114
+ // VS Code is the one client that keeps servers under `servers` (and requires `type`).
115
+ function mergeJson(file, launch, env, key = "mcpServers") {
100
116
  mkdirSync(dirname(file), { recursive: true });
101
117
  let cfg = {};
102
118
  if (existsSync(file)) {
@@ -111,14 +127,15 @@ function mergeJson(file, launch, env) {
111
127
  }
112
128
  }
113
129
  }
114
- if (typeof cfg.mcpServers !== "object" || !cfg.mcpServers)
115
- cfg.mcpServers = {};
116
- cfg.mcpServers[NAME] = {
130
+ if (typeof cfg[key] !== "object" || !cfg[key])
131
+ cfg[key] = {};
132
+ cfg[key][NAME] = {
133
+ ...(key === "servers" ? { type: "stdio" } : {}),
117
134
  command: launch.command,
118
135
  args: launch.args,
119
136
  ...(Object.keys(env).length ? { env } : {}),
120
137
  };
121
- writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
138
+ writeConfig(file, JSON.stringify(cfg, null, 2) + "\n");
122
139
  return true;
123
140
  }
124
141
  // ── OpenCode config (its own shape, not mcpServers) ─────────────────────────
@@ -146,7 +163,7 @@ function mergeOpencodeJson(file, launch, env) {
146
163
  enabled: true,
147
164
  ...(Object.keys(env).length ? { environment: env } : {}),
148
165
  };
149
- writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
166
+ writeConfig(file, JSON.stringify(cfg, null, 2) + "\n");
150
167
  return true;
151
168
  }
152
169
  // ── TOML config (Codex) ──────────────────────────────────────────────────────
@@ -154,16 +171,15 @@ function configureCodex(launch, env) {
154
171
  const dir = join(HOME, ".codex");
155
172
  const cfg = join(dir, "config.toml");
156
173
  mkdirSync(dir, { recursive: true });
157
- const argsToml = launch.args.map((a) => `"${a}"`).join(", ");
174
+ const argsToml = launch.args.map((a) => JSON.stringify(a)).join(", ");
158
175
  const envParts = Object.entries(env)
159
- .map(([k, v]) => `"${k}" = "${v}"`)
176
+ .map(([k, v]) => `${JSON.stringify(k)} = ${JSON.stringify(v)}`)
160
177
  .join(", ");
161
178
  const envLine = envParts ? `env = { ${envParts} }\n` : "";
162
- const block = `\n[mcp_servers.${NAME}]\ncommand = "${launch.command}"\nargs = [${argsToml}]\n${envLine}`;
179
+ const block = `\n[mcp_servers.${NAME}]\ncommand = ${JSON.stringify(launch.command)}\nargs = [${argsToml}]\n${envLine}`;
163
180
  let content = existsSync(cfg) ? readFileSync(cfg, "utf8") : "# Webcake Landing MCP\n";
164
181
  content = content.replace(new RegExp(`\\n?\\[mcp_servers\\.${NAME}\\][\\s\\S]*?(?=\\n\\[|$)`), "");
165
- content = content.trimEnd() + "\n" + block;
166
- writeFileSync(cfg, content);
182
+ writeConfig(cfg, content.trimEnd() + "\n" + block);
167
183
  }
168
184
  // ── IDE config-file locations ────────────────────────────────────────────────
169
185
  function claudeDesktopPath() {
@@ -196,10 +212,7 @@ function vscodeUserDir() {
196
212
  const mac = join(HOME, "Library", "Application Support", "Code", "User");
197
213
  if (existsSync(mac))
198
214
  return mac;
199
- const lin = join(HOME, ".config", "Code", "User");
200
- if (existsSync(lin))
201
- return lin;
202
- return join(HOME, ".vscode");
215
+ return join(HOME, ".config", "Code", "User");
203
216
  }
204
217
  const vscodeUserPath = () => join(vscodeUserDir(), "mcp.json");
205
218
  const cursorPath = () => join(HOME, ".cursor", "mcp.json");
@@ -220,13 +233,31 @@ function hasClaudeCli() {
220
233
  });
221
234
  return probe.status === 0;
222
235
  }
236
+ // Installed = its config dir exists (Claude Code: also the CLI on PATH), so a normal
237
+ // install needs no IDE question and never creates config for an app the user lacks.
238
+ function detectIdes() {
239
+ const marks = {
240
+ "claude-desktop": dirname(claudeDesktopPath()),
241
+ "claude-code": claudeJsonPath(),
242
+ cursor: join(HOME, ".cursor"),
243
+ windsurf: join(HOME, ".codeium", "windsurf"),
244
+ augment: vscodeUserDir(),
245
+ codex: join(HOME, ".codex"),
246
+ antigravity: dirname(antigravityPath()),
247
+ gemini: geminiPath(),
248
+ cline: dirname(dirname(clinePath())),
249
+ kiro: join(HOME, ".kiro"),
250
+ opencode: dirname(opencodePath()),
251
+ };
252
+ return Object.keys(marks).filter((id) => existsSync(marks[id]) || (id === "claude-code" && hasClaudeCli()));
253
+ }
223
254
  // ── per-IDE configure ────────────────────────────────────────────────────────
224
255
  function configureClaudeCode(launch, env) {
225
256
  info("Claude Code…");
226
257
  if (hasClaudeCli()) {
227
258
  spawnSync("claude", ["mcp", "remove", NAME], { stdio: "ignore" });
228
259
  const envFlags = Object.entries(env).flatMap(([k, v]) => ["-e", `${k}=${v}`]);
229
- const r = spawnSync("claude", ["mcp", "add", NAME, ...envFlags, "--", launch.command, ...launch.args], { stdio: "inherit" });
260
+ const r = spawnSync("claude", ["mcp", "add", "--scope", "user", NAME, ...envFlags, "--", launch.command, ...launch.args], { stdio: "inherit" });
230
261
  if (r.status === 0) {
231
262
  ok("Claude Code configured via CLI — verify: claude mcp list");
232
263
  return;
@@ -255,7 +286,7 @@ function configureWindsurf(launch, env) {
255
286
  }
256
287
  function configureAugment(launch, env) {
257
288
  info("Augment / VS Code…");
258
- if (mergeJson(vscodeUserPath(), launch, env))
289
+ if (mergeJson(vscodeUserPath(), launch, env, "servers"))
259
290
  ok(`VS Code configured (${vscodeUserPath()})`);
260
291
  }
261
292
  function configureCodexIde(launch, env) {
@@ -327,10 +358,17 @@ function runConfigure(ides, launch, env) {
327
358
  const targets = set.has("all") ? Object.keys(CONFIGURATORS) : [...set];
328
359
  for (const id of targets) {
329
360
  const configure = CONFIGURATORS[id];
330
- if (configure)
331
- configure(launch, env);
332
- else
361
+ if (!configure) {
333
362
  warn(`Unknown IDE: ${id}`);
363
+ continue;
364
+ }
365
+ // One broken client must not leave the others unconfigured.
366
+ try {
367
+ configure(launch, env);
368
+ }
369
+ catch (e) {
370
+ warn(`${id} skipped: ${e?.message ?? e}`);
371
+ }
334
372
  }
335
373
  }
336
374
  // ── uninstall ────────────────────────────────────────────────────────────────
@@ -339,8 +377,10 @@ function removeFromJson(file) {
339
377
  return;
340
378
  try {
341
379
  const cfg = JSON.parse(readFileSync(file, "utf8"));
342
- if (cfg.mcpServers && cfg.mcpServers[NAME]) {
343
- delete cfg.mcpServers[NAME];
380
+ const holders = [cfg.mcpServers, cfg.servers].filter((s) => s && s[NAME]);
381
+ if (holders.length) {
382
+ for (const s of holders)
383
+ delete s[NAME];
344
384
  writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
345
385
  ok(`Cleaned ${file}`);
346
386
  }
@@ -360,6 +400,7 @@ function uninstall() {
360
400
  cursorPath(),
361
401
  windsurfPath(),
362
402
  vscodeUserPath(),
403
+ join(HOME, ".vscode", "mcp.json"), // older versions wrote here; nothing reads it
363
404
  antigravityPath(),
364
405
  geminiPath(),
365
406
  clinePath(),
@@ -394,7 +435,8 @@ function printHelp() {
394
435
  ${c.bold}webcake-landing-mcp install${c.reset} — configure the MCP server in your IDE(s)
395
436
 
396
437
  ${c.bold}Usage${c.reset}
397
- npx -y ${PKG} install # interactive: pick environment, log in (or paste a JWT), pick IDEs
438
+ npx -y ${PKG} install # opens the browser: click Connect, installed IDEs get configured (prod)
439
+ npx -y ${PKG} install --dev # step by step: pick environment, log in (or paste a JWT), org, IDEs
398
440
  npx -y ${PKG} install --ide all # non-interactive, all IDEs (defaults to --env prod)
399
441
  npx -y ${PKG} install --ide claude-code --env local --jwt <JWT>
400
442
  npx -y ${PKG} uninstall # remove from every IDE config
@@ -402,6 +444,7 @@ ${c.bold}Usage${c.reset}
402
444
  ${c.bold}Flags${c.reset}
403
445
  --ide <list> comma list: claude-desktop, claude-code, cursor, windsurf, augment,
404
446
  codex, antigravity, gemini, cline, kiro, opencode, all
447
+ --dev developer wizard (asks environment, auth, org, IDEs)
405
448
  --env <name> WEBCAKE_ENV: local | staging | prod (default prod) — sets the API + app base URLs
406
449
  --jwt <token> WEBCAKE_JWT (account token; optional — or log in via the browser interactively)
407
450
  --org-id <id> WEBCAKE_ORG_ID (optional default organization)
@@ -422,11 +465,12 @@ export async function runInstaller(argv) {
422
465
  log(`\n${c.cyan}${c.bold}Webcake Landing MCP — installer${c.reset}`);
423
466
  log(`${c.gray}Build & edit Webcake landing pages from a prompt.${c.reset}`);
424
467
  const interactive = !o.ide && process.stdin.isTTY && process.stdout.isTTY;
468
+ const wizard = interactive && o.dev;
425
469
  // 1) environment — one choice sets the API + app base URLs (replaces the old
426
470
  // separate WEBCAKE_API_BASE / WEBCAKE_APP_BASE prompts). The global --env flag
427
471
  // / WEBCAKE_ENV is already validated in index.ts (applyEnvFlag).
428
472
  let envName = isEnvName(process.env.WEBCAKE_ENV) ? process.env.WEBCAKE_ENV : "prod";
429
- if (interactive && !isEnvName(process.env.WEBCAKE_ENV)) {
473
+ if (wizard && !isEnvName(process.env.WEBCAKE_ENV)) {
430
474
  log(`\n${c.bold}1) Environment${c.reset} ${c.gray}(sets the Webcake API + app URLs)${c.reset}`);
431
475
  log(` 1) prod ${c.gray}${ENVIRONMENTS.prod.apiBase}${c.reset} ${c.gray}(default)${c.reset}`);
432
476
  log(` 2) staging ${c.gray}${ENVIRONMENTS.staging.apiBase}${c.reset}`);
@@ -440,14 +484,17 @@ export async function runInstaller(argv) {
440
484
  // saved to ~/.webcake-landing-mcp/auth.json) or a pasted JWT. An explicit --jwt
441
485
  // skips the prompt; a non-TTY falls back to the WEBCAKE_JWT env var (for scripted
442
486
  // installs). Reference/validation tools work with no auth at all.
443
- let jwt = o.jwt ?? "";
444
- let authNote = jwt ? "JWT (from --jwt)" : "";
445
- if (interactive && !jwt) {
446
- log(`\n${c.bold}2) Authentication${c.reset} ${c.gray}(only needed to save pages to your account)${c.reset}`);
447
- log(` 1) Log in via browser ${c.gray}(recommended — opens Webcake, saves a token)${c.reset}`);
448
- log(` 2) Paste a JWT token`);
449
- log(` 3) Skip for now ${c.gray}(reference/validation tools still work)${c.reset}`);
450
- const pick = (await ask(" Select [1]: ")).trim() || "1";
487
+ let jwt = o.jwt ?? (wizard ? "" : process.env.WEBCAKE_JWT ?? "");
488
+ let authNote = o.jwt ? "JWT (from --jwt)" : "";
489
+ if (!o.ide && !jwt) {
490
+ let pick = "1";
491
+ if (wizard) {
492
+ log(`\n${c.bold}2) Authentication${c.reset} ${c.gray}(only needed to save pages to your account)${c.reset}`);
493
+ log(` 1) Log in via browser ${c.gray}(recommended — opens Webcake, saves a token)${c.reset}`);
494
+ log(` 2) Paste a JWT token`);
495
+ log(` 3) Skip for now ${c.gray}(reference/validation tools still work)${c.reset}`);
496
+ pick = (await ask(" Select [1]: ")).trim() || "1";
497
+ }
451
498
  if (pick === "1") {
452
499
  info(`Connecting to ${preset.appBase} …`);
453
500
  try {
@@ -455,22 +502,20 @@ export async function runInstaller(argv) {
455
502
  authNote = "browser login (saved to auth.json)";
456
503
  }
457
504
  catch (e) {
458
- warn(`Login didn't complete (${e?.message ?? e}). Paste a JWT now, or run \`${PKG} login\` later.`);
459
- jwt = (await ask(" WEBCAKE_JWT (or Enter to skip): ")).trim();
505
+ warn(`Login didn't complete (${e?.message ?? e}). Run \`npx -y ${PKG} login\` to connect later.`);
506
+ if (wizard)
507
+ jwt = (await ask(" WEBCAKE_JWT (or Enter to skip): ")).trim();
460
508
  }
461
509
  }
462
510
  else if (pick === "2") {
463
511
  jwt = (await ask(" WEBCAKE_JWT: ")).trim();
464
512
  }
465
513
  }
466
- else if (!interactive) {
467
- jwt = jwt || process.env.WEBCAKE_JWT || ""; // scripted / CI: fall back to ambient env
468
- }
469
514
  if (!authNote)
470
515
  authNote = jwt ? "JWT" : "none — reference tools only";
471
516
  // 3) optional default organization for create_page
472
517
  let orgId = o.orgId ?? process.env.WEBCAKE_ORG_ID ?? "";
473
- if (interactive && !orgId) {
518
+ if (wizard && !orgId) {
474
519
  orgId = (await ask(`\n${c.bold}3) WEBCAKE_ORG_ID${c.reset} ${c.gray}(optional, Enter to skip): ${c.reset}`)).trim();
475
520
  }
476
521
  // env block written into IDE configs: WEBCAKE_ENV drives the URLs. A pasted JWT is
@@ -493,7 +538,7 @@ export async function runInstaller(argv) {
493
538
  .map((s) => IDE_ALIASES[s.trim().toLowerCase()])
494
539
  .filter(Boolean);
495
540
  }
496
- else if (interactive) {
541
+ else if (wizard) {
497
542
  log(`\n${c.bold}4) Which IDE(s) to configure?${c.reset}`);
498
543
  log(" 1) Claude Desktop 2) Claude Code (CLI) 3) Cursor");
499
544
  log(" 4) Windsurf 5) Augment (VS Code) 6) Codex");
@@ -521,17 +566,21 @@ export async function runInstaller(argv) {
521
566
  .filter(Boolean);
522
567
  }
523
568
  else {
524
- warn("No --ide given and not a TTY. Nothing to configure.");
525
- printHelp();
526
- return;
569
+ ides = detectIdes();
527
570
  }
528
571
  if (!ides.length) {
529
- warn("No IDE selected — skipping configuration.");
572
+ if (wizard) {
573
+ warn("No IDE selected — skipping configuration.");
574
+ return;
575
+ }
576
+ warn("No AI app found on this computer (Claude, Cursor, VS Code…).");
577
+ log(`${c.gray} Install one and run this again, or name it: npx -y ${PKG} install --ide <name>${c.reset}\n`);
578
+ process.exitCode = 1;
530
579
  return;
531
580
  }
532
581
  // 5) write
533
582
  const launch = resolveLaunch(o);
534
- log(`\n${c.bold}5) Writing config${c.reset} ${c.gray}(launch: ${launch.command} ${launch.args.join(" ")})${c.reset}`);
583
+ log(`\n${c.bold}Writing config${c.reset} ${c.gray}(launch: ${launch.command} ${launch.args.join(" ")})${c.reset}`);
535
584
  runConfigure(ides, launch, env);
536
585
  // 6) summary
537
586
  log(`\n${c.green}${c.bold}✓ Done.${c.reset}`);
@@ -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 = "#06210f"; // text on the brand button
16
+ const TEXT_ACCENT = "#0c6a30"; // 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",
26
+ "s": "ý tưởng của bạn"
27
+ },
28
+ {
29
+ "t": "Trợ lý AI",
30
+ "s": "Claude · Cursor · Codex…"
31
+ },
32
+ {
33
+ "t": "Webcake MCP",
34
+ "s": "cầu nối thông minh"
35
+ },
36
+ {
37
+ "t": "Webcake",
38
+ "s": "trang web thật"
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: “Làm trang bán áo thun, tông cam ấm.”"
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ư tạo trang hay thêm một mục, 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": "Ảnh lớn, sản phẩm, nút đặt hàng lần lượt được lưu vào Webcake. Đây là trang thật, bạn vẫn sửa được trong trình chỉnh sửa."
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",
72
+ "s": "your idea"
73
+ },
74
+ {
75
+ "t": "AI assistant",
76
+ "s": "Claude · Cursor · Codex…"
77
+ },
78
+ {
79
+ "t": "Webcake MCP",
80
+ "s": "the smart bridge"
81
+ },
82
+ {
83
+ "t": "Webcake",
84
+ "s": "a real page"
85
+ }
86
+ ],
87
+ "steps": [
88
+ {
89
+ "t": "You say what you want",
90
+ "d": "Type in Claude, Cursor… like messaging a colleague: “Make a T-shirt sales page in warm orange.”"
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 creating a page or adding a section, 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": "The big image, products and order button are saved to Webcake 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
@@ -20,15 +20,17 @@
20
20
  * regenerated by scripts/render-og.mjs from `ogImageSvg`) — PNG because SVG OG
21
21
  * images don't unfurl on Facebook/X/LinkedIn/Zalo. `/og.svg` is still served too.
22
22
  *
23
- * Self-contained (inline CSS + the Webcake icon, no external assets/fonts/trackers)
24
- * so it loads instantly and leaks nothing.
23
+ * Inline CSS + the Webcake icon, no fonts or trackers, so it loads instantly. The only
24
+ * extra download is three.js from jsDelivr for the 3D scene, fetched when that section
25
+ * nears the viewport (see web-guide-scene.ts).
25
26
  */
26
27
  import { readFileSync } from "node:fs";
28
+ import { GLASS_CSS, SCENE_JS, sceneHtml } from "./web-guide-scene.js";
27
29
  import { ICON_SVG } from "./branding.js";
28
30
  const MCP_REMOTE_URL = "https://webcake.io/mcp-remote";
29
31
  // The "configure every IDE" one-liner — rendered as a code block (with a copy
30
32
  // button) rather than long inline code, which wrapped messily on mobile.
31
- const INSTALL_ALL_CMD = "npx -y webcake-landing-mcp install --ide all --env prod --jwt &lt;TOKEN&gt;";
33
+ const INSTALL_ALL_CMD = "npx -y webcake-landing-mcp install --ide all --jwt &lt;TOKEN&gt;";
32
34
  const GITHUB_URL = "https://github.com/vuluu2k/webcake-landing-mcp";
33
35
  const NPM_URL = "https://www.npmjs.com/package/webcake-landing-mcp";
34
36
  const DOCS_URL = `${GITHUB_URL}#readme`;
@@ -124,7 +126,7 @@ const FAQ = {
124
126
  },
125
127
  {
126
128
  q: "Thông tin của tôi có an toàn không?",
127
- a: "Có. Mã đăng nhập là của riêng bạn và không bị lưu lại. Ngoài ra, mỗi lần lưu trang công cụ đều cho bạn xem trước, chắc chắn rồi mới thực hiện.",
129
+ a: "Có. Mã đăng nhập là của riêng bạn: cài trên máy thì mã chỉ nằm trên máy bạn, dùng link thì mã nằm trong link của bạn. Ngoài ra, mỗi lần lưu trang công cụ đều cho bạn xem trước, chắc chắn rồi mới thực hiện.",
128
130
  },
129
131
  ],
130
132
  en: [
@@ -146,7 +148,7 @@ const FAQ = {
146
148
  },
147
149
  {
148
150
  q: "Is my information safe?",
149
- a: "Yes. Your login code is yours alone and is never stored. On top of that, every save shows you a preview first, so nothing happens until you're sure.",
151
+ a: "Yes. Your login code is yours alone: installed on your computer, it stays on your computer; with a link, it lives in your link. On top of that, every save shows you a preview first, so nothing happens until you're sure.",
150
152
  },
151
153
  ],
152
154
  };
@@ -160,13 +162,6 @@ const T = {
160
162
  ctaStart: "Bắt đầu kết nối",
161
163
  ctaStar: "Tặng sao trên GitHub",
162
164
  flowH2: "Mọi thứ diễn ra thế nào",
163
- flow: [
164
- { icon: "bulb", t: "Bạn", s: "ý tưởng của bạn" },
165
- { icon: "brain", t: "Trợ lý AI", s: "Claude · Cursor · Codex…" },
166
- { icon: "server", t: "Webcake MCP", s: "cầu nối thông minh" },
167
- { icon: "window", t: "Webcake", s: "trang web thật" },
168
- ],
169
- flowCap: "Bạn nói ý tưởng → AI hiểu cách Webcake hoạt động → tự dựng trang và tự kiểm tra → trang được lưu thật vào Webcake. Bạn nhận link, mở lên xem và đăng trang.",
170
165
  howH2: "Vì sao bạn không cần biết kỹ thuật",
171
166
  how: [
172
167
  {
@@ -244,10 +239,10 @@ const T = {
244
239
  m1Steps: [
245
240
  "<b>Cài Node.js</b> (miễn phí) nếu máy chưa có — tải tại <b>nodejs.org</b>. Đây là phần mềm giúp máy chạy được công cụ ở bước sau.",
246
241
  "<b>Mở Terminal</b> (cửa sổ gõ lệnh — trên Mac tìm “Terminal”, trên Windows tìm “Command Prompt”), dán dòng dưới đây rồi nhấn Enter:<pre>npx -y webcake-landing-mcp install</pre>",
247
- '<b>Làm theo hướng dẫn hiện ra:</b> chọn <code class="inl">prod</code> → đăng nhập Webcake bằng trình duyệt → chọn ứng dụng AI bạn đang dùng (Claude, Cursor…).',
242
+ '<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…).',
248
243
  '<b>Mở lại ứng dụng AI.</b> Thấy chữ <code class="inl">webcake-landing</code> xuất hiện là đã kết nối thành công.',
249
244
  ],
250
- m1Note: "Muốn cài cho tất cả ứng dụng cùng lúc, dùng dòng lệnh này:",
245
+ 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:",
251
246
  m2Tag: "Cách ② · Dùng link — không cần cài gì",
252
247
  m2Sub: "Phù hợp khi máy không cài được phần mềm, dùng theo nhóm, hoặc dùng Claude trên web (claude.ai).",
253
248
  m2Steps: [
@@ -303,13 +298,6 @@ const T = {
303
298
  ctaStart: "Get connected",
304
299
  ctaStar: "Star on GitHub",
305
300
  flowH2: "How it all happens",
306
- flow: [
307
- { icon: "bulb", t: "You", s: "your idea" },
308
- { icon: "brain", t: "AI assistant", s: "Claude · Cursor · Codex…" },
309
- { icon: "server", t: "Webcake MCP", s: "the smart bridge" },
310
- { icon: "window", t: "Webcake", s: "a real page" },
311
- ],
312
- flowCap: "You say your idea → the AI learns how Webcake works → it builds the page and checks it → the page is saved for real in Webcake. You get a link, open it, and publish.",
313
301
  howH2: "Why you don't need to be techy",
314
302
  how: [
315
303
  {
@@ -387,10 +375,10 @@ const T = {
387
375
  m1Steps: [
388
376
  "<b>Install Node.js</b> (free) if you don't have it — get it at <b>nodejs.org</b>. It's the program that lets your computer run the tool in the next step.",
389
377
  "<b>Open a terminal</b> (the command window — “Terminal” on Mac, “Command Prompt” on Windows), paste the line below and press Enter:<pre>npx -y webcake-landing-mcp install</pre>",
390
- '<b>Follow the prompts:</b> choose <code class="inl">prod</code> → sign in to Webcake in your browser → pick the AI app you use (Claude, Cursor…).',
378
+ '<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…).',
391
379
  '<b>Reopen your AI app.</b> When you see <code class="inl">webcake-landing</code> listed, you\'re connected.',
392
380
  ],
393
- m1Note: "Set it up for every app at once with this command:",
381
+ m1Note: "Need every app configured, even ones not on this computer yet, or running from a script? Use this command:",
394
382
  m2Tag: "Way ② · Use a link — nothing to install",
395
383
  m2Sub: "Best when you can't install software, work in a team, or use Claude on the web (claude.ai).",
396
384
  m2Steps: [
@@ -648,27 +636,7 @@ export function guideHtml(origin, lang = "vi") {
648
636
  .feat li{display:flex;gap:13px;align-items:center;font-size:.97rem;padding:13px 16px}
649
637
  .feat li b{color:var(--ink)}
650
638
  .cta-row{display:flex;gap:12px;flex-wrap:wrap;margin:22px 0 6px}
651
- /* Flow diagram: nodes connected by wires with a traveling "packet" */
652
- .flow{display:flex;align-items:flex-start;gap:0;padding:24px 18px 18px;overflow-x:auto}
653
- .flow .node{flex:0 0 auto;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;width:104px}
654
- .flow .node .ic{width:54px;height:54px;border-radius:16px}
655
- .flow .node .ic .i{width:27px;height:27px}
656
- .flow .node b{font-size:.93rem}
657
- .flow .node span{font-size:.75rem;color:var(--mut)}
658
- .flow .wire{flex:1 1 auto;min-width:30px;position:relative;height:2px;margin-top:27px;
659
- background:linear-gradient(90deg,var(--line),rgba(29,185,84,.45),var(--line))}
660
- .flow .wire .pkt{position:absolute;top:50%;left:0;width:9px;height:9px;margin:-5px 0 0 -4px;border-radius:50%;
661
- background:var(--g);box-shadow:0 0 9px 1px rgba(29,185,84,.7)}
662
- .flow .wire::after{content:"";position:absolute;right:-1px;top:50%;width:7px;height:7px;margin-top:-4px;
663
- border-top:2px solid var(--g7);border-right:2px solid var(--g7);transform:rotate(45deg)}
664
639
  .flow-cap{color:var(--mut);font-size:.9rem;margin:2px 2px 0;max-width:68ch}
665
- @media(prefers-reduced-motion:no-preference){
666
- .flow .wire .pkt{animation:pkt 2.4s ease-in-out infinite}
667
- @keyframes pkt{0%{left:0;opacity:0}12%{opacity:1}88%{opacity:1}100%{left:100%;opacity:0}}
668
- .flow .node .ic{animation:nodepop 2.4s ease-in-out infinite}
669
- }
670
- @media(prefers-reduced-motion:reduce){.flow .wire .pkt{display:none}}
671
- @keyframes nodepop{0%,100%{box-shadow:none}50%{box-shadow:0 0 0 4px rgba(29,185,84,.12)}}
672
640
  .btn{display:inline-flex;align-items:center;gap:9px;padding:11px 19px;border-radius:11px;cursor:pointer;
673
641
  background:var(--g);color:#fff;text-decoration:none;font-weight:700;font-size:.93rem;
674
642
  box-shadow:0 4px 12px -4px rgba(29,185,84,.5);transition:transform .15s ease,background .15s ease}
@@ -801,17 +769,6 @@ export function guideHtml(origin, lang = "vi") {
801
769
  .cl-wrap{padding:18px 16px 10px}
802
770
  .langsw{padding:6px 10px}
803
771
  .uses li,.feat li{padding:14px}
804
- /* Flow diagram: stack vertically (the horizontal row overflows narrow screens) */
805
- .flow{flex-direction:column;align-items:stretch;overflow:visible;padding:16px}
806
- .flow .node{flex-direction:row;width:auto;align-items:center;gap:13px;text-align:left}
807
- .flow .node .ic{width:44px;height:44px;border-radius:13px}
808
- .flow .node .ic .i{width:22px;height:22px}
809
- .flow .node b{font-size:.95rem}
810
- .flow .node span{font-size:.8rem}
811
- .flow .wire{flex:0 0 auto;width:2px;height:20px;min-width:0;margin:3px 0 3px 21px;
812
- background:linear-gradient(var(--line),var(--g))}
813
- .flow .wire::after{content:none}
814
- .flow .wire .pkt{display:none}
815
772
  }
816
773
  @media(prefers-reduced-motion:no-preference){
817
774
  /* One-shot reveal: JS adds .in the first time an element scrolls into view and
@@ -825,9 +782,10 @@ export function guideHtml(origin, lang = "vi") {
825
782
  .hero-in{animation:rise2 .8s cubic-bezier(.2,.7,.2,1) both}
826
783
  @keyframes rise2{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:none}}
827
784
  }
785
+ ${GLASS_CSS}
828
786
  </style></head>
829
787
  <body>
830
- <div class="blobs"><b></b><b></b></div>
788
+ <div class="blobs"><b></b><b></b><b></b></div>
831
789
  <div class="wrap">
832
790
 
833
791
  <header class="hero-in">
@@ -856,15 +814,7 @@ export function guideHtml(origin, lang = "vi") {
856
814
  </nav>
857
815
 
858
816
  <h2 id="flow" class="reveal">${t.flowH2}</h2>
859
- <div class="glass flow reveal">
860
- ${t.flow
861
- .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>` +
862
- (i < t.flow.length - 1
863
- ? `<div class="wire"><i class="pkt" style="animation-delay:${(i * 0.8).toFixed(1)}s"></i></div>`
864
- : ""))
865
- .join("\n ")}
866
- </div>
867
- <p class="flow-cap reveal">${t.flowCap}</p>
817
+ ${sceneHtml(L)}
868
818
 
869
819
  <h2 class="reveal">${t.howH2}</h2>
870
820
  <div class="grid">
@@ -1057,6 +1007,7 @@ export function guideHtml(origin, lang = "vi") {
1057
1007
  }
1058
1008
  })();
1059
1009
  </script>
1010
+ <script>${SCENE_JS}</script>
1060
1011
  </body></html>`;
1061
1012
  }
1062
1013
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-landing-mcp",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "description": "MCP server exposing Webcake landing-page element schemas + AI usage hints, and persisting LLM-generated page sources to a Webcake backend.",
5
5
  "mcpName": "io.github.vuluu2k/webcake-landing-mcp",
6
6
  "type": "module",