@aotter/mantle 0.1.3 → 0.1.5-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 (105) hide show
  1. package/README.md +20 -20
  2. package/dist/cli/generate-cloudflare.d.ts +7 -0
  3. package/dist/cli/generate-cloudflare.d.ts.map +1 -0
  4. package/dist/cli/generate-cloudflare.js +123 -0
  5. package/dist/cli/generate-cloudflare.js.map +1 -0
  6. package/dist/cli/generate-project.d.ts +25 -0
  7. package/dist/cli/generate-project.d.ts.map +1 -0
  8. package/dist/cli/generate-project.js +282 -0
  9. package/dist/cli/generate-project.js.map +1 -0
  10. package/dist/cli/generate-sites.d.ts +8 -0
  11. package/dist/cli/generate-sites.d.ts.map +1 -0
  12. package/dist/cli/generate-sites.js +273 -0
  13. package/dist/cli/generate-sites.js.map +1 -0
  14. package/dist/cli/generate.d.ts.map +1 -1
  15. package/dist/cli/generate.js +121 -10
  16. package/dist/cli/generate.js.map +1 -1
  17. package/dist/cli/main.d.ts +1 -1
  18. package/dist/cli/main.d.ts.map +1 -1
  19. package/dist/cli/main.js +11 -11
  20. package/dist/cli/skills.js +1 -1
  21. package/dist/cli/skills.js.map +1 -1
  22. package/docs/adr/0001-four-atom-manifest-model.md +3 -2
  23. package/docs/adr/0013-agent-provisioned-consumer-projects.md +4 -4
  24. package/docs/adr/0016-site-semantic-layer.md +5 -4
  25. package/docs/adr/0018-core-starters-repository-boundary.md +1 -1
  26. package/docs/adr/0021-retire-starter-scaffolding.md +1 -1
  27. package/docs/adr/0026-progressive-generate.md +36 -0
  28. package/docs/adr/0027-scheduled-procedure-triggers.md +31 -0
  29. package/docs/adr/0028-schema-ttl-expiry.md +33 -0
  30. package/docs/adr/README.md +7 -4
  31. package/docs/agent-prompts.md +41 -78
  32. package/docs/assets/mantle-admin-developer.png +0 -0
  33. package/docs/examples/README.md +1 -1
  34. package/docs/examples/host-chatgpt-sites/README.md +29 -12
  35. package/docs/examples/host-chatgpt-sites/drizzle/0003_store_instance_id.sql +1 -0
  36. package/docs/examples/host-chatgpt-sites/drizzle/0004_mantle.sql +10 -0
  37. package/docs/examples/host-chatgpt-sites/drizzle/0005_mantle.sql +24 -0
  38. package/docs/examples/host-chatgpt-sites/drizzle/meta/_journal.json +1 -1
  39. package/docs/examples/host-chatgpt-sites/drizzle/meta/mantle-state.json +60 -0
  40. package/docs/examples/host-chatgpt-sites/package.json +1 -1
  41. package/docs/examples/host-chatgpt-sites/public/site.css +1 -1
  42. package/docs/examples/host-chatgpt-sites/scripts/build.mjs +2 -1
  43. package/docs/examples/host-chatgpt-sites/scripts/check.mjs +2 -0
  44. package/docs/examples/host-chatgpt-sites/scripts/migration.mjs +42 -8
  45. package/docs/examples/host-chatgpt-sites/src/chatgpt-auth.ts +9 -6
  46. package/docs/examples/host-chatgpt-sites/src/index.ts +1 -1
  47. package/docs/examples/host-chatgpt-sites/src/web.ts +1 -1
  48. package/docs/examples/host-local-admin-otp/package.json +2 -2
  49. package/docs/examples/host-minimal-worker/README.md +5 -5
  50. package/docs/examples/host-minimal-worker/package.json +2 -2
  51. package/docs/handbook/{sites → chatgpt-sites}/equipment-checkout.md +1 -1
  52. package/docs/handbook/chatgpt-sites/generated-app.md +84 -0
  53. package/docs/handbook/{sites → chatgpt-sites}/index.md +35 -13
  54. package/docs/handbook/cloudflare/authentication.md +19 -2
  55. package/docs/handbook/cloudflare/bindings.md +4 -11
  56. package/docs/handbook/cloudflare/chatgpt-sites.md +6 -6
  57. package/docs/handbook/cloudflare/conventional-worker.md +7 -3
  58. package/docs/handbook/cloudflare/deploy-and-operate.md +4 -3
  59. package/docs/handbook/cloudflare/media-r2.md +2 -2
  60. package/docs/handbook/concepts/four-atoms.md +1 -1
  61. package/docs/handbook/concepts/lifecycle-and-locales.md +1 -1
  62. package/docs/handbook/concepts/mcp-and-agents.md +24 -4
  63. package/docs/handbook/concepts/procedures-and-triggers.md +1 -1
  64. package/docs/handbook/concepts/runtime-and-adapters.md +8 -1
  65. package/docs/handbook/concepts/views.md +1 -1
  66. package/docs/handbook/guides/agent-setup.md +8 -7
  67. package/docs/handbook/navigation.json +7 -6
  68. package/docs/handbook/reference/diagnostics.md +5 -0
  69. package/docs/handbook/reference/procedure.md +52 -1
  70. package/docs/handbook/reference/schema.md +27 -1
  71. package/docs/handbook/reference/surface.md +3 -3
  72. package/docs/handbook/reference/trigger.md +21 -1
  73. package/docs/handbook/releases/index.md +81 -1
  74. package/docs/handbook/start/overview.md +6 -3
  75. package/docs/handbook/start/project-and-cli.md +103 -119
  76. package/docs/handbook/start/quickstart-admin.md +6 -4
  77. package/docs/handbook/start/quickstart-worker.md +17 -11
  78. package/docs/release-process.md +3 -2
  79. package/docs/sealed-pipeline-ownership.md +1 -1
  80. package/docs/skills/develop/SKILL.md +258 -0
  81. package/docs/skills/integrate/SKILL.md +60 -0
  82. package/docs/skills/media-gc/SKILL.md +85 -0
  83. package/docs/skills/plugin/SKILL.md +132 -0
  84. package/docs/skills/provision/SKILL.md +194 -0
  85. package/docs/skills/theme/SKILL.md +77 -0
  86. package/docs/skills/update/SKILL.md +51 -0
  87. package/docs/spec-only-host-adoption.md +1 -1
  88. package/package.json +19 -18
  89. package/skills/README.md +28 -21
  90. package/skills/develop/SKILL.md +16 -8
  91. package/skills/install/SKILL.md +103 -128
  92. package/skills/integrate/SKILL.md +60 -0
  93. package/skills/media-gc/SKILL.md +2 -2
  94. package/skills/plugin/SKILL.md +2 -2
  95. package/skills/provision/SKILL.md +3 -3
  96. package/skills/theme/SKILL.md +2 -2
  97. package/skills/update/SKILL.md +2 -2
  98. package/templates/chatgpt-sites/auth.ts +66 -0
  99. package/templates/chatgpt-sites/build.mjs +14 -0
  100. package/templates/chatgpt-sites/env.ts +1 -0
  101. package/templates/chatgpt-sites/mcp.ts +48 -0
  102. package/templates/chatgpt-sites/public-mcp.ts +29 -0
  103. package/templates/chatgpt-sites/smoke-local.mjs +20 -0
  104. package/skills/.keep +0 -0
  105. /package/docs/handbook/{sites → chatgpt-sites}/host-reference.md +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aotter/mantle",
