@aotter/mantle 0.2.0-alpha.9 → 0.2.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +15 -5
  2. package/dist/auth/adapter.js +1 -28
  3. package/dist/auth/admin.js +2 -5
  4. package/dist/auth/caller.js +0 -27
  5. package/dist/auth/consent.js +100 -0
  6. package/dist/auth/hardening.js +0 -7
  7. package/dist/auth/identity.js +0 -11
  8. package/dist/auth/oauth.js +0 -32
  9. package/dist/auth/resource-seeds.js +0 -2
  10. package/dist/auth/route-http.js +33 -0
  11. package/dist/auth/routes.js +5 -151
  12. package/dist/build/compiler.d.ts +19 -609
  13. package/dist/build/compiler.js +6 -6896
  14. package/dist/build/spec/domain/model/ManifestGrammar.d.ts +39 -1
  15. package/dist/build/spec/domain/model/RuntimePlan.d.ts +16 -3
  16. package/dist/build/spec/domain/model/SqlIr.d.ts +32 -0
  17. package/dist/build/spec/domain/model/UserFields.d.ts +1 -0
  18. package/dist/build/spec/kernel/diagnostic.d.ts +1 -1
  19. package/dist/bun/assets.js +0 -2
  20. package/dist/domain/adminOrder.js +0 -2
  21. package/dist/domain/columns.js +7 -20
  22. package/dist/domain/describe/chunk-P6PP6VVV.js +1 -0
  23. package/dist/domain/describe/index.d.ts +1 -0
  24. package/dist/domain/describe/index.js +1 -115
  25. package/dist/domain/describe/match.d.ts +19 -0
  26. package/dist/domain/describe/target-hash.js +1 -12
  27. package/dist/domain/entry.js +0 -14
  28. package/dist/domain/generated-tools.js +0 -1
  29. package/dist/domain/input.js +0 -2
  30. package/dist/domain/paging.js +0 -17
  31. package/dist/domain/recipes.js +10 -7
  32. package/dist/domain/userReferences.js +0 -1
  33. package/dist/domain/wireScalars.js +0 -6
  34. package/dist/infrastructure/adminEntries.js +27 -8
  35. package/dist/infrastructure/adminPaging.js +55 -57
  36. package/dist/infrastructure/artifacts.js +0 -4
  37. package/dist/infrastructure/authSchema.js +0 -9
  38. package/dist/infrastructure/bundle.js +45 -38
  39. package/dist/infrastructure/cli.js +26 -12
  40. package/dist/infrastructure/generate.js +26 -19
  41. package/dist/infrastructure/generateAuth.js +1 -9
  42. package/dist/infrastructure/help.js +55 -0
  43. package/dist/infrastructure/init.js +50 -0
  44. package/dist/infrastructure/inputs.js +0 -9
  45. package/dist/infrastructure/mounts.js +22 -0
  46. package/dist/infrastructure/wrangler.js +0 -6
  47. package/dist/kernel/authorization.js +0 -1
  48. package/dist/kernel/binds.d.ts +34 -7
  49. package/dist/kernel/binds.js +5 -11
  50. package/dist/kernel/caller-identity.d.ts +0 -3
  51. package/dist/kernel/caller-identity.js +0 -15
  52. package/dist/kernel/caller-mode.d.ts +4 -0
  53. package/dist/kernel/caller-mode.js +14 -0
  54. package/dist/kernel/contracts.d.ts +13 -10
  55. package/dist/kernel/contracts.js +14 -41
  56. package/dist/kernel/cron.js +0 -4
  57. package/dist/kernel/dialect/common.js +0 -3
  58. package/dist/kernel/dialect/postgres.js +0 -2
  59. package/dist/kernel/dialect/sqlite.js +1 -6
  60. package/dist/kernel/drain.js +2 -8
  61. package/dist/kernel/driver/bun-sqlite.js +3 -7
  62. package/dist/kernel/driver/d1.d.ts +1 -1
  63. package/dist/kernel/driver/d1.js +6 -4
  64. package/dist/kernel/driver/postgres.d.ts +2 -1
  65. package/dist/kernel/driver/postgres.js +12 -22
  66. package/dist/kernel/driver/transaction-context.js +0 -1
  67. package/dist/kernel/email.js +0 -4
  68. package/dist/kernel/host-access.js +2 -3
  69. package/dist/kernel/host-caller.d.ts +1 -1
  70. package/dist/kernel/host-caller.js +3 -6
  71. package/dist/kernel/json-body.js +0 -2
  72. package/dist/kernel/mcp-apps.js +0 -5
  73. package/dist/kernel/mcp-call.js +0 -1
  74. package/dist/kernel/mcp-handler.js +4 -27
  75. package/dist/kernel/mcp.js +0 -5
  76. package/dist/kernel/media.js +0 -18
  77. package/dist/kernel/paging.js +1 -9
  78. package/dist/kernel/publishing.js +3 -4
  79. package/dist/kernel/r2-media.js +0 -7
  80. package/dist/kernel/rest-dispatch.js +0 -1
  81. package/dist/kernel/rest-router.js +5 -8
  82. package/dist/kernel/rest.d.ts +2 -1
  83. package/dist/kernel/rest.js +1 -3
  84. package/dist/kernel/route-pattern.d.ts +26 -0
  85. package/dist/kernel/route-pattern.js +34 -0
  86. package/dist/kernel/scalars.js +1 -9
  87. package/dist/kernel/search.js +0 -1
  88. package/dist/kernel/site.js +0 -2
  89. package/dist/kernel/store.d.ts +26 -2
  90. package/dist/kernel/store.js +69 -49
  91. package/dist/kernel/surface-failure.d.ts +10 -0
  92. package/dist/kernel/surface-failure.js +29 -0
  93. package/dist/kernel/surface.js +0 -3
  94. package/dist/kernel/sweep.js +0 -1
  95. package/dist/kernel/translations.js +0 -1
  96. package/dist/kernel/user-caller.js +2 -8
  97. package/dist/kernel/user-fields.d.ts +3 -2
  98. package/dist/kernel/user-fields.js +9 -9
  99. package/dist/kernel/validation.js +0 -8
  100. package/dist/kernel/web-gateway.js +0 -2
  101. package/dist/kernel/web-head.js +0 -1
  102. package/dist/kernel/web-index.js +0 -1
  103. package/dist/kernel/web-response.js +0 -1
  104. package/dist/kernel/web-serve.js +97 -0
  105. package/dist/kernel/web.d.ts +1 -1
  106. package/dist/kernel/web.js +10 -91
  107. package/dist/kernel/where.js +0 -6
  108. package/dist/usecase/adminBindings.js +32 -23
  109. package/dist/usecase/adminClient.js +4 -22
  110. package/dist/usecase/adminDescriptors.js +2 -9
  111. package/dist/usecase/generate.js +14 -17
  112. package/dist/usecase/handlers.js +1 -4
  113. package/dist/usecase/mcp-media.js +0 -1
  114. package/dist/usecase/mcp.js +0 -4
  115. package/dist/usecase/paging.js +1 -3
  116. package/dist/usecase/publishing.js +20 -11
  117. package/dist/usecase/rest.js +5 -6
  118. package/dist/usecase/site.js +0 -1
  119. package/dist/usecase/stores.js +12 -17
  120. package/dist/usecase/tool-version.js +0 -3
  121. package/dist/usecase/translations.js +0 -2
  122. package/dist/usecase/validation.js +0 -20
  123. package/docs/examples/README.md +13 -5
  124. package/docs/examples/app-shell/README.md +91 -12
  125. package/docs/examples/app-shell/accept.mjs +91 -0
  126. package/docs/examples/app-shell/gitignore +7 -0
  127. package/docs/examples/app-shell/package.json +10 -9
  128. package/docs/examples/app-shell/smoke-kit.mjs +29 -15
  129. package/docs/examples/app-shell/src/routes.ts +6 -3
  130. package/docs/examples/app-shell/src/service.ts +2 -1
  131. package/docs/examples/club-events/README.md +7 -2
  132. package/docs/examples/club-events/manifests/club-events.yaml +17 -0
  133. package/docs/examples/club-events/smoke.mjs +7 -1
  134. package/docs/examples/generated-web/seed.sql +5 -4
  135. package/docs/examples/purchasing/README.md +12 -3
  136. package/docs/examples/purchasing/manifests/purchasing.yaml +24 -4
  137. package/docs/examples/purchasing/smoke.mjs +14 -0
  138. package/docs/examples/recipes/README.md +5 -3
  139. package/docs/handbook/cloudflare/media-r2.md +6 -3
  140. package/docs/handbook/cloudflare/service-entry.md +5 -0
  141. package/docs/handbook/concepts/lifecycle-and-locales.md +21 -1
  142. package/docs/handbook/examples/hub.md +1 -1
  143. package/docs/handbook/guides/admin-ui.md +1 -1
  144. package/docs/handbook/guides/agent-setup.md +20 -10
  145. package/docs/handbook/guides/agent-workflow-acceptance.md +225 -105
  146. package/docs/handbook/guides/local-testing.md +85 -0
  147. package/docs/handbook/guides/native-admin.md +242 -16
  148. package/docs/handbook/guides/native-execution.md +10 -8
  149. package/docs/handbook/guides/public-pages.md +44 -4
  150. package/docs/handbook/guides/revisions.md +584 -0
  151. package/docs/handbook/guides/size-and-startup.md +140 -0
  152. package/docs/handbook/guides/sql-patterns.md +312 -0
  153. package/docs/handbook/guides/typed-queries.md +146 -3
  154. package/docs/handbook/navigation.json +20 -0
  155. package/docs/handbook/reference/admin-descriptors.md +4 -1
  156. package/docs/handbook/reference/authorization.md +3 -1
  157. package/docs/handbook/reference/describe.md +42 -0
  158. package/docs/handbook/reference/diagnostics.md +16 -2
  159. package/docs/handbook/reference/procedure.md +6 -6
  160. package/docs/handbook/reference/schema.md +79 -9
  161. package/docs/handbook/reference/sql.md +65 -0
  162. package/docs/handbook/reference/surface.md +8 -4
  163. package/docs/handbook/reference/trigger.md +12 -0
  164. package/docs/handbook/reference/view.md +11 -3
  165. package/docs/handbook/releases/index.md +71 -7
  166. package/docs/handbook/start/agents.md +49 -0
  167. package/docs/handbook/start/project-and-cli.md +10 -0
  168. package/docs/handbook/start/quickstart-worker.md +1 -1
  169. package/docs/skills/develop/SKILL.md +19 -6
  170. package/docs/skills/integrate/SKILL.md +3 -1
  171. package/docs/skills/performance/SKILL.md +169 -0
  172. package/docs/skills/update/SKILL.md +10 -4
  173. package/docs/upgrade-0.1-to-0.2.md +151 -39
  174. package/package.json +31 -11
  175. package/skills/README.md +6 -2
  176. package/skills/mantle/SKILL.md +53 -120
  177. package/dist/domain/describe/chunk-ZVXBGP7Y.js +0 -424
  178. package/skills/mantle/references/local-testing.md +0 -20
  179. package/skills/mantle/references/web.md +0 -41
  180. package/skills/mantle/references/website.md +0 -51
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aotter/mantle",
3
- "version": "0.2.0-alpha.9",
3
+ "version": "0.2.1-alpha.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "engines": {
@@ -20,9 +20,9 @@
20
20
  "jsonc-parser": "3.3.1",
