vibedgames 0.6.3 → 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.
- package/README.md +14 -9
- package/dist/THIRD_PARTY_NOTICES.txt +383 -0
- package/dist/chunk-2GL2WJZX.js +172 -0
- package/dist/chunk-2QBYTIMH.js +511 -0
- package/dist/chunk-34AHIMX7.js +466 -0
- package/dist/chunk-6FZPPUQH.js +107 -0
- package/dist/chunk-BVVYDSFJ.js +99 -0
- package/dist/chunk-CAKBGDCY.js +47 -0
- package/dist/chunk-CBKOPVU6.js +1780 -0
- package/dist/chunk-CU7UY5YJ.js +1108 -0
- package/dist/chunk-CZPKN32Z.js +257 -0
- package/dist/chunk-DHEXGWJY.js +111 -0
- package/dist/chunk-FL6IFBUF.js +22 -0
- package/dist/chunk-FLUXEHMU.js +1360 -0
- package/dist/chunk-FNYBZNW2.js +165 -0
- package/dist/chunk-G5FRIFA3.js +22 -0
- package/dist/chunk-HCMTSR7E.js +69 -0
- package/dist/chunk-HKA5LBYW.js +159 -0
- package/dist/chunk-I6O4HIDY.js +1063 -0
- package/dist/chunk-J6PKNPI2.js +26 -0
- package/dist/chunk-JT2AU24K.js +759 -0
- package/dist/chunk-MBXCVCC4.js +478 -0
- package/dist/chunk-MJQSHP3Y.js +415 -0
- package/dist/chunk-MYFLYNPO.js +68 -0
- package/dist/chunk-PEUP4MZR.js +59 -0
- package/dist/chunk-PHEDW6C7.js +32 -0
- package/dist/chunk-PQDBCZRT.js +2017 -0
- package/dist/chunk-QGEITHUP.js +395 -0
- package/dist/chunk-QIVCBUYD.js +273 -0
- package/dist/chunk-RYFO3ZPO.js +71 -0
- package/dist/chunk-RZ4DIJQW.js +68 -0
- package/dist/chunk-SAANBZ25.js +118 -0
- package/dist/chunk-VFFOT7KD.js +2980 -0
- package/dist/chunk-Y552BNFZ.js +41 -0
- package/dist/chunk-Z4Z24FWO.js +39 -0
- package/dist/chunk-ZI6PKVXG.js +64 -0
- package/dist/chunk-ZYCSYJWX.js +87 -0
- package/dist/index.js +67 -60
- package/package.json +13 -16
- package/templates/none/_gitignore +3 -0
- package/templates/none/index.html +29 -0
- package/templates/none/package.json +16 -0
- package/templates/none/src/main.ts +16 -0
- package/templates/none/tsconfig.json +18 -0
- package/templates/none/vite.config.ts +8 -0
- package/templates/phaser/_gitignore +3 -0
- package/templates/phaser/index.html +24 -0
- package/templates/phaser/package.json +19 -0
- package/templates/phaser/src/main.ts +16 -0
- package/templates/phaser/src/scenes/game-scene.ts +65 -0
- package/templates/phaser/tsconfig.json +18 -0
- package/templates/phaser/vite.config.ts +8 -0
- package/templates/react-r3f/_gitignore +3 -0
- package/templates/react-r3f/index.html +24 -0
- package/templates/react-r3f/package.json +27 -0
- package/templates/react-r3f/src/app.tsx +33 -0
- package/templates/react-r3f/src/main.tsx +15 -0
- package/templates/react-r3f/tsconfig.json +19 -0
- package/templates/react-r3f/vite.config.ts +10 -0
- package/templates/threejs/_gitignore +3 -0
- package/templates/threejs/index.html +36 -0
- package/templates/threejs/package.json +20 -0
- package/templates/threejs/src/main.ts +44 -0
- package/templates/threejs/tsconfig.json +18 -0
- package/templates/threejs/vite.config.ts +8 -0
- package/dist/commands/completions.d.ts +0 -7
- package/dist/commands/completions.js +0 -145
- package/dist/commands/credits.d.ts +0 -10
- package/dist/commands/credits.js +0 -136
- package/dist/commands/deploy.d.ts +0 -26
- package/dist/commands/deploy.js +0 -257
- package/dist/commands/factory.d.ts +0 -3
- package/dist/commands/factory.js +0 -73
- package/dist/commands/fork.d.ts +0 -29
- package/dist/commands/fork.js +0 -124
- package/dist/commands/generate.d.ts +0 -1
- package/dist/commands/generate.js +0 -565
- package/dist/commands/init.d.ts +0 -20
- package/dist/commands/init.js +0 -105
- package/dist/commands/login.d.ts +0 -1
- package/dist/commands/login.js +0 -45
- package/dist/commands/logout.d.ts +0 -1
- package/dist/commands/logout.js +0 -13
- package/dist/commands/new.d.ts +0 -26
- package/dist/commands/new.js +0 -318
- package/dist/commands/playtest-run.d.ts +0 -66
- package/dist/commands/playtest-run.js +0 -268
- package/dist/commands/playtest.d.ts +0 -76
- package/dist/commands/playtest.js +0 -372
- package/dist/commands/update.d.ts +0 -13
- package/dist/commands/update.js +0 -82
- package/dist/commands/whoami.d.ts +0 -10
- package/dist/commands/whoami.js +0 -44
- package/dist/index.d.ts +0 -2
- package/dist/lib/api.d.ts +0 -18
- package/dist/lib/api.js +0 -27
- package/dist/lib/archive.d.ts +0 -17
- package/dist/lib/archive.js +0 -228
- package/dist/lib/codex.d.ts +0 -117
- package/dist/lib/codex.js +0 -426
- package/dist/lib/config-file.d.ts +0 -16
- package/dist/lib/config-file.js +0 -54
- package/dist/lib/config.d.ts +0 -11
- package/dist/lib/config.js +0 -54
- package/dist/lib/manifest.d.ts +0 -10
- package/dist/lib/manifest.js +0 -91
- package/dist/lib/media-args.d.ts +0 -30
- package/dist/lib/media-args.js +0 -219
- package/dist/lib/media-download.d.ts +0 -37
- package/dist/lib/media-download.js +0 -268
- package/dist/lib/media-poll.d.ts +0 -18
- package/dist/lib/media-poll.js +0 -86
- package/dist/lib/media-upload.d.ts +0 -12
- package/dist/lib/media-upload.js +0 -52
- package/dist/lib/output.d.ts +0 -68
- package/dist/lib/output.js +0 -102
- package/dist/lib/package-manager.d.ts +0 -25
- package/dist/lib/package-manager.js +0 -77
- package/dist/lib/playtest/agent.d.ts +0 -192
- package/dist/lib/playtest/agent.js +0 -652
- package/dist/lib/playtest/browser.d.ts +0 -109
- package/dist/lib/playtest/browser.js +0 -219
- package/dist/lib/playtest/controls.d.ts +0 -47
- package/dist/lib/playtest/controls.js +0 -218
- package/dist/lib/playtest/errors.d.ts +0 -9
- package/dist/lib/playtest/errors.js +0 -12
- package/dist/lib/playtest/keys.d.ts +0 -41
- package/dist/lib/playtest/keys.js +0 -157
- package/dist/lib/playtest/run.d.ts +0 -195
- package/dist/lib/playtest/run.js +0 -409
- package/dist/lib/run.d.ts +0 -19
- package/dist/lib/run.js +0 -23
- package/dist/lib/strict-args.d.ts +0 -27
- package/dist/lib/strict-args.js +0 -78
- package/dist/lib/types.d.ts +0 -16
- package/dist/lib/types.js +0 -10
- package/dist/lib/update.d.ts +0 -10
- package/dist/lib/update.js +0 -110
- package/dist/lib/upload.d.ts +0 -16
- 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
|
+
consola
|
|
24
|
+
} from "./chunk-CU7UY5YJ.js";
|
|
25
|
+
import {
|
|
26
|
+
isJsonObject,
|
|
27
|
+
isJsonString
|
|
28
|
+
} from "./chunk-J6PKNPI2.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,107 @@
|
|
|
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
|
+
getConfigDir
|
|
9
|
+
} from "./chunk-RYFO3ZPO.js";
|
|
10
|
+
import {
|
|
11
|
+
isJsonObject,
|
|
12
|
+
isJsonString
|
|
13
|
+
} from "./chunk-J6PKNPI2.js";
|
|
14
|
+
|
|
15
|
+
// src/lib/settings.ts
|
|
16
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
var SETTINGS = {
|
|
19
|
+
"generate.codex-bin": {
|
|
20
|
+
default: "codex",
|
|
21
|
+
description: "The codex binary the codex provider runs.",
|
|
22
|
+
env: { name: "VG_CODEX_BIN", read: (raw) => raw }
|
|
23
|
+
},
|
|
24
|
+
"generate.provider": {
|
|
25
|
+
default: "vibedgames",
|
|
26
|
+
description: "Where `vg generate run` sends work. codex: OpenAI image runs that Codex can serve go to your own Codex plan; everything else stays on vibedgames. `--provider` overrides it for one run.",
|
|
27
|
+
env: { name: "VG_GENERATE_PROVIDER", read: (raw) => raw.trim().toLowerCase() },
|
|
28
|
+
values: ["vibedgames", "codex"]
|
|
29
|
+
},
|
|
30
|
+
"update.auto": {
|
|
31
|
+
default: "true",
|
|
32
|
+
description: "Update the CLI and installed skills in the background, at most once a day.",
|
|
33
|
+
env: { name: "VG_NO_AUTO_UPDATE", read: () => "false" },
|
|
34
|
+
values: ["true", "false"]
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var isSettingKey = (key) => Object.hasOwn(SETTINGS, key);
|
|
38
|
+
var SETTING_KEYS = Object.keys(SETTINGS).filter((key) => isSettingKey(key));
|
|
39
|
+
var settingsPath = () => path.join(getConfigDir(), "config.json");
|
|
40
|
+
var readFile = () => {
|
|
41
|
+
const file = settingsPath();
|
|
42
|
+
if (!existsSync(file)) {
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const data = JSON.parse(readFileSync(file, "utf-8"));
|
|
47
|
+
return isJsonObject(data) ? data : {};
|
|
48
|
+
} catch {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var writeFile = (data) => {
|
|
53
|
+
const dir = getConfigDir();
|
|
54
|
+
if (!existsSync(dir)) {
|
|
55
|
+
mkdirSync(dir, { mode: 448, recursive: true });
|
|
56
|
+
}
|
|
57
|
+
writeFileSync(settingsPath(), `${JSON.stringify(data, null, 2)}
|
|
58
|
+
`);
|
|
59
|
+
};
|
|
60
|
+
var savedValue = (data, key) => {
|
|
61
|
+
const value = data[key];
|
|
62
|
+
return isJsonString(value) && validate(key, value) === null ? value : null;
|
|
63
|
+
};
|
|
64
|
+
var validate = (key, value) => {
|
|
65
|
+
const { values } = SETTINGS[key];
|
|
66
|
+
if (values && !values.includes(value)) {
|
|
67
|
+
return `${key} must be one of: ${values.join(", ")}.`;
|
|
68
|
+
}
|
|
69
|
+
if (value.trim() === "") {
|
|
70
|
+
return `${key} can't be empty.`;
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
74
|
+
var resolveSetting = (key, env = process.env) => {
|
|
75
|
+
const spec = SETTINGS[key];
|
|
76
|
+
const raw = env[spec.env.name];
|
|
77
|
+
if (raw !== void 0 && raw !== "") {
|
|
78
|
+
return { key, source: "env", value: spec.env.read(raw) };
|
|
79
|
+
}
|
|
80
|
+
const saved = savedValue(readFile(), key);
|
|
81
|
+
if (saved !== null) {
|
|
82
|
+
return { key, source: "config", value: saved };
|
|
83
|
+
}
|
|
84
|
+
return { key, source: "default", value: spec.default };
|
|
85
|
+
};
|
|
86
|
+
var saveSetting = (key, value) => {
|
|
87
|
+
writeFile({ ...readFile(), [key]: value });
|
|
88
|
+
};
|
|
89
|
+
var removeSetting = (key) => {
|
|
90
|
+
const data = readFile();
|
|
91
|
+
if (!Object.hasOwn(data, key)) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
writeFile(Object.fromEntries(Object.entries(data).filter(([name]) => name !== key)));
|
|
95
|
+
return true;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
SETTINGS,
|
|
100
|
+
isSettingKey,
|
|
101
|
+
SETTING_KEYS,
|
|
102
|
+
settingsPath,
|
|
103
|
+
validate,
|
|
104
|
+
resolveSetting,
|
|
105
|
+
saveSetting,
|
|
106
|
+
removeSetting
|
|
107
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
consola
|
|
9
|
+
} from "./chunk-CU7UY5YJ.js";
|
|
10
|
+
import {
|
|
11
|
+
isJsonObject,
|
|
12
|
+
isJsonString
|
|
13
|
+
} from "./chunk-J6PKNPI2.js";
|
|
14
|
+
import {
|
|
15
|
+
defineCommand
|
|
16
|
+
} from "./chunk-MBXCVCC4.js";
|
|
17
|
+
import "./chunk-CAKBGDCY.js";
|
|
18
|
+
|
|
19
|
+
// src/commands/factory.ts
|
|
20
|
+
import { spawnSync } from "node:child_process";
|
|
21
|
+
import { existsSync } from "node:fs";
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
var factoryPackageFor = (platform, arch, report) => {
|
|
24
|
+
const name = `@vibedgames/factory-${platform}-${arch}`;
|
|
25
|
+
if (platform !== "linux") {
|
|
26
|
+
return name;
|
|
27
|
+
}
|
|
28
|
+
const header = isJsonObject(report) ? report.header : void 0;
|
|
29
|
+
return isJsonObject(header) && isJsonString(header.glibcVersionRuntime) ? name : `${name}-musl`;
|
|
30
|
+
};
|
|
31
|
+
var factoryPackage = () => {
|
|
32
|
+
if (process.platform !== "linux") {
|
|
33
|
+
return factoryPackageFor(process.platform, process.arch, null);
|
|
34
|
+
}
|
|
35
|
+
const reportText = JSON.stringify(process.report.getReport());
|
|
36
|
+
const report = JSON.parse(reportText);
|
|
37
|
+
return factoryPackageFor(process.platform, process.arch, report);
|
|
38
|
+
};
|
|
39
|
+
var BIN = process.platform === "win32" ? "vg-factory.exe" : "vg-factory";
|
|
40
|
+
var npmGlobalRoot = () => {
|
|
41
|
+
try {
|
|
42
|
+
const res = spawnSync("npm", ["root", "-g"], { encoding: "utf-8", timeout: 3e4 });
|
|
43
|
+
if (res.status !== 0 || res.error !== void 0) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const root = res.stdout.trim();
|
|
47
|
+
return root || null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var findBinary = (pkg) => {
|
|
53
|
+
const override = process.env.VG_FACTORY_BIN;
|
|
54
|
+
if (override) {
|
|
55
|
+
return existsSync(override) ? override : null;
|
|
56
|
+
}
|
|
57
|
+
const root = npmGlobalRoot();
|
|
58
|
+
if (!root) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const bin = path.join(root, pkg, "bin", BIN);
|
|
62
|
+
return existsSync(bin) ? bin : null;
|
|
63
|
+
};
|
|
64
|
+
var runFactory = (args) => {
|
|
65
|
+
const pkg = factoryPackage();
|
|
66
|
+
let bin = findBinary(pkg);
|
|
67
|
+
if (!bin) {
|
|
68
|
+
consola.start(`Installing the factory (${pkg})\u2026`);
|
|
69
|
+
const install = spawnSync("npm", ["install", "-g", pkg], { stdio: "inherit" });
|
|
70
|
+
if (install.status !== 0 || install.error !== void 0) {
|
|
71
|
+
consola.error(`Couldn't install the factory. Try manually: npm install -g ${pkg}`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
bin = findBinary(pkg);
|
|
75
|
+
if (!bin) {
|
|
76
|
+
consola.error(
|
|
77
|
+
`Installed ${pkg} but couldn't find its binary under npm's global root. Check \`npm root -g\`.`
|
|
78
|
+
);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
consola.success("Factory installed.");
|
|
82
|
+
}
|
|
83
|
+
const result = spawnSync(bin, args, { stdio: "inherit" });
|
|
84
|
+
process.exit(result.status ?? 1);
|
|
85
|
+
};
|
|
86
|
+
var factoryCommand = defineCommand({
|
|
87
|
+
meta: {
|
|
88
|
+
description: "Run the vibedgames factory \u2014 an autonomous agent that builds a browser game and evolves it like a studio (optional plugin; installs on first use). All arguments are passed through: `vg factory` opens the dashboard, `vg factory start <slug>` resumes a game.",
|
|
89
|
+
name: "factory"
|
|
90
|
+
},
|
|
91
|
+
run: ({ rawArgs }) => {
|
|
92
|
+
runFactory(rawArgs);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
export {
|
|
96
|
+
factoryCommand,
|
|
97
|
+
factoryPackageFor,
|
|
98
|
+
runFactory
|
|
99
|
+
};
|