Mirror `attest`'s tracked-vault write exactly (body = pretty JSON + '\n', flat-string frontmatter anchors).
(repo: &Repository, id: &str, node: &CanonicalNode, inputs: &LiftInputs)
| 348 | /// Mirror `attest`'s tracked-vault write exactly (body = pretty JSON + '\n', |
| 349 | /// flat-string frontmatter anchors). |
| 350 | fn write_tracked(repo: &Repository, id: &str, node: &CanonicalNode, inputs: &LiftInputs) { |
| 351 | let mut body = serde_json::to_string_pretty(&node.to_value()).unwrap(); |
| 352 | body.push('\n'); |
| 353 | let mut fm = serde_json::Map::new(); |
| 354 | fm.insert( |
| 355 | "intentId".into(), |
| 356 | Value::String(normalized_id(repo, id).unwrap()), |
| 357 | ); |
| 358 | fm.insert( |
| 359 | "sourceContentHash".into(), |
| 360 | Value::String(source_content_hash(inputs)), |
| 361 | ); |
| 362 | let frontmatter_json = serde_json::to_string(&fm).unwrap(); |
| 363 | let vpath = attestation_vault_path(repo, id).unwrap(); |
| 364 | repo.vault_store( |
| 365 | &vpath, |
| 366 | VaultEntryType::Attestation, |
| 367 | body.into_bytes(), |
| 368 | frontmatter_json, |
| 369 | ) |
| 370 | .unwrap(); |
| 371 | } |
| 372 | |
| 373 | /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper). |
| 374 | fn write_legacy_sidecar( |