Skip to content
FunCoding

demos-dev-loop

Build, hot-reload, test and check the Demos Exact app (the root of the demos repo; the original React Native app is in .legacy/) on the web and the iOS simulator. Use before any build, test run or simulator check here.

Star
3,258
Last commit
Nov 29, 2026

.claude/skills/demos-dev-loop/SKILL.md

View on GitHub

Demos dev loop

# from the repo root (the Exact app; the RN app is .legacy/)
export PATH=~/.bun-1.4.2/bin:~/.cargo/bin:$PATH
export CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
export EXACT_SIM=4287A1AF-1C48-462C-9E3D-3FAABC3F0119   # iPhone Air, iOS 27.1: this app's sim
bun exact.mjs contract build app.contract --json --errors-only   # [] = no errors (~1 s)
bun exact.mjs test web 'demos/**/*.test.contract' app.test.contract
bun exact.mjs ios --run --sim $EXACT_SIM                         # native build + launch

On a physical iPhone

  • bun exact.mjs phone [<udid|name>] [--run]: a development build signed with this Mac's Apple Development identity (wildcard profile W3N4N47454.*), installed with devicectl. The phone must be connected, unlocked, paired, Developer Mode on. share works again since exact2 730abad1 (expo/exact#30 fixed upstream); phone stays the cable route.

Phone loop: hot reload + feedback

