config

package
v0.0.0-...-10bf2d1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaVersion = 1

Variables

This section is empty.

Functions

func CaseFoldEqual

func CaseFoldEqual(left, right string) bool

func FindCaseFoldCollision

func FindCaseFoldCollision(name string, existing []string) (string, bool)

func IsValidName

func IsValidName(name string) bool

func IsWithin

func IsWithin(root, candidate string) bool

func ManifestUnknownFields

func ManifestUnknownFields(data []byte) ([]string, error)

func Marshal

func Marshal(value any) ([]byte, error)

func ResolvePath

func ResolvePath(value, baseDir, homeDir string) (string, error)

ResolvePath applies the schema-v1 path rules. Relative paths resolve from baseDir, a leading "~/" resolves from homeDir, and interpolation is rejected.

func Save

func Save(path string, value any) error

func ValidateName

func ValidateName(name string) error

Types

type BundleClaude

type BundleClaude struct {
	Instructions []string `toml:"instructions,omitempty"`
	Skills       []string `toml:"skills,omitempty"`
	Agents       []string `toml:"agents,omitempty"`
}

type BundleCodex

type BundleCodex struct {
	Instructions []string `toml:"instructions,omitempty"`
	Skills       []string `toml:"skills,omitempty"`
}

type BundleManifest

type BundleManifest struct {
	Schema      int          `toml:"schema"`
	Name        string       `toml:"name"`
	Description string       `toml:"description,omitempty"`
	Claude      BundleClaude `toml:"claude,omitempty"`
	Codex       BundleCodex  `toml:"codex,omitempty"`
}

func DecodeBundleManifest

func DecodeBundleManifest(data []byte, strict bool) (BundleManifest, error)

func LoadBundleManifest

func LoadBundleManifest(path string, strict bool) (BundleManifest, error)

func (BundleManifest) Validate

func (b BundleManifest) Validate() error

type ClaudeAuth

type ClaudeAuth struct {
	CredentialSource
	Mode           ClaudeAuthMode    `toml:"mode,omitempty"`
	EnvironmentKey string            `toml:"environment_key,omitempty"`
	CloudEnv       map[string]string `toml:"cloud_env,omitempty"`
}

type ClaudeAuthMode

type ClaudeAuthMode string
const (
	ClaudeAuthNativeOAuth  ClaudeAuthMode = "native_oauth"
	ClaudeAuthAPIKeyHelper ClaudeAuthMode = "api_key_helper"
	ClaudeAuthEnvironment  ClaudeAuthMode = "environment"
	ClaudeAuthBedrock      ClaudeAuthMode = "bedrock"
	ClaudeAuthVertex       ClaudeAuthMode = "vertex"
	ClaudeAuthFoundry      ClaudeAuthMode = "foundry"
)

type ClaudeTool

type ClaudeTool struct {
	ToolConfig
	Auth ClaudeAuth `toml:"auth,omitempty"`
}

type CodexAuth

type CodexAuth struct {
	CredentialSource
	Mode              CodexAuthMode `toml:"mode,omitempty"`
	ExpectedMethod    string        `toml:"expected_method,omitempty"`
	ExpectedWorkspace string        `toml:"expected_workspace,omitempty"`
	ProviderName      string        `toml:"provider_name,omitempty"`
	EnvironmentKey    string        `toml:"environment_key,omitempty"`
}

type CodexAuthMode

type CodexAuthMode string
const (
	CodexAuthNativeFile     CodexAuthMode = "native_file"
	CodexAuthNativeKeyring  CodexAuthMode = "native_keyring"
	CodexAuthExecAPIKey     CodexAuthMode = "exec_api_key"
	CodexAuthCustomProvider CodexAuthMode = "custom_provider"
)

type CodexTool

type CodexTool struct {
	ToolConfig
	Auth CodexAuth `toml:"auth,omitempty"`
}

type ColorMode

type ColorMode string
const (
	ColorAuto   ColorMode = "auto"
	ColorAlways ColorMode = "always"
	ColorNever  ColorMode = "never"
)

