VibeWatch
A fast and extensible file watcher utility built in Rust with glob pattern support and cross-platform compatibility.
Features
- Custom command execution: Run commands on file changes with event-specific triggers (
--on-create,--on-modify,--on-delete,--on-change) - Template substitution: Use
{file_path},{relative_path},{absolute_path},{event_type}in commands - Structured logging: Objective, timestamp-based logs with exit codes for monitoring and automation
- Cross-platform file watching: Fully tested on Linux, macOS, and Windows with platform-specific event handling
- Glob pattern support: Include and exclude files using glob patterns like
*.rs,node_modules/** - Extensible architecture: Clean separation of concerns for easy feature additions
- Fast performance: Built in Rust for minimal resource usage
- Flexible CLI: Intuitive command-line interface with verbose logging and quiet mode
- Comprehensive testing: 90.95% code coverage with 187 tests covering unit, filesystem, and integration scenarios
Installation
From crates.io (Recommended)
From Binary Releases (Recommended for Production)
Download pre-built binaries from the latest release.
Available platforms:
- Linux: x86_64, ARM64 (
.tar.gz) - macOS: Intel (x86_64), Apple Silicon (ARM64) (
.tar.gz) - Windows: x64 (
.zip)
# Example: Linux x86_64
# Example: macOS ARM (Apple Silicon)
From Source
Make sure you have Rust installed via mise or rustup:
# Clone and build
⚡ Performance
vibewatch includes significant performance optimizations:
- 40-60% fewer memory allocations through static strings and optimized path handling
- 15-30% faster event processing via async channels (tokio)
- 80-95% fewer redundant commands with intelligent event debouncing
- Proper shell parsing with quote support via shell-words crate
- Fast binary builds - Reliable cross-platform compilation (~4 minutes for 5 platforms)
Benchmarks
Run comprehensive benchmarks yourself:
The benchmark suite includes:
- Template substitution - Single-pass vs multi-pass string operations
- Path normalization - Platform-specific optimization validation
- Pattern matching - Glob compilation and matching performance
Usage
Command Execution on File Changes
The primary use case is executing commands when files change:
# Run tests on any change
# Format Rust files when modified
# Run linter on TypeScript files (using brace expansion)
# Different commands for different events
Available Templates:
{file_path}- Full path to the changed file{relative_path}- Path relative to watched directory{absolute_path}- Absolute path to the changed file{event_type}- Type of event (create, modify, delete)
Brace Expansion: You can use brace expansion syntax for convenience with both --include and --exclude patterns:
# Include patterns - these are equivalent:
# Works with multiple extensions:
# Works with paths:
# Exclude patterns - these are equivalent:
# Combined include and exclude with brace expansion:
Watch-Only Mode
Watch a directory and log all file changes (no commands):
Include Patterns
Watch only specific file types:
Exclude Patterns
Ignore common directories and files:
Combined Patterns
Use both include and exclude patterns:
Options
Directory:
<DIRECTORY>: Directory to watch (can be relative or absolute)
Command Execution:
--on-create <COMMAND>: Run command when files are created--on-modify <COMMAND>: Run command when files are modified--on-delete <COMMAND>: Run command when files are deleted--on-change <COMMAND>: Run command on any file change (fallback)
Filtering:
-i, --include <PATTERN>: Include patterns like*.ts,*.rs(use multiple times for multiple patterns)-e, --exclude <PATTERN>: Exclude patterns likenode_modules/**,.git/**,.next/**
General:
-v, --verbose: Enable verbose output with debug logging-q, --quiet: Suppress command output (only show file events and status)-h, --help: Show help message-V, --version: Show version information
Structured Logging (v0.4.0+)
vibewatch provides objective, timestamp-based logs for monitoring and automation:
File Events:
[2025-10-06T14:23:15] [CREATED] src/main.rs
[2025-10-06T14:23:16] [MODIFIED] src/watcher.rs
[2025-10-06T14:23:17] [DELETED] tmp/test.txt
Command Execution:
[2025-10-06T14:23:15] Executing command: cargo build
<command output appears here>
[2025-10-06T14:23:18] Command succeeded (exit code: 0)
Command Failure:
[2025-10-06T14:23:19] Executing command: cargo check
<error output appears here>
[2025-10-06T14:23:20] Command failed (exit code: 1)
Features:
- ISO 8601 timestamps for sortable, parseable logs
- Uppercase event types (CREATED, MODIFIED, DELETED, CHANGED)
- Exit codes shown for all command executions
- Grep-friendly format (all lines start with
[YYYY-MM-DD) - Use
--quietto suppress command output, keeping only events and status
Examples
Auto-format TypeScript on save
Run Rust tests on file changes
Rebuild documentation on changes
Watch and restart development server
Auto-commit on file creation
Architecture
The application is structured for extensibility:
main.rs: CLI argument parsing and application entry pointwatcher.rs: Core file watching logic using thenotifycratefilter.rs: Glob pattern matching for include/exclude functionality
Common Glob Patterns
Exclude Patterns
node_modules/**- Node.js dependencies.git/**- Git repository files.next/**- Next.js build filestarget/**- Rust build directorydist/**- Build output directory{target,dist,build}/**- Multiple build directories (brace expansion)*.tmp- Temporary files*.swp- Vim swap files*.{tmp,swp,bak}- Multiple temporary file types (brace expansion)
Include Patterns
*.rs- Rust source files*.{ts,tsx}- TypeScript files (brace expansion supported)*.{js,jsx}- JavaScript files (brace expansion supported)*.py- Python files*.go- Go files*.{cpp,c,h}- C/C++ files (brace expansion supported)*.md- Markdown files
Note: Brace expansion like *.{ext1,ext2} or {dir1,dir2}/** works with both --include and --exclude patterns. The syntax is automatically expanded to multiple patterns before glob compilation. You can also use multiple flags if you prefer explicit patterns.
Future Enhancements
The following features are planned for future releases:
- Configuration file support: Store watch patterns and commands in
.vibewatch.toml - Ignore file support: Respect
.gitignore,.watchignorepatterns
Requirements
- Rust 1.70+ (managed via
mise) - Unix-like system (macOS, Linux) or Windows
Development
Quick Start with Just
The project uses just for task automation:
# Install just (if not already installed)
# or: brew install just
# List all available tasks
# Common tasks
Running Tests
# Run all tests (187 total: 140 unit + 21 filesystem + 26 integration)
# or: just test
# Run tests with output
# or: just test-verbose
# Run specific test suite
# or: just test-integration test_name
Code Coverage
The project maintains 90.95% code coverage (1096/1205 lines):
# Generate coverage report
# View report
Coverage by file:
filter.rs: 100.00% (177/177) ✅main.rs: 97.67% (252/258) ✅watcher.rs: 86.62% (667/770) ✅
Note: The watcher.rs coverage is lower due to command execution happening in spawned async tasks that are harder to test in unit tests. All command execution logic is thoroughly tested through our comprehensive integration test suite.
Development Commands
# Run with debug logging
RUST_LOG=debug
# Build for release
# Run linter
# Format code
Contributing
Commit Message Convention
This project uses Conventional Commits for automated versioning and changelog generation.
Format: <type>(<optional scope>): <description>
Types:
feat:- New feature (triggers minor version bump)fix:- Bug fix (triggers patch version bump)docs:- Documentation changeschore:- Maintenance tasksrefactor:- Code refactoringtest:- Adding or updating testsfeat!:orfix!:- Breaking changes (triggers major version bump)
Examples:
)
Release Process
Releases are fully automated via Release Please:
- Commit using conventional commits - Each commit to
masteris analyzed - Release PR is created - Release Please opens a PR with updated version and CHANGELOG
- Merge the Release PR - This triggers:
- GitHub Release creation with release notes
- Binary builds for 5 platforms (parallel execution, ~4 minutes):
- Linux x86_64 and ARM64
- macOS Intel and Apple Silicon
- Windows x64
- Publish to crates.io (requires
CARGO_TOKENsecret)
Current version: v0.4.0 (October 2025)
Binary build tool: Uses taiki-e/upload-rust-binary-action for reliable cross-compilation
- Automatic cross-compilation for Linux ARM64
- No timeout issues (resolved in v0.3.0)
- Battle-tested by tokio-console and cargo-hack
CI/CD
Branch Protection: Enabled on master with 6 required status checks
All PRs and pushes to master run:
- ✅ Tests (187 tests on Linux, macOS, Windows)
- ✅ Formatting check (
cargo fmt --check) - ✅ Linting (
cargo clippy -D warnings) - ✅ Coverage report (uploaded to Codecov)
On release (after merging Release PR):
- ✅ Build binaries for 5 platforms (parallel)
- ✅ Create GitHub Release with all binaries
- ✅ Publish to crates.io
Release Process:
- Uses Release Please with Personal Access Token (
RELEASE_PLEASE_TOKEN) - PAT required to trigger CI workflows on Release Please PRs
- Ensures all tests pass before releases are created
See docs/CI_CD.md for complete CI/CD architecture documentation.
Documentation
For comprehensive technical documentation:
- CI/CD Architecture:
docs/CI_CD.md- Complete CI/CD pipeline, release process, branch protection (v2.0) - Testing Guide:
docs/TESTING.md- Test organization, best practices, and quick reference - Coverage Analysis:
docs/COVERAGE.md- Detailed coverage metrics and industry benchmarks - Integration Tests:
docs/INTEGRATION_TEST.md- Testing research, rationale, and best practices - Justfile Guide:
docs/JUSTFILE_IMPLEMENTATION.md- Task runner implementation and benefits