# Working on geeknative

This repo is the geeknative framework itself, not an app built with it.

| Path | What it is |
|---|---|
| template/ | The project every `geeknative create` copies: docs, contracts, the three apps, agent config. It's a working project you can build in place. |
| packages/geeknative/ | The CLI: `create`, `gen` (codegen), `check`, `doctor`, `parity`, `run`. Plain ESM JavaScript with `// @ts-check`, no dependencies. |
| packages/create-geeknative/ | The `npm create geeknative` entry point; forwards to `geeknative create`. |
| packages/geeknative/test/ | The CLI test suite (`npm test`, Node's built-in test runner). |
| website/ | The landing page and docs (Next.js static export, styled after colony.geekyants.com), deployed to GitHub Pages by .github/workflows/docs.yml. |
| demo-apps/ | Finished sample apps built with geeknative, not checked by CI. Each one has a `previews/` folder of real screenshots. |
| scripts/smoke.js | Creates a fresh project in a temp folder and runs every check in it. |
| scripts/publish-demo-app.mjs | Copies an app into `demo-apps/<slug>/` and photographs every screen on iOS, Android and web. |

## Rules

- **Generated code is committed in template/.** After changing a contract in template/contracts or a generator in packages/geeknative/src/codegen, run `node ../packages/geeknative/bin/geeknative.js gen` inside template/ and commit the output. Codegen output must be deterministic.
- **Know who owns each template file.** Files listed in packages/geeknative/src/lib/managed.js (and the `geeknative:begin/end` blocks in AGENTS.md and CLAUDE.md files) belong to the framework: upgrades replace them. Everything else in template/ is seeded once and then belongs to the project, so changes there only reach new projects.
- **Keep the three apps mirrored.** Template app changes follow the same rules the template's own AGENTS.md gives users: same names, same behavior, native idioms.
- **Icons come from one catalog.** packages/geeknative/src/codegen/catalogs/lucide.json holds every Lucide icon as shape data, and `gen` draws them natively in each app. To move to a newer Lucide release, run `node packages/geeknative/scripts/icon-catalogs.js <version>` and commit the result (with the regenerated template).
- **Template files named `_gitignore`** become `.gitignore` on create (npm drops real .gitignore files from packages).
- **Test** every change: `npm test` for the CLI, `cd template && make check` for the apps, and `npm run smoke` before a release. CI (.github/workflows/ci.yml) runs all three, with iOS on macOS.
- **Docs** live in website/content/docs. Update them in the same change as the behavior they describe.
- **Demo apps are not copied in by hand.** Adding or updating an app in `demo-apps/` includes taking its screenshots in the same turn. Follow **Publishing a demo app** below. Do not stop after the source lands in `demo-apps/<slug>/`.

## Publishing a demo app

The screenshots in `demo-apps/<slug>/previews/` are part of the app. An app without them is not finished.

1. Teach the app to open a named screen from launch arguments: iOS `-screenshotScreen` / `-screenshotAppearance`, Android extras of the same names (see dine-in's `UITesting.swift` and `ScreenshotLaunch.kt`). Read any extra ids from `launchExtras` in `shots.json` (`-screenshotRestaurantId`, `-screenshotDestinationId`, and so on). Seed the same local data the web shots will show.
2. Write `previews/shots.json`. Put per-app seed data there, not in the publish script: `webStorage` is a localStorage map (`signedIn` / `signedOut` / `always`, or a flat map applied to every screen), and `launchExtras` is extra iOS/Android launch arguments. Optional `mark` is the showcase tab color; otherwise the site uses `color.primary`. List every screen from `spec/navigation.md` with real ids (no `$placeholders` in `webPath`). Mark two to four screens with `"showcase": true` so the landing frames and /showcase/ pick them up. Do not edit the showcase catalog or components by hand.
3. Publish from the repo root, on a Mac with Xcode and an Android emulator:

```sh
node scripts/publish-demo-app.mjs /path/to/app slug-name
```

If the app is already in `demo-apps/<slug>/`:

```sh
node scripts/publish-demo-app.mjs --capture slug-name
```

Recapture only the screens that changed (`--screens welcome,discover`) and leave the other webps untouched. A full run rewrites every shot, and captures are not byte-identical between runs, so a full recapture recommits them all.

Capture turns on Reduce Motion, overrides the iOS status bar, sets Android animation scales to 0, and forces night mode. On the way out, including when a capture fails, the script writes those back and leaves Android demo mode.

4. If the script writes a stub `shots.json` and exits, fill in `webStorage`, `launchExtras`, and real ids in `webPath`, then run `--capture` again.
5. Commit `previews/shots.json` and the webp files under `previews/ios/`, `previews/android/` and `previews/web/` with the app. That folder is the only source for the website. `npm run dev` and `npm run build` in website/ copy the featured shots into `public/showcase/` (gitignored). Do not copy webps into `website/public/screens/`.

Do not copy `node_modules`, Gradle or DerivedData into `demo-apps/`. The publish script skips those. Do not capture on Ubuntu CI: it needs simulators.
