smelter

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package smelter batches pending warden rules into PRs. The Smelter periodically queries pending_warden_rules from the state DB, groups them by anvil, appends them to each anvil's .forge/warden-rules.yaml (deduping by rule ID), commits the change, and creates or updates a PR on the forge/warden-learn-batch/<anvil> branch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Smelter

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

Smelter batches pending warden rules into PRs on a schedule.

func New

func New(db *state.DB, interval time.Duration, anvilPaths map[string]string) *Smelter

New creates a Smelter. interval controls how often Flush is called; pass 0 to disable scheduled runs (Flush can still be called directly).

func (*Smelter) Flush

func (s *Smelter) Flush(ctx context.Context) error

Flush queries all pending warden rules, groups them by anvil, and for each anvil: creates a worktree, appends rules to warden-rules.yaml (deduping by rule ID), commits, force-pushes to the batch branch, and creates/updates a PR. Flushed rules are deleted from the DB on success.

func (*Smelter) Run

func (s *Smelter) Run(ctx context.Context) error

Run starts the periodic flush loop. Blocks until ctx is canceled. If interval <= 0 at startup, scheduled flushes are paused until UpdateInterval is called with a positive value.

func (*Smelter) UpdateAnvilPaths

func (s *Smelter) UpdateAnvilPaths(paths map[string]string)

UpdateAnvilPaths replaces the set of anvils. Safe to call while Run is active.

func (*Smelter) UpdateInterval

func (s *Smelter) UpdateInterval(d time.Duration)

UpdateInterval signals the Run loop to reset its ticker with d. If d <= 0 the ticker is paused until a positive interval is sent. Safe to call concurrently while Run is active.

Jump to

Keyboard shortcuts

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