rsdoc
Rust crate文档的语义搜索。从docs.rs获取rustdoc JSON,将其解析为markdown,使用Voyage AI对其进行矢量化,并使用HNSW索引将所有内容存储在SQLite中。
特性
- 语义搜索:使用自然语言查询查找文档
- 内容寻址存储:跨机箱版本重复数据消除文档-对相同文档重新编制索引无需API调用
- 读取时自动获取:请求您尚未索引的板条箱的文档,它会自动获取
- 再出口决议:如下
pub use查找规范文档的链 - crates.io搜索:按名称或关键字搜索板条箱
- 后台守护程序:繁重的工作在后台守护进程中运行,后台守护进程在不活动后自动退出
快速开始
先决条件
- 转到1.24+
- A. Voyage AI API密钥
安装
从源代码构建
git clone https://github.com/jcdickinson/ferrisfetch
cd ferrisfetch
go build -o rsdoc ./cmd/rsdoc无
nix run github:jcdickinson/ferrisfetch
nix profile install github:jcdickinson/ferrisfetch配置
创建 ~/.config/ferrisfetch/config.toml:
[voyage_ai]
model = "voyage-3.5"
rerank_model = "rerank-lite-1"
# Read API key from a file (recommended)
api_key = { path = "~/.config/ferrisfetch/voyage_api_key.txt" }
# Or inline (not recommended)
# api_key = "your-api-key"或者使用环境变量:
export FERRISFETCH_VOYAGE_AI_API_KEY="your-api-key"用法
当 CLAUDECODE=1 或 AGENT=1 设置, rsdoc --help 输出为AI代理量身定制的降价指令。要使代理了解该工具,请添加 CLI Tools 部分到您的 CLAUDE.md 或 AGENTS.md:
## CLI Tools
These tools are intended to be used in the same way that MCPs are. stderr is for logging and you should typically ignore it.
- `rsdoc --help`: used to search for crates, as well as semantic search across indexed crates. Use this instead of fetching documentation from doc.rs.命令
rsdoc add serde tokio # Index crates (latest version)
rsdoc add tokio@1.44.2 # Index a specific version
rsdoc search "async runtime" # Semantic search
rsdoc search-crates serde # Search crates.io
rsdoc get serde/latest/serde::Serialize # Read a doc item (rsdoc:// prefix optional)
rsdoc status # Show indexed crates
rsdoc logs # Tail daemon log
rsdoc stop # Stop the daemon
rsdoc clear-cache # Clear version resolution cache使用 --debug 在进程内运行守护进程,并显示日志输出。
建筑
单二进制,两种模式:
- 命令行界面 (
rsdoc):将请求转发到守护进程的瘦客户端。 - 守护进程 (
rsdoc daemon):执行繁重任务的后台进程——获取文档、生成嵌入、运行搜索。通过Unix套接字进行通信。如果未运行,则自动生成,在10分钟不活动后自动退出。
数据存在于 ~/.cache/ferrisfetch/:
db.db--带有HNSW索引的SQLite数据库cas/--用于文档标记的内容可寻址存储json/--从docs.rs缓存rustdoc JSONdaemon.log--守护进程日志输出
许可证
看 许可证.
