Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
110 lines (88 loc) · 4.29 KB
/
Copy pathjustfile
File metadata and controls
110 lines (88 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# One command per job. `just ci` runs what .github/workflows/ci.yml runs, in the same
# configuration, so a green `just ci` means a green pull request (Docker build aside;
# see `docker-smoke`). Install just with `brew install just`, `cargo install just` or
# `uvx --from rust-just just`; every recipe is plain shell, so CONTRIBUTING.md lists
# the same commands for anyone without it.
set shell := ["bash", "-euo", "pipefail", "-c"]
# Pinned to the version in ci.yml: `ruff format` output changes between releases.
ruff := "uvx ruff@0.15.7"
# The import contracts in pyproject's [tool.importlinter], at ci.yml's pinned version.
imports := "PYTHONPATH=src:ee/src uvx --from import-linter==2.15 lint-imports"
# Exactly CI's extras. Not --all-extras: it pulls transitive versions that break tests.
extras := "--extra pii --extra classifiers --extra otel --extra postgres --extra sql --extra dev"
# List the recipes.
default:
@just --list
# Create .venv with the extras CI tests against.
setup:
uv sync {{extras}}
# The whole Python suite, as CI runs it: in parallel, one worker per core.
test *args:
uv run pytest -q -n auto {{args}}
# Stop at the first failure, skipping tests/e2e and tests/repo, serially so the first
# failure is the one reported. Pass the directory you changed:
# `just test-fast tests/platform/policy`.
test-fast *args:
uv run pytest -q -x --ignore=tests/e2e --ignore=tests/repo {{args}}
# Ruff rules, formatting and the import contracts (layers), at CI's pinned versions.
lint:
{{ruff}} check .
{{ruff}} format --check .
{{imports}}
# Apply ruff's fixes and formatting.
fmt:
{{ruff}} check --fix .
{{ruff}} format .
# The drift checks: docs, reference, published numbers and the demo kit copy against the code.
check:
uv run python scripts/check/plugins.py
uv run python scripts/check/demo_kit.py
uv run python scripts/gen/api_routes.py --check
uv run python scripts/gen/docs_reference.py --check
uv run python scripts/check/claims.py --check
# Regenerate every generated file the checks above compare against.
regen:
uv run python scripts/gen/api_routes.py --write
uv run python scripts/gen/docs_reference.py --write
uv run python scripts/gen/coverage.py --write
# Dashboard: clean install, vitest, and a type check (the type check is not in CI).
dashboard:
cd dashboard && npm ci && npm test && npx tsc --noEmit --incremental false
# Fail if src/agentfox/ changed against BASE without the vendored wheels (CI's rule).
wheel-freshness base="origin/main":
#!/usr/bin/env bash
set -euo pipefail
changed="$(git diff --name-only "{{base}}"...HEAD)"
if echo "$changed" | grep -q '^src/agentfox/' \
&& ! echo "$changed" | grep -qE '^(api|demo/redteam-live-lang)/vendor/.*\.whl$'; then
echo "src/agentfox/ changed but the vendored wheels were not rebuilt: run 'just wheels'"
exit 1
fi
echo "vendored wheels: fresh relative to {{base}}"
# Everything CI runs except the Docker build.
ci: lint test check dashboard wheel-freshness
# Scaffold a coding-agent harness adapter: `just new-harness codex "Codex CLI"`.
new-harness name display="":
uv run python scripts/gen/new_harness.py {{name}} {{ if display != "" { "--display-name '" + display + "'" } else { "" } }}
# Rebuild both vendored wheels (api/ and the live demo deploy these, not src/).
wheels:
uv build --wheel --out-dir api/vendor
uv build --wheel --out-dir demo/redteam-live-lang/vendor
# CI's docker-smoke job: build deploy/Dockerfile up to the `deps` stage.
docker-smoke:
docker build -f deploy/Dockerfile --target deps .
# Gateway and control-plane API on 127.0.0.1:8080.
serve *args:
uv run agentfox serve {{args}}
# The offline walkthrough, against a throwaway database so it never touches yours.
demo:
AGENTFOX_DATABASE_URL="sqlite:///${TMPDIR:-/tmp}/agentfox-demo.db" uv run agentfox init
AGENTFOX_DATABASE_URL="sqlite:///${TMPDIR:-/tmp}/agentfox-demo.db" uv run agentfox demo
# Scaffold a built-in capability pack from src/agentfox/packs/_template:
# `just new-pack payments/chargebacks`.
new-pack id:
uv run agentfox policy packs new {{id}} --builtin
# Validate a capability pack and run its golden cases: `just test-pack payments/refunds`.
# With no id, every pack.
test-pack *ids:
uv run agentfox policy packs validate {{ids}}