@terreno/mcp 57.21.0 → 58.0.0-beta.1

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 (244) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +57 -3
  3. package/dist/bootstrap.d.ts.map +1 -1
  4. package/dist/bootstrap.js +17 -16
  5. package/dist/bootstrap.js.map +1 -1
  6. package/dist/docs/guidelines/admin-frontend/guidelines/core.md +6 -5
  7. package/dist/docs/guidelines/ui/guidelines/core.md +1 -1
  8. package/dist/docs/prompts/debug.md +6 -4
  9. package/dist/docs/prompts/screen.md +11 -17
  10. package/dist/docs/resources/overview.md +5 -3
  11. package/dist/docs/resources/patterns.md +157 -238
  12. package/dist/docs/resources/syncdb.md +44 -16
  13. package/dist/docs/templates/bootstrap/CLAUDE.template.md +2 -2
  14. package/dist/docs/templates/bootstrap/cursorrules.template.md +7 -5
  15. package/dist/docs/templates/bootstrap/frontend/app/(tabs)/profile.template.tsx +8 -12
  16. package/dist/docs/templates/bootstrap/frontend/app/_layout.template.tsx +75 -52
  17. package/dist/docs/templates/bootstrap/frontend/app/login.template.tsx +46 -108
  18. package/dist/docs/templates/bootstrap/frontend/app/signup.template.tsx +53 -0
  19. package/dist/docs/templates/bootstrap/frontend/lib/betterAuth.template.md +18 -0
  20. package/dist/docs/templates/bootstrap/frontend/store/apiClient.template.md +33 -0
  21. package/dist/docs/templates/bootstrap/frontend/store/apiSdk.template.md +76 -0
  22. package/dist/docs/templates/bootstrap/frontend/store/syncdb.template.md +56 -0
  23. package/dist/docs/templates/bootstrap/frontend/utils/index.template.md +0 -4
  24. package/dist/docs/upgrades/58.0.0-beta.1.md +504 -0
  25. package/dist/docs/upgrades/58.0.0.md +495 -4
  26. package/dist/docs/versioned/next/README.md +2 -2
  27. package/dist/docs/versioned/next/approval-rubric.md +2 -2
  28. package/dist/docs/versioned/next/explanation/admin-interface.md +6 -5
  29. package/dist/docs/versioned/next/explanation/admin-plugin-frontend.md +1 -1
  30. package/dist/docs/versioned/next/explanation/ai-workflows.md +5 -3
  31. package/dist/docs/versioned/next/explanation/announcements/rtk-deprecation.md +16 -11
  32. package/dist/docs/versioned/next/explanation/authentication.md +62 -43
  33. package/dist/docs/versioned/next/explanation/dependency-management.md +1 -1
  34. package/dist/docs/versioned/next/explanation/deployment-baseline.md +1 -1
  35. package/dist/docs/versioned/next/explanation/example-coverage.md +2 -2
  36. package/dist/docs/versioned/next/explanation/explicit-any-policy.md +5 -6
  37. package/dist/docs/versioned/next/explanation/gcp-hosting-architecture.md +1 -1
  38. package/dist/docs/versioned/next/explanation/local-first-data.md +11 -9
  39. package/dist/docs/versioned/next/explanation/model-router-actions.md +1 -1
  40. package/dist/docs/versioned/next/explanation/modular-api-design.md +2 -2
  41. package/dist/docs/versioned/next/explanation/no-barrel-imports.md +5 -5
  42. package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +4 -3
  43. package/dist/docs/versioned/next/explanation/source-rules.md +2 -2
  44. package/dist/docs/versioned/next/explanation/typescript-configuration.md +2 -4
  45. package/dist/docs/versioned/next/explanation/versioning-policy.md +3 -3
  46. package/dist/docs/versioned/next/how-to/README.md +3 -2
  47. package/dist/docs/versioned/next/how-to/add-feature-flags.md +50 -25
  48. package/dist/docs/versioned/next/how-to/add-organizations.md +2 -1
  49. package/dist/docs/versioned/next/how-to/admin-custom-home.md +8 -2
  50. package/dist/docs/versioned/next/how-to/admin-custom-widget.md +0 -1
  51. package/dist/docs/versioned/next/how-to/agent-ui-asks.md +6 -6
  52. package/dist/docs/versioned/next/how-to/build-admin-screens.md +10 -8
  53. package/dist/docs/versioned/next/how-to/build-for-web.md +1 -1
  54. package/dist/docs/versioned/next/how-to/call-external-apis.md +2 -2
  55. package/dist/docs/versioned/next/how-to/circleci.md +12 -6
  56. package/dist/docs/versioned/next/how-to/configure-better-auth.md +114 -60
  57. package/dist/docs/versioned/next/how-to/connect-mcp-service-token.md +10 -4
  58. package/dist/docs/versioned/next/how-to/create-a-terreno-app.md +14 -2
  59. package/dist/docs/versioned/next/how-to/debug-with-mcp.md +8 -13
  60. package/dist/docs/versioned/next/how-to/expose-mcp-tools.md +15 -4
  61. package/dist/docs/versioned/next/how-to/generate-the-client-sdk.md +33 -0
  62. package/dist/docs/versioned/next/how-to/github-actions-ci.md +2 -2
  63. package/dist/docs/versioned/next/how-to/in-app-notifications.md +1 -1
  64. package/dist/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +318 -447
  65. package/dist/docs/versioned/next/how-to/password-reset.md +1 -1
  66. package/dist/docs/versioned/next/how-to/product-announcements.md +6 -3
  67. package/dist/docs/versioned/next/how-to/rate-limiting.md +38 -16
  68. package/dist/docs/versioned/next/how-to/run-mongodb-migrations.md +19 -0
  69. package/dist/docs/versioned/next/how-to/run-tests-locally.md +2 -3
  70. package/dist/docs/versioned/next/how-to/set-up-social-login.md +1 -1
  71. package/dist/docs/versioned/next/how-to/set-up-terreno-mcp.md +2 -2
  72. package/dist/docs/versioned/next/how-to/track-upstream-expo.md +1 -1
  73. package/dist/docs/versioned/next/how-to/upgrade-banner.md +5 -3
  74. package/dist/docs/versioned/next/how-to/upgrade-terreno.md +5 -5
  75. package/dist/docs/versioned/next/how-to/use-syncdb-correctly.md +1 -1
  76. package/dist/docs/versioned/next/how-to/websocket-integration.md +113 -402
  77. package/dist/docs/versioned/next/implementationPlans/b2b-platform-program.md +1 -1
  78. package/dist/docs/versioned/next/implementationPlans/migrate-admin-to-syncdb.md +5 -0
  79. package/dist/docs/versioned/next/implementationPlans/native-module-baseline.md +29 -5
  80. package/dist/docs/versioned/next/implementationPlans/remove-legacy-realtime.md +1 -1
  81. package/dist/docs/versioned/next/implementationPlans/remove-rtk.md +185 -0
  82. package/dist/docs/versioned/next/reference/README.md +1 -1
  83. package/dist/docs/versioned/next/reference/admin-frontend.md +85 -70
  84. package/dist/docs/versioned/next/reference/admin-spa.md +10 -4
  85. package/dist/docs/versioned/next/reference/ai.md +36 -4
  86. package/dist/docs/versioned/next/reference/announcements.md +3 -3
  87. package/dist/docs/versioned/next/reference/api.md +39 -24
  88. package/dist/docs/versioned/next/reference/cli.md +3 -4
  89. package/dist/docs/versioned/next/reference/environment-variables.md +16 -16
  90. package/dist/docs/versioned/next/reference/feature-flags.md +48 -7
  91. package/dist/docs/versioned/next/reference/jobs.md +2 -2
  92. package/dist/docs/versioned/next/reference/legacy/rtk.md +25 -600
  93. package/dist/docs/versioned/next/reference/mcp-server.md +441 -1158
  94. package/dist/docs/versioned/next/reference/syncdb.md +426 -16
  95. package/dist/docs/versioned/next/reference/test.md +28 -3
  96. package/dist/docs/versioned/next/reference/ui.md +132 -19
  97. package/dist/docs/versioned/next/tasks/native-module-baseline.md +8 -4
  98. package/dist/docs/versioned/next/tasks/rate-limiting.md +9 -2
  99. package/dist/docs/versioned/next/tasks/remove-legacy-realtime.md +5 -5
  100. package/dist/docs/versioned/next/tasks/remove-rtk.md +155 -0
  101. package/dist/local/localTools.d.ts.map +1 -1
  102. package/dist/local/localTools.js +3 -54
  103. package/dist/local/localTools.js.map +1 -1
  104. package/dist/local/tools/runtime.d.ts +0 -21
  105. package/dist/local/tools/runtime.d.ts.map +1 -1
  106. package/dist/local/tools/runtime.js +0 -176
  107. package/dist/local/tools/runtime.js.map +1 -1
  108. package/dist/local/tools/syncDb.d.ts +0 -11
  109. package/dist/local/tools/syncDb.d.ts.map +1 -1
  110. package/dist/local/tools/syncDb.js +1 -5
  111. package/dist/local/tools/syncDb.js.map +1 -1
  112. package/dist/packageGuidelines.d.ts +3 -2
  113. package/dist/packageGuidelines.d.ts.map +1 -1
  114. package/dist/packageGuidelines.js +4 -11
  115. package/dist/packageGuidelines.js.map +1 -1
  116. package/dist/prompts.d.ts.map +1 -1
  117. package/dist/prompts.js +17 -18
  118. package/dist/prompts.js.map +1 -1
  119. package/dist/resources.d.ts.map +1 -1
  120. package/dist/resources.js +1 -8
  121. package/dist/resources.js.map +1 -1
  122. package/dist/search/chunker.d.ts +1 -1
  123. package/dist/search/chunker.d.ts.map +1 -1
  124. package/dist/search/inferPackages.d.ts +1 -1
  125. package/dist/search/inferPackages.js +5 -5
  126. package/dist/search/inferPackages.js.map +1 -1
  127. package/dist/tools.d.ts +6 -0
  128. package/dist/tools.d.ts.map +1 -1
  129. package/dist/tools.js +126 -119
  130. package/dist/tools.js.map +1 -1
  131. package/package.json +6 -6
  132. package/src/docs/guidelines/admin-frontend/guidelines/core.md +6 -5
  133. package/src/docs/guidelines/ui/guidelines/core.md +1 -1
  134. package/src/docs/prompts/debug.md +6 -4
  135. package/src/docs/prompts/screen.md +11 -17
  136. package/src/docs/resources/overview.md +5 -3
  137. package/src/docs/resources/patterns.md +157 -238
  138. package/src/docs/resources/syncdb.md +44 -16
  139. package/src/docs/templates/bootstrap/CLAUDE.template.md +2 -2
  140. package/src/docs/templates/bootstrap/cursorrules.template.md +7 -5
  141. package/src/docs/templates/bootstrap/frontend/app/(tabs)/profile.template.tsx +8 -12
  142. package/src/docs/templates/bootstrap/frontend/app/_layout.template.tsx +75 -52
  143. package/src/docs/templates/bootstrap/frontend/app/login.template.tsx +46 -108
  144. package/src/docs/templates/bootstrap/frontend/app/signup.template.tsx +53 -0
  145. package/src/docs/templates/bootstrap/frontend/lib/betterAuth.template.md +18 -0
  146. package/src/docs/templates/bootstrap/frontend/store/apiClient.template.md +33 -0
  147. package/src/docs/templates/bootstrap/frontend/store/apiSdk.template.md +76 -0
  148. package/src/docs/templates/bootstrap/frontend/store/syncdb.template.md +56 -0
  149. package/src/docs/templates/bootstrap/frontend/utils/index.template.md +0 -4
  150. package/src/docs/upgrades/58.0.0-beta.1.md +504 -0
  151. package/src/docs/upgrades/58.0.0.md +495 -4
  152. package/src/docs/versioned/next/README.md +2 -2
  153. package/src/docs/versioned/next/approval-rubric.md +2 -2
  154. package/src/docs/versioned/next/explanation/admin-interface.md +6 -5
  155. package/src/docs/versioned/next/explanation/admin-plugin-frontend.md +1 -1
  156. package/src/docs/versioned/next/explanation/ai-workflows.md +5 -3
  157. package/src/docs/versioned/next/explanation/announcements/rtk-deprecation.md +16 -11
  158. package/src/docs/versioned/next/explanation/authentication.md +62 -43
  159. package/src/docs/versioned/next/explanation/dependency-management.md +1 -1
  160. package/src/docs/versioned/next/explanation/deployment-baseline.md +1 -1
  161. package/src/docs/versioned/next/explanation/example-coverage.md +2 -2
  162. package/src/docs/versioned/next/explanation/explicit-any-policy.md +5 -6
  163. package/src/docs/versioned/next/explanation/gcp-hosting-architecture.md +1 -1
  164. package/src/docs/versioned/next/explanation/local-first-data.md +11 -9
  165. package/src/docs/versioned/next/explanation/model-router-actions.md +1 -1
  166. package/src/docs/versioned/next/explanation/modular-api-design.md +2 -2
  167. package/src/docs/versioned/next/explanation/no-barrel-imports.md +5 -5
  168. package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +4 -3
  169. package/src/docs/versioned/next/explanation/source-rules.md +2 -2
  170. package/src/docs/versioned/next/explanation/typescript-configuration.md +2 -4
  171. package/src/docs/versioned/next/explanation/versioning-policy.md +3 -3
  172. package/src/docs/versioned/next/how-to/README.md +3 -2
  173. package/src/docs/versioned/next/how-to/add-feature-flags.md +50 -25
  174. package/src/docs/versioned/next/how-to/add-organizations.md +2 -1
  175. package/src/docs/versioned/next/how-to/admin-custom-home.md +8 -2
  176. package/src/docs/versioned/next/how-to/admin-custom-widget.md +0 -1
  177. package/src/docs/versioned/next/how-to/agent-ui-asks.md +6 -6
  178. package/src/docs/versioned/next/how-to/build-admin-screens.md +10 -8
  179. package/src/docs/versioned/next/how-to/build-for-web.md +1 -1
  180. package/src/docs/versioned/next/how-to/call-external-apis.md +2 -2
  181. package/src/docs/versioned/next/how-to/circleci.md +12 -6
  182. package/src/docs/versioned/next/how-to/configure-better-auth.md +114 -60
  183. package/src/docs/versioned/next/how-to/connect-mcp-service-token.md +10 -4
  184. package/src/docs/versioned/next/how-to/create-a-terreno-app.md +14 -2
  185. package/src/docs/versioned/next/how-to/debug-with-mcp.md +8 -13
  186. package/src/docs/versioned/next/how-to/expose-mcp-tools.md +15 -4
  187. package/src/docs/versioned/next/how-to/generate-the-client-sdk.md +33 -0
  188. package/src/docs/versioned/next/how-to/github-actions-ci.md +2 -2
  189. package/src/docs/versioned/next/how-to/in-app-notifications.md +1 -1
  190. package/src/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +318 -447
  191. package/src/docs/versioned/next/how-to/password-reset.md +1 -1
  192. package/src/docs/versioned/next/how-to/product-announcements.md +6 -3
  193. package/src/docs/versioned/next/how-to/rate-limiting.md +38 -16
  194. package/src/docs/versioned/next/how-to/run-mongodb-migrations.md +19 -0
  195. package/src/docs/versioned/next/how-to/run-tests-locally.md +2 -3
  196. package/src/docs/versioned/next/how-to/set-up-social-login.md +1 -1
  197. package/src/docs/versioned/next/how-to/set-up-terreno-mcp.md +2 -2
  198. package/src/docs/versioned/next/how-to/track-upstream-expo.md +1 -1
  199. package/src/docs/versioned/next/how-to/upgrade-banner.md +5 -3
  200. package/src/docs/versioned/next/how-to/upgrade-terreno.md +5 -5
  201. package/src/docs/versioned/next/how-to/use-syncdb-correctly.md +1 -1
  202. package/src/docs/versioned/next/how-to/websocket-integration.md +113 -402
  203. package/src/docs/versioned/next/implementationPlans/b2b-platform-program.md +1 -1
  204. package/src/docs/versioned/next/implementationPlans/migrate-admin-to-syncdb.md +5 -0
  205. package/src/docs/versioned/next/implementationPlans/native-module-baseline.md +29 -5
  206. package/src/docs/versioned/next/implementationPlans/remove-legacy-realtime.md +1 -1
  207. package/src/docs/versioned/next/implementationPlans/remove-rtk.md +185 -0
  208. package/src/docs/versioned/next/reference/README.md +1 -1
  209. package/src/docs/versioned/next/reference/admin-frontend.md +85 -70
  210. package/src/docs/versioned/next/reference/admin-spa.md +10 -4
  211. package/src/docs/versioned/next/reference/ai.md +36 -4
  212. package/src/docs/versioned/next/reference/announcements.md +3 -3
  213. package/src/docs/versioned/next/reference/api.md +39 -24
  214. package/src/docs/versioned/next/reference/cli.md +3 -4
  215. package/src/docs/versioned/next/reference/environment-variables.md +16 -16
  216. package/src/docs/versioned/next/reference/feature-flags.md +48 -7
  217. package/src/docs/versioned/next/reference/jobs.md +2 -2
  218. package/src/docs/versioned/next/reference/legacy/rtk.md +25 -600
  219. package/src/docs/versioned/next/reference/mcp-server.md +441 -1158
  220. package/src/docs/versioned/next/reference/syncdb.md +426 -16
  221. package/src/docs/versioned/next/reference/test.md +28 -3
  222. package/src/docs/versioned/next/reference/ui.md +132 -19
  223. package/src/docs/versioned/next/tasks/native-module-baseline.md +8 -4
  224. package/src/docs/versioned/next/tasks/rate-limiting.md +9 -2
  225. package/src/docs/versioned/next/tasks/remove-legacy-realtime.md +5 -5
  226. package/src/docs/versioned/next/tasks/remove-rtk.md +155 -0
  227. package/dist/docs/guidelines/rtk/guidelines/core.md +0 -26
  228. package/dist/docs/resources/rtk.md +0 -181
  229. package/dist/docs/templates/bootstrap/frontend/openapi-config.template.md +0 -16
  230. package/dist/docs/templates/bootstrap/frontend/scripts/generate-sdk.template.md +0 -49
  231. package/dist/docs/templates/bootstrap/frontend/store/appState.template.md +0 -45
  232. package/dist/docs/templates/bootstrap/frontend/store/errors.template.md +0 -51
  233. package/dist/docs/templates/bootstrap/frontend/store/index.template.md +0 -86
  234. package/dist/docs/templates/bootstrap/frontend/store/openApiSdk.template.md +0 -49
  235. package/dist/docs/templates/bootstrap/frontend/store/sdk.template.md +0 -80
  236. package/src/docs/guidelines/rtk/guidelines/core.md +0 -26
  237. package/src/docs/resources/rtk.md +0 -181
  238. package/src/docs/templates/bootstrap/frontend/openapi-config.template.md +0 -16
  239. package/src/docs/templates/bootstrap/frontend/scripts/generate-sdk.template.md +0 -49
  240. package/src/docs/templates/bootstrap/frontend/store/appState.template.md +0 -45
  241. package/src/docs/templates/bootstrap/frontend/store/errors.template.md +0 -51
  242. package/src/docs/templates/bootstrap/frontend/store/index.template.md +0 -86
  243. package/src/docs/templates/bootstrap/frontend/store/openApiSdk.template.md +0 -49
  244. package/src/docs/templates/bootstrap/frontend/store/sdk.template.md +0 -80
