diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-15 15:26:21 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-15 15:26:21 +0100 |
| commit | fa5894ea5740852c37eba3937c6ad255574ccfd3 (patch) | |
| tree | 82d09308bbe8afe3ce92c4df31a03b77d3add110 /src/main.rs | |
| parent | 0.2.0: streaming line-range reads (diff) | |
| download | agent686-fa5894ea5740852c37eba3937c6ad255574ccfd3.tar.gz agent686-fa5894ea5740852c37eba3937c6ad255574ccfd3.zip | |
0.3.0: --version and --doctor
doctor reports key source, writable dirs, provider, model, then checks the key
against GET /models and confirms the model id is listed. Non-zero exit on
failure, so it can gate a deployment.
Diffstat (limited to '')
| -rw-r--r-- | src/main.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 29b4280..ccd4e37 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -30,6 +30,8 @@ OPTIONS: | |||
| 30 | --session <ID> resume a session, creating it if the id is new | 30 | --session <ID> resume a session, creating it if the id is new |
| 31 | -c, --continue resume the most recent session | 31 | -c, --continue resume the most recent session |
| 32 | --list list sessions and exit | 32 | --list list sessions and exit |
| 33 | --doctor check key, directories, provider and model, then exit | ||
| 34 | -V, --version print the version and exit | ||
| 33 | --yolo approve every tool call without asking | 35 | --yolo approve every tool call without asking |
| 34 | -h, --help this text | 36 | -h, --help this text |
| 35 | 37 | ||
| @@ -47,6 +49,7 @@ fn main() { | |||
| 47 | let mut resume = None; | 49 | let mut resume = None; |
| 48 | let mut continue_last = false; | 50 | let mut continue_last = false; |
| 49 | let mut list = false; | 51 | let mut list = false; |
| 52 | let mut doctor = false; | ||
| 50 | let mut yolo = false; | 53 | let mut yolo = false; |
| 51 | 54 | ||
| 52 | let mut args = std::env::args().skip(1); | 55 | let mut args = std::env::args().skip(1); |
| @@ -57,6 +60,11 @@ fn main() { | |||
| 57 | "--session" | "--resume" => resume = args.next(), | 60 | "--session" | "--resume" => resume = args.next(), |
| 58 | "-c" | "--continue" => continue_last = true, | 61 | "-c" | "--continue" => continue_last = true, |
| 59 | "--list" => list = true, | 62 | "--list" => list = true, |
| 63 | "--doctor" => doctor = true, | ||
| 64 | "-V" | "--version" => { | ||
| 65 | println!("agent686 {}", env!("CARGO_PKG_VERSION")); | ||
| 66 | return; | ||
| 67 | } | ||
| 60 | "--yolo" => yolo = true, | 68 | "--yolo" => yolo = true, |
| 61 | "-h" | "--help" => { | 69 | "-h" | "--help" => { |
| 62 | print!("{HELP}"); | 70 | print!("{HELP}"); |
| @@ -78,6 +86,11 @@ fn main() { | |||
| 78 | return; | 86 | return; |
| 79 | } | 87 | } |
| 80 | 88 | ||
| 89 | if doctor { | ||
| 90 | let config = Config::resolve_lenient(model, base_url, yolo); | ||
| 91 | std::process::exit(agent686::doctor::run(&config)); | ||
| 92 | } | ||
| 93 | |||
| 81 | let mut cfg = match Config::resolve(model, base_url, yolo) { | 94 | let mut cfg = match Config::resolve(model, base_url, yolo) { |
| 82 | Ok(cfg) => cfg, | 95 | Ok(cfg) => cfg, |
| 83 | Err(message) => { | 96 | Err(message) => { |
