Community README: docs mirror, proven starters, golden gotchas

This commit is contained in:
drjones
2026-09-02 19:39:32 -07:00
parent bfed37a847
commit 53dbaaf774

View File

@@ -1,35 +1,66 @@
# Even Realities G2 — App Lab # Even G2 App Lab 🕶️⭐
Dev workspace for Even G2 smart glasses apps. Naming theme: constellations/stars. > **The repo that gives back.** Everything here — docs, tooling notes, starter code, hard-won gotchas — is free for every Even Realities G2 developer. Take it, build on it, ship faster.
## Toolchain (all installed globally) Built and maintained by **drjones** — homelab warlord, red teamer, and the guy who reads the SDK type definitions so you don't have to. If this repo saved you a weekend of debugging, pour one out for the countless hours spent discovering that the simulator sends `sysEvent` but hardware sends `textEvent`.
| Tool | Command | Version |
|---|---|---|
| Even Hub CLI | `evenhub` / `eh` | 0.1.13 |
| Simulator | `evenhub-simulator` | 0.8.0 |
| SDK (per-app dep) | `@evenrealities/even_hub_sdk` | 0.0.14 |
| Node | v26.8.1 | — |
## Layout ## What's in here
- `apps/` — one folder per app (web apps: Vite + TypeScript + SDK)
- `docs/` — full Even Realities developer docs snapshot | Path | What it is |
- `docs/pages/` — per-page markdown |---|---|
- `docs/site-data.json` / `docs/links.txt` — doc index | `apps/` | Working G2 apps — each one verified in the simulator before it lands |
| `docs/pages/` | Full snapshot of the official Even Realities developer docs, converted to clean markdown (28 pages) — grep it, feed it to your agent, don't scrape it again |
| `README.md` | This love letter |
## Why this exists
The G2 platform is awesome but the docs are a website and the SDK is a black box. This repo is:
1. **A local docs mirror** — the entire developer documentation, markdown-ified, so it's searchable offline and LLM-friendly
2. **Proven starter code** — every app here has been booted in the simulator, click-tested through the automation API, and screenshot-verified on the framebuffer
3. **A graveyard of gotchas** — so they only kill each of us once
## The golden gotchas (learned the hard way)
- **Simulator ≠ hardware**: simulator clicks arrive as `sysEvent`, real glasses send `textEvent`. Handle BOTH or your app works in dev and dies in the wild.
- **SDK 0.0.14 API**: bridge methods are on the instance (`bridge.createStartUpPageContainer(...)`), containers must be **class instances** (`new TextContainerProperty({...})`), not plain objects.
- **`min_sdk_version` in `app.json` must match** the SDK version in `node_modules` — mismatch = rejected.
- **HMR breaks the bridge** — restart the simulator after code changes.
- **`waitForEvenAppBridge()` before everything** — instant in sim, waits on hardware.
- **Network whitelist is NOT a CORS bypass** — your API needs real CORS headers too.
- **npm `omit=dev` silently skips devDependencies** — check `npm config get omit` if `tsc` "doesn't exist".
## Toolchain
| Tool | Version |
|---|---|
| `evenhub` CLI | 0.1.13 |
| `evenhub-simulator` | 0.8.0 |
| `@evenrealities/even_hub_sdk` | 0.0.14 |
| Node | 20+ |
## Quick start (one app, five commands)
## Quick loop
```bash ```bash
cd apps/<name> npm create vite@latest my-app -- --template vanilla-ts
npm run dev # Vite on :5173 cd my-app && npm install
npm install @evenrealities/even_hub_sdk@latest
npm run dev # :5173
evenhub-simulator http://localhost:5173/ --automation-port 9898 evenhub-simulator http://localhost:5173/ --automation-port 9898
```
Then drive it like a robot (the way apps should be tested):
```bash
curl http://127.0.0.1:9898/api/ping # -> pong curl http://127.0.0.1:9898/api/ping # -> pong
curl -X POST http://127.0.0.1:9898/api/input -H 'Content-Type: application/json' -d '{"action":"click"}' curl -X POST http://127.0.0.1:9898/api/input -H 'Content-Type: application/json' -d '{"action":"click"}'
curl -s http://127.0.0.1:9898/api/screenshot/glasses -o frame.png curl -s http://127.0.0.1:9898/api/screenshot/glasses -o frame.png
``` ```
## Critical platform notes ## License / ethos
- Simulator sends clicks as `sysEvent`, hardware as `textEvent` — handlers must accept BOTH.
- `min_sdk_version` in app.json must match the installed SDK version. Copy freely. The glasses render monochrome green at 576×288 — there's enough room in this world for all our apps. 🟢
- HMR reloads break the bridge — restart simulator after code changes.
- `waitForEvenAppBridge()` before any SDK call. ---
- Network whitelist ≠ CORS bypass — remote API needs real CORS headers too.
- Full reference: docs/pages/ *Hydroponics, homelabs, and head-mounted displays. — Indiana "drjones" Holmes*