resq-cleanup 0.1.10

.gitignore-aware workspace cleaner for ResQ development
resq-cleanup-0.1.10 is not a library.

resq-clean — Build Artifact Cleaner

Removes gitignored build artifacts and generated files from the monorepo while preserving negated patterns and .env files. Uses the ignore crate for full .gitignore semantics and provides an interactive TUI for visual cleanup.

Build

# Build from workspace root
cargo build --release -p resq-cleanup

Binary: target/release/resq-clean

Usage

# Interactive TUI (default)
resq-clean

# Preview what would be deleted without removing anything
resq-clean --dry-run

How It Works

  1. Walks the repository tree starting from the project root
  2. Applies .gitignore rules via the ignore crate (full support for negated patterns, nested .gitignore files, .git/info/exclude)
  3. Identifies files and directories that are gitignored
  4. Processes entries depth-first (children before parents) so directories only get removed after their contents are gone
  5. Always preserves .env files regardless of gitignore rules

Safety rules:

  • .env files are never deleted (even if gitignored) — they contain local credentials
  • Negated patterns (!important-file) keep matching files safe
  • Dry-run is the recommended first step

What Gets Deleted

Anything gitignored, which typically includes:

target/           # Rust build output
node_modules/     # npm/bun dependencies
.next/            # Next.js build cache
dist/             # TypeScript/Bun build output
build/            # C++ CMake build dirs
__pycache__/      # Python bytecode
*.pyc
.pytest_cache/
*.o *.a *.so      # C++ object files
*.nettrace        # .NET profiling traces
flamegraph.svg    # Generated profiles
scripts/out/      # Dependency cost reports

Files matching negated gitignore entries (e.g. !dist/keep-this.json) are preserved.

Flags

Flag Description
--dry-run Print what would be deleted without deleting anything
--verbose Print each file/directory as it is deleted

Example Output

$ cleanup --dry-run
Would delete: services/infrastructure-api/target/
Would delete: services/coordination-hce/node_modules/
Would delete: services/web-dashboard/.next/
Would delete: libs/cpp/resq-common/build/
Would delete: services/intelligence-pdie/__pycache__/
5 items would be removed (2.4 GB)
$ cleanup --verbose
Deleted: services/infrastructure-api/target/debug/build/
Deleted: services/infrastructure-api/target/debug/deps/
...
Deleted: services/infrastructure-api/target/
Done. Removed 847 items (2.4 GB freed)

When to Use

  • Before committing to ensure no build artifacts slip through
  • After switching branches to avoid stale build caches
  • Periodic deep clean when disk space is low

For a lighter clean, use the individual ecosystem commands:

cargo clean                          # Rust only
rm -rf services/coordination-hce/node_modules  # Node only
find . -type d -name __pycache__ -exec rm -rf {} +  # Python only