(&self)
| 26 | |
| 27 | impl Command for IntentShow { |
| 28 | fn run(&self) -> CliResult<()> { |
| 29 | let root = find_repository_root()?; |
| 30 | let repo = Repository::open(&root).map_err(CliError::Repository)?; |
| 31 | |
| 32 | // Pure read-time projection: lift then render. No gate, no proof |
| 33 | // requirement — this must work on a plain (un-attested) intent. The |
| 34 | // status line is regenerated from the spine by the renderer. If a FRESH |
| 35 | // attestation sidecar exists we project that (so `show` reflects the |
| 36 | // attested author/proof); a stale one warns and falls back to the raw node. |
| 37 | let inputs = bridge::read_intent(&repo, &self.id)?; |
| 38 | let node = match bridge::load_attestation(&repo, &self.id, &inputs)? { |
| 39 | bridge::Attestation::Fresh(node) => *node, |
| 40 | bridge::Attestation::Stale(_) => { |
| 41 | eprintln!( |
| 42 | "warning: the attestation for {} is stale; showing the current \ |
| 43 | (un-attested) intent.", |
| 44 | self.id |
| 45 | ); |
| 46 | bridge::lift(&inputs)? |
| 47 | } |
| 48 | bridge::Attestation::None => bridge::lift(&inputs)?, |
| 49 | }; |
| 50 | |
| 51 | if self.json { |
| 52 | println!( |
| 53 | "{}", |
| 54 | serde_json::to_string_pretty(&node.to_value()).unwrap() |
| 55 | ); |
| 56 | } else { |
| 57 | print!("{}", render(&node, Target::Cli)); |
| 58 | } |
| 59 | |
| 60 | Ok(()) |
| 61 | } |
| 62 | } |
nothing calls this directly
no test coverage detected