vibedgames 0.8.1 → 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 (96) hide show
  1. package/README.md +17 -8
  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 +59 -7
  6. package/dist/chunk-2KVQJKIZ.js +6495 -0
  7. package/dist/chunk-2SBBKY5C.js +16993 -0
  8. package/dist/chunk-2ZKS7V72.js +170 -0
  9. package/dist/{chunk-RAUJA3OY.js → chunk-3HGBIUM5.js} +21 -18
  10. package/dist/chunk-3UGGMFJJ.js +22 -0
  11. package/dist/{chunk-I6O4HIDY.js → chunk-42K3BJJH.js} +163 -131
  12. package/dist/chunk-43P4U7CB.js +104 -0
  13. package/dist/chunk-4FJXCS3K.js +741 -0
  14. package/dist/{chunk-NC5XCGYU.js → chunk-4UU622RK.js} +6 -5
  15. package/dist/{chunk-2QBYTIMH.js → chunk-5535KDYI.js} +1 -1
  16. package/dist/chunk-5YPLKGY3.js +87 -0
  17. package/dist/chunk-6KXXZXSO.js +475 -0
  18. package/dist/chunk-7RPLQWR2.js +91 -0
  19. package/dist/{chunk-C2IRIRAA.js → chunk-A556KALN.js} +15 -14
  20. package/dist/{chunk-N3XAUFKH.js → chunk-ABTUEIRC.js} +576 -301
  21. package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
  22. package/dist/{chunk-QGEITHUP.js → chunk-BN3Q7UEC.js} +22 -19
  23. package/dist/chunk-BZOMEG3X.js +412 -0
  24. package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
  25. package/dist/{chunk-PQDBCZRT.js → chunk-CTY2WZQK.js} +204 -158
  26. package/dist/{chunk-CU7UY5YJ.js → chunk-D2RF35HJ.js} +1 -1
  27. package/dist/chunk-DB7WVFS7.js +80 -0
  28. package/dist/chunk-DOOQUFPG.js +73 -0
  29. package/dist/chunk-E3FJUPLT.js +177 -0
  30. package/dist/chunk-E7NDOZ27.js +428 -0
  31. package/dist/chunk-F42QKWBB.js +39 -0
  32. package/dist/chunk-FXXVXDTW.js +168 -0
  33. package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
  34. package/dist/{chunk-CAKBGDCY.js → chunk-GKDUYJ7R.js} +5 -0
  35. package/dist/chunk-GLEW7VJQ.js +45 -0
  36. package/dist/{chunk-MGIASPED.js → chunk-H2C4QUTG.js} +9 -8
  37. package/dist/{chunk-HCMTSR7E.js → chunk-HRKVAXNN.js} +21 -17
  38. package/dist/{chunk-TLRL6FHW.js → chunk-HSMG6U7J.js} +10 -9
  39. package/dist/chunk-HX5Q63UA.js +48 -0
  40. package/dist/chunk-HYOXGNWS.js +53 -0
  41. package/dist/chunk-I5LELJSK.js +22 -0
  42. package/dist/{chunk-6FZPPUQH.js → chunk-JN4WZCR7.js} +5 -4
  43. package/dist/{chunk-QJZ72MSY.js → chunk-K36EOII3.js} +7 -6
  44. package/dist/chunk-KAGVI3CE.js +62 -0
  45. package/dist/chunk-KJK5CB6E.js +58 -0
  46. package/dist/chunk-KLFBAFXD.js +25 -0
  47. package/dist/{chunk-7MKUR7Y3.js → chunk-LONQWRTR.js} +112 -81
  48. package/dist/chunk-LORGE2NB.js +2484 -0
  49. package/dist/{chunk-HKA5LBYW.js → chunk-MEAO33XW.js} +22 -19
  50. package/dist/{chunk-PM5UOIKR.js → chunk-MR5KIFI7.js} +22 -21
  51. package/dist/{chunk-GCX5KQ6A.js → chunk-N2UHAQXC.js} +18 -11
  52. package/dist/chunk-NCX6LYNJ.js +117 -0
  53. package/dist/chunk-OGX4DKIS.js +215 -0
  54. package/dist/chunk-OPUCUUID.js +41 -0
  55. package/dist/chunk-Q2QC6KAZ.js +132 -0
  56. package/dist/{chunk-2GL2WJZX.js → chunk-Q3XQPNF6.js} +14 -14
  57. package/dist/{chunk-RYFO3ZPO.js → chunk-Q5NZNXJE.js} +15 -12
  58. package/dist/{chunk-JT2AU24K.js → chunk-QARXJGI5.js} +1 -1
  59. package/dist/chunk-QLCVLCPM.js +126 -0
  60. package/dist/chunk-R2WVORGD.js +91 -0
  61. package/dist/chunk-RKS7SI5L.js +64 -0
  62. package/dist/{chunk-4BGCA3W7.js → chunk-RPJR3S5S.js} +32 -18
  63. package/dist/chunk-RPSUFZAG.js +3307 -0
  64. package/dist/chunk-RRI23NK2.js +40 -0
  65. package/dist/chunk-S7HYWITX.js +57 -0
  66. package/dist/chunk-SBXCK2I2.js +48 -0
  67. package/dist/chunk-SUSX3QIA.js +62 -0
  68. package/dist/{chunk-PHEDW6C7.js → chunk-SXYQL4GK.js} +16 -7
  69. package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
  70. package/dist/chunk-TXOE5UY5.js +72 -0
  71. package/dist/chunk-U6DTE5IX.js +124 -0
  72. package/dist/chunk-UPHB5HWO.js +115 -0
  73. package/dist/chunk-UQ7VO6B3.js +91 -0
  74. package/dist/chunk-VB4WLJR2.js +47 -0
  75. package/dist/{chunk-FNYBZNW2.js → chunk-VIEKOGKG.js} +21 -3
  76. package/dist/{chunk-QIVCBUYD.js → chunk-VZEJ2ZHE.js} +18 -18
  77. package/dist/chunk-X75Y7LUW.js +126 -0
  78. package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
  79. package/dist/chunk-ZHLPE6LI.js +71 -0
  80. package/dist/index.js +48 -34
  81. package/package.json +32 -16
  82. package/templates/none/src/main.ts +4 -0
  83. package/templates/none/vite.config.ts +0 -2
  84. package/templates/phaser/src/main.ts +0 -1
  85. package/templates/phaser/src/scenes/game-scene.ts +10 -8
  86. package/templates/phaser/vite.config.ts +0 -2
  87. package/templates/react-r3f/src/app.tsx +3 -1
  88. package/templates/react-r3f/src/main.tsx +1 -0
  89. package/templates/react-r3f/vite.config.ts +0 -2
  90. package/templates/threejs/src/main.ts +10 -1
  91. package/templates/threejs/vite.config.ts +0 -2
  92. package/LICENSE +0 -21
  93. package/dist/chunk-AYJQVZXY.js +0 -39
  94. package/dist/chunk-J6PKNPI2.js +0 -26
  95. package/dist/chunk-MJQSHP3Y.js +0 -415
  96. package/dist/chunk-MYFLYNPO.js +0 -68
