Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
135 lines (102 loc) · 4.62 KB
/
Copy pathjustfile
File metadata and controls
135 lines (102 loc) · 4.62 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Cyber Code development tasks. Run `just` to list them.
set shell := ["bash", "-euo", "pipefail", "-c"]
cyber := "target/debug/cyber"
linux_image := "cyber-linux-test"
# List the recipes.
default:
@just --list --unsorted
# --- Build -------------------------------------------------------------------
# Debug build of the whole workspace (binary: target/debug/cyber).
build:
cargo build --workspace
# Optimized `cyber` binary (target/release/cyber).
release:
cargo build --release -p cyber-cli
# Install `cyber` into ~/.cargo/bin.
install:
cargo install --path crates/cyber-cli --locked
# Remove build artifacts.
clean:
cargo clean
# --- Checks (what CI runs) ---------------------------------------------------
# Format all Rust code.
fmt:
cargo fmt --all
# Rust formatting and clippy with warnings as errors.
lint:
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
# Rust tests: `just test`, `just test -p cyber-server`, or `just test <name filter>`.
[positional-arguments]
test *args:
if printf '%s\n' "$@" | grep -qxE -- '-p|--package'; then cargo test "$@"; else cargo test --workspace "$@"; fi
# OpenSpec validation, cross-spec lint and the ROADMAP requirement inventory.
specs:
openspec validate --all --strict
python3 scripts/spec_lint.py
python3 scripts/spec_inventory.py
git diff --exit-code ROADMAP.md
# TypeScript SDK: generated sources current, typecheck, tests.
sdk-test:
python3 scripts/generate_sdk.py --check
cd sdk/typescript && npm ci --silent && npm run typecheck && npm test
# Everything CI checks.
ci: lint test specs sdk-test
# Rust tests on Linux in Docker (bubblewrap sandbox, unprivileged user). Parallelism is
# capped (LINUX_JOBS, default 4) so linking fits in Docker's memory.
[positional-arguments]
test-linux *args:
docker build -q -t {{ linux_image }} -f scripts/docker/linux-test.Dockerfile scripts/docker >/dev/null
scope=--workspace; if printf '%s\n' "$@" | grep -qxE -- '-p|--package'; then scope=; fi; \
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined \
-v "$PWD":/src:ro -v cyber-target:/target -u root {{ linux_image }} \
sh -c 'chown -R dev /target && su dev -c "export CARGO_TARGET_DIR=/target CARGO_HOME=/target/cargo-home CARGO_INCREMENTAL=0 CARGO_BUILD_JOBS=${LINUX_JOBS:-4} PATH=/usr/local/cargo/bin:\$PATH; cd /src && cargo test --locked $0 $*"' "$scope" "$@"
# --- Evaluation -----------------------------------------------------------------
# Check every suite grader: fails on the fixture, passes with the reference solution.
eval-check:
python3 scripts/check_eval_graders.py
# Run the coding suite against a model, e.g. `just eval openai/gpt-6-luna --trials 3`.
[positional-arguments]
eval model *args: build
{{ cyber }} eval run eval/manifests/suite-coding-v1.json -m "$1" --output "eval/results/$(date +%Y%m%d-%H%M%S)-${1//\//-}" "${@:2}"
# --- Generated sources --------------------------------------------------------
# Regenerate sdk/openapi.json from the server's types.
openapi:
UPDATE_OPENAPI=1 cargo test -p cyber-server --test http openapi_document_is_current
# Regenerate sdk/openapi.json and the TypeScript SDK from it.
sdk-generate: openapi
python3 scripts/generate_sdk.py
# Refresh the bundled models.dev catalog snapshot.
models-snapshot:
python3 scripts/refresh_models_snapshot.py
# --- Run ----------------------------------------------------------------------
# The TUI in the current directory (or pass a project path and flags).
[positional-arguments]
tui *args: build
{{ cyber }} "$@"
# One non-interactive run, e.g. `just exec -m openai/gpt-6-luna "fix the tests"`.
[positional-arguments]
exec *args: build
{{ cyber }} exec "$@"
# The server in the foreground.
[positional-arguments]
serve *args: build
{{ cyber }} serve "$@"
# Background server: `just service start|stop|restart|status|password [value]`.
[positional-arguments]
service *args: build
{{ cyber }} service "${@:-status}"
# One API request, e.g. `just api v1.session.list`.
[positional-arguments]
api *args: build
{{ cyber }} api "$@"
# Run against a throwaway home so nothing touches your real ~/.local data.
[positional-arguments]
sandboxed *args: build
CYBER_HOME="$(mktemp -d)" {{ cyber }} "$@"
# --- Docs ---------------------------------------------------------------------
# Recapture docs/screenshots from the real TUI (needs pyte and pillow, and Chrome).
# PY selects the interpreter, e.g. `PY=/tmp/cyber-shots/bin/python just screenshots`.
screenshots:
cargo build -p cyber-cli
"${PY:-python3}" scripts/capture_tui_screens.py --binary {{ cyber }}