Files
luxe/scripts/remote-vendor.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

57 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Vendor the phone app's view library: Preact, its hooks, htm, and Preact Signals.
#
# The app has no build step, so these ship as the packages publish them, byte for byte, and the
# browser resolves their bare imports (`from "preact"`) through the page's import map. Each file's
# SHA-256 goes into `manifest.json`, and a test in `luxe-remote` holds the embedded files to it, so
# an edit to a vendored file fails the build instead of shipping as "Preact 11.0.1".
#
# To update: change a version below, run this, then check the app still boots. The same versions go
# in crates/luxe-remote/app-tests/package.json, whose type declarations check the app; a test there
# holds the two together.
#
# Requires: npm (only to fetch; nothing is installed). Usage: scripts/remote-vendor.sh
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
out_dir="${repo_root}/crates/luxe-remote/app/vendor"
work_dir="$(mktemp -d)"
trap 'rm -rf "${work_dir}"' EXIT
# package@version, the file inside the package, and the name it is served under
files=(
"preact@11.0.1 dist/preact.mjs preact.mjs"
"preact@11.0.1 hooks/dist/hooks.mjs hooks.mjs"
"htm@3.1.1 dist/htm.mjs htm.mjs"
"@preact/signals-core@1.14.4 dist/signals-core.mjs signals-core.mjs"
"@preact/signals@2.11.3 dist/signals.mjs signals.mjs"
)
fetch() {
local spec="$1" dir="${work_dir}/$1"
if [[ ! -d "${dir}" ]]; then
mkdir -p "${dir}"
(cd "${dir}" && npm pack --silent "${spec}" >/dev/null && tar xzf ./*.tgz)
fi
echo "${dir}/package"
}
rm -rf "${out_dir}"
mkdir -p "${out_dir}/licenses"
manifest="["
for line in "${files[@]}"; do
read -r spec inner served <<<"${line}"
package_dir="$(fetch "${spec}")"
cp "${package_dir}/${inner}" "${out_dir}/${served}"
name="${spec%@*}"
slug="${name#@}"
cp "${package_dir}/LICENSE" "${out_dir}/licenses/${slug//\//-}.txt"
license="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["license"])' "${package_dir}/package.json")"
sha="$(sha256sum "${out_dir}/${served}" | cut -d' ' -f1)"
manifest+="
{\"file\": \"${served}\", \"package\": \"${name}\", \"version\": \"${spec##*@}\", \"from\": \"${inner}\", \"license\": \"${license}\", \"sha256\": \"${sha}\"},"
done
printf '%s\n]\n' "${manifest%,}" >"${out_dir}/manifest.json"
echo "vendored ${#files[@]} files into ${out_dir#"${repo_root}/"}"