# Canvas

## Get project canvas

`$ flora projects:canvas retrieve`

**get** `/projects/{projectId}/canvas`

Returns the current project canvas topology as a Mermaid flowchart using the same serializer as the Fauna agent.

### Parameters

- `--project-id: string`

  Project identifier

### Returns

- `ProjectCanvasGetResponse: object { canvas_url, diagram, project_id, summary }`

  - `canvas_url: string`

    Project canvas URL

  - `diagram: string`

    Mermaid flowchart diagram

  - `project_id: string`

    Project identifier

  - `summary: object { edge_count, group_count, isolated_node_count, 2 more }`

    - `edge_count: number`

    - `group_count: number`

    - `isolated_node_count: number`

    - `node_count: number`

    - `workflow_count: number`

### Example

```cli
flora projects:canvas retrieve \
  --api-key 'My API Key' \
  --project-id prj_abc123
```

#### Response

```json
{
  "canvas_url": "https://example.com",
  "diagram": "graph LR\n  n1[\"Prompt (text)\"]\n  n2[\"Result (image)\"]\n  n1 -->|text| n2",
  "project_id": "prj_abc123",
  "summary": {
    "edge_count": 0,
    "group_count": 0,
    "isolated_node_count": 0,
    "node_count": 0,
    "workflow_count": 0
  }
}
```

## Patch project canvas

`$ flora projects:canvas update`

**patch** `/projects/{projectId}/canvas`

Applies a Mermaid flowchart patch to the project canvas using the same create_workflow path as the Fauna agent. The diagram may add nodes, connect nodes, and reference existing canvas nodes by their Mermaid short IDs in edges (e.g. `n1 --> out`). This endpoint is add-only: re-declaring an existing node id with a label (e.g. `n3["..."]`) creates a NEW node instead of updating the existing one, and returns a warning. To attach to an existing node, reference its id in an edge without re-declaring its label. Subgraph grouping is not applied (nodes inside a `subgraph` are added ungrouped) and returns a warning. To place an existing image/video/audio as a static node, set `node_params` — which is keyed by Mermaid node id, e.g. `{ "img1": { "content_url": "https://…" } }`, NOT a bare `{ content_url }` object. `prompt` and `content_url` are mutually exclusive for a node: use `prompt` (or a label that doubles as the prompt) for generation, or `content_url` for existing media. When using `content_url`, give the node a content-free type-only label such as `img1["(Image)"]` so no prompt is inferred from the label.

### Parameters

- `--project-id: string`

  Project identifier

- `--diagram: string`

  Mermaid flowchart diagram to apply

- `--node-params: optional map[object { aspect_ratio, content_url, model, 3 more } ]`

  Optional per-node parameters, keyed by Mermaid node id (a Record<nodeId, NodeParams>), e.g. { "img1": { "content_url": "https://…" } }. Pass a map keyed by node id, NOT a bare { content_url } object.

### Returns

- `ProjectCanvasUpdateResponse: object { canvas_url, created_edge_count, created_node_count, 3 more }`

  - `canvas_url: string`

    Project canvas URL

  - `created_edge_count: number`

  - `created_node_count: number`

  - `diagram: string`

    Applied Mermaid flowchart diagram

  - `project_id: string`

    Project identifier

  - `warnings: optional array of string`

### Example

```cli
flora projects:canvas update \
  --api-key 'My API Key' \
  --project-id prj_abc123 \
  --diagram 'graph LR
  source["Product photo (Image)"]
  output["Editorial campaign image (Image)"]
  source --> output'
```

#### Response

```json
{
  "canvas_url": "https://example.com",
  "created_edge_count": 0,
  "created_node_count": 0,
  "diagram": "graph LR\n  n1[\"Prompt (text)\"]\n  n2[\"Result (image)\"]\n  n1 --> n2",
  "project_id": "prj_abc123",
  "warnings": [
    "string"
  ]
}
```
