@terreno/mcp 57.0.0-beta.1 → 57.1.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 (222) hide show
  1. package/dist/bootstrap.d.ts +1 -1
  2. package/dist/bootstrap.d.ts.map +1 -1
  3. package/dist/bootstrap.js +381 -191
  4. package/dist/bootstrap.js.map +1 -1
  5. package/dist/docs/guidelines/api/skills/mongoose-schema-safety/SKILL.md +8 -0
  6. package/dist/docs/resources/overview.md +6 -1
  7. package/dist/docs/resources/rtk.md +3 -1
  8. package/dist/docs/resources/syncdb.md +43 -0
  9. package/dist/docs/upgrades/56.0.0-beta.2.md +34 -0
  10. package/dist/docs/upgrades/57.0.0.md +49 -0
  11. package/dist/docs/upgrades/57.1.0.md +126 -0
  12. package/dist/docs/versioned/next/README.md +15 -3
  13. package/dist/docs/versioned/next/explanation/README.md +3 -0
  14. package/dist/docs/versioned/next/explanation/admin-consent-migration.md +15 -0
  15. package/dist/docs/versioned/next/explanation/admin-plugin-frontend.md +12 -0
  16. package/dist/docs/versioned/next/explanation/announcements/rtk-deprecation.md +29 -0
  17. package/dist/docs/versioned/next/explanation/authentication.md +51 -58
  18. package/dist/docs/versioned/next/explanation/local-first-data.md +52 -0
  19. package/dist/docs/versioned/next/explanation/loop-engineering.md +117 -0
  20. package/dist/docs/versioned/next/explanation/repository-settings.md +8 -0
  21. package/dist/docs/versioned/next/explanation/roadmap-process.md +22 -9
  22. package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +39 -0
  23. package/dist/docs/versioned/next/how-to/README.md +3 -0
  24. package/dist/docs/versioned/next/how-to/admin-add-model.md +41 -0
  25. package/dist/docs/versioned/next/how-to/admin-custom-home.md +31 -0
  26. package/dist/docs/versioned/next/how-to/admin-custom-widget.md +42 -0
  27. package/dist/docs/versioned/next/how-to/admin-import-prebuilt.md +25 -0
  28. package/dist/docs/versioned/next/how-to/circleci.md +173 -0
  29. package/dist/docs/versioned/next/how-to/configure-better-auth.md +13 -10
  30. package/dist/docs/versioned/next/how-to/expose-mcp-tools.md +194 -0
  31. package/dist/docs/versioned/next/how-to/install-agent-skills.md +46 -0
  32. package/dist/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +26 -1
  33. package/dist/docs/versioned/next/how-to/websocket-integration.md +2 -1
  34. package/dist/docs/versioned/next/implementationPlans/ModularAPI.md +1 -0
  35. package/dist/docs/versioned/next/implementationPlans/README.md +31 -17
  36. package/dist/docs/versioned/next/implementationPlans/admin-improvements-research.md +136 -0
  37. package/dist/docs/versioned/next/implementationPlans/admin-improvements.md +157 -527
  38. package/dist/docs/versioned/next/implementationPlans/admin-only-research.md +4 -0
  39. package/dist/docs/versioned/next/implementationPlans/admin-only.md +3 -1
  40. package/dist/docs/versioned/next/implementationPlans/admin-script-runner.md +1 -0
  41. package/dist/docs/versioned/next/implementationPlans/admin-ui-v2-django-parity.md +1 -0
  42. package/dist/docs/versioned/next/implementationPlans/agentic-sdlc-plugin.md +160 -130
  43. package/dist/docs/versioned/next/implementationPlans/apierror-standard-error-redesign.md +1 -0
  44. package/dist/docs/versioned/next/implementationPlans/b2b-platform-program.md +5 -4
  45. package/dist/docs/versioned/next/implementationPlans/comms-abstraction-research.md +48 -0
  46. package/dist/docs/versioned/next/implementationPlans/comms-abstraction.md +152 -62
  47. package/dist/docs/versioned/next/implementationPlans/comms-adapter-sendgrid.md +9 -9
  48. package/dist/docs/versioned/next/implementationPlans/comms-admin-dashboard.md +1 -1
  49. package/dist/docs/versioned/next/implementationPlans/consent-forms.md +4 -0
  50. package/dist/docs/versioned/next/implementationPlans/design-blend-skill.md +1 -0
  51. package/dist/docs/versioned/next/implementationPlans/docs-site-and-versioning.md +1 -0
  52. package/dist/docs/versioned/next/implementationPlans/feature-flags-openfeature.md +1 -0
  53. package/dist/docs/versioned/next/implementationPlans/feature-flags.md +4 -0
  54. package/dist/docs/versioned/next/implementationPlans/infra-mcp-research.md +1 -0
  55. package/dist/docs/versioned/next/implementationPlans/infra-mcp.md +3 -3
  56. package/dist/docs/versioned/next/implementationPlans/mcp-boost-parity.md +1 -0
  57. package/dist/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci-research.md +1 -0
  58. package/dist/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci.md +2 -2
  59. package/dist/docs/versioned/next/implementationPlans/model-router-actions.md +4 -0
  60. package/dist/docs/versioned/next/implementationPlans/model-router-mcp.md +5 -4
  61. package/dist/docs/versioned/next/implementationPlans/offline-mode.md +3 -1
  62. package/dist/docs/versioned/next/implementationPlans/oss-launch-program.md +11 -2
  63. package/dist/docs/versioned/next/implementationPlans/pluggable-database-sqlite-research.md +150 -0
  64. package/dist/docs/versioned/next/implementationPlans/pluggable-database-sqlite.md +247 -0
  65. package/dist/docs/versioned/next/implementationPlans/positioning-django-rails-universal.md +1 -1
  66. package/dist/docs/versioned/next/implementationPlans/public-roadmap-github.md +2 -2
  67. package/dist/docs/versioned/next/implementationPlans/rbac-permissions.md +52 -15
  68. package/dist/docs/versioned/next/implementationPlans/rtk-to-syncdb-migration-docs.md +13 -12
  69. package/dist/docs/versioned/next/implementationPlans/syncdb-codegen-research.md +137 -0
  70. package/dist/docs/versioned/next/implementationPlans/syncdb-codegen.md +63 -59
  71. package/dist/docs/versioned/next/implementationPlans/syncdb-local-first.md +1 -0
  72. package/dist/docs/versioned/next/implementationPlans/syncdb-phase-c-design.md +1 -0
  73. package/dist/docs/versioned/next/implementationPlans/terreno-langfuse-integration.md +1 -0
  74. package/dist/docs/versioned/next/implementationPlans/terreno-syncdb-2.md +1 -0
  75. package/dist/docs/versioned/next/implementationPlans/upgrade-banner.md +4 -0
  76. package/dist/docs/versioned/next/reference/README.md +6 -1
  77. package/dist/docs/versioned/next/reference/admin-config.md +51 -0
  78. package/dist/docs/versioned/next/reference/ai.md +15 -1
  79. package/dist/docs/versioned/next/reference/api.md +18 -0
  80. package/dist/docs/versioned/next/reference/comms.md +88 -7
  81. package/dist/docs/versioned/next/reference/environment-variables.md +9 -1
  82. package/dist/docs/versioned/next/reference/{rtk.md → legacy/rtk.md} +11 -7
  83. package/dist/docs/versioned/next/reference/lifecycle-plugin.md +54 -0
  84. package/dist/docs/versioned/next/reference/mcp-server.md +7 -0
  85. package/dist/docs/versioned/next/reference/syncdb.md +30 -3
  86. package/dist/docs/versioned/next/tasks/README.md +21 -10
  87. package/dist/docs/versioned/next/tasks/admin-improvements.md +189 -353
  88. package/dist/docs/versioned/next/tasks/admin-only.md +2 -0
  89. package/dist/docs/versioned/next/tasks/agentic-sdlc-plugin.md +54 -160
  90. package/dist/docs/versioned/next/tasks/comms-abstraction.md +30 -24
  91. package/dist/docs/versioned/next/tasks/comms-adapter-sendgrid.md +4 -4
  92. package/dist/docs/versioned/next/tasks/consent-forms.md +2 -0
  93. package/dist/docs/versioned/next/tasks/feature-flags.md +2 -0
  94. package/dist/docs/versioned/next/tasks/migrate-cicd-to-circleci.md +14 -10
  95. package/dist/docs/versioned/next/tasks/model-router-actions.md +2 -0
  96. package/dist/docs/versioned/next/tasks/model-router-mcp.md +27 -27
  97. package/dist/docs/versioned/next/tasks/offline-mode.md +2 -0
  98. package/dist/docs/versioned/next/tasks/pluggable-database-sqlite.md +44 -0
  99. package/dist/docs/versioned/next/tasks/public-roadmap-github.md +1 -1
  100. package/dist/docs/versioned/next/tasks/rtk-to-syncdb-migration-docs.md +15 -15
  101. package/dist/docs/versioned/next/tasks/syncdb-codegen.md +37 -31
  102. package/dist/docs/versioned/next/tasks/upgrade-banner.md +2 -0
  103. package/dist/index.js +24 -55
  104. package/dist/index.js.map +1 -1
  105. package/dist/local/localServer.d.ts.map +1 -1
  106. package/dist/local/localServer.js +9 -8
  107. package/dist/local/localServer.js.map +1 -1
  108. package/dist/local/localTools.d.ts +1 -1
  109. package/dist/local/localTools.d.ts.map +1 -1
  110. package/dist/prompts.d.ts.map +1 -1
  111. package/dist/prompts.js +44 -45
  112. package/dist/prompts.js.map +1 -1
  113. package/dist/resources.d.ts.map +1 -1
  114. package/dist/resources.js +9 -2
  115. package/dist/resources.js.map +1 -1
  116. package/dist/tools.d.ts +1 -1
  117. package/dist/tools.d.ts.map +1 -1
  118. package/dist/tools.js +4 -2
  119. package/dist/tools.js.map +1 -1
  120. package/package.json +7 -3
  121. package/src/docs/guidelines/api/skills/mongoose-schema-safety/SKILL.md +8 -0
  122. package/src/docs/resources/overview.md +6 -1
  123. package/src/docs/resources/rtk.md +3 -1
  124. package/src/docs/resources/syncdb.md +43 -0
  125. package/src/docs/upgrades/56.0.0-beta.2.md +34 -0
  126. package/src/docs/upgrades/57.0.0.md +49 -0
  127. package/src/docs/upgrades/57.1.0.md +126 -0
  128. package/src/docs/versioned/next/README.md +15 -3
  129. package/src/docs/versioned/next/explanation/README.md +3 -0
  130. package/src/docs/versioned/next/explanation/admin-consent-migration.md +15 -0
  131. package/src/docs/versioned/next/explanation/admin-plugin-frontend.md +12 -0
  132. package/src/docs/versioned/next/explanation/announcements/rtk-deprecation.md +29 -0
  133. package/src/docs/versioned/next/explanation/authentication.md +51 -58
  134. package/src/docs/versioned/next/explanation/local-first-data.md +52 -0
  135. package/src/docs/versioned/next/explanation/loop-engineering.md +117 -0
  136. package/src/docs/versioned/next/explanation/repository-settings.md +8 -0
  137. package/src/docs/versioned/next/explanation/roadmap-process.md +22 -9
  138. package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +39 -0
  139. package/src/docs/versioned/next/how-to/README.md +3 -0
  140. package/src/docs/versioned/next/how-to/admin-add-model.md +41 -0
  141. package/src/docs/versioned/next/how-to/admin-custom-home.md +31 -0
  142. package/src/docs/versioned/next/how-to/admin-custom-widget.md +42 -0
  143. package/src/docs/versioned/next/how-to/admin-import-prebuilt.md +25 -0
  144. package/src/docs/versioned/next/how-to/circleci.md +173 -0
  145. package/src/docs/versioned/next/how-to/configure-better-auth.md +13 -10
  146. package/src/docs/versioned/next/how-to/expose-mcp-tools.md +194 -0
  147. package/src/docs/versioned/next/how-to/install-agent-skills.md +46 -0
  148. package/src/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +26 -1
  149. package/src/docs/versioned/next/how-to/websocket-integration.md +2 -1
  150. package/src/docs/versioned/next/implementationPlans/ModularAPI.md +1 -0
  151. package/src/docs/versioned/next/implementationPlans/README.md +31 -17
  152. package/src/docs/versioned/next/implementationPlans/admin-improvements-research.md +136 -0
  153. package/src/docs/versioned/next/implementationPlans/admin-improvements.md +157 -527
  154. package/src/docs/versioned/next/implementationPlans/admin-only-research.md +4 -0
  155. package/src/docs/versioned/next/implementationPlans/admin-only.md +3 -1
  156. package/src/docs/versioned/next/implementationPlans/admin-script-runner.md +1 -0
  157. package/src/docs/versioned/next/implementationPlans/admin-ui-v2-django-parity.md +1 -0
  158. package/src/docs/versioned/next/implementationPlans/agentic-sdlc-plugin.md +160 -130
  159. package/src/docs/versioned/next/implementationPlans/apierror-standard-error-redesign.md +1 -0
  160. package/src/docs/versioned/next/implementationPlans/b2b-platform-program.md +5 -4
  161. package/src/docs/versioned/next/implementationPlans/comms-abstraction-research.md +48 -0
  162. package/src/docs/versioned/next/implementationPlans/comms-abstraction.md +152 -62
  163. package/src/docs/versioned/next/implementationPlans/comms-adapter-sendgrid.md +9 -9
  164. package/src/docs/versioned/next/implementationPlans/comms-admin-dashboard.md +1 -1
  165. package/src/docs/versioned/next/implementationPlans/consent-forms.md +4 -0
  166. package/src/docs/versioned/next/implementationPlans/design-blend-skill.md +1 -0
  167. package/src/docs/versioned/next/implementationPlans/docs-site-and-versioning.md +1 -0
  168. package/src/docs/versioned/next/implementationPlans/feature-flags-openfeature.md +1 -0
  169. package/src/docs/versioned/next/implementationPlans/feature-flags.md +4 -0
  170. package/src/docs/versioned/next/implementationPlans/infra-mcp-research.md +1 -0
  171. package/src/docs/versioned/next/implementationPlans/infra-mcp.md +3 -3
  172. package/src/docs/versioned/next/implementationPlans/mcp-boost-parity.md +1 -0
  173. package/src/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci-research.md +1 -0
  174. package/src/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci.md +2 -2
  175. package/src/docs/versioned/next/implementationPlans/model-router-actions.md +4 -0
  176. package/src/docs/versioned/next/implementationPlans/model-router-mcp.md +5 -4
  177. package/src/docs/versioned/next/implementationPlans/offline-mode.md +3 -1
  178. package/src/docs/versioned/next/implementationPlans/oss-launch-program.md +11 -2
  179. package/src/docs/versioned/next/implementationPlans/pluggable-database-sqlite-research.md +150 -0
  180. package/src/docs/versioned/next/implementationPlans/pluggable-database-sqlite.md +247 -0
  181. package/src/docs/versioned/next/implementationPlans/positioning-django-rails-universal.md +1 -1
  182. package/src/docs/versioned/next/implementationPlans/public-roadmap-github.md +2 -2
  183. package/src/docs/versioned/next/implementationPlans/rbac-permissions.md +52 -15
  184. package/src/docs/versioned/next/implementationPlans/rtk-to-syncdb-migration-docs.md +13 -12
  185. package/src/docs/versioned/next/implementationPlans/syncdb-codegen-research.md +137 -0
  186. package/src/docs/versioned/next/implementationPlans/syncdb-codegen.md +63 -59
  187. package/src/docs/versioned/next/implementationPlans/syncdb-local-first.md +1 -0
  188. package/src/docs/versioned/next/implementationPlans/syncdb-phase-c-design.md +1 -0
  189. package/src/docs/versioned/next/implementationPlans/terreno-langfuse-integration.md +1 -0
  190. package/src/docs/versioned/next/implementationPlans/terreno-syncdb-2.md +1 -0
  191. package/src/docs/versioned/next/implementationPlans/upgrade-banner.md +4 -0
  192. package/src/docs/versioned/next/reference/README.md +6 -1
  193. package/src/docs/versioned/next/reference/admin-config.md +51 -0
  194. package/src/docs/versioned/next/reference/ai.md +15 -1
  195. package/src/docs/versioned/next/reference/api.md +18 -0
  196. package/src/docs/versioned/next/reference/comms.md +88 -7
  197. package/src/docs/versioned/next/reference/environment-variables.md +9 -1
  198. package/src/docs/versioned/next/reference/{rtk.md → legacy/rtk.md} +11 -7
  199. package/src/docs/versioned/next/reference/lifecycle-plugin.md +54 -0
  200. package/src/docs/versioned/next/reference/mcp-server.md +7 -0
  201. package/src/docs/versioned/next/reference/syncdb.md +30 -3
  202. package/src/docs/versioned/next/tasks/README.md +21 -10
  203. package/src/docs/versioned/next/tasks/admin-improvements.md +189 -353
  204. package/src/docs/versioned/next/tasks/admin-only.md +2 -0
  205. package/src/docs/versioned/next/tasks/agentic-sdlc-plugin.md +54 -160
  206. package/src/docs/versioned/next/tasks/comms-abstraction.md +30 -24
  207. package/src/docs/versioned/next/tasks/comms-adapter-sendgrid.md +4 -4
  208. package/src/docs/versioned/next/tasks/consent-forms.md +2 -0
  209. package/src/docs/versioned/next/tasks/feature-flags.md +2 -0
  210. package/src/docs/versioned/next/tasks/migrate-cicd-to-circleci.md +14 -10
  211. package/src/docs/versioned/next/tasks/model-router-actions.md +2 -0
  212. package/src/docs/versioned/next/tasks/model-router-mcp.md +27 -27
  213. package/src/docs/versioned/next/tasks/offline-mode.md +2 -0
  214. package/src/docs/versioned/next/tasks/pluggable-database-sqlite.md +44 -0
  215. package/src/docs/versioned/next/tasks/public-roadmap-github.md +1 -1
  216. package/src/docs/versioned/next/tasks/rtk-to-syncdb-migration-docs.md +15 -15
  217. package/src/docs/versioned/next/tasks/syncdb-codegen.md +37 -31
  218. package/src/docs/versioned/next/tasks/upgrade-banner.md +2 -0
  219. package/dist/docs/versioned/next/implementationPlans/PLAN_INDEX.md +0 -73
  220. package/dist/docs/versioned/next/implementationPlans/syncdb-api-inventory.md +0 -303
  221. package/src/docs/versioned/next/implementationPlans/PLAN_INDEX.md +0 -73
  222. package/src/docs/versioned/next/implementationPlans/syncdb-api-inventory.md +0 -303
