sophon-cli Agent Skill
Project
- Rust CLI binary (
sophon-cli) with a provider-agnostic domain layer - Brave Search and Exa adapters behind a trait boundary
Key Files
src/main.rs— entrypoint wiring CLI args, app service, providers, and HTTP transportsrc/domain/— pure types and traits (no HTTP, no CLI parsing)src/providers/brave/— Brave-specific DTOs, mapper, config, and clientsrc/providers/exa/— Exa-specific DTOs, mapper, config, and clientsrc/transport/—HttpClienttrait andReqwestHttpClientadaptersrc/app/—SearchServiceorchestratorsrc/cli/—clapargument parsing and text renderingtests/architecture_test.rs— source-scan tests enforcing layer boundaries
Quality Gate
Run just check before committing. This runs:
cargo fmt --checkcargo clippy -- -D warnings -W clippy::complexity -W clippy::cognitive_complexitycargo testmdbook build
Architecture Boundaries
src/domain/must NOT importcrate::providers,crate::transport,crate::cli,crate::appsrc/transport/must NOT importcrate::providers,crate::cli,crate::appsrc/providers/must NOT importcrate::cli,crate::appsrc/app/must NOT importcrate::cli- Only
src/cli/may importrender_text
Environment Setup
Copy .env.example to .env and fill in the API key for the provider you want to use:
BRAVE_API_KEYfor Brave SearchEXA_API_KEYfor Exa
Common Tasks
- Add a new provider: create
src/providers/<name>/withconfig.rs,dto.rs,mapper.rs,client.rs, then register insrc/providers/mod.rs - Add a domain type: place in
src/domain/and updatesrc/domain/mod.rs - Modify CLI output: edit
src/cli/output.rsand add unit tests there - Update docs: edit files in
docs/and runmdbook buildto verify