21
21
  "@pgsql/types": "18.0.0",
22
22
  "libpg-query": "18.1.5",
23
- "pgsql-deparser": "18.3.8",
23
+ "pgsql-deparser": "18.3.10",
24
24
  "yaml": "^2.9.1",
25
- "zod": "^4.6.5"
25
+ "zod": "^4.6.7"
26
26
  },
27
27
  "exports": {
28
28
  ".": "./dist/infrastructure/generate.js",
@@ -72,7 +72,7 @@
72
72
  "./target-hash": "./dist/domain/describe/target-hash.js"
73
73
  },
74
74
  "peerDependencies": {
75
- "@modelcontextprotocol/server": "2.2.0",
75
+ "@modelcontextprotocol/server": "2.3.1",
76
76
  "@better-auth/core": "1.7.7",
77
77
  "@better-auth/oauth-provider": "1.7.7",
78
78
  "better-auth": "1.7.7"
@@ -92,21 +92,38 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@modelcontextprotocol/client": "2.2.0",
96
- "@modelcontextprotocol/server": "2.2.0",
95
+ "@modelcontextprotocol/client": "2.3.1",
96
+ "@modelcontextprotocol/server": "2.3.1",
97
97
  "@better-auth/core": "1.7.7",
98
98
  "@better-auth/oauth-provider": "1.7.7",
99
99
  "@better-auth/test-utils": "1.7.7",
100
- "@cloudflare/workers-types": "^5.20261008.1",
100
+ "@cloudflare/workers-types": "^5.20261027.1",
101
101
  "@types/node": "^26",
102
102
  "better-auth": "1.7.7",
103
103
  "bun-types": "1.4.2",
104
104
  "postgres": "3.4.9",
105
105
  "typescript": "^6.0.3",
106
- "wrangler": "4.145.0",
107
- "vitest": "^5.0.1"
106
+ "wrangler": "4.153.0",
107
+ "vitest": "^5.0.4"
108
108
  },