@@ -6,78 +6,78 @@
6
6
 
7
7
  ### Phase 1: Core MCP Infrastructure
8
8
 
9
- - [ ] **Task 1.1**: Define MCP types and interfaces
9
+ - [x] **Task 1.1**: Define MCP types and interfaces
10
10
  - Description: Create `MCPConfig` interface (with `methods` defaulting to `['list', 'read']`, `excludeFields` for hiding sensitive fields, `maxLimit` defaulting to 50), `MCPRegistryEntry`, and add `mcp?: MCPConfig` to `ModelRouterOptions`. Create the `api/src/mcp/` directory structure.
11
11
  - Files: `api/src/mcp/types.ts`, `api/src/mcp/index.ts`, `api/src/api.ts` (add mcp to ModelRouterOptions)
12
12
  - Depends on: none
13
13
  - Acceptance: Types compile, existing tests still pass, `mcp` is an optional field on `ModelRouterOptions`
14
14
 
15
- - [ ] **Task 1.2**: Build MCP tool registry
16
- - Description: Create a global registry that collects MCP tool entries as `modelRouter()` is called. When a modelRouter has `mcp` config, it pushes an entry to the registry. Export `getMCPRegistry()` internally and `getMCPTools()` publicly (returns `Record<string, CoreTool>`).
15
+ - [x] **Task 1.2**: Build MCP tool registry
16
+ - Description: Create a global registry that collects MCP tool entries as `modelRouter()` is called. When a modelRouter has `mcp` config, it pushes an entry to the registry. Export `getMCPRegistry()` from `@terreno/api`. Vercel AI SDK wrapping lives in `getMCPTools()` on `@terreno/ai`.
17
17
  - Files: `api/src/mcp/registry.ts`, `api/src/mcp/index.ts`, `api/src/api.ts` (register in modelRouter function)
