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
use std::path::PathBuf;
use clap::Parser;
// TODO: Move to subcommands
#[allow(clippy::struct_excessive_bools)]
#[derive(Parser, Debug, Clone)]
#[clap(author, about, version)]
pub struct Args {
/// Optional path to overwrite the config
#[arg(short, long, default_value = "kwaak.toml")]
pub config_path: PathBuf,
/// Run kwaak as a tui (default) or run an agent directly
#[arg(short, long, default_value = "tui")]
pub mode: ModeArgs,
/// When running the agent directly, the initial message to send to the agent
#[arg(short, long, required_if_eq("mode", "run-agent"))]
pub initial_message: Option<String>,
/// When querying the indexed project, the query to run
#[arg(short, long, required_if_eq("mode", "query"))]
pub query: Option<String>,
#[arg(required_if_eq("mode", "test-tool"))]
/// The tool name when testing a tool
pub tool_name: Option<String>,
/// Optional argument for testing a tool, expects the raw json
#[allow(clippy::struct_field_names)]
pub tool_args: Option<String>,
/// Print the configuration and exit
#[arg(long)]
pub print_config: bool,
/// Clear the the index and cache for this project and exit
#[arg(long, name = "clear-cache", default_value_t = false)]
pub clear_cache: bool,
/// Initializes a new kwaak project in the current directory
#[arg(long, default_value_t = false)]
pub init: bool,
/// Skip initial indexing and splash screen
#[arg(short, long, default_value_t = false)]
pub skip_indexing: bool,
}
#[derive(clap::ValueEnum, Clone, Debug, Default, strum_macros::AsRefStr)]
pub enum ModeArgs {
/// Index the current project
Index,
/// Query the indexed project
Query,
/// Run an agent directly
RunAgent,
/// Start the TUI
#[default]
Tui,
/// Runs a tool and check the output. Warning: Will not run in a sandbox
TestTool,
}