MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / source_content_hash

Function source_content_hash

atomic-cli/src/commands/intent/bridge.rs:198–205  ·  view source on GitHub ↗

A hash of the source lift inputs, recorded in the sidecar so a later edit to the intent can be detected as making the attestation stale. This is a standalone digest of (frontmatter + body); it is NOT the vault's `content_hash` and never feeds it. `attest` writes it; `validate`/`show`/ `verify` recompute it to decide whether a sidecar is still fresh.

(inputs: &LiftInputs)

Source from the content-addressed store, hash-verified

196/// `content_hash` and never feeds it. `attest` writes it; `validate`/`show`/
197/// `verify` recompute it to decide whether a sidecar is still fresh.
198pub fn source_content_hash(inputs: &LiftInputs) -> String {
199 let fm = serde_json::to_string(&inputs.frontmatter).unwrap_or_default();
200 let mut hasher = blake3::Hasher::new();
201 hasher.update(fm.as_bytes());
202 hasher.update(b"\0");
203 hasher.update(inputs.body.as_bytes());
204 format!("blake3:{}", hasher.finalize().to_hex())
205}
206
207/// The state of an intent's attestation sidecar relative to the current source.
208pub enum Attestation {

Callers 6

load_attestationFunction · 0.70
write_trackedFunction · 0.70
write_legacy_sidecarFunction · 0.70
runMethod · 0.70
write_trackedFunction · 0.70

Calls 2

updateMethod · 0.80
as_bytesMethod · 0.45

Tested by 2

runMethod · 0.56