1mod agent;
2mod bash_mode;
3mod checkpoints;
4mod cli;
5mod commands;
6mod compaction;
7pub mod config;
8pub mod context;
9mod hash;
10mod herdr;
11mod hex;
12mod hooks;
13mod http_body;
14mod instructions;
15mod login;
16mod lsp;
17mod mcp;
18mod model_catalog;
19mod output;
20mod persistence;
21mod primary_agents;
22mod prompt_file;
23mod providers;
24mod rendering;
25pub mod sessions;
26mod shell;
27mod skills;
28mod subagents;
29#[cfg(test)]
30mod test_support;
31mod thinking;
32mod tool_display;
33mod tools;
34mod tui;
35
36pub use providers::{ChatMessage, MessageRole, Usage};
47pub use thinking::ThinkingLevel;
48
49use anyhow::Result;
50use clap::Parser;
51
52pub fn run_from_env() -> Result<()> {
53 run_from_env_inner().map_err(crate::cli::AppError::into_error)
54}
55
56pub fn run_from_env_with_exit_code() -> std::process::ExitCode {
57 match run_from_env_inner() {
58 Ok(()) => std::process::ExitCode::SUCCESS,
59 Err(error) => {
60 eprintln!("Error: {:?}", error.as_error());
61 error.exit_code()
62 }
63 }
64}
65
66fn run_from_env_inner() -> crate::cli::AppResult<()> {
67 let args = cli::CliArgs::parse();
68 cli::run(args)
69}