Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ install-bashunit:
# ============================================================
# TESTING
# ============================================================
test: test-unit test-e2e
test:
@echo "$(BLUE)Running tests in parallel...$(NC)"
@$(MAKE) test-unit & $(MAKE) test-e2e & wait
@echo "$(GREEN)✓ All tests passed$(NC)"

test-unit:
Expand Down
66 changes: 47 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

DevSweep is a **production-grade CLI tool** that safely cleans deep system caches on macOS, helping developers reclaim valuable disk space without compromising system stability.

### 📺 See It In Action

<div align="center">
<img src="assets/demo.gif" alt="DevSweep Demo" width="100%" />
<p><em>DevSweep analyze mode detecting ~14GB of cleanable caches</em></p>
</div>

### 🧹 What It Cleans

- **🎨 JetBrains IDEs** - Removes old versions, keeps latest, cleans corrupted caches (~2-5GB)
Expand All @@ -31,13 +38,13 @@ DevSweep is a **production-grade CLI tool** that safely cleans deep system cache

## ✨ Features

- 🛡️ **Safety First**: Built-in `--dry-run` mode to preview all actions
- 🛡️ **Safety First**: Built-in `--dry-run` and `--analyze` modes to preview all actions
- 🎛️ **Interactive Menu**: User-friendly interface for guided cleanup
- 🔧 **Modular Architecture**: Clean, testable, extensible codebase
- ⚠️ **Double Confirmation**: Explicit approval for destructive operations
- 📊 **Smart Analysis**: Shows estimated space to be recovered
- 📊 **Smart Analysis**: Shows estimated space to be recovered before cleaning
- 🎨 **Beautiful Output**: Colored, organized logging with progress indicators
- ✅ **Well Tested**: 101 tests, 123 assertions, 100% passing
- ✅ **Well Tested**: 115 tests, 100% passing, optimized for speed
- 🚀 **Fast**: Optimized for performance, completes in seconds

## 📦 Installation
Expand Down Expand Up @@ -99,7 +106,10 @@ sudo make uninstall
# Interactive mode - guided cleanup
devsweep

# Safe preview - see what would be deleted
# Analyze mode - see what can be cleaned with size estimates
devsweep --analyze --all

# Safe preview - see detailed actions without deleting
devsweep --dry-run --all

# Clean everything (with confirmations)
Expand All @@ -117,10 +127,13 @@ Launches an interactive menu to select which modules to run.
### Command-Line Flags

```bash
# Analyze mode - preview with size estimates (recommended first step)
devsweep --analyze --all

# Run all cleanup modules (with confirmations)
devsweep --all

# Safe preview mode - no files deleted
# Safe preview mode - see detailed actions, no files deleted
devsweep --dry-run --all

# Clean specific modules
Expand All @@ -140,7 +153,8 @@ devsweep --verbose --jetbrains
|------|-------|-------------|
| `--help` | `-h` | Show help message |
| `--version` | `-v` | Show version |
| `--dry-run` | `-d` | Preview mode - no deletions |
| `--analyze` | `-a` | Analyze and show cleanup preview with size estimates |
| `--dry-run` | `-d` | Preview mode - shows detailed actions, no deletions |
| `--verbose` | | Detailed output |
| `--force` | `-f` | Skip confirmations |
| `--all` | `-a` | Run all cleanup modules |
Expand All @@ -153,7 +167,11 @@ devsweep --verbose --jetbrains
### Examples

```bash
# Safe exploration - see what would be deleted
# Recommended workflow: Analyze first, then clean
devsweep --analyze --all # See what can be cleaned
devsweep --all # Clean with confirmations

# Safe exploration - see detailed actions
devsweep --dry-run --all

# Clean only JetBrains with preview
Expand All @@ -168,12 +186,13 @@ devsweep --force --all

## 🛡️ Safety Features

