@thecms/cli 0.20.2-dev.128 → 0.20.2-dev.130

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.
@@ -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.2-dev.128";
178
+ var CLI_VERSION = "0.20.2-dev.130";
179
179
  function call(ctx, path, init = {}) {
180
180
  const { token, client = "cli", ...rest } = init;
181
181
  const headers = new Headers(rest.headers);
@@ -6649,7 +6649,7 @@ async function readWorkspace(session, state, account, signal) {
6649
6649
  else if (siteApps.includes(app) && state2 && state2 !== "connected") application.review.push(`${app.slug}: the site is not connected (${state2}): start it and open a page`);
6650
6650
  }
6651
6651
  levels.push(level("application", worst(application), [...application.missing, ...application.review], {
6652
- applications: apps.map((a) => ({ id: a.id, slug: a.slug, name: a.name, siteUrl: a.siteUrl ?? null, siteName: a.siteName ?? null, sitemap: !!a.sitemap, publicKey: a.publicKey, connection: a.connection?.state ?? null, site: siteApps.includes(a), app: isAppAddress(a.siteUrl) }))
6652
+ applications: apps.map((a) => ({ id: a.id, slug: a.slug, name: a.name, siteUrl: a.siteUrl ?? null, siteName: a.siteName ?? null, sitemap: !!a.sitemap, publicKey: a.publicKey, connection: a.connection?.state ?? null, runs: a.connection?.library ? `${a.connection.library.name} ${a.connection.library.version}` : null, site: siteApps.includes(a), app: isAppAddress(a.siteUrl) }))
6653
6653
  }));
6654
6654
  await measure(apps);
6655
6655
  }
@@ -8289,13 +8289,14 @@ async function doctorOne(ctx) {
8289
8289
  else note(line);
8290
8290
  } else if (connection?.update?.level === "required") problem2(`The site's server announces a library the platform no longer supports: thecms upgrade (to ${connection.update.to})`);
8291
8291
  else if (connection?.update?.level === "available") note(`The site's server can update to ${connection.update.to}: thecms upgrade`);
8292
+ const runs = announced2?.version ? ` \xB7 it runs ${announced2.name} ${announced2.version}` : "";
8292
8293
  if (!state) note("The site's state is not readable with your account");
8293
- else if (state === "connected") ok2("The site is connected");
8294
+ else if (state === "connected") ok2(`The site is connected${runs}`);
8294
8295
  else if (state === "outdated") {
8295
8296
  if (!stale && connection?.update?.level !== "required") problem2("The site runs a library the platform calls outdated: thecms upgrade");
8296
8297
  } else if (state === "not_configured") note("The application has no Site URL yet (dashboard \u2192 the application's settings)");
8297
8298
  else if (state === "never") note("The site has never announced itself: start it (npm run dev) and open a page");
8298
- else note("The site has not been seen recently");
8299
+ else note(`The site has not been seen recently${runs ? ` (last seen running ${announced2.name} ${announced2.version})` : ""}`);
8299
8300
  }
8300
8301
  return problems ? 1 : 0;
8301
8302
  }
@@ -9073,6 +9074,7 @@ function imagesIn(html) {
9073
9074
  return images;
9074
9075
  }
9075
9076
  var decorative = (img) => ["presentation", "none"].includes((img.role ?? "").trim().toLowerCase()) || (img["aria-hidden"] ?? "").trim().toLowerCase() === "true";
9077
+ var SECRET_FILES = [".env.local", ".env.development.local", ".env.production.local"];
9076
9078
  async function verify(ctx, opts = {}) {
9077
9079
  let render;
9078
9080
  let siteBase;
@@ -9218,10 +9220,11 @@ async function verifyOne(ctx, only, ref, render, siteBase) {
9218
9220
  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
9221
  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
9222
  else if (writing.length) {
9221
- const env = existsSync19(join22(ctx.cwd, ".env.local")) ? readFileSync20(join22(ctx.cwd, ".env.local"), "utf8") : "";
9222
- const secret = new RegExp(`^${SECRET_VARIABLE}=(.+)$`, "m").exec(env)?.[1]?.trim() || process.env[SECRET_VARIABLE]?.trim();
9223
- if (!secret && siteBase) note(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}): its key is tried where .env.local or ${SECRET_VARIABLE} has it, not on the started build`);
9224
- else if (!secret) problem2(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}) but .env.local has no ${SECRET_VARIABLE}: apply_set with the shape's writes makes the key`);
9223
+ 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;
9224
+ const secret = SECRET_FILES.map(secretIn).find(Boolean) || process.env[SECRET_VARIABLE]?.trim();
9225
+ const files = SECRET_FILES.join(", ");
9226
+ 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`);
9227
+ 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
9228
  else for (const w of writing) {
9226
9229
  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
9230
  const answer2 = tried?.ok ? await tried.json() : null;
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-3XYLUUS6.js";
4
+ } from "./chunk-XA5W7CT3.js";
5
5
 
6
6
  // src/cli.ts
7
7
  run(process.argv.slice(2)).then((code) => process.exit(code)).catch((err) => {
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  personalToken,
4
4
  run
5
- } from "./chunk-3XYLUUS6.js";
5
+ } from "./chunk-XA5W7CT3.js";
6
6
  export {
7
7
  personalToken,
8
8
  run
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecms/cli",
3
- "version": "0.20.2-dev.128",
3
+ "version": "0.20.2-dev.130",
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.2-dev.128",
39
+ "@thecms/sdk": "0.20.2-dev.130",
40
40
  "libpg-query": "18.2.0",
41
41
  "zod": "4.6.5"
42
42
  },