109
- "description": "Mantle: a manifest-driven service core. Store authored as SQL, surfaces as Fetch functions, and the mantle CLI.",
109
+ "description": "Agent-native app SDK and backend compiler: YAML manifests to native SQL (SQLite, Cloudflare D1, PostgreSQL) and typed TypeScript; optional REST and MCP.",
110
+ "keywords": [
111
+ "mantle",
112
+ "agent-native",
113
+ "sdk",
114
+ "backend",
115
+ "yaml",
116
+ "code-generation",
117
+ "sql",
118
+ "sqlite",
119
+ "postgresql",
120
+ "cloudflare-d1",
121
+ "cloudflare-workers",
122
+ "bun",
123
+ "typescript",
124
+ "mcp",
125
+ "model-context-protocol"
126
+ ],
110
127
  "license": "Apache-2.0",
111
128
  "homepage": "https://mantle.tools/",
112
129
  "repository": {
@@ -114,13 +131,16 @@
114
131
  "url": "git+https://github.com/aotter/mantle.git",
115
132
  "directory": "packages/mantle"
116
133
  },
134
+ "bugs": {
135
+ "url": "https://github.com/aotter/mantle/issues"
136
+ },
117
137
  "publishConfig": {
118
138
  "access": "public",
119
139
  "tag": "alpha",
120
140
  "registry": "https://registry.npmjs.org"
121
141
  },
