deployai 0.1.0-beta.30 → 0.1.0-beta.31

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.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/dist/index.js +575 -260
  3. 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 resolve6 } from "path";
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, resolve7) {
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, resolve7);
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, resolve7) : NONE;
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 ?? (resolve7 ? inst._zod.innerType : void 0);
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 = "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, or request_user_input in Codex. 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.";
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. Stop there: do not explain DNS, do not change DNS and do not start that step in this chat." };
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 && ["wordpress", "wix", "squarespace", "shopify"].includes(r.platform)) out2.push("serverPixel");
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 readFileSync2, writeFileSync as writeFileSync2 } from "fs";
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) ? readFileSync2(ignore, "utf8") : "";
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 = JSON.parse(readFileSync2(projectFile(root), "utf8"));
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.30";
24740
+ var CLI_VERSION = "0.1.0-beta.31";
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 readFileSync5, writeFileSync as writeFileSync3 } from "fs";
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 readFileSync4, readdirSync as readdirSync2 } from "fs";
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 readFileSync3, lstatSync } from "fs";
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(readFileSync3(file2, "utf8"));
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(readFileSync3(join3(root, ".deployaiignore"), "utf8"));
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(readFileSync3(join3(root, ".gitignore"), "utf8"));
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 all = walkFiles(root, { ignore: loadUploadIgnore(root), skipEnv: true, maxFiles: 1e5 });
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 readJson(file2) {
25230
+ function readJson2(file2) {
25163
25231
  try {
25164
- return JSON.parse(readFileSync4(file2, "utf8"));
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 readFileSync4(join4(root, rel), "utf8");
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 = readJson(pkgPath);
25375
+ const pkg = readJson2(pkgPath);
25308
25376
  let pkgText = "";
25309
25377
  try {
25310
- pkgText = readFileSync4(pkgPath, "utf8");
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 = readFileSync4(f.abs, "utf8");
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(readFileSync4(f.abs, "utf8"));
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 = readFileSync4(join4(root, name), "utf8");
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 = readFileSync4(join4(root, name), "utf8");
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 readFileSync4(join4(root, name), "utf8");
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 user in simple words, in the language they write to you in. The user may not read English.
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 user does not need a Cloudflare account: DeployAI creates the database and storage and publishes the site, with: npx deployai@latest deploy
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 developer before removing any existing functionality.
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 = readFileSync5(md, "utf8");
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) ? readFileSync5(file2, "utf8") : null;
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 readFileSync6, writeFileSync as writeFileSync5, appendFileSync as appendFileSync2 } from "fs";
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 = JSON.parse(readFileSync6(file2, "utf8"));
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) ? readFileSync6(gi, "utf8") : "";
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
- return process.env.CLAUDECODE === "1" ? "claude-code" : null;
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
- out(added ? `Done: Claude Code runs npx deployai@latest commands in this folder without asking (${rel}).` : "Already allowed in this folder.");
26225
- out("Other commands still ask, and going live still waits for the owner. The owner can take it back with /permissions.");
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 readFileSync7, rmSync, writeFileSync as writeFileSync7 } from "fs";
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
- const dot = { working: '\\u{1F535}', waiting: '\\u{1F7E0}', done: '\\u{1F7E2}', failed: '\\u{1F534}' }[state] ?? '';
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) && readFileSync7(script, "utf8") === text2;
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 : {};
@@ -26483,7 +26562,7 @@ function soundCommand(root, action, state, tool, opts = {}) {
26483
26562
  import { createInterface } from "readline/promises";
26484
26563
 
26485
26564
  // src/commands/migrate.ts
26486
- import { createWriteStream, existsSync as existsSync11, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync8, statSync as statSync2, writeFileSync as writeFileSync8 } from "fs";
26565
+ import { createWriteStream, existsSync as existsSync11, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync8 } from "fs";
26487
26566
  import { dirname as dirname2, join as join11, posix, relative, resolve, sep } from "path";
26488
26567
  import { Readable } from "stream";
26489
26568
  import { pipeline } from "stream/promises";
@@ -26497,9 +26576,9 @@ var SCAN_WORKERS = 4;
26497
26576
  var START_SCAN_PAGES = 300;
26498
26577
  var sleep2 = (ms2) => new Promise((r) => setTimeout(r, ms2));
26499
26578
  var hostDir = (root, host) => join11(root, MIGRATION_DIR, host.replace(/^www\./, ""));
26500
- var readJson2 = (file2) => {
26579
+ var readJson3 = (file2) => {
26501
26580
  try {
26502
- return JSON.parse(readFileSync8(file2, "utf8"));
26581
+ return readJson(file2);
26503
26582
  } catch {
26504
26583
  return null;
26505
26584
  }
@@ -26531,7 +26610,7 @@ async function migrateStatusCommand(root, ctx, stage, note) {
26531
26610
  out(`Reported: ${stage}${note ? ` (${stageNote(note)})` : ""}.`);
26532
26611
  }
26533
26612
  function readChoices(root) {
26534
- return readJson2(join11(root, MIGRATION_DIR, "choices.json"));
26613
+ return readJson3(join11(root, MIGRATION_DIR, "choices.json"));
26535
26614
  }
26536
26615
  function writeChoices(root, choices) {
26537
26616
  ensureMigrationDir(root);
@@ -26617,9 +26696,9 @@ async function wordpressContent(base, dir) {
26617
26696
  out(` ${type}: ${items.length}`);
26618
26697
  }
26619
26698
  }
26620
- const posts = readJson2(join11(dir, "content", "posts.json"));
26699
+ const posts = readJson3(join11(dir, "content", "posts.json"));
26621
26700
  if (posts?.length) {
26622
- const files = wpPostsToMarkdown({ origin: new URL(base).origin, posts, categories: readJson2(join11(dir, "content", "categories.json")) ?? [], tags: readJson2(join11(dir, "content", "tags.json")) ?? [], users: readJson2(join11(dir, "content", "users.json")) ?? [], media: readJson2(join11(dir, "content", "media.json")) ?? [] });
26701
+ 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
26702
  mkdirSync5(join11(dir, "posts"), { recursive: true });
26624
26703
  for (const f of files) writeFileSync8(join11(dir, "posts", f.file), f.text);
26625
26704
  out(` posts as Markdown: ${files.length}`);
@@ -26751,10 +26830,10 @@ var stateFile = (dir) => join11(dir, "report-state.json");
26751
26830
  function kitMap(root) {
26752
26831
  if (!existsSync11(join11(root, "src/kit/schema.ts"))) return {};
26753
26832
  const cut = (s, n2) => String(s ?? "").slice(0, n2);
26754
- const pages = (readJson2(join11(root, MOVED_PAGES_FILE)) ?? []).slice(0, 150).map((p) => ({ path: cut(p.path, 300), title: cut(p.title, 80), inNav: Boolean(p.inNav) }));
26755
- const posts = readJson2(join11(root, "src/kit/moved-posts.json")) ?? [];
26756
- const docs = [...new Set((readJson2(join11(root, MOVED_LEGAL_FILE))?.docs ?? []).map((d) => d.key).filter((k) => k === "privacy" || k === "terms" || k === "cancellation"))];
26757
- const forms = (readJson2(join11(root, "src/kit/forms.json")) ?? []).filter((f) => /^[a-z0-9-]{1,40}$/.test(f.key ?? "")).slice(0, 30).map((f) => ({
26833
+ 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) }));
26834
+ const posts = readJson3(join11(root, "src/kit/moved-posts.json")) ?? [];
26835
+ const docs = [...new Set((readJson3(join11(root, MOVED_LEGAL_FILE))?.docs ?? []).map((d) => d.key).filter((k) => k === "privacy" || k === "terms" || k === "cancellation"))];
26836
+ 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
26837
  key: f.key,
26759
26838
  label: cut(f.label, 80),
26760
26839
  ...f.page ? { page: cut(f.page, 300) } : {},
@@ -26765,15 +26844,25 @@ function kitMap(root) {
26765
26844
  }
26766
26845
  async function sendReport(root, ctx, host, open2, verify) {
26767
26846
  const dir = hostDir(root, host);
26768
- const inv = readJson2(join11(dir, "inventory.json"));
26769
- const site = readJson2(tagsFile(dir));
26847
+ const inv = readJson3(join11(dir, "inventory.json"));
26848
+ const site = readJson3(tagsFile(dir));
26770
26849
  const startId = readChoices(root)?.startId;
26771
26850
  if (!inv || !site) return;
26851
+ const dns = readJson3(join11(dir, "dns.json"));
26852
+ const thanksPages = findThanksPages(inv.pages);
26772
26853
  if (open2 === "scan") {
26773
- const questions = moveQuestions({ plugins: site.plugins, platform: inv.platform, tags: site.tags, forms: site.forms, triggers: site.triggers, verification: site.verification });
26854
+ if (thanksPages.length && site.forms.length) {
26855
+ const titled = thanksPages.map((p) => {
26856
+ const t = inv.pages.find((x) => x.path === p)?.title;
26857
+ return t ? `${p} (${t})` : p;
26858
+ });
26859
+ out();
26860
+ 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.`);
26861
+ }
26862
+ 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
26863
  if (questions.length) {
26775
26864
  out();
26776
- out("Ask the owner, in plain words, and record each answer:");
26865
+ 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
26866
  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
26867
  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
26868
  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 +26877,10 @@ async function sendReport(root, ctx, host, open2, verify) {
26788
26877
  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
26878
  return;
26790
26879
  }
26791
- const state = readJson2(stateFile(dir)) ?? {};
26792
- const dns = readJson2(join11(dir, "dns.json"));
26793
- const plan = existsSync11(join11(root, MIGRATION_DIR, "plan.md")) ? readFileSync8(join11(root, MIGRATION_DIR, "plan.md"), "utf8") : "";
26794
- const saved = verify ?? readJson2(join11(dir, "verify-report.json"))?.report ?? null;
26795
- const assets = readJson2(join11(dir, "assets.json")) ?? [];
26880
+ const state = readJson3(stateFile(dir)) ?? {};
26881
+ const plan = existsSync11(join11(root, MIGRATION_DIR, "plan.md")) ? readFileSync9(join11(root, MIGRATION_DIR, "plan.md"), "utf8") : "";
26882
+ const saved = verify ?? readJson3(join11(dir, "verify-report.json"))?.report ?? null;
26883
+ const assets = readJson3(join11(dir, "assets.json")) ?? [];
26796
26884
  const report2 = {
26797
26885
  source: inv.source,
26798
26886
  platform: inv.platform,
@@ -26800,6 +26888,7 @@ async function sendReport(root, ctx, host, open2, verify) {
26800
26888
  pages: { total: inv.pages.length, broken: inv.pages.filter((p) => p.status >= 400).length, skipped: inv.skipped },
26801
26889
  files: assets.length,
26802
26890
  ...reportOfTags(site),
26891
+ ...thanksPages.length ? { thanksPages } : {},
26803
26892
  dns: dns ?? null,
26804
26893
  features: parsePlanFeatures(plan),
26805
26894
  ...state.answers ? { answers: state.answers } : {},
@@ -26888,7 +26977,7 @@ async function migrateScanCommand(root, raw, opts = {}) {
26888
26977
  await addStylesheetAssets(assets);
26889
26978
  const wordpressApi = platform3 === "wordpress" ? await wordpressContent(base, dir) : false;
26890
26979
  if (wordpressApi) {
26891
- const media = readJson2(join11(dir, "content", "media.json")) ?? [];
26980
+ const media = readJson3(join11(dir, "content", "media.json")) ?? [];
26892
26981
  media.forEach((m) => m.source_url && assets.add(m.source_url));
26893
26982
  }
26894
26983
  const known = new Set(pages.map((p) => p.path));
@@ -26953,9 +27042,9 @@ async function migrateMediaCommand(root) {
26953
27042
  if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
26954
27043
  for (const host of hosts) {
26955
27044
  const dir = hostDir(root, host);
26956
- const assets = readJson2(join11(dir, "assets.json")) ?? [];
27045
+ const assets = readJson3(join11(dir, "assets.json")) ?? [];
26957
27046
  const stateFile2 = join11(dir, "media-state.json");
26958
- const state = readJson2(stateFile2) ?? { done: [], failed: [], bytes: 0 };
27047
+ const state = readJson3(stateFile2) ?? { done: [], failed: [], bytes: 0 };
26959
27048
  const done = new Set(state.done);
26960
27049
  const todo = assets.filter((a) => !done.has(a));
26961
27050
  out(`${host}: ${assets.length} files, ${todo.length} left`);
@@ -27009,9 +27098,9 @@ function migratePostsCommand(root) {
27009
27098
  const posts = [];
27010
27099
  for (const host of hosts) {
27011
27100
  const dir = hostDir(root, host);
27012
- const inv = readJson2(join11(dir, "inventory.json"));
27013
- const list = readJson2(join11(dir, "content", "posts.json"));
27014
- if (inv && list?.length) posts.push(...wpPostsToKit({ origin: new URL(inv.source).origin, posts: list, categories: readJson2(join11(dir, "content", "categories.json")) ?? [], media: readJson2(join11(dir, "content", "media.json")) ?? [] }));
27101
+ const inv = readJson3(join11(dir, "inventory.json"));
27102
+ const list = readJson3(join11(dir, "content", "posts.json"));
27103
+ 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
27104
  }
27016
27105
  if (!posts.length) {
27017
27106
  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 +27119,13 @@ function migratePagesCommand(root) {
27030
27119
  if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
27031
27120
  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
27121
  const file2 = join11(root, MOVED_PAGES_FILE);
27033
- const before = readJson2(file2);
27122
+ const before = readJson3(file2);
27034
27123
  const pages = [];
27035
27124
  for (const host of hosts) {
27036
27125
  const dir = hostDir(root, host);
27037
- const inv = readJson2(join11(dir, "inventory.json"));
27126
+ const inv = readJson3(join11(dir, "inventory.json"));
27038
27127
  if (!inv) continue;
27039
- const homeHtml = existsSync11(join11(dir, "home.html")) ? readFileSync8(join11(dir, "home.html"), "utf8") : null;
27128
+ const homeHtml = existsSync11(join11(dir, "home.html")) ? readFileSync9(join11(dir, "home.html"), "utf8") : null;
27040
27129
  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
27130
  }
27042
27131
  const kept = before?.length ? pages.filter((p) => before.some((b) => b.path === p.path)) : pages;
@@ -27052,8 +27141,8 @@ function migrateLegalCommand(root) {
27052
27141
  const site = emptySiteTags();
27053
27142
  for (const host of hosts) {
27054
27143
  const dir = hostDir(root, host);
27055
- pages.push(...readJson2(join11(dir, "inventory.json"))?.pages ?? []);
27056
- const found = readJson2(tagsFile(dir));
27144
+ pages.push(...readJson3(join11(dir, "inventory.json"))?.pages ?? []);
27145
+ const found = readJson3(tagsFile(dir));
27057
27146
  if (found) {
27058
27147
  site.tags.push(...found.tags);
27059
27148
  site.outside.push(...found.outside);
@@ -27061,7 +27150,7 @@ function migrateLegalCommand(root) {
27061
27150
  }
27062
27151
  }
27063
27152
  const file2 = join11(root, MOVED_LEGAL_FILE);
27064
- const legal = { ...movedLegalFromScan({ pages, site }), docs: readJson2(file2)?.docs ?? [] };
27153
+ const legal = { ...movedLegalFromScan({ pages, site }), docs: readJson3(file2)?.docs ?? [] };
27065
27154
  writeFileSync8(file2, JSON.stringify(legal, null, 1));
27066
27155
  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
27156
  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 +27161,12 @@ function migrateRedirectsCommand(root) {
27072
27161
  if (!hosts.length) throw new CliError("Nothing scanned yet. Run: npx deployai@latest migrate scan <the old site address>", 1, "usage");
27073
27162
  const lines = /* @__PURE__ */ new Set();
27074
27163
  for (const host of hosts) {
27075
- const inv = readJson2(join11(hostDir(root, host), "inventory.json"));
27164
+ const inv = readJson3(join11(hostDir(root, host), "inventory.json"));
27076
27165
  if (inv) redirectLines(inv).forEach((l) => lines.add(l));
27077
27166
  }
27078
27167
  const publicDir = join11(root, "public");
27079
27168
  const file2 = join11(existsSync11(publicDir) ? publicDir : root, "_redirects");
27080
- const before = existsSync11(file2) ? readFileSync8(file2, "utf8").split(/\r?\n/).filter(Boolean) : [];
27169
+ const before = existsSync11(file2) ? readFileSync9(file2, "utf8").split(/\r?\n/).filter(Boolean) : [];
27081
27170
  const added = [...lines].filter((l) => !before.some((b) => b.split(/\s+/)[0] === l.split(/\s+/)[0]));
27082
27171
  writeFileSync8(file2, [...before, ...added].join("\n") + "\n");
27083
27172
  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 +27176,7 @@ function allowedRedirects(root) {
27087
27176
  const map2 = /* @__PURE__ */ new Map();
27088
27177
  for (const file2 of [join11(root, "public", "_redirects"), join11(root, "_redirects")]) {
27089
27178
  if (!existsSync11(file2)) continue;
27090
- for (const line of readFileSync8(file2, "utf8").split(/\r?\n/)) {
27179
+ for (const line of readFileSync9(file2, "utf8").split(/\r?\n/)) {
27091
27180
  const [from, to] = line.trim().split(/\s+/);
27092
27181
  if (from && to && !from.startsWith("#")) map2.set(from, to);
27093
27182
  }
@@ -27117,13 +27206,13 @@ async function migrateTagsCommand(root, ctx, opts) {
27117
27206
  const [k, v] = a.split("=");
27118
27207
  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
27208
  }
27120
- const urls = opts.requests ? readFileSync8(resolve(root, opts.requests), "utf8").split(/\r?\n/) : [];
27209
+ const urls = opts.requests ? readFileSync9(resolve(root, opts.requests), "utf8").split(/\r?\n/) : [];
27121
27210
  for (const host of hosts) {
27122
27211
  const dir = hostDir(root, host);
27123
- const site = readJson2(tagsFile(dir));
27124
- const inv = readJson2(join11(dir, "inventory.json"));
27212
+ const site = readJson3(tagsFile(dir));
27213
+ const inv = readJson3(join11(dir, "inventory.json"));
27125
27214
  if (!site || !inv) continue;
27126
- const state = readJson2(stateFile(dir)) ?? {};
27215
+ const state = readJson3(stateFile(dir)) ?? {};
27127
27216
  if (urls.length && opts.fired) {
27128
27217
  const seen = emptySiteTags();
27129
27218
  addBrowserRequests(seen, urls, inv.source);
@@ -27191,9 +27280,9 @@ async function migrateVerifyCommand(root, previewRaw, ctx, retryMs = PREVIEW_RET
27191
27280
  const tagFindings = [];
27192
27281
  const perHost = [];
27193
27282
  for (const host of hosts) {
27194
- const inv = readJson2(join11(hostDir(root, host), "inventory.json"));
27195
- const oldSite = readJson2(tagsFile(hostDir(root, host)));
27196
- const state = readJson2(stateFile(hostDir(root, host))) ?? {};
27283
+ const inv = readJson3(join11(hostDir(root, host), "inventory.json"));
27284
+ const oldSite = readJson3(tagsFile(hostDir(root, host)));
27285
+ const state = readJson3(stateFile(hostDir(root, host))) ?? {};
27197
27286
  const nextSite = emptySiteTags();
27198
27287
  const triggerFound = {};
27199
27288
  const formIdFound = {};
@@ -27392,8 +27481,33 @@ async function askYes(question) {
27392
27481
  return answer === "y" || answer === "yes";
27393
27482
  }
27394
27483
 
27484
+ // src/same-name.ts
27485
+ import { createHash } from "crypto";
27486
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "fs";
27487
+ import { dirname as dirname3, join as join12 } from "path";
27488
+ var LAST_FILES = ".deployai/last-files.json";
27489
+ var KEPT = /^(public|static)\/.*\.(avif|webp|png|jpe?g|gif|svg|ico|woff2?|ttf|otf|mp4|webm|css|js|mjs)$/i;
27490
+ var HASHED = /[.-][A-Za-z0-9_]{6,20}\.[a-z0-9]+$/;
27491
+ var digest = (abs) => createHash("sha1").update(readFileSync10(abs)).digest("hex").slice(0, 16);
27492
+ function changedUnderSameName(root, files) {
27493
+ const now = {};
27494
+ for (const f of files) if (KEPT.test(f.rel) && !HASHED.test(f.rel.split("/").pop() ?? "")) now[f.rel] = digest(f.abs);
27495
+ let before = {};
27496
+ try {
27497
+ before = readJson(join12(root, LAST_FILES));
27498
+ } catch {
27499
+ }
27500
+ const changed = Object.keys(now).filter((rel) => before[rel] && before[rel] !== now[rel]).sort();
27501
+ try {
27502
+ mkdirSync6(dirname3(join12(root, LAST_FILES)), { recursive: true });
27503
+ writeFileSync9(join12(root, LAST_FILES), JSON.stringify(now));
27504
+ } catch {
27505
+ }
27506
+ return changed;
27507
+ }
27508
+
27395
27509
  // src/tar.ts
27396
- import { readFileSync as readFileSync9 } from "fs";
27510
+ import { readFileSync as readFileSync11 } from "fs";
27397
27511
  import { gzipSync } from "zlib";
27398
27512
  var BLOCK = 512;
27399
27513
  function writeString(buf, offset, length, value) {
@@ -27477,7 +27591,7 @@ function packFiles(files) {
27477
27591
  return createTarGz(
27478
27592
  files.map((f) => ({
27479
27593
  name: f.rel,
27480
- data: readFileSync9(f.abs),
27594
+ data: readFileSync11(f.abs),
27481
27595
  mtimeMs: f.mtimeMs,
27482
27596
  mode: f.mode & 64 ? 493 : 420
27483
27597
  }))
@@ -27553,6 +27667,7 @@ async function versionsCommand(root, ctx) {
27553
27667
  ];
27554
27668
  out(` ${cols.join("")}`);
27555
27669
  if (v.error) out(` ${v.error}`);
27670
+ if (v.preview) out(` ${v.preview}`);
27556
27671
  if (v.migrationStatus === "waiting") out(` ${messages(root)("sqlWaitingLine", { n: v.number })}`);
27557
27672
  }
27558
27673
  }
@@ -27775,6 +27890,7 @@ function expiryDate(iso) {
27775
27890
  return Number.isNaN(d.getTime()) ? iso : d.toISOString().slice(0, 10);
27776
27891
  }
27777
27892
  var BUILD_WAIT_MS = 15 * 6e4;
27893
+ var PREVIEW_WAIT_MS = 2 * 6e4;
27778
27894
  var LIVE_WAIT_MS = 3 * 6e4;
27779
27895
  async function deployCommand(root, ctx, opts) {
27780
27896
  const project = readProject(root);
@@ -27814,6 +27930,8 @@ async function prepare(root, ctx, maxBytes) {
27814
27930
  out(t("publicLeftOut", { count: leftOut.length, file: leftOut[0] }));
27815
27931
  out(t("publicLeftOutFix", { dir: leftOut[0].split("/").slice(0, 2).join("/") }));
27816
27932
  }
27933
+ const sameName = changedUnderSameName(root, plan.files);
27934
+ if (sameName.length) out(t("sameNameChanged", { count: sameName.length, file: sameName[0] }));
27817
27935
  const archive = packFiles(plan.files);
27818
27936
  if (archive.length > maxBytes) throw new CliError(t("uploadTooLargeGuest", { size: formatBytes(archive.length), max: formatBytes(maxBytes) }), 1, "too_large");
27819
27937
  const info = [[t("files"), `${plan.files.length} (${formatBytes(plan.totalBytes)}, packed ${formatBytes(archive.length)})`]];
@@ -27823,9 +27941,12 @@ async function prepare(root, ctx, maxBytes) {
27823
27941
  }
27824
27942
  return { archive, info, hasSql: plan.files.some((f) => SQL_FILE.test(f.rel) && !f.rel.includes("node_modules/")) };
27825
27943
  }
27826
- function addTool(form, ctx) {
27827
- const tool = telemetryEnabled(ctx.config) ? deployToolFromEnv(process.env) : null;
27944
+ function addTool(form, ctx, model) {
27945
+ if (!telemetryEnabled(ctx.config)) return;
27946
+ const tool = deployToolFromEnv(process.env);
27828
27947
  if (tool) form.append("tool", tool);
27948
+ const m = toDeployModel(model) ?? deployModelFromEnv(process.env);
27949
+ if (m) form.append("model", m);
27829
27950
  }
27830
27951
  async function deployVersion(root, ctx, opts, guest) {
27831
27952
  requireToken(ctx);
@@ -27847,7 +27968,7 @@ async function deployVersion(root, ctx, opts, guest) {
27847
27968
  form.append("message", message);
27848
27969
  const fixed = (opts.fixed ?? "").replace(/\s+/g, " ").trim().slice(0, 300);
27849
27970
  if (fixed && telemetryEnabled(ctx.config)) form.append("fixNote", fixed);
27850
- addTool(form, ctx);
27971
+ addTool(form, ctx, opts.model);
27851
27972
  if (wait && soundWanted(ctx.config)) form.append("soundHere", live ? "live" : "preview");
27852
27973
  form.append("archive", new Blob([new Uint8Array(archive)], { type: "application/gzip" }), "source.tar.gz");
27853
27974
  const res = await apiRequest(ctx, "/api/cli/deploy", DeployResponse, { method: "POST", form, timeoutMs: 5 * 6e4 });
@@ -27904,6 +28025,11 @@ async function afterBuild(root, ctx, projectId, n2, o) {
27904
28025
  return;
27905
28026
  }
27906
28027
  const ready = built.latest?.number === n2 && built.latest.status === "ready" && built.project.liveVersion !== n2;
28028
+ if (ready && !built.latest?.preview) {
28029
+ const withPreview = await poll(root, ctx, projectId, n2, o.pollMs, PREVIEW_WAIT_MS, (s) => Boolean(s.latest?.preview) || s.latest?.number !== n2);
28030
+ if (withPreview?.latest?.number === n2 && withPreview.latest.preview) built.latest = withPreview.latest;
28031
+ else out(t("previewNotYet"));
28032
+ }
27907
28033
  if (ready && built.latest?.preview) {
27908
28034
  if (!await homeAnswers(root, built.latest.preview, o.homeRetryMs)) {
27909
28035
  process.exitCode = 1;
@@ -28022,7 +28148,7 @@ async function deployGuest(root, ctx, opts) {
28022
28148
  out(t("uploading"));
28023
28149
  const form = new FormData();
28024
28150
  form.append("message", message);
28025
- addTool(form, ctx);
28151
+ addTool(form, ctx, opts.model);
28026
28152
  form.append("archive", new Blob([new Uint8Array(archive)], { type: "application/gzip" }), "source.tar.gz");
28027
28153
  const res = await apiRequest(ctx, "/api/cli/guest", GuestResponse, { method: "POST", form, auth: false, timeoutMs: 5 * 6e4 });
28028
28154
  updateConfig({ guestTokens: { ...ctx.config.guestTokens ?? {}, [res.projectId]: res.token }, guestClaims: { ...ctx.config.guestClaims ?? {}, [res.projectId]: res.claimUrl } });
@@ -28064,12 +28190,12 @@ async function claimCommand(root, ctx, opts) {
28064
28190
  // src/commands/pull.ts
28065
28191
  import { spawnSync as spawnSync2 } from "child_process";
28066
28192
  import { existsSync as existsSync13, readdirSync as readdirSync5, rmSync as rmSync2 } from "fs";
28067
- import { join as join13 } from "path";
28193
+ import { join as join14 } from "path";
28068
28194
 
28069
28195
  // src/commands/samples.ts
28070
28196
  import { createInterface as createInterface3 } from "readline/promises";
28071
- import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync4, writeFileSync as writeFileSync9 } from "fs";
28072
- import { dirname as dirname3, join as join12, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
28197
+ import { existsSync as existsSync12, mkdirSync as mkdirSync7, readdirSync as readdirSync4, writeFileSync as writeFileSync10 } from "fs";
28198
+ import { dirname as dirname4, join as join13, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
28073
28199
  import { gunzipSync } from "zlib";
28074
28200
  var SAMPLES = [
28075
28201
  { key: "landing", title: "Landing page: a full one-page site with WhatsApp sign-up", stack: "static HTML and CSS" },
@@ -28119,7 +28245,7 @@ async function askWhere(cwd, key, count) {
28119
28245
  }
28120
28246
  }
28121
28247
  async function downloadSample(ctx, key, root) {
28122
- mkdirSync6(root, { recursive: true });
28248
+ mkdirSync7(root, { recursive: true });
28123
28249
  let res;
28124
28250
  try {
28125
28251
  res = await fetch(`${ctx.apiUrl}/samples-src/${key}.tar.gz`, {
@@ -28141,7 +28267,7 @@ function extractInto(gz, root, damaged) {
28141
28267
  } catch {
28142
28268
  throw new CliError(damaged, 1, "api");
28143
28269
  }
28144
- mkdirSync6(root, { recursive: true });
28270
+ mkdirSync7(root, { recursive: true });
28145
28271
  const base = resolve2(root);
28146
28272
  let written = 0;
28147
28273
  for (const e3 of entries) {
@@ -28149,8 +28275,8 @@ function extractInto(gz, root, damaged) {
28149
28275
  if (privateProjectFile(e3.name.replace(/\\/g, "/"))) continue;
28150
28276
  const target = resolve2(base, e3.name);
28151
28277
  if (target !== base && !target.startsWith(base + sep2)) continue;
28152
- mkdirSync6(dirname3(target), { recursive: true });
28153
- writeFileSync9(target, e3.data);
28278
+ mkdirSync7(dirname4(target), { recursive: true });
28279
+ writeFileSync10(target, e3.data);
28154
28280
  written++;
28155
28281
  }
28156
28282
  return written;
@@ -28174,7 +28300,7 @@ async function samplesCommand(cwd, ctx, key, opts = {}) {
28174
28300
  }
28175
28301
  const written = await downloadSample(ctx, sample.key, root);
28176
28302
  const base = resolve2(root);
28177
- const hasPackage = existsSync12(join12(base, "package.json"));
28303
+ const hasPackage = existsSync12(join13(base, "package.json"));
28178
28304
  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
28305
  out("");
28180
28306
  const t = messages(base);
@@ -28231,7 +28357,7 @@ var git = (root, args, env = {}) => spawnSync2("git", args, { cwd: root, encodin
28231
28357
  function clearTree(root) {
28232
28358
  for (const name of readdirSync5(root)) {
28233
28359
  if (name === ".git" || name === ".deployai") continue;
28234
- rmSync2(join13(root, name), { recursive: true, force: true });
28360
+ rmSync2(join14(root, name), { recursive: true, force: true });
28235
28361
  }
28236
28362
  }
28237
28363
  async function pullHistory(root, ctx, projectId) {
@@ -28241,7 +28367,7 @@ async function pullHistory(root, ctx, projectId) {
28241
28367
  const live = versions.find((v) => v.isLive)?.number ?? Math.max(0, ...versions.filter((v) => v.status === "ready").map((v) => v.number));
28242
28368
  const chosen = versions.filter((v) => v.number <= live && v.status !== "failed" && v.status !== "queued").sort((a, b) => a.number - b.number);
28243
28369
  if (!chosen.length) throw new CliError(t("pullNoSource"), 1, "not_found");
28244
- if (!existsSync13(join13(root, ".git")) && git(root, ["init", "-q"]).status !== 0) throw new CliError(t("pullNoGit"), 1, "usage");
28370
+ if (!existsSync13(join14(root, ".git")) && git(root, ["init", "-q"]).status !== 0) throw new CliError(t("pullNoGit"), 1, "usage");
28245
28371
  for (const v of chosen) {
28246
28372
  const gz = await fetchSource(root, ctx, projectId, v.number).catch(() => null);
28247
28373
  if (!gz) continue;
@@ -28292,12 +28418,52 @@ async function requestsOpenCommand(root, ctx, path, open2) {
28292
28418
 
28293
28419
  // src/commands/start.ts
28294
28420
  import { spawnSync as spawnSync3 } from "child_process";
28295
- import { existsSync as existsSync14, writeFileSync as writeFileSync11 } from "fs";
28296
- import { join as join15, relative as relative3, resolve as resolve3 } from "path";
28421
+ import { existsSync as existsSync14, writeFileSync as writeFileSync13 } from "fs";
28422
+ import { join as join17, relative as relative3, resolve as resolve3 } from "path";
28423
+
28424
+ // src/rules.ts
28425
+ import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync11 } from "fs";
28426
+ import { join as join15 } from "path";
28427
+ var CACHE_FILE = "rules-cache.json";
28428
+ var DAY_MS = 864e5;
28429
+ var WAIT_MS2 = 2e3;
28430
+ var EMPTY = { rules: {}, extra: [] };
28431
+ function cleanRules(v) {
28432
+ const o = v && typeof v === "object" ? v : {};
28433
+ const rules = {};
28434
+ if (o.rules && typeof o.rules === "object") {
28435
+ for (const [k, t] of Object.entries(o.rules)) if (typeof t === "string" && t.trim() && t.length < 2e4) rules[k] = t;
28436
+ }
28437
+ const extra = Array.isArray(o.extra) ? o.extra.filter((t) => typeof t === "string" && t.trim().length > 0 && t.length < 4e3).slice(0, 20) : [];
28438
+ return { rules, extra };
28439
+ }
28440
+ async function serverRules(apiUrl, fetcher = fetch, now = Date.now()) {
28441
+ const file2 = join15(configDir(), CACHE_FILE);
28442
+ let cached2 = null;
28443
+ try {
28444
+ cached2 = readJson(file2);
28445
+ } catch {
28446
+ }
28447
+ if (cached2 && cached2.version === CLI_VERSION && now - cached2.at < DAY_MS) return cleanRules(cached2.data);
28448
+ try {
28449
+ const r = await fetcher(`${apiUrl}/api/cli/rules?cli=${encodeURIComponent(CLI_VERSION)}`, { signal: AbortSignal.timeout(WAIT_MS2) });
28450
+ if (!r.ok) throw new Error(String(r.status));
28451
+ const data = cleanRules(await r.json());
28452
+ try {
28453
+ mkdirSync8(configDir(), { recursive: true });
28454
+ writeFileSync11(file2, JSON.stringify({ at: now, version: CLI_VERSION, data }));
28455
+ } catch {
28456
+ }
28457
+ return data;
28458
+ } catch {
28459
+ return cached2 ? cleanRules(cached2.data) : EMPTY;
28460
+ }
28461
+ }
28462
+ var rule = (r, key, bundled) => r.rules[key] ?? bundled;
28297
28463
 
28298
28464
  // src/commands/starter.ts
28299
- import { writeFileSync as writeFileSync10 } from "fs";
28300
- import { join as join14 } from "path";
28465
+ import { writeFileSync as writeFileSync12 } from "fs";
28466
+ import { join as join16 } from "path";
28301
28467
  var esc2 = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]);
28302
28468
  var TEXT = {
28303
28469
  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 +28511,8 @@ DeployAI wrote this page so the folder starts as a working site. Build the owner
28345
28511
  - Delete this README or replace it with notes about the site.
28346
28512
  `;
28347
28513
  function writeStarter(root, name, lang, stack) {
28348
- writeFileSync10(join14(root, "index.html"), page2(name ?? "", lang, stack));
28349
- writeFileSync10(join14(root, "README.md"), README);
28514
+ writeFileSync12(join16(root, "index.html"), page2(name ?? "", lang, stack));
28515
+ writeFileSync12(join16(root, "README.md"), README);
28350
28516
  }
28351
28517
 
28352
28518
  // src/commands/start.ts
@@ -28395,6 +28561,8 @@ async function startCommand(cwd, ctx, id, opts = {}) {
28395
28561
  const { kind, choices, agent } = start2;
28396
28562
  const sample = choices.sampleKey ? SAMPLES.find((s) => s.key === choices.sampleKey) : void 0;
28397
28563
  if (choices.sampleKey && !sample) throw new CliError(messages()("unknownSample", { key: choices.sampleKey }), 1, "not_found");
28564
+ out(START_WAIT_LINE);
28565
+ out();
28398
28566
  const fresh = kind === "new" || kind === "migrate" || kind === "guest" && sample;
28399
28567
  const here = resolve3(cwd);
28400
28568
  const sameSite = Boolean(choices.projectId && readProject(here)?.projectId === choices.projectId);
@@ -28416,7 +28584,7 @@ async function startCommand(cwd, ctx, id, opts = {}) {
28416
28584
  if (sample && !sameSite) {
28417
28585
  const written = await downloadSample(ctxNow, sample.key, root);
28418
28586
  done.push(t("startDownloaded", { key: sample.key, n: written }));
28419
- if (existsSync14(join15(root, "package.json"))) {
28587
+ if (existsSync14(join17(root, "package.json"))) {
28420
28588
  if (opts.install !== false && install(root)) done.push(t("startInstalled"));
28421
28589
  else steps.unshift({ cmd: "npm install", say: "Installs the sample's packages." });
28422
28590
  }
@@ -28441,7 +28609,7 @@ async function startCommand(cwd, ctx, id, opts = {}) {
28441
28609
  const stackText = choices.stack ? stackBlock(choices.stack) : "";
28442
28610
  if (choices.brief || stackText) {
28443
28611
  ensureDeployaiDir(root);
28444
- writeFileSync11(join15(root, BRIEF_FILE), [choices.brief ? `# The owner's details
28612
+ writeFileSync13(join17(root, BRIEF_FILE), [choices.brief ? `# The owner's details
28445
28613
 
28446
28614
  ${choices.brief}
28447
28615
  ` : "", stackText].filter(Boolean).join("\n"));
@@ -28465,38 +28633,48 @@ ${choices.brief}
28465
28633
  if (root !== here) out(t(update ? "startUpdateFolder" : "startNewFolder", { dir: relative3(here, root) }));
28466
28634
  for (const line of done) out(`- ${line}`);
28467
28635
  out();
28468
- out("----- Instructions for the agent -----");
28469
- out();
28636
+ const lines = [];
28637
+ const say = (line = "") => {
28638
+ lines.push(line);
28639
+ out(line);
28640
+ };
28641
+ say("----- Instructions for the agent -----");
28642
+ say();
28470
28643
  if (root !== here) {
28471
- out(`Work only inside the folder ${relative3(here, root)} from now on (cd ${JSON.stringify(relative3(here, root))}).`);
28472
- out();
28644
+ say(`Work only inside the folder ${relative3(here, root)} from now on (cd ${JSON.stringify(relative3(here, root))}).`);
28645
+ say();
28473
28646
  }
28474
- out(agent.trim());
28647
+ say(agent.trim());
28475
28648
  if (stackText) {
28476
- out();
28477
- out(stackText.trim());
28649
+ say();
28650
+ say(stackText.trim());
28478
28651
  }
28479
28652
  if (kind === "migrate") {
28480
- out();
28481
- out(uiSourcesText());
28482
- }
28483
- out();
28484
- out("Then, in this order:");
28485
- steps.forEach((s, i) => out(`${i + 1}. ${s.cmd ? `Run ${s.cmd}. ` : ""}${s.say}`));
28486
- out();
28487
- out(runCommandsRule(langOf(choices.ownerLanguage)));
28653
+ say();
28654
+ say(uiSourcesText());
28655
+ }
28656
+ say();
28657
+ say("Then, in this order:");
28658
+ steps.forEach((s, i) => say(`${i + 1}. ${s.cmd ? `Run ${s.cmd}. ` : ""}${s.say}`));
28659
+ say();
28660
+ say(runCommandsRule(langOf(choices.ownerLanguage)));
28661
+ say(MODEL_FLAG_RULE);
28488
28662
  const askLine2 = toolAskLine(deployToolFromEnv(process.env));
28489
- if (askLine2) out(askLine2);
28490
- out(ASK_OWNER_RULE);
28491
- out(OWNER_TEXT_RULE);
28492
- out(START_FAIL_LINE);
28663
+ if (askLine2) say(askLine2);
28664
+ const server = await serverRules(ctx.apiUrl);
28665
+ say(rule(server, "askOwner", ASK_OWNER_RULE));
28666
+ say(rule(server, "ownerText", OWNER_TEXT_RULE));
28667
+ for (const line of server.extra) say(line);
28668
+ say(START_FAIL_LINE);
28669
+ ensureDeployaiDir(root);
28670
+ writeFileSync13(join17(root, START_FILE), `${lines.join("\n")}
28671
+ `);
28493
28672
  }
28494
28673
 
28495
28674
  // src/commands/addon.ts
28496
- import { readFileSync as readFileSync10 } from "fs";
28497
- import { dirname as dirname4, join as join16, resolve as resolve4 } from "path";
28498
- import { mkdirSync as mkdirSync7 } from "fs";
28499
- import { existsSync as existsSync15, writeFileSync as writeFileSync12 } from "fs";
28675
+ import { dirname as dirname5, join as join18, resolve as resolve4 } from "path";
28676
+ import { mkdirSync as mkdirSync9 } from "fs";
28677
+ import { existsSync as existsSync15, writeFileSync as writeFileSync14 } from "fs";
28500
28678
  function linkedProjectId2(root) {
28501
28679
  const id = readProject(root)?.projectId;
28502
28680
  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 +28731,14 @@ async function addonsRunCommand(root, ctx, opts = {}) {
28553
28731
  const all = opts.all === true || !opts.oneByOne && readProject(root)?.addonsAll === true;
28554
28732
  if (!order && r.picked && !r.agreed && todo.length > 1 && (opts.all || !all)) {
28555
28733
  const stamps = readStamps(root);
28556
- const items = todo.map((a) => ({ ...a, trace: addonTrace(a.key, (path) => existsSync15(join16(root, path)), stamps) }));
28734
+ const items = todo.map((a) => ({ ...a, trace: addonTrace(a.key, (path) => existsSync15(join18(root, path)), stamps) }));
28557
28735
  addonOrderBrief(items, opts.all ? "all" : opts.oneByOne ? "one-by-one" : null).forEach((line) => out(line));
28558
28736
  return;
28559
28737
  }
28560
28738
  if (!all && !opts.oneByOne && todo.length > 1) {
28561
28739
  out(`This site has ${todo.length} add-ons waiting: ${todo.map((a) => a.key).join(", ")}.`);
28562
- out('Ask the owner: "Run the add-ons one by one, or all at once?"');
28740
+ out("If .deployai/owner-mode says on-my-own, do not ask: run npx deployai@latest addons run --all (D-865).");
28741
+ out('Else ask the owner: "Run the add-ons one by one, or all at once?"');
28563
28742
  out("- One by one (recommended): after each add-on, choose whether to publish.");
28564
28743
  out(" Run: npx deployai@latest addons run --one-by-one");
28565
28744
  out("- All at once: they all finish first, then one publish at the end.");
@@ -28595,24 +28774,24 @@ async function addonBuyCommand(root, ctx, key) {
28595
28774
  return;
28596
28775
  }
28597
28776
  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. They pay once for this site, then run: npx deployai@latest addon run ${a.key}`);
28777
+ 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
28778
  out(a.buyUrl);
28600
28779
  }
28601
28780
  function readStamps(root) {
28602
28781
  try {
28603
- return JSON.parse(readFileSync10(join16(root, ADDON_STAMP_FILE), "utf8"));
28782
+ return readJson(join18(root, ADDON_STAMP_FILE));
28604
28783
  } catch {
28605
28784
  return {};
28606
28785
  }
28607
28786
  }
28608
28787
  function writeStamps(root, stamps) {
28609
- const file2 = join16(root, ADDON_STAMP_FILE);
28610
- mkdirSync7(dirname4(file2), { recursive: true });
28611
- writeFileSync12(file2, JSON.stringify(stamps, null, 2));
28788
+ const file2 = join18(root, ADDON_STAMP_FILE);
28789
+ mkdirSync9(dirname5(file2), { recursive: true });
28790
+ writeFileSync14(file2, JSON.stringify(stamps, null, 2));
28612
28791
  }
28613
28792
  function printAddon(root, a) {
28614
28793
  const stamps = readStamps(root);
28615
- const trace = addonTrace(a.key, (path) => existsSync15(join16(root, path)), stamps);
28794
+ const trace = addonTrace(a.key, (path) => existsSync15(join18(root, path)), stamps);
28616
28795
  writeStamps(root, { ...stamps, [a.key]: { ...stamps[a.key], runId: a.runId } });
28617
28796
  out(`DeployAI add-on ${a.position} of ${a.total}: ${a.name} (${a.key}, run ${a.runId}).`);
28618
28797
  const line = addonTraceLine(a.key, a.runId, trace);
@@ -28644,7 +28823,7 @@ async function addonDoneCommand(root, ctx, runId, opts) {
28644
28823
  let report2;
28645
28824
  if (opts.report) {
28646
28825
  try {
28647
- report2 = JSON.parse(readFileSync10(resolve4(root, opts.report), "utf8"));
28826
+ report2 = readJson(resolve4(root, opts.report));
28648
28827
  } catch {
28649
28828
  throw new CliError(`Cannot read the report file ${opts.report} as JSON.`, 1, "usage");
28650
28829
  }
@@ -28671,9 +28850,9 @@ async function addonDoneCommand(root, ctx, runId, opts) {
28671
28850
 
28672
28851
  // src/commands/speed.ts
28673
28852
  import { spawn as spawn3 } from "child_process";
28674
- import { mkdtempSync, readFileSync as readFileSync11, rmSync as rmSync3 } from "fs";
28853
+ import { mkdtempSync, readFileSync as readFileSync12, rmSync as rmSync3 } from "fs";
28675
28854
  import { tmpdir } from "os";
28676
- import { join as join17 } from "path";
28855
+ import { join as join19 } from "path";
28677
28856
  var ms = (v) => v >= 1e3 ? `${(v / 1e3).toFixed(1)} s` : `${Math.round(v)} ms`;
28678
28857
  var LOCAL_WAIT_MS = 18e4;
28679
28858
  function runLighthouse(url2, strategy, browser, file2) {
@@ -28697,11 +28876,11 @@ function runLighthouse(url2, strategy, browser, file2) {
28697
28876
  }
28698
28877
  async function localSpeed(url2, strategy, run = runLighthouse, browser = findBrowser()) {
28699
28878
  if (!browser) return null;
28700
- const dir = mkdtempSync(join17(tmpdir(), "deployai-speed-"));
28879
+ const dir = mkdtempSync(join19(tmpdir(), "deployai-speed-"));
28701
28880
  try {
28702
- const file2 = join17(dir, "report.json");
28881
+ const file2 = join19(dir, "report.json");
28703
28882
  await run(url2, strategy, browser, file2);
28704
- const lighthouseResult = JSON.parse(readFileSync11(file2, "utf8"));
28883
+ const lighthouseResult = JSON.parse(readFileSync12(file2, "utf8"));
28705
28884
  return lighthouseResult.categories ? mapPsi({ lighthouseResult }, strategy) : null;
28706
28885
  } catch {
28707
28886
  return null;
@@ -28754,29 +28933,159 @@ async function speedCommand(ctx, url2, opts, deps = {}) {
28754
28933
  }
28755
28934
  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
28935
  out("Google's test is not available right now, so Lighthouse is running on this computer. This takes about a minute...");
28757
- const report2 = await localSpeed(page3, strategy, deps.run, deps.browser === void 0 ? findBrowser() : deps.browser);
28758
- if (!report2) throw new CliError("The speed test could not run: Google's test is not available, and Lighthouse needs Chrome or Edge and Node 22.19 or newer on this computer. Go on without speed numbers and tell the owner in one line.", 1, "speed_failed");
28936
+ const browser = deps.browser === void 0 ? findBrowser() : deps.browser;
28937
+ 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");
28938
+ const report2 = await localSpeed(page3, strategy, deps.run, browser);
28939
+ 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
28940
  printReport(report2, strategy, true);
28760
28941
  out();
28761
28942
  out("Measured on this computer, so compare it only with numbers measured the same way.");
28762
28943
  }
28763
28944
 
28945
+ // src/commands/shot.ts
28946
+ import { spawn as spawn4 } from "child_process";
28947
+ import { existsSync as existsSync16, mkdirSync as mkdirSync10 } from "fs";
28948
+ import { join as join20, resolve as resolve5 } from "path";
28949
+ var SHOT_SIZES = [{ name: "phone", size: "390,844" }, { name: "desktop", size: "1440,900" }];
28950
+ var PLAYWRIGHT = "playwright@1.56";
28951
+ var WAIT_MS3 = 18e4;
28952
+ var channelFor = (browser) => /msedge|edge/i.test(browser) ? "msedge" : "chrome";
28953
+ function shotName(address, width) {
28954
+ const u = new URL(address);
28955
+ const path = u.pathname.replace(/\/+$/, "").replace(/[^a-z0-9]+/gi, "-").replace(/^-|-$/g, "") || "home";
28956
+ return `${u.hostname}-${path}-${width}.png`;
28957
+ }
28958
+ function runNpx(args) {
28959
+ const win = process.platform === "win32";
28960
+ return new Promise((done) => {
28961
+ const child = win ? spawn4(["npx", ...args.map((a) => `"${a}"`)].join(" "), { stdio: "ignore", windowsHide: true, shell: true }) : spawn4("npx", args, { stdio: "ignore" });
28962
+ const timer = setTimeout(() => child.kill(), WAIT_MS3);
28963
+ child.once("error", () => {
28964
+ clearTimeout(timer);
28965
+ done(1);
28966
+ });
28967
+ child.once("exit", (code) => {
28968
+ clearTimeout(timer);
28969
+ done(code ?? 1);
28970
+ });
28971
+ });
28972
+ }
28973
+ async function shotCommand(root, address, opts = {}, run = runNpx) {
28974
+ let url2;
28975
+ try {
28976
+ url2 = new URL(address);
28977
+ if (!/^https?:$/.test(url2.protocol) || address.includes('"')) throw new Error("bad");
28978
+ } catch {
28979
+ throw new CliError("Give a full page address, like https://my-site.co.il/about.", 1, "bad_address");
28980
+ }
28981
+ const browser = opts.webkit ? null : findBrowser();
28982
+ 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");
28983
+ 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");
28984
+ const dir = resolve5(root, opts.out ?? join20(".deployai", "shots"));
28985
+ mkdirSync10(dir, { recursive: true });
28986
+ const saved = [];
28987
+ for (const s of SHOT_SIZES) {
28988
+ const file2 = join20(dir, shotName(url2.toString(), s.name));
28989
+ const engine = opts.webkit ? ["--browser=webkit"] : [`--channel=${channelFor(browser)}`];
28990
+ const code = await run(["--yes", PLAYWRIGHT, "screenshot", ...engine, `--viewport-size=${s.size}`, "--full-page", "--wait-for-timeout=1500", url2.toString(), file2]);
28991
+ 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");
28992
+ saved.push(file2);
28993
+ out(`${s.name.padEnd(8)} ${file2}`);
28994
+ }
28995
+ out("Open both and look at them as a visitor: the header, the menu, every image and button.");
28996
+ return saved;
28997
+ }
28998
+
28999
+ // src/commands/images.ts
29000
+ import { spawnSync as spawnSync4 } from "child_process";
29001
+ import { existsSync as existsSync17, mkdirSync as mkdirSync11, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as writeFileSync15 } from "fs";
29002
+ import { createRequire } from "module";
29003
+ import { homedir as homedir3 } from "os";
29004
+ import { extname, join as join21, relative as relative4, resolve as resolve6 } from "path";
29005
+ var PHONE_WIDTH = 640;
29006
+ var SHARP = "sharp@0.34";
29007
+ var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", ".git", ".deployai", "dist", ".astro", ".next"]);
29008
+ function imagesIn(dir) {
29009
+ const found = [];
29010
+ const walk2 = (d) => {
29011
+ for (const name of readdirSync6(d)) {
29012
+ const p = join21(d, name);
29013
+ const st = statSync3(p);
29014
+ if (st.isDirectory()) {
29015
+ if (!SKIP_DIRS2.has(name)) walk2(p);
29016
+ } else if (/\.(jpe?g|png)$/i.test(name)) found.push(p);
29017
+ }
29018
+ };
29019
+ if (existsSync17(dir)) walk2(dir);
29020
+ return found.sort();
29021
+ }
29022
+ function outputsFor(file2, width) {
29023
+ const base = file2.slice(0, -extname(file2).length);
29024
+ const list = [{ file: `${base}.webp`, format: "webp" }, { file: `${base}.avif`, format: "avif" }];
29025
+ 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" });
29026
+ return list;
29027
+ }
29028
+ function loadSharp() {
29029
+ const dir = join21(homedir3(), ".deployai", "tools", "sharp");
29030
+ if (!existsSync17(join21(dir, "node_modules", "sharp"))) {
29031
+ mkdirSync11(dir, { recursive: true });
29032
+ if (!existsSync17(join21(dir, "package.json"))) writeFileSync15(join21(dir, "package.json"), '{"private":true}');
29033
+ out("Getting the image tool once (it stays outside the site)...");
29034
+ const r = spawnSync4(process.platform === "win32" ? "npm.cmd" : "npm", ["install", SHARP, "--no-audit", "--no-fund", "--silent"], { cwd: dir, stdio: "ignore", shell: process.platform === "win32" });
29035
+ 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");
29036
+ }
29037
+ return createRequire(join21(dir, "package.json"))("sharp");
29038
+ }
29039
+ async function imagesCommand(root, folder, sharp = loadSharp) {
29040
+ const dir = resolve6(root, folder ?? "public");
29041
+ const files = imagesIn(dir);
29042
+ if (!files.length) {
29043
+ out(`No JPG or PNG images under ${relative4(root, dir) || "."}.`);
29044
+ return { done: 0, skipped: 0, saved: 0 };
29045
+ }
29046
+ const make = sharp();
29047
+ let done = 0;
29048
+ let skipped = 0;
29049
+ let saved = 0;
29050
+ for (const file2 of files) {
29051
+ const size = statSync3(file2).size;
29052
+ const meta3 = await make(file2).metadata();
29053
+ const outputs = outputsFor(file2, meta3.width);
29054
+ if (outputs.every((o) => existsSync17(o.file) && statSync3(o.file).mtimeMs >= statSync3(file2).mtimeMs)) {
29055
+ skipped++;
29056
+ continue;
29057
+ }
29058
+ for (const o of outputs) {
29059
+ let img = make(file2);
29060
+ if (o.width) img = img.resize({ width: o.width });
29061
+ const r = await (o.format === "webp" ? img.webp({ quality: 80 }) : img.avif({ quality: 55 })).toFile(o.file);
29062
+ if (!o.width && o.format === "webp") saved += Math.max(0, size - r.size);
29063
+ }
29064
+ done++;
29065
+ }
29066
+ out(`Converted ${done} image${done === 1 ? "" : "s"}${skipped ? `, ${skipped} already done` : ""}. WebP alone saves about ${Math.round(saved / 1024)} KB.`);
29067
+ out("Serve them with <picture>, the original last so its address keeps working:");
29068
+ 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>');
29069
+ return { done, skipped, saved };
29070
+ }
29071
+
28764
29072
  // src/commands/blocks.ts
28765
- import { createHash } from "crypto";
28766
- import { existsSync as existsSync16, mkdirSync as mkdirSync8, readFileSync as readFileSync12, writeFileSync as writeFileSync13 } from "fs";
28767
- import { dirname as dirname5, resolve as resolve5, sep as sep3 } from "path";
29073
+ import { createHash as createHash2 } from "crypto";
29074
+ import { existsSync as existsSync18, mkdirSync as mkdirSync12, readFileSync as readFileSync13, writeFileSync as writeFileSync16 } from "fs";
29075
+ import { dirname as dirname6, resolve as resolve7, sep as sep3 } from "path";
28768
29076
  import { gunzipSync as gunzipSync2 } from "zlib";
28769
29077
  var BLOCKS = [
28770
29078
  { key: "dashboard", title: "The site's own dashboard: messages, pages, blog, shop, images, accessibility, documents. Add --update to get a newer version" },
28771
29079
  { 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" }
29080
+ { key: "blog", title: "Blog: posts as Markdown files, categories, tags, authors, pages, RSS and article data for search" },
29081
+ { 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
29082
  ];
28774
29083
  var MAX_BYTES3 = 5 * 1024 * 1024;
28775
- var sha = (data) => createHash("sha256").update(data).digest("hex");
28776
- var lockPath = (base, key) => resolve5(base, ".deployai", "blocks", `${key}.lock.json`);
29084
+ var sha = (data) => createHash2("sha256").update(data).digest("hex");
29085
+ var lockPath = (base, key) => resolve7(base, ".deployai", "blocks", `${key}.lock.json`);
28777
29086
  function readLock(base, key) {
28778
29087
  try {
28779
- return JSON.parse(readFileSync12(lockPath(base, key), "utf8"));
29088
+ return readJson(lockPath(base, key));
28780
29089
  } catch {
28781
29090
  return {};
28782
29091
  }
@@ -28807,21 +29116,21 @@ async function blocksCommand(root, ctx, name, opts = {}) {
28807
29116
  } catch {
28808
29117
  throw new CliError("The block download is damaged. Try again.", 1, "api");
28809
29118
  }
28810
- const base = resolve5(root);
29119
+ const base = resolve7(root);
28811
29120
  const written = [];
28812
29121
  const kept = [];
28813
29122
  const updated = [];
28814
29123
  const lock = readLock(base, block.key);
28815
29124
  for (const e3 of entries) {
28816
29125
  if (e3.type !== "0" && e3.type !== "\0") continue;
28817
- const target = resolve5(base, e3.name);
29126
+ const target = resolve7(base, e3.name);
28818
29127
  if (target === base || !target.startsWith(base + sep3)) continue;
28819
- if (existsSync16(target)) {
28820
- const now = sha(readFileSync12(target));
29128
+ if (existsSync18(target)) {
29129
+ const now = sha(readFileSync13(target));
28821
29130
  if (now === sha(e3.data)) {
28822
29131
  lock[e3.name] = now;
28823
29132
  } else if (opts.update && lock[e3.name] === now) {
28824
- writeFileSync13(target, e3.data);
29133
+ writeFileSync16(target, e3.data);
28825
29134
  lock[e3.name] = sha(e3.data);
28826
29135
  updated.push(e3.name);
28827
29136
  } else {
@@ -28829,13 +29138,13 @@ async function blocksCommand(root, ctx, name, opts = {}) {
28829
29138
  }
28830
29139
  continue;
28831
29140
  }
28832
- mkdirSync8(dirname5(target), { recursive: true });
28833
- writeFileSync13(target, e3.data);
29141
+ mkdirSync12(dirname6(target), { recursive: true });
29142
+ writeFileSync16(target, e3.data);
28834
29143
  lock[e3.name] = sha(e3.data);
28835
29144
  written.push(e3.name);
28836
29145
  }
28837
- mkdirSync8(dirname5(lockPath(base, block.key)), { recursive: true });
28838
- writeFileSync13(lockPath(base, block.key), `${JSON.stringify(lock, null, 2)}
29146
+ mkdirSync12(dirname6(lockPath(base, block.key)), { recursive: true });
29147
+ writeFileSync16(lockPath(base, block.key), `${JSON.stringify(lock, null, 2)}
28839
29148
  `);
28840
29149
  out(`Added the ${block.key} block: ${written.length} files.`);
28841
29150
  written.forEach((f) => out(` + ${f}`));
@@ -28895,11 +29204,11 @@ async function integrationsCommand(ctx, name, opts = {}) {
28895
29204
  }
28896
29205
 
28897
29206
  // src/commands/brand.ts
28898
- import { spawn as spawn4 } from "child_process";
28899
- import { copyFileSync, existsSync as existsSync17, mkdirSync as mkdirSync9, mkdtempSync as mkdtempSync2, readdirSync as readdirSync6, readFileSync as readFileSync13, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync14 } from "fs";
29207
+ import { spawn as spawn5 } from "child_process";
29208
+ 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
29209
  import { createServer } from "http";
28901
29210
  import { tmpdir as tmpdir2 } from "os";
28902
- import { basename as basename2, dirname as dirname6, extname, join as join18, relative as relative4, sep as sep4 } from "path";
29211
+ import { basename as basename2, dirname as dirname7, extname as extname2, join as join22, relative as relative5, sep as sep4 } from "path";
28903
29212
  import { randomBytes } from "crypto";
28904
29213
 
28905
29214
  // src/commands/brand-page.ts
@@ -28988,61 +29297,61 @@ var BRAND_DIR = ".deployai/brand";
28988
29297
  var IMAGE_EXT = /\.(png|jpe?g|gif|webp|avif)$/i;
28989
29298
  var MAX_UPLOAD = 25 * 1024 * 1024;
28990
29299
  var WALK_CAP = 4e3;
28991
- var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", "dist", "build", "out", ".astro", ".output", ".svelte-kit", ".wrangler", ".deployai"]);
29300
+ var SKIP_DIRS3 = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", "dist", "build", "out", ".astro", ".output", ".svelte-kit", ".wrangler", ".deployai"]);
28992
29301
  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
29302
  function webRoot(root) {
28994
- for (const d of ["public", "static"]) if (existsSync17(join18(root, d))) return join18(root, d);
29303
+ for (const d of ["public", "static"]) if (existsSync19(join22(root, d))) return join22(root, d);
28995
29304
  return root;
28996
29305
  }
28997
29306
  function walk(dir, found = []) {
28998
29307
  let names;
28999
29308
  try {
29000
- names = readdirSync6(dir);
29309
+ names = readdirSync7(dir);
29001
29310
  } catch {
29002
29311
  return found;
29003
29312
  }
29004
29313
  for (const n2 of names) {
29005
29314
  if (found.length >= WALK_CAP) break;
29006
- const p = join18(dir, n2);
29315
+ const p = join22(dir, n2);
29007
29316
  let isDir = false;
29008
29317
  try {
29009
- isDir = statSync3(p).isDirectory();
29318
+ isDir = statSync4(p).isDirectory();
29010
29319
  } catch {
29011
29320
  continue;
29012
29321
  }
29013
29322
  if (isDir) {
29014
- if (!SKIP_DIRS2.has(n2)) walk(p, found);
29323
+ if (!SKIP_DIRS3.has(n2)) walk(p, found);
29015
29324
  } else found.push(p);
29016
29325
  }
29017
29326
  return found;
29018
29327
  }
29019
29328
  function existingFavicon(root) {
29020
29329
  const web = webRoot(root);
29021
- for (const f of ["favicon.ico", "favicon.svg", "favicon.png", "icon.svg", "icon.png"]) if (existsSync17(join18(web, f))) return relative4(root, join18(web, f)).split(sep4).join("/");
29022
- for (const d of ["app", "src/app"]) for (const f of ["favicon.ico", "icon.svg", "icon.png", "icon.tsx", "icon.jpg"]) if (existsSync17(join18(root, d, f))) return `${d}/${f}`;
29330
+ 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("/");
29331
+ 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
29332
  for (const f of walk(root).filter((p) => /\.(html|astro|tsx|jsx|vue|svelte)$/.test(p)).slice(0, 400)) {
29024
29333
  try {
29025
- const m = readFileSync13(f, "utf8").match(/<link\b[^>]*\brel=["'](?:shortcut )?icon["'][^>]*>/i);
29334
+ const m = readFileSync14(f, "utf8").match(/<link\b[^>]*\brel=["'](?:shortcut )?icon["'][^>]*>/i);
29026
29335
  if (!m) continue;
29027
29336
  const href = m[0].match(/\shref=["']([^"']+)/i)?.[1] ?? "";
29028
- if (href.startsWith("data:") || /^https?:/.test(href) || existsSync17(join18(web, href.split("?")[0]))) return relative4(root, f).split(sep4).join("/");
29337
+ if (href.startsWith("data:") || /^https?:/.test(href) || existsSync19(join22(web, href.split("?")[0]))) return relative5(root, f).split(sep4).join("/");
29029
29338
  } catch {
29030
29339
  }
29031
29340
  }
29032
29341
  return null;
29033
29342
  }
29034
29343
  function scannedIcons(root) {
29035
- const base = join18(root, MIGRATION_DIR);
29036
- if (!existsSync17(base)) return [];
29344
+ const base = join22(root, MIGRATION_DIR);
29345
+ if (!existsSync19(base)) return [];
29037
29346
  const found = [];
29038
- for (const host of readdirSync6(base)) {
29039
- const dir = join18(base, host, "icons");
29347
+ for (const host of readdirSync7(base)) {
29348
+ const dir = join22(base, host, "icons");
29040
29349
  try {
29041
- const list = JSON.parse(readFileSync13(join18(dir, "icons.json"), "utf8"));
29350
+ const list = readJson(join22(dir, "icons.json"));
29042
29351
  for (const i of list) {
29043
- const path = join18(dir, i.file);
29044
- if (!existsSync17(path)) continue;
29045
- const size = imageSize(readFileSync13(path));
29352
+ const path = join22(dir, i.file);
29353
+ if (!existsSync19(path)) continue;
29354
+ const size = imageSize(readFileSync14(path));
29046
29355
  found.push({ path, kind: i.kind, big: !size || size.width >= 64 });
29047
29356
  }
29048
29357
  } catch {
@@ -29054,8 +29363,8 @@ function findSource(root) {
29054
29363
  const icons = scannedIcons(root);
29055
29364
  const sharp = icons.find((i) => i.kind === "icon" && i.big);
29056
29365
  if (sharp) return { path: sharp.path, from: "old-icon" };
29057
- const dirs = ["public", "static", "src/assets", "assets", "images", "img"].map((d) => join18(root, d));
29058
- const logos = dirs.flatMap((d) => walk(d)).filter((p) => looksLikeLogo(relative4(root, p).split(sep4).join("/")));
29366
+ const dirs = ["public", "static", "src/assets", "assets", "images", "img"].map((d) => join22(root, d));
29367
+ const logos = dirs.flatMap((d) => walk(d)).filter((p) => looksLikeLogo(relative5(root, p).split(sep4).join("/")));
29059
29368
  const logo = logos.find((p) => /\.svg$/i.test(p)) ?? logos[0];
29060
29369
  if (logo) return { path: logo, from: "logo" };
29061
29370
  const oldLogo = icons.find((i) => i.kind === "logo");
@@ -29066,25 +29375,25 @@ function findSource(root) {
29066
29375
  }
29067
29376
  var CODE_EXT2 = /\.(css|scss|sass|less|html|astro|vue|svelte)$/i;
29068
29377
  var READ_CAP = 300;
29069
- function readText(path) {
29378
+ function readText2(path) {
29070
29379
  try {
29071
- return readFileSync13(path, "utf8");
29380
+ return readFileSync14(path, "utf8");
29072
29381
  } catch {
29073
29382
  return "";
29074
29383
  }
29075
29384
  }
29076
29385
  function scanDirs(root) {
29077
- const base = join18(root, MIGRATION_DIR);
29386
+ const base = join22(root, MIGRATION_DIR);
29078
29387
  try {
29079
- return readdirSync6(base).map((h) => join18(base, h)).filter((d) => existsSync17(join18(d, "home.html")));
29388
+ return readdirSync7(base).map((h) => join22(base, h)).filter((d) => existsSync19(join22(d, "home.html")));
29080
29389
  } catch {
29081
29390
  return [];
29082
29391
  }
29083
29392
  }
29084
29393
  function homePage(root) {
29085
- for (const d of scanDirs(root)) return readText(join18(d, "home.html"));
29394
+ for (const d of scanDirs(root)) return readText2(join22(d, "home.html"));
29086
29395
  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 = readText(join18(root, f));
29396
+ const text2 = readText2(join22(root, f));
29088
29397
  if (text2) return text2;
29089
29398
  }
29090
29399
  return "";
@@ -29095,30 +29404,30 @@ function siteFacts(root, given = {}) {
29095
29404
  const id = readSiteIdentity(home);
29096
29405
  let pkg;
29097
29406
  try {
29098
- pkg = JSON.parse(readFileSync13(join18(root, "package.json"), "utf8")).name;
29407
+ pkg = readJson(join22(root, "package.json")).name;
29099
29408
  } catch {
29100
29409
  }
29101
29410
  const name = given.name?.trim() || readProject(root)?.name || id.name || (pkg && !pkg.startsWith("@") ? pkg : "") || basename2(root);
29102
29411
  if (given.color) return { name, line: given.line ?? id.line ?? "", color: given.color, colorFrom: "given" };
29103
- const old = scanDirs(root).flatMap((d) => walkAll(join18(d, "styles")).map((f) => ({ text: readText(f) })));
29412
+ const old = scanDirs(root).flatMap((d) => walkAll(join22(d, "styles")).map((f) => ({ text: readText2(f) })));
29104
29413
  const fromOld = scanDirs(root).length ? pickBrandColor([{ text: home, themeColor: id.themeColor }, ...old]) : null;
29105
29414
  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: readText(join18(root, f)) });
29107
- const code = ["src", "app", "styles", "css", "public", "static"].flatMap((d) => walk(join18(root, d))).filter((p) => CODE_EXT2.test(p));
29108
- const plain2 = readdirSync6(root).filter((f) => CODE_EXT2.test(f)).map((f) => join18(root, f));
29109
- for (const f of [...plain2, ...code].slice(0, READ_CAP)) sources.push({ text: readText(f) });
29415
+ for (const f of ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs", "tailwind.config.cjs"]) sources.push({ text: readText2(join22(root, f)) });
29416
+ const code = ["src", "app", "styles", "css", "public", "static"].flatMap((d) => walk(join22(root, d))).filter((p) => CODE_EXT2.test(p));
29417
+ const plain2 = readdirSync7(root).filter((f) => CODE_EXT2.test(f)).map((f) => join22(root, f));
29418
+ for (const f of [...plain2, ...code].slice(0, READ_CAP)) sources.push({ text: readText2(f) });
29110
29419
  const color = fromOld ?? pickBrandColor(sources);
29111
29420
  return { name, line: given.line ?? id.line ?? "", color: color ?? BRAND_DEFAULT_COLOR, colorFrom: color ? "site" : "default" };
29112
29421
  }
29113
29422
  function writeSiteFile(root, file2, data) {
29114
- const target = join18(webRoot(root), file2);
29115
- if (existsSync17(target)) {
29116
- const keep = join18(root, BRAND_DIR, "originals");
29117
- mkdirSync9(keep, { recursive: true });
29118
- copyFileSync(target, join18(keep, file2));
29423
+ const target = join22(webRoot(root), file2);
29424
+ if (existsSync19(target)) {
29425
+ const keep = join22(root, BRAND_DIR, "originals");
29426
+ mkdirSync13(keep, { recursive: true });
29427
+ copyFileSync(target, join22(keep, file2));
29119
29428
  }
29120
- mkdirSync9(dirname6(target), { recursive: true });
29121
- writeFileSync14(target, data);
29429
+ mkdirSync13(dirname7(target), { recursive: true });
29430
+ writeFileSync17(target, data);
29122
29431
  }
29123
29432
  var send = (res, status, body = "", type = "text/plain; charset=utf-8") => {
29124
29433
  res.writeHead(status, { "content-type": type, "cache-control": "no-store", "x-content-type-options": "nosniff" });
@@ -29153,8 +29462,8 @@ function allowed(req, url2, port, token) {
29153
29462
  return req.headers.host === `127.0.0.1:${port}` && url2.searchParams.get("t") === token;
29154
29463
  }
29155
29464
  async function headless(browser, url2, width, until, timeoutMs) {
29156
- const profile = mkdtempSync2(join18(tmpdir2(), "deployai-brand-"));
29157
- const child = spawn4(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 });
29465
+ const profile = mkdtempSync2(join22(tmpdir2(), "deployai-brand-"));
29466
+ 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
29467
  child.on("error", () => {
29159
29468
  });
29160
29469
  let timer;
@@ -29167,7 +29476,7 @@ async function headless(browser, url2, width, until, timeoutMs) {
29167
29476
  await new Promise((done) => {
29168
29477
  if (child.exitCode !== null || child.pid === void 0) return done();
29169
29478
  child.once("exit", () => done());
29170
- if (process.platform === "win32") spawn4("taskkill", ["/PID", String(child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true }).on("error", () => {
29479
+ if (process.platform === "win32") spawn5("taskkill", ["/PID", String(child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true }).on("error", () => {
29171
29480
  });
29172
29481
  else child.kill();
29173
29482
  setTimeout(done, 3e3);
@@ -29253,10 +29562,10 @@ async function drawInBrowser(o, browser) {
29253
29562
  }
29254
29563
  }
29255
29564
  function sourceBytes(path) {
29256
- return { bytes: readFileSync13(path), type: TYPES[extname(path).toLowerCase()] ?? "application/octet-stream" };
29565
+ return { bytes: readFileSync14(path), type: TYPES[extname2(path).toLowerCase()] ?? "application/octet-stream" };
29257
29566
  }
29258
29567
  function report(root, r) {
29259
- const where = relative4(root, webRoot(root)).split(sep4).join("/") || "the site root";
29568
+ const where = relative5(root, webRoot(root)).split(sep4).join("/") || "the site root";
29260
29569
  out(`Written in ${where}: ${r.written.join(", ")}`);
29261
29570
  if (r.skipped.length) out(`Left out, the picture is too small to stay sharp: ${r.skipped.join(", ")}. A larger logo makes them.`);
29262
29571
  const tags2 = brandHeadTags(r.written);
@@ -29268,10 +29577,10 @@ function report(root, r) {
29268
29577
  }
29269
29578
  function plainIcon(root, source, name, color) {
29270
29579
  if (source.path) {
29271
- const ext = extname(source.path).toLowerCase();
29580
+ const ext = extname2(source.path).toLowerCase();
29272
29581
  if (ext === ".ico" || ext === ".svg" || ext === ".png") {
29273
29582
  const file2 = `favicon${ext}`;
29274
- writeSiteFile(root, file2, readFileSync13(source.path));
29583
+ writeSiteFile(root, file2, readFileSync14(source.path));
29275
29584
  return [file2];
29276
29585
  }
29277
29586
  }
@@ -29289,7 +29598,7 @@ function printStatus2(root, files) {
29289
29598
  const web = webRoot(root);
29290
29599
  const icon = existingFavicon(root);
29291
29600
  out(icon ? `Icon: ${icon}` : "Icon: missing. Run: npx deployai@latest brand favicon");
29292
- const missing = files.filter((f) => f !== "favicon.svg" && !existsSync17(join18(web, f)));
29601
+ const missing = files.filter((f) => f !== "favicon.svg" && !existsSync19(join22(web, f)));
29293
29602
  if (files.length) out(missing.length ? `Missing from the full set: ${missing.join(", ")}` : "The full set is there.");
29294
29603
  }
29295
29604
  function printFacts(f, picture2) {
@@ -29303,12 +29612,12 @@ function picture(source, facts) {
29303
29612
  }
29304
29613
  function withLogoColor(facts, source) {
29305
29614
  if (facts.colorFrom === "given" || !source.path || !/\.svg$/i.test(source.path)) return facts;
29306
- const color = svgLogoColor(readText(source.path));
29615
+ const color = svgLogoColor(readText2(source.path));
29307
29616
  return color ? { ...facts, color, colorFrom: "site" } : facts;
29308
29617
  }
29309
29618
  function pickSource(root, from) {
29310
29619
  const source = from ? { path: from, from: "file" } : findSource(root);
29311
- if (source.path && !existsSync17(source.path)) throw new CliError(`No such file: ${source.path}`, 1, "usage");
29620
+ if (source.path && !existsSync19(source.path)) throw new CliError(`No such file: ${source.path}`, 1, "usage");
29312
29621
  return source;
29313
29622
  }
29314
29623
  async function brandFaviconCommand(root, opts) {
@@ -29336,7 +29645,7 @@ async function brandFaviconCommand(root, opts) {
29336
29645
  }
29337
29646
  function iconsToDraw(root, force) {
29338
29647
  const icon = force ? null : existingFavicon(root);
29339
- const keepOg = !force && existsSync17(join18(webRoot(root), "og-image.png"));
29648
+ const keepOg = !force && existsSync19(join22(webRoot(root), "og-image.png"));
29340
29649
  return {
29341
29650
  targets: BRAND_TARGETS.filter((t) => !(keepOg && t.file === "og-image.png") && !(icon && t.icoOnly)),
29342
29651
  keepIcon: Boolean(icon),
@@ -29392,7 +29701,7 @@ async function measurePage(browser, address, width, scripts) {
29392
29701
  }
29393
29702
  }
29394
29703
  function imageFiles(root) {
29395
- const dirs = [webRoot(root) === root ? null : webRoot(root), join18(root, "src"), join18(root, MIGRATION_DIR)].filter((d) => !!d);
29704
+ const dirs = [webRoot(root) === root ? null : webRoot(root), join22(root, "src"), join22(root, MIGRATION_DIR)].filter((d) => !!d);
29396
29705
  const files = dirs.flatMap((d) => walkAll(d));
29397
29706
  if (webRoot(root) === root) files.push(...walk(root));
29398
29707
  return [...new Set(files)].filter((p) => IMAGE_EXT.test(p) && !p.split(sep4).includes("icons") && !BRAND_FILES.includes(basename2(p)));
@@ -29402,16 +29711,16 @@ function walkAll(dir) {
29402
29711
  const go = (d) => {
29403
29712
  let names = [];
29404
29713
  try {
29405
- names = readdirSync6(d);
29714
+ names = readdirSync7(d);
29406
29715
  } catch {
29407
29716
  return;
29408
29717
  }
29409
29718
  for (const n2 of names) {
29410
29719
  if (found.length >= WALK_CAP) return;
29411
- const p = join18(d, n2);
29720
+ const p = join22(d, n2);
29412
29721
  try {
29413
- if (statSync3(p).isDirectory()) {
29414
- if (!SKIP_DIRS2.has(n2) || n2 === ".deployai") go(p);
29722
+ if (statSync4(p).isDirectory()) {
29723
+ if (!SKIP_DIRS3.has(n2) || n2 === ".deployai") go(p);
29415
29724
  } else found.push(p);
29416
29725
  } catch {
29417
29726
  }
@@ -29427,7 +29736,7 @@ function judgeFiles(root) {
29427
29736
  for (const f of files) {
29428
29737
  let bytes;
29429
29738
  try {
29430
- bytes = readFileSync13(f);
29739
+ bytes = readFileSync14(f);
29431
29740
  } catch {
29432
29741
  continue;
29433
29742
  }
@@ -29435,7 +29744,7 @@ function judgeFiles(root) {
29435
29744
  if (!size) continue;
29436
29745
  total++;
29437
29746
  const verdict = judgeImage({ width: size.width, height: size.height, bytes: bytes.length, format: size.format });
29438
- if (verdict !== "ok") findings.push({ where: relative4(root, f).split(sep4).join("/"), width: size.width, height: size.height, verdict });
29747
+ if (verdict !== "ok") findings.push({ where: relative5(root, f).split(sep4).join("/"), width: size.width, height: size.height, verdict });
29439
29748
  }
29440
29749
  return { findings, total };
29441
29750
  }
@@ -29477,10 +29786,10 @@ async function brandImagesCommand(root, urls, opts) {
29477
29786
  if (verdict !== "ok") onPages.push({ where: m.src, width: m.width, height: m.height, shownWidth: m.shownWidth, verdict, alt: m.alt });
29478
29787
  }
29479
29788
  const weak = [...onPages, ...findings];
29480
- mkdirSync9(join18(root, BRAND_DIR), { recursive: true });
29789
+ mkdirSync13(join22(root, BRAND_DIR), { recursive: true });
29481
29790
  const file2 = `${BRAND_DIR}/images.json`;
29482
29791
  const data = { measuredAt: (/* @__PURE__ */ new Date()).toISOString(), pages: urls, unmeasured, filesChecked: total, imagesMeasured: shown.size, weak };
29483
- writeFileSync14(join18(root, file2), `${JSON.stringify(data, null, 2)}
29792
+ writeFileSync17(join22(root, file2), `${JSON.stringify(data, null, 2)}
29484
29793
  `);
29485
29794
  if (opts.json) {
29486
29795
  out(JSON.stringify(data));
@@ -29543,7 +29852,7 @@ function buildProgram() {
29543
29852
  if (lang === "he" || lang === "en") process.env.DEPLOYAI_LANG = lang;
29544
29853
  }).showHelpAfterError();
29545
29854
  const g = (cmd) => cmd.optsWithGlobals();
29546
- const root = (cmd) => resolve6(g(cmd).dir ?? process.cwd());
29855
+ const root = (cmd) => resolve8(g(cmd).dir ?? process.cwd());
29547
29856
  const ctx = (cmd) => apiContext(g(cmd).api);
29548
29857
  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
29858
  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 +29869,12 @@ function buildProgram() {
29560
29869
  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
29870
  ${AGENT_FEEDBACK_RULES.join("\n\n")}
29562
29871
  `).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 antigravity (Claude Code is found by itself)").action((tool) => allowCommand(tool));
29872
+ 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
29873
  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
29874
  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
29875
  (project, opts, cmd) => linkCommand(root(cmd), ctx(cmd), project, opts)
29567
29876
  );
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));
29877
+ 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
29878
  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
29879
  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
29880
  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 +29917,12 @@ ${AGENT_FEEDBACK_RULES.join("\n\n")}
29608
29917
  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
29918
  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
29919
  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));
29920
+ 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) => {
29921
+ await shotCommand(root(cmd), url2, opts);
29922
+ });
29923
+ 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) => {
29924
+ await imagesCommand(root(cmd), folder);
29925
+ });
29611
29926
  const env = program.command("env").description("the site's environment variables: secrets by default, never shown again");
29612
29927
  env.command("list").description("list the keys, with a hint of each value").action((_opts, cmd) => envListCommand(root(cmd), ctx(cmd)));
29613
29928
  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));
@@ -29686,9 +30001,9 @@ async function main(argv = process.argv) {
29686
30001
  }
29687
30002
 
29688
30003
  // src/update.ts
29689
- import { spawnSync as spawnSync4 } from "child_process";
29690
- import { existsSync as existsSync18, mkdirSync as mkdirSync10, readdirSync as readdirSync7, readFileSync as readFileSync14, rmSync as rmSync5, writeFileSync as writeFileSync15 } from "fs";
29691
- import { join as join19 } from "path";
30004
+ import { spawnSync as spawnSync5 } from "child_process";
30005
+ import { existsSync as existsSync20, mkdirSync as mkdirSync14, readdirSync as readdirSync8, readFileSync as readFileSync15, rmSync as rmSync5, writeFileSync as writeFileSync18 } from "fs";
30006
+ import { join as join23 } from "path";
29692
30007
  var CHECK_EVERY_MS = 60 * 60 * 1e3;
29693
30008
  var ASK_NPM_MS = 1500;
29694
30009
  var GET_VERSION_MS = 12e4;
@@ -29726,11 +30041,11 @@ function updateAllowed(env, args) {
29726
30041
  return resolveApiUrl(void 0, loadConfig()) === API_BASE_DEFAULT.replace(/\/+$/, "");
29727
30042
  }
29728
30043
  function statePath() {
29729
- return join19(configDir(), "update-check.json");
30044
+ return join23(configDir(), "update-check.json");
29730
30045
  }
29731
30046
  function readState() {
29732
30047
  try {
29733
- const data = JSON.parse(readFileSync14(statePath(), "utf8"));
30048
+ const data = JSON.parse(readFileSync15(statePath(), "utf8"));
29734
30049
  return data && typeof data === "object" ? data : {};
29735
30050
  } catch {
29736
30051
  return {};
@@ -29738,8 +30053,8 @@ function readState() {
29738
30053
  }
29739
30054
  function writeState(state) {
29740
30055
  try {
29741
- mkdirSync10(configDir(), { recursive: true });
29742
- writeFileSync15(statePath(), JSON.stringify(state) + "\n");
30056
+ mkdirSync14(configDir(), { recursive: true });
30057
+ writeFileSync18(statePath(), JSON.stringify(state) + "\n");
29743
30058
  } catch {
29744
30059
  }
29745
30060
  }
@@ -29755,24 +30070,24 @@ async function askNpmLatest(env) {
29755
30070
  }
29756
30071
  }
29757
30072
  function versionEntry(version2) {
29758
- return join19(configDir(), "cli", version2, "node_modules", "deployai", "dist", "index.js");
30073
+ return join23(configDir(), "cli", version2, "node_modules", "deployai", "dist", "index.js");
29759
30074
  }
29760
30075
  function getVersion(version2, env) {
29761
30076
  process.stderr.write(`Getting the newest DeployAI CLI, version ${version2}.
29762
30077
  `);
29763
- const root = join19(configDir(), "cli");
29764
- const dir = join19(root, version2);
29765
- mkdirSync10(dir, { recursive: true });
29766
- writeFileSync15(join19(dir, "package.json"), '{"private":true}\n');
29767
- const installed = spawnSync4(`npm install deployai@${version2} --ignore-scripts --no-audit --no-fund --silent`, { cwd: dir, env, shell: true, stdio: "ignore", windowsHide: true, timeout: GET_VERSION_MS });
30078
+ const root = join23(configDir(), "cli");
30079
+ const dir = join23(root, version2);
30080
+ mkdirSync14(dir, { recursive: true });
30081
+ writeFileSync18(join23(dir, "package.json"), '{"private":true}\n');
30082
+ 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
30083
  if (installed.status !== 0) return false;
29769
- const ran = spawnSync4(process.execPath, [versionEntry(version2), "--version"], { env: { ...env, DEPLOYAI_NO_UPDATE: "1" }, encoding: "utf8", timeout: GET_VERSION_MS });
30084
+ const ran = spawnSync5(process.execPath, [versionEntry(version2), "--version"], { env: { ...env, DEPLOYAI_NO_UPDATE: "1" }, encoding: "utf8", timeout: GET_VERSION_MS });
29770
30085
  if (ran.status !== 0 || ran.stdout.trim() !== version2) return false;
29771
- for (const old of readdirSync7(root)) if (old !== version2) rmSync5(join19(root, old), { recursive: true, force: true });
30086
+ for (const old of readdirSync8(root)) if (old !== version2) rmSync5(join23(root, old), { recursive: true, force: true });
29772
30087
  return true;
29773
30088
  }
29774
30089
  function runVersion(version2, args, env = process.env) {
29775
- const r = spawnSync4(process.execPath, [versionEntry(version2), ...args], { stdio: "inherit", env: { ...env, DEPLOYAI_NO_UPDATE: "1" } });
30090
+ const r = spawnSync5(process.execPath, [versionEntry(version2), ...args], { stdio: "inherit", env: { ...env, DEPLOYAI_NO_UPDATE: "1" } });
29776
30091
  if (r.error) return null;
29777
30092
  return r.status ?? 1;
29778
30093
  }
@@ -29787,7 +30102,7 @@ async function versionToRun(current, args, env = process.env, deps = {}) {
29787
30102
  }
29788
30103
  const latest = state.latest;
29789
30104
  if (!latest || !PLAIN_VERSION.test(latest) || compareVersions(latest, current) <= 0) return null;
29790
- if (state.ready === latest && existsSync18(versionEntry(latest))) return latest;
30105
+ if (state.ready === latest && existsSync20(versionEntry(latest))) return latest;
29791
30106
  if (now - (state.triedAt ?? 0) < CHECK_EVERY_MS) return null;
29792
30107
  state.triedAt = now;
29793
30108
  if (get2(latest, env)) state.ready = latest;