watch

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Overview

Package watch polls corpus directories for changes and re-runs bin/kb/index.

Port of the former bin/kb-watch bash script to an importable, testable Go package. Polls file mtimes (no inotify deps); cheap and reliable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args []string)

Run blocks forever polling Dirs (defaults: KB_WATCH_DIRS or /corpus) every Interval (default 30s) and re-indexing when files change. KB_ROOT names the repo root used to locate bin/kb/index.

func Stamp

func Stamp(dirs []string) string

Stamp returns a rolling fingerprint (newest mtime under dirs) that changes whenever any corpus file is touched. Empty when no files found.

Types

type Options

type Options struct {
	Dirs     []string
	Interval time.Duration
	// IndexCmd is the kb/index command template. %s is replaced by the repo
	// root (from KB_ROOT). Defaults to `python3 <root>/bin/kb/index`.
	IndexCmd string
}

Options controls the polling loop. Zero value uses defaults.

Jump to

Keyboard shortcuts

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