Skip to main content

vtcode_core/cli/args/
secret.rs

1use clap::{Args, Subcommand, ValueEnum};
2
3/// Supported built-in provider names for legacy callers.
4///
5/// The CLI accepts arbitrary configured provider names through `String`
6/// fields below; this enum remains available to integrations that used the
7/// older typed API.
8#[derive(Debug, Clone, Copy, ValueEnum, PartialEq, Eq)]
9pub enum SecretProvider {
10    #[value(name = "openai")]
11    OpenAI,
12    #[value(name = "anthropic")]
13    Anthropic,
14    #[value(name = "gemini")]
15    Gemini,
16    #[value(name = "deepseek")]
17    DeepSeek,
18    #[value(name = "meta")]
19    Meta,
20    #[value(name = "openrouter")]
21    OpenRouter,
22    #[value(name = "stepfun")]
23    StepFun,
24    #[value(name = "zai")]
25    Zai,
26    #[value(name = "moonshot")]
27    Moonshot,
28    #[value(name = "minimax")]
29    MiniMax,
30    #[value(name = "mistral")]
31    Mistral,
32    #[value(name = "huggingface")]
33    HuggingFace,
34    #[value(name = "mimo")]
35    MiMo,
36    #[value(name = "opencode-zen")]
37    OpenCodeZen,
38    #[value(name = "opencode-go")]
39    OpenCodeGo,
40    #[value(name = "qwen")]
41    Qwen,
42    #[value(name = "evolink")]
43    Evolink,
44    #[value(name = "poolside")]
45    Poolside,
46    #[value(name = "ollama")]
47    Ollama,
48    #[value(name = "ollama-cloud")]
49    OllamaCloud,
50    #[value(name = "lmstudio")]
51    LMStudio,
52    #[value(name = "copilot")]
53    Copilot,
54    #[value(name = "nvidia")]
55    Nvidia,
56    #[value(name = "merge-gateway")]
57    MergeGateway,
58    #[value(name = "vercel")]
59    Vercel,
60}
61
62/// Secret management subcommands
63#[derive(Debug, Subcommand, Clone)]
64pub enum SecretSubcommand {
65    /// List secret status for all providers
66    #[command(name = "list", visible_alias = "ls")]
67    List,
68
69    /// Show status for a specific provider
70    #[command(name = "status", visible_alias = "info")]
71    Status {
72        /// Provider name (e.g. openai, anthropic, stepfun)
73        provider_name: Option<String>,
74        /// Explicit environment-variable identity for a non-default key
75        #[arg(long, alias = "env")]
76        key_name: Option<String>,
77    },
78
79    /// Store an API key in secure storage
80    #[command(name = "add", visible_alias = "set")]
81    Add {
82        /// Provider name (e.g. openai, anthropic, stepfun)
83        provider_name: String,
84        /// Explicit environment-variable identity for a non-default key
85        #[arg(long, alias = "env")]
86        key_name: Option<String>,
87    },
88
89    /// Remove a stored API key from secure storage
90    #[command(name = "delete", visible_alias = "remove")]
91    Delete {
92        /// Provider name (e.g. openai, anthropic, stepfun)
93        provider_name: String,
94        /// Explicit environment-variable identity for a non-default key
95        #[arg(long, alias = "env")]
96        key_name: Option<String>,
97    },
98
99    /// Migrate API keys from workspace .env to secure storage
100    #[command(name = "migrate")]
101    Migrate(MigrateArgs),
102}
103
104/// Arguments for `vtcode secret migrate`.
105#[derive(Debug, Args, Clone)]
106pub struct MigrateArgs {
107    /// Provider name (e.g. openai, anthropic). Omit to migrate all found keys.
108    pub provider_name: Option<String>,
109
110    /// Migrate all found keys without prompting
111    #[arg(long)]
112    pub all: bool,
113
114    /// Preview migration without making changes
115    #[arg(long)]
116    pub dry_run: bool,
117
118    /// Skip confirmation prompts
119    #[arg(long)]
120    pub force: bool,
121}
122
123/// Top-level secret command args (allows bare `vtcode secret` to default to list)
124#[derive(Debug, Args, Clone)]
125pub struct SecretArgs {
126    #[command(subcommand)]
127    pub command: Option<SecretSubcommand>,
128}