Skip to content

feat: Add YAML import when creating a Canvas#3076

Open
harxhist wants to merge 3 commits intosuperplanehq:mainfrom
harxhist:feat/import-canvas-from-yaml
Open

feat: Add YAML import when creating a Canvas#3076
harxhist wants to merge 3 commits intosuperplanehq:mainfrom
harxhist:feat/import-canvas-from-yaml

Conversation

@harxhist
Copy link
Contributor

Summary

Closes #1725

Adds the ability to create a Canvas by importing from a YAML file on the Create Canvas page (/canvases/new).

  • New YAML parsing utility (parseCanvasYaml.ts) that accepts both:
    • The UI export format
    • The CLI resource format (apiVersion / kind: "Canvas")
  • Tabbed UI ("Create manually" / "Import from YAML") with:
    • Paste support
    • File upload
    • Inline validation
    • Editable name/description after parsing
  • No backend changes required — the existing CreateCanvas API already supports a full canvas spec with nodes and edges.

Video Demo: Loom

How it works

The user selects the "Import from YAML" tab, then either:

  • Pastes YAML content, or
  • Uploads a .yaml / .yml file

Clicking "Parse YAML" (or uploading a file):

  1. Validates the structure
  2. On success:
    • Pre-fills the name and description fields
    • Stores the parsed nodes and edges

These are passed through the existing useCreateCanvas mutation on submit.

The YAML format matches:

  • The CLI output (superplane get canvas)
  • The dev-mode YAML export in the UI

What changed

File Change
web_src/src/utils/parseCanvasYaml.ts New — shared YAML parser and file reader utility
web_src/src/components/CreateCanvasModal/index.tsx Added "Import from YAML" tab, extracted CanvasFormFields subcomponent, extended submit data type with optional nodes/edges
web_src/src/pages/home/useCreateCanvasModalState.tsx Extended onSubmit to pass through YAML-imported nodes/edges, falling back to template lookup
web_src/src/pages/canvas/CreateCanvasPage.tsx Added same tabbed YAML import flow to the standalone create page

Tests

  • Import valid YAML from UI
  • Validate error handling for malformed YAML
  • Validate error handling for invalid Canvas schema
  • Confirm name/description pre-fill correctly
  • Confirm nodes/edges are correctly passed to CreateCanvas API
  • Confirm manual creation flow remains unaffected

Signed-off-by: Harsh <harxhist@gmail.com>
@cursor
Copy link

cursor bot commented Feb 12, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 12.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Signed-off-by: Harsh <harxhist@gmail.com>
</Field>
</div>
{showYamlTab ? (
<Tabs value={activeTab} onValueChange={setActiveTab}>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modal doesn't clear imported YAML state on tab switch

Medium Severity

In CreateCanvasModal, the Tabs onValueChange is just setActiveTab, unlike CreateCanvasPage which also clears importedSpec, yamlText, and yamlError when switching back to "manual". If a user imports YAML (setting importedSpec), then switches to the manual tab and selects a template, handleSubmit still passes the stale importedSpec?.nodes and importedSpec?.edges. Since those are truthy arrays, the template lookup in useCreateCanvasModalState is skipped (!nodes && !edges is false), silently ignoring the user's template selection.

Additional Locations (1)

Fix in Cursor Fix in Web

}
},
[applyParsedYaml],
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated YAML import logic across two components

Low Severity

The applyParsedYaml, handleYamlParse, and handleFileUpload callback functions are virtually identical between CreateCanvasPage and CreateCanvasModal. The YAML tab UI (textarea, parse button, upload button, success/error messages) is also duplicated. This led to the tab-switch reset bug existing in only one of the two copies. Extracting a shared hook or component would reduce divergence risk.

Additional Locations (1)

Fix in Cursor Fix in Web

Signed-off-by: Harsh <harxhist@gmail.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
setYamlText(e.target.value);
if (yamlError) setYamlError("");
}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale parsed data submitted after YAML text edits

Medium Severity

The YAML textarea's onChange handler clears yamlError but not importedSpec. After a successful parse, if the user edits the YAML text, importedSpec still holds the old parsed nodes/edges, the "Parsed successfully" message remains visible, and the submit button stays enabled. Submitting sends the stale parsed data rather than reflecting the user's modifications.

Additional Locations (1)

Fix in Cursor Fix in Web

@AleksandarCole AleksandarCole self-assigned this Feb 13, 2026
@AleksandarCole AleksandarCole added the pr:stage-2/3 Needs to pass functional review label Feb 13, 2026
@AleksandarCole AleksandarCole self-requested a review February 13, 2026 09:36
@harxhist
Copy link
Contributor Author

@shiroyasha
Can you please assign this to me & review the PR?
I am working on other issue meanwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:stage-2/3 Needs to pass functional review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Canvas from YAML

2 participants