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

Method run

atomic-cli/src/commands/intent/show.rs:28–61  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

26
27impl 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}

Callers

nothing calls this directly

Calls 4

find_repository_rootFunction · 0.85
read_intentFunction · 0.85
load_attestationFunction · 0.70
liftFunction · 0.70

Tested by

no test coverage detected