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

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.
Files changed (2) hide show
  1. package/README.md +206 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,206 @@
1
+ # create-rn-ai-starter
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.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx create-rn-ai-starter my-app
9
+ ```
10
+
11
+ This launches an interactive wizard that walks you through each option. To skip prompts and accept all defaults:
12
+
13
+ ```bash
14
+ npx create-rn-ai-starter my-app --yes
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```
20
+ create-rn-ai-starter <project-path> [options]
21
+ ```
22
+
23
+ The `<project-path>` argument can be a plain name, a relative path, an absolute path, or `.` to scaffold in the current (empty) directory. The project name is derived from the last segment of the path.
24
+
25
+ ```bash
26
+ npx create-rn-ai-starter my-app # creates ./my-app
27
+ npx create-rn-ai-starter ./projects/my-app # creates ./projects/my-app
28
+ npx create-rn-ai-starter /absolute/path/my-app # creates /absolute/path/my-app
29
+ npx create-rn-ai-starter . # scaffolds in cwd (must be empty)
30
+ ```
31
+
32
+ ### Options
33
+
34
+ | Flag | Values | Default |
35
+ | --- | --- | --- |
36
+ | `--ui <provider>` | `tamagui` \| `gluestack` | `tamagui` |
37
+ | `--auth <provider>` | `clerk` \| `none` | `none` |
38
+ | `--preset <theme>` | `radix-blue` \| `radix-green` \| `radix-purple` \| `radix-orange` \| `radix-cyan` \| `radix-red` | `radix-blue` |
39
+ | `--yes` | — | Skip prompts, use defaults for unset flags |
40
+
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
+
43
+ ### Examples
44
+
45
+ Scaffold with all defaults (no prompts):
46
+
47
+ ```bash
48
+ npx create-rn-ai-starter my-app --yes
49
+ ```
50
+
51
+ Pick specific providers:
52
+
53
+ ```bash
54
+ npx create-rn-ai-starter my-app --ui gluestack --auth clerk --preset radix-purple
55
+ ```
56
+
57
+ Mix flags with interactive prompts for the rest:
58
+
59
+ ```bash
60
+ npx create-rn-ai-starter my-app --ui tamagui
61
+ ```
62
+
63
+ Interactive prompt order is: `ui -> auth -> preset`.
64
+
65
+ Scaffold inside an existing projects folder:
66
+
67
+ ```bash
68
+ npx create-rn-ai-starter ./work/my-app --yes
69
+ ```
70
+
71
+ Scaffold in the current directory:
72
+
73
+ ```bash
74
+ mkdir my-app && cd my-app
75
+ npx create-rn-ai-starter . --yes
76
+ ```
77
+
78
+ ## What Gets Generated
79
+
80
+ The CLI creates a new Expo project with:
81
+
82
+ - **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.
86
+ - **ML Kit** (`on-device-mlkit`) — on-device object detection via `@infinitered/react-native-mlkit-object-detection`, vision hook, and camera/image-picker integration.
87
+ - **Auth** — Auth provider wiring, `(auth)` route group, and login button (when not `none`).
88
+ - **DX** — Developer experience profile (linting, formatting, TypeScript strictness).
89
+
90
+ After scaffolding, the CLI installs dependencies and runs validation checks to make sure everything is wired correctly.
91
+
92
+ ### UI library selection
93
+
94
+ Screens use the selected library's components directly — no abstraction layer:
95
+
96
+ - `--ui tamagui` → screens import `YStack`, `Text` from `'tamagui'`
97
+ - `--ui gluestack` → screens import `VStack`, `Text` from `'@gluestack-ui/themed'`
98
+
99
+ This is powered by a **kit pattern** in the CLI templates: a plain object maps component names and import paths per library, so screen templates are written once with EJS variables and produce clean, idiomatic output for each library.
100
+
101
+ ### AI providers
102
+
103
+ Every generated project includes an AI tab with a chat interface. The provider is selected at scaffold time (defaults to OpenRouter):
104
+
105
+ - **OpenRouter** — calls cloud LLMs via the OpenRouter API with streaming responses. Requires an `OPENROUTER_API_KEY` environment variable at runtime.
106
+ - **ML Kit** — runs object detection on-device using React Native ML Kit. No API key needed; works fully offline.
107
+
108
+ Both providers implement a shared `AiChatProvider` interface so swapping later is straightforward.
109
+
110
+ ### Theme presets
111
+
112
+ All Radix-based presets include light and dark mode palettes:
113
+
114
+ - `--preset radix-blue` — Blue accent palette
115
+ - `--preset radix-green` — Green accent palette
116
+ - `--preset radix-purple` — Purple accent palette
117
+ - `--preset radix-orange` — Orange accent palette
118
+ - `--preset radix-cyan` — Cyan accent palette
119
+ - `--preset radix-red` — Red accent palette
120
+
121
+ Theme selection persists across app restarts via Zustand persist middleware.
122
+
123
+ ## Generated Project Structure
124
+
125
+ ```
126
+ my-app/
127
+ ├── app/
128
+ │ ├── _layout.tsx # Root layout — SafeAreaProvider, QueryClient, ThemeProvider
129
+ │ ├── index.tsx # Entry redirect (splash handling)
130
+ │ ├── (onboarding)/
131
+ │ │ ├── _layout.tsx # Stack navigator
132
+ │ │ ├── welcome.tsx # Uses YStack/VStack + design tokens
133
+ │ │ ├── features.tsx
134
+ │ │ └── get-started.tsx
135
+ │ ├── (app)/
136
+ │ │ ├── _layout.tsx # Tab navigator (Home, AI, Settings)
137
+ │ │ ├── index.tsx # Home screen with login button
138
+ │ │ ├── ai.tsx # AI chat screen
139
+ │ │ └── settings.tsx
140
+ │ └── (auth)/ # (generated when auth ≠ none)
141
+ │ └── _layout.tsx
142
+ ├── src/
143
+ │ ├── starter.config.ts # Selected providers & modes
144
+ │ ├── design-system/
145
+ │ │ ├── index.ts # Barrel export (resolveTokens, useTokens, ThemeProvider, elevation)
146
+ │ │ ├── tokens.ts # Canonical tokens — colors, spacing, radius, typography
147
+ │ │ ├── ThemeProvider.tsx # Reads store, resolves tokens, animated theme transitions
148
+ │ │ └── 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
153
+ │ ├── store/
154
+ │ │ ├── index.ts # Barrel export
155
+ │ │ ├── onboarding.ts # Zustand — onboarding state
156
+ │ │ └── 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
160
+ │ └── providers/
161
+ │ ├── ui/
162
+ │ │ ├── index.ts # Resolver — tamagui or gluestack
163
+ │ │ └── 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
173
+ │ ├── auth/index.ts # Resolver — clerk or no-op stub
174
+ │ └── payments/index.ts # Resolver — stripe or no-op stub
175
+ ├── tamagui.config.ts # (only when --ui tamagui)
176
+ ├── app.json
177
+ ├── tsconfig.json # strict, noUncheckedIndexedAccess, @/* alias
178
+ └── package.json
179
+ ```
180
+
181
+ ## After Scaffolding
182
+
183
+ ```bash
184
+ cd my-app
185
+ npx expo start
186
+ ```
187
+
188
+ For OpenRouter AI, set your API key before running:
189
+
190
+ ```bash
191
+ OPENROUTER_API_KEY=sk-or-... npx expo start
192
+ ```
193
+
194
+ ## Development
195
+
196
+ ```bash
197
+ npm install
198
+ npm run build # compile with tsup
199
+ npm run dev # compile in watch mode
200
+ npm test # run tests with vitest
201
+ npm run typecheck # type-check without emitting
202
+ ```
203
+
204
+ ## Requirements
205
+
206
+ - Node.js >= 18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trailer-park-oss/create-rn-ai-starter",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CLI to scaffold Expo React Native projects with modular feature packs",
5
5
  "type": "module",
6
6
  "bin": {