Repository navigation
feat(books): outline editor, browser test and docs (7/7) - #274
Open
nehalkumarsingh wants to merge 15 commits into
Open
nehalkumarsingh wants to merge 15 commits into
nehalkumarsingh wants to merge 15 commits into
Conversation
nehalkumarsingh
requested review from
anuragrao04 and
razvi-razorpay
as code owners
November 4, 2026 11:46
nehalkumarsingh
force-pushed
the
nehal/book-mode-6-reader
branch
from
November 5, 2026 10:49
d9731a5 to
1d5f068
Compare
nehalkumarsingh
force-pushed
the
nehal/book-mode-7-editor
branch
from
November 5, 2026 10:49
39b4a98 to
f4fdea0
Compare
Folder editors get "Make this a book" on the folder page (or "Read as book" once one exists), which opens an outline editor. The editor edits a local draft: drag or Move up/down for chapters and parts, Move to part, planned chapters, front and back matter, and a Not in outline list. Chapter numbers follow the draft live. Save sends the base version and an optional note; 422 problems show at their rows and 409 offers a reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#273 hid the button until the outline route existed. This PR adds the route, so editors get the button again; readers still do not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The outline error screen shows only when there is no outline, so a failed refetch after a save keeps the editor and its draft. It offers Try again, retries outages like the other book reads, and neither the outline nor the manifest query raises the global error toast: the page explains its own errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The folder's book lookup answers 404 for every ordinary folder, and the global query handler toasted it. The lookup now keeps its errors to itself, and only a 404 offers Make this a book: after any other error the folder may already have one, so the action shows nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The manifest's toc has chapters only, so every front and back matter row read "Untitled document", and removing one put that name in the pool. Titles now come from readingOrder, which has every document slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows were keyed by index, so after "Move Alpha down" the focused button belonged to Beta and a second press undid the move. Rows now have stable keys: the document id, or a client-only key for parts and planned chapters that is dropped before the outline is compared or sent. After a move, focus goes to the moved row's Move button in the same direction, or the other one at an edge, across parts too. Also: an empty subtitle no longer marks the draft changed, removePart reuses poolEntry, the draft is cloned with structuredClone, the row label reuses the row name, and the global-error spies in the tests are typed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server prunes deleted and moved-out documents before it returns the outline, so the draft matched it and Save stayed disabled while the notice said saving would drop them. Save is now enabled while documents were removed, and the notice says "Save to drop them". An empty subtitle no longer counts as a change (test for the previous commit's normaliser). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The banner came from the history state, which survives a save and a refresh, so it kept showing the creation-time counts. The page now reads the state once and clears it, and shows the banner only on the first outline version. Reload refetches through the book's query key alone, which covers the outline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drops the canEditFolder alias; the R1 note moves to the call site. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The main test is marked slow: it makes several page loads with nested frames, a second browser context and throttled saves, which can pass the default 30 s on a slow runner. A viewport report that arrives before the reader has restored its place is dropped, and nothing reports again until the next scroll, so a one-shot wait for the position save could hang. The test now watches for the save and scrolls again whenever it does not come. A new test opens a chapter that fits on screen and checks that it is not marked read when it opens (#272's reached-end rule). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guidelines told agents to pass --base-version <n>. The flag takes the outline's version_id (bov_...), and an agent that passed the outline number got a conflict on every push, then a "pull again" loop. The guidelines and the skill now say to push the pulled file, whose version_id is the base, and to pass --base-version only with a bare outline, as the version_id. Both say the book commands work only when Book mode is enabled on the server. The heading-id guideline test checks only the review page; the join over every page was redundant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… details - Book search results come back in relevance order, not by chapter number. - "Reached the end" follows the shipped rule: a scroll to the end in this visit, or 15 seconds on screen for a chapter that fits. - Outline versions are listed through the API; the editor shows the current version number. - With Book mode off the MCP server does not offer the book tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…titles
- The outline query refetches on every mount (no staleTime: Infinity) and
the page shows its skeleton until this visit's fetch, so a returning
editor never builds a draft on a cached version and then hits a
conflict on Save. Focus and reconnect refetches stay off.
- The page also waits for the manifest, so placed rows never flash (or,
when removed, stay) "Untitled document"; a manifest error still falls
through to generic names.
- The "fits" browser test waits for a position save for the chapter before
its 3 s no-reached_end window, so it cannot pass on a hook that dropped
every report.
- self-hosting.md: the flag also disables /v1/folders/{id}/book.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nehalkumarsingh
force-pushed
the
nehal/book-mode-6-reader
branch
from
November 5, 2026 12:13
1d5f068 to
7a20082
Compare
nehalkumarsingh
force-pushed
the
nehal/book-mode-7-editor
branch
from
November 5, 2026 12:13
f4fdea0 to
6dd1fe0
Compare
Contributor
Author
End-to-end test evidence (stack tip
|
| Check | Result |
|---|---|
| Walkthrough: 12 flows, each asserted through the API and the screen | 12/12 pass |
frontend/e2e on the same server |
26/28. book-mode.spec.ts passes 4/4. The 2 failures need Dex: the public-view sign-in and the @mention picker. The stack changes none of that code. |
| Frontend unit tests | 289/289 |
| Go suite (Postgres-backed, 0 skipped) | pass |
| golangci-lint v2.14.0 | 0 issues |
| Flag off | every book route 404, no book buttons, chapters still open as documents |
What this PR's code did in the run:
- "Make this a book" on a folder opens the outline editor, seeded in title order.
- Save stays disabled until an edit, and an edit to the subtitle and note saves (200).
- With the flag off, the folder shows neither "Make this a book" nor "Read as book".
- A note: a title whose number doesn't match its position (
5 · Being on callas chapter 4) keeps its prefix. That is per the spec, but it could use a sentence in the authoring docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: 7/7. Based on #273 (reader UI), then #272, #271, #270, #269 and #268. Review this PR after #273.
What and why
This PR finishes Book mode v1.
Outline editor (
/app/b/:bookId/outline, folder editors only):@dnd-kit/core, plus keyboard Move up/down;Folder page: "Make this a book" for folder editors when Book mode is enabled, and "Read as book" once a book exists.
Browser test (
frontend/e2e/book-mode.spec.ts), which runs in CI:The e2e stack sets
SLASHDOCS_BOOKS_ENABLED=true.Configuration and docs:
SLASHDOCS_BOOKS_ENABLEDin.env.example, Helm (features.books, default false) anddocs/self-hosting.md;skills/slashdocs/SKILL.mdgains a Books section;TODOS.mdadds two follow-ups: signed-out readers of public books, and one batched access query for manifests;How it was tested
npm testpasses all 208 tests,npm run lintshows 0 errors,npm run format:checkis clean andnpm run buildpasses.go test ./api/... ./internal/... ./cli/... -count=1passes with 0 skipped DB tests.npm run e2e:typecheckandplaywright --list. It runs in CI withmake e2e-browser; the author's machine has no Docker.helm templatesetsSLASHDOCS_BOOKS_ENABLEDfromfeatures.books.Checklist
.env.example, Helm,docs/self-hosting.md, guidelines, skill, proposal,TODOS.md)🤖 Generated with Claude Code