vibedgames 0.6.2 → 0.7.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-2GL2WJZX.js +172 -0
  4. package/dist/chunk-2QBYTIMH.js +511 -0
  5. package/dist/chunk-34AHIMX7.js +466 -0
  6. package/dist/chunk-6FZPPUQH.js +107 -0
  7. package/dist/chunk-BVVYDSFJ.js +99 -0
  8. package/dist/chunk-CAKBGDCY.js +47 -0
  9. package/dist/chunk-CBKOPVU6.js +1780 -0
  10. package/dist/chunk-CU7UY5YJ.js +1108 -0
  11. package/dist/chunk-CZPKN32Z.js +257 -0
  12. package/dist/chunk-DHEXGWJY.js +111 -0
  13. package/dist/chunk-FL6IFBUF.js +22 -0
  14. package/dist/chunk-FLUXEHMU.js +1360 -0
  15. package/dist/chunk-FNYBZNW2.js +165 -0
  16. package/dist/chunk-G5FRIFA3.js +22 -0
  17. package/dist/chunk-HCMTSR7E.js +69 -0
  18. package/dist/chunk-HKA5LBYW.js +159 -0
  19. package/dist/chunk-I6O4HIDY.js +1063 -0
  20. package/dist/chunk-J6PKNPI2.js +26 -0
  21. package/dist/chunk-JT2AU24K.js +759 -0
  22. package/dist/chunk-MBXCVCC4.js +478 -0
  23. package/dist/chunk-MJQSHP3Y.js +415 -0
  24. package/dist/chunk-MYFLYNPO.js +68 -0
  25. package/dist/chunk-PEUP4MZR.js +59 -0
  26. package/dist/chunk-PHEDW6C7.js +32 -0
  27. package/dist/chunk-PQDBCZRT.js +2017 -0
  28. package/dist/chunk-QGEITHUP.js +395 -0
  29. package/dist/chunk-QIVCBUYD.js +273 -0
  30. package/dist/chunk-RYFO3ZPO.js +71 -0
  31. package/dist/chunk-RZ4DIJQW.js +68 -0
  32. package/dist/chunk-SAANBZ25.js +118 -0
  33. package/dist/chunk-VFFOT7KD.js +2980 -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
