anhedral 0.13.0 → 0.16.0

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 (360) hide show
  1. package/README.md +23 -229
  2. package/assets/patches/audit-deps.mjs +12 -2
  3. package/assets/stack/ai-schema.ts.txt +5 -0
  4. package/assets/stack/ai.ts.txt +30 -0
  5. package/assets/stack/api-index.ts.txt +15 -0
  6. package/assets/stack/auth-features.ts.txt +4 -0
  7. package/assets/stack/auth-journal.json.txt +13 -0
  8. package/assets/stack/auth-migration.sql.txt +53 -0
  9. package/assets/stack/auth-routes.ts.txt +11 -0
  10. package/assets/stack/auth-schema.ts.txt +64 -0
  11. package/assets/stack/auth-snapshot.json.txt +346 -0
  12. package/assets/stack/auth.ts.txt +32 -0
  13. package/assets/stack/billing-mode.ts.txt +8 -0
  14. package/assets/stack/billing-schema.ts.txt +11 -0
  15. package/assets/stack/desktop.rs.txt +21 -0
  16. package/assets/stack/entitlement-guard.ts.txt +32 -0
  17. package/assets/stack/entitlements.ts.txt +8 -0
  18. package/assets/stack/events-schema.ts.txt +12 -0
  19. package/assets/stack/events.ts.txt +59 -0
  20. package/assets/stack/mobile-auth.ts.txt +25 -0
  21. package/assets/stack/mobile-billing.tsx.txt +63 -0
  22. package/assets/stack/mobile-session.tsx.txt +83 -0
  23. package/assets/stack/native-button.tsx.txt +108 -0
  24. package/assets/stack/native-global.css.txt +4 -0
  25. package/assets/stack/native-lib-utils.ts.txt +5 -0
  26. package/assets/stack/native-metro.config.js.txt +6 -0
  27. package/assets/stack/native-nativewind-env.d.ts.txt +1 -0
  28. package/assets/stack/native-tailwind.config.js.txt +73 -0
  29. package/assets/stack/native-text.tsx.txt +89 -0
  30. package/assets/stack/purchases.ts.txt +65 -0
  31. package/assets/stack/revenuecat.ts.txt +88 -0
  32. package/assets/stack/rtc-schema.ts.txt +10 -0
  33. package/assets/stack/rtc.ts.txt +122 -0
  34. package/assets/stack/security.ts.txt +31 -0
  35. package/assets/stack/storage.ts.txt +36 -0
  36. package/assets/stack/stripe.ts.txt +126 -0
  37. package/assets/stack/web-sign-in.tsx.txt +51 -0
  38. package/assets/ui/LICENSE.react-native-reusables +21 -0
  39. package/assets/ui/LICENSE.shadcn +21 -0
  40. package/assets/ui/UPSTREAM.json +39 -0
  41. package/assets/ui/catalog.json +891 -0
  42. package/assets/ui/extensions/registry.json +6 -0
  43. package/assets/ui/native/_controls.tsx +521 -0
  44. package/assets/ui/native/_core.tsx +118 -0
  45. package/assets/ui/native/_data.tsx +200 -0
  46. package/assets/ui/native/_display.tsx +453 -0
  47. package/assets/ui/native/_feedback.tsx +242 -0
  48. package/assets/ui/native/_legacy-dialog.tsx +38 -0
  49. package/assets/ui/native/_motion.tsx +520 -0
  50. package/assets/ui/native/_overlay.tsx +402 -0
  51. package/assets/ui/native/_selection.tsx +366 -0
  52. package/assets/ui/native/accordion.tsx +1 -0
  53. package/assets/ui/native/alert-dialog.tsx +11 -0
  54. package/assets/ui/native/alert.tsx +1 -0
  55. package/assets/ui/native/aspect-ratio.tsx +1 -0
  56. package/assets/ui/native/attachment.tsx +8 -0
  57. package/assets/ui/native/avatar.tsx +8 -0
  58. package/assets/ui/native/badge.tsx +1 -0
  59. package/assets/ui/native/breadcrumb.tsx +9 -0
  60. package/assets/ui/native/bubble.tsx +1 -0
  61. package/assets/ui/native/button-group.tsx +1 -0
  62. package/assets/ui/native/button.tsx +86 -0
  63. package/assets/ui/native/calendar.tsx +170 -0
  64. package/assets/ui/native/card.tsx +44 -0
  65. package/assets/ui/native/carousel.tsx +1 -0
  66. package/assets/ui/native/chart.tsx +193 -0
  67. package/assets/ui/native/checkbox.tsx +1 -0
  68. package/assets/ui/native/code-block.tsx +137 -0
  69. package/assets/ui/native/collapsible.tsx +1 -0
  70. package/assets/ui/native/combobox.tsx +1 -0
  71. package/assets/ui/native/command.tsx +11 -0
  72. package/assets/ui/native/context-menu.tsx +16 -0
  73. package/assets/ui/native/data-table.tsx +1 -0
  74. package/assets/ui/native/date-picker.tsx +43 -0
  75. package/assets/ui/native/dialog.tsx +15 -0
  76. package/assets/ui/native/direction.tsx +1 -0
  77. package/assets/ui/native/drawer.tsx +10 -0
  78. package/assets/ui/native/dropdown-menu.tsx +16 -0
  79. package/assets/ui/native/empty.tsx +8 -0
  80. package/assets/ui/native/field.tsx +13 -0
  81. package/assets/ui/native/hover-card.tsx +1 -0
  82. package/assets/ui/native/input-group.tsx +8 -0
  83. package/assets/ui/native/input-otp.tsx +1 -0
  84. package/assets/ui/native/input.tsx +28 -0
  85. package/assets/ui/native/item.tsx +12 -0
  86. package/assets/ui/native/kbd.tsx +1 -0
  87. package/assets/ui/native/label.tsx +4 -0
  88. package/assets/ui/native/layout.tsx +26 -0
  89. package/assets/ui/native/marker.tsx +1 -0
  90. package/assets/ui/native/menubar.tsx +17 -0
  91. package/assets/ui/native/message-scroller.tsx +6 -0
  92. package/assets/ui/native/message.tsx +10 -0
  93. package/assets/ui/native/native-select.tsx +1 -0
  94. package/assets/ui/native/navigation-menu.tsx +10 -0
  95. package/assets/ui/native/pagination.tsx +9 -0
  96. package/assets/ui/native/popover.tsx +1 -0
  97. package/assets/ui/native/progress.tsx +1 -0
  98. package/assets/ui/native/questionnaire.tsx +130 -0
  99. package/assets/ui/native/radio-group.tsx +1 -0
  100. package/assets/ui/native/registry.json +1103 -0
  101. package/assets/ui/native/resizable.tsx +1 -0
  102. package/assets/ui/native/scroll-area.tsx +1 -0
  103. package/assets/ui/native/select.tsx +11 -0
  104. package/assets/ui/native/separator.tsx +1 -0
  105. package/assets/ui/native/sheet.tsx +10 -0
  106. package/assets/ui/native/sidebar.tsx +22 -0
  107. package/assets/ui/native/skeleton.tsx +1 -0
  108. package/assets/ui/native/slider.tsx +1 -0
  109. package/assets/ui/native/spinner.tsx +1 -0
  110. package/assets/ui/native/switch.tsx +1 -0
  111. package/assets/ui/native/table.tsx +10 -0
  112. package/assets/ui/native/tabs.tsx +1 -0
  113. package/assets/ui/native/text.tsx +20 -0
  114. package/assets/ui/native/textarea.tsx +1 -0
  115. package/assets/ui/native/theme-switcher.tsx +22 -0
  116. package/assets/ui/native/toast.tsx +11 -0
  117. package/assets/ui/native/toggle-group.tsx +1 -0
  118. package/assets/ui/native/toggle.tsx +1 -0
  119. package/assets/ui/native/tooltip.tsx +1 -0
  120. package/assets/ui/native/trace.tsx +20 -0
  121. package/assets/ui/native/typography.tsx +15 -0
  122. package/assets/ui/theme-storage.ts +25 -0
  123. package/assets/ui/theme.tsx +66 -0
  124. package/assets/ui/web/button.tsx +59 -0
  125. package/assets/ui/web/input.tsx +21 -0
  126. package/assets/ui/web/label.tsx +19 -0
  127. package/dist/bin.js +7 -12
  128. package/dist/capabilities.d.ts +4 -33
  129. package/dist/capabilities.js +2 -84
  130. package/dist/capability-catalog.d.ts +83 -0
  131. package/dist/capability-catalog.js +121 -0
  132. package/dist/capability-command.d.ts +3 -0
  133. package/dist/capability-command.js +188 -0
  134. package/dist/capability-editor.d.ts +17 -0
  135. package/dist/capability-editor.js +97 -0
  136. package/dist/capability-recipes.d.ts +4 -0
  137. package/dist/capability-recipes.js +520 -0
  138. package/dist/capability-references.d.ts +4 -0
  139. package/dist/capability-references.js +7 -0
  140. package/dist/cli-commands.d.ts +1 -2
  141. package/dist/cli-commands.js +10 -104
  142. package/dist/cli-output.d.ts +1 -2
  143. package/dist/cli-output.js +6 -251
  144. package/dist/command-schema.js +40 -374
  145. package/dist/dependencies.d.ts +34 -62
  146. package/dist/dependencies.js +112 -199
  147. package/dist/index.d.ts +1 -45
  148. package/dist/index.js +1 -30
  149. package/dist/platforms/mobile.js +29 -139
  150. package/dist/platforms/web.d.ts +3 -0
  151. package/dist/platforms/web.js +251 -0
  152. package/dist/project-config.d.ts +2 -13
  153. package/dist/project-config.js +10 -83
  154. package/dist/registry/context.js +0 -1
  155. package/dist/registry/options.js +6 -40
  156. package/dist/registry/resolve.d.ts +3 -4
  157. package/dist/registry/resolve.js +18 -108
  158. package/dist/registry/types.d.ts +1 -7
  159. package/dist/registry/usage.js +3 -9
  160. package/dist/runtime-policy.d.ts +0 -2
  161. package/dist/runtime-policy.js +0 -16
  162. package/dist/scaffold/backend.d.ts +0 -4
  163. package/dist/scaffold/backend.js +1 -189
  164. package/dist/scaffold/bootstrap.d.ts +2 -3
  165. package/dist/scaffold/bootstrap.js +37 -43
  166. package/dist/scaffold/compose.js +2 -14
  167. package/dist/scaffold/database.d.ts +1 -1
  168. package/dist/scaffold/database.js +19 -126
  169. package/dist/scaffold/documentation.d.ts +0 -1
  170. package/dist/scaffold/documentation.js +82 -84
  171. package/dist/scaffold/expo-runtime.d.ts +2 -2
  172. package/dist/scaffold/expo-runtime.js +9 -101
  173. package/dist/scaffold/native-ui.d.ts +2 -0
  174. package/dist/scaffold/native-ui.js +74 -0
  175. package/dist/scaffold/stack-documentation.d.ts +0 -1
  176. package/dist/scaffold/stack-documentation.js +3 -49
  177. package/dist/scaffold/storage.d.ts +2 -0
  178. package/dist/scaffold/storage.js +21 -0
  179. package/dist/scaffold/styling.d.ts +1 -1
  180. package/dist/scaffold/styling.js +20 -28
  181. package/dist/scaffold/workspace.js +63 -199
  182. package/dist/stack-registry.d.ts +2 -58
  183. package/dist/stack-registry.js +22 -446
  184. package/dist/standard.js +7 -24
  185. package/dist/ui-catalog.d.ts +26 -0
  186. package/dist/ui-catalog.js +31 -0
  187. package/dist/ui-command.d.ts +3 -0
  188. package/dist/ui-command.js +219 -0
  189. package/dist/ui-project.d.ts +22 -0
  190. package/dist/ui-project.js +110 -0
  191. package/dist/version.d.ts +1 -1
  192. package/dist/version.js +1 -1
  193. package/docs/anhedral-stack.md +4 -119
  194. package/docs/capabilities.md +110 -0
  195. package/docs/native-ui.md +102 -0
  196. package/docs/software-factory.md +16 -577
  197. package/docs/stack-standard.md +11 -307
  198. package/docs/ui.md +33 -0
  199. package/docs/verification.md +511 -0
  200. package/package.json +26 -27
  201. package/dist/access.d.ts +0 -10
  202. package/dist/access.js +0 -93
  203. package/dist/auth-schema-snapshot.d.ts +0 -346
  204. package/dist/auth-schema-snapshot.js +0 -347
  205. package/dist/auth-schema.d.ts +0 -1
  206. package/dist/auth-schema.js +0 -57
  207. package/dist/capability-contract.d.ts +0 -47
  208. package/dist/capability-contract.js +0 -168
  209. package/dist/catalog-model.d.ts +0 -24
  210. package/dist/catalog-model.js +0 -1
  211. package/dist/catalog-registration.d.ts +0 -16
  212. package/dist/catalog-registration.js +0 -22
  213. package/dist/catalog-snapshot.d.ts +0 -5
  214. package/dist/catalog-snapshot.js +0 -97
  215. package/dist/cli-delivery.d.ts +0 -3
  216. package/dist/cli-delivery.js +0 -172
  217. package/dist/cloudflare.d.ts +0 -25
  218. package/dist/cloudflare.js +0 -226
  219. package/dist/delivery-evidence.d.ts +0 -62
  220. package/dist/delivery-evidence.js +0 -186
  221. package/dist/delivery.d.ts +0 -88
  222. package/dist/delivery.js +0 -570
  223. package/dist/inspector-model.d.ts +0 -123
  224. package/dist/inspector-model.js +0 -1
  225. package/dist/integration-service-readers.d.ts +0 -13
  226. package/dist/integration-service-readers.js +0 -173
  227. package/dist/lifecycle-model.d.ts +0 -15
  228. package/dist/lifecycle-model.js +0 -20
  229. package/dist/lifecycle.d.ts +0 -11
  230. package/dist/lifecycle.js +0 -91
  231. package/dist/management.d.ts +0 -3
  232. package/dist/management.js +0 -47
  233. package/dist/mobile-delivery.d.ts +0 -77
  234. package/dist/mobile-delivery.js +0 -366
  235. package/dist/neon-service-data.d.ts +0 -8
  236. package/dist/neon-service-data.js +0 -117
  237. package/dist/platforms/desktop.d.ts +0 -2
  238. package/dist/platforms/desktop.js +0 -415
  239. package/dist/platforms/extension.d.ts +0 -2
  240. package/dist/platforms/extension.js +0 -328
  241. package/dist/project-catalog.d.ts +0 -41
  242. package/dist/project-catalog.js +0 -288
  243. package/dist/project-inspector.d.ts +0 -4
  244. package/dist/project-inspector.js +0 -702
  245. package/dist/project-lifecycle.d.ts +0 -25
  246. package/dist/project-lifecycle.js +0 -57
  247. package/dist/project-state.d.ts +0 -49
  248. package/dist/project-state.js +0 -563
  249. package/dist/provider-auth.d.ts +0 -41
  250. package/dist/provider-auth.js +0 -215
  251. package/dist/provider-readiness.d.ts +0 -30
  252. package/dist/provider-readiness.js +0 -104
  253. package/dist/providers/adapters.d.ts +0 -17
  254. package/dist/providers/adapters.js +0 -278
  255. package/dist/providers/api.d.ts +0 -29
  256. package/dist/providers/api.js +0 -253
  257. package/dist/providers/config.d.ts +0 -15
  258. package/dist/providers/config.js +0 -182
  259. package/dist/providers/definitions.d.ts +0 -318
  260. package/dist/providers/definitions.js +0 -127
  261. package/dist/providers/provision.d.ts +0 -24
  262. package/dist/providers/provision.js +0 -76
  263. package/dist/providers/receipts.d.ts +0 -20
  264. package/dist/providers/receipts.js +0 -66
  265. package/dist/providers/recovery-verification.d.ts +0 -7
  266. package/dist/providers/recovery-verification.js +0 -112
  267. package/dist/providers/recovery.d.ts +0 -30
  268. package/dist/providers/recovery.js +0 -34
  269. package/dist/providers/runtime.d.ts +0 -10
  270. package/dist/providers/runtime.js +0 -265
  271. package/dist/providers/schema.d.ts +0 -28
  272. package/dist/providers/schema.js +0 -49
  273. package/dist/providers/state.d.ts +0 -55
  274. package/dist/providers/state.js +0 -289
  275. package/dist/provision.d.ts +0 -55
  276. package/dist/provision.js +0 -284
  277. package/dist/r2-service-data.d.ts +0 -2
  278. package/dist/r2-service-data.js +0 -136
  279. package/dist/readiness.d.ts +0 -23
  280. package/dist/readiness.js +0 -122
  281. package/dist/registry/add.d.ts +0 -24
  282. package/dist/registry/add.js +0 -270
  283. package/dist/registry/bootstrap.d.ts +0 -2
  284. package/dist/registry/bootstrap.js +0 -14
  285. package/dist/registry/commands.d.ts +0 -3
  286. package/dist/registry/commands.js +0 -85
  287. package/dist/registry/presets.d.ts +0 -4
  288. package/dist/registry/presets.js +0 -41
  289. package/dist/registry/preview.d.ts +0 -11
  290. package/dist/registry/preview.js +0 -91
  291. package/dist/registry/receipt.d.ts +0 -3
  292. package/dist/registry/receipt.js +0 -68
  293. package/dist/repository.d.ts +0 -24
  294. package/dist/repository.js +0 -96
  295. package/dist/scaffold/auth.d.ts +0 -3
  296. package/dist/scaffold/auth.js +0 -151
  297. package/dist/scaffold/billing-config.d.ts +0 -1
  298. package/dist/scaffold/billing-config.js +0 -73
  299. package/dist/scaffold/billing-contracts.d.ts +0 -2
  300. package/dist/scaffold/billing-contracts.js +0 -48
  301. package/dist/scaffold/billing-providers.d.ts +0 -1
  302. package/dist/scaffold/billing-providers.js +0 -249
  303. package/dist/scaffold/billing-schema.d.ts +0 -1
  304. package/dist/scaffold/billing-schema.js +0 -34
  305. package/dist/scaffold/billing-security.d.ts +0 -1
  306. package/dist/scaffold/billing-security.js +0 -46
  307. package/dist/scaffold/billing-server.d.ts +0 -1
  308. package/dist/scaffold/billing-server.js +0 -139
  309. package/dist/scaffold/billing-store.d.ts +0 -1
  310. package/dist/scaffold/billing-store.js +0 -72
  311. package/dist/scaffold/billing.d.ts +0 -2
  312. package/dist/scaffold/billing.js +0 -216
  313. package/dist/scaffold/cloudflare-services.d.ts +0 -8
  314. package/dist/scaffold/cloudflare-services.js +0 -198
  315. package/dist/scaffold/expo-auth.d.ts +0 -3
  316. package/dist/scaffold/expo-auth.js +0 -192
  317. package/dist/scaffold/expo-billing.d.ts +0 -3
  318. package/dist/scaffold/expo-billing.js +0 -292
  319. package/dist/scaffold/integrations.d.ts +0 -4
  320. package/dist/scaffold/integrations.js +0 -12
  321. package/dist/scaffold/lint.d.ts +0 -4
  322. package/dist/scaffold/lint.js +0 -56
  323. package/dist/scaffold/neon-realtime.d.ts +0 -2
  324. package/dist/scaffold/neon-realtime.js +0 -97
  325. package/dist/scaffold/services.d.ts +0 -5
  326. package/dist/scaffold/services.js +0 -108
  327. package/dist/scaffold/stream.d.ts +0 -2
  328. package/dist/scaffold/stream.js +0 -114
  329. package/dist/scaffold/void.d.ts +0 -4
  330. package/dist/scaffold/void.js +0 -264
  331. package/dist/scaffold/web.d.ts +0 -2
  332. package/dist/scaffold/web.js +0 -130
  333. package/dist/service-deletion.d.ts +0 -29
  334. package/dist/service-deletion.js +0 -195
  335. package/dist/service-descriptor.d.ts +0 -10
  336. package/dist/service-descriptor.js +0 -78
  337. package/dist/service-model.d.ts +0 -49
  338. package/dist/service-model.js +0 -8
  339. package/dist/service-operations.d.ts +0 -29
  340. package/dist/service-operations.js +0 -78
  341. package/dist/service-readers.d.ts +0 -8
  342. package/dist/service-readers.js +0 -247
  343. package/dist/services-command.d.ts +0 -39
  344. package/dist/services-command.js +0 -102
  345. package/dist/ship.d.ts +0 -348
  346. package/dist/ship.js +0 -239
  347. package/dist/vercel-project.d.ts +0 -101
  348. package/dist/vercel-project.js +0 -305
  349. package/dist/vercel.d.ts +0 -67
  350. package/dist/vercel.js +0 -581
  351. package/dist/vinext.d.ts +0 -2
  352. package/dist/vinext.js +0 -86
  353. package/dist/void-execution.d.ts +0 -10
  354. package/dist/void-execution.js +0 -94
  355. package/dist/void-migrations.d.ts +0 -6
  356. package/dist/void-migrations.js +0 -110
  357. package/dist/void-state.d.ts +0 -16
  358. package/dist/void-state.js +0 -65
  359. package/dist/void.d.ts +0 -3
  360. package/dist/void.js +0 -5
