config

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirs

func EnsureDirs() error

EnsureDirs creates required zen directories.

func StateDir

func StateDir() string

StateDir returns the path to the zen state directory.

Types

type Config

type Config struct {
	Repos        map[string]RepoConfig `yaml:"repos"`
	WatchPaths   []string              `yaml:"watch_paths"`
	Authors      []string              `yaml:"authors"`
	PollInterval string                `yaml:"poll_interval"`
	Agent        string                `yaml:"agent"` // "claude" (default) or "codex"
	ClaudeBin    string                `yaml:"claude_bin"`
	CodexBin     string                `yaml:"codex_bin"`
	Terminal     string                `yaml:"terminal"` // "iterm", "ghostty", "kitty", or "macos"
	BranchPrefix string                `yaml:"branch_prefix"`
	IgnoreDrafts bool                  `yaml:"ignore_drafts"`
	Watch        WatchConfig           `yaml:"watch"`
	Slack        SlackConfig           `yaml:"slack"`
}

Config holds the complete zen configuration.

func Load

func Load() (*Config, error)

Load reads the YAML config from ~/.zen/config.yaml. Returns an error if the config file does not exist or is invalid.

func (*Config) AgentKind added in v0.9.0

func (c *Config) AgentKind(override string) string

AgentKind returns the effective agent kind. A non-empty override (e.g. from a --agent flag) wins over the configured default.

func (*Config) AllBasePaths added in v0.7.0

func (c *Config) AllBasePaths() []string

AllBasePaths returns all configured repo base paths.

func (*Config) GetBranchPrefix added in v0.7.0

func (c *Config) GetBranchPrefix() string

GetBranchPrefix returns the prefix for feature branch names. Falls back to git config user.name (with spaces replaced by hyphens), then empty string.

func (*Config) GetTerminal added in v0.7.0

func (c *Config) GetTerminal() string

GetTerminal returns the configured terminal type.

func (*Config) IsAuthor

func (c *Config) IsAuthor(login string) bool

IsAuthor returns true if the given login is in the authors list.

func (*Config) NewAgent added in v0.9.0

func (c *Config) NewAgent(override string) agent.Agent

NewAgent builds the configured agent, honouring an optional override kind.

func (*Config) RepoBasePath

func (c *Config) RepoBasePath(short string) string

RepoBasePath returns the local base path for a repo (the parent dir that contains the main clone directory).

func (*Config) RepoFullName

func (c *Config) RepoFullName(short string) string

RepoFullName maps a short name to full GitHub owner/repo.

func (*Config) RepoNames

func (c *Config) RepoNames() []string

RepoNames returns all configured short repo names.

func (*Config) RepoShortName

func (c *Config) RepoShortName(full string) string

RepoShortName maps a full GitHub owner/repo to short name.

type RepoConfig

type RepoConfig struct {
	FullName string `yaml:"full_name"`
	BasePath string `yaml:"base_path"`
}

RepoConfig holds per-repository configuration.

type SlackConfig added in v0.11.0

type SlackConfig struct {
	Enabled      bool   `yaml:"enabled"`
	Emoji        string `yaml:"emoji"`         // reaction name (no colons) that flags a task, default "claudecode"
	DefaultRepo  string `yaml:"default_repo"`  // short repo name (from repos:) worktrees are created in
	PollInterval string `yaml:"poll_interval"` // default "5m"
	AckReaction  string `yaml:"ack_reaction"`  // reaction added on pickup, default "eyes"
	DoneEmoji    string `yaml:"done_emoji"`    // reaction (on the original message) or a merged PR from the worktree's branch stops further completion DMs, default "done_check"
}

SlackConfig holds configuration for the Slack task watcher: polling for the user's own emoji reaction on a message, then spinning up a feature worktree seeded with the thread as context. Disabled unless Enabled is explicitly set to true. The Slack token itself is never stored here — it's read from the ZEN_SLACK_TOKEN environment variable at daemon startup.

func (SlackConfig) GetAckReaction added in v0.11.0

func (s SlackConfig) GetAckReaction() string

GetAckReaction returns the reaction added on pickup, defaulting to "eyes".

func (SlackConfig) GetDoneEmoji added in v0.11.0

func (s SlackConfig) GetDoneEmoji() string

GetDoneEmoji returns the reaction name that marks a task done, defaulting to "done_check".

func (SlackConfig) GetEmoji added in v0.11.0

func (s SlackConfig) GetEmoji() string

GetEmoji returns the configured reaction name, defaulting to "claudecode".

func (SlackConfig) PollIntervalDuration added in v0.11.0

func (s SlackConfig) PollIntervalDuration() time.Duration

PollIntervalDuration returns the Slack poll interval, defaulting to 5 minutes.

type WatchConfig

type WatchConfig struct {
	DispatchInterval    string `yaml:"dispatch_interval"`     // default "10s"
	CleanupInterval     string `yaml:"cleanup_interval"`      // default "1h"
	SessionScanInterval string `yaml:"session_scan_interval"` // default "10s"
	CleanupAfterDays    int    `yaml:"cleanup_after_days"`    // default 5
	Concurrency         int    `yaml:"concurrency"`           // default 2
	MaxRetries          int    `yaml:"max_retries"`           // default 5
	DigestInterval      string `yaml:"digest_interval"`       // "" = disabled, e.g. "2h"
}

WatchConfig holds configuration for the watch daemon's workqueue behavior.

func (WatchConfig) CleanupIntervalDuration

func (w WatchConfig) CleanupIntervalDuration() time.Duration

CleanupIntervalDuration returns the cleanup interval as a time.Duration, falling back to the default of 1 hour.

func (WatchConfig) DigestIntervalDuration added in v0.7.0

func (w WatchConfig) DigestIntervalDuration() (time.Duration, bool)

DigestIntervalDuration returns the digest interval duration and whether it is enabled. An empty DigestInterval string disables the digest (returns 0, false).

func (WatchConfig) DispatchIntervalDuration

func (w WatchConfig) DispatchIntervalDuration() time.Duration

DispatchIntervalDuration returns the dispatch interval as a time.Duration, falling back to the default of 10 seconds.

func (WatchConfig) GetCleanupAfterDays

func (w WatchConfig) GetCleanupAfterDays() int

GetCleanupAfterDays returns CleanupAfterDays with a default of 5.

func (WatchConfig) GetConcurrency

func (w WatchConfig) GetConcurrency() int

GetConcurrency returns the concurrency limit with a default of 2.

func (WatchConfig) GetMaxRetries

func (w WatchConfig) GetMaxRetries() int

GetMaxRetries returns the max retries with a default of 5.

func (WatchConfig) SessionScanIntervalDuration added in v0.7.0

func (w WatchConfig) SessionScanIntervalDuration() time.Duration

SessionScanIntervalDuration returns the session scan interval as a time.Duration, falling back to the default of 10 seconds.

Jump to

Keyboard shortcuts

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