@aotter/mantle 0.2.1-alpha.2 → 0.2.1-alpha.4
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 +16 -177
- package/dist/build/compiler.js +3 -3
- package/dist/infrastructure/help.js +1 -3
- package/dist/usecase/adminDescriptors.js +1 -1
- package/dist/usecase/generate.js +20 -4
- package/dist/usecase/rest.js +2 -4
- package/docs/examples/README.md +2 -2
- package/docs/examples/app-shell/README.md +1 -1
- package/docs/examples/app-shell/accept.mjs +12 -2
- package/docs/examples/app-shell/package.json +3 -3
- package/docs/handbook/cloudflare/authentication.md +1 -1
- package/docs/handbook/cloudflare/deploy-and-operate.md +20 -8
- package/docs/handbook/cloudflare/media-r2.md +31 -0
- package/docs/handbook/examples/hub.md +1 -1
- package/docs/handbook/guides/agent-setup.md +25 -67
- package/docs/handbook/guides/agent-workflow-acceptance.md +33 -4
- package/docs/handbook/guides/mcp-apps.md +3 -1
- package/docs/{skills/performance/SKILL.md → handbook/guides/performance.md} +55 -32
- package/docs/handbook/guides/size-and-startup.md +2 -2
- package/docs/handbook/guides/typed-queries.md +12 -0
- package/docs/handbook/navigation.json +4 -0
- package/docs/handbook/releases/index.md +63 -2
- package/docs/{upgrade-0.1-to-0.2.md → handbook/releases/upgrade-0.1-to-0.2.md} +13 -13
- package/docs/handbook/start/agents.md +43 -6
- package/docs/handbook/start/quickstart-worker.md +1 -1
- package/package.json +1 -1
- package/skills/README.md +7 -69
- package/skills/mantle/SKILL.md +16 -81
- package/docs/skills/develop/SKILL.md +0 -100
- package/docs/skills/integrate/SKILL.md +0 -51
- package/docs/skills/media-gc/SKILL.md +0 -109
- package/docs/skills/provision/SKILL.md +0 -44
- package/docs/skills/update/SKILL.md +0 -42
package/skills/mantle/SKILL.md
CHANGED
|
@@ -1,90 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mantle
|
|
3
|
-
description: Create, continue, test or deploy a Mantle application
|
|
3
|
+
description: Create, continue, upgrade, test, speed up or deploy a Mantle application (@aotter/mantle manifests, SQL Views and Procedures, MCP, REST, Admin, mantle generate). Every contract comes from the installed version's `mantle help`.
|
|
4
4
|
metadata:
|
|
5
5
|
source: "@aotter/mantle"
|
|
6
6
|
sourcePath: skills/mantle/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: plugin
|
|
9
|
-
projectionReason: The plugin's authoring entry skill is installed from the repository; workflow documentation comes from the installed SDK package.
|
|
10
7
|
---
|
|
11
8
|
|
|
12
9
|
# Mantle
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
and
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Work in the user's application, outside the SDK checkout. Read package.json, the lockfile, installed SDK README and node_modules/@aotter/mantle/docs/. Those files define the exact version's contract. Preserve existing identity, handles, routes and resources.
|
|
31
|
-
For existing older applications, use their installed docs until the user requests an upgrade; if an older version
|
|
32
|
-
lacks a guide named here, record the missing guidance and keep that version's contract.
|
|
33
|
-
|
|
34
|
-
## Choose the installed package skill
|
|
35
|
-
|
|
36
|
-
- Read `node_modules/@aotter/mantle/docs/skills/develop/SKILL.md` to change an existing project's manifests, SQL, handlers, service entry or surfaces.
|
|
37
|
-
- Read `node_modules/@aotter/mantle/docs/skills/integrate/SKILL.md` to add Mantle to an application with existing code, users or data.
|
|
38
|
-
- Read `node_modules/@aotter/mantle/docs/skills/update/SKILL.md` to upgrade Mantle, including from 0.1.x.
|
|
39
|
-
- Read `node_modules/@aotter/mantle/docs/skills/provision/SKILL.md` only for an authorized production deployment.
|
|
40
|
-
- Read `node_modules/@aotter/mantle/docs/skills/media-gc/SKILL.md` only to audit or remove stale uncommitted media uploads.
|
|
41
|
-
- Read `node_modules/@aotter/mantle/docs/skills/performance/SKILL.md` after acceptance converges, or when a page, first request or query is slow.
|
|
42
|
-
|
|
43
|
-
## New application
|
|
44
|
-
|
|
45
|
-
Node must be 22.22 or newer. Stable 0.2.0 is available as `@aotter/mantle@0.2.0`; pin selected Mantle packages to that exact version. Create it with `npx @aotter/mantle@<exact version> init <directory>`, then follow
|
|
46
|
-
`mantle help` ("Build from a product brief") and the app's `README.md`. Without the user listing them, a complete app
|
|
47
|
-
includes:
|
|
48
|
-
|
|
49
|
-
- Email OTP sign-in, the two roles `admin` and `user`, Admin for `admin`, MCP for both roles (`/mcp`, `/mcp/admin`)
|
|
50
|
-
and REST: the shell already wires them; keep them.
|
|
51
|
-
- Real business rules in SQL Procedures (`mantle help sql-patterns`), not in handler code around separate writes.
|
|
52
|
-
- For visitor pages, everything in `mantle help public-pages` (SEO, AEO, sitemap, robots, `llms.txt`), styled.
|
|
53
|
-
- Local HTTP checks (`mantle help local-testing`), then independent acceptance with `pnpm accept`
|
|
54
|
-
(`mantle help agent-workflow-acceptance`), then the installed `docs/skills/performance/SKILL.md`.
|
|
55
|
-
|
|
56
|
-
Take patterns from `mantle help examples` into the app's own manifests and `src/`; do not copy an example directory
|
|
57
|
-
over the app. Resolve each `AGENT:` or name the ones you left. Generation only, inside an app you already have: skip
|
|
58
|
-
`init` and use `mantle generate` (`mantle help project-and-cli`).
|
|
59
|
-
|
|
60
|
-
## Accept before reporting done
|
|
61
|
-
|
|
62
|
-
Before reporting any new app or feature as done, follow `mantle help agent-workflow-acceptance`: a private rubric,
|
|
63
|
-
then one fresh agent per role given only its role and the URLs `pnpm accept` prints, at most three rounds. The first
|
|
64
|
-
delivery covers every role and surface; after a repair, the guide's "Re-verify what a repair touches" rule decides what
|
|
65
|
-
re-runs: a page-only repair re-runs the affected UI, while auth, scope, SQL Procedure, unique index or shared-transport changes widen
|
|
66
|
-
to every surface they reach. State the round and revision of any evidence you reuse. If it was
|
|
67
|
-
not run, report the work as UNVERIFIED rather than done; if it could not run, BLOCKED. Report status per layer as that
|
|
68
|
-
guide's "Report done-ness in layers" defines; a block from your environment (approval policy, missing browser,
|
|
69
|
-
network) is BLOCKED on its layer, not a product failure, and does not discard the other layers.
|
|
70
|
-
|
|
71
|
-
Once acceptance is CONVERGED, read the installed `docs/skills/performance/SKILL.md`: it decides which of front end,
|
|
72
|
-
cold start and backend load apply, and runs them before you report done. This is the one exception to installed docs
|
|
73
|
-
winning: if the installed package predates that skill, read
|
|
74
|
-
[the 0.2.1 copy](https://github.com/aotter/mantle/blob/v0.2.1/docs/skills/performance/SKILL.md) and the pages it links
|
|
75
|
-
from the installed docs with `mantle help <topic>`.
|
|
76
|
-
|
|
77
|
-
## Deployment
|
|
78
|
-
|
|
79
|
-
Deploy only when the user requests it, following the installed `docs/skills/provision/SKILL.md` and the selected
|
|
80
|
-
host's native workflow. Local project creation alone is not deployment authorization.
|
|
81
|
-
|
|
82
|
-
## Existing project and handoff
|
|
83
|
-
|
|
84
|
-
Preserve the user's manifests, `src/` files, identity, package versions and provider resources. Run the project's
|
|
85
|
-
generate command with `--check` and its own tests before and after a change.
|
|
86
|
-
|
|
87
|
-
Report the project path, the exact Mantle version, what you changed, the four-layer status with each layer's checks
|
|
88
|
-
and results (the independent acceptance verdict, CONVERGED / BLOCKED / UNVERIFIED, is layer 3), the performance verdict
|
|
89
|
-
(PASS / PARTIAL / SKIPPED) with its before and after numbers, and anything left for the user, including what would
|
|
90
|
-
unblock a BLOCKED layer.
|
|
11
|
+
This skill only routes; it holds no contract. The installed `@aotter/mantle` is the authority, and `mantle help` prints
|
|
12
|
+
its docs one topic at a time.
|
|
13
|
+
|
|
14
|
+
1. **Start with `mantle help`.** In a project run `npx mantle help`; before one exists, `npx @aotter/mantle@<exact
|
|
15
|
+
version> help`. It prints the entry page (how to choose, build and accept); `mantle help <topic>` prints one page and
|
|
16
|
+
ends with the commands for the pages it links. `mantle help topics` lists them all. For a new app, do every step of its
|
|
17
|
+
"Build from a product brief". Follow it rather than this file, an SDK checkout or an online copy.
|
|
18
|
+
2. **Work in the user's application.** Read its `package.json` and lockfile for the exact Mantle version and keep using
|
|
19
|
+
that version's docs until the user asks to upgrade (`mantle help releases/index`). Preserve existing code, identity,
|
|
20
|
+
versions and resources.
|
|
21
|
+
3. **Plan once, then run to the end.** For a new app, first reply with the entry page's plan, in plain business terms
|
|
22
|
+
and with the questions the brief leaves open, and wait for one go-ahead. Then build, show the Developer UI, accept
|
|
23
|
+
and measure without stopping. Never report done without acceptance and performance; end with what each found and
|
|
24
|
+
changed, and each layer as CONVERGED, BLOCKED or UNVERIFIED.
|
|
25
|
+
4. **Deploy, delete remote data or publish nothing unless the user asks for that exact action.**
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: develop
|
|
3
|
-
description: Work on an existing Mantle 0.2 project — manifests, SQL Views and Procedures, ref handlers, the service entry, surfaces, identity, MCP tool design and independent acceptance — using the installed package's contract.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/develop/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Mantle Develop
|
|
12
|
-
|
|
13
|
-
## Workflow
|
|
14
|
-
|
|
15
|
-
Read the installed SDK README, then follow the version-matched [project and CLI
|
|
16
|
-
workflow](../../handbook/start/project-and-cli.md) before editing.
|
|
17
|
-
|
|
18
|
-
Use the native Store/query/surface entries and app-owned fetch from the [service
|
|
19
|
-
composition guide](../../handbook/cloudflare/service-entry.md).
|
|
20
|
-
Pair every HTTP Trigger with an MCP Trigger by default; see [Trigger](../../handbook/reference/trigger.md)
|
|
21
|
-
for the generate warning and deliberate asymmetry exception.
|
|
22
|
-
Keep optional modules out of unused entry imports and auth dynamically loaded.
|
|
23
|
-
Run actual public/member/admin HTTP, MCP and UI scenarios; verify stored state,
|
|
24
|
-
visibility, OCC and restart persistence, not just a 200 response.
|
|
25
|
-
Before reporting any new app or feature as done, follow the [independent
|
|
26
|
-
acceptance guide](../../handbook/guides/agent-workflow-acceptance.md): write a
|
|
27
|
-
private rubric, then give one fresh agent per role (`admin`, `user`) only its
|
|
28
|
-
role and entry points, across every surface it uses. After a repair, re-run
|
|
29
|
-
the scope its [re-verification
|
|
30
|
-
rule](../../handbook/guides/agent-workflow-acceptance.md#re-verify-what-a-repair-touches)
|
|
31
|
-
names and state which evidence you reused. This is not limited to
|
|
32
|
-
MCP; if it was not run, say so explicitly and report the work as UNVERIFIED
|
|
33
|
-
rather than done. Hand off with the guide's [layered
|
|
34
|
-
report](../../handbook/guides/agent-workflow-acceptance.md#report-done-ness-in-layers):
|
|
35
|
-
an environment block is BLOCKED on its layer, never a product failure. For MCP workflows, also run the guide's design audit before implementing
|
|
36
|
-
tools. Once acceptance converges, follow the [performance skill](../performance/SKILL.md) before reporting done.
|
|
37
|
-
|
|
38
|
-
For native Admin, read the [current guide](../../handbook/guides/native-admin.md):
|
|
39
|
-
the app builds Admin with `mantle bundle`. To customise pages, slots, hooks or
|
|
40
|
-
MCP-host-safe components, follow [Customising Admin](../../handbook/guides/native-admin.md#customising-admin).
|
|
41
|
-
Custom structured inputs and browser pages can use the optional
|
|
42
|
-
`@aotter/mantle-admin/media` controlled `MediaPicker`: pass `readOnly` and an exact
|
|
43
|
-
`uploadPurpose` (omit for selection only), apply `onSelect` to the local draft,
|
|
44
|
-
and keep its import out of the MCP App entry. See the native Admin media example.
|
|
45
|
-
Keep matching SDK, Admin and UI versions. Ref handlers retain caller-bound
|
|
46
|
-
`ctx.store`; generic Admin reads use shared generated View templates and writes
|
|
47
|
-
use native Procedure fragments.
|
|
48
|
-
Check actual member/Admin OTP, private scope/TTL/translation visibility, paging,
|
|
49
|
-
statistics, safe/exact OCC and no automatic retry after unknown 503 outcomes.
|
|
50
|
-
|
|
51
|
-
For application-owned MCP App entries and host checks, follow the [MCP Apps
|
|
52
|
-
guide](../../handbook/guides/mcp-apps.md).
|
|
53
|
-
|
|
54
|
-
Build a custom frontend with `App` from `@modelcontextprotocol/ext-apps`: register
|
|
55
|
-
`ontoolinput`/`ontoolresult` before `connect()`, and use `callServerTool` for
|
|
56
|
-
host-proxied calls. Keep protocol negotiation and message routing in the official
|
|
57
|
-
client; importing its types while writing a second `postMessage` bridge is
|
|
58
|
-
insufficient.
|
|
59
|
-
|
|
60
|
-
For Admin UI upgrades, follow the installed handbook's
|
|
61
|
-
[retained-page recipe](../../handbook/guides/mcp-apps.md#keep-old-conversations-working-after-an-upgrade).
|
|
62
|
-
Keep deployed snapshots in source/artifact storage and pass `previous` to
|
|
63
|
-
`adminMcpApps`; verify old conversations after a changed UI build without host
|
|
64
|
-
tool refresh, reconnection or cache clearing. Keep tool contracts compatible
|
|
65
|
-
through the declared retention window.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Place admin MCP Procedures in Admin deliberately: `spec.uiSchema.collectionAction:
|
|
69
|
-
<schema-name>` adds a collection-header action; `spec.target: { schema, id,
|
|
70
|
-
version? }` selects row actions and binds the row id / reviewed OCC version to
|
|
71
|
-
the named inputs. Other admin operations appear under Operations in the sidebar.
|
|
72
|
-
Keep state conditions in the SQL WHERE: simple AND equality/IN literals become
|
|
73
|
-
row-menu hints, while the Procedure remains the authority. Required-ref child
|
|
74
|
-
collections fold under their parent's sidebar group; with two or more required
|
|
75
|
-
`id` refs, set Schema `uiSchema.nav.parentField` to the parent's ref (generate
|
|
76
|
-
refuses otherwise); use `uiSchema.nav.standalone: true` for a top-level entry.
|
|
77
|
-
|
|
78
|
-
## Database changes
|
|
79
|
-
|
|
80
|
-
The runtime never creates, alters or checks tables. Boot and requests run no DDL, introspection or schema checks.
|
|
81
|
-
|
|
82
|
-
For the first install, apply generated `schema.sql`, including selected auth/site DDL, to an empty database. Apply selected seed SQL explicitly.
|
|
83
|
-
|
|
84
|
-
For every later schema change, the application's coding agent diffs the regenerated `schema.sql`, writes a migration with the host's native tool (`wrangler d1 migrations` or the app's PostgreSQL migration tool), rehearses it on a copy, and applies it before deploying the new code.
|
|
85
|
-
|
|
86
|
-
Destructive changes and type changes need explicit data migration. Mantle drops nothing. Initial `schema.sql` is not an upgrade script.
|
|
87
|
-
|
|
88
|
-
## Data paths
|
|
89
|
-
|
|
90
|
-
Writes use Store `insert` / `update` / `delete`, `batch`, `transaction`, or declared Procedures. Never use raw SQL writes: they bypass scope, TTL, publishing and system-column rules. For reads beyond an id lookup or simple AND filter (joins, aggregates, OR, reuse), declare an internal View so the SQL is reviewable and typed. Store `findById`, `find` and `first` remain suitable for handler lookups and embedding in an existing app. Ref handlers receive `ctx.store` bound to the same Caller and transaction.
|
|
91
|
-
|
|
92
|
-
For published-content replacement with preview and rollback, follow `mantle help revisions`: Core supplies OCC, Schema locks and atomic `store.batch`; the recipe binds the previewed revision ID/version and atomically seals it while switching the parent. Applications own retention and review policy; Core does not mandate a preparation step. Keep the previewed version on submit and require another preview after a revision conflict.
|
|
93
|
-
Use its custom Native Admin preview/switch page: freeze the reviewed content and both row versions, then submit them through the authorized operation. Do not make editors copy version numbers or silently replace the reviewed snapshot after a refresh; conflicts require another explicit preview.
|
|
94
|
-
|
|
95
|
-
For simple creates/partial updates, prefer Store-backed ref Procedures; keep
|
|
96
|
-
Procedure `requires`/generated input checks, use only allowed patch fields and
|
|
97
|
-
return safe business fields with the actual returned ID/version. Preserve
|
|
98
|
-
omitted fields and document null semantics. Retain SQL for atomic conditional
|
|
99
|
-
or related writes; D1 batches cannot consume an earlier result. Follow the
|
|
100
|
-
[Store write guidance](../../handbook/guides/typed-queries.md#prefer-store-backed-ref-procedures-for-simple-writes).
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: integrate
|
|
3
|
-
description: Add Mantle 0.2 to an existing application, or rebuild one on Mantle and migrate its data. Use when the application already has its own code, routes, users, storage or deployment.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/integrate/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Integrate Mantle into an existing application
|
|
12
|
-
|
|
13
|
-
## Workflow
|
|
14
|
-
|
|
15
|
-
Read the installed SDK README, then follow the version-matched [project and CLI
|
|
16
|
-
workflow](../../handbook/start/project-and-cli.md) before editing.
|
|
17
|
-
|
|
18
|
-
Keep the application router, database/pool, identity and frontend. Replace
|
|
19
|
-
Core consumers explicitly and compose only selected generated entries. Resolve
|
|
20
|
-
one Caller per request with the shared cookie-session origin check. Rehearse
|
|
21
|
-
data-preserving schema/auth/role migrations on a copy and retain rollback artifacts.
|
|
22
|
-
Initial schema.sql is for an empty database, not an in-place upgrade. Requests run
|
|
23
|
-
no DDL or storage checks; the only request-time write outside app operations is
|
|
24
|
-
the configured OAuth resource row (see [OAuth](../../handbook/guides/oauth.md)).
|
|
25
|
-
Verify cutover with actual app tests. Before reporting user-facing work done, run
|
|
26
|
-
[independent acceptance](../../handbook/guides/agent-workflow-acceptance.md), then the
|
|
27
|
-
[performance skill](../performance/SKILL.md).
|
|
28
|
-
|
|
29
|
-
Preserve the app router, verified identity and native resources. For selected
|
|
30
|
-
Admin, follow the [native guide](../../handbook/guides/native-admin.md) for its
|
|
31
|
-
application-built bundle and service composition.
|
|
32
|
-
Do not import old `/spec`, `/core` or runtime surface APIs. Review data/role
|
|
33
|
-
migrations explicitly; full cross-target int64 parity and automated transfer
|
|
34
|
-
are not this release's upgrade contract.
|
|
35
|
-
|
|
36
|
-
## Partial adoption in TypeScript/Node
|
|
37
|
-
|
|
38
|
-
Keep the app's router, pool/handle, identity and frontend. Declare only the Schemas and operations being adopted; import selected `views/<encoded-name>.ts` or `procedures/<encoded-name>.ts`, then call `(appHandle, verifiedCaller, validatedInput)`. Bun.SQL and postgres.js fit directly; [node-postgres can adapt](../../handbook/guides/postgres-adapters.md). No Admin/auth/surface module is required for direct queries.
|
|
39
|
-
|
|
40
|
-
Existing tables need explicit migration into the declared storage shape, including system columns and constraints. Initial schema.sql must not be applied over an occupied database. Rehearse on a copy and test scope, TTL, publication, OCC and persisted state with the app's own identity.
|
|
41
|
-
|
|
42
|
-
Writes use Store or declared Procedures; never raw SQL writes to adopted collections. Use internal Views for joins, aggregates, OR and reusable reads. Store findById/find/first remain useful for simple AND lookups in existing handlers.
|
|
43
|
-
|
|
44
|
-
Direct declared Schema-column outputs in Views and SQL Procedure `RETURNING`
|
|
45
|
-
keep their authored field names; explicit aliases keep SQL casing rules. Store
|
|
46
|
-
rows and nested SQL relations use storage names. Boundary validators support a
|
|
47
|
-
permissive `format: email` check (one `@`, non-empty parts, no whitespace). For
|
|
48
|
-
LEFT JOIN paging, join on the joined Schema's id or single-field unique key and
|
|
49
|
-
keep the base indexed, non-null order/id tuple. Generation always emits `Handlers`
|
|
50
|
-
(empty without ref Procedures); pass `handlers` at `adminBindings()`, generated REST/MCP options and
|
|
51
|
-
`webmcpRoutes(catalogue, tools, handlers)`, as the app shell does.
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: media-gc
|
|
3
|
-
description: Audit and safely remove stale, uncommitted media uploads from a Mantle 0.2 Cloudflare R2 bucket. Use when an operator asks to inspect or clean objects left under uploads/ by an upload that was created but never committed.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/media-gc/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
projectionReason: Destructive remote object deletion and Cloudflare-specific; opt-in only.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Mantle Media GC
|
|
13
|
-
|
|
14
|
-
## Generated native applications (alpha.7 and later)
|
|
15
|
-
|
|
16
|
-
If the installed README describes generated native queries, read
|
|
17
|
-
`docs/handbook/cloudflare/media-r2.md` and app-owned site/media wiring instead of Core storage
|
|
18
|
-
options. Resolve the exact configured bucket and declared purposes. The
|
|
19
|
-
`uploads/` candidate audit below still applies. Committed copies live under
|
|
20
|
-
`committed/` and must never be candidates. Attempt-isolated committed copies
|
|
21
|
-
retained after an uncertain DB outcome require reconciliation with live DB
|
|
22
|
-
references before any separately authorized cleanup.
|
|
23
|
-
|
|
24
|
-
Use the connected Cloudflare API. Audit by default; delete only the exact
|
|
25
|
-
objects approved by the user.
|
|
26
|
-
|
|
27
|
-
## Preflight
|
|
28
|
-
|
|
29
|
-
1. Read `wrangler.jsonc`, the app-owned entry (`src/worker.ts` by default,
|
|
30
|
-
or the generation command's `--entry`) and its media wiring. Resolve the R2
|
|
31
|
-
bucket that `r2MediaStorage` uses and the media purpose names in
|
|
32
|
-
`siteDefaults.media.purposes` selected by `--site`.
|
|
33
|
-
2. Confirm the exact Cloudflare account and bucket. If either is ambiguous,
|
|
34
|
-
ask; never choose by name similarity.
|
|
35
|
-
3. Use the Cloudflare OpenAPI search before execution to resolve the current
|
|
36
|
-
R2 List Objects and Delete Objects endpoints. If the connected account lacks
|
|
37
|
-
access, stop. Do not create, request, or store credentials.
|
|
38
|
-
4. Stop when the service passes no `r2MediaStorage` or declares no purpose.
|
|
39
|
-
|
|
40
|
-
## How 0.2 lays out media
|
|
41
|
-
|
|
42
|
-
`POST /admin/api/media/uploads` issues presigned PUT URLs that expire after 15
|
|
43
|
-
minutes, for keys under `uploads/<purpose>/<group>/<role>.<ext>`. Commit
|
|
44
|
-
copies each checked object to `committed/<group>/<attempt>/<role>.<ext>` (with
|
|
45
|
-
`committedAt` metadata); the attempt UUID isolates concurrent commits. Upload
|
|
46
|
-
keys are removed after the database commit succeeds, or when a group is
|
|
47
|
-
rejected. An old upload key may also be leftover cleanup from a successful or
|
|
48
|
-
uncertain commit: it is not evidence that the media row is absent. Once expired,
|
|
49
|
-
it cannot create a new asset. Objects outside `uploads/` are never candidates;
|
|
50
|
-
reconcile attempt copies separately with live database references.
|
|
51
|
-
|
|
52
|
-
## Audit
|
|
53
|
-
|
|
54
|
-
For each declared purpose, list up to 1,000 objects per page under the exact
|
|
55
|
-
`uploads/<purpose>/` prefix. Use the API cursor until `is_truncated` is false.
|
|
56
|
-
|
|
57
|
-
An object is a deletion candidate only when all conditions hold:
|
|
58
|
-
|
|
59
|
-
- `last_modified` is more than 24 hours old;
|
|
60
|
-
- `custom_metadata.committedAt` is absent or empty;
|
|
61
|
-
- the key matches the exact upload layout
|
|
62
|
-
`uploads/<purpose>/<group>/(primary|alternate|fallback).(png|jpg|webp|avif|gif|bin)`,
|
|
63
|
-
where `<purpose>` is declared by this project and `<group>` contains only
|
|
64
|
-
letters, digits, `_`, or `-`.
|
|
65
|
-
|
|
66
|
-
Skip committed, unknown-prefix, unprefixed, malformed, or ambiguous objects.
|
|
67
|
-
Delete only an uncommitted variant, never its whole group.
|
|
68
|
-
|
|
69
|
-
Report the account, bucket, purpose prefixes, UTC cutoff, candidate object and
|
|
70
|
-
group counts, total bytes, skipped count, and a SHA-256 digest of the sorted
|
|
71
|
-
`key + etag` candidate set. Do not print object keys, upload group IDs,
|
|
72
|
-
filenames, public URLs, signed URLs, or secrets.
|
|
73
|
-
|
|
74
|
-
## Apply
|
|
75
|
-
|
|
76
|
-
1. Show the audit summary and get explicit confirmation for that exact account,
|
|
77
|
-
bucket, cutoff, count, byte total, and candidate-set digest.
|
|
78
|
-
2. Re-run the complete audit with the same UTC cutoff. If the candidate count,
|
|
79
|
-
bytes, or digest changed, stop and present the new audit for confirmation.
|
|
80
|
-
3. Call Delete Objects with JSON arrays of exact keys, at most 1,000 keys per
|
|
81
|
-
request. Never send the `prefix` query parameter: an empty prefix can empty
|
|
82
|
-
the bucket.
|
|
83
|
-
4. Do not automatically retry failed keys. Report safe API error codes and
|
|
84
|
-
counts; a later invocation can audit and retry what remains.
|
|
85
|
-
5. Re-list every inspected purpose prefix and report the remaining candidate
|
|
86
|
-
count and bytes.
|
|
87
|
-
|
|
88
|
-
## Don't
|
|
89
|
-
|
|
90
|
-
- Don't create a Worker, Cron Trigger, lifecycle rule, D1 table, or local script.
|
|
91
|
-
- Don't use prefix deletion or empty-bucket operations.
|
|
92
|
-
- Don't delete objects outside `uploads/<declared purpose>/`, and never
|
|
93
|
-
committed media.
|
|
94
|
-
- Don't treat missing pagination pages, metadata, or permissions as an empty
|
|
95
|
-
result.
|
|
96
|
-
|
|
97
|
-
## Diagnostics
|
|
98
|
-
|
|
99
|
-
| Symptom | Action |
|
|
100
|
-
|---|---|
|
|
101
|
-
| Multiple matching accounts or buckets | Stop and ask the user to select the exact target. |
|
|
102
|
-
| A page is truncated without a cursor | Stop; do not delete from a partial audit. |
|
|
103
|
-
| A candidate has an unexpected key or metadata shape | Skip it and include it only in the aggregate skipped count. |
|
|
104
|
-
| A delete request partially fails | Report safe error codes and leave the remaining objects for a later audit. |
|
|
105
|
-
|
|
106
|
-
## When You're Done
|
|
107
|
-
|
|
108
|
-
Return whether the run was audit-only or applied, the aggregate before/after
|
|
109
|
-
counts and bytes, and any safely redacted failures.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: provision
|
|
3
|
-
description: Ship a Mantle 0.2 project to production — Cloudflare Workers with D1, production sign-in and secrets, or ChatGPT Sites through its guide — and verify the deployed service.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/provision/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
projectionReason: Creates remote resources and handles production secrets; opt-in only.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Provision a Mantle project
|
|
13
|
-
|
|
14
|
-
## Workflow
|
|
15
|
-
|
|
16
|
-
Read the installed SDK README, then follow the version-matched [project and CLI
|
|
17
|
-
workflow](../../handbook/start/project-and-cli.md) before editing.
|
|
18
|
-
|
|
19
|
-
Deploy/create resources only within the user's authorization; reuse configured
|
|
20
|
-
host resources. Apply reviewed and rehearsed migrations before routing traffic;
|
|
21
|
-
imports/first requests perform no DDL or schema checks. Keep auth dynamic, production
|
|
22
|
-
secrets in the host store, trusted HTTPS origin and verified bootstrap rule,
|
|
23
|
-
production email and selected media wiring. Configure Admin ASSETS worker-first
|
|
24
|
-
as in [Workers assets and secrets](../../handbook/cloudflare/service-entry.md#workers-assets-and-secrets). Hyperdrive caching stays off; PG settings are deployment-owned.
|
|
25
|
-
Keep the Workers [public-fetch flags](../../handbook/cloudflare/deploy-and-operate.md#public-fetch-routing),
|
|
26
|
-
including environment overrides; verify deployed MCP with a real OAuth bearer
|
|
27
|
-
(`initialize` and `tools/list`), not only a browser session cookie.
|
|
28
|
-
For MCP Apps, also follow [deployed host acceptance](../../handbook/guides/mcp-apps.md#verify-a-deployed-app-in-chatgpt):
|
|
29
|
-
compare the current resource URI and visibly verify a newly invoked render tool.
|
|
30
|
-
Archive deployed Admin pages using the guide's `previous` recipe and carry them
|
|
31
|
-
through clean builds. Test the same old conversation after changing the UI build,
|
|
32
|
-
without reconnecting, refreshing host tools or clearing caches. A deliberate tool
|
|
33
|
-
contract change has its own migration/host rediscovery step. OAuth renewal, `tools/call` success and a
|
|
34
|
-
local official-host replay do not establish that the deployed App rendered.
|
|
35
|
-
Bun uses native Database/SQL, an app server and scheduler. Verify admin sign-in
|
|
36
|
-
(role admin), denied access, public reads, a persisted write, MCP and selected UI.
|
|
37
|
-
Report artifact/resources/checks and keep rollback artifacts.
|
|
38
|
-
|
|
39
|
-
For ChatGPT Sites, follow [Mantle on ChatGPT Sites](../../handbook/cloudflare/chatgpt-sites.md).
|
|
40
|
-
|
|
41
|
-
The app builds Admin with `mantle bundle`; serve it as [Native
|
|
42
|
-
Admin](../../handbook/guides/native-admin.md) describes. Verify both member and
|
|
43
|
-
admin OTP/UI flows. Deployment of an authorized application does not authorize
|
|
44
|
-
SDK publication; a workspace preview remains a preview.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: update
|
|
3
|
-
description: Upgrade a Mantle project's @aotter/mantle packages to a new exact version, including the move from 0.1.x to 0.2, without overwriting application-owned code.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/update/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Mantle Update
|
|
12
|
-
|
|
13
|
-
## Workflow
|
|
14
|
-
|
|
15
|
-
Read the installed SDK README, then follow the version-matched [project and CLI
|
|
16
|
-
workflow](../../handbook/start/project-and-cli.md) before editing.
|
|
17
|
-
|
|
18
|
-
For 0.1.x, follow [Upgrade 0.1 to 0.2](../../upgrade-0.1-to-0.2.md). Mantle
|
|
19
|
-
ships no migration tool: plan the data move from
|
|
20
|
-
[Moving data from 0.1.x](../../upgrade-0.1-to-0.2.md#moving-data-from-01x),
|
|
21
|
-
verify each fact against the generated `schema.sql` and the 0.1.4 export, and
|
|
22
|
-
have the plan reviewed. Give the 0.2 service a new database, rehearse the load
|
|
23
|
-
on a copy, never boot 0.2 against a 0.1.x database, and keep exports out of the
|
|
24
|
-
repository. The guide's appendix is historical; do not follow it. Between 0.2
|
|
25
|
-
versions, apply reviewed migrations rehearsed on a copy.
|
|
26
|
-
|
|
27
|
-
For the stable 0.2 line, pin every selected Mantle package to `0.2.0`; to try the 0.2.1 prerelease, pin all of them to `0.2.1-alpha.2` and read its release notes. Do not upgrade an existing application by following a moving dist-tag.
|
|
28
|
-
|
|
29
|
-
Pin exact target SDK/peer versions and read its release notes and Admin build
|
|
30
|
-
instructions. Core-to-native replaces app imports/wiring; it is not
|
|
31
|
-
a package-only update. For 0.2-to-0.2 updates, preserve users, sessions, content
|
|
32
|
-
and application code; review emitted SQL/policy diffs and rehearse explicit
|
|
33
|
-
data-preserving schema/auth/role migrations on a copy. Initial schema.sql never
|
|
34
|
-
authorizes rebuilding production tables. Verify auth/Admin/MCP/REST, locks and
|
|
35
|
-
persistence before authorized cutover.
|
|
36
|
-
|
|
37
|
-
Follow [Customising Admin](../../handbook/guides/native-admin.md#customising-admin)
|
|
38
|
-
for the current application-built Admin; old UI subpaths have no compatibility
|
|
39
|
-
aliases. Pin only actually published versions, or explicitly use a matching
|
|
40
|
-
workspace preview. Recheck member and Admin OTP, all affected native routes,
|
|
41
|
-
private field visibility, OCC and unknown outcomes. Do not publish a package as
|
|
42
|
-
part of an application dependency update.
|