vibedgames 0.8.1 → 0.9.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 (40) hide show
  1. package/README.md +14 -6
  2. package/dist/THIRD_PARTY_NOTICES.txt +58 -6
  3. package/dist/{chunk-FNYBZNW2.js → chunk-25BAMW5X.js} +3 -1
  4. package/dist/{chunk-GCX5KQ6A.js → chunk-2VUUMXAQ.js} +2 -2
  5. package/dist/{chunk-7MKUR7Y3.js → chunk-355VG7EO.js} +13 -12
  6. package/dist/{chunk-I6O4HIDY.js → chunk-3HUWAJQH.js} +76 -61
  7. package/dist/{chunk-2QBYTIMH.js → chunk-5535KDYI.js} +1 -1
  8. package/dist/chunk-56OY4TEP.js +20125 -0
  9. package/dist/{chunk-PHEDW6C7.js → chunk-6EWHKL7Z.js} +13 -5
  10. package/dist/{chunk-6FZPPUQH.js → chunk-7CXMMC5S.js} +1 -1
  11. package/dist/{chunk-QJZ72MSY.js → chunk-7QZSDU52.js} +5 -5
  12. package/dist/{chunk-MGIASPED.js → chunk-AXTLPJ2F.js} +5 -5
  13. package/dist/{chunk-RAUJA3OY.js → chunk-BMTHAVMS.js} +5 -5
  14. package/dist/{chunk-CU7UY5YJ.js → chunk-D2RF35HJ.js} +1 -1
  15. package/dist/chunk-FC233UKH.js +170 -0
  16. package/dist/{chunk-CAKBGDCY.js → chunk-GKDUYJ7R.js} +5 -0
  17. package/dist/{chunk-HCMTSR7E.js → chunk-H3IPLBXQ.js} +8 -7
  18. package/dist/{chunk-QGEITHUP.js → chunk-HNRVSBRK.js} +5 -5
  19. package/dist/chunk-K2U7L4RU.js +183 -0
  20. package/dist/{chunk-PQDBCZRT.js → chunk-KZBZNTM4.js} +203 -153
  21. package/dist/{chunk-QIVCBUYD.js → chunk-LXS3NJYD.js} +7 -6
  22. package/dist/{chunk-HKA5LBYW.js → chunk-LY2GQ32S.js} +9 -8
  23. package/dist/{chunk-2GL2WJZX.js → chunk-NDHXM4PL.js} +4 -4
  24. package/dist/{chunk-PM5UOIKR.js → chunk-OD2MNYXD.js} +16 -16
  25. package/dist/{chunk-JT2AU24K.js → chunk-QARXJGI5.js} +1 -1
  26. package/dist/{chunk-RYFO3ZPO.js → chunk-RXHTGX7C.js} +9 -2
  27. package/dist/chunk-ST5FC2W3.js +95 -0
  28. package/dist/{chunk-AYJQVZXY.js → chunk-TBQ5BU3Q.js} +4 -4
  29. package/dist/{chunk-N3XAUFKH.js → chunk-UFR6G6BL.js} +38 -63
  30. package/dist/{chunk-4BGCA3W7.js → chunk-US6QZICZ.js} +8 -8
  31. package/dist/{chunk-TLRL6FHW.js → chunk-UXCWSWWX.js} +7 -7
  32. package/dist/chunk-UZM6OSW5.js +113 -0
  33. package/dist/{chunk-NC5XCGYU.js → chunk-WSRIF6K4.js} +4 -4
  34. package/dist/chunk-X75Y7LUW.js +126 -0
  35. package/dist/chunk-Z5TFZQ5U.js +2478 -0
  36. package/dist/{chunk-C2IRIRAA.js → chunk-ZCYWDKYP.js} +2 -2
  37. package/dist/index.js +30 -19
  38. package/package.json +6 -5
  39. package/dist/chunk-MJQSHP3Y.js +0 -415
  40. package/dist/chunk-MYFLYNPO.js +0 -68
