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,466 @@
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-2QBYTIMH.js";
10
+ import {
11
+ So
12
+ } from "./chunk-VFFOT7KD.js";
13
+ import {
14
+ PKG_NAME,
15
+ detectPackageManager,
16
+ globalInstallArgs,
17
+ globalInstallCommand
18
+ } from "./chunk-PEUP4MZR.js";
19
+ import {
20
+ assertKnownFlags
21
+ } from "./chunk-RZ4DIJQW.js";
22
+ import {
23
+ isJsonObject,
24
+ isJsonString
25
+ } from "./chunk-J6PKNPI2.js";
26
+ import {
27
+ consola
28
+ } from "./chunk-CU7UY5YJ.js";
29
+ import {
30
+ defineCommand
31
+ } from "./chunk-MBXCVCC4.js";
32
+ import {
33
+ __toESM
34
+ } from "./chunk-CAKBGDCY.js";
35
+
36
+ // src/commands/init.ts
37
+ import path2 from "node:path";
38
+
39
+ // src/lib/run.ts
40
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
41
+ var isMissingCommand = (result) => result.code !== 0 && /ENOENT|not found|not recognized/iu.test(result.output);
42
+ var run = (cmd, args) => (
43
+ // oxlint-disable-next-line promise/avoid-new -- child_process.spawn is event-based
44
+ new Promise((resolve) => {
45
+ const chunks = [];
46
+ const child = (0, import_cross_spawn.default)(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
47
+ const collect = (c) => {
48
+ chunks.push(c);
49
+ };
50
+ child.stdout?.on("data", collect);
51
+ child.stderr?.on("data", collect);
52
+ child.on("error", (err) => resolve({ code: 1, output: `${err.message}
53
+ ` }));
54
+ child.on(
55
+ "close",
56
+ (code) => resolve({ code: code ?? 1, output: Buffer.concat(chunks).toString("utf-8") })
57
+ );
58
+ })
59
+ );
60
+
61
+ // src/lib/skills-install.ts
62
+ import {
63
+ cpSync,
64
+ existsSync,
65
+ lstatSync,
66
+ mkdirSync,
67
+ mkdtempSync,
68
+ readdirSync,
69
+ readFileSync,
70
+ realpathSync,
71
+ rmSync,
72
+ statSync,
73
+ symlinkSync,
74
+ unlinkSync,
75
+ writeFileSync
76
+ } from "node:fs";
77
+ import { homedir, tmpdir } from "node:os";
78
+ import path from "node:path";
79
+ var SKILLS_REPO = "kyh/vibedgames-plugins";
80
+ var SKILLS_TARBALL = `https://codeload.github.com/${SKILLS_REPO}/tar.gz/refs/heads/main`;
81
+ var DEFAULT_AGENTS = ["claude-code", "cursor", "codex"];
82
+ var SHARED_DIR_AGENTS = /* @__PURE__ */ new Set([
83
+ "amp",
84
+ "antigravity",
85
+ "cline",
86
+ "codex",
87
+ "cursor",
88
+ "gemini-cli",
89
+ "github-copilot",
90
+ "kilo",
91
+ "opencode",
92
+ "replit",
93
+ "warp",
94
+ "zed"
95
+ ]);
96
+ var configHome = (home, env) => env.XDG_CONFIG_HOME ?? path.join(home, ".config");
97
+ var LINKED_AGENTS = /* @__PURE__ */ new Map([
98
+ [
99
+ "claude-code",
100
+ {
101
+ global: (home, env) => path.join(env.CLAUDE_CONFIG_DIR ?? path.join(home, ".claude"), "skills"),
102
+ project: ".claude/skills"
103
+ }
104
+ ],
105
+ ["augment", { global: (home) => path.join(home, ".augment/skills"), project: ".augment/skills" }],
106
+ [
107
+ "continue",
108
+ { global: (home) => path.join(home, ".continue/skills"), project: ".continue/skills" }
109
+ ],
110
+ [
111
+ "crush",
112
+ {
113
+ global: (home, env) => path.join(configHome(home, env), "crush/skills"),
114
+ project: ".crush/skills"
115
+ }
116
+ ],
117
+ [
118
+ "goose",
119
+ {
120
+ global: (home, env) => path.join(configHome(home, env), "goose/skills"),
121
+ project: ".goose/skills"
122
+ }
123
+ ],
124
+ ["junie", { global: (home) => path.join(home, ".junie/skills"), project: ".junie/skills" }],
125
+ ["kiro-cli", { global: (home) => path.join(home, ".kiro/skills"), project: ".kiro/skills" }],
126
+ [
127
+ "openhands",
128
+ { global: (home) => path.join(home, ".openhands/skills"), project: ".openhands/skills" }
129
+ ],
130
+ ["qwen-code", { global: (home) => path.join(home, ".qwen/skills"), project: ".qwen/skills" }],
131
+ ["roo", { global: (home) => path.join(home, ".roo/skills"), project: ".roo/skills" }],
132
+ ["trae", { global: (home) => path.join(home, ".trae/skills"), project: ".trae/skills" }],
133
+ [
134
+ "windsurf",
135
+ {
136
+ global: (home) => path.join(home, ".codeium/windsurf/skills"),
137
+ project: ".windsurf/skills"
138
+ }
139
+ ]
140
+ ]);
141
+ var SUPPORTED_AGENTS = [...SHARED_DIR_AGENTS, ...LINKED_AGENTS.keys()].toSorted();
142
+ var parseAgents = (raw) => {
143
+ const ids = raw.split(",").map((id) => id.trim().toLowerCase()).filter(Boolean);
144
+ if (ids.includes("*")) {
145
+ return SUPPORTED_AGENTS;
146
+ }
147
+ const unknown = ids.filter((id) => !SHARED_DIR_AGENTS.has(id) && !LINKED_AGENTS.has(id));
148
+ if (unknown.length > 0) {
149
+ throw new Error(
150
+ `Unknown agent: ${unknown.join(", ")}. Supported: ${SUPPORTED_AGENTS.join(", ")}. Any other agent can read the skills from .agents/skills (or ~/.agents/skills with --global).`
151
+ );
152
+ }
153
+ return [...new Set(ids)];
154
+ };
155
+ var SKILL_NAME = /^[a-z0-9][a-z0-9-]*$/u;
156
+ var SKIPPED_ENTRIES = /* @__PURE__ */ new Set([".DS_Store", ".git", "__pycache__", "node_modules"]);
157
+ var fetchSkillsSource = async (env = process.env) => {
158
+ const override = env.VG_SKILLS_SOURCE?.trim();
159
+ if (override && !/^https?:\/\//iu.test(override)) {
160
+ const root = path.resolve(override);
161
+ if (!existsSync(path.join(root, "plugins"))) {
162
+ throw new Error(`VG_SKILLS_SOURCE=${override} has no plugins/ directory.`);
163
+ }
164
+ return { origin: root, root };
165
+ }
166
+ const url = override || SKILLS_TARBALL;
167
+ const work = mkdtempSync(path.join(tmpdir(), "vg-skills-"));
168
+ const cleanup = () => rmSync(work, { force: true, recursive: true });
169
+ try {
170
+ let res;
171
+ try {
172
+ res = await fetch(url, { signal: AbortSignal.timeout(12e4) });
173
+ } catch (error) {
174
+ throw new Error(
175
+ `Couldn't download the skills from ${url}: ${error instanceof Error ? error.message : String(error)}`,
176
+ { cause: error }
177
+ );
178
+ }
179
+ if (!res.ok) {
180
+ throw new Error(`Couldn't download the skills from ${url}: HTTP ${res.status}.`);
181
+ }
182
+ const tarball = path.join(work, "skills.tar.gz");
183
+ writeFileSync(tarball, Buffer.from(await res.arrayBuffer()));
184
+ const root = path.join(work, "src");
185
+ mkdirSync(root);
186
+ await So({ cwd: root, file: tarball, strip: 1 });
187
+ return { cleanup, origin: url, root };
188
+ } catch (error) {
189
+ cleanup();
190
+ throw error;
191
+ }
192
+ };
193
+ var discoverSkills = (root) => {
194
+ const pluginsDir = path.join(root, "plugins");
195
+ const skills = /* @__PURE__ */ new Map();
196
+ for (const plugin of readdirSync(pluginsDir, { withFileTypes: true })) {
197
+ const skillsDir = path.join(pluginsDir, plugin.name, "skills");
198
+ if (!plugin.isDirectory() || !existsSync(skillsDir)) {
199
+ continue;
200
+ }
201
+ for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
202
+ const dir = path.join(skillsDir, entry.name);
203
+ if (entry.isDirectory() && SKILL_NAME.test(entry.name) && existsSync(path.join(dir, "SKILL.md")) && !skills.has(entry.name)) {
204
+ skills.set(entry.name, { dir, name: entry.name });
205
+ }
206
+ }
207
+ }
208
+ return [...skills.values()].toSorted((a, b) => a.name.localeCompare(b.name));
209
+ };
210
+ var baseDir = (target) => target.scope === "global" ? target.home : target.cwd;
211
+ var canonicalDir = (target) => path.join(baseDir(target), ".agents", "skills");
212
+ var manifestPath = (target) => path.join(baseDir(target), ".agents", "vibedgames-skills.json");
213
+ var agentSkillsDir = (target, agent) => target.scope === "global" ? agent.global(target.home, target.env) : path.join(target.cwd, agent.project);
214
+ var readJson = (file) => {
215
+ if (!existsSync(file)) {
216
+ return null;
217
+ }
218
+ try {
219
+ const value = JSON.parse(readFileSync(file, "utf-8"));
220
+ return value;
221
+ } catch {
222
+ return null;
223
+ }
224
+ };
225
+ var readManifest = (target) => {
226
+ const data = readJson(manifestPath(target));
227
+ if (!isJsonObject(data) || !Array.isArray(data.skills) || !Array.isArray(data.agents)) {
228
+ return null;
229
+ }
230
+ return {
231
+ agents: data.agents.filter((agent) => isJsonString(agent)),
232
+ skills: data.skills.filter((skill) => isJsonString(skill))
233
+ };
234
+ };
235
+ var linksTo = (link, dir) => {
236
+ try {
237
+ return lstatSync(link).isSymbolicLink() && realpathSync(link) === realpathSync(dir);
238
+ } catch {
239
+ return false;
240
+ }
241
+ };
242
+ var isDanglingLink = (link) => {
243
+ try {
244
+ return lstatSync(link).isSymbolicLink() && !existsSync(link);
245
+ } catch {
246
+ return false;
247
+ }
248
+ };
249
+ var isCopyOf = (copy, dir) => {
250
+ try {
251
+ return lstatSync(copy).isDirectory() && readFileSync(path.join(copy, "SKILL.md"), "utf-8") === readFileSync(path.join(dir, "SKILL.md"), "utf-8");
252
+ } catch {
253
+ return false;
254
+ }
255
+ };
256
+ var isMissing = (file) => {
257
+ try {
258
+ lstatSync(file);
259
+ return false;
260
+ } catch {
261
+ return true;
262
+ }
263
+ };
264
+ var resolvesTo = (file, dir) => {
265
+ try {
266
+ return realpathSync(file) === realpathSync(dir);
267
+ } catch {
268
+ return false;
269
+ }
270
+ };
271
+ var linkSkill = (link, dir) => {
272
+ mkdirSync(path.dirname(link), { recursive: true });
273
+ if (resolvesTo(link, dir)) {
274
+ return "unchanged";
275
+ }
276
+ if (!isMissing(link)) {
277
+ rmSync(link, { force: true, recursive: true });
278
+ }
279
+ try {
280
+ if (process.platform === "win32") {
281
+ symlinkSync(dir, link, "junction");
282
+ } else {
283
+ symlinkSync(path.relative(realpathSync(path.dirname(link)), realpathSync(dir)), link);
284
+ }
285
+ return "linked";
286
+ } catch {
287
+ cpSync(dir, link, { recursive: true });
288
+ return "copied";
289
+ }
290
+ };
291
+ var copySkill = (from, to) => {
292
+ rmSync(to, { force: true, recursive: true });
293
+ cpSync(from, to, {
294
+ dereference: true,
295
+ filter: (source) => !SKIPPED_ENTRIES.has(path.basename(source)),
296
+ recursive: true
297
+ });
298
+ };
299
+ var installSkills = (source, target, agents) => {
300
+ const skills = discoverSkills(source.root);
301
+ if (skills.length === 0) {
302
+ throw new Error(`No skills found in ${source.origin}.`);
303
+ }
304
+ const canonical = canonicalDir(target);
305
+ const previous = readManifest(target)?.skills ?? [];
306
+ const names = new Set(skills.map((skill) => skill.name));
307
+ const linked = agents.flatMap((id) => {
308
+ const dirs = LINKED_AGENTS.get(id);
309
+ return dirs ? [{ dir: agentSkillsDir(target, dirs), id }] : [];
310
+ });
311
+ const copiedFor = /* @__PURE__ */ new Set();
312
+ mkdirSync(canonical, { recursive: true });
313
+ for (const skill of skills) {
314
+ const dir = path.join(canonical, skill.name);
315
+ copySkill(skill.dir, dir);
316
+ for (const agent of linked) {
317
+ if (linkSkill(path.join(agent.dir, skill.name), dir) === "copied") {
318
+ copiedFor.add(agent.id);
319
+ }
320
+ }
321
+ }
322
+ const removed = [];
323
+ for (const name of previous.filter((n) => SKILL_NAME.test(n) && !names.has(n)).toSorted()) {
324
+ const dir = path.join(canonical, name);
325
+ for (const agent of [...LINKED_AGENTS.values()].map((dirs) => agentSkillsDir(target, dirs))) {
326
+ const link = path.join(agent, name);
327
+ if (linksTo(link, dir) || isDanglingLink(link)) {
328
+ unlinkSync(link);
329
+ } else if (isCopyOf(link, dir)) {
330
+ rmSync(link, { force: true, recursive: true });
331
+ }
332
+ }
333
+ if (existsSync(dir) && statSync(dir).isDirectory()) {
334
+ rmSync(dir, { force: true, recursive: true });
335
+ removed.push(name);
336
+ }
337
+ }
338
+ writeFileSync(
339
+ manifestPath(target),
340
+ `${JSON.stringify(
341
+ {
342
+ agents,
343
+ skills: [...names],
344
+ source: SKILLS_REPO,
345
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
346
+ version: 1
347
+ },
348
+ null,
349
+ 2
350
+ )}
351
+ `
352
+ );
353
+ return {
354
+ agents,
355
+ copiedFor: [...copiedFor],
356
+ dir: canonical,
357
+ installed: [...names],
358
+ removed,
359
+ scope: target.scope
360
+ };
361
+ };
362
+ var syncSkills = async (target, agents) => {
363
+ const source = await fetchSkillsSource(target.env);
364
+ try {
365
+ return installSkills(source, target, agents);
366
+ } finally {
367
+ source.cleanup?.();
368
+ }
369
+ };
370
+ var settleSync = async (task) => {
371
+ try {
372
+ return { ok: true, value: await task };
373
+ } catch (error) {
374
+ return { message: error instanceof Error ? error.message : String(error), ok: false };
375
+ }
376
+ };
377
+ var targetFor = (scope) => ({
378
+ cwd: process.cwd(),
379
+ env: process.env,
380
+ home: homedir(),
381
+ scope
382
+ });
383
+ var findInstall = (scopes, base = targetFor("project")) => {
384
+ for (const scope of scopes) {
385
+ const target = { ...base, scope };
386
+ const manifest = readManifest(target);
387
+ if (manifest) {
388
+ const known = manifest.agents.filter(
389
+ (id) => SHARED_DIR_AGENTS.has(id) || LINKED_AGENTS.has(id)
390
+ );
391
+ return { agents: known.length > 0 ? known : DEFAULT_AGENTS, target };
392
+ }
393
+ }
394
+ return null;
395
+ };
396
+
397
+ // src/commands/init.ts
398
+ var description = "Install/update vibedgames skills and the vg CLI";
399
+ var initArgs = {
400
+ agent: {
401
+ alias: "a",
402
+ default: DEFAULT_AGENTS.join(","),
403
+ description: "Comma-separated target agents (default: Claude Code, Cursor and Codex). Skills live once in .agents/skills/, which Codex, Cursor and most agents read directly; Claude Code and agents with a skills dir of their own get a symlink per skill. Pass '*' for every supported agent.",
404
+ type: "string"
405
+ },
406
+ global: {
407
+ alias: "g",
408
+ default: false,
409
+ description: "Install to your home directory instead of the project",
410
+ type: "boolean"
411
+ }
412
+ };
413
+ var reportSkills = (report) => {
414
+ const where = path2.relative(process.cwd(), report.dir) || report.dir;
415
+ consola.success(
416
+ `Installed ${report.installed.length} vibedgames skills into ${where} for ${report.agents.join(", ")}`
417
+ );
418
+ if (report.removed.length > 0) {
419
+ consola.info(`Removed skills dropped upstream: ${report.removed.join(", ")}`);
420
+ }
421
+ for (const agent of report.copiedFor) {
422
+ consola.info(
423
+ `Symlinks aren't available here, so ${agent} got copies of the skills; vg init and vg update refresh them.`
424
+ );
425
+ }
426
+ };
427
+ var initCommand = defineCommand({
428
+ args: initArgs,
429
+ meta: { description, name: "init" },
430
+ run: async ({ args, rawArgs }) => {
431
+ assertKnownFlags(rawArgs, initArgs);
432
+ const agents = parseAgents(args.agent);
433
+ const manager = detectPackageManager(import.meta.filename);
434
+ consola.start("Installing/updating vibedgames skills and the vg CLI...");
435
+ const [skills, cli] = await Promise.all([
436
+ settleSync(syncSkills(targetFor(args.global ? "global" : "project"), agents)),
437
+ run(manager, globalInstallArgs(manager))
438
+ ]);
439
+ if (skills.ok) {
440
+ reportSkills(skills.value);
441
+ }
442
+ if (cli.code === 0) {
443
+ consola.success(`Installed/updated ${PKG_NAME} globally with ${manager}`);
444
+ } else {
445
+ if (cli.output.trim() && !isMissingCommand(cli)) {
446
+ consola.warn(cli.output.trim());
447
+ }
448
+ consola.warn(
449
+ isMissingCommand(cli) ? `Couldn't find ${manager} to update the vg CLI. Update manually: ${globalInstallCommand(manager)}` : `Couldn't install the vg CLI globally (${manager} exit ${cli.code}). Install manually: ${globalInstallCommand(manager)}`
450
+ );
451
+ }
452
+ if (!skills.ok) {
453
+ throw new Error(`Couldn't install the skills: ${skills.message}`);
454
+ }
455
+ }
456
+ });
457
+
458
+ export {
459
+ isMissingCommand,
460
+ run,
461
+ syncSkills,
462
+ settleSync,
463
+ findInstall,
464
+ reportSkills,
465
+ initCommand
466
+ };
@@ -0,0 +1,26 @@
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
+
8
+ // src/lib/types.ts
9
+ var isJsonObject = (value) => (
10
+ // Object() is the identity only on objects; arrays are split off explicitly.
11
+ Object(value) === value && !Array.isArray(value)
12
+ );
13
+ var isJsonString = (value) => (
14
+ // String() is the identity only on strings.
15
+ String(value) === value
16
+ );
17
+ var isJsonNumber = (value) => (
18
+ // JSON cannot encode NaN/Infinity, so isFinite matches every JSON number.
19
+ Number.isFinite(value)
20
+ );
21
+
22
+ export {
23
+ isJsonObject,
24
+ isJsonString,
25
+ isJsonNumber
26
+ };