Overview
sniffercommit is a fast, C++20-powered pre-commit hook and CI generator. It ensures code quality before every push with zero runtime dependencies — a single static binary that replaces Python- and Node-based pre-commit frameworks.
Subcommands
| Command | Action |
|---|---|
init | Generate .sniffercommit.toml, .clang-format (plus .clang-tidy / CMakeLists.txt with --enable-* flags) |
install | Install pre-commit hook + optional CI workflows |
install-compiler | Install a C++ compiler/toolchain |
run | Execute checks on files (staged by default, --all-files for tracked) |
generate-gha | Write GitHub Actions workflow to .github/workflows/sniffercommit.yml |
generate-gitlab | Write GitLab CI workflow to .gitlab-ci.yml |
--version, -v | Print version and exit |
--help | Print help and exit |
Global flag: --config <path> — use a non-default config file path with any subcommand.
Dependencies
| Dependency | Purpose | Version |
|---|---|---|
| tomlplusplus | Header-only TOML config file parser and serializer | v3.4.0 |
| fmt | Modern formatting library | v11.0.2 |
Both are fetched automatically at configure time via CMake's FetchContent. No system installation required.
Build
# Release build (recommended) cmake -B build -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel # Verify ./build/sniffercommit --version # Quick smoke test ./build/sniffercommit init --style google --enable-clang-tidy ./build/sniffercommit run --dry-run --all-files ./build/sniffercommit install
| Option | Default | Description |
|---|---|---|
SNIFFERCOMMIT_ENABLE_SANITIZERS | OFF | AddressSanitizer + UBSan (Debug only) |
SNIFFERCOMMIT_USE_SYSTEM_FMT | ON | Use system libfmt instead of FetchContent |
SNIFFERCOMMIT_USE_SYSTEM_TOMLPLUSPLUS | OFF | Use system tomlplusplus instead of FetchContent |
Compiler Requirements
GCC >= 11Clang >= 14MSVC >= 2022 17.0
Install (from build): sudo cmake --install build