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

Function write_legacy_sidecar

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

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