use clap::ValueEnum;
#[derive(ValueEnum, Clone, Debug, Default, PartialEq)]
pub enum ValidateOutputFormat {
#[default]
Text,
Json,
Sarif,
}
#[derive(clap::ValueEnum, Clone, Debug, Default, PartialEq)]
pub enum OutputFormat {
#[default]
Text,
Json,
}
#[derive(clap::Args, Clone)]
pub struct JudgeArgs {
#[arg(long, default_value = "none", env = "VERDICT_JUDGE")]
pub judge: String,
#[arg(long, conflicts_with = "judge")]
pub no_judge: bool,
#[arg(long, env = "VERDICT_JUDGE_MODEL")]
pub judge_model: Option<String>,
#[arg(long, default_value_t = 3, env = "VERDICT_JUDGE_SAMPLES")]
pub judge_samples: u32,
#[arg(long)]
pub judge_refresh: bool,
#[arg(long, default_value_t = 0.0, env = "VERDICT_JUDGE_TEMPERATURE")]
pub judge_temperature: f32,
#[arg(long, default_value_t = 800, env = "VERDICT_JUDGE_MAX_TOKENS")]
pub judge_max_tokens: u32,
#[arg(long, hide = true)]
pub judge_api_key: Option<String>,
}
impl Default for JudgeArgs {
fn default() -> Self {
Self {
judge: "none".to_string(),
no_judge: false,
judge_model: None,
judge_samples: 3,
judge_refresh: false,
judge_temperature: 0.0,
judge_max_tokens: 800,
judge_api_key: None,
}
}
}
#[derive(clap::ValueEnum, Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum McpTranscriptFormat {
#[default]
#[value(alias = "mcp-inspector", alias = "mcp-inspector@v1")]
Inspector,
Jsonrpc,
#[value(name = "streamable-http")]
StreamableHttp,
#[value(name = "http-sse", alias = "sse-legacy")]
HttpSse,
}
impl McpTranscriptFormat {
pub fn as_core_label(self) -> &'static str {
match self {
Self::Inspector => "inspector",
Self::Jsonrpc => "jsonrpc",
Self::StreamableHttp => "streamable-http",
Self::HttpSse => "http-sse",
}
}
pub fn to_core(self) -> assay_core::mcp::McpInputFormat {
assay_core::mcp::McpInputFormat::from_cli_label(self.as_core_label())
.expect("McpTranscriptFormat label is not one McpInputFormat accepts")
}
}
#[derive(clap::ValueEnum, Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum PolicyOutputFormat {
#[default]
Yaml,
Json,
}
#[derive(clap::ValueEnum, Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum ShowFormat {
#[default]
Table,
Json,
}
#[cfg(test)]
mod mcp_format_vocabulary_tests {
use super::McpTranscriptFormat;
use clap::ValueEnum;
#[test]
fn mcp_format_vocabularies_agree() {
let mut seen = std::collections::BTreeSet::new();
for variant in McpTranscriptFormat::value_variants() {
let core = variant.to_core();
assert!(
seen.insert(format!("{core:?}")),
"{variant:?} maps to a core format another variant already claims"
);
}
assert_eq!(seen.len(), 4, "a core format lost its CLI spelling");
for label in [
"inspector",
"mcp-inspector",
"jsonrpc",
"streamable-http",
"http-sse",
"sse-legacy",
] {
assert!(
McpTranscriptFormat::from_str(label, true).is_ok(),
"`--format {label}` used to work and no longer parses"
);
}
}
}