webcake-landing-mcp 1.6.1 → 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,18 @@
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
+ },
9
+ {
10
+ "v": "1.6.2",
11
+ "d": "27/10/2026",
12
+ "type": "Fixed",
13
+ "en": "expand now syncs a field element's properties.field_default with its specials.field_name, turning it on for the editor's system columns…",
14
+ "vi": "expand nay đồng bộ properties.field_default của field element theo specials.field_name: bật cho các cột hệ thống của editor (phone_number,…"
15
+ },
2
16
  {
3
17
  "v": "1.6.1",
4
18
  "d": "21/10/2026",
@@ -26,19 +40,5 @@
26
40
  "type": "Changed",
27
41
  "en": "Rewrote every tool and parameter description (new_element, new_page_skeleton, validate_page, layout, ingest_html, ingest_url, search_images,…",
28
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,…"
29
- },
30
- {
31
- "v": "1.5.9",
32
- "d": "13/10/2026",
33
- "type": "Fixed",
34
- "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…",
35
- "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…"
36
- },
37
- {
38
- "v": "1.5.8",
39
- "d": "13/10/2026",
40
- "type": "Fixed",
41
- "en": "The OAuth authorize endpoint now accepts http://localhost/127.0.0.1/[::1] redirect URIs on any port as long as the scheme, host, path, and query…",
42
- "vi": "Endpoint OAuth authorize nay chấp nhận redirect URI http://localhost/127.0.0.1/[::1] ở bất kỳ port nào miễn là scheme, host, path, và query khớp với…"
43
43
  }
44
44
  ]
@@ -58,7 +58,7 @@ export const FORM = [
58
58
  summary: "Single-line input. specials.field_name is the submitted data column (REQUIRED & unique).",
59
59
  useWhen: "Name/email/phone fields. Set field_type to text/email/phone/number. Must be a DIRECT child of the form to submit.",
60
60
  keySpecials: {
61
- field_name: "REQUIRED unique data key. Special names coerce the input type: 'phone_number'/'recheck_phone_number' → tel, 'email' → email. Phone pattern validation only applies when field_name=='phone_number' AND validate=true.",
61
+ field_name: "REQUIRED unique data key. Use the EXACT system names for standard columns — full_name, first_name, last_name, phone_number, recheck_phone_number, email, address, quantity, coupon, postal_code (never 'phone'/'name'/'sdt'/'ho_ten'): the editor locks those IDs and refuses them when typed, so a field saved as 'phone' can never be renamed to 'phone_number' there. Special names coerce the input type: 'phone_number'/'recheck_phone_number' → tel, 'email' → email. Phone pattern validation only applies when field_name=='phone_number' AND validate=true.",
62
62
  field_placeholder: "placeholder text.",
63
63
  field_type: "text | email | phone | number | postal_code | date. 'postal_code' enables postcode-detect helper and uses condition/pattern (country_default|limit_5|limit_6|custom). 'date' renders a date input.",
64
64
  required: "boolean.",
@@ -99,7 +99,7 @@ export const FORM = [
99
99
  desktop: { styles: { top: 60, left: 20, width: 360, height: 40 } },
100
100
  mobile: { styles: { top: 60, left: 20, width: 360, height: 40 } },
101
101
  },
102
- specials: { field_name: "phone", field_placeholder: "Số điện thoại", field_type: "phone", required: true },
102
+ specials: { field_name: "phone_number", field_placeholder: "Số điện thoại", field_type: "phone", required: true },
103
103
  },
104
104
  },
105
105
  {
@@ -389,3 +389,37 @@ export const FORM = [
389
389
  },
390
390
  },
391
391
  ];
