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 init;
33pub mod mcp_servers;
34pub mod observability;
35#[cfg(feature = "oneshot")]
36pub mod oneshot;
37pub mod paths;
38pub mod policy;
39pub mod providers;
40#[cfg(feature = "repl")]
41pub mod repl;
42#[cfg(any(feature = "repl", feature = "oneshot"))]
43pub mod session_open;
44pub mod tools;
45
46#[cfg(test)]
47mod tests;