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

Function vault_context

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

`atomic vault context` over GetVaultContext — every form. The gather+rank (seeds from query terms, `--intent`, `--files`; the memory-body scan; neighbor bonuses; recency; the body budget) runs in the handler; the CLI renders the SAME markdown/JSON contracts with the SAME render functions the local body uses (one render, two data `atomic vault context` over GetVaultContext — every form. The gather+

(args: &super::vault::context::Context)

Source from the content-addressed store, hash-verified

1844/// the SAME render functions the local body uses (one render, two data
1845/// sources).
1846pub fn vault_context(args: &super::vault::context::Context) -> CliResult<bool> {
1847 use super::vault::context::{
1848 render_candidates_json, render_candidates_md, render_json, render_md, wire_items,
1849 };
1850 let session = match Service::open()? {
1851 Some(session) => session,
1852 None => return Ok(false),
1853 };
1854 let as_json = args.json || args.format.eq_ignore_ascii_case("json");
1855 let request = pb::GetVaultContextRequest {
1856 repository: Some(session.reference.clone()),
1857 max_entries: Some(args.limit as u32),
1858 kinds: Vec::new(),
1859 query: args.query.clone(),
1860 intent: args.intent.clone(),
1861 files: args.files.clone(),
1862 budget_chars: Some(args.budget_chars as u32),
1863 include_body: Some(!args.candidates_only),
1864 view: None,
1865 };
1866 let response = session.get_vault_context(request)?;
1867 let items = wire_items(&response.context);
1868
1869 if args.candidates_only {
1870 if as_json {
1871 println!("{}", render_candidates_json(&items, args, args.limit));
1872 } else {
1873 let md = render_candidates_md(&items);
1874 if !md.is_empty() {
1875 print!("{md}");
1876 }
1877 }
1878 return Ok(true);
1879 }
1880
1881 let md = render_md(&items);
1882 if as_json {
1883 println!("{}", render_json(&items, &md, args, args.limit));
1884 } else if !md.is_empty() {
1885 print!("{md}");
1886 }
1887 Ok(true)
1888}
1889
1890/// `atomic agent attest` over ListAttestations — every form. The
1891/// listing rides the view filter as before; `--hash <prefix>` resolves

Callers 1

runMethod · 0.85

Calls 7

openFunction · 0.85
wire_itemsFunction · 0.85
render_candidates_mdFunction · 0.85
render_mdFunction · 0.85
cloneMethod · 0.45
get_vault_contextMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected