watcher

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WalkAllFiles

func WalkAllFiles(repoRoot string, excludedDirs []string) ([]string, error)

WalkAllFiles walks the repository and returns relative paths of ALL files, respecting excluded dirs and .gitignore rules, but NOT filtering by extension. This is used by the file document indexer to find config, Blade, and SQL files that are not covered by tree-sitter parsing.

func WalkSourceFiles

func WalkSourceFiles(repoRoot string, excludedDirs []string) ([]string, error)

WalkSourceFiles walks the repo root and returns relative paths of all watchable source files, respecting excluded dirs and .gitignore rules. Unlike WalkExisting(), this does NOT require an fsnotify watcher allocation. (L4)

func WalkSourceFilesUnder

func WalkSourceFilesUnder(repoRoot string, walkDir string, excludedDirs []string) ([]string, error)

WalkSourceFilesUnder walks a specific directory (which must be inside repoRoot) and returns relative paths (relative to repoRoot) of all watchable source files, respecting excluded dirs and .gitignore rules. Unlike WalkSourceFiles, this only walks the subtree rooted at walkDir.

Types

type Watcher

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

Watcher monitors filesystem changes and emits deduplicated FileEvents

func New

func New(repoRoot string, debounceDelay time.Duration, excludedDirs []string) (*Watcher, error)

New creates a new Watcher for the given repo root

func (*Watcher) Events

func (w *Watcher) Events() <-chan types.FileEvent

Events returns the channel of deduplicated file events

func (*Watcher) Start

func (w *Watcher) Start() error

Start begins watching the repository for changes

func (*Watcher) Stop

func (w *Watcher) Stop() error

Stop gracefully shuts down the watcher. It is safe to call Stop() multiple times — only the first call takes effect (C15).

func (*Watcher) WalkExisting

func (w *Watcher) WalkExisting() ([]string, error)

WalkExisting walks the repo and returns all existing watchable file paths. This is useful for initial indexing. M15: follows symlinks with cycle detection for consistent symlink handling.

Jump to

Keyboard shortcuts

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