Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions ast/src/lang/queries/skips/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,32 @@ pub const TEST_FILE_PATTERNS: &[&str] = &[
"test_.py",
];

pub const PRIORITY_SOURCE_DIRS: &[&str] = &[
"src", "app", "lib", "api", "routes", "routers", "controllers", "services",
"components", "pages", "pkg", "cmd", "internal", "crates", "server", "client",
"frontend", "backend", "mcp", "ast", "lsp", "shared", "cli", "web",
];

pub const ALWAYS_EXPAND_DIRS: &[&str] = &[
"src", "app", "lib", "api", "server", "client", "backend", "frontend",
];

pub const COLLAPSE_DIRS: &[&str] = &[
"migrations", "seeds", "fixtures", "tests", "test", "spec", "__tests__", "e2e",
"integration", "docs", "doc", "public", "assets", "static", ".github", ".ai",
".cursorrules", ".husky",
"dist", "build", "out", ".next", "coverage", "node_modules", "vendor", "target",
"__pycache__", "obj", ".turbo", ".cache", "storybook-static",
];

pub const PRIORITY_ROOT_FILES: &[&str] = &[
"package.json", "Cargo.toml", "README.md", "AGENTS.md", "CLAUDE.md", "Dockerfile",
"docker-compose.yml", "docker-compose.yaml", "compose.yml", "compose.yaml",
"next.config.ts", "next.config.js", "tsconfig.json", "schema.prisma", "go.mod",
"pyproject.toml", "requirements.txt", "Gemfile", "composer.json", "pom.xml",
"build.gradle", "build.gradle.kts",
];

pub fn should_skip_dir(name: &str) -> bool {
name.starts_with('.') || JUNK_DIRS.contains(&name) || TEST_DIRS.contains(&name)
}
Expand Down
39 changes: 37 additions & 2 deletions cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ pub enum Commands {
Deps(DepsArgs),
/// Show what is affected if a node changes (reverse dependency tree)
Impact(ImpactArgs),
/// Show a de-noised overview of a repository tree
Overview(OverviewArgs),
}

#[derive(Debug, Args)]
Expand Down Expand Up @@ -184,6 +186,33 @@ pub struct ImpactArgs {
pub files: Vec<String>,
}

#[derive(Debug, Args)]
pub struct OverviewArgs {
/// Repository root or directory to summarize
#[arg(value_name = "PATH")]
pub path: String,

/// Maximum number of lines to emit
#[arg(long, default_value = "80")]
pub max_lines: usize,

/// Maximum depth to expand before collapsing
#[arg(long, default_value = "4")]
pub depth: usize,

/// Filter tree to branches matching this pattern (filename/path substring)
#[arg(long)]
pub grep: Option<String>,

/// Mark files changed in the last N commits
#[arg(long)]
pub recent: Option<usize>,

/// Mark uncommitted (dirty) files
#[arg(long, action = ArgAction::SetTrue)]
pub changed: bool,
}

impl CliArgs {
pub fn parse_and_expand() -> Result<Self> {
let mut args = Self::parse();
Expand All @@ -200,7 +229,11 @@ impl CliArgs {
})
.collect();

if args.command.is_none() && args.files.is_empty() {
if args.command.is_some() {
return Ok(args);
}

if args.files.is_empty() {
eprintln!("Error: no file path provided. Run with --help for usage.");
std::process::exit(1);
}
Expand All @@ -220,7 +253,9 @@ impl CliArgs {
if let Some(Commands::Impact(_)) = &args.command {
return Ok(args);
}

if let Some(Commands::Overview(_)) = &args.command {
return Ok(args);
}
Ok(args)
}
}
Loading
Loading