vibedgames 0.9.0 → 0.10.0

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 (88) hide show
  1. package/README.md +3 -2
  2. package/assets/align-framing.py +242 -0
  3. package/assets/render-model.py +406 -0
  4. package/assets/tilemap-editor.html +630 -0
  5. package/dist/THIRD_PARTY_NOTICES.txt +2 -2
  6. package/dist/chunk-2KVQJKIZ.js +6495 -0
  7. package/dist/{chunk-56OY4TEP.js → chunk-2SBBKY5C.js} +1361 -4493
  8. package/dist/{chunk-FC233UKH.js → chunk-2ZKS7V72.js} +16 -16
  9. package/dist/{chunk-BMTHAVMS.js → chunk-3HGBIUM5.js} +22 -19
  10. package/dist/chunk-3UGGMFJJ.js +22 -0
  11. package/dist/{chunk-3HUWAJQH.js → chunk-42K3BJJH.js} +93 -76
  12. package/dist/{chunk-ST5FC2W3.js → chunk-43P4U7CB.js} +20 -11
  13. package/dist/chunk-4FJXCS3K.js +741 -0
  14. package/dist/{chunk-WSRIF6K4.js → chunk-4UU622RK.js} +5 -4
  15. package/dist/chunk-5YPLKGY3.js +87 -0
  16. package/dist/chunk-6KXXZXSO.js +475 -0
  17. package/dist/chunk-7RPLQWR2.js +91 -0
  18. package/dist/{chunk-ZCYWDKYP.js → chunk-A556KALN.js} +14 -13
  19. package/dist/{chunk-UFR6G6BL.js → chunk-ABTUEIRC.js} +554 -254
  20. package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
  21. package/dist/{chunk-HNRVSBRK.js → chunk-BN3Q7UEC.js} +20 -17
  22. package/dist/chunk-BZOMEG3X.js +412 -0
  23. package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
  24. package/dist/{chunk-KZBZNTM4.js → chunk-CTY2WZQK.js} +9 -13
  25. package/dist/chunk-DB7WVFS7.js +80 -0
  26. package/dist/chunk-DOOQUFPG.js +73 -0
  27. package/dist/{chunk-K2U7L4RU.js → chunk-E3FJUPLT.js} +15 -21
  28. package/dist/chunk-E7NDOZ27.js +428 -0
  29. package/dist/{chunk-TBQ5BU3Q.js → chunk-F42QKWBB.js} +18 -18
  30. package/dist/chunk-FXXVXDTW.js +168 -0
  31. package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
  32. package/dist/chunk-GLEW7VJQ.js +45 -0
  33. package/dist/{chunk-AXTLPJ2F.js → chunk-H2C4QUTG.js} +8 -7
  34. package/dist/{chunk-H3IPLBXQ.js → chunk-HRKVAXNN.js} +17 -14
  35. package/dist/{chunk-UXCWSWWX.js → chunk-HSMG6U7J.js} +8 -7
  36. package/dist/chunk-HX5Q63UA.js +48 -0
  37. package/dist/chunk-HYOXGNWS.js +53 -0
  38. package/dist/chunk-I5LELJSK.js +22 -0
  39. package/dist/{chunk-7CXMMC5S.js → chunk-JN4WZCR7.js} +5 -4
  40. package/dist/{chunk-7QZSDU52.js → chunk-K36EOII3.js} +5 -4
  41. package/dist/chunk-KAGVI3CE.js +62 -0
  42. package/dist/chunk-KJK5CB6E.js +58 -0
  43. package/dist/chunk-KLFBAFXD.js +25 -0
  44. package/dist/{chunk-355VG7EO.js → chunk-LONQWRTR.js} +107 -77
  45. package/dist/{chunk-Z5TFZQ5U.js → chunk-LORGE2NB.js} +68 -62
  46. package/dist/{chunk-LY2GQ32S.js → chunk-MEAO33XW.js} +22 -20
  47. package/dist/{chunk-OD2MNYXD.js → chunk-MR5KIFI7.js} +23 -22
  48. package/dist/{chunk-2VUUMXAQ.js → chunk-N2UHAQXC.js} +18 -11
  49. package/dist/chunk-NCX6LYNJ.js +117 -0
  50. package/dist/chunk-OGX4DKIS.js +215 -0
  51. package/dist/chunk-OPUCUUID.js +41 -0
  52. package/dist/chunk-Q2QC6KAZ.js +132 -0
  53. package/dist/{chunk-NDHXM4PL.js → chunk-Q3XQPNF6.js} +12 -12
  54. package/dist/{chunk-RXHTGX7C.js → chunk-Q5NZNXJE.js} +6 -10
  55. package/dist/chunk-QLCVLCPM.js +126 -0
  56. package/dist/chunk-R2WVORGD.js +91 -0
  57. package/dist/chunk-RKS7SI5L.js +64 -0
  58. package/dist/{chunk-US6QZICZ.js → chunk-RPJR3S5S.js} +32 -18
  59. package/dist/chunk-RPSUFZAG.js +3307 -0
  60. package/dist/chunk-RRI23NK2.js +40 -0
  61. package/dist/chunk-S7HYWITX.js +57 -0
  62. package/dist/chunk-SBXCK2I2.js +48 -0
  63. package/dist/chunk-SUSX3QIA.js +62 -0
  64. package/dist/{chunk-6EWHKL7Z.js → chunk-SXYQL4GK.js} +7 -6
  65. package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
  66. package/dist/chunk-TXOE5UY5.js +72 -0
  67. package/dist/chunk-U6DTE5IX.js +124 -0
  68. package/dist/{chunk-UZM6OSW5.js → chunk-UPHB5HWO.js} +15 -13
  69. package/dist/chunk-UQ7VO6B3.js +91 -0
  70. package/dist/chunk-VB4WLJR2.js +47 -0
  71. package/dist/{chunk-25BAMW5X.js → chunk-VIEKOGKG.js} +18 -2
  72. package/dist/{chunk-LXS3NJYD.js → chunk-VZEJ2ZHE.js} +14 -15
  73. package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
  74. package/dist/chunk-ZHLPE6LI.js +71 -0
  75. package/dist/index.js +39 -36
  76. package/package.json +31 -16
  77. package/templates/none/src/main.ts +4 -0
  78. package/templates/none/vite.config.ts +0 -2
  79. package/templates/phaser/src/main.ts +0 -1
  80. package/templates/phaser/src/scenes/game-scene.ts +10 -8
  81. package/templates/phaser/vite.config.ts +0 -2
  82. package/templates/react-r3f/src/app.tsx +3 -1
  83. package/templates/react-r3f/src/main.tsx +1 -0
  84. package/templates/react-r3f/vite.config.ts +0 -2
  85. package/templates/threejs/src/main.ts +10 -1
  86. package/templates/threejs/vite.config.ts +0 -2
  87. package/LICENSE +0 -21
  88. package/dist/chunk-J6PKNPI2.js +0 -26
