Submit version
fabrement-submit-versionSubmit a new version of a block: the backend builds block.json from the shorthand attributes, validates (PHP syntax, security, policy, esbuild) and on success writes the files to the site — then VERIFY with preview {target:"block", id: blockId}. On failure nothing is saved; fix what violations[] names and resubmit. A NEW block needs every field. An existing block takes only what changes: omitted fields keep the current version, and a file can be changed with edits (fragment replacements) instead of re-sent — pass expectedHash from get-block-source. summary is always required, and so is mode: "add" (a NEW version, the current one stays in history) or "replace" (replaces the current version in place, nothing left to roll back to).
Rules: get-skill-doc {id:"block-contract"} for a content block; a header follows {id:"header-contract"}, a footer {id:"footer-contract"} — read the one for the block's type before the first call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"blockId": "<blockId>",
"summary": "<summary>",
"mode": "<mode>"
},
"name": "fabrement-submit-version"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Required — there is no default. add: this becomes a NEW version and the current one stays in history, so it can be rolled back to. replace: the current version is replaced in place (iterative fixes) and there is nothing to roll back to. | |
| tags | No | REQUIRED for a new block: 2-6 lowercase tokens, the SECTION KIND first (get-skill-doc {id:"description-tags"} lists them; a wrong one is refused and the refusal names them all), then mechanics and composition. Check list-blocks `availableTags` and reuse the words already in use. | |
| edits | No | Fragment replacements per source file of the CURRENT version (as get-block-source returns it, {{nameKebab}} tokens included), instead of re-sending the file. A file is sent whole OR edited, not both. | |
| remove | No | Parts to DELETE from the block: viewJs, controlsJs, backgroundColor, skills. The only way to delete — an empty value ("" / [] / {}) is treated as not sent. | |
| skills | No | Technique skill ids you applied (must match the docs you followed). Omit to keep. | |
| viewJs | No | view.js source, whole (window.Fabrement.registerBlockView). Omit to keep; remove:["viewJs"] deletes it. | |
| blockId | Yes | WordPress block id from create-block / list-blocks. | |
| summary | Yes | REQUIRED changelog line: what changed / was built THIS submit (e.g. "bigger CTA, tighter hero spacing"). | |
| styleCss | No | style.css source, whole — `.e-*` selectors written flat (the backend scopes them to the block); only root-state heads carry .block-{{nameKebab}}. Omit to keep. | |
| renderPhp | No | render.php source, whole. Omit to keep, or change it with edits.renderPhp. | |
| attributes | No | SHORTHAND attributes map — every field needs "control" (get-skill-doc {id:"attributes"}). The WHOLE map when sent; omit to keep. | |
| controlsJs | No | controls.js source, whole (export function Controls, BlockModal). Omit to keep. | |
| description | No | REQUIRED for a new block: what it is and where it is used, how it looks and what is in it, any behaviour, and what it depends on. At least 25 words, at most 400 characters. get-skill-doc {id:"description-tags"} has the shape and an example. Omit on an edit to keep the stored one. | |
| expectedHash | No | `hash` from get-block-source. If the block got a newer version since, nothing is submitted. | |
| backgroundColor | No | Whole-section fill: hex or full CSS gradient string (headers: never). Omit to keep; remove it with remove:["backgroundColor"]. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| notice | No | Present only when the block changed and its description did not — something to check, not a failure. The version is saved either way. | |
| buildOk | No | ||
| warnings | No | Things to fix that did not stop the save: a site option read with a name that is not a literal string (block.json cannot list it). | |
| versionId | No | ||
| overwritten | No | true when this replaced the current version in place. | |
| siteOptions | No | The site options this version reads, "<options page>.<field>", found in render.php and written into block.json. Absent when it reads none. | |
| filesWritten | No |