set positional-arguments cargo := "rustup run stable cargo" # What coverage leaves out: the tests themselves, the harness, examples and the standard library. ignore := "(tests/|tests\\.rs|harness/|examples/|rustlib/)" # The view, into web/dist/index.html, which hud-server embeds. web: cd web && npm run build # The `hud` binary, with the view it embeds built first. build: web {{cargo}} build --release -p hud # The server at http://localhost:8787 (MCP at /mcp), built with the view. serve: web {{cargo}} run -p hud -- serve # The dev host at http://localhost:5173/dev/: the view in an iframe as an MCP Apps host shows it, its tool calls sent to `just serve`. dev: cd web && npm run dev # What a change must pass: rustfmt, clippy with warnings denied, the tests under `cov`'s gate, svelte-check, the renderer and the shell drawn on a server and hydrated (`ssr`), the shell's unit tests (`unit`), `lint` and `lex`. check: web lint lex {{cargo}} fmt --check {{cargo}} clippy --all-targets -- -D warnings just cov cd web && npm run check cd web && npm run ssr cd web && npm run unit # Every crate's tests under cargo-llvm-cov, failing under 100% of lines or functions, and naming each line no test runs. The stable toolchain's own binaries go first on the PATH: another install's rustc (Homebrew's) writes profiles that rustup's llvm-profdata refuses. Needs `cargo install cargo-llvm-cov` and `rustup component add llvm-tools-preview` once; .knotless/workflows/test.yml runs the same. cov: PATH="$(dirname "$(rustup which --toolchain stable cargo)"):$PATH" {{cargo}} llvm-cov --workspace --locked --ignore-filename-regex '{{ignore}}' --fail-under-lines 100 --fail-under-functions 100 --show-missing-lines # The workspace's components each use only their own layer and those below (harness/layers.mjs), every text colour reads at 4.5:1 in light and dark (harness/contrast.mjs), and the docs keep docs/_style.md's shape, links and punctuation (harness/docs.mjs). lint: node harness/layers.mjs node harness/contrast.mjs node harness/docs.mjs # The workspace drawn from web/dist/workspace.html in front of fixture answers, each given its `_meta.ui` by `hud resolve`, as pictures in target/look: `just look tabs --press n`. Its options are at the top of harness/look.mjs. look *args: web {{cargo}} build -p hud node harness/look.mjs "$@" # Every state of the workspace worth a look (harness/look/states.mjs), afresh in target/look; or only those named: `just looks empty badges`. looks *names: web {{cargo}} build -p hud node harness/look/states.mjs {{names}} # The landing's picture, crates/hud-server/hero/, made again: the `hero` state in every theme, two stills and one animated WebP cycling through them (harness/look/hero.mjs). Needs cwebp, img2webp and sips. hero: web {{cargo}} build -p hud node harness/look/hero.mjs # The gallery's data, target/gallery/gallery.json: every drawing HUD makes as a tile, each answer in harness/gallery/answers.json (recorded, or made up as the signed-in account) given its `_meta.ui` by `hud resolve` and held to the tree lexicon (harness/gallery/data.mjs). Record the answers again with `node harness/gallery/record.mjs []`. gallery-data: {{cargo}} build -p hud node harness/gallery/data.mjs # The trees the renderer's server test draws (web/renderer/test/ssr.mjs, `cd web && npm run ssr`), web/renderer/test/trees: Grain's screens, the gallery's recorded answers and some made of them, each given its `_meta.ui` by `hud resolve` and held to the tree lexicon (harness/ssr/data.mjs). ssr-data: {{cargo}} build -p hud node harness/ssr/data.mjs # The gallery on the web: every tile of target/gallery/gallery.json on one canvas, in front of a stand-in (harness/gallery.mjs), kept running and opened in the browser; `just gallery --shot` writes the strip's pictures to target/gallery instead. gallery *args: web gallery-data node harness/gallery.mjs "$@" # The reference PDS and a PLC on free ports, with alice, bob and carol (`.test`, password `password`), as one JSON line in target/test-net.json (harness/pds.mjs). Stop it with ctrl-c. Needs the Node .node-version names, and `cd harness && npm ci` once. pds: mkdir -p target tail -f /dev/null | node harness/pds.mjs > target/test-net.json # The workspace used against a real server (harness/e2e): a world of its own each run, the PDS, `hud serve` over it behind https, and the flows in Chromium, signing in on the PDS's own pages. Arguments go to Playwright: `just e2e -g reload`. HUD's log goes to target/e2e/hud.log. Too slow for `check`. e2e *args: web {{cargo}} build -p hud cd harness && npx playwright test -c e2e/playwright.config.mjs "$@" # The same flows against the spaces alpha (harness/spaces: `cd harness/spaces && npm ci` once), HUD keeping canvases in people's spaces (HUD_SPACES=on). e2e-spaces *args: web {{cargo}} build -p hud cd harness && HUD_DEV_ENV=harness/spaces/node_modules/@atproto/dev-env npx playwright test -c e2e/playwright.config.mjs "$@" # HUD against a PDS of its own, to try by hand: the e2e world kept running (alice, bob and carol, password `password`), and a Chromium window at the workspace that reaches it; `--spaces` on the spaces alpha, `--ios [--device ]` the iOS app too, on a simulator, built and pointed at it. Stop it with ctrl-c (harness/local.mjs). `just local-setup` once first. local *args: web {{cargo}} build -p hud node harness/local.mjs "$@" # What `just local` needs, once per checkout and Mac: the harness's packages and the spaces alpha, this checkout's own certificate authority (harness/tls.mjs, in .local/tls), and, for the simulator, which resolves names as the Mac does, `hud.harness.internal` at 127.0.0.1 in /etc/hosts (macOS asks for the password, the one time it is missing, in a dialog of its own, so it works from any terminal or agent). local-setup: cd harness && npm ci cd harness/spaces && npm ci node -e "import('./harness/tls.mjs').then((t) => console.log('authority: ' + t.certificates().ca))" grep -qE '^127\.0\.0\.1[[:space:]]+hud\.harness\.internal([[:space:]]|$)' /etc/hosts || osascript -e 'do shell script "echo \"127.0.0.1 hud.harness.internal\" >> /etc/hosts" with prompt "HUD: map hud.harness.internal to 127.0.0.1 for the local stack" with administrator privileges' # What the workspace and the server hold in memory over a session (harness/e2e/memory.spec.mjs): three canvases of public feeds, galleries, documents and players, the big feeds scrolled, the tabs switched, 200 tool calls; per stage the page's heap, DOM nodes, pictures and image memory, and the server's RSS (release build), also in target/memory/