CLI command

watch

Monitor a solution continuously and re-run analysis after file changes so simplification work gets immediate feedback.

Command contract

watch is the refactoring loop. It keeps the current solution shape visible while you are actively changing code.

Best for

Simplification sessions, teaching demos, and iterative cleanup where you want to see the effect of each edit quickly.

Writes files

No. It watches the solution tree and streams refreshed output.

Exit behavior

Returns 0 when stopped cleanly. Returns 1 for usage errors; runtime watch failures are printed to stderr.

Usage

Start with the exact command shape the CLI supports today.

Command
dotnet simplicity watch path/to/YourSolution.sln

Refactoring loop

Keep watch running in one terminal while you simplify code in another.

dotnet simplicity watch samples/Sample.Simplified/Sample.Simplified.sln

What it prints or produces

watch starts with an initial snapshot, then prints refreshed snapshots and filter verdicts after debounced file changes.

  • Full solution path in the initial “Watching …” banner.
  • Initial snapshot plus filter verdicts immediately after startup.
  • Updated snapshot sections after file changes, using a 500 ms debounce.
  • Change display that shows which file changed, including rename old -> new formatting.
  • Missing-config warnings shown once until a simplicity.json file appears again.
Sample output
Watching /path/to/YourSolution.sln
Press Ctrl+C to stop.

Initial snapshot
----------------
Simplicity Snapshot (2026-05-01)
----------------------------------------
Projects: 2
Total files: 23
Primary path files: 5
Abstraction layers: 1

Filter Verdicts
---------------
TwoAmTest: PASS (1.00)
HalfRule: PASS (1.00)
PrimaryPathFirst: PASS (0.79)

Operational notes

These behaviors matter when you move from a local run to team automation.

  • The watcher ignores bin, obj, .git, .vs, and simplicity-report to avoid self-triggering noise.
  • Configuration is reloaded on every pass, so threshold changes in simplicity.json show up without restarting the process.
  • watch is meant for local feedback, not CI. Use diff for merge gates and report for persistent artifacts.

Related pages

Use the surrounding docs when you need setup, filter interpretation, or CI context.