# Local baseline: bangso computer account, Traditional Chinese UI, sudo-capable
# desktop, rebuilt computer image. Changeable values live in .env; `make up`
# injects blanks and always rebuilds rakazo/computer:local.
#
#   make up      inject missing env, rebuild the computer image, start the stack
#   make down    stop local Postgres (keeps volumes)
#   make env     create/fill .env only
#   make image   rebuild the computer image only

.PHONY: help env image up down

help:
	@printf '%s\n' \
	  'make up      Start local BangSo (inject missing .env, rebuild computer image)' \
	  'make down    Stop local Postgres (data volumes kept)' \
	  'make env     Create .env from the example and fill blank local defaults' \
	  'make image   Rebuild rakazo/computer:local (bangso account, current password)' \
	  '' \
	  'Override blanks via .env, or once on the command line:' \
	  '  make up COMPUTER_USER_PASSWORD=secret COMPUTER_ALLOW_SUDO=1'

env:
	@test -f .env.example || { echo 'Run make from the repository root.' >&2; exit 1; }
	bash scripts/ensure-local-env.sh

image: env
	pnpm sandbox:build

up: env
	bash scripts/start-local.sh --rebuild-computer

down:
	docker compose --env-file .env -f infra/compose/docker-compose.yml stop
