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

Function intent_list

atomic-cli/src/commands/rpc.rs:1364–1414  ·  view source on GitHub ↗

`atomic intent list` over ListVaultEntries — every form. The handler computes the per-intent manifest kind and the attestation/verifies state with the same domain logic the local body uses; the CLI renders with the SAME table/JSON code (one render, two data sources). The `--kind`/`--review` filter validates client-side (an unknown kind is a clean argument error) and applies over the wire's classif

(args: &super::intent::list::IntentList)

Source from the content-addressed store, hash-verified

1362/// `--kind`/`--review` filter validates client-side (an unknown kind is
1363/// a clean argument error) and applies over the wire's classification.
1364pub fn intent_list(args: &super::intent::list::IntentList) -> CliResult<bool> {
1365 let Some(session) = Service::open()? else {
1366 return Ok(false);
1367 };
1368 // Resolve + validate the kind filter (`--review` ⇒ `--kind review`)
1369 // BEFORE the request, so the argument error never round-trips.
1370 let filter = args.kind_filter();
1371 if let Some(kind) = &filter {
1372 if !atomic_canonical::vocab::is_known_intent_kind(kind) {
1373 return Err(CliError::InvalidArgument {
1374 message: format!(
1375 "unknown intent kind '{}' (expected one of {:?})",
1376 kind,
1377 atomic_canonical::vocab::INTENT_KIND
1378 ),
1379 });
1380 }
1381 }
1382 let request = pb::ListVaultEntriesRequest {
1383 repository: Some(session.reference.clone()),
1384 kind: Some(Kind::Intent as i32),
1385 status: None,
1386 summaries_only: false,
1387 cursor: None,
1388 budget: None,
1389 view: None,
1390 identity: args.identity.clone(),
1391 path_prefix: None,
1392 entry_type: None,
1393 status_filter: None,
1394 tool_result_previews: false,
1395 sort: Some(args.sort.wire() as i32),
1396 reverse: args.reverse,
1397 };
1398 let response = session.list_vault_entries(request)?;
1399 let mut rows = response
1400 .entries
1401 .iter()
1402 .map(super::intent::list::wire_row)
1403 .collect::<Vec<_>>();
1404 if let Some(kind) = &filter {
1405 rows.retain(|row| &row.kind == kind);
1406 }
1407 // This request is unbudgeted and returns the full intent listing. Keep the
1408 // existing wire ID order for older services, then apply the new CLI sort.
1409 if args.sort == super::intent::list::IntentSort::HumanKey {
1410 super::intent::list::sort_rows(&mut rows, args.sort, args.reverse);
1411 }
1412 super::intent::list::IntentList::render(&rows, args.json);
1413 Ok(true)
1414}
1415
1416/// `atomic intent show` over GetVaultEntry — every form. The wire
1417/// carries the lift inputs (the stored entry) plus the RAW attestation

Callers 1

runMethod · 0.85

Calls 9

openFunction · 0.85
is_known_intent_kindFunction · 0.85
kind_filterMethod · 0.80
sort_rowsFunction · 0.50
renderFunction · 0.50
cloneMethod · 0.45
wireMethod · 0.45
list_vault_entriesMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected