Skip to content

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

Open
rafal-fryc wants to merge 1 commit into
willchen96:mainfrom
rafal-fryc:feat/workflow-file-transfer
Open

feat(workflows): add JSON file download/upload for workflow transfer#59
rafal-fryc wants to merge 1 commit into
willchen96:mainfrom
rafal-fryc:feat/workflow-file-transfer

Conversation

@rafal-fryc
Copy link
Copy Markdown

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

Lets users export a workflow as a .mikeworkflow.json envelope and
import one on another instance. Round-trips title, type, practice,
prompt_md, and columns_config. Upload reuses the existing
POST /workflows endpoint via createWorkflow, so no backend, schema,
or Supabase config changes are required.

- New: frontend/src/app/lib/workflowFile.ts
  Envelope schema (format "mike.workflow", version 1), download
  helper, and a strict parser that rejects malformed files.
- New: frontend/src/app/components/workflows/UploadWorkflowButton.tsx
  File picker that parses the envelope, creates a workflow under the
  current user, and surfaces validation errors inline.
- Modified: frontend/src/app/components/workflows/WorkflowList.tsx
  Mounts the Upload button next to "+ New" and adds a per-row
  Download icon. Trailing actions column widened from w-8 to w-16.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dshamir added a commit to Dshamir/AI-Legal that referenced this pull request May 24, 2026
- Wire up monthly credit checking and incrementing for both chat
  streaming routes. Credits checked before LLM call (429 if exceeded),
  incremented after successful response. Auto-resets when past reset
  date. Limit via MONTHLY_CREDIT_LIMIT env var (PR willchen96#157).
- Add GET /workflows/:id/export (.mikeworkflow.json download) and
  POST /workflows/import endpoints for portable workflow transfer
  between environments (PR willchen96#59).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dshamir added a commit to Dshamir/AI-Legal that referenced this pull request May 24, 2026
…tegration

- CHANGELOG: add security hardening and feature entries for PRs willchen96#158,
  willchen96#81, willchen96#76, willchen96#79, willchen96#145, willchen96#112, willchen96#111, willchen96#110, willchen96#155, willchen96#157, willchen96#59
- ROADMAP: mark 12 new items as completed
- CLAUDE.md: add sanitize.ts, streamTimeout.ts, credits.ts to lib index,
  update test count to 40
- README: update API endpoints table (chat pagination, workflow export),
  security row (HKDF, RLS, prompt defense), encryption row

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant