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,
)
| 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 | |
| 654 | pub struct VaultImpl { |
no test coverage detected