@mutagent/cli 0.1.53 → 0.1.55
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/dist/bin/cli.js +460 -148
- package/dist/bin/cli.js.map +9 -6
- package/dist/index.js +41 -2
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -608,7 +608,7 @@ class SDKClientWrapper {
|
|
|
608
608
|
async deletePrompt(id, options) {
|
|
609
609
|
try {
|
|
610
610
|
if (options?.force) {
|
|
611
|
-
await this.request(`/api/
|
|
611
|
+
await this.request(`/api/prompt/${id}?force=true`, { method: "DELETE" });
|
|
612
612
|
} else {
|
|
613
613
|
await this.sdk.prompt.deletePrompt({ id: parseInt(id, 10) });
|
|
614
614
|
}
|
|
@@ -1003,6 +1003,45 @@ class SDKClientWrapper {
|
|
|
1003
1003
|
this.handleError(error);
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
|
+
async createProvider(data) {
|
|
1007
|
+
try {
|
|
1008
|
+
const response = await this.sdk.providerConfigs.createProvider({
|
|
1009
|
+
name: data.name,
|
|
1010
|
+
provider: data.provider,
|
|
1011
|
+
apiKey: data.apiKey,
|
|
1012
|
+
scope: data.scope ?? {},
|
|
1013
|
+
baseUrl: data.baseUrl,
|
|
1014
|
+
isDefault: data.isDefault
|
|
1015
|
+
});
|
|
1016
|
+
return response;
|
|
1017
|
+
} catch (error) {
|
|
1018
|
+
this.handleError(error);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
async updateProvider(id, data) {
|
|
1022
|
+
try {
|
|
1023
|
+
const response = await this.sdk.providerConfigs.updateProvider({
|
|
1024
|
+
id,
|
|
1025
|
+
body: {
|
|
1026
|
+
name: data.name,
|
|
1027
|
+
apiKey: data.apiKey,
|
|
1028
|
+
isActive: data.isActive,
|
|
1029
|
+
isDefault: data.isDefault,
|
|
1030
|
+
baseUrl: data.baseUrl
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
return response;
|
|
1034
|
+
} catch (error) {
|
|
1035
|
+
this.handleError(error);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
async deleteProvider(id) {
|
|
1039
|
+
try {
|
|
1040
|
+
await this.sdk.providerConfigs.deleteProvider({ id });
|
|
1041
|
+
} catch (error) {
|
|
1042
|
+
this.handleError(error);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1006
1045
|
}
|
|
1007
1046
|
function getSDKClient() {
|
|
1008
1047
|
if (!sdkClient) {
|
|
@@ -1067,7 +1106,7 @@ var init_sdk_client = __esm(() => {
|
|
|
1067
1106
|
|
|
1068
1107
|
// src/bin/cli.ts
|
|
1069
1108
|
import { Command as Command19 } from "commander";
|
|
1070
|
-
import
|
|
1109
|
+
import chalk30 from "chalk";
|
|
1071
1110
|
import { readFileSync as readFileSync11 } from "fs";
|
|
1072
1111
|
import { join as join9, dirname } from "path";
|
|
1073
1112
|
import { fileURLToPath } from "url";
|
|
@@ -7208,11 +7247,290 @@ Examples:
|
|
|
7208
7247
|
return workspaces;
|
|
7209
7248
|
}
|
|
7210
7249
|
|
|
7211
|
-
// src/commands/providers.ts
|
|
7250
|
+
// src/commands/providers/index.ts
|
|
7212
7251
|
init_sdk_client();
|
|
7213
7252
|
import { Command as Command13 } from "commander";
|
|
7253
|
+
import chalk25 from "chalk";
|
|
7254
|
+
init_errors();
|
|
7255
|
+
|
|
7256
|
+
// src/commands/providers/add.ts
|
|
7257
|
+
init_sdk_client();
|
|
7214
7258
|
import chalk22 from "chalk";
|
|
7215
7259
|
init_errors();
|
|
7260
|
+
function resolveScope(scopeFlag, client) {
|
|
7261
|
+
const scope = scopeFlag ?? "workspace";
|
|
7262
|
+
if (scope === "workspace") {
|
|
7263
|
+
const wsId = client.getCurrentWorkspaceId();
|
|
7264
|
+
if (!wsId) {
|
|
7265
|
+
throw new MutagentError("MISSING_WORKSPACE", "No workspace configured. Cannot create workspace-scoped provider.", "Run: mutagent config set defaultWorkspace <workspace-id>");
|
|
7266
|
+
}
|
|
7267
|
+
return { workspaceId: wsId };
|
|
7268
|
+
}
|
|
7269
|
+
if (scope === "org") {
|
|
7270
|
+
const orgId = client.getCurrentOrgId();
|
|
7271
|
+
if (!orgId) {
|
|
7272
|
+
throw new MutagentError("MISSING_ORGANIZATION", "No organization configured. Cannot create org-scoped provider.", "Run: mutagent config set defaultOrganization <org-id>");
|
|
7273
|
+
}
|
|
7274
|
+
return { organizationId: orgId };
|
|
7275
|
+
}
|
|
7276
|
+
return {};
|
|
7277
|
+
}
|
|
7278
|
+
function registerAddCommand(parent) {
|
|
7279
|
+
parent.command("add").description("Add a new provider configuration").requiredOption("-p, --provider <type>", "Provider type (openai, anthropic, google, ...)").requiredOption("-n, --name <name>", "Display name for this provider").requiredOption("-k, --api-key <key>", "API key for the provider").option("-s, --scope <scope>", "Scope: workspace (default), org, user", "workspace").option("--base-url <url>", "Custom base URL for the provider API").option("--set-default", "Set as default provider for this scope").addHelpText("after", `
|
|
7280
|
+
Examples:
|
|
7281
|
+
${chalk22.dim("$")} mutagent providers add --provider openai --name "My OpenAI" --api-key $OPENAI_API_KEY
|
|
7282
|
+
${chalk22.dim("$")} mutagent providers add --provider anthropic --name "Team Claude" --api-key $KEY --scope org
|
|
7283
|
+
${chalk22.dim("$")} mutagent providers add --provider openai --name "Personal" --api-key $KEY --scope user --set-default
|
|
7284
|
+
${chalk22.dim("$")} mutagent providers add --provider custom --name "Ollama" --api-key none --base-url http://localhost:11434 --json
|
|
7285
|
+
|
|
7286
|
+
Scope Resolution:
|
|
7287
|
+
workspace (default) Uses your configured workspace
|
|
7288
|
+
org Uses your configured organization
|
|
7289
|
+
user Personal provider config
|
|
7290
|
+
|
|
7291
|
+
The API key is encrypted server-side and never returned in plain text.
|
|
7292
|
+
`).action(async (options) => {
|
|
7293
|
+
const isJson = getJsonFlag(parent);
|
|
7294
|
+
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
7295
|
+
try {
|
|
7296
|
+
const providerType = validateProviderType(options.provider);
|
|
7297
|
+
if (!options.apiKey || options.apiKey.trim() === "") {
|
|
7298
|
+
throw new MutagentError("MISSING_API_KEY", "API key cannot be empty", "Provide a valid API key with --api-key");
|
|
7299
|
+
}
|
|
7300
|
+
const validScopes = ["workspace", "org", "user"];
|
|
7301
|
+
if (options.scope && !validScopes.includes(options.scope)) {
|
|
7302
|
+
throw new MutagentError("INVALID_SCOPE", `Invalid scope: ${options.scope}`, `Valid scopes: ${validScopes.join(", ")}`);
|
|
7303
|
+
}
|
|
7304
|
+
const client = getSDKClient();
|
|
7305
|
+
const scope = resolveScope(options.scope, client);
|
|
7306
|
+
const created = await client.createProvider({
|
|
7307
|
+
name: options.name,
|
|
7308
|
+
provider: providerType,
|
|
7309
|
+
apiKey: options.apiKey,
|
|
7310
|
+
scope,
|
|
7311
|
+
baseUrl: options.baseUrl,
|
|
7312
|
+
isDefault: options.setDefault
|
|
7313
|
+
});
|
|
7314
|
+
if (isJson) {
|
|
7315
|
+
const directive = buildProviderCreatedDirective(created, options.scope ?? "workspace");
|
|
7316
|
+
echoDirectiveToStderr(directive);
|
|
7317
|
+
output.output({
|
|
7318
|
+
success: true,
|
|
7319
|
+
...created,
|
|
7320
|
+
_links: providerLinks(created.id),
|
|
7321
|
+
_directive: directive
|
|
7322
|
+
});
|
|
7323
|
+
} else {
|
|
7324
|
+
output.success(`Provider created: ${created.name ?? options.name}`);
|
|
7325
|
+
console.log(` ID: ${String(created.id)}`);
|
|
7326
|
+
console.log(` Type: ${providerType}`);
|
|
7327
|
+
console.log(` Scope: ${options.scope ?? "workspace"}`);
|
|
7328
|
+
console.log(` URL: ${providerLink(created.id)}`);
|
|
7329
|
+
if (options.setDefault) {
|
|
7330
|
+
console.log(chalk22.green(" Set as default provider"));
|
|
7331
|
+
}
|
|
7332
|
+
console.log("");
|
|
7333
|
+
console.log(chalk22.dim("API key is encrypted server-side. Use `providers get` to see masked key."));
|
|
7334
|
+
}
|
|
7335
|
+
} catch (error) {
|
|
7336
|
+
handleError(error, isJson);
|
|
7337
|
+
}
|
|
7338
|
+
});
|
|
7339
|
+
}
|
|
7340
|
+
function buildProviderCreatedDirective(provider, scope) {
|
|
7341
|
+
const title = `Provider Created — ${provider.name ?? "Unknown"}`;
|
|
7342
|
+
const dashboardUrl = providerLink(provider.id);
|
|
7343
|
+
const apiUrl = `/api/providers/${String(provider.id)}`;
|
|
7344
|
+
const rows = [
|
|
7345
|
+
{ label: "Name", value: provider.name ?? "Unknown" },
|
|
7346
|
+
{ label: "Provider ID", value: String(provider.id) },
|
|
7347
|
+
{ label: "Scope", value: scope }
|
|
7348
|
+
];
|
|
7349
|
+
const links = [
|
|
7350
|
+
{ label: "Settings", url: dashboardUrl },
|
|
7351
|
+
{ label: "API", url: apiUrl }
|
|
7352
|
+
];
|
|
7353
|
+
const next = [
|
|
7354
|
+
`mutagent providers test ${String(provider.id)} --json`,
|
|
7355
|
+
`mutagent providers list --json`
|
|
7356
|
+
];
|
|
7357
|
+
return {
|
|
7358
|
+
display: "status_card",
|
|
7359
|
+
template: "provider_created",
|
|
7360
|
+
title,
|
|
7361
|
+
fields: { providerId: String(provider.id), name: provider.name, scope },
|
|
7362
|
+
links: { settings: dashboardUrl, api: apiUrl },
|
|
7363
|
+
next,
|
|
7364
|
+
instruction: "MANDATORY: Display this card to the user before proceeding.",
|
|
7365
|
+
renderedCard: renderPlainCard({ title, icon: "+", rows, links, next })
|
|
7366
|
+
};
|
|
7367
|
+
}
|
|
7368
|
+
|
|
7369
|
+
// src/commands/providers/update.ts
|
|
7370
|
+
init_sdk_client();
|
|
7371
|
+
import chalk23 from "chalk";
|
|
7372
|
+
init_errors();
|
|
7373
|
+
function registerUpdateCommand(parent) {
|
|
7374
|
+
parent.command("update").description("Update an existing provider configuration").argument("<id>", "Provider ID (from: mutagent providers list)").option("-n, --name <name>", "Updated display name").option("-k, --api-key <key>", "Updated API key (will be re-encrypted)").option("--active <bool>", "Activate or deactivate (true|false)").option("--set-default", "Set as default provider for its scope").option("--base-url <url>", 'Updated base URL (use "" to clear)').addHelpText("after", `
|
|
7375
|
+
Examples:
|
|
7376
|
+
${chalk23.dim("$")} mutagent providers update <id> --name "New Name"
|
|
7377
|
+
${chalk23.dim("$")} mutagent providers update <id> --api-key $NEW_KEY --json
|
|
7378
|
+
${chalk23.dim("$")} mutagent providers update <id> --active false
|
|
7379
|
+
${chalk23.dim("$")} mutagent providers update <id> --set-default --json
|
|
7380
|
+
|
|
7381
|
+
PATCH semantics — only provided fields are updated.
|
|
7382
|
+
`).action(async (id, options) => {
|
|
7383
|
+
const isJson = getJsonFlag(parent);
|
|
7384
|
+
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
7385
|
+
try {
|
|
7386
|
+
const updateData = {};
|
|
7387
|
+
let hasUpdates = false;
|
|
7388
|
+
if (options.name !== undefined) {
|
|
7389
|
+
updateData.name = options.name;
|
|
7390
|
+
hasUpdates = true;
|
|
7391
|
+
}
|
|
7392
|
+
if (options.apiKey !== undefined) {
|
|
7393
|
+
updateData.apiKey = options.apiKey;
|
|
7394
|
+
hasUpdates = true;
|
|
7395
|
+
}
|
|
7396
|
+
if (options.active !== undefined) {
|
|
7397
|
+
if (options.active !== "true" && options.active !== "false") {
|
|
7398
|
+
throw new MutagentError("INVALID_OPTION", `Invalid --active value: ${options.active}`, "Use --active true or --active false");
|
|
7399
|
+
}
|
|
7400
|
+
updateData.isActive = options.active === "true";
|
|
7401
|
+
hasUpdates = true;
|
|
7402
|
+
}
|
|
7403
|
+
if (options.setDefault) {
|
|
7404
|
+
updateData.isDefault = true;
|
|
7405
|
+
hasUpdates = true;
|
|
7406
|
+
}
|
|
7407
|
+
if (options.baseUrl !== undefined) {
|
|
7408
|
+
updateData.baseUrl = options.baseUrl === "" ? null : options.baseUrl;
|
|
7409
|
+
hasUpdates = true;
|
|
7410
|
+
}
|
|
7411
|
+
if (!hasUpdates) {
|
|
7412
|
+
throw new MutagentError("NO_UPDATES", "No update fields provided", "Provide at least one of: --name, --api-key, --active, --set-default, --base-url");
|
|
7413
|
+
}
|
|
7414
|
+
const client = getSDKClient();
|
|
7415
|
+
const updated = await client.updateProvider(id, updateData);
|
|
7416
|
+
if (isJson) {
|
|
7417
|
+
const directive = buildProviderUpdatedDirective(updated, id);
|
|
7418
|
+
echoDirectiveToStderr(directive);
|
|
7419
|
+
output.output({
|
|
7420
|
+
success: true,
|
|
7421
|
+
...updated,
|
|
7422
|
+
_links: providerLinks(updated.id ?? id),
|
|
7423
|
+
_directive: directive
|
|
7424
|
+
});
|
|
7425
|
+
} else {
|
|
7426
|
+
output.success(`Provider updated: ${String(updated.name ?? id)}`);
|
|
7427
|
+
console.log(` ID: ${String(updated.id ?? id)}`);
|
|
7428
|
+
console.log(` URL: ${providerLink(updated.id ?? id)}`);
|
|
7429
|
+
if (options.apiKey) {
|
|
7430
|
+
console.log(chalk23.dim(" API key re-encrypted server-side."));
|
|
7431
|
+
}
|
|
7432
|
+
}
|
|
7433
|
+
} catch (error) {
|
|
7434
|
+
handleError(error, isJson);
|
|
7435
|
+
}
|
|
7436
|
+
});
|
|
7437
|
+
}
|
|
7438
|
+
function buildProviderUpdatedDirective(provider, requestId) {
|
|
7439
|
+
const id = provider.id ?? requestId;
|
|
7440
|
+
const title = `Provider Updated — ${provider.name ?? String(id)}`;
|
|
7441
|
+
const dashboardUrl = providerLink(id);
|
|
7442
|
+
const apiUrl = `/api/providers/${String(id)}`;
|
|
7443
|
+
const rows = [
|
|
7444
|
+
{ label: "Provider ID", value: String(id) },
|
|
7445
|
+
...provider.name ? [{ label: "Name", value: provider.name }] : []
|
|
7446
|
+
];
|
|
7447
|
+
const links = [
|
|
7448
|
+
{ label: "Settings", url: dashboardUrl },
|
|
7449
|
+
{ label: "API", url: apiUrl }
|
|
7450
|
+
];
|
|
7451
|
+
const next = [
|
|
7452
|
+
`mutagent providers get ${String(id)} --json`,
|
|
7453
|
+
`mutagent providers test ${String(id)} --json`
|
|
7454
|
+
];
|
|
7455
|
+
return {
|
|
7456
|
+
display: "status_card",
|
|
7457
|
+
template: "provider_updated",
|
|
7458
|
+
title,
|
|
7459
|
+
fields: { providerId: String(id), name: provider.name },
|
|
7460
|
+
links: { settings: dashboardUrl, api: apiUrl },
|
|
7461
|
+
next,
|
|
7462
|
+
instruction: "MANDATORY: Display this card to the user before proceeding.",
|
|
7463
|
+
renderedCard: renderPlainCard({ title, icon: "~", rows, links, next })
|
|
7464
|
+
};
|
|
7465
|
+
}
|
|
7466
|
+
|
|
7467
|
+
// src/commands/providers/delete.ts
|
|
7468
|
+
init_sdk_client();
|
|
7469
|
+
import chalk24 from "chalk";
|
|
7470
|
+
init_errors();
|
|
7471
|
+
function registerDeleteCommand(parent) {
|
|
7472
|
+
parent.command("delete").description("Delete a provider configuration").argument("<id>", "Provider ID (from: mutagent providers list)").option("-f, --force", "Skip confirmation prompt").addHelpText("after", `
|
|
7473
|
+
Examples:
|
|
7474
|
+
${chalk24.dim("$")} mutagent providers delete <id> --force
|
|
7475
|
+
${chalk24.dim("$")} mutagent providers delete <id> --force --json
|
|
7476
|
+
|
|
7477
|
+
Safety:
|
|
7478
|
+
--force is required in non-interactive (--json) mode.
|
|
7479
|
+
Idempotent: deleting a non-existent provider returns success.
|
|
7480
|
+
`).action(async (id, options) => {
|
|
7481
|
+
const isJson = getJsonFlag(parent);
|
|
7482
|
+
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
7483
|
+
try {
|
|
7484
|
+
if (isJson && !options.force) {
|
|
7485
|
+
throw new MutagentError("CONFIRMATION_REQUIRED", "Delete requires --force flag in non-interactive (--json) mode", "Add --force to confirm deletion: mutagent providers delete <id> --force --json");
|
|
7486
|
+
}
|
|
7487
|
+
if (!isJson && !options.force) {
|
|
7488
|
+
throw new MutagentError("CONFIRMATION_REQUIRED", `Deleting provider ${id} requires explicit confirmation`, `Add --force to confirm: mutagent providers delete ${id} --force`);
|
|
7489
|
+
}
|
|
7490
|
+
const client = getSDKClient();
|
|
7491
|
+
try {
|
|
7492
|
+
await client.deleteProvider(id);
|
|
7493
|
+
} catch (error) {
|
|
7494
|
+
if (error instanceof ApiError && error.statusCode === 404) {} else {
|
|
7495
|
+
throw error;
|
|
7496
|
+
}
|
|
7497
|
+
}
|
|
7498
|
+
if (isJson) {
|
|
7499
|
+
const directive = buildProviderDeletedDirective(id);
|
|
7500
|
+
echoDirectiveToStderr(directive);
|
|
7501
|
+
output.output({
|
|
7502
|
+
success: true,
|
|
7503
|
+
deletedId: id,
|
|
7504
|
+
_directive: directive
|
|
7505
|
+
});
|
|
7506
|
+
} else {
|
|
7507
|
+
output.success(`Provider deleted: ${id}`);
|
|
7508
|
+
console.log(` Settings: ${providerSettingsLink()}`);
|
|
7509
|
+
}
|
|
7510
|
+
} catch (error) {
|
|
7511
|
+
handleError(error, isJson);
|
|
7512
|
+
}
|
|
7513
|
+
});
|
|
7514
|
+
}
|
|
7515
|
+
function buildProviderDeletedDirective(id) {
|
|
7516
|
+
const title = `Provider Deleted — ${id}`;
|
|
7517
|
+
const settingsUrl = providerSettingsLink();
|
|
7518
|
+
const rows = [{ label: "Provider ID", value: id }];
|
|
7519
|
+
const links = [{ label: "Settings", url: settingsUrl }];
|
|
7520
|
+
const next = [`mutagent providers list --json`];
|
|
7521
|
+
return {
|
|
7522
|
+
display: "status_card",
|
|
7523
|
+
template: "provider_deleted",
|
|
7524
|
+
title,
|
|
7525
|
+
fields: { providerId: id },
|
|
7526
|
+
links: { settings: settingsUrl },
|
|
7527
|
+
next,
|
|
7528
|
+
instruction: "MANDATORY: Display this card to the user before proceeding.",
|
|
7529
|
+
renderedCard: renderPlainCard({ title, icon: "x", rows, links, next })
|
|
7530
|
+
};
|
|
7531
|
+
}
|
|
7532
|
+
|
|
7533
|
+
// src/commands/providers/index.ts
|
|
7216
7534
|
var VALID_PROVIDER_TYPES = [
|
|
7217
7535
|
"openai",
|
|
7218
7536
|
"anthropic",
|
|
@@ -7233,29 +7551,26 @@ function validateProviderType(type) {
|
|
|
7233
7551
|
return type;
|
|
7234
7552
|
}
|
|
7235
7553
|
function createProvidersCommand() {
|
|
7236
|
-
const providers = new Command13("providers").description("
|
|
7554
|
+
const providers = new Command13("providers").description("Manage LLM provider configurations (BYOK)").addHelpText("after", `
|
|
7237
7555
|
Examples:
|
|
7238
|
-
${
|
|
7239
|
-
${
|
|
7240
|
-
${
|
|
7556
|
+
${chalk25.dim("$")} mutagent providers list
|
|
7557
|
+
${chalk25.dim("$")} mutagent providers get <provider-id>
|
|
7558
|
+
${chalk25.dim("$")} mutagent providers add --provider openai --name "My OpenAI" --api-key $KEY
|
|
7559
|
+
${chalk25.dim("$")} mutagent providers update <id> --name "New Name"
|
|
7560
|
+
${chalk25.dim("$")} mutagent providers delete <id> --force
|
|
7561
|
+
${chalk25.dim("$")} mutagent providers test <provider-id>
|
|
7241
7562
|
|
|
7242
7563
|
Provider Types:
|
|
7243
7564
|
openai, anthropic, google, azure, bedrock, cohere, mistral, groq, together, replicate, custom
|
|
7244
7565
|
|
|
7245
7566
|
Subcommands:
|
|
7246
|
-
list, get, test
|
|
7247
|
-
|
|
7248
|
-
Note: Provider management (create, update, delete) is available in the Admin Panel only.
|
|
7249
|
-
|
|
7250
|
-
${chalk22.yellow("Note:")} The providers module is not yet active. This is a placeholder
|
|
7251
|
-
for future external provider configuration. The server currently uses
|
|
7252
|
-
built-in provider settings.
|
|
7567
|
+
list, get, add, update, delete, test
|
|
7253
7568
|
`);
|
|
7254
7569
|
providers.command("list").description("List all providers").option("-l, --limit <n>", "Limit results", "50").option("-o, --offset <n>", "Offset for pagination").option("-t, --type <type>", "Filter by provider type").addHelpText("after", `
|
|
7255
7570
|
Examples:
|
|
7256
|
-
${
|
|
7257
|
-
${
|
|
7258
|
-
${
|
|
7571
|
+
${chalk25.dim("$")} mutagent providers list
|
|
7572
|
+
${chalk25.dim("$")} mutagent providers list --type openai
|
|
7573
|
+
${chalk25.dim("$")} mutagent providers list --json
|
|
7259
7574
|
`).action(async (options) => {
|
|
7260
7575
|
const isJson = getJsonFlag(providers);
|
|
7261
7576
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7282,8 +7597,6 @@ Examples:
|
|
|
7282
7597
|
}));
|
|
7283
7598
|
output.output({ ...result, data: withLinks });
|
|
7284
7599
|
} else {
|
|
7285
|
-
console.log(chalk22.yellow("Note: The providers module is not yet active. This is a placeholder for future external provider configuration."));
|
|
7286
|
-
console.log("");
|
|
7287
7600
|
if (result.data.length === 0) {
|
|
7288
7601
|
output.info("No providers configured.");
|
|
7289
7602
|
output.info(`Configure at: ${providerSettingsLink()}`);
|
|
@@ -7306,8 +7619,8 @@ Examples:
|
|
|
7306
7619
|
});
|
|
7307
7620
|
providers.command("get").description("Get provider details").argument("<id>", "Provider ID (from: mutagent providers list)").addHelpText("after", `
|
|
7308
7621
|
Examples:
|
|
7309
|
-
${
|
|
7310
|
-
${
|
|
7622
|
+
${chalk25.dim("$")} mutagent providers get <provider-id>
|
|
7623
|
+
${chalk25.dim("$")} mutagent providers get <provider-id> --json
|
|
7311
7624
|
`).action(async (id) => {
|
|
7312
7625
|
const isJson = getJsonFlag(providers);
|
|
7313
7626
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7317,8 +7630,6 @@ Examples:
|
|
|
7317
7630
|
if (isJson) {
|
|
7318
7631
|
output.output({ ...provider, _links: providerLinks(provider.id) });
|
|
7319
7632
|
} else {
|
|
7320
|
-
console.log(chalk22.yellow("Note: The providers module is not yet active. This is a placeholder for future external provider configuration."));
|
|
7321
|
-
console.log("");
|
|
7322
7633
|
const formatted = {
|
|
7323
7634
|
id: provider.id,
|
|
7324
7635
|
name: provider.name,
|
|
@@ -7338,18 +7649,16 @@ Examples:
|
|
|
7338
7649
|
});
|
|
7339
7650
|
providers.command("test").description("Test provider connectivity").argument("<id>", "Provider ID (from: mutagent providers list)").addHelpText("after", `
|
|
7340
7651
|
Examples:
|
|
7341
|
-
${
|
|
7342
|
-
${
|
|
7652
|
+
${chalk25.dim("$")} mutagent providers test <provider-id>
|
|
7653
|
+
${chalk25.dim("$")} mutagent providers test <provider-id> --json
|
|
7343
7654
|
|
|
7344
|
-
${
|
|
7655
|
+
${chalk25.dim("Tests connectivity and lists available models for the provider.")}
|
|
7345
7656
|
`).action(async (id) => {
|
|
7346
7657
|
const isJson = getJsonFlag(providers);
|
|
7347
7658
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
7348
7659
|
try {
|
|
7349
7660
|
const client = getSDKClient();
|
|
7350
7661
|
if (!isJson) {
|
|
7351
|
-
console.log(chalk22.yellow("Note: The providers module is not yet active. This is a placeholder for future external provider configuration."));
|
|
7352
|
-
console.log("");
|
|
7353
7662
|
output.info(`Testing provider ${id}...`);
|
|
7354
7663
|
}
|
|
7355
7664
|
const result = await client.testProvider(id);
|
|
@@ -7358,9 +7667,9 @@ ${chalk22.dim("Tests connectivity and lists available models for the provider.")
|
|
|
7358
7667
|
} else {
|
|
7359
7668
|
if (result.success) {
|
|
7360
7669
|
output.success(`Provider test passed (${String(result.responseTimeMs)}ms)`);
|
|
7361
|
-
console.log(
|
|
7670
|
+
console.log(chalk25.green(`Message: ${result.message}`));
|
|
7362
7671
|
if (result.availableModels && result.availableModels.length > 0) {
|
|
7363
|
-
console.log(
|
|
7672
|
+
console.log(chalk25.bold(`
|
|
7364
7673
|
Available Models:`));
|
|
7365
7674
|
result.availableModels.forEach((model) => {
|
|
7366
7675
|
console.log(` - ${model}`);
|
|
@@ -7369,7 +7678,7 @@ Available Models:`));
|
|
|
7369
7678
|
} else {
|
|
7370
7679
|
output.error(`Provider test failed: ${result.message}`);
|
|
7371
7680
|
if (result.error) {
|
|
7372
|
-
console.log(
|
|
7681
|
+
console.log(chalk25.red(`Error: ${result.error}`));
|
|
7373
7682
|
}
|
|
7374
7683
|
}
|
|
7375
7684
|
}
|
|
@@ -7377,6 +7686,9 @@ Available Models:`));
|
|
|
7377
7686
|
handleError(error, isJson);
|
|
7378
7687
|
}
|
|
7379
7688
|
});
|
|
7689
|
+
registerAddCommand(providers);
|
|
7690
|
+
registerUpdateCommand(providers);
|
|
7691
|
+
registerDeleteCommand(providers);
|
|
7380
7692
|
return providers;
|
|
7381
7693
|
}
|
|
7382
7694
|
|
|
@@ -7384,7 +7696,7 @@ Available Models:`));
|
|
|
7384
7696
|
init_config();
|
|
7385
7697
|
import { Command as Command14 } from "commander";
|
|
7386
7698
|
import inquirer3 from "inquirer";
|
|
7387
|
-
import
|
|
7699
|
+
import chalk26 from "chalk";
|
|
7388
7700
|
import { existsSync as existsSync11, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
7389
7701
|
import { execSync as execSync3 } from "child_process";
|
|
7390
7702
|
import { join as join6 } from "path";
|
|
@@ -7507,13 +7819,13 @@ function writeRcConfig(config, cwd = process.cwd()) {
|
|
|
7507
7819
|
function createInitCommand() {
|
|
7508
7820
|
const init = new Command14("init").description("Initialize MutagenT in your project").option("--non-interactive", "Skip interactive prompts (defaults to CLI-only mode)").addHelpText("after", `
|
|
7509
7821
|
Examples:
|
|
7510
|
-
${
|
|
7511
|
-
${
|
|
7822
|
+
${chalk26.dim("$")} mutagent init # Interactive setup wizard
|
|
7823
|
+
${chalk26.dim("$")} mutagent init --non-interactive # CLI-only mode (no prompts)
|
|
7512
7824
|
|
|
7513
7825
|
Modes:
|
|
7514
|
-
${
|
|
7515
|
-
${
|
|
7516
|
-
${
|
|
7826
|
+
${chalk26.bold("Full scaffold")} Install SDK + integration package, create config, setup tracing
|
|
7827
|
+
${chalk26.bold("CLI-only")} Verify auth + create .mutagentrc.json with workspace/endpoint
|
|
7828
|
+
${chalk26.bold("Skip")} Exit without changes
|
|
7517
7829
|
`).action(async (options) => {
|
|
7518
7830
|
const isJson = getJsonFlag(init);
|
|
7519
7831
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7782,23 +8094,23 @@ Modes:
|
|
|
7782
8094
|
|
|
7783
8095
|
// src/commands/explore.ts
|
|
7784
8096
|
import { Command as Command15 } from "commander";
|
|
7785
|
-
import
|
|
8097
|
+
import chalk27 from "chalk";
|
|
7786
8098
|
import { resolve as resolve3 } from "path";
|
|
7787
8099
|
init_errors();
|
|
7788
8100
|
function createExploreCommand() {
|
|
7789
8101
|
const explore = new Command15("explore").description("Scan codebase for prompts, datasets, and MutagenT markers").option("-p, --path <dir>", "Directory to scan", ".").option("--depth <n>", "Max directory depth", "10").option("--include <glob>", "Include file pattern", "**/*.{ts,js,py,tsx,jsx}").option("--exclude <dirs>", "Comma-separated directories to exclude", "node_modules,dist,.git,build,.next,__pycache__,venv,.venv").option("--markers-only", "Only find existing MutagenT markers").addHelpText("after", `
|
|
7790
8102
|
Examples:
|
|
7791
|
-
${
|
|
7792
|
-
${
|
|
7793
|
-
${
|
|
7794
|
-
${
|
|
7795
|
-
${
|
|
8103
|
+
${chalk27.dim("$")} mutagent explore
|
|
8104
|
+
${chalk27.dim("$")} mutagent explore --path ./src
|
|
8105
|
+
${chalk27.dim("$")} mutagent explore --include "**/*.{ts,py}" --depth 5
|
|
8106
|
+
${chalk27.dim("$")} mutagent explore --markers-only
|
|
8107
|
+
${chalk27.dim("$")} mutagent explore --json
|
|
7796
8108
|
|
|
7797
8109
|
Detection modes:
|
|
7798
|
-
${
|
|
7799
|
-
${
|
|
8110
|
+
${chalk27.dim("Heuristic")} Template variables ({{var}}), prompt constants, schema definitions
|
|
8111
|
+
${chalk27.dim("Marker")} MutagenT:START/END comment markers from previous uploads
|
|
7800
8112
|
|
|
7801
|
-
${
|
|
8113
|
+
${chalk27.dim("Results are saved to .mutagent/mutation-context.md for use by other commands.")}
|
|
7802
8114
|
`).action((options) => {
|
|
7803
8115
|
const isJson = getJsonFlag(explore);
|
|
7804
8116
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7816,7 +8128,7 @@ ${chalk24.dim("Results are saved to .mutagent/mutation-context.md for use by oth
|
|
|
7816
8128
|
markersOnly
|
|
7817
8129
|
};
|
|
7818
8130
|
if (!isJson) {
|
|
7819
|
-
console.log(
|
|
8131
|
+
console.log(chalk27.cyan(`
|
|
7820
8132
|
Scanning ${scanPath}...
|
|
7821
8133
|
`));
|
|
7822
8134
|
}
|
|
@@ -7845,41 +8157,41 @@ Scanning ${scanPath}...
|
|
|
7845
8157
|
const totalFindings = result.prompts.length + result.datasets.length + result.markers.length;
|
|
7846
8158
|
if (totalFindings === 0) {
|
|
7847
8159
|
output.info("No prompts, datasets, or markers found.");
|
|
7848
|
-
console.log(
|
|
8160
|
+
console.log(chalk27.dim(`
|
|
7849
8161
|
Tip: Create a prompt with template variables like {{input}} to get started.`));
|
|
7850
8162
|
return;
|
|
7851
8163
|
}
|
|
7852
8164
|
if (result.prompts.length > 0) {
|
|
7853
|
-
console.log(
|
|
8165
|
+
console.log(chalk27.bold(` Prompts Found (${String(result.prompts.length)}):`));
|
|
7854
8166
|
console.log();
|
|
7855
8167
|
for (const p of result.prompts) {
|
|
7856
|
-
const confidenceTag = p.confidence === "high" ?
|
|
7857
|
-
const reasonTag =
|
|
7858
|
-
console.log(` ${confidenceTag} ${
|
|
7859
|
-
console.log(` ${
|
|
8168
|
+
const confidenceTag = p.confidence === "high" ? chalk27.green("[high]") : p.confidence === "medium" ? chalk27.yellow("[medium]") : chalk27.dim("[low]");
|
|
8169
|
+
const reasonTag = chalk27.dim(`[${p.reason}]`);
|
|
8170
|
+
console.log(` ${confidenceTag} ${chalk27.green(p.file)}:${chalk27.yellow(String(p.line))} ${reasonTag}`);
|
|
8171
|
+
console.log(` ${chalk27.dim(p.preview)}`);
|
|
7860
8172
|
}
|
|
7861
8173
|
console.log();
|
|
7862
8174
|
}
|
|
7863
8175
|
if (result.datasets.length > 0) {
|
|
7864
|
-
console.log(
|
|
8176
|
+
console.log(chalk27.bold(` Datasets Found (${String(result.datasets.length)}):`));
|
|
7865
8177
|
console.log();
|
|
7866
8178
|
for (const d of result.datasets) {
|
|
7867
|
-
console.log(` ${
|
|
8179
|
+
console.log(` ${chalk27.green(d.file)} ${chalk27.dim(`(${String(d.items)} items)`)}`);
|
|
7868
8180
|
}
|
|
7869
8181
|
console.log();
|
|
7870
8182
|
}
|
|
7871
8183
|
if (result.markers.length > 0) {
|
|
7872
|
-
console.log(
|
|
8184
|
+
console.log(chalk27.bold(` MutagenT Markers (${String(result.markers.length)}):`));
|
|
7873
8185
|
console.log();
|
|
7874
8186
|
for (const m of result.markers) {
|
|
7875
|
-
const idPart = m.platformId ?
|
|
7876
|
-
console.log(` ${
|
|
8187
|
+
const idPart = m.platformId ? chalk27.cyan(` id=${m.platformId}`) : "";
|
|
8188
|
+
console.log(` ${chalk27.green(m.file)}:${chalk27.yellow(String(m.line))} ${chalk27.magenta(m.type)}${idPart}`);
|
|
7877
8189
|
}
|
|
7878
8190
|
console.log();
|
|
7879
8191
|
}
|
|
7880
|
-
console.log(
|
|
7881
|
-
console.log(` ${
|
|
7882
|
-
console.log(
|
|
8192
|
+
console.log(chalk27.dim(" ─────────────────────────────────"));
|
|
8193
|
+
console.log(` ${chalk27.bold("Summary:")} ${String(result.prompts.length)} prompts, ${String(result.datasets.length)} datasets, ${String(result.markers.length)} markers`);
|
|
8194
|
+
console.log(chalk27.dim(` Saved to .mutagent/mutation-context.md`));
|
|
7883
8195
|
console.log();
|
|
7884
8196
|
}
|
|
7885
8197
|
} catch (error) {
|
|
@@ -7891,7 +8203,7 @@ Scanning ${scanPath}...
|
|
|
7891
8203
|
|
|
7892
8204
|
// src/commands/skills.ts
|
|
7893
8205
|
import { Command as Command16 } from "commander";
|
|
7894
|
-
import
|
|
8206
|
+
import chalk28 from "chalk";
|
|
7895
8207
|
import { existsSync as existsSync12, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
7896
8208
|
import { join as join7 } from "path";
|
|
7897
8209
|
import { execSync as execSync4 } from "child_process";
|
|
@@ -8015,7 +8327,7 @@ function createSkillsCommand() {
|
|
|
8015
8327
|
const skills = new Command16("skills").description("Manage MutagenT CLI skills for coding agents");
|
|
8016
8328
|
skills.command("install").description("Install MutagenT CLI skill for Claude Code").addHelpText("after", `
|
|
8017
8329
|
Examples:
|
|
8018
|
-
${
|
|
8330
|
+
${chalk28.dim("$")} mutagent skills install
|
|
8019
8331
|
|
|
8020
8332
|
This creates a Claude Code skill at .claude/skills/mutagent-cli/SKILL.md
|
|
8021
8333
|
that teaches coding agents how to use the MutagenT CLI effectively.
|
|
@@ -8042,10 +8354,10 @@ ${SKILL_BODY}
|
|
|
8042
8354
|
});
|
|
8043
8355
|
} else {
|
|
8044
8356
|
output.success(`Installed MutagenT CLI skill`);
|
|
8045
|
-
console.log(` ${
|
|
8357
|
+
console.log(` ${chalk28.dim("Path:")} ${skillPath}`);
|
|
8046
8358
|
console.log("");
|
|
8047
|
-
console.log(` ${
|
|
8048
|
-
console.log(` ${
|
|
8359
|
+
console.log(` ${chalk28.dim("This skill teaches coding agents how to use the MutagenT CLI.")}`);
|
|
8360
|
+
console.log(` ${chalk28.dim("It will be automatically loaded by Claude Code when relevant triggers match.")}`);
|
|
8049
8361
|
}
|
|
8050
8362
|
});
|
|
8051
8363
|
return skills;
|
|
@@ -8054,7 +8366,7 @@ ${SKILL_BODY}
|
|
|
8054
8366
|
// src/commands/usage.ts
|
|
8055
8367
|
init_config();
|
|
8056
8368
|
import { Command as Command17 } from "commander";
|
|
8057
|
-
import
|
|
8369
|
+
import chalk29 from "chalk";
|
|
8058
8370
|
init_errors();
|
|
8059
8371
|
init_sdk_client();
|
|
8060
8372
|
var TRIAL_OPTIMIZATION_LIMIT = 5;
|
|
@@ -8070,8 +8382,8 @@ function renderProgressBar(used, limit, width = 30) {
|
|
|
8070
8382
|
function createUsageCommand() {
|
|
8071
8383
|
const usage = new Command17("usage").description("Show resource counts and optimization run limits").addHelpText("after", `
|
|
8072
8384
|
Examples:
|
|
8073
|
-
${
|
|
8074
|
-
${
|
|
8385
|
+
${chalk29.dim("$")} mutagent usage
|
|
8386
|
+
${chalk29.dim("$")} mutagent usage --json
|
|
8075
8387
|
`);
|
|
8076
8388
|
usage.action(async () => {
|
|
8077
8389
|
const isJson = getJsonFlag(usage);
|
|
@@ -8126,21 +8438,21 @@ Examples:
|
|
|
8126
8438
|
});
|
|
8127
8439
|
} else {
|
|
8128
8440
|
console.log("");
|
|
8129
|
-
console.log(
|
|
8130
|
-
console.log(
|
|
8441
|
+
console.log(chalk29.bold("\uD83D\uDCCA MutagenT Usage"));
|
|
8442
|
+
console.log(chalk29.dim("─".repeat(45)));
|
|
8131
8443
|
console.log("");
|
|
8132
|
-
console.log(
|
|
8133
|
-
console.log(` Prompts: ${
|
|
8134
|
-
console.log(` Datasets: ${
|
|
8135
|
-
console.log(` Evaluations: ${
|
|
8444
|
+
console.log(chalk29.bold("Resources:"));
|
|
8445
|
+
console.log(` Prompts: ${chalk29.cyan(String(promptCount))}`);
|
|
8446
|
+
console.log(` Datasets: ${chalk29.cyan(String(datasetCount))}`);
|
|
8447
|
+
console.log(` Evaluations: ${chalk29.cyan(String(evaluationCount))}`);
|
|
8136
8448
|
console.log("");
|
|
8137
|
-
console.log(
|
|
8138
|
-
console.log(` Remaining: ${
|
|
8449
|
+
console.log(chalk29.bold(`Optimization Runs (${chalk29.yellow("trial")} plan):`));
|
|
8450
|
+
console.log(` Remaining: ${chalk29.cyan(String(optimizationRemaining))} / ${String(optimizationLimit)}`);
|
|
8139
8451
|
console.log(` ${renderProgressBar(optimizationUsed, optimizationLimit)}`);
|
|
8140
8452
|
console.log("");
|
|
8141
|
-
console.log(
|
|
8142
|
-
console.log(
|
|
8143
|
-
console.log(` Upgrade: ${
|
|
8453
|
+
console.log(chalk29.yellow(` ⚠ ${String(optimizationRemaining)} optimization runs remaining`));
|
|
8454
|
+
console.log(chalk29.dim(` ℹ Optimization run counts are approximate`));
|
|
8455
|
+
console.log(` Upgrade: ${chalk29.underline(BILLING_URL)}`);
|
|
8144
8456
|
console.log("");
|
|
8145
8457
|
}
|
|
8146
8458
|
} catch (error) {
|
|
@@ -8439,100 +8751,100 @@ program.name("mutagent").description(`MutagenT CLI - AI-native prompt optimizati
|
|
|
8439
8751
|
showGlobalOptions: true
|
|
8440
8752
|
});
|
|
8441
8753
|
program.addHelpText("after", `
|
|
8442
|
-
${
|
|
8443
|
-
export MUTAGENT_API_KEY=mt_... ${
|
|
8444
|
-
--json ${
|
|
8445
|
-
|
|
8446
|
-
${
|
|
8447
|
-
mutagent auth login --browser ${
|
|
8448
|
-
mutagent auth status ${
|
|
8449
|
-
mutagent init ${
|
|
8450
|
-
mutagent explore ${
|
|
8451
|
-
mutagent workspaces list --json ${
|
|
8452
|
-
mutagent config set workspace <id> ${
|
|
8453
|
-
mutagent usage --json ${
|
|
8454
|
-
|
|
8455
|
-
mutagent prompts create --help ${
|
|
8456
|
-
mutagent prompts list --json ${
|
|
8457
|
-
mutagent prompts get <id> --json ${
|
|
8458
|
-
|
|
8459
|
-
mutagent prompts dataset add --help ${
|
|
8460
|
-
mutagent prompts dataset list <id> ${
|
|
8461
|
-
|
|
8462
|
-
mutagent prompts evaluation create --help ${
|
|
8463
|
-
mutagent prompts evaluation create <id> --guided --json ${
|
|
8464
|
-
mutagent prompts evaluation list <id> --json ${
|
|
8465
|
-
|
|
8466
|
-
mutagent prompts optimize start --help ${
|
|
8467
|
-
mutagent prompts optimize status <job-id> ${
|
|
8468
|
-
mutagent prompts optimize results <job-id> ${
|
|
8469
|
-
|
|
8470
|
-
mutagent integrate <framework> ${
|
|
8471
|
-
mutagent hooks --help ${
|
|
8472
|
-
mutagent playground run <id> --input '{...}' ${
|
|
8473
|
-
|
|
8474
|
-
${
|
|
8475
|
-
1. mutagent explore ${
|
|
8476
|
-
2. mutagent integrate <framework> ${
|
|
8477
|
-
3. Apply tracing code to your codebase ${
|
|
8478
|
-
4. mutagent traces list --json ${
|
|
8479
|
-
|
|
8480
|
-
${
|
|
8481
|
-
1. mutagent prompts create --help ${
|
|
8482
|
-
2. mutagent prompts create ... --json ${
|
|
8483
|
-
3. mutagent prompts dataset add --help ${
|
|
8484
|
-
4. mutagent prompts dataset add <id> ... --json ${
|
|
8485
|
-
5. mutagent prompts evaluation create <id> --guided --json ${
|
|
8754
|
+
${chalk30.yellow("Non-Interactive Mode (CI/CD & Coding Agents):")}
|
|
8755
|
+
export MUTAGENT_API_KEY=mt_... ${chalk30.dim("or")} --api-key mt_...
|
|
8756
|
+
--json ${chalk30.dim("for structured output")} --non-interactive ${chalk30.dim("to disable prompts")}
|
|
8757
|
+
|
|
8758
|
+
${chalk30.yellow("Command Navigation:")}
|
|
8759
|
+
mutagent auth login --browser ${chalk30.dim("Authenticate (OAuth)")}
|
|
8760
|
+
mutagent auth status ${chalk30.dim("Check auth + workspace")}
|
|
8761
|
+
mutagent init ${chalk30.dim("Initialize project (.mutagentrc.json)")}
|
|
8762
|
+
mutagent explore ${chalk30.dim("Discover prompts in codebase")}
|
|
8763
|
+
mutagent workspaces list --json ${chalk30.dim("List workspaces (verify ID)")}
|
|
8764
|
+
mutagent config set workspace <id> ${chalk30.dim("Set active workspace")}
|
|
8765
|
+
mutagent usage --json ${chalk30.dim("Check plan limits")}
|
|
8766
|
+
|
|
8767
|
+
mutagent prompts create --help ${chalk30.dim("Upload prompt (read help first!)")}
|
|
8768
|
+
mutagent prompts list --json ${chalk30.dim("List prompts")}
|
|
8769
|
+
mutagent prompts get <id> --json ${chalk30.dim("Full prompt details + schemas")}
|
|
8770
|
+
|
|
8771
|
+
mutagent prompts dataset add --help ${chalk30.dim("Upload dataset (read help first!)")}
|
|
8772
|
+
mutagent prompts dataset list <id> ${chalk30.dim("List datasets")}
|
|
8773
|
+
|
|
8774
|
+
mutagent prompts evaluation create --help ${chalk30.dim("Create eval (read help first!)")}
|
|
8775
|
+
mutagent prompts evaluation create <id> --guided --json ${chalk30.dim("Guided eval workflow")}
|
|
8776
|
+
mutagent prompts evaluation list <id> --json ${chalk30.dim("List evaluations")}
|
|
8777
|
+
|
|
8778
|
+
mutagent prompts optimize start --help ${chalk30.dim("Run optimization (read help first!)")}
|
|
8779
|
+
mutagent prompts optimize status <job-id> ${chalk30.dim("Poll progress")}
|
|
8780
|
+
mutagent prompts optimize results <job-id> ${chalk30.dim("View scorecard")}
|
|
8781
|
+
|
|
8782
|
+
mutagent integrate <framework> ${chalk30.dim("Framework integration guide")}
|
|
8783
|
+
mutagent hooks --help ${chalk30.dim("Hook setup for Claude Code telemetry")}
|
|
8784
|
+
mutagent playground run <id> --input '{...}' ${chalk30.dim("Quick test")}
|
|
8785
|
+
|
|
8786
|
+
${chalk30.yellow("★ Workflow: Framework Integration (Tracing):")}
|
|
8787
|
+
1. mutagent explore ${chalk30.dim("← discover prompts/agents in codebase")}
|
|
8788
|
+
2. mutagent integrate <framework> ${chalk30.dim("← get integration instructions")}
|
|
8789
|
+
3. Apply tracing code to your codebase ${chalk30.dim("← follow the guide output")}
|
|
8790
|
+
4. mutagent traces list --json ${chalk30.dim("← verify traces are arriving")}
|
|
8791
|
+
|
|
8792
|
+
${chalk30.yellow("★ Workflow: Evaluate → Optimize:")}
|
|
8793
|
+
1. mutagent prompts create --help ${chalk30.dim("← read help")}
|
|
8794
|
+
2. mutagent prompts create ... --json ${chalk30.dim("← upload prompt with {variables} + inputSchema")}
|
|
8795
|
+
3. mutagent prompts dataset add --help ${chalk30.dim("← read help")}
|
|
8796
|
+
4. mutagent prompts dataset add <id> ... --json ${chalk30.dim("← upload dataset")}
|
|
8797
|
+
5. mutagent prompts evaluation create <id> --guided --json ${chalk30.dim("← guided eval")}
|
|
8486
8798
|
6. mutagent prompts optimize start <id> --dataset <d> --evaluation <e> --json
|
|
8487
8799
|
|
|
8488
|
-
${
|
|
8489
|
-
After ${
|
|
8490
|
-
${
|
|
8491
|
-
${
|
|
8492
|
-
${
|
|
8800
|
+
${chalk30.yellow("Post-Onboarding Decision Tree:")}
|
|
8801
|
+
After ${chalk30.bold("mutagent auth login")}, users land in one of 3 paths:
|
|
8802
|
+
${chalk30.bold("Path A")} (Tracing): explore → integrate <framework> → apply tracing → verify
|
|
8803
|
+
${chalk30.bold("Path B")} (Optimization): explore → prompts create → dataset add → eval create → optimize
|
|
8804
|
+
${chalk30.bold("Path C")} (Manual): Use CLI commands directly — run mutagent <command> --help
|
|
8493
8805
|
|
|
8494
|
-
${
|
|
8806
|
+
${chalk30.yellow("Directive System:")}
|
|
8495
8807
|
Every --json response may include:
|
|
8496
|
-
${
|
|
8497
|
-
${
|
|
8498
|
-
${
|
|
8499
|
-
${
|
|
8808
|
+
${chalk30.bold("_directive.renderedCard")} Pre-formatted card for the user ${chalk30.red("(MUST be shown in chat)")}
|
|
8809
|
+
${chalk30.bold("_directive.instruction")} Next step for the agent
|
|
8810
|
+
${chalk30.bold("_directive.next")} Array of suggested follow-up commands
|
|
8811
|
+
${chalk30.bold("_links")} Dashboard/API URLs (format as markdown links)
|
|
8500
8812
|
|
|
8501
|
-
${
|
|
8502
|
-
Each criterion MUST have: ${
|
|
8813
|
+
${chalk30.yellow("Evaluation Criteria Format:")}
|
|
8814
|
+
Each criterion MUST have: ${chalk30.bold("name")}, ${chalk30.bold("description")} (scoring rubric), ${chalk30.bold("evaluationParameter")}
|
|
8503
8815
|
evaluationParameter MUST match an inputSchema or outputSchema field name
|
|
8504
8816
|
No duplicate evaluationParameter values — each criterion targets a unique field
|
|
8505
8817
|
ALL schema fields must be covered (missing fields = error)
|
|
8506
|
-
Use ${
|
|
8818
|
+
Use ${chalk30.bold("--guided --json")} to generate criteria templates from prompt schemas
|
|
8507
8819
|
|
|
8508
|
-
${
|
|
8509
|
-
Default max-iterations is 1. ${
|
|
8820
|
+
${chalk30.yellow("Optimization Cost Control:")}
|
|
8821
|
+
Default max-iterations is 1. ${chalk30.red("NEVER increase without explicit user request.")}
|
|
8510
8822
|
Each iteration incurs LLM costs — confirm with user before starting >1.
|
|
8511
8823
|
|
|
8512
|
-
${
|
|
8513
|
-
After ${
|
|
8514
|
-
Then offer choices: ${
|
|
8824
|
+
${chalk30.yellow("Post-Optimization:")}
|
|
8825
|
+
After ${chalk30.bold("optimize results")}: ALWAYS show the before/after diff to the user first.
|
|
8826
|
+
Then offer choices: ${chalk30.bold("Apply")} / ${chalk30.bold("Reject")}.
|
|
8515
8827
|
|
|
8516
|
-
${
|
|
8828
|
+
${chalk30.yellow("State Tracking:")}
|
|
8517
8829
|
.mutagent/mutation-context.md — Codebase index of discovered/uploaded prompts
|
|
8518
8830
|
Update after explore, create, and dataset operations
|
|
8519
8831
|
mutagent auth status — Auth + workspace state
|
|
8520
8832
|
Comment markers (// MutagenT:START ... // MutagenT:END) in source files
|
|
8521
8833
|
|
|
8522
|
-
${
|
|
8834
|
+
${chalk30.yellow("AI Agent Rules (MANDATORY for coding agents):")}
|
|
8523
8835
|
1. EVERY command MUST include --json (no exceptions)
|
|
8524
8836
|
2. Run <command> --help BEFORE first use of any command
|
|
8525
8837
|
3. Use --guided --json for evaluation creation (NEVER --guided alone)
|
|
8526
8838
|
4. Parse _directive.renderedCard and copy it into your CHAT RESPONSE verbatim
|
|
8527
|
-
${
|
|
8839
|
+
${chalk30.red("HARD STOP")}: do NOT run further commands until the card is rendered in chat
|
|
8528
8840
|
5. After mutagent init, verify workspace: mutagent workspaces list --json
|
|
8529
8841
|
6. Use {single_braces} for template variables in prompts
|
|
8530
8842
|
7. Collect evaluation criteria from the user — NEVER auto-generate
|
|
8531
8843
|
8. ALL user interaction via AskUserQuestion — CLI is non-interactive
|
|
8532
8844
|
${!hasCredentials() ? `
|
|
8533
|
-
` +
|
|
8845
|
+
` + chalk30.yellow(" Warning: Not authenticated. Run: mutagent auth login --browser") + `
|
|
8534
8846
|
` : ""}${!hasRcConfig() ? `
|
|
8535
|
-
` +
|
|
8847
|
+
` + chalk30.green(" Get started: mutagent init") + `
|
|
8536
8848
|
` : ""}`);
|
|
8537
8849
|
program.hook("preAction", (thisCommand) => {
|
|
8538
8850
|
const globalOpts = thisCommand.optsWithGlobals();
|
|
@@ -8563,5 +8875,5 @@ program.addCommand(createUsageCommand());
|
|
|
8563
8875
|
program.addCommand(createHooksCommand());
|
|
8564
8876
|
program.parse();
|
|
8565
8877
|
|
|
8566
|
-
//# debugId=
|
|
8878
|
+
//# debugId=4C609807D0CBF5B664756E2164756E21
|
|
8567
8879
|
//# sourceMappingURL=cli.js.map
|