392
+ /**
393
+ * The editor's SYSTEM form columns — the `default: true` fields of its "add
394
+ * field" panel (landing_page_backend assets/editor/main/panels/FormPanel.vue).
395
+ * The editor creates them with `properties.field_default = true`, which LOCKS
396
+ * the ID box (FieldTrait.vue `disabled`), and it refuses these names when typed
397
+ * (FieldTrait.vue `defaultFieldName` appends a random suffix). So a field must
398
+ * be BORN with the canonical name: a field saved as "phone" can never become
399
+ * "phone_number" in the editor, and only the canonical names get the editor's
400
+ * extra behaviour (phone validation, address autocomplete, quantity, coupon…).
401
+ */
402
+ export const SYSTEM_FIELD_NAMES = new Set([
403
+ "full_name", "first_name", "last_name", "phone_number", "recheck_phone_number",
404
+ "email", "quantity", "coupon", "address", "postal_code", "country_select",
405
+ "verify_code", "access_key", "province_id/district_id/commune_id",
406
+ ]);
407
+ /** Common hand-made spellings of a system column (slugged: lowercase, no accents, `_`). */
408
+ const SYSTEM_FIELD_ALIASES = {
409
+ phone: "phone_number", phonenumber: "phone_number", phone_no: "phone_number", tel: "phone_number",
410
+ telephone: "phone_number", mobile: "phone_number", sdt: "phone_number", so_dt: "phone_number",
411
+ so_dien_thoai: "phone_number", sodienthoai: "phone_number", dien_thoai: "phone_number", dienthoai: "phone_number",
412
+ name: "full_name", fullname: "full_name", your_name: "full_name", customer_name: "full_name",
413
+ ho_ten: "full_name", hoten: "full_name", ho_va_ten: "full_name", ten: "full_name",
414
+ firstname: "first_name", lastname: "last_name",
415
+ mail: "email", e_mail: "email", email_address: "email",
416
+ dia_chi: "address", diachi: "address",
417
+ so_luong: "quantity", soluong: "quantity", qty: "quantity",
418
+ ma_giam_gia: "coupon", voucher: "coupon",
419
+ };
420
+ /** The system column a non-canonical field_name was clearly meant to be, else undefined. */
421
+ export function systemFieldAlias(fieldName) {
422
+ const slug = fieldName.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/đ/gi, "d")
423
+ .toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
424
+ return SYSTEM_FIELD_ALIASES[slug];
425
+ }
@@ -2,6 +2,7 @@ import { CANVAS, EVENT_TRIGGERS, CLICK_ACTIONS, HOVER_ACTIONS, SUCCESS_ACTIONS,
2
2
  import { GENERATION_GUIDE } from "./guide.js";
3
3
  import { INSTRUCTIONS } from "./instructions.js";
4
4
  import { LIBRARY, ELEMENT_TYPES, CONTAINER_TYPES, FIELD_TYPES, createElement } from "./elements/index.js";
5
+ import { SYSTEM_FIELD_NAMES } from "./elements/form.js";
5
6
  import { createPageSource } from "./page.js";
6
7
  import { canvasToPageSource } from "./canvas-to-source.js";
7
8
  import { validatePage, coercePage, pageSchema } from "./validate.js";
@@ -389,6 +390,32 @@ function normalizeSettings(source) {
389
390
  ws.desktop ??= CANVAS.desktopWidth;
390
391
  ws.mobile ??= CANVAS.mobileWidth;
391
392
  }
393
+ // ---------------------------------------------------------------------------
394
+ // form-field lock normalization: the editor locks a field's ID box when
395
+ // `properties.field_default` is true (FieldTrait.vue `disabled`) and only ever
396
+ // sets it on its SYSTEM columns (phone_number, full_name, email…). A model that
397
+ // copies `field_default:true` onto a custom field ("message", "note") leaves
398
+ // the user an ID they can NEVER change; a system column without it is editable
399
+ // in a way the editor itself never allows. So the flag follows the name:
400
+ // on for system names, off for everything else. Deterministic + idempotent,
401
+ // so the expand(compact(x)) == expand(x) invariant holds.
402
+ // ---------------------------------------------------------------------------
403
+ /** Walk a tree node and sync properties.field_default with the field_name in-place (mutates). */
404
+ function normalizeFormFields(node) {
405
+ if (!node || typeof node !== "object")
406
+ return;
407
+ const fn = node.specials?.field_name;
408
+ if (FIELD_TYPES.has(node.type) && typeof fn === "string" && node.properties && typeof node.properties === "object") {
409
+ if (SYSTEM_FIELD_NAMES.has(fn))
410
+ node.properties.field_default = true;
411
+ else
412
+ delete node.properties.field_default;
413
+ }
414
+ if (Array.isArray(node.children)) {
415
+ for (const child of node.children)
416
+ normalizeFormFields(child);
417
+ }
418
+ }
392
419
  /** Apply all post-expand normalizations to every node in a page source. */
393
420
  function normalizeSource(source) {
394
421
  if (!source || typeof source !== "object")
@@ -405,6 +432,7 @@ function normalizeSource(source) {
405
432
  // url() layer in the same value.
406
433
  normalizeColors(node);
407
434
  normalizeBackgrounds(node);
435
+ normalizeFormFields(node);
408
436
  }
409
437
  }
410
438
  }
@@ -9,6 +9,7 @@
9
9
  import { readFileSync } from "node:fs";
10
10
  import Ajv2020Module from "ajv/dist/2020.js";
