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

Function write_legacy_sidecar

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

390
391 /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).
392 fn write_legacy_sidecar(
393 repo: &Repository,
394 id: &str,
395 node: &CanonicalNode,
396 inputs: &LiftInputs,
397 ) {
398 let path = attested_sidecar_path(repo, id).unwrap();
399 std::fs::create_dir_all(path.parent().unwrap()).unwrap();
400 let mut artifact = serde_json::Map::new();
401 artifact.insert("node".to_string(), node.to_value());
402 let mut source = serde_json::Map::new();
403 source.insert(
404 "sourceContentHash".to_string(),
405 Value::String(source_content_hash(inputs)),
406 );
407 artifact.insert("source".to_string(), Value::Object(source));
408 std::fs::write(
409 &path,
410 serde_json::to_string_pretty(&Value::Object(artifact)).unwrap(),
411 )
412 .unwrap();
413 }
414
415 #[test]
416 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