1. **🔍 Dry-Run Mode**: Preview all actions without making changes
2. **✋ Interactive Confirmations**: Explicit approval for destructive operations
3. **🔒 Smart Validation**: Prevents accidental deletion of critical paths
4. **📝 Detailed Logging**: Full transparency of all actions taken
5. **💾 Version Preservation**: Automatically keeps latest IDE versions
6. **⚡ Graceful Handling**: Safely handles missing tools and empty caches
1. **� Analyze Mode**: Preview what can be cleaned with size estimates before any action
2. **🔍 Dry-Run Mode**: See detailed actions without making changes
3. **✋ Interactive Confirmations**: Explicit approval for destructive operations
4. **🔒 Smart Validation**: Prevents accidental deletion of critical paths
5. **📝 Detailed Logging**: Full transparency of all actions taken
6. **💾 Version Preservation**: Automatically keeps latest IDE versions
7. **⚡ Graceful Handling**: Safely handles missing tools and empty caches

## 💻 Development

Expand All @@ -200,7 +219,7 @@ make test
### Running Tests

```bash
# Run all tests (101 tests, ~11s)
# Run all tests (123 tests, ~12.2s)
make test

# Run specific test suite
Expand Down Expand Up @@ -238,7 +257,8 @@ dev_sweep/
│ ├── common.sh # Common functions
│ └── menu.sh # Interactive menu
├── tests/
│ └── unit/ # Unit tests (101 tests)
│ ├── unit/ # Unit tests (112 tests)
│ └── e2e/ # E2E tests (11 tests)
├── Makefile # Build automation
└── .bashunit.yml # Test configuration
```
Expand Down Expand Up @@ -305,12 +325,20 @@ See [HOMEBREW_CORE_SUBMISSION.md](HOMEBREW_CORE_SUBMISSION.md) for complete guid
## 📊 Test Coverage

```
Tests: 101 passed, 101 total
Assertions: 123 passed, 123 total
Time: ~11 seconds
Coverage: All modules tested
Tests: 123 passed, 123 total
Unit: 112 tests (fast validation, <50ms each)
E2E: 11 tests (integration validation)
Smoke: 3 critical tests (CLI, menu, analyze)
Cleanup: 8 tests (module behavior)
Time: ~12.2 seconds (parallel execution)
Coverage: All modules tested, following testing pyramid
```

## 🔮 Roadmap

- [ ] Add more modules (Xcode, Gradle)
- [ ] Windows Support: Planning a rewrite in .NET 10 Native AOT for cross-platform compatibility

