@mutagent/cli 0.1.113 → 0.1.114
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 +394 -345
- package/dist/bin/cli.js.map +9 -6
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -1182,7 +1182,7 @@ var init_sdk_client = __esm(() => {
|
|
|
1182
1182
|
|
|
1183
1183
|
// src/bin/cli.ts
|
|
1184
1184
|
import { Command as Command20 } from "commander";
|
|
1185
|
-
import
|
|
1185
|
+
import chalk35 from "chalk";
|
|
1186
1186
|
import { readFileSync as readFileSync12 } from "fs";
|
|
1187
1187
|
import { join as join10, dirname as dirname2 } from "path";
|
|
1188
1188
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -5900,30 +5900,140 @@ Subcommands:
|
|
|
5900
5900
|
return prompts;
|
|
5901
5901
|
}
|
|
5902
5902
|
|
|
5903
|
-
// src/commands/traces.ts
|
|
5903
|
+
// src/commands/traces/index.ts
|
|
5904
5904
|
init_sdk_client();
|
|
5905
5905
|
import { Command as Command7 } from "commander";
|
|
5906
|
+
import chalk19 from "chalk";
|
|
5907
|
+
init_errors();
|
|
5908
|
+
|
|
5909
|
+
// src/commands/traces/export.ts
|
|
5910
|
+
init_sdk_client();
|
|
5906
5911
|
import chalk16 from "chalk";
|
|
5907
5912
|
init_errors();
|
|
5908
|
-
function
|
|
5909
|
-
|
|
5913
|
+
function registerExportCommand(parent) {
|
|
5914
|
+
parent.command("export").description("Export traces").option("-p, --prompt <id>", "Filter by prompt ID").option("-f, --format <format>", "Export format (json, csv)", "json").option("-o, --output <path>", "Output file path").addHelpText("after", `
|
|
5910
5915
|
Examples:
|
|
5911
|
-
${chalk16.dim("$")} mutagent traces
|
|
5912
|
-
${chalk16.dim("$")} mutagent traces list --prompt <prompt-id>
|
|
5913
|
-
${chalk16.dim("$")} mutagent traces get <trace-id>
|
|
5914
|
-
${chalk16.dim("$")} mutagent traces analyze <prompt-id>
|
|
5916
|
+
${chalk16.dim("$")} mutagent traces export
|
|
5915
5917
|
${chalk16.dim("$")} mutagent traces export --format json --output traces.json
|
|
5918
|
+
${chalk16.dim("$")} mutagent traces export --format csv --output traces.csv
|
|
5919
|
+
${chalk16.dim("$")} mutagent traces export --prompt <prompt-id> --format json
|
|
5916
5920
|
|
|
5917
|
-
|
|
5921
|
+
${chalk16.dim("Exports to stdout by default. Use --output to save to a file.")}
|
|
5922
|
+
`).action(async (options) => {
|
|
5923
|
+
const isJson = getJsonFlag(parent);
|
|
5924
|
+
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
5925
|
+
try {
|
|
5926
|
+
const client = await getSDKClient();
|
|
5927
|
+
const tracesList = await client.listTraces({
|
|
5928
|
+
promptId: options.prompt
|
|
5929
|
+
});
|
|
5930
|
+
let content;
|
|
5931
|
+
if (options.format === "json") {
|
|
5932
|
+
content = JSON.stringify(tracesList, null, 2);
|
|
5933
|
+
} else if (options.format === "csv") {
|
|
5934
|
+
const headers = ["id", "promptId", "latency", "tokensInput", "tokensOutput", "timestamp"];
|
|
5935
|
+
const rows = tracesList.map((t) => [
|
|
5936
|
+
t.id,
|
|
5937
|
+
t.promptId,
|
|
5938
|
+
t.latency,
|
|
5939
|
+
t.tokens.input,
|
|
5940
|
+
t.tokens.output,
|
|
5941
|
+
t.timestamp
|
|
5942
|
+
]);
|
|
5943
|
+
content = [headers.join(","), ...rows.map((r) => r.join(","))].join(`
|
|
5944
|
+
`);
|
|
5945
|
+
} else {
|
|
5946
|
+
throw new Error(`Unsupported format: ${options.format}`);
|
|
5947
|
+
}
|
|
5948
|
+
if (options.output) {
|
|
5949
|
+
const { writeFileSync: writeFileSync3 } = await import("fs");
|
|
5950
|
+
writeFileSync3(options.output, content);
|
|
5951
|
+
output.success(`Exported ${String(tracesList.length)} traces to ${options.output}`);
|
|
5952
|
+
} else {
|
|
5953
|
+
process.stdout.write(content);
|
|
5954
|
+
}
|
|
5955
|
+
} catch (error) {
|
|
5956
|
+
handleError(error, isJson);
|
|
5957
|
+
}
|
|
5958
|
+
});
|
|
5959
|
+
}
|
|
5960
|
+
|
|
5961
|
+
// src/commands/traces/analyze.ts
|
|
5962
|
+
import chalk17 from "chalk";
|
|
5963
|
+
function registerAnalyzeCommand(parent) {
|
|
5964
|
+
parent.command("analyze").description("Analyze traces for a prompt (coming soon)").argument("<prompt-id>", "Prompt ID").addHelpText("after", `
|
|
5965
|
+
Examples:
|
|
5966
|
+
${chalk17.dim("$")} mutagent traces analyze <prompt-id>
|
|
5967
|
+
${chalk17.dim("$")} mutagent traces analyze <prompt-id> --json
|
|
5968
|
+
|
|
5969
|
+
${chalk17.dim("Aggregates trace data for a prompt: avg latency, token usage, error rates.")}
|
|
5970
|
+
${chalk17.yellow("NOTE: This command is not yet connected to the API.")}
|
|
5971
|
+
`).action((promptId) => {
|
|
5972
|
+
const isJson = getJsonFlag(parent);
|
|
5973
|
+
if (isJson) {
|
|
5974
|
+
console.log(JSON.stringify({
|
|
5975
|
+
status: "coming_soon",
|
|
5976
|
+
promptId,
|
|
5977
|
+
message: "Per-prompt trace analysis is not yet available. Use the dashboard at /observe/analytics for workspace-level metrics."
|
|
5978
|
+
}));
|
|
5979
|
+
} else {
|
|
5980
|
+
console.log(chalk17.yellow(`
|
|
5981
|
+
⚠ Per-prompt trace analysis for ${promptId} is not yet available — coming soon.
|
|
5982
|
+
`));
|
|
5983
|
+
console.log(chalk17.dim(" Workspace-level analytics are available on the dashboard:"));
|
|
5984
|
+
console.log(chalk17.dim(` ${getAppBaseUrl()}/observe/analytics
|
|
5985
|
+
`));
|
|
5986
|
+
}
|
|
5987
|
+
});
|
|
5988
|
+
}
|
|
5989
|
+
|
|
5990
|
+
// src/commands/traces/stream.ts
|
|
5991
|
+
import chalk18 from "chalk";
|
|
5992
|
+
function registerStreamCommand(parent) {
|
|
5993
|
+
parent.command("stream").description("Stream traces in real-time (coming soon)").addHelpText("after", `
|
|
5994
|
+
Examples:
|
|
5995
|
+
${chalk18.dim("$")} mutagent traces stream
|
|
5996
|
+
${chalk18.dim("$")} mutagent traces stream --json
|
|
5997
|
+
|
|
5998
|
+
${chalk18.dim("Real-time trace streaming via SSE.")}
|
|
5999
|
+
${chalk18.yellow("NOTE: This command is not yet connected to the API.")}
|
|
6000
|
+
`).action(() => {
|
|
6001
|
+
const isJson = getJsonFlag(parent);
|
|
6002
|
+
if (isJson) {
|
|
6003
|
+
console.log(JSON.stringify({
|
|
6004
|
+
status: "coming_soon",
|
|
6005
|
+
message: 'Real-time trace streaming is not yet available. Use "mutagent traces list" to poll, or view live traces on the dashboard.'
|
|
6006
|
+
}));
|
|
6007
|
+
} else {
|
|
6008
|
+
console.log(chalk18.yellow(`
|
|
6009
|
+
⚠ Real-time trace streaming is not yet available — coming soon.
|
|
6010
|
+
`));
|
|
6011
|
+
console.log(chalk18.dim(" In the meantime, use:"));
|
|
6012
|
+
console.log(chalk18.dim(" mutagent traces list --json (poll for new traces)"));
|
|
6013
|
+
console.log(chalk18.dim(` ${getAppBaseUrl()}/observe/traces (live dashboard)
|
|
6014
|
+
`));
|
|
6015
|
+
}
|
|
6016
|
+
});
|
|
6017
|
+
}
|
|
6018
|
+
|
|
6019
|
+
// src/commands/traces/index.ts
|
|
6020
|
+
function createTracesCommand() {
|
|
6021
|
+
const traces = new Command7("traces").description("View and analyze traces").addHelpText("after", `
|
|
6022
|
+
Examples:
|
|
6023
|
+
${chalk19.dim("$")} mutagent traces list
|
|
6024
|
+
${chalk19.dim("$")} mutagent traces list --prompt <prompt-id>
|
|
6025
|
+
${chalk19.dim("$")} mutagent traces get <trace-id>
|
|
6026
|
+
${chalk19.dim("$")} mutagent traces analyze <prompt-id>
|
|
6027
|
+
${chalk19.dim("$")} mutagent traces export --format json --output traces.json
|
|
5918
6028
|
`);
|
|
5919
6029
|
traces.command("list").description("List traces").option("-p, --prompt <id>", "Filter by prompt ID").option("-s, --source <source>", "Filter by trace source (e.g., claude-code, sdk, langchain)").option("-l, --limit <n>", "Limit results", "50").addHelpText("after", `
|
|
5920
6030
|
Examples:
|
|
5921
|
-
${
|
|
5922
|
-
${
|
|
5923
|
-
${
|
|
5924
|
-
${
|
|
6031
|
+
${chalk19.dim("$")} mutagent traces list
|
|
6032
|
+
${chalk19.dim("$")} mutagent traces list --prompt <prompt-id>
|
|
6033
|
+
${chalk19.dim("$")} mutagent traces list --source claude-code --json
|
|
6034
|
+
${chalk19.dim("$")} mutagent traces list --limit 10 --json
|
|
5925
6035
|
|
|
5926
|
-
${
|
|
6036
|
+
${chalk19.dim("Tip: Filter by prompt to see traces for a specific prompt version.")}
|
|
5927
6037
|
`).action(async (options) => {
|
|
5928
6038
|
const isJson = getJsonFlag(traces);
|
|
5929
6039
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5963,10 +6073,10 @@ ${chalk16.dim("Tip: Filter by prompt to see traces for a specific prompt version
|
|
|
5963
6073
|
});
|
|
5964
6074
|
traces.command("get").description("Get trace details").argument("<id>", "Trace ID").addHelpText("after", `
|
|
5965
6075
|
Examples:
|
|
5966
|
-
${
|
|
5967
|
-
${
|
|
6076
|
+
${chalk19.dim("$")} mutagent traces get <trace-id>
|
|
6077
|
+
${chalk19.dim("$")} mutagent traces get <trace-id> --json
|
|
5968
6078
|
|
|
5969
|
-
${
|
|
6079
|
+
${chalk19.dim("Returns full trace details including spans, tokens, and latency.")}
|
|
5970
6080
|
`).action(async (id) => {
|
|
5971
6081
|
const isJson = getJsonFlag(traces);
|
|
5972
6082
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5983,79 +6093,16 @@ ${chalk16.dim("Returns full trace details including spans, tokens, and latency."
|
|
|
5983
6093
|
handleError(error, isJson);
|
|
5984
6094
|
}
|
|
5985
6095
|
});
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
${chalk16.dim("$")} mutagent traces analyze <prompt-id> --json
|
|
5990
|
-
|
|
5991
|
-
${chalk16.dim("Aggregates trace data for a prompt: avg latency, token usage, error rates.")}
|
|
5992
|
-
`).action(async (promptId) => {
|
|
5993
|
-
const isJson = getJsonFlag(traces);
|
|
5994
|
-
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
5995
|
-
try {
|
|
5996
|
-
const client = await getSDKClient();
|
|
5997
|
-
const analysis = await client.analyzeTraces(promptId);
|
|
5998
|
-
if (isJson) {
|
|
5999
|
-
output.output({ ...analysis, _links: { traces: `${getAppBaseUrl()}/traces?promptId=${promptId}` } });
|
|
6000
|
-
} else {
|
|
6001
|
-
output.output(analysis);
|
|
6002
|
-
}
|
|
6003
|
-
} catch (error) {
|
|
6004
|
-
handleError(error, isJson);
|
|
6005
|
-
}
|
|
6006
|
-
});
|
|
6007
|
-
traces.command("export").description("Export traces").option("-p, --prompt <id>", "Filter by prompt ID").option("-f, --format <format>", "Export format (json, csv)", "json").option("-o, --output <path>", "Output file path").addHelpText("after", `
|
|
6008
|
-
Examples:
|
|
6009
|
-
${chalk16.dim("$")} mutagent traces export
|
|
6010
|
-
${chalk16.dim("$")} mutagent traces export --format json --output traces.json
|
|
6011
|
-
${chalk16.dim("$")} mutagent traces export --format csv --output traces.csv
|
|
6012
|
-
${chalk16.dim("$")} mutagent traces export --prompt <prompt-id> --format json
|
|
6013
|
-
|
|
6014
|
-
${chalk16.dim("Exports to stdout by default. Use --output to save to a file.")}
|
|
6015
|
-
`).action(async (options) => {
|
|
6016
|
-
const isJson = getJsonFlag(traces);
|
|
6017
|
-
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
6018
|
-
try {
|
|
6019
|
-
const client = await getSDKClient();
|
|
6020
|
-
const tracesList = await client.listTraces({
|
|
6021
|
-
promptId: options.prompt
|
|
6022
|
-
});
|
|
6023
|
-
let content;
|
|
6024
|
-
if (options.format === "json") {
|
|
6025
|
-
content = JSON.stringify(tracesList, null, 2);
|
|
6026
|
-
} else if (options.format === "csv") {
|
|
6027
|
-
const headers = ["id", "promptId", "latency", "tokensInput", "tokensOutput", "timestamp"];
|
|
6028
|
-
const rows = tracesList.map((t) => [
|
|
6029
|
-
t.id,
|
|
6030
|
-
t.promptId,
|
|
6031
|
-
t.latency,
|
|
6032
|
-
t.tokens.input,
|
|
6033
|
-
t.tokens.output,
|
|
6034
|
-
t.timestamp
|
|
6035
|
-
]);
|
|
6036
|
-
content = [headers.join(","), ...rows.map((r) => r.join(","))].join(`
|
|
6037
|
-
`);
|
|
6038
|
-
} else {
|
|
6039
|
-
throw new Error(`Unsupported format: ${options.format}`);
|
|
6040
|
-
}
|
|
6041
|
-
if (options.output) {
|
|
6042
|
-
const { writeFileSync: writeFileSync3 } = await import("fs");
|
|
6043
|
-
writeFileSync3(options.output, content);
|
|
6044
|
-
output.success(`Exported ${String(tracesList.length)} traces to ${options.output}`);
|
|
6045
|
-
} else {
|
|
6046
|
-
process.stdout.write(content);
|
|
6047
|
-
}
|
|
6048
|
-
} catch (error) {
|
|
6049
|
-
handleError(error, isJson);
|
|
6050
|
-
}
|
|
6051
|
-
});
|
|
6096
|
+
registerExportCommand(traces);
|
|
6097
|
+
registerAnalyzeCommand(traces);
|
|
6098
|
+
registerStreamCommand(traces);
|
|
6052
6099
|
return traces;
|
|
6053
6100
|
}
|
|
6054
6101
|
|
|
6055
6102
|
// src/commands/integrate.ts
|
|
6056
6103
|
init_config();
|
|
6057
6104
|
import { Command as Command8 } from "commander";
|
|
6058
|
-
import
|
|
6105
|
+
import chalk20 from "chalk";
|
|
6059
6106
|
import { writeFileSync as writeFileSync3, existsSync as existsSync9 } from "fs";
|
|
6060
6107
|
import { execSync } from "child_process";
|
|
6061
6108
|
init_errors();
|
|
@@ -6652,12 +6699,12 @@ AI AGENT: Please determine the framework by:
|
|
|
6652
6699
|
function createIntegrateCommand() {
|
|
6653
6700
|
const integrate = new Command8("integrate").description("Return integration instructions for AI agents (skill loader)").addHelpText("after", `
|
|
6654
6701
|
Examples:
|
|
6655
|
-
${
|
|
6656
|
-
${
|
|
6657
|
-
${
|
|
6658
|
-
${
|
|
6659
|
-
${
|
|
6660
|
-
${
|
|
6702
|
+
${chalk20.dim("$")} mutagent integrate # Return exploration instructions for AI agents
|
|
6703
|
+
${chalk20.dim("$")} mutagent integrate langchain # Return @mutagent/langchain integration steps
|
|
6704
|
+
${chalk20.dim("$")} mutagent integrate openai # Return @mutagent/openai integration steps
|
|
6705
|
+
${chalk20.dim("$")} mutagent integrate vercel-ai --verify # Verify integration
|
|
6706
|
+
${chalk20.dim("$")} mutagent integrate langchain --output ./INTEGRATION.md
|
|
6707
|
+
${chalk20.dim("$")} mutagent integrate --list # List available frameworks
|
|
6661
6708
|
|
|
6662
6709
|
Frameworks: langchain, langgraph, vercel-ai, openai
|
|
6663
6710
|
|
|
@@ -6773,18 +6820,18 @@ AI AGENT: Execute these steps using Bash for install, Write/Edit for code change
|
|
|
6773
6820
|
|
|
6774
6821
|
// src/commands/agents/index.ts
|
|
6775
6822
|
import { Command as Command9 } from "commander";
|
|
6776
|
-
import
|
|
6823
|
+
import chalk22 from "chalk";
|
|
6777
6824
|
|
|
6778
6825
|
// src/commands/agents/agents-crud.ts
|
|
6779
6826
|
init_sdk_client();
|
|
6780
|
-
import
|
|
6827
|
+
import chalk21 from "chalk";
|
|
6781
6828
|
init_errors();
|
|
6782
6829
|
function registerAgentsCrud(agents) {
|
|
6783
6830
|
agents.command("list").description("List all agents").option("-l, --limit <n>", "Limit results", "50").option("-o, --offset <n>", "Offset for pagination").option("-n, --name <name>", "Filter by name").option("-s, --status <status>", "Filter by status (active, paused, archived)").addHelpText("after", `
|
|
6784
6831
|
Examples:
|
|
6785
|
-
${
|
|
6786
|
-
${
|
|
6787
|
-
${
|
|
6832
|
+
${chalk21.dim("$")} mutagent agents list
|
|
6833
|
+
${chalk21.dim("$")} mutagent agents list --status active
|
|
6834
|
+
${chalk21.dim("$")} mutagent agents list --name "reviewer" --json
|
|
6788
6835
|
`).action(async (options) => {
|
|
6789
6836
|
const isJson = getJsonFlag(agents);
|
|
6790
6837
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6834,8 +6881,8 @@ Examples:
|
|
|
6834
6881
|
});
|
|
6835
6882
|
agents.command("get").description("Get agent details").argument("<id>", "Agent ID").addHelpText("after", `
|
|
6836
6883
|
Examples:
|
|
6837
|
-
${
|
|
6838
|
-
${
|
|
6884
|
+
${chalk21.dim("$")} mutagent agents get <agent-id>
|
|
6885
|
+
${chalk21.dim("$")} mutagent agents get <agent-id> --json
|
|
6839
6886
|
`).action(async (id) => {
|
|
6840
6887
|
const isJson = getJsonFlag(agents);
|
|
6841
6888
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6865,11 +6912,11 @@ Examples:
|
|
|
6865
6912
|
};
|
|
6866
6913
|
output.output(formatted);
|
|
6867
6914
|
if (agent.systemPrompt) {
|
|
6868
|
-
console.log(
|
|
6915
|
+
console.log(chalk21.bold(`
|
|
6869
6916
|
System Prompt:`));
|
|
6870
|
-
console.log(
|
|
6917
|
+
console.log(chalk21.gray("─".repeat(60)));
|
|
6871
6918
|
console.log(agent.systemPrompt);
|
|
6872
|
-
console.log(
|
|
6919
|
+
console.log(chalk21.gray("─".repeat(60)));
|
|
6873
6920
|
}
|
|
6874
6921
|
}
|
|
6875
6922
|
} catch (error) {
|
|
@@ -6878,17 +6925,17 @@ System Prompt:`));
|
|
|
6878
6925
|
});
|
|
6879
6926
|
agents.command("create").description("Create a new agent").option("-d, --data <json>", "Agent as JSON string (recommended for CI/scripts/agents)").option("-n, --name <name>", "Agent name").option("-s, --slug <slug>", "Agent slug (URL-friendly identifier)").option("-p, --system-prompt <prompt>", "System prompt").option("-m, --model <model>", "Model (claude-sonnet-4-5, claude-opus-4-5, claude-haiku-4-5)").option("--description <desc>", "Agent description").addHelpText("after", `
|
|
6880
6927
|
Examples:
|
|
6881
|
-
${
|
|
6882
|
-
${
|
|
6928
|
+
${chalk21.dim("$")} mutagent agents create --name "Code Reviewer" --slug code-reviewer --system-prompt "You are a code reviewer..."
|
|
6929
|
+
${chalk21.dim("$")} mutagent agents create -d '{"name":"Code Reviewer","slug":"code-reviewer","systemPrompt":"You are a code reviewer..."}'
|
|
6883
6930
|
|
|
6884
6931
|
Expected JSON (--data):
|
|
6885
|
-
${
|
|
6932
|
+
${chalk21.dim('{"name":"<name>","slug":"<slug>","systemPrompt":"<system prompt>","model":"<model-id>","description":"<description>"}')}
|
|
6886
6933
|
|
|
6887
6934
|
Input Methods (pick one, priority order):
|
|
6888
|
-
--name/--slug/... Individual flags ${
|
|
6935
|
+
--name/--slug/... Individual flags ${chalk21.green("(recommended)")}
|
|
6889
6936
|
-d, --data Inline JSON object (CI/scripts/agents)
|
|
6890
6937
|
|
|
6891
|
-
${
|
|
6938
|
+
${chalk21.red("Required: name, slug, systemPrompt.")} ${chalk21.dim("CLI flags override --data fields.")}
|
|
6892
6939
|
`).action(async (options) => {
|
|
6893
6940
|
const isJson = getJsonFlag(agents);
|
|
6894
6941
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6925,7 +6972,8 @@ ${chalk18.red("Required: name, slug, systemPrompt.")} ${chalk18.dim("CLI flags o
|
|
|
6925
6972
|
}
|
|
6926
6973
|
const client = await getSDKClient();
|
|
6927
6974
|
const agent = await client.createAgent(data);
|
|
6928
|
-
|
|
6975
|
+
if (!isJson)
|
|
6976
|
+
output.success(`Created agent: ${agent.name} (${agent.slug})`);
|
|
6929
6977
|
output.output(agent);
|
|
6930
6978
|
} catch (error) {
|
|
6931
6979
|
handleError(error, isJson);
|
|
@@ -6933,15 +6981,15 @@ ${chalk18.red("Required: name, slug, systemPrompt.")} ${chalk18.dim("CLI flags o
|
|
|
6933
6981
|
});
|
|
6934
6982
|
agents.command("update").description("Update an agent").argument("<id>", "Agent ID").option("-d, --data <json>", "Agent updates as JSON string (CI/scripts/agents)").option("-n, --name <name>", "New name").option("-p, --system-prompt <prompt>", "New system prompt").option("-m, --model <model>", "New model").option("--description <desc>", "New description").option("-s, --status <status>", "New status (active, paused, archived)").addHelpText("after", `
|
|
6935
6983
|
Examples:
|
|
6936
|
-
${
|
|
6937
|
-
${
|
|
6938
|
-
${
|
|
6984
|
+
${chalk21.dim("$")} mutagent agents update <id> --name "New Name"
|
|
6985
|
+
${chalk21.dim("$")} mutagent agents update <id> --system-prompt "Updated prompt" --status active
|
|
6986
|
+
${chalk21.dim("$")} mutagent agents update <id> -d '{"name":"New Name","systemPrompt":"Updated prompt"}'
|
|
6939
6987
|
|
|
6940
6988
|
Input Methods (pick one, priority order):
|
|
6941
|
-
--name/--system-prompt/... Individual flags ${
|
|
6989
|
+
--name/--system-prompt/... Individual flags ${chalk21.green("(recommended)")}
|
|
6942
6990
|
-d, --data Inline JSON object (CI/scripts/agents)
|
|
6943
6991
|
|
|
6944
|
-
${
|
|
6992
|
+
${chalk21.dim("CLI flags override --data fields.")}
|
|
6945
6993
|
`).action(async (id, options) => {
|
|
6946
6994
|
const isJson = getJsonFlag(agents);
|
|
6947
6995
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6980,7 +7028,8 @@ ${chalk18.dim("CLI flags override --data fields.")}
|
|
|
6980
7028
|
}
|
|
6981
7029
|
const client = await getSDKClient();
|
|
6982
7030
|
const agent = await client.updateAgent(id, data);
|
|
6983
|
-
|
|
7031
|
+
if (!isJson)
|
|
7032
|
+
output.success(`Updated agent: ${agent.name}`);
|
|
6984
7033
|
output.output(agent);
|
|
6985
7034
|
} catch (error) {
|
|
6986
7035
|
handleError(error, isJson);
|
|
@@ -6988,11 +7037,11 @@ ${chalk18.dim("CLI flags override --data fields.")}
|
|
|
6988
7037
|
});
|
|
6989
7038
|
agents.command("delete").description("Delete an agent").argument("<id>", "Agent ID").option("--force", "Skip confirmation").addHelpText("after", `
|
|
6990
7039
|
Examples:
|
|
6991
|
-
${
|
|
6992
|
-
${
|
|
6993
|
-
${
|
|
7040
|
+
${chalk21.dim("$")} mutagent agents delete <id>
|
|
7041
|
+
${chalk21.dim("$")} mutagent agents delete <id> --force
|
|
7042
|
+
${chalk21.dim("$")} mutagent agents delete <id> --force --json
|
|
6994
7043
|
|
|
6995
|
-
${
|
|
7044
|
+
${chalk21.dim("Tip: Use --force to skip confirmation (required for non-interactive/CI usage).")}
|
|
6996
7045
|
`).action(async (id, options) => {
|
|
6997
7046
|
const isJson = getJsonFlag(agents);
|
|
6998
7047
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7023,12 +7072,12 @@ ${chalk18.dim("Tip: Use --force to skip confirmation (required for non-interacti
|
|
|
7023
7072
|
function createAgentsCommand() {
|
|
7024
7073
|
const agents = new Command9("agents").description("Manage AI agents").addHelpText("after", `
|
|
7025
7074
|
Examples:
|
|
7026
|
-
${
|
|
7027
|
-
${
|
|
7028
|
-
${
|
|
7029
|
-
${
|
|
7030
|
-
${
|
|
7031
|
-
${
|
|
7075
|
+
${chalk22.dim("$")} mutagent agents list
|
|
7076
|
+
${chalk22.dim("$")} mutagent agents get <agent-id>
|
|
7077
|
+
${chalk22.dim("$")} mutagent agents create --name "Code Reviewer" --slug code-reviewer --system-prompt "You are a code reviewer..."
|
|
7078
|
+
${chalk22.dim("$")} mutagent agents create -d '{"name":"Code Reviewer","slug":"code-reviewer","systemPrompt":"You are..."}'
|
|
7079
|
+
${chalk22.dim("$")} mutagent agents update <agent-id> --name "Updated Name"
|
|
7080
|
+
${chalk22.dim("$")} mutagent agents delete <agent-id> --force
|
|
7032
7081
|
|
|
7033
7082
|
Subcommands:
|
|
7034
7083
|
list, get, create, update, delete
|
|
@@ -7040,22 +7089,22 @@ Subcommands:
|
|
|
7040
7089
|
// src/commands/config.ts
|
|
7041
7090
|
init_config();
|
|
7042
7091
|
import { Command as Command10 } from "commander";
|
|
7043
|
-
import
|
|
7092
|
+
import chalk23 from "chalk";
|
|
7044
7093
|
init_errors();
|
|
7045
7094
|
init_sdk_client();
|
|
7046
7095
|
var VALID_CONFIG_KEYS = ["apiKey", "endpoint", "format", "timeout", "defaultWorkspace", "defaultOrganization"];
|
|
7047
7096
|
function createConfigCommand() {
|
|
7048
7097
|
const config = new Command10("config").description("Manage CLI configuration").addHelpText("after", `
|
|
7049
7098
|
Examples:
|
|
7050
|
-
${
|
|
7051
|
-
${
|
|
7052
|
-
${
|
|
7053
|
-
${
|
|
7099
|
+
${chalk23.dim("$")} mutagent config list
|
|
7100
|
+
${chalk23.dim("$")} mutagent config get endpoint
|
|
7101
|
+
${chalk23.dim("$")} mutagent config set workspace <workspace-id>
|
|
7102
|
+
${chalk23.dim("$")} mutagent config set org <org-id>
|
|
7054
7103
|
`);
|
|
7055
7104
|
config.command("list").description("List all configuration").addHelpText("after", `
|
|
7056
7105
|
Examples:
|
|
7057
|
-
${
|
|
7058
|
-
${
|
|
7106
|
+
${chalk23.dim("$")} mutagent config list
|
|
7107
|
+
${chalk23.dim("$")} mutagent config list --json
|
|
7059
7108
|
`).action(() => {
|
|
7060
7109
|
const isJson = getJsonFlag(config);
|
|
7061
7110
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7068,11 +7117,11 @@ Examples:
|
|
|
7068
7117
|
});
|
|
7069
7118
|
config.command("get").description("Get configuration value").argument("<key>", "Configuration key (apiKey, endpoint, format, timeout, defaultWorkspace, defaultOrganization)").addHelpText("after", `
|
|
7070
7119
|
Examples:
|
|
7071
|
-
${
|
|
7072
|
-
${
|
|
7073
|
-
${
|
|
7120
|
+
${chalk23.dim("$")} mutagent config get endpoint
|
|
7121
|
+
${chalk23.dim("$")} mutagent config get defaultWorkspace
|
|
7122
|
+
${chalk23.dim("$")} mutagent config get apiKey --json
|
|
7074
7123
|
|
|
7075
|
-
${
|
|
7124
|
+
${chalk23.dim("Keys: apiKey, endpoint, format, timeout, defaultWorkspace, defaultOrganization")}
|
|
7076
7125
|
`).action((key) => {
|
|
7077
7126
|
const isJson = getJsonFlag(config);
|
|
7078
7127
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7099,9 +7148,9 @@ ${chalk20.dim("Keys: apiKey, endpoint, format, timeout, defaultWorkspace, defaul
|
|
|
7099
7148
|
});
|
|
7100
7149
|
set.command("workspace").description("Set default workspace ID").argument("<id>", "Workspace ID to set as default").addHelpText("after", `
|
|
7101
7150
|
Examples:
|
|
7102
|
-
${
|
|
7151
|
+
${chalk23.dim("$")} mutagent config set workspace <workspace-id>
|
|
7103
7152
|
|
|
7104
|
-
${
|
|
7153
|
+
${chalk23.dim("Persists workspace ID so you don't need to pass headers on every request.")}
|
|
7105
7154
|
`).action((id) => {
|
|
7106
7155
|
const isJson = getJsonFlag(config);
|
|
7107
7156
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7115,9 +7164,9 @@ ${chalk20.dim("Persists workspace ID so you don't need to pass headers on every
|
|
|
7115
7164
|
});
|
|
7116
7165
|
set.command("org").description("Set default organization ID").argument("<id>", "Organization ID to set as default").addHelpText("after", `
|
|
7117
7166
|
Examples:
|
|
7118
|
-
${
|
|
7167
|
+
${chalk23.dim("$")} mutagent config set org <org-id>
|
|
7119
7168
|
|
|
7120
|
-
${
|
|
7169
|
+
${chalk23.dim("Persists organization ID for org-scoped API keys.")}
|
|
7121
7170
|
`).action((id) => {
|
|
7122
7171
|
const isJson = getJsonFlag(config);
|
|
7123
7172
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7136,7 +7185,7 @@ ${chalk20.dim("Persists organization ID for org-scoped API keys.")}
|
|
|
7136
7185
|
// src/commands/playground.ts
|
|
7137
7186
|
init_sdk_client();
|
|
7138
7187
|
import { Command as Command11 } from "commander";
|
|
7139
|
-
import
|
|
7188
|
+
import chalk24 from "chalk";
|
|
7140
7189
|
init_errors();
|
|
7141
7190
|
function parseSSELine(line3) {
|
|
7142
7191
|
if (!line3 || line3.startsWith(":")) {
|
|
@@ -7163,11 +7212,11 @@ function parsePromptStreamEvent(data) {
|
|
|
7163
7212
|
function createPlaygroundCommand() {
|
|
7164
7213
|
const playground = new Command11("playground").description("Execute and test prompts interactively").addHelpText("after", `
|
|
7165
7214
|
Examples:
|
|
7166
|
-
${
|
|
7167
|
-
${
|
|
7168
|
-
${
|
|
7169
|
-
${
|
|
7170
|
-
${
|
|
7215
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --input '{"name": "John"}'
|
|
7216
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --input '{}' --stream
|
|
7217
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> -i '{}' --model gpt-4-turbo
|
|
7218
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --system "You are helpful" --human "Hello"
|
|
7219
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --messages '[{"role":"user","content":"Hi"}]'
|
|
7171
7220
|
|
|
7172
7221
|
Input Format:
|
|
7173
7222
|
The input must be a valid JSON object matching the prompt's input schema.
|
|
@@ -7183,16 +7232,16 @@ Streaming:
|
|
|
7183
7232
|
`);
|
|
7184
7233
|
playground.command("run").description("Execute a prompt with input variables").argument("<prompt-id>", "Prompt ID to execute (from: mutagent prompts list)").option("-i, --input <json>", "Input variables as JSON").option("-s, --stream", "Stream the response").option("-m, --model <model>", "Override model").option("--system <text>", "Set system prompt text").option("--human <text>", "Set human/user message text").option("--messages <json>", "Pass full messages array as JSON string").addHelpText("after", `
|
|
7185
7234
|
Examples:
|
|
7186
|
-
${
|
|
7187
|
-
${
|
|
7188
|
-
${
|
|
7189
|
-
${
|
|
7235
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --input '{"name": "John"}'
|
|
7236
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --input '{}' --stream
|
|
7237
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --system "You are helpful" --human "Hello"
|
|
7238
|
+
${chalk24.dim("$")} mutagent playground run <prompt-id> --input '{}' --model gpt-4-turbo --json
|
|
7190
7239
|
|
|
7191
7240
|
Input Methods (pick one, priority order):
|
|
7192
|
-
--system/--human Quick system + user message ${
|
|
7241
|
+
--system/--human Quick system + user message ${chalk24.green("(recommended)")}
|
|
7193
7242
|
--input '{"key":"value"}' Inline JSON variables
|
|
7194
7243
|
--messages '[...]' Full messages array
|
|
7195
|
-
${
|
|
7244
|
+
${chalk24.dim(`Hint: Test before evaluating: mutagent playground run <id> --input '{"key":"value"}'`)}
|
|
7196
7245
|
`).action(async (promptId, options) => {
|
|
7197
7246
|
const isJson = getJsonFlag(playground);
|
|
7198
7247
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7214,21 +7263,21 @@ ${chalk21.dim(`Hint: Test before evaluating: mutagent playground run <id> --inpu
|
|
|
7214
7263
|
}
|
|
7215
7264
|
});
|
|
7216
7265
|
} else {
|
|
7217
|
-
console.log(
|
|
7266
|
+
console.log(chalk24.bold(`
|
|
7218
7267
|
Execution Result:`));
|
|
7219
|
-
console.log(
|
|
7220
|
-
console.log(
|
|
7268
|
+
console.log(chalk24.gray("─".repeat(50)));
|
|
7269
|
+
console.log(chalk24.cyan("Output:"));
|
|
7221
7270
|
console.log(result.output);
|
|
7222
|
-
console.log(
|
|
7223
|
-
console.log(
|
|
7224
|
-
console.log(
|
|
7271
|
+
console.log(chalk24.gray("─".repeat(50)));
|
|
7272
|
+
console.log(chalk24.dim(`Model: ${result.model}`));
|
|
7273
|
+
console.log(chalk24.dim(`Execution Time: ${String(result.executionTimeMs)}ms`));
|
|
7225
7274
|
if (result.tokens) {
|
|
7226
|
-
console.log(
|
|
7275
|
+
console.log(chalk24.dim(`Tokens: ${String(result.tokens.prompt)} prompt + ${String(result.tokens.completion)} completion = ${String(result.tokens.total)} total`));
|
|
7227
7276
|
}
|
|
7228
7277
|
if (result.cost !== undefined) {
|
|
7229
|
-
console.log(
|
|
7278
|
+
console.log(chalk24.dim(`Cost: $${result.cost.toFixed(6)}`));
|
|
7230
7279
|
}
|
|
7231
|
-
console.log(
|
|
7280
|
+
console.log(chalk24.dim(`Playground: ${playgroundLink(promptId)}`));
|
|
7232
7281
|
console.log();
|
|
7233
7282
|
}
|
|
7234
7283
|
}
|
|
@@ -7317,9 +7366,9 @@ async function executeStreaming(client, promptId, input, model, isJson, output)
|
|
|
7317
7366
|
const decoder = new TextDecoder;
|
|
7318
7367
|
let buffer = "";
|
|
7319
7368
|
if (!isJson) {
|
|
7320
|
-
console.log(
|
|
7369
|
+
console.log(chalk24.bold(`
|
|
7321
7370
|
Streaming Output:`));
|
|
7322
|
-
console.log(
|
|
7371
|
+
console.log(chalk24.gray("─".repeat(50)));
|
|
7323
7372
|
}
|
|
7324
7373
|
try {
|
|
7325
7374
|
for (;; ) {
|
|
@@ -7358,15 +7407,15 @@ Streaming Output:`));
|
|
|
7358
7407
|
console.log(JSON.stringify({ type: "complete", result: event.result }));
|
|
7359
7408
|
} else {
|
|
7360
7409
|
console.log();
|
|
7361
|
-
console.log(
|
|
7410
|
+
console.log(chalk24.gray("─".repeat(50)));
|
|
7362
7411
|
if (event.result) {
|
|
7363
|
-
console.log(
|
|
7364
|
-
console.log(
|
|
7412
|
+
console.log(chalk24.dim(`Model: ${event.result.model}`));
|
|
7413
|
+
console.log(chalk24.dim(`Execution Time: ${String(event.result.executionTimeMs)}ms`));
|
|
7365
7414
|
if (event.result.tokens) {
|
|
7366
|
-
console.log(
|
|
7415
|
+
console.log(chalk24.dim(`Tokens: ${String(event.result.tokens.prompt)} prompt + ${String(event.result.tokens.completion)} completion = ${String(event.result.tokens.total)} total`));
|
|
7367
7416
|
}
|
|
7368
7417
|
if (event.result.cost !== undefined) {
|
|
7369
|
-
console.log(
|
|
7418
|
+
console.log(chalk24.dim(`Cost: $${event.result.cost.toFixed(6)}`));
|
|
7370
7419
|
}
|
|
7371
7420
|
}
|
|
7372
7421
|
console.log();
|
|
@@ -7391,13 +7440,13 @@ Streaming Output:`));
|
|
|
7391
7440
|
// src/commands/workspaces.ts
|
|
7392
7441
|
init_sdk_client();
|
|
7393
7442
|
import { Command as Command12 } from "commander";
|
|
7394
|
-
import
|
|
7443
|
+
import chalk25 from "chalk";
|
|
7395
7444
|
init_errors();
|
|
7396
7445
|
function createWorkspacesCommand() {
|
|
7397
7446
|
const workspaces = new Command12("workspaces").description("View workspaces (read-only)").addHelpText("after", `
|
|
7398
7447
|
Examples:
|
|
7399
|
-
${
|
|
7400
|
-
${
|
|
7448
|
+
${chalk25.dim("$")} mutagent workspaces list
|
|
7449
|
+
${chalk25.dim("$")} mutagent workspaces get <workspace-id>
|
|
7401
7450
|
|
|
7402
7451
|
Subcommands:
|
|
7403
7452
|
list, get
|
|
@@ -7406,8 +7455,8 @@ Note: Workspace management (create, update, delete) is available in the Admin Pa
|
|
|
7406
7455
|
`);
|
|
7407
7456
|
workspaces.command("list").description("List all workspaces").option("-l, --limit <n>", "Limit results", "50").option("-o, --offset <n>", "Offset for pagination").addHelpText("after", `
|
|
7408
7457
|
Examples:
|
|
7409
|
-
${
|
|
7410
|
-
${
|
|
7458
|
+
${chalk25.dim("$")} mutagent workspaces list
|
|
7459
|
+
${chalk25.dim("$")} mutagent workspaces list --limit 10 --json
|
|
7411
7460
|
`).action(async (options) => {
|
|
7412
7461
|
const isJson = getJsonFlag(workspaces);
|
|
7413
7462
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7447,8 +7496,8 @@ Examples:
|
|
|
7447
7496
|
});
|
|
7448
7497
|
workspaces.command("get").description("Get workspace details").argument("<id>", "Workspace ID").addHelpText("after", `
|
|
7449
7498
|
Examples:
|
|
7450
|
-
${
|
|
7451
|
-
${
|
|
7499
|
+
${chalk25.dim("$")} mutagent workspaces get <workspace-id>
|
|
7500
|
+
${chalk25.dim("$")} mutagent workspaces get <workspace-id> --json
|
|
7452
7501
|
`).action(async (id) => {
|
|
7453
7502
|
const isJson = getJsonFlag(workspaces);
|
|
7454
7503
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7481,12 +7530,12 @@ Examples:
|
|
|
7481
7530
|
// src/commands/providers/index.ts
|
|
7482
7531
|
init_sdk_client();
|
|
7483
7532
|
import { Command as Command13 } from "commander";
|
|
7484
|
-
import
|
|
7533
|
+
import chalk29 from "chalk";
|
|
7485
7534
|
init_errors();
|
|
7486
7535
|
|
|
7487
7536
|
// src/commands/providers/add.ts
|
|
7488
7537
|
init_sdk_client();
|
|
7489
|
-
import
|
|
7538
|
+
import chalk26 from "chalk";
|
|
7490
7539
|
init_errors();
|
|
7491
7540
|
function resolveScope(scopeFlag, client) {
|
|
7492
7541
|
const scope = scopeFlag ?? "workspace";
|
|
@@ -7509,10 +7558,10 @@ function resolveScope(scopeFlag, client) {
|
|
|
7509
7558
|
function registerAddCommand(parent) {
|
|
7510
7559
|
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", `
|
|
7511
7560
|
Examples:
|
|
7512
|
-
${
|
|
7513
|
-
${
|
|
7514
|
-
${
|
|
7515
|
-
${
|
|
7561
|
+
${chalk26.dim("$")} mutagent providers add --provider openai --name "My OpenAI" --api-key $OPENAI_API_KEY
|
|
7562
|
+
${chalk26.dim("$")} mutagent providers add --provider anthropic --name "Team Claude" --api-key $KEY --scope org
|
|
7563
|
+
${chalk26.dim("$")} mutagent providers add --provider openai --name "Personal" --api-key $KEY --scope user --set-default
|
|
7564
|
+
${chalk26.dim("$")} mutagent providers add --provider custom --name "Ollama" --api-key none --base-url http://localhost:11434 --json
|
|
7516
7565
|
|
|
7517
7566
|
Scope Resolution:
|
|
7518
7567
|
workspace (default) Uses your configured workspace
|
|
@@ -7558,10 +7607,10 @@ The API key is encrypted server-side and never returned in plain text.
|
|
|
7558
7607
|
console.log(` Scope: ${options.scope ?? "workspace"}`);
|
|
7559
7608
|
console.log(` URL: ${providerLink(created.id)}`);
|
|
7560
7609
|
if (options.setDefault) {
|
|
7561
|
-
console.log(
|
|
7610
|
+
console.log(chalk26.green(" Set as default provider"));
|
|
7562
7611
|
}
|
|
7563
7612
|
console.log("");
|
|
7564
|
-
console.log(
|
|
7613
|
+
console.log(chalk26.dim("API key is encrypted server-side. Use `providers get` to see masked key."));
|
|
7565
7614
|
}
|
|
7566
7615
|
} catch (error) {
|
|
7567
7616
|
handleError(error, isJson);
|
|
@@ -7599,15 +7648,15 @@ function buildProviderCreatedDirective(provider, scope) {
|
|
|
7599
7648
|
|
|
7600
7649
|
// src/commands/providers/update.ts
|
|
7601
7650
|
init_sdk_client();
|
|
7602
|
-
import
|
|
7651
|
+
import chalk27 from "chalk";
|
|
7603
7652
|
init_errors();
|
|
7604
7653
|
function registerUpdateCommand(parent) {
|
|
7605
7654
|
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", `
|
|
7606
7655
|
Examples:
|
|
7607
|
-
${
|
|
7608
|
-
${
|
|
7609
|
-
${
|
|
7610
|
-
${
|
|
7656
|
+
${chalk27.dim("$")} mutagent providers update <id> --name "New Name"
|
|
7657
|
+
${chalk27.dim("$")} mutagent providers update <id> --api-key $NEW_KEY --json
|
|
7658
|
+
${chalk27.dim("$")} mutagent providers update <id> --active false
|
|
7659
|
+
${chalk27.dim("$")} mutagent providers update <id> --set-default --json
|
|
7611
7660
|
|
|
7612
7661
|
PATCH semantics — only provided fields are updated.
|
|
7613
7662
|
`).action(async (id, options) => {
|
|
@@ -7658,7 +7707,7 @@ PATCH semantics — only provided fields are updated.
|
|
|
7658
7707
|
console.log(` ID: ${String(updated.id ?? id)}`);
|
|
7659
7708
|
console.log(` URL: ${providerLink(updated.id ?? id)}`);
|
|
7660
7709
|
if (options.apiKey) {
|
|
7661
|
-
console.log(
|
|
7710
|
+
console.log(chalk27.dim(" API key re-encrypted server-side."));
|
|
7662
7711
|
}
|
|
7663
7712
|
}
|
|
7664
7713
|
} catch (error) {
|
|
@@ -7697,17 +7746,17 @@ function buildProviderUpdatedDirective(provider, requestId) {
|
|
|
7697
7746
|
|
|
7698
7747
|
// src/commands/providers/delete.ts
|
|
7699
7748
|
init_sdk_client();
|
|
7700
|
-
import
|
|
7749
|
+
import chalk28 from "chalk";
|
|
7701
7750
|
init_errors();
|
|
7702
7751
|
function registerDeleteCommand(parent) {
|
|
7703
7752
|
parent.command("delete").description("Delete a provider configuration").argument("<id>", "Provider ID (from: mutagent providers list)").option("-f, --force", "Skip confirmation prompt").addHelpText("after", `
|
|
7704
7753
|
Examples:
|
|
7705
|
-
${
|
|
7706
|
-
${
|
|
7707
|
-
${
|
|
7754
|
+
${chalk28.dim("$")} mutagent providers delete <id>
|
|
7755
|
+
${chalk28.dim("$")} mutagent providers delete <id> --force
|
|
7756
|
+
${chalk28.dim("$")} mutagent providers delete <id> --force --json
|
|
7708
7757
|
|
|
7709
|
-
${
|
|
7710
|
-
${
|
|
7758
|
+
${chalk28.dim("Note: --force is required. The CLI is non-interactive — confirm with the user via your native flow, then pass --force.")}
|
|
7759
|
+
${chalk28.dim("Warning: API keys are AES-256-GCM encrypted and irrecoverable after deletion. Agents referencing this provider will lose their model config.")}
|
|
7711
7760
|
`).action(async (id, options) => {
|
|
7712
7761
|
const isJson = getJsonFlag(parent);
|
|
7713
7762
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7797,12 +7846,12 @@ function validateProviderType(type) {
|
|
|
7797
7846
|
function createProvidersCommand() {
|
|
7798
7847
|
const providers = new Command13("providers").description("Manage LLM provider configurations (BYOK)").addHelpText("after", `
|
|
7799
7848
|
Examples:
|
|
7800
|
-
${
|
|
7801
|
-
${
|
|
7802
|
-
${
|
|
7803
|
-
${
|
|
7804
|
-
${
|
|
7805
|
-
${
|
|
7849
|
+
${chalk29.dim("$")} mutagent providers list
|
|
7850
|
+
${chalk29.dim("$")} mutagent providers get <provider-id>
|
|
7851
|
+
${chalk29.dim("$")} mutagent providers add --provider openai --name "My OpenAI" --api-key $KEY
|
|
7852
|
+
${chalk29.dim("$")} mutagent providers update <id> --name "New Name"
|
|
7853
|
+
${chalk29.dim("$")} mutagent providers delete <id> --force
|
|
7854
|
+
${chalk29.dim("$")} mutagent providers test <provider-id>
|
|
7806
7855
|
|
|
7807
7856
|
Provider Types:
|
|
7808
7857
|
openai, anthropic, google, azure, bedrock, cohere, mistral, groq, together, replicate, custom
|
|
@@ -7812,9 +7861,9 @@ Subcommands:
|
|
|
7812
7861
|
`);
|
|
7813
7862
|
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", `
|
|
7814
7863
|
Examples:
|
|
7815
|
-
${
|
|
7816
|
-
${
|
|
7817
|
-
${
|
|
7864
|
+
${chalk29.dim("$")} mutagent providers list
|
|
7865
|
+
${chalk29.dim("$")} mutagent providers list --type openai
|
|
7866
|
+
${chalk29.dim("$")} mutagent providers list --json
|
|
7818
7867
|
`).action(async (options) => {
|
|
7819
7868
|
const isJson = getJsonFlag(providers);
|
|
7820
7869
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7863,8 +7912,8 @@ Examples:
|
|
|
7863
7912
|
});
|
|
7864
7913
|
providers.command("get").description("Get provider details").argument("<id>", "Provider ID (from: mutagent providers list)").addHelpText("after", `
|
|
7865
7914
|
Examples:
|
|
7866
|
-
${
|
|
7867
|
-
${
|
|
7915
|
+
${chalk29.dim("$")} mutagent providers get <provider-id>
|
|
7916
|
+
${chalk29.dim("$")} mutagent providers get <provider-id> --json
|
|
7868
7917
|
`).action(async (id) => {
|
|
7869
7918
|
const isJson = getJsonFlag(providers);
|
|
7870
7919
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7893,10 +7942,10 @@ Examples:
|
|
|
7893
7942
|
});
|
|
7894
7943
|
providers.command("test").description("Test provider connectivity").argument("<id>", "Provider ID (from: mutagent providers list)").addHelpText("after", `
|
|
7895
7944
|
Examples:
|
|
7896
|
-
${
|
|
7897
|
-
${
|
|
7945
|
+
${chalk29.dim("$")} mutagent providers test <provider-id>
|
|
7946
|
+
${chalk29.dim("$")} mutagent providers test <provider-id> --json
|
|
7898
7947
|
|
|
7899
|
-
${
|
|
7948
|
+
${chalk29.dim("Tests connectivity and lists available models for the provider.")}
|
|
7900
7949
|
`).action(async (id) => {
|
|
7901
7950
|
const isJson = getJsonFlag(providers);
|
|
7902
7951
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -7911,9 +7960,9 @@ ${chalk26.dim("Tests connectivity and lists available models for the provider.")
|
|
|
7911
7960
|
} else {
|
|
7912
7961
|
if (result.success) {
|
|
7913
7962
|
output.success(`Provider test passed (${String(result.responseTimeMs)}ms)`);
|
|
7914
|
-
console.log(
|
|
7963
|
+
console.log(chalk29.green(`Message: ${result.message}`));
|
|
7915
7964
|
if (result.availableModels && result.availableModels.length > 0) {
|
|
7916
|
-
console.log(
|
|
7965
|
+
console.log(chalk29.bold(`
|
|
7917
7966
|
Available Models:`));
|
|
7918
7967
|
result.availableModels.forEach((model) => {
|
|
7919
7968
|
console.log(` - ${model}`);
|
|
@@ -7922,7 +7971,7 @@ Available Models:`));
|
|
|
7922
7971
|
} else {
|
|
7923
7972
|
output.error(`Provider test failed: ${result.message}`);
|
|
7924
7973
|
if (result.error) {
|
|
7925
|
-
console.log(
|
|
7974
|
+
console.log(chalk29.red(`Error: ${result.error}`));
|
|
7926
7975
|
}
|
|
7927
7976
|
}
|
|
7928
7977
|
}
|
|
@@ -7940,7 +7989,7 @@ Available Models:`));
|
|
|
7940
7989
|
init_config();
|
|
7941
7990
|
import { Command as Command14 } from "commander";
|
|
7942
7991
|
import inquirer2 from "inquirer";
|
|
7943
|
-
import
|
|
7992
|
+
import chalk30 from "chalk";
|
|
7944
7993
|
import { existsSync as existsSync11, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
7945
7994
|
import { execSync as execSync3 } from "child_process";
|
|
7946
7995
|
import { join as join6 } from "path";
|
|
@@ -8063,13 +8112,13 @@ function writeRcConfig(config, cwd = process.cwd()) {
|
|
|
8063
8112
|
function createInitCommand() {
|
|
8064
8113
|
const init = new Command14("init").description("Initialize MutagenT in your project").option("--non-interactive", "Skip interactive prompts (defaults to CLI-only mode)").addHelpText("after", `
|
|
8065
8114
|
Examples:
|
|
8066
|
-
${
|
|
8067
|
-
${
|
|
8115
|
+
${chalk30.dim("$")} mutagent init # Interactive setup wizard
|
|
8116
|
+
${chalk30.dim("$")} mutagent init --non-interactive # CLI-only mode (no prompts)
|
|
8068
8117
|
|
|
8069
8118
|
Modes:
|
|
8070
|
-
${
|
|
8071
|
-
${
|
|
8072
|
-
${
|
|
8119
|
+
${chalk30.bold("Full scaffold")} Install SDK + integration package, create config, setup tracing
|
|
8120
|
+
${chalk30.bold("CLI-only")} Verify auth + create .mutagentrc.json with workspace/endpoint
|
|
8121
|
+
${chalk30.bold("Skip")} Exit without changes
|
|
8073
8122
|
`).action(async (options) => {
|
|
8074
8123
|
const isJson = getJsonFlag(init);
|
|
8075
8124
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -8341,23 +8390,23 @@ Modes:
|
|
|
8341
8390
|
|
|
8342
8391
|
// src/commands/explore.ts
|
|
8343
8392
|
import { Command as Command15 } from "commander";
|
|
8344
|
-
import
|
|
8393
|
+
import chalk31 from "chalk";
|
|
8345
8394
|
import { resolve as resolve3 } from "path";
|
|
8346
8395
|
init_errors();
|
|
8347
8396
|
function createExploreCommand() {
|
|
8348
8397
|
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", `
|
|
8349
8398
|
Examples:
|
|
8350
|
-
${
|
|
8351
|
-
${
|
|
8352
|
-
${
|
|
8353
|
-
${
|
|
8354
|
-
${
|
|
8399
|
+
${chalk31.dim("$")} mutagent explore
|
|
8400
|
+
${chalk31.dim("$")} mutagent explore --path ./src
|
|
8401
|
+
${chalk31.dim("$")} mutagent explore --include "**/*.{ts,py}" --depth 5
|
|
8402
|
+
${chalk31.dim("$")} mutagent explore --markers-only
|
|
8403
|
+
${chalk31.dim("$")} mutagent explore --json
|
|
8355
8404
|
|
|
8356
8405
|
Detection modes:
|
|
8357
|
-
${
|
|
8358
|
-
${
|
|
8406
|
+
${chalk31.dim("Heuristic")} Template variables ({{var}}), prompt constants, schema definitions
|
|
8407
|
+
${chalk31.dim("Marker")} MutagenT:START/END comment markers from previous uploads
|
|
8359
8408
|
|
|
8360
|
-
${
|
|
8409
|
+
${chalk31.dim("Results are saved to .mutagent/mutation-context.md for use by other commands.")}
|
|
8361
8410
|
`).action((options) => {
|
|
8362
8411
|
const isJson = getJsonFlag(explore);
|
|
8363
8412
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -8375,7 +8424,7 @@ ${chalk28.dim("Results are saved to .mutagent/mutation-context.md for use by oth
|
|
|
8375
8424
|
markersOnly
|
|
8376
8425
|
};
|
|
8377
8426
|
if (!isJson) {
|
|
8378
|
-
console.log(
|
|
8427
|
+
console.log(chalk31.cyan(`
|
|
8379
8428
|
Scanning ${scanPath}...
|
|
8380
8429
|
`));
|
|
8381
8430
|
}
|
|
@@ -8404,41 +8453,41 @@ Scanning ${scanPath}...
|
|
|
8404
8453
|
const totalFindings = result.prompts.length + result.datasets.length + result.markers.length;
|
|
8405
8454
|
if (totalFindings === 0) {
|
|
8406
8455
|
output.info("No prompts, datasets, or markers found.");
|
|
8407
|
-
console.log(
|
|
8456
|
+
console.log(chalk31.dim(`
|
|
8408
8457
|
Tip: Create a prompt with template variables like {{input}} to get started.`));
|
|
8409
8458
|
return;
|
|
8410
8459
|
}
|
|
8411
8460
|
if (result.prompts.length > 0) {
|
|
8412
|
-
console.log(
|
|
8461
|
+
console.log(chalk31.bold(` Prompts Found (${String(result.prompts.length)}):`));
|
|
8413
8462
|
console.log();
|
|
8414
8463
|
for (const p of result.prompts) {
|
|
8415
|
-
const confidenceTag = p.confidence === "high" ?
|
|
8416
|
-
const reasonTag =
|
|
8417
|
-
console.log(` ${confidenceTag} ${
|
|
8418
|
-
console.log(` ${
|
|
8464
|
+
const confidenceTag = p.confidence === "high" ? chalk31.green("[high]") : p.confidence === "medium" ? chalk31.yellow("[medium]") : chalk31.dim("[low]");
|
|
8465
|
+
const reasonTag = chalk31.dim(`[${p.reason}]`);
|
|
8466
|
+
console.log(` ${confidenceTag} ${chalk31.green(p.file)}:${chalk31.yellow(String(p.line))} ${reasonTag}`);
|
|
8467
|
+
console.log(` ${chalk31.dim(p.preview)}`);
|
|
8419
8468
|
}
|
|
8420
8469
|
console.log();
|
|
8421
8470
|
}
|
|
8422
8471
|
if (result.datasets.length > 0) {
|
|
8423
|
-
console.log(
|
|
8472
|
+
console.log(chalk31.bold(` Datasets Found (${String(result.datasets.length)}):`));
|
|
8424
8473
|
console.log();
|
|
8425
8474
|
for (const d of result.datasets) {
|
|
8426
|
-
console.log(` ${
|
|
8475
|
+
console.log(` ${chalk31.green(d.file)} ${chalk31.dim(`(${String(d.items)} items)`)}`);
|
|
8427
8476
|
}
|
|
8428
8477
|
console.log();
|
|
8429
8478
|
}
|
|
8430
8479
|
if (result.markers.length > 0) {
|
|
8431
|
-
console.log(
|
|
8480
|
+
console.log(chalk31.bold(` MutagenT Markers (${String(result.markers.length)}):`));
|
|
8432
8481
|
console.log();
|
|
8433
8482
|
for (const m of result.markers) {
|
|
8434
|
-
const idPart = m.platformId ?
|
|
8435
|
-
console.log(` ${
|
|
8483
|
+
const idPart = m.platformId ? chalk31.cyan(` id=${m.platformId}`) : "";
|
|
8484
|
+
console.log(` ${chalk31.green(m.file)}:${chalk31.yellow(String(m.line))} ${chalk31.magenta(m.type)}${idPart}`);
|
|
8436
8485
|
}
|
|
8437
8486
|
console.log();
|
|
8438
8487
|
}
|
|
8439
|
-
console.log(
|
|
8440
|
-
console.log(` ${
|
|
8441
|
-
console.log(
|
|
8488
|
+
console.log(chalk31.dim(" ─────────────────────────────────"));
|
|
8489
|
+
console.log(` ${chalk31.bold("Summary:")} ${String(result.prompts.length)} prompts, ${String(result.datasets.length)} datasets, ${String(result.markers.length)} markers`);
|
|
8490
|
+
console.log(chalk31.dim(` Saved to .mutagent/mutation-context.md`));
|
|
8442
8491
|
console.log();
|
|
8443
8492
|
}
|
|
8444
8493
|
} catch (error) {
|
|
@@ -8450,7 +8499,7 @@ Scanning ${scanPath}...
|
|
|
8450
8499
|
|
|
8451
8500
|
// src/commands/skills.ts
|
|
8452
8501
|
import { Command as Command16 } from "commander";
|
|
8453
|
-
import
|
|
8502
|
+
import chalk32 from "chalk";
|
|
8454
8503
|
import { existsSync as existsSync12, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
8455
8504
|
import { join as join7 } from "path";
|
|
8456
8505
|
import { execSync as execSync4 } from "child_process";
|
|
@@ -8574,7 +8623,7 @@ function createSkillsCommand() {
|
|
|
8574
8623
|
const skills = new Command16("skills").description("Manage MutagenT CLI skills for coding agents");
|
|
8575
8624
|
skills.command("install").description("Install MutagenT CLI skill for Claude Code").addHelpText("after", `
|
|
8576
8625
|
Examples:
|
|
8577
|
-
${
|
|
8626
|
+
${chalk32.dim("$")} mutagent skills install
|
|
8578
8627
|
|
|
8579
8628
|
This creates a Claude Code skill at .claude/skills/mutagent-cli/SKILL.md
|
|
8580
8629
|
that teaches coding agents how to use the MutagenT CLI effectively.
|
|
@@ -8601,10 +8650,10 @@ ${SKILL_BODY}
|
|
|
8601
8650
|
});
|
|
8602
8651
|
} else {
|
|
8603
8652
|
output.success(`Installed MutagenT CLI skill`);
|
|
8604
|
-
console.log(` ${
|
|
8653
|
+
console.log(` ${chalk32.dim("Path:")} ${skillPath}`);
|
|
8605
8654
|
console.log("");
|
|
8606
|
-
console.log(` ${
|
|
8607
|
-
console.log(` ${
|
|
8655
|
+
console.log(` ${chalk32.dim("This skill teaches coding agents how to use the MutagenT CLI.")}`);
|
|
8656
|
+
console.log(` ${chalk32.dim("It will be automatically loaded by Claude Code when relevant triggers match.")}`);
|
|
8608
8657
|
}
|
|
8609
8658
|
});
|
|
8610
8659
|
return skills;
|
|
@@ -8613,15 +8662,15 @@ ${SKILL_BODY}
|
|
|
8613
8662
|
// src/commands/usage.ts
|
|
8614
8663
|
init_config();
|
|
8615
8664
|
import { Command as Command17 } from "commander";
|
|
8616
|
-
import
|
|
8665
|
+
import chalk33 from "chalk";
|
|
8617
8666
|
init_errors();
|
|
8618
8667
|
init_sdk_client();
|
|
8619
8668
|
var PROVIDERS_URL = "https://app.mutagent.io/settings/providers";
|
|
8620
8669
|
function createUsageCommand() {
|
|
8621
8670
|
const usage = new Command17("usage").description("Show resource counts (prompts, datasets, evaluations, optimizations, experiments)").addHelpText("after", `
|
|
8622
8671
|
Examples:
|
|
8623
|
-
${
|
|
8624
|
-
${
|
|
8672
|
+
${chalk33.dim("$")} mutagent usage
|
|
8673
|
+
${chalk33.dim("$")} mutagent usage --json
|
|
8625
8674
|
`);
|
|
8626
8675
|
usage.action(async () => {
|
|
8627
8676
|
const isJson = getJsonFlag(usage);
|
|
@@ -8676,17 +8725,17 @@ Examples:
|
|
|
8676
8725
|
});
|
|
8677
8726
|
} else {
|
|
8678
8727
|
console.log("");
|
|
8679
|
-
console.log(
|
|
8680
|
-
console.log(
|
|
8728
|
+
console.log(chalk33.bold("\uD83D\uDCCA MutagenT Usage"));
|
|
8729
|
+
console.log(chalk33.dim("─".repeat(45)));
|
|
8681
8730
|
console.log("");
|
|
8682
|
-
console.log(
|
|
8683
|
-
console.log(` Prompts: ${
|
|
8684
|
-
console.log(` Datasets: ${
|
|
8685
|
-
console.log(` Evaluations: ${
|
|
8686
|
-
console.log(` Optimizations: ${
|
|
8687
|
-
console.log(` Experiments: ${
|
|
8731
|
+
console.log(chalk33.bold("Resources:"));
|
|
8732
|
+
console.log(` Prompts: ${chalk33.cyan(String(promptCount))}`);
|
|
8733
|
+
console.log(` Datasets: ${chalk33.cyan(String(datasetCount))}`);
|
|
8734
|
+
console.log(` Evaluations: ${chalk33.cyan(String(evaluationCount))}`);
|
|
8735
|
+
console.log(` Optimizations: ${chalk33.cyan(String(optimizationCount))}`);
|
|
8736
|
+
console.log(` Experiments: ${chalk33.cyan(String(experimentCount))}`);
|
|
8688
8737
|
console.log("");
|
|
8689
|
-
console.log(` Providers: ${
|
|
8738
|
+
console.log(` Providers: ${chalk33.underline(PROVIDERS_URL)}`);
|
|
8690
8739
|
console.log("");
|
|
8691
8740
|
}
|
|
8692
8741
|
} catch (error) {
|
|
@@ -8974,7 +9023,7 @@ Claude Code Session Telemetry:
|
|
|
8974
9023
|
|
|
8975
9024
|
// src/commands/feedback.ts
|
|
8976
9025
|
import { Command as Command19 } from "commander";
|
|
8977
|
-
import
|
|
9026
|
+
import chalk34 from "chalk";
|
|
8978
9027
|
init_errors();
|
|
8979
9028
|
init_config();
|
|
8980
9029
|
import { readFileSync as readFileSync11 } from "fs";
|
|
@@ -9028,12 +9077,12 @@ async function postToServer(payload, endpoint, apiKey, workspaceId, organization
|
|
|
9028
9077
|
}
|
|
9029
9078
|
function createFeedbackCommand() {
|
|
9030
9079
|
const feedback = new Command19("feedback").description("Send product feedback to MutagenT").addHelpText("after", `
|
|
9031
|
-
${
|
|
9032
|
-
${
|
|
9033
|
-
${
|
|
9034
|
-
${
|
|
9080
|
+
${chalk34.bold("Examples:")}
|
|
9081
|
+
${chalk34.cyan('mutagent feedback send -m "Great optimization results!"')}
|
|
9082
|
+
${chalk34.cyan('mutagent feedback send -m "CLI crashed on export" --category bug')}
|
|
9083
|
+
${chalk34.cyan('mutagent feedback send -m "Need batch operations" --category feature --json')}
|
|
9035
9084
|
|
|
9036
|
-
${
|
|
9085
|
+
${chalk34.yellow("AI Agent (MANDATORY):")}
|
|
9037
9086
|
ALWAYS use --json: mutagent feedback send -m "..." --category improvement --json
|
|
9038
9087
|
Use this command to report bugs, request features, or share UX feedback.
|
|
9039
9088
|
`).action(() => {
|
|
@@ -9044,18 +9093,18 @@ ${chalk31.yellow("AI Agent (MANDATORY):")}
|
|
|
9044
9093
|
}
|
|
9045
9094
|
function registerFeedbackSend(feedback) {
|
|
9046
9095
|
feedback.command("send").description("Send feedback about the MutagenT platform").requiredOption("-m, --message <text>", "Feedback message").option("--category <type>", `Feedback category: ${VALID_CATEGORIES.join(", ")}`, "improvement").option("--session <id>", "Link feedback to a specific session").addHelpText("after", `
|
|
9047
|
-
${
|
|
9048
|
-
${
|
|
9049
|
-
${
|
|
9050
|
-
${
|
|
9051
|
-
|
|
9052
|
-
${
|
|
9053
|
-
${
|
|
9054
|
-
${
|
|
9055
|
-
${
|
|
9056
|
-
${
|
|
9057
|
-
|
|
9058
|
-
${
|
|
9096
|
+
${chalk34.bold("Examples:")}
|
|
9097
|
+
${chalk34.dim("$")} mutagent feedback send -m "The optimization UX could show progress better"
|
|
9098
|
+
${chalk34.dim("$")} mutagent feedback send -m "CLI errored on traces export" --category bug
|
|
9099
|
+
${chalk34.dim("$")} mutagent feedback send -m "Love the guided eval!" --category praise --json
|
|
9100
|
+
|
|
9101
|
+
${chalk34.bold("Categories:")}
|
|
9102
|
+
${chalk34.bold("bug")} Something is broken or not working as expected
|
|
9103
|
+
${chalk34.bold("feature")} Request a new capability
|
|
9104
|
+
${chalk34.bold("improvement")} Suggest a UX or workflow enhancement (default)
|
|
9105
|
+
${chalk34.bold("praise")} Share what you love about the platform
|
|
9106
|
+
|
|
9107
|
+
${chalk34.yellow("AI Agent (MANDATORY):")}
|
|
9059
9108
|
ALWAYS use --json: mutagent feedback send -m "..." --json
|
|
9060
9109
|
Auto-captured context (CLI version, platform, node version) is included automatically.
|
|
9061
9110
|
`).action(async (options) => {
|
|
@@ -9127,90 +9176,90 @@ program.name("mutagent").description(`MutagenT CLI - AI-native prompt optimizati
|
|
|
9127
9176
|
showGlobalOptions: true
|
|
9128
9177
|
});
|
|
9129
9178
|
program.addHelpText("after", `
|
|
9130
|
-
${
|
|
9131
|
-
export MUTAGENT_API_KEY=mt_... ${
|
|
9132
|
-
--json ${
|
|
9133
|
-
|
|
9134
|
-
${
|
|
9135
|
-
mutagent login ${
|
|
9136
|
-
mutagent auth status ${
|
|
9137
|
-
mutagent init ${
|
|
9138
|
-
mutagent explore ${
|
|
9139
|
-
mutagent workspaces list --json ${
|
|
9140
|
-
mutagent config set workspace <id> ${
|
|
9141
|
-
mutagent usage --json ${
|
|
9142
|
-
|
|
9143
|
-
mutagent prompts create --help ${
|
|
9144
|
-
mutagent prompts list --json ${
|
|
9145
|
-
mutagent prompts get <id> --json ${
|
|
9146
|
-
|
|
9147
|
-
mutagent prompts dataset add --help ${
|
|
9148
|
-
mutagent prompts dataset list <id> ${
|
|
9149
|
-
|
|
9150
|
-
mutagent prompts evaluation create --help ${
|
|
9151
|
-
mutagent prompts evaluation create <id> --guided --json ${
|
|
9152
|
-
mutagent prompts evaluation list <id> --json ${
|
|
9153
|
-
|
|
9154
|
-
mutagent prompts optimize start --help ${
|
|
9155
|
-
mutagent prompts optimize status <job-id> ${
|
|
9156
|
-
mutagent prompts optimize results <job-id> ${
|
|
9157
|
-
|
|
9158
|
-
mutagent feedback send -m "..." ${
|
|
9159
|
-
mutagent feedback send -m "..." --category bug ${
|
|
9160
|
-
|
|
9161
|
-
mutagent integrate <framework> ${
|
|
9162
|
-
mutagent hooks --help ${
|
|
9163
|
-
mutagent playground run <id> --input '{...}' ${
|
|
9164
|
-
|
|
9165
|
-
${
|
|
9166
|
-
1. mutagent explore ${
|
|
9167
|
-
2. mutagent integrate <framework> ${
|
|
9168
|
-
3. Apply tracing code to your codebase ${
|
|
9169
|
-
4. mutagent traces list --json ${
|
|
9170
|
-
|
|
9171
|
-
${
|
|
9172
|
-
1. mutagent prompts create --help ${
|
|
9173
|
-
2. mutagent prompts create ... --json ${
|
|
9174
|
-
3. mutagent prompts dataset add --help ${
|
|
9175
|
-
4. mutagent prompts dataset add <id> ... --json ${
|
|
9176
|
-
5. mutagent prompts evaluation create <id> --guided --json ${
|
|
9179
|
+
${chalk35.yellow("Non-Interactive Mode (CI/CD & Coding Agents):")}
|
|
9180
|
+
export MUTAGENT_API_KEY=mt_... ${chalk35.dim("or")} --api-key mt_...
|
|
9181
|
+
--json ${chalk35.dim("for structured output")} --non-interactive ${chalk35.dim("to disable prompts")}
|
|
9182
|
+
|
|
9183
|
+
${chalk35.yellow("Command Navigation:")}
|
|
9184
|
+
mutagent login ${chalk35.dim("Login (browser OAuth — recommended)")}
|
|
9185
|
+
mutagent auth status ${chalk35.dim("Check auth + workspace")}
|
|
9186
|
+
mutagent init ${chalk35.dim("Initialize project (.mutagentrc.json)")}
|
|
9187
|
+
mutagent explore ${chalk35.dim("Discover prompts in codebase")}
|
|
9188
|
+
mutagent workspaces list --json ${chalk35.dim("List workspaces (verify ID)")}
|
|
9189
|
+
mutagent config set workspace <id> ${chalk35.dim("Set active workspace")}
|
|
9190
|
+
mutagent usage --json ${chalk35.dim("Show account usage + provider status")}
|
|
9191
|
+
|
|
9192
|
+
mutagent prompts create --help ${chalk35.dim("Upload prompt (read help first!)")}
|
|
9193
|
+
mutagent prompts list --json ${chalk35.dim("List prompts")}
|
|
9194
|
+
mutagent prompts get <id> --json ${chalk35.dim("Full prompt details + schemas")}
|
|
9195
|
+
|
|
9196
|
+
mutagent prompts dataset add --help ${chalk35.dim("Upload dataset (read help first!)")}
|
|
9197
|
+
mutagent prompts dataset list <id> ${chalk35.dim("List datasets")}
|
|
9198
|
+
|
|
9199
|
+
mutagent prompts evaluation create --help ${chalk35.dim("Create eval (read help first!)")}
|
|
9200
|
+
mutagent prompts evaluation create <id> --guided --json ${chalk35.dim("Guided eval workflow")}
|
|
9201
|
+
mutagent prompts evaluation list <id> --json ${chalk35.dim("List evaluations")}
|
|
9202
|
+
|
|
9203
|
+
mutagent prompts optimize start --help ${chalk35.dim("Run optimization (read help first!)")}
|
|
9204
|
+
mutagent prompts optimize status <job-id> ${chalk35.dim("Poll progress")}
|
|
9205
|
+
mutagent prompts optimize results <job-id> ${chalk35.dim("View scorecard")}
|
|
9206
|
+
|
|
9207
|
+
mutagent feedback send -m "..." ${chalk35.dim("Send product feedback")}
|
|
9208
|
+
mutagent feedback send -m "..." --category bug ${chalk35.dim("Report a bug")}
|
|
9209
|
+
|
|
9210
|
+
mutagent integrate <framework> ${chalk35.dim("Framework integration guide")}
|
|
9211
|
+
mutagent hooks --help ${chalk35.dim("Hook setup for Claude Code telemetry")}
|
|
9212
|
+
mutagent playground run <id> --input '{...}' ${chalk35.dim("Quick test")}
|
|
9213
|
+
|
|
9214
|
+
${chalk35.yellow("★ Workflow: Framework Integration (Tracing):")}
|
|
9215
|
+
1. mutagent explore ${chalk35.dim("← discover prompts/agents in codebase")}
|
|
9216
|
+
2. mutagent integrate <framework> ${chalk35.dim("← get integration instructions")}
|
|
9217
|
+
3. Apply tracing code to your codebase ${chalk35.dim("← follow the guide output")}
|
|
9218
|
+
4. mutagent traces list --json ${chalk35.dim("← verify traces are arriving")}
|
|
9219
|
+
|
|
9220
|
+
${chalk35.yellow("★ Workflow: Evaluate → Optimize:")}
|
|
9221
|
+
1. mutagent prompts create --help ${chalk35.dim("← read help")}
|
|
9222
|
+
2. mutagent prompts create ... --json ${chalk35.dim("← upload prompt with {variables} + inputSchema")}
|
|
9223
|
+
3. mutagent prompts dataset add --help ${chalk35.dim("← read help")}
|
|
9224
|
+
4. mutagent prompts dataset add <id> ... --json ${chalk35.dim("← upload dataset")}
|
|
9225
|
+
5. mutagent prompts evaluation create <id> --guided --json ${chalk35.dim("← guided eval")}
|
|
9177
9226
|
6. mutagent prompts optimize start <id> --dataset <d> --evaluation <e> --json
|
|
9178
9227
|
|
|
9179
|
-
${
|
|
9180
|
-
After ${
|
|
9181
|
-
${
|
|
9182
|
-
${
|
|
9183
|
-
${
|
|
9228
|
+
${chalk35.yellow("Post-Onboarding Decision Tree:")}
|
|
9229
|
+
After ${chalk35.bold("mutagent auth login")}, users land in one of 3 paths:
|
|
9230
|
+
${chalk35.bold("Path A")} (Tracing): explore → integrate <framework> → apply tracing → verify
|
|
9231
|
+
${chalk35.bold("Path B")} (Optimization): explore → prompts create → dataset add → eval create → optimize
|
|
9232
|
+
${chalk35.bold("Path C")} (Manual): Use CLI commands directly — run mutagent <command> --help
|
|
9184
9233
|
|
|
9185
|
-
${
|
|
9234
|
+
${chalk35.yellow("Directive System:")}
|
|
9186
9235
|
Every --json response may include:
|
|
9187
|
-
${
|
|
9188
|
-
${
|
|
9189
|
-
${
|
|
9190
|
-
${
|
|
9236
|
+
${chalk35.bold("_directive.renderedCard")} Pre-formatted card for the user ${chalk35.red("(MUST be shown in chat)")}
|
|
9237
|
+
${chalk35.bold("_directive.instruction")} Next step for the agent
|
|
9238
|
+
${chalk35.bold("_directive.next")} Array of suggested follow-up commands
|
|
9239
|
+
${chalk35.bold("_links")} Dashboard/API URLs (format as markdown links)
|
|
9191
9240
|
|
|
9192
|
-
${
|
|
9193
|
-
Each criterion MUST have: ${
|
|
9241
|
+
${chalk35.yellow("Evaluation Criteria Format:")}
|
|
9242
|
+
Each criterion MUST have: ${chalk35.bold("name")}, ${chalk35.bold("description")} (scoring rubric), ${chalk35.bold("evaluationParameter")}
|
|
9194
9243
|
evaluationParameter MUST match an inputSchema or outputSchema field name
|
|
9195
9244
|
No duplicate evaluationParameter values — each criterion targets a unique field
|
|
9196
9245
|
ALL schema fields must be covered (missing fields = error)
|
|
9197
|
-
Use ${
|
|
9246
|
+
Use ${chalk35.bold("--guided --json")} to generate criteria templates from prompt schemas
|
|
9198
9247
|
|
|
9199
|
-
${
|
|
9200
|
-
Default max-iterations is 1. ${
|
|
9248
|
+
${chalk35.yellow("Optimization Cost Control:")}
|
|
9249
|
+
Default max-iterations is 1. ${chalk35.red("NEVER increase without explicit user request.")}
|
|
9201
9250
|
Each iteration incurs LLM costs — confirm with user before starting >1.
|
|
9202
9251
|
|
|
9203
|
-
${
|
|
9204
|
-
After ${
|
|
9205
|
-
Then offer choices: ${
|
|
9252
|
+
${chalk35.yellow("Post-Optimization:")}
|
|
9253
|
+
After ${chalk35.bold("optimize results")}: ALWAYS show the before/after diff to the user first.
|
|
9254
|
+
Then offer choices: ${chalk35.bold("Apply")} / ${chalk35.bold("Reject")}.
|
|
9206
9255
|
|
|
9207
|
-
${
|
|
9256
|
+
${chalk35.yellow("State Tracking:")}
|
|
9208
9257
|
.mutagent/mutation-context.md — Codebase index of discovered/uploaded prompts
|
|
9209
9258
|
Update after explore, create, and dataset operations
|
|
9210
9259
|
mutagent auth status — Auth + workspace state
|
|
9211
9260
|
Comment markers (// MutagenT:START ... // MutagenT:END) in source files
|
|
9212
9261
|
|
|
9213
|
-
${
|
|
9262
|
+
${chalk35.yellow("AI Agent Rules (MANDATORY for coding agents):")}
|
|
9214
9263
|
1. Login (two paths):
|
|
9215
9264
|
- CI / fully automated: export MUTAGENT_API_KEY=mt_... then mutagent login --json
|
|
9216
9265
|
- Helping a user onboard: mutagent login --browser --json
|
|
@@ -9221,15 +9270,15 @@ ${chalk32.yellow("AI Agent Rules (MANDATORY for coding agents):")}
|
|
|
9221
9270
|
3. Run <command> --help BEFORE first use of any command
|
|
9222
9271
|
4. Use --guided --json for evaluation creation (NEVER --guided alone)
|
|
9223
9272
|
5. Parse _directive.renderedCard and copy it into your CHAT RESPONSE verbatim
|
|
9224
|
-
${
|
|
9273
|
+
${chalk35.red("HARD STOP")}: do NOT run further commands until the card is rendered in chat
|
|
9225
9274
|
6. After mutagent init, verify workspace: mutagent workspaces list --json
|
|
9226
9275
|
7. Use {single_braces} for template variables in prompts
|
|
9227
9276
|
8. Collect evaluation criteria from the user — NEVER auto-generate
|
|
9228
9277
|
9. ALL user interaction via AskUserQuestion — CLI is non-interactive
|
|
9229
9278
|
${!hasCredentials() ? `
|
|
9230
|
-
` +
|
|
9279
|
+
` + chalk35.yellow(" Warning: Not authenticated. Run: mutagent login") + `
|
|
9231
9280
|
` : ""}${!hasRcConfig() ? `
|
|
9232
|
-
` +
|
|
9281
|
+
` + chalk35.green(" Get started: mutagent init") + `
|
|
9233
9282
|
` : ""}`);
|
|
9234
9283
|
var rawArgs = process.argv.slice(2);
|
|
9235
9284
|
if (rawArgs.includes("-v") || rawArgs.includes("--version")) {
|
|
@@ -9270,5 +9319,5 @@ program.addCommand(createHooksCommand());
|
|
|
9270
9319
|
program.addCommand(createFeedbackCommand());
|
|
9271
9320
|
program.parse();
|
|
9272
9321
|
|
|
9273
|
-
//# debugId=
|
|
9322
|
+
//# debugId=F5EE29698365D55564756E2164756E21
|
|
9274
9323
|
//# sourceMappingURL=cli.js.map
|