Skip to content

Paste-to-import in UI #95

@TomMaSS

Description

@TomMaSS

Goal

Allow users to paste markdown text directly into the UI and split it into sections. No URL fetching, no OAuth — just clipboard.

Frontend

frontend/src/components/import-dialog.tsx:

Step 1 — Input:

  • Large textarea: "Paste your markdown here"
  • Dropdown: "Split on" — ## Headings (H2), ### Headings (H3), # Headings (H1), <!-- split --> delimiter
  • "Preview Split" button

Step 2 — Preview:

  • List of detected sections: title, word count, first 100 chars
  • Checkboxes to include/exclude each section
  • Editable slug field (auto-generated from title)
  • "Import Selected" button

Step 3 — Import:

  • Call section creation endpoints to add to existing project (or create new project)
  • Progress indicator during import
  • Success: navigate to project / refresh section list

Backend

POST /api/projects/{slug}/import-markdown

{"markdown": "## Overview\n\nContent...\n\n## Tech Stack\n\nMore...", "heading_level": 2, "replace_existing": false}

Returns: {"created": ["overview", "tech-stack"], "skipped": [], "errors": []}

POST /api/projects/{slug}/import-markdown/preview
Same body, returns split preview without creating anything:

{"sections": [{"slug": "overview", "title": "Overview", "word_count": 150, "preview": "First 100 chars..."}], "conflicts": ["overview"]}

Reuses existing prd_import_markdown MCP tool logic exposed as REST.

Trigger

  • "Import Markdown" button in project list page (creates new project)
  • "Import Markdown" button in section sidebar header (adds to current project)

Acceptance Criteria

  • Pasting markdown with H2 headings correctly splits into sections
  • Preview shows accurate section boundaries
  • Conflicting slugs detected and shown
  • Import creates sections with correct content
  • Empty sections handled gracefully

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendFastAPI Python API, REST endpointsarea:frontendNext.js dashboard, UI components, shadcn/uitype:featureNew feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions