mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 22:01:22 +01:00
50ce2860c942d83a375cccfcd220c9a2b1baf86f
Consumers that check whether generated options are older than their schema (komorebi-for-kde's `schema-fresh`) compare a `# schema-sha256: <hex>` first line with the hash of schema.json. That line was added by hand in the consumer's justfile with `printf` and `nix hash file`, so the tool's own output could never pass the check. Write the line from the tool. `schema_hash_header` returns it for the raw bytes of the schema file, in lowercase hex, which is the digest `nix hash file --type sha256 --base16` prints. The binary puts it before the generated code; the library functions that return generated code are unchanged, so library users get no new line unless they ask for it. Adds the sha2 dependency. Verified: cargo test passes (49, including two known SHA-256 vectors). On the komorebi-for-kde schema.json the first line equals `nix hash file --type sha256 --base16 schema.json`.