3
- "version": "0.1.3",
3
+ "version": "0.1.5-alpha.1",
4
4
  "description": "Embeddable Mantle Core umbrella with Spec and Runtime; Web, Admin, Auth, Bun, Vercel, Cloudflare, and Admin UI are optional peer packages.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://mantle.tools/",
@@ -80,11 +80,12 @@
80
80
  "dist",
81
81
  "docs",
82
82
  "skills",
83
+ "templates",
83
84
  "README.md"
84
85
  ],
85
86
  "dependencies": {
86
- "@aotter/mantle-runtime": "0.1.3",
87
- "@aotter/mantle-spec": "0.1.3"
87
+ "@aotter/mantle-runtime": "0.1.5-alpha.1",
88
+ "@aotter/mantle-spec": "0.1.5-alpha.1"
88
89
  },
89
90
  "peerDependencies": {
90
91
  "aws4fetch": "^1.0.20",
@@ -92,13 +93,13 @@
92
93
  "hono": "^4.12.0",
93
94
  "@libsql/client": "^0.17.4",
94
95
  "zod": "^4.5.0",
95
- "@aotter/mantle-admin": "0.1.3",
96
- "@aotter/mantle-admin-ui": "0.1.3",
97
- "@aotter/mantle-bun": "0.1.3",
98
- "@aotter/mantle-auth": "0.1.3",
99
- "@aotter/mantle-web": "0.1.3",
100
- "@aotter/mantle-cloudflare": "0.1.3",
101
- "@aotter/mantle-vercel": "0.1.3"
96
+ "@aotter/mantle-admin": "0.1.5-alpha.1",
97
+ "@aotter/mantle-admin-ui": "0.1.5-alpha.1",
98
+ "@aotter/mantle-auth": "0.1.5-alpha.1",
99
+ "@aotter/mantle-bun": "0.1.5-alpha.1",
100
+ "@aotter/mantle-cloudflare": "0.1.5-alpha.1",
101
+ "@aotter/mantle-vercel": "0.1.5-alpha.1",
102
+ "@aotter/mantle-web": "0.1.5-alpha.1"
102
103
  },
