Solidify the Python test-env path so any agent (Claude / Codex) or
human can bootstrap with one command, and so the global preflight
skill's pip-audit branch actually runs against this repo.
scripts/bootstrap_test_env.{ps1,sh}: one-liner per platform, idempotent
(no-op if .venv exists, --force / -Force to recreate), upgrades pip,
installs project + test extras.
pyproject.toml: add pip-audit>=2.7 to [project.optional-dependencies]
test so /preflight's Python audit branch lights up.
CLAUDE.md, Hard rules: replace the inline venv-bootstrap command with
a reference to the platform script.
AGENTS.md: short "Test Environment Bootstrap" pointer (mirrors CLAUDE.md
per the Claude/Codex symmetry rule).
.gitattributes: enforce LF for *.sh (otherwise Windows CRLF breaks the
bash shebang on POSIX) and CRLF for *.ps1 (Windows convention).
Triggered by the warmup-skill Python detection added in agent-playbooks
PR #34 — projects now need a clean bootstrap path for the new check to
have a recommended remediation.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
798 B
Bash
Executable File
35 lines
798 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Bootstrap a repo-local .venv and install test dependencies.
|
|
# Idempotent — no-op if .venv already exists. Pass --force to recreate.
|
|
#
|
|
# Usage: bash scripts/bootstrap_test_env.sh [--force]
|
|
|
|
set -euo pipefail
|
|
|
|
FORCE=""
|
|
if [ "${1:-}" = "--force" ]; then
|
|
FORCE="1"
|
|
fi
|
|
|
|
if [ -d .venv ]; then
|
|
if [ -z "$FORCE" ]; then
|
|
echo ".venv already exists. Pass --force to recreate."
|
|
exit 0
|
|
fi
|
|
echo "Removing existing .venv ..."
|
|
rm -rf .venv
|
|
fi
|
|
|
|
echo "Creating .venv ..."
|
|
python -m venv .venv
|
|
|
|
echo "Upgrading pip ..."
|
|
.venv/bin/python -m pip install --quiet --upgrade pip
|
|
|
|
echo "Installing project + test extras ..."
|
|
.venv/bin/python -m pip install --quiet -e '.[test]'
|
|
|
|
echo ""
|
|
echo "Test env ready. Run tests with:"
|
|
echo " .venv/bin/python -m pytest"
|