βββββββββββ βββββββ βββ ββββββ βββ βββββββ βββββββ βββ βββ
βββββββββββ ββββββββββββ ββββββ ββββββββββββββββββββββββ ββββ
ββββββ βββ βββ ββββββ ββ ββββββββββββββ ββββββ ββββββββββ
ββββββ βββ βββ ββββββββββββββββββββββββ ββββββ ββββββββββ
βββ ββββββββββββββββββββββββββββββ ββββββββββββββββββββββββ βββ
βββ ββββββββ βββββββ ββββββββ βββ βββ βββββββ βββββββ βββ βββ
Flowhook is a lightweight C++ file-watcher CLI using Linux inotify. It allows you to define build commands, branch on success/failure, log your build history to a log file and persist watch state across reboots.
Click the player above to watch a full 3-minute walkthrough of FlowHook tracking file modifications and running build commands automatically including the hook feature.
While there are other file watchers out there, FlowHook was designed with a few core strengths that are difficult to find out-of-the-box in popular alternatives:
- True Persistence: FlowHook configurations are saved to a config file, giving it true persistence. Once you set up your project configurations you only need to run the
flowhook runcommand whenever you want to start monitoring your project and run your commands at file change. - Contextual Branching (
on_success/on_failure): It allows you to attach different commands to run based on the exit state of the previous command, so you can run different commands depending on whether the build succeeded or failed. Use cases include running different test suites depending on the build outcome, or sending desktop notifications based on the build result. - Language Agnostic: Though engineered in native C++, FlowHook is entirely toolchain-agnostic. Whether you are compiling C++, watching TypeScript builds, restarting a Go backend, or running Python scripts, it hooks into any CLI pipeline seamlessly.
- Logs Everything: FlowHook keeps track of your active sessions, and logs information about each of your sessions, into a log file called
<YOUR_PROJECT_NAME>-flowhook.logright in your project directory. So you can easily review the history of your sessions and your build history including the terminal output and several other informations. Use cases include debugging build issues, tracking build history, and monitoring build outcomes.
This is the easiest way to get started with FlowHook.
- Grab the latest release from the GitHub releases page.
- Unzip the downloaded file.
unzip flowhook.zip - Grant execute permissions to the
flowhookbinary.
chmod +x flowhook- Move the
flowhookbinary to a directory in yourPATH(e.g./usr/local/bin).
sudo mv flowhook /usr/local/bin/If you prefer to compile from source or are modifying the codebase, ensure your system has a modern C++ toolchain supporting C++17/20, cmake, and make.
On Ubuntu/Debian or WSL (Ubuntu), install the build requirements:
sudo apt update && sudo apt install -y build-essential cmakeThen compile and install:
- Clone and navigate into the project
git clone https://github.com/etcoder-642/FlowHook.git
cd FlowHook- Create and enter a clean build directory
mkdir build && cd build- Generate an optimized Release build configuration
cmake -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ..- Compile the binary using all available CPU cores(to save some of your timeπ )
make -j$(nproc)- Install system-wide to
/usr/local/bin
sudo make installTo verify the installation, run flowhook --version and ensure it outputs the version number.
FlowHook provides a Git-like subcommand interface to seamlessly configure, track, and monitor your development pipelines.
- Initialize a new FlowHook environment in your project root
flowhook init- Add your execution bounds and build/test targets
flowhook add --command "make" --on-success "./run_tests" --on-failure "echo 'Fix the build!'"- Ignore build artifacts and transient directories from being tracked by FlowHook
flowhook add --ignored-path "build/" --ignored-pattern "*.o"- Spin up the background thread filewatcher
flowhook runThese flags can be appended to the base flowhook command from anywhere:
-h, --help β Displays help information for the base flowhook command.
--version β Prints the version of the installed flowhook engine.
--verbose β Enables verbose logging output. it is not global flag and must be used with a base flowhook subcommand. But all subcommands support it.
--debug β Enables debug logging output. This is useful for troubleshooting and seeing detailed log output. it is not global flag and must be used with a base flowhook subcommand. But all subcommands support it.
*Tip: Use flowhook --help <subcommand> to see detailed usage and options for each subcommand.
Initializes a flowhook instance in your current directory and registers it inside a config.json file under $HOME/.config/flowhook/config.json.
Usage: flowhook init
Options:
--task TEXT[OPTIONAL] β enables you to name your flowhook instance a unique name. If not provided the filename of your current directory will be taken as name.
To register a property to your flowhook instance, use the add subcommand.
Usage: flowhook add [options]
Options:
--command "<cmd>" β The base target command to be executed on file change.
--path "<path>" β enables you to specify a path any directory or file from any where from your machine to be watched for file changes. If it's a directory, all files within it until the depth limit is reached will be watched recursively.
--on-success "<cmd>" β Hook a separate command for execution if the base target command returns exit code 0.
--on-failure "<cmd>" β Hook a separate command for execution if the base target command returns a non-zero exit code.
--ignored-path "<path>" β register a directory to be ignored by the filewatcher.
--ignored-pattern "<glob>" β register a file pattern to be ignored by the filewatcher. (e.g., *.tmp, *.o)
To list all registered tasks, paths, commands, and ignored patterns, in your flowhook instance in the current directory, use the list subcommand.
Usage: flowhook list [options]
Flags:
--tasks β lists all registered tasks and their associated paths in your machine.
--paths β lists all registered paths and watched paths in the current directory.
--commands β lists all build commands registered in the current directory.
--ignored β lists all ignored paths and patterns in the current directory.
--on-success β lists all on success commands to run in the current directory.
--on-failure β lists all on failure commands to run in the current directory.
To remove a registered task, path, command, or ignored pattern, use the remove subcommand.
Usage: flowhook remove [options]
*if no options are provided, the remove subcommand will remove the flowhook configuration from the current directory, with a confirmation dialog.
Options:
-f β Bypasses verification checks to force immediate removal of the flowhook configuration in the current directory.
--command "<cmd>" β removes a base target command from the flowhook configuration.
--path "<path>" β removes a path from the flowhook configuration.
--on-success "<cmd>" β removes a separate command for execution if the base target command returns exit code 0.
--on-failure "<cmd>" β removes a separate command for execution if the base target command returns a non-zero exit code.
--ignored-path "<path>" β removes a directory to be ignored by the filewatcher.
--ignored-pattern "<glob>" β removes a file pattern to be ignored by the filewatcher. (e.g., *.tmp, *.o)
To change different settings in the flowhook configuration, use the set subcommand.
Usage: flowhook set [options]
Options:
--depth <int> β Adjusts recursive folder watch limits. Accepts integers mapping from 0(shallow tracking) up to 10(deep recursive tracking).
Flag:
--active β sets the the initialized task in the current directory as active. This enables you to watch for only tasks labeled as active later using the command flowhook run --active
It checks for the status set by the set command.
Usage: flowhook check
Options:
--depth - outputs the recursive folder watch limits set for the flowhook configuration in the current directory.
--active - checks if current flowhook instance in the current working directory is labeled active.
--deactive - checks if current flowhook instance in the current working directory is labeled deactive.
Spins up the underlying filewatcher background-thread. Mounts registered commands and hooks for execution.
Usage: flowhook run
Flags:
--quiet β Silences non-essential build terminal output streams, funneling terminal logs strictly to the log file instead of flooding stdout.
--all - Runs all registered tasks across the entire machine.
--active - Runs all tasks that are labeled as active.
FlowHook is early and has some known gaps:
- Linux only. Relies directly on the kernel's
inotifysubsystem. No macOS or Windows support. Planned in the near term. - Sequential command execution. Commands run one at a time, not concurrently. A thread pool for concurrent execution is planned.
- No write-ahead logging (WAL). Config writes and log writes aren't crash-safe. A failure mid-write can corrupt the config file, losing all registered projects. Same risk applies to session logs.
- No daemon/service mode.
flowhook runis a foreground process; usenohup,tmux, or a systemd unit if you need it to survive terminal closure.
These are known gaps, not surprises. Issues and PRs addressing any of them are welcome.
FlowHook is early-stage and contributions are genuinely welcome, from bug fixes to feature ideas.
- Found a bug? Open an issue.
- Have a feature in mind? Open an issue to discuss before submitting a large PR.
- PRs should target the
devbranch, notmain.mainis reserved for tagged releases. I merge fromdevmyself once changes are reviewed and versioned.
No formal contribution guide yet. For now, fork, branch off dev, and open a PR against dev.
mnasie | aspiring systems engineer