@@ -6,16 +6,18 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  extractSource
9
- } from "./chunk-I6O4HIDY.js";
9
+ } from "./chunk-3HUWAJQH.js";
10
10
  import "./chunk-VFFOT7KD.js";
11
- import {
12
- SLUG_RE
13
- } from "./chunk-ZI6PKVXG.js";
14
11
  import {
15
12
  createClient
16
- } from "./chunk-PQDBCZRT.js";
13
+ } from "./chunk-KZBZNTM4.js";
14
+ import "./chunk-K2U7L4RU.js";
17
15
  import "./chunk-Z4Z24FWO.js";
18
16
  import "./chunk-PEUP4MZR.js";
17
+ import "./chunk-RXHTGX7C.js";
18
+ import {
19
+ SLUG_RE
20
+ } from "./chunk-ZI6PKVXG.js";
19
21
  import {
20
22
  isJsonOutput,
21
23
  outputArgs,
@@ -24,17 +26,16 @@ import {
24
26
  import {
25
27
  assertKnownFlags
26
28
  } from "./chunk-RZ4DIJQW.js";
27
- import "./chunk-RYFO3ZPO.js";
28
29
  import {
29
30
  consola
30
- } from "./chunk-CU7UY5YJ.js";
31
+ } from "./chunk-D2RF35HJ.js";
31
32
  import {
32
33
  isJsonObject
33
34
  } from "./chunk-J6PKNPI2.js";
34
35
  import {
35
36
  defineCommand
36
37
  } from "./chunk-MBXCVCC4.js";
37
- import "./chunk-CAKBGDCY.js";
38
+ import "./chunk-GKDUYJ7R.js";
38
39
 
39
40
  // src/commands/fork.ts
40
41
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
@@ -13,7 +13,8 @@ import {
13
13
  saveSetting,
14
14
  settingsPath,
15
15
  validate
16
- } from "./chunk-6FZPPUQH.js";
16
+ } from "./chunk-7CXMMC5S.js";
17
+ import "./chunk-RXHTGX7C.js";
17
18
  import {
18
19
  outputArgs,
19
20
  writeStructured
@@ -21,15 +22,14 @@ import {
21
22
  import {
22
23
  assertKnownFlags
23
24
  } from "./chunk-RZ4DIJQW.js";
24
- import "./chunk-RYFO3ZPO.js";
25
25
  import {
26
26
  consola
27
- } from "./chunk-CU7UY5YJ.js";
27
+ } from "./chunk-D2RF35HJ.js";
28
28
  import "./chunk-J6PKNPI2.js";
29
29
  import {
30
30
  defineCommand
31
31
  } from "./chunk-MBXCVCC4.js";
32
- import "./chunk-CAKBGDCY.js";
32
+ import "./chunk-GKDUYJ7R.js";
33
33
 
34
34
  // src/commands/config.ts
35
35
  var keyArg = {
@@ -4,27 +4,22 @@ 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
+ FACTORY_PACKAGE,
9
+ installedFactoryVersion,
10
+ updateFactory
11
+ } from "./chunk-ZCYWDKYP.js";
7
12
  import {
8
13
  findInstall,
9
14
  reportSkills,
10
15
  settleSync,
11
16
  syncSkills
12
- } from "./chunk-RAUJA3OY.js";
17
+ } from "./chunk-BMTHAVMS.js";
13
18
  import {
14
19
  fetchLatestVersion,
15
20
  isNewerVersion
16
- } from "./chunk-GCX5KQ6A.js";
17
- import "./chunk-6FZPPUQH.js";
18
- import {
19
- FACTORY_PACKAGE,
20
- installedFactoryVersion,
21
- updateFactory
22
- } from "./chunk-C2IRIRAA.js";
23
- import {
24
- isMissingCommand,
25
- run
26
- } from "./chunk-AYJQVZXY.js";
27
- import "./chunk-2QBYTIMH.js";
21
+ } from "./chunk-2VUUMXAQ.js";
22
+ import "./chunk-7CXMMC5S.js";
28
23
  import "./chunk-VFFOT7KD.js";
