Skip to content

Releases: coldsofttech/Sweepito

Release list

v0.1.0

Choose a tag to compare

@coldsofttech coldsofttech released this 25 Oct 09:07
91ad170

Sweepito 0.1.0

The first release. Sweepito clears out the caches and build leftovers that pile up in your
projects, safely, and the same way for every language you use.

Why you might want it

Every tool leaves clutter behind: Python's __pycache__, Node's node_modules and .next,
Rust's target, Gradle's build, Terraform's .terraform, and many more. It adds up to
gigabytes, and clearing it by hand means remembering what each tool leaves where. The usual
shortcuts are risky, because a blunt rm -rf build can delete a folder you committed, and
git clean -fdx removes everything untracked, including your local settings.

Sweepito takes the careful route. It only removes files that Git already ignores, never
anything you have committed or are still working on, and it looks for the signs of a real
project before it touches a folder. A build folder is only cleaned next to the files that
prove it is a build folder, never just because of its name.

What you get

  • One tool for 17 kinds of project. Python, Node.js (npm, pnpm, Yarn, Bun), Rust, Java and
    Kotlin (Maven, Gradle), .NET, Go, C and C++, PHP, Ruby, Dart and Flutter, Swift and Xcode,
    Elixir, R, Jupyter notebooks, Terraform, and everyday editor and system junk. It works out
    what is in your project on its own, including projects with several languages.
  • See before you delete. scan lists exactly what would go, with sizes and the total space
    you would get back. Nothing is removed until you say so.
  • Careful by default. Out of the box it only clears things that rebuild themselves
    instantly. Larger things, like build output, are opt-in. Heavy things, like node_modules or
    a virtual environment, only go when you ask for them by name.
  • Your own rules. Tell it about your project's own clutter in a few lines, and it joins in
    automatically.
  • Tidy after every commit, if you like. Add it as a Git hook and your project cleans itself
    up quietly in the background.
  • Friendly to read, easy to script. Clear coloured tables in your terminal, plain JSON when
    a script is reading.
  • Light and everywhere. Works on Windows, macOS and Linux, and needs only Python 3.11 or
    newer and Git.

Get started

pipx install sweepito          # or: uv tool install sweepito

Or try it without installing: uvx sweepito scan

Then, inside a project:

sweepito scan                  # what could be cleaned up? (changes nothing)
sweepito clean                 # clean it, asking first

A scan looks like this:

Project: /home/you/myapp   profiles: common, node, python, rust
                    Cleanup candidates
┌────────────────┬──────────────────┬──────────┬──────────────┐
│ Rule           │ Path             │     Size │ Risk         │
├────────────────┼──────────────────┼──────────┼──────────────┤
│ python.pytest  │ .pytest_cache/   │   3.2 KB │ safe         │
│ python.pycache │ src/__pycache__/ │  87.8 KB │ safe         │
│ node.next      │ web/.next/       │ 210.0 MB │ configurable │
│ rust.target    │ engine/target/   │   1.8 GB │ configurable │
└────────────────┴──────────────────┴──────────┴──────────────┘
4 candidate(s), 2.0 GB reclaimable.
Nothing deleted. Run 'sweepito clean' to remove them.

Choose how much to clean

What you want Command
Just the quick wins sweepito clean
Also build output (.next, target, dist, ...) sweepito clean --risk configurable
One specific thing sweepito clean --enable rust.target
Everything, including dependencies sweepito clean --risk high-impact
Only your own rules sweepito clean --risk custom
Keep something safe sweepito clean -x dist/

Every item is labelled safe, configurable or high-impact so you know what you are
agreeing to. Find out what each technology covers with sweepito profiles, and what every rule
does with sweepito rules.

Add your own cleanup

Put a sweepito.toml in your project (sweepito init writes a starter one):

[clean]
enable  = ["rust.target", "node.next"]    # also clean these by default
exclude = ["dist/"]                       # never touch this

[[rule]]                                  # your own cleanup
id = "custom.test-output"
paths = ["test-results/", "tmp/e2e/"]

Your own rules are always on, so there is no risk level to choose. Python projects can keep the
same settings in pyproject.toml under [tool.sweepito].

Clean up automatically after each commit

With the pre-commit framework:

repos:
  - repo: https://github.com/coldsofttech/Sweepito
    rev: v0.1.0
    hooks:
      - id: sweepito-clean
pre-commit install --hook-type post-commit

No pre-commit? Run sweepito hook install for a plain Git hook. It stays silent unless there is
something to report, and it can never block a commit.

You stay in control

  • Your work is protected. Files Git tracks are never deleted, and neither is your .git
    folder or anything outside the project.
  • Shortcuts are not followed. Symlinks and Windows junctions are removed as the shortcut
    they are. The folder they point to is never touched.
  • No surprises outside a Git project. Sweepito declines to clean a folder that isn't in a
    Git repository unless you explicitly allow it.
  • Mistakes are reported, not forced. If a file is locked or protected, Sweepito tells you
    and moves on, and never works around it.
  • Settings you can check. sweepito doctor shows how Sweepito sees your setup, and
    sweepito config validate checks your settings file.

Good to know

  • Sweepito cleans inside your project only. Caches that live in your home folder, such as
    ~/.cargo or Xcode's DerivedData, are not touched.
  • It can't run custom commands from your settings yet, only remove folders and files.
  • It doesn't write a log file. Results appear in your terminal, and --json gives scripts the
    details.
  • The built-in rules are cautious on purpose. If one misses something or is too eager for your
    project, we'd like to hear about it.

More help

Thank you for trying Sweepito.