refactor: rename sandbox-daemon to sandbox-agent

This commit is contained in:
Nathan Flurry 2026-01-25 02:30:12 -08:00
parent f92ecd9b9a
commit a49ea094f3
41 changed files with 808 additions and 134 deletions

View file

@ -1,8 +1,12 @@
use std::env;
use std::fs;
use std::io::Write;
use std::path::PathBuf;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
fn main() {
init_logging();
let mut out: Option<PathBuf> = None;
let mut stdout = false;
let mut args = env::args().skip(1).peekable();
@ -26,15 +30,30 @@ fn main() {
}
}
let schema = sandbox_daemon_openapi_gen::OPENAPI_JSON;
let schema = sandbox_agent_openapi_gen::OPENAPI_JSON;
if stdout {
println!("{schema}");
write_stdout(schema);
return;
}
let out = out.unwrap_or_else(|| PathBuf::from("openapi.json"));
if let Err(err) = fs::write(&out, schema) {
eprintln!("failed to write {}: {err}", out.display());
tracing::error!(path = %out.display(), error = %err, "failed to write openapi schema");
std::process::exit(1);
}
}
fn init_logging() {
let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
tracing_subscriber::registry()
.with(filter)
.with(tracing_logfmt::builder().layer().with_writer(std::io::stderr))
.init();
}
fn write_stdout(text: &str) {
let mut out = std::io::stdout();
let _ = out.write_all(text.as_bytes());
let _ = out.write_all(b"\n");
let _ = out.flush();
}