Summary
optiqor watch [chart] is registered as a Cobra subcommand but returns notYetImplemented. The roadmap (Tier 2) calls for a file-watcher that re-runs analysis whenever a watched values file or chart directory changes — useful for tightening a chart iteratively.
Desired behaviour
optiqor watch ./my-chart
# Clears screen, prints analysis, then waits.
# On any *.yaml change under ./my-chart → clears, re-prints.
# Ctrl-C exits cleanly.
What to do
- Choose a file-watcher library.
fsnotify/fsnotify is the idiomatic Go choice and already used by many Cobra CLIs. Add it to go.mod.
- Create
internal/watch/watch.go with a Run(path string, opts Options) error that:
- Calls
analyze.RunPath(path) once on start.
- Sets up an
fsnotify.Watcher on the chart directory (recursive glob **/*.yaml).
- On
WRITE/CREATE/REMOVE events, debounces 200 ms, then re-runs analysis and reprints.
- Clears the terminal between runs (ANSI
\033[H\033[2J when IsTTY).
- On
SIGINT / SIGTERM, shuts down cleanly (exit code 0).
- Wire
watchCmd in cmd/optiqor/main.go to call watch.Run.
- Support
--json (stream newline-delimited JSON events instead of clearing screen).
Acceptance criteria
optiqor watch ./testdata/fixtures/basic-chart starts, prints findings, and reprints on YAML edit.
--json streams {"event":"update","findings":[...]} lines.
- Ctrl-C exits with code 0.
make lint test passes (use a temporary directory + file write in the test to trigger a re-run).
Notes
- Keep the binary size in mind —
fsnotify adds ~200 KB, which is fine.
- Windows is explicitly out of scope per
CLAUDE.md; fsnotify still works but is not a test target.
Summary
optiqor watch [chart]is registered as a Cobra subcommand but returnsnotYetImplemented. The roadmap (Tier 2) calls for a file-watcher that re-runs analysis whenever a watched values file or chart directory changes — useful for tightening a chart iteratively.Desired behaviour
What to do
fsnotify/fsnotifyis the idiomatic Go choice and already used by many Cobra CLIs. Add it togo.mod.internal/watch/watch.gowith aRun(path string, opts Options) errorthat:analyze.RunPath(path)once on start.fsnotify.Watcheron the chart directory (recursive glob**/*.yaml).WRITE/CREATE/REMOVEevents, debounces 200 ms, then re-runs analysis and reprints.\033[H\033[2JwhenIsTTY).SIGINT/SIGTERM, shuts down cleanly (exit code 0).watchCmdincmd/optiqor/main.goto callwatch.Run.--json(stream newline-delimited JSON events instead of clearing screen).Acceptance criteria
optiqor watch ./testdata/fixtures/basic-chartstarts, prints findings, and reprints on YAML edit.--jsonstreams{"event":"update","findings":[...]}lines.make lint testpasses (use a temporary directory + file write in the test to trigger a re-run).Notes
fsnotifyadds ~200 KB, which is fine.CLAUDE.md;fsnotifystill works but is not a test target.