config

package
v0.0.0-...-9314b3c Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages API configurations

func NewConfigManager

func NewConfigManager() (*Manager, error)

NewConfigManager creates a new Manager with unified config path

func NewConfigManagerWithPath

func NewConfigManagerWithPath(configPath string) *Manager

NewConfigManagerWithPath creates a Manager with a custom config file path. This is useful for testing or when the config location needs to be overridden.

func (*Manager) Add

func (cm *Manager) Add(config models.APIConfig) error

Add adds a new configuration

func (*Manager) Disable

func (cm *Manager) Disable() error

Disable clears the active configuration and syncs with Claude Code

func (*Manager) GenerateActiveScript

func (cm *Manager) GenerateActiveScript() error

GenerateActiveScript generates the activation script for active configuration

func (*Manager) Get

func (cm *Manager) Get(alias string) (*models.APIConfig, error)

Get returns a configuration by alias

func (*Manager) GetActive

func (cm *Manager) GetActive() (*models.APIConfig, error)

GetActive returns the active configuration

func (*Manager) GetActiveName

func (cm *Manager) GetActiveName() (string, error)

GetActiveName returns the active configuration name

func (*Manager) GetConfigPath

func (cm *Manager) GetConfigPath() string

GetConfigPath returns the path to the config file

func (*Manager) GetGlobalActive

func (cm *Manager) GetGlobalActive() (*models.APIConfig, error)

GetGlobalActive returns the persisted global active configuration. Unlike GetActive, it ignores the APIMGR_ACTIVE environment override.

func (*Manager) GetModels

func (cm *Manager) GetModels(alias string) ([]string, error)

GetModels returns the supported models list for a configuration.

func (*Manager) List

func (cm *Manager) List() ([]models.APIConfig, error)

List returns all configurations

func (*Manager) Load

func (cm *Manager) Load() ([]models.APIConfig, error)

Load loads all configurations from the config file

func (*Manager) Remove

func (cm *Manager) Remove(alias string) error

Remove removes a configuration by alias

func (*Manager) RenameAlias

func (cm *Manager) RenameAlias(oldAlias, newAlias string) error

RenameAlias renames a configuration alias

func (*Manager) RestoreClaudeToGlobal

func (cm *Manager) RestoreClaudeToGlobal() error

RestoreClaudeToGlobal restores Claude Code settings to match the global active configuration. If no global active configuration exists, it clears the ANTHROPIC_* env vars from Claude Code settings.

func (*Manager) Save

func (cm *Manager) Save(configs []models.APIConfig) error

Save saves configurations to the config file

func (*Manager) SetActive

func (cm *Manager) SetActive(alias string) error

SetActive sets the active configuration

func (*Manager) SetModels

func (cm *Manager) SetModels(alias string, modelNames []string) error

SetModels updates the supported models list for a configuration. It validates the models list and handles active model fallback when the current active model is removed.

func (*Manager) SwitchModel

func (cm *Manager) SwitchModel(alias string, model string) error

SwitchModel switches the active model for a configuration. It validates that the model is in the supported models list before switching.

func (*Manager) SyncClaudeSettingsOnly

func (cm *Manager) SyncClaudeSettingsOnly(cfg *models.APIConfig) error

SyncClaudeSettingsOnly syncs configuration to Claude Code settings files without updating global active field or generating active.env file. This is used for local mode to update Claude Code immediately.

func (*Manager) UpdatePartial

func (cm *Manager) UpdatePartial(alias string, updates map[string]string) error

UpdatePartial updates only the specified fields of a configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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