Mote is a high-performance, asynchronous file watcher written in Rust. It's designed to monitor one or more directories for file system changes and automatically create Git commits in the corresponding repository when changes are detected.
- Real-time File Monitoring: Watches specified directories for changes (creations, modifications, deletions).
- Automatic Git Commits: Automatically stages and commits detected changes to the respective Git repository.
- History Squashing: Automatically condenses older automated commits into hourly, daily, or weekly summaries to keep your Git history clean.
- Asynchronous Architecture: Built on
tokiofor efficient, non-blocking I/O operations. - Non-Blocking Git Operations: Utilizes
tokio::task::spawn_blockingto ensure CPU-intensive Git operations don't block the main event loop. - Configurable: Easy to set up watch directories, logging levels, and squashing policies via a
config.tomlfile.
Make sure you have Rust and Cargo installed. If not, you can install them via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shBefore running Mote, you need to create a config.toml file in the project root. This file specifies the desired database path, logging level, and history squashing policies.
Example config.toml:
# The path to the SQLite database (defaults to ~/.mote/mote.db)
database_path = "~/.mote/mote.db"
# Optional: Set the logging level.
# Can be "error", "warn", "info", "debug", or "trace". Defaults to "info".
log_level = "debug"
# Optional: Set the debounce period in milliseconds.
# Mote will wait this long for filesystem activity to settle before committing.
# Defaults to 1000.
debounce_ms = 1000
# Optional: Custom ignore patterns (glob format).
# Files matching these patterns will NOT trigger auto-commits.
ignore = ["*.tmp", "target/**"]
# Optional: Configure history squashing
[squash_history]
# How old should commits be before they start getting squashed?
# Supports "h" (hours), "d" (days), "w" (weeks).
squash_by_time = "1h"
# How many commits should exist before squashing older ones?
# (e.g., if set to 10, mote will always keep the 10 most recent commits untouched)
squash_by_limit = 10
# How should squashed commits be grouped?
# Options: "hour", "day", "week".
squash_into = "day"Navigate to the project root directory and use Cargo to build and run Mote:
-
Build the project:
cargo build
-
Run the application:
cargo run
-
Run in release mode (for performance):
cargo run --release
- Asynchronous Rust: The application leverages the
tokioruntime for all I/O-bound tasks. - Non-Blocking Git Operations: All
git2operations are wrapped intokio::task::spawn_blockingto prevent blocking the main event loop. - Logging:
env_loggeris used for flexible logging, configurable viaconfig.tomlorRUST_LOG.
See LICENSE