type CredentialProvider

type CredentialProvider string
const (
	ProviderNative      CredentialProvider = "native"
	ProviderOnePassword CredentialProvider = "1password"
	ProviderCommand     CredentialProvider = "command"
	ProviderEnvironment CredentialProvider = "environment"
)

type CredentialSource

type CredentialSource struct {
	Provider   CredentialProvider `toml:"provider,omitempty"`
	Reference  string             `toml:"reference,omitempty"`
	Executable string             `toml:"executable,omitempty"`
	Args       []string           `toml:"args,omitempty"`
	Variable   string             `toml:"variable,omitempty"`
}

CredentialSource identifies a secret without containing the secret itself. Only fields required by the selected provider may be populated.

type GlobalConfig

type GlobalConfig struct {
	Schema        int             `toml:"schema"`
	DefaultShell  string          `toml:"default_shell,omitempty"`
	DefaultTools  []ToolName      `toml:"default_tools,omitempty"`
	Color         ColorMode       `toml:"color,omitempty"`
	Telemetry     bool            `toml:"telemetry"`
	Providers     ProviderConfigs `toml:"providers,omitempty"`
	LogRotationMB int             `toml:"log_rotation_mb,omitempty"`
}

func DecodeGlobalConfig

func DecodeGlobalConfig(data []byte, strict bool) (GlobalConfig, error)

func DefaultGlobalConfig

func DefaultGlobalConfig() GlobalConfig

func LoadGlobalConfig

func LoadGlobalConfig(path string, strict bool) (GlobalConfig, error)

func (GlobalConfig) Validate

func (c GlobalConfig) Validate() error

type HomeMode

type HomeMode string
const (
	HomeManaged HomeMode = "managed"
	HomeAdopted HomeMode = "adopted"
)

type Manifest

type Manifest struct {
	Schema      int                       `toml:"schema"`
	Name        string                    `toml:"name"`
	Description string                    `toml:"description,omitempty"`
	DefaultCWD  string                    `toml:"default_cwd,omitempty"`
	Bundles     []string                  `toml:"bundles,omitempty"`
	Shell       ShellConfig               `toml:"shell,omitempty"`
	Tools       ToolsConfig               `toml:"tools"`
	Env         map[string]string         `toml:"env,omitempty"`
	SecretEnv   map[string]SecretEnvEntry `toml:"secret_env,omitempty"`
	Overrides   map[string]string         `toml:"overrides,omitempty"`
}

func DecodeManifest

func DecodeManifest(data []byte, strict bool) (Manifest, error)

func LoadManifest

func LoadManifest(path string, strict bool) (Manifest, error)

func NewManifest

func NewManifest(name string) Manifest

func (Manifest) Validate

func (m Manifest) Validate() error

type OnePasswordConfig

type OnePasswordConfig struct {
	Binary string `toml:"binary,omitempty"`
}

type ProviderConfigs

type ProviderConfigs struct {
	OnePassword OnePasswordConfig `toml:"1password,omitempty"`
}

type SecretEnvEntry

type SecretEnvEntry struct {
	CredentialSource
	Tools        []ToolName `toml:"tools,omitempty"`
	ExposeToExec bool       `toml:"expose_to_exec"`
}

type ShellConfig

type ShellConfig struct {
	Prompt      bool `toml:"prompt"`
	AllowNested bool `toml:"allow_nested"`
}

type ToolConfig

type ToolConfig struct {
	Enabled bool     `toml:"enabled"`
	Home    string   `toml:"home"`
	Binary  string   `toml:"binary"`
	Mode    HomeMode `toml:"home_mode,omitempty"`
}

type ToolName

type ToolName string
const (
	ToolClaude ToolName = "claude"
	ToolCodex  ToolName = "codex"
)

type ToolsConfig

type ToolsConfig struct {
	Claude *ClaudeTool `toml:"claude,omitempty"`
	Codex  *CodexTool  `toml:"codex,omitempty"`
}

type ValidationError

type ValidationError struct {
	Problems []string
}

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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