@@ -0,0 +1,132 @@
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
+ rawTool,
9
+ runRawTool
10
+ } from "./chunk-OPUCUUID.js";
11
+ import {
12
+ defineCommand
13
+ } from "./chunk-MBXCVCC4.js";
14
+ import "./chunk-D2RF35HJ.js";
15
+ import "./chunk-GKDUYJ7R.js";
16
+
17
+ // src/commands/asset.ts
18
+ var ASSET_TOOLS = {
19
+ "align-framing": {
20
+ description: "Crop or align a reference image to a render's framing (needs uv).",
21
+ load: rawTool(async () => await import("./chunk-3UGGMFJJ.js"))
22
+ },
23
+ "aseprite-inspect": {
24
+ description: "Parse an .aseprite file into JSON: frames, layers, tags, optional cel decode.",
25
+ load: rawTool(async () => await import("./chunk-ZHLPE6LI.js"))
26
+ },
27
+ "build-sequence-gif": {
28
+ description: "Assemble ordered frames into an animated GIF preview.",
29
+ load: rawTool(async () => await import("./chunk-DOOQUFPG.js"))
30
+ },
31
+ "chroma-clean": {
32
+ description: "Key out a chroma background, trim fringe and despill.",
33
+ load: rawTool(async () => await import("./chunk-OGX4DKIS.js"))
34
+ },
35
+ "image-util": {
36
+ description: "Report PNG sizes, nearest-neighbour upscale, or Lanczos resize.",
37
+ load: rawTool(async () => await import("./chunk-7RPLQWR2.js"))
38
+ },
39
+ "manifest-check": {
40
+ description: "Check an asset manifest against the files on disk.",
41
+ load: rawTool(async () => await import("./chunk-KAGVI3CE.js"))
42
+ },
43
+ "manifest-export-json": {
44
+ description: "Convert an assets_index.lua manifest to JSON.",
45
+ load: rawTool(async () => await import("./chunk-GLEW7VJQ.js"))
46
+ },
47
+ "normalize-canvas": {
48
+ description: "Pad frames to one canvas size with a shared baseline.",
49
+ load: rawTool(async () => await import("./chunk-TXOE5UY5.js"))
50
+ },
51
+ "normalize-factory": {
52
+ description: "Strip generator metadata from image-to-threejs factory output.",
53
+ load: rawTool(async () => await import("./chunk-5YPLKGY3.js"))
54
+ },
55
+ "pack-spritesheet": {
56
+ description: "Pack a folder of frames into a spritesheet plus JSON.",
57
+ load: rawTool(async () => await import("./chunk-VB4WLJR2.js"))
58
+ },
59
+ "pixel-snapper": {
60
+ description: "Snap a generated image onto a true pixel grid with a reduced palette.",
61
+ load: rawTool(async () => await import("./chunk-HYOXGNWS.js"))
62
+ },
63
+ "pixel-snapper-sheet": {
64
+ description: "Pixel-snap each cell of a known-layout spritesheet.",
65
+ load: rawTool(async () => await import("./chunk-S7HYWITX.js"))
66
+ },
67
+ "process-sheet": {
68
+ description: "Turn a generated pose board into clean, aligned animation frames.",
69
+ load: rawTool(async () => await import("./chunk-U6DTE5IX.js"))
70
+ },
71
+ "recover-component-frames": {
72
+ description: "Recover frames from a pose board by connected components.",
73
+ load: rawTool(async () => await import("./chunk-RKS7SI5L.js"))
74
+ },
75
+ "ref-sxs": {
76
+ description: "Put a reference shot beside a capture, plus a blurred twin.",
77
+ load: rawTool(async () => await import("./chunk-UQ7VO6B3.js"))
78
+ },
79
+ "render-model": {
80
+ description: "Render a three.js factory from fixed cameras for review (needs uv).",
81
+ load: rawTool(async () => await import("./chunk-I5LELJSK.js"))
82
+ },
83
+ "sheet-probe": {
84
+ description: "Probe a spritesheet or folder for frame grid and empty cells.",
85
+ load: rawTool(async () => await import("./chunk-KJK5CB6E.js"))
86
+ },
87
+ "sheet-qc": {
88
+ description: "Quality-check a spritesheet: frame drift, clipping, jitter.",
89
+ load: rawTool(async () => await import("./chunk-SUSX3QIA.js"))
90
+ },
91
+ "size-contract": {
92
+ description: "Derive, audit or prompt for a sprite size contract.",
93
+ load: rawTool(async () => await import("./chunk-QLCVLCPM.js"))
94
+ },
95
+ sizes: {
96
+ description: "List every image's dimensions under a folder (CSV/JSON).",
97
+ load: rawTool(async () => await import("./chunk-HX5Q63UA.js"))
98
+ },
99
+ "sprite-baseline": {
100
+ description: "Measure or fix sprites' feet baseline and centre.",
101
+ load: rawTool(async () => await import("./chunk-DB7WVFS7.js"))
102
+ },
103
+ "sprite-presets": {
104
+ description: "List animation presets: frames, timing and poses per action.",
105
+ load: rawTool(async () => await import("./chunk-R2WVORGD.js"))
106
+ },
107
+ "sprite-prompt": {
108
+ description: "Write the generation prompt for a sprite anchor or pose board.",
109
+ load: rawTool(async () => await import("./chunk-NCX6LYNJ.js"))
110
+ },
111
+ "tilemap-editor": {
112
+ description: "Edit a tilemap in the browser, or export tileset grids and map renders.",
113
+ load: rawTool(async () => await import("./chunk-FXXVXDTW.js"))
114
+ }
115
+ };
116
+ var runAsset = async (argv) => {
117
+ await runRawTool("asset", ASSET_TOOLS, argv);
118
+ };
119
+ var assetCommand = defineCommand({
120
+ meta: {
121
+ description: "Local image, sprite and tilemap tools the skills run (`vg asset --help` lists them). All arguments pass through to the tool.",
122
+ name: "asset"
123
+ },
124
+ run: async ({ rawArgs }) => {
125
+ await runAsset(rawArgs);
126
+ }
127
+ });
128
+ export {
129
+ ASSET_TOOLS,
130
+ assetCommand,
131
+ runAsset
132
+ };
@@ -4,6 +4,9 @@ import { fileURLToPath as __fileURLToPath } from "node:url";
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
+ import {
8
+ assertKnownFlags
9
+ } from "./chunk-RZ4DIJQW.js";
7
10
  import {
8
11
  SETTINGS,
9
12
  SETTING_KEYS,
@@ -13,23 +16,21 @@ import {
13
16
  saveSetting,
14
17
  settingsPath,
15
18
  validate
16
- } from "./chunk-6FZPPUQH.js";
19
+ } from "./chunk-JN4WZCR7.js";
20
+ import "./chunk-Q5NZNXJE.js";
17
21
  import {
18
22
  outputArgs,
19
23
  writeStructured
20
- } from "./chunk-ZYCSYJWX.js";
21
- import {
22
- assertKnownFlags
23
- } from "./chunk-RZ4DIJQW.js";
24
- import "./chunk-RYFO3ZPO.js";
25
- import {
26
- consola
27
- } from "./chunk-CU7UY5YJ.js";
28
- import "./chunk-J6PKNPI2.js";
24
+ } from "./chunk-COSLGSVO.js";
29
25
  import {
30
26
  defineCommand
31
27
  } from "./chunk-MBXCVCC4.js";
