feat(workflows): add JSON file download/upload for workflow transfer

🟢 open · #59 · willchen96/mike ← rafal-fryc/mikelocal · opened 15d ago by rafal-fryc · +208-3 across 3 files · ↗ on GitHub

From the PR description

Summary

Adds a way to move a workflow between Mike instances by exporting it as a .mikeworkflow.json file and importing it elsewhere - useful for sharing built/customised workflows across teams, environments, or organisations without needing a shared account.

  • Download - every workflow row in /workflows gets a small download icon that serialises the workflow to a JSON envelope (format: "mike.workflow", version: 1) with title, type, practice, prompt_md, and columns_config.
  • Upload - a new upload icon in the page header opens a file picker, validates the envelope, and creates a new workflow under the current user.
  • Scope is intentionally minimal: no backend, schema, or Supabase config changes. Upload reuses the existing POST /workflows endpoint via createWorkflow. Email sharing is untouched.

Files

  • New: frontend/src/app/lib/workflowFile.ts - envelope builder, download helper, strict parser with typed errors.
  • New: frontend/src/app/components/workflows/UploadWorkflowButton.tsx - file-picker button that creates a workflow from a parsed envelope and shows inline errors.
  • Modified: frontend/src/app/components/workflows/WorkflowList.tsx - mounts the upload button next to + New, adds a per-row download icon, widens the trailing actions column from w-8 to w-16.

No new dependencies. All icons come from the existing lucide-react import.

Test plan

  • Create a custom assistant workflow with a prompt and practice → click the row's download icon → verify a <title>.mikeworkflow.json file downloads and the JSON contains format: "mike.workflow", version: 1, and the expected fields.
  • Click the header upload icon → pick the downloaded file → verify a new workflow appears in the list with identical fields, owned by you.
  • Repeat with a tabular workflow → verify columns_config round-trips.
  • Upload an arbitrary JSON file → expect a red inline error from the envelope validator.
  • Upload a malformed envelope (wrong format) → expect a clear inline error.
  • Confirm no regression to existing flows: + New, email share modal, hide/unhide built-ins, bulk delete.

🤖 Generated with Claude Code

Our analysis

Workflow portability via JSON export and import — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-59.md from inside the repo you want the changes in.

⬇ Download capture-pull-59.md