Skip to main content

defect_cli/
lib.rs

1//! `defect-cli` assembly library — reusable by the `defect` binary and downstream
2//! developers.
3//!
4//! This crate aims to make "assembling an ACP server" a few lines of code: it translates
5//! the typed configuration from `defect-config` into the runtime structures needed by
6//! `defect-agent`, `defect-llm`, `defect-tools`, `defect-mcp`, and other modules.
7//!
8//! ## Extension points for downstream development
9//!
10//! - [`args::CliArgs`] / [`args::CliArgs::to_overrides`]: standard CLI arguments
11//! - [`providers::build_registry`]: assembles [`ProviderRegistry`] + [`TurnConfig`]
12//! - [`http_stack::build_http_stack_config`]: translates typed HTTP configuration into
13//!   `defect_http::HttpStackConfig`
14//! - [`tools::build_process_tools`] / [`mcp_servers::build_default_mcp_servers`]
15//! - [`hooks::build_engine_arc`]: assembles the hook engine
16//! - [`policy::build_policy`] / [`paths::default_sessions_root`]
17//! - tracing initialization has moved to `defect-obs` (`defect_obs::init_tracing`)
18//!
19//! The main binary `src/bin/cli.rs` only performs assembly and holds no helper
20//! implementations — downstream consumers can replace any step without forking the entire
21//! helper set.
22//!
23//! [`ProviderRegistry`]: defect_agent::llm::ProviderRegistry
24//! [`TurnConfig`]: defect_agent::session::TurnConfig
25
26#![cfg_attr(not(test), warn(clippy::indexing_slicing, clippy::unwrap_used))]
27
28pub mod args;
29pub mod assembly;
30pub mod hooks;
31pub mod http_stack;
32pub mod mcp_servers;
33pub mod observability;
34#[cfg(feature = "oneshot")]
35pub mod oneshot;
36pub mod paths;
37pub mod policy;
38pub mod providers;
39#[cfg(feature = "repl")]
40pub mod repl;
41#[cfg(any(feature = "repl", feature = "oneshot"))]
42pub mod session_open;
43pub mod tools;
44
45#[cfg(test)]
46mod tests;