Skip to content

feat(rust-docs): render source README on each crate's landing page#68

Merged
WomB0ComB0 merged 2 commits into
mainfrom
feat/rust-readme-on-landing
May 10, 2026
Merged

feat(rust-docs): render source README on each crate's landing page#68
WomB0ComB0 merged 2 commits into
mainfrom
feat/rust-readme-on-landing

Conversation

@WomB0ComB0
Copy link
Copy Markdown
Member

@WomB0ComB0 WomB0ComB0 commented May 10, 2026

Summary

Per request: keep the rich README rendering (mermaid diagrams, badges, install instructions) on each library crate's landing page, then list per-module API pages below.

Before

Each library crate's `index.md` was `cargo-doc-md`'s output — derived from the `lib.rs` `//!` doc comment. Accurate but plain: no diagrams, no badges, no install instructions. The mermaid architecture / install / examples in each crate's source `README.md` were ignored for library crates (only used for binary-only stubs).

After

Each library crate's `index.md` is now a hybrid landing:

  1. Version + license banner
  2. Cleaned source `README.md` (mermaid renders inline, badges intact, links rewritten to absolute GitHub URLs)
  3. `## Modules` section linking to each cargo-doc-md per-module page

Per-module pages (`bloom.md`, `count_min.md`, etc.) untouched — full rustdoc API surface preserved. Crates without a `README.md` (e.g. `resq-ai`) gracefully fall through to banner + Modules section only.

Live state

`sdks/rust/api/resq-{ai,bin,cli,dsa,tui}/index.md` rebuilt locally so the change is visible immediately on pull, no workflow regen needed:

Crate New landing length
resq-ai 12 lines (no README)
resq-bin 380 lines
resq-cli 590 lines
resq-dsa 455 lines (with mermaid Module Structure diagram)
resq-tui 689 lines

Test plan

  • Local rebuild produces correct content on each library crate's landing
  • After merge: pull + restart `bunx mint dev`; navigate to ResQ DSA → see Architecture mermaid diagram, badges, install snippet, then Modules linking to bloom/count_min/graph/heap/trie
  • Sync template to `resq-software/crates` so future regenerations follow the same pattern

Summary by CodeRabbit

  • Documentation
    • Significantly expanded and reorganized Rust SDK documentation across all crates with comprehensive guides, examples, and reference materials.
    • Added architecture diagrams, usage examples, configuration details, and API reference tables to improve developer experience.
    • Enhanced documentation workflow to generate richer landing pages with README integration and module navigation.

Review Change Stack

cargo-doc-md generated each library crate's index.md from the
lib.rs //! doc comment — accurate but plain (no diagrams, no
badges, no install instructions). The source README.md in each
crate has the rich content: mermaid architecture diagrams,
crates.io/docs.rs/license badges, install snippets, examples.
Previously that content was only embedded in binary-only stubs;
library crates dropped it on the floor.

Replace each library crate's auto-generated index.md with a
hybrid landing:

  1. version + license banner
  2. cleaned README.md from the source repo (mermaid diagrams,
     badges, install instructions, prose — full fidelity)
  3. ## Modules section linking to each cargo-doc-md per-module
     page

The original cargo-doc-md index.md content is dropped because
the README provides the same information more richly, and the
per-module pages keep the full API surface (types, traits,
functions, methods) intact.

Crates without a README.md (e.g. resq-ai) gracefully fall through
to banner + Modules section only.

Live sdks/rust/api/resq-{ai,bin,cli,dsa,tui}/index.md rebuilt
locally so the change shows up immediately when pulled. Future
regenerations stay correct via the updated template.
@github-actions github-actions Bot added the area:content MDX/MD documentation content label May 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Warning

Rate limit exceeded

@WomB0ComB0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 3 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c5e219b8-95b0-4b4a-bb89-ef802a99c526

📥 Commits

Reviewing files that changed from the base of the PR and between c8a66ee and d04de09.

📒 Files selected for processing (1)
  • sdks/rust/api/resq-cli/index.md
📝 Walkthrough

Walkthrough

