deployai 0.1.0-beta.49 → 0.1.0-beta.50

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 +2 -1
  2. package/dist/index.js +531 -305
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,12 +6,38 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // src/cli.ts
9
- import { existsSync as existsSync22 } from "fs";
10
- import { join as join25, resolve as resolve10 } from "path";
9
+ import { existsSync as existsSync23 } from "fs";
10
+ import { join as join26, resolve as resolve11 } from "path";
11
11
  import { Command, CommanderError } from "commander";
12
12
 
13
13
  // ../shared/src/plans.ts
14
14
  var VAT_RATE = 0.18;
15
+ var ADDON_WAVES = [
16
+ [["redesign", "code-quality"]],
17
+ [["dashboard", "legal", "sso"], ["ux", "responsive", "graphics"]],
18
+ [["language"]],
19
+ [["security"], ["accessibility"], ["exposure"], ["performance"]]
20
+ ];
21
+ var addonWave = (key2) => {
22
+ const i = ADDON_WAVES.findIndex((w) => w.some((lane) => lane.includes(key2)));
23
+ return i < 0 ? ADDON_WAVES.length - 1 : i;
24
+ };
25
+ function nextAddonWave(keys) {
26
+ if (!keys.length) return null;
27
+ const wave = Math.min(...keys.map(addonWave));
28
+ const inWave = keys.filter((k) => addonWave(k) === wave);
29
+ const laneOf2 = (k) => {
30
+ const i = (ADDON_WAVES[wave] ?? []).findIndex((lane) => lane.includes(k));
31
+ return i < 0 ? `own:${k}` : String(i);
32
+ };
33
+ const lanes = [];
34
+ for (const k of inWave) {
35
+ const lane = lanes.find((l) => laneOf2(l.keys[0]) === laneOf2(k));
36
+ if (lane) lane.keys.push(k);
37
+ else lanes.push({ name: k, keys: [k] });
38
+ }
39
+ return { wave, lanes };
40
+ }
15
41
 
16
42
  // ../shared/src/blockers.ts
17
43
  var ISSUES = [
@@ -791,12 +817,12 @@ function bindingsOf(list) {
791
817
  if (!Array.isArray(list)) return [];
792
818
  return list.map((x) => x && typeof x === "object" && typeof x.binding === "string" ? { binding: x.binding } : null).filter((x) => x !== null);
793
819
  }
794
- function parseWranglerConfig(fileName, text2) {
820
+ function parseWranglerConfig(fileName, text3) {
795
821
  const empty = { d1: [], r2: [], vars: [], main: null, assetsDir: null, compatibilityDate: null, compatibilityFlags: [], durableObjects: [], crons: [], queues: { producers: [], consumers: [] } };
796
- if (/\.toml$/.test(fileName)) return parseWranglerToml(text2);
822
+ if (/\.toml$/.test(fileName)) return parseWranglerToml(text3);
797
823
  let j;
798
824
  try {
799
- j = JSON.parse(jsoncToJson(text2));
825
+ j = JSON.parse(jsoncToJson(text3));
800
826
  } catch {
801
827
  return empty;
802
828
  }
@@ -820,11 +846,11 @@ function tomlString(v) {
820
846
  const m = /^\s*(?:"((?:[^"\\]|\\.)*)"|'([^']*)')/.exec(v);
821
847
  return m ? m[1] ?? m[2] ?? "" : null;
822
848
  }
823
- function parseWranglerToml(text2) {
849
+ function parseWranglerToml(text3) {
824
850
  const decl = { d1: [], r2: [], vars: [], main: null, assetsDir: null, compatibilityDate: null, compatibilityFlags: [], durableObjects: [], crons: [], queues: { producers: [], consumers: [] } };
825
851
  let section = "";
826
852
  let cronLines = false;
827
- for (const rawLine of text2.split(/\r?\n/)) {
853
+ for (const rawLine of text3.split(/\r?\n/)) {
828
854
  const line = rawLine.replace(/\s+#.*$/, "").replace(/^#.*$/, "").trim();
829
855
  if (!line) continue;
830
856
  if (cronLines) {
@@ -6516,7 +6542,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
6516
6542
  var NONE = 0;
6517
6543
  var ASSUMED = 1;
6518
6544
  var PROVEN = 2;
6519
- function isRecursive(inst, stack, resolve11) {
6545
+ function isRecursive(inst, stack, resolve12) {
6520
6546
  const cached2 = recursive.get(inst);
6521
6547
  if (cached2 !== void 0)
6522
6548
  return cached2 ? PROVEN : NONE;
@@ -6526,7 +6552,7 @@ function isRecursive(inst, stack, resolve11) {
6526
6552
  let result = NONE;
6527
6553
  const check2 = (child) => {
6528
6554
  if (result !== PROVEN && child?._zod) {
6529
- const answer = isRecursive(child, stack, resolve11);
6555
+ const answer = isRecursive(child, stack, resolve12);
6530
6556
  if (answer > result)
6531
6557
  result = answer;
6532
6558
  }
@@ -6537,7 +6563,7 @@ function isRecursive(inst, stack, resolve11) {
6537
6563
  const desc = Object.getOwnPropertyDescriptor(sh, key2);
6538
6564
  if (spread && !desc.enumerable)
6539
6565
  continue;
6540
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve11) : NONE;
6566
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve12) : NONE;
6541
6567
  if (child > answer)
6542
6568
  answer = child;
6543
6569
  }
@@ -6601,7 +6627,7 @@ function isRecursive(inst, stack, resolve11) {
6601
6627
  break;
6602
6628
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
6603
6629
  case "lazy": {
6604
- const inner = def._cachedInner ?? (resolve11 ? inst._zod.innerType : void 0);
6630
+ const inner = def._cachedInner ?? (resolve12 ? inst._zod.innerType : void 0);
6605
6631
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
6606
6632
  break;
6607
6633
  }
@@ -10799,8 +10825,8 @@ function ko_default() {
10799
10825
  }
10800
10826
 
10801
10827
  // ../../node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/locales/lt.js
10802
- var capitalizeFirstCharacter = (text2) => {
10803
- return text2.charAt(0).toUpperCase() + text2.slice(1);
10828
+ var capitalizeFirstCharacter = (text3) => {
10829
+ return text3.charAt(0).toUpperCase() + text3.slice(1);
10804
10830
  };
10805
10831
  function getUnitTypeFromNumber(number4) {
10806
10832
  const abs = Math.abs(number4);
@@ -21180,21 +21206,21 @@ var SECRET_PATTERNS = [
21180
21206
  ];
21181
21207
  var SECRET_PLACEHOLDER = /^(?:password|passwd|pass|pwd|secret|changeme|example|x+|\*+|<[^>]*>|\[[^\]]*\])$|\$\{|\$[A-Z_]/i;
21182
21208
  var SECRET_SCAN_MAX_BYTES = 1024 * 1024;
21183
- function lineAt(text2, index) {
21209
+ function lineAt(text3, index) {
21184
21210
  let line = 1;
21185
- for (let i = 0; i < index && i < text2.length; i++) if (text2.charCodeAt(i) === 10) line++;
21211
+ for (let i = 0; i < index && i < text3.length; i++) if (text3.charCodeAt(i) === 10) line++;
21186
21212
  return line;
21187
21213
  }
21188
- function findSecretLine(text2, re) {
21214
+ function findSecretLine(text3, re) {
21189
21215
  if (!re.global) {
21190
- const m2 = re.exec(text2);
21191
- return m2 ? lineAt(text2, m2.index) : null;
21216
+ const m2 = re.exec(text3);
21217
+ return m2 ? lineAt(text3, m2.index) : null;
21192
21218
  }
21193
21219
  re.lastIndex = 0;
21194
21220
  let m;
21195
- while (m = re.exec(text2)) {
21221
+ while (m = re.exec(text3)) {
21196
21222
  if (m[1] && SECRET_PLACEHOLDER.test(m[1])) continue;
21197
- return lineAt(text2, m.index);
21223
+ return lineAt(text3, m.index);
21198
21224
  }
21199
21225
  return null;
21200
21226
  }
@@ -21248,11 +21274,11 @@ var SCRUB_RULES = [
21248
21274
  [/\b(?=[A-Za-z0-9_-]*\d)(?=[A-Za-z0-9_-]*[A-Za-z])[A-Za-z0-9_-]{24,}\b/g, "[id]"],
21249
21275
  [/\+?\d[\d -]{7,}\d/g, "[number]"]
21250
21276
  ];
21251
- function secretKindIn(text2) {
21252
- return SECRET_PATTERNS.find((p) => findSecretLine(text2, p.re) !== null)?.kind ?? null;
21277
+ function secretKindIn(text3) {
21278
+ return SECRET_PATTERNS.find((p) => findSecretLine(text3, p.re) !== null)?.kind ?? null;
21253
21279
  }
21254
- function scrubText(text2, max) {
21255
- let out2 = text2;
21280
+ function scrubText(text3, max) {
21281
+ let out2 = text3;
21256
21282
  for (const { re } of SECRET_PATTERNS) out2 = out2.replace(new RegExp(re.source, re.flags.includes("g") ? re.flags : `${re.flags}g`), "[secret]");
21257
21283
  for (const [re, to] of SCRUB_RULES) out2 = out2.replace(re, to);
21258
21284
  out2 = out2.replace(FILE_NAME, (name) => SAFE_NAME.test(name) ? name : "[file]");
@@ -21848,8 +21874,8 @@ function tags(html, name) {
21848
21874
  while (m = re.exec(html)) out2.push({ attrs: parseAttrs(m[0]), index: m.index });
21849
21875
  return out2;
21850
21876
  }
21851
- function decode3(text2) {
21852
- return text2.replace(/&#(\d{1,7});/g, (m, n2) => Number(n2) > 0 && Number(n2) <= 1114111 ? String.fromCodePoint(Number(n2)) : m).replace(/&#x([0-9a-f]{1,6});/gi, (m, h) => parseInt(h, 16) > 0 && parseInt(h, 16) <= 1114111 ? String.fromCodePoint(parseInt(h, 16)) : m).replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;|&apos;/g, "'").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
21877
+ function decode3(text3) {
21878
+ return text3.replace(/&#(\d{1,7});/g, (m, n2) => Number(n2) > 0 && Number(n2) <= 1114111 ? String.fromCodePoint(Number(n2)) : m).replace(/&#x([0-9a-f]{1,6});/gi, (m, h) => parseInt(h, 16) > 0 && parseInt(h, 16) <= 1114111 ? String.fromCodePoint(parseInt(h, 16)) : m).replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;|&apos;/g, "'").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
21853
21879
  }
21854
21880
  function titleOfPage(html) {
21855
21881
  const m = /<title\b[^>]*>([\s\S]*?)<\/title>/i.exec(html);
@@ -22300,8 +22326,8 @@ function readSiteIdentity(html) {
22300
22326
  const description = metaContent2(html, "name", "description") ?? metaContent2(html, "property", "og:description");
22301
22327
  return { name: metaContent2(html, "property", "og:site_name") ?? fromTitle, line: description ? shareLine(description) : null, themeColor: metaContent2(html, "name", "theme-color") };
22302
22328
  }
22303
- function shareLine(text2, max = 70) {
22304
- const first = decode4(text2).split(/(?<=[.!?\u05c3])\s/)[0] ?? "";
22329
+ function shareLine(text3, max = 70) {
22330
+ const first = decode4(text3).split(/(?<=[.!?\u05c3])\s/)[0] ?? "";
22305
22331
  if (first.length <= max) return first.replace(/[.\s]+$/, "");
22306
22332
  const cut = first.slice(0, max);
22307
22333
  const pause = Math.max(cut.lastIndexOf(":"), cut.lastIndexOf(","), cut.lastIndexOf(";"));
@@ -22365,7 +22391,7 @@ function svgLogoColor(svg) {
22365
22391
  }
22366
22392
  return [...count.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0]?.[0] ?? null;
22367
22393
  }
22368
- var isSvgText = (text2) => /<svg[\s>]/i.test(text2);
22394
+ var isSvgText = (text3) => /<svg[\s>]/i.test(text3);
22369
22395
  function iconLinks(html) {
22370
22396
  const found = [];
22371
22397
  for (const m of html.matchAll(/<link\b[^>]*>/gi)) {
@@ -22410,8 +22436,8 @@ function vendorFiles(html) {
22410
22436
  }
22411
22437
  function builderCredits(html) {
22412
22438
  const found = /* @__PURE__ */ new Set();
22413
- const say = (text2) => {
22414
- const t = text2.replace(/\s+/g, " ").trim();
22439
+ const say = (text3) => {
22440
+ const t = text3.replace(/\s+/g, " ").trim();
22415
22441
  found.add(t.length > 80 ? `${t.slice(0, 77)}...` : t);
22416
22442
  };
22417
22443
  const footers = [...html.matchAll(/<footer\b[\s\S]*?<\/footer\s*>/gi)].map((m) => pageText(m[0])).join(" ");
@@ -22463,11 +22489,11 @@ function auditItems(audit) {
22463
22489
  }
22464
22490
  const url2 = typeof it?.url === "string" ? it.url : typeof it?.source?.url === "string" ? it.source.url : null;
22465
22491
  const label = clean2(it?.label ?? it?.groupLabel ?? it?.entity?.text ?? it?.entity, 160);
22466
- const text2 = url2 ?? label;
22467
- if (!text2) continue;
22492
+ const text3 = url2 ?? label;
22493
+ if (!text3) continue;
22468
22494
  const wastedMs = typeof it?.wastedMs === "number" ? Math.round(it.wastedMs) : void 0;
22469
22495
  const wastedBytes = typeof it?.wastedBytes === "number" ? Math.round(it.wastedBytes) : void 0;
22470
- out2.push({ text: clean2(text2, 300), wastedMs, wastedBytes });
22496
+ out2.push({ text: clean2(text3, 300), wastedMs, wastedBytes });
22471
22497
  }
22472
22498
  return out2;
22473
22499
  }
@@ -22576,12 +22602,12 @@ function readPageSeo(html, headers = {}) {
22576
22602
  spaShell: isSpaShell(html)
22577
22603
  };
22578
22604
  }
22579
- function parseRobots(text2) {
22605
+ function parseRobots(text3) {
22580
22606
  const groups = [];
22581
22607
  const sitemaps = [];
22582
22608
  let current = null;
22583
22609
  let lastWasAgent = false;
22584
- for (const raw of text2.split(/\r?\n/)) {
22610
+ for (const raw of text3.split(/\r?\n/)) {
22585
22611
  const line = raw.replace(/#.*$/, "").trim();
22586
22612
  const m = /^([A-Za-z-]+)\s*:\s*(.*)$/.exec(line);
22587
22613
  if (!m) continue;
@@ -22748,7 +22774,7 @@ var PROMOTE = { cmd: "npx deployai@latest promote v<N>", say: "Only when deploy
22748
22774
  var DEPLOY_SAY = "Add --live only if the owner chose to put it live right away. It waits for the build: with --live it ends with the live address, else with the preview address to send the owner. When it prints database changes, a yes to going live does not cover them (D-541): show the owner the changes and ask the question it prints, and only after a yes run the promote --approve-sql command it printed; changes it says remove data only the owner approves, never you. Write the -m message in a few words in the language of the owner, about what they see changed.";
22749
22775
  var BUILD = { say: "This folder had no site, so start wrote a starter page. Do not ask where the site comes from or which way to start: build a first version of the owner's site in its place now. Use what you know (the instructions above, .deployai/brief.md if it exists, the folder name) and choose the layout, colors and wording yourself. Besides the question about going live, ask at most one short question, and only if you cannot tell what the site is for. Leave out what you do not know (phone, prices, hours) instead of asking for it. The steps below show it to the owner as the first look: offer to add those details then. Run check only after you built it." };
22750
22776
  var OFFER_DASHBOARD = { cmd: "npx deployai@latest addon run dashboard", say: "Only after the site is live, and only if the owner says yes: in one sentence, offer the site's own free dashboard, to read form messages, hide and edit pages and manage a blog or a shop without an agent." };
22751
- var ADDONS_RUN = { cmd: "npx deployai@latest addons run", say: "With more than one add-on picked, it prints what you know about each and asks you to suggest the order for this site. Tell the owner your order and why, ask how to run them, run the command for their answer, work through each step it prints, and report each add-on as it says." };
22777
+ var ADDONS_RUN = { cmd: "npx deployai@latest addons run", say: "With more than one add-on picked, it prints what you know about each and asks you to decide the order for this site. Run the command it prints for your order, work through each step it prints, and report each add-on as it says. Nothing is asked between add-ons, and one publish comes at the end." };
22752
22778
  var TAGS_SEEN = { cmd: "npx deployai@latest migrate tags --requests <file>", say: "While you look at the old site, save the outside addresses your browser asks for to a file, one a line, and run this: Tag Manager loads tags that are not in the page. Never send a form on the old site. If the old site shows a security check (Cloudflare, a captcha) or blocks a command but opens in a browser (D-916): open it in your browser tool, tell the owner in one line that a check may show in that window and to pass it there, wait up to three minutes, and read the pages in that browser. Offer this first, as the recommended answer, when you ask the owner; turning the check off for the move or sending an export are the other answers." };
22753
22779
  var PLAN_SHOW = "Then show the owner the plan as one chat message, never as the file, a table or one long paragraph, since a long table breaks in a terminal: Moves as it is, with a count and at most three names. Changes, one short line for each Replaced with row. Needs you, one short line for each Needs me or Not possible row. End with the link it printed, for the full list. Do not use a plan mode: it changes the owner's setting.";
22754
22780
  var REPORT_SAY = "Once .deployai/migration/plan.md is written, with its features as one table (| Feature | Status | Note |) and a row for each tag and connection in tags.json: this adds it to the owner's move report and prints the link.";
@@ -22791,7 +22817,7 @@ var MIGRATE_STEPS = [
22791
22817
  PROMOTE,
22792
22818
  AFTER_LIVE
22793
22819
  ];
22794
- var MOVE_ADDONS = { cmd: "npx deployai@latest addons", say: 'The move is done, so offer the second part: the free add-ons. This lists the ones this site has; never offer the ones to buy here. If none is waiting, finish. The dashboard came with the move: do not offer it again. Else tell the owner in one short line what the waiting ones add, in plain words, and ask once: "Your site moved. Go on to the free add-ons?" with three answers. One by one (recommended): run npx deployai@latest addons run --one-by-one, and after each add-on the owner chooses whether to publish. All at once: run npx deployai@latest addons run --all, with one publish at the end. With more than one waiting, the command then asks you to suggest their order: do what it prints. Not now: finish here, and tell them the add-ons stay with this site, on its page in the dashboard, with no time limit. Never start an add-on without their answer.' };
22820
+ var MOVE_ADDONS = { cmd: "npx deployai@latest addons", say: 'The move is done, so offer the second part: the free add-ons. This lists the ones this site has; never offer the ones to buy here. If none is waiting, finish. The dashboard came with the move: do not offer it again. Else tell the owner in one short line what the waiting ones add, in plain words, and ask once: "Your site moved. Go on to the free add-ons?" with two answers. Run them now (recommended): run npx deployai@latest addons run, and do what it prints; they run one after another with no question between them, side by side when it prints how, and one publish comes at the end. Not now: finish here, and tell them the add-ons stay with this site, on its page in the dashboard, with no time limit. Never start an add-on without their answer.' };
22795
22821
  var managedStatus = (stage, note, say) => ({ cmd: `npx deployai@latest migrate status ${stage} "${note}"`, say });
22796
22822
  var stepWith = (part) => MIGRATE_STEPS.find((step) => step.cmd?.includes(part));
22797
22823
  var MANAGED_STEPS = [
@@ -22835,8 +22861,8 @@ function startSteps(kind, opts = {}) {
22835
22861
  }
22836
22862
  function withServerSteps(bundled, server) {
22837
22863
  if (!Array.isArray(server) || server.length !== bundled.length) return bundled;
22838
- const ok = server.every((s, i) => s && typeof s === "object" && typeof s.say === "string" && s.say.trim() && s.say.length < 8e3 && (s.cmd ?? void 0) === bundled[i].cmd);
22839
- return ok ? bundled.map((b, i) => ({ ...b, say: server[i].say })) : bundled;
22864
+ const ok2 = server.every((s, i) => s && typeof s === "object" && typeof s.say === "string" && s.say.trim() && s.say.length < 8e3 && (s.cmd ?? void 0) === bundled[i].cmd);
22865
+ return ok2 ? bundled.map((b, i) => ({ ...b, say: server[i].say })) : bundled;
22840
22866
  }
22841
22867
  var startStepsQuery = (kind, opts) => `kind=${kind}&o=${["emptyFolder", "starter", "managed", "signedIn", "addons"].filter((k) => opts[k]).join(",")}`;
22842
22868
  function stepsOf(kind, opts) {
@@ -22925,7 +22951,7 @@ var CLI_MAP_NODES = [
22925
22951
  n("api-logs", "server", "/api/cli/logs", "\u05D6\u05E8\u05DD \u05D0\u05D9\u05E8\u05D5\u05E2\u05D9\u05DD \u05DE\u05D4\u05BEtail \u05E9\u05DC \u05D4\u05BEdispatch Worker, \u05DE\u05E1\u05D5\u05E0\u05DF \u05DC\u05E1\u05E7\u05E8\u05D9\u05E4\u05D8 \u05E9\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D1\u05DC\u05D1\u05D3. \u05D1\u05DC\u05D9 \u05DB\u05D5\u05EA\u05E8\u05D5\u05EA \u05D5\u05D1\u05DC\u05D9 IP.", "An event stream from the dispatch Worker's tail, filtered to the site's own script. No headers and no IP."),
22926
22952
  n("api-requests", "server", "/api/cli/requests", "\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4 \u05D1\u05DC\u05D9 IP \u05D5\u05D1\u05DC\u05D9 \u05EA\u05D5\u05DB\u05DF, \u05D5\u05E4\u05EA\u05D9\u05D7\u05D4 \u05D0\u05D5 \u05E1\u05D2\u05D9\u05E8\u05D4 \u05E9\u05DC \u05DB\u05EA\u05D5\u05D1\u05EA.", "The list with no IP and no content, and opening or closing an address."),
22927
22953
  n("cmd-rollback", "cli", "rollback v<N>", "\u05D7\u05D5\u05D6\u05E8 \u05DC\u05D2\u05E8\u05E1\u05D4 \u05E7\u05D5\u05D3\u05DE\u05EA.", "Goes back to an earlier version."),
22928
- n("cmd-addons", "cli", "addons / addon next / addon buy", "\u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E9\u05DC \u05D4\u05D0\u05EA\u05E8, \u05D4\u05E9\u05DC\u05D1 \u05D4\u05D1\u05D0 \u05E9\u05DC \u05EA\u05D5\u05E1\u05E3 \u05E9\u05E0\u05E7\u05E0\u05D4, \u05D5\u05E7\u05D9\u05E9\u05D5\u05E8 \u05E7\u05E0\u05D9\u05D9\u05D4 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8.", "The site's add-ons, the next step of one it bought, and a buy link for the owner."),
22954
+ n("cmd-addons", "cli", "addons / addon next / addon buy", "\u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E9\u05DC \u05D4\u05D0\u05EA\u05E8, \u05D4\u05E8\u05E6\u05D4 \u05E9\u05DC \u05DB\u05D5\u05DC\u05DD \u05D1\u05DC\u05D9 \u05E2\u05E6\u05D9\u05E8\u05D5\u05EA (\u05D2\u05DD \u05D1\u05DE\u05E7\u05D1\u05D9\u05DC, \u05D1\u05D2\u05DC\u05D9\u05DD), \u05D4\u05E9\u05DC\u05D1 \u05D4\u05D1\u05D0 \u05E9\u05DC \u05EA\u05D5\u05E1\u05E3 \u05E9\u05E0\u05E7\u05E0\u05D4, \u05D5\u05E7\u05D9\u05E9\u05D5\u05E8 \u05E7\u05E0\u05D9\u05D9\u05D4 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8.", "The site's add-ons, a run of all of them with no stops (also side by side, in waves), the next step of one it bought, and a buy link for the owner."),
22929
22955
  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."),
22930
22956
  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."),
22931
22957
  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."),
@@ -22963,7 +22989,7 @@ var CLI_MAP_NODES = [
22963
22989
  n("text-details", "agent", "site.details / site.ask-details", "\u05E7\u05D5\u05E8\u05D0\u05D9\u05DD \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05DE .deployai/brief.md, \u05D0\u05D5 \u05E9\u05D5\u05D0\u05DC\u05D9\u05DD \u05D0\u05EA \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8.", "Read the details from .deployai/brief.md, or ask the owner."),
22964
22990
  n("text-update", "agent", "site.update", "\u05E2\u05D5\u05E9\u05D9\u05DD \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9 \u05E9\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D1\u05D9\u05E7\u05E9.", "Make the change the owner asked for."),
22965
22991
  n("text-refresh", "agent", "site.refresh", "\u05E2\u05D9\u05E6\u05D5\u05D1 \u05D7\u05D3\u05E9 \u05DC\u05D0\u05EA\u05E8 \u05D7\u05D9: \u05DB\u05DC \u05E2\u05DE\u05D5\u05D3, \u05DB\u05EA\u05D5\u05D1\u05EA, \u05DE\u05D9\u05DC\u05D4 \u05D5\u05DE\u05D5\u05EA\u05D2 \u05E0\u05E9\u05D0\u05E8\u05D9\u05DD, \u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05E2\u05D5\u05DC\u05D4.", "A new look for a live site: every page, address, word and the brand stay, a preview before it goes live."),
22966
- n("text-run-addons", "agent", "site.addons", "\u05DE\u05E8\u05D9\u05E6\u05D9\u05DD \u05D0\u05EA \u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E9\u05DC \u05D0\u05EA\u05E8 \u05D7\u05D9, \u05D0\u05D7\u05D3 \u05D0\u05D7\u05E8\u05D9 \u05D4\u05E9\u05E0\u05D9: \u05D4\u05D0\u05EA\u05E8 \u05E0\u05E9\u05D0\u05E8 \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D5\u05D0 \u05E2\u05D3 \u05E9\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DE\u05D0\u05E9\u05E8.", "Run a live site's add-ons one by one: the site stays as it is until the owner approves."),
22992
+ n("text-run-addons", "agent", "site.addons", "\u05DE\u05E8\u05D9\u05E6\u05D9\u05DD \u05D0\u05EA \u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05E9\u05DC \u05D0\u05EA\u05E8 \u05D7\u05D9 \u05D1\u05DC\u05D9 \u05DC\u05E2\u05E6\u05D5\u05E8 \u05D1\u05D9\u05E0\u05D9\u05D4\u05DD: \u05D4\u05D0\u05EA\u05E8 \u05E0\u05E9\u05D0\u05E8 \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D5\u05D0 \u05E2\u05D3 \u05E9\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DE\u05D0\u05E9\u05E8 \u05D1\u05E1\u05D5\u05E3.", "Run a live site's add-ons with no stop between them: the site stays as it is until the owner approves at the end."),
22967
22993
  n("text-migrate-keep", "agent", "site.migrate-keep", "\u05E8\u05E7 \u05DB\u05E9\u05D4\u05E6\u05D5\u05D5\u05EA \u05D1\u05D7\u05E8 \u05D1\u05D6\u05D4 \u05D1\u05D1\u05E7\u05E9\u05EA \u05D4\u05E2\u05D1\u05E8\u05D4, \u05DC\u05D1\u05D3\u05D9\u05E7\u05D4: \u05DE\u05E2\u05D1\u05D9\u05E8\u05D9\u05DD \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8 \u05D4\u05D9\u05E9\u05DF \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D5\u05D0, \u05E2\u05DD \u05D4\u05E2\u05D9\u05E6\u05D5\u05D1 \u05D5\u05D4\u05E1\u05E7\u05E8\u05D9\u05E4\u05D8\u05D9\u05DD \u05E9\u05DC\u05D5, \u05D5\u05DE\u05E9\u05D5\u05D5\u05D9\u05DD \u05E6\u05D9\u05DC\u05D5\u05DE\u05D9 \u05DE\u05E1\u05DA. \u05DE\u05E0\u05E7\u05D9\u05DD \u05E8\u05E7 \u05DE\u05D4 \u05E9\u05DE\u05D1\u05E7\u05E8 \u05DC\u05D0 \u05E8\u05D5\u05D0\u05D4.", "Only when the team picks it on a move request, to test: move the old site exactly as it is, with its own front end, and compare screenshots. Clean up only what a visitor cannot see."),
22968
22994
  n("text-migrate", "agent", "site.migrate", "\u05D1\u05E8\u05D9\u05E8\u05EA \u05D4\u05DE\u05D7\u05D3\u05DC: \u05D1\u05D5\u05E0\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9 \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8 \u05D4\u05D9\u05E9\u05DF \u05E2\u05DC \u05D4\u05D3\u05D5\u05D2\u05DE\u05D4, \u05E9\u05D5\u05DE\u05E8\u05D9\u05DD \u05DB\u05DC \u05DB\u05EA\u05D5\u05D1\u05EA \u05D5\u05DB\u05D5\u05EA\u05E8\u05EA, \u05EA\u05D5\u05DB\u05E0\u05D9\u05EA \u05E2\u05DD \u05E1\u05D8\u05D8\u05D5\u05E1 \u05DC\u05DB\u05DC \u05D9\u05DB\u05D5\u05DC\u05EA.", "The default: rebuild the old site on the sample, keep every address and title, a plan with a status for each feature."),
22969
22995
  n("text-move", "agent", "site.move", "\u05DE\u05E2\u05D1\u05D9\u05E8\u05D9\u05DD \u05D0\u05EA\u05E8 \u05E7\u05D9\u05D9\u05DD \u05D1\u05DC\u05D9 \u05DC\u05E9\u05E0\u05D5\u05EA \u05D0\u05EA \u05D4\u05E2\u05D9\u05E6\u05D5\u05D1 \u05D0\u05D5 \u05D4\u05DE\u05E1\u05D2\u05E8\u05EA.", "Move an existing site without changing its design or framework."),
@@ -23261,7 +23287,7 @@ function readContainer(js, container) {
23261
23287
  if (start2 < 0 || !js.includes('"predicates"')) return null;
23262
23288
  const end = js.indexOf('"runtime"', start2);
23263
23289
  const body = js.slice(start2, end > start2 ? end : void 0);
23264
- const text2 = body.replace(/\\u([0-9a-f]{4})/gi, (_, h) => String.fromCharCode(parseInt(h, 16))).replace(/\\\\x([0-9a-f]{2})/gi, (_, h) => String.fromCharCode(parseInt(h, 16))).replace(/\\\//g, "/").replace(/\\"/g, '"');
23290
+ const text3 = body.replace(/\\u([0-9a-f]{4})/gi, (_, h) => String.fromCharCode(parseInt(h, 16))).replace(/\\\\x([0-9a-f]{2})/gi, (_, h) => String.fromCharCode(parseInt(h, 16))).replace(/\\\//g, "/").replace(/\\"/g, '"');
23265
23291
  const triggers = /* @__PURE__ */ new Map();
23266
23292
  const unescape = (v) => v.replace(/\\u([0-9a-f]{4})/gi, (_, h) => String.fromCharCode(parseInt(h, 16))).replace(/\\(["/\\])/g, "$1");
23267
23293
  for (const m of body.matchAll(/\{"function":"(_css|_eq|_cn|_sw)","arg0":\["macro",\d+\],"arg1":"((?:[^"\\]|\\.)*)"/g)) {
@@ -23271,7 +23297,7 @@ function readContainer(js, container) {
23271
23297
  else if (value2.startsWith("/") && !/\s/.test(value2)) triggers.set(`p|${value2}`, { type: "page", value: value2, container });
23272
23298
  else if (m[1] === "_eq" && /^[a-zA-Z][\w.-]{1,50}$/.test(value2) && !value2.startsWith("gtm.")) triggers.set(`e|${value2}`, { type: "event", value: value2, container });
23273
23299
  }
23274
- const { tags: tags2 } = scanPageTags(text2, "https://container.invalid/");
23300
+ const { tags: tags2 } = scanPageTags(text3, "https://container.invalid/");
23275
23301
  return { tags: tags2.filter((t) => t.key !== "gtm"), triggers: [...triggers.values()] };
23276
23302
  }
23277
23303
  function selectorInPage(selector, html) {
@@ -23306,11 +23332,11 @@ function addPageTags(site, page3, path) {
23306
23332
  site.ownNames = [.../* @__PURE__ */ new Set([...site.ownNames, ...page3.ownNames])];
23307
23333
  site.plugins = [.../* @__PURE__ */ new Set([...site.plugins, ...page3.plugins])];
23308
23334
  site.serverContainers = [.../* @__PURE__ */ new Set([...site.serverContainers, ...page3.serverContainers])];
23309
- for (const text2 of page3.events) if (!site.events.some((x) => x.text === text2)) site.events.push({ text: text2, page: path });
23335
+ for (const text3 of page3.events) if (!site.events.some((x) => x.text === text3)) site.events.push({ text: text3, page: path });
23310
23336
  for (const v of page3.verification) if (!site.verification.some((x) => x.service === v.service && x.value === v.value)) site.verification.push({ ...v, page: path });
23311
23337
  for (const f of page3.forms) {
23312
- const same3 = site.forms.some((x) => x.id === f.id && x.action === f.action && x.classes === f.classes);
23313
- if (!same3 && site.forms.length < FORMS_KEPT) site.forms.push({ ...f, page: path });
23338
+ const same4 = site.forms.some((x) => x.id === f.id && x.action === f.action && x.classes === f.classes);
23339
+ if (!same4 && site.forms.length < FORMS_KEPT) site.forms.push({ ...f, page: path });
23314
23340
  }
23315
23341
  }
23316
23342
  function addBrowserRequests(site, urls, siteUrl) {
@@ -24160,11 +24186,11 @@ function isBlockedMoveSite(url2) {
24160
24186
  return [...BLOCKED_MOVE_ENDINGS, ...BLOCKED_MOVE_HOSTS].some((name) => host === name || host.endsWith(`.${name}`));
24161
24187
  }
24162
24188
  function normalizeSourceUrl(raw) {
24163
- const text2 = raw.trim();
24164
- if (!text2 || text2.length > 300) return null;
24189
+ const text3 = raw.trim();
24190
+ if (!text3 || text3.length > 300) return null;
24165
24191
  let u;
24166
24192
  try {
24167
- u = new URL(/^https?:\/\//i.test(text2) ? text2 : `https://${text2}`);
24193
+ u = new URL(/^https?:\/\//i.test(text3) ? text3 : `https://${text3}`);
24168
24194
  } catch {
24169
24195
  return null;
24170
24196
  }
@@ -24258,8 +24284,9 @@ ${t.join("\n")}` : "tags: []",
24258
24284
  "---",
24259
24285
  ""
24260
24286
  ].join("\n");
24261
- const base = (safeSlug(p.slug) || `post-${p.id}`).replace(/[^\p{L}\p{N}-]+/gu, "-").slice(0, 80) || `post-${p.id}`;
24262
- const file2 = used.has(base) ? `${base}-${p.id}.md` : `${base}.md`;
24287
+ const id = String(p.id ?? "").replace(/[^0-9]/g, "").slice(0, 20) || "0";
24288
+ const base = (safeSlug(p.slug) || `post-${id}`).replace(/[^\p{L}\p{N}-]+/gu, "-").slice(0, 80) || `post-${id}`;
24289
+ const file2 = used.has(base) ? `${base}-${id}.md` : `${base}.md`;
24263
24290
  used.add(base);
24264
24291
  return { file: file2, text: front + (p.content?.rendered ?? "").replace(sameHost, "").trim() + "\n" };
24265
24292
  });
@@ -24353,8 +24380,9 @@ function wpPostsToKit(input2) {
24353
24380
  path = safeSlug(new URL(p.link ?? "").pathname);
24354
24381
  } catch {
24355
24382
  }
24356
- let slug = safeSlug(p.slug).slice(0, 100) || `post-${p.id}`;
24357
- if (used.has(slug)) slug = `${slug.slice(0, 90)}-${p.id}`;
24383
+ const id = String(p.id ?? "").replace(/[^0-9]/g, "").slice(0, 20) || "0";
24384
+ let slug = safeSlug(p.slug).slice(0, 100) || `post-${id}`;
24385
+ if (used.has(slug)) slug = `${slug.slice(0, 90)}-${id}`;
24358
24386
  used.add(slug);
24359
24387
  const { body, lost } = wpHtmlToRich(p.content?.rendered ?? "", input2.origin);
24360
24388
  const picture2 = p.featured_media ? media.get(p.featured_media) : void 0;
@@ -24367,7 +24395,7 @@ function wpPostsToKit(input2) {
24367
24395
  excerpt: plain(p.excerpt?.rendered).replace(/\s*(\[&hellip;\]|\[…\]|…)$/, "").slice(0, 300),
24368
24396
  image: (picture2?.source_url ?? "").replace(sameHost, ""),
24369
24397
  image_alt: (picture2?.alt_text ?? "").slice(0, 200),
24370
- category: (p.categories ?? []).map((id) => cats.get(id)?.name).find(Boolean)?.slice(0, 60) ?? "",
24398
+ category: (p.categories ?? []).map((id2) => cats.get(id2)?.name).find(Boolean)?.slice(0, 60) ?? "",
24371
24399
  published_at: p.date ? p.date.replace("T", " ") : null
24372
24400
  };
24373
24401
  });
@@ -24478,9 +24506,9 @@ function value(token, min, max, names) {
24478
24506
  const n2 = named >= 0 ? named + min : /^\d{1,2}$/.test(token) ? Number(token) : NaN;
24479
24507
  return Number.isInteger(n2) && n2 >= min && n2 <= max ? n2 : null;
24480
24508
  }
24481
- function field(text2, min, max, names) {
24509
+ function field(text3, min, max, names) {
24482
24510
  const out2 = /* @__PURE__ */ new Set();
24483
- for (const part of text2.split(",")) {
24511
+ for (const part of text3.split(",")) {
24484
24512
  const m = /^(\*|\?|[A-Za-z0-9]+(?:-[A-Za-z0-9]+)?)(?:\/(\d{1,2}))?$/.exec(part);
24485
24513
  if (!m) return null;
24486
24514
  const step = m[2] ? Number(m[2]) : 1;
@@ -24647,20 +24675,20 @@ var orderFact = (a) => {
24647
24675
  if (a.status === "skipped") return "skipped last time.";
24648
24676
  return a.trace.files.length ? `not run here, but this folder has ${a.trace.files.join(", ")}: check whether it is already done.` : "not run yet.";
24649
24677
  };
24650
- function addonOrderBrief(items, mode) {
24678
+ function addonOrderBrief(items, parallel) {
24651
24679
  const keys = items.map((a) => a.key);
24652
- const flags = mode ? [`--${mode}`] : ["--one-by-one", "--all"];
24653
24680
  return [
24654
- `The owner picked ${items.length} add-ons for this site. No order is fixed: you suggest what goes first, and the owner approves. Change no file yet.`,
24681
+ `The owner picked ${items.length} add-ons for this site. No order is fixed: you decide what goes first for this site. Change no file yet.`,
24655
24682
  ...items.map((a) => `- ${a.key}: ${orderFact(a)}`),
24656
24683
  `Starting order, to challenge: ${keys.join(", ")}.`,
24657
24684
  "Read the code in this folder and the site itself, then decide for this site:",
24658
24685
  "- First: what hurts visitors, safety or the business most today, and what the others build on. Last: what measures the final result, like speed.",
24659
- "- Work already in the site, where nothing since touched its topic, never goes first. Recommend leaving it out. A change counts only if it touched that topic: a text edit gives security or code quality nothing new to do.",
24660
- "Never add an add-on the owner did not pick. Leave one out only with their OK.",
24661
- `Tell the owner in a short list, in plain words: your order, one reason for each, and what you would leave out and why. Ask once: "Run in this order, or change it?"${mode ? "" : " In the same question ask: one by one (recommended, after each add-on they choose whether to publish) or all at once (they all finish first, then one publish at the end). If they have no preference, use one by one."}`,
24662
- "Then run, with the keys in the agreed order:",
24663
- ...flags.map((f) => ` npx deployai@latest addons run --order ${keys.join(",")} ${f}`)
24686
+ "- Work already in the site, where nothing since touched its topic, never goes first. Leave it out. A change counts only if it touched that topic: a text edit gives security or code quality nothing new to do.",
24687
+ "Never add an add-on the owner did not pick.",
24688
+ 'If .deployai/owner-mode says check-with-me, tell the owner in a short list, in plain words, your order, one reason for each and what you would leave out, and ask once: "Run in this order, or change it?" Else do not ask: tell them the same list in one short message and go on.',
24689
+ "Then run, with the keys in your order:",
24690
+ ` npx deployai@latest addons run --order ${keys.join(",")}${parallel ? " --parallel" : ""}`,
24691
+ ...parallel ? [] : ["Add --parallel only when .deployai/owner-mode says on-my-own and your tool can run several helper agents at the same time: lanes that touch different files then run side by side, each in its own copy of the folder."]
24664
24692
  ];
24665
24693
  }
24666
24694
  function addonTrace(key2, exists, stamps) {
@@ -24799,7 +24827,7 @@ function forgetAccount(email3) {
24799
24827
  }
24800
24828
 
24801
24829
  // src/project.ts
24802
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
24830
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync2 } from "fs";
24803
24831
  import { join as join2 } from "path";
24804
24832
 
24805
24833
  // src/json.ts
@@ -24812,8 +24840,8 @@ function readText(path) {
24812
24840
  swapped.swap16();
24813
24841
  return swapped.toString("utf16le");
24814
24842
  }
24815
- const text2 = b.toString("utf8");
24816
- return text2.charCodeAt(0) === 65279 ? text2.slice(1) : text2;
24843
+ const text3 = b.toString("utf8");
24844
+ return text3.charCodeAt(0) === 65279 ? text3.slice(1) : text3;
24817
24845
  }
24818
24846
  function readJson(path) {
24819
24847
  return JSON.parse(readText(path));
@@ -24832,7 +24860,7 @@ function ensureDeployaiDir(root) {
24832
24860
  if (!existsSync2(dir)) mkdirSync2(dir, { recursive: true });
24833
24861
  const ignore = join2(dir, ".gitignore");
24834
24862
  const have = existsSync2(ignore) ? readFileSync3(ignore, "utf8") : "";
24835
- const missing = ["last-check.json", "brief.md", "start.md", "blocks/*.md", "sync.json", "sync/"].filter((f) => !have.split(/\r?\n/).includes(f));
24863
+ const missing = ["last-check.json", "brief.md", "start.md", "blocks/*.md", "sync.json", "sync/", "run.json"].filter((f) => !have.split(/\r?\n/).includes(f));
24836
24864
  if (missing.length) writeFileSync2(ignore, have + (have && !have.endsWith("\n") ? "\n" : "") + missing.join("\n") + "\n");
24837
24865
  }
24838
24866
  function readProject(root) {
@@ -24852,6 +24880,30 @@ function updateProject(root, patch) {
24852
24880
  writeProject(root, cfg);
24853
24881
  return cfg;
24854
24882
  }
24883
+ var runFile = (root) => join2(root, DEPLOYAI_DIR, "run.json");
24884
+ function readRun(root) {
24885
+ try {
24886
+ return readJson(runFile(root));
24887
+ } catch {
24888
+ return null;
24889
+ }
24890
+ }
24891
+ function writeRun(root, state) {
24892
+ if (!state) {
24893
+ if (existsSync2(runFile(root))) rmSync(runFile(root));
24894
+ return;
24895
+ }
24896
+ ensureDeployaiDir(root);
24897
+ writeFileSync2(runFile(root), JSON.stringify(state, null, 2) + "\n");
24898
+ }
24899
+ function ownerMode(root) {
24900
+ try {
24901
+ const v = readFileSync3(join2(root, DEPLOYAI_DIR, "owner-mode"), "utf8").trim();
24902
+ return v === "on-my-own" || v === "check-with-me" ? v : null;
24903
+ } catch {
24904
+ return null;
24905
+ }
24906
+ }
24855
24907
 
24856
24908
  // src/errors.ts
24857
24909
  var CliError = class extends Error {
@@ -24916,6 +24968,7 @@ var M = {
24916
24968
  moveOfferGranted: "Moved from /move: the site got {n} add-ons free. They wait until the move is done, and the last step offers them.",
24917
24969
  moveOfferCap: "The free add-ons for moved sites were already used on 3 sites of this account.",
24918
24970
  moveOfferOver: "The free add-ons offer for moved sites is over.",
24971
+ moveOfferNotMove: "No free add-ons: this folder did not start from /move, so the site does not count as a move.",
24919
24972
  initHint: " So your agent follows the DeployAI rules, run: npx deployai@latest init",
24920
24973
  emptyFolder: "Nothing to check yet: this folder has no site. Build the site here, then run: npx deployai@latest check",
24921
24974
  deployTitle: "DeployAI deploy",
@@ -25218,6 +25271,7 @@ var M = {
25218
25271
  moveOfferGranted: "\u05D4\u05D0\u05EA\u05E8 \u05D4\u05D2\u05D9\u05E2 \u05D3\u05E8\u05DA \u200E/move \u05D5\u05E7\u05D9\u05D1\u05DC {n} \u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D1\u05D7\u05D9\u05E0\u05DD. \u05E0\u05E6\u05D9\u05E2 \u05D0\u05D5\u05EA\u05DD \u05D1\u05E9\u05DC\u05D1 \u05D4\u05D0\u05D7\u05E8\u05D5\u05DF, \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D4\u05D4\u05E2\u05D1\u05E8\u05D4 \u05DE\u05E1\u05EA\u05D9\u05D9\u05DE\u05EA.",
25219
25272
  moveOfferCap: "\u05DB\u05D1\u05E8 \u05D4\u05E9\u05EA\u05DE\u05E9\u05EA\u05DD \u05D1\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D4\u05D7\u05D9\u05E0\u05DE\u05D9\u05D9\u05DD \u05DC\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05D4\u05D5\u05E2\u05D1\u05E8\u05D5 \u05D1\u05BE3 \u05D0\u05EA\u05E8\u05D9\u05DD \u05D1\u05D7\u05E9\u05D1\u05D5\u05DF \u05D4\u05D6\u05D4.",
25220
25273
  moveOfferOver: "\u05DE\u05D1\u05E6\u05E2 \u05D4\u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D4\u05D7\u05D9\u05E0\u05DE\u05D9\u05D9\u05DD \u05DC\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05D4\u05D5\u05E2\u05D1\u05E8\u05D5 \u05D4\u05E1\u05EA\u05D9\u05D9\u05DD.",
25274
+ moveOfferNotMove: "\u05D0\u05D9\u05DF \u05EA\u05D5\u05E1\u05E4\u05D9\u05DD \u05D1\u05D7\u05D9\u05E0\u05DD: \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05DC\u05D0 \u05D4\u05EA\u05D7\u05D9\u05DC\u05D4 \u05DE\u05BE\u200E/move, \u05D5\u05DC\u05DB\u05DF \u05D4\u05D0\u05EA\u05E8 \u05DC\u05D0 \u05E0\u05D7\u05E9\u05D1 \u05DB\u05D4\u05E2\u05D1\u05E8\u05D4.",
25221
25275
  initHint: " \u05DB\u05D3\u05D9 \u05E9\u05D4\u05E1\u05D5\u05DB\u05DF \u05D9\u05E2\u05D1\u05D5\u05D3 \u05DC\u05E4\u05D9 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC DeployAI, \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest init",
25222
25276
  emptyFolder: "\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D4 \u05DC\u05D1\u05D3\u05D5\u05E7: \u05D0\u05D9\u05DF \u05D1\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05D0\u05EA\u05E8. \u05D1\u05E0\u05D5 \u05DB\u05D0\u05DF \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8, \u05D5\u05D0\u05D6 \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest check",
25223
25277
  deployTitle: "DeployAI deploy",
@@ -25502,8 +25556,8 @@ function out(line = "") {
25502
25556
  function err(line = "") {
25503
25557
  process.stderr.write(line + "\n");
25504
25558
  }
25505
- function pad(text2, width) {
25506
- return text2.length >= width ? text2 + " " : text2 + " ".repeat(width - text2.length);
25559
+ function pad(text3, width) {
25560
+ return text3.length >= width ? text3 + " " : text3 + " ".repeat(width - text3.length);
25507
25561
  }
25508
25562
  function row(label, value2, width = LABEL_WIDTH) {
25509
25563
  return pad(label, width) + value2;
@@ -25519,7 +25573,7 @@ function formatBytes(n2) {
25519
25573
  }
25520
25574
 
25521
25575
  // src/version.ts
25522
- var CLI_VERSION = "0.1.0-beta.49";
25576
+ var CLI_VERSION = "0.1.0-beta.50";
25523
25577
 
25524
25578
  // src/api.ts
25525
25579
  function apiContext(apiFlag, root) {
@@ -25601,10 +25655,10 @@ async function apiRequest(ctx, path, schema, opts = {}) {
25601
25655
  err(messages(process.cwd())("retrying", { n: attempt + 2, max: waits.length + 1 }));
25602
25656
  await new Promise((r) => setTimeout(r, waits[attempt]));
25603
25657
  }
25604
- const text2 = await res.text().catch(() => "");
25658
+ const text3 = await res.text().catch(() => "");
25605
25659
  let data = null;
25606
25660
  try {
25607
- data = text2 ? JSON.parse(text2) : null;
25661
+ data = text3 ? JSON.parse(text3) : null;
25608
25662
  } catch {
25609
25663
  data = null;
25610
25664
  }
@@ -25633,8 +25687,8 @@ async function apiRequest(ctx, path, schema, opts = {}) {
25633
25687
  const msg = parsed2.success ? parsed2.data.error : `HTTP ${res.status}`;
25634
25688
  const category = res.status === 403 ? "forbidden" : res.status === 404 ? "not_found" : res.status === 429 ? "rate_limited" : "api";
25635
25689
  const serverLine = parsed2.success ? parsed2.data.messageHe : void 0;
25636
- const text3 = category === "forbidden" ? t("forbidden") : category === "not_found" ? t("notFound") : category === "rate_limited" ? t("rateLimited") : serverLine ? t("apiRefused", { code: msg, message: serverLine }) : t("apiError", { code: msg });
25637
- throw new CliError(text3, 1, category);
25690
+ const text4 = category === "forbidden" ? t("forbidden") : category === "not_found" ? t("notFound") : category === "rate_limited" ? t("rateLimited") : serverLine ? t("apiRefused", { code: msg, message: serverLine }) : t("apiError", { code: msg });
25691
+ throw new CliError(text4, 1, category);
25638
25692
  }
25639
25693
  if (!schema) return data;
25640
25694
  const parsed = schema.safeParse(data);
@@ -25981,9 +26035,9 @@ function globToRegex(glob) {
25981
26035
  }
25982
26036
  return re;
25983
26037
  }
25984
- function parseIgnore(text2) {
26038
+ function parseIgnore(text3) {
25985
26039
  const rules = [];
25986
- for (const rawLine of text2.split(/\r?\n/)) {
26040
+ for (const rawLine of text3.split(/\r?\n/)) {
25987
26041
  let line = rawLine.trim();
25988
26042
  if (!line || line.startsWith("#")) continue;
25989
26043
  let negate = false;
@@ -26021,12 +26075,12 @@ function loadIgnore(root) {
26021
26075
  }
26022
26076
  }
26023
26077
  function loadUploadIgnore(root) {
26024
- let git3 = [];
26078
+ let git4 = [];
26025
26079
  try {
26026
- git3 = parseIgnore(readFileSync4(join3(root, ".gitignore"), "utf8"));
26080
+ git4 = parseIgnore(readFileSync4(join3(root, ".gitignore"), "utf8"));
26027
26081
  } catch {
26028
26082
  }
26029
- return [...git3, ...loadIgnore(root)];
26083
+ return [...git4, ...loadIgnore(root)];
26030
26084
  }
26031
26085
  function walkFiles(root, opts = {}) {
26032
26086
  const result = [];
@@ -26157,14 +26211,14 @@ function brokenRegexLine(code) {
26157
26211
  }
26158
26212
  return null;
26159
26213
  }
26160
- function lineAt3(text2, index) {
26214
+ function lineAt3(text3, index) {
26161
26215
  let line = 1;
26162
- for (let i = 0; i < index && i < text2.length; i++) if (text2.charCodeAt(i) === 10) line++;
26216
+ for (let i = 0; i < index && i < text3.length; i++) if (text3.charCodeAt(i) === 10) line++;
26163
26217
  return line;
26164
26218
  }
26165
- function firstMatchLine(text2, re) {
26166
- const m = re.exec(text2);
26167
- return m ? lineAt3(text2, m.index) : null;
26219
+ function firstMatchLine(text3, re) {
26220
+ const m = re.exec(text3);
26221
+ return m ? lineAt3(text3, m.index) : null;
26168
26222
  }
26169
26223
  function escapeRe(s) {
26170
26224
  return s.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
@@ -26354,16 +26408,16 @@ function analyzeProject(root) {
26354
26408
  }
26355
26409
  for (const f of files) {
26356
26410
  if (!f.rel.endsWith(".prisma")) continue;
26357
- let text2 = "";
26411
+ let text3 = "";
26358
26412
  try {
26359
- text2 = stripComments(readFileSync5(f.abs, "utf8"));
26413
+ text3 = stripComments(readFileSync5(f.abs, "utf8"));
26360
26414
  } catch {
26361
26415
  continue;
26362
26416
  }
26363
- const block = /datasource\s+\w+\s*\{[^}]*?provider\s*=\s*"(\w+)"/.exec(text2);
26417
+ const block = /datasource\s+\w+\s*\{[^}]*?provider\s*=\s*"(\w+)"/.exec(text3);
26364
26418
  if (!block) continue;
26365
26419
  const provider = block[1];
26366
- const line = lineAt3(text2, block.index + block[0].lastIndexOf("provider"));
26420
+ const line = lineAt3(text3, block.index + block[0].lastIndexOf("provider"));
26367
26421
  const kind = provider === "postgresql" || provider === "cockroachdb" ? "postgres" : provider === "mysql" ? "mysql" : provider === "mongodb" ? "mongodb" : provider === "sqlite" ? deps["@prisma/adapter-d1"] ? "d1" : "sqlite" : null;
26368
26422
  if (kind) databases.push({ kind, via: "Prisma", file: f.rel, line });
26369
26423
  }
@@ -26402,32 +26456,32 @@ function analyzeProject(root) {
26402
26456
  if (!databases.some((d) => d.kind === "d1")) {
26403
26457
  for (const name of ["wrangler.toml", "wrangler.json", "wrangler.jsonc"]) {
26404
26458
  if (!existsSync4(join4(root, name))) continue;
26405
- const text2 = readFileSync5(join4(root, name), "utf8");
26406
- const at = text2.search(/d1_databases/);
26459
+ const text3 = readFileSync5(join4(root, name), "utf8");
26460
+ const at = text3.search(/d1_databases/);
26407
26461
  if (at < 0) continue;
26408
- databases.push({ kind: "d1", via: "wrangler config", file: name, line: text2.slice(0, at).split("\n").length });
26462
+ databases.push({ kind: "d1", via: "wrangler config", file: name, line: text3.slice(0, at).split("\n").length });
26409
26463
  break;
26410
26464
  }
26411
26465
  }
26412
26466
  for (const name of ["wrangler.toml", "wrangler.json", "wrangler.jsonc"]) {
26413
26467
  if (!existsSync4(join4(root, name))) continue;
26414
- const text2 = readFileSync5(join4(root, name), "utf8");
26415
- if (!parseWranglerConfig(name, text2).durableObjects.some((o) => o.script || !o.name || !o.className)) break;
26416
- const at = text2.search(/script_name/) >= 0 ? text2.search(/script_name/) : text2.search(/durable_objects/);
26417
- add({ code: "durable_objects", severity: "blocker", file: name, line: at < 0 ? 1 : text2.slice(0, at).split("\n").length, detail: "" });
26468
+ const text3 = readFileSync5(join4(root, name), "utf8");
26469
+ if (!parseWranglerConfig(name, text3).durableObjects.some((o) => o.script || !o.name || !o.className)) break;
26470
+ const at = text3.search(/script_name/) >= 0 ? text3.search(/script_name/) : text3.search(/durable_objects/);
26471
+ add({ code: "durable_objects", severity: "blocker", file: name, line: at < 0 ? 1 : text3.slice(0, at).split("\n").length, detail: "" });
26418
26472
  break;
26419
26473
  }
26420
26474
  for (const name of ["wrangler.toml", "wrangler.json", "wrangler.jsonc"]) {
26421
26475
  if (!existsSync4(join4(root, name))) continue;
26422
- const text2 = readFileSync5(join4(root, name), "utf8");
26423
- for (const cron of parseWranglerConfig(name, text2).crons) {
26476
+ const text3 = readFileSync5(join4(root, name), "utf8");
26477
+ for (const cron of parseWranglerConfig(name, text3).crons) {
26424
26478
  const spec = parseSiteCron(cron);
26425
26479
  const gap = isSiteCronSpec(spec) ? siteCronGapMinutes(spec) : null;
26426
26480
  const why = !isSiteCronSpec(spec) ? "not a five part cron line" : gap !== null && gap < SITE_SCHEDULE_MIN_MINUTES ? `more often than every ${SITE_SCHEDULE_MIN_MINUTES} minutes` : null;
26427
26481
  if (!why) continue;
26428
- const quoted = Math.max(text2.indexOf(`"${cron}"`), text2.indexOf(`'${cron}'`));
26429
- const at = quoted >= 0 ? quoted : text2.indexOf(cron);
26430
- add({ code: "schedule_not_run", severity: "warning", file: name, line: at < 0 ? 1 : text2.slice(0, at).split("\n").length, detail: ` ("${cron}", ${why})` });
26482
+ const quoted = Math.max(text3.indexOf(`"${cron}"`), text3.indexOf(`'${cron}'`));
26483
+ const at = quoted >= 0 ? quoted : text3.indexOf(cron);
26484
+ add({ code: "schedule_not_run", severity: "warning", file: name, line: at < 0 ? 1 : text3.slice(0, at).split("\n").length, detail: ` ("${cron}", ${why})` });
26431
26485
  }
26432
26486
  break;
26433
26487
  }
@@ -26634,7 +26688,7 @@ import { appendFileSync, existsSync as existsSync5, readFileSync as readFileSync
26634
26688
  import { join as join6 } from "path";
26635
26689
  var RULES_FILE = "DEPLOYAI.md";
26636
26690
  var RULES_STAMP = `${DEPLOYAI_DIR}/rules.json`;
26637
- var rulesHash = (text2) => createHash("sha256").update(text2.replace(/\r\n/g, "\n")).digest("hex");
26691
+ var rulesHash = (text3) => createHash("sha256").update(text3.replace(/\r\n/g, "\n")).digest("hex");
26638
26692
  function readStamp(root) {
26639
26693
  try {
26640
26694
  const v = readJson(join6(root, RULES_STAMP));
@@ -26643,37 +26697,37 @@ function readStamp(root) {
26643
26697
  return null;
26644
26698
  }
26645
26699
  }
26646
- function writeStamp(root, text2) {
26700
+ function writeStamp(root, text3) {
26647
26701
  ensureDeployaiDir(root);
26648
- writeFileSync4(join6(root, RULES_STAMP), `${JSON.stringify({ deployaiMd: rulesHash(text2) }, null, 2)}
26702
+ writeFileSync4(join6(root, RULES_STAMP), `${JSON.stringify({ deployaiMd: rulesHash(text3) }, null, 2)}
26649
26703
  `);
26650
26704
  }
26651
26705
  function writeRulesFile(root, md) {
26652
26706
  writeFileSync4(join6(root, RULES_FILE), md);
26653
26707
  writeStamp(root, md);
26654
26708
  }
26655
- function addMissingRules(file2, text2, later) {
26656
- const missing = later.filter((r) => !text2.includes(r.has));
26709
+ function addMissingRules(file2, text3, later) {
26710
+ const missing = later.filter((r) => !text3.includes(r.has));
26657
26711
  if (!missing.length) return false;
26658
- const eol = text2.includes("\r\n") ? "\r\n" : "\n";
26659
- const gap = text2.endsWith("\n") ? eol : eol + eol;
26712
+ const eol = text3.includes("\r\n") ? "\r\n" : "\n";
26713
+ const gap = text3.endsWith("\n") ? eol : eol + eol;
26660
26714
  appendFileSync(file2, `${gap}## Added later by DeployAI${eol}${eol}${missing.map((r) => r.text).join(eol + eol)}${eol}`);
26661
26715
  return true;
26662
26716
  }
26663
26717
  function syncRulesFile(root, md, later = DEPLOYAI_LATER_RULES) {
26664
26718
  const file2 = join6(root, RULES_FILE);
26665
26719
  if (!existsSync5(file2)) return "none";
26666
- const text2 = readFileSync6(file2, "utf8");
26667
- const now = rulesHash(text2);
26720
+ const text3 = readFileSync6(file2, "utf8");
26721
+ const now = rulesHash(text3);
26668
26722
  if (now === rulesHash(md)) {
26669
26723
  if (readStamp(root) !== now) writeStamp(root, md);
26670
26724
  return "current";
26671
26725
  }
26672
26726
  if (readStamp(root) === now) {
26673
- writeRulesFile(root, text2.includes("\r\n") ? md.replace(/\r?\n/g, "\r\n") : md);
26727
+ writeRulesFile(root, text3.includes("\r\n") ? md.replace(/\r?\n/g, "\r\n") : md);
26674
26728
  return "updated";
26675
26729
  }
26676
- return addMissingRules(file2, text2, later) ? "added" : "edited";
26730
+ return addMissingRules(file2, text3, later) ? "added" : "edited";
26677
26731
  }
26678
26732
 
26679
26733
  // src/commands/init.ts
@@ -26695,16 +26749,16 @@ function runInit(root, opts = {}) {
26695
26749
  if (opts.agentFiles !== false) {
26696
26750
  for (const name of AGENT_FILES) {
26697
26751
  const file2 = join7(root, name);
26698
- const text2 = existsSync6(file2) ? readFileSync7(file2, "utf8") : null;
26699
- if (text2 === null) {
26752
+ const text3 = existsSync6(file2) ? readFileSync7(file2, "utf8") : null;
26753
+ if (text3 === null) {
26700
26754
  writeFileSync5(file2, `${AGENT_POINTER}
26701
26755
  `);
26702
26756
  created.push(name);
26703
- } else if (text2.includes("DEPLOYAI.md")) {
26757
+ } else if (text3.includes("DEPLOYAI.md")) {
26704
26758
  kept.push(name);
26705
26759
  } else {
26706
- const eol = text2.includes("\r\n") ? "\r\n" : "\n";
26707
- const gap = !text2.trim() ? "" : text2.endsWith("\n") ? eol : eol + eol;
26760
+ const eol = text3.includes("\r\n") ? "\r\n" : "\n";
26761
+ const gap = !text3.trim() ? "" : text3.endsWith("\n") ? eol : eol + eol;
26708
26762
  appendFileSync2(file2, `${gap}${AGENT_POINTER}${eol}`);
26709
26763
  updated.push(name);
26710
26764
  }
@@ -26820,7 +26874,7 @@ function buildPrompt(analysis) {
26820
26874
  import { spawn, spawnSync } from "child_process";
26821
26875
  import { existsSync as existsSync7 } from "fs";
26822
26876
  import { join as join8 } from "path";
26823
- function copyToClipboard(text2) {
26877
+ function copyToClipboard(text3) {
26824
26878
  if (process.env.DEPLOYAI_NO_CLIPBOARD) return false;
26825
26879
  const candidates = process.platform === "win32" ? [["clip", []]] : process.platform === "darwin" ? [["pbcopy", []]] : [
26826
26880
  ["wl-copy", []],
@@ -26829,7 +26883,7 @@ function copyToClipboard(text2) {
26829
26883
  ];
26830
26884
  for (const [cmd, args] of candidates) {
26831
26885
  try {
26832
- const r = spawnSync(cmd, args, { input: text2, timeout: 2e3, stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
26886
+ const r = spawnSync(cmd, args, { input: text3, timeout: 2e3, stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
26833
26887
  if (r.status === 0 && !r.error) return true;
26834
26888
  } catch {
26835
26889
  }
@@ -27198,9 +27252,9 @@ function addTo(obj, key2, list, value2) {
27198
27252
  function ignoreInGit(root, path) {
27199
27253
  if (!existsSync9(join10(root, ".git"))) return;
27200
27254
  const gi = join10(root, ".gitignore");
27201
- const text2 = existsSync9(gi) ? readFileSync8(gi, "utf8") : "";
27202
- if (text2.split(/\r?\n/).some((l) => l.trim() === path)) return;
27203
- appendFileSync3(gi, `${text2 && !text2.endsWith("\n") ? "\n" : ""}${path}
27255
+ const text3 = existsSync9(gi) ? readFileSync8(gi, "utf8") : "";
27256
+ if (text3.split(/\r?\n/).some((l) => l.trim() === path)) return;
27257
+ appendFileSync3(gi, `${text3 && !text3.endsWith("\n") ? "\n" : ""}${path}
27204
27258
  `);
27205
27259
  }
27206
27260
  function detectTool() {
@@ -27256,7 +27310,7 @@ function allowCommand(tool) {
27256
27310
  }
27257
27311
 
27258
27312
  // src/commands/sound.ts
27259
- import { existsSync as existsSync11, readFileSync as readFileSync9, rmSync, writeFileSync as writeFileSync9 } from "fs";
27313
+ import { existsSync as existsSync11, readFileSync as readFileSync9, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
27260
27314
  import { homedir as homedir2 } from "os";
27261
27315
  import { join as join12 } from "path";
27262
27316
 
@@ -27386,9 +27440,9 @@ function agentOn(root, opts = {}) {
27386
27440
  writeSoundFiles();
27387
27441
  ensureDeployaiDir(root);
27388
27442
  const script = join12(root, AGENT_SCRIPT);
27389
- const text2 = agentScript(soundsDir());
27390
- const scriptSame = existsSync11(script) && readFileSync9(script, "utf8") === text2;
27391
- if (!scriptSame) writeFileSync9(script, text2);
27443
+ const text3 = agentScript(soundsDir());
27444
+ const scriptSame = existsSync11(script) && readFileSync9(script, "utf8") === text3;
27445
+ if (!scriptSame) writeFileSync9(script, text3);
27392
27446
  const hooks = hooksOf(obj);
27393
27447
  const env = obj.env && typeof obj.env === "object" ? obj.env : {};
27394
27448
  let added = env[TITLE_ENV] !== "1";
@@ -27430,7 +27484,7 @@ function agentOff(root) {
27430
27484
  }
27431
27485
  const script = join12(root, AGENT_SCRIPT);
27432
27486
  if (existsSync11(script)) {
27433
- rmSync(script);
27487
+ rmSync2(script);
27434
27488
  removed = true;
27435
27489
  }
27436
27490
  return removed;
@@ -27498,11 +27552,11 @@ function soundCommand(root, action, state, tool, opts = {}) {
27498
27552
  function refreshAgentScript(root) {
27499
27553
  const script = join12(root, AGENT_SCRIPT);
27500
27554
  if (!existsSync11(script)) return false;
27501
- const text2 = agentScript(soundsDir());
27555
+ const text3 = agentScript(soundsDir());
27502
27556
  const now = readFileSync9(script, "utf8");
27503
- if (now === text2 || !now.startsWith("// DeployAI's sound and tab dot")) return false;
27557
+ if (now === text3 || !now.startsWith("// DeployAI's sound and tab dot")) return false;
27504
27558
  writeSoundFiles();
27505
- writeFileSync9(script, text2);
27559
+ writeFileSync9(script, text3);
27506
27560
  return true;
27507
27561
  }
27508
27562
 
@@ -27672,7 +27726,12 @@ async function wordpressContent(base, dir) {
27672
27726
  if (posts?.length) {
27673
27727
  const files = wpPostsToMarkdown({ origin: new URL(base).origin, posts, categories: readJson3(join13(dir, "content", "categories.json")) ?? [], tags: readJson3(join13(dir, "content", "tags.json")) ?? [], users: readJson3(join13(dir, "content", "users.json")) ?? [], media: readJson3(join13(dir, "content", "media.json")) ?? [] });
27674
27728
  mkdirSync6(join13(dir, "posts"), { recursive: true });
27675
- for (const f of files) writeFileSync10(join13(dir, "posts", f.file), f.text);
27729
+ const postsDir = resolve(dir, "posts");
27730
+ for (const f of files) {
27731
+ const target = resolve(postsDir, f.file);
27732
+ if (dirname2(target) !== postsDir) continue;
27733
+ writeFileSync10(target, f.text);
27734
+ }
27676
27735
  out(` posts as Markdown: ${files.length}`);
27677
27736
  }
27678
27737
  return true;
@@ -27766,10 +27825,10 @@ async function saveOldStyles(html, pageUrl, dir) {
27766
27825
  for (const url2 of stylesheetLinks(html, pageUrl, 6)) {
27767
27826
  const res = await get(url2, "text/css,*/*;q=0.8");
27768
27827
  if (!res?.ok) continue;
27769
- const text2 = await res.text();
27770
- if (text2.length > ICON_MAX_BYTES) continue;
27828
+ const text3 = await res.text();
27829
+ if (text3.length > ICON_MAX_BYTES) continue;
27771
27830
  mkdirSync6(styles, { recursive: true });
27772
- writeFileSync10(join13(styles, `${++n2}.css`), text2);
27831
+ writeFileSync10(join13(styles, `${++n2}.css`), text3);
27773
27832
  }
27774
27833
  }
27775
27834
  var TRIGGER_PAGES_CAP = 30;
@@ -28344,7 +28403,7 @@ async function migrateVerifyCommand(root, previewRaw, ctx, retryMs = PREVIEW_RET
28344
28403
  writeJson(report2, { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), preview: preview.origin, checked, findings, credits: [...credits.keys()], vendors: [...vendors.keys()], tags: tagFindings, leftOnOld });
28345
28404
  if (credits.size) {
28346
28405
  out(`A builder's credit is still on the preview:`);
28347
- for (const [text2, path] of credits) out(` ${path} ${text2}`);
28406
+ for (const [text3, path] of credits) out(` ${path} ${text3}`);
28348
28407
  out("Remove each and put the site's own name and the year in its place, unless the owner asked to keep it, then deploy again and run verify again.");
28349
28408
  blockedBy("builder_credit");
28350
28409
  process.exitCode = 1;
@@ -28414,7 +28473,7 @@ async function moveOffer(root, p, ctx) {
28414
28473
  out(t("movedSlug", { url: r.url ?? r.slug }));
28415
28474
  }
28416
28475
  if (r.granted?.length) out(t("moveOfferGranted", { n: r.granted.length }));
28417
- else if (r.reason && r.reason !== "start_used") out(t(r.reason === "cap" ? "moveOfferCap" : "moveOfferOver"));
28476
+ else if (r.reason && r.reason !== "start_used") out(t(r.reason === "cap" ? "moveOfferCap" : r.reason === "offer_over" ? "moveOfferOver" : "moveOfferNotMove"));
28418
28477
  } catch {
28419
28478
  }
28420
28479
  }
@@ -28540,7 +28599,7 @@ function changedUnderSameName(root, files) {
28540
28599
 
28541
28600
  // src/commands/sync.ts
28542
28601
  import { spawnSync as spawnSync3 } from "child_process";
28543
- import { existsSync as existsSync15, mkdirSync as mkdirSync9, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync3, unlinkSync, writeFileSync as writeFileSync13 } from "fs";
28602
+ import { existsSync as existsSync15, mkdirSync as mkdirSync9, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync4, unlinkSync, writeFileSync as writeFileSync13 } from "fs";
28544
28603
  import { tmpdir } from "os";
28545
28604
  import { dirname as dirname5, join as join17, resolve as resolve4, sep as sep3 } from "path";
28546
28605
  import { gunzipSync as gunzipSync2 } from "zlib";
@@ -28668,6 +28727,9 @@ function readTar(tar) {
28668
28727
  }
28669
28728
  return entries;
28670
28729
  }
28730
+ function aliasPathPart(path) {
28731
+ return path.split("/").some((p) => /^[^.]{1,8}~\d+(\.[^.]{0,3})?$/.test(p) || /[. ]$/.test(p) || p.includes(":"));
28732
+ }
28671
28733
 
28672
28734
  // src/work.ts
28673
28735
  import { createHash as createHash3 } from "crypto";
@@ -28711,7 +28773,7 @@ function othersLine(root, others) {
28711
28773
 
28712
28774
  // src/commands/pull.ts
28713
28775
  import { spawnSync as spawnSync2 } from "child_process";
28714
- import { existsSync as existsSync14, readdirSync as readdirSync5, rmSync as rmSync2 } from "fs";
28776
+ import { existsSync as existsSync14, readdirSync as readdirSync5, rmSync as rmSync3 } from "fs";
28715
28777
  import { join as join16 } from "path";
28716
28778
 
28717
28779
  // src/commands/samples.ts
@@ -28794,7 +28856,7 @@ function extractInto(gz, root, damaged) {
28794
28856
  let written = 0;
28795
28857
  for (const e3 of entries) {
28796
28858
  if (e3.type !== "0" && e3.type !== "\0") continue;
28797
- if (privateProjectFile(e3.name.replace(/\\/g, "/"))) continue;
28859
+ if (privateProjectFile(e3.name.replace(/\\/g, "/")) || aliasPathPart(e3.name.replace(/\\/g, "/"))) continue;
28798
28860
  const target = resolve3(base, e3.name);
28799
28861
  if (target !== base && !target.startsWith(base + sep2)) continue;
28800
28862
  mkdirSync8(dirname4(target), { recursive: true });
@@ -28882,7 +28944,7 @@ var git = (root, args, env = {}) => spawnSync2("git", args, { cwd: root, encodin
28882
28944
  function clearTree(root) {
28883
28945
  for (const name of readdirSync5(root)) {
28884
28946
  if (name === ".git" || name === ".deployai") continue;
28885
- rmSync2(join16(root, name), { recursive: true, force: true });
28947
+ rmSync3(join16(root, name), { recursive: true, force: true });
28886
28948
  }
28887
28949
  }
28888
28950
  async function pullHistory(root, ctx, projectId) {
@@ -28926,7 +28988,7 @@ function safeSourceName(raw) {
28926
28988
  if (!name || name.startsWith("/") || /^[a-zA-Z]:/.test(name) || name.includes("\0")) return null;
28927
28989
  if (name.split("/").some((p) => p === ".." || p === ".")) return null;
28928
28990
  if (privateProjectFile(name)) return null;
28929
- if (name.split("/").some((p) => /^[^.]{1,8}~\d+(\.[^.]{0,3})?$/.test(p) || /[. ]$/.test(p))) return null;
28991
+ if (aliasPathPart(name)) return null;
28930
28992
  return name;
28931
28993
  }
28932
28994
  var same2 = (a, b) => a === void 0 && b === void 0 || a !== void 0 && b !== void 0 && a.equals(b);
@@ -28956,7 +29018,7 @@ function mergeText(ours2, base, live, liveLabel) {
28956
29018
  if (r.error || r.status === null || r.status < 0) return null;
28957
29019
  return { text: r.stdout, conflicts: r.status > 0 };
28958
29020
  } finally {
28959
- rmSync3(dir, { recursive: true, force: true });
29021
+ rmSync4(dir, { recursive: true, force: true });
28960
29022
  }
28961
29023
  }
28962
29024
  async function bringIn(root, ctx, projectId, behind) {
@@ -29070,8 +29132,8 @@ async function recordHistory(root, ctx, projectId, behind) {
29070
29132
  tip = sha2;
29071
29133
  added++;
29072
29134
  } finally {
29073
- rmSync3(tree, { recursive: true, force: true });
29074
- rmSync3(index, { force: true });
29135
+ rmSync4(tree, { recursive: true, force: true });
29136
+ rmSync4(index, { force: true });
29075
29137
  }
29076
29138
  }
29077
29139
  if (!tip) return null;
@@ -30173,8 +30235,150 @@ ${choices.brief}
30173
30235
  }
30174
30236
 
30175
30237
  // src/commands/addon.ts
30176
- import { dirname as dirname6, join as join20, resolve as resolve6 } from "path";
30177
- import { mkdirSync as mkdirSync10, existsSync as existsSync17, writeFileSync as writeFileSync16 } from "fs";
30238
+ import { dirname as dirname7, join as join21, resolve as resolve7 } from "path";
30239
+ import { mkdirSync as mkdirSync11, existsSync as existsSync18, writeFileSync as writeFileSync17 } from "fs";
30240
+
30241
+ // src/commands/addon-lanes.ts
30242
+ import { spawnSync as spawnSync5 } from "child_process";
30243
+ import { copyFileSync, existsSync as existsSync17, lstatSync as lstatSync2, mkdirSync as mkdirSync10, readdirSync as readdirSync6, rmdirSync, statSync as statSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync16 } from "fs";
30244
+ import { basename as basename2, dirname as dirname6, join as join20, resolve as resolve6 } from "path";
30245
+ var git3 = (cwd, args) => spawnSync5("git", args, { cwd, encoding: "utf8" });
30246
+ var ok = (cwd, args) => git3(cwd, args).status === 0;
30247
+ var text2 = (cwd, args) => (git3(cwd, args).stdout ?? "").trim();
30248
+ var same3 = (a, b) => resolve6(a).replace(/\\/g, "/").toLowerCase() === resolve6(b).replace(/\\/g, "/").toLowerCase();
30249
+ var LOCAL_FILES = [".env", ".env.local", ".env.production", ".dev.vars"];
30250
+ function mainFolderOf(root) {
30251
+ const common = text2(root, ["rev-parse", "--path-format=absolute", "--git-common-dir"]);
30252
+ if (!common || basename2(common) !== ".git") return null;
30253
+ const main2 = dirname6(common);
30254
+ return same3(main2, root) ? null : main2;
30255
+ }
30256
+ function laneOf(root) {
30257
+ const main2 = mainFolderOf(root);
30258
+ if (!main2) return null;
30259
+ const lane = readRun(main2)?.wave?.lanes.find((l) => same3(l.dir, root));
30260
+ return lane ? { ...lane, main: main2 } : null;
30261
+ }
30262
+ function laneRules(lane) {
30263
+ return `You are the helper of lane ${lane.name} (${lane.keys.join(", ")}), in this folder only: ${lane.dir}. The owner chose On my own, so never ask them anything: take the recommended option and list what waits for them in the report. Install the site's packages here with its own package manager; never link node_modules from another folder. Never deploy and never merge. After each add-on, commit here: git add -A, then git commit -m "<the add-on>".`;
30264
+ }
30265
+ function startWave(root, keys) {
30266
+ const w = nextAddonWave(keys);
30267
+ if (!w) return null;
30268
+ const label = `Wave ${w.wave + 1} of ${ADDON_WAVES.length}`;
30269
+ if (w.lanes.length === 1) {
30270
+ writeRun(root, { mode: "parallel" });
30271
+ out(`${label}: ${w.lanes[0].keys.join(", ")}, one after another in this folder.`);
30272
+ return w.lanes[0].keys[0];
30273
+ }
30274
+ if (!ok(root, ["rev-parse", "--is-inside-work-tree"])) throw new CliError('Running add-ons side by side needs git in this folder. Run: git init, then git add -A, then git commit -m "Before add-ons", then this command again.', 1, "no_git");
30275
+ if (text2(root, ["status", "--porcelain"])) throw new CliError('This folder has changes that are not committed. Commit them first: git add -A, then git commit -m "Before add-ons", then run this command again.', 1, "dirty");
30276
+ const base = text2(root, ["rev-parse", "HEAD"]);
30277
+ if (!base) throw new CliError('This folder has no commit yet. Run: git add -A, then git commit -m "Before add-ons", then this command again.', 1, "no_commit");
30278
+ const parent = join20(dirname6(root), `${basename2(root)}-addons`);
30279
+ const lanes = w.lanes.map((l) => ({ name: l.name, keys: l.keys, dir: join20(parent, l.name), branch: `addon/${l.name}` }));
30280
+ for (const l of lanes) {
30281
+ if (existsSync17(l.dir)) throw new CliError(`A lane folder from an earlier run is still there: ${l.dir}. Bring its work in with npx deployai@latest addons merge, or remove it with git worktree remove "${l.dir}", then run this again.`, 1, "lane_exists");
30282
+ if (ok(root, ["rev-parse", "--verify", "--quiet", `refs/heads/${l.branch}`])) throw new CliError(`The branch ${l.branch} from an earlier run is still there. Bring it in with git merge ${l.branch}, or remove it with git branch -D ${l.branch}, then run this again.`, 1, "lane_exists");
30283
+ }
30284
+ for (const l of lanes) {
30285
+ const r = git3(root, ["worktree", "add", "-b", l.branch, l.dir, base]);
30286
+ if (r.status !== 0) throw new CliError(`Could not make the lane folder ${l.dir}: ${(r.stderr || r.stdout).trim()}`, 1, "worktree");
30287
+ copyLocalFiles(root, l.dir);
30288
+ }
30289
+ writeRun(root, { mode: "parallel", wave: { number: w.wave, base, lanes } });
30290
+ out(`${label}: ${lanes.length} lanes run side by side, each in its own copy of this folder.`);
30291
+ out("Start one helper agent per lane now, all at the same time. Give each one its lane line below as its task, word for word:");
30292
+ for (const l of lanes) out(`- Lane ${l.name}: in ${l.dir}, run ${l.keys.map((k) => `npx deployai@latest addon run ${k}`).join(", then ")}, and follow what each prints.`);
30293
+ out("Each helper installs the packages in its own folder, commits after each add-on, never deploys and never asks the owner.");
30294
+ out("While they run, change nothing in this folder. Tell the owner in one line which add-ons run now. When every helper is done, run here: npx deployai@latest addons merge");
30295
+ return null;
30296
+ }
30297
+ function copyLocalFiles(from, to) {
30298
+ const dir = join20(from, DEPLOYAI_DIR);
30299
+ const files = existsSync17(dir) ? readdirSync6(dir).map((f) => join20(DEPLOYAI_DIR, f)).filter((f) => statSync3(join20(from, f)).isFile()) : [];
30300
+ for (const f of [...files, ...LOCAL_FILES]) {
30301
+ if (f === join20(DEPLOYAI_DIR, "run.json")) continue;
30302
+ if (!existsSync17(join20(from, f)) || existsSync17(join20(to, f))) continue;
30303
+ mkdirSync10(dirname6(join20(to, f)), { recursive: true });
30304
+ copyFileSync(join20(from, f), join20(to, f));
30305
+ }
30306
+ }
30307
+ function mergeStamps(root) {
30308
+ const side = (n2) => {
30309
+ try {
30310
+ return JSON.parse(text2(root, ["show", `:${n2}:${ADDON_STAMP_FILE}`]) || "{}");
30311
+ } catch {
30312
+ return null;
30313
+ }
30314
+ };
30315
+ const ours2 = side(2);
30316
+ const theirs = side(3);
30317
+ if (!ours2 || !theirs) return false;
30318
+ const merged = { ...ours2 };
30319
+ for (const [k, v] of Object.entries(theirs)) merged[k] = { ...ours2[k] ?? {}, ...v };
30320
+ writeFileSync16(join20(root, ADDON_STAMP_FILE), JSON.stringify(merged, null, 2));
30321
+ return ok(root, ["add", "--", ADDON_STAMP_FILE]);
30322
+ }
30323
+ function removeLane(root, lane) {
30324
+ const nm = join20(lane.dir, "node_modules");
30325
+ try {
30326
+ if (lstatSync2(nm).isSymbolicLink()) {
30327
+ try {
30328
+ unlinkSync2(nm);
30329
+ } catch {
30330
+ rmdirSync(nm);
30331
+ }
30332
+ }
30333
+ } catch {
30334
+ }
30335
+ git3(root, ["worktree", "remove", "--force", lane.dir]);
30336
+ git3(root, ["branch", "-D", lane.branch]);
30337
+ }
30338
+ function addonsMergeCommand(root) {
30339
+ if (laneOf(root)) throw new CliError("This is a lane folder. Run addons merge in the main folder, after every lane is done.", 1, "in_lane");
30340
+ const run = readRun(root);
30341
+ const wave = run?.wave;
30342
+ if (!wave) {
30343
+ out("No lanes are running, so there is nothing to merge. To go on: npx deployai@latest addons run --parallel");
30344
+ return;
30345
+ }
30346
+ if (ok(root, ["rev-parse", "-q", "--verify", "MERGE_HEAD"])) throw new CliError("A merge is still open in this folder. Resolve what it lists, then git add -A, then git commit --no-edit, then run npx deployai@latest addons merge again.", 1, "merge_open");
30347
+ for (const lane of wave.lanes) {
30348
+ if (existsSync17(lane.dir) && text2(lane.dir, ["status", "--porcelain"])) throw new CliError(`Lane ${lane.name} has work that is not committed in ${lane.dir}. If its helper is still working, wait for it. Else commit it there: git add -A, then git commit -m "${lane.keys.join(", ")}", then run this again.`, 1, "lane_dirty");
30349
+ if (!ok(root, ["rev-parse", "--verify", "--quiet", `refs/heads/${lane.branch}`])) throw new CliError(`The branch ${lane.branch} is missing, so lane ${lane.name} cannot come in. Run its add-ons here instead: ${lane.keys.map((k) => `npx deployai@latest addon run ${k}`).join(", then ")}.`, 1, "lane_missing");
30350
+ if (ok(root, ["merge-base", "--is-ancestor", lane.branch, "HEAD"])) continue;
30351
+ const r = git3(root, ["merge", "--no-ff", "-m", `Add-ons: ${lane.keys.join(", ")}`, lane.branch]);
30352
+ if (r.status === 0) {
30353
+ out(`Merged lane ${lane.name}: ${lane.keys.join(", ")}.`);
30354
+ continue;
30355
+ }
30356
+ const conflicted = text2(root, ["diff", "--name-only", "--diff-filter=U"]).split("\n").filter(Boolean);
30357
+ const left = conflicted.filter((f) => !(f === ADDON_STAMP_FILE && mergeStamps(root)));
30358
+ if (!conflicted.length) throw new CliError(`Could not merge lane ${lane.name}: ${(r.stderr || r.stdout).trim()}`, 1, "merge_failed");
30359
+ if (!left.length && ok(root, ["commit", "--no-edit"])) {
30360
+ out(`Merged lane ${lane.name}: ${lane.keys.join(", ")}.`);
30361
+ continue;
30362
+ }
30363
+ out(`Lane ${lane.name} (${lane.keys.join(", ")}) changed the same lines as a lane merged before it, in:`);
30364
+ left.forEach((f) => out(` ${f}`));
30365
+ out("Resolve each file so it keeps what both add-ons meant: never take one side whole. A lock file (package-lock.json, pnpm-lock.yaml, yarn.lock, bun.lock) is never edited by hand: take either side, then run the site's install to rebuild it.");
30366
+ out("Then: git add -A, then git commit --no-edit, then run npx deployai@latest addons merge again.");
30367
+ throw new CliError(`Lane ${lane.name} needs its conflicts resolved.`, 1, "merge_conflict");
30368
+ }
30369
+ for (const lane of wave.lanes) removeLane(root, lane);
30370
+ const parent = join20(dirname6(root), `${basename2(root)}-addons`);
30371
+ try {
30372
+ if (existsSync17(parent) && !readdirSync6(parent).length) rmdirSync(parent);
30373
+ } catch {
30374
+ }
30375
+ writeRun(root, { mode: "parallel" });
30376
+ const keys = wave.lanes.flatMap((l) => l.keys);
30377
+ out(`Wave ${wave.number + 1} is merged: ${keys.join(", ")}.`);
30378
+ out(`Now, in this folder: install the packages, build the site, run npx deployai@latest check, and run the "Verify with" commands of ${keys.join(", ")} again on the merged code. Fix what broke, then git add -A and git commit -m "Wave ${wave.number + 1} checked". Do not deploy. Then at once: npx deployai@latest addons run --parallel`);
30379
+ }
30380
+
30381
+ // src/commands/addon.ts
30178
30382
  function linkedProjectId2(root) {
30179
30383
  const id = readProject(root)?.projectId;
30180
30384
  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");
@@ -30210,15 +30414,23 @@ async function addonsCommand(root, ctx) {
30210
30414
  }
30211
30415
  out(`Next: ${r.next}. To run what is waiting: npx deployai@latest addons run (or one: npx deployai@latest addon run <name>)`);
30212
30416
  }
30417
+ var FINAL_PUBLISH = 'Now the one publish. Run npx deployai@latest check, then ask the owner once, naming the site and its address: "See a preview first, put it live, or not yet?" Preview first is the recommended answer. If a check waits for a preview, offer only a preview or not yet. Then run once: npx deployai@latest deploy -m "<the add-ons, in a few words>", with --live only if they chose to put it live. Run the checks that waited on that preview and fix what they find; deploy again only if a fix was needed.';
30213
30418
  async function addonsRunCommand(root, ctx, opts = {}) {
30214
30419
  requireToken(ctx);
30215
- if (opts.all && opts.oneByOne) throw new CliError("Choose one: --one-by-one or --all.", 1, "usage");
30420
+ if (laneOf(root)) throw new CliError("This is a lane folder of an add-on run. Here, run only the add-ons of this lane with npx deployai@latest addon run <name>.", 1, "in_lane");
30216
30421
  const projectId = linkedProjectId2(root);
30217
30422
  const r = await apiRequest(ctx, `/api/cli/addons?projectId=${encodeURIComponent(projectId)}`, AddonsResponse);
30218
30423
  if (!r.open) {
30219
30424
  out("The DeployAI marketplace is not open yet, so this site has no add-ons to run.");
30220
30425
  return;
30221
30426
  }
30427
+ const running = readRun(root);
30428
+ if (running?.wave) {
30429
+ out(`Wave ${running.wave.number + 1} is still running in ${running.wave.lanes.length} lanes:`);
30430
+ running.wave.lanes.forEach((l) => out(`- Lane ${l.name} (${l.keys.join(", ")}): ${l.dir}`));
30431
+ out("When every helper is done, run here: npx deployai@latest addons merge");
30432
+ return;
30433
+ }
30222
30434
  const order = opts.order === void 0 ? null : [...new Set(opts.order.split(",").map((k) => k.trim().toLowerCase()).filter(Boolean))];
30223
30435
  if (order) {
30224
30436
  const wrong = order.filter((k) => !r.addons.some((a) => a.key === k && a.owned));
@@ -30228,37 +30440,37 @@ async function addonsRunCommand(root, ctx, opts = {}) {
30228
30440
  const pickedKeys = order ?? r.picked;
30229
30441
  const todo = pickedKeys ? pickedKeys.flatMap((k) => r.addons.filter((a) => a.key === k)) : r.addons.filter((a) => a.owned && a.status !== "done" && a.status !== "skipped");
30230
30442
  if (!todo.length) {
30231
- updateProject(root, { addonsAll: false });
30443
+ writeRun(root, null);
30444
+ if (running) {
30445
+ out("The add-ons of this run are done or skipped.");
30446
+ out(FINAL_PUBLISH);
30447
+ return;
30448
+ }
30232
30449
  out(r.addons.some((a) => a.owned) ? "Every add-on of this site is done or skipped. To run one again: npx deployai@latest addon run <name>" : "This site has no add-ons yet. See them: npx deployai@latest addons");
30233
30450
  return;
30234
30451
  }
30235
30452
  requireSiteCode(root);
30236
- const all = opts.all === true || !opts.oneByOne && readProject(root)?.addonsAll === true;
30237
- if (!order && r.picked && !r.agreed && todo.length > 1 && (opts.all || !all)) {
30453
+ const checkWithMe = ownerMode(root) === "check-with-me";
30454
+ if (!order && !running && r.picked && !r.agreed && todo.length > 1) {
30238
30455
  const stamps = readStamps(root);
30239
- const items = todo.map((a) => ({ ...a, trace: addonTrace(a.key, (path) => existsSync17(join20(root, path)), stamps) }));
30240
- addonOrderBrief(items, opts.all ? "all" : opts.oneByOne ? "one-by-one" : null).forEach((line) => out(line));
30456
+ const items = todo.map((a) => ({ ...a, trace: addonTrace(a.key, (path) => existsSync18(join21(root, path)), stamps) }));
30457
+ addonOrderBrief(items, Boolean(opts.parallel) && !checkWithMe).forEach((line) => out(line));
30241
30458
  return;
30242
30459
  }
30243
- if (!all && !opts.oneByOne && todo.length > 1) {
30244
- out(`This site has ${todo.length} add-ons waiting: ${todo.map((a) => a.key).join(", ")}.`);
30245
- out("If .deployai/owner-mode says on-my-own, do not ask: run npx deployai@latest addons run --all (D-865).");
30246
- out('Else ask the owner: "Run the add-ons one by one, or all at once?"');
30247
- out("- One by one (recommended): after each add-on, choose whether to publish.");
30248
- out(" Run: npx deployai@latest addons run --one-by-one");
30249
- out("- All at once: they all finish first, then one publish at the end.");
30250
- out(" Run: npx deployai@latest addons run --all");
30251
- out("If the owner has no preference, use one by one.");
30460
+ const parallel = Boolean(opts.parallel || running?.mode === "parallel") && todo.length > 1;
30461
+ if (parallel && checkWithMe) out("Check with me runs the add-ons one after another, so the owner can approve each plan.");
30462
+ if (parallel && !checkWithMe) {
30463
+ const here = startWave(root, todo.map((a) => a.key));
30464
+ if (here) {
30465
+ out();
30466
+ await addonRunCommand(root, ctx, here);
30467
+ }
30252
30468
  return;
30253
30469
  }
30254
- updateProject(root, { addonsAll: all });
30255
- if (all) {
30256
- out(`Running every add-on of this site in one go: ${todo.map((a) => a.key).join(", ")}.`);
30257
- out('Do each one fully, build the site, run npx deployai@latest check after it, and report it with addon done as it says; the next one starts right after, without asking. Do not deploy between add-ons: tell the owner once, "I will publish once, after all the add-ons are done." The owner still approves each plan before you change any file. Tell the owner in one line which add-on you are on.');
30258
- out();
30259
- } else if (todo.length > 1) {
30260
- out(`Running the add-ons of this site one by one: ${todo.map((a) => a.key).join(", ")}.`);
30261
- out("The owner approves each plan before you change any file, and after each add-on chooses whether to publish and whether to go on.");
30470
+ writeRun(root, { mode: running?.mode === "parallel" && !checkWithMe ? "parallel" : "sequence" });
30471
+ if (todo.length > 1) {
30472
+ out(`Running the add-ons of this site one after another: ${todo.map((a) => a.key).join(", ")}.`);
30473
+ out(`Do each one fully, build the site, run npx deployai@latest check after it, commit, and report it with addon done as it says; the next one starts right after, without asking. Do not deploy between add-ons: tell the owner once, "I will publish once, after all the add-ons are done."${checkWithMe ? " The owner approves each plan before you change any file." : ""} Tell the owner in one line which add-on you are on.`);
30262
30474
  out();
30263
30475
  }
30264
30476
  await addonNextCommand(root, ctx);
@@ -30284,21 +30496,23 @@ async function addonBuyCommand(root, ctx, key2) {
30284
30496
  }
30285
30497
  function readStamps(root) {
30286
30498
  try {
30287
- return readJson(join20(root, ADDON_STAMP_FILE));
30499
+ return readJson(join21(root, ADDON_STAMP_FILE));
30288
30500
  } catch {
30289
30501
  return {};
30290
30502
  }
30291
30503
  }
30292
30504
  function writeStamps(root, stamps) {
30293
- const file2 = join20(root, ADDON_STAMP_FILE);
30294
- mkdirSync10(dirname6(file2), { recursive: true });
30295
- writeFileSync16(file2, JSON.stringify(stamps, null, 2));
30505
+ const file2 = join21(root, ADDON_STAMP_FILE);
30506
+ mkdirSync11(dirname7(file2), { recursive: true });
30507
+ writeFileSync17(file2, JSON.stringify(stamps, null, 2));
30296
30508
  }
30297
30509
  function printAddon(root, a) {
30510
+ const lane = laneOf(root);
30298
30511
  const stamps = readStamps(root);
30299
- const trace = addonTrace(a.key, (path) => existsSync17(join20(root, path)), stamps);
30512
+ const trace = addonTrace(a.key, (path) => existsSync18(join21(root, path)), stamps);
30300
30513
  writeStamps(root, { ...stamps, [a.key]: { ...stamps[a.key], runId: a.runId } });
30301
30514
  out(`DeployAI add-on ${a.position} of ${a.total}: ${a.name} (${a.key}, run ${a.runId}).`);
30515
+ if (lane) out(laneRules(lane));
30302
30516
  const line = addonTraceLine(a.key, a.runId, trace);
30303
30517
  if (line) out(line);
30304
30518
  out("Follow these instructions step by step, with the site owner:");
@@ -30330,7 +30544,7 @@ async function addonDoneCommand(root, ctx, runId, opts) {
30330
30544
  let report2;
30331
30545
  if (opts.report) {
30332
30546
  try {
30333
- report2 = readJson(resolve6(root, opts.report));
30547
+ report2 = readJson(resolve7(root, opts.report));
30334
30548
  } catch {
30335
30549
  throw new CliError(`Cannot read the report file ${opts.report} as JSON.`, 1, "usage");
30336
30550
  }
@@ -30345,22 +30559,33 @@ async function addonDoneCommand(root, ctx, runId, opts) {
30345
30559
  const key2 = Object.keys(stamps).find((k) => stamps[k]?.runId === runId.trim());
30346
30560
  if (key2) writeStamps(root, { ...stamps, [key2]: { ...stamps[key2], doneAt: (/* @__PURE__ */ new Date()).toISOString() } });
30347
30561
  }
30348
- const all = readProject(root)?.addonsAll === true;
30349
- if (r.next && all) out(`Next: ${r.next}. Do not deploy yet: everything goes up in one deploy after the last add-on. Run npx deployai@latest check, then at once: npx deployai@latest addon next`);
30562
+ const lane = laneOf(root);
30563
+ if (lane) {
30564
+ const stamps = readStamps(root);
30565
+ const key2 = Object.keys(stamps).find((k) => stamps[k]?.runId === runId.trim());
30566
+ const after = key2 ? lane.keys[lane.keys.indexOf(key2) + 1] : void 0;
30567
+ out('Commit this add-on here now: git add -A, then git commit -m "<the add-on>".');
30568
+ if (after) out(`Next in lane ${lane.name}, at once: npx deployai@latest addon run ${after}`);
30569
+ else out(`Lane ${lane.name} is done. Do not deploy and do not merge: tell the main agent this lane is done. It runs npx deployai@latest addons merge in ${lane.main} once every lane is done.`);
30570
+ return;
30571
+ }
30572
+ const run = readRun(root);
30573
+ if (run?.mode === "parallel") out('Build the site, run npx deployai@latest check, and commit: git add -A, then git commit -m "<the add-on>". Do not deploy yet. Then at once: npx deployai@latest addons run --parallel');
30574
+ else if (r.next && run) out(`Next: ${r.next}. Do not deploy yet: everything goes up in one deploy after the last add-on. Run npx deployai@latest check, commit, then at once: npx deployai@latest addon next`);
30350
30575
  else if (r.next) out(`Next: ${r.next}. Tell the site owner what is next, and only with their OK run: npx deployai@latest addon next`);
30351
30576
  else {
30352
- if (all) updateProject(root, { addonsAll: false });
30577
+ writeRun(root, null);
30353
30578
  out("The add-ons of this run are done or skipped.");
30354
- if (all) out('Now the one publish. Run npx deployai@latest check, then ask the owner once, naming the site and its address: "Put it live, see a preview first, or not yet?" If a check waits for a preview, offer only a preview or not yet. Then run once: npx deployai@latest deploy -m "<the add-ons, in a few words>", with --live only if they chose to put it live. Run the checks that waited on that preview and fix what they find; deploy again only if a fix was needed.');
30579
+ if (run) out(FINAL_PUBLISH);
30355
30580
  }
30356
30581
  }
30357
30582
 
30358
30583
  // src/commands/speed.ts
30359
30584
  import { spawn as spawn3 } from "child_process";
30360
30585
  import { createHash as createHash4 } from "crypto";
30361
- import { mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync2, readFileSync as readFileSync14, rmSync as rmSync4, writeFileSync as writeFileSync17 } from "fs";
30586
+ import { mkdirSync as mkdirSync12, mkdtempSync as mkdtempSync2, readFileSync as readFileSync14, rmSync as rmSync5, writeFileSync as writeFileSync18 } from "fs";
30362
30587
  import { tmpdir as tmpdir2 } from "os";
30363
- import { join as join21 } from "path";
30588
+ import { join as join22 } from "path";
30364
30589
  var ms = (v) => v >= 1e3 ? `${(v / 1e3).toFixed(1)} s` : `${Math.round(v)} ms`;
30365
30590
  var LOCAL_WAIT_MS = 18e4;
30366
30591
  function runLighthouse(url2, strategy, browser, file2) {
@@ -30384,16 +30609,16 @@ function runLighthouse(url2, strategy, browser, file2) {
30384
30609
  }
30385
30610
  async function localSpeed(url2, strategy, run = runLighthouse, browser = findBrowser()) {
30386
30611
  if (!browser) return null;
30387
- const dir = mkdtempSync2(join21(tmpdir2(), "deployai-speed-"));
30612
+ const dir = mkdtempSync2(join22(tmpdir2(), "deployai-speed-"));
30388
30613
  try {
30389
- const file2 = join21(dir, "report.json");
30614
+ const file2 = join22(dir, "report.json");
30390
30615
  await run(url2, strategy, browser, file2);
30391
30616
  const lighthouseResult = JSON.parse(readFileSync14(file2, "utf8"));
30392
30617
  return lighthouseResult.categories ? mapPsi({ lighthouseResult }, strategy) : null;
30393
30618
  } catch {
30394
30619
  return null;
30395
30620
  } finally {
30396
- rmSync4(dir, { recursive: true, force: true, maxRetries: 3 });
30621
+ rmSync5(dir, { recursive: true, force: true, maxRetries: 3 });
30397
30622
  }
30398
30623
  }
30399
30624
  function printReport(r, strategy, local2) {
@@ -30415,7 +30640,7 @@ function printReport(r, strategy, local2) {
30415
30640
  }
30416
30641
  }
30417
30642
  var CACHE_MS = 10 * 6e4;
30418
- var cacheFile = (dir, url2, strategy) => join21(dir, `${createHash4("sha256").update(`${strategy} ${url2}`).digest("hex").slice(0, 24)}.json`);
30643
+ var cacheFile = (dir, url2, strategy) => join22(dir, `${createHash4("sha256").update(`${strategy} ${url2}`).digest("hex").slice(0, 24)}.json`);
30419
30644
  function readCache(dir, url2, strategy) {
30420
30645
  try {
30421
30646
  return JSON.parse(readFileSync14(cacheFile(dir, url2, strategy), "utf8"));
@@ -30425,8 +30650,8 @@ function readCache(dir, url2, strategy) {
30425
30650
  }
30426
30651
  function writeCache(dir, url2, strategy, c) {
30427
30652
  try {
30428
- mkdirSync11(dir, { recursive: true });
30429
- writeFileSync17(cacheFile(dir, url2, strategy), JSON.stringify(c));
30653
+ mkdirSync12(dir, { recursive: true });
30654
+ writeFileSync18(cacheFile(dir, url2, strategy), JSON.stringify(c));
30430
30655
  } catch {
30431
30656
  }
30432
30657
  }
@@ -30442,7 +30667,7 @@ async function speedCommand(ctx, url2, opts, deps = {}) {
30442
30667
  } catch {
30443
30668
  throw new CliError(`Not an address: ${url2}. Use the full address, for example https://example.com/`, 1, "usage");
30444
30669
  }
30445
- const dir = deps.cacheDir ?? join21(tmpdir2(), "deployai-speed-cache");
30670
+ const dir = deps.cacheDir ?? join22(tmpdir2(), "deployai-speed-cache");
30446
30671
  const now = deps.now ?? Date.now;
30447
30672
  const cached2 = readCache(dir, page3, strategy);
30448
30673
  if (cached2 && now() - cached2.at < CACHE_MS) {
@@ -30500,9 +30725,9 @@ async function local(page3, strategy, deps, dir, now) {
30500
30725
 
30501
30726
  // src/commands/shot.ts
30502
30727
  import { spawn as spawn4 } from "child_process";
30503
- import { existsSync as existsSync18, mkdirSync as mkdirSync12, readFileSync as readFileSync15, rmSync as rmSync5, writeFileSync as writeFileSync18 } from "fs";
30728
+ import { existsSync as existsSync19, mkdirSync as mkdirSync13, readFileSync as readFileSync15, rmSync as rmSync6, writeFileSync as writeFileSync19 } from "fs";
30504
30729
  import { tmpdir as tmpdir3 } from "os";
30505
- import { join as join22, resolve as resolve7 } from "path";
30730
+ import { join as join23, resolve as resolve8 } from "path";
30506
30731
  var SHOT_SIZES = [{ name: "phone", size: "390,844" }, { name: "desktop", size: "1440,900" }];
30507
30732
  var PLAYWRIGHT = "playwright@1.56";
30508
30733
  var WAIT_MS3 = 18e4;
@@ -30566,19 +30791,19 @@ async function shotCommand(root, address, opts = {}, run = runNpx) {
30566
30791
  const browser = opts.webkit ? null : findBrowser();
30567
30792
  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");
30568
30793
  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");
30569
- const dir = resolve7(root, opts.out ?? join22(".deployai", "shots"));
30570
- mkdirSync12(dir, { recursive: true });
30571
- const taker = join22(tmpdir3(), "deployai-shot.cjs");
30572
- writeFileSync18(taker, TAKER);
30794
+ const dir = resolve8(root, opts.out ?? join23(".deployai", "shots"));
30795
+ mkdirSync13(dir, { recursive: true });
30796
+ const taker = join23(tmpdir3(), "deployai-shot.cjs");
30797
+ writeFileSync19(taker, TAKER);
30573
30798
  const saved = [];
30574
30799
  for (const s of SHOT_SIZES) {
30575
- const file2 = join22(dir, shotName(url2.toString(), s.name));
30800
+ const file2 = join23(dir, shotName(url2.toString(), s.name));
30576
30801
  const engine = opts.webkit ? ["--browser=webkit"] : [`--channel=${channelFor(browser)}`];
30577
- rmSync5(file2, { force: true });
30802
+ rmSync6(file2, { force: true });
30578
30803
  const code = await run(["--yes", "-p", PLAYWRIGHT, "node", taker, ...engine, `--viewport-size=${s.size}`, url2.toString(), file2]);
30579
- if (code !== 0 || !existsSync18(file2)) {
30580
- const step = existsSync18(`${file2}.step`) ? readFileSync15(`${file2}.step`, "utf8").trim() : "";
30581
- rmSync5(`${file2}.step`, { force: true });
30804
+ if (code !== 0 || !existsSync19(file2)) {
30805
+ const step = existsSync19(`${file2}.step`) ? readFileSync15(`${file2}.step`, "utf8").trim() : "";
30806
+ rmSync6(`${file2}.step`, { force: true });
30582
30807
  throw new CliError(`The ${s.name} picture of ${url2} could not be taken${step ? `, stopped at: ${step}` : code === TIMED_OUT ? ", it took over 3 minutes" : ""}. Check that the page opens, then run shot again; if it stops again, look with your own browser tool or at home.html.`, 1, "shot_failed");
30583
30808
  }
30584
30809
  saved.push(file2);
@@ -30589,26 +30814,26 @@ async function shotCommand(root, address, opts = {}, run = runNpx) {
30589
30814
  }
30590
30815
 
30591
30816
  // src/commands/images.ts
30592
- import { spawnSync as spawnSync5 } from "child_process";
30593
- import { existsSync as existsSync19, mkdirSync as mkdirSync13, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as writeFileSync19 } from "fs";
30817
+ import { spawnSync as spawnSync6 } from "child_process";
30818
+ import { existsSync as existsSync20, mkdirSync as mkdirSync14, readdirSync as readdirSync7, statSync as statSync4, writeFileSync as writeFileSync20 } from "fs";
30594
30819
  import { createRequire } from "module";
30595
30820
  import { homedir as homedir3 } from "os";
30596
- import { extname, join as join23, relative as relative4, resolve as resolve8 } from "path";
30821
+ import { extname, join as join24, relative as relative4, resolve as resolve9 } from "path";
30597
30822
  var PHONE_WIDTH = 640;
30598
30823
  var SHARP = "sharp@0.34";
30599
30824
  var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", ".git", ".deployai", "dist", ".astro", ".next"]);
30600
30825
  function imagesIn(dir) {
30601
30826
  const found = [];
30602
30827
  const walk2 = (d) => {
30603
- for (const name of readdirSync6(d)) {
30604
- const p = join23(d, name);
30605
- const st = statSync3(p);
30828
+ for (const name of readdirSync7(d)) {
30829
+ const p = join24(d, name);
30830
+ const st = statSync4(p);
30606
30831
  if (st.isDirectory()) {
30607
30832
  if (!SKIP_DIRS2.has(name)) walk2(p);
30608
30833
  } else if (/\.(jpe?g|png)$/i.test(name)) found.push(p);
30609
30834
  }
30610
30835
  };
30611
- if (existsSync19(dir)) walk2(dir);
30836
+ if (existsSync20(dir)) walk2(dir);
30612
30837
  return found.sort();
30613
30838
  }
30614
30839
  function outputsFor(file2, width) {
@@ -30618,18 +30843,18 @@ function outputsFor(file2, width) {
30618
30843
  return list;
30619
30844
  }
30620
30845
  function loadSharp() {
30621
- const dir = join23(homedir3(), ".deployai", "tools", "sharp");
30622
- if (!existsSync19(join23(dir, "node_modules", "sharp"))) {
30623
- mkdirSync13(dir, { recursive: true });
30624
- if (!existsSync19(join23(dir, "package.json"))) writeFileSync19(join23(dir, "package.json"), '{"private":true}');
30846
+ const dir = join24(homedir3(), ".deployai", "tools", "sharp");
30847
+ if (!existsSync20(join24(dir, "node_modules", "sharp"))) {
30848
+ mkdirSync14(dir, { recursive: true });
30849
+ if (!existsSync20(join24(dir, "package.json"))) writeFileSync20(join24(dir, "package.json"), '{"private":true}');
30625
30850
  out("Getting the image tool once (it stays outside the site)...");
30626
- const r = spawnSync5(process.platform === "win32" ? "npm.cmd" : "npm", ["install", SHARP, "--no-audit", "--no-fund", "--silent"], { cwd: dir, stdio: "ignore", shell: process.platform === "win32" });
30851
+ const r = spawnSync6(process.platform === "win32" ? "npm.cmd" : "npm", ["install", SHARP, "--no-audit", "--no-fund", "--silent"], { cwd: dir, stdio: "ignore", shell: process.platform === "win32" });
30627
30852
  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");
30628
30853
  }
30629
- return createRequire(join23(dir, "package.json"))("sharp");
30854
+ return createRequire(join24(dir, "package.json"))("sharp");
30630
30855
  }
30631
30856
  async function imagesCommand(root, folder, sharp = loadSharp) {
30632
- const dir = resolve8(root, folder ?? "public");
30857
+ const dir = resolve9(root, folder ?? "public");
30633
30858
  const files = imagesIn(dir);
30634
30859
  if (!files.length) {
30635
30860
  out(`No JPG or PNG images under ${relative4(root, dir) || "."}.`);
@@ -30640,10 +30865,10 @@ async function imagesCommand(root, folder, sharp = loadSharp) {
30640
30865
  let skipped = 0;
30641
30866
  let saved = 0;
30642
30867
  for (const file2 of files) {
30643
- const size = statSync3(file2).size;
30868
+ const size = statSync4(file2).size;
30644
30869
  const meta3 = await make(file2).metadata();
30645
30870
  const outputs = outputsFor(file2, meta3.width);
30646
- if (outputs.every((o) => existsSync19(o.file) && statSync3(o.file).mtimeMs >= statSync3(file2).mtimeMs)) {
30871
+ if (outputs.every((o) => existsSync20(o.file) && statSync4(o.file).mtimeMs >= statSync4(file2).mtimeMs)) {
30647
30872
  skipped++;
30648
30873
  continue;
30649
30874
  }
@@ -30663,8 +30888,8 @@ async function imagesCommand(root, folder, sharp = loadSharp) {
30663
30888
 
30664
30889
  // src/commands/blocks.ts
30665
30890
  import { createHash as createHash5 } from "crypto";
30666
- import { existsSync as existsSync20, mkdirSync as mkdirSync14, readFileSync as readFileSync16, writeFileSync as writeFileSync20 } from "fs";
30667
- import { dirname as dirname7, resolve as resolve9, sep as sep4 } from "path";
30891
+ import { existsSync as existsSync21, mkdirSync as mkdirSync15, readFileSync as readFileSync16, writeFileSync as writeFileSync21 } from "fs";
30892
+ import { dirname as dirname8, resolve as resolve10, sep as sep4 } from "path";
30668
30893
  import { gunzipSync as gunzipSync3 } from "zlib";
30669
30894
  var BLOCKS = [
30670
30895
  { key: "dashboard", title: "The site's own dashboard: messages, pages, blog, shop, images, accessibility, documents. Add --update to get a newer version" },
@@ -30674,7 +30899,7 @@ var BLOCKS = [
30674
30899
  ];
30675
30900
  var MAX_BYTES3 = 5 * 1024 * 1024;
30676
30901
  var sha = (data) => createHash5("sha256").update(data).digest("hex");
30677
- var lockPath = (base, key2) => resolve9(base, ".deployai", "blocks", `${key2}.lock.json`);
30902
+ var lockPath = (base, key2) => resolve10(base, ".deployai", "blocks", `${key2}.lock.json`);
30678
30903
  function readLock(base, key2) {
30679
30904
  try {
30680
30905
  return readJson(lockPath(base, key2));
@@ -30708,40 +30933,40 @@ async function blocksCommand(root, ctx, name, opts = {}) {
30708
30933
  } catch {
30709
30934
  throw new CliError("The block download is damaged. Try again.", 1, "api");
30710
30935
  }
30711
- const base = resolve9(root);
30936
+ const base = resolve10(root);
30712
30937
  const written = [];
30713
30938
  const kept = [];
30714
30939
  const updated = [];
30715
30940
  const lock = readLock(base, block.key);
30716
30941
  for (const e3 of entries) {
30717
30942
  if (e3.type !== "0" && e3.type !== "\0") continue;
30718
- const target = resolve9(base, e3.name);
30943
+ const target = resolve10(base, e3.name);
30719
30944
  if (target === base || !target.startsWith(base + sep4)) continue;
30720
- if (existsSync20(target)) {
30945
+ if (existsSync21(target)) {
30721
30946
  const now = sha(readFileSync16(target));
30722
30947
  if (now === sha(e3.data)) {
30723
30948
  lock[e3.name] = now;
30724
30949
  } else if (opts.update && lock[e3.name] === now) {
30725
- writeFileSync20(target, e3.data);
30950
+ writeFileSync21(target, e3.data);
30726
30951
  lock[e3.name] = sha(e3.data);
30727
30952
  updated.push(e3.name);
30728
30953
  } else {
30729
- const upstream = resolve9(base, ".deployai", "blocks", `${block.key}-upstream`, e3.name);
30954
+ const upstream = resolve10(base, ".deployai", "blocks", `${block.key}-upstream`, e3.name);
30730
30955
  if (upstream.startsWith(base + sep4)) {
30731
- mkdirSync14(dirname7(upstream), { recursive: true });
30732
- writeFileSync20(upstream, e3.data);
30956
+ mkdirSync15(dirname8(upstream), { recursive: true });
30957
+ writeFileSync21(upstream, e3.data);
30733
30958
  }
30734
30959
  kept.push(e3.name);
30735
30960
  }
30736
30961
  continue;
30737
30962
  }
30738
- mkdirSync14(dirname7(target), { recursive: true });
30739
- writeFileSync20(target, e3.data);
30963
+ mkdirSync15(dirname8(target), { recursive: true });
30964
+ writeFileSync21(target, e3.data);
30740
30965
  lock[e3.name] = sha(e3.data);
30741
30966
  written.push(e3.name);
30742
30967
  }
30743
- mkdirSync14(dirname7(lockPath(base, block.key)), { recursive: true });
30744
- writeFileSync20(lockPath(base, block.key), `${JSON.stringify(lock, null, 2)}
30968
+ mkdirSync15(dirname8(lockPath(base, block.key)), { recursive: true });
30969
+ writeFileSync21(lockPath(base, block.key), `${JSON.stringify(lock, null, 2)}
30745
30970
  `);
30746
30971
  out(`Added the ${block.key} block: ${written.length} files.`);
30747
30972
  written.forEach((f) => out(` + ${f}`));
@@ -30803,10 +31028,10 @@ async function integrationsCommand(ctx, name, opts = {}) {
30803
31028
 
30804
31029
  // src/commands/brand.ts
30805
31030
  import { spawn as spawn5 } from "child_process";
30806
- import { copyFileSync, existsSync as existsSync21, mkdirSync as mkdirSync15, mkdtempSync as mkdtempSync3, readdirSync as readdirSync7, readFileSync as readFileSync17, rmSync as rmSync6, statSync as statSync4, writeFileSync as writeFileSync21 } from "fs";
31031
+ import { copyFileSync as copyFileSync2, existsSync as existsSync22, mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync3, readdirSync as readdirSync8, readFileSync as readFileSync17, rmSync as rmSync7, statSync as statSync5, writeFileSync as writeFileSync22 } from "fs";
30807
31032
  import { createServer } from "http";
30808
31033
  import { tmpdir as tmpdir4 } from "os";
30809
- import { basename as basename2, dirname as dirname8, extname as extname2, join as join24, relative as relative5, sep as sep5 } from "path";
31034
+ import { basename as basename3, dirname as dirname9, extname as extname2, join as join25, relative as relative5, sep as sep5 } from "path";
30810
31035
  import { randomBytes } from "crypto";
30811
31036
 
30812
31037
  // src/commands/brand-page.ts
@@ -30898,22 +31123,22 @@ var WALK_CAP = 4e3;
30898
31123
  var SKIP_DIRS3 = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", "dist", "build", "out", ".astro", ".output", ".svelte-kit", ".wrangler", ".deployai"]);
30899
31124
  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" };
30900
31125
  function webRoot(root) {
30901
- for (const d of ["public", "static"]) if (existsSync21(join24(root, d))) return join24(root, d);
31126
+ for (const d of ["public", "static"]) if (existsSync22(join25(root, d))) return join25(root, d);
30902
31127
  return root;
30903
31128
  }
30904
31129
  function walk(dir, found = []) {
30905
31130
  let names;
30906
31131
  try {
30907
- names = readdirSync7(dir);
31132
+ names = readdirSync8(dir);
30908
31133
  } catch {
30909
31134
  return found;
30910
31135
  }
30911
31136
  for (const n2 of names) {
30912
31137
  if (found.length >= WALK_CAP) break;
30913
- const p = join24(dir, n2);
31138
+ const p = join25(dir, n2);
30914
31139
  let isDir = false;
30915
31140
  try {
30916
- isDir = statSync4(p).isDirectory();
31141
+ isDir = statSync5(p).isDirectory();
30917
31142
  } catch {
30918
31143
  continue;
30919
31144
  }
@@ -30925,30 +31150,30 @@ function walk(dir, found = []) {
30925
31150
  }
30926
31151
  function existingFavicon(root) {
30927
31152
  const web = webRoot(root);
30928
- for (const f of ["favicon.ico", "favicon.svg", "favicon.png", "icon.svg", "icon.png"]) if (existsSync21(join24(web, f))) return relative5(root, join24(web, f)).split(sep5).join("/");
30929
- for (const d of ["app", "src/app"]) for (const f of ["favicon.ico", "icon.svg", "icon.png", "icon.tsx", "icon.jpg"]) if (existsSync21(join24(root, d, f))) return `${d}/${f}`;
31153
+ for (const f of ["favicon.ico", "favicon.svg", "favicon.png", "icon.svg", "icon.png"]) if (existsSync22(join25(web, f))) return relative5(root, join25(web, f)).split(sep5).join("/");
31154
+ for (const d of ["app", "src/app"]) for (const f of ["favicon.ico", "icon.svg", "icon.png", "icon.tsx", "icon.jpg"]) if (existsSync22(join25(root, d, f))) return `${d}/${f}`;
30930
31155
  for (const f of walk(root).filter((p) => /\.(html|astro|tsx|jsx|vue|svelte)$/.test(p)).slice(0, 400)) {
30931
31156
  try {
30932
31157
  const m = readFileSync17(f, "utf8").match(/<link\b[^>]*\brel=["'](?:shortcut )?icon["'][^>]*>/i);
30933
31158
  if (!m) continue;
30934
31159
  const href = m[0].match(/\shref=["']([^"']+)/i)?.[1] ?? "";
30935
- if (href.startsWith("data:") || /^https?:/.test(href) || existsSync21(join24(web, href.split("?")[0]))) return relative5(root, f).split(sep5).join("/");
31160
+ if (href.startsWith("data:") || /^https?:/.test(href) || existsSync22(join25(web, href.split("?")[0]))) return relative5(root, f).split(sep5).join("/");
30936
31161
  } catch {
30937
31162
  }
30938
31163
  }
30939
31164
  return null;
30940
31165
  }
30941
31166
  function scannedIcons(root) {
30942
- const base = join24(root, MIGRATION_DIR);
30943
- if (!existsSync21(base)) return [];
31167
+ const base = join25(root, MIGRATION_DIR);
31168
+ if (!existsSync22(base)) return [];
30944
31169
  const found = [];
30945
- for (const host of readdirSync7(base)) {
30946
- const dir = join24(base, host, "icons");
31170
+ for (const host of readdirSync8(base)) {
31171
+ const dir = join25(base, host, "icons");
30947
31172
  try {
30948
- const list = readJson(join24(dir, "icons.json"));
31173
+ const list = readJson(join25(dir, "icons.json"));
30949
31174
  for (const i of list) {
30950
- const path = join24(dir, i.file);
30951
- if (!existsSync21(path)) continue;
31175
+ const path = join25(dir, i.file);
31176
+ if (!existsSync22(path)) continue;
30952
31177
  const size = imageSize(readFileSync17(path));
30953
31178
  found.push({ path, kind: i.kind, big: !size || size.width >= 64 });
30954
31179
  }
@@ -30961,7 +31186,7 @@ function findSource(root) {
30961
31186
  const icons = scannedIcons(root);
30962
31187
  const sharp = icons.find((i) => i.kind === "icon" && i.big);
30963
31188
  if (sharp) return { path: sharp.path, from: "old-icon" };
30964
- const dirs = ["public", "static", "src/assets", "assets", "images", "img"].map((d) => join24(root, d));
31189
+ const dirs = ["public", "static", "src/assets", "assets", "images", "img"].map((d) => join25(root, d));
30965
31190
  const logos = dirs.flatMap((d) => walk(d)).filter((p) => looksLikeLogo(relative5(root, p).split(sep5).join("/")));
30966
31191
  const logo = logos.find((p) => /\.svg$/i.test(p)) ?? logos[0];
30967
31192
  if (logo) return { path: logo, from: "logo" };
@@ -30981,18 +31206,18 @@ function readText2(path) {
30981
31206
  }
30982
31207
  }
30983
31208
  function scanDirs(root) {
30984
- const base = join24(root, MIGRATION_DIR);
31209
+ const base = join25(root, MIGRATION_DIR);
30985
31210
  try {
30986
- return readdirSync7(base).map((h) => join24(base, h)).filter((d) => existsSync21(join24(d, "home.html")));
31211
+ return readdirSync8(base).map((h) => join25(base, h)).filter((d) => existsSync22(join25(d, "home.html")));
30987
31212
  } catch {
30988
31213
  return [];
30989
31214
  }
30990
31215
  }
30991
31216
  function homePage(root) {
30992
- for (const d of scanDirs(root)) return readText2(join24(d, "home.html"));
31217
+ for (const d of scanDirs(root)) return readText2(join25(d, "home.html"));
30993
31218
  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"]) {
30994
- const text2 = readText2(join24(root, f));
30995
- if (text2) return text2;
31219
+ const text3 = readText2(join25(root, f));
31220
+ if (text3) return text3;
30996
31221
  }
30997
31222
  return "";
30998
31223
  }
@@ -31002,37 +31227,37 @@ function siteFacts(root, given = {}) {
31002
31227
  const id = readSiteIdentity(home);
31003
31228
  let pkg;
31004
31229
  try {
31005
- pkg = readJson(join24(root, "package.json")).name;
31230
+ pkg = readJson(join25(root, "package.json")).name;
31006
31231
  } catch {
31007
31232
  }
31008
- const name = given.name?.trim() || readProject(root)?.name || id.name || (pkg && !pkg.startsWith("@") ? pkg : "") || basename2(root);
31233
+ const name = given.name?.trim() || readProject(root)?.name || id.name || (pkg && !pkg.startsWith("@") ? pkg : "") || basename3(root);
31009
31234
  if (given.color) return { name, line: given.line ?? id.line ?? "", color: given.color, colorFrom: "given" };
31010
- const old = scanDirs(root).flatMap((d) => walkAll(join24(d, "styles")).map((f) => ({ text: readText2(f) })));
31235
+ const old = scanDirs(root).flatMap((d) => walkAll(join25(d, "styles")).map((f) => ({ text: readText2(f) })));
31011
31236
  const fromOld = scanDirs(root).length ? pickBrandColor([{ text: home, themeColor: id.themeColor }, ...old]) : null;
31012
31237
  const sources = [{ text: home, themeColor: id.themeColor }];
31013
- for (const f of ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs", "tailwind.config.cjs"]) sources.push({ text: readText2(join24(root, f)) });
31014
- const code = ["src", "app", "styles", "css", "public", "static"].flatMap((d) => walk(join24(root, d))).filter((p) => CODE_EXT2.test(p));
31015
- const plain2 = readdirSync7(root).filter((f) => CODE_EXT2.test(f)).map((f) => join24(root, f));
31238
+ for (const f of ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs", "tailwind.config.cjs"]) sources.push({ text: readText2(join25(root, f)) });
31239
+ const code = ["src", "app", "styles", "css", "public", "static"].flatMap((d) => walk(join25(root, d))).filter((p) => CODE_EXT2.test(p));
31240
+ const plain2 = readdirSync8(root).filter((f) => CODE_EXT2.test(f)).map((f) => join25(root, f));
31016
31241
  for (const f of [...plain2, ...code].slice(0, READ_CAP)) sources.push({ text: readText2(f) });
31017
31242
  const color = fromOld ?? pickBrandColor(sources);
31018
31243
  return { name, line: given.line ?? id.line ?? "", color: color ?? BRAND_DEFAULT_COLOR, colorFrom: color ? "site" : "default" };
31019
31244
  }
31020
31245
  function writeSiteFile(root, file2, data) {
31021
- const target = join24(webRoot(root), file2);
31022
- if (existsSync21(target)) {
31023
- const keep = join24(root, BRAND_DIR, "originals");
31024
- mkdirSync15(keep, { recursive: true });
31025
- copyFileSync(target, join24(keep, file2));
31246
+ const target = join25(webRoot(root), file2);
31247
+ if (existsSync22(target)) {
31248
+ const keep = join25(root, BRAND_DIR, "originals");
31249
+ mkdirSync16(keep, { recursive: true });
31250
+ copyFileSync2(target, join25(keep, file2));
31026
31251
  }
31027
- mkdirSync15(dirname8(target), { recursive: true });
31028
- writeFileSync21(target, data);
31252
+ mkdirSync16(dirname9(target), { recursive: true });
31253
+ writeFileSync22(target, data);
31029
31254
  }
31030
31255
  var send = (res, status, body = "", type = "text/plain; charset=utf-8") => {
31031
31256
  res.writeHead(status, { "content-type": type, "cache-control": "no-store", "x-content-type-options": "nosniff" });
31032
31257
  res.end(body);
31033
31258
  };
31034
31259
  function readBody(req) {
31035
- return new Promise((ok, fail) => {
31260
+ return new Promise((ok2, fail) => {
31036
31261
  const parts2 = [];
31037
31262
  let size = 0;
31038
31263
  req.on("data", (c) => {
@@ -31042,16 +31267,16 @@ function readBody(req) {
31042
31267
  fail(new Error("too large"));
31043
31268
  } else parts2.push(c);
31044
31269
  });
31045
- req.on("end", () => ok(Buffer.concat(parts2)));
31270
+ req.on("end", () => ok2(Buffer.concat(parts2)));
31046
31271
  req.on("error", fail);
31047
31272
  });
31048
31273
  }
31049
31274
  function listen(server) {
31050
- return new Promise((ok, fail) => {
31275
+ return new Promise((ok2, fail) => {
31051
31276
  server.once("error", fail);
31052
31277
  server.listen(0, "127.0.0.1", () => {
31053
31278
  const a = server.address();
31054
- if (a && typeof a === "object") ok(a.port);
31279
+ if (a && typeof a === "object") ok2(a.port);
31055
31280
  else fail(new Error("no port"));
31056
31281
  });
31057
31282
  });
@@ -31060,7 +31285,7 @@ function allowed(req, url2, port, token) {
31060
31285
  return req.headers.host === `127.0.0.1:${port}` && url2.searchParams.get("t") === token;
31061
31286
  }
31062
31287
  async function headless(browser, url2, width, until, timeoutMs) {
31063
- const profile = mkdtempSync3(join24(tmpdir4(), "deployai-brand-"));
31288
+ const profile = mkdtempSync3(join25(tmpdir4(), "deployai-brand-"));
31064
31289
  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 });
31065
31290
  child.on("error", () => {
31066
31291
  });
@@ -31080,7 +31305,7 @@ async function headless(browser, url2, width, until, timeoutMs) {
31080
31305
  setTimeout(done, 3e3);
31081
31306
  });
31082
31307
  try {
31083
- rmSync6(profile, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 });
31308
+ rmSync7(profile, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 });
31084
31309
  } catch {
31085
31310
  }
31086
31311
  }
@@ -31092,8 +31317,8 @@ async function drawInBrowser(o, browser) {
31092
31317
  let port = 0;
31093
31318
  let finish;
31094
31319
  let abort;
31095
- const finished = new Promise((ok, fail) => {
31096
- finish = ok;
31320
+ const finished = new Promise((ok2, fail) => {
31321
+ finish = ok2;
31097
31322
  abort = fail;
31098
31323
  });
31099
31324
  const allowedFiles = new Set(o.targets.map((t) => t.file));
@@ -31196,7 +31421,7 @@ function printStatus2(root, files) {
31196
31421
  const web = webRoot(root);
31197
31422
  const icon = existingFavicon(root);
31198
31423
  out(icon ? `Icon: ${icon}` : "Icon: missing. Run: npx deployai@latest brand favicon");
31199
- const missing = files.filter((f) => f !== "favicon.svg" && !existsSync21(join24(web, f)));
31424
+ const missing = files.filter((f) => f !== "favicon.svg" && !existsSync22(join25(web, f)));
31200
31425
  if (files.length) out(missing.length ? `Missing from the full set: ${missing.join(", ")}` : "The full set is there.");
31201
31426
  }
31202
31427
  function printFacts(f, picture2) {
@@ -31215,7 +31440,7 @@ function withLogoColor(facts, source) {
31215
31440
  }
31216
31441
  function pickSource(root, from) {
31217
31442
  const source = from ? { path: from, from: "file" } : findSource(root);
31218
- if (source.path && !existsSync21(source.path)) throw new CliError(`No such file: ${source.path}`, 1, "usage");
31443
+ if (source.path && !existsSync22(source.path)) throw new CliError(`No such file: ${source.path}`, 1, "usage");
31219
31444
  return source;
31220
31445
  }
31221
31446
  async function brandFaviconCommand(root, opts) {
@@ -31243,7 +31468,7 @@ async function brandFaviconCommand(root, opts) {
31243
31468
  }
31244
31469
  function iconsToDraw(root, force) {
31245
31470
  const icon = force ? null : existingFavicon(root);
31246
- const keepOg = !force && existsSync21(join24(webRoot(root), "og-image.png"));
31471
+ const keepOg = !force && existsSync22(join25(webRoot(root), "og-image.png"));
31247
31472
  return {
31248
31473
  targets: BRAND_TARGETS.filter((t) => !(keepOg && t.file === "og-image.png") && !(icon && t.icoOnly)),
31249
31474
  keepIcon: Boolean(icon),
@@ -31266,8 +31491,8 @@ async function measurePage(browser, address, width, scripts) {
31266
31491
  const token = randomBytes(24).toString("hex");
31267
31492
  let port = 0;
31268
31493
  let finish;
31269
- const finished = new Promise((ok) => {
31270
- finish = ok;
31494
+ const finished = new Promise((ok2) => {
31495
+ finish = ok2;
31271
31496
  });
31272
31497
  const res = await fetch(address, { headers: { accept: "text/html" }, signal: AbortSignal.timeout(2e4) });
31273
31498
  const page3 = await res.text();
@@ -31299,25 +31524,25 @@ async function measurePage(browser, address, width, scripts) {
31299
31524
  }
31300
31525
  }
31301
31526
  function imageFiles(root) {
31302
- const dirs = [webRoot(root) === root ? null : webRoot(root), join24(root, "src"), join24(root, MIGRATION_DIR)].filter((d) => !!d);
31527
+ const dirs = [webRoot(root) === root ? null : webRoot(root), join25(root, "src"), join25(root, MIGRATION_DIR)].filter((d) => !!d);
31303
31528
  const files = dirs.flatMap((d) => walkAll(d));
31304
31529
  if (webRoot(root) === root) files.push(...walk(root));
31305
- return [...new Set(files)].filter((p) => IMAGE_EXT.test(p) && !p.split(sep5).includes("icons") && !BRAND_FILES.includes(basename2(p)));
31530
+ return [...new Set(files)].filter((p) => IMAGE_EXT.test(p) && !p.split(sep5).includes("icons") && !BRAND_FILES.includes(basename3(p)));
31306
31531
  }
31307
31532
  function walkAll(dir) {
31308
31533
  const found = [];
31309
31534
  const go = (d) => {
31310
31535
  let names = [];
31311
31536
  try {
31312
- names = readdirSync7(d);
31537
+ names = readdirSync8(d);
31313
31538
  } catch {
31314
31539
  return;
31315
31540
  }
31316
31541
  for (const n2 of names) {
31317
31542
  if (found.length >= WALK_CAP) return;
31318
- const p = join24(d, n2);
31543
+ const p = join25(d, n2);
31319
31544
  try {
31320
- if (statSync4(p).isDirectory()) {
31545
+ if (statSync5(p).isDirectory()) {
31321
31546
  if (!SKIP_DIRS3.has(n2) || n2 === ".deployai") go(p);
31322
31547
  } else found.push(p);
31323
31548
  } catch {
@@ -31384,10 +31609,10 @@ async function brandImagesCommand(root, urls, opts) {
31384
31609
  if (verdict !== "ok") onPages.push({ where: m.src, width: m.width, height: m.height, shownWidth: m.shownWidth, verdict, alt: m.alt });
31385
31610
  }
31386
31611
  const weak = [...onPages, ...findings];
31387
- mkdirSync15(join24(root, BRAND_DIR), { recursive: true });
31612
+ mkdirSync16(join25(root, BRAND_DIR), { recursive: true });
31388
31613
  const file2 = `${BRAND_DIR}/images.json`;
31389
31614
  const data = { measuredAt: (/* @__PURE__ */ new Date()).toISOString(), pages: urls, unmeasured, filesChecked: total, imagesMeasured: shown.size, weak };
31390
- writeFileSync21(join24(root, file2), `${JSON.stringify(data, null, 2)}
31615
+ writeFileSync22(join25(root, file2), `${JSON.stringify(data, null, 2)}
31391
31616
  `);
31392
31617
  if (opts.json) {
31393
31618
  out(JSON.stringify(data));
@@ -31450,10 +31675,10 @@ function buildProgram() {
31450
31675
  if (lang === "he" || lang === "en") process.env.DEPLOYAI_LANG = lang;
31451
31676
  }).showHelpAfterError();
31452
31677
  const g = (cmd) => cmd.optsWithGlobals();
31453
- const root = (cmd) => resolve10(g(cmd).dir ?? process.cwd());
31678
+ const root = (cmd) => resolve11(g(cmd).dir ?? process.cwd());
31454
31679
  const ctx = (cmd) => apiContext(g(cmd).api, root(cmd));
31455
31680
  program.hook("preAction", async (_p, action) => {
31456
- if (["init", "start", "rules"].includes(action.name()) || !existsSync22(join25(root(action), "DEPLOYAI.md"))) return;
31681
+ if (["init", "start", "rules"].includes(action.name()) || !existsSync23(join26(root(action), "DEPLOYAI.md"))) return;
31457
31682
  await refreshRules(root(action), ctx(action).apiUrl);
31458
31683
  });
31459
31684
  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, ctx(cmd).apiUrl));
@@ -31511,10 +31736,11 @@ ${AGENT_FEEDBACK_RULES.join("\n\n")}
31511
31736
  brand.command("favicon").description("gives the site an icon if it has none: the old site's, else its logo, else a letter").option("--from <file>", "the logo or picture to use").option("--name <name>", "the site's name, for the letter").option("--color <#rrggbb>", "the background color").option("--force", "replace the icon the site has").option("--check", "only say whether the site has an icon").action((opts, cmd) => brandFaviconCommand(root(cmd), opts));
31512
31737
  brand.command("icons").description("makes every icon size and the 1200 by 630 share image from the site itself").option("--from <file>", "use this picture instead of the logo it finds").option("--name <name>", "correct the name it reads").option("--line <text>", "correct the line it reads").option("--color <#rrggbb>", "correct the color it reads").option("--check", "only list what is missing").option("--force", "redraw the site's own tab icon and share image too").action((opts, cmd) => brandIconsCommand(root(cmd), opts));
31513
31738
  brand.command("images").description("reports images too weak for where they show, by measuring them; never changes one").argument("[pages...]", "up to 10 page addresses to measure in a browser").option("--json", "print the result as JSON").action((pages, opts, cmd) => brandImagesCommand(root(cmd), pages, opts));
31514
- program.command("addons").description("the add-ons of this site: which it has, which are done and which is next; addons run prints what to agree with the owner before they run").argument("[action]", "run: the add-ons picked for this site, one by one or all at once").option("--one-by-one", "after each add-on, the owner chooses whether to publish (recommended)").option("--all", "finish every add-on first, then one publish at the end").option("--order <keys>", "the add-ons to run in the order agreed with the owner, separated by commas").action((action, opts, cmd) => {
31739
+ program.command("addons").description("the add-ons of this site: which it has, which are done and which is next; addons run prints what to agree with the owner before they run").argument("[action]", "run: the add-ons picked for this site, one after another with one publish at the end; merge: bring the lanes of a wave back in").option("--parallel", "run in waves, the lanes of each wave side by side in their own git worktrees (On my own only)").option("--order <keys>", "the add-ons to run, in the order the agent chose, separated by commas").action((action, opts, cmd) => {
31515
31740
  if (!action) return addonsCommand(root(cmd), ctx(cmd));
31516
31741
  if (action === "run") return addonsRunCommand(root(cmd), ctx(cmd), opts);
31517
- throw new CliError(`Unknown: addons ${action}. Use npx deployai@latest addons, or npx deployai@latest addons run`, 1, "usage");
31742
+ if (action === "merge") return addonsMergeCommand(root(cmd));
31743
+ throw new CliError(`Unknown: addons ${action}. Use npx deployai@latest addons, addons run or addons merge`, 1, "usage");
31518
31744
  });
31519
31745
  const addon = program.command("addon").description("run the add-ons of this site, one at a time");
31520
31746
  addon.command("next").description("print the next add-on for your agent").action((_opts, cmd) => addonNextCommand(root(cmd), ctx(cmd)));
@@ -31635,9 +31861,9 @@ function nodeGuideUrl(lang, base = API_BASE_DEFAULT) {
31635
31861
  }
31636
31862
 
31637
31863
  // src/update.ts
31638
- import { spawnSync as spawnSync6 } from "child_process";
31639
- import { existsSync as existsSync23, mkdirSync as mkdirSync16, readdirSync as readdirSync8, readFileSync as readFileSync18, rmSync as rmSync7, writeFileSync as writeFileSync22 } from "fs";
31640
- import { join as join26 } from "path";
31864
+ import { spawnSync as spawnSync7 } from "child_process";
31865
+ import { existsSync as existsSync24, mkdirSync as mkdirSync17, readdirSync as readdirSync9, readFileSync as readFileSync18, rmSync as rmSync8, writeFileSync as writeFileSync23 } from "fs";
31866
+ import { join as join27 } from "path";
31641
31867
  var CHECK_EVERY_MS = 60 * 60 * 1e3;
31642
31868
  var ASK_NPM_MS = 1500;
31643
31869
  var GET_VERSION_MS = 12e4;
@@ -31675,7 +31901,7 @@ function updateAllowed(env, args) {
31675
31901
  return resolveApiUrl(void 0, loadConfig()) === API_BASE_DEFAULT.replace(/\/+$/, "");
31676
31902
  }
31677
31903
  function statePath() {
31678
- return join26(configDir(), "update-check.json");
31904
+ return join27(configDir(), "update-check.json");
31679
31905
  }
31680
31906
  function readState() {
31681
31907
  try {
@@ -31687,8 +31913,8 @@ function readState() {
31687
31913
  }
31688
31914
  function writeState(state) {
31689
31915
  try {
31690
- mkdirSync16(configDir(), { recursive: true });
31691
- writeFileSync22(statePath(), JSON.stringify(state) + "\n");
31916
+ mkdirSync17(configDir(), { recursive: true });
31917
+ writeFileSync23(statePath(), JSON.stringify(state) + "\n");
31692
31918
  } catch {
31693
31919
  }
31694
31920
  }
@@ -31704,24 +31930,24 @@ async function askNpmLatest(env) {
31704
31930
  }
31705
31931
  }
31706
31932
  function versionEntry(version2) {
31707
- return join26(configDir(), "cli", version2, "node_modules", "deployai", "dist", "index.js");
31933
+ return join27(configDir(), "cli", version2, "node_modules", "deployai", "dist", "index.js");
31708
31934
  }
31709
31935
  function getVersion(version2, env) {
31710
31936
  process.stderr.write(`Getting the newest DeployAI CLI, version ${version2}.
31711
31937
  `);
31712
- const root = join26(configDir(), "cli");
31713
- const dir = join26(root, version2);
31714
- mkdirSync16(dir, { recursive: true });
31715
- writeFileSync22(join26(dir, "package.json"), '{"private":true}\n');
31716
- const installed = spawnSync6(`npm install deployai@${version2} --ignore-scripts --no-audit --no-fund --silent`, { cwd: dir, env, shell: true, stdio: "ignore", windowsHide: true, timeout: GET_VERSION_MS });
31938
+ const root = join27(configDir(), "cli");
31939
+ const dir = join27(root, version2);
31940
+ mkdirSync17(dir, { recursive: true });
31941
+ writeFileSync23(join27(dir, "package.json"), '{"private":true}\n');
31942
+ const installed = spawnSync7(`npm install deployai@${version2} --ignore-scripts --no-audit --no-fund --silent`, { cwd: dir, env, shell: true, stdio: "ignore", windowsHide: true, timeout: GET_VERSION_MS });
31717
31943
  if (installed.status !== 0) return false;
31718
- const ran = spawnSync6(process.execPath, [versionEntry(version2), "--version"], { env: { ...env, DEPLOYAI_NO_UPDATE: "1" }, encoding: "utf8", timeout: GET_VERSION_MS });
31944
+ const ran = spawnSync7(process.execPath, [versionEntry(version2), "--version"], { env: { ...env, DEPLOYAI_NO_UPDATE: "1" }, encoding: "utf8", timeout: GET_VERSION_MS });
31719
31945
  if (ran.status !== 0 || ran.stdout.trim() !== version2) return false;
31720
- for (const old of readdirSync8(root)) if (old !== version2) rmSync7(join26(root, old), { recursive: true, force: true });
31946
+ for (const old of readdirSync9(root)) if (old !== version2) rmSync8(join27(root, old), { recursive: true, force: true });
31721
31947
  return true;
31722
31948
  }
31723
31949
  function runVersion(version2, args, env = process.env) {
31724
- const r = spawnSync6(process.execPath, [versionEntry(version2), ...args], { stdio: "inherit", env: { ...env, DEPLOYAI_NO_UPDATE: "1" } });
31950
+ const r = spawnSync7(process.execPath, [versionEntry(version2), ...args], { stdio: "inherit", env: { ...env, DEPLOYAI_NO_UPDATE: "1" } });
31725
31951
  if (r.error) return null;
31726
31952
  return r.status ?? 1;
31727
31953
  }
@@ -31736,7 +31962,7 @@ async function versionToRun(current, args, env = process.env, deps = {}) {
31736
31962
  }
31737
31963
  const latest = state.latest;
31738
31964
  if (!latest || !PLAIN_VERSION.test(latest) || compareVersions(latest, current) <= 0) return null;
31739
- if (state.ready === latest && existsSync23(versionEntry(latest))) return latest;
31965
+ if (state.ready === latest && existsSync24(versionEntry(latest))) return latest;
31740
31966
  if (now - (state.triedAt ?? 0) < CHECK_EVERY_MS) return null;
31741
31967
  state.triedAt = now;
31742
31968
  if (get2(latest, env)) state.ready = latest;