@@ -69,7 +69,7 @@ On `BetterAuthConfig` set the same `publicAppUrl`, `sendMail`, and `renderAuthMa
69
69
 
70
70
  1. Pass `onForgotPassword` (or `onForgotPasswordPress`) to `LoginScreen`.
71
71
  2. Add `/forgotPassword` (email form) and `/resetPassword` that reads `token` from the query string.
72
- 3. On Better Auth apps, request reset with `authClient.requestPasswordReset` and submit with `authClient.resetPassword({newPassword, token})`. JWT apps use `POST /auth/forgotPassword` and the RTK `resetPassword` mutation (`POST /resetPassword`). The example app falls back to the JWT request or reset route when Better Auth rejects the operation, so either auth mode can complete.
72
+ 3. On Better Auth apps, request reset with `authClient.requestPasswordReset` and submit with `authClient.resetPassword({newPassword, token})`. JWT apps call `POST /auth/forgotPassword` and `POST /resetPassword` through the generated `usePostAuthForgotPasswordMutation` / `usePostResetPasswordMutation` hooks (`store/apiSdk.ts`), or `useJwtAuth().resetPassword` from `@terreno/syncdb/auth`. The example app falls back to the JWT request or reset route when Better Auth rejects the operation, so either auth mode can complete.
73
73
  4. Show a profile banner when `emailVerified` is false, with Resend calling `POST /auth/sendVerification`.
74
74
  5. Add `/verifyEmail` that reads `token` from the query string. JWT apps call `POST /auth/verifyEmail`. Better Auth apps try `GET /verify-email?token=...` first, then the JWT route so either token type can complete.
75
75
 
@@ -64,7 +64,7 @@ For release-driven batches, use an [announcement release pack](../reference/anno
64
64
 
65
65
  ### Admin overview
66
66
 
67
- `AnnouncementOverview` calls `GET /announcements/overview` (via RTK `injectEndpoints`) and shows:
67
+ `AnnouncementOverview` calls `GET /announcements/overview` (through the `AdminProvider` fetch client) and shows:
68
68
 
69
69
  - Launch workflow guidance (draft → targeting → preview → publish) with a primary **Create announcement** action
70
70
  - Summary cards for published, drafts, impressions, acknowledgements, and CTA clicks
@@ -87,12 +87,15 @@ Wrap authenticated app content:
87
87
 
88
88
  ```tsx