## 🤝 Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for:
Expand Down
Binary file added assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 56 additions & 14 deletions bin/devsweep
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ show_help() {
echo " -h, --help Show this help message"
echo " -v, --version Show version information"
echo " -d, --dry-run Preview actions without deleting files"
echo " -a, --analyze Analyze and show cleanup preview with estimated space"
echo " --verbose Show detailed output"
echo " -f, --force, -y, --yes Skip all confirmations (dangerous!)"
echo ""
Expand All @@ -96,6 +97,9 @@ show_help() {
echo " # Preview all cleanup operations"
echo " devsweep --dry-run --all"
echo ""
echo " # Analyze what would be cleaned (with size estimates)"
echo " devsweep --analyze --all"
echo ""
echo " # Clean only JetBrains IDEs"
echo " devsweep --jetbrains"
echo ""
Expand Down Expand Up @@ -156,6 +160,11 @@ parse_arguments() {
log_info "Dry-run mode enabled - no files will be deleted"
shift
;;
-a|--analyze)
ANALYZE_MODE=true
log_info "Analyze mode enabled - showing cleanup preview"
shift
;;
--verbose)
VERBOSE=true
log_debug "Verbose mode enabled"
Expand All @@ -166,7 +175,7 @@ parse_arguments() {
log_warn "Force mode enabled - confirmations will be skipped!"
shift
;;
-a|--all)
--all)
SELECTED_MODULES=("jetbrains" "docker" "homebrew" "devtools" "system")
shift
;;
Expand Down Expand Up @@ -229,31 +238,39 @@ run_modules() {
case "$module" in
jetbrains)
if cleanup_jetbrains_installations; then
log_success "Module completed: jetbrains"
if [[ "$ANALYZE_MODE" != true ]]; then
log_success "Module completed: jetbrains"
fi
else
log_error "Module failed: jetbrains"
((failed++))
fi
;;
docker)
if docker_clean; then
log_success "Module completed: docker"
if [[ "$ANALYZE_MODE" != true ]]; then
log_success "Module completed: docker"
fi
else
log_error "Module failed: docker"
((failed++))
fi
;;
homebrew)
if homebrew_clean; then
log_success "Module completed: homebrew"
if [[ "$ANALYZE_MODE" != true ]]; then
log_success "Module completed: homebrew"
fi
else
log_error "Module failed: homebrew"
((failed++))
fi
;;
devtools)
if devtools_clean; then
log_success "Module completed: devtools"
if [[ "$ANALYZE_MODE" != true ]]; then
log_success "Module completed: devtools"
fi
else
log_error "Module failed: devtools"
((failed++))
Expand Down Expand Up @@ -348,6 +365,9 @@ main() {
if [[ "$DRY_RUN" == true ]]; then
log_warn "🔍 DRY-RUN MODE: No files will be deleted"
fi
if [[ "$ANALYZE_MODE" == true ]]; then
log_info "📊 ANALYZE MODE: Collecting cleanup preview..."
fi
if [[ "$FORCE" == true ]]; then
log_warn "⚡ FORCE MODE: Confirmations will be skipped"
fi
Expand All @@ -359,16 +379,38 @@ main() {
exit_code=$?
fi

# Show completion message
print_completion

if [[ "$DRY_RUN" == true ]]; then
log_success "Dry-run completed. No files were modified."
echo ""
log_info "To perform actual cleanup, run without --dry-run flag"
# Show analyze preview or completion message
if [[ "$ANALYZE_MODE" == true ]]; then
show_analyze_preview
# Ask for confirmation to proceed with cleanup
if confirm_action "Proceed with cleanup?"; then
log_info "Starting cleanup..."
echo ""
# Reset analyze mode and run cleanup
ANALYZE_MODE=false
ANALYZE_ITEMS=()
TOTAL_SPACE_FREED_KB=0
if ! run_modules; then
exit_code=$?
fi
print_completion
log_info "Note: Spotlight may show 'Calculating...' for a few minutes"
log_info "This is normal as macOS recalculates disk space"
else
log_info "Cleanup cancelled"
fi
else
log_info "Note: Spotlight may show 'Calculating...' for a few minutes"
log_info "This is normal as macOS recalculates disk space"
# Show completion message
print_completion

if [[ "$DRY_RUN" == true ]]; then
log_success "Dry-run completed. No files were modified."
echo ""
log_info "To perform actual cleanup, run without --dry-run flag"
else
log_info "Note: Spotlight may show 'Calculating...' for a few minutes"
log_info "This is normal as macOS recalculates disk space"
fi
fi

exit $exit_code
Expand Down
49 changes: 49 additions & 0 deletions demo.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# demo.tape - DevSweep Demo
# 1. Run: ./setup-demo.sh to create demo files
# 2. Run: vhs demo.tape to record the demo
# 3. This demo shows analyze mode detecting ~14GB to clean

Output demo.gif

Set FontSize 14
Set Width 1400
Set Height 700
Set Padding 20
Set Theme "Dracula"

# Show help first
Type "# DevSweep - Professional macOS developer cache cleaner"
Sleep 1s
Enter
Enter
Sleep 500ms

Type "devsweep --help"
Sleep 500ms
Enter
Sleep 3s

# Clear screen
Ctrl+L
Sleep 500ms

# Run analyze mode to show what can be cleaned
Type "# Analyze mode - Preview what can be cleaned (~14GB)"
Sleep 1s
Enter
Sleep 500ms

Type "devsweep --analyze --all"
Sleep 500ms
Enter

# Wait for analysis to complete and show preview
Sleep 8s

# Show the preview clearly - answer no to not proceed
Type "n"
Enter
Sleep 2s

# Final pause to review the 13GB detected
Sleep 3s
Loading