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

Function show_recent_sessions

atomic-cli/src/commands/session.rs:134–157  ·  view source on GitHub ↗
(repo: &Repository, limit: usize, json: bool)

Source from the content-addressed store, hash-verified

132}
133
134fn show_recent_sessions(repo: &Repository, limit: usize, json: bool) -> CliResult<()> {
135 let ledgers = repo
136 .list_session_ledgers(limit)
137 .map_err(CliError::Repository)?;
138 // The per-session intent counts: prefer turn plan ids, else the vault
139 // manifest's session links.
140 let intent_map = build_session_intent_map(repo);
141 let intent_counts: Vec<usize> = ledgers
142 .iter()
143 .map(|(record, turns)| {
144 let from_turns: std::collections::HashSet<&str> =
145 turns.iter().filter_map(|t| t.plan_id.as_deref()).collect();
146 if !from_turns.is_empty() {
147 from_turns.len()
148 } else {
149 intent_map
150 .get(&record.session_id)
151 .map(|ids| ids.len())
152 .unwrap_or(0)
153 }
154 })
155 .collect();
156 render_recent_sessions(ledgers, intent_counts, json)
157}
158
159/// The listing render, over the gathered data — the repository path and the
160/// routed path (ListSessions' ledger bundle + intent counts) share it.

Callers 1

runMethod · 0.85

Calls 8

build_session_intent_mapFunction · 0.85
render_recent_sessionsFunction · 0.85
list_session_ledgersMethod · 0.80
getMethod · 0.65
collectMethod · 0.45
iterMethod · 0.45
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected