@thecms/cli 0.20.1 → 0.20.2-dev.129
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/dist/{chunk-AGRULCIN.js → chunk-I24UVFZ7.js} +43 -9
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -5,9 +5,9 @@ import { spawn } from "child_process";
|
|
|
5
5
|
import { createInterface } from "readline/promises";
|
|
6
6
|
|
|
7
7
|
// src/channel.ts
|
|
8
|
-
var CHANNEL = "
|
|
9
|
-
var PLATFORM_API = "https://
|
|
10
|
-
var PLATFORM_DASHBOARD = "https://
|
|
8
|
+
var CHANNEL = "dev";
|
|
9
|
+
var PLATFORM_API = "https://apidev.dotscms.com";
|
|
10
|
+
var PLATFORM_DASHBOARD = "https://dev.dotscms.com";
|
|
11
11
|
|
|
12
12
|
// src/credentials.ts
|
|
13
13
|
import { spawnSync } from "child_process";
|
|
@@ -175,7 +175,7 @@ function realContext(env = process.env) {
|
|
|
175
175
|
import { parseArgs } from "util";
|
|
176
176
|
|
|
177
177
|
// src/context.ts
|
|
178
|
-
var CLI_VERSION = "0.20.
|
|
178
|
+
var CLI_VERSION = "0.20.2-dev.129";
|
|
179
179
|
function call(ctx, path, init = {}) {
|
|
180
180
|
const { token, client = "cli", ...rest } = init;
|
|
181
181
|
const headers = new Headers(rest.headers);
|
|
@@ -9073,6 +9073,7 @@ function imagesIn(html) {
|
|
|
9073
9073
|
return images;
|
|
9074
9074
|
}
|
|
9075
9075
|
var decorative = (img) => ["presentation", "none"].includes((img.role ?? "").trim().toLowerCase()) || (img["aria-hidden"] ?? "").trim().toLowerCase() === "true";
|
|
9076
|
+
var SECRET_FILES = [".env.local", ".env.development.local", ".env.production.local"];
|
|
9076
9077
|
async function verify(ctx, opts = {}) {
|
|
9077
9078
|
let render;
|
|
9078
9079
|
let siteBase;
|
|
@@ -9218,10 +9219,11 @@ async function verifyOne(ctx, only, ref, render, siteBase) {
|
|
|
9218
9219
|
const writing = (sets ?? []).flatMap((w) => (w.shapes ?? []).flatMap((sh) => sh.writes ? [{ set: w.entity ?? w.name ?? w.slug, shape: sh.id, schema: sh.writes.schema }] : []));
|
|
9219
9220
|
if (!sets) note(`The shapes that write are not readable with ${ctx.key ? "this API key" : "your account"} (${setsRes?.status ?? "no answer"}): their key is not tried`);
|
|
9220
9221
|
else if (writing.length) {
|
|
9221
|
-
const
|
|
9222
|
-
const secret =
|
|
9223
|
-
|
|
9224
|
-
|
|
9222
|
+
const secretIn = (file) => existsSync19(join22(ctx.cwd, file)) ? new RegExp(`^${SECRET_VARIABLE}=(.+)$`, "m").exec(readFileSync20(join22(ctx.cwd, file), "utf8"))?.[1]?.trim().replace(/^(["'])(.*)\1$/, "$2") : void 0;
|
|
9223
|
+
const secret = SECRET_FILES.map(secretIn).find(Boolean) || process.env[SECRET_VARIABLE]?.trim();
|
|
9224
|
+
const files = SECRET_FILES.join(", ");
|
|
9225
|
+
if (!secret && siteBase) note(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}): its key is tried where ${files} or ${SECRET_VARIABLE} has it, not on the started build`);
|
|
9226
|
+
else if (!secret) problem2(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}) but none of ${files} has ${SECRET_VARIABLE}: apply_set with the shape's writes makes the key`);
|
|
9225
9227
|
else for (const w of writing) {
|
|
9226
9228
|
const tried = await call(ctx, `/v1/${encodeURIComponent(workspace)}/records/${encodeURIComponent(w.schema)}/import`, { method: "POST", headers: { "X-Api-Key": secret }, body: JSON.stringify({ mode: "preview", rows: [{}] }) }).catch(() => null);
|
|
9227
9229
|
const answer2 = tried?.ok ? await tried.json() : null;
|
|
@@ -9298,13 +9300,45 @@ async function verifyOne(ctx, only, ref, render, siteBase) {
|
|
|
9298
9300
|
];
|
|
9299
9301
|
const before2 = problems;
|
|
9300
9302
|
let silent = false;
|
|
9303
|
+
const platform = await res.text();
|
|
9304
|
+
const titleOf2 = (text2) => text2.split("\n").find((l) => l.startsWith("# "))?.trim() ?? "";
|
|
9305
|
+
let another = false;
|
|
9301
9306
|
for (const [url, how] of routes) {
|
|
9302
9307
|
const answer2 = await ctx.fetch(url, { headers: { Accept: "text/plain, text/markdown" }, redirect: "manual" }).catch(() => null);
|
|
9303
9308
|
if (!answer2) {
|
|
9304
9309
|
silent = true;
|
|
9305
9310
|
continue;
|
|
9306
9311
|
}
|
|
9307
|
-
if (!answer2.ok)
|
|
9312
|
+
if (!answer2.ok) {
|
|
9313
|
+
problem2(`AI readers are on but the site's ${url} answers ${answer2.status}: ${how}`);
|
|
9314
|
+
continue;
|
|
9315
|
+
}
|
|
9316
|
+
if (url.endsWith("/llms.txt")) {
|
|
9317
|
+
const theirs = titleOf2(await answer2.text());
|
|
9318
|
+
if (theirs !== titleOf2(platform)) {
|
|
9319
|
+
another = true;
|
|
9320
|
+
problem2(`Another site answers at ${base}: its llms.txt is "${theirs.slice(2) || "not a theCMS. one"}", this workspace's "${titleOf2(platform).slice(2)}" \u2014 start this site there, or check its address: thecms verify --site-url <its address>`);
|
|
9321
|
+
break;
|
|
9322
|
+
}
|
|
9323
|
+
}
|
|
9324
|
+
}
|
|
9325
|
+
if (!silent && !another && problems === before2) {
|
|
9326
|
+
const links = [...platform.matchAll(/\]\((https?:\/\/[^)\s]+)\)/g)].map((m) => {
|
|
9327
|
+
try {
|
|
9328
|
+
const u = new URL(m[1]);
|
|
9329
|
+
return u.pathname === "/llms" || u.pathname.startsWith("/llms/") ? `${base}${u.pathname}` : null;
|
|
9330
|
+
} catch {
|
|
9331
|
+
return null;
|
|
9332
|
+
}
|
|
9333
|
+
}).filter((u) => !!u);
|
|
9334
|
+
const failed = [];
|
|
9335
|
+
for (let i = 0; i < links.length; i += 8) {
|
|
9336
|
+
await Promise.all(links.slice(i, i + 8).map(async (url) => {
|
|
9337
|
+
const answer2 = await ctx.fetch(url, { headers: { Accept: "text/plain, text/markdown" }, redirect: "manual" }).catch(() => null);
|
|
9338
|
+
if (!answer2?.ok) failed.push(`${url} (${answer2 ? answer2.status : "no answer"}${answer2?.headers.get("x-cms-text") ? `: ${answer2.headers.get("x-cms-text")}` : ""})`);
|
|
9339
|
+
}));
|
|
9340
|
+
}
|
|
9341
|
+
if (failed.length) problem2(`AI readers are on but ${failed.length} of the ${links.length} pages llms.txt lists have no text: ${failed.slice(0, 5).join(", ")}${failed.length > 5 ? ", \u2026" : ""}`);
|
|
9308
9342
|
}
|
|
9309
9343
|
if (problems > before2 && !siteBase) note(`Not online at ${base} yet? Check the started build: thecms verify --site-url <its address>`);
|
|
9310
9344
|
if (silent) note(`The site does not answer at ${base}: its addresses for AI readers (/llms.txt, /llms) are checked once it is online`);
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecms/cli",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2-dev.129",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "theCMS. command line: the standard's starter, checks, brand, the method's docs, sign-in with a personal token",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
38
38
|
"@resvg/resvg-wasm": "2.6.2",
|
|
39
|
-
"@thecms/sdk": "0.20.
|
|
39
|
+
"@thecms/sdk": "0.20.2-dev.129",
|
|
40
40
|
"libpg-query": "18.2.0",
|
|
41
41
|
"zod": "4.6.5"
|
|
42
42
|
},
|