Skip to content

feat: add gitignore-aware smart scan (#13) - #14

Merged
kunjee17 merged 1 commit into
mainfrom
feat/gitignore-smart-scan
Apr 25, 2026
Merged

kunjee17 merged 1 commit into
mainfrom
feat/gitignore-smart-scan

Conversation

@kunjee17

Copy link
Copy Markdown
Owner

Summary

  • Complements language-based scanning with a .gitignore-aware pass — walks every .gitignore encountered and surfaces matching directories that exist on disk (e.g. dist/, out/, .cache/, .next/)
  • Adds a source label column to every list row (Rust, Node.js, gitignore, etc.) — the language field was stored but never rendered before
  • Language-scanner results take precedence: if a dir is found by both scanners it appears once, attributed to the language rule

Changes

  • Cargo.toml — add ignore = "0.4" for correct gitignore pattern parsing (handles negations, ** globs, directory-specific patterns)
  • src/scanner.rs — Language::GitIgnore variant; GITIGNORE_DENYLIST (.git, .vscode, .idea, .github); detect_gitignore_artifacts(); scan() uses RefCell<HashSet<PathBuf>> shared with filter_entry so gitignore-matched dirs are pruned from WalkDir traversal just like hardcoded ones
  • src/render.rs — language label span {:<12} in DarkGray; parent column trimmed 45→33 chars to keep row width stable
  • README.md — new "Gitignore-aware scan" section; missing a keybinding added

Test plan

  • cargo nextest run — 51/51 pass (6 new tests)
  • New scan_deduplicates_lang_and_gitignore_for_same_dir integration test: a Rust target/ also listed in .gitignore appears exactly once
  • Pre-commit hooks (fmt, clippy, build) pass

Closes #13

🤖 Generated with Claude Code

Walk .gitignore files during traversal and surface any matching
directories as additional deletion candidates (Language::GitIgnore,
labelled "gitignore" in the UI). Language-scanner results take
precedence — if a dir is found by both, it appears once under the
language rule.

- Add `ignore = "0.4"` dependency for correct gitignore pattern parsing
- Add `Language::GitIgnore` variant and `detect_gitignore_artifacts()`
- Thread `RefCell<HashSet<PathBuf>>` through `scan()` so gitignore-matched
  dirs are pruned from WalkDir traversal the same as hardcoded artifact dirs
- Add language/source label column to every list row (Rust, Node.js,
  gitignore, etc.) — the field was stored but never rendered before
- Denylist: .git, .vscode, .idea, .github are never surfaced
- 6 new tests including a scan-level dedup integration test (51 total)
- Update README with gitignore scan section and missing `a` keybinding

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kunjee17
kunjee17 merged commit 46a9971 into main Apr 25, 2026
1 check passed
@kunjee17
kunjee17 deleted the feat/gitignore-smart-scan branch April 25, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smart scan: discover deletable dirs via .gitignore

1 participant