use std::path::Path;
pub(crate) const DISCOVERY_ALWAYS_DIRS: &[&str] = &[".deepseek", ".cursor", ".claude", ".agents"];
const DISCOVERY_EXCLUDED_SUBDIRS: &[&str] =
&[".deepseek/snapshots", ".worktrees", ".claude/worktrees"];
const DISCOVERY_EXCLUDED_DIR_NAMES: &[&str] = &[
".git",
"target",
"node_modules",
".venv",
"venv",
"env",
"dist",
"build",
".next",
".turbo",
"coverage",
"__pycache__",
".pytest_cache",
".ruff_cache",
];
pub(crate) fn path_is_excluded_from_discovery(walk_root: &Path, path: &Path) -> bool {
DISCOVERY_EXCLUDED_SUBDIRS
.iter()
.any(|excluded| path.starts_with(walk_root.join(excluded)))
}
pub(crate) fn should_skip_unignored_discovery_entry(walk_root: &Path, path: &Path) -> bool {
if path == walk_root {
return false;
}
if path_is_excluded_from_discovery(walk_root, path) {
return true;
}
path.file_name()
.and_then(|name| name.to_str())
.is_some_and(|name| DISCOVERY_EXCLUDED_DIR_NAMES.contains(&name))
}