devdust-core 1.0.1

Core library for detecting and cleaning development project artifacts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# Dev Dust ๐Ÿงน


**Clean build artifacts from development projects to reclaim disk space.**

Dev Dust is a fast, cross-platform command-line tool written in Rust that recursively scans directories to find development projects and cleans their build artifacts (like `target/`, `node_modules/`, `__pycache__/`, etc.).

> [!WARNING]
> Dev Dust permanently deletes files and directories. Always review what will be deleted before confirming, or use `--dry-run` to preview changes safely.

## Features


- **Fast** - Written in Rust for maximum performance
- **Smart Detection** - Automatically detects 18+ project types
- **Space Saver** - Reclaim gigabytes of disk space
- **Beautiful CLI** - Colored output with clear information
- **Safe** - Confirmation prompts before deletion
- **Flexible** - Many options for customization

## Supported Project Types


<details>
<summary><strong>Click to expand full list of 18+ supported project types</strong></summary>

### Currently Supported


- [x] **Rust** - Cargo projects (`target/`, `.xwin-cache/`)
- [x] **Node.js/JavaScript** - npm, yarn, pnpm (`node_modules/`, `.next/`, `dist/`, `build/`)
- [x] **Python** - pip, venv, pytest (`__pycache__/`, `.venv/`, `.pytest_cache/`)
- [x] **.NET** - C#, F# projects (`bin/`, `obj/`)
- [x] **Unity** - Game Engine projects (`Library/`, `Temp/`, `Obj/`)
- [x] **Unreal Engine** - Game projects (`Binaries/`, `Intermediate/`, `Saved/`)
- [x] **Java Maven** - Maven projects (`target/`)
- [x] **Java/Kotlin Gradle** - Gradle projects (`build/`, `.gradle/`)
- [x] **CMake** - C/C++ projects (`build/`, `cmake-build-*/`)
- [x] **Haskell Stack** - Stack projects (`.stack-work/`)
- [x] **Scala SBT** - SBT projects (`target/`, `project/target/`)
- [x] **PHP Composer** - Composer projects (`vendor/`)
- [x] **Dart/Flutter** - Flutter projects (`build/`, `.dart_tool/`)
- [x] **Elixir** - Mix projects (`_build/`, `.elixir-tools/`)
- [x] **Swift** - Swift Package Manager (`.build/`, `.swiftpm/`)
- [x] **Zig** - Zig projects (`zig-cache/`, `zig-out/`)
- [x] **Godot** - Godot 4.x projects (`.godot/`)
- [x] **Jupyter** - Jupyter notebooks (`.ipynb_checkpoints/`)
- [x] **Go** - Go modules (`vendor/`, `bin/`)
- [x] **Ruby** - Bundler projects (`vendor/bundle/`)
- [x] **Terraform** - Infrastructure projects (`.terraform/`)
- [x] **Docker** - Build cache and volumes
- [x] **Bazel** - Build system (`bazel-*/`)

</details>

## Installation


### Quick Install (Recommended)


> [!TIP]
> Use the provided installation script for the easiest setup experience. It handles building and installing devdust automatically.

```bash
# Clone the repository

git clone https://github.com/extrise/devdust.git
cd devdust

# Run the installation script

chmod +x install.sh
./install.sh
```

The install script supports several options:

```bash
# Install to a custom directory

./install.sh --install-dir ~/.local

# Automatically install Rust if not found

./install.sh --auto-install-rust

# Run tests before installing

./install.sh --test

# Skip building (use existing binary)

./install.sh --skip-build

# Uninstall devdust

./install.sh --uninstall

# Show help

./install.sh --help
```

**Available Flags:**

| Flag | Description |
|------|-------------|
| `--install-dir DIR` | Specify custom installation directory (default: `~/.local/bin`) |
| `--auto-install-rust` | Automatically install Rust if not detected |
| `--test` | Run test suite before installing |
| `--skip-build` | Skip building, use existing binary |
| `--uninstall` | Remove devdust from system |
| `--help` | Display help information |

#### Interactive Menu Mode


Running `./install.sh` without arguments launches an interactive menu with colorful options:

- **Install devdust** - Automatically detects OS, checks/installs Rust, builds, and installs
- **Uninstall devdust** - Removes the installed binary
- **Exit** - Quit the installer

