deployai 0.1.0-beta.47 → 0.1.0-beta.48

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 (2) hide show
  1. package/dist/index.js +86 -42
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
 
8
8
  // src/cli.ts
9
9
  import { existsSync as existsSync22 } from "fs";
10
- import { join as join25, resolve as resolve9 } from "path";
10
+ import { join as join25, resolve as resolve10 } from "path";
11
11
  import { Command, CommanderError } from "commander";
12
12
 
13
13
  // ../shared/src/plans.ts
@@ -6516,7 +6516,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
6516
6516
  var NONE = 0;
6517
6517
  var ASSUMED = 1;
6518
6518
  var PROVEN = 2;
6519
- function isRecursive(inst, stack, resolve10) {
6519
+ function isRecursive(inst, stack, resolve11) {
6520
6520
  const cached2 = recursive.get(inst);
6521
6521
  if (cached2 !== void 0)
6522
6522
  return cached2 ? PROVEN : NONE;
@@ -6526,7 +6526,7 @@ function isRecursive(inst, stack, resolve10) {
6526
6526
  let result = NONE;
6527
6527
  const check2 = (child) => {
6528
6528
  if (result !== PROVEN && child?._zod) {
6529
- const answer = isRecursive(child, stack, resolve10);
6529
+ const answer = isRecursive(child, stack, resolve11);
6530
6530
  if (answer > result)
6531
6531
  result = answer;
6532
6532
  }
@@ -6537,7 +6537,7 @@ function isRecursive(inst, stack, resolve10) {
6537
6537
  const desc = Object.getOwnPropertyDescriptor(sh, key2);
6538
6538
  if (spread && !desc.enumerable)
6539
6539
  continue;
6540
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve10) : NONE;
6540
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve11) : NONE;
6541
6541
  if (child > answer)
6542
6542
  answer = child;
6543
6543
  }
@@ -6601,7 +6601,7 @@ function isRecursive(inst, stack, resolve10) {
6601
6601
  break;
6602
6602
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
6603
6603
  case "lazy": {
6604
- const inner = def._cachedInner ?? (resolve10 ? inst._zod.innerType : void 0);
6604
+ const inner = def._cachedInner ?? (resolve11 ? inst._zod.innerType : void 0);
6605
6605
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
6606
6606
  break;
6607
6607
  }
@@ -21199,12 +21199,12 @@ function findSecretLine(text2, re) {
21199
21199
  return null;
21200
21200
  }
21201
21201
  var PRIVATE_DIRS = /* @__PURE__ */ new Set([".deployai", ".claude", ".cursor", ".vscode", ".idea", ".git", ".github", ".husky"]);
21202
- var PRIVATE_FILES = /* @__PURE__ */ new Set(["DEPLOYAI.md", "CLAUDE.md", "AGENTS.md", ".cursorrules", ".windsurfrules"]);
21202
+ var PRIVATE_FILES = /* @__PURE__ */ new Set(["deployai.md", "claude.md", "agents.md", ".cursorrules", ".windsurfrules"]);
21203
21203
  var SERVED_DOT_DIR = ".well-known";
21204
21204
  var BUILD_DOTFILES = /* @__PURE__ */ new Set([".babelrc", ".babelrc.json", ".browserslistrc", ".postcssrc", ".postcssrc.json", ".postcssrc.js", ".postcssrc.cjs", ".postcssrc.mjs", ".swcrc", ".nvmrc", ".node-version", ".assetsignore"]);
21205
21205
  var segments = (path) => path.replace(/^\/+/, "").split("/").filter(Boolean);
21206
21206
  function privateProjectFile(path) {
21207
- const parts2 = segments(path);
21207
+ const parts2 = segments(path).map((p) => p.toLowerCase());
21208
21208
  const base = parts2[parts2.length - 1] ?? "";
21209
21209
  return PRIVATE_FILES.has(base) || parts2.slice(0, -1).some((p) => PRIVATE_DIRS.has(p)) || PRIVATE_DIRS.has(base);
21210
21210
  }
@@ -21324,6 +21324,10 @@ var AgentFeedback = external_exports.object({
21324
21324
  tried: external_exports.string().trim().max(FEEDBACK_TEXT_MAX).nullable(),
21325
21325
  suggest: external_exports.string().trim().max(FEEDBACK_TEXT_MAX).nullable()
21326
21326
  });
21327
+ var UPLOAD_PART_BYTES = 4 * 1024 * 1024;
21328
+ var MAX_DEPLOY_BYTES = 50 * 1024 * 1024;
21329
+ var MAX_UPLOAD_PARTS = Math.ceil(MAX_DEPLOY_BYTES / UPLOAD_PART_BYTES);
21330
+ var UploadPartResponse = external_exports.object({ ok: external_exports.literal(true) });
21327
21331
  var DeployResponse = external_exports.object({
21328
21332
  versionId: external_exports.string(),
21329
21333
  number: external_exports.number(),
@@ -24917,6 +24921,7 @@ var M = {
24917
24921
  deployTitle: "DeployAI deploy",
24918
24922
  guestTitle: "DeployAI deploy (no account)",
24919
24923
  uploading: "Uploading...",
24924
+ uploadingPart: "Uploading part {n} of {total}...",
24920
24925
  project: "Project",
24921
24926
  message: "Message",
24922
24927
  version: "Version",
@@ -25218,6 +25223,7 @@ var M = {
25218
25223
  deployTitle: "DeployAI deploy",
25219
25224
  guestTitle: "DeployAI deploy (\u05D1\u05DC\u05D9 \u05D7\u05E9\u05D1\u05D5\u05DF)",
25220
25225
  uploading: "\u05DE\u05E2\u05DC\u05D9\u05DD...",
25226
+ uploadingPart: "\u05DE\u05E2\u05DC\u05D9\u05DD \u05D7\u05DC\u05E7 {n} \u05DE\u05EA\u05D5\u05DA {total}...",
25221
25227
  project: "\u05D0\u05EA\u05E8",
25222
25228
  message: "\u05D4\u05D5\u05D3\u05E2\u05D4",
25223
25229
  version: "\u05D2\u05E8\u05E1\u05D4",
@@ -25513,7 +25519,7 @@ function formatBytes(n2) {
25513
25519
  }
25514
25520
 
25515
25521
  // src/version.ts
25516
- var CLI_VERSION = "0.1.0-beta.47";
25522
+ var CLI_VERSION = "0.1.0-beta.48";
25517
25523
 
25518
25524
  // src/api.ts
25519
25525
  function apiContext(apiFlag, root) {
@@ -25546,9 +25552,10 @@ function errorCode(e3) {
25546
25552
  const cause = e3?.cause;
25547
25553
  return cause?.code ?? e3?.code;
25548
25554
  }
25549
- function shouldRetry(method, failure2) {
25550
- const get2 = method === "GET";
25551
- if (typeof failure2 === "number") return get2 && (failure2 === 502 || failure2 === 503 || failure2 === 504);
25555
+ var EDGE_TIMEOUT = /* @__PURE__ */ new Set([520, 521, 522, 523, 524]);
25556
+ function shouldRetry(method, failure2, idempotent = false) {
25557
+ const get2 = method === "GET" || idempotent;
25558
+ if (typeof failure2 === "number") return get2 && (failure2 === 502 || failure2 === 503 || failure2 === 504 || EDGE_TIMEOUT.has(failure2));
25552
25559
  const code = errorCode(failure2);
25553
25560
  if (code && NEVER_SENT.has(code)) return true;
25554
25561
  if (!get2) return false;
@@ -25586,7 +25593,7 @@ async function apiRequest(ctx, path, schema, opts = {}) {
25586
25593
  } catch (e3) {
25587
25594
  failure2 = e3;
25588
25595
  }
25589
- const again = attempt < waits.length && shouldRetry(method, res ? res.status : failure2);
25596
+ const again = attempt < waits.length && shouldRetry(method, res ? res.status : failure2, opts.idempotent);
25590
25597
  if (!again) {
25591
25598
  if (!res) throw await networkError(failure2, ctx.apiUrl);
25592
25599
  break;
@@ -25603,6 +25610,7 @@ async function apiRequest(ctx, path, schema, opts = {}) {
25603
25610
  }
25604
25611
  const t = messages(process.cwd());
25605
25612
  if (res.status === 401) throw new CliError(t("sessionExpired"), 1, "auth");
25613
+ if (EDGE_TIMEOUT.has(res.status)) throw new CliError(t("timeout", { url: ctx.apiUrl }), 1, "network");
25606
25614
  if (!res.ok) {
25607
25615
  const parsed2 = ApiError.safeParse(data);
25608
25616
  if (parsed2.success && parsed2.data.error === "site_deleted") {
@@ -25767,6 +25775,8 @@ function buildTelemetryEvent(installId, command, result, errorCategory, extra =
25767
25775
  if ((result === "error" || result === "blocked") && extra.errorLine) ev.errorLine = scrubText(extra.errorLine, ERROR_LINE_MAX);
25768
25776
  return ev;
25769
25777
  }
25778
+ var TELEMETRY_WAIT_MS = 2e3;
25779
+ var TELEMETRY_ERROR_WAIT_MS = 8e3;
25770
25780
  async function sendTelemetryEvent(ctx, event) {
25771
25781
  if (!telemetryEnabled(ctx.config)) return;
25772
25782
  try {
@@ -25777,7 +25787,7 @@ async function sendTelemetryEvent(ctx, event) {
25777
25787
  method: "POST",
25778
25788
  headers,
25779
25789
  body: JSON.stringify(event),
25780
- signal: AbortSignal.timeout(2e3)
25790
+ signal: AbortSignal.timeout(event.result === "error" ? TELEMETRY_ERROR_WAIT_MS : TELEMETRY_WAIT_MS)
25781
25791
  });
25782
25792
  await res.body?.cancel().catch(() => {
25783
25793
  });
@@ -28484,6 +28494,9 @@ async function linkCommand(root, ctx, target, opts) {
28484
28494
  out(t("runLinkPick"));
28485
28495
  }
28486
28496
 
28497
+ // src/commands/deploy.ts
28498
+ import { randomUUID as randomUUID2 } from "crypto";
28499
+
28487
28500
  // src/ask.ts
28488
28501
  import { createInterface as createInterface2 } from "readline/promises";
28489
28502
  var isInteractive = () => Boolean(process.stdin.isTTY && process.stdout.isTTY);
@@ -28529,7 +28542,7 @@ function changedUnderSameName(root, files) {
28529
28542
  import { spawnSync as spawnSync3 } from "child_process";
28530
28543
  import { existsSync as existsSync15, mkdirSync as mkdirSync9, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync3, unlinkSync, writeFileSync as writeFileSync13 } from "fs";
28531
28544
  import { tmpdir } from "os";
28532
- import { dirname as dirname5, join as join17 } from "path";
28545
+ import { dirname as dirname5, join as join17, resolve as resolve4, sep as sep3 } from "path";
28533
28546
  import { gunzipSync as gunzipSync2 } from "zlib";
28534
28547
 
28535
28548
  // src/tar.ts
@@ -28642,7 +28655,7 @@ function readTar(tar) {
28642
28655
  const data = tar.subarray(offset + BLOCK, offset + BLOCK + size);
28643
28656
  offset += BLOCK + Math.ceil(size / BLOCK) * BLOCK;
28644
28657
  if (type === "x") {
28645
- const m = /\d+ path=([^\n]*)\n/.exec(data.toString("utf8"));
28658
+ const m = /(?:^|\n)\d+ path=([^\n]*)\n/.exec(data.toString("utf8"));
28646
28659
  paxPath = m ? m[1] : null;
28647
28660
  continue;
28648
28661
  }
@@ -28899,11 +28912,19 @@ var git2 = (cwd, args) => spawnSync3("git", args, { cwd, encoding: "utf8" });
28899
28912
  function filesOf(gz) {
28900
28913
  const map2 = /* @__PURE__ */ new Map();
28901
28914
  for (const e3 of readTar(gunzipSync2(gz, { maxOutputLength: 200 * 1024 * 1024 }))) {
28902
- const name = e3.name.replace(/^\.\//, "");
28903
- if (e3.type === "0" || e3.type === "" || e3.type === "\0") map2.set(name, e3.data);
28915
+ if (e3.type !== "0" && e3.type !== "" && e3.type !== "\0") continue;
28916
+ const name = safeSourceName(e3.name);
28917
+ if (name) map2.set(name, e3.data);
28904
28918
  }
28905
28919
  return map2;
28906
28920
  }
28921
+ function safeSourceName(raw) {
28922
+ const name = raw.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
28923
+ if (!name || name.startsWith("/") || /^[a-zA-Z]:/.test(name) || name.includes("\0")) return null;
28924
+ if (name.split("/").some((p) => p === ".." || p === ".")) return null;
28925
+ if (privateProjectFile(name)) return null;
28926
+ return name;
28927
+ }
28907
28928
  var same2 = (a, b) => a === void 0 && b === void 0 || a !== void 0 && b !== void 0 && a.equals(b);
28908
28929
  var isBinary = (b) => !!b && b.subarray(0, 8e3).includes(0);
28909
28930
  function migrationNumber(path) {
@@ -28949,8 +28970,10 @@ async function bringIn(root, ctx, projectId, behind) {
28949
28970
  const state = { live, base: behind.base, conflicts: [], clashes: migrationClashes(baseFiles, liveFiles, ourFiles) };
28950
28971
  let taken = 0;
28951
28972
  let merged = 0;
28973
+ const folder = resolve4(root);
28952
28974
  const write = (path, data) => {
28953
- const abs = join17(root, path);
28975
+ const abs = resolve4(folder, path);
28976
+ if (!abs.startsWith(folder + sep3)) return;
28954
28977
  if (data === void 0) {
28955
28978
  if (existsSync15(abs)) unlinkSync(abs);
28956
28979
  return;
@@ -29445,6 +29468,27 @@ function addTool(form, ctx, model) {
29445
29468
  const m = toDeployModel(model) ?? deployModelFromEnv(process.env);
29446
29469
  if (m) form.append("model", m);
29447
29470
  }
29471
+ async function attachArchive(ctx, form, projectId, archive, root) {
29472
+ if (archive.length <= UPLOAD_PART_BYTES) {
29473
+ form.append("archive", new Blob([new Uint8Array(archive)], { type: "application/gzip" }), "source.tar.gz");
29474
+ return;
29475
+ }
29476
+ const t = messages(root);
29477
+ const uploadId = randomUUID2();
29478
+ const parts2 = Math.ceil(archive.length / UPLOAD_PART_BYTES);
29479
+ for (let n2 = 0; n2 < parts2; n2++) {
29480
+ out(t("uploadingPart", { n: n2 + 1, total: parts2 }));
29481
+ const part = new FormData();
29482
+ part.append("projectId", projectId);
29483
+ part.append("uploadId", uploadId);
29484
+ part.append("part", String(n2));
29485
+ part.append("parts", String(parts2));
29486
+ part.append("data", new Blob([new Uint8Array(archive.subarray(n2 * UPLOAD_PART_BYTES, (n2 + 1) * UPLOAD_PART_BYTES))], { type: "application/octet-stream" }), `part-${n2}`);
29487
+ await apiRequest(ctx, "/api/cli/deploy/parts", UploadPartResponse, { method: "POST", form: part, idempotent: true, timeoutMs: 2 * 6e4 });
29488
+ }
29489
+ form.append("uploadId", uploadId);
29490
+ form.append("parts", String(parts2));
29491
+ }
29448
29492
  async function catchUp(root, ctx, projectId, builtOn) {
29449
29493
  const t = messages(root);
29450
29494
  const work = await checkWork(ctx, root, projectId, builtOn);
@@ -29492,7 +29536,7 @@ async function deployVersion(root, ctx, opts, guest) {
29492
29536
  addTool(form, ctx, opts.model);
29493
29537
  if (wait && soundWanted(ctx.config)) form.append("soundHere", live ? "live" : "preview");
29494
29538
  if (hold) form.append("hold", "1");
29495
- form.append("archive", new Blob([new Uint8Array(archive)], { type: "application/gzip" }), "source.tar.gz");
29539
+ await attachArchive(ctx, form, project.projectId, archive, root);
29496
29540
  const res = await apiRequest(ctx, "/api/cli/deploy", DeployResponse, { method: "POST", form, timeoutMs: 5 * 6e4 });
29497
29541
  if (!guest) {
29498
29542
  updateProject(root, { builtOn: res.number });
@@ -29875,7 +29919,7 @@ async function requestsOpenCommand(root, ctx, path, open2) {
29875
29919
  // src/commands/start.ts
29876
29920
  import { spawnSync as spawnSync4 } from "child_process";
29877
29921
  import { existsSync as existsSync16, writeFileSync as writeFileSync15 } from "fs";
29878
- import { join as join19, relative as relative3, resolve as resolve4 } from "path";
29922
+ import { join as join19, relative as relative3, resolve as resolve5 } from "path";
29879
29923
 
29880
29924
  // src/commands/starter.ts
29881
29925
  import { writeFileSync as writeFileSync14 } from "fs";
@@ -29999,7 +30043,7 @@ async function startCommand(cwd, ctx, id, opts = {}) {
29999
30043
  out(START_WAIT_LINE);
30000
30044
  out();
30001
30045
  const fresh = kind === "new" || kind === "migrate" || kind === "guest" && sample;
30002
- const here = resolve4(cwd);
30046
+ const here = resolve5(cwd);
30003
30047
  const sameSite = Boolean(choices.projectId && readProject(here)?.projectId === choices.projectId);
30004
30048
  const update = kind === "update" && Boolean(choices.projectId);
30005
30049
  const root = (fresh || update) && filesIn(here).length && !opts.here && !sameSite ? freeFolder(here, choices.slug ?? sample?.key ?? "site") : here;
@@ -30125,7 +30169,7 @@ ${choices.brief}
30125
30169
  }
30126
30170
 
30127
30171
  // src/commands/addon.ts
30128
- import { dirname as dirname6, join as join20, resolve as resolve5 } from "path";
30172
+ import { dirname as dirname6, join as join20, resolve as resolve6 } from "path";
30129
30173
  import { mkdirSync as mkdirSync10, existsSync as existsSync17, writeFileSync as writeFileSync16 } from "fs";
30130
30174
  function linkedProjectId2(root) {
30131
30175
  const id = readProject(root)?.projectId;
@@ -30282,7 +30326,7 @@ async function addonDoneCommand(root, ctx, runId, opts) {
30282
30326
  let report2;
30283
30327
  if (opts.report) {
30284
30328
  try {
30285
- report2 = readJson(resolve5(root, opts.report));
30329
+ report2 = readJson(resolve6(root, opts.report));
30286
30330
  } catch {
30287
30331
  throw new CliError(`Cannot read the report file ${opts.report} as JSON.`, 1, "usage");
30288
30332
  }
@@ -30454,7 +30498,7 @@ async function local(page3, strategy, deps, dir, now) {
30454
30498
  import { spawn as spawn4 } from "child_process";
30455
30499
  import { existsSync as existsSync18, mkdirSync as mkdirSync12, readFileSync as readFileSync15, rmSync as rmSync5, writeFileSync as writeFileSync18 } from "fs";
30456
30500
  import { tmpdir as tmpdir3 } from "os";
30457
- import { join as join22, resolve as resolve6 } from "path";
30501
+ import { join as join22, resolve as resolve7 } from "path";
30458
30502
  var SHOT_SIZES = [{ name: "phone", size: "390,844" }, { name: "desktop", size: "1440,900" }];
30459
30503
  var PLAYWRIGHT = "playwright@1.56";
30460
30504
  var WAIT_MS3 = 18e4;
@@ -30518,7 +30562,7 @@ async function shotCommand(root, address, opts = {}, run = runNpx) {
30518
30562
  const browser = opts.webkit ? null : findBrowser();
30519
30563
  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");
30520
30564
  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");
30521
- const dir = resolve6(root, opts.out ?? join22(".deployai", "shots"));
30565
+ const dir = resolve7(root, opts.out ?? join22(".deployai", "shots"));
30522
30566
  mkdirSync12(dir, { recursive: true });
30523
30567
  const taker = join22(tmpdir3(), "deployai-shot.cjs");
30524
30568
  writeFileSync18(taker, TAKER);
@@ -30545,7 +30589,7 @@ import { spawnSync as spawnSync5 } from "child_process";
30545
30589
  import { existsSync as existsSync19, mkdirSync as mkdirSync13, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as writeFileSync19 } from "fs";
30546
30590
  import { createRequire } from "module";
30547
30591
  import { homedir as homedir3 } from "os";
30548
- import { extname, join as join23, relative as relative4, resolve as resolve7 } from "path";
30592
+ import { extname, join as join23, relative as relative4, resolve as resolve8 } from "path";
30549
30593
  var PHONE_WIDTH = 640;
30550
30594
  var SHARP = "sharp@0.34";
30551
30595
  var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", ".git", ".deployai", "dist", ".astro", ".next"]);
@@ -30581,7 +30625,7 @@ function loadSharp() {
30581
30625
  return createRequire(join23(dir, "package.json"))("sharp");
30582
30626
  }
30583
30627
  async function imagesCommand(root, folder, sharp = loadSharp) {
30584
- const dir = resolve7(root, folder ?? "public");
30628
+ const dir = resolve8(root, folder ?? "public");
30585
30629
  const files = imagesIn(dir);
30586
30630
  if (!files.length) {
30587
30631
  out(`No JPG or PNG images under ${relative4(root, dir) || "."}.`);
@@ -30616,7 +30660,7 @@ async function imagesCommand(root, folder, sharp = loadSharp) {
30616
30660
  // src/commands/blocks.ts
30617
30661
  import { createHash as createHash5 } from "crypto";
30618
30662
  import { existsSync as existsSync20, mkdirSync as mkdirSync14, readFileSync as readFileSync16, writeFileSync as writeFileSync20 } from "fs";
30619
- import { dirname as dirname7, resolve as resolve8, sep as sep3 } from "path";
30663
+ import { dirname as dirname7, resolve as resolve9, sep as sep4 } from "path";
30620
30664
  import { gunzipSync as gunzipSync3 } from "zlib";
30621
30665
  var BLOCKS = [
30622
30666
  { key: "dashboard", title: "The site's own dashboard: messages, pages, blog, shop, images, accessibility, documents. Add --update to get a newer version" },
@@ -30626,7 +30670,7 @@ var BLOCKS = [
30626
30670
  ];
30627
30671
  var MAX_BYTES3 = 5 * 1024 * 1024;
30628
30672
  var sha = (data) => createHash5("sha256").update(data).digest("hex");
30629
- var lockPath = (base, key2) => resolve8(base, ".deployai", "blocks", `${key2}.lock.json`);
30673
+ var lockPath = (base, key2) => resolve9(base, ".deployai", "blocks", `${key2}.lock.json`);
30630
30674
  function readLock(base, key2) {
30631
30675
  try {
30632
30676
  return readJson(lockPath(base, key2));
@@ -30660,15 +30704,15 @@ async function blocksCommand(root, ctx, name, opts = {}) {
30660
30704
  } catch {
30661
30705
  throw new CliError("The block download is damaged. Try again.", 1, "api");
30662
30706
  }
30663
- const base = resolve8(root);
30707
+ const base = resolve9(root);
30664
30708
  const written = [];
30665
30709
  const kept = [];
30666
30710
  const updated = [];
30667
30711
  const lock = readLock(base, block.key);
30668
30712
  for (const e3 of entries) {
30669
30713
  if (e3.type !== "0" && e3.type !== "\0") continue;
30670
- const target = resolve8(base, e3.name);
30671
- if (target === base || !target.startsWith(base + sep3)) continue;
30714
+ const target = resolve9(base, e3.name);
30715
+ if (target === base || !target.startsWith(base + sep4)) continue;
30672
30716
  if (existsSync20(target)) {
30673
30717
  const now = sha(readFileSync16(target));
30674
30718
  if (now === sha(e3.data)) {
@@ -30678,8 +30722,8 @@ async function blocksCommand(root, ctx, name, opts = {}) {
30678
30722
  lock[e3.name] = sha(e3.data);
30679
30723
  updated.push(e3.name);
30680
30724
  } else {
30681
- const upstream = resolve8(base, ".deployai", "blocks", `${block.key}-upstream`, e3.name);
30682
- if (upstream.startsWith(base + sep3)) {
30725
+ const upstream = resolve9(base, ".deployai", "blocks", `${block.key}-upstream`, e3.name);
30726
+ if (upstream.startsWith(base + sep4)) {
30683
30727
  mkdirSync14(dirname7(upstream), { recursive: true });
30684
30728
  writeFileSync20(upstream, e3.data);
30685
30729
  }
@@ -30758,7 +30802,7 @@ import { spawn as spawn5 } from "child_process";
30758
30802
  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";
30759
30803
  import { createServer } from "http";
30760
30804
  import { tmpdir as tmpdir4 } from "os";
30761
- import { basename as basename2, dirname as dirname8, extname as extname2, join as join24, relative as relative5, sep as sep4 } from "path";
30805
+ import { basename as basename2, dirname as dirname8, extname as extname2, join as join24, relative as relative5, sep as sep5 } from "path";
30762
30806
  import { randomBytes } from "crypto";
30763
30807
 
30764
30808
  // src/commands/brand-page.ts
@@ -30877,14 +30921,14 @@ function walk(dir, found = []) {
30877
30921
  }
30878
30922
  function existingFavicon(root) {
30879
30923
  const web = webRoot(root);
30880
- 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(sep4).join("/");
30924
+ 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("/");
30881
30925
  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}`;
30882
30926
  for (const f of walk(root).filter((p) => /\.(html|astro|tsx|jsx|vue|svelte)$/.test(p)).slice(0, 400)) {
30883
30927
  try {
30884
30928
  const m = readFileSync17(f, "utf8").match(/<link\b[^>]*\brel=["'](?:shortcut )?icon["'][^>]*>/i);
30885
30929
  if (!m) continue;
30886
30930
  const href = m[0].match(/\shref=["']([^"']+)/i)?.[1] ?? "";
30887
- if (href.startsWith("data:") || /^https?:/.test(href) || existsSync21(join24(web, href.split("?")[0]))) return relative5(root, f).split(sep4).join("/");
30931
+ if (href.startsWith("data:") || /^https?:/.test(href) || existsSync21(join24(web, href.split("?")[0]))) return relative5(root, f).split(sep5).join("/");
30888
30932
  } catch {
30889
30933
  }
30890
30934
  }
@@ -30914,7 +30958,7 @@ function findSource(root) {
30914
30958
  const sharp = icons.find((i) => i.kind === "icon" && i.big);
30915
30959
  if (sharp) return { path: sharp.path, from: "old-icon" };
30916
30960
  const dirs = ["public", "static", "src/assets", "assets", "images", "img"].map((d) => join24(root, d));
30917
- const logos = dirs.flatMap((d) => walk(d)).filter((p) => looksLikeLogo(relative5(root, p).split(sep4).join("/")));
30961
+ const logos = dirs.flatMap((d) => walk(d)).filter((p) => looksLikeLogo(relative5(root, p).split(sep5).join("/")));
30918
30962
  const logo = logos.find((p) => /\.svg$/i.test(p)) ?? logos[0];
30919
30963
  if (logo) return { path: logo, from: "logo" };
30920
30964
  const oldLogo = icons.find((i) => i.kind === "logo");
@@ -31115,7 +31159,7 @@ function sourceBytes(path) {
31115
31159
  return { bytes: readFileSync17(path), type: TYPES[extname2(path).toLowerCase()] ?? "application/octet-stream" };
31116
31160
  }
31117
31161
  function report(root, r) {
31118
- const where = relative5(root, webRoot(root)).split(sep4).join("/") || "the site root";
31162
+ const where = relative5(root, webRoot(root)).split(sep5).join("/") || "the site root";
31119
31163
  out(`Written in ${where}: ${r.written.join(", ")}`);
31120
31164
  if (r.skipped.length) out(`Left out, the picture is too small to stay sharp: ${r.skipped.join(", ")}. A larger logo makes them.`);
31121
31165
  const tags2 = brandHeadTags(r.written);
@@ -31254,7 +31298,7 @@ function imageFiles(root) {
31254
31298
  const dirs = [webRoot(root) === root ? null : webRoot(root), join24(root, "src"), join24(root, MIGRATION_DIR)].filter((d) => !!d);
31255
31299
  const files = dirs.flatMap((d) => walkAll(d));
31256
31300
  if (webRoot(root) === root) files.push(...walk(root));
31257
- return [...new Set(files)].filter((p) => IMAGE_EXT.test(p) && !p.split(sep4).includes("icons") && !BRAND_FILES.includes(basename2(p)));
31301
+ return [...new Set(files)].filter((p) => IMAGE_EXT.test(p) && !p.split(sep5).includes("icons") && !BRAND_FILES.includes(basename2(p)));
31258
31302
  }
31259
31303
  function walkAll(dir) {
31260
31304
  const found = [];
@@ -31294,7 +31338,7 @@ function judgeFiles(root) {
31294
31338
  if (!size) continue;
31295
31339
  total++;
31296
31340
  const verdict = judgeImage({ width: size.width, height: size.height, bytes: bytes.length, format: size.format });
31297
- if (verdict !== "ok") findings.push({ where: relative5(root, f).split(sep4).join("/"), width: size.width, height: size.height, verdict });
31341
+ if (verdict !== "ok") findings.push({ where: relative5(root, f).split(sep5).join("/"), width: size.width, height: size.height, verdict });
31298
31342
  }
31299
31343
  return { findings, total };
31300
31344
  }
@@ -31402,7 +31446,7 @@ function buildProgram() {
31402
31446
  if (lang === "he" || lang === "en") process.env.DEPLOYAI_LANG = lang;
31403
31447
  }).showHelpAfterError();
31404
31448
  const g = (cmd) => cmd.optsWithGlobals();
31405
- const root = (cmd) => resolve9(g(cmd).dir ?? process.cwd());
31449
+ const root = (cmd) => resolve10(g(cmd).dir ?? process.cwd());
31406
31450
  const ctx = (cmd) => apiContext(g(cmd).api, root(cmd));
31407
31451
  program.hook("preAction", async (_p, action) => {
31408
31452
  if (["init", "start", "rules"].includes(action.name()) || !existsSync22(join25(root(action), "DEPLOYAI.md"))) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deployai",
3
- "version": "0.1.0-beta.47",
3
+ "version": "0.1.0-beta.48",
4
4
  "description": "Check a site built with an AI editor, see what has to change, and publish it to DeployAI. Hebrew first.",
5
5
  "keywords": [
6
6
  "deployai",