use std::path::{Path, PathBuf};
use walkdir::WalkDir;
pub fn roots(home: &Path) -> Vec<(&'static str, PathBuf)> {
vec![
("claude", home.join(".claude").join("projects")),
("codex", home.join(".codex").join("sessions")),
("copilot", home.join(".copilot").join("session-state")),
("copilot", home.join(".copilot").join("logs")),
("openai", home.join(".openai")),
]
}
pub fn transcript_files(root: &Path, agent: &str) -> Vec<PathBuf> {
WalkDir::new(root)
.into_iter()
.filter_map(|e| e.ok())
.filter(|e| e.file_type().is_file())
.filter_map(|e| {
let p = e.into_path();
let ext = p.extension().and_then(|x| x.to_str()).unwrap_or("");
let name = p.file_name().and_then(|x| x.to_str()).unwrap_or("");
let keep = matches!(ext, "jsonl" | "json" | "log" | "txt")
&& !(agent == "copilot"
&& p.components().any(|c| c.as_os_str() == "pkg")
&& !name.contains("session"));
keep.then_some(p)
})
.collect()
}