@vm0/cli 9.18.0 → 9.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +580 -366
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command68 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth/index.ts
|
|
7
7
|
import { Command as Command5 } from "commander";
|
|
@@ -3772,6 +3772,26 @@ async function httpGet(path16) {
|
|
|
3772
3772
|
headers
|
|
3773
3773
|
});
|
|
3774
3774
|
}
|
|
3775
|
+
async function httpPost(path16, body) {
|
|
3776
|
+
const baseUrl = await getBaseUrl();
|
|
3777
|
+
const headers = await getRawHeaders();
|
|
3778
|
+
return fetch(`${baseUrl}${path16}`, {
|
|
3779
|
+
method: "POST",
|
|
3780
|
+
headers: {
|
|
3781
|
+
...headers,
|
|
3782
|
+
"Content-Type": "application/json"
|
|
3783
|
+
},
|
|
3784
|
+
body: JSON.stringify(body)
|
|
3785
|
+
});
|
|
3786
|
+
}
|
|
3787
|
+
async function httpDelete(path16) {
|
|
3788
|
+
const baseUrl = await getBaseUrl();
|
|
3789
|
+
const headers = await getRawHeaders();
|
|
3790
|
+
return fetch(`${baseUrl}${path16}`, {
|
|
3791
|
+
method: "DELETE",
|
|
3792
|
+
headers
|
|
3793
|
+
});
|
|
3794
|
+
}
|
|
3775
3795
|
|
|
3776
3796
|
// src/lib/api/domains/composes.ts
|
|
3777
3797
|
import { initClient } from "@ts-rest/core";
|
|
@@ -5366,7 +5386,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
5366
5386
|
)
|
|
5367
5387
|
);
|
|
5368
5388
|
if (options.autoUpdate !== false) {
|
|
5369
|
-
await silentUpgradeAfterCommand("9.
|
|
5389
|
+
await silentUpgradeAfterCommand("9.19.0");
|
|
5370
5390
|
}
|
|
5371
5391
|
} catch (error) {
|
|
5372
5392
|
if (error instanceof Error) {
|
|
@@ -7597,7 +7617,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
7597
7617
|
}
|
|
7598
7618
|
showNextSteps(result);
|
|
7599
7619
|
if (options.autoUpdate !== false) {
|
|
7600
|
-
await silentUpgradeAfterCommand("9.
|
|
7620
|
+
await silentUpgradeAfterCommand("9.19.0");
|
|
7601
7621
|
}
|
|
7602
7622
|
} catch (error) {
|
|
7603
7623
|
handleRunError(error, identifier);
|
|
@@ -9104,7 +9124,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9104
9124
|
).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(
|
|
9105
9125
|
async (prompt, options) => {
|
|
9106
9126
|
if (options.autoUpdate !== false) {
|
|
9107
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9127
|
+
const shouldExit = await checkAndUpgrade("9.19.0", prompt);
|
|
9108
9128
|
if (shouldExit) {
|
|
9109
9129
|
process.exit(0);
|
|
9110
9130
|
}
|
|
@@ -9679,7 +9699,7 @@ var setCommand = new Command33().name("set").description("Set your scope slug").
|
|
|
9679
9699
|
var scopeCommand = new Command34().name("scope").description("Manage your scope (namespace for agents)").addCommand(statusCommand4).addCommand(setCommand);
|
|
9680
9700
|
|
|
9681
9701
|
// src/commands/agent/index.ts
|
|
9682
|
-
import { Command as
|
|
9702
|
+
import { Command as Command43 } from "commander";
|
|
9683
9703
|
|
|
9684
9704
|
// src/commands/agent/clone.ts
|
|
9685
9705
|
import { Command as Command35 } from "commander";
|
|
@@ -10099,12 +10119,206 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10099
10119
|
}
|
|
10100
10120
|
});
|
|
10101
10121
|
|
|
10122
|
+
// src/commands/agent/public.ts
|
|
10123
|
+
import { Command as Command38 } from "commander";
|
|
10124
|
+
import chalk39 from "chalk";
|
|
10125
|
+
var publicCommand = new Command38().name("public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").action(async (name) => {
|
|
10126
|
+
try {
|
|
10127
|
+
const compose = await getComposeByName(name);
|
|
10128
|
+
if (!compose) {
|
|
10129
|
+
console.error(chalk39.red(`\u2717 Agent not found: ${name}`));
|
|
10130
|
+
process.exit(1);
|
|
10131
|
+
}
|
|
10132
|
+
const scope = await getScope();
|
|
10133
|
+
const response = await httpPost(
|
|
10134
|
+
`/api/agent/composes/${compose.id}/permissions`,
|
|
10135
|
+
{ granteeType: "public" }
|
|
10136
|
+
);
|
|
10137
|
+
if (!response.ok) {
|
|
10138
|
+
const error = await response.json();
|
|
10139
|
+
if (response.status === 409) {
|
|
10140
|
+
console.log(chalk39.yellow(`Agent "${name}" is already public`));
|
|
10141
|
+
return;
|
|
10142
|
+
}
|
|
10143
|
+
throw new Error(error.error?.message || "Failed to make agent public");
|
|
10144
|
+
}
|
|
10145
|
+
const fullName = `${scope.slug}/${name}`;
|
|
10146
|
+
console.log(chalk39.green(`\u2713 Agent "${name}" is now public`));
|
|
10147
|
+
console.log();
|
|
10148
|
+
console.log("Others can now run your agent with:");
|
|
10149
|
+
console.log(chalk39.cyan(` vm0 run ${fullName} "your prompt"`));
|
|
10150
|
+
} catch (error) {
|
|
10151
|
+
console.error(chalk39.red("\u2717 Failed to make agent public"));
|
|
10152
|
+
if (error instanceof Error) {
|
|
10153
|
+
console.error(chalk39.dim(` ${error.message}`));
|
|
10154
|
+
}
|
|
10155
|
+
process.exit(1);
|
|
10156
|
+
}
|
|
10157
|
+
});
|
|
10158
|
+
|
|
10159
|
+
// src/commands/agent/private.ts
|
|
10160
|
+
import { Command as Command39 } from "commander";
|
|
10161
|
+
import chalk40 from "chalk";
|
|
10162
|
+
var privateCommand = new Command39().name("private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").action(async (name) => {
|
|
10163
|
+
try {
|
|
10164
|
+
const compose = await getComposeByName(name);
|
|
10165
|
+
if (!compose) {
|
|
10166
|
+
console.error(chalk40.red(`\u2717 Agent not found: ${name}`));
|
|
10167
|
+
process.exit(1);
|
|
10168
|
+
}
|
|
10169
|
+
const response = await httpDelete(
|
|
10170
|
+
`/api/agent/composes/${compose.id}/permissions?type=public`
|
|
10171
|
+
);
|
|
10172
|
+
if (!response.ok) {
|
|
10173
|
+
const error = await response.json();
|
|
10174
|
+
if (response.status === 404) {
|
|
10175
|
+
console.log(chalk40.yellow(`Agent "${name}" is already private`));
|
|
10176
|
+
return;
|
|
10177
|
+
}
|
|
10178
|
+
throw new Error(error.error?.message || "Failed to make agent private");
|
|
10179
|
+
}
|
|
10180
|
+
console.log(chalk40.green(`\u2713 Agent "${name}" is now private`));
|
|
10181
|
+
} catch (error) {
|
|
10182
|
+
console.error(chalk40.red("\u2717 Failed to make agent private"));
|
|
10183
|
+
if (error instanceof Error) {
|
|
10184
|
+
console.error(chalk40.dim(` ${error.message}`));
|
|
10185
|
+
}
|
|
10186
|
+
process.exit(1);
|
|
10187
|
+
}
|
|
10188
|
+
});
|
|
10189
|
+
|
|
10190
|
+
// src/commands/agent/share.ts
|
|
10191
|
+
import { Command as Command40 } from "commander";
|
|
10192
|
+
import chalk41 from "chalk";
|
|
10193
|
+
var shareCommand = new Command40().name("share").description("Share an agent with a user by email").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to share with").action(async (name, options) => {
|
|
10194
|
+
try {
|
|
10195
|
+
const compose = await getComposeByName(name);
|
|
10196
|
+
if (!compose) {
|
|
10197
|
+
console.error(chalk41.red(`\u2717 Agent not found: ${name}`));
|
|
10198
|
+
process.exit(1);
|
|
10199
|
+
}
|
|
10200
|
+
const scope = await getScope();
|
|
10201
|
+
const response = await httpPost(
|
|
10202
|
+
`/api/agent/composes/${compose.id}/permissions`,
|
|
10203
|
+
{ granteeType: "email", granteeEmail: options.email }
|
|
10204
|
+
);
|
|
10205
|
+
if (!response.ok) {
|
|
10206
|
+
const error = await response.json();
|
|
10207
|
+
if (response.status === 409) {
|
|
10208
|
+
console.log(
|
|
10209
|
+
chalk41.yellow(
|
|
10210
|
+
`Agent "${name}" is already shared with ${options.email}`
|
|
10211
|
+
)
|
|
10212
|
+
);
|
|
10213
|
+
return;
|
|
10214
|
+
}
|
|
10215
|
+
throw new Error(error.error?.message || "Failed to share agent");
|
|
10216
|
+
}
|
|
10217
|
+
const fullName = `${scope.slug}/${name}`;
|
|
10218
|
+
console.log(
|
|
10219
|
+
chalk41.green(`\u2713 Agent "${name}" shared with ${options.email}`)
|
|
10220
|
+
);
|
|
10221
|
+
console.log();
|
|
10222
|
+
console.log("They can now run your agent with:");
|
|
10223
|
+
console.log(chalk41.cyan(` vm0 run ${fullName} "your prompt"`));
|
|
10224
|
+
} catch (error) {
|
|
10225
|
+
console.error(chalk41.red("\u2717 Failed to share agent"));
|
|
10226
|
+
if (error instanceof Error) {
|
|
10227
|
+
console.error(chalk41.dim(` ${error.message}`));
|
|
10228
|
+
}
|
|
10229
|
+
process.exit(1);
|
|
10230
|
+
}
|
|
10231
|
+
});
|
|
10232
|
+
|
|
10233
|
+
// src/commands/agent/unshare.ts
|
|
10234
|
+
import { Command as Command41 } from "commander";
|
|
10235
|
+
import chalk42 from "chalk";
|
|
10236
|
+
var unshareCommand = new Command41().name("unshare").description("Remove sharing from a user").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to unshare").action(async (name, options) => {
|
|
10237
|
+
try {
|
|
10238
|
+
const compose = await getComposeByName(name);
|
|
10239
|
+
if (!compose) {
|
|
10240
|
+
console.error(chalk42.red(`\u2717 Agent not found: ${name}`));
|
|
10241
|
+
process.exit(1);
|
|
10242
|
+
}
|
|
10243
|
+
const response = await httpDelete(
|
|
10244
|
+
`/api/agent/composes/${compose.id}/permissions?type=email&email=${encodeURIComponent(options.email)}`
|
|
10245
|
+
);
|
|
10246
|
+
if (!response.ok) {
|
|
10247
|
+
const error = await response.json();
|
|
10248
|
+
if (response.status === 404) {
|
|
10249
|
+
console.log(
|
|
10250
|
+
chalk42.yellow(`Agent "${name}" is not shared with ${options.email}`)
|
|
10251
|
+
);
|
|
10252
|
+
return;
|
|
10253
|
+
}
|
|
10254
|
+
throw new Error(error.error?.message || "Failed to unshare agent");
|
|
10255
|
+
}
|
|
10256
|
+
console.log(
|
|
10257
|
+
chalk42.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
|
|
10258
|
+
);
|
|
10259
|
+
} catch (error) {
|
|
10260
|
+
console.error(chalk42.red("\u2717 Failed to unshare agent"));
|
|
10261
|
+
if (error instanceof Error) {
|
|
10262
|
+
console.error(chalk42.dim(` ${error.message}`));
|
|
10263
|
+
}
|
|
10264
|
+
process.exit(1);
|
|
10265
|
+
}
|
|
10266
|
+
});
|
|
10267
|
+
|
|
10268
|
+
// src/commands/agent/permission.ts
|
|
10269
|
+
import { Command as Command42 } from "commander";
|
|
10270
|
+
import chalk43 from "chalk";
|
|
10271
|
+
var permissionCommand = new Command42().name("permission").description("List all permissions for an agent").argument("<name>", "Agent name").action(async (name) => {
|
|
10272
|
+
try {
|
|
10273
|
+
const compose = await getComposeByName(name);
|
|
10274
|
+
if (!compose) {
|
|
10275
|
+
console.error(chalk43.red(`\u2717 Agent not found: ${name}`));
|
|
10276
|
+
process.exit(1);
|
|
10277
|
+
}
|
|
10278
|
+
const response = await httpGet(
|
|
10279
|
+
`/api/agent/composes/${compose.id}/permissions`
|
|
10280
|
+
);
|
|
10281
|
+
if (!response.ok) {
|
|
10282
|
+
const error = await response.json();
|
|
10283
|
+
throw new Error(error.error?.message || "Failed to list permissions");
|
|
10284
|
+
}
|
|
10285
|
+
const data = await response.json();
|
|
10286
|
+
if (data.permissions.length === 0) {
|
|
10287
|
+
console.log(chalk43.dim("No permissions set (private agent)"));
|
|
10288
|
+
return;
|
|
10289
|
+
}
|
|
10290
|
+
console.log(
|
|
10291
|
+
chalk43.dim(
|
|
10292
|
+
"TYPE EMAIL PERMISSION GRANTED"
|
|
10293
|
+
)
|
|
10294
|
+
);
|
|
10295
|
+
console.log(
|
|
10296
|
+
chalk43.dim(
|
|
10297
|
+
"------- ----------------------------- ---------- ----------"
|
|
10298
|
+
)
|
|
10299
|
+
);
|
|
10300
|
+
for (const p of data.permissions) {
|
|
10301
|
+
const type = p.granteeType.padEnd(7);
|
|
10302
|
+
const email = (p.granteeEmail ?? "-").padEnd(29);
|
|
10303
|
+
const permission = p.permission.padEnd(10);
|
|
10304
|
+
const granted = formatRelativeTime(p.createdAt);
|
|
10305
|
+
console.log(`${type} ${email} ${permission} ${granted}`);
|
|
10306
|
+
}
|
|
10307
|
+
} catch (error) {
|
|
10308
|
+
console.error(chalk43.red("\u2717 Failed to list permissions"));
|
|
10309
|
+
if (error instanceof Error) {
|
|
10310
|
+
console.error(chalk43.dim(` ${error.message}`));
|
|
10311
|
+
}
|
|
10312
|
+
process.exit(1);
|
|
10313
|
+
}
|
|
10314
|
+
});
|
|
10315
|
+
|
|
10102
10316
|
// src/commands/agent/index.ts
|
|
10103
|
-
var agentCommand = new
|
|
10317
|
+
var agentCommand = new Command43().name("agent").description("Manage agent composes").addCommand(cloneCommand3).addCommand(listCommand4).addCommand(statusCommand5).addCommand(publicCommand).addCommand(privateCommand).addCommand(shareCommand).addCommand(unshareCommand).addCommand(permissionCommand);
|
|
10104
10318
|
|
|
10105
10319
|
// src/commands/init/index.ts
|
|
10106
|
-
import { Command as
|
|
10107
|
-
import
|
|
10320
|
+
import { Command as Command44 } from "commander";
|
|
10321
|
+
import chalk44 from "chalk";
|
|
10108
10322
|
import path15 from "path";
|
|
10109
10323
|
import { existsSync as existsSync10 } from "fs";
|
|
10110
10324
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -10142,14 +10356,14 @@ function checkExistingFiles() {
|
|
|
10142
10356
|
if (existsSync10(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
10143
10357
|
return existingFiles;
|
|
10144
10358
|
}
|
|
10145
|
-
var initCommand3 = new
|
|
10359
|
+
var initCommand3 = new Command44().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(async (options) => {
|
|
10146
10360
|
const existingFiles = checkExistingFiles();
|
|
10147
10361
|
if (existingFiles.length > 0 && !options.force) {
|
|
10148
10362
|
for (const file of existingFiles) {
|
|
10149
|
-
console.log(
|
|
10363
|
+
console.log(chalk44.red(`\u2717 ${file} already exists`));
|
|
10150
10364
|
}
|
|
10151
10365
|
console.log();
|
|
10152
|
-
console.log(`To overwrite: ${
|
|
10366
|
+
console.log(`To overwrite: ${chalk44.cyan("vm0 init --force")}`);
|
|
10153
10367
|
process.exit(1);
|
|
10154
10368
|
}
|
|
10155
10369
|
let agentName;
|
|
@@ -10157,9 +10371,9 @@ var initCommand3 = new Command39().name("init").description("Initialize a new VM
|
|
|
10157
10371
|
agentName = options.name.trim();
|
|
10158
10372
|
} else if (!isInteractive()) {
|
|
10159
10373
|
console.error(
|
|
10160
|
-
|
|
10374
|
+
chalk44.red("\u2717 --name flag is required in non-interactive mode")
|
|
10161
10375
|
);
|
|
10162
|
-
console.error(
|
|
10376
|
+
console.error(chalk44.dim(" Usage: vm0 init --name <agent-name>"));
|
|
10163
10377
|
process.exit(1);
|
|
10164
10378
|
} else {
|
|
10165
10379
|
const dirName = path15.basename(process.cwd());
|
|
@@ -10175,47 +10389,47 @@ var initCommand3 = new Command39().name("init").description("Initialize a new VM
|
|
|
10175
10389
|
}
|
|
10176
10390
|
);
|
|
10177
10391
|
if (name === void 0) {
|
|
10178
|
-
console.log(
|
|
10392
|
+
console.log(chalk44.dim("Cancelled"));
|
|
10179
10393
|
return;
|
|
10180
10394
|
}
|
|
10181
10395
|
agentName = name;
|
|
10182
10396
|
}
|
|
10183
10397
|
if (!agentName || !validateAgentName(agentName)) {
|
|
10184
|
-
console.log(
|
|
10398
|
+
console.log(chalk44.red("\u2717 Invalid agent name"));
|
|
10185
10399
|
console.log(
|
|
10186
|
-
|
|
10400
|
+
chalk44.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
10187
10401
|
);
|
|
10188
|
-
console.log(
|
|
10402
|
+
console.log(chalk44.dim(" Must start and end with letter or number"));
|
|
10189
10403
|
process.exit(1);
|
|
10190
10404
|
}
|
|
10191
10405
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
10192
10406
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
10193
|
-
console.log(
|
|
10407
|
+
console.log(chalk44.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
10194
10408
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
10195
10409
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
10196
|
-
console.log(
|
|
10410
|
+
console.log(chalk44.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
10197
10411
|
console.log();
|
|
10198
10412
|
console.log("Next steps:");
|
|
10199
10413
|
console.log(
|
|
10200
|
-
` 1. Set up model provider (one-time): ${
|
|
10414
|
+
` 1. Set up model provider (one-time): ${chalk44.cyan("vm0 model-provider setup")}`
|
|
10201
10415
|
);
|
|
10202
10416
|
console.log(
|
|
10203
|
-
` 2. Edit ${
|
|
10417
|
+
` 2. Edit ${chalk44.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
10204
10418
|
);
|
|
10205
10419
|
console.log(
|
|
10206
|
-
` Or install Claude plugin: ${
|
|
10420
|
+
` Or install Claude plugin: ${chalk44.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
10207
10421
|
);
|
|
10208
10422
|
console.log(
|
|
10209
|
-
` 3. Run your agent: ${
|
|
10423
|
+
` 3. Run your agent: ${chalk44.cyan(`vm0 cook "let's start working"`)}`
|
|
10210
10424
|
);
|
|
10211
10425
|
});
|
|
10212
10426
|
|
|
10213
10427
|
// src/commands/schedule/index.ts
|
|
10214
|
-
import { Command as
|
|
10428
|
+
import { Command as Command51 } from "commander";
|
|
10215
10429
|
|
|
10216
10430
|
// src/commands/schedule/setup.ts
|
|
10217
|
-
import { Command as
|
|
10218
|
-
import
|
|
10431
|
+
import { Command as Command45 } from "commander";
|
|
10432
|
+
import chalk46 from "chalk";
|
|
10219
10433
|
|
|
10220
10434
|
// src/lib/domain/schedule-utils.ts
|
|
10221
10435
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -10357,7 +10571,7 @@ async function resolveScheduleByAgent(agentName) {
|
|
|
10357
10571
|
}
|
|
10358
10572
|
|
|
10359
10573
|
// src/commands/schedule/gather-configuration.ts
|
|
10360
|
-
import
|
|
10574
|
+
import chalk45 from "chalk";
|
|
10361
10575
|
var defaultPromptDeps = {
|
|
10362
10576
|
isInteractive,
|
|
10363
10577
|
promptConfirm,
|
|
@@ -10385,7 +10599,7 @@ async function handleExistingSecrets(existingSecretNames, deps) {
|
|
|
10385
10599
|
return true;
|
|
10386
10600
|
}
|
|
10387
10601
|
console.log(
|
|
10388
|
-
|
|
10602
|
+
chalk45.dim(
|
|
10389
10603
|
" Note: Secrets will be cleared. Use 'vm0 secret set' to add platform secrets."
|
|
10390
10604
|
)
|
|
10391
10605
|
);
|
|
@@ -10410,21 +10624,21 @@ async function handleVars(optionVars, existingVars, deps) {
|
|
|
10410
10624
|
}
|
|
10411
10625
|
function displayMissingRequirements(missingSecrets, missingVars) {
|
|
10412
10626
|
if (missingSecrets.length > 0) {
|
|
10413
|
-
console.log(
|
|
10627
|
+
console.log(chalk45.yellow("\nAgent requires the following secrets:"));
|
|
10414
10628
|
for (const name of missingSecrets) {
|
|
10415
|
-
console.log(
|
|
10629
|
+
console.log(chalk45.dim(` ${name}`));
|
|
10416
10630
|
}
|
|
10417
10631
|
console.log();
|
|
10418
10632
|
console.log("Set secrets using the platform:");
|
|
10419
10633
|
for (const name of missingSecrets) {
|
|
10420
|
-
console.log(
|
|
10634
|
+
console.log(chalk45.cyan(` vm0 secret set ${name} <value>`));
|
|
10421
10635
|
}
|
|
10422
10636
|
console.log();
|
|
10423
10637
|
}
|
|
10424
10638
|
if (missingVars.length > 0) {
|
|
10425
|
-
console.log(
|
|
10639
|
+
console.log(chalk45.yellow("\nAgent requires the following variables:"));
|
|
10426
10640
|
for (const name of missingVars) {
|
|
10427
|
-
console.log(
|
|
10641
|
+
console.log(chalk45.dim(` ${name}`));
|
|
10428
10642
|
}
|
|
10429
10643
|
console.log();
|
|
10430
10644
|
}
|
|
@@ -10432,7 +10646,7 @@ function displayMissingRequirements(missingSecrets, missingVars) {
|
|
|
10432
10646
|
async function promptForMissingVars(missingVars, vars, deps) {
|
|
10433
10647
|
for (const name of missingVars) {
|
|
10434
10648
|
const value = await deps.promptText(
|
|
10435
|
-
`Enter value for var ${
|
|
10649
|
+
`Enter value for var ${chalk45.cyan(name)}`,
|
|
10436
10650
|
""
|
|
10437
10651
|
);
|
|
10438
10652
|
if (value) {
|
|
@@ -10520,7 +10734,7 @@ function expandEnvVars(value) {
|
|
|
10520
10734
|
const envValue = process.env[varName];
|
|
10521
10735
|
if (envValue === void 0) {
|
|
10522
10736
|
console.warn(
|
|
10523
|
-
|
|
10737
|
+
chalk46.yellow(` Warning: Environment variable ${varName} not set`)
|
|
10524
10738
|
);
|
|
10525
10739
|
return match;
|
|
10526
10740
|
}
|
|
@@ -10587,7 +10801,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
10587
10801
|
}
|
|
10588
10802
|
if (!isInteractive()) {
|
|
10589
10803
|
console.error(
|
|
10590
|
-
|
|
10804
|
+
chalk46.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
10591
10805
|
);
|
|
10592
10806
|
process.exit(1);
|
|
10593
10807
|
}
|
|
@@ -10607,7 +10821,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10607
10821
|
const day2 = parseDayOption(optionDay, frequency);
|
|
10608
10822
|
if (day2 === void 0) {
|
|
10609
10823
|
console.error(
|
|
10610
|
-
|
|
10824
|
+
chalk46.red(
|
|
10611
10825
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
10612
10826
|
)
|
|
10613
10827
|
);
|
|
@@ -10616,7 +10830,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10616
10830
|
return day2;
|
|
10617
10831
|
}
|
|
10618
10832
|
if (!isInteractive()) {
|
|
10619
|
-
console.error(
|
|
10833
|
+
console.error(chalk46.red("\u2717 --day is required for weekly/monthly"));
|
|
10620
10834
|
process.exit(1);
|
|
10621
10835
|
}
|
|
10622
10836
|
if (frequency === "weekly") {
|
|
@@ -10635,7 +10849,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10635
10849
|
if (!dayStr) return null;
|
|
10636
10850
|
const day = parseInt(dayStr, 10);
|
|
10637
10851
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
10638
|
-
console.error(
|
|
10852
|
+
console.error(chalk46.red("\u2717 Day must be between 1 and 31"));
|
|
10639
10853
|
process.exit(1);
|
|
10640
10854
|
}
|
|
10641
10855
|
return day;
|
|
@@ -10644,13 +10858,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
10644
10858
|
if (optionTime) {
|
|
10645
10859
|
const validation = validateTimeFormat(optionTime);
|
|
10646
10860
|
if (validation !== true) {
|
|
10647
|
-
console.error(
|
|
10861
|
+
console.error(chalk46.red(`\u2717 Invalid time: ${validation}`));
|
|
10648
10862
|
process.exit(1);
|
|
10649
10863
|
}
|
|
10650
10864
|
return optionTime;
|
|
10651
10865
|
}
|
|
10652
10866
|
if (!isInteractive()) {
|
|
10653
|
-
console.error(
|
|
10867
|
+
console.error(chalk46.red("\u2717 --time is required (HH:MM format)"));
|
|
10654
10868
|
process.exit(1);
|
|
10655
10869
|
}
|
|
10656
10870
|
return await promptText(
|
|
@@ -10663,7 +10877,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
10663
10877
|
if (optionDay && optionTime) {
|
|
10664
10878
|
if (!validateDateFormat(optionDay)) {
|
|
10665
10879
|
console.error(
|
|
10666
|
-
|
|
10880
|
+
chalk46.red(
|
|
10667
10881
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
10668
10882
|
)
|
|
10669
10883
|
);
|
|
@@ -10671,16 +10885,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
10671
10885
|
}
|
|
10672
10886
|
if (!validateTimeFormat(optionTime)) {
|
|
10673
10887
|
console.error(
|
|
10674
|
-
|
|
10888
|
+
chalk46.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
10675
10889
|
);
|
|
10676
10890
|
process.exit(1);
|
|
10677
10891
|
}
|
|
10678
10892
|
return `${optionDay} ${optionTime}`;
|
|
10679
10893
|
}
|
|
10680
10894
|
if (!isInteractive()) {
|
|
10681
|
-
console.error(
|
|
10895
|
+
console.error(chalk46.red("\u2717 One-time schedules require interactive mode"));
|
|
10682
10896
|
console.error(
|
|
10683
|
-
|
|
10897
|
+
chalk46.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
10684
10898
|
);
|
|
10685
10899
|
process.exit(1);
|
|
10686
10900
|
}
|
|
@@ -10711,7 +10925,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
10711
10925
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
10712
10926
|
if (optionPrompt) return optionPrompt;
|
|
10713
10927
|
if (!isInteractive()) {
|
|
10714
|
-
console.error(
|
|
10928
|
+
console.error(chalk46.red("\u2717 --prompt is required"));
|
|
10715
10929
|
process.exit(1);
|
|
10716
10930
|
}
|
|
10717
10931
|
return await promptText(
|
|
@@ -10722,8 +10936,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
10722
10936
|
async function resolveAgent(agentName) {
|
|
10723
10937
|
const compose = await getComposeByName(agentName);
|
|
10724
10938
|
if (!compose) {
|
|
10725
|
-
console.error(
|
|
10726
|
-
console.error(
|
|
10939
|
+
console.error(chalk46.red(`\u2717 Agent not found: ${agentName}`));
|
|
10940
|
+
console.error(chalk46.dim(" Make sure the agent is composed first"));
|
|
10727
10941
|
process.exit(1);
|
|
10728
10942
|
}
|
|
10729
10943
|
return {
|
|
@@ -10770,7 +10984,7 @@ async function buildAndDeploy(params) {
|
|
|
10770
10984
|
const expandedSecrets = expandEnvVarsInObject(params.secrets);
|
|
10771
10985
|
console.log(
|
|
10772
10986
|
`
|
|
10773
|
-
Deploying schedule for agent ${
|
|
10987
|
+
Deploying schedule for agent ${chalk46.cyan(params.agentName)}...`
|
|
10774
10988
|
);
|
|
10775
10989
|
const deployResult = await deploySchedule({
|
|
10776
10990
|
name: params.scheduleName,
|
|
@@ -10786,12 +11000,12 @@ Deploying schedule for agent ${chalk41.cyan(params.agentName)}...`
|
|
|
10786
11000
|
return deployResult;
|
|
10787
11001
|
}
|
|
10788
11002
|
function handleSetupError(error) {
|
|
10789
|
-
console.error(
|
|
11003
|
+
console.error(chalk46.red("\u2717 Failed to setup schedule"));
|
|
10790
11004
|
if (error instanceof Error) {
|
|
10791
11005
|
if (error.message.includes("Not authenticated")) {
|
|
10792
|
-
console.error(
|
|
11006
|
+
console.error(chalk46.dim(" Run: vm0 auth login"));
|
|
10793
11007
|
} else {
|
|
10794
|
-
console.error(
|
|
11008
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
10795
11009
|
}
|
|
10796
11010
|
}
|
|
10797
11011
|
process.exit(1);
|
|
@@ -10799,56 +11013,56 @@ function handleSetupError(error) {
|
|
|
10799
11013
|
function displayDeployResult(agentName, deployResult) {
|
|
10800
11014
|
if (deployResult.created) {
|
|
10801
11015
|
console.log(
|
|
10802
|
-
|
|
11016
|
+
chalk46.green(`\u2713 Created schedule for agent ${chalk46.cyan(agentName)}`)
|
|
10803
11017
|
);
|
|
10804
11018
|
} else {
|
|
10805
11019
|
console.log(
|
|
10806
|
-
|
|
11020
|
+
chalk46.green(`\u2713 Updated schedule for agent ${chalk46.cyan(agentName)}`)
|
|
10807
11021
|
);
|
|
10808
11022
|
}
|
|
10809
|
-
console.log(
|
|
11023
|
+
console.log(chalk46.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
10810
11024
|
if (deployResult.schedule.cronExpression) {
|
|
10811
|
-
console.log(
|
|
11025
|
+
console.log(chalk46.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
10812
11026
|
if (deployResult.schedule.nextRunAt) {
|
|
10813
11027
|
const nextRun = formatInTimezone(
|
|
10814
11028
|
deployResult.schedule.nextRunAt,
|
|
10815
11029
|
deployResult.schedule.timezone
|
|
10816
11030
|
);
|
|
10817
|
-
console.log(
|
|
11031
|
+
console.log(chalk46.dim(` Next run: ${nextRun}`));
|
|
10818
11032
|
}
|
|
10819
11033
|
} else if (deployResult.schedule.atTime) {
|
|
10820
11034
|
const atTimeFormatted = formatInTimezone(
|
|
10821
11035
|
deployResult.schedule.atTime,
|
|
10822
11036
|
deployResult.schedule.timezone
|
|
10823
11037
|
);
|
|
10824
|
-
console.log(
|
|
11038
|
+
console.log(chalk46.dim(` At: ${atTimeFormatted}`));
|
|
10825
11039
|
}
|
|
10826
11040
|
}
|
|
10827
11041
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
10828
11042
|
try {
|
|
10829
11043
|
await enableSchedule({ name: scheduleName, composeId });
|
|
10830
11044
|
console.log(
|
|
10831
|
-
|
|
11045
|
+
chalk46.green(`\u2713 Enabled schedule for agent ${chalk46.cyan(agentName)}`)
|
|
10832
11046
|
);
|
|
10833
11047
|
} catch (error) {
|
|
10834
|
-
console.error(
|
|
11048
|
+
console.error(chalk46.yellow("\u26A0 Failed to enable schedule"));
|
|
10835
11049
|
if (error instanceof ApiRequestError) {
|
|
10836
11050
|
if (error.code === "SCHEDULE_PAST") {
|
|
10837
|
-
console.error(
|
|
11051
|
+
console.error(chalk46.dim(" Scheduled time has already passed"));
|
|
10838
11052
|
} else {
|
|
10839
|
-
console.error(
|
|
11053
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
10840
11054
|
}
|
|
10841
11055
|
} else if (error instanceof Error) {
|
|
10842
|
-
console.error(
|
|
11056
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
10843
11057
|
}
|
|
10844
11058
|
console.log(
|
|
10845
|
-
` To enable manually: ${
|
|
11059
|
+
` To enable manually: ${chalk46.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
10846
11060
|
);
|
|
10847
11061
|
}
|
|
10848
11062
|
}
|
|
10849
11063
|
function showEnableHint(agentName) {
|
|
10850
11064
|
console.log();
|
|
10851
|
-
console.log(` To enable: ${
|
|
11065
|
+
console.log(` To enable: ${chalk46.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
10852
11066
|
}
|
|
10853
11067
|
async function handleScheduleEnabling(params) {
|
|
10854
11068
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -10869,13 +11083,13 @@ async function handleScheduleEnabling(params) {
|
|
|
10869
11083
|
showEnableHint(agentName);
|
|
10870
11084
|
}
|
|
10871
11085
|
}
|
|
10872
|
-
var setupCommand = new
|
|
11086
|
+
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("--var <name=value>", "Variable (can be repeated)", collect, []).option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
|
|
10873
11087
|
try {
|
|
10874
11088
|
const { composeId, scheduleName, composeContent } = await resolveAgent(agentName);
|
|
10875
11089
|
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
10876
11090
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
10877
11091
|
console.log(
|
|
10878
|
-
|
|
11092
|
+
chalk46.dim(
|
|
10879
11093
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
10880
11094
|
)
|
|
10881
11095
|
);
|
|
@@ -10885,12 +11099,12 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10885
11099
|
defaults.frequency
|
|
10886
11100
|
);
|
|
10887
11101
|
if (!frequency) {
|
|
10888
|
-
console.log(
|
|
11102
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10889
11103
|
return;
|
|
10890
11104
|
}
|
|
10891
11105
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
10892
11106
|
if (!timing) {
|
|
10893
|
-
console.log(
|
|
11107
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10894
11108
|
return;
|
|
10895
11109
|
}
|
|
10896
11110
|
const { day, time, atTime } = timing;
|
|
@@ -10899,7 +11113,7 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10899
11113
|
existingSchedule?.timezone
|
|
10900
11114
|
);
|
|
10901
11115
|
if (!timezone) {
|
|
10902
|
-
console.log(
|
|
11116
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10903
11117
|
return;
|
|
10904
11118
|
}
|
|
10905
11119
|
const promptText_ = await gatherPromptText(
|
|
@@ -10907,7 +11121,7 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10907
11121
|
existingSchedule?.prompt
|
|
10908
11122
|
);
|
|
10909
11123
|
if (!promptText_) {
|
|
10910
|
-
console.log(
|
|
11124
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10911
11125
|
return;
|
|
10912
11126
|
}
|
|
10913
11127
|
const config = await gatherConfiguration({
|
|
@@ -10947,15 +11161,15 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10947
11161
|
});
|
|
10948
11162
|
|
|
10949
11163
|
// src/commands/schedule/list.ts
|
|
10950
|
-
import { Command as
|
|
10951
|
-
import
|
|
10952
|
-
var listCommand5 = new
|
|
11164
|
+
import { Command as Command46 } from "commander";
|
|
11165
|
+
import chalk47 from "chalk";
|
|
11166
|
+
var listCommand5 = new Command46().name("list").alias("ls").description("List all schedules").action(async () => {
|
|
10953
11167
|
try {
|
|
10954
11168
|
const result = await listSchedules();
|
|
10955
11169
|
if (result.schedules.length === 0) {
|
|
10956
|
-
console.log(
|
|
11170
|
+
console.log(chalk47.dim("No schedules found"));
|
|
10957
11171
|
console.log(
|
|
10958
|
-
|
|
11172
|
+
chalk47.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
10959
11173
|
);
|
|
10960
11174
|
return;
|
|
10961
11175
|
}
|
|
@@ -10975,10 +11189,10 @@ var listCommand5 = new Command41().name("list").alias("ls").description("List al
|
|
|
10975
11189
|
"STATUS".padEnd(8),
|
|
10976
11190
|
"NEXT RUN"
|
|
10977
11191
|
].join(" ");
|
|
10978
|
-
console.log(
|
|
11192
|
+
console.log(chalk47.dim(header));
|
|
10979
11193
|
for (const schedule of result.schedules) {
|
|
10980
11194
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
10981
|
-
const status = schedule.enabled ?
|
|
11195
|
+
const status = schedule.enabled ? chalk47.green("enabled") : chalk47.yellow("disabled");
|
|
10982
11196
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
10983
11197
|
const row = [
|
|
10984
11198
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -10990,12 +11204,12 @@ var listCommand5 = new Command41().name("list").alias("ls").description("List al
|
|
|
10990
11204
|
console.log(row);
|
|
10991
11205
|
}
|
|
10992
11206
|
} catch (error) {
|
|
10993
|
-
console.error(
|
|
11207
|
+
console.error(chalk47.red("\u2717 Failed to list schedules"));
|
|
10994
11208
|
if (error instanceof Error) {
|
|
10995
11209
|
if (error.message.includes("Not authenticated")) {
|
|
10996
|
-
console.error(
|
|
11210
|
+
console.error(chalk47.dim(" Run: vm0 auth login"));
|
|
10997
11211
|
} else {
|
|
10998
|
-
console.error(
|
|
11212
|
+
console.error(chalk47.dim(` ${error.message}`));
|
|
10999
11213
|
}
|
|
11000
11214
|
}
|
|
11001
11215
|
process.exit(1);
|
|
@@ -11003,45 +11217,45 @@ var listCommand5 = new Command41().name("list").alias("ls").description("List al
|
|
|
11003
11217
|
});
|
|
11004
11218
|
|
|
11005
11219
|
// src/commands/schedule/status.ts
|
|
11006
|
-
import { Command as
|
|
11007
|
-
import
|
|
11220
|
+
import { Command as Command47 } from "commander";
|
|
11221
|
+
import chalk48 from "chalk";
|
|
11008
11222
|
function formatDateTimeStyled(dateStr) {
|
|
11009
|
-
if (!dateStr) return
|
|
11223
|
+
if (!dateStr) return chalk48.dim("-");
|
|
11010
11224
|
const formatted = formatDateTime(dateStr);
|
|
11011
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
11225
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk48.dim("($1)"));
|
|
11012
11226
|
}
|
|
11013
11227
|
function formatTrigger(schedule) {
|
|
11014
11228
|
if (schedule.cronExpression) {
|
|
11015
11229
|
return schedule.cronExpression;
|
|
11016
11230
|
}
|
|
11017
11231
|
if (schedule.atTime) {
|
|
11018
|
-
return `${schedule.atTime} ${
|
|
11232
|
+
return `${schedule.atTime} ${chalk48.dim("(one-time)")}`;
|
|
11019
11233
|
}
|
|
11020
|
-
return
|
|
11234
|
+
return chalk48.dim("-");
|
|
11021
11235
|
}
|
|
11022
11236
|
function formatRunStatus2(status) {
|
|
11023
11237
|
switch (status) {
|
|
11024
11238
|
case "completed":
|
|
11025
|
-
return
|
|
11239
|
+
return chalk48.green(status);
|
|
11026
11240
|
case "failed":
|
|
11027
11241
|
case "timeout":
|
|
11028
|
-
return
|
|
11242
|
+
return chalk48.red(status);
|
|
11029
11243
|
case "running":
|
|
11030
|
-
return
|
|
11244
|
+
return chalk48.blue(status);
|
|
11031
11245
|
case "pending":
|
|
11032
|
-
return
|
|
11246
|
+
return chalk48.yellow(status);
|
|
11033
11247
|
default:
|
|
11034
11248
|
return status;
|
|
11035
11249
|
}
|
|
11036
11250
|
}
|
|
11037
11251
|
function printRunConfiguration(schedule) {
|
|
11038
|
-
const statusText = schedule.enabled ?
|
|
11252
|
+
const statusText = schedule.enabled ? chalk48.green("enabled") : chalk48.yellow("disabled");
|
|
11039
11253
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
11040
11254
|
console.log(
|
|
11041
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
11255
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk48.dim(`(${schedule.scopeSlug})`)}`
|
|
11042
11256
|
);
|
|
11043
11257
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
11044
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
11258
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk48.dim(promptPreview)}`);
|
|
11045
11259
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
11046
11260
|
console.log(
|
|
11047
11261
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -11078,7 +11292,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11078
11292
|
console.log();
|
|
11079
11293
|
console.log("Recent Runs:");
|
|
11080
11294
|
console.log(
|
|
11081
|
-
|
|
11295
|
+
chalk48.dim("RUN ID STATUS CREATED")
|
|
11082
11296
|
);
|
|
11083
11297
|
for (const run of runs) {
|
|
11084
11298
|
const id = run.id;
|
|
@@ -11089,24 +11303,24 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11089
11303
|
}
|
|
11090
11304
|
} catch {
|
|
11091
11305
|
console.log();
|
|
11092
|
-
console.log(
|
|
11306
|
+
console.log(chalk48.dim("Recent Runs: (unable to fetch)"));
|
|
11093
11307
|
}
|
|
11094
11308
|
}
|
|
11095
11309
|
function handleStatusError(error, agentName) {
|
|
11096
|
-
console.error(
|
|
11310
|
+
console.error(chalk48.red("\u2717 Failed to get schedule status"));
|
|
11097
11311
|
if (error instanceof Error) {
|
|
11098
11312
|
if (error.message.includes("Not authenticated")) {
|
|
11099
|
-
console.error(
|
|
11313
|
+
console.error(chalk48.dim(" Run: vm0 auth login"));
|
|
11100
11314
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
11101
|
-
console.error(
|
|
11102
|
-
console.error(
|
|
11315
|
+
console.error(chalk48.dim(` No schedule found for agent "${agentName}"`));
|
|
11316
|
+
console.error(chalk48.dim(" Run: vm0 schedule list"));
|
|
11103
11317
|
} else {
|
|
11104
|
-
console.error(
|
|
11318
|
+
console.error(chalk48.dim(` ${error.message}`));
|
|
11105
11319
|
}
|
|
11106
11320
|
}
|
|
11107
11321
|
process.exit(1);
|
|
11108
11322
|
}
|
|
11109
|
-
var statusCommand6 = new
|
|
11323
|
+
var statusCommand6 = new Command47().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
11110
11324
|
"-l, --limit <number>",
|
|
11111
11325
|
"Number of recent runs to show (0 to hide)",
|
|
11112
11326
|
"5"
|
|
@@ -11116,8 +11330,8 @@ var statusCommand6 = new Command42().name("status").description("Show detailed s
|
|
|
11116
11330
|
const { name, composeId } = resolved;
|
|
11117
11331
|
const schedule = await getScheduleByName({ name, composeId });
|
|
11118
11332
|
console.log();
|
|
11119
|
-
console.log(`Schedule for agent: ${
|
|
11120
|
-
console.log(
|
|
11333
|
+
console.log(`Schedule for agent: ${chalk48.cyan(agentName)}`);
|
|
11334
|
+
console.log(chalk48.dim("\u2501".repeat(50)));
|
|
11121
11335
|
printRunConfiguration(schedule);
|
|
11122
11336
|
printTimeSchedule(schedule);
|
|
11123
11337
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -11133,24 +11347,24 @@ var statusCommand6 = new Command42().name("status").description("Show detailed s
|
|
|
11133
11347
|
});
|
|
11134
11348
|
|
|
11135
11349
|
// src/commands/schedule/delete.ts
|
|
11136
|
-
import { Command as
|
|
11137
|
-
import
|
|
11138
|
-
var deleteCommand = new
|
|
11350
|
+
import { Command as Command48 } from "commander";
|
|
11351
|
+
import chalk49 from "chalk";
|
|
11352
|
+
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) => {
|
|
11139
11353
|
try {
|
|
11140
11354
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
11141
11355
|
if (!options.force) {
|
|
11142
11356
|
if (!isInteractive()) {
|
|
11143
11357
|
console.error(
|
|
11144
|
-
|
|
11358
|
+
chalk49.red("\u2717 --force required in non-interactive mode")
|
|
11145
11359
|
);
|
|
11146
11360
|
process.exit(1);
|
|
11147
11361
|
}
|
|
11148
11362
|
const confirmed = await promptConfirm(
|
|
11149
|
-
`Delete schedule for agent ${
|
|
11363
|
+
`Delete schedule for agent ${chalk49.cyan(agentName)}?`,
|
|
11150
11364
|
false
|
|
11151
11365
|
);
|
|
11152
11366
|
if (!confirmed) {
|
|
11153
|
-
console.log(
|
|
11367
|
+
console.log(chalk49.dim("Cancelled"));
|
|
11154
11368
|
return;
|
|
11155
11369
|
}
|
|
11156
11370
|
}
|
|
@@ -11159,20 +11373,20 @@ var deleteCommand = new Command43().name("delete").alias("rm").description("Dele
|
|
|
11159
11373
|
composeId: resolved.composeId
|
|
11160
11374
|
});
|
|
11161
11375
|
console.log(
|
|
11162
|
-
|
|
11376
|
+
chalk49.green(`\u2713 Deleted schedule for agent ${chalk49.cyan(agentName)}`)
|
|
11163
11377
|
);
|
|
11164
11378
|
} catch (error) {
|
|
11165
|
-
console.error(
|
|
11379
|
+
console.error(chalk49.red("\u2717 Failed to delete schedule"));
|
|
11166
11380
|
if (error instanceof Error) {
|
|
11167
11381
|
if (error.message.includes("Not authenticated")) {
|
|
11168
|
-
console.error(
|
|
11382
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
11169
11383
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
11170
11384
|
console.error(
|
|
11171
|
-
|
|
11385
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
11172
11386
|
);
|
|
11173
|
-
console.error(
|
|
11387
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
11174
11388
|
} else {
|
|
11175
|
-
console.error(
|
|
11389
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
11176
11390
|
}
|
|
11177
11391
|
}
|
|
11178
11392
|
process.exit(1);
|
|
@@ -11180,9 +11394,9 @@ var deleteCommand = new Command43().name("delete").alias("rm").description("Dele
|
|
|
11180
11394
|
});
|
|
11181
11395
|
|
|
11182
11396
|
// src/commands/schedule/enable.ts
|
|
11183
|
-
import { Command as
|
|
11184
|
-
import
|
|
11185
|
-
var enableCommand = new
|
|
11397
|
+
import { Command as Command49 } from "commander";
|
|
11398
|
+
import chalk50 from "chalk";
|
|
11399
|
+
var enableCommand = new Command49().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
11186
11400
|
try {
|
|
11187
11401
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
11188
11402
|
await enableSchedule({
|
|
@@ -11190,34 +11404,34 @@ var enableCommand = new Command44().name("enable").description("Enable a schedul
|
|
|
11190
11404
|
composeId: resolved.composeId
|
|
11191
11405
|
});
|
|
11192
11406
|
console.log(
|
|
11193
|
-
|
|
11407
|
+
chalk50.green(`\u2713 Enabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11194
11408
|
);
|
|
11195
11409
|
} catch (error) {
|
|
11196
|
-
console.error(
|
|
11410
|
+
console.error(chalk50.red("\u2717 Failed to enable schedule"));
|
|
11197
11411
|
if (error instanceof ApiRequestError) {
|
|
11198
11412
|
if (error.code === "SCHEDULE_PAST") {
|
|
11199
|
-
console.error(
|
|
11200
|
-
console.error(
|
|
11413
|
+
console.error(chalk50.dim(" Scheduled time has already passed"));
|
|
11414
|
+
console.error(chalk50.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
11201
11415
|
} else if (error.code === "NOT_FOUND") {
|
|
11202
11416
|
console.error(
|
|
11203
|
-
|
|
11417
|
+
chalk50.dim(` No schedule found for agent "${agentName}"`)
|
|
11204
11418
|
);
|
|
11205
|
-
console.error(
|
|
11419
|
+
console.error(chalk50.dim(" Run: vm0 schedule list"));
|
|
11206
11420
|
} else if (error.code === "UNAUTHORIZED") {
|
|
11207
|
-
console.error(
|
|
11421
|
+
console.error(chalk50.dim(" Run: vm0 auth login"));
|
|
11208
11422
|
} else {
|
|
11209
|
-
console.error(
|
|
11423
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11210
11424
|
}
|
|
11211
11425
|
} else if (error instanceof Error) {
|
|
11212
11426
|
if (error.message.includes("Not authenticated")) {
|
|
11213
|
-
console.error(
|
|
11427
|
+
console.error(chalk50.dim(" Run: vm0 auth login"));
|
|
11214
11428
|
} else if (error.message.includes("No schedule found")) {
|
|
11215
11429
|
console.error(
|
|
11216
|
-
|
|
11430
|
+
chalk50.dim(` No schedule found for agent "${agentName}"`)
|
|
11217
11431
|
);
|
|
11218
|
-
console.error(
|
|
11432
|
+
console.error(chalk50.dim(" Run: vm0 schedule list"));
|
|
11219
11433
|
} else {
|
|
11220
|
-
console.error(
|
|
11434
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11221
11435
|
}
|
|
11222
11436
|
}
|
|
11223
11437
|
process.exit(1);
|
|
@@ -11225,9 +11439,9 @@ var enableCommand = new Command44().name("enable").description("Enable a schedul
|
|
|
11225
11439
|
});
|
|
11226
11440
|
|
|
11227
11441
|
// src/commands/schedule/disable.ts
|
|
11228
|
-
import { Command as
|
|
11229
|
-
import
|
|
11230
|
-
var disableCommand = new
|
|
11442
|
+
import { Command as Command50 } from "commander";
|
|
11443
|
+
import chalk51 from "chalk";
|
|
11444
|
+
var disableCommand = new Command50().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
11231
11445
|
try {
|
|
11232
11446
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
11233
11447
|
await disableSchedule({
|
|
@@ -11235,20 +11449,20 @@ var disableCommand = new Command45().name("disable").description("Disable a sche
|
|
|
11235
11449
|
composeId: resolved.composeId
|
|
11236
11450
|
});
|
|
11237
11451
|
console.log(
|
|
11238
|
-
|
|
11452
|
+
chalk51.green(`\u2713 Disabled schedule for agent ${chalk51.cyan(agentName)}`)
|
|
11239
11453
|
);
|
|
11240
11454
|
} catch (error) {
|
|
11241
|
-
console.error(
|
|
11455
|
+
console.error(chalk51.red("\u2717 Failed to disable schedule"));
|
|
11242
11456
|
if (error instanceof Error) {
|
|
11243
11457
|
if (error.message.includes("Not authenticated")) {
|
|
11244
|
-
console.error(
|
|
11458
|
+
console.error(chalk51.dim(" Run: vm0 auth login"));
|
|
11245
11459
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
11246
11460
|
console.error(
|
|
11247
|
-
|
|
11461
|
+
chalk51.dim(` No schedule found for agent "${agentName}"`)
|
|
11248
11462
|
);
|
|
11249
|
-
console.error(
|
|
11463
|
+
console.error(chalk51.dim(" Run: vm0 schedule list"));
|
|
11250
11464
|
} else {
|
|
11251
|
-
console.error(
|
|
11465
|
+
console.error(chalk51.dim(` ${error.message}`));
|
|
11252
11466
|
}
|
|
11253
11467
|
}
|
|
11254
11468
|
process.exit(1);
|
|
@@ -11256,11 +11470,11 @@ var disableCommand = new Command45().name("disable").description("Disable a sche
|
|
|
11256
11470
|
});
|
|
11257
11471
|
|
|
11258
11472
|
// src/commands/schedule/index.ts
|
|
11259
|
-
var scheduleCommand = new
|
|
11473
|
+
var scheduleCommand = new Command51().name("schedule").description("Manage agent schedules").addCommand(setupCommand).addCommand(listCommand5).addCommand(statusCommand6).addCommand(deleteCommand).addCommand(enableCommand).addCommand(disableCommand);
|
|
11260
11474
|
|
|
11261
11475
|
// src/commands/usage/index.ts
|
|
11262
|
-
import { Command as
|
|
11263
|
-
import
|
|
11476
|
+
import { Command as Command52 } from "commander";
|
|
11477
|
+
import chalk52 from "chalk";
|
|
11264
11478
|
|
|
11265
11479
|
// src/lib/utils/duration-formatter.ts
|
|
11266
11480
|
function formatDuration(ms) {
|
|
@@ -11333,7 +11547,7 @@ function fillMissingDates(daily, startDate, endDate) {
|
|
|
11333
11547
|
result.sort((a, b) => b.date.localeCompare(a.date));
|
|
11334
11548
|
return result;
|
|
11335
11549
|
}
|
|
11336
|
-
var usageCommand = new
|
|
11550
|
+
var usageCommand = new Command52().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
|
|
11337
11551
|
"--until <date>",
|
|
11338
11552
|
"End date (ISO format or relative, defaults to now)"
|
|
11339
11553
|
).action(async (options) => {
|
|
@@ -11347,7 +11561,7 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11347
11561
|
endDate = new Date(untilMs);
|
|
11348
11562
|
} catch {
|
|
11349
11563
|
console.error(
|
|
11350
|
-
|
|
11564
|
+
chalk52.red(
|
|
11351
11565
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
11352
11566
|
)
|
|
11353
11567
|
);
|
|
@@ -11362,7 +11576,7 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11362
11576
|
startDate = new Date(sinceMs);
|
|
11363
11577
|
} catch {
|
|
11364
11578
|
console.error(
|
|
11365
|
-
|
|
11579
|
+
chalk52.red(
|
|
11366
11580
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
11367
11581
|
)
|
|
11368
11582
|
);
|
|
@@ -11372,13 +11586,13 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11372
11586
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
11373
11587
|
}
|
|
11374
11588
|
if (startDate >= endDate) {
|
|
11375
|
-
console.error(
|
|
11589
|
+
console.error(chalk52.red("\u2717 --since must be before --until"));
|
|
11376
11590
|
process.exit(1);
|
|
11377
11591
|
}
|
|
11378
11592
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
11379
11593
|
if (rangeMs > MAX_RANGE_MS) {
|
|
11380
11594
|
console.error(
|
|
11381
|
-
|
|
11595
|
+
chalk52.red(
|
|
11382
11596
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
11383
11597
|
)
|
|
11384
11598
|
);
|
|
@@ -11395,19 +11609,19 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11395
11609
|
);
|
|
11396
11610
|
console.log();
|
|
11397
11611
|
console.log(
|
|
11398
|
-
|
|
11612
|
+
chalk52.bold(
|
|
11399
11613
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
11400
11614
|
)
|
|
11401
11615
|
);
|
|
11402
11616
|
console.log();
|
|
11403
|
-
console.log(
|
|
11617
|
+
console.log(chalk52.dim("DATE RUNS RUN TIME"));
|
|
11404
11618
|
for (const day of filledDaily) {
|
|
11405
11619
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
11406
11620
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
11407
11621
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
11408
11622
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
11409
11623
|
}
|
|
11410
|
-
console.log(
|
|
11624
|
+
console.log(chalk52.dim("\u2500".repeat(29)));
|
|
11411
11625
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
11412
11626
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
11413
11627
|
console.log(
|
|
@@ -11417,66 +11631,66 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11417
11631
|
} catch (error) {
|
|
11418
11632
|
if (error instanceof Error) {
|
|
11419
11633
|
if (error.message.includes("Not authenticated")) {
|
|
11420
|
-
console.error(
|
|
11421
|
-
console.error(
|
|
11634
|
+
console.error(chalk52.red("\u2717 Not authenticated"));
|
|
11635
|
+
console.error(chalk52.dim(" Run: vm0 auth login"));
|
|
11422
11636
|
} else {
|
|
11423
|
-
console.error(
|
|
11637
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
11424
11638
|
}
|
|
11425
11639
|
} else {
|
|
11426
|
-
console.error(
|
|
11640
|
+
console.error(chalk52.red("\u2717 An unexpected error occurred"));
|
|
11427
11641
|
}
|
|
11428
11642
|
process.exit(1);
|
|
11429
11643
|
}
|
|
11430
11644
|
});
|
|
11431
11645
|
|
|
11432
11646
|
// src/commands/secret/index.ts
|
|
11433
|
-
import { Command as
|
|
11647
|
+
import { Command as Command56 } from "commander";
|
|
11434
11648
|
|
|
11435
11649
|
// src/commands/secret/list.ts
|
|
11436
|
-
import { Command as
|
|
11437
|
-
import
|
|
11438
|
-
var listCommand6 = new
|
|
11650
|
+
import { Command as Command53 } from "commander";
|
|
11651
|
+
import chalk53 from "chalk";
|
|
11652
|
+
var listCommand6 = new Command53().name("list").alias("ls").description("List all secrets").action(async () => {
|
|
11439
11653
|
try {
|
|
11440
11654
|
const result = await listSecrets();
|
|
11441
11655
|
if (result.secrets.length === 0) {
|
|
11442
|
-
console.log(
|
|
11656
|
+
console.log(chalk53.dim("No secrets found"));
|
|
11443
11657
|
console.log();
|
|
11444
11658
|
console.log("To add a secret:");
|
|
11445
|
-
console.log(
|
|
11659
|
+
console.log(chalk53.cyan(" vm0 secret set MY_API_KEY <value>"));
|
|
11446
11660
|
return;
|
|
11447
11661
|
}
|
|
11448
|
-
console.log(
|
|
11662
|
+
console.log(chalk53.bold("Secrets:"));
|
|
11449
11663
|
console.log();
|
|
11450
11664
|
for (const secret of result.secrets) {
|
|
11451
|
-
const typeIndicator = secret.type === "model-provider" ?
|
|
11452
|
-
console.log(` ${
|
|
11665
|
+
const typeIndicator = secret.type === "model-provider" ? chalk53.dim(" [model-provider]") : "";
|
|
11666
|
+
console.log(` ${chalk53.cyan(secret.name)}${typeIndicator}`);
|
|
11453
11667
|
if (secret.description) {
|
|
11454
|
-
console.log(` ${
|
|
11668
|
+
console.log(` ${chalk53.dim(secret.description)}`);
|
|
11455
11669
|
}
|
|
11456
11670
|
console.log(
|
|
11457
|
-
` ${
|
|
11671
|
+
` ${chalk53.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
11458
11672
|
);
|
|
11459
11673
|
console.log();
|
|
11460
11674
|
}
|
|
11461
|
-
console.log(
|
|
11675
|
+
console.log(chalk53.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
11462
11676
|
} catch (error) {
|
|
11463
11677
|
if (error instanceof Error) {
|
|
11464
11678
|
if (error.message.includes("Not authenticated")) {
|
|
11465
|
-
console.error(
|
|
11679
|
+
console.error(chalk53.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11466
11680
|
} else {
|
|
11467
|
-
console.error(
|
|
11681
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
11468
11682
|
}
|
|
11469
11683
|
} else {
|
|
11470
|
-
console.error(
|
|
11684
|
+
console.error(chalk53.red("\u2717 An unexpected error occurred"));
|
|
11471
11685
|
}
|
|
11472
11686
|
process.exit(1);
|
|
11473
11687
|
}
|
|
11474
11688
|
});
|
|
11475
11689
|
|
|
11476
11690
|
// src/commands/secret/set.ts
|
|
11477
|
-
import { Command as
|
|
11478
|
-
import
|
|
11479
|
-
var setCommand2 = new
|
|
11691
|
+
import { Command as Command54 } from "commander";
|
|
11692
|
+
import chalk54 from "chalk";
|
|
11693
|
+
var setCommand2 = new Command54().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").argument("<value>", "Secret value").option("-d, --description <description>", "Optional description").action(
|
|
11480
11694
|
async (name, value, options) => {
|
|
11481
11695
|
try {
|
|
11482
11696
|
const secret = await setSecret({
|
|
@@ -11484,29 +11698,29 @@ var setCommand2 = new Command49().name("set").description("Create or update a se
|
|
|
11484
11698
|
value,
|
|
11485
11699
|
description: options.description
|
|
11486
11700
|
});
|
|
11487
|
-
console.log(
|
|
11701
|
+
console.log(chalk54.green(`\u2713 Secret "${secret.name}" saved`));
|
|
11488
11702
|
console.log();
|
|
11489
11703
|
console.log("Use in vm0.yaml:");
|
|
11490
|
-
console.log(
|
|
11491
|
-
console.log(
|
|
11704
|
+
console.log(chalk54.cyan(` environment:`));
|
|
11705
|
+
console.log(chalk54.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
11492
11706
|
} catch (error) {
|
|
11493
11707
|
if (error instanceof Error) {
|
|
11494
11708
|
if (error.message.includes("Not authenticated")) {
|
|
11495
11709
|
console.error(
|
|
11496
|
-
|
|
11710
|
+
chalk54.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
11497
11711
|
);
|
|
11498
11712
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
11499
|
-
console.error(
|
|
11713
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
11500
11714
|
console.log();
|
|
11501
11715
|
console.log("Examples of valid secret names:");
|
|
11502
|
-
console.log(
|
|
11503
|
-
console.log(
|
|
11504
|
-
console.log(
|
|
11716
|
+
console.log(chalk54.dim(" MY_API_KEY"));
|
|
11717
|
+
console.log(chalk54.dim(" GITHUB_TOKEN"));
|
|
11718
|
+
console.log(chalk54.dim(" AWS_ACCESS_KEY_ID"));
|
|
11505
11719
|
} else {
|
|
11506
|
-
console.error(
|
|
11720
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
11507
11721
|
}
|
|
11508
11722
|
} else {
|
|
11509
|
-
console.error(
|
|
11723
|
+
console.error(chalk54.red("\u2717 An unexpected error occurred"));
|
|
11510
11724
|
}
|
|
11511
11725
|
process.exit(1);
|
|
11512
11726
|
}
|
|
@@ -11514,20 +11728,20 @@ var setCommand2 = new Command49().name("set").description("Create or update a se
|
|
|
11514
11728
|
);
|
|
11515
11729
|
|
|
11516
11730
|
// src/commands/secret/delete.ts
|
|
11517
|
-
import { Command as
|
|
11518
|
-
import
|
|
11519
|
-
var deleteCommand2 = new
|
|
11731
|
+
import { Command as Command55 } from "commander";
|
|
11732
|
+
import chalk55 from "chalk";
|
|
11733
|
+
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) => {
|
|
11520
11734
|
try {
|
|
11521
11735
|
try {
|
|
11522
11736
|
await getSecret(name);
|
|
11523
11737
|
} catch {
|
|
11524
|
-
console.error(
|
|
11738
|
+
console.error(chalk55.red(`\u2717 Secret "${name}" not found`));
|
|
11525
11739
|
process.exit(1);
|
|
11526
11740
|
}
|
|
11527
11741
|
if (!options.yes) {
|
|
11528
11742
|
if (!isInteractive()) {
|
|
11529
11743
|
console.error(
|
|
11530
|
-
|
|
11744
|
+
chalk55.red("\u2717 --yes flag is required in non-interactive mode")
|
|
11531
11745
|
);
|
|
11532
11746
|
process.exit(1);
|
|
11533
11747
|
}
|
|
@@ -11536,83 +11750,83 @@ var deleteCommand2 = new Command50().name("delete").description("Delete a secret
|
|
|
11536
11750
|
false
|
|
11537
11751
|
);
|
|
11538
11752
|
if (!confirmed) {
|
|
11539
|
-
console.log(
|
|
11753
|
+
console.log(chalk55.dim("Cancelled"));
|
|
11540
11754
|
return;
|
|
11541
11755
|
}
|
|
11542
11756
|
}
|
|
11543
11757
|
await deleteSecret(name);
|
|
11544
|
-
console.log(
|
|
11758
|
+
console.log(chalk55.green(`\u2713 Secret "${name}" deleted`));
|
|
11545
11759
|
} catch (error) {
|
|
11546
11760
|
if (error instanceof Error) {
|
|
11547
11761
|
if (error.message.includes("Not authenticated")) {
|
|
11548
|
-
console.error(
|
|
11762
|
+
console.error(chalk55.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11549
11763
|
} else {
|
|
11550
|
-
console.error(
|
|
11764
|
+
console.error(chalk55.red(`\u2717 ${error.message}`));
|
|
11551
11765
|
}
|
|
11552
11766
|
} else {
|
|
11553
|
-
console.error(
|
|
11767
|
+
console.error(chalk55.red("\u2717 An unexpected error occurred"));
|
|
11554
11768
|
}
|
|
11555
11769
|
process.exit(1);
|
|
11556
11770
|
}
|
|
11557
11771
|
});
|
|
11558
11772
|
|
|
11559
11773
|
// src/commands/secret/index.ts
|
|
11560
|
-
var secretCommand = new
|
|
11774
|
+
var secretCommand = new Command56().name("secret").description("Manage stored secrets for agent runs").addCommand(listCommand6).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
11561
11775
|
|
|
11562
11776
|
// src/commands/variable/index.ts
|
|
11563
|
-
import { Command as
|
|
11777
|
+
import { Command as Command60 } from "commander";
|
|
11564
11778
|
|
|
11565
11779
|
// src/commands/variable/list.ts
|
|
11566
|
-
import { Command as
|
|
11567
|
-
import
|
|
11780
|
+
import { Command as Command57 } from "commander";
|
|
11781
|
+
import chalk56 from "chalk";
|
|
11568
11782
|
function truncateValue(value, maxLength = 60) {
|
|
11569
11783
|
if (value.length <= maxLength) {
|
|
11570
11784
|
return value;
|
|
11571
11785
|
}
|
|
11572
11786
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
11573
11787
|
}
|
|
11574
|
-
var listCommand7 = new
|
|
11788
|
+
var listCommand7 = new Command57().name("list").alias("ls").description("List all variables").action(async () => {
|
|
11575
11789
|
try {
|
|
11576
11790
|
const result = await listVariables();
|
|
11577
11791
|
if (result.variables.length === 0) {
|
|
11578
|
-
console.log(
|
|
11792
|
+
console.log(chalk56.dim("No variables found"));
|
|
11579
11793
|
console.log();
|
|
11580
11794
|
console.log("To add a variable:");
|
|
11581
|
-
console.log(
|
|
11795
|
+
console.log(chalk56.cyan(" vm0 variable set MY_VAR <value>"));
|
|
11582
11796
|
return;
|
|
11583
11797
|
}
|
|
11584
|
-
console.log(
|
|
11798
|
+
console.log(chalk56.bold("Variables:"));
|
|
11585
11799
|
console.log();
|
|
11586
11800
|
for (const variable of result.variables) {
|
|
11587
11801
|
const displayValue = truncateValue(variable.value);
|
|
11588
|
-
console.log(` ${
|
|
11802
|
+
console.log(` ${chalk56.cyan(variable.name)} = ${displayValue}`);
|
|
11589
11803
|
if (variable.description) {
|
|
11590
|
-
console.log(` ${
|
|
11804
|
+
console.log(` ${chalk56.dim(variable.description)}`);
|
|
11591
11805
|
}
|
|
11592
11806
|
console.log(
|
|
11593
|
-
` ${
|
|
11807
|
+
` ${chalk56.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
11594
11808
|
);
|
|
11595
11809
|
console.log();
|
|
11596
11810
|
}
|
|
11597
|
-
console.log(
|
|
11811
|
+
console.log(chalk56.dim(`Total: ${result.variables.length} variable(s)`));
|
|
11598
11812
|
} catch (error) {
|
|
11599
11813
|
if (error instanceof Error) {
|
|
11600
11814
|
if (error.message.includes("Not authenticated")) {
|
|
11601
|
-
console.error(
|
|
11815
|
+
console.error(chalk56.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11602
11816
|
} else {
|
|
11603
|
-
console.error(
|
|
11817
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
11604
11818
|
}
|
|
11605
11819
|
} else {
|
|
11606
|
-
console.error(
|
|
11820
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
11607
11821
|
}
|
|
11608
11822
|
process.exit(1);
|
|
11609
11823
|
}
|
|
11610
11824
|
});
|
|
11611
11825
|
|
|
11612
11826
|
// src/commands/variable/set.ts
|
|
11613
|
-
import { Command as
|
|
11614
|
-
import
|
|
11615
|
-
var setCommand3 = new
|
|
11827
|
+
import { Command as Command58 } from "commander";
|
|
11828
|
+
import chalk57 from "chalk";
|
|
11829
|
+
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(
|
|
11616
11830
|
async (name, value, options) => {
|
|
11617
11831
|
try {
|
|
11618
11832
|
const variable = await setVariable({
|
|
@@ -11620,29 +11834,29 @@ var setCommand3 = new Command53().name("set").description("Create or update a va
|
|
|
11620
11834
|
value,
|
|
11621
11835
|
description: options.description
|
|
11622
11836
|
});
|
|
11623
|
-
console.log(
|
|
11837
|
+
console.log(chalk57.green(`\u2713 Variable "${variable.name}" saved`));
|
|
11624
11838
|
console.log();
|
|
11625
11839
|
console.log("Use in vm0.yaml:");
|
|
11626
|
-
console.log(
|
|
11627
|
-
console.log(
|
|
11840
|
+
console.log(chalk57.cyan(` environment:`));
|
|
11841
|
+
console.log(chalk57.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
11628
11842
|
} catch (error) {
|
|
11629
11843
|
if (error instanceof Error) {
|
|
11630
11844
|
if (error.message.includes("Not authenticated")) {
|
|
11631
11845
|
console.error(
|
|
11632
|
-
|
|
11846
|
+
chalk57.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
11633
11847
|
);
|
|
11634
11848
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
11635
|
-
console.error(
|
|
11849
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
11636
11850
|
console.log();
|
|
11637
11851
|
console.log("Examples of valid variable names:");
|
|
11638
|
-
console.log(
|
|
11639
|
-
console.log(
|
|
11640
|
-
console.log(
|
|
11852
|
+
console.log(chalk57.dim(" MY_VAR"));
|
|
11853
|
+
console.log(chalk57.dim(" API_URL"));
|
|
11854
|
+
console.log(chalk57.dim(" DEBUG_MODE"));
|
|
11641
11855
|
} else {
|
|
11642
|
-
console.error(
|
|
11856
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
11643
11857
|
}
|
|
11644
11858
|
} else {
|
|
11645
|
-
console.error(
|
|
11859
|
+
console.error(chalk57.red("\u2717 An unexpected error occurred"));
|
|
11646
11860
|
}
|
|
11647
11861
|
process.exit(1);
|
|
11648
11862
|
}
|
|
@@ -11650,15 +11864,15 @@ var setCommand3 = new Command53().name("set").description("Create or update a va
|
|
|
11650
11864
|
);
|
|
11651
11865
|
|
|
11652
11866
|
// src/commands/variable/delete.ts
|
|
11653
|
-
import { Command as
|
|
11654
|
-
import
|
|
11655
|
-
var deleteCommand3 = new
|
|
11867
|
+
import { Command as Command59 } from "commander";
|
|
11868
|
+
import chalk58 from "chalk";
|
|
11869
|
+
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) => {
|
|
11656
11870
|
try {
|
|
11657
11871
|
try {
|
|
11658
11872
|
await getVariable(name);
|
|
11659
11873
|
} catch (error) {
|
|
11660
11874
|
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
11661
|
-
console.error(
|
|
11875
|
+
console.error(chalk58.red(`\u2717 Variable "${name}" not found`));
|
|
11662
11876
|
process.exit(1);
|
|
11663
11877
|
}
|
|
11664
11878
|
throw error;
|
|
@@ -11666,7 +11880,7 @@ var deleteCommand3 = new Command54().name("delete").description("Delete a variab
|
|
|
11666
11880
|
if (!options.yes) {
|
|
11667
11881
|
if (!isInteractive()) {
|
|
11668
11882
|
console.error(
|
|
11669
|
-
|
|
11883
|
+
chalk58.red("\u2717 --yes flag is required in non-interactive mode")
|
|
11670
11884
|
);
|
|
11671
11885
|
process.exit(1);
|
|
11672
11886
|
}
|
|
@@ -11675,43 +11889,43 @@ var deleteCommand3 = new Command54().name("delete").description("Delete a variab
|
|
|
11675
11889
|
false
|
|
11676
11890
|
);
|
|
11677
11891
|
if (!confirmed) {
|
|
11678
|
-
console.log(
|
|
11892
|
+
console.log(chalk58.dim("Cancelled"));
|
|
11679
11893
|
return;
|
|
11680
11894
|
}
|
|
11681
11895
|
}
|
|
11682
11896
|
await deleteVariable(name);
|
|
11683
|
-
console.log(
|
|
11897
|
+
console.log(chalk58.green(`\u2713 Variable "${name}" deleted`));
|
|
11684
11898
|
} catch (error) {
|
|
11685
11899
|
if (error instanceof Error) {
|
|
11686
11900
|
if (error.message.includes("Not authenticated")) {
|
|
11687
|
-
console.error(
|
|
11901
|
+
console.error(chalk58.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11688
11902
|
} else {
|
|
11689
|
-
console.error(
|
|
11903
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
11690
11904
|
}
|
|
11691
11905
|
} else {
|
|
11692
|
-
console.error(
|
|
11906
|
+
console.error(chalk58.red("\u2717 An unexpected error occurred"));
|
|
11693
11907
|
}
|
|
11694
11908
|
process.exit(1);
|
|
11695
11909
|
}
|
|
11696
11910
|
});
|
|
11697
11911
|
|
|
11698
11912
|
// src/commands/variable/index.ts
|
|
11699
|
-
var variableCommand = new
|
|
11913
|
+
var variableCommand = new Command60().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand7).addCommand(setCommand3).addCommand(deleteCommand3);
|
|
11700
11914
|
|
|
11701
11915
|
// src/commands/model-provider/index.ts
|
|
11702
|
-
import { Command as
|
|
11916
|
+
import { Command as Command65 } from "commander";
|
|
11703
11917
|
|
|
11704
11918
|
// src/commands/model-provider/list.ts
|
|
11705
|
-
import { Command as
|
|
11706
|
-
import
|
|
11707
|
-
var listCommand8 = new
|
|
11919
|
+
import { Command as Command61 } from "commander";
|
|
11920
|
+
import chalk59 from "chalk";
|
|
11921
|
+
var listCommand8 = new Command61().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
11708
11922
|
try {
|
|
11709
11923
|
const result = await listModelProviders();
|
|
11710
11924
|
if (result.modelProviders.length === 0) {
|
|
11711
|
-
console.log(
|
|
11925
|
+
console.log(chalk59.dim("No model providers configured"));
|
|
11712
11926
|
console.log();
|
|
11713
11927
|
console.log("To add a model provider:");
|
|
11714
|
-
console.log(
|
|
11928
|
+
console.log(chalk59.cyan(" vm0 model-provider setup"));
|
|
11715
11929
|
return;
|
|
11716
11930
|
}
|
|
11717
11931
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -11725,16 +11939,16 @@ var listCommand8 = new Command56().name("list").alias("ls").description("List al
|
|
|
11725
11939
|
},
|
|
11726
11940
|
{}
|
|
11727
11941
|
);
|
|
11728
|
-
console.log(
|
|
11942
|
+
console.log(chalk59.bold("Model Providers:"));
|
|
11729
11943
|
console.log();
|
|
11730
11944
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
11731
|
-
console.log(` ${
|
|
11945
|
+
console.log(` ${chalk59.cyan(framework)}:`);
|
|
11732
11946
|
for (const provider of providers) {
|
|
11733
|
-
const defaultTag = provider.isDefault ?
|
|
11734
|
-
const modelTag = provider.selectedModel ?
|
|
11947
|
+
const defaultTag = provider.isDefault ? chalk59.green(" (default)") : "";
|
|
11948
|
+
const modelTag = provider.selectedModel ? chalk59.dim(` [${provider.selectedModel}]`) : "";
|
|
11735
11949
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
11736
11950
|
console.log(
|
|
11737
|
-
|
|
11951
|
+
chalk59.dim(
|
|
11738
11952
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
11739
11953
|
)
|
|
11740
11954
|
);
|
|
@@ -11742,33 +11956,33 @@ var listCommand8 = new Command56().name("list").alias("ls").description("List al
|
|
|
11742
11956
|
console.log();
|
|
11743
11957
|
}
|
|
11744
11958
|
console.log(
|
|
11745
|
-
|
|
11959
|
+
chalk59.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
11746
11960
|
);
|
|
11747
11961
|
} catch (error) {
|
|
11748
11962
|
if (error instanceof Error) {
|
|
11749
11963
|
if (error.message.includes("Not authenticated")) {
|
|
11750
|
-
console.error(
|
|
11964
|
+
console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11751
11965
|
} else {
|
|
11752
|
-
console.error(
|
|
11966
|
+
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
11753
11967
|
}
|
|
11754
11968
|
} else {
|
|
11755
|
-
console.error(
|
|
11969
|
+
console.error(chalk59.red("\u2717 An unexpected error occurred"));
|
|
11756
11970
|
}
|
|
11757
11971
|
process.exit(1);
|
|
11758
11972
|
}
|
|
11759
11973
|
});
|
|
11760
11974
|
|
|
11761
11975
|
// src/commands/model-provider/setup.ts
|
|
11762
|
-
import { Command as
|
|
11763
|
-
import
|
|
11976
|
+
import { Command as Command62 } from "commander";
|
|
11977
|
+
import chalk60 from "chalk";
|
|
11764
11978
|
import prompts2 from "prompts";
|
|
11765
11979
|
function validateProviderType(typeStr) {
|
|
11766
11980
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
11767
|
-
console.error(
|
|
11981
|
+
console.error(chalk60.red(`\u2717 Invalid type "${typeStr}"`));
|
|
11768
11982
|
console.log();
|
|
11769
11983
|
console.log("Valid types:");
|
|
11770
11984
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11771
|
-
console.log(` ${
|
|
11985
|
+
console.log(` ${chalk60.cyan(t)} - ${config.label}`);
|
|
11772
11986
|
}
|
|
11773
11987
|
process.exit(1);
|
|
11774
11988
|
}
|
|
@@ -11780,11 +11994,11 @@ function validateModel(type, modelStr) {
|
|
|
11780
11994
|
return modelStr;
|
|
11781
11995
|
}
|
|
11782
11996
|
if (models && !models.includes(modelStr)) {
|
|
11783
|
-
console.error(
|
|
11997
|
+
console.error(chalk60.red(`\u2717 Invalid model "${modelStr}"`));
|
|
11784
11998
|
console.log();
|
|
11785
11999
|
console.log("Valid models:");
|
|
11786
12000
|
for (const m of models) {
|
|
11787
|
-
console.log(` ${
|
|
12001
|
+
console.log(` ${chalk60.cyan(m)}`);
|
|
11788
12002
|
}
|
|
11789
12003
|
process.exit(1);
|
|
11790
12004
|
}
|
|
@@ -11793,12 +12007,12 @@ function validateModel(type, modelStr) {
|
|
|
11793
12007
|
function validateAuthMethod(type, authMethodStr) {
|
|
11794
12008
|
const authMethods = getAuthMethodsForType(type);
|
|
11795
12009
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
11796
|
-
console.error(
|
|
12010
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
11797
12011
|
console.log();
|
|
11798
12012
|
console.log("Valid auth methods:");
|
|
11799
12013
|
if (authMethods) {
|
|
11800
12014
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
11801
|
-
console.log(` ${
|
|
12015
|
+
console.log(` ${chalk60.cyan(method)} - ${config.label}`);
|
|
11802
12016
|
}
|
|
11803
12017
|
}
|
|
11804
12018
|
process.exit(1);
|
|
@@ -11808,7 +12022,7 @@ function validateAuthMethod(type, authMethodStr) {
|
|
|
11808
12022
|
function parseCredentials(type, authMethod, credentialArgs) {
|
|
11809
12023
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11810
12024
|
if (!credentialsConfig) {
|
|
11811
|
-
console.error(
|
|
12025
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11812
12026
|
process.exit(1);
|
|
11813
12027
|
}
|
|
11814
12028
|
const credentialNames = Object.keys(credentialsConfig);
|
|
@@ -11816,7 +12030,7 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11816
12030
|
if (credentialArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
11817
12031
|
if (credentialNames.length !== 1) {
|
|
11818
12032
|
console.error(
|
|
11819
|
-
|
|
12033
|
+
chalk60.red(
|
|
11820
12034
|
"\u2717 Must use KEY=VALUE format for multi-credential auth methods"
|
|
11821
12035
|
)
|
|
11822
12036
|
);
|
|
@@ -11824,13 +12038,13 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11824
12038
|
console.log("Required credentials:");
|
|
11825
12039
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11826
12040
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
11827
|
-
console.log(` ${
|
|
12041
|
+
console.log(` ${chalk60.cyan(name)}${requiredNote}`);
|
|
11828
12042
|
}
|
|
11829
12043
|
process.exit(1);
|
|
11830
12044
|
}
|
|
11831
12045
|
const firstCredentialName = credentialNames[0];
|
|
11832
12046
|
if (!firstCredentialName) {
|
|
11833
|
-
console.error(
|
|
12047
|
+
console.error(chalk60.red("\u2717 No credentials defined for this auth method"));
|
|
11834
12048
|
process.exit(1);
|
|
11835
12049
|
}
|
|
11836
12050
|
return { [firstCredentialName]: firstArg };
|
|
@@ -11839,7 +12053,7 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11839
12053
|
for (const arg of credentialArgs) {
|
|
11840
12054
|
const eqIndex = arg.indexOf("=");
|
|
11841
12055
|
if (eqIndex === -1) {
|
|
11842
|
-
console.error(
|
|
12056
|
+
console.error(chalk60.red(`\u2717 Invalid credential format "${arg}"`));
|
|
11843
12057
|
console.log();
|
|
11844
12058
|
console.log("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
11845
12059
|
process.exit(1);
|
|
@@ -11853,17 +12067,17 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11853
12067
|
function validateCredentials(type, authMethod, credentials) {
|
|
11854
12068
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11855
12069
|
if (!credentialsConfig) {
|
|
11856
|
-
console.error(
|
|
12070
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11857
12071
|
process.exit(1);
|
|
11858
12072
|
}
|
|
11859
12073
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11860
12074
|
if (fieldConfig.required && !credentials[name]) {
|
|
11861
|
-
console.error(
|
|
12075
|
+
console.error(chalk60.red(`\u2717 Missing required credential: ${name}`));
|
|
11862
12076
|
console.log();
|
|
11863
12077
|
console.log("Required credentials:");
|
|
11864
12078
|
for (const [n, fc] of Object.entries(credentialsConfig)) {
|
|
11865
12079
|
if (fc.required) {
|
|
11866
|
-
console.log(` ${
|
|
12080
|
+
console.log(` ${chalk60.cyan(n)} - ${fc.label}`);
|
|
11867
12081
|
}
|
|
11868
12082
|
}
|
|
11869
12083
|
process.exit(1);
|
|
@@ -11871,12 +12085,12 @@ function validateCredentials(type, authMethod, credentials) {
|
|
|
11871
12085
|
}
|
|
11872
12086
|
for (const name of Object.keys(credentials)) {
|
|
11873
12087
|
if (!(name in credentialsConfig)) {
|
|
11874
|
-
console.error(
|
|
12088
|
+
console.error(chalk60.red(`\u2717 Unknown credential: ${name}`));
|
|
11875
12089
|
console.log();
|
|
11876
12090
|
console.log("Valid credentials:");
|
|
11877
12091
|
for (const [n, fc] of Object.entries(credentialsConfig)) {
|
|
11878
12092
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
11879
|
-
console.log(` ${
|
|
12093
|
+
console.log(` ${chalk60.cyan(n)}${requiredNote}`);
|
|
11880
12094
|
}
|
|
11881
12095
|
process.exit(1);
|
|
11882
12096
|
}
|
|
@@ -11899,7 +12113,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11899
12113
|
const defaultAuthMethod = getDefaultAuthMethod(type);
|
|
11900
12114
|
const authMethods = getAuthMethodsForType(type);
|
|
11901
12115
|
if (!defaultAuthMethod || !authMethods) {
|
|
11902
|
-
console.error(
|
|
12116
|
+
console.error(chalk60.red(`\u2717 Provider "${type}" requires --auth-method`));
|
|
11903
12117
|
process.exit(1);
|
|
11904
12118
|
}
|
|
11905
12119
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -11907,7 +12121,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11907
12121
|
authMethod = authMethodNames[0];
|
|
11908
12122
|
} else {
|
|
11909
12123
|
console.error(
|
|
11910
|
-
|
|
12124
|
+
chalk60.red(
|
|
11911
12125
|
`\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
|
|
11912
12126
|
)
|
|
11913
12127
|
);
|
|
@@ -11916,13 +12130,13 @@ function handleNonInteractiveMode(options) {
|
|
|
11916
12130
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
11917
12131
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
11918
12132
|
console.log(
|
|
11919
|
-
` ${
|
|
12133
|
+
` ${chalk60.cyan(method)} - ${config.label}${defaultNote}`
|
|
11920
12134
|
);
|
|
11921
12135
|
}
|
|
11922
12136
|
console.log();
|
|
11923
12137
|
console.log("Example:");
|
|
11924
12138
|
console.log(
|
|
11925
|
-
|
|
12139
|
+
chalk60.cyan(
|
|
11926
12140
|
` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --credential KEY=VALUE`
|
|
11927
12141
|
)
|
|
11928
12142
|
);
|
|
@@ -11942,7 +12156,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11942
12156
|
const credentialArgs = options.credential;
|
|
11943
12157
|
const firstArg = credentialArgs[0];
|
|
11944
12158
|
if (!firstArg) {
|
|
11945
|
-
console.error(
|
|
12159
|
+
console.error(chalk60.red("\u2717 Credential is required"));
|
|
11946
12160
|
process.exit(1);
|
|
11947
12161
|
}
|
|
11948
12162
|
let credential;
|
|
@@ -11991,7 +12205,7 @@ async function promptForModelSelection(type) {
|
|
|
11991
12205
|
if (selected === "__custom__") {
|
|
11992
12206
|
const placeholder = getCustomModelPlaceholder(type);
|
|
11993
12207
|
if (placeholder) {
|
|
11994
|
-
console.log(
|
|
12208
|
+
console.log(chalk60.dim(`Example: ${placeholder}`));
|
|
11995
12209
|
}
|
|
11996
12210
|
const customResponse = await prompts2(
|
|
11997
12211
|
{
|
|
@@ -12036,13 +12250,13 @@ function isSecretCredential(name) {
|
|
|
12036
12250
|
async function promptForCredentials(type, authMethod) {
|
|
12037
12251
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
12038
12252
|
if (!credentialsConfig) {
|
|
12039
|
-
console.error(
|
|
12253
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12040
12254
|
process.exit(1);
|
|
12041
12255
|
}
|
|
12042
12256
|
const credentials = {};
|
|
12043
12257
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
12044
12258
|
if (fieldConfig.helpText) {
|
|
12045
|
-
console.log(
|
|
12259
|
+
console.log(chalk60.dim(fieldConfig.helpText));
|
|
12046
12260
|
}
|
|
12047
12261
|
const isSecret = isSecretCredential(name);
|
|
12048
12262
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -12077,11 +12291,11 @@ async function promptForCredentials(type, authMethod) {
|
|
|
12077
12291
|
}
|
|
12078
12292
|
async function handleInteractiveMode() {
|
|
12079
12293
|
if (!isInteractive()) {
|
|
12080
|
-
console.error(
|
|
12294
|
+
console.error(chalk60.red("\u2717 Interactive mode requires a TTY"));
|
|
12081
12295
|
console.log();
|
|
12082
12296
|
console.log("Use non-interactive mode:");
|
|
12083
12297
|
console.log(
|
|
12084
|
-
|
|
12298
|
+
chalk60.cyan(
|
|
12085
12299
|
' vm0 model-provider setup --type <type> --credential "<value>"'
|
|
12086
12300
|
)
|
|
12087
12301
|
);
|
|
@@ -12098,7 +12312,7 @@ async function handleInteractiveMode() {
|
|
|
12098
12312
|
title = `${title} \u2713`;
|
|
12099
12313
|
}
|
|
12100
12314
|
if (isExperimental) {
|
|
12101
|
-
title = `${title} ${
|
|
12315
|
+
title = `${title} ${chalk60.dim("(experimental)")}`;
|
|
12102
12316
|
}
|
|
12103
12317
|
return {
|
|
12104
12318
|
title,
|
|
@@ -12131,14 +12345,14 @@ async function handleInteractiveMode() {
|
|
|
12131
12345
|
const provider = await convertModelProviderCredential(type);
|
|
12132
12346
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
12133
12347
|
console.log(
|
|
12134
|
-
|
|
12348
|
+
chalk60.green(
|
|
12135
12349
|
`\u2713 Converted "${checkResult.credentialName}" to model provider${defaultNote}`
|
|
12136
12350
|
)
|
|
12137
12351
|
);
|
|
12138
12352
|
await promptSetAsDefault(type, provider.framework, provider.isDefault);
|
|
12139
12353
|
return null;
|
|
12140
12354
|
}
|
|
12141
|
-
console.log(
|
|
12355
|
+
console.log(chalk60.dim("Aborted"));
|
|
12142
12356
|
process.exit(0);
|
|
12143
12357
|
}
|
|
12144
12358
|
if (checkResult.exists && checkResult.currentType === "model-provider") {
|
|
@@ -12169,7 +12383,7 @@ async function handleInteractiveMode() {
|
|
|
12169
12383
|
}
|
|
12170
12384
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
12171
12385
|
console.log();
|
|
12172
|
-
console.log(
|
|
12386
|
+
console.log(chalk60.dim(config.helpText));
|
|
12173
12387
|
console.log();
|
|
12174
12388
|
if (hasAuthMethods(type)) {
|
|
12175
12389
|
const authMethod = await promptForAuthMethod(type);
|
|
@@ -12200,17 +12414,17 @@ async function handleInteractiveMode() {
|
|
|
12200
12414
|
function handleSetupError2(error) {
|
|
12201
12415
|
if (error instanceof Error) {
|
|
12202
12416
|
if (error.message.includes("already exists")) {
|
|
12203
|
-
console.error(
|
|
12417
|
+
console.error(chalk60.red(`\u2717 ${error.message}`));
|
|
12204
12418
|
console.log();
|
|
12205
12419
|
console.log("To convert the existing credential, run:");
|
|
12206
|
-
console.log(
|
|
12420
|
+
console.log(chalk60.cyan(" vm0 model-provider setup --convert"));
|
|
12207
12421
|
} else if (error.message.includes("Not authenticated")) {
|
|
12208
|
-
console.error(
|
|
12422
|
+
console.error(chalk60.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12209
12423
|
} else {
|
|
12210
|
-
console.error(
|
|
12424
|
+
console.error(chalk60.red(`\u2717 ${error.message}`));
|
|
12211
12425
|
}
|
|
12212
12426
|
} else {
|
|
12213
|
-
console.error(
|
|
12427
|
+
console.error(chalk60.red("\u2717 An unexpected error occurred"));
|
|
12214
12428
|
}
|
|
12215
12429
|
process.exit(1);
|
|
12216
12430
|
}
|
|
@@ -12227,13 +12441,13 @@ async function promptSetAsDefault(type, framework, isDefault) {
|
|
|
12227
12441
|
);
|
|
12228
12442
|
if (response.setDefault) {
|
|
12229
12443
|
await setModelProviderDefault(type);
|
|
12230
|
-
console.log(
|
|
12444
|
+
console.log(chalk60.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
12231
12445
|
}
|
|
12232
12446
|
}
|
|
12233
12447
|
function collectCredentials(value, previous) {
|
|
12234
12448
|
return previous.concat([value]);
|
|
12235
12449
|
}
|
|
12236
|
-
var setupCommand2 = new
|
|
12450
|
+
var setupCommand2 = new Command62().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
12237
12451
|
"-c, --credential <value>",
|
|
12238
12452
|
"Credential value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
12239
12453
|
collectCredentials,
|
|
@@ -12256,7 +12470,7 @@ var setupCommand2 = new Command57().name("setup").description("Configure a model
|
|
|
12256
12470
|
});
|
|
12257
12471
|
} else if (options.type || credentialArgs.length > 0) {
|
|
12258
12472
|
console.error(
|
|
12259
|
-
|
|
12473
|
+
chalk60.red("\u2717 Both --type and --credential are required")
|
|
12260
12474
|
);
|
|
12261
12475
|
process.exit(1);
|
|
12262
12476
|
} else {
|
|
@@ -12275,11 +12489,11 @@ var setupCommand2 = new Command57().name("setup").description("Configure a model
|
|
|
12275
12489
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
12276
12490
|
if (!hasModelSelection(input.type)) {
|
|
12277
12491
|
console.log(
|
|
12278
|
-
|
|
12492
|
+
chalk60.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
12279
12493
|
);
|
|
12280
12494
|
} else {
|
|
12281
12495
|
console.log(
|
|
12282
|
-
|
|
12496
|
+
chalk60.green(
|
|
12283
12497
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
12284
12498
|
)
|
|
12285
12499
|
);
|
|
@@ -12305,7 +12519,7 @@ var setupCommand2 = new Command57().name("setup").description("Configure a model
|
|
|
12305
12519
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
12306
12520
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
12307
12521
|
console.log(
|
|
12308
|
-
|
|
12522
|
+
chalk60.green(
|
|
12309
12523
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
12310
12524
|
)
|
|
12311
12525
|
);
|
|
@@ -12323,96 +12537,96 @@ var setupCommand2 = new Command57().name("setup").description("Configure a model
|
|
|
12323
12537
|
);
|
|
12324
12538
|
|
|
12325
12539
|
// src/commands/model-provider/delete.ts
|
|
12326
|
-
import { Command as
|
|
12327
|
-
import
|
|
12328
|
-
var deleteCommand4 = new
|
|
12540
|
+
import { Command as Command63 } from "commander";
|
|
12541
|
+
import chalk61 from "chalk";
|
|
12542
|
+
var deleteCommand4 = new Command63().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
12329
12543
|
try {
|
|
12330
12544
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
12331
|
-
console.error(
|
|
12545
|
+
console.error(chalk61.red(`\u2717 Invalid type "${type}"`));
|
|
12332
12546
|
console.log();
|
|
12333
12547
|
console.log("Valid types:");
|
|
12334
12548
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12335
|
-
console.log(` ${
|
|
12549
|
+
console.log(` ${chalk61.cyan(t)} - ${config.label}`);
|
|
12336
12550
|
}
|
|
12337
12551
|
process.exit(1);
|
|
12338
12552
|
}
|
|
12339
12553
|
await deleteModelProvider(type);
|
|
12340
|
-
console.log(
|
|
12554
|
+
console.log(chalk61.green(`\u2713 Model provider "${type}" deleted`));
|
|
12341
12555
|
} catch (error) {
|
|
12342
12556
|
if (error instanceof Error) {
|
|
12343
12557
|
if (error.message.includes("not found")) {
|
|
12344
|
-
console.error(
|
|
12558
|
+
console.error(chalk61.red(`\u2717 Model provider "${type}" not found`));
|
|
12345
12559
|
} else if (error.message.includes("Not authenticated")) {
|
|
12346
|
-
console.error(
|
|
12560
|
+
console.error(chalk61.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12347
12561
|
} else {
|
|
12348
|
-
console.error(
|
|
12562
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
12349
12563
|
}
|
|
12350
12564
|
} else {
|
|
12351
|
-
console.error(
|
|
12565
|
+
console.error(chalk61.red("\u2717 An unexpected error occurred"));
|
|
12352
12566
|
}
|
|
12353
12567
|
process.exit(1);
|
|
12354
12568
|
}
|
|
12355
12569
|
});
|
|
12356
12570
|
|
|
12357
12571
|
// src/commands/model-provider/set-default.ts
|
|
12358
|
-
import { Command as
|
|
12359
|
-
import
|
|
12360
|
-
var setDefaultCommand = new
|
|
12572
|
+
import { Command as Command64 } from "commander";
|
|
12573
|
+
import chalk62 from "chalk";
|
|
12574
|
+
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) => {
|
|
12361
12575
|
try {
|
|
12362
12576
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
12363
|
-
console.error(
|
|
12577
|
+
console.error(chalk62.red(`\u2717 Invalid type "${type}"`));
|
|
12364
12578
|
console.log();
|
|
12365
12579
|
console.log("Valid types:");
|
|
12366
12580
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12367
|
-
console.log(` ${
|
|
12581
|
+
console.log(` ${chalk62.cyan(t)} - ${config.label}`);
|
|
12368
12582
|
}
|
|
12369
12583
|
process.exit(1);
|
|
12370
12584
|
}
|
|
12371
12585
|
const provider = await setModelProviderDefault(type);
|
|
12372
12586
|
console.log(
|
|
12373
|
-
|
|
12587
|
+
chalk62.green(
|
|
12374
12588
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
12375
12589
|
)
|
|
12376
12590
|
);
|
|
12377
12591
|
} catch (error) {
|
|
12378
12592
|
if (error instanceof Error) {
|
|
12379
12593
|
if (error.message.includes("not found")) {
|
|
12380
|
-
console.error(
|
|
12594
|
+
console.error(chalk62.red(`\u2717 Model provider "${type}" not found`));
|
|
12381
12595
|
} else if (error.message.includes("Not authenticated")) {
|
|
12382
|
-
console.error(
|
|
12596
|
+
console.error(chalk62.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12383
12597
|
} else {
|
|
12384
|
-
console.error(
|
|
12598
|
+
console.error(chalk62.red(`\u2717 ${error.message}`));
|
|
12385
12599
|
}
|
|
12386
12600
|
} else {
|
|
12387
|
-
console.error(
|
|
12601
|
+
console.error(chalk62.red("\u2717 An unexpected error occurred"));
|
|
12388
12602
|
}
|
|
12389
12603
|
process.exit(1);
|
|
12390
12604
|
}
|
|
12391
12605
|
});
|
|
12392
12606
|
|
|
12393
12607
|
// src/commands/model-provider/index.ts
|
|
12394
|
-
var modelProviderCommand = new
|
|
12608
|
+
var modelProviderCommand = new Command65().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand4).addCommand(setDefaultCommand);
|
|
12395
12609
|
|
|
12396
12610
|
// src/commands/onboard/index.ts
|
|
12397
|
-
import { Command as
|
|
12398
|
-
import
|
|
12611
|
+
import { Command as Command66 } from "commander";
|
|
12612
|
+
import chalk66 from "chalk";
|
|
12399
12613
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
12400
12614
|
import { existsSync as existsSync11 } from "fs";
|
|
12401
12615
|
|
|
12402
12616
|
// src/lib/ui/welcome-box.ts
|
|
12403
|
-
import
|
|
12617
|
+
import chalk63 from "chalk";
|
|
12404
12618
|
var gradientColors = [
|
|
12405
|
-
|
|
12619
|
+
chalk63.hex("#FFAB5E"),
|
|
12406
12620
|
// Line 1 - lightest
|
|
12407
|
-
|
|
12621
|
+
chalk63.hex("#FF9642"),
|
|
12408
12622
|
// Line 2
|
|
12409
|
-
|
|
12623
|
+
chalk63.hex("#FF8228"),
|
|
12410
12624
|
// Line 3
|
|
12411
|
-
|
|
12625
|
+
chalk63.hex("#FF6D0A"),
|
|
12412
12626
|
// Line 4
|
|
12413
|
-
|
|
12627
|
+
chalk63.hex("#E85D00"),
|
|
12414
12628
|
// Line 5
|
|
12415
|
-
|
|
12629
|
+
chalk63.hex("#CC4E00")
|
|
12416
12630
|
// Line 6 - darkest
|
|
12417
12631
|
];
|
|
12418
12632
|
var vm0LogoLines = [
|
|
@@ -12434,15 +12648,15 @@ function renderVm0Banner() {
|
|
|
12434
12648
|
function renderOnboardWelcome() {
|
|
12435
12649
|
renderVm0Banner();
|
|
12436
12650
|
console.log(` Build agentic workflows using natural language.`);
|
|
12437
|
-
console.log(` ${
|
|
12651
|
+
console.log(` ${chalk63.dim("Currently in beta, enjoy it free.")}`);
|
|
12438
12652
|
console.log(
|
|
12439
|
-
` ${
|
|
12653
|
+
` ${chalk63.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
12440
12654
|
);
|
|
12441
12655
|
console.log();
|
|
12442
12656
|
}
|
|
12443
12657
|
|
|
12444
12658
|
// src/lib/ui/step-runner.ts
|
|
12445
|
-
import
|
|
12659
|
+
import chalk64 from "chalk";
|
|
12446
12660
|
function createStepRunner(options = true) {
|
|
12447
12661
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
12448
12662
|
const interactive = opts.interactive ?? true;
|
|
@@ -12457,25 +12671,25 @@ function createStepRunner(options = true) {
|
|
|
12457
12671
|
}
|
|
12458
12672
|
for (const [i, step] of completedSteps.entries()) {
|
|
12459
12673
|
if (step.failed) {
|
|
12460
|
-
console.log(
|
|
12674
|
+
console.log(chalk64.red(`\u2717 ${step.label}`));
|
|
12461
12675
|
} else {
|
|
12462
|
-
console.log(
|
|
12676
|
+
console.log(chalk64.green(`\u25CF ${step.label}`));
|
|
12463
12677
|
}
|
|
12464
12678
|
const isLastStep = i === completedSteps.length - 1;
|
|
12465
12679
|
if (!isLastStep || !isFinal) {
|
|
12466
|
-
console.log(
|
|
12680
|
+
console.log(chalk64.dim("\u2502"));
|
|
12467
12681
|
}
|
|
12468
12682
|
}
|
|
12469
12683
|
}
|
|
12470
12684
|
async function executeStep(label, fn, isFinal) {
|
|
12471
12685
|
let stepFailed = false;
|
|
12472
|
-
console.log(
|
|
12686
|
+
console.log(chalk64.yellow(`\u25CB ${label}`));
|
|
12473
12687
|
const ctx = {
|
|
12474
12688
|
connector() {
|
|
12475
|
-
console.log(
|
|
12689
|
+
console.log(chalk64.dim("\u2502"));
|
|
12476
12690
|
},
|
|
12477
12691
|
detail(message) {
|
|
12478
|
-
console.log(`${
|
|
12692
|
+
console.log(`${chalk64.dim("\u2502")} ${message}`);
|
|
12479
12693
|
},
|
|
12480
12694
|
async prompt(promptFn) {
|
|
12481
12695
|
return await promptFn();
|
|
@@ -12492,12 +12706,12 @@ function createStepRunner(options = true) {
|
|
|
12492
12706
|
redrawCompletedSteps(isFinal);
|
|
12493
12707
|
} else {
|
|
12494
12708
|
if (stepFailed) {
|
|
12495
|
-
console.log(
|
|
12709
|
+
console.log(chalk64.red(`\u2717 ${label}`));
|
|
12496
12710
|
} else {
|
|
12497
|
-
console.log(
|
|
12711
|
+
console.log(chalk64.green(`\u25CF ${label}`));
|
|
12498
12712
|
}
|
|
12499
12713
|
if (!isFinal) {
|
|
12500
|
-
console.log(
|
|
12714
|
+
console.log(chalk64.dim("\u2502"));
|
|
12501
12715
|
}
|
|
12502
12716
|
}
|
|
12503
12717
|
}
|
|
@@ -12655,7 +12869,7 @@ async function setupModelProvider(type, credential, options) {
|
|
|
12655
12869
|
|
|
12656
12870
|
// src/lib/domain/onboard/claude-setup.ts
|
|
12657
12871
|
import { spawn as spawn3 } from "child_process";
|
|
12658
|
-
import
|
|
12872
|
+
import chalk65 from "chalk";
|
|
12659
12873
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
12660
12874
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
12661
12875
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -12692,12 +12906,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
12692
12906
|
}
|
|
12693
12907
|
function handlePluginError(error, context) {
|
|
12694
12908
|
const displayContext = context ?? "Claude plugin";
|
|
12695
|
-
console.error(
|
|
12909
|
+
console.error(chalk65.red(`Failed to install ${displayContext}`));
|
|
12696
12910
|
if (error instanceof Error) {
|
|
12697
|
-
console.error(
|
|
12911
|
+
console.error(chalk65.red(error.message));
|
|
12698
12912
|
}
|
|
12699
12913
|
console.error(
|
|
12700
|
-
|
|
12914
|
+
chalk65.dim("Please ensure Claude CLI is installed and accessible.")
|
|
12701
12915
|
);
|
|
12702
12916
|
process.exit(1);
|
|
12703
12917
|
}
|
|
@@ -12740,7 +12954,7 @@ async function updateMarketplace() {
|
|
|
12740
12954
|
]);
|
|
12741
12955
|
if (!result.success) {
|
|
12742
12956
|
console.warn(
|
|
12743
|
-
|
|
12957
|
+
chalk65.yellow(
|
|
12744
12958
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
12745
12959
|
)
|
|
12746
12960
|
);
|
|
@@ -12778,7 +12992,7 @@ async function handleAuthentication(ctx) {
|
|
|
12778
12992
|
return;
|
|
12779
12993
|
}
|
|
12780
12994
|
if (!ctx.interactive) {
|
|
12781
|
-
console.error(
|
|
12995
|
+
console.error(chalk66.red("Error: Not authenticated"));
|
|
12782
12996
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
12783
12997
|
process.exit(1);
|
|
12784
12998
|
}
|
|
@@ -12786,16 +13000,16 @@ async function handleAuthentication(ctx) {
|
|
|
12786
13000
|
onInitiating: () => {
|
|
12787
13001
|
},
|
|
12788
13002
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
12789
|
-
step.detail(`Copy code: ${
|
|
12790
|
-
step.detail(`Open: ${
|
|
12791
|
-
step.detail(
|
|
13003
|
+
step.detail(`Copy code: ${chalk66.cyan.bold(code)}`);
|
|
13004
|
+
step.detail(`Open: ${chalk66.cyan(url)}`);
|
|
13005
|
+
step.detail(chalk66.dim(`Expires in ${expiresIn} minutes`));
|
|
12792
13006
|
},
|
|
12793
13007
|
onPolling: () => {
|
|
12794
13008
|
},
|
|
12795
13009
|
onSuccess: () => {
|
|
12796
13010
|
},
|
|
12797
13011
|
onError: (error) => {
|
|
12798
|
-
console.error(
|
|
13012
|
+
console.error(chalk66.red(`
|
|
12799
13013
|
${error.message}`));
|
|
12800
13014
|
process.exit(1);
|
|
12801
13015
|
}
|
|
@@ -12809,7 +13023,7 @@ async function handleModelProvider(ctx) {
|
|
|
12809
13023
|
return;
|
|
12810
13024
|
}
|
|
12811
13025
|
if (!ctx.interactive) {
|
|
12812
|
-
console.error(
|
|
13026
|
+
console.error(chalk66.red("Error: No model provider configured"));
|
|
12813
13027
|
console.error("Run 'vm0 model-provider setup' first");
|
|
12814
13028
|
process.exit(1);
|
|
12815
13029
|
}
|
|
@@ -12830,7 +13044,7 @@ async function handleModelProvider(ctx) {
|
|
|
12830
13044
|
const selectedChoice = choices.find((c23) => c23.type === providerType);
|
|
12831
13045
|
if (selectedChoice?.helpText) {
|
|
12832
13046
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
12833
|
-
step.detail(
|
|
13047
|
+
step.detail(chalk66.dim(line));
|
|
12834
13048
|
}
|
|
12835
13049
|
}
|
|
12836
13050
|
const credential = await step.prompt(
|
|
@@ -12839,7 +13053,7 @@ async function handleModelProvider(ctx) {
|
|
|
12839
13053
|
)
|
|
12840
13054
|
);
|
|
12841
13055
|
if (!credential) {
|
|
12842
|
-
console.log(
|
|
13056
|
+
console.log(chalk66.dim("Cancelled"));
|
|
12843
13057
|
process.exit(0);
|
|
12844
13058
|
}
|
|
12845
13059
|
let selectedModel;
|
|
@@ -12858,7 +13072,7 @@ async function handleModelProvider(ctx) {
|
|
|
12858
13072
|
() => promptSelect("Select model:", modelChoices)
|
|
12859
13073
|
);
|
|
12860
13074
|
if (modelSelection === void 0) {
|
|
12861
|
-
console.log(
|
|
13075
|
+
console.log(chalk66.dim("Cancelled"));
|
|
12862
13076
|
process.exit(0);
|
|
12863
13077
|
}
|
|
12864
13078
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -12868,7 +13082,7 @@ async function handleModelProvider(ctx) {
|
|
|
12868
13082
|
});
|
|
12869
13083
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
12870
13084
|
step.detail(
|
|
12871
|
-
|
|
13085
|
+
chalk66.green(
|
|
12872
13086
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
12873
13087
|
)
|
|
12874
13088
|
);
|
|
@@ -12899,7 +13113,7 @@ async function handleAgentCreation(ctx) {
|
|
|
12899
13113
|
agentName = inputName;
|
|
12900
13114
|
if (existsSync11(agentName)) {
|
|
12901
13115
|
step.detail(
|
|
12902
|
-
|
|
13116
|
+
chalk66.yellow(`${agentName}/ already exists, choose another name`)
|
|
12903
13117
|
);
|
|
12904
13118
|
} else {
|
|
12905
13119
|
folderExists = false;
|
|
@@ -12908,22 +13122,22 @@ async function handleAgentCreation(ctx) {
|
|
|
12908
13122
|
} else {
|
|
12909
13123
|
if (!validateAgentName(agentName)) {
|
|
12910
13124
|
console.error(
|
|
12911
|
-
|
|
13125
|
+
chalk66.red(
|
|
12912
13126
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
12913
13127
|
)
|
|
12914
13128
|
);
|
|
12915
13129
|
process.exit(1);
|
|
12916
13130
|
}
|
|
12917
13131
|
if (existsSync11(agentName)) {
|
|
12918
|
-
console.error(
|
|
13132
|
+
console.error(chalk66.red(`${agentName}/ already exists`));
|
|
12919
13133
|
console.log();
|
|
12920
13134
|
console.log("Remove it first or choose a different name:");
|
|
12921
|
-
console.log(
|
|
13135
|
+
console.log(chalk66.cyan(` rm -rf ${agentName}`));
|
|
12922
13136
|
process.exit(1);
|
|
12923
13137
|
}
|
|
12924
13138
|
}
|
|
12925
13139
|
await mkdir8(agentName, { recursive: true });
|
|
12926
|
-
step.detail(
|
|
13140
|
+
step.detail(chalk66.green(`Created ${agentName}/`));
|
|
12927
13141
|
});
|
|
12928
13142
|
return agentName;
|
|
12929
13143
|
}
|
|
@@ -12939,7 +13153,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12939
13153
|
shouldInstall = confirmed ?? true;
|
|
12940
13154
|
}
|
|
12941
13155
|
if (!shouldInstall) {
|
|
12942
|
-
step.detail(
|
|
13156
|
+
step.detail(chalk66.dim("Skipped"));
|
|
12943
13157
|
return;
|
|
12944
13158
|
}
|
|
12945
13159
|
const scope = "project";
|
|
@@ -12947,7 +13161,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12947
13161
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
12948
13162
|
const result = await installVm0Plugin(scope, agentDir);
|
|
12949
13163
|
step.detail(
|
|
12950
|
-
|
|
13164
|
+
chalk66.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
12951
13165
|
);
|
|
12952
13166
|
pluginInstalled = true;
|
|
12953
13167
|
} catch (error) {
|
|
@@ -12958,18 +13172,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12958
13172
|
}
|
|
12959
13173
|
function printNextSteps(agentName, pluginInstalled) {
|
|
12960
13174
|
console.log();
|
|
12961
|
-
console.log(
|
|
13175
|
+
console.log(chalk66.bold("Next step:"));
|
|
12962
13176
|
console.log();
|
|
12963
13177
|
if (pluginInstalled) {
|
|
12964
13178
|
console.log(
|
|
12965
|
-
` ${
|
|
13179
|
+
` ${chalk66.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
12966
13180
|
);
|
|
12967
13181
|
} else {
|
|
12968
|
-
console.log(` ${
|
|
13182
|
+
console.log(` ${chalk66.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
12969
13183
|
}
|
|
12970
13184
|
console.log();
|
|
12971
13185
|
}
|
|
12972
|
-
var onboardCommand = new
|
|
13186
|
+
var onboardCommand = new Command66().name("onboard").description("Guided setup for new VM0 users").option("-y, --yes", "Skip confirmation prompts").option("--name <name>", `Agent name (default: ${DEFAULT_AGENT_NAME})`).action(async (options) => {
|
|
12973
13187
|
const interactive = isInteractive();
|
|
12974
13188
|
if (interactive) {
|
|
12975
13189
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -12992,15 +13206,15 @@ var onboardCommand = new Command61().name("onboard").description("Guided setup f
|
|
|
12992
13206
|
});
|
|
12993
13207
|
|
|
12994
13208
|
// src/commands/setup-claude/index.ts
|
|
12995
|
-
import { Command as
|
|
12996
|
-
import
|
|
12997
|
-
var setupClaudeCommand = new
|
|
12998
|
-
console.log(
|
|
13209
|
+
import { Command as Command67 } from "commander";
|
|
13210
|
+
import chalk67 from "chalk";
|
|
13211
|
+
var setupClaudeCommand = new Command67().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) => {
|
|
13212
|
+
console.log(chalk67.dim("Installing VM0 Claude Plugin..."));
|
|
12999
13213
|
const scope = options.scope === "user" ? "user" : "project";
|
|
13000
13214
|
try {
|
|
13001
13215
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
13002
13216
|
console.log(
|
|
13003
|
-
|
|
13217
|
+
chalk67.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13004
13218
|
);
|
|
13005
13219
|
} catch (error) {
|
|
13006
13220
|
handlePluginError(error);
|
|
@@ -13009,15 +13223,15 @@ var setupClaudeCommand = new Command62().name("setup-claude").description("Insta
|
|
|
13009
13223
|
console.log("Next step:");
|
|
13010
13224
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
13011
13225
|
console.log(
|
|
13012
|
-
|
|
13226
|
+
chalk67.cyan(
|
|
13013
13227
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
13014
13228
|
)
|
|
13015
13229
|
);
|
|
13016
13230
|
});
|
|
13017
13231
|
|
|
13018
13232
|
// src/index.ts
|
|
13019
|
-
var program = new
|
|
13020
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
13233
|
+
var program = new Command68();
|
|
13234
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.19.0");
|
|
13021
13235
|
program.addCommand(authCommand);
|
|
13022
13236
|
program.addCommand(infoCommand);
|
|
13023
13237
|
program.addCommand(composeCommand);
|