webcake-landing-mcp 1.0.53 → 1.0.55
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 +49 -348
- package/README.vi.md +50 -321
- package/dist/auth/login.js +56 -21
- package/dist/changelog.json +14 -14
- package/dist/install.js +152 -40
- package/dist/persistence/config.js +9 -6
- package/dist/smoke.js +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ One sentence to your AI → a finished, **editable** WebCake page. A taste of wh
|
|
|
68
68
|
|
|
69
69
|
…then **"make the CTA green"** or **"add a 4th feature"** and it edits *only* that block — every other id and coordinate stays exactly where it was.
|
|
70
70
|
|
|
71
|
-
> 🤖 Works in **Claude Desktop, Claude Code, Cursor, Windsurf, Augment, Codex**, or any MCP-capable client — and the **reference + generation tools need zero setup**, so you can try it before ever pasting a token.
|
|
71
|
+
> 🤖 Works in **Claude Desktop, Claude Code, Cursor, Windsurf, Augment, Codex, Antigravity, Gemini CLI, Cline, Kiro, OpenCode**, or any MCP-capable client — and the **reference + generation tools need zero setup**, so you can try it before ever pasting a token.
|
|
72
72
|
|
|
73
73
|
---
|
|
74
74
|
|
|
@@ -82,8 +82,6 @@ valid element/page skeletons, a page validator, and tools to create or edit page
|
|
|
82
82
|
The AI agent produces the full `{ page, popup, settings, options, cartConfigs }` JSON; `create_page`
|
|
83
83
|
persists it (source-only — the page opens in the editor where re-saving renders it).
|
|
84
84
|
|
|
85
|
-
## Two ways to run
|
|
86
|
-
|
|
87
85
|
| Method | Best for | Auth |
|
|
88
86
|
|--------|----------|------|
|
|
89
87
|
| **npx (local)** — runs on your machine | Personal daily use, full control | browser `login`, a JWT, or none (reference tools) |
|
|
@@ -91,7 +89,7 @@ persists it (source-only — the page opens in the editor where re-saving render
|
|
|
91
89
|
|
|
92
90
|
The **reference + generation tools** (`get_generation_guide`, `list_elements`, `validate_page`, …) and the **ingest tools** (`ingest_html`, `ingest_url` — turn an existing HTML or URL into a layout anchor so the AI can recreate or adapt it) work with **zero config**; only the **persistence tools** (`create_page`, `update_page`, `add_section`, `patch_page`, `publish_page`, `list_pages`, `find_pages`, `get_page`, `list_organizations`) need a token. Credentials resolve in order: **per-request header → env var → saved `auth.json`** (`login`).
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
---
|
|
95
93
|
|
|
96
94
|
## 🚀 Get connected — the 2 main ways
|
|
97
95
|
|
|
@@ -99,58 +97,7 @@ Pick **one**. Both hand your AI tool (Claude, Cursor, …) the full Webcake land
|
|
|
99
97
|
|
|
100
98
|
### ① `npx` — runs on your machine (recommended for personal use)
|
|
101
99
|
|
|
102
|
-
Zero install, always the latest version. **One line** grabs your token *and* writes the IDE config:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
npx -y webcake-landing-mcp install
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Just want to run the server (configure by hand later)?
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
npx -y webcake-landing-mcp
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
✅ Best for: daily personal use, local development, full control. Needs Node.js 18+.
|
|
115
|
-
|
|
116
|
-
### ② Remote URL `…/mcp?jwt=` — hosted, nothing to install
|
|
117
|
-
|
|
118
|
-
Use the server we already host. Grab **your personal link** (your token is baked in) and paste it into your client's *Add custom connector* / config:
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
https://mcp.toolvn.io.vn/mcp?jwt=<YOUR_TOKEN>
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Two ways to get the link:
|
|
125
|
-
- **Easiest** — open **<https://webcake.io/mcp-remote>** in your Webcake dashboard → it builds & copies the link for you.
|
|
126
|
-
- **By hand** — see the step-by-step guide below.
|
|
127
|
-
|
|
128
|
-
You can also add extra params: `&env=prod`, `&org_id=…`, `&api_base=…`.
|
|
129
|
-
|
|
130
|
-
✅ Best for: no Node.js, team/shared use, the **claude.ai** connector dialog (URL-only, no headers).
|
|
131
|
-
⚠️ The link contains your personal token — treat it like a password, always use **HTTPS**.
|
|
132
|
-
|
|
133
|
-
> 📖 **Full hand-config for every IDE** (Claude Desktop, Claude Code, Cursor, Windsurf, claude.ai…) is in the
|
|
134
|
-
> step-by-step guide → **[docs/connect-mcp.md](docs/connect-mcp.md)** · Tiếng Việt: **[docs/ket-noi-mcp.md](docs/ket-noi-mcp.md)**.
|
|
135
|
-
|
|
136
|
-
## Install (npx)
|
|
137
|
-
|
|
138
|
-
Once published to npm, the server runs straight from the registry — no clone, no build:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
npx -y webcake-landing-mcp
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Or run the latest from GitHub (npx clones + builds via the `prepare` script on the fly):
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
npx -y github:vuluu2k/webcake-landing-mcp
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Auto-configure your IDE (`install` subcommand)
|
|
151
|
-
|
|
152
|
-
`npx` only **runs** the server — unlike the [shell installers](docs/manual-install.md), it does not
|
|
153
|
-
write the MCP config into your IDE. The bundled `install` subcommand does that step for you, no clone needed:
|
|
100
|
+
Zero install, always the latest version, needs Node.js 18+. **One line** grabs your token *and* writes the IDE config:
|
|
154
101
|
|
|
155
102
|
```bash
|
|
156
103
|
# Interactive — pick environment, log in via browser (or paste a JWT), pick IDE(s)
|
|
@@ -159,279 +106,85 @@ npx -y webcake-landing-mcp install
|
|
|
159
106
|
# Non-interactive — configure every supported IDE at once (env + token via flags)
|
|
160
107
|
npx -y webcake-landing-mcp install --ide all --env prod --jwt <your-jwt>
|
|
161
108
|
|
|
162
|
-
# Local dev — point at your local stack (localhost:5800 / :5173)
|
|
163
|
-
npx -y webcake-landing-mcp install --ide cursor --env local --jwt <your-jwt>
|
|
164
|
-
|
|
165
109
|
# Remove the server from every IDE config
|
|
166
110
|
npx -y webcake-landing-mcp uninstall
|
|
167
111
|
```
|
|
168
112
|
|
|
169
|
-
It writes a `webcake-landing` entry
|
|
170
|
-
|
|
171
|
-
or `all`.
|
|
172
|
-
app
|
|
173
|
-
`--org-id`, `--api-base`/`--app-base` (advanced overrides), `--npx`/`--local`, `-y`. Run
|
|
174
|
-
`npx -y webcake-landing-mcp install --help` for the full list.
|
|
175
|
-
|
|
176
|
-
### Manual config
|
|
177
|
-
|
|
178
|
-
The MCP config is the same as the local one, but `command`/`args` point at `npx` instead of a built file:
|
|
179
|
-
|
|
180
|
-
```json
|
|
181
|
-
{
|
|
182
|
-
"mcpServers": {
|
|
183
|
-
"webcake-landing": {
|
|
184
|
-
"command": "npx",
|
|
185
|
-
"args": ["-y", "webcake-landing-mcp"],
|
|
186
|
-
"env": {
|
|
187
|
-
"WEBCAKE_ENV": "prod",
|
|
188
|
-
"WEBCAKE_JWT": "<your-jwt>"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
```
|
|
113
|
+
It writes a `webcake-landing` entry into the right config file for each target: `claude-desktop`,
|
|
114
|
+
`claude-code`, `cursor`, `windsurf`, `augment` (VS Code), `codex`, `antigravity`, `gemini` (Gemini CLI),
|
|
115
|
+
`cline`, `kiro`, `opencode`, or `all`. Flags: `--ide`, `--env`, `--jwt`, `--org-id`,
|
|
116
|
+
`--api-base`/`--app-base`, `--npx`/`--local`, `-y` — see `install --help`.
|
|
194
117
|
|
|
195
|
-
|
|
196
|
-
> (`webcake-landing-mcp@1.0.0`) if you need a reproducible build.
|
|
118
|
+
Just want to run the server (configure by hand later)? `npx -y webcake-landing-mcp`
|
|
197
119
|
|
|
198
|
-
|
|
120
|
+
> 🛠️ Hand-written per-IDE config, shell-script installers (`install.sh`/`install.ps1`), or a cloned
|
|
121
|
+
> local build → **[docs/manual-install.md](docs/manual-install.md)**.
|
|
199
122
|
|
|
200
|
-
|
|
201
|
-
machine to keep awake. Just point your AI client at the URL and go.
|
|
123
|
+
### ② Remote URL `…/mcp?jwt=` — hosted, nothing to install
|
|
202
124
|
|
|
203
|
-
|
|
204
|
-
and
|
|
125
|
+
The server is **already live** at `https://mcp.toolvn.io.vn/mcp` — no Node.js, no machine to keep awake.
|
|
126
|
+
Grab **your personal link** (your token is baked in) and paste it into your client's *Add custom connector* / config:
|
|
205
127
|
|
|
206
128
|
```
|
|
207
129
|
https://mcp.toolvn.io.vn/mcp?jwt=<YOUR_TOKEN>
|
|
208
130
|
```
|
|
209
131
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
### Sending the token as a header (safer)
|
|
214
|
-
|
|
215
|
-
Clients that support headers should send the token as a header instead of putting it in the URL (so it never
|
|
216
|
-
lands in logs). Any header that's missing falls back to the matching env var:
|
|
217
|
-
|
|
218
|
-
| Header | Maps to | Notes |
|
|
219
|
-
|--------|---------|-------|
|
|
220
|
-
| `x-webcake-jwt` (or `Authorization: Bearer <jwt>`) | `WEBCAKE_JWT` | the account token — sent per request |
|
|
221
|
-
| `x-webcake-env` | `WEBCAKE_ENV` | named environment (`local`/`staging`/`prod`) |
|
|
222
|
-
| `x-webcake-org-id` | `WEBCAKE_ORG_ID` | default org |
|
|
223
|
-
| `x-webcake-api-base` | `WEBCAKE_API_BASE` | overrides the env preset's API base |
|
|
224
|
-
| `x-webcake-app-base` | `WEBCAKE_APP_BASE` | overrides the env preset's SPA base (login connect page) |
|
|
225
|
-
| `x-webcake-builder-base` | `WEBCAKE_BUILDER_BASE` | overrides the builder host used for editor links |
|
|
226
|
-
| `x-webcake-preview-base` | `WEBCAKE_PREVIEW_BASE` | overrides the public preview host used for `/preview/<id>` links |
|
|
227
|
-
|
|
228
|
-
> The reference + generation tools (`get_generation_guide`, `list_elements`, `validate_page`, …) need **no
|
|
229
|
-
> token** — only the persistence tools (`create_page`, `update_page`, …) use it. Without a JWT, those return
|
|
230
|
-
> `missing_env` instead of touching the network.
|
|
231
|
-
|
|
232
|
-
> 📖 **Full step-by-step for every IDE** (Claude Desktop, Claude Code, Cursor, Windsurf, claude.ai) →
|
|
233
|
-
> **[docs/connect-mcp.md](docs/connect-mcp.md)** · Tiếng Việt: **[docs/ket-noi-mcp.md](docs/ket-noi-mcp.md)**.
|
|
234
|
-
|
|
235
|
-
## Connect once — grab your token automatically (`login`)
|
|
236
|
-
|
|
237
|
-
Instead of copying a JWT by hand, run:
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
# Production — zero config (defaults: connect via webcake.io, API via api.webcake.io):
|
|
241
|
-
npx -y webcake-landing-mcp login
|
|
242
|
-
|
|
243
|
-
# Local dev / staging — pick a named environment (see Environments below):
|
|
244
|
-
node dist/index.js login --env local # SPA :5173 + API :5800
|
|
245
|
-
node dist/index.js login --env staging # staging.webcake.io + api.staging.webcake.io
|
|
246
|
-
|
|
247
|
-
# …or point at custom URLs explicitly (these override --env):
|
|
248
|
-
node dist/index.js login \
|
|
249
|
-
--connect-url http://localhost:5173/mcp-connect \
|
|
250
|
-
--api-base http://localhost:5800
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
It opens your browser → (log into Webcake if needed) → the token is saved to
|
|
254
|
-
`~/.webcake-landing-mcp/auth.json`, which the server then reads automatically.
|
|
255
|
-
|
|
256
|
-
You're already logged in to Webcake in your browser, so `login` just opens a Webcake "connect"
|
|
257
|
-
page that reads your **`ljwt`** (landing) cookie and hands the token back to a localhost callback —
|
|
258
|
-
no copy-paste. The saved token is then read automatically (env vars still take precedence).
|
|
259
|
-
The landing JWT lasts ~90 days, so you rarely reconnect.
|
|
260
|
-
|
|
261
|
-
Two URLs, don't mix them up:
|
|
262
|
-
|
|
263
|
-
- **Connect page = the SPA** (`--connect-url`): derived from the `--env` app base + `/mcp-connect`
|
|
264
|
-
(`https://webcake.io/mcp-connect` for prod, `http://localhost:5173/mcp-connect` for local). Override with `--connect-url`.
|
|
265
|
-
- **API base = the backend** (`--api-base` / `WEBCAKE_API_BASE`): `https://api.webcake.io` in prod,
|
|
266
|
-
`http://localhost:5800` locally. Defaults to `https://api.webcake.io`.
|
|
267
|
-
|
|
268
|
-
Other flags: `--org-id`, `--port`, `--no-open`. Saved-file dir: `WEBCAKE_CONFIG_DIR` (default
|
|
269
|
-
`~/.webcake-landing-mcp`).
|
|
270
|
-
|
|
271
|
-
**Backend endpoint to add** (in your Webcake backend — it owns the session cookie):
|
|
272
|
-
|
|
273
|
-
```
|
|
274
|
-
GET /mcp-connect?redirect_uri=<loopback>&state=<s>
|
|
275
|
-
→ read the `ljwt` cookie (the logged-in user's landing token)
|
|
276
|
-
→ 302 to <redirect_uri>?token=<ljwt>&state=<s>
|
|
277
|
-
(if there's no cookie: 302 to the login page first, then back here)
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
For safety, only honor `redirect_uri` values on `http://127.0.0.1:*` / `http://localhost:*`.
|
|
281
|
-
(Reference implementation: `builderx_spa/src/views/McpConnect.vue` reads `cookies.get('ljwt')` — so this
|
|
282
|
-
flow can also be done entirely in the SPA, no backend route needed.)
|
|
283
|
-
|
|
284
|
-
> Multi-user remote (the claude.ai connector dialog) can't do this browser loopback — there each
|
|
285
|
-
> user sends their own token via the `x-webcake-jwt` header (see the hosted-server section above).
|
|
286
|
-
|
|
287
|
-
## Environment Variables
|
|
288
|
-
|
|
289
|
-
| Variable | Required | Description |
|
|
290
|
-
|----------|----------|-------------|
|
|
291
|
-
| `WEBCAKE_ENV` | No | Named environment: `local` \| `staging` \| `prod`. Fills in `WEBCAKE_API_BASE` + `WEBCAKE_APP_BASE` from a preset (see table below). Also settable with the `--env <name>` flag. Explicit vars win. |
|
|
292
|
-
| `WEBCAKE_API_BASE` | No* | Backend base URL, e.g. `http://localhost:5800`. Required to persist (or set `WEBCAKE_ENV`). |
|
|
293
|
-
| `WEBCAKE_JWT` | No* | Account JWT (dashboard auth). Required to persist — expires, refresh when needed. |
|
|
294
|
-
| `WEBCAKE_ORG_ID` | No | Default organization id for `create_page` (overridden by its `organization_id` arg). Omit → personal page. |
|
|
295
|
-
| `WEBCAKE_APP_BASE` | No | Optional SPA base — used for the browser `login` connect page. |
|
|
296
|
-
| `WEBCAKE_BUILDER_BASE` | No | Optional builder host for the editor links in the result. Defaults to the env preset, else derived from the API host (`api.x`→`builder.x`). |
|
|
297
|
-
| `WEBCAKE_PREVIEW_BASE` | No | Optional public preview host for the `/preview/<id>` links — NOT the builder subdomain. Defaults to the env preset (`preview.localhost:5800` local / `staging.webcake.me` staging / `www.webcake.me` prod). |
|
|
298
|
-
| `WEBCAKE_CONFIG_DIR` | No | Dir for the saved `auth.json` written by `login` (default `~/.webcake-landing-mcp`). |
|
|
299
|
-
|
|
300
|
-
> \* `WEBCAKE_API_BASE` and `WEBCAKE_JWT` are only needed for the persistence tools. The reference and
|
|
301
|
-
> validation tools (`get_generation_guide`, `list_elements`, `get_element`, `validate_page`, …) work without them.
|
|
132
|
+
Two ways to get the link:
|
|
133
|
+
- **Easiest** — open **<https://webcake.io/mcp-remote>** in your Webcake dashboard → it builds & copies the link for you.
|
|
134
|
+
- **By hand** — see the step-by-step guide: **[docs/connect-mcp.md](docs/connect-mcp.md)**.
|
|
302
135
|
|
|
303
|
-
|
|
304
|
-
|
|
136
|
+
Optional extras: `&env=prod`, `&org_id=…`, `&api_base=…`. Hand each teammate a link with their own `jwt` →
|
|
137
|
+
per-user, no OAuth. Clients that support headers should send the token as **`x-webcake-jwt`** instead of
|
|
138
|
+
putting it in the URL — the full header ↔ env mapping is in **[docs/configuration.md](docs/configuration.md#per-request-headers-hosted--remote-server)**.
|
|
305
139
|
|
|
306
|
-
|
|
140
|
+
✅ Best for: no Node.js, team/shared use, the **claude.ai** connector dialog (URL-only, no headers).
|
|
141
|
+
⚠️ The link contains your personal token — treat it like a password, always use **HTTPS**.
|
|
307
142
|
|
|
308
|
-
|
|
309
|
-
truth for the API + app bases:
|
|
143
|
+
---
|
|
310
144
|
|
|
311
|
-
|
|
312
|
-
|-------------------------|-------------------------------|-------------------------------|----------------------------------------|
|
|
313
|
-
| `local` | `http://localhost:5800` | `http://localhost:5173` | `http://builder.localhost:5800` |
|
|
314
|
-
| `staging` | `https://api.staging.webcake.io` | `https://staging.webcake.io` | `https://builder.staging.webcake.io` |
|
|
315
|
-
| `prod` | `https://api.webcake.io` | `https://webcake.io` | `https://builder.webcake.io` |
|
|
145
|
+
## ⚙️ Configuration
|
|
316
146
|
|
|
317
|
-
|
|
147
|
+
The quick version — only the **persistence tools** need any of this:
|
|
318
148
|
|
|
319
149
|
```bash
|
|
320
|
-
npx -y webcake-landing-mcp login
|
|
321
|
-
WEBCAKE_ENV=staging npx -y webcake-landing-mcp # run against the staging backend
|
|
322
|
-
WEBCAKE_ENV=prod npx -y webcake-landing-mcp # prod (env var form)
|
|
150
|
+
npx -y webcake-landing-mcp login # opens the browser once, saves the token to ~/.webcake-landing-mcp/auth.json
|
|
323
151
|
```
|
|
324
152
|
|
|
325
|
-
|
|
326
|
-
by field. On the hosted server you can override the environment per request with the
|
|
327
|
-
**`x-webcake-env`** header or **`?env=`** query (e.g. `…/mcp?jwt=<token>&env=staging`).
|
|
153
|
+
…or set `WEBCAKE_ENV` (`local` | `staging` | `prod` — fills in all base URLs) + `WEBCAKE_JWT`.
|
|
328
154
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
2. Open DevTools (`F12` or `Cmd + Option + I`)
|
|
333
|
-
3. Go to the **Network** tab > click any page
|
|
334
|
-
4. Find an API request (e.g. `@me`, `organizations`…)
|
|
335
|
-
5. In **Request Headers**, copy the value after `Authorization: Bearer ` → this is your `WEBCAKE_JWT`
|
|
336
|
-
6. Use the `list_organizations` tool to list orgs and pick `WEBCAKE_ORG_ID`
|
|
155
|
+
Everything else — the full env-var table, environment presets, per-request headers for the hosted
|
|
156
|
+
server, the `login` browser flow (+ backend contract), and how to grab a JWT by hand — lives in
|
|
157
|
+
**[docs/configuration.md](docs/configuration.md)**.
|
|
337
158
|
|
|
338
159
|
---
|
|
339
160
|
|
|
340
|
-
##
|
|
341
|
-
|
|
342
|
-
The npx **`install`** subcommand (above) writes the right config for each IDE automatically. For
|
|
343
|
-
hand-written config (Claude Desktop, Claude Code, Cursor, Windsurf, Augment, Codex) and the
|
|
344
|
-
cloned-build variants, see **[docs/manual-install.md](docs/manual-install.md#configuration-by-ide--ai-tool)**.
|
|
345
|
-
|
|
346
|
-
## Usage Examples
|
|
161
|
+
## 📚 Docs
|
|
347
162
|
|
|
348
|
-
|
|
349
|
-
|
|
163
|
+
| Guide | What's inside |
|
|
164
|
+
|-------|---------------|
|
|
165
|
+
| **[Connect your IDE / claude.ai](docs/connect-mcp.md)** | Step-by-step connection for every client (npx & hosted URL), troubleshooting table. |
|
|
166
|
+
| **[Configuration](docs/configuration.md)** | Env vars, `--env` presets, browser `login`, per-request headers, getting a JWT. |
|
|
167
|
+
| **[Tools reference](docs/tools.md)** | All 19 tools in detail + the step-by-step workflow + model notes. |
|
|
168
|
+
| **[Usage examples](docs/usage-examples.md)** | Three end-to-end walkthroughs: build from a brief, surgical edit, inspect a type. |
|
|
169
|
+
| **[Manual / advanced install](docs/manual-install.md)** | Shell installers, cloned builds, hand-written per-IDE config. |
|
|
170
|
+
| **[Page-element schema](docs/page-element-schema.md)** | The full element-model reference (+ [every special/event](docs/element-specials-reference.md)). |
|
|
350
171
|
|
|
351
172
|
---
|
|
352
173
|
|
|
353
|
-
##
|
|
174
|
+
## 🧰 The tools at a glance
|
|
354
175
|
|
|
355
|
-
|
|
356
|
-
**generation** (build valid nodes), and **persistence** (save to the backend — needs env vars).
|
|
176
|
+
19 tools in five groups — full descriptions in **[docs/tools.md](docs/tools.md)**:
|
|
357
177
|
|
|
358
|
-
|
|
178
|
+
| Group | Tools | Needs |
|
|
179
|
+
|-------|-------|-------|
|
|
180
|
+
| **Reference** | `get_generation_guide` · `list_elements` · `get_element` · `get_page_schema` | nothing |
|
|
181
|
+
| **Generation** | `new_element` · `new_page_skeleton` · `validate_page` | nothing |
|
|
182
|
+
| **Media** | `search_images` (real Pexels stock photos) | nothing (optional own key) |
|
|
183
|
+
| **Ingest** | `ingest_html` · `ingest_url` (recreate an existing page) | nothing |
|
|
184
|
+
| **Persistence** | `list_organizations` · `create_page` · `list_pages` · `find_pages` · `get_page` · `update_page` · `add_section` · `patch_page` · `publish_page` | `WEBCAKE_API_BASE` + `WEBCAKE_JWT` |
|
|
359
185
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
```
|
|
364
|
-
get_generation_guide({})
|
|
365
|
-
→ "## Output shape… ## Canvas… ## Events… ## Workflow…"
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### Step 2: Browse the element catalog — `list_elements` / `get_element`
|
|
369
|
-
|
|
370
|
-
```
|
|
371
|
-
# All element types by category (summary + when-to-use + is it a container?)
|
|
372
|
-
list_elements({})
|
|
373
|
-
→ { categories: { layout: [...], content: [...], form: [...], ... } }
|
|
374
|
-
|
|
375
|
-
# Deep-dive one type — hints, key specials, default skeleton, filled example
|
|
376
|
-
get_element({ type: "button" })
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
### Step 3: Get valid building blocks — `new_element` / `new_page_skeleton`
|
|
380
|
-
|
|
381
|
-
```
|
|
382
|
-
# A structurally-valid default node for a type (fresh id)
|
|
383
|
-
new_element({ type: "section" })
|
|
384
|
-
|
|
385
|
-
# An empty but complete top-level source
|
|
386
|
-
new_page_skeleton({})
|
|
387
|
-
→ { page: [], popup: [], settings: {…}, options: { currency, mobileOnly, versionID }, cartConfigs: {} }
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
### Step 4: Inspect / validate — `get_page_schema` / `validate_page`
|
|
391
|
-
|
|
392
|
-
```
|
|
393
|
-
# Full JSON Schema (Draft 2020-12) of a page source
|
|
394
|
-
get_page_schema({})
|
|
395
|
-
|
|
396
|
-
# Structural + semantic validation — fix every error before persisting
|
|
397
|
-
validate_page({ source })
|
|
398
|
-
→ { ok: false, errors: [...], warnings: [...] }
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
`validate_page` **errors are blocking**; warnings (dangling event target, missing `field_name`) are advisory.
|
|
402
|
-
|
|
403
|
-
### Step 5: Persist — `list_organizations` / `create_page` / `update_page`
|
|
404
|
-
|
|
405
|
-
```
|
|
406
|
-
# List the account's organizations — ask which to use; default = the is_default org
|
|
407
|
-
list_organizations({})
|
|
408
|
-
→ [{ id: "org_1", name: "Acme", is_default: true }, ...]
|
|
409
|
-
|
|
410
|
-
# Create a NEW page (source-only). Defaults to dry_run=true.
|
|
411
|
-
create_page({ source, organization_id: "org_1" }) # preview
|
|
412
|
-
create_page({ source, dry_run: false }) # actually create
|
|
413
|
-
|
|
414
|
-
# Edit an EXISTING page
|
|
415
|
-
list_pages({}) # find the page
|
|
416
|
-
get_page({ page_id }) # fetch decoded source
|
|
417
|
-
update_page({ page_id, source, dry_run: false }) # overwrite (dry_run=true by default)
|
|
418
|
-
|
|
419
|
-
# Build a LARGE page incrementally (avoids the giant single create_page payload
|
|
420
|
-
# that can drop the connection): small skeleton first, then one section at a time.
|
|
421
|
-
create_page({ source: smallSkeleton, dry_run: false }) # → page_id
|
|
422
|
-
add_section({ page_id, sections: heroSection }) # dry_run=true → validates + returns draft_id
|
|
423
|
-
add_section({ page_id, draft_id, dry_run: false }) # re-run with draft_id — no re-send of sections
|
|
424
|
-
add_section({ page_id, sections: [formSection, footerSection], dry_run: false }) # or skip dry-run entirely
|
|
425
|
-
|
|
426
|
-
# Go LIVE (the preview link works without this — publish to attach a domain / set live status)
|
|
427
|
-
publish_page({ page_id, custom_domain: "shop.example.com", custom_path: "sale", dry_run: false })
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
`create_page` calls **`POST {WEBCAKE_API_BASE}/api/v1/ai/create_page_from_source`** on the backend.
|
|
431
|
-
Both `create_page` and `update_page` **default to `dry_run=true`** (validate and return the request they
|
|
432
|
-
*would* send, JWT masked); set `dry_run=false` to actually write. The result returns `page_id` + editor/preview URLs.
|
|
433
|
-
|
|
434
|
-
---
|
|
186
|
+
Every write **defaults to `dry_run=true`** — it previews the exact request (token masked) and only
|
|
187
|
+
touches your account when you re-run with `dry_run=false`.
|
|
435
188
|
|
|
436
189
|
## Suggested prompt
|
|
437
190
|
|
|
@@ -442,58 +195,6 @@ Both `create_page` and `update_page` **default to `dry_run=true`** (validate and
|
|
|
442
195
|
|
|
443
196
|
---
|
|
444
197
|
|
|
445
|
-
## Available Tools
|
|
446
|
-
|
|
447
|
-
### Reference (no config needed)
|
|
448
|
-
| Tool | Description |
|
|
449
|
-
|------|-------------|
|
|
450
|
-
| `get_generation_guide` | **Read FIRST.** Output shape, coordinate system, event vocabulary, workflow. |
|
|
451
|
-
| `list_elements` | All element types by category (summary + when-to-use + container?). |
|
|
452
|
-
| `get_element` | One type (or many at once): hints, key `specials`, a SPARSE skeleton (the exact shape to emit — the server hydrates omitted boilerplate), filled example. |
|
|
453
|
-
| `get_page_schema` | Full JSON Schema (Draft 2020-12) of a page source. |
|
|
454
|
-
|
|
455
|
-
### Generation
|
|
456
|
-
| Tool | Description |
|
|
457
|
-
|------|-------------|
|
|
458
|
-
| `new_element` | A default node for a type (fresh id) in the SPARSE authoring shape — copy it as-is; omitted boilerplate is hydrated server-side. |
|
|
459
|
-
| `new_page_skeleton` | An empty but complete top-level source `{ page, popup, settings, options, cartConfigs }`. |
|
|
460
|
-
| `validate_page` | Structural + semantic validation (ids, event targets, containers, `field_name`). |
|
|
461
|
-
|
|
462
|
-
### Media (works out of the box; optional Pexels key)
|
|
463
|
-
| Tool | Description |
|
|
464
|
-
|------|-------------|
|
|
465
|
-
| `search_images` | Find REAL stock photos (Pexels) for a page — returns hotlinkable URLs at several sizes to drop into an image element's `specials.src`. Works with **no setup** (a shared hosted proxy supplies images); set `PEXELS_API_KEY` env or the `x-pexels-key` header to use your own [free Pexels key](https://www.pexels.com/api/) / quota. |
|
|
466
|
-
|
|
467
|
-
### Persistence (needs `WEBCAKE_API_BASE` + `WEBCAKE_JWT`)
|
|
468
|
-
| Tool | Description |
|
|
469
|
-
|------|-------------|
|
|
470
|
-
| `list_organizations` | List the account's organizations (id, name, is_default). Default = the `is_default` org. |
|
|
471
|
-
| `create_page` | Persist a generated source as a new page (source-only). Validates, caches the source as `draft_id`, then creates. On validation failure, timeout, or network error the draft is kept — retry via `create_page({ draft_id, dry_run:false })` or fix via `patch_page({ draft_id, patches })`. **Defaults to `dry_run=true`.** |
|
|
472
|
-
| `list_pages` | List the account's pages (id, name, organization_id, updated_at) to pick one to edit. |
|
|
473
|
-
| `find_pages` | Search the account's pages by name, domain, and/or page id (AND-combined) to locate one to edit; returns id, name, org, custom/default domain, updated_at. |
|
|
474
|
-
| `get_page` | Fetch an existing page's decoded source tree, COMPACTED to the sparse authoring shape (factory-default boilerplate stripped — far fewer tokens; `compact:false` for the raw tree). Edit and send back as-is. |
|
|
475
|
-
| `update_page` | Overwrite an existing page's source with an edited tree. Validates, caches the source as `draft_id`, then saves. On timeout or failure the draft is kept — retry via `update_page({ draft_id, dry_run:false })` or `patch_page({ draft_id, dry_run:false })` (no patches). **Defaults to `dry_run=true`.** |
|
|
476
|
-
| `add_section` | Append section(s) to an existing page without re-sending the whole source (incremental-build path). Always caches the batch as `draft_id`; re-run with `{ page_id, draft_id, dry_run:false }` — no need to re-send sections. Validation failure, timeout, or network error also keeps the draft — fix via `patch_page({ draft_id, patches })` or retry `patch_page({ draft_id, dry_run:false })` with no patches. **Defaults to `dry_run=true`.** |
|
|
477
|
-
| `patch_page` | Edit a page by element id without re-sending the whole source. Targets a live page (`page_id`) OR a cached draft (`draft_id`). Draft kinds: `create_page` (creates page once valid), `add_section` (appends once valid), `update_page`/live-patch (retries updatePageSource). **Empty/omitted patches + `draft_id` = commit-as-is (the universal timeout-retry path).** Live-page path pre-caches the patched source before the network call and returns `draft_id` for recovery. **Defaults to `dry_run=true`.** |
|
|
478
|
-
| `publish_page` | Publish a page (live status, optional custom domain/path). The preview link works WITHOUT publishing — publish only to go live. **Defaults to `dry_run=true`.** |
|
|
479
|
-
|
|
480
|
-
---
|
|
481
|
-
|
|
482
|
-
## Model notes
|
|
483
|
-
|
|
484
|
-
- **Absolute-positioning canvas:** every child carries numeric `top/left/width/height` per breakpoint;
|
|
485
|
-
sections stack vertically and own a `height`. Content lives in `specials` (`text`, `src`, …), never in `styles`.
|
|
486
|
-
- **Top-level source:** `{ page: [sections], popup: [popups], settings: {…}, options: { currency, mobileOnly, versionID }, cartConfigs: {} }`.
|
|
487
|
-
Popups are a **separate** top-level array, not nested in `page`.
|
|
488
|
-
- Per-breakpoint animation lives in `config.animation = { name, delay, duration, repeat }`.
|
|
489
|
-
- Colors are `rgba()`; `top/left/width/height/fontSize` are numbers (px); form inputs need a unique `specials.field_name`.
|
|
490
|
-
|
|
491
|
-
Reference: [docs/page-element-schema.md](docs/page-element-schema.md) and
|
|
492
|
-
[src/domains/landing/page-schema.json](src/domains/landing/page-schema.json) (the bundled JSON Schema, Draft 2020-12). The schema mirrors
|
|
493
|
-
the real editor `page_source` shape.
|
|
494
|
-
|
|
495
|
-
---
|
|
496
|
-
|
|
497
198
|
## ⭐ Like the idea? Drop a star
|
|
498
199
|
|
|
499
200
|
This is a solo, open-source project — every ⭐ genuinely keeps it moving and helps other builders discover it.
|