Expand description
defect-cli assembly library — reusable by the defect binary and downstream
developers.
This crate aims to make “assembling an ACP server” a few lines of code: it translates
the typed configuration from defect-config into the runtime structures needed by
defect-agent, defect-llm, defect-tools, defect-mcp, and other modules.
§Extension points for downstream development
args::CliArgs/args::CliArgs::to_overrides: standard CLI argumentsproviders::build_registry: assemblesProviderRegistry+TurnConfighttp_stack::build_http_stack_config: translates typed HTTP configuration intodefect_http::HttpStackConfigtools::build_process_tools/mcp_servers::build_default_mcp_servershooks::build_engine_arc: assembles the hook enginepolicy::build_policy/paths::default_sessions_root- tracing initialization has moved to
defect-obs(defect_obs::init_tracing)
The main binary src/bin/cli.rs only performs assembly and holds no helper
implementations — downstream consumers can replace any step without forking the entire
helper set.
Modules§
- args
- CLI argument parsing.
- assembly
- CLI default AgentCore assembler.
- hooks
- Translates
defect-confighook configuration into the agent’sDefaultHookEngine. - http_
stack - Translates the typed HTTP configuration from
defect-configinto adefect_http::HttpStackConfig. - init
defect init— scan the environment for provider API keys, fetch each detected provider’s real model list over its API, and write a global~/.config/defect/config.toml.- mcp_
servers - Translates the typed configuration from the
[mcp]section into a list of ACPMcpServervalues. - observability
- Translates a typed Langfuse config from
defect-configinto an observer fordefect-obs. - oneshot
- Single-turn unattended mode ——
defect --message <prompt>. - paths
- Path resolution helpers — session storage root, etc.
- policy
- Maps a
SandboxModeto a concreteSandboxPolicyinstance. - providers
- Assembles a
ProviderRegistryand individual provider instances. - repl
- In-process minimal REPL —
defect --repl. - session_
open - Opens a session running directly on the local machine — a neutral helper shared by the
interactive REPL (
repl) and the single-shot (oneshot) paths. - tools
- Assembles the
process_toolsregistry.