Expand description
faucet fmt — canonicalize a pipeline config (#387).
A deterministic, idempotent config formatter — the config analogue of
cargo fmt / terraform fmt. It parses the file, rewrites every object with
a stable key order (a curated priority order for the well-known blocks, then
alphabetical for everything else), and re-serializes it. Running fmt twice
is always a no-op, so --check is a cheap CI gate for “is this config
normalized?”.
Canonicalization is a pure serde_json::Value → serde_json::Value
transform (canonicalize); the command layer only reads/writes files and
renders the --check diff.
Scope: fmt formats the literal file — it does not resolve
${env:…} / ${file:…} interpolation, apply !include / extends
composition, or drop schema defaults. Use faucet validate --show-composed
to see the composed result.
Comments are not preserved — the config is parsed and re-serialized, the
same limitation faucet migrate documents.
Functions§
- canonicalize
- Rewrite
valueinto canonical form: every object’s keys are reordered by (canonical rank, then name), recursively. Pure and idempotent — running it on its own output is a no-op. Relies onserde_json’spreserve_orderfeature (enabled workspace-wide) so the rebuilt insertion order survives serialization. - run
- Execute the
fmtsubcommand.