Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .claude/rules/linting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Linting Rules

Before committing Go code changes:

1. Run `cd src && make lint` to check for lint errors
2. Run `cd src && make lint-fix` to auto-fix issues
3. Do NOT use `--no-verify` to skip pre-commit hooks
4. Do NOT commit code that fails `golangci-lint`

The PostToolUse hook auto-runs golangci-lint on edited Go files, but always verify with a full lint pass before committing.
14 changes: 14 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,19 @@
"Bash(tail:*)",
"Bash(xxd:*)"
]
},
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "FILE=$(jq -r '.tool_input.file_path // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '/src/.*\\.go$'; then PKG=$(dirname \"$FILE\" | sed 's|.*/src/||'); cd src && golangci-lint run --fix \"./$PKG/...\" 2>/dev/null || true; fi",
"timeout": 30
}
]
}
]
}
}
16 changes: 16 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Agents (Codex)

## Linting

- MUST run `cd src && make lint` before committing any Go changes
- MUST run `cd src && make lint-fix` to auto-fix lint issues when lint fails
- MUST NOT use `--no-verify` on git commits

## Testing

- MUST run `cd src && make test` before pushing
- Use `-short` flag for unit tests: `cd src && go test -short ./...`

## Git Hooks

Git hooks are configured via `core.hooksPath`. Run `make install-git-hooks` if hooks are not active.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
.PHONY: install-git-hooks
install-git-hooks:
printf "#!/bin/sh\nmake pre-commit" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
printf "#!/bin/sh\nmake pre-push" > .git/hooks/pre-push
chmod +x .git/hooks/pre-push
git config core.hooksPath scripts

.PHONY: pre-commit
pre-commit:
Expand Down
5 changes: 5 additions & 0 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
# Pre-commit hook: lint changed Go files in src/
if git diff --cached --name-only | grep -q '^src/'; then
make -C src lint
fi
3 changes: 3 additions & 0 deletions scripts/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
# Pre-push hook: run tests before pushing
make pre-push
Loading