29
24
  import {
30
25
  PACKAGE_VERSION
@@ -34,18 +29,23 @@ import {
34
29
  globalInstallArgs,
35
30
  globalInstallCommand
36
31
  } from "./chunk-PEUP4MZR.js";
32
+ import "./chunk-RXHTGX7C.js";
33
+ import {
34
+ isMissingCommand,
35
+ run
36
+ } from "./chunk-TBQ5BU3Q.js";
37
+ import "./chunk-5535KDYI.js";
37
38
  import {
38
39
  assertKnownFlags
39
40
  } from "./chunk-RZ4DIJQW.js";
40
- import "./chunk-RYFO3ZPO.js";
41
41
  import {
42
42
  consola
43
- } from "./chunk-CU7UY5YJ.js";
43
+ } from "./chunk-D2RF35HJ.js";
44
44
  import "./chunk-J6PKNPI2.js";
45
45
  import {
46
46
  defineCommand
47
47
  } from "./chunk-MBXCVCC4.js";
48
- import "./chunk-CAKBGDCY.js";
48
+ import "./chunk-GKDUYJ7R.js";
49
49
 
50
50
  // src/commands/update.ts
51
51
  var updateInstalledSkills = async (global) => {
@@ -4,7 +4,7 @@ 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 "./chunk-CAKBGDCY.js";
7
+ import "./chunk-GKDUYJ7R.js";
8
8
 
9
9
  // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
10
10
  import g, { stdin, stdout } from "node:process";
@@ -5,6 +5,7 @@ const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
+ isJsonNumber,
8
9
  isJsonObject,
9
10
  isJsonString
10
11
  } from "./chunk-J6PKNPI2.js";
@@ -33,11 +34,16 @@ var getConfig = () => {
33
34
  if (!isJsonObject(raw)) {
34
35
  return null;
35
36
  }
36
- const { token, baseUrl } = raw;
37
+ const { baseUrl, expiresAt, refreshToken, token } = raw;
37
38
  if (!isJsonString(token) || !isJsonString(baseUrl)) {
38
39
  return null;
39
40
  }
40
- return { baseUrl, token };
41
+ return {
42
+ baseUrl,
43
+ expiresAt: isJsonNumber(expiresAt) ? expiresAt : void 0,
44
+ refreshToken: isJsonString(refreshToken) ? refreshToken : void 0,
45
+ token
46
+ };
41
47
  };
