@trailer-park-oss/create-rn-ai-starter 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-rn-ai-starter
2
2
 
3
- CLI to scaffold Expo React Native projects with modular feature packs — including built-in AI chat powered by OpenRouter or on-device ML Kit.
3
+ CLI to scaffold Expo React Native projects with modular feature packs — including built-in AI chat powered by OpenRouter, ExecuTorch, or ML Kit.
4
4
 
5
5
  ## Quick Start
6
6
 
@@ -35,10 +35,11 @@ npx create-rn-ai-starter . # scaffolds in cwd (must be em
35
35
  | --- | --- | --- |
36
36
  | `--ui <provider>` | `tamagui` \| `gluestack` | `tamagui` |
37
37
  | `--auth <provider>` | `clerk` \| `none` | `none` |
38
+ | `--ai <provider>` | `online-openrouter` \| `on-device-executorch` \| `on-device-mlkit` (repeatable) | `online-openrouter` |
38
39
  | `--preset <theme>` | `radix-blue` \| `radix-green` \| `radix-purple` \| `radix-orange` \| `radix-cyan` \| `radix-red` | `radix-blue` |
39
40
  | `--yes` | — | Skip prompts, use defaults for unset flags |
40
41
 
41
- > **Note:** AI, payments, and DX profile options are not yet exposed as CLI flags. The generated project always includes the AI pack (defaults to `online-openrouter`). Payments defaults to `none` and DX defaults to `basic`.
42
+ > **Note:** Payments and DX profile options are not yet exposed as CLI flags. Payments defaults to `none` and DX defaults to `basic`. AI providers can be selected via `--ai` flag.
42
43
 
43
44
  ### Examples
44
45
 
@@ -54,13 +55,19 @@ Pick specific providers:
54
55
  npx create-rn-ai-starter my-app --ui gluestack --auth clerk --preset radix-purple
55
56
  ```
56
57
 
58
+ Select multiple AI providers:
59
+
60
+ ```bash
61
+ npx create-rn-ai-starter my-app --ai online-openrouter --ai on-device-executorch --ai on-device-mlkit
62
+ ```
63
+
57
64
  Mix flags with interactive prompts for the rest:
58
65
 
59
66
  ```bash
60
67
  npx create-rn-ai-starter my-app --ui tamagui
61
68
  ```
62
69
 
63
- Interactive prompt order is: `ui -> auth -> preset`.
70
+ Interactive prompt order is: `ui -> auth -> ai -> preset`.
64
71
 
65
72
  Scaffold inside an existing projects folder:
66
73
 
@@ -80,9 +87,10 @@ npx create-rn-ai-starter . --yes
80
87
  The CLI creates a new Expo project with:
81
88
 
82
89
  - **Core** — Expo Router file-based routing, onboarding flow (3 screens), tab navigation (Home, AI, Settings), login button, Zustand stores, React Query setup, provider resolvers, and a `starter.config.ts` manifest.
83
- - **UI** — Full design system with canonical tokens (colors, spacing, radius, typography), `ThemeProvider` with animated transitions, MMKV-persisted theme store, and library-specific components (Card, PrimaryButton, StatusBanner). Screens import directly from the selected UI library via the kit pattern — `tamagui` or `@gluestack-ui/themed`.
84
- - **AI** — AI chat screen with a shared provider interface (`ai.interface.ts`). Two back-end implementations:
85
- - **OpenRouter** (`online-openrouter`, default) — streaming chat client, `useChat` / `useAiChat` hooks, and env config for API keys.
90
+ - **UI** — Full design system with canonical tokens (colors, spacing, radius, typography), `ThemeProvider` with animated transitions, MMKV-persisted theme store, and library-specific components (Card, PrimaryButton, StatusBanner, ModelSelector). Screens import directly from the selected UI library via the kit pattern — `tamagui` or `@gluestack-ui/themed`.
91
+ - **AI** — AI chat screen with a shared provider interface (`ai.interface.ts`). Three back-end implementations:
92
+ - **OpenRouter** (`online-openrouter`, default) — streaming chat client, `useChat` / `useAiChat` hooks, env config for API keys, and live model search from OpenRouter API.
93
+ - **ExecuTorch** (`on-device-executorch`) — on-device LLM inference with model download/management, search, and delete functionality. No API key needed; works fully offline.
86
94
  - **ML Kit** (`on-device-mlkit`) — on-device object detection via `@infinitered/react-native-mlkit-object-detection`, vision hook, and camera/image-picker integration.
87
95
  - **Auth** — Auth provider wiring, `(auth)` route group, and login button (when not `none`).
88
96
  - **DX** — Developer experience profile (linting, formatting, TypeScript strictness).
@@ -102,11 +110,58 @@ This is powered by a **kit pattern** in the CLI templates: a plain object maps c
102
110
 
103
111
  Every generated project includes an AI tab with a chat interface. The provider is selected at scaffold time (defaults to OpenRouter):
104
112
 
105
- - **OpenRouter** — calls cloud LLMs via the OpenRouter API with streaming responses. Requires an `OPENROUTER_API_KEY` environment variable at runtime.
113
+ - **OpenRouter** — calls cloud LLMs via the OpenRouter API with streaming responses. Requires an `OPENROUTER_API_KEY` environment variable at runtime. Models are fetched live from OpenRouter API with full search functionality.
114
+ - **ExecuTorch** — runs LLMs on-device with ExecuTorch. No API key needed; works fully offline. Includes comprehensive model download/management with search, download, and delete capabilities.
106
115
  - **ML Kit** — runs object detection on-device using React Native ML Kit. No API key needed; works fully offline.
107
116
 
108
117
  Both providers implement a shared `AiChatProvider` interface so swapping later is straightforward.
109
118
 
119
+ > **ExecuTorch (on-device LLMs):** requires a dev build. It will not run in Expo Go.
120
+ > Use `npx expo run:ios` or `npx expo run:android`, then `npx expo start --dev-client`.
121
+
122
+ #### Model Selection & Management
123
+
124
+ **CLI Model Selection:**
125
+
126
+ The CLI provides an interactive search for selecting AI models during scaffolding:
127
+
128
+ **OpenRouter Models:**
129
+ - Fetched live from `https://openrouter.ai/api/v1/models`
130
+ - Includes pricing information
131
+ - Search by model name, ID, or description
132
+ - Fallback to curated list if API unavailable
133
+ - 15+ models from various providers (OpenAI, Anthropic, Meta, Google, Mistral, etc.)
134
+
135
+ **ExecuTorch Models:**
136
+ - Curated list of mobile-optimized models
137
+ - Includes Llama 3.2, Phi-3, Qwen 2, Gemma 2, Mistral 7B, and Nemotron Super
138
+ - Search by model name or description
139
+ - No network fetch required for faster scaffolding
140
+ - 13 popular models optimized for mobile deployment
141
+
142
+ **In-App Model Management:**
143
+
144
+ After scaffolding, you can manage AI models directly from the AI screen:
145
+
146
+ **OpenRouter:**
147
+ - Search and select from available models
148
+ - View pricing information
149
+ - Change active model at runtime
150
+
151
+ **ExecuTorch:**
152
+ - **Download Models**: Browse and download on-device models
153
+ - **Delete Models**: Remove downloaded models to free storage
154
+ - **Search**: Filter available models by name or description
155
+ - **Download Status**: Track download progress
156
+ - **Model Status**: View which models are already downloaded (green checkmark)
157
+ - **Current Model**: See active model with download status badge
158
+ - **Change Model**: Switch between downloaded or available models
159
+
160
+ All ExecuTorch models are stored locally and managed via:
161
+ - AsyncStorage tracking of downloaded models
162
+ - File system storage in `{documentDirectory}/execuTorch-models/`
163
+ - Automatic cleanup and validation of model files
164
+
110
165
  ### Theme presets
