config

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(v bool) *bool

func GlobalConfigPath

func GlobalConfigPath() string

func IsWillowRepo added in v0.1.2

func IsWillowRepo(bareDir string) bool

IsWillowRepo checks if bareDir lives under ~/.willow/repos/. Both paths are resolved through EvalSymlinks to handle macOS /var → /private/var.

func ListRepos added in v0.1.2

func ListRepos() ([]string, error)

ListRepos scans ~/.willow/repos/ for *.git dirs and returns repo names (without .git suffix).

func LocalConfigPath

func LocalConfigPath(bareDir string) string

func ReposDir

func ReposDir() string

func ResolveRepo added in v0.1.2

func ResolveRepo(name string) (string, error)

ResolveRepo returns the bare dir path for a named repo under ~/.willow/repos/.

func ResolveRepoFromDir added in v0.2.0

func ResolveRepoFromDir(dir string) (string, bool)

ResolveRepoFromDir checks if dir is at or under ~/.willow/worktrees/<name>/ and returns the corresponding bare repo path (~/.willow/repos/<name>.git). This allows commands to work from the worktrees/<name>/ directory itself, not just from inside a specific worktree.

func Save

func Save(cfg *Config, path string) error

Save writes a config to the given path, creating directories as needed. Uses atomic write (temp file + rename) to prevent corruption from interrupted writes.

func TrashDir added in v0.3.3

func TrashDir() string

func WillowHome

func WillowHome() string

WillowHome returns ~/.willow

func WorktreesDir

func WorktreesDir() string

Types

type Config

type Config struct {
	BaseBranch       string       `json:"baseBranch,omitempty"`
	BranchPrefix     string       `json:"branchPrefix,omitempty"`
	PostCheckoutHook string       `json:"postCheckoutHook,omitempty"`
	Setup            []string     `json:"setup,omitempty"`
	Teardown         []string     `json:"teardown,omitempty"`
	Defaults         Defaults     `json:"defaults"`
	Tmux             TmuxConfig   `json:"tmux,omitempty"`
	Notify           NotifyConfig `json:"notify,omitempty"`
	Telemetry        *bool        `json:"telemetry,omitempty"`
	Cost             CostConfig   `json:"cost,omitempty"`
}

func DefaultConfig

func DefaultConfig() *Config

func Load

func Load(bareDir string) *Config

Load resolves config by merging 2 tiers: global → local. bareDir can be empty if unavailable (e.g. not in a repo).

func LoadFile

func LoadFile(path string) (*Config, error)

func (*Config) Validate added in v1.1.1

func (cfg *Config) Validate() []string

Validate checks for common config issues and returns warnings. Returns nil if config is valid.

type CostConfig added in v1.2.0

type CostConfig struct {
	InputRate  float64 `json:"inputRate,omitempty"`  // $/M tokens, default 3.0 (Sonnet 4)
	OutputRate float64 `json:"outputRate,omitempty"` // $/M tokens, default 15.0 (Sonnet 4)
}

type Defaults

type Defaults struct {
	Fetch           *bool `json:"fetch,omitempty"`
	AutoSetupRemote *bool `json:"autoSetupRemote,omitempty"`
}

type NotifyConfig added in v1.2.0

type NotifyConfig struct {
	Desktop *bool  `json:"desktop,omitempty"`
	Sound   *bool  `json:"sound,omitempty"`
	Command string `json:"command,omitempty"`
}

type PaneConfig added in v1.1.0

type PaneConfig struct {
	Command string `json:"command,omitempty"`
}

type TmuxConfig added in v0.5.0

type TmuxConfig struct {
	ReloadInterval    int          `json:"reloadInterval,omitempty"`
	Notification      *bool        `json:"notification,omitempty"`
	NotifyCommand     string       `json:"notifyCommand,omitempty"`
	NotifyWaitCommand string       `json:"notifyWaitCommand,omitempty"`
	SwitcherPreview   *bool        `json:"switcherPreview,omitempty"`
	Layout            []string     `json:"layout,omitempty"`
	Panes             []PaneConfig `json:"panes,omitempty"`
}

Jump to

Keyboard shortcuts

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