42
48
  var saveConfig = (config) => {
43
49
  const dir = getConfigDir();
@@ -64,6 +70,7 @@ var getToken = () => (
64
70
 
65
71
  export {
66
72
  getConfigDir,
73
+ getConfig,
67
74
  saveConfig,
68
75
  clearConfig,
69
76
  getBaseUrl,
@@ -0,0 +1,95 @@
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
+ OAuthError,
9
+ pollDeviceToken,
10
+ requestDeviceCode
11
+ } from "./chunk-K2U7L4RU.js";
12
+ import {
13
+ getBaseUrl,
14
+ saveConfig
15
+ } from "./chunk-RXHTGX7C.js";
16
+ import {
17
+ consola
18
+ } from "./chunk-D2RF35HJ.js";
19
+ import "./chunk-J6PKNPI2.js";
20
+ import {
21
+ defineCommand
22
+ } from "./chunk-MBXCVCC4.js";
23
+ import "./chunk-GKDUYJ7R.js";
24
+
25
+ // src/commands/login.ts
26
+ import { spawn } from "node:child_process";
27
+ import { setTimeout as sleep } from "node:timers/promises";
28
+ var SLOW_DOWN_STEP_MS = 5e3;
29
+ var openBrowser = (url, baseUrl) => {
30
+ let target;
31
+ try {
32
+ target = new URL(url);
33
+ } catch {
34
+ return;
35
+ }
36
+ if (target.origin !== new URL(baseUrl).origin) {
37
+ return;
38
+ }
39
+ const openers = {
40
+ darwin: ["open", [target.href]],
41
+ win32: ["rundll32", ["url.dll,FileProtocolHandler", target.href]]
42
+ };
43
+ const [cmd, args] = openers[process.platform] ?? ["xdg-open", [target.href]];
44
+ const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
45
+ child.on("error", () => {
46
+ });
47
+ child.unref();
48
+ };
49
+ var fail = (message) => {
50
+ consola.error(message);
51
+ process.exit(1);
52
+ };
53
+ var loginCommand = defineCommand({
54
+ meta: {
55
+ description: "Authenticate with vibedgames",
56
+ name: "login"
57
+ },
58
+ run: async () => {
59
+ const baseUrl = getBaseUrl();
60
+ const device = await requestDeviceCode(baseUrl);
61
+ consola.box(`Code: ${device.userCode}`);
62
+ consola.info(
63
+ `Opening ${device.verificationUriComplete}: approve there if it shows this same code.`
64
+ );
65
+ openBrowser(device.verificationUriComplete, baseUrl);
66
+ consola.start("Waiting for approval...");
67
+ let intervalMs = device.interval * 1e3;
68
+ const deadline = Date.now() + device.expiresIn * 1e3;
69
+ while (Date.now() < deadline) {
70
+ await sleep(intervalMs);
71
+ try {
72
+ saveConfig(await pollDeviceToken(baseUrl, device.deviceCode));
73
+ consola.success("Logged in successfully");
74
+ return;
75
+ } catch (error) {
76
+ if (!(error instanceof OAuthError)) {
77
+ throw error;
78
+ }
79
+ if (error.code === "slow_down") {
80
+ intervalMs += SLOW_DOWN_STEP_MS;
81
+ } else if (error.code === "access_denied") {
82
+ fail("Login was denied in the browser.");
83
+ } else if (error.code === "expired_token") {
84
+ fail("Code expired. Run `vg login` to try again.");
85
+ } else if (error.code !== "authorization_pending") {
86
+ throw error;
87
+ }
88
+ }
89
+ }
90
+ fail("Timed out waiting for approval. Run `vg login` to try again.");
91
+ }
92
+ });
93
+ export {
94
+ loginCommand
95
+ };
@@ -6,19 +6,19 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  require_cross_spawn
9
- } from "./chunk-2QBYTIMH.js";
9
+ } from "./chunk-5535KDYI.js";
10
10
  import {
11
11
  __toESM
12
- } from "./chunk-CAKBGDCY.js";
12
+ } from "./chunk-GKDUYJ7R.js";
13
13
 
14
14
  // src/lib/run.ts
15
15
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
16
16
  var isMissingCommand = (result) => result.code !== 0 && /ENOENT|not found|not recognized/iu.test(result.output);