@@ -0,0 +1,91 @@
1
+ import { createRequire as __createRequire } from "node:module";
2
+ import { dirname as __pathDirname } from "node:path";
3
+ import { fileURLToPath as __fileURLToPath } from "node:url";
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import {
8
+ ACTIONS,
9
+ actionFacts,
10
+ canonicalProfiles,
11
+ coerceFrameCount,
12
+ formatPythonValue,
13
+ getFlag,
14
+ getInt,
15
+ getString,
16
+ main,
17
+ parseArgs,
18
+ resolveProfile
19
+ } from "./chunk-2KVQJKIZ.js";
20
+ import "./chunk-2SBBKY5C.js";
21
+ import "./chunk-GKDUYJ7R.js";
22
+
23
+ // src/commands/asset/sprite-presets.ts
24
+ var run = (argv) => {
25
+ main(() => {
26
+ const args = parseArgs([...argv], {
27
+ booleans: ["json", "list", "list-profiles"],
28
+ values: ["action", "coerce-frames", "profile"]
29
+ });
30
+ const asJson = getFlag(args, "json");
31
+ const emit = (json = "", lines = [""]) => {
32
+ if (asJson) {
33
+ console.log(json);
34
+ return;
35
+ }
36
+ for (const line of lines) {
37
+ console.log(line);
38
+ }
39
+ };
40
+ if (getFlag(args, "list-profiles")) {
41
+ const rows = canonicalProfiles().map((key) => {
42
+ const entry = resolveProfile(key);
43
+ return {
44
+ actions: [...entry.actions],
45
+ description: entry.description,
46
+ direction: entry.direction,
47
+ profile: entry.profile
48
+ };
49
+ });
50
+ emit(
51
+ JSON.stringify(rows, null, 2),
52
+ rows.map((row) => JSON.stringify(row))
53
+ );
54
+ return;
55
+ }
56
+ const profileId = getString(args, "profile") ?? "";
57
+ const profile = profileId === "" ? null : resolveProfile(profileId);
58
+ const actionId = getString(args, "action") ?? "";
59
+ if (actionId !== "") {
60
+ const facts = actionFacts(actionId, profile);
61
+ if (getString(args, "coerce-frames") !== void 0) {
62
+ const requested = getInt(args, "coerce-frames", 0);
63
+ const { frames, warning } = coerceFrameCount(actionId, requested);
64
+ facts.requestedFrames = requested;
65
+ facts.coercedFrames = frames;
66
+ if (warning !== null && warning !== "") {
67
+ facts.frameWarning = warning;
68
+ }
69
+ }
70
+ emit(
71
+ JSON.stringify(facts, null, 2),
72
+ Object.entries({ ...facts }).map(([key, nested]) => `${key}: ${formatPythonValue(nested)}`)
73
+ );
74
+ return;
75
+ }
76
+ if (getFlag(args, "list")) {
77
+ const ids = profile === null ? Object.keys(ACTIONS) : profile.actions;
78
+ const rows = ids.map((id) => actionFacts(id, profile));
79
+ emit(
80
+ JSON.stringify(rows, null, 2),
81
+ rows.map((row) => JSON.stringify(row))
82
+ );
83
+ return;
84
+ }
85
+ console.log("Usage: vg asset sprite-presets --action <id> | --list | --list-profiles [--json]");
86
+ process.exit(2);
87
+ });
88
+ };
89
+ export {
90
+ run
91
+ };
@@ -0,0 +1,64 @@
1
+ import { createRequire as __createRequire } from "node:module";
2
+ import { dirname as __pathDirname } from "node:path";
3
+ import { fileURLToPath as __fileURLToPath } from "node:url";
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import {
8
+ failUsage,
9
+ getInt,
10
+ getString,
11
+ main,
12
+ parseArgs,
13
+ recoverFrames,
14
+ writeJsonFile
15
+ } from "./chunk-2KVQJKIZ.js";
16
+ import "./chunk-2SBBKY5C.js";
17
+ import "./chunk-GKDUYJ7R.js";
18
+
19
+ // src/commands/asset/recover-component-frames.ts
20
+ import path from "node:path";
21
+ var run = (argv) => {
22
+ main(() => {
23
+ const args = parseArgs([...argv], {
24
+ values: ["cols", "frames", "out-dir", "prefix", "rows", "threshold"]
25
+ });
26
+ const [sheet = ""] = args.positionals;
27
+ if (sheet === "") {
28
+ failUsage("A pose-board PNG path is required.");
29
+ }
30
+ const outDir = getString(args, "out-dir") ?? "";
31
+ if (outDir === "") {
32
+ failUsage("--out-dir is required");
33
+ }
34
+ const rows = getInt(args, "rows", 0);
35
+ const cols = getInt(args, "cols", 0);
36
+ if (!rows || !cols) {
37
+ failUsage("--rows and --cols are required");
38
+ }
39
+ const prefix = getString(args, "prefix") ?? "frame";
40
+ const frames = getString(args, "frames") === void 0 ? null : getInt(args, "frames", 0);
41
+ const { result, crops } = recoverFrames(sheet, {
42
+ cols,
43
+ frames,
44
+ rows,
45
+ threshold: getInt(args, "threshold", 15)
46
+ });
47
+ for (const crop of crops) {
48
+ const outPath = path.join(outDir, `${prefix}-${crop.label}.png`);
49
+ crop.image.toFile(outPath);
50
+ result.frames.push({
51
+ area: crop.area,
52
+ bbox: crop.bbox,
53
+ center: crop.center,
54
+ frame: crop.label,
55
+ path: outPath
56
+ });
57
+ }
58
+ writeJsonFile(path.join(outDir, `${prefix}-metadata.json`), result);
59
+ console.log(outDir);
60
+ });
61
+ };
62
+ export {
63
+ run
64
+ };
@@ -6,25 +6,25 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  isNewerVersion
9
- } from "./chunk-2VUUMXAQ.js";
9
+ } from "./chunk-N2UHAQXC.js";
10
+ import {
11
+ SLUG_RE,
12
+ findProjectRoot,
13
+ readProjectConfig
14
+ } from "./chunk-TMPBGXT4.js";
10
15
  import {
11
16
  getBaseUrl,
12
17
  getConfigDir
13
- } from "./chunk-RXHTGX7C.js";
18
+ } from "./chunk-Q5NZNXJE.js";
19
+ import {
20
+ defineCommand
21
+ } from "./chunk-MBXCVCC4.js";
14
22
  import {
15
23
  require_cross_spawn
16
24
  } from "./chunk-5535KDYI.js";
