#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum AcpAmbientGlobal {
Prompt,
PromptContent,
PromptMessages,
Cwd,
Mcp,
}
impl AcpAmbientGlobal {
pub const ALL: [AcpAmbientGlobal; 5] = [
Self::Prompt,
Self::PromptContent,
Self::PromptMessages,
Self::Cwd,
Self::Mcp,
];
pub const fn name(self) -> &'static str {
match self {
Self::Prompt => "prompt",
Self::PromptContent => "prompt_content",
Self::PromptMessages => "prompt_messages",
Self::Cwd => "cwd",
Self::Mcp => "mcp",
}
}
pub const fn checker_type(self) -> &'static str {
match self {
Self::Prompt | Self::Cwd => "string",
Self::PromptContent | Self::PromptMessages => "list",
Self::Mcp => "dict",
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn all_lists_every_variant_exactly_once() {
for variant in [
AcpAmbientGlobal::Prompt,
AcpAmbientGlobal::PromptContent,
AcpAmbientGlobal::PromptMessages,
AcpAmbientGlobal::Cwd,
AcpAmbientGlobal::Mcp,
] {
let count = AcpAmbientGlobal::ALL
.iter()
.filter(|candidate| **candidate == variant)
.count();
assert_eq!(
count,
1,
"{} must appear in ALL exactly once",
variant.name()
);
}
}
#[test]
fn names_are_unique() {
for (index, global) in AcpAmbientGlobal::ALL.iter().enumerate() {
for other in &AcpAmbientGlobal::ALL[index + 1..] {
assert_ne!(global.name(), other.name(), "duplicate ambient global name");
}
}
}
}