89
89
  import {AnnouncementNavigator} from "@terreno/ui";
90
+ import {apiClient} from "@/store/apiClient"; // @terreno/syncdb/api createApiClient(...)
90
91
 
91
- <AnnouncementNavigator api={terrenoApi}>
92
+ <AnnouncementNavigator client={apiClient}>
92
93
  <AppTabs />
93
94
  </AnnouncementNavigator>
94
95
  ```
95
96
 
97
+ `client` is the app's request client (see [`TerrenoRequestClient`](../reference/ui.md#terrenorequestclient)); the RTK `api` prop was removed in Terreno 58.
98
+
96
99
  Place it after consent/onboarding wrappers if you use `ConsentNavigator`. The navigator sends the native platform (`ios` / `android` / `web`) and, when available, the app build number from `Constants.expoConfig.extra.buildNumber` (same source as `useUpgradeCheck`) on pending and feed requests. Only pending failures block the app — changelog feed errors are non-fatal. These surfaces are not in the `@terreno/ui` component demo; wire them in the app (`example-frontend`) the same way.
97
100
 
98
101
  ## Modal vs banner
@@ -120,7 +123,7 @@ Interrupt frequency is enforced **client-side** in `AnnouncementNavigator` befor
120
123
 
121
124
  ```tsx
