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

Function vault_goal_show

atomic-cli/src/commands/rpc.rs:6539–6576  ·  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

6537/// goal.md content + frontmatter ride the bundle; the CLI renders the
6538/// local JSON/plain projection over them.
6539pub fn vault_goal_show(args: &super::vault::goal::GoalShow) -> CliResult<bool> {
6540 let Some(session) = Service::open()? else {
6541 return Ok(false);
6542 };
6543 let request = pb::GetVaultEntryRequest {
6544 repository: Some(session.reference.clone()),
6545 kind: Kind::Goal as i32,
6546 id: args.goal.clone(),
6547 path: None,
6548 include_bundle: true,
6549 view: None,
6550 };
6551 let response = session.get_vault_entry(request)?;
6552 let Some(bundle) = response
6553 .entry_bundle
6554 .as_ref()
6555 .map(parse_entry_bundle)
6556 .transpose()?
6557 else {
6558 return Err(CliError::Internal(anyhow::anyhow!(
6559 "the service returned no entry bundle (include_bundle required)"
6560 )));
6561 };
6562 let entry = &bundle.entry;
6563 if args.json {
6564 let json = serde_json::json!({
6565 "name": args.goal,
6566 "content": String::from_utf8_lossy(&entry.content_bytes),
6567 "frontmatter": serde_json::from_str::<serde_json::Value>(
6568 &entry.frontmatter_json
6569 ).unwrap_or_default(),
6570 });
6571 println!("{}", serde_json::to_string_pretty(&json).unwrap());
6572 } else {
6573 print!("{}", String::from_utf8_lossy(&entry.content_bytes));
6574 }
6575 Ok(true)
6576}
6577
6578// ---------------------------------------------------------------------------
6579// vault materialize / summaries (VaultService)

Callers 1

runMethod · 0.85

Calls 4

openFunction · 0.85
as_refMethod · 0.80
cloneMethod · 0.45
get_vault_entryMethod · 0.45

Tested by

no test coverage detected