1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
//! # VT Code - Terminal Coding Agent
//!
//! VT Code is a Rust-based terminal coding agent that pairs a streamlined
//! crossterm-powered interface with LLM-native code understanding and robust shell safety.
//! It is designed for developers who need precise context handling,
//! secure tool execution, and configurable multi-provider AI workflows.
//!
//! ## Highlights
//!
//! - **Multi-provider agent**: integrations for OpenAI, Anthropic,
//! DeepSeek, Gemini, OpenRouter, and Ollama (local) with automatic failover and spend guards.
//! - **Semantic code understanding**: LLM-native code analysis and navigation (Rust, Python,
//! JavaScript, TypeScript, Go, Java, and more) without the need for local grammar libraries.
//! - **Bash shell safety**: tree-sitter-bash integration for critical command validation
//! and security enforcement.
//! - **Modern terminal experience**: inline renderer with streaming PTY output,
//! slash commands, and customizable Ciapre-inspired theming.
//! - **Workspace-aware automation**: git-aware fuzzy navigation, workspace
//! boundary enforcement, command allowlists, and human-in-the-loop
//! confirmation.
//! - **Config-driven behavior**: every agent control lives in `vtcode.toml`,
//! anchored by constants in `vtcode_core::config::constants` and curated model
//! metadata in `docs/models.json`.
//!
//! ## Quickstart
//!
//! ```bash
//! # Install the CLI (cargo, npm, or Homebrew are also supported)
//! cargo install vtcode
//!
//! # Export the API key for your provider
//! export OPENAI_API_KEY="your-key"
//!
//! # Launch the agent with explicit provider/model overrides
//! vtcode --provider openai --model gpt-5-codex
//!
//! # Run a one-off prompt with streaming output
//! vtcode ask "Summarize diagnostics in src/lib.rs"
//!
//! # Perform a dry run without tool execution
//! vtcode --no-tools ask "Review recent changes in src/main.rs"
//! ```
//!
//! Persist long-lived defaults in `vtcode.toml` instead of hardcoding them:
//!
//! ```toml
//! [agent]
//! provider = "openai"
//! default_model = "gpt-5.4"
//! ```
//!
//! The configuration loader resolves aliases through
//! `vtcode_core::config::constants`, while `docs/models.json` tracks the latest
//! vetted provider model identifiers.
//!
//! ## Architecture Overview
//!
//! VT Code separates reusable library components from the CLI entrypoint:
//!
//! - `vtcode-core/` exposes the agent runtime, provider abstractions (`llm/`),
//! tool registry (`tools/`), configuration loaders, and shell safety
//! integrations orchestrated with Tokio.
//! - `src/main.rs` embeds the inline UI, Clap-based CLI, and runtime wiring.
//! - MCP (Model Context Protocol) tools provide contextual resources (e.g.
//! Serena MCP for journaling and memory), with policies expressed entirely in
//! configuration.
//! - Safety features include workspace boundary enforcement, rate limiting,
//! telemetry controls, and confirm-to-run guardrails.
//!
//! Additional implementation details live in `docs/ARCHITECTURE.md` and the
//! guides under `docs/project/`.
//!
//! ## Distribution Channels
//!
//! VT Code is distributed via multiple ecosystems:
//!
//! - **crates.io**: `cargo install vtcode`
//! - **npm**: `npm install -g vtcode`
//! - **Homebrew**: `brew install vtcode`
//! - **GitHub Releases**: pre-built binaries for macOS, Linux, and Windows
//!
//! ## crates.io Categories
//!
//! This crate is listed under the following crates.io categories to improve
//! discoverability for terminal-focused developer tooling:
//!
//! - [`#development-tools`](https://crates.io/categories/development-tools)
//! - [`#command-line-utilities`](https://crates.io/categories/command-line-utilities)
//!
//! ## Library Usage Examples
//!
//! ### Starting an Agent Programmatically
//!
//! ```rust,ignore
//! use vtcode_core::{Agent, VTCodeConfig};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), anyhow::Error> {
//! let config = VTCodeConfig::load()?;
//! let agent = Agent::new(config).await?;
//! agent.run().await?;
//! Ok(())
//! }
//! ```
//!
//! ### Registering a Custom Tool
//!
//! ```rust,ignore
//! use vtcode_core::tools::{ToolRegistry, ToolRegistration};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), anyhow::Error> {
//! let workspace = std::env::current_dir()?;
//! let mut registry = ToolRegistry::new(workspace);
//!
//! let custom_tool = ToolRegistration {
//! name: "my_custom_tool".into(),
//! description: "A custom tool for specific tasks".into(),
//! parameters: serde_json::json!({
//! "type": "object",
//! "properties": {
//! "input": {"type": "string"}
//! }
//! }),
//! handler: |args| async move {
//! // Tool implementation goes here
//! Ok(serde_json::json!({"result": "success"}))
//! },
//! };
//!
//! registry.register_tool(custom_tool).await?;
//! Ok(())
//! }
//! ```
//!
//! ## Agent Client Protocol (ACP)
//!
//! VT Code ships an ACP bridge tailored for Zed. Enable it via the `[acp]` section in
//! `vtcode.toml`, launch `vtcode acp`, and register the binary inside Zed's
//! `agent_servers` list. The full walkthrough lives in the
//! [Zed ACP integration guide](https://github.com/vinhnx/vtcode/blob/main/docs/guides/zed-acp.md),
//! and the rendered API guarantees appear on
//! [docs.rs](https://docs.rs/vtcode/latest/vtcode/#agent-client-protocol-acp).
//!
//! ### Bridge guarantees
//!
//! - Filesystem tooling stays disabled unless Zed advertises `fs.read_text_file`, so the agent
//! never emits unsupported requests.
//! - Each `read_file` call is wrapped in `session/request_permission`, letting you approve or
//! deny access to sensitive paths before any data leaves the editor.
//! - Cancellation signals from Zed halt streaming, mark pending tools as cancelled, and end the
//! turn with `StopReason::Cancelled` for clean transcripts.
//! - ACP `plan` updates broadcast analysis, optional context gathering, and response drafting
//! progress so Zed mirrors the agent's workflow.
//! - Strict absolute-path validation blocks relative or out-of-workspace arguments before they
//! reach the client.
//! - When the model lacks tool calling, VT Code emits reasoning notices and downgrades to plain
//! completions while keeping the plan timeline consistent.
//!
//! VT Code binary package
//!
//! This package contains the binary executable for VT Code.
//! For the core library functionality, see [`vtcode-core`](https://docs.rs/vtcode-core).
pub use vtcode_acp as acp;
pub use interactive_list;