17
- import {
18
- SLUG_RE,
19
- findProjectRoot,
20
- readProjectConfig
21
- } from "./chunk-ZI6PKVXG.js";
22
25
  import {
23
26
  consola
24
27
  } from "./chunk-D2RF35HJ.js";
25
- import {
26
- defineCommand
27
- } from "./chunk-MBXCVCC4.js";
28
28
  import {
29
29
  __toESM
30
30
  } from "./chunk-GKDUYJ7R.js";
@@ -34,6 +34,15 @@ import { createHash } from "node:crypto";
34
34
  import { existsSync, mkdirSync, statSync, writeFileSync } from "node:fs";
35
35
  import path from "node:path";
36
36
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
37
+
38
+ // ../../packages/contract/src/deploy/game-origin.ts
39
+ var gameOrigin = (baseUrl, slug) => {
40
+ const base = new URL(baseUrl);
41
+ const host = base.host.startsWith("www.") ? base.host.slice("www.".length) : base.host;
42
+ return `${base.protocol}//${slug}.${host}`;
43
+ };
44
+
45
+ // src/commands/playtest.ts
37
46
  var PKG = "agent-browser";
38
47
  var MIN_VERSION = "0.34.0";
39
48
  var PKG_SPEC = `${PKG}@^${MIN_VERSION}`;