package/README.md CHANGED
@@ -1,252 +1,46 @@
1
- # Anhedral
1
+ # Anhedral CLI
2
2
 
3
- [![CI](https://github.com/anhedral/anhedral-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/anhedral/anhedral-cli/actions/workflows/ci.yml)
4
- [![npm](https://img.shields.io/npm/v/anhedral)](https://www.npmjs.com/package/anhedral)
5
- [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
6
-
7
- > 🚧 **Under construction.** Anhedral is in active development; features and APIs may change.
8
-
9
- Anhedral creates TypeScript application workspaces and helps deliver them to your own cloud accounts. Start with a minimal universal frontend, add the services your product needs, and keep the source code, infrastructure, data and billing under your control.
10
-
11
- The default is a **minimal Expo web/iOS/Android app** with React Native Reusables using shadcn conventions, NativeWind, shared styling, TypeScript, pnpm and Turborepo. Cloudflare hosts its static web export. Add API, accounts, data, files, payments or AI when needed; the resolver supplies dependencies. `--preset full-product` selects the complete compatible product foundation without activating services.
12
-
13
- ## Start locally
14
-
15
- Use **Node.js 24.21.0 or newer** and **pnpm 10.34.5**. Initialize on Linux, macOS or WSL.
3
+ Start with one Next.js application configured for OpenNext on Cloudflare Workers, with Anhedral UI included as editable source. Add architecture when a product needs it.
16
4
 
17
5
  ```sh
18
- npm install --global anhedral
19
-
20
- # Inspect the default selection; no writes or network requests.
21
- anhedral init my-app --dry-run --json
22
-
23
- # Generate source, install dependencies and start development.
24
6
  anhedral init my-app
25
7
  cd my-app
26
8
  pnpm dev
27
9
  ```
28
10
 
29
- Initialization creates the selected frontend and API foundations, downloads any required pinned upstream starter and installs dependencies. It does not provision cloud services or deploy the app. Follow the generated README for local addresses and any setup required by your selection. You can also run the CLI with `pnpm dlx anhedral@latest`; pin a version for repeatable automation.
30
-
31
- ## Progressive stack
32
-
33
- Plain init creates only the Expo client, styling and tooling. Add capabilities for
34
- real requirements, or use `--preset full-product` for the complete compatible
35
- foundation. [See the concise stack page](docs/anhedral-stack.md).
36
-
37
- ```mermaid
38
- %%{init: {"flowchart": {"curve": "linear", "nodeSpacing": 35, "rankSpacing": 50, "padding": 18}}}%%
39
- flowchart TB
40
- subgraph minimal["1 · Minimal default"]
41
- client["Expo · web / iOS / Android<br/>React Native Reusables · shadcn conventions<br/>NativeWind · shared tokens"]
42
- web["Cloudflare static web Worker"]
43
- client -->|"web export"| web
44
- end
45
-
46
- subgraph optional["2 · Optional capabilities · choose independently"]
47
- backend["Hono API · Cloudflare Workers<br/>Public contracts · authorization"]
48
- core["Data, accounts and files<br/>Drizzle / D1 · Better Auth · private R2 · KV"]
49
- compute["AI, analytics and processing<br/>Workers AI · Analytics Engine · Basin<br/>Images · Queues · Cron · Workflows"]
50
- media["Realtime and video<br/>Durable Object rooms · RealtimeKit<br/>Stream live / uploaded video"]
51
- payments["Payments<br/>Stripe web · RevenueCat native<br/>Shared entitlements enforced by Hono"]
52
- clients["Additional client<br/>WXT browser side panel"]
53
- operations["External operations<br/>Resend email · Sentry monitoring"]
54
- backend -.-> core
55
- backend -.-> compute
56
- backend -.-> media
57
- backend -.-> payments
58
- backend -.-> operations
59
- clients -.->|"when a backend is needed"| backend
60
- end
61
-
62
- web ~~~ clients
63
- web -.->|"add API service binding"| backend
64
- client -.->|"native HTTPS when selected"| backend
65
-
66
- subgraph full["3 · Full-product preset · selection summary"]
67
- preset["Minimal app + all capabilities above<br/>22 selected products · no provider activation"]
68
- end
69
- core ~~~ preset
70
- compute ~~~ preset
71
- media ~~~ preset
72
- payments ~~~ preset
73
- operations ~~~ preset
74
- ```
75
-
76
- | Need | Selection | Added automatically |
77
- | --- | --- | --- |
78
- | Minimal client | Plain init / `--preset minimal` | Expo, NativeWind, shared tokens and workspace tooling |
79
- | Server logic | `--expo --hono` | Hono API and public contracts |
80
- | Persistence | `--d1` | Hono and Drizzle/D1 |
81
- | Accounts | `--better-auth` | Hono, a database and browser/native auth |
82
- | AI | `--workers-ai` | Hono and AI binding; no implicit accounts or billing |
83
- | Full product | `--preset full-product` | All compatible Cloudflare layers, WXT, payments, email and monitoring |
84
-
85
- The full preset includes Expo, WXT side panel, Hono, Better Auth, D1, R2, KV,
86
- Stripe, RevenueCat, Workers AI, Analytics Engine, Basin/Pipelines, Images,
87
- RealtimeKit, Durable Object rooms, uploaded/live Stream video, Queues, Cron,
88
- Workflows, Resend and Sentry. Bindings and helpers still need product logic,
89
- provider setup and real acceptance. Init never provisions or activates services.
90
-
91
- ```sh
92
- anhedral init complete --preset full-product --dry-run --json
93
- anhedral add better-auth --cwd my-app --dry-run --json
94
- anhedral add workers-ai images --cwd my-app --dry-run --json
95
- anhedral add stripe revenuecat --cwd my-app --dry-run --json
96
- ```
97
-
98
- Additions preserve edited source and reject conflicting regeneration or backend
99
- relocation. Auth additions expose `/sign-in` and `/account` for product navigation.
100
-
101
- ## Choose the applications
102
-
103
- Expo on Cloudflare is the minimal universal default. **Next.js on Vercel**
104
- (`--next`) is the usual explicit web alternative; **Vinext on Cloudflare**
105
- (`--vinext`) is also available. `--hono`, `--wxt` and `--electron` alone select
106
- standalone applications; combine them with `--expo` when desired. Explicit Neon
107
- or Clerk replace the full preset's D1 or Better Auth selections. OpenNext remains
108
- an explicit compatibility profile (`--next --hosting=cloudflare`).
109
-
110
- Every workspace uses pnpm and Turborepo with shared TypeScript/ESLint configuration
111
- and one root lockfile. Public contracts appear with Hono; server auth, database
112
- and billing packages appear only when selected. Root `pnpm dev` serves exported
113
- Expo web on 3000 and Hono on 8787 when present. Native Metro uses
114
- `pnpm --dir apps/mobile start`. Browser changes need a re-export; this is not HMR.
115
- Keep SDK 57 pinned and provide build-time paths for static dynamic routes.
116
-
117
- ## Choose data and identity
118
-
119
- | Selection | Generates | Selection rule |
120
- | --------------- | --------------------------------------------------------------------- | ----------------------------------------------------- |
121
- | `--d1` | Shared Drizzle/SQLite database package and migrations | Cloudflare runtime; alternative to Neon |
122
- | `--neon` | Shared Drizzle/PostgreSQL package using Neon HTTP | Server required; separate direct migration connection |
123
- | `--better-auth` | Auth factory, database schema and server auth routes | Adds D1 when no database is selected; can use Neon |
124
- | `--clerk` | Managed web identity integration and/or backend authentication helper | Alternative to Better Auth; server required |
125
- | `--local-data` | Device-local persistence interface | Implement platform adapters and synchronization |
126
-
127
- Database code lives in `packages/db`, including schemas and explicit migration tooling. Browser and device clients call server endpoints. Hosting audience protection and application resource authorization are separate from selecting an identity provider.
128
-
129
- ## Choose services and integrations
130
-
131
- Private R2 and every service below are optional; full-product selects the complete compatible set. The generated scope column distinguishes bindings and Workers from SDK factories and integration guidance.
132
-
133
- | Selection | Purpose | Generated scope |
134
- | ----------------- | --------------------------------- | ---------------------------------------------------------------------------------------- |
135
- | `--r2` | Private files | R2 Worker binding and authorization guidance |
136
- | `--analytics-engine` | Custom event analytics | Dataset binding and privacy-safe server event helper |
137
- | `--images` | Image processing | Images binding and private raw-byte transform helper |
138
- | `--realtimekit` | Audio/video conferencing | Meeting/participant-token helpers; client SDK/UI remains product work |
139
- | `--video` | Uploaded video | Private Stream upload helper; implement processing checks and signed playback |
140
- | `--kv` | Cache/configuration | Eventually consistent Worker binding |
141
- | `--realtime` | WebSocket rooms | Separate Durable Object Worker; implement room authorization |
142
- | `--neon-realtime` | Live PostgreSQL query results | Server/client factories and Drizzle adapter; adds Neon; manual branch activation |
143
- | `--stream` | One-to-many live video | Cloudflare Stream WHIP/WHEP; server management factory; manual activation and product UI |
144
- | `--queues` | Background jobs | Producer, consumer and dead-letter configuration; implement processing/idempotency |
145
- | `--cron` | Scheduled work | Separate Worker with an hourly starter schedule |
146
- | `--workflows` | Durable multi-step work | Separate Worker with a starter validation step |
147
- | `--workers-ai` | Cloudflare inference | Worker AI binding; implement model calls |
148
- | `--openai` | Direct OpenAI integration | Server SDK factory in `packages/ai` |
149
- | `--ai-sdk` | AI streaming/provider abstraction | AI SDK exports with an OpenAI provider; alternative to `--openai` |
150
- | `--resend` | Transactional email | Server SDK factory in `packages/email` |
151
- | `--stripe` | Payments/subscriptions | Hono Checkout/portal/webhooks, DB projection and server entitlement guard |
152
- | `--revenuecat` | Cross-store entitlements | Native purchase/restore/manage plus Hono webhooks and shared entitlement projection |
153
- | `--sentry` | Error/crash monitoring | Integration boundary and redaction fields; initialize platform SDKs |
154
- | `--posthog` | Product analytics | Server analytics factory |
155
- | `--basin` | Cloudflare analytical events | Private stream binding and event helper |
156
- | `--styling` | Shared design tokens | Light/dark tokens and Tailwind preset; automatically included with Expo/WXT |
157
-
158
- Live video (`--stream`), room messaging (`--realtime`) and live SQL (`--neon-realtime`) can coexist. See [live video setup and limits](docs/stack-standard.md#live-video-with-cloudflare-stream). PostHog and Basin can coexist with separate packages. Workers AI can accompany either AI SDK choice. Provider setup supports selected resources for Neon, Clerk, Resend, Stripe, RevenueCat, Sentry, PostHog and OpenAI; credentials, permissions and remaining owner steps are described in the [provider reference](docs/software-factory.md#provider-configuration).
159
-
160
- ### Composition rules
161
-
162
- - Choose one web framework, one database and one identity provider; D1 and Better Auth are the defaults when data/identity is needed. `--openai` and `--ai-sdk` are alternatives.
163
- - Database/auth, Stream and Neon Realtime selections need a compatible server. For mobile with PostgreSQL, use `--expo --hono --neon`.
164
- - New server capabilities introduce Hono on Cloudflare, including for Next.js/Vercel. Existing apps retain runtime ownership during `add`.
165
- - New Expo workspaces, explicit OpenNext, Queues, Basin, Images and Analytics Engine use Wrangler for the Cloudflare workspace. Other supported Cloudflare selections use Void. `add` rejects changes that switch an existing engine or relocate runtime source.
166
- - Neon Realtime requires Neon and manual Realtime configuration. Stripe and RevenueCat are independently optional; WXT is an optional browser-extension interface.
167
-
168
- Examples:
169
-
170
- ```sh
171
- # Web with database-backed identity; Better Auth adds D1.
172
- anhedral init my-app --better-auth
173
-
174
- # Universal web/iOS/Android, shared API and PostgreSQL.
175
- anhedral init my-app --expo --neon
176
-
177
- # Vercel web with a Cloudflare API and private files.
178
- anhedral init my-app --next --r2
179
-
180
- # Live broadcasts with independent room messaging and SQL subscriptions.
181
- anhedral init my-app --stream --neon-realtime --realtime
182
- ```
183
-
184
- Inspect the full catalog and preview later additions:
185
-
186
- ```sh
187
- anhedral registry list
188
- anhedral registry view resend --json
189
- anhedral add resend --cwd my-app --dry-run --json
190
- anhedral add resend --cwd my-app
191
- ```
192
-
193
- Generated entry points live in `apps/*`, shared code in `packages/*`, and Anhedral configuration in one root `anhedral.json`. Read the [source-only full-stack example](https://github.com/anhedral/anhedral-cli/tree/main/examples/full-stack) to see a larger project without creating services.
194
-
195
- ## Build and deliver
196
-
197
- Implement the product, configure selected integrations and review database migrations. Then use the [software factory](docs/software-factory.md) to check provider access, connect the intended account and audience, commit source, ship and verify real user flows.
11
+ Init creates only `apps/web` plus shared tooling and tokens. It includes three reviewed web starter components (Button, Input and Label), official shadcn configuration and Anhedral UI metadata. It creates no Expo app, API, database, authentication or cloud resources.
198
12
 
199
13
  ```sh
200
- anhedral auth --status --json
201
- anhedral doctor --providers --json
202
- # Select the intended account and audience, then commit source/configuration.
203
- anhedral connect --audience private --allow-email owner@example.com
204
- git add .
205
- git commit -m "Implement application and delivery configuration"
206
- anhedral ship --dry-run --json
207
- anhedral ship --json
208
- anhedral verify --json
14
+ anhedral init my-app --dry-run --json
15
+ anhedral init my-app --skip-install --no-git
16
+ anhedral ui list
17
+ anhedral ui add card --web
18
+ anhedral ui diff card --web
19
+ anhedral ui doctor --web
209
20
  ```
210
21
 
211
- Replace the example member with the intended user. Private Cloudflare hosting requires Zero Trust and scoped Access permissions; native Vercel uses its own connect options in the factory. Implement a meaningful `test:live` script before `verify`. Actual shipping can create resources, apply reviewed deployment migrations and publish code. Provider permissions, account eligibility and usage charges still apply. A generated starter or successful deployment does not establish a working product.
212
-
213
- Cloudflare and Vercel have automated delivery and provider evidence checks. Mixed delivery runs Cloudflare before Vercel and can partially succeed. Expo native shipping with an explicit platform returns verified EAS build artifacts; store submission is separate. Electron and extension projects include local build/package tooling, with signing and distribution handled through their platform workflows.
22
+ Anhedral UI is a small catalog and CLI over official shadcn on web and React Native Reusables on native. Components are copied into your application. Native resolution prefers a reviewed Anhedral extension when one exists, then RNR; unsupported components are reported. The extension registry starts empty. There is no Anhedral component runtime, whole-library fork or automatic source replacement.
214
23
 
215
- Use the [stack standard](docs/stack-standard.md) for destinations, compatibility, migration ownership, environment files and the remaining implementation requirements for every option. Exact dependency versions live in the [source catalog](https://github.com/anhedral/anhedral-cli/blob/main/src/dependencies.ts).
24
+ For an existing Expo app, complete the upstream React Native Reusables NativeWind 4 setup first, then use `anhedral ui init --native`. Ambiguous workspaces require `--web`, `--native`, `--all` or an application-specific `--cwd`. UI installation does not require Hono, a database or authentication.
216
25
 
217
- ## Use with Codex
26
+ Add the rest strategically through the CLI:
218
27
 
219
28
  ```sh
220
- codex plugin marketplace add anhedral/anhedral-cli
221
- codex plugin add anhedral@anhedral
29
+ anhedral stack list
30
+ anhedral add hono
31
+ anhedral add database-auth
32
+ anhedral add expo native-ui --dry-run --json
33
+ anhedral add side-panel --with-dependencies --dry-run --json
222
34
  ```
223
35
 
224
- Select **Try now**, or start with:
36
+ The catalog includes private R2, Stripe, events, RTC, AI, Expo, native UI, RevenueCat, WXT, Side Panel and GPUI. Missing prerequisites require an explicit selection or `--with-dependencies`. “If needed” decisions remain open. Additions preserve edited source and do not provision providers, install credentials, migrate databases or deploy. Anhedral Platform remains a separate managed product; no Platform account is required.
225
37
 
226
- > Create a new project using [@Anhedral](plugin://anhedral@anhedral). Start by explaining the stack and asking me what it should be about.
38
+ See [stack standard](docs/stack-standard.md), [workflow](docs/software-factory.md) and [UI commands](docs/ui.md) and [stack additions](docs/capabilities.md).
227
39
 
228
- The plugin ships six focused skills: Init, Dev, Design, Auth, Billing and Hosting. They guide implementation using the same stack and workflow. Its optional inspector shows project structure, setup, recorded delivery evidence and explicit service controls. Opening it does not deploy the app. The CLI works independently.
40
+ ## Compatibility
229
41
 
230
- ## Read next
231
-
232
- | Document | Use it to answer |
233
- | -------------------------------------------- | ------------------------------------------------------------------------ |
234
- | [Stack standard](docs/stack-standard.md) | What should the application contain, and how should it fit together? |
235
- | [Software factory](docs/software-factory.md) | How do I turn a brief into a tested, delivered and maintainable product? |
236
-
237
- The [verification record](docs/verification.md) keeps dated code reviews, provider evidence and remaining acceptance gaps together. Provider setup, CLI behavior, dashboard development and the release process are sections of the software factory.
238
-
239
- Use `anhedral --help` and `anhedral help <command>` for command options. `--cwd` selects the project; `--json` produces structured output. Use its [provider configuration](docs/software-factory.md#provider-configuration), [CLI behavior](docs/software-factory.md#cli-behavior), [Codex dashboard](docs/software-factory.md#project-dashboard) and [release process](docs/software-factory.md#maintain-and-release-the-cli) sections for details.
240
-
241
- ## Work on the CLI
242
-
243
- ```sh
244
- pnpm install --frozen-lockfile
245
- pnpm build
246
- node dist/bin.js init ../my-test-app --dry-run --json
247
- pnpm test:all
248
- ```
42
+ This changes the default generated layout. Existing applications, Platform runtime images and installed plugins keep their reviewed pins until explicitly upgraded. The retained legacy native source and full-stack recipes are compatibility material; new init does not copy them. Publishing does not update an existing application or installed plugin.
249
43
 
250
- `pnpm test:integration` installs and checks generated projects. Inspector development uses `pnpm plugin:build`, `pnpm plugin:check` and `pnpm plugin:preview`; its dependencies and lockfile live in `plugins/codex/inspector`. Building the checkout does not update an installed CLI or plugin. See the [contribution guide](https://github.com/anhedral/anhedral-cli/blob/main/.github/CONTRIBUTING.md) for the development and review process.
44
+ For source development, run `pnpm install --frozen-lockfile && pnpm build`, then `node dist/bin.js init my-app`.
251
45
 
252
- Anhedral is open source under the [Apache License 2.0](LICENSE). Generated applications are source code that developers can customize and license for their products, preserving upstream notices. Report bugs in [issues](https://github.com/anhedral/anhedral-cli/issues) and vulnerabilities through [private security reporting](https://github.com/anhedral/anhedral-cli/security/advisories/new).
46
+ Apache-2.0. Generated applications are editable source that consumers may customize and license for their own products. Retain the applicable MIT notices for copied upstream UI source.
@@ -63,8 +63,18 @@ export function verifyAuditReport(report, { status, patchedCoordinates = [] } =
63
63
  )
64
64
  )
65
65
  fail('Incomplete advisory details; no advisory exception was applied.');
66
- if (new Set(finding.findings.map((item) => item.version)).size !== finding.findings.length)
67
- fail('Duplicate affected versions in advisory details.');
66
+ // pnpm emits separate peer/workspace instances with the same version.
67
+ // Keep every instance in severity counts; only an identical version/path
68
+ // repeated within this advisory is ambiguous report data.
69
+ const affectedPaths = new Set();
70
+ for (const item of finding.findings) {
71
+ for (const dependencyPath of item.paths) {
72
+ const coordinate = JSON.stringify([item.version, dependencyPath]);
73
+ if (affectedPaths.has(coordinate))
74
+ fail('Duplicate affected version/path in advisory details.');
75
+ affectedPaths.add(coordinate);
76
+ }
77
+ }
68
78
  counts[finding.severity] += finding.findings.length;
69
79
  }
70
80
  for (const severity of severities) {
@@ -0,0 +1,5 @@
1
+ import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
+ export const aiUsage = sqliteTable('ai_usage', {
3
+ id: text('id').primaryKey(),
4
+ count: integer('count').notNull(),
5
+ });
@@ -0,0 +1,30 @@
1
+ import { Hono } from 'hono';
2
+ import { z } from 'zod';
3
+ import { requireSession } from '../security';
4
+ import type { AppEnv } from '../environment';
5
+ export const aiRoutes = new Hono<AppEnv>();
6
+ const configuration = z.object({
7
+ AI_MODEL: z.string().min(1),
8
+ AI_DAILY_LIMIT: z.coerce.number().int().min(1).max(1000),
9
+ });
10
+ const input = z.object({ prompt: z.string().trim().min(1).max(4000) });
11
+ aiRoutes.post('/ai/generate', requireSession, async (c) => {
12
+ const config = configuration.safeParse(c.env);
13
+ if (!config.success)
14
+ return c.json({ error: 'Choose a model and a daily limit from 1 to 1000' }, 503);
15
+ const body = input.safeParse(await c.req.json().catch(() => null));
16
+ if (!body.success) return c.json({ error: 'Prompt must contain 1–4000 characters' }, 400);
17
+ const key = c.get('userId') + ':' + new Date().toISOString().slice(0, 10);
18
+ const quota = await c.env.DB.prepare(
19
+ 'INSERT INTO ai_usage(id,count) VALUES (?,1) ON CONFLICT(id) DO UPDATE SET count = count + 1 WHERE count < ? RETURNING count',
20
+ )
21
+ .bind(key, config.data.AI_DAILY_LIMIT)
22
+ .first();
23
+ if (!quota) return c.json({ error: 'Daily AI limit reached' }, 429);
24
+ // Failed provider calls consume quota as well; retrying cannot bypass the limit.
25
+ const result = await c.env.AI.run(config.data.AI_MODEL as Parameters<Ai['run']>[0], {
26
+ messages: [{ role: 'user', content: body.data.prompt }],
27
+ max_tokens: 512,
28
+ });
29
+ return c.json({ result });
30
+ });
@@ -0,0 +1,15 @@
1
+ import { Hono } from 'hono';
2
+ import { bodyLimit } from 'hono/body-limit';
3
+ import { capabilities } from './capabilities';
4
+ import type { AppEnv } from './environment';
5
+
6
+ const app = new Hono<AppEnv>();
7
+ app.use('/api/*', bodyLimit({ maxSize: 1024 * 1024 }));
8
+ app.use('/api/*', async (c, next) => {
9
+ await next();
10
+ c.header('Cache-Control', 'private, no-store');
11
+ });
12
+ app.get('/api/health', (c) => c.json({ ok: true }));
13
+ app.route('/api', capabilities);
14
+ app.onError((_error, c) => c.json({ error: 'Application request failed' }, 500));
15
+ export default app;
@@ -0,0 +1,4 @@
1
+ // Enable methods deliberately after configuring credentials, email and policies.
2
+ // OAuth, passkeys, MFA and organizations each need their matching provider/plugin,
3
+ // schema generation, reviewed migrations and client configuration before use.
4
+ export const authFeatures = { emailPassword: false };
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "sqlite",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "6",
8
+ "when": 1791504000000,
9
+ "tag": "0000_better_auth",
10
+ "breakpoints": true
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,53 @@
1
+ CREATE TABLE `account` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `account_id` text NOT NULL,
4
+ `provider_id` text NOT NULL,
5
+ `user_id` text NOT NULL,
6
+ `access_token` text,
7
+ `refresh_token` text,
8
+ `id_token` text,
9
+ `access_token_expires_at` integer,
10
+ `refresh_token_expires_at` integer,
11
+ `scope` text,
12
+ `password` text,
13
+ `created_at` integer NOT NULL,
14
+ `updated_at` integer NOT NULL,
15
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
16
+ );
17
+ --> statement-breakpoint
18
+ CREATE INDEX `account_user_id_idx` ON `account` (`user_id`);--> statement-breakpoint
19
+ CREATE TABLE `session` (
20
+ `id` text PRIMARY KEY NOT NULL,
21
+ `expires_at` integer NOT NULL,
22
+ `token` text NOT NULL,
23
+ `created_at` integer NOT NULL,
24
+ `updated_at` integer NOT NULL,
25
+ `ip_address` text,
26
+ `user_agent` text,
27
+ `user_id` text NOT NULL,
28
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
29
+ );
30
+ --> statement-breakpoint
31
+ CREATE UNIQUE INDEX `session_token_unique` ON `session` (`token`);--> statement-breakpoint
32
+ CREATE INDEX `session_user_id_idx` ON `session` (`user_id`);--> statement-breakpoint
33
+ CREATE TABLE `user` (
34
+ `id` text PRIMARY KEY NOT NULL,
35
+ `name` text NOT NULL,
36
+ `email` text NOT NULL,
37
+ `email_verified` integer DEFAULT false NOT NULL,
38
+ `image` text,
39
+ `created_at` integer NOT NULL,
40
+ `updated_at` integer NOT NULL
41
+ );
42
+ --> statement-breakpoint
43
+ CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
44
+ CREATE TABLE `verification` (
45
+ `id` text PRIMARY KEY NOT NULL,
46
+ `identifier` text NOT NULL,
47
+ `value` text NOT NULL,
48
+ `expires_at` integer NOT NULL,
49
+ `created_at` integer NOT NULL,
50
+ `updated_at` integer NOT NULL
51
+ );
52
+ --> statement-breakpoint
53
+ CREATE INDEX `verification_identifier_idx` ON `verification` (`identifier`);
@@ -0,0 +1,11 @@
1
+ import { Hono } from 'hono';
2
+ import { createAuth, authConfiguration } from '../auth';
3
+ import { requireSession } from '../security';
4
+ import type { AppEnv } from '../environment';
5
+ export const authRoutes = new Hono<AppEnv>();
6
+ authRoutes.on(['GET', 'POST'], '/auth/*', (c) => {
7
+ if (!authConfiguration.safeParse(c.env).success)
8
+ return c.json({ error: 'Authentication needs configuration' }, 503);
9
+ return createAuth(c.env).handler(c.req.raw);
10
+ });
11
+ authRoutes.get('/session', requireSession, (c) => c.json({ userId: c.get('userId') }));
@@ -0,0 +1,64 @@
1
+ import { index, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
2
+ const timestamps = () => ({
3
+ createdAt: integer('created_at', { mode: 'timestamp_ms' })
4
+ .notNull()
5
+ .$defaultFn(() => new Date()),
6
+ updatedAt: integer('updated_at', { mode: 'timestamp_ms' })
7
+ .notNull()
8
+ .$defaultFn(() => new Date())
9
+ .$onUpdate(() => new Date()),
10
+ });
11
+ export const user = sqliteTable('user', {
12
+ id: text('id').primaryKey(),
13
+ name: text('name').notNull(),
14
+ email: text('email').notNull().unique(),
15
+ emailVerified: integer('email_verified', { mode: 'boolean' }).notNull().default(false),
16
+ image: text('image'),
17
+ ...timestamps(),
18
+ });
19
+ export const session = sqliteTable(
20
+ 'session',
21
+ {
22
+ id: text('id').primaryKey(),
23
+ expiresAt: integer('expires_at', { mode: 'timestamp_ms' }).notNull(),
24
+ token: text('token').notNull().unique(),
25
+ ...timestamps(),
26
+ ipAddress: text('ip_address'),
27
+ userAgent: text('user_agent'),
28
+ userId: text('user_id')
29
+ .notNull()
30
+ .references(() => user.id, { onDelete: 'cascade' }),
31
+ },
32
+ (t) => [index('session_user_id_idx').on(t.userId)],
33
+ );
34
+ export const account = sqliteTable(
35
+ 'account',
36
+ {
37
+ id: text('id').primaryKey(),
38
+ accountId: text('account_id').notNull(),
39
+ providerId: text('provider_id').notNull(),
40
+ userId: text('user_id')
41
+ .notNull()
42
+ .references(() => user.id, { onDelete: 'cascade' }),
43
+ accessToken: text('access_token'),
44
+ refreshToken: text('refresh_token'),
45
+ idToken: text('id_token'),
46
+ accessTokenExpiresAt: integer('access_token_expires_at', { mode: 'timestamp_ms' }),
47
+ refreshTokenExpiresAt: integer('refresh_token_expires_at', { mode: 'timestamp_ms' }),
48
+ scope: text('scope'),
49
+ password: text('password'),
50
+ ...timestamps(),
51
+ },
52
+ (t) => [index('account_user_id_idx').on(t.userId)],
53
+ );
54
+ export const verification = sqliteTable(
55
+ 'verification',
56
+ {
57
+ id: text('id').primaryKey(),
58
+ identifier: text('identifier').notNull(),
59
+ value: text('value').notNull(),
60
+ expiresAt: integer('expires_at', { mode: 'timestamp_ms' }).notNull(),
61
+ ...timestamps(),
62
+ },
63
+ (t) => [index('verification_identifier_idx').on(t.identifier)],
64
+ );