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

Function write_legacy_sidecar

atomic-repository/src/intent_bridge.rs:436–457  ·  view source on GitHub ↗

Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).

(
        repo: &Repository,
        id: &str,
        node: &CanonicalNode,
        inputs: &LiftInputs,
    )

Source from the content-addressed store, hash-verified

434
435 /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).
436 fn write_legacy_sidecar(
437 repo: &Repository,
438 id: &str,
439 node: &CanonicalNode,
440 inputs: &LiftInputs,
441 ) {
442 let path = attested_sidecar_path(repo, id).unwrap();
443 std::fs::create_dir_all(path.parent().unwrap()).unwrap();
444 let mut artifact = serde_json::Map::new();
445 artifact.insert("node".to_string(), node.to_value());
446 let mut source = serde_json::Map::new();
447 source.insert(
448 "sourceContentHash".to_string(),
449 Value::String(source_content_hash(inputs)),
450 );
451 artifact.insert("source".to_string(), Value::Object(source));
452 std::fs::write(
453 &path,
454 serde_json::to_string_pretty(&Value::Object(artifact)).unwrap(),
455 )
456 .unwrap();
457 }
458
459 #[test]
460 fn test_load_attestation_prefers_tracked_then_legacy() {

Calls 7

parentMethod · 0.80
attested_sidecar_pathFunction · 0.70
source_content_hashFunction · 0.70
writeFunction · 0.50
unwrapMethod · 0.45
insertMethod · 0.45
to_valueMethod · 0.45