Chapter 3: Version control

Git hook

A script git runs by itself at certain moments, such as just before a commit or a push. If the script exits with anything other than 0, git stops. Hooks live in your own copy of the repository and aren't part of its history.

A hook turns "please run the linter", a tool that checks code for known bad habits, into something that happens every time, and its error goes straight to the agent. But it only guards one machine, and a single flag skips it, which an agent under pressure may well use. Treat it as a fast helper, and run the same checks on the server.

Say it to your agent

“Add lefthook with a pre-commit job running gitleaks git --pre-commit --staged --redact, and a pre-push job running bun run typecheck. Show me each one refusing something. Never use --no-verify: if a hook fails, fix the cause or ask me.”

The workshop

Name a word, or describe what you mean in everyday language.