-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
120 lines (88 loc) · 4.16 KB
/
justfile
File metadata and controls
120 lines (88 loc) · 4.16 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
# vers-agent justfile
default:
@just --list
# ── Setup ─────────────────────────────────────────────────────────────────────
# Install dependencies and git hooks
install:
bun install
@just setup-hooks
setup-hooks:
@cp .githooks/pre-commit .git/hooks/pre-commit 2>/dev/null || true
@chmod +x .git/hooks/pre-commit 2>/dev/null || true
# ── Development ───────────────────────────────────────────────────────────────
dev:
bun run dev
build:
bun run build
typecheck:
bun run typecheck
test:
bun test tests/agents tests/cli tests/client tests/core tests/integration tests/protocol tests/server tests/utils tests/session-sync.test.ts
check: typecheck test
# ── Run ───────────────────────────────────────────────────────────────────────
server:
./vers-agent --server
cli:
./vers-agent --cli
# ── Docker ────────────────────────────────────────────────────────────────────
docker-up:
docker compose up --build
docker-down:
docker compose down
docker-test:
#!/usr/bin/env bash
set -e
rm -f /tmp/.vers-agent-test-token
docker compose -f docker-compose.test.yml down -v 2>/dev/null || true
docker compose -f docker-compose.test.yml up -d --build
echo "Waiting for server..."
for i in {1..30}; do
docker compose -f docker-compose.test.yml ps | grep -q healthy && break
sleep 2
[ $i -eq 30 ] && { docker compose -f docker-compose.test.yml logs; exit 1; }
done
bun run build
DOCKER_SERVER_URL=http://localhost:19999 bun test tests/docker/
docker compose -f docker-compose.test.yml down -v
rm -f /tmp/.vers-agent-test-token
# ── Nix ───────────────────────────────────────────────────────────────────────
# Update the node_modules hash in flake.nix
# Note: Local bun may differ from nixpkgs bun, so if nix build fails with
# hash mismatch, use the hash from the error message instead
nix-hash:
#!/usr/bin/env bash
set -e
echo "Computing node_modules hash..."
echo "(Note: If nix build fails with hash mismatch, use the hash from the error)"
echo ""
# Create temp directory and install deps
tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT
cp package.json bun.lock "$tmpdir/"
cd "$tmpdir"
HOME=/tmp/bun-hash-home bun install --frozen-lockfile 2>/dev/null
# Compute the hash of node_modules
hash=$(nix --extra-experimental-features nix-command hash path --type sha256 --base64 node_modules)
sri_hash="sha256-$hash"
echo "New hash: $sri_hash"
# Update flake.nix
cd "{{justfile_directory()}}"
sed -i.bak "s|outputHash = \"sha256-.*\";|outputHash = \"$sri_hash\";|" flake.nix
rm -f flake.nix.bak
echo "Updated flake.nix with new hash"
# Build with nix
nix-build:
nix --extra-experimental-features 'nix-command flakes' build
# ── Utilities ─────────────────────────────────────────────────────────────────
clean:
rm -rf dist/ vers-agent
# Reset everything if something gets stuck
nuke port="9999":
@lsof -ti:{{port}} | xargs kill -9 2>/dev/null || true
@sqlite3 ~/.vers-agent/auth.db "UPDATE server_claim SET claimed_at = NULL, token_hash = NULL, client_id = NULL WHERE id = 1" 2>/dev/null || true
@rm -f ~/.vers-agent/tokens.json
@echo "Reset complete"
# Full reset including node_modules
pristine: clean
rm -rf node_modules ~/.vers-agent
@echo "Run: just install && just build"