@genex-ai/cli-demo 1.36.11-dev.994 → 1.36.12-dev.995

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 +42 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2671,8 +2671,11 @@ function tierFor(estVramMb) {
2671
2671
  }
2672
2672
 
2673
2673
  // src/lib/download-assets.ts
2674
+ import { createWriteStream } from "fs";
2674
2675
  import fs12 from "fs/promises";
2675
2676
  import path13 from "path";
2677
+ import { Readable } from "stream";
2678
+ import { pipeline } from "stream/promises";
2676
2679
  var RUNG_ROLE = /@\d+$/;
2677
2680
  function isPrimaryRole(role) {
2678
2681
  return !RUNG_ROLE.test(role);
@@ -2704,21 +2707,37 @@ async function downloadAssets(files, opts) {
2704
2707
  return result;
2705
2708
  }
2706
2709
  const multi = wanted.length > 1;
2707
- for (const file of wanted) {
2708
- const dest = path13.join(opts.outDir, localAssetName(opts.kind, opts.prompt, opts.id, file, multi));
2710
+ const outcomes = await Promise.all(
2711
+ wanted.map(
2712
+ (file) => saveOne(file, path13.join(opts.outDir, localAssetName(opts.kind, opts.prompt, opts.id, file, multi)))
2713
+ )
2714
+ );
2715
+ for (const outcome2 of outcomes) {
2716
+ if ("failure" in outcome2) result.failures.push(outcome2.failure);
2717
+ else result.saved.push(outcome2);
2718
+ }
2719
+ return result;
2720
+ }
2721
+ async function saveOne(file, dest) {
2722
+ try {
2723
+ const res = await fetch(file.url);
2724
+ if (!res.ok || !res.body) throw new Error(`HTTP ${res.status}`);
2725
+ let bytes = 0;
2726
+ const counted = Readable.fromWeb(res.body).on("data", (chunk) => {
2727
+ bytes += chunk.byteLength;
2728
+ });
2709
2729
  try {
2710
- const res = await fetch(file.url);
2711
- if (!res.ok) throw new Error(`HTTP ${res.status}`);
2712
- const buf = Buffer.from(await res.arrayBuffer());
2713
- await fs12.writeFile(dest, buf);
2714
- result.saved.push({ role: file.role, path: dest, url: file.url, bytes: buf.byteLength });
2730
+ await pipeline(counted, createWriteStream(dest));
2715
2731
  } catch (err) {
2716
- result.failures.push(
2717
- `${file.role}: ${err instanceof Error ? err.message : String(err)} \u2014 the asset is still live at ${file.url}`
2718
- );
2732
+ await fs12.rm(dest, { force: true });
2733
+ throw err;
2719
2734
  }
2735
+ return { role: file.role, path: dest, url: file.url, bytes };
2736
+ } catch (err) {
2737
+ return {
2738
+ failure: `${file.role}: ${err instanceof Error ? err.message : String(err)} \u2014 the asset is still live at ${file.url}`
2739
+ };
2720
2740
  }
2721
- return result;
2722
2741
  }
2723
2742
  function formatBytes(bytes) {
2724
2743
  if (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
@@ -6245,6 +6264,16 @@ async function pushSource(cwd, ctx, log, branch = "main", expectStagingCommit, o
6245
6264
  ) === true;
6246
6265
  }
6247
6266
  var WORKSPACE_SOURCE_REF = "workspace";
6267
+ function gitLfsInstallCommand(platform) {
6268
+ if (platform === "darwin") {
6269
+ return {
6270
+ bin: "brew",
6271
+ args: ["install", "git-lfs"],
6272
+ env: { HOMEBREW_NO_AUTO_UPDATE: "1", HOMEBREW_NO_INSTALL_CLEANUP: "1" }
6273
+ };
6274
+ }
6275
+ return { bin: "sudo", args: ["-n", "apt-get", "install", "-y", "git-lfs"], env: {} };
6276
+ }
6248
6277
  async function pushWorktree(cwd, pushUrl, managed, log, branch = "main", onCommit, skipSizeCheck = false, limits) {
6249
6278
  const EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
6250
6279
  const failed = () => {
@@ -6271,8 +6300,8 @@ async function pushWorktree(cwd, pushUrl, managed, log, branch = "main", onCommi
6271
6300
  let lfs = (await run("git", ["lfs", "version"], base)).code !== 0 ? false : true;
6272
6301
  if (!lfs) {
6273
6302
  log.step("Installing git-lfs (keeps large binary assets out of the source push)\u2026");
6274
- const [bin, args] = process.platform === "darwin" ? ["brew", ["install", "git-lfs"]] : ["sudo", ["-n", "apt-get", "install", "-y", "git-lfs"]];
6275
- await run(bin, args, base);
6303
+ const install2 = gitLfsInstallCommand(process.platform);
6304
+ await run(install2.bin, install2.args, { ...base, ...install2.env });
6276
6305
  lfs = (await run("git", ["lfs", "version"], base)).code === 0;
6277
6306
  if (!lfs) {
6278
6307
  log.warn(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "1.36.11-dev.994",
3
+ "version": "1.36.12-dev.995",
4
4
  "description": "Set up your project's agent workspace (.claude/.codex/.cursor in the game folder), authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {