@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.
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +381 -191
- package/dist/bootstrap.js.map +1 -1
- package/dist/docs/guidelines/api/skills/mongoose-schema-safety/SKILL.md +8 -0
- package/dist/docs/resources/overview.md +6 -1
- package/dist/docs/resources/rtk.md +3 -1
- package/dist/docs/resources/syncdb.md +43 -0
- package/dist/docs/upgrades/56.0.0-beta.2.md +34 -0
- package/dist/docs/upgrades/57.0.0.md +49 -0
- package/dist/docs/upgrades/57.1.0.md +126 -0
- package/dist/docs/versioned/next/README.md +15 -3
- package/dist/docs/versioned/next/explanation/README.md +3 -0
- package/dist/docs/versioned/next/explanation/admin-consent-migration.md +15 -0
- package/dist/docs/versioned/next/explanation/admin-plugin-frontend.md +12 -0
- package/dist/docs/versioned/next/explanation/announcements/rtk-deprecation.md +29 -0
- package/dist/docs/versioned/next/explanation/authentication.md +51 -58
- package/dist/docs/versioned/next/explanation/local-first-data.md +52 -0
- package/dist/docs/versioned/next/explanation/loop-engineering.md +117 -0
- package/dist/docs/versioned/next/explanation/repository-settings.md +8 -0
- package/dist/docs/versioned/next/explanation/roadmap-process.md +22 -9
- package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +39 -0
- package/dist/docs/versioned/next/how-to/README.md +3 -0
- package/dist/docs/versioned/next/how-to/admin-add-model.md +41 -0
- package/dist/docs/versioned/next/how-to/admin-custom-home.md +31 -0
- package/dist/docs/versioned/next/how-to/admin-custom-widget.md +42 -0
- package/dist/docs/versioned/next/how-to/admin-import-prebuilt.md +25 -0
- package/dist/docs/versioned/next/how-to/circleci.md +173 -0
- package/dist/docs/versioned/next/how-to/configure-better-auth.md +13 -10
- package/dist/docs/versioned/next/how-to/expose-mcp-tools.md +194 -0
- package/dist/docs/versioned/next/how-to/install-agent-skills.md +46 -0
- package/dist/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +26 -1
- package/dist/docs/versioned/next/how-to/websocket-integration.md +2 -1
- package/dist/docs/versioned/next/implementationPlans/ModularAPI.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/README.md +31 -17
- package/dist/docs/versioned/next/implementationPlans/admin-improvements-research.md +136 -0
- package/dist/docs/versioned/next/implementationPlans/admin-improvements.md +157 -527
- package/dist/docs/versioned/next/implementationPlans/admin-only-research.md +4 -0
- package/dist/docs/versioned/next/implementationPlans/admin-only.md +3 -1
- package/dist/docs/versioned/next/implementationPlans/admin-script-runner.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/admin-ui-v2-django-parity.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/agentic-sdlc-plugin.md +160 -130
- package/dist/docs/versioned/next/implementationPlans/apierror-standard-error-redesign.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/b2b-platform-program.md +5 -4
- package/dist/docs/versioned/next/implementationPlans/comms-abstraction-research.md +48 -0
- package/dist/docs/versioned/next/implementationPlans/comms-abstraction.md +152 -62
- package/dist/docs/versioned/next/implementationPlans/comms-adapter-sendgrid.md +9 -9
- package/dist/docs/versioned/next/implementationPlans/comms-admin-dashboard.md +1 -1
- package/dist/docs/versioned/next/implementationPlans/consent-forms.md +4 -0
- package/dist/docs/versioned/next/implementationPlans/design-blend-skill.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/docs-site-and-versioning.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/feature-flags-openfeature.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/feature-flags.md +4 -0
- package/dist/docs/versioned/next/implementationPlans/infra-mcp-research.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/infra-mcp.md +3 -3
- package/dist/docs/versioned/next/implementationPlans/mcp-boost-parity.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci-research.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci.md +2 -2
- package/dist/docs/versioned/next/implementationPlans/model-router-actions.md +4 -0
- package/dist/docs/versioned/next/implementationPlans/model-router-mcp.md +5 -4
- package/dist/docs/versioned/next/implementationPlans/offline-mode.md +3 -1
- package/dist/docs/versioned/next/implementationPlans/oss-launch-program.md +11 -2
- package/dist/docs/versioned/next/implementationPlans/pluggable-database-sqlite-research.md +150 -0
- package/dist/docs/versioned/next/implementationPlans/pluggable-database-sqlite.md +247 -0
- package/dist/docs/versioned/next/implementationPlans/positioning-django-rails-universal.md +1 -1
- package/dist/docs/versioned/next/implementationPlans/public-roadmap-github.md +2 -2
- package/dist/docs/versioned/next/implementationPlans/rbac-permissions.md +52 -15
- package/dist/docs/versioned/next/implementationPlans/rtk-to-syncdb-migration-docs.md +13 -12
- package/dist/docs/versioned/next/implementationPlans/syncdb-codegen-research.md +137 -0
- package/dist/docs/versioned/next/implementationPlans/syncdb-codegen.md +63 -59
- package/dist/docs/versioned/next/implementationPlans/syncdb-local-first.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/syncdb-phase-c-design.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/terreno-langfuse-integration.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/terreno-syncdb-2.md +1 -0
- package/dist/docs/versioned/next/implementationPlans/upgrade-banner.md +4 -0
- package/dist/docs/versioned/next/reference/README.md +6 -1
- package/dist/docs/versioned/next/reference/admin-config.md +51 -0
- package/dist/docs/versioned/next/reference/ai.md +15 -1
- package/dist/docs/versioned/next/reference/api.md +18 -0
- package/dist/docs/versioned/next/reference/comms.md +88 -7
- package/dist/docs/versioned/next/reference/environment-variables.md +9 -1
- package/dist/docs/versioned/next/reference/{rtk.md → legacy/rtk.md} +11 -7
- package/dist/docs/versioned/next/reference/lifecycle-plugin.md +54 -0
- package/dist/docs/versioned/next/reference/mcp-server.md +7 -0
- package/dist/docs/versioned/next/reference/syncdb.md +30 -3
- package/dist/docs/versioned/next/tasks/README.md +21 -10
- package/dist/docs/versioned/next/tasks/admin-improvements.md +189 -353
- package/dist/docs/versioned/next/tasks/admin-only.md +2 -0
- package/dist/docs/versioned/next/tasks/agentic-sdlc-plugin.md +54 -160
- package/dist/docs/versioned/next/tasks/comms-abstraction.md +30 -24
- package/dist/docs/versioned/next/tasks/comms-adapter-sendgrid.md +4 -4
- package/dist/docs/versioned/next/tasks/consent-forms.md +2 -0
- package/dist/docs/versioned/next/tasks/feature-flags.md +2 -0
- package/dist/docs/versioned/next/tasks/migrate-cicd-to-circleci.md +14 -10
- package/dist/docs/versioned/next/tasks/model-router-actions.md +2 -0
- package/dist/docs/versioned/next/tasks/model-router-mcp.md +27 -27
- package/dist/docs/versioned/next/tasks/offline-mode.md +2 -0
- package/dist/docs/versioned/next/tasks/pluggable-database-sqlite.md +44 -0
- package/dist/docs/versioned/next/tasks/public-roadmap-github.md +1 -1
- package/dist/docs/versioned/next/tasks/rtk-to-syncdb-migration-docs.md +15 -15
- package/dist/docs/versioned/next/tasks/syncdb-codegen.md +37 -31
- package/dist/docs/versioned/next/tasks/upgrade-banner.md +2 -0
- package/dist/index.js +24 -55
- package/dist/index.js.map +1 -1
- package/dist/local/localServer.d.ts.map +1 -1
- package/dist/local/localServer.js +9 -8
- package/dist/local/localServer.js.map +1 -1
- package/dist/local/localTools.d.ts +1 -1
- package/dist/local/localTools.d.ts.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +44 -45
- package/dist/prompts.js.map +1 -1
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +9 -2
- package/dist/resources.js.map +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +4 -2
- package/dist/tools.js.map +1 -1
- package/package.json +7 -3
- package/src/docs/guidelines/api/skills/mongoose-schema-safety/SKILL.md +8 -0
- package/src/docs/resources/overview.md +6 -1
- package/src/docs/resources/rtk.md +3 -1
- package/src/docs/resources/syncdb.md +43 -0
- package/src/docs/upgrades/56.0.0-beta.2.md +34 -0
- package/src/docs/upgrades/57.0.0.md +49 -0
- package/src/docs/upgrades/57.1.0.md +126 -0
- package/src/docs/versioned/next/README.md +15 -3
- package/src/docs/versioned/next/explanation/README.md +3 -0
- package/src/docs/versioned/next/explanation/admin-consent-migration.md +15 -0
- package/src/docs/versioned/next/explanation/admin-plugin-frontend.md +12 -0
- package/src/docs/versioned/next/explanation/announcements/rtk-deprecation.md +29 -0
- package/src/docs/versioned/next/explanation/authentication.md +51 -58
- package/src/docs/versioned/next/explanation/local-first-data.md +52 -0
- package/src/docs/versioned/next/explanation/loop-engineering.md +117 -0
- package/src/docs/versioned/next/explanation/repository-settings.md +8 -0
- package/src/docs/versioned/next/explanation/roadmap-process.md +22 -9
- package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +39 -0
- package/src/docs/versioned/next/how-to/README.md +3 -0
- package/src/docs/versioned/next/how-to/admin-add-model.md +41 -0
- package/src/docs/versioned/next/how-to/admin-custom-home.md +31 -0
- package/src/docs/versioned/next/how-to/admin-custom-widget.md +42 -0
- package/src/docs/versioned/next/how-to/admin-import-prebuilt.md +25 -0
- package/src/docs/versioned/next/how-to/circleci.md +173 -0
- package/src/docs/versioned/next/how-to/configure-better-auth.md +13 -10
- package/src/docs/versioned/next/how-to/expose-mcp-tools.md +194 -0
- package/src/docs/versioned/next/how-to/install-agent-skills.md +46 -0
- package/src/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +26 -1
- package/src/docs/versioned/next/how-to/websocket-integration.md +2 -1
- package/src/docs/versioned/next/implementationPlans/ModularAPI.md +1 -0
- package/src/docs/versioned/next/implementationPlans/README.md +31 -17
- package/src/docs/versioned/next/implementationPlans/admin-improvements-research.md +136 -0
- package/src/docs/versioned/next/implementationPlans/admin-improvements.md +157 -527
- package/src/docs/versioned/next/implementationPlans/admin-only-research.md +4 -0
- package/src/docs/versioned/next/implementationPlans/admin-only.md +3 -1
- package/src/docs/versioned/next/implementationPlans/admin-script-runner.md +1 -0
- package/src/docs/versioned/next/implementationPlans/admin-ui-v2-django-parity.md +1 -0
- package/src/docs/versioned/next/implementationPlans/agentic-sdlc-plugin.md +160 -130
- package/src/docs/versioned/next/implementationPlans/apierror-standard-error-redesign.md +1 -0
- package/src/docs/versioned/next/implementationPlans/b2b-platform-program.md +5 -4
- package/src/docs/versioned/next/implementationPlans/comms-abstraction-research.md +48 -0
- package/src/docs/versioned/next/implementationPlans/comms-abstraction.md +152 -62
- package/src/docs/versioned/next/implementationPlans/comms-adapter-sendgrid.md +9 -9
- package/src/docs/versioned/next/implementationPlans/comms-admin-dashboard.md +1 -1
- package/src/docs/versioned/next/implementationPlans/consent-forms.md +4 -0
- package/src/docs/versioned/next/implementationPlans/design-blend-skill.md +1 -0
- package/src/docs/versioned/next/implementationPlans/docs-site-and-versioning.md +1 -0
- package/src/docs/versioned/next/implementationPlans/feature-flags-openfeature.md +1 -0
- package/src/docs/versioned/next/implementationPlans/feature-flags.md +4 -0
- package/src/docs/versioned/next/implementationPlans/infra-mcp-research.md +1 -0
- package/src/docs/versioned/next/implementationPlans/infra-mcp.md +3 -3
- package/src/docs/versioned/next/implementationPlans/mcp-boost-parity.md +1 -0
- package/src/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci-research.md +1 -0
- package/src/docs/versioned/next/implementationPlans/migrate-cicd-to-circleci.md +2 -2
- package/src/docs/versioned/next/implementationPlans/model-router-actions.md +4 -0
- package/src/docs/versioned/next/implementationPlans/model-router-mcp.md +5 -4
- package/src/docs/versioned/next/implementationPlans/offline-mode.md +3 -1
- package/src/docs/versioned/next/implementationPlans/oss-launch-program.md +11 -2
- package/src/docs/versioned/next/implementationPlans/pluggable-database-sqlite-research.md +150 -0
- package/src/docs/versioned/next/implementationPlans/pluggable-database-sqlite.md +247 -0
- package/src/docs/versioned/next/implementationPlans/positioning-django-rails-universal.md +1 -1
- package/src/docs/versioned/next/implementationPlans/public-roadmap-github.md +2 -2
- package/src/docs/versioned/next/implementationPlans/rbac-permissions.md +52 -15
- package/src/docs/versioned/next/implementationPlans/rtk-to-syncdb-migration-docs.md +13 -12
- package/src/docs/versioned/next/implementationPlans/syncdb-codegen-research.md +137 -0
- package/src/docs/versioned/next/implementationPlans/syncdb-codegen.md +63 -59
- package/src/docs/versioned/next/implementationPlans/syncdb-local-first.md +1 -0
- package/src/docs/versioned/next/implementationPlans/syncdb-phase-c-design.md +1 -0
- package/src/docs/versioned/next/implementationPlans/terreno-langfuse-integration.md +1 -0
- package/src/docs/versioned/next/implementationPlans/terreno-syncdb-2.md +1 -0
- package/src/docs/versioned/next/implementationPlans/upgrade-banner.md +4 -0
- package/src/docs/versioned/next/reference/README.md +6 -1
- package/src/docs/versioned/next/reference/admin-config.md +51 -0
- package/src/docs/versioned/next/reference/ai.md +15 -1
- package/src/docs/versioned/next/reference/api.md +18 -0
- package/src/docs/versioned/next/reference/comms.md +88 -7
- package/src/docs/versioned/next/reference/environment-variables.md +9 -1
- package/src/docs/versioned/next/reference/{rtk.md → legacy/rtk.md} +11 -7
- package/src/docs/versioned/next/reference/lifecycle-plugin.md +54 -0
- package/src/docs/versioned/next/reference/mcp-server.md +7 -0
- package/src/docs/versioned/next/reference/syncdb.md +30 -3
- package/src/docs/versioned/next/tasks/README.md +21 -10
- package/src/docs/versioned/next/tasks/admin-improvements.md +189 -353
- package/src/docs/versioned/next/tasks/admin-only.md +2 -0
- package/src/docs/versioned/next/tasks/agentic-sdlc-plugin.md +54 -160
- package/src/docs/versioned/next/tasks/comms-abstraction.md +30 -24
- package/src/docs/versioned/next/tasks/comms-adapter-sendgrid.md +4 -4
- package/src/docs/versioned/next/tasks/consent-forms.md +2 -0
- package/src/docs/versioned/next/tasks/feature-flags.md +2 -0
- package/src/docs/versioned/next/tasks/migrate-cicd-to-circleci.md +14 -10
- package/src/docs/versioned/next/tasks/model-router-actions.md +2 -0
- package/src/docs/versioned/next/tasks/model-router-mcp.md +27 -27
- package/src/docs/versioned/next/tasks/offline-mode.md +2 -0
- package/src/docs/versioned/next/tasks/pluggable-database-sqlite.md +44 -0
- package/src/docs/versioned/next/tasks/public-roadmap-github.md +1 -1
- package/src/docs/versioned/next/tasks/rtk-to-syncdb-migration-docs.md +15 -15
- package/src/docs/versioned/next/tasks/syncdb-codegen.md +37 -31
- package/src/docs/versioned/next/tasks/upgrade-banner.md +2 -0
- package/dist/docs/versioned/next/implementationPlans/PLAN_INDEX.md +0 -73
- package/dist/docs/versioned/next/implementationPlans/syncdb-api-inventory.md +0 -303
- package/src/docs/versioned/next/implementationPlans/PLAN_INDEX.md +0 -73
- package/src/docs/versioned/next/implementationPlans/syncdb-api-inventory.md +0 -303
|
@@ -38,6 +38,40 @@ encrypted web persistence). Install as `@terreno/syncdb@beta` (or the exact vers
|
|
|
38
38
|
`@terreno/syncdb` does not replace the generated OpenAPI SDK, Better Auth wiring, or
|
|
39
39
|
feature flags — only collection sync/CRUD offline paths.
|
|
40
40
|
|
|
41
|
+
## `@terreno/rtk` deprecated for data sync
|
|
42
|
+
|
|
43
|
+
As of **56.0.0**, RTK Query hooks for **collection CRUD** are deprecated. Migrate to
|
|
44
|
+
`@terreno/syncdb` using the migration guide above. Keep `@terreno/rtk` for:
|
|
45
|
+
|
|
46
|
+
- `bun run sdk` / `store/openApiSdk.ts` (non-synced routes)
|
|
47
|
+
- Better Auth session Redux (`generateBetterAuthSlice`)
|
|
48
|
+
- Feature flags and socket helpers
|
|
49
|
+
|
|
50
|
+
`@terreno/rtk` remains published through the current major line and will not ship in the
|
|
51
|
+
next major release.
|
|
52
|
+
|
|
53
|
+
### Read hook (before → after)
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// Before — RTK Query
|
|
57
|
+
const {data, isLoading} = useGetTodosQuery({completed: false});
|
|
58
|
+
|
|
59
|
+
// After — syncdb
|
|
60
|
+
const todos = useQuery<Todo>("todos", {filter: (t) => !t.completed});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Write hook (before → after)
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// Before — RTK Query
|
|
67
|
+
const [createTodo, {isLoading}] = usePostTodosMutation();
|
|
68
|
+
await createTodo({title, completed: false}).unwrap();
|
|
69
|
+
|
|
70
|
+
// After — syncdb
|
|
71
|
+
const {create} = useMutate("todos");
|
|
72
|
+
create({data: {title, completed: false}});
|
|
73
|
+
```
|
|
74
|
+
|
|
41
75
|
## `excludeArchivedPlugin` now filters `findOne`
|
|
42
76
|
|
|
43
77
|
`excludeArchivedPlugin` applies the same archived filter to `findOne` that it already
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 57.0.0
|
|
2
|
+
|
|
3
|
+
First stable release of the Expo SDK 57 line. Packages publish to the npm `latest`
|
|
4
|
+
dist-tag. Apps that are not ready to upgrade Expo should stay on the `0.x` line
|
|
5
|
+
(`npm install @terreno/ui@0.31.0` or your current pin).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @terreno/ui @terreno/api @terreno/rtk
|
|
9
|
+
# optional local-first data layer
|
|
10
|
+
bun add @terreno/syncdb
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Upgrade Expo before Terreno
|
|
14
|
+
|
|
15
|
+
This line targets Expo SDK 57. Upgrade the app first, then bump `@terreno/*`:
|
|
16
|
+
|
|
17
|
+
| Package | Version |
|
|
18
|
+
|---------|---------|
|
|
19
|
+
| `expo` | `~57.0.14` |
|
|
20
|
+
| `react-native` | `0.86.2` |
|
|
21
|
+
| `react` | `19.2.3` |
|
|
22
|
+
| `typescript` | `~6.0.3` |
|
|
23
|
+
|
|
24
|
+
Follow Expo's SDK 57 upgrade guide, then bump `@terreno/*` to `57.0.0`.
|
|
25
|
+
Run `npx expo install expo@latest --fix` at the app root, rebuild native binaries, then
|
|
26
|
+
`bun run compile` / `bun run lint`. Regenerate the OpenAPI SDK after any `@terreno/api`
|
|
27
|
+
surface change (`bun run sdk` in the frontend).
|
|
28
|
+
|
|
29
|
+
Terreno's version major now tracks the Expo SDK major. There is no in-place semver path
|
|
30
|
+
from `0.x` or `56.x` across Expo SDK majors — treat this as an Expo upgrade plus a
|
|
31
|
+
Terreno major bump.
|
|
32
|
+
|
|
33
|
+
## `@terreno/syncdb` and TinyBase 9.5
|
|
34
|
+
|
|
35
|
+
`@terreno/syncdb` depends on `tinybase` `^9.5.1` for Expo SDK 57 / `expo-sqlite` type
|
|
36
|
+
compatibility. Apps using syncdb should reinstall and re-run sync integration tests after
|
|
37
|
+
upgrading Expo.
|
|
38
|
+
|
|
39
|
+
## From `57.0.0-beta.1`
|
|
40
|
+
|
|
41
|
+
If you already validated on the beta line, bump the exact version from `57.0.0-beta.1` to
|
|
42
|
+
`57.0.0` (or drop the `@beta` dist-tag). No additional code changes are required beyond
|
|
43
|
+
rebuilding native binaries if you changed Expo during the beta period.
|
|
44
|
+
|
|
45
|
+
## From `0.x` or `56.x`
|
|
46
|
+
|
|
47
|
+
Stay on your current Terreno major until the app runs on Expo SDK 57. Backend-only apps
|
|
48
|
+
can often stay on `0.x` longer; frontend packages (`ui`, `rtk`, `admin-frontend`,
|
|
49
|
+
`admin-spa`, `syncdb`) require the matching Expo major.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# 57.1.0
|
|
2
|
+
|
|
3
|
+
Terreno packages move in lockstep. Bump every `@terreno/*` dependency to `57.1.0`, then:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun add @terreno/ui @terreno/api @terreno/rtk
|
|
7
|
+
# optional
|
|
8
|
+
bun add @terreno/syncdb @terreno/admin-frontend @terreno/comms
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- `bun run compile` and `bun run lint` at the app root
|
|
12
|
+
- `cd <your frontend> && bun run sdk` after any `@terreno/api` route or model surface change
|
|
13
|
+
|
|
14
|
+
This is a minor on the Expo SDK 57 line. No Expo upgrade is required if you are already on `57.0.0`.
|
|
15
|
+
|
|
16
|
+
## `@terreno/rtk` data sync is deprecated
|
|
17
|
+
|
|
18
|
+
Collection CRUD through `@terreno/rtk` is deprecated (first called out for `56.0.0`). The package still publishes through this major and remains required for the OpenAPI SDK, Better Auth Redux, feature flags, and sockets. It will not ship in the next major.
|
|
19
|
+
|
|
20
|
+
Migrate collection screens to [`@terreno/syncdb`](../../../docs/reference/syncdb.md) using [migrate-rtk-to-syncdb.md](../../../docs/how-to/migrate-rtk-to-syncdb.md). New apps from `terreno_bootstrap_app` now scaffold Better Auth + syncdb instead of JWT `generateAuthSlice`.
|
|
21
|
+
|
|
22
|
+
Typed collection hooks can be generated with the `terreno-syncdb-codegen` bin of `@terreno/syncdb` (not a separate package):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bunx terreno-syncdb-codegen --schema http://localhost:4000/openapi.json --out store/syncDbSdk.ts
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## RBAC (`@terreno/api`)
|
|
29
|
+
|
|
30
|
+
RBAC is opt-in. If you do not call `createAccess` / `accessControl`, skip this section except the `RbacRoleModel` singleton removal if you imported those names.
|
|
31
|
+
|
|
32
|
+
### Register models on your connection
|
|
33
|
+
|
|
34
|
+
Importing `@terreno/api` no longer registers `RbacRole` / `RbacAudit` on the default mongoose connection. The `RbacRoleModel` / `RbacAuditModel` **value** singletons are gone; the `RbacRoleModel` **type** remains.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// Before
|
|
38
|
+
import {RbacRoleModel} from "@terreno/api";
|
|
39
|
+
await RbacRoleModel.find();
|
|
40
|
+
|
|
41
|
+
// After
|
|
42
|
+
import {createAccess, createRbacRoleModel} from "@terreno/api";
|
|
43
|
+
import mongoose from "mongoose";
|
|
44
|
+
|
|
45
|
+
const access = createAccess({
|
|
46
|
+
connection: mongoose.connection,
|
|
47
|
+
statements: appStatements,
|
|
48
|
+
userModel: User,
|
|
49
|
+
});
|
|
50
|
+
// or, in scripts/tests only:
|
|
51
|
+
const RbacRole = createRbacRoleModel(mongoose.connection);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See `example-backend/src/access.ts`.
|
|
55
|
+
|
|
56
|
+
### Fail closed
|
|
57
|
+
|
|
58
|
+
- `createView: "deny"` and unknown field-view names deny instead of granting a full mask.
|
|
59
|
+
- Nested omits clone documents; write masks honor dotted paths; bulk create and array mutations use the same write mask as single-document writes.
|
|
60
|
+
- Admin CRUD for a resource missing from statements fails closed (list/read, search, and writes).
|
|
61
|
+
- Permission-source refresh with `staleOnFailure: "deny"` (default) keeps last-cached **deny** grants; additive `roles` / `permissions` from that source are omitted.
|
|
62
|
+
|
|
63
|
+
If a previously unknown view name silently allowed a full mask, tighten statements or name the view.
|
|
64
|
+
|
|
65
|
+
### AdminApp + `admin:access`
|
|
66
|
+
|
|
67
|
+
`admin:access` is no longer enough for model CRUD. Each resource needs its list/read/create/update/delete actions. Framework statements now include `featureFlag`, `consentForm`, and `consentResponse`.
|
|
68
|
+
|
|
69
|
+
| Action | Required permission |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| Admin model CRUD | Resource verb **and** `admin:access` |
|
|
72
|
+
| `POST /admin/background-tasks` | `admin:runScripts` |
|
|
73
|
+
| Version-config GET / PUT | `configuration:read` / `configuration:update` |
|
|
74
|
+
| Change User `admin` (RBAC on) | `rbac:assignRoles` **and** an actor who already has the legacy admin flag (`rbac:manageRoles` is not a substitute) |
|
|
75
|
+
| Assign / unassign roles | Actor already holds the target user's current permissions |
|
|
76
|
+
|
|
77
|
+
The seeded `auditor` role no longer receives `admin:access` from read-only expansion.
|
|
78
|
+
|
|
79
|
+
Without RBAC, admin User CRUD may still set `admin`. With RBAC, `roles` go through `RoleManager.assign`. Echoed unchanged `admin` values on create/update are allowed.
|
|
80
|
+
|
|
81
|
+
### Privilege fields are stripped on self-service writes
|
|
82
|
+
|
|
83
|
+
Signup, `PATCH /auth/me`, and ordinary User modelRouter / sync / MCP writes drop `admin`, `roles`, and `organizationIds`. Change organization membership through a privileged server path, not self-service.
|
|
84
|
+
|
|
85
|
+
`example-backend` `backfillAdmins` is a dry run unless `RBAC_BACKFILL_ADMINS=true`. Live production admin script resets require `ALLOW_ADMIN_DB_RESET=true`.
|
|
86
|
+
|
|
87
|
+
### Custom `modelRouter` actions
|
|
88
|
+
|
|
89
|
+
`runActionPermissions` **combines** legacy `action.permissions` with RBAC (it does not replace them). Actions without `access` inherit the router's `access.resource` and the mapped CRUD verb (`instance` POST → `update`, `collection` POST → `create`). Set `access` on custom actions that must not inherit, or they follow that mapping.
|
|
90
|
+
|
|
91
|
+
MCP and SyncDB registries use TerrenoApp-injected `accessControl` (not pre-build legacy permission arrays). User `roles` on modelRouter writes are dropped when `accessControl` is set.
|
|
92
|
+
|
|
93
|
+
### Audit
|
|
94
|
+
|
|
95
|
+
`RoleManager` writes `RbacAudit` (with `permissionDelta`) on create/update/remove/assign/unassign. HTTP `rbacRouter` no longer writes a second row. Pass `auditSink` (one function or an array) to fan into an app log; `persistAudit: false` skips the built-in collection and then requires at least one sink.
|
|
96
|
+
|
|
97
|
+
Assignment **preview** does not write denied-assign rows. Denied mutation audits are stored only for the escalation `403` (`Cannot grant permissions you do not hold`).
|
|
98
|
+
|
|
99
|
+
## Admin frontend
|
|
100
|
+
|
|
101
|
+
`@terreno/admin-frontend` is now provider-backed: wrap screens in `AdminProvider`, use the widget registry / `AdminScreenRouter`, and prefer `AdminRolesField` / `AdminRolesList` over raw role arrays. The sidebar groups Scripts, Roles, Version, Audit Log, Feature Flags, and Configuration under **Platform**. Empty sections hide.
|
|
102
|
+
|
|
103
|
+
If you still pass the deprecated `customScreens` prop, migrate to the widget registry (`mergeWidgetRegistry`, `BUILT_IN_WIDGET_REGISTRY`).
|
|
104
|
+
|
|
105
|
+
## MCP on `modelRouter`
|
|
106
|
+
|
|
107
|
+
Opt a model in with `mcp` on `modelRouter`. Tools are served at `POST /mcp` with the same permissions, filters, and hooks as REST. Lifecycle hooks receive a stub request from `createMCPRequest` (`isMCPRequest: true`); they do not see forwarded HTTP headers. Register extra tools with `registerMCPTool`. `@terreno/rtk` adds `useMCPTools()` and `useTerrenoChat()`.
|
|
108
|
+
|
|
109
|
+
## Comms
|
|
110
|
+
|
|
111
|
+
Optional `SendGridMailProvider` lives at `@terreno/comms/adapters/sendgrid` (peer `@sendgrid/mail`). Phase 1 hooks: `beforeSend` may mutate or cancel; `onRetry` stays `(context, result)` with `context.attempt`. Push prune treats `errorClass: "permanent"` like `isPermanentFailure`.
|
|
112
|
+
|
|
113
|
+
## `@terreno/ui`
|
|
114
|
+
|
|
115
|
+
React Native Web `shadow*` and `props.pointerEvents` deprecation warnings are fixed inside the library. No app code change is required unless you copied those patterns locally — use `style.pointerEvents` and `boxShadow`.
|
|
116
|
+
|
|
117
|
+
`Host` and `Portal` are exported from `@terreno/ui` (replacing `react-native-portalize`).
|
|
118
|
+
|
|
119
|
+
## Verification
|
|
120
|
+
|
|
121
|
+
- Compile and lint the app against `@terreno/*@57.1.0`.
|
|
122
|
+
- If you imported `RbacRoleModel` as a value, switch to `createAccess` / `createRbacRoleModel`.
|
|
123
|
+
- If RBAC is on, confirm admin list/create still works for each model and that `admin:access`-only roles cannot mutate resources.
|
|
124
|
+
- Confirm signup / `PATCH /auth/me` cannot set `admin`, `roles`, or `organizationIds`.
|
|
125
|
+
- If you use collection RTK Query hooks, start the syncdb migration (see above).
|
|
126
|
+
- Regenerated OpenAPI SDK after enabling `mcp` or new admin/RBAC routes.
|
|
@@ -16,16 +16,28 @@ Documentation for the Terreno monorepo: shared packages for full-stack applicati
|
|
|
16
16
|
|---------|-------------|
|
|
17
17
|
| [@terreno/api](reference/api.md) | REST API framework (Express/Mongoose) |
|
|
18
18
|
| [@terreno/ui](reference/ui.md) | React Native UI component library |
|
|
19
|
-
| [@terreno/rtk](reference/rtk.md) | RTK Query utilities for API backends |
|
|
20
19
|
| [@terreno/syncdb](reference/syncdb.md) | Local-first data layer (offline sync, conflicts) |
|
|
20
|
+
| [@terreno/ai](reference/ai.md) | AI service, GPT routes, request logging |
|
|
21
21
|
| [@terreno/admin-backend](reference/admin-backend.md) | Admin panel backend plugin |
|
|
22
22
|
| [@terreno/admin-frontend](reference/admin-frontend.md) | Admin panel frontend screens |
|
|
23
|
+
| [@terreno/admin-spa](reference/admin-spa.md) | Standalone admin SPA + Express serve plugin |
|
|
23
24
|
| [@terreno/api-health](reference/api-health.md) | Health check endpoint plugin |
|
|
24
|
-
| [@terreno/comms](reference/comms.md) | Pluggable communications providers
|
|
25
|
+
| [@terreno/comms](reference/comms.md) | Pluggable communications providers |
|
|
26
|
+
| [@terreno/feature-flags](reference/feature-flags.md) | Feature flags and A/B testing plugin |
|
|
25
27
|
| [@terreno/mcp](reference/mcp-server.md) | AI coding assistant integration (MCP) |
|
|
28
|
+
| [@terreno/test](reference/test.md) | Bun test helpers and in-memory MongoDB |
|
|
29
|
+
|
|
30
|
+
### Legacy
|
|
31
|
+
|
|
32
|
+
| Package | Description |
|
|
33
|
+
|---------|-------------|
|
|
34
|
+
| [@terreno/rtk](reference/legacy/rtk.md) (deprecated) | RTK Query utilities — superseded by syncdb for data sync; still used for OpenAPI SDK, auth, and feature flags during migration |
|
|
35
|
+
|
|
36
|
+
**Migrating from RTK?** See [How to migrate from @terreno/rtk to @terreno/syncdb](how-to/migrate-rtk-to-syncdb.md).
|
|
26
37
|
|
|
27
38
|
## Quick links
|
|
28
39
|
|
|
29
40
|
- [Getting started](tutorials/getting-started.md)
|
|
41
|
+
- [Local-first data](explanation/local-first-data.md)
|
|
30
42
|
- [AGENTS.md](../AGENTS.md) — Onboarding context for AI assistants
|
|
31
|
-
- [.
|
|
43
|
+
- [ROADMAP.md](../ROADMAP.md) — Public roadmap
|
|
@@ -10,6 +10,9 @@ Understanding-oriented documentation: concepts, architecture, and context.
|
|
|
10
10
|
|
|
11
11
|
## Contents
|
|
12
12
|
|
|
13
|
+
- [Local-first data](local-first-data.md) — Why the local store is the UI source of truth
|
|
14
|
+
- [Loop engineering](loop-engineering.md) — Fresh-invocation lifecycle, state, evidence, and orchestration boundaries
|
|
15
|
+
- [Install agent skills](../how-to/install-agent-skills.md) — `npx skills add FlourishHealth/terreno`
|
|
13
16
|
- [AI-powered workflows](ai-workflows.md) — Autonomous documentation, testing, and maintenance workflows
|
|
14
17
|
- [Authentication architecture](authentication.md) — How JWT, OAuth, and token refresh work
|
|
15
18
|
- [Configuration system](configuration-system.md) — Runtime configuration with database persistence
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Consent admin migration audit
|
|
2
|
+
|
|
3
|
+
The example keeps specialized consent routes where generic model screens do not cover the workflow.
|
|
4
|
+
|
|
5
|
+
| Route file | Disposition | Reason |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `consent-forms/index.tsx` | Keep as a hand-written route | Adds consent-specific list navigation and publishing workflow. |
|
|
8
|
+
| `consent-forms/create.tsx` | Keep as a hand-written route | Uses `ConsentFormEditor` for localized content, AI generation, and consent validation. |
|
|
9
|
+
| `consent-forms/[id].tsx` | Keep as a hand-written route | Supports publish/version behavior beyond generic CRUD editing. |
|
|
10
|
+
| `consent-responses/index.tsx` | Keep as a hand-written route | Presents consent-response-specific navigation. |
|
|
11
|
+
| `consent-responses/[id].tsx` | Keep as a hand-written route | Uses `ConsentResponseViewer` for signatures, snapshots, and audit details. |
|
|
12
|
+
|
|
13
|
+
`ConsentApp.adminContribution()` still contributes generic ConsentForm and ConsentResponse models.
|
|
14
|
+
Those models provide searchable tables and field widgets, while Expo Router gives the explicit
|
|
15
|
+
routes above precedence for the richer consent workflows.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Admin plugin frontend widgets
|
|
2
|
+
|
|
3
|
+
Backend plugins contribute stable widget IDs through `adminContribution()`. Their React
|
|
4
|
+
implementations ship from `@terreno/admin-frontend`, under `src/widgets/`.
|
|
5
|
+
|
|
6
|
+
This keeps the first-party integration in one frontend package and avoids making backend-only
|
|
7
|
+
packages depend on React Native. The built-in registry includes consent field widgets, feature
|
|
8
|
+
flag home widgets, and Documents/AI custom screens. Hosts can override any ID through
|
|
9
|
+
`AdminProvider.widgets`.
|
|
10
|
+
|
|
11
|
+
Third-party plugins should publish their own frontend package and ask the host to spread its
|
|
12
|
+
registry into `AdminProvider`; `@terreno/admin-frontend` only owns first-party Terreno widgets.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# RTK deprecation announcement (draft)
|
|
2
|
+
|
|
3
|
+
**Do not post until maintainers review.** Target: GitHub Discussions → Announcements.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## `@terreno/rtk` data sync is deprecated — migrate to `@terreno/syncdb`
|
|
8
|
+
|
|
9
|
+
Starting with **56.0.0**, Terreno's default frontend data path is **local-first** via [`@terreno/syncdb`](https://github.com/FlourishHealth/terreno/blob/master/docs/reference/syncdb.md). Collection reads and writes apply to an on-device store first; the server reconciles over the sync protocol. This replaces RTK Query hooks for CRUD lists and mutations.
|
|
10
|
+
|
|
11
|
+
### What changed
|
|
12
|
+
|
|
13
|
+
- **New:** `@terreno/syncdb` — `useQuery`, `useMutate`, offline outbox, conflict resolution, sync status UX
|
|
14
|
+
- **Deprecated:** RTK Query hooks for synced collections (`useGetTodosQuery`, `usePostTodosMutation`, manual optimistic updates)
|
|
15
|
+
- **Unchanged:** `bun run sdk` still generates the OpenAPI SDK for auth, profile, admin, AI, and other non-synced routes
|
|
16
|
+
|
|
17
|
+
### What you need to do
|
|
18
|
+
|
|
19
|
+
1. **By next major:** move collection screens from RTK Query to syncdb. `@terreno/rtk` will not publish in the next major line.
|
|
20
|
+
2. **Support window:** `@terreno/rtk` continues to publish with a deprecation notice through the **current major** (56.x beta and stable 0.x).
|
|
21
|
+
3. **Recommended order:** migrate to **Better Auth** first, then syncdb per screen ([migration guide](https://github.com/FlourishHealth/terreno/blob/master/docs/how-to/migrate-rtk-to-syncdb.md)).
|
|
22
|
+
|
|
23
|
+
### Why local-first
|
|
24
|
+
|
|
25
|
+
Instant UI, durable offline writes, and simpler screen code — at the cost of explicit conflict and sync-status handling. See [local-first data](https://github.com/FlourishHealth/terreno/blob/master/docs/explanation/local-first-data.md).
|
|
26
|
+
|
|
27
|
+
### Questions
|
|
28
|
+
|
|
29
|
+
Open a thread in [Docs feedback](https://github.com/FlourishHealth/terreno/discussions/categories/docs-feedback) or reply here.
|
|
@@ -1,30 +1,59 @@
|
|
|
1
1
|
# Authentication Architecture
|
|
2
2
|
|
|
3
|
-
Understanding how authentication works in @terreno/api —
|
|
3
|
+
Understanding how authentication works in @terreno/api — Better Auth sessions for new apps, with JWT/Passport documented for legacy consumers.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Better Auth is the default path** for new Terreno apps. It provides session-based authentication with MongoDB storage, built-in social OAuth (Google, GitHub, Apple), and clean integration with `@terreno/syncdb` (`betterAuthAdapter`, `RealtimeApp` socket sessions).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **JWT (JSON Web Tokens)** for stateless session management
|
|
11
|
-
- **Passport.js** for authentication strategy management
|
|
12
|
-
- **Multiple strategies**: Email/password, GitHub OAuth, Anonymous
|
|
13
|
-
- **Automatic token refresh** to maintain long-lived sessions
|
|
14
|
-
- **Token storage utilities** for secure frontend storage (via @terreno/rtk)
|
|
9
|
+
Set `AUTH_PROVIDER=better-auth` and register `BetterAuthApp` on the server. On the client, use `createBetterAuthClient` + `generateBetterAuthSlice` from `@terreno/rtk` for session Redux state, then wire `betterAuthAdapter` into `createSyncDb`.
|
|
15
10
|
|
|
16
|
-
**
|
|
17
|
-
- **Session-based authentication** with MongoDB storage
|
|
18
|
-
- **Built-in OAuth providers**: Google, GitHub, Apple
|
|
19
|
-
- **Modern OAuth 2.0 flows** with PKCE
|
|
20
|
-
- **Automatic session management** via cookies
|
|
21
|
-
- **Redux integration** for session state (via @terreno/rtk)
|
|
11
|
+
**JWT/Passport (legacy)** remains supported through the current major release line for existing deployments. It uses stateless tokens, Passport strategies (email/password, GitHub OAuth, anonymous), and manual token refresh via `@terreno/rtk`. New projects should not start on JWT unless they have a specific requirement (custom token contracts, non-cookie clients, or a phased migration).
|
|
22
12
|
|
|
23
|
-
|
|
13
|
+
Both systems can run in parallel during migration (`AUTH_PROVIDER` selects the primary path; legacy JWT routes stay available).
|
|
14
|
+
|
|
15
|
+
## When to choose which
|
|
16
|
+
|
|
17
|
+
| Choose Better Auth | Stay on JWT (legacy) |
|
|
18
|
+
|--------------------|----------------------|
|
|
19
|
+
| New app or greenfield screen | Existing production JWT deployment |
|
|
20
|
+
| Social login (Google, GitHub, Apple) | Custom JWT payload requirements |
|
|
21
|
+
| `@terreno/syncdb` local-first data | Non-cookie API clients only |
|
|
22
|
+
| Socket sessions via `RealtimeApp` | Gradual migration in progress |
|
|
23
|
+
|
|
24
|
+
**Setup:** [Configure Better Auth](../how-to/configure-better-auth.md). **Data layer:** migrate auth before or with syncdb — see [Migrate from RTK to syncdb](../how-to/migrate-rtk-to-syncdb.md) §7.
|
|
24
25
|
|
|
25
26
|
## Authentication Strategies
|
|
26
27
|
|
|
27
|
-
###
|
|
28
|
+
### Better Auth (default)
|
|
29
|
+
|
|
30
|
+
Modern session-based authentication with built-in social OAuth support.
|
|
31
|
+
|
|
32
|
+
**Flow:**
|
|
33
|
+
1. Configure Better Auth with `AUTH_PROVIDER=better-auth` and register `BetterAuthApp`
|
|
34
|
+
2. User chooses social provider (Google, GitHub, Apple) or email/password
|
|
35
|
+
3. Backend redirects to OAuth provider or validates credentials
|
|
36
|
+
4. Better Auth creates session in MongoDB
|
|
37
|
+
5. Frontend receives session cookie (web) or bearer session token (native)
|
|
38
|
+
6. Session middleware populates `req.user` for subsequent requests
|
|
39
|
+
|
|
40
|
+
**Key properties:**
|
|
41
|
+
- Session-based (cookies / bearer session) vs. stateless JWT
|
|
42
|
+
- Built-in OAuth providers with PKCE
|
|
43
|
+
- `betterAuthAdapter` for syncdb socket auth
|
|
44
|
+
- `sync:auth-expired` socket event when the session is no longer valid
|
|
45
|
+
|
|
46
|
+
**Endpoints (when enabled):**
|
|
47
|
+
- `POST /api/auth/signup/email` — Email/password signup
|
|
48
|
+
- `POST /api/auth/signin/email` — Email/password signin
|
|
49
|
+
- `GET /api/auth/signin/{provider}` — Initiate OAuth flow (google, github, apple)
|
|
50
|
+
- `GET /api/auth/callback/{provider}` — OAuth callback handler
|
|
51
|
+
- `POST /api/auth/signout` — Sign out session
|
|
52
|
+
- `GET /api/auth/session` — Get current session
|
|
53
|
+
|
|
54
|
+
**Learn more:** [Configure Better Auth](../how-to/configure-better-auth.md)
|
|
55
|
+
|
|
56
|
+
### Email/Password (JWT / Local Strategy — legacy)
|
|
28
57
|
|
|
29
58
|
Traditional username/password authentication using `passport-local-mongoose`.
|
|
30
59
|
|
|
@@ -39,7 +68,7 @@ Traditional username/password authentication using `passport-local-mongoose`.
|
|
|
39
68
|
- `POST /auth/signup` — Create new user account
|
|
40
69
|
- `POST /auth/login` — Authenticate and receive tokens
|
|
41
70
|
|
|
42
|
-
### GitHub OAuth Strategy
|
|
71
|
+
### GitHub OAuth Strategy (JWT — legacy)
|
|
43
72
|
|
|
44
73
|
OAuth 2.0 authentication with GitHub.
|
|
45
74
|
|
|
@@ -60,45 +89,7 @@ OAuth 2.0 authentication with GitHub.
|
|
|
60
89
|
|
|
61
90
|
**Learn more:** [How to add GitHub OAuth](../how-to/add-github-oauth.md)
|
|
62
91
|
|
|
63
|
-
###
|
|
64
|
-
|
|
65
|
-
Modern session-based authentication with built-in social OAuth support. Better Auth runs **alongside** JWT/Passport authentication as an optional alternative.
|
|
66
|
-
|
|
67
|
-
**Flow:**
|
|
68
|
-
1. Configure Better Auth with `AUTH_PROVIDER=better-auth`
|
|
69
|
-
2. User chooses social provider (Google, GitHub, Apple) or email/password
|
|
70
|
-
3. Backend redirects to OAuth provider or validates credentials
|
|
71
|
-
4. Better Auth creates session in MongoDB
|
|
72
|
-
5. Frontend receives session cookie
|
|
73
|
-
6. Session middleware populates `req.user` for subsequent requests
|
|
74
|
-
|
|
75
|
-
**Key differences from JWT auth:**
|
|
76
|
-
- Session-based (cookies) vs. stateless (tokens)
|
|
77
|
-
- Built-in OAuth providers vs. custom Passport strategies
|
|
78
|
-
- Automatic session management vs. manual token refresh
|
|
79
|
-
- Modern OAuth 2.0 flows with PKCE
|
|
80
|
-
|
|
81
|
-
**Use Better Auth when you need:**
|
|
82
|
-
- Social login (Google, GitHub, Apple)
|
|
83
|
-
- Session-based authentication
|
|
84
|
-
- Modern OAuth 2.0 flows
|
|
85
|
-
|
|
86
|
-
**Use JWT authentication when you need:**
|
|
87
|
-
- Stateless authentication
|
|
88
|
-
- Simpler token-based auth
|
|
89
|
-
- No social login required
|
|
90
|
-
|
|
91
|
-
**Endpoints (when enabled):**
|
|
92
|
-
- `POST /api/auth/signup/email` — Email/password signup
|
|
93
|
-
- `POST /api/auth/signin/email` — Email/password signin
|
|
94
|
-
- `GET /api/auth/signin/{provider}` — Initiate OAuth flow (google, github, apple)
|
|
95
|
-
- `GET /api/auth/callback/{provider}` — OAuth callback handler
|
|
96
|
-
- `POST /api/auth/signout` — Sign out session
|
|
97
|
-
- `GET /api/auth/session` — Get current session
|
|
98
|
-
|
|
99
|
-
**Learn more:** [Configure Better Auth](../how-to/configure-better-auth.md)
|
|
100
|
-
|
|
101
|
-
### Anonymous Strategy
|
|
92
|
+
### Anonymous Strategy (JWT — legacy)
|
|
102
93
|
|
|
103
94
|
Allows limited access without authentication.
|
|
104
95
|
|
|
@@ -116,7 +107,9 @@ modelRouter(Model, {
|
|
|
116
107
|
});
|
|
117
108
|
``````
|
|
118
109
|
|
|
119
|
-
## JWT Token System
|
|
110
|
+
## JWT Token System (legacy)
|
|
111
|
+
|
|
112
|
+
> JWT/Passport auth is **legacy**. It remains supported through the current major line but is not the recommended path for new apps. Prefer Better Auth above.
|
|
120
113
|
|
|
121
114
|
### Token Types
|
|
122
115
|
|
|
@@ -435,4 +428,4 @@ router.post("/webhook", asyncHandler(async (req, res) => {
|
|
|
435
428
|
- [Add GitHub OAuth](../how-to/add-github-oauth.md)
|
|
436
429
|
- [Create a model](../how-to/create-a-model.md)
|
|
437
430
|
- [API reference](../reference/api.md)
|
|
438
|
-
- [@terreno/rtk reference](../reference/rtk.md)
|
|
431
|
+
- [@terreno/rtk reference (legacy)](../reference/legacy/rtk.md)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Local-first data in Terreno
|
|
2
|
+
|
|
3
|
+
Terreno's default frontend data path is **local-first**: the on-device store is what your UI reads and writes, and the server reconciles changes asynchronously. This is a different mental model from request/response fetching with RTK Query.
|
|
4
|
+
|
|
5
|
+
## What local-first means here
|
|
6
|
+
|
|
7
|
+
In `@terreno/syncdb`, a TinyBase `MergeableStore` on the device is the **UI source of truth**. When a user taps "save," the mutation applies to local state immediately and lands in a durable outbox. The client then pushes the change to `@terreno/api` over the sync protocol (socket deltas with HTTP snapshot catch-up). The server remains the **authority** for permissions, validation, and conflict resolution — but the UI does not wait on the network for every write.
|
|
8
|
+
|
|
9
|
+
There is no server-first mode and no opt-in flag: if you use syncdb, you adopt this model for every synced collection.
|
|
10
|
+
|
|
11
|
+
## Mental model shift
|
|
12
|
+
|
|
13
|
+
| Server-first (RTK Query) | Local-first (syncdb) |
|
|
14
|
+
|--------------------------|----------------------|
|
|
15
|
+
| UI reads from cache filled by HTTP | UI reads from the local store |
|
|
16
|
+
| Writes call the API, then invalidate/refetch | Writes apply locally, then reconcile |
|
|
17
|
+
| Loading spinners track request lifecycle | Sync status tracks outbox + connectivity |
|
|
18
|
+
| Optimistic updates are manual and fragile | Optimistic state is the default path |
|
|
19
|
+
| Conflicts are rare / ignored | Conflicts are explicit and must be resolved |
|
|
20
|
+
|
|
21
|
+
Think **apply locally, then reconcile** instead of **request, wait, update cache**.
|
|
22
|
+
|
|
23
|
+
## What you stop doing
|
|
24
|
+
|
|
25
|
+
1. **Manual optimistic updates** — `onQueryStarted` patches, temporary IDs, and rollback logic for writes.
|
|
26
|
+
2. **Write-level loading spinners** — `isLoading` on mutations for "saving…" UX; the row updates instantly.
|
|
27
|
+
3. **Refetch orchestration** — `invalidatesTags`, `refetch()`, and list/detail cache coordination after mutations.
|
|
28
|
+
4. **Treating the network as the read path** — list screens blocked on `isLoading` for every navigation.
|
|
29
|
+
|
|
30
|
+
RTK Query remains appropriate for **non-synced** endpoints: `/auth/me`, admin RPC, AI routes, and anything that should stay request/response.
|
|
31
|
+
|
|
32
|
+
## What you start doing
|
|
33
|
+
|
|
34
|
+
1. **Conflict resolution UI** — When the server rejects a mutation (409 / `sync:nack`), the user must choose a strategy (`useServer` or `keepMine`). Use `ConflictSheet` from `@terreno/ui` or build your own with `useConflicts`.
|
|
35
|
+
2. **Sync-status UX** — Surface offline state, queued mutations, and drain progress with `useSyncStatus` (and optionally `SyncStatusBanner`).
|
|
36
|
+
3. **Encryption at rest (web)** — Web persistence uses AES-GCM via the default `createServerKeyProvider`; understand key fetch and `onDecryptFailure` for support flows.
|
|
37
|
+
4. **Key lifecycle on logout** — Call `syncDb.stop()` and consider `wipeLocalData` when the authenticated user changes so one account does not read another's local store.
|
|
38
|
+
5. **Backend sync registration** — Every synced collection needs `syncPlugin`, `isDeletedPlugin`, and a `sync` block on `modelRouter`, plus `SyncApp` and `RealtimeApp` on the server.
|
|
39
|
+
|
|
40
|
+
## Tradeoffs
|
|
41
|
+
|
|
42
|
+
**Gains:** instant UI, offline writes with a durable outbox, simpler screen code, and one write path on the server (sync and REST share `modelRouter`).
|
|
43
|
+
|
|
44
|
+
**Costs:** larger conceptual surface (conflicts, sync status, local storage), mandatory replica-set MongoDB for realtime, and migration work for existing RTK Query screens.
|
|
45
|
+
|
|
46
|
+
Server-first fetching is simpler when you only need online CRUD with no offline requirement — but Terreno's blessed path for collection data is local-first.
|
|
47
|
+
|
|
48
|
+
## Related docs
|
|
49
|
+
|
|
50
|
+
- [syncdb reference](../reference/syncdb.md) — API ground truth
|
|
51
|
+
- [Migrate from RTK to syncdb](../how-to/migrate-rtk-to-syncdb.md) — step-by-step migration
|
|
52
|
+
- [Authentication architecture](authentication.md) — Better Auth + socket sessions
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Loop engineering
|
|
2
|
+
|
|
3
|
+
Terreno separates engineering method from orchestration:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
LOOP
|
|
7
|
+
orchestrate / persist / wait
|
|
8
|
+
retry / stop / escalate
|
|
9
|
+
|
|
|
10
|
+
v
|
|
11
|
+
GROW
|
|
12
|
+
shape
|
|
13
|
+
|
|
|
14
|
+
v
|
|
15
|
+
PICK
|
|
16
|
+
build
|
|
17
|
+
|
|
|
18
|
+
v
|
|
19
|
+
ROAST
|
|
20
|
+
prove
|
|
21
|
+
|
|
|
22
|
+
v
|
|
23
|
+
BREW
|
|
24
|
+
submit
|
|
25
|
+
|
|
|
26
|
+
v
|
|
27
|
+
TASTE
|
|
28
|
+
react once
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Repository knowledge composes underneath every invocation:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
lifecycle stage + project skills + IP/task/state + evidence
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Why fresh invocations
|
|
38
|
+
|
|
39
|
+
One enormous agent context accumulates assumptions, stale external state, and confidence
|
|
40
|
+
in its own implementation. The lifecycle instead makes every stage reconstructable from
|
|
41
|
+
durable artifacts. Pick can retry from exact Roast evidence; Roast can verify without the
|
|
42
|
+
implementer's assumptions; Taste can react to the current PR head rather than an old
|
|
43
|
+
green result.
|
|
44
|
+
|
|
45
|
+
The outer loop decides **when, who, what next, when to retry, when to wait, and when to
|
|
46
|
+
escalate**. Stages decide how to perform one transition correctly.
|
|
47
|
+
|
|
48
|
+
## The five transitions
|
|
49
|
+
|
|
50
|
+
| Stage | Question | Primary evidence |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| Grow | Is the work shaped and approved? | IP/tasks, decisions, criterion→verification map |
|
|
53
|
+
| Pick | Was this slice implemented carefully? | red/green tests, checks, internal reviews |
|
|
54
|
+
| Roast | Does the result actually satisfy the IP? | independent requirement→evidence verdict |
|
|
55
|
+
| Brew | Is the verified result correctly submitted? | final checks, commit/head, PR, artifacts |
|
|
56
|
+
| Taste | What is actionable on the current PR head now? | CI, mergeability, reviews, bounded fixes |
|
|
57
|
+
|
|
58
|
+
Roast is not another implementation review. It independently proves or disproves
|
|
59
|
+
acceptance criteria. Taste is not a resident watcher. It observes once, acts once, emits
|
|
60
|
+
`PASS`, `FAIL`, `BLOCKED`, or `PENDING`, then exits.
|
|
61
|
+
|
|
62
|
+
## Portable plugin, local knowledge
|
|
63
|
+
|
|
64
|
+
The reusable plugin defines contracts, invariants, evidence, and transitions. Repo-local
|
|
65
|
+
skills define exact API/UI/database patterns, commands, test environments, generated
|
|
66
|
+
code, deployment, and safety rules.
|
|
67
|
+
|
|
68
|
+
Each stage inspects available skills and loads those whose descriptions match the
|
|
69
|
+
affected domain. A useful skill is optional when absent; a capability required by
|
|
70
|
+
repository policy is a hard gate and produces `BLOCKED` if unavailable.
|
|
71
|
+
|
|
72
|
+
Stages also load architecture docs before acting. Docs are the design; code implements
|
|
73
|
+
them. Missing docs for a user-visible or architectural change is `FAIL`.
|
|
74
|
+
|
|
75
|
+
This lets the same Pick method compose with backend API and test-environment knowledge,
|
|
76
|
+
while Roast composes with UI conventions and real-app verification.
|
|
77
|
+
|
|
78
|
+
### Terreno's current project-skill layer
|
|
79
|
+
|
|
80
|
+
The canonical sources remain under `.rulesync/skills/` and are generated for supported
|
|
81
|
+
agents. The current high-value composition points include:
|
|
82
|
+
|
|
83
|
+
| Domain | Repo-local skills stages may discover |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| Backend/API/data | `terreno-backend-api`, `mongoose-schema-safety`, `backend-test-env`, `generate-sdk`, `terreno-data-fetching` |
|
|
86
|
+
| UI/app | `terreno-ui`, `building-terreno-apps`, `building-native-ui`, `verify-ui-changes` |
|
|
87
|
+
| AI/prompts | `ai-prompt-governance` |
|
|
88
|
+
| Docs/submission | `update-docs`, `commit`, `create-pr`, `fix-conflicts` |
|
|
89
|
+
| Deployment/runtime | `deploy-gcp`, Expo deployment/workflow skills |
|
|
90
|
+
|
|
91
|
+
This inventory is descriptive, not a plugin dependency list. Stages inspect the actual
|
|
92
|
+
catalog on every invocation.
|
|
93
|
+
|
|
94
|
+
## State and evidence
|
|
95
|
+
|
|
96
|
+
The IP remains the design/scope source of truth. The task file remains the execution
|
|
97
|
+
checklist. Lightweight loop-owned state stores only current stage/attempt/task,
|
|
98
|
+
branch/head/PR, the previous structured result, artifacts, attempted approaches, and next
|
|
99
|
+
transition.
|
|
100
|
+
|
|
101
|
+
The fallback state location is `.terreno/pipeline/<slug>.json`; the outer loop preserves
|
|
102
|
+
or transports it and Brew excludes it from commits unless repository policy says
|
|
103
|
+
otherwise. Stage results follow the plugin's JSON-schema-backed YAML contract and never
|
|
104
|
+
contain chain-of-thought or transcripts.
|
|
105
|
+
|
|
106
|
+
## Retry and stop rules
|
|
107
|
+
|
|
108
|
+
- Roast failure returns exact expected/actual evidence to a fresh Pick.
|
|
109
|
+
- Engineering retries require a new hypothesis and preserve failed approaches.
|
|
110
|
+
- Taste `PENDING` lets the outer loop wait and invoke fresh Taste against current state.
|
|
111
|
+
- Human decisions are `BLOCKED`, never arbitrary retries.
|
|
112
|
+
- Taste `PASS` requires all current-head checks terminal/non-failing, no conflicts, and
|
|
113
|
+
no actionable review findings.
|
|
114
|
+
|
|
115
|
+
The detailed contract, schemas, and three execution scenarios live under
|
|
116
|
+
[`plugins/terreno-planning/references/`](https://github.com/FlourishHealth/terreno/tree/master/plugins/terreno-planning/references).
|
|
117
|
+
|
|
@@ -36,6 +36,14 @@ descriptions):
|
|
|
36
36
|
- Require branches to be up to date before merging
|
|
37
37
|
- Do not allow bypassing the above settings
|
|
38
38
|
|
|
39
|
+
### CircleCI dual-run (in progress)
|
|
40
|
+
|
|
41
|
+
Package CI / policy / Playwright twins live under `.circleci/` (see
|
|
42
|
+
[how-to/circleci.md](../how-to/circleci.md)). **Keep requiring the existing GitHub
|
|
43
|
+
Actions check names** until a twin is trusted; then add the CircleCI job name and
|
|
44
|
+
remove the GHA workflow. Do not require CircleCI deploy jobs yet (deploys not
|
|
45
|
+
ported).
|
|
46
|
+
|
|
39
47
|
## Merge settings
|
|
40
48
|
|
|
41
49
|
**Path:** Settings → General → Pull Requests
|