watcher

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package watcher provides a filesystem watcher that monitors workspace directories for file changes, filters by extension, respects .gitignore, and debounces events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Path string
	Kind EventKind
}

Event represents a filtered, debounced file system event.

type EventKind

type EventKind int

EventKind classifies a file system event.

const (
	EventCreated EventKind = iota
	EventModified
	EventDeleted
)

func (EventKind) String

func (k EventKind) String() string

type Watcher

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

Watcher watches a directory tree for file changes filtered by extension, respecting .gitignore. Events are debounced per-file.

func New

func New(root string, extensions []string) (*Watcher, error)

New creates a Watcher for the given root directory. Only files whose extension appears in extensions (e.g. ".go", ".kt") produce events.

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context) (<-chan Event, error)

Watch starts the event loop. It returns a channel on which filtered, debounced events are sent. Watch blocks until ctx is cancelled, at which point the channel is closed and the underlying fsnotify watcher is shut down.

Jump to

Keyboard shortcuts

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