Skip to content

feat(workflow): starter templates for the blank-canvas cold start#2607

Open
simlarsen wants to merge 1 commit into
feat/workflow-node-statusfrom
feat/workflow-templates
Open

feat(workflow): starter templates for the blank-canvas cold start#2607
simlarsen wants to merge 1 commit into
feat/workflow-node-statusfrom
feat/workflow-templates

Conversation

@simlarsen

Copy link
Copy Markdown
Contributor

Fixes the intimidating blank-canvas cold start the design flagged. Stacked on #2606.

What

A brand-new workflow opened to an empty canvas with a lone placeholder trigger — a "now what?" moment. This offers a few pre-wired starter workflows instead; picking one drops a ready graph you just fill in, and "Start from scratch" keeps the empty canvas.

  • WorkflowTemplates — engine-agnostic recipes (which components, where, how they connect). Uses only static components, so there's no per-model id-fidelity risk. buildTemplateGraph resolves each against the live catalog and produces the exact node/edge shape addToGraph already creates (returns null rather than dropping a broken graph if a component is missing).
  • WorkflowTemplateGallery — the cards + "Start from scratch" overlay.
  • Wired into Workflow.tsx — shown only when the graph has no real steps yet (every node is a placeholder), gated on the catalog being loaded, dismissed once the user picks a template or opts out. Existing workflows (which have real nodes) never see it.

Ships 3 templates: Scheduled Slack message, Scheduled email, Webhook → Slack.

Verification

  • WorkflowTemplates.test.ts: buildTemplateGraph shape matches addToGraph; connects first out-port → first in-port; disambiguates duplicate data ids; returns null on a missing component; and a guard that every shipped template resolves against the real static catalog (so no broken metadataId can ship).
  • WorkflowTemplateGallery.test.tsx (RTL): lists templates, select fires onSelect(template), "Start from scratch" fires onDismiss.
  • 62 workflow tests pass; tsc ✓, eslint ✓.

One caveat: loaded-template canvas rendering goes through the same node shape as manually-added components (unit-verified), but ReactFlow rendering isn't exercised in jsdom — worth a 30-second manual smoke-test when convenient.

🤖 Generated with Claude Code

A brand-new workflow opened to an empty canvas with a lone placeholder
trigger — an intimidating "now what?" for non-technical authors. This offers a
few pre-wired starter workflows instead; picking one drops a ready graph you
just fill in, and "Start from scratch" keeps the empty canvas.

- WorkflowTemplates: engine-agnostic recipes (which components, where, how they
  connect) using only STATIC components, so there's no per-model id-fidelity
  risk. buildTemplateGraph resolves each against the live catalog and produces
  the exact node/edge shape addToGraph already creates (returns null rather
  than dropping a broken graph if a component is missing).
- WorkflowTemplateGallery: the cards + "Start from scratch" overlay.
- Wired into Workflow.tsx: shown only when the graph has no real steps yet
  (every node is a placeholder), gated on the catalog being loaded, and
  dismissed once the user picks a template or opts out. Existing workflows
  (which have real nodes) never see it.

Tests: buildTemplateGraph (shape matches addToGraph, first-port wiring,
duplicate-id disambiguation, null on missing component) + a guard that EVERY
shipped template resolves against the real static catalog (so no broken
metadataIds ship) + gallery RTL (lists templates, select, dismiss). 62 workflow
tests pass; tsc + eslint clean.

Note: loaded-template canvas rendering goes through the same node shape as
manually added components (unit-verified), but is worth a quick manual
smoke-test since ReactFlow rendering isn't exercised in jsdom.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simlarsen

Copy link
Copy Markdown
Contributor Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants