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
|
@@ -30,7 +30,23 @@ var SUBCOMMANDS = [
|
|
|
30
30
|
"completions",
|
|
31
31
|
"whoami"
|
|
32
32
|
];
|
|
33
|
-
var GENERATE_SUBCOMMANDS = [
|
|
33
|
+
var GENERATE_SUBCOMMANDS = [
|
|
34
|
+
"run",
|
|
35
|
+
"status",
|
|
36
|
+
"models",
|
|
37
|
+
"schema",
|
|
38
|
+
"pricing",
|
|
39
|
+
"docs",
|
|
40
|
+
"upload",
|
|
41
|
+
"image",
|
|
42
|
+
"video",
|
|
43
|
+
"3d",
|
|
44
|
+
"animate-3d",
|
|
45
|
+
"music",
|
|
46
|
+
"sound",
|
|
47
|
+
"speech",
|
|
48
|
+
"remove-background"
|
|
49
|
+
];
|
|
34
50
|
var COMMON_FLAGS = ["--help", "--version"];
|
|
35
51
|
var GENERATE_FLAGS = [
|
|
36
52
|
"--async",
|
|
@@ -146,7 +162,7 @@ var completionsCommand = defineCommand({
|
|
|
146
162
|
name: "completions"
|
|
147
163
|
},
|
|
148
164
|
run: ({ args }) => {
|
|
149
|
-
const shell =
|
|
165
|
+
const shell = args.shell ?? "";
|
|
150
166
|
if (!isShell(shell)) {
|
|
151
167
|
process.stderr.write(
|
|
152
168
|
`Unsupported shell "${shell}". Expected: ${[...SUPPORTED].join(", ")}
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
getDirection,
|
|
11
|
+
getFlag,
|
|
12
|
+
getInt,
|
|
13
|
+
getString,
|
|
14
|
+
main,
|
|
15
|
+
parseArgs,
|
|
16
|
+
renderAnchorPrompt,
|
|
17
|
+
renderPoseBoardPrompt,
|
|
18
|
+
resolvePoseBoardPreset,
|
|
19
|
+
totalCells,
|
|
20
|
+
withStyle
|
|
21
|
+
} from "./chunk-OFJIG4K3.js";
|
|
22
|
+
import "./chunk-2SBBKY5C.js";
|
|
23
|
+
import "./chunk-GKDUYJ7R.js";
|
|
24
|
+
|
|
25
|
+
// src/commands/asset/sprite-prompt.ts
|
|
26
|
+
var STYLE_CHOICES = ["lobit-v1", "high-fidelity-v1", "preserve-reference-v1"];
|
|
27
|
+
var run = (argv) => {
|
|
28
|
+
main(() => {
|
|
29
|
+
const args = parseArgs([...argv], {
|
|
30
|
+
booleans: ["guide-image"],
|
|
31
|
+
values: [
|
|
32
|
+
"action",
|
|
33
|
+
"anchor-context",
|
|
34
|
+
"chroma",
|
|
35
|
+
"direction",
|
|
36
|
+
"frame-prompt-style",
|
|
37
|
+
"frames",
|
|
38
|
+
"game-view",
|
|
39
|
+
"pose-board",
|
|
40
|
+
"role",
|
|
41
|
+
"style"
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
const styleOf = () => {
|
|
45
|
+
const style = getString(args, "style");
|
|
46
|
+
if (style !== void 0 && !STYLE_CHOICES.includes(style)) {
|
|
47
|
+
failUsage(
|
|
48
|
+
`argument --style: invalid choice: '${style}' (choose from ${STYLE_CHOICES.map((c) => `'${c}'`).join(", ")})`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return style ?? null;
|
|
52
|
+
};
|
|
53
|
+
const anchor = () => {
|
|
54
|
+
const direction = getString(args, "direction") ?? "";
|
|
55
|
+
if (direction === "") {
|
|
56
|
+
failUsage("--direction is required (n,s,e,w,ne,nw,se,sw)");
|
|
57
|
+
}
|
|
58
|
+
const prompt = renderAnchorPrompt(getDirection(direction), {
|
|
59
|
+
anchorContext: getString(args, "anchor-context") ?? null,
|
|
60
|
+
anchorRole: getString(args, "role") ?? "character",
|
|
61
|
+
chroma: getString(args, "chroma") ?? "#00FF00",
|
|
62
|
+
gameView: getString(args, "game-view") ?? "platformer",
|
|
63
|
+
guideImage: getFlag(args, "guide-image")
|
|
64
|
+
});
|
|
65
|
+
console.log(withStyle(prompt, styleOf()));
|
|
66
|
+
};
|
|
67
|
+
const poseBoard = () => {
|
|
68
|
+
const action = getString(args, "action") ?? "";
|
|
69
|
+
const direction = getString(args, "direction") ?? "";
|
|
70
|
+
if (action === "") {
|
|
71
|
+
failUsage("--action is required (e.g. attack, idle, walk)");
|
|
72
|
+
}
|
|
73
|
+
if (direction === "") {
|
|
74
|
+
failUsage("--direction is required (n,s,e,w,ne,nw,se,sw)");
|
|
75
|
+
}
|
|
76
|
+
const framePromptStyle = getString(args, "frame-prompt-style") ?? "specific";
|
|
77
|
+
if (framePromptStyle !== "specific" && framePromptStyle !== "loose") {
|
|
78
|
+
failUsage(
|
|
79
|
+
`argument --frame-prompt-style: invalid choice: '${framePromptStyle}' (choose from 'specific', 'loose')`
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
const board = resolvePoseBoardPreset(getString(args, "pose-board") ?? "standard");
|
|
83
|
+
const frames = getInt(args, "frames", 0);
|
|
84
|
+
if (frames <= 0) {
|
|
85
|
+
fail("--frames must be a positive integer");
|
|
86
|
+
}
|
|
87
|
+
if (frames > totalCells(board)) {
|
|
88
|
+
fail(
|
|
89
|
+
`--frames ${frames} exceeds the ${board.id} board's ${totalCells(board)} cells; use fewer frames or a larger --pose-board`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
const prompt = renderPoseBoardPrompt(
|
|
93
|
+
action.trim().toLowerCase(),
|
|
94
|
+
getDirection(direction),
|
|
95
|
+
frames,
|
|
96
|
+
{
|
|
97
|
+
chroma: getString(args, "chroma") ?? "#00FF00",
|
|
98
|
+
framePromptStyle,
|
|
99
|
+
guideImage: getFlag(args, "guide-image"),
|
|
100
|
+
poseBoard: board
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
console.log(withStyle(prompt, styleOf()));
|
|
104
|
+
};
|
|
105
|
+
const mode = (/* @__PURE__ */ new Map([
|
|
106
|
+
["anchor", anchor],
|
|
107
|
+
["pose-board", poseBoard]
|
|
108
|
+
])).get(args.positionals[0] ?? "");
|
|
109
|
+
if (mode === void 0) {
|
|
110
|
+
failUsage("Usage: vg asset sprite-prompt <anchor|pose-board> ...");
|
|
111
|
+
}
|
|
112
|
+
mode?.();
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
export {
|
|
116
|
+
run
|
|
117
|
+
};
|
|
@@ -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/credits.ts
|
|
@@ -95,7 +96,7 @@ var formatWhen = (date, now) => {
|
|
|
95
96
|
return date.toLocaleDateString("en-US", opts);
|
|
96
97
|
};
|
|
97
98
|
var requireLogin = () => {
|
|
98
|
-
if (
|
|
99
|
+
if ((getToken() ?? "") === "") {
|
|
99
100
|
consola.warn("Not logged in. Run `vg login` to authenticate.");
|
|
100
101
|
process.exit(1);
|
|
101
102
|
}
|
|
@@ -124,7 +125,6 @@ var balanceCommand = defineCommand({
|
|
|
124
125
|
note: e.note,
|
|
125
126
|
request_id: e.requestId
|
|
126
127
|
})),
|
|
127
|
-
// Whether `vg credits buy` can take a card payment; false means codes only.
|
|
128
128
|
purchases_enabled: purchasesEnabled
|
|
129
129
|
};
|
|
130
130
|
if (writeStructured(payload, args)) {
|
|
@@ -256,7 +256,6 @@ var buyCommand = defineCommand({
|
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
258
|
var creditsCommand = defineCommand({
|
|
259
|
-
// Declared so citty skips `--field <value>` when looking for a subcommand.
|
|
260
259
|
args: outputArgs,
|
|
261
260
|
default: "balance",
|
|
262
261
|
meta: {
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
getString,
|
|
11
|
+
main,
|
|
12
|
+
parseArgs,
|
|
13
|
+
parseFrame,
|
|
14
|
+
probeSheet,
|
|
15
|
+
resolveTargets,
|
|
16
|
+
writeJsonFile
|
|
17
|
+
} from "./chunk-OFJIG4K3.js";
|
|
18
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
|
+
import "./chunk-GKDUYJ7R.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/asset/sheet-probe.ts
|
|
22
|
+
var run = (argv) => {
|
|
23
|
+
main(() => {
|
|
24
|
+
const args = parseArgs([...argv], {
|
|
25
|
+
booleans: ["list", "show-empty"],
|
|
26
|
+
values: ["frame", "json"]
|
|
27
|
+
});
|
|
28
|
+
const [target = ""] = args.positionals;
|
|
29
|
+
if (target === "") {
|
|
30
|
+
failUsage("A PNG file or folder path is required.");
|
|
31
|
+
}
|
|
32
|
+
const frameSpec = getString(args, "frame") ?? "";
|
|
33
|
+
if (frameSpec === "") {
|
|
34
|
+
failUsage("--frame is required, e.g. --frame 32x32");
|
|
35
|
+
}
|
|
36
|
+
const frame = parseFrame(frameSpec);
|
|
37
|
+
const showEmpty = getFlag(args, "show-empty");
|
|
38
|
+
const results = resolveTargets(target).map((sheet) => probeSheet(sheet, frame, showEmpty));
|
|
39
|
+
for (const result of results) {
|
|
40
|
+
console.log(
|
|
41
|
+
`${result.path} grid=${result.grid.columns}x${result.grid.rows} non_empty=${result.non_empty.length} empty=${result.empty_count}`
|
|
42
|
+
);
|
|
43
|
+
if (getFlag(args, "list")) {
|
|
44
|
+
console.log(` non_empty=[${result.non_empty.map(([c, r]) => `(${c}, ${r})`).join(", ")}]`);
|
|
45
|
+
}
|
|
46
|
+
if (showEmpty) {
|
|
47
|
+
console.log(` empty=[${(result.empty ?? []).map(([c, r]) => `(${c}, ${r})`).join(", ")}]`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const json = getString(args, "json") ?? "";
|
|
51
|
+
if (json !== "") {
|
|
52
|
+
writeJsonFile(json, results);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
run
|
|
58
|
+
};
|
|
@@ -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
|
+
exportManifest,
|
|
9
|
+
fail,
|
|
10
|
+
failUsage,
|
|
11
|
+
getFlag,
|
|
12
|
+
getString,
|
|
13
|
+
main,
|
|
14
|
+
parseArgs,
|
|
15
|
+
writeJsonFile
|
|
16
|
+
} from "./chunk-OFJIG4K3.js";
|
|
17
|
+
import "./chunk-2SBBKY5C.js";
|
|
18
|
+
import "./chunk-GKDUYJ7R.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/asset/manifest-export-json.ts
|
|
21
|
+
import { existsSync } from "node:fs";
|
|
22
|
+
var run = (argv) => {
|
|
23
|
+
main(() => {
|
|
24
|
+
const args = parseArgs([...argv], {
|
|
25
|
+
booleans: ["keep-paths"],
|
|
26
|
+
values: ["manifest", "out"]
|
|
27
|
+
});
|
|
28
|
+
const manifest = getString(args, "manifest") ?? "";
|
|
29
|
+
const out = getString(args, "out") ?? "";
|
|
30
|
+
if (manifest === "") {
|
|
31
|
+
failUsage("--manifest is required (path to assets_index.lua or .json)");
|
|
32
|
+
}
|
|
33
|
+
if (out === "") {
|
|
34
|
+
failUsage("--out is required (output JSON path)");
|
|
35
|
+
}
|
|
36
|
+
if (!existsSync(manifest)) {
|
|
37
|
+
fail(`Manifest not found: ${manifest}`);
|
|
38
|
+
}
|
|
39
|
+
writeJsonFile(out, exportManifest(manifest, !getFlag(args, "keep-paths"), out));
|
|
40
|
+
console.log(`Wrote ${out}`);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
run
|
|
45
|
+
};
|
|
@@ -6,11 +6,12 @@ var __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
PKG_NAME
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AWJNAGPE.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/package-root.ts
|
|
16
17
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -18,7 +19,7 @@ import path from "node:path";
|
|
|
18
19
|
var findPackage = (dir) => {
|
|
19
20
|
const manifestPath = path.join(dir, "package.json");
|
|
20
21
|
if (existsSync(manifestPath)) {
|
|
21
|
-
const manifest =
|
|
22
|
+
const manifest = parseJson(readFileSync(manifestPath, "utf-8"));
|
|
22
23
|
if (isJsonObject(manifest) && manifest.name === PKG_NAME && isJsonString(manifest.version)) {
|
|
23
24
|
return { root: dir, version: manifest.version };
|
|
24
25
|
}
|
|
@@ -32,8 +33,10 @@ var findPackage = (dir) => {
|
|
|
32
33
|
var found = findPackage(import.meta.dirname);
|
|
33
34
|
var PACKAGE_ROOT = found.root;
|
|
34
35
|
var PACKAGE_VERSION = found.version;
|
|
36
|
+
var ASSETS_DIR = path.join(PACKAGE_ROOT, "assets");
|
|
35
37
|
|
|
36
38
|
export {
|
|
37
39
|
PACKAGE_ROOT,
|
|
38
|
-
PACKAGE_VERSION
|
|
40
|
+
PACKAGE_VERSION,
|
|
41
|
+
ASSETS_DIR
|
|
39
42
|
};
|
|
@@ -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-OFJIG4K3.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
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -5,15 +5,16 @@ import { fileURLToPath as __fileURLToPath } from "node:url";
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
var __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
var __dirname = __pathDirname(__filename);
|
|
8
|
-
import {
|
|
9
|
-
PACKAGE_VERSION
|
|
10
|
-
} from "./chunk-Z4Z24FWO.js";
|
|
11
|
-
import "./chunk-PEUP4MZR.js";
|
|
12
|
-
import "./chunk-J6PKNPI2.js";
|
|
13
8
|
import {
|
|
14
9
|
defineCommand,
|
|
15
10
|
runMain
|
|
16
11
|
} from "./chunk-MBXCVCC4.js";
|
|
12
|
+
import {
|
|
13
|
+
PACKAGE_VERSION
|
|
14
|
+
} from "./chunk-YNCYMWER.js";
|
|
15
|
+
import "./chunk-AWJNAGPE.js";
|
|
16
|
+
import "./chunk-RPSUFZAG.js";
|
|
17
|
+
import "./chunk-2SBBKY5C.js";
|
|
17
18
|
import "./chunk-GKDUYJ7R.js";
|
|
18
19
|
|
|
19
20
|
// src/index.ts
|
|
@@ -35,53 +36,55 @@ var main = defineCommand({
|
|
|
35
36
|
name: "vg",
|
|
36
37
|
version: PACKAGE_VERSION
|
|
37
38
|
},
|
|
38
|
-
// Each command is imported when it runs, so a call loads that command's code
|
|
39
|
-
// and dependencies alone. `vg --help` loads them all, for their descriptions.
|
|
40
39
|
subCommands: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// `vg playtest …` straight to the binary below. Only the meta is reused:
|
|
57
|
-
// citty runs a parent's `run` AFTER its subcommand, so carrying the
|
|
58
|
-
// passthrough here would forward `run …` to agent-browser once the
|
|
59
|
-
// playtest had finished and turn every passing run into an exit 1.
|
|
40
|
+
asset: lazy(async () => await import("./chunk-ALPTHSUT.js"), "assetCommand"),
|
|
41
|
+
check: lazy(async () => await import("./chunk-BJAN3RMY.js"), "checkCommand"),
|
|
42
|
+
completions: lazy(async () => await import("./chunk-VIEKOGKG.js"), "completionsCommand"),
|
|
43
|
+
config: lazy(async () => await import("./chunk-Q3XQPNF6.js"), "configCommand"),
|
|
44
|
+
credits: lazy(async () => await import("./chunk-VZEJ2ZHE.js"), "creditsCommand"),
|
|
45
|
+
deploy: lazy(async () => await import("./chunk-E7NDOZ27.js"), "deployCommand"),
|
|
46
|
+
deployments: lazy(async () => await import("./chunk-2ZKS7V72.js"), "deploymentsCommand"),
|
|
47
|
+
distribute: lazy(async () => await import("./chunk-LORGE2NB.js"), "distributeCommand"),
|
|
48
|
+
factory: lazy(async () => await import("./chunk-K36EOII3.js"), "factoryCommand"),
|
|
49
|
+
fork: lazy(async () => await import("./chunk-MEAO33XW.js"), "forkCommand"),
|
|
50
|
+
generate: lazy(async () => await import("./chunk-ABTUEIRC.js"), "generateCommand"),
|
|
51
|
+
init: lazy(async () => await import("./chunk-H2C4QUTG.js"), "initCommand"),
|
|
52
|
+
login: lazy(async () => await import("./chunk-43P4U7CB.js"), "loginCommand"),
|
|
53
|
+
logout: lazy(async () => await import("./chunk-SXYQL4GK.js"), "logoutCommand"),
|
|
54
|
+
new: lazy(async () => await import("./chunk-BN3Q7UEC.js"), "newCommand"),
|
|
60
55
|
playtest: async () => {
|
|
61
|
-
const { playtestCommand } = await import("./chunk-
|
|
56
|
+
const { playtestCommand } = await import("./chunk-HSMG6U7J.js");
|
|
62
57
|
return defineCommand({
|
|
63
58
|
meta: playtestCommand.meta,
|
|
64
59
|
subCommands: {
|
|
65
|
-
run: lazy(() => import("./chunk-
|
|
60
|
+
run: lazy(async () => await import("./chunk-LONQWRTR.js"), "playtestRunCommand")
|
|
66
61
|
}
|
|
67
62
|
});
|
|
68
63
|
},
|
|
69
|
-
skills: lazy(() => import("./chunk-
|
|
70
|
-
update: lazy(() => import("./chunk-
|
|
71
|
-
whoami: lazy(() => import("./chunk-
|
|
64
|
+
skills: lazy(async () => await import("./chunk-UPHB5HWO.js"), "skillsCommand"),
|
|
65
|
+
update: lazy(async () => await import("./chunk-MR5KIFI7.js"), "updateCommand"),
|
|
66
|
+
whoami: lazy(async () => await import("./chunk-HRKVAXNN.js"), "whoamiCommand")
|
|
72
67
|
}
|
|
73
68
|
});
|
|
74
69
|
var subcommand = process.argv.at(2);
|
|
75
|
-
if (subcommand && !["update", "init", "completions"].includes(subcommand)) {
|
|
76
|
-
const { maybeScheduleAutoUpdate } = await import("./chunk-
|
|
70
|
+
if (subcommand !== void 0 && subcommand !== "" && !["update", "init", "completions"].includes(subcommand)) {
|
|
71
|
+
const { maybeScheduleAutoUpdate } = await import("./chunk-4UU622RK.js");
|
|
77
72
|
maybeScheduleAutoUpdate();
|
|
78
73
|
}
|
|
79
74
|
if (subcommand === "factory") {
|
|
80
|
-
const { runFactory } = await import("./chunk-
|
|
75
|
+
const { runFactory } = await import("./chunk-K36EOII3.js");
|
|
81
76
|
runFactory(process.argv.slice(3));
|
|
82
77
|
}
|
|
83
78
|
if (subcommand === "playtest" && process.argv.at(3) !== "run") {
|
|
84
|
-
const { runPlaytest } = await import("./chunk-
|
|
79
|
+
const { runPlaytest } = await import("./chunk-HSMG6U7J.js");
|
|
85
80
|
runPlaytest(process.argv.slice(3));
|
|
86
81
|
}
|
|
87
|
-
|
|
82
|
+
if (subcommand === "asset") {
|
|
83
|
+
const { runAsset } = await import("./chunk-ALPTHSUT.js");
|
|
84
|
+
await runAsset(process.argv.slice(3));
|
|
85
|
+
} else if (subcommand === "check") {
|
|
86
|
+
const { runCheck } = await import("./chunk-BJAN3RMY.js");
|
|
87
|
+
await runCheck(process.argv.slice(3));
|
|
88
|
+
} else {
|
|
89
|
+
await runMain(main);
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibedgames",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"vg": "./dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
|
+
"assets",
|
|
9
10
|
"dist",
|
|
10
11
|
"templates"
|
|
11
12
|
],
|
|
12
13
|
"type": "module",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "node scripts/build.ts",
|
|
16
|
+
"dev": "node scripts/build.ts --watch",
|
|
17
|
+
"clean": "rm -rf .turbo dist node_modules",
|
|
18
|
+
"test": "node --import tsx --test \"test/*.test.ts\" \"src/**/*.test.ts\"",
|
|
19
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p templates/none && tsc --noEmit -p templates/phaser && tsc --noEmit -p templates/react-r3f && tsc --noEmit -p templates/threejs"
|
|
20
|
+
},
|
|
13
21
|
"devDependencies": {
|
|
14
|
-
"@kyh/tsconfig": "
|
|
15
|
-
"@orpc/client": "
|
|
16
|
-
"@
|
|
22
|
+
"@kyh/tsconfig": "catalog:",
|
|
23
|
+
"@orpc/client": "catalog:",
|
|
24
|
+
"@react-three/drei": "^10.7.9",
|
|
25
|
+
"@react-three/fiber": "^9.8.2",
|
|
26
|
+
"@repo/asset-tools": "workspace:^",
|
|
27
|
+
"@repo/contract": "workspace:^",
|
|
17
28
|
"@types/cross-spawn": "^6.0.6",
|
|
18
|
-
"@types/node": "
|
|
29
|
+
"@types/node": "catalog:",
|
|
30
|
+
"@types/react": "catalog:",
|
|
31
|
+
"@types/react-dom": "catalog:",
|
|
32
|
+
"@types/three": "^0.186.0",
|
|
33
|
+
"@vitejs/plugin-react": "catalog:",
|
|
19
34
|
"citty": "^0.2.2",
|
|
20
35
|
"consola": "^3.4.2",
|
|
21
36
|
"cross-spawn": "^7.0.6",
|
|
22
37
|
"esbuild": "^0.28.2",
|
|
23
38
|
"fflate": "^0.8.3",
|
|
24
|
-
"ignore": "^7.0.
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
39
|
+
"ignore": "^7.0.16",
|
|
40
|
+
"msw": "2.11.3",
|
|
41
|
+
"phaser": "^4.2.1",
|
|
42
|
+
"react": "catalog:",
|
|
43
|
+
"react-dom": "catalog:",
|
|
44
|
+
"tar": "^7.5.23",
|
|
45
|
+
"three": "^0.186.1",
|
|
46
|
+
"typescript": "catalog:",
|
|
47
|
+
"vite": "catalog:",
|
|
48
|
+
"zod": "catalog:"
|
|
34
49
|
}
|
|
35
|
-
}
|
|
50
|
+
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
const host = document.querySelector("#game");
|
|
2
2
|
const canvas = document.createElement("canvas");
|
|
3
|
+
|
|
3
4
|
canvas.width = 800;
|
|
5
|
+
|
|
4
6
|
canvas.height = 600;
|
|
7
|
+
|
|
5
8
|
host?.append(canvas);
|
|
6
9
|
|
|
7
10
|
const ctx = canvas.getContext("2d");
|
|
11
|
+
|
|
8
12
|
if (ctx) {
|
|
9
13
|
ctx.fillStyle = "#fff";
|
|
10
14
|
ctx.textAlign = "center";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { defineConfig } from "vite";
|
|
2
2
|
|
|
3
|
-
// A relative base keeps built asset URLs relative, so the bundle works wherever it is
|
|
4
|
-
// hosted — including {slug}.vibedgames.com after `vg deploy ./dist`.
|
|
5
3
|
export default defineConfig({
|
|
6
4
|
base: "./",
|
|
7
5
|
server: { port: 5173 },
|
|
@@ -7,7 +7,6 @@ const config: Types.Core.GameConfig = {
|
|
|
7
7
|
backgroundColor: "#0e1020",
|
|
8
8
|
parent: "game",
|
|
9
9
|
physics: { arcade: { debug: false }, default: "arcade" },
|
|
10
|
-
// A fixed 960×540 world, letterboxed to fit any window.
|
|
11
10
|
scale: { autoCenter: Scale.CENTER_BOTH, height: 540, mode: Scale.FIT, width: 960 },
|
|
12
11
|
scene: [GameScene],
|
|
13
12
|
type: AUTO,
|