<!-- enhance-docs page=reference/cli/canvas/publish-prototype -->
<!-- enhance-docs release-sha256=8a804cfc9a6fc6b942b8daf6a82266ad6e308291ae4351abee3346bc696d1258 -->

# enhance-dev canvas publish-prototype

```text
enhance-dev canvas publish-prototype [options]
```

## Arguments

This command takes no positional arguments.

## Options

| Option | Required | Default | Meaning |
| --- | --- | --- | --- |
| `--input <json-or-@path>` | Yes | None | Publish request JSON. To update a prototype, publish to its owner node: pass source.prototypeId and that node's id as source.nodeId. Any other node that shows it forks into its own prototype and keeps its label. An update keeps the title the node shows; you must still pass a title of 200 characters or fewer, which only names a new node. |
| `--client-token <uuid>` | Yes | None | Stable UUID to reuse when retrying the exact same mutation. |

## Input

This command presents the capability `prototype.publishCanvas`. It has external effect and composite idempotency.

<details class="reference-schema">
<summary>Show complete input JSON Schema</summary>

```json
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"canvasRef":{"type":"string","minLength":1},"baseVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"waitMs":{"default":1500,"description":"Additional ingestion polling, capped at five seconds. This budget does not include packaging or network transfers.","type":"integer","minimum":0,"maximum":5000},"source":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"directory"},"prototypeId":{"default":null,"anyOf":[{"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)$"},{"type":"null"}]},"nodeId":{"type":"string","minLength":1},"title":{"type":"string","minLength":1,"maxLength":200},"entryPath":{"default":"index.html","type":"string","minLength":1},"box":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0}},"required":["x","y","width","height"],"additionalProperties":false},"directory":{"type":"string","minLength":1}},"required":["kind","nodeId","title","box","directory"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"deployment"},"deploymentId":{"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":["kind","deploymentId"],"additionalProperties":false}]}},"required":["canvasRef","baseVersion","source"],"additionalProperties":false}
```
</details>


## Output

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

<details class="reference-schema">
<summary>Show complete output JSON Schema</summary>

```json
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"operation":{"type":"object","properties":{"kind":{"type":"string","const":"prototype-deployment"},"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)$"},"deploymentId":{"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":["kind","canvasId","deploymentId"],"additionalProperties":false},"deploymentStatus":{"type":"string","enum":["unknown","uploading","queued","ingesting","ready","failed","abandoned"]},"publication":{"anyOf":[{"oneOf":[{"type":"object","properties":{"prototypeId":{"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)$"},"deploymentId":{"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)$"},"nodeId":{"type":"string","minLength":1},"fileCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"processedFiles":{"type":"integer","minimum":0,"maximum":9007199254740991},"unavailableFiles":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","minLength":1},"code":{"type":"string","minLength":1}},"required":["path","code"],"additionalProperties":false}},"state":{"type":"string","const":"failed"},"failure":{"type":"object","properties":{"code":{"type":"string","minLength":1},"message":{"type":"string","minLength":1},"path":{"type":"string","minLength":1}},"required":["code","message"],"additionalProperties":false}},"required":["prototypeId","deploymentId","nodeId","fileCount","totalBytes","processedFiles","state","failure"],"additionalProperties":false},{"type":"object","properties":{"prototypeId":{"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)$"},"deploymentId":{"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)$"},"nodeId":{"type":"string","minLength":1},"fileCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"processedFiles":{"type":"integer","minimum":0,"maximum":9007199254740991},"unavailableFiles":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","minLength":1},"code":{"type":"string","minLength":1}},"required":["path","code"],"additionalProperties":false}},"state":{"type":"string","enum":["uploading","queued","ingesting","ready","abandoned"]}},"required":["prototypeId","deploymentId","nodeId","fileCount","totalBytes","processedFiles","state"],"additionalProperties":false}]},{"type":"null"}]},"attachmentStatus":{"type":"string","enum":["not_attempted","pending","committed","no_op","conflict","not_confirmed"]},"attachment":{"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)$"},"prototypeId":{"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)$"},"deploymentId":{"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)$"},"nodeId":{"type":"string","minLength":1},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"state":{"type":"string","const":"ready"},"origin":{"type":"string","format":"uri"},"openUrl":{"type":"string","pattern":"^\\/c\\/.*"},"canvasUrl":{"type":"string","format":"uri"},"unavailableFiles":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","minLength":1},"code":{"type":"string","minLength":1}},"required":["path","code"],"additionalProperties":false}},"attachment":{"oneOf":[{"type":"object","properties":{"outcome":{"type":"string","const":"committed"},"mutationId":{"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)$"},"previousVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["outcome","mutationId","previousVersion","version"],"additionalProperties":false},{"type":"object","properties":{"outcome":{"type":"string","const":"no_op"},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["outcome","version"],"additionalProperties":false}]}},"required":["canvasId","prototypeId","deploymentId","nodeId","version","state","origin","openUrl","attachment"],"additionalProperties":false},{"type":"null"}]},"failure":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"remediation":{"type":"string"}},"required":["code","message","remediation"],"additionalProperties":false},{"type":"null"}]},"nextAction":{"type":"string","enum":["retry_same_request","retry_new_publication","restore_access","check_status","replan_attachment","fix_build","inspect_result"]},"warnings":{"type":"array","items":{"type":"string"}}},"required":["operation","deploymentStatus","publication","attachmentStatus","attachment","failure","nextAction","warnings"],"additionalProperties":false}
```
</details>


## Examples

```bash
enhance-dev canvas publish-prototype --input <json-or-@path> --client-token <uuid>
```

<details class="reference-schema">
<summary>Show example input</summary>

```json
{
 "canvasRef": "00000000-0000-4000-8000-000000000010",
 "baseVersion": 1,
 "source": {
  "kind": "deployment",
  "deploymentId": "00000000-0000-4000-8000-000000000010"
 },
 "waitMs": 1500
}
```
</details>

<details class="reference-schema">
<summary>Show example output</summary>

```json
{
 "operation": {
  "kind": "prototype-deployment",
  "canvasId": "00000000-0000-4000-8000-000000000010",
  "deploymentId": "00000000-0000-4000-8000-000000000010"
 },
 "deploymentStatus": "queued",
 "publication": {
  "prototypeId": "00000000-0000-4000-8000-000000000010",
  "deploymentId": "00000000-0000-4000-8000-000000000010",
  "nodeId": "prototype",
  "state": "queued",
  "fileCount": 3,
  "totalBytes": 100,
  "processedFiles": 0
 },
 "attachmentStatus": "pending",
 "attachment": null,
 "failure": null,
 "nextAction": "check_status",
 "warnings": []
}
```
</details>

## Exit behaviour

| Exit code | Meaning |
| --- | --- |
| `0` | The command succeeded. |
| `1` | The command failed for another reason (`INTERNAL`). A write may have an unknown outcome. |
| `2` | The command line was malformed. Nothing ran. |
| `3` | The API refused the input (`BAD_REQUEST`). |
| `4` | The credential is missing or expired (`UNAUTHORIZED`). |
| `5` | The API refused the request (`FORBIDDEN`, `NOT_FOUND`, `CONFLICT`, `RATE_LIMITED`). |
| `6` | A 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.
