Skip to content

feat: add 'Copy as JSON' button to repository brief#71

Open
vultuk wants to merge 1 commit into
mainfrom
fix/70-copy-json-brief
Open

feat: add 'Copy as JSON' button to repository brief#71
vultuk wants to merge 1 commit into
mainfrom
fix/70-copy-json-brief

Conversation

@vultuk

@vultuk vultuk commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Closes #70

Summary

Add a "Copy as JSON" button alongside the existing Markdown export on cached repository brief pages, allowing users to copy structured analysis data to their clipboard.

What changed

  • Added generateBriefJson() function to web/src/lib/export-brief.ts that produces pretty-printed JSON with all analysis data (upstream summary, stats, recommendations, and full fork analysis)
  • Added "Copy as JSON" button to the cached repository brief toolbar in web/src/components/repository-brief.tsx
  • Button uses navigator.clipboard with textarea fallback (matching the existing ShareSnapshotButton pattern)
  • Shows "Copied!" confirmation with check icon for 2 seconds after copying

Why

The existing Markdown export is great for documentation but hard to parse programmatically. Users who want to share Discofork data in structured form (scripts, databases, chat) previously had no quick path from the web UI.

Validation

  • npx bun run typecheck (root) — passed
  • npx bun run typecheck (web) — passed
  • npx bun run build (web) — passed, all routes healthy

Risks

  • Minimal: two files touched, pure client-side addition, no backend changes
  • The button reuses the same Download icon as the Markdown export; the label text "Copy .json" distinguishes it

Add a 'Copy as JSON' button alongside the existing Markdown export on
cached repository brief pages. Copies all analysis data as pretty-printed
JSON to the clipboard with a 'Copied!' confirmation.

Closes #70
@vultuk vultuk self-assigned this Apr 12, 2026
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.

Web: Add 'Copy as JSON' button to repository brief

1 participant