Repository navigation
feat(cli): help a docs miss, read one docs section, print safely - #2317
Merged
Merged
Conversation
aicayzer
marked this pull request as ready for review
October 22, 2026 18:08
aicayzer
force-pushed
the
feat/cli-docs-recovery
branch
from
October 22, 2026 18:08
82ef545 to
3d3dbc5
Compare
aicayzer
enabled auto-merge (squash)
October 22, 2026 18:08
aicayzer
marked this pull request as draft
October 22, 2026 18:15
auto-merge was automatically disabled
October 22, 2026 18:15
Pull request was converted to draft
aicayzer
marked this pull request as ready for review
October 22, 2026 18:15
aicayzer
enabled auto-merge (squash)
October 22, 2026 18:15
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.
Summary
marfa docsnow recovers when a search finds nothing, can print one section of a page, and shows a page safely on a terminal. An agent that searched for a word the docs do not use gets the nearest page titles and where every page is listed, and one that needs a single command's section no longer reads a whole page (the changelog alone is 11,854 words).Closes #2312
Changes
marfa docs searchwith no hit printsno docs page matches "<query>", up to five page titles with their paths whose title, path or description hold words of the query (read from the site's topics), and "marfa docs topicslists every page." If the topics cannot be read, the plain miss and that line still print. With--jsonthe answer is the site's{"hits": []}and no topics request is sent.marfa docs <page> --section <heading>prints the part of the page under that heading, with the sections inside it. The heading is matched by its text in any case, or by its anchor (the site's[#anchor]or the one made from the text). Headings inside fenced code are not headings. With--jsonthe record gainssection.docs_section_not_found, naming the page and listing its headings, indented by depth.\u{..}, asprintableshows them for other text; line breaks and tabs stay. When stdout is a pipe, the bytes are exact.device/docs-search-miss,device/docs-search-miss-json,device/docs-sectionanddevice/docs-section-missinginconformance/spec/device.md, with one device fixture. The command reference (COMMANDS.md) is regenerated.Testing
cargo test -p marfa-cli,cargo clippy -p marfa-cli --all-targets -- -D warnings,cargo fmt --checkandpnpm format:checkpass.tests/docs.rs. The device fixturehelps a docs search that finds nothing, and reads one section of a pagefails with themarfabuild frommainand passes with this one.ESC[31m, a bell and a carriage return: the terminal shows\u{1b}[31m,\u{7}and\u{d}, and the pipe shows the exact bytes.marfa docs cli --section "Use another keychain file"on the real site printed that section only, and an unknown heading listed the page's headings.Notes for reviewers
marfa docslives in the docs repository and is updated after this merges.Checklist