@aotter/mantle 0.1.2-alpha.6 → 0.1.2
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/README.md +15 -10
- package/dist/cli/generate.d.ts +9 -0
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +40 -1
- package/dist/cli/generate.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +37 -9
- package/dist/cli/main.js.map +1 -1
- package/docs/adapter-guide.md +6 -1
- package/docs/adr/adr-lite-845-frontend-client.md +38 -0
- package/docs/agent-prompts.md +91 -0
- package/docs/api-mcp-authorization.md +1 -1
- package/docs/auth-hosting-model.md +1 -1
- package/docs/examples/README.md +22 -0
- package/docs/examples/builtin-commerce.md +269 -0
- package/docs/examples/builtin-intake.md +143 -0
- package/docs/examples/builtin-legal-documents.md +189 -0
- package/docs/examples/builtin-procurement.md +241 -0
- package/docs/examples/builtin-publication.md +241 -0
- package/docs/examples/builtin-reservation.md +149 -0
- package/docs/examples/cf-primitives-commerce-inventory.md +809 -0
- package/docs/examples/cf-primitives-guarded-api.md +429 -0
- package/docs/examples/cf-primitives-intake-hooks.md +319 -0
- package/docs/examples/host-chatgpt-sites/.openai/hosting.json +1 -0
- package/docs/examples/host-chatgpt-sites/README.md +53 -0
- package/docs/examples/host-chatgpt-sites/drizzle/0000_sites_users.sql +8 -0
- package/docs/examples/host-chatgpt-sites/drizzle/0001_mantle.sql +294 -0
- package/docs/examples/host-chatgpt-sites/drizzle/0002_article_cover.sql +5 -0
- package/docs/examples/host-chatgpt-sites/drizzle/meta/_journal.json +1 -0
- package/docs/examples/host-chatgpt-sites/manifests/site.yaml +27 -0
- package/docs/examples/host-chatgpt-sites/package.json +1 -0
- package/docs/examples/host-chatgpt-sites/public/site.css +1 -0
- package/docs/examples/host-chatgpt-sites/scripts/build.mjs +12 -0
- package/docs/examples/host-chatgpt-sites/scripts/check.mjs +99 -0
- package/docs/examples/host-chatgpt-sites/scripts/migration.mjs +9 -0
- package/docs/examples/host-chatgpt-sites/src/chatgpt-auth.ts +63 -0
- package/docs/examples/host-chatgpt-sites/src/index.ts +46 -0
- package/docs/examples/host-chatgpt-sites/src/mcp.ts +49 -0
- package/docs/examples/host-chatgpt-sites/src/media.ts +109 -0
- package/docs/examples/host-chatgpt-sites/src/r2-lab.ts +38 -0
- package/docs/examples/host-chatgpt-sites/src/storage-fingerprint.json +1 -0
- package/docs/examples/host-chatgpt-sites/src/web.ts +35 -0
- package/docs/examples/host-chatgpt-sites/tsconfig.json +1 -0
- package/docs/examples/host-chatgpt-sites/wrangler.jsonc +10 -0
- package/docs/examples/host-local-admin-otp/.dev.vars.example +3 -0
- package/docs/examples/host-local-admin-otp/README.md +70 -0
- package/docs/examples/host-local-admin-otp/ensure-dev-vars.mjs +5 -0
- package/docs/examples/host-local-admin-otp/package.json +29 -0
- package/docs/examples/host-local-admin-otp/public/.gitkeep +1 -0
- package/docs/examples/host-local-admin-otp/smoke.mjs +141 -0
- package/docs/examples/host-local-admin-otp/src/index.ts +54 -0
- package/docs/examples/host-local-admin-otp/wrangler.jsonc +23 -0
- package/docs/examples/{minimal-worker → host-minimal-worker}/README.md +9 -5
- package/docs/examples/host-minimal-worker/manifests/site.yaml +25 -0
- package/docs/examples/{minimal-worker → host-minimal-worker}/package.json +3 -3
- package/docs/examples/host-minimal-worker/tsconfig.json +17 -0
- package/docs/handbook/cloudflare/authentication.md +17 -2
- package/docs/handbook/cloudflare/bindings.md +9 -7
- package/docs/handbook/cloudflare/chatgpt-sites.md +29 -0
- package/docs/handbook/cloudflare/conventional-worker.md +3 -3
- package/docs/handbook/cloudflare/deferred-hooks-queues.md +0 -1
- package/docs/handbook/cloudflare/deploy-and-operate.md +14 -20
- package/docs/handbook/cloudflare/media-r2.md +2 -2
- package/docs/handbook/cloudflare/public-web.md +1 -1
- package/docs/handbook/cloudflare/site-chrome.md +75 -0
- package/docs/handbook/concepts/authorization.md +2 -2
- package/docs/handbook/concepts/four-atoms.md +2 -2
- package/docs/handbook/concepts/lifecycle-and-locales.md +1 -1
- package/docs/handbook/concepts/mcp-and-agents.md +1 -1
- package/docs/handbook/concepts/procedures-and-triggers.md +1 -1
- package/docs/handbook/concepts/runtime-and-adapters.md +2 -2
- package/docs/handbook/concepts/views.md +2 -2
- package/docs/handbook/examples/commerce-transaction.md +4 -806
- package/docs/handbook/examples/commerce.md +11 -0
- package/docs/handbook/examples/guarded-api.md +3 -420
- package/docs/handbook/examples/hub.md +10 -0
- package/docs/handbook/examples/intake-form.md +6 -313
- package/docs/handbook/examples/intake-hooks.md +11 -0
- package/docs/handbook/examples/legal-documents.md +3 -211
- package/docs/handbook/examples/procurement-approvals.md +3 -233
- package/docs/handbook/examples/publication.md +3 -233
- package/docs/handbook/examples/reservation.md +3 -213
- package/docs/handbook/navigation.json +17 -2
- package/docs/handbook/reference/authorization.md +1 -1
- package/docs/handbook/reference/procedure.md +2 -2
- package/docs/handbook/reference/schema.md +3 -3
- package/docs/handbook/reference/site-config.md +5 -16
- package/docs/handbook/reference/surface.md +3 -7
- package/docs/handbook/sites/equipment-checkout.md +231 -0
- package/docs/handbook/sites/host-reference.md +113 -0
- package/docs/handbook/sites/index.md +111 -0
- package/docs/handbook/start/project-and-cli.md +22 -14
- package/docs/handbook/start/quickstart-admin.md +239 -0
- package/docs/handbook/start/quickstart-worker.md +22 -23
- package/docs/migration-0.1.2.md +26 -0
- package/docs/release-process.md +92 -7
- package/docs/sealed-pipeline-ownership.md +2 -2
- package/docs/spec-only-host-adoption.md +3 -4
- package/docs/transaction-patterns.md +2 -2
- package/package.json +15 -15
- package/skills/README.md +18 -2
- package/skills/develop/SKILL.md +32 -23
- package/skills/install/SKILL.md +50 -11
- package/skills/provision/SKILL.md +21 -5
- /package/docs/examples/{minimal-worker → host-local-admin-otp}/manifests/site.yaml +0 -0
- /package/docs/examples/{minimal-worker → host-local-admin-otp}/tsconfig.json +0 -0
- /package/docs/examples/{minimal-worker → host-minimal-worker}/smoke.mjs +0 -0
- /package/docs/examples/{minimal-worker → host-minimal-worker}/src/index.ts +0 -0
- /package/docs/examples/{minimal-worker → host-minimal-worker}/wrangler.jsonc +0 -0
package/skills/develop/SKILL.md
CHANGED
|
@@ -17,12 +17,11 @@ docs govern runtime/API behavior.
|
|
|
17
17
|
## First Read
|
|
18
18
|
|
|
19
19
|
1. `package.json` for the installed `@aotter/mantle*` versions.
|
|
20
|
-
2. `manifests/site.yaml`, the active adapter config
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
5. Installed Core docs in `node_modules/@aotter/mantle/docs/`.
|
|
20
|
+
2. `manifests/site.yaml`, the active adapter config (`wrangler.jsonc`), and
|
|
21
|
+
the Worker entry. Custom Auth lives in that entry's `createAuth` factory.
|
|
22
|
+
3. Optional local context: `.mantle/plugins.json`, `.mantle/plugins.lock.json`,
|
|
23
|
+
and `.mantle/recipes/`. Legacy launch/handoff files are context only.
|
|
24
|
+
4. Installed Core docs in `node_modules/@aotter/mantle/docs/`.
|
|
26
25
|
|
|
27
26
|
If `node_modules/` is missing, run `pnpm install --frozen-lockfile` before
|
|
28
27
|
falling back to remote docs. Remote docs must use a tag matching the installed
|
|
@@ -30,9 +29,14 @@ version; never use `develop` branch docs for a versioned consumer project.
|
|
|
30
29
|
|
|
31
30
|
## Existing Examples
|
|
32
31
|
|
|
33
|
-
Read installed `docs/handbook/start/project-and-cli.md
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
Read installed `docs/handbook/start/project-and-cli.md` and
|
|
33
|
+
`docs/examples/README.md`. Use `docs/examples/host-minimal-worker/` for Spec +
|
|
34
|
+
adapter without Admin. Read `docs/examples/host-local-admin-otp/` only when the
|
|
35
|
+
project already has Admin or the human asked for Dev UI — that path is opt-in.
|
|
36
|
+
Ingest only `docs/examples/builtin-*.md` Manifests as grammar for new domains.
|
|
37
|
+
Read `docs/examples/cf-primitives-*.md` before inventing Durable Object, Queue,
|
|
38
|
+
cron, or `ref` handler patterns.
|
|
39
|
+
References are test/documentation, not a Starter or a fixed application shape.
|
|
36
40
|
|
|
37
41
|
Public rendering is opt-in consumer wiring: `mountPublicRoutes`, a
|
|
38
42
|
`TemplateRegistry`, and a matching `publicPathResolver` must agree on the
|
|
@@ -53,7 +57,8 @@ pnpm validate
|
|
|
53
57
|
```
|
|
54
58
|
|
|
55
59
|
This CLI validates and derives artifacts from application-authored manifests.
|
|
56
|
-
It does not create projects, business schemas or a visitor homepage.
|
|
60
|
+
It does not create projects, business schemas or a visitor homepage. There is
|
|
61
|
+
no `mantle create` / `mantle update` happy path.
|
|
57
62
|
|
|
58
63
|
## Core Model
|
|
59
64
|
|
|
@@ -72,11 +77,10 @@ the atoms cannot express the behavior.
|
|
|
72
77
|
|
|
73
78
|
## Content Edits
|
|
74
79
|
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
for runtime-backed content.
|
|
80
|
+
- Follow the actual frontend content source. Use Admin or Staff MCP for
|
|
81
|
+
runtime-backed content. Do not invent an overlay/seed homepage.
|
|
78
82
|
- For a new submitted field, update the stored `Schema` and the public
|
|
79
|
-
`Procedure.spec.input` before
|
|
83
|
+
`Procedure.spec.input` before any form UI. Keep public mutation inputs
|
|
80
84
|
`additionalProperties: false`; otherwise JSON Schema's default may strip an
|
|
81
85
|
undeclared field while returning success.
|
|
82
86
|
- Use `lifecycle: operational` for submissions, inquiries, orders, and other
|
|
@@ -134,13 +138,20 @@ teaching the project Mantle internals.
|
|
|
134
138
|
|
|
135
139
|
## Auth Composition
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
Admin is opt-in. A project without `@aotter/mantle-admin-ui` is complete.
|
|
142
|
+
When Admin is installed, `createMantleWorker({ auth })` with `email-otp`
|
|
143
|
+
and `ConsoleEmailSender` is the local human path (OTP in wrangler logs).
|
|
144
|
+
That override owns Auth construction; Core still owns `/admin` and
|
|
145
|
+
`/api/auth/*`. Admin also requires wrangler `assets.directory=./public`
|
|
146
|
+
and an `ASSETS` binding. A white screen at `/admin` with HTML 200 and
|
|
147
|
+
`/_mantle/admin/assets/*` 404 is a missing assets binding, not a missing
|
|
148
|
+
frontend build.
|
|
149
|
+
|
|
150
|
+
Conventional Cloudflare projects that do not replace Auth declare
|
|
151
|
+
`MANTLE_AUTH_MODE=hosted` or `self-managed`; Core owns that standard
|
|
152
|
+
composition and rejects partial or mixed bindings. Preserve the explicit
|
|
153
|
+
mode recorded in Worker config, keep provider secrets out of source, and
|
|
154
|
+
do not infer a mode from whichever credentials happen to be present.
|
|
144
155
|
|
|
145
156
|
## Performance Loop
|
|
146
157
|
|
|
@@ -213,8 +224,6 @@ cache.
|
|
|
213
224
|
|
|
214
225
|
- Keep content models in the configured manifest directory; its immediate
|
|
215
226
|
`.yaml` and `.yml` files are loaded together.
|
|
216
|
-
- Use a generated overlay `seed.json` for the auth-free local first page when
|
|
217
|
-
it is already imported by `src/web/content/*`.
|
|
218
227
|
- Add TypeScript only for handlers, rendering, adapter wiring, or real behavior.
|
|
219
228
|
- Do not write directly to D1, KV, Postgres, or object storage for content
|
|
220
229
|
authoring. Use runtime use cases, admin APIs, or Staff MCP.
|
package/skills/install/SKILL.md
CHANGED
|
@@ -21,18 +21,53 @@ turn `generate` into implicit scaffolding.
|
|
|
21
21
|
1. Determine the actual host and required surfaces from the request. Reuse an
|
|
22
22
|
existing application when available; otherwise work in its own directory.
|
|
23
23
|
Do not assume Cloudflare, public HTML or Admin is required. Check Node 22+
|
|
24
|
-
and pnpm 9+ for these SDK examples.
|
|
24
|
+
and pnpm 9+ for these SDK examples. A ChatGPT Site is not a conventional
|
|
25
|
+
Cloudflare Worker deployment; use the installed
|
|
26
|
+
`docs/handbook/sites/index.md` integration guide and
|
|
27
|
+
`docs/examples/host-chatgpt-sites/` runnable reference when selected.
|
|
25
28
|
2. Choose the requested exact SDK version, or resolve the intended release
|
|
26
29
|
channel once. Pin all selected `@aotter/mantle*` dependencies to that same
|
|
27
30
|
version. Install only the adapter/optional packages the application needs.
|
|
28
31
|
If a global scope registry overrides public npmjs, use a project-owned
|
|
29
32
|
`.npmrc` with `@aotter:registry=https://registry.npmjs.org/`.
|
|
30
|
-
3.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
3. Interview the human for host and required surfaces. Do not assume Admin,
|
|
34
|
+
public HTML or Cloudflare. Scale:
|
|
35
|
+
- Spec + generate / embed Runtime — `docs/handbook/start/project-and-cli.md`.
|
|
36
|
+
- Adapter without Admin — `docs/examples/host-minimal-worker/`.
|
|
37
|
+
- Opt-in Admin / Dev UI — only when a human needs a console: interview
|
|
38
|
+
the bootstrap owner email, then `docs/examples/host-local-admin-otp/`
|
|
39
|
+
(`pnpm install && pnpm generate && pnpm dev`, `/admin/sign-in`, OTP
|
|
40
|
+
in wrangler logs). Admin needs `@aotter/mantle-admin`,
|
|
41
|
+
`@aotter/mantle-admin-ui`, wrangler `ASSETS` on `./public`, and
|
|
42
|
+
`createAuth` email-otp + `ConsoleEmailSender`. Do not Vite-build Admin.
|
|
43
|
+
- ChatGPT Sites with Admin/D1/R2 — follow
|
|
44
|
+
`docs/examples/host-chatgpt-sites/`, not the email-OTP Worker example.
|
|
45
|
+
Copy it outside the SDK checkout, then `npm ci`,
|
|
46
|
+
`npx mantle validate --phase deploy`, `npm run generate`, `npm run check`,
|
|
47
|
+
`npx wrangler d1 migrations apply DB --local`,
|
|
48
|
+
`npm run dev -- --port 4174`, and `npm test` in a second terminal.
|
|
49
|
+
Preserve its Sites-owned identity ingress and hosting manifest; author the
|
|
50
|
+
user's Schema/View/Procedure/Trigger, then review migrations, media policy
|
|
51
|
+
and the local/production smoke gates. Sites provisions and deploys; never
|
|
52
|
+
`wrangler deploy` a Site. Request both D1 and R2 when uploads are in scope.
|
|
53
|
+
Browser Admin WebMCP and Sites-session `/api/mcp/staff` do not enable remote staff OAuth MCP.
|
|
54
|
+
- ChatGPT Sites with custom business rules or an external callback — the
|
|
55
|
+
runnable reference covers builtin content only. For application-owned
|
|
56
|
+
operational state, `handler: { kind: ref }` Procedures, staff-only SQL
|
|
57
|
+
Views, staff MCP Triggers with `requires.auth`, and outbound webhooks
|
|
58
|
+
called from handler code, follow
|
|
59
|
+
`docs/handbook/sites/equipment-checkout.md`. It is an implementation
|
|
60
|
+
guide, not a shipped app: keep Mantle-owned Schema tables and
|
|
61
|
+
application-owned tables separate, and give every application table a
|
|
62
|
+
reviewed migration.
|
|
63
|
+
- Grammar — `docs/examples/README.md`. Copy `builtin-*` Manifests directly.
|
|
64
|
+
Read `cf-primitives-*` when the request needs Durable Objects, Queues,
|
|
65
|
+
cron, payment-provider callbacks, or API-key and entitlement guards;
|
|
66
|
+
those carry `ref` handlers and are not Builder-ingestible.
|
|
67
|
+
None of these is a template to install wholesale. Other hosts use the
|
|
68
|
+
embedded adapter guides. Author package scripts, manifests, entry and
|
|
69
|
+
configuration for the user's requirements. No default notes model, home
|
|
70
|
+
page, icon, launch metadata or visitor frontend is required.
|
|
36
71
|
4. Compile and verify using the application's commands. The fundamental CLI
|
|
37
72
|
sequence is:
|
|
38
73
|
|
|
@@ -44,10 +79,14 @@ pnpm exec mantle skills
|
|
|
44
79
|
pnpm exec mantle skills --check
|
|
45
80
|
```
|
|
46
81
|
|
|
47
|
-
Run the project's TypeScript check and start its actual local server. Probe
|
|
48
|
-
route the application declares
|
|
49
|
-
|
|
50
|
-
|
|
82
|
+
Run the project's TypeScript check and start its actual local server. Probe
|
|
83
|
+
a route the application declares. An API-only or adapter-only project may
|
|
84
|
+
correctly return 404 at `/` and have no Admin. When Admin was requested,
|
|
85
|
+
probe `/admin/sign-in` and a `/_mantle/admin/assets/*` URL — both must be
|
|
86
|
+
200. A white screen is an assets 404, not a missing frontend build.
|
|
87
|
+
Conventional Auth routes may return `503 setup_incomplete` until that mode
|
|
88
|
+
is configured; the local OTP path replaces construction instead. Do not
|
|
89
|
+
introduce an auth bypass to make smoke pass.
|
|
51
90
|
|
|
52
91
|
Commit the resolved lockfile in the application's normal workflow; subsequent
|
|
53
92
|
installs use `pnpm install --frozen-lockfile`. Do not initialize/push a remote,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: provision
|
|
3
|
-
description: Ship a
|
|
3
|
+
description: Ship a Mantle project through its selected host, routing ChatGPT Sites to its integration guide and conventional Cloudflare Workers to production auth and provisioning.
|
|
4
4
|
metadata:
|
|
5
5
|
source: "@aotter/mantle"
|
|
6
6
|
sourcePath: skills/provision/SKILL.md
|
|
@@ -12,7 +12,13 @@ metadata:
|
|
|
12
12
|
# Provision a Mantle Project
|
|
13
13
|
|
|
14
14
|
Local cold start deliberately stops before this skill. Provision only after the
|
|
15
|
-
user asks to create remote resources or ship production.
|
|
15
|
+
user asks to create remote resources or ship production. This flow is for
|
|
16
|
+
consumer-owned Cloudflare Workers. For a ChatGPT Site, use the installed
|
|
17
|
+
`docs/handbook/sites/index.md` integration guide and the "Publish with Sites"
|
|
18
|
+
steps in `docs/examples/host-chatgpt-sites/README.md`: request D1 and R2 on the
|
|
19
|
+
Site, set `PUBLIC_ORIGIN` and `OWNER_EMAIL` in Sites settings, review the
|
|
20
|
+
migration, then save and deploy a Sites version. Do not run `wrangler deploy`
|
|
21
|
+
or require R2 S3 credentials merely because Sites exposes an R2 binding.
|
|
16
22
|
|
|
17
23
|
## Source of Truth
|
|
18
24
|
|
|
@@ -59,8 +65,8 @@ directly; boot syncs its canonical origin from `PUBLIC_ORIGIN`.
|
|
|
59
65
|
|
|
60
66
|
## Choose Auth
|
|
61
67
|
|
|
62
|
-
- **Self-hosted
|
|
63
|
-
|
|
68
|
+
- **Self-hosted email OTP:** use the application's production transactional-email sender. Replace `ConsoleEmailSender`; never deploy it.
|
|
69
|
+
- **Self-hosted GitHub OAuth — free fallback:** use when the application has no email provider. Configure the owner's per-site GitHub OAuth App and Worker secrets using the steps below.
|
|
64
70
|
- **Mantle hosted auth — paid:** use only when the landing handoff records a
|
|
65
71
|
hosted allocation and client configuration. Mantle Platform operates the
|
|
66
72
|
identity provider; do not ask the user for a per-site GitHub OAuth App.
|
|
@@ -74,7 +80,17 @@ current Mantle landing flow explicitly supplies that handoff.
|
|
|
74
80
|
For the exact boundary, read
|
|
75
81
|
`node_modules/@aotter/mantle/docs/auth-hosting-model.md`.
|
|
76
82
|
|
|
77
|
-
## Self-hosted
|
|
83
|
+
## Self-hosted email OTP
|
|
84
|
+
|
|
85
|
+
Keep the application's custom `createAuth()` factory, replace
|
|
86
|
+
`ConsoleEmailSender` with its production `EmailSender`, and retain
|
|
87
|
+
`bootstrapOwner: { match: "email", value: <owner email> }`. Store sender
|
|
88
|
+
credentials and `BETTER_AUTH_SECRET` as Worker secrets, put `PUBLIC_ORIGIN` in
|
|
89
|
+
non-secret vars, deploy, then verify that the owner receives an OTP at
|
|
90
|
+
`/admin/sign-in`. If there is no production email provider, use GitHub OAuth
|
|
91
|
+
below instead of deploying console delivery.
|
|
92
|
+
|
|
93
|
+
## Self-hosted GitHub OAuth
|
|
78
94
|
|
|
79
95
|
1. Ask the user to create a GitHub OAuth App:
|
|
80
96
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|