Skip to content

Commit c663aed

Browse files
committed
feat: rewrite bleach in bash with modular architecture and TUI
- Replaced Python codebase with a modular Bash architecture. - Added gum based TUI for interactive menu selection. - Implemented comprehensive cleanup modules: - System: APT, Docker, Logs, Temp, SSD Trim, Trash, Thumbnails. - Dev: Node (npm/pnpm/yarn), Python (deep __pycache__ scan), Build artifacts. - IDE: VS Code and JetBrains cache cleaning. - Added install.sh for one-line installation and dependencies (gum). - Implemented auto-update mechanism (weekly check + APT hook). - Added storage freed reporting session summary. - Removed legacy Python files and assets.
1 parent 7c8cec8 commit c663aed

38 files changed

+780
-1437
lines changed

CONTRIBUTING.md

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,38 @@
11
# Contributing to Bleach
22

3-
First off, thanks for taking the time to contribute! 🎉
4-
5-
The following is a set of guidelines for contributing to Bleach. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
6-
7-
## Code of Conduct
8-
9-
This project and everyone participating in it is governed by the
10-
[Bleach Code of Conduct](CODE_OF_CONDUCT.md).
11-
By participating, you are expected to uphold this code.
12-
13-
## How Can I Contribute?
14-
15-
### Reporting Bugs
16-
17-
- **Ensure the bug was not already reported** by searching on GitHub under [Issues].
18-
- If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
19-
20-
### Suggesting Enhancements
21-
22-
- Open a new issue and purely describe the feature you would like to see.
23-
- Explain why this feature would be useful to most users.
24-
25-
### Pull Requests
26-
27-
1. Fork the repo and create your branch from `main` (or `dev`).
28-
2. If you've added code that should be tested, add tests.
29-
3. Ensure the test suite passes.
30-
4. Make sure your code lints (`ruff check .`).
31-
5. Issue that pull request!
32-
33-
## Styleguides
34-
35-
### Git Commit Messages
36-
37-
- Use the present tense ("Add feature" not "Added feature")
38-
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
39-
- Limit the first line to 72 characters or less
40-
- Reference issues and pull requests liberally after the first line
41-
42-
### Python Styleguide
43-
44-
- We use [Ruff](https://beta.ruff.rs/docs/) for linting and formatting.
45-
- We use [MyPy](https://mypy-lang.org/) for static type checking.
46-
- All public functions and classes should have docstrings (Google style).
47-
48-
## Development Setup
49-
50-
1. Clone the repo
51-
2. Install dependencies: `pip install -e ".[dev]"`
52-
3. Run tests: `pytest`
53-
4. Run linter: `ruff check .`
54-
55-
Thanks! ❤️
3+
Thank you for your interest in contributing to Bleach! We have moved to a modular Bash architecture to make system maintenance accessible and transparent.
4+
5+
## Project Structure
6+
7+
- **`bleach`**: The main entry point script.
8+
- **`install.sh`**: The one-line installer and updater.
9+
- **`src/core/`**: Core libraries (`tui.sh`, `logging.sh`, `state.sh`, `self_update.sh`).
10+
- **`src/modules/`**: Standalone scripts for specific tasks.
11+
- `cleanup/`: Cleaning caches, logs, IDEs, trash, etc.
12+
- `updates/`: System updates (APT, Snap, Flatpak).
13+
- `maintenance/`: System optimization.
14+
15+
## How to Add a New Module
16+
17+
1. **Create a Script**: Add a new `.sh` file in the appropriate `src/modules/<category>/` directory.
18+
2. **Define a Function**: The script should export a function (e.g., `cleanup_myapp()`).
19+
3. **User Interaction**:
20+
- Use `gum confirm` for yes/no prompts.
21+
- Use `run_with_spinner` for long-running commands.
22+
- Use `log_info` / `log_error` for feedback.
23+
4. **Register**: Add your function to the `run_<category>_menu` function in `src/modules/<category>/main.sh`.
24+
25+
## Style Guide
26+
27+
- **Shebang**: Always use `#!/usr/bin/env bash`.
28+
- **Safety**: Use `set -Eeuo pipefail` where possible, or handle errors explicitly.
29+
- **Indentation**: 4 spaces.
30+
- **Comments**: Comment complexity; keep it simple.
31+
32+
## Pull Requests
33+
34+
1. Fork the repo.
35+
2. Create a new branch (`git checkout -b feature/my-new-feature`).
36+
3. Commit your changes.
37+
4. Push to the branch.
38+
5. Open a Pull Request.

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 42 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,67 @@
1-
# Bleach
1+
# Bleach (Bash Edition)
22

3-
**A safe, cross-platform terminal-based system cleaner.**
3+
> **Automated System Cleanup & Maintenance Tool for Linux**
4+
> _Inspired by [ChrisTitusTech/linutil](https://github.com/ChrisTitusTech/linutil)_
45
5-
![License](https://img.shields.io/badge/license-MIT-blue.svg)
6-
![Python](https://img.shields.io/badge/python-3.8+-blue.svg)
6+
Bleach is a powerful, interactive terminal utility designed to keep your Linux system clean, fast, and private. Rewritten entirely in **Bash** for maximum portability and control, it uses [gum](https://github.com/charmbracelet/gum) to provide a modern, easy-to-use interface.
77

8-
**Bleach** is a modern system maintenance tool designed for developers. It helps you keep your Linux environment fast and clean by removing unused caches, logs, and temporary files safely.
9-
10-
Unlike aggressive cleaning tools, Bleach respects your development environment—it never touches `.git` folders, source code, or active databases.
8+
![Demo](https://charm.sh/m/gum/demo.gif)
9+
*(Example of the Gum interface used in Bleach)*
1110

1211
## ✨ Features
1312

14-
- **🖥️ Modern TUI**: built with [Textual](https://textual.textualize.io/) for a beautiful, interactive terminal experience.
15-
- **🛡️ Safe by Default**: Explicitly ignores `.git` directories and critical system files.
16-
- **🐧 Cross-Distro**: Smartly detects your package manager (APT, DNF, Pacman, etc.).
17-
- **🧹 Deep Cleaning**:
18-
- **System**: Journal logs, temporary files, thumbnails.
19-
- **Dev Tools**: Docker (unused images/containers), NPM cache, Pip cache.
20-
- **Package Managers**: Clean APT/DNF/Pacman caches and autoremove unused packages.
21-
22-
## 📦 Installation
23-
24-
### Option 1: One-Line Installer (Recommended)
25-
26-
Quickly install and setup Bleach with a single command:
27-
28-
```bash
29-
curl -sL https://raw.githubusercontent.com/maruf-pfc/bleach/main/install.sh | bash
30-
```
31-
32-
### Option 2: Debian/Ubuntu (.deb)
33-
34-
Download the latest release from the [Releases Page](https://github.com/maruf-pfc/bleach/releases).
13+
- **Interactive TUI**: Navigate easy menus to select exactly what you want to clean.
14+
- **Deep Clean & Storage Recovery**:
15+
- **System**: APT (autoremove/clean), Docker (prune), Logs (vacuum), Temp files (`/tmp`), Trash.
16+
- **Dev**: Node (`npm`, `pnpm`, `yarn`), Python (deep `__pycache__` scan), Build Artifacts (`dist`, `build`).
17+
- **IDE**: Clear caches for VS Code and JetBrains IDEs.
18+
- **Privacy**: Clear user thumbnail caches.
19+
- **System Maintenance**:
20+
- **SSD Trim**: Optimize SSD performance via `fstrim`.
21+
- **Storage Reporting**: Tracks and reports exactly how much disk space was reclaimed after every session.
22+
- **Auto-Updates**:
23+
- **Self-Update**: Built-in weekly check for new versions.
24+
- **APT Hook**: Optional integration to check for Bleach updates whenever you run `sudo apt update`.
25+
- **Logging**: Detailed logs of every action kept in `~/.local/share/bleach/logs`.
26+
27+
## 🚀 Installation
28+
29+
### One-Line Installer
30+
This will install Bleach to `/opt/bleach`, create a symlink at `/usr/local/bin/bleach`, and install the `gum` dependency automatically.
3531

3632
```bash
37-
sudo dpkg -i bleach_*.deb
38-
sudo apt-get install -f # Fix dependencies if needed
33+
curl -fsSL https://raw.githubusercontent.com/yourusername/bleach/main/install.sh | sudo bash
3934
```
4035

41-
### Option 2: Python (Universal)
36+
*(Note: If you are running from a local clone, just run `sudo ./install.sh`)*
4237

43-
Install directly from the repository using `pip` (requires Python 3.8+):
44-
45-
```bash
46-
pip install git+https://github.com/maruf-pfc/bleach.git
47-
```
38+
### Prerequisites
39+
Bleach uses **[gum](https://github.com/charmbracelet/gum)** for its UI. The installer handles this for you on Debian/Ubuntu systems.
4840

49-
### Option 3: Build from Source
41+
## 🛠 Usage
5042

51-
If you want to build the `.deb` package yourself:
52-
53-
```bash
54-
git clone https://github.com/maruf-pfc/bleach.git
55-
cd bleach
56-
./build_deb.sh
57-
sudo dpkg -i build/bleach_0.1.0_all.deb
58-
```
59-
60-
## 🚀 Usage
61-
62-
Simply run `bleach` in your terminal:
43+
Run the tool anytime from your terminal:
6344

6445
```bash
6546
bleach
6647
```
6748

68-
- Navigate using **Arrow Keys** or **Mouse**.
69-
- Toggle items with **Space** or **Click**.
70-
- Run cleanup by clicking **"Run Cleanup"**.
71-
72-
### CLI Options
49+
### Modes
50+
- **System Cleanup**: Quick access to disk space recovery tools.
51+
- **System Updates**: Centralized update management for APT, Flatpak, and Snap.
52+
- **Maintenance**: Utilities for long-term health (SSD Trim, etc.).
53+
- **View Logs**: Read what Bleach has done recently.
7354

55+
### Auto-Update
56+
Bleach checks for updates weekly. You can also manually trigger a check:
7457
```bash
75-
bleach --version # Show version
76-
bleach --help # Show help message
58+
bleach --check-update
7759
```
7860

79-
## 🛠️ Development
80-
81-
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
82-
83-
1. **Clone the repo**
84-
```bash
85-
git clone https://github.com/maruf-pfc/bleach.git
86-
cd bleach
87-
```
88-
89-
2. **Install dev dependencies**
90-
```bash
91-
pip install -e ".[dev]"
92-
```
93-
94-
3. **Run Linting & Tests**
95-
```bash
96-
ruff check .
97-
mypy .
98-
pytest
99-
```
100-
101-
## 📄 License
61+
## 🤝 Contributing
10262

103-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
63+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to add new modules or improve existing ones.
10464

105-
---
65+
## 📜 License
10666

107-
<p align="center">
108-
Made with ❤️ by <a href="https://github.com/maruf-pfc">Md. Maruf Sarker</a>
109-
</p>
67+
MIT License. See [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)