Skip to content

Repair path: import a finished book from Word, export it back - #5

Closed
MrPickering wants to merge 2 commits into
agent/weaver-s1-doctorfrom
agent/weaver-s2-repair
Closed

MrPickering wants to merge 2 commits into
agent/weaver-s1-doctorfrom
agent/weaver-s2-repair

Conversation

@MrPickering

Copy link
Copy Markdown
Contributor

Stacked on #4 (which is stacked on #3). Merge in order, retargeting each to main.

Why

Weaver could only draft forward from an outline. The common real request is repairing a finished manuscript, where the original file must never change.

What

  • weaver import <file|folder>: DOCX (stdlib ZIP/XML), Markdown, text, or a folder of chapter files. It splits chapters on headings or "Chapter N" lines and scenes on break lines. POV comes from the chapter title, and an untitled chapter carries the previous POV. It refuses a book that already has scenes, writes an import record, and never touches the source (sha256 checked before and after).
  • Word specifics: hyperlink text and field results are kept; footnotes, endnotes and comments are left out and counted in the summary. Unaccepted tracked changes are refused. The author decides which changes stand, not the importer.
  • Prose fidelity: italics are stored as *x*, and literal asterisks and backslashes are escaped, so f*** and 5 * 3 round-trip. Scene breaks are exported literally.
  • weaver export --format md|docx: deterministic, refuses to overwrite, refuses to target the source's name.
  • weaver init --empty starts a book for import.
  • Imported books keep the stale-state release gate.
  • Plain error messages, not stack traces.
  • README: "How PickBits Weaver works" states the setup requirements up front.

Verification

  • npm run preflight: 29/29, leakscan, consumer install
  • A manuscript written by Microsoft Word (hyperlink, DATE field, footnote, comment, italics, curly quotes, em dash, tracked change) is refused while changes are pending. After Accept All in Word, it imports correctly and reports "Not imported: 1 comment, 1 footnote". The source is byte-identical afterwards.
  • Weaver's DOCX export opens in Word: literal f*** and 5 * 3, a literal * * * scene break, only the intended word in italics, and the title in the Title style.

🤖 Generated with Claude Code

Weaver could only draft forward from an outline. Most real requests are
repairing a finished manuscript whose original must never change.

- `weaver import <file|folder>` reads DOCX (stdlib ZIP/XML), Markdown,
  text, or a folder of chapter files. It splits chapters on headings or
  "Chapter N" lines and scenes on break lines, and takes POV from the
  chapter title (an untitled chapter carries the previous POV). It
  refuses a book that already has scenes, writes an import record, and
  never touches the source (sha256 checked before and after).
- Word specifics: hyperlink text and field results are kept; footnotes,
  endnotes and comments are left out and counted in the summary.
  Unaccepted tracked changes are refused: the author decides which
  changes stand, not the importer.
- Scene prose stores italics as *x* and escapes literal asterisks and
  backslashes, so "f***" and "5 * 3" survive a round trip. Export writes
  literal scene breaks, never through the italics parser.
- `weaver export --format md|docx` writes deterministic output and
  refuses to overwrite files or target the source's name.
- `weaver init --empty` starts a book for import.
- Imported books keep the stale-state release gate: `check` reports it
  and `release` refuses until narrative state is current.
- The CLI prints plain error messages, not stack traces.
- README: "How PickBits Weaver works" states the setup requirements
  up front.

Verified: npm run preflight (29/29). A manuscript written by Microsoft
Word (hyperlink, field, footnote, comment, italics, curly quotes, em
dash, tracked change) is refused while changes are pending, and imports
correctly once they are accepted. Weaver's DOCX export opens in Word with
literal asterisks, a literal scene break, correct italics and a Title
style.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Session-Id: 04db4d93-9884-44ee-b28f-627e92b33731
Agent: claude-code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Session-Id: 04db4d93-9884-44ee-b28f-627e92b33731
Agent: claude-code
@MrPickering

Copy link
Copy Markdown
Contributor Author

Landed on main via #9 (merge of the full stack).

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.

1 participant