Files
teabot/internal/config/paths.go
T
unkinben 1b4448afb4
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Add teabot daemon implementation
teabot watches Gitea repos and dispatches one-shot Claude Code sessions in
Docker containers to work issues and review PRs, acting as configurable bot
personalities.

Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
2026-07-26 23:36:21 +10:00

37 lines
865 B
Go

package config
import (
"os"
"path/filepath"
)
// DefaultConfigPath returns $XDG_CONFIG_HOME/teabot/config.yaml
// (default ~/.config/teabot/config.yaml).
func DefaultConfigPath() string {
base := os.Getenv("XDG_CONFIG_HOME")
if base == "" {
home, _ := os.UserHomeDir()
base = filepath.Join(home, ".config")
}
return filepath.Join(base, AppName, "config.yaml")
}
// DefaultStateDir returns $XDG_STATE_HOME/teabot
// (default ~/.local/state/teabot).
func DefaultStateDir() string {
base := os.Getenv("XDG_STATE_HOME")
if base == "" {
home, _ := os.UserHomeDir()
base = filepath.Join(home, ".local", "state")
}
return filepath.Join(base, AppName)
}
// StateDirOrDefault resolves the effective state directory for the config.
func (c *Config) StateDirOrDefault() string {
if c.StateDir != "" {
return c.StateDir
}
return DefaultStateDir()
}