use battlsnake cli from git repo and build client localy

This commit is contained in:
2026-04-03 18:37:16 +02:00
parent 8a431da014
commit a3fe386198
2 changed files with 39 additions and 7 deletions
+2
View File
@@ -7,5 +7,7 @@
__pycache__/
data/
.env
.tools/
dbschema/migrations/
*.jsonl
+36 -6
View File
@@ -12,6 +12,9 @@ set dotenv-required := true
# Use zsh
set shell := ["bash", "-cu"]
BATTLESNAKE_CLI_DIR := ".tools/battlesnake-cli"
BATTLESNAKE_CLI_BIN := ".tools/battlesnake-cli/battlesnake"
# ------------------------------------------------------------------------------
# Default
# ------------------------------------------------------------------------------
@@ -28,23 +31,50 @@ default:
run:
"{{justfile_directory()}}/main.py"
build-battlesnake-cli:
#!/usr/bin/env bash
set -euo pipefail
install_dir="{{justfile_directory()}}/{{BATTLESNAKE_CLI_DIR}}"
bin_path="{{justfile_directory()}}/{{BATTLESNAKE_CLI_BIN}}"
mkdir -p "$install_dir"
if [ ! -f "{{justfile_directory()}}/local-client/go.mod" ]; then
echo "Missing local-client source. Run: git submodule update --init --recursive"
exit 1
fi
(
cd "{{justfile_directory()}}/local-client"
go build -o "$bin_path" ./cli/battlesnake/main.go
)
"$bin_path" --help > /dev/null
echo "Built Battlesnake CLI at $bin_path"
battlesnake-cli-version:
#!/usr/bin/env bash
set -euo pipefail
"{{justfile_directory()}}/{{BATTLESNAKE_CLI_BIN}}" --help
# ------------------------------------------------------------------------------
# Testing helpers
# ------------------------------------------------------------------------------
test-constrictor:
test-constrictor: build-battlesnake-cli
#!/usr/bin/env bash
set -euo pipefail
BATTLESNAKE_CLI=battlesnake_cli_1.2.3_Linux_x86_64/battlesnake
$BATTLESNAKE_CLI play -W 11 -H 11 --name 'Python Starter Project' --url http://localhost:8000 -g constrictor --browser --minimumFood 0
BATTLESNAKE_CLI="{{justfile_directory()}}/{{BATTLESNAKE_CLI_BIN}}"
"$BATTLESNAKE_CLI" play -W 11 -H 11 --name 'Python Starter Project' --url http://localhost:8000 -g constrictor --browser --minimumFood 0
test-seed:
test-seed: build-battlesnake-cli
#!/usr/bin/env bash
set -euo pipefail
BATTLESNAKE_CLI=battlesnake_cli_1.2.3_Linux_x86_64/battlesnake
$BATTLESNAKE_CLI play -W 11 -H 11 --name 'Python Starter Project' --url http://localhost:8000 -g solo --browser --seed 1713099635738952360
BATTLESNAKE_CLI="{{justfile_directory()}}/{{BATTLESNAKE_CLI_BIN}}"
"$BATTLESNAKE_CLI" play -W 11 -H 11 --name 'Python Starter Project' --url http://localhost:8000 -g solo --browser --seed 1713099635738952360
# ------------------------------------------------------------------------------
# Fataset helpers