Documentation
¶
Index ¶
- Constants
- func CreateDefaultIgnoreFile(path string) error
- func DefaultIgnoreFilePath(configFilePath string) string
- func LoadIgnoreConfig(path string) (*pullrequest.IgnoreConfig, error)
- func OpenInEditor(path string) error
- func OpenOrCreateIgnoreFile(path string) error
- func WatchForValidConfig(ctx context.Context, path string) <-chan *Config
- func WatchForValidIgnoreConfig(ctx context.Context, ignoreFilePath string) <-chan *pullrequest.IgnoreConfig
- type Config
Constants ¶
const ( // DefaultConfigFileName is the name of the config file in the user's home directory DefaultConfigFileName = ".github-notifier.conf" // DefaultStateFileName is the name of the state file in the user's home directory. // It lives alongside the config file and holds the persisted seen/tracked PR state. DefaultStateFileName = ".github-notifier.state.json" )
const DefaultIgnoreFileName = "ignore.yaml"
Variables ¶
This section is empty.
Functions ¶
func CreateDefaultIgnoreFile ¶
CreateDefaultIgnoreFile writes a self-documenting ignore.yaml if it does not exist.
func DefaultIgnoreFilePath ¶
DefaultIgnoreFilePath returns the default path for ignore.yaml, next to the config file.
func LoadIgnoreConfig ¶
func LoadIgnoreConfig(path string) (*pullrequest.IgnoreConfig, error)
LoadIgnoreConfig loads ignore.yaml from the given path. Returns nil without error if the file does not exist. Returns nil with an error if the file exists but cannot be parsed.
func OpenInEditor ¶
OpenInEditor opens the config file in the user's default text editor. It uses platform-specific commands: xdg-open (Linux), open -t (macOS), notepad (Windows).
func OpenOrCreateIgnoreFile ¶
OpenOrCreateIgnoreFile opens ignore.yaml in the user's editor, creating it if missing.
func WatchForValidConfig ¶
WatchForValidConfig watches the config file at path for changes. When a valid config (with a non-empty GitHub token) is detected, it sends the config on the returned channel and stops watching. The caller should cancel the context to stop watching early.
func WatchForValidIgnoreConfig ¶
func WatchForValidIgnoreConfig(ctx context.Context, ignoreFilePath string) <-chan *pullrequest.IgnoreConfig
WatchForValidIgnoreConfig watches ignoreFilePath and sends a freshly parsed *pullrequest.IgnoreConfig whenever the file changes and parses successfully. The channel is closed when ctx is cancelled.
Types ¶
type Config ¶
type Config struct {
GitHubToken string
SlackOAuthToken string
CheckInterval int // in minutes
MaxNumberOfRepos int
MaxNumberOfPRs int
EnableActivityTracking bool // Enable checking for comments/reviews/commits (increases API usage)
RecentPRThresholdHours int // PRs created within this are "recent" and checked every minute
StalePRCheckIntervalMin int // Check stale PRs every N minutes
IncludeDraftPRs bool // Include draft PRs where user participated (default: true)
MacOSNotificationSender string // macOS notification sender bundle ID (optional)
// ConfigFilePath stores the resolved config file path (not a user setting)
ConfigFilePath string
}
Config holds application configuration
func LoadConfig ¶
func LoadConfig() *Config
LoadConfig loads configuration with the following priority:
- Environment variables (highest priority)
- Config file (~/.github-notifier.conf)
- Default values (lowest priority)
If the config file does not exist, it is created with commented-out defaults.
func LoadConfigWithPath ¶
LoadConfigWithPath loads configuration using a specific config file path. If path is empty, it defaults to ~/.github-notifier.conf.
func (*Config) StateFilePath ¶
StateFilePath returns the path to the JSON state file that persists seen and tracked PR state across process restarts. It is a sibling of ConfigFilePath with the name DefaultStateFileName.