Skip to content

[Improvement] Deduplicate export logic between ExportPanel.tsx and CLI #191

@d-oit

Description

@d-oit

Description

The export logic is fully duplicated between src/features/export/ExportPanel.tsx and cli/index.ts. Both implement Markdown, JSON, and HTML site export independently with slightly different behavior and different security postures.

Duplication

Feature ExportPanel.tsx cli/index.ts
Markdown export ✅ Single file ✅ Per-entity files
JSON export ✅ Single file ✅ Single file
HTML site export ✅ Single file ✅ Single file
HTML escaping Partial (names only) None
Shared logic None None

Recommended Fix

  1. Extract shared export logic into src/lib/export/ module
  2. Create format-specific exporters: MarkdownExporter, JsonExporter, HtmlSiteExporter
  3. Use the shared module from both browser and CLI
  4. Ensure consistent security posture (escaping) across both paths

Acceptance Criteria

  • Export logic extracted to shared module
  • Both browser and CLI use shared exporters
  • Consistent HTML escaping across both paths
  • No duplicated export code

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions