apiKey、baseUrl 和 modelcargo build
cargo run -- config init
默认配置文件路径:~/.config/opencli/config.json
最小可用示例:
{
"provider": "openai-compatible",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "<your-api-key>",
"model": "gpt-4.1",
"approvalMode": "on-write",
"nonInteractiveApproval": "deny",
"workspaceRoot": ".",
"allowedToolKinds": [
"filesystem-read",
"filesystem-search",
"shell",
"agent"
],
"allowedTools": []
}
单轮执行:
cargo run -- "Explain this repository"
聊天模式:
cargo run -- chat
带上下文运行:
cargo run -- run --file crates/opencli-core/src/lib.rs "Explain this file"
cargo run -- run --dir crates/opencli-core/src "Summarize this codebase"
Unix-like 环境:
./scripts/install.sh
Windows PowerShell:
./scripts/install.ps1