The PR overhauls Rust API documentation across six crates by introducing a landing page generation workflow that assembles hybrid index pages combining version/license banners, cleaned README content with GitHub blob link rewriting, and auto-generated module listings. Five crate documentation pages are expanded from minimal stubs or briefly-organized reference material into comprehensive guides with architecture diagrams, detailed command/module/function reference, usage examples, and configuration documentation.

Changes

API Documentation Expansion and Landing Page Generation

Layer / File(s) Summary
Workflow Template
automation/source-repo-templates/api-docs.rust.yml
Workflow now replaces the rustdoc-generated landing index.md with an assembled page: copies the rustdoc markdown tree, collects module .md files (excluding root and library root), extracts cleaned README content (stripping first HTML comment and first H1, rewriting relative Markdown links to absolute GitHub blob URLs), injects version/license/crate/docs.rs banner, optionally appends "## Modules" section with module links, and writes final markdown to (dest / "index.md").
Simple Structure Update
sdks/rust/api/resq-ai/index.md
Title renamed from resq_ai to resq-ai; module section simplified from detailed formatted list to plain bullet list.
Binary Tool Documentation
sdks/rust/api/resq-bin/index.md
Expanded from minimal stub to comprehensive guide: adds metadata header, capabilities overview, architecture flowchart (parsing → Capstone/objdump → caching → output modes), installation/system requirements, full CLI argument reference table, usage examples (TUI, plain-text, JSON, recursive scan, config, cache rebuild), TUI mode section with three-pane layout and keyboard shortcuts, cache system documentation (location, CRC32 fingerprinting, hit/miss scenarios, JSON storage), TOML config format with precedence rules, JSON output schema with example and field reference table.
CLI Tool Documentation
sdks/rust/api/resq-cli/index.md
Comprehensive rewrite: new header (v0.3.0) with badges, installation section with cargo-alias mappings, overview with Mermaid command-graph diagram (primary/dev/version/TUI commands), detailed per-command reference for copyright, lqip, audit, cost, secrets, tree-shake, dev (subcommands), pre-commit, version (subcommands), docs with argument tables and examples; separate TUI launchers section (explore, logs, health, deploy, clean, asm); environment variables, configuration (root detection, gitignore fallback, osv-scanner, secrets allowlist, changesets location), standardized exit codes, simplified module navigation.
Data Structure Library Documentation
sdks/rust/api/resq-dsa/index.md
Expanded from brief overview to full rustdoc guide: richer header with version/license/docs links, module structure Mermaid diagram, feature flags with no_std/alloc guidance, dual installation instructions (std default vs no_std), detailed per-module sections (Bloom Filter, Count-Min Sketch, Weighted Directed Graph with BFS/Dijkstra/A*, BoundedHeap, Trie, Rabin-Karp) each with complexity table, API reference table (method/function signatures), and code examples; adds Quick Reference table, Contributing checklist, license, updated module navigation.
TUI Framework Documentation
sdks/rust/api/resq-tui/index.md
Replaced stub with comprehensive guide (v0.1.8, Apache-2.0): crate header with badges, overview of TUI vs non-TUI behavior and styling gates, architecture diagrams (module structure and dependency flow), installation with workspace/crates.io examples, detailed module reference for lib.rs (Theme fields, widget functions draw_header/footer/tabs/popup, centered_rect, utilities format_bytes/duration, SPINNER_FRAMES), theme module (AdaptiveColor, palette constants), detect module (environment variables, ColorMode, detection/styling gate functions), console module (formatter functions, stderr wrappers), table module (Align, Column builder, render_table styled/fallback behavior), progress module (ProgressBar construction/rendering/finish variants), spinner module (threaded behavior, TTY/accessibility, lifecycle methods), terminal module (Term, init/restore, TuiApp trait, run_loop signature); includes end-to-end integration guide (TuiApp example, non-TUI console example using console/spinner/table/progress), accessibility section (environment variables NO_COLOR/TERM=dumb/ACCESSIBLE and non-TTY behavior), license, module navigation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • resq-software/docs#43: Introduces the api-docs.rust.yml workflow template that is refined in this PR to implement the landing page assembly logic.

Suggested labels

area:content, area:meta

Poem

🐰 A Rabbit's Ode to Documentation