103
104
  "peerDependenciesMeta": {
104
105
  "@aotter/mantle-admin": {
@@ -139,18 +140,18 @@
139
140
  "@types/node": "^26",
140
141
  "aws4fetch": "^1.0.20",
141
142
  "better-auth": "1.7.2",
142
- "hono": "^4.13.3",
143
+ "hono": "^4.13.7",
143
144
  "@libsql/client": "^0.17.4",
144
145
  "typescript": "^6.0.3",
145
146
  "vitest": "^4.1.11",
146
147
  "zod": "^4.5.4",
147
- "@aotter/mantle-admin-ui": "0.1.3",
148
- "@aotter/mantle-admin": "0.1.3",
149
- "@aotter/mantle-auth": "0.1.3",
150
- "@aotter/mantle-bun": "0.1.3",
151
- "@aotter/mantle-cloudflare": "0.1.3",
152
- "@aotter/mantle-vercel": "0.1.3",
153
- "@aotter/mantle-web": "0.1.3"
148
+ "@aotter/mantle-admin": "0.1.5-alpha.1",
149
+ "@aotter/mantle-admin-ui": "0.1.5-alpha.1",
150
+ "@aotter/mantle-auth": "0.1.5-alpha.1",
151
+ "@aotter/mantle-bun": "0.1.5-alpha.1",
152
+ "@aotter/mantle-cloudflare": "0.1.5-alpha.1",
153
+ "@aotter/mantle-vercel": "0.1.5-alpha.1",
154
+ "@aotter/mantle-web": "0.1.5-alpha.1"
154
155
  },
155
156
  "engines": {
156
157
  "node": ">=22"
package/skills/README.md CHANGED
@@ -4,13 +4,14 @@ Agent-readable skill briefs for consumers of `@aotter/mantle-*`. Discoverable by
4
4
 
5
5
  | Skill | When to invoke |
6
6
  |---|---|
7
- | [`develop`](develop/SKILL.md) | `mantle:develop`: Core-owned workflow for manifest, runtime, handler, adapter, validation, and MCP work in any Mantle project. |
8
- | [`media-gc`](media-gc/SKILL.md) | `mantle:media-gc`: audit or remove stale uncommitted public media objects with the connected Cloudflare API. |
9
- | [`plugin`](plugin/SKILL.md) | `mantle:plugin`: Core-owned marketplace workflow for plan-first capability installs across applications and adapters. |
10
- | [`theme`](theme/SKILL.md) | `mantle:theme`: Core-owned visual workflow. Reads project-owned theme and UI contracts. |
11
- | [`update`](update/SKILL.md) | `mantle:update`: Core-owned drift check workflow for SDK dependencies, local skills, and plugin lockfiles. |
12
- | [`install`](install/SKILL.md) | User wants to author a local Mantle application or continue an existing project. |
13
- | [`provision`](provision/SKILL.md) | User wants a local project shipped to Cloudflare with production auth and operator handoff. |
7
+ | [`develop`](../docs/skills/develop/SKILL.md) | `mantle:develop`: Core-owned workflow for manifest, runtime, handler, adapter, validation, and MCP work in any Mantle project. |
8
+ | [`integrate`](../docs/skills/integrate/SKILL.md) | `mantle:integrate`: choose and carry out an existing application's Mantle integration or rebuild and data migration. |
9
+ | [`media-gc`](../docs/skills/media-gc/SKILL.md) | `mantle:media-gc`: audit or remove stale uncommitted public media objects with the connected Cloudflare API. |
10
+ | [`plugin`](../docs/skills/plugin/SKILL.md) | `mantle:plugin`: Core-owned marketplace workflow for plan-first capability installs across applications and adapters. |
11
+ | [`theme`](../docs/skills/theme/SKILL.md) | `mantle:theme`: Core-owned visual workflow. Reads project-owned theme and UI contracts. |
12
+ | [`update`](../docs/skills/update/SKILL.md) | `mantle:update`: Core-owned drift check workflow for SDK dependencies, local skills, and plugin lockfiles. |
13
+ | [`mantle`](install/SKILL.md) | User wants to author a local Mantle application or continue an existing project. |
14
+ | [`provision`](../docs/skills/provision/SKILL.md) | User wants a local project shipped to Cloudflare with production auth and operator handoff. |
14
15
 
15
16
  The skills target Mantle's v0.1 grammar. The installed package version, not
16
17
  duplicated skill prose, selects the exact runtime and embedded docs.
@@ -25,13 +26,14 @@ enforces the columns below.
25
26
 
26
27
  | Skill | Routes on | Entry-path constraints (read before acting) | Path-gated sections | Projection | Restricted because |
27
28
  |---|---|---|---|---|---|
28
- | `develop` | existing project; manifest, runtime, handler, adapter, or MCP work | four-atom model; adapter neutrality; no direct D1/KV/Postgres writes; no committed secrets | performance harness; local MCP client; locale rules | project, plugin | — |
29
- | `plugin` | user wants an installable capability | plan before apply; lock entry is the removal manifest; delete only plugin-owned files and atoms | apply; remove | project, plugin | — |
30
- | `theme` | brand or visual direction in a project | repo-owned theme and UI contracts | — | project, plugin | — |
31
- | `update` | SDK upgrade or plugin lock review | never blindly overwrite user-owned code | — | project, plugin | — |
32
- | `install` | new application, or opening an existing project | do not use the SDK checkout as the application; no push/deploy/provider config during cold start | author local project; continue existing project | plugin | Creates a new project; nothing to project into an existing one. |
33
- | `provision` | ship to Cloudflare and finish production auth | secrets never enter source or logs; explicit auth mode | hosted auth; self-managed auth | plugin | Platform-specific deploy that handles production secrets; opt-in only. |
34
- | `media-gc` | audit or remove stale uncommitted media objects | audit by default; confirm exact account, bucket, cutoff, and candidate digest; re-audit before applying; never prefix-delete; never print keys | apply | plugin | Destructive remote object deletion and Cloudflare-specific; opt-in only. |
29
+ | `develop` | existing project; manifest, runtime, handler, adapter, or MCP work | four-atom model; adapter neutrality; no direct D1/KV/Postgres writes; no committed secrets | performance harness; local MCP client; locale rules | project | — |
30
+ | `integrate` | independently authored application; add Mantle or rebuild with migration | inspect application before strategy; version-matched SDK; protect live data | embed; incrementally replace; rebuild and migrate | package | Existing-project migration is opt-in; a fresh generated app does not need this brief. |
31
+ | `plugin` | user wants an installable capability | plan before apply; lock entry is the removal manifest; delete only plugin-owned files and atoms | apply; remove | project | — |
32
+ | `theme` | brand or visual direction in a project | repo-owned theme and UI contracts | — | project | — |
33
+ | `update` | SDK upgrade or plugin lock review | never blindly overwrite user-owned code | — | project | — |
34
+ | `mantle` | new application, or opening an existing project | do not use the SDK checkout as the application; no push/deploy/provider config during cold start | author local project; continue existing project | plugin | Creates a new project; nothing to project into an existing one. |
35
+ | `provision` | ship to Cloudflare and finish production auth | secrets never enter source or logs; explicit auth mode | hosted auth; self-managed auth | package | Platform-specific deploy that handles production secrets; opt-in only. |
36
+ | `media-gc` | audit or remove stale uncommitted media objects | audit by default; confirm exact account, bucket, cutoff, and candidate digest; re-audit before applying; never prefix-delete; never print keys | apply | package | Destructive remote object deletion and Cloudflare-specific; opt-in only. |
35
37
 
36
38
  Deliberately monolithic:
37
39
 
@@ -47,7 +49,8 @@ Deliberately monolithic:
47
49
  The `mantle:*` namespace is owned by `@aotter/mantle`. Every skill declares its
48
50
  own distribution scope in front matter: `metadata.projection: project` marks a
49
51
  skill `mantle skills` should place in a consumer project, and a skill that
50
- withholds `project` must say why. `scripts/check-skills.mjs` holds that
52
+ withholds `project` must say why. `plugin` is the bootstrap skill and `package`
53
+ is an opt-in brief in the installed SDK. `scripts/check-skills.mjs` holds that
51
54
  declaration and the audit table below to each other.
52
55
 
53
56
  Run `mantle skills` to project the installed package's skills into a project;
@@ -58,11 +61,15 @@ contracts.
58
61
 
59
62
  ## Source-repository marketplace install
60
63
 
61
- Cold start is the install skill. Other marketplace hosts are pointers
62
- to the same entry:
64
+ `skills/install/SKILL.md` declares `name: mantle`. It is the only repository
65
+ skill discovered by the no-flag command and copied as a small directory.
66
+ The other seven skills live in `docs/skills/` and ship with the npm package.
67
+ `mantle skills` projects the four ongoing workflows after package installation.
68
+
69
+ Other marketplace hosts point to the same entry:
63
70
 
64
71
  ```sh
65
- npx skills add aotter/mantle --skill install
72
+ npx skills add aotter/mantle
66
73
  ```
67
74
 
68
75
  ```bash
@@ -76,7 +83,7 @@ codex plugin add mantle@mantle
76
83
  ```
77
84
 
78
85
  Read the path printed by the installer (for project-local Codex,
79
- `.agents/skills/install/SKILL.md`). Only the selected brief is installed, not
86
+ `.agents/skills/mantle/SKILL.md`). Only the selected brief is installed, not
80
87
  the SDK or handbook. After choosing and installing an exact SDK version, read
81
88
  `node_modules/@aotter/mantle/skills/install/SKILL.md` and its embedded docs;
82
89
  that package supersedes the bootstrap Git-ref instructions. After packages are
@@ -100,13 +107,13 @@ package. Two audiences, two artifacts.
100
107
 
101
108
  ## Discoverability
102
109
 
103
- The skills target ADR-0007's "AI as primary author" thesis: agents reach these files by URL when the user invokes them by intent ("install mantle", "develop my Mantle site", "deploy"). Official cold start is `npx skills add aotter/mantle --skill install`. Point the agent at the repository or pass the version-matched markdown content directly.
110
+ The skills target ADR-0007's "AI as primary author" thesis: agents reach these files by URL when the user invokes them by intent ("install mantle", "develop my Mantle site", "deploy"). Official cold start is `npx skills add aotter/mantle`. Point the agent at the repository or pass the version-matched markdown content directly.
104
111
 
105
112
  ## Conventions
106
113
 
107
114
  Each SKILL.md ships:
108
115
 
109
- - **Front-matter** with a folder-matching `name`, trigger-complete
116
+ - **Front-matter** with a stable `name`, trigger-complete
110
117
  `description`, and optional source/version `metadata`. Plugin hosts add the
111
118
  external `mantle:` namespace.
112
119
  - **Preflight** section — environment + user-confirmation gates.
@@ -3,9 +3,9 @@ name: develop
3
3
  description: Work on any Mantle project using the Core SDK contract. Use for manifest, runtime, content model, handler, adapter, validation, and MCP work after a project already exists.
4
4
  metadata:
5
5
  source: "@aotter/mantle"
6
- sourcePath: skills/develop/SKILL.md
6
+ sourcePath: docs/skills/develop/SKILL.md
7
7
  applies_to: mantle grammar v0.1
8
- projection: project, plugin
8
+ projection: project
9
9
  ---
10
10
 
11
11
  # Mantle Develop
@@ -57,9 +57,11 @@ pnpm exec mantle --help
57
57
  pnpm validate
58
58
  ```
59
59
 
60
- This CLI validates and derives artifacts from application-authored manifests.
61
- It does not create projects, business schemas or a visitor homepage. There is
62
- no `mantle create` / `mantle update` happy path.
60
+ On 0.1.5 and newer, `generate --host cf|chatgpt-sites` assembles a new blank
61
+ app; no `--features` selects Spec, Runtime, API, MCP, Admin and Web. Explicit
62
+ `--features` selects a smaller composition. It never invents a business
63
+ Schema. Existing authored apps keep compile mode, and older installed CLIs
64
+ may not support project generation. Check this project's CLI help first.
63
65
 
64
66
  ## Core Model
65
67
 
@@ -155,7 +157,10 @@ teaching the project Mantle internals.
155
157
 
156
158
  ## Auth Composition
157
159
 
158
- Admin is opt-in. A project without `@aotter/mantle-admin-ui` is complete.
160
+ Generated full apps select Admin by default; smaller selections can omit it.
161
+ A project without `@aotter/mantle-admin-ui` is complete when Admin was not
162
+ selected. If Admin was selected but its package is missing, install the
163
+ CLI-declared exact version and rerun generation.
159
164
  When Admin is installed, `createMantleWorker({ auth })` with `email-otp`
160
165
  and `ConsoleEmailSender` is the local human path (OTP in wrangler logs).
161
166
  That override owns Auth construction; Core still owns `/admin` and
@@ -164,8 +169,11 @@ and an `ASSETS` binding. A white screen at `/admin` with HTML 200 and
164
169
  `/_mantle/admin/assets/*` 404 is a missing assets binding, not a missing
165
170
  frontend build.
166
171
 
167
- Conventional Cloudflare projects that do not replace Auth declare
168
- `MANTLE_AUTH_MODE=hosted` or `self-managed`; Core owns that standard
172
+ Generated Cloudflare apps use `MANTLE_AUTH_MODE=local-otp` on loopback after
173
+ copying `.dev.vars.example` to `.dev.vars` and setting a real owner email and
174
+ random secret. Production uses `hosted` or `self-managed` with provider
175
+ credentials and `ADMIN_GITHUB_LOGIN`. Conventional Cloudflare projects that
176
+ do not replace Auth use those two production modes; Core owns that standard
169
177
  composition and rejects partial or mixed bindings. Preserve the explicit
170
178
  mode recorded in Worker config, keep provider secrets out of source, and
171
179
  do not infer a mode from whichever credentials happen to be present.
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: install
3
- description: Author a new Mantle application directly from version-matched SDK docs, or continue an existing project. Use when asked to install Mantle, build a Mantle application, or open a Mantle repository.
2
+ name: mantle
3
+ description: Set up a new Mantle application or continue an existing one using the installed SDK's matching instructions.
4
4
  metadata:
5
5
  source: "@aotter/mantle"
6
6
  sourcePath: skills/install/SKILL.md
@@ -9,129 +9,104 @@ metadata:
9
9
  projectionReason: Creates a new project; nothing to project into an existing one.
10
10
  ---
11
11
 
12
- # Mantle Install
13
-
14
- Mantle is an embeddable manifest engine. The application owns its source and
15
- provider configuration. There is no Starter/type picker or `mantle create`.
16
- Do not use the SDK checkout as the application, copy an old Starter tree, or
17
- turn `generate` into implicit scaffolding.
18
-
19
- ## Locate the version-matched instructions
20
-
21
- `npx skills add aotter/mantle --skill install` installs this brief, not the SDK,
22
- a project, or the handbook. Read the path printed by the installer (Codex's
23
- project-local path is `.agents/skills/install/SKILL.md`); `metadata.sourcePath`
24
- is repository provenance, not a consumer path. A repository install follows
25
- the selected Git ref and does not pin an npm release.
26
-
27
- After selecting the host and exact version, install `@aotter/mantle` locally
28
- with the selected optional packages. All `docs/...` paths below then mean
29
- `node_modules/@aotter/mantle/docs/...`; package skills are under
30
- `node_modules/@aotter/mantle/skills/`. Read that package's
31
- `skills/install/SKILL.md` before authoring: it supersedes this bootstrap copy.
32
- If the user requested a prerelease, resolve that channel explicitly; `latest`
33
- need not contain prerelease features. Never mix versioned npm code with branch
34
- docs. No local CLI exists until the package is installed.
35
-
36
- ## New application
37
-
38
- 1. Determine the actual host and required surfaces from the request. Reuse an
39
- existing application when available; otherwise work in its own directory.
40
- Do not assume Cloudflare, public HTML or Admin is required. Check Node 22+
41
- and pnpm 9+ for these SDK examples. A ChatGPT Site is not a conventional
42
- Cloudflare Worker deployment; use the installed
43
- `docs/handbook/sites/index.md` integration guide and
44
- `docs/examples/host-chatgpt-sites/` runnable reference when selected.
45
- 2. Choose the requested exact SDK version, or resolve the intended release
46
- channel once. Pin all selected `@aotter/mantle*` dependencies to that same
47
- version. Install only the adapter/optional packages the application needs.
48
- If a global scope registry overrides public npmjs, use a project-owned
49
- `.npmrc` with `@aotter:registry=https://registry.npmjs.org/`.
50
- 3. Use the host and surfaces already established in step 1; ask only for
51
- information still missing. Read `docs/handbook/start/overview.md` and
52
- `docs/handbook/reference/features.md`, then select the matching path:
53
- - Spec + generate / embed Runtime — `docs/handbook/start/project-and-cli.md`.
54
- - Adapter without Admin — `docs/examples/host-minimal-worker/`.
55
- - Opt-in Admin / Dev UI — only when a human needs a console: interview
56
- the bootstrap owner email, then `docs/examples/host-local-admin-otp/`
57
- (`pnpm install && pnpm generate && pnpm dev`, `/admin/sign-in`, OTP
58
- in wrangler logs). Admin needs `@aotter/mantle-admin`,
59
- `@aotter/mantle-admin-ui`, wrangler `ASSETS` on `./public`, and
60
- `createAuth` email-otp + `ConsoleEmailSender`. Do not Vite-build Admin.
61
- - ChatGPT Sites with Admin/D1/R2 — follow
62
- `docs/examples/host-chatgpt-sites/`, not the email-OTP Worker example.
63
- Copy it outside the SDK checkout, then `npm ci`,
64
- `npx mantle validate --phase deploy`, `npm run generate`, `npm run check`,
65
- `npx wrangler d1 migrations apply DB --local`,
66
- `npm run dev -- --port 4174`, and `npm test` in a second terminal.
67
- Preserve its Sites-owned identity ingress and hosting manifest; author the
68
- user's Schema/View/Procedure/Trigger, then review migrations, media policy
69
- and the local/production smoke gates. Sites provisions and deploys; never
70
- `wrangler deploy` a Site. Request both D1 and R2 when uploads are in scope.
71
- Browser Admin WebMCP and Sites-session `/api/mcp/staff` do not enable remote staff OAuth MCP.
72
- - ChatGPT Sites with custom business rules or an external callback — the
73
- runnable reference covers builtin content only. For application-owned
74
- operational state, `handler: { kind: ref }` Procedures, staff-only SQL
75
- Views, staff MCP Triggers with `requires.auth`, and outbound webhooks
76
- called from handler code, follow
77
- `docs/handbook/sites/equipment-checkout.md`. It is an implementation
78
- guide, not a shipped app: keep Mantle-owned Schema tables and
79
- application-owned tables separate, and give every application table a
80
- reviewed migration.
81
- - Grammar — `docs/examples/README.md`. Copy `builtin-*` Manifests directly.
82
- Read `cf-primitives-*` when the request needs Durable Objects, Queues,
83
- cron, payment-provider callbacks, or API-key and entitlement guards;
84
- those carry `ref` handlers and are not Builder-ingestible.
85
- None of these is a template to install wholesale. Other hosts use the
86
- embedded adapter guides. Author package scripts, manifests, entry and
87
- configuration for the user's requirements. No default notes model, home
88
- page, icon, launch metadata or visitor frontend is required.
89
- 4. Compile and verify using the application's commands. The fundamental CLI
90
- sequence is:
91
-
92
- ```sh
93
- pnpm exec mantle generate
94
- pnpm exec mantle generate --check
95
- pnpm exec mantle validate
96
- pnpm exec mantle skills
97
- pnpm exec mantle skills --check
98
- ```
99
-
100
- Run the project's TypeScript check and start its actual local server. Probe
101
- a route the application declares. An API-only or adapter-only project may
102
- correctly return 404 at `/` and have no Admin. When Admin was requested,
103
- probe `/admin/sign-in` and a `/_mantle/admin/assets/*` URL — both must be
104
- 200. A white screen is an assets 404, not a missing frontend build.
105
- Conventional Auth routes may return `503 setup_incomplete` until that mode
106
- is configured; the local OTP path replaces construction instead. Do not
107
- introduce an auth bypass to make smoke pass.
108
-
109
- Commit the resolved lockfile in the application's normal workflow; subsequent
110
- installs use `pnpm install --frozen-lockfile`. Do not initialize/push a remote,
111
- provision resources, deploy or commit secrets as part of local verification.
112
-
113
- ## Existing application
114
-
115
- Read package.json, lockfile, actual entry, manifest files, provider config and
116
- project instructions. `.mantle/launch-state.json`, features or handoff files
117
- are optional legacy context, never prerequisites. Preserve them and user code.
118
- Install the frozen dependency graph, project installed Core skills, then read
119
- those skills and embedded docs. Never apply develop docs to an older package.
120
- Use the installed `mantle --help` and the project's scripts as authority.
121
-
122
- For a legacy pre-stable project, retain its pinned behavior until an explicit
123
- upgrade is requested. Do not rewrite provider identities, delete metadata or
124
- fetch a nonexistent new Starter tag. SDK upgrades follow the update skill, not
125
- a bundle comparison command.
126
-
127
- ## Ship and report
128
-
129
- When deployment is requested, read
130
- `node_modules/@aotter/mantle/skills/provision/SKILL.md` (not projected by
131
- `mantle skills`) and follow that version-matched skill and the
132
- observed host configuration. Legacy Landing remains a pre-stable product; it
133
- is not a launch dependency for new Core projects.
134
-
135
- Report the project path, exact SDK version, local URL/HTTP result and checks,
136
- plus any genuinely missing auth/provider setup. Do not claim a working homepage
137
- or authenticated MCP based only on successful generation.
12
+ # Mantle
13
+
14
+ `npx skills add aotter/mantle` installs this small bootstrap skill. It does not
15
+ install the SDK or create a project. The skill name is `mantle`; the source
16
+ folder remains `skills/install/` so installation does not copy the repository.
17
+
18
+ ## Find the application and its version
19
+
20
+ First locate the user's target project. If it already has `@aotter/mantle`,
21
+ read that project's `package.json`, lockfile, and
22
+ `node_modules/@aotter/mantle/package.json`. Follow the CLI and docs shipped in
23
+ that exact installed package. Never use another project's dependencies, the
24
+ SDK checkout, a floating GitHub handbook, or an old alpha/Starter fallback.
25
+ An older installed SDK may only support direct authoring; its own
26
+ `mantle generate --help` decides which flags exist. Upgrade only when requested.
27
+
28
+ For a new project, choose `cf` or `chatgpt-sites` from the request; ask only if
29
+ it remains ambiguous. A host-free Spec-only project needs no host. Resolve the
30
+ latest **published stable** `@aotter/mantle` version from npm once, confirm it
31
+ is not a prerelease, and install it with an exact version in the new project.
32
+ For example, run `npm view @aotter/mantle@latest version`, inspect the returned
33
+ plain `X.Y.Z`, then `npm install --save-exact @aotter/mantle@X.Y.Z` with that
34
+ actual version substituted. Set `type=module` in `package.json` first; npm's
35
+ default project type may be CommonJS.
36
+ When testing a release candidate, use the explicitly supplied exact version
37
+ or local tarball instead of npm latest. Pin every selected `@aotter/mantle*`
38
+ package to the running CLI's exact version; `generate` writes the required
39
+ package declarations. Do not let npm's default `^` range remain. If the
40
+ project registry overrides public npmjs, set `@aotter:registry=https://registry.npmjs.org/`
41
+ in a project-owned `.npmrc`.
42
+
43
+ ## New project sequence
44
+
45
+ 1. Create a separate application directory with Node 22+ and a project
46
+ `package.json` containing `"type":"module"`. Install the exact chosen
47
+ `@aotter/mantle` version locally. Read its
48
+ `node_modules/@aotter/mantle/skills/install/SKILL.md` and version-matched
49
+ `docs/handbook/start/overview.md` before continuing. These installed
50
+ instructions take precedence over this GitHub bootstrap copy. Check
51
+ `npx mantle generate --help`: if it does not list `--host`, follow the
52
+ installed version's direct-authoring path instead of the steps below.
53
+ 2. On a CLI that supports it, run with an explicit host, for example
54
+ `npx mantle generate --host cf` or `npx mantle generate --host chatgpt-sites`.
55
+ No `--features` means Spec, Runtime, API, MCP, Admin and a blank editable
56
+ home. For a smaller app, positively list the modules with `--features`
57
+ (for example `spec,api`); use `--features spec` for a host-free compiler.
58
+ Do not remove Admin merely because its package is not installed yet.
59
+ 3. The first run may declare selected dependencies and exit asking for an
60
+ install. Install them using the project's package manager, then rerun
61
+ `mantle generate` to finish. Read `docs/handbook/start/project-and-cli.md`
62
+ from the same installed package for saved selections, owned files,
63
+ `--check`.
64
+ 4. Before adding a Schema on ChatGPT Sites, review and apply its initial local
65
+ D1 migration as the installed Sites guide says. Then add only the user's
66
+ Schema, View, Procedure and Trigger manifests. Keep the blank home editable;
67
+ do not invent business data or media bindings. Run `mantle generate` to
68
+ append any new migration, review and apply it, then run `generate --check`,
69
+ `validate`, `skills`, build/typecheck and local smoke.
70
+ 5. For Cloudflare, follow installed `docs/handbook/start/project-and-cli.md`
71
+ and `docs/handbook/cloudflare/authentication.md`. Copy `.dev.vars.example`
72
+ to `.dev.vars`, set `ADMIN_EMAIL` and `BETTER_AUTH_SECRET`, and match
73
+ `PUBLIC_ORIGIN` to the loopback URL printed by `wrangler dev`. Open
74
+ `/admin/sign-in` with that email; read the OTP from wrangler logs. Check
75
+ Admin assets and an owner-only Admin API before claiming Admin works. For
76
+ ChatGPT Sites, follow installed
77
+ `docs/handbook/chatgpt-sites/generated-app.md`: review and apply local D1
78
+ migrations, set `OWNER_EMAIL` and `PUBLIC_ORIGIN`, then test the blank home,
79
+ unauthorized Admin, owner Admin, public MCP and staff MCP. Local owner
80
+ identity is simulated by the loopback-only smoke; it does not create a
81
+ browser ChatGPT session. Sites owns
82
+ production identity and deployment; do not deploy its Worker directly.
83
+ Browser Admin WebMCP and Sites-session `/api/mcp/staff` do not provide
84
+ remote staff OAuth MCP. The owner can maintain content through Admin and
85
+ the applicable authenticated MCP surface.
86
+
87
+ Use installed `docs/handbook/reference/features.md` for Manifest choices and
88
+ `docs/examples/` for optional examples. The generated project is the starting
89
+ point; a domain example is not a template to copy wholesale. Do not use a
90
+ `mantle-starters` tag or `mantle create`.
91
+
92
+ ## Existing project and handoff
93
+
94
+ For an application that already uses Mantle, preserve selected features,
95
+ user-authored files, migrations, package versions, identity settings and
96
+ provider resources. Use its installed CLI's `--help` and package-local docs.
97
+ Run `generate --check` without writing, then the project's normal tests.
98
+
99
+ When the request is to add Mantle to an independently authored application,
100
+ inspect its host, code and data first. Use the exact installed package's
101
+ `docs/skills/integrate/SKILL.md` if available. If Mantle is not installed,
102
+ choose between selective embedding, incremental replacement and creating a
103
+ separate Mantle app followed by frontend/data migration before installing an
104
+ exact SDK version. The existing application does not need to adopt the
105
+ generated project's entry or directory layout. An older SDK's own docs and
106
+ CLI govern its behavior; upgrade deliberately if the selected strategy needs
107
+ newer capabilities.
108
+
109
+ When deployment is requested, read the installed version's
110
+ `skills/provision/SKILL.md`. Report the target path, exact SDK version, local
111
+ HTTP results, Admin/MCP identity evidence, and any missing provider setup.
112
+ Local simulated Sites headers do not prove deployed ChatGPT sign-in.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: integrate
3
+ description: Integrate Mantle into an existing application. Use when the application has its own code, routes, storage or deployment and the owner wants to add Mantle, replace part of it, or rebuild with Mantle while migrating frontend and data.
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: docs/skills/integrate/SKILL.md
7
+ applies_to: mantle grammar v0.1
8
+ projection: package
9
+ projectionReason: Existing-project migration is opt-in; a fresh generated app does not need this brief.
10
+ ---
11
+
12
+ # Integrate Mantle into an existing application
13
+
14
+ Work in the target application. Read its installed `@aotter/mantle` version,
15
+ CLI help and package-local docs before editing. If Mantle is absent, inspect
16
+ the application first, then install an exact SDK version only after choosing an
17
+ integration strategy. Use the installed version's contract; do not copy
18
+ `develop` branch examples into an older consumer.
19
+
20
+ ## Inspect and decide
21
+
22
+ Map the actual entry points, router, frontend, auth, storage, data volume and
23
+ relationships, deployment pipeline, URLs, background jobs and existing tests.
24
+ Identify which behavior the owner wants Mantle to own and what must remain
25
+ stable. Compare three approaches using the application's evidence:
26
+
27
+ 1. **Embed selectively:** keep the host and call Mantle's parser, Runtime or
28
+ selected surfaces through its documented package APIs. The host owns wiring.
29
+ 2. **Replace incrementally:** move one bounded capability at a time. Define
30
+ where reads and writes go during coexistence and how each step is checked.
31
+ 3. **Rebuild and migrate:** create a separate new Mantle application, port the
32
+ frontend and business behavior, and transform/import existing data. Prefer
33
+ this when adapting the old structure costs more than rebuilding. Preserve
34
+ relevant IDs, relations, URLs and identity semantics; rehearse the data
35
+ transfer before a production cutover.
36
+
37
+ Explain the chosen path and its concrete tradeoffs to the owner. A small
38
+ prototype or read-only inventory may resolve uncertainty. Do not run a generic
39
+ project converter or assume the current application's shape matches a
40
+ generated Cloudflare or ChatGPT Sites skeleton.
41
+
42
+ ## Implement and verify
43
+
44
+ - For embedding, retain user-owned entry/config/build files. Use the installed
45
+ direct-authoring docs and CLI to validate manifests and emit bindings; wire
46
+ the selected Mantle capabilities into the existing host explicitly.
47
+ - For incremental replacement, establish a clear owner for each data write
48
+ and request route at every stage. Verify old and new behavior together.
49
+ - For rebuilding, generate in a **separate directory** with the installed
50
+ CLI, move frontend and handlers deliberately, and plan data mapping and
51
+ import separately. Review database migrations before application or cutover.
52
+ - Run the application's build and representative behavior checks for the
53
+ changed routes, auth and data. `mantle generate --check` checks generated
54
+ output against its declared selection; it cannot certify host integration.
55
+ For live data, record migration counts and a rollback or recovery path
56
+ appropriate to the project.
57
+
58
+ Leave existing data and deployment untouched until the requested migration
59
+ and release steps are ready. Report which capabilities Mantle now owns,
60
+ what was verified, and what remains for application deployment or cutover.
@@ -3,9 +3,9 @@ name: media-gc
3
3
  description: Audit and safely remove stale, uncommitted public media uploads from a Mantle Cloudflare R2 bucket. Use when a Mantle operator asks to inspect or clean orphan media objects left after create_media_upload without commit_media_upload.
4
4
  metadata:
5
5
  source: "@aotter/mantle"
6
- sourcePath: skills/media-gc/SKILL.md
6
+ sourcePath: docs/skills/media-gc/SKILL.md
7
7
  applies_to: mantle grammar v0.1
8
- projection: plugin
8
+ projection: package
9
9
  projectionReason: Destructive remote object deletion and Cloudflare-specific; opt-in only.
10
10
  ---
11
11
 
@@ -3,9 +3,9 @@ name: plugin
3
3
  description: Discover, plan, apply, and verify Mantle marketplace plugins through the Core SDK contract. Use when the user wants to add an installable capability without hand-planning provisioning steps.
4
4
  metadata:
5
5
  source: "@aotter/mantle"
6
- sourcePath: skills/plugin/SKILL.md
6
+ sourcePath: docs/skills/plugin/SKILL.md
7
7
  applies_to: mantle grammar v0.1
8
- projection: project, plugin
8
+ projection: project
9
9
  ---
10
10
 
11
11
  # Mantle Plugin
@@ -3,9 +3,9 @@ name: provision
3
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
- sourcePath: skills/provision/SKILL.md
6
+ sourcePath: docs/skills/provision/SKILL.md
7
7
  applies_to: mantle grammar v0.1
8
- projection: plugin
8
+ projection: package
9
9
  projectionReason: Platform-specific deploy that handles production secrets; opt-in only.
10
10
  ---
11
11
 
@@ -16,7 +16,7 @@ user asks to create remote resources or ship production. This flow is for
16
16
  consumer-owned Cloudflare Workers. New direct-authored apps do not need Landing
17
17
  artifacts (`.mantle/launch-state.json`, `.mantle/handoff.md`, or a hosted-auth
18
18
  allocation). Treat any Landing handoff as **legacy/optional**. For a ChatGPT
19
- Site, use the installed `docs/handbook/sites/index.md` integration guide and
19
+ Site, use the installed `docs/handbook/chatgpt-sites/index.md` integration guide and
20
20
  the "Publish with Sites" steps in `docs/examples/host-chatgpt-sites/README.md`:
21
21
  request D1 and R2 on the Site, set `PUBLIC_ORIGIN` and `OWNER_EMAIL` in Sites
22
22
  settings, review the migration, then save and deploy a Sites version. Do not
@@ -3,9 +3,9 @@ name: theme
3
3
  description: Apply brand and visual direction in a Mantle application using its repo-owned theme and UI contracts.
4
4
  metadata:
5
5
  source: "@aotter/mantle"
6
- sourcePath: skills/theme/SKILL.md
6
+ sourcePath: docs/skills/theme/SKILL.md
7
7
  applies_to: mantle grammar v0.1
8
- projection: project, plugin
8
+ projection: project
9
9
  ---
10
10
 
11
11
  # Mantle Theme