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

Method list_all

atomic-cli/src/commands/agent/attest.rs:392–466  ·  view source on GitHub ↗

List all attestations in the repository.

(&self, repo: &Repository)

Source from the content-addressed store, hash-verified

390
391 /// List all attestations in the repository.
392 fn list_all(&self, repo: &Repository) -> CliResult<()> {
393 let mut attestations: Vec<(Hash, Attestation)> = Vec::new();
394
395 for result in repo.change_store().iter_attestations() {
396 let hash = match result {
397 Ok(h) => h,
398 Err(e) => {
399 print_warning(&format!("Skipping corrupt attestation: {}", e));
400 continue;
401 }
402 };
403
404 match repo.load_attestation(&hash) {
405 Ok(attest) => attestations.push((hash, attest)),
406 Err(e) => {
407 print_warning(&format!(
408 "Failed to load attestation {}: {}",
409 format_hash(&hash, false),
410 e
411 ));
412 }
413 }
414 }
415
416 if attestations.is_empty() {
417 println!("No attestations in this repository.");
418 println!();
419 println!("Attestations are created when AI agent sessions end.");
420 println!("They capture cost, token usage, and model breakdown.");
421 return Ok(());
422 }
423
424 // Sort by timestamp descending (newest first)
425 attestations.sort_by_key(|a| std::cmp::Reverse(a.1.timestamp));
426
427 println!(
428 "{} attestation{}",
429 attestations.len(),
430 if attestations.len() == 1 { "" } else { "s" }
431 );
432 println!();
433
434 for (hash, attest) in &attestations {
435 self.print_summary(hash, attest);
436
437 if self.verbose {
438 self.print_models(attest);
439 println!();
440 }
441 }
442
443 let total_changes: usize = attestations.iter().map(|(_, a)| a.change_count()).sum();
444 let total_cost: f64 = attestations.iter().map(|(_, a)| a.cost_usd).sum();
445 let total_tokens: u64 = attestations.iter().map(|(_, a)| a.total_tokens()).sum();
446
447 println!("──────────────────────────────────────────");
448 let mut summary = format!(
449 "{} {} covered",

Callers 1

runMethod · 0.80

Calls 11

print_warningFunction · 0.85
iter_attestationsMethod · 0.80
print_summaryMethod · 0.80
print_modelsMethod · 0.80
change_storeMethod · 0.45
load_attestationMethod · 0.45
pushMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45
change_countMethod · 0.45
total_tokensMethod · 0.45

Tested by

no test coverage detected