vibefast-cli 1.1.5 → 1.3.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 (301) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +63 -169
  3. package/dist/__tests__/recipes.test.js +89 -85
  4. package/dist/__tests__/recipes.test.js.map +1 -1
  5. package/dist/commands/add.d.ts +1 -1
  6. package/dist/commands/add.d.ts.map +1 -1
  7. package/dist/commands/add.js +576 -588
  8. package/dist/commands/add.js.map +1 -1
  9. package/dist/commands/checklist.d.ts +1 -1
  10. package/dist/commands/checklist.d.ts.map +1 -1
  11. package/dist/commands/checklist.js +40 -39
  12. package/dist/commands/checklist.js.map +1 -1
  13. package/dist/commands/doctor.d.ts +1 -1
  14. package/dist/commands/doctor.js +22 -22
  15. package/dist/commands/doctor.js.map +1 -1
  16. package/dist/commands/env.d.ts +1 -1
  17. package/dist/commands/env.d.ts.map +1 -1
  18. package/dist/commands/env.js +58 -53
  19. package/dist/commands/env.js.map +1 -1
  20. package/dist/commands/health.d.ts +1 -1
  21. package/dist/commands/health.d.ts.map +1 -1
  22. package/dist/commands/health.js +101 -93
  23. package/dist/commands/health.js.map +1 -1
  24. package/dist/commands/init.d.ts +1 -1
  25. package/dist/commands/init.d.ts.map +1 -1
  26. package/dist/commands/init.js +416 -296
  27. package/dist/commands/init.js.map +1 -1
  28. package/dist/commands/remove.d.ts +1 -1
  29. package/dist/commands/remove.d.ts.map +1 -1
  30. package/dist/commands/remove.js +77 -64
  31. package/dist/commands/remove.js.map +1 -1
  32. package/dist/commands/status.d.ts +1 -1
  33. package/dist/commands/status.d.ts.map +1 -1
  34. package/dist/commands/status.js +15 -14
  35. package/dist/commands/status.js.map +1 -1
  36. package/dist/core/__tests__/detect.test.js +68 -34
  37. package/dist/core/__tests__/detect.test.js.map +1 -1
  38. package/dist/core/ast.d.ts +14 -0
  39. package/dist/core/ast.d.ts.map +1 -0
  40. package/dist/core/ast.js +239 -0
  41. package/dist/core/ast.js.map +1 -0
  42. package/dist/core/codemod.d.ts.map +1 -1
  43. package/dist/core/codemod.js +62 -44
  44. package/dist/core/codemod.js.map +1 -1
  45. package/dist/core/config.d.ts +10 -0
  46. package/dist/core/config.d.ts.map +1 -0
  47. package/dist/core/config.js +51 -0
  48. package/dist/core/config.js.map +1 -0
  49. package/dist/core/detect.d.ts +8 -2
  50. package/dist/core/detect.d.ts.map +1 -1
  51. package/dist/core/detect.js +52 -21
  52. package/dist/core/detect.js.map +1 -1
  53. package/dist/core/errors.d.ts.map +1 -1
  54. package/dist/core/errors.js +9 -8
  55. package/dist/core/errors.js.map +1 -1
  56. package/dist/core/exec.d.ts +16 -0
  57. package/dist/core/exec.d.ts.map +1 -0
  58. package/dist/core/exec.js +48 -0
  59. package/dist/core/exec.js.map +1 -0
  60. package/dist/core/manualSteps.d.ts +7 -0
  61. package/dist/core/manualSteps.d.ts.map +1 -0
  62. package/dist/core/manualSteps.js +59 -0
  63. package/dist/core/manualSteps.js.map +1 -0
  64. package/dist/core/paths.d.ts +3 -1
  65. package/dist/core/paths.d.ts.map +1 -1
  66. package/dist/core/paths.js +14 -10
  67. package/dist/core/paths.js.map +1 -1
  68. package/dist/core/spinner.d.ts +1 -1
  69. package/dist/core/spinner.d.ts.map +1 -1
  70. package/dist/core/spinner.js +38 -8
  71. package/dist/core/spinner.js.map +1 -1
  72. package/dist/core/vosk.d.ts.map +1 -1
  73. package/dist/core/vosk.js +50 -39
  74. package/dist/core/vosk.js.map +1 -1
  75. package/docs/manual-testing.md +91 -0
  76. package/package.json +6 -3
  77. package/recipes/audio-recorder/apps/native/src/app/audio-recorder/index.tsx +5 -0
  78. package/recipes/audio-recorder/recipe.json +3 -3
  79. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-player.tsx +301 -0
  80. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-recorder.tsx +373 -0
  81. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-waveform.tsx +270 -0
  82. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/index.ts +4 -0
  83. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/recording-list.tsx +89 -0
  84. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-player-demo.tsx +66 -0
  85. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-recorder-cloud.tsx +68 -0
  86. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-recorder-interview.tsx +102 -0
  87. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/basic.tsx +27 -0
  88. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/index.ts +5 -0
  89. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/with-recording-list-demo.tsx +82 -0
  90. package/recipes/audio-recorder-supabase/packages/backend/src/services/recordings.ts +369 -0
  91. package/recipes/audio-recorder-supabase/packages/backend/supabase/migrations/recordings.sql +70 -0
  92. package/recipes/audio-recorder-supabase/recipe.json +52 -0
  93. package/recipes/audio-recorder-supabase@latest.zip +0 -0
  94. package/recipes/audio-recorder@latest.zip +0 -0
  95. package/recipes/charts/apps/native/src/features/charts/components/bar-chart.tsx +3 -3
  96. package/recipes/charts/apps/native/src/features/charts/components/candlestick-chart.tsx +2 -2
  97. package/recipes/charts/apps/native/src/features/charts/components/chart-card.tsx +5 -5
  98. package/recipes/charts/apps/native/src/features/charts/components/column-chart.tsx +3 -3
  99. package/recipes/charts/apps/native/src/features/charts/components/doughnut-chart.tsx +20 -4
  100. package/recipes/charts/apps/native/src/features/charts/components/line-chart.tsx +7 -6
  101. package/recipes/charts/apps/native/src/features/charts/components/radar-chart.tsx +6 -4
  102. package/recipes/charts/apps/native/src/features/charts/components/radial-bar-chart.tsx +1 -1
  103. package/recipes/charts/apps/native/src/features/charts/components/stacked-bar-chart.tsx +5 -4
  104. package/recipes/charts/recipe.json +4 -13
  105. package/recipes/charts@latest.zip +0 -0
  106. package/recipes/chatbot/apps/native/src/app/chatbot/index.tsx +1 -0
  107. package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-markdown.tsx +86 -86
  108. package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/code-block.tsx +86 -53
  109. package/recipes/chatbot/recipe.json +26 -92
  110. package/recipes/chatbot-supabase/apps/native/src/api-client/supabase/chatbot.ts +515 -0
  111. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/app/index.tsx +257 -0
  112. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-header-buttons.tsx +59 -0
  113. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-input-bar.tsx +485 -0
  114. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-markdown.tsx +575 -0
  115. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-message-bubble.tsx +223 -0
  116. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-settings-modal.tsx +161 -0
  117. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/image-preview-list.tsx +116 -0
  118. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/code-block.tsx +165 -0
  119. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/index.ts +10 -0
  120. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/table-renderer.tsx +129 -0
  121. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/message-error-boundary.tsx +78 -0
  122. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/message-list.tsx +170 -0
  123. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/model-selector.tsx +283 -0
  124. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/report-content-modal.tsx +188 -0
  125. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/suggested-messages.tsx +67 -0
  126. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/constants/models.ts +20 -0
  127. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/constants/report-reasons.ts +9 -0
  128. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-attachment-cache.ts +142 -0
  129. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chat-config.ts +458 -0
  130. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chat-handlers.ts +429 -0
  131. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chatbot-settings.ts +89 -0
  132. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-conversation.ts +90 -0
  133. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-image-picker.ts +122 -0
  134. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-keyboard-coordinator.ts +161 -0
  135. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-smart-scroll-manager.ts +213 -0
  136. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/index.ts +86 -0
  137. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/models.ts +162 -0
  138. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/providers.ts +62 -0
  139. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/types.ts +40 -0
  140. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/services/file-uploader.ts +287 -0
  141. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/services/message-handler-service.ts +189 -0
  142. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/types/index.ts +70 -0
  143. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/utils/chat-telemetry.ts +91 -0
  144. package/recipes/chatbot-supabase/packages/backend/src/services/conversations.ts +243 -0
  145. package/recipes/chatbot-supabase/packages/backend/src/services/messages.ts +327 -0
  146. package/recipes/chatbot-supabase/packages/backend/supabase/functions/chat-stream/index.ts +347 -0
  147. package/recipes/chatbot-supabase/packages/backend/supabase/migrations/chatbot.sql +104 -0
  148. package/recipes/chatbot-supabase/recipe.json +106 -0
  149. package/recipes/chatbot-supabase@latest.zip +0 -0
  150. package/recipes/chatbot.zip +0 -0
  151. package/recipes/chatbot@latest.zip +0 -0
  152. package/recipes/image-analysis/packages/backend/convex/imageAnalysis/index.ts +2 -2
  153. package/recipes/image-analysis/packages/backend/convex/imageAnalysis.ts +0 -1
  154. package/recipes/image-analysis/recipe.json +15 -55
  155. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/analysis-options-screen.tsx +304 -0
  156. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/camera.tsx +221 -0
  157. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/image-capture-screen.tsx +333 -0
  158. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/loading-screen.tsx +214 -0
  159. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/loading.tsx +191 -0
  160. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/results.tsx +137 -0
  161. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/trait-details.tsx +172 -0
  162. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/use-analysis-data.ts +160 -0
  163. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/use-results-screen.ts +151 -0
  164. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-badge.tsx +77 -0
  165. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-card.tsx +75 -0
  166. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-unlocked-modal.tsx +162 -0
  167. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievements-section.tsx +44 -0
  168. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/advice-list.tsx +42 -0
  169. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/circular-progress.tsx +233 -0
  170. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/content-card.tsx +38 -0
  171. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/error-state.tsx +42 -0
  172. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/index.ts +9 -0
  173. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/loading-state.tsx +26 -0
  174. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/profile-image.tsx +60 -0
  175. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/results-header.tsx +62 -0
  176. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/score-display.tsx +54 -0
  177. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/share-options-modal.tsx +110 -0
  178. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/traits-grid.tsx +74 -0
  179. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/config/analysis-config.ts +80 -0
  180. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/config/master-analysis-config.ts +157 -0
  181. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/index.ts +1 -0
  182. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/use-analysis.ts +38 -0
  183. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/use-image-analysis.ts +208 -0
  184. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/analysis-service.ts +262 -0
  185. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/share-service.ts +176 -0
  186. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/trait-details-service.ts +289 -0
  187. package/recipes/image-analysis-supabase/packages/backend/src/services/image-analyses.ts +132 -0
  188. package/recipes/image-analysis-supabase/packages/backend/supabase/functions/analyze-image/index.ts +312 -0
  189. package/recipes/image-analysis-supabase/packages/backend/supabase/migrations/image_analysis.sql +42 -0
  190. package/recipes/image-analysis-supabase/recipe.json +90 -0
  191. package/recipes/image-analysis-supabase@latest.zip +0 -0
  192. package/recipes/image-analysis@latest.zip +0 -0
  193. package/recipes/image-generator/apps/native/src/features/image-generator/app/index.tsx +16 -2
  194. package/recipes/image-generator/apps/native/src/features/image-generator/components/image-model-selector.tsx +11 -5
  195. package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-generator.ts +11 -5
  196. package/recipes/image-generator/packages/backend/convex/imageGeneration/index.ts +2 -2
  197. package/recipes/image-generator/recipe.json +16 -39
  198. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/_layout.tsx +26 -0
  199. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/gallery.tsx +217 -0
  200. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/index.tsx +251 -0
  201. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/gallery-image.tsx +25 -0
  202. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-detail-modal.tsx +215 -0
  203. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-model-selector.tsx +216 -0
  204. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-placeholder.tsx +26 -0
  205. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-gallery.ts +71 -0
  206. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-generator-settings.ts +152 -0
  207. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-generator.ts +103 -0
  208. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/models/models.ts +66 -0
  209. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/services/image-gallery-service.ts +96 -0
  210. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/services/image-save-service.ts +120 -0
  211. package/recipes/image-generator-supabase/packages/backend/supabase/functions/generate-image/index.ts +291 -0
  212. package/recipes/image-generator-supabase/packages/backend/supabase/migrations/image_generator.sql +71 -0
  213. package/recipes/image-generator-supabase/recipe.json +86 -0
  214. package/recipes/image-generator-supabase@latest.zip +0 -0
  215. package/recipes/image-generator@latest.zip +0 -0
  216. package/recipes/ios-widget/recipe.json +15 -24
  217. package/recipes/ios-widget@latest.zip +0 -0
  218. package/recipes/onboarding/apps/native/src/features/onboarding/analytics/index.ts +9 -0
  219. package/recipes/onboarding/apps/native/src/features/onboarding/components/onboarding-with-analytics.tsx +141 -0
  220. package/recipes/onboarding/apps/native/src/features/onboarding/components/onboarding.tsx +173 -0
  221. package/recipes/onboarding/apps/native/src/features/onboarding/config/onboarding-flow-config.ts +189 -0
  222. package/recipes/onboarding/apps/native/src/features/onboarding/demo-one/app/index.tsx +42 -0
  223. package/recipes/onboarding/apps/native/src/features/onboarding/demo-one/data.ts +32 -0
  224. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/app/index.tsx +43 -0
  225. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/interactive-onboarding.tsx +222 -0
  226. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/ai-tone-step.tsx +133 -0
  227. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/currency-step.tsx +165 -0
  228. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-ai-step.tsx +199 -0
  229. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-chatbot-step.tsx +154 -0
  230. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-manual-step.tsx +156 -0
  231. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-scan-step.tsx +158 -0
  232. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/main-reason-step.tsx +139 -0
  233. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/notification-step.tsx +129 -0
  234. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/overspend-step.tsx +138 -0
  235. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/personalizing-step.tsx +190 -0
  236. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/rating-step.tsx +98 -0
  237. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/reminder-step.tsx +181 -0
  238. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/safety-step.tsx +110 -0
  239. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/struggle-step.tsx +139 -0
  240. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/welcome-step.tsx +217 -0
  241. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/ui/onboarding-header.tsx +58 -0
  242. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/constants.ts +179 -0
  243. package/recipes/onboarding/apps/native/src/features/onboarding/hooks/use-onboarding-analytics.ts +323 -0
  244. package/recipes/onboarding/apps/native/src/features/onboarding/services/onboarding-analytics.ts +432 -0
  245. package/recipes/onboarding/recipe.json +15 -0
  246. package/recipes/onboarding@latest.zip +0 -0
  247. package/recipes/payments/recipe.json +28 -61
  248. package/recipes/payments-supabase/apps/native/src/features/payments/README.md +200 -0
  249. package/recipes/payments-supabase/apps/native/src/features/payments/app/local-paywall.tsx +194 -0
  250. package/recipes/payments-supabase/apps/native/src/features/payments/app/remote-paywall.tsx +79 -0
  251. package/recipes/payments-supabase/apps/native/src/features/payments/components/payment-initializer.tsx +95 -0
  252. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-error-state.tsx +60 -0
  253. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-local-mode.tsx +116 -0
  254. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-product-card.tsx +133 -0
  255. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-remote-mode.tsx +146 -0
  256. package/recipes/payments-supabase/apps/native/src/features/payments/hooks/use-entitlement.ts +63 -0
  257. package/recipes/payments-supabase/apps/native/src/features/payments/index.ts +8 -0
  258. package/recipes/payments-supabase/apps/native/src/features/payments/services/revenuecat-adapter.ts +407 -0
  259. package/recipes/payments-supabase/packages/backend/src/services/payments.ts +201 -0
  260. package/recipes/payments-supabase/packages/backend/supabase/migrations/payments.sql +35 -0
  261. package/recipes/payments-supabase/recipe.json +72 -0
  262. package/recipes/payments-supabase@latest.zip +0 -0
  263. package/recipes/payments@latest.zip +0 -0
  264. package/recipes/quiz/apps/native/src/features/quiz/index.tsx +1 -2
  265. package/recipes/quiz/recipe.json +6 -9
  266. package/recipes/quiz@latest.zip +0 -0
  267. package/recipes/tracker-app/apps/native/src/features/tracker-app/app/index.tsx +1 -2
  268. package/recipes/tracker-app/recipe.json +7 -10
  269. package/recipes/tracker-app@latest.zip +0 -0
  270. package/recipes/voice-bot/recipe.json +8 -68
  271. package/recipes/voice-bot.zip +0 -0
  272. package/recipes/voice-bot@latest.zip +0 -0
  273. package/recipes/wake-word/recipe.json +10 -9
  274. package/recipes/wake-word.zip +0 -0
  275. package/recipes/wake-word@latest.zip +0 -0
  276. package/recipes/charts/apps/native/src/app/(root)/(protected)/charts/index.tsx +0 -3
  277. package/recipes/chatbot/packages/backend/convex/lib/rateLimit.ts +0 -100
  278. package/recipes/chatbot/packages/backend/convex/lib/telemetry.ts +0 -29
  279. package/recipes/chatbot/packages/backend/convex/ragKnowledge.ts +0 -0
  280. package/recipes/image-analysis/apps/native/assets/features/image-analyzer/front.jpg +0 -0
  281. package/recipes/image-analysis/apps/native/assets/features/image-analyzer/side.jpg +0 -0
  282. package/recipes/image-analysis/apps/native/assets/features/image-analyzer/threeQuarter.jpg +0 -0
  283. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/_layout.tsx +0 -5
  284. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/analysis-options.tsx +0 -50
  285. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/camera.tsx +0 -2
  286. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/index.tsx +0 -50
  287. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/loading.tsx +0 -50
  288. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/results.tsx +0 -2
  289. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/trait-details.tsx +0 -3
  290. package/recipes/image-analysis/packages/backend/convex/imageAnalysisFunctions.ts +0 -325
  291. package/recipes/image-analysis/packages/backend/convex/lib/ai/imageAnalysisAdapter.ts +0 -200
  292. package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/index.tsx +0 -74
  293. package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/local.tsx +0 -25
  294. package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/remote.tsx +0 -23
  295. package/recipes/quiz/apps/native/src/app/(root)/(protected)/quiz/index.tsx +0 -47
  296. package/recipes/tracker-app/apps/native/src/app/(root)/(protected)/tracker-app/index.tsx +0 -1
  297. package/recipes/voice-bot/apps/native/src/app/(root)/(protected)/voice-bot/index.tsx +0 -27
  298. package/recipes/voice-bot/packages/backend/convex/router.ts +0 -81
  299. /package/recipes/{chatbot/apps/native/src/app/(root)/(protected) → chatbot-supabase/apps/native/src/app}/chatbot/index.tsx +0 -0
  300. /package/recipes/{image-generator/apps/native/src/app/(root)/(protected) → image-generator-supabase/apps/native/src/app}/image-generator/gallery.tsx +0 -0
  301. /package/recipes/{image-generator/apps/native/src/app/(root)/(protected) → image-generator-supabase/apps/native/src/app}/image-generator/index.tsx +0 -0
