Files
luxe/scripts/site-assets.sh
Evan Whittaker d2129a886f Luxe 0.1.3: your sessions on your phone, joinable sessions, and nested AGENTS.md
- luxe remote puts the sessions on your computer in reach of your own phone or tablet over
  Tailscale: write, steer, answer prompts, send photos, browse files, diffs and GitHub, with a
  paired device and your own Tailscale login.
- luxe join lets another program on the same machine join a running session over the RPC protocol.
- An AGENTS.md in a subfolder reaches the model the first time it works there.
- Long sessions stay fast: no stall before each model call, lighter memory, cheaper drawing.
- A session is open in one Luxe at a time, web_search shares results across its phrasings, and a
  grep glob starting with ! excludes.

The CHANGELOG has the full list.
2026-10-20 02:40:13 -05:00

221 lines
9.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Regenerate every asset the website derives from this repo.
#
# Nothing under the output directory is authored by hand: the logotype comes from the art constants,
# the color tokens from the theme JSON, and the screenshots from the production view path via the
# fixture runner. That is the point — a screenshot taken by hand is a claim about a build nobody can
# reproduce, and it starts lying the first time a border changes.
#
# Run it after anything that changes how Luxe looks, and commit the result. CI runs it with
# `--check`, which regenerates into a scratch directory and fails if the committed assets differ.
#
# The *demos* are not here and cannot be. They are recordings of real sessions against a real
# provider (`scripts/site-record.sh`), so no two runs produce the same bytes and nothing CI does
# can verify one. They live beside these, under `web/src/assets/captures/`, with a manifest saying
# what each was shot against. Everything in this directory is derived and checked; everything in
# that one is a take.
#
# Usage:
# scripts/site-assets.sh [--out DIR] [--check]
#
# --out DIR where to write (default: web/src/assets/generated)
# --check regenerate to a temp dir and diff against --out; write nothing
#
# The guide's screenshots are generated the same way, into docs/guide/images/, and checked with the
# rest.
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
out_dir="${repo_root}/web/src/assets/generated"
check=false
while [[ $# -gt 0 ]]; do
case "$1" in
--out)
out_dir="$2"
shift 2
;;
--check)
check=true
shift
;;
-h | --help)
sed -n '2,17p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
exit 0
;;
*)
echo "unknown argument: $1" >&2
exit 2
;;
esac
done
# The scenarios the site shows, and the terminal each is drawn at. Guided Review earns a wider box
# because it is a three-pane surface and a narrow capture sells it as a diff viewer. The dashboard
# is first because it is the first thing anyone sees, and it went uncaptured for far too long.
#
# The GitHub review surfaces are the landing page's, each twice: at the width a laptop shows and at
# the width a phone can read, which lays the same review out as one pane. So is peek, once wide
# enough to sit beside the conversation and once narrow enough to take its place, at the same
# aspect (172x50 against 110x32) so switching between the two does not jolt the page. The optional
# fourth field names the file when one scenario is drawn at two sizes, and the fifth opens a state
# over it, by the names `fixture_svg --overlay` takes (`/github` and `/pr` live there).
#
# <fixture scenario>:<cols>:<rows>[:<name>[:<overlay>]]
SHOTS=(
"dashboard:150:36"
"chat-tools:150:40"
"chat-streaming:150:36"
"chat-thinking:150:34"
"chat-question:150:34"
"guided-review-demo:180:44"
"changes-wide:240:40"
"dock-wide:170:42"
"session-picker:150:36"
"guided-review-pull-request:150:42"
"guided-review-pull-request:72:30:guided-review-pull-request.narrow"
"guided-review-pull-request-post:150:42"
"guided-review-pull-request-post:72:30:guided-review-pull-request-post.narrow"
"changes-wide:172:50:peek-beside"
"changes-narrow:110:32:peek-over"
"chat-idle:140:34:github-overview:github"
"chat-idle:72:30:github-overview.narrow:github-detail"
"chat-idle:140:34:github-conversation:github-conversation"
"chat-idle:72:30:github-conversation.narrow:github-conversation"
)
# The guide's screenshots, drawn narrower than the site's: the docs column is about 830px, and a
# 100-column capture keeps the type readable in it. Same fields; the name is required.
GUIDE_SHOTS=(
"dashboard:100:26:quickstart-dashboard"
"setup:110:34:quickstart-setup"
"dashboard-typing:100:28:interface-launcher-typing"
"dashboard-minimal:100:20:interface-launcher-minimal"
"settings-tools:120:36:configuration-settings"
"configuration:100:26:quickstart-configuration"
"chat-tool-run:100:22:quickstart-turn"
"guided-review-demo:110:34:quickstart-review"
"guided-review-open-pull-request:100:30:quickstart-pull-request"
"changes-wide:140:36:interface-peek"
"guided-review-demo:140:40:review-guide"
"guided-review-finish:110:26:review-finish"
"guided-review-pull-request:140:40:review-pull-request"
"chat-idle:140:34:github-overview:github"
"chat-idle:140:34:github-search:github-search"
"chat-idle:140:34:github-conversation:github-conversation"
"chat-question:100:22:agent-question"
"chat-turn:100:36:interface-turn"
"chat-permission:100:24:security-permission-prompt"
"chat-palette:100:30:commands-palette"
"chat-idle:100:22:mentions-picker:mention-files-status"
"session-picker:100:28:sessions-picker"
"chat-plan-ready:100:26:loop-plan-ready"
)
guide_dir="${repo_root}/docs/guide/images"
# The phone app's wordmark, from the same art. The app has no build step, so it ships the file
app_dir="${repo_root}/crates/luxe-remote/app/generated"
# Luxe's own theme, the one the site is set in. The colors are baked into each file rather than left
# as custom properties, so a capture stays correct wherever it is embedded — a README, someone's
# blog. The theme preview is the one picture drawn in every theme, below.
THEMES=("luxe")
# The figures the landing page quotes, derived rather than typed.
#
# Only the ones that change with the thing they describe: the theme count moves when a theme ships,
# and the catalog moves when the models.dev snapshot is refreshed, which regenerates this in the
# same pull request. A test total used to live here too, and it made every pull request that added a
# test fail this check until someone regenerated a number the page barely needed.
facts() {
python3 -c "import gzip,json,sys
catalog = json.load(gzip.open('${repo_root}/crates/luxe-providers/data/models-dev-snapshot.json.gz'))
print(json.dumps({
'themes': len(json.load(open('${1}/themes.json'))),
'providers': len(catalog),
'models': sum(len(p.get('models', {})) for p in catalog.values()),
}, indent=2))"
}
fixture() { cargo run --quiet --release -p luxe-tui --features fixture --example fixture_svg -- "$@"; }
wordmark() { cargo run --quiet --release -p luxe-tui --example wordmark_svg -- "$@"; }
tokens() { cargo run --quiet --release -p luxe-tui --example theme_css; }
catalog() { cargo run --quiet --release -p luxe-tui --example theme_css -- --json; }
shiki() { cargo run --quiet --release -p luxe-tui --example shiki_theme -- "$@"; }
# The README's wordmark, animated as the terminal lights it, transparent for GitHub's light and dark
# pages alike. Two variants: a light page washes the shine out sooner, so it gets the gentler one
wordmark_gif() { cargo run --quiet --release -p luxe-tui --example wordmark_gif -- "$@"; }
generate() {
local target="$1" guide_target="$2" app_target="$3"
mkdir -p "${target}" "${guide_target}" "${app_target}"
wordmark app >"${app_target}/wordmark.svg"
wordmark wordmark >"${target}/wordmark.svg"
wordmark mark >"${target}/mark.svg"
wordmark tile >"${target}/tile.svg"
tokens >"${target}/tokens.css"
wordmark_gif dark >"${target}/wordmark-dark.gif"
wordmark_gif light >"${target}/wordmark-light.gif"
catalog >"${target}/themes.json"
facts "${target}" >"${target}/facts.json"
shiki luxe >"${target}/shiki-luxe.json"
local shot theme scenario cols rows name
for shot in "${SHOTS[@]}"; do
IFS=: read -r scenario cols rows name overlay <<<"${shot}"
for theme in "${THEMES[@]}"; do
fixture --theme "${theme}" --scenario "${scenario}" \
--cols "${cols}" --rows "${rows}" ${overlay:+--overlay "${overlay}"} \
>"${target}/${name:-${scenario}}.${theme}.svg"
done
done
# The theme preview: the dashboard, once, in every built-in theme. Each color in it is a CSS
# variable and `theme-preview.json` says what each one is per theme, so the page can repaint the
# real UI as a reader points at a theme instead of shipping twelve copies of one picture. The
# shipped theme leads, so its colors are the fallbacks when no palette has been applied.
local palette
palette="$(python3 -c "
import json, sys
names = sorted(json.load(open(sys.argv[1])))
names.remove('luxe')
print(','.join(['luxe'] + names))
" "${target}/themes.json")"
fixture --scenario dashboard --cols 150 --rows 36 --palette "${palette}" \
--palette-json "${target}/theme-preview.json" >"${target}/theme-preview.svg"
for shot in "${GUIDE_SHOTS[@]}"; do
IFS=: read -r scenario cols rows name overlay <<<"${shot}"
fixture --theme luxe --scenario "${scenario}" --cols "${cols}" --rows "${rows}" \
${overlay:+--overlay "${overlay}"} >"${guide_target}/${name}.svg"
done
}
# One release build up front. Every generator is a separate `cargo run`, and letting each discover
# that for itself turns a five-second job into a minute of cargo deciding it has nothing to do.
cargo build --quiet --release -p luxe-tui --features fixture \
--example fixture_svg --example wordmark_svg --example wordmark_gif --example theme_css \
--example shiki_theme
if [[ "${check}" == true ]]; then
scratch="$(mktemp -d)"
trap 'rm -rf "${scratch}"' EXIT
generate "${scratch}/site" "${scratch}/guide" "${scratch}/app"
if diff -ru "${out_dir}" "${scratch}/site" && diff -ru "${guide_dir}" "${scratch}/guide" &&
diff -ru "${app_dir}" "${scratch}/app"; then
echo "site assets are up to date"
else
echo >&2
echo "site assets are stale — run scripts/site-assets.sh and commit the result" >&2
exit 1
fi
exit 0
fi
generate "${out_dir}" "${guide_dir}" "${app_dir}"
printf '%s\n' "wrote $(find "${out_dir}" -type f | wc -l) files to ${out_dir}"
du -sh "${out_dir}" | cut -f1 | xargs -I{} echo "total {} on disk, and they gzip to about a tenth of that"