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

Function build_rows

atomic-cli/src/commands/intent/list.rs:360–382  ·  view source on GitHub ↗

Build the (optionally kind-filtered) rows for the listing. Enumeration reuses [`Repository::vault_intent_list`]; the `kind` tag prefers stored frontmatter over the manifest fallback. Factored out of [`Command::run`] so the kind tag + filter are unit-testable without a global identity store. A row whose id is missing from the manifest (should not happen — the same manifest backs both) degrades to

(
    repo: &Repository,
    verifier: Option<&Verifier>,
    filter: Option<&str>,
)

Source from the content-addressed store, hash-verified

358/// the manifest (should not happen — the same manifest backs both) degrades to
359/// the default `feature`.
360fn build_rows(
361 repo: &Repository,
362 verifier: Option<&Verifier>,
363 filter: Option<&str>,
364) -> CliResult<Vec<Row>> {
365 let manifest = repo.vault_manifest().map_err(CliError::Repository)?;
366 let intents = repo.vault_intent_list(None).map_err(CliError::Repository)?;
367 let mut rows = Vec::new();
368 for info in &intents {
369 let kind = manifest
370 .intents
371 .get(&info.id)
372 .map(|s| repo.vault_intent_effective_kind(&s.vault_path, &s.kind))
373 .unwrap_or_else(|| "feature".to_string());
374 if let Some(f) = filter {
375 if kind != f {
376 continue;
377 }
378 }
379 rows.push(compute_row(repo, info, kind, verifier));
380 }
381 Ok(rows)
382}
383
384impl IntentList {
385 /// The effective `kind` filter is validated and applied client-side

Callers 2

runMethod · 0.85

Calls 6

vault_manifestMethod · 0.80
vault_intent_listMethod · 0.80
compute_rowFunction · 0.70
getMethod · 0.65
pushMethod · 0.45

Tested by 1