PRD: docforge — modular doc-generator engine for paliad + upc-commentary #157
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Direction (m, 2026-05-29 12:32–13:55)
Locked constraints (confirmed)
pkg/docforge— name bikeshed during PRD) with clean sub-packages. Same model aspkg/litigationplannertoday.UPCommentary/upc-kommentar). Design the resolver / importer abstractions with both in mind from day one.type VariableResolver interface { Resolve(key string) (string, bool) }) for testability + clean separation.Today's state — what to audit
internal/services/submission_*.go(~12 files) — current home for vars / merge / md / render / draft / base / section / building_block.internal/handlers/submission_*.go(~5 files) — HTTP surface for the editor.frontend/src/client/submission-draft.ts+submission-draft.tsx— editor UI.b78a984→ main1b4b2e4), the placeholderRegex contract (submission_merge.go:95), the live-preview-with-click-to-jump (data-var contract), the building-block + section model.addProjectVars/addUserVarsetc) rather than a clean interface.Inventor task
Grill in prose FIRST — 3-5 core-metaphor questions before any AskUserQuestion batch. atlas's #152 + edison's #153 debriefs both flagged: structured chips with the wrong core-metaphor lock costs a doc rewrite.
Prose-grill candidates:
engineend andvariablesbegin? Do importers belong INSIDE engine (since they parse OOXML) or as a sibling? Tests of this seam: can a new format adapter (markdown importer, say) be added without touching engine internals?Then structured AskUserQuestion batches (4-Q max per batch, ~12-16 total) on hard UX/data/migration decisions.
Draft
docs/plans/prd-docforge-2026-05-29.md:internal/services/submission_*.goto the new package. Critical: this is a big-ish refactor of working code — migration plan must protect the in-flight Submission generator AND the recent fixes (last night's underscore fix, building-block model, click-to-jump data-var contract).Report DESIGN READY FOR REVIEW and park persistent. Head gates the coder shift.
Out of scope for the PRD: implementation, mig SQL drafting, code. PRD only.
NOT atlas / cronus / edison (parked with framing bias on procedures). Fresh Opus inventor.
PRD ready for review — docforge
Design committed:
docs/plans/prd-docforge-2026-05-29.md(0918049) on branchmai/leibniz/inventor-prd-docforge.Status: DESIGN READY FOR REVIEW — awaiting head/m go-no-go on the coder shift.
Premise correction (verified against live repos)
UPCommentary/upc-kommentaris Bun/SvelteKit/TS, zero Go — it cannot import a Gopkg/. Per m: out of scope as a live consumer for now; docforge is a pure Go pkg (in-process likepkg/litigationplanner), interfaces sized so an HTTP veneer is addable later.submission-draft.tsx(single.tsbundle);lukasjarosch/go-docxis comment-only — the renderer is purearchive/zipOOXML, no third-party docx dep.m's 13 decisions (5 prose-grill + 8 structured) — all captured in §4
TemplateStoreinterface (Supabase Storage = 1-impl swap). Snapshot at draft-create. Extract-in-place migration.8-slice train (§7)
extract docx engine → neutral model+binding →
VariableResolverinterface → template store+schema → UI pkg extraction → authoring page → generation on uploaded templates → markdown importer + exporter finalisation. Slices 1-3 are behavior-preserving refactors front-loaded under golden-export + preview-string checks that protect theb78a984underscore fix, the placeholderRegex + data-var contracts, and the building-block/section model.Coder gate is the head's to call.
Sweep verdict (2026-07-29): PARTLY.
The paliad half shipped and is wired:
pkg/docforgewithdocforge/docxanddocforge/markdown, consumed byinternal/handlers/templates.goandinternal/handlers/submission_drafts.go, with the editor atfrontend/src/lib/docforge-editor/.The PRD's second consumer — upc-commentary — is a different repository and cannot be verified from this one. That half is unconfirmed rather than unshipped.
Full sweep:
docs/findings-issue-sweep-2026-07-29.md(commit4c39886).