vibedgames 0.9.0 → 0.10.1
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.
- package/README.md +3 -2
- package/assets/align-framing.py +242 -0
- package/assets/render-model.py +406 -0
- package/assets/tilemap-editor.html +630 -0
- package/dist/THIRD_PARTY_NOTICES.txt +2 -2
- package/dist/{chunk-56OY4TEP.js → chunk-2SBBKY5C.js} +1361 -4493
- package/dist/{chunk-FC233UKH.js → chunk-2ZKS7V72.js} +16 -16
- package/dist/chunk-37LLKM73.js +124 -0
- package/dist/{chunk-BMTHAVMS.js → chunk-3HGBIUM5.js} +22 -19
- package/dist/chunk-3UGGMFJJ.js +22 -0
- package/dist/{chunk-3HUWAJQH.js → chunk-42K3BJJH.js} +93 -76
- package/dist/{chunk-ST5FC2W3.js → chunk-43P4U7CB.js} +20 -11
- package/dist/chunk-4RYTTD4D.js +53 -0
- package/dist/{chunk-WSRIF6K4.js → chunk-4UU622RK.js} +5 -4
- package/dist/chunk-52E6EKZV.js +72 -0
- package/dist/chunk-6IUFHPMV.js +62 -0
- package/dist/chunk-6KXXZXSO.js +475 -0
- package/dist/chunk-72KHWZMN.js +87 -0
- package/dist/{chunk-ZCYWDKYP.js → chunk-A556KALN.js} +14 -13
- package/dist/{chunk-UFR6G6BL.js → chunk-ABTUEIRC.js} +554 -254
- package/dist/chunk-ALPTHSUT.js +132 -0
- package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
- package/dist/chunk-BJAN3RMY.js +48 -0
- package/dist/{chunk-HNRVSBRK.js → chunk-BN3Q7UEC.js} +20 -17
- package/dist/chunk-BZOMEG3X.js +412 -0
- package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
- package/dist/{chunk-KZBZNTM4.js → chunk-CTY2WZQK.js} +9 -13
- package/dist/chunk-DH6WPL3X.js +47 -0
- package/dist/chunk-DPLFCKXP.js +80 -0
- package/dist/{chunk-K2U7L4RU.js → chunk-E3FJUPLT.js} +15 -21
- package/dist/chunk-E7NDOZ27.js +428 -0
- package/dist/{chunk-TBQ5BU3Q.js → chunk-F42QKWBB.js} +18 -18
- package/dist/chunk-F4J6XCHT.js +73 -0
- package/dist/chunk-FB3UDZAV.js +168 -0
- package/dist/chunk-FJXPMA63.js +48 -0
- package/dist/chunk-FNJL6Z5C.js +71 -0
- package/dist/chunk-G63MXDX2.js +45 -0
- package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
- package/dist/{chunk-AXTLPJ2F.js → chunk-H2C4QUTG.js} +8 -7
- package/dist/{chunk-H3IPLBXQ.js → chunk-HRKVAXNN.js} +17 -14
- package/dist/chunk-HSCTPDEU.js +126 -0
- package/dist/{chunk-UXCWSWWX.js → chunk-HSMG6U7J.js} +8 -7
- package/dist/chunk-I5LELJSK.js +22 -0
- package/dist/{chunk-7CXMMC5S.js → chunk-JN4WZCR7.js} +5 -4
- package/dist/{chunk-7QZSDU52.js → chunk-K36EOII3.js} +5 -4
- package/dist/chunk-KLFBAFXD.js +25 -0
- package/dist/{chunk-355VG7EO.js → chunk-LONQWRTR.js} +107 -77
- package/dist/{chunk-Z5TFZQ5U.js → chunk-LORGE2NB.js} +68 -62
- package/dist/{chunk-LY2GQ32S.js → chunk-MEAO33XW.js} +22 -20
- package/dist/{chunk-OD2MNYXD.js → chunk-MR5KIFI7.js} +23 -22
- package/dist/{chunk-2VUUMXAQ.js → chunk-N2UHAQXC.js} +18 -11
- package/dist/chunk-NG2X3SMF.js +91 -0
- package/dist/chunk-OFJIG4K3.js +6482 -0
- package/dist/chunk-P74GTK23.js +91 -0
- package/dist/chunk-PKM3JOKQ.js +62 -0
- package/dist/{chunk-NDHXM4PL.js → chunk-Q3XQPNF6.js} +12 -12
- package/dist/{chunk-RXHTGX7C.js → chunk-Q5NZNXJE.js} +6 -10
- package/dist/chunk-QEKVZ7BX.js +57 -0
- package/dist/chunk-QNWCBPVO.js +215 -0
- package/dist/{chunk-US6QZICZ.js → chunk-RPJR3S5S.js} +32 -18
- package/dist/chunk-RPSUFZAG.js +3307 -0
- package/dist/chunk-RRI23NK2.js +40 -0
- package/dist/{chunk-6EWHKL7Z.js → chunk-SXYQL4GK.js} +7 -6
- package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
- package/dist/{chunk-UZM6OSW5.js → chunk-UPHB5HWO.js} +15 -13
- package/dist/chunk-UTSSDFQL.js +64 -0
- package/dist/chunk-V5ADM3WC.js +741 -0
- package/dist/{chunk-25BAMW5X.js → chunk-VIEKOGKG.js} +18 -2
- package/dist/chunk-VUV5U4J5.js +117 -0
- package/dist/{chunk-LXS3NJYD.js → chunk-VZEJ2ZHE.js} +14 -15
- package/dist/chunk-W2QPNAZ3.js +58 -0
- package/dist/chunk-YLUB6252.js +45 -0
- package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
- package/dist/chunk-YXOGRERG.js +91 -0
- package/dist/index.js +39 -36
- package/package.json +31 -16
- package/templates/none/src/main.ts +4 -0
- package/templates/none/vite.config.ts +0 -2
- package/templates/phaser/src/main.ts +0 -1
- package/templates/phaser/src/scenes/game-scene.ts +10 -8
- package/templates/phaser/vite.config.ts +0 -2
- package/templates/react-r3f/src/app.tsx +3 -1
- package/templates/react-r3f/src/main.tsx +1 -0
- package/templates/react-r3f/vite.config.ts +0 -2
- package/templates/threejs/src/main.ts +10 -1
- package/templates/threejs/vite.config.ts +0 -2
- package/LICENSE +0 -21
- package/dist/chunk-J6PKNPI2.js +0 -26
|
@@ -0,0 +1,168 @@
|
|
|
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
|
+
ASSETS_DIR
|
|
9
|
+
} from "./chunk-YNCYMWER.js";
|
|
10
|
+
import "./chunk-AWJNAGPE.js";
|
|
11
|
+
import "./chunk-RPSUFZAG.js";
|
|
12
|
+
import {
|
|
13
|
+
MANIFEST_JSON_CANDIDATES,
|
|
14
|
+
createTilemapEditor,
|
|
15
|
+
exportMapRender,
|
|
16
|
+
exportTilesetGrid,
|
|
17
|
+
fail,
|
|
18
|
+
getAll,
|
|
19
|
+
getFlag,
|
|
20
|
+
getInt,
|
|
21
|
+
getString,
|
|
22
|
+
isJsonObject,
|
|
23
|
+
isJsonString,
|
|
24
|
+
loadManifestJson,
|
|
25
|
+
main,
|
|
26
|
+
makeSelftestMap,
|
|
27
|
+
parseArgs,
|
|
28
|
+
parseColor,
|
|
29
|
+
parseJsonText,
|
|
30
|
+
sanitizeTilesets,
|
|
31
|
+
tilesetMetaFromManifest,
|
|
32
|
+
writeJsonFile
|
|
33
|
+
} from "./chunk-OFJIG4K3.js";
|
|
34
|
+
import "./chunk-2SBBKY5C.js";
|
|
35
|
+
import "./chunk-GKDUYJ7R.js";
|
|
36
|
+
|
|
37
|
+
// src/commands/asset/tilemap-editor.ts
|
|
38
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
39
|
+
import path from "node:path";
|
|
40
|
+
var firstTileset = (manifestPath, tilesets) => Object.keys(tilesets).toSorted()[0] ?? fail(`No tilesets in ${manifestPath}.`);
|
|
41
|
+
var resolveManifest = (explicit = "") => {
|
|
42
|
+
if (explicit === "") {
|
|
43
|
+
return MANIFEST_JSON_CANDIDATES.find((c) => existsSync(c)) ?? fail(
|
|
44
|
+
`Manifest not found. Pass --manifest or create one of: ${MANIFEST_JSON_CANDIDATES.join(", ")}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (existsSync(explicit) && statSync(explicit).isDirectory()) {
|
|
48
|
+
return ["assets_index.json", "asset_index.json"].map((n) => path.join(explicit, n)).find((c) => existsSync(c)) ?? fail(
|
|
49
|
+
`--manifest points at a directory (${explicit}), but no assets_index.json was found inside.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
if (!existsSync(explicit)) {
|
|
53
|
+
fail(`Manifest not found: ${explicit}`);
|
|
54
|
+
}
|
|
55
|
+
return explicit;
|
|
56
|
+
};
|
|
57
|
+
var run = (argv) => {
|
|
58
|
+
main(() => {
|
|
59
|
+
const args = parseArgs([...argv], {
|
|
60
|
+
booleans: ["edit", "label-ids", "trim"],
|
|
61
|
+
values: [
|
|
62
|
+
"bg",
|
|
63
|
+
"export-map-render",
|
|
64
|
+
"export-tileset-grid",
|
|
65
|
+
"fill-rect",
|
|
66
|
+
"host",
|
|
67
|
+
"make-selftest-map",
|
|
68
|
+
"manifest",
|
|
69
|
+
"map",
|
|
70
|
+
"port",
|
|
71
|
+
"scale",
|
|
72
|
+
"tileset",
|
|
73
|
+
"write-root"
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
const manifestPath = resolveManifest(getString(args, "manifest"));
|
|
77
|
+
const manifest = loadManifestJson(manifestPath);
|
|
78
|
+
const tilesets = sanitizeTilesets(manifest);
|
|
79
|
+
const name = getString(args, "tileset") ?? firstTileset(manifestPath, tilesets);
|
|
80
|
+
let meta = tilesetMetaFromManifest(manifestPath, manifest, name);
|
|
81
|
+
const scale = getInt(args, "scale", 4);
|
|
82
|
+
const trim = getFlag(args, "trim");
|
|
83
|
+
const gridOut = getString(args, "export-tileset-grid") ?? "";
|
|
84
|
+
const renderOut = getString(args, "export-map-render") ?? "";
|
|
85
|
+
const selftestOut = getString(args, "make-selftest-map") ?? "";
|
|
86
|
+
const startEditor = () => {
|
|
87
|
+
const html = readFileSync(path.join(ASSETS_DIR, "tilemap-editor.html"), "utf-8");
|
|
88
|
+
const host = getString(args, "host") ?? "127.0.0.1";
|
|
89
|
+
const port = getInt(args, "port", 0);
|
|
90
|
+
const editor = createTilemapEditor({
|
|
91
|
+
html,
|
|
92
|
+
manifestPath,
|
|
93
|
+
mapPath: getString(args, "map") ?? null,
|
|
94
|
+
tileset: name,
|
|
95
|
+
writeRoot: getString(args, "write-root") ?? process.cwd()
|
|
96
|
+
});
|
|
97
|
+
editor.server.on("error", (error) => {
|
|
98
|
+
fail(
|
|
99
|
+
"code" in error && error.code === "EADDRINUSE" ? `Port ${port} is already in use \u2014 pass a different --port, or omit it to get a free one.` : error.message
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
editor.server.listen(port, host, () => {
|
|
103
|
+
const address = editor.server.address();
|
|
104
|
+
const actual = address !== null && address instanceof Object ? address.port : port;
|
|
105
|
+
console.log(`Tilemap editor: ${editor.url(actual, host)}`);
|
|
106
|
+
console.log("Open that URL (the token is part of it). Ctrl-C to stop.");
|
|
107
|
+
});
|
|
108
|
+
process.on("SIGINT", () => {
|
|
109
|
+
editor.server.close();
|
|
110
|
+
process.exit(0);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
if (getFlag(args, "edit")) {
|
|
114
|
+
startEditor();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (gridOut === "" && renderOut === "" && selftestOut === "") {
|
|
118
|
+
fail(
|
|
119
|
+
"Nothing to do. Pass --edit, --export-tileset-grid, --export-map-render or --make-selftest-map."
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
if (gridOut !== "") {
|
|
123
|
+
exportTilesetGrid(meta, gridOut, { labelIds: getFlag(args, "label-ids"), scale, trim });
|
|
124
|
+
console.log(`Wrote ${gridOut}`);
|
|
125
|
+
}
|
|
126
|
+
if (renderOut !== "") {
|
|
127
|
+
const mapPath = getString(args, "map") ?? "";
|
|
128
|
+
if (mapPath === "") {
|
|
129
|
+
fail("--export-map-render requires --map PATH");
|
|
130
|
+
}
|
|
131
|
+
const parsedMap = parseJsonText(readFileSync(mapPath, "utf-8"));
|
|
132
|
+
const mapPayload = isJsonObject(parsedMap) ? parsedMap : fail("Map JSON must be an object at top-level.");
|
|
133
|
+
const mapMeta = mapPayload.meta;
|
|
134
|
+
if (isJsonObject(mapMeta) && isJsonString(mapMeta.tileset) && mapMeta.tileset in tilesets) {
|
|
135
|
+
meta = tilesetMetaFromManifest(manifestPath, manifest, mapMeta.tileset);
|
|
136
|
+
}
|
|
137
|
+
const fills = getAll(args, "fill-rect").map((spec) => {
|
|
138
|
+
const parts = spec.split(",").map((p) => p.trim());
|
|
139
|
+
if (parts.length !== 5) {
|
|
140
|
+
fail("--fill-rect must be x,y,w,h,#RRGGBB[AA]");
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
color: parseColor(parts[4] ?? ""),
|
|
144
|
+
h: Number(parts[3]),
|
|
145
|
+
w: Number(parts[2]),
|
|
146
|
+
x: Number(parts[0]),
|
|
147
|
+
y: Number(parts[1])
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
const bg = getString(args, "bg") ?? "";
|
|
151
|
+
exportMapRender(meta, renderOut, {
|
|
152
|
+
background: bg === "" ? null : parseColor(bg),
|
|
153
|
+
fills,
|
|
154
|
+
mapPayload,
|
|
155
|
+
scale,
|
|
156
|
+
trim
|
|
157
|
+
});
|
|
158
|
+
console.log(`Wrote ${renderOut}`);
|
|
159
|
+
}
|
|
160
|
+
if (selftestOut !== "") {
|
|
161
|
+
writeJsonFile(selftestOut, makeSelftestMap(meta));
|
|
162
|
+
console.log(`Wrote ${selftestOut}`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
run
|
|
168
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
collectSizes,
|
|
9
|
+
defaultRoot,
|
|
10
|
+
fail,
|
|
11
|
+
getString,
|
|
12
|
+
main,
|
|
13
|
+
parseArgs,
|
|
14
|
+
sizesToCsv,
|
|
15
|
+
writeJsonFile,
|
|
16
|
+
writeTextFile
|
|
17
|
+
} from "./chunk-OFJIG4K3.js";
|
|
18
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
|
+
import "./chunk-GKDUYJ7R.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/asset/sizes.ts
|
|
22
|
+
import { existsSync } from "node:fs";
|
|
23
|
+
var run = (argv) => {
|
|
24
|
+
main(() => {
|
|
25
|
+
const args = parseArgs([...argv], {
|
|
26
|
+
values: ["csv", "json", "root"]
|
|
27
|
+
});
|
|
28
|
+
const root = defaultRoot(getString(args, "root"));
|
|
29
|
+
if (!existsSync(root)) {
|
|
30
|
+
fail(`Root not found: ${root}`);
|
|
31
|
+
}
|
|
32
|
+
const rows = collectSizes(root);
|
|
33
|
+
for (const row of rows) {
|
|
34
|
+
console.log(`${row.width}x${row.height} ${row.path}`);
|
|
35
|
+
}
|
|
36
|
+
const csv = getString(args, "csv") ?? "";
|
|
37
|
+
if (csv !== "") {
|
|
38
|
+
writeTextFile(csv, sizesToCsv(rows));
|
|
39
|
+
}
|
|
40
|
+
const json = getString(args, "json") ?? "";
|
|
41
|
+
if (json !== "") {
|
|
42
|
+
writeJsonFile(json, rows);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
run
|
|
48
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
getFlag,
|
|
9
|
+
getInt,
|
|
10
|
+
inspectAseprite,
|
|
11
|
+
main,
|
|
12
|
+
parseArgs
|
|
13
|
+
} from "./chunk-OFJIG4K3.js";
|
|
14
|
+
import "./chunk-2SBBKY5C.js";
|
|
15
|
+
import "./chunk-GKDUYJ7R.js";
|
|
16
|
+
|
|
17
|
+
// src/commands/asset/aseprite-inspect.ts
|
|
18
|
+
import { readFileSync } from "node:fs";
|
|
19
|
+
var USAGE = `usage: vg asset aseprite-inspect [-h] [--json] [--pretty] [--decode-cels]
|
|
20
|
+
[--max-decompress-mib MAX_DECOMPRESS_MIB]
|
|
21
|
+
[--palette-entries PALETTE_ENTRIES]
|
|
22
|
+
[--treat-index0-transparent]
|
|
23
|
+
file
|
|
24
|
+
|
|
25
|
+
Inspect an Aseprite .ase/.aseprite file and emit JSON.
|
|
26
|
+
|
|
27
|
+
positional arguments:
|
|
28
|
+
file Path to .ase/.aseprite (sometimes typo .aes).
|
|
29
|
+
|
|
30
|
+
options:
|
|
31
|
+
--json Emit JSON to stdout (default).
|
|
32
|
+
--pretty Pretty-print JSON.
|
|
33
|
+
--decode-cels Zlib-decompress cel/tilemap data for extra inference
|
|
34
|
+
(bounds/summaries).
|
|
35
|
+
--max-decompress-mib MAX_DECOMPRESS_MIB
|
|
36
|
+
Safety limit for decompressed bytes (MiB). Default 64.
|
|
37
|
+
--palette-entries PALETTE_ENTRIES
|
|
38
|
+
How many palette entries to include per palette chunk
|
|
39
|
+
preview. Default 16.
|
|
40
|
+
--treat-index0-transparent
|
|
41
|
+
For indexed sprites, also treat palette index 0 as
|
|
42
|
+
transparent when inferring bounds (heuristic; off by
|
|
43
|
+
default).`;
|
|
44
|
+
var run = (argv) => {
|
|
45
|
+
main(() => {
|
|
46
|
+
const args = parseArgs([...argv], {
|
|
47
|
+
booleans: ["decode-cels", "json", "pretty", "treat-index0-transparent"],
|
|
48
|
+
values: ["max-decompress-mib", "palette-entries"]
|
|
49
|
+
});
|
|
50
|
+
const [file] = args.positionals;
|
|
51
|
+
if (file === void 0) {
|
|
52
|
+
process.stderr.write(`${USAGE}
|
|
53
|
+
|
|
54
|
+
error: the following arguments are required: file
|
|
55
|
+
`);
|
|
56
|
+
process.exit(2);
|
|
57
|
+
}
|
|
58
|
+
const report = inspectAseprite(file, readFileSync(file), {
|
|
59
|
+
decodeCels: getFlag(args, "decode-cels"),
|
|
60
|
+
maxDecompressMib: getInt(args, "max-decompress-mib", 64),
|
|
61
|
+
paletteEntries: getInt(args, "palette-entries", 16),
|
|
62
|
+
treatIndex0Transparent: getFlag(args, "treat-index0-transparent")
|
|
63
|
+
});
|
|
64
|
+
const json = getFlag(args, "pretty") ? JSON.stringify(report, null, 2) : JSON.stringify(report);
|
|
65
|
+
process.stdout.write(`${json}
|
|
66
|
+
`);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
run
|
|
71
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
consola
|
|
9
|
+
} from "./chunk-D2RF35HJ.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/raw-tools.ts
|
|
12
|
+
var rawTool = (load) => async () => {
|
|
13
|
+
const module = await load();
|
|
14
|
+
return module.run;
|
|
15
|
+
};
|
|
16
|
+
var usage = (group, tools) => [
|
|
17
|
+
`Usage: vg ${group} <tool> [args]`,
|
|
18
|
+
"",
|
|
19
|
+
...Object.entries(tools).map(([name, entry]) => ` ${name.padEnd(26)}${entry.description}`)
|
|
20
|
+
].join("\n");
|
|
21
|
+
var runRawTool = async (group, tools, argv) => {
|
|
22
|
+
const [name = "", ...rest] = argv;
|
|
23
|
+
if (name === "" || name === "--help" || name === "-h") {
|
|
24
|
+
console.log(usage(group, tools));
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
const entry = Object.hasOwn(tools, name) ? tools[name] : void 0;
|
|
28
|
+
if (entry === void 0) {
|
|
29
|
+
consola.error(`Unknown ${group} tool: ${name}
|
|
30
|
+
|
|
31
|
+
${usage(group, tools)}`);
|
|
32
|
+
process.exit(2);
|
|
33
|
+
}
|
|
34
|
+
if (rest.includes("--help") || rest.includes("-h")) {
|
|
35
|
+
console.log(`${entry.description}
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
const run = await entry.load();
|
|
39
|
+
await run(rest);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
rawTool,
|
|
44
|
+
runRawTool
|
|
45
|
+
};
|
|
@@ -5,7 +5,7 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/tar@7.5.
|
|
8
|
+
// ../../node_modules/.pnpm/tar@7.5.23/node_modules/tar/dist/esm/index.min.js
|
|
9
9
|
import Qr from "events";
|
|
10
10
|
import I from "fs";
|
|
11
11
|
import { EventEmitter as Di } from "node:events";
|
|
@@ -7,15 +7,16 @@ var __dirname = __pathDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
initCommand,
|
|
9
9
|
reportSkills
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-TBQ5BU3Q.js";
|
|
14
|
-
import "./chunk-5535KDYI.js";
|
|
10
|
+
} from "./chunk-3HGBIUM5.js";
|
|
11
|
+
import "./chunk-F42QKWBB.js";
|
|
12
|
+
import "./chunk-G66HRVDW.js";
|
|
15
13
|
import "./chunk-RZ4DIJQW.js";
|
|
16
|
-
import "./chunk-D2RF35HJ.js";
|
|
17
|
-
import "./chunk-J6PKNPI2.js";
|
|
18
14
|
import "./chunk-MBXCVCC4.js";
|
|
15
|
+
import "./chunk-5535KDYI.js";
|
|
16
|
+
import "./chunk-D2RF35HJ.js";
|
|
17
|
+
import "./chunk-AWJNAGPE.js";
|
|
18
|
+
import "./chunk-RPSUFZAG.js";
|
|
19
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
20
|
import "./chunk-GKDUYJ7R.js";
|
|
20
21
|
export {
|
|
21
22
|
initCommand,
|
|
@@ -4,30 +4,31 @@ 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
|
authErrorCode,
|
|
9
12
|
createClient
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-Z4Z24FWO.js";
|
|
13
|
-
import "./chunk-PEUP4MZR.js";
|
|
13
|
+
} from "./chunk-CTY2WZQK.js";
|
|
14
|
+
import "./chunk-E3FJUPLT.js";
|
|
14
15
|
import {
|
|
15
16
|
getToken
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Q5NZNXJE.js";
|
|
17
18
|
import {
|
|
18
19
|
outputArgs,
|
|
19
20
|
writeStructured
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-COSLGSVO.js";
|
|
21
22
|
import {
|
|
22
|
-
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
defineCommand
|
|
24
|
+
} from "./chunk-MBXCVCC4.js";
|
|
24
25
|
import {
|
|
25
26
|
consola
|
|
26
27
|
} from "./chunk-D2RF35HJ.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
import "./chunk-YNCYMWER.js";
|
|
29
|
+
import "./chunk-AWJNAGPE.js";
|
|
30
|
+
import "./chunk-RPSUFZAG.js";
|
|
31
|
+
import "./chunk-2SBBKY5C.js";
|
|
31
32
|
import "./chunk-GKDUYJ7R.js";
|
|
32
33
|
|
|
33
34
|
// src/commands/whoami.ts
|
|
@@ -41,7 +42,7 @@ var whoamiCommand = defineCommand({
|
|
|
41
42
|
run: async ({ args, rawArgs }) => {
|
|
42
43
|
assertKnownFlags(rawArgs, whoamiArgs);
|
|
43
44
|
const token = getToken();
|
|
44
|
-
if (
|
|
45
|
+
if (token === null || token === "") {
|
|
45
46
|
consola.warn("Not logged in. Run `vg login` to authenticate.");
|
|
46
47
|
process.exit(1);
|
|
47
48
|
}
|
|
@@ -51,7 +52,9 @@ var whoamiCommand = defineCommand({
|
|
|
51
52
|
if (writeStructured({ email: user.email, id: user.id, name: user.name }, args)) {
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
consola.log(
|
|
55
|
+
consola.log(
|
|
56
|
+
user.email !== null && user.email !== "" ? `${user.name} (${user.email})` : user.name
|
|
57
|
+
);
|
|
55
58
|
} catch (error) {
|
|
56
59
|
const code = authErrorCode(error);
|
|
57
60
|
if (code === "UNAUTHORIZED" || code === "FORBIDDEN") {
|
|
@@ -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-OFJIG4K3.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
|
+
};
|
|
@@ -16,15 +16,16 @@ import {
|
|
|
16
16
|
resolveGameUrl,
|
|
17
17
|
runPlaytest,
|
|
18
18
|
withScopedSession
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-RPJR3S5S.js";
|
|
20
|
+
import "./chunk-N2UHAQXC.js";
|
|
21
|
+
import "./chunk-TMPBGXT4.js";
|
|
22
|
+
import "./chunk-JN4WZCR7.js";
|
|
23
|
+
import "./chunk-Q5NZNXJE.js";
|
|
24
|
+
import "./chunk-MBXCVCC4.js";
|
|
23
25
|
import "./chunk-5535KDYI.js";
|
|
24
|
-
import "./chunk-ZI6PKVXG.js";
|
|
25
26
|
import "./chunk-D2RF35HJ.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-RPSUFZAG.js";
|
|
28
|
+
import "./chunk-2SBBKY5C.js";
|
|
28
29
|
import "./chunk-GKDUYJ7R.js";
|
|
29
30
|
export {
|
|
30
31
|
bareTokens,
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
pythonScript
|
|
9
|
+
} from "./chunk-RRI23NK2.js";
|
|
10
|
+
import "./chunk-5535KDYI.js";
|
|
11
|
+
import "./chunk-D2RF35HJ.js";
|
|
12
|
+
import "./chunk-YNCYMWER.js";
|
|
13
|
+
import "./chunk-AWJNAGPE.js";
|
|
14
|
+
import "./chunk-RPSUFZAG.js";
|
|
15
|
+
import "./chunk-2SBBKY5C.js";
|
|
16
|
+
import "./chunk-GKDUYJ7R.js";
|
|
17
|
+
|
|
18
|
+
// src/commands/asset/render-model.ts
|
|
19
|
+
var run = pythonScript("render-model.py");
|
|
20
|
+
export {
|
|
21
|
+
run
|
|
22
|
+
};
|
|
@@ -6,11 +6,12 @@ var __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
getConfigDir
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Q5NZNXJE.js";
|
|
10
10
|
import {
|
|
11
11
|
isJsonObject,
|
|
12
|
-
isJsonString
|
|
13
|
-
|
|
12
|
+
isJsonString,
|
|
13
|
+
parseJson
|
|
14
|
+
} from "./chunk-RPSUFZAG.js";
|
|
14
15
|
|
|
15
16
|
// src/lib/settings.ts
|
|
16
17
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -43,7 +44,7 @@ var readFile = () => {
|
|
|
43
44
|
return {};
|
|
44
45
|
}
|
|
45
46
|
try {
|
|
46
|
-
const data =
|
|
47
|
+
const data = parseJson(readFileSync(file, "utf-8"));
|
|
47
48
|
return isJsonObject(data) ? data : {};
|
|
48
49
|
} catch {
|
|
49
50
|
return {};
|
|
@@ -10,12 +10,13 @@ import {
|
|
|
10
10
|
installedFactoryVersion,
|
|
11
11
|
runFactory,
|
|
12
12
|
updateFactory
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-A556KALN.js";
|
|
14
|
+
import "./chunk-F42QKWBB.js";
|
|
15
|
+
import "./chunk-MBXCVCC4.js";
|
|
15
16
|
import "./chunk-5535KDYI.js";
|
|
16
17
|
import "./chunk-D2RF35HJ.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-RPSUFZAG.js";
|
|
19
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
20
|
import "./chunk-GKDUYJ7R.js";
|
|
20
21
|
export {
|
|
21
22
|
FACTORY_PACKAGE,
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
|
|
8
|
+
// src/checks/project-playwright.ts
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { pathToFileURL } from "node:url";
|
|
12
|
+
var hasChromium = (module) => typeof module === "object" && module !== null && "chromium" in module;
|
|
13
|
+
var loadProjectChromium = async () => {
|
|
14
|
+
try {
|
|
15
|
+
const resolved = createRequire(path.join(process.cwd(), "package.json")).resolve("playwright");
|
|
16
|
+
const module = await import(pathToFileURL(resolved).href);
|
|
17
|
+
return hasChromium(module) ? module.chromium : null;
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
loadProjectChromium
|
|
25
|
+
};
|