18
18
  - Depends on: Task 1.1
19
- - Acceptance: Calling `modelRouter(Todo, { ..., mcp: { methods: ['list', 'read'] } })` adds entries to the registry. `getMCPTools()` returns CoreTool objects.
19
+ - Acceptance: Calling `modelRouter(Todo, { ..., mcp: { methods: ['list', 'read'] } })` adds entries to the registry. `getMCPRegistry()` returns those entries.
20
20
 
21
- - [ ] **Task 1.3**: Generate Zod schemas from Mongoose models
21
+ - [x] **Task 1.3**: Generate Zod schemas from Mongoose models
22
22
  - Description: Build a utility that converts a Mongoose model's schema into Zod schemas suitable for MCP tool `inputSchema`. Handle common field types (String, Number, Boolean, Date, ObjectId, Array, Mixed). Generate separate schemas for create (required fields), update (all optional + id required), read (id + optional populate), list (queryFields + pagination), and delete (id only). Respect `excludeFields` — omit listed fields from all generated schemas.
23
23
  - Files: `api/src/mcp/schemaGenerator.ts`, `api/src/mcp/schemaGenerator.test.ts`
24
24
  - Depends on: Task 1.1
25
25
  - Acceptance: Given a Mongoose model, produces valid Zod schemas for each CRUD method. Tests cover all common field types. `excludeFields` removes specified fields from schemas.
26
26
 
27
- - [ ] **Task 1.4**: Generate MCP tool definitions from registry entries
27
+ - [x] **Task 1.4**: Generate MCP tool definitions from registry entries
28
28
  - Description: Build tool generator that takes an `MCPRegistryEntry` and produces both `@modelcontextprotocol/sdk` `Tool` objects (JSON Schema input) and Vercel `ai` SDK `CoreTool` objects. Auto-generate descriptions from model name, fields, and queryFields. Apply `toolPrefix` naming (`{prefix}_{method}`). Only generate tools for methods listed in `mcp.methods`.
29
29
  - Files: `api/src/mcp/toolGenerator.ts`, `api/src/mcp/toolGenerator.test.ts`
30
30
  - Depends on: Task 1.2, Task 1.3
31
31
  - Acceptance: Registry entry with `methods: ['list', 'read']` produces exactly `todos_list` and `todos_read` tools with correct schemas and descriptions.
32
32
 
33
- - [ ] **Task 1.5**: Implement MCP tool handlers (CRUD execution)
33
+ - [x] **Task 1.5**: Implement MCP tool handlers (CRUD execution)
34
34
  - Description: Build the execute functions for each CRUD tool. Each handler: (1) extracts user from auth context, (2) checks permissions via `checkPermissions()`, (3) for read/update/delete: loads document and checks object-level permissions, (4) applies queryFilter and population for list, (5) enforces `maxLimit` cap on list results (default 50), (6) runs pre/post hooks, (7) strips `excludeFields` from response data, (8) serializes via `mcpResponseHandler` or default. Reuse internal logic from REST handlers but decoupled from Express req/res.
35
35
  - Files: `api/src/mcp/handlers.ts`, `api/src/mcp/handlers.test.ts`
36
36
  - Depends on: Task 1.4
37
37
  - Acceptance: Each CRUD handler works with correct permission checks, population, filtering. List enforces maxLimit. excludeFields are stripped from responses. Tests cover: successful CRUD, permission denied (403), not found (404), validation errors, owner filtering, population, maxLimit enforcement, excludeFields stripping.
38
38
 
39
- - [ ] **Task 1.6**: Auth-agnostic user extraction for MCP
39
+ - [x] **Task 1.6**: Auth-agnostic user extraction for MCP
40
40
  - Description: Build middleware/utility that extracts user from MCP transport headers using whichever auth provider is configured (JWT via passport or Better Auth via `auth.api.getSession()`). Should mirror `authenticateMiddleware` behavior but work with raw headers instead of Express req.
41
41
  - Files: `api/src/mcp/auth.ts`, `api/src/mcp/auth.test.ts`
42
42
  - Depends on: Task 1.1
43
43
  - Acceptance: Given headers with a valid JWT, returns User. Given headers with a valid Better Auth session token, returns User. Given no/invalid headers with `allowAnonymous: false`, returns null. Works with both auth providers.
44
44
 
45
- - [ ] **Task 1.7**: Mount MCP server in TerrenoApp
45
+ - [x] **Task 1.7**: Mount MCP server in TerrenoApp
46
46
  - Description: In `TerrenoApp`'s startup flow, check if the MCP registry has any entries. If so, create an `McpServer` instance from `@modelcontextprotocol/sdk`, register all tools from the registry, set up `StreamableHTTPServerTransport`, and mount on `/mcp`. Wire up `ListToolsRequestSchema` and `CallToolRequestSchema` handlers.
47
47
  - Files: `api/src/mcp/server.ts`, `api/src/expressServer.ts` (or TerrenoApp equivalent — integrate into startup)
48
48
  - Depends on: Task 1.4, Task 1.5, Task 1.6
49
49
  - Acceptance: Starting a TerrenoApp with MCP-configured models auto-mounts `/mcp`. MCP clients can list tools and call them. No MCP config = no `/mcp` endpoint.
50
50
 
51
- - [ ] **Task 1.8**: Integration tests
51
+ - [x] **Task 1.8**: Integration tests
52
52
  - Description: End-to-end tests that spin up a TerrenoApp with MCP-configured models and test the full flow: MCP client connects, lists tools, performs CRUD via tool calls, verifies permissions block unauthorized access, verifies population and query filtering work.
53
53
  - Files: `api/src/mcp/integration.test.ts`
54
54
  - Depends on: Task 1.7
55
55
  - Acceptance: Full CRUD lifecycle works over MCP. Permission denials return appropriate errors. Owner filtering restricts results. Population returns nested data.
56
56
 
57
- - [ ] **Task 1.9**: Export public API
58
- - Description: Export `MCPConfig`, `getMCPTools()`, and any other public interfaces from `@terreno/api`'s main index. Update package exports.
59
- - Files: `api/src/index.ts`, `api/src/mcp/index.ts`
57
+ - [x] **Task 1.9**: Export public API
58
+ - Description: Export `MCPConfig` and MCP registry/server helpers from `@terreno/api`. Export `getMCPTools()` from `@terreno/ai` so the Vercel `ai` SDK stays out of `@terreno/api`.
59
+ - Files: `api/src/index.ts`, `ai/src/index.ts`, `ai/src/service/getMCPTools.ts`
60
60
  - Depends on: Task 1.7
61
- - Acceptance: Consumers can `import { MCPConfig, getMCPTools } from "@terreno/api"`.
61
+ - Acceptance: Consumers can `import { MCPConfig } from "@terreno/api"` and `import { getMCPTools } from "@terreno/ai"`.
62
62
 
63
63
  ---
64
64
 
65
65
  ### Phase 2: Frontend Integration
66
66
 
