Documentation
¶
Overview ¶
Package cmd provides command-line interface functionality for the CLI Proxy API server. It includes authentication flows for various AI service providers, service startup, and other command-line operations.
Package cmd provides command-line interface functionality for the CLI Proxy API server. It includes authentication flows for various AI service providers, service startup, and other command-line operations.
Package cmd contains CLI helpers. This file implements importing a Vertex AI service account JSON into the auth store as a dedicated "vertex" credential.
Index ¶
- func DoAntigravityLogin(cfg *config.Config, options *LoginOptions)
- func DoClaudeLogin(cfg *config.Config, options *LoginOptions)
- func DoCodeBuddyLogin(cfg *config.Config, options *LoginOptions)
- func DoCodexDeviceLogin(cfg *config.Config, options *LoginOptions)
- func DoCodexLogin(cfg *config.Config, options *LoginOptions)
- func DoGitHubCopilotLogin(cfg *config.Config, options *LoginOptions)
- func DoGitLabLogin(cfg *config.Config, options *LoginOptions)
- func DoGitLabTokenLogin(cfg *config.Config, options *LoginOptions)
- func DoIFlowCookieAuth(cfg *config.Config, options *LoginOptions)
- func DoIFlowLogin(cfg *config.Config, options *LoginOptions)
- func DoKiloLogin(cfg *config.Config, options *LoginOptions)
- func DoKimiLogin(cfg *config.Config, options *LoginOptions)
- func DoKiroAWSAuthCodeLogin(cfg *config.Config, options *LoginOptions)
- func DoKiroAWSLogin(cfg *config.Config, options *LoginOptions)
- func DoKiroGoogleLogin(cfg *config.Config, options *LoginOptions)
- func DoKiroIDCLogin(cfg *config.Config, options *LoginOptions, startURL, region, flow string)
- func DoKiroImport(cfg *config.Config, options *LoginOptions)
- func DoKiroLogin(cfg *config.Config, options *LoginOptions)
- func DoLogin(cfg *config.Config, projectID string, options *LoginOptions)
- func DoQwenLogin(cfg *config.Config, options *LoginOptions)
- func DoVertexImport(cfg *config.Config, keyPath string)
- func StartService(cfg *config.Config, configPath string, localPassword string)
- func StartServiceBackground(cfg *config.Config, configPath string, localPassword string) (cancel func(), done <-chan struct{})
- func WaitForCloudDeploy()
- type LoginOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoAntigravityLogin ¶ added in v6.5.0
func DoAntigravityLogin(cfg *config.Config, options *LoginOptions)
DoAntigravityLogin triggers the OAuth flow for the antigravity provider and saves tokens.
func DoClaudeLogin ¶
func DoClaudeLogin(cfg *config.Config, options *LoginOptions)
DoClaudeLogin triggers the Claude OAuth flow through the shared authentication manager. It initiates the OAuth authentication process for Anthropic Claude services and saves the authentication tokens to the configured auth directory.
Parameters:
- cfg: The application configuration
- options: Login options including browser behavior and prompts
func DoCodeBuddyLogin ¶
func DoCodeBuddyLogin(cfg *config.Config, options *LoginOptions)
DoCodeBuddyLogin triggers the browser OAuth polling flow for CodeBuddy and saves tokens. It initiates the OAuth authentication, displays the user code for the user to enter at the CodeBuddy verification URL, and waits for authorization before saving the tokens.
Parameters:
- cfg: The application configuration containing proxy and auth directory settings
- options: Login options including browser behavior settings
func DoCodexDeviceLogin ¶ added in v6.8.27
func DoCodexDeviceLogin(cfg *config.Config, options *LoginOptions)
DoCodexDeviceLogin triggers the Codex device-code flow while keeping the existing codex-login OAuth callback flow intact.
func DoCodexLogin ¶
func DoCodexLogin(cfg *config.Config, options *LoginOptions)
DoCodexLogin triggers the Codex OAuth flow through the shared authentication manager. It initiates the OAuth authentication process for OpenAI Codex services and saves the authentication tokens to the configured auth directory.
Parameters:
- cfg: The application configuration
- options: Login options including browser behavior and prompts
func DoGitHubCopilotLogin ¶
func DoGitHubCopilotLogin(cfg *config.Config, options *LoginOptions)
DoGitHubCopilotLogin triggers the OAuth device flow for GitHub Copilot and saves tokens. It initiates the device flow authentication, displays the user code for the user to enter at GitHub's verification URL, and waits for authorization before saving the tokens.
Parameters:
- cfg: The application configuration containing proxy and auth directory settings
- options: Login options including browser behavior settings
func DoGitLabLogin ¶
func DoGitLabLogin(cfg *config.Config, options *LoginOptions)
func DoGitLabTokenLogin ¶
func DoGitLabTokenLogin(cfg *config.Config, options *LoginOptions)
func DoIFlowCookieAuth ¶ added in v6.3.53
func DoIFlowCookieAuth(cfg *config.Config, options *LoginOptions)
DoIFlowCookieAuth performs the iFlow cookie-based authentication.
func DoIFlowLogin ¶ added in v6.1.0
func DoIFlowLogin(cfg *config.Config, options *LoginOptions)
DoIFlowLogin performs the iFlow OAuth login via the shared authentication manager.
func DoKiloLogin ¶
func DoKiloLogin(cfg *config.Config, options *LoginOptions)
DoKiloLogin handles the Kilo device flow using the shared authentication manager. It initiates the device-based authentication process for Kilo AI services and saves the authentication tokens to the configured auth directory.
Parameters:
- cfg: The application configuration
- options: Login options including browser behavior and prompts
func DoKimiLogin ¶ added in v6.8.0
func DoKimiLogin(cfg *config.Config, options *LoginOptions)
DoKimiLogin triggers the OAuth device flow for Kimi (Moonshot AI) and saves tokens. It initiates the device flow authentication, displays the verification URL for the user, and waits for authorization before saving the tokens.
Parameters:
- cfg: The application configuration containing proxy and auth directory settings
- options: Login options including browser behavior settings
func DoKiroAWSAuthCodeLogin ¶
func DoKiroAWSAuthCodeLogin(cfg *config.Config, options *LoginOptions)
DoKiroAWSAuthCodeLogin triggers Kiro authentication with AWS Builder ID using authorization code flow. This provides a better UX than device code flow as it uses automatic browser callback.
Parameters:
- cfg: The application configuration
- options: Login options including prompts
func DoKiroAWSLogin ¶
func DoKiroAWSLogin(cfg *config.Config, options *LoginOptions)
DoKiroAWSLogin triggers Kiro authentication with AWS Builder ID. This uses the device code flow for AWS SSO OIDC authentication.
Parameters:
- cfg: The application configuration
- options: Login options including prompts
func DoKiroGoogleLogin ¶
func DoKiroGoogleLogin(cfg *config.Config, options *LoginOptions)
DoKiroGoogleLogin triggers Kiro authentication with Google OAuth. This uses a custom protocol handler (kiro://) to receive the callback.
Parameters:
- cfg: The application configuration
- options: Login options including prompts
func DoKiroIDCLogin ¶
func DoKiroIDCLogin(cfg *config.Config, options *LoginOptions, startURL, region, flow string)
func DoKiroImport ¶
func DoKiroImport(cfg *config.Config, options *LoginOptions)
DoKiroImport imports Kiro token from Kiro IDE's token file. This is useful for users who have already logged in via Kiro IDE and want to use the same credentials in CLI Proxy API.
Parameters:
- cfg: The application configuration
- options: Login options (currently unused for import)
func DoKiroLogin ¶
func DoKiroLogin(cfg *config.Config, options *LoginOptions)
DoKiroLogin triggers the Kiro authentication flow with Google OAuth. This is the default login method (same as --kiro-google-login).
Parameters:
- cfg: The application configuration
- options: Login options including Prompt field
func DoLogin ¶
func DoLogin(cfg *config.Config, projectID string, options *LoginOptions)
DoLogin handles Google Gemini authentication using the shared authentication manager. It initiates the OAuth flow for Google Gemini services, performs the legacy CLI user setup, and saves the authentication tokens to the configured auth directory.
Parameters:
- cfg: The application configuration
- projectID: Optional Google Cloud project ID for Gemini services
- options: Login options including browser behavior and prompts
func DoQwenLogin ¶
func DoQwenLogin(cfg *config.Config, options *LoginOptions)
DoQwenLogin handles the Qwen device flow using the shared authentication manager. It initiates the device-based authentication process for Qwen services and saves the authentication tokens to the configured auth directory.
Parameters:
- cfg: The application configuration
- options: Login options including browser behavior and prompts
func DoVertexImport ¶ added in v6.3.29
DoVertexImport imports a Google Cloud service account key JSON and persists it as a "vertex" provider credential. The file content is embedded in the auth file to allow portable deployment across stores.
func StartService ¶
StartService builds and runs the proxy service using the exported SDK. It creates a new proxy service instance, sets up signal handling for graceful shutdown, and starts the service with the provided configuration.
Parameters:
- cfg: The application configuration
- configPath: The path to the configuration file
- localPassword: Optional password accepted for local management requests
func StartServiceBackground ¶ added in v6.8.20
func StartServiceBackground(cfg *config.Config, configPath string, localPassword string) (cancel func(), done <-chan struct{})
StartServiceBackground starts the proxy service in a background goroutine and returns a cancel function for shutdown and a done channel.
func WaitForCloudDeploy ¶ added in v6.1.17
func WaitForCloudDeploy()
WaitForCloudDeploy waits indefinitely for shutdown signals in cloud deploy mode when no configuration file is available.
Types ¶
type LoginOptions ¶
type LoginOptions struct {
// NoBrowser indicates whether to skip opening the browser automatically.
NoBrowser bool
// CallbackPort overrides the local OAuth callback port when set (>0).
CallbackPort int
// Prompt allows the caller to provide interactive input when needed.
Prompt func(prompt string) (string, error)
}
LoginOptions contains options for the login processes. It provides configuration for authentication flows including browser behavior and interactive prompting capabilities.