@aotter/mantle 0.2.0-alpha.2 → 0.2.0-alpha.3

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 (50) hide show
  1. package/dist/admin/design.d.ts +7 -0
  2. package/dist/admin/design.d.ts.map +1 -0
  3. package/dist/admin/design.js +18 -0
  4. package/dist/admin/design.js.map +1 -0
  5. package/dist/admin/developerConsole.d.ts +1 -0
  6. package/dist/admin/developerConsole.d.ts.map +1 -1
  7. package/dist/admin/developerConsole.js.map +1 -1
  8. package/dist/admin/index.d.ts +2 -0
  9. package/dist/admin/index.d.ts.map +1 -1
  10. package/dist/admin/index.js +2 -0
  11. package/dist/admin/index.js.map +1 -1
  12. package/dist/auth/buildAuth.d.ts +6 -5
  13. package/dist/auth/buildAuth.d.ts.map +1 -1
  14. package/dist/auth/buildAuth.js +5 -1
  15. package/dist/auth/buildAuth.js.map +1 -1
  16. package/dist/auth/createMantleAuth.d.ts.map +1 -1
  17. package/dist/auth/createMantleAuth.js +6 -11
  18. package/dist/auth/createMantleAuth.js.map +1 -1
  19. package/dist/cli/generate.d.ts.map +1 -1
  20. package/dist/cli/generate.js +38 -2
  21. package/dist/cli/generate.js.map +1 -1
  22. package/dist/core/withCaller.js +1 -1
  23. package/dist/core/withCaller.js.map +1 -1
  24. package/dist/spec/infrastructure/sql/PgQueryParser.js +1 -1
  25. package/dist/spec/infrastructure/sql/PgQueryParser.js.map +1 -1
  26. package/dist/spec/infrastructure/sql/compileSql.js +2 -2
  27. package/dist/spec/infrastructure/sql/compileSql.js.map +1 -1
  28. package/dist/web/createRestSurface.d.ts.map +1 -1
  29. package/dist/web/createRestSurface.js +5 -3
  30. package/dist/web/createRestSurface.js.map +1 -1
  31. package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +20 -0
  32. package/docs/adr/0031-host-cloud-core-contract.md +17 -1
  33. package/docs/adr/README.md +1 -1
  34. package/docs/examples/procurement.md +12 -1
  35. package/docs/examples/reference-service/package.json +6 -6
  36. package/docs/examples/reference-service/smoke.mjs +6 -2
  37. package/docs/handbook/cloudflare/authentication.md +84 -1
  38. package/docs/handbook/cloudflare/deploy-and-operate.md +15 -4
  39. package/docs/handbook/concepts/authorization.md +7 -1
  40. package/docs/handbook/concepts/mcp-and-agents.md +1 -1
  41. package/docs/handbook/guides/admin-ui.md +29 -0
  42. package/docs/handbook/releases/index.md +7 -2
  43. package/docs/handbook/start/overview.md +1 -1
  44. package/docs/handbook/start/project-and-cli.md +7 -0
  45. package/docs/handbook/start/quickstart-worker.md +5 -4
  46. package/docs/skills/develop/SKILL.md +10 -0
  47. package/docs/skills/develop/mcp-app.md +1 -1
  48. package/docs/skills/provision/SKILL.md +4 -3
  49. package/docs/skills/update/SKILL.md +6 -0
  50. package/package.json +14 -12
@@ -43,6 +43,7 @@ After that they are your files.
43
43
  | Look up a field | [Feature table](../reference/features.md), then the [Schema](../reference/schema.md), [View](../reference/view.md), [Procedure](../reference/procedure.md) and [Trigger](../reference/trigger.md) references |
44
44
  | Wire sign-in, media or deploy | [Authentication](../cloudflare/authentication.md), [Media uploads with R2](../cloudflare/media-r2.md), [Deploy and operate](../cloudflare/deploy-and-operate.md) |
45
45
  | Run on ChatGPT Sites | [Mantle on ChatGPT Sites](../cloudflare/chatgpt-sites.md) |
