flutter_osouji
Fast parallel Flutter project cleaner that sweeps build artifacts.
Features
- ๐ Smart Detection: Automatically finds Flutter projects by scanning
pubspec.yamlfiles - โก Parallel Execution: Leverages multiple CPU cores for maximum performance
- ๐ Size Analysis: Shows how much space you'll free before and after cleaning
- ๐จ Beautiful Output: Colorful, progress-aware CLI interface with real-time scanning progress
- ๐ High Performance: ~1.9s per GB cleaned on modern SSD systems
- ๐ Progress Tracking: Real-time scanning progress with current directory and project count
Installation
# Install from pub.dev (when published)
dart pub global activate flutter_osouji
# Or run locally
dart pub get
dart bin/flutter_osouji.dart run
Usage
Basic Commands
# Clean all Flutter projects in current directory (default)
flutter_osouji run
# Clean projects in specific directory with 8 parallel jobs
flutter_osouji run ./my_projects --concurrency=8
# Dry run - see what would be cleaned without actually cleaning
flutter_osouji dry-run
# Clean with verbose output
flutter_osouji run --verbose
Expected Output
# Run mode with real-time scanning progress
$ flutter_osouji run ./dev --concurrency=8
๐ Scanning /dev/projects/app1 (0 found)...
๐ Scanning /dev/projects/app2 (1 found)...
๐ Scanning /dev/projects/app3 (2 found)...
๐ Scanning โฆ 12 Flutter projects detected
โก Cleaning (8 parallel jobs) โฆ
โ /dev/app1 784 MB โฑ 3.2 s
โ /dev/app2 1.1 GB โฑ 2.9 s
โ /dev/app3 โ ๐ซ flutter not found
โฆ
๐งน Finished in 12.7 s. Freed 8.6 GB (11 projects OK, 1 failed)
# Dry run mode
$ flutter_osouji dry-run
๐ Found 12 Flutter projects
๐ Cleanable sizes:
๐ /dev/app1 784 MB
๐ /dev/app2 1.1 GB
โฆ
๐พ Total cleanable size: 9.4 GB
Options
| Option | Description | Default |
|---|---|---|
--concurrency, -j |
Number of parallel jobs | Number of CPU cores |
--exclude |
Glob pattern to exclude directories | None |
--verbose, -v |
Verbose output | false |
Examples
# Clean with custom concurrency
flutter_osouji run --concurrency=4
# Exclude example directories
flutter_osouji run --exclude "**/example/**"
# Verbose output
flutter_osouji run --verbose
How it Works
- Discovery: Recursively scans directories for
pubspec.yamlfiles - Validation: Checks if projects contain Flutter dependencies (
flutter:key) - Analysis: Calculates size of cleanable directories (
build/,.dart_tool/, etc.) - Execution: Runs
flutter cleanin parallel across all found projects - Reporting: Shows cleaned size and execution time
Performance
- Smart Skipping: Avoids scanning
.git,node_modules, and other non-project directories - Parallel I/O: Maximizes disk throughput with concurrent operations
- Memory Efficient: Streams directory contents instead of loading everything into memory
Typical performance: ~1.9s per GB cleaned on modern SSD systems with 8+ cores.
Development
# Clone and setup
git clone <repository>
cd flutter_osouji
dart pub get
# Run tests
dart test
# Run locally
dart bin/flutter_osouji.dart run ./test_projects
dart bin/flutter_osouji.dart dry-run
# Run with global activation (for testing)
dart pub global activate --source path .
flutter_osouji run
Project Structure
flutter_osouji/
โโโ bin/
โ โโโ flutter_osouji.dart # CLI entry point
โโโ lib/
โ โโโ flutter_osouji.dart # Library exports
โ โโโ src/
โ โโโ commands/
โ โ โโโ run_cmd.dart # Run command implementation
โ โ โโโ dry_run_cmd.dart # Dry-run command implementation
โ โโโ utils/
โ โโโ dir_scan.dart # Directory scanning utilities
โ โโโ size.dart # Size calculation utilities
โ โโโ clean.dart # Flutter clean execution
โ โโโ logger.dart # Logging utilities
โโโ test/
โ โโโ flutter_osouji_test.dart # Unit tests
โโโ pubspec.yaml # Dependencies
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run
dart testto ensure tests pass - Submit a pull request
License
MIT License - see LICENSE file for details.
Libraries
- flutter_osouji
- Fast parallel Flutter project cleaner that sweeps build artifacts