deployai 0.1.0-beta.11 → 0.1.0-beta.13
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 +12 -3
- package/dist/index.js +1368 -223
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
|
-
import { resolve as
|
|
9
|
+
import { resolve as resolve6 } from "path";
|
|
10
10
|
import { Command } from "commander";
|
|
11
11
|
|
|
12
12
|
// src/api.ts
|
|
@@ -4711,14 +4711,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
4711
4711
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
4712
4712
|
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
4713
4713
|
if (sh) {
|
|
4714
|
-
const
|
|
4714
|
+
const get2 = () => {
|
|
4715
4715
|
const newSh = { ...sh };
|
|
4716
4716
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
4717
|
-
|
|
4717
|
+
get2.raw = newSh;
|
|
4718
4718
|
return newSh;
|
|
4719
4719
|
};
|
|
4720
|
-
|
|
4721
|
-
Object.defineProperty(def, "shape", { get });
|
|
4720
|
+
get2.raw = sh;
|
|
4721
|
+
Object.defineProperty(def, "shape", { get: get2 });
|
|
4722
4722
|
}
|
|
4723
4723
|
const _normalized = cached(() => normalizeDef(def));
|
|
4724
4724
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -6241,7 +6241,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
6241
6241
|
var NONE = 0;
|
|
6242
6242
|
var ASSUMED = 1;
|
|
6243
6243
|
var PROVEN = 2;
|
|
6244
|
-
function isRecursive(inst, stack,
|
|
6244
|
+
function isRecursive(inst, stack, resolve7) {
|
|
6245
6245
|
const cached2 = recursive.get(inst);
|
|
6246
6246
|
if (cached2 !== void 0)
|
|
6247
6247
|
return cached2 ? PROVEN : NONE;
|
|
@@ -6251,7 +6251,7 @@ function isRecursive(inst, stack, resolve5) {
|
|
|
6251
6251
|
let result = NONE;
|
|
6252
6252
|
const check2 = (child) => {
|
|
6253
6253
|
if (result !== PROVEN && child?._zod) {
|
|
6254
|
-
const answer = isRecursive(child, stack,
|
|
6254
|
+
const answer = isRecursive(child, stack, resolve7);
|
|
6255
6255
|
if (answer > result)
|
|
6256
6256
|
result = answer;
|
|
6257
6257
|
}
|
|
@@ -6262,7 +6262,7 @@ function isRecursive(inst, stack, resolve5) {
|
|
|
6262
6262
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
6263
6263
|
if (spread && !desc.enumerable)
|
|
6264
6264
|
continue;
|
|
6265
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
6265
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve7) : NONE;
|
|
6266
6266
|
if (child > answer)
|
|
6267
6267
|
answer = child;
|
|
6268
6268
|
}
|
|
@@ -6326,7 +6326,7 @@ function isRecursive(inst, stack, resolve5) {
|
|
|
6326
6326
|
break;
|
|
6327
6327
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
6328
6328
|
case "lazy": {
|
|
6329
|
-
const inner = def._cachedInner ?? (
|
|
6329
|
+
const inner = def._cachedInner ?? (resolve7 ? inst._zod.innerType : void 0);
|
|
6330
6330
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
6331
6331
|
break;
|
|
6332
6332
|
}
|
|
@@ -20958,7 +20958,31 @@ var EnvSetResponse = external_exports.object({ ok: external_exports.literal(true
|
|
|
20958
20958
|
var EnvRemoveRequest = external_exports.object({ projectId: external_exports.string(), key: external_exports.string() });
|
|
20959
20959
|
var EnvListResponse = external_exports.object({ vars: external_exports.array(external_exports.object({ key: external_exports.string(), isSecret: external_exports.boolean(), hint: external_exports.string() })) });
|
|
20960
20960
|
var RollbackRequest = external_exports.object({ projectId: external_exports.string(), number: external_exports.number().int().positive() });
|
|
20961
|
-
var PromoteRequest = external_exports.object({
|
|
20961
|
+
var PromoteRequest = external_exports.object({
|
|
20962
|
+
projectId: external_exports.string(),
|
|
20963
|
+
number: external_exports.number().int().positive(),
|
|
20964
|
+
/** The owner's yes to the version's SQL (D-541): the `hash` of the plan they were shown, so newer SQL is never run on it. */
|
|
20965
|
+
approveSql: external_exports.string().optional(),
|
|
20966
|
+
/** Destructive SQL (D-541): the database name the person typed at the terminal. */
|
|
20967
|
+
confirmDatabase: external_exports.string().optional()
|
|
20968
|
+
});
|
|
20969
|
+
var SqlPlanResponse = external_exports.object({
|
|
20970
|
+
number: external_exports.number(),
|
|
20971
|
+
migrationStatus: MigrationStatus.nullable(),
|
|
20972
|
+
/** The database binding the SQL runs on, null when the version declares none. */
|
|
20973
|
+
database: external_exports.string().nullable(),
|
|
20974
|
+
/** A database that does not exist yet: the seed runs too. */
|
|
20975
|
+
isNew: external_exports.boolean(),
|
|
20976
|
+
files: external_exports.array(external_exports.object({ file: external_exports.string(), kind: external_exports.string(), statements: external_exports.number(), skip: external_exports.boolean() })),
|
|
20977
|
+
/** Statements that delete or overwrite data: an agent may not approve them, a person types the database name. */
|
|
20978
|
+
destructive: external_exports.array(external_exports.object({ file: external_exports.string(), statement: external_exports.string() })),
|
|
20979
|
+
/** Files that stopped part way and changed since: only the dashboard sorts these out. */
|
|
20980
|
+
stuck: external_exports.array(external_exports.string()),
|
|
20981
|
+
hash: external_exports.string(),
|
|
20982
|
+
/** Only the owner approves SQL; a teammate gets the dashboard page to send them. */
|
|
20983
|
+
canApprove: external_exports.boolean(),
|
|
20984
|
+
url: external_exports.string()
|
|
20985
|
+
});
|
|
20962
20986
|
var StatusResponse = external_exports.object({
|
|
20963
20987
|
project: Project,
|
|
20964
20988
|
queue: external_exports.object({ position: external_exports.number(), running: external_exports.boolean() }),
|
|
@@ -20969,6 +20993,8 @@ var StatusResponse = external_exports.object({
|
|
|
20969
20993
|
error: external_exports.string().nullable(),
|
|
20970
20994
|
logTail: external_exports.string().nullable(),
|
|
20971
20995
|
migrationStatus: MigrationStatus.nullable().optional(),
|
|
20996
|
+
/** Why the SQL failed, when it did (D-541). */
|
|
20997
|
+
migrationError: external_exports.string().nullable().optional(),
|
|
20972
20998
|
/** A ready version that is not live: its preview, for the owner to look at before promote (D-505). */
|
|
20973
20999
|
preview: external_exports.string().nullable().optional(),
|
|
20974
21000
|
/** Going live right now (D-528). */
|
|
@@ -21174,6 +21200,7 @@ var ARCH_NODES = [
|
|
|
21174
21200
|
{ id: "oauth", kind: "external", zone: "services", label: "Google / GitHub OAuth", summary: "\u05D4\u05EA\u05D7\u05D1\u05E8\u05D5\u05EA \u05E2\u05DD Google \u05D0\u05D5 GitHub \u05D3\u05E8\u05DA Better Auth.", summaryEn: "Log in with Google or GitHub through Better Auth.", code: ["apps/web/src/server/auth.ts"], env: ["GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET", "GITHUB_CLIENT_ID", "GITHUB_CLIENT_SECRET"], decisions: ["D-020"] },
|
|
21175
21201
|
{ id: "payments", kind: "external", zone: "services", label: "Payment provider (Cardcom)", summary: "\u05E7\u05D0\u05E8\u05D3\u05E7\u05D5\u05DD \u05DB\u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC, \u05D5\u05E0\u05D1\u05D7\u05E8 \u05D1\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05D4\u05D0\u05D3\u05DE\u05D9\u05DF (\u05D0\u05D5 \u05DE\u05D3\u05D5\u05DE\u05D4 \u05DC\u05D1\u05D3\u05D9\u05E7\u05D5\u05EA). \u05D4\u05DB\u05E8\u05D8\u05D9\u05E1 \u05DE\u05D5\u05E7\u05DC\u05D3 \u05D1\u05D3\u05E3 \u05D4\u05DE\u05D0\u05D5\u05D1\u05D8\u05D7 \u05E9\u05DC \u05E7\u05D0\u05E8\u05D3\u05E7\u05D5\u05DD \u05D5\u05E0\u05E9\u05DE\u05E8 \u05DB\u05D8\u05D5\u05E7\u05DF \u05DE\u05D5\u05E6\u05E4\u05DF, \u05DB\u05DC \u05D7\u05D9\u05D5\u05D1 \u05E2\u05DD \u05DE\u05E4\u05EA\u05D7 \u05D0\u05D9\u05D3\u05DE\u05E4\u05D5\u05D8\u05E0\u05D8\u05D9\u05D5\u05EA, \u05D5\u05E7\u05D0\u05E8\u05D3\u05E7\u05D5\u05DD \u05DE\u05E4\u05D9\u05E7\u05D4 \u05D7\u05E9\u05D1\u05D5\u05E0\u05D9\u05EA \u05DE\u05E1 \u05DC\u05DB\u05DC \u05D7\u05D9\u05D5\u05D1 \u05D5\u05D7\u05E9\u05D1\u05D5\u05E0\u05D9\u05EA \u05D6\u05D9\u05DB\u05D5\u05D9 \u05DC\u05DB\u05DC \u05D4\u05D7\u05D6\u05E8.", summaryEn: "Cardcom by default, chosen in admin settings (or simulated for tests). The card is typed on the secure Cardcom page and saved as a sealed token, every charge carries an idempotency key, and Cardcom issues a tax invoice per charge and a credit invoice per refund.", code: ["apps/web/src/server/billing/provider.ts", "apps/web/src/server/billing/cardcom.ts", "apps/web/src/server/billing/card-pages.ts", "apps/web/src/app/api/billing/card"], env: ["BILLING_PROVIDER", "BILLING_MOCK_FAIL", "CARDCOM_TERMINAL", "CARDCOM_API_NAME", "CARDCOM_API_PASSWORD", "CARDCOM_INVOICES", "CARDCOM_CSS_URL", "CARDCOM_TOKEN_KEY", "CARDCOM_DEPARTMENT_ID"], portability: "Payments", decisions: ["D-175", "D-292"] },
|
|
21176
21202
|
{ id: "registrar", kind: "external", zone: "services", label: "Domain registrars (Cloudflare, LiveDNS)", summary: "\u05E7\u05E0\u05D9\u05D9\u05EA \u05D3\u05D5\u05DE\u05D9\u05D9\u05E0\u05D9\u05DD \u05DC\u05D0\u05EA\u05E8: \u05DB\u05DC \u05E9\u05DD \u05D4\u05D5\u05DC\u05DA \u05DC\u05E8\u05E9\u05DD \u05D4\u05D6\u05D5\u05DC \u05D1\u05D9\u05D5\u05EA\u05E8 \u05E9\u05E4\u05D5\u05E2\u05DC, \u05DB\u05DC \u05E8\u05E9\u05DD \u05D1\u05E2\u05DC\u05D5\u05EA \u05D5\u05D1\u05E2\u05DE\u05DC\u05D4 \u05DE\u05E9\u05DC\u05D5 (Cloudflare \u05D1\u05D3\u05D5\u05DC\u05E8\u05D9\u05DD \u05DC\u05DB\u05DC \u05E9\u05DD, LiveDNS \u05DE\u05E0\u05E7\u05D5\u05D3\u05D5\u05EA \u05E7\u05E8\u05D3\u05D9\u05D8 \u05DC\u05E4\u05D9 \u05D4\u05DE\u05D7\u05D9\u05E8\u05D5\u05DF \u05E9\u05E0\u05E7\u05E8\u05D0 \u05DB\u05DC \u05D9\u05D5\u05DD, \u05D0\u05D5 \u05D9\u05D3\u05E0\u05D9 \u05DE\u05EA\u05D5\u05E8 \u05D4\u05E6\u05D5\u05D5\u05EA), \u05DE\u05D7\u05D9\u05E8 \u05DB\u05DC \u05E1\u05D9\u05D5\u05DE\u05EA \u05E0\u05D1\u05D3\u05E7 \u05DB\u05DC \u05D9\u05D5\u05DD (\u05D5\u05D0\u05E4\u05E9\u05E8 \u05DC\u05DB\u05D1\u05D5\u05EA \u05E1\u05D9\u05D5\u05DE\u05D5\u05EA), \u05E8\u05D9\u05E9\u05D5\u05DD \u05D0\u05D7\u05D3 \u05DC\u05DB\u05DC \u05D4\u05D6\u05DE\u05E0\u05D4, \u05D9\u05D5\u05DE\u05DF \u05E7\u05E8\u05D9\u05D0\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D6\u05DE\u05E0\u05D4, \u05D5\u05D7\u05D9\u05D3\u05D5\u05E9 \u05E9\u05E0\u05EA\u05D9 \u05D0\u05E6\u05DC \u05D0\u05D5\u05EA\u05D5 \u05E8\u05E9\u05DD. \u05DC\u05D3\u05D5\u05DE\u05D9\u05D9\u05DF \u05E9\u05E0\u05E7\u05E0\u05D4: \u05D3\u05D5\u05D0\u05E8 \u05D3\u05E8\u05DA Cloudflare Email Routing.", summaryEn: "Buying domains for a site: each name goes to the cheapest registrar that is on, each with its own cost and fee (Cloudflare in dollars per name, LiveDNS from credit points priced by its list, read daily, or by hand from the team queue), the price of every extension checked daily (some can be turned off), one registration per order, a call log per order, yearly renewal at the same registrar. For a bought domain: email through Cloudflare Email Routing.", code: ["apps/web/src/server/registrar.ts", "apps/web/src/server/registrar-livedns.ts", "apps/web/src/server/registrar-log.ts", "apps/web/src/server/domain-sales.ts", "apps/web/src/server/domain-extensions.ts", "apps/web/src/server/domain-email.ts", "apps/web/src/server/billing/services.ts"], env: ["CF_REGISTRAR_TOKEN", "LIVEDNS_USER", "LIVEDNS_PASSWORD"], decisions: ["D-299", "D-300", "D-301", "D-458", "D-486", "D-489", "D-491"] },
|
|
21203
|
+
{ id: "mailbox-providers", kind: "external", zone: "services", label: "Mailbox providers (Google Workspace, Zoho Mail)", summary: "\u05EA\u05D9\u05D1\u05D5\u05EA \u05D3\u05D5\u05D0\u05E8 \u05E9\u05E0\u05DE\u05DB\u05D5\u05E8 \u05E2\u05DC \u05D3\u05D5\u05DE\u05D9\u05D9\u05DF \u05E9\u05DC \u05D4\u05DC\u05E7\u05D5\u05D7: Google Workspace \u05D3\u05E8\u05DA \u05EA\u05D5\u05DB\u05E0\u05D9\u05EA \u05D4\u05DE\u05E9\u05D5\u05D5\u05E7\u05D9\u05DD \u05D5\u05BEZoho Mail \u05D3\u05E8\u05DA \u05EA\u05D5\u05DB\u05E0\u05D9\u05EA \u05D4\u05E9\u05D5\u05EA\u05E4\u05D9\u05DD, \u05D1\u05D7\u05D9\u05D5\u05D1 \u05D7\u05D5\u05D3\u05E9\u05D9 \u05DC\u05DB\u05DC \u05EA\u05D9\u05D1\u05D4. \u05D4\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05DE\u05D5\u05DB\u05E0\u05D9\u05DD, \u05D4\u05DE\u05D7\u05D1\u05E8 \u05D9\u05D9\u05D1\u05E0\u05D4 \u05DB\u05E9\u05D9\u05D4\u05D9\u05D5 \u05D7\u05D5\u05D6\u05D4 \u05D5\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4.", summaryEn: "Mailboxes we sell on the customer domain: Google Workspace through the reseller program and Zoho Mail through the partner program, billed per mailbox per month. The keys are ready; the connector is built once a contract and sandbox keys exist.", code: ["apps/web/src/server/mailbox.ts"], env: ["GOOGLE_RESELLER_KEY", "GOOGLE_RESELLER_ADMIN", "ZOHO_PARTNER_CLIENT_ID", "ZOHO_PARTNER_CLIENT_SECRET", "ZOHO_PARTNER_REFRESH_TOKEN"], decisions: ["D-547"] },
|
|
21177
21204
|
{ id: "mcp", kind: "external", zone: "services", label: "MCP for AI tools (/api/mcp)", summary: "ChatGPT \u05D5\u05BEClaude \u05DE\u05EA\u05D7\u05D1\u05E8\u05D9\u05DD \u05D1\u05DC\u05D9 \u05D8\u05E8\u05DE\u05D9\u05E0\u05DC: OAuth \u05E2\u05DD \u05D0\u05D9\u05E9\u05D5\u05E8 \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF, \u05D5\u05D0\u05D6 \u05DB\u05DC\u05D9\u05DD \u05DC\u05E8\u05E9\u05D9\u05DE\u05EA \u05D4\u05D0\u05EA\u05E8\u05D9\u05DD, \u05D1\u05D3\u05D9\u05E7\u05D4, \u05D4\u05E2\u05DC\u05D0\u05EA \u05D2\u05E8\u05E1\u05D4 \u05DC\u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4, \u05D4\u05E8\u05E6\u05EA \u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E9\u05D4\u05D0\u05EA\u05E8 \u05E7\u05E0\u05D4 (\u05D4\u05E7\u05E0\u05D9\u05D9\u05D4 \u05E8\u05E7 \u05D1\u05D0\u05EA\u05E8), \u05D5\u05D4\u05E2\u05DC\u05D0\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E8\u05E7 \u05E2\u05DD \u05D4\u05E8\u05E9\u05D0\u05D4 \u05D5\u05D0\u05D9\u05E9\u05D5\u05E8.", summaryEn: "ChatGPT and Claude connect without a terminal: OAuth with a browser consent, then tools to list sites, check, upload a version to a preview, run add-ons the site owns (buying stays on the site), and go live only with the permission and a yes.", code: ["apps/web/src/app/api/mcp/route.ts", "apps/web/src/server/mcp-tools.ts", "apps/web/src/server/auth.ts"], decisions: ["D-302"] },
|
|
21178
21205
|
{ id: "npm", kind: "external", zone: "services", label: "npm registry", summary: "\u05DE\u05E4\u05D9\u05E5 \u05D0\u05EA \u05D4\u05BECLI, \u05D5\u05DE\u05DE\u05E0\u05D5 \u05D4\u05D1\u05E0\u05D9\u05D9\u05D4 \u05DE\u05EA\u05E7\u05D9\u05E0\u05D4 \u05EA\u05DC\u05D5\u05D9\u05D5\u05EA.", summaryEn: "Distributes the CLI, and the build installs dependencies from it." },
|
|
21179
21206
|
{ id: "pagespeed", kind: "external", zone: "services", label: "Google PageSpeed Insights", summary: "\u05D1\u05D3\u05D9\u05E7\u05D5\u05EA \u05D4\u05DE\u05D4\u05D9\u05E8\u05D5\u05EA, \u05D4\u05E0\u05D2\u05D9\u05E9\u05D5\u05EA \u05D5\u05D4\u05BESEO \u05D4\u05D7\u05D9\u05E0\u05DE\u05D9\u05D5\u05EA: Lighthouse \u05D1\u05DE\u05E2\u05D1\u05D3\u05D4 \u05E9\u05DC \u05D2\u05D5\u05D2\u05DC (\u05DB\u05D5\u05DC\u05DC \u05E1\u05D5\u05DB\u05E0\u05D9 AI) \u05D5\u05E0\u05EA\u05D5\u05E0\u05D9 \u05DE\u05D1\u05E7\u05E8\u05D9\u05DD \u05D0\u05DE\u05D9\u05EA\u05D9\u05D9\u05DD.", summaryEn: "The free speed, accessibility and SEO tests: Lighthouse run at Google (AI agents included) plus real visitor data.", env: ["PAGESPEED_API_KEY"], decisions: ["D-199", "D-222"] },
|
|
@@ -21315,9 +21342,109 @@ var DEFAULT_FLEET = {
|
|
|
21315
21342
|
};
|
|
21316
21343
|
var DEFAULT_PROFIT = { paying: 1e4, priceAgorot: 4e3, freeAccounts: 0, sitesPerPaying: 1, profile: "typical", ownDomainShare: DEFAULT_FLEET.ownDomainShare, zoneOwned: true, demoHostnames: DEFAULT_FLEET.demoHostnames, ownEmailsPerAccount: DEFAULT_FLEET.ownEmailsPerAccount, otherFixedUsd: DEFAULT_FLEET.otherFixedUsd, teamIls: 0, incomeTax: 0.23 };
|
|
21317
21344
|
|
|
21345
|
+
// ../shared/src/html.ts
|
|
21346
|
+
function stripHtmlComments(html) {
|
|
21347
|
+
return html.replace(/<!--[\s\S]*?-->/g, (m) => m.replace(/[^\n]/g, " "));
|
|
21348
|
+
}
|
|
21349
|
+
function stripScripts(html) {
|
|
21350
|
+
return html.replace(/(<(script|style|template|noscript)\b[^>]*>)([\s\S]*?)(<\/\2\s*>)/gi, (_m, open2, _t, body, close) => open2 + body.replace(/[^\n]/g, " ") + close);
|
|
21351
|
+
}
|
|
21352
|
+
function parseAttrs(tag) {
|
|
21353
|
+
const attrs = {};
|
|
21354
|
+
const inner = tag.replace(/^<\s*[\w:-]+/, "").replace(/\/?>$/, "");
|
|
21355
|
+
const re = /([^\s=/>"']+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;
|
|
21356
|
+
let m;
|
|
21357
|
+
while (m = re.exec(inner)) attrs[m[1].toLowerCase()] = m[2] ?? m[3] ?? m[4] ?? "";
|
|
21358
|
+
return attrs;
|
|
21359
|
+
}
|
|
21360
|
+
function tags(html, name) {
|
|
21361
|
+
const re = new RegExp(`<${name}\\b[^>]*>`, "gi");
|
|
21362
|
+
const out2 = [];
|
|
21363
|
+
let m;
|
|
21364
|
+
while (m = re.exec(html)) out2.push({ attrs: parseAttrs(m[0]), index: m.index });
|
|
21365
|
+
return out2;
|
|
21366
|
+
}
|
|
21367
|
+
function decode3(text) {
|
|
21368
|
+
return text.replace(/&#(\d{1,7});/g, (m, n2) => Number(n2) > 0 && Number(n2) <= 1114111 ? String.fromCodePoint(Number(n2)) : m).replace(/&#x([0-9a-f]{1,6});/gi, (m, h) => parseInt(h, 16) > 0 && parseInt(h, 16) <= 1114111 ? String.fromCodePoint(parseInt(h, 16)) : m).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'|'/g, "'").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
21369
|
+
}
|
|
21370
|
+
function titleOfPage(html) {
|
|
21371
|
+
const m = /<title\b[^>]*>([\s\S]*?)<\/title>/i.exec(html);
|
|
21372
|
+
const t = m ? decode3(m[1].replace(/<[^>]*>/g, "")) : "";
|
|
21373
|
+
return t || null;
|
|
21374
|
+
}
|
|
21375
|
+
function metaContent(html, key) {
|
|
21376
|
+
for (const t of tags(html, "meta")) {
|
|
21377
|
+
const k = (t.attrs.name ?? t.attrs.property ?? "").toLowerCase();
|
|
21378
|
+
if (k === key && t.attrs.content?.trim()) return decode3(t.attrs.content);
|
|
21379
|
+
}
|
|
21380
|
+
return null;
|
|
21381
|
+
}
|
|
21382
|
+
function htmlTag(html) {
|
|
21383
|
+
return tags(html, "html")[0] ?? null;
|
|
21384
|
+
}
|
|
21385
|
+
function isSpaShell(html) {
|
|
21386
|
+
return /<div\b[^>]*\bid\s*=\s*["'](?:root|app|__nuxt|svelte)["'][^>]*>\s*<\/div>/i.test(html) && !/<h1\b/i.test(html);
|
|
21387
|
+
}
|
|
21388
|
+
|
|
21318
21389
|
// ../shared/src/tool-fetch.ts
|
|
21319
21390
|
var FILE_BYTES = 512 * 1024;
|
|
21320
21391
|
|
|
21392
|
+
// ../shared/src/seo-audit.ts
|
|
21393
|
+
var textOf = (html) => decode3(html.replace(/<[^>]*>/g, " "));
|
|
21394
|
+
function readPageSeo(html, headers = {}) {
|
|
21395
|
+
const clean = stripScripts(stripHtmlComments(html));
|
|
21396
|
+
const headings = [];
|
|
21397
|
+
const re = /<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1\s*>/gi;
|
|
21398
|
+
let m;
|
|
21399
|
+
while (m = re.exec(clean)) headings.push({ level: Number(m[1]), text: textOf(m[2]).slice(0, 160) });
|
|
21400
|
+
const links = tags(clean, "link");
|
|
21401
|
+
const rel = (t) => (t.attrs.rel ?? "").toLowerCase().split(/\s+/);
|
|
21402
|
+
const imgs = tags(clean, "img");
|
|
21403
|
+
const root = htmlTag(clean);
|
|
21404
|
+
return {
|
|
21405
|
+
title: titleOfPage(clean),
|
|
21406
|
+
description: metaContent(clean, "description"),
|
|
21407
|
+
h1: headings.filter((h) => h.level === 1).map((h) => h.text),
|
|
21408
|
+
headings,
|
|
21409
|
+
lang: root?.attrs.lang?.trim() || null,
|
|
21410
|
+
dir: root?.attrs.dir?.trim() || null,
|
|
21411
|
+
canonical: links.find((t) => rel(t).includes("canonical"))?.attrs.href?.trim() || null,
|
|
21412
|
+
robots: metaContent(clean, "robots"),
|
|
21413
|
+
xRobots: headers["x-robots-tag"] ?? null,
|
|
21414
|
+
hreflang: links.filter((t) => rel(t).includes("alternate") && t.attrs.hreflang && t.attrs.href).map((t) => ({ lang: t.attrs.hreflang.trim(), href: t.attrs.href.trim() })),
|
|
21415
|
+
viewport: !!metaContent(clean, "viewport"),
|
|
21416
|
+
images: imgs.length,
|
|
21417
|
+
imagesWithoutAlt: imgs.filter((t) => !("alt" in t.attrs)).length,
|
|
21418
|
+
spaShell: isSpaShell(html)
|
|
21419
|
+
};
|
|
21420
|
+
}
|
|
21421
|
+
function parseRobots(text) {
|
|
21422
|
+
const groups = [];
|
|
21423
|
+
const sitemaps = [];
|
|
21424
|
+
let current = null;
|
|
21425
|
+
let lastWasAgent = false;
|
|
21426
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
21427
|
+
const line = raw.replace(/#.*$/, "").trim();
|
|
21428
|
+
const m = /^([A-Za-z-]+)\s*:\s*(.*)$/.exec(line);
|
|
21429
|
+
if (!m) continue;
|
|
21430
|
+
const key = m[1].toLowerCase();
|
|
21431
|
+
const value = m[2].trim();
|
|
21432
|
+
if (key === "user-agent") {
|
|
21433
|
+
if (!current || !lastWasAgent) {
|
|
21434
|
+
current = { agents: [], rules: [] };
|
|
21435
|
+
groups.push(current);
|
|
21436
|
+
}
|
|
21437
|
+
current.agents.push(value.toLowerCase());
|
|
21438
|
+
lastWasAgent = true;
|
|
21439
|
+
continue;
|
|
21440
|
+
}
|
|
21441
|
+
lastWasAgent = false;
|
|
21442
|
+
if (key === "sitemap") sitemaps.push(value);
|
|
21443
|
+
else if ((key === "allow" || key === "disallow") && current) current.rules.push({ allow: key === "allow", path: value });
|
|
21444
|
+
}
|
|
21445
|
+
return { groups, sitemaps };
|
|
21446
|
+
}
|
|
21447
|
+
|
|
21321
21448
|
// ../shared/src/plan-copy.ts
|
|
21322
21449
|
var PLAN_FEATURES = [
|
|
21323
21450
|
{ key: "sites", limit: "maxSites" },
|
|
@@ -21338,22 +21465,47 @@ var KEYS = new Set(PLAN_FEATURES.map((f) => f.key));
|
|
|
21338
21465
|
|
|
21339
21466
|
// ../shared/src/start-flow.ts
|
|
21340
21467
|
var START_ID_RE = /^[a-hjkmnp-z2-9]{10}$/;
|
|
21468
|
+
var MIGRATION_DIR = ".deployai/migration";
|
|
21341
21469
|
var BRIEF_FILE = ".deployai/brief.md";
|
|
21342
21470
|
var CHECK = { cmd: "npx deployai@latest check", say: "Fix every blocker it lists, then run it again until it shows none." };
|
|
21343
|
-
var
|
|
21471
|
+
var DEPLOY_ASK_RULE = 'Never deploy on your own, and never after each small edit: every deploy is a full build. Deploy only when what the owner asked for is done. Then say in short what changed and ask: "Put it live, see a preview first, or not yet?" Put it live: deploy with --live. Preview first: deploy without it and send the owner the preview address. Not yet: keep working, and the next change goes up in the same deploy. If the owner said to always put changes live, deploy with --live without asking. Database changes still get their own yes.';
|
|
21472
|
+
var ASK = { say: DEPLOY_ASK_RULE };
|
|
21473
|
+
var GUEST_ASK = { say: 'Deploy only when what the owner asked for is done. Say in short what you made and ask: "Put it up now, or not yet?" On Not yet, keep working and ask again when the next request is done.' };
|
|
21344
21474
|
var LOGIN = { cmd: "npx deployai@latest login", say: "The owner approves it in the browser window it opens." };
|
|
21345
|
-
var
|
|
21346
|
-
var
|
|
21347
|
-
var DEPLOY_SAY = "It builds a preview first. Write the -m message in a few words in the language of the owner, about what they see changed.";
|
|
21475
|
+
var PROMOTE = { cmd: "npx deployai@latest promote v<N>", say: "Only when deploy ran without --live, and only after the owner approves the preview. N is the version number deploy printed. Then give the owner the live address." };
|
|
21476
|
+
var DEPLOY_SAY = "Add --live only if the owner chose to put it live right away. It waits for the build: with --live it ends with the live address, else with the preview address to send the owner. When it prints database changes, a yes to going live does not cover them (D-541): show the owner the changes and ask the question it prints, and only after a yes run the promote --approve-sql command it printed; changes it says remove data only the owner approves, never you. Write the -m message in a few words in the language of the owner, about what they see changed.";
|
|
21348
21477
|
var BUILD = { say: "This folder had no site, so start wrote a starter page. Do not ask where the site comes from or which way to start: build a first version of the owner's site in its place now. Use what you know (the instructions above, .deployai/brief.md if it exists, the folder name) and choose the layout, colors and wording yourself. Ask at most one short question, and only if you cannot tell what the site is for. Leave out what you do not know (phone, prices, hours) instead of asking for it. Then show it to the owner and offer to add those details. Run check only after that." };
|
|
21478
|
+
var MIGRATE_STEPS = [
|
|
21479
|
+
{ cmd: "npx deployai@latest blocks inbox", say: "Only if the old site has a contact or quote form: the form with its own messages page for the owner." },
|
|
21480
|
+
{ cmd: "npx deployai@latest blocks blog", say: "Only if the old site has posts, news or articles: the blog, with the posts as Markdown files." },
|
|
21481
|
+
{ cmd: "npx deployai@latest migrate media", say: "Downloads the old site's images and files into .deployai/migration/media; run it again if it stops, it goes on where it stopped. Move the files the new pages use into the site." },
|
|
21482
|
+
{ ...CHECK },
|
|
21483
|
+
LOGIN,
|
|
21484
|
+
{ cmd: 'npx deployai@latest link --create "<the site name>"', say: "Makes the site in the owner's account and links this folder. The add-ons come with it for free while the offer lasts." },
|
|
21485
|
+
{ cmd: 'npx deployai@latest deploy -m "moved from the old site"', say: "Without --live: the first version of a moved site is always a preview. It waits for the build and prints the preview address." },
|
|
21486
|
+
{ cmd: "npx deployai@latest migrate verify <preview address>", say: "Compares every old address with the preview: a page that moved, lost its title or description, or does not open. Fix each one, deploy again and run it again until it lists none." },
|
|
21487
|
+
{ cmd: "npx deployai@latest addons run", say: "Runs every add-on of the site in one go. Work through each step it prints, run check between add-ons, and report each one as it says." },
|
|
21488
|
+
{ say: 'Send the owner the preview address and the table from .deployai/migration/plan.md. Ask: "Put it live now, or change something first?" Deploy again for each change.' },
|
|
21489
|
+
PROMOTE,
|
|
21490
|
+
{ say: "Only after it is live: tell the owner how to connect their domain in the dashboard (Domains), to keep their email records (MX) as they are, and to keep the old hosting for a few weeks before they cancel it." }
|
|
21491
|
+
];
|
|
21492
|
+
var managedStatus = (stage, note, say) => ({ cmd: `npx deployai@latest migrate status ${stage} "${note}"`, say });
|
|
21493
|
+
var MANAGED_STEPS = [
|
|
21494
|
+
managedStatus("building", "<what is done>", "First, once the plan in .deployai/migration/plan.md is agreed: the request shows the build started."),
|
|
21495
|
+
...MIGRATE_STEPS.slice(0, 9),
|
|
21496
|
+
managedStatus("preview_ready", "<preview address>", "The owner gets an email with the preview address."),
|
|
21497
|
+
...MIGRATE_STEPS.slice(9, 11),
|
|
21498
|
+
managedStatus("live", "<live address>", "Only after it is live. Then the team transfers the site to the owner."),
|
|
21499
|
+
...MIGRATE_STEPS.slice(11)
|
|
21500
|
+
];
|
|
21349
21501
|
var PULL = { cmd: "npx deployai@latest pull", say: "This folder was empty, so it downloads the code of the live site first. Work on that code." };
|
|
21350
21502
|
function startSteps(kind, opts = {}) {
|
|
21351
21503
|
switch (kind) {
|
|
21352
21504
|
case "new":
|
|
21353
|
-
return [...opts.starter ? [BUILD] : [], CHECK, ASK, LOGIN, { cmd: 'npx deployai@latest deploy -m "first version"', say: DEPLOY_SAY },
|
|
21505
|
+
return [...opts.starter ? [BUILD] : [], CHECK, ASK, LOGIN, { cmd: 'npx deployai@latest deploy -m "first version"', say: DEPLOY_SAY }, PROMOTE];
|
|
21354
21506
|
case "update": {
|
|
21355
21507
|
const deploy = { cmd: 'npx deployai@latest deploy -m "<what changed, in a few words>"', say: DEPLOY_SAY };
|
|
21356
|
-
return opts.emptyFolder ? [LOGIN, PULL, CHECK, ASK, deploy,
|
|
21508
|
+
return opts.emptyFolder ? [LOGIN, PULL, CHECK, ASK, deploy, PROMOTE] : [CHECK, ASK, LOGIN, deploy, PROMOTE];
|
|
21357
21509
|
}
|
|
21358
21510
|
case "move":
|
|
21359
21511
|
return [
|
|
@@ -21362,14 +21514,15 @@ function startSteps(kind, opts = {}) {
|
|
|
21362
21514
|
LOGIN,
|
|
21363
21515
|
{ cmd: "npx deployai@latest link", say: `If it lists the owner's sites, ask which one is this folder and run npx deployai@latest link <slug>. If there is none, ask for a name and run npx deployai@latest link --create "<name>".` },
|
|
21364
21516
|
{ cmd: 'npx deployai@latest deploy -m "first version"', say: DEPLOY_SAY },
|
|
21365
|
-
STATUS,
|
|
21366
21517
|
PROMOTE
|
|
21367
21518
|
];
|
|
21519
|
+
case "migrate":
|
|
21520
|
+
return (opts.managed ? MANAGED_STEPS : MIGRATE_STEPS).map((step) => ({ ...step }));
|
|
21368
21521
|
case "guest":
|
|
21369
21522
|
return [
|
|
21370
21523
|
...opts.starter ? [BUILD] : [],
|
|
21371
21524
|
{ ...CHECK, say: "Fix every blocker it lists, then run it again until it shows none. If the site needs environment variables, secrets, file storage or sending email, never stop building for it: tell the owner once, in one plain line, that putting those parts live needs a free account (one link, about a minute), keep building what they asked, and ask about the account only at the deploy step." },
|
|
21372
|
-
|
|
21525
|
+
GUEST_ASK,
|
|
21373
21526
|
{ cmd: "npx deployai@latest deploy --guest", say: "It prints the address, the claim link and any owner keys." },
|
|
21374
21527
|
{ say: "The site goes live about a minute later: wait, then open the address to see it is live before you tell the owner." },
|
|
21375
21528
|
{ say: "Give the owner the address, the claim link and any owner keys it printed. Tell them the site is temporary until the date it printed, that the claim link is the only way to keep it in a free account, and that owner keys show only once, so they should save both now." },
|
|
@@ -21389,9 +21542,12 @@ var CLI_MAP_NODES = [
|
|
|
21389
21542
|
n("page-samples", "site", "/samples", "\u05DE\u05EA\u05D7\u05D9\u05DC\u05D9\u05DD \u05DE\u05D3\u05D5\u05D2\u05DE\u05D4: \u05E9\u05D5\u05DC\u05D7 \u05DC /go-live \u05E2\u05DD \u05D4\u05D3\u05D5\u05D2\u05DE\u05D4, \u05D5\u05D4 id \u05E0\u05D5\u05E9\u05D0 \u05D0\u05D5\u05EA\u05D4.", "Start from a sample: sends to /go-live with the sample, and the id carries it."),
|
|
21390
21543
|
n("page-new", "site", "/dashboard/new", "\u05D0\u05EA\u05E8 \u05D7\u05D3\u05E9: \u05D4\u05D3\u05D5\u05D2\u05DE\u05D4, \u05D4\u05E9\u05DD \u05D5\u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E0\u05E9\u05DE\u05E8\u05D9\u05DD \u05D1\u05D0\u05EA\u05E8, \u05D5\u05D4 id \u05E0\u05D5\u05E9\u05D0 \u05D0\u05EA \u05DB\u05D5\u05DC\u05DD.", "New site: the sample, name and details are saved on the site, and the id carries them all."),
|
|
21391
21544
|
n("page-site", "site", "/project/<id>", "\u05E2\u05DE\u05D5\u05D3 \u05D4\u05D0\u05EA\u05E8: \u05E9\u05D5\u05E8\u05EA \u05D4\u05EA\u05D7\u05DC\u05D4 \u05E2\u05D3 \u05D4\u05D2\u05E8\u05E1\u05D4 \u05D4\u05E8\u05D0\u05E9\u05D5\u05E0\u05D4, \u05D5\u05D0\u05D7\u05E8\u05D9\u05D4 \u05E9\u05D5\u05E8\u05EA \u05E2\u05D3\u05DB\u05D5\u05DF.", "The site page: a new site line until the first version, then an update line."),
|
|
21545
|
+
n("page-move-url", "site", "/move", "\u05D4\u05E2\u05D1\u05D9\u05E8\u05D5 \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8 \u05E9\u05DC\u05D9: \u05DB\u05EA\u05D5\u05D1\u05EA \u05D4\u05D0\u05EA\u05E8 \u05D4\u05D9\u05E9\u05DF, \u05D4\u05E4\u05DC\u05D8\u05E4\u05D5\u05E8\u05DE\u05D4, \u05E1\u05D5\u05D2 \u05D4\u05D0\u05EA\u05E8 \u05D5\u05D4\u05E2\u05D9\u05E6\u05D5\u05D1. \u05D4 id \u05E0\u05D5\u05E9\u05D0 \u05D0\u05EA \u05DB\u05D5\u05DC\u05DD.", "Move my site: the old site address, the platform, the kind of site and the design. The id carries them all."),
|
|
21392
21546
|
n("page-move", "site", "/dashboard", "\u05D9\u05E9 \u05DC\u05D9 \u05DB\u05D1\u05E8 \u05D0\u05EA\u05E8: \u05E9\u05D5\u05E8\u05D4 \u05DC\u05D4\u05E2\u05D1\u05E8\u05EA \u05D4\u05D0\u05EA\u05E8 \u05E9\u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4.", "I already have a site: a line to move the site in the folder."),
|
|
21393
21547
|
// The CLI: every command (packages/cli/src/cli.ts).
|
|
21394
21548
|
n("cmd-start", "cli", "start <id>", "\u05DE\u05DB\u05D9\u05DF \u05D0\u05EA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05DC\u05E4\u05D9 \u05DB\u05DC \u05D4\u05D1\u05D7\u05D9\u05E8\u05D5\u05EA: \u05EA\u05D9\u05E7\u05D9\u05D9\u05D4, \u05D3\u05D5\u05D2\u05DE\u05D4 \u05D5\u05D4\u05EA\u05E7\u05E0\u05D4, \u05E7\u05D5\u05D1\u05E5 \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05D5\u05D7\u05D9\u05D1\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8. \u05DE\u05D3\u05E4\u05D9\u05E1 \u05DC\u05E1\u05D5\u05DB\u05DF \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 \u05D5\u05D0\u05EA \u05D4\u05E4\u05E7\u05D5\u05D3\u05D5\u05EA.", "Prepares the folder with every choice: folder, sample and install, the details file and the site link. Prints the text and the commands for the agent."),
|
|
21549
|
+
n("cmd-migrate", "cli", "migrate scan / media / redirects / verify / status", "\u05D4\u05D0\u05EA\u05E8 \u05D4\u05D9\u05E9\u05DF: \u05E1\u05E8\u05D9\u05E7\u05EA \u05D4\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05D5\u05D4\u05EA\u05D5\u05DB\u05DF, \u05D4\u05D5\u05E8\u05D3\u05EA \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD, \u05D4\u05E4\u05E0\u05D9\u05D5\u05EA 301 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E9\u05DC\u05D0 \u05E0\u05E9\u05D0\u05E8\u05D5, \u05D5\u05D1\u05D3\u05D9\u05E7\u05D4 \u05E9\u05DB\u05DC \u05DB\u05EA\u05D5\u05D1\u05EA \u05D9\u05E9\u05E0\u05D4 \u05E0\u05E4\u05EA\u05D7\u05EA \u05D1\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D4\u05DE\u05E7\u05D3\u05D9\u05DE\u05D4.", "The old site: scan its addresses and content, download its files, 301s for addresses that could not stay, and a check that every old address opens on the preview."),
|
|
21550
|
+
n("cmd-blocks", "cli", "blocks [name]", "\u05D0\u05D1\u05E0\u05D9 \u05D1\u05E0\u05D9\u05D9\u05DF \u05E9\u05DC\u05E0\u05D5 \u05DC\u05D0\u05EA\u05E8 \u05E7\u05D9\u05D9\u05DD: inbox (\u05D8\u05D5\u05E4\u05E1 \u05D5\u05E2\u05DE\u05D5\u05D3 \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05DC\u05D1\u05E2\u05DC\u05D9\u05DD), blog. \u05DC\u05D0 \u05D3\u05D5\u05E8\u05E1 \u05E7\u05D1\u05E6\u05D9\u05DD.", "Our building blocks for an existing site: inbox (form and owner messages page), blog. Never writes over files."),
|
|
21395
21551
|
n("cmd-samples", "cli", "samples [key]", "\u05E8\u05E9\u05D9\u05DE\u05EA \u05D4\u05D3\u05D5\u05D2\u05DE\u05D0\u05D5\u05EA, \u05D0\u05D5 \u05D4\u05D5\u05E8\u05D3\u05D4 \u05E9\u05DC \u05D0\u05D7\u05EA.", "Lists the samples, or downloads one."),
|
|
21396
21552
|
n("cmd-check", "cli", "check", "\u05D4\u05D0\u05DD \u05D4\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E8\u05D5\u05E5 \u05D0\u05E6\u05DC\u05E0\u05D5: \u05D7\u05D5\u05E1\u05DE\u05D9\u05DD \u05D5\u05D0\u05D6\u05D4\u05E8\u05D5\u05EA, \u05E2\u05DD \u05E4\u05E8\u05D5\u05DE\u05E4\u05D8 \u05EA\u05D9\u05E7\u05D5\u05DF.", "Can the project run on our hosting: blockers and warnings, with a fix prompt."),
|
|
21397
21553
|
n("cmd-init", "cli", "init", "\u05D9\u05D5\u05E6\u05E8 DEPLOYAI.md \u05E2\u05DD \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DC\u05E1\u05D5\u05DB\u05DF, \u05E9\u05D5\u05E8\u05D4 \u05D0\u05DC\u05D9\u05D5 \u05D1 AGENTS.md \u05D5 CLAUDE.md, \u05D5 .deployai/project.json. \u05E8\u05D0\u05E9\u05D5\u05DF \u05D1\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8 \u05D7\u05D3\u05E9.", "Creates DEPLOYAI.md with the agent rules, a line to it in AGENTS.md and CLAUDE.md, and .deployai/project.json. First in a new project."),
|
|
@@ -21400,12 +21556,14 @@ var CLI_MAP_NODES = [
|
|
|
21400
21556
|
n("cmd-logout", "cli", "logout", "\u05DE\u05D1\u05D8\u05DC \u05D0\u05EA \u05D4\u05D8\u05D5\u05E7\u05DF \u05D5\u05D9\u05D5\u05E6\u05D0 \u05DE\u05D4\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05DE\u05D7\u05E9\u05D1 \u05D4\u05D6\u05D4.", "Cancels the token and logs out on this computer."),
|
|
21401
21557
|
n("cmd-whoami", "cli", "whoami", "\u05E2\u05DD \u05D0\u05D9\u05D6\u05D4 \u05D7\u05E9\u05D1\u05D5\u05DF \u05DE\u05D7\u05D5\u05D1\u05E8\u05D9\u05DD.", "Which account is logged in."),
|
|
21402
21558
|
n("cmd-link", "cli", "link [site]", "\u05DE\u05D7\u05D1\u05E8 \u05D0\u05EA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05DC\u05D0\u05EA\u05E8, \u05D0\u05D5 \u05D9\u05D5\u05E6\u05E8 \u05D0\u05EA\u05E8 \u05E2\u05DD --create.", "Links the folder to a site, or makes one with --create."),
|
|
21403
|
-
n("cmd-deploy", "cli", "deploy -m", "\u05D1\u05D5\u05D3\u05E7, \u05D0\u05D5\u05E8\u05D6 \u05D5\u05DE\u05E2\u05DC\u05D4 \u05D2\u05E8\u05E1\u05D4 \u05DC\u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4.", "Checks, packs and uploads a version
|
|
21559
|
+
n("cmd-deploy", "cli", "deploy -m", "\u05D1\u05D5\u05D3\u05E7, \u05D0\u05D5\u05E8\u05D6 \u05D5\u05DE\u05E2\u05DC\u05D4 \u05D2\u05E8\u05E1\u05D4, \u05DE\u05D7\u05DB\u05D4 \u05DC\u05D1\u05E0\u05D9\u05D9\u05D4 \u05D5\u05DE\u05E2\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E2\u05DD --live \u05D0\u05D5 \u05E0\u05D5\u05EA\u05DF \u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4.", "Checks, packs and uploads a version, waits for the build, then puts it live with --live or gives the preview."),
|
|
21404
21560
|
n("cmd-guest", "cli", "deploy --guest", "\u05D0\u05EA\u05E8 \u05D6\u05DE\u05E0\u05D9 \u05D1\u05DC\u05D9 \u05D7\u05E9\u05D1\u05D5\u05DF, \u05E2\u05DD \u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05E9\u05DE\u05D9\u05E8\u05D4.", "A temporary site with no account, with a claim link."),
|
|
21405
21561
|
n("cmd-pull", "cli", "pull", "\u05DE\u05D5\u05E8\u05D9\u05D3 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D3 \u05E9\u05DC \u05D4\u05D2\u05E8\u05E1\u05D4 \u05E9\u05D1\u05D0\u05D5\u05D5\u05D9\u05E8 \u05DC\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05E8\u05D9\u05E7\u05D4.", "Downloads the code of the live version into an empty folder."),
|
|
21406
21562
|
n("cmd-claim", "cli", "claim --email", "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D4\u05E9\u05DE\u05D9\u05E8\u05D4 \u05E9\u05D5\u05D1, \u05D0\u05D5 \u05D1\u05DE\u05D9\u05D9\u05DC \u05E2\u05DD \u05EA\u05D6\u05DB\u05D5\u05E8\u05EA \u05DC\u05E4\u05E0\u05D9 \u05D4\u05DE\u05D7\u05D9\u05E7\u05D4.", "The claim link again, or by email with a reminder before the delete."),
|
|
21407
21563
|
n("cmd-status", "cli", "status", "\u05DE\u05E6\u05D1 \u05D4\u05D2\u05E8\u05E1\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05D5\u05DB\u05EA\u05D5\u05D1\u05EA \u05D4\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D4\u05DE\u05E7\u05D3\u05D9\u05DE\u05D4.", "The latest version's state and preview address."),
|
|
21408
|
-
n("cmd-promote", "cli", "promote v<N>", "\u05DE\u05E2\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05D2\u05E8\u05E1\u05D4 \u05E9\u05D0\u05D5\u05E9\u05E8\u05D4.", "Puts an approved version live."),
|
|
21564
|
+
n("cmd-promote", "cli", "promote v<N>", "\u05DE\u05E2\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05D2\u05E8\u05E1\u05D4 \u05E9\u05D0\u05D5\u05E9\u05E8\u05D4, \u05D5\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D7\u05D3\u05E9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E8\u05E6\u05D9\u05DD \u05E7\u05D5\u05D3\u05DD \u05D0\u05D7\u05E8\u05D9 \u05D0\u05D9\u05E9\u05D5\u05E8.", "Puts an approved version live; new database changes run first, after a yes."),
|
|
21565
|
+
n("cmd-sql", "cli", "sql v<N>", "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E9\u05D2\u05E8\u05E1\u05D4 \u05DE\u05E8\u05D9\u05E6\u05D4 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D4\u05D9\u05D0 \u05E2\u05D5\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8.", "The database changes a version runs before it goes live."),
|
|
21566
|
+
n("api-sql", "server", "/api/cli/sql", "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05E9\u05DE\u05D7\u05DB\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8, \u05D5\u05E7\u05D5\u05D3 \u05E9\u05DE\u05D7\u05D1\u05E8 \u05D0\u05EA \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D0\u05DC\u05D9\u05D4\u05DD.", "The changes that wait for a yes, and a code that ties the yes to them."),
|
|
21409
21567
|
n("cmd-versions", "cli", "versions", "\u05E8\u05E9\u05D9\u05DE\u05EA \u05D4\u05D2\u05E8\u05E1\u05D0\u05D5\u05EA \u05E9\u05DC \u05D4\u05D0\u05EA\u05E8.", "The site's versions."),
|
|
21410
21568
|
n("cmd-rollback", "cli", "rollback v<N>", "\u05D7\u05D5\u05D6\u05E8 \u05DC\u05D2\u05E8\u05E1\u05D4 \u05E7\u05D5\u05D3\u05DE\u05EA.", "Goes back to an earlier version."),
|
|
21411
21569
|
n("cmd-addons", "cli", "addons / addon next / addon buy", "\u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E9\u05DC \u05D4\u05D0\u05EA\u05E8, \u05D4\u05E9\u05DC\u05D1 \u05D4\u05D1\u05D0 \u05E9\u05DC \u05EA\u05D5\u05E1\u05E3 \u05E9\u05E0\u05E7\u05E0\u05D4, \u05D5\u05E7\u05D9\u05E9\u05D5\u05E8 \u05E7\u05E0\u05D9\u05D9\u05D4 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8.", "The site's add-ons, the next step of one it bought, and a buy link for the owner."),
|
|
@@ -21415,6 +21573,9 @@ var CLI_MAP_NODES = [
|
|
|
21415
21573
|
n("cmd-telemetry", "cli", "telemetry", "\u05D4\u05E4\u05E2\u05DC\u05D4 \u05D0\u05D5 \u05DB\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC \u05E0\u05EA\u05D5\u05E0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9 \u05D0\u05E0\u05D5\u05E0\u05D9\u05DE\u05D9\u05D9\u05DD.", "Turns anonymous usage data on or off."),
|
|
21416
21574
|
// The server routes the CLI calls.
|
|
21417
21575
|
n("api-starts", "server", "GET /api/starts/:id", "\u05D4\u05D1\u05D7\u05D9\u05E8\u05D5\u05EA \u05D5\u05D4\u05D8\u05E7\u05E1\u05D8 \u05DC\u05E1\u05D5\u05DB\u05DF. 7 \u05D9\u05DE\u05D9\u05DD, 5 \u05E9\u05DC\u05D9\u05E4\u05D5\u05EA \u05DC\u05D0\u05EA\u05E8.", "The choices and the agent text. 7 days, 5 fetches for a site."),
|
|
21576
|
+
n("api-blocks", "server", "GET /blocks-src/<key>", "\u05E7\u05D5\u05D3 \u05D4\u05DE\u05E7\u05D5\u05E8 \u05E9\u05DC \u05D0\u05D1\u05DF \u05D1\u05E0\u05D9\u05D9\u05DF, \u05E6\u05D9\u05D1\u05D5\u05E8\u05D9.", "A block's source, public."),
|
|
21577
|
+
n("api-migrate-grant", "server", "POST /api/cli/migrations/grant", "\u05D0\u05D7\u05E8\u05D9 link \u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05DE /move: \u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D1\u05D7\u05D9\u05E0\u05DD \u05DC\u05D0\u05EA\u05E8 \u05E9\u05E2\u05D1\u05E8, \u05E4\u05E2\u05DD \u05D0\u05D7\u05EA \u05DC\u05DB\u05DC start \u05D5\u05E2\u05D3 3 \u05D0\u05EA\u05E8\u05D9\u05DD \u05DC\u05D7\u05E9\u05D1\u05D5\u05DF.", "After link in a folder from /move: the add-ons free for the moved site, once per start and up to 3 sites an account."),
|
|
21578
|
+
n("api-migrate-progress", "server", "POST /api/migrations/progress", "\u05DE\u05E2\u05D1\u05E8 \u05DE\u05E0\u05D5\u05D4\u05DC: \u05D4\u05E9\u05DC\u05D1 \u05D5\u05D4\u05E2\u05E8\u05D4 \u05E9\u05DC \u05E9\u05D5\u05E8\u05D4 \u05D0\u05D7\u05EA \u05DE migrate status, \u05DC\u05DC\u05D5\u05D7 \u05D4\u05D1\u05E7\u05E9\u05D5\u05EA \u05D5\u05DC\u05E2\u05DE\u05D5\u05D3 \u05D4\u05E1\u05D8\u05D8\u05D5\u05E1 \u05E9\u05DC \u05D4\u05D1\u05E2\u05DC\u05D9\u05DD.", "Managed move: the stage and a one line note from migrate status, to the requests board and the owner's status page."),
|
|
21418
21579
|
n("api-samples", "server", "GET /samples-src/<key>", "\u05E7\u05D5\u05D3 \u05D4\u05DE\u05E7\u05D5\u05E8 \u05E9\u05DC \u05D3\u05D5\u05D2\u05DE\u05D4, \u05E6\u05D9\u05D1\u05D5\u05E8\u05D9.", "A sample's source, public."),
|
|
21419
21580
|
n("api-device", "server", "/api/cli/device/*", "\u05DB\u05E0\u05D9\u05E1\u05D4 \u05D1\u05DE\u05DB\u05E9\u05D9\u05E8: \u05E7\u05D5\u05D3, \u05D0\u05D9\u05E9\u05D5\u05E8 \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF, \u05D8\u05D5\u05E7\u05DF.", "Device login: a code, approval in the browser, a token."),
|
|
21420
21581
|
n("api-projects", "server", "/api/cli/projects", "\u05D4\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05DC \u05D4\u05D7\u05E9\u05D1\u05D5\u05DF, \u05D5\u05D9\u05E6\u05D9\u05E8\u05EA \u05D0\u05EA\u05E8.", "The account's sites, and making one."),
|
|
@@ -21433,6 +21594,7 @@ var CLI_MAP_NODES = [
|
|
|
21433
21594
|
n("text-start-blank", "agent", "site.start-blank", "\u05D1\u05D5\u05E0\u05D9\u05DD \u05D0\u05EA\u05E8 \u05D1\u05DC\u05D9 \u05D3\u05D5\u05D2\u05DE\u05D4.", "Build a site with no sample."),
|
|
21434
21595
|
n("text-details", "agent", "site.details / site.ask-details", "\u05E7\u05D5\u05E8\u05D0\u05D9\u05DD \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05DE .deployai/brief.md, \u05D0\u05D5 \u05E9\u05D5\u05D0\u05DC\u05D9\u05DD \u05D0\u05EA \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8.", "Read the details from .deployai/brief.md, or ask the owner."),
|
|
21435
21596
|
n("text-update", "agent", "site.update", "\u05E2\u05D5\u05E9\u05D9\u05DD \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9 \u05E9\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D1\u05D9\u05E7\u05E9.", "Make the change the owner asked for."),
|
|
21597
|
+
n("text-migrate", "agent", "site.migrate", "\u05D1\u05D5\u05E0\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9 \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8 \u05D4\u05D9\u05E9\u05DF \u05E2\u05DC \u05D4\u05D3\u05D5\u05D2\u05DE\u05D4, \u05E9\u05D5\u05DE\u05E8\u05D9\u05DD \u05DB\u05DC \u05DB\u05EA\u05D5\u05D1\u05EA \u05D5\u05DB\u05D5\u05EA\u05E8\u05EA, \u05EA\u05D5\u05DB\u05E0\u05D9\u05EA \u05E2\u05DD \u05E1\u05D8\u05D8\u05D5\u05E1 \u05DC\u05DB\u05DC \u05D9\u05DB\u05D5\u05DC\u05EA.", "Rebuild the old site on the sample, keep every address and title, a plan with a status for each feature."),
|
|
21436
21598
|
n("text-move", "agent", "site.move", "\u05DE\u05E2\u05D1\u05D9\u05E8\u05D9\u05DD \u05D0\u05EA\u05E8 \u05E7\u05D9\u05D9\u05DD \u05D1\u05DC\u05D9 \u05DC\u05E9\u05E0\u05D5\u05EA \u05D0\u05EA \u05D4\u05E2\u05D9\u05E6\u05D5\u05D1 \u05D0\u05D5 \u05D4\u05DE\u05E1\u05D2\u05E8\u05EA.", "Move an existing site without changing its design or framework."),
|
|
21437
21599
|
n("text-guest", "agent", "site.guest / site.guest-sample", "\u05D0\u05EA\u05E8 \u05D6\u05DE\u05E0\u05D9: \u05D4\u05DE\u05D2\u05D1\u05DC\u05D5\u05EA, \u05D5\u05DE\u05D4 \u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05EA \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8.", "A temporary site: the limits, and what to ask the owner."),
|
|
21438
21600
|
n("text-addons", "agent", "core.workflow-frame", "\u05D4\u05DE\u05E1\u05D2\u05E8\u05EA \u05E9\u05DC \u05DB\u05DC \u05EA\u05D5\u05E1\u05E3. \u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E2\u05E6\u05DE\u05DD \u05D1\u05E2\u05DE\u05D5\u05D3 \u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD.", "The frame of every add-on. The add-ons themselves are on the marketplace page.")
|
|
@@ -21457,6 +21619,8 @@ var CLI_MAP_EDGES = [
|
|
|
21457
21619
|
e("cmd-whoami", "api-device"),
|
|
21458
21620
|
e("cmd-link", "api-projects"),
|
|
21459
21621
|
e("cmd-deploy", "api-deploy"),
|
|
21622
|
+
e("cmd-deploy", "api-status"),
|
|
21623
|
+
e("cmd-deploy", "api-promote"),
|
|
21460
21624
|
e("cmd-guest", "api-guest"),
|
|
21461
21625
|
e("cmd-claim", "api-guest-email"),
|
|
21462
21626
|
e("cmd-pull", "api-source"),
|
|
@@ -21465,7 +21629,16 @@ var CLI_MAP_EDGES = [
|
|
|
21465
21629
|
e("cmd-status", "api-status"),
|
|
21466
21630
|
e("cmd-versions", "api-status"),
|
|
21467
21631
|
e("cmd-promote", "api-promote"),
|
|
21632
|
+
e("cmd-promote", "api-sql"),
|
|
21633
|
+
e("cmd-sql", "api-sql"),
|
|
21634
|
+
e("cmd-deploy", "api-sql"),
|
|
21468
21635
|
e("cmd-rollback", "api-promote"),
|
|
21636
|
+
e("page-move-url", "cmd-start"),
|
|
21637
|
+
e("cmd-start", "text-migrate"),
|
|
21638
|
+
e("cmd-start", "cmd-migrate"),
|
|
21639
|
+
e("cmd-blocks", "api-blocks"),
|
|
21640
|
+
e("cmd-link", "api-migrate-grant"),
|
|
21641
|
+
e("cmd-migrate", "api-migrate-progress"),
|
|
21469
21642
|
e("cmd-addons", "api-addons"),
|
|
21470
21643
|
e("cmd-addon-run", "api-addons"),
|
|
21471
21644
|
e("cmd-addons", "text-addons"),
|
|
@@ -21552,6 +21725,11 @@ var ENV_KEYS = {
|
|
|
21552
21725
|
CF_REGISTRAR_TOKEN: { scope: "server", section: "cloudflare", about: "Buys real domains (D-300): a Cloudflare token with Registrar edit only. Server only." },
|
|
21553
21726
|
LIVEDNS_USER: { scope: "server", section: "cloudflare", about: "Buys real Israeli domains at LiveDNS (D-458): the API user of our LiveDNS partner account. Server only: LiveDNS refuses some networks, and it spends prepaid credit." },
|
|
21554
21727
|
LIVEDNS_PASSWORD: { scope: "server", section: "cloudflare", about: "Its password, sent in every LiveDNS call; never logged. Server only." },
|
|
21728
|
+
GOOGLE_RESELLER_KEY: { scope: "own", section: "email", about: "Sells Google Workspace mailboxes (D-547; not connected until the reseller contract is signed): the service account JSON of our reseller project, delegated to GOOGLE_RESELLER_ADMIN. The laptop uses the reseller sandbox, the server the real account." },
|
|
21729
|
+
GOOGLE_RESELLER_ADMIN: { scope: "own", section: "email", about: "The reseller admin user the service account acts as (D-547)." },
|
|
21730
|
+
ZOHO_PARTNER_CLIENT_ID: { scope: "own", section: "email", about: "Sells Zoho Mail mailboxes (D-547; not connected until the partner account exists): the API client of our Zoho partner account." },
|
|
21731
|
+
ZOHO_PARTNER_CLIENT_SECRET: { scope: "own", section: "email", about: "Its secret (D-547)." },
|
|
21732
|
+
ZOHO_PARTNER_REFRESH_TOKEN: { scope: "own", section: "email", about: "The long lived token the partner API calls are signed with (D-547)." },
|
|
21555
21733
|
ADMIN_GEO_MANAGE: { scope: "server", section: "cloudflare", about: "1 lets the superadmin change the admin-geo rule on Admin, Server, Security (temporary, D-455); CF_API_TOKEN needs Zone WAF Edit. Off or unset: the card only shows it. The rule stays in Cloudflare either way." },
|
|
21556
21734
|
DISPATCH_RATE_LIMIT_GUEST: { scope: "same", section: "cloudflare", about: "pnpm dispatch:deploy: requests per IP per period on a temporary site (D-087, D-238)." },
|
|
21557
21735
|
DISPATCH_RATE_LIMIT_FREE: { scope: "same", section: "cloudflare", about: "The same on a site on a free plan." },
|
|
@@ -21695,6 +21873,162 @@ var KEEP_DATA_RULES = [
|
|
|
21695
21873
|
];
|
|
21696
21874
|
var AGENT_POINTER = "Read DEPLOYAI.md before you write code, change the plan or add a dependency: this project is published with DeployAI.";
|
|
21697
21875
|
|
|
21876
|
+
// ../shared/src/stack.ts
|
|
21877
|
+
var SITE_LANG_INFO = {
|
|
21878
|
+
he: { name: "Hebrew", dir: "rtl", font: "Heebo" },
|
|
21879
|
+
ar: { name: "Arabic", dir: "rtl", font: "Tajawal" },
|
|
21880
|
+
en: { name: "English", dir: "ltr", font: "Inter" }
|
|
21881
|
+
};
|
|
21882
|
+
var STACK_FRAMEWORKS = SUPPORTED_FRAMEWORKS.map((f) => f.id);
|
|
21883
|
+
var frameworkName = (id) => FRAMEWORKS.find((f) => f.id === id)?.name ?? id;
|
|
21884
|
+
var NEED_TEXT = {
|
|
21885
|
+
form: "a contact form whose messages are saved to D1, with an owner inbox behind a key from env",
|
|
21886
|
+
login: "an owner login (the account is created on the first visit, passwords with bcryptjs or Web Crypto)",
|
|
21887
|
+
data: "data the owner adds and edits, saved to D1",
|
|
21888
|
+
files: "photos and files the owner uploads, saved to R2"
|
|
21889
|
+
};
|
|
21890
|
+
function stackBlock(s) {
|
|
21891
|
+
const langs = s.langs.map((l, i) => `${SITE_LANG_INFO[l].name} (${SITE_LANG_INFO[l].dir === "rtl" ? "right to left" : "left to right"}${i === 0 ? ", the main language at the root" : `, under /${l}/`})`);
|
|
21892
|
+
const fonts = s.fonts.map((f) => `${f} (${s.langs.filter((l) => l === "en" && f === "Heebo" || SITE_LANG_INFO[l].font === f).map((l) => SITE_LANG_INFO[l].name).join(" and ")})`);
|
|
21893
|
+
const lines = [
|
|
21894
|
+
"# The stack",
|
|
21895
|
+
"",
|
|
21896
|
+
"The owner chose this on DeployAI. Build with exactly this stack: do not add a server, a database, a storage service, a CSS framework or a font outside it.",
|
|
21897
|
+
"",
|
|
21898
|
+
`- Framework: ${frameworkName(s.framework)}${s.framework === "static" ? " (HTML, CSS and a little JavaScript, no build step)" : ""}`,
|
|
21899
|
+
`- Languages: ${langs.join(", ")}.${s.langs.length > 1 ? " Every page and every string in each language, a language switch to the same page, and hreflang." : ""}`,
|
|
21900
|
+
`- Fonts: ${fonts.join(", ")}, from Google Fonts.`,
|
|
21901
|
+
`- CSS: ${s.css === "tailwind" ? "Tailwind CSS" : "plain CSS"}.`,
|
|
21902
|
+
`- Database: ${s.bindings.includes("d1") ? "Cloudflare D1 (SQLite) through Drizzle with drizzle-orm/d1." : "none."}`,
|
|
21903
|
+
`- Files: ${s.bindings.includes("r2") ? "Cloudflare R2, never the local disk." : "none."}`
|
|
21904
|
+
];
|
|
21905
|
+
if (s.needs.length) lines.push(`- The site has: ${s.needs.map((n2) => NEED_TEXT[n2]).join("; ")}.`);
|
|
21906
|
+
return lines.join("\n") + "\n";
|
|
21907
|
+
}
|
|
21908
|
+
function stackSummary(s) {
|
|
21909
|
+
return [frameworkName(s.framework), ...s.bindings.map((b) => b.toUpperCase()), s.css === "tailwind" ? "Tailwind" : null, s.fonts.join(", "), s.dir.toUpperCase()].filter(Boolean).join(" \xB7 ");
|
|
21910
|
+
}
|
|
21911
|
+
|
|
21912
|
+
// ../shared/src/ui-sources.ts
|
|
21913
|
+
var UI_SOURCES = [
|
|
21914
|
+
{ key: "shadcn", name: "shadcn/ui", url: "https://ui.shadcn.com", install: "npx shadcn@latest add <component>", license: "MIT", terms: "Free for any use; keep the license notice.", use: "Forms, dialogs, menus, tabs, tables: the plain building blocks.", frameworks: "React (Astro with the React integration)", checkedOn: "2026-10-30" },
|
|
21915
|
+
{ key: "magicui", name: "Magic UI", url: "https://magicui.design", install: 'npx shadcn@latest add "https://magicui.design/r/<component>.json"', license: "MIT", terms: "Free components only (not Magic UI Pro); keep the license notice.", use: "Marketing sections: animated backgrounds, marquees, number tickers, bento grids.", frameworks: "React", checkedOn: "2026-10-30" },
|
|
21916
|
+
{ key: "aceternity", name: "Aceternity UI", url: "https://ui.aceternity.com", install: 'npx shadcn@latest add "https://ui.aceternity.com/registry/<component>.json"', license: "Aceternity licence", terms: "Free components only (not Pro or templates). Allowed in the owner's own site; never publish the component source on its own or sell it as a template.", use: "Hero effects: spotlight, background beams, cards with motion, scroll effects.", frameworks: "React", checkedOn: "2026-10-30" },
|
|
21917
|
+
{ key: "reactbits", name: "React Bits", url: "https://reactbits.dev", install: "Copy the component from its page (or its shadcn registry line on that page)", license: "MIT + Commons Clause", terms: "Allowed as part of a website; never sell the components themselves.", use: "Text animations, backgrounds, small interactive effects.", frameworks: "React", checkedOn: "2026-10-30" },
|
|
21918
|
+
{ key: "embla", name: "Embla Carousel", url: "https://www.embla-carousel.com", install: "npm install embla-carousel", license: "MIT", terms: "Free for any use.", use: "Sliders and carousels, with plain JavaScript in any framework.", frameworks: "Any (plain JS, React, Vue, Svelte)", checkedOn: "2026-10-30" },
|
|
21919
|
+
{ key: "swiper", name: "Swiper", url: "https://swiperjs.com", install: "npm install swiper", license: "MIT", terms: "Free for any use.", use: "Galleries and touch sliders, like many WordPress themes use.", frameworks: "Any (plain JS, React, Vue)", checkedOn: "2026-10-30" },
|
|
21920
|
+
{ key: "motion", name: "Motion", url: "https://motion.dev", install: "npm install motion", license: "MIT", terms: "The free library only (not Motion+).", use: "Animations on scroll and on enter, in plain JS or React.", frameworks: "Any (plain JS, React, Vue)", checkedOn: "2026-10-30" }
|
|
21921
|
+
];
|
|
21922
|
+
function uiSourcesText() {
|
|
21923
|
+
return [
|
|
21924
|
+
"UI sources you may use for visual sections (install each from its own place, never copy from elsewhere; free tiers only; add a line per component to .deployai/migration/credits.md with its source, URL and license):",
|
|
21925
|
+
...UI_SOURCES.map((s) => `- ${s.name} (${s.url}, ${s.license}; ${s.frameworks}): ${s.use} Install: ${s.install}. ${s.terms}`),
|
|
21926
|
+
"React components need React in the site: in an Astro site, add it with npx astro add react and use them as islands only where they move or react; keep the rest plain Astro."
|
|
21927
|
+
].join("\n");
|
|
21928
|
+
}
|
|
21929
|
+
|
|
21930
|
+
// ../shared/src/migration.ts
|
|
21931
|
+
function normalizeSourceUrl(raw) {
|
|
21932
|
+
const text = raw.trim();
|
|
21933
|
+
if (!text || text.length > 300) return null;
|
|
21934
|
+
let u;
|
|
21935
|
+
try {
|
|
21936
|
+
u = new URL(/^https?:\/\//i.test(text) ? text : `https://${text}`);
|
|
21937
|
+
} catch {
|
|
21938
|
+
return null;
|
|
21939
|
+
}
|
|
21940
|
+
if (u.protocol !== "https:" && u.protocol !== "http:") return null;
|
|
21941
|
+
if (u.username || u.password || !u.hostname.includes(".")) return null;
|
|
21942
|
+
u.hash = "";
|
|
21943
|
+
return u.pathname === "/" && !u.search ? u.origin : u.toString();
|
|
21944
|
+
}
|
|
21945
|
+
function parseSitemapXml(xml) {
|
|
21946
|
+
const locs = (block) => [...block.matchAll(/<loc>\s*([\s\S]*?)\s*<\/loc>/gi)].map((m) => decode3(m[1].replace(/^<!\[CDATA\[|\]\]>$/g, "")).trim()).filter(Boolean);
|
|
21947
|
+
const sitemaps = [...xml.matchAll(/<sitemap\b[^>]*>([\s\S]*?)<\/sitemap>/gi)].flatMap((m) => locs(m[1]));
|
|
21948
|
+
const urls = [...xml.matchAll(/<url\b[^>]*>([\s\S]*?)<\/url>/gi)].flatMap((m) => locs(m[1]));
|
|
21949
|
+
return { urls, sitemaps };
|
|
21950
|
+
}
|
|
21951
|
+
function detectPlatform(html, headers = {}) {
|
|
21952
|
+
const h = Object.fromEntries(Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v.toLowerCase()]));
|
|
21953
|
+
const gen = (html.match(/<meta[^>]+name=["']generator["'][^>]*content=["']([^"']+)/i)?.[1] ?? "").toLowerCase();
|
|
21954
|
+
if (gen.includes("wordpress") || /\/wp-(content|includes)\//i.test(html) || (h.link ?? "").includes("wp-json")) return "wordpress";
|
|
21955
|
+
if (gen.includes("wix") || h["x-wix-request-id"] || /static\.wixstatic\.com/i.test(html)) return "wix";
|
|
21956
|
+
if (gen.includes("squarespace") || /static1\.squarespace\.com/i.test(html)) return "squarespace";
|
|
21957
|
+
if (gen.includes("webflow") || /data-wf-(page|site)=/i.test(html)) return "webflow";
|
|
21958
|
+
if (/<script[^>]+src=["'][^"']*\/(_next|assets|_astro|_nuxt)\//i.test(html)) return "code";
|
|
21959
|
+
return "other";
|
|
21960
|
+
}
|
|
21961
|
+
function pathOf(url2) {
|
|
21962
|
+
const u = new URL(url2);
|
|
21963
|
+
return u.pathname + u.search;
|
|
21964
|
+
}
|
|
21965
|
+
function comparePage(old, next, allowedRedirect) {
|
|
21966
|
+
if (!next || next.status === 404 || next.status === 410) return { path: old.path, problem: "missing" };
|
|
21967
|
+
if (next.status >= 400) return { path: old.path, problem: "error", detail: String(next.status) };
|
|
21968
|
+
if (next.finalPath !== old.path) {
|
|
21969
|
+
if (allowedRedirect && allowedRedirect === next.finalPath) return null;
|
|
21970
|
+
return { path: old.path, problem: "moved", detail: next.finalPath };
|
|
21971
|
+
}
|
|
21972
|
+
if (old.title && !next.title) return { path: old.path, problem: "title_lost" };
|
|
21973
|
+
if (old.description && !next.description) return { path: old.path, problem: "description_lost" };
|
|
21974
|
+
return null;
|
|
21975
|
+
}
|
|
21976
|
+
var plain = (html) => decode3((html ?? "").replace(/<[^>]*>/g, " ")).replace(/\s+/g, " ").trim();
|
|
21977
|
+
var yamlStr = (s) => JSON.stringify(s);
|
|
21978
|
+
var safeSlug = (s) => {
|
|
21979
|
+
try {
|
|
21980
|
+
return decodeURIComponent(s ?? "");
|
|
21981
|
+
} catch {
|
|
21982
|
+
return s ?? "";
|
|
21983
|
+
}
|
|
21984
|
+
};
|
|
21985
|
+
function wpPostsToMarkdown(input2) {
|
|
21986
|
+
const host = new URL(input2.origin).hostname.replace(/^www\./, "");
|
|
21987
|
+
const byId = (list = []) => new Map(list.map((x) => [x.id, x]));
|
|
21988
|
+
const cats = byId(input2.categories);
|
|
21989
|
+
const tags2 = byId(input2.tags);
|
|
21990
|
+
const users = byId(input2.users);
|
|
21991
|
+
const media = byId(input2.media);
|
|
21992
|
+
const sameHost = new RegExp(`https?://(?:www\\.)?${host.replace(/\./g, "\\.")}(?=/)`, "gi");
|
|
21993
|
+
const termList = (ids, map2) => (ids ?? []).map((id) => map2.get(id)).filter((t) => Boolean(t?.slug)).map((t) => ` - { slug: ${yamlStr(safeSlug(t.slug))}, name: ${yamlStr(decode3(t.name ?? t.slug ?? ""))} }`);
|
|
21994
|
+
const used = /* @__PURE__ */ new Set();
|
|
21995
|
+
return input2.posts.filter((p) => !p.status || p.status === "publish").map((p) => {
|
|
21996
|
+
let path = "/";
|
|
21997
|
+
try {
|
|
21998
|
+
path = safeSlug(new URL(p.link ?? "").pathname);
|
|
21999
|
+
} catch {
|
|
22000
|
+
path = `/blog/${safeSlug(p.slug)}/`;
|
|
22001
|
+
}
|
|
22002
|
+
const image = p.featured_media ? media.get(p.featured_media) : void 0;
|
|
22003
|
+
const c = termList(p.categories, cats);
|
|
22004
|
+
const t = termList(p.tags, tags2);
|
|
22005
|
+
const front = [
|
|
22006
|
+
"---",
|
|
22007
|
+
`title: ${yamlStr(plain(p.title?.rendered))}`,
|
|
22008
|
+
`description: ${yamlStr(plain(p.excerpt?.rendered).replace(/\s*(\[…\]|\[…\]|…)$/, "").slice(0, 300))}`,
|
|
22009
|
+
`date: ${yamlStr(p.date ?? "")}`,
|
|
22010
|
+
...p.modified && p.modified !== p.date ? [`updated: ${yamlStr(p.modified)}`] : [],
|
|
22011
|
+
...p.author && users.get(p.author)?.name ? [`author: ${yamlStr(users.get(p.author).name)}`] : [],
|
|
22012
|
+
c.length ? `categories:
|
|
22013
|
+
${c.join("\n")}` : "categories: []",
|
|
22014
|
+
t.length ? `tags:
|
|
22015
|
+
${t.join("\n")}` : "tags: []",
|
|
22016
|
+
...image?.source_url ? [`image: ${yamlStr(image.source_url.replace(sameHost, ""))}`, ...image.alt_text ? [`imageAlt: ${yamlStr(image.alt_text)}`] : []] : [],
|
|
22017
|
+
`path: ${yamlStr(path)}`,
|
|
22018
|
+
"---",
|
|
22019
|
+
""
|
|
22020
|
+
].join("\n");
|
|
22021
|
+
const base = (safeSlug(p.slug) || `post-${p.id}`).replace(/[^\p{L}\p{N}-]+/gu, "-").slice(0, 80) || `post-${p.id}`;
|
|
22022
|
+
const file2 = used.has(base) ? `${base}-${p.id}.md` : `${base}.md`;
|
|
22023
|
+
used.add(base);
|
|
22024
|
+
return { file: file2, text: front + (p.content?.rendered ?? "").replace(sameHost, "").trim() + "\n" };
|
|
22025
|
+
});
|
|
22026
|
+
}
|
|
22027
|
+
var AGENT_STAGES = ["scanning", "building", "preview_ready", "customer_review", "live", "blocked"];
|
|
22028
|
+
var STAGE_NOTE_MAX = 300;
|
|
22029
|
+
var isAgentStage = (s) => AGENT_STAGES.includes(s);
|
|
22030
|
+
var stageNote = (s) => (s ?? "").replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim().slice(0, STAGE_NOTE_MAX);
|
|
22031
|
+
|
|
21698
22032
|
// src/config.ts
|
|
21699
22033
|
import { randomUUID } from "crypto";
|
|
21700
22034
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -21844,6 +22178,9 @@ var M = {
|
|
|
21844
22178
|
startLinked: 'Linked this folder to the site "{name}".',
|
|
21845
22179
|
startRules: "Wrote the rules for your agent to DEPLOYAI.md (never uploaded).",
|
|
21846
22180
|
startStarter: "Wrote a starter page (index.html) to build the site on.",
|
|
22181
|
+
startStack: "Saved the stack chosen on the site: {stack}.",
|
|
22182
|
+
startScanned: "Scanned the old site {url}: its pages, images and content are in {dir}.",
|
|
22183
|
+
stackDiffers: "Note: the stack chosen on the site is {chosen}, but this folder is {found}. Keep to the chosen stack, or tell the owner why it changed.",
|
|
21847
22184
|
startRelinked: 'Linked this folder to the site "{name}" instead of the site it was linked to.',
|
|
21848
22185
|
statusLine: "Status: {s}",
|
|
21849
22186
|
ready: "ready",
|
|
@@ -21857,6 +22194,9 @@ var M = {
|
|
|
21857
22194
|
pasteFix: " Paste the prompt below into your AI editor, then run: npx deployai@latest check",
|
|
21858
22195
|
copied: " (copied to clipboard)",
|
|
21859
22196
|
runDeploy: ' Run: npx deployai@latest deploy -m "<message>"',
|
|
22197
|
+
moveOfferGranted: "Moved from /move: the site got {n} add-ons free. Run them all with: npx deployai@latest addons run",
|
|
22198
|
+
moveOfferCap: "The free add-ons for moved sites were already used on 3 sites of this account.",
|
|
22199
|
+
moveOfferOver: "The free add-ons offer for moved sites is over.",
|
|
21860
22200
|
initHint: " So your agent follows the DeployAI rules, run: npx deployai@latest init",
|
|
21861
22201
|
emptyFolder: "Nothing to check yet: this folder has no site. Build the site here, then run: npx deployai@latest check",
|
|
21862
22202
|
deployTitle: "DeployAI deploy",
|
|
@@ -21885,6 +22225,8 @@ var M = {
|
|
|
21885
22225
|
guestClaim: "Open the claim link to keep the site (sign up or log in).",
|
|
21886
22226
|
claimLink: "Keep link of this temporary site: {url}",
|
|
21887
22227
|
pulled: "Downloaded the code of version v{v}: {n} files.",
|
|
22228
|
+
pulledHistory: "Downloaded the history: {n} versions as git commits, up to the live version v{v}.",
|
|
22229
|
+
pullNoGit: "The history needs git on this computer. Install it from https://git-scm.com, or run pull without --history.",
|
|
21888
22230
|
pullNotLinked: "This folder is not linked to a site. Copy the line again from the site page on DeployAI.",
|
|
21889
22231
|
pullNotEmpty: "This folder already has files, so nothing was downloaded. Use an empty folder.",
|
|
21890
22232
|
pullNoSource: "This site has no version to download yet.",
|
|
@@ -21903,6 +22245,13 @@ var M = {
|
|
|
21903
22245
|
promoteReady: " After the owner approves the preview: npx deployai@latest promote v{n} (to put it live)",
|
|
21904
22246
|
askOwner: ' Version {n} is ready and not live. Ask the owner: "Version {n} is ready. Do you want to put it live?"',
|
|
21905
22247
|
showPreview: " Send them the preview first: {url}",
|
|
22248
|
+
askLiveFirst: "Put it live as soon as the build is done? No shows you the preview first. (y/N) ",
|
|
22249
|
+
askLiveNow: "Put v{n} live now? (y/N) ",
|
|
22250
|
+
waitBuild: "Waiting for the build of v{n}. Ctrl+C stops the waiting, not the build.",
|
|
22251
|
+
waitState: " v{n}: {s}",
|
|
22252
|
+
buildSlow: "The build of v{n} is taking longer than usual.",
|
|
22253
|
+
liveNow: "v{n} is live: {url}",
|
|
22254
|
+
promoteLater: " To put it live later: npx deployai@latest promote v{n}",
|
|
21906
22255
|
notPublished: "not published yet",
|
|
21907
22256
|
none: "none",
|
|
21908
22257
|
buildingNow: "building now",
|
|
@@ -21992,7 +22341,31 @@ var M = {
|
|
|
21992
22341
|
guestClaimFirst: "This folder holds a temporary site, and you are logged in. Claim the site to your account first: {url}",
|
|
21993
22342
|
guestClaimFirstNoLink: "This folder holds a temporary site, and you are logged in. Claim it to your account first with the claim link deploy --guest printed.",
|
|
21994
22343
|
guestAccountSite: "This folder belongs to a site in an account, so it cannot go up as a temporary site. Run: npx deployai@latest login, then: npx deployai@latest deploy",
|
|
21995
|
-
sqlWaitingLine: "Database changes (SQL) wait for
|
|
22344
|
+
sqlWaitingLine: "Database changes (SQL) wait for the owner's yes before v{n} goes live. See them: npx deployai@latest sql v{n}",
|
|
22345
|
+
sqlTitle: "v{n} changes the database {db}:",
|
|
22346
|
+
sqlNewDatabase: " A new database: it is created, and seed.sql runs too.",
|
|
22347
|
+
sqlStatements: "{n} statements",
|
|
22348
|
+
sqlSkipped: "skipped (seed on a database that has data)",
|
|
22349
|
+
sqlDestructive: "These remove or overwrite data, and a rollback does not bring it back:",
|
|
22350
|
+
sqlRunningNow: "The database changes of v{n} are already running. It goes live when they finish.",
|
|
22351
|
+
sqlRunningNowShort: "The database changes are already running. The version goes live when they finish: {url}",
|
|
22352
|
+
sqlOwnerOnly: "Only the site owner approves database changes. Send them this page: {url}",
|
|
22353
|
+
sqlDashboard: "These database changes are sorted out in the dashboard: {url}",
|
|
22354
|
+
sqlTypeDatabase: "To run them and put v{n} live, type the database name ({db}): ",
|
|
22355
|
+
sqlAskRun: "Run them on {db} and put v{n} live? (y/N) ",
|
|
22356
|
+
sqlNotRun: "Not run. Nothing changed.",
|
|
22357
|
+
sqlAgentDestructive: " These changes remove or overwrite data, so only the owner approves them: at their own terminal (npx deployai@latest promote v{n}) or here: {url}",
|
|
22358
|
+
sqlChanged: "The database changes of v{n} changed since they were shown. Run npx deployai@latest sql v{n}, show the owner again, and ask again.",
|
|
22359
|
+
sqlChangedServer: "The database changes changed since they were shown. Show them again and ask again: {url}",
|
|
22360
|
+
sqlConfirmServer: "These changes remove or overwrite data, so they are approved only at the owner's terminal or in the dashboard: {url}",
|
|
22361
|
+
sqlAgentAsk: ' Show the owner the changes above and ask: "Version {n} changes the database {db}. Run the changes and put it live?"',
|
|
22362
|
+
sqlAgentThen: " After a yes: npx deployai@latest promote v{n} --approve-sql {hash}",
|
|
22363
|
+
sqlNone: "v{n} has no new database changes.",
|
|
22364
|
+
sqlFirst: "The database changes run first. If they fail, the live version stays.",
|
|
22365
|
+
sqlFailed: "The database changes of v{n} failed. The live version stayed.",
|
|
22366
|
+
sqlRetry: " After a fix, deploy again, or try again: npx deployai@latest promote v{n}",
|
|
22367
|
+
sqlRunningState: "running the database changes",
|
|
22368
|
+
sqlBeforeUpload: "This upload has SQL files. New database changes run only after a yes, once the build is done.",
|
|
21996
22369
|
sqlWaiting: "This version has database changes (SQL) that have not run yet. Approve them in the dashboard first, then promote again: {url}",
|
|
21997
22370
|
tokenOtherApi: "The login on this computer is for {saved}, not {url}. Run: npx deployai@latest login --api {url}, or drop --api and DEPLOYAI_API_URL.",
|
|
21998
22371
|
linkConfirm: "Link this folder to {name} ({address})? (y/N) ",
|
|
@@ -22020,6 +22393,9 @@ var M = {
|
|
|
22020
22393
|
startLinked: '\u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D7\u05D5\u05D1\u05E8\u05D4 \u05DC\u05D0\u05EA\u05E8 "{name}".',
|
|
22021
22394
|
startRules: "\u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DC\u05E1\u05D5\u05DB\u05DF \u05E0\u05DB\u05EA\u05D1\u05D5 \u05DC DEPLOYAI.md (\u05DC\u05D0 \u05E2\u05D5\u05DC\u05D9\u05DD \u05DC\u05D0\u05EA\u05E8).",
|
|
22022
22395
|
startStarter: "\u05E0\u05DB\u05EA\u05D1 \u05D3\u05E3 \u05E4\u05EA\u05D9\u05D7\u05D4 (index.html) \u05DC\u05D1\u05E0\u05D5\u05EA \u05E2\u05DC\u05D9\u05D5 \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8.",
|
|
22396
|
+
startStack: "\u05E0\u05E9\u05DE\u05E8 \u05D4\u05E1\u05D8\u05D0\u05E7 \u05E9\u05E0\u05D1\u05D7\u05E8 \u05D1\u05D0\u05EA\u05E8: {stack}.",
|
|
22397
|
+
startScanned: "\u05E0\u05E1\u05E8\u05E7 \u05D4\u05D0\u05EA\u05E8 \u05D4\u05D9\u05E9\u05DF {url}: \u05D4\u05D3\u05E4\u05D9\u05DD, \u05D4\u05EA\u05DE\u05D5\u05E0\u05D5\u05EA \u05D5\u05D4\u05EA\u05D5\u05DB\u05DF \u05E9\u05DC\u05D5 \u05D1 {dir}.",
|
|
22398
|
+
stackDiffers: "\u05E9\u05D9\u05DE\u05D5 \u05DC\u05D1: \u05D4\u05E1\u05D8\u05D0\u05E7 \u05E9\u05E0\u05D1\u05D7\u05E8 \u05D1\u05D0\u05EA\u05E8 \u05D4\u05D5\u05D0 {chosen}, \u05D0\u05D1\u05DC \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05D4\u05D9\u05D0 {found}. \u05D4\u05DE\u05E9\u05D9\u05DB\u05D5 \u05D1\u05E1\u05D8\u05D0\u05E7 \u05E9\u05E0\u05D1\u05D7\u05E8, \u05D0\u05D5 \u05D4\u05E1\u05D1\u05D9\u05E8\u05D5 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DC\u05DE\u05D4 \u05D4\u05D5\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4.",
|
|
22023
22399
|
startRelinked: '\u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D7\u05D5\u05D1\u05E8\u05D4 \u05DC\u05D0\u05EA\u05E8 "{name}" \u05D1\u05DE\u05E7\u05D5\u05DD \u05D4\u05D0\u05EA\u05E8 \u05E9\u05D4\u05D9\u05D9\u05EA\u05D4 \u05DE\u05D7\u05D5\u05D1\u05E8\u05EA \u05D0\u05DC\u05D9\u05D5.',
|
|
22024
22400
|
statusLine: "\u05DE\u05E6\u05D1: {s}",
|
|
22025
22401
|
ready: "\u05DE\u05D5\u05DB\u05DF \u05DC\u05E2\u05DC\u05D5\u05EA",
|
|
@@ -22033,6 +22409,9 @@ var M = {
|
|
|
22033
22409
|
pasteFix: " \u05D4\u05D3\u05D1\u05D9\u05E7\u05D5 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D5\u05DE\u05E4\u05D8 \u05E9\u05DC\u05DE\u05D8\u05D4 \u05DC\u05E1\u05D5\u05DB\u05DF, \u05D5\u05D0\u05D6 \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest check",
|
|
22034
22410
|
copied: " (\u05D4\u05D5\u05E2\u05EA\u05E7)",
|
|
22035
22411
|
runDeploy: ' \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest deploy -m "<message>"',
|
|
22412
|
+
moveOfferGranted: "\u05D4\u05D0\u05EA\u05E8 \u05E2\u05D1\u05E8 \u05DE /move \u05D5\u05E7\u05D9\u05D1\u05DC {n} \u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D1\u05D7\u05D9\u05E0\u05DD. \u05DE\u05E8\u05D9\u05E6\u05D9\u05DD \u05D0\u05EA \u05DB\u05D5\u05DC\u05DD \u05E2\u05DD: npx deployai@latest addons run",
|
|
22413
|
+
moveOfferCap: "\u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D4\u05D7\u05D9\u05E0\u05DE\u05D9\u05D9\u05DD \u05DC\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05E2\u05D1\u05E8\u05D5 \u05DB\u05D1\u05E8 \u05E0\u05D5\u05E6\u05DC\u05D5 \u05D1 3 \u05D0\u05EA\u05E8\u05D9\u05DD \u05D1\u05D7\u05E9\u05D1\u05D5\u05DF \u05D4\u05D6\u05D4.",
|
|
22414
|
+
moveOfferOver: "\u05DE\u05D1\u05E6\u05E2 \u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D4\u05D7\u05D9\u05E0\u05DE\u05D9\u05D9\u05DD \u05DC\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05E2\u05D1\u05E8\u05D5 \u05D4\u05E1\u05EA\u05D9\u05D9\u05DD.",
|
|
22036
22415
|
initHint: " \u05DB\u05D3\u05D9 \u05E9\u05D4\u05E1\u05D5\u05DB\u05DF \u05D9\u05E2\u05D1\u05D5\u05D3 \u05DC\u05E4\u05D9 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC DeployAI, \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest init",
|
|
22037
22416
|
emptyFolder: "\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D4 \u05DC\u05D1\u05D3\u05D5\u05E7: \u05D0\u05D9\u05DF \u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05D0\u05EA\u05E8. \u05D1\u05E0\u05D5 \u05DB\u05D0\u05DF \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8, \u05D5\u05D0\u05D6 \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest check",
|
|
22038
22417
|
deployTitle: "DeployAI deploy",
|
|
@@ -22061,6 +22440,8 @@ var M = {
|
|
|
22061
22440
|
guestClaim: "\u05E4\u05EA\u05D7\u05D5 \u05D0\u05EA \u05E7\u05D9\u05E9\u05D5\u05E8 \u05D4\u05E9\u05DE\u05D9\u05E8\u05D4 \u05DB\u05D3\u05D9 \u05DC\u05E9\u05DE\u05D5\u05E8 \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8 (\u05D4\u05E8\u05E9\u05DE\u05D4 \u05D0\u05D5 \u05DB\u05E0\u05D9\u05E1\u05D4).",
|
|
22062
22441
|
claimLink: "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D4\u05E9\u05DE\u05D9\u05E8\u05D4 \u05E9\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D4\u05D6\u05DE\u05E0\u05D9: {url}",
|
|
22063
22442
|
pulled: "\u05D4\u05D5\u05E8\u05D3\u05E0\u05D5 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D3 \u05E9\u05DC \u05D2\u05E8\u05E1\u05D4 v{v}: {n} \u05E7\u05D1\u05E6\u05D9\u05DD.",
|
|
22443
|
+
pulledHistory: "\u05D4\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4 \u05D9\u05E8\u05D3\u05D4: {n} \u05D2\u05E8\u05E1\u05D0\u05D5\u05EA \u05DB commits \u05D1 git, \u05E2\u05D3 \u05D4\u05D2\u05E8\u05E1\u05D4 \u05D4\u05D7\u05D9\u05D4 v{v}.",
|
|
22444
|
+
pullNoGit: "\u05DB\u05D3\u05D9 \u05DC\u05D4\u05D5\u05E8\u05D9\u05D3 \u05D0\u05EA \u05D4\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4 \u05E6\u05E8\u05D9\u05DA git \u05D1\u05DE\u05D7\u05E9\u05D1. \u05D4\u05EA\u05E7\u05D9\u05E0\u05D5 \u05D0\u05D5\u05EA\u05D5 \u05DE https://git-scm.com, \u05D0\u05D5 \u05D4\u05E8\u05D9\u05E6\u05D5 pull \u05D1\u05DC\u05D9 --history.",
|
|
22064
22445
|
pullNotLinked: "\u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05DC\u05D0 \u05DE\u05D7\u05D5\u05D1\u05E8\u05EA \u05DC\u05D0\u05EA\u05E8. \u05D4\u05E2\u05EA\u05D9\u05E7\u05D5 \u05E9\u05D5\u05D1 \u05D0\u05EA \u05D4\u05E9\u05D5\u05E8\u05D4 \u05DE\u05D3\u05E3 \u05D4\u05D0\u05EA\u05E8 \u05D1\u05BEDeployAI.",
|
|
22065
22446
|
pullNotEmpty: "\u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05DB\u05D1\u05E8 \u05D9\u05E9 \u05E7\u05D1\u05E6\u05D9\u05DD, \u05D0\u05D6 \u05DC\u05D0 \u05D4\u05D5\u05E8\u05D3\u05E0\u05D5 \u05DB\u05DC\u05D5\u05DD. \u05D4\u05E9\u05EA\u05DE\u05E9\u05D5 \u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05E8\u05D9\u05E7\u05D4.",
|
|
22066
22447
|
pullNoSource: "\u05DC\u05D0\u05EA\u05E8 \u05D4\u05D6\u05D4 \u05E2\u05D5\u05D3 \u05D0\u05D9\u05DF \u05D2\u05E8\u05E1\u05D4 \u05DC\u05D4\u05D5\u05E8\u05D9\u05D3.",
|
|
@@ -22079,6 +22460,13 @@ var M = {
|
|
|
22079
22460
|
promoteReady: " \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D0\u05D9\u05E9\u05E8 \u05D0\u05EA \u05D4\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D4\u05DE\u05E7\u05D3\u05D9\u05DE\u05D4: npx deployai@latest promote v{n} (\u05DB\u05D3\u05D9 \u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05D5\u05EA\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8)",
|
|
22080
22461
|
askOwner: ' \u05D2\u05E8\u05E1\u05D4 {n} \u05DE\u05D5\u05DB\u05E0\u05D4 \u05D5\u05E2\u05D5\u05D3 \u05DC\u05D0 \u05D1\u05D0\u05D5\u05D5\u05D9\u05E8. \u05E9\u05D0\u05DC\u05D5 \u05D0\u05EA \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8: "\u05D2\u05E8\u05E1\u05D4 {n} \u05DE\u05D5\u05DB\u05E0\u05D4. \u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05D5\u05EA\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8?"',
|
|
22081
22462
|
showPreview: " \u05E9\u05DC\u05D7\u05D5 \u05E7\u05D5\u05D3\u05DD \u05D0\u05EA \u05D4\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D4\u05DE\u05E7\u05D3\u05D9\u05DE\u05D4: {url}",
|
|
22463
|
+
askLiveFirst: "\u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05DE\u05D9\u05D3 \u05DB\u05E9\u05D4\u05D1\u05E0\u05D9\u05D9\u05D4 \u05DE\u05E1\u05EA\u05D9\u05D9\u05DE\u05EA? \u05DC\u05D0 \u05DE\u05E6\u05D9\u05D2 \u05E7\u05D5\u05D3\u05DD \u05D0\u05EA \u05D4\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D4\u05DE\u05E7\u05D3\u05D9\u05DE\u05D4. (y/N) ",
|
|
22464
|
+
askLiveNow: "\u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05EA v{n} \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E2\u05DB\u05E9\u05D9\u05D5? (y/N) ",
|
|
22465
|
+
waitBuild: "\u05DE\u05D7\u05DB\u05D9\u05DD \u05DC\u05D1\u05E0\u05D9\u05D9\u05D4 \u05E9\u05DC v{n}. Ctrl+C \u05DE\u05E4\u05E1\u05D9\u05E7 \u05D0\u05EA \u05D4\u05D4\u05DE\u05EA\u05E0\u05D4, \u05DC\u05D0 \u05D0\u05EA \u05D4\u05D1\u05E0\u05D9\u05D9\u05D4.",
|
|
22466
|
+
waitState: " v{n}: {s}",
|
|
22467
|
+
buildSlow: "\u05D4\u05D1\u05E0\u05D9\u05D9\u05D4 \u05E9\u05DC v{n} \u05DC\u05D5\u05E7\u05D7\u05EA \u05D9\u05D5\u05EA\u05E8 \u05D6\u05DE\u05DF \u05DE\u05D4\u05E8\u05D2\u05D9\u05DC.",
|
|
22468
|
+
liveNow: "v{n} \u05D1\u05D0\u05D5\u05D5\u05D9\u05E8: {url}",
|
|
22469
|
+
promoteLater: " \u05DB\u05D3\u05D9 \u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05D0\u05D7\u05E8 \u05DB\u05DA: npx deployai@latest promote v{n}",
|
|
22082
22470
|
notPublished: "\u05E2\u05D3\u05D9\u05D9\u05DF \u05DC\u05D0 \u05D1\u05D0\u05D5\u05D5\u05D9\u05E8",
|
|
22083
22471
|
none: "\u05D0\u05D9\u05DF",
|
|
22084
22472
|
buildingNow: "\u05D1\u05D5\u05E0\u05D9\u05DD \u05E2\u05DB\u05E9\u05D9\u05D5",
|
|
@@ -22168,7 +22556,31 @@ var M = {
|
|
|
22168
22556
|
guestClaimFirst: "\u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05D9\u05E9 \u05D0\u05EA\u05E8 \u05D6\u05DE\u05E0\u05D9, \u05D5\u05D0\u05EA\u05DD \u05DE\u05D7\u05D5\u05D1\u05E8\u05D9\u05DD \u05DC\u05D7\u05E9\u05D1\u05D5\u05DF. \u05E7\u05D5\u05D3\u05DD \u05E9\u05DE\u05E8\u05D5 \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8 \u05D1\u05D7\u05E9\u05D1\u05D5\u05DF: {url}",
|
|
22169
22557
|
guestClaimFirstNoLink: "\u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05D9\u05E9 \u05D0\u05EA\u05E8 \u05D6\u05DE\u05E0\u05D9, \u05D5\u05D0\u05EA\u05DD \u05DE\u05D7\u05D5\u05D1\u05E8\u05D9\u05DD \u05DC\u05D7\u05E9\u05D1\u05D5\u05DF. \u05E7\u05D5\u05D3\u05DD \u05E9\u05DE\u05E8\u05D5 \u05D0\u05D5\u05EA\u05D5 \u05D1\u05D7\u05E9\u05D1\u05D5\u05DF \u05E2\u05DD \u05E7\u05D9\u05E9\u05D5\u05E8 \u05D4\u05E9\u05DE\u05D9\u05E8\u05D4 \u05E9\u05BEdeploy --guest \u05D4\u05D3\u05E4\u05D9\u05E1.",
|
|
22170
22558
|
guestAccountSite: "\u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05E9\u05D9\u05D9\u05DB\u05EA \u05DC\u05D0\u05EA\u05E8 \u05D1\u05D7\u05E9\u05D1\u05D5\u05DF, \u05D5\u05DC\u05DB\u05DF \u05D4\u05D9\u05D0 \u05DC\u05D0 \u05D9\u05DB\u05D5\u05DC\u05D4 \u05DC\u05E2\u05DC\u05D5\u05EA \u05DB\u05D0\u05EA\u05E8 \u05D6\u05DE\u05E0\u05D9. \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest login, \u05D5\u05D0\u05D6: npx deployai@latest deploy",
|
|
22171
|
-
sqlWaitingLine: "\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD (SQL) \u05DE\u05D7\u05DB\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC\
|
|
22559
|
+
sqlWaitingLine: "\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD (SQL) \u05DE\u05D7\u05DB\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05BEv{n} \u05E2\u05D5\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8. \u05DC\u05E8\u05D0\u05D5\u05EA \u05D0\u05D5\u05EA\u05DD: npx deployai@latest sql v{n}",
|
|
22560
|
+
sqlTitle: "v{n} \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD {db}:",
|
|
22561
|
+
sqlNewDatabase: " \u05DE\u05E1\u05D3 \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05D7\u05D3\u05E9: \u05D4\u05D5\u05D0 \u05E0\u05D5\u05E6\u05E8, \u05D5\u05BEseed.sql \u05E8\u05E5 \u05D2\u05DD \u05D4\u05D5\u05D0.",
|
|
22562
|
+
sqlStatements: "{n} \u05E4\u05E7\u05D5\u05D3\u05D5\u05EA",
|
|
22563
|
+
sqlSkipped: "\u05DC\u05D0 \u05D9\u05E8\u05D5\u05E5 (seed \u05E2\u05DC \u05DE\u05E1\u05D3 \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E9\u05DB\u05D1\u05E8 \u05D9\u05E9 \u05D1\u05D5 \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD)",
|
|
22564
|
+
sqlDestructive: "\u05D0\u05DC\u05D4 \u05DE\u05D5\u05D7\u05E7\u05D9\u05DD \u05D0\u05D5 \u05D3\u05D5\u05E8\u05E1\u05D9\u05DD \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD, \u05D5\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D2\u05E8\u05E1\u05D4 \u05E7\u05D5\u05D3\u05DE\u05EA \u05DC\u05D0 \u05DE\u05D7\u05D6\u05D9\u05E8\u05D4 \u05D0\u05D5\u05EA\u05DD:",
|
|
22565
|
+
sqlRunningNow: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E9\u05DC v{n} \u05DB\u05D1\u05E8 \u05E8\u05E6\u05D9\u05DD. \u05D4\u05D9\u05D0 \u05E2\u05D5\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05DB\u05E9\u05D4\u05DD \u05DE\u05E1\u05EA\u05D9\u05D9\u05DE\u05D9\u05DD.",
|
|
22566
|
+
sqlRunningNowShort: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05DB\u05D1\u05E8 \u05E8\u05E6\u05D9\u05DD. \u05D4\u05D2\u05E8\u05E1\u05D4 \u05E2\u05D5\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05DB\u05E9\u05D4\u05DD \u05DE\u05E1\u05EA\u05D9\u05D9\u05DE\u05D9\u05DD: {url}",
|
|
22567
|
+
sqlOwnerOnly: "\u05E8\u05E7 \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DE\u05D0\u05E9\u05E8 \u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD. \u05E9\u05DC\u05D7\u05D5 \u05D0\u05EA \u05D4\u05D3\u05E3 \u05D4\u05D6\u05D4 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8: {url}",
|
|
22568
|
+
sqlDashboard: "\u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D4\u05D0\u05DC\u05D4 \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05DE\u05E1\u05D3\u05E8\u05D9\u05DD \u05D1\u05DC\u05D5\u05D7 \u05D4\u05D1\u05E7\u05E8\u05D4: {url}",
|
|
22569
|
+
sqlTypeDatabase: "\u05DB\u05D3\u05D9 \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05DD \u05D5\u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05EA v{n} \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8, \u05D4\u05E7\u05DC\u05D9\u05D3\u05D5 \u05D0\u05EA \u05E9\u05DD \u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD ({db}): ",
|
|
22570
|
+
sqlAskRun: "\u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05DD \u05E2\u05DC {db} \u05D5\u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05EA v{n} \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8? (y/N) ",
|
|
22571
|
+
sqlNotRun: "\u05DC\u05D0 \u05E8\u05E5. \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4.",
|
|
22572
|
+
sqlAgentDestructive: " \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D4\u05D0\u05DC\u05D4 \u05DE\u05D5\u05D7\u05E7\u05D9\u05DD \u05D0\u05D5 \u05D3\u05D5\u05E8\u05E1\u05D9\u05DD \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD, \u05D5\u05DC\u05DB\u05DF \u05E8\u05E7 \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DE\u05D0\u05E9\u05E8 \u05D0\u05D5\u05EA\u05DD: \u05D1\u05DE\u05E1\u05D5\u05E3 \u05E9\u05DC \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 (npx deployai@latest promote v{n}) \u05D0\u05D5 \u05DB\u05D0\u05DF: {url}",
|
|
22573
|
+
sqlChanged: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E9\u05DC v{n} \u05D4\u05E9\u05EA\u05E0\u05D5 \u05DE\u05D0\u05D6 \u05E9\u05D4\u05D5\u05E6\u05D2\u05D5. \u05D4\u05E8\u05D9\u05E6\u05D5 npx deployai@latest sql v{n}, \u05D4\u05E8\u05D0\u05D5 \u05E9\u05D5\u05D1 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D5\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D5\u05D1.",
|
|
22574
|
+
sqlChangedServer: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05D4\u05E9\u05EA\u05E0\u05D5 \u05DE\u05D0\u05D6 \u05E9\u05D4\u05D5\u05E6\u05D2\u05D5. \u05D4\u05E6\u05D9\u05D2\u05D5 \u05D0\u05D5\u05EA\u05DD \u05E9\u05D5\u05D1 \u05D5\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D5\u05D1: {url}",
|
|
22575
|
+
sqlConfirmServer: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D4\u05D0\u05DC\u05D4 \u05DE\u05D5\u05D7\u05E7\u05D9\u05DD \u05D0\u05D5 \u05D3\u05D5\u05E8\u05E1\u05D9\u05DD \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD, \u05D5\u05DC\u05DB\u05DF \u05DE\u05D0\u05E9\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DD \u05E8\u05E7 \u05D1\u05DE\u05E1\u05D5\u05E3 \u05E9\u05DC \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D0\u05D5 \u05D1\u05DC\u05D5\u05D7 \u05D4\u05D1\u05E7\u05E8\u05D4: {url}",
|
|
22576
|
+
sqlAgentAsk: ' \u05D4\u05E8\u05D0\u05D5 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05E9\u05D0\u05DC\u05D5: "\u05D2\u05E8\u05E1\u05D4 {n} \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD {db}. \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D5\u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05D5\u05EA\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8?"',
|
|
22577
|
+
sqlAgentThen: " \u05D0\u05D7\u05E8\u05D9 \u05EA\u05E9\u05D5\u05D1\u05D4 \u05D7\u05D9\u05D5\u05D1\u05D9\u05EA: npx deployai@latest promote v{n} --approve-sql {hash}",
|
|
22578
|
+
sqlNone: "\u05D1\u05BEv{n} \u05D0\u05D9\u05DF \u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D7\u05D3\u05E9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD.",
|
|
22579
|
+
sqlFirst: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E8\u05E6\u05D9\u05DD \u05E7\u05D5\u05D3\u05DD. \u05D0\u05DD \u05D4\u05DD \u05E0\u05DB\u05E9\u05DC\u05D9\u05DD, \u05D4\u05D2\u05E8\u05E1\u05D4 \u05E9\u05D1\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E0\u05E9\u05D0\u05E8\u05EA.",
|
|
22580
|
+
sqlFailed: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E9\u05DC v{n} \u05E0\u05DB\u05E9\u05DC\u05D5. \u05D4\u05D2\u05E8\u05E1\u05D4 \u05E9\u05D1\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E0\u05E9\u05D0\u05E8\u05D4.",
|
|
22581
|
+
sqlRetry: " \u05D0\u05D7\u05E8\u05D9 \u05EA\u05D9\u05E7\u05D5\u05DF, \u05D4\u05E2\u05DC\u05D5 \u05E9\u05D5\u05D1, \u05D0\u05D5 \u05E0\u05E1\u05D5 \u05E9\u05D5\u05D1: npx deployai@latest promote v{n}",
|
|
22582
|
+
sqlRunningState: "\u05DE\u05E8\u05D9\u05E5 \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD",
|
|
22583
|
+
sqlBeforeUpload: "\u05D1\u05D4\u05E2\u05DC\u05D0\u05D4 \u05D4\u05D6\u05D5 \u05D9\u05E9 \u05E7\u05D5\u05D1\u05E6\u05D9 SQL. \u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D7\u05D3\u05E9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E8\u05E6\u05D9\u05DD \u05E8\u05E7 \u05D0\u05D7\u05E8\u05D9 \u05D0\u05D9\u05E9\u05D5\u05E8, \u05DB\u05E9\u05D4\u05D1\u05E0\u05D9\u05D9\u05D4 \u05DE\u05E1\u05EA\u05D9\u05D9\u05DE\u05EA.",
|
|
22172
22584
|
sqlWaiting: "\u05D1\u05D2\u05E8\u05E1\u05D4 \u05D4\u05D6\u05D5 \u05D9\u05E9 \u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD (SQL) \u05E9\u05E2\u05D5\u05D3 \u05DC\u05D0 \u05E8\u05E6\u05D5. \u05D0\u05E9\u05E8\u05D5 \u05D0\u05D5\u05EA\u05DD \u05E7\u05D5\u05D3\u05DD \u05D1\u05DC\u05D5\u05D7 \u05D4\u05D1\u05E7\u05E8\u05D4, \u05D5\u05D0\u05D6 \u05D4\u05E2\u05DC\u05D5 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E9\u05D5\u05D1: {url}",
|
|
22173
22585
|
tokenOtherApi: "\u05D4\u05DB\u05E0\u05D9\u05E1\u05D4 \u05D1\u05DE\u05D7\u05E9\u05D1 \u05D4\u05D6\u05D4 \u05D4\u05D9\u05D0 \u05DC {saved}, \u05DC\u05D0 \u05DC {url}. \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest login --api {url}, \u05D0\u05D5 \u05D4\u05D5\u05E8\u05D9\u05D3\u05D5 \u05D0\u05EA --api \u05D5\u05D0\u05EA DEPLOYAI_API_URL.",
|
|
22174
22586
|
linkConfirm: "\u05DC\u05D7\u05D1\u05E8 \u05D0\u05EA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05DC {name} ({address})? (y/N) ",
|
|
@@ -22198,7 +22610,7 @@ function messages(root) {
|
|
|
22198
22610
|
}
|
|
22199
22611
|
|
|
22200
22612
|
// src/version.ts
|
|
22201
|
-
var CLI_VERSION = "0.1.0-beta.
|
|
22613
|
+
var CLI_VERSION = "0.1.0-beta.13";
|
|
22202
22614
|
|
|
22203
22615
|
// src/api.ts
|
|
22204
22616
|
function apiContext(apiFlag) {
|
|
@@ -22259,6 +22671,10 @@ async function apiRequest(ctx, path, schema, opts = {}) {
|
|
|
22259
22671
|
if (parsed2.success && parsed2.data.error === "sql_waiting") {
|
|
22260
22672
|
throw new CliError(t("sqlWaiting", { url: parsed2.data.url ?? `${ctx.apiUrl}/dashboard` }), 1, "sql_waiting");
|
|
22261
22673
|
}
|
|
22674
|
+
const sqlRefusals = { sql_running: "sqlRunningNowShort", sql_owner_only: "sqlOwnerOnly", sql_changed: "sqlChangedServer", sql_confirm: "sqlConfirmServer", sql_dashboard: "sqlDashboard" };
|
|
22675
|
+
if (parsed2.success && sqlRefusals[parsed2.data.error]) {
|
|
22676
|
+
throw new CliError(t(sqlRefusals[parsed2.data.error], { url: parsed2.data.url ?? `${ctx.apiUrl}/dashboard` }), 1, parsed2.data.error);
|
|
22677
|
+
}
|
|
22262
22678
|
const known = parsed2.success ? knownError(parsed2.data.error, data?.max, t, { ...data, billingUrl: `${ctx.apiUrl}/billing` }) : null;
|
|
22263
22679
|
if (known) throw new CliError(known, 1, parsed2.success ? parsed2.data.error : "api");
|
|
22264
22680
|
const msg = parsed2.success ? parsed2.data.error : `HTTP ${res.status}`;
|
|
@@ -22533,12 +22949,12 @@ function loadIgnore(root) {
|
|
|
22533
22949
|
}
|
|
22534
22950
|
}
|
|
22535
22951
|
function loadUploadIgnore(root) {
|
|
22536
|
-
let
|
|
22952
|
+
let git2 = [];
|
|
22537
22953
|
try {
|
|
22538
|
-
|
|
22954
|
+
git2 = parseIgnore(readFileSync3(join3(root, ".gitignore"), "utf8"));
|
|
22539
22955
|
} catch {
|
|
22540
22956
|
}
|
|
22541
|
-
return [...
|
|
22957
|
+
return [...git2, ...loadIgnore(root)];
|
|
22542
22958
|
}
|
|
22543
22959
|
function walkFiles(root, opts = {}) {
|
|
22544
22960
|
const result = [];
|
|
@@ -23086,6 +23502,10 @@ ${runCommandsRule()}
|
|
|
23086
23502
|
|
|
23087
23503
|
Never stop building for an account, a plan or a limit. Build what the owner asks; say once, in one plain line, what going live will need, and ask about it only at the deploy step.
|
|
23088
23504
|
|
|
23505
|
+
## When to deploy
|
|
23506
|
+
|
|
23507
|
+
${DEPLOY_ASK_RULE}
|
|
23508
|
+
|
|
23089
23509
|
## Check
|
|
23090
23510
|
|
|
23091
23511
|
Before adding a dependency or a new server feature, run: npx deployai@latest check
|
|
@@ -23360,6 +23780,11 @@ async function runCheck(root, ctx, opts = {}) {
|
|
|
23360
23780
|
printCheck(a);
|
|
23361
23781
|
out();
|
|
23362
23782
|
const t = messages(root);
|
|
23783
|
+
const chosen = project?.stack?.framework;
|
|
23784
|
+
if (chosen && a.inspect.framework.id !== chosen && a.inspect.framework.id !== "unknown") {
|
|
23785
|
+
out(t("stackDiffers", { chosen: frameworkName(chosen), found: a.inspect.framework.display }));
|
|
23786
|
+
out();
|
|
23787
|
+
}
|
|
23363
23788
|
out(t("nextStep"));
|
|
23364
23789
|
if (prompt) {
|
|
23365
23790
|
const copied = opts.clipboard !== false && copyToClipboard(prompt);
|
|
@@ -23433,21 +23858,21 @@ async function loginCommand(ctx, opts = {}) {
|
|
|
23433
23858
|
const deadline = Date.now() + start.expiresInSeconds * 1e3;
|
|
23434
23859
|
while (Date.now() < deadline) {
|
|
23435
23860
|
await sleep(intervalMs);
|
|
23436
|
-
const
|
|
23861
|
+
const poll2 = await apiRequest(ctx, "/api/cli/device/poll", DevicePollResponse, {
|
|
23437
23862
|
method: "POST",
|
|
23438
23863
|
body: { deviceCode: start.deviceCode },
|
|
23439
23864
|
auth: false
|
|
23440
23865
|
});
|
|
23441
|
-
if (
|
|
23442
|
-
if (!
|
|
23443
|
-
updateConfig({ token:
|
|
23866
|
+
if (poll2.status === "approved") {
|
|
23867
|
+
if (!poll2.token) throw new CliError(messages()("loginNoToken"), 1, "protocol");
|
|
23868
|
+
updateConfig({ token: poll2.token, email: poll2.email, apiUrl: ctx.apiUrl, tokenApiUrl: ctx.apiUrl });
|
|
23444
23869
|
out();
|
|
23445
|
-
out(
|
|
23870
|
+
out(poll2.email ? t("loggedInAs", { email: poll2.email }) : t("loggedIn"));
|
|
23446
23871
|
out(t("nextStep"));
|
|
23447
23872
|
out(opts.root && readProject(opts.root)?.projectId ? t("runDeploy") : t("runLink"));
|
|
23448
23873
|
return;
|
|
23449
23874
|
}
|
|
23450
|
-
if (
|
|
23875
|
+
if (poll2.status === "expired") break;
|
|
23451
23876
|
}
|
|
23452
23877
|
throw new CliError(t("loginExpired"), 1, "auth_expired");
|
|
23453
23878
|
}
|
|
@@ -23503,14 +23928,384 @@ function telemetryCommand(action) {
|
|
|
23503
23928
|
|
|
23504
23929
|
// src/commands/link.ts
|
|
23505
23930
|
import { createInterface } from "readline/promises";
|
|
23506
|
-
|
|
23931
|
+
|
|
23932
|
+
// src/commands/migrate.ts
|
|
23933
|
+
import { createWriteStream, existsSync as existsSync7, mkdirSync as mkdirSync3, readdirSync as readdirSync3, readFileSync as readFileSync6, statSync, writeFileSync as writeFileSync5 } from "fs";
|
|
23934
|
+
import { dirname, join as join7, posix, relative, resolve, sep } from "path";
|
|
23935
|
+
import { Readable } from "stream";
|
|
23936
|
+
import { pipeline } from "stream/promises";
|
|
23937
|
+
var UA = `deployai-migrate/${CLI_VERSION} (+https://deployai.co.il/move)`;
|
|
23938
|
+
var PAGE_CAP = 1e3;
|
|
23939
|
+
var WP_PAGE_CAP = 50;
|
|
23940
|
+
var MEDIA_FILE_CAP = 25 * 1024 * 1024;
|
|
23941
|
+
var MEDIA_TOTAL_CAP = 1024 * 1024 * 1024;
|
|
23942
|
+
var PAUSE_MS = 150;
|
|
23943
|
+
var SCAN_WORKERS = 4;
|
|
23944
|
+
var START_SCAN_PAGES = 300;
|
|
23945
|
+
var sleep2 = (ms2) => new Promise((r) => setTimeout(r, ms2));
|
|
23946
|
+
var hostDir = (root, host) => join7(root, MIGRATION_DIR, host.replace(/^www\./, ""));
|
|
23947
|
+
var readJson2 = (file2) => {
|
|
23948
|
+
try {
|
|
23949
|
+
return JSON.parse(readFileSync6(file2, "utf8"));
|
|
23950
|
+
} catch {
|
|
23951
|
+
return null;
|
|
23952
|
+
}
|
|
23953
|
+
};
|
|
23954
|
+
var writeJson = (file2, data) => {
|
|
23955
|
+
mkdirSync3(dirname(file2), { recursive: true });
|
|
23956
|
+
writeFileSync5(file2, JSON.stringify(data, null, 2) + "\n");
|
|
23957
|
+
};
|
|
23958
|
+
async function get(url2, accept = "text/html,application/xhtml+xml,*/*;q=0.8", redirect = "follow") {
|
|
23959
|
+
try {
|
|
23960
|
+
return await fetch(url2, { headers: { "User-Agent": UA, Accept: accept }, redirect, signal: AbortSignal.timeout(3e4) });
|
|
23961
|
+
} catch {
|
|
23962
|
+
return null;
|
|
23963
|
+
}
|
|
23964
|
+
}
|
|
23965
|
+
function scannedHosts(root) {
|
|
23966
|
+
const dir = join7(root, MIGRATION_DIR);
|
|
23967
|
+
if (!existsSync7(dir)) return [];
|
|
23968
|
+
return readdirSync3(dir).filter((h) => existsSync7(join7(dir, h, "inventory.json")));
|
|
23969
|
+
}
|
|
23970
|
+
async function migrateStatusCommand(root, ctx, stage, note) {
|
|
23971
|
+
if (!isAgentStage(stage)) throw new CliError(`Unknown stage: ${stage}. One of: ${AGENT_STAGES.join(", ")}.`, 1, "usage");
|
|
23972
|
+
const choices = readChoices(root);
|
|
23973
|
+
if (!choices?.startId || !choices.requestId) {
|
|
23974
|
+
out("This folder is not a managed move, so there is no request to update. Nothing was sent.");
|
|
23975
|
+
return;
|
|
23976
|
+
}
|
|
23977
|
+
await apiRequest(ctx, "/api/migrations/progress", null, { method: "POST", auth: false, body: { startId: choices.startId, stage, note: stageNote(note) } });
|
|
23978
|
+
out(`Reported: ${stage}${note ? ` (${stageNote(note)})` : ""}.`);
|
|
23979
|
+
}
|
|
23980
|
+
function readChoices(root) {
|
|
23981
|
+
return readJson2(join7(root, MIGRATION_DIR, "choices.json"));
|
|
23982
|
+
}
|
|
23983
|
+
function writeChoices(root, choices) {
|
|
23984
|
+
ensureMigrationDir(root);
|
|
23985
|
+
writeJson(join7(root, MIGRATION_DIR, "choices.json"), choices);
|
|
23986
|
+
}
|
|
23987
|
+
function ensureMigrationDir(root) {
|
|
23988
|
+
ensureDeployaiDir(root);
|
|
23989
|
+
const dir = join7(root, MIGRATION_DIR);
|
|
23990
|
+
mkdirSync3(dir, { recursive: true });
|
|
23991
|
+
const ignore = join7(dir, ".gitignore");
|
|
23992
|
+
if (!existsSync7(ignore)) writeFileSync5(ignore, "*/media/\n*/media-state.json\n");
|
|
23993
|
+
}
|
|
23994
|
+
async function sitemapUrls(base, robotsSitemaps, enough) {
|
|
23995
|
+
const own2 = [`${base}/wp-sitemap.xml`, `${base}/sitemap_index.xml`, `${base}/sitemap.xml`];
|
|
23996
|
+
const prefix = new URL(base).pathname.replace(/\/$/, "");
|
|
23997
|
+
const queue = prefix ? [...own2, ...robotsSitemaps] : robotsSitemaps.length ? [...robotsSitemaps] : own2;
|
|
23998
|
+
const host = new URL(base).hostname.replace(/^www\./, "");
|
|
23999
|
+
const inSite = (u) => u.hostname.replace(/^www\./, "") === host && (!prefix || u.pathname === prefix || u.pathname.startsWith(`${prefix}/`));
|
|
24000
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24001
|
+
const found = [];
|
|
24002
|
+
const urls = /* @__PURE__ */ new Set();
|
|
24003
|
+
while (queue.length && seen.size < 200 && urls.size < enough) {
|
|
24004
|
+
const next = queue.shift();
|
|
24005
|
+
if (seen.has(next)) continue;
|
|
24006
|
+
seen.add(next);
|
|
24007
|
+
const res = await get(next, "application/xml,text/xml,*/*;q=0.5");
|
|
24008
|
+
if (!res?.ok) continue;
|
|
24009
|
+
const xml = await res.text();
|
|
24010
|
+
if (!/<(urlset|sitemapindex)\b/i.test(xml)) continue;
|
|
24011
|
+
found.push(next);
|
|
24012
|
+
const parsed = parseSitemapXml(xml);
|
|
24013
|
+
queue.push(...parsed.sitemaps);
|
|
24014
|
+
for (const u of parsed.urls) {
|
|
24015
|
+
try {
|
|
24016
|
+
if (inSite(new URL(u))) urls.add(u);
|
|
24017
|
+
} catch {
|
|
24018
|
+
}
|
|
24019
|
+
}
|
|
24020
|
+
await sleep2(PAUSE_MS);
|
|
24021
|
+
}
|
|
24022
|
+
return { urls: [...urls], sitemaps: found };
|
|
24023
|
+
}
|
|
24024
|
+
function homeLinks(html, origin) {
|
|
24025
|
+
const host = new URL(origin).hostname;
|
|
24026
|
+
const out2 = /* @__PURE__ */ new Set();
|
|
24027
|
+
for (const m of html.matchAll(/<a\b[^>]*href=["']([^"'#]+)/gi)) {
|
|
24028
|
+
try {
|
|
24029
|
+
const u = new URL(m[1], origin);
|
|
24030
|
+
if (u.hostname === host && !/\.(jpe?g|png|gif|webp|svg|pdf|zip|mp4|mp3)$/i.test(u.pathname)) out2.add(u.origin + u.pathname + u.search);
|
|
24031
|
+
} catch {
|
|
24032
|
+
}
|
|
24033
|
+
}
|
|
24034
|
+
return [...out2];
|
|
24035
|
+
}
|
|
24036
|
+
async function wordpressContent(base, dir) {
|
|
24037
|
+
const probe = await get(`${base}/wp-json/wp/v2/types`, "application/json");
|
|
24038
|
+
if (!probe?.ok || !(probe.headers.get("content-type") ?? "").includes("json")) return false;
|
|
24039
|
+
const types = ["pages", "posts", "categories", "tags", "media", "users", "product"];
|
|
24040
|
+
for (const type of types) {
|
|
24041
|
+
const items = [];
|
|
24042
|
+
for (let page2 = 1; page2 <= WP_PAGE_CAP; page2++) {
|
|
24043
|
+
const res = await get(`${base}/wp-json/wp/v2/${type}?per_page=100&page=${page2}`, "application/json");
|
|
24044
|
+
if (!res?.ok) break;
|
|
24045
|
+
const batch = await res.json().catch(() => null);
|
|
24046
|
+
if (!Array.isArray(batch) || !batch.length) break;
|
|
24047
|
+
items.push(...batch);
|
|
24048
|
+
if (batch.length < 100) break;
|
|
24049
|
+
await sleep2(PAUSE_MS);
|
|
24050
|
+
}
|
|
24051
|
+
if (items.length) {
|
|
24052
|
+
writeJson(join7(dir, "content", `${type}.json`), items);
|
|
24053
|
+
out(` ${type}: ${items.length}`);
|
|
24054
|
+
}
|
|
24055
|
+
}
|
|
24056
|
+
const posts = readJson2(join7(dir, "content", "posts.json"));
|
|
24057
|
+
if (posts?.length) {
|
|
24058
|
+
const files = wpPostsToMarkdown({ origin: new URL(base).origin, posts, categories: readJson2(join7(dir, "content", "categories.json")) ?? [], tags: readJson2(join7(dir, "content", "tags.json")) ?? [], users: readJson2(join7(dir, "content", "users.json")) ?? [], media: readJson2(join7(dir, "content", "media.json")) ?? [] });
|
|
24059
|
+
mkdirSync3(join7(dir, "posts"), { recursive: true });
|
|
24060
|
+
for (const f of files) writeFileSync5(join7(dir, "posts", f.file), f.text);
|
|
24061
|
+
out(` posts as Markdown: ${files.length}`);
|
|
24062
|
+
}
|
|
24063
|
+
return true;
|
|
24064
|
+
}
|
|
24065
|
+
function pageAssets(html, base) {
|
|
24066
|
+
const found = /* @__PURE__ */ new Set();
|
|
24067
|
+
const add = (u) => {
|
|
24068
|
+
if (!u || u.startsWith("data:")) return;
|
|
24069
|
+
try {
|
|
24070
|
+
found.add(new URL(u.trim(), base).toString());
|
|
24071
|
+
} catch {
|
|
24072
|
+
}
|
|
24073
|
+
};
|
|
24074
|
+
for (const m of html.matchAll(/<img\b[^>]*>/gi)) {
|
|
24075
|
+
add(m[0].match(/\ssrc=["']([^"']+)/i)?.[1]);
|
|
24076
|
+
const set2 = m[0].match(/\ssrcset=["']([^"']+)/i)?.[1];
|
|
24077
|
+
if (set2) add(set2.split(",").map((s) => s.trim().split(/\s+/)[0]).pop());
|
|
24078
|
+
}
|
|
24079
|
+
add(html.match(/<meta[^>]+property=["']og:image["'][^>]*content=["']([^"']+)/i)?.[1]);
|
|
24080
|
+
for (const m of html.matchAll(/url\(["']?([^"')]+\.(?:jpe?g|png|gif|webp|svg|avif))/gi)) add(m[1]);
|
|
24081
|
+
return [...found];
|
|
24082
|
+
}
|
|
24083
|
+
async function migrateScanCommand(root, raw, opts = {}) {
|
|
24084
|
+
const source = normalizeSourceUrl(raw);
|
|
24085
|
+
if (!source) throw new CliError(`Not a site address: ${raw}. Use the full address, for example https://example.co.il`, 1, "usage");
|
|
24086
|
+
const home = await get(source);
|
|
24087
|
+
if (!home) throw new CliError(`Could not reach ${source}. Check the address, or that the site is up.`, 1, "network");
|
|
24088
|
+
if (home.status === 401 || home.status === 403) throw new CliError(`${source} answers ${home.status}: it is behind a login or blocks visitors. Ask the owner to open it to the public while it moves, or work from their export.`, 1, "blocked");
|
|
24089
|
+
const origin = new URL(home.url).origin;
|
|
24090
|
+
const base = (origin + new URL(home.url).pathname).replace(/\/+$/, "");
|
|
24091
|
+
const html = await home.text();
|
|
24092
|
+
const headers = Object.fromEntries(home.headers.entries());
|
|
24093
|
+
const platform3 = detectPlatform(html, headers);
|
|
24094
|
+
const host = new URL(origin).hostname;
|
|
24095
|
+
ensureMigrationDir(root);
|
|
24096
|
+
const dir = hostDir(root, host);
|
|
24097
|
+
mkdirSync3(dir, { recursive: true });
|
|
24098
|
+
out(`Scanning ${base} (${platform3})`);
|
|
24099
|
+
const robotsRes = await get(`${origin}/robots.txt`, "text/plain");
|
|
24100
|
+
const robots = robotsRes?.ok ? await robotsRes.text() : "";
|
|
24101
|
+
if (robots) writeFileSync5(join7(dir, "robots.txt"), robots);
|
|
24102
|
+
const cap = Math.min(opts.max ?? PAGE_CAP, PAGE_CAP);
|
|
24103
|
+
const fromSitemaps = await sitemapUrls(base, robots ? parseRobots(robots).sitemaps : [], cap * 5);
|
|
24104
|
+
const all = [.../* @__PURE__ */ new Set([`${base}/`, ...fromSitemaps.urls, ...fromSitemaps.urls.length ? [] : homeLinks(html, base)])];
|
|
24105
|
+
const list = all.slice(0, cap);
|
|
24106
|
+
out(` sitemaps: ${fromSitemaps.sitemaps.length}, addresses: ${all.length}${all.length > cap ? ` (the first ${cap} are read)` : ""}`);
|
|
24107
|
+
const pages = new Array(list.length);
|
|
24108
|
+
const assets = /* @__PURE__ */ new Set();
|
|
24109
|
+
let next = 0;
|
|
24110
|
+
let read = 0;
|
|
24111
|
+
const worker = async () => {
|
|
24112
|
+
while (next < list.length) {
|
|
24113
|
+
const i = next++;
|
|
24114
|
+
const url2 = list[i];
|
|
24115
|
+
const res = i === 0 ? null : await get(url2, void 0, "manual");
|
|
24116
|
+
const status = i === 0 ? home.status : res?.status ?? 0;
|
|
24117
|
+
const body = i === 0 ? html : res && res.ok ? await res.text() : "";
|
|
24118
|
+
const seo = body ? readPageSeo(body) : null;
|
|
24119
|
+
pages[i] = { path: pathOf(url2), status, title: seo?.title ?? null, description: seo?.description ?? null, canonical: seo?.canonical ?? null, h1: seo?.h1[0] ?? null, lang: seo?.lang ?? null };
|
|
24120
|
+
if (body) pageAssets(body, url2).forEach((a) => assets.add(a));
|
|
24121
|
+
if (++read % 50 === 0) out(` pages read: ${read} of ${list.length}`);
|
|
24122
|
+
if (i) await sleep2(PAUSE_MS);
|
|
24123
|
+
}
|
|
24124
|
+
};
|
|
24125
|
+
await Promise.all(Array.from({ length: SCAN_WORKERS }, worker));
|
|
24126
|
+
const wordpressApi = platform3 === "wordpress" ? await wordpressContent(base, dir) : false;
|
|
24127
|
+
if (wordpressApi) {
|
|
24128
|
+
const media = readJson2(join7(dir, "content", "media.json")) ?? [];
|
|
24129
|
+
media.forEach((m) => m.source_url && assets.add(m.source_url));
|
|
24130
|
+
}
|
|
24131
|
+
const inventory = { source: base, platform: platform3, scannedAt: (/* @__PURE__ */ new Date()).toISOString(), sitemaps: fromSitemaps.sitemaps, pages, wordpressApi, skipped: Math.max(0, all.length - list.length) };
|
|
24132
|
+
writeJson(join7(dir, "inventory.json"), inventory);
|
|
24133
|
+
writeJson(join7(dir, "assets.json"), [...assets].sort());
|
|
24134
|
+
writeFileSync5(join7(dir, "home.html"), html);
|
|
24135
|
+
const rel = relative(root, dir).split(sep).join("/");
|
|
24136
|
+
const broken = pages.filter((p) => p.status >= 400).length;
|
|
24137
|
+
out();
|
|
24138
|
+
out(`Saved in ${rel}:`);
|
|
24139
|
+
out(` inventory.json ${pages.length} pages with their address, title, description and headings${broken ? ` (${broken} already broken on the old site)` : ""}`);
|
|
24140
|
+
out(` assets.json ${assets.size} images and files`);
|
|
24141
|
+
if (wordpressApi) {
|
|
24142
|
+
out(" content/ the WordPress pages, posts, categories, tags, media and authors as JSON");
|
|
24143
|
+
if (existsSync7(join7(dir, "posts"))) out(" posts/ the posts as Markdown for the blog block, each with its old address");
|
|
24144
|
+
} else if (platform3 === "wordpress") out(" The WordPress API is closed on this site: work from the pages, or ask the owner for an export (Tools > Export).");
|
|
24145
|
+
out();
|
|
24146
|
+
out("Keep every path in inventory.json exactly as it is: same address, same title and description.");
|
|
24147
|
+
return inventory.skipped;
|
|
24148
|
+
}
|
|
24149
|
+
function mediaTarget(dir, url2) {
|
|
24150
|
+
const u = new URL(url2);
|
|
24151
|
+
const clean = posix.normalize(decodeURIComponent(u.pathname)).replace(/^\/+/, "");
|
|
24152
|
+
if (!clean || clean.endsWith("/") || clean.includes("..")) return null;
|
|
24153
|
+
const base = resolve(dir, "media", u.hostname.replace(/^www\./, ""));
|
|
24154
|
+
const target = resolve(base, clean);
|
|
24155
|
+
return target.startsWith(base + sep) ? target : null;
|
|
24156
|
+
}
|
|
24157
|
+
async function migrateMediaCommand(root) {
|
|
24158
|
+
const hosts = scannedHosts(root);
|
|
24159
|
+
if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
|
|
24160
|
+
for (const host of hosts) {
|
|
24161
|
+
const dir = hostDir(root, host);
|
|
24162
|
+
const assets = readJson2(join7(dir, "assets.json")) ?? [];
|
|
24163
|
+
const stateFile = join7(dir, "media-state.json");
|
|
24164
|
+
const state = readJson2(stateFile) ?? { done: [], failed: [], bytes: 0 };
|
|
24165
|
+
const done = new Set(state.done);
|
|
24166
|
+
const todo = assets.filter((a) => !done.has(a));
|
|
24167
|
+
out(`${host}: ${assets.length} files, ${todo.length} left`);
|
|
24168
|
+
for (const [i, url2] of todo.entries()) {
|
|
24169
|
+
if (state.bytes >= MEDIA_TOTAL_CAP) {
|
|
24170
|
+
out(` Stopped at ${formatBytes(state.bytes)}: the cap for one move. Use only the files the new pages need.`);
|
|
24171
|
+
break;
|
|
24172
|
+
}
|
|
24173
|
+
const target = mediaTarget(dir, url2);
|
|
24174
|
+
const res = target ? await get(url2, "*/*") : null;
|
|
24175
|
+
const size = Number(res?.headers.get("content-length") ?? 0);
|
|
24176
|
+
if (!target || !res?.ok || !res.body || size > MEDIA_FILE_CAP) {
|
|
24177
|
+
if (!state.failed.includes(url2)) state.failed.push(url2);
|
|
24178
|
+
done.add(url2);
|
|
24179
|
+
continue;
|
|
24180
|
+
}
|
|
24181
|
+
mkdirSync3(dirname(target), { recursive: true });
|
|
24182
|
+
await pipeline(Readable.fromWeb(res.body), createWriteStream(target));
|
|
24183
|
+
const bytes = statSync(target).size;
|
|
24184
|
+
state.bytes += bytes;
|
|
24185
|
+
done.add(url2);
|
|
24186
|
+
state.done = [...done];
|
|
24187
|
+
if (i % 25 === 0) writeJson(stateFile, state);
|
|
24188
|
+
await sleep2(PAUSE_MS / 3);
|
|
24189
|
+
}
|
|
24190
|
+
state.done = [...done];
|
|
24191
|
+
writeJson(stateFile, state);
|
|
24192
|
+
out(` ${formatBytes(state.bytes)} in ${relative(root, join7(dir, "media")).split(sep).join("/")}${state.failed.length ? `, ${state.failed.length} could not be downloaded (listed in media-state.json)` : ""}`);
|
|
24193
|
+
}
|
|
24194
|
+
out("Copy the files the new pages use into the site's public folder at the same path (for example public/wp-content/uploads/...), so old image addresses keep working.");
|
|
24195
|
+
}
|
|
24196
|
+
function redirectLines(inv, rss = "/rss.xml") {
|
|
24197
|
+
const lines = /* @__PURE__ */ new Set();
|
|
24198
|
+
for (const p of inv.pages) {
|
|
24199
|
+
const path = p.path.split("?")[0];
|
|
24200
|
+
if (/\/feed\/?$/.test(path)) lines.add(`${path} ${rss} 301`);
|
|
24201
|
+
if (/\/attachment\/[^/]+\/?$/.test(path)) lines.add(`${path} ${path.replace(/\/attachment\/[^/]+\/?$/, "/")} 301`);
|
|
24202
|
+
}
|
|
24203
|
+
if (inv.platform === "wordpress") {
|
|
24204
|
+
const folder = new URL(inv.source).pathname.replace(/\/+$/, "");
|
|
24205
|
+
lines.add(`${folder}/feed/ ${rss} 301`);
|
|
24206
|
+
lines.add(`${folder}/comments/feed/ ${rss} 301`);
|
|
24207
|
+
}
|
|
24208
|
+
return [...lines];
|
|
24209
|
+
}
|
|
24210
|
+
function migrateRedirectsCommand(root) {
|
|
24211
|
+
const hosts = scannedHosts(root);
|
|
24212
|
+
if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
|
|
24213
|
+
const lines = /* @__PURE__ */ new Set();
|
|
24214
|
+
for (const host of hosts) {
|
|
24215
|
+
const inv = readJson2(join7(hostDir(root, host), "inventory.json"));
|
|
24216
|
+
if (inv) redirectLines(inv).forEach((l) => lines.add(l));
|
|
24217
|
+
}
|
|
24218
|
+
const publicDir = join7(root, "public");
|
|
24219
|
+
const file2 = join7(existsSync7(publicDir) ? publicDir : root, "_redirects");
|
|
24220
|
+
const before = existsSync7(file2) ? readFileSync6(file2, "utf8").split(/\r?\n/).filter(Boolean) : [];
|
|
24221
|
+
const added = [...lines].filter((l) => !before.some((b) => b.split(/\s+/)[0] === l.split(/\s+/)[0]));
|
|
24222
|
+
writeFileSync5(file2, [...before, ...added].join("\n") + "\n");
|
|
24223
|
+
out(`${relative(root, file2).split(sep).join("/")}: ${added.length} added, ${before.length + added.length} in all (at most 2,000; no query strings).`);
|
|
24224
|
+
out('Add a line "<old path> <new path> 301" only for a page that truly could not keep its address.');
|
|
24225
|
+
}
|
|
24226
|
+
function allowedRedirects(root) {
|
|
24227
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
24228
|
+
for (const file2 of [join7(root, "public", "_redirects"), join7(root, "_redirects")]) {
|
|
24229
|
+
if (!existsSync7(file2)) continue;
|
|
24230
|
+
for (const line of readFileSync6(file2, "utf8").split(/\r?\n/)) {
|
|
24231
|
+
const [from, to] = line.trim().split(/\s+/);
|
|
24232
|
+
if (from && to && !from.startsWith("#")) map2.set(from, to);
|
|
24233
|
+
}
|
|
24234
|
+
}
|
|
24235
|
+
return map2;
|
|
24236
|
+
}
|
|
24237
|
+
function previewUrl(preview, path) {
|
|
24238
|
+
const u = new URL(path, preview.origin);
|
|
24239
|
+
const token = preview.searchParams.get("deployai_preview");
|
|
24240
|
+
if (token) u.searchParams.set("deployai_preview", token);
|
|
24241
|
+
return u.toString();
|
|
24242
|
+
}
|
|
24243
|
+
async function migrateVerifyCommand(root, previewRaw) {
|
|
24244
|
+
let preview;
|
|
24245
|
+
try {
|
|
24246
|
+
preview = new URL(/^https?:\/\//.test(previewRaw) ? previewRaw : `https://${previewRaw}`);
|
|
24247
|
+
} catch {
|
|
24248
|
+
throw new CliError(`Not an address: ${previewRaw}. Use the preview address deploy printed.`, 1, "usage");
|
|
24249
|
+
}
|
|
24250
|
+
const hosts = scannedHosts(root);
|
|
24251
|
+
if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
|
|
24252
|
+
const redirects = allowedRedirects(root);
|
|
24253
|
+
const findings = [];
|
|
24254
|
+
let checked = 0;
|
|
24255
|
+
for (const host of hosts) {
|
|
24256
|
+
const inv = readJson2(join7(hostDir(root, host), "inventory.json"));
|
|
24257
|
+
for (const old of inv?.pages ?? []) {
|
|
24258
|
+
if (old.status >= 300) continue;
|
|
24259
|
+
const res = await get(previewUrl(preview, old.path));
|
|
24260
|
+
checked++;
|
|
24261
|
+
let next = null;
|
|
24262
|
+
if (res) {
|
|
24263
|
+
const u = new URL(res.url);
|
|
24264
|
+
u.searchParams.delete("deployai_preview");
|
|
24265
|
+
const body = res.ok ? await res.text() : "";
|
|
24266
|
+
const seo = body ? readPageSeo(body) : null;
|
|
24267
|
+
next = { status: res.status, finalPath: u.pathname + u.search, title: seo?.title ?? null, description: seo?.description ?? null };
|
|
24268
|
+
}
|
|
24269
|
+
const f = comparePage(old, next, redirects.get(old.path.split("?")[0]));
|
|
24270
|
+
if (f) findings.push(f);
|
|
24271
|
+
await sleep2(PAUSE_MS / 3);
|
|
24272
|
+
}
|
|
24273
|
+
}
|
|
24274
|
+
const words = { missing: "not found on the preview", moved: "moved to", error: "answers", title_lost: "lost its title", description_lost: "lost its description" };
|
|
24275
|
+
const report = join7(root, MIGRATION_DIR, "verify.json");
|
|
24276
|
+
writeJson(report, { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), preview: preview.origin, checked, findings });
|
|
24277
|
+
if (!findings.length) {
|
|
24278
|
+
out(`All ${checked} old addresses open on the preview with their title and description.`);
|
|
24279
|
+
return;
|
|
24280
|
+
}
|
|
24281
|
+
out(`${findings.length} of ${checked} old addresses need a fix (also in ${relative(root, report).split(sep).join("/")}):`);
|
|
24282
|
+
for (const f of findings.slice(0, 60)) out(` ${f.path} ${words[f.problem]}${f.detail ? ` ${f.detail}` : ""}`);
|
|
24283
|
+
if (findings.length > 60) out(` and ${findings.length - 60} more in verify.json`);
|
|
24284
|
+
out("Give each page its old address back (or, only if it truly cannot stay, a line in public/_redirects), deploy again, and run verify again.");
|
|
24285
|
+
process.exitCode = 1;
|
|
24286
|
+
}
|
|
24287
|
+
|
|
24288
|
+
// src/commands/link.ts
|
|
24289
|
+
async function save(root, p, ctx) {
|
|
23507
24290
|
updateProject(root, { projectId: p.id, name: p.name, slug: p.slug });
|
|
23508
24291
|
const t = messages(root);
|
|
23509
24292
|
out(t("linkedTo", { name: p.name, slug: p.slug }));
|
|
23510
24293
|
out(t("savedIn"));
|
|
24294
|
+
await moveOffer(root, p, ctx);
|
|
23511
24295
|
out(t("nextStep"));
|
|
23512
24296
|
out(t("runDeploy"));
|
|
23513
24297
|
}
|
|
24298
|
+
async function moveOffer(root, p, ctx) {
|
|
24299
|
+
const startId = readChoices(root)?.startId;
|
|
24300
|
+
if (!startId) return;
|
|
24301
|
+
const t = messages(root);
|
|
24302
|
+
try {
|
|
24303
|
+
const r = await apiRequest(ctx, "/api/cli/migrations/grant", null, { method: "POST", body: { projectId: p.id, startId } });
|
|
24304
|
+
if (r.granted?.length) out(t("moveOfferGranted", { n: r.granted.length }));
|
|
24305
|
+
else if (r.reason && r.reason !== "start_used") out(t(r.reason === "cap" ? "moveOfferCap" : "moveOfferOver"));
|
|
24306
|
+
} catch {
|
|
24307
|
+
}
|
|
24308
|
+
}
|
|
23514
24309
|
function projectLine(p, i) {
|
|
23515
24310
|
const live = p.liveVersion ? `v${p.liveVersion}` : "-";
|
|
23516
24311
|
return ` ${String(i + 1).padStart(2)}. ${p.slug.padEnd(24)} ${p.status.padEnd(7)} ${live.padEnd(5)} ${p.url ?? ""}`.trimEnd();
|
|
@@ -23523,14 +24318,14 @@ async function linkCommand(root, ctx, target, opts) {
|
|
|
23523
24318
|
const p = await apiRequest(ctx, "/api/cli/projects", Project, { method: "POST", body: { name: opts.create, framework } });
|
|
23524
24319
|
out(t("createdProject", { name: p.name }));
|
|
23525
24320
|
if (p.notice) out(p.notice);
|
|
23526
|
-
save(root, p);
|
|
24321
|
+
await save(root, p, ctx);
|
|
23527
24322
|
return;
|
|
23528
24323
|
}
|
|
23529
24324
|
const { projects } = await apiRequest(ctx, "/api/cli/projects", ProjectsResponse);
|
|
23530
24325
|
if (target) {
|
|
23531
24326
|
const p = projects.find((x) => x.id === target || x.slug === target || x.name === target);
|
|
23532
24327
|
if (!p) throw new CliError(messages(root)("noProjectNamed", { name: target }), 1, "not_found");
|
|
23533
|
-
save(root, p);
|
|
24328
|
+
await save(root, p, ctx);
|
|
23534
24329
|
return;
|
|
23535
24330
|
}
|
|
23536
24331
|
if (!projects.length) {
|
|
@@ -23561,7 +24356,7 @@ async function linkCommand(root, ctx, target, opts) {
|
|
|
23561
24356
|
} finally {
|
|
23562
24357
|
rl.close();
|
|
23563
24358
|
}
|
|
23564
|
-
if (answer === "y" || answer === "yes") return save(root, p);
|
|
24359
|
+
if (answer === "y" || answer === "yes") return save(root, p, ctx);
|
|
23565
24360
|
out(t("linkCancelled"));
|
|
23566
24361
|
return;
|
|
23567
24362
|
}
|
|
@@ -23577,7 +24372,7 @@ async function linkCommand(root, ctx, target, opts) {
|
|
|
23577
24372
|
const answer = (await rl.question("Number to link: ")).trim();
|
|
23578
24373
|
const p = projects[Number(answer) - 1];
|
|
23579
24374
|
if (!p) throw new CliError(messages(root)("noProjectPicked"), 1, "usage");
|
|
23580
|
-
save(root, p);
|
|
24375
|
+
await save(root, p, ctx);
|
|
23581
24376
|
} finally {
|
|
23582
24377
|
rl.close();
|
|
23583
24378
|
}
|
|
@@ -23587,11 +24382,24 @@ async function linkCommand(root, ctx, target, opts) {
|
|
|
23587
24382
|
out(t("runLinkPick"));
|
|
23588
24383
|
}
|
|
23589
24384
|
|
|
23590
|
-
// src/
|
|
24385
|
+
// src/ask.ts
|
|
23591
24386
|
import { createInterface as createInterface2 } from "readline/promises";
|
|
24387
|
+
var isInteractive = () => Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
24388
|
+
async function askLine(question) {
|
|
24389
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
24390
|
+
try {
|
|
24391
|
+
return (await rl.question(question)).trim();
|
|
24392
|
+
} finally {
|
|
24393
|
+
rl.close();
|
|
24394
|
+
}
|
|
24395
|
+
}
|
|
24396
|
+
async function askYes(question) {
|
|
24397
|
+
const answer = (await askLine(question)).toLowerCase();
|
|
24398
|
+
return answer === "y" || answer === "yes";
|
|
24399
|
+
}
|
|
23592
24400
|
|
|
23593
24401
|
// src/tar.ts
|
|
23594
|
-
import { readFileSync as
|
|
24402
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
23595
24403
|
import { gzipSync } from "zlib";
|
|
23596
24404
|
var BLOCK = 512;
|
|
23597
24405
|
function writeString(buf, offset, length, value) {
|
|
@@ -23675,7 +24483,7 @@ function packFiles(files) {
|
|
|
23675
24483
|
return createTarGz(
|
|
23676
24484
|
files.map((f) => ({
|
|
23677
24485
|
name: f.rel,
|
|
23678
|
-
data:
|
|
24486
|
+
data: readFileSync7(f.abs),
|
|
23679
24487
|
mtimeMs: f.mtimeMs,
|
|
23680
24488
|
mode: f.mode & 64 ? 493 : 420
|
|
23681
24489
|
}))
|
|
@@ -23711,6 +24519,212 @@ function readTar(tar) {
|
|
|
23711
24519
|
return entries;
|
|
23712
24520
|
}
|
|
23713
24521
|
|
|
24522
|
+
// src/commands/versions.ts
|
|
24523
|
+
function linkedProjectId(root) {
|
|
24524
|
+
const id = readProject(root)?.projectId;
|
|
24525
|
+
if (!id) throw new CliError(messages(root)("notLinked"), 1, "not_linked");
|
|
24526
|
+
return id;
|
|
24527
|
+
}
|
|
24528
|
+
function parseVersion(input2) {
|
|
24529
|
+
const m = /^v?(\d+)$/i.exec(input2.trim());
|
|
24530
|
+
const n2 = m ? Number(m[1]) : NaN;
|
|
24531
|
+
if (!Number.isInteger(n2) || n2 <= 0) throw new CliError(messages()("notVersion", { input: input2 }), 1, "usage");
|
|
24532
|
+
return n2;
|
|
24533
|
+
}
|
|
24534
|
+
function shortDate(iso) {
|
|
24535
|
+
const d = new Date(iso);
|
|
24536
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
24537
|
+
const p = (x) => String(x).padStart(2, "0");
|
|
24538
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
|
24539
|
+
}
|
|
24540
|
+
async function versionsCommand(root, ctx) {
|
|
24541
|
+
requireToken(ctx);
|
|
24542
|
+
const projectId = linkedProjectId(root);
|
|
24543
|
+
const { versions } = await apiRequest(ctx, `/api/cli/versions?projectId=${encodeURIComponent(projectId)}`, VersionsResponse);
|
|
24544
|
+
if (!versions.length) {
|
|
24545
|
+
out('No versions yet. Run: npx deployai@latest deploy -m "<message>"');
|
|
24546
|
+
return;
|
|
24547
|
+
}
|
|
24548
|
+
const sorted = [...versions].sort((a, b) => b.number - a.number);
|
|
24549
|
+
out("Versions");
|
|
24550
|
+
for (const v of sorted) {
|
|
24551
|
+
const status = v.status === "replaced" ? stateName("replaced", root) : v.status;
|
|
24552
|
+
const cols = [
|
|
24553
|
+
`v${v.number}`.padEnd(6),
|
|
24554
|
+
(v.isLive ? "live" : "").padEnd(6),
|
|
24555
|
+
status.padEnd(10),
|
|
24556
|
+
shortDate(v.createdAt).padEnd(18),
|
|
24557
|
+
formatBytes(v.sizeBytes).padEnd(10),
|
|
24558
|
+
v.message
|
|
24559
|
+
];
|
|
24560
|
+
out(` ${cols.join("")}`);
|
|
24561
|
+
if (v.error) out(` ${v.error}`);
|
|
24562
|
+
if (v.migrationStatus === "waiting") out(` ${messages(root)("sqlWaitingLine", { n: v.number })}`);
|
|
24563
|
+
}
|
|
24564
|
+
}
|
|
24565
|
+
async function changeLiveCommand(root, ctx, version2, kind, opts = {}) {
|
|
24566
|
+
requireToken(ctx);
|
|
24567
|
+
const projectId = linkedProjectId(root);
|
|
24568
|
+
const number4 = parseVersion(version2);
|
|
24569
|
+
const t = messages(root);
|
|
24570
|
+
const approval = await promoteWithSql(root, ctx, projectId, number4, kind, opts.approveSql);
|
|
24571
|
+
if (approval === null) return;
|
|
24572
|
+
out(t(kind === "rollback" ? "rollbackQueued" : "promoteQueued", { n: number4 }));
|
|
24573
|
+
if (approval) out(t("sqlFirst", { n: number4 }));
|
|
24574
|
+
out(t("nextStep"));
|
|
24575
|
+
out(t("runStatus"));
|
|
24576
|
+
}
|
|
24577
|
+
async function promoteWithSql(root, ctx, projectId, number4, kind, approve) {
|
|
24578
|
+
try {
|
|
24579
|
+
await apiRequest(ctx, `/api/cli/${kind}`, null, { method: "POST", body: { projectId, number: number4 } });
|
|
24580
|
+
return false;
|
|
24581
|
+
} catch (e2) {
|
|
24582
|
+
if (kind !== "promote" || !(e2 instanceof CliError) || e2.category !== "sql_waiting") throw e2;
|
|
24583
|
+
}
|
|
24584
|
+
const approval = await approveSqlStep(root, ctx, projectId, number4, approve);
|
|
24585
|
+
if (!approval) return null;
|
|
24586
|
+
await apiRequest(ctx, "/api/cli/promote", null, { method: "POST", body: { projectId, number: number4, ...approval } });
|
|
24587
|
+
return approval;
|
|
24588
|
+
}
|
|
24589
|
+
function fetchStatus(ctx, projectId) {
|
|
24590
|
+
return apiRequest(ctx, `/api/cli/status?projectId=${encodeURIComponent(projectId)}`, StatusResponse);
|
|
24591
|
+
}
|
|
24592
|
+
async function statusCommand(root, ctx) {
|
|
24593
|
+
requireToken(ctx);
|
|
24594
|
+
const projectId = linkedProjectId(root);
|
|
24595
|
+
printStatus(root, ctx, projectId, await fetchStatus(ctx, projectId));
|
|
24596
|
+
}
|
|
24597
|
+
function printStatus(root, ctx, projectId, s) {
|
|
24598
|
+
const p = s.project;
|
|
24599
|
+
const t = messages(root);
|
|
24600
|
+
const newer = s.latest && s.latest.number !== p.liveVersion ? s.latest : null;
|
|
24601
|
+
out(t("statusTitle"));
|
|
24602
|
+
out();
|
|
24603
|
+
out(
|
|
24604
|
+
rows([
|
|
24605
|
+
[t("project"), `${p.name} (${p.slug})`],
|
|
24606
|
+
[t("state"), stateName(p.status, root)],
|
|
24607
|
+
[t("address"), p.url ?? t("notPublished")],
|
|
24608
|
+
[t("liveVersion"), p.liveVersion ? `v${p.liveVersion}` : t("none")],
|
|
24609
|
+
// A newer upload than the live one: its state, so "follow the build" after deploy has something to follow.
|
|
24610
|
+
...newer ? [[t("newestVersion"), `v${newer.number} ${stateName(newer.status, root)}`]] : [],
|
|
24611
|
+
[t("queue"), s.queue.running ? t("buildingNow") : s.queue.position > 0 ? queueText(s.queue.position, root) : t("idle")]
|
|
24612
|
+
])
|
|
24613
|
+
);
|
|
24614
|
+
if (s.latest?.goingLive) {
|
|
24615
|
+
out();
|
|
24616
|
+
out(t("goingLive", { n: s.latest.number }));
|
|
24617
|
+
return;
|
|
24618
|
+
}
|
|
24619
|
+
if (s.latest?.wentBack) {
|
|
24620
|
+
out();
|
|
24621
|
+
out(t("wentBack", { n: s.latest.number, prev: s.latest.wentBack.previous, reason: s.latest.wentBack.reason }));
|
|
24622
|
+
return;
|
|
24623
|
+
}
|
|
24624
|
+
if (newer?.status === "ready" && s.latest?.migrationStatus !== "failed") {
|
|
24625
|
+
out();
|
|
24626
|
+
out(t("nextStep"));
|
|
24627
|
+
out(t("askOwner", { n: newer.number }));
|
|
24628
|
+
if (s.latest?.preview) out(t("showPreview", { url: s.latest.preview }));
|
|
24629
|
+
out(t("promoteReady", { n: newer.number }));
|
|
24630
|
+
}
|
|
24631
|
+
if (s.latest?.migrationStatus === "waiting") {
|
|
24632
|
+
out();
|
|
24633
|
+
out(t("sqlWaitingLine", { n: s.latest.number }));
|
|
24634
|
+
}
|
|
24635
|
+
if (s.latest?.migrationStatus === "failed") {
|
|
24636
|
+
out();
|
|
24637
|
+
out(t("sqlFailed", { n: s.latest.number }));
|
|
24638
|
+
if (s.latest.migrationError) out(` ${s.latest.migrationError}`);
|
|
24639
|
+
out(t("sqlRetry", { n: s.latest.number }));
|
|
24640
|
+
}
|
|
24641
|
+
if (s.latest?.status !== "failed") return;
|
|
24642
|
+
out();
|
|
24643
|
+
out(t("buildFailed", { n: s.latest.number }));
|
|
24644
|
+
if (s.latest.error) out(` ${s.latest.error}`);
|
|
24645
|
+
if (s.latest.logTail) {
|
|
24646
|
+
out();
|
|
24647
|
+
out(t("buildLogTail"));
|
|
24648
|
+
for (const line of s.latest.logTail.split("\n")) out(` ${line}`);
|
|
24649
|
+
}
|
|
24650
|
+
out();
|
|
24651
|
+
out(t(telemetryEnabled(ctx.config) ? "buildFixHint" : "buildFixHintNoNote"));
|
|
24652
|
+
}
|
|
24653
|
+
|
|
24654
|
+
// src/commands/sql.ts
|
|
24655
|
+
function fetchSqlPlan(ctx, projectId, n2) {
|
|
24656
|
+
return apiRequest(ctx, `/api/cli/sql?projectId=${encodeURIComponent(projectId)}&number=${n2}`, SqlPlanResponse);
|
|
24657
|
+
}
|
|
24658
|
+
var SQL_FILE = /(^|\/)(migrations\/[^/]+|schema|seed)\.sql$/;
|
|
24659
|
+
function printSqlPlan(root, plan) {
|
|
24660
|
+
const t = messages(root);
|
|
24661
|
+
out(t("sqlTitle", { n: plan.number, db: plan.database ?? "-" }));
|
|
24662
|
+
if (plan.isNew) out(t("sqlNewDatabase"));
|
|
24663
|
+
for (const f of plan.files) out(` ${f.file} ${f.skip ? t("sqlSkipped") : t("sqlStatements", { n: f.statements })}`);
|
|
24664
|
+
if (plan.destructive.length) {
|
|
24665
|
+
out();
|
|
24666
|
+
out(t("sqlDestructive"));
|
|
24667
|
+
for (const d of plan.destructive) out(` ${d.file}: ${d.statement}`);
|
|
24668
|
+
}
|
|
24669
|
+
}
|
|
24670
|
+
async function approveSqlStep(root, ctx, projectId, n2, approve) {
|
|
24671
|
+
const t = messages(root);
|
|
24672
|
+
const plan = await fetchSqlPlan(ctx, projectId, n2);
|
|
24673
|
+
if (plan.migrationStatus === "queued" || plan.migrationStatus === "running") {
|
|
24674
|
+
out(t("sqlRunningNow", { n: n2 }));
|
|
24675
|
+
return null;
|
|
24676
|
+
}
|
|
24677
|
+
printSqlPlan(root, plan);
|
|
24678
|
+
out();
|
|
24679
|
+
if (!plan.canApprove) throw new CliError(t("sqlOwnerOnly", { url: plan.url }), 1, "sql_owner_only");
|
|
24680
|
+
if (!plan.database || plan.stuck.length) throw new CliError(t("sqlDashboard", { url: plan.url }), 1, "sql_dashboard");
|
|
24681
|
+
if (isInteractive()) {
|
|
24682
|
+
if (plan.destructive.length) {
|
|
24683
|
+
const typed = await askLine(t("sqlTypeDatabase", { db: plan.database, n: n2 }));
|
|
24684
|
+
if (typed !== plan.database) {
|
|
24685
|
+
out(t("sqlNotRun"));
|
|
24686
|
+
return null;
|
|
24687
|
+
}
|
|
24688
|
+
return { approveSql: plan.hash, confirmDatabase: plan.database };
|
|
24689
|
+
}
|
|
24690
|
+
if (!await askYes(t("sqlAskRun", { db: plan.database, n: n2 }))) {
|
|
24691
|
+
out(t("sqlNotRun"));
|
|
24692
|
+
return null;
|
|
24693
|
+
}
|
|
24694
|
+
return { approveSql: plan.hash };
|
|
24695
|
+
}
|
|
24696
|
+
if (plan.destructive.length) {
|
|
24697
|
+
out(t("sqlAgentDestructive", { n: n2, url: plan.url }));
|
|
24698
|
+
return null;
|
|
24699
|
+
}
|
|
24700
|
+
if (approve) {
|
|
24701
|
+
if (approve !== plan.hash) throw new CliError(t("sqlChanged", { n: n2 }), 1, "sql_changed");
|
|
24702
|
+
return { approveSql: plan.hash };
|
|
24703
|
+
}
|
|
24704
|
+
out(t("nextStep"));
|
|
24705
|
+
out(t("sqlAgentAsk", { n: n2, db: plan.database }));
|
|
24706
|
+
out(t("sqlAgentThen", { n: n2, hash: plan.hash }));
|
|
24707
|
+
return null;
|
|
24708
|
+
}
|
|
24709
|
+
async function sqlCommand(root, ctx, version2) {
|
|
24710
|
+
requireToken(ctx);
|
|
24711
|
+
const projectId = linkedProjectId(root);
|
|
24712
|
+
const n2 = parseVersion(version2);
|
|
24713
|
+
const plan = await fetchSqlPlan(ctx, projectId, n2);
|
|
24714
|
+
if (!plan.files.length) {
|
|
24715
|
+
out(messages(root)("sqlNone", { n: n2 }));
|
|
24716
|
+
return;
|
|
24717
|
+
}
|
|
24718
|
+
printSqlPlan(root, plan);
|
|
24719
|
+
const t = messages(root);
|
|
24720
|
+
if (plan.migrationStatus !== "waiting" && plan.migrationStatus !== "failed") return;
|
|
24721
|
+
out();
|
|
24722
|
+
out(t("nextStep"));
|
|
24723
|
+
if (!plan.canApprove) out(t("sqlOwnerOnly", { url: plan.url }));
|
|
24724
|
+
else if (plan.destructive.length) out(t("sqlAgentDestructive", { n: n2, url: plan.url }));
|
|
24725
|
+
else out(t("sqlAgentThen", { n: n2, hash: plan.hash }));
|
|
24726
|
+
}
|
|
24727
|
+
|
|
23714
24728
|
// src/commands/deploy.ts
|
|
23715
24729
|
function queueText(position, root) {
|
|
23716
24730
|
const t = messages(root);
|
|
@@ -23731,23 +24745,15 @@ function expiryDate(iso) {
|
|
|
23731
24745
|
const d = new Date(iso);
|
|
23732
24746
|
return Number.isNaN(d.getTime()) ? iso : d.toISOString().slice(0, 10);
|
|
23733
24747
|
}
|
|
23734
|
-
|
|
23735
|
-
|
|
23736
|
-
try {
|
|
23737
|
-
const answer = (await rl.question(messages(root)("askGuest"))).trim().toLowerCase();
|
|
23738
|
-
return answer === "y" || answer === "yes";
|
|
23739
|
-
} finally {
|
|
23740
|
-
rl.close();
|
|
23741
|
-
}
|
|
23742
|
-
}
|
|
24748
|
+
var BUILD_WAIT_MS = 15 * 6e4;
|
|
24749
|
+
var LIVE_WAIT_MS = 3 * 6e4;
|
|
23743
24750
|
async function deployCommand(root, ctx, opts) {
|
|
23744
24751
|
const project = readProject(root);
|
|
23745
24752
|
if (!ctx.config.token) {
|
|
23746
24753
|
const guestToken = project?.projectId ? ctx.config.guestTokens?.[project.projectId] : void 0;
|
|
23747
24754
|
if (guestToken) return deployVersion(root, { ...ctx, config: { ...ctx.config, token: guestToken } }, opts, true);
|
|
23748
24755
|
if (project?.projectId) throw new CliError(messages(root)("guestAccountSite"), 1, "auth");
|
|
23749
|
-
|
|
23750
|
-
if (!opts.guest && !(interactive && await askGuest(root))) {
|
|
24756
|
+
if (!opts.guest && !(isInteractive() && await askYes(messages(root)("askGuest")))) {
|
|
23751
24757
|
throw new CliError(messages(root)("deployNotLoggedIn"), 1, "auth");
|
|
23752
24758
|
}
|
|
23753
24759
|
return deployGuest(root, ctx, opts);
|
|
@@ -23781,15 +24787,19 @@ async function prepare(root, ctx, maxBytes) {
|
|
|
23781
24787
|
const names = plan.skippedLarge.slice(0, 3).map((f) => f.rel).join(", ");
|
|
23782
24788
|
info.push([t("skipped"), t("skippedLarge", { n: plan.skippedLarge.length, max: formatBytes(MAX_FILE_BYTES), names })]);
|
|
23783
24789
|
}
|
|
23784
|
-
return { archive, info };
|
|
24790
|
+
return { archive, info, hasSql: plan.files.some((f) => SQL_FILE.test(f.rel) && !f.rel.includes("node_modules/")) };
|
|
23785
24791
|
}
|
|
23786
24792
|
async function deployVersion(root, ctx, opts, guest) {
|
|
23787
24793
|
requireToken(ctx);
|
|
23788
24794
|
const project = readProject(root);
|
|
23789
24795
|
if (!project?.projectId) throw new CliError(messages(root)("notLinked"), 1, "not_linked");
|
|
23790
24796
|
const message = (opts.message ?? "").trim() || "update";
|
|
23791
|
-
const { archive, info } = await prepare(root, ctx, guest ? GUEST_MAX_BYTES : Number.POSITIVE_INFINITY);
|
|
24797
|
+
const { archive, info, hasSql } = await prepare(root, ctx, guest ? GUEST_MAX_BYTES : Number.POSITIVE_INFINITY);
|
|
23792
24798
|
const t = messages(root);
|
|
24799
|
+
const wait = opts.live || opts.wait !== false;
|
|
24800
|
+
let live = Boolean(opts.live);
|
|
24801
|
+
if (!guest && hasSql) out(t("sqlBeforeUpload"));
|
|
24802
|
+
if (!guest && wait && !live && isInteractive()) live = await askYes(t("askLiveFirst"));
|
|
23793
24803
|
out(t("deployTitle"));
|
|
23794
24804
|
out();
|
|
23795
24805
|
out(rows([[t("project"), project.name ?? project.projectId], [t("message"), message], ...info]));
|
|
@@ -23816,11 +24826,83 @@ async function deployVersion(root, ctx, opts, guest) {
|
|
|
23816
24826
|
[t("preview"), res.previewUrl]
|
|
23817
24827
|
])
|
|
23818
24828
|
);
|
|
23819
|
-
out();
|
|
23820
|
-
out(t("nextStep"));
|
|
23821
|
-
out(t("followBuild"));
|
|
23822
|
-
out(t("thenPromote", { n: res.number }));
|
|
23823
24829
|
pageHint(res, root);
|
|
24830
|
+
out();
|
|
24831
|
+
if (!wait) {
|
|
24832
|
+
out(t("nextStep"));
|
|
24833
|
+
out(t("followBuild"));
|
|
24834
|
+
out(t("thenPromote", { n: res.number }));
|
|
24835
|
+
return;
|
|
24836
|
+
}
|
|
24837
|
+
await afterBuild(root, ctx, project.projectId, res.number, { live, pollMs: opts.pollMs ?? 3e3 });
|
|
24838
|
+
}
|
|
24839
|
+
var sleep3 = (ms2) => new Promise((r) => setTimeout(r, ms2));
|
|
24840
|
+
async function poll(root, ctx, projectId, n2, pollMs, maxMs, done) {
|
|
24841
|
+
const end = Date.now() + maxMs;
|
|
24842
|
+
let last = "";
|
|
24843
|
+
for (; ; ) {
|
|
24844
|
+
const s = await fetchStatus(ctx, projectId);
|
|
24845
|
+
if (done(s)) return s;
|
|
24846
|
+
const sqlRuns = s.latest?.migrationStatus === "queued" || s.latest?.migrationStatus === "running";
|
|
24847
|
+
const state = sqlRuns ? messages(root)("sqlRunningState") : s.latest?.status === "queued" && s.queue.position > 0 ? queueText(s.queue.position, root) : stateName(s.latest?.status ?? "queued", root);
|
|
24848
|
+
if (state !== last) out(messages(root)("waitState", { n: n2, s: state }));
|
|
24849
|
+
last = state;
|
|
24850
|
+
if (Date.now() >= end) return null;
|
|
24851
|
+
await sleep3(pollMs);
|
|
24852
|
+
}
|
|
24853
|
+
}
|
|
24854
|
+
async function afterBuild(root, ctx, projectId, n2, o) {
|
|
24855
|
+
const t = messages(root);
|
|
24856
|
+
out(t("waitBuild", { n: n2 }));
|
|
24857
|
+
const built = await poll(root, ctx, projectId, n2, o.pollMs, BUILD_WAIT_MS, (s) => !s.latest || s.latest.number !== n2 || !["queued", "building"].includes(s.latest.status));
|
|
24858
|
+
out();
|
|
24859
|
+
if (!built) {
|
|
24860
|
+
out(t("buildSlow", { n: n2 }));
|
|
24861
|
+
out(t("followBuild"));
|
|
24862
|
+
out(t("thenPromote", { n: n2 }));
|
|
24863
|
+
return;
|
|
24864
|
+
}
|
|
24865
|
+
const ready = built.latest?.number === n2 && built.latest.status === "ready" && built.project.liveVersion !== n2;
|
|
24866
|
+
const sqlWaits = ready && built.latest?.migrationStatus === "waiting";
|
|
24867
|
+
let approval = null;
|
|
24868
|
+
let live = o.live;
|
|
24869
|
+
if (sqlWaits) {
|
|
24870
|
+
if (built.latest?.preview) out(t("showPreview", { url: built.latest.preview }));
|
|
24871
|
+
approval = await approveSqlStep(root, ctx, projectId, n2);
|
|
24872
|
+
if (!approval) {
|
|
24873
|
+
if (isInteractive()) out(t("promoteLater", { n: n2 }));
|
|
24874
|
+
return;
|
|
24875
|
+
}
|
|
24876
|
+
live = true;
|
|
24877
|
+
}
|
|
24878
|
+
if (ready && !live && isInteractive()) {
|
|
24879
|
+
if (built.latest?.preview) out(t("showPreview", { url: built.latest.preview }));
|
|
24880
|
+
live = await askYes(t("askLiveNow", { n: n2 }));
|
|
24881
|
+
}
|
|
24882
|
+
if (!ready || !live) {
|
|
24883
|
+
if (ready && !live && isInteractive()) {
|
|
24884
|
+
out(t("promoteLater", { n: n2 }));
|
|
24885
|
+
return;
|
|
24886
|
+
}
|
|
24887
|
+
printStatus(root, ctx, projectId, built);
|
|
24888
|
+
if (built.latest?.number === n2 && built.latest.status === "failed") process.exitCode = 1;
|
|
24889
|
+
return;
|
|
24890
|
+
}
|
|
24891
|
+
await apiRequest(ctx, "/api/cli/promote", null, { method: "POST", body: { projectId, number: n2, ...approval } });
|
|
24892
|
+
out(t("promoteQueued", { n: n2 }));
|
|
24893
|
+
if (approval) out(t("sqlFirst", { n: n2 }));
|
|
24894
|
+
const after = await poll(root, ctx, projectId, n2, o.pollMs, LIVE_WAIT_MS, (s) => s.latest?.migrationStatus === "failed" || !s.latest?.goingLive && (s.project.liveVersion === n2 || Boolean(s.latest?.wentBack)));
|
|
24895
|
+
out();
|
|
24896
|
+
if (after?.project.liveVersion === n2 && !after.latest?.wentBack) {
|
|
24897
|
+
out(t("liveNow", { n: n2, url: after.project.url ?? "" }));
|
|
24898
|
+
return;
|
|
24899
|
+
}
|
|
24900
|
+
if (!after) {
|
|
24901
|
+
out(t("goingLive", { n: n2 }));
|
|
24902
|
+
return;
|
|
24903
|
+
}
|
|
24904
|
+
printStatus(root, ctx, projectId, after);
|
|
24905
|
+
process.exitCode = 1;
|
|
23824
24906
|
}
|
|
23825
24907
|
function pageHint(res, root) {
|
|
23826
24908
|
if (!res.page) return;
|
|
@@ -23878,10 +24960,15 @@ async function claimCommand(root, ctx, opts) {
|
|
|
23878
24960
|
out(t("claimLink", { url: url2 }));
|
|
23879
24961
|
}
|
|
23880
24962
|
|
|
24963
|
+
// src/commands/pull.ts
|
|
24964
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
24965
|
+
import { existsSync as existsSync9, readdirSync as readdirSync5, rmSync } from "fs";
|
|
24966
|
+
import { join as join9 } from "path";
|
|
24967
|
+
|
|
23881
24968
|
// src/commands/samples.ts
|
|
23882
24969
|
import { createInterface as createInterface3 } from "readline/promises";
|
|
23883
|
-
import { existsSync as
|
|
23884
|
-
import { dirname, join as
|
|
24970
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, readdirSync as readdirSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
24971
|
+
import { dirname as dirname2, join as join8, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
|
|
23885
24972
|
import { gunzipSync } from "zlib";
|
|
23886
24973
|
var SAMPLES = [
|
|
23887
24974
|
{ key: "landing", title: "Landing page: a full one-page site with WhatsApp sign-up", stack: "static HTML and CSS" },
|
|
@@ -23902,11 +24989,11 @@ function listSamples(apiUrl) {
|
|
|
23902
24989
|
out(`See them live: ${apiUrl}/samples`);
|
|
23903
24990
|
}
|
|
23904
24991
|
function filesIn(dir) {
|
|
23905
|
-
return
|
|
24992
|
+
return existsSync8(dir) ? readdirSync4(dir).filter((f) => !IGNORED.has(f)) : [];
|
|
23906
24993
|
}
|
|
23907
24994
|
function freeFolder(cwd, key) {
|
|
23908
24995
|
for (let n2 = 1; ; n2++) {
|
|
23909
|
-
const dir =
|
|
24996
|
+
const dir = resolve2(cwd, n2 === 1 ? key : `${key}-${n2}`);
|
|
23910
24997
|
if (!filesIn(dir).length) return dir;
|
|
23911
24998
|
}
|
|
23912
24999
|
}
|
|
@@ -23915,15 +25002,15 @@ async function askWhere(cwd, key, count) {
|
|
|
23915
25002
|
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
23916
25003
|
try {
|
|
23917
25004
|
out(`This folder already has ${count} ${count === 1 ? "file" : "files"}. Where should the ${key} sample go?`);
|
|
23918
|
-
out(` 1) A new folder: ${
|
|
25005
|
+
out(` 1) A new folder: ${relative2(cwd, fresh)}`);
|
|
23919
25006
|
out(" 2) This folder (files with the same name are replaced)");
|
|
23920
25007
|
out(" 3) Cancel");
|
|
23921
25008
|
const choice = (await rl.question("Choose 1, 2 or 3 [1]: ")).trim() || "1";
|
|
23922
25009
|
if (choice === "2") return cwd;
|
|
23923
25010
|
if (choice !== "1") return null;
|
|
23924
|
-
const name = (await rl.question(`Folder name [${
|
|
25011
|
+
const name = (await rl.question(`Folder name [${relative2(cwd, fresh)}]: `)).trim();
|
|
23925
25012
|
if (!name) return fresh;
|
|
23926
|
-
const dir =
|
|
25013
|
+
const dir = resolve2(cwd, name);
|
|
23927
25014
|
if (filesIn(dir).length) throw new CliError(`The folder ${name} is not empty. Run it again and pick another name.`, 1, "not_empty");
|
|
23928
25015
|
return dir;
|
|
23929
25016
|
} finally {
|
|
@@ -23931,7 +25018,7 @@ async function askWhere(cwd, key, count) {
|
|
|
23931
25018
|
}
|
|
23932
25019
|
}
|
|
23933
25020
|
async function downloadSample(ctx, key, root) {
|
|
23934
|
-
|
|
25021
|
+
mkdirSync4(root, { recursive: true });
|
|
23935
25022
|
let res;
|
|
23936
25023
|
try {
|
|
23937
25024
|
res = await fetch(`${ctx.apiUrl}/samples-src/${key}.tar.gz`, {
|
|
@@ -23953,15 +25040,15 @@ function extractInto(gz, root, damaged) {
|
|
|
23953
25040
|
} catch {
|
|
23954
25041
|
throw new CliError(damaged, 1, "api");
|
|
23955
25042
|
}
|
|
23956
|
-
|
|
23957
|
-
const base =
|
|
25043
|
+
mkdirSync4(root, { recursive: true });
|
|
25044
|
+
const base = resolve2(root);
|
|
23958
25045
|
let written = 0;
|
|
23959
25046
|
for (const e2 of entries) {
|
|
23960
25047
|
if (e2.type !== "0" && e2.type !== "\0") continue;
|
|
23961
|
-
const target =
|
|
23962
|
-
if (target !== base && !target.startsWith(base +
|
|
23963
|
-
|
|
23964
|
-
|
|
25048
|
+
const target = resolve2(base, e2.name);
|
|
25049
|
+
if (target !== base && !target.startsWith(base + sep2)) continue;
|
|
25050
|
+
mkdirSync4(dirname2(target), { recursive: true });
|
|
25051
|
+
writeFileSync6(target, e2.data);
|
|
23965
25052
|
written++;
|
|
23966
25053
|
}
|
|
23967
25054
|
return written;
|
|
@@ -23972,7 +25059,7 @@ async function samplesCommand(cwd, ctx, key, opts = {}) {
|
|
|
23972
25059
|
if (!sample) throw new CliError(messages()("noSampleNamed", { key }), 1, "not_found");
|
|
23973
25060
|
let root;
|
|
23974
25061
|
if (opts.folder) {
|
|
23975
|
-
root =
|
|
25062
|
+
root = resolve2(cwd, opts.folder);
|
|
23976
25063
|
if (filesIn(root).length && !opts.force) throw new CliError(`The folder ${opts.folder} is not empty. Run: npx deployai@latest samples ${sample.key}, and it picks a free folder`, 1, "not_empty");
|
|
23977
25064
|
} else {
|
|
23978
25065
|
const here = filesIn(cwd);
|
|
@@ -23984,13 +25071,13 @@ async function samplesCommand(cwd, ctx, key, opts = {}) {
|
|
|
23984
25071
|
} else root = freeFolder(cwd, sample.key);
|
|
23985
25072
|
}
|
|
23986
25073
|
const written = await downloadSample(ctx, sample.key, root);
|
|
23987
|
-
const base =
|
|
23988
|
-
const hasPackage =
|
|
23989
|
-
out(base ===
|
|
25074
|
+
const base = resolve2(root);
|
|
25075
|
+
const hasPackage = existsSync8(join8(base, "package.json"));
|
|
25076
|
+
out(base === resolve2(cwd) ? `Downloaded the ${sample.key} sample: ${written} files.` : `Downloaded the ${sample.key} sample into the new folder ${relative2(cwd, base)}: ${written} files. Work in that folder from now on.`);
|
|
23990
25077
|
out("");
|
|
23991
25078
|
const t = messages(base);
|
|
23992
25079
|
out(t("nextSteps"));
|
|
23993
|
-
if (base !==
|
|
25080
|
+
if (base !== resolve2(cwd)) out(` cd ${JSON.stringify(relative2(cwd, base))}`);
|
|
23994
25081
|
if (hasPackage) out(" npm install");
|
|
23995
25082
|
out(" npx deployai@latest check");
|
|
23996
25083
|
if (ctx.config.token) {
|
|
@@ -24003,15 +25090,23 @@ async function samplesCommand(cwd, ctx, key, opts = {}) {
|
|
|
24003
25090
|
|
|
24004
25091
|
// src/commands/pull.ts
|
|
24005
25092
|
var MAX_BYTES2 = 50 * 1024 * 1024;
|
|
24006
|
-
async function pullCommand(root, ctx) {
|
|
25093
|
+
async function pullCommand(root, ctx, opts = {}) {
|
|
24007
25094
|
const t = messages(root);
|
|
24008
25095
|
const projectId = readProject(root)?.projectId;
|
|
24009
25096
|
if (!projectId) throw new CliError(t("pullNotLinked"), 1, "not_linked");
|
|
24010
25097
|
if (filesIn(root).length) throw new CliError(t("pullNotEmpty"), 1, "not_empty");
|
|
25098
|
+
requireToken(ctx);
|
|
25099
|
+
if (opts.history) return pullHistory(root, ctx, projectId);
|
|
25100
|
+
const n2 = extractInto(await fetchSource(root, ctx, projectId), root, t("pullDamaged"));
|
|
25101
|
+
out(t("pulled", { n: n2, v: lastVersion ?? "?" }));
|
|
25102
|
+
}
|
|
25103
|
+
var lastVersion = null;
|
|
25104
|
+
async function fetchSource(root, ctx, projectId, version2) {
|
|
25105
|
+
const t = messages(root);
|
|
24011
25106
|
const token = requireToken(ctx);
|
|
24012
25107
|
let res;
|
|
24013
25108
|
try {
|
|
24014
|
-
res = await fetch(`${ctx.apiUrl}/api/cli/source?projectId=${encodeURIComponent(projectId)}`, { headers: { "User-Agent": userAgent(ctx.config), Authorization: `Bearer ${token}` }, signal: AbortSignal.timeout(12e4) });
|
|
25109
|
+
res = await fetch(`${ctx.apiUrl}/api/cli/source?projectId=${encodeURIComponent(projectId)}${version2 ? `&version=${version2}` : ""}`, { headers: { "User-Agent": userAgent(ctx.config), Authorization: `Bearer ${token}` }, signal: AbortSignal.timeout(12e4) });
|
|
24015
25110
|
} catch {
|
|
24016
25111
|
throw new CliError(messages()("unreachable", { url: ctx.apiUrl }), 1, "network");
|
|
24017
25112
|
}
|
|
@@ -24024,142 +25119,69 @@ async function pullCommand(root, ctx) {
|
|
|
24024
25119
|
if (!res.ok) throw new CliError(t("apiError", { code: `HTTP ${res.status}` }), 1, "api");
|
|
24025
25120
|
const gz = Buffer.from(await res.arrayBuffer());
|
|
24026
25121
|
if (gz.length > MAX_BYTES2) throw new CliError(t("pullTooLarge"), 1, "too_large");
|
|
24027
|
-
|
|
24028
|
-
|
|
25122
|
+
lastVersion = res.headers.get("X-DeployAI-Version");
|
|
25123
|
+
return gz;
|
|
24029
25124
|
}
|
|
24030
|
-
|
|
24031
|
-
|
|
24032
|
-
|
|
24033
|
-
|
|
24034
|
-
|
|
24035
|
-
return id;
|
|
24036
|
-
}
|
|
24037
|
-
function parseVersion(input2) {
|
|
24038
|
-
const m = /^v?(\d+)$/i.exec(input2.trim());
|
|
24039
|
-
const n2 = m ? Number(m[1]) : NaN;
|
|
24040
|
-
if (!Number.isInteger(n2) || n2 <= 0) throw new CliError(messages()("notVersion", { input: input2 }), 1, "usage");
|
|
24041
|
-
return n2;
|
|
24042
|
-
}
|
|
24043
|
-
function shortDate(iso) {
|
|
24044
|
-
const d = new Date(iso);
|
|
24045
|
-
if (Number.isNaN(d.getTime())) return iso;
|
|
24046
|
-
const p = (x) => String(x).padStart(2, "0");
|
|
24047
|
-
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
|
24048
|
-
}
|
|
24049
|
-
async function versionsCommand(root, ctx) {
|
|
24050
|
-
requireToken(ctx);
|
|
24051
|
-
const projectId = linkedProjectId(root);
|
|
24052
|
-
const { versions } = await apiRequest(ctx, `/api/cli/versions?projectId=${encodeURIComponent(projectId)}`, VersionsResponse);
|
|
24053
|
-
if (!versions.length) {
|
|
24054
|
-
out('No versions yet. Run: npx deployai@latest deploy -m "<message>"');
|
|
24055
|
-
return;
|
|
24056
|
-
}
|
|
24057
|
-
const sorted = [...versions].sort((a, b) => b.number - a.number);
|
|
24058
|
-
out("Versions");
|
|
24059
|
-
for (const v of sorted) {
|
|
24060
|
-
const status = v.status === "replaced" ? stateName("replaced", root) : v.status;
|
|
24061
|
-
const cols = [
|
|
24062
|
-
`v${v.number}`.padEnd(6),
|
|
24063
|
-
(v.isLive ? "live" : "").padEnd(6),
|
|
24064
|
-
status.padEnd(10),
|
|
24065
|
-
shortDate(v.createdAt).padEnd(18),
|
|
24066
|
-
formatBytes(v.sizeBytes).padEnd(10),
|
|
24067
|
-
v.message
|
|
24068
|
-
];
|
|
24069
|
-
out(` ${cols.join("")}`);
|
|
24070
|
-
if (v.error) out(` ${v.error}`);
|
|
24071
|
-
if (v.migrationStatus === "waiting") out(` ${messages(root)("sqlWaitingLine", { url: versionsPage(ctx, projectId) })}`);
|
|
25125
|
+
var git = (root, args, env = {}) => spawnSync2("git", args, { cwd: root, encoding: "utf8", env: { ...process.env, ...env } });
|
|
25126
|
+
function clearTree(root) {
|
|
25127
|
+
for (const name of readdirSync5(root)) {
|
|
25128
|
+
if (name === ".git" || name === ".deployai") continue;
|
|
25129
|
+
rmSync(join9(root, name), { recursive: true, force: true });
|
|
24072
25130
|
}
|
|
24073
25131
|
}
|
|
24074
|
-
function
|
|
24075
|
-
return `${ctx.apiUrl}/project/${encodeURIComponent(projectId)}/versions`;
|
|
24076
|
-
}
|
|
24077
|
-
async function changeLiveCommand(root, ctx, version2, kind) {
|
|
24078
|
-
requireToken(ctx);
|
|
24079
|
-
const projectId = linkedProjectId(root);
|
|
24080
|
-
const number4 = parseVersion(version2);
|
|
24081
|
-
await apiRequest(ctx, `/api/cli/${kind}`, null, { method: "POST", body: { projectId, number: number4 } });
|
|
25132
|
+
async function pullHistory(root, ctx, projectId) {
|
|
24082
25133
|
const t = messages(root);
|
|
24083
|
-
|
|
24084
|
-
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
const
|
|
24090
|
-
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24095
|
-
|
|
24096
|
-
|
|
24097
|
-
|
|
24098
|
-
|
|
24099
|
-
|
|
24100
|
-
|
|
24101
|
-
[t("liveVersion"), p.liveVersion ? `v${p.liveVersion}` : t("none")],
|
|
24102
|
-
// A newer upload than the live one: its state, so "follow the build" after deploy has something to follow.
|
|
24103
|
-
...newer ? [[t("newestVersion"), `v${newer.number} ${stateName(newer.status, root)}`]] : [],
|
|
24104
|
-
[t("queue"), s.queue.running ? t("buildingNow") : s.queue.position > 0 ? queueText(s.queue.position, root) : t("idle")]
|
|
24105
|
-
])
|
|
24106
|
-
);
|
|
24107
|
-
if (s.latest?.goingLive) {
|
|
24108
|
-
out();
|
|
24109
|
-
out(t("goingLive", { n: s.latest.number }));
|
|
24110
|
-
return;
|
|
24111
|
-
}
|
|
24112
|
-
if (s.latest?.wentBack) {
|
|
24113
|
-
out();
|
|
24114
|
-
out(t("wentBack", { n: s.latest.number, prev: s.latest.wentBack.previous, reason: s.latest.wentBack.reason }));
|
|
24115
|
-
return;
|
|
24116
|
-
}
|
|
24117
|
-
if (newer?.status === "ready") {
|
|
24118
|
-
out();
|
|
24119
|
-
out(t("nextStep"));
|
|
24120
|
-
out(t("askOwner", { n: newer.number }));
|
|
24121
|
-
if (s.latest?.preview) out(t("showPreview", { url: s.latest.preview }));
|
|
24122
|
-
out(t("promoteReady", { n: newer.number }));
|
|
24123
|
-
}
|
|
24124
|
-
if (s.latest?.migrationStatus === "waiting") {
|
|
24125
|
-
out();
|
|
24126
|
-
out(t("sqlWaitingLine", { url: versionsPage(ctx, projectId) }));
|
|
24127
|
-
}
|
|
24128
|
-
if (s.latest?.status !== "failed") return;
|
|
24129
|
-
out();
|
|
24130
|
-
out(t("buildFailed", { n: s.latest.number }));
|
|
24131
|
-
if (s.latest.error) out(` ${s.latest.error}`);
|
|
24132
|
-
if (s.latest.logTail) {
|
|
24133
|
-
out();
|
|
24134
|
-
out(t("buildLogTail"));
|
|
24135
|
-
for (const line of s.latest.logTail.split("\n")) out(` ${line}`);
|
|
24136
|
-
}
|
|
24137
|
-
out();
|
|
24138
|
-
out(t(telemetryEnabled(ctx.config) ? "buildFixHint" : "buildFixHintNoNote"));
|
|
25134
|
+
if (git(root, ["--version"]).status !== 0) throw new CliError(t("pullNoGit"), 1, "usage");
|
|
25135
|
+
const { versions } = await apiRequest(ctx, `/api/cli/versions?projectId=${encodeURIComponent(projectId)}`, VersionsResponse);
|
|
25136
|
+
const live = versions.find((v) => v.isLive)?.number ?? Math.max(0, ...versions.filter((v) => v.status === "ready").map((v) => v.number));
|
|
25137
|
+
const chosen = versions.filter((v) => v.number <= live && v.status !== "failed" && v.status !== "queued").sort((a, b) => a.number - b.number);
|
|
25138
|
+
if (!chosen.length) throw new CliError(t("pullNoSource"), 1, "not_found");
|
|
25139
|
+
if (!existsSync9(join9(root, ".git")) && git(root, ["init", "-q"]).status !== 0) throw new CliError(t("pullNoGit"), 1, "usage");
|
|
25140
|
+
for (const v of chosen) {
|
|
25141
|
+
const gz = await fetchSource(root, ctx, projectId, v.number).catch(() => null);
|
|
25142
|
+
if (!gz) continue;
|
|
25143
|
+
clearTree(root);
|
|
25144
|
+
extractInto(gz, root, t("pullDamaged"));
|
|
25145
|
+
git(root, ["add", "-A"]);
|
|
25146
|
+
const when = { GIT_AUTHOR_DATE: v.createdAt, GIT_COMMITTER_DATE: v.createdAt };
|
|
25147
|
+
const r = git(root, ["-c", "user.name=DeployAI", "-c", "user.email=versions@deployai.co.il", "commit", "-q", "--allow-empty", "-m", `v${v.number}: ${v.message}`], when);
|
|
25148
|
+
if (r.status !== 0) throw new CliError(`git commit failed for v${v.number}: ${r.stderr.trim()}`, 1, "git");
|
|
25149
|
+
out(` v${v.number} ${v.message}`);
|
|
25150
|
+
}
|
|
25151
|
+
out(t("pulledHistory", { n: chosen.length, v: live }));
|
|
24139
25152
|
}
|
|
24140
25153
|
|
|
24141
25154
|
// src/commands/start.ts
|
|
24142
|
-
import { spawnSync as
|
|
24143
|
-
import { existsSync as
|
|
24144
|
-
import { join as
|
|
25155
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
25156
|
+
import { existsSync as existsSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
25157
|
+
import { join as join11, relative as relative3, resolve as resolve3 } from "path";
|
|
24145
25158
|
|
|
24146
25159
|
// src/commands/starter.ts
|
|
24147
|
-
import { writeFileSync as
|
|
24148
|
-
import { join as
|
|
25160
|
+
import { writeFileSync as writeFileSync7 } from "fs";
|
|
25161
|
+
import { join as join10 } from "path";
|
|
24149
25162
|
var esc2 = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
24150
|
-
|
|
24151
|
-
|
|
24152
|
-
|
|
24153
|
-
|
|
24154
|
-
|
|
25163
|
+
var TEXT = {
|
|
25164
|
+
he: { title: "\u05D4\u05D0\u05EA\u05E8 \u05E9\u05DC\u05D9", soon: "\u05D4\u05D0\u05EA\u05E8 \u05D1\u05D1\u05E0\u05D9\u05D9\u05D4, \u05D1\u05E7\u05E8\u05D5\u05D1 \u05DB\u05D0\u05DF." },
|
|
25165
|
+
ar: { title: "\u0645\u0648\u0642\u0639\u064A", soon: "\u0627\u0644\u0645\u0648\u0642\u0639 \u0642\u064A\u062F \u0627\u0644\u0625\u0646\u0634\u0627\u0621\u060C \u0642\u0631\u064A\u0628\u064B\u0627 \u0647\u0646\u0627." },
|
|
25166
|
+
en: { title: "My site", soon: "This site is being built. Coming soon." }
|
|
25167
|
+
};
|
|
25168
|
+
function page(name, lang, stack) {
|
|
25169
|
+
const main2 = stack?.langs[0] ?? lang;
|
|
25170
|
+
const dir = stack?.dir ?? (main2 === "en" ? "ltr" : "rtl");
|
|
25171
|
+
const fonts = stack ? stack.fonts : main2 === "he" ? ["Heebo"] : [];
|
|
25172
|
+
const title = esc2(name || TEXT[main2].title);
|
|
25173
|
+
const soon = TEXT[main2].soon;
|
|
25174
|
+
const font = fonts.length ? `<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
25175
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?${fonts.map((f) => `family=${f.replace(/ /g, "+")}:wght@400;700`).join("&")}&display=swap">
|
|
25176
|
+
` : "";
|
|
24155
25177
|
return `<!doctype html>
|
|
24156
|
-
<html lang="${
|
|
25178
|
+
<html lang="${main2}" dir="${dir}">
|
|
24157
25179
|
<head>
|
|
24158
25180
|
<meta charset="utf-8">
|
|
24159
25181
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
24160
25182
|
<title>${title}</title>
|
|
24161
25183
|
${font}<style>
|
|
24162
|
-
body { margin: 0; min-height: 100vh; display: grid; place-items: center; font-family: ${
|
|
25184
|
+
body { margin: 0; min-height: 100vh; display: grid; place-items: center; font-family: ${fonts.map((f) => `${f}, `).join("")}system-ui, sans-serif; background: #fafafa; color: #18181b; }
|
|
24163
25185
|
main { padding: 1.5rem; text-align: center; }
|
|
24164
25186
|
h1 { margin: 0 0 .5rem; font-size: 2rem; }
|
|
24165
25187
|
</style>
|
|
@@ -24183,9 +25205,9 @@ DeployAI wrote this page so the folder starts as a working site. Build the owner
|
|
|
24183
25205
|
- Nothing from this starter stays: no "coming soon" text goes live.
|
|
24184
25206
|
- Delete this README or replace it with notes about the site.
|
|
24185
25207
|
`;
|
|
24186
|
-
function writeStarter(root, name, lang) {
|
|
24187
|
-
|
|
24188
|
-
|
|
25208
|
+
function writeStarter(root, name, lang, stack) {
|
|
25209
|
+
writeFileSync7(join10(root, "index.html"), page(name ?? "", lang, stack));
|
|
25210
|
+
writeFileSync7(join10(root, "README.md"), README);
|
|
24189
25211
|
}
|
|
24190
25212
|
|
|
24191
25213
|
// src/commands/start.ts
|
|
@@ -24206,7 +25228,7 @@ async function fetchStart(ctx, id) {
|
|
|
24206
25228
|
return data;
|
|
24207
25229
|
}
|
|
24208
25230
|
function install(root) {
|
|
24209
|
-
const r =
|
|
25231
|
+
const r = spawnSync3("npm", ["install"], { cwd: root, stdio: "inherit", shell: process.platform === "win32" });
|
|
24210
25232
|
return r.status === 0;
|
|
24211
25233
|
}
|
|
24212
25234
|
async function startCommand(cwd, ctx, id, opts = {}) {
|
|
@@ -24215,36 +25237,53 @@ async function startCommand(cwd, ctx, id, opts = {}) {
|
|
|
24215
25237
|
const { kind, choices, agent } = await fetchStart(ctx, key);
|
|
24216
25238
|
const sample = choices.sampleKey ? SAMPLES.find((s) => s.key === choices.sampleKey) : void 0;
|
|
24217
25239
|
if (choices.sampleKey && !sample) throw new CliError(messages()("unknownSample", { key: choices.sampleKey }), 1, "not_found");
|
|
24218
|
-
const fresh = kind === "new" || kind === "guest" && sample;
|
|
24219
|
-
const here =
|
|
25240
|
+
const fresh = kind === "new" || kind === "migrate" || kind === "guest" && sample;
|
|
25241
|
+
const here = resolve3(cwd);
|
|
24220
25242
|
const sameSite = Boolean(choices.projectId && readProject(here)?.projectId === choices.projectId);
|
|
24221
25243
|
const root = fresh && filesIn(here).length && !opts.here && !sameSite ? freeFolder(here, choices.slug ?? sample?.key ?? "site") : here;
|
|
24222
25244
|
const done = [];
|
|
24223
25245
|
const empty = !filesIn(root).length;
|
|
24224
25246
|
const starter = (kind === "new" || kind === "guest") && !sample && empty;
|
|
24225
|
-
const steps = startSteps(kind, { emptyFolder: kind === "update" && empty, starter });
|
|
25247
|
+
const steps = startSteps(kind, { emptyFolder: kind === "update" && empty, starter, managed: Boolean(choices.migration?.requestId) });
|
|
24226
25248
|
updateProject(root, { lang: langOf(choices.ownerLanguage) });
|
|
24227
25249
|
const t = messages(root);
|
|
24228
25250
|
if (sample && !sameSite) {
|
|
24229
25251
|
const written = await downloadSample(ctx, sample.key, root);
|
|
24230
25252
|
done.push(t("startDownloaded", { key: sample.key, n: written }));
|
|
24231
|
-
if (
|
|
25253
|
+
if (existsSync10(join11(root, "package.json"))) {
|
|
24232
25254
|
if (opts.install !== false && install(root)) done.push(t("startInstalled"));
|
|
24233
25255
|
else steps.unshift({ cmd: "npm install", say: "Installs the sample's packages." });
|
|
24234
25256
|
}
|
|
24235
25257
|
}
|
|
25258
|
+
if (kind === "migrate" && choices.migration) {
|
|
25259
|
+
writeChoices(root, { ...choices.migration, startId: key });
|
|
25260
|
+
for (const url2 of choices.migration.sourceUrls) {
|
|
25261
|
+
try {
|
|
25262
|
+
const skipped = await migrateScanCommand(root, url2, { max: START_SCAN_PAGES });
|
|
25263
|
+
done.push(t("startScanned", { url: url2, dir: MIGRATION_DIR }));
|
|
25264
|
+
if (skipped) steps.unshift({ cmd: `npx deployai@latest migrate scan ${url2}`, say: `The first scan read ${START_SCAN_PAGES} pages and the site has ${skipped} more: run it now to read up to 1,000, before you plan.` });
|
|
25265
|
+
} catch (e2) {
|
|
25266
|
+
steps.unshift({ cmd: `npx deployai@latest migrate scan ${url2}`, say: `The scan stopped: ${e2.message} Run it again; if it fails again, tell the owner what it said.` });
|
|
25267
|
+
}
|
|
25268
|
+
}
|
|
25269
|
+
}
|
|
24236
25270
|
if (starter) {
|
|
24237
|
-
writeStarter(root, choices.name, langOf(choices.ownerLanguage));
|
|
25271
|
+
writeStarter(root, choices.name, langOf(choices.ownerLanguage), choices.stack);
|
|
24238
25272
|
done.push(t("startStarter"));
|
|
24239
25273
|
}
|
|
24240
|
-
|
|
25274
|
+
const stackText = choices.stack ? stackBlock(choices.stack) : "";
|
|
25275
|
+
if (choices.brief || stackText) {
|
|
24241
25276
|
ensureDeployaiDir(root);
|
|
24242
|
-
|
|
25277
|
+
writeFileSync8(join11(root, BRIEF_FILE), [choices.brief ? `# The owner's details
|
|
24243
25278
|
|
|
24244
25279
|
${choices.brief}
|
|
24245
|
-
`);
|
|
25280
|
+
` : "", stackText].filter(Boolean).join("\n"));
|
|
24246
25281
|
done.push(t("startBrief", { file: BRIEF_FILE }));
|
|
24247
25282
|
}
|
|
25283
|
+
if (choices.stack) {
|
|
25284
|
+
updateProject(root, { stack: choices.stack });
|
|
25285
|
+
done.push(t("startStack", { stack: stackSummary(choices.stack) }));
|
|
25286
|
+
}
|
|
24248
25287
|
if (runInit(root).created.includes("DEPLOYAI.md")) done.push(t("startRules"));
|
|
24249
25288
|
if (choices.projectId) {
|
|
24250
25289
|
const before = readProject(root);
|
|
@@ -24253,16 +25292,24 @@ ${choices.brief}
|
|
|
24253
25292
|
}
|
|
24254
25293
|
out(t("startTitle"));
|
|
24255
25294
|
out();
|
|
24256
|
-
if (root !== here) out(t("startNewFolder", { dir:
|
|
25295
|
+
if (root !== here) out(t("startNewFolder", { dir: relative3(here, root) }));
|
|
24257
25296
|
for (const line of done) out(`- ${line}`);
|
|
24258
25297
|
out();
|
|
24259
25298
|
out("----- Instructions for the agent -----");
|
|
24260
25299
|
out();
|
|
24261
25300
|
if (root !== here) {
|
|
24262
|
-
out(`Work only inside the folder ${
|
|
25301
|
+
out(`Work only inside the folder ${relative3(here, root)} from now on (cd ${JSON.stringify(relative3(here, root))}).`);
|
|
24263
25302
|
out();
|
|
24264
25303
|
}
|
|
24265
25304
|
out(agent.trim());
|
|
25305
|
+
if (stackText) {
|
|
25306
|
+
out();
|
|
25307
|
+
out(stackText.trim());
|
|
25308
|
+
}
|
|
25309
|
+
if (kind === "migrate") {
|
|
25310
|
+
out();
|
|
25311
|
+
out(uiSourcesText());
|
|
25312
|
+
}
|
|
24266
25313
|
out();
|
|
24267
25314
|
out("Then, in this order:");
|
|
24268
25315
|
steps.forEach((s, i) => out(`${i + 1}. ${s.cmd ? `Run ${s.cmd}. ` : ""}${s.say}`));
|
|
@@ -24272,8 +25319,8 @@ ${choices.brief}
|
|
|
24272
25319
|
}
|
|
24273
25320
|
|
|
24274
25321
|
// src/commands/addon.ts
|
|
24275
|
-
import { readFileSync as
|
|
24276
|
-
import { resolve as
|
|
25322
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
25323
|
+
import { resolve as resolve4 } from "path";
|
|
24277
25324
|
function linkedProjectId2(root) {
|
|
24278
25325
|
const id = readProject(root)?.projectId;
|
|
24279
25326
|
if (!id) throw new CliError("This folder is not linked to a DeployAI site. Run: npx deployai@latest login, then npx deployai@latest link", 1, "not_linked");
|
|
@@ -24303,7 +25350,27 @@ async function addonsCommand(root, ctx) {
|
|
|
24303
25350
|
out("Every add-on of this site is done or skipped. To run one again: npx deployai@latest addon run <name>");
|
|
24304
25351
|
return;
|
|
24305
25352
|
}
|
|
24306
|
-
out(`Next: ${r.next}.
|
|
25353
|
+
out(`Next: ${r.next}. Run them all in one go: npx deployai@latest addons run (or one: npx deployai@latest addon run <name>)`);
|
|
25354
|
+
}
|
|
25355
|
+
async function addonsRunCommand(root, ctx) {
|
|
25356
|
+
requireToken(ctx);
|
|
25357
|
+
const projectId = linkedProjectId2(root);
|
|
25358
|
+
const r = await apiRequest(ctx, `/api/cli/addons?projectId=${encodeURIComponent(projectId)}`, AddonsResponse);
|
|
25359
|
+
if (!r.open) {
|
|
25360
|
+
out("The DeployAI marketplace is not open yet, so this site has no add-ons to run.");
|
|
25361
|
+
return;
|
|
25362
|
+
}
|
|
25363
|
+
const todo = r.addons.filter((a) => a.owned && a.status !== "done" && a.status !== "skipped");
|
|
25364
|
+
if (!todo.length) {
|
|
25365
|
+
updateProject(root, { addonsAll: false });
|
|
25366
|
+
out(r.addons.some((a) => a.owned) ? "Every add-on of this site is done or skipped. To run one again: npx deployai@latest addon run <name>" : "This site has no add-ons yet. See them: npx deployai@latest addons");
|
|
25367
|
+
return;
|
|
25368
|
+
}
|
|
25369
|
+
updateProject(root, { addonsAll: true });
|
|
25370
|
+
out(`Running every add-on of this site in one go: ${todo.map((a) => a.key).join(", ")}.`);
|
|
25371
|
+
out("Do each one fully, run npx deployai@latest check after it, and report it with addon done as it says; the next one starts right after. Tell the owner in one line which add-on you are on.");
|
|
25372
|
+
out();
|
|
25373
|
+
await addonNextCommand(root, ctx);
|
|
24307
25374
|
}
|
|
24308
25375
|
async function addonBuyCommand(root, ctx, key) {
|
|
24309
25376
|
requireToken(ctx);
|
|
@@ -24353,7 +25420,7 @@ async function addonDoneCommand(root, ctx, runId, opts) {
|
|
|
24353
25420
|
let report;
|
|
24354
25421
|
if (opts.report) {
|
|
24355
25422
|
try {
|
|
24356
|
-
report = JSON.parse(
|
|
25423
|
+
report = JSON.parse(readFileSync8(resolve4(root, opts.report), "utf8"));
|
|
24357
25424
|
} catch {
|
|
24358
25425
|
throw new CliError(`Cannot read the report file ${opts.report} as JSON.`, 1, "usage");
|
|
24359
25426
|
}
|
|
@@ -24363,8 +25430,13 @@ async function addonDoneCommand(root, ctx, runId, opts) {
|
|
|
24363
25430
|
if (!body.success) throw new CliError("Status must be done, failed or skipped.", 1, "usage");
|
|
24364
25431
|
const r = await apiRequest(ctx, `/api/cli/addons/runs/${encodeURIComponent(runId.trim())}`, AddonDoneResponse, { method: "POST", body: body.data });
|
|
24365
25432
|
out(`Saved: add-on ${body.data.status}.`);
|
|
24366
|
-
|
|
24367
|
-
|
|
25433
|
+
const all = readProject(root)?.addonsAll === true;
|
|
25434
|
+
if (r.next && all) out(`Next: ${r.next}. Run npx deployai@latest check, then at once: npx deployai@latest addon next`);
|
|
25435
|
+
else if (r.next) out(`Next: ${r.next}. Tell the site owner what is next, and only with their OK run: npx deployai@latest addon next`);
|
|
25436
|
+
else {
|
|
25437
|
+
if (all) updateProject(root, { addonsAll: false });
|
|
25438
|
+
out("Every add-on of this site is done or skipped.");
|
|
25439
|
+
}
|
|
24368
25440
|
}
|
|
24369
25441
|
|
|
24370
25442
|
// src/commands/speed.ts
|
|
@@ -24404,6 +25476,65 @@ async function speedCommand(ctx, url2, opts) {
|
|
|
24404
25476
|
out(`Full report: ${ctx.apiUrl}/tools/r/${id}`);
|
|
24405
25477
|
}
|
|
24406
25478
|
|
|
25479
|
+
// src/commands/blocks.ts
|
|
25480
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync5, writeFileSync as writeFileSync9 } from "fs";
|
|
25481
|
+
import { dirname as dirname3, resolve as resolve5, sep as sep3 } from "path";
|
|
25482
|
+
import { gunzipSync as gunzipSync2 } from "zlib";
|
|
25483
|
+
var BLOCKS = [
|
|
25484
|
+
{ key: "inbox", title: "Contact form with the site's own messages page for the owner, and an email on each message (D1)" },
|
|
25485
|
+
{ key: "blog", title: "Blog: posts as Markdown files, categories, tags, authors, pages, RSS and article data for search" }
|
|
25486
|
+
];
|
|
25487
|
+
var MAX_BYTES3 = 5 * 1024 * 1024;
|
|
25488
|
+
async function blocksCommand(root, ctx, name) {
|
|
25489
|
+
if (!name) {
|
|
25490
|
+
out("DeployAI blocks");
|
|
25491
|
+
out("");
|
|
25492
|
+
out(rows(BLOCKS.map((b) => [b.key, b.title])));
|
|
25493
|
+
out("");
|
|
25494
|
+
out("Add one: npx deployai@latest blocks <name>");
|
|
25495
|
+
return;
|
|
25496
|
+
}
|
|
25497
|
+
const block = BLOCKS.find((b) => b.key === name.trim().toLowerCase());
|
|
25498
|
+
if (!block) throw new CliError(`No block named ${name}. See the list: npx deployai@latest blocks`, 1, "not_found");
|
|
25499
|
+
let res;
|
|
25500
|
+
try {
|
|
25501
|
+
res = await fetch(`${ctx.apiUrl}/blocks-src/${block.key}.tar.gz`, { headers: { "User-Agent": userAgent(ctx.config) }, signal: AbortSignal.timeout(6e4) });
|
|
25502
|
+
} catch {
|
|
25503
|
+
throw new CliError(messages()("unreachable", { url: ctx.apiUrl }), 1, "network");
|
|
25504
|
+
}
|
|
25505
|
+
if (!res.ok) throw new CliError(`Could not download the ${block.key} block (HTTP ${res.status}). Try again.`, 1, "api");
|
|
25506
|
+
const gz = Buffer.from(await res.arrayBuffer());
|
|
25507
|
+
if (gz.length > MAX_BYTES3) throw new CliError("The block download is too large.", 1, "api");
|
|
25508
|
+
let entries;
|
|
25509
|
+
try {
|
|
25510
|
+
entries = readTar(gunzipSync2(gz, { maxOutputLength: MAX_BYTES3 * 4 }));
|
|
25511
|
+
} catch {
|
|
25512
|
+
throw new CliError("The block download is damaged. Try again.", 1, "api");
|
|
25513
|
+
}
|
|
25514
|
+
const base = resolve5(root);
|
|
25515
|
+
const written = [];
|
|
25516
|
+
const kept = [];
|
|
25517
|
+
for (const e2 of entries) {
|
|
25518
|
+
if (e2.type !== "0" && e2.type !== "\0") continue;
|
|
25519
|
+
const target = resolve5(base, e2.name);
|
|
25520
|
+
if (target === base || !target.startsWith(base + sep3)) continue;
|
|
25521
|
+
if (existsSync11(target)) {
|
|
25522
|
+
kept.push(e2.name);
|
|
25523
|
+
continue;
|
|
25524
|
+
}
|
|
25525
|
+
mkdirSync5(dirname3(target), { recursive: true });
|
|
25526
|
+
writeFileSync9(target, e2.data);
|
|
25527
|
+
written.push(e2.name);
|
|
25528
|
+
}
|
|
25529
|
+
out(`Added the ${block.key} block: ${written.length} files.`);
|
|
25530
|
+
written.forEach((f) => out(` + ${f}`));
|
|
25531
|
+
if (kept.length) {
|
|
25532
|
+
out(`These ${kept.length} files already exist and were left as they are; merge what the block needs into them:`);
|
|
25533
|
+
kept.forEach((f) => out(` = ${f}`));
|
|
25534
|
+
}
|
|
25535
|
+
out(`Read .deployai/blocks/${block.key}.md and follow it: it says what to wire and what to set.`);
|
|
25536
|
+
}
|
|
25537
|
+
|
|
24407
25538
|
// src/commands/env.ts
|
|
24408
25539
|
async function readStdin() {
|
|
24409
25540
|
const chunks = [];
|
|
@@ -24447,7 +25578,7 @@ function buildProgram() {
|
|
|
24447
25578
|
if (lang === "he" || lang === "en") process.env.DEPLOYAI_LANG = lang;
|
|
24448
25579
|
}).showHelpAfterError();
|
|
24449
25580
|
const g = (cmd) => cmd.optsWithGlobals();
|
|
24450
|
-
const root = (cmd) =>
|
|
25581
|
+
const root = (cmd) => resolve6(g(cmd).dir ?? process.cwd());
|
|
24451
25582
|
const ctx = (cmd) => apiContext(g(cmd).api);
|
|
24452
25583
|
program.command("init").description("create DEPLOYAI.md and .deployai/ guard files").option("--force", "overwrite DEPLOYAI.md").option("--no-agent-files", "do not add the DEPLOYAI.md line to AGENTS.md and CLAUDE.md").action((opts, cmd) => initCommand(root(cmd), opts));
|
|
24453
25584
|
program.command("inspect").description("show framework, package manager, language, database, storage").option("--json", "machine readable output").action((opts, cmd) => inspectCommand(root(cmd), opts));
|
|
@@ -24464,14 +25595,28 @@ function buildProgram() {
|
|
|
24464
25595
|
program.command("link").description("link this folder to a DeployAI project").argument("[project]", "project slug or id").option("--create <name>", "create a new project and link it").action(
|
|
24465
25596
|
(project, opts, cmd) => linkCommand(root(cmd), ctx(cmd), project, opts)
|
|
24466
25597
|
);
|
|
24467
|
-
program.command("deploy").description("check, pack and upload the source, then print the preview address").option("-m, --message <message>", "version message", "update").option("--fixed <what>", "after a failed version: one sentence on what you changed to fix it, no code (helps us catch it for others)").option("--guest", "without login: deploy as a temporary site, deleted after the days we set unless claimed").action((opts, cmd) => deployCommand(root(cmd), ctx(cmd), opts));
|
|
24468
|
-
program.command("pull").description("download the code of the linked site's live version into this empty folder (needs login)").action((
|
|
25598
|
+
program.command("deploy").description("check, pack and upload the source, wait for the build, then put it live or print the preview address").option("-m, --message <message>", "version message", "update").option("--fixed <what>", "after a failed version: one sentence on what you changed to fix it, no code (helps us catch it for others)").option("--guest", "without login: deploy as a temporary site, deleted after the days we set unless claimed").option("--live", "put it live when the build is done; only after the owner said yes").option("--no-wait", "upload and return, without waiting for the build").action((opts, cmd) => deployCommand(root(cmd), ctx(cmd), opts));
|
|
25599
|
+
program.command("pull").description("download the code of the linked site's live version into this empty folder (needs login)").option("--history", "every version up to the live one as git commits, oldest first").action((opts, cmd) => pullCommand(root(cmd), ctx(cmd), opts));
|
|
24469
25600
|
program.command("claim").description("print this folder's temporary site keep link again; --email mails it, with a reminder before the delete").option("--email <address>", "the owner's email for the link and the reminder").action((opts, cmd) => claimCommand(root(cmd), ctx(cmd), opts));
|
|
24470
25601
|
program.command("versions").description("list versions").action((_opts, cmd) => versionsCommand(root(cmd), ctx(cmd)));
|
|
24471
25602
|
program.command("rollback").description("put an earlier version back live, with no rebuild").argument("<version>", "for example v5").action((version2, _opts, cmd) => changeLiveCommand(root(cmd), ctx(cmd), version2, "rollback"));
|
|
24472
|
-
program.command("promote").description("put a version live").argument("<version>", "for example v5").action((version2,
|
|
25603
|
+
program.command("promote").description("put a version live; new database changes (SQL) are shown and run first, after a yes").argument("<version>", "for example v5").option("--approve-sql <code>", "for an agent, after the owner said yes to the SQL that sql printed: the code it printed; never for SQL that removes data").action((version2, opts, cmd) => changeLiveCommand(root(cmd), ctx(cmd), version2, "promote", opts));
|
|
25604
|
+
program.command("sql").description("the database changes (SQL) a version runs before it goes live").argument("<version>", "for example v5").action((version2, _opts, cmd) => sqlCommand(root(cmd), ctx(cmd), version2));
|
|
24473
25605
|
program.command("status").description("site state, live version and queue").action((_opts, cmd) => statusCommand(root(cmd), ctx(cmd)));
|
|
24474
|
-
program.command("
|
|
25606
|
+
const migrate = program.command("migrate").description("move an existing site: scan it, download its files, check the new one keeps its addresses");
|
|
25607
|
+
migrate.command("scan").description("read the old site: every address with its title and description, the platform, and WordPress content").argument("<url>", "the old site address").option("--max <n>", "the most pages to read (up to 1000)", (v) => Number(v)).action(async (url2, opts, cmd) => {
|
|
25608
|
+
await migrateScanCommand(root(cmd), url2, opts);
|
|
25609
|
+
});
|
|
25610
|
+
migrate.command("media").description("download the images and files the old site uses, at their old paths; run again to go on").action((_opts, cmd) => migrateMediaCommand(root(cmd)));
|
|
25611
|
+
migrate.command("redirects").description("write public/_redirects for the old addresses that cannot stay (feeds, attachment pages)").action((_opts, cmd) => migrateRedirectsCommand(root(cmd)));
|
|
25612
|
+
migrate.command("verify").description("open every old address on the preview: lists pages that moved, are missing or lost their title or description").argument("<preview>", "the preview address deploy printed").action(async (preview, _opts, cmd) => migrateVerifyCommand(root(cmd), preview));
|
|
25613
|
+
migrate.command("status").description("a managed move: report a stage to the request (scanning, building, preview_ready, customer_review, live, blocked)").argument("<stage>", "the stage").argument("[note]", "one line: the preview address, what is done, or why it is blocked").action((stage, note, _opts, cmd) => migrateStatusCommand(root(cmd), ctx(cmd), stage, note));
|
|
25614
|
+
program.command("blocks").description("list our building blocks, or add one to this site (inbox, blog); never writes over a file").argument("[name]", "inbox or blog").action((name, _opts, cmd) => blocksCommand(root(cmd), ctx(cmd), name));
|
|
25615
|
+
program.command("addons").description("the add-ons of this site: which it has, which are done and which is next; addons run runs them all in one go").argument("[action]", "run: every add-on that is not done, one after the other").action((action, _opts, cmd) => {
|
|
25616
|
+
if (!action) return addonsCommand(root(cmd), ctx(cmd));
|
|
25617
|
+
if (action === "run") return addonsRunCommand(root(cmd), ctx(cmd));
|
|
25618
|
+
throw new CliError(`Unknown: addons ${action}. Use npx deployai@latest addons, or npx deployai@latest addons run`, 1, "usage");
|
|
25619
|
+
});
|
|
24475
25620
|
const addon = program.command("addon").description("run the add-ons of this site, one at a time");
|
|
24476
25621
|
addon.command("next").description("print the next add-on for your agent").action((_opts, cmd) => addonNextCommand(root(cmd), ctx(cmd)));
|
|
24477
25622
|
addon.command("run").description("print one add-on by name").argument("<name>", "the add-on name, as npx deployai@latest addons lists it").action((name, _opts, cmd) => addonRunCommand(root(cmd), ctx(cmd), name));
|