deployai 0.1.0-beta.37 → 0.1.0-beta.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +194 -78
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22601,6 +22601,9 @@ var V6_PRIVATE = [[[...Array(16).fill(0)], 127], [[252, ...Array(15).fill(0)], 7
|
|
|
22601
22601
|
|
|
22602
22602
|
// ../shared/src/probe.ts
|
|
22603
22603
|
var TEAM_PASS_MAX_AGE_S = 8 * 3600;
|
|
22604
|
+
var HUMAN_CHECK_PATH = "/__deployai/check";
|
|
22605
|
+
var HUMAN_COOKIE = "__deployai_human";
|
|
22606
|
+
var HUMAN_MAX_AGE_S = 7 * 86400;
|
|
22604
22607
|
|
|
22605
22608
|
// ../shared/src/deploy-tools.ts
|
|
22606
22609
|
var DEPLOY_TOOL_NAMES = {
|
|
@@ -22675,7 +22678,7 @@ var ADDONS_RUN = { cmd: "npx deployai@latest addons run", say: "With more than o
|
|
|
22675
22678
|
var TAGS_SEEN = { cmd: "npx deployai@latest migrate tags --requests <file>", say: "While you look at the old site, save the outside addresses your browser asks for to a file, one a line, and run this: Tag Manager loads tags that are not in the page. Never send a form on the old site. If the old site shows a security check (Cloudflare, a captcha) or blocks a command but opens in a browser (D-916): open it in your browser tool, tell the owner in one line that a check may show in that window and to pass it there, wait up to three minutes, and read the pages in that browser. Offer this first, as the recommended answer, when you ask the owner; turning the check off for the move or sending an export are the other answers." };
|
|
22676
22679
|
var PLAN_SHOW = "Then show the owner the plan as one chat message, never as the file, a table or one long paragraph, since a long table breaks in a terminal: Moves as it is, with a count and at most three names. Changes, one short line for each Replaced with row. Needs you, one short line for each Needs me or Not possible row. End with the link it printed, for the full list. Do not use a plan mode: it changes the owner's setting.";
|
|
22677
22680
|
var REPORT_SAY = "Once .deployai/migration/plan.md is written, with its features as one table (| Feature | Status | Note |) and a row for each tag and connection in tags.json: this adds it to the owner's move report and prints the link.";
|
|
22678
|
-
var MOVE_REPORT = { cmd: "npx deployai@latest migrate report", say: `${REPORT_SAY} ${PLAN_SHOW} Then ask: "Go ahead with this plan?" The answers: Go ahead and put it live when it is ready (recommended), Go ahead and show me first, or Change something. Say that the old site and its domain do not change either way.` };
|
|
22681
|
+
var MOVE_REPORT = { cmd: "npx deployai@latest migrate report", say: `${REPORT_SAY} ${PLAN_SHOW} Then ask: "Go ahead with this plan?" The answers: Go ahead and put it live when it is ready (recommended), Go ahead and show me first, or Change something. Say that the old site and its domain do not change either way. If .deployai/owner-mode says on-my-own, do not ask (D-928): show the plan, say in one line that you go on and the owner sees the preview before anything goes live, and go on as if they chose to see it first.` };
|
|
22679
22682
|
var TAGS_FIRED = { cmd: "npx deployai@latest migrate tags --requests <file> --fired", say: "Open the preview, save the outside addresses your browser asks for to a file and run this: it shows which tags really fired there. Tags on the preview are real: a test form send shows up as a real lead in the owner's Google and Meta accounts, so send at most one, and tell the owner first." };
|
|
22680
22683
|
var SEND_PREVIEW = { say: 'Send the owner the preview address and, in short lines with no table, what changed from the plan and what still needs them. Ask: "Put it live now, or change something first?" Make all their changes first and put them in one deploy, never one deploy for each change.' };
|
|
22681
22684
|
var AFTER_LIVE = { say: "Only after it is live: tell the owner, in one short message, that the site is live, that their old site and email did not change, that Google keeps showing the old site until the domain is connected, and that they can connect their domain whenever they are ready, as a separate step, from Site addresses on the site's page. Do not explain DNS, do not change DNS and do not start that step in this chat. Then go on with the next step." };
|
|
@@ -22687,7 +22690,7 @@ var DASHBOARD = { cmd: "npx deployai@latest blocks dashboard", say: "Every move
|
|
|
22687
22690
|
var MOVE_POSTS = { cmd: "npx deployai@latest migrate posts", say: "Only if the old site has posts, news or articles: they go into the dashboard's Blog, each at its old address, so the owner can edit them from day one." };
|
|
22688
22691
|
var MOVE_PAGES = { cmd: "npx deployai@latest migrate pages", say: "Lists every page the move keeps in the dashboard's Pages, at its old address, with only the old menu's pages in the menu. Run it before you build the rest of the pages, and build each one at exactly its path in src/kit/moved-pages.json, keeping its look and words: these stay pages of the site's code, never rebuilt from the dashboard's sections. A page the plan drops, remove from that file too. Every form goes to the dashboard's messages, as the step before says." };
|
|
22689
22692
|
var MOVE_LEGAL = { cmd: "npx deployai@latest migrate legal", say: "Starts the dashboard's Documents and Accessibility pages from what the scan found. Ask the owner nothing here, and write no legal text of your own. An old page at exactly /privacy, /terms or /cancellation goes into `docs` in src/kit/moved-legal.json, as .deployai/blocks/dashboard.md says, so it stays live at its address and the owner can edit it. Every other old legal or accessibility page stays exactly as it is. This finishes nothing: never say the legal side is handled or taken care of. In what still needs the owner, say one line: the dashboard's Documents page lists what is left, it is help and not legal advice, and an expert should check it." };
|
|
22690
|
-
var SELF_SEND = { say: 'If the owner chose to put it live when it is ready: when verify lists nothing, run promote on that version with no more questions, and give them the live address and, in short lines with no table, what changed from the plan and what still needs them. If they chose to see it first, send the preview address with the same lines and ask: "Put it live now, or change something first?" Make all their changes first and put them in one deploy, never one deploy for each change.' };
|
|
22693
|
+
var SELF_SEND = { say: 'On my own (.deployai/owner-mode, D-928): this is the one question at the end. Send the preview address, the list of what you left out or need from the owner, and ask once: "Put it live now, or change something first?" Never put it live without that yes. If the owner chose to put it live when it is ready: when verify lists nothing, run promote on that version with no more questions, and give them the live address and, in short lines with no table, what changed from the plan and what still needs them. If they chose to see it first, send the preview address with the same lines and ask: "Put it live now, or change something first?" Make all their changes first and put them in one deploy, never one deploy for each change.' };
|
|
22691
22694
|
var MIGRATE_STEPS = [
|
|
22692
22695
|
TAGS_SEEN,
|
|
22693
22696
|
MOVE_REPORT,
|
|
@@ -22806,7 +22809,7 @@ var OWNER_TEXT_RULE = "Write to the owner in short plain text, with no file path
|
|
|
22806
22809
|
var START_LOGIN_WAIT_LINE = "For the agent: this command prints your instructions after the owner approves the login in the browser. Ask the owner to approve it now. If your tool stops this command, run the same command again. Do not build, scan or download anything before your instructions print.";
|
|
22807
22810
|
var START_FILE = ".deployai/start.md";
|
|
22808
22811
|
var START_WAIT_LINE = `For the agent: this can take several minutes, and your instructions print at the very end. Wait for it to end. If your tool moves it to the background, wait for it to finish, then read its whole output, or read ${START_FILE}. Do not start any work, ask the owner anything or act on the scan lines before you have read the instructions.`;
|
|
22809
|
-
var START_FAIL_LINE = "If anything fails, tell the owner in one or two short sentences what happened and what happens now, with no technical words. Give the cause only when it helps them, in simple words. Do not suggest another coding tool.";
|
|
22812
|
+
var START_FAIL_LINE = "If anything fails, tell the owner in one or two short sentences what happened and what happens now, with no technical words. Give the cause only when it helps them, in simple words. When a command says the connection dropped or DeployAI cannot be reached, wait 15 seconds and run the same command once more before you tell the owner. If the owner says no to a step, tell them in one sentence why it is needed and ask once more; after a second no, leave that step out or stop. Do not suggest another coding tool.";
|
|
22810
22813
|
|
|
22811
22814
|
// ../shared/src/cli-map.ts
|
|
22812
22815
|
var n = (id, lane, label, summaryHe, summaryEn) => ({ id, lane, label, summaryHe, summaryEn });
|
|
@@ -23063,7 +23066,7 @@ var TAG_CATALOG = [
|
|
|
23063
23066
|
e2("sentry", "Sentry", "widget", [/browser\.sentry-cdn\.com/i, /js\.sentry-cdn\.com/i], ["browser.sentry-cdn.com"], `<script src="https://browser.sentry-cdn.com/7.0.0/bundle.min.js"></script>`),
|
|
23064
23067
|
e2("impact", "Impact (affiliates)", "ads", [/\bimpactcdn\.com/i, /\bire\(\s*['"]identify['"]/], [], `<script>s.src='https://utt.impactcdn.com/abc.js';</script>`)
|
|
23065
23068
|
];
|
|
23066
|
-
var OUTSIDE_KINDS = ["oldHost", "fonts", "design", "icons", "code", "analytics", "profile", "images", "unknown"];
|
|
23069
|
+
var OUTSIDE_KINDS = ["oldHost", "fonts", "design", "icons", "code", "analytics", "profile", "images", "media", "widget", "unknown"];
|
|
23067
23070
|
var OUTSIDE_SERVICES = [
|
|
23068
23071
|
{ key: "wix", name: "Wix", kind: "oldHost", host: /(^|\.)(wixstatic|parastorage)\.com$/ },
|
|
23069
23072
|
{ key: "squarespace", name: "Squarespace", kind: "oldHost", host: /(^|\.)squarespace(-cdn)?\.com$/ },
|
|
@@ -23082,7 +23085,10 @@ var OUTSIDE_SERVICES = [
|
|
|
23082
23085
|
{ key: "cfinsights", name: "Cloudflare Web Analytics", kind: "analytics", host: /(^|\.)cloudflareinsights\.com$/ },
|
|
23083
23086
|
{ key: "gravatar", name: "Gravatar", kind: "profile", host: /(^|\.)gravatar\.com$/ },
|
|
23084
23087
|
{ key: "cloudinary", name: "Cloudinary", kind: "images", host: /(^|\.)cloudinary\.com$/ },
|
|
23085
|
-
{ key: "unsplash", name: "Unsplash", kind: "images", host: /(^|\.)unsplash\.com$/ }
|
|
23088
|
+
{ key: "unsplash", name: "Unsplash", kind: "images", host: /(^|\.)unsplash\.com$/ },
|
|
23089
|
+
{ key: "youtube", name: "YouTube", kind: "media", host: /(^|\.)(youtube(-nocookie)?\.com|ytimg\.com|youtu\.be)$/ },
|
|
23090
|
+
{ key: "vimeo", name: "Vimeo", kind: "media", host: /(^|\.)(vimeo\.com|vimeocdn\.com)$/ },
|
|
23091
|
+
{ key: "userway", name: "UserWay", kind: "widget", host: /(^|\.)userway\.org$/ }
|
|
23086
23092
|
];
|
|
23087
23093
|
var outsideService = (host) => OUTSIDE_SERVICES.find((s) => s.host.test(host.toLowerCase())) ?? null;
|
|
23088
23094
|
function outsideRows(hosts) {
|
|
@@ -23262,6 +23268,14 @@ function cspAllows(csp, directive, host) {
|
|
|
23262
23268
|
return h.startsWith("*.") ? host === h.slice(2) || host.endsWith(h.slice(1)) : host === h;
|
|
23263
23269
|
});
|
|
23264
23270
|
}
|
|
23271
|
+
var PHONE_TAGS = /* @__PURE__ */ new Set(["whatsapp"]);
|
|
23272
|
+
var phoneCore = (s) => s.replace(/\D/g, "").replace(/^00/, "").replace(/^0/, "");
|
|
23273
|
+
function sameTagId(key2, a, b) {
|
|
23274
|
+
if (a === b) return true;
|
|
23275
|
+
if (!a || !b || !PHONE_TAGS.has(key2)) return false;
|
|
23276
|
+
const [short, long] = [phoneCore(a), phoneCore(b)].sort((x, y) => x.length - y.length);
|
|
23277
|
+
return short.length >= 7 && long.endsWith(short) && long.length - short.length <= 3;
|
|
23278
|
+
}
|
|
23265
23279
|
var isRemoved = (removed, what) => what.some((w) => w && removed.some((r) => r.toLowerCase() === w.toLowerCase()));
|
|
23266
23280
|
function compareTags(old, next, opts = {}) {
|
|
23267
23281
|
const removed = opts.removed ?? [];
|
|
@@ -23269,7 +23283,7 @@ function compareTags(old, next, opts = {}) {
|
|
|
23269
23283
|
for (const t of old.tags) {
|
|
23270
23284
|
if (isRemoved(removed, [t.id ?? "", t.key, t.name, t.id ? `${t.name} ${t.id}` : ""])) continue;
|
|
23271
23285
|
if (t.source !== "page") continue;
|
|
23272
|
-
const here = next.tags.some((n2) => n2.key === t.key &&
|
|
23286
|
+
const here = next.tags.some((n2) => n2.key === t.key && sameTagId(t.key, t.id, n2.id));
|
|
23273
23287
|
if (!here) findings.push({ problem: "tag_lost", what: `${t.name}${t.id ? ` ${t.id}` : ""}`, page: t.pages[0] });
|
|
23274
23288
|
else if (opts.csp) {
|
|
23275
23289
|
const entry = TAG_CATALOG.find((c) => c.key === t.key);
|
|
@@ -23395,6 +23409,8 @@ var moveReportSchema = external_exports.object({
|
|
|
23395
23409
|
checkedAt: text(40),
|
|
23396
23410
|
pagesChecked: external_exports.number().int().min(0),
|
|
23397
23411
|
pageProblems: external_exports.number().int().min(0),
|
|
23412
|
+
/** Which pages failed the page check (D-928), so a page reads lost only from its own check. Older reports have only the count. */
|
|
23413
|
+
pageFindings: external_exports.array(external_exports.object({ path: page, problem: text(30) })).max(150).optional(),
|
|
23398
23414
|
findings: external_exports.array(external_exports.object({ problem: text(30), what: text(240), detail: text(300).optional(), page: page.optional() })).max(300),
|
|
23399
23415
|
seen: external_exports.array(external_exports.object({ key: external_exports.enum(tagKeys), id: text(80).nullable() })).max(300),
|
|
23400
23416
|
/** Asked for by a browser on the preview, so really fired there, not only present in the code. */
|
|
@@ -23598,7 +23614,9 @@ var SPACE_ADDRESSES = {
|
|
|
23598
23614
|
appUrl: "http://localhost:3000",
|
|
23599
23615
|
// Plain pnpm dev links to the tunnel too, so share images, canonical and sitemap never point at localhost (D-089).
|
|
23600
23616
|
siteUrl: `https://${DEV_HOST}`,
|
|
23601
|
-
|
|
23617
|
+
// Another app on the laptop can hold 3000, so next dev moves to 3001 and up: sign in and Log in as this user work
|
|
23618
|
+
// there too (D-933). Dev space only, never prod.
|
|
23619
|
+
trustedOrigins: Array.from({ length: 10 }, (_, i) => `http://localhost:${3e3 + i}`),
|
|
23602
23620
|
devSitesDomain: "deployai.click",
|
|
23603
23621
|
devPublicHost: DEV_HOST,
|
|
23604
23622
|
mailFrom: "DeployAI <noreply@deployai.co.il>",
|
|
@@ -23614,7 +23632,8 @@ var SPACES = {
|
|
|
23614
23632
|
};
|
|
23615
23633
|
|
|
23616
23634
|
// ../shared/src/protection-rule.ts
|
|
23617
|
-
var SKIP_COUNTRY = ['http.request.uri.query contains "deployai_preview"', 'http.cookie contains "deployai_preview"', 'http.request.uri.query contains "deployai_team"', 'http.cookie contains "__deployai_team"', ...UNVERIFIED_BOT_TOKENS.map((t) => `lower(http.user_agent) contains "${t}"`)];
|
|
23635
|
+
var SKIP_COUNTRY = [`http.cookie contains "${HUMAN_COOKIE}"`, 'http.request.uri.query contains "deployai_preview"', 'http.cookie contains "deployai_preview"', 'http.request.uri.query contains "deployai_team"', 'http.cookie contains "__deployai_team"', ...UNVERIFIED_BOT_TOKENS.map((t) => `lower(http.user_agent) contains "${t}"`)];
|
|
23636
|
+
var HUMAN_CHECK_CLAUSE = `http.request.uri.path eq "${HUMAN_CHECK_PATH}"`;
|
|
23618
23637
|
|
|
23619
23638
|
// ../shared/src/agent-rules.ts
|
|
23620
23639
|
var IPHONE_RULE = "iPhone: Safari is its own browser engine, so working in Chrome or on Android proves nothing. Full height sections use svh or dvh, never 100vh. Typing fields are at least 16px, or the page zooms. A video that plays by itself has muted and playsinline. Bars fixed to the bottom pad with env(safe-area-inset-bottom). Nothing needs a hover. Newer CSS and browser features need a working fallback.";
|
|
@@ -24284,6 +24303,7 @@ function addonTraceLine(key2, runId, trace) {
|
|
|
24284
24303
|
|
|
24285
24304
|
// src/api.ts
|
|
24286
24305
|
import { arch, platform } from "os";
|
|
24306
|
+
import { lookup } from "dns/promises";
|
|
24287
24307
|
|
|
24288
24308
|
// src/config.ts
|
|
24289
24309
|
import { randomUUID } from "crypto";
|
|
@@ -24621,6 +24641,7 @@ var M = {
|
|
|
24621
24641
|
buildLogTail: "End of the build log:",
|
|
24622
24642
|
buildFixHint: 'Fix the error above, then run: npx deployai@latest check, then npx deployai@latest deploy -m "<message>" --fixed "<one sentence: what you changed, no code>"',
|
|
24623
24643
|
buildFixHintNoNote: 'Fix the error above, then run: npx deployai@latest check, then npx deployai@latest deploy -m "<message>"',
|
|
24644
|
+
buildFailedAfter: 'The build itself finished: its log ends without an error, so the failure came in a step after it, on our side. Change nothing and deploy again with the same command. If it fails the same way, tell us: npx deployai@latest feedback --kind blocker --command deploy --what "<what you ran and what it printed>"',
|
|
24624
24645
|
linkedTo: "Linked to {name} ({slug}).",
|
|
24625
24646
|
loginTitle: "DeployAI login",
|
|
24626
24647
|
browserOpened: "Opened the browser. Approve the code there.",
|
|
@@ -24672,6 +24693,8 @@ var M = {
|
|
|
24672
24693
|
addonsClosed: "Add-ons are not open yet, so this cannot run now.",
|
|
24673
24694
|
timeout: "DeployAI did not answer in time at {url}. Check the connection and run the same command again.",
|
|
24674
24695
|
unreachable: "Cannot reach DeployAI at {url}. Check the connection and run the same command again.",
|
|
24696
|
+
offline: "This computer seems to have no internet connection. Check it, then run the same command again.",
|
|
24697
|
+
retrying: "The connection dropped, trying again ({n} of {max}).",
|
|
24675
24698
|
noProjectNamed: "No site named {name}. Run: npx deployai@latest link",
|
|
24676
24699
|
noNameGiven: "No name given.",
|
|
24677
24700
|
noProjectPicked: "No site picked.",
|
|
@@ -24737,6 +24760,7 @@ var M = {
|
|
|
24737
24760
|
sqlConfirmServer: "These changes remove or overwrite data, so they are approved only at the owner's terminal or in the dashboard: {url}",
|
|
24738
24761
|
sqlAgentAsk: ' Show the owner the changes above and ask: "Version {n} changes the database {db}. Run the changes and put it live?"',
|
|
24739
24762
|
sqlAgentThen: " After a yes: npx deployai@latest promote v{n} --approve-sql {hash}",
|
|
24763
|
+
sqlLater: " Version {n} changes the database. Nothing runs now and nothing goes live: ask nothing about it yet. When the owner says yes to putting it live, run npx deployai@latest promote v{n}, which shows the changes to approve.",
|
|
24740
24764
|
sqlNone: "v{n} has no new database changes.",
|
|
24741
24765
|
sqlFirst: "The database changes run first. If they fail, the live version stays.",
|
|
24742
24766
|
sqlFailed: "The database changes of v{n} failed. The live version stayed.",
|
|
@@ -24896,6 +24920,7 @@ var M = {
|
|
|
24896
24920
|
buildLogTail: "\u05E1\u05D5\u05E3 \u05D9\u05D5\u05DE\u05DF \u05D4\u05D1\u05E0\u05D9\u05D9\u05D4:",
|
|
24897
24921
|
buildFixHint: '\u05EA\u05E7\u05E0\u05D5 \u05D0\u05EA \u05D4\u05E9\u05D2\u05D9\u05D0\u05D4 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4, \u05D5\u05D0\u05D6 \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest check, \u05D5\u05D0\u05D7\u05E8\u05D9\u05D5 npx deployai@latest deploy -m "<message>" --fixed "<one sentence: what you changed, no code>"',
|
|
24898
24922
|
buildFixHintNoNote: '\u05EA\u05E7\u05E0\u05D5 \u05D0\u05EA \u05D4\u05E9\u05D2\u05D9\u05D0\u05D4 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4, \u05D5\u05D0\u05D6 \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest check, \u05D5\u05D0\u05D7\u05E8\u05D9\u05D5 npx deployai@latest deploy -m "<message>"',
|
|
24923
|
+
buildFailedAfter: '\u05D4\u05D1\u05E0\u05D9\u05D9\u05D4 \u05E2\u05E6\u05DE\u05D4 \u05D4\u05E1\u05EA\u05D9\u05D9\u05DE\u05D4: \u05D4\u05D9\u05D5\u05DE\u05DF \u05E9\u05DC\u05D4 \u05E0\u05D2\u05DE\u05E8 \u05D1\u05DC\u05D9 \u05E9\u05D2\u05D9\u05D0\u05D4, \u05DB\u05DA \u05E9\u05D4\u05DB\u05D9\u05E9\u05DC\u05D5\u05DF \u05E7\u05E8\u05D4 \u05D1\u05E9\u05DC\u05D1 \u05E9\u05D0\u05D7\u05E8\u05D9\u05D4, \u05D0\u05E6\u05DC\u05E0\u05D5. \u05D0\u05DC \u05EA\u05E9\u05E0\u05D5 \u05DB\u05DC\u05D5\u05DD \u05D5\u05E4\u05E8\u05E1\u05D5 \u05E9\u05D5\u05D1 \u05D1\u05D0\u05D5\u05EA\u05D4 \u05E4\u05E7\u05D5\u05D3\u05D4. \u05D0\u05DD \u05D6\u05D4 \u05E0\u05DB\u05E9\u05DC \u05E9\u05D5\u05D1 \u05D1\u05D0\u05D5\u05EA\u05D4 \u05E6\u05D5\u05E8\u05D4, \u05E1\u05E4\u05E8\u05D5 \u05DC\u05E0\u05D5: npx deployai@latest feedback --kind blocker --command deploy --what "<what you ran and what it printed>"',
|
|
24899
24924
|
linkedTo: "\u05DE\u05D7\u05D5\u05D1\u05E8 \u05DC {name} ({slug}).",
|
|
24900
24925
|
loginTitle: "DeployAI login",
|
|
24901
24926
|
browserOpened: "\u05D4\u05D3\u05E4\u05D3\u05E4\u05DF \u05E0\u05E4\u05EA\u05D7. \u05D0\u05E9\u05E8\u05D5 \u05E9\u05DD \u05D0\u05EA \u05D4\u05E7\u05D5\u05D3.",
|
|
@@ -24947,6 +24972,8 @@ var M = {
|
|
|
24947
24972
|
addonsClosed: "\u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E2\u05D5\u05D3 \u05DC\u05D0 \u05E4\u05EA\u05D5\u05D7\u05D9\u05DD, \u05D5\u05DC\u05DB\u05DF \u05D0\u05D9 \u05D0\u05E4\u05E9\u05E8 \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05EA \u05D6\u05D4 \u05E2\u05DB\u05E9\u05D9\u05D5.",
|
|
24948
24973
|
timeout: "DeployAI \u05DC\u05D0 \u05E2\u05E0\u05D4 \u05D1\u05D6\u05DE\u05DF \u05D1\u05BE{url}. \u05D1\u05D3\u05E7\u05D5 \u05D0\u05EA \u05D4\u05D7\u05D9\u05D1\u05D5\u05E8 \u05D5\u05D4\u05E8\u05D9\u05E6\u05D5 \u05E9\u05D5\u05D1 \u05D0\u05EA \u05D0\u05D5\u05EA\u05D4 \u05E4\u05E7\u05D5\u05D3\u05D4.",
|
|
24949
24974
|
unreachable: "\u05D0\u05D9\u05DF \u05D7\u05D9\u05D1\u05D5\u05E8 \u05DC\u05BEDeployAI \u05D1\u05BE{url}. \u05D1\u05D3\u05E7\u05D5 \u05D0\u05EA \u05D4\u05D7\u05D9\u05D1\u05D5\u05E8 \u05D5\u05D4\u05E8\u05D9\u05E6\u05D5 \u05E9\u05D5\u05D1 \u05D0\u05EA \u05D0\u05D5\u05EA\u05D4 \u05E4\u05E7\u05D5\u05D3\u05D4.",
|
|
24975
|
+
offline: "\u05E0\u05E8\u05D0\u05D4 \u05E9\u05D0\u05D9\u05DF \u05DC\u05DE\u05D7\u05E9\u05D1 \u05D7\u05D9\u05D1\u05D5\u05E8 \u05DC\u05D0\u05D9\u05E0\u05D8\u05E8\u05E0\u05D8. \u05D1\u05D3\u05E7\u05D5 \u05D0\u05D5\u05EA\u05D5 \u05D5\u05D4\u05E8\u05D9\u05E6\u05D5 \u05E9\u05D5\u05D1 \u05D0\u05EA \u05D0\u05D5\u05EA\u05D4 \u05E4\u05E7\u05D5\u05D3\u05D4.",
|
|
24976
|
+
retrying: "\u05D4\u05D7\u05D9\u05D1\u05D5\u05E8 \u05E0\u05E4\u05DC, \u05DE\u05E0\u05E1\u05D9\u05DD \u05E9\u05D5\u05D1 ({n} \u05DE\u05EA\u05D5\u05DA {max}).",
|
|
24950
24977
|
noProjectNamed: "\u05D0\u05D9\u05DF \u05D0\u05EA\u05E8 \u05D1\u05E9\u05DD {name}. \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest link",
|
|
24951
24978
|
noNameGiven: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8 \u05E9\u05DD.",
|
|
24952
24979
|
noProjectPicked: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8 \u05D0\u05EA\u05E8.",
|
|
@@ -25012,6 +25039,7 @@ var M = {
|
|
|
25012
25039
|
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}",
|
|
25013
25040
|
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?"',
|
|
25014
25041
|
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}",
|
|
25042
|
+
sqlLater: " \u05D2\u05E8\u05E1\u05D4 {n} \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD. \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05E8\u05E5 \u05E2\u05DB\u05E9\u05D9\u05D5 \u05D5\u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05E2\u05D5\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8: \u05D0\u05DC \u05EA\u05E9\u05D0\u05DC\u05D5 \u05E2\u05DC \u05D6\u05D4 \u05E2\u05D3\u05D9\u05D9\u05DF. \u05DB\u05E9\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DE\u05D0\u05E9\u05E8 \u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05D5\u05EA\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8, \u05D4\u05E8\u05D9\u05E6\u05D5 npx deployai@latest promote v{n}, \u05D5\u05D4\u05D5\u05D0 \u05D9\u05E8\u05D0\u05D4 \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8.",
|
|
25015
25043
|
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.",
|
|
25016
25044
|
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.",
|
|
25017
25045
|
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.",
|
|
@@ -25046,8 +25074,32 @@ function messages(root) {
|
|
|
25046
25074
|
return (key2, vars = {}) => M[lang][key2].replace(/\{(\w+)\}/g, (_, k) => String(vars[k] ?? `{${k}}`));
|
|
25047
25075
|
}
|
|
25048
25076
|
|
|
25077
|
+
// src/output.ts
|
|
25078
|
+
var LABEL_WIDTH = 17;
|
|
25079
|
+
function out(line = "") {
|
|
25080
|
+
process.stdout.write(line + "\n");
|
|
25081
|
+
}
|
|
25082
|
+
function err(line = "") {
|
|
25083
|
+
process.stderr.write(line + "\n");
|
|
25084
|
+
}
|
|
25085
|
+
function pad(text2, width) {
|
|
25086
|
+
return text2.length >= width ? text2 + " " : text2 + " ".repeat(width - text2.length);
|
|
25087
|
+
}
|
|
25088
|
+
function row(label, value, width = LABEL_WIDTH) {
|
|
25089
|
+
return pad(label, width) + value;
|
|
25090
|
+
}
|
|
25091
|
+
function rows(items) {
|
|
25092
|
+
const width = Math.max(LABEL_WIDTH, ...items.map(([l]) => l.length + 2));
|
|
25093
|
+
return items.map(([l, v]) => row(l, v, width)).join("\n");
|
|
25094
|
+
}
|
|
25095
|
+
function formatBytes(n2) {
|
|
25096
|
+
if (n2 < 1024) return `${n2} B`;
|
|
25097
|
+
if (n2 < 1024 * 1024) return `${(n2 / 1024).toFixed(1)} KB`;
|
|
25098
|
+
return `${(n2 / (1024 * 1024)).toFixed(1)} MB`;
|
|
25099
|
+
}
|
|
25100
|
+
|
|
25049
25101
|
// src/version.ts
|
|
25050
|
-
var CLI_VERSION = "0.1.0-beta.
|
|
25102
|
+
var CLI_VERSION = "0.1.0-beta.39";
|
|
25051
25103
|
|
|
25052
25104
|
// src/api.ts
|
|
25053
25105
|
function apiContext(apiFlag, root) {
|
|
@@ -25068,6 +25120,37 @@ function tokenIfOwnApi(ctx) {
|
|
|
25068
25120
|
const saved = ctx.config.tokenApiUrl?.replace(/\/+$/, "");
|
|
25069
25121
|
return ctx.config.token && saved && saved === ctx.apiUrl.replace(/\/+$/, "") ? ctx.config.token : null;
|
|
25070
25122
|
}
|
|
25123
|
+
var RETRY_WAITS_MS = [2e3, 5e3, 1e4];
|
|
25124
|
+
function retryWaits() {
|
|
25125
|
+
const raw = process.env.DEPLOYAI_RETRY_MS;
|
|
25126
|
+
const ms2 = raw ? Number(raw) : NaN;
|
|
25127
|
+
return Number.isFinite(ms2) && ms2 >= 0 ? RETRY_WAITS_MS.map(() => ms2) : RETRY_WAITS_MS;
|
|
25128
|
+
}
|
|
25129
|
+
var NEVER_SENT = /* @__PURE__ */ new Set(["ENOTFOUND", "EAI_AGAIN", "ECONNREFUSED", "ENETUNREACH", "EHOSTUNREACH", "UND_ERR_CONNECT_TIMEOUT"]);
|
|
25130
|
+
var DROPPED = /* @__PURE__ */ new Set(["ECONNRESET", "EPIPE", "ETIMEDOUT", "UND_ERR_SOCKET"]);
|
|
25131
|
+
function errorCode(e3) {
|
|
25132
|
+
const cause = e3?.cause;
|
|
25133
|
+
return cause?.code ?? e3?.code;
|
|
25134
|
+
}
|
|
25135
|
+
function shouldRetry(method, failure2) {
|
|
25136
|
+
const get2 = method === "GET";
|
|
25137
|
+
if (typeof failure2 === "number") return get2 && (failure2 === 502 || failure2 === 503 || failure2 === 504);
|
|
25138
|
+
const code = errorCode(failure2);
|
|
25139
|
+
if (code && NEVER_SENT.has(code)) return true;
|
|
25140
|
+
if (!get2) return false;
|
|
25141
|
+
return failure2?.name === "TimeoutError" || code !== void 0 && DROPPED.has(code);
|
|
25142
|
+
}
|
|
25143
|
+
async function networkError(e3, url2) {
|
|
25144
|
+
const t = messages(process.cwd());
|
|
25145
|
+
const name = e3?.name;
|
|
25146
|
+
if (name === "TimeoutError" || name === "AbortError") return new CliError(t("timeout", { url: url2 }), 1, "network");
|
|
25147
|
+
const code = errorCode(e3);
|
|
25148
|
+
if (code === "ENOTFOUND" || code === "EAI_AGAIN" || code === "ENETUNREACH") {
|
|
25149
|
+
const online = await Promise.race([lookup("cloudflare.com").then(() => true, () => false), new Promise((r) => setTimeout(() => r(true), 3e3))]);
|
|
25150
|
+
if (!online) return new CliError(t("offline"), 1, "network");
|
|
25151
|
+
}
|
|
25152
|
+
return new CliError(t("unreachable", { url: url2 }), 1, "network");
|
|
25153
|
+
}
|
|
25071
25154
|
async function apiRequest(ctx, path, schema, opts = {}) {
|
|
25072
25155
|
const headers = { "User-Agent": userAgent(ctx.config), Accept: "application/json" };
|
|
25073
25156
|
if (opts.auth !== false) headers.Authorization = `Bearer ${requireToken(ctx)}`;
|
|
@@ -25078,20 +25161,24 @@ async function apiRequest(ctx, path, schema, opts = {}) {
|
|
|
25078
25161
|
headers["Content-Type"] = "application/json";
|
|
25079
25162
|
body = JSON.stringify(opts.body);
|
|
25080
25163
|
}
|
|
25164
|
+
const method = opts.method ?? (body ? "POST" : "GET");
|
|
25165
|
+
const waits = retryWaits();
|
|
25081
25166
|
let res;
|
|
25082
|
-
|
|
25083
|
-
|
|
25084
|
-
|
|
25085
|
-
|
|
25086
|
-
body,
|
|
25087
|
-
|
|
25088
|
-
|
|
25089
|
-
|
|
25090
|
-
const
|
|
25091
|
-
if (
|
|
25092
|
-
throw
|
|
25167
|
+
for (let attempt = 0; ; attempt++) {
|
|
25168
|
+
let failure2;
|
|
25169
|
+
res = void 0;
|
|
25170
|
+
try {
|
|
25171
|
+
res = await fetch(ctx.apiUrl + path, { method, headers, body, signal: AbortSignal.timeout(opts.timeoutMs ?? 3e4) });
|
|
25172
|
+
} catch (e3) {
|
|
25173
|
+
failure2 = e3;
|
|
25174
|
+
}
|
|
25175
|
+
const again = attempt < waits.length && shouldRetry(method, res ? res.status : failure2);
|
|
25176
|
+
if (!again) {
|
|
25177
|
+
if (!res) throw await networkError(failure2, ctx.apiUrl);
|
|
25178
|
+
break;
|
|
25093
25179
|
}
|
|
25094
|
-
|
|
25180
|
+
err(messages(process.cwd())("retrying", { n: attempt + 2, max: waits.length + 1 }));
|
|
25181
|
+
await new Promise((r) => setTimeout(r, waits[attempt]));
|
|
25095
25182
|
}
|
|
25096
25183
|
const text2 = await res.text().catch(() => "");
|
|
25097
25184
|
let data = null;
|
|
@@ -25194,30 +25281,6 @@ function knownError(code, max, t, extra) {
|
|
|
25194
25281
|
}
|
|
25195
25282
|
}
|
|
25196
25283
|
|
|
25197
|
-
// src/output.ts
|
|
25198
|
-
var LABEL_WIDTH = 17;
|
|
25199
|
-
function out(line = "") {
|
|
25200
|
-
process.stdout.write(line + "\n");
|
|
25201
|
-
}
|
|
25202
|
-
function err(line = "") {
|
|
25203
|
-
process.stderr.write(line + "\n");
|
|
25204
|
-
}
|
|
25205
|
-
function pad(text2, width) {
|
|
25206
|
-
return text2.length >= width ? text2 + " " : text2 + " ".repeat(width - text2.length);
|
|
25207
|
-
}
|
|
25208
|
-
function row(label, value, width = LABEL_WIDTH) {
|
|
25209
|
-
return pad(label, width) + value;
|
|
25210
|
-
}
|
|
25211
|
-
function rows(items) {
|
|
25212
|
-
const width = Math.max(LABEL_WIDTH, ...items.map(([l]) => l.length + 2));
|
|
25213
|
-
return items.map(([l, v]) => row(l, v, width)).join("\n");
|
|
25214
|
-
}
|
|
25215
|
-
function formatBytes(n2) {
|
|
25216
|
-
if (n2 < 1024) return `${n2} B`;
|
|
25217
|
-
if (n2 < 1024 * 1024) return `${(n2 / 1024).toFixed(1)} KB`;
|
|
25218
|
-
return `${(n2 / (1024 * 1024)).toFixed(1)} MB`;
|
|
25219
|
-
}
|
|
25220
|
-
|
|
25221
25284
|
// src/telemetry.ts
|
|
25222
25285
|
import { arch as arch2, platform as platform2 } from "os";
|
|
25223
25286
|
var TELEMETRY_SENT = [
|
|
@@ -27624,7 +27687,7 @@ async function migrateTagsCommand(root, ctx, opts) {
|
|
|
27624
27687
|
const names = removableNames(site);
|
|
27625
27688
|
const known = opts.removed.filter((r) => names.some((n2) => n2.toLowerCase() === r.toLowerCase()));
|
|
27626
27689
|
const unknown2 = opts.removed.filter((r) => !known.includes(r));
|
|
27627
|
-
if (known.length) out(`Marked as
|
|
27690
|
+
if (known.length) out(`Marked as left out on purpose: ${known.join(", ")}. Verify will not ask for these. The report shows what took its place from the plan row "Replaced with ...".`);
|
|
27628
27691
|
if (unknown2.length) out(`Not found in what the old site has: ${unknown2.join(", ")}. Use the name verify prints, exactly as it prints it.`);
|
|
27629
27692
|
}
|
|
27630
27693
|
for (const a of answers) {
|
|
@@ -27727,7 +27790,7 @@ async function migrateVerifyCommand(root, previewRaw, ctx, retryMs = PREVIEW_RET
|
|
|
27727
27790
|
for (const t of oldSite.triggers.filter((x) => x.type === "page")) pageOnPreview[t.value] = Boolean((await page3(t.value))?.ok);
|
|
27728
27791
|
const found = compareTags(oldSite, nextSite, { removed: state.removed ?? [], csp, fileOnPreview, triggerFound, pageOnPreview, formIdFound });
|
|
27729
27792
|
tagFindings.push(...found);
|
|
27730
|
-
perHost.push({ host, checked: checked - checkedBefore, problems: findings.length - findingsBefore, seen: nextSite.tags.map((t) => ({ key: t.key, id: t.id })), found, removed: state.removed ?? [] });
|
|
27793
|
+
perHost.push({ host, checked: checked - checkedBefore, problems: findings.length - findingsBefore, pages: findings.slice(findingsBefore), seen: nextSite.tags.map((t) => ({ key: t.key, id: t.id })), found, removed: state.removed ?? [] });
|
|
27731
27794
|
}
|
|
27732
27795
|
}
|
|
27733
27796
|
const words = { missing: "not found on the preview", moved: "moved to", error: "answers", title_lost: "lost its title", description_lost: "lost its description" };
|
|
@@ -27756,13 +27819,13 @@ async function migrateVerifyCommand(root, previewRaw, ctx, retryMs = PREVIEW_RET
|
|
|
27756
27819
|
out(`${tagFindings.length} tags and connections need a fix:`);
|
|
27757
27820
|
for (const f of tagFindings.slice(0, 60)) out(` ${f.what} ${TAG_WORDS[f.problem]}${f.detail ? ` (${f.detail})` : ""}${f.page ? ` on ${f.page}` : ""}`);
|
|
27758
27821
|
if (tagFindings.length > 60) out(` and ${tagFindings.length - 60} more in verify.json`);
|
|
27759
|
-
out('Put each one back, deploy again and run verify again. If the owner asked
|
|
27822
|
+
out('Put each one back, deploy again and run verify again. If one was left out on purpose (the owner asked, or the plan replaced it with ours): npx deployai@latest migrate tags --removed "<its number or name>", and give its plan row the status "Replaced with <what took its place>" so the report says so.');
|
|
27760
27823
|
process.exitCode = 1;
|
|
27761
27824
|
}
|
|
27762
27825
|
const clean3 = !findings.length && !tagFindings.length && !credits.size && !vendors.size && !leftOnOld.length;
|
|
27763
27826
|
for (const h of perHost) {
|
|
27764
27827
|
const dir = hostDir(root, h.host);
|
|
27765
|
-
const verify = { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), pagesChecked: h.checked, pageProblems: h.problems, findings: h.found.map((f) => ({ problem: f.problem, what: f.what.slice(0, 240), ...f.detail ? { detail: f.detail.slice(0, 300) } : {}, ...f.page ? { page: f.page.slice(0, 300) } : {} })).slice(0, 300), seen: h.seen.slice(0, 300), removed: h.removed, vendors: [...vendors.keys()].map((v) => v.slice(0, 80)).slice(0, 40) };
|
|
27828
|
+
const verify = { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), pagesChecked: h.checked, pageProblems: h.problems, pageFindings: h.pages.map((f) => ({ path: f.path.slice(0, 300), problem: f.problem })).slice(0, 150), findings: h.found.map((f) => ({ problem: f.problem, what: f.what.slice(0, 240), ...f.detail ? { detail: f.detail.slice(0, 300) } : {}, ...f.page ? { page: f.page.slice(0, 300) } : {} })).slice(0, 300), seen: h.seen.slice(0, 300), removed: h.removed, vendors: [...vendors.keys()].map((v) => v.slice(0, 80)).slice(0, 40) };
|
|
27766
27829
|
writeJson(join13(dir, "verify-report.json"), { report: verify });
|
|
27767
27830
|
await sendReport(root, ctx, h.host, clean3 ? "verify" : null, verify);
|
|
27768
27831
|
}
|
|
@@ -28590,8 +28653,14 @@ function printStatus(root, ctx, projectId, s) {
|
|
|
28590
28653
|
for (const line of s.latest.logTail.split("\n")) out(` ${line}`);
|
|
28591
28654
|
}
|
|
28592
28655
|
out();
|
|
28656
|
+
const lastLines = (s.latest.logTail ?? "").trim().split("\n").slice(-4).join("\n");
|
|
28657
|
+
if (!s.latest.error && BUILD_FINISHED.test(lastLines)) {
|
|
28658
|
+
out(t("buildFailedAfter"));
|
|
28659
|
+
return;
|
|
28660
|
+
}
|
|
28593
28661
|
out(t(telemetryEnabled(ctx.config) ? "buildFixHint" : "buildFixHintNoNote"));
|
|
28594
28662
|
}
|
|
28663
|
+
var BUILD_FINISHED = /(\bComplete!|\bbuilt in \d|Compiled successfully|\bDone in \d|\bbuild complete)/i;
|
|
28595
28664
|
|
|
28596
28665
|
// src/commands/sql.ts
|
|
28597
28666
|
function fetchSqlPlan(ctx, projectId, n2) {
|
|
@@ -28849,6 +28918,11 @@ async function afterBuild(root, ctx, projectId, n2, o) {
|
|
|
28849
28918
|
const sqlWaits = ready && built.latest?.migrationStatus === "waiting";
|
|
28850
28919
|
let approval = null;
|
|
28851
28920
|
let live = o.live;
|
|
28921
|
+
if (sqlWaits && !o.live && !isInteractive()) {
|
|
28922
|
+
out(t("sqlLater", { n: n2 }));
|
|
28923
|
+
printStatus(root, ctx, projectId, built);
|
|
28924
|
+
return;
|
|
28925
|
+
}
|
|
28852
28926
|
if (sqlWaits) {
|
|
28853
28927
|
if (built.latest?.preview) out(t("showPreview", { url: built.latest.preview }));
|
|
28854
28928
|
approval = await approveSqlStep(root, ctx, projectId, n2);
|
|
@@ -29542,11 +29616,36 @@ async function speedCommand(ctx, url2, opts, deps = {}) {
|
|
|
29542
29616
|
|
|
29543
29617
|
// src/commands/shot.ts
|
|
29544
29618
|
import { spawn as spawn4 } from "child_process";
|
|
29545
|
-
import { existsSync as existsSync18, mkdirSync as mkdirSync11 } from "fs";
|
|
29619
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync11, readFileSync as readFileSync15, rmSync as rmSync5, writeFileSync as writeFileSync17 } from "fs";
|
|
29620
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
29546
29621
|
import { join as join22, resolve as resolve6 } from "path";
|
|
29547
29622
|
var SHOT_SIZES = [{ name: "phone", size: "390,844" }, { name: "desktop", size: "1440,900" }];
|
|
29548
29623
|
var PLAYWRIGHT = "playwright@1.56";
|
|
29549
29624
|
var WAIT_MS3 = 18e4;
|
|
29625
|
+
var TIMED_OUT = 124;
|
|
29626
|
+
var TAKER = String.raw`const fs = require('fs'), path = require('path');
|
|
29627
|
+
const a = process.argv.slice(2), opt = (k) => (a.find((x) => x.startsWith('--' + k + '=')) || '').split('=')[1];
|
|
29628
|
+
const [url, file] = a.filter((x) => !x.startsWith('--'));
|
|
29629
|
+
const step = (s) => fs.writeFileSync(file + '.step', s);
|
|
29630
|
+
const bin = (process.env.PATH || '').split(path.delimiter).find((d) => fs.existsSync(path.join(d, '..', 'playwright', 'package.json')));
|
|
29631
|
+
const pw = require(path.join(bin, '..', 'playwright'));
|
|
29632
|
+
(async () => {
|
|
29633
|
+
step('start the browser');
|
|
29634
|
+
const [w, h] = opt('viewport-size').split(',').map(Number);
|
|
29635
|
+
const browser = opt('browser') === 'webkit' ? await pw.webkit.launch() : await pw.chromium.launch({ channel: opt('channel') });
|
|
29636
|
+
const page = await browser.newPage({ viewport: { width: w, height: h } });
|
|
29637
|
+
step('open the page');
|
|
29638
|
+
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
|
|
29639
|
+
await page.waitForLoadState('load', { timeout: 15000 }).catch(() => {});
|
|
29640
|
+
step('scroll to the bottom');
|
|
29641
|
+
await page.evaluate(async () => { for (let y = 0; y < Math.min(document.body.scrollHeight, 40000); y += innerHeight) { scrollTo(0, y); await new Promise((r) => setTimeout(r, 150)); } scrollTo(0, 0); });
|
|
29642
|
+
await page.waitForTimeout(1500);
|
|
29643
|
+
step('take the picture');
|
|
29644
|
+
await page.screenshot({ path: file, fullPage: true, animations: 'disabled', timeout: 60000 });
|
|
29645
|
+
await browser.close();
|
|
29646
|
+
fs.rmSync(file + '.step', { force: true });
|
|
29647
|
+
})().catch((e) => { try { fs.appendFileSync(file + '.step', ': ' + String(e && e.message || e).split(String.fromCharCode(10))[0]); } catch {} process.exit(1); });
|
|
29648
|
+
`;
|
|
29550
29649
|
var channelFor = (browser) => /msedge|edge/i.test(browser) ? "msedge" : "chrome";
|
|
29551
29650
|
function shotName(address, width) {
|
|
29552
29651
|
const u = new URL(address);
|
|
@@ -29557,14 +29656,18 @@ function runNpx(args) {
|
|
|
29557
29656
|
const win = process.platform === "win32";
|
|
29558
29657
|
return new Promise((done) => {
|
|
29559
29658
|
const child = win ? spawn4(["npx", ...args.map((a) => `"${a}"`)].join(" "), { stdio: "ignore", windowsHide: true, shell: true }) : spawn4("npx", args, { stdio: "ignore" });
|
|
29560
|
-
|
|
29659
|
+
let killed = false;
|
|
29660
|
+
const timer = setTimeout(() => {
|
|
29661
|
+
killed = true;
|
|
29662
|
+
child.kill();
|
|
29663
|
+
}, WAIT_MS3);
|
|
29561
29664
|
child.once("error", () => {
|
|
29562
29665
|
clearTimeout(timer);
|
|
29563
29666
|
done(1);
|
|
29564
29667
|
});
|
|
29565
29668
|
child.once("exit", (code) => {
|
|
29566
29669
|
clearTimeout(timer);
|
|
29567
|
-
done(code ?? 1);
|
|
29670
|
+
done(killed ? TIMED_OUT : code ?? 1);
|
|
29568
29671
|
});
|
|
29569
29672
|
});
|
|
29570
29673
|
}
|
|
@@ -29581,12 +29684,19 @@ async function shotCommand(root, address, opts = {}, run = runNpx) {
|
|
|
29581
29684
|
if (opts.webkit && await run(["--yes", PLAYWRIGHT, "install", "webkit"]) !== 0) throw new CliError("Safari's engine could not be installed. Run shot without --webkit to use Chrome or Edge.", 1, "shot_failed");
|
|
29582
29685
|
const dir = resolve6(root, opts.out ?? join22(".deployai", "shots"));
|
|
29583
29686
|
mkdirSync11(dir, { recursive: true });
|
|
29687
|
+
const taker = join22(tmpdir3(), "deployai-shot.cjs");
|
|
29688
|
+
writeFileSync17(taker, TAKER);
|
|
29584
29689
|
const saved = [];
|
|
29585
29690
|
for (const s of SHOT_SIZES) {
|
|
29586
29691
|
const file2 = join22(dir, shotName(url2.toString(), s.name));
|
|
29587
29692
|
const engine = opts.webkit ? ["--browser=webkit"] : [`--channel=${channelFor(browser)}`];
|
|
29588
|
-
|
|
29589
|
-
|
|
29693
|
+
rmSync5(file2, { force: true });
|
|
29694
|
+
const code = await run(["--yes", "-p", PLAYWRIGHT, "node", taker, ...engine, `--viewport-size=${s.size}`, url2.toString(), file2]);
|
|
29695
|
+
if (code !== 0 || !existsSync18(file2)) {
|
|
29696
|
+
const step = existsSync18(`${file2}.step`) ? readFileSync15(`${file2}.step`, "utf8").trim() : "";
|
|
29697
|
+
rmSync5(`${file2}.step`, { force: true });
|
|
29698
|
+
throw new CliError(`The ${s.name} picture of ${url2} could not be taken${step ? `, stopped at: ${step}` : code === TIMED_OUT ? ", it took over 3 minutes" : ""}. Check that the page opens, then run shot again; if it stops again, look with your own browser tool or at home.html.`, 1, "shot_failed");
|
|
29699
|
+
}
|
|
29590
29700
|
saved.push(file2);
|
|
29591
29701
|
out(`${s.name.padEnd(8)} ${file2}`);
|
|
29592
29702
|
}
|
|
@@ -29596,7 +29706,7 @@ async function shotCommand(root, address, opts = {}, run = runNpx) {
|
|
|
29596
29706
|
|
|
29597
29707
|
// src/commands/images.ts
|
|
29598
29708
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
29599
|
-
import { existsSync as existsSync19, mkdirSync as mkdirSync12, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as
|
|
29709
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync12, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
29600
29710
|
import { createRequire } from "module";
|
|
29601
29711
|
import { homedir as homedir3 } from "os";
|
|
29602
29712
|
import { extname, join as join23, relative as relative4, resolve as resolve7 } from "path";
|
|
@@ -29627,7 +29737,7 @@ function loadSharp() {
|
|
|
29627
29737
|
const dir = join23(homedir3(), ".deployai", "tools", "sharp");
|
|
29628
29738
|
if (!existsSync19(join23(dir, "node_modules", "sharp"))) {
|
|
29629
29739
|
mkdirSync12(dir, { recursive: true });
|
|
29630
|
-
if (!existsSync19(join23(dir, "package.json")))
|
|
29740
|
+
if (!existsSync19(join23(dir, "package.json"))) writeFileSync18(join23(dir, "package.json"), '{"private":true}');
|
|
29631
29741
|
out("Getting the image tool once (it stays outside the site)...");
|
|
29632
29742
|
const r = spawnSync5(process.platform === "win32" ? "npm.cmd" : "npm", ["install", SHARP, "--no-audit", "--no-fund", "--silent"], { cwd: dir, stdio: "ignore", shell: process.platform === "win32" });
|
|
29633
29743
|
if (r.status !== 0) throw new CliError("The image tool could not be installed. Check the internet connection and run optimize again.", 1, "images_failed");
|
|
@@ -29669,7 +29779,7 @@ async function imagesCommand(root, folder, sharp = loadSharp) {
|
|
|
29669
29779
|
|
|
29670
29780
|
// src/commands/blocks.ts
|
|
29671
29781
|
import { createHash as createHash4 } from "crypto";
|
|
29672
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync13, readFileSync as
|
|
29782
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync13, readFileSync as readFileSync16, writeFileSync as writeFileSync19 } from "fs";
|
|
29673
29783
|
import { dirname as dirname7, resolve as resolve8, sep as sep3 } from "path";
|
|
29674
29784
|
import { gunzipSync as gunzipSync3 } from "zlib";
|
|
29675
29785
|
var BLOCKS = [
|
|
@@ -29724,25 +29834,30 @@ async function blocksCommand(root, ctx, name, opts = {}) {
|
|
|
29724
29834
|
const target = resolve8(base, e3.name);
|
|
29725
29835
|
if (target === base || !target.startsWith(base + sep3)) continue;
|
|
29726
29836
|
if (existsSync20(target)) {
|
|
29727
|
-
const now = sha(
|
|
29837
|
+
const now = sha(readFileSync16(target));
|
|
29728
29838
|
if (now === sha(e3.data)) {
|
|
29729
29839
|
lock[e3.name] = now;
|
|
29730
29840
|
} else if (opts.update && lock[e3.name] === now) {
|
|
29731
|
-
|
|
29841
|
+
writeFileSync19(target, e3.data);
|
|
29732
29842
|
lock[e3.name] = sha(e3.data);
|
|
29733
29843
|
updated.push(e3.name);
|
|
29734
29844
|
} else {
|
|
29845
|
+
const upstream = resolve8(base, ".deployai", "blocks", `${block.key}-upstream`, e3.name);
|
|
29846
|
+
if (upstream.startsWith(base + sep3)) {
|
|
29847
|
+
mkdirSync13(dirname7(upstream), { recursive: true });
|
|
29848
|
+
writeFileSync19(upstream, e3.data);
|
|
29849
|
+
}
|
|
29735
29850
|
kept.push(e3.name);
|
|
29736
29851
|
}
|
|
29737
29852
|
continue;
|
|
29738
29853
|
}
|
|
29739
29854
|
mkdirSync13(dirname7(target), { recursive: true });
|
|
29740
|
-
|
|
29855
|
+
writeFileSync19(target, e3.data);
|
|
29741
29856
|
lock[e3.name] = sha(e3.data);
|
|
29742
29857
|
written.push(e3.name);
|
|
29743
29858
|
}
|
|
29744
29859
|
mkdirSync13(dirname7(lockPath(base, block.key)), { recursive: true });
|
|
29745
|
-
|
|
29860
|
+
writeFileSync19(lockPath(base, block.key), `${JSON.stringify(lock, null, 2)}
|
|
29746
29861
|
`);
|
|
29747
29862
|
out(`Added the ${block.key} block: ${written.length} files.`);
|
|
29748
29863
|
written.forEach((f) => out(` + ${f}`));
|
|
@@ -29753,6 +29868,7 @@ async function blocksCommand(root, ctx, name, opts = {}) {
|
|
|
29753
29868
|
if (kept.length) {
|
|
29754
29869
|
out(`These ${kept.length} files already exist and were left as they are; merge what the block needs into them:`);
|
|
29755
29870
|
kept.forEach((f) => out(` = ${f}`));
|
|
29871
|
+
out(`The block's own version of each is in .deployai/blocks/${block.key}-upstream/ at the same path: compare the two (git diff --no-index <yours> <its>), merge, then delete that folder.`);
|
|
29756
29872
|
}
|
|
29757
29873
|
out(`Read .deployai/blocks/${block.key}.md and follow it: it says what to wire and what to set.`);
|
|
29758
29874
|
}
|
|
@@ -29803,9 +29919,9 @@ async function integrationsCommand(ctx, name, opts = {}) {
|
|
|
29803
29919
|
|
|
29804
29920
|
// src/commands/brand.ts
|
|
29805
29921
|
import { spawn as spawn5 } from "child_process";
|
|
29806
|
-
import { copyFileSync, existsSync as existsSync21, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, readdirSync as readdirSync7, readFileSync as
|
|
29922
|
+
import { copyFileSync, existsSync as existsSync21, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, readdirSync as readdirSync7, readFileSync as readFileSync17, rmSync as rmSync6, statSync as statSync4, writeFileSync as writeFileSync20 } from "fs";
|
|
29807
29923
|
import { createServer } from "http";
|
|
29808
|
-
import { tmpdir as
|
|
29924
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
29809
29925
|
import { basename as basename2, dirname as dirname8, extname as extname2, join as join24, relative as relative5, sep as sep4 } from "path";
|
|
29810
29926
|
import { randomBytes } from "crypto";
|
|
29811
29927
|
|
|
@@ -29929,7 +30045,7 @@ function existingFavicon(root) {
|
|
|
29929
30045
|
for (const d of ["app", "src/app"]) for (const f of ["favicon.ico", "icon.svg", "icon.png", "icon.tsx", "icon.jpg"]) if (existsSync21(join24(root, d, f))) return `${d}/${f}`;
|
|
29930
30046
|
for (const f of walk(root).filter((p) => /\.(html|astro|tsx|jsx|vue|svelte)$/.test(p)).slice(0, 400)) {
|
|
29931
30047
|
try {
|
|
29932
|
-
const m =
|
|
30048
|
+
const m = readFileSync17(f, "utf8").match(/<link\b[^>]*\brel=["'](?:shortcut )?icon["'][^>]*>/i);
|
|
29933
30049
|
if (!m) continue;
|
|
29934
30050
|
const href = m[0].match(/\shref=["']([^"']+)/i)?.[1] ?? "";
|
|
29935
30051
|
if (href.startsWith("data:") || /^https?:/.test(href) || existsSync21(join24(web, href.split("?")[0]))) return relative5(root, f).split(sep4).join("/");
|
|
@@ -29949,7 +30065,7 @@ function scannedIcons(root) {
|
|
|
29949
30065
|
for (const i of list) {
|
|
29950
30066
|
const path = join24(dir, i.file);
|
|
29951
30067
|
if (!existsSync21(path)) continue;
|
|
29952
|
-
const size = imageSize(
|
|
30068
|
+
const size = imageSize(readFileSync17(path));
|
|
29953
30069
|
found.push({ path, kind: i.kind, big: !size || size.width >= 64 });
|
|
29954
30070
|
}
|
|
29955
30071
|
} catch {
|
|
@@ -29975,7 +30091,7 @@ var CODE_EXT2 = /\.(css|scss|sass|less|html|astro|vue|svelte)$/i;
|
|
|
29975
30091
|
var READ_CAP = 300;
|
|
29976
30092
|
function readText2(path) {
|
|
29977
30093
|
try {
|
|
29978
|
-
return
|
|
30094
|
+
return readFileSync17(path, "utf8");
|
|
29979
30095
|
} catch {
|
|
29980
30096
|
return "";
|
|
29981
30097
|
}
|
|
@@ -30025,7 +30141,7 @@ function writeSiteFile(root, file2, data) {
|
|
|
30025
30141
|
copyFileSync(target, join24(keep, file2));
|
|
30026
30142
|
}
|
|
30027
30143
|
mkdirSync14(dirname8(target), { recursive: true });
|
|
30028
|
-
|
|
30144
|
+
writeFileSync20(target, data);
|
|
30029
30145
|
}
|
|
30030
30146
|
var send = (res, status, body = "", type = "text/plain; charset=utf-8") => {
|
|
30031
30147
|
res.writeHead(status, { "content-type": type, "cache-control": "no-store", "x-content-type-options": "nosniff" });
|
|
@@ -30060,7 +30176,7 @@ function allowed(req, url2, port, token) {
|
|
|
30060
30176
|
return req.headers.host === `127.0.0.1:${port}` && url2.searchParams.get("t") === token;
|
|
30061
30177
|
}
|
|
30062
30178
|
async function headless(browser, url2, width, until, timeoutMs) {
|
|
30063
|
-
const profile = mkdtempSync3(join24(
|
|
30179
|
+
const profile = mkdtempSync3(join24(tmpdir4(), "deployai-brand-"));
|
|
30064
30180
|
const child = spawn5(browser, ["--headless=new", "--disable-gpu", "--no-first-run", "--no-default-browser-check", "--disable-extensions", `--user-data-dir=${profile}`, `--window-size=${width},900`, url2], { stdio: "ignore", windowsHide: true });
|
|
30065
30181
|
child.on("error", () => {
|
|
30066
30182
|
});
|
|
@@ -30080,7 +30196,7 @@ async function headless(browser, url2, width, until, timeoutMs) {
|
|
|
30080
30196
|
setTimeout(done, 3e3);
|
|
30081
30197
|
});
|
|
30082
30198
|
try {
|
|
30083
|
-
|
|
30199
|
+
rmSync6(profile, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 });
|
|
30084
30200
|
} catch {
|
|
30085
30201
|
}
|
|
30086
30202
|
}
|
|
@@ -30160,7 +30276,7 @@ async function drawInBrowser(o, browser) {
|
|
|
30160
30276
|
}
|
|
30161
30277
|
}
|
|
30162
30278
|
function sourceBytes(path) {
|
|
30163
|
-
return { bytes:
|
|
30279
|
+
return { bytes: readFileSync17(path), type: TYPES[extname2(path).toLowerCase()] ?? "application/octet-stream" };
|
|
30164
30280
|
}
|
|
30165
30281
|
function report(root, r) {
|
|
30166
30282
|
const where = relative5(root, webRoot(root)).split(sep4).join("/") || "the site root";
|
|
@@ -30178,7 +30294,7 @@ function plainIcon(root, source, name, color) {
|
|
|
30178
30294
|
const ext = extname2(source.path).toLowerCase();
|
|
30179
30295
|
if (ext === ".ico" || ext === ".svg" || ext === ".png") {
|
|
30180
30296
|
const file2 = `favicon${ext}`;
|
|
30181
|
-
writeSiteFile(root, file2,
|
|
30297
|
+
writeSiteFile(root, file2, readFileSync17(source.path));
|
|
30182
30298
|
return [file2];
|
|
30183
30299
|
}
|
|
30184
30300
|
}
|
|
@@ -30334,7 +30450,7 @@ function judgeFiles(root) {
|
|
|
30334
30450
|
for (const f of files) {
|
|
30335
30451
|
let bytes;
|
|
30336
30452
|
try {
|
|
30337
|
-
bytes =
|
|
30453
|
+
bytes = readFileSync17(f);
|
|
30338
30454
|
} catch {
|
|
30339
30455
|
continue;
|
|
30340
30456
|
}
|
|
@@ -30387,7 +30503,7 @@ async function brandImagesCommand(root, urls, opts) {
|
|
|
30387
30503
|
mkdirSync14(join24(root, BRAND_DIR), { recursive: true });
|
|
30388
30504
|
const file2 = `${BRAND_DIR}/images.json`;
|
|
30389
30505
|
const data = { measuredAt: (/* @__PURE__ */ new Date()).toISOString(), pages: urls, unmeasured, filesChecked: total, imagesMeasured: shown.size, weak };
|
|
30390
|
-
|
|
30506
|
+
writeFileSync20(join24(root, file2), `${JSON.stringify(data, null, 2)}
|
|
30391
30507
|
`);
|
|
30392
30508
|
if (opts.json) {
|
|
30393
30509
|
out(JSON.stringify(data));
|
|
@@ -30610,7 +30726,7 @@ async function main(argv = process.argv) {
|
|
|
30610
30726
|
|
|
30611
30727
|
// src/update.ts
|
|
30612
30728
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
30613
|
-
import { existsSync as existsSync23, mkdirSync as mkdirSync15, readdirSync as readdirSync8, readFileSync as
|
|
30729
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync15, readdirSync as readdirSync8, readFileSync as readFileSync18, rmSync as rmSync7, writeFileSync as writeFileSync21 } from "fs";
|
|
30614
30730
|
import { join as join26 } from "path";
|
|
30615
30731
|
var CHECK_EVERY_MS = 60 * 60 * 1e3;
|
|
30616
30732
|
var ASK_NPM_MS = 1500;
|
|
@@ -30653,7 +30769,7 @@ function statePath() {
|
|
|
30653
30769
|
}
|
|
30654
30770
|
function readState() {
|
|
30655
30771
|
try {
|
|
30656
|
-
const data = JSON.parse(
|
|
30772
|
+
const data = JSON.parse(readFileSync18(statePath(), "utf8"));
|
|
30657
30773
|
return data && typeof data === "object" ? data : {};
|
|
30658
30774
|
} catch {
|
|
30659
30775
|
return {};
|
|
@@ -30662,7 +30778,7 @@ function readState() {
|
|
|
30662
30778
|
function writeState(state) {
|
|
30663
30779
|
try {
|
|
30664
30780
|
mkdirSync15(configDir(), { recursive: true });
|
|
30665
|
-
|
|
30781
|
+
writeFileSync21(statePath(), JSON.stringify(state) + "\n");
|
|
30666
30782
|
} catch {
|
|
30667
30783
|
}
|
|
30668
30784
|
}
|
|
@@ -30686,12 +30802,12 @@ function getVersion(version2, env) {
|
|
|
30686
30802
|
const root = join26(configDir(), "cli");
|
|
30687
30803
|
const dir = join26(root, version2);
|
|
30688
30804
|
mkdirSync15(dir, { recursive: true });
|
|
30689
|
-
|
|
30805
|
+
writeFileSync21(join26(dir, "package.json"), '{"private":true}\n');
|
|
30690
30806
|
const installed = spawnSync6(`npm install deployai@${version2} --ignore-scripts --no-audit --no-fund --silent`, { cwd: dir, env, shell: true, stdio: "ignore", windowsHide: true, timeout: GET_VERSION_MS });
|
|
30691
30807
|
if (installed.status !== 0) return false;
|
|
30692
30808
|
const ran = spawnSync6(process.execPath, [versionEntry(version2), "--version"], { env: { ...env, DEPLOYAI_NO_UPDATE: "1" }, encoding: "utf8", timeout: GET_VERSION_MS });
|
|
30693
30809
|
if (ran.status !== 0 || ran.stdout.trim() !== version2) return false;
|
|
30694
|
-
for (const old of readdirSync8(root)) if (old !== version2)
|
|
30810
|
+
for (const old of readdirSync8(root)) if (old !== version2) rmSync7(join26(root, old), { recursive: true, force: true });
|
|
30695
30811
|
return true;
|
|
30696
30812
|
}
|
|
30697
30813
|
function runVersion(version2, args, env = process.env) {
|