CLI reference
Run the same configured steps locally, in Git hooks, and in CI.
| Task | Command |
|---|---|
| Set up a project | hk init and hk install |
| Check or fix code | hk check and hk fix |
| Run a named hook | hk run |
| Inspect configuration | hk config and hk validate |
| Test a step definition | hk test |
| Integrate a coding agent | hk agent and hk mcp |
| Use included file checks | hk util |
Start with getting started for an end-to-end setup. Command-specific flags are listed on each page; the flags below apply globally.
Usage: hk [FLAGS] <SUBCOMMAND>
Version: 1.58.1
Global Flags
--cd <DIRECTORY>— Run as if hk was started in this directory-j --jobs <JOBS>— Number of jobs to run in parallel-p --profile <PROFILE>— Profiles to enable or disable. Prefix a profile with ! to disable it, e.g. --profile slow --profile !fast-s --slow— Shorthand for --profile=slow-v --verbose— Enable verbose (debug) output. Pass twice for trace output-n --no-progress— Disable progress output-q --quiet— Suppress non-essential output (info messages, progress indicators). Failed-step diagnostics are still shown--silent— Suppress all output except errors, including warnings--trace— Enable tracing spans and performance diagnostics--json— Output in JSON format
Flags
--format <FORMAT>— Select human or machine-readable execution outputChoices:
human,json,jsonlDefault:
human-h --help— Print help-V --version— Print version
Subcommands
hk agent <SUBCOMMAND>hk agent hooks <--target <TARGET>>hk agent instructions <--target <TARGET>>hk agent mcp <--target <TARGET>>hk builtinshk cache clearhk check [FLAGS] [FILES]…hk completion [--install] [--force] <SHELL>hk config <SUBCOMMAND>hk config dump [--format <FORMAT>]hk config explain <KEY>hk config get <KEY>hk config sourceshk fix [FLAGS] [FILES]…hk init [FLAGS]hk install [FLAGS]hk mcp [--root <PATH>]hk migrate <SUBCOMMAND>hk migrate pre-commit [FLAGS]hk run [FLAGS] [FILES]… <SUBCOMMAND>hk run commit-msg [FLAGS] <COMMIT_MSG_FILE> [FILES]…hk run post-checkout [FLAGS] <ARGS>…hk run post-commit [FLAGS] [FILES]…hk run post-merge [FLAGS] <IS_SQUASH> [FILES]…hk run post-rewrite [FLAGS] <COMMAND> [FILES]…hk run pre-commit [FLAGS] [FILES]…hk run pre-push [FLAGS] [ARGS]…hk run pre-rebase [FLAGS] <ARGS>…hk run prepare-commit-msg [FLAGS] <ARGS>…hk sponsorshk test [FLAGS]hk uninstall [--global]hk util <SUBCOMMAND>hk util check-added-large-files [--maxkb <MAXKB>] <FILES>…hk util check-byte-order-marker [-d --diff] <FILES>…hk util check-case-conflict <FILES>…hk util check-conventional-commit [--allowed-types <ALLOWED_TYPES>] <COMMIT_MSG_FILE>hk util check-executables-have-shebangs <FILES>…hk util check-merge-conflict [--assume-in-merge] <FILES>…hk util check-symlinks <FILES>…hk util detect-private-key <FILES>…hk util end-of-file-fixer [-d --diff] [-f --fix] <FILES>…hk util fix-byte-order-marker <FILES>…hk util fix-smart-quotes [--check] [-d --diff] <FILES>…hk util mixed-line-ending [-d --diff] [-f --fix] <FILES>…hk util no-commit-to-branch [--branch <BRANCH>]hk util python-check-ast <FILES>…hk util python-debug-statements <FILES>…hk util trailing-whitespace [-d --diff] [-f --fix] <FILES>…hk validatehk version
