aboutsummaryrefslogtreecommitdiffstats
path: root/src/doctor.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/doctor.rs28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/doctor.rs b/src/doctor.rs
index 8baf1f7..e7b949e 100644
--- a/src/doctor.rs
+++ b/src/doctor.rs
@@ -1,3 +1,10 @@
1/*
2 * This file is part of agent686
3 * Copyright (C) 2026 Salmonik <salmon@2137697.xyz>
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 * https://git.2137697.xyz/agent686
6 */
7
1use std::path::Path; 8use std::path::Path;
2 9
3use serde_json::json; 10use serde_json::json;
@@ -32,7 +39,8 @@ pub fn run(cfg: &Config, json: bool) -> i32 {
32 } 39 }
33 record("key", true, detail); 40 record("key", true, detail);
34 } 41 }
35 KeySource::Missing => record("key", 42 KeySource::Missing => record(
43 "key",
36 false, 44 false,
37 "missing — set OPENCODE_API_KEY or write ~/.config/agent686/key".into(), 45 "missing — set OPENCODE_API_KEY or write ~/.config/agent686/key".into(),
38 ), 46 ),
@@ -55,11 +63,7 @@ pub fn run(cfg: &Config, json: bool) -> i32 {
55 true, 63 true,
56 format!("{} ({} entries)", history.display(), text.lines().count()), 64 format!("{} ({} entries)", history.display(), text.lines().count()),
57 ), 65 ),
58 Err(_) => record( 66 Err(_) => record("history", true, format!("{} (new)", history.display())),
59 "history",
60 true,
61 format!("{} (new)", history.display()),
62 ),
63 } 67 }
64 68
65 record("provider", true, cfg.base_url.clone()); 69 record("provider", true, cfg.base_url.clone());
@@ -70,7 +74,11 @@ pub fn run(cfg: &Config, json: bool) -> i32 {
70 } else { 74 } else {
71 match provider::models(cfg) { 75 match provider::models(cfg) {
72 Ok(models) => { 76 Ok(models) => {
73 record("auth", true, format!("ok — {} models visible", models.len())); 77 record(
78 "auth",
79 true,
80 format!("ok — {} models visible", models.len()),
81 );
74 if models.iter().any(|id| id == &cfg.model) { 82 if models.iter().any(|id| id == &cfg.model) {
75 record("model known", true, "yes".into()); 83 record("model known", true, "yes".into());
76 } else { 84 } else {
@@ -107,7 +115,11 @@ pub fn run(cfg: &Config, json: bool) -> i32 {
107 ); 115 );
108 println!(); 116 println!();
109 for (label, ok, detail) in &checks { 117 for (label, ok, detail) in &checks {
110 println!("{:<13} {:<4} {detail}", label, if *ok { "ok" } else { "FAIL" }); 118 println!(
119 "{:<13} {:<4} {detail}",
120 label,
121 if *ok { "ok" } else { "FAIL" }
122 );
111 } 123 }
112 println!(); 124 println!();
113 if failed { 125 if failed {