# Run the full CI suite locally before pushing.
#
# Mirrors `.github/workflows/test.yml` so a stale doc / broken lint
# is caught before it turns into a red badge on main.
#
# Safety:
#   - Tests run with placeholder API keys (no real OPENROUTER /
#     ELEVENLABS calls). Live-API tests live under tests/live/ and
#     are NOT included here — run them manually with `bun run test:live`.
#   - Tests use tmp dirs under $TMPDIR; the repo's `workspace/` is
#     never touched.
#   - All lint steps are read-only file operations.
#
# Bypass with `git push --no-verify` if you really need to.

set -e

echo "→ bun test --timeout 15000 tests/unit/ tests/integration/"
OPENROUTER_API_KEY="test-placeholder" \
ELEVENLABS_API_KEY="test-placeholder" \
  bun test --timeout 15000 tests/unit/ tests/integration/

echo "→ bun run lint:errors"
bun run lint:errors

echo "→ bun run lint:help-examples"
bun run lint:help-examples

echo "→ bun run cli:surface:check"
bun run cli:surface:check

echo "→ bun run docs:cli:check"
bun run docs:cli:check

echo "→ bun run lint:docs-links:fast"
bun run lint:docs-links:fast

echo "✓ pre-push checks passed"
