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 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 DoCodexDeviceLogin(cfg *config.Config, options *LoginOptions)
- func DoCodexLogin(cfg *config.Config, options *LoginOptions)
- func DoDevinLogin(cfg *config.Config, options *LoginOptions)
- func DoDiscover(timeout time.Duration, jsonOutput bool) int
- func DoDiscoverWithOptions(opts DiscoverOptions) int
- func DoDiscoverWithServiceType(timeout time.Duration, jsonOutput bool, serviceType string) int
- func DoKimiAILogin(cfg *config.Config, options *LoginOptions)
- func DoKimiLogin(cfg *config.Config, options *LoginOptions)
- func DoMetaLogin(cfg *config.Config, options *LoginOptions)
- func DoSIWCBind(cfg *config.Config, target string, options *LoginOptions)
- func DoVertexImport(cfg *config.Config, keyPath string, prefix string)
- func DoXAILogin(cfg *config.Config, options *LoginOptions)
- func LoadDiscoveryScanFilters(configPath string) (include, exclude []string)
- func ParseInterfaceList(values ...string) []string
- func ResolveDiscoveryInterfaceFilters(cliInclude, cliExclude, cfgInclude, cfgExclude []string) (include, exclude []string)
- func ResolveSIWCBindPath(cfg *config.Config, target string) (string, error)
- func StartService(cfg *config.Config, configPath string, localPassword string)
- func StartServiceBackground(cfg *config.Config, configPath string, localPassword string) (cancel func(), done <-chan struct{})
- func StartServiceBackgroundWithPluginHost(cfg *config.Config, configPath string, localPassword string, ...) (cancel func(), done <-chan struct{})
- func StartServiceWithPluginHost(cfg *config.Config, configPath string, localPassword string, ...)
- func WaitForCloudDeploy()
- type DiscoverOptions
- type LoginOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoAntigravityLogin ¶
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 DoCodexDeviceLogin ¶
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 DoDevinLogin ¶
func DoDevinLogin(cfg *config.Config, options *LoginOptions)
DoDevinLogin triggers the OAuth PKCE or headless token flow for Devin / Cognition and saves credentials.
func DoDiscover ¶
DoDiscover executes the LAN AI gateway discovery workflow and outputs results. Returns 0 on success, 1 on error.
func DoDiscoverWithOptions ¶
func DoDiscoverWithOptions(opts DiscoverOptions) int
DoDiscoverWithOptions executes LAN discovery with explicit scan options.
func DoDiscoverWithServiceType ¶
DoDiscoverWithServiceType executes LAN discovery for the requested DNS-SD service type.
func DoKimiAILogin ¶
func DoKimiAILogin(cfg *config.Config, options *LoginOptions)
DoKimiAILogin triggers the OAuth device flow for Kimi.ai (Moonshot AI) and saves tokens.
Parameters:
- cfg: The application configuration containing proxy and auth directory settings
- options: Login options including browser behavior settings
func DoKimiLogin ¶
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 DoMetaLogin ¶
func DoMetaLogin(cfg *config.Config, options *LoginOptions)
DoMetaLogin triggers the OAuth device-code flow for the Meta provider and saves tokens.
func DoSIWCBind ¶ added in v8.0.25
func DoSIWCBind(cfg *config.Config, target string, options *LoginOptions)
DoSIWCBind runs the OpenAI Sign in with ChatGPT (SIWC) OAuth flow and writes the resulting SIWC credential section and use_siwc=true into the specified Codex credential file.
func DoVertexImport ¶
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 DoXAILogin ¶
func DoXAILogin(cfg *config.Config, options *LoginOptions)
DoXAILogin triggers the OAuth device-code flow for the xAI provider and saves tokens.
func ParseInterfaceList ¶
ParseInterfaceList splits comma-separated interface names and drops blanks.
func ResolveDiscoveryInterfaceFilters ¶
func ResolveDiscoveryInterfaceFilters(cliInclude, cliExclude, cfgInclude, cfgExclude []string) (include, exclude []string)
ResolveDiscoveryInterfaceFilters prefers explicit CLI filters over config filters.
func ResolveSIWCBindPath ¶ added in v8.0.25
ResolveSIWCBindPath resolves a target Codex credential file path (either an absolute path or a bare filename looked up under cfg.AuthDir) and validates that it is an existing Codex JSON file.
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 ¶
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 StartServiceBackgroundWithPluginHost ¶
func StartServiceBackgroundWithPluginHost(cfg *config.Config, configPath string, localPassword string, host *pluginhost.Host, serverOptions ...api.ServerOption) (cancel func(), done <-chan struct{})
StartServiceBackgroundWithPluginHost starts the proxy service with a shared plugin host.
func StartServiceWithPluginHost ¶
func StartServiceWithPluginHost(cfg *config.Config, configPath string, localPassword string, host *pluginhost.Host, serverOptions ...api.ServerOption)
StartServiceWithPluginHost builds and runs the proxy service with a shared plugin host.
func WaitForCloudDeploy ¶
func WaitForCloudDeploy()
WaitForCloudDeploy waits indefinitely for shutdown signals in cloud deploy mode when no configuration file is available.
Types ¶
type DiscoverOptions ¶
type DiscoverOptions struct {
Timeout time.Duration
JSONOutput bool
ServiceType string
Include []string
Exclude []string
}
DiscoverOptions configures a one-shot LAN discovery scan.
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)
ProxyURL string
}
LoginOptions contains options for the login processes. It provides configuration for authentication flows including browser behavior and interactive prompting capabilities.