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

Method run

atomic-cli/src/commands/vault/summaries.rs:62–101  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

60
61impl Command for Summaries {
62 fn run(&self) -> CliResult<()> {
63 // Route every form through the service layer (the previews arm
64 // computes the same enumeration + 200-char previews).
65 if crate::commands::rpc::vault_summaries(self)? {
66 return Ok(());
67 }
68
69 let root = find_repository_root()?;
70 let repo =
71 crate::commands::open_readonly_repository(&root).map_err(CliError::Repository)?;
72
73 let prefix = match &self.goal {
74 Some(name) => format!("goals/{}/", name),
75 None => "goals/".to_string(),
76 };
77
78 let entries = repo
79 .vault_list(&prefix, Some(VaultEntryType::ToolResult))
80 .map_err(CliError::Repository)?;
81
82 let mut summaries = serde_json::Map::new();
83 for meta in &entries {
84 // Extract tool_use_id from filename
85 // e.g., "goals/abc/toolu_xyz.md" -> "toolu_xyz"
86 let filename = meta.path.rsplit('/').next().unwrap_or(&meta.path);
87 let id = filename.strip_suffix(".md").unwrap_or(filename);
88
89 // Get a preview (first 200 chars of content)
90 if let Ok(Some(entry)) = repo.vault_retrieve(&meta.path) {
91 let content = String::from_utf8_lossy(&entry.content_bytes);
92 let preview: String = content.chars().take(200).collect();
93 summaries.insert(id.to_string(), serde_json::Value::String(preview));
94 }
95 }
96
97 let output = serde_json::Value::Object(summaries);
98 println!("{}", serde_json::to_string_pretty(&output).unwrap());
99
100 Ok(())
101 }
102}

Callers

nothing calls this directly

Calls 8

vault_summariesFunction · 0.85
find_repository_rootFunction · 0.85
open_readonly_repositoryFunction · 0.85
vault_listMethod · 0.80
vault_retrieveMethod · 0.80
nextMethod · 0.45
collectMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected