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

Function vault_goal_show

atomic-cli/src/commands/rpc.rs:6579–6616  ·  view source on GitHub ↗

`atomic vault goal show` over GetVaultEntry (kind=GOAL) — the stored goal.md content + frontmatter ride the bundle; the CLI renders the local JSON/plain projection over them.

(args: &super::vault::goal::GoalShow)

Source from the content-addressed store, hash-verified

6577/// goal.md content + frontmatter ride the bundle; the CLI renders the
6578/// local JSON/plain projection over them.
6579pub fn vault_goal_show(args: &super::vault::goal::GoalShow) -> CliResult<bool> {
6580 let Some(session) = Service::open()? else {
6581 return Ok(false);
6582 };
6583 let request = pb::GetVaultEntryRequest {
6584 repository: Some(session.reference.clone()),
6585 kind: Kind::Goal as i32,
6586 id: args.goal.clone(),
6587 path: None,
6588 include_bundle: true,
6589 view: None,
6590 };
6591 let response = session.get_vault_entry(request)?;
6592 let Some(bundle) = response
6593 .entry_bundle
6594 .as_ref()
6595 .map(parse_entry_bundle)
6596 .transpose()?
6597 else {
6598 return Err(CliError::Internal(anyhow::anyhow!(
6599 "the service returned no entry bundle (include_bundle required)"
6600 )));
6601 };
6602 let entry = &bundle.entry;
6603 if args.json {
6604 let json = serde_json::json!({
6605 "name": args.goal,
6606 "content": String::from_utf8_lossy(&entry.content_bytes),
6607 "frontmatter": serde_json::from_str::<serde_json::Value>(
6608 &entry.frontmatter_json
6609 ).unwrap_or_default(),
6610 });
6611 println!("{}", serde_json::to_string_pretty(&json).unwrap());
6612 } else {
6613 print!("{}", String::from_utf8_lossy(&entry.content_bytes));
6614 }
6615 Ok(true)
6616}
6617
6618// ---------------------------------------------------------------------------
6619// vault materialize / summaries (VaultService)

Callers 1

runMethod · 0.85

Calls 4

as_refMethod · 0.80
openFunction · 0.50
cloneMethod · 0.45
get_vault_entryMethod · 0.45

Tested by

no test coverage detected