- #65: update policies + per-agent version pinning - add settings.update_policy (stable/latest/skip) - add AgentDef.pin_version - honor both in update_cmd - add update_policy tests - #69: REPL color theme CLI command - add am theme [name] (show/switch) - persist selected theme to config - #72: doctor checks local model runtimes - verify ollama and llama-server on PATH - for ollama, also check server responds (ollama ls) Version 0.4.4
This commit is contained in:
@@ -11,7 +11,7 @@ fn report_contains_core_checks() {
|
||||
let runner = SystemRunner::new(false, false, &app.log);
|
||||
let report = doctor::run(&app, &runner);
|
||||
let names: Vec<&str> = report.checks.iter().map(|c| c.name.as_str()).collect();
|
||||
for expected in ["git", "config", "config-schema", "state", "install-dir", "bin-on-path"] {
|
||||
for expected in ["git", "config", "config-schema", "state", "install-dir", "bin-on-path", "ollama", "llama-server"] {
|
||||
assert!(
|
||||
names.contains(&expected),
|
||||
"missing check '{expected}' in {names:?}"
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
use agent_manager::commands::update_cmd;
|
||||
use agent_manager::config::UpdatePolicy;
|
||||
use agent_manager::state::{InstalledEntry, StateFile};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
mod common;
|
||||
|
||||
fn installed_state(name: &str, version: &str) -> StateFile {
|
||||
StateFile {
|
||||
version: 3,
|
||||
installed: BTreeMap::from([(
|
||||
name.to_string(),
|
||||
InstalledEntry {
|
||||
name: name.to_string(),
|
||||
version: Some(version.to_string()),
|
||||
method: "binary".to_string(),
|
||||
install_dir: "/tmp".to_string(),
|
||||
bins: vec![name.to_string()],
|
||||
run: name.to_string(),
|
||||
installed_at: "2026-01-01T00:00:00Z".to_string(),
|
||||
updated_at: None,
|
||||
pid: None,
|
||||
started_at: None,
|
||||
},
|
||||
)]),
|
||||
sessions_count: 0,
|
||||
last_used: None,
|
||||
annotations: BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn agent_yaml(name: &str, pin: Option<&str>) -> String {
|
||||
let pin_line = pin
|
||||
.map(|v| format!(" pin_version: \"{v}\"\n"))
|
||||
.unwrap_or_default();
|
||||
format!(
|
||||
"agents:\n - name: {name}\n display_name: {name}\n run: \"{name}\"\n install:\n type: binary\n binary: {name}\n{pin_line}"
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn update_policy_none_blocks_all() {
|
||||
let body = agent_yaml("pi", None);
|
||||
let mut app = common::test_app("policy_none", &["--yes"]);
|
||||
app.config.settings.update_policy = Some(UpdatePolicy::None);
|
||||
app.state.save(&installed_state("pi", "0.1.0")).unwrap();
|
||||
let code = update_cmd::run(&app, None, true).unwrap();
|
||||
assert_eq!(code, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pinned_agent_is_skipped() {
|
||||
let body = agent_yaml("pi", Some("0.1.0"));
|
||||
let app = common::test_app("pinned_ok", &[]);
|
||||
app.state.save(&installed_state("pi", "0.1.0")).unwrap();
|
||||
let code = update_cmd::run(&app, Some("pi"), false).unwrap();
|
||||
assert_eq!(code, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pinned_agent_mismatch_warns() {
|
||||
let body = agent_yaml("pi", Some("0.1.0"));
|
||||
let app = common::test_app("pinned_warn", &[]);
|
||||
app.state.save(&installed_state("pi", "0.2.0")).unwrap();
|
||||
let code = update_cmd::run(&app, Some("pi"), false).unwrap();
|
||||
assert_eq!(code, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user