watcher

package
v0.7.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Display

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

Display renders watch mode output to the terminal.

func NewDisplay

func NewDisplay(out io.Writer, noColor bool) *Display

NewDisplay creates a new Display.

func (*Display) Clear

func (d *Display) Clear()

Clear clears the terminal screen.

func (*Display) RenderExit

func (d *Display) RenderExit(totalRuns int, totalIssues int, duration time.Duration)

RenderExit shows the summary when watch mode ends.

func (*Display) RenderHeader

func (d *Display) RenderHeader(repoRoot string, version string)

RenderHeader shows the watch mode banner.

func (*Display) RenderResult

func (d *Display) RenderResult(result RunResult)

RenderResult shows the latest analysis result.

func (*Display) RenderWaiting

func (d *Display) RenderWaiting()

RenderWaiting shows the idle state.

type Options

type Options struct {
	PollInterval time.Duration // how often to check for changes (default 500ms)
	Debounce     time.Duration // wait this long after last change before running (default 200ms)
}

Options configures the watcher behavior.

type RunResult

type RunResult struct {
	Result    *analyzer.AnalysisResult
	Timestamp time.Time
	Duration  time.Duration
	Trigger   string // which file triggered the run
}

RunResult holds the output of a single analysis cycle.

type Watcher

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

Watcher monitors the git working tree and runs analysis on changes.

func New

func New(repoRoot string, repo *git.Repo, cfg *config.Config, reg *parser.Registry,
	analyzers []analyzer.Analyzer, idx *index.Index, opts Options,
	onChange func(RunResult), onError func(error)) *Watcher

New creates a new Watcher.

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context) error

Watch starts the monitoring loop. Blocks until ctx is cancelled.

Jump to

Keyboard shortcuts

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