Files
wordcraft/ROADMAP.md
T
663904a2e2 Import Word 97-2003 .doc files (#28) (#145)
* D0+D1: open Word 97-2003 .doc — container, FIB, piece table text (#28)

New wordcraft-docbin crate (L2) reads the OLE2 container via the cfb
crate (MIT) and parses the FIB and piece table from the [MS-DOC]
specification: text pieces decode as UTF-16LE or Windows-1252 (table
moved to wordcraft-doc::encoding), subdocument CP ranges, and Word's
special characters map to the model's (tabs, breaks, hyphens). .doc/.dot
registered in OPEN_EXTS and the I/O dispatch. Encrypted and Word 6/95
files give clear errors; every length is checked and proptest
truncation/flips never panic.

* D2: .doc formatting — stylesheet, fonts, CHPX/PAPX FKPs, sprms (#28)

Sprm decoder with operand-size rules (incl. sprmTDefTable/sprmPChgTabs
exceptions and the Prm0 isprm table), bin tables + ChpxFkp/PapxFkp page
lookup, STSH styles (StdfBase layout validated against real Word files:
bchUpe == cbStd, sti 0 = Normal) and the SttbfFfn font table in both
extended and self-delimiting flavours. The CP walk now splits runs on
formatting changes and resolves paragraph styles: bold/italic/strike/
underline/caps/hidden, colours (Ico palette + COLORREF), half-point
sizes, super/subscript, fonts, highlights; alignment, indents, spacing,
keep options, outline levels. Unknown sprms are skipped leniently;
an env-gated corpus test opens real files (styles + text asserted).

* D3: .doc structure — sections, headers/footers, tables, lists (#28)

- Sections: PlcfSed/Sepx with 16-bit measurement sprms (sprmSXaPage & co),
  explicit sprmSBOrientation with a width/height fallback; even/odd/first
  header and footer stories from Plcfhdd become document parts.
- Tables: sprmTDefTable grids (operand length fixed to cb+1 per the spec),
  horizontal merges (sprmTMerge), vertical merges (sprmTVertMerge), cell
  shading (sprmTSetShd / sprmTDefTableShd80), cell widths, valign, row
  height/header/cant-split, and table borders (sprmTTableBorders80 Brc80s).
- Lists: PlfLst (LSTF + appended LVLs) and PlfLfo (LFO + LFOLVL overrides)
  resolved into the numbering model; sprmPIlvl/sprmPIlfo mark paragraphs.
- Combined fixture (intro + table + list + 2 sections + header) round-trips
  through Document JSON; hostile proptests now mutate the structured fixture.

* D4: .doc notes, fields, bookmarks and inline pictures (#28)

- Footnotes/endnotes: PlcffndRef/PlcfEndRef reference CPs paired with the
  PlcffndTxt/PlcfEndTxt story ranges; each story walks into a Footnote or
  Endnote part and the 0x02 anchor becomes a NoteRef object.
- Fields: 0x13/0x14/0x15 state machine in the walker — instruction text is
  hidden, the cached result kept; HYPERLINK fields keep their result as
  linked runs, everything else becomes one Field object.
- Bookmarks: SttbfBkmk names + Plcfbkf/Plcfbkl CPs become BookmarkStart/
  BookmarkEnd objects at their anchors.
- Pictures: sprmCPicLocation points into the Data stream; the PICF header
  gives the display size (dxaGoal/dyaGoal scaled by mx/my) and the payload
  is format-sniffed (PNG/JPEG/GIF/BMP; metafiles are dropped with a warn).
- Hostile proptests now truncate/flip a fixture with all of the above.

* D5: .doc import hardening, caps and roadmap (#28)

- Cap inline pictures at 5 000 per document.
- Engine test: .doc/.dot bytes dispatch through the Word 97-2003 reader
  (garbage must error, never panic or open empty).
- ROADMAP: Word 97-2003 import row (60% — text, formatting, styles,
  sections, headers/footers, tables, lists, notes, fields, bookmarks,
  raster pictures).

Real-corpus validation stays opt-in: WORDCRAFT_DOCBIN_FIXTURES=<dir>
cargo test -p wordcraft-docbin corpus_files_open.

* Corpus fixes: compressed-piece FC space, PAPX query point, none-level labels (#28)

Validated against two real files (kept locally under plan/word/fixtures,
gitignored): a 1 MB Lorem-ipsum sample and a 2003 styles/lists/table
sample.

- FKP bin tables and pages address the WordDocument stream in true byte
  offsets; a compressed piece stores its base fc doubled (byte = fc/2),
  so fc_of_cp now unwinds the doubling. Before, every PAPX/CHPX lookup in
  compressed (cp1252) files landed on the wrong entry — tables collapsed
  to one row, lists and heading styles were lost.
- The paragraph-properties query now uses the paragraph mark's own FC
  (inside the paragraph) instead of the FC after it, which picked up the
  next paragraph's FKP entry.
- Fixture papx entries re-keyed to paragraph-start CPs, the real rgfc
  convention.
- Counters::next_label returns nothing for NumFormat::None levels (Word's
  numFmt none shows no label; also fixes a latent docx-reader case).
- Symbol/Wingdings bullet chars map to Unicode glyphs (• ▪ ○ ●).

With this, both corpus files render headings, styles, nested and numbered
lists, the tables and the PAGE field correctly; metafile-wrapped images
and OLE objects stay dropped by policy (logged).

* docbin: bound the text walk by real text; dedupe and cap pictures (#28)

Hostile CP numbers no longer drive the work:
- header/footnote/endnote story ranges from the Table stream are clamped to their
  subdocument (ccpHdd/ccpFtn/ccpEdn) with checked base additions, and every walk stops at
  the last piece's CP; a story spanning [0, 4e9) used to push billions of U+FFFD;
- characters are found by binary search over the pieces (PieceTable::char_at), and an
  unreadable stretch (gap, truncated or out-of-stream piece) is skipped in one step rather
  than one U+FFFD per CP; the old per-character scan was O(chars x pieces);
- the piece CPs are made non-decreasing at parse, so inverted pieces are empty and binary
  search stays sound; surrogate pairs now decode;
- note references are looked up by binary search; the style's CharProps is borrowed, not
  cloned, per character;
- pictures are interned by fc_pic (5000 anchors on one picture share one media entry and
  one copy) and the bytes copied per document are capped at 256 MB.

Each fix has a crafted-bytes regression test; against the previous code the story,
piece-claim, last-piece and many-pieces tests hang (killed at 60 s) and the shared
picture test copies the picture once per anchor (80 GB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docbin: checked offset arithmetic in lists, sections and table rows (#28)

- list.rs: PlfLst/PlfLfo/LVL offsets (at + 2 + cLst*28, at + 4 + lfoMac*16, off += len,
  ...) saturate, which matters on 32-bit targets (wasm32) where fc + n can overflow usize;
  the LFO override path no longer indexes abstracts directly.
- sections.rs: the Sepx range (fc_sepx + 2 + cb) is checked; Plcfhdd is read only as far
  as the stories a capped section count can use (it used to reserve lcb/4 entries).
- table.rs: sprmTDyaRowHeight = i16::MIN negated in i16 (overflow panic in debug builds);
  now -(v as f32).

Regression tests: the row height test failed before (overflow panic with debug assertions, a 0 pt height without); the list test pins the saturating
offsets (it only overflowed on 32-bit targets).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Format the merged OPEN_EXTS list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 08:36:38 -04:00

8.0 KiB
Raw Blame History

WordCraft roadmap

WordCraft aims for complete feature parity with Microsoft Word, then goes further on speed, openness and agent control. This file tracks where we are honestly. Generated numbers come from cargo xtask parity (docs/parity.md).

Where we are (2026-10-09)

Measure Value
Commands (every action, scriptable by CLI/MCP/control channel) 390
Feature catalog coverage (Word ribbon/menu features with a command) 355 / 405 (88%)
Estimated real feature parity (depth and fidelity, not just a command) ~62%
Distance to alpha ~85% of the way; ≈20–25 h of Claude wall-clock work
Distance to 100% parity ≈120–150 h of Claude Opus 5.5 wall-clock work (with parallel agents)
Tests ~225 test functions (unit, round-trip, fuzz/proptest, MCP acceptance)
Layout speed (188-page document) 61 ms cold, 1.4 ms relayout after an edit
Code ~44k lines of Rust in 12 crates and 3 apps

Catalog coverage overstates parity: many commands are first versions. The real-parity estimate weighs each area by how much of Word's behaviour it reproduces, and by how often people use it.

Alpha

What we mean by alpha: someone can write, format and review real documents every day, open the .docx files they receive and send back files Word opens cleanly, on every desktop platform from a signed download, without losing work.

Alpha requirement State
Editing, formatting, styles, lists, tables, headers/footers, references, review done (first versions, tested)
Pagination fidelity: wrap, row splitting, hyphenation, drop caps, line numbers, borders done this arc
Comments in margin balloons, track changes done
Never-crash standard (no panics, hostile-param fuzzing, panic guard) done
Autosave and crash recovery done; needs a soak test
DOCX fidelity against a corpus of real-world files (open, render, round-trip, fix) not started — the main alpha blocker (≈10 h)
Footnotes that continue onto the next page; column balancing missing (≈4 h)
Native printing (today printing goes through PDF) missing (≈4 h)
Signed builds for macOS, Windows, Linux, FreeBSD and web pipeline written; needs the GitHub remote and release secrets from the owner
Real app icon / mascot art placeholder; needs owner art

So: alpha is roughly 85% of the way, with about 20–25 hours of agent work left, plus two owner actions (push to github.com/storytold/wordcraft and enable the release secrets, and supply the icon art).

Parity by area

Area Status Parity
Typing, selection, clipboard, undo, find/replace Solid; IME, autocorrect, smart quotes, list autoformat 85%
Character & paragraph formatting Nearly all properties; Font/Paragraph dialogs 85%
Styles (gallery, pane, create/modify, style sets, themes) Good 75%
Lists (bullets, numbering, multilevel, restart, set value) Good 75%
Tables (insert, merge/split, styles, borders, header rows, sort, formula) Good; rows split across pages; no drawn tables, no nested-table polish 72%
Page layout (margins, size, orientation, columns, breaks, sections) Good; page borders, line numbers, vertical alignment, drop caps, hyphenation; columns don't balance 72%
Headers/footers, page numbers, fields Good; first/even/odd, link to previous 70%
Footnotes/endnotes Placed and editable; long notes don't continue onto the next page 60%
References (TOC, citations APA/MLA/Chicago/IEEE, bibliography, index, figures, cross-refs, TOA) Working first versions; Zotero/Mendeley ADDIN fields and custom properties round-trip; Zotero in the app (ui.zotero.*, wordcraft-cli zotero): citations, bibliography, refresh, unlink, document preferences, in-text ↔ footnote switching, Zotero ribbon tab, Move Past Citation; Read Aloud player (speed, previous/next sentence, skips citations and bibliography) 60%
Review (spelling, grammar, thesaurus, comments, track changes, compare, protect) Good; comment balloons in the margin; no track-changes balloons 75%
Mailings (mail merge, rules, preview, envelopes, labels) Working 70%
Pictures & shapes (insert, size, crop, recolour, effects, styles, float position) Text wraps around floats (rectangular); text boxes render their text; no tight/contour wrap, no rotation handles 55%
Draw tab (ink), SmartArt, charts, 3D models, equations editor Not started / linear equations only 5%
File formats: DOCX read/write Good (Word opens our files); charts/SmartArt/OLE dropped; untested on a real-world corpus 75%
File formats: PDF, ODT, RTF, HTML, Markdown, LaTeX, TXT Working 70%
File formats: Word 97-2003 .doc/.dot import Text, formatting, styles, sections, headers/footers, tables, lists, notes, fields, bookmarks, pictures (spec-based reader; metafile images and Word 6/95 rejected) 60%
View modes (print, web, draft, read, focus, zoom, navigation pane) Working 70%
Backstage (new from templates, open, info, export, options) Working; printing goes through PDF 55%
Agent control (CLI, MCP, control channel, macros) Beyond Word 100%+

Estimate to 100%

About 120–150 hours of Claude Opus 5.5 wall-clock work (with parallel agents), in this order:

  1. Alpha blockers (≈20–25 h): DOCX fidelity corpus, footnote continuation, column balancing, native printing, autosave soak test, first signed release.
  2. Objects (≈15 h): tight/through (contour) wrap, rotation and resize handles on the canvas, grouping, z-order polish, track-changes balloons and formatting revisions.
  3. Draw tab / ink (≈15 h).
  4. Charts (own renderer) and SmartArt-style diagrams (≈20 h).
  5. Equation editor (OMML read/write, 2D layout) (≈15 h).
  6. Dialog depth: every Word dialog with all its options (Font, Paragraph, Tabs, Borders and Shading, Page Setup, Styles, Columns, Index/TOC options, Mail Merge wizard, Options panes) (≈20 h).
  7. Accessibility (screen readers), localisation, RTL and complex scripts (≈15 h).
  8. Long tail: kerning/ligature options, drawn tables, nested-table polish, more templates, Word's less-used commands still missing from the catalog (≈10 h).

Milestones

# Milestone State
M0 Skeleton + vertical slice (model, layout, render, engine, Word-style UI, CLI, MCP, web) done
M1 DOCX I/O done (first version; corpus testing next)
M2 Home tab complete done
M3 Insert tab mostly done (charts/SmartArt/icons/3D missing)
M4 Layout + Design tabs done except column balancing
M5 Tables done (row splitting landed)
M6 References first version done; footnote continuation missing
M7 Review done (margin balloons landed)
M8 View mostly done
M9 Mailings done (first version)
M10 File/Backstage mostly done; native printing missing
M11 Draw + objects text wrap and text boxes done; ink, rotation, grouping missing
M12 Formats breadth (PDF, ODT, RTF, HTML, MD, TXT) done (first versions)
M13 Performance budgets on track (1.4 ms relayout)
M14 1.0 polish, packaging, signing pipeline written; waiting on remote and secrets

Recently landed

  • Ukrainian interface catalog: all existing 771 labels, Ukrainian locale detection and a persisted language choice (#85).
  • Brazilian Portuguese interface catalog: all existing 771 labels, pt-BR locale detection and a persisted language choice (#127).
  • Text wraps around floating pictures and shapes; text boxes lay out their own text.
  • Table rows split across pages between lines (Can't Split honoured, header rows repeat).
  • Drop caps; automatic hyphenation with Word's 0.25" hyphenation zone; soft hyphens.
  • Page borders measured from the page edge, line numbers, vertical alignment, column separators.
  • Comment balloons in a markup area beside each page, with leader lines to their anchors.

Next

The DOCX fidelity corpus, then footnote continuation, column balancing and native printing.