Skip to content

Add one-shot CLI over shared rust docs runtime#58

Merged
snowmead merged 3 commits into
mainfrom
feat/one-shot-cli-runtime
Jul 9, 2026
Merged

Add one-shot CLI over shared rust docs runtime#58
snowmead merged 3 commits into
mainfrom
feat/one-shot-cli-runtime

Conversation

@snowmead

@snowmead snowmead commented May 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a transport-free RustDocsRuntime shared by the MCP service and CLI paths.
  • Add a one-shot CLI adapter via rust-docs-mcp call <tool> --params <json>.
  • Keep default/serve behavior as the existing long-running MCP stdio server.
  • Add blocking CLI cache behavior so call cache-crate completes download, rustdoc generation, and search index creation before exiting.
  • Add runtime/CLI integration tests and README examples.

CLI examples

rust-docs-mcp serve
rust-docs-mcp call cache-crate --params '{"crate_name":"semver","source_type":"cratesio","version":"1.0.0"}'
rust-docs-mcp call search-items-fuzzy --params '{"crate_name":"semver","version":"1.0.0","query":"Version","limit":5}'

Verification

  • cargo fmt -p rust-docs-mcp -- --check
  • cargo build -p rust-docs-mcp
  • cargo clippy -p rust-docs-mcp
  • cargo test -p rust-docs-mcp --no-run
  • cargo test -p rust-docs-mcp --test integration_tests test_runtime_cache_blocking -- --nocapture
  • cargo test -p rust-docs-mcp --test integration_tests test_runtime_search_fuzzy -- --nocapture
  • cargo test -p rust-docs-mcp --test integration_tests test_cli_call -- --nocapture
  • End-to-end binary smoke test with fresh temp cache:
    • call cache-crate
    • call search-items-fuzzy
    • call list-cached-crates
  • Full integration suite:
    • Default parallel run hit the existing 30s timeout in test_cache_update under resource contention.
    • Reran test_cache_update alone: passed.
    • Reran full integration suite serially: 27 passed; 0 failed.

Notes

cache_operations remains MCP-oriented because task state is in-memory and only meaningful for a long-running process. The CLI cache-crate path is intentionally blocking.


Note

Cursor Bugbot is generating a summary for commit 8479a5c. Configure here.

snowmead added 3 commits May 7, 2026 15:12
Resolve conflicts by keeping blocking cache_crate API and CLI tests
while adopting features parameter support from main.
@snowmead snowmead marked this pull request as ready for review July 9, 2026 15:19

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8479a5c. Configure here.

Comment thread rust-docs-mcp/src/cli.rs
.get("status")
.and_then(serde_json::Value::as_str)
.is_some_and(|status| status == "error")
|| object.contains_key("error")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CLI zero exit on workspace

Medium Severity

call cache-crate decides failure via output_indicates_error, which ignores status: "workspace_detected". That response means docs were not cached, yet the process exits 0. MCP background caching treats the same outcome as a failed task, so CLI and MCP disagree on success.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8479a5c. Configure here.

@snowmead snowmead merged commit 27b26e6 into main Jul 9, 2026
12 checks passed
@snowmead snowmead deleted the feat/one-shot-cli-runtime branch July 9, 2026 15:24
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