@vm0/cli 9.30.1 → 9.31.1

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 +91 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -45,7 +45,7 @@ if (DSN) {
45
45
  Sentry.init({
46
46
  dsn: DSN,
47
47
  environment: process.env.SENTRY_ENVIRONMENT ?? "production",
48
- release: "9.30.1",
48
+ release: "9.31.1",
49
49
  sendDefaultPii: false,
50
50
  tracesSampleRate: 0,
51
51
  shutdownTimeout: 500,
@@ -64,7 +64,7 @@ if (DSN) {
64
64
  }
65
65
  });
66
66
  Sentry.setContext("cli", {
67
- version: "9.30.1",
67
+ version: "9.31.1",
68
68
  command: process.argv.slice(2).join(" ")
69
69
  });
70
70
  Sentry.setContext("runtime", {
@@ -605,7 +605,7 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
605
605
  // src/commands/info/index.ts
606
606
  var CONFIG_PATH = join2(homedir2(), ".vm0", "config.json");
607
607
  var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
608
- console.log(chalk7.bold(`VM0 CLI v${"9.30.1"}`));
608
+ console.log(chalk7.bold(`VM0 CLI v${"9.31.1"}`));
609
609
  console.log();
610
610
  const config = await loadConfig();
611
611
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -3558,6 +3558,9 @@ var CONNECTOR_TYPES = {
3558
3558
  }
3559
3559
  };
3560
3560
  var connectorTypeSchema = z23.enum(["github"]);
3561
+ function getConnectorEnvironmentMapping(type2) {
3562
+ return CONNECTOR_TYPES[type2].environmentMapping;
3563
+ }
3561
3564
  function getConnectorDerivedNames(secretName) {
3562
3565
  const allTypes = Object.keys(CONNECTOR_TYPES);
3563
3566
  for (const type2 of allTypes) {
@@ -3581,6 +3584,20 @@ function getConnectorDerivedNames(secretName) {
3581
3584
  }
3582
3585
  return null;
3583
3586
  }
3587
+ function getConnectorProvidedSecretNames(connectedTypes) {
3588
+ const provided = /* @__PURE__ */ new Set();
3589
+ for (const rawType of connectedTypes) {
3590
+ const parsed = connectorTypeSchema.safeParse(rawType);
3591
+ if (!parsed.success) {
3592
+ continue;
3593
+ }
3594
+ const mapping = getConnectorEnvironmentMapping(parsed.data);
3595
+ for (const envVar of Object.keys(mapping)) {
3596
+ provided.add(envVar);
3597
+ }
3598
+ }
3599
+ return provided;
3600
+ }
3584
3601
  var connectorResponseSchema = z23.object({
3585
3602
  id: z23.string().uuid(),
3586
3603
  type: connectorTypeSchema,
@@ -5724,6 +5741,11 @@ function getSecretsFromComposeContent(content) {
5724
5741
  const grouped = groupVariablesBySource(refs);
5725
5742
  return new Set(grouped.secrets.map((r) => r.name));
5726
5743
  }
5744
+ function getVarsFromComposeContent(content) {
5745
+ const refs = extractVariableReferences(content);
5746
+ const grouped = groupVariablesBySource(refs);
5747
+ return new Set(grouped.vars.map((r) => r.name));
5748
+ }
5727
5749
  async function loadAndValidateConfig(configFile, jsonMode) {
5728
5750
  if (!existsSync5(configFile)) {
5729
5751
  if (jsonMode) {
@@ -5946,6 +5968,62 @@ function mergeSkillVariables(agent, variables) {
5946
5968
  agent.environment = environment;
5947
5969
  }
5948
5970
  }
5971
+ function getPlatformUrl(apiUrl) {
5972
+ const url = new URL(apiUrl);
5973
+ url.hostname = url.hostname.replace("www", "platform");
5974
+ return url.origin;
5975
+ }
5976
+ async function checkAndPromptMissingItems(config, options) {
5977
+ const requiredSecrets = getSecretsFromComposeContent(config);
5978
+ const requiredVars = getVarsFromComposeContent(config);
5979
+ if (requiredSecrets.size === 0 && requiredVars.size === 0) {
5980
+ return { missingSecrets: [], missingVars: [] };
5981
+ }
5982
+ const [secretsResponse, variablesResponse, connectorsResponse] = await Promise.all([
5983
+ requiredSecrets.size > 0 ? listSecrets() : { secrets: [] },
5984
+ requiredVars.size > 0 ? listVariables() : { variables: [] },
5985
+ listConnectors()
5986
+ ]);
5987
+ const existingSecretNames = new Set(
5988
+ secretsResponse.secrets.map((s) => s.name)
5989
+ );
5990
+ const existingVarNames = new Set(
5991
+ variablesResponse.variables.map((v) => v.name)
5992
+ );
5993
+ const connectorProvided = getConnectorProvidedSecretNames(
5994
+ connectorsResponse.connectors.map((c24) => c24.type)
5995
+ );
5996
+ const missingSecrets = [...requiredSecrets].filter(
5997
+ (name) => !existingSecretNames.has(name) && !connectorProvided.has(name)
5998
+ );
5999
+ const missingVars = [...requiredVars].filter(
6000
+ (name) => !existingVarNames.has(name)
6001
+ );
6002
+ if (missingSecrets.length === 0 && missingVars.length === 0) {
6003
+ return { missingSecrets: [], missingVars: [] };
6004
+ }
6005
+ const apiUrl = await getApiUrl();
6006
+ const platformUrl = getPlatformUrl(apiUrl);
6007
+ const params = new URLSearchParams();
6008
+ if (missingSecrets.length > 0) {
6009
+ params.set("secrets", missingSecrets.join(","));
6010
+ }
6011
+ if (missingVars.length > 0) {
6012
+ params.set("vars", missingVars.join(","));
6013
+ }
6014
+ const setupUrl = `${platformUrl}/environment-variables-setup?${params.toString()}`;
6015
+ if (!options.json) {
6016
+ console.log();
6017
+ console.log(
6018
+ chalk8.yellow(
6019
+ "\u26A0 Missing secrets/variables detected. Set them up before running your agent:"
6020
+ )
6021
+ );
6022
+ console.log(chalk8.cyan(` ${setupUrl}`));
6023
+ console.log();
6024
+ }
6025
+ return { missingSecrets, missingVars, setupUrl };
6026
+ }
5949
6027
  async function finalizeCompose(config, agent, variables, options) {
5950
6028
  const confirmed = await displayAndConfirmVariables(variables, options);
5951
6029
  if (!confirmed) {
@@ -5966,6 +6044,12 @@ async function finalizeCompose(config, agent, variables, options) {
5966
6044
  action: response.action,
5967
6045
  displayName
5968
6046
  };
6047
+ const missingItems = await checkAndPromptMissingItems(config, options);
6048
+ if (missingItems.missingSecrets.length > 0 || missingItems.missingVars.length > 0) {
6049
+ result.missingSecrets = missingItems.missingSecrets;
6050
+ result.missingVars = missingItems.missingVars;
6051
+ result.setupUrl = missingItems.setupUrl;
6052
+ }
5969
6053
  if (!options.json) {
5970
6054
  if (response.action === "created") {
5971
6055
  console.log(chalk8.green(`\u2713 Compose created: ${displayName}`));
@@ -6118,7 +6202,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
6118
6202
  options.autoUpdate = false;
6119
6203
  }
6120
6204
  if (options.autoUpdate !== false) {
6121
- await startSilentUpgrade("9.30.1");
6205
+ await startSilentUpgrade("9.31.1");
6122
6206
  }
6123
6207
  try {
6124
6208
  let result;
@@ -8315,7 +8399,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
8315
8399
  async (identifier, prompt, options) => {
8316
8400
  try {
8317
8401
  if (options.autoUpdate !== false) {
8318
- await startSilentUpgrade("9.30.1");
8402
+ await startSilentUpgrade("9.31.1");
8319
8403
  }
8320
8404
  const { scope, name, version } = parseIdentifier(identifier);
8321
8405
  if (scope && !options.experimentalSharedAgent) {
@@ -9888,7 +9972,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
9888
9972
  ).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(
9889
9973
  async (prompt, options) => {
9890
9974
  if (options.autoUpdate !== false) {
9891
- const shouldExit = await checkAndUpgrade("9.30.1", prompt);
9975
+ const shouldExit = await checkAndUpgrade("9.31.1", prompt);
9892
9976
  if (shouldExit) {
9893
9977
  process.exit(0);
9894
9978
  }
@@ -14304,7 +14388,7 @@ var devToolCommand = new Command75().name("dev-tool").description("Developer too
14304
14388
 
14305
14389
  // src/index.ts
14306
14390
  var program = new Command76();
14307
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.30.1");
14391
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.31.1");
14308
14392
  program.addCommand(authCommand);
14309
14393
  program.addCommand(infoCommand);
14310
14394
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.30.1",
3
+ "version": "9.31.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",