cmd

package
v6.7.2-0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 29 Imported by: 0

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

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 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 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 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 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

func DoVertexImport(cfg *config.Config, keyPath string)

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

func StartService(cfg *config.Config, configPath string, localPassword string)

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 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL