Add grid agent milestone acceptance gate (#135)
This commit is contained in:
@@ -36,12 +36,15 @@ enum Operation {
|
||||
Tui,
|
||||
TuiClient,
|
||||
PrintPaths,
|
||||
Acceptance,
|
||||
CheckLiveOptIns,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Options {
|
||||
config: Option<PathBuf>,
|
||||
operation: Operation,
|
||||
evidence: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn options() -> Result<Option<Options>, CliError> {
|
||||
@@ -57,7 +60,7 @@ fn options() -> Result<Option<Options>, CliError> {
|
||||
}
|
||||
if argument == "--help" || argument == "-h" {
|
||||
println!(
|
||||
"metacrate-grid-agent [--config PATH] [--check-config | --run-once | --tui | --tui-client | --print-paths]\n\
|
||||
"metacrate-grid-agent [--config PATH] [--check-config | --run-once | --tui | --tui-client | --print-paths | --acceptance-evidence PATH | --check-live-opt-ins]\n\
|
||||
Configuration precedence: defaults < JSON < secret files < environment.\n\
|
||||
With no --config, the platform default is used when it exists."
|
||||
);
|
||||
@@ -76,6 +79,15 @@ fn options() -> Result<Option<Options>, CliError> {
|
||||
set_operation(&mut result, Operation::TuiClient)?;
|
||||
} else if argument == "--print-paths" {
|
||||
set_operation(&mut result, Operation::PrintPaths)?;
|
||||
} else if argument == "--acceptance-evidence" {
|
||||
set_operation(&mut result, Operation::Acceptance)?;
|
||||
let path = arguments
|
||||
.next()
|
||||
.ok_or_else(|| CliError("--acceptance-evidence requires a new path".into()))?;
|
||||
count += 1;
|
||||
result.evidence = Some(PathBuf::from(path));
|
||||
} else if argument == "--check-live-opt-ins" {
|
||||
set_operation(&mut result, Operation::CheckLiveOptIns)?;
|
||||
} else if argument == "--config" {
|
||||
let path = arguments
|
||||
.next()
|
||||
@@ -102,6 +114,7 @@ fn set_operation(options: &mut Options, operation: Operation) -> Result<(), CliE
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
let Some(options) = options()? else {
|
||||
return Ok(());
|
||||
@@ -112,6 +125,36 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
println!("data={}", platform_paths.data_directory.display());
|
||||
return Ok(());
|
||||
}
|
||||
if options.operation == Operation::Acceptance {
|
||||
let evidence = options
|
||||
.evidence
|
||||
.ok_or_else(|| CliError("acceptance evidence path is required".into()))?;
|
||||
let written = metacrate_grid_agent::run_deterministic_acceptance(
|
||||
evidence,
|
||||
metacrate_grid_agent::AcceptanceBudgets::default(),
|
||||
)
|
||||
.await?;
|
||||
println!(
|
||||
"deterministic acceptance passed; evidence={}",
|
||||
written.display()
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
if options.operation == Operation::CheckLiveOptIns {
|
||||
let opt_ins =
|
||||
metacrate_grid_agent::LiveGridOptIns::from_environment(|name| std::env::var(name).ok())
|
||||
.validate()?;
|
||||
println!(
|
||||
"live opt-ins: login={} chat_im={} script={} landmarks={} build={} visual={}",
|
||||
opt_ins.login,
|
||||
opt_ins.chat_and_im,
|
||||
opt_ins.script_delivery,
|
||||
opt_ins.landmarks_and_roaming,
|
||||
opt_ins.reversible_build,
|
||||
opt_ins.visual_capture
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
let mut loader = ConfigLoader::new();
|
||||
let config_path = options.config.or_else(|| {
|
||||
platform_paths
|
||||
|
||||
Reference in New Issue
Block a user