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

Function write_legacy_sidecar

atomic-repository/src/intent_bridge.rs:509–530  ·  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

507
508 /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).
509 fn write_legacy_sidecar(
510 repo: &Repository,
511 id: &str,
512 node: &CanonicalNode,
513 inputs: &LiftInputs,
514 ) {
515 let path = attested_sidecar_path(repo, id).unwrap();
516 std::fs::create_dir_all(path.parent().unwrap()).unwrap();
517 let mut artifact = serde_json::Map::new();
518 artifact.insert("node".to_string(), node.to_value());
519 let mut source = serde_json::Map::new();
520 source.insert(
521 "sourceContentHash".to_string(),
522 Value::String(source_content_hash(inputs)),
523 );
524 artifact.insert("source".to_string(), Value::Object(source));
525 std::fs::write(
526 &path,
527 serde_json::to_string_pretty(&Value::Object(artifact)).unwrap(),
528 )
529 .unwrap();
530 }
531
532 #[test]
533 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