Skip to content

Add modular renderer, PDF output, and session transcript#12

Merged
houfu merged 4 commits intomainfrom
feat/modular-renderer-pdf-docx
Feb 25, 2026
Merged

Add modular renderer, PDF output, and session transcript#12
houfu merged 4 commits intomainfrom
feat/modular-renderer-pdf-docx

Conversation

@houfu
Copy link
Owner

@houfu houfu commented Feb 25, 2026

Summary

  • PDF output for docx templates — after rendering a .docx, Codraft now attempts PDF conversion via docx2pdf (uses MS Word on macOS/Windows, LibreOffice on Linux) with a LibreOffice headless fallback. Soft-fails with a warning if neither tool is available; the .docx is always delivered.
  • Modular, on-demand dependency installation — core packages (docxtpl, pyyaml, jinja2) are installed upfront; docx2pdf is installed only for docx jobs and weasyprint only for HTML jobs. No unnecessary packages loaded.
  • Session transcript — after rendering, the Orchestrator generates transcript.md in the job folder recording the full interview: values collected, conditional sections included/skipped, and loop items. Works natively in Claude Code and Cowork (both render Markdown).
  • Orchestrator updated — Phase 7 now generates the transcript (Step 7a) then presents results with links to all output files including the transcript (Step 7b).
  • Output folder deduplication — renderer no longer silently overwrites an existing job folder; appends _2, _3, etc. when a same-named folder already exists.
  • Docs updated — quick-rendering feature page, templates reference, introduction, and changelog (v0.2.1 entry added).
  • Prominent Download button on docs landing page — hero now has a direct Download button linking to codraft-latest.zip, so Cowork users can download without navigating into the install guide.

Test plan

  • Run codraft on templates/_examples/Bonterms_Mutual_NDA/ (simple docx) — confirm transcript.md has clean table-only sections, no conditional annotations
  • Run codraft on templates/_examples/consulting_agreement/ (docx, groups + conditionals + loop) — confirm .docx + .pdf produced, transcript sections annotated correctly, loop items as **Item N** sub-sections
  • Run codraft on templates/_examples/event_invitation/ (HTML, conditionals + loop) — confirm transcript saved to HTML job folder
  • Render the same template twice in one day — confirm second job gets _2 suffix, first job untouched
  • Soft-fail path: remove/rename soffice and uninstall docx2pdf — confirm .docx delivered with warning message
  • No regression: both template types still render correctly
  • Docs landing page: confirm four hero buttons render (Get Started, Download, Feature Tour, GitHub); Download triggers codraft-latest.zip download

🤖 Generated with Claude Code

houfu and others added 2 commits February 25, 2026 06:35
- Renderer now installs only what's needed: docx2pdf for docx jobs, weasyprint for HTML jobs; core packages (docxtpl, pyyaml, jinja2) only - DOCX → PDF conversion attempts docx2pdf first, falls back to LibreOffice headless (soffice), soft-fails with warning if neither available - Orchestrator relays PDF warning and suggests manual conversion when PDF is not produced - Docs updated: quick-rendering, templates reference, introduction, changelog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After rendering, the Orchestrator now generates a transcript.md in the job folder recording the full interview: questions asked, values collected, which conditional sections were included or skipped, and loop items. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@houfu houfu changed the title Add modular renderer with on-demand deps and PDF output for docx Add modular renderer, PDF output, and session transcript Feb 25, 2026
houfu and others added 2 commits February 25, 2026 21:00
Replace exist_ok=True with a deduplication loop that appends _2, _3, etc. when a same-named job folder already exists, preventing silent overwrites when the same template is rendered for the same person on the same day. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@houfu houfu merged commit fb70ff1 into main Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant