@vm0/cli 4.10.0 → 4.11.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 (2) hide show
  1. package/index.js +201 -99
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
 
8
8
  // src/index.ts
9
9
  import { Command as Command17 } from "commander";
10
- import chalk17 from "chalk";
10
+ import chalk18 from "chalk";
11
11
 
12
12
  // src/lib/auth.ts
13
13
  import chalk from "chalk";
@@ -15725,18 +15725,116 @@ var artifactCommand = new Command10().name("artifact").description("Manage cloud
15725
15725
 
15726
15726
  // src/commands/cook.ts
15727
15727
  import { Command as Command11 } from "commander";
15728
- import chalk12 from "chalk";
15728
+ import chalk13 from "chalk";
15729
15729
  import { readFile as readFile5, mkdir as mkdir5, writeFile as writeFile5, appendFile } from "fs/promises";
15730
15730
  import { existsSync as existsSync5, readFileSync } from "fs";
15731
15731
  import path12 from "path";
15732
- import { spawn } from "child_process";
15732
+ import { spawn as spawn2 } from "child_process";
15733
15733
  import { parse as parseYaml3 } from "yaml";
15734
15734
  import { config as dotenvConfig2 } from "dotenv";
15735
+
15736
+ // src/lib/update-checker.ts
15737
+ import https from "https";
15738
+ import { spawn } from "child_process";
15739
+ import chalk12 from "chalk";
15740
+ var PACKAGE_NAME = "@vm0/cli";
15741
+ var NPM_REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
15742
+ var TIMEOUT_MS = 5e3;
15743
+ function escapeForShell(str) {
15744
+ return `"${str.replace(/"/g, '\\"')}"`;
15745
+ }
15746
+ function buildRerunCommand(prompt) {
15747
+ if (prompt) {
15748
+ return `vm0 cook ${escapeForShell(prompt)}`;
15749
+ }
15750
+ return "vm0 cook";
15751
+ }
15752
+ function getLatestVersion() {
15753
+ return new Promise((resolve2) => {
15754
+ const req = https.get(NPM_REGISTRY_URL, (res) => {
15755
+ let data = "";
15756
+ res.on("data", (chunk) => {
15757
+ data += chunk.toString();
15758
+ });
15759
+ res.on("end", () => {
15760
+ try {
15761
+ const json2 = JSON.parse(data);
15762
+ resolve2(json2.version ?? null);
15763
+ } catch {
15764
+ resolve2(null);
15765
+ }
15766
+ });
15767
+ });
15768
+ req.on("error", () => {
15769
+ resolve2(null);
15770
+ });
15771
+ req.setTimeout(TIMEOUT_MS, () => {
15772
+ req.destroy();
15773
+ resolve2(null);
15774
+ });
15775
+ });
15776
+ }
15777
+ function performUpgrade() {
15778
+ return new Promise((resolve2) => {
15779
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
15780
+ const child = spawn(npm, ["install", "-g", `${PACKAGE_NAME}@latest`], {
15781
+ stdio: "inherit",
15782
+ shell: process.platform === "win32"
15783
+ });
15784
+ child.on("close", (code) => {
15785
+ resolve2(code === 0);
15786
+ });
15787
+ child.on("error", () => {
15788
+ resolve2(false);
15789
+ });
15790
+ });
15791
+ }
15792
+ async function checkAndUpgrade(currentVersion, prompt) {
15793
+ const latestVersion = await getLatestVersion();
15794
+ if (latestVersion === null) {
15795
+ console.log(chalk12.yellow("Warning: Could not check for updates"));
15796
+ console.log();
15797
+ return false;
15798
+ }
15799
+ if (latestVersion === currentVersion) {
15800
+ return false;
15801
+ }
15802
+ console.log(chalk12.yellow("vm0 is currently in Early Access (EA)."));
15803
+ console.log(
15804
+ chalk12.yellow(
15805
+ `Current version: ${currentVersion} -> Latest version: ${latestVersion}`
15806
+ )
15807
+ );
15808
+ console.log(
15809
+ chalk12.yellow(
15810
+ "Please always use the latest version for best compatibility."
15811
+ )
15812
+ );
15813
+ console.log();
15814
+ console.log("Upgrading...");
15815
+ const success2 = await performUpgrade();
15816
+ if (success2) {
15817
+ console.log(chalk12.green(`Upgraded to ${latestVersion}`));
15818
+ console.log();
15819
+ console.log("To continue, run:");
15820
+ console.log(chalk12.cyan(` ${buildRerunCommand(prompt)}`));
15821
+ return true;
15822
+ }
15823
+ console.log();
15824
+ console.log(chalk12.red("Upgrade failed. Please run manually:"));
15825
+ console.log(chalk12.cyan(` npm install -g ${PACKAGE_NAME}@latest`));
15826
+ console.log();
15827
+ console.log("Then re-run:");
15828
+ console.log(chalk12.cyan(` ${buildRerunCommand(prompt)}`));
15829
+ return true;
15830
+ }
15831
+
15832
+ // src/commands/cook.ts
15735
15833
  var CONFIG_FILE3 = "vm0.yaml";
15736
15834
  var ARTIFACT_DIR = "artifact";
15737
15835
  function execVm0Command(args, options = {}) {
15738
15836
  return new Promise((resolve2, reject) => {
15739
- const proc = spawn("vm0", args, {
15837
+ const proc = spawn2("vm0", args, {
15740
15838
  cwd: options.cwd,
15741
15839
  stdio: options.silent ? "pipe" : ["inherit", "inherit", "inherit"],
15742
15840
  shell: process.platform === "win32"
@@ -15765,7 +15863,7 @@ function execVm0Command(args, options = {}) {
15765
15863
  }
15766
15864
  function execVm0RunWithCapture(args, options = {}) {
15767
15865
  return new Promise((resolve2, reject) => {
15768
- const proc = spawn("vm0", args, {
15866
+ const proc = spawn2("vm0", args, {
15769
15867
  cwd: options.cwd,
15770
15868
  stdio: ["inherit", "pipe", "pipe"],
15771
15869
  shell: process.platform === "win32"
@@ -15848,10 +15946,14 @@ async function generateEnvPlaceholders(missingVars, envFilePath) {
15848
15946
  }
15849
15947
  }
15850
15948
  var cookCommand = new Command11().name("cook").description("One-click agent preparation and execution from vm0.yaml").argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
15949
+ const shouldExit = await checkAndUpgrade("4.11.0", prompt);
15950
+ if (shouldExit) {
15951
+ process.exit(0);
15952
+ }
15851
15953
  const cwd = process.cwd();
15852
- console.log(chalk12.blue(`Reading config: ${CONFIG_FILE3}`));
15954
+ console.log(chalk13.blue(`Reading config: ${CONFIG_FILE3}`));
15853
15955
  if (!existsSync5(CONFIG_FILE3)) {
15854
- console.error(chalk12.red(`\u2717 Config file not found: ${CONFIG_FILE3}`));
15956
+ console.error(chalk13.red(`\u2717 Config file not found: ${CONFIG_FILE3}`));
15855
15957
  process.exit(1);
15856
15958
  }
15857
15959
  let config2;
@@ -15859,22 +15961,22 @@ var cookCommand = new Command11().name("cook").description("One-click agent prep
15859
15961
  const content = await readFile5(CONFIG_FILE3, "utf8");
15860
15962
  config2 = parseYaml3(content);
15861
15963
  } catch (error43) {
15862
- console.error(chalk12.red("\u2717 Invalid YAML format"));
15964
+ console.error(chalk13.red("\u2717 Invalid YAML format"));
15863
15965
  if (error43 instanceof Error) {
15864
- console.error(chalk12.gray(` ${error43.message}`));
15966
+ console.error(chalk13.gray(` ${error43.message}`));
15865
15967
  }
15866
15968
  process.exit(1);
15867
15969
  }
15868
15970
  const validation = validateAgentCompose(config2);
15869
15971
  if (!validation.valid) {
15870
- console.error(chalk12.red(`\u2717 ${validation.error}`));
15972
+ console.error(chalk13.red(`\u2717 ${validation.error}`));
15871
15973
  process.exit(1);
15872
15974
  }
15873
15975
  const agentNames = Object.keys(config2.agents);
15874
15976
  const agentName = agentNames[0];
15875
15977
  const volumeCount = config2.volumes ? Object.keys(config2.volumes).length : 0;
15876
15978
  console.log(
15877
- chalk12.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
15979
+ chalk13.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
15878
15980
  );
15879
15981
  const requiredVarNames = extractRequiredVarNames(config2);
15880
15982
  if (requiredVarNames.length > 0) {
@@ -15884,25 +15986,25 @@ var cookCommand = new Command11().name("cook").description("One-click agent prep
15884
15986
  await generateEnvPlaceholders(missingVars, envFilePath);
15885
15987
  console.log();
15886
15988
  console.log(
15887
- chalk12.yellow(
15989
+ chalk13.yellow(
15888
15990
  `\u26A0 Missing environment variables. Please fill in values in .env file:`
15889
15991
  )
15890
15992
  );
15891
15993
  for (const varName of missingVars) {
15892
- console.log(chalk12.yellow(` ${varName}`));
15994
+ console.log(chalk13.yellow(` ${varName}`));
15893
15995
  }
15894
15996
  process.exit(1);
15895
15997
  }
15896
15998
  }
15897
15999
  if (config2.volumes && Object.keys(config2.volumes).length > 0) {
15898
16000
  console.log();
15899
- console.log(chalk12.blue("Processing volumes..."));
16001
+ console.log(chalk13.blue("Processing volumes..."));
15900
16002
  for (const volumeConfig of Object.values(config2.volumes)) {
15901
16003
  const volumeDir = path12.join(cwd, volumeConfig.name);
15902
- console.log(chalk12.gray(` ${volumeConfig.name}/`));
16004
+ console.log(chalk13.gray(` ${volumeConfig.name}/`));
15903
16005
  if (!existsSync5(volumeDir)) {
15904
16006
  console.error(
15905
- chalk12.red(
16007
+ chalk13.red(
15906
16008
  ` \u2717 Directory not found. Create the directory and add files first.`
15907
16009
  )
15908
16010
  );
@@ -15915,30 +16017,30 @@ var cookCommand = new Command11().name("cook").description("One-click agent prep
15915
16017
  cwd: volumeDir,
15916
16018
  silent: true
15917
16019
  });
15918
- console.log(chalk12.green(` \u2713 Initialized`));
16020
+ console.log(chalk13.green(` \u2713 Initialized`));
15919
16021
  }
15920
16022
  await execVm0Command(["volume", "push"], {
15921
16023
  cwd: volumeDir,
15922
16024
  silent: true
15923
16025
  });
15924
- console.log(chalk12.green(` \u2713 Pushed`));
16026
+ console.log(chalk13.green(` \u2713 Pushed`));
15925
16027
  } catch (error43) {
15926
- console.error(chalk12.red(` \u2717 Failed`));
16028
+ console.error(chalk13.red(` \u2717 Failed`));
15927
16029
  if (error43 instanceof Error) {
15928
- console.error(chalk12.gray(` ${error43.message}`));
16030
+ console.error(chalk13.gray(` ${error43.message}`));
15929
16031
  }
15930
16032
  process.exit(1);
15931
16033
  }
15932
16034
  }
15933
16035
  }
15934
16036
  console.log();
15935
- console.log(chalk12.blue("Processing artifact..."));
16037
+ console.log(chalk13.blue("Processing artifact..."));
15936
16038
  const artifactDir = path12.join(cwd, ARTIFACT_DIR);
15937
- console.log(chalk12.gray(` ${ARTIFACT_DIR}/`));
16039
+ console.log(chalk13.gray(` ${ARTIFACT_DIR}/`));
15938
16040
  try {
15939
16041
  if (!existsSync5(artifactDir)) {
15940
16042
  await mkdir5(artifactDir, { recursive: true });
15941
- console.log(chalk12.green(` \u2713 Created directory`));
16043
+ console.log(chalk13.green(` \u2713 Created directory`));
15942
16044
  }
15943
16045
  const existingConfig = await readStorageConfig(artifactDir);
15944
16046
  if (!existingConfig) {
@@ -15946,38 +16048,38 @@ var cookCommand = new Command11().name("cook").description("One-click agent prep
15946
16048
  cwd: artifactDir,
15947
16049
  silent: true
15948
16050
  });
15949
- console.log(chalk12.green(` \u2713 Initialized`));
16051
+ console.log(chalk13.green(` \u2713 Initialized`));
15950
16052
  }
15951
16053
  await execVm0Command(["artifact", "push"], {
15952
16054
  cwd: artifactDir,
15953
16055
  silent: true
15954
16056
  });
15955
- console.log(chalk12.green(` \u2713 Pushed`));
16057
+ console.log(chalk13.green(` \u2713 Pushed`));
15956
16058
  } catch (error43) {
15957
- console.error(chalk12.red(` \u2717 Failed`));
16059
+ console.error(chalk13.red(` \u2717 Failed`));
15958
16060
  if (error43 instanceof Error) {
15959
- console.error(chalk12.gray(` ${error43.message}`));
16061
+ console.error(chalk13.gray(` ${error43.message}`));
15960
16062
  }
15961
16063
  process.exit(1);
15962
16064
  }
15963
16065
  console.log();
15964
- console.log(chalk12.blue("Uploading compose..."));
16066
+ console.log(chalk13.blue("Uploading compose..."));
15965
16067
  try {
15966
16068
  await execVm0Command(["compose", CONFIG_FILE3], {
15967
16069
  cwd,
15968
16070
  silent: true
15969
16071
  });
15970
- console.log(chalk12.green(`\u2713 Compose uploaded: ${agentName}`));
16072
+ console.log(chalk13.green(`\u2713 Compose uploaded: ${agentName}`));
15971
16073
  } catch (error43) {
15972
- console.error(chalk12.red(`\u2717 Compose failed`));
16074
+ console.error(chalk13.red(`\u2717 Compose failed`));
15973
16075
  if (error43 instanceof Error) {
15974
- console.error(chalk12.gray(` ${error43.message}`));
16076
+ console.error(chalk13.gray(` ${error43.message}`));
15975
16077
  }
15976
16078
  process.exit(1);
15977
16079
  }
15978
16080
  if (prompt) {
15979
16081
  console.log();
15980
- console.log(chalk12.blue(`Running agent: ${agentName}`));
16082
+ console.log(chalk13.blue(`Running agent: ${agentName}`));
15981
16083
  console.log();
15982
16084
  let runOutput;
15983
16085
  try {
@@ -15998,17 +16100,17 @@ var cookCommand = new Command11().name("cook").description("One-click agent prep
15998
16100
  );
15999
16101
  if (serverVersion) {
16000
16102
  console.log();
16001
- console.log(chalk12.blue("Pulling updated artifact..."));
16103
+ console.log(chalk13.blue("Pulling updated artifact..."));
16002
16104
  try {
16003
16105
  await execVm0Command(["artifact", "pull"], {
16004
16106
  cwd: artifactDir,
16005
16107
  silent: true
16006
16108
  });
16007
- console.log(chalk12.green(`\u2713 Artifact pulled (${serverVersion})`));
16109
+ console.log(chalk13.green(`\u2713 Artifact pulled (${serverVersion})`));
16008
16110
  } catch (error43) {
16009
- console.error(chalk12.red(`\u2717 Artifact pull failed`));
16111
+ console.error(chalk13.red(`\u2717 Artifact pull failed`));
16010
16112
  if (error43 instanceof Error) {
16011
- console.error(chalk12.gray(` ${error43.message}`));
16113
+ console.error(chalk13.gray(` ${error43.message}`));
16012
16114
  }
16013
16115
  }
16014
16116
  }
@@ -16016,7 +16118,7 @@ var cookCommand = new Command11().name("cook").description("One-click agent prep
16016
16118
  console.log();
16017
16119
  console.log(" Run your agent:");
16018
16120
  console.log(
16019
- chalk12.cyan(
16121
+ chalk13.cyan(
16020
16122
  ` vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "your prompt"`
16021
16123
  )
16022
16124
  );
@@ -16028,7 +16130,7 @@ import { Command as Command15 } from "commander";
16028
16130
 
16029
16131
  // src/commands/image/build.ts
16030
16132
  import { Command as Command12 } from "commander";
16031
- import chalk13 from "chalk";
16133
+ import chalk14 from "chalk";
16032
16134
  import { readFile as readFile6 } from "fs/promises";
16033
16135
  import { existsSync as existsSync6 } from "fs";
16034
16136
  var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
@@ -16036,13 +16138,13 @@ var buildCommand = new Command12().name("build").description("Build a custom ima
16036
16138
  async (options) => {
16037
16139
  const { file: file2, name, deleteExisting } = options;
16038
16140
  if (!existsSync6(file2)) {
16039
- console.error(chalk13.red(`\u2717 Dockerfile not found: ${file2}`));
16141
+ console.error(chalk14.red(`\u2717 Dockerfile not found: ${file2}`));
16040
16142
  process.exit(1);
16041
16143
  }
16042
16144
  const nameRegex = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,62}[a-zA-Z0-9]$/;
16043
16145
  if (!nameRegex.test(name)) {
16044
16146
  console.error(
16045
- chalk13.red(
16147
+ chalk14.red(
16046
16148
  "\u2717 Invalid name format. Must be 3-64 characters, letters, numbers, and hyphens only."
16047
16149
  )
16048
16150
  );
@@ -16050,7 +16152,7 @@ var buildCommand = new Command12().name("build").description("Build a custom ima
16050
16152
  }
16051
16153
  if (name.startsWith("vm0-")) {
16052
16154
  console.error(
16053
- chalk13.red(
16155
+ chalk14.red(
16054
16156
  '\u2717 Invalid name. Cannot start with "vm0-" (reserved prefix).'
16055
16157
  )
16056
16158
  );
@@ -16058,8 +16160,8 @@ var buildCommand = new Command12().name("build").description("Build a custom ima
16058
16160
  }
16059
16161
  try {
16060
16162
  const dockerfile = await readFile6(file2, "utf8");
16061
- console.log(chalk13.blue(`Building image: ${name}`));
16062
- console.log(chalk13.gray(` Dockerfile: ${file2}`));
16163
+ console.log(chalk14.blue(`Building image: ${name}`));
16164
+ console.log(chalk14.gray(` Dockerfile: ${file2}`));
16063
16165
  console.log();
16064
16166
  const buildInfo = await apiClient.createImage({
16065
16167
  dockerfile,
@@ -16067,7 +16169,7 @@ var buildCommand = new Command12().name("build").description("Build a custom ima
16067
16169
  deleteExisting
16068
16170
  });
16069
16171
  const { imageId, buildId } = buildInfo;
16070
- console.log(chalk13.gray(` Build ID: ${buildId}`));
16172
+ console.log(chalk14.gray(` Build ID: ${buildId}`));
16071
16173
  console.log();
16072
16174
  let logsOffset = 0;
16073
16175
  let status = "building";
@@ -16083,7 +16185,7 @@ var buildCommand = new Command12().name("build").description("Build a custom ima
16083
16185
  }
16084
16186
  const statusData = await statusResponse.json();
16085
16187
  for (const log of statusData.logs) {
16086
- console.log(chalk13.gray(` ${log}`));
16188
+ console.log(chalk14.gray(` ${log}`));
16087
16189
  }
16088
16190
  logsOffset = statusData.logsOffset;
16089
16191
  status = statusData.status;
@@ -16093,27 +16195,27 @@ var buildCommand = new Command12().name("build").description("Build a custom ima
16093
16195
  }
16094
16196
  console.log();
16095
16197
  if (status === "ready") {
16096
- console.log(chalk13.green(`\u2713 Image built: ${name}`));
16198
+ console.log(chalk14.green(`\u2713 Image built: ${name}`));
16097
16199
  console.log();
16098
16200
  console.log("Use in vm0.yaml:");
16099
- console.log(chalk13.cyan(` agents:`));
16100
- console.log(chalk13.cyan(` your-agent:`));
16101
- console.log(chalk13.cyan(` image: "${name}"`));
16201
+ console.log(chalk14.cyan(` agents:`));
16202
+ console.log(chalk14.cyan(` your-agent:`));
16203
+ console.log(chalk14.cyan(` image: "${name}"`));
16102
16204
  } else {
16103
- console.error(chalk13.red(`\u2717 Build failed`));
16205
+ console.error(chalk14.red(`\u2717 Build failed`));
16104
16206
  process.exit(1);
16105
16207
  }
16106
16208
  } catch (error43) {
16107
16209
  if (error43 instanceof Error) {
16108
16210
  if (error43.message.includes("Not authenticated")) {
16109
16211
  console.error(
16110
- chalk13.red("\u2717 Not authenticated. Run: vm0 auth login")
16212
+ chalk14.red("\u2717 Not authenticated. Run: vm0 auth login")
16111
16213
  );
16112
16214
  } else {
16113
- console.error(chalk13.red(`\u2717 ${error43.message}`));
16215
+ console.error(chalk14.red(`\u2717 ${error43.message}`));
16114
16216
  }
16115
16217
  } else {
16116
- console.error(chalk13.red("\u2717 An unexpected error occurred"));
16218
+ console.error(chalk14.red("\u2717 An unexpected error occurred"));
16117
16219
  }
16118
16220
  process.exit(1);
16119
16221
  }
@@ -16122,7 +16224,7 @@ var buildCommand = new Command12().name("build").description("Build a custom ima
16122
16224
 
16123
16225
  // src/commands/image/list.ts
16124
16226
  import { Command as Command13 } from "commander";
16125
- import chalk14 from "chalk";
16227
+ import chalk15 from "chalk";
16126
16228
  var listCommand = new Command13().name("list").alias("ls").description("List your custom images").action(async () => {
16127
16229
  try {
16128
16230
  const response = await apiClient.get("/api/images");
@@ -16135,43 +16237,43 @@ var listCommand = new Command13().name("list").alias("ls").description("List you
16135
16237
  const data = await response.json();
16136
16238
  const { images } = data;
16137
16239
  if (images.length === 0) {
16138
- console.log(chalk14.gray("No images found."));
16240
+ console.log(chalk15.gray("No images found."));
16139
16241
  console.log();
16140
16242
  console.log("Build your first image:");
16141
16243
  console.log(
16142
- chalk14.cyan(" vm0 image build --file Dockerfile --name my-image")
16244
+ chalk15.cyan(" vm0 image build --file Dockerfile --name my-image")
16143
16245
  );
16144
16246
  return;
16145
16247
  }
16146
- console.log(chalk14.bold("Your images:"));
16248
+ console.log(chalk15.bold("Your images:"));
16147
16249
  console.log();
16148
16250
  console.log(
16149
- chalk14.gray(
16251
+ chalk15.gray(
16150
16252
  `${"NAME".padEnd(30)} ${"STATUS".padEnd(12)} ${"CREATED".padEnd(20)}`
16151
16253
  )
16152
16254
  );
16153
- console.log(chalk14.gray("-".repeat(62)));
16255
+ console.log(chalk15.gray("-".repeat(62)));
16154
16256
  for (const image of images) {
16155
- const statusColor = image.status === "ready" ? chalk14.green : image.status === "building" ? chalk14.yellow : chalk14.red;
16257
+ const statusColor = image.status === "ready" ? chalk15.green : image.status === "building" ? chalk15.yellow : chalk15.red;
16156
16258
  const createdAt = new Date(image.createdAt).toLocaleString();
16157
16259
  console.log(
16158
16260
  `${image.alias.padEnd(30)} ${statusColor(image.status.padEnd(12))} ${createdAt.padEnd(20)}`
16159
16261
  );
16160
16262
  if (image.status === "error" && image.errorMessage) {
16161
- console.log(chalk14.red(` Error: ${image.errorMessage}`));
16263
+ console.log(chalk15.red(` Error: ${image.errorMessage}`));
16162
16264
  }
16163
16265
  }
16164
16266
  console.log();
16165
- console.log(chalk14.gray(`Total: ${images.length} image(s)`));
16267
+ console.log(chalk15.gray(`Total: ${images.length} image(s)`));
16166
16268
  } catch (error43) {
16167
16269
  if (error43 instanceof Error) {
16168
16270
  if (error43.message.includes("Not authenticated")) {
16169
- console.error(chalk14.red("Not authenticated. Run: vm0 auth login"));
16271
+ console.error(chalk15.red("Not authenticated. Run: vm0 auth login"));
16170
16272
  } else {
16171
- console.error(chalk14.red(`Error: ${error43.message}`));
16273
+ console.error(chalk15.red(`Error: ${error43.message}`));
16172
16274
  }
16173
16275
  } else {
16174
- console.error(chalk14.red("An unexpected error occurred"));
16276
+ console.error(chalk15.red("An unexpected error occurred"));
16175
16277
  }
16176
16278
  process.exit(1);
16177
16279
  }
@@ -16179,7 +16281,7 @@ var listCommand = new Command13().name("list").alias("ls").description("List you
16179
16281
 
16180
16282
  // src/commands/image/delete.ts
16181
16283
  import { Command as Command14 } from "commander";
16182
- import chalk15 from "chalk";
16284
+ import chalk16 from "chalk";
16183
16285
  import * as readline from "readline";
16184
16286
  var deleteCommand = new Command14().name("delete").alias("rm").description("Delete a custom image").argument("<name>", "Name of the image to delete").option("-f, --force", "Skip confirmation prompt").action(async (name, options) => {
16185
16287
  try {
@@ -16193,7 +16295,7 @@ var deleteCommand = new Command14().name("delete").alias("rm").description("Dele
16193
16295
  const data = await listResponse.json();
16194
16296
  const image = data.images.find((img) => img.alias === name);
16195
16297
  if (!image) {
16196
- console.error(chalk15.red(`Image not found: ${name}`));
16298
+ console.error(chalk16.red(`Image not found: ${name}`));
16197
16299
  process.exit(1);
16198
16300
  }
16199
16301
  if (!options.force) {
@@ -16203,7 +16305,7 @@ var deleteCommand = new Command14().name("delete").alias("rm").description("Dele
16203
16305
  });
16204
16306
  const answer = await new Promise((resolve2) => {
16205
16307
  rl.question(
16206
- chalk15.yellow(`Delete image "${name}"? [y/N] `),
16308
+ chalk16.yellow(`Delete image "${name}"? [y/N] `),
16207
16309
  (answer2) => {
16208
16310
  rl.close();
16209
16311
  resolve2(answer2);
@@ -16211,7 +16313,7 @@ var deleteCommand = new Command14().name("delete").alias("rm").description("Dele
16211
16313
  );
16212
16314
  });
16213
16315
  if (answer.toLowerCase() !== "y" && answer.toLowerCase() !== "yes") {
16214
- console.log(chalk15.gray("Cancelled."));
16316
+ console.log(chalk16.gray("Cancelled."));
16215
16317
  return;
16216
16318
  }
16217
16319
  }
@@ -16222,16 +16324,16 @@ var deleteCommand = new Command14().name("delete").alias("rm").description("Dele
16222
16324
  error43.error?.message || "Failed to delete image"
16223
16325
  );
16224
16326
  }
16225
- console.log(chalk15.green(`Deleted image: ${name}`));
16327
+ console.log(chalk16.green(`Deleted image: ${name}`));
16226
16328
  } catch (error43) {
16227
16329
  if (error43 instanceof Error) {
16228
16330
  if (error43.message.includes("Not authenticated")) {
16229
- console.error(chalk15.red("Not authenticated. Run: vm0 auth login"));
16331
+ console.error(chalk16.red("Not authenticated. Run: vm0 auth login"));
16230
16332
  } else {
16231
- console.error(chalk15.red(`Error: ${error43.message}`));
16333
+ console.error(chalk16.red(`Error: ${error43.message}`));
16232
16334
  }
16233
16335
  } else {
16234
- console.error(chalk15.red("An unexpected error occurred"));
16336
+ console.error(chalk16.red("An unexpected error occurred"));
16235
16337
  }
16236
16338
  process.exit(1);
16237
16339
  }
@@ -16242,7 +16344,7 @@ var imageCommand = new Command15().name("image").description("Manage custom imag
16242
16344
 
16243
16345
  // src/commands/logs/index.ts
16244
16346
  import { Command as Command16 } from "commander";
16245
- import chalk16 from "chalk";
16347
+ import chalk17 from "chalk";
16246
16348
 
16247
16349
  // src/lib/time-parser.ts
16248
16350
  function parseTime(timeStr) {
@@ -16304,23 +16406,23 @@ function formatMetric(metric) {
16304
16406
  function formatNetworkLog(entry) {
16305
16407
  let statusColor;
16306
16408
  if (entry.status >= 200 && entry.status < 300) {
16307
- statusColor = chalk16.green;
16409
+ statusColor = chalk17.green;
16308
16410
  } else if (entry.status >= 300 && entry.status < 400) {
16309
- statusColor = chalk16.yellow;
16411
+ statusColor = chalk17.yellow;
16310
16412
  } else if (entry.status >= 400) {
16311
- statusColor = chalk16.red;
16413
+ statusColor = chalk17.red;
16312
16414
  } else {
16313
- statusColor = chalk16.gray;
16415
+ statusColor = chalk17.gray;
16314
16416
  }
16315
16417
  let latencyColor;
16316
16418
  if (entry.latency_ms < 500) {
16317
- latencyColor = chalk16.green;
16419
+ latencyColor = chalk17.green;
16318
16420
  } else if (entry.latency_ms < 2e3) {
16319
- latencyColor = chalk16.yellow;
16421
+ latencyColor = chalk17.yellow;
16320
16422
  } else {
16321
- latencyColor = chalk16.red;
16423
+ latencyColor = chalk17.red;
16322
16424
  }
16323
- return `[${entry.timestamp}] ${chalk16.cyan(entry.method.padEnd(6))} ${statusColor(entry.status)} ${latencyColor(entry.latency_ms + "ms")} ${formatBytes5(entry.request_size)}/${formatBytes5(entry.response_size)} ${chalk16.gray(entry.url)}`;
16425
+ return `[${entry.timestamp}] ${chalk17.cyan(entry.method.padEnd(6))} ${statusColor(entry.status)} ${latencyColor(entry.latency_ms + "ms")} ${formatBytes5(entry.request_size)}/${formatBytes5(entry.response_size)} ${chalk17.gray(entry.url)}`;
16324
16426
  }
16325
16427
  function renderAgentEvent(event) {
16326
16428
  const parsed = ClaudeEventParser.parse(
@@ -16340,7 +16442,7 @@ function getLogType(options) {
16340
16442
  ].filter(Boolean).length;
16341
16443
  if (selected > 1) {
16342
16444
  console.error(
16343
- chalk16.red(
16445
+ chalk17.red(
16344
16446
  "Options --agent, --system, --metrics, and --network are mutually exclusive"
16345
16447
  )
16346
16448
  );
@@ -16393,7 +16495,7 @@ var logsCommand = new Command16().name("logs").description("View logs for an age
16393
16495
  async function showAgentEvents(runId, options) {
16394
16496
  const response = await apiClient.getAgentEvents(runId, options);
16395
16497
  if (response.events.length === 0) {
16396
- console.log(chalk16.yellow("No agent events found for this run."));
16498
+ console.log(chalk17.yellow("No agent events found for this run."));
16397
16499
  return;
16398
16500
  }
16399
16501
  for (const event of response.events) {
@@ -16402,7 +16504,7 @@ async function showAgentEvents(runId, options) {
16402
16504
  if (response.hasMore) {
16403
16505
  console.log();
16404
16506
  console.log(
16405
- chalk16.gray(
16507
+ chalk17.gray(
16406
16508
  `Showing ${response.events.length} events. Use --limit to see more.`
16407
16509
  )
16408
16510
  );
@@ -16411,21 +16513,21 @@ async function showAgentEvents(runId, options) {
16411
16513
  async function showSystemLog(runId, options) {
16412
16514
  const response = await apiClient.getSystemLog(runId, options);
16413
16515
  if (!response.systemLog) {
16414
- console.log(chalk16.yellow("No system log found for this run."));
16516
+ console.log(chalk17.yellow("No system log found for this run."));
16415
16517
  return;
16416
16518
  }
16417
16519
  console.log(response.systemLog);
16418
16520
  if (response.hasMore) {
16419
16521
  console.log();
16420
16522
  console.log(
16421
- chalk16.gray("More log entries available. Use --limit to see more.")
16523
+ chalk17.gray("More log entries available. Use --limit to see more.")
16422
16524
  );
16423
16525
  }
16424
16526
  }
16425
16527
  async function showMetrics(runId, options) {
16426
16528
  const response = await apiClient.getMetrics(runId, options);
16427
16529
  if (response.metrics.length === 0) {
16428
- console.log(chalk16.yellow("No metrics found for this run."));
16530
+ console.log(chalk17.yellow("No metrics found for this run."));
16429
16531
  return;
16430
16532
  }
16431
16533
  for (const metric of response.metrics) {
@@ -16434,7 +16536,7 @@ async function showMetrics(runId, options) {
16434
16536
  if (response.hasMore) {
16435
16537
  console.log();
16436
16538
  console.log(
16437
- chalk16.gray(
16539
+ chalk17.gray(
16438
16540
  `Showing ${response.metrics.length} metrics. Use --limit to see more.`
16439
16541
  )
16440
16542
  );
@@ -16444,7 +16546,7 @@ async function showNetworkLogs(runId, options) {
16444
16546
  const response = await apiClient.getNetworkLogs(runId, options);
16445
16547
  if (response.networkLogs.length === 0) {
16446
16548
  console.log(
16447
- chalk16.yellow(
16549
+ chalk17.yellow(
16448
16550
  "No network logs found for this run. Network logs are only captured when beta_network_security is enabled."
16449
16551
  )
16450
16552
  );
@@ -16456,7 +16558,7 @@ async function showNetworkLogs(runId, options) {
16456
16558
  if (response.hasMore) {
16457
16559
  console.log();
16458
16560
  console.log(
16459
- chalk16.gray(
16561
+ chalk17.gray(
16460
16562
  `Showing ${response.networkLogs.length} network logs. Use --limit to see more.`
16461
16563
  )
16462
16564
  );
@@ -16465,25 +16567,25 @@ async function showNetworkLogs(runId, options) {
16465
16567
  function handleError(error43, runId) {
16466
16568
  if (error43 instanceof Error) {
16467
16569
  if (error43.message.includes("Not authenticated")) {
16468
- console.error(chalk16.red("Not authenticated. Run: vm0 auth login"));
16570
+ console.error(chalk17.red("Not authenticated. Run: vm0 auth login"));
16469
16571
  } else if (error43.message.includes("not found")) {
16470
- console.error(chalk16.red(`Run not found: ${runId}`));
16572
+ console.error(chalk17.red(`Run not found: ${runId}`));
16471
16573
  } else if (error43.message.includes("Invalid time format")) {
16472
- console.error(chalk16.red(error43.message));
16574
+ console.error(chalk17.red(error43.message));
16473
16575
  } else {
16474
- console.error(chalk16.red("Failed to fetch logs"));
16475
- console.error(chalk16.gray(` ${error43.message}`));
16576
+ console.error(chalk17.red("Failed to fetch logs"));
16577
+ console.error(chalk17.gray(` ${error43.message}`));
16476
16578
  }
16477
16579
  } else {
16478
- console.error(chalk16.red("An unexpected error occurred"));
16580
+ console.error(chalk17.red("An unexpected error occurred"));
16479
16581
  }
16480
16582
  }
16481
16583
 
16482
16584
  // src/index.ts
16483
16585
  var program = new Command17();
16484
- program.name("vm0").description("VM0 CLI - A modern build tool").version("4.10.0");
16586
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("4.11.0");
16485
16587
  program.command("info").description("Display environment information").action(async () => {
16486
- console.log(chalk17.cyan("System Information:"));
16588
+ console.log(chalk18.cyan("System Information:"));
16487
16589
  console.log(`Node Version: ${process.version}`);
16488
16590
  console.log(`Platform: ${process.platform}`);
16489
16591
  console.log(`Architecture: ${process.arch}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",