122
142
  "scripts": {
123
- "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.lib.json && node scripts/bundle-compiler.mjs && node scripts/prune-declarations.mjs",
143
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.lib.json && node ../../scripts/strip-comments.mjs tsconfig.lib.json && node scripts/bundle-compiler.mjs && node scripts/prune-declarations.mjs",
124
144
  "typecheck": "tsc --noEmit -p tsconfig.json",
125
145
  "test": "bun test tests/*.test.ts && bun run test:compiler",
126
146
  "generate": "bun src/infrastructure/cli.ts",
package/skills/README.md CHANGED
@@ -18,6 +18,7 @@ distributions (ADR-0032 decision 13):
18
18
  | [`update`](../docs/skills/update/SKILL.md) | Upgrade `@aotter/mantle`, including from 0.1.x. |
19
19
  | [`provision`](../docs/skills/provision/SKILL.md) | Ship to Cloudflare Workers or ChatGPT Sites with production sign-in. |
20
20
  | [`media-gc`](../docs/skills/media-gc/SKILL.md) | Audit or remove stale, uncommitted R2 uploads. |
21
+ | [`performance`](../docs/skills/performance/SKILL.md) | Make an accepted app fast: Lighthouse, cold start, backend load, indexes and Views. Runs after acceptance converges. |
21
22
 
22
23
  ## Install
23
24
 
@@ -27,10 +28,12 @@ release tag as the application's SDK; alpha releases on `develop` can be newer
27
28
  than the default `main` branch. For a skill-only installation:
28
29
 
29
30
  ```sh
30
- npx skills add https://github.com/aotter/mantle/tree/v0.2.0-alpha.9 --skill mantle
31
+ npx skills add aotter/mantle@mantle
31
32
  ```
32
33
 
33
- The explicit skill name excludes repository maintainer skills. The manifests
34
+ Without a version it follows `main`, the latest stable release; pin the SDK's
35
+ release tag with `npx skills add aotter/mantle#v0.2.1-alpha.1@mantle`.
36
+ The explicit skill name (`@mantle`) excludes repository maintainer skills. The manifests
34
37
  are generated by `scripts/sync-plugin-manifests.mjs` and checked with `--check`.
35
38
  When upgrading, update the marketplace ref or local tagged checkout and refresh
36
39
  the plugin. Verify the loaded manifest version; Claude Code's plugin version
@@ -53,6 +56,7 @@ each other: `metadata.projection` is `plugin` for `skills/mantle` and
53
56
  | `update` | an SDK upgrade | never overwrite application files; 0.1.x moves by the upgrade guide to a new database | package | — |
54
57
  | `provision` | ship to production | secrets never in source, chat or logs; a new database for 0.2; self-hosting is always an option | package | Creates remote resources and handles production secrets; opt-in only. |
55
58
  | `media-gc` | stale R2 uploads | audit by default; exact keys only, never a prefix delete; re-audit before applying | package | Destructive remote object deletion and Cloudflare-specific; opt-in only. |
59
+ | `performance` | converged acceptance, a slow page, first request or query | accepted behavior only; never trade scope, authorization, OCC or atomicity for speed; local unless deployment is authorized | package | — |
56
60
 
57
61
  ## Audience
58
62
 
@@ -17,9 +17,19 @@ authority: `node_modules/@aotter/mantle/README.md` and
17
17
  `node_modules/@aotter/mantle/docs/`. Prefer them over this file, the SDK
18
18
  checkout, or any online copy.
19
19
 
20
+ ## Start with `mantle help`
21
+
22
+ Run `mantle help` first (in a project: `npx mantle help`; before one exists:
23
+ `npx @aotter/mantle@<exact version> help`). It prints the installed version's
24
+ entry page and every topic; `mantle help <topic>` prints one page with the next
25
+ and linked topics as commands. Follow it rather than browsing the SDK checkout
26
+ or an online copy.
27
+
20
28
  ## Find the project and its version
21
29
 
22
30
  Work in the user's application, outside the SDK checkout. Read package.json, the lockfile, installed SDK README and node_modules/@aotter/mantle/docs/. Those files define the exact version's contract. Preserve existing identity, handles, routes and resources.
31
+ For existing older applications, use their installed docs until the user requests an upgrade; if an older version
32
+ lacks a guide named here, record the missing guidance and keep that version's contract.
23
33
 
24
34
  ## Choose the installed package skill
25
35
 
@@ -28,130 +38,53 @@ Work in the user's application, outside the SDK checkout. Read package.json, the
28
38
  - Read `node_modules/@aotter/mantle/docs/skills/update/SKILL.md` to upgrade Mantle, including from 0.1.x.
29
39
  - Read `node_modules/@aotter/mantle/docs/skills/provision/SKILL.md` only for an authorized production deployment.
30
40
  - Read `node_modules/@aotter/mantle/docs/skills/media-gc/SKILL.md` only to audit or remove stale uncommitted media uploads.
41
+ - Read `node_modules/@aotter/mantle/docs/skills/performance/SKILL.md` after acceptance converges, or when a page, first request or query is slow.
31
42
 
32
- For a new project, install an exact published SDK version with matching selected Admin/UI packages. Node must be 22.22 or newer. Add TypeScript and target types; Workers also need Wrangler. `node_modules/@aotter/mantle/docs/examples/app-shell/package.json` lists the Wrangler, TypeScript and type-package versions this release is tested with. Optional auth/MCP peers use the installed SDK's package.json versions. Read the installed handbook's start/project-and-cli.md before choosing a target.
33
-
34
- For a new Cloudflare app, copy `node_modules/@aotter/mantle/docs/examples/app-shell/` first, then the closest example from `docs/examples/README.md` on top of it, and edit from there: manifests, `src/handlers.ts`, `src/routes.ts`, `src/schedule.ts`, `smoke.mjs`. Search for `AGENT:` to find what the app must fill in; the example pages are unstyled on purpose, so styling them is part of that work. Before reporting done, resolve each `AGENT:` or name the ones you left. Keep the two roles `admin` and `user` unless the user asks for more.
35
-
36
- Before reporting any user-facing work as done, follow the installed
37
- `node_modules/@aotter/mantle/docs/handbook/guides/agent-workflow-acceptance.md`:
38
- run independent acceptance with a fresh agent on the surface its user uses.
39
- This is not limited to MCP; if it was not run, say so explicitly and report the
40
- work as UNVERIFIED rather than done. For MCP workflows, also run the guide's
41
- design audit before implementing tools. This workflow practice applies to every
42
- installed SDK version: if its guide is older or MCP-scoped, apply its fresh-agent
43
- round loop to the user-facing surface actually built. If an older installed
44
- version lacks this guide, record the missing guidance and preserve that version's
45
- contract; do not silently upgrade or substitute checkout/online docs.
46
-
47
- For existing older applications, use their installed docs until the user requests an upgrade. For partial adoption read node_modules/@aotter/mantle/docs/skills/integrate/SKILL.md.
48
-
49
- ## Generated native applications
50
-
51
- Follow the installed (or workspace-linked) package README for generation, Workers
52
- builds and D1 Sessions; the app owns its entry and routing. Read that
53
- version's `docs/handbook/reference/features.md` before choosing declarations. Keep auth behind
54
- `authLoader(() => import(...))` to pass the startup guard. Install only the exact
55
- released version shown by the installed/target package
56
- contract. Replacing Core needs explicit app wiring and reviewed deployment
57
- migrations; never use initial schema.sql as an in-place production upgrade.
58
- Pass outgoing `responseHeaders` to `resolveCaller` so Better Auth's session cookie
59
- can slide. Native auth adapters use joins by default; keep the joined primary
60
- session/user check, including before any refresh from secondary storage.
61
- Only positively classified View/web reads may pass `readOnly: true`, with official
62
- cookieCache `{enabled:true,maxAge:60,refreshCache:false,version:"read-60-v1"}` and
63
- no KV. Bump version when enabling/changing the policy; writes, Admin, consent,
64
- unknown/ref/media calls stay fresh. Read the installed auth docs before MCP caching.
65
-
66
- Use the workflow **generate → implement listed handlers → check**. In an app
67
- copied from the installed app shell, its scripts are the canonical commands:
68
-
69
- ```sh
70
- pnpm generate
71
- pnpm check
72
- ```
73
- Implement every printed `Handlers` key
74
- and pass the implementations at `store(db, caller, { handlers })` (and selected
75
- surface options).
76
- Generated Store metadata initializes on its first use, once per module. Bind
77
- `store(db, caller, options?)` for the current request; never reuse one caller's
78
- bound Store for another caller.
79
-
80
- Use `paged/views/<encoded-name>.ts` for bounded cursor walks, including internal
81
- Views that satisfy the installed package's generation-time paging proofs.
82
- Call its default export with `(db, caller, input, { limit?, cursor? })`; it returns
83
- `{ rows, nextCursor? }`. Internal paging creates no public route/tool. Keep bare
84
- Views for authored-query row arrays, and inspect native EXPLAIN/source indexes
85
- when grouping: cursor paging does not eliminate aggregation work.
86
- Bare Views, Store and SQL Procedure results keep driver-native scalar values.
87
- Selected REST/MCP/Admin boundaries return target-identical `WireRow` types:
88
- declared integers become safe numbers or exact decimal strings, SQLite/D1
89
- JSON/booleans become JSON values/booleans, and compiler-declared decimals become
90
- strings. Selected SQL reads integer text before driver rounding; it cannot repair
91
- already-rounded writes. Use exported `WireRow` for clients and `Row` for bare
92
- queries. Computed/ref results remain app-owned.
93
-
94
- Commit everything `mantle generate` writes, including generated TypeScript, SQL and
95
- Wrangler edits; keep bundle `dist/` untracked. Never hand-edit generated files.
96
- Resolve conflicts by merging manifests/options and regenerating. Add the printed
97
- `.gitattributes` line and run the same generate command with `--check` in CI.
98
- Compose the app-owned `fetch` using `docs/handbook/cloudflare/service-entry.md`: auth/consent, Admin,
99
- MCP, REST behind one request-local origin-checked resolver; keep heavy auth dynamic.
100
- Pair every HTTP Trigger with an MCP Trigger by default; see `docs/handbook/reference/trigger.md` for the generate warning and deliberate asymmetry exception.
101
-
102
- For selected native Admin, follow the version-matched
103
- `docs/handbook/guides/native-admin.md`: select `--admin` (or `admin: true`), then
104
- build and serve the application-owned Admin with `mantle bundle` as that guide
105
- describes.
106
- Admin reads share generated whitelisted native View templates, writes use native
107
- Procedure fragments and generated checks. Ref operations retain typed `ctx.store`
108
- at request time. Verify member/frontend and admin/Admin OTP, tenant/privacy/TTL,
109
- publishing, paging, statistics, exact OCC, ref effects and the actual console;
110
- never retry unknown 503 writes automatically. Read the installed Admin README
111
- for raw-body limits, CSP/assets, 22 languages and the developer workspace.
112
- Use only versions actually published, or the explicitly linked workspace packages.
113
-
114
- For generated native applications, optional site settings/media are selected
115
- with `--site <module>` exporting `siteDefaults`. Apply the emitted deployment DDL;
116
- wire application-owned object storage as documented in `docs/handbook/cloudflare/media-r2.md`.
117
-
118
- For a generated public website, follow [web mounting and acceptance](references/web.md).
119
- The app renders HTML and inserts `site.head()`; generated `web.ts` serves the
120
- indexes and Markdown alternates.
121
-
122
- ## Complete websites
123
-
124
- For a requested complete website, apply [website defaults](references/website.md)
125
- without asking the user to enumerate OTP, media, Admin or SEO. Defaults are
126
- acceptance requirements, not evidence that a missing renderer is implemented.
127
- Do not report a complete website with blocked required checks.
128
-
129
- Run the [local HTTP acceptance](references/local-testing.md) for handlers and selected interfaces; compilation does not execute their behavior. Account for every declared interface as verified, intentionally not exposed, or deferred/unverified with a reason in the existing application handoff. An early preview may defer remote MCP; preserve that pending work. WebMCP, cookie-session discovery and OAuth Bearer/client integration are separate checks.
130
-
131
- ## Self-hosted deployment
132
-
133
- Deploy only when the user requests it. Follow the application's selected host
134
- and the installed `docs/skills/provision/SKILL.md`; use the platform's native
135
- workflow. Local project creation alone is not deployment authorization.
43
+ ## New application
136
44
 
137
- ## Existing project and handoff
45
+ Node must be 22.22 or newer. Stable 0.2.0 is available as `@aotter/mantle@0.2.0`; pin selected Mantle packages to that exact version. Create it with `npx @aotter/mantle@<exact version> init <directory>`, then follow
46
+ `mantle help` ("Build from a product brief") and the app's `README.md`. Without the user listing them, a complete app
47
+ includes:
48
+
49
+ - Email OTP sign-in, the two roles `admin` and `user`, Admin for `admin`, MCP for both roles (`/mcp`, `/mcp/admin`)
50
+ and REST: the shell already wires them; keep them.
51
+ - Real business rules in SQL Procedures (`mantle help sql-patterns`), not in handler code around separate writes.
52
+ - For visitor pages, everything in `mantle help public-pages` (SEO, AEO, sitemap, robots, `llms.txt`), styled.
53
+ - Local HTTP checks (`mantle help local-testing`), then independent acceptance with `pnpm accept`
54
+ (`mantle help agent-workflow-acceptance`), then the installed `docs/skills/performance/SKILL.md`.
55
+
56
+ Take patterns from `mantle help examples` into the app's own manifests and `src/`; do not copy an example directory
57
+ over the app. Resolve each `AGENT:` or name the ones you left. Generation only, inside an app you already have: skip
58
+ `init` and use `mantle generate` (`mantle help project-and-cli`).
138
59
 
139
- Preserve the user's manifests, `src/` files, identity, package versions and
140
- provider resources. The app writes its entry (`src/worker.ts` by default;
141
- `--entry` selects another). Workers generation creates or updates Wrangler's
142
- split-build settings and public-fetch compatibility flags. Run the same generation command (target, output directory,
143
- manifests and options) with `--check`, and the project's own tests,
144
- before and after a change.
60
+ ## Accept before reporting done
145
61
 
146
- To add Mantle to an application that has its own code, users and data, read
147
- `node_modules/@aotter/mantle/docs/skills/integrate/SKILL.md` first.
62
+ Before reporting any new app or feature as done, follow `mantle help agent-workflow-acceptance`: a private rubric,
63
+ then one fresh agent per role given only its role and the URLs `pnpm accept` prints, at most three rounds. The first
64
+ delivery covers every role and surface; after a repair, the guide's "Re-verify what a repair touches" rule decides what
65
+ re-runs: a page-only repair re-runs the affected UI, while auth, scope, SQL Procedure, unique index or shared-transport changes widen
66
+ to every surface they reach. State the round and revision of any evidence you reuse. If it was
67
+ not run, report the work as UNVERIFIED rather than done; if it could not run, BLOCKED. Report status per layer as that
68
+ guide's "Report done-ness in layers" defines; a block from your environment (approval policy, missing browser,
69
+ network) is BLOCKED on its layer, not a product failure, and does not discard the other layers.
148
70
 