@@ -0,0 +1,458 @@
1
+ /**
2
+ * Chat Configuration Hook
3
+ *
4
+ * Manages chat state and streaming with Supabase backend.
5
+ */
6
+
7
+ import { useCallback, useEffect, useRef, useState } from 'react';
8
+
9
+ import { chatbotApi } from '@/api-client';
10
+ import type { AgentStatus, AppMessage } from '@/features/chatbot/types';
11
+ import {
12
+ type ChatTelemetryTracker,
13
+ createChatTelemetryTracker,
14
+ } from '@/features/chatbot/utils/chat-telemetry';
15
+
16
+ type AttachmentInput = {
17
+ type: 'image';
18
+ storageId: string;
19
+ fileName?: string;
20
+ mimeType?: string;
21
+ url?: string;
22
+ };
23
+
24
+ type SubmitOptions = {
25
+ body?: {
26
+ conversationId?: string;
27
+ userMessageId?: string;
28
+ preferredModel?: string;
29
+ attachments?: AttachmentInput[];
30
+ text?: string;
31
+ };
32
+ };
33
+
34
+ type UseChatConfigOptions = {
35
+ conversationId: string | null;
36
+ initialMessages?: AppMessage[];
37
+ preferredProvider?: string;
38
+ preferredModel?: string;
39
+ searchMode?: string;
40
+ onStreamFailure?: (details: {
41
+ userMessageId: string | null;
42
+ text: string;
43
+ attachments?: AttachmentInput[];
44
+ errorMessage?: string;
45
+ }) => void;
46
+ };
47
+
48
+ const STREAM_TIMEOUT_MS = 60000;
49
+ const STREAM_TIMEOUT_ERROR_MESSAGE =
50
+ 'Request timed out. Please check your connection and try again.';
51
+
52
+ export const useChatConfig = (options: UseChatConfigOptions) => {
53
+ const { conversationId } = options;
54
+
55
+ const chatStream = chatbotApi.useChatStream();
56
+
57
+ const [input, setInput] = useState('');
58
+ const [messages, setMessages] = useState<AppMessage[]>(
59
+ options.initialMessages ?? [],
60
+ );
61
+ const [isLoading, setIsLoading] = useState(false);
62
+ const [error, setError] = useState<Error | null>(null);
63
+ const [streamingMessageId, setStreamingMessageId] = useState<string | null>(
64
+ null,
65
+ );
66
+ const telemetryRef = useRef<ChatTelemetryTracker | null>(null);
67
+ const firstStreamChunkLoggedRef = useRef(false);
68
+ const streamTimingRef = useRef<{
69
+ requestStart?: number;
70
+ firstChunk?: number;
71
+ }>({});
72
+ const pendingSubmissionRef = useRef<{
73
+ userMessageId: string;
74
+ text: string;
75
+ attachments?: AttachmentInput[];
76
+ placeholderId?: string;
77
+ } | null>(null);
78
+ const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
79
+ const [optimisticStatus, setOptimisticStatus] = useState<AgentStatus | null>(
80
+ null,
81
+ );
82
+
83
+ const finalizeStreamFailure = useCallback(
84
+ (errorMessage?: string) => {
85
+ if (timeoutRef.current) {
86
+ clearTimeout(timeoutRef.current);
87
+ timeoutRef.current = null;
88
+ }
89
+
90
+ const pending = pendingSubmissionRef.current;
91
+ const placeholderId =
92
+ pending?.placeholderId ?? streamingMessageId ?? null;
93
+
94
+ console.log('[useChatConfig] finalizeStreamFailure called', {
95
+ errorMessage,
96
+ hasPending: !!pending,
97
+ placeholderId,
98
+ });
99
+
100
+ setMessages((prev) =>
101
+ prev.filter((message) => {
102
+ if (pending && message.id === pending.userMessageId) {
103
+ return false;
104
+ }
105
+ if (placeholderId && message.id === placeholderId) {
106
+ return false;
107
+ }
108
+ return true;
109
+ }),
110
+ );
111
+
112
+ setStreamingMessageId(null);
113
+ setIsLoading(false);
114
+ if (errorMessage) {
115
+ setError(new Error(errorMessage));
116
+ }
117
+ if (telemetryRef.current) {
118
+ telemetryRef.current.mark('stream.failure', {
119
+ reason: errorMessage ?? 'unknown',
120
+ });
121
+ telemetryRef.current.finalize('error', {
122
+ reason: 'streamFailed',
123
+ errorMessage: errorMessage ?? null,
124
+ });
125
+ telemetryRef.current = null;
126
+ }
127
+ firstStreamChunkLoggedRef.current = false;
128
+ streamTimingRef.current = {};
129
+ setOptimisticStatus(null);
130
+
131
+ const restoredText = pending?.text ?? '';
132
+ if (pending) {
133
+ setInput(restoredText);
134
+ }
135
+
136
+ options.onStreamFailure?.({
137
+ userMessageId: pending?.userMessageId ?? null,
138
+ text: restoredText,
139
+ attachments: pending?.attachments,
140
+ errorMessage,
141
+ });
142
+
143
+ pendingSubmissionRef.current = null;
144
+ },
145
+ [options, streamingMessageId],
146
+ );
147
+
148
+ // Reset state when conversation ID changes (not when messages update)
149
+ useEffect(() => {
150
+ setMessages(options.initialMessages ?? []);
151
+ setStreamingMessageId(null);
152
+ setIsLoading(false);
153
+ setError(null);
154
+ if (telemetryRef.current) {
155
+ telemetryRef.current.finalize('error', { reason: 'conversationChanged' });
156
+ telemetryRef.current = null;
157
+ }
158
+ if (timeoutRef.current) {
159
+ clearTimeout(timeoutRef.current);
160
+ timeoutRef.current = null;
161
+ }
162
+ firstStreamChunkLoggedRef.current = false;
163
+ streamTimingRef.current = {};
164
+ pendingSubmissionRef.current = null;
165
+ setOptimisticStatus(null);
166
+ // eslint-disable-next-line react-hooks/exhaustive-deps
167
+ }, [conversationId]); // Only reset on conversation change, not on initialMessages change
168
+
169
+ // Sync initial messages from server
170
+ useEffect(() => {
171
+ const incoming = options.initialMessages ?? [];
172
+ if (incoming.length === 0) {
173
+ return;
174
+ }
175
+
176
+ // Merge server messages without dropping local streaming placeholders
177
+ setMessages((prev) => {
178
+ const incomingById = new Map(incoming.map((msg) => [msg.id, msg]));
179
+ const existingIds = new Set(prev.map((msg) => msg.id));
180
+
181
+ const updatedPrev = prev.map((msg) => {
182
+ const next = incomingById.get(msg.id);
183
+ if (!next) return msg;
184
+
185
+ return {
186
+ ...msg,
187
+ ...next,
188
+ content: next.content ?? msg.content,
189
+ attachments: next.attachments ?? msg.attachments,
190
+ toolCalls: next.toolCalls ?? msg.toolCalls,
191
+ metadata: next.metadata ?? msg.metadata,
192
+ createdAt: next.createdAt ?? msg.createdAt,
193
+ };
194
+ });
195
+
196
+ const newMessages = incoming.filter((msg) => !existingIds.has(msg.id));
197
+ return [...updatedPrev, ...newMessages];
198
+ });
199
+ }, [options.initialMessages]);
200
+
201
+ const handleInputChange = useCallback((event: any) => {
202
+ if (typeof event === 'string') {
203
+ setInput(event);
204
+ return;
205
+ }
206
+
207
+ const value = event?.target?.value ?? '';
208
+ setInput(value);
209
+ }, []);
210
+
211
+ const handleSubmit = useCallback(
212
+ async (
213
+ event?: React.FormEvent<HTMLFormElement>,
214
+ submitOptions?: SubmitOptions,
215
+ ) => {
216
+ event?.preventDefault?.();
217
+
218
+ if (!conversationId) {
219
+ const err = new Error('Conversation is not initialised.');
220
+ setError(err);
221
+ return;
222
+ }
223
+
224
+ const body = submitOptions?.body;
225
+ const userMessageId = body?.userMessageId;
226
+ const preferredModelOverride =
227
+ body?.preferredModel ?? options.preferredModel ?? null;
228
+
229
+ if (!userMessageId) {
230
+ const err = new Error('Missing user message identifier.');
231
+ setError(err);
232
+ return;
233
+ }
234
+
235
+ const currentInput = body?.text ?? input;
236
+
237
+ // Setup telemetry
238
+ if (telemetryRef.current) {
239
+ telemetryRef.current.finalize('error', {
240
+ reason: 'supersededByNewSubmit',
241
+ });
242
+ }
243
+ const telemetryTracker = createChatTelemetryTracker('chat.handleSubmit', {
244
+ conversationId,
245
+ userMessageId,
246
+ preferredModel: preferredModelOverride,
247
+ });
248
+ telemetryRef.current = telemetryTracker;
249
+ firstStreamChunkLoggedRef.current = false;
250
+ telemetryTracker?.mark('optimistic.enqueue');
251
+
252
+ pendingSubmissionRef.current = {
253
+ userMessageId,
254
+ text: currentInput ?? '',
255
+ attachments: body?.attachments,
256
+ };
257
+
258
+ // Add optimistic user message
259
+ setMessages((prev) => {
260
+ if (prev.some((m) => m.id === userMessageId)) {
261
+ return prev;
262
+ }
263
+
264
+ return [
265
+ ...prev,
266
+ {
267
+ id: userMessageId,
268
+ role: 'user',
269
+ content: currentInput ?? '',
270
+ createdAt: new Date(),
271
+ },
272
+ ];
273
+ });
274
+ telemetryTracker?.mark('optimistic.userMessageAdded');
275
+
276
+ setInput('');
277
+ setIsLoading(true);
278
+ setError(null);
279
+ const requestStart = Date.now();
280
+ streamTimingRef.current = { requestStart };
281
+
282
+ // Create streaming placeholder
283
+ const tempStreamingId = `stream-${Date.now()}`;
284
+ setStreamingMessageId(tempStreamingId);
285
+ pendingSubmissionRef.current = {
286
+ ...pendingSubmissionRef.current!,
287
+ placeholderId: tempStreamingId,
288
+ };
289
+
290
+ setMessages((prev) => [
291
+ ...prev,
292
+ {
293
+ id: tempStreamingId,
294
+ role: 'assistant',
295
+ content: '',
296
+ createdAt: new Date(),
297
+ },
298
+ ]);
299
+
300
+ // Set optimistic status
301
+ setOptimisticStatus({
302
+ type: 'thinking',
303
+ label: 'Thinking…',
304
+ startedAt: Date.now(),
305
+ });
306
+
307
+ // Set timeout
308
+ timeoutRef.current = setTimeout(() => {
309
+ finalizeStreamFailure(STREAM_TIMEOUT_ERROR_MESSAGE);
310
+ }, STREAM_TIMEOUT_MS);
311
+
312
+ try {
313
+ console.log('[CHATBOT_FRONTEND] 🚀 Starting SSE stream', {
314
+ conversationId,
315
+ userMessageId,
316
+ preferredModel: preferredModelOverride,
317
+ });
318
+ telemetryTracker?.mark('stream.started');
319
+
320
+ await chatStream.startStream({
321
+ conversationId,
322
+ message: currentInput ?? '',
323
+ attachments: body?.attachments?.map((a) => ({
324
+ type: a.type,
325
+ url: a.url ?? a.storageId, // Prefer signed URL, fallback to storage ID
326
+ mimeType: a.mimeType,
327
+ name: a.fileName,
328
+ })),
329
+ preferredModel: preferredModelOverride ?? undefined,
330
+ onText: (text) => {
331
+ // Clear timeout on first chunk
332
+ if (timeoutRef.current) {
333
+ clearTimeout(timeoutRef.current);
334
+ timeoutRef.current = null;
335
+ }
336
+
337
+ if (!firstStreamChunkLoggedRef.current) {
338
+ const now = Date.now();
339
+ streamTimingRef.current.firstChunk = now;
340
+ telemetryTracker?.mark('stream.firstChunk', {
341
+ latencyMs: requestStart ? now - requestStart : undefined,
342
+ });
343
+ firstStreamChunkLoggedRef.current = true;
344
+ }
345
+
346
+ // Update streaming message with accumulated text (replace, don't append)
347
+ setMessages((prev) => {
348
+ const idx = prev.findIndex((m) => m.id === tempStreamingId);
349
+ if (idx === -1) {
350
+ console.log(
351
+ '[useChatConfig] Message not found for streaming:',
352
+ tempStreamingId,
353
+ );
354
+ return prev;
355
+ }
356
+
357
+ const existing = prev[idx];
358
+ const updated = [...prev];
359
+ updated[idx] = {
360
+ ...existing,
361
+ content: text, // Replace with full accumulated text
362
+ };
363
+ console.log(
364
+ '[useChatConfig] Updated message content length:',
365
+ text.length,
366
+ );
367
+ return updated;
368
+ });
369
+ },
370
+ onToolCall: (toolCall) => {
371
+ setOptimisticStatus({
372
+ type: 'tool',
373
+ toolName: toolCall.name,
374
+ label: `Using ${toolCall.name}...`,
375
+ startedAt: Date.now(),
376
+ });
377
+ },
378
+ onDone: async (messageId) => {
379
+ console.log('[CHATBOT_FRONTEND] ✅ Stream completed', {
380
+ messageId,
381
+ });
382
+
383
+ if (timeoutRef.current) {
384
+ clearTimeout(timeoutRef.current);
385
+ timeoutRef.current = null;
386
+ }
387
+
388
+ // Replace the temp streaming message with the real message ID
389
+ // Keep the content so it's visible until refetch arrives
390
+ setMessages((prev) => {
391
+ return prev.map((m) => {
392
+ if (m.id === tempStreamingId) {
393
+ return {
394
+ ...m,
395
+ id: messageId || m.id, // Use real ID from server
396
+ };
397
+ }
398
+ return m;
399
+ });
400
+ });
401
+
402
+ setStreamingMessageId(null);
403
+ setIsLoading(false);
404
+ setOptimisticStatus(null);
405
+ pendingSubmissionRef.current = null;
406
+
407
+ telemetryTracker?.mark('stream.completed', { messageId });
408
+ telemetryTracker?.finalize('ok', { messageId });
409
+ telemetryRef.current = null;
410
+ },
411
+ onError: (err) => {
412
+ console.error('[CHATBOT_FRONTEND] Stream error:', err);
413
+ finalizeStreamFailure(err.message);
414
+ },
415
+ });
416
+ } catch (err) {
417
+ console.error('[useChatConfig] Failed to start stream', err);
418
+ const message =
419
+ err instanceof Error
420
+ ? err.message
421
+ : typeof err === 'string'
422
+ ? err
423
+ : undefined;
424
+ finalizeStreamFailure(
425
+ message ?? 'Failed to start chat stream. Please try again.',
426
+ );
427
+ throw err;
428
+ }
429
+ },
430
+ [
431
+ conversationId,
432
+ input,
433
+ options.preferredModel,
434
+ chatStream,
435
+ finalizeStreamFailure,
436
+ ],
437
+ );
438
+
439
+ const resetMessages = useCallback(() => {
440
+ setMessages([]);
441
+ setStreamingMessageId(null);
442
+ setIsLoading(false);
443
+ setError(null);
444
+ setOptimisticStatus(null);
445
+ chatStream.stopStream();
446
+ }, [chatStream]);
447
+
448
+ return {
449
+ messages,
450
+ input,
451
+ isLoading: isLoading || chatStream.isStreaming,
452
+ error,
453
+ handleInputChange,
454
+ handleSubmit,
455
+ resetMessages,
456
+ currentStatus: optimisticStatus,
457
+ };
458
+ };