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.
- 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,257 @@
|
|
|
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
|
+
isNewerVersion
|
|
12
|
+
} from "./chunk-SAANBZ25.js";
|
|
13
|
+
import {
|
|
14
|
+
SLUG_RE,
|
|
15
|
+
findProjectRoot,
|
|
16
|
+
readProjectConfig
|
|
17
|
+
} from "./chunk-ZI6PKVXG.js";
|
|
18
|
+
import {
|
|
19
|
+
getBaseUrl,
|
|
20
|
+
getConfigDir
|
|
21
|
+
} from "./chunk-RYFO3ZPO.js";
|
|
22
|
+
import {
|
|
23
|
+
consola
|
|
24
|
+
} from "./chunk-CU7UY5YJ.js";
|
|
25
|
+
import {
|
|
26
|
+
defineCommand
|
|
27
|
+
} from "./chunk-MBXCVCC4.js";
|
|
28
|
+
import {
|
|
29
|
+
__toESM
|
|
30
|
+
} from "./chunk-CAKBGDCY.js";
|
|
31
|
+
|
|
32
|
+
// src/commands/playtest.ts
|
|
33
|
+
import { createHash } from "node:crypto";
|
|
34
|
+
import { existsSync, mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
35
|
+
import path from "node:path";
|
|
36
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
37
|
+
var PKG = "agent-browser";
|
|
38
|
+
var MIN_VERSION = "0.34.0";
|
|
39
|
+
var PKG_SPEC = `${PKG}@^${MIN_VERSION}`;
|
|
40
|
+
var UNKNOWN_VERSION = "unknown";
|
|
41
|
+
var UPGRADE_RETRY_MS = 24 * 60 * 6e4;
|
|
42
|
+
var URL_TAKING = /* @__PURE__ */ new Set(["open", "goto", "navigate", "url"]);
|
|
43
|
+
var KNOWN_VERBS = /* @__PURE__ */ new Set([...URL_TAKING, "diff"]);
|
|
44
|
+
var installedVersion = (bin) => {
|
|
45
|
+
const res = import_cross_spawn.default.sync(bin, ["--version"], { encoding: "utf-8", timeout: 3e4 });
|
|
46
|
+
if (res.status !== 0 || res.error) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const match = /\d+\.\d+\.\d+/u.exec(res.stdout ?? "");
|
|
50
|
+
return match ? match[0] : UNKNOWN_VERSION;
|
|
51
|
+
};
|
|
52
|
+
var meetsMinimum = (version) => !isNewerVersion(MIN_VERSION, version);
|
|
53
|
+
var resolveBinary = () => {
|
|
54
|
+
const override = process.env.VG_AGENT_BROWSER_BIN;
|
|
55
|
+
if (override) {
|
|
56
|
+
return existsSync(override) ? { bin: override, version: UNKNOWN_VERSION } : null;
|
|
57
|
+
}
|
|
58
|
+
const version = installedVersion(PKG);
|
|
59
|
+
return version === null ? null : { bin: PKG, version };
|
|
60
|
+
};
|
|
61
|
+
var installGlobal = () => {
|
|
62
|
+
const res = import_cross_spawn.default.sync("npm", ["install", "-g", PKG_SPEC], {
|
|
63
|
+
stdio: "inherit",
|
|
64
|
+
timeout: 10 * 6e4
|
|
65
|
+
});
|
|
66
|
+
return res.status === 0 && !res.error ? resolveBinary() : null;
|
|
67
|
+
};
|
|
68
|
+
var bootstrap = () => {
|
|
69
|
+
consola.start(`Installing the playtest browser (${PKG})\u2026`);
|
|
70
|
+
const resolved = installGlobal();
|
|
71
|
+
if (!resolved) {
|
|
72
|
+
consola.error(
|
|
73
|
+
`Couldn't install ${PKG}, or it isn't on PATH afterwards. Try manually: npm install -g ${PKG_SPEC} \u2014 and check that npm's global bin directory is in your PATH (\`npm bin -g\`).`
|
|
74
|
+
);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
consola.start("Provisioning the browser (first run only)\u2026");
|
|
78
|
+
const provision = import_cross_spawn.default.sync(resolved.bin, ["install"], { stdio: "inherit" });
|
|
79
|
+
if (provision.status !== 0) {
|
|
80
|
+
consola.error(
|
|
81
|
+
`\`${PKG} install\` failed. On Linux you may need system libraries: ${PKG} install --with-deps`
|
|
82
|
+
);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
consola.success("Playtest browser ready.");
|
|
86
|
+
return resolved;
|
|
87
|
+
};
|
|
88
|
+
var recentlyFailed = (stamp) => {
|
|
89
|
+
try {
|
|
90
|
+
return Date.now() - statSync(stamp).mtimeMs < UPGRADE_RETRY_MS;
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var ensureMinimum = (resolved) => {
|
|
96
|
+
if (meetsMinimum(resolved.version)) {
|
|
97
|
+
return resolved;
|
|
98
|
+
}
|
|
99
|
+
const stamp = path.join(getConfigDir(), `${PKG}-upgrade-failed-${resolved.version}`);
|
|
100
|
+
if (recentlyFailed(stamp)) {
|
|
101
|
+
return resolved;
|
|
102
|
+
}
|
|
103
|
+
consola.warn(
|
|
104
|
+
`Found ${PKG} ${resolved.version}, but the playtest skill needs at least ${MIN_VERSION}. Upgrading\u2026`
|
|
105
|
+
);
|
|
106
|
+
const upgraded = installGlobal();
|
|
107
|
+
if (!upgraded || !meetsMinimum(upgraded.version)) {
|
|
108
|
+
try {
|
|
109
|
+
mkdirSync(getConfigDir(), { mode: 448, recursive: true });
|
|
110
|
+
writeFileSync(stamp, "");
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
consola.warn(
|
|
114
|
+
`Couldn't upgrade ${PKG}. Continuing on ${resolved.version} \u2014 run \`npm install -g ${PKG_SPEC}\` if commands misbehave.`
|
|
115
|
+
);
|
|
116
|
+
return resolved;
|
|
117
|
+
}
|
|
118
|
+
return upgraded;
|
|
119
|
+
};
|
|
120
|
+
var projectSlug = () => {
|
|
121
|
+
let config = null;
|
|
122
|
+
try {
|
|
123
|
+
config = readProjectConfig(process.cwd());
|
|
124
|
+
} catch (error) {
|
|
125
|
+
consola.error(error instanceof Error ? error.message : String(error));
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
if (!config) {
|
|
129
|
+
consola.error(
|
|
130
|
+
"`--game` with no slug reads vibedgames.json, and none was found here. Pass a slug (`vg playtest --game my-game`) or run from a deployed project."
|
|
131
|
+
);
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
return config.slug;
|
|
135
|
+
};
|
|
136
|
+
var resolveGameUrl = (slug) => {
|
|
137
|
+
const resolved = slug ?? projectSlug();
|
|
138
|
+
if (!SLUG_RE.test(resolved)) {
|
|
139
|
+
consola.error(`Invalid game slug "${resolved}". Use lowercase letters, digits, and hyphens.`);
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
const base = new URL(getBaseUrl());
|
|
143
|
+
if (base.hostname === "localhost" || base.hostname === "127.0.0.1") {
|
|
144
|
+
consola.error(
|
|
145
|
+
`\`--game\` resolves a deployed game's subdomain, which a local API URL (${base.host}) doesn't serve. Pass the game's URL directly instead.`
|
|
146
|
+
);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
return `${base.protocol}//${resolved}.${base.host}`;
|
|
150
|
+
};
|
|
151
|
+
var bareTokens = (args) => args.filter((arg, index) => {
|
|
152
|
+
if (arg.startsWith("-")) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
const previous = args[index - 1];
|
|
156
|
+
if (KNOWN_VERBS.has(arg) && previous !== "--game") {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
return !(previous !== void 0 && previous.startsWith("-") && !previous.includes("="));
|
|
160
|
+
});
|
|
161
|
+
var expandGameFlag = (args, resolveUrl = resolveGameUrl) => {
|
|
162
|
+
if (!args.includes("--game")) {
|
|
163
|
+
return args;
|
|
164
|
+
}
|
|
165
|
+
const bare = bareTokens(args);
|
|
166
|
+
const [verb] = bare;
|
|
167
|
+
const hasUrlVerb = verb !== void 0 && (URL_TAKING.has(verb) || verb === "diff" && bare[1] !== void 0 && URL_TAKING.has(bare[1]));
|
|
168
|
+
const verbLeads = bareTokens(args.slice(0, args.indexOf("--game"))).some(
|
|
169
|
+
(token) => URL_TAKING.has(token)
|
|
170
|
+
);
|
|
171
|
+
if (hasUrlVerb && !verbLeads) {
|
|
172
|
+
consola.error(
|
|
173
|
+
"`--game` supplies the URL to a verb, so it has to come after one: `vg playtest open --game my-game`."
|
|
174
|
+
);
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
const subcommand = hasUrlVerb ? null : verb ?? null;
|
|
178
|
+
if (subcommand !== null) {
|
|
179
|
+
consola.error(
|
|
180
|
+
`\`--game\` supplies a URL, so it only works with \`${[...URL_TAKING].join("`, `")}\` \u2014 not \`${subcommand}\`. Open the game first, then run \`vg playtest ${subcommand} \u2026\` against it.`
|
|
181
|
+
);
|
|
182
|
+
process.exit(1);
|
|
183
|
+
}
|
|
184
|
+
const out = [];
|
|
185
|
+
let consumed = false;
|
|
186
|
+
let opened = false;
|
|
187
|
+
for (const [index, arg] of args.entries()) {
|
|
188
|
+
if (consumed) {
|
|
189
|
+
consumed = false;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (arg !== "--game") {
|
|
193
|
+
out.push(arg);
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const next = args[index + 1];
|
|
197
|
+
const slug = next !== void 0 && !next.startsWith("-") ? next : null;
|
|
198
|
+
consumed = slug !== null;
|
|
199
|
+
if (!hasUrlVerb && !opened) {
|
|
200
|
+
out.push("open");
|
|
201
|
+
opened = true;
|
|
202
|
+
}
|
|
203
|
+
out.push(resolveUrl(slug));
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
};
|
|
207
|
+
var withScopedSession = (args, sessionId) => {
|
|
208
|
+
if (args.includes("--session") || args.some((a) => a.startsWith("--session="))) {
|
|
209
|
+
return args;
|
|
210
|
+
}
|
|
211
|
+
if (process.env.AGENT_BROWSER_SESSION) {
|
|
212
|
+
return args;
|
|
213
|
+
}
|
|
214
|
+
const [verb] = bareTokens(args);
|
|
215
|
+
if (verb === void 0 || verb === "session" || verb === "install") {
|
|
216
|
+
return args;
|
|
217
|
+
}
|
|
218
|
+
return ["--session", sessionId(), ...args];
|
|
219
|
+
};
|
|
220
|
+
var projectSessionId = () => {
|
|
221
|
+
const root = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
222
|
+
const digest = createHash("sha256").update(root).digest("hex").slice(0, 12);
|
|
223
|
+
return `vg-${digest}`;
|
|
224
|
+
};
|
|
225
|
+
var ensureAgentBrowser = () => {
|
|
226
|
+
const resolved = resolveBinary();
|
|
227
|
+
return resolved ? ensureMinimum(resolved) : bootstrap();
|
|
228
|
+
};
|
|
229
|
+
var runPlaytest = (rawArgs) => {
|
|
230
|
+
const args = withScopedSession(expandGameFlag(rawArgs), projectSessionId);
|
|
231
|
+
const { bin } = ensureAgentBrowser();
|
|
232
|
+
const result = import_cross_spawn.default.sync(bin, args, { stdio: "inherit" });
|
|
233
|
+
process.exit(result.status ?? 1);
|
|
234
|
+
};
|
|
235
|
+
var playtestCommand = defineCommand({
|
|
236
|
+
meta: {
|
|
237
|
+
description: "Drive a real browser to play a game \u2014 snapshot, click, hold keys, read state, screenshot, diff (installs the browser on first use). All arguments pass through: `vg playtest open <url>`, `vg playtest --game <slug>` to open a deployed game, `vg playtest --help` for the full command surface. `vg playtest run` is the exception: a model plays the game and reports (`vg playtest run --help`).",
|
|
238
|
+
name: "playtest"
|
|
239
|
+
},
|
|
240
|
+
run: ({ rawArgs }) => {
|
|
241
|
+
runPlaytest(rawArgs);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
export {
|
|
246
|
+
resolveBinary,
|
|
247
|
+
bootstrap,
|
|
248
|
+
ensureMinimum,
|
|
249
|
+
resolveGameUrl,
|
|
250
|
+
bareTokens,
|
|
251
|
+
expandGameFlag,
|
|
252
|
+
withScopedSession,
|
|
253
|
+
projectSessionId,
|
|
254
|
+
ensureAgentBrowser,
|
|
255
|
+
runPlaytest,
|
|
256
|
+
playtestCommand
|
|
257
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
findInstall,
|
|
9
|
+
isMissingCommand,
|
|
10
|
+
reportSkills,
|
|
11
|
+
run,
|
|
12
|
+
settleSync,
|
|
13
|
+
syncSkills
|
|
14
|
+
} from "./chunk-34AHIMX7.js";
|
|
15
|
+
import "./chunk-2QBYTIMH.js";
|
|
16
|
+
import {
|
|
17
|
+
fetchLatestVersion,
|
|
18
|
+
isNewerVersion
|
|
19
|
+
} from "./chunk-SAANBZ25.js";
|
|
20
|
+
import "./chunk-6FZPPUQH.js";
|
|
21
|
+
import "./chunk-VFFOT7KD.js";
|
|
22
|
+
import {
|
|
23
|
+
PACKAGE_VERSION
|
|
24
|
+
} from "./chunk-Z4Z24FWO.js";
|
|
25
|
+
import {
|
|
26
|
+
detectPackageManager,
|
|
27
|
+
globalInstallArgs,
|
|
28
|
+
globalInstallCommand
|
|
29
|
+
} from "./chunk-PEUP4MZR.js";
|
|
30
|
+
import {
|
|
31
|
+
assertKnownFlags
|
|
32
|
+
} from "./chunk-RZ4DIJQW.js";
|
|
33
|
+
import "./chunk-RYFO3ZPO.js";
|
|
34
|
+
import {
|
|
35
|
+
consola
|
|
36
|
+
} from "./chunk-CU7UY5YJ.js";
|
|
37
|
+
import "./chunk-J6PKNPI2.js";
|
|
38
|
+
import {
|
|
39
|
+
defineCommand
|
|
40
|
+
} from "./chunk-MBXCVCC4.js";
|
|
41
|
+
import "./chunk-CAKBGDCY.js";
|
|
42
|
+
|
|
43
|
+
// src/commands/update.ts
|
|
44
|
+
var updateInstalledSkills = async (global) => {
|
|
45
|
+
const found = findInstall(global ? ["global"] : ["project", "global"]);
|
|
46
|
+
return found ? await syncSkills(found.target, found.agents) : null;
|
|
47
|
+
};
|
|
48
|
+
var updateArgs = {
|
|
49
|
+
auto: {
|
|
50
|
+
default: false,
|
|
51
|
+
description: "(internal) silent background mode: only update when the registry has a newer version",
|
|
52
|
+
type: "boolean"
|
|
53
|
+
},
|
|
54
|
+
global: {
|
|
55
|
+
alias: "g",
|
|
56
|
+
default: false,
|
|
57
|
+
description: "Update skills installed in the user directory instead of the project",
|
|
58
|
+
type: "boolean"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var updateCommand = defineCommand({
|
|
62
|
+
args: updateArgs,
|
|
63
|
+
meta: {
|
|
64
|
+
description: "Update the vg CLI and vibedgames skills to latest (runs automatically once a day; turn that off with `vg config set update.auto false`)",
|
|
65
|
+
name: "update"
|
|
66
|
+
},
|
|
67
|
+
run: async ({ args, rawArgs }) => {
|
|
68
|
+
assertKnownFlags(rawArgs, updateArgs);
|
|
69
|
+
const manager = detectPackageManager(import.meta.filename);
|
|
70
|
+
if (args.auto) {
|
|
71
|
+
const latest = await fetchLatestVersion();
|
|
72
|
+
if (!latest || !isNewerVersion(latest, PACKAGE_VERSION)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
await Promise.all([
|
|
76
|
+
run(manager, globalInstallArgs(manager)),
|
|
77
|
+
// Silent background mode: a failed skills sync waits for the next run.
|
|
78
|
+
settleSync(updateInstalledSkills(args.global))
|
|
79
|
+
]);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
consola.start("Updating the vg CLI and vibedgames skills...");
|
|
83
|
+
const [cli, skills] = await Promise.all([
|
|
84
|
+
run(manager, globalInstallArgs(manager)),
|
|
85
|
+
settleSync(updateInstalledSkills(args.global))
|
|
86
|
+
]);
|
|
87
|
+
if (cli.code === 0) {
|
|
88
|
+
consola.success(`vg CLI updated to latest with ${manager}`);
|
|
89
|
+
} else {
|
|
90
|
+
if (cli.output.trim() && !isMissingCommand(cli)) {
|
|
91
|
+
consola.warn(cli.output.trim());
|
|
92
|
+
}
|
|
93
|
+
consola.warn(
|
|
94
|
+
isMissingCommand(cli) ? `Couldn't find ${manager} to update the vg CLI. Update manually: ${globalInstallCommand(manager)}` : `Couldn't update the vg CLI (${manager} exit ${cli.code}). Update manually: ${globalInstallCommand(manager)}`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
if (!skills.ok) {
|
|
98
|
+
consola.warn(`Couldn't update the skills: ${skills.message}`);
|
|
99
|
+
} else if (skills.value) {
|
|
100
|
+
reportSkills(skills.value);
|
|
101
|
+
} else {
|
|
102
|
+
consola.info("No vibedgames skills installed here or in your home directory: run vg init");
|
|
103
|
+
}
|
|
104
|
+
if (cli.code !== 0 && !skills.ok) {
|
|
105
|
+
throw new Error("update failed for both the CLI and skills");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
export {
|
|
110
|
+
updateCommand
|
|
111
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
fetchLatestVersion,
|
|
9
|
+
isNewerVersion,
|
|
10
|
+
markUpdateChecked,
|
|
11
|
+
maybeScheduleAutoUpdate
|
|
12
|
+
} from "./chunk-SAANBZ25.js";
|
|
13
|
+
import "./chunk-6FZPPUQH.js";
|
|
14
|
+
import "./chunk-RYFO3ZPO.js";
|
|
15
|
+
import "./chunk-J6PKNPI2.js";
|
|
16
|
+
import "./chunk-CAKBGDCY.js";
|
|
17
|
+
export {
|
|
18
|
+
fetchLatestVersion,
|
|
19
|
+
isNewerVersion,
|
|
20
|
+
markUpdateChecked,
|
|
21
|
+
maybeScheduleAutoUpdate
|
|
22
|
+
};
|