-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
234 lines (194 loc) · 7.08 KB
/
Copy pathjustfile
File metadata and controls
234 lines (194 loc) · 7.08 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
# PixeLAW Core Justfile
#
# Docker Images:
# just docker-build-base Build base image (toolchain only)
# just docker-build-core Build core image (contracts migrated)
# just docker-build-populated Build populated image (with pixel art)
#
# Development:
# just up Start local environment (docker-compose)
# just down Stop local environment
# just build Build contracts
# just test Run tests
# just docker-test Run tests using Docker (sozo 1.8.5)
#
# Deployment:
# just deploy-sepolia Deploy to Sepolia testnet
# just deploy-slot NAME Deploy to Cartridge Slot
set dotenv-load := true
set dotenv-path := "./.account"
# Repository configuration
repo := "ghcr.io/pixelaw/core"
base_repo := "ghcr.io/pixelaw/base"
core_version := `cat VERSION`
dojo_version := `cat DOJO_VERSION`
dojo_world_address := `cat DOJO_WORLD_ADDRESS`
# ==============================================================================
# Docker Image Builds
# ==============================================================================
# Build base image (Dojo toolchain only)
docker-build-base:
docker build -f base.Dockerfile \
-t {{ base_repo }}:{{ dojo_version }} \
-t {{ base_repo }}:latest \
--progress=plain .
# Build core image (contracts compiled and migrated)
docker-build-core:
docker build \
-t {{ repo }}:{{ core_version }} \
-t {{ repo }}:latest \
--secret id=DOJO_KEYSTORE_PASSWORD \
--network=host \
--progress=plain .
# Build populated image (with pixel art data)
docker-build-populated:
docker build -f populate.Dockerfile \
-t {{ repo }}:{{ core_version }}-populated \
-t {{ repo }}:latest-populated \
--network=host \
--progress=plain .
# Build all images in sequence
docker-build-all: docker-build-base docker-build-core docker-build-populated
# ==============================================================================
# Docker Runtime
# ==============================================================================
# Start docker-compose services
up:
docker compose up -d
# Stop docker-compose services
down:
docker compose down
# View docker-compose logs
logs:
docker compose logs -f
# Access running container shell
shell:
docker compose exec pixelaw-core bash
# Run Docker container standalone (without docker-compose)
docker-run:
docker run \
--name pixelaw \
--rm \
-ti \
-p 5050:5050 -p 8080:8080 \
-e DOJO_WORLD_ADDRESS={{ dojo_world_address }} \
-e WORLD_ID=local \
-e RPC_URL=http://127.0.0.1:5050 \
{{ repo }}:{{ core_version }}
# Run Docker container with bash shell
docker-bash:
docker run \
--name pixelaw \
--rm \
-ti \
-p 5050:5050 -p 8080:8080 \
-e DOJO_WORLD_ADDRESS={{ dojo_world_address }} \
-e WORLD_ID=local \
-e RPC_URL=http://127.0.0.1:5050 \
{{ repo }}:{{ core_version }} \
/bin/bash
# ==============================================================================
# Contract Development
# ==============================================================================
# Build contracts
build:
cd contracts && scarb fmt && sozo build
# Run contract tests
test:
cd contracts && scarb fmt && sozo test
# Run filtered contract tests
test_filtered filter:
cd contracts && scarb fmt && sozo test --filter {{ filter }}
# Build contracts using Docker
docker-build-contracts:
docker run --rm \
--entrypoint sozo \
-e HOME=/tmp \
-v {{ justfile_directory() }}/contracts:/pixelaw/contracts \
-v {{ justfile_directory() }}/pixelaw_test_utils:/pixelaw/pixelaw_test_utils \
-w /pixelaw/contracts \
{{ repo }}:latest \
build
# Run contract tests using Docker
docker-test:
docker run --rm \
--entrypoint sozo \
-e HOME=/tmp \
-v {{ justfile_directory() }}/contracts:/pixelaw/contracts \
-v {{ justfile_directory() }}/pixelaw_test_utils:/pixelaw/pixelaw_test_utils \
-w /pixelaw/contracts \
{{ repo }}:latest \
test
# Run filtered contract tests using Docker
docker-test-filtered filter:
docker run --rm \
--entrypoint sozo \
-e HOME=/tmp \
-v {{ justfile_directory() }}/contracts:/pixelaw/contracts \
-v {{ justfile_directory() }}/pixelaw_test_utils:/pixelaw/pixelaw_test_utils \
-w /pixelaw/contracts \
{{ repo }}:latest \
test --filter {{ filter }}
# ==============================================================================
# Deployment
# ==============================================================================
# Deploy to Sepolia testnet
deploy-sepolia:
scripts/deploy/sepolia.sh
# Deploy to Cartridge Slot
deploy-slot name:
scripts/deploy/slot.sh {{ name }}
# ==============================================================================
# Claude Code
# ==============================================================================
claude:
#!/usr/bin/env bash
set -a
source .claude.env
set +a
PROMPT=$(cat .claude.prompt)
clear && claude \
--dangerously-skip-permissions \
--append-system-prompt "$PROMPT"
# Start tmux with 4 Claude Code panes (or reattach if exists)
claude4:
#!/usr/bin/env bash
SESSION="claude-4"
# If session exists, just reattach
if tmux has-session -t "$SESSION" 2>/dev/null; then
echo "Reattaching to existing session..."
tmux attach-session -t "$SESSION"
exit 0
fi
# Create new session with first pane (100k line scrollback, mouse enabled)
tmux new-session -d -s "$SESSION" -c "{{ justfile_directory() }}"
tmux set-option -t "$SESSION" history-limit 100000
tmux set-option -t "$SESSION" mouse on
# Clean status bar showing full cwd
tmux set-option -t "$SESSION" status-left ""
tmux set-option -t "$SESSION" status-right " #{pane_current_path} "
tmux set-option -t "$SESSION" status-right-length 100
# Pane borders with numbers
tmux set-option -t "$SESSION" pane-border-status top
tmux set-option -t "$SESSION" pane-border-format " #{pane_index} "
# Highlight active pane border
tmux set-option -t "$SESSION" pane-active-border-style "fg=cyan,bold"
# Alt+arrow to switch panes without prefix
tmux bind-key -n M-Left select-pane -L
tmux bind-key -n M-Right select-pane -R
tmux bind-key -n M-Up select-pane -U
tmux bind-key -n M-Down select-pane -D
# Alt+z to zoom (fullscreen) current pane
tmux bind-key -n M-z resize-pane -Z
# Create 3 more panes
tmux split-window -t "$SESSION" -c "{{ justfile_directory() }}"
tmux split-window -t "$SESSION" -c "{{ justfile_directory() }}"
tmux split-window -t "$SESSION" -c "{{ justfile_directory() }}"
# Arrange as 2x2 grid
tmux select-layout -t "$SESSION" tiled
# Start claude in each pane
for pane in 0 1 2 3; do
tmux send-keys -t "$SESSION:0.$pane" "just claude" Enter
done
# Attach to session
tmux attach-session -t "$SESSION"