It is a lightweight CLI + Git pre-commit hook that prevents committing files with forbidden keywords (like TODO, FIXME, DEBUG). It helps keep repositories clean by enforcing code hygiene automatically.
- Regex-based scanning for keywords (default:
#TODO). - Scans staged files in Git repositories.
- CLI options: custom keyword, list matches, count matches.
- One-command setup and cleanup:
jammer --initandjammer --uninstall - Local installation via RubyGem.
- RubyGems installation support (
gem install jammer-cli). - Config file support (
.jammer.yml) with multiple keywords, exclude patterns, and optional commands. - GitHub/ESLint-style configuration format.
- Ruby
>= 3.0 - Git
- A shell environment with
grepavailable
gem install jammer-cli- Clone the repository:
git clone https://github.com/rna/jammer-cli.git cd jammer-cli - Build the gem locally:
gem build jammer-cli.gemspec
- Install the built
.gemfile (replace version if needed):gem install ./jammer-cli-0.1.0.gem
Initialize jammer in your project (creates config + installs Git hook):
jammer --initThis will:
- Create
.jammer.ymlbased on.jammer.yml.example - Install the Git pre-commit hook automatically (if in a Git repository)
Edit .jammer.yml to customize keywords and exclude patterns for your project.
To completely remove jammer from your project:
jammer --uninstallThis removes .jammer.yml and removes the Git pre-commit hook only if it was installed by jammer.
jammer- Check staged files using configured keywordsjammer --keyword KEYWORD- Check with a one-off keywordjammer --list- List all matchesjammer --count- Show match countjammer --init- Create config and install hookjammer --init --force- Force overwrite existing config/hookjammer --uninstall- Remove jammer config/hook from current projectjammer --help- Show helpjammer --version- Show version
0- Success (no blocking issues)1- Blocking issue (keywords found, invalid config, hook/config setup issue, or configured command failure)2- Internal jammer runtime error (Jammer::Error)
The .jammer.yml file follows the GitHub/ESLint config pattern. See .jammer.yml.example for a complete example.
keywords - List of patterns to search for (default: ["#TODO"])
exclude - List of path patterns to skip during scanning (default: [])
commands - List of commands to run after keyword checks pass (default: [])
Commands run directly (without implicit shell). For shell operators like &&, wrap explicitly:
commands:
- rubocop
- sh -c "bundle exec rspec --fail-fast && echo done"keywords:
- TODO
- FIXME
exclude:
- vendor/
- node_modules/
commands:
- rubocopNote: Exclude patterns are matched against file paths only.
jammer --initinstalls.git/hooks/pre-commitif no hook exists.- If a jammer-installed hook already exists, init is idempotent.
- If a custom pre-commit hook exists, init fails (unless
--forceis used). --forceoverwrites existing config/hook.jammer --uninstallremoves only the jammer-created hook and leaves custom hooks untouched.- If
jammercommand is missing during commit, the hook blocks the commit.
Error: 'jammer' command not foundin hook: install the gem (gem install jammer-cli) and ensure RubyGems bin path is inPATH.Unknown setting(s) in .jammer.yml: use onlykeywords,exclude, andcommands.'keywords'/'exclude'/'commands' must be an array of strings: fix the value type in.jammer.yml.A custom pre-commit hook already exists. Cannot auto-install.: keep existing hook, or runjammer --init --forceif overwriting is intended.Nothing to uninstall. No .jammer.yml or git hook found.: jammer is not installed in the current project.
Configured commands are executed from the repository's .jammer.yml.
Run jammer only in repositories you trust.
- Tagging
vX.Y.Ztriggers the GitHub release workflow at.github/workflows/release.yml. - Publishing requires GitHub Actions secret:
RUBYGEMS_API_KEY.
- Preserve existing custom hook while appending jammer checks (non-destructive hook mode)
- Optional JSON output for CI tooling
- Richer exclude matching (glob-style patterns)
See CONTRIBUTING.md for local setup, testing, and pull request guidelines.
See CHANGELOG.md for release history.
MIT - See LICENSE