Skip to main content

Crate defect_cli

Crate defect_cli 

Source
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

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-config hook configuration into the agent’s DefaultHookEngine.
http_stack
Translates the typed HTTP configuration from defect-config into a defect_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 ACP McpServer values.
observability
Translates a typed Langfuse config from defect-config into an observer for defect-obs.
oneshot
Single-turn unattended mode —— defect --message <prompt>.
paths
Path resolution helpers — session storage root, etc.
policy
Maps a SandboxMode to a concrete SandboxPolicy instance.
providers
Assembles a ProviderRegistry and 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_tools registry.