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

Method run

atomic-cli/src/commands/provenance/command.rs:78–115  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

76
77impl Command for ProvenanceTrace {
78 fn run(&self) -> CliResult<()> {
79 let root = find_repository_root()?;
80 let repo = Repository::open(&root).map_err(CliError::Repository)?;
81 let change_hash = resolve_change_target(&repo, &self.target)?;
82 let graphs = load_graphs(&repo, &change_hash)?;
83
84 if self.json {
85 // Emit the JSON-LD, exactly like `show` (unsigned by default; `--sign`
86 // for the signable artifact).
87 let (identity, keypair) = resolve_person(self.identity.as_deref())?;
88 let person_did = did_for_public_key(&identity.public_key);
89 let values = graphs
90 .iter()
91 .map(|(_, g)| {
92 let input = map_graph_to_input(&repo, g, &change_hash, &person_did);
93 if self.sign {
94 attest_prov(&input, &identity, &keypair)
95 } else {
96 project(&input)
97 }
98 })
99 .collect::<Vec<_>>();
100 print_value(&values, self.sign);
101 return Ok(());
102 }
103
104 // Plain trace: no identity/key required. Use the graph's own person
105 // slot as "(unresolved)" — the human chain does not need a signature.
106 // We still resolve a Person did if one is available so the chain shows
107 // the real signer; otherwise the actedOnBehalfOf target is left blank.
108 let person_did = resolve_person(self.identity.as_deref())
109 .ok()
110 .map(|(id, _)| did_for_public_key(&id.public_key))
111 .unwrap_or_else(|| "(no signing identity)".to_string());
112
113 print_trace(&repo, &graphs, &change_hash, &person_did);
114 Ok(())
115 }
116}
117
118impl Command for ProvenanceShow {

Callers

nothing calls this directly

Calls 11

find_repository_rootFunction · 0.85
resolve_change_targetFunction · 0.85
load_graphsFunction · 0.85
resolve_personFunction · 0.85
did_for_public_keyFunction · 0.85
map_graph_to_inputFunction · 0.85
attest_provFunction · 0.85
projectFunction · 0.85
print_valueFunction · 0.85
print_traceFunction · 0.85
iterMethod · 0.45

Tested by

no test coverage detected