17
- var run = (cmd, args) => (
17
+ var run = (cmd, args, cwd) => (
18
18
  // oxlint-disable-next-line promise/avoid-new -- child_process.spawn is event-based
19
19
  new Promise((resolve) => {
20
20
  const chunks = [];
21
- const child = (0, import_cross_spawn.default)(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
21
+ const child = (0, import_cross_spawn.default)(cmd, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
22
22
  const collect = (c) => {
23
23
  chunks.push(c);
24
24
  };
@@ -6,26 +6,27 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  resolveSetting
9
- } from "./chunk-6FZPPUQH.js";
10
- import {
11
- require_cross_spawn
12
- } from "./chunk-2QBYTIMH.js";
9
+ } from "./chunk-7CXMMC5S.js";
13
10
  import {
14
11
  createClient,
15
12
  forwardJson
16
- } from "./chunk-PQDBCZRT.js";
13
+ } from "./chunk-KZBZNTM4.js";
14
+ import "./chunk-K2U7L4RU.js";
17
15
  import "./chunk-Z4Z24FWO.js";
18
16
  import "./chunk-PEUP4MZR.js";
17
+ import "./chunk-RXHTGX7C.js";
18
+ import {
19
+ require_cross_spawn
20
+ } from "./chunk-5535KDYI.js";
19
21
  import {
20
22
  isJsonOutput,
21
23
  outputArgs,
22
24
  writeJson,
23
25
  writeStructured
24
26
  } from "./chunk-ZYCSYJWX.js";
25
- import "./chunk-RYFO3ZPO.js";
26
27
  import {
27
28
  consola
28
- } from "./chunk-CU7UY5YJ.js";
29
+ } from "./chunk-D2RF35HJ.js";
29
30
  import {
30
31
  isJsonNumber,
31
32
  isJsonObject,
@@ -36,11 +37,20 @@ import {
36
37
  } from "./chunk-MBXCVCC4.js";
37
38
  import {
38
39
  __toESM
39
- } from "./chunk-CAKBGDCY.js";
40
+ } from "./chunk-GKDUYJ7R.js";
40
41
 
41
42
  // src/commands/generate.ts
42
43
  import { setTimeout as sleep2 } from "node:timers/promises";
43
44
 
45
+ // ../../packages/contract/src/generate/queue-path.ts
46
+ var endpointPath = (endpointId) => endpointId.replaceAll(/^\/+|\/+$/gu, "");
47
+ var QUEUE_APP_NAMESPACES = /* @__PURE__ */ new Set(["workflows", "comfy"]);
48
+ var queueAppId = (endpointId) => {
49
+ const parts = endpointPath(endpointId).split("/").filter(Boolean);
50
+ const take = QUEUE_APP_NAMESPACES.has(parts[0] ?? "") ? 3 : 2;
51
+ return parts.slice(0, take).join("/");
52
+ };
53
+
44
54
  // src/lib/codex.ts
45
55
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
46
56
  import { randomBytes } from "node:crypto";
@@ -232,6 +242,20 @@ var parseDownloadFlag = (argv) => {
232
242
  // src/lib/media-download.ts
233
243
  import { mkdirSync, writeFileSync } from "node:fs";
234
244
  import path2 from "node:path";
245
+
246
+ // ../../packages/contract/src/generate/media-hosts.ts
247
+ var HOSTS = /* @__PURE__ */ new Set(["fal.media", "fal.run", "fal.ai"]);
248
+ var SUFFIXES = [".fal.media", ".fal.run", ".fal.ai"];
249
+ var HTTPS = /^https:\/\/(?<host>[a-z0-9.-]+)(?::\d{1,5})?(?:[/?#]|$)/iu;
250
+ var isMediaUrl = (url) => {
251
+ const host = HTTPS.exec(url)?.groups?.host?.toLowerCase();
252
+ if (!host) {
253
+ return false;
254
+ }
255
+ return HOSTS.has(host) || SUFFIXES.some((suffix) => host.endsWith(suffix));
256
+ };
257
+
258
+ // src/lib/media-download.ts
235
259
  var MEDIA_EXT = /* @__PURE__ */ new Set([
236
260
  "png",
237
261
  "jpg",
@@ -251,24 +275,6 @@ var MEDIA_EXT = /* @__PURE__ */ new Set([
251
275
  "flac",
252
276
  "m4a"
253
277
  ]);
254
- var TRUSTED_HOST_SUFFIXES = [".fal.media", ".fal.run", ".fal.ai"];
255
- var TRUSTED_HOSTS = /* @__PURE__ */ new Set(["fal.media", "fal.run", "fal.ai"]);
256
- var isTrustedFalContentHost = (url) => {
257
- let parsed;
258
- try {
259
- parsed = new URL(url);
260
- } catch {
261
- return false;
262
- }
263
- if (parsed.protocol !== "https:") {
264
- return false;
265
- }
266
- const host = parsed.hostname.toLowerCase();
267
- if (TRUSTED_HOSTS.has(host)) {
268
- return true;
269
- }
270
- return TRUSTED_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix));
271
- };
272
278
  var extFromUrl = (url) => {
273
279
  try {
274
280
  const { pathname } = new URL(url);
@@ -296,7 +302,7 @@ var visit = (value, refs, seen) => {
296
302
  return;
297
303
  }
298
304
  const { url } = value;
299
- if (isJsonString(url) && isTrustedFalContentHost(url) && !seen.has(url)) {
305
+ if (isJsonString(url) && isMediaUrl(url) && !seen.has(url)) {
300
306
  const contentType = isJsonString(value.content_type) ? value.content_type.toLowerCase() : null;
301
307
  const filenameField = isJsonString(value.file_name) ? sanitizeFilename(value.file_name) : null;
302
308
  const ext = filenameField ? path2.extname(filenameField).slice(1).toLowerCase() : extFromUrl(url);
@@ -745,13 +751,6 @@ var placeCodexOutputs = (rawFiles, template, requestId) => {
745
751
 
746
752
  // src/lib/media-poll.ts
747
753
  import { setTimeout as sleep } from "node:timers/promises";
748
- var endpointPath = (endpointId) => endpointId.replaceAll(/^\/+|\/+$/gu, "");
749
- var QUEUE_APP_NAMESPACES = /* @__PURE__ */ new Set(["workflows", "comfy"]);
750
- var queueAppId = (endpointId) => {
751
- const parts = endpointPath(endpointId).split("/").filter(Boolean);
752
- const take = QUEUE_APP_NAMESPACES.has(parts[0] ?? "") ? 3 : 2;
753
- return parts.slice(0, take).join("/");
754
- };
755
754
  var POLL_INTERVAL_MS = 2e3;
756
755
  var POLL_TIMEOUT_MS = 30 * 60 * 1e3;
757
756
  var pickErrorReason = (value) => {
@@ -816,42 +815,18 @@ var waitForCompletion = async (client, endpoint_id, request_id, opts) => {
816
815
 
817
816
  // src/lib/media-upload.ts
818
817
  import { openAsBlob } from "node:fs";
819
- var pickUrl = (slot, key) => {
820
- const value = isJsonObject(slot) ? slot[key] : void 0;
821
- if (!isJsonString(value) || value.length === 0) {
822
- throw new Error(`fal storage initiate response missing ${key}.`);
823
- }
824
- let parsed;
825
- try {
826
- parsed = new URL(value);
827
- } catch {
828
- throw new Error(`fal storage initiate response ${key} is not a valid URL.`);
829
- }
830
- if (parsed.protocol !== "https:") {
831
- throw new Error(`fal storage initiate response ${key} must be HTTPS, got ${parsed.protocol}.`);
832
- }
833
- return value;
834
- };
835
818
  var uploadFile = async (client, file) => {
836
- const slot = await forwardJson(client, {
837
- body: { content_type: file.contentType, file_name: file.filename },
838
- method: "POST",
839
- path: "/storage/upload/initiate",
840
- target: "storage"
819
+ const slot = await client.generate.upload({
820
+ contentType: file.contentType,
821
+ fileName: file.filename
841
822
  });
842
- const uploadUrl = pickUrl(slot, "upload_url");
843
- const fileUrl = pickUrl(slot, "file_url");
844
823
  const body = await openAsBlob(file.path, { type: file.contentType });
845
- const res = await fetch(uploadUrl, {
846
- body,
847
- headers: { "Content-Type": file.contentType },
848
- method: "PUT"
849
- });
824
+ const res = await fetch(slot.uploadUrl, { body, headers: slot.headers, method: "PUT" });
850
825
  if (!res.ok) {
851
826
  const text = await res.text().catch(() => "");
852
827
  throw new Error(`Upload failed for ${file.filename}: ${res.status} ${res.statusText} ${text}`);
853
828
  }
854
- return fileUrl;
829
+ return slot.fileUrl;
855
830
  };
856
831
 
857
832
  // src/commands/generate.ts
@@ -6,28 +6,28 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  isNewerVersion
9
- } from "./chunk-GCX5KQ6A.js";
9
+ } from "./chunk-2VUUMXAQ.js";
10
+ import {
11
+ getBaseUrl,
12
+ getConfigDir
13
+ } from "./chunk-RXHTGX7C.js";
10
14
  import {
11
15
  require_cross_spawn
12
- } from "./chunk-2QBYTIMH.js";
16
+ } from "./chunk-5535KDYI.js";
13
17
  import {
14
18
  SLUG_RE,
15
19
  findProjectRoot,
16
20
  readProjectConfig
17
21
  } from "./chunk-ZI6PKVXG.js";
18
- import {
19
- getBaseUrl,
20
- getConfigDir
21
- } from "./chunk-RYFO3ZPO.js";
22
22
  import {
23
23
  consola
24
- } from "./chunk-CU7UY5YJ.js";
24
+ } from "./chunk-D2RF35HJ.js";
25
25
  import {
26
26
  defineCommand
27
27
  } from "./chunk-MBXCVCC4.js";
28
28
  import {
29
29
  __toESM
30
- } from "./chunk-CAKBGDCY.js";
30
+ } from "./chunk-GKDUYJ7R.js";
31
31
 
32
32
  // src/commands/playtest.ts
33
33
  import { createHash } from "node:crypto";
@@ -16,16 +16,16 @@ import {
16
16
  resolveGameUrl,
17
17
  runPlaytest,
18
18
  withScopedSession
19
- } from "./chunk-4BGCA3W7.js";
20
- import "./chunk-GCX5KQ6A.js";
21
- import "./chunk-6FZPPUQH.js";
22
- import "./chunk-2QBYTIMH.js";
19
+ } from "./chunk-US6QZICZ.js";
20
+ import "./chunk-2VUUMXAQ.js";
21
+ import "./chunk-7CXMMC5S.js";
22
+ import "./chunk-RXHTGX7C.js";
23
+ import "./chunk-5535KDYI.js";
23
24
  import "./chunk-ZI6PKVXG.js";
24
- import "./chunk-RYFO3ZPO.js";
25
- import "./chunk-CU7UY5YJ.js";
25
+ import "./chunk-D2RF35HJ.js";
26
26
  import "./chunk-J6PKNPI2.js";
27
27
  import "./chunk-MBXCVCC4.js";
28
- import "./chunk-CAKBGDCY.js";
28
+ import "./chunk-GKDUYJ7R.js";
29
29
  export {
30
30
  bareTokens,
31
31
  bootstrap,
@@ -0,0 +1,113 @@
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
+ getBaseUrl
9
+ } from "./chunk-RXHTGX7C.js";
10
+ import {
11
+ isJsonOutput,
12
+ outputArgs,
13
+ writeStructured
14
+ } from "./chunk-ZYCSYJWX.js";
15
+ import {
16
+ assertKnownFlags
17
+ } from "./chunk-RZ4DIJQW.js";
18
+ import {
19
+ consola
20
+ } from "./chunk-D2RF35HJ.js";
21
+ import {
22
+ isJsonObject,
23
+ isJsonString
24
+ } from "./chunk-J6PKNPI2.js";
25
+ import {
26
+ defineCommand
27
+ } from "./chunk-MBXCVCC4.js";
28
+ import "./chunk-GKDUYJ7R.js";
29
+
30
+ // src/commands/skills.ts
31
+ var skillsArgs = {
32
+ name: {
33
+ description: "A skill's name; omit to list every skill and what it is for.",
34
+ required: false,
35
+ type: "positional"
36
+ },
37
+ ...outputArgs
38
+ };
39
+ var discoveryUrl = (path) => new URL(`/.well-known/agent-skills/${path}`, getBaseUrl());
40
+ var fetchOrExit = async (url, doing) => {
41
+ try {
42
+ return await fetch(url);
43
+ } catch (error) {
44
+ consola.error(`${doing}: ${error instanceof Error ? error.message : String(error)}`);
45
+ process.exit(1);
46
+ }
47
+ };
48
+ var summaries = (index) => {
49
+ const skills = isJsonObject(index) ? index.skills : void 0;
50
+ if (!Array.isArray(skills)) {
51
+ return [];
52
+ }
53
+ return skills.flatMap((entry) => {
54
+ if (!isJsonObject(entry) || !isJsonString(entry.name) || !isJsonString(entry.description)) {
55
+ return [];
56
+ }
57
+ return [{ description: entry.description, name: entry.name }];
58
+ });
59
+ };
60
+ var listSkills = async () => {
61
+ const res = await fetchOrExit(discoveryUrl("index.json"), "Could not list the skills");
62
+ if (!res.ok) {
63
+ consola.error(`Could not list the skills: ${res.status} ${res.statusText}`);
64
+ process.exit(1);
65
+ }
66
+ const index = JSON.parse(await res.text());
67
+ return summaries(index);
68
+ };
69
+ var skillsCommand = defineCommand({
70
+ args: skillsArgs,
71
+ meta: {
72
+ description: "The game-studio skills: list them, or print one's SKILL.md (how to build, art-direct, add multiplayer to, balance and ship a browser game).",
73
+ name: "skills"
74
+ },
75
+ run: async ({ args, rawArgs }) => {
76
+ assertKnownFlags(rawArgs, skillsArgs);
77
+ if (!args.name) {
78
+ const skills = await listSkills();
79
+ if (writeStructured({ skills }, args)) {
80
+ return;
81
+ }
82
+ for (const skill of skills) {
83
+ consola.log(`${skill.name} ${skill.description}`);
84
+ }
85
+ return;
86
+ }
87
+ const name = args.name.trim();
88
+ const res = await fetchOrExit(
89
+ discoveryUrl(`${encodeURIComponent(name)}/SKILL.md`),
90
+ `Could not fetch ${name}`
91
+ );
92
+ if (res.status === 404) {
93
+ consola.error(`No skill "${name}". Run \`vg skills\` to list them.`);
94
+ process.exit(1);
95
+ }
96
+ if (!res.ok) {
97
+ consola.error(`Could not fetch ${name}: ${res.status} ${res.statusText}`);
98
+ process.exit(1);
99
+ }
100
+ const content = await res.text();
101
+ if (isJsonOutput(args) || args.field) {
102
+ const listed = await listSkills();
103
+ const summary = listed.find((skill) => skill.name === name);
104
+ writeStructured({ content, description: summary?.description ?? "", name }, args);
105
+ return;
106
+ }
107
+ process.stdout.write(content.endsWith("\n") ? content : `${content}
108
+ `);
109
+ }
110
+ });
111
+ export {
112
+ skillsCommand
113
+ };
@@ -9,11 +9,11 @@ import {
9
9
  isNewerVersion,
10
10
  markUpdateChecked,
11
11
  maybeScheduleAutoUpdate
12
- } from "./chunk-GCX5KQ6A.js";
13
- import "./chunk-6FZPPUQH.js";
14
- import "./chunk-RYFO3ZPO.js";
12
+ } from "./chunk-2VUUMXAQ.js";
13
+ import "./chunk-7CXMMC5S.js";
14
+ import "./chunk-RXHTGX7C.js";
15
15
  import "./chunk-J6PKNPI2.js";
16
- import "./chunk-CAKBGDCY.js";
16
+ import "./chunk-GKDUYJ7R.js";
17
17
  export {
18
18
  fetchLatestVersion,
19
19
  isNewerVersion,