devsweep-cli 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- devsweep/__init__.py +5 -0
- devsweep/__main__.py +6 -0
- devsweep/cleaner.py +247 -0
- devsweep/cli.py +581 -0
- devsweep/display.py +909 -0
- devsweep/docker.py +307 -0
- devsweep/ignore.py +272 -0
- devsweep/models.py +132 -0
- devsweep/scanner.py +418 -0
- devsweep/utils.py +58 -0
- devsweep_cli-0.2.0.dist-info/METADATA +249 -0
- devsweep_cli-0.2.0.dist-info/RECORD +16 -0
- devsweep_cli-0.2.0.dist-info/WHEEL +5 -0
- devsweep_cli-0.2.0.dist-info/entry_points.txt +2 -0
- devsweep_cli-0.2.0.dist-info/licenses/LICENSE +21 -0
- devsweep_cli-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devsweep-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: CLI tool to scan and safely clean developer build artifacts, dependencies, caches, and unused Docker resources.
|
|
5
|
+
Author-email: Vũ Lộc <vuloc668165@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/vuloc080611/DevSweep
|
|
8
|
+
Project-URL: Repository, https://github.com/vuloc080611/DevSweep
|
|
9
|
+
Project-URL: Issues, https://github.com/vuloc080611/DevSweep/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/vuloc080611/DevSweep/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: cli,cleanup,developer-tools,disk-space,node_modules,docker,typer,rich
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: System :: Filesystems
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: rich>=13.7.0
|
|
29
|
+
Requires-Dist: typer>=0.12.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.11.0; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# 🧹 DevSweep
|
|
38
|
+
|
|
39
|
+
[](https://github.com/vuloc080611/DevSweep/actions/workflows/ci.yml)
|
|
40
|
+
[](CHANGELOG.md)
|
|
41
|
+
[](https://www.python.org/)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
[](https://typer.tiangolo.com/)
|
|
44
|
+
|
|
45
|
+
**DevSweep** is a fast, safe, cross-platform Python CLI that scans your workspaces and reclaims gigabytes of disk space from forgotten build artifacts, dependency folders (`node_modules`, `.venv`, `target`, `.next`, `__pycache__`, …), and unused Docker resources — with built-in dry-run previews, interactive selection, `.devsweepignore` rules, and strict safety guardrails.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Demo
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<img src="assets/demo.gif" alt="DevSweep CLI Demo" width="760" />
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
| Category | Capabilities |
|
|
60
|
+
| :--- | :--- |
|
|
61
|
+
| **Multi-ecosystem Detection** | Automatically detects `node_modules`, `.venv`, `venv`, virtualenv `.env` (verified by markers so secret `.env` files are never touched), `target` (Rust/Java), `dist`, `build`, `__pycache__`, `.next`, `.nuxt`, `coverage`, `.pytest_cache`, `.gradle`, `.turbo`, `.parcel-cache`, `.mypy_cache`, and `.ruff_cache` |
|
|
62
|
+
| **Fast & Accurate Scanner** | Streaming `os.scandir()` traversal, automatic pruning inside matched folders (prevents nested double-counting), symlink & Windows NTFS junction safety, multi-path scanning, `--max-depth`, and smart `devsweep scan ~` |
|
|
63
|
+
| **Safe Deletion Engine** | Multi-layer protection blocking filesystem roots (`/`, `C:\`, `D:\`), user `$HOME`, and OS system trees (`C:\Windows`, `/usr`, `/etc`, `/System`, …); enforces allowed cleanup scope and handles `PermissionError`/`OSError` gracefully |
|
|
64
|
+
| **Interactive & Dry-Run Modes** | `--dry-run` preview banner, interactive checkbox selector (`1,3-5`, `all`, `none`, `done`, `q`), explicit confirmation prompt (default `No`), and `--yes` for automation |
|
|
65
|
+
| **Ignore System** | Full `.gitignore`-style `.devsweepignore` and `--ignore-file` support with strict precedence: `CLI --exclude` > `.devsweepignore` > default ignores (`.git`, `.idea`, `.vscode`, `.hg`, `.svn`) |
|
|
66
|
+
| **Docker Cleanup** | `devsweep docker scan` and `devsweep docker clean` for dangling images, stopped containers, unused volumes, and build cache — never force-removes in-use images or running containers |
|
|
67
|
+
| **Polished Terminal UI** | Color-coded Rich tables, progress spinners, multi-path progress bars, summary panels, helpful error hints, and `--no-color` ASCII-safe output for CI/logs |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
### Requirements
|
|
74
|
+
- **Python 3.10+**
|
|
75
|
+
- Optional: **Docker CLI** (only required for `devsweep docker ...` commands)
|
|
76
|
+
|
|
77
|
+
### Install from PyPI *(once published)*
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install devsweep-cli
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Standard Install (from source)
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
git clone https://github.com/vuloc080611/DevSweep.git
|
|
87
|
+
cd DevSweep
|
|
88
|
+
pip install .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Editable / Development Install
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/vuloc080611/DevSweep.git
|
|
95
|
+
cd DevSweep
|
|
96
|
+
pip install -e ".[dev]"
|
|
97
|
+
# or alternatively:
|
|
98
|
+
pip install -e .
|
|
99
|
+
pip install -r requirements-dev.txt
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Verify Installation
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
devsweep --version
|
|
106
|
+
devsweep --help
|
|
107
|
+
# Also works via Python module execution:
|
|
108
|
+
python -m devsweep --version
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> **Windows PATH note:** If `pip` installs into user site-packages (`%APPDATA%\Python\Python3xx\Scripts`) and prints a PATH warning, either add that `Scripts` folder to your system `PATH`, install inside a virtual environment, or run via `python -m devsweep`.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Usage Examples
|
|
116
|
+
|
|
117
|
+
### Scanning Directories
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Scan the current directory
|
|
121
|
+
devsweep scan
|
|
122
|
+
|
|
123
|
+
# Scan one or more target directories
|
|
124
|
+
devsweep scan ./frontend ./backend
|
|
125
|
+
|
|
126
|
+
# Limit traversal depth and exclude specific directories or patterns
|
|
127
|
+
devsweep scan ~/projects --max-depth 2 --exclude "*backup*" --exclude vendor
|
|
128
|
+
|
|
129
|
+
# Smart home directory scan (focuses on common workspace folders like Projects, workspace, Desktop, Documents)
|
|
130
|
+
devsweep scan ~
|
|
131
|
+
|
|
132
|
+
# Preview scan with dry-run notice or plain text output (CI-friendly)
|
|
133
|
+
devsweep scan ./projects --dry-run --no-color
|
|
134
|
+
|
|
135
|
+
# Machine-readable JSON output for jq, CI pipelines, or dashboards
|
|
136
|
+
devsweep scan ./projects --json | jq '.total_reclaimable_bytes'
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Cleaning Folders Safely
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Always preview first with --dry-run
|
|
143
|
+
devsweep clean ./projects --dry-run
|
|
144
|
+
|
|
145
|
+
# Interactively toggle folders to delete (supports 1,3-5, all, none, done, q)
|
|
146
|
+
devsweep clean ./projects --interactive
|
|
147
|
+
|
|
148
|
+
# Clean multiple paths, keeping specific directories excluded
|
|
149
|
+
devsweep clean ./web ./api --exclude legacy --interactive
|
|
150
|
+
|
|
151
|
+
# Non-interactive cleanup (skips confirmation prompt)
|
|
152
|
+
devsweep clean ./projects --yes
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Cleaning Unused Docker Resources
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# List dangling images, stopped containers, unused volumes, and reclaimable build cache
|
|
159
|
+
devsweep docker scan
|
|
160
|
+
|
|
161
|
+
# Export unused Docker resources as JSON
|
|
162
|
+
devsweep docker scan --json
|
|
163
|
+
|
|
164
|
+
# Preview Docker cleanup without removing anything
|
|
165
|
+
devsweep docker clean --dry-run
|
|
166
|
+
|
|
167
|
+
# Interactively choose which unused Docker resources to remove
|
|
168
|
+
devsweep docker clean --interactive
|
|
169
|
+
|
|
170
|
+
# Remove all discovered unused Docker resources without prompting
|
|
171
|
+
devsweep docker clean --yes
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
> **Safety guarantee:** `devsweep docker clean` removes stopped containers before dangling images/volumes and never uses `--force` on images or containers, so active containers and in-use images are never touched.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Commands & Flags Reference
|
|
179
|
+
|
|
180
|
+
### Global Options
|
|
181
|
+
|
|
182
|
+
| Option | Short | Description |
|
|
183
|
+
| :--- | :---: | :--- |
|
|
184
|
+
| `--version` | `-V` | Show DevSweep version and exit |
|
|
185
|
+
| `--no-color` | | Disable colored output and Unicode emojis |
|
|
186
|
+
| `--help` | | Show help message and usage examples |
|
|
187
|
+
|
|
188
|
+
### Commands
|
|
189
|
+
|
|
190
|
+
| Command | Description |
|
|
191
|
+
| :--- | :--- |
|
|
192
|
+
| `devsweep scan [PATHS...]` | Scan one or more directories and display cleanable folders |
|
|
193
|
+
| `devsweep clean [PATHS...]` | Scan and safely delete cleanable folders |
|
|
194
|
+
| `devsweep docker scan` | List unused Docker images, containers, volumes, and build cache |
|
|
195
|
+
| `devsweep docker clean` | Safely remove unused Docker resources |
|
|
196
|
+
| `devsweep version` | Display the installed DevSweep version |
|
|
197
|
+
|
|
198
|
+
### `scan` & `clean` Options
|
|
199
|
+
|
|
200
|
+
| Option | Short | Commands | Description |
|
|
201
|
+
| :--- | :---: | :--- | :--- |
|
|
202
|
+
| `--max-depth INT` | `-d` | `scan`, `clean` | Maximum directory depth to descend (`0` scans nothing inside root) |
|
|
203
|
+
| `--exclude PATTERN` | `-e` | `scan`, `clean` | Exclude matching folder name or relative glob pattern (repeatable) |
|
|
204
|
+
| `--ignore-file PATH` | | `scan`, `clean` | Use a custom ignore file instead of auto-discovered `.devsweepignore` |
|
|
205
|
+
| `--dry-run` | `-n` | `scan`, `clean`, `docker` | Show what would be targeted without deleting anything |
|
|
206
|
+
| `--json` | | `scan`, `docker scan` | Emit pure machine-readable JSON (suppresses spinners and banners) |
|
|
207
|
+
| `--interactive` | `-i` | `clean`, `docker clean` | Interactively select items (`1,3-5`, `all`, `none`, `done`, `q`) |
|
|
208
|
+
| `--yes` | `-y` | `clean`, `docker clean` | Skip confirmation prompt before deletion |
|
|
209
|
+
| `--no-color` | | all | Disable ANSI color output |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Ignore System (`.devsweepignore`)
|
|
214
|
+
|
|
215
|
+
Place a `.devsweepignore` file inside your workspace root (or pass `--ignore-file <path>`) using standard `.gitignore` syntax:
|
|
216
|
+
|
|
217
|
+
```gitignore
|
|
218
|
+
# Comments start with '#'
|
|
219
|
+
archive/
|
|
220
|
+
vendor/
|
|
221
|
+
|
|
222
|
+
# Anchor to scan root only (ignores ./dist but still scans ./apps/web/dist)
|
|
223
|
+
/dist
|
|
224
|
+
|
|
225
|
+
# Wildcards and double-star paths
|
|
226
|
+
*backup*
|
|
227
|
+
packages/**/legacy
|
|
228
|
+
|
|
229
|
+
# Negation ('!') overrides earlier rules or default ignores
|
|
230
|
+
!important_backup
|
|
231
|
+
!.vscode
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Precedence Order (Highest to Lowest)
|
|
235
|
+
1. **CLI `--exclude` flags** (always win, cannot be overridden by ignore files)
|
|
236
|
+
2. **`--ignore-file` or `.devsweepignore`** (supports `!` negation to re-include paths)
|
|
237
|
+
3. **Default ignores** (`.git`, `.idea`, `.vscode`, `.hg`, `.svn`)
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Contributing
|
|
242
|
+
|
|
243
|
+
Contributions, bug reports, and feature ideas are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, test commands, and commit guidelines, and [SECURITY.md](SECURITY.md) for reporting safety or security issues.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
Released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
devsweep/__init__.py,sha256=yYbTYUD4VFBbMmc0ge_dqXEqdJli0bjiytl7XHvhax8,110
|
|
2
|
+
devsweep/__main__.py,sha256=rZzUGCKaeUvuHGX-PCXVGF1XXpcKYwVihr4UbmrCi6c,123
|
|
3
|
+
devsweep/cleaner.py,sha256=H6rsuBfvDAXgcaF3MM0gV7YTqfnEYEjvdAT8TYjPGao,8089
|
|
4
|
+
devsweep/cli.py,sha256=ZlhFApVb6oj5naP-riJO-e0Gv3jnQ8fvNgdY6Abb7-0,17329
|
|
5
|
+
devsweep/display.py,sha256=rirrPBMlBfXTgRRvIDd0e4seBB6p7u_Rq82YBIccqXY,31289
|
|
6
|
+
devsweep/docker.py,sha256=uOpfO2wKZrOzK15FeUmhvUvhgX3uGz_80SP_moec3q4,10606
|
|
7
|
+
devsweep/ignore.py,sha256=nlihvKqbnBs8cIZm8z2f5ru-W3lqecaPzMJ_C6x0P3o,8396
|
|
8
|
+
devsweep/models.py,sha256=wYo1s2m26OXDh9GLDnfZW0uInEV5jkQ0TH02yxYoLjo,3576
|
|
9
|
+
devsweep/scanner.py,sha256=D2UUZri5lR_0f8UC_cgoWs9SL1HLyan3H_B2BTu03Ew,14236
|
|
10
|
+
devsweep/utils.py,sha256=fd84aezeeOiDJAyLRSO11t4d50iyY0cArajoT5297Dw,1802
|
|
11
|
+
devsweep_cli-0.2.0.dist-info/licenses/LICENSE,sha256=xm-g4QAwlis2Hk_Ty6lbLlFZoIUYbHS7qyQCkOYFgWU,1077
|
|
12
|
+
devsweep_cli-0.2.0.dist-info/METADATA,sha256=IRCYyeechAS4cWK3cCfylKmv68H_uEfiBqK9TyRbh9I,9929
|
|
13
|
+
devsweep_cli-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
14
|
+
devsweep_cli-0.2.0.dist-info/entry_points.txt,sha256=XzQbEzG13xzjjN-HUeIqI0jIsHTogzvjOueKW4v40PA,46
|
|
15
|
+
devsweep_cli-0.2.0.dist-info/top_level.txt,sha256=_5R0zY5mBLfU9gM9C44Jh2VOZht9Xa3IEzrgQe4HsMs,9
|
|
16
|
+
devsweep_cli-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vuloc0981925341-boop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
devsweep
|