@@ -1,110 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
- import { getConfigDir } from "./config.js";
4
- import { isJsonNumber, isJsonObject, isJsonString } from "./types.js";
5
- import path from "node:path";
6
- const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
7
- const VERSION_RE = /^\d+\.\d+\.\d+$/u;
8
- const getCachePath = () => path.join(getConfigDir(), "update-check.json");
9
- const getLastCheckedAt = () => {
10
- const cache = getCachePath();
11
- if (!existsSync(cache)) {
12
- return 0;
13
- }
14
- try {
15
- const data = JSON.parse(readFileSync(cache, "utf-8"));
16
- if (isJsonObject(data)) {
17
- const ts = data.lastCheckedAt;
18
- if (isJsonNumber(ts)) {
19
- return ts;
20
- }
21
- }
22
- }
23
- catch {
24
- // corrupt cache — treat as never checked
25
- }
26
- return 0;
27
- };
28
- export const markUpdateChecked = () => {
29
- const dir = getConfigDir();
30
- try {
31
- if (!existsSync(dir)) {
32
- mkdirSync(dir, { mode: 0o700, recursive: true });
33
- }
34
- writeFileSync(getCachePath(), JSON.stringify({ lastCheckedAt: Date.now() }, null, 2));
35
- }
36
- catch {
37
- // best-effort; worst case we check again next run
38
- }
39
- };
40
- export const isNewerVersion = (latest, current) => {
41
- if (!VERSION_RE.test(latest) || !VERSION_RE.test(current)) {
42
- return false;
43
- }
44
- const a = latest.split(".").map(Number);
45
- const b = current.split(".").map(Number);
46
- for (let i = 0; i < 3; i += 1) {
47
- const left = a[i] ?? 0;
48
- const right = b[i] ?? 0;
49
- if (left > right) {
50
- return true;
51
- }
52
- if (left < right) {
53
- return false;
54
- }
55
- }
56
- return false;
57
- };
58
- export const fetchLatestVersion = async () => {
59
- const registry = process.env.VG_REGISTRY_URL ?? "https://registry.npmjs.org";
60
- try {
61
- const res = await fetch(`${registry}/vibedgames/latest`, {
62
- signal: AbortSignal.timeout(5000),
63
- });
64
- if (!res.ok) {
65
- return null;
66
- }
67
- // SAFETY: res.json() is JSON.parse of the response body, which is
68
- // structurally JsonValue.
69
- const data = (await res.json());
70
- if (isJsonObject(data)) {
71
- const { version } = data;
72
- if (isJsonString(version)) {
73
- return version;
74
- }
75
- }
76
- }
77
- catch {
78
- // offline or registry down — skip this round
79
- }
80
- return null;
81
- };
82
- /**
83
- * Fire-and-forget background update: at most once per day (and never in CI
84
- * or with VG_NO_AUTO_UPDATE set), re-invoke this CLI as a detached
85
- * `vg update --auto`, which only applies anything when npm has a newer
86
- * version. The foreground command pays no latency and prints nothing.
87
- */
88
- export const maybeScheduleAutoUpdate = () => {
89
- if (process.env.VG_NO_AUTO_UPDATE || process.env.CI) {
90
- return;
91
- }
92
- const [, script] = process.argv;
93
- if (!script) {
94
- return;
95
- }
96
- if (Date.now() - getLastCheckedAt() < CHECK_INTERVAL_MS) {
97
- return;
98
- }
99
- markUpdateChecked();
100
- try {
101
- const child = spawn(process.execPath, [script, "update", "--auto"], {
102
- detached: true,
103
- stdio: "ignore",
104
- });
105
- child.unref();
106
- }
107
- catch {
108
- // best-effort; worst case we try again next run
109
- }
110
- };
@@ -1,16 +0,0 @@
1
- import type { ManifestFile } from "./manifest.js";
2
- export interface UploadTarget {
3
- path: string;
4
- url: string;
5
- headers: Record<string, string>;
6
- }
7
- /**
8
- * Upload all files to their presigned PUT URLs with bounded concurrency.
9
- * Throws on the first non-2xx response.
10
- */
11
- export declare const uploadAll: ({ files, uploads, concurrency, onProgress, }: {
12
- files: ManifestFile[];
13
- uploads: UploadTarget[];
14
- concurrency?: number;
15
- onProgress?: (done: number, total: number) => void;
16
- }) => Promise<void>;
@@ -1,41 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- /**
3
- * Upload all files to their presigned PUT URLs with bounded concurrency.
4
- * Throws on the first non-2xx response.
5
- */
6
- export const uploadAll = async ({ files, uploads, concurrency = 6, onProgress, }) => {
7
- const byPath = new Map(files.map((f) => [f.path, f]));
8
- let done = 0;
9
- let cursor = 0;
10
- const worker = async () => {
11
- while (true) {
12
- const idx = cursor;
13
- cursor += 1;
14
- if (idx >= uploads.length) {
15
- return;
16
- }
17
- const upload = uploads[idx];
18
- if (!upload) {
19
- return;
20
- }
21
- const file = byPath.get(upload.path);
22
- if (!file) {
23
- throw new Error(`Missing file for upload target: ${upload.path}`);
24
- }
25
- const body = readFileSync(file.absolutePath);
26
- const res = await fetch(upload.url, {
27
- body,
28
- headers: upload.headers,
29
- method: "PUT",
30
- });
31
- if (!res.ok) {
32
- const text = await res.text().catch(() => "");
33
- throw new Error(`Upload failed for ${upload.path}: ${res.status} ${res.statusText} ${text}`);
34
- }
35
- done += 1;
36
- onProgress?.(done, uploads.length);
37
- }
38
- };
39
- const workers = Array.from({ length: Math.min(concurrency, uploads.length) }, () => worker());
40
- await Promise.all(workers);
41
- };