@blockingmachine/cli v1.0.0-beta.6
Blockingmachine
Lists Last Updated: April 26, 2025
Description
Blockingmachine CLI is a powerful command-line tool that streamlines the process of collecting, analyzing, and exporting ad-blocking and privacy filter lists. It aggregates rules from multiple trusted sources, intelligently deduplicates entries, categorizes blocking rules, and exports to various formats including AdGuard, hosts files, dnsmasq, and more. Designed for flexibility, the tool allows for custom filtering by category, priority, and tags, enabling both automated workflows and personalized filter list creation.
Related Projects
- Blockingmachine Core - Core functionality library
- Blockingmachine Desktop - Desktop application for managing filter lists
Quick Start
# Install globally
npm install -g @blockingmachine/cli
# Create a new configuration
blockingmachine init
# Import and export rules
blockingmachine import
blockingmachine export adguardTimeline
Current Release (v1.0.0-beta.3)
- ๐ Full integration with @blockingmachine/core
- ๐ช TypeScript support
- ๐ฅ Multiple source list support
- ๐ Rule categorization and filtering
- โก Multi-format export capabilities
- โ Advanced configuration options
- ๐ Bug fixes and performance improvements
Upcoming Features (v1.0.0)
- ๐ Enhanced statistics and reporting
- ๐ Improved pattern matching and rule validation
- ๐ Support for additional export formats
- ๐ Better network resilience and retry logic
- ๐ฏ Rule optimization commands
- ๐ฆ Smaller installation footprint
- ๐งช Extended test coverage
Future Roadmap (v1.x+)
- ๐ Streaming processing for large rule sets
- ๐ Internationalization support
- ๐ Enhanced security features
- ๐ Performance optimizations
- ๐งฉ Plugin system for custom rule processors
- ๐ค Third-party service integrations
- ๐ ๏ธ Advanced debugging and troubleshooting tools
Version History
1.0.0-beta.3 (Current)
- Added parallel processing capabilities
- Fixed MongoDB connection handling issues
- Added more comprehensive export formats
- Improved command-line argument parsing
- Enhanced logging and error reporting
- Fixed NPM packaging issues
1.0.0-beta.2
- Added support for multiple export formats
- Enhanced configuration options
- Improved rule categorization
- Fixed dependency resolution issues
- Optimized database operations
1.0.0-beta.1
- Initial public release
- Core commands (import/export) stable
- Basic documentation
- Essential features implemented
0.9.0 (Internal)
- Feature complete CLI
- Internal testing and validation
- Performance optimization
- Documentation drafting
0.5.0 (Development)
- Command structure implementation
- Basic feature development
- Initial testing setup
Features
Enhanced Rule Processing
- Smart Rule Classification: Automatically detects and categorizes rules:
- Domain-based blocking rules
- Regular expression patterns
- Exception rules
- Cosmetic filters
- Mobile-Specific Detection: Identifies mobile-specific rules using patterns:
- App store URLs
- Mobile domains
- App-specific patterns
- Platform-specific rules
Advanced Filtering
- Category-Based Management:
blockingmachine export --categories privacy,security blockingmachine export --exclude advertising,gaming - Priority System:
blockingmachine export --min-priority 80 - Tag-Based Filtering:
blockingmachine export --tags mobile,trusted
Multiple Export Formats
- DNS-Based Formats:
- Hosts files (
hosts) - dnsmasq configuration (
dnsmasq) - Unbound configuration (
unbound) - BIND configuration (
bind)
- Hosts files (
- Browser-Based Formats:
- AdGuard (
adguard) - ABP format (
abp)
- AdGuard (
- Application-Specific:
- Privoxy rules (
privoxy) - Shadowrocket configuration (
shadowrocket)
- Privoxy rules (
Database Management
# Import and process rules
blockingmachine import
# View database statistics
blockingmachine view
blockingmachine view --sample 10
# Run database migrations
blockingmachine migrate
# Clean up and maintenance
blockingmachine cleanup
blockingmachine cleanup --drop # Development onlyConfiguration
{
"mongodb": {
"uri": "mongodb://localhost:27017/blockingmachine",
"options": {
"maxPoolSize": 10
}
},
"output": {
"directory": "./filters/output"
},
"sources": [
{
"name": "EasyPrivacy",
"url": "https://easylist.to/easylist/easyprivacy.txt",
"category": "privacy",
"enabled": true,
"priority": 90
}
]
}Logging and Debugging
- Detailed Logging:
blockingmachine --debug import - Log Files:
logs/error.log: Error-level messageslogs/combined.log: All log levels
Rule Processing Pipeline
graph TD
A[Download Rules] --> B[Parse & Classify]
B --> C[Apply Modifiers]
C --> D[Deduplication]
D --> E[Store in MongoDB]
E --> F[Export Filters]Performance Optimization
- Caching System:
# Enable caching in .blockingmachinerc.json { "caching": { "enabled": true, "ttl": 3600, "maxSize": "100mb" } } - Batch Processing: Rules are processed in configurable batch sizes
- Parallel Processing: Multi-threaded rule processing for better performance
Error Handling
# View detailed error logs
blockingmachine --debug import
# Check rule validation errors
blockingmachine validate --fixContributing
Setting up the development environment:
# Fork and clone the repository git clone https://github.com/yourusername/blockingmachine-cli.git # Install dependencies cd blockingmachine npm install # Run tests npm test # Start in development mode npm run devRunning Tests:
# Run all tests npm test # Run specific test suite npm test -- --grep "rule processing" # Run with coverage npm run test:coverage
Environment Variables
# Development mode
NODE_ENV=development
# MongoDB configuration
MONGODB_URI=mongodb://localhost:27017/blockingmachine
MONGODB_MAX_POOL_SIZE=10
# Logging
LOG_LEVEL=debug
LOG_FORMAT=pretty
# Feature flags
ENABLE_CACHING=true
ENABLE_PARALLEL_PROCESSING=trueTroubleshooting
Common Issues
MongoDB Connection Issues
# Check MongoDB status brew services list | grep mongodb # Start MongoDB if needed brew services start mongodb-communityPermission Issues
# Fix output directory permissions chmod 755 ./filters/outputMemory Issues
# Increase Node.js memory limit export NODE_OPTIONS="--max-old-space-size=4096"
API Documentation
Command Context
interface CommandContext {
config: AppConfig;
debug: boolean;
logger: Logger;
}Export Options
interface ExportOptions {
formats?: SupportedFormat[];
categories?: string[];
excludeCategories?: string[];
minPriority?: number;
tags?: string[];
outputPath?: string;
}Security
- All downloaded content is validated and sanitized
- HTTPS-only for rule downloads
- Input validation for all command parameters
- Safe file system operations
Please read our Contributing Guide for more details.
Code Style
We use ESLint and Prettier to maintain code quality. Before submitting a pull request:
# Run linter
npm run lint
# Fix linting issues automatically
npm run lint:fixTechnology Stack
- Electron: Cross-platform desktop application framework
- React: UI library for building interactive interfaces
- TypeScript: Type-safe JavaScript
- Recharts: Responsive charting library
- Electron Store: Persistent settings storage
- @blockingmachine/core: Core rule processing functionality
License
This project is licensed under the BSD-3-Clause License.