enhancedocs
For agentsOpen Enhance ↗
CLI commands / enhance-dev canvas write-html

Enhance documentation

enhance-dev canvas write-html

Compile HTML/CSS primitives.

↓ Markdown

enhance-dev canvas write-html

enhance-dev canvas write-html [options]

Arguments

This command takes no positional arguments.

Options

OptionRequiredDefaultMeaning
--canvas <url-or-id>YesNoneCanvas URL or UUID to edit.
--base-version <integer>YesNoneDocument version returned by enhance canvas document get.
--target-node-id <id>YesNoneContainer receiving children, or node to replace.
--html <html-or-@path>YesNoneInline HTML fragment or @path to a UTF-8 file.
--mode <mode>Noinsert-childreninsert-children or replace.
--review <mode>Norendernone to return after commitment; render to include review pixels.
--id-prefix <prefix>NoNoneFresh namespace for a new import/replacement; reuse only for an identical retry.
--client-token <uuid>NoNoneStable UUID to reuse when retrying the exact same mutation.
--output <path>NoNoneWrite the review PNG to this path.
--forceNofalseReplace an existing --output file deliberately.
--scale <number>No1Review pixels per canvas unit, from 0.1 to 4.
--timeout-ms <integer>No120000Review render polling deadline.

Input

This command presents the capability canvas.writeHtml. It has write effect and composite idempotency.

Show complete input JSON Schema
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"canvasId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"pageId":{"description":"Page from the complete canvas URL; the destination must belong to this page.","type":"string","minLength":1},"selectionNodeIds":{"description":"Selected node IDs from the canvas URL; restrict the destination to this selection.","type":"array","items":{"type":"string","minLength":1}},"targetNodeId":{"type":"string","minLength":1,"description":"Stable container id for insert-children, or subtree root id for replace."},"mode":{"type":"string","enum":["insert-children","replace"],"description":"Insert the compiled group inside the target, or replace the target subtree."},"html":{"type":"string","minLength":1,"description":"Exactly one safe top-level HTML/CSS visual group to compile into editable nodes."},"idPrefix":{"description":"Optional namespace for generated IDs. Choose a fresh prefix for each new import or replacement; reuse only for an identical retry.","type":"string","minLength":1},"baseVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"review":{"description":"Use none to return the committed edit without rendering; omission preserves combined review.","type":"string","enum":["none","render"]},"renderOutputPath":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"description":"Local review PNG path, or null for a protected temporary artifact."},"overwriteRender":{"type":"boolean","description":"Whether an existing renderOutputPath may be replaced."},"renderScale":{"type":"number","exclusiveMinimum":0,"description":"Review PNG pixels per canvas unit."},"renderTimeoutMs":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"description":"Local import and review-render polling deadline in milliseconds."}},"required":["canvasId","targetNodeId","mode","html","baseVersion","renderOutputPath","overwriteRender","renderScale","renderTimeoutMs"]}

Output

This command writes JSON records to standard output. Returns a typed canvas.writeHtml result from the Enhance API without transport-specific prose.

Show complete output JSON Schema
{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"canvasId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"mutationCommitted":{"type":"boolean","const":true},"previousVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"rootNodeId":{"type":"string"},"jobId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"affected":{"type":"object","properties":{"inserted":{"type":"number"},"changed":{"type":"number"},"removed":{"type":"number"}},"required":["inserted","changed","removed"],"additionalProperties":false},"createdNodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"component":{"type":"string"}},"required":["id","name","component"],"additionalProperties":false}},"removedNodeIds":{"type":"array","items":{"type":"string"}},"next":{"type":"array","items":{"type":"string"}}},"required":["canvasId","mutationCommitted","previousVersion","version","removedNodeIds"],"additionalProperties":{}},{"type":"object","properties":{"state":{"type":"string","const":"pending"},"canvasId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"jobId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"phase":{"type":"string"},"status":{"type":"object","properties":{"tool":{"type":"string","const":"capability_query"},"arguments":{"type":"object","properties":{"capability":{"type":"string","const":"canvas.render.getImport"},"input":{"type":"object","properties":{"jobId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["jobId"],"additionalProperties":false}},"required":["capability","input"],"additionalProperties":false}},"required":["tool","arguments"],"additionalProperties":false}},"required":["state","canvasId","jobId","phase","status"],"additionalProperties":false}]}

Examples

enhance-dev canvas write-html --canvas <url-or-id> --base-version <integer> --target-node-id <id> --html <html-or-@path>
Show example input
{
 "canvasId": "00000000-0000-4000-8000-000000000010",
 "targetNodeId": "root",
 "mode": "insert-children",
 "html": "<div layer-name=\"Ready\" style=\"display:flex;flex-direction:column;gap:16px;padding:24px;width:360px;background:#fff\"><h1 style=\"font-size:24px\">Today</h1><p>Three tasks ready to start</p><div style=\"padding:16px;background:#eef2ff\">Review the design</div></div>",
 "review": "none",
 "idPrefix": "example",
 "baseVersion": 1,
 "renderOutputPath": null,
 "overwriteRender": false,
 "renderScale": 1,
 "renderTimeoutMs": 120000
}
Show example output
{
 "canvasId": "00000000-0000-4000-8000-000000000010",
 "mutationCommitted": true,
 "previousVersion": 1,
 "version": 2,
 "rootNodeId": "example_ready_0001",
 "jobId": "00000000-0000-4000-8000-000000000010",
 "affected": {
  "inserted": 4,
  "changed": 0,
  "removed": 0
 },
 "insertedNodeIds": [
  "example_ready_0001",
  "example_text_0002",
  "example_text_0003",
  "example_text_0004"
 ],
 "affectedBounds": {
  "x": 0,
  "y": 0,
  "width": 360,
  "height": 180
 },
 "removedNodeIds": []
}

Exit behaviour

Exit codeMeaning
0The command succeeded.
1The command failed for another reason (INTERNAL). A write may have an unknown outcome.
2The command line was malformed. Nothing ran.
3The API refused the input (BAD_REQUEST).
4The credential is missing or expired (UNAUTHORIZED).
5The API refused the request (FORBIDDEN, NOT_FOUND, CONFLICT, RATE_LIMITED).
6A batch finished only in part. Retry with the same --client-token.

Versions

Minimum tested versions: Enhance CLI and MCP runtime 0.1.40, plugin 1.0.38, Node.js 24. No older floor is published.