Files
replicate__skills/script/lint
Andreas Jansson c4820d4c4a Add reference docs, Cloudflare examples, and test runner
- Split SKILL.md into focused reference docs: PREDICTIONS.md,
  MODEL_SEARCH.md, COLLECTIONS.md, WORKFLOWS.md, DEPLOYMENTS.md,
  HTTP_API.md, CLOUDFLARE_WORKERS.md, CLOUDFLARE_WORKFLOWS.md
- Add Cloudflare Workers examples: basic, async poll, concurrent,
  image editing via request.blob(), routing by path
- Add Cloudflare Workflows example: keyframe → video → stitch pipeline
- Vary models across examples (p-image, flux-2-klein, flux-schnell)
- Add script/test_snippets.py: extracts and runs all code snippets,
  spins up wrangler dev for worker/workflow snippets, detects image
  inputs and POSTs test fixture
- Add ruff check/format to script/lint
- Add test-snippets job to CI (skipped on fork PRs)
- Update AGENTS.md with new structure and testing docs
2026-02-26 11:05:58 +01:00

36 lines
887 B
Bash
Executable File

#!/bin/sh
# script/lint: Validate Agent Skills definitions with skills-ref,
# then lint and format Python scripts with ruff.
set -e
cd "$(dirname "$0")/.."
[ -z "$DEBUG" ] || set -x
SKILL_PATH="${1:-skills/replicate}"
echo "==> Validating Agent Skills in $SKILL_PATH"
if command -v uv >/dev/null 2>&1; then
uvx --from skills-ref agentskills validate "$SKILL_PATH"
else
PYTHON_BIN="${PYTHON_BIN:-python3}"
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1; then
if command -v python >/dev/null 2>&1; then
PYTHON_BIN=python
else
echo "python not found. Install Python 3 or uv to run skills-ref." >&2
exit 1
fi
fi
"$PYTHON_BIN" -m skills_ref validate "$SKILL_PATH"
fi
echo "==> Linting Python (ruff check)"
uvx ruff check script/test_snippets.py
echo "==> Formatting Python (ruff format --check)"
uvx ruff format --check script/test_snippets.py