The owner tests on the phone; every .contract / app.ts edit reaches it live, so a native build is rare and batched (one, by the integrator, for everyone's Swift / Rust / app.json changes).

  1. The dev server on the LAN: nohup bun exact.mjs web --port 5341 --lan > /tmp/demos-dev-lan.log 2>&1 & (one loop per app dir: stop a loopback-only one first; --lan still answers on 127.0.0.1).
  2. The feedback server on the LAN: bun .parity/feedback/server.ts (once: cd .parity && bun install, for sharp) binds 0.0.0.0:5350 and prints phone: http://<mac ip>:5350.
  3. The development build, connected to that server: bun exact.mjs phone <udid> --run --url http://<mac ip>:5341 (the Mac's IP: ipconfig getifaddr en0). tools/phone.mjs also bakes the Mac's addresses into feedback-host/mac.json (gitignored) for the feedback sheet. Saved edits then reload on the phone; the log shows the device's requests.
  4. phone <udid> --run --release is for performance checks only: no dev server, no hot reload.

Feedback from the phone (modules/apple/Feedback.swift): in any open demo, shake the phone or long-press with two fingers. The sheet has the demo's name and slug, a screenshot taken at the trigger (tap it to mark a point), quick commands (📸 Screenshot, 🎬 Record 5 s, 🔁 Same as RN?, ✅ Looks good), a text note (dictation works) with Send, and the demo's last 3 notes. Each command is a POST /phone (.parity/feedback/phone.ts): one line of .parity/feedback/data/inbox.jsonl with source: "phone" and kind note | screenshot | clip | approve | parity, media in .parity/feedback/data/phone/, a note also in data/<slug>.json (bun .parity/feedback/list.ts). Undelivered commands queue on the phone and retry every 20 s. Override the Mac without a rebuild: launch argument -feedbackHost <ip[:port]>.

Hot reload first

  • Keep one development build installed on your simulator. An edit to any .contract, to app.ts or what it imports reaches it only when you run bun exact.mjs ios --run --sim <udid> again: it skips the native build and pushes the new plan (about 15 s). The web dev server (exact.mjs web, e.g. :5203) does not reload the iOS app.
  • Rebuild natively only for Rust (gpu/), Swift, app.json, assets/ (icons, images), fonts or grants. Batch them and build once (warm: 1–2 min; first: many minutes).
  • One build at a time: pgrep -f "exact.mjs ios" empty first; df -h ~ above 8 GB.
  • Fonts: SF Pro Rounded is the generic ui-rounded on Apple: no bundled file needed.

Machine rules

  • Several agents share this tree: never run cargo fmt (it rewrites every file), git stash, or git checkout/restore on files you didn't write. Format only your own files (rustfmt gpu/src/<slug>.rs); commit only your own hunks.
  • Commit through a private index (GIT_INDEX_FILE=$(mktemp) seeded with git read-tree HEAD), then git reset -q -- <your paths> in the shared index: otherwise the shared index keeps your paths' old content staged and the next agent's commit reverts your work.
  • Metro 8082 (RN reference) is the integrator's; watchman is broken on this machine, so if RN edits stop reaching the app, tell the integrator (restart with --clear).
  • Simulators: this app uses only $EXACT_SIM. Never touch "Exact Try (Air)" (D3273441…), "RN Ref (Air)" (FF41FAED…) nor the patterns-exact agents' iPhone Air (4F281EA4…).
  • bun exact.mjs feedback is never; never run share (it publishes a link).
  • Judge motion on real time (a screen recording, argent), never under the agent's frozen clock.

Layout of the app

  • demos.contract is generated by bun tools/gen-demos.ts from the RN registry (order, names, icons, backdrops, inspiration links, ported = a folder in demos/). Re-run it after porting a demo (and rebuild only if new icons were copied).
  • home/: the SpringBoard and the demo screen. demos/<slug>/<slug>.contract + <slug>.test.contract: one demo each, listed in demos/index.contract.
  • packages/*: what the RN demos import from npm (pressto, …), as Contract packages.
  • gpu/ (when it exists): the Rust crate for every Skia/WebGPU/three surface.

Parity (the owner's rule)

  • Same object properties as the RN demo: every size, padding, radius, font, colour, timing, curve and spring copied from its code (name the RN constant in a comment). No "close enough".
  • Keep every layout animation: Reanimated layout= becomes -exact-layout-transition, entering/exiting become animation + -exact-exit-animation with the same durations.
  • Performance first: per-frame motion runs on the host (transitions, keyframes, springs, drag/scroll timelines, transformDragFor) or in Rust on the GPU, never in a commit per frame.

Springs

  • Reanimated 4 withSpring() with no config: -exact-spring(900, 120, 4) (GentleSpringConfig).
  • withSpring(v, { duration, dampingRatio }): bun tools/spring.ts <duration> <dampingRatio> prints the exact stiffness/damping/mass (Reanimated's own bisection, mass 4 by default).
  • { stiffness, damping, mass } configs copy straight across; a missing key is Gentle's.
  • Layout springify() with no setters is the same default spring.
  • Overdamped: Reanimated runs any spring with damping ratio ζ = c / (2√(k·m)) ≥ 1 as critically damped. Contract's -exact-spring solves the real overdamped curve, so when ζ > 1 write damping 2√(k·m), not RN's number. packages/motion already does this.
  • perspective in Exact acts on a box's children (CSS), not on the box: put it on the parent of the rotating node.
  • Presses are pressto's (packages/pressto: 250 ms ease from pointerdown/pointerup state), not the host's :active (a fixed 120 ms). See the port-demo skill.

GPU surfaces (gpu/, packages/motion, packages/gestures)

  • A canvas is a replaced element: inset=0 leaves it 300×150. Give it width/height.
  • Gestures and motion live in the surface: wants_input() -> true, recognizers from gestures, animations from motion, render() returns true only while something moves or a finger is down. No commit per frame.
  • cargo test -p demos-gpu renders offscreen (exact_gpu::fixture; EXACT_GPU_OUT=/tmp/x writes PPMs): check positions there before a device build.
  • Surface::agent() answers the drive's state request: report the surface's state there.
  • Never let a surface publish state that changes route props (closedby, presentation) during a gesture: the commit held the canvas's first frames ~1 s. Per-demo policy is static (ownsDrags in app.contract).
  • Skia drawing goes through packages/draw2d, antialiased as RN Skia's Graphite: draw_rect, draw_rrect, draw_circle, draw_oval, draw_line (and paths that are those shapes) are analytic (AnalyticRRectRenderStep), other paths 4× MSAA of Graphite's tessellation, clips analytic or MSAA as Graphite picks. Text below 162 device px is Graphite's direct masks: CoreText rasterises each glyph with Skia's Mac-scaler settings into a per-thread atlas (bit-exact against tools/coretext_reference.c); larger text is still glyph paths. Arcs, ovals and circles built with draw2d::add_arc, add_svg_arc, add_circle, add_oval (and SVG A commands) are Skia's conics: build them with those helpers, not lyon's own arc/circle builders, or they stay cubics.
  • cargo test --release -p demos-gpu bench -- --ignored --nocapture: CPU µs per frame of the heaviest Skia surfaces (BENCH_ONLY=<name>, BENCH_FRAMES=<n>); run it before and after touching packages/draw2d. Use the shape call RN's JSX makes (<Circle> is draw_circle, not a circle path). vello was tried and fails on the iOS Simulator (no indirect dispatch), so don't reach for it.

Parity with RN (tools/compare.sh)

  • The RN dev build runs on the same simulator (com.reactiive.app, Metro on 8082: exp+thank-you://expo-development-client/?url=http%3A%2F%2Flocalhost%3A8082). WAIT=5 ./tools/compare.sh <slug>… → /tmp/compare/sheet.png, RN left, Exact right. A capture of the home or a half-open card is timing: rerun with a larger WAIT.
  • GPU surfaces: one write_buffer per resource per frame (each stages a buffer); morphs in the vertex shader; the web host gives a surface no touches (iOS is the target).
  • argent on the RN Debug build: gesture-swipe often doesn't register; gesture-custom with interpolated Moves (interpolate: 20) works on both apps, so drive A/B gestures with it. Its recordings of RN drop frames heavily (often 3-15 fps): time nothing from them.
  • If argent's touches fail ("CoreDevice transport is dead"), stop-simulator-server for the device and retry.

Desktop atlas (macOS)

  • Launch: bun exact.mjs mac --run --url http://localhost:5341 (the web dev server, bun exact.mjs web --port 5341, must be up and building cleanly). On a Mac window (fine pointer, ≥ 600 pt wide) home is the atlas (home/atlas.contract), its header the window's native toolbar.
  • Hot: .contract and app.ts edits. The app logs reloaded generation ← localhost per push (~1–2 s). The dev server stops pushing after a failed build until its next save is seen; on this machine its file watcher can miss saves, so if no new generation arrives, press r + Enter in the dev server's terminal (or restart it). Any agent's Contract error blocks everyone's reload: check contract build app.contract --errors-only first.
  • Not hot (one native build, batched with the integrator): Swift (modules/), Rust (gpu/), app.json, bundled assets/, fonts. A gpu/ change needs the rebuild and a relaunch.
  • Never run agent macos while the person uses the app: it rebuilds when anything is stale and replaces the running app.
  • Feedback: bun .parity/feedback/server.ts (:5350) before opening the atlas; right-click a tile → Add Feedback Here…; bun .parity/feedback/list.ts --since 15m; inbox.jsonl has one line per event. The server also serves assets/atlas/*.jpg to the atlas at runtime (/snap/<slug>.jpg), so regenerated frames need no build.

Similar Skills

reverse-engineer-anything

MOmorluto/rea485k7,690 new stars in the last 7 days

reverse-engineer-anything

MOmorluto/rea485k7,690 new stars in the last 7 days

test-driven-development

OBobra/superpowers331k5,030 new stars in the last 7 days

agent-runtime-gateway-smoke-test

AFaffaan-m/ECC314k3,503 new stars in the last 7 days

ai-regression-testing

AFaffaan-m/ECC314k3,503 new stars in the last 7 days

Featured

accessibility

Audit accessibility on Web, iOS, and Android to meet WCAG 2.2, with keyboard navigation and screen-reader support.

AFaffaan-m/ECC314k3,503 new stars in the last 7 days