feat(cli): add cms-lab watch for the local dev loop (#27)#145
Merged
Conversation
cms-lab watch re-runs the scan when cms-lab.config.ts changes and, with --interval, on a fixed timer, printing a short timestamped summary per run. It reloads config each run (edits take effect without restarting) and reuses the scan filters (--only/--skip/--type). The watcher and stop signal are injectable dependencies, so the loop is tested deterministically without real fs events or timers. The default watcher is a debounced fs.watch wrapper. Interactive extras (raw-stdin re-run key, warm-adapter TTL) are intentionally out of this first version.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
cms-lab watch: re-runs the scan whencms-lab.config.tschanges and, with--interval <duration>, on a fixed timer. Prints a short timestamped summary per run ([HH:MM:SS] N errors, ...). Reuses the--only/--skip/--typefilters fromscan, reloads config each run so edits take effect without restarting, and detects the Next project once.Design
The watcher and stop signal are injectable (
dependencies.watch,dependencies.watchSignal), so the loop is tested deterministically without real fs events or timers. The default watcher is a debouncedfs.watchwrapper; the real CLI runs until Ctrl-C. Overlapping runs are coalesced (a change during a run queues exactly one rerun). A scan failure prints and keeps watching rather than exiting.Interactive extras from the design doc (raw-stdin re-run key, warm-adapter TTL) are intentionally left out of this first version to keep it robust and well-tested.
How verified
--intervalexits 2.pnpm verifygreen (223 tests). Documented under/docs/scan.Refs improvements/27.