10. Tooling day-to-day
The edit loop around a living document: fmt, set, diff, and the repl.
After this lesson you can
- Normalise a file with wcl fmt - Edit a field from the shell with wcl set and see it with wcl diff - Explore a document interactively with wcl repl
Before you start: Imports and namespaces
Once a document exists, most work is small edits. wcl fmt --in-place rewrites to canonical form (comments and blank-line groupings survive). wcl set file.wcl path value updates one field in place, following the import chain to the file that declares it — the value is parsed as a WCL expression, so quote it from the shell. wcl diff old new compares the *evaluated* documents, so a formatting-only change is an empty diff.
For exploration, wcl repl file.wcl gives you a prompt whose identifiers resolve against the file's top-level fields — the quickest way to poke at expressions before committing them.
§ 1Exercise: One full edit loop
Take the services file from lesson 5, change a port with wcl set, and inspect the change with wcl diff.
Expected result
wcl set reports the update, and the diff shows one modified "service:api" entry with old = 9090u32, new = 8443u32. The final check prints OK.
Hint
wcl set edits explicitly-authored fields; the diff output is itself re-parseable WCL — pipe it to a file and inspect it like any document. Use --format json for scripting.