@vm0/cli 2.0.0 → 3.0.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 +30 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12488,44 +12488,56 @@ function validateAgentConfig(config2) {
|
|
|
12488
12488
|
if (!cfg.version) {
|
|
12489
12489
|
return { valid: false, error: "Missing config.version" };
|
|
12490
12490
|
}
|
|
12491
|
-
if (!cfg.agents ||
|
|
12492
|
-
return { valid: false, error: "Missing
|
|
12491
|
+
if (!cfg.agents || typeof cfg.agents !== "object") {
|
|
12492
|
+
return { valid: false, error: "Missing agents object in config" };
|
|
12493
12493
|
}
|
|
12494
|
-
if (cfg.agents
|
|
12495
|
-
return {
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
return { valid: false, error: "First agent must be an object" };
|
|
12494
|
+
if (Array.isArray(cfg.agents)) {
|
|
12495
|
+
return {
|
|
12496
|
+
valid: false,
|
|
12497
|
+
error: "agents must be an object, not an array. Use format: agents: { agent-name: { ... } }"
|
|
12498
|
+
};
|
|
12500
12499
|
}
|
|
12501
|
-
|
|
12502
|
-
|
|
12500
|
+
const agentKeys = Object.keys(cfg.agents);
|
|
12501
|
+
if (agentKeys.length === 0) {
|
|
12502
|
+
return {
|
|
12503
|
+
valid: false,
|
|
12504
|
+
error: "agents must have at least one agent defined"
|
|
12505
|
+
};
|
|
12503
12506
|
}
|
|
12504
|
-
if (
|
|
12505
|
-
return {
|
|
12507
|
+
if (agentKeys.length > 1) {
|
|
12508
|
+
return {
|
|
12509
|
+
valid: false,
|
|
12510
|
+
error: "Multiple agents not supported yet. Only one agent allowed."
|
|
12511
|
+
};
|
|
12506
12512
|
}
|
|
12507
|
-
|
|
12513
|
+
const agentName = agentKeys[0];
|
|
12514
|
+
if (!validateAgentName(agentName)) {
|
|
12508
12515
|
return {
|
|
12509
12516
|
valid: false,
|
|
12510
|
-
error: "Invalid
|
|
12517
|
+
error: "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number."
|
|
12511
12518
|
};
|
|
12512
12519
|
}
|
|
12520
|
+
const agentsObj = cfg.agents;
|
|
12521
|
+
const agent = agentsObj[agentName];
|
|
12522
|
+
if (!agent || typeof agent !== "object") {
|
|
12523
|
+
return { valid: false, error: "Agent definition must be an object" };
|
|
12524
|
+
}
|
|
12513
12525
|
if (!agent.working_dir || typeof agent.working_dir !== "string") {
|
|
12514
12526
|
return {
|
|
12515
12527
|
valid: false,
|
|
12516
|
-
error: "Missing or invalid
|
|
12528
|
+
error: "Missing or invalid agent.working_dir (must be a string)"
|
|
12517
12529
|
};
|
|
12518
12530
|
}
|
|
12519
12531
|
if (!agent.image || typeof agent.image !== "string") {
|
|
12520
12532
|
return {
|
|
12521
12533
|
valid: false,
|
|
12522
|
-
error: "Missing or invalid
|
|
12534
|
+
error: "Missing or invalid agent.image (must be a string)"
|
|
12523
12535
|
};
|
|
12524
12536
|
}
|
|
12525
12537
|
if (!agent.provider || typeof agent.provider !== "string") {
|
|
12526
12538
|
return {
|
|
12527
12539
|
valid: false,
|
|
12528
|
-
error: "Missing or invalid
|
|
12540
|
+
error: "Missing or invalid agent.provider (must be a string)"
|
|
12529
12541
|
};
|
|
12530
12542
|
}
|
|
12531
12543
|
const agentVolumes = agent.volumes;
|
|
@@ -14047,7 +14059,7 @@ var artifactCommand = new Command10().name("artifact").description("Manage cloud
|
|
|
14047
14059
|
|
|
14048
14060
|
// src/index.ts
|
|
14049
14061
|
var program = new Command11();
|
|
14050
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("
|
|
14062
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("3.0.0");
|
|
14051
14063
|
program.command("hello").description("Say hello from the App").action(() => {
|
|
14052
14064
|
console.log(chalk11.blue("Welcome to the VM0 CLI!"));
|
|
14053
14065
|
console.log(chalk11.green(`Core says: ${FOO}`));
|