149
- Report the project path, the exact Mantle version, what you changed, the checks
150
- you ran with their results, the independent acceptance verdict (CONVERGED / NOT
151
- CONVERGED / BLOCKED / UNVERIFIED), and anything left for the user.
71
+ Once acceptance is CONVERGED, read the installed `docs/skills/performance/SKILL.md`: it decides which of front end,
72
+ cold start and backend load apply, and runs them before you report done. This is the one exception to installed docs
73
+ winning: if the installed package predates that skill, read
74
+ [the 0.2.1 copy](https://github.com/aotter/mantle/blob/v0.2.1/docs/skills/performance/SKILL.md) and the pages it links
75
+ from the installed docs with `mantle help <topic>`.
76
+
77
+ ## Deployment
78
+
79
+ Deploy only when the user requests it, following the installed `docs/skills/provision/SKILL.md` and the selected
80
+ host's native workflow. Local project creation alone is not deployment authorization.
81
+
82
+ ## Existing project and handoff
152
83
 
153
- ## Data paths
84
+ Preserve the user's manifests, `src/` files, identity, package versions and provider resources. Run the project's
85
+ generate command with `--check` and its own tests before and after a change.
154
86
 
155
- Follow the installed `docs/handbook/guides/typed-queries.md` for Store,
156
- Procedure and View data paths; the service composition guide owns request-local
157
- Caller binding.
87
+ Report the project path, the exact Mantle version, what you changed, the four-layer status with each layer's checks
88
+ and results (the independent acceptance verdict, CONVERGED / BLOCKED / UNVERIFIED, is layer 3), the performance verdict
89
+ (PASS / PARTIAL / SKIPPED) with its before and after numbers, and anything left for the user, including what would
90
+ unblock a BLOCKED layer.