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

Function context_items

libatomic/src/daemon/services_agent.rs:628–651  ·  view source on GitHub ↗

The gather→rank→budget pipeline for one context request: the ranked ContextItems the CLI renders (md, candidates, and JSON forms).

(
        repo: &Repository,
        query: &[String],
        intent: Option<&str>,
        files: &[String],
        limit: usize,
        budget_chars: usize,
        include_body: bool,
    )

Source from the content-addressed store, hash-verified

626 /// The gather→rank→budget pipeline for one context request: the ranked
627 /// ContextItems the CLI renders (md, candidates, and JSON forms).
628 pub fn context_items(
629 repo: &Repository,
630 query: &[String],
631 intent: Option<&str>,
632 files: &[String],
633 limit: usize,
634 budget_chars: usize,
635 include_body: bool,
636 ) -> Result<Vec<ContextItem>, Status> {
637 let candidates = gather_candidates(repo, query, intent, files, limit)?;
638 let mut items = resolve_and_rank(repo, candidates, limit, include_body)?;
639 if include_body {
640 apply_budget(&mut items, budget_chars);
641 for item in &mut items {
642 let preview = item.body.as_deref().map(preview).unwrap_or_default();
643 item.preview = Some(preview);
644 }
645 } else {
646 for item in &mut items {
647 item.preview = None;
648 }
649 }
650 Ok(items)
651 }
652}
653
654pub struct VaultImpl {

Callers 1

get_vault_contextMethod · 0.85

Calls 3

gather_candidatesFunction · 0.85
resolve_and_rankFunction · 0.70
apply_budgetFunction · 0.70

Tested by

no test coverage detected