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

Function show_session_detail

atomic-cli/src/commands/session.rs:208–343  ·  view source on GitHub ↗
(repo: &Repository, session_id: &str, json: bool)

Source from the content-addressed store, hash-verified

206}
207
208fn show_session_detail(repo: &Repository, session_id: &str, json: bool) -> CliResult<()> {
209 let (record, turns) = repo
210 .get_session_ledger(session_id)
211 .map_err(CliError::Repository)?
212 .ok_or_else(|| CliError::VaultEntityNotFound {
213 kind: "session",
214 id: session_id.to_string(),
215 // No hint: there is no session-listing command to point at, and the
216 // id comes from the caller's own ledger rather than something a
217 // user would create on demand.
218 hint: None,
219 })?;
220
221 if json {
222 println!(
223 "{}",
224 serde_json::to_string_pretty(&(record, turns)).map_err(|e| {
225 CliError::Internal(anyhow::anyhow!("failed to encode session ledger: {}", e))
226 })?
227 );
228 return Ok(());
229 }
230
231 // Build turn→intent map for this session from vault paths.
232 let turn_intents = build_turn_intent_map(repo, session_id);
233
234 println!("Session {}", record.session_id);
235 println!(
236 " Status: {}",
237 if record.ended_at.is_some() {
238 "ended"
239 } else {
240 "active"
241 }
242 );
243 if let Some(view) = &record.view_name {
244 println!(" View: {}", view);
245 }
246 if let Some(parent) = &record.parent_view {
247 println!(" Parent view: {}", parent);
248 }
249 println!(" JSON: {}", record.json_path);
250 println!(" Turns: {}", record.turn_count);
251
252 // Show all intents linked to this session.
253 let all_intents: Vec<&str> = {
254 let mut ids: Vec<&str> = turn_intents.values().map(|s| s.as_str()).collect();
255 ids.sort();
256 ids.dedup();
257 ids
258 };
259 if !all_intents.is_empty() {
260 println!(" Intents: {}", all_intents.join(", "));
261 }
262
263 if let Ok(Some(head)) = repo.get_session_head(session_id) {
264 println!(" Manifest head: {}", head.to_base32());
265 if let Ok(Some(manifest)) = repo.get_session_manifest(&head) {

Callers 1

runMethod · 0.85

Calls 12

build_turn_intent_mapFunction · 0.85
todo_status_markerFunction · 0.85
single_lineFunction · 0.85
get_session_ledgerMethod · 0.80
sortMethod · 0.80
getMethod · 0.65
as_strMethod · 0.45
is_emptyMethod · 0.45
get_session_headMethod · 0.45
get_session_manifestMethod · 0.45
iterMethod · 0.45
to_base32Method · 0.45

Tested by

no test coverage detected