@vm0/cli 9.27.2 → 9.28.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/index.js +44 -29
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ if (DSN) {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
Sentry.setContext("cli", {
|
|
64
|
-
version: "9.
|
|
64
|
+
version: "9.28.0",
|
|
65
65
|
command: process.argv.slice(2).join(" ")
|
|
66
66
|
});
|
|
67
67
|
Sentry.setContext("runtime", {
|
|
@@ -303,6 +303,7 @@ import chalk2 from "chalk";
|
|
|
303
303
|
var PACKAGE_NAME = "@vm0/cli";
|
|
304
304
|
var NPM_REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
|
|
305
305
|
var TIMEOUT_MS = 5e3;
|
|
306
|
+
var pendingUpgrade = null;
|
|
306
307
|
function detectPackageManager() {
|
|
307
308
|
const execPath = process.argv[1] ?? "";
|
|
308
309
|
if (execPath.includes("pnpm")) {
|
|
@@ -437,7 +438,8 @@ async function checkAndUpgrade(currentVersion, prompt) {
|
|
|
437
438
|
console.error(chalk2.cyan(` ${buildRerunCommand(prompt)}`));
|
|
438
439
|
return true;
|
|
439
440
|
}
|
|
440
|
-
async function
|
|
441
|
+
async function startSilentUpgrade(currentVersion) {
|
|
442
|
+
pendingUpgrade = null;
|
|
441
443
|
const latestVersion = await getLatestVersion();
|
|
442
444
|
if (latestVersion === null || latestVersion === currentVersion) {
|
|
443
445
|
return;
|
|
@@ -449,29 +451,36 @@ async function silentUpgradeAfterCommand(currentVersion) {
|
|
|
449
451
|
const isWindows = process.platform === "win32";
|
|
450
452
|
const command = isWindows ? `${packageManager}.cmd` : packageManager;
|
|
451
453
|
const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
windowsHide: true
|
|
460
|
-
});
|
|
461
|
-
const timeoutId = setTimeout(() => {
|
|
462
|
-
child.kill();
|
|
463
|
-
resolve(false);
|
|
464
|
-
}, TIMEOUT_MS);
|
|
465
|
-
child.on("close", (code) => {
|
|
466
|
-
clearTimeout(timeoutId);
|
|
467
|
-
resolve(code === 0);
|
|
468
|
-
});
|
|
469
|
-
child.on("error", () => {
|
|
470
|
-
clearTimeout(timeoutId);
|
|
471
|
-
resolve(false);
|
|
472
|
-
});
|
|
454
|
+
const child = spawn(command, args, {
|
|
455
|
+
stdio: "pipe",
|
|
456
|
+
// Capture output instead of inheriting
|
|
457
|
+
shell: isWindows,
|
|
458
|
+
detached: !isWindows,
|
|
459
|
+
// Detach on non-Windows
|
|
460
|
+
windowsHide: true
|
|
473
461
|
});
|
|
474
|
-
|
|
462
|
+
const promise = new Promise((resolve) => {
|
|
463
|
+
child.on("close", (code) => resolve(code === 0));
|
|
464
|
+
child.on("error", () => resolve(false));
|
|
465
|
+
});
|
|
466
|
+
pendingUpgrade = { promise, child, packageManager };
|
|
467
|
+
}
|
|
468
|
+
async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
|
|
469
|
+
if (!pendingUpgrade) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const { promise, child, packageManager } = pendingUpgrade;
|
|
473
|
+
pendingUpgrade = null;
|
|
474
|
+
const result = await Promise.race([
|
|
475
|
+
promise,
|
|
476
|
+
new Promise((resolve) => {
|
|
477
|
+
setTimeout(() => {
|
|
478
|
+
child.kill();
|
|
479
|
+
resolve(false);
|
|
480
|
+
}, timeout);
|
|
481
|
+
})
|
|
482
|
+
]);
|
|
483
|
+
if (!result) {
|
|
475
484
|
console.log(
|
|
476
485
|
chalk2.yellow(
|
|
477
486
|
`
|
|
@@ -484,7 +493,7 @@ async function silentUpgradeAfterCommand(currentVersion) {
|
|
|
484
493
|
// src/commands/info/index.ts
|
|
485
494
|
var CONFIG_PATH = join2(homedir2(), ".vm0", "config.json");
|
|
486
495
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
487
|
-
console.log(chalk3.bold(`VM0 CLI v${"9.
|
|
496
|
+
console.log(chalk3.bold(`VM0 CLI v${"9.28.0"}`));
|
|
488
497
|
console.log();
|
|
489
498
|
const config = await loadConfig();
|
|
490
499
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -5951,7 +5960,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5951
5960
|
);
|
|
5952
5961
|
}
|
|
5953
5962
|
if (options.autoUpdate !== false) {
|
|
5954
|
-
await
|
|
5963
|
+
await waitForSilentUpgrade();
|
|
5955
5964
|
}
|
|
5956
5965
|
return result;
|
|
5957
5966
|
}
|
|
@@ -6086,6 +6095,9 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
6086
6095
|
options.yes = true;
|
|
6087
6096
|
options.autoUpdate = false;
|
|
6088
6097
|
}
|
|
6098
|
+
if (options.autoUpdate !== false) {
|
|
6099
|
+
await startSilentUpgrade("9.28.0");
|
|
6100
|
+
}
|
|
6089
6101
|
try {
|
|
6090
6102
|
let result;
|
|
6091
6103
|
if (isGitHubUrl(resolvedConfigFile)) {
|
|
@@ -8305,6 +8317,9 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8305
8317
|
).addOption(new Option2("--debug-no-mock-claude").hideHelp()).addOption(new Option2("--no-auto-update").hideHelp()).action(
|
|
8306
8318
|
async (identifier, prompt, options) => {
|
|
8307
8319
|
try {
|
|
8320
|
+
if (options.autoUpdate !== false) {
|
|
8321
|
+
await startSilentUpgrade("9.28.0");
|
|
8322
|
+
}
|
|
8308
8323
|
const { scope, name, version } = parseIdentifier(identifier);
|
|
8309
8324
|
if (scope && !options.experimentalSharedAgent) {
|
|
8310
8325
|
const userScope = await getScope();
|
|
@@ -8401,7 +8416,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8401
8416
|
}
|
|
8402
8417
|
showNextSteps(result);
|
|
8403
8418
|
if (options.autoUpdate !== false) {
|
|
8404
|
-
await
|
|
8419
|
+
await waitForSilentUpgrade();
|
|
8405
8420
|
}
|
|
8406
8421
|
} catch (error) {
|
|
8407
8422
|
handleRunError(error, identifier);
|
|
@@ -9848,7 +9863,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9848
9863
|
).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
|
|
9849
9864
|
async (prompt, options) => {
|
|
9850
9865
|
if (options.autoUpdate !== false) {
|
|
9851
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9866
|
+
const shouldExit = await checkAndUpgrade("9.28.0", prompt);
|
|
9852
9867
|
if (shouldExit) {
|
|
9853
9868
|
process.exit(0);
|
|
9854
9869
|
}
|
|
@@ -14246,7 +14261,7 @@ var devToolCommand = new Command75().name("dev-tool").description("Developer too
|
|
|
14246
14261
|
|
|
14247
14262
|
// src/index.ts
|
|
14248
14263
|
var program = new Command76();
|
|
14249
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
14264
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.28.0");
|
|
14250
14265
|
program.addCommand(authCommand);
|
|
14251
14266
|
program.addCommand(infoCommand);
|
|
14252
14267
|
program.addCommand(composeCommand);
|