32
- import "./chunk-CAKBGDCY.js";
28
+ import {
29
+ consola
30
+ } from "./chunk-D2RF35HJ.js";
31
+ import "./chunk-RPSUFZAG.js";
32
+ import "./chunk-2SBBKY5C.js";
33
+ import "./chunk-GKDUYJ7R.js";
33
34
 
34
35
  // src/commands/config.ts
35
36
  var keyArg = {
@@ -42,7 +43,7 @@ var requireKey = (key) => {
42
43
  return key;
43
44
  }
44
45
  consola.error(`Unknown setting: ${key}. Settings: ${SETTING_KEYS.join(", ")}.`);
45
- process.exit(1);
46
+ return process.exit(1);
46
47
  };
47
48
  var describeSource = (setting) => {
48
49
  if (setting.source === "env") {
@@ -120,7 +121,7 @@ var setCommand = defineCommand({
120
121
  const key = requireKey(args.key);
121
122
  const value = args.value.trim();
122
123
  const problem = validate(key, value);
123
- if (problem) {
124
+ if (problem !== null && problem !== "") {
124
125
  consola.error(problem);
125
126
  process.exit(1);
126
127
  }
@@ -153,7 +154,6 @@ var unsetCommand = defineCommand({
153
154
  }
154
155
  });
155
156
  var configCommand = defineCommand({
156
- // Declared so citty skips `--field <value>` when looking for a subcommand.
157
157
  args: outputArgs,
158
158
  default: "list",
159
159
  meta: {
@@ -5,9 +5,11 @@ const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
+ isJsonNumber,
8
9
  isJsonObject,
9
- isJsonString
10
- } from "./chunk-J6PKNPI2.js";
10
+ isJsonString,
11
+ parseJson
12
+ } from "./chunk-RPSUFZAG.js";
11
13
 
12
14
  // src/lib/config.ts
13
15
  import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
@@ -26,18 +28,23 @@ var getConfig = () => {
26
28
  }
27
29
  let raw;
28
30
  try {
29
- raw = JSON.parse(readFileSync(file, "utf-8"));
31
+ raw = parseJson(readFileSync(file, "utf-8"));
30
32
  } catch {
31
33
  return null;
32
34
  }
33
35
  if (!isJsonObject(raw)) {
34
36
  return null;
35
37
  }
36
- const { token, baseUrl } = raw;
38
+ const { baseUrl, expiresAt, refreshToken, token } = raw;
37
39
  if (!isJsonString(token) || !isJsonString(baseUrl)) {
38
40
  return null;
39
41
  }
40
- return { baseUrl, token };
42
+ return {
43
+ baseUrl,
44
+ expiresAt: isJsonNumber(expiresAt) ? expiresAt : void 0,
45
+ refreshToken: isJsonString(refreshToken) ? refreshToken : void 0,
46
+ token
47
+ };
41
48
  };
42
49
  var saveConfig = (config) => {
43
50
  const dir = getConfigDir();
@@ -54,16 +61,12 @@ var clearConfig = () => {
54
61
  unlinkSync(file);
55
62
  }
56
63
  };
57
- var getBaseUrl = () => process.env.VG_API_URL ?? getConfig()?.baseUrl ?? "https://vibedgames.com";
58
- var getToken = () => (
59
- // VG_TOKEN lets local/CI runs authenticate without touching the saved
60
- // login (e.g. a seeded dev session), so headless testing never clobbers
61
- // the user's real `vg login` credentials.
62
- process.env.VG_TOKEN ?? getConfig()?.token ?? null
63
- );
64
+ var getBaseUrl = () => process.env.VG_API_URL ?? getConfig()?.baseUrl ?? "https://www.vibedgames.com";
65
+ var getToken = () => process.env.VG_TOKEN ?? getConfig()?.token ?? null;
64
66
 
65
67
  export {
66
68
  getConfigDir,
69
+ getConfig,
67
70
  saveConfig,
68
71
  clearConfig,
69
72
  getBaseUrl,
@@ -4,7 +4,7 @@ import { fileURLToPath as __fileURLToPath } from "node:url";
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import "./chunk-CAKBGDCY.js";
7
+ import "./chunk-GKDUYJ7R.js";
8
8
 
9
9
  // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
10
10
  import g, { stdin, stdout } from "node:process";
@@ -0,0 +1,126 @@
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
+ FRAME_HEIGHT,
9
+ FRAME_WIDTH,
10
+ auditSizeContract,
11
+ deriveSizeContract,
12
+ fail,
13
+ failUsage,
14
+ getFlag,
15
+ getString,
16
+ loadSizeContract,
17
+ main,
18
+ parseArgs,
19
+ parseJsonText,
20
+ promptGuidanceForContract,
21
+ toPythonJson,
22
+ writeJsonFile
23
+ } from "./chunk-2KVQJKIZ.js";
24
+ import "./chunk-2SBBKY5C.js";
25
+ import "./chunk-GKDUYJ7R.js";
26
+
27
+ // src/commands/asset/size-contract.ts
28
+ import { readFileSync } from "node:fs";
29
+ var leadingInteger = (text = "") => Number(/^\s*[+-]?\d+/u.exec(text)?.[0] ?? Number.NaN);
30
+ var parseCell = (value = "") => {
31
+ const parts = value.toLowerCase().split("x");
32
+ if (parts.length !== 2) {
33
+ fail(`cell must be WxH, got: '${value}'`);
34
+ }
35
+ const width = leadingInteger(parts[0]);
36
+ const height = leadingInteger(parts[1]);
37
+ if (!Number.isFinite(width) || !Number.isFinite(height)) {
38
+ fail(`cell must be WxH integers, got: '${value}'`);
39
+ }
40
+ const cell = [width, height];
41
+ return cell;
42
+ };
43
+ var readContract = (path = "") => {
44
+ if (path === "") {
45
+ failUsage("--contract is required");
46
+ }
47
+ return loadSizeContract(parseJsonText(readFileSync(path, "utf-8")), path);
48
+ };
49
+ var run = (argv) => {
50
+ main(() => {
51
+ const args = parseArgs([...argv], {
52
+ booleans: ["strict"],
53
+ values: [
54
+ "action",
55
+ "anchor-policy",
56
+ "cell",
57
+ "contract",
58
+ "direction",
59
+ "frame-glob",
60
+ "name",
61
+ "out",
62
+ "pivot",
63
+ "source",
64
+ "stage"
65
+ ]
66
+ });
67
+ const audit = () => {
68
+ const source = getString(args, "source") ?? "";
69
+ if (source === "") {
70
+ failUsage("--source is required");
71
+ }
72
+ const contract = readContract(getString(args, "contract"));
73
+ const report = auditSizeContract(source, contract, {
74
+ frameGlob: getString(args, "frame-glob") ?? "frame-*.png",
75
+ stage: getString(args, "stage") ?? "runtime"
76
+ });
77
+ const out = getString(args, "out") ?? "";
78
+ if (out !== "") {
79
+ writeJsonFile(out, report);
80
+ }
81
+ console.log(toPythonJson(report));
82
+ if (getFlag(args, "strict") && report.status !== "pass") {
83
+ process.exit(1);
84
+ }
85
+ };
86
+ const derive = () => {
87
+ const source = getString(args, "source") ?? "";
88
+ const out = getString(args, "out") ?? "";
89
+ if (source === "") {
90
+ failUsage("--source is required");
91
+ }
92
+ if (out === "") {
93
+ failUsage("--out is required");
94
+ }
95
+ const contract = deriveSizeContract(source, {
96
+ action: getString(args, "action") ?? null,
97
+ anchorPolicy: getString(args, "anchor-policy") ?? "grounded",
98
+ cellSize: parseCell(getString(args, "cell") ?? `${FRAME_WIDTH}x${FRAME_HEIGHT}`),
99
+ direction: getString(args, "direction") ?? null,
100
+ frameGlob: getString(args, "frame-glob") ?? "frame-*.png",
101
+ name: getString(args, "name") ?? null,
102
+ pivot: getString(args, "pivot") ?? "base-center"
103
+ });
104
+ writeJsonFile(out, contract);
105
+ console.log(out);
106
+ };
107
+ const prompt = () => {
108
+ const contract = readContract(getString(args, "contract"));
109
+ for (const line of promptGuidanceForContract(contract)) {
110
+ console.log(`- ${line}`);
111
+ }
112
+ };
113
+ const mode = (/* @__PURE__ */ new Map([
114
+ ["audit", audit],
115
+ ["derive", derive],
116
+ ["prompt", prompt]
117
+ ])).get(args.positionals[0] ?? "");
118
+ if (mode === void 0) {
119
+ failUsage("Usage: vg asset size-contract <derive|audit|prompt> ...");
120
+ }
121
+ mode?.();
122
+ });
123
+ };
124
+ export {
125
+ run
126
+ };
@@ -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,34 +6,43 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  isNewerVersion
9
- } from "./chunk-GCX5KQ6A.js";
10
- import {
11
- require_cross_spawn
12
- } from "./chunk-2QBYTIMH.js";
9
+ } from "./chunk-N2UHAQXC.js";
13
10
  import {
14
11
  SLUG_RE,
15
12
  findProjectRoot,
16
13
  readProjectConfig
17
- } from "./chunk-ZI6PKVXG.js";
14
+ } from "./chunk-TMPBGXT4.js";
18
15
  import {
19
16
  getBaseUrl,
20
17
  getConfigDir
21
- } from "./chunk-RYFO3ZPO.js";
22
- import {
23
- consola
24
- } from "./chunk-CU7UY5YJ.js";
18
+ } from "./chunk-Q5NZNXJE.js";
25
19
  import {
26
20
  defineCommand
27
21
  } from "./chunk-MBXCVCC4.js";
22
+ import {
23
+ require_cross_spawn
24
+ } from "./chunk-5535KDYI.js";
25
+ import {
26
+ consola
27
+ } from "./chunk-D2RF35HJ.js";
28
28
  import {
29
29
  __toESM
30
- } from "./chunk-CAKBGDCY.js";
30
+ } from "./chunk-GKDUYJ7R.js";
31
31
 
32
32
  // src/commands/playtest.ts
33
33
  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);