Quick Start
The minimal closed loop: init → scan → baseline → diff. Copy-paste friendly.
1. Install and initialize
pip install cfgdrift
cfgdrift init
This initializes the SQLite database (default ~/.cfgdrift/cfgdrift.db; override with
CFGDRIFT_HOME or the global --store PATH option).
2. Scan and save a baseline
cfgdrift scan ./config --save-as-baseline prod
Scans a file or a whole directory, records history, and stores the snapshot as baseline
prod. Directory scans recognize .json / .yaml|.yml /
.toml / .ini|.cfg|.conf by extension; unknown extensions are skipped with a
warning. For a single file with an unknown extension, pass an explicit --format.
3. Introduce a change, then diff
# ... edit your config ...
cfgdrift diff ./config --baseline prod # exit code 1 = drift detected
The diff report lists each drift item with severity, key path, change type, and
file:line location. CRITICAL/WARN items also carry a [hint] block
(expected value + rollback command + provenance). Exit codes: 0 = no drift,
1 = drift detected, 2 = error.
4. (Optional) Open the Web dashboard
pip install "cfgdrift[web]"
cfgdrift serve # open http://127.0.0.1:8080
What's next?
- CLI Reference — every command in detail
- Consistency Constraints — range / enum / conditional_required / correlation / mutual_exclusion
- Gallery — three runnable end-to-end demos