Files
even-g2/README.md

67 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Even G2 App Lab 🕶️⭐
> **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.
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`.
## What's in here
| Path | What it is |
|---|---|
| `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)
```bash
npm create vite@latest my-app -- --template vanilla-ts
cd my-app && npm install
npm install @evenrealities/even_hub_sdk@latest
npm run dev # :5173
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 -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
```
## License / ethos
Copy freely. The glasses render monochrome green at 576×288 — there's enough room in this world for all our apps. 🟢
---
*Hydroponics, homelabs, and head-mounted displays. — Indiana "drjones" Holmes*