feat: add Copy Draft, Markdown, and Word export for AI outputs

↗ view on GitHub · Claude · 2026-05-19 · b4345deb

Adds three export actions below every Gary assistant response so U.S.
lawyers can move drafts into Word, email, or their own templates in one
click:

- "Copy Draft" - clipboard copy with HTML + Markdown payloads so paste
  into Word preserves headings and bullets; plain-English status text.
- "Download Markdown" - `.md` file with safe filename like
  `contract-review-draft-2026-05-19.md`, wrapped with a short title
  block (matter, Saved Legal Task, date) and an attorney-review
  reminder.
- "Download Word Draft" - `.docx` via the already-installed `docx`
  package; preserves headings, paragraphs, bullets, and simple GFM
  tables; ends with a short footer note.

Helpers live in `frontend/src/lib/exportDraft.ts` and are reused by both
the standalone assistant chat and the per-matter chat. Exports include
only the assistant's prose - internal events, tool calls, IDs, and
annotations are intentionally excluded.

Adds focused tests in `exportDraft.test.ts` covering filename safety,
header content, attorney-review reminder, no API-key/internal-ID
leakage, and clipboard failure messaging.

Updates the U.S. lawyer setup guide with a "Copying or Downloading
Drafts" section, and extends the terminology map.
Repository zgbrenner/gary
Author Claude <noreply@anthropic.com>
Authored
Parents fb699b29
Stats 7 files changed , +1166 , -40
Part of Copy Draft / Markdown / Word export for AI outputs

Capture this commit into my fork

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

⬇ Download capture-commit-b4345deb.md