11
11
  import { CONTAINER_TYPES, FIELD_TYPES } from "./elements/index.js";
12
+ import { systemFieldAlias } from "./elements/form.js";
12
13
  import { ANIMATABLE_TYPES, ANIMATION_NAMES } from "./vocab.js";
13
14
  import { estTextHeightPx, measureTextBlock } from "./text-metrics.js";
14
15
  import { isColorKey, isUnparseableByEditor } from "./color.js";
@@ -316,6 +317,12 @@ export function validatePage(input) {
316
317
  if (!fn || typeof fn !== "string" || fn.trim() === "") {
317
318
  warnings.push(`${path} (${type}): form input should have a unique specials.field_name.`);
318
319
  }
320
+ else {
321
+ const canonical = systemFieldAlias(fn);
322
+ if (canonical && canonical !== fn) {
323
+ warnings.push(`${path} (${type}): field_name "${fn}" should be the system column "${canonical}" — the Webcake editor reserves system names (typing "${canonical}" there gets a random suffix), so the user can NEVER rename this field to "${canonical}" later, and only "${canonical}" gets the editor's built-in behaviour. Rename it now (also update any {{${fn}}} placeholder). On an EXISTING page this changes the submitted data column — ask the user first.`);
324
+ }
325
+ }
319
326
  // `field_placeholder` is the ONLY placeholder key the renderer reads. A stray
320
327
  // `placeholder` renders blank; a select with no field_placeholder crashes the
321
328
  // published renderer (unescapeHTML(undefined)).
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}`);
package/dist/smoke.js CHANGED
@@ -187,6 +187,36 @@ console.log("== expand: relocates misplaced responsive.<bp>.animation into confi
187
187
  const kept = landingDomain.expand(both).page[0].children[0].responsive.desktop;
188
188
  check("explicit config.animation wins over the stray key", kept.config.animation.name === "zoomIn" && kept.animation === undefined, kept.config);
189
189
  }
190
+ console.log("== form fields: field_default follows the system field_name; alias names warn ==");
191
+ {
192
+ // The editor locks a field's ID when properties.field_default is true and
193
+ // refuses system names when typed — so the lock must match the name, and a
194
+ // hand-made "phone" must be flagged before it is saved un-renameable.
195
+ const mk = (fields) => ({
196
+ page: [{ id: "s1", type: "section", responsive: { desktop: { styles: { height: 400 } }, mobile: { styles: { height: 400 } } },
197
+ children: [{ id: "f1", type: "form",
198
+ responsive: { desktop: { styles: { top: 10, left: 10, width: 400, height: 300 } }, mobile: { styles: { top: 10, left: 10, width: 400, height: 300 } } },
199
+ children: fields.map((f, i) => ({ id: `i${i}`, type: f.type ?? "input", properties: f.properties,
200
+ responsive: { desktop: { styles: { top: i * 50, left: 0, width: 300, height: 40 } }, mobile: { styles: { top: i * 50, left: 0, width: 300, height: 40 } } },
201
+ specials: { field_name: f.name, field_placeholder: "x" } })) }] }],
202
+ popup: [], settings: {},
203
+ });
204
+ const ex = landingDomain.expand(mk([
205
+ { name: "phone_number" },
206
+ { name: "message", properties: { field_default: true } },
207
+ { name: "phone" },
208
+ ]));
209
+ const kids = ex.page[0].children[0].children;
210
+ check("system field gets field_default:true", kids[0].properties.field_default === true, kids[0].properties);
211
+ check("custom field never locked", kids[1].properties.field_default === undefined, kids[1].properties);
212
+ check("field_default normalization idempotent", JSON.stringify(landingDomain.expand(ex)) === JSON.stringify(ex));
213
+ const w = validatePage(ex).warnings;
214
+ check("alias 'phone' warns → phone_number", w.some((m) => m.includes('"phone"') && m.includes('"phone_number"')), w);
215
+ check("canonical/custom names don't warn", !w.some((m) => m.includes('"message" should') || m.includes('"phone_number" should')), w);
216
+ const vi = landingDomain.expand(mk([{ name: "Số điện thoại" }, { name: "Họ tên" }]));
217
+ const wv = validatePage(vi).warnings;
218
+ check("Vietnamese aliases warn", wv.some((m) => m.includes('"phone_number"')) && wv.some((m) => m.includes('"full_name"')), wv);
219
+ }
190
220
  console.log("== validate: accepts JSON string input ==");
191
221
  const r3 = validatePage(JSON.stringify(good));
192
222
  check("string input parsed & valid", r3.valid, r3.errors);