Skip to main content

An advanced workspace cleanup tool for developers to reclaim disk space.

Project description

🧹 fsweep

fsweep is your friendly neighborhood workspace cleanup tool! It's designed to help developers mop up bulky development artifacts and sweep away disk-space-hogging junk with ease.

Whether it's a mountain of node_modules, a forgotten venv, or stale build caches, fsweep identifies the mess and helps you reclaim your disk space in seconds.

📦 Installation

fsweep is best managed with uv. If you don't have it yet, get it from astral.sh/uv.

uv tool install fsweep

⚡ Quickstart (30 seconds)

Safe first run (dry-run, current directory):

uv run fsweep

Machine-readable dry-run:

uv run fsweep --output json

Destructive run with hard-delete:

uv run fsweep --delete --yes-delete

Destructive run with recoverable trash mode:

uv run fsweep --delete --trash --yes-delete

The default scan path is your current working directory (.).

Options

Option Shorthand Description Default
--path The directory to scan for cleanup. .
--force -f Skip final destructive confirmation prompt. False
--dry-run / --delete -d Simulate cleanup (default) or enable destructive mode. True
--trash Move matched folders to ~/.fsweep_trash instead of hard delete. False
--interactive Select matched folders before execution. False
--use-index / --no-index Enable/disable scan size cache index. True
--index-file Path to scan index JSON file. <scan_path>/.fsweep-index.json
--output Output format: table or json. table
--report Write a markdown run report to a file. unset
--config Load a TOML config file. unset
--target-folder Add custom target folder names (repeatable). []
--exclude-pattern Exclude glob patterns from scan (repeatable). []
--protected-path Protect paths from scan/deletion (repeatable). []
--yes-delete Required for destructive runs. False
--best-effort Continue and exit successfully even if deletes fail. False
--max-delete-count Max folders allowed in one destructive run. 50
--no-delete-limit Override --max-delete-count. False

⚙️ Config File (fsweep.toml)

fsweep loads config in this order (later wins):

  1. ~/.config/fsweep/fsweep.toml
  2. <scan_path>/fsweep.toml
  3. --config /path/to/fsweep.toml
  4. CLI flags

Example:

[fsweep]
target_folders = ["node_modules", "venv", "vendor_cache"]
exclude_patterns = ["**/.git/**", "**/keep/**"]
protected_paths = ["important", "../do-not-touch"]
max_delete_count = 75
no_delete_limit = false

protected_paths are resolved relative to the config file that defines them. If you want to include generic names such as build, dist, out, bin, or obj, add them explicitly with target_folders.

📤 JSON Output Contract

Use --output json for scripts/automation.

  • schema_version: currently "1"
  • summary: totals, counts, and effective action
  • items[]: per-folder path, size, action, status, and optional error
  • error responses also use JSON with error and exit_code

⚖️ Dry-run Parity Guarantee

fsweep now includes a dry-run parity test that guarantees the matched set in dry-run and destructive mode is identical for equivalent flags and path.

📈 Benchmark + Indexing

  • --use-index caches directory size calculations in <scan_path>/.fsweep-index.json to speed repeated scans.
  • Use --no-index to benchmark raw scan performance.
  • Opt-in benchmark suite:
FSWEEP_BENCHMARK=1 ./.venv/bin/python -m pytest tests/test_fsweep/test_benchmark.py -q

🧹 What does it sweep?

fsweep knows exactly which corners to sweep. It currently targets:

  • JavaScript/TypeScript: .astro, .eslintcache, .next, .nuxt, .parcel-cache, .pnpm-store, .svelte-kit, .turbo, .vercel, .vite, .wrangler, node_modules
  • Python: .ipynb_checkpoints, .mypy_cache, .nox, .pytest_cache, .ruff_cache, .rumdl_cache, .tox, .uv-cache, .venv, __pycache__, venv
  • Build/Test Artifacts: .cache, .nyc_output, coverage, htmlcov
  • JVM/.NET/Rust: .gradle
  • Infrastructure-as-Code: .aws-sam, .serverless, .terraform, .terragrunt-cache

🚀 Key Features

  • 🔍 Intelligent Scanning: Recursively hunts down common "junk" folders across your projects.
  • 💰 Size Estimation: Calculates exactly how much space you'll recover before you commit.
  • 📊 Rich Terminal UI: Presents findings in beautiful, easy-to-read tables thanks to Rich.
  • 🛡️ Safety First: Includes a robust --dry-run mode and confirmation prompts to ensure your precious source code stays safe.
  • 💨 Reach + Speed: Supports Python 3.10+ and keeps scan/deletion fast.
  • 🚫 .fsweepignore: Skip an entire directory tree by placing an empty .fsweepignore file in its root.
  • 🔧 System Command: Run fsweep system to get tips for cleaning global tool caches (like Docker or uv).

🧪 Development

Ready to help improve the fsweep? Here's how to keep the codebase as clean as your workspace.

git clone https://github.com/drew-simmons/fsweep.git
cd fsweep

uv sync

🛠️ Tech Stack

  • Python 3.10+
  • Typer: For a clean and intuitive CLI experience.
  • Rich: For beautiful terminal output, tables, and progress indicators.
  • uv: For lightning-fast dependency management.

Running Tests

uv run pytest

Exit Codes

  • 0: successful run (or dry-run simulation complete)
  • 1: safety check failure or invalid invocation
  • 2: one or more deletions failed (unless --best-effort is set)

Linting & Formatting

We use Ruff to keep things tidy:

uv run ruff check .
uv run ruff format .
uv run rumdl fmt .

Type Checking

Keep the types in check with ty:

uv run ty check .

[!TIP] uv run prek -a runs all the above linting and formatting.

🔐 Safety Model

  • Default mode is non-destructive (--dry-run).
  • Destructive mode requires --delete --yes-delete.
  • Optional --trash mode is destructive but recoverable.
  • fsweep refuses to sweep / and your home directory root.
  • Destructive runs are capped by --max-delete-count unless overridden.

📋 Release Checklist

Before tagging a release (v*), verify:

uv run pytest
uv run ruff check .
uv run ty check .
uv build
uv run --isolated --no-project --with dist/*.whl fsweep --help
uv run --isolated --no-project --with dist/*.whl python -m fsweep --help
uv run --isolated --no-project --with dist/*.tar.gz fsweep --help
uv run --isolated --no-project --with dist/*.tar.gz python -m fsweep --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fsweep-0.3.3.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fsweep-0.3.3-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file fsweep-0.3.3.tar.gz.

File metadata

  • Download URL: fsweep-0.3.3.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fsweep-0.3.3.tar.gz
Algorithm Hash digest
SHA256 666444851df10792950fe1c9fcaee077104763f5aa872bbdaabf0bf1a4d48ca0
MD5 f7db8a85a6688123a5dcd52520ccc134
BLAKE2b-256 b7ddf201c7fefb3e5edc94d5931e95be694838ed5772226b05b25790a6d5f39d

See more details on using hashes here.

File details

Details for the file fsweep-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: fsweep-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fsweep-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee9766933ce336615e0284b5fbe8931cabf487013ad1fa55acafe2086b14e7a8
MD5 591d1ce5a8391775a23e1c656927ccae
BLAKE2b-256 90a42ad3221b8c6b2eaf39b77a09636bdd317fc3c2caf908261f0c9a384f9c8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page