@genex-ai/cli-demo 0.46.0-dev.67 → 0.47.0-dev.69

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 +69 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -868,6 +868,49 @@ async function writeGitignore(dir, log) {
868
868
  await fs4.writeFile(file, next);
869
869
  log.dim(`Updated .gitignore (${toAdd.join(", ")}).`);
870
870
  }
871
+ var LFS_PATTERNS = [
872
+ // models
873
+ "*.glb",
874
+ "*.gltf",
875
+ "*.bin",
876
+ "*.vrm",
877
+ "*.fbx",
878
+ "*.obj",
879
+ // textures / images
880
+ "*.png",
881
+ "*.jpg",
882
+ "*.jpeg",
883
+ "*.webp",
884
+ "*.ktx2",
885
+ "*.basis",
886
+ "*.hdr",
887
+ "*.exr",
888
+ "*.tga",
889
+ // audio / video
890
+ "*.mp3",
891
+ "*.ogg",
892
+ "*.wav",
893
+ "*.m4a",
894
+ "*.mp4",
895
+ "*.webm"
896
+ ];
897
+ async function writeGitattributes(dir, log) {
898
+ const file = path4.join(dir, ".gitattributes");
899
+ let content = "";
900
+ try {
901
+ content = await fs4.readFile(file, "utf8");
902
+ } catch {
903
+ }
904
+ const present = new Set(content.split("\n").map((l) => l.trim().split(/\s+/)[0]));
905
+ const toAdd = LFS_PATTERNS.filter((p) => !present.has(p));
906
+ if (toAdd.length === 0) return;
907
+ let next = content;
908
+ if (next.length > 0 && !next.endsWith("\n")) next += "\n";
909
+ if (!content.trim()) next += "# Binary game assets go to Git LFS (R2) \u2014 keeps the source push small\n";
910
+ next += toAdd.map((p) => `${p} filter=lfs diff=lfs merge=lfs -text`).join("\n") + "\n";
911
+ await fs4.writeFile(file, next);
912
+ log.dim(`Updated .gitattributes (${toAdd.length} binary globs \u2192 Git LFS).`);
913
+ }
871
914
 
872
915
  // src/lib/store.ts
873
916
  import fs6 from "fs/promises";
@@ -1512,6 +1555,28 @@ async function pushWorktree(cwd, pushUrl, managed, log) {
1512
1555
  ["node_modules/", "dist/", ".git/", ".genex/", ".env", ".env.*", "!.env.example", ""].join("\n")
1513
1556
  );
1514
1557
  const env = { ...base, GIT_WORK_TREE: cwd, GIT_INDEX_FILE: path10.join(gitDir, "index-source") };
1558
+ let lfs = (await run("git", ["lfs", "version"], base)).code !== 0 ? false : true;
1559
+ if (!lfs) {
1560
+ log.step("Installing git-lfs (keeps large binary assets out of the source push)\u2026");
1561
+ const [bin, args] = process.platform === "darwin" ? ["brew", ["install", "git-lfs"]] : ["sudo", ["-n", "apt-get", "install", "-y", "git-lfs"]];
1562
+ await run(bin, args, base);
1563
+ lfs = (await run("git", ["lfs", "version"], base)).code === 0;
1564
+ if (!lfs) {
1565
+ log.warn(
1566
+ "Couldn't install git-lfs \u2014 large binary assets won't be saved to your source (the game still publishes)."
1567
+ );
1568
+ }
1569
+ }
1570
+ if (lfs) {
1571
+ await writeGitattributes(cwd, log);
1572
+ const filters = [
1573
+ ["filter.lfs.clean", "git-lfs clean -- %f"],
1574
+ ["filter.lfs.smudge", "git-lfs smudge -- %f"],
1575
+ ["filter.lfs.process", "git-lfs filter-process"],
1576
+ ["filter.lfs.required", "true"]
1577
+ ];
1578
+ for (const [key, value] of filters) await run("git", ["config", key, value], base);
1579
+ }
1515
1580
  await run("git", ["add", "-A"], env);
1516
1581
  const tree = (await run("git", ["ls-files"], env)).out.trim() ? (await run("git", ["write-tree"], env)).out.trim() : "";
1517
1582
  if (!tree || tree === EMPTY_TREE) {
@@ -1520,6 +1585,10 @@ async function pushWorktree(cwd, pushUrl, managed, log) {
1520
1585
  }
1521
1586
  const commit = (await run("git", ["commit-tree", tree, "-m", "source"], { ...base, ...ident })).out.trim();
1522
1587
  await run("git", ["update-ref", "refs/heads/main", commit], base);
1588
+ if (lfs && (await run("git", ["lfs", "push", "--all", pushUrl, "main"], base)).code !== 0) {
1589
+ log.error("Couldn't upload your game's binary assets to the source store.");
1590
+ return false;
1591
+ }
1523
1592
  const push = await run(
1524
1593
  "git",
1525
1594
  ["-c", "http.postBuffer=536870912", "push", "-q", pushUrl, "+refs/heads/main:main"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "0.46.0-dev.67",
3
+ "version": "0.47.0-dev.69",
4
4
  "description": "Set up your ~/.claude workspace, authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {