Files
Yggdrasil/Justfile
T
Klagarge 6472890fa2 fix: self-bootstrapping shiroa, help on bare just, AGENT.md
- Justfile: pinned shiroa (v0.4.0-rc2, arch-aware) bootstrapped into
  tools/ by the 'tools' recipe; build-docs/preview-docs use it, so a
  fresh clone needs only Go and just. Bare 'just' now shows the recipe
  overview instead of starting a build.
- AGENT.md: operating rules for agents (commands, layout, security
  invariants, shiroa version-pairing trap, testing expectations).
- README: prerequisites updated (no global shiroa), bare-just behavior,
  tools/ in the layout. gitignore tools/ and docs/dist/.
2026-10-10 18:56:05 +02:00

52 lines
2.0 KiB
Makefile

# Yggdrasil: Typst documentation behind an authenticated Go server.
# Pinned shiroa toolchain, self-managed under tools/ (no global install).
# The CLI and the @preview/shiroa package version must match (see AGENT.md).
shiroa-version := "v0.4.0-rc2"
shiroa-target := if arch() == "x86_64" { "x86_64-unknown-linux-musl" } else if arch() == "aarch64" { "aarch64-unknown-linux-musl" } else { error("unsupported architecture " + arch()) }
shiroa-dir := "tools/shiroa"
shiroa-bin := shiroa-dir + "/shiroa-" + shiroa-target + "/shiroa"
shiroa-url := "https://github.com/Myriad-Dreamin/shiroa/releases/download/" + shiroa-version + "/shiroa-" + shiroa-target + ".tar.gz"
# Show the available commands.
default:
@just --list
# Build everything: acl.json, the static site, and the server binary.
build: parse build-docs build-server
# Scan docs/ for access-groups tags and regenerate acl.json.
parse:
go run ./cmd/parser -in docs -out acl.json
# Download the pinned shiroa into tools/ if missing.
tools:
@mkdir -p {{shiroa-dir}}
@test -x {{shiroa-bin}} || { echo "Downloading shiroa {{shiroa-version}} ({{shiroa-target}})..."; curl -sSL -o {{shiroa-dir}}/shiroa.tar.gz {{shiroa-url}}; tar -xzf {{shiroa-dir}}/shiroa.tar.gz -C {{shiroa-dir}}; rm {{shiroa-dir}}/shiroa.tar.gz; {{shiroa-bin}} --version; }
# Compile the Typst book into dist/.
build-docs: tools
{{shiroa-bin}} build docs --dest-dir ../dist
# Build the server binary (embeds dist/ and acl.json).
build-server:
CGO_ENABLED=0 go build -trimpath -o server ./cmd/server
# Rebuild everything and run the server locally.
run: build
./server
# Live-preview the book without authentication (shiroa dev server).
preview-docs: tools
{{shiroa-bin}} serve docs
# Run static checks and tests.
check:
go vet ./...
go test ./...
@test -z "$(gofmt -l cmd internal embed.go)" || { echo 'gofmt needed:'; gofmt -l cmd internal embed.go; exit 1; }
# Remove build artifacts (keeps tools/, the committed acl.json and dist/.gitkeep).
clean:
rm -rf dist server