-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathjustfile
More file actions
309 lines (247 loc) · 10.1 KB
/
justfile
File metadata and controls
309 lines (247 loc) · 10.1 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# Development commands
# Install just: ./init-cloud-env.sh (pre-built) or cargo install just
# Usage: just <recipe> (or: just --list)
# Default: show available commands
default:
@just --list
# === Build & Test ===
# Build all crates
build:
cargo build
# Run all tests (including fail-point tests)
test:
cargo test --features http_client
cargo test --features failpoints --test security_failpoint_tests -- --test-threads=1
# Run fail-point tests only (single-threaded, requires failpoints feature)
test-failpoints:
cargo test --features failpoints --test security_failpoint_tests -- --test-threads=1
# Run formatters and linters (auto-fix)
fmt:
cargo fmt
cargo clippy --all-targets --fix --allow-dirty --allow-staged 2>/dev/null || true
# Run format, lint, and test checks
check:
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test
# Lint and format-check Python bindings
python-lint:
ruff check crates/bashkit-python
ruff format --check crates/bashkit-python
# Run all pre-PR checks
pre-pr: check vet
@echo "Pre-PR checks passed"
# Run all pre-PR checks plus strict host-bash parity
pre-pr-strict: pre-pr check-bash-compat
@echo "Strict pre-PR checks passed"
# Check spec tests against real bash
check-bash-compat:
./scripts/update-spec-expected.sh
# Check spec tests against real bash (verbose)
check-bash-compat-verbose:
./scripts/update-spec-expected.sh --verbose
# Generate comprehensive compatibility report
compat-report:
cargo test --test spec_tests -- compatibility_report --ignored --nocapture
# Run differential fuzzing tests (grammar-based proptest)
fuzz-diff:
cargo test --test proptest_differential -- --nocapture
# Run differential fuzzing with more iterations
fuzz-diff-deep:
PROPTEST_CASES=500 cargo test --test proptest_differential -- --nocapture
# Clean build artifacts
clean:
cargo clean
# === Run ===
# Run the CLI
run *args:
cargo run -p bashkit-cli -- {{args}}
# Run REPL
repl:
cargo run -p bashkit-cli -- repl
# Run a script file
run-script file:
cargo run -p bashkit-cli -- run {{file}}
# === Benchmarks ===
# Run benchmarks comparing bashkit to bash
bench:
cargo run -p bashkit-bench --release
# Run benchmarks and save results to JSON
bench-save file="bench-results.json":
cargo run -p bashkit-bench --release -- --save {{file}}
# Run benchmarks with verbose output
bench-verbose:
cargo run -p bashkit-bench --release -- --verbose
# Run specific benchmark category (startup, variables, arithmetic, control, strings, arrays, pipes, tools, complex)
bench-category cat:
cargo run -p bashkit-bench --release -- --category {{cat}}
# Run benchmarks with more iterations for accuracy
bench-accurate:
cargo run -p bashkit-bench --release -- --iterations 50 --warmup 5
# List available benchmarks
bench-list:
cargo run -p bashkit-bench --release -- --list
# Run benchmarks with all runners (including just-bash if available)
bench-all:
cargo run -p bashkit-bench --release -- --runners bashkit,bash,just-bash
# Run Criterion parallel_execution benchmark and save results
bench-parallel:
./scripts/bench-parallel.sh
# === Eval ===
# Run LLM eval (requires ANTHROPIC_API_KEY or OPENAI_API_KEY)
eval dataset="crates/bashkit-eval/data/eval-tasks.jsonl" provider="anthropic" model="claude-sonnet-4-20250514":
cargo run -p bashkit-eval --release -- run --dataset {{dataset}} --provider {{provider}} --model {{model}}
# Run eval and save results
eval-save dataset="crates/bashkit-eval/data/eval-tasks.jsonl" provider="anthropic" model="claude-sonnet-4-20250514":
cargo run -p bashkit-eval --release -- run --dataset {{dataset}} --provider {{provider}} --model {{model}} --save
# Run scripting-tool eval (scripted mode)
eval-scripting dataset="crates/bashkit-eval/data/scripting-tool/many-tools.jsonl" provider="openai" model="gpt-5.4":
cargo run -p bashkit-eval --release -- run --eval-type scripting-tool --dataset {{dataset}} --provider {{provider}} --model {{model}}
# Run scripting-tool eval (baseline mode — individual tools, no ScriptedTool)
eval-scripting-baseline dataset="crates/bashkit-eval/data/scripting-tool/many-tools.jsonl" provider="openai" model="gpt-5.4":
cargo run -p bashkit-eval --release -- run --eval-type scripting-tool --baseline --dataset {{dataset}} --provider {{provider}} --model {{model}}
# Run scripting-tool eval and save results
eval-scripting-save dataset="crates/bashkit-eval/data/scripting-tool/many-tools.jsonl" provider="openai" model="gpt-5.4":
cargo run -p bashkit-eval --release -- run --eval-type scripting-tool --dataset {{dataset}} --provider {{provider}} --model {{model}} --save
# === Security ===
# Run supply chain audit (cargo-vet)
vet:
cargo vet
# Suggest crates to audit
vet-suggest:
cargo vet suggest
# Certify a crate after audit
vet-certify crate version:
cargo vet certify {{crate}} {{version}}
# === Nightly CI ===
# Check that recent nightly and fuzz CI runs are green (requires gh CLI)
check-nightly:
#!/usr/bin/env bash
set -euo pipefail
echo "Checking nightly CI status..."
failed=0
for workflow in nightly.yml fuzz.yml; do
name=$(echo "$workflow" | sed 's/\.yml//')
echo ""
echo "=== $name ==="
conclusions=$(gh run list --workflow="$workflow" --limit 3 --json conclusion --jq '.[].conclusion')
i=0
for c in $conclusions; do
i=$((i + 1))
if [ "$c" = "success" ]; then
echo " Run $i: ok"
else
echo " Run $i: FAILED ($c)"
failed=$((failed + 1))
fi
done
if [ "$i" -eq 0 ]; then
echo " WARNING: no runs found (is gh authenticated?)"
fi
done
echo ""
if [ "$failed" -gt 0 ]; then
echo "ERROR: $failed nightly run(s) failed in last 3 runs."
echo "Inspect with: gh run list --workflow=<workflow>.yml --limit 5"
echo "Do NOT release with red nightly jobs."
exit 1
fi
echo "Nightly CI: all recent runs green."
# === Release ===
# Prepare a release (update version, remind to edit changelog)
release-prepare version:
#!/usr/bin/env bash
set -euo pipefail
echo "Preparing release v{{version}}..."
# Update workspace version
sed -i 's/^version = ".*"/version = "{{version}}"/' Cargo.toml
# Verify the change
echo "Updated Cargo.toml workspace version to {{version}}"
grep '^version' Cargo.toml | head -1
# Remind to update changelog
echo ""
echo "Next steps:"
echo "1. Edit CHANGELOG.md to add release notes for {{version}}"
echo "2. Run: just release-check"
echo "3. Run: just release-tag {{version}}"
# Verify release is ready
release-check:
#!/usr/bin/env bash
set -euo pipefail
echo "Running release checks..."
# Run pre-PR checks
just pre-pr
# Check nightly CI jobs (last 3 runs must be green)
just check-nightly
# Match publish.yml locally: strip git-only publish blockers, dry-run, restore.
TMPDIR=$(mktemp -d)
LOCKFILE=Cargo.lock
BASHKIT_TOML=crates/bashkit/Cargo.toml
CLI_TOML=crates/bashkit-cli/Cargo.toml
JS_TOML=crates/bashkit-js/Cargo.toml
PY_TOML=crates/bashkit-python/Cargo.toml
cp "$LOCKFILE" "$TMPDIR/Cargo.lock"
cp "$BASHKIT_TOML" "$TMPDIR/bashkit.Cargo.toml"
cp "$CLI_TOML" "$TMPDIR/bashkit-cli.Cargo.toml"
cp "$JS_TOML" "$TMPDIR/bashkit-js.Cargo.toml"
cp "$PY_TOML" "$TMPDIR/bashkit-python.Cargo.toml"
trap 'cp "$TMPDIR/Cargo.lock" "$LOCKFILE"; \
cp "$TMPDIR/bashkit.Cargo.toml" "$BASHKIT_TOML"; \
cp "$TMPDIR/bashkit-cli.Cargo.toml" "$CLI_TOML"; \
cp "$TMPDIR/bashkit-js.Cargo.toml" "$JS_TOML"; \
cp "$TMPDIR/bashkit-python.Cargo.toml" "$PY_TOML"; \
rm -rf "$TMPDIR"' EXIT
perli() {
perl -0pi.bak -e "$1" "$2"
rm -f "$2.bak"
}
# --- bashkit core: remove monty dep and python feature ---
perli 's/^monty = .*?\n//m' "$BASHKIT_TOML"
perli 's/^python = \["dep:monty"\]\n//m' "$BASHKIT_TOML"
perli 's/\n\[\[example\]\]\nname = "python_scripts"\nrequired-features = \["python"\]\n//g' "$BASHKIT_TOML"
perli 's/\n\[\[example\]\]\nname = "python_external_functions"\nrequired-features = \["python"\]\n//g' "$BASHKIT_TOML"
# --- bashkit-cli: remove python feature ---
perli 's/^python = \["bashkit\/python"\]\n//m' "$CLI_TOML"
perli 's/, "python"//g; s/"python", //g; s/\["python"\]/[]/g' "$CLI_TOML"
# --- bashkit-js/bashkit-python: remove python from features list ---
perli 's/, "python"//g; s/"python", //g' "$JS_TOML"
perli 's/, "python"//g; s/"python", //g' "$PY_TOML"
# Dry-run publish
echo ""
echo "Dry-run publish bashkit..."
cargo publish -p bashkit --dry-run --allow-dirty
echo ""
echo "Dry-run publish bashkit-cli..."
# bashkit-cli verifies against the registry package of bashkit.
# Before the matching bashkit release is published, local dry-run cannot
# compile that packaged dependency graph. The real publish workflow keeps
# verification enabled after bashkit is live on crates.io.
cargo publish -p bashkit-cli --dry-run --allow-dirty --no-verify
echo ""
echo "All release checks passed!"
# Create and push release tag
release-tag version:
#!/usr/bin/env bash
set -euo pipefail
# Verify version matches Cargo.toml
CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
if [ "{{version}}" != "$CARGO_VERSION" ]; then
echo "Error: Requested version ({{version}}) does not match Cargo.toml version ($CARGO_VERSION)"
echo "Run: just release-prepare {{version}}"
exit 1
fi
# Check for uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
echo "Error: Uncommitted changes detected. Commit all changes before tagging."
git status --short
exit 1
fi
# Create tag
echo "Creating tag v{{version}}..."
git tag -a "v{{version}}" -m "Release v{{version}}"
# Push tag
echo "Pushing tag to origin..."
git push origin "v{{version}}"
echo ""
echo "Release v{{version}} tagged and pushed!"
echo "CI will now publish to crates.io"