46
+ | Save, preview and publish on Mantle Cloud | [Mantle Cloud](../cloudflare/deploy-and-operate.md#mantle-cloud), then the plugin's `mantle` Cloud workflow |
46
47
  | See whole services | [Examples](../examples/hub.md) and the runnable reference service |
47
48
  | Move a 0.1.x project | `docs/upgrade-0.1-to-0.2.md` in the installed package |
48
49
 
@@ -60,4 +61,3 @@ check the code.
60
61
  `createMantle`. The Bun preset has no scheduler.
61
62
  - **Site settings and media on PostgreSQL.** Only the `sqlite` dialect's
62
63
  storage takes `SiteDefaults`; see [Site defaults](../reference/site-config.md).
63
- - **Deploying to Mantle Cloud.** See [Deploy and operate](../cloudflare/deploy-and-operate.md).
@@ -59,6 +59,13 @@ and stops before writing anything, naming the install command for your
59
59
  package manager. It never installs anything. The host and dialect rows, and the
60
60
  staff MCP App, are checked only while the preset is still to be written.
61
61
 
62
+ Use the versions in the installed Core's `package.json` `peerDependencies`,
63
+ not registry latest, for optional auth and MCP packages. The diagnostic's
64
+ install command includes those versions and incompatible installed peers are
65
+ refused before generation. Keep `@aotter/mantle-ui` at Core's
66
+ exact version. A package manager accepting an incompatible peer does not make
67
+ it a supported combination; inspect peer warnings before starting the service.
68
+
62
69
  | Selection | Packages |
63
70
  |---|---|
64
71
  | always | `@aotter/mantle` |
@@ -112,12 +112,13 @@ pnpm exec mantle generate
112
112
  ```
113
113
 
114
114
  With no flags the selection is identity `mantle` and every feature. The first
115
- run names the packages it needs, with the install command, and writes nothing
116
- until they are installed:
115
+ run names the packages it needs, with versioned install commands from the
116
+ installed Core's `peerDependencies`, and writes nothing until they are installed
117
+ at compatible versions. Copy those commands rather than installing registry
118
+ latest; `@aotter/mantle-ui` must match Core's exact version:
117
119
 
118
120
  ```sh
119
- pnpm add better-auth @better-auth/oauth-provider @better-auth/mcp @better-auth/cimd \
120
- @modelcontextprotocol/server @modelcontextprotocol/ext-apps @aotter/mantle-ui
121
+ # Run each versioned pnpm add command printed above first.
121
122
  pnpm exec mantle generate
122
123
  cp .dev.vars.example .dev.vars # set ADMIN_EMAIL and a random BETTER_AUTH_SECRET
123
124
  pnpm exec wrangler dev --local
@@ -66,6 +66,11 @@ Choose in this order, stopping at the first that works:
66
66
  published-only into public Views. Never repeat them.
67
67
  - `scope` hides rows from staff too. When staff must see every row, store
68
68
  `auth.uid()` in a field and filter on it instead.
69
+ - That filter protects the View, not generic Admin Schema reads. Root
70
+ `schema.readOnly: true` blocks generic writes only. If a contributor must
71
+ not read other users' rows, restrict the application-owned Admin surface
72
+ inside its existing `withCaller` boundary; see
73
+ `docs/handbook/guides/admin-ui.md` (Roles). Keep business transitions in SQL.
69
74
 
70
75
  ## Handlers
71
76
 
@@ -112,6 +117,11 @@ Then exercise what changed over HTTP: the REST View or Trigger, `/mcp`
112
117
  sign-in and the Admin route (`docs/handbook/cloudflare/authentication.md`).
113
118
  Check the stored rows, not only a 200. Before deploying a Schema change on
114
119
  SQLite, run `mantle generate --check --database <file>` to see the storage SQL.
120
+ For a workflow, verify valid and invalid state transitions, ownership on every
121
+ mounted surface (including generic Admin reads and writes), concurrent writes
122
+ with one expected version, and persisted data and sessions after a restart.
123
+ Exercise the actual UI when the product includes one; serving HTML alone does
124
+ not verify its forms or operations.
115
125
 
116
126
  ## Rules
117
127
 
@@ -19,7 +19,7 @@ decision. Build it case by case from these pieces.
19
19
  | `SchemaFields` and the primitives | `@aotter/mantle-ui/kit`, styled by `@aotter/mantle-ui/kit.css` | Admin's form controls |
20
20
 
21
21
  The App's own build installs what it imports: `@modelcontextprotocol/ext-apps`
22
- at the exact version `@aotter/mantle` depends on, React and the kit's peers
22
+ at the exact version in the installed Core's `peerDependencies`, React and the kit's peers
23
23
  (`@aotter/mantle-ui`'s README lists them). `docs/handbook/concepts/mcp-and-agents.md`
24
24
  (MCP Apps) describes the catalog and the staff App these share.
25
25
 
@@ -23,7 +23,7 @@ Ask which target, unless the project already shows one.
23
23
  |---|---|---|
24
24
  | Cloudflare Workers | `wrangler.jsonc` | the rest of this skill |
25
25
  | ChatGPT Sites | the Site's hosting config | installed `docs/handbook/cloudflare/chatgpt-sites.md`; publish through Sites, never `wrangler deploy` |
26
- | Mantle Cloud | — | not available for 0.2 services yet; the plugin's `mantle` skill says when it is |
26
+ | Mantle Cloud | Cloud project link | the plugin's `mantle` skill and its Cloud workflow; connect Cloud MCP and use its exact host contract, not `wrangler deploy` |
27
27
  | Bun (host `bun`) | `.env` | self-hosted; installed `docs/handbook/start/project-and-cli.md` (Bun), not this skill |
28
28
 
29
29
  Self-hosting is always an option; never present a hosted target as required.
@@ -58,8 +58,9 @@ Confirm the active Cloudflare account with the user before creating anything.
58
58
  and `bootstrapOwner: { match: "github-login", value }`. The user creates a
59
59
  GitHub OAuth App with callback `<PUBLIC_ORIGIN>/api/auth/callback/github`.
60
60
  Remove the preset's loopback-only check once the method is real.
61
- 4. **Secrets.** Never in chat, files or logs. Use a connector, or hidden
62
- input:
61
+ 4. **Secrets.** Never commit them or put them in chat, logs or `wrangler.jsonc`
62
+ `vars`. Store production values in the deployment's secret store. Use a
63
+ connector, or hidden input:
63
64
 
64
65
  ```bash
65
66
  openssl rand -hex 32 | pnpm exec wrangler secret put BETTER_AUTH_SECRET
@@ -27,6 +27,12 @@ Upgrade deliberately; never overwrite application-owned code.
27
27
  `@aotter/mantle-ui/admin`), and update the lockfile with the
28
28
  package manager. Review the dependency diff and any peer changes
29
29
  `mantle generate` names.
30
+ With identity `mantle`, inspect auth database upgrade requirements in
31
+ `docs/handbook/cloudflare/authentication.md` before starting the new service.
32
+ Better Auth 1.7.0–1.7.2's required legacy `account.issuer` needs a
33
+ data-preserving host-specific constraint migration when moving to 1.7.7;
34
+ fresh-database success alone does not verify an upgrade. Back up the service's
35
+ own database and retain existing users, sessions, roles and content.
30
36
  5. Regenerate and check:
31
37
 
32
38
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aotter/mantle",
3
- "version": "0.2.0-alpha.2",
3
+ "version": "0.2.0-alpha.3",
4
4
  "description": "Mantle: a manifest-driven service core. Store authored as SQL, surfaces as Fetch functions, and the mantle CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://mantle.tools/",
@@ -85,33 +85,35 @@
85
85
  "libpg-query": "18.1.5",
86
86
  "pgsql-deparser": "18.3.8",
87
87
  "yaml": "^2.9.0",
88
- "zod": "^4.5.4"
88
+ "zod": "^4.5.4",
89
+ "semver": "^7.8.5"
89
90
  },
90
91
  "devDependencies": {
91
- "@better-auth/cimd": "1.7.2",
92
- "@better-auth/core": "1.7.2",
93
- "@better-auth/mcp": "1.7.2",
94
- "@better-auth/oauth-provider": "1.7.2",
92
+ "@better-auth/cimd": "1.7.7",
93
+ "@better-auth/core": "1.7.7",
94
+ "@better-auth/mcp": "1.7.7",
95
+ "@better-auth/oauth-provider": "1.7.7",
95
96
  "@better-auth/utils": "0.4.2",
96
97
  "@modelcontextprotocol/client": "2.1.0",
97
98
  "@modelcontextprotocol/ext-apps": "2.0.0",
98
99
  "@modelcontextprotocol/server": "2.1.0",
99
100
  "@types/node": "^26",
100
101
  "@types/pg": "8.23.1",
101
- "better-auth": "1.7.2",
102
+ "better-auth": "1.7.7",
102
103
  "bun-types": "1.3.14",
103
104
  "pg": "8.23.1",
104
105
  "typescript": "^6.0.3",
105
106
  "vitest": "^4.1.11",
106
- "wrangler": "4.126.0"
107
+ "wrangler": "4.126.0",
108
+ "@types/semver": "^7.7.1"
107
109
  },
108
110
  "peerDependencies": {
109
- "@better-auth/cimd": "1.7.2",
110
- "@better-auth/mcp": "1.7.2",
111
- "@better-auth/oauth-provider": "1.7.2",
111
+ "@better-auth/cimd": "1.7.7",
112
+ "@better-auth/mcp": "1.7.7",
113
+ "@better-auth/oauth-provider": "1.7.7",
112
114
  "@modelcontextprotocol/ext-apps": "2.0.0",
113
115
  "@modelcontextprotocol/server": "2.1.0",
114
- "better-auth": "1.7.2"
116
+ "better-auth": "1.7.7"
115
117
  },
116
118
  "peerDependenciesMeta": {
117
119
  "@better-auth/cimd": {