@@ -52,7 +61,7 @@ var installedVersion = (bin) => {
52
61
  var meetsMinimum = (version) => !isNewerVersion(MIN_VERSION, version);
53
62
  var resolveBinary = () => {
54
63
  const override = process.env.VG_AGENT_BROWSER_BIN;
55
- if (override) {
64
+ if (override !== void 0 && override !== "") {
56
65
  return existsSync(override) ? { bin: override, version: UNKNOWN_VERSION } : null;
57
66
  }
58
67
  const version = installedVersion(PKG);
@@ -92,6 +101,15 @@ var recentlyFailed = (stamp) => {
92
101
  return false;
93
102
  }
94
103
  };
104
+ var touchStamp = (stamp) => {
105
+ try {
106
+ mkdirSync(getConfigDir(), { mode: 448, recursive: true });
107
+ writeFileSync(stamp, "");
108
+ return true;
109
+ } catch {
110
+ return false;
111
+ }
112
+ };
95
113
  var ensureMinimum = (resolved) => {
96
114
  if (meetsMinimum(resolved.version)) {
97
115
  return resolved;
@@ -105,11 +123,7 @@ var ensureMinimum = (resolved) => {
105
123
  );
106
124
  const upgraded = installGlobal();
107
125
  if (!upgraded || !meetsMinimum(upgraded.version)) {
108
- try {
109
- mkdirSync(getConfigDir(), { mode: 448, recursive: true });
110
- writeFileSync(stamp, "");
111
- } catch {
112
- }
126
+ touchStamp(stamp);
113
127
  consola.warn(
114
128
  `Couldn't upgrade ${PKG}. Continuing on ${resolved.version} \u2014 run \`npm install -g ${PKG_SPEC}\` if commands misbehave.`
115
129
  );
@@ -146,7 +160,7 @@ var resolveGameUrl = (slug) => {
146
160
  );
147
161
  process.exit(1);
148
162
  }
149
- return `${base.protocol}//${resolved}.${base.host}`;
163
+ return gameOrigin(base, resolved);
150
164
  };
151
165
  var bareTokens = (args) => args.filter((arg, index) => {
152
166
  if (arg.startsWith("-")) {
@@ -208,7 +222,7 @@ var withScopedSession = (args, sessionId) => {
208
222
  if (args.includes("--session") || args.some((a) => a.startsWith("--session="))) {
209
223
  return args;
210
224
  }
211
- if (process.env.AGENT_BROWSER_SESSION) {
225
+ if (process.env.AGENT_BROWSER_SESSION !== void 0 && process.env.AGENT_BROWSER_SESSION !== "") {
212
226
  return args;
213
227
  }
214
228
  const [verb] = bareTokens(args);