-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Expand file tree
/
Copy pathJustfile
More file actions
252 lines (217 loc) · 10.8 KB
/
Copy pathJustfile
File metadata and controls
252 lines (217 loc) · 10.8 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
# elizaOS Live — Justfile recipes
#
# The ISO build is containerized: any host with Docker (Linux / macOS /
# Windows WSL2 / CI) builds an identical ISO with no VM, no Vagrant, no
# host-specific setup. See build.sh / Dockerfile / build-iso.sh.
#
# The dev loop has three speeds — pick the slowest one your change needs:
#
# 1. App work (the Milady desktop) → develop the app on your host,
# normal hot-reload. Never touches the ISO. ~90% of dev time.
# 2. OS-level config (branding, → `just nspawn` — boots the built
# systemd units, hooks, files) chroot/ in seconds for non-GUI
# sanity checks. No ISO build.
# 3. Full integration test → `just binary` — incremental
# ISO rebuild (~10 min), or
# `just build` for a clean one.
#
# A cold `just build` is a once-in-a-while thing, not the dev loop.
default:
@just --list
# --- Preflight --------------------------------------------------------------
# The only host requirement is Docker — the container is the build env.
setup:
@command -v docker >/dev/null 2>&1 || { echo "Install Docker first — it is the only host requirement."; exit 1; }
@docker info >/dev/null 2>&1 || { echo "Docker is installed but not running / not accessible to this user."; exit 1; }
@echo "Docker OK — run 'just config' for a go/no-go, or 'just build' for a full ISO."
# --- Build ------------------------------------------------------------------
# Build or stage the Milady Electrobun app artifact for the ISO. If the
# existing app build is present, this only rsyncs it into live-build's
# chroot_local-includes overlay. Set ELIZAOS_BUILD_MILADY_APP=1 to allow
# this recipe to run the heavier app build when the artifact is missing.
milady-app:
#!/usr/bin/env bash
set -euo pipefail
eliza_root="$(git rev-parse --show-toplevel)"
outer_root="$(cd "${eliza_root}/.." && pwd)"
app_out="${ELIZAOS_MILADY_APP_ARTIFACT:-${eliza_root}/packages/app-core/platforms/electrobun/build/dev-linux-x64/Milady-dev}"
stage="tails/config/chroot_local-includes/usr/share/elizaos/milady-app"
ensure_plugin_runtime_dist() {
local package_rel="$1"
local mode="$2"
local package_dir="${eliza_root}/${package_rel}"
local dist_index="${package_dir}/dist/index.js"
if [ -s "${dist_index}" ]; then
return 0
fi
echo "Building ${package_rel} runtime dist for elizaOS Live"
case "${mode}" in
package-js)
( cd "${package_dir}" && bun run build:js )
;;
tsup-index)
( cd "${package_dir}" && bunx tsup src/index.ts --format esm --clean )
;;
*)
echo "Unknown runtime package build mode: ${mode}" >&2
exit 1
;;
esac
test -s "${dist_index}" || {
echo "missing ${dist_index} after runtime package build" >&2
exit 1
}
}
if [ ! -x "${app_out}/bin/launcher" ]; then
if [ "${ELIZAOS_BUILD_MILADY_APP:-0}" != "1" ]; then
echo "Milady app build not found at ${app_out}/bin/launcher"
echo "Build it separately, set ELIZAOS_MILADY_APP_ARTIFACT, or rerun with ELIZAOS_BUILD_MILADY_APP=1 to permit this recipe to build it."
exit 1
fi
echo "Milady app build not found; ELIZAOS_BUILD_MILADY_APP=1 so building it now"
( cd "${eliza_root}" && bun install --no-frozen-lockfile --ignore-scripts )
if [ -f "${outer_root}/package.json" ] && [ -d "${outer_root}/eliza" ]; then
( cd "${outer_root}" && bun install --no-frozen-lockfile --ignore-scripts )
( cd "${outer_root}" && bun install --cwd eliza --no-frozen-lockfile --ignore-scripts )
( cd "${outer_root}" && MILADY_ELIZA_SOURCE=local node scripts/setup-upstreams.mjs )
( cd "${outer_root}/eliza/packages/electrobun-carrots" && bun run build )
( cd "${outer_root}" && MILADY_ELIZA_SOURCE=local bun run build:desktop )
else
( cd "${eliza_root}" && MILADY_ELIZA_SOURCE=local node packages/app-core/scripts/setup-upstreams.mjs )
( cd "${eliza_root}/packages/electrobun-carrots" && bun run build )
( cd "${eliza_root}" && \
ELIZA_APP_NAME=Milady \
ELIZA_APP_ID=ai.milady.milady \
ELIZA_URL_SCHEME=milady \
ELIZA_NAMESPACE=milady \
bun run --cwd packages/app-core/platforms/electrobun build )
fi
fi
test -x "${app_out}/bin/launcher" || { echo "missing ${app_out}/bin/launcher"; exit 1; }
ensure_plugin_runtime_dist "plugins/plugin-health" package-js
ensure_plugin_runtime_dist "plugins/plugin-calendly" tsup-index
if [ -e "${stage}" ] && ! rm -rf "${stage}"; then
sudo -n rm -rf "${stage}"
fi
mkdir -p "${stage}"
rsync -a --delete "${app_out}/" "${stage}/"
node scripts/prepare-milady-app-overlay.mjs "${stage}"
echo "staged Milady app at ${stage}"
# Full clean ISO build → out/. ~1.5h cold, much faster once the
# apt-cacher-ng volume is warm. This is the release-quality build.
build: milady-app
./build.sh build
# Like 'build' but with low-compression squashfs — faster mksquashfs,
# larger ISO. For dev iteration when you just need a bootable image.
build-fast: milady-app
MT_FAST=1 ./build.sh build
# Low-CPU full build for hot laptops / parallel dev work. Override the
# cap with ELIZAOS_BUILD_CPUS=3 just build-cool. This defaults to
# demo-friendly docs behavior; set ELIZAOS_SKIP_WEBSITE=0 to rebuild docs.
build-cool: milady-app
#!/usr/bin/env bash
set -euo pipefail
cpus="${ELIZAOS_BUILD_CPUS:-2}"
ELIZAOS_BUILD_CPUS="${cpus}" \
ELIZAOS_MKSQUASHFS_PROCESSORS="${ELIZAOS_MKSQUASHFS_PROCESSORS:-${cpus}}" \
ELIZAOS_SKIP_WEBSITE="${ELIZAOS_SKIP_WEBSITE:-1}" \
MT_FAST=1 \
./build.sh build
# Fastest full demo build: keep the Tails OS build, low-compression ISO,
# and CPU cap, but skip rebuilding the bundled offline website/docs.
# Use release `just build` when the local Tails documentation must be exact.
build-demo: milady-app
#!/usr/bin/env bash
set -euo pipefail
cpus="${ELIZAOS_BUILD_CPUS:-2}"
ELIZAOS_BUILD_CPUS="${cpus}" \
ELIZAOS_MKSQUASHFS_PROCESSORS="${ELIZAOS_MKSQUASHFS_PROCESSORS:-${cpus}}" \
ELIZAOS_SKIP_WEBSITE=1 \
MT_FAST=1 \
./build.sh build
# Go/no-go: run only `lb config` in the container. Fast (~1 min) sanity
# check that the Tails config tree still processes cleanly.
config:
./build.sh config
# Incremental rebuild: reuse the chroot/ from the last full build and
# re-run only the squashfs + ISO assembly (~10 min). Use after editing
# overlay files. Run a full `just build` first to create the chroot/.
binary: milady-app
./build.sh binary
# Low-CPU incremental rebuild. Still requires an existing chroot/ from a
# previous full build.
binary-cool: milady-app
#!/usr/bin/env bash
set -euo pipefail
cpus="${ELIZAOS_BUILD_CPUS:-2}"
ELIZAOS_BUILD_CPUS="${cpus}" \
ELIZAOS_MKSQUASHFS_PROCESSORS="${ELIZAOS_MKSQUASHFS_PROCESSORS:-${cpus}}" \
MT_FAST=1 \
./build.sh binary
# --- Test -------------------------------------------------------------------
# Run CPU-light static checks only. No Docker, no QEMU, no ISO build.
static-smoke:
scripts/static-smoke.sh
# Boot the built chroot/ in systemd-nspawn — seconds, no QEMU. For
# non-GUI sanity (do my systemd units parse? did my file land where I
# expect? does a service start?). --volatile=overlay keeps the chroot
# read-only; all writes go to a discarded tmpfs. NOT for GUI testing —
# use `just boot` for that.
nspawn:
@test -d tails/chroot || { echo "no tails/chroot/ — run 'just build' first"; exit 1; }
sudo systemd-nspawn --boot --directory=tails/chroot \
--volatile=overlay --machine=elizaos-live-dev
# Boot the latest built ISO in QEMU. Tails stopped making the ISO
# isohybrid, so the ISO must be presented as a CD-ROM. Needs KVM.
boot:
scripts/boot-qemu.sh
# Write the latest built ISO to a removable USB device with guard rails.
usb-write device:
scripts/usb-write.sh "{{device}}"
# Write a specific ISO to a removable USB device with guard rails.
usb-write-iso device iso:
scripts/usb-write.sh "{{device}}" "{{iso}}"
# CPU-light validation for the active elizaOS Live variant.
lint:
./scripts/static-smoke.sh
test:
./scripts/static-smoke.sh
# --- CI aliases -------------------------------------------------------------
#
# The release pipeline (.github/workflows/build-linux-iso.yml) calls a fixed
# set of `iso-*` targets so a single contract spans every variant. These are
# thin wrappers around the recipes above. If a step has no underlying
# implementation in this variant it prints a clear "skipping" message and
# exits 0 — the workflow gates the corresponding step explicitly so we never
# silently pretend a missing step ran.
# Stage build inputs (Milady app rsync into chroot_local-includes).
iso-stage: milady-app
@echo "iso-stage: staged Milady app into chroot_local-includes overlay"
# Pre-cache the bundled LLM model. The milady-tails variant currently
# downloads the model from the chroot during live-build (no separate
# pre-cache step) — this is a no-op so the workflow stays uniform.
iso-cache-model:
@echo "iso-cache-model: skipping — milady-tails resolves the model inside live-build's chroot; no separate cache step"
# Pre-cache the eliza CLI binary. Same story — fetched inside live-build.
iso-cache-cli:
@echo "iso-cache-cli: skipping — milady-tails resolves the eliza CLI inside live-build's chroot; no separate cache step"
# Alias for `config` (live-build go/no-go).
iso-config: config
# Alias for `static-smoke` (pre-build sanity check).
iso-check: static-smoke
# Alias for the full ISO build.
iso-build: build
# --- Clean ------------------------------------------------------------------
# Remove build artifacts (out/ + the chroot/binary/cache trees inside
# tails/). These are root-owned (built in-container as root), so this
# needs sudo. The apt-cacher-ng volume is left alone — see cache-clean.
clean:
sudo rm -rf out tails/chroot tails/binary tails/cache tails/.build \
tails/tmp tails/chroot.files tails/*.buildlog tails/*.iso tails/*.img
@echo "Build artifacts cleared. The apt-cacher-ng cache volume is kept (run 'just cache-clean' to drop it)."
# Drop the persistent apt-cacher-ng package cache. Next build re-downloads
# everything from the network — only do this to reclaim disk or force a
# fully cold rebuild.
cache-clean:
docker volume rm elizaos-tails-acng milady-tails-acng 2>/dev/null || true
@echo "apt-cacher-ng cache volume removed."