mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-14 23:21:19 +00:00
feat(cli): improve CLI agent and command handling
This commit is contained in:
parent
cb83656718
commit
f2a3282b92
6 changed files with 23 additions and 1 deletions
|
|
@ -190,6 +190,7 @@ Tokens are valid for 90 days. The CLI will prompt you to re-authenticate when yo
|
|||
| `-k, --api-key <key>` | API key for the LLM provider | From env var |
|
||||
| `--provider <provider>` | API provider (roo, anthropic, openai, openrouter, etc.) | `openrouter` (or `roo` if authenticated) |
|
||||
| `-m, --model <model>` | Model to use | `anthropic/claude-opus-4.6` |
|
||||
| `-b, --base-url <url>` | Base URL for the LLM provider (e.g., for OpenAI-compatible APIs) | None |
|
||||
| `--mode <mode>` | Mode to start in (code, architect, ask, debug, etc.) | `code` |
|
||||
| `--terminal-shell <path>` | Absolute shell path for inline terminal command execution | Auto-detected shell |
|
||||
| `-r, --reasoning-effort <effort>` | Reasoning effort level (unspecified, disabled, none, minimal, low, medium, high, xhigh) | `medium` |
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ export interface ExtensionHostOptions {
|
|||
provider: SupportedProvider
|
||||
apiKey?: string
|
||||
model: string
|
||||
baseUrl?: string
|
||||
workspacePath: string
|
||||
extensionPath: string
|
||||
nonInteractive?: boolean
|
||||
|
|
@ -227,7 +228,12 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
|
|||
experiments: {
|
||||
customTools: true,
|
||||
},
|
||||
...getProviderSettings(this.options.provider, this.options.apiKey, this.options.model),
|
||||
...getProviderSettings(
|
||||
this.options.provider,
|
||||
this.options.apiKey,
|
||||
this.options.model,
|
||||
this.options.baseUrl,
|
||||
),
|
||||
}
|
||||
|
||||
this.initialSettings = this.options.nonInteractive
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ export async function run(promptArg: string | undefined, flagOptions: FlagOption
|
|||
user: null,
|
||||
provider: effectiveProvider,
|
||||
model: effectiveModel,
|
||||
baseUrl: flagOptions.baseUrl,
|
||||
workspacePath: effectiveWorkspacePath,
|
||||
extensionPath: path.resolve(flagOptions.extension || getDefaultExtensionPath(__dirname)),
|
||||
nonInteractive: !effectiveRequireApproval,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ program
|
|||
.option("-k, --api-key <key>", "API key for the LLM provider")
|
||||
.option("--provider <provider>", "API provider (roo, anthropic, openai, openrouter, etc.)")
|
||||
.option("-m, --model <model>", "Model to use", DEFAULT_FLAGS.model)
|
||||
.option("-b, --base-url <url>", "Base URL for the LLM provider (e.g., for OpenAI-compatible APIs)")
|
||||
.option("--mode <mode>", "Mode to start in (code, architect, ask, debug, etc.)", DEFAULT_FLAGS.mode)
|
||||
.option("--terminal-shell <path>", "Absolute path to shell executable for inline terminal commands")
|
||||
.option(
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import type { SupportedProvider } from "@/types/index.js"
|
|||
const envVarMap: Record<SupportedProvider, string> = {
|
||||
anthropic: "ANTHROPIC_API_KEY",
|
||||
"openai-native": "OPENAI_API_KEY",
|
||||
openai: "OPENAI_API_KEY",
|
||||
gemini: "GOOGLE_API_KEY",
|
||||
openrouter: "OPENROUTER_API_KEY",
|
||||
"vercel-ai-gateway": "VERCEL_AI_GATEWAY_API_KEY",
|
||||
|
|
@ -24,6 +25,7 @@ export function getProviderSettings(
|
|||
provider: SupportedProvider,
|
||||
apiKey: string | undefined,
|
||||
model: string | undefined,
|
||||
baseUrl: string | undefined,
|
||||
): RooCodeSettings {
|
||||
const config: RooCodeSettings = { apiProvider: provider }
|
||||
|
||||
|
|
@ -32,17 +34,25 @@ export function getProviderSettings(
|
|||
if (apiKey) config.apiKey = apiKey
|
||||
if (model) config.apiModelId = model
|
||||
break
|
||||
case "openai":
|
||||
if (apiKey) config.openAiApiKey = apiKey
|
||||
if (model) config.openAiModelId = model
|
||||
if (baseUrl) config.openAiBaseUrl = baseUrl
|
||||
break
|
||||
case "openai-native":
|
||||
if (apiKey) config.openAiNativeApiKey = apiKey
|
||||
if (model) config.apiModelId = model
|
||||
if (baseUrl) config.openAiNativeBaseUrl = baseUrl
|
||||
break
|
||||
case "gemini":
|
||||
if (apiKey) config.geminiApiKey = apiKey
|
||||
if (model) config.apiModelId = model
|
||||
if (baseUrl) config.googleGeminiBaseUrl = baseUrl
|
||||
break
|
||||
case "openrouter":
|
||||
if (apiKey) config.openRouterApiKey = apiKey
|
||||
if (model) config.openRouterModelId = model
|
||||
if (baseUrl) config.openRouterBaseUrl = baseUrl
|
||||
break
|
||||
case "vercel-ai-gateway":
|
||||
if (apiKey) config.vercelAiGatewayApiKey = apiKey
|
||||
|
|
@ -55,6 +65,7 @@ export function getProviderSettings(
|
|||
default:
|
||||
if (apiKey) config.apiKey = apiKey
|
||||
if (model) config.apiModelId = model
|
||||
if (baseUrl) config.openAiBaseUrl = baseUrl
|
||||
}
|
||||
|
||||
return config
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import type { OutputFormat } from "./json-events.js"
|
|||
export const supportedProviders = [
|
||||
"anthropic",
|
||||
"openai-native",
|
||||
"openai",
|
||||
"gemini",
|
||||
"openrouter",
|
||||
"vercel-ai-gateway",
|
||||
|
|
@ -34,6 +35,7 @@ export type FlagOptions = {
|
|||
apiKey?: string
|
||||
provider?: SupportedProvider
|
||||
model?: string
|
||||
baseUrl?: string
|
||||
mode?: string
|
||||
terminalShell?: string
|
||||
reasoningEffort?: ReasoningEffortFlagOptions
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue