(&self)
| 76 | |
| 77 | impl 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 | |
| 118 | impl Command for ProvenanceShow { |
nothing calls this directly
no test coverage detected