67
- - [ ] **Task 2.1**: `useTerrenoChat` hook
67
+ - [x] **Task 2.1**: `useTerrenoChat` hook
68
68
  - Description: Create a hook wrapping `@ai-sdk/react`'s `useChat()` pre-configured for a Terreno MCP backend. Handles Bearer token injection from auth state (reads from Redux store — JWT token or Better Auth session). Accepts `baseURL` and optional `tools` override.
69
- - Files: `rtk/src/useTerrenoChat.ts`, `rtk/src/useTerrenoChat.test.ts`
69
+ - Files: `rtk/src/useTerrenoChat.ts`
70
70
  - Depends on: Task 1.7
71
71
  - Acceptance: Hook connects to MCP-enabled backend, streams responses with tool calls, injects auth token automatically.
72
72
 
73
- - [ ] **Task 2.2**: `useMCPTools` hook
74
- - Description: Create a hook that discovers available MCP tools from the backend. Uses `@ai-sdk/mcp`'s `createMCPClient()` to connect and list tools. Caches result. Returns typed tool list.
75
- - Files: `rtk/src/useMCPTools.ts`, `rtk/src/useMCPTools.test.ts`
73
+ - [x] **Task 2.2**: `useMCPTools` hook
74
+ - Description: Create a hook that discovers available MCP tools from the backend via JSON-RPC call to /mcp endpoint. Caches result. Returns typed tool list.
75
+ - Files: `rtk/src/useMCPTools.ts`
76
76
  - Depends on: Task 1.7
77
77
  - Acceptance: Hook returns list of available tools with names, descriptions, and input schemas. Handles connection errors gracefully.
78
78
 
79
- - [ ] **Task 2.3**: Export frontend public API
80
- - Description: Export `useTerrenoChat` and `useMCPTools` from `@terreno/rtk`. Add `@ai-sdk/react` and `@ai-sdk/mcp` as dependencies.
79
+ - [x] **Task 2.3**: Export frontend public API
80
+ - Description: Export `useTerrenoChat` and `useMCPTools` from `@terreno/rtk`. Add `@ai-sdk/react` and `ai` as dependencies.
81
81
  - Files: `rtk/src/index.ts`, `rtk/package.json`
82
82
  - Depends on: Task 2.1, Task 2.2
83
83
  - Acceptance: Consumers can `import { useTerrenoChat, useMCPTools } from "@terreno/rtk"`.
@@ -86,19 +86,19 @@
86
86
 
87
87
  ### Phase 3: Examples & Polish
88
88
 
89
- - [ ] **Task 3.1**: Add MCP config to example backend models
90
- - Description: Add `mcp` config to the existing Todo and Food models in `example-backend`. Todos: read-only (`list`, `read`). Food: full CRUD. Include `mcpResponseHandler` example on one model.
91
- - Files: `example-backend/src/routes/todos.ts`, `example-backend/src/routes/food.ts`
89
+ - [x] **Task 3.1**: Add MCP config to example backend models
90
+ - Description: Add `mcp` config to the existing Todo and User models in `example-backend`. Todos: read-only (`list`, `read`) with excludeFields. Users: read-only (`list`, `read`) with sensitive fields excluded.
91
+ - Files: `example-backend/src/api/todos.ts`, `example-backend/src/api/users.ts`
92
92
  - Depends on: Task 1.9
93
- - Acceptance: Starting example-backend mounts `/mcp` with todo and food tools. MCP client can list and call them.
93
+ - Acceptance: Starting example-backend mounts `/mcp` with todo and user tools. MCP client can list and call them.
94
94
 
95
- - [ ] **Task 3.2**: Demo chat screen in example frontend
95
+ - [x] **Task 3.2**: Demo chat screen in example frontend
96
96
  - Description: Add a simple chat screen to `example-frontend` that uses `useTerrenoChat()` to connect to the MCP-enabled backend. Show tool calls inline (e.g., "Searching todos..." with results). Navigation from home screen.
97
97
  - Files: `example-frontend/app/chat.tsx`, `example-frontend/app/_layout.tsx` (add nav)
98
98
  - Depends on: Task 2.3, Task 3.1
99
99
  - Acceptance: User can chat with the AI, which calls MCP tools to query/modify data. Tool calls and results visible in the UI.
100
100
 
101
- - [ ] **Task 3.3**: Refine auto-generated tool descriptions
101
+ - [x] **Task 3.3**: Refine auto-generated tool descriptions
102
102
  - Description: Improve description generation quality. Include field types, required vs optional, enum values, ref model names. Test with multiple model shapes to ensure descriptions are helpful for LLMs.
103
103
  - Files: `api/src/mcp/toolGenerator.ts`, `api/src/mcp/toolGenerator.test.ts`
104
104
  - Depends on: Task 1.4
@@ -1,5 +1,7 @@
1
1
  # Task List: Offline Mode
2
2
 
3
+ **Status:** Closed (2026-08-20) — IP deferred; superseded by `@terreno/syncdb`. Open tasks below will not be executed.
4
+
3
5
  *Structured task breakdown for automated implementation. Each task should be independently implementable and testable.*
4
6
 
5
7
  ## Phase 1: RTK Core Offline Framework
