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;
35mod tui2;
36
37pub use providers::{ChatMessage, MessageRole, Usage};
48pub use thinking::ThinkingLevel;
49
50use anyhow::Result;
51use clap::Parser;
52
53pub fn run_from_env() -> Result<()> {
54 run_from_env_inner().map_err(crate::cli::AppError::into_error)
55}
56
57pub fn run_from_env_with_exit_code() -> std::process::ExitCode {
58 match run_from_env_inner() {
59 Ok(()) => std::process::ExitCode::SUCCESS,
60 Err(error) => {
61 eprintln!("Error: {:?}", error.as_error());
62 error.exit_code()
63 }
64 }
65}
66
67fn run_from_env_inner() -> crate::cli::AppResult<()> {
68 let args = cli::CliArgs::parse();
69 cli::run(args)
70}