The workflow now speaks with refined intent,
Assembling landing pages eloquently sent,
Five crates adorned with examples and guides,
Architecture diagrams, each algorithm inside,
From bare stubs to bustling reference—hopping bright! 📚✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: rendering source README files on Rust crate landing pages, which aligns with the primary objective of retaining rich README content (diagrams, badges, examples) on each library crate's index.md.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rust-readme-on-landing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sdks/rust/api/resq-cli/index.md`:
- Line 214: The MDX build fails because the unescaped "<" in the bucket
description "low (<1 MB)" is parsed as JSX; update the source text that
generates sdks/rust/api/resq-cli/index.md (the sentence containing "Fetches
package sizes... high (>10 MB), medium (1-10 MB), and low (<1 MB) buckets") to
escape the angle bracket (replace "<1 MB" with "&lt;1 MB") or rephrase (e.g.,
"less than 1 MB") in the README.md in crates/resq-cli or the generator source so
the produced index.md no longer contains an unescaped "<".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a46783fa-1963-45a8-9170-905a6ba2ce5d

📥 Commits

Reviewing files that changed from the base of the PR and between 14d8794 and c8a66ee.

📒 Files selected for processing (6)
  • automation/source-repo-templates/api-docs.rust.yml
  • sdks/rust/api/resq-ai/index.md
  • sdks/rust/api/resq-bin/index.md
  • sdks/rust/api/resq-cli/index.md
  • sdks/rust/api/resq-dsa/index.md
  • sdks/rust/api/resq-tui/index.md

Comment thread sdks/rust/api/resq-cli/index.md Outdated
The local rebuild of the lib crate index.md files skipped the
template's MDX-escape pass, leaving prose like `(<1 MB)` in
resq-cli's README to trip the broken-links check (the parser
treats <1 as the start of a JSX tag with a digit-prefixed name).
Run the same backtick-aware escape walker over the new files.
@WomB0ComB0 WomB0ComB0 merged commit 4aac52a into main May 10, 2026
14 checks passed
@WomB0ComB0 WomB0ComB0 deleted the feat/rust-readme-on-landing branch May 10, 2026 11:05
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Rust API documentation generation process to create hybrid landing pages by combining version banners, crate README content, and module links. Feedback indicates that the generated module links are missing the required .md extensions, which will break navigation. Furthermore, for crates without a README, the new logic results in a loss of descriptive content; a fallback to the Cargo.toml description was suggested to maintain documentation quality.

Comment on lines +282 to +285
module_lines = [
f"- [`{p.stem}`](./{p.stem})"
for p in module_files
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The generated links for modules are missing the .md extension. Since the files on disk retain the .md suffix (as seen in the filtering logic at line 279), these links will likely fail to resolve in the documentation site. Additionally, the post-processing script that prefixes relative links (lines 371-408) specifically looks for the .md extension, so these links will be skipped by that safety check as well.

                  module_lines = [
                      f"- [{p.stem}](./{p.name})"
                      for p in module_files
                  ]

Comment on lines +288 to +294
body_parts = [f"# {meta['name']}", "", banner_for(meta).rstrip(), ""]
if readme.is_file():
body = readme.read_text(encoding="utf-8")
body = re.sub(r"^\s*<!--.*?-->\s*", "", body, count=1, flags=re.S)
body = re.sub(r"^#\s+[^\n]+\n+", "", body, count=1)
body = rewrite_relative_links(body, crate_dir)
body_parts.extend([body.rstrip(), ""])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For crates without a README.md (such as resq-ai), this change results in a landing page that lacks any description of the crate's purpose, losing information that was previously extracted from the lib.rs doc comments. To maintain documentation quality, consider falling back to the description field from Cargo.toml when the README is missing, similar to the logic used for binary stubs at line 336.

                  body_parts = [f"# {meta['name']}", "", banner_for(meta).rstrip(), ""]
                  if readme.is_file():
                      body = readme.read_text(encoding="utf-8")
                      body = re.sub(r"^\s*<!--.*?-->\s*", "", body, count=1, flags=re.S)
                      body = re.sub(r"^#\s+[^\n]+\n+", "", body, count=1)
                      body = rewrite_relative_links(body, crate_dir)
                      body_parts.extend([body.rstrip(), ""])
                  elif meta["description"]:
                      body_parts.extend([meta["description"], ""])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:content MDX/MD documentation content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants