vibedgames 0.6.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +14 -9
  2. package/dist/THIRD_PARTY_NOTICES.txt +383 -0
  3. package/dist/chunk-2QBYTIMH.js +511 -0
  4. package/dist/chunk-6FZPPUQH.js +107 -0
  5. package/dist/chunk-AZGENOOR.js +22 -0
  6. package/dist/chunk-CAKBGDCY.js +47 -0
  7. package/dist/chunk-CU7UY5YJ.js +1108 -0
  8. package/dist/chunk-CZPKN32Z.js +257 -0
  9. package/dist/chunk-FL6IFBUF.js +22 -0
  10. package/dist/chunk-FNYBZNW2.js +165 -0
  11. package/dist/chunk-GUF6ADBF.js +273 -0
  12. package/dist/chunk-H4NBRFBY.js +79 -0
  13. package/dist/chunk-HASKWB6B.js +111 -0
  14. package/dist/chunk-I6O4HIDY.js +1063 -0
  15. package/dist/chunk-IO6OM6WM.js +466 -0
  16. package/dist/chunk-J6PKNPI2.js +26 -0
  17. package/dist/chunk-JT2AU24K.js +759 -0
  18. package/dist/chunk-K5SC6SXO.js +172 -0
  19. package/dist/chunk-MBXCVCC4.js +478 -0
  20. package/dist/chunk-PEUP4MZR.js +59 -0
  21. package/dist/chunk-PQDBCZRT.js +2017 -0
  22. package/dist/chunk-RIGKOLNN.js +1360 -0
  23. package/dist/chunk-RNBUX5VF.js +68 -0
  24. package/dist/chunk-RYFO3ZPO.js +71 -0
  25. package/dist/chunk-RZ4DIJQW.js +68 -0
  26. package/dist/chunk-SAANBZ25.js +118 -0
  27. package/dist/chunk-TMK6V5FV.js +395 -0
  28. package/dist/chunk-TYVYWBY6.js +69 -0
  29. package/dist/chunk-VFFOT7KD.js +2980 -0
  30. package/dist/chunk-W5XP4ZVU.js +159 -0
  31. package/dist/chunk-X4ZABSCN.js +415 -0
  32. package/dist/chunk-XDC7QGOF.js +32 -0
  33. package/dist/chunk-XK5RZQMX.js +1780 -0
  34. package/dist/chunk-Y552BNFZ.js +41 -0
  35. package/dist/chunk-Z4Z24FWO.js +39 -0
  36. package/dist/chunk-ZI6PKVXG.js +64 -0
  37. package/dist/chunk-ZYCSYJWX.js +87 -0
  38. package/dist/index.js +67 -60
  39. package/package.json +13 -16
  40. package/templates/none/_gitignore +3 -0
  41. package/templates/none/index.html +29 -0
  42. package/templates/none/package.json +16 -0
  43. package/templates/none/src/main.ts +16 -0
  44. package/templates/none/tsconfig.json +18 -0
  45. package/templates/none/vite.config.ts +8 -0
  46. package/templates/phaser/_gitignore +3 -0
  47. package/templates/phaser/index.html +24 -0
  48. package/templates/phaser/package.json +19 -0
  49. package/templates/phaser/src/main.ts +16 -0
  50. package/templates/phaser/src/scenes/game-scene.ts +65 -0
  51. package/templates/phaser/tsconfig.json +18 -0
  52. package/templates/phaser/vite.config.ts +8 -0
  53. package/templates/react-r3f/_gitignore +3 -0
  54. package/templates/react-r3f/index.html +24 -0
  55. package/templates/react-r3f/package.json +27 -0
  56. package/templates/react-r3f/src/app.tsx +33 -0
  57. package/templates/react-r3f/src/main.tsx +15 -0
  58. package/templates/react-r3f/tsconfig.json +19 -0
  59. package/templates/react-r3f/vite.config.ts +10 -0
  60. package/templates/threejs/_gitignore +3 -0
  61. package/templates/threejs/index.html +36 -0
  62. package/templates/threejs/package.json +20 -0
  63. package/templates/threejs/src/main.ts +44 -0
  64. package/templates/threejs/tsconfig.json +18 -0
  65. package/templates/threejs/vite.config.ts +8 -0
  66. package/dist/commands/completions.d.ts +0 -7
  67. package/dist/commands/completions.js +0 -145
  68. package/dist/commands/credits.d.ts +0 -10
  69. package/dist/commands/credits.js +0 -136
  70. package/dist/commands/deploy.d.ts +0 -26
  71. package/dist/commands/deploy.js +0 -257
  72. package/dist/commands/factory.d.ts +0 -3
  73. package/dist/commands/factory.js +0 -73
  74. package/dist/commands/fork.d.ts +0 -29
  75. package/dist/commands/fork.js +0 -124
  76. package/dist/commands/generate.d.ts +0 -1
  77. package/dist/commands/generate.js +0 -565
  78. package/dist/commands/init.d.ts +0 -20
  79. package/dist/commands/init.js +0 -105
  80. package/dist/commands/login.d.ts +0 -1
  81. package/dist/commands/login.js +0 -45
  82. package/dist/commands/logout.d.ts +0 -1
  83. package/dist/commands/logout.js +0 -13
  84. package/dist/commands/new.d.ts +0 -26
  85. package/dist/commands/new.js +0 -318
  86. package/dist/commands/playtest-run.d.ts +0 -66
  87. package/dist/commands/playtest-run.js +0 -268
  88. package/dist/commands/playtest.d.ts +0 -76
  89. package/dist/commands/playtest.js +0 -372
  90. package/dist/commands/update.d.ts +0 -13
  91. package/dist/commands/update.js +0 -82
  92. package/dist/commands/whoami.d.ts +0 -10
  93. package/dist/commands/whoami.js +0 -44
  94. package/dist/index.d.ts +0 -2
  95. package/dist/lib/api.d.ts +0 -18
  96. package/dist/lib/api.js +0 -27
  97. package/dist/lib/archive.d.ts +0 -17
  98. package/dist/lib/archive.js +0 -228
  99. package/dist/lib/codex.d.ts +0 -117
  100. package/dist/lib/codex.js +0 -426
  101. package/dist/lib/config-file.d.ts +0 -16
  102. package/dist/lib/config-file.js +0 -54
  103. package/dist/lib/config.d.ts +0 -11
  104. package/dist/lib/config.js +0 -54
  105. package/dist/lib/manifest.d.ts +0 -10
  106. package/dist/lib/manifest.js +0 -91
  107. package/dist/lib/media-args.d.ts +0 -30
  108. package/dist/lib/media-args.js +0 -219
  109. package/dist/lib/media-download.d.ts +0 -37
  110. package/dist/lib/media-download.js +0 -268
  111. package/dist/lib/media-poll.d.ts +0 -18
  112. package/dist/lib/media-poll.js +0 -86
  113. package/dist/lib/media-upload.d.ts +0 -12
  114. package/dist/lib/media-upload.js +0 -52
  115. package/dist/lib/output.d.ts +0 -68
  116. package/dist/lib/output.js +0 -102
  117. package/dist/lib/package-manager.d.ts +0 -25
  118. package/dist/lib/package-manager.js +0 -77
  119. package/dist/lib/playtest/agent.d.ts +0 -192
  120. package/dist/lib/playtest/agent.js +0 -652
  121. package/dist/lib/playtest/browser.d.ts +0 -109
  122. package/dist/lib/playtest/browser.js +0 -219
  123. package/dist/lib/playtest/controls.d.ts +0 -47
  124. package/dist/lib/playtest/controls.js +0 -218
  125. package/dist/lib/playtest/errors.d.ts +0 -9
  126. package/dist/lib/playtest/errors.js +0 -12
  127. package/dist/lib/playtest/keys.d.ts +0 -41
  128. package/dist/lib/playtest/keys.js +0 -157
  129. package/dist/lib/playtest/run.d.ts +0 -195
  130. package/dist/lib/playtest/run.js +0 -409
  131. package/dist/lib/run.d.ts +0 -19
  132. package/dist/lib/run.js +0 -23
  133. package/dist/lib/strict-args.d.ts +0 -27
  134. package/dist/lib/strict-args.js +0 -78
  135. package/dist/lib/types.d.ts +0 -16
  136. package/dist/lib/types.js +0 -10
  137. package/dist/lib/update.d.ts +0 -10
  138. package/dist/lib/update.js +0 -110
  139. package/dist/lib/upload.d.ts +0 -16
  140. package/dist/lib/upload.js +0 -41
@@ -0,0 +1,395 @@
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
+ So
9
+ } from "./chunk-VFFOT7KD.js";
10
+ import {
11
+ SLUG_RE
12
+ } from "./chunk-ZI6PKVXG.js";
13
+ import {
14
+ PACKAGE_ROOT
15
+ } from "./chunk-Z4Z24FWO.js";
16
+ import "./chunk-PEUP4MZR.js";
17
+ import {
18
+ assertKnownFlags
19
+ } from "./chunk-RZ4DIJQW.js";
20
+ import {
21
+ isJsonObject,
22
+ isJsonString
23
+ } from "./chunk-J6PKNPI2.js";
24
+ import {
25
+ consola
26
+ } from "./chunk-CU7UY5YJ.js";
27
+ import {
28
+ defineCommand
29
+ } from "./chunk-MBXCVCC4.js";
30
+ import "./chunk-CAKBGDCY.js";
31
+
32
+ // src/commands/new.ts
33
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
34
+ import path2 from "node:path";
35
+
36
+ // src/lib/template-source.ts
37
+ import { once } from "node:events";
38
+ import { readdirSync } from "node:fs";
39
+ var REPO_PREFIXES = ["github:", "https://github.com/", "http://github.com/", "git@github.com:"];
40
+ var OTHER_HOSTS = /^(?:gitlab|bitbucket|sourcehut|codeberg):|^(?:https?:\/\/|git@)(?!github\.com[/:])/u;
41
+ var OWNER = /^[A-Za-z\d](?:[A-Za-z\d-]*[A-Za-z\d])?$/u;
42
+ var NAME = /^[\w.-]+$/u;
43
+ var SPEC_FORMS = "owner/repo, owner/repo/sub/dir or owner/repo#ref";
44
+ var parseTemplateSpec = (spec) => {
45
+ const trimmed = spec.trim();
46
+ const hashAt = trimmed.indexOf("#");
47
+ const location = hashAt === -1 ? trimmed : trimmed.slice(0, hashAt);
48
+ const ref = hashAt === -1 ? "HEAD" : trimmed.slice(hashAt + 1);
49
+ if (OTHER_HOSTS.test(location)) {
50
+ throw new Error(`Only GitHub templates are supported: ${SPEC_FORMS}.`);
51
+ }
52
+ const prefix = REPO_PREFIXES.find((candidate) => location.startsWith(candidate)) ?? "";
53
+ const [owner = "", repoSegment = "", ...subdir] = location.slice(prefix.length).replace(/\/+$/u, "").split("/");
54
+ const repo = repoSegment.replace(/\.git$/u, "");
55
+ if (!OWNER.test(owner) || !NAME.test(repo) || subdir.some((part) => !NAME.test(part) || part === "." || part === "..") || !ref || /\s/u.test(ref)) {
56
+ throw new Error(`"${spec}" is not a GitHub template spec. Use ${SPEC_FORMS}.`);
57
+ }
58
+ return { owner, ref, repo, subdir: subdir.join("/") };
59
+ };
60
+ var templateTarballUrl = ({ owner, repo, ref }) => `https://codeload.github.com/${owner}/${repo}/tar.gz/${ref.split("/").map(encodeURIComponent).join("/")}`;
61
+ var fetchTemplate = async (template, target, force, fetchImpl = fetch) => {
62
+ if (!force && readdirSync(target).length > 0) {
63
+ throw new Error(`${target} is not empty. Pass --force to scaffold into it anyway.`);
64
+ }
65
+ const url = templateTarballUrl(template);
66
+ const res = await fetchImpl(url, { signal: AbortSignal.timeout(12e4) });
67
+ if (res.status === 404) {
68
+ throw new Error(
69
+ `GitHub has no ${template.owner}/${template.repo} at ${template.ref} (or the repo is private).`
70
+ );
71
+ }
72
+ if (!res.ok) {
73
+ throw new Error(`Couldn't download ${url}: HTTP ${res.status}.`);
74
+ }
75
+ const tarball = Buffer.from(await res.arrayBuffer());
76
+ const prefix = template.subdir ? template.subdir.split("/") : [];
77
+ let unpacked = 0;
78
+ const unpack = So({
79
+ cwd: target,
80
+ filter: (entryPath) => {
81
+ const parts = entryPath.split("/").slice(1);
82
+ const inside = parts.length > prefix.length && prefix.every((part, index) => parts[index] === part);
83
+ if (inside) {
84
+ unpacked += 1;
85
+ }
86
+ return inside;
87
+ },
88
+ strip: 1 + prefix.length
89
+ });
90
+ const closed = once(unpack, "close");
91
+ unpack.end(tarball);
92
+ await closed;
93
+ if (unpacked === 0) {
94
+ throw new Error(
95
+ template.subdir ? `${template.owner}/${template.repo} has no directory ${template.subdir} at ${template.ref}.` : `${template.owner}/${template.repo} at ${template.ref} has no files.`
96
+ );
97
+ }
98
+ };
99
+
100
+ // src/lib/templates.ts
101
+ import {
102
+ copyFileSync,
103
+ existsSync,
104
+ mkdirSync,
105
+ readdirSync as readdirSync2,
106
+ readFileSync,
107
+ writeFileSync
108
+ } from "node:fs";
109
+ import path from "node:path";
110
+ var TEMPLATES_DIR = path.join(PACKAGE_ROOT, "templates");
111
+ var SLUG_TOKEN = "__VG_SLUG__";
112
+ var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".css", ".html", ".json", ".md", ".ts", ".tsx"]);
113
+ var SKIPPED_ENTRIES = /* @__PURE__ */ new Set([".turbo", "dist", "node_modules"]);
114
+ var GITIGNORE_STAND_IN = "_gitignore";
115
+ var copyTemplate = (template, target, slug, force, templatesDir = TEMPLATES_DIR) => {
116
+ const root = path.join(templatesDir, template);
117
+ if (!existsSync(root)) {
118
+ throw new Error(`No bundled template named "${template}" in ${templatesDir}.`);
119
+ }
120
+ const kept = [];
121
+ const walk = (from, relative) => {
122
+ for (const entry of readdirSync2(from, { withFileTypes: true })) {
123
+ if (SKIPPED_ENTRIES.has(entry.name)) {
124
+ continue;
125
+ }
126
+ const source = path.join(from, entry.name);
127
+ const name = entry.name === GITIGNORE_STAND_IN ? ".gitignore" : entry.name;
128
+ const relativePath = path.join(relative, name);
129
+ if (entry.isDirectory()) {
130
+ walk(source, relativePath);
131
+ continue;
132
+ }
133
+ const destination = path.join(target, relativePath);
134
+ if (existsSync(destination) && !force) {
135
+ kept.push(relativePath);
136
+ continue;
137
+ }
138
+ mkdirSync(path.dirname(destination), { recursive: true });
139
+ if (TEXT_EXTENSIONS.has(path.extname(name))) {
140
+ writeFileSync(destination, readFileSync(source, "utf-8").replaceAll(SLUG_TOKEN, slug));
141
+ } else {
142
+ copyFileSync(source, destination);
143
+ }
144
+ }
145
+ };
146
+ walk(root, "");
147
+ return kept;
148
+ };
149
+
150
+ // src/commands/new.ts
151
+ var ENGINES = /* @__PURE__ */ new Map([
152
+ [
153
+ "phaser",
154
+ { kind: "bundled", label: "Phaser 4 + Vite + TypeScript", skill: "phaser", template: "phaser" }
155
+ ],
156
+ [
157
+ "threejs",
158
+ {
159
+ kind: "bundled",
160
+ label: "Three.js + Vite + TypeScript",
161
+ skill: "threejs",
162
+ template: "threejs"
163
+ }
164
+ ],
165
+ [
166
+ "react-r3f",
167
+ {
168
+ kind: "bundled",
169
+ label: "React Three Fiber + drei + Vite + TypeScript",
170
+ skill: "threejs",
171
+ template: "react-r3f"
172
+ }
173
+ ],
174
+ [
175
+ "none",
176
+ {
177
+ kind: "bundled",
178
+ label: "minimal Vite + TypeScript canvas",
179
+ skill: "deploy",
180
+ template: "none"
181
+ }
182
+ ]
183
+ ]);
184
+ var ENGINE_IDS = [...ENGINES.keys()];
185
+ var newArgs = {
186
+ engine: {
187
+ default: "phaser",
188
+ description: `Engine preset: ${ENGINE_IDS.join(", ")} (default: phaser).`,
189
+ type: "string"
190
+ },
191
+ force: {
192
+ default: false,
193
+ description: "Overwrite an existing target directory.",
194
+ type: "boolean"
195
+ },
196
+ here: {
197
+ default: false,
198
+ description: "Write into the current directory instead of creating <slug>/.",
199
+ type: "boolean"
200
+ },
201
+ slug: {
202
+ description: "Lowercase, hyphenated slug \u2014 used as the directory name and deploy subdomain.",
203
+ required: true,
204
+ type: "positional"
205
+ },
206
+ template: {
207
+ description: "Fetch a third-party template from GitHub instead of a bundled preset: owner/repo, owner/repo/sub/dir, either with #branch, #tag or #commit. Needs network; not maintained by vibedgames.",
208
+ type: "string"
209
+ }
210
+ };
211
+ var cleanTemplateArtifacts = (target) => {
212
+ for (const f of ["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock"]) {
213
+ const p = path2.resolve(target, f);
214
+ if (existsSync2(p)) {
215
+ rmSync(p);
216
+ }
217
+ }
218
+ const gh = path2.resolve(target, ".github");
219
+ if (existsSync2(gh)) {
220
+ rmSync(gh, { recursive: true });
221
+ }
222
+ };
223
+ var ensureViteConfig = (target) => {
224
+ const hasConfig = ["vite.config.ts", "vite.config.js", "vite.config.mjs"].some(
225
+ (f) => existsSync2(path2.resolve(target, f))
226
+ ) || existsSync2(path2.resolve(target, "vite"));
227
+ if (hasConfig) {
228
+ return;
229
+ }
230
+ writeFileSync2(
231
+ path2.resolve(target, "vite.config.ts"),
232
+ `import { defineConfig } from "vite";
233
+
234
+ export default defineConfig({
235
+ base: "./",
236
+ });
237
+ `
238
+ );
239
+ };
240
+ var ensureTypecheckScript = (target) => {
241
+ const pkgPath = path2.resolve(target, "package.json");
242
+ if (!existsSync2(pkgPath)) {
243
+ return;
244
+ }
245
+ try {
246
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
247
+ if (!isJsonObject(pkg)) {
248
+ return;
249
+ }
250
+ const scripts = isJsonObject(pkg.scripts) ? pkg.scripts : {};
251
+ if (isJsonString(scripts.typecheck)) {
252
+ return;
253
+ }
254
+ scripts.typecheck = "tsc --noEmit";
255
+ pkg.scripts = scripts;
256
+ writeFileSync2(pkgPath, `${JSON.stringify(pkg, null, 2)}
257
+ `);
258
+ } catch {
259
+ }
260
+ };
261
+ var rewritePackageName = (target, slug) => {
262
+ const pkgPath = path2.resolve(target, "package.json");
263
+ if (!existsSync2(pkgPath)) {
264
+ return;
265
+ }
266
+ try {
267
+ const raw = readFileSync2(pkgPath, "utf-8");
268
+ const pkg = JSON.parse(raw);
269
+ if (!isJsonObject(pkg)) {
270
+ throw new Error("package.json is not a JSON object");
271
+ }
272
+ pkg.name = slug;
273
+ delete pkg.repository;
274
+ delete pkg.bugs;
275
+ delete pkg.homepage;
276
+ writeFileSync2(pkgPath, `${JSON.stringify(pkg, null, 2)}
277
+ `);
278
+ } catch (error) {
279
+ consola.warn(
280
+ `Could not rewrite package.json name to ${slug}: ${error instanceof Error ? error.message : String(error)}`
281
+ );
282
+ }
283
+ };
284
+ var writeVibedgamesJson = (target, slug) => {
285
+ writeFileSync2(
286
+ path2.resolve(target, "vibedgames.json"),
287
+ `${JSON.stringify({ name: slug.replaceAll("-", " "), slug }, null, 2)}
288
+ `
289
+ );
290
+ };
291
+ var writeReadme = (target, slug, preset) => {
292
+ const readmePath = path2.resolve(target, "README.md");
293
+ const footer = `
294
+
295
+ ---
296
+
297
+ ## Vibedgames
298
+
299
+ This project was scaffolded with \`vg new ${slug}\` (${preset.label}).
300
+
301
+ \`\`\`sh
302
+ npm install
303
+ npm run dev # local preview
304
+ npm run build
305
+ vg deploy ./dist # ships to ${slug}.vibedgames.com
306
+ \`\`\`
307
+
308
+ For engine-specific work, the \`${preset.skill}\` skill loads automatically in Claude Code.
309
+ `;
310
+ if (existsSync2(readmePath)) {
311
+ const existing = readFileSync2(readmePath, "utf-8");
312
+ if (existing.includes("## Vibedgames")) {
313
+ return;
314
+ }
315
+ writeFileSync2(readmePath, existing.replace(/\s*$/u, "") + footer);
316
+ return;
317
+ }
318
+ writeFileSync2(readmePath, `# ${slug}${footer}`);
319
+ };
320
+ var newCommand = defineCommand({
321
+ args: newArgs,
322
+ meta: {
323
+ description: "Scaffold a new browser game from a template bundled with the CLI (phaser, threejs, react-r3f, none). Works offline.",
324
+ name: "new"
325
+ },
326
+ run: async ({ args, rawArgs }) => {
327
+ assertKnownFlags(rawArgs, newArgs);
328
+ const slug = args.slug.trim().toLowerCase();
329
+ if (!SLUG_RE.test(slug)) {
330
+ consola.error(
331
+ `Invalid slug: ${args.slug}
332
+ Use lowercase letters, digits, and hyphens (e.g. "asteroid-belt").`
333
+ );
334
+ process.exit(1);
335
+ }
336
+ let template;
337
+ try {
338
+ template = args.template ? parseTemplateSpec(args.template) : void 0;
339
+ } catch (error) {
340
+ consola.error(error instanceof Error ? error.message : String(error));
341
+ process.exit(1);
342
+ }
343
+ const preset = template ? { kind: "remote", label: `custom: ${args.template}`, skill: "deploy", template } : ENGINES.get(args.engine);
344
+ if (!preset) {
345
+ consola.error(`Unknown engine: ${args.engine}. Use one of: ${ENGINE_IDS.join(", ")}.`);
346
+ process.exit(1);
347
+ }
348
+ const target = args.here ? process.cwd() : path2.resolve(process.cwd(), slug);
349
+ if (!args.here) {
350
+ if (existsSync2(target) && !args.force) {
351
+ consola.error(
352
+ `Directory ${target} already exists. Pass --force to overwrite, or pick a different slug.`
353
+ );
354
+ process.exit(1);
355
+ }
356
+ mkdirSync2(target, { recursive: true });
357
+ }
358
+ consola.start(`Scaffolding ${slug} with ${preset.label}`);
359
+ if (preset.kind === "bundled") {
360
+ for (const file of copyTemplate(preset.template, target, slug, args.force)) {
361
+ consola.warn(`Kept the existing ${file} (pass --force to overwrite it).`);
362
+ }
363
+ } else {
364
+ try {
365
+ await fetchTemplate(preset.template, target, args.force);
366
+ } catch (error) {
367
+ consola.error(
368
+ `Failed to fetch template ${args.template}: ${error instanceof Error ? error.message : String(error)}
369
+ Check your network connection, or drop --template to use a bundled engine preset.`
370
+ );
371
+ process.exit(1);
372
+ }
373
+ cleanTemplateArtifacts(target);
374
+ ensureViteConfig(target);
375
+ ensureTypecheckScript(target);
376
+ }
377
+ rewritePackageName(target, slug);
378
+ writeVibedgamesJson(target, slug);
379
+ writeReadme(target, slug, preset);
380
+ consola.success(`Scaffolded ${slug} in ${target}`);
381
+ consola.log("");
382
+ consola.info("Next steps:");
383
+ consola.log(` cd ${args.here ? "." : slug}`);
384
+ consola.log(" npm install");
385
+ consola.log(" npm run dev");
386
+ consola.log(" # then: npm run build && vg deploy ./dist");
387
+ consola.log("");
388
+ consola.log(
389
+ `Skill to load for engine work: ${preset.skill} (Claude Code: triggered automatically by package.json deps)`
390
+ );
391
+ }
392
+ });
393
+ export {
394
+ newCommand
395
+ };
@@ -0,0 +1,69 @@
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
+ authErrorCode,
9
+ createClient
10
+ } from "./chunk-PQDBCZRT.js";
11
+ import "./chunk-Z4Z24FWO.js";
12
+ import "./chunk-PEUP4MZR.js";
13
+ import {
14
+ outputArgs,
15
+ writeStructured
16
+ } from "./chunk-ZYCSYJWX.js";
17
+ import {
18
+ assertKnownFlags
19
+ } from "./chunk-RZ4DIJQW.js";
20
+ import {
21
+ getToken
22
+ } from "./chunk-RYFO3ZPO.js";
23
+ import "./chunk-J6PKNPI2.js";
24
+ import {
25
+ consola
26
+ } from "./chunk-CU7UY5YJ.js";
27
+ import {
28
+ defineCommand
29
+ } from "./chunk-MBXCVCC4.js";
30
+ import "./chunk-CAKBGDCY.js";
31
+
32
+ // src/commands/whoami.ts
33
+ var whoamiArgs = { ...outputArgs };
34
+ var whoamiCommand = defineCommand({
35
+ args: whoamiArgs,
36
+ meta: {
37
+ description: "Show the currently authenticated user",
38
+ name: "whoami"
39
+ },
40
+ run: async ({ args, rawArgs }) => {
41
+ assertKnownFlags(rawArgs, whoamiArgs);
42
+ const token = getToken();
43
+ if (!token) {
44
+ consola.warn("Not logged in. Run `vg login` to authenticate.");
45
+ process.exit(1);
46
+ }
47
+ const client = createClient();
48
+ try {
49
+ const user = await client.auth.me();
50
+ if (writeStructured({ email: user.email, id: user.id, name: user.name }, args)) {
51
+ return;
52
+ }
53
+ consola.log(`${user.name} (${user.email})`);
54
+ } catch (error) {
55
+ const code = authErrorCode(error);
56
+ if (code === "UNAUTHORIZED" || code === "FORBIDDEN") {
57
+ consola.warn("Not authenticated. Run `vg login`, or check your VG_TOKEN / API key.");
58
+ } else {
59
+ consola.error(
60
+ `Failed to fetch current user: ${error instanceof Error ? error.message : String(error)}`
61
+ );
62
+ }
63
+ process.exit(1);
64
+ }
65
+ }
66
+ });
67
+ export {
68
+ whoamiCommand
69
+ };