111
166
 
112
167
  All Radix-based presets include light and dark mode palettes:
@@ -146,30 +201,33 @@ my-app/
146
201
  │ │ ├── tokens.ts # Canonical tokens — colors, spacing, radius, typography
147
202
  │ │ ├── ThemeProvider.tsx # Reads store, resolves tokens, animated theme transitions
148
203
  │ │ └── elevation.ts # Platform-aware card/modal/toast shadows
149
- │ ├── components/
150
- │ │ ├── Card.tsx # Animated card with haptics — uses tamagui or gluestack directly
151
- │ │ ├── PrimaryButton.tsx # Animated button with haptics
152
- │ │ └── StatusBanner.tsx # Success/warning/critical/info banners
204
+ │ ├── components/
205
+ │ │ ├── Card.tsx # Animated card with haptics — uses tamagui or gluestack directly
206
+ │ │ ├── PrimaryButton.tsx # Animated button with haptics
207
+ │ │ ├── StatusBanner.tsx # Success/warning/critical/info banners
208
+ │ │ └── ModelSelector.tsx # AI model selection and management with search/download/delete
153
209
  │ ├── store/
154
210
  │ │ ├── index.ts # Barrel export
155
211
  │ │ ├── onboarding.ts # Zustand — onboarding state
156
212
  │ │ └── theme.ts # Zustand + MMKV persist — preset & colorMode
157
- │ ├── lib/
158
- │ │ ├── query-client.ts # TanStack Query client
159
- │ │ └── mmkv-storage.ts # MMKV instance + Zustand StateStorage adapter
213
+ │ ├── lib/
214
+ │ │ ├── query-client.ts # TanStack Query client
215
+ │ │ ├── mmkv-storage.ts # MMKV instance + Zustand StateStorage adapter
216
+ │ │ └── model-fetcher.ts # OpenRouter & ExecuTorch model fetching utilities
160
217
  │ └── providers/
161
218
  │ ├── ui/
162
219
  │ │ ├── index.ts # Resolver — tamagui or gluestack
163
220
  │ │ └── tamagui/ # (or gluestack/) — library-specific config & provider
164
- │ ├── ai/
165
- │ │ ├── ai.interface.ts # Shared AI provider interface
166
- │ │ ├── index.ts # Barrel export
167
- │ │ └── openrouter/ # (or mlkit/) — provider-specific implementation
168
- │ │ ├── client.ts # Streaming OpenRouter API client
169
- │ │ ├── useChat.ts # Chat hook with message history
170
- │ │ ├── useAiChat.ts # High-level chat hook
171
- │ │ ├── env.ts # API key configuration
172
- │ │ └── index.ts
221
+ │ ├── ai/
222
+ │ │ ├── ai.interface.ts # Shared AI provider interface
223
+ │ │ ├── index.ts # Barrel export
224
+ │ │ └── openrouter/ # (or mlkit/executorch/) — provider-specific implementation
225
+ │ │ ├── client.ts # Streaming OpenRouter API client
226
+ │ │ ├── useChat.ts # Chat hook with message history
227
+ │ │ ├── useAiChat.ts # High-level chat hook
228
+ │ │ ├── env.ts # API key configuration
229
+ │ │ ├── model-download.ts # ExecuTorch model download/delete management
230
+ │ │ └── index.ts
173
231
  │ ├── auth/index.ts # Resolver — clerk or no-op stub
174
232
  │ └── payments/index.ts # Resolver — stripe or no-op stub
175
233
  ├── tamagui.config.ts # (only when --ui tamagui)