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

Function vault_list

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

`atomic vault list` over ListVaultEntries — every form. kind absent is the WHOLE-VAULT listing: every entry with its type, content size, and updated-at date, filtered by the request's path prefix and entry type; the CLI renders with the same table/JSON code the local body uses.

(args: &super::vault::list::List)

Source from the content-addressed store, hash-verified

2043/// type; the CLI renders with the same table/JSON code the local body
2044/// uses.
2045pub fn vault_list(args: &super::vault::list::List) -> CliResult<bool> {
2046 let Some(session) = Service::open()? else {
2047 return Ok(false);
2048 };
2049 // The local parse: an unknown --type value parses to no filter (the
2050 // local body lists everything), so only a PARSED type rides the wire.
2051 let type_filter = args
2052 .r#type
2053 .as_deref()
2054 .and_then(atomic_core::pristine::VaultEntryType::parse);
2055 let request = pb::ListVaultEntriesRequest {
2056 repository: Some(session.reference.clone()),
2057 kind: None,
2058 status: None,
2059 summaries_only: true,
2060 cursor: None,
2061 budget: None,
2062 view: None,
2063 identity: None,
2064 path_prefix: args.prefix.clone(),
2065 entry_type: type_filter.map(|kind| kind.to_string()),
2066 status_filter: None,
2067 tool_result_previews: false,
2068 sort: None,
2069 reverse: false,
2070 };
2071 let response = session.list_vault_entries(request)?;
2072 let rows = response
2073 .entries
2074 .iter()
2075 .map(|entry| super::vault::list::EntryRow {
2076 path: entry.vault_path.clone().unwrap_or_default(),
2077 entry_type: entry.entry_type.clone().unwrap_or_default(),
2078 size: entry.content_size.unwrap_or(0),
2079 updated_at: entry.updated_at_label.clone().unwrap_or_default(),
2080 })
2081 .collect::<Vec<_>>();
2082 super::vault::list::render_rows(&rows, args.json);
2083 Ok(true)
2084}
2085
2086/// `atomic vault show <path>` over GetVaultEntry — every form. The
2087/// wire resolves by vault-relative path (any entry type) and carries

Callers 1

runMethod · 0.85

Calls 5

render_rowsFunction · 0.85
openFunction · 0.50
cloneMethod · 0.45
list_vault_entriesMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected