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

Function vault_context

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

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

Callers 1

runMethod · 0.85

Calls 7

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

Tested by

no test coverage detected