@aotter/mantle 0.0.11-alpha.48 → 0.0.11-alpha.50

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 CHANGED
@@ -31,14 +31,16 @@ import { mountServerEndpoints } from "@aotter/mantle/cloudflare";
31
31
 
32
32
  ## Getting started
33
33
 
34
- Recommended path: open the Mantle landing page, answer the launch
35
- questions, and sign in with GitHub and Cloudflare. Landing provisions the
36
- site server-side it creates the private GitHub repo, commits a blank
37
- deployable Mantle site, and connects the first Cloudflare deploy. Then
38
- point your coding agent (Claude Code / Cursor / Codex) at the provisioned
39
- repo to continue.
34
+ Give the [Mantle repo](https://github.com/aotter/mantle) to a coding agent or
35
+ install its agent plugin, then ask it to create a site. The install skill picks
36
+ a deterministic bundle from
37
+ [`aotter/mantle-starters`](https://github.com/aotter/mantle-starters),
38
+ materializes a local project, and verifies it before any provider work.
40
39
 
41
- Starter source and provision bundles live in [`aotter/mantle-starters`](https://github.com/aotter/mantle-starters); launch starts from the blank base and the agent applies the selected type as a post-launch overlay. Generated repos vendor Core-owned `mantle:*` skills from this package for repo-local use. See `skills/install` in the [Mantle repo](https://github.com/aotter/mantle/tree/develop/skills/install) for how the agent continues a provisioned repo.
40
+ [Mantle landing](https://mantle.tools) uses the same bundles and continues
41
+ through private GitHub repo creation, Cloudflare deployment, and optional paid
42
+ hosted auth. Generated repos vendor Core-owned `mantle:*` skills from this
43
+ package for repo-local use.
42
44
 
43
45
  ## Agent marketplace install
44
46
 
@@ -47,7 +49,7 @@ Install the Mantle Core skill bundle before working on generated repos:
47
49
  ```bash
48
50
  # Claude Code
49
51
  /plugin marketplace add aotter/mantle
50
- /plugin install mantle
52
+ /plugin install mantle@mantle
51
53
 
52
54
  # Codex
53
55
  codex plugin marketplace add aotter/mantle --ref develop
@@ -14,7 +14,8 @@ mantle is in `0.0.x-alpha` until the v0.1.0 release gate closes. The process bel
14
14
  - Use semver after v0.1.0.
15
15
  - Tag format is `vMAJOR.MINOR.PATCH`, for example `v0.1.0`.
16
16
  - Alpha tags may use prerelease suffixes, for example `v0.0.6-alpha`.
17
- - Package versions must stay aligned unless a future ADR explicitly changes package release policy.
17
+ - Package versions and agent plugin manifest versions must stay aligned unless
18
+ a future ADR explicitly changes release policy.
18
19
 
19
20
  ## Release channels
20
21
 
@@ -278,13 +279,13 @@ source.
278
279
 
279
280
  Do **not** publish `@aotter/mantle-netlify` while it is a stub.
280
281
 
281
- The retired `create-mantle` scaffolder is not shipped by this SDK repo.
282
- Releases on this SDK repo must not attach a create-mantle tarball and
283
- must not publish `@aotter/create-mantle`.
282
+ Releases on this SDK repo must not attach or publish a separate starter
283
+ scaffolder package. Local cold start is owned by the versioned provision
284
+ bundles and materializer in `aotter/mantle-starters`.
284
285
 
285
- `skills/install/SKILL.md` consumes the repo and handoff created by the
286
- landing page. Human-facing starter bundle details belong in the
287
- `mantle-starters` README, not this SDK repo.
286
+ `skills/install/SKILL.md` creates or continues a local / landing-generated
287
+ project. Human-facing starter bundle details belong in the `mantle-starters`
288
+ README, not this SDK repo.
288
289
 
289
290
  ### Pre-publish checks
290
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aotter/mantle",
3
- "version": "0.0.11-alpha.48",
3
+ "version": "0.0.11-alpha.50",
4
4
  "description": "Umbrella entry for @aotter/mantle. Adopters install this one package and import from subpaths: /spec, /runtime, /cloudflare, /admin-ui. Sub-packages remain individually installable on npm for tooling / alt-adapter authors. The Netlify adapter ships as a private workspace stub in v0.1 — its subpath will be added when the impl lands in v0.2.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://mantle.tools/",
@@ -47,10 +47,10 @@
47
47
  "README.md"
48
48
  ],
49
49
  "dependencies": {
50
- "@aotter/mantle-admin-ui": "0.0.11-alpha.48",
51
- "@aotter/mantle-cloudflare": "0.0.11-alpha.48",
52
- "@aotter/mantle-spec": "0.0.11-alpha.48",
53
- "@aotter/mantle-runtime": "0.0.11-alpha.48"
50
+ "@aotter/mantle-admin-ui": "0.0.11-alpha.50",
51
+ "@aotter/mantle-spec": "0.0.11-alpha.50",
52
+ "@aotter/mantle-cloudflare": "0.0.11-alpha.50",
53
+ "@aotter/mantle-runtime": "0.0.11-alpha.50"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@cloudflare/workers-oauth-provider": "^0.8.0",
package/skills/README.md CHANGED
@@ -8,12 +8,14 @@ Agent-readable skill briefs for consumers of `@aotter/mantle-*`. Discoverable by
8
8
  | [`plugin`](plugin/SKILL.md) | `mantle:plugin`: Core-owned marketplace workflow for plan-first capability installs across starters and adapters. |
9
9
  | [`theme`](theme/SKILL.md) | `mantle:theme`: Core-owned visual workflow. Reads project context but does not depend on starter-owned skill semantics. |
10
10
  | [`update`](update/SKILL.md) | `mantle:update`: Core-owned drift check workflow for SDK, starter snapshots, and plugin lockfiles. |
11
- | [`install`](install/SKILL.md) | User wants to start or continue a Mantle site. Sites launch on [Mantle landing](https://mantle.tools), which provisions the GitHub repo and first Cloudflare deploy; this brief orients the agent to take over and continue the provisioned repo. |
11
+ | [`install`](install/SKILL.md) | User wants to create a local Mantle site from a deterministic starter bundle or continue an existing local / landing-generated project. |
12
12
  | [`customize-design`](customize-design/SKILL.md) | Legacy publication-specific design guide. Prefer `mantle:theme` for generated repos. |
13
13
  | [`extend`](extend/SKILL.md) | Legacy atom-authoring guide. Prefer `mantle:develop` or `mantle:plugin` depending on whether the work is one-off or installable. |
14
- | [`provision`](provision/SKILL.md) | User wants production fully usable after a landing launch. Verify the current landing deploy, wire per-site staff auth, smoke test, and hand off the operator setup URL. |
14
+ | [`provision`](provision/SKILL.md) | User wants a local or landing-generated project shipped to Cloudflare with production auth and operator handoff. |
15
15
 
16
- The skills target `mantle@v0.1.0`. Each one names its assumed grammar version in the front-matter `applies_to:` field; future versions add a sibling SKILL.md or update the existing one.
16
+ The skills target `mantle@v0.1.0`. Each one names its assumed grammar version
17
+ in front-matter `metadata.applies_to`; future versions add a sibling SKILL.md
18
+ or update the existing one.
17
19
 
18
20
  ## Skill authority
19
21
 
@@ -43,7 +45,9 @@ The skills target ADR-0007's "AI as primary author" thesis: agents reach these f
43
45
 
44
46
  Each SKILL.md ships:
45
47
 
46
- - **Front-matter** with `name`, `description`, `when_to_invoke`, `applies_to`.
48
+ - **Front-matter** with a folder-matching `name`, trigger-complete
49
+ `description`, and optional source/version `metadata`. Plugin hosts add the
50
+ external `mantle:` namespace.
47
51
  - **Preflight** section — environment + user-confirmation gates.
48
52
  - **Step-by-step** — concrete commands (`pnpm validate`, `mantle emit-openapi`, etc.).
49
53
  - **Diagnostic recipes** — `Symptom → Cause → Fix` table for the common failure modes.
@@ -1,9 +1,10 @@
1
1
  ---
2
- name: mantle customize-design
2
+ name: customize-design
3
3
  description: Layer custom design over a mantle publication starter project using the L1–L4 theme stack (tokens / extraCss+icons+i18n / Header+Footer+PageShell slots / whole-template fork). Use when the user wants to rebrand, restyle, or swap UI pieces without forking the whole starter.
4
- when_to_invoke: |
5
- User says: "change the colors", "use my own font", "I want a different header", "make this look like X", "this is too plain / too editorial", "translate the labels", "swap the logo". Applies to the `publication` archetype; the `blank` archetype has no UI to customize.
6
- applies_to: mantle@v0.1.0 + publication archetype
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/customize-design/SKILL.md
7
+ applies_to: mantle@v0.1.0 + publication archetype
7
8
  ---
8
9
 
9
10
  # Customize the design of a mantle publication site
@@ -1,11 +1,10 @@
1
1
  ---
2
- name: mantle:develop
2
+ 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
- source: "@aotter/mantle"
5
- sourcePath: skills/develop/SKILL.md
6
- when_to_invoke: |
7
- Working dir contains a Mantle project: package.json depends on @aotter/mantle or @aotter/mantle-*, and manifests/ or src/mantle/config.ts exists. Legacy projects may still use src/mantleConfig.ts.
8
- applies_to: mantle@v0.1.0
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/develop/SKILL.md
7
+ applies_to: mantle@v0.1.0
9
8
  ---
10
9
 
11
10
  # Mantle Develop
@@ -23,7 +22,34 @@ owns the workflow vocabulary.
23
22
  4. Installed Core docs in `node_modules/@aotter/mantle/docs/`.
24
23
 
25
24
  If `node_modules/` is missing, run `pnpm install --frozen-lockfile` before
26
- falling back to remote docs.
25
+ falling back to remote docs. Remote docs must use a tag matching the installed
26
+ version; never use `develop` branch docs for a versioned consumer project.
27
+
28
+ ## Existing Examples
29
+
30
+ Before inventing a Mantle pattern, inspect
31
+ [`aotter/mantle-starters`](https://github.com/aotter/mantle-starters).
32
+ Use a tag matching the installed Mantle version when available; use `develop`
33
+ only for unreleased work. `blank/` shows the base application shape and
34
+ `overlays/<type>/` contains working examples of manifests, handlers, routes,
35
+ pages, and feature wiring. Copy the smallest matching pattern. Do not edit or
36
+ copy generated `provision-bundles/*.json` by hand.
37
+
38
+ ## Authoring CLI
39
+
40
+ Use the project's scripts first; generated starters expose the shipping
41
+ `mantle` authoring CLI from `@aotter/mantle-spec`:
42
+
43
+ ```bash
44
+ pnpm exec mantle --help
45
+ pnpm validate
46
+ pnpm introspect
47
+ pnpm emit-openapi
48
+ pnpm emit-types
49
+ ```
50
+
51
+ This CLI validates and derives artifacts from an existing materialized
52
+ project; starter creation is owned by the provision-bundle flow.
27
53
 
28
54
  ## Core Model
29
55
 
@@ -1,9 +1,10 @@
1
1
  ---
2
- name: mantle extend
2
+ name: extend
3
3
  description: Add new functionality to an existing mantle project — a new Schema, View, Procedure, or Trigger; or wire a feature like a contact form, newsletter signup, comment thread, or filtered list page. Use when the user already has a mantle project and wants to grow it.
4
- when_to_invoke: |
5
- Working dir contains `manifests/`, `package.json` includes `@aotter/*`. The user describes a new content type, a public REST query, a write endpoint, or a side-effect on entry mutation.
6
- applies_to: mantle@v0.1.0
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/extend/SKILL.md
7
+ applies_to: mantle@v0.1.0
7
8
  ---
8
9
 
9
10
  # Extend a mantle project
@@ -1,144 +1,142 @@
1
1
  ---
2
- name: mantle install
3
- description: Orient and continue a Mantle site that Mantle landing has provisioned. Mantle sites launch on Mantle landing (mantle.tools), which creates the GitHub repo and the first Cloudflare deploy; the agent takes over the provisioned repo to complete the selected type, first pages, and content. Use when the user pasted a Mantle launch / after-launch context, opened a landing-provisioned repo, or wants to start a new Mantle site.
4
- when_to_invoke: |
5
- The user wants a new Mantle site, pasted a Mantle landing launch / after-launch context, or opened a repo that Mantle landing provisioned and wants help continuing it.
2
+ name: install
3
+ description: Start a new Mantle site locally from a deterministic starter bundle, or orient and continue an existing local or Mantle landing project. Use when the user gives a Mantle repository URL and asks to try or build with it, invokes the Mantle install skill, wants a new Mantle site, or opens an existing generated site.
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/install/SKILL.md
7
+ applies_to: mantle@v0.1.0
6
8
  ---
7
9
 
8
- # mantle install
10
+ # Mantle Install
9
11
 
10
- Mantle sites are launched on **Mantle landing** (`https://mantle.tools`),
11
- not scaffolded locally. Landing asks the launch questions, then provisions
12
- server-side: it creates the user's private GitHub repo, commits a blank
13
- deployable Mantle site, and connects Cloudflare Workers CI for the first
14
- deploy. Your job is to **continue that provisioned repo** — complete the
15
- selected type, first pages, and content — not to scaffold from scratch.
12
+ Route by the working directory:
16
13
 
17
- There is no local scaffolder to run. The `create-mantle` CLI was retired
18
- when provisioning moved into landing. If the user has not launched yet,
19
- send them to `https://mantle.tools` to launch, then resume here once the
20
- repo exists. Do not rebuild the old manual interview / prompt-composition
21
- harness.
14
+ - If it already contains `.mantle/launch-state.json` or depends on
15
+ `@aotter/mantle`, continue the existing project.
16
+ - Otherwise create a new local project from a deterministic provision bundle.
17
+ Do not use the Mantle SDK checkout as the application.
22
18
 
23
- ## Ground Truth
19
+ Mantle landing uses the same bundles but continues through GitHub, Cloudflare,
20
+ and optional paid hosted auth. Use landing only when the user wants that
21
+ hosted provider flow.
24
22
 
25
- `@aotter/mantle-*` exposes exactly four declarative atoms scoped to
26
- `cms.mantle.aotter.net/v1`, mapping 1-to-1 to Postgres primitives:
23
+ ## Create a Local Project
27
24
 
28
- | Atom | Postgres analog | External surface |
29
- |---|---|---|
30
- | Schema | `CREATE TABLE` | none directly |
31
- | View | `CREATE VIEW` | auto-mounted at `GET /api/views/<name>` |
32
- | Procedure | `CREATE FUNCTION` | none directly |
33
- | Trigger | `CREATE TRIGGER` + cron + REST route + LISTEN/NOTIFY | binding atom |
25
+ 1. Infer the closest starter from the user's request. Ask only when two choices
26
+ would materially change the result.
34
27
 
35
- Anything domain-shaped (Form, Membership, Workflow) is composed in the
36
- consumer project from these four atoms plus user TypeScript. Full grammar
37
- reference:
38
- <https://raw.githubusercontent.com/aotter/mantle/develop/docs/design-atoms.md>.
28
+ | Intent | Type |
29
+ |---|---|
30
+ | API/MCP backend or empty base | `blank` |
31
+ | Small public or company site | `presence` |
32
+ | Form, application, or submission flow | `intake` |
33
+ | Blog, docs, posts, or editorial site | `publication` |
34
+ | Catalog or order intent | `transaction` |
35
+ | Booking or request intent | `reservation` |
36
+ | Member or participation intent | `community` |
37
+
38
+ 2. Choose absolute paths for a temporary starters checkout and a target
39
+ directory outside both Mantle repositories. Derive a short project slug,
40
+ brand, one-sentence description, and locales from the user's prompt.
41
+
42
+ 3. Clone [`aotter/mantle-starters`](https://github.com/aotter/mantle-starters)
43
+ into a temporary directory and run its materializer. Use a starters ref
44
+ supplied by the user for branch testing. Otherwise use a tag matching the
45
+ requested Mantle version; use `develop` only for unreleased work.
39
46
 
40
- A landing-provisioned repo carries its launch context and ground truth in:
47
+ ```bash
48
+ git clone --depth 1 --branch <starters-ref> \
49
+ https://github.com/aotter/mantle-starters.git <temporary-starters-dir>
50
+ pnpm --dir <temporary-starters-dir> materialize <type> \
51
+ --out <target-dir> \
52
+ --project-name <slug> \
53
+ --brand "<brand>" \
54
+ --description "<one sentence>" \
55
+ --locales <comma-separated-locales>
56
+ ```
41
57
 
42
- | Path | Contents |
43
- |---|---|
44
- | `.mantle/launch-state.json` | Non-secret launch choices: type, purpose, locales, repo, owner, suggested overlay |
45
- | `.mantle/features.json` | Starter launch context and applied starter state |
46
- | `.mantle/handoff.md` | The launch handoff note written for you |
47
- | `manifests/*.yaml` | Schemas / Views / Procedures / Triggers |
48
- | `src/mantle/config.ts` | Site defaults, runtime bindings |
49
- | `src/mantle/handlers/index.ts` | Procedure handler registration |
50
- | `src/handlers/` | Handler implementations |
51
- | `AGENTS.md` | Cross-tool agent entry |
52
- | `.agent/skills/` + `.claude/skills/` | Vendored Core skills from `@aotter/mantle`: `mantle:develop`, `mantle:plugin`, `mantle:theme`, `mantle:update` |
53
-
54
- ## Take Over a Provisioned Repo
55
-
56
- The repo was already created and deployed by landing. Continue it:
57
-
58
- 1. Confirm repository access through an available GitHub connector or MCP
59
- tool. Use GitHub CLI only if it is already authenticated.
60
- 2. Clone or open the repo, then read `.mantle/launch-state.json`,
61
- `.mantle/features.json`, and `.mantle/handoff.md`.
62
- 3. Inspect the four-atoms manifest, the type overlay notes, pages, and
63
- seed data before changing code.
64
- 4. Validate locally before editing:
58
+ The materializer writes the same precomposed `provision-bundles/<type>.json`
59
+ used by Mantle landing. Do not manually copy `blank/`, merge overlays, or edit
60
+ the generated bundle JSON.
61
+
62
+ 4. Initialize and verify the local project:
65
63
 
66
64
  ```bash
65
+ cd <target-dir>
66
+ git init -b main
67
67
  pnpm install --frozen-lockfile
68
68
  pnpm validate
69
69
  pnpm typecheck
70
+ pnpm dev
70
71
  ```
71
72
 
72
- Diagnostics are structured JSON with `code` and `suggestion` fields.
73
- Surface both verbatim when validation fails.
74
-
75
- ## Continue With Repo-Local Skills
76
-
77
- The generated repo vendors Core-owned skills under `.agent/skills/` and
78
- `.claude/skills/`. The starter carries local copies for offline/pinned use; it
79
- does not own a separate skill contract.
73
+ Open `http://localhost:8787`. Public preview works before auth is configured;
74
+ auth-gated routes may return `503 setup_incomplete`.
80
75
 
81
- - **`mantle:develop`** manifest, runtime, content-model, layout,
82
- bug-fix, and validation work on the site.
83
- - **`mantle:plugin`** — install repeatable marketplace capabilities using
84
- a plan-first Core workflow.
85
- - **`mantle:theme`** — brand and visual direction via Mantle / Kiwa tokens
86
- and source. There is no premade theme picker; visual direction is agent
87
- work after launch.
88
- - **`mantle:update`** — compare the repo against its upstream provision
89
- bundle or installed plugin locks.
76
+ ## Continue an Existing Project
90
77
 
91
- Remove the placeholder blank homepage once the selected type ships a real
92
- homepage.
78
+ Read these before editing:
93
79
 
94
- ## Optional Media Uploads
80
+ 1. `.mantle/launch-state.json`, `.mantle/features.json`, and
81
+ `.mantle/handoff.md`.
82
+ 2. `package.json` for the installed `@aotter/mantle*` versions.
83
+ 3. Repo-local Mantle skills under `.agent/skills/` or `.claude/skills/`.
84
+ 4. Matching embedded docs under `node_modules/@aotter/mantle/docs/`.
95
85
 
96
- Media uploads are a post-launch opt-in, not part of Day 1 provisioning. Do
97
- not block the first deploy or first useful page on storage setup.
86
+ Use remote docs only when embedded docs are unavailable, and use a tag matching
87
+ the installed version. Never use `develop` docs for a versioned project.
98
88
 
99
- When the current repo uses the Cloudflare adapter and really needs
100
- staff-managed images or files, follow the Cloudflare R2 recipe:
101
- <https://raw.githubusercontent.com/aotter/mantle/develop/docs/media-uploads.md>.
89
+ Do not branch on how the project was created. Verify the current git remote,
90
+ live URL, and auth response, then skip work that is already complete.
102
91
 
103
- For media maintenance, prefer Claude Code, Codex, Cursor, or another
104
- local/non-sandboxed coding agent that can read files and make outbound PUT
105
- requests. Do not rely on Claude Cowork for R2 uploads; use a
106
- non-sandboxed agent instead.
92
+ Then run:
107
93
 
108
- ## Local Preview
94
+ ```bash
95
+ pnpm install --frozen-lockfile
96
+ pnpm validate
97
+ pnpm typecheck
98
+ ```
109
99
 
110
- To see the site locally before pushing:
100
+ Inspect the already composed manifest, page, and seed files before changing
101
+ them. Use the project's scripts first; generated projects expose:
111
102
 
112
103
  ```bash
113
- [ -f .dev.vars.example ] && cp .dev.vars.example .dev.vars
114
- openssl rand -hex 32
115
- pnpm dev
104
+ pnpm exec mantle --help
105
+ pnpm validate
106
+ pnpm introspect
107
+ pnpm emit-openapi
108
+ pnpm emit-types
116
109
  ```
117
110
 
118
- Paste the generated random value into `.dev.vars` as `BETTER_AUTH_SECRET`.
119
- This secret is local only and must not be reused for production. Use
120
- `localhost`, not `127.0.0.1`, in local examples. A fresh blank site may
121
- return 404 on the public home route until the type overlay adds one; treat
122
- that as an empty-site state, not a failure, when validation and admin
123
- routes are alive.
124
-
125
111
  ## Production
126
112
 
127
- Landing already created the GitHub repo and the first Cloudflare deploy.
128
- To finish production verify the deploy, wire per-site staff auth, smoke
129
- test, and hand off the operator setup URL — continue with the provision
130
- skill:
131
- <https://raw.githubusercontent.com/aotter/mantle/develop/skills/provision/SKILL.md>.
113
+ Local cold start intentionally stops before GitHub and Cloudflare operations.
114
+ When the user asks to ship, use `mantle:provision` from the installed plugin or
115
+ `node_modules/@aotter/mantle/skills/provision/SKILL.md`.
116
+
117
+ Mantle landing is the first-run option when the user wants Mantle to create the
118
+ private GitHub repo, connect Cloudflare, and offer paid hosted auth. Free
119
+ self-hosted auth requires the owner to configure their GitHub OAuth App and
120
+ provider secrets.
121
+
122
+ ## Report
123
+
124
+ Return:
125
+
126
+ - created or opened project path;
127
+ - selected type and why;
128
+ - local URL;
129
+ - validation and typecheck results;
130
+ - observed GitHub, deploy, and auth state;
131
+ - three tailored next options: shape the visual experience, build the first
132
+ real business workflow, or finish deploy/auth if incomplete. Never leave
133
+ auth or seed data as the only next step.
132
134
 
133
135
  ## Don't
134
136
 
135
- - Don't run or look for `create-mantle`; it was retired with provisioning v2.
136
- - Don't rebuild the manual interview / prompt-composition harness.
137
- - Don't scaffold a project from scratch locally; launch happens on landing.
138
- - Don't block the first useful page on polishing prose or writing a site letter.
139
- - Don't ask for a Cloudflare API token in the base flow.
140
- - Don't require R2 media setup in the base flow; it is optional
141
- post-launch work.
137
+ - Don't use the Mantle SDK checkout as the generated application.
138
+ - Don't hand-compose starter layers; materialize the generated provision
139
+ bundle.
140
+ - Don't push, deploy, or configure providers during local cold start.
142
141
  - Don't commit provider secrets.
143
- - Don't use `127.0.0.1` in OAuth callback examples; use `localhost` locally
144
- and the real Worker URL in production.
142
+ - Don't block the first useful page on optional media storage.
@@ -1,11 +1,10 @@
1
1
  ---
2
- name: mantle:plugin
2
+ 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
- source: "@aotter/mantle"
5
- sourcePath: skills/plugin/SKILL.md
6
- when_to_invoke: |
7
- The user asks for a marketplace/plugin/capability install, or wants a domain feature that should be repeatable across starters and adapters.
8
- applies_to: mantle@v0.1.0
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/plugin/SKILL.md
7
+ applies_to: mantle@v0.1.0
9
8
  ---
10
9
 
11
10
  # Mantle Plugin
@@ -1,79 +1,27 @@
1
1
  ---
2
- name: mantle provision
3
- description: Finish production for a Mantle site after Mantle landing has provisioned it. Landing already created the private GitHub repo and the first Cloudflare Worker deploy; this skill covers verifying that deploy, wiring per-site staff auth (GitHub OAuth App + Worker secrets), smoke testing, and handing off the operator setup URL.
4
- when_to_invoke: |
5
- Mantle landing has created the repo and the first Cloudflare deploy, the user wants production fully usable, and staff sign-in / MCP still needs wiring.
6
- applies_to: mantle@v0.1.0
2
+ name: provision
3
+ description: Ship a local or Mantle landing-generated project to Cloudflare and finish production auth. Use when a Mantle project is ready for GitHub, Cloudflare deployment, self-hosted GitHub OAuth, paid Mantle hosted auth verification, production smoke testing, or operator handoff.
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/provision/SKILL.md
7
+ applies_to: mantle@v0.1.0
7
8
  ---
8
9
 
9
10
  # Provision a Mantle Project
10
11
 
11
- Provisioning is landing-driven. **Mantle landing is the executor for the
12
- first deploy**: it creates the user's private GitHub repo, commits the
13
- blank deployable site, connects Cloudflare Workers CI, and triggers the
14
- first build. You pick up after that to make production fully usable.
15
-
16
- The Worker boots before staff auth is configured — it serves public routes
17
- and returns a clean `503 setup_incomplete` on auth-gated routes until the
18
- GitHub OAuth App and Worker secrets are set. Your remaining job is to
19
- finish that wiring, verify, and hand off.
20
-
21
- Keep provisioning boring: set the few secrets, commit non-secret config,
22
- let Cloudflare CI redeploy. Do not re-create the repo, re-run the first
23
- deploy, or resurrect a heavy `provision:up` orchestrator — both retired
24
- with v2.
25
-
26
- ## End State
27
-
28
- - Cloudflare has deployed the Worker from the repo (landing's first build,
29
- plus your redeploy after config).
30
- - `wrangler.toml` carries `PUBLIC_ORIGIN`, `GITHUB_CLIENT_ID`,
31
- `ADMIN_GITHUB_LOGIN`, and the correct Worker name.
32
- - Worker secrets are set: `GITHUB_CLIENT_SECRET`, `BETTER_AUTH_SECRET`,
33
- and any optional feature/provider secrets.
34
- - `AGENTS.md` `Public site:` points at the deployed Worker URL.
35
- - Staff MCP and browser admin sign-in work.
36
- - Operator setup URL handed to the owner:
37
- `https://mantle.tools/connect?site=<url-encoded-worker-url>`.
38
-
39
- Provision does not seed production content. First real content is created
40
- after owner sign-in through Staff MCP / admin authoring.
41
-
42
- Media uploads are optional post-launch work. Do not require storage or media
43
- upload credentials to finish first production provisioning. If the current
44
- repo uses the Cloudflare adapter and the owner asks for staff image/file
45
- uploads later, follow the Cloudflare R2 recipe:
46
- <https://raw.githubusercontent.com/aotter/mantle/develop/docs/media-uploads.md>
47
- and use Claude Code or another local/non-sandboxed coding agent for the
48
- upload workflow. Do not use Claude Cowork for R2 uploads; use a
49
- non-sandboxed agent instead.
50
-
51
- ## Principles
52
-
53
- 1. Use the user's accounts. The repo and Worker belong to the user's
54
- GitHub and Cloudflare accounts.
55
- 2. No Cloudflare API token in the base flow. Prefer a Cloudflare MCP
56
- connector for provider work; use `wrangler login` as a fallback after
57
- the user agrees.
58
- 3. GitHub OAuth is per-site and user-owned. The callback URL is exactly
59
- `<worker-url>/api/auth/callback/github`.
60
- 4. Launch state is context, not provider authority.
61
- `.mantle/launch-state.json` may supply owner, admin login, repo name,
62
- locales, and type. It does not authorize Cloudflare operations, OAuth
63
- secrets, or custom domains.
64
- 5. `BETTER_AUTH_SECRET` is load-bearing. Set it once and preserve it;
65
- rotating it invalidates every session.
66
-
67
- ## Flow
68
-
69
- Run from the generated project root.
70
-
71
- 1. Verify the landing deploy. Confirm Cloudflare Workers CI built and
72
- deployed from GitHub, and capture the live `*.workers.dev` URL. The
73
- public site should respond; auth-gated routes return `503
74
- setup_incomplete` until step 4 — that is expected, not a failure.
75
-
76
- 2. Confirm the local repo is clean and valid before changing config:
12
+ Local cold start deliberately stops before this skill. Provision only after the
13
+ user asks to create remote resources or ship production.
14
+
15
+ ## Source of Truth
16
+
17
+ 1. Read `.mantle/launch-state.json`, `.mantle/handoff.md`, `wrangler.toml`,
18
+ and the current git remotes.
19
+ 2. Read installed `@aotter/mantle*` versions from `package.json`.
20
+ 3. Use matching embedded docs under `node_modules/@aotter/mantle/docs/`.
21
+ 4. Never infer provider authority from launch state. Confirm the active GitHub
22
+ and Cloudflare accounts before changing them.
23
+
24
+ Run the local gate first:
77
25
 
78
26
  ```bash
79
27
  pnpm install --frozen-lockfile
@@ -82,95 +30,116 @@ pnpm typecheck
82
30
  git status --short
83
31
  ```
84
32
 
85
- 3. Ask the user to create the per-site GitHub OAuth App once the Worker
86
- URL is known:
33
+ ## Resume From Observed State
34
+
35
+ Do not branch on how the project was created. Verify these facts and skip
36
+ completed work:
37
+
38
+ 1. `git remote get-url origin` confirms the GitHub repo.
39
+ 2. An HTTPS `PUBLIC_ORIGIN` that responds confirms the Cloudflare deploy.
40
+ 3. `/admin/sign-in` returning `503 setup_incomplete` means auth is not bound.
41
+ Use the recorded auth intent only to choose hosted or self-hosted setup;
42
+ live behavior is authoritative.
43
+
44
+ If there is no remote, confirm the target account, create a private repo,
45
+ commit, and push `main`. If there is no live Worker, confirm the Cloudflare
46
+ account, prefer an available connector, or use `pnpm exec wrangler login` with
47
+ the user's agreement, then run `pnpm deploy`.
48
+
49
+ Capture the live URL in `PUBLIC_ORIGIN` and `Public site:` in `AGENTS.md`, then
50
+ commit and push non-secret changes. Reuse any repo or Worker already created
51
+ by landing. Workers Builds is optional after a direct deploy.
52
+
53
+ ## Choose Auth
54
+
55
+ - **Self-hosted — free:** configure the owner's per-site GitHub OAuth App and
56
+ Worker secrets using the steps below.
57
+ - **Mantle hosted auth — paid:** use only when the landing handoff records a
58
+ hosted allocation and client configuration. Mantle Platform operates the
59
+ identity provider; do not ask the user for a per-site GitHub OAuth App.
60
+
61
+ Do not claim that hosted auth can attach to an arbitrary local repo unless the
62
+ current Mantle landing flow explicitly supplies that handoff.
63
+
64
+ For the exact boundary, read
65
+ `node_modules/@aotter/mantle/docs/auth-hosting-model.md`.
66
+
67
+ ## Self-hosted Auth
68
+
69
+ 1. Ask the user to create a GitHub OAuth App:
87
70
 
88
71
  - Homepage URL: `<worker-url>`
89
72
  - Authorization callback URL: `<worker-url>/api/auth/callback/github`
90
73
  - Device Flow: unchecked
91
74
 
92
- Ask for the Client ID in chat. Keep the Client Secret out of chat and pass
93
- it through the hidden shell prompt below.
75
+ 2. Put non-secret values in `wrangler.toml`:
94
76
 
95
- 4. Write non-secret production config into `wrangler.toml`
96
- (`PUBLIC_ORIGIN=<worker-url>`, `GITHUB_CLIENT_ID`, `ADMIN_GITHUB_LOGIN`,
97
- and the correct Worker `name`), then set the Worker secrets. Prefer a
98
- Cloudflare MCP connector; otherwise use Wrangler after the user agrees
99
- to `wrangler login`:
77
+ - `PUBLIC_ORIGIN`
78
+ - `GITHUB_CLIENT_ID`
79
+ - `ADMIN_GITHUB_LOGIN`
80
+ - correct Worker `name`
81
+
82
+ 3. Keep the Client Secret out of chat. Prefer a Cloudflare connector for
83
+ secrets; otherwise use hidden shell input:
100
84
 
101
85
  ```bash
102
- pnpm exec wrangler login
103
- read -rsp "GitHub OAuth client secret: " GITHUB_CLIENT_SECRET && printf "\n"
104
- printf '%s' "$GITHUB_CLIENT_SECRET" | pnpm exec wrangler secret put GITHUB_CLIENT_SECRET
86
+ read -rsp "GitHub OAuth client secret: " MANTLE_GITHUB_CLIENT_SECRET && printf "\n"
87
+ printf '%s' "$MANTLE_GITHUB_CLIENT_SECRET" | pnpm exec wrangler secret put GITHUB_CLIENT_SECRET
105
88
  openssl rand -hex 32 | pnpm exec wrangler secret put BETTER_AUTH_SECRET
106
- unset GITHUB_CLIENT_SECRET
89
+ unset MANTLE_GITHUB_CLIENT_SECRET
107
90
  ```
108
91
 
109
- Set `BETTER_AUTH_SECRET` only on the first run; reuse the existing value on
110
- later runs.
92
+ Set `BETTER_AUTH_SECRET` once and preserve it. Rotating it invalidates existing
93
+ sessions.
111
94
 
112
- 5. Commit and push the non-secret config so Cloudflare CI redeploys:
95
+ 4. Commit and push only non-secret config, then redeploy:
113
96
 
114
97
  ```bash
115
98
  git add wrangler.toml AGENTS.md
116
- git commit -m "mantle: wire production provision"
99
+ git commit -m "mantle: wire production auth"
117
100
  git push
101
+ pnpm deploy
118
102
  ```
119
103
 
120
- Wait for Workers Builds to redeploy from the pushed commit. If the
121
- dashboard build is unavailable, run `pnpm deploy` as a fallback and explain
122
- that to the user.
104
+ ## Hosted Auth
105
+
106
+ Follow the landing handoff and generated client configuration. Hosted
107
+ configuration remains in landing-managed Cloudflare Worker bindings; do not
108
+ write client secrets into `wrangler.toml`.
123
109
 
124
- 6. Smoke test:
110
+ Verify that admin sign-in redirects to Mantle Platform and Staff MCP
111
+ authenticates, then skip the self-hosted flow.
112
+
113
+ ## Smoke Test
125
114
 
126
115
  - public home route;
127
116
  - `/admin/sign-in`;
128
- - GitHub admin sign-in;
117
+ - selected admin sign-in path;
129
118
  - `/mcp/staff` with an agent client when available;
130
- - a type-specific core workflow.
119
+ - one type-specific core workflow.
131
120
 
132
- A fresh site may have no public home content yet. A 404 on the locale
133
- homepage is acceptable only after the Worker boots, `/admin/sign-in`
134
- loads, and auth / MCP boundaries behave correctly.
121
+ Media uploads are optional. Configure R2 only when the owner asks for
122
+ staff-managed files; then read
123
+ `node_modules/@aotter/mantle/docs/media-uploads.md`.
135
124
 
136
125
  ## Handoff
137
126
 
138
- After smoke checks pass, render a short final handoff in the user's
139
- language:
140
-
141
- - Public URL.
142
- - Admin sign-in URL.
143
- - Staff MCP URL.
144
- - Operator setup URL (`https://mantle.tools/connect?site=...`).
145
- - What changed locally and what was committed.
146
- - Any intentionally deferred feature / provider setup.
147
-
148
- Point future agents at `AGENTS.md`, `.mantle/launch-state.json`, and the
149
- repo-local `.agent/skills/` directory (`mantle:develop`, `mantle:overlay`,
150
- `mantle:theme`, `mantle:update`).
151
-
152
- ## Diagnostics
127
+ Return:
153
128
 
154
- | Symptom | Likely cause | Fix |
155
- |---|---|---|
156
- | Auth-gated routes return `503 setup_incomplete` | GitHub OAuth + secrets not wired yet | Expected before step 3-4; finish the OAuth App + secrets, then redeploy. |
157
- | `wrangler secret put` targets the wrong account | Wrangler logged into another Cloudflare account | Re-run `pnpm exec wrangler login` and confirm the account. |
158
- | GitHub OAuth callback mismatch | OAuth App callback URL is wrong | Set it exactly to `<worker-url>/api/auth/callback/github`. |
159
- | Owner signs in but admin / MCP returns 403 | `ADMIN_GITHUB_LOGIN` does not match the signed-in GitHub login | Fix the `ADMIN_GITHUB_LOGIN` value and redeploy. |
160
- | Worker boots but sessions fail after a rerun | `BETTER_AUTH_SECRET` changed or was deleted | Restore the old secret if available; otherwise users must sign in again. |
161
- | `create_media_upload` is missing from Staff MCP | Optional R2 media is not configured, or `media.purposes` is empty | Only fix this if the owner explicitly wants media uploads; follow `docs/media-uploads.md`. |
162
- | Upload session works but the PUT to R2 fails from Claude Cowork | Cowork sandbox egress blocks direct R2 uploads | Retry from Claude Code / another non-sandboxed agent. |
129
+ - public URL;
130
+ - admin sign-in URL;
131
+ - Staff MCP URL;
132
+ - operator setup URL:
133
+ `https://mantle.tools/connect?site=<url-encoded-worker-url>`;
134
+ - remote resources created or reused;
135
+ - auth mode and any intentionally deferred setup.
163
136
 
164
137
  ## Don't
165
138
 
166
- - Don't ask for a Cloudflare API token in the base first-run path.
167
- - Don't require R2 media setup in the base first-run path.
168
- - Don't re-create the repo or re-run the first deploy from the agent;
169
- landing owns first provisioning.
170
- - Don't resurrect `provision:up` / `provision:plan` as a second
171
- provisioner; those scripts were retired with v2.
139
+ - Don't create remote resources before the user asks to ship.
140
+ - Don't ask for a Cloudflare API token in the base flow.
172
141
  - Don't commit provider secrets.
173
- - Don't use `127.0.0.1` in OAuth callback examples; use `localhost` locally
174
- and the real Worker URL in production.
175
- - Don't use `/admin/auth/github/callback`; the Better Auth callback path is
142
+ - Don't require R2 for first production.
143
+ - Don't invent a second provision orchestrator.
144
+ - Don't use `/admin/auth/github/callback`; the callback is
176
145
  `/api/auth/callback/github`.
@@ -1,11 +1,10 @@
1
1
  ---
2
- name: mantle:theme
2
+ name: theme
3
3
  description: Apply brand and visual direction in a Mantle project without depending on starter-owned skill semantics.
4
- source: "@aotter/mantle"
5
- sourcePath: skills/theme/SKILL.md
6
- when_to_invoke: |
7
- User wants visual, brand, layout, copy, or UI polish in an existing Mantle project.
8
- applies_to: mantle@v0.1.0
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/theme/SKILL.md
7
+ applies_to: mantle@v0.1.0
9
8
  ---
10
9
 
11
10
  # Mantle Theme
@@ -1,11 +1,10 @@
1
1
  ---
2
- name: mantle:update
2
+ name: update
3
3
  description: Check a Mantle project for drift against its Core SDK, starter source, or installed plugin lockfiles.
4
- source: "@aotter/mantle"
5
- sourcePath: skills/update/SKILL.md
6
- when_to_invoke: |
7
- User asks to update Mantle, compare generated files, refresh starter/vendor output, or inspect marketplace plugin drift.
8
- applies_to: mantle@v0.1.0
4
+ metadata:
5
+ source: "@aotter/mantle"
6
+ sourcePath: skills/update/SKILL.md
7
+ applies_to: mantle@v0.1.0
9
8
  ---
10
9
 
11
10
  # Mantle Update