deployai 0.1.0-beta.30 → 0.1.0-beta.32
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 +3 -1
- package/dist/index.js +590 -260
- package/package.json +2 -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 resolve8 } from "path";
|
|
10
10
|
import { Command, CommanderError } from "commander";
|
|
11
11
|
|
|
12
12
|
// ../shared/src/plans.ts
|
|
@@ -6457,7 +6457,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
6457
6457
|
var NONE = 0;
|
|
6458
6458
|
var ASSUMED = 1;
|
|
6459
6459
|
var PROVEN = 2;
|
|
6460
|
-
function isRecursive(inst, stack,
|
|
6460
|
+
function isRecursive(inst, stack, resolve9) {
|
|
6461
6461
|
const cached2 = recursive.get(inst);
|
|
6462
6462
|
if (cached2 !== void 0)
|
|
6463
6463
|
return cached2 ? PROVEN : NONE;
|
|
@@ -6467,7 +6467,7 @@ function isRecursive(inst, stack, resolve7) {
|
|
|
6467
6467
|
let result = NONE;
|
|
6468
6468
|
const check2 = (child) => {
|
|
6469
6469
|
if (result !== PROVEN && child?._zod) {
|
|
6470
|
-
const answer = isRecursive(child, stack,
|
|
6470
|
+
const answer = isRecursive(child, stack, resolve9);
|
|
6471
6471
|
if (answer > result)
|
|
6472
6472
|
result = answer;
|
|
6473
6473
|
}
|
|
@@ -6478,7 +6478,7 @@ function isRecursive(inst, stack, resolve7) {
|
|
|
6478
6478
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
6479
6479
|
if (spread && !desc.enumerable)
|
|
6480
6480
|
continue;
|
|
6481
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
6481
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve9) : NONE;
|
|
6482
6482
|
if (child > answer)
|
|
6483
6483
|
answer = child;
|
|
6484
6484
|
}
|
|
@@ -6542,7 +6542,7 @@ function isRecursive(inst, stack, resolve7) {
|
|
|
6542
6542
|
break;
|
|
6543
6543
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
6544
6544
|
case "lazy": {
|
|
6545
|
-
const inner = def._cachedInner ?? (
|
|
6545
|
+
const inner = def._cachedInner ?? (resolve9 ? inst._zod.innerType : void 0);
|
|
6546
6546
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
6547
6547
|
break;
|
|
6548
6548
|
}
|
|
@@ -21290,7 +21290,9 @@ var Version = external_exports.object({
|
|
|
21290
21290
|
sizeBytes: external_exports.number(),
|
|
21291
21291
|
/** Why the build failed, in words the customer's AI can act on. Null unless status is failed. */
|
|
21292
21292
|
error: external_exports.string().nullable().optional(),
|
|
21293
|
-
migrationStatus: MigrationStatus.nullable().optional()
|
|
21293
|
+
migrationStatus: MigrationStatus.nullable().optional(),
|
|
21294
|
+
/** The preview address of a version waiting for review, once it is up (D-864). */
|
|
21295
|
+
preview: external_exports.string().nullable().optional()
|
|
21294
21296
|
});
|
|
21295
21297
|
var VersionsResponse = external_exports.object({ versions: external_exports.array(Version) });
|
|
21296
21298
|
var RequestsResponse = external_exports.object({ lines: external_exports.array(external_exports.object({ at: external_exports.number(), method: external_exports.string(), path: external_exports.string(), status: external_exports.number(), outcome: external_exports.string(), country: external_exports.string(), dropped: external_exports.number().optional() })).nullable() });
|
|
@@ -21437,7 +21439,7 @@ var DEFAULT_SLUG_RULES = [
|
|
|
21437
21439
|
"demo"
|
|
21438
21440
|
], "Platform"),
|
|
21439
21441
|
// The demo sites on <label>.<a sites domain> (packages/shared/src/demos.ts). The platform may use generic names.
|
|
21440
|
-
...exact("system", "platform", ["landing", "business", "form", "crud", "shop", "admin-demo"], "Demo site"),
|
|
21442
|
+
...exact("system", "platform", ["landing", "business", "form", "crud", "shop", "admin-demo", "dashboard-demo"], "Demo site"),
|
|
21441
21443
|
...contains("system", "brand", ["deployai", "deployme"], "Our brand"),
|
|
21442
21444
|
{ pattern: "^v[0-9]+-", match: "regex", kind: "system", category: "platform", note: "Version preview addresses (v3-mysite)" },
|
|
21443
21445
|
// Adult.
|
|
@@ -22250,7 +22252,8 @@ var DEPLOY_TOOL_NAMES = {
|
|
|
22250
22252
|
antigravity: "Antigravity",
|
|
22251
22253
|
gemini: "Gemini CLI",
|
|
22252
22254
|
opencode: "OpenCode",
|
|
22253
|
-
replit: "Replit"
|
|
22255
|
+
replit: "Replit",
|
|
22256
|
+
grok: "Grok Build"
|
|
22254
22257
|
};
|
|
22255
22258
|
var AI_AGENT_NAMES = [
|
|
22256
22259
|
[/claude/, "claudeCode"],
|
|
@@ -22260,13 +22263,15 @@ var AI_AGENT_NAMES = [
|
|
|
22260
22263
|
[/antigravity/, "antigravity"],
|
|
22261
22264
|
[/gemini/, "gemini"],
|
|
22262
22265
|
[/opencode/, "opencode"],
|
|
22263
|
-
[/replit/, "replit"]
|
|
22266
|
+
[/replit/, "replit"],
|
|
22267
|
+
[/grok/, "grok"]
|
|
22264
22268
|
];
|
|
22265
22269
|
function deployToolFromEnv(env) {
|
|
22266
22270
|
const named = env.AI_AGENT?.trim().toLowerCase();
|
|
22267
22271
|
if (named) return AI_AGENT_NAMES.find(([re]) => re.test(named))?.[1] ?? "other";
|
|
22268
22272
|
if (env.CLAUDECODE || env.CLAUDE_CODE) return "claudeCode";
|
|
22269
22273
|
if (env.CODEX_SANDBOX || env.CODEX_CI || env.CODEX_THREAD_ID) return "codex";
|
|
22274
|
+
if (env.GROK_AGENT === "1") return "grok";
|
|
22270
22275
|
if (env.GEMINI_CLI) return "gemini";
|
|
22271
22276
|
if (env.ANTIGRAVITY_AGENT) return "antigravity";
|
|
22272
22277
|
if (env.OPENCODE === "1" || env.OPENCODE_CLIENT) return "opencode";
|
|
@@ -22288,8 +22293,8 @@ var CHECK = { cmd: "npx deployai@latest check", say: "Fix every blocker it lists
|
|
|
22288
22293
|
var FIRST_LOOK_MESSAGE = "first look";
|
|
22289
22294
|
var FIRST_SITE_RULE = 'A site that has never been live (this folder is not linked yet, or npx deployai@latest status shows no live version) follows this, and not the rule for later changes. Right at the start, before you build, ask once, naming the site and its address when you know it: "When your site is ready, should I put it live for you? Anyone will be able to see it." The answers: Yes, put it live (recommended), or Show me first. Then go on working, and do not ask it again for this first version. Deploy twice. First, the first look: when a first version works, deploy without --live and send the owner the preview address. Make every change they ask for in the folder, without deploying. Second, when everything they asked for is done: on Yes, deploy with --live and give them the live address, with no more questions. On Show me first, deploy without it, send the preview address and ask: "Put it live, or change something first?" If nothing changed since the first look, there is nothing to build: run promote on that version instead of a second deploy. Deploy again only when a deploy failed, or the owner asks for more after the last one, and then put all of it in one deploy. Database changes still get their own yes.';
|
|
22290
22295
|
var DEPLOY_ASK_RULE = 'Once a site has been live, 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.';
|
|
22291
|
-
var ASK_OWNER_RULE =
|
|
22292
|
-
var QUESTION_FEATURE = { claudeCode: "AskUserQuestion", cursor: "AskQuestion", copilot: "askQuestions", codex: "request_user_input" };
|
|
22296
|
+
var ASK_OWNER_RULE = `When a question to the owner has set answers, use your tool's own question feature with clickable choices if it has one, for example AskUserQuestion in Claude Code, AskQuestion in Cursor, askQuestions in Copilot in VS Code, request_user_input in Codex, or ask_user_question in Grok Build. Use the owner's language, with each answer as its own choice. If your tool has no such feature, or it is refused or fails, ask the same question once in plain text and go on. Never change a mode or a setting to get it. A yes or no question has set answers too. This holds for every question, also one you think of yourself in the middle of the work: say what you have to say, then ask through the feature, never as the last line of your message. A question about going live names the site and its address when you know it, and says anyone will be able to see it, so the owner's answer is about this exact site (D-691). Open details, like a phone number or hours, stay in plain text, in one short list. How the owner wants you to work is saved in .deployai/owner-mode (D-865): on-my-own or check-with-me. If the file is missing, ask once, "How should I work?", with "On my own (recommended)": I build and choose the recommended option at every step, I stop only for money, deleting your content or your real domain, and I leave you a short list at the end; and "Check with me". Save the answer there, and change it when the owner says so. On my own: take the recommended option without asking, install the tools you need, and stop only for money, deleting the owner's content, a real domain going live or a fact you would have to invent, which you leave out and list. Every question opens with a short tag naming who asks, like "Search add-on \xB7 1 of 2" or "Move \xB7 forms", and a question with several items offers "Approve all (recommended)" first. Never ask the owner about a package, library, framework, tool, file path or size: ask about the outcome in plain words.`;
|
|
22297
|
+
var QUESTION_FEATURE = { claudeCode: "AskUserQuestion", cursor: "AskQuestion", copilot: "askQuestions", codex: "request_user_input", grok: "ask_user_question" };
|
|
22293
22298
|
function toolAskLine(tool) {
|
|
22294
22299
|
const feature = tool && QUESTION_FEATURE[tool];
|
|
22295
22300
|
return feature ? `You run in ${DEPLOY_TOOL_NAMES[tool]}, so every question with set answers goes through ${feature}.` : "";
|
|
@@ -22309,7 +22314,8 @@ var REPORT_SAY = "Once .deployai/migration/plan.md is written, with its features
|
|
|
22309
22314
|
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.` };
|
|
22310
22315
|
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." };
|
|
22311
22316
|
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.' };
|
|
22312
|
-
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.
|
|
22317
|
+
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." };
|
|
22318
|
+
var MOVE_SPEED = { cmd: "npx deployai@latest speed <address>", say: "Run it on the old site's home page and on the preview's home page, at phone width, and on one page of each other kind when they are built differently. The new site must score at least what the old one does, and aim for 90 or more. Fix the biggest items it lists: image sizes and formats, fonts, scripts that block the page, layout shifts. In a move that keeps the site exactly as it is, every fix keeps file names, fonts and scripts as they are: images only get lighter at the same path and size (D-866). Never drop or delay a tag, pixel or form to raise the score: loading tags later is the Performance add-on's job. One round only: make all the fixes, deploy once, run it and migrate verify once more, and go on whatever the score is then. Never start a second round. If the preview cannot be measured, measure the live address once right after it goes live instead. Tell the owner in one line the old and the new phone score, and when it is under 90, that the Performance add-on can raise it." };
|
|
22313
22319
|
var LOOK_BUILD = { say: "A first look, before the rest of the site: build the real home page now, as step 3 says, with the owner's logo, colors, photos and words from the scan, and only the contact details found there. Its menu and buttons lead only to what already works on this one page; leave the rest out for now. Never write coming soon or under construction." };
|
|
22314
22320
|
var LOOK_DEPLOY = { cmd: 'npx deployai@latest deploy -m "first look"', say: "Never with --live, and do not ask first: this one deploy is a private preview that visitors and Google do not see, and the old site and its domain stay as they are. It waits for the build and prints the preview address. Deploy it once, not for each small fix. If it fails and you cannot fix it soon, skip the next step and go on: the full preview is what the owner approves." };
|
|
22315
22321
|
var LOOK_OPEN = "Open the address once, and do not retry for more than two minutes: a new link can take a few minutes. If it still does not open, tell the owner in one line, go on building, and try it again after the next step. Never end your turn to wait for it. If the owner puts a version live by themselves, that is their choice: do not ask why, say in one line what it holds so far, and go on.";
|
|
@@ -22338,6 +22344,7 @@ var MIGRATE_STEPS = [
|
|
|
22338
22344
|
{ 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." },
|
|
22339
22345
|
{ 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, any credit to a site builder still on it, and every tag, conversion rule, hidden form field and file the old site had. Fix all of them in one pass, then deploy once and run it again, until it lists none. A credit the owner asked to keep is the only one that may stay: say so in .deployai/migration/plan.md." },
|
|
22340
22346
|
TAGS_FIRED,
|
|
22347
|
+
MOVE_SPEED,
|
|
22341
22348
|
SELF_SEND,
|
|
22342
22349
|
PROMOTE,
|
|
22343
22350
|
AFTER_LIVE
|
|
@@ -22355,7 +22362,7 @@ var MANAGED_STEPS = [
|
|
|
22355
22362
|
CHECK,
|
|
22356
22363
|
LOGIN,
|
|
22357
22364
|
// Whose account holds the site until the transfer is the team's own business (D-777): an agent that was told read it out.
|
|
22358
|
-
{ cmd: stepWith("link --create").cmd, say: "Makes the site and links this folder. Do not run the add-ons. Never mention which login or account holds the site, or a transfer." },
|
|
22365
|
+
{ cmd: stepWith("link --create").cmd, say: "Makes the site and links this folder. Do not run the add-ons now: the last step offers them. Never mention which login or account holds the site, or a transfer." },
|
|
22359
22366
|
LOOK_DEPLOY,
|
|
22360
22367
|
managedStatus("first_look", "<preview address>", `${LOOK_OPEN} Only once you saw the home page, not an empty or not found page. The owner gets one email that leads to this private link. Then build the rest of the site with the steps below.`),
|
|
22361
22368
|
DASHBOARD,
|
|
@@ -22368,11 +22375,13 @@ var MANAGED_STEPS = [
|
|
|
22368
22375
|
managedStatus("first_look", "<the new preview address>", "A site keeps one preview, so this deploy ended the old link. Report the new one, and again after any deploy below, until preview_ready. It sends no second email."),
|
|
22369
22376
|
stepWith("migrate verify"),
|
|
22370
22377
|
TAGS_FIRED,
|
|
22378
|
+
MOVE_SPEED,
|
|
22371
22379
|
managedStatus("preview_ready", "<preview address>", "The owner gets an email with the preview address."),
|
|
22372
22380
|
SEND_PREVIEW,
|
|
22373
22381
|
PROMOTE,
|
|
22374
22382
|
managedStatus("live", "<live address>", "Only after it is live. Say that it is live, and nothing about logins, accounts or a transfer."),
|
|
22375
|
-
AFTER_LIVE
|
|
22383
|
+
AFTER_LIVE,
|
|
22384
|
+
MOVE_ADDONS
|
|
22376
22385
|
];
|
|
22377
22386
|
var FIRST_ASK = { say: FIRST_SITE_RULE };
|
|
22378
22387
|
var FIRST_LOOK = { cmd: 'npx deployai@latest deploy -m "first look"', say: "When a first version works. Never with --live, whatever the owner answered: this is a private preview. It waits for the build and prints the preview address. Send it to the owner, say what is still missing in one line, and ask what to change. Do not ask about going live now, even if deploy suggests it: the owner answered that at the start. If it prints database changes, do not run them and do not promote this version: they wait for the last deploy, so say in one line that what needs them does not work on this link yet." };
|
|
@@ -22421,6 +22430,8 @@ var allowCommandsUrl = (lang = "he") => `${HELP_ORIGIN}${lang === "he" ? "" : "/
|
|
|
22421
22430
|
var runCommandsRule = (lang = "he") => `Run every npx deployai@latest command yourself. The package is DeployAI's own CLI: its code is public at github.com/yobotn/deployai-cli and npm shows where each version was built. If your tool shows the owner its own approval for a command, that approval is the question, so do not ask again. If it needs approval and shows the owner nothing, ask the owner one short yes or no question that names the command, for example "Run npx deployai@latest check?", and run it when they say yes. Never ask the owner to copy, paste or type a command. Right after the first command runs, before any other work, ask the owner once, unless your tool already allows our commands here: "Let your coding tool run DeployAI commands in this folder without asking each time? New versions of DeployAI will run too. Going live still waits for your answer." Only on yes run npx deployai@latest allow (add your tool's name if it asks: claude-code, cursor, copilot, codex or antigravity). Either way go on without stopping, and do not ask again. Never change your tool's settings any other way. If a command is still blocked after their yes, also by a safety check of your tool, never retry it, change it or run it another way. Say in one short sentence what was stopped, send them ${allowCommandsUrl(lang)}, which shows how to approve it in their tool, without copying its steps, and ask: "Your coding tool stopped this step. I approved it, or not yet?" If the stopped command was a deploy with --live, also offer a preview first. On I approved it, try once more.`;
|
|
22422
22431
|
var OWNER_TEXT_RULE = "Write to the owner in short plain text, with no file paths or setting names, and no escape codes or invisible direction marks such as \\u200E.";
|
|
22423
22432
|
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.";
|
|
22433
|
+
var START_FILE = ".deployai/start.md";
|
|
22434
|
+
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.`;
|
|
22424
22435
|
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.";
|
|
22425
22436
|
|
|
22426
22437
|
// ../shared/src/cli-map.ts
|
|
@@ -22438,7 +22449,7 @@ var CLI_MAP_NODES = [
|
|
|
22438
22449
|
// The CLI: every command (packages/cli/src/cli.ts).
|
|
22439
22450
|
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."),
|
|
22440
22451
|
n("cmd-migrate", "cli", "migrate scan / media / pages / posts / legal / redirects / verify / tags / report / 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."),
|
|
22441
|
-
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: dashboard (\u05DE\u05E2\u05E8\u05DB\u05EA \u05E0\u05D9\u05D4\u05D5\u05DC \u05E2\u05DD AI), 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 \u05E9\u05E9\u05D9\u05E0\u05D9\u05EA\u05DD.", "Our building blocks for an existing site: dashboard (the site's own back office), inbox (form and owner messages page), blog. Never writes over files you changed."),
|
|
22452
|
+
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: dashboard (\u05DE\u05E2\u05E8\u05DB\u05EA \u05E0\u05D9\u05D4\u05D5\u05DC \u05E2\u05DD AI), inbox (\u05D8\u05D5\u05E4\u05E1 \u05D5\u05E2\u05DE\u05D5\u05D3 \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05DC\u05D1\u05E2\u05DC\u05D9\u05DD), blog, late-tags (\u05EA\u05D2\u05D9 \u05DE\u05E2\u05E7\u05D1 \u05E9\u05E0\u05D8\u05E2\u05E0\u05D9\u05DD \u05E8\u05D2\u05E2 \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D4\u05E2\u05DE\u05D5\u05D3 \u05DE\u05D5\u05E4\u05D9\u05E2). \u05DC\u05D0 \u05D3\u05D5\u05E8\u05E1 \u05E7\u05D1\u05E6\u05D9\u05DD \u05E9\u05E9\u05D9\u05E0\u05D9\u05EA\u05DD.", "Our building blocks for an existing site: dashboard (the site's own back office), inbox (form and owner messages page), blog, late-tags (tracking tags that load a moment after the page shows). Never writes over files you changed."),
|
|
22442
22453
|
n("cmd-brand", "cli", "brand favicon / icons / images", "\u05D4\u05D0\u05D9\u05D9\u05E7\u05D5\u05E0\u05D9\u05DD \u05D5\u05EA\u05DE\u05D5\u05E0\u05EA \u05D4\u05E9\u05D9\u05EA\u05D5\u05E3 \u05E0\u05D5\u05E6\u05E8\u05D9\u05DD \u05D1\u05E7\u05D5\u05D3 \u05DE\u05D4\u05D0\u05EA\u05E8 \u05E2\u05E6\u05DE\u05D5: \u05D4\u05E9\u05DD, \u05D4\u05E6\u05D1\u05E2\u05D9\u05DD \u05D5\u05D4\u05DC\u05D5\u05D2\u05D5. favicon \u05D7\u05D9\u05E0\u05DD \u05DC\u05DB\u05DC \u05D0\u05EA\u05E8, \u05E1\u05D8 \u05DE\u05DC\u05D0, \u05D5\u05D3\u05D5\u05D7 \u05EA\u05DE\u05D5\u05E0\u05D5\u05EA \u05D7\u05DC\u05E9\u05D5\u05EA \u05DC\u05E4\u05D9 \u05DE\u05D3\u05D9\u05D3\u05D4. \u05DC\u05D0 \u05DE\u05D7\u05DC\u05D9\u05E3 \u05EA\u05DE\u05D5\u05E0\u05D4 \u05DC\u05D1\u05D3.", "The site's icons and share image, made by code from the site itself: its name, colors and logo. A free favicon for every site, the full set, and a measured report of weak images. Never replaces an image by itself."),
|
|
22443
22454
|
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."),
|
|
22444
22455
|
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."),
|
|
@@ -22464,6 +22475,8 @@ var CLI_MAP_NODES = [
|
|
|
22464
22475
|
n("cmd-addon-run", "cli", "addon run / done", "\u05EA\u05D5\u05E1\u05E3 \u05D0\u05D7\u05D3 \u05DC\u05E4\u05D9 \u05E9\u05DD, \u05D5\u05D3\u05D9\u05D5\u05D5\u05D7 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05E1\u05EA\u05D9\u05D9\u05DD.", "One add-on by name, and the report that a step is done."),
|
|
22465
22476
|
n("cmd-env", "cli", "env list / set / remove", "\u05DE\u05E9\u05EA\u05E0\u05D9 \u05D4\u05E1\u05D1\u05D9\u05D1\u05D4 \u05E9\u05DC \u05D4\u05D0\u05EA\u05E8. \u05E1\u05D5\u05D3 \u05DB\u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC, \u05D5\u05DC\u05D0 \u05DE\u05D5\u05E6\u05D2 \u05E9\u05D5\u05D1.", "The site's environment variables. A secret by default, never shown again."),
|
|
22466
22477
|
n("cmd-speed", "cli", "speed <url>", "\u05D1\u05D3\u05D9\u05E7\u05EA \u05DE\u05D4\u05D9\u05E8\u05D5\u05EA \u05E9\u05DC \u05DB\u05EA\u05D5\u05D1\u05EA \u05D7\u05D9\u05D4.", "A speed test of a live address."),
|
|
22478
|
+
n("cmd-shot", "cli", "shot <url>", "\u05EA\u05DE\u05D5\u05E0\u05D5\u05EA \u05D8\u05DC\u05E4\u05D5\u05DF \u05D5\u05DE\u05D7\u05E9\u05D1 \u05E9\u05DC \u05E2\u05DE\u05D5\u05D3, \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05E9\u05DB\u05D1\u05E8 \u05D1\u05DE\u05D7\u05E9\u05D1.", "Phone and desktop pictures of a page, with the browser already on the computer."),
|
|
22479
|
+
n("cmd-optimize", "cli", "optimize [folder]", "AVIF \u05D5\u05BEWebP \u05DC\u05D9\u05D3 \u05DB\u05DC \u05EA\u05DE\u05D5\u05E0\u05D4, \u05D1\u05DC\u05D9 \u05DC\u05D2\u05E2\u05EA \u05D1\u05DE\u05E7\u05D5\u05E8.", "AVIF and WebP next to each image, originals untouched."),
|
|
22467
22480
|
n("cmd-allow", "cli", "allow [tool]", "\u05D0\u05D7\u05E8\u05D9 \u05E9\u05D4\u05D1\u05E2\u05DC\u05D9\u05DD \u05D0\u05D9\u05E9\u05E8: \u05DB\u05DC\u05D9 \u05D4\u05E7\u05D5\u05D3 \u05DE\u05E4\u05E1\u05D9\u05E7 \u05DC\u05E9\u05D0\u05D5\u05DC \u05DC\u05E4\u05E0\u05D9 \u05DB\u05DC \u05E4\u05E7\u05D5\u05D3\u05EA DeployAI, \u05E8\u05E7 \u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5.", "After the owner says yes: the coding tool stops asking before every DeployAI command, in this folder only."),
|
|
22468
22481
|
n("cmd-sound", "cli", "sound", "\u05E6\u05DC\u05D9\u05DC \u05D1\u05DE\u05D7\u05E9\u05D1 \u05DB\u05E9\u05D4\u05D0\u05EA\u05E8 \u05DE\u05D5\u05DB\u05DF, \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D4\u05D1\u05E2\u05DC\u05D9\u05DD \u05D0\u05D9\u05E9\u05E8. \u05D1-Claude Code \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D4\u05D6\u05D4 \u05DE\u05D5\u05E1\u05D9\u05E3 \u05D2\u05DD \u05E6\u05DC\u05D9\u05DC \u05D5\u05E0\u05E7\u05D5\u05D3\u05D4 \u05D1\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA \u05E9\u05DC \u05D4\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC.", "A sound on this computer when the site is ready, after the owner says yes. In Claude Code that yes also adds a sound and a tab dot in the terminal."),
|
|
22469
22482
|
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."),
|
|
@@ -22488,6 +22501,7 @@ var CLI_MAP_NODES = [
|
|
|
22488
22501
|
n("api-check", "server", "/api/cli/check-results, telemetry, feedback", "\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4, \u05E0\u05EA\u05D5\u05E0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9 \u05D5\u05D4\u05E2\u05E8\u05D5\u05EA \u05E9\u05DC \u05D4\u05E1\u05D5\u05DB\u05DF, \u05D1\u05DC\u05D9 \u05E7\u05D5\u05D3.", "Check results, usage data and the agent's notes, no code."),
|
|
22489
22502
|
n("api-env", "server", "/api/cli/env", "\u05E8\u05E9\u05D9\u05DE\u05D4, \u05E7\u05D1\u05D9\u05E2\u05D4 \u05D5\u05D4\u05E1\u05E8\u05D4 \u05E9\u05DC \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD. \u05E1\u05D5\u05D3 \u05E0\u05E9\u05DC\u05D7 \u05DC\u05D0\u05EA\u05E8 \u05D4\u05D7\u05D9 \u05D5\u05DC\u05D0 \u05E0\u05E9\u05DE\u05E8.", "Lists, sets and removes variables. A secret goes to the live site and is not stored."),
|
|
22490
22503
|
n("api-speed", "server", "/api/cli/speed", "\u05D1\u05D3\u05D9\u05E7\u05EA \u05DE\u05D4\u05D9\u05E8\u05D5\u05EA \u05D1\u05EA\u05D5\u05E8.", "A queued speed test."),
|
|
22504
|
+
n("api-rules", "server", "/api/cli/rules", "\u05DB\u05DC\u05DC\u05D9 \u05D4\u05E1\u05D5\u05DB\u05DF \u05D4\u05E2\u05D3\u05DB\u05E0\u05D9\u05D9\u05DD, \u05D8\u05E7\u05E1\u05D8 \u05D1\u05DC\u05D1\u05D3, \u05E4\u05E2\u05DD \u05D1\u05D9\u05D5\u05DD.", "The current agent rules, text only, once a day."),
|
|
22491
22505
|
// The texts the agent gets: only what needs judgement (the prompt library, edited on the Texts tab).
|
|
22492
22506
|
n("text-start", "agent", "site.start", "\u05DE\u05EA\u05D0\u05D9\u05DE\u05D9\u05DD \u05D0\u05EA \u05D4\u05D3\u05D5\u05D2\u05DE\u05D4 \u05DC\u05E2\u05E1\u05E7, \u05D1\u05E9\u05E4\u05D5\u05EA \u05E9\u05DC \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8.", "Adapt the sample to the business, in the owner's languages."),
|
|
22493
22507
|
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."),
|
|
@@ -22511,6 +22525,7 @@ var CLI_MAP_EDGES = [
|
|
|
22511
22525
|
e("page-addons", "cmd-start"),
|
|
22512
22526
|
e("page-move", "cmd-start"),
|
|
22513
22527
|
e("cmd-start", "api-starts"),
|
|
22528
|
+
e("cmd-start", "api-rules"),
|
|
22514
22529
|
e("cmd-start", "cmd-login"),
|
|
22515
22530
|
e("cmd-start", "api-samples"),
|
|
22516
22531
|
e("cmd-samples", "api-samples"),
|
|
@@ -22982,6 +22997,8 @@ var moveReportSchema = external_exports.object({
|
|
|
22982
22997
|
plugins: external_exports.array(text(60)).max(20),
|
|
22983
22998
|
serverContainers: external_exports.array(text(255)).max(20),
|
|
22984
22999
|
rootFiles: external_exports.array(text(80)).max(20),
|
|
23000
|
+
/** Pages of the old site that read as a thank you page (D-834): a form's page to open after sending, so no one asks for it. */
|
|
23001
|
+
thanksPages: external_exports.array(page).max(20).optional(),
|
|
22985
23002
|
dns: external_exports.object({ records: external_exports.array(record2).max(600), unread: external_exports.array(text(255)).max(300), services: external_exports.array(text(60)).max(40) }).nullable(),
|
|
22986
23003
|
features: external_exports.array(external_exports.object({ name: text(200), status: text(60), note: text(300).optional() })).max(100),
|
|
22987
23004
|
answers: external_exports.partialRecord(external_exports.enum(QUESTION_KEYS), external_exports.enum(ANSWERS)).optional(),
|
|
@@ -23039,12 +23056,24 @@ function parsePlanFeatures(md) {
|
|
|
23039
23056
|
}
|
|
23040
23057
|
return rows2.slice(0, 100);
|
|
23041
23058
|
}
|
|
23059
|
+
var THANKS_PATH = /(^|[/_-])(thank|thanks|thankyou|toda|todah|תודה)([/_.-]|$)/i;
|
|
23060
|
+
var THANKS_TITLE = /^\s*(thank you|thanks|תודה)/i;
|
|
23061
|
+
function findThanksPages(pages) {
|
|
23062
|
+
const read = (p) => {
|
|
23063
|
+
try {
|
|
23064
|
+
return decodeURIComponent(p);
|
|
23065
|
+
} catch {
|
|
23066
|
+
return p;
|
|
23067
|
+
}
|
|
23068
|
+
};
|
|
23069
|
+
return pages.filter((p) => THANKS_PATH.test(read(p.path)) || THANKS_TITLE.test(p.title ?? "")).map((p) => p.path).slice(0, 20);
|
|
23070
|
+
}
|
|
23042
23071
|
function moveQuestions(r) {
|
|
23043
23072
|
const out2 = [];
|
|
23044
23073
|
const hasAds = r.tags.some((t) => TAG_CATALOG.find((c) => c.key === t.key)?.kind === "ads");
|
|
23045
|
-
if (r.plugins.length || hasAds && ["
|
|
23046
|
-
if (r.forms.length && !r.triggers.some((t) => t.type === "page")) out2.push("thankYou");
|
|
23047
|
-
if (!r.verification.some((v) => v.service === "Google Search Console")) out2.push("verificationFile");
|
|
23074
|
+
if (r.plugins.length || r.serverContainers?.length || hasAds && ["wix", "squarespace", "shopify"].includes(r.platform)) out2.push("serverPixel");
|
|
23075
|
+
if (r.forms.length && !r.triggers.some((t) => t.type === "page") && !r.thanksPages?.length) out2.push("thankYou");
|
|
23076
|
+
if (!r.verification.some((v) => v.service === "Google Search Console") && !r.dns?.services.includes("Google Search Console")) out2.push("verificationFile");
|
|
23048
23077
|
return out2;
|
|
23049
23078
|
}
|
|
23050
23079
|
function dashboardParts(r) {
|
|
@@ -23981,6 +24010,21 @@ function builderCredits(html) {
|
|
|
23981
24010
|
return [...found];
|
|
23982
24011
|
}
|
|
23983
24012
|
|
|
24013
|
+
// ../shared/src/deploy-models.ts
|
|
24014
|
+
var MODEL_ID_MAX = 48;
|
|
24015
|
+
var KNOWN_MODEL = /^(claude|opus|sonnet|haiku|fable|gpt|o[1-9]|chatgpt|codex|gemini|gemma|grok|composer|deepseek|qwen|kimi|glm|llama|mistral|codestral|devstral|minimax|nova|phi)/;
|
|
24016
|
+
function toDeployModel(v) {
|
|
24017
|
+
if (typeof v !== "string") return null;
|
|
24018
|
+
const id = v.trim().toLowerCase().replace(/\[[^\]]*\]/g, "").replace(/^.*\//, "").replace(/^([a-z]{2}\.)?anthropic\./, "").replace(/[\s_:]+/g, "-").replace(/[^a-z0-9.-]/g, "").replace(/^-+|-+$/g, "").slice(0, MODEL_ID_MAX);
|
|
24019
|
+
if (!id) return null;
|
|
24020
|
+
if (id === "other") return "other";
|
|
24021
|
+
return KNOWN_MODEL.test(id) ? id : "other";
|
|
24022
|
+
}
|
|
24023
|
+
function deployModelFromEnv(env) {
|
|
24024
|
+
return toDeployModel(env.ANTHROPIC_MODEL || env.COPILOT_MODEL);
|
|
24025
|
+
}
|
|
24026
|
+
var MODEL_FLAG_RULE = 'Add --model "<your exact model id, for example claude-opus-5-5 or gpt-5.1-codex>" to every npx deployai@latest deploy command. If you do not know it, leave the flag out rather than guess.';
|
|
24027
|
+
|
|
23984
24028
|
// ../shared/src/addon-signs.ts
|
|
23985
24029
|
var ADDON_STAMP_FILE = ".deployai/addons.json";
|
|
23986
24030
|
var ADDON_SIGNS = {
|
|
@@ -24121,8 +24165,27 @@ var CliError = class extends Error {
|
|
|
24121
24165
|
};
|
|
24122
24166
|
|
|
24123
24167
|
// src/project.ts
|
|
24124
|
-
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as
|
|
24168
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
24125
24169
|
import { join as join2 } from "path";
|
|
24170
|
+
|
|
24171
|
+
// src/json.ts
|
|
24172
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
24173
|
+
function readText(path) {
|
|
24174
|
+
const b = readFileSync2(path);
|
|
24175
|
+
if (b.length >= 2 && b[0] === 255 && b[1] === 254) return b.subarray(2).toString("utf16le");
|
|
24176
|
+
if (b.length >= 2 && b[0] === 254 && b[1] === 255) {
|
|
24177
|
+
const swapped = Buffer.from(b.subarray(2));
|
|
24178
|
+
swapped.swap16();
|
|
24179
|
+
return swapped.toString("utf16le");
|
|
24180
|
+
}
|
|
24181
|
+
const text2 = b.toString("utf8");
|
|
24182
|
+
return text2.charCodeAt(0) === 65279 ? text2.slice(1) : text2;
|
|
24183
|
+
}
|
|
24184
|
+
function readJson(path) {
|
|
24185
|
+
return JSON.parse(readText(path));
|
|
24186
|
+
}
|
|
24187
|
+
|
|
24188
|
+
// src/project.ts
|
|
24126
24189
|
var DEPLOYAI_DIR = ".deployai";
|
|
24127
24190
|
function projectFile(root) {
|
|
24128
24191
|
return join2(root, DEPLOYAI_DIR, "project.json");
|
|
@@ -24134,13 +24197,13 @@ function ensureDeployaiDir(root) {
|
|
|
24134
24197
|
const dir = join2(root, DEPLOYAI_DIR);
|
|
24135
24198
|
if (!existsSync2(dir)) mkdirSync2(dir, { recursive: true });
|
|
24136
24199
|
const ignore = join2(dir, ".gitignore");
|
|
24137
|
-
const have = existsSync2(ignore) ?
|
|
24138
|
-
const missing = ["last-check.json", "brief.md"].filter((f) => !have.split(/\r?\n/).includes(f));
|
|
24200
|
+
const have = existsSync2(ignore) ? readFileSync3(ignore, "utf8") : "";
|
|
24201
|
+
const missing = ["last-check.json", "brief.md", "start.md"].filter((f) => !have.split(/\r?\n/).includes(f));
|
|
24139
24202
|
if (missing.length) writeFileSync2(ignore, have + (have && !have.endsWith("\n") ? "\n" : "") + missing.join("\n") + "\n");
|
|
24140
24203
|
}
|
|
24141
24204
|
function readProject(root) {
|
|
24142
24205
|
try {
|
|
24143
|
-
const data =
|
|
24206
|
+
const data = readJson(projectFile(root));
|
|
24144
24207
|
return { projectId: null, ...data };
|
|
24145
24208
|
} catch {
|
|
24146
24209
|
return null;
|
|
@@ -24249,6 +24312,7 @@ var M = {
|
|
|
24249
24312
|
firstLookNext: " Version {n} is the private first look. Nothing waits for the owner: send the preview address and go on with the next step.",
|
|
24250
24313
|
previewNotYet: "The preview link is not answering yet. It can take a few minutes: go on working, and open it after your next step.",
|
|
24251
24314
|
publicLeftOut: " {count} files the site serves are not uploaded, because .gitignore leaves them out. The first: {file}",
|
|
24315
|
+
sameNameChanged: " {count} files changed but kept their name, so returning visitors may see the old one for up to a month. The first: {file}. Save a changed image under a new name with a short hash, like team-3f9a2c.webp, and update where it is used.",
|
|
24252
24316
|
publicLeftOutFix: " To upload them, add this line to .deployaiignore: !{dir}/",
|
|
24253
24317
|
statusWait: " To wait here until it ends: npx deployai@latest status --wait",
|
|
24254
24318
|
statusWaitSlow: "Still not done after 5 minutes. Run status again later.",
|
|
@@ -24494,6 +24558,7 @@ var M = {
|
|
|
24494
24558
|
firstLookNext: " \u05D2\u05E8\u05E1\u05D4 {n} \u05D4\u05D9\u05D0 \u05D4\u05DE\u05D1\u05D8 \u05D4\u05E8\u05D0\u05E9\u05D5\u05DF \u05D4\u05E4\u05E8\u05D8\u05D9. \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05DE\u05D7\u05DB\u05D4 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8: \u05E9\u05DC\u05D7\u05D5 \u05D0\u05EA \u05DB\u05EA\u05D5\u05D1\u05EA \u05D4\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D4\u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05D5\u05D4\u05DE\u05E9\u05D9\u05DB\u05D5 \u05DC\u05E9\u05DC\u05D1 \u05D4\u05D1\u05D0.",
|
|
24495
24559
|
previewNotYet: "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D4\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D4\u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05E2\u05D5\u05D3 \u05DC\u05D0 \u05E2\u05D5\u05E0\u05D4. \u05D6\u05D4 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E7\u05D7\u05EA \u05DB\u05DE\u05D4 \u05D3\u05E7\u05D5\u05EA: \u05D4\u05DE\u05E9\u05D9\u05DB\u05D5 \u05DC\u05E2\u05D1\u05D5\u05D3, \u05D5\u05E4\u05EA\u05D7\u05D5 \u05D0\u05D5\u05EA\u05D5 \u05D0\u05D7\u05E8\u05D9 \u05D4\u05E9\u05DC\u05D1 \u05D4\u05D1\u05D0.",
|
|
24496
24560
|
publicLeftOut: " {count} \u05E7\u05D1\u05E6\u05D9\u05DD \u05E9\u05D4\u05D0\u05EA\u05E8 \u05DE\u05D2\u05D9\u05E9 \u05DC\u05D0 \u05E2\u05D5\u05DC\u05D9\u05DD, \u05DB\u05D9 \u200E.gitignore \u05DE\u05D5\u05E6\u05D9\u05D0 \u05D0\u05D5\u05EA\u05DD. \u05D4\u05E8\u05D0\u05E9\u05D5\u05DF: {file}",
|
|
24561
|
+
sameNameChanged: " {count} \u05E7\u05D1\u05E6\u05D9\u05DD \u05D4\u05E9\u05EA\u05E0\u05D5 \u05D0\u05D1\u05DC \u05E9\u05DE\u05E8\u05D5 \u05E2\u05DC \u05D4\u05E9\u05DD, \u05D0\u05D6 \u05DE\u05D1\u05E7\u05E8\u05D9\u05DD \u05D7\u05D5\u05D6\u05E8\u05D9\u05DD \u05E2\u05DC\u05D5\u05DC\u05D9\u05DD \u05DC\u05E8\u05D0\u05D5\u05EA \u05D0\u05EA \u05D4\u05D9\u05E9\u05DF \u05E2\u05D3 \u05D7\u05D5\u05D3\u05E9. \u05D4\u05E8\u05D0\u05E9\u05D5\u05DF: {file}. \u05E9\u05DE\u05E8\u05D5 \u05EA\u05DE\u05D5\u05E0\u05D4 \u05E9\u05D4\u05E9\u05EA\u05E0\u05EA\u05D4 \u05D1\u05E9\u05DD \u05D7\u05D3\u05E9 \u05E2\u05DD \u05E7\u05D5\u05D3 \u05E7\u05E6\u05E8, \u05DB\u05DE\u05D5 team-3f9a2c.webp, \u05D5\u05E2\u05D3\u05DB\u05E0\u05D5 \u05D0\u05D9\u05E4\u05D4 \u05E9\u05D4\u05D9\u05D0 \u05D1\u05E9\u05D9\u05DE\u05D5\u05E9.",
|
|
24497
24562
|
publicLeftOutFix: " \u05DB\u05D3\u05D9 \u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05D5\u05EA\u05DD, \u05D4\u05D5\u05E1\u05D9\u05E4\u05D5 \u05D0\u05EA \u05D4\u05E9\u05D5\u05E8\u05D4 \u05D4\u05D6\u05D5 \u05DC\u05E7\u05D5\u05D1\u05E5 \u200E.deployaiignore: !{dir}/",
|
|
24498
24563
|
statusWait: " \u05DB\u05D3\u05D9 \u05DC\u05D7\u05DB\u05D5\u05EA \u05DB\u05D0\u05DF \u05E2\u05D3 \u05E9\u05D6\u05D4 \u05E0\u05D2\u05DE\u05E8: npx deployai@latest status --wait",
|
|
24499
24564
|
statusWaitSlow: "\u05E2\u05D5\u05D3 \u05DC\u05D0 \u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D0\u05D7\u05E8\u05D9 5 \u05D3\u05E7\u05D5\u05EA. \u05D4\u05E8\u05D9\u05E6\u05D5 status \u05E9\u05D5\u05D1 \u05DE\u05D0\u05D5\u05D7\u05E8 \u05D9\u05D5\u05EA\u05E8.",
|
|
@@ -24672,7 +24737,7 @@ function messages(root) {
|
|
|
24672
24737
|
}
|
|
24673
24738
|
|
|
24674
24739
|
// src/version.ts
|
|
24675
|
-
var CLI_VERSION = "0.1.0-beta.
|
|
24740
|
+
var CLI_VERSION = "0.1.0-beta.32";
|
|
24676
24741
|
|
|
24677
24742
|
// src/api.ts
|
|
24678
24743
|
function apiContext(apiFlag) {
|
|
@@ -24849,7 +24914,7 @@ var TELEMETRY_SENT = [
|
|
|
24849
24914
|
"OS, architecture and Node version (in the request header)",
|
|
24850
24915
|
"Your user id, only after login (from the login token), and only to the API that issued the login (D-557)",
|
|
24851
24916
|
"After a failed version, the one sentence you pass with deploy --fixed (what you changed, no code)",
|
|
24852
|
-
"With each deploy, which AI tool ran it (for example Claude Code or Codex), when the environment says so"
|
|
24917
|
+
"With each deploy, which AI tool ran it (for example Claude Code or Codex), when the environment says so, and which model (for example claude-opus-5-5), when the agent passes --model or the environment names it"
|
|
24853
24918
|
];
|
|
24854
24919
|
var ADDON_REPORT_NOTE = "Add-on reports (addon done --report) are part of the add-on you bought, so they are saved even with telemetry off. They can name the files the add-on changed.";
|
|
24855
24920
|
var MOVE_REPORT_NOTE = "The move report (migrate scan and verify, in a move started on the site) is part of the move, so it is saved even with telemetry off. It holds the old site's page addresses, public tag numbers and public DNS records, nothing private.";
|
|
@@ -24981,16 +25046,16 @@ async function feedbackCommand(root, ctx, opts) {
|
|
|
24981
25046
|
}
|
|
24982
25047
|
|
|
24983
25048
|
// src/commands/init.ts
|
|
24984
|
-
import { appendFileSync, existsSync as existsSync5, readFileSync as
|
|
25049
|
+
import { appendFileSync, existsSync as existsSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
|
|
24985
25050
|
import { join as join5 } from "path";
|
|
24986
25051
|
|
|
24987
25052
|
// src/analyze.ts
|
|
24988
25053
|
import { execFileSync } from "child_process";
|
|
24989
|
-
import { existsSync as existsSync4, readFileSync as
|
|
25054
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5, readdirSync as readdirSync2 } from "fs";
|
|
24990
25055
|
import { join as join4 } from "path";
|
|
24991
25056
|
|
|
24992
25057
|
// src/files.ts
|
|
24993
|
-
import { existsSync as existsSync3, readdirSync, readFileSync as
|
|
25058
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync4, lstatSync } from "fs";
|
|
24994
25059
|
import { join as join3 } from "path";
|
|
24995
25060
|
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
24996
25061
|
"node_modules",
|
|
@@ -25009,7 +25074,7 @@ function rootBuilds(root) {
|
|
|
25009
25074
|
const file2 = join3(root, "package.json");
|
|
25010
25075
|
if (!existsSync3(file2)) return false;
|
|
25011
25076
|
try {
|
|
25012
|
-
const pkg = JSON.parse(
|
|
25077
|
+
const pkg = JSON.parse(readFileSync4(file2, "utf8"));
|
|
25013
25078
|
return typeof pkg?.scripts?.build === "string";
|
|
25014
25079
|
} catch {
|
|
25015
25080
|
return true;
|
|
@@ -25080,7 +25145,7 @@ function isIgnored(rules, rel, isDir) {
|
|
|
25080
25145
|
}
|
|
25081
25146
|
function loadIgnore(root) {
|
|
25082
25147
|
try {
|
|
25083
|
-
return parseIgnore(
|
|
25148
|
+
return parseIgnore(readFileSync4(join3(root, ".deployaiignore"), "utf8"));
|
|
25084
25149
|
} catch {
|
|
25085
25150
|
return [];
|
|
25086
25151
|
}
|
|
@@ -25088,7 +25153,7 @@ function loadIgnore(root) {
|
|
|
25088
25153
|
function loadUploadIgnore(root) {
|
|
25089
25154
|
let git2 = [];
|
|
25090
25155
|
try {
|
|
25091
|
-
git2 = parseIgnore(
|
|
25156
|
+
git2 = parseIgnore(readFileSync4(join3(root, ".gitignore"), "utf8"));
|
|
25092
25157
|
} catch {
|
|
25093
25158
|
}
|
|
25094
25159
|
return [...git2, ...loadIgnore(root)];
|
|
@@ -25137,7 +25202,10 @@ function publicFilesLeftOut(root, plan) {
|
|
|
25137
25202
|
return walkFiles(root, { ignore: loadIgnore(root), skipEnv: true, maxFiles: 1e5 }).map((f) => f.rel).filter((rel) => /^(public|static)\//.test(rel) && !sent.has(rel) && !large.has(rel) && !neverUploadedFile(rel));
|
|
25138
25203
|
}
|
|
25139
25204
|
function planUpload(root) {
|
|
25140
|
-
const
|
|
25205
|
+
const byGit = walkFiles(root, { ignore: loadUploadIgnore(root), skipEnv: true, maxFiles: 1e5 });
|
|
25206
|
+
const seen = new Set(byGit.map((f) => f.rel));
|
|
25207
|
+
const served = walkFiles(root, { ignore: loadIgnore(root), skipEnv: true, maxFiles: 1e5 }).filter((f) => /^(public|static)\//.test(f.rel) && !seen.has(f.rel));
|
|
25208
|
+
const all = [...byGit, ...served];
|
|
25141
25209
|
const files = [];
|
|
25142
25210
|
const skippedLarge = [];
|
|
25143
25211
|
let totalBytes = 0;
|
|
@@ -25159,9 +25227,9 @@ var CODE_EXT = /\.(js|jsx|ts|tsx|mjs|cjs|mts|cts|vue|svelte|astro)$/;
|
|
|
25159
25227
|
var SECRET_SCAN_EXT = /\.(js|jsx|ts|tsx|mjs|cjs|mts|cts|vue|svelte|astro|json|ya?ml|toml|html|prisma)$/;
|
|
25160
25228
|
var LOCKFILES = /* @__PURE__ */ new Set(["package-lock.json", "pnpm-lock.yaml", "yarn.lock", "bun.lock", "bun.lockb"]);
|
|
25161
25229
|
var MAX_SCAN_BYTES = 1024 * 1024;
|
|
25162
|
-
function
|
|
25230
|
+
function readJson2(file2) {
|
|
25163
25231
|
try {
|
|
25164
|
-
return
|
|
25232
|
+
return readJson(file2);
|
|
25165
25233
|
} catch {
|
|
25166
25234
|
return null;
|
|
25167
25235
|
}
|
|
@@ -25257,7 +25325,7 @@ function detectFramework2(root, pkg, files, sources) {
|
|
|
25257
25325
|
files: files.map((f) => f.rel),
|
|
25258
25326
|
read: (rel) => {
|
|
25259
25327
|
try {
|
|
25260
|
-
return
|
|
25328
|
+
return readFileSync5(join4(root, rel), "utf8");
|
|
25261
25329
|
} catch {
|
|
25262
25330
|
return null;
|
|
25263
25331
|
}
|
|
@@ -25304,10 +25372,10 @@ function trackedEnvFiles(root) {
|
|
|
25304
25372
|
function analyzeProject(root) {
|
|
25305
25373
|
const files = walkFiles(root, { ignore: loadIgnore(root) });
|
|
25306
25374
|
const pkgPath = join4(root, "package.json");
|
|
25307
|
-
const pkg =
|
|
25375
|
+
const pkg = readJson2(pkgPath);
|
|
25308
25376
|
let pkgText = "";
|
|
25309
25377
|
try {
|
|
25310
|
-
pkgText =
|
|
25378
|
+
pkgText = readFileSync5(pkgPath, "utf8");
|
|
25311
25379
|
} catch {
|
|
25312
25380
|
}
|
|
25313
25381
|
const deps = { ...pkg?.devDependencies ?? {}, ...pkg?.dependencies ?? {} };
|
|
@@ -25329,7 +25397,7 @@ function analyzeProject(root) {
|
|
|
25329
25397
|
if (!isCode && !SECRET_SCAN_EXT.test(f.rel)) continue;
|
|
25330
25398
|
let raw;
|
|
25331
25399
|
try {
|
|
25332
|
-
raw =
|
|
25400
|
+
raw = readFileSync5(f.abs, "utf8");
|
|
25333
25401
|
} catch {
|
|
25334
25402
|
continue;
|
|
25335
25403
|
}
|
|
@@ -25418,7 +25486,7 @@ function analyzeProject(root) {
|
|
|
25418
25486
|
if (!f.rel.endsWith(".prisma")) continue;
|
|
25419
25487
|
let text2 = "";
|
|
25420
25488
|
try {
|
|
25421
|
-
text2 = stripComments(
|
|
25489
|
+
text2 = stripComments(readFileSync5(f.abs, "utf8"));
|
|
25422
25490
|
} catch {
|
|
25423
25491
|
continue;
|
|
25424
25492
|
}
|
|
@@ -25464,7 +25532,7 @@ function analyzeProject(root) {
|
|
|
25464
25532
|
if (!databases.some((d) => d.kind === "d1")) {
|
|
25465
25533
|
for (const name of ["wrangler.toml", "wrangler.json", "wrangler.jsonc"]) {
|
|
25466
25534
|
if (!existsSync4(join4(root, name))) continue;
|
|
25467
|
-
const text2 =
|
|
25535
|
+
const text2 = readFileSync5(join4(root, name), "utf8");
|
|
25468
25536
|
const at = text2.search(/d1_databases/);
|
|
25469
25537
|
if (at < 0) continue;
|
|
25470
25538
|
databases.push({ kind: "d1", via: "wrangler config", file: name, line: text2.slice(0, at).split("\n").length });
|
|
@@ -25473,7 +25541,7 @@ function analyzeProject(root) {
|
|
|
25473
25541
|
}
|
|
25474
25542
|
for (const name of ["wrangler.toml", "wrangler.json", "wrangler.jsonc"]) {
|
|
25475
25543
|
if (!existsSync4(join4(root, name))) continue;
|
|
25476
|
-
const text2 =
|
|
25544
|
+
const text2 = readFileSync5(join4(root, name), "utf8");
|
|
25477
25545
|
if (!parseWranglerConfig(name, text2).durableObjects.some((o) => o.script || !o.name || !o.className)) break;
|
|
25478
25546
|
const at = text2.search(/script_name/) >= 0 ? text2.search(/script_name/) : text2.search(/durable_objects/);
|
|
25479
25547
|
add({ code: "durable_objects", severity: "blocker", file: name, line: at < 0 ? 1 : text2.slice(0, at).split("\n").length, detail: "" });
|
|
@@ -25580,7 +25648,7 @@ function analyzeProject(root) {
|
|
|
25580
25648
|
function readWranglerConfig(root) {
|
|
25581
25649
|
for (const name of ["wrangler.toml", "wrangler.json", "wrangler.jsonc"]) {
|
|
25582
25650
|
try {
|
|
25583
|
-
return
|
|
25651
|
+
return readFileSync5(join4(root, name), "utf8");
|
|
25584
25652
|
} catch {
|
|
25585
25653
|
}
|
|
25586
25654
|
}
|
|
@@ -25632,7 +25700,7 @@ This project is published with DeployAI.
|
|
|
25632
25700
|
|
|
25633
25701
|
${FOLDER_READY_RULE}
|
|
25634
25702
|
|
|
25635
|
-
Always explain to the
|
|
25703
|
+
Always explain to the owner in simple words, in the language they write to you in. The owner may not read English.
|
|
25636
25704
|
|
|
25637
25705
|
${START_FAIL_LINE}
|
|
25638
25706
|
|
|
@@ -25660,7 +25728,7 @@ When the owner wants an outside service, such as card payments, invoices or send
|
|
|
25660
25728
|
|
|
25661
25729
|
## Do not run
|
|
25662
25730
|
|
|
25663
|
-
- wrangler commands that need a Cloudflare account (login, deploy, d1 create, r2 bucket create). Wrangler is installed only for local development. The
|
|
25731
|
+
- wrangler commands that need a Cloudflare account (login, deploy, d1 create, r2 bucket create). Wrangler is installed only for local development. The owner does not need a Cloudflare account: DeployAI creates the database and storage and publishes the site, with: npx deployai@latest deploy
|
|
25664
25732
|
|
|
25665
25733
|
## Keep existing data
|
|
25666
25734
|
|
|
@@ -25691,7 +25759,7 @@ ${AGENT_FEEDBACK_RULES.join("\n\n")}
|
|
|
25691
25759
|
## Check
|
|
25692
25760
|
|
|
25693
25761
|
Before adding a dependency or a new server feature, run: npx deployai@latest check
|
|
25694
|
-
Ask the
|
|
25762
|
+
Ask the owner before removing any existing functionality.
|
|
25695
25763
|
|
|
25696
25764
|
Files:
|
|
25697
25765
|
- .deployai/project.json: project id and settings (safe to commit)
|
|
@@ -25707,7 +25775,7 @@ var LATER_RULES = [
|
|
|
25707
25775
|
{ has: "never been live", text: FIRST_SITE_RULE }
|
|
25708
25776
|
];
|
|
25709
25777
|
function addMissingRules(md) {
|
|
25710
|
-
const text2 =
|
|
25778
|
+
const text2 = readFileSync6(md, "utf8");
|
|
25711
25779
|
const missing = LATER_RULES.filter((r) => !text2.includes(r.has));
|
|
25712
25780
|
if (!missing.length) return false;
|
|
25713
25781
|
const eol = text2.includes("\r\n") ? "\r\n" : "\n";
|
|
@@ -25731,7 +25799,7 @@ function runInit(root, opts = {}) {
|
|
|
25731
25799
|
if (opts.agentFiles !== false) {
|
|
25732
25800
|
for (const name of AGENT_FILES) {
|
|
25733
25801
|
const file2 = join5(root, name);
|
|
25734
|
-
const text2 = existsSync5(file2) ?
|
|
25802
|
+
const text2 = existsSync5(file2) ? readFileSync6(file2, "utf8") : null;
|
|
25735
25803
|
if (text2 === null) {
|
|
25736
25804
|
writeFileSync3(file2, `${AGENT_POINTER}
|
|
25737
25805
|
`);
|
|
@@ -26157,9 +26225,9 @@ function telemetryCommand(action) {
|
|
|
26157
26225
|
}
|
|
26158
26226
|
|
|
26159
26227
|
// src/commands/allow.ts
|
|
26160
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as
|
|
26228
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync5, appendFileSync as appendFileSync2 } from "fs";
|
|
26161
26229
|
import { dirname, join as join8 } from "path";
|
|
26162
|
-
var ALLOW_TOOLS = ["claude-code", "cursor", "copilot", "codex", "antigravity"];
|
|
26230
|
+
var ALLOW_TOOLS = ["claude-code", "cursor", "copilot", "codex", "antigravity", "grok"];
|
|
26163
26231
|
var CLAUDE_RULE = "Bash(npx deployai@latest *)";
|
|
26164
26232
|
var CURSOR_LINE = "Running npx deployai@latest commands is allowed without approval.";
|
|
26165
26233
|
var CLICKS = {
|
|
@@ -26170,7 +26238,7 @@ var CLICKS = {
|
|
|
26170
26238
|
function readObject(file2) {
|
|
26171
26239
|
if (!existsSync8(file2)) return {};
|
|
26172
26240
|
try {
|
|
26173
|
-
const v =
|
|
26241
|
+
const v = readJson(file2);
|
|
26174
26242
|
return v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
26175
26243
|
} catch {
|
|
26176
26244
|
return null;
|
|
@@ -26192,13 +26260,14 @@ function addTo(obj, key, list, value) {
|
|
|
26192
26260
|
function ignoreInGit(root, path) {
|
|
26193
26261
|
if (!existsSync8(join8(root, ".git"))) return;
|
|
26194
26262
|
const gi = join8(root, ".gitignore");
|
|
26195
|
-
const text2 = existsSync8(gi) ?
|
|
26263
|
+
const text2 = existsSync8(gi) ? readFileSync7(gi, "utf8") : "";
|
|
26196
26264
|
if (text2.split(/\r?\n/).some((l) => l.trim() === path)) return;
|
|
26197
26265
|
appendFileSync2(gi, `${text2 && !text2.endsWith("\n") ? "\n" : ""}${path}
|
|
26198
26266
|
`);
|
|
26199
26267
|
}
|
|
26200
26268
|
function detectTool() {
|
|
26201
|
-
|
|
26269
|
+
if (process.env.CLAUDECODE === "1") return "claude-code";
|
|
26270
|
+
return process.env.GROK_AGENT === "1" ? "grok" : null;
|
|
26202
26271
|
}
|
|
26203
26272
|
function allowCommand(tool) {
|
|
26204
26273
|
const root = process.cwd();
|
|
@@ -26211,7 +26280,8 @@ function allowCommand(tool) {
|
|
|
26211
26280
|
out(`Tools: ${ALLOW_TOOLS.join(", ")}.`);
|
|
26212
26281
|
return;
|
|
26213
26282
|
}
|
|
26214
|
-
if (picked === "claude-code") {
|
|
26283
|
+
if (picked === "claude-code" || picked === "grok") {
|
|
26284
|
+
const grok = picked === "grok";
|
|
26215
26285
|
const rel = ".claude/settings.local.json";
|
|
26216
26286
|
const file2 = join8(root, rel);
|
|
26217
26287
|
const obj = readObject(file2);
|
|
@@ -26221,8 +26291,14 @@ function allowCommand(tool) {
|
|
|
26221
26291
|
writeObject(file2, obj);
|
|
26222
26292
|
ignoreInGit(root, rel);
|
|
26223
26293
|
}
|
|
26224
|
-
|
|
26225
|
-
|
|
26294
|
+
if (grok) {
|
|
26295
|
+
out(added ? `Done: Grok Build runs npx deployai@latest commands in this folder without asking, from its next session (${rel}).` : "Already allowed in this folder.");
|
|
26296
|
+
out("Until Grok Build restarts, tell the owner, in their language: when it asks to run npx deployai@latest, choose Always allow.");
|
|
26297
|
+
out("Other commands still ask, and going live still waits for the owner.");
|
|
26298
|
+
} else {
|
|
26299
|
+
out(added ? `Done: Claude Code runs npx deployai@latest commands in this folder without asking (${rel}).` : "Already allowed in this folder.");
|
|
26300
|
+
out("Other commands still ask, and going live still waits for the owner. The owner can take it back with /permissions.");
|
|
26301
|
+
}
|
|
26226
26302
|
out(`If a safety check of the tool still stops a command, do not run it another way: send the owner ${allowCommandsUrl()}, the link only, not its steps (D-691).`);
|
|
26227
26303
|
return;
|
|
26228
26304
|
}
|
|
@@ -26242,7 +26318,7 @@ function allowCommand(tool) {
|
|
|
26242
26318
|
}
|
|
26243
26319
|
|
|
26244
26320
|
// src/commands/sound.ts
|
|
26245
|
-
import { existsSync as existsSync10, readFileSync as
|
|
26321
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8, rmSync, writeFileSync as writeFileSync7 } from "fs";
|
|
26246
26322
|
import { homedir as homedir2 } from "os";
|
|
26247
26323
|
import { join as join10 } from "path";
|
|
26248
26324
|
|
|
@@ -26336,9 +26412,12 @@ if (sound && !off) {
|
|
|
26336
26412
|
} catch {}
|
|
26337
26413
|
}
|
|
26338
26414
|
|
|
26339
|
-
|
|
26415
|
+
// Busy orange, done green, needs you or failed red (D-869). The emoji dot is in the title for every terminal; Windows Terminal
|
|
26416
|
+
// also lights its tab with its own progress state (OSC 9;4): busy spinning, done cleared, needs you yellow, failed red.
|
|
26417
|
+
const dot = { working: '\\u{1F7E0}', waiting: '\\u{1F534}', done: '\\u{1F7E2}', failed: '\\u{1F534}' }[state] ?? '';
|
|
26418
|
+
const progress = { working: '3;0', waiting: '4;100', done: '0;0', failed: '2;100' }[state];
|
|
26340
26419
|
const name = basename(String(event.cwd ?? '')).replace(/[^\\p{L}\\p{N} ._-]/gu, '').slice(0, 40) || 'DeployAI';
|
|
26341
|
-
process.stdout.write(JSON.stringify({ terminalSequence: '\\u001b]0;' + dot + ' ' + name + '\\u0007' }));
|
|
26420
|
+
process.stdout.write(JSON.stringify({ terminalSequence: '\\u001b]0;' + dot + ' ' + name + '\\u0007' + (progress ? '\\u001b]9;4;' + progress + '\\u0007' : '') }));
|
|
26342
26421
|
`;
|
|
26343
26422
|
}
|
|
26344
26423
|
var hookCommand = (state) => `node "$CLAUDE_PROJECT_DIR/${AGENT_SCRIPT}" ${state}`;
|
|
@@ -26370,7 +26449,7 @@ function agentOn(root, opts = {}) {
|
|
|
26370
26449
|
ensureDeployaiDir(root);
|
|
26371
26450
|
const script = join10(root, AGENT_SCRIPT);
|
|
26372
26451
|
const text2 = agentScript(soundsDir());
|
|
26373
|
-
const scriptSame = existsSync10(script) &&
|
|
26452
|
+
const scriptSame = existsSync10(script) && readFileSync8(script, "utf8") === text2;
|
|
26374
26453
|
if (!scriptSame) writeFileSync7(script, text2);
|
|
26375
26454
|
const hooks = hooksOf(obj);
|
|
26376
26455
|
const env = obj.env && typeof obj.env === "object" ? obj.env : {};
|
|
@@ -26478,12 +26557,22 @@ function soundCommand(root, action, state, tool, opts = {}) {
|
|
|
26478
26557
|
if (act !== "status") throw new CliError("Usage: npx deployai@latest sound on|off|status|test, or sound agent on|off", 1, "usage");
|
|
26479
26558
|
out(t(soundWanted(cfg) ? "soundOn" : "soundOff"));
|
|
26480
26559
|
}
|
|
26560
|
+
function refreshAgentScript(root) {
|
|
26561
|
+
const script = join10(root, AGENT_SCRIPT);
|
|
26562
|
+
if (!existsSync10(script)) return false;
|
|
26563
|
+
const text2 = agentScript(soundsDir());
|
|
26564
|
+
const now = readFileSync8(script, "utf8");
|
|
26565
|
+
if (now === text2 || !now.startsWith("// DeployAI's sound and tab dot")) return false;
|
|
26566
|
+
writeSoundFiles();
|
|
26567
|
+
writeFileSync7(script, text2);
|
|
26568
|
+
return true;
|
|
26569
|
+
}
|
|
26481
26570
|
|
|
26482
26571
|
// src/commands/link.ts
|
|
26483
26572
|
import { createInterface } from "readline/promises";
|
|
26484
26573
|
|
|
26485
26574
|
// src/commands/migrate.ts
|
|
26486
|
-
import { createWriteStream, existsSync as existsSync11, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as
|
|
26575
|
+
import { createWriteStream, existsSync as existsSync11, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync8 } from "fs";
|
|
26487
26576
|
import { dirname as dirname2, join as join11, posix, relative, resolve, sep } from "path";
|
|
26488
26577
|
import { Readable } from "stream";
|
|
26489
26578
|
import { pipeline } from "stream/promises";
|
|
@@ -26497,9 +26586,9 @@ var SCAN_WORKERS = 4;
|
|
|
26497
26586
|
var START_SCAN_PAGES = 300;
|
|
26498
26587
|
var sleep2 = (ms2) => new Promise((r) => setTimeout(r, ms2));
|
|
26499
26588
|
var hostDir = (root, host) => join11(root, MIGRATION_DIR, host.replace(/^www\./, ""));
|
|
26500
|
-
var
|
|
26589
|
+
var readJson3 = (file2) => {
|
|
26501
26590
|
try {
|
|
26502
|
-
return
|
|
26591
|
+
return readJson(file2);
|
|
26503
26592
|
} catch {
|
|
26504
26593
|
return null;
|
|
26505
26594
|
}
|
|
@@ -26531,7 +26620,7 @@ async function migrateStatusCommand(root, ctx, stage, note) {
|
|
|
26531
26620
|
out(`Reported: ${stage}${note ? ` (${stageNote(note)})` : ""}.`);
|
|
26532
26621
|
}
|
|
26533
26622
|
function readChoices(root) {
|
|
26534
|
-
return
|
|
26623
|
+
return readJson3(join11(root, MIGRATION_DIR, "choices.json"));
|
|
26535
26624
|
}
|
|
26536
26625
|
function writeChoices(root, choices) {
|
|
26537
26626
|
ensureMigrationDir(root);
|
|
@@ -26617,9 +26706,9 @@ async function wordpressContent(base, dir) {
|
|
|
26617
26706
|
out(` ${type}: ${items.length}`);
|
|
26618
26707
|
}
|
|
26619
26708
|
}
|
|
26620
|
-
const posts =
|
|
26709
|
+
const posts = readJson3(join11(dir, "content", "posts.json"));
|
|
26621
26710
|
if (posts?.length) {
|
|
26622
|
-
const files = wpPostsToMarkdown({ origin: new URL(base).origin, posts, categories:
|
|
26711
|
+
const files = wpPostsToMarkdown({ origin: new URL(base).origin, posts, categories: readJson3(join11(dir, "content", "categories.json")) ?? [], tags: readJson3(join11(dir, "content", "tags.json")) ?? [], users: readJson3(join11(dir, "content", "users.json")) ?? [], media: readJson3(join11(dir, "content", "media.json")) ?? [] });
|
|
26623
26712
|
mkdirSync5(join11(dir, "posts"), { recursive: true });
|
|
26624
26713
|
for (const f of files) writeFileSync8(join11(dir, "posts", f.file), f.text);
|
|
26625
26714
|
out(` posts as Markdown: ${files.length}`);
|
|
@@ -26751,10 +26840,10 @@ var stateFile = (dir) => join11(dir, "report-state.json");
|
|
|
26751
26840
|
function kitMap(root) {
|
|
26752
26841
|
if (!existsSync11(join11(root, "src/kit/schema.ts"))) return {};
|
|
26753
26842
|
const cut = (s, n2) => String(s ?? "").slice(0, n2);
|
|
26754
|
-
const pages = (
|
|
26755
|
-
const posts =
|
|
26756
|
-
const docs = [...new Set((
|
|
26757
|
-
const forms = (
|
|
26843
|
+
const pages = (readJson3(join11(root, MOVED_PAGES_FILE)) ?? []).slice(0, 150).map((p) => ({ path: cut(p.path, 300), title: cut(p.title, 80), inNav: Boolean(p.inNav) }));
|
|
26844
|
+
const posts = readJson3(join11(root, "src/kit/moved-posts.json")) ?? [];
|
|
26845
|
+
const docs = [...new Set((readJson3(join11(root, MOVED_LEGAL_FILE))?.docs ?? []).map((d) => d.key).filter((k) => k === "privacy" || k === "terms" || k === "cancellation"))];
|
|
26846
|
+
const forms = (readJson3(join11(root, "src/kit/forms.json")) ?? []).filter((f) => /^[a-z0-9-]{1,40}$/.test(f.key ?? "")).slice(0, 30).map((f) => ({
|
|
26758
26847
|
key: f.key,
|
|
26759
26848
|
label: cut(f.label, 80),
|
|
26760
26849
|
...f.page ? { page: cut(f.page, 300) } : {},
|
|
@@ -26765,15 +26854,25 @@ function kitMap(root) {
|
|
|
26765
26854
|
}
|
|
26766
26855
|
async function sendReport(root, ctx, host, open2, verify) {
|
|
26767
26856
|
const dir = hostDir(root, host);
|
|
26768
|
-
const inv =
|
|
26769
|
-
const site =
|
|
26857
|
+
const inv = readJson3(join11(dir, "inventory.json"));
|
|
26858
|
+
const site = readJson3(tagsFile(dir));
|
|
26770
26859
|
const startId = readChoices(root)?.startId;
|
|
26771
26860
|
if (!inv || !site) return;
|
|
26861
|
+
const dns = readJson3(join11(dir, "dns.json"));
|
|
26862
|
+
const thanksPages = findThanksPages(inv.pages);
|
|
26772
26863
|
if (open2 === "scan") {
|
|
26773
|
-
|
|
26864
|
+
if (thanksPages.length && site.forms.length) {
|
|
26865
|
+
const titled = thanksPages.map((p) => {
|
|
26866
|
+
const t = inv.pages.find((x) => x.path === p)?.title;
|
|
26867
|
+
return t ? `${p} (${t})` : p;
|
|
26868
|
+
});
|
|
26869
|
+
out();
|
|
26870
|
+
out(`Thank you pages on the old site: ${titled.join(", ")}. Keep each at its address. In src/kit/forms.json, give each form the one whose title fits it as its thank you page; a form no page fits shows the thank you message on its own page. Do not ask the owner: name in the plan which page each form opens.`);
|
|
26871
|
+
}
|
|
26872
|
+
const questions = moveQuestions({ plugins: site.plugins, platform: inv.platform, tags: site.tags, forms: site.forms, triggers: site.triggers, verification: site.verification, serverContainers: site.serverContainers, thanksPages, dns });
|
|
26774
26873
|
if (questions.length) {
|
|
26775
26874
|
out();
|
|
26776
|
-
out("Ask the owner, in plain words, and record each answer:");
|
|
26875
|
+
out("The scan cannot see these. Ask the owner, in plain words, and record each answer. Not sure keeps the old site as it is:");
|
|
26777
26876
|
if (questions.includes("serverPixel")) out(` Does the site send conversions to Meta or Google from the server?${site.plugins.length ? ` (signs: ${site.plugins.join(", ")})` : ""} npx deployai@latest migrate tags --answer serverPixel=yes`);
|
|
26778
26877
|
if (questions.includes("thankYou")) out(" Does a page open after sending the form, and what is its address? npx deployai@latest migrate tags --answer thankYou=yes");
|
|
26779
26878
|
if (questions.includes("verificationFile")) out(" Was the site verified in Google Search Console with a file, and what is its name? npx deployai@latest migrate tags --answer verificationFile=yes");
|
|
@@ -26788,11 +26887,10 @@ async function sendReport(root, ctx, host, open2, verify) {
|
|
|
26788
26887
|
out("The move report needs a start from the DeployAI site, so none was made here. Tell the owner the lists above in plain words.");
|
|
26789
26888
|
return;
|
|
26790
26889
|
}
|
|
26791
|
-
const state =
|
|
26792
|
-
const
|
|
26793
|
-
const
|
|
26794
|
-
const
|
|
26795
|
-
const assets = readJson2(join11(dir, "assets.json")) ?? [];
|
|
26890
|
+
const state = readJson3(stateFile(dir)) ?? {};
|
|
26891
|
+
const plan = existsSync11(join11(root, MIGRATION_DIR, "plan.md")) ? readFileSync9(join11(root, MIGRATION_DIR, "plan.md"), "utf8") : "";
|
|
26892
|
+
const saved = verify ?? readJson3(join11(dir, "verify-report.json"))?.report ?? null;
|
|
26893
|
+
const assets = readJson3(join11(dir, "assets.json")) ?? [];
|
|
26796
26894
|
const report2 = {
|
|
26797
26895
|
source: inv.source,
|
|
26798
26896
|
platform: inv.platform,
|
|
@@ -26800,6 +26898,7 @@ async function sendReport(root, ctx, host, open2, verify) {
|
|
|
26800
26898
|
pages: { total: inv.pages.length, broken: inv.pages.filter((p) => p.status >= 400).length, skipped: inv.skipped },
|
|
26801
26899
|
files: assets.length,
|
|
26802
26900
|
...reportOfTags(site),
|
|
26901
|
+
...thanksPages.length ? { thanksPages } : {},
|
|
26803
26902
|
dns: dns ?? null,
|
|
26804
26903
|
features: parsePlanFeatures(plan),
|
|
26805
26904
|
...state.answers ? { answers: state.answers } : {},
|
|
@@ -26888,7 +26987,7 @@ async function migrateScanCommand(root, raw, opts = {}) {
|
|
|
26888
26987
|
await addStylesheetAssets(assets);
|
|
26889
26988
|
const wordpressApi = platform3 === "wordpress" ? await wordpressContent(base, dir) : false;
|
|
26890
26989
|
if (wordpressApi) {
|
|
26891
|
-
const media =
|
|
26990
|
+
const media = readJson3(join11(dir, "content", "media.json")) ?? [];
|
|
26892
26991
|
media.forEach((m) => m.source_url && assets.add(m.source_url));
|
|
26893
26992
|
}
|
|
26894
26993
|
const known = new Set(pages.map((p) => p.path));
|
|
@@ -26953,9 +27052,9 @@ async function migrateMediaCommand(root) {
|
|
|
26953
27052
|
if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
|
|
26954
27053
|
for (const host of hosts) {
|
|
26955
27054
|
const dir = hostDir(root, host);
|
|
26956
|
-
const assets =
|
|
27055
|
+
const assets = readJson3(join11(dir, "assets.json")) ?? [];
|
|
26957
27056
|
const stateFile2 = join11(dir, "media-state.json");
|
|
26958
|
-
const state =
|
|
27057
|
+
const state = readJson3(stateFile2) ?? { done: [], failed: [], bytes: 0 };
|
|
26959
27058
|
const done = new Set(state.done);
|
|
26960
27059
|
const todo = assets.filter((a) => !done.has(a));
|
|
26961
27060
|
out(`${host}: ${assets.length} files, ${todo.length} left`);
|
|
@@ -27009,9 +27108,9 @@ function migratePostsCommand(root) {
|
|
|
27009
27108
|
const posts = [];
|
|
27010
27109
|
for (const host of hosts) {
|
|
27011
27110
|
const dir = hostDir(root, host);
|
|
27012
|
-
const inv =
|
|
27013
|
-
const list =
|
|
27014
|
-
if (inv && list?.length) posts.push(...wpPostsToKit({ origin: new URL(inv.source).origin, posts: list, categories:
|
|
27111
|
+
const inv = readJson3(join11(dir, "inventory.json"));
|
|
27112
|
+
const list = readJson3(join11(dir, "content", "posts.json"));
|
|
27113
|
+
if (inv && list?.length) posts.push(...wpPostsToKit({ origin: new URL(inv.source).origin, posts: list, categories: readJson3(join11(dir, "content", "categories.json")) ?? [], media: readJson3(join11(dir, "content", "media.json")) ?? [] }));
|
|
27015
27114
|
}
|
|
27016
27115
|
if (!posts.length) {
|
|
27017
27116
|
out("No posts in the scan. If the old site has posts, write src/kit/moved-posts.json yourself: .deployai/blocks/dashboard.md says how.");
|
|
@@ -27030,13 +27129,13 @@ function migratePagesCommand(root) {
|
|
|
27030
27129
|
if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
|
|
27031
27130
|
if (!existsSync11(join11(root, "src/kit/schema.ts"))) throw new CliError("The dashboard is not in this folder yet. Run: npx deployai@latest blocks dashboard", 1, "usage");
|
|
27032
27131
|
const file2 = join11(root, MOVED_PAGES_FILE);
|
|
27033
|
-
const before =
|
|
27132
|
+
const before = readJson3(file2);
|
|
27034
27133
|
const pages = [];
|
|
27035
27134
|
for (const host of hosts) {
|
|
27036
27135
|
const dir = hostDir(root, host);
|
|
27037
|
-
const inv =
|
|
27136
|
+
const inv = readJson3(join11(dir, "inventory.json"));
|
|
27038
27137
|
if (!inv) continue;
|
|
27039
|
-
const homeHtml = existsSync11(join11(dir, "home.html")) ?
|
|
27138
|
+
const homeHtml = existsSync11(join11(dir, "home.html")) ? readFileSync9(join11(dir, "home.html"), "utf8") : null;
|
|
27040
27139
|
for (const p of movedPagesFromScan({ pages: inv.pages, homeHtml, origin: new URL(inv.source).origin })) if (!pages.some((x) => x.path === p.path)) pages.push(p);
|
|
27041
27140
|
}
|
|
27042
27141
|
const kept = before?.length ? pages.filter((p) => before.some((b) => b.path === p.path)) : pages;
|
|
@@ -27052,8 +27151,8 @@ function migrateLegalCommand(root) {
|
|
|
27052
27151
|
const site = emptySiteTags();
|
|
27053
27152
|
for (const host of hosts) {
|
|
27054
27153
|
const dir = hostDir(root, host);
|
|
27055
|
-
pages.push(...
|
|
27056
|
-
const found =
|
|
27154
|
+
pages.push(...readJson3(join11(dir, "inventory.json"))?.pages ?? []);
|
|
27155
|
+
const found = readJson3(tagsFile(dir));
|
|
27057
27156
|
if (found) {
|
|
27058
27157
|
site.tags.push(...found.tags);
|
|
27059
27158
|
site.outside.push(...found.outside);
|
|
@@ -27061,7 +27160,7 @@ function migrateLegalCommand(root) {
|
|
|
27061
27160
|
}
|
|
27062
27161
|
}
|
|
27063
27162
|
const file2 = join11(root, MOVED_LEGAL_FILE);
|
|
27064
|
-
const legal = { ...movedLegalFromScan({ pages, site }), docs:
|
|
27163
|
+
const legal = { ...movedLegalFromScan({ pages, site }), docs: readJson3(file2)?.docs ?? [] };
|
|
27065
27164
|
writeFileSync8(file2, JSON.stringify(legal, null, 1));
|
|
27066
27165
|
out(`Wrote ${MOVED_LEGAL_FILE}: ${legal.duties.length} rows for the dashboard's Documents page, ${legal.forms.length} forms, ${legal.services.length} outside services.`);
|
|
27067
27166
|
for (const d of legal.duties) if (d.old) out(` ${d.key}: the old site has its own page at ${d.old}. Keep it. See "Accessibility and documents" in .deployai/blocks/dashboard.md.`);
|
|
@@ -27072,12 +27171,12 @@ function migrateRedirectsCommand(root) {
|
|
|
27072
27171
|
if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
|
|
27073
27172
|
const lines = /* @__PURE__ */ new Set();
|
|
27074
27173
|
for (const host of hosts) {
|
|
27075
|
-
const inv =
|
|
27174
|
+
const inv = readJson3(join11(hostDir(root, host), "inventory.json"));
|
|
27076
27175
|
if (inv) redirectLines(inv).forEach((l) => lines.add(l));
|
|
27077
27176
|
}
|
|
27078
27177
|
const publicDir = join11(root, "public");
|
|
27079
27178
|
const file2 = join11(existsSync11(publicDir) ? publicDir : root, "_redirects");
|
|
27080
|
-
const before = existsSync11(file2) ?
|
|
27179
|
+
const before = existsSync11(file2) ? readFileSync9(file2, "utf8").split(/\r?\n/).filter(Boolean) : [];
|
|
27081
27180
|
const added = [...lines].filter((l) => !before.some((b) => b.split(/\s+/)[0] === l.split(/\s+/)[0]));
|
|
27082
27181
|
writeFileSync8(file2, [...before, ...added].join("\n") + "\n");
|
|
27083
27182
|
out(`${relative(root, file2).split(sep).join("/")}: ${added.length} added, ${before.length + added.length} in all (at most 2,000; no query strings).`);
|
|
@@ -27087,7 +27186,7 @@ function allowedRedirects(root) {
|
|
|
27087
27186
|
const map2 = /* @__PURE__ */ new Map();
|
|
27088
27187
|
for (const file2 of [join11(root, "public", "_redirects"), join11(root, "_redirects")]) {
|
|
27089
27188
|
if (!existsSync11(file2)) continue;
|
|
27090
|
-
for (const line of
|
|
27189
|
+
for (const line of readFileSync9(file2, "utf8").split(/\r?\n/)) {
|
|
27091
27190
|
const [from, to] = line.trim().split(/\s+/);
|
|
27092
27191
|
if (from && to && !from.startsWith("#")) map2.set(from, to);
|
|
27093
27192
|
}
|
|
@@ -27117,13 +27216,13 @@ async function migrateTagsCommand(root, ctx, opts) {
|
|
|
27117
27216
|
const [k, v] = a.split("=");
|
|
27118
27217
|
if (!QUESTION_KEYS.includes(k) || !ANSWERS.includes(v)) throw new CliError(`Not an answer: ${a}. Use one of ${QUESTION_KEYS.join(", ")} = ${ANSWERS.join(", ")}, for example serverPixel=yes.`, 1, "usage");
|
|
27119
27218
|
}
|
|
27120
|
-
const urls = opts.requests ?
|
|
27219
|
+
const urls = opts.requests ? readFileSync9(resolve(root, opts.requests), "utf8").split(/\r?\n/) : [];
|
|
27121
27220
|
for (const host of hosts) {
|
|
27122
27221
|
const dir = hostDir(root, host);
|
|
27123
|
-
const site =
|
|
27124
|
-
const inv =
|
|
27222
|
+
const site = readJson3(tagsFile(dir));
|
|
27223
|
+
const inv = readJson3(join11(dir, "inventory.json"));
|
|
27125
27224
|
if (!site || !inv) continue;
|
|
27126
|
-
const state =
|
|
27225
|
+
const state = readJson3(stateFile(dir)) ?? {};
|
|
27127
27226
|
if (urls.length && opts.fired) {
|
|
27128
27227
|
const seen = emptySiteTags();
|
|
27129
27228
|
addBrowserRequests(seen, urls, inv.source);
|
|
@@ -27191,9 +27290,9 @@ async function migrateVerifyCommand(root, previewRaw, ctx, retryMs = PREVIEW_RET
|
|
|
27191
27290
|
const tagFindings = [];
|
|
27192
27291
|
const perHost = [];
|
|
27193
27292
|
for (const host of hosts) {
|
|
27194
|
-
const inv =
|
|
27195
|
-
const oldSite =
|
|
27196
|
-
const state =
|
|
27293
|
+
const inv = readJson3(join11(hostDir(root, host), "inventory.json"));
|
|
27294
|
+
const oldSite = readJson3(tagsFile(hostDir(root, host)));
|
|
27295
|
+
const state = readJson3(stateFile(hostDir(root, host))) ?? {};
|
|
27197
27296
|
const nextSite = emptySiteTags();
|
|
27198
27297
|
const triggerFound = {};
|
|
27199
27298
|
const formIdFound = {};
|
|
@@ -27392,8 +27491,33 @@ async function askYes(question) {
|
|
|
27392
27491
|
return answer === "y" || answer === "yes";
|
|
27393
27492
|
}
|
|
27394
27493
|
|
|
27494
|
+
// src/same-name.ts
|
|
27495
|
+
import { createHash } from "crypto";
|
|
27496
|
+
import { mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "fs";
|
|
27497
|
+
import { dirname as dirname3, join as join12 } from "path";
|
|
27498
|
+
var LAST_FILES = ".deployai/last-files.json";
|
|
27499
|
+
var KEPT = /^(public|static)\/.*\.(avif|webp|png|jpe?g|gif|svg|ico|woff2?|ttf|otf|mp4|webm|css|js|mjs)$/i;
|
|
27500
|
+
var HASHED = /[.-][A-Za-z0-9_]{6,20}\.[a-z0-9]+$/;
|
|
27501
|
+
var digest = (abs) => createHash("sha1").update(readFileSync10(abs)).digest("hex").slice(0, 16);
|
|
27502
|
+
function changedUnderSameName(root, files) {
|
|
27503
|
+
const now = {};
|
|
27504
|
+
for (const f of files) if (KEPT.test(f.rel) && !HASHED.test(f.rel.split("/").pop() ?? "")) now[f.rel] = digest(f.abs);
|
|
27505
|
+
let before = {};
|
|
27506
|
+
try {
|
|
27507
|
+
before = readJson(join12(root, LAST_FILES));
|
|
27508
|
+
} catch {
|
|
27509
|
+
}
|
|
27510
|
+
const changed = Object.keys(now).filter((rel) => before[rel] && before[rel] !== now[rel]).sort();
|
|
27511
|
+
try {
|
|
27512
|
+
mkdirSync6(dirname3(join12(root, LAST_FILES)), { recursive: true });
|
|
27513
|
+
writeFileSync9(join12(root, LAST_FILES), JSON.stringify(now));
|
|
27514
|
+
} catch {
|
|
27515
|
+
}
|
|
27516
|
+
return changed;
|
|
27517
|
+
}
|
|
27518
|
+
|
|
27395
27519
|
// src/tar.ts
|
|
27396
|
-
import { readFileSync as
|
|
27520
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
27397
27521
|
import { gzipSync } from "zlib";
|
|
27398
27522
|
var BLOCK = 512;
|
|
27399
27523
|
function writeString(buf, offset, length, value) {
|
|
@@ -27477,7 +27601,7 @@ function packFiles(files) {
|
|
|
27477
27601
|
return createTarGz(
|
|
27478
27602
|
files.map((f) => ({
|
|
27479
27603
|
name: f.rel,
|
|
27480
|
-
data:
|
|
27604
|
+
data: readFileSync11(f.abs),
|
|
27481
27605
|
mtimeMs: f.mtimeMs,
|
|
27482
27606
|
mode: f.mode & 64 ? 493 : 420
|
|
27483
27607
|
}))
|
|
@@ -27553,6 +27677,7 @@ async function versionsCommand(root, ctx) {
|
|
|
27553
27677
|
];
|
|
27554
27678
|
out(` ${cols.join("")}`);
|
|
27555
27679
|
if (v.error) out(` ${v.error}`);
|
|
27680
|
+
if (v.preview) out(` ${v.preview}`);
|
|
27556
27681
|
if (v.migrationStatus === "waiting") out(` ${messages(root)("sqlWaitingLine", { n: v.number })}`);
|
|
27557
27682
|
}
|
|
27558
27683
|
}
|
|
@@ -27775,6 +27900,7 @@ function expiryDate(iso) {
|
|
|
27775
27900
|
return Number.isNaN(d.getTime()) ? iso : d.toISOString().slice(0, 10);
|
|
27776
27901
|
}
|
|
27777
27902
|
var BUILD_WAIT_MS = 15 * 6e4;
|
|
27903
|
+
var PREVIEW_WAIT_MS = 2 * 6e4;
|
|
27778
27904
|
var LIVE_WAIT_MS = 3 * 6e4;
|
|
27779
27905
|
async function deployCommand(root, ctx, opts) {
|
|
27780
27906
|
const project = readProject(root);
|
|
@@ -27814,6 +27940,8 @@ async function prepare(root, ctx, maxBytes) {
|
|
|
27814
27940
|
out(t("publicLeftOut", { count: leftOut.length, file: leftOut[0] }));
|
|
27815
27941
|
out(t("publicLeftOutFix", { dir: leftOut[0].split("/").slice(0, 2).join("/") }));
|
|
27816
27942
|
}
|
|
27943
|
+
const sameName = changedUnderSameName(root, plan.files);
|
|
27944
|
+
if (sameName.length) out(t("sameNameChanged", { count: sameName.length, file: sameName[0] }));
|
|
27817
27945
|
const archive = packFiles(plan.files);
|
|
27818
27946
|
if (archive.length > maxBytes) throw new CliError(t("uploadTooLargeGuest", { size: formatBytes(archive.length), max: formatBytes(maxBytes) }), 1, "too_large");
|
|
27819
27947
|
const info = [[t("files"), `${plan.files.length} (${formatBytes(plan.totalBytes)}, packed ${formatBytes(archive.length)})`]];
|
|
@@ -27823,9 +27951,12 @@ async function prepare(root, ctx, maxBytes) {
|
|
|
27823
27951
|
}
|
|
27824
27952
|
return { archive, info, hasSql: plan.files.some((f) => SQL_FILE.test(f.rel) && !f.rel.includes("node_modules/")) };
|
|
27825
27953
|
}
|
|
27826
|
-
function addTool(form, ctx) {
|
|
27827
|
-
|
|
27954
|
+
function addTool(form, ctx, model) {
|
|
27955
|
+
if (!telemetryEnabled(ctx.config)) return;
|
|
27956
|
+
const tool = deployToolFromEnv(process.env);
|
|
27828
27957
|
if (tool) form.append("tool", tool);
|
|
27958
|
+
const m = toDeployModel(model) ?? deployModelFromEnv(process.env);
|
|
27959
|
+
if (m) form.append("model", m);
|
|
27829
27960
|
}
|
|
27830
27961
|
async function deployVersion(root, ctx, opts, guest) {
|
|
27831
27962
|
requireToken(ctx);
|
|
@@ -27847,7 +27978,7 @@ async function deployVersion(root, ctx, opts, guest) {
|
|
|
27847
27978
|
form.append("message", message);
|
|
27848
27979
|
const fixed = (opts.fixed ?? "").replace(/\s+/g, " ").trim().slice(0, 300);
|
|
27849
27980
|
if (fixed && telemetryEnabled(ctx.config)) form.append("fixNote", fixed);
|
|
27850
|
-
addTool(form, ctx);
|
|
27981
|
+
addTool(form, ctx, opts.model);
|
|
27851
27982
|
if (wait && soundWanted(ctx.config)) form.append("soundHere", live ? "live" : "preview");
|
|
27852
27983
|
form.append("archive", new Blob([new Uint8Array(archive)], { type: "application/gzip" }), "source.tar.gz");
|
|
27853
27984
|
const res = await apiRequest(ctx, "/api/cli/deploy", DeployResponse, { method: "POST", form, timeoutMs: 5 * 6e4 });
|
|
@@ -27904,6 +28035,11 @@ async function afterBuild(root, ctx, projectId, n2, o) {
|
|
|
27904
28035
|
return;
|
|
27905
28036
|
}
|
|
27906
28037
|
const ready = built.latest?.number === n2 && built.latest.status === "ready" && built.project.liveVersion !== n2;
|
|
28038
|
+
if (ready && !built.latest?.preview) {
|
|
28039
|
+
const withPreview = await poll(root, ctx, projectId, n2, o.pollMs, PREVIEW_WAIT_MS, (s) => Boolean(s.latest?.preview) || s.latest?.number !== n2);
|
|
28040
|
+
if (withPreview?.latest?.number === n2 && withPreview.latest.preview) built.latest = withPreview.latest;
|
|
28041
|
+
else out(t("previewNotYet"));
|
|
28042
|
+
}
|
|
27907
28043
|
if (ready && built.latest?.preview) {
|
|
27908
28044
|
if (!await homeAnswers(root, built.latest.preview, o.homeRetryMs)) {
|
|
27909
28045
|
process.exitCode = 1;
|
|
@@ -28022,7 +28158,7 @@ async function deployGuest(root, ctx, opts) {
|
|
|
28022
28158
|
out(t("uploading"));
|
|
28023
28159
|
const form = new FormData();
|
|
28024
28160
|
form.append("message", message);
|
|
28025
|
-
addTool(form, ctx);
|
|
28161
|
+
addTool(form, ctx, opts.model);
|
|
28026
28162
|
form.append("archive", new Blob([new Uint8Array(archive)], { type: "application/gzip" }), "source.tar.gz");
|
|
28027
28163
|
const res = await apiRequest(ctx, "/api/cli/guest", GuestResponse, { method: "POST", form, auth: false, timeoutMs: 5 * 6e4 });
|
|
28028
28164
|
updateConfig({ guestTokens: { ...ctx.config.guestTokens ?? {}, [res.projectId]: res.token }, guestClaims: { ...ctx.config.guestClaims ?? {}, [res.projectId]: res.claimUrl } });
|
|
@@ -28064,12 +28200,12 @@ async function claimCommand(root, ctx, opts) {
|
|
|
28064
28200
|
// src/commands/pull.ts
|
|
28065
28201
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
28066
28202
|
import { existsSync as existsSync13, readdirSync as readdirSync5, rmSync as rmSync2 } from "fs";
|
|
28067
|
-
import { join as
|
|
28203
|
+
import { join as join14 } from "path";
|
|
28068
28204
|
|
|
28069
28205
|
// src/commands/samples.ts
|
|
28070
28206
|
import { createInterface as createInterface3 } from "readline/promises";
|
|
28071
|
-
import { existsSync as existsSync12, mkdirSync as
|
|
28072
|
-
import { dirname as
|
|
28207
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync7, readdirSync as readdirSync4, writeFileSync as writeFileSync10 } from "fs";
|
|
28208
|
+
import { dirname as dirname4, join as join13, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
|
|
28073
28209
|
import { gunzipSync } from "zlib";
|
|
28074
28210
|
var SAMPLES = [
|
|
28075
28211
|
{ key: "landing", title: "Landing page: a full one-page site with WhatsApp sign-up", stack: "static HTML and CSS" },
|
|
@@ -28119,7 +28255,7 @@ async function askWhere(cwd, key, count) {
|
|
|
28119
28255
|
}
|
|
28120
28256
|
}
|
|
28121
28257
|
async function downloadSample(ctx, key, root) {
|
|
28122
|
-
|
|
28258
|
+
mkdirSync7(root, { recursive: true });
|
|
28123
28259
|
let res;
|
|
28124
28260
|
try {
|
|
28125
28261
|
res = await fetch(`${ctx.apiUrl}/samples-src/${key}.tar.gz`, {
|
|
@@ -28141,7 +28277,7 @@ function extractInto(gz, root, damaged) {
|
|
|
28141
28277
|
} catch {
|
|
28142
28278
|
throw new CliError(damaged, 1, "api");
|
|
28143
28279
|
}
|
|
28144
|
-
|
|
28280
|
+
mkdirSync7(root, { recursive: true });
|
|
28145
28281
|
const base = resolve2(root);
|
|
28146
28282
|
let written = 0;
|
|
28147
28283
|
for (const e3 of entries) {
|
|
@@ -28149,8 +28285,8 @@ function extractInto(gz, root, damaged) {
|
|
|
28149
28285
|
if (privateProjectFile(e3.name.replace(/\\/g, "/"))) continue;
|
|
28150
28286
|
const target = resolve2(base, e3.name);
|
|
28151
28287
|
if (target !== base && !target.startsWith(base + sep2)) continue;
|
|
28152
|
-
|
|
28153
|
-
|
|
28288
|
+
mkdirSync7(dirname4(target), { recursive: true });
|
|
28289
|
+
writeFileSync10(target, e3.data);
|
|
28154
28290
|
written++;
|
|
28155
28291
|
}
|
|
28156
28292
|
return written;
|
|
@@ -28174,7 +28310,7 @@ async function samplesCommand(cwd, ctx, key, opts = {}) {
|
|
|
28174
28310
|
}
|
|
28175
28311
|
const written = await downloadSample(ctx, sample.key, root);
|
|
28176
28312
|
const base = resolve2(root);
|
|
28177
|
-
const hasPackage = existsSync12(
|
|
28313
|
+
const hasPackage = existsSync12(join13(base, "package.json"));
|
|
28178
28314
|
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.`);
|
|
28179
28315
|
out("");
|
|
28180
28316
|
const t = messages(base);
|
|
@@ -28231,7 +28367,7 @@ var git = (root, args, env = {}) => spawnSync2("git", args, { cwd: root, encodin
|
|
|
28231
28367
|
function clearTree(root) {
|
|
28232
28368
|
for (const name of readdirSync5(root)) {
|
|
28233
28369
|
if (name === ".git" || name === ".deployai") continue;
|
|
28234
|
-
rmSync2(
|
|
28370
|
+
rmSync2(join14(root, name), { recursive: true, force: true });
|
|
28235
28371
|
}
|
|
28236
28372
|
}
|
|
28237
28373
|
async function pullHistory(root, ctx, projectId) {
|
|
@@ -28241,7 +28377,7 @@ async function pullHistory(root, ctx, projectId) {
|
|
|
28241
28377
|
const live = versions.find((v) => v.isLive)?.number ?? Math.max(0, ...versions.filter((v) => v.status === "ready").map((v) => v.number));
|
|
28242
28378
|
const chosen = versions.filter((v) => v.number <= live && v.status !== "failed" && v.status !== "queued").sort((a, b) => a.number - b.number);
|
|
28243
28379
|
if (!chosen.length) throw new CliError(t("pullNoSource"), 1, "not_found");
|
|
28244
|
-
if (!existsSync13(
|
|
28380
|
+
if (!existsSync13(join14(root, ".git")) && git(root, ["init", "-q"]).status !== 0) throw new CliError(t("pullNoGit"), 1, "usage");
|
|
28245
28381
|
for (const v of chosen) {
|
|
28246
28382
|
const gz = await fetchSource(root, ctx, projectId, v.number).catch(() => null);
|
|
28247
28383
|
if (!gz) continue;
|
|
@@ -28292,12 +28428,52 @@ async function requestsOpenCommand(root, ctx, path, open2) {
|
|
|
28292
28428
|
|
|
28293
28429
|
// src/commands/start.ts
|
|
28294
28430
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
28295
|
-
import { existsSync as existsSync14, writeFileSync as
|
|
28296
|
-
import { join as
|
|
28431
|
+
import { existsSync as existsSync14, writeFileSync as writeFileSync13 } from "fs";
|
|
28432
|
+
import { join as join17, relative as relative3, resolve as resolve3 } from "path";
|
|
28433
|
+
|
|
28434
|
+
// src/rules.ts
|
|
28435
|
+
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync11 } from "fs";
|
|
28436
|
+
import { join as join15 } from "path";
|
|
28437
|
+
var CACHE_FILE = "rules-cache.json";
|
|
28438
|
+
var DAY_MS = 864e5;
|
|
28439
|
+
var WAIT_MS2 = 2e3;
|
|
28440
|
+
var EMPTY = { rules: {}, extra: [] };
|
|
28441
|
+
function cleanRules(v) {
|
|
28442
|
+
const o = v && typeof v === "object" ? v : {};
|
|
28443
|
+
const rules = {};
|
|
28444
|
+
if (o.rules && typeof o.rules === "object") {
|
|
28445
|
+
for (const [k, t] of Object.entries(o.rules)) if (typeof t === "string" && t.trim() && t.length < 2e4) rules[k] = t;
|
|
28446
|
+
}
|
|
28447
|
+
const extra = Array.isArray(o.extra) ? o.extra.filter((t) => typeof t === "string" && t.trim().length > 0 && t.length < 4e3).slice(0, 20) : [];
|
|
28448
|
+
return { rules, extra };
|
|
28449
|
+
}
|
|
28450
|
+
async function serverRules(apiUrl, fetcher = fetch, now = Date.now()) {
|
|
28451
|
+
const file2 = join15(configDir(), CACHE_FILE);
|
|
28452
|
+
let cached2 = null;
|
|
28453
|
+
try {
|
|
28454
|
+
cached2 = readJson(file2);
|
|
28455
|
+
} catch {
|
|
28456
|
+
}
|
|
28457
|
+
if (cached2 && cached2.version === CLI_VERSION && now - cached2.at < DAY_MS) return cleanRules(cached2.data);
|
|
28458
|
+
try {
|
|
28459
|
+
const r = await fetcher(`${apiUrl}/api/cli/rules?cli=${encodeURIComponent(CLI_VERSION)}`, { signal: AbortSignal.timeout(WAIT_MS2) });
|
|
28460
|
+
if (!r.ok) throw new Error(String(r.status));
|
|
28461
|
+
const data = cleanRules(await r.json());
|
|
28462
|
+
try {
|
|
28463
|
+
mkdirSync8(configDir(), { recursive: true });
|
|
28464
|
+
writeFileSync11(file2, JSON.stringify({ at: now, version: CLI_VERSION, data }));
|
|
28465
|
+
} catch {
|
|
28466
|
+
}
|
|
28467
|
+
return data;
|
|
28468
|
+
} catch {
|
|
28469
|
+
return cached2 ? cleanRules(cached2.data) : EMPTY;
|
|
28470
|
+
}
|
|
28471
|
+
}
|
|
28472
|
+
var rule = (r, key, bundled) => r.rules[key] ?? bundled;
|
|
28297
28473
|
|
|
28298
28474
|
// src/commands/starter.ts
|
|
28299
|
-
import { writeFileSync as
|
|
28300
|
-
import { join as
|
|
28475
|
+
import { writeFileSync as writeFileSync12 } from "fs";
|
|
28476
|
+
import { join as join16 } from "path";
|
|
28301
28477
|
var esc2 = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
28302
28478
|
var TEXT = {
|
|
28303
28479
|
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." },
|
|
@@ -28345,8 +28521,8 @@ DeployAI wrote this page so the folder starts as a working site. Build the owner
|
|
|
28345
28521
|
- Delete this README or replace it with notes about the site.
|
|
28346
28522
|
`;
|
|
28347
28523
|
function writeStarter(root, name, lang, stack) {
|
|
28348
|
-
|
|
28349
|
-
|
|
28524
|
+
writeFileSync12(join16(root, "index.html"), page2(name ?? "", lang, stack));
|
|
28525
|
+
writeFileSync12(join16(root, "README.md"), README);
|
|
28350
28526
|
}
|
|
28351
28527
|
|
|
28352
28528
|
// src/commands/start.ts
|
|
@@ -28395,6 +28571,8 @@ async function startCommand(cwd, ctx, id, opts = {}) {
|
|
|
28395
28571
|
const { kind, choices, agent } = start2;
|
|
28396
28572
|
const sample = choices.sampleKey ? SAMPLES.find((s) => s.key === choices.sampleKey) : void 0;
|
|
28397
28573
|
if (choices.sampleKey && !sample) throw new CliError(messages()("unknownSample", { key: choices.sampleKey }), 1, "not_found");
|
|
28574
|
+
out(START_WAIT_LINE);
|
|
28575
|
+
out();
|
|
28398
28576
|
const fresh = kind === "new" || kind === "migrate" || kind === "guest" && sample;
|
|
28399
28577
|
const here = resolve3(cwd);
|
|
28400
28578
|
const sameSite = Boolean(choices.projectId && readProject(here)?.projectId === choices.projectId);
|
|
@@ -28416,7 +28594,7 @@ async function startCommand(cwd, ctx, id, opts = {}) {
|
|
|
28416
28594
|
if (sample && !sameSite) {
|
|
28417
28595
|
const written = await downloadSample(ctxNow, sample.key, root);
|
|
28418
28596
|
done.push(t("startDownloaded", { key: sample.key, n: written }));
|
|
28419
|
-
if (existsSync14(
|
|
28597
|
+
if (existsSync14(join17(root, "package.json"))) {
|
|
28420
28598
|
if (opts.install !== false && install(root)) done.push(t("startInstalled"));
|
|
28421
28599
|
else steps.unshift({ cmd: "npm install", say: "Installs the sample's packages." });
|
|
28422
28600
|
}
|
|
@@ -28441,7 +28619,7 @@ async function startCommand(cwd, ctx, id, opts = {}) {
|
|
|
28441
28619
|
const stackText = choices.stack ? stackBlock(choices.stack) : "";
|
|
28442
28620
|
if (choices.brief || stackText) {
|
|
28443
28621
|
ensureDeployaiDir(root);
|
|
28444
|
-
|
|
28622
|
+
writeFileSync13(join17(root, BRIEF_FILE), [choices.brief ? `# The owner's details
|
|
28445
28623
|
|
|
28446
28624
|
${choices.brief}
|
|
28447
28625
|
` : "", stackText].filter(Boolean).join("\n"));
|
|
@@ -28465,38 +28643,49 @@ ${choices.brief}
|
|
|
28465
28643
|
if (root !== here) out(t(update ? "startUpdateFolder" : "startNewFolder", { dir: relative3(here, root) }));
|
|
28466
28644
|
for (const line of done) out(`- ${line}`);
|
|
28467
28645
|
out();
|
|
28468
|
-
|
|
28469
|
-
|
|
28646
|
+
const lines = [];
|
|
28647
|
+
const say = (line = "") => {
|
|
28648
|
+
lines.push(line);
|
|
28649
|
+
out(line);
|
|
28650
|
+
};
|
|
28651
|
+
say("----- Instructions for the agent -----");
|
|
28652
|
+
say();
|
|
28470
28653
|
if (root !== here) {
|
|
28471
|
-
|
|
28472
|
-
|
|
28654
|
+
say(`Work only inside the folder ${relative3(here, root)} from now on (cd ${JSON.stringify(relative3(here, root))}).`);
|
|
28655
|
+
say();
|
|
28473
28656
|
}
|
|
28474
|
-
|
|
28657
|
+
say(agent.trim());
|
|
28475
28658
|
if (stackText) {
|
|
28476
|
-
|
|
28477
|
-
|
|
28659
|
+
say();
|
|
28660
|
+
say(stackText.trim());
|
|
28478
28661
|
}
|
|
28479
28662
|
if (kind === "migrate") {
|
|
28480
|
-
|
|
28481
|
-
|
|
28482
|
-
}
|
|
28483
|
-
|
|
28484
|
-
|
|
28485
|
-
steps.forEach((s, i) =>
|
|
28486
|
-
|
|
28487
|
-
|
|
28663
|
+
say();
|
|
28664
|
+
say(uiSourcesText());
|
|
28665
|
+
}
|
|
28666
|
+
say();
|
|
28667
|
+
say("Then, in this order:");
|
|
28668
|
+
steps.forEach((s, i) => say(`${i + 1}. ${s.cmd ? `Run ${s.cmd}. ` : ""}${s.say}`));
|
|
28669
|
+
say();
|
|
28670
|
+
const server = await serverRules(ctx.apiUrl);
|
|
28671
|
+
const lang = langOf(choices.ownerLanguage);
|
|
28672
|
+
say(rule(server, `runCommands.${lang}`, runCommandsRule(lang)));
|
|
28673
|
+
say(rule(server, "modelFlag", MODEL_FLAG_RULE));
|
|
28488
28674
|
const askLine2 = toolAskLine(deployToolFromEnv(process.env));
|
|
28489
|
-
if (askLine2)
|
|
28490
|
-
|
|
28491
|
-
|
|
28492
|
-
|
|
28675
|
+
if (askLine2) say(askLine2);
|
|
28676
|
+
say(rule(server, "askOwner", ASK_OWNER_RULE));
|
|
28677
|
+
say(rule(server, "ownerText", OWNER_TEXT_RULE));
|
|
28678
|
+
for (const line of server.extra) say(line);
|
|
28679
|
+
say(rule(server, "startFail", START_FAIL_LINE));
|
|
28680
|
+
ensureDeployaiDir(root);
|
|
28681
|
+
writeFileSync13(join17(root, START_FILE), `${lines.join("\n")}
|
|
28682
|
+
`);
|
|
28493
28683
|
}
|
|
28494
28684
|
|
|
28495
28685
|
// src/commands/addon.ts
|
|
28496
|
-
import {
|
|
28497
|
-
import {
|
|
28498
|
-
import {
|
|
28499
|
-
import { existsSync as existsSync15, writeFileSync as writeFileSync12 } from "fs";
|
|
28686
|
+
import { dirname as dirname5, join as join18, resolve as resolve4 } from "path";
|
|
28687
|
+
import { mkdirSync as mkdirSync9 } from "fs";
|
|
28688
|
+
import { existsSync as existsSync15, writeFileSync as writeFileSync14 } from "fs";
|
|
28500
28689
|
function linkedProjectId2(root) {
|
|
28501
28690
|
const id = readProject(root)?.projectId;
|
|
28502
28691
|
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");
|
|
@@ -28553,13 +28742,14 @@ async function addonsRunCommand(root, ctx, opts = {}) {
|
|
|
28553
28742
|
const all = opts.all === true || !opts.oneByOne && readProject(root)?.addonsAll === true;
|
|
28554
28743
|
if (!order && r.picked && !r.agreed && todo.length > 1 && (opts.all || !all)) {
|
|
28555
28744
|
const stamps = readStamps(root);
|
|
28556
|
-
const items = todo.map((a) => ({ ...a, trace: addonTrace(a.key, (path) => existsSync15(
|
|
28745
|
+
const items = todo.map((a) => ({ ...a, trace: addonTrace(a.key, (path) => existsSync15(join18(root, path)), stamps) }));
|
|
28557
28746
|
addonOrderBrief(items, opts.all ? "all" : opts.oneByOne ? "one-by-one" : null).forEach((line) => out(line));
|
|
28558
28747
|
return;
|
|
28559
28748
|
}
|
|
28560
28749
|
if (!all && !opts.oneByOne && todo.length > 1) {
|
|
28561
28750
|
out(`This site has ${todo.length} add-ons waiting: ${todo.map((a) => a.key).join(", ")}.`);
|
|
28562
|
-
out(
|
|
28751
|
+
out("If .deployai/owner-mode says on-my-own, do not ask: run npx deployai@latest addons run --all (D-865).");
|
|
28752
|
+
out('Else ask the owner: "Run the add-ons one by one, or all at once?"');
|
|
28563
28753
|
out("- One by one (recommended): after each add-on, choose whether to publish.");
|
|
28564
28754
|
out(" Run: npx deployai@latest addons run --one-by-one");
|
|
28565
28755
|
out("- All at once: they all finish first, then one publish at the end.");
|
|
@@ -28595,24 +28785,24 @@ async function addonBuyCommand(root, ctx, key) {
|
|
|
28595
28785
|
return;
|
|
28596
28786
|
}
|
|
28597
28787
|
if (!a.buyUrl) throw new CliError(`${a.name} is not for sale right now.`, 1, "not_for_sale");
|
|
28598
|
-
out(`Send this link to the site owner
|
|
28788
|
+
out(`Send this link to the site owner: they pay once for this site. After they pay, run: npx deployai@latest addon run ${a.key}`);
|
|
28599
28789
|
out(a.buyUrl);
|
|
28600
28790
|
}
|
|
28601
28791
|
function readStamps(root) {
|
|
28602
28792
|
try {
|
|
28603
|
-
return
|
|
28793
|
+
return readJson(join18(root, ADDON_STAMP_FILE));
|
|
28604
28794
|
} catch {
|
|
28605
28795
|
return {};
|
|
28606
28796
|
}
|
|
28607
28797
|
}
|
|
28608
28798
|
function writeStamps(root, stamps) {
|
|
28609
|
-
const file2 =
|
|
28610
|
-
|
|
28611
|
-
|
|
28799
|
+
const file2 = join18(root, ADDON_STAMP_FILE);
|
|
28800
|
+
mkdirSync9(dirname5(file2), { recursive: true });
|
|
28801
|
+
writeFileSync14(file2, JSON.stringify(stamps, null, 2));
|
|
28612
28802
|
}
|
|
28613
28803
|
function printAddon(root, a) {
|
|
28614
28804
|
const stamps = readStamps(root);
|
|
28615
|
-
const trace = addonTrace(a.key, (path) => existsSync15(
|
|
28805
|
+
const trace = addonTrace(a.key, (path) => existsSync15(join18(root, path)), stamps);
|
|
28616
28806
|
writeStamps(root, { ...stamps, [a.key]: { ...stamps[a.key], runId: a.runId } });
|
|
28617
28807
|
out(`DeployAI add-on ${a.position} of ${a.total}: ${a.name} (${a.key}, run ${a.runId}).`);
|
|
28618
28808
|
const line = addonTraceLine(a.key, a.runId, trace);
|
|
@@ -28644,7 +28834,7 @@ async function addonDoneCommand(root, ctx, runId, opts) {
|
|
|
28644
28834
|
let report2;
|
|
28645
28835
|
if (opts.report) {
|
|
28646
28836
|
try {
|
|
28647
|
-
report2 =
|
|
28837
|
+
report2 = readJson(resolve4(root, opts.report));
|
|
28648
28838
|
} catch {
|
|
28649
28839
|
throw new CliError(`Cannot read the report file ${opts.report} as JSON.`, 1, "usage");
|
|
28650
28840
|
}
|
|
@@ -28671,9 +28861,9 @@ async function addonDoneCommand(root, ctx, runId, opts) {
|
|
|
28671
28861
|
|
|
28672
28862
|
// src/commands/speed.ts
|
|
28673
28863
|
import { spawn as spawn3 } from "child_process";
|
|
28674
|
-
import { mkdtempSync, readFileSync as
|
|
28864
|
+
import { mkdtempSync, readFileSync as readFileSync12, rmSync as rmSync3 } from "fs";
|
|
28675
28865
|
import { tmpdir } from "os";
|
|
28676
|
-
import { join as
|
|
28866
|
+
import { join as join19 } from "path";
|
|
28677
28867
|
var ms = (v) => v >= 1e3 ? `${(v / 1e3).toFixed(1)} s` : `${Math.round(v)} ms`;
|
|
28678
28868
|
var LOCAL_WAIT_MS = 18e4;
|
|
28679
28869
|
function runLighthouse(url2, strategy, browser, file2) {
|
|
@@ -28697,11 +28887,11 @@ function runLighthouse(url2, strategy, browser, file2) {
|
|
|
28697
28887
|
}
|
|
28698
28888
|
async function localSpeed(url2, strategy, run = runLighthouse, browser = findBrowser()) {
|
|
28699
28889
|
if (!browser) return null;
|
|
28700
|
-
const dir = mkdtempSync(
|
|
28890
|
+
const dir = mkdtempSync(join19(tmpdir(), "deployai-speed-"));
|
|
28701
28891
|
try {
|
|
28702
|
-
const file2 =
|
|
28892
|
+
const file2 = join19(dir, "report.json");
|
|
28703
28893
|
await run(url2, strategy, browser, file2);
|
|
28704
|
-
const lighthouseResult = JSON.parse(
|
|
28894
|
+
const lighthouseResult = JSON.parse(readFileSync12(file2, "utf8"));
|
|
28705
28895
|
return lighthouseResult.categories ? mapPsi({ lighthouseResult }, strategy) : null;
|
|
28706
28896
|
} catch {
|
|
28707
28897
|
return null;
|
|
@@ -28754,29 +28944,159 @@ async function speedCommand(ctx, url2, opts, deps = {}) {
|
|
|
28754
28944
|
}
|
|
28755
28945
|
if (run?.error === "psi_unreachable") throw new CliError("Google could not load this page. Check that the address opens and is public, then try again.", 1, "speed_failed");
|
|
28756
28946
|
out("Google's test is not available right now, so Lighthouse is running on this computer. This takes about a minute...");
|
|
28757
|
-
const
|
|
28758
|
-
if (!
|
|
28947
|
+
const browser = deps.browser === void 0 ? findBrowser() : deps.browser;
|
|
28948
|
+
if (!browser) throw new CliError("The speed test could not run: Google's test is not available, and no Chrome or Edge was found on this computer (looked in Program Files and the user's apps). If one is installed elsewhere, set CHROME_PATH to its path and run speed again; else go on without speed numbers and tell the owner in one line.", 1, "speed_failed");
|
|
28949
|
+
const report2 = await localSpeed(page3, strategy, deps.run, browser);
|
|
28950
|
+
if (!report2) throw new CliError(`The speed test could not finish: Lighthouse started with ${browser} and gave no result. Its first run downloads Lighthouse, which can take a few minutes, and it needs Node 22.19 or newer. Run speed again once; if it fails again, go on without speed numbers and tell the owner in one line.`, 1, "speed_failed");
|
|
28759
28951
|
printReport(report2, strategy, true);
|
|
28760
28952
|
out();
|
|
28761
28953
|
out("Measured on this computer, so compare it only with numbers measured the same way.");
|
|
28762
28954
|
}
|
|
28763
28955
|
|
|
28956
|
+
// src/commands/shot.ts
|
|
28957
|
+
import { spawn as spawn4 } from "child_process";
|
|
28958
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync10 } from "fs";
|
|
28959
|
+
import { join as join20, resolve as resolve5 } from "path";
|
|
28960
|
+
var SHOT_SIZES = [{ name: "phone", size: "390,844" }, { name: "desktop", size: "1440,900" }];
|
|
28961
|
+
var PLAYWRIGHT = "playwright@1.56";
|
|
28962
|
+
var WAIT_MS3 = 18e4;
|
|
28963
|
+
var channelFor = (browser) => /msedge|edge/i.test(browser) ? "msedge" : "chrome";
|
|
28964
|
+
function shotName(address, width) {
|
|
28965
|
+
const u = new URL(address);
|
|
28966
|
+
const path = u.pathname.replace(/\/+$/, "").replace(/[^a-z0-9]+/gi, "-").replace(/^-|-$/g, "") || "home";
|
|
28967
|
+
return `${u.hostname}-${path}-${width}.png`;
|
|
28968
|
+
}
|
|
28969
|
+
function runNpx(args) {
|
|
28970
|
+
const win = process.platform === "win32";
|
|
28971
|
+
return new Promise((done) => {
|
|
28972
|
+
const child = win ? spawn4(["npx", ...args.map((a) => `"${a}"`)].join(" "), { stdio: "ignore", windowsHide: true, shell: true }) : spawn4("npx", args, { stdio: "ignore" });
|
|
28973
|
+
const timer = setTimeout(() => child.kill(), WAIT_MS3);
|
|
28974
|
+
child.once("error", () => {
|
|
28975
|
+
clearTimeout(timer);
|
|
28976
|
+
done(1);
|
|
28977
|
+
});
|
|
28978
|
+
child.once("exit", (code) => {
|
|
28979
|
+
clearTimeout(timer);
|
|
28980
|
+
done(code ?? 1);
|
|
28981
|
+
});
|
|
28982
|
+
});
|
|
28983
|
+
}
|
|
28984
|
+
async function shotCommand(root, address, opts = {}, run = runNpx) {
|
|
28985
|
+
let url2;
|
|
28986
|
+
try {
|
|
28987
|
+
url2 = new URL(address);
|
|
28988
|
+
if (!/^https?:$/.test(url2.protocol) || address.includes('"')) throw new Error("bad");
|
|
28989
|
+
} catch {
|
|
28990
|
+
throw new CliError("Give a full page address, like https://my-site.co.il/about.", 1, "bad_address");
|
|
28991
|
+
}
|
|
28992
|
+
const browser = opts.webkit ? null : findBrowser();
|
|
28993
|
+
if (!opts.webkit && !browser) throw new CliError("No Chrome or Edge was found on this computer. Install Chrome, set CHROME_PATH to its path, or run shot again with --webkit (it downloads Safari's engine first).", 1, "no_browser");
|
|
28994
|
+
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");
|
|
28995
|
+
const dir = resolve5(root, opts.out ?? join20(".deployai", "shots"));
|
|
28996
|
+
mkdirSync10(dir, { recursive: true });
|
|
28997
|
+
const saved = [];
|
|
28998
|
+
for (const s of SHOT_SIZES) {
|
|
28999
|
+
const file2 = join20(dir, shotName(url2.toString(), s.name));
|
|
29000
|
+
const engine = opts.webkit ? ["--browser=webkit"] : [`--channel=${channelFor(browser)}`];
|
|
29001
|
+
const code = await run(["--yes", PLAYWRIGHT, "screenshot", ...engine, `--viewport-size=${s.size}`, "--full-page", "--wait-for-timeout=1500", url2.toString(), file2]);
|
|
29002
|
+
if (code !== 0 || !existsSync16(file2)) throw new CliError(`The ${s.name} picture of ${url2} could not be taken. Check that the page opens, then run shot again.`, 1, "shot_failed");
|
|
29003
|
+
saved.push(file2);
|
|
29004
|
+
out(`${s.name.padEnd(8)} ${file2}`);
|
|
29005
|
+
}
|
|
29006
|
+
out("Open both and look at them as a visitor: the header, the menu, every image and button.");
|
|
29007
|
+
return saved;
|
|
29008
|
+
}
|
|
29009
|
+
|
|
29010
|
+
// src/commands/images.ts
|
|
29011
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
29012
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync11, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as writeFileSync15 } from "fs";
|
|
29013
|
+
import { createRequire } from "module";
|
|
29014
|
+
import { homedir as homedir3 } from "os";
|
|
29015
|
+
import { extname, join as join21, relative as relative4, resolve as resolve6 } from "path";
|
|
29016
|
+
var PHONE_WIDTH = 640;
|
|
29017
|
+
var SHARP = "sharp@0.34";
|
|
29018
|
+
var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", ".git", ".deployai", "dist", ".astro", ".next"]);
|
|
29019
|
+
function imagesIn(dir) {
|
|
29020
|
+
const found = [];
|
|
29021
|
+
const walk2 = (d) => {
|
|
29022
|
+
for (const name of readdirSync6(d)) {
|
|
29023
|
+
const p = join21(d, name);
|
|
29024
|
+
const st = statSync3(p);
|
|
29025
|
+
if (st.isDirectory()) {
|
|
29026
|
+
if (!SKIP_DIRS2.has(name)) walk2(p);
|
|
29027
|
+
} else if (/\.(jpe?g|png)$/i.test(name)) found.push(p);
|
|
29028
|
+
}
|
|
29029
|
+
};
|
|
29030
|
+
if (existsSync17(dir)) walk2(dir);
|
|
29031
|
+
return found.sort();
|
|
29032
|
+
}
|
|
29033
|
+
function outputsFor(file2, width) {
|
|
29034
|
+
const base = file2.slice(0, -extname(file2).length);
|
|
29035
|
+
const list = [{ file: `${base}.webp`, format: "webp" }, { file: `${base}.avif`, format: "avif" }];
|
|
29036
|
+
if (width && width > PHONE_WIDTH * 1.4) list.push({ file: `${base}-${PHONE_WIDTH}.webp`, width: PHONE_WIDTH, format: "webp" }, { file: `${base}-${PHONE_WIDTH}.avif`, width: PHONE_WIDTH, format: "avif" });
|
|
29037
|
+
return list;
|
|
29038
|
+
}
|
|
29039
|
+
function loadSharp() {
|
|
29040
|
+
const dir = join21(homedir3(), ".deployai", "tools", "sharp");
|
|
29041
|
+
if (!existsSync17(join21(dir, "node_modules", "sharp"))) {
|
|
29042
|
+
mkdirSync11(dir, { recursive: true });
|
|
29043
|
+
if (!existsSync17(join21(dir, "package.json"))) writeFileSync15(join21(dir, "package.json"), '{"private":true}');
|
|
29044
|
+
out("Getting the image tool once (it stays outside the site)...");
|
|
29045
|
+
const r = spawnSync4(process.platform === "win32" ? "npm.cmd" : "npm", ["install", SHARP, "--no-audit", "--no-fund", "--silent"], { cwd: dir, stdio: "ignore", shell: process.platform === "win32" });
|
|
29046
|
+
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");
|
|
29047
|
+
}
|
|
29048
|
+
return createRequire(join21(dir, "package.json"))("sharp");
|
|
29049
|
+
}
|
|
29050
|
+
async function imagesCommand(root, folder, sharp = loadSharp) {
|
|
29051
|
+
const dir = resolve6(root, folder ?? "public");
|
|
29052
|
+
const files = imagesIn(dir);
|
|
29053
|
+
if (!files.length) {
|
|
29054
|
+
out(`No JPG or PNG images under ${relative4(root, dir) || "."}.`);
|
|
29055
|
+
return { done: 0, skipped: 0, saved: 0 };
|
|
29056
|
+
}
|
|
29057
|
+
const make = sharp();
|
|
29058
|
+
let done = 0;
|
|
29059
|
+
let skipped = 0;
|
|
29060
|
+
let saved = 0;
|
|
29061
|
+
for (const file2 of files) {
|
|
29062
|
+
const size = statSync3(file2).size;
|
|
29063
|
+
const meta3 = await make(file2).metadata();
|
|
29064
|
+
const outputs = outputsFor(file2, meta3.width);
|
|
29065
|
+
if (outputs.every((o) => existsSync17(o.file) && statSync3(o.file).mtimeMs >= statSync3(file2).mtimeMs)) {
|
|
29066
|
+
skipped++;
|
|
29067
|
+
continue;
|
|
29068
|
+
}
|
|
29069
|
+
for (const o of outputs) {
|
|
29070
|
+
let img = make(file2);
|
|
29071
|
+
if (o.width) img = img.resize({ width: o.width });
|
|
29072
|
+
const r = await (o.format === "webp" ? img.webp({ quality: 80 }) : img.avif({ quality: 55 })).toFile(o.file);
|
|
29073
|
+
if (!o.width && o.format === "webp") saved += Math.max(0, size - r.size);
|
|
29074
|
+
}
|
|
29075
|
+
done++;
|
|
29076
|
+
}
|
|
29077
|
+
out(`Converted ${done} image${done === 1 ? "" : "s"}${skipped ? `, ${skipped} already done` : ""}. WebP alone saves about ${Math.round(saved / 1024)} KB.`);
|
|
29078
|
+
out("Serve them with <picture>, the original last so its address keeps working:");
|
|
29079
|
+
out(' <picture><source type="image/avif" srcset="/hero-640.avif 640w, /hero.avif 1600w" sizes="100vw"><source type="image/webp" srcset="/hero-640.webp 640w, /hero.webp 1600w" sizes="100vw"><img src="/hero.jpg" width="1600" height="900" alt="..."></picture>');
|
|
29080
|
+
return { done, skipped, saved };
|
|
29081
|
+
}
|
|
29082
|
+
|
|
28764
29083
|
// src/commands/blocks.ts
|
|
28765
|
-
import { createHash } from "crypto";
|
|
28766
|
-
import { existsSync as
|
|
28767
|
-
import { dirname as
|
|
29084
|
+
import { createHash as createHash2 } from "crypto";
|
|
29085
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync12, readFileSync as readFileSync13, writeFileSync as writeFileSync16 } from "fs";
|
|
29086
|
+
import { dirname as dirname6, resolve as resolve7, sep as sep3 } from "path";
|
|
28768
29087
|
import { gunzipSync as gunzipSync2 } from "zlib";
|
|
28769
29088
|
var BLOCKS = [
|
|
28770
29089
|
{ key: "dashboard", title: "The site's own dashboard: messages, pages, blog, shop, images, accessibility, documents. Add --update to get a newer version" },
|
|
28771
29090
|
{ key: "inbox", title: "Contact form with the site's own messages page for the owner, and an email on each message (D1)" },
|
|
28772
|
-
{ key: "blog", title: "Blog: posts as Markdown files, categories, tags, authors, pages, RSS and article data for search" }
|
|
29091
|
+
{ key: "blog", title: "Blog: posts as Markdown files, categories, tags, authors, pages, RSS and article data for search" },
|
|
29092
|
+
{ key: "late-tags", title: "Tracking tags (Tag Manager, Google, Meta, Clarity) that load a moment after the page shows, at once on conversion pages and ad clicks" }
|
|
28773
29093
|
];
|
|
28774
29094
|
var MAX_BYTES3 = 5 * 1024 * 1024;
|
|
28775
|
-
var sha = (data) =>
|
|
28776
|
-
var lockPath = (base, key) =>
|
|
29095
|
+
var sha = (data) => createHash2("sha256").update(data).digest("hex");
|
|
29096
|
+
var lockPath = (base, key) => resolve7(base, ".deployai", "blocks", `${key}.lock.json`);
|
|
28777
29097
|
function readLock(base, key) {
|
|
28778
29098
|
try {
|
|
28779
|
-
return
|
|
29099
|
+
return readJson(lockPath(base, key));
|
|
28780
29100
|
} catch {
|
|
28781
29101
|
return {};
|
|
28782
29102
|
}
|
|
@@ -28807,21 +29127,21 @@ async function blocksCommand(root, ctx, name, opts = {}) {
|
|
|
28807
29127
|
} catch {
|
|
28808
29128
|
throw new CliError("The block download is damaged. Try again.", 1, "api");
|
|
28809
29129
|
}
|
|
28810
|
-
const base =
|
|
29130
|
+
const base = resolve7(root);
|
|
28811
29131
|
const written = [];
|
|
28812
29132
|
const kept = [];
|
|
28813
29133
|
const updated = [];
|
|
28814
29134
|
const lock = readLock(base, block.key);
|
|
28815
29135
|
for (const e3 of entries) {
|
|
28816
29136
|
if (e3.type !== "0" && e3.type !== "\0") continue;
|
|
28817
|
-
const target =
|
|
29137
|
+
const target = resolve7(base, e3.name);
|
|
28818
29138
|
if (target === base || !target.startsWith(base + sep3)) continue;
|
|
28819
|
-
if (
|
|
28820
|
-
const now = sha(
|
|
29139
|
+
if (existsSync18(target)) {
|
|
29140
|
+
const now = sha(readFileSync13(target));
|
|
28821
29141
|
if (now === sha(e3.data)) {
|
|
28822
29142
|
lock[e3.name] = now;
|
|
28823
29143
|
} else if (opts.update && lock[e3.name] === now) {
|
|
28824
|
-
|
|
29144
|
+
writeFileSync16(target, e3.data);
|
|
28825
29145
|
lock[e3.name] = sha(e3.data);
|
|
28826
29146
|
updated.push(e3.name);
|
|
28827
29147
|
} else {
|
|
@@ -28829,13 +29149,13 @@ async function blocksCommand(root, ctx, name, opts = {}) {
|
|
|
28829
29149
|
}
|
|
28830
29150
|
continue;
|
|
28831
29151
|
}
|
|
28832
|
-
|
|
28833
|
-
|
|
29152
|
+
mkdirSync12(dirname6(target), { recursive: true });
|
|
29153
|
+
writeFileSync16(target, e3.data);
|
|
28834
29154
|
lock[e3.name] = sha(e3.data);
|
|
28835
29155
|
written.push(e3.name);
|
|
28836
29156
|
}
|
|
28837
|
-
|
|
28838
|
-
|
|
29157
|
+
mkdirSync12(dirname6(lockPath(base, block.key)), { recursive: true });
|
|
29158
|
+
writeFileSync16(lockPath(base, block.key), `${JSON.stringify(lock, null, 2)}
|
|
28839
29159
|
`);
|
|
28840
29160
|
out(`Added the ${block.key} block: ${written.length} files.`);
|
|
28841
29161
|
written.forEach((f) => out(` + ${f}`));
|
|
@@ -28895,11 +29215,11 @@ async function integrationsCommand(ctx, name, opts = {}) {
|
|
|
28895
29215
|
}
|
|
28896
29216
|
|
|
28897
29217
|
// src/commands/brand.ts
|
|
28898
|
-
import { spawn as
|
|
28899
|
-
import { copyFileSync, existsSync as
|
|
29218
|
+
import { spawn as spawn5 } from "child_process";
|
|
29219
|
+
import { copyFileSync, existsSync as existsSync19, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync2, readdirSync as readdirSync7, readFileSync as readFileSync14, rmSync as rmSync4, statSync as statSync4, writeFileSync as writeFileSync17 } from "fs";
|
|
28900
29220
|
import { createServer } from "http";
|
|
28901
29221
|
import { tmpdir as tmpdir2 } from "os";
|
|
28902
|
-
import { basename as basename2, dirname as
|
|
29222
|
+
import { basename as basename2, dirname as dirname7, extname as extname2, join as join22, relative as relative5, sep as sep4 } from "path";
|
|
28903
29223
|
import { randomBytes } from "crypto";
|
|
28904
29224
|
|
|
28905
29225
|
// src/commands/brand-page.ts
|
|
@@ -28988,61 +29308,61 @@ var BRAND_DIR = ".deployai/brand";
|
|
|
28988
29308
|
var IMAGE_EXT = /\.(png|jpe?g|gif|webp|avif)$/i;
|
|
28989
29309
|
var MAX_UPLOAD = 25 * 1024 * 1024;
|
|
28990
29310
|
var WALK_CAP = 4e3;
|
|
28991
|
-
var
|
|
29311
|
+
var SKIP_DIRS3 = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", "dist", "build", "out", ".astro", ".output", ".svelte-kit", ".wrangler", ".deployai"]);
|
|
28992
29312
|
var TYPES = { ".svg": "image/svg+xml", ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp", ".gif": "image/gif", ".ico": "image/x-icon", ".avif": "image/avif" };
|
|
28993
29313
|
function webRoot(root) {
|
|
28994
|
-
for (const d of ["public", "static"]) if (
|
|
29314
|
+
for (const d of ["public", "static"]) if (existsSync19(join22(root, d))) return join22(root, d);
|
|
28995
29315
|
return root;
|
|
28996
29316
|
}
|
|
28997
29317
|
function walk(dir, found = []) {
|
|
28998
29318
|
let names;
|
|
28999
29319
|
try {
|
|
29000
|
-
names =
|
|
29320
|
+
names = readdirSync7(dir);
|
|
29001
29321
|
} catch {
|
|
29002
29322
|
return found;
|
|
29003
29323
|
}
|
|
29004
29324
|
for (const n2 of names) {
|
|
29005
29325
|
if (found.length >= WALK_CAP) break;
|
|
29006
|
-
const p =
|
|
29326
|
+
const p = join22(dir, n2);
|
|
29007
29327
|
let isDir = false;
|
|
29008
29328
|
try {
|
|
29009
|
-
isDir =
|
|
29329
|
+
isDir = statSync4(p).isDirectory();
|
|
29010
29330
|
} catch {
|
|
29011
29331
|
continue;
|
|
29012
29332
|
}
|
|
29013
29333
|
if (isDir) {
|
|
29014
|
-
if (!
|
|
29334
|
+
if (!SKIP_DIRS3.has(n2)) walk(p, found);
|
|
29015
29335
|
} else found.push(p);
|
|
29016
29336
|
}
|
|
29017
29337
|
return found;
|
|
29018
29338
|
}
|
|
29019
29339
|
function existingFavicon(root) {
|
|
29020
29340
|
const web = webRoot(root);
|
|
29021
|
-
for (const f of ["favicon.ico", "favicon.svg", "favicon.png", "icon.svg", "icon.png"]) if (
|
|
29022
|
-
for (const d of ["app", "src/app"]) for (const f of ["favicon.ico", "icon.svg", "icon.png", "icon.tsx", "icon.jpg"]) if (
|
|
29341
|
+
for (const f of ["favicon.ico", "favicon.svg", "favicon.png", "icon.svg", "icon.png"]) if (existsSync19(join22(web, f))) return relative5(root, join22(web, f)).split(sep4).join("/");
|
|
29342
|
+
for (const d of ["app", "src/app"]) for (const f of ["favicon.ico", "icon.svg", "icon.png", "icon.tsx", "icon.jpg"]) if (existsSync19(join22(root, d, f))) return `${d}/${f}`;
|
|
29023
29343
|
for (const f of walk(root).filter((p) => /\.(html|astro|tsx|jsx|vue|svelte)$/.test(p)).slice(0, 400)) {
|
|
29024
29344
|
try {
|
|
29025
|
-
const m =
|
|
29345
|
+
const m = readFileSync14(f, "utf8").match(/<link\b[^>]*\brel=["'](?:shortcut )?icon["'][^>]*>/i);
|
|
29026
29346
|
if (!m) continue;
|
|
29027
29347
|
const href = m[0].match(/\shref=["']([^"']+)/i)?.[1] ?? "";
|
|
29028
|
-
if (href.startsWith("data:") || /^https?:/.test(href) ||
|
|
29348
|
+
if (href.startsWith("data:") || /^https?:/.test(href) || existsSync19(join22(web, href.split("?")[0]))) return relative5(root, f).split(sep4).join("/");
|
|
29029
29349
|
} catch {
|
|
29030
29350
|
}
|
|
29031
29351
|
}
|
|
29032
29352
|
return null;
|
|
29033
29353
|
}
|
|
29034
29354
|
function scannedIcons(root) {
|
|
29035
|
-
const base =
|
|
29036
|
-
if (!
|
|
29355
|
+
const base = join22(root, MIGRATION_DIR);
|
|
29356
|
+
if (!existsSync19(base)) return [];
|
|
29037
29357
|
const found = [];
|
|
29038
|
-
for (const host of
|
|
29039
|
-
const dir =
|
|
29358
|
+
for (const host of readdirSync7(base)) {
|
|
29359
|
+
const dir = join22(base, host, "icons");
|
|
29040
29360
|
try {
|
|
29041
|
-
const list =
|
|
29361
|
+
const list = readJson(join22(dir, "icons.json"));
|
|
29042
29362
|
for (const i of list) {
|
|
29043
|
-
const path =
|
|
29044
|
-
if (!
|
|
29045
|
-
const size = imageSize(
|
|
29363
|
+
const path = join22(dir, i.file);
|
|
29364
|
+
if (!existsSync19(path)) continue;
|
|
29365
|
+
const size = imageSize(readFileSync14(path));
|
|
29046
29366
|
found.push({ path, kind: i.kind, big: !size || size.width >= 64 });
|
|
29047
29367
|
}
|
|
29048
29368
|
} catch {
|
|
@@ -29054,8 +29374,8 @@ function findSource(root) {
|
|
|
29054
29374
|
const icons = scannedIcons(root);
|
|
29055
29375
|
const sharp = icons.find((i) => i.kind === "icon" && i.big);
|
|
29056
29376
|
if (sharp) return { path: sharp.path, from: "old-icon" };
|
|
29057
|
-
const dirs = ["public", "static", "src/assets", "assets", "images", "img"].map((d) =>
|
|
29058
|
-
const logos = dirs.flatMap((d) => walk(d)).filter((p) => looksLikeLogo(
|
|
29377
|
+
const dirs = ["public", "static", "src/assets", "assets", "images", "img"].map((d) => join22(root, d));
|
|
29378
|
+
const logos = dirs.flatMap((d) => walk(d)).filter((p) => looksLikeLogo(relative5(root, p).split(sep4).join("/")));
|
|
29059
29379
|
const logo = logos.find((p) => /\.svg$/i.test(p)) ?? logos[0];
|
|
29060
29380
|
if (logo) return { path: logo, from: "logo" };
|
|
29061
29381
|
const oldLogo = icons.find((i) => i.kind === "logo");
|
|
@@ -29066,25 +29386,25 @@ function findSource(root) {
|
|
|
29066
29386
|
}
|
|
29067
29387
|
var CODE_EXT2 = /\.(css|scss|sass|less|html|astro|vue|svelte)$/i;
|
|
29068
29388
|
var READ_CAP = 300;
|
|
29069
|
-
function
|
|
29389
|
+
function readText2(path) {
|
|
29070
29390
|
try {
|
|
29071
|
-
return
|
|
29391
|
+
return readFileSync14(path, "utf8");
|
|
29072
29392
|
} catch {
|
|
29073
29393
|
return "";
|
|
29074
29394
|
}
|
|
29075
29395
|
}
|
|
29076
29396
|
function scanDirs(root) {
|
|
29077
|
-
const base =
|
|
29397
|
+
const base = join22(root, MIGRATION_DIR);
|
|
29078
29398
|
try {
|
|
29079
|
-
return
|
|
29399
|
+
return readdirSync7(base).map((h) => join22(base, h)).filter((d) => existsSync19(join22(d, "home.html")));
|
|
29080
29400
|
} catch {
|
|
29081
29401
|
return [];
|
|
29082
29402
|
}
|
|
29083
29403
|
}
|
|
29084
29404
|
function homePage(root) {
|
|
29085
|
-
for (const d of scanDirs(root)) return
|
|
29405
|
+
for (const d of scanDirs(root)) return readText2(join22(d, "home.html"));
|
|
29086
29406
|
for (const f of ["index.html", "public/index.html", "src/index.html", "src/pages/index.astro", "src/pages/index.html", "app/layout.tsx", "src/app/layout.tsx", "src/layouts/Layout.astro"]) {
|
|
29087
|
-
const text2 =
|
|
29407
|
+
const text2 = readText2(join22(root, f));
|
|
29088
29408
|
if (text2) return text2;
|
|
29089
29409
|
}
|
|
29090
29410
|
return "";
|
|
@@ -29095,30 +29415,30 @@ function siteFacts(root, given = {}) {
|
|
|
29095
29415
|
const id = readSiteIdentity(home);
|
|
29096
29416
|
let pkg;
|
|
29097
29417
|
try {
|
|
29098
|
-
pkg =
|
|
29418
|
+
pkg = readJson(join22(root, "package.json")).name;
|
|
29099
29419
|
} catch {
|
|
29100
29420
|
}
|
|
29101
29421
|
const name = given.name?.trim() || readProject(root)?.name || id.name || (pkg && !pkg.startsWith("@") ? pkg : "") || basename2(root);
|
|
29102
29422
|
if (given.color) return { name, line: given.line ?? id.line ?? "", color: given.color, colorFrom: "given" };
|
|
29103
|
-
const old = scanDirs(root).flatMap((d) => walkAll(
|
|
29423
|
+
const old = scanDirs(root).flatMap((d) => walkAll(join22(d, "styles")).map((f) => ({ text: readText2(f) })));
|
|
29104
29424
|
const fromOld = scanDirs(root).length ? pickBrandColor([{ text: home, themeColor: id.themeColor }, ...old]) : null;
|
|
29105
29425
|
const sources = [{ text: home, themeColor: id.themeColor }];
|
|
29106
|
-
for (const f of ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs", "tailwind.config.cjs"]) sources.push({ text:
|
|
29107
|
-
const code = ["src", "app", "styles", "css", "public", "static"].flatMap((d) => walk(
|
|
29108
|
-
const plain2 =
|
|
29109
|
-
for (const f of [...plain2, ...code].slice(0, READ_CAP)) sources.push({ text:
|
|
29426
|
+
for (const f of ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs", "tailwind.config.cjs"]) sources.push({ text: readText2(join22(root, f)) });
|
|
29427
|
+
const code = ["src", "app", "styles", "css", "public", "static"].flatMap((d) => walk(join22(root, d))).filter((p) => CODE_EXT2.test(p));
|
|
29428
|
+
const plain2 = readdirSync7(root).filter((f) => CODE_EXT2.test(f)).map((f) => join22(root, f));
|
|
29429
|
+
for (const f of [...plain2, ...code].slice(0, READ_CAP)) sources.push({ text: readText2(f) });
|
|
29110
29430
|
const color = fromOld ?? pickBrandColor(sources);
|
|
29111
29431
|
return { name, line: given.line ?? id.line ?? "", color: color ?? BRAND_DEFAULT_COLOR, colorFrom: color ? "site" : "default" };
|
|
29112
29432
|
}
|
|
29113
29433
|
function writeSiteFile(root, file2, data) {
|
|
29114
|
-
const target =
|
|
29115
|
-
if (
|
|
29116
|
-
const keep =
|
|
29117
|
-
|
|
29118
|
-
copyFileSync(target,
|
|
29434
|
+
const target = join22(webRoot(root), file2);
|
|
29435
|
+
if (existsSync19(target)) {
|
|
29436
|
+
const keep = join22(root, BRAND_DIR, "originals");
|
|
29437
|
+
mkdirSync13(keep, { recursive: true });
|
|
29438
|
+
copyFileSync(target, join22(keep, file2));
|
|
29119
29439
|
}
|
|
29120
|
-
|
|
29121
|
-
|
|
29440
|
+
mkdirSync13(dirname7(target), { recursive: true });
|
|
29441
|
+
writeFileSync17(target, data);
|
|
29122
29442
|
}
|
|
29123
29443
|
var send = (res, status, body = "", type = "text/plain; charset=utf-8") => {
|
|
29124
29444
|
res.writeHead(status, { "content-type": type, "cache-control": "no-store", "x-content-type-options": "nosniff" });
|
|
@@ -29153,8 +29473,8 @@ function allowed(req, url2, port, token) {
|
|
|
29153
29473
|
return req.headers.host === `127.0.0.1:${port}` && url2.searchParams.get("t") === token;
|
|
29154
29474
|
}
|
|
29155
29475
|
async function headless(browser, url2, width, until, timeoutMs) {
|
|
29156
|
-
const profile = mkdtempSync2(
|
|
29157
|
-
const child =
|
|
29476
|
+
const profile = mkdtempSync2(join22(tmpdir2(), "deployai-brand-"));
|
|
29477
|
+
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 });
|
|
29158
29478
|
child.on("error", () => {
|
|
29159
29479
|
});
|
|
29160
29480
|
let timer;
|
|
@@ -29167,7 +29487,7 @@ async function headless(browser, url2, width, until, timeoutMs) {
|
|
|
29167
29487
|
await new Promise((done) => {
|
|
29168
29488
|
if (child.exitCode !== null || child.pid === void 0) return done();
|
|
29169
29489
|
child.once("exit", () => done());
|
|
29170
|
-
if (process.platform === "win32")
|
|
29490
|
+
if (process.platform === "win32") spawn5("taskkill", ["/PID", String(child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true }).on("error", () => {
|
|
29171
29491
|
});
|
|
29172
29492
|
else child.kill();
|
|
29173
29493
|
setTimeout(done, 3e3);
|
|
@@ -29253,10 +29573,10 @@ async function drawInBrowser(o, browser) {
|
|
|
29253
29573
|
}
|
|
29254
29574
|
}
|
|
29255
29575
|
function sourceBytes(path) {
|
|
29256
|
-
return { bytes:
|
|
29576
|
+
return { bytes: readFileSync14(path), type: TYPES[extname2(path).toLowerCase()] ?? "application/octet-stream" };
|
|
29257
29577
|
}
|
|
29258
29578
|
function report(root, r) {
|
|
29259
|
-
const where =
|
|
29579
|
+
const where = relative5(root, webRoot(root)).split(sep4).join("/") || "the site root";
|
|
29260
29580
|
out(`Written in ${where}: ${r.written.join(", ")}`);
|
|
29261
29581
|
if (r.skipped.length) out(`Left out, the picture is too small to stay sharp: ${r.skipped.join(", ")}. A larger logo makes them.`);
|
|
29262
29582
|
const tags2 = brandHeadTags(r.written);
|
|
@@ -29268,10 +29588,10 @@ function report(root, r) {
|
|
|
29268
29588
|
}
|
|
29269
29589
|
function plainIcon(root, source, name, color) {
|
|
29270
29590
|
if (source.path) {
|
|
29271
|
-
const ext =
|
|
29591
|
+
const ext = extname2(source.path).toLowerCase();
|
|
29272
29592
|
if (ext === ".ico" || ext === ".svg" || ext === ".png") {
|
|
29273
29593
|
const file2 = `favicon${ext}`;
|
|
29274
|
-
writeSiteFile(root, file2,
|
|
29594
|
+
writeSiteFile(root, file2, readFileSync14(source.path));
|
|
29275
29595
|
return [file2];
|
|
29276
29596
|
}
|
|
29277
29597
|
}
|
|
@@ -29289,7 +29609,7 @@ function printStatus2(root, files) {
|
|
|
29289
29609
|
const web = webRoot(root);
|
|
29290
29610
|
const icon = existingFavicon(root);
|
|
29291
29611
|
out(icon ? `Icon: ${icon}` : "Icon: missing. Run: npx deployai@latest brand favicon");
|
|
29292
|
-
const missing = files.filter((f) => f !== "favicon.svg" && !
|
|
29612
|
+
const missing = files.filter((f) => f !== "favicon.svg" && !existsSync19(join22(web, f)));
|
|
29293
29613
|
if (files.length) out(missing.length ? `Missing from the full set: ${missing.join(", ")}` : "The full set is there.");
|
|
29294
29614
|
}
|
|
29295
29615
|
function printFacts(f, picture2) {
|
|
@@ -29303,12 +29623,12 @@ function picture(source, facts) {
|
|
|
29303
29623
|
}
|
|
29304
29624
|
function withLogoColor(facts, source) {
|
|
29305
29625
|
if (facts.colorFrom === "given" || !source.path || !/\.svg$/i.test(source.path)) return facts;
|
|
29306
|
-
const color = svgLogoColor(
|
|
29626
|
+
const color = svgLogoColor(readText2(source.path));
|
|
29307
29627
|
return color ? { ...facts, color, colorFrom: "site" } : facts;
|
|
29308
29628
|
}
|
|
29309
29629
|
function pickSource(root, from) {
|
|
29310
29630
|
const source = from ? { path: from, from: "file" } : findSource(root);
|
|
29311
|
-
if (source.path && !
|
|
29631
|
+
if (source.path && !existsSync19(source.path)) throw new CliError(`No such file: ${source.path}`, 1, "usage");
|
|
29312
29632
|
return source;
|
|
29313
29633
|
}
|
|
29314
29634
|
async function brandFaviconCommand(root, opts) {
|
|
@@ -29336,7 +29656,7 @@ async function brandFaviconCommand(root, opts) {
|
|
|
29336
29656
|
}
|
|
29337
29657
|
function iconsToDraw(root, force) {
|
|
29338
29658
|
const icon = force ? null : existingFavicon(root);
|
|
29339
|
-
const keepOg = !force &&
|
|
29659
|
+
const keepOg = !force && existsSync19(join22(webRoot(root), "og-image.png"));
|
|
29340
29660
|
return {
|
|
29341
29661
|
targets: BRAND_TARGETS.filter((t) => !(keepOg && t.file === "og-image.png") && !(icon && t.icoOnly)),
|
|
29342
29662
|
keepIcon: Boolean(icon),
|
|
@@ -29392,7 +29712,7 @@ async function measurePage(browser, address, width, scripts) {
|
|
|
29392
29712
|
}
|
|
29393
29713
|
}
|
|
29394
29714
|
function imageFiles(root) {
|
|
29395
|
-
const dirs = [webRoot(root) === root ? null : webRoot(root),
|
|
29715
|
+
const dirs = [webRoot(root) === root ? null : webRoot(root), join22(root, "src"), join22(root, MIGRATION_DIR)].filter((d) => !!d);
|
|
29396
29716
|
const files = dirs.flatMap((d) => walkAll(d));
|
|
29397
29717
|
if (webRoot(root) === root) files.push(...walk(root));
|
|
29398
29718
|
return [...new Set(files)].filter((p) => IMAGE_EXT.test(p) && !p.split(sep4).includes("icons") && !BRAND_FILES.includes(basename2(p)));
|
|
@@ -29402,16 +29722,16 @@ function walkAll(dir) {
|
|
|
29402
29722
|
const go = (d) => {
|
|
29403
29723
|
let names = [];
|
|
29404
29724
|
try {
|
|
29405
|
-
names =
|
|
29725
|
+
names = readdirSync7(d);
|
|
29406
29726
|
} catch {
|
|
29407
29727
|
return;
|
|
29408
29728
|
}
|
|
29409
29729
|
for (const n2 of names) {
|
|
29410
29730
|
if (found.length >= WALK_CAP) return;
|
|
29411
|
-
const p =
|
|
29731
|
+
const p = join22(d, n2);
|
|
29412
29732
|
try {
|
|
29413
|
-
if (
|
|
29414
|
-
if (!
|
|
29733
|
+
if (statSync4(p).isDirectory()) {
|
|
29734
|
+
if (!SKIP_DIRS3.has(n2) || n2 === ".deployai") go(p);
|
|
29415
29735
|
} else found.push(p);
|
|
29416
29736
|
} catch {
|
|
29417
29737
|
}
|
|
@@ -29427,7 +29747,7 @@ function judgeFiles(root) {
|
|
|
29427
29747
|
for (const f of files) {
|
|
29428
29748
|
let bytes;
|
|
29429
29749
|
try {
|
|
29430
|
-
bytes =
|
|
29750
|
+
bytes = readFileSync14(f);
|
|
29431
29751
|
} catch {
|
|
29432
29752
|
continue;
|
|
29433
29753
|
}
|
|
@@ -29435,7 +29755,7 @@ function judgeFiles(root) {
|
|
|
29435
29755
|
if (!size) continue;
|
|
29436
29756
|
total++;
|
|
29437
29757
|
const verdict = judgeImage({ width: size.width, height: size.height, bytes: bytes.length, format: size.format });
|
|
29438
|
-
if (verdict !== "ok") findings.push({ where:
|
|
29758
|
+
if (verdict !== "ok") findings.push({ where: relative5(root, f).split(sep4).join("/"), width: size.width, height: size.height, verdict });
|
|
29439
29759
|
}
|
|
29440
29760
|
return { findings, total };
|
|
29441
29761
|
}
|
|
@@ -29477,10 +29797,10 @@ async function brandImagesCommand(root, urls, opts) {
|
|
|
29477
29797
|
if (verdict !== "ok") onPages.push({ where: m.src, width: m.width, height: m.height, shownWidth: m.shownWidth, verdict, alt: m.alt });
|
|
29478
29798
|
}
|
|
29479
29799
|
const weak = [...onPages, ...findings];
|
|
29480
|
-
|
|
29800
|
+
mkdirSync13(join22(root, BRAND_DIR), { recursive: true });
|
|
29481
29801
|
const file2 = `${BRAND_DIR}/images.json`;
|
|
29482
29802
|
const data = { measuredAt: (/* @__PURE__ */ new Date()).toISOString(), pages: urls, unmeasured, filesChecked: total, imagesMeasured: shown.size, weak };
|
|
29483
|
-
|
|
29803
|
+
writeFileSync17(join22(root, file2), `${JSON.stringify(data, null, 2)}
|
|
29484
29804
|
`);
|
|
29485
29805
|
if (opts.json) {
|
|
29486
29806
|
out(JSON.stringify(data));
|
|
@@ -29543,7 +29863,7 @@ function buildProgram() {
|
|
|
29543
29863
|
if (lang === "he" || lang === "en") process.env.DEPLOYAI_LANG = lang;
|
|
29544
29864
|
}).showHelpAfterError();
|
|
29545
29865
|
const g = (cmd) => cmd.optsWithGlobals();
|
|
29546
|
-
const root = (cmd) =>
|
|
29866
|
+
const root = (cmd) => resolve8(g(cmd).dir ?? process.cwd());
|
|
29547
29867
|
const ctx = (cmd) => apiContext(g(cmd).api);
|
|
29548
29868
|
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));
|
|
29549
29869
|
program.command("inspect").description("show framework, package manager, language, database, storage").option("--json", "machine readable output").action((opts, cmd) => inspectCommand(root(cmd), opts));
|
|
@@ -29560,12 +29880,12 @@ function buildProgram() {
|
|
|
29560
29880
|
program.command("feedback").description("for your agent: tell DeployAI what got in its way and what would have helped (no code, names or addresses)").option("--kind <kind>", FEEDBACK_KINDS.join(", ")).option("--stage <stage>", `with --kind ask, when the owner asked: ${FEEDBACK_STAGES.join(", ")}`).option("--command <name>", "the DeployAI command it is about, for example deploy").option("--what <sentence>", "what happened: what you expected and what you got").option("--tried <sentence>", "what you tried, and what worked in the end").option("--suggest <sentence>", "the smallest change on our side that would have saved the step").addHelpText("after", `
|
|
29561
29881
|
${AGENT_FEEDBACK_RULES.join("\n\n")}
|
|
29562
29882
|
`).action((opts, cmd) => feedbackCommand(root(cmd), ctx(cmd), opts));
|
|
29563
|
-
program.command("allow").description("stop your coding tool asking before every DeployAI command, in this folder only (run it after the owner says yes)").argument("[tool]", "claude-code, cursor, copilot, codex or
|
|
29883
|
+
program.command("allow").description("stop your coding tool asking before every DeployAI command, in this folder only (run it after the owner says yes)").argument("[tool]", "claude-code, cursor, copilot, codex, antigravity or grok (Claude Code and Grok Build are found by themselves)").action((tool) => allowCommand(tool));
|
|
29564
29884
|
program.command("sound").description("a sound on this computer when the site is ready, or while the agent works (run it after the owner says yes)").argument("[action]", "on, off, status, test or agent", "status").argument("[state]", "with agent: on or off").argument("[tool]", "with agent: claude-code (found by itself)").option("--alongside", "with agent on: add it next to sounds Claude Code already plays").action((action, state, tool, opts, cmd) => soundCommand(root(cmd), action, state, tool, opts));
|
|
29565
29885
|
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(
|
|
29566
29886
|
(project, opts, cmd) => linkCommand(root(cmd), ctx(cmd), project, opts)
|
|
29567
29887
|
);
|
|
29568
|
-
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));
|
|
29888
|
+
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").option("--model <id>", "the AI model running this deploy, for example claude-opus-5-5 (sent only with telemetry on)").action((opts, cmd) => deployCommand(root(cmd), ctx(cmd), opts));
|
|
29569
29889
|
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));
|
|
29570
29890
|
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));
|
|
29571
29891
|
program.command("requests").argument("[action]").argument("[address]").description('incoming requests: did a webhook arrive, and what happened. "requests open <address>" opens an address to every country, "requests close <address>" closes it').option("--limit <n>", "how many, 30 by default").action((action, address, opts, cmd) => {
|
|
@@ -29608,6 +29928,12 @@ ${AGENT_FEEDBACK_RULES.join("\n\n")}
|
|
|
29608
29928
|
addon.command("buy").description("print the link where the site owner buys an add-on").argument("<name>", "the add-on name, as npx deployai@latest addons lists it").action((name, _opts, cmd) => addonBuyCommand(root(cmd), ctx(cmd), name));
|
|
29609
29929
|
addon.command("done").description("save the report of a finished add-on and print the next one").argument("<runId>", "the run id printed at the top of the add-on").option("--status <status>", "done, failed or skipped", "done").option("--report <file>", "the JSON report, for example .deployai/addon-report.json").action((runId, opts, cmd) => addonDoneCommand(root(cmd), ctx(cmd), runId, opts));
|
|
29610
29930
|
program.command("speed").description("Google PageSpeed test of a page, or Lighthouse on this computer when Google's is not available: lab results, real visitor data, biggest opportunities").argument("<url>", "the page address").option("--desktop", "test a desktop load instead of a phone").action((url2, opts, cmd) => speedCommand(ctx(cmd), url2, opts));
|
|
29931
|
+
program.command("shot").description("phone (390) and desktop (1440) pictures of a page, full page, with the Chrome or Edge on this computer").argument("<url>", "the page address").option("--out <folder>", "where to save them (default .deployai/shots)").option("--webkit", "use Safari's engine instead (downloads it first)").action(async (url2, opts, cmd) => {
|
|
29932
|
+
await shotCommand(root(cmd), url2, opts);
|
|
29933
|
+
});
|
|
29934
|
+
program.command("optimize").description("AVIF and WebP next to every JPG and PNG under public/ (or the folder given), plus a phone width; originals stay").argument("[folder]", "the folder (default public)").action(async (folder, _opts, cmd) => {
|
|
29935
|
+
await imagesCommand(root(cmd), folder);
|
|
29936
|
+
});
|
|
29611
29937
|
const env = program.command("env").description("the site's environment variables: secrets by default, never shown again");
|
|
29612
29938
|
env.command("list").description("list the keys, with a hint of each value").action((_opts, cmd) => envListCommand(root(cmd), ctx(cmd)));
|
|
29613
29939
|
env.command("set").argument("<key>", "the name, like API_KEY").argument("[value]", "the value; leave it out to pipe it in, so it stays out of the shell history").option("--plain", "a plain value the dashboard may show, not a secret").description("set a variable on the live site").action((key, value, opts, cmd) => envSetCommand(root(cmd), ctx(cmd), key, value, opts));
|
|
@@ -29635,6 +29961,10 @@ async function main(argv = process.argv) {
|
|
|
29635
29961
|
program.hook("preAction", (_this, actionCmd) => {
|
|
29636
29962
|
command = commandPath(actionCmd);
|
|
29637
29963
|
apiFlag = actionCmd.optsWithGlobals().api;
|
|
29964
|
+
try {
|
|
29965
|
+
refreshAgentScript(process.cwd());
|
|
29966
|
+
} catch {
|
|
29967
|
+
}
|
|
29638
29968
|
});
|
|
29639
29969
|
const exitBefore = process.exitCode;
|
|
29640
29970
|
let result = "success";
|
|
@@ -29686,9 +30016,9 @@ async function main(argv = process.argv) {
|
|
|
29686
30016
|
}
|
|
29687
30017
|
|
|
29688
30018
|
// src/update.ts
|
|
29689
|
-
import { spawnSync as
|
|
29690
|
-
import { existsSync as
|
|
29691
|
-
import { join as
|
|
30019
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
30020
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync14, readdirSync as readdirSync8, readFileSync as readFileSync15, rmSync as rmSync5, writeFileSync as writeFileSync18 } from "fs";
|
|
30021
|
+
import { join as join23 } from "path";
|
|
29692
30022
|
var CHECK_EVERY_MS = 60 * 60 * 1e3;
|
|
29693
30023
|
var ASK_NPM_MS = 1500;
|
|
29694
30024
|
var GET_VERSION_MS = 12e4;
|
|
@@ -29726,11 +30056,11 @@ function updateAllowed(env, args) {
|
|
|
29726
30056
|
return resolveApiUrl(void 0, loadConfig()) === API_BASE_DEFAULT.replace(/\/+$/, "");
|
|
29727
30057
|
}
|
|
29728
30058
|
function statePath() {
|
|
29729
|
-
return
|
|
30059
|
+
return join23(configDir(), "update-check.json");
|
|
29730
30060
|
}
|
|
29731
30061
|
function readState() {
|
|
29732
30062
|
try {
|
|
29733
|
-
const data = JSON.parse(
|
|
30063
|
+
const data = JSON.parse(readFileSync15(statePath(), "utf8"));
|
|
29734
30064
|
return data && typeof data === "object" ? data : {};
|
|
29735
30065
|
} catch {
|
|
29736
30066
|
return {};
|
|
@@ -29738,8 +30068,8 @@ function readState() {
|
|
|
29738
30068
|
}
|
|
29739
30069
|
function writeState(state) {
|
|
29740
30070
|
try {
|
|
29741
|
-
|
|
29742
|
-
|
|
30071
|
+
mkdirSync14(configDir(), { recursive: true });
|
|
30072
|
+
writeFileSync18(statePath(), JSON.stringify(state) + "\n");
|
|
29743
30073
|
} catch {
|
|
29744
30074
|
}
|
|
29745
30075
|
}
|
|
@@ -29755,24 +30085,24 @@ async function askNpmLatest(env) {
|
|
|
29755
30085
|
}
|
|
29756
30086
|
}
|
|
29757
30087
|
function versionEntry(version2) {
|
|
29758
|
-
return
|
|
30088
|
+
return join23(configDir(), "cli", version2, "node_modules", "deployai", "dist", "index.js");
|
|
29759
30089
|
}
|
|
29760
30090
|
function getVersion(version2, env) {
|
|
29761
30091
|
process.stderr.write(`Getting the newest DeployAI CLI, version ${version2}.
|
|
29762
30092
|
`);
|
|
29763
|
-
const root =
|
|
29764
|
-
const dir =
|
|
29765
|
-
|
|
29766
|
-
|
|
29767
|
-
const installed =
|
|
30093
|
+
const root = join23(configDir(), "cli");
|
|
30094
|
+
const dir = join23(root, version2);
|
|
30095
|
+
mkdirSync14(dir, { recursive: true });
|
|
30096
|
+
writeFileSync18(join23(dir, "package.json"), '{"private":true}\n');
|
|
30097
|
+
const installed = spawnSync5(`npm install deployai@${version2} --ignore-scripts --no-audit --no-fund --silent`, { cwd: dir, env, shell: true, stdio: "ignore", windowsHide: true, timeout: GET_VERSION_MS });
|
|
29768
30098
|
if (installed.status !== 0) return false;
|
|
29769
|
-
const ran =
|
|
30099
|
+
const ran = spawnSync5(process.execPath, [versionEntry(version2), "--version"], { env: { ...env, DEPLOYAI_NO_UPDATE: "1" }, encoding: "utf8", timeout: GET_VERSION_MS });
|
|
29770
30100
|
if (ran.status !== 0 || ran.stdout.trim() !== version2) return false;
|
|
29771
|
-
for (const old of
|
|
30101
|
+
for (const old of readdirSync8(root)) if (old !== version2) rmSync5(join23(root, old), { recursive: true, force: true });
|
|
29772
30102
|
return true;
|
|
29773
30103
|
}
|
|
29774
30104
|
function runVersion(version2, args, env = process.env) {
|
|
29775
|
-
const r =
|
|
30105
|
+
const r = spawnSync5(process.execPath, [versionEntry(version2), ...args], { stdio: "inherit", env: { ...env, DEPLOYAI_NO_UPDATE: "1" } });
|
|
29776
30106
|
if (r.error) return null;
|
|
29777
30107
|
return r.status ?? 1;
|
|
29778
30108
|
}
|
|
@@ -29787,7 +30117,7 @@ async function versionToRun(current, args, env = process.env, deps = {}) {
|
|
|
29787
30117
|
}
|
|
29788
30118
|
const latest = state.latest;
|
|
29789
30119
|
if (!latest || !PLAIN_VERSION.test(latest) || compareVersions(latest, current) <= 0) return null;
|
|
29790
|
-
if (state.ready === latest &&
|
|
30120
|
+
if (state.ready === latest && existsSync20(versionEntry(latest))) return latest;
|
|
29791
30121
|
if (now - (state.triedAt ?? 0) < CHECK_EVERY_MS) return null;
|
|
29792
30122
|
state.triedAt = now;
|
|
29793
30123
|
if (get2(latest, env)) state.ready = latest;
|