cmd

package
v8.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 28 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 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

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

func DoDiscover(timeout time.Duration, jsonOutput bool) int

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

func DoDiscoverWithServiceType(timeout time.Duration, jsonOutput bool, serviceType string) int

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 DoVertexImport

func DoVertexImport(cfg *config.Config, keyPath string, prefix 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 DoXAILogin

func DoXAILogin(cfg *config.Config, options *LoginOptions)

DoXAILogin triggers the OAuth device-code flow for the xAI provider and saves tokens.

func LoadDiscoveryScanFilters

func LoadDiscoveryScanFilters(configPath string) (include, exclude []string)

func ParseInterfaceList

func ParseInterfaceList(values ...string) []string

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

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