Skip to content

Add scan roots and an interactive directory picker to the TUI - #4

Merged
UnbreakableMJ merged 1 commit into
mainfrom
feature/tui-scan-roots-and-picker
Jun 22, 2026
Merged

Add scan roots and an interactive directory picker to the TUI#4
UnbreakableMJ merged 1 commit into
mainfrom
feature/tui-scan-roots-and-picker

Conversation

@UnbreakableMJ

@UnbreakableMJ UnbreakableMJ commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Rebased onto main after #3 merged. Base is now main; the diff is exactly this round's changes.

Summary

The TUI could only ever scan $HOMEvacuum-tui called safety::default_roots() directly and vacuum_tui::run() took no arguments, so a target outside $HOME (e.g. /spacecraft-software) was reachable only via a HOME=… hack (which also misdirects the XDG trash). This makes the TUI take roots properly and adds a runtime directory picker.

  • CLI roots. vacuum tui [PATHS]... [--root PATH]... now accepts roots (cli::TuiArgs) and resolves them through the same machinery as scan/list/clean: app::run_tui reuses resolve_roots + config::fallback_roots, so precedence is CLI --root/paths > VACUUM_ROOTS > config roots > $HOME. Bare vacuum/vacuum tui still defaults to $HOME but now also honors VACUUM_ROOTS/config. run(roots) threads the roots into both the scan and the Deleter.
  • Interactive picker. Press r to open a Clear-based centered overlay that browses the filesystem (std::fs only — no new deps) and adds/removes scan roots at runtime, re-scanning on close. Keys: j/k move · enter/l descend · h/Backspace up · space add/remove (✓ marks active roots) · d remove · esc apply. Pure helpers (read_subdirs, toggle_root) carry the logic; symlinks are not followed and unreadable dirs are skipped.
  • Safety unchanged. The picked roots become the deletion allowlist via safety::check_deletable exactly as for the CLI — the picker cannot widen the boundary, and the system-path denylist still applies.

Surface & docs

  • schema/describe advertise tui (with paths + root); stale "Defaults to $HOME" descriptions corrected to the real precedence.
  • Texinfo manual: new Interactive TUI chapter (keys + picker), builds zero-warning.
  • AGENTS.md and SKILL.md updated.

Testing

  • cargo fmt --check · cargo clippy --workspace --all-targets -- -D warnings · cargo test --workspace (44 pass — 2 new CLI parse tests, 3 new TUI unit tests) · reuse lint compliant · makeinfo zero-warning.
  • Reinstalled to ~/.cargo/bin/vacuum; verified tui --help/schema/describe from outside the repo.
  • Caveat: the interactive event loop needs a TTY and is not unit-tested — coverage lives in the pure helpers and arg parsing. The picker UI warrants a manual terminal smoke-test.

Follow-ups (out of scope)

  • Persisting picker-added roots back to the config file (one-shot per session for now).
  • Per-root scan progress for very large trees.

🤖 Generated with Claude Code

The TUI could only ever scan $HOME: vacuum-tui called safety::default_roots()
directly and vacuum_tui::run() took no arguments, so a target outside $HOME was
reachable only via a HOME-override hack (which also misdirects the XDG trash).
This threads roots into the TUI properly and adds a runtime picker.

CLI roots: 'vacuum tui [PATHS]... [--root PATH]...' now accepts roots
(cli::TuiArgs) and resolves them through the same machinery as scan/list/clean —
app::run_tui reuses resolve_roots + config::fallback_roots, so precedence is
CLI --root/paths > VACUUM_ROOTS > config 'roots' > $HOME. Bare 'vacuum'/'vacuum
tui' still defaults to $HOME but now also honors VACUUM_ROOTS/config. run(roots)
threads the roots into both the scan and the Deleter.

Interactive picker: press 'r' to open a Clear-based centered overlay that
browses the filesystem (std::fs only, no new deps) and adds/removes scan roots at
runtime, re-scanning on close. Keys: j/k move, enter/l descend, h/Backspace up,
space add/remove (✓ marks active roots), d remove, esc apply. Pure helpers
(read_subdirs, toggle_root) carry the logic and are unit-tested; symlinks are not
followed and unreadable dirs are skipped.

Safety unchanged: the picked roots become the deletion allowlist via
safety::check_deletable exactly as for the CLI — the picker cannot widen the
boundary, and the system-path denylist still applies.

Surface + docs: schema/describe advertise 'tui'; the Texinfo manual gains an
Interactive TUI chapter (keys + picker) and builds zero-warning; AGENTS.md and
SKILL.md updated. Adds 2 CLI parse tests and 3 TUI unit tests (44 total).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ force-pushed the feature/tui-scan-roots-and-picker branch from 04d6c5d to 54803b7 Compare June 22, 2026 20:12
@UnbreakableMJ
UnbreakableMJ changed the base branch from feature/empty-trash-and-config-roots to main June 22, 2026 20:12
@UnbreakableMJ
UnbreakableMJ merged commit 53dee6b into main Jun 22, 2026
2 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the feature/tui-scan-roots-and-picker branch June 22, 2026 20:17
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.

1 participant