@@ -0,0 +1,44 @@
1
+ # Tasks: Pluggable database layer and SQLite adapter
2
+
3
+ IP: [pluggable-database-sqlite.md](../implementationPlans/pluggable-database-sqlite.md)
4
+
5
+ ## Phase 1 — Adapter seam + Mongoose adapter (no behavior change)
6
+
7
+ - [ ] Define `DatabaseAdapter`, `AdapterCollection`, `AdapterCapabilities`, `PopulatePath`, and `MongoFilter` types in `api/src/db/adapter.ts`
8
+ - [ ] Implement `MongooseAdapter` in `api/src/db/mongooseAdapter.ts` delegating to today's exact Mongoose calls (including the `docLoader.ts` native soft-delete probe)
9
+ - [ ] Refactor `api/src/api.ts` list/read/create/update/delete/array handlers to use the adapter
10
+ - [ ] Refactor `api/src/sync/executors.ts` and `api/src/docLoader.ts` to use the adapter
11
+ - [ ] Refactor permissions doc loading (`permissionMiddleware`) to use the adapter
12
+ - [ ] Add `TerrenoAppOptions.database` with Mongoose adapter default; export adapter types + `mongooseAdapter()` from `api/src/index.ts`
13
+ - [ ] Add capability checks (`changeStreams`, `transactions`, `textSearch`) to realtime, syncdb, feature-flag, and search registration paths (all pass on Mongo)
14
+ - [ ] Gate: full existing api test suite green with zero test edits
15
+
16
+ ## Phase 2 — @terreno/db-sqlite core
17
+
18
+ - [ ] Scaffold `db-sqlite/` workspace package (catalog deps, tsconfig, biome, CI wiring)
19
+ - [ ] Driver injection layer (`bun:sqlite` default; accept `better-sqlite3` / `node:sqlite` / `libsql` handles); connection defaults (WAL, busy_timeout, foreign_keys off)
20
+ - [ ] Schema → DDL mapping per the IP table (String/Number/Boolean/Date/ObjectId/enum/JSON/`DateOnly`/`_id`/`__v`; NOT NULL; JS-layer defaults; indexes incl. unique + sparse-as-partial)
21
+ - [ ] `ensureSchema` additive migration with `_terreno_schema` metadata table; destructive changes → startup error + generated SQL file
22
+ - [ ] CRUD: create / findById / save (validate + changed-path persist) / delete (soft + hard) with `model.hydrate()` documents
23
+ - [ ] Plugin semantics: created/updated timestamps, soft-delete read filter, `__v` optimistic-concurrency conflict path, document save middleware via the hook registry
24
+ - [ ] Query compiler for the modelRouter filter subset (equality, `$in/$nin/$ne/$exists/$gt/$gte/$lt/$lte`, `$and`/`$or`, date ranges) incl. `json_extract` and `json_each` paths; unknown operators → 400
25
+ - [ ] Sort / skip / limit / count
26
+ - [ ] Population: batched two-phase loads per path, field selection in SQL, single + array refs, dangling ref → null, soft-delete filter on referenced models, populate on findById/list and post-create/update re-reads
27
+ - [ ] Adapter conformance suite in `api/src/db/conformance/` (CRUD, query operators, pagination, plugins, population) run against both adapters
28
+
29
+ ## Phase 3 — Auth + capability hardening
30
+
31
+ - [ ] `adapter.getBetterAuthDatabase()` seam in `betterAuthSetup.ts` (Mongo adapter returns today's `mongodbAdapter` client)
32
+ - [ ] Better Auth on SQLite: driver handle → Kysely adapter; schema tables created from `ensureSchema` via Better Auth migration tooling; signup/login/session → `req.user` end-to-end test
33
+ - [ ] Gate `setupAuth`/passport path to the Mongo adapter with an actionable startup error
34
+ - [ ] Startup errors for missing capabilities name the capability and the feature that needs it (tested)
35
+ - [ ] `@terreno/test`: `TERRENO_TEST_DB=sqlite` mode (temp-file DB per suite, no mongod)
36
+
37
+ ## Phase 4 — Example, docs, and integration
38
+
39
+ - [ ] `example-backend` `DB_ADAPTER=sqlite` mode: adapter wiring, skip change-stream features via capability flags, seed script works, boot + CRUD smoke test with no mongod
40
+ - [ ] Parity checks: `/openapi.json` and admin `/admin/config` identical across adapters for example models
41
+ - [ ] Docs: `docs/how-to/run-on-sqlite.md`, `docs/explanation/database-adapters.md`; update positioning docs' MongoDB-only claims
42
+ - [ ] MCP: `terreno_generate_model` / bootstrap templates mention adapter choice
43
+ - [ ] Changelog + upgrade note (no action needed for existing apps)
44
+ - [ ] `bun run lint`, `bun run compile`, api + db-sqlite tests green in CI
@@ -80,7 +80,7 @@ See: [`docs/implementationPlans/public-roadmap-github.md`](../implementationPlan
80
80
  - Acceptance: workflow parses as valid YAML; the secret-validation step lists every required variable; the commit step is conditional on a real diff.
81
81
 
82
82
  - [x] **Task 4.3**: Seed `ROADMAP.md` and link it
83
- - Description: Commit an initial hand-written `ROADMAP.md` (the generator will overwrite it later) built from the IPs in `docs/implementationPlans/oss-launch-program.md` plus the active plans in `PLAN_INDEX.md`. Add a note at the top that it is generated from the Project board. Link it from `README.md` and add it to the docs site sidebar in `website/docusaurus.config.ts` (or the sidebars file if navigation is defined there — check both).
83
+ - Description: Commit an initial hand-written `ROADMAP.md` (the generator will overwrite it later) built from the IPs in `docs/implementationPlans/oss-launch-program.md` plus active IPs (those whose `**Status:**` header is not Complete/Deferred/Closed). Add a note at the top that it is generated from the Project board. Link it from `README.md` and add it to the docs site sidebar in `website/docusaurus.config.ts` (or the sidebars file if navigation is defined there — check both).
84
84
  - Files: `ROADMAP.md` (new), `README.md`, `website/docusaurus.config.ts` or `website/sidebars.ts`
85
85
  - Depends on: Task 4.1
86
86
  - Acceptance: `ROADMAP.md` lists every IP in the program with a `Target`; the docs site builds (`bun run website:build`) with the new nav entry; the README links it.
@@ -42,13 +42,13 @@ See: [`docs/implementationPlans/rtk-to-syncdb-migration-docs.md`](../implementat
42
42
  - Depends on: Task 1.1
43
43
  - Acceptance: every documented symbol exists in the inventory; every config option lists a type and default; no `TODO` or placeholder text remains.
44
44
 
45
- - [ ] **Task 2.2**: Remove `rtk.md` from the public reference index
45
+ - [x] **Task 2.2**: Remove `rtk.md` from the public reference index
46
46
  - Description: Per IP decision M4 (P7 A), remove `docs/reference/rtk.md` from the public reference tree — do **not** maintain a parallel RTK reference page at launch. Add a Docusaurus redirect from the old URL to `docs/how-to/migrate-rtk-to-syncdb.md`. Archive the pre-launch `rtk.md` content only if inbound links require it (e.g. under `docs/reference/legacy/` with a deprecation banner), but do not list it in `docs/reference/README.md`.
47
47
  - Files: `docs/reference/rtk.md` (removed or archived), `website/docusaurus.config.ts`, `docs/reference/README.md`
48
48
  - Depends on: Task 2.1
49
49
  - Acceptance: `docs/reference/README.md` has no RTK entry; the old URL redirects to the migration guide; no launch doc presents RTK as a supported reference path.
50
50
 
51
- - [ ] **Task 2.3**: Update the reference and docs indexes
51
+ - [x] **Task 2.3**: Update the reference and docs indexes
52
52
  - Description: Update `docs/reference/README.md` and `docs/README.md`: add `@terreno/syncdb` and `@terreno/ai` to the package table (`ai` is currently missing entirely), add `@terreno/admin-spa` and `@terreno/feature-flags` if absent. Do **not** list `rtk` in the public reference index per M4 — link the migration guide from a "Migrating from RTK" note instead. Confirm every shipped package in `publish-on-tag.yml` appears exactly once in the appropriate section.
53
53
  - Files: `docs/reference/README.md`, `docs/README.md`
54
54
  - Depends on: Task 2.2
@@ -80,7 +80,7 @@ See: [`docs/implementationPlans/rtk-to-syncdb-migration-docs.md`](../implementat
80
80
  - Depends on: Task 3.3
81
81
  - Acceptance: all eleven sections complete; the rollback section states what local data survives; the checklist has no step absent from the body; the guide is listed in `docs/how-to/README.md`.
82
82
 
83
- - [ ] **Task 3.5**: Validate the guide by performing the migration
83
+ - [x] **Task 3.5**: Validate the guide by performing the migration
84
84
  - Description: On a scratch branch, take a screen in `example-frontend` that #869 did **not** migrate and migrate it following only the guide. Record every point where the guide was insufficient. Fix the guide. Then revert the scratch branch — the migration itself is not part of this IP's deliverable, only the guide corrections are.
85
85
  - Files: `docs/how-to/migrate-rtk-to-syncdb.md`
86
86
  - Depends on: Task 3.4
@@ -88,13 +88,13 @@ See: [`docs/implementationPlans/rtk-to-syncdb-migration-docs.md`](../implementat
88
88
 
89
89
  ## Phase 4: Explainers and auth repositioning
90
90
 
91
- - [ ] **Task 4.1**: Write `docs/explanation/local-first-data.md`
91
+ - [x] **Task 4.1**: Write `docs/explanation/local-first-data.md`
92
92
  - Description: Conceptual explainer, no step-by-step. Cover: what local-first means here (local DB is the UI source of truth, server is the authority), the mental-model shift from request/response to apply-locally-then-reconcile, what the developer stops having to think about (loading states on writes, manual optimistic updates, refetch orchestration), what they must newly think about (conflicts, sync status, encryption at rest, key lifecycle on logout), and the tradeoffs versus server-first fetching. Link the migration guide and the syncdb reference.
93
93
  - Files: `docs/explanation/local-first-data.md` (new)
94
94
  - Depends on: Task 2.1
95
95
  - Acceptance: no shell commands or step lists; names at least three things developers stop doing and three they start doing; linked from `docs/explanation/README.md` if one exists.
96
96
 
97
- - [ ] **Task 4.2**: Reposition authentication documentation
97
+ - [x] **Task 4.2**: Reposition authentication documentation
98
98
  - Description: Rewrite `docs/explanation/authentication.md` so Better Auth is the primary path and JWT/Passport is described as legacy with its support status. Update `docs/how-to/configure-better-auth.md` to drop "optional"/"alternative" framing and present it as the default setup. Add a short decision section: when a consumer would still choose JWT (existing deployment, custom token requirements). Verify every claim against `api/src/betterAuth*.ts` and the #869 socket auth changes.
99
99
  - Files: `docs/explanation/authentication.md`, `docs/how-to/configure-better-auth.md`
100
100
  - Depends on: Task 3.3
@@ -102,25 +102,25 @@ See: [`docs/implementationPlans/rtk-to-syncdb-migration-docs.md`](../implementat
102
102
 
103
103
  ## Phase 5: Agent surfaces
104
104
 
105
- - [ ] **Task 5.1**: Add syncdb agent rules and mark RTK rules legacy
105
+ - [x] **Task 5.1**: Add syncdb agent rules and mark RTK rules legacy
106
106
  - Description: Create `.rulesync/rules/syncdb/00-syncdb.md` following the structure of `.rulesync/rules/rtk/00-rtk.md` (commands, architecture, key exports, usage patterns, conventions, testing). Add a legacy banner to the top of the RTK rule file stating that new code must use syncdb and that the RTK rules exist only for maintaining existing consumers. Run `bun run rules` and commit all mirrors.
107
107
  - Files: `.rulesync/rules/syncdb/00-syncdb.md` (new), `.rulesync/rules/rtk/00-rtk.md`, generated mirrors
108
108
  - Depends on: Task 2.1
109
109
  - Acceptance: `bun run rules:check` exits 0; the syncdb rule documents only APIs from the inventory; the RTK rule's first line marks it legacy.
110
110
 
111
- - [ ] **Task 5.2**: Update the SDK codegen skill
111
+ - [x] **Task 5.2**: Update the SDK codegen skill
112
112
  - Description: Rewrite `.rulesync/skills/generate-sdk/SKILL.md` for the syncdb codegen path. Keep an explicitly-labeled legacy branch for consumers still on RTK during the support window. Update the trigger description, the prerequisite list, the command, the output file path, and the "never edit the generated file" warning to name the correct file. Regenerate mirrors.
113
113
  - Files: `.rulesync/skills/generate-sdk/SKILL.md`, generated mirrors
114
114
  - Depends on: Task 3.4
115
115
  - Acceptance: the skill's primary path produces a working generated file when run against `example-backend`; the legacy branch is clearly labeled; `bun run rules:check` exits 0.
116
116
 
117
- - [ ] **Task 5.3**: Update root agent context files
117
+ - [x] **Task 5.3**: Update root agent context files
118
118
  - Description: Update `AGENTS.md`, `CLAUDE.md`, and `CLAUDE-consumer.md`: replace the `@terreno/rtk` package description and the "always use generated SDK hooks" guidance with the syncdb equivalent, update the architecture diagram, and add a short legacy note pointing at the migration guide. Do not change unrelated sections. Note that `CLAUDE.local.md` also contains a stale copy — either update or delete it (it appears to be an outdated duplicate; confirm before deleting).
119
119
  - Files: `AGENTS.md`, `CLAUDE.md`, `CLAUDE-consumer.md`, possibly `CLAUDE.local.md`
120
120
  - Depends on: Task 5.1
121
121
  - Acceptance: no root agent file instructs writing RTK Query code for new work; the architecture diagram names syncdb; `bun run rules:check` exits 0.
122
122
 
123
- - [ ] **Task 5.4**: Update MCP resources and bootstrap templates
123
+ - [x] **Task 5.4**: Update MCP resources and bootstrap templates
124
124
  - Description: Update `mcp-server/src/docs/resources/*.md` (the `terreno://docs/rtk` resource and the patterns/overview bundles) and every file under `mcp-server/src/docs/templates/bootstrap/` that wires the Redux store, auth slice, or RTK hooks. A bootstrapped app must run on syncdb + Better Auth. Also check `mcp-server/src/prompts.ts` for RTK-specific prompt text.
125
125
  - Files: `mcp-server/src/docs/resources/*.md`, `mcp-server/src/docs/templates/bootstrap/**`, `mcp-server/src/prompts.ts`
126
126
  - Depends on: Task 5.1
@@ -128,37 +128,37 @@ See: [`docs/implementationPlans/rtk-to-syncdb-migration-docs.md`](../implementat
128
128
 
129
129
  ## Phase 6: Deprecation signalling
130
130
 
131
- - [ ] **Task 6.1**: Add the deprecation notice to `rtk/README.md`
131
+ - [x] **Task 6.1**: Add the deprecation notice to `rtk/README.md`
132
132
  - Description: Add a notice block at the very top of `rtk/README.md`: deprecated as of version X, supported through version Y, superseded by `@terreno/syncdb`, link the migration guide. Do not remove existing content.
133
133
  - Files: `rtk/README.md`
134
134
  - Depends on: Task 2.2
135
135
  - Acceptance: the notice is the first content after the title; versions are concrete, not placeholders.
136
136
 
137
- - [ ] **Task 6.2**: Add the changelog entry
137
+ - [x] **Task 6.2**: Add the changelog entry
138
138
  - Description: Add a `Deprecated` entry to the root `CHANGELOG.md` under the release that includes #869, naming `@terreno/rtk`, the support window, and the migration guide link. Add the corresponding `Added` entry for `@terreno/syncdb`.
139
139
  - Files: `CHANGELOG.md`
140
140
  - Depends on: Task 6.1
141
141
  - Acceptance: both entries exist under the correct version heading; the migration guide link resolves.
142
142
 
143
- - [ ] **Task 6.3**: Write the upgrade note
143
+ - [x] **Task 6.3**: Write the upgrade note
144
144
  - Description: Create `mcp-server/src/docs/upgrades/<version>.md` for the release containing #869, following the format of the existing `0.20.0.md` and `0.21.0.md` notes. Include: what changed, whether action is required, the auth-then-data migration order, links to the migration guide, and before/after snippets for the two most common changes (a read hook and a write hook).
145
145
  - Files: `mcp-server/src/docs/upgrades/<version>.md` (new)
146
146
  - Depends on: Task 3.4
147
147
  - Acceptance: `terreno_get_upgrade_guide` with a range spanning this version returns the note; the format matches the existing notes.
148
148
 
149
- - [ ] **Task 6.4**: Draft the announcement post
149
+ - [x] **Task 6.4**: Draft the announcement post
150
150
  - Description: Add the announcement body to `docs/explanation/roadmap-process.md` under a "Drafted announcements" heading (or to a new `docs/explanation/announcements/rtk-deprecation.md` if that file does not exist yet). It should explain to outside users what changed, why local-first, what they must do and by when, and where to ask questions. Under 400 words. Do not post it — posting is a maintainer action.
151
151
  - Files: `docs/explanation/roadmap-process.md` or `docs/explanation/announcements/rtk-deprecation.md`
152
152
  - Depends on: Task 6.2
153
153
  - Acceptance: under 400 words; names the support window; links the migration guide and the Q&A discussion category.
154
154
 
155
- - [ ] **Task 6.5**: Update the README architecture and package list
155
+ - [x] **Task 6.5**: Update the README architecture and package list
156
156
  - Description: Update `README.md`: replace `@terreno/rtk` with `@terreno/syncdb` in the architecture diagram and the published-packages list, keeping `rtk` listed with a `(deprecated)` marker. Update the "Integration Flow" numbered list to describe the syncdb loop. Do not make positioning changes here — those belong to [`positioning-django-rails-universal`](../implementationPlans/positioning-django-rails-universal.md).
157
157
  - Files: `README.md`
158
158
  - Depends on: Task 6.1
159
159
  - Acceptance: the diagram names syncdb; `rtk` is marked deprecated; the integration flow describes local-first reads and writes; no positioning prose changed.
160
160
 
161
- - [ ] **Task 6.6**: Delete the working inventory document
161
+ - [x] **Task 6.6**: Delete the working inventory document
162
162
  - Description: Confirm every fact from `docs/implementationPlans/syncdb-api-inventory.md` has landed in `docs/reference/syncdb.md` or the migration guide, then delete the working file. It is scaffolding, not a deliverable.
163
163
  - Files: `docs/implementationPlans/syncdb-api-inventory.md` (deleted)
164
164
  - Depends on: all Phase 2–5 tasks
@@ -1,65 +1,71 @@
1
1
  # Task List: @terreno/syncdb-codegen
2
2
 
3
- Paired with [docs/implementationPlans/syncdb-codegen.md](../implementationPlans/syncdb-codegen.md). Each task is independently implementable and testable.
3
+ Paired with [docs/implementationPlans/syncdb-codegen.md](../implementationPlans/syncdb-codegen.md). **Delivery: single PR** — phases define implementation order only.
4
4
 
5
5
  ## Phase 1: syncdb runtime
6
6
 
7
- - [ ] **Task 1.1**: Per-mutation `maxAttempts` plumbing
7
+ - [x] **Task 1.1**: Per-mutation `maxAttempts` plumbing
8
8
  - Description: Add optional `maxAttempts` to `MutateArgs`, store it as an optional cell on the outbox row, and have the replay coordinator's `error`-nack branch use `row.maxAttempts ?? MAX_ERROR_NACK_ATTEMPTS` when deciding terminal failure. Missing cell keeps current behavior.
9
9
  - Files: `syncdb/src/client.ts`, `syncdb/src/mutations/outbox.ts`, `syncdb/src/storage/schema.ts`, `syncdb/src/sync/replayCoordinator.ts`, `syncdb/src/sync/replayCoordinator.test.ts`, `syncdb/src/mutations/outbox.test.ts`
10
10
  - Depends on: none
11
11
  - Acceptance: `maxAttempts: 1` fails terminally after one error nack; omitted preserves 5-attempt exponential backoff; existing tests unchanged.
12
12
 
13
- - [ ] **Task 1.2**: `createCollectionHooks` factory
14
- - Description: New `createCollectionHooks<TData, TCreate, TUpdate>({collection, retries})` in `@terreno/syncdb/react` returning the five per-operation hooks `{useListQuery, useReadQuery, useCreateMutation, useUpdateMutation, useDeleteMutation}`. Read hooks delegate to the existing `useQuery`/`useEntity`; mutation hooks return one-element `[trigger]` tuples (RTK call-site parity) whose triggers wrap `client.mutate`, mapping `retries` (false → 1, number → n, omitted → undefined) to `maxAttempts`.
13
+ - [x] **Task 1.2**: `createCollectionHooks` factory
14
+ - Description: New `createCollectionHooks<TData, TCreate, TUpdate>({collection, retries})` in `@terreno/syncdb/react` returning the five per-operation hooks `{useListQuery, useReadQuery, useCreateMutation, useUpdateMutation, useDeleteMutation}`. Read hooks delegate to the existing `useQuery`/`useEntity`; mutation hooks return one-element `[trigger]` tuples whose triggers wrap `client.mutate`, mapping `retries` (false → 1, number → n, omitted → undefined) to `maxAttempts`.
15
15
  - Files: `syncdb/src/react/collectionHooks.ts` (new), `syncdb/src/react/collectionHooks.test.tsx` (new), `syncdb/src/react/index.ts`
16
16
  - Depends on: Task 1.1
17
17
  - Acceptance: factory hooks behave identically to direct hook calls; `const [create] = useCreateMutation()` destructuring compiles and works; typed create/update payloads compile; `retries` reaches the outbox row.
18
18
 
19
19
  ## Phase 2: OpenAPI extension in @terreno/api
20
20
 
21
- - [ ] **Task 2.1**: Emit `x-terreno-sync` on list operations
22
- - Description: When `modelRouter` options include `sync`, the list operation's OpenAPI object gains `"x-terreno-sync": {collection, scope}` where `collection` is the route path without the leading slash and `scope` is the scope type ("owner" | "tenant" | "broadcast" | "custom").
23
- - Files: `api/src/openApi.ts`, `api/src/openApi.test.ts` (or the existing spec-generation test file)
21
+ - [x] **Task 2.1**: Emit `x-terreno-sync` on list operations
22
+ - Description: When `modelRouter` options include `sync`, the list operation's OpenAPI object gains `"x-terreno-sync": {collection, scope}` where `collection` is the route path without the leading slash and `scope` is the scope type ("owner" | "tenant" | "broadcast" | "custom"). Thread `routePath` into `listOpenApiMiddleware` so `collection` matches `syncRegistry` `collectionTag`.
23
+ - Files: `api/src/openApi.ts`, `api/src/api.ts` (call site), `api/src/openApi.test.ts` (or existing spec-generation test file)
24
24
  - Depends on: none
25
25
  - Acceptance: spec for a synced model contains the extension with correct collection tag and scope; non-synced routes contain no extension; RTK codegen output for example-frontend is unchanged.
26
26
 
27
- ## Phase 3: codegen package
27
+ ## Phase 3: codegen CLI (`@terreno/syncdb`)
28
28
 
29
- - [ ] **Task 3.1**: Package scaffold
30
- - Description: New `syncdb-codegen/` workspace package (`@terreno/syncdb-codegen`) with bin `terreno-syncdb-codegen` (`#!/usr/bin/env bun`), `compile`, `test`, `lint`, and `build:binary` (`bun build --compile src/cli.ts --outfile dist/terreno-syncdb-codegen`) scripts, modeled on `syncdb/` + the `mcp-server` bin pattern.
31
- - Files: `syncdb-codegen/package.json` (new), `syncdb-codegen/tsconfig.json` (new), `syncdb-codegen/biome.jsonc` (new), root `package.json` (workspaces + `syncdb-codegen:compile`/`syncdb-codegen:test` scripts)
29
+ - [x] **Task 3.1**: Bin scaffold
30
+ - Description: Add `terreno-syncdb-codegen` bin and `build:binary` to `@terreno/syncdb` (`src/codegen/cli.ts` with `#!/usr/bin/env bun`), modeled on the `mcp-server` bin pattern. No new workspace package.
31
+ - Files: `syncdb/package.json`, `syncdb/src/codegen/cli.ts`
32
32
  - Depends on: none
33
- - Acceptance: `bun run syncdb-codegen:compile` and `bun run lint` pass from the repo root.
33
+ - Acceptance: `bun syncdb/src/codegen/cli.ts --help`-equivalent missing-args usage exits 1; `bun run lint` in syncdb passes.
34
34
 
35
- - [ ] **Task 3.2**: Spec loading and collection discovery
35
+ - [x] **Task 3.2**: Spec loading and collection discovery
36
36
  - Description: Load the OpenAPI document from a URL or file path; walk `paths` for `x-terreno-sync` extensions; resolve each collection's entity schema (list response `data` items ref), create body, and update body schema refs; apply `--collections` as filter or fallback; fail with an actionable error when no collections resolve.
37
- - Files: `syncdb-codegen/src/loadSpec.ts` (new), `syncdb-codegen/src/discoverCollections.ts` (new), tests, `syncdb-codegen/src/fixtures/openapi.example.json` (new, captured from example-backend)
37
+ - Files: `syncdb/src/codegen/loadSpec.ts`, `syncdb/src/codegen/discoverCollections.ts`, tests, `syncdb/src/codegen/fixtures/openapi.example.json`
38
38
  - Depends on: Task 2.1, Task 3.1
39
- - Acceptance: fixture spec yields `[{collection: "todos", entityRef, createRef, updateRef}]`; missing extensions + no flag exits non-zero.
39
+ - Acceptance: fixture spec yields todos; missing extensions + no flag exits non-zero.
40
40
 
41
- - [ ] **Task 3.3**: Type and SDK emitters
42
- - Description: Emit TS interfaces from the OpenAPI schema subset produced by `mongoose-to-swagger` (objects, primitives, string-union enums, arrays, `$ref`, required lists), then assemble the output file: generated header, interfaces, `SYNC_COLLECTIONS as const`, and one destructured `createCollectionHooks` block per collection renaming the factory keys to RTK-style hook names (`useListQuery: useGetTodosQuery`, `useReadQuery: useGetTodosByIdQuery`, `useCreateMutation: usePostTodosMutation`, `useUpdateMutation: usePatchTodosByIdMutation`, `useDeleteMutation: useDeleteTodosByIdMutation`), with per-collection `retries` overrides from `--config` JSON applied. Name derivation must match `@rtk-query/codegen-openapi`'s pascal-case of the route path. Format via `bunx biome check --write` when available; `--no-format` skips.
43
- - Files: `syncdb-codegen/src/emitTypes.ts` (new), `syncdb-codegen/src/emitSdk.ts` (new), snapshot tests
41
+ - [x] **Task 3.3**: Type and SDK emitters
42
+ - Description: Emit TS interfaces from the OpenAPI schema subset, then assemble the output file with friendly hook names (`useTodos`, `useTodo`, `useCreateTodo`, `useUpdateTodo`, `useDeleteTodo`).
43
+ - Files: `syncdb/src/codegen/emitTypes.ts`, `syncdb/src/codegen/emitSdk.ts`, `syncdb/src/codegen/hookNames.ts`, tests
44
44
  - Depends on: Task 3.2
45
- - Acceptance: snapshot output type-checks; emitted hook names for the todos fixture are byte-identical to the RTK-generated names in `example-frontend/store/openApiSdk.ts`; `{overrides: {todos: {retries: false}}}` appears as `retries: false` in the emitted factory call.
45
+ - Acceptance: todos fixture emits friendly hooks; retries override appears in the factory call.
46
46
 
47
- - [ ] **Task 3.4**: CLI entry and binary build
48
- - Description: `cli.ts` wires arg parsing (`util.parseArgs`) → load → discover → emit → write, with clear usage/error output and non-zero exit codes. Verify `build:binary` produces a standalone executable with identical output.
49
- - Files: `syncdb-codegen/src/cli.ts` (new), `syncdb-codegen/src/cli.test.ts` (new)
47
+ - [x] **Task 3.4**: CLI entry and binary build
48
+ - Description: `cli.ts` wires arg parsing → load → discover → emit → write. Verify `build:binary` produces a standalone executable.
49
+ - Files: `syncdb/src/codegen/cli.ts`, `syncdb/src/codegen/cli.test.ts`
50
50
  - Depends on: Task 3.3
51
- - Acceptance: `terreno-syncdb-codegen --schema fixtures/openapi.example.json --out /tmp/out.ts` succeeds; missing required args print usage and exit 1; compiled binary output matches bin output byte-for-byte.
51
+ - Acceptance: missing required args print usage and exit 1; `--schema` fixture write succeeds.
52
52
 
53
53
  ## Phase 4: Integration and docs
54
54
 
55
- - [ ] **Task 4.1**: example-frontend integration
56
- - Description: Add `sync-sdk` script and `syncdb-codegen.json`, check in generated `store/syncDbSdk.ts`, source `SYNC_COLLECTIONS` from it in `store/syncdb.ts`, and migrate `SyncTodosScreen` to the generated hooks (`useGetTodosQuery`, `usePostTodosMutation`, `usePatchTodosByIdMutation`, `useDeleteTodosByIdMutation`; delete the local `SyncTodo` interface). Imports come from `@/store/syncDbSdk` — never re-export these alongside `openApiSdk.ts` from a shared barrel, since the names intentionally collide.
57
- - Files: `example-frontend/package.json`, `example-frontend/syncdb-codegen.json` (new), `example-frontend/store/syncDbSdk.ts` (generated), `example-frontend/store/syncdb.ts`, `example-frontend/components/SyncTodosScreen.tsx`
55
+ - [x] **Task 4.1**: example-frontend integration
56
+ - Description: Add `sync-sdk` script and `syncdb-codegen.json`, check in generated `store/syncDbSdk.ts` (todos collection only), source `SYNC_COLLECTIONS` from it in `store/syncdb.ts`, and migrate `SyncTodosScreen` to generated `useTodo` / `useCreateTodo` / `useUpdateTodo` / `useDeleteTodo` (keep `useEntityIds` for list virtualization).
57
+ - Files: `example-frontend/package.json`, `example-frontend/syncdb-codegen.json`, `example-frontend/store/syncDbSdk.ts`, `example-frontend/store/syncdb.ts`, `example-frontend/components/SyncTodosScreen.tsx`
58
58
  - Depends on: Task 1.2, Task 3.4
59
- - Acceptance: `bun run sync-sdk` regenerates with no diff against an unchanged backend; syncdb Playwright e2e suite passes; `compile` passes.
59
+ - Acceptance: generated hooks are the screen's mutate/read path; `SYNC_COLLECTIONS` feeds `createSyncDb`.
60
60
 
61
- - [ ] **Task 4.2**: Documentation
62
- - Description: Codegen section in `syncdb/README.md`, new `syncdb-codegen/README.md` (args, config format, custom-hooks pattern via `createCollectionHooks`), and a note in the RTK migration guide pointing at generated hooks.
63
- - Files: `syncdb/README.md`, `syncdb-codegen/README.md` (new), `docs/how-to/migrate-rtk-to-syncdb.md`
61
+ - [x] **Task 4.2**: Documentation
62
+ - Description: Codegen section in `syncdb/README.md` and `docs/reference/syncdb.md`, plus the RTK migration guide mapping.
63
+ - Files: `syncdb/README.md`, `docs/how-to/migrate-rtk-to-syncdb.md`, `docs/reference/syncdb.md`
64
64
  - Depends on: Task 4.1
65
- - Acceptance: docs cover install, generation, custom hooks, and retries overrides; examples compile as written.
65
+ - Acceptance: docs cover generation, custom hooks, retries overrides, and friendly names.
66
+
67
+ - [x] **Task 4.3**: npm publish
68
+ - Description: Codegen ships inside `@terreno/syncdb`. Do not add `publish-syncdb-codegen` or a second package.
69
+ - Files: none
70
+ - Depends on: Task 3.1
71
+ - Acceptance: no new workspace package; existing `publish-syncdb` covers the bin.
@@ -1,5 +1,7 @@
1
1
  # Task List: Upgrade Banner
2
2
 
3
+ **Status:** Closed (2026-08-20) — IP complete. Shipped via `VersionCheckPlugin`, `AdminVersionConfig`, `useUpgradeCheck`, and `UpgradeRequiredScreen`. Open tasks below were not executed.
4
+
3
5
  *Structured task breakdown for automated implementation. Each task should be independently implementable and testable.*
4
6
 
5
7
  ## Phase 1: Backend + Admin
@@ -1,73 +0,0 @@
1
- # Implementation plan index
2
-
3
- Tracks active and completed implementation plans (IP) for Terreno. File paths are relative to `docs/implementationPlans/`.
4
-
5
- ## Programs
6
-
7
- Umbrella plans that coordinate several IPs.
8
-
9
- | Program | Status | Created | IPs |
10
- |---------|--------|---------|-----|
11
- | [Open source launch](oss-launch-program.md) | Draft — decisions recorded; Vercel spike open | 2026-07-27 | 15 |
12
-
13
- ## Active
14
-
15
- | Plan | Status | Created | Tasks |
16
- |------|--------|---------|-------|
17
- | [Migrate CI/CD to CircleCI](migrate-cicd-to-circleci.md) | Draft — decisions recorded | 2026-08-17 | [tasks](../tasks/migrate-cicd-to-circleci.md) |
18
- | [Admin UI v2 — Django-parity admin](admin-ui-v2-django-parity.md) | Approved | 2026-06-15 | [tasks](../tasks/admin-ui-v2-django-parity.md) |
19
- | [@terreno/syncdb-codegen](syncdb-codegen.md) | Draft | 2026-07-08 | [tasks](../tasks/syncdb-codegen.md) |
20
- | [SyncDB local-first data layer (v2)](syncdb-local-first.md) | In progress — Phases 1–8 landed, Phase 9 follow-ups open | 2026-06-23 | [tasks](../tasks/syncdb-local-first.md) |
21
- | [SyncDB hardening (syncdb-2)](terreno-syncdb-2.md) | Implemented — Phases A–F landed; deviations carried into Phase 9 | 2026-07-11 | [tasks](../tasks/syncdb-local-first.md) (Phase 8/9) |
22
- | [SyncDB Phase C design](syncdb-phase-c-design.md) | Implemented — design authority for C1–C8 | 2026-07-11 | [tasks](../tasks/syncdb-local-first.md) (Phase 8) |
23
-
24
- ## Completed
25
-
26
- | Plan | Status | Created | Tasks |
27
- |------|--------|---------|-------|
28
- | [APIError redesign — standards-first extension of Error](apierror-standard-error-redesign.md) | Complete | 2026-07-28 | n/a |
29
-
30
- ## Deferred / Closed
31
-
32
- *(Plans parked or superseded.)*
33
-
34
- ## Backlog
35
-
36
- *(Links to ideas not yet promoted to a full IP.)*
37
-
38
- | Idea | Notes |
39
- |------|-------|
40
- | [Langfuse integration](terreno-langfuse-integration.md) | AI observability plugin |
41
- | [modelRouter MCP tools](model-router-mcp.md) | MCP surface for consumer app APIs |
42
- | [Offline mode](offline-mode.md) | Superseded in large part by [syncdb](syncdb-local-first.md) — confirm and close |
43
- | [modelRouter actions](model-router-actions.md) | — |
44
- | [B2B platform](b2b-platform-program.md) | Draft — decisions D1–D7 resolved | 2026-08-09 | 10 written (+ [rbac-permissions](rbac-permissions.md)); 30 roadmap items seeded |
45
- | [RBAC Permissions](rbac-permissions.md) | Draft (API design) | 2026-07-08 | TBD |
46
- | [SyncDB Local-First Data Layer](syncdb-local-first.md) | In progress ([PR #869](https://github.com/flourishhealth/terreno/pull/869)) | 2026-07-13 | [tasks](../tasks/syncdb-local-first.md) |
47
- | [MCP Boost parity](mcp-boost-parity.md) | In progress ([PR #802](https://github.com/flourishhealth/terreno/pull/802)) | 2026-06-21 | TBD |
48
- | [Infrastructure MCP server](infra-mcp.md) | Draft — blocked on [RBAC](rbac-permissions.md) | 2026-08-09 | [tasks](../tasks/infra-mcp.md) |
49
- | [OSS governance baseline](oss-governance-baseline.md) | Draft | None | [tasks](../tasks/oss-governance-baseline.md) |
50
- | [Public roadmap on GitHub](public-roadmap-github.md) | Draft | None | [tasks](../tasks/public-roadmap-github.md) |
51
- | [Deploy to GCP (generalized)](deploy-to-gcp.md) | Draft | None | [tasks](../tasks/deploy-to-gcp.md) |
52
- | [Agentic SDLC plugin (`/terreno-*`)](agentic-sdlc-plugin.md) | Draft | Partial | [tasks](../tasks/agentic-sdlc-plugin.md) |
53
- | [RTK deprecation and syncdb migration docs](rtk-to-syncdb-migration-docs.md) | Draft | **Blocked** (gating IP) | [tasks](../tasks/rtk-to-syncdb-migration-docs.md) |
54
- | [Positioning — Django/Rails for TypeScript](positioning-django-rails-universal.md) | Draft | Partial | [tasks](../tasks/positioning-django-rails-universal.md) |
55
- | [Reference documentation coverage](docs-reference-coverage.md) | Draft | Blocked | [tasks](../tasks/docs-reference-coverage.md) |
56
- | [AI-first tutorials](docs-tutorials-ai-first.md) | Draft | Blocked | [tasks](../tasks/docs-tutorials-ai-first.md) |
57
- | [Deployment foundation](deployment-foundation.md) | Draft | Partial | [tasks](../tasks/deployment-foundation.md) |
58
- | [Deploy to Vercel](deploy-to-vercel.md) | Draft | Partial | [tasks](../tasks/deploy-to-vercel.md) |
59
- | [Upgrade guides and skill](upgrade-guides-and-skill.md) | Draft | Blocked | [tasks](../tasks/upgrade-guides-and-skill.md) |
60
- | [The AI development loop (Boost)](ai-dev-loop-boost.md) | Draft | Partial | [tasks](../tasks/ai-dev-loop-boost.md) |
61
- | [Dogfooding run and launch blog post](build-terreno-app-validation.md) | Draft | Blocked | [tasks](../tasks/build-terreno-app-validation.md) |
62
- | [Examples, demo, and test coverage](examples-demo-coverage.md) | Draft | Partial | [tasks](../tasks/examples-demo-coverage.md) |
63
- | [Web SSR and admin SPA](web-ssr-and-admin-spa.md) | Draft | Partial | [tasks](../tasks/web-ssr-and-admin-spa.md) |
64
- | [Pluggable communications layer (@terreno/comms)](comms-abstraction.md) | Draft | None | [tasks](../tasks/comms-abstraction.md) |
65
- | [Comms adapter — Expo push](comms-adapter-expo-push.md) | Draft | None | [tasks](../tasks/comms-adapter-expo-push.md) |
66
- | [Comms adapter — Twilio SMS](comms-adapter-twilio-sms.md) | Draft | None | [tasks](../tasks/comms-adapter-twilio-sms.md) |
67
- | [Comms adapter — Twilio Verify (OTP)](comms-adapter-twilio-verify.md) | Draft | None | [tasks](../tasks/comms-adapter-twilio-verify.md) |
68
- | [Comms adapter — SendGrid email](comms-adapter-sendgrid.md) | Draft | None | [tasks](../tasks/comms-adapter-sendgrid.md) |
69
- | [Comms admin dashboard (errors, retries, log digging)](comms-admin-dashboard.md) | Draft | Partial | [tasks](../tasks/comms-admin-dashboard.md) |
70
- | [Password reset and email verification](password-reset-and-email-verification.md) | Draft | None | [tasks](../tasks/password-reset-and-email-verification.md) |
71
- | [Organizations, teams, and multi-tenant scoping](orgs-and-teams.md) | Draft | None | [tasks](../tasks/orgs-and-teams.md) |
72
- | [Stripe billing and subscriptions](billing-stripe.md) | Draft | None | [tasks](../tasks/billing-stripe.md) |
73
- | [Native module baseline (next major)](native-module-baseline.md) | Draft | None | [tasks](../tasks/native-module-baseline.md) |