The installer includes:
- โœ… Automatic OS detection (Linux, macOS, Windows/WSL)
- โœ… Rust installation check and auto-install option
- โœ… Cross-platform support with proper PATH configuration
- โœ… Colorful, user-friendly interface

### Manual Installation


#### From Source


```bash
# Clone the repository

git clone https://github.com/extrise/devdust.git
cd devdust

# Build and install

cargo build --release
cargo install --path devdust-cli
```

#### Using Cargo


```bash
cargo install devdust
```

> [!NOTE]
> Make sure `~/.cargo/bin` is in your PATH to use the `devdust` command globally.

### Platform-Specific Binaries


Pre-built binaries are available for multiple platforms via GitHub Releases:

| Platform | Architecture | Download |
|----------|--------------|----------|
| Linux    | x86_64       | devdust-linux-x86_64 |
| Linux    | ARM64        | devdust-linux-aarch64 |
| macOS    | Intel        | devdust-macos-x86_64 |
| macOS    | Apple Silicon| devdust-macos-aarch64 |
| Windows  | x86_64       | devdust-windows-x86_64.exe |

## Usage


### Basic Usage


```bash
# Scan current directory

devdust

# Scan specific directories

devdust ~/projects ~/work

# Clean all projects without confirmation

devdust --all

# Dry run (show what would be deleted)

devdust --dry-run
```

> [!IMPORTANT]
> Always use `--dry-run` first when scanning important directories to preview what will be deleted before actually cleaning.

### Advanced Options


```bash
# Only show projects older than 30 days

devdust --older 30d

# Follow symbolic links

devdust --follow-symlinks

# Stay on same filesystem (don't cross mount points)

devdust --same-filesystem

# Quiet mode (minimal output)

devdust --quiet

# Combine options for powerful workflows

devdust ~/projects --older 7d --all --quiet
```

### Command-Line Options Reference


