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

Function write_legacy_sidecar

atomic-cli/src/commands/intent/bridge.rs:374–395  ·  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

372
373 /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).
374 fn write_legacy_sidecar(
375 repo: &Repository,
376 id: &str,
377 node: &CanonicalNode,
378 inputs: &LiftInputs,
379 ) {
380 let path = attested_sidecar_path(repo, id).unwrap();
381 std::fs::create_dir_all(path.parent().unwrap()).unwrap();
382 let mut artifact = serde_json::Map::new();
383 artifact.insert("node".to_string(), node.to_value());
384 let mut source = serde_json::Map::new();
385 source.insert(
386 "sourceContentHash".to_string(),
387 Value::String(source_content_hash(inputs)),
388 );
389 artifact.insert("source".to_string(), Value::Object(source));
390 std::fs::write(
391 &path,
392 serde_json::to_string_pretty(&Value::Object(artifact)).unwrap(),
393 )
394 .unwrap();
395 }
396
397 #[test]
398 fn test_load_attestation_prefers_tracked_then_legacy() {

Calls 7

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