Skip to content

Commit d7ea0c6

Browse files
committed
chore: Add post-edit script to replace agent instruction
1 parent 9c581a1 commit d7ea0c6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.agents/hooks/post-edit-python.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Post-edit hook for Python files. Runs type checking and linting/formatting.
3+
# Usage: post-edit-python.sh <file_path>
4+
# Intended to be called by AI coding agents after editing a python file.
5+
FILE_PATH="$1"
6+
7+
[[ "$FILE_PATH" != *.py ]] && exit 0
8+
9+
cd "$(git rev-parse --show-toplevel)"
10+
uv run ty check
11+
uv run ruff check --fix "$FILE_PATH"
12+
uv run ruff format "$FILE_PATH"

AGENTS.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
- We use uv for everything (e.g. we do `uv run python ...` to run some python code, and
77
`uv run pytest tests/unit` to run unit tests). Please prefer `uv run python -c ...` over
88
`python3 -c ...`
9-
- After generating code, please run `uv run ty check`, `uv run ruff check` and `uv run ruff format`.
10-
Fix any error.
119
- After changing anything in `src` or in `tests/unit` or `tests/doc`, please identify the affected
1210
test files in `tests/` and run them with e.g.
1311
`uv run pytest tests/unit/aggregation/test_upgrad.py -W error`. Fix any error, either in the

0 commit comments

Comments
 (0)