| Option | Short | Description |
|--------|-------|-------------|
| `--all` | `-a` | Clean all found projects without confirmation |
| `--follow-symlinks` | `-L` | Follow symbolic links during scanning |
| `--same-filesystem` | `-s` | Stay on the same filesystem (don't cross mount points) |
| `--older <TIME>` | `-o` | Only show projects older than specified time |
| `--quiet` | `-q` | Quiet mode with minimal output |
| `--dry-run` | `-n` | Show what would be deleted without actually deleting |
| `--format <FORMAT>` | `-f` | Output format: `pretty`, `plain`, or `json` |
| `--help` | `-h` | Display help information |
| `--version` | `-V` | Display version information |

### Age Filter Examples


devdust supports flexible time specifications for the `--older` flag:

| Format | Meaning | Example |
|--------|---------|---------|
| `30m` | 30 minutes | `devdust --older 30m` |
| `2h` | 2 hours | `devdust --older 2h` |
| `7d` | 7 days | `devdust --older 7d` |
| `2w` | 2 weeks | `devdust --older 2w` |
| `6M` | 6 months | `devdust --older 6M` |
| `1y` | 1 year | `devdust --older 1y` |

> [!TIP]
> Use the `--older` flag to target stale projects that haven't been modified recently, keeping your active projects untouched.

## Examples


### Interactive Cleaning


```bash
$ devdust ~/projects

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘        Dev Dust v1.0.0                โ•‘
โ•‘  Clean Development Project Artifacts  โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Scanning: /home/user/projects

Found: 5 projects with 2.3 GB of artifacts

โ— my-rust-app (Rust)
  Path: /home/user/projects/my-rust-app
  Artifacts: 1.2 GB
  Modified: 2 days ago
  โ†’ Artifact directories:
    โ€ข target
  ? Clean my-rust-app project? [y/N/a/q]: y
  โœ“ Cleaned 1.2 GB

โ— old-website (Node.js)
  Path: /home/user/projects/old-website
  Artifacts: 450.5 MB
  Modified: 3 months ago
  โ†’ Artifact directories:
    โ€ข node_modules
  ? Clean old-website project? [y/N/a/q]: y
  โœ“ Cleaned 450.5 MB

...

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Summary: 3 projects cleaned, 1.8 GB freed!
```

### Automated Cleaning


```bash
# Clean all projects older than 30 days

devdust ~/projects --older 30d --all --quiet

# Result: 12 projects cleaned, 5.4 GB freed

```

### Safe Preview Mode


```bash
# Preview what would be deleted without actually deleting

devdust ~/projects --dry-run

# Output shows potential space savings without making changes

```

### JSON Output for Scripting


```bash
# Get machine-readable output for automation

devdust ~/projects --format json --dry-run > projects.json
```

## Safety Guidelines


> [!CAUTION]
> devdust deletes files permanently. Follow these safety guidelines to avoid data loss:

### Best Practices


1. **Always test first**: Use `--dry-run` to preview changes before cleaning
2. **Start small**: Test on a single project directory before scanning large areas
3. **Check your backups**: Ensure important projects are backed up
4. **Review carefully**: Read the list of artifact directories before confirming deletion
5. **Use age filters**: Target old projects with `--older` to avoid cleaning active work

### What Gets Deleted


devdust **only** deletes recognized build artifact directories. It **never** deletes:

- [x] Source code files (`.rs`, `.js`, `.py`, etc.)
- [x] Configuration files (`Cargo.toml`, `package.json`, etc.)
- [x] Documentation and README files
- [x] Git repositories (`.git/` directories)
- [x] Any files outside artifact directories

### What Gets Cleaned


devdust **will** delete these artifact directories:

- โŒ Build outputs (`target/`, `build/`, `dist/`)
- โŒ Dependencies (`node_modules/`, `vendor/`)
- โŒ Cache directories (`__pycache__/`, `.cache/`)
- โŒ Temporary files (`Temp/`, `.tmp/`)

> [!NOTE]
> All deleted artifacts can be regenerated by rebuilding your projects. devdust never touches source code or configuration files.

### Building from Source


```bash
# Debug build (faster compilation, slower runtime)

cargo build

# Release build (optimized for performance)

cargo build --release

# Run tests

cargo test

# Run with logging enabled

RUST_LOG=debug cargo run

# Run clippy for linting

cargo clippy

# Format code

cargo fmt
```

### Running Tests


```bash
# Run all tests

cargo test

# Run tests with output

cargo test -- --nocapture

# Run specific test

cargo test test_format_size

# Run tests in release mode

cargo test --release
```

### Code Style


This project follows Rust best practices and conventions:

- [x] Comprehensive inline documentation
- [x] Clear error handling with custom error types
- [x] Modular design with separation of concerns
- [x] Extensive unit tests for core functionality
- [x] Type safety and zero-cost abstractions
- [x] Idiomatic Rust patterns

## Contributing


Contributions are welcome! Here's how you can help:

### Ways to Contribute


- ๐Ÿ› **Report bugs**: Open an issue with details about the problem
- ๐Ÿ’ก **Suggest features**: Share ideas for new functionality
- ๐Ÿ“ **Improve documentation**: Fix typos or add examples
- ๐Ÿ”ง **Submit pull requests**: Fix bugs or implement features
- โญ **Star the project**: Show your support on GitHub

### Development Workflow


1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes and add tests
4. Run tests and linting (`cargo test && cargo clippy`)
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to your branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request

> [!TIP]
> Before submitting a PR, make sure all tests pass and the code is properly formatted with `cargo fmt`.

## Troubleshooting


### Common Issues


**Issue**: `devdust: command not found`

**Solution**: Make sure `~/.cargo/bin` is in your PATH:
```bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

**Issue**: Permission denied when cleaning

**Solution**: Some artifact directories may require elevated permissions. Run with appropriate permissions or skip those projects.

**Issue**: Symbolic links not followed

**Solution**: Use the `--follow-symlinks` flag to traverse symbolic links during scanning.

## License


MIT License - See [LICENSE](https://raw.githubusercontent.com/extrise/devdust/refs/heads/main/LICENSE) file for details.

## Author


**Ext Rise**
- Email: nayanchandradas@hotmail.com
- GitHub: [extrise]https://github.com/extrise
- Repository: [github.com/extrise/devdust]https://github.com/extrise/devdust

## Acknowledgments


devdust was built from scratch with modern Rust practices, inspired by similar tools in the ecosystem. Special thanks to the Rust community for excellent libraries like `clap`, `walkdir`, and `colored`.

---

**Made with โค๏ธ and Rust** | [Report Issues]https://github.com/extrise/devdust/issues | [View Releases]https://github.com/extrise/devdust/releases