Quick start
Install the CLI, move into a Git repository, and initialize the default checks.
cd your-repository
npm install --save-dev @githooked/cli
npx git-hooked init
npx git-hooked check pre-push
Future commits and pushes run the configured checks automatically. The manual check above lets you confirm the first setup immediately.
What initialization adds
git-hooked init creates a reviewable .githooked/ directory and managed blocks in the repository’s local Git hooks. Existing hook content is preserved, and running init again is safe.
.githooked/
├── config.yml
└── hooks/
├── pre-commit.yml
└── pre-push.yml
Fast deterministic checks for secrets, environment files, and conflict markers.
Deeper semantic review for security issues and missing tests using your configured agent.
Your daily workflow
Work normally. Git Hooked collects the relevant staged or outgoing diff, runs only the configured checks, and reports findings in the terminal.
- 1Commit
Fast local checks catch mechanical mistakes before they enter history.
- 2Push
Your configured agent reviews the bounded outgoing change in an isolated run.
- 3Resolve
Fix blocking findings yourself, or deliberately run
git-hooked fixfor the latest completed review. - 4Push again
Successful unchanged semantic reviews are reused from the repository’s private Git cache.
Git Hooked has no hosted proxy and collects no telemetry. Agent review goes through the authenticated CLI already installed on your machine.
Choose which checks run
Hook files are plain YAML. Reference shipped checks with builtin:<id> and repository-specific checks with check:<id>.
checks:
- builtin:security-review
- builtin:missing-tests
- builtin:breaking-changes
- check:tenant-isolation
Add a repository rule
Give Git Hooked a plain-language policy. Your configured agent analyzes bounded repository context in an isolated run, asks focused questions when needed, and recommends an existing, semantic, deterministic, or hybrid implementation.
git-hooked rule add "Every database query must include tenantId" --dry-run
git-hooked rule add "Every database query must include tenantId"
Before writing, Git Hooked previews the hook, severity, file globs, evidence, instructions, and any generated script. Generated command checks remain untrusted and cannot run until you inspect them and run git-hooked trust. Commit the resulting .githooked/ files so the whole team receives the same auditable rule.
Install a curated guide pack
Packs bundle focused, auditable rules for common security and quality concerns. Inspect every rule and proposed file change before installing it.
git-hooked guide list
git-hooked guide inspect security/multi-tenant
git-hooked guide add security/multi-tenant
Installed checks become ordinary Markdown and YAML under .githooked/. Removal refuses to delete a pack check that your team has edited locally.
Discover repository-specific security rules
Guided setup maps the repository locally, then asks your configured agent for a bounded set of proposals. Start with dry-run mode to review the evidence and exact file changes.
git-hooked setup security --dry-run
git-hooked setup security --focus auth,database --max-proposals 5
Interactive mode asks before installing each proposal. Non-interactive and dry-run modes never modify .githooked/.
Using an existing hook manager
If Git Hooked detects Husky, Lefthook, or pre-commit, it creates the configuration but leaves the manager’s hooks untouched. Install the CLI as a development dependency and call it from the manager you already use.
npx --no-install git-hooked check pre-commitrun: npx --no-install git-hooked check pre-pushentry: npx --no-install git-hooked check pre-commitDiagnose, repair, or remove
git-hooked doctorCheck the repository, configuration, hooks, and agent.git-hooked doctor --test-agentAlso run a basic isolated invocation with the configured agent.git-hooked fixDeliberately fix findings from the latest completed review.git-hooked uninstallRemove managed hook blocks and keep configuration.git-hooked uninstall --remove-configRemove managed hooks and the configuration directory.Run GIT_HOOKED_SKIP=1 git push. Git Hooked prints a visible warning and does not present the skipped review as successful.
Pick checks for your repository.
Explore the shipped checks and installable packs, with exact IDs and commands.