Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(cli): accept anthropic oauth llm-test provider

AkitaOnRails7af761aa4d36
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1c8d1518..0d8b1a32 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`bash -c` commands that keep the POSIX `.sh` hook scripts and convert
drive-letter paths to Git Bash paths, matching Claude Code's actual hook
runner instead of emitting PowerShell commands ([#45]).
+- `ai-memory llm-test --provider anthropic-oauth` now parses and maps to the
+ Anthropic OAuth provider instead of being rejected by clap ([#43]).
## [0.5.1] - 2026-05-27
### Changed
diff --git a/crates/ai-memory-cli/src/cli.rs b/crates/ai-memory-cli/src/cli.rs
index 692486f0..4d8a847b 100644
--- a/crates/ai-memory-cli/src/cli.rs
+++ b/crates/ai-memory-cli/src/cli.rs
@@ -517,6 +517,8 @@ pub struct CommitArgs {
pub enum LlmProviderChoice {
/// Anthropic Messages API.
Anthropic,
+ /// Anthropic Messages API using a Claude subscription OAuth token.
+ AnthropicOauth,
/// OpenAI Chat Completions.
Openai,
/// Google Gemini (Generative Language API).
@@ -881,4 +883,26 @@ mod tests {
assert_eq!(login.github_token.as_deref(), Some("ghu-test"));
assert_eq!(login.client_id.as_deref(), Some("Iv1.test"));
}
+
+ #[test]
+ fn llm_test_anthropic_oauth_parses() {
+ let cli = Cli::try_parse_from([
+ "ai-memory",
+ "llm-test",
+ "--provider",
+ "anthropic-oauth",
+ "--model",
+ "claude-sonnet-4-6",
+ "--prompt",
+ "ping",
+ ])
+ .unwrap();
+
+ let Command::LlmTest(args) = cli.command else {
+ panic!("expected llm-test command");
+ };
+ assert!(matches!(args.provider, LlmProviderChoice::AnthropicOauth));
+ assert_eq!(args.model, "claude-sonnet-4-6");
+ assert_eq!(args.prompt, "ping");
+ }
}
diff --git a/crates/ai-memory-cli/src/commands/llm_test.rs b/crates/ai-memory-cli/src/commands/llm_test.rs
index 200022ab..bc79396a 100644
--- a/crates/ai-memory-cli/src/commands/llm_test.rs
+++ b/crates/ai-memory-cli/src/commands/llm_test.rs
@@ -50,6 +50,7 @@ impl From<LlmProviderChoice> for ProviderChoice {
fn from(value: LlmProviderChoice) -> Self {
match value {
LlmProviderChoice::Anthropic => Self::Anthropic,
+ LlmProviderChoice::AnthropicOauth => Self::AnthropicOAuth,
LlmProviderChoice::Openai => Self::OpenAi,
LlmProviderChoice::Gemini => Self::Gemini,
LlmProviderChoice::OpenaiCompat => Self::OpenAiCompat,
@@ -58,3 +59,16 @@ impl From<LlmProviderChoice> for ProviderChoice {
}
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn anthropic_oauth_choice_maps_to_runtime_provider() {
+ assert_eq!(
+ ProviderChoice::from(LlmProviderChoice::AnthropicOauth),
+ ProviderChoice::AnthropicOAuth
+ );
+ }
+}