hotreload

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package hotreload watches forge.yaml for changes and applies safe updates to the running daemon without a restart.

Hot-reloadable settings:

  • settings.poll_interval
  • settings.smith_timeout
  • settings.max_total_smiths
  • settings.claude_flags
  • settings.providers
  • settings.smith_providers
  • settings.max_ci_fix_attempts (applied immediately to lifecycle manager)
  • settings.max_review_fix_attempts (applied immediately to lifecycle manager)
  • settings.max_rebase_attempts (applied immediately to lifecycle manager)
  • notifications.* (all notification settings)
  • anvils.<name>.max_smiths (changes to existing anvils' concurrency limit)
  • anvils.<name>.path (changes to existing anvils' path; updates bellows and depcheck)
  • anvils.* adding or removing anvil entries (updates bellows and depcheck)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(oldCfg, newCfg *config.Config)

Callback is called when config changes are detected and applied. oldCfg is the previous config, newCfg is the updated config.

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher monitors the config file and applies safe changes.

func NewWatcher

func NewWatcher(configFile string, current *config.Config, logger *slog.Logger) *Watcher

NewWatcher creates a config file watcher.

func (*Watcher) Current

func (w *Watcher) Current() *config.Config

Current returns the current config (thread-safe).

func (*Watcher) OnChange

func (w *Watcher) OnChange(cb Callback)

OnChange registers a callback for config changes.

func (*Watcher) Start

func (w *Watcher) Start() error

Start begins watching the config file. Blocks until Stop() or error.

We watch the parent directory instead of the file itself because many editors (and tools like Viper) save files via write-to-temp + rename. On Windows this can cause fsnotify to stop delivering events for the original file after the rename. Watching the directory catches Create/Rename events for the config filename regardless of how the file is written.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop terminates the watcher.

Jump to

Keyboard shortcuts

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