122
125
  <AnnouncementNavigator
123
- api={terrenoApi}
126
+ client={apiClient}
124
127
  frequency={{
125
128
  cooldownHours: 24,
126
129
  skipFirstLaunch: false,
@@ -1,37 +1,62 @@
1
1
  # Rate limiting
2
2
 
3
- Turn on HTTP rate limiting for `@terreno/api` by passing `rateLimit` on `TerrenoApp`. The framework does **not** read `RATE_LIMIT_ENABLED`.
3
+ `TerrenoApp` turns on HTTP rate limiting by default (Terreno 58 and later). Omitting `rateLimit` mounts the limiter with the memory store and the default limits. The framework does **not** read `RATE_LIMIT_ENABLED`.
4
4
 
5
- Terreno 58 will default the limiter **on**. Until then, omit `rateLimit` to leave it off.
5
+ ## Default (memory)
6
6
 
7
- ## Terreno 58 (not this release)
7
+ ```typescript
8
+ new TerrenoApp({userModel: User});
9
+ ```
10
+
11
+ That is the same as `rateLimit: {}` or `rateLimit: {store: "memory"}`: auth 20 / 15 min, api 600 / 15 min, one bucket per Node process.
12
+
13
+ ## Cloud Run
14
+
15
+ Cloud Run sits behind one Google Front End hop. Without `trustProxy`, every unauthenticated request shares the front end's address, so all users share one auth bucket (20 logins per 15 minutes for the whole service). Pass `trustProxy: 1`:
16
+
17
+ ```typescript
18
+ new TerrenoApp({
19
+ userModel: User,
20
+ rateLimit: {trustProxy: 1},
21
+ });
22
+ ```
23
+
24
+ The limiter sets Express `trust proxy` from `rateLimit.trustProxy` when it mounts. Set it there, not with `app.set("trust proxy", …)` before `build()`.
8
25
 
9
- When Terreno 58 is cut, `TerrenoApp` will enable the limiter by default. Apps that must stay unlimited will pass an explicit off (documented in the 58 upgrade note). Until then, omitted `rateLimit` is unlimited. Stub: [`mcp-server/src/docs/upgrades/58.0.0.md`](../../mcp-server/src/docs/upgrades/58.0.0.md).
26
+ ## Turn it off
10
27
 
11
- ## Enable (memory)
28
+ Pass `false`:
12
29
 
13
30
  ```typescript
14
31
  new TerrenoApp({
15
32
  userModel: User,
16
- rateLimit: process.env.RATE_LIMIT_ENABLED === "true" ? {store: "memory"} : undefined,
33
+ rateLimit: false,
17
34
  });
18
35
  ```
19
36
 
20
- Empty `{}` is the same as `{store: "memory"}`.
37
+ Apps that want an env toggle own it:
38
+
39
+ ```typescript
40
+ new TerrenoApp({
41
+ userModel: User,
42
+ rateLimit: process.env.RATE_LIMIT_DISABLED === "true" ? false : {trustProxy: 1},
43
+ });
44
+ ```
45
+
46
+ ## Tests
47
+
48
+ Each `build()` creates a fresh memory store, so most suites never reach a limit. A suite that logs in more than 20 times or sends more than 600 requests against one app instance should pass `rateLimit: false` in its shared app helper, or raise `limits`.
21
49
 
22
50
  ## Redis on Cloud Run
23
51
 
24
52
  1. Add a Valkey or Redis instance (Memorystore or equivalent).
25
53
  2. Set `VALKEY_URL` (preferred) or `REDIS_URL` on the Cloud Run service. Same URL as realtime Redis.
26
- 3. Pass `store: "redis"` only when you intend to enable the limiter:
54
+ 3. Pass `store: "redis"`:
27
55
 
28
56
  ```typescript
29
57
  new TerrenoApp({
30
58
  userModel: User,
31
- rateLimit:
32
- process.env.RATE_LIMIT_ENABLED === "true"
33
- ? {store: "redis", trustProxy: 1}
34
- : undefined,
59
+ rateLimit: {store: "redis", trustProxy: 1},
35
60
  });
36
61
  ```
37
62
 
@@ -50,7 +75,7 @@ new TerrenoApp({
50
75
 
51
76
  Pass `{store: "mongo"}`. Hits live in `rateLimitHits` on the same mongoose connection as the app. A TTL index on `expiresAt` expires windows. This collection is not a `modelRouter` resource.
52
77
 
53
- Unauthenticated keys use `req.ip`. Express `trust proxy` defaults to **off** so a client cannot rotate `X-Forwarded-For` to bypass the auth bucket. On Cloud Run (one hop via GFE), pass `trustProxy: 1`. Extra proxies: hop count or a subnet list. `trustProxy: false` is the same as the default.
78
+ Unauthenticated keys use `req.ip`. Express `trust proxy` defaults to **off** so a client cannot rotate `X-Forwarded-For` to bypass the auth bucket. On Cloud Run (one hop via GFE), pass `trustProxy: 1` (see [Cloud Run](#cloud-run)). Extra proxies: hop count or a subnet list. `trustProxy: false` is the same as the default.
54
79
 
55
80
  ## Limit one route
56
81
 
@@ -90,6 +115,3 @@ JWT login/signup/refresh and password-reset paths skip access-token verification
90
115
  Auth-bucket keys are always the client IP, even if a Better Auth session already set `req.user`. API traffic still keys by user when authenticated.
91
116
 
92
117
  When `BetterAuthApp` is registered, TerrenoApp copies its `config.basePath` into the limiter unless you set `rateLimit.betterAuthBasePath`.
93
-
94
-
95
-
@@ -30,6 +30,25 @@ export const down = async ({dryRun, mongoose}): Promise<void> => {
30
30
  };
31
31
  ```
32
32
 
33
+ ## Framework migrations
34
+
35
+ Some Terreno releases ship a data migration in a package. Wire it in with a one-line wrapper file, so it runs, dry-runs, and records history like your own files:
36
+
37
+ ```typescript
38
+ // migrations/20261022120000-mcp-service-token-string-ids.ts
39
+ import {mcpServiceTokenStringIdsMigration} from "@terreno/api";
40
+
41
+ export const id = "20261022120000-mcp-service-token-string-ids";
42
+ export const up = mcpServiceTokenStringIdsMigration.up;
43
+ ```
44
+
45
+ | Package | Export | Since | What it does |
46
+ | --- | --- | --- | --- |
47
+ | `@terreno/api` | `mcpServiceTokenStringIdsMigration` | 58.0.0 | Re-keys ObjectId `McpServiceToken` rows to hex-string `_id`s. Idempotent; no `down`. |
48
+ | `@terreno/ai` | `gptHistoryStringIdsMigration` | 58.0.0 | Re-keys ObjectId `GptHistory` rows to hex-string `_id`s and rewrites `AIDataset.historyId`. Idempotent; no `down`. |
49
+
50
+ The upgrade note for each release says which framework migrations to add.
51
+
33
52
  ## First apply
34
53
 
35
54
  1. Generate a draft from the current models vs the last `schemaAfter` snapshot:
@@ -21,7 +21,7 @@ with `origin/master`. It applies the CircleCI path-filter mapping in
21
21
  `.circleci/config.yml`, then runs the local command for each triggered job: package
22
22
  `test:coverage` plus the 90% new-file LCOV gate, `ui` types, demo typecheck,
23
23
  example-backend and example-frontend tests, every `repo-policies` step, rulesync drift,
24
- and the typedoc API reference when `api/src` or `rtk/src` changes. Every step runs even
24
+ and the typedoc API reference when `api/src` changes. Every step runs even
25
25
  after a failure, so a single pass lists every problem. Fix them all, then push once.
26
26
 
27
27
  Jobs that need infrastructure (Playwright e2e, Maestro, admin-spa integration, Docker)
@@ -64,7 +64,6 @@ bun test --only-failures <path>
64
64
  | `ai-ci` | `cd ai && bun run test:ci` |
65
65
  | `blocks-ci` | `bun run blocks:test` |
66
66
  | `ui-ci` | `bun run ui:test` |
67
- | `rtk-ci` | `bun run rtk:test` |
68
67
  | `syncdb-ci` | `bun run syncdb:test` |
69
68
  | `comms-ci` | `bun run comms:test` |
70
69
  | `jobs-ci` / jobs package | `bun run jobs:test` |
@@ -124,7 +123,7 @@ MONGO_URI="mongodb://127.0.0.1:27017/terreno-e2e?replicaSet=rs0" \
124
123
  | CircleCI shard | Specs |
125
124
  | --- | --- |
126
125
  | `e2e` `auth` | `login` `signup` `consents` `forgot-password` `reset-password` `verify-email` `two-factor` |
127
- | `e2e` `app` | `todos` `profile` `realtime` `ai-chat` `pdf` |
126
+ | `e2e` `app` | `todos` `todo-windows` `todo-browser` `profile` `realtime` `ai-chat` `pdf` `notifications` `socket-flags` `mcp-tokens` |
128
127
  | `e2e` `admin-core` | `admin` `admin-home` `admin-form` `admin-todo-crud` `admin-title-update-depth` `org-admin-security` `admin-user-security` |
129
128
  | `e2e-cross-site` (not required) | the cross-site specs below, then `account-linking` with `E2E_ACCOUNT_LINKING=explicit` |
130
129
  | `e2e` `admin-table` | `admin-table-search-filter` `admin-table-bulk-actions` `admin-custom-screens` `admin-comms-back` `harness-approvals` `harness-intake` |
@@ -317,7 +317,7 @@ Expo plugin. The provider still returns to the backend's own
317
317
  `@better-auth/expo`, which serves `GET {basePath}/expo-authorization-proxy`. The app opens
318
318
  that URL in the browser; it sets the OAuth state cookie there and redirects to the provider.
319
319
  2. **Give the app a scheme.** Set `expo.scheme` in `app.json` (`frontend` in the example) and
320
- pass the same value to `createBetterAuthClient({scheme})` from `@terreno/rtk`.
320
+ pass the same value to `createBetterAuthClient({scheme})` from `@terreno/syncdb/auth`.
321
321
  3. **List the scheme in `trustedOrigins`**, as `frontend://`. After the callback, the backend
322
322
  redirects the browser to the app's `callbackURL` (`frontend://.../login`), with the session in
323
323
  a `cookie` query parameter. Better Auth refuses a callback URL that matches no trusted origin.
@@ -1,7 +1,7 @@
1
1
  # Set up Terreno MCP
2
2
 
3
- Connect your editor to both Terreno MCP servers:
4
-
3
+ Configure both Terreno servers: the hosted server supplies documentation and generators; the local
4
+ stdio server inspects the app, database, logs, Metro, and SyncDB state.
5
5
  - **`terreno`** (hosted, Streamable HTTP) supplies documentation search and code generators.
6
6
  - **`terreno-local`** (stdio, runs in your repository) reads the app's packages, database, logs,
7
7
  Metro, and client state.
@@ -33,7 +33,7 @@ State files (in the repo, not linked from this page):
33
33
 
34
34
  ## 2. Branch name
35
35
 
36
- Expo `58.0.0-preview.1` → `release-58.0.0`. Create from `origin/master` the
36
+ Expo `58.0.0-preview.2` → `release-58.0.0`. Create from `origin/master` the
37
37
  first day. Later days check it out, merge `master`, and either bump to a
38
38
  newer preview or resume **Open** items from the log.
39
39
 
@@ -25,10 +25,10 @@ This adds the public `GET /version-check` endpoint. The admin routes (`GET/PUT /
25
25
 
26
26
  ### 2. Frontend: Add build number injection
27
27
 
28
- Create or update `app.config.ts` in your Expo app root. Use the `resolveBuildNumber` helper from `@terreno/rtk/buildNumber`:
28
+ Create or update `app.config.ts` in your Expo app root. Use the `resolveBuildNumber` helper from `@terreno/syncdb/buildNumber` (node-only, so import it only from `app.config.ts`):
29
29
 
30
30
  ```typescript
31
- import {resolveBuildNumber} from "@terreno/rtk/buildNumber";
31
+ import {resolveBuildNumber} from "@terreno/syncdb/buildNumber";
32
32
  import type {ConfigContext, ExpoConfig} from "expo/config";
33
33
 
34
34
  export default ({config}: ConfigContext): ExpoConfig => ({
@@ -54,10 +54,12 @@ This sets `Constants.expoConfig.extra.buildNumber` when Metro loads the config.
54
54
 
55
55
  ### 3. Frontend: Wire up the hook
56
56
 
57
+ `useUpgradeCheck` calls `/version-check` through the `@terreno/syncdb/api` request client,
58
+ so render it inside `<ApiClientProvider client={apiClient}>` (or pass `{client: apiClient}`).
57
59
  In your root layout:
58
60
 
59
61
  ```typescript
60
- import {useUpgradeCheck} from "@terreno/rtk";
62
+ import {useUpgradeCheck} from "@terreno/syncdb/app";
61
63
  import {UpgradeRequiredScreen} from "@terreno/ui";
62
64
 
63
65
  function RootLayoutNav() {
@@ -31,8 +31,8 @@ Or browse [`mcp-server/src/docs/upgrades/`](../../mcp-server/src/docs/upgrades/)
31
31
  | Clean git tree, work on a branch | Rollback is `git checkout -- .` / `git reset --hard` on that branch. |
32
32
  | Backend `@terreno/*` first | `/openapi.json` is the contract the frontend typed client is generated from. Regenerating against an old backend omits new routes; screens fail at compile. |
33
33
  | Backend compile + tests | Catch API breaks before touching Expo or UI. |
34
- | Expo SDK (if the Terreno major tracks a new Expo) | `@terreno/ui` pins `react-native` (for example `~0.86.0` on the 57 line in `ui/package.json` `peerDependencies`). Installing Terreno frontend packages before Expo leaves unmet peers. |
35
- | Frontend `@terreno/*` | UI, syncdb, admin-frontend, admin-spa, rtk. |
34
+ | Expo SDK (if the Terreno major tracks a new Expo) | `@terreno/ui` pins `react-native` (for example `0.88.0-rc.1` on the 58 line in `ui/package.json` `peerDependencies`). Installing Terreno frontend packages before Expo leaves unmet peers. |
35
+ | Frontend `@terreno/*` | UI, syncdb, admin-frontend, admin-spa. |
36
36
  | Regenerate typed client | Only after the **upgraded** backend is running. |
37
37
  | Compile, lint, tests | Whole app. |
38
38
  | Run the app | UI verification. |
@@ -42,11 +42,11 @@ Maintainers watching the next SDK beta use `track-upstream-expo` / [`track-upstr
42
42
 
43
43
  ### Backend vs frontend packages
44
44
 
45
- From `publish-on-tag.yml`: **backend** `api`, `test`, `admin-backend`, `blocks`, `ai`, `api-health`, `comms`, `feature-flags`, `mcp`. **frontend** `ui`, `rtk`, `syncdb`, `admin-frontend`, `admin-spa`. `blocks` holds contracts that both `ai` and `ui` depend on, so it moves with the backend step.
45
+ From `publish-on-tag.yml`: **backend** `api`, `test`, `admin-backend`, `blocks`, `ai`, `api-health`, `comms`, `feature-flags`, `mcp`. **frontend** `ui`, `syncdb`, `admin-frontend`, `admin-spa`. `blocks` holds contracts that both `ai` and `ui` depend on, so it moves with the backend step.
46
46
 
47
- ## 4. RTK → syncdb is not a version bump
47
+ ## 4. Crossing 58 removes `@terreno/rtk`
48
48
 
49
- If the range includes the syncdb release (`56.0.0-beta.2` and later), treat collection CRUD as a **platform migration**. Follow [migrate-rtk-to-syncdb.md](migrate-rtk-to-syncdb.md) in a separate change from the routine lockstep bump. Keep `@terreno/rtk` for the OpenAPI SDK, Better Auth, feature flags, and sockets until that migration is done.
49
+ If the range crosses `58.0.0`, the app must drop `@terreno/rtk` and Redux: there is no 58 release of `@terreno/rtk`. Follow [How to upgrade from @terreno/rtk to @terreno/syncdb (Terreno 58)](migrate-rtk-to-syncdb.md) as part of the upgrade. Run the 58 data migrations before deploying 58 frontends.
50
50
 
51
51
  ## 5. Manual steps
52
52
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  This page lists `@terreno/syncdb` behavior that a working app has to account for. Each entry says what the library does today, what breaks if you ignore it, and what to do instead. It was checked against `syncdb/src` and `api/src/sync` at 57.13.0. Several entries are library gaps rather than intended behavior. Delete an entry when its gap is fixed.
4
4
 
5
- Read [Local-first data](../explanation/local-first-data.md) and [Migrate from @terreno/rtk to @terreno/syncdb](migrate-rtk-to-syncdb.md) first.
5
+ Read [Local-first data](../explanation/local-first-data.md) and [How to upgrade from @terreno/rtk to @terreno/syncdb](migrate-rtk-to-syncdb.md) first.
6
6
 
7
7
  ## Startup and snapshots
8
8