Files
renovate/tools/agents/hooks/readme.md
Sebastian Poxhofer b632d27cdd ci(agents): extend AGENTS.md and add Claude hooks (#43470)
* ci: add agent instructions and ClaudeCode hooks

* refactor: rename start-check and use schemas

* fix: remove redundant flow diagram

* refactor: add block utility

* docs: add reference to development documentation

* ci: add pretooluse hook

* test: remove unnecessary schema tests

* ci: add --all flag run fixer and linters in a single command

* ci: switch stop hook to `pnpm check --all`

* refactor: use simple git

* refactor: use zod/v4

* ci: prevent usages of pnpm vitest

* ci: add must read and code example for codeBlock

* fixup! simplegit by allowing user pagers and editors

* ci(agent hooks): run installs on worktree changes

* docs: shorten description

* chore: remove additional new line at the end

* explicitly fail if parsing fails

* fix: rename to kebabcase

* docs: reduce commands highlighted for local dev
2026-06-08 13:56:15 +00:00

33 lines
1.3 KiB
Markdown

# Claude Code hooks
This directory contains hook scripts that Claude Code invokes automatically at key points in a session.
## Hooks
### `sessionstart-check.ts` — SessionStart
Runs once on session startup, resume, clear, or compact.
Installs tools and dependencies so the session has a working environment:
1. `mise install` — installs language runtimes declared in `.tool-versions` / `mise.toml`. Failure is non-fatal (logs a warning and continues) so the session works even without `mise`.
2. `pnpm install` — installs Node dependencies. Failure is fatal and blocks the session.
### `cwdchanged-check.ts` — CwdChanged
Runs on every working-directory change, including `EnterWorktree`.
Install tools and dependencies in the new cwd, so the session has a working environment even when switching to a different worktree or subdirectory.
### `pretooluse-check.ts` — PreToolUse
Runs before every tool call.
Blocks tool invocations that use forbidden package managers or test runners (e.g. `npm`, `yarn`, `npx`, `jest` directly) and requires `pnpm` / `vitest` instead.
### `stop-check.ts` — Stop
Runs when Claude Code is about to stop.
Executes `pnpm check --all` against all files changed since the base branch. If the check fails, the stop is blocked and Claude is prompted to fix the issues before finishing.