@vm0/cli 5.6.0 → 5.7.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 +121 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -6472,7 +6472,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
6472
6472
|
}
|
|
6473
6473
|
var cookCmd = new Command17().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
6474
6474
|
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").action(async (prompt, options) => {
|
|
6475
|
-
const shouldExit = await checkAndUpgrade("5.
|
|
6475
|
+
const shouldExit = await checkAndUpgrade("5.7.0", prompt);
|
|
6476
6476
|
if (shouldExit) {
|
|
6477
6477
|
process.exit(0);
|
|
6478
6478
|
}
|
|
@@ -8048,6 +8048,7 @@ import { stringify as stringifyYaml2 } from "yaml";
|
|
|
8048
8048
|
import { existsSync as existsSync11, readFileSync as readFileSync2 } from "fs";
|
|
8049
8049
|
import { parse as parseYaml6 } from "yaml";
|
|
8050
8050
|
var CONFIG_FILE4 = "vm0.yaml";
|
|
8051
|
+
var SCHEDULE_FILE = "schedule.yaml";
|
|
8051
8052
|
function loadAgentName() {
|
|
8052
8053
|
if (!existsSync11(CONFIG_FILE4)) {
|
|
8053
8054
|
return { agentName: null };
|
|
@@ -8064,6 +8065,28 @@ function loadAgentName() {
|
|
|
8064
8065
|
};
|
|
8065
8066
|
}
|
|
8066
8067
|
}
|
|
8068
|
+
function loadScheduleName() {
|
|
8069
|
+
if (!existsSync11(SCHEDULE_FILE)) {
|
|
8070
|
+
return { scheduleName: null };
|
|
8071
|
+
}
|
|
8072
|
+
try {
|
|
8073
|
+
const content = readFileSync2(SCHEDULE_FILE, "utf8");
|
|
8074
|
+
const parsed = parseYaml6(content);
|
|
8075
|
+
if (!parsed?.schedules) {
|
|
8076
|
+
return {
|
|
8077
|
+
scheduleName: null,
|
|
8078
|
+
error: "No schedules defined in schedule.yaml"
|
|
8079
|
+
};
|
|
8080
|
+
}
|
|
8081
|
+
const scheduleNames = Object.keys(parsed.schedules);
|
|
8082
|
+
return { scheduleName: scheduleNames[0] || null };
|
|
8083
|
+
} catch (err) {
|
|
8084
|
+
return {
|
|
8085
|
+
scheduleName: null,
|
|
8086
|
+
error: err instanceof Error ? err.message : "Failed to parse schedule.yaml"
|
|
8087
|
+
};
|
|
8088
|
+
}
|
|
8089
|
+
}
|
|
8067
8090
|
function formatRelativeTime2(dateStr) {
|
|
8068
8091
|
if (!dateStr) return "-";
|
|
8069
8092
|
const date = new Date(dateStr);
|
|
@@ -8216,7 +8239,7 @@ function toISODateTime(dateTimeStr) {
|
|
|
8216
8239
|
}
|
|
8217
8240
|
|
|
8218
8241
|
// src/commands/schedule/init.ts
|
|
8219
|
-
var
|
|
8242
|
+
var SCHEDULE_FILE2 = "schedule.yaml";
|
|
8220
8243
|
var FREQUENCY_CHOICES = [
|
|
8221
8244
|
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
8222
8245
|
{
|
|
@@ -8279,7 +8302,7 @@ var initCommand4 = new Command27().name("init").description("Create a schedule.y
|
|
|
8279
8302
|
);
|
|
8280
8303
|
process.exit(1);
|
|
8281
8304
|
}
|
|
8282
|
-
if (existsSync12(
|
|
8305
|
+
if (existsSync12(SCHEDULE_FILE2) && !options.force) {
|
|
8283
8306
|
if (!isInteractive()) {
|
|
8284
8307
|
console.error(chalk29.red("\u2717 schedule.yaml already exists"));
|
|
8285
8308
|
console.error(chalk29.dim(" Use --force to overwrite"));
|
|
@@ -8514,8 +8537,8 @@ var initCommand4 = new Command27().name("init").description("Create a schedule.y
|
|
|
8514
8537
|
if (secrets && Object.keys(secrets).length > 0) {
|
|
8515
8538
|
scheduleYaml.schedules[scheduleName].run.secrets = secrets;
|
|
8516
8539
|
}
|
|
8517
|
-
writeFileSync(
|
|
8518
|
-
console.log(chalk29.green(`\u2713 Created ${
|
|
8540
|
+
writeFileSync(SCHEDULE_FILE2, stringifyYaml2(scheduleYaml));
|
|
8541
|
+
console.log(chalk29.green(`\u2713 Created ${SCHEDULE_FILE2}`));
|
|
8519
8542
|
console.log(chalk29.dim(" Deploy with: vm0 schedule deploy"));
|
|
8520
8543
|
} catch (error) {
|
|
8521
8544
|
console.error(chalk29.red("\u2717 Failed to create schedule.yaml"));
|
|
@@ -8785,12 +8808,33 @@ function formatRunStatus(status) {
|
|
|
8785
8808
|
return status;
|
|
8786
8809
|
}
|
|
8787
8810
|
}
|
|
8788
|
-
var statusCommand4 = new Command30().name("status").description("Show detailed status of a schedule").argument(
|
|
8811
|
+
var statusCommand4 = new Command30().name("status").description("Show detailed status of a schedule").argument(
|
|
8812
|
+
"[name]",
|
|
8813
|
+
"Schedule name (auto-detected from schedule.yaml if omitted)"
|
|
8814
|
+
).option(
|
|
8789
8815
|
"-l, --limit <number>",
|
|
8790
8816
|
"Number of recent runs to show (0 to hide)",
|
|
8791
8817
|
"5"
|
|
8792
|
-
).action(async (
|
|
8818
|
+
).action(async (nameArg, options) => {
|
|
8793
8819
|
try {
|
|
8820
|
+
let name = nameArg;
|
|
8821
|
+
if (!name) {
|
|
8822
|
+
const scheduleResult = loadScheduleName();
|
|
8823
|
+
if (scheduleResult.error) {
|
|
8824
|
+
console.error(chalk32.red(`\u2717 ${scheduleResult.error}`));
|
|
8825
|
+
process.exit(1);
|
|
8826
|
+
}
|
|
8827
|
+
if (!scheduleResult.scheduleName) {
|
|
8828
|
+
console.error(chalk32.red("\u2717 Schedule name required"));
|
|
8829
|
+
console.error(
|
|
8830
|
+
chalk32.dim(
|
|
8831
|
+
" Provide name or run from directory with schedule.yaml"
|
|
8832
|
+
)
|
|
8833
|
+
);
|
|
8834
|
+
process.exit(1);
|
|
8835
|
+
}
|
|
8836
|
+
name = scheduleResult.scheduleName;
|
|
8837
|
+
}
|
|
8794
8838
|
const result = loadAgentName();
|
|
8795
8839
|
if (result.error) {
|
|
8796
8840
|
console.error(chalk32.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
|
|
@@ -8893,7 +8937,9 @@ var statusCommand4 = new Command30().name("status").description("Show detailed s
|
|
|
8893
8937
|
if (error.message.includes("Not authenticated")) {
|
|
8894
8938
|
console.error(chalk32.dim(" Run: vm0 auth login"));
|
|
8895
8939
|
} else if (error.message.includes("not found") || error.message.includes("Not found")) {
|
|
8896
|
-
console.error(
|
|
8940
|
+
console.error(
|
|
8941
|
+
chalk32.dim(` Schedule "${nameArg ?? "unknown"}" not found`)
|
|
8942
|
+
);
|
|
8897
8943
|
} else {
|
|
8898
8944
|
console.error(chalk32.dim(` ${error.message}`));
|
|
8899
8945
|
}
|
|
@@ -8918,8 +8964,29 @@ async function confirm(message) {
|
|
|
8918
8964
|
});
|
|
8919
8965
|
});
|
|
8920
8966
|
}
|
|
8921
|
-
var deleteCommand = new Command31().name("delete").alias("rm").description("Delete a schedule").argument(
|
|
8967
|
+
var deleteCommand = new Command31().name("delete").alias("rm").description("Delete a schedule").argument(
|
|
8968
|
+
"[name]",
|
|
8969
|
+
"Schedule name (auto-detected from schedule.yaml if omitted)"
|
|
8970
|
+
).option("-f, --force", "Skip confirmation prompt").action(async (nameArg, options) => {
|
|
8922
8971
|
try {
|
|
8972
|
+
let name = nameArg;
|
|
8973
|
+
if (!name) {
|
|
8974
|
+
const scheduleResult = loadScheduleName();
|
|
8975
|
+
if (scheduleResult.error) {
|
|
8976
|
+
console.error(chalk33.red(`\u2717 ${scheduleResult.error}`));
|
|
8977
|
+
process.exit(1);
|
|
8978
|
+
}
|
|
8979
|
+
if (!scheduleResult.scheduleName) {
|
|
8980
|
+
console.error(chalk33.red("\u2717 Schedule name required"));
|
|
8981
|
+
console.error(
|
|
8982
|
+
chalk33.dim(
|
|
8983
|
+
" Provide name or run from directory with schedule.yaml"
|
|
8984
|
+
)
|
|
8985
|
+
);
|
|
8986
|
+
process.exit(1);
|
|
8987
|
+
}
|
|
8988
|
+
name = scheduleResult.scheduleName;
|
|
8989
|
+
}
|
|
8923
8990
|
const result = loadAgentName();
|
|
8924
8991
|
if (result.error) {
|
|
8925
8992
|
console.error(chalk33.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
|
|
@@ -8971,8 +9038,29 @@ var deleteCommand = new Command31().name("delete").alias("rm").description("Dele
|
|
|
8971
9038
|
// src/commands/schedule/enable.ts
|
|
8972
9039
|
import { Command as Command32 } from "commander";
|
|
8973
9040
|
import chalk34 from "chalk";
|
|
8974
|
-
var enableCommand = new Command32().name("enable").description("Enable a schedule").argument(
|
|
9041
|
+
var enableCommand = new Command32().name("enable").description("Enable a schedule").argument(
|
|
9042
|
+
"[name]",
|
|
9043
|
+
"Schedule name (auto-detected from schedule.yaml if omitted)"
|
|
9044
|
+
).action(async (nameArg) => {
|
|
8975
9045
|
try {
|
|
9046
|
+
let name = nameArg;
|
|
9047
|
+
if (!name) {
|
|
9048
|
+
const scheduleResult = loadScheduleName();
|
|
9049
|
+
if (scheduleResult.error) {
|
|
9050
|
+
console.error(chalk34.red(`\u2717 ${scheduleResult.error}`));
|
|
9051
|
+
process.exit(1);
|
|
9052
|
+
}
|
|
9053
|
+
if (!scheduleResult.scheduleName) {
|
|
9054
|
+
console.error(chalk34.red("\u2717 Schedule name required"));
|
|
9055
|
+
console.error(
|
|
9056
|
+
chalk34.dim(
|
|
9057
|
+
" Provide name or run from directory with schedule.yaml"
|
|
9058
|
+
)
|
|
9059
|
+
);
|
|
9060
|
+
process.exit(1);
|
|
9061
|
+
}
|
|
9062
|
+
name = scheduleResult.scheduleName;
|
|
9063
|
+
}
|
|
8976
9064
|
const result = loadAgentName();
|
|
8977
9065
|
if (result.error) {
|
|
8978
9066
|
console.error(chalk34.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
|
|
@@ -9018,8 +9106,29 @@ var enableCommand = new Command32().name("enable").description("Enable a schedul
|
|
|
9018
9106
|
// src/commands/schedule/disable.ts
|
|
9019
9107
|
import { Command as Command33 } from "commander";
|
|
9020
9108
|
import chalk35 from "chalk";
|
|
9021
|
-
var disableCommand = new Command33().name("disable").description("Disable a schedule").argument(
|
|
9109
|
+
var disableCommand = new Command33().name("disable").description("Disable a schedule").argument(
|
|
9110
|
+
"[name]",
|
|
9111
|
+
"Schedule name (auto-detected from schedule.yaml if omitted)"
|
|
9112
|
+
).action(async (nameArg) => {
|
|
9022
9113
|
try {
|
|
9114
|
+
let name = nameArg;
|
|
9115
|
+
if (!name) {
|
|
9116
|
+
const scheduleResult = loadScheduleName();
|
|
9117
|
+
if (scheduleResult.error) {
|
|
9118
|
+
console.error(chalk35.red(`\u2717 ${scheduleResult.error}`));
|
|
9119
|
+
process.exit(1);
|
|
9120
|
+
}
|
|
9121
|
+
if (!scheduleResult.scheduleName) {
|
|
9122
|
+
console.error(chalk35.red("\u2717 Schedule name required"));
|
|
9123
|
+
console.error(
|
|
9124
|
+
chalk35.dim(
|
|
9125
|
+
" Provide name or run from directory with schedule.yaml"
|
|
9126
|
+
)
|
|
9127
|
+
);
|
|
9128
|
+
process.exit(1);
|
|
9129
|
+
}
|
|
9130
|
+
name = scheduleResult.scheduleName;
|
|
9131
|
+
}
|
|
9023
9132
|
const result = loadAgentName();
|
|
9024
9133
|
if (result.error) {
|
|
9025
9134
|
console.error(chalk35.red(`\u2717 Invalid vm0.yaml: ${result.error}`));
|
|
@@ -9067,7 +9176,7 @@ var scheduleCommand = new Command34().name("schedule").description("Manage agent
|
|
|
9067
9176
|
|
|
9068
9177
|
// src/index.ts
|
|
9069
9178
|
var program = new Command35();
|
|
9070
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("5.
|
|
9179
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("5.7.0");
|
|
9071
9180
|
program.command("info").description("Display environment information").action(async () => {
|
|
9072
9181
|
console.log(chalk36.bold("System Information:"));
|
|
9073
9182
|
console.log(`Node Version: ${process.version}`);
|