Skip to content

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

Draft
snowmead wants to merge 2 commits into
mainfrom
feat/one-shot-cli-runtime
Draft

Add one-shot CLI over shared rust docs runtime#58
snowmead wants to merge 2 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.

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