use std::path::Path;
use std::process::Command;
pub(crate) fn aid_cmd_in(aid_home: &Path) -> Command {
aid_cmd_with_cwd(aid_home, aid_home)
}
pub(crate) fn aid_cmd_with_cwd(aid_home: &Path, cwd: &Path) -> Command {
let mut cmd = Command::new(env!("CARGO_BIN_EXE_aid"));
cmd.env("AID_HOME", aid_home);
cmd.env("AID_NO_DETACH", "1");
for var in [
"AID_GROUP",
"AID_TASK_ID",
"AID_TASK_DEPTH",
"AID_TASK_NAME",
"AID_ITERATION",
"AID_PARENT_TASK_ID",
"AID_CASCADE",
] {
cmd.env_remove(var);
}
cmd.current_dir(cwd);
cmd
}
#[allow(dead_code)]
pub fn seed_codex_leaderboard(home: &Path) {
let scores = include_str!("../fixtures/leaderboard/e2e-codex-scores.json");
let prices = include_str!("../fixtures/leaderboard/e2e-codex-prices.json");
for (file, body) in [("scores.json", scores), ("prices.json", prices)] {
let mut feed: serde_json::Value = serde_json::from_str(body).expect("leaderboard fixture");
feed["built_at"] = serde_json::Value::String(chrono::Utc::now().to_rfc3339());
std::fs::write(home.join(file), feed.to_string()).expect("leaderboard cache");
}
}