chore: add project docs and agent workflow setup
This commit is contained in:
1 parent
b647343c99
commit
95e1b9cb89
15 files changed
+894
-1
No files matched your search
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stop hook: block "done" while ruff or tests fail on changed Python code.
|
||||
input=$(cat)
|
||||
[[ "$(jq -r '.stop_hook_active // false' <<<"$input")" == "true" ]] && exit 0
|
||||
cd "$CLAUDE_PROJECT_DIR" || exit 0
|
||||
[[ -f pyproject.toml ]] || exit 0
|
||||
command -v uv >/dev/null || exit 0
|
||||
# -uall lists files inside new folders (e.g. a fresh src/), not just the folder.
|
||||
git status --porcelain -uall | grep -q '\.py$' || exit 0
|
||||
|
||||
if ! out=$(uv run --quiet ruff check . 2>&1); then
|
||||
echo "ruff check failed, fix before finishing:" >&2
|
||||
tail -n 30 <<<"$out" >&2
|
||||
exit 2
|
||||
fi
|
||||
if grep -q pyright pyproject.toml && ! out=$(uv run --quiet pyright 2>&1); then
|
||||
echo "pyright failed, fix before finishing:" >&2
|
||||
tail -n 30 <<<"$out" >&2
|
||||
exit 2
|
||||
fi
|
||||
out=$(uv run --quiet pytest -q -x 2>&1)
|
||||
status=$?
|
||||
# 0 = passed, 5 = no tests collected yet; neither should block.
|
||||
if [[ $status -ne 0 && $status -ne 5 ]]; then
|
||||
echo "pytest failed, fix before finishing:" >&2
|
||||
tail -n 40 <<<"$out" >&2
|
||||
exit 2
|
||||
fi
|
||||
exit 0
|
||||
Reference in new issue
Block a user