device-shadow-drift-detector compares an exported desired shadow with separately exported reported and observed field evidence. It classifies reconciled, stale, conflicting, missing, and ambiguous fields without reading or writing a device. Node.js 22+; no dependencies.
This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+.
Run the checked-in example
node bin/device-shadow-drift-detector.mjs --root examples --input passing.json
node bin/device-shadow-drift-detector.mjs --root examples --input failing.json
npm run checkRead the result
The passing example exits 0; the failing example exits 1 with field-stale. CLI configuration errors exit 2 with empty stdout. Unreadable, malformed, incomplete, or unsupported exports exit 2 with an incomplete JSON report. Stdout contains only that report. The real input path must remain inside the real --root, including through symlinks.
Scope
Strict UTF-8 only. Maximum input 1,048,576 bytes, 200 records per array, JSON depth 3 (root at 0), 5,000 ms injected processing time. Exceeding any bound returns incomplete; exact N and N+1 tests cover each. Duplicate JSON keys (including escaped spelling) are refused. A read-only report has no --out and never sends device commands.