@vm0/cli 9.24.0 → 9.24.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.
- package/index.js +318 -492
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ if (DSN) {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
Sentry.setContext("cli", {
|
|
64
|
-
version: "9.24.
|
|
64
|
+
version: "9.24.1",
|
|
65
65
|
command: process.argv.slice(2).join(" ")
|
|
66
66
|
});
|
|
67
67
|
Sentry.setContext("runtime", {
|
|
@@ -2594,12 +2594,9 @@ var c14 = initContract();
|
|
|
2594
2594
|
var sessionResponseSchema = z17.object({
|
|
2595
2595
|
id: z17.string(),
|
|
2596
2596
|
agentComposeId: z17.string(),
|
|
2597
|
-
agentComposeVersionId: z17.string().nullable(),
|
|
2598
2597
|
conversationId: z17.string().nullable(),
|
|
2599
2598
|
artifactName: z17.string().nullable(),
|
|
2600
|
-
vars: z17.record(z17.string(), z17.string()).nullable(),
|
|
2601
2599
|
secretNames: z17.array(z17.string()).nullable(),
|
|
2602
|
-
volumeVersions: z17.record(z17.string(), z17.string()).nullable(),
|
|
2603
2600
|
createdAt: z17.string(),
|
|
2604
2601
|
updatedAt: z17.string()
|
|
2605
2602
|
});
|
|
@@ -2700,8 +2697,7 @@ var deployScheduleRequestSchema = z18.object({
|
|
|
2700
2697
|
atTime: z18.string().optional(),
|
|
2701
2698
|
timezone: z18.string().default("UTC"),
|
|
2702
2699
|
prompt: z18.string().min(1, "Prompt required"),
|
|
2703
|
-
vars
|
|
2704
|
-
secrets: z18.record(z18.string(), z18.string()).optional(),
|
|
2700
|
+
// vars and secrets removed - now managed via platform tables
|
|
2705
2701
|
artifactName: z18.string().optional(),
|
|
2706
2702
|
artifactVersion: z18.string().optional(),
|
|
2707
2703
|
volumeVersions: z18.record(z18.string(), z18.string()).optional(),
|
|
@@ -5840,7 +5836,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5840
5836
|
);
|
|
5841
5837
|
}
|
|
5842
5838
|
if (options.autoUpdate !== false) {
|
|
5843
|
-
await silentUpgradeAfterCommand("9.24.
|
|
5839
|
+
await silentUpgradeAfterCommand("9.24.1");
|
|
5844
5840
|
}
|
|
5845
5841
|
return result;
|
|
5846
5842
|
}
|
|
@@ -7381,6 +7377,7 @@ var ApiClient = class {
|
|
|
7381
7377
|
}
|
|
7382
7378
|
/**
|
|
7383
7379
|
* Deploy schedule (create or update)
|
|
7380
|
+
* Note: vars and secrets are now managed via platform tables (vm0 secret set, vm0 var set)
|
|
7384
7381
|
*/
|
|
7385
7382
|
async deploySchedule(body) {
|
|
7386
7383
|
const baseUrl = await this.getBaseUrl();
|
|
@@ -8282,7 +8279,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8282
8279
|
}
|
|
8283
8280
|
showNextSteps(result);
|
|
8284
8281
|
if (options.autoUpdate !== false) {
|
|
8285
|
-
await silentUpgradeAfterCommand("9.24.
|
|
8282
|
+
await silentUpgradeAfterCommand("9.24.1");
|
|
8286
8283
|
}
|
|
8287
8284
|
} catch (error) {
|
|
8288
8285
|
handleRunError(error, identifier);
|
|
@@ -8390,11 +8387,6 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8390
8387
|
"Secrets for ${{ secrets.xxx }} (repeatable, falls back to --env-file or env vars)",
|
|
8391
8388
|
collectKeyValue,
|
|
8392
8389
|
{}
|
|
8393
|
-
).option(
|
|
8394
|
-
"--volume-version <name=version>",
|
|
8395
|
-
"Volume version override (repeatable)",
|
|
8396
|
-
collectVolumeVersions,
|
|
8397
|
-
{}
|
|
8398
8390
|
).option(
|
|
8399
8391
|
"--experimental-realtime",
|
|
8400
8392
|
"Use realtime event streaming instead of polling (experimental)"
|
|
@@ -8423,7 +8415,6 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8423
8415
|
prompt,
|
|
8424
8416
|
vars: Object.keys(vars).length > 0 ? vars : void 0,
|
|
8425
8417
|
secrets: loadedSecrets,
|
|
8426
|
-
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
|
|
8427
8418
|
modelProvider: options.modelProvider || allOpts.modelProvider,
|
|
8428
8419
|
debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
|
|
8429
8420
|
});
|
|
@@ -9789,7 +9780,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9789
9780
|
).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(
|
|
9790
9781
|
async (prompt, options) => {
|
|
9791
9782
|
if (options.autoUpdate !== false) {
|
|
9792
|
-
const shouldExit = await checkAndUpgrade("9.24.
|
|
9783
|
+
const shouldExit = await checkAndUpgrade("9.24.1", prompt);
|
|
9793
9784
|
if (shouldExit) {
|
|
9794
9785
|
process.exit(0);
|
|
9795
9786
|
}
|
|
@@ -11102,7 +11093,7 @@ import { Command as Command51 } from "commander";
|
|
|
11102
11093
|
|
|
11103
11094
|
// src/commands/schedule/setup.ts
|
|
11104
11095
|
import { Command as Command45 } from "commander";
|
|
11105
|
-
import
|
|
11096
|
+
import chalk45 from "chalk";
|
|
11106
11097
|
|
|
11107
11098
|
// src/lib/domain/schedule-utils.ts
|
|
11108
11099
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -11214,22 +11205,6 @@ function toISODateTime(dateTimeStr) {
|
|
|
11214
11205
|
const date = new Date(isoStr);
|
|
11215
11206
|
return date.toISOString();
|
|
11216
11207
|
}
|
|
11217
|
-
function extractRequiredConfiguration(composeContent) {
|
|
11218
|
-
const result = {
|
|
11219
|
-
secrets: [],
|
|
11220
|
-
vars: [],
|
|
11221
|
-
credentials: []
|
|
11222
|
-
};
|
|
11223
|
-
if (!composeContent) {
|
|
11224
|
-
return result;
|
|
11225
|
-
}
|
|
11226
|
-
const refs = extractVariableReferences(composeContent);
|
|
11227
|
-
const grouped = groupVariablesBySource(refs);
|
|
11228
|
-
result.secrets = grouped.secrets.map((r) => r.name);
|
|
11229
|
-
result.vars = grouped.vars.map((r) => r.name);
|
|
11230
|
-
result.credentials = grouped.credentials.map((r) => r.name);
|
|
11231
|
-
return result;
|
|
11232
|
-
}
|
|
11233
11208
|
async function resolveScheduleByAgent(agentName) {
|
|
11234
11209
|
const { schedules } = await listSchedules();
|
|
11235
11210
|
const schedule = schedules.find((s) => s.composeName === agentName);
|
|
@@ -11243,117 +11218,6 @@ async function resolveScheduleByAgent(agentName) {
|
|
|
11243
11218
|
};
|
|
11244
11219
|
}
|
|
11245
11220
|
|
|
11246
|
-
// src/commands/schedule/gather-configuration.ts
|
|
11247
|
-
import chalk45 from "chalk";
|
|
11248
|
-
var defaultPromptDeps = {
|
|
11249
|
-
isInteractive,
|
|
11250
|
-
promptConfirm,
|
|
11251
|
-
promptText
|
|
11252
|
-
};
|
|
11253
|
-
function parseKeyValuePairs(pairs) {
|
|
11254
|
-
const result = {};
|
|
11255
|
-
for (const pair of pairs) {
|
|
11256
|
-
const eqIndex = pair.indexOf("=");
|
|
11257
|
-
if (eqIndex > 0) {
|
|
11258
|
-
const key = pair.slice(0, eqIndex);
|
|
11259
|
-
const value = pair.slice(eqIndex + 1);
|
|
11260
|
-
result[key] = value;
|
|
11261
|
-
}
|
|
11262
|
-
}
|
|
11263
|
-
return result;
|
|
11264
|
-
}
|
|
11265
|
-
async function handleExistingSecrets(existingSecretNames, deps) {
|
|
11266
|
-
if (existingSecretNames.length > 0 && deps.isInteractive()) {
|
|
11267
|
-
const keepSecrets = await deps.promptConfirm(
|
|
11268
|
-
`Keep existing secrets? (${existingSecretNames.join(", ")})`,
|
|
11269
|
-
true
|
|
11270
|
-
);
|
|
11271
|
-
if (keepSecrets) {
|
|
11272
|
-
return true;
|
|
11273
|
-
}
|
|
11274
|
-
console.log(
|
|
11275
|
-
chalk45.dim(
|
|
11276
|
-
" Note: Secrets will be cleared. Use 'vm0 secret set' to add platform secrets."
|
|
11277
|
-
)
|
|
11278
|
-
);
|
|
11279
|
-
return false;
|
|
11280
|
-
}
|
|
11281
|
-
return false;
|
|
11282
|
-
}
|
|
11283
|
-
async function handleVars(optionVars, existingVars, deps) {
|
|
11284
|
-
if (optionVars.length > 0) {
|
|
11285
|
-
return parseKeyValuePairs(optionVars);
|
|
11286
|
-
}
|
|
11287
|
-
if (existingVars && deps.isInteractive()) {
|
|
11288
|
-
const keepVars = await deps.promptConfirm(
|
|
11289
|
-
`Keep existing variables? (${Object.keys(existingVars).join(", ")})`,
|
|
11290
|
-
true
|
|
11291
|
-
);
|
|
11292
|
-
if (keepVars) {
|
|
11293
|
-
return { ...existingVars };
|
|
11294
|
-
}
|
|
11295
|
-
}
|
|
11296
|
-
return {};
|
|
11297
|
-
}
|
|
11298
|
-
function displayMissingRequirements(missingSecrets, missingVars) {
|
|
11299
|
-
if (missingSecrets.length > 0) {
|
|
11300
|
-
console.log(chalk45.yellow("\nAgent requires the following secrets:"));
|
|
11301
|
-
for (const name of missingSecrets) {
|
|
11302
|
-
console.log(chalk45.dim(` ${name}`));
|
|
11303
|
-
}
|
|
11304
|
-
console.log();
|
|
11305
|
-
console.log("Set secrets using the platform:");
|
|
11306
|
-
for (const name of missingSecrets) {
|
|
11307
|
-
console.log(chalk45.cyan(` vm0 secret set ${name} <value>`));
|
|
11308
|
-
}
|
|
11309
|
-
console.log();
|
|
11310
|
-
}
|
|
11311
|
-
if (missingVars.length > 0) {
|
|
11312
|
-
console.log(chalk45.yellow("\nAgent requires the following variables:"));
|
|
11313
|
-
for (const name of missingVars) {
|
|
11314
|
-
console.log(chalk45.dim(` ${name}`));
|
|
11315
|
-
}
|
|
11316
|
-
console.log();
|
|
11317
|
-
}
|
|
11318
|
-
}
|
|
11319
|
-
async function promptForMissingVars(missingVars, vars, deps) {
|
|
11320
|
-
for (const name of missingVars) {
|
|
11321
|
-
const value = await deps.promptText(
|
|
11322
|
-
`Enter value for var ${chalk45.cyan(name)}`,
|
|
11323
|
-
""
|
|
11324
|
-
);
|
|
11325
|
-
if (value) {
|
|
11326
|
-
vars[name] = value;
|
|
11327
|
-
}
|
|
11328
|
-
}
|
|
11329
|
-
}
|
|
11330
|
-
async function gatherConfiguration(params, deps = defaultPromptDeps) {
|
|
11331
|
-
const { required, optionVars, existingSchedule } = params;
|
|
11332
|
-
const existingSecretNames = existingSchedule?.secretNames ?? [];
|
|
11333
|
-
const existingVars = existingSchedule?.vars ?? null;
|
|
11334
|
-
const preserveExistingSecrets = await handleExistingSecrets(
|
|
11335
|
-
existingSecretNames,
|
|
11336
|
-
deps
|
|
11337
|
-
);
|
|
11338
|
-
const vars = await handleVars(optionVars, existingVars, deps);
|
|
11339
|
-
const effectiveExistingSecrets = preserveExistingSecrets ? existingSecretNames : [];
|
|
11340
|
-
const missingSecrets = required.secrets.filter(
|
|
11341
|
-
(name) => !effectiveExistingSecrets.includes(name)
|
|
11342
|
-
);
|
|
11343
|
-
const missingVars = required.vars.filter(
|
|
11344
|
-
(name) => !Object.keys(vars).includes(name)
|
|
11345
|
-
);
|
|
11346
|
-
if (missingSecrets.length === 0 && missingVars.length === 0) {
|
|
11347
|
-
return { vars, preserveExistingSecrets };
|
|
11348
|
-
}
|
|
11349
|
-
if (!deps.isInteractive()) {
|
|
11350
|
-
return { vars, preserveExistingSecrets };
|
|
11351
|
-
}
|
|
11352
|
-
displayMissingRequirements(missingSecrets, missingVars);
|
|
11353
|
-
await promptForMissingVars(missingVars, vars, deps);
|
|
11354
|
-
return { vars, preserveExistingSecrets };
|
|
11355
|
-
}
|
|
11356
|
-
|
|
11357
11221
|
// src/commands/schedule/setup.ts
|
|
11358
11222
|
var FREQUENCY_CHOICES = [
|
|
11359
11223
|
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
@@ -11402,26 +11266,6 @@ function parseDayOption(day, frequency) {
|
|
|
11402
11266
|
}
|
|
11403
11267
|
return void 0;
|
|
11404
11268
|
}
|
|
11405
|
-
function expandEnvVars(value) {
|
|
11406
|
-
return value.replace(/\$\{([^}]+)\}/g, (match, varName) => {
|
|
11407
|
-
const envValue = process.env[varName];
|
|
11408
|
-
if (envValue === void 0) {
|
|
11409
|
-
console.warn(
|
|
11410
|
-
chalk46.yellow(` Warning: Environment variable ${varName} not set`)
|
|
11411
|
-
);
|
|
11412
|
-
return match;
|
|
11413
|
-
}
|
|
11414
|
-
return envValue;
|
|
11415
|
-
});
|
|
11416
|
-
}
|
|
11417
|
-
function expandEnvVarsInObject(obj) {
|
|
11418
|
-
if (!obj) return void 0;
|
|
11419
|
-
const result = {};
|
|
11420
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
11421
|
-
result[key] = expandEnvVars(value);
|
|
11422
|
-
}
|
|
11423
|
-
return result;
|
|
11424
|
-
}
|
|
11425
11269
|
function formatInTimezone(isoDate, timezone) {
|
|
11426
11270
|
const date = new Date(isoDate);
|
|
11427
11271
|
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
@@ -11450,9 +11294,6 @@ function parseFrequencyFromCron(cron) {
|
|
|
11450
11294
|
}
|
|
11451
11295
|
return null;
|
|
11452
11296
|
}
|
|
11453
|
-
function collect(value, previous) {
|
|
11454
|
-
return previous.concat([value]);
|
|
11455
|
-
}
|
|
11456
11297
|
function getExistingDefaults(existingSchedule) {
|
|
11457
11298
|
const defaults = {};
|
|
11458
11299
|
if (existingSchedule?.cronExpression) {
|
|
@@ -11474,7 +11315,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
11474
11315
|
}
|
|
11475
11316
|
if (!isInteractive()) {
|
|
11476
11317
|
console.error(
|
|
11477
|
-
|
|
11318
|
+
chalk45.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
11478
11319
|
);
|
|
11479
11320
|
process.exit(1);
|
|
11480
11321
|
}
|
|
@@ -11494,7 +11335,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11494
11335
|
const day2 = parseDayOption(optionDay, frequency);
|
|
11495
11336
|
if (day2 === void 0) {
|
|
11496
11337
|
console.error(
|
|
11497
|
-
|
|
11338
|
+
chalk45.red(
|
|
11498
11339
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
11499
11340
|
)
|
|
11500
11341
|
);
|
|
@@ -11503,7 +11344,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11503
11344
|
return day2;
|
|
11504
11345
|
}
|
|
11505
11346
|
if (!isInteractive()) {
|
|
11506
|
-
console.error(
|
|
11347
|
+
console.error(chalk45.red("\u2717 --day is required for weekly/monthly"));
|
|
11507
11348
|
process.exit(1);
|
|
11508
11349
|
}
|
|
11509
11350
|
if (frequency === "weekly") {
|
|
@@ -11522,7 +11363,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11522
11363
|
if (!dayStr) return null;
|
|
11523
11364
|
const day = parseInt(dayStr, 10);
|
|
11524
11365
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
11525
|
-
console.error(
|
|
11366
|
+
console.error(chalk45.red("\u2717 Day must be between 1 and 31"));
|
|
11526
11367
|
process.exit(1);
|
|
11527
11368
|
}
|
|
11528
11369
|
return day;
|
|
@@ -11531,13 +11372,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
11531
11372
|
if (optionTime) {
|
|
11532
11373
|
const validation = validateTimeFormat(optionTime);
|
|
11533
11374
|
if (validation !== true) {
|
|
11534
|
-
console.error(
|
|
11375
|
+
console.error(chalk45.red(`\u2717 Invalid time: ${validation}`));
|
|
11535
11376
|
process.exit(1);
|
|
11536
11377
|
}
|
|
11537
11378
|
return optionTime;
|
|
11538
11379
|
}
|
|
11539
11380
|
if (!isInteractive()) {
|
|
11540
|
-
console.error(
|
|
11381
|
+
console.error(chalk45.red("\u2717 --time is required (HH:MM format)"));
|
|
11541
11382
|
process.exit(1);
|
|
11542
11383
|
}
|
|
11543
11384
|
return await promptText(
|
|
@@ -11550,7 +11391,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11550
11391
|
if (optionDay && optionTime) {
|
|
11551
11392
|
if (!validateDateFormat(optionDay)) {
|
|
11552
11393
|
console.error(
|
|
11553
|
-
|
|
11394
|
+
chalk45.red(
|
|
11554
11395
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
11555
11396
|
)
|
|
11556
11397
|
);
|
|
@@ -11558,16 +11399,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11558
11399
|
}
|
|
11559
11400
|
if (!validateTimeFormat(optionTime)) {
|
|
11560
11401
|
console.error(
|
|
11561
|
-
|
|
11402
|
+
chalk45.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
11562
11403
|
);
|
|
11563
11404
|
process.exit(1);
|
|
11564
11405
|
}
|
|
11565
11406
|
return `${optionDay} ${optionTime}`;
|
|
11566
11407
|
}
|
|
11567
11408
|
if (!isInteractive()) {
|
|
11568
|
-
console.error(
|
|
11409
|
+
console.error(chalk45.red("\u2717 One-time schedules require interactive mode"));
|
|
11569
11410
|
console.error(
|
|
11570
|
-
|
|
11411
|
+
chalk45.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
11571
11412
|
);
|
|
11572
11413
|
process.exit(1);
|
|
11573
11414
|
}
|
|
@@ -11598,7 +11439,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
11598
11439
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
11599
11440
|
if (optionPrompt) return optionPrompt;
|
|
11600
11441
|
if (!isInteractive()) {
|
|
11601
|
-
console.error(
|
|
11442
|
+
console.error(chalk45.red("\u2717 --prompt is required"));
|
|
11602
11443
|
process.exit(1);
|
|
11603
11444
|
}
|
|
11604
11445
|
return await promptText(
|
|
@@ -11609,8 +11450,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
11609
11450
|
async function resolveAgent(agentName) {
|
|
11610
11451
|
const compose = await getComposeByName(agentName);
|
|
11611
11452
|
if (!compose) {
|
|
11612
|
-
console.error(
|
|
11613
|
-
console.error(
|
|
11453
|
+
console.error(chalk45.red(`\u2717 Agent not found: ${agentName}`));
|
|
11454
|
+
console.error(chalk45.dim(" Make sure the agent is composed first"));
|
|
11614
11455
|
process.exit(1);
|
|
11615
11456
|
}
|
|
11616
11457
|
return {
|
|
@@ -11653,11 +11494,9 @@ async function buildAndDeploy(params) {
|
|
|
11653
11494
|
params.day
|
|
11654
11495
|
);
|
|
11655
11496
|
}
|
|
11656
|
-
const expandedVars = expandEnvVarsInObject(params.vars);
|
|
11657
|
-
const expandedSecrets = expandEnvVarsInObject(params.secrets);
|
|
11658
11497
|
console.log(
|
|
11659
11498
|
`
|
|
11660
|
-
Deploying schedule for agent ${
|
|
11499
|
+
Deploying schedule for agent ${chalk45.cyan(params.agentName)}...`
|
|
11661
11500
|
);
|
|
11662
11501
|
const deployResult = await deploySchedule({
|
|
11663
11502
|
name: params.scheduleName,
|
|
@@ -11666,19 +11505,17 @@ Deploying schedule for agent ${chalk46.cyan(params.agentName)}...`
|
|
|
11666
11505
|
atTime: atTimeISO,
|
|
11667
11506
|
timezone: params.timezone,
|
|
11668
11507
|
prompt: params.prompt,
|
|
11669
|
-
vars: expandedVars,
|
|
11670
|
-
secrets: expandedSecrets,
|
|
11671
11508
|
artifactName: params.artifactName
|
|
11672
11509
|
});
|
|
11673
11510
|
return deployResult;
|
|
11674
11511
|
}
|
|
11675
11512
|
function handleSetupError(error) {
|
|
11676
|
-
console.error(
|
|
11513
|
+
console.error(chalk45.red("\u2717 Failed to setup schedule"));
|
|
11677
11514
|
if (error instanceof Error) {
|
|
11678
11515
|
if (error.message.includes("Not authenticated")) {
|
|
11679
|
-
console.error(
|
|
11516
|
+
console.error(chalk45.dim(" Run: vm0 auth login"));
|
|
11680
11517
|
} else {
|
|
11681
|
-
console.error(
|
|
11518
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11682
11519
|
}
|
|
11683
11520
|
}
|
|
11684
11521
|
process.exit(1);
|
|
@@ -11686,56 +11523,56 @@ function handleSetupError(error) {
|
|
|
11686
11523
|
function displayDeployResult(agentName, deployResult) {
|
|
11687
11524
|
if (deployResult.created) {
|
|
11688
11525
|
console.log(
|
|
11689
|
-
|
|
11526
|
+
chalk45.green(`\u2713 Created schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11690
11527
|
);
|
|
11691
11528
|
} else {
|
|
11692
11529
|
console.log(
|
|
11693
|
-
|
|
11530
|
+
chalk45.green(`\u2713 Updated schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11694
11531
|
);
|
|
11695
11532
|
}
|
|
11696
|
-
console.log(
|
|
11533
|
+
console.log(chalk45.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
11697
11534
|
if (deployResult.schedule.cronExpression) {
|
|
11698
|
-
console.log(
|
|
11535
|
+
console.log(chalk45.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
11699
11536
|
if (deployResult.schedule.nextRunAt) {
|
|
11700
11537
|
const nextRun = formatInTimezone(
|
|
11701
11538
|
deployResult.schedule.nextRunAt,
|
|
11702
11539
|
deployResult.schedule.timezone
|
|
11703
11540
|
);
|
|
11704
|
-
console.log(
|
|
11541
|
+
console.log(chalk45.dim(` Next run: ${nextRun}`));
|
|
11705
11542
|
}
|
|
11706
11543
|
} else if (deployResult.schedule.atTime) {
|
|
11707
11544
|
const atTimeFormatted = formatInTimezone(
|
|
11708
11545
|
deployResult.schedule.atTime,
|
|
11709
11546
|
deployResult.schedule.timezone
|
|
11710
11547
|
);
|
|
11711
|
-
console.log(
|
|
11548
|
+
console.log(chalk45.dim(` At: ${atTimeFormatted}`));
|
|
11712
11549
|
}
|
|
11713
11550
|
}
|
|
11714
11551
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
11715
11552
|
try {
|
|
11716
11553
|
await enableSchedule({ name: scheduleName, composeId });
|
|
11717
11554
|
console.log(
|
|
11718
|
-
|
|
11555
|
+
chalk45.green(`\u2713 Enabled schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11719
11556
|
);
|
|
11720
11557
|
} catch (error) {
|
|
11721
|
-
console.error(
|
|
11558
|
+
console.error(chalk45.yellow("\u26A0 Failed to enable schedule"));
|
|
11722
11559
|
if (error instanceof ApiRequestError) {
|
|
11723
11560
|
if (error.code === "SCHEDULE_PAST") {
|
|
11724
|
-
console.error(
|
|
11561
|
+
console.error(chalk45.dim(" Scheduled time has already passed"));
|
|
11725
11562
|
} else {
|
|
11726
|
-
console.error(
|
|
11563
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11727
11564
|
}
|
|
11728
11565
|
} else if (error instanceof Error) {
|
|
11729
|
-
console.error(
|
|
11566
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11730
11567
|
}
|
|
11731
11568
|
console.log(
|
|
11732
|
-
` To enable manually: ${
|
|
11569
|
+
` To enable manually: ${chalk45.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
11733
11570
|
);
|
|
11734
11571
|
}
|
|
11735
11572
|
}
|
|
11736
11573
|
function showEnableHint(agentName) {
|
|
11737
11574
|
console.log();
|
|
11738
|
-
console.log(` To enable: ${
|
|
11575
|
+
console.log(` To enable: ${chalk45.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
11739
11576
|
}
|
|
11740
11577
|
async function handleScheduleEnabling(params) {
|
|
11741
11578
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -11756,13 +11593,12 @@ async function handleScheduleEnabling(params) {
|
|
|
11756
11593
|
showEnableHint(agentName);
|
|
11757
11594
|
}
|
|
11758
11595
|
}
|
|
11759
|
-
var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--
|
|
11596
|
+
var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
|
|
11760
11597
|
try {
|
|
11761
|
-
const { composeId, scheduleName
|
|
11762
|
-
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
11598
|
+
const { composeId, scheduleName } = await resolveAgent(agentName);
|
|
11763
11599
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
11764
11600
|
console.log(
|
|
11765
|
-
|
|
11601
|
+
chalk45.dim(
|
|
11766
11602
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
11767
11603
|
)
|
|
11768
11604
|
);
|
|
@@ -11772,12 +11608,12 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11772
11608
|
defaults.frequency
|
|
11773
11609
|
);
|
|
11774
11610
|
if (!frequency) {
|
|
11775
|
-
console.log(
|
|
11611
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11776
11612
|
return;
|
|
11777
11613
|
}
|
|
11778
11614
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
11779
11615
|
if (!timing) {
|
|
11780
|
-
console.log(
|
|
11616
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11781
11617
|
return;
|
|
11782
11618
|
}
|
|
11783
11619
|
const { day, time, atTime } = timing;
|
|
@@ -11786,7 +11622,7 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11786
11622
|
existingSchedule?.timezone
|
|
11787
11623
|
);
|
|
11788
11624
|
if (!timezone) {
|
|
11789
|
-
console.log(
|
|
11625
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11790
11626
|
return;
|
|
11791
11627
|
}
|
|
11792
11628
|
const promptText_ = await gatherPromptText(
|
|
@@ -11794,16 +11630,9 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11794
11630
|
existingSchedule?.prompt
|
|
11795
11631
|
);
|
|
11796
11632
|
if (!promptText_) {
|
|
11797
|
-
console.log(
|
|
11633
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11798
11634
|
return;
|
|
11799
11635
|
}
|
|
11800
|
-
const config = await gatherConfiguration({
|
|
11801
|
-
required: requiredConfig,
|
|
11802
|
-
optionSecrets: [],
|
|
11803
|
-
// Secrets are no longer passed via CLI
|
|
11804
|
-
optionVars: options.var || [],
|
|
11805
|
-
existingSchedule
|
|
11806
|
-
});
|
|
11807
11636
|
const deployResult = await buildAndDeploy({
|
|
11808
11637
|
scheduleName,
|
|
11809
11638
|
composeId,
|
|
@@ -11814,9 +11643,6 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11814
11643
|
atTime,
|
|
11815
11644
|
timezone,
|
|
11816
11645
|
prompt: promptText_,
|
|
11817
|
-
vars: Object.keys(config.vars).length > 0 ? config.vars : void 0,
|
|
11818
|
-
secrets: void 0,
|
|
11819
|
-
// Secrets managed via platform, not schedule
|
|
11820
11646
|
artifactName: options.artifactName
|
|
11821
11647
|
});
|
|
11822
11648
|
displayDeployResult(agentName, deployResult);
|
|
@@ -11835,14 +11661,14 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11835
11661
|
|
|
11836
11662
|
// src/commands/schedule/list.ts
|
|
11837
11663
|
import { Command as Command46 } from "commander";
|
|
11838
|
-
import
|
|
11664
|
+
import chalk46 from "chalk";
|
|
11839
11665
|
var listCommand5 = new Command46().name("list").alias("ls").description("List all schedules").action(async () => {
|
|
11840
11666
|
try {
|
|
11841
11667
|
const result = await listSchedules();
|
|
11842
11668
|
if (result.schedules.length === 0) {
|
|
11843
|
-
console.log(
|
|
11669
|
+
console.log(chalk46.dim("No schedules found"));
|
|
11844
11670
|
console.log(
|
|
11845
|
-
|
|
11671
|
+
chalk46.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
11846
11672
|
);
|
|
11847
11673
|
return;
|
|
11848
11674
|
}
|
|
@@ -11862,10 +11688,10 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11862
11688
|
"STATUS".padEnd(8),
|
|
11863
11689
|
"NEXT RUN"
|
|
11864
11690
|
].join(" ");
|
|
11865
|
-
console.log(
|
|
11691
|
+
console.log(chalk46.dim(header));
|
|
11866
11692
|
for (const schedule of result.schedules) {
|
|
11867
11693
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
11868
|
-
const status = schedule.enabled ?
|
|
11694
|
+
const status = schedule.enabled ? chalk46.green("enabled") : chalk46.yellow("disabled");
|
|
11869
11695
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
11870
11696
|
const row = [
|
|
11871
11697
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -11877,12 +11703,12 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11877
11703
|
console.log(row);
|
|
11878
11704
|
}
|
|
11879
11705
|
} catch (error) {
|
|
11880
|
-
console.error(
|
|
11706
|
+
console.error(chalk46.red("\u2717 Failed to list schedules"));
|
|
11881
11707
|
if (error instanceof Error) {
|
|
11882
11708
|
if (error.message.includes("Not authenticated")) {
|
|
11883
|
-
console.error(
|
|
11709
|
+
console.error(chalk46.dim(" Run: vm0 auth login"));
|
|
11884
11710
|
} else {
|
|
11885
|
-
console.error(
|
|
11711
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
11886
11712
|
}
|
|
11887
11713
|
}
|
|
11888
11714
|
process.exit(1);
|
|
@@ -11891,44 +11717,44 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11891
11717
|
|
|
11892
11718
|
// src/commands/schedule/status.ts
|
|
11893
11719
|
import { Command as Command47 } from "commander";
|
|
11894
|
-
import
|
|
11720
|
+
import chalk47 from "chalk";
|
|
11895
11721
|
function formatDateTimeStyled(dateStr) {
|
|
11896
|
-
if (!dateStr) return
|
|
11722
|
+
if (!dateStr) return chalk47.dim("-");
|
|
11897
11723
|
const formatted = formatDateTime(dateStr);
|
|
11898
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
11724
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk47.dim("($1)"));
|
|
11899
11725
|
}
|
|
11900
11726
|
function formatTrigger(schedule) {
|
|
11901
11727
|
if (schedule.cronExpression) {
|
|
11902
11728
|
return schedule.cronExpression;
|
|
11903
11729
|
}
|
|
11904
11730
|
if (schedule.atTime) {
|
|
11905
|
-
return `${schedule.atTime} ${
|
|
11731
|
+
return `${schedule.atTime} ${chalk47.dim("(one-time)")}`;
|
|
11906
11732
|
}
|
|
11907
|
-
return
|
|
11733
|
+
return chalk47.dim("-");
|
|
11908
11734
|
}
|
|
11909
11735
|
function formatRunStatus2(status) {
|
|
11910
11736
|
switch (status) {
|
|
11911
11737
|
case "completed":
|
|
11912
|
-
return
|
|
11738
|
+
return chalk47.green(status);
|
|
11913
11739
|
case "failed":
|
|
11914
11740
|
case "timeout":
|
|
11915
|
-
return
|
|
11741
|
+
return chalk47.red(status);
|
|
11916
11742
|
case "running":
|
|
11917
|
-
return
|
|
11743
|
+
return chalk47.blue(status);
|
|
11918
11744
|
case "pending":
|
|
11919
|
-
return
|
|
11745
|
+
return chalk47.yellow(status);
|
|
11920
11746
|
default:
|
|
11921
11747
|
return status;
|
|
11922
11748
|
}
|
|
11923
11749
|
}
|
|
11924
11750
|
function printRunConfiguration(schedule) {
|
|
11925
|
-
const statusText = schedule.enabled ?
|
|
11751
|
+
const statusText = schedule.enabled ? chalk47.green("enabled") : chalk47.yellow("disabled");
|
|
11926
11752
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
11927
11753
|
console.log(
|
|
11928
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
11754
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk47.dim(`(${schedule.scopeSlug})`)}`
|
|
11929
11755
|
);
|
|
11930
11756
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
11931
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
11757
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk47.dim(promptPreview)}`);
|
|
11932
11758
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
11933
11759
|
console.log(
|
|
11934
11760
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -11965,7 +11791,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11965
11791
|
console.log();
|
|
11966
11792
|
console.log("Recent Runs:");
|
|
11967
11793
|
console.log(
|
|
11968
|
-
|
|
11794
|
+
chalk47.dim("RUN ID STATUS CREATED")
|
|
11969
11795
|
);
|
|
11970
11796
|
for (const run of runs) {
|
|
11971
11797
|
const id = run.id;
|
|
@@ -11976,19 +11802,19 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11976
11802
|
}
|
|
11977
11803
|
} catch {
|
|
11978
11804
|
console.log();
|
|
11979
|
-
console.log(
|
|
11805
|
+
console.log(chalk47.dim("Recent Runs: (unable to fetch)"));
|
|
11980
11806
|
}
|
|
11981
11807
|
}
|
|
11982
11808
|
function handleStatusError(error, agentName) {
|
|
11983
|
-
console.error(
|
|
11809
|
+
console.error(chalk47.red("\u2717 Failed to get schedule status"));
|
|
11984
11810
|
if (error instanceof Error) {
|
|
11985
11811
|
if (error.message.includes("Not authenticated")) {
|
|
11986
|
-
console.error(
|
|
11812
|
+
console.error(chalk47.dim(" Run: vm0 auth login"));
|
|
11987
11813
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
11988
|
-
console.error(
|
|
11989
|
-
console.error(
|
|
11814
|
+
console.error(chalk47.dim(` No schedule found for agent "${agentName}"`));
|
|
11815
|
+
console.error(chalk47.dim(" Run: vm0 schedule list"));
|
|
11990
11816
|
} else {
|
|
11991
|
-
console.error(
|
|
11817
|
+
console.error(chalk47.dim(` ${error.message}`));
|
|
11992
11818
|
}
|
|
11993
11819
|
}
|
|
11994
11820
|
process.exit(1);
|
|
@@ -12003,8 +11829,8 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12003
11829
|
const { name, composeId } = resolved;
|
|
12004
11830
|
const schedule = await getScheduleByName({ name, composeId });
|
|
12005
11831
|
console.log();
|
|
12006
|
-
console.log(`Schedule for agent: ${
|
|
12007
|
-
console.log(
|
|
11832
|
+
console.log(`Schedule for agent: ${chalk47.cyan(agentName)}`);
|
|
11833
|
+
console.log(chalk47.dim("\u2501".repeat(50)));
|
|
12008
11834
|
printRunConfiguration(schedule);
|
|
12009
11835
|
printTimeSchedule(schedule);
|
|
12010
11836
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -12021,23 +11847,23 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12021
11847
|
|
|
12022
11848
|
// src/commands/schedule/delete.ts
|
|
12023
11849
|
import { Command as Command48 } from "commander";
|
|
12024
|
-
import
|
|
11850
|
+
import chalk48 from "chalk";
|
|
12025
11851
|
var deleteCommand = new Command48().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
12026
11852
|
try {
|
|
12027
11853
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12028
11854
|
if (!options.force) {
|
|
12029
11855
|
if (!isInteractive()) {
|
|
12030
11856
|
console.error(
|
|
12031
|
-
|
|
11857
|
+
chalk48.red("\u2717 --force required in non-interactive mode")
|
|
12032
11858
|
);
|
|
12033
11859
|
process.exit(1);
|
|
12034
11860
|
}
|
|
12035
11861
|
const confirmed = await promptConfirm(
|
|
12036
|
-
`Delete schedule for agent ${
|
|
11862
|
+
`Delete schedule for agent ${chalk48.cyan(agentName)}?`,
|
|
12037
11863
|
false
|
|
12038
11864
|
);
|
|
12039
11865
|
if (!confirmed) {
|
|
12040
|
-
console.log(
|
|
11866
|
+
console.log(chalk48.dim("Cancelled"));
|
|
12041
11867
|
return;
|
|
12042
11868
|
}
|
|
12043
11869
|
}
|
|
@@ -12046,20 +11872,20 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12046
11872
|
composeId: resolved.composeId
|
|
12047
11873
|
});
|
|
12048
11874
|
console.log(
|
|
12049
|
-
|
|
11875
|
+
chalk48.green(`\u2713 Deleted schedule for agent ${chalk48.cyan(agentName)}`)
|
|
12050
11876
|
);
|
|
12051
11877
|
} catch (error) {
|
|
12052
|
-
console.error(
|
|
11878
|
+
console.error(chalk48.red("\u2717 Failed to delete schedule"));
|
|
12053
11879
|
if (error instanceof Error) {
|
|
12054
11880
|
if (error.message.includes("Not authenticated")) {
|
|
12055
|
-
console.error(
|
|
11881
|
+
console.error(chalk48.dim(" Run: vm0 auth login"));
|
|
12056
11882
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12057
11883
|
console.error(
|
|
12058
|
-
|
|
11884
|
+
chalk48.dim(` No schedule found for agent "${agentName}"`)
|
|
12059
11885
|
);
|
|
12060
|
-
console.error(
|
|
11886
|
+
console.error(chalk48.dim(" Run: vm0 schedule list"));
|
|
12061
11887
|
} else {
|
|
12062
|
-
console.error(
|
|
11888
|
+
console.error(chalk48.dim(` ${error.message}`));
|
|
12063
11889
|
}
|
|
12064
11890
|
}
|
|
12065
11891
|
process.exit(1);
|
|
@@ -12068,7 +11894,7 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12068
11894
|
|
|
12069
11895
|
// src/commands/schedule/enable.ts
|
|
12070
11896
|
import { Command as Command49 } from "commander";
|
|
12071
|
-
import
|
|
11897
|
+
import chalk49 from "chalk";
|
|
12072
11898
|
var enableCommand = new Command49().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12073
11899
|
try {
|
|
12074
11900
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
@@ -12077,34 +11903,34 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12077
11903
|
composeId: resolved.composeId
|
|
12078
11904
|
});
|
|
12079
11905
|
console.log(
|
|
12080
|
-
|
|
11906
|
+
chalk49.green(`\u2713 Enabled schedule for agent ${chalk49.cyan(agentName)}`)
|
|
12081
11907
|
);
|
|
12082
11908
|
} catch (error) {
|
|
12083
|
-
console.error(
|
|
11909
|
+
console.error(chalk49.red("\u2717 Failed to enable schedule"));
|
|
12084
11910
|
if (error instanceof ApiRequestError) {
|
|
12085
11911
|
if (error.code === "SCHEDULE_PAST") {
|
|
12086
|
-
console.error(
|
|
12087
|
-
console.error(
|
|
11912
|
+
console.error(chalk49.dim(" Scheduled time has already passed"));
|
|
11913
|
+
console.error(chalk49.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
12088
11914
|
} else if (error.code === "NOT_FOUND") {
|
|
12089
11915
|
console.error(
|
|
12090
|
-
|
|
11916
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
12091
11917
|
);
|
|
12092
|
-
console.error(
|
|
11918
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
12093
11919
|
} else if (error.code === "UNAUTHORIZED") {
|
|
12094
|
-
console.error(
|
|
11920
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
12095
11921
|
} else {
|
|
12096
|
-
console.error(
|
|
11922
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
12097
11923
|
}
|
|
12098
11924
|
} else if (error instanceof Error) {
|
|
12099
11925
|
if (error.message.includes("Not authenticated")) {
|
|
12100
|
-
console.error(
|
|
11926
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
12101
11927
|
} else if (error.message.includes("No schedule found")) {
|
|
12102
11928
|
console.error(
|
|
12103
|
-
|
|
11929
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
12104
11930
|
);
|
|
12105
|
-
console.error(
|
|
11931
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
12106
11932
|
} else {
|
|
12107
|
-
console.error(
|
|
11933
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
12108
11934
|
}
|
|
12109
11935
|
}
|
|
12110
11936
|
process.exit(1);
|
|
@@ -12113,7 +11939,7 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12113
11939
|
|
|
12114
11940
|
// src/commands/schedule/disable.ts
|
|
12115
11941
|
import { Command as Command50 } from "commander";
|
|
12116
|
-
import
|
|
11942
|
+
import chalk50 from "chalk";
|
|
12117
11943
|
var disableCommand = new Command50().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12118
11944
|
try {
|
|
12119
11945
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
@@ -12122,20 +11948,20 @@ var disableCommand = new Command50().name("disable").description("Disable a sche
|
|
|
12122
11948
|
composeId: resolved.composeId
|
|
12123
11949
|
});
|
|
12124
11950
|
console.log(
|
|
12125
|
-
|
|
11951
|
+
chalk50.green(`\u2713 Disabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
12126
11952
|
);
|
|
12127
11953
|
} catch (error) {
|
|
12128
|
-
console.error(
|
|
11954
|
+
console.error(chalk50.red("\u2717 Failed to disable schedule"));
|
|
12129
11955
|
if (error instanceof Error) {
|
|
12130
11956
|
if (error.message.includes("Not authenticated")) {
|
|
12131
|
-
console.error(
|
|
11957
|
+
console.error(chalk50.dim(" Run: vm0 auth login"));
|
|
12132
11958
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12133
11959
|
console.error(
|
|
12134
|
-
|
|
11960
|
+
chalk50.dim(` No schedule found for agent "${agentName}"`)
|
|
12135
11961
|
);
|
|
12136
|
-
console.error(
|
|
11962
|
+
console.error(chalk50.dim(" Run: vm0 schedule list"));
|
|
12137
11963
|
} else {
|
|
12138
|
-
console.error(
|
|
11964
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
12139
11965
|
}
|
|
12140
11966
|
}
|
|
12141
11967
|
process.exit(1);
|
|
@@ -12147,7 +11973,7 @@ var scheduleCommand = new Command51().name("schedule").description("Manage agent
|
|
|
12147
11973
|
|
|
12148
11974
|
// src/commands/usage/index.ts
|
|
12149
11975
|
import { Command as Command52 } from "commander";
|
|
12150
|
-
import
|
|
11976
|
+
import chalk51 from "chalk";
|
|
12151
11977
|
|
|
12152
11978
|
// src/lib/utils/duration-formatter.ts
|
|
12153
11979
|
function formatDuration(ms) {
|
|
@@ -12234,7 +12060,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12234
12060
|
endDate = new Date(untilMs);
|
|
12235
12061
|
} catch {
|
|
12236
12062
|
console.error(
|
|
12237
|
-
|
|
12063
|
+
chalk51.red(
|
|
12238
12064
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12239
12065
|
)
|
|
12240
12066
|
);
|
|
@@ -12249,7 +12075,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12249
12075
|
startDate = new Date(sinceMs);
|
|
12250
12076
|
} catch {
|
|
12251
12077
|
console.error(
|
|
12252
|
-
|
|
12078
|
+
chalk51.red(
|
|
12253
12079
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12254
12080
|
)
|
|
12255
12081
|
);
|
|
@@ -12259,13 +12085,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12259
12085
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
12260
12086
|
}
|
|
12261
12087
|
if (startDate >= endDate) {
|
|
12262
|
-
console.error(
|
|
12088
|
+
console.error(chalk51.red("\u2717 --since must be before --until"));
|
|
12263
12089
|
process.exit(1);
|
|
12264
12090
|
}
|
|
12265
12091
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
12266
12092
|
if (rangeMs > MAX_RANGE_MS) {
|
|
12267
12093
|
console.error(
|
|
12268
|
-
|
|
12094
|
+
chalk51.red(
|
|
12269
12095
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
12270
12096
|
)
|
|
12271
12097
|
);
|
|
@@ -12282,19 +12108,19 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12282
12108
|
);
|
|
12283
12109
|
console.log();
|
|
12284
12110
|
console.log(
|
|
12285
|
-
|
|
12111
|
+
chalk51.bold(
|
|
12286
12112
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
12287
12113
|
)
|
|
12288
12114
|
);
|
|
12289
12115
|
console.log();
|
|
12290
|
-
console.log(
|
|
12116
|
+
console.log(chalk51.dim("DATE RUNS RUN TIME"));
|
|
12291
12117
|
for (const day of filledDaily) {
|
|
12292
12118
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
12293
12119
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
12294
12120
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
12295
12121
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
12296
12122
|
}
|
|
12297
|
-
console.log(
|
|
12123
|
+
console.log(chalk51.dim("\u2500".repeat(29)));
|
|
12298
12124
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
12299
12125
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
12300
12126
|
console.log(
|
|
@@ -12304,13 +12130,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12304
12130
|
} catch (error) {
|
|
12305
12131
|
if (error instanceof Error) {
|
|
12306
12132
|
if (error.message.includes("Not authenticated")) {
|
|
12307
|
-
console.error(
|
|
12308
|
-
console.error(
|
|
12133
|
+
console.error(chalk51.red("\u2717 Not authenticated"));
|
|
12134
|
+
console.error(chalk51.dim(" Run: vm0 auth login"));
|
|
12309
12135
|
} else {
|
|
12310
|
-
console.error(
|
|
12136
|
+
console.error(chalk51.red(`\u2717 ${error.message}`));
|
|
12311
12137
|
}
|
|
12312
12138
|
} else {
|
|
12313
|
-
console.error(
|
|
12139
|
+
console.error(chalk51.red("\u2717 An unexpected error occurred"));
|
|
12314
12140
|
}
|
|
12315
12141
|
process.exit(1);
|
|
12316
12142
|
}
|
|
@@ -12321,40 +12147,40 @@ import { Command as Command56 } from "commander";
|
|
|
12321
12147
|
|
|
12322
12148
|
// src/commands/secret/list.ts
|
|
12323
12149
|
import { Command as Command53 } from "commander";
|
|
12324
|
-
import
|
|
12150
|
+
import chalk52 from "chalk";
|
|
12325
12151
|
var listCommand6 = new Command53().name("list").alias("ls").description("List all secrets").action(async () => {
|
|
12326
12152
|
try {
|
|
12327
12153
|
const result = await listSecrets();
|
|
12328
12154
|
if (result.secrets.length === 0) {
|
|
12329
|
-
console.log(
|
|
12155
|
+
console.log(chalk52.dim("No secrets found"));
|
|
12330
12156
|
console.log();
|
|
12331
12157
|
console.log("To add a secret:");
|
|
12332
|
-
console.log(
|
|
12158
|
+
console.log(chalk52.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
12333
12159
|
return;
|
|
12334
12160
|
}
|
|
12335
|
-
console.log(
|
|
12161
|
+
console.log(chalk52.bold("Secrets:"));
|
|
12336
12162
|
console.log();
|
|
12337
12163
|
for (const secret of result.secrets) {
|
|
12338
|
-
const typeIndicator = secret.type === "model-provider" ?
|
|
12339
|
-
console.log(` ${
|
|
12164
|
+
const typeIndicator = secret.type === "model-provider" ? chalk52.dim(" [model-provider]") : "";
|
|
12165
|
+
console.log(` ${chalk52.cyan(secret.name)}${typeIndicator}`);
|
|
12340
12166
|
if (secret.description) {
|
|
12341
|
-
console.log(` ${
|
|
12167
|
+
console.log(` ${chalk52.dim(secret.description)}`);
|
|
12342
12168
|
}
|
|
12343
12169
|
console.log(
|
|
12344
|
-
` ${
|
|
12170
|
+
` ${chalk52.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
12345
12171
|
);
|
|
12346
12172
|
console.log();
|
|
12347
12173
|
}
|
|
12348
|
-
console.log(
|
|
12174
|
+
console.log(chalk52.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
12349
12175
|
} catch (error) {
|
|
12350
12176
|
if (error instanceof Error) {
|
|
12351
12177
|
if (error.message.includes("Not authenticated")) {
|
|
12352
|
-
console.error(
|
|
12178
|
+
console.error(chalk52.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12353
12179
|
} else {
|
|
12354
|
-
console.error(
|
|
12180
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
12355
12181
|
}
|
|
12356
12182
|
} else {
|
|
12357
|
-
console.error(
|
|
12183
|
+
console.error(chalk52.red("\u2717 An unexpected error occurred"));
|
|
12358
12184
|
}
|
|
12359
12185
|
process.exit(1);
|
|
12360
12186
|
}
|
|
@@ -12362,7 +12188,7 @@ var listCommand6 = new Command53().name("list").alias("ls").description("List al
|
|
|
12362
12188
|
|
|
12363
12189
|
// src/commands/secret/set.ts
|
|
12364
12190
|
import { Command as Command54 } from "commander";
|
|
12365
|
-
import
|
|
12191
|
+
import chalk53 from "chalk";
|
|
12366
12192
|
var setCommand2 = new Command54().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
12367
12193
|
"-b, --body <value>",
|
|
12368
12194
|
"Secret value (required in non-interactive mode)"
|
|
@@ -12380,12 +12206,12 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12380
12206
|
value = prompted;
|
|
12381
12207
|
} else {
|
|
12382
12208
|
console.error(
|
|
12383
|
-
|
|
12209
|
+
chalk53.red("\u2717 --body is required in non-interactive mode")
|
|
12384
12210
|
);
|
|
12385
12211
|
console.log();
|
|
12386
12212
|
console.log("Usage:");
|
|
12387
12213
|
console.log(
|
|
12388
|
-
|
|
12214
|
+
chalk53.cyan(` vm0 secret set ${name} --body "your-secret-value"`)
|
|
12389
12215
|
);
|
|
12390
12216
|
process.exit(1);
|
|
12391
12217
|
}
|
|
@@ -12394,29 +12220,29 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12394
12220
|
value,
|
|
12395
12221
|
description: options.description
|
|
12396
12222
|
});
|
|
12397
|
-
console.log(
|
|
12223
|
+
console.log(chalk53.green(`\u2713 Secret "${secret.name}" saved`));
|
|
12398
12224
|
console.log();
|
|
12399
12225
|
console.log("Use in vm0.yaml:");
|
|
12400
|
-
console.log(
|
|
12401
|
-
console.log(
|
|
12226
|
+
console.log(chalk53.cyan(` environment:`));
|
|
12227
|
+
console.log(chalk53.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
12402
12228
|
} catch (error) {
|
|
12403
12229
|
if (error instanceof Error) {
|
|
12404
12230
|
if (error.message.includes("Not authenticated")) {
|
|
12405
12231
|
console.error(
|
|
12406
|
-
|
|
12232
|
+
chalk53.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12407
12233
|
);
|
|
12408
12234
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12409
|
-
console.error(
|
|
12235
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12410
12236
|
console.log();
|
|
12411
12237
|
console.log("Examples of valid secret names:");
|
|
12412
|
-
console.log(
|
|
12413
|
-
console.log(
|
|
12414
|
-
console.log(
|
|
12238
|
+
console.log(chalk53.dim(" MY_API_KEY"));
|
|
12239
|
+
console.log(chalk53.dim(" GITHUB_TOKEN"));
|
|
12240
|
+
console.log(chalk53.dim(" AWS_ACCESS_KEY_ID"));
|
|
12415
12241
|
} else {
|
|
12416
|
-
console.error(
|
|
12242
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12417
12243
|
}
|
|
12418
12244
|
} else {
|
|
12419
|
-
console.error(
|
|
12245
|
+
console.error(chalk53.red("\u2717 An unexpected error occurred"));
|
|
12420
12246
|
}
|
|
12421
12247
|
process.exit(1);
|
|
12422
12248
|
}
|
|
@@ -12425,19 +12251,19 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12425
12251
|
|
|
12426
12252
|
// src/commands/secret/delete.ts
|
|
12427
12253
|
import { Command as Command55 } from "commander";
|
|
12428
|
-
import
|
|
12254
|
+
import chalk54 from "chalk";
|
|
12429
12255
|
var deleteCommand2 = new Command55().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12430
12256
|
try {
|
|
12431
12257
|
try {
|
|
12432
12258
|
await getSecret(name);
|
|
12433
12259
|
} catch {
|
|
12434
|
-
console.error(
|
|
12260
|
+
console.error(chalk54.red(`\u2717 Secret "${name}" not found`));
|
|
12435
12261
|
process.exit(1);
|
|
12436
12262
|
}
|
|
12437
12263
|
if (!options.yes) {
|
|
12438
12264
|
if (!isInteractive()) {
|
|
12439
12265
|
console.error(
|
|
12440
|
-
|
|
12266
|
+
chalk54.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12441
12267
|
);
|
|
12442
12268
|
process.exit(1);
|
|
12443
12269
|
}
|
|
@@ -12446,21 +12272,21 @@ var deleteCommand2 = new Command55().name("delete").description("Delete a secret
|
|
|
12446
12272
|
false
|
|
12447
12273
|
);
|
|
12448
12274
|
if (!confirmed) {
|
|
12449
|
-
console.log(
|
|
12275
|
+
console.log(chalk54.dim("Cancelled"));
|
|
12450
12276
|
return;
|
|
12451
12277
|
}
|
|
12452
12278
|
}
|
|
12453
12279
|
await deleteSecret(name);
|
|
12454
|
-
console.log(
|
|
12280
|
+
console.log(chalk54.green(`\u2713 Secret "${name}" deleted`));
|
|
12455
12281
|
} catch (error) {
|
|
12456
12282
|
if (error instanceof Error) {
|
|
12457
12283
|
if (error.message.includes("Not authenticated")) {
|
|
12458
|
-
console.error(
|
|
12284
|
+
console.error(chalk54.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12459
12285
|
} else {
|
|
12460
|
-
console.error(
|
|
12286
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
12461
12287
|
}
|
|
12462
12288
|
} else {
|
|
12463
|
-
console.error(
|
|
12289
|
+
console.error(chalk54.red("\u2717 An unexpected error occurred"));
|
|
12464
12290
|
}
|
|
12465
12291
|
process.exit(1);
|
|
12466
12292
|
}
|
|
@@ -12474,7 +12300,7 @@ import { Command as Command60 } from "commander";
|
|
|
12474
12300
|
|
|
12475
12301
|
// src/commands/variable/list.ts
|
|
12476
12302
|
import { Command as Command57 } from "commander";
|
|
12477
|
-
import
|
|
12303
|
+
import chalk55 from "chalk";
|
|
12478
12304
|
function truncateValue(value, maxLength = 60) {
|
|
12479
12305
|
if (value.length <= maxLength) {
|
|
12480
12306
|
return value;
|
|
@@ -12485,35 +12311,35 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
12485
12311
|
try {
|
|
12486
12312
|
const result = await listVariables();
|
|
12487
12313
|
if (result.variables.length === 0) {
|
|
12488
|
-
console.log(
|
|
12314
|
+
console.log(chalk55.dim("No variables found"));
|
|
12489
12315
|
console.log();
|
|
12490
12316
|
console.log("To add a variable:");
|
|
12491
|
-
console.log(
|
|
12317
|
+
console.log(chalk55.cyan(" vm0 variable set MY_VAR <value>"));
|
|
12492
12318
|
return;
|
|
12493
12319
|
}
|
|
12494
|
-
console.log(
|
|
12320
|
+
console.log(chalk55.bold("Variables:"));
|
|
12495
12321
|
console.log();
|
|
12496
12322
|
for (const variable of result.variables) {
|
|
12497
12323
|
const displayValue = truncateValue(variable.value);
|
|
12498
|
-
console.log(` ${
|
|
12324
|
+
console.log(` ${chalk55.cyan(variable.name)} = ${displayValue}`);
|
|
12499
12325
|
if (variable.description) {
|
|
12500
|
-
console.log(` ${
|
|
12326
|
+
console.log(` ${chalk55.dim(variable.description)}`);
|
|
12501
12327
|
}
|
|
12502
12328
|
console.log(
|
|
12503
|
-
` ${
|
|
12329
|
+
` ${chalk55.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
12504
12330
|
);
|
|
12505
12331
|
console.log();
|
|
12506
12332
|
}
|
|
12507
|
-
console.log(
|
|
12333
|
+
console.log(chalk55.dim(`Total: ${result.variables.length} variable(s)`));
|
|
12508
12334
|
} catch (error) {
|
|
12509
12335
|
if (error instanceof Error) {
|
|
12510
12336
|
if (error.message.includes("Not authenticated")) {
|
|
12511
|
-
console.error(
|
|
12337
|
+
console.error(chalk55.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12512
12338
|
} else {
|
|
12513
|
-
console.error(
|
|
12339
|
+
console.error(chalk55.red(`\u2717 ${error.message}`));
|
|
12514
12340
|
}
|
|
12515
12341
|
} else {
|
|
12516
|
-
console.error(
|
|
12342
|
+
console.error(chalk55.red("\u2717 An unexpected error occurred"));
|
|
12517
12343
|
}
|
|
12518
12344
|
process.exit(1);
|
|
12519
12345
|
}
|
|
@@ -12521,7 +12347,7 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
12521
12347
|
|
|
12522
12348
|
// src/commands/variable/set.ts
|
|
12523
12349
|
import { Command as Command58 } from "commander";
|
|
12524
|
-
import
|
|
12350
|
+
import chalk56 from "chalk";
|
|
12525
12351
|
var setCommand3 = new Command58().name("set").description("Create or update a variable").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
12526
12352
|
async (name, value, options) => {
|
|
12527
12353
|
try {
|
|
@@ -12530,29 +12356,29 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12530
12356
|
value,
|
|
12531
12357
|
description: options.description
|
|
12532
12358
|
});
|
|
12533
|
-
console.log(
|
|
12359
|
+
console.log(chalk56.green(`\u2713 Variable "${variable.name}" saved`));
|
|
12534
12360
|
console.log();
|
|
12535
12361
|
console.log("Use in vm0.yaml:");
|
|
12536
|
-
console.log(
|
|
12537
|
-
console.log(
|
|
12362
|
+
console.log(chalk56.cyan(` environment:`));
|
|
12363
|
+
console.log(chalk56.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
12538
12364
|
} catch (error) {
|
|
12539
12365
|
if (error instanceof Error) {
|
|
12540
12366
|
if (error.message.includes("Not authenticated")) {
|
|
12541
12367
|
console.error(
|
|
12542
|
-
|
|
12368
|
+
chalk56.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12543
12369
|
);
|
|
12544
12370
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12545
|
-
console.error(
|
|
12371
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12546
12372
|
console.log();
|
|
12547
12373
|
console.log("Examples of valid variable names:");
|
|
12548
|
-
console.log(
|
|
12549
|
-
console.log(
|
|
12550
|
-
console.log(
|
|
12374
|
+
console.log(chalk56.dim(" MY_VAR"));
|
|
12375
|
+
console.log(chalk56.dim(" API_URL"));
|
|
12376
|
+
console.log(chalk56.dim(" DEBUG_MODE"));
|
|
12551
12377
|
} else {
|
|
12552
|
-
console.error(
|
|
12378
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12553
12379
|
}
|
|
12554
12380
|
} else {
|
|
12555
|
-
console.error(
|
|
12381
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
12556
12382
|
}
|
|
12557
12383
|
process.exit(1);
|
|
12558
12384
|
}
|
|
@@ -12561,14 +12387,14 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12561
12387
|
|
|
12562
12388
|
// src/commands/variable/delete.ts
|
|
12563
12389
|
import { Command as Command59 } from "commander";
|
|
12564
|
-
import
|
|
12390
|
+
import chalk57 from "chalk";
|
|
12565
12391
|
var deleteCommand3 = new Command59().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12566
12392
|
try {
|
|
12567
12393
|
try {
|
|
12568
12394
|
await getVariable(name);
|
|
12569
12395
|
} catch (error) {
|
|
12570
12396
|
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
12571
|
-
console.error(
|
|
12397
|
+
console.error(chalk57.red(`\u2717 Variable "${name}" not found`));
|
|
12572
12398
|
process.exit(1);
|
|
12573
12399
|
}
|
|
12574
12400
|
throw error;
|
|
@@ -12576,7 +12402,7 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12576
12402
|
if (!options.yes) {
|
|
12577
12403
|
if (!isInteractive()) {
|
|
12578
12404
|
console.error(
|
|
12579
|
-
|
|
12405
|
+
chalk57.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12580
12406
|
);
|
|
12581
12407
|
process.exit(1);
|
|
12582
12408
|
}
|
|
@@ -12585,21 +12411,21 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12585
12411
|
false
|
|
12586
12412
|
);
|
|
12587
12413
|
if (!confirmed) {
|
|
12588
|
-
console.log(
|
|
12414
|
+
console.log(chalk57.dim("Cancelled"));
|
|
12589
12415
|
return;
|
|
12590
12416
|
}
|
|
12591
12417
|
}
|
|
12592
12418
|
await deleteVariable(name);
|
|
12593
|
-
console.log(
|
|
12419
|
+
console.log(chalk57.green(`\u2713 Variable "${name}" deleted`));
|
|
12594
12420
|
} catch (error) {
|
|
12595
12421
|
if (error instanceof Error) {
|
|
12596
12422
|
if (error.message.includes("Not authenticated")) {
|
|
12597
|
-
console.error(
|
|
12423
|
+
console.error(chalk57.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12598
12424
|
} else {
|
|
12599
|
-
console.error(
|
|
12425
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
12600
12426
|
}
|
|
12601
12427
|
} else {
|
|
12602
|
-
console.error(
|
|
12428
|
+
console.error(chalk57.red("\u2717 An unexpected error occurred"));
|
|
12603
12429
|
}
|
|
12604
12430
|
process.exit(1);
|
|
12605
12431
|
}
|
|
@@ -12613,15 +12439,15 @@ import { Command as Command65 } from "commander";
|
|
|
12613
12439
|
|
|
12614
12440
|
// src/commands/model-provider/list.ts
|
|
12615
12441
|
import { Command as Command61 } from "commander";
|
|
12616
|
-
import
|
|
12442
|
+
import chalk58 from "chalk";
|
|
12617
12443
|
var listCommand8 = new Command61().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
12618
12444
|
try {
|
|
12619
12445
|
const result = await listModelProviders();
|
|
12620
12446
|
if (result.modelProviders.length === 0) {
|
|
12621
|
-
console.log(
|
|
12447
|
+
console.log(chalk58.dim("No model providers configured"));
|
|
12622
12448
|
console.log();
|
|
12623
12449
|
console.log("To add a model provider:");
|
|
12624
|
-
console.log(
|
|
12450
|
+
console.log(chalk58.cyan(" vm0 model-provider setup"));
|
|
12625
12451
|
return;
|
|
12626
12452
|
}
|
|
12627
12453
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -12635,16 +12461,16 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12635
12461
|
},
|
|
12636
12462
|
{}
|
|
12637
12463
|
);
|
|
12638
|
-
console.log(
|
|
12464
|
+
console.log(chalk58.bold("Model Providers:"));
|
|
12639
12465
|
console.log();
|
|
12640
12466
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
12641
|
-
console.log(` ${
|
|
12467
|
+
console.log(` ${chalk58.cyan(framework)}:`);
|
|
12642
12468
|
for (const provider of providers) {
|
|
12643
|
-
const defaultTag = provider.isDefault ?
|
|
12644
|
-
const modelTag = provider.selectedModel ?
|
|
12469
|
+
const defaultTag = provider.isDefault ? chalk58.green(" (default)") : "";
|
|
12470
|
+
const modelTag = provider.selectedModel ? chalk58.dim(` [${provider.selectedModel}]`) : "";
|
|
12645
12471
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
12646
12472
|
console.log(
|
|
12647
|
-
|
|
12473
|
+
chalk58.dim(
|
|
12648
12474
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
12649
12475
|
)
|
|
12650
12476
|
);
|
|
@@ -12652,17 +12478,17 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12652
12478
|
console.log();
|
|
12653
12479
|
}
|
|
12654
12480
|
console.log(
|
|
12655
|
-
|
|
12481
|
+
chalk58.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
12656
12482
|
);
|
|
12657
12483
|
} catch (error) {
|
|
12658
12484
|
if (error instanceof Error) {
|
|
12659
12485
|
if (error.message.includes("Not authenticated")) {
|
|
12660
|
-
console.error(
|
|
12486
|
+
console.error(chalk58.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12661
12487
|
} else {
|
|
12662
|
-
console.error(
|
|
12488
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
12663
12489
|
}
|
|
12664
12490
|
} else {
|
|
12665
|
-
console.error(
|
|
12491
|
+
console.error(chalk58.red("\u2717 An unexpected error occurred"));
|
|
12666
12492
|
}
|
|
12667
12493
|
process.exit(1);
|
|
12668
12494
|
}
|
|
@@ -12670,15 +12496,15 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12670
12496
|
|
|
12671
12497
|
// src/commands/model-provider/setup.ts
|
|
12672
12498
|
import { Command as Command62 } from "commander";
|
|
12673
|
-
import
|
|
12499
|
+
import chalk59 from "chalk";
|
|
12674
12500
|
import prompts2 from "prompts";
|
|
12675
12501
|
function validateProviderType(typeStr) {
|
|
12676
12502
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
12677
|
-
console.error(
|
|
12503
|
+
console.error(chalk59.red(`\u2717 Invalid type "${typeStr}"`));
|
|
12678
12504
|
console.log();
|
|
12679
12505
|
console.log("Valid types:");
|
|
12680
12506
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12681
|
-
console.log(` ${
|
|
12507
|
+
console.log(` ${chalk59.cyan(t)} - ${config.label}`);
|
|
12682
12508
|
}
|
|
12683
12509
|
process.exit(1);
|
|
12684
12510
|
}
|
|
@@ -12690,11 +12516,11 @@ function validateModel(type, modelStr) {
|
|
|
12690
12516
|
return modelStr;
|
|
12691
12517
|
}
|
|
12692
12518
|
if (models && !models.includes(modelStr)) {
|
|
12693
|
-
console.error(
|
|
12519
|
+
console.error(chalk59.red(`\u2717 Invalid model "${modelStr}"`));
|
|
12694
12520
|
console.log();
|
|
12695
12521
|
console.log("Valid models:");
|
|
12696
12522
|
for (const m of models) {
|
|
12697
|
-
console.log(` ${
|
|
12523
|
+
console.log(` ${chalk59.cyan(m)}`);
|
|
12698
12524
|
}
|
|
12699
12525
|
process.exit(1);
|
|
12700
12526
|
}
|
|
@@ -12703,12 +12529,12 @@ function validateModel(type, modelStr) {
|
|
|
12703
12529
|
function validateAuthMethod(type, authMethodStr) {
|
|
12704
12530
|
const authMethods = getAuthMethodsForType(type);
|
|
12705
12531
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
12706
|
-
console.error(
|
|
12532
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
12707
12533
|
console.log();
|
|
12708
12534
|
console.log("Valid auth methods:");
|
|
12709
12535
|
if (authMethods) {
|
|
12710
12536
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12711
|
-
console.log(` ${
|
|
12537
|
+
console.log(` ${chalk59.cyan(method)} - ${config.label}`);
|
|
12712
12538
|
}
|
|
12713
12539
|
}
|
|
12714
12540
|
process.exit(1);
|
|
@@ -12718,7 +12544,7 @@ function validateAuthMethod(type, authMethodStr) {
|
|
|
12718
12544
|
function parseSecrets(type, authMethod, secretArgs) {
|
|
12719
12545
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12720
12546
|
if (!secretsConfig) {
|
|
12721
|
-
console.error(
|
|
12547
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12722
12548
|
process.exit(1);
|
|
12723
12549
|
}
|
|
12724
12550
|
const secretNames = Object.keys(secretsConfig);
|
|
@@ -12726,19 +12552,19 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12726
12552
|
if (secretArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
12727
12553
|
if (secretNames.length !== 1) {
|
|
12728
12554
|
console.error(
|
|
12729
|
-
|
|
12555
|
+
chalk59.red("\u2717 Must use KEY=VALUE format for multi-secret auth methods")
|
|
12730
12556
|
);
|
|
12731
12557
|
console.log();
|
|
12732
12558
|
console.log("Required secrets:");
|
|
12733
12559
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12734
12560
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
12735
|
-
console.log(` ${
|
|
12561
|
+
console.log(` ${chalk59.cyan(name)}${requiredNote}`);
|
|
12736
12562
|
}
|
|
12737
12563
|
process.exit(1);
|
|
12738
12564
|
}
|
|
12739
12565
|
const firstSecretName = secretNames[0];
|
|
12740
12566
|
if (!firstSecretName) {
|
|
12741
|
-
console.error(
|
|
12567
|
+
console.error(chalk59.red("\u2717 No secrets defined for this auth method"));
|
|
12742
12568
|
process.exit(1);
|
|
12743
12569
|
}
|
|
12744
12570
|
return { [firstSecretName]: firstArg };
|
|
@@ -12747,7 +12573,7 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12747
12573
|
for (const arg of secretArgs) {
|
|
12748
12574
|
const eqIndex = arg.indexOf("=");
|
|
12749
12575
|
if (eqIndex === -1) {
|
|
12750
|
-
console.error(
|
|
12576
|
+
console.error(chalk59.red(`\u2717 Invalid secret format "${arg}"`));
|
|
12751
12577
|
console.log();
|
|
12752
12578
|
console.log("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
12753
12579
|
process.exit(1);
|
|
@@ -12761,17 +12587,17 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12761
12587
|
function validateSecrets(type, authMethod, secrets) {
|
|
12762
12588
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12763
12589
|
if (!secretsConfig) {
|
|
12764
|
-
console.error(
|
|
12590
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12765
12591
|
process.exit(1);
|
|
12766
12592
|
}
|
|
12767
12593
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12768
12594
|
if (fieldConfig.required && !secrets[name]) {
|
|
12769
|
-
console.error(
|
|
12595
|
+
console.error(chalk59.red(`\u2717 Missing required secret: ${name}`));
|
|
12770
12596
|
console.log();
|
|
12771
12597
|
console.log("Required secrets:");
|
|
12772
12598
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12773
12599
|
if (fc.required) {
|
|
12774
|
-
console.log(` ${
|
|
12600
|
+
console.log(` ${chalk59.cyan(n)} - ${fc.label}`);
|
|
12775
12601
|
}
|
|
12776
12602
|
}
|
|
12777
12603
|
process.exit(1);
|
|
@@ -12779,12 +12605,12 @@ function validateSecrets(type, authMethod, secrets) {
|
|
|
12779
12605
|
}
|
|
12780
12606
|
for (const name of Object.keys(secrets)) {
|
|
12781
12607
|
if (!(name in secretsConfig)) {
|
|
12782
|
-
console.error(
|
|
12608
|
+
console.error(chalk59.red(`\u2717 Unknown secret: ${name}`));
|
|
12783
12609
|
console.log();
|
|
12784
12610
|
console.log("Valid secrets:");
|
|
12785
12611
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12786
12612
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
12787
|
-
console.log(` ${
|
|
12613
|
+
console.log(` ${chalk59.cyan(n)}${requiredNote}`);
|
|
12788
12614
|
}
|
|
12789
12615
|
process.exit(1);
|
|
12790
12616
|
}
|
|
@@ -12807,7 +12633,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12807
12633
|
const defaultAuthMethod = getDefaultAuthMethod(type);
|
|
12808
12634
|
const authMethods = getAuthMethodsForType(type);
|
|
12809
12635
|
if (!defaultAuthMethod || !authMethods) {
|
|
12810
|
-
console.error(
|
|
12636
|
+
console.error(chalk59.red(`\u2717 Provider "${type}" requires --auth-method`));
|
|
12811
12637
|
process.exit(1);
|
|
12812
12638
|
}
|
|
12813
12639
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -12815,7 +12641,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12815
12641
|
authMethod = authMethodNames[0];
|
|
12816
12642
|
} else {
|
|
12817
12643
|
console.error(
|
|
12818
|
-
|
|
12644
|
+
chalk59.red(
|
|
12819
12645
|
`\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
|
|
12820
12646
|
)
|
|
12821
12647
|
);
|
|
@@ -12824,13 +12650,13 @@ function handleNonInteractiveMode(options) {
|
|
|
12824
12650
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12825
12651
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
12826
12652
|
console.log(
|
|
12827
|
-
` ${
|
|
12653
|
+
` ${chalk59.cyan(method)} - ${config.label}${defaultNote}`
|
|
12828
12654
|
);
|
|
12829
12655
|
}
|
|
12830
12656
|
console.log();
|
|
12831
12657
|
console.log("Example:");
|
|
12832
12658
|
console.log(
|
|
12833
|
-
|
|
12659
|
+
chalk59.cyan(
|
|
12834
12660
|
` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`
|
|
12835
12661
|
)
|
|
12836
12662
|
);
|
|
@@ -12850,7 +12676,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12850
12676
|
const secretArgs = options.secret;
|
|
12851
12677
|
const firstArg = secretArgs[0];
|
|
12852
12678
|
if (!firstArg) {
|
|
12853
|
-
console.error(
|
|
12679
|
+
console.error(chalk59.red("\u2717 Secret is required"));
|
|
12854
12680
|
process.exit(1);
|
|
12855
12681
|
}
|
|
12856
12682
|
let secret;
|
|
@@ -12899,7 +12725,7 @@ async function promptForModelSelection(type) {
|
|
|
12899
12725
|
if (selected === "__custom__") {
|
|
12900
12726
|
const placeholder = getCustomModelPlaceholder(type);
|
|
12901
12727
|
if (placeholder) {
|
|
12902
|
-
console.log(
|
|
12728
|
+
console.log(chalk59.dim(`Example: ${placeholder}`));
|
|
12903
12729
|
}
|
|
12904
12730
|
const customResponse = await prompts2(
|
|
12905
12731
|
{
|
|
@@ -12944,13 +12770,13 @@ function isSensitiveSecret(name) {
|
|
|
12944
12770
|
async function promptForSecrets(type, authMethod) {
|
|
12945
12771
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12946
12772
|
if (!secretsConfig) {
|
|
12947
|
-
console.error(
|
|
12773
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12948
12774
|
process.exit(1);
|
|
12949
12775
|
}
|
|
12950
12776
|
const secrets = {};
|
|
12951
12777
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12952
12778
|
if (fieldConfig.helpText) {
|
|
12953
|
-
console.log(
|
|
12779
|
+
console.log(chalk59.dim(fieldConfig.helpText));
|
|
12954
12780
|
}
|
|
12955
12781
|
const isSensitive = isSensitiveSecret(name);
|
|
12956
12782
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -12985,11 +12811,11 @@ async function promptForSecrets(type, authMethod) {
|
|
|
12985
12811
|
}
|
|
12986
12812
|
async function handleInteractiveMode() {
|
|
12987
12813
|
if (!isInteractive()) {
|
|
12988
|
-
console.error(
|
|
12814
|
+
console.error(chalk59.red("\u2717 Interactive mode requires a TTY"));
|
|
12989
12815
|
console.log();
|
|
12990
12816
|
console.log("Use non-interactive mode:");
|
|
12991
12817
|
console.log(
|
|
12992
|
-
|
|
12818
|
+
chalk59.cyan(' vm0 model-provider setup --type <type> --secret "<value>"')
|
|
12993
12819
|
);
|
|
12994
12820
|
process.exit(1);
|
|
12995
12821
|
}
|
|
@@ -13004,7 +12830,7 @@ async function handleInteractiveMode() {
|
|
|
13004
12830
|
title = `${title} \u2713`;
|
|
13005
12831
|
}
|
|
13006
12832
|
if (isExperimental) {
|
|
13007
|
-
title = `${title} ${
|
|
12833
|
+
title = `${title} ${chalk59.dim("(experimental)")}`;
|
|
13008
12834
|
}
|
|
13009
12835
|
return {
|
|
13010
12836
|
title,
|
|
@@ -13051,7 +12877,7 @@ async function handleInteractiveMode() {
|
|
|
13051
12877
|
}
|
|
13052
12878
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
13053
12879
|
console.log();
|
|
13054
|
-
console.log(
|
|
12880
|
+
console.log(chalk59.dim(config.helpText));
|
|
13055
12881
|
console.log();
|
|
13056
12882
|
if (hasAuthMethods(type)) {
|
|
13057
12883
|
const authMethod = await promptForAuthMethod(type);
|
|
@@ -13082,12 +12908,12 @@ async function handleInteractiveMode() {
|
|
|
13082
12908
|
function handleSetupError2(error) {
|
|
13083
12909
|
if (error instanceof Error) {
|
|
13084
12910
|
if (error.message.includes("Not authenticated")) {
|
|
13085
|
-
console.error(
|
|
12911
|
+
console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13086
12912
|
} else {
|
|
13087
|
-
console.error(
|
|
12913
|
+
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
13088
12914
|
}
|
|
13089
12915
|
} else {
|
|
13090
|
-
console.error(
|
|
12916
|
+
console.error(chalk59.red("\u2717 An unexpected error occurred"));
|
|
13091
12917
|
}
|
|
13092
12918
|
process.exit(1);
|
|
13093
12919
|
}
|
|
@@ -13104,7 +12930,7 @@ async function promptSetAsDefault(type, framework, isDefault) {
|
|
|
13104
12930
|
);
|
|
13105
12931
|
if (response.setDefault) {
|
|
13106
12932
|
await setModelProviderDefault(type);
|
|
13107
|
-
console.log(
|
|
12933
|
+
console.log(chalk59.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
13108
12934
|
}
|
|
13109
12935
|
}
|
|
13110
12936
|
function collectSecrets(value, previous) {
|
|
@@ -13131,7 +12957,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13131
12957
|
model: options.model
|
|
13132
12958
|
});
|
|
13133
12959
|
} else if (options.type || secretArgs.length > 0) {
|
|
13134
|
-
console.error(
|
|
12960
|
+
console.error(chalk59.red("\u2717 Both --type and --secret are required"));
|
|
13135
12961
|
process.exit(1);
|
|
13136
12962
|
} else {
|
|
13137
12963
|
const result = await handleInteractiveMode();
|
|
@@ -13149,11 +12975,11 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13149
12975
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
13150
12976
|
if (!hasModelSelection(input.type)) {
|
|
13151
12977
|
console.log(
|
|
13152
|
-
|
|
12978
|
+
chalk59.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
13153
12979
|
);
|
|
13154
12980
|
} else {
|
|
13155
12981
|
console.log(
|
|
13156
|
-
|
|
12982
|
+
chalk59.green(
|
|
13157
12983
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
13158
12984
|
)
|
|
13159
12985
|
);
|
|
@@ -13178,7 +13004,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13178
13004
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
13179
13005
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
13180
13006
|
console.log(
|
|
13181
|
-
|
|
13007
|
+
chalk59.green(
|
|
13182
13008
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
13183
13009
|
)
|
|
13184
13010
|
);
|
|
@@ -13197,31 +13023,31 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13197
13023
|
|
|
13198
13024
|
// src/commands/model-provider/delete.ts
|
|
13199
13025
|
import { Command as Command63 } from "commander";
|
|
13200
|
-
import
|
|
13026
|
+
import chalk60 from "chalk";
|
|
13201
13027
|
var deleteCommand4 = new Command63().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
13202
13028
|
try {
|
|
13203
13029
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
13204
|
-
console.error(
|
|
13030
|
+
console.error(chalk60.red(`\u2717 Invalid type "${type}"`));
|
|
13205
13031
|
console.log();
|
|
13206
13032
|
console.log("Valid types:");
|
|
13207
13033
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13208
|
-
console.log(` ${
|
|
13034
|
+
console.log(` ${chalk60.cyan(t)} - ${config.label}`);
|
|
13209
13035
|
}
|
|
13210
13036
|
process.exit(1);
|
|
13211
13037
|
}
|
|
13212
13038
|
await deleteModelProvider(type);
|
|
13213
|
-
console.log(
|
|
13039
|
+
console.log(chalk60.green(`\u2713 Model provider "${type}" deleted`));
|
|
13214
13040
|
} catch (error) {
|
|
13215
13041
|
if (error instanceof Error) {
|
|
13216
13042
|
if (error.message.includes("not found")) {
|
|
13217
|
-
console.error(
|
|
13043
|
+
console.error(chalk60.red(`\u2717 Model provider "${type}" not found`));
|
|
13218
13044
|
} else if (error.message.includes("Not authenticated")) {
|
|
13219
|
-
console.error(
|
|
13045
|
+
console.error(chalk60.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13220
13046
|
} else {
|
|
13221
|
-
console.error(
|
|
13047
|
+
console.error(chalk60.red(`\u2717 ${error.message}`));
|
|
13222
13048
|
}
|
|
13223
13049
|
} else {
|
|
13224
|
-
console.error(
|
|
13050
|
+
console.error(chalk60.red("\u2717 An unexpected error occurred"));
|
|
13225
13051
|
}
|
|
13226
13052
|
process.exit(1);
|
|
13227
13053
|
}
|
|
@@ -13229,35 +13055,35 @@ var deleteCommand4 = new Command63().name("delete").description("Delete a model
|
|
|
13229
13055
|
|
|
13230
13056
|
// src/commands/model-provider/set-default.ts
|
|
13231
13057
|
import { Command as Command64 } from "commander";
|
|
13232
|
-
import
|
|
13058
|
+
import chalk61 from "chalk";
|
|
13233
13059
|
var setDefaultCommand = new Command64().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type) => {
|
|
13234
13060
|
try {
|
|
13235
13061
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
13236
|
-
console.error(
|
|
13062
|
+
console.error(chalk61.red(`\u2717 Invalid type "${type}"`));
|
|
13237
13063
|
console.log();
|
|
13238
13064
|
console.log("Valid types:");
|
|
13239
13065
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13240
|
-
console.log(` ${
|
|
13066
|
+
console.log(` ${chalk61.cyan(t)} - ${config.label}`);
|
|
13241
13067
|
}
|
|
13242
13068
|
process.exit(1);
|
|
13243
13069
|
}
|
|
13244
13070
|
const provider = await setModelProviderDefault(type);
|
|
13245
13071
|
console.log(
|
|
13246
|
-
|
|
13072
|
+
chalk61.green(
|
|
13247
13073
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
13248
13074
|
)
|
|
13249
13075
|
);
|
|
13250
13076
|
} catch (error) {
|
|
13251
13077
|
if (error instanceof Error) {
|
|
13252
13078
|
if (error.message.includes("not found")) {
|
|
13253
|
-
console.error(
|
|
13079
|
+
console.error(chalk61.red(`\u2717 Model provider "${type}" not found`));
|
|
13254
13080
|
} else if (error.message.includes("Not authenticated")) {
|
|
13255
|
-
console.error(
|
|
13081
|
+
console.error(chalk61.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13256
13082
|
} else {
|
|
13257
|
-
console.error(
|
|
13083
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
13258
13084
|
}
|
|
13259
13085
|
} else {
|
|
13260
|
-
console.error(
|
|
13086
|
+
console.error(chalk61.red("\u2717 An unexpected error occurred"));
|
|
13261
13087
|
}
|
|
13262
13088
|
process.exit(1);
|
|
13263
13089
|
}
|
|
@@ -13271,7 +13097,7 @@ import { Command as Command67 } from "commander";
|
|
|
13271
13097
|
|
|
13272
13098
|
// src/commands/connector/connect.ts
|
|
13273
13099
|
import { Command as Command66 } from "commander";
|
|
13274
|
-
import
|
|
13100
|
+
import chalk62 from "chalk";
|
|
13275
13101
|
import { initClient as initClient11 } from "@ts-rest/core";
|
|
13276
13102
|
function delay2(ms) {
|
|
13277
13103
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -13293,14 +13119,14 @@ async function getHeaders2() {
|
|
|
13293
13119
|
var connectCommand = new Command66().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type) => {
|
|
13294
13120
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13295
13121
|
if (!parseResult.success) {
|
|
13296
|
-
console.error(
|
|
13122
|
+
console.error(chalk62.red(`Unknown connector type: ${type}`));
|
|
13297
13123
|
console.error("Available connectors: github");
|
|
13298
13124
|
process.exit(1);
|
|
13299
13125
|
}
|
|
13300
13126
|
const connectorType = parseResult.data;
|
|
13301
13127
|
const apiUrl = await getApiUrl();
|
|
13302
13128
|
const headers = await getHeaders2();
|
|
13303
|
-
console.log(`Connecting ${
|
|
13129
|
+
console.log(`Connecting ${chalk62.cyan(type)}...`);
|
|
13304
13130
|
const sessionsClient = initClient11(connectorSessionsContract, {
|
|
13305
13131
|
baseUrl: apiUrl,
|
|
13306
13132
|
baseHeaders: headers,
|
|
@@ -13313,16 +13139,16 @@ var connectCommand = new Command66().name("connect").description("Connect a thir
|
|
|
13313
13139
|
if (createResult.status !== 200) {
|
|
13314
13140
|
const errorBody = createResult.body;
|
|
13315
13141
|
console.error(
|
|
13316
|
-
|
|
13142
|
+
chalk62.red(`Failed to create session: ${errorBody.error?.message}`)
|
|
13317
13143
|
);
|
|
13318
13144
|
process.exit(1);
|
|
13319
13145
|
}
|
|
13320
13146
|
const session = createResult.body;
|
|
13321
13147
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13322
|
-
console.log(
|
|
13323
|
-
console.log(
|
|
13148
|
+
console.log(chalk62.green("\nSession created"));
|
|
13149
|
+
console.log(chalk62.cyan(`
|
|
13324
13150
|
To connect, visit: ${verificationUrl}`));
|
|
13325
|
-
console.log(`Session code: ${
|
|
13151
|
+
console.log(`Session code: ${chalk62.bold(session.code)}`);
|
|
13326
13152
|
console.log(
|
|
13327
13153
|
`
|
|
13328
13154
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
@@ -13348,7 +13174,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
13348
13174
|
if (statusResult.status !== 200) {
|
|
13349
13175
|
const errorBody = statusResult.body;
|
|
13350
13176
|
console.error(
|
|
13351
|
-
|
|
13177
|
+
chalk62.red(`
|
|
13352
13178
|
Failed to check status: ${errorBody.error?.message}`)
|
|
13353
13179
|
);
|
|
13354
13180
|
process.exit(1);
|
|
@@ -13356,17 +13182,17 @@ Failed to check status: ${errorBody.error?.message}`)
|
|
|
13356
13182
|
const status = statusResult.body;
|
|
13357
13183
|
switch (status.status) {
|
|
13358
13184
|
case "complete":
|
|
13359
|
-
console.log(
|
|
13185
|
+
console.log(chalk62.green(`
|
|
13360
13186
|
|
|
13361
13187
|
${type} connected successfully!`));
|
|
13362
13188
|
return;
|
|
13363
13189
|
case "expired":
|
|
13364
|
-
console.log(
|
|
13190
|
+
console.log(chalk62.red("\nSession expired. Please try again."));
|
|
13365
13191
|
process.exit(1);
|
|
13366
13192
|
break;
|
|
13367
13193
|
case "error":
|
|
13368
13194
|
console.log(
|
|
13369
|
-
|
|
13195
|
+
chalk62.red(
|
|
13370
13196
|
`
|
|
13371
13197
|
Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13372
13198
|
)
|
|
@@ -13374,11 +13200,11 @@ Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
|
13374
13200
|
process.exit(1);
|
|
13375
13201
|
break;
|
|
13376
13202
|
case "pending":
|
|
13377
|
-
process.stdout.write(
|
|
13203
|
+
process.stdout.write(chalk62.dim("."));
|
|
13378
13204
|
break;
|
|
13379
13205
|
}
|
|
13380
13206
|
}
|
|
13381
|
-
console.log(
|
|
13207
|
+
console.log(chalk62.red("\nSession timed out. Please try again."));
|
|
13382
13208
|
process.exit(1);
|
|
13383
13209
|
});
|
|
13384
13210
|
|
|
@@ -13387,24 +13213,24 @@ var connectorCommand = new Command67().name("connector").description("Manage thi
|
|
|
13387
13213
|
|
|
13388
13214
|
// src/commands/onboard/index.ts
|
|
13389
13215
|
import { Command as Command68 } from "commander";
|
|
13390
|
-
import
|
|
13216
|
+
import chalk66 from "chalk";
|
|
13391
13217
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
13392
13218
|
import { existsSync as existsSync11 } from "fs";
|
|
13393
13219
|
|
|
13394
13220
|
// src/lib/ui/welcome-box.ts
|
|
13395
|
-
import
|
|
13221
|
+
import chalk63 from "chalk";
|
|
13396
13222
|
var gradientColors = [
|
|
13397
|
-
|
|
13223
|
+
chalk63.hex("#FFAB5E"),
|
|
13398
13224
|
// Line 1 - lightest
|
|
13399
|
-
|
|
13225
|
+
chalk63.hex("#FF9642"),
|
|
13400
13226
|
// Line 2
|
|
13401
|
-
|
|
13227
|
+
chalk63.hex("#FF8228"),
|
|
13402
13228
|
// Line 3
|
|
13403
|
-
|
|
13229
|
+
chalk63.hex("#FF6D0A"),
|
|
13404
13230
|
// Line 4
|
|
13405
|
-
|
|
13231
|
+
chalk63.hex("#E85D00"),
|
|
13406
13232
|
// Line 5
|
|
13407
|
-
|
|
13233
|
+
chalk63.hex("#CC4E00")
|
|
13408
13234
|
// Line 6 - darkest
|
|
13409
13235
|
];
|
|
13410
13236
|
var vm0LogoLines = [
|
|
@@ -13426,15 +13252,15 @@ function renderVm0Banner() {
|
|
|
13426
13252
|
function renderOnboardWelcome() {
|
|
13427
13253
|
renderVm0Banner();
|
|
13428
13254
|
console.log(` Build agentic workflows using natural language.`);
|
|
13429
|
-
console.log(` ${
|
|
13255
|
+
console.log(` ${chalk63.dim("Currently in beta, enjoy it free.")}`);
|
|
13430
13256
|
console.log(
|
|
13431
|
-
` ${
|
|
13257
|
+
` ${chalk63.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
13432
13258
|
);
|
|
13433
13259
|
console.log();
|
|
13434
13260
|
}
|
|
13435
13261
|
|
|
13436
13262
|
// src/lib/ui/step-runner.ts
|
|
13437
|
-
import
|
|
13263
|
+
import chalk64 from "chalk";
|
|
13438
13264
|
function createStepRunner(options = true) {
|
|
13439
13265
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
13440
13266
|
const interactive = opts.interactive ?? true;
|
|
@@ -13449,25 +13275,25 @@ function createStepRunner(options = true) {
|
|
|
13449
13275
|
}
|
|
13450
13276
|
for (const [i, step] of completedSteps.entries()) {
|
|
13451
13277
|
if (step.failed) {
|
|
13452
|
-
console.log(
|
|
13278
|
+
console.log(chalk64.red(`\u2717 ${step.label}`));
|
|
13453
13279
|
} else {
|
|
13454
|
-
console.log(
|
|
13280
|
+
console.log(chalk64.green(`\u25CF ${step.label}`));
|
|
13455
13281
|
}
|
|
13456
13282
|
const isLastStep = i === completedSteps.length - 1;
|
|
13457
13283
|
if (!isLastStep || !isFinal) {
|
|
13458
|
-
console.log(
|
|
13284
|
+
console.log(chalk64.dim("\u2502"));
|
|
13459
13285
|
}
|
|
13460
13286
|
}
|
|
13461
13287
|
}
|
|
13462
13288
|
async function executeStep(label, fn, isFinal) {
|
|
13463
13289
|
let stepFailed = false;
|
|
13464
|
-
console.log(
|
|
13290
|
+
console.log(chalk64.yellow(`\u25CB ${label}`));
|
|
13465
13291
|
const ctx = {
|
|
13466
13292
|
connector() {
|
|
13467
|
-
console.log(
|
|
13293
|
+
console.log(chalk64.dim("\u2502"));
|
|
13468
13294
|
},
|
|
13469
13295
|
detail(message) {
|
|
13470
|
-
console.log(`${
|
|
13296
|
+
console.log(`${chalk64.dim("\u2502")} ${message}`);
|
|
13471
13297
|
},
|
|
13472
13298
|
async prompt(promptFn) {
|
|
13473
13299
|
return await promptFn();
|
|
@@ -13484,12 +13310,12 @@ function createStepRunner(options = true) {
|
|
|
13484
13310
|
redrawCompletedSteps(isFinal);
|
|
13485
13311
|
} else {
|
|
13486
13312
|
if (stepFailed) {
|
|
13487
|
-
console.log(
|
|
13313
|
+
console.log(chalk64.red(`\u2717 ${label}`));
|
|
13488
13314
|
} else {
|
|
13489
|
-
console.log(
|
|
13315
|
+
console.log(chalk64.green(`\u25CF ${label}`));
|
|
13490
13316
|
}
|
|
13491
13317
|
if (!isFinal) {
|
|
13492
|
-
console.log(
|
|
13318
|
+
console.log(chalk64.dim("\u2502"));
|
|
13493
13319
|
}
|
|
13494
13320
|
}
|
|
13495
13321
|
}
|
|
@@ -13646,7 +13472,7 @@ async function setupModelProvider(type, secret, options) {
|
|
|
13646
13472
|
|
|
13647
13473
|
// src/lib/domain/onboard/claude-setup.ts
|
|
13648
13474
|
import { spawn as spawn3 } from "child_process";
|
|
13649
|
-
import
|
|
13475
|
+
import chalk65 from "chalk";
|
|
13650
13476
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
13651
13477
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
13652
13478
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -13683,12 +13509,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
13683
13509
|
}
|
|
13684
13510
|
function handlePluginError(error, context) {
|
|
13685
13511
|
const displayContext = context ?? "Claude plugin";
|
|
13686
|
-
console.error(
|
|
13512
|
+
console.error(chalk65.red(`Failed to install ${displayContext}`));
|
|
13687
13513
|
if (error instanceof Error) {
|
|
13688
|
-
console.error(
|
|
13514
|
+
console.error(chalk65.red(error.message));
|
|
13689
13515
|
}
|
|
13690
13516
|
console.error(
|
|
13691
|
-
|
|
13517
|
+
chalk65.dim("Please ensure Claude CLI is installed and accessible.")
|
|
13692
13518
|
);
|
|
13693
13519
|
process.exit(1);
|
|
13694
13520
|
}
|
|
@@ -13731,7 +13557,7 @@ async function updateMarketplace() {
|
|
|
13731
13557
|
]);
|
|
13732
13558
|
if (!result.success) {
|
|
13733
13559
|
console.warn(
|
|
13734
|
-
|
|
13560
|
+
chalk65.yellow(
|
|
13735
13561
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
13736
13562
|
)
|
|
13737
13563
|
);
|
|
@@ -13769,7 +13595,7 @@ async function handleAuthentication(ctx) {
|
|
|
13769
13595
|
return;
|
|
13770
13596
|
}
|
|
13771
13597
|
if (!ctx.interactive) {
|
|
13772
|
-
console.error(
|
|
13598
|
+
console.error(chalk66.red("Error: Not authenticated"));
|
|
13773
13599
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
13774
13600
|
process.exit(1);
|
|
13775
13601
|
}
|
|
@@ -13777,16 +13603,16 @@ async function handleAuthentication(ctx) {
|
|
|
13777
13603
|
onInitiating: () => {
|
|
13778
13604
|
},
|
|
13779
13605
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
13780
|
-
step.detail(`Copy code: ${
|
|
13781
|
-
step.detail(`Open: ${
|
|
13782
|
-
step.detail(
|
|
13606
|
+
step.detail(`Copy code: ${chalk66.cyan.bold(code)}`);
|
|
13607
|
+
step.detail(`Open: ${chalk66.cyan(url)}`);
|
|
13608
|
+
step.detail(chalk66.dim(`Expires in ${expiresIn} minutes`));
|
|
13783
13609
|
},
|
|
13784
13610
|
onPolling: () => {
|
|
13785
13611
|
},
|
|
13786
13612
|
onSuccess: () => {
|
|
13787
13613
|
},
|
|
13788
13614
|
onError: (error) => {
|
|
13789
|
-
console.error(
|
|
13615
|
+
console.error(chalk66.red(`
|
|
13790
13616
|
${error.message}`));
|
|
13791
13617
|
process.exit(1);
|
|
13792
13618
|
}
|
|
@@ -13800,7 +13626,7 @@ async function handleModelProvider(ctx) {
|
|
|
13800
13626
|
return;
|
|
13801
13627
|
}
|
|
13802
13628
|
if (!ctx.interactive) {
|
|
13803
|
-
console.error(
|
|
13629
|
+
console.error(chalk66.red("Error: No model provider configured"));
|
|
13804
13630
|
console.error("Run 'vm0 model-provider setup' first");
|
|
13805
13631
|
process.exit(1);
|
|
13806
13632
|
}
|
|
@@ -13821,14 +13647,14 @@ async function handleModelProvider(ctx) {
|
|
|
13821
13647
|
const selectedChoice = choices.find((c25) => c25.type === providerType);
|
|
13822
13648
|
if (selectedChoice?.helpText) {
|
|
13823
13649
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
13824
|
-
step.detail(
|
|
13650
|
+
step.detail(chalk66.dim(line));
|
|
13825
13651
|
}
|
|
13826
13652
|
}
|
|
13827
13653
|
const secret = await step.prompt(
|
|
13828
13654
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
13829
13655
|
);
|
|
13830
13656
|
if (!secret) {
|
|
13831
|
-
console.log(
|
|
13657
|
+
console.log(chalk66.dim("Cancelled"));
|
|
13832
13658
|
process.exit(0);
|
|
13833
13659
|
}
|
|
13834
13660
|
let selectedModel;
|
|
@@ -13847,7 +13673,7 @@ async function handleModelProvider(ctx) {
|
|
|
13847
13673
|
() => promptSelect("Select model:", modelChoices)
|
|
13848
13674
|
);
|
|
13849
13675
|
if (modelSelection === void 0) {
|
|
13850
|
-
console.log(
|
|
13676
|
+
console.log(chalk66.dim("Cancelled"));
|
|
13851
13677
|
process.exit(0);
|
|
13852
13678
|
}
|
|
13853
13679
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -13857,7 +13683,7 @@ async function handleModelProvider(ctx) {
|
|
|
13857
13683
|
});
|
|
13858
13684
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
13859
13685
|
step.detail(
|
|
13860
|
-
|
|
13686
|
+
chalk66.green(
|
|
13861
13687
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
13862
13688
|
)
|
|
13863
13689
|
);
|
|
@@ -13888,7 +13714,7 @@ async function handleAgentCreation(ctx) {
|
|
|
13888
13714
|
agentName = inputName;
|
|
13889
13715
|
if (existsSync11(agentName)) {
|
|
13890
13716
|
step.detail(
|
|
13891
|
-
|
|
13717
|
+
chalk66.yellow(`${agentName}/ already exists, choose another name`)
|
|
13892
13718
|
);
|
|
13893
13719
|
} else {
|
|
13894
13720
|
folderExists = false;
|
|
@@ -13897,22 +13723,22 @@ async function handleAgentCreation(ctx) {
|
|
|
13897
13723
|
} else {
|
|
13898
13724
|
if (!validateAgentName(agentName)) {
|
|
13899
13725
|
console.error(
|
|
13900
|
-
|
|
13726
|
+
chalk66.red(
|
|
13901
13727
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
13902
13728
|
)
|
|
13903
13729
|
);
|
|
13904
13730
|
process.exit(1);
|
|
13905
13731
|
}
|
|
13906
13732
|
if (existsSync11(agentName)) {
|
|
13907
|
-
console.error(
|
|
13733
|
+
console.error(chalk66.red(`${agentName}/ already exists`));
|
|
13908
13734
|
console.log();
|
|
13909
13735
|
console.log("Remove it first or choose a different name:");
|
|
13910
|
-
console.log(
|
|
13736
|
+
console.log(chalk66.cyan(` rm -rf ${agentName}`));
|
|
13911
13737
|
process.exit(1);
|
|
13912
13738
|
}
|
|
13913
13739
|
}
|
|
13914
13740
|
await mkdir8(agentName, { recursive: true });
|
|
13915
|
-
step.detail(
|
|
13741
|
+
step.detail(chalk66.green(`Created ${agentName}/`));
|
|
13916
13742
|
});
|
|
13917
13743
|
return agentName;
|
|
13918
13744
|
}
|
|
@@ -13928,7 +13754,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13928
13754
|
shouldInstall = confirmed ?? true;
|
|
13929
13755
|
}
|
|
13930
13756
|
if (!shouldInstall) {
|
|
13931
|
-
step.detail(
|
|
13757
|
+
step.detail(chalk66.dim("Skipped"));
|
|
13932
13758
|
return;
|
|
13933
13759
|
}
|
|
13934
13760
|
const scope = "project";
|
|
@@ -13936,7 +13762,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13936
13762
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
13937
13763
|
const result = await installVm0Plugin(scope, agentDir);
|
|
13938
13764
|
step.detail(
|
|
13939
|
-
|
|
13765
|
+
chalk66.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13940
13766
|
);
|
|
13941
13767
|
pluginInstalled = true;
|
|
13942
13768
|
} catch (error) {
|
|
@@ -13947,14 +13773,14 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13947
13773
|
}
|
|
13948
13774
|
function printNextSteps(agentName, pluginInstalled) {
|
|
13949
13775
|
console.log();
|
|
13950
|
-
console.log(
|
|
13776
|
+
console.log(chalk66.bold("Next step:"));
|
|
13951
13777
|
console.log();
|
|
13952
13778
|
if (pluginInstalled) {
|
|
13953
13779
|
console.log(
|
|
13954
|
-
` ${
|
|
13780
|
+
` ${chalk66.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
13955
13781
|
);
|
|
13956
13782
|
} else {
|
|
13957
|
-
console.log(` ${
|
|
13783
|
+
console.log(` ${chalk66.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
13958
13784
|
}
|
|
13959
13785
|
console.log();
|
|
13960
13786
|
}
|
|
@@ -13982,14 +13808,14 @@ var onboardCommand = new Command68().name("onboard").description("Guided setup f
|
|
|
13982
13808
|
|
|
13983
13809
|
// src/commands/setup-claude/index.ts
|
|
13984
13810
|
import { Command as Command69 } from "commander";
|
|
13985
|
-
import
|
|
13811
|
+
import chalk67 from "chalk";
|
|
13986
13812
|
var setupClaudeCommand = new Command69().name("setup-claude").description("Install VM0 Claude Plugin").option("--agent-dir <dir>", "Agent directory to run install in").option("--scope <scope>", "Installation scope (user or project)", "project").action(async (options) => {
|
|
13987
|
-
console.log(
|
|
13813
|
+
console.log(chalk67.dim("Installing VM0 Claude Plugin..."));
|
|
13988
13814
|
const scope = options.scope === "user" ? "user" : "project";
|
|
13989
13815
|
try {
|
|
13990
13816
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
13991
13817
|
console.log(
|
|
13992
|
-
|
|
13818
|
+
chalk67.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13993
13819
|
);
|
|
13994
13820
|
} catch (error) {
|
|
13995
13821
|
handlePluginError(error);
|
|
@@ -13998,7 +13824,7 @@ var setupClaudeCommand = new Command69().name("setup-claude").description("Insta
|
|
|
13998
13824
|
console.log("Next step:");
|
|
13999
13825
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
14000
13826
|
console.log(
|
|
14001
|
-
|
|
13827
|
+
chalk67.cyan(
|
|
14002
13828
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
14003
13829
|
)
|
|
14004
13830
|
);
|
|
@@ -14009,7 +13835,7 @@ import { Command as Command71 } from "commander";
|
|
|
14009
13835
|
|
|
14010
13836
|
// src/commands/dev-tool/compose.ts
|
|
14011
13837
|
import { Command as Command70 } from "commander";
|
|
14012
|
-
import
|
|
13838
|
+
import chalk68 from "chalk";
|
|
14013
13839
|
import { initClient as initClient12 } from "@ts-rest/core";
|
|
14014
13840
|
function sleep2(ms) {
|
|
14015
13841
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -14061,7 +13887,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
14061
13887
|
const job = await getComposeJobStatus(jobId);
|
|
14062
13888
|
if (!jsonMode) {
|
|
14063
13889
|
console.log(
|
|
14064
|
-
|
|
13890
|
+
chalk68.dim(`[${timestamp()}] Polling... status=${job.status}`)
|
|
14065
13891
|
);
|
|
14066
13892
|
}
|
|
14067
13893
|
if (job.status === "completed" || job.status === "failed") {
|
|
@@ -14094,7 +13920,7 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
14094
13920
|
options.overwrite
|
|
14095
13921
|
);
|
|
14096
13922
|
if (!options.json) {
|
|
14097
|
-
console.log(`Job ID: ${
|
|
13923
|
+
console.log(`Job ID: ${chalk68.cyan(jobId)}`);
|
|
14098
13924
|
console.log();
|
|
14099
13925
|
}
|
|
14100
13926
|
if (initialStatus === "completed" || initialStatus === "failed") {
|
|
@@ -14128,7 +13954,7 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
14128
13954
|
);
|
|
14129
13955
|
} else {
|
|
14130
13956
|
console.error(
|
|
14131
|
-
|
|
13957
|
+
chalk68.red(
|
|
14132
13958
|
`\u2717 ${error instanceof Error ? error.message : String(error)}`
|
|
14133
13959
|
)
|
|
14134
13960
|
);
|
|
@@ -14139,21 +13965,21 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
14139
13965
|
);
|
|
14140
13966
|
function displayResult(job) {
|
|
14141
13967
|
if (job.status === "completed" && job.result) {
|
|
14142
|
-
console.log(
|
|
14143
|
-
console.log(` Compose ID: ${
|
|
14144
|
-
console.log(` Name: ${
|
|
14145
|
-
console.log(` Version: ${
|
|
13968
|
+
console.log(chalk68.green("\u2713 Compose completed!"));
|
|
13969
|
+
console.log(` Compose ID: ${chalk68.cyan(job.result.composeId)}`);
|
|
13970
|
+
console.log(` Name: ${chalk68.cyan(job.result.composeName)}`);
|
|
13971
|
+
console.log(` Version: ${chalk68.cyan(job.result.versionId.slice(0, 8))}`);
|
|
14146
13972
|
if (job.result.warnings.length > 0) {
|
|
14147
13973
|
console.log();
|
|
14148
|
-
console.log(
|
|
13974
|
+
console.log(chalk68.yellow(" Warnings:"));
|
|
14149
13975
|
for (const warning of job.result.warnings) {
|
|
14150
|
-
console.log(
|
|
13976
|
+
console.log(chalk68.yellow(` - ${warning}`));
|
|
14151
13977
|
}
|
|
14152
13978
|
}
|
|
14153
13979
|
} else if (job.status === "failed") {
|
|
14154
|
-
console.log(
|
|
13980
|
+
console.log(chalk68.red("\u2717 Compose failed!"));
|
|
14155
13981
|
if (job.error) {
|
|
14156
|
-
console.log(` Error: ${
|
|
13982
|
+
console.log(` Error: ${chalk68.red(job.error)}`);
|
|
14157
13983
|
}
|
|
14158
13984
|
} else {
|
|
14159
13985
|
console.log(`Status: ${job.status}`);
|
|
@@ -14165,7 +13991,7 @@ var devToolCommand = new Command71().name("dev-tool").description("Developer too
|
|
|
14165
13991
|
|
|
14166
13992
|
// src/index.ts
|
|
14167
13993
|
var program = new Command72();
|
|
14168
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.24.
|
|
13994
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.24.1");
|
|
14169
13995
|
program.addCommand(authCommand);
|
|
14170
13996
|
program.addCommand(infoCommand);
|
|
14171
13997
|
program.addCommand(composeCommand);
|