@mapled/mcp 0.14.0 → 0.15.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 +3 -2
- package/dist/tools.js +18 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,8 +46,9 @@ For the first integration, propose one plan and let the owner approve it on a tr
|
|
|
46
46
|
2. `propose_setup_plan` — the collections and singles (with fields and the records to import), the files you will change, the packages you will install. Nothing changes yet. Relation fields name their target — a collection of the plan by its display name, or an existing one by key; give a record a `"$ref": "jane"` and other records of the plan link to it as `"author": "jane"` (a list of refs for `many`), while links to existing collections use record ids from `list_records`. Group fields carry their sub-fields; their values are objects keyed by the sub-field keys. Mark a field — or a sub-field of a group — `sensitive: true` when editors keep it but the site must never get it. A link that does not resolve is answered right away with its path, so fix the plan before the owner sees it.
|
|
47
47
|
3. Ask the user to open the returned `reviewUrl` and approve. Poll `get_setup_run` until its status is `approved` (or `rejected` — then propose a better plan).
|
|
48
48
|
4. `apply_setup_plan` — Mapled creates everything in one go and tells you the keys it assigned.
|
|
49
|
-
5. Wire the site: `get_connection`, then `configure_revalidation` for a site with a server — or `set_site_url` for one rendered in the browser (a React single-page app, plain HTML: no webhook, no preview route) —
|
|
49
|
+
5. Wire the site: `get_connection`, then `configure_revalidation` for a site with a server — or `set_site_url` for one rendered in the browser (a React single-page app, plain HTML: no webhook, no preview route) — and deploy.
|
|
50
50
|
6. Leave a guide: `get_mapled_md` renders `MAPLED.md` from the project — what the site reads and where, the content model, the working rules, the commands that verify the integration. Write it to the repository root and commit it; the next agent (or person) starts from it. When the file exists, replace everything above its `<!-- mapled:notes -->` line and keep the notes below.
|
|
51
|
+
7. Close with `report_setup` (files changed, `buildPassed`, `secretsCommitted: false`, `mapledMdWritten: true`). Mapled runs its own checks — the site reads content, the webhook delivered, the preview route responds, fields have help texts, MAPLED.md was written — and the run is completed only when they pass. Fix what failed and call `verify_setup`. The result lands in the file's «Last setup run» section, so call `get_mapled_md` once more when the run is settled and commit the refreshed file.
|
|
51
52
|
|
|
52
53
|
## Destructive and breaking changes
|
|
53
54
|
|
|
@@ -66,7 +67,7 @@ A rename or a conversion Mapled wouldn't take is refused at once with the reason
|
|
|
66
67
|
| `add_records` | Insert draft records |
|
|
67
68
|
| `list_records` | Read a collection's draft records, newest edit first — `query` searches their content, `limit` (1–200) and `cursor` (the previous answer's `nextCursor`) page through them; `total` counts every match |
|
|
68
69
|
| `create_form` / `list_forms` | Set up public forms with spam protection |
|
|
69
|
-
| `get_connection` | The delivery key and the API URL, plus — for the `framework` the agent names (`nextjs`, `react-spa`, `plain-html`, …) or the project's own — the package
|
|
70
|
+
| `get_connection` | The delivery key and the API URL, plus — for the `framework` the agent names (`nextjs`, `react-spa`, `plain-html`, …) or the project's own — the package the site reads through (`@mapled/next`, `@mapled/react`, `@mapled/vanilla` — a script tag and `data-mapled-*` attributes for plain HTML — or `@mapled/client`), the env var of the key, whether the site renders on a server or in the browser, and the wire-up steps. Image values → `assetUrl(id, { width })` of the same package |
|
|
70
71
|
| `set_site_url` | Where the site is deployed — for a site rendered in the browser (a React single-page app, plain HTML), which has no webhook to learn it from: Preview opens the site there, verification checks that it answers |
|
|
71
72
|
| `push_site_manifest` / `list_bindings` | Tell Mapled where each field is rendered; read every binding's health (type mismatch, outdated, missing on site). Keep the repository's copy in `mapled/manifest.json` — `npx @mapled/cli scan --write` derives it from the code and `bindings push` / `bindings pull` exchange it with Mapled. A push records the integration hash — the schema and these bindings — and `list_bindings` says whether it still matches (`integration.inSync`, with `schemaChanged` / `bindingsChanged` naming what moved) |
|
|
72
73
|
| `configure_revalidation` | Point the publish webhook at the site (one with a server that caches what it reads), get the signing secret; the description also tells the agent how to add live updates for tabs that are already open (`createReleaseHandler` and `<MapledLive />`, `@mapled/next` 0.8.0+) |
|
package/dist/tools.js
CHANGED
|
@@ -160,17 +160,21 @@ export function createTools(api) {
|
|
|
160
160
|
name: "apply_setup_plan",
|
|
161
161
|
description: "Apply an approved setup plan. Mapled creates the collections, fields and records in one go and returns " +
|
|
162
162
|
"what was created (keys, counts) plus warnings for records it had to skip. Then wire the site " +
|
|
163
|
-
"(get_connection, configure_revalidation), write MAPLED.md (get_mapled_md)
|
|
163
|
+
"(get_connection, configure_revalidation), write MAPLED.md (get_mapled_md), finish with report_setup and " +
|
|
164
|
+
"refresh MAPLED.md once more.",
|
|
164
165
|
schema: { runId: z.string().uuid() },
|
|
165
166
|
handler: async (args) => api.request("POST", `/v1/agent/runs/${encodeURIComponent(args.runId)}/apply`, {}),
|
|
166
167
|
},
|
|
167
168
|
{
|
|
168
169
|
name: "report_setup",
|
|
169
170
|
description: "Close a setup run with your report: the files you changed, what stayed hardcoded, warnings the owner " +
|
|
170
|
-
"should know about, whether the site builds (buildPassed)
|
|
171
|
-
"(secretsCommitted: false)
|
|
171
|
+
"should know about, whether the site builds (buildPassed), that no secrets were committed " +
|
|
172
|
+
"(secretsCommitted: false) and whether you wrote MAPLED.md from get_mapled_md before this call " +
|
|
173
|
+
"(mapledMdWritten), plus the preview URL if the site is deployed. Mapled then runs its own " +
|
|
172
174
|
"checks (site reads content, webhook delivered, preview route responds, help texts) and returns them; " +
|
|
173
|
-
"the run is completed only when every check passes — fix what failed and call verify_setup."
|
|
175
|
+
"the run is completed only when every check passes — fix what failed and call verify_setup. The report " +
|
|
176
|
+
"and the checks change the file's «Last setup run» section, so once the run is settled call get_mapled_md " +
|
|
177
|
+
"again and rewrite MAPLED.md — a refresh keeps the check passed and the file current.",
|
|
174
178
|
schema: {
|
|
175
179
|
runId: z.string().uuid(),
|
|
176
180
|
filesChanged: z.array(z.string().max(300)).max(50).optional(),
|
|
@@ -179,6 +183,7 @@ export function createTools(api) {
|
|
|
179
183
|
previewUrl: z.string().url().optional(),
|
|
180
184
|
buildPassed: z.boolean().optional(),
|
|
181
185
|
secretsCommitted: z.boolean().optional(),
|
|
186
|
+
mapledMdWritten: z.boolean().optional(),
|
|
182
187
|
},
|
|
183
188
|
handler: async (args) => {
|
|
184
189
|
const { runId, ...body } = args;
|
|
@@ -289,7 +294,8 @@ export function createTools(api) {
|
|
|
289
294
|
"collections or fields. `framework` is what the site is built with, as a short key: \"nextjs\", " +
|
|
290
295
|
"\"react-spa\" (a React single-page app — Vite and the like), \"plain-html\", or astro, remix, nuxt, " +
|
|
291
296
|
"sveltekit…; react-spa and plain-html tell Mapled the site renders in the browser, so verification " +
|
|
292
|
-
"expects no webhook and no preview route. " +
|
|
297
|
+
"expects no webhook and no preview route. A plain HTML page that shows one record keeps the slug in its " +
|
|
298
|
+
"query — name it \"/post.html?slug=[slug]\", with a route_param binding on the slug field. " +
|
|
293
299
|
"The answer's manifest.integrationHash is the hash of the schema and these " +
|
|
294
300
|
"bindings — what the site is synced with from now on; check_integration reports inSync against it. " +
|
|
295
301
|
"Needs the builder plan.",
|
|
@@ -492,14 +498,17 @@ export function createTools(api) {
|
|
|
492
498
|
"for the site's framework (`sdk`), the env var the key goes in (`envVar`), how the site renders " +
|
|
493
499
|
"(`rendering`: server or browser) and `wireUp` — the steps for that framework; follow them. Pass " +
|
|
494
500
|
'`framework` as you see it in the repository: "nextjs" (@mapled/next), "react-spa" for a React ' +
|
|
495
|
-
'single-page app such as Vite (@mapled/react), "plain-html"
|
|
496
|
-
"@mapled/
|
|
501
|
+
'single-page app such as Vite (@mapled/react), "plain-html" for pages without a build step ' +
|
|
502
|
+
"(@mapled/vanilla: one script tag and data-mapled-* attributes on the elements — no reading code to " +
|
|
503
|
+
"write, wireUp lists the attributes), or another short key (astro, remix, … — " +
|
|
504
|
+
"@mapled/client on the server); left out, the project's own is used. The JavaScript packages have the same reads: " +
|
|
497
505
|
'createClient({ key }).getRecords("<collection>"), getSingle, getRecordBySlug. ' +
|
|
498
506
|
"Reads take filter ({ field: value } or { field: { gte, lt, in, contains… } }), sort, limit/offset, " +
|
|
499
507
|
"fields, and expand (relation fields, e.g. [\"author\"]) — linked records arrive under record.expanded; " +
|
|
500
508
|
"getRecordBySlug(collection, slug) reads one record by its slug field. " +
|
|
501
509
|
"Image values are asset ids: assetUrl(id, { width, format }) from the same package gives the URL of a resized variant. " +
|
|
502
|
-
"rich_text values are Markdown — render them with a Markdown component (e.g. react-markdown), never as raw HTML
|
|
510
|
+
"rich_text values are Markdown — render them with a Markdown component (e.g. react-markdown), never as raw HTML " +
|
|
511
|
+
"(@mapled/vanilla renders them itself: data-mapled-format=\"markdown\"). " +
|
|
503
512
|
"Content appears on the site only after a human presses Publish in Mapled.",
|
|
504
513
|
schema: {
|
|
505
514
|
framework: z
|
|
@@ -547,7 +556,7 @@ export function createTools(api) {
|
|
|
547
556
|
"repository root and commit it. If the file exists, replace everything above its `<!-- mapled:notes -->` " +
|
|
548
557
|
"line and keep what is below — that part belongs to the repository. Its first line is a stamp with the " +
|
|
549
558
|
"schema hash, the manifest version and the integration hash. Refresh it after every schema or " +
|
|
550
|
-
"manifest change and at the end of a setup; `npx @mapled/cli md pull` does the same from the repository " +
|
|
559
|
+
"manifest change and at the end of a setup, after report_setup or verify_setup; `npx @mapled/cli md pull` does the same from the repository " +
|
|
551
560
|
"and `mapled doctor` says when it is out of date. It never contains a secret — don't add one.",
|
|
552
561
|
schema: {},
|
|
553
562
|
handler: async () => api.request("GET", "/v1/agent/mapled-md"),
|