@mapled/cli 0.14.4 → 0.14.5
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 +1 -1
- package/dist/commands.js +1 -1
- package/dist/doctor.d.ts +11 -1
- package/dist/doctor.js +23 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -206,7 +206,7 @@ Mapled doctor — Dolphin Landing
|
|
|
206
206
|
1 warning.
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
The repository side: the link, the sign-in, the generated types, the schema pin, the site manifest (and whether it matches what was pushed), the integration hash — one line saying whether the pin and the manifest here describe the same integration Mapled holds, and if not, what moved (the schema, the bindings, or edits made in Mapled) and which command catches up — `MAPLED.md` (and whether it is what Mapled would render now), `MAPLED_KEY` and `MAPLED_WEBHOOK_SECRET` in your env files (names only — values are never read out), env files or Mapled secrets tracked by git, the installed `@mapled/next` and CLI versions, the revalidation and preview routes of a Next.js site, and its live updates — ○ «Not used» while no page mounts `<MapledLive />` or calls `watchRelease`, ✓ when the route they ask answers its `GET` with `createReleaseHandler` (`GET` is the handler, or always returns its call: every return is that call, the last statement is one, and nothing throws), ⚠ when it is missing (the tabs would poll a 404) with the file to add, when the route's `GET` isn't seen to answer with the handler (exported as `POST` they would get a 405; a `GET` that only mentions it, calls it and returns something else, or answers something else on another branch, answers without the release), or when no route can be checked against the endpoint — it is relative to the page, a full address (the tab asks it as written, and doctor can't tell it's the site's own), computed, or comes from spread props; a path from the site's root is checked against the route the App Router picks for it, dynamic and catch-all folders included, among route files with the site's page extensions (`pageExtensions` in next.config; `tsx`, `ts`, `jsx`, `js` by default) and under its `basePath`; ⚠ too when a page of either router, more specific than the route, takes that path first, when the dynamic route that answers sets `dynamicParams`, when the route may set `dynamic` to anything but `"auto"` or `"force-dynamic"` (a copy Next builds without the tab's request), sets `"force-dynamic"` while `createReleaseHandler` there isn't seen to keep a `revalidate` above 0 (its default does; with `false` or `0` Next reads the release past the cache tag) or `fetchCache` to anything but `"auto"` (the release read past the cache tag, before the webhook refreshes the pages), when next.config sets `output: "export"` (no server runs the route), or when next.config may set `pageExtensions`, `basePath` or `output` where doctor can't read them — it reads them only as literals, once, in the object the file exports, and only while the file is declarative: type imports, declarations of data, one export of the config object itself, and functions only as Next's hooks (`webpack`, `headers` …) in it. A module the file loads (a plugin such as `withMDX`, a `path` helper, an env check), a config exported as a function, any other code, a spread or a getter leaves the config unread. With a `basePath`, a listener that gives no endpoint asks under it from `@mapled/next` 0.10.0 — doctor reads the version the site has installed, and it's a ⚠ when that is older or missing. A `middleware` file (`proxy` in Next 16) next to the folder Next reads is a ⚠ unless its matcher, read the way Next's build reads `export const config`, surely leaves the route's path alone: it has no matcher, doctor can't read it, a source may take the path, or next.config has locales (`i18n`). `src/app` or `src/pages` counts only when the root has no `app` or `pages`, as Next reads them. On the Pages Router the route is an API route — a file of the pages folder at `/api` or under it — whose default export is `createPagesReleaseHandler` or always returns its call, and the listener is `<MapledLive />` from `@mapled/next/live/pages` in `pages/_app`: a listener without it gets the API route to add (`pages/api/mapled/release.ts` by default; an endpoint outside `/api` no API route can answer). ⚠ there too when the API route may run on the edge runtime — `runtime` or `config.runtime` other than `"nodejs"`, or written where doctor can't read it (Next reads both only as literals) — where the handler has no Node request and response; when a listener the App Router may run asks it — a file of `app/`, or on a site with both folders one either router may render: the API route answers Mapled's live release, which moves before the webhook refreshes what App Router pages read; and when `<MapledLive />` from `@mapled/next/live/pages` sits in the App Router's folder, where it can't mount. doctor reads the files, not how Next serves them at run time: rewrites and what a middleware does on the path aren't checked, and neither is whether a page renders the component that listens; `revalidate` on the route is no ⚠ — the handler's read names its own. The Mapled side, from the same status the AI agent's `check_integration` tool reads: whether the site has read content with the delivery key, the publish webhook and its last delivery, the preview route on the deployed site, the bindings health.
|
|
209
|
+
The repository side: the link, the sign-in, the generated types, the schema pin, the site manifest (and whether it matches what was pushed), the integration hash — one line saying whether the pin and the manifest here describe the same integration Mapled holds, and if not, what moved (the schema, the bindings, or edits made in Mapled) and which command catches up — `MAPLED.md` (and whether it is what Mapled would render now), `MAPLED_KEY` and `MAPLED_WEBHOOK_SECRET` in your env files (names only — values are never read out), env files or Mapled secrets tracked by git, the installed `@mapled/next` and CLI versions, the revalidation and preview routes of a Next.js site, and its live updates — ○ «Not used» while no page mounts `<MapledLive />` or calls `watchRelease`, ✓ when the route they ask answers its `GET` with `createReleaseHandler` (`GET` is the handler, or always returns its call: every return is that call, the last statement is one, and nothing throws), ⚠ when it is missing (the tabs would poll a 404) with the file to add, when the route's `GET` isn't seen to answer with the handler (exported as `POST` they would get a 405; a `GET` that only mentions it, calls it and returns something else, or answers something else on another branch, answers without the release), or when no route can be checked against the endpoint — it is relative to the page, a full address (the tab asks it as written, and doctor can't tell it's the site's own), computed, or comes from spread props; a path from the site's root is checked against the route the App Router picks for it, dynamic and catch-all folders included, among route files with the site's page extensions (`pageExtensions` in next.config; `tsx`, `ts`, `jsx`, `js` by default) and under its `basePath`; ⚠ too when a page of either router, more specific than the route, takes that path first, when the dynamic route that answers sets `dynamicParams`, when the route may set `dynamic` to anything but `"auto"` or `"force-dynamic"` (a copy Next builds without the tab's request), sets `"force-dynamic"` while `createReleaseHandler` there isn't seen to keep a `revalidate` above 0 (its default does; with `false` or `0` Next reads the release past the cache tag) or `fetchCache` to anything but `"auto"` (the release read past the cache tag, before the webhook refreshes the pages), when next.config sets `output: "export"` (no server runs the route), or when next.config may set `pageExtensions`, `basePath` or `output` where doctor can't read them — it reads them only as literals, once, in the object the file exports, and only while the file is declarative: type imports, declarations of data, one export of the config object itself, and functions only as Next's hooks (`webpack`, `headers` …) in it. A module the file loads (a plugin such as `withMDX`, a `path` helper, an env check), a config exported as a function, any other code, a spread or a getter leaves the config unread. With a `basePath`, a listener that gives no endpoint asks under it from `@mapled/next` 0.10.0 — doctor reads the version the site has installed, and it's a ⚠ when that is older or missing. A `middleware` file (`proxy` in Next 16) next to the folder Next reads is a ⚠ unless its matcher, read the way Next's build reads `export const config`, surely leaves the route's path alone: it has no matcher, doctor can't read it, a source may take the path, or next.config has locales (`i18n`). `src/app` or `src/pages` counts only when the root has no `app` or `pages`, as Next reads them. On the Pages Router the route is an API route — a file of the pages folder at `/api` or under it — whose default export is `createPagesReleaseHandler` or always returns its call, and the listener is `<MapledLive />` from `@mapled/next/live/pages` in `pages/_app`: a listener without it gets the API route to add (`pages/api/mapled/release.ts` by default; an endpoint outside `/api` no API route can answer). ⚠ there too when the API route may run on the edge runtime — `runtime` or `config.runtime` other than `"nodejs"`, or written where doctor can't read it (Next reads both only as literals) — where the handler has no Node request and response; when a listener the App Router may run asks it — a file of `app/`, or on a site with both folders one either router may render: the API route answers Mapled's live release, which moves before the webhook refreshes what App Router pages read; and when `<MapledLive />` from `@mapled/next/live/pages` sits in the App Router's folder, where it can't mount. doctor reads the files, not how Next serves them at run time: rewrites and what a middleware does on the path aren't checked, and neither is whether a page renders the component that listens; `revalidate` on the route is no ⚠ — the handler's read names its own. The Mapled side, from the same status the AI agent's `check_integration` tool reads: whether the site has read content with the delivery key (for a project with a staging channel, through which key: production's or staging's — the key decides which releases a deployment shows), the publish webhook and its last delivery, the preview route on the deployed site, the bindings health.
|
|
210
210
|
|
|
211
211
|
A site rendered in the visitor's browser — a React single-page app (Vite and the like), plain HTML — is checked for what it has: the package line is `@mapled/react`, Environment wants `VITE_MAPLED_KEY` and no webhook secret, and the routes and the webhook read ○ «Not needed» — such a site shows a publish on its next load and trades Mapled's preview link on the page itself; Live updates reads ○ as well: `live` on `MapledProvider` or `data-mapled-live` asks Mapled directly, with no route of the site's. Plain HTML installs nothing: the line is `@mapled/vanilla`, read from the script tag in the pages (or from a copy of the file next to them) — ⚠ when the address has no version or an older one, and before that when a page's tag has an `integrity` a browser won't pass: from another origin without `crossorigin` (a browser checks only a file that came with CORS), `crossorigin="use-credentials"` on jsDelivr or unpkg (their `*` answer fails a request with credentials, integrity or not), or a digest that isn't the file's — for a copy next to the pages, the copy's own; for a jsDelivr or unpkg address, the released file's of the version in it (another host may serve a file of its own; an address with a query isn't checked — `?meta` answers with something else), which doctor knows without the network for the releases up to its own, or from `node_modules/@mapled/vanilla` of that version — and Generated types and Environment read ○: the fields are named in attributes, the delivery key sits in the page. doctor takes the framework from `mapled.json`, or works it out from `package.json` (no `package.json` and an `index.html` is plain HTML). Whatever the framework, a server key or a signing secret under a public prefix (`VITE_…`, `NEXT_PUBLIC_…`) is a ✗: it would ship to every visitor.
|
|
212
212
|
|
package/dist/commands.js
CHANGED
|
@@ -737,7 +737,7 @@ export async function doctor(ctx, flags) {
|
|
|
737
737
|
// the code is read only where the check applies: a Next.js site (or one doctor can't place)
|
|
738
738
|
checks.push(dr.checkLive(live, framework));
|
|
739
739
|
if (status) {
|
|
740
|
-
checks.push(dr.checkReads(status.delivery.lastReadAt));
|
|
740
|
+
checks.push(dr.checkReads(status.delivery.lastReadAt, status.delivery.staging));
|
|
741
741
|
checks.push(dr.checkWebhook(status.webhook, { local: browser, remote: status.site }));
|
|
742
742
|
let origin = null;
|
|
743
743
|
try {
|
package/dist/doctor.d.ts
CHANGED
|
@@ -29,8 +29,12 @@ export type IntegrationStatus = {
|
|
|
29
29
|
name: string;
|
|
30
30
|
createdAt: string | null;
|
|
31
31
|
};
|
|
32
|
+
/** `staging` only for a project with a staging delivery key (release channels). */
|
|
32
33
|
delivery: {
|
|
33
34
|
lastReadAt: string | null;
|
|
35
|
+
staging?: {
|
|
36
|
+
lastReadAt: string | null;
|
|
37
|
+
};
|
|
34
38
|
};
|
|
35
39
|
webhook: {
|
|
36
40
|
url: string | null;
|
|
@@ -210,7 +214,13 @@ export declare function checkRoute(kind: RouteKind, found: RouteFile | null, fra
|
|
|
210
214
|
code listens, whether a route answers it. `facts` is null when the
|
|
211
215
|
code wasn't read (a stack this check doesn't cover). */
|
|
212
216
|
export declare function checkLive(facts: LiveFacts | null, framework: string | undefined): Check;
|
|
213
|
-
|
|
217
|
+
/** The delivery key decides which release channel a site reads: a
|
|
218
|
+
project with a staging key has two, and the line says which of them
|
|
219
|
+
sites read through — a production site on the staging key shows
|
|
220
|
+
releases nobody promoted. */
|
|
221
|
+
export declare function checkReads(lastReadAt: string | null, staging?: {
|
|
222
|
+
lastReadAt: string | null;
|
|
223
|
+
}): Check;
|
|
214
224
|
export declare function checkWebhook(webhook: IntegrationStatus["webhook"], site?: {
|
|
215
225
|
local: boolean;
|
|
216
226
|
remote: IntegrationStatus["site"];
|
package/dist/doctor.js
CHANGED
|
@@ -991,9 +991,14 @@ export function checkLive(facts, framework) {
|
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
|
-
|
|
994
|
+
/** The delivery key decides which release channel a site reads: a
|
|
995
|
+
project with a staging key has two, and the line says which of them
|
|
996
|
+
sites read through — a production site on the staging key shows
|
|
997
|
+
releases nobody promoted. */
|
|
998
|
+
export function checkReads(lastReadAt, staging) {
|
|
995
999
|
const label = "Site reads content";
|
|
996
|
-
|
|
1000
|
+
const viaStaging = staging?.lastReadAt ?? null;
|
|
1001
|
+
if (!lastReadAt && !viaStaging) {
|
|
997
1002
|
return {
|
|
998
1003
|
key: "reads",
|
|
999
1004
|
label,
|
|
@@ -1001,7 +1006,22 @@ export function checkReads(lastReadAt) {
|
|
|
1001
1006
|
detail: "No reads yet. Deploy the site and open a page that shows Mapled content.",
|
|
1002
1007
|
};
|
|
1003
1008
|
}
|
|
1004
|
-
|
|
1009
|
+
if (!staging)
|
|
1010
|
+
return { key: "reads", label, status: "passed", detail: `Last read ${ago(lastReadAt)}` };
|
|
1011
|
+
if (!lastReadAt) {
|
|
1012
|
+
return {
|
|
1013
|
+
key: "reads",
|
|
1014
|
+
label,
|
|
1015
|
+
status: "passed",
|
|
1016
|
+
detail: `Staging key: last read ${ago(viaStaging)}. No reads with the production key yet — a site on the staging key shows staging releases.`,
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
return {
|
|
1020
|
+
key: "reads",
|
|
1021
|
+
label,
|
|
1022
|
+
status: "passed",
|
|
1023
|
+
detail: `Production key: last read ${ago(lastReadAt)}. Staging key: ${viaStaging ? `last read ${ago(viaStaging)}` : "no reads yet"}.`,
|
|
1024
|
+
};
|
|
1005
1025
|
}
|
|
1006
1026
|
export function checkWebhook(webhook, site) {
|
|
1007
1027
|
const label = "Publish webhook";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapled/cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.5",
|
|
4
4
|
"description": "Mapled CLI — sign in, link a project, generate TypeScript types for its content, create forms, preview drafts and check the site's integration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://mapled.io",
|