Skip to content

AnasNafees1802/clenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

clenv β€” CLI Environment Manager

Your CLI junk drawer, finally cleaned up.

clenv is a terminal tool that scans your system for forgotten CLI tools installed via brew, npm, pip, pipx, cargo, gem, go, apt and more β€” then lets you cleanly remove them (binaries and leftover config files) through a slick interactive TUI.

And yes, when you're done, it offers to uninstall itself too.


πŸ€” Why clenv?

As developers, our terminal is our second home. Over time, we install dozens of CLI tools and utilities to solve immediate problemsβ€”a quick formatter here, an API client there, an experimental utility somewhere else.

While it is easy to clean up desktop applications (they sit visibly in our Applications folder or Start Menu, prompting us to uninstall them when they are no longer needed), CLI tools are invisible. They hide away in global npm, pip, cargo, gem, or brew paths, quietly consuming disk space and cluttering our shell environment long after we have forgotten they even exist.

clenv was built to solve this exact problem:

  • Find the Forgotten: It aggregates and scans your package managers and system directories to surface every globally-installed CLI tool in one unified view.
  • Track Utility: It analyzes your shell history to show you which commands you actually use versus which ones have been sitting idle for months.
  • Clean the Leftovers: It removes not just the binary, but the configurations, cache files, and hidden directories (~/.config/tool, ~/.cache/tool) that standard package managers leave behind.

✨ Features

Feature Details
πŸ” Cross-manager scan brew Β· npm -g Β· pip Β· pipx Β· cargo Β· gem Β· go Β· apt/dpkg
πŸ•’ Last-used detection Checks shell history to show which tools you actually use
πŸ—‘ Config cleanup Removes ~/.config/tool, ~/.cache/tool, dotfiles
β˜‘οΈ Interactive TUI Multi-select with keyboard navigation
πŸͺ„ Self-uninstall Removes itself on exit β€” zero hypocrisy
🐍 Single language Pure Python, no compilation needed

πŸš€ Installation

Choose the installation method for your operating system:

🍎 macOS & 🐧 Linux

You can install clenv with a single command using our shell script:

curl -fsSL https://raw.githubusercontent.com/AnasNafees1802/clenv/main/install.sh | bash

Alternatively, you can install it via Python:

# via pipx (recommended β€” keeps it isolated)
pipx install git+https://github.com/AnasNafees1802/clenv.git

# via pip
pip install git+https://github.com/AnasNafees1802/clenv.git

πŸͺŸ Windows (native PowerShell / Command Prompt)

Since Windows does not natively run bash scripts, install clenv directly using your Python environment:

# via pipx (recommended β€” keeps it isolated)
pipx install git+https://github.com/AnasNafees1802/clenv.git

# via pip
pip install git+https://github.com/AnasNafees1802/clenv.git

Note: Make sure your Python Scripts directory (e.g., %USERPROFILE%\AppData\Local\Programs\Python\Python3xx\Scripts) is in your system's PATH environment variable.


⚑ Run without installing (One-liner)

If you just want to run clenv once to clean your system without a permanent installation:

pipx run --spec git+https://github.com/AnasNafees1802/clenv.git clenv

πŸ–₯ Usage

clenv

That's it. The TUI guides you through everything:

  1. Scan β€” detects all CLI tools across package managers
  2. Review β€” see tool name, source, version, and whether you've used it recently
  3. Select β€” checkbox-select the tools you want to remove
  4. Remove β€” clenv runs the right uninstall command per tool and cleans up configs
  5. Exit β€” clenv offers to remove itself, then says goodbye

πŸ“¦ What gets scanned

Manager How detected
Homebrew brew list --formula
npm npm list -g --depth=0
pipx pipx list --json
pip pip list --format=json + binary check
Cargo ~/.cargo/bin/ + .crates2.json
RubyGems gem list + binary check
Go $GOPATH/bin/
APT/dpkg dpkg -l + binary check

πŸ”’ Safety

  • Nothing is deleted without confirmation. You review a list and explicitly confirm before anything is removed.
  • Dry-run friendly. The table view shows you everything without making any changes.
  • Config removal is optional. You're asked separately whether to remove leftover config/cache files.
  • Self-uninstall is always opt-in. clenv asks at the end; you can always say no.

πŸ›  Requirements

  • Python 3.9+
  • Works on macOS and Linux
  • Windows support via WSL

🀝 Contributing

PRs welcome! Areas to improve:

  • Windows native support (choco, winget, scoop)
  • --dry-run / --json output flags
  • Fish/Nushell history parsing
  • dnf/yum scanner for RHEL-based systems

πŸ‘€ Author

Anas Nafees
πŸ”— LinkedIn Profile


πŸ“„ License

MIT β€” see LICENSE

About

🧹 Clean up your terminal's junk drawer. Scans & purges forgotten CLI tools (brew, npm, pip, cargo, etc.) + their leftover config files and cleanly uninstalls itself when done. Zero hypocrisy. ✨

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors