@vm0/cli 4.22.0 → 4.23.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 +34 -26
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16515,6 +16515,9 @@ async function checkAndUpgrade(currentVersion, prompt) {
|
|
|
16515
16515
|
// src/commands/cook.ts
|
|
16516
16516
|
var CONFIG_FILE3 = "vm0.yaml";
|
|
16517
16517
|
var ARTIFACT_DIR = "artifact";
|
|
16518
|
+
function printCommand(cmd) {
|
|
16519
|
+
console.log(chalk16.dim(`> ${cmd}`));
|
|
16520
|
+
}
|
|
16518
16521
|
function execVm0Command(args, options = {}) {
|
|
16519
16522
|
return new Promise((resolve2, reject) => {
|
|
16520
16523
|
const proc = spawn2("vm0", args, {
|
|
@@ -16629,7 +16632,7 @@ async function generateEnvPlaceholders(missingVars, envFilePath) {
|
|
|
16629
16632
|
}
|
|
16630
16633
|
}
|
|
16631
16634
|
var cookCommand = new Command13().name("cook").description("One-click agent preparation and execution from vm0.yaml").argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
16632
|
-
const shouldExit = await checkAndUpgrade("4.
|
|
16635
|
+
const shouldExit = await checkAndUpgrade("4.23.0", prompt);
|
|
16633
16636
|
if (shouldExit) {
|
|
16634
16637
|
process.exit(0);
|
|
16635
16638
|
}
|
|
@@ -16681,78 +16684,80 @@ var cookCommand = new Command13().name("cook").description("One-click agent prep
|
|
|
16681
16684
|
}
|
|
16682
16685
|
if (config2.volumes && Object.keys(config2.volumes).length > 0) {
|
|
16683
16686
|
console.log();
|
|
16684
|
-
console.log(chalk16.blue("Processing volumes
|
|
16687
|
+
console.log(chalk16.blue("Processing volumes:"));
|
|
16685
16688
|
for (const volumeConfig of Object.values(config2.volumes)) {
|
|
16686
16689
|
const volumeDir = path11.join(cwd, volumeConfig.name);
|
|
16687
|
-
console.log(chalk16.gray(` ${volumeConfig.name}/`));
|
|
16688
16690
|
if (!existsSync6(volumeDir)) {
|
|
16689
16691
|
console.error(
|
|
16690
16692
|
chalk16.red(
|
|
16691
|
-
|
|
16693
|
+
`\u2717 Directory not found: ${volumeConfig.name}. Create the directory and add files first.`
|
|
16692
16694
|
)
|
|
16693
16695
|
);
|
|
16694
16696
|
process.exit(1);
|
|
16695
16697
|
}
|
|
16696
16698
|
try {
|
|
16699
|
+
printCommand(`cd ${volumeConfig.name}`);
|
|
16697
16700
|
const existingConfig = await readStorageConfig(volumeDir);
|
|
16698
16701
|
if (!existingConfig) {
|
|
16702
|
+
printCommand("vm0 volume init");
|
|
16699
16703
|
await execVm0Command(["volume", "init"], {
|
|
16700
16704
|
cwd: volumeDir,
|
|
16701
16705
|
silent: true
|
|
16702
16706
|
});
|
|
16703
|
-
console.log(chalk16.green(` \u2713 Initialized`));
|
|
16704
16707
|
}
|
|
16708
|
+
printCommand("vm0 volume push");
|
|
16705
16709
|
await execVm0Command(["volume", "push"], {
|
|
16706
16710
|
cwd: volumeDir,
|
|
16707
16711
|
silent: true
|
|
16708
16712
|
});
|
|
16709
|
-
|
|
16713
|
+
printCommand("cd ..");
|
|
16710
16714
|
} catch (error43) {
|
|
16711
|
-
console.error(chalk16.red(
|
|
16715
|
+
console.error(chalk16.red(`\u2717 Failed`));
|
|
16712
16716
|
if (error43 instanceof Error) {
|
|
16713
|
-
console.error(chalk16.gray(`
|
|
16717
|
+
console.error(chalk16.gray(` ${error43.message}`));
|
|
16714
16718
|
}
|
|
16715
16719
|
process.exit(1);
|
|
16716
16720
|
}
|
|
16717
16721
|
}
|
|
16718
16722
|
}
|
|
16719
16723
|
console.log();
|
|
16720
|
-
console.log(chalk16.blue("Processing artifact
|
|
16724
|
+
console.log(chalk16.blue("Processing artifact:"));
|
|
16721
16725
|
const artifactDir = path11.join(cwd, ARTIFACT_DIR);
|
|
16722
|
-
console.log(chalk16.gray(` ${ARTIFACT_DIR}/`));
|
|
16723
16726
|
try {
|
|
16724
16727
|
if (!existsSync6(artifactDir)) {
|
|
16728
|
+
printCommand(`mkdir ${ARTIFACT_DIR}`);
|
|
16725
16729
|
await mkdir5(artifactDir, { recursive: true });
|
|
16726
|
-
console.log(chalk16.green(` \u2713 Created directory`));
|
|
16727
16730
|
}
|
|
16731
|
+
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
16728
16732
|
const existingConfig = await readStorageConfig(artifactDir);
|
|
16729
16733
|
if (!existingConfig) {
|
|
16734
|
+
printCommand("vm0 artifact init");
|
|
16730
16735
|
await execVm0Command(["artifact", "init"], {
|
|
16731
16736
|
cwd: artifactDir,
|
|
16732
16737
|
silent: true
|
|
16733
16738
|
});
|
|
16734
|
-
console.log(chalk16.green(` \u2713 Initialized`));
|
|
16735
16739
|
}
|
|
16740
|
+
printCommand("vm0 artifact push");
|
|
16736
16741
|
await execVm0Command(["artifact", "push"], {
|
|
16737
16742
|
cwd: artifactDir,
|
|
16738
16743
|
silent: true
|
|
16739
16744
|
});
|
|
16740
|
-
|
|
16745
|
+
printCommand("cd ..");
|
|
16741
16746
|
} catch (error43) {
|
|
16742
|
-
console.error(chalk16.red(
|
|
16747
|
+
console.error(chalk16.red(`\u2717 Failed`));
|
|
16743
16748
|
if (error43 instanceof Error) {
|
|
16744
|
-
console.error(chalk16.gray(`
|
|
16749
|
+
console.error(chalk16.gray(` ${error43.message}`));
|
|
16745
16750
|
}
|
|
16746
16751
|
process.exit(1);
|
|
16747
16752
|
}
|
|
16748
16753
|
console.log();
|
|
16749
|
-
console.log(chalk16.blue("
|
|
16754
|
+
console.log(chalk16.blue("Composing agent:"));
|
|
16755
|
+
printCommand(`vm0 compose ${CONFIG_FILE3}`);
|
|
16750
16756
|
try {
|
|
16751
16757
|
await execVm0Command(["compose", CONFIG_FILE3], {
|
|
16752
16758
|
cwd,
|
|
16753
16759
|
silent: true
|
|
16754
16760
|
});
|
|
16755
|
-
console.log(chalk16.green(`\u2713 Compose uploaded: ${agentName}`));
|
|
16756
16761
|
} catch (error43) {
|
|
16757
16762
|
console.error(chalk16.red(`\u2717 Compose failed`));
|
|
16758
16763
|
if (error43 instanceof Error) {
|
|
@@ -16762,7 +16767,10 @@ var cookCommand = new Command13().name("cook").description("One-click agent prep
|
|
|
16762
16767
|
}
|
|
16763
16768
|
if (prompt) {
|
|
16764
16769
|
console.log();
|
|
16765
|
-
console.log(chalk16.blue(
|
|
16770
|
+
console.log(chalk16.blue("Running agent:"));
|
|
16771
|
+
printCommand(
|
|
16772
|
+
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
|
|
16773
|
+
);
|
|
16766
16774
|
console.log();
|
|
16767
16775
|
let runOutput;
|
|
16768
16776
|
try {
|
|
@@ -16783,13 +16791,15 @@ var cookCommand = new Command13().name("cook").description("One-click agent prep
|
|
|
16783
16791
|
);
|
|
16784
16792
|
if (serverVersion) {
|
|
16785
16793
|
console.log();
|
|
16786
|
-
console.log(chalk16.blue("Pulling updated artifact
|
|
16794
|
+
console.log(chalk16.blue("Pulling updated artifact:"));
|
|
16795
|
+
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
16796
|
+
printCommand(`vm0 artifact pull ${serverVersion}`);
|
|
16787
16797
|
try {
|
|
16788
16798
|
await execVm0Command(["artifact", "pull", serverVersion], {
|
|
16789
16799
|
cwd: artifactDir,
|
|
16790
16800
|
silent: true
|
|
16791
16801
|
});
|
|
16792
|
-
|
|
16802
|
+
printCommand("cd ..");
|
|
16793
16803
|
} catch (error43) {
|
|
16794
16804
|
console.error(chalk16.red(`\u2717 Artifact pull failed`));
|
|
16795
16805
|
if (error43 instanceof Error) {
|
|
@@ -16799,11 +16809,9 @@ var cookCommand = new Command13().name("cook").description("One-click agent prep
|
|
|
16799
16809
|
}
|
|
16800
16810
|
} else {
|
|
16801
16811
|
console.log();
|
|
16802
|
-
console.log("
|
|
16803
|
-
|
|
16804
|
-
|
|
16805
|
-
` vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "your prompt"`
|
|
16806
|
-
)
|
|
16812
|
+
console.log("To run your agent:");
|
|
16813
|
+
printCommand(
|
|
16814
|
+
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "your prompt"`
|
|
16807
16815
|
);
|
|
16808
16816
|
}
|
|
16809
16817
|
});
|
|
@@ -17567,7 +17575,7 @@ var scopeCommand = new Command22().name("scope").description("Manage your scope
|
|
|
17567
17575
|
|
|
17568
17576
|
// src/index.ts
|
|
17569
17577
|
var program = new Command23();
|
|
17570
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.
|
|
17578
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.23.0");
|
|
17571
17579
|
program.command("info").description("Display environment information").action(async () => {
|
|
17572
17580
|
console.log(chalk24.cyan("System Information:"));
|
|
17573
17581
|
console.log(`Node Version: ${process.version}`);
|