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.
- 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-2KVQJKIZ.js +6495 -0
- package/dist/{chunk-56OY4TEP.js → chunk-2SBBKY5C.js} +1361 -4493
- package/dist/{chunk-FC233UKH.js → chunk-2ZKS7V72.js} +16 -16
- 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-4FJXCS3K.js +741 -0
- package/dist/{chunk-WSRIF6K4.js → chunk-4UU622RK.js} +5 -4
- package/dist/chunk-5YPLKGY3.js +87 -0
- package/dist/chunk-6KXXZXSO.js +475 -0
- package/dist/chunk-7RPLQWR2.js +91 -0
- package/dist/{chunk-ZCYWDKYP.js → chunk-A556KALN.js} +14 -13
- package/dist/{chunk-UFR6G6BL.js → chunk-ABTUEIRC.js} +554 -254
- package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
- 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-DB7WVFS7.js +80 -0
- package/dist/chunk-DOOQUFPG.js +73 -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-FXXVXDTW.js +168 -0
- package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
- package/dist/chunk-GLEW7VJQ.js +45 -0
- package/dist/{chunk-AXTLPJ2F.js → chunk-H2C4QUTG.js} +8 -7
- package/dist/{chunk-H3IPLBXQ.js → chunk-HRKVAXNN.js} +17 -14
- package/dist/{chunk-UXCWSWWX.js → chunk-HSMG6U7J.js} +8 -7
- package/dist/chunk-HX5Q63UA.js +48 -0
- package/dist/chunk-HYOXGNWS.js +53 -0
- 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-KAGVI3CE.js +62 -0
- package/dist/chunk-KJK5CB6E.js +58 -0
- 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-NCX6LYNJ.js +117 -0
- package/dist/chunk-OGX4DKIS.js +215 -0
- package/dist/chunk-OPUCUUID.js +41 -0
- package/dist/chunk-Q2QC6KAZ.js +132 -0
- package/dist/{chunk-NDHXM4PL.js → chunk-Q3XQPNF6.js} +12 -12
- package/dist/{chunk-RXHTGX7C.js → chunk-Q5NZNXJE.js} +6 -10
- package/dist/chunk-QLCVLCPM.js +126 -0
- package/dist/chunk-R2WVORGD.js +91 -0
- package/dist/chunk-RKS7SI5L.js +64 -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-S7HYWITX.js +57 -0
- package/dist/chunk-SBXCK2I2.js +48 -0
- package/dist/chunk-SUSX3QIA.js +62 -0
- package/dist/{chunk-6EWHKL7Z.js → chunk-SXYQL4GK.js} +7 -6
- package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
- package/dist/chunk-TXOE5UY5.js +72 -0
- package/dist/chunk-U6DTE5IX.js +124 -0
- package/dist/{chunk-UZM6OSW5.js → chunk-UPHB5HWO.js} +15 -13
- package/dist/chunk-UQ7VO6B3.js +91 -0
- package/dist/chunk-VB4WLJR2.js +47 -0
- package/dist/{chunk-25BAMW5X.js → chunk-VIEKOGKG.js} +18 -2
- package/dist/{chunk-LXS3NJYD.js → chunk-VZEJ2ZHE.js} +14 -15
- package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
- package/dist/chunk-ZHLPE6LI.js +71 -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,40 @@
|
|
|
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
|
+
require_cross_spawn
|
|
9
|
+
} from "./chunk-5535KDYI.js";
|
|
10
|
+
import {
|
|
11
|
+
consola
|
|
12
|
+
} from "./chunk-D2RF35HJ.js";
|
|
13
|
+
import {
|
|
14
|
+
ASSETS_DIR
|
|
15
|
+
} from "./chunk-YNCYMWER.js";
|
|
16
|
+
import {
|
|
17
|
+
__toESM
|
|
18
|
+
} from "./chunk-GKDUYJ7R.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/asset/python.ts
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
23
|
+
var pythonScript = (file) => (argv) => {
|
|
24
|
+
const result = import_cross_spawn.default.sync(
|
|
25
|
+
"uv",
|
|
26
|
+
["run", "--python", "3.12", "--no-project", path.join(ASSETS_DIR, file), ...argv],
|
|
27
|
+
{ stdio: "inherit" }
|
|
28
|
+
);
|
|
29
|
+
if (result.error !== void 0 && result.error !== null) {
|
|
30
|
+
consola.error(
|
|
31
|
+
`Couldn't start uv (${result.error.message}). Install it: https://docs.astral.sh/uv/getting-started/installation/`
|
|
32
|
+
);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
process.exit(result.status ?? 1);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
pythonScript
|
|
40
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
Bitmap,
|
|
9
|
+
DEFAULT_SNAP_CONFIG,
|
|
10
|
+
fail,
|
|
11
|
+
failUsage,
|
|
12
|
+
getInt,
|
|
13
|
+
main,
|
|
14
|
+
parseArgs,
|
|
15
|
+
snapSheet
|
|
16
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
17
|
+
import "./chunk-2SBBKY5C.js";
|
|
18
|
+
import "./chunk-GKDUYJ7R.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/asset/pixel-snapper-sheet.ts
|
|
21
|
+
var run = (argv) => {
|
|
22
|
+
main(() => {
|
|
23
|
+
const args = parseArgs([...argv], {
|
|
24
|
+
values: ["cols", "k-colors", "rows", "seed"]
|
|
25
|
+
});
|
|
26
|
+
const [input = "", output = ""] = args.positionals;
|
|
27
|
+
if (input === "" || output === "") {
|
|
28
|
+
failUsage("Usage: vg asset pixel-snapper-sheet input.png output.png --cols N --rows N");
|
|
29
|
+
}
|
|
30
|
+
const cols = getInt(args, "cols", 0);
|
|
31
|
+
const rows = getInt(args, "rows", 0);
|
|
32
|
+
if (cols <= 0 || rows <= 0) {
|
|
33
|
+
fail("--cols and --rows must be positive integers");
|
|
34
|
+
}
|
|
35
|
+
const kColors = getInt(args, "k-colors", 256);
|
|
36
|
+
if (kColors <= 0) {
|
|
37
|
+
fail("--k-colors must be a positive integer");
|
|
38
|
+
}
|
|
39
|
+
const { image, info } = snapSheet(Bitmap.fromFile(input), cols, rows, {
|
|
40
|
+
...DEFAULT_SNAP_CONFIG,
|
|
41
|
+
kColors,
|
|
42
|
+
kSeed: getInt(args, "seed", 42)
|
|
43
|
+
});
|
|
44
|
+
image.toFile(output);
|
|
45
|
+
const [fw, fh] = info.targetFrameDims;
|
|
46
|
+
const [ow, oh] = info.outputDims;
|
|
47
|
+
console.log(`Snapped sheet ${input} -> ${output}`);
|
|
48
|
+
console.log(
|
|
49
|
+
` input: ${info.inputDims[0]}x${info.inputDims[1]} (${cols}x${rows} of ${info.inputFrameDims[0]}x${info.inputFrameDims[1]})`
|
|
50
|
+
);
|
|
51
|
+
console.log(` target frame: ${fw}x${fh} (shared pitch across all frames)`);
|
|
52
|
+
console.log(` output: ${ow}x${oh}`);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
run
|
|
57
|
+
};
|
|
@@ -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
|
+
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/check.ts
|
|
18
|
+
var CHECK_TOOLS = {
|
|
19
|
+
canvas: {
|
|
20
|
+
description: "Fail on a blank canvas or uncaught page error (needs playwright in the project).",
|
|
21
|
+
load: rawTool(async () => await import("./chunk-6KXXZXSO.js"))
|
|
22
|
+
},
|
|
23
|
+
net: {
|
|
24
|
+
description: "Measure multiplayer smoothness across simulated clients (needs playwright in the project).",
|
|
25
|
+
load: rawTool(async () => await import("./chunk-BZOMEG3X.js"))
|
|
26
|
+
},
|
|
27
|
+
"scripted-playtest": {
|
|
28
|
+
description: "Drive a fixed input sweep through vg playtest and report progression.",
|
|
29
|
+
load: rawTool(async () => await import("./chunk-4FJXCS3K.js"))
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var runCheck = async (argv) => {
|
|
33
|
+
await runRawTool("check", CHECK_TOOLS, argv);
|
|
34
|
+
};
|
|
35
|
+
var checkCommand = defineCommand({
|
|
36
|
+
meta: {
|
|
37
|
+
description: "Headless checks for a build: canvas, net, scripted-playtest (`vg check --help` lists them). All arguments pass through to the check.",
|
|
38
|
+
name: "check"
|
|
39
|
+
},
|
|
40
|
+
run: async ({ rawArgs }) => {
|
|
41
|
+
await runCheck(rawArgs);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export {
|
|
45
|
+
CHECK_TOOLS,
|
|
46
|
+
checkCommand,
|
|
47
|
+
runCheck
|
|
48
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
getFlag,
|
|
10
|
+
getInt,
|
|
11
|
+
getString,
|
|
12
|
+
main,
|
|
13
|
+
parseArgs,
|
|
14
|
+
runQc,
|
|
15
|
+
toPythonJson
|
|
16
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
17
|
+
import "./chunk-2SBBKY5C.js";
|
|
18
|
+
import "./chunk-GKDUYJ7R.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/asset/sheet-qc.ts
|
|
21
|
+
var run = (argv) => {
|
|
22
|
+
main(() => {
|
|
23
|
+
const args = parseArgs([...argv], {
|
|
24
|
+
booleans: ["fail-on-hints", "json", "strict"],
|
|
25
|
+
values: ["frame-height", "frame-width"]
|
|
26
|
+
});
|
|
27
|
+
const [sheet = ""] = args.positionals;
|
|
28
|
+
if (sheet === "") {
|
|
29
|
+
failUsage("a spritesheet path is required");
|
|
30
|
+
}
|
|
31
|
+
const frameWidth = getString(args, "frame-width") === void 0 ? null : getInt(args, "frame-width", 0);
|
|
32
|
+
const frameHeight = getString(args, "frame-height") === void 0 ? null : getInt(args, "frame-height", 0);
|
|
33
|
+
const report = runQc(sheet, frameWidth, frameHeight);
|
|
34
|
+
if (getFlag(args, "json")) {
|
|
35
|
+
console.log(toPythonJson(report));
|
|
36
|
+
} else {
|
|
37
|
+
console.log(
|
|
38
|
+
`[${report.verdict.toUpperCase()}] ${report.sheet} (${report.frameCount} frames ${report.frameWidth}x${report.frameHeight})`
|
|
39
|
+
);
|
|
40
|
+
for (const check of report.checks) {
|
|
41
|
+
const marker = check.severity === "warn" ? "!" : "?";
|
|
42
|
+
console.log(
|
|
43
|
+
` ${marker} ${check.check}: frames [${check.frames.join(", ")}] \u2014 ${check.detail}`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
if (report.checks.length === 0) {
|
|
47
|
+
console.log(
|
|
48
|
+
" no issues: sizes consistent, facing consistent, no clipping or empty cells."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (getFlag(args, "fail-on-hints") && report.verdict !== "clean") {
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
if (getFlag(args, "strict") && report.verdict === "warn") {
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
run
|
|
62
|
+
};
|
|
@@ -6,18 +6,19 @@ var __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
revokeLogin
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-E3FJUPLT.js";
|
|
10
10
|
import {
|
|
11
11
|
clearConfig,
|
|
12
12
|
getConfig
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
consola
|
|
16
|
-
} from "./chunk-D2RF35HJ.js";
|
|
17
|
-
import "./chunk-J6PKNPI2.js";
|
|
13
|
+
} from "./chunk-Q5NZNXJE.js";
|
|
18
14
|
import {
|
|
19
15
|
defineCommand
|
|
20
16
|
} from "./chunk-MBXCVCC4.js";
|
|
17
|
+
import {
|
|
18
|
+
consola
|
|
19
|
+
} from "./chunk-D2RF35HJ.js";
|
|
20
|
+
import "./chunk-RPSUFZAG.js";
|
|
21
|
+
import "./chunk-2SBBKY5C.js";
|
|
21
22
|
import "./chunk-GKDUYJ7R.js";
|
|
22
23
|
|
|
23
24
|
// src/commands/logout.ts
|
|
@@ -6,8 +6,9 @@ var __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
isJsonObject,
|
|
9
|
-
isJsonString
|
|
10
|
-
|
|
9
|
+
isJsonString,
|
|
10
|
+
parseJson
|
|
11
|
+
} from "./chunk-RPSUFZAG.js";
|
|
11
12
|
|
|
12
13
|
// src/lib/config-file.ts
|
|
13
14
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -30,15 +31,15 @@ var findConfigPath = (dir) => {
|
|
|
30
31
|
};
|
|
31
32
|
var findProjectRoot = (dir) => {
|
|
32
33
|
const found = findConfigPath(dir);
|
|
33
|
-
return found ? path.dirname(found) : null;
|
|
34
|
+
return found !== null && found !== "" ? path.dirname(found) : null;
|
|
34
35
|
};
|
|
35
36
|
var readProjectConfig = (dir) => {
|
|
36
37
|
const file = findConfigPath(dir);
|
|
37
|
-
if (
|
|
38
|
+
if (file === null || file === "") {
|
|
38
39
|
return null;
|
|
39
40
|
}
|
|
40
41
|
const raw = readFileSync(file, "utf-8");
|
|
41
|
-
const parsed =
|
|
42
|
+
const parsed = parseJson(raw);
|
|
42
43
|
if (!isJsonObject(parsed) || !isJsonString(parsed.slug)) {
|
|
43
44
|
throw new Error(`${FILENAME} is malformed \u2014 missing "slug".`);
|
|
44
45
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
fail,
|
|
9
|
+
failUsage,
|
|
10
|
+
getFlag,
|
|
11
|
+
getInt,
|
|
12
|
+
getNumber,
|
|
13
|
+
getString,
|
|
14
|
+
main,
|
|
15
|
+
normalizeCanvas,
|
|
16
|
+
parseArgs
|
|
17
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
18
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
|
+
import "./chunk-GKDUYJ7R.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/asset/normalize-canvas.ts
|
|
22
|
+
var parseSize = (text = "256x256") => {
|
|
23
|
+
const match = /^(?<w>\d+)\s*x\s*(?<h>\d+)$/iu.exec(text.trim());
|
|
24
|
+
if (!match) {
|
|
25
|
+
fail(`--canvas must be WxH, e.g. 256x256 (got "${text}")`);
|
|
26
|
+
}
|
|
27
|
+
const width = Number(match?.groups?.w);
|
|
28
|
+
const height = Number(match?.groups?.h);
|
|
29
|
+
if (width <= 0 || height <= 0) {
|
|
30
|
+
fail(`--canvas dimensions must be positive, got: "${text}"`);
|
|
31
|
+
}
|
|
32
|
+
return { height, width };
|
|
33
|
+
};
|
|
34
|
+
var run = (argv) => {
|
|
35
|
+
main(() => {
|
|
36
|
+
const args = parseArgs([...argv], {
|
|
37
|
+
booleans: ["no-upscale"],
|
|
38
|
+
values: ["canvas", "char-fill", "glob", "input-dir", "out-dir", "pad", "target-height"]
|
|
39
|
+
});
|
|
40
|
+
const inputDir = getString(args, "input-dir") ?? "";
|
|
41
|
+
const outDir = getString(args, "out-dir") ?? "";
|
|
42
|
+
if (inputDir === "" || outDir === "") {
|
|
43
|
+
failUsage("--input-dir and --out-dir are required");
|
|
44
|
+
}
|
|
45
|
+
const pad = getInt(args, "pad", 6);
|
|
46
|
+
if (pad < 0) {
|
|
47
|
+
fail("--pad must be >= 0");
|
|
48
|
+
}
|
|
49
|
+
const charFill = getNumber(args, "char-fill", 0.5);
|
|
50
|
+
if (!(charFill > 0 && charFill <= 1)) {
|
|
51
|
+
fail("--char-fill must be in (0, 1]");
|
|
52
|
+
}
|
|
53
|
+
const targetHeightSpec = getString(args, "target-height");
|
|
54
|
+
const targetHeight = targetHeightSpec === void 0 ? null : getInt(args, "target-height", 0);
|
|
55
|
+
if (targetHeight !== null && targetHeight <= 0) {
|
|
56
|
+
fail("--target-height must be a positive integer");
|
|
57
|
+
}
|
|
58
|
+
const written = normalizeCanvas(inputDir, outDir, {
|
|
59
|
+
allowUpscale: !getFlag(args, "no-upscale"),
|
|
60
|
+
canvas: parseSize(getString(args, "canvas")),
|
|
61
|
+
charFill,
|
|
62
|
+
glob: getString(args, "glob") ?? "frame-*.png",
|
|
63
|
+
pad,
|
|
64
|
+
targetHeight
|
|
65
|
+
});
|
|
66
|
+
console.log(outDir);
|
|
67
|
+
console.log(`${written.length} frames`);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
run
|
|
72
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
fail,
|
|
9
|
+
failUsage,
|
|
10
|
+
getFlag,
|
|
11
|
+
getInt,
|
|
12
|
+
getNumber,
|
|
13
|
+
getString,
|
|
14
|
+
main,
|
|
15
|
+
parseArgs,
|
|
16
|
+
parseColor,
|
|
17
|
+
processSheet,
|
|
18
|
+
toPythonJson
|
|
19
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
20
|
+
import "./chunk-2SBBKY5C.js";
|
|
21
|
+
import "./chunk-GKDUYJ7R.js";
|
|
22
|
+
|
|
23
|
+
// src/commands/asset/process-sheet.ts
|
|
24
|
+
import { existsSync } from "node:fs";
|
|
25
|
+
var run = (argv) => {
|
|
26
|
+
main(() => {
|
|
27
|
+
const args = parseArgs([...argv], {
|
|
28
|
+
booleans: ["json", "no-pixel-snap", "no-qc", "recover"],
|
|
29
|
+
values: [
|
|
30
|
+
"action",
|
|
31
|
+
"char-fill",
|
|
32
|
+
"chroma",
|
|
33
|
+
"cols",
|
|
34
|
+
"frames",
|
|
35
|
+
"out-dir",
|
|
36
|
+
"rows",
|
|
37
|
+
"snap-k-colors"
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
const readOptions = () => {
|
|
41
|
+
const [board = ""] = args.positionals;
|
|
42
|
+
if (board === "") {
|
|
43
|
+
failUsage("a pose board PNG is required");
|
|
44
|
+
}
|
|
45
|
+
if (!existsSync(board)) {
|
|
46
|
+
fail(`board not found: ${board}`);
|
|
47
|
+
}
|
|
48
|
+
const action2 = getString(args, "action") ?? "";
|
|
49
|
+
if (action2 === "") {
|
|
50
|
+
failUsage("--action is required");
|
|
51
|
+
}
|
|
52
|
+
const outDir = getString(args, "out-dir") ?? "";
|
|
53
|
+
if (outDir === "") {
|
|
54
|
+
failUsage("--out-dir is required");
|
|
55
|
+
}
|
|
56
|
+
const rows = getInt(args, "rows", 0);
|
|
57
|
+
const cols = getInt(args, "cols", 0);
|
|
58
|
+
if (rows <= 0 || cols <= 0) {
|
|
59
|
+
fail("--rows and --cols must be positive integers");
|
|
60
|
+
}
|
|
61
|
+
const charFill = getNumber(args, "char-fill", 0.5);
|
|
62
|
+
if (!(charFill > 0 && charFill <= 1)) {
|
|
63
|
+
fail("--char-fill must be in (0, 1]");
|
|
64
|
+
}
|
|
65
|
+
const snapKColors = getInt(args, "snap-k-colors", 16);
|
|
66
|
+
if (snapKColors <= 0) {
|
|
67
|
+
fail("--snap-k-colors must be a positive integer");
|
|
68
|
+
}
|
|
69
|
+
const requested = getString(args, "frames");
|
|
70
|
+
if (requested !== void 0 && getInt(args, "frames", 0) <= 0) {
|
|
71
|
+
fail("--frames must be a positive integer");
|
|
72
|
+
}
|
|
73
|
+
const frames2 = requested === void 0 ? void 0 : getInt(args, "frames", 0);
|
|
74
|
+
return { action: action2, board, charFill, cols, frames: frames2, outDir, rows, snapKColors };
|
|
75
|
+
};
|
|
76
|
+
const [chromaR, chromaG, chromaB] = parseColor(getString(args, "chroma") ?? "#00FF00");
|
|
77
|
+
const result = processSheet({
|
|
78
|
+
...readOptions(),
|
|
79
|
+
chroma: [chromaR, chromaG, chromaB],
|
|
80
|
+
pixelSnap: !getFlag(args, "no-pixel-snap"),
|
|
81
|
+
qc: !getFlag(args, "no-qc"),
|
|
82
|
+
recover: getFlag(args, "recover"),
|
|
83
|
+
warn: (message) => {
|
|
84
|
+
process.stderr.write(`[process_sheet] warning: ${message}
|
|
85
|
+
`);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const { action, fps, frames, gif, qc, spritesheet } = result;
|
|
89
|
+
if (getFlag(args, "json")) {
|
|
90
|
+
const summary = {
|
|
91
|
+
action,
|
|
92
|
+
fps,
|
|
93
|
+
frames,
|
|
94
|
+
gif,
|
|
95
|
+
path: "image",
|
|
96
|
+
pixelSnap: result.pixelSnap,
|
|
97
|
+
qc: qc ? qc.verdict : "skipped",
|
|
98
|
+
runtimeFrames: result.runtimeFrames,
|
|
99
|
+
slicing: result.slicing,
|
|
100
|
+
spritesheet
|
|
101
|
+
};
|
|
102
|
+
console.log(toPythonJson(qc ? { ...summary, qcChecks: qc.checks } : summary));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const lines = [
|
|
106
|
+
`
|
|
107
|
+
=== ${action} (image): ${frames} frames @ ${fps}fps ===`,
|
|
108
|
+
` sheet: ${spritesheet}`,
|
|
109
|
+
` gif: ${gif}`
|
|
110
|
+
];
|
|
111
|
+
if (qc) {
|
|
112
|
+
lines.push(` qc: [${qc.verdict.toUpperCase()}]`);
|
|
113
|
+
for (const check of qc.checks) {
|
|
114
|
+
lines.push(
|
|
115
|
+
` ${check.severity === "warn" ? "!" : "?"} ${check.check}: frames [${check.frames.join(", ")}] \u2014 ${check.detail}`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
console.log(lines.join("\n"));
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
export {
|
|
123
|
+
run
|
|
124
|
+
};
|
|
@@ -4,27 +4,29 @@ 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
|
getBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Q5NZNXJE.js";
|
|
10
13
|
import {
|
|
11
14
|
isJsonOutput,
|
|
12
15
|
outputArgs,
|
|
13
16
|
writeStructured
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-COSLGSVO.js";
|
|
15
18
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
defineCommand
|
|
20
|
+
} from "./chunk-MBXCVCC4.js";
|
|
18
21
|
import {
|
|
19
22
|
consola
|
|
20
23
|
} from "./chunk-D2RF35HJ.js";
|
|
21
24
|
import {
|
|
22
25
|
isJsonObject,
|
|
23
|
-
isJsonString
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "./chunk-MBXCVCC4.js";
|
|
26
|
+
isJsonString,
|
|
27
|
+
parseJson
|
|
28
|
+
} from "./chunk-RPSUFZAG.js";
|
|
29
|
+
import "./chunk-2SBBKY5C.js";
|
|
28
30
|
import "./chunk-GKDUYJ7R.js";
|
|
29
31
|
|
|
30
32
|
// src/commands/skills.ts
|
|
@@ -42,7 +44,7 @@ var fetchOrExit = async (url, doing) => {
|
|
|
42
44
|
return await fetch(url);
|
|
43
45
|
} catch (error) {
|
|
44
46
|
consola.error(`${doing}: ${error instanceof Error ? error.message : String(error)}`);
|
|
45
|
-
process.exit(1);
|
|
47
|
+
return process.exit(1);
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
var summaries = (index) => {
|
|
@@ -63,7 +65,7 @@ var listSkills = async () => {
|
|
|
63
65
|
consola.error(`Could not list the skills: ${res.status} ${res.statusText}`);
|
|
64
66
|
process.exit(1);
|
|
65
67
|
}
|
|
66
|
-
const index =
|
|
68
|
+
const index = parseJson(await res.text());
|
|
67
69
|
return summaries(index);
|
|
68
70
|
};
|
|
69
71
|
var skillsCommand = defineCommand({
|
|
@@ -74,7 +76,7 @@ var skillsCommand = defineCommand({
|
|
|
74
76
|
},
|
|
75
77
|
run: async ({ args, rawArgs }) => {
|
|
76
78
|
assertKnownFlags(rawArgs, skillsArgs);
|
|
77
|
-
if (
|
|
79
|
+
if (args.name === void 0 || args.name === "") {
|
|
78
80
|
const skills = await listSkills();
|
|
79
81
|
if (writeStructured({ skills }, args)) {
|
|
80
82
|
return;
|
|
@@ -98,7 +100,7 @@ var skillsCommand = defineCommand({
|
|
|
98
100
|
process.exit(1);
|
|
99
101
|
}
|
|
100
102
|
const content = await res.text();
|
|
101
|
-
if (isJsonOutput(args) || args.field) {
|
|
103
|
+
if (isJsonOutput(args) || args.field !== void 0 && args.field !== "") {
|
|
102
104
|
const listed = await listSkills();
|
|
103
105
|
const summary = listed.find((skill) => skill.name === name);
|
|
104
106
|
writeStructured({ content, description: summary?.description ?? "", name }, args);
|
|
@@ -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
|
+
Bitmap,
|
|
9
|
+
fail,
|
|
10
|
+
failUsage,
|
|
11
|
+
getInt,
|
|
12
|
+
getString,
|
|
13
|
+
main,
|
|
14
|
+
parseArgs,
|
|
15
|
+
parseColor
|
|
16
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
17
|
+
import "./chunk-2SBBKY5C.js";
|
|
18
|
+
import "./chunk-GKDUYJ7R.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/asset/ref-sxs.ts
|
|
21
|
+
import { existsSync } from "node:fs";
|
|
22
|
+
var GAP = 8;
|
|
23
|
+
var STRIP = 6;
|
|
24
|
+
var BACKGROUND = parseColor("#101010");
|
|
25
|
+
var REF_INK = parseColor("#dc3c3c");
|
|
26
|
+
var GAME_INK = parseColor("#3cc85a");
|
|
27
|
+
var run = (argv) => {
|
|
28
|
+
main(() => {
|
|
29
|
+
const args = parseArgs([...argv], {
|
|
30
|
+
values: ["blur", "game", "height", "out", "ref"]
|
|
31
|
+
});
|
|
32
|
+
const out = getString(args, "out") ?? "";
|
|
33
|
+
if (!out.endsWith(".png")) {
|
|
34
|
+
failUsage("--out is required and must end in .png");
|
|
35
|
+
}
|
|
36
|
+
const height = getInt(args, "height", 720);
|
|
37
|
+
const blur = getInt(args, "blur", 24);
|
|
38
|
+
if (height < 64 || blur < 2) {
|
|
39
|
+
failUsage("--height must be \u2265 64 and --blur \u2265 2");
|
|
40
|
+
}
|
|
41
|
+
const sides = [
|
|
42
|
+
{ ink: REF_INK, role: "ref" },
|
|
43
|
+
{ ink: GAME_INK, role: "game" }
|
|
44
|
+
].map(({ ink, role }) => {
|
|
45
|
+
const file = getString(args, role) ?? "";
|
|
46
|
+
if (file === "") {
|
|
47
|
+
failUsage(`--${role} is required (a PNG path)`);
|
|
48
|
+
}
|
|
49
|
+
if (!existsSync(file)) {
|
|
50
|
+
fail(`${role} not found: ${file}`);
|
|
51
|
+
}
|
|
52
|
+
const image = Bitmap.fromFile(file).flatten([0, 0, 0]);
|
|
53
|
+
const sharp = image.resize(
|
|
54
|
+
Math.max(1, Math.round(image.width * height / image.height)),
|
|
55
|
+
height,
|
|
56
|
+
"bilinear"
|
|
57
|
+
);
|
|
58
|
+
const soft = sharp.resize(
|
|
59
|
+
Math.max(1, Math.round(sharp.width / blur)),
|
|
60
|
+
Math.max(1, Math.round(sharp.height / blur)),
|
|
61
|
+
"bilinear"
|
|
62
|
+
).resize(sharp.width, sharp.height, "bilinear");
|
|
63
|
+
return { ink, sharp, soft };
|
|
64
|
+
});
|
|
65
|
+
const compose = (images = sides.map((side) => side.sharp)) => {
|
|
66
|
+
const composed = Bitmap.create(
|
|
67
|
+
images.reduce((width, image) => width + image.width, 0) + GAP * (images.length - 1),
|
|
68
|
+
STRIP + Math.max(...images.map((image) => image.height)),
|
|
69
|
+
BACKGROUND
|
|
70
|
+
);
|
|
71
|
+
let x = 0;
|
|
72
|
+
for (const [i, image] of images.entries()) {
|
|
73
|
+
composed.paste(Bitmap.create(image.width, STRIP, sides[i]?.ink ?? BACKGROUND), x, 0);
|
|
74
|
+
composed.paste(image, x, STRIP);
|
|
75
|
+
x += image.width + GAP;
|
|
76
|
+
}
|
|
77
|
+
return composed;
|
|
78
|
+
};
|
|
79
|
+
const [ref, game] = sides.map((side) => side.sharp);
|
|
80
|
+
compose().toFile(out);
|
|
81
|
+
const blurred = compose(sides.map((side) => side.soft));
|
|
82
|
+
const blurOut = out.replace(/\.png$/u, "-blur.png");
|
|
83
|
+
blurred.resize(Math.round(blurred.width / 2), Math.round(blurred.height / 2), "bilinear").toFile(blurOut);
|
|
84
|
+
console.log(
|
|
85
|
+
JSON.stringify({ blur: blurOut, game: game?.width, height, ref: ref?.width, sxs: out })
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
90
|
+
run
|
|
91
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
packSpritesheet,
|
|
13
|
+
parseArgs,
|
|
14
|
+
writeJsonFile
|
|
15
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
16
|
+
import "./chunk-2SBBKY5C.js";
|
|
17
|
+
import "./chunk-GKDUYJ7R.js";
|
|
18
|
+
|
|
19
|
+
// src/commands/asset/pack-spritesheet.ts
|
|
20
|
+
var run = (argv) => {
|
|
21
|
+
main(() => {
|
|
22
|
+
const args = parseArgs([...argv], {
|
|
23
|
+
values: ["action", "columns", "fps", "glob", "input-dir", "json-out", "out"]
|
|
24
|
+
});
|
|
25
|
+
const inputDir = getString(args, "input-dir") ?? "";
|
|
26
|
+
const out = getString(args, "out") ?? "";
|
|
27
|
+
if (inputDir === "" || out === "") {
|
|
28
|
+
failUsage("--input-dir and --out are required");
|
|
29
|
+
}
|
|
30
|
+
const columnsSpec = getString(args, "columns");
|
|
31
|
+
const { manifest, sheet } = packSpritesheet(inputDir, out, {
|
|
32
|
+
action: getString(args, "action") ?? "anim",
|
|
33
|
+
columns: columnsSpec === void 0 ? null : getInt(args, "columns", 0),
|
|
34
|
+
fps: getInt(args, "fps", 10),
|
|
35
|
+
glob: getString(args, "glob") ?? "frame-*.png"
|
|
36
|
+
});
|
|
37
|
+
sheet.toFile(out);
|
|
38
|
+
const manifestPath = getString(args, "json-out") ?? out.replace(/\.png$/iu, ".json");
|
|
39
|
+
writeJsonFile(manifestPath, manifest);
|
|
40
|
+
console.log(
|
|
41
|
+
JSON.stringify({ ...manifest, _manifestPath: manifestPath, _sheetPath: out }, null, 2)
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
run
|
|
47
|
+
};
|