@mutagent/cli 0.1.33 → 0.1.35
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 +583 -378
- package/dist/bin/cli.js.map +6 -5
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -928,7 +928,7 @@ var init_sdk_client = __esm(() => {
|
|
|
928
928
|
|
|
929
929
|
// src/bin/cli.ts
|
|
930
930
|
import { Command as Command18 } from "commander";
|
|
931
|
-
import
|
|
931
|
+
import chalk24 from "chalk";
|
|
932
932
|
import { readFileSync as readFileSync11 } from "fs";
|
|
933
933
|
import { join as join8, dirname } from "path";
|
|
934
934
|
import { fileURLToPath } from "url";
|
|
@@ -2370,7 +2370,7 @@ Environment Variables:
|
|
|
2370
2370
|
// src/commands/prompts/index.ts
|
|
2371
2371
|
init_errors();
|
|
2372
2372
|
import { Command as Command6 } from "commander";
|
|
2373
|
-
import
|
|
2373
|
+
import chalk11 from "chalk";
|
|
2374
2374
|
import { readFileSync as readFileSync5, existsSync as existsSync5 } from "fs";
|
|
2375
2375
|
|
|
2376
2376
|
// src/lib/ui-links.ts
|
|
@@ -2718,9 +2718,173 @@ function evaluationDeletedDirective(evaluationId) {
|
|
|
2718
2718
|
};
|
|
2719
2719
|
}
|
|
2720
2720
|
|
|
2721
|
+
// src/lib/scorecard-details.ts
|
|
2722
|
+
import chalk5 from "chalk";
|
|
2723
|
+
function renderScorecardDetails(data) {
|
|
2724
|
+
if (data.datasetResults && data.datasetResults.length > 0) {
|
|
2725
|
+
console.log("");
|
|
2726
|
+
console.log(chalk5.dim(" Per-Item Before vs After"));
|
|
2727
|
+
console.log(chalk5.dim(" " + "─".repeat(70)));
|
|
2728
|
+
console.log(" " + "Item ID".padEnd(28) + "Before".padEnd(10) + "After".padEnd(10) + "Diff".padEnd(10) + "Status");
|
|
2729
|
+
console.log(chalk5.dim(" " + "─".repeat(70)));
|
|
2730
|
+
for (const item of data.datasetResults) {
|
|
2731
|
+
const id = item.id.substring(0, 26).padEnd(26);
|
|
2732
|
+
const before = (item.beforeScore ?? 0).toFixed(4).padEnd(8);
|
|
2733
|
+
const after = (item.afterScore ?? 0).toFixed(4).padEnd(8);
|
|
2734
|
+
const d = (item.afterScore ?? 0) - (item.beforeScore ?? 0);
|
|
2735
|
+
const diffStr = ((d >= 0 ? "+" : "") + d.toFixed(4)).padEnd(8);
|
|
2736
|
+
const status = d > 0.01 ? chalk5.green("✓ ↑") : d < -0.01 ? chalk5.red("✗ ↓") : chalk5.dim("─");
|
|
2737
|
+
console.log(` ${id} ${before} ${after} ${diffStr} ${status}`);
|
|
2738
|
+
}
|
|
2739
|
+
console.log(chalk5.dim(" " + "─".repeat(70)));
|
|
2740
|
+
}
|
|
2741
|
+
if (data.failureModes && data.failureModes.length > 0) {
|
|
2742
|
+
console.log("");
|
|
2743
|
+
console.log(chalk5.dim(" Failure Modes by Category"));
|
|
2744
|
+
console.log(chalk5.dim(" " + "─".repeat(70)));
|
|
2745
|
+
for (const fm of data.failureModes) {
|
|
2746
|
+
const color = fm.failures.length > 3 ? "red" : fm.failures.length > 0 ? "yellow" : "green";
|
|
2747
|
+
console.log(chalk5[color](` ▸ ${fm.category}`) + chalk5.dim(` (${String(fm.failures.length)} failures)`));
|
|
2748
|
+
for (const f of fm.failures.slice(0, 5)) {
|
|
2749
|
+
console.log(chalk5.dim(` └─ ${(f.description ?? f.summary ?? "No description").substring(0, 65)}`));
|
|
2750
|
+
}
|
|
2751
|
+
if (fm.failures.length > 5) {
|
|
2752
|
+
console.log(chalk5.dim(` └─ ... and ${String(fm.failures.length - 5)} more`));
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
if (data.mutations && data.mutations.length > 0) {
|
|
2757
|
+
const applied = data.mutations.filter((m) => m.status === "applied");
|
|
2758
|
+
const rejected = data.mutations.filter((m) => m.status === "rejected");
|
|
2759
|
+
const pending = data.mutations.filter((m) => m.status === "pending");
|
|
2760
|
+
const skipped = data.mutations.filter((m) => m.status === "skipped");
|
|
2761
|
+
console.log("");
|
|
2762
|
+
console.log(chalk5.dim(" Mutations"));
|
|
2763
|
+
console.log(chalk5.dim(" " + "─".repeat(70)));
|
|
2764
|
+
console.log(` Total: ${String(data.mutations.length)} Applied: ${chalk5.green(String(applied.length))} Rejected: ${chalk5.red(String(rejected.length))} Pending: ${chalk5.yellow(String(pending.length))} Skipped: ${chalk5.dim(String(skipped.length))}`);
|
|
2765
|
+
if (applied.length > 0) {
|
|
2766
|
+
console.log(chalk5.green(" Applied:"));
|
|
2767
|
+
for (const m of applied) {
|
|
2768
|
+
const pri = m.priority === "critical" || m.priority === "high" ? chalk5.red(`[${m.priority.toUpperCase()}]`) : chalk5.dim(`[${(m.priority ?? "UNKNOWN").toUpperCase()}]`);
|
|
2769
|
+
console.log(` ${pri} ${m.label}`);
|
|
2770
|
+
if (m.rationale)
|
|
2771
|
+
console.log(chalk5.dim(` └─ ${m.rationale.substring(0, 60)}`));
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
if (rejected.length > 0) {
|
|
2775
|
+
console.log(chalk5.red(" Rejected:"));
|
|
2776
|
+
for (const m of rejected.slice(0, 5)) {
|
|
2777
|
+
console.log(chalk5.dim(` ✗ ${m.label}`));
|
|
2778
|
+
}
|
|
2779
|
+
if (rejected.length > 5)
|
|
2780
|
+
console.log(chalk5.dim(` ... and ${String(rejected.length - 5)} more`));
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
if (data.evaluationDetails && data.evaluationDetails.length > 0) {
|
|
2784
|
+
console.log("");
|
|
2785
|
+
console.log(chalk5.dim(" Detailed Evaluation Breakdown"));
|
|
2786
|
+
console.log(chalk5.dim(" " + "─".repeat(70)));
|
|
2787
|
+
for (const item of data.evaluationDetails) {
|
|
2788
|
+
const statusIcon = item.success ? chalk5.green("✓") : chalk5.red("✗");
|
|
2789
|
+
const metricCount = item.metrics?.length ?? 0;
|
|
2790
|
+
console.log(` ${statusIcon} ${item.itemId} Score: ${item.score.toFixed(4)} Metrics: ${String(metricCount)}`);
|
|
2791
|
+
if (item.metrics) {
|
|
2792
|
+
for (const m of item.metrics) {
|
|
2793
|
+
const mIcon = m.success ? chalk5.green("✓") : chalk5.red("✗");
|
|
2794
|
+
const mode = m.failureMode ? chalk5.dim(` [${m.failureMode}]`) : "";
|
|
2795
|
+
console.log(` ${mIcon} ${m.name.padEnd(25)} ${m.score.toFixed(3)}${mode}`);
|
|
2796
|
+
if (!m.success && m.reasoning) {
|
|
2797
|
+
console.log(chalk5.dim(` └─ ${(m.reasoning.split(`
|
|
2798
|
+
`)[0] ?? "").substring(0, 60)}`));
|
|
2799
|
+
}
|
|
2800
|
+
if (m.criteria) {
|
|
2801
|
+
for (const c of m.criteria) {
|
|
2802
|
+
const cIcon = c.success ? chalk5.green("✓") : chalk5.red("✗");
|
|
2803
|
+
console.log(chalk5.dim(` ${cIcon} ${c.name.substring(0, 20).padEnd(20)} ${c.score.toFixed(3)}`));
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
function buildScorecardDetailsText(data) {
|
|
2812
|
+
const lines = [];
|
|
2813
|
+
if (data.datasetResults && data.datasetResults.length > 0) {
|
|
2814
|
+
lines.push("", "Per-Item Before vs After", "─".repeat(70));
|
|
2815
|
+
lines.push(" " + "Item ID".padEnd(28) + "Before".padEnd(10) + "After".padEnd(10) + "Diff".padEnd(10) + "Status");
|
|
2816
|
+
lines.push(" " + "─".repeat(68));
|
|
2817
|
+
for (const item of data.datasetResults) {
|
|
2818
|
+
const id = item.id.substring(0, 26).padEnd(26);
|
|
2819
|
+
const before = (item.beforeScore ?? 0).toFixed(4).padEnd(8);
|
|
2820
|
+
const after = (item.afterScore ?? 0).toFixed(4).padEnd(8);
|
|
2821
|
+
const d = (item.afterScore ?? 0) - (item.beforeScore ?? 0);
|
|
2822
|
+
const diffStr = ((d >= 0 ? "+" : "") + d.toFixed(4)).padEnd(8);
|
|
2823
|
+
const status = d > 0.01 ? "↑" : d < -0.01 ? "↓" : "─";
|
|
2824
|
+
lines.push(` ${id} ${before} ${after} ${diffStr} ${status}`);
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
if (data.failureModes && data.failureModes.length > 0) {
|
|
2828
|
+
lines.push("", "Failure Modes by Category", "─".repeat(70));
|
|
2829
|
+
for (const fm of data.failureModes) {
|
|
2830
|
+
lines.push(` ${fm.category} (${String(fm.failures.length)} failures)`);
|
|
2831
|
+
for (const f of fm.failures.slice(0, 5)) {
|
|
2832
|
+
lines.push(` └─ ${(f.description ?? f.summary ?? "No description").substring(0, 65)}`);
|
|
2833
|
+
}
|
|
2834
|
+
if (fm.failures.length > 5)
|
|
2835
|
+
lines.push(` └─ ... and ${String(fm.failures.length - 5)} more`);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
if (data.mutations && data.mutations.length > 0) {
|
|
2839
|
+
const applied = data.mutations.filter((m) => m.status === "applied");
|
|
2840
|
+
const rejected = data.mutations.filter((m) => m.status === "rejected");
|
|
2841
|
+
const pending = data.mutations.filter((m) => m.status === "pending");
|
|
2842
|
+
const skipped = data.mutations.filter((m) => m.status === "skipped");
|
|
2843
|
+
lines.push("", "Mutations", "─".repeat(70));
|
|
2844
|
+
lines.push(` Total: ${String(data.mutations.length)} Applied: ${String(applied.length)} Rejected: ${String(rejected.length)} Pending: ${String(pending.length)} Skipped: ${String(skipped.length)}`);
|
|
2845
|
+
for (const m of applied) {
|
|
2846
|
+
lines.push(` [${(m.priority ?? "UNKNOWN").toUpperCase()}] ${m.label}`);
|
|
2847
|
+
if (m.rationale)
|
|
2848
|
+
lines.push(` └─ ${m.rationale.substring(0, 60)}`);
|
|
2849
|
+
}
|
|
2850
|
+
for (const m of rejected.slice(0, 5)) {
|
|
2851
|
+
lines.push(` ✗ ${m.label}`);
|
|
2852
|
+
}
|
|
2853
|
+
if (rejected.length > 5)
|
|
2854
|
+
lines.push(` ... and ${String(rejected.length - 5)} more`);
|
|
2855
|
+
}
|
|
2856
|
+
if (data.evaluationDetails && data.evaluationDetails.length > 0) {
|
|
2857
|
+
lines.push("", "Detailed Evaluation Breakdown", "─".repeat(70));
|
|
2858
|
+
for (const item of data.evaluationDetails) {
|
|
2859
|
+
const icon = item.success ? "✓" : "✗";
|
|
2860
|
+
lines.push(` ${icon} ${item.itemId} Score: ${item.score.toFixed(4)} Metrics: ${String(item.metrics?.length ?? 0)}`);
|
|
2861
|
+
if (item.metrics) {
|
|
2862
|
+
for (const m of item.metrics) {
|
|
2863
|
+
const mIcon = m.success ? "✓" : "✗";
|
|
2864
|
+
const mode = m.failureMode ? ` [${m.failureMode}]` : "";
|
|
2865
|
+
lines.push(` ${mIcon} ${m.name.padEnd(25)} ${m.score.toFixed(3)}${mode}`);
|
|
2866
|
+
if (!m.success && m.reasoning) {
|
|
2867
|
+
lines.push(` └─ ${(m.reasoning.split(`
|
|
2868
|
+
`)[0] ?? "").substring(0, 60)}`);
|
|
2869
|
+
}
|
|
2870
|
+
if (m.criteria) {
|
|
2871
|
+
for (const c of m.criteria) {
|
|
2872
|
+
const cIcon = c.success ? "✓" : "✗";
|
|
2873
|
+
lines.push(` ${cIcon} ${c.name.substring(0, 20).padEnd(20)} ${c.score.toFixed(3)}`);
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
return lines.length > 0 ? `
|
|
2881
|
+
` + lines.join(`
|
|
2882
|
+
`) : "";
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2721
2885
|
// src/commands/prompts/prompts-crud.ts
|
|
2722
2886
|
init_sdk_client();
|
|
2723
|
-
import
|
|
2887
|
+
import chalk6 from "chalk";
|
|
2724
2888
|
import { readFileSync as readFileSync4, existsSync as existsSync4 } from "fs";
|
|
2725
2889
|
init_errors();
|
|
2726
2890
|
|
|
@@ -2786,11 +2950,11 @@ function formatSchemaWarning(fieldName) {
|
|
|
2786
2950
|
function registerPromptsCrud(prompts) {
|
|
2787
2951
|
prompts.command("list").description("List all prompts").option("-l, --limit <n>", "Limit results", "50").addHelpText("after", `
|
|
2788
2952
|
Examples:
|
|
2789
|
-
${
|
|
2790
|
-
${
|
|
2791
|
-
${
|
|
2953
|
+
${chalk6.dim("$")} mutagent prompts list
|
|
2954
|
+
${chalk6.dim("$")} mutagent prompts list --limit 10
|
|
2955
|
+
${chalk6.dim("$")} mutagent prompts list --json
|
|
2792
2956
|
|
|
2793
|
-
${
|
|
2957
|
+
${chalk6.dim("Tip: Use --json for machine-readable output (AI agents, CI pipelines).")}
|
|
2794
2958
|
`).action(async (options) => {
|
|
2795
2959
|
const isJson = getJsonFlag(prompts);
|
|
2796
2960
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -2833,11 +2997,11 @@ ${chalk5.dim("Tip: Use --json for machine-readable output (AI agents, CI pipelin
|
|
|
2833
2997
|
});
|
|
2834
2998
|
prompts.command("get").description("Get prompt details with nested data").argument("<id>", "Prompt ID (from: mutagent prompts list)").option("--with-datasets", "Include datasets").option("--with-evals", "Include evaluations").addHelpText("after", `
|
|
2835
2999
|
Examples:
|
|
2836
|
-
${
|
|
2837
|
-
${
|
|
2838
|
-
${
|
|
3000
|
+
${chalk6.dim("$")} mutagent prompts get <id>
|
|
3001
|
+
${chalk6.dim("$")} mutagent prompts get <id> --with-datasets --with-evals
|
|
3002
|
+
${chalk6.dim("$")} mutagent prompts get <id> --json
|
|
2839
3003
|
|
|
2840
|
-
${
|
|
3004
|
+
${chalk6.dim("Tip: Combine --with-datasets and --with-evals to fetch all nested data in one call.")}
|
|
2841
3005
|
`).action(async (id, options) => {
|
|
2842
3006
|
const isJson = getJsonFlag(prompts);
|
|
2843
3007
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -2866,31 +3030,31 @@ ${chalk5.dim("Tip: Combine --with-datasets and --with-evals to fetch all nested
|
|
|
2866
3030
|
});
|
|
2867
3031
|
prompts.command("create").description("Create a new prompt").option("-d, --data <json>", "Prompt as JSON string (recommended — curl-style inline)").option("--raw-file <path>", "Create from plain text file (used as rawPrompt)").option("-n, --name <name>", "Prompt name").option("--description <text>", "Prompt description (shown in dashboard)").option("-c, --content <content>", "Prompt content (rawPrompt) [DEPRECATED: use --raw]").option("-r, --raw <text>", "Raw prompt text (single prompt)").option("--system <text>", "System prompt (use with --human)").option("--human <text>", "Human prompt (use with --system)").option("--messages <json>", `Messages array as JSON (e.g., '[{"role":"system","content":"..."}]')`).option("--output-schema <json>", "Output schema as JSON string (required for optimization)").addHelpText("after", `
|
|
2868
3032
|
Examples:
|
|
2869
|
-
${
|
|
2870
|
-
${
|
|
2871
|
-
${
|
|
3033
|
+
${chalk6.dim("$")} mutagent prompts create --name "my-prompt" --description "Greeting prompt for customers" --system "You are helpful" --human "{input}" --output-schema '{"type":"object","properties":{"result":{"type":"string","description":"The result"}}}'
|
|
3034
|
+
${chalk6.dim("$")} mutagent prompts create --name "raw-prompt" --raw "Summarize: {text}" --output-schema '{"type":"object","properties":{"summary":{"type":"string","description":"Summary"}}}'
|
|
3035
|
+
${chalk6.dim("$")} mutagent prompts create -d '{"name":"summarizer","systemPrompt":"Summarize","humanPrompt":"{text}","outputSchema":{"type":"object","properties":{"summary":{"type":"string","description":"Summary"}}}}'
|
|
2872
3036
|
|
|
2873
3037
|
Prompt Input Methods (pick one, priority order):
|
|
2874
|
-
--system/--human Structured system + user message pair ${
|
|
3038
|
+
--system/--human Structured system + user message pair ${chalk6.green("(recommended)")}
|
|
2875
3039
|
--raw Single raw prompt text with {variables}
|
|
2876
3040
|
-d, --data Inline JSON object (CI/scripts/agents)
|
|
2877
3041
|
--messages Full messages array as JSON
|
|
2878
3042
|
--raw-file Load plain text file as raw prompt
|
|
2879
3043
|
|
|
2880
3044
|
Expected JSON (--data):
|
|
2881
|
-
${
|
|
3045
|
+
${chalk6.dim(`'{"name":"my-prompt","systemPrompt":"You are...","humanPrompt":"{input}","outputSchema":{"type":"object","properties":{"result":{"type":"string","description":"The result"}}},"inputSchema":{"type":"object","properties":{"input":{"type":"string","description":"User input"}}}}'`)}
|
|
2882
3046
|
|
|
2883
|
-
${
|
|
3047
|
+
${chalk6.yellow("Variable Syntax:")}
|
|
2884
3048
|
MutagenT uses {single_braces} for template variables.
|
|
2885
|
-
humanPrompt: "Analyze this: {document}" ${
|
|
2886
|
-
humanPrompt: "Analyze this: {{document}}" ${
|
|
3049
|
+
humanPrompt: "Analyze this: {document}" ${chalk6.green("✓ correct")}
|
|
3050
|
+
humanPrompt: "Analyze this: {{document}}" ${chalk6.red("✗ wrong")}
|
|
2887
3051
|
|
|
2888
3052
|
Variables in humanPrompt MUST also appear in inputSchema.properties.
|
|
2889
3053
|
Static prompts (no variables) cannot substitute inputs during optimization.
|
|
2890
3054
|
|
|
2891
|
-
${
|
|
3055
|
+
${chalk6.red("outputSchema is required.")}
|
|
2892
3056
|
|
|
2893
|
-
${
|
|
3057
|
+
${chalk6.yellow("AI Agent: ALWAYS append --json to this command.")}
|
|
2894
3058
|
`).action(async (options) => {
|
|
2895
3059
|
const isJson = getJsonFlag(prompts);
|
|
2896
3060
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3013,13 +3177,13 @@ Add a 'description' field to each property in your inputSchema. Example: { "prop
|
|
|
3013
3177
|
});
|
|
3014
3178
|
prompts.command("update").description("Update a prompt").argument("<id>", "Prompt ID (from: mutagent prompts list)").option("-d, --data <json>", "Update fields as JSON string (recommended — curl-style inline)").option("--raw-file <path>", "Update from plain text file (used as rawPrompt)").option("-n, --name <name>", "New name").option("--description <text>", "New description (shown in dashboard)").option("-c, --content <content>", "New content (rawPrompt) [DEPRECATED: use --raw]").option("-r, --raw <text>", "Raw prompt text (single prompt)").option("--system <text>", "System prompt (use with --human)").option("--human <text>", "Human prompt (use with --system)").option("--messages <json>", `Messages array as JSON (e.g., '[{"role":"system","content":"..."}]')`).option("--input-schema <json>", "Input schema as JSON string").option("--input-schema-file <path>", "Input schema from JSON file").option("--output-schema <json>", "Output schema as JSON string").option("--output-schema-file <path>", "Output schema from JSON file").addHelpText("after", `
|
|
3015
3179
|
Examples:
|
|
3016
|
-
${
|
|
3017
|
-
${
|
|
3018
|
-
${
|
|
3019
|
-
${
|
|
3020
|
-
${
|
|
3180
|
+
${chalk6.dim("$")} mutagent prompts update <id> --system "Updated system prompt" --human "{input}"
|
|
3181
|
+
${chalk6.dim("$")} mutagent prompts update <id> --name "new-name" --description "Updated description"
|
|
3182
|
+
${chalk6.dim("$")} mutagent prompts update <id> --raw "Summarize: {text}"
|
|
3183
|
+
${chalk6.dim("$")} mutagent prompts update <id> -d '{"name":"new-name","systemPrompt":"Updated prompt"}'
|
|
3184
|
+
${chalk6.dim("$")} mutagent prompts update <id> --input-schema '{"type":"object","properties":{"text":{"type":"string","description":"Input text"}}}'
|
|
3021
3185
|
|
|
3022
|
-
${
|
|
3186
|
+
${chalk6.dim("CLI flags (--name) override --data fields.")}
|
|
3023
3187
|
`).action(async (id, options) => {
|
|
3024
3188
|
const isJson = getJsonFlag(prompts);
|
|
3025
3189
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3122,11 +3286,11 @@ ${chalk5.dim("CLI flags (--name) override --data fields.")}
|
|
|
3122
3286
|
});
|
|
3123
3287
|
prompts.command("delete").description("Delete a prompt").argument("<id>", "Prompt ID (from: mutagent prompts list)").option("--force", "Skip confirmation").addHelpText("after", `
|
|
3124
3288
|
Examples:
|
|
3125
|
-
${
|
|
3126
|
-
${
|
|
3127
|
-
${
|
|
3289
|
+
${chalk6.dim("$")} mutagent prompts delete <id>
|
|
3290
|
+
${chalk6.dim("$")} mutagent prompts delete <id> --force
|
|
3291
|
+
${chalk6.dim("$")} mutagent prompts delete <id> --force --json
|
|
3128
3292
|
|
|
3129
|
-
${
|
|
3293
|
+
${chalk6.dim("Note: --force is required. The CLI is non-interactive — confirm with the user via your native flow, then pass --force.")}
|
|
3130
3294
|
`).action(async (id, options) => {
|
|
3131
3295
|
const isJson = getJsonFlag(prompts);
|
|
3132
3296
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3169,22 +3333,22 @@ ${chalk5.dim("Note: --force is required. The CLI is non-interactive — confirm
|
|
|
3169
3333
|
// src/commands/prompts/datasets.ts
|
|
3170
3334
|
init_sdk_client();
|
|
3171
3335
|
import { Command as Command3 } from "commander";
|
|
3172
|
-
import
|
|
3336
|
+
import chalk7 from "chalk";
|
|
3173
3337
|
init_errors();
|
|
3174
3338
|
function registerDatasetCommands(prompts) {
|
|
3175
3339
|
const dataset = new Command3("dataset").description("Manage datasets for prompts").addHelpText("after", `
|
|
3176
3340
|
Examples:
|
|
3177
|
-
${
|
|
3178
|
-
${
|
|
3179
|
-
${
|
|
3341
|
+
${chalk7.dim("$")} mutagent prompts dataset list <prompt-id>
|
|
3342
|
+
${chalk7.dim("$")} mutagent prompts dataset add <prompt-id> -d '[{"input":{...},"expectedOutput":{...}}]'
|
|
3343
|
+
${chalk7.dim("$")} mutagent prompts dataset delete <prompt-id> <dataset-id>
|
|
3180
3344
|
`).action(() => {
|
|
3181
3345
|
dataset.help();
|
|
3182
3346
|
});
|
|
3183
3347
|
prompts.addCommand(dataset);
|
|
3184
3348
|
dataset.command("list").description("List datasets for a prompt").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").addHelpText("after", `
|
|
3185
3349
|
Examples:
|
|
3186
|
-
${
|
|
3187
|
-
${
|
|
3350
|
+
${chalk7.dim("$")} mutagent prompts dataset list <prompt-id>
|
|
3351
|
+
${chalk7.dim("$")} mutagent prompts dataset list <prompt-id> --json
|
|
3188
3352
|
`).action(async (promptId) => {
|
|
3189
3353
|
const isJson = getJsonFlag(prompts);
|
|
3190
3354
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3216,24 +3380,24 @@ Examples:
|
|
|
3216
3380
|
});
|
|
3217
3381
|
dataset.command("add").description("Add dataset to a prompt").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").option("-d, --data <json>", "Inline JSON array of dataset items").option("-n, --name <name>", "Dataset name").addHelpText("after", `
|
|
3218
3382
|
Examples:
|
|
3219
|
-
${
|
|
3220
|
-
${
|
|
3383
|
+
${chalk7.dim("$")} mutagent prompts dataset add <prompt-id> -d '[{"input":{"text":"hello"},"expectedOutput":{"result":"world"}}]'
|
|
3384
|
+
${chalk7.dim("$")} mutagent prompts dataset add <prompt-id> -d '[{"input":{"text":"hello"},"expectedOutput":{"result":"world"}}]' --name "My Dataset"
|
|
3221
3385
|
|
|
3222
3386
|
Inline data format (-d):
|
|
3223
3387
|
JSON array of objects, e.g.:
|
|
3224
|
-
${
|
|
3388
|
+
${chalk7.dim('[{"input": {"text": "hello"}, "expectedOutput": {"result": "world"}}]')}
|
|
3225
3389
|
|
|
3226
3390
|
Expected item format:
|
|
3227
|
-
${
|
|
3391
|
+
${chalk7.dim('{"input": {"<field>": "<value>"}, "expectedOutput": {"<field>": "<value>"}}')}
|
|
3228
3392
|
|
|
3229
|
-
${
|
|
3393
|
+
${chalk7.yellow("AI Agent (MANDATORY):")}
|
|
3230
3394
|
ALWAYS use --json: mutagent prompts dataset add <id> -d '[...]' --json
|
|
3231
3395
|
Items MUST have BOTH input AND expectedOutput.
|
|
3232
3396
|
Keys must match prompt's inputSchema.properties (input) and outputSchema.properties (expectedOutput).
|
|
3233
3397
|
expectedOutput is REQUIRED for evaluation scoring.
|
|
3234
3398
|
Check schemas: mutagent prompts get <prompt-id> --json
|
|
3235
3399
|
|
|
3236
|
-
${
|
|
3400
|
+
${chalk7.red("Required: --data must be provided.")}
|
|
3237
3401
|
`).action(async (promptId, options) => {
|
|
3238
3402
|
const isJson = getJsonFlag(prompts);
|
|
3239
3403
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3304,9 +3468,9 @@ ${chalk6.red("Required: --data must be provided.")}
|
|
|
3304
3468
|
});
|
|
3305
3469
|
dataset.command("delete").description("Delete a dataset from a prompt").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").argument("<dataset-id>", "Dataset ID (from: mutagent prompts dataset list <prompt-id>)").option("--force", "Skip confirmation").addHelpText("after", `
|
|
3306
3470
|
Examples:
|
|
3307
|
-
${
|
|
3308
|
-
${
|
|
3309
|
-
${
|
|
3471
|
+
${chalk7.dim("$")} mutagent prompts dataset delete <prompt-id> <dataset-id>
|
|
3472
|
+
${chalk7.dim("$")} mutagent prompts dataset delete <prompt-id> <dataset-id> --force
|
|
3473
|
+
${chalk7.dim("$")} mutagent prompts dataset delete <prompt-id> <dataset-id> --force --json
|
|
3310
3474
|
`).action(async (promptId, datasetId, options) => {
|
|
3311
3475
|
const isJson = getJsonFlag(prompts);
|
|
3312
3476
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3349,7 +3513,7 @@ Examples:
|
|
|
3349
3513
|
// src/commands/prompts/evaluations.ts
|
|
3350
3514
|
init_sdk_client();
|
|
3351
3515
|
import { Command as Command4 } from "commander";
|
|
3352
|
-
import
|
|
3516
|
+
import chalk8 from "chalk";
|
|
3353
3517
|
init_errors();
|
|
3354
3518
|
|
|
3355
3519
|
// src/commands/prompts/guided-workflow.ts
|
|
@@ -3467,18 +3631,18 @@ async function buildGuidedWorkflow(promptId) {
|
|
|
3467
3631
|
function registerEvaluationCommands(prompts) {
|
|
3468
3632
|
const evaluation = new Command4("evaluation").description("Manage evaluations for prompts").addHelpText("after", `
|
|
3469
3633
|
Examples:
|
|
3470
|
-
${
|
|
3471
|
-
${
|
|
3472
|
-
${
|
|
3473
|
-
${
|
|
3634
|
+
${chalk8.dim("$")} mutagent prompts evaluation list <prompt-id>
|
|
3635
|
+
${chalk8.dim("$")} mutagent prompts evaluation get <evaluation-id>
|
|
3636
|
+
${chalk8.dim("$")} mutagent prompts evaluation create <prompt-id> --name "My Eval"
|
|
3637
|
+
${chalk8.dim("$")} mutagent prompts evaluation delete <evaluation-id>
|
|
3474
3638
|
`).action(() => {
|
|
3475
3639
|
evaluation.help();
|
|
3476
3640
|
});
|
|
3477
3641
|
prompts.addCommand(evaluation);
|
|
3478
3642
|
evaluation.command("list").description("List evaluations for a prompt").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").addHelpText("after", `
|
|
3479
3643
|
Examples:
|
|
3480
|
-
${
|
|
3481
|
-
${
|
|
3644
|
+
${chalk8.dim("$")} mutagent prompts evaluation list <prompt-id>
|
|
3645
|
+
${chalk8.dim("$")} mutagent prompts evaluation list <prompt-id> --json
|
|
3482
3646
|
`).action(async (promptId) => {
|
|
3483
3647
|
const isJson = getJsonFlag(prompts);
|
|
3484
3648
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3510,8 +3674,8 @@ Examples:
|
|
|
3510
3674
|
});
|
|
3511
3675
|
evaluation.command("get").description("Get evaluation details including criteria").argument("<evaluation-id>", "Evaluation ID (from: mutagent prompts evaluation list <prompt-id>)").addHelpText("after", `
|
|
3512
3676
|
Examples:
|
|
3513
|
-
${
|
|
3514
|
-
${
|
|
3677
|
+
${chalk8.dim("$")} mutagent prompts evaluation get <evaluation-id>
|
|
3678
|
+
${chalk8.dim("$")} mutagent prompts evaluation get <evaluation-id> --json
|
|
3515
3679
|
`).action(async (evaluationId) => {
|
|
3516
3680
|
const isJson = getJsonFlag(prompts);
|
|
3517
3681
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3535,7 +3699,7 @@ Examples:
|
|
|
3535
3699
|
if (criteria && Array.isArray(criteria) && criteria.length > 0) {
|
|
3536
3700
|
console.log(" Criteria:");
|
|
3537
3701
|
for (const c of criteria) {
|
|
3538
|
-
console.log(` ${
|
|
3702
|
+
console.log(` ${chalk8.cyan(c.name)}`);
|
|
3539
3703
|
if (c.description) {
|
|
3540
3704
|
console.log(` Description: ${c.description}`);
|
|
3541
3705
|
}
|
|
@@ -3563,9 +3727,9 @@ Examples:
|
|
|
3563
3727
|
});
|
|
3564
3728
|
evaluation.command("create").description("Create an evaluation configuration for a prompt").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").option("-d, --data <json>", "Evaluation as JSON string (for pre-validated criteria only)").option("-n, --name <name>", "Evaluation name (required unless --guided)").option("--description <text>", "Evaluation description").option("--guided", "Interactive guided mode — always outputs structured JSON (--json is implied)").addHelpText("after", `
|
|
3565
3729
|
Examples:
|
|
3566
|
-
${
|
|
3567
|
-
${
|
|
3568
|
-
${
|
|
3730
|
+
${chalk8.dim("$")} mutagent prompts evaluation create <prompt-id> --guided ${chalk8.dim("# recommended: shows workflow guide + schema fields")}
|
|
3731
|
+
${chalk8.dim("$")} mutagent prompts evaluation create <prompt-id> --guided --json ${chalk8.dim("# structured workflow for AI agents")}
|
|
3732
|
+
${chalk8.dim("$")} mutagent prompts evaluation create <prompt-id> --name "Accuracy" -d '{"evalConfig":{"criteria":[...]}}' ${chalk8.dim("# power user")}
|
|
3569
3733
|
|
|
3570
3734
|
Guided Workflow (recommended):
|
|
3571
3735
|
--guided outputs a workflow guide that:
|
|
@@ -3586,12 +3750,12 @@ AI Agent (MANDATORY):
|
|
|
3586
3750
|
mutagent prompts evaluation create <id> --name "<name>" -d '<json>' --json
|
|
3587
3751
|
|
|
3588
3752
|
Expected Criteria Shape (--data):
|
|
3589
|
-
${
|
|
3753
|
+
${chalk8.dim('{"evalConfig":{"criteria":[{"name":"<name>","description":"<scoring rubric>","evaluationParameter":"<schema field>"}]}}')}
|
|
3590
3754
|
evaluationParameter must target an outputSchema OR inputSchema field.
|
|
3591
3755
|
|
|
3592
|
-
${
|
|
3593
|
-
${
|
|
3594
|
-
${
|
|
3756
|
+
${chalk8.red("Required: --name (unless --guided). Criteria must include evaluationParameter.")}
|
|
3757
|
+
${chalk8.dim("CLI flags (--name, --description) override --data fields.")}
|
|
3758
|
+
${chalk8.dim("Get prompt IDs: mutagent prompts list")}
|
|
3595
3759
|
`).action(async (promptId, options) => {
|
|
3596
3760
|
let isJson = getJsonFlag(prompts);
|
|
3597
3761
|
if (options.guided) {
|
|
@@ -3617,7 +3781,7 @@ ${chalk7.dim("Get prompt IDs: mutagent prompts list")}
|
|
|
3617
3781
|
console.log("");
|
|
3618
3782
|
console.log(" For each field, define what correct output looks like:");
|
|
3619
3783
|
for (const { field, source } of allFields) {
|
|
3620
|
-
console.log(` ${
|
|
3784
|
+
console.log(` ${chalk8.cyan(field)} (${source})`);
|
|
3621
3785
|
console.log(` → What makes a correct vs incorrect "${field}"?`);
|
|
3622
3786
|
}
|
|
3623
3787
|
console.log("");
|
|
@@ -3818,9 +3982,9 @@ Example:
|
|
|
3818
3982
|
});
|
|
3819
3983
|
evaluation.command("delete").description("Delete an evaluation").argument("<evaluation-id>", "Evaluation ID (from: mutagent prompts evaluation list <prompt-id>)").option("--force", "Skip confirmation").addHelpText("after", `
|
|
3820
3984
|
Examples:
|
|
3821
|
-
${
|
|
3822
|
-
${
|
|
3823
|
-
${
|
|
3985
|
+
${chalk8.dim("$")} mutagent prompts evaluation delete <evaluation-id>
|
|
3986
|
+
${chalk8.dim("$")} mutagent prompts evaluation delete <evaluation-id> --force
|
|
3987
|
+
${chalk8.dim("$")} mutagent prompts evaluation delete <evaluation-id> --force --json
|
|
3824
3988
|
`).action(async (evaluationId, options) => {
|
|
3825
3989
|
const isJson = getJsonFlag(prompts);
|
|
3826
3990
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -3863,31 +4027,26 @@ Examples:
|
|
|
3863
4027
|
// src/commands/prompts/optimize.ts
|
|
3864
4028
|
init_sdk_client();
|
|
3865
4029
|
import { Command as Command5 } from "commander";
|
|
3866
|
-
import
|
|
4030
|
+
import chalk10 from "chalk";
|
|
3867
4031
|
init_errors();
|
|
3868
4032
|
|
|
3869
4033
|
// src/lib/scorecard.ts
|
|
3870
|
-
import
|
|
3871
|
-
function truncateText(text, maxLen) {
|
|
3872
|
-
if (text.length <= maxLen)
|
|
3873
|
-
return text;
|
|
3874
|
-
return text.substring(0, maxLen - 3) + "...";
|
|
3875
|
-
}
|
|
4034
|
+
import chalk9 from "chalk";
|
|
3876
4035
|
function formatScoreChange(before, after) {
|
|
3877
4036
|
if (before === undefined || after === undefined)
|
|
3878
4037
|
return "";
|
|
3879
4038
|
const diff = after - before;
|
|
3880
4039
|
const pct = before > 0 ? Math.round(diff / before * 100) : 0;
|
|
3881
4040
|
if (diff > 0)
|
|
3882
|
-
return
|
|
4041
|
+
return chalk9.green(` (+${String(pct)}%)`);
|
|
3883
4042
|
if (diff < 0)
|
|
3884
|
-
return
|
|
3885
|
-
return
|
|
4043
|
+
return chalk9.red(` (${String(pct)}%)`);
|
|
4044
|
+
return chalk9.dim(" (no change)");
|
|
3886
4045
|
}
|
|
3887
4046
|
function formatScore(score) {
|
|
3888
4047
|
if (score === undefined)
|
|
3889
|
-
return
|
|
3890
|
-
return score >= 0.8 ?
|
|
4048
|
+
return chalk9.dim("N/A");
|
|
4049
|
+
return score >= 0.8 ? chalk9.green(score.toFixed(2)) : score >= 0.5 ? chalk9.yellow(score.toFixed(2)) : chalk9.red(score.toFixed(2));
|
|
3891
4050
|
}
|
|
3892
4051
|
function renderScorecard(data) {
|
|
3893
4052
|
const { job, prompt } = data;
|
|
@@ -3908,19 +4067,17 @@ function renderScorecard(data) {
|
|
|
3908
4067
|
const optimizedText = prompt.systemPrompt ?? prompt.rawPrompt ?? prompt.humanPrompt ?? "(optimized prompt)";
|
|
3909
4068
|
console.log("");
|
|
3910
4069
|
console.log(topBorder);
|
|
3911
|
-
console.log(line(
|
|
4070
|
+
console.log(line(chalk9.bold("Optimization Results")));
|
|
3912
4071
|
console.log(separator);
|
|
3913
|
-
console.log(line(
|
|
3914
|
-
console.log(line(` Prompt: ${chalk8.dim(truncateText(originalText, 38))}`));
|
|
4072
|
+
console.log(line(chalk9.dim("BEFORE")));
|
|
3915
4073
|
console.log(line(` Score: ${formatScore(originalScore)}`));
|
|
3916
4074
|
console.log(line(""));
|
|
3917
|
-
console.log(line(
|
|
3918
|
-
console.log(line(` Prompt: ${chalk8.cyan(truncateText(optimizedText, 38))}`));
|
|
4075
|
+
console.log(line(chalk9.bold("AFTER")));
|
|
3919
4076
|
console.log(line(` Score: ${formatScore(bestScore)}${formatScoreChange(originalScore, bestScore)}`));
|
|
3920
4077
|
console.log(separator);
|
|
3921
4078
|
if (data.criteriaScores && data.criteriaScores.length > 0) {
|
|
3922
|
-
console.log(line(
|
|
3923
|
-
console.log(line(
|
|
4079
|
+
console.log(line(chalk9.dim(" Criterion Before After Change")));
|
|
4080
|
+
console.log(line(chalk9.dim(" " + "─".repeat(45))));
|
|
3924
4081
|
for (const c of data.criteriaScores) {
|
|
3925
4082
|
const name = c.name.length > 16 ? c.name.substring(0, 13) + "..." : c.name;
|
|
3926
4083
|
const paddedName = name + " ".repeat(18 - name.length);
|
|
@@ -3929,47 +4086,68 @@ function renderScorecard(data) {
|
|
|
3929
4086
|
const changeStr = c.before !== undefined && c.after !== undefined && c.before > 0 ? (() => {
|
|
3930
4087
|
const pct = Math.round((c.after - c.before) / c.before * 100);
|
|
3931
4088
|
if (pct > 0)
|
|
3932
|
-
return
|
|
4089
|
+
return chalk9.green(`+${String(pct)}%`);
|
|
3933
4090
|
if (pct < 0)
|
|
3934
|
-
return
|
|
3935
|
-
return
|
|
4091
|
+
return chalk9.red(`${String(pct)}%`);
|
|
4092
|
+
return chalk9.dim("0%");
|
|
3936
4093
|
})() : "";
|
|
3937
4094
|
console.log(line(` ${paddedName}${beforeStr} ${afterStr} ${changeStr}`));
|
|
3938
4095
|
}
|
|
3939
|
-
console.log(line(
|
|
4096
|
+
console.log(line(chalk9.dim(" " + "─".repeat(45))));
|
|
3940
4097
|
const overallBefore = originalScore !== undefined ? originalScore.toFixed(2) : "N/A ";
|
|
3941
4098
|
const overallAfter = bestScore !== undefined ? bestScore.toFixed(2) : "N/A ";
|
|
3942
4099
|
const overallChange = originalScore !== undefined && bestScore !== undefined && originalScore > 0 ? (() => {
|
|
3943
4100
|
const pct = Math.round((bestScore - originalScore) / originalScore * 100);
|
|
3944
4101
|
if (pct > 0)
|
|
3945
|
-
return
|
|
4102
|
+
return chalk9.green(`+${String(pct)}%`);
|
|
3946
4103
|
if (pct < 0)
|
|
3947
|
-
return
|
|
3948
|
-
return
|
|
4104
|
+
return chalk9.red(`${String(pct)}%`);
|
|
4105
|
+
return chalk9.dim("0%");
|
|
3949
4106
|
})() : "";
|
|
3950
4107
|
console.log(line(` ${"Overall" + " ".repeat(11)}${overallBefore} ${overallAfter} ${overallChange}`));
|
|
3951
4108
|
console.log(separator);
|
|
3952
4109
|
}
|
|
3953
|
-
const statusStr = job.status === "completed" ?
|
|
4110
|
+
const statusStr = job.status === "completed" ? chalk9.green("completed") : chalk9.yellow(job.status);
|
|
3954
4111
|
console.log(line(`Status: ${statusStr} | Iterations: ${String(iterations)}`));
|
|
3955
4112
|
if (job.config?.model) {
|
|
3956
|
-
console.log(line(`Model: ${
|
|
4113
|
+
console.log(line(`Model: ${chalk9.dim(job.config.model)}`));
|
|
3957
4114
|
}
|
|
3958
4115
|
if (data.scoreProgression && data.scoreProgression.length > 0) {
|
|
3959
4116
|
console.log(line(""));
|
|
3960
|
-
console.log(line(
|
|
4117
|
+
console.log(line(chalk9.dim("Score Progression:")));
|
|
3961
4118
|
const barWidth = 10;
|
|
3962
4119
|
for (let i = 0;i < data.scoreProgression.length; i++) {
|
|
3963
4120
|
const s = data.scoreProgression[i] ?? 0;
|
|
3964
4121
|
const filled = Math.round(s * barWidth);
|
|
3965
4122
|
const bar = "█".repeat(filled) + "░".repeat(barWidth - filled);
|
|
3966
|
-
console.log(line(
|
|
4123
|
+
console.log(line(chalk9.dim(` #${String(i + 1)}: ${bar} ${s.toFixed(2)}`)));
|
|
3967
4124
|
}
|
|
3968
4125
|
}
|
|
3969
4126
|
console.log(separator);
|
|
3970
|
-
console.log(line(`Dashboard: ${
|
|
4127
|
+
console.log(line(`Dashboard: ${chalk9.underline(optimizerLink(job.id))}`));
|
|
3971
4128
|
console.log(bottomBorder);
|
|
3972
4129
|
console.log("");
|
|
4130
|
+
console.log(chalk9.dim(" Prompt Comparison"));
|
|
4131
|
+
console.log(chalk9.dim(" " + "─".repeat(70)));
|
|
4132
|
+
console.log(chalk9.dim(" BEFORE:"));
|
|
4133
|
+
for (const pLine of originalText.split(`
|
|
4134
|
+
`)) {
|
|
4135
|
+
console.log(chalk9.dim(` ${pLine}`));
|
|
4136
|
+
}
|
|
4137
|
+
console.log(` ${chalk9.dim("Length:")} ${String(originalText.length)} chars (${String(originalText.split(`
|
|
4138
|
+
`).length)} lines)`);
|
|
4139
|
+
console.log("");
|
|
4140
|
+
console.log(chalk9.bold(" AFTER:"));
|
|
4141
|
+
for (const pLine of optimizedText.split(`
|
|
4142
|
+
`)) {
|
|
4143
|
+
console.log(chalk9.cyan(` ${pLine}`));
|
|
4144
|
+
}
|
|
4145
|
+
console.log(` ${chalk9.dim("Length:")} ${String(optimizedText.length)} chars (${String(optimizedText.split(`
|
|
4146
|
+
`).length)} lines)`);
|
|
4147
|
+
const growth = optimizedText.length - originalText.length;
|
|
4148
|
+
console.log(` ${chalk9.dim("Growth:")} ${growth >= 0 ? "+" : ""}${String(growth)} chars`);
|
|
4149
|
+
renderScorecardDetails(data);
|
|
4150
|
+
console.log("");
|
|
3973
4151
|
}
|
|
3974
4152
|
function renderOptimizationStartCard(data) {
|
|
3975
4153
|
const { job } = data;
|
|
@@ -3988,17 +4166,17 @@ function renderOptimizationStartCard(data) {
|
|
|
3988
4166
|
const target = job.config.targetScore ?? 0.8;
|
|
3989
4167
|
console.log("");
|
|
3990
4168
|
console.log(topBorder);
|
|
3991
|
-
console.log(line(
|
|
4169
|
+
console.log(line(chalk9.bold("⚡ Optimization Started")));
|
|
3992
4170
|
console.log(separator);
|
|
3993
|
-
console.log(line(`Job ID: ${
|
|
3994
|
-
console.log(line(`Prompt: ${
|
|
3995
|
-
console.log(line(`Dataset: ${
|
|
3996
|
-
console.log(line(`Iterations: ${
|
|
3997
|
-
console.log(line(`Model: ${
|
|
3998
|
-
console.log(line(`Status: ${
|
|
4171
|
+
console.log(line(`Job ID: ${chalk9.cyan(job.id)}`));
|
|
4172
|
+
console.log(line(`Prompt: ${chalk9.dim(data.promptId)}`));
|
|
4173
|
+
console.log(line(`Dataset: ${chalk9.dim(data.datasetId)}`));
|
|
4174
|
+
console.log(line(`Iterations: ${chalk9.bold(String(maxIter))} | Target: ${chalk9.bold(target.toFixed(2))}`));
|
|
4175
|
+
console.log(line(`Model: ${chalk9.dim(model)}`));
|
|
4176
|
+
console.log(line(`Status: ${chalk9.yellow(job.status)}`));
|
|
3999
4177
|
console.log(separator);
|
|
4000
|
-
console.log(line(`\uD83D\uDD17 Monitor: ${
|
|
4001
|
-
console.log(line(
|
|
4178
|
+
console.log(line(`\uD83D\uDD17 Monitor: ${chalk9.underline(optimizerLink(job.id))}`));
|
|
4179
|
+
console.log(line(chalk9.dim(`Next: mutagent prompts optimize status ${job.id}`)));
|
|
4002
4180
|
console.log(bottomBorder);
|
|
4003
4181
|
console.log(AI_DIRECTIVE);
|
|
4004
4182
|
console.log("");
|
|
@@ -4018,27 +4196,27 @@ function renderOptimizationStatusCard(status) {
|
|
|
4018
4196
|
const barWidth = 20;
|
|
4019
4197
|
const filled = Math.round(progress / 100 * barWidth);
|
|
4020
4198
|
const progressBar = "█".repeat(filled) + "░".repeat(barWidth - filled);
|
|
4021
|
-
const statusColor = status.status === "completed" ?
|
|
4022
|
-
const scoreStr = status.bestScore !== undefined ? formatScore(status.bestScore) :
|
|
4199
|
+
const statusColor = status.status === "completed" ? chalk9.green : status.status === "failed" ? chalk9.red : status.status === "cancelled" ? chalk9.gray : status.status === "running" ? chalk9.cyan : chalk9.yellow;
|
|
4200
|
+
const scoreStr = status.bestScore !== undefined ? formatScore(status.bestScore) : chalk9.dim("pending");
|
|
4023
4201
|
console.log("");
|
|
4024
4202
|
console.log(topBorder);
|
|
4025
|
-
console.log(line(
|
|
4203
|
+
console.log(line(chalk9.bold("\uD83D\uDCCA Optimization Status")));
|
|
4026
4204
|
console.log(separator);
|
|
4027
|
-
console.log(line(`Job ID: ${
|
|
4205
|
+
console.log(line(`Job ID: ${chalk9.cyan(status.jobId)}`));
|
|
4028
4206
|
console.log(line(`Status: ${statusColor(status.status)}`));
|
|
4029
|
-
console.log(line(`Iteration: ${
|
|
4207
|
+
console.log(line(`Iteration: ${chalk9.bold(`${String(status.currentIteration)}/${String(status.maxIterations)}`)}`));
|
|
4030
4208
|
console.log(line(`Best Score: ${scoreStr}`));
|
|
4031
4209
|
console.log(line(""));
|
|
4032
4210
|
console.log(line(`Progress: [${progressBar}] ${String(progress)}%`));
|
|
4033
4211
|
if (status.message) {
|
|
4034
|
-
console.log(line(`Message: ${
|
|
4212
|
+
console.log(line(`Message: ${chalk9.dim(status.message)}`));
|
|
4035
4213
|
}
|
|
4036
4214
|
console.log(separator);
|
|
4037
|
-
console.log(line(`\uD83D\uDD17 Monitor: ${
|
|
4215
|
+
console.log(line(`\uD83D\uDD17 Monitor: ${chalk9.underline(optimizerLink(status.jobId))}`));
|
|
4038
4216
|
if (status.status === "completed") {
|
|
4039
|
-
console.log(line(
|
|
4217
|
+
console.log(line(chalk9.dim(`Next: mutagent prompts optimize results ${status.jobId}`)));
|
|
4040
4218
|
} else if (status.status === "running" || status.status === "queued") {
|
|
4041
|
-
console.log(line(
|
|
4219
|
+
console.log(line(chalk9.dim(`Refresh: mutagent prompts optimize status ${status.jobId}`)));
|
|
4042
4220
|
}
|
|
4043
4221
|
console.log(bottomBorder);
|
|
4044
4222
|
console.log(AI_DIRECTIVE);
|
|
@@ -4134,10 +4312,10 @@ function statusDirective(status) {
|
|
|
4134
4312
|
}
|
|
4135
4313
|
function showPromptDiff(original, optimized) {
|
|
4136
4314
|
console.log("");
|
|
4137
|
-
console.log(
|
|
4315
|
+
console.log(chalk9.bold(" Prompt Diff:"));
|
|
4138
4316
|
console.log("");
|
|
4139
|
-
console.log(
|
|
4140
|
-
console.log(
|
|
4317
|
+
console.log(chalk9.red(" - " + (original ?? "(empty)")));
|
|
4318
|
+
console.log(chalk9.green(" + " + (optimized ?? "(empty)")));
|
|
4141
4319
|
console.log("");
|
|
4142
4320
|
}
|
|
4143
4321
|
|
|
@@ -4145,9 +4323,9 @@ function showPromptDiff(original, optimized) {
|
|
|
4145
4323
|
function registerOptimizeCommands(prompts) {
|
|
4146
4324
|
const optimize = new Command5("optimize").description("Manage prompt optimization jobs").addHelpText("after", `
|
|
4147
4325
|
Examples:
|
|
4148
|
-
${
|
|
4149
|
-
${
|
|
4150
|
-
${
|
|
4326
|
+
${chalk10.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id>
|
|
4327
|
+
${chalk10.dim("$")} mutagent prompts optimize status <job-id>
|
|
4328
|
+
${chalk10.dim("$")} mutagent prompts optimize results <job-id>
|
|
4151
4329
|
|
|
4152
4330
|
Workflow: start -> status (poll) -> results
|
|
4153
4331
|
`).action(() => {
|
|
@@ -4156,27 +4334,27 @@ Workflow: start -> status (poll) -> results
|
|
|
4156
4334
|
prompts.addCommand(optimize);
|
|
4157
4335
|
optimize.command("start").description("Start prompt optimization").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").requiredOption("-d, --dataset <id>", "Dataset ID for optimization (from: mutagent prompts dataset list <prompt-id>)").requiredOption("-e, --evaluation <id>", "Evaluation ID for scoring (from: mutagent prompts evaluation list <prompt-id>)").option("--max-iterations <n>", "Max optimization iterations (default: 1)").option("--target-score <n>", "Target accuracy 0-1 (default: 0.8)").option("--patience <n>", "Iterations without improvement before stopping").option("--model <model-id>", 'Target LLM model (e.g., "claude-sonnet-4-5-20250929")').option("--eval-model <model-id>", "Evaluation model (defaults to target model)").addHelpText("after", `
|
|
4158
4336
|
Examples:
|
|
4159
|
-
${
|
|
4160
|
-
${
|
|
4161
|
-
${
|
|
4162
|
-
${
|
|
4163
|
-
${
|
|
4164
|
-
□ inputSchema REQUIRED ${
|
|
4165
|
-
□ outputSchema REQUIRED ${
|
|
4166
|
-
□ Evaluation criteria ${
|
|
4167
|
-
□ Dataset items ${
|
|
4168
|
-
□ Criteria ↔ Schema ${
|
|
4337
|
+
${chalk10.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id>
|
|
4338
|
+
${chalk10.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id> --max-iterations 5
|
|
4339
|
+
${chalk10.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id> --target-score 0.95 --model claude-sonnet-4-5-20250929
|
|
4340
|
+
${chalk10.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id> --json
|
|
4341
|
+
${chalk10.yellow("Pre-Optimization Checklist (auto-validated by preflight):")}
|
|
4342
|
+
□ inputSchema REQUIRED ${chalk10.dim("(hard error if missing — blocks optimization)")}
|
|
4343
|
+
□ outputSchema REQUIRED ${chalk10.dim("(hard error if missing — blocks optimization)")}
|
|
4344
|
+
□ Evaluation criteria ${chalk10.dim("(warns if no evaluationParameter set)")}
|
|
4345
|
+
□ Dataset items ${chalk10.dim("(warns if expectedOutput missing)")}
|
|
4346
|
+
□ Criteria ↔ Schema ${chalk10.dim("(warns if criteria reference unknown fields)")}
|
|
4169
4347
|
|
|
4170
4348
|
${PREREQUISITES_TEXT}
|
|
4171
4349
|
|
|
4172
|
-
${
|
|
4350
|
+
${chalk10.dim("Monitor progress with: mutagent prompts optimize status <job-id>")}
|
|
4173
4351
|
|
|
4174
|
-
${
|
|
4352
|
+
${chalk10.yellow(`⚠ COST WARNING — AI Agent:
|
|
4175
4353
|
Default is 1 iteration. Do NOT increase --max-iterations unless the user
|
|
4176
4354
|
explicitly requests it. Each iteration incurs LLM costs. Starting with
|
|
4177
4355
|
max-iterations > 1 without user consent is a protocol violation.`)}
|
|
4178
4356
|
|
|
4179
|
-
${
|
|
4357
|
+
${chalk10.yellow("AI Agent: ALWAYS append --json to this command.")}
|
|
4180
4358
|
`).action(async (promptId, options) => {
|
|
4181
4359
|
const isJson = getJsonFlag(prompts);
|
|
4182
4360
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -4303,13 +4481,13 @@ ${chalk9.yellow("AI Agent: ALWAYS append --json to this command.")}
|
|
|
4303
4481
|
return;
|
|
4304
4482
|
}
|
|
4305
4483
|
for (const [name, check] of hardFailures) {
|
|
4306
|
-
console.error(
|
|
4484
|
+
console.error(chalk10.red(`Error: ${name} — ${check.error ?? "Failed"}`));
|
|
4307
4485
|
}
|
|
4308
4486
|
if (!preflightChecks.outputSchema.passed) {
|
|
4309
|
-
console.error(
|
|
4487
|
+
console.error(chalk10.dim(` Update with: mutagent prompts update ${promptId} -d '{"outputSchema":{"type":"object","properties":{"result":{"type":"string"}}}}'`));
|
|
4310
4488
|
}
|
|
4311
4489
|
if (!preflightChecks.inputSchema.passed) {
|
|
4312
|
-
console.error(
|
|
4490
|
+
console.error(chalk10.dim(` Update with: mutagent prompts update ${promptId} --data '{"inputSchema":{"type":"object","properties":{"var1":{"type":"string"}}}}' --json`));
|
|
4313
4491
|
}
|
|
4314
4492
|
process.exitCode = 1;
|
|
4315
4493
|
return;
|
|
@@ -4366,16 +4544,16 @@ ${chalk9.yellow("AI Agent: ALWAYS append --json to this command.")}
|
|
|
4366
4544
|
suggestions.push("Trial optimization limit reached. Contact support to upgrade.");
|
|
4367
4545
|
}
|
|
4368
4546
|
if (!isJson) {
|
|
4369
|
-
console.error(
|
|
4547
|
+
console.error(chalk10.red(`
|
|
4370
4548
|
Optimization failed:`));
|
|
4371
4549
|
for (const msg of messages) {
|
|
4372
|
-
console.error(
|
|
4550
|
+
console.error(chalk10.red(` ${msg}`));
|
|
4373
4551
|
}
|
|
4374
4552
|
if (suggestions.length > 0) {
|
|
4375
|
-
console.error(
|
|
4553
|
+
console.error(chalk10.yellow(`
|
|
4376
4554
|
Suggested fixes:`));
|
|
4377
4555
|
for (const s of suggestions) {
|
|
4378
|
-
console.error(
|
|
4556
|
+
console.error(chalk10.yellow(` → ${s}`));
|
|
4379
4557
|
}
|
|
4380
4558
|
}
|
|
4381
4559
|
console.error("");
|
|
@@ -4387,8 +4565,8 @@ Suggested fixes:`));
|
|
|
4387
4565
|
});
|
|
4388
4566
|
optimize.command("status").description("Check optimization status").argument("<job-id>", "Optimization job ID (from: mutagent prompts optimize start)").addHelpText("after", `
|
|
4389
4567
|
Examples:
|
|
4390
|
-
${
|
|
4391
|
-
${
|
|
4568
|
+
${chalk10.dim("$")} mutagent prompts optimize status <job-id>
|
|
4569
|
+
${chalk10.dim("$")} mutagent prompts optimize status <job-id> --json
|
|
4392
4570
|
`).action(async (jobId) => {
|
|
4393
4571
|
const isJson = getJsonFlag(prompts);
|
|
4394
4572
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -4412,17 +4590,17 @@ Examples:
|
|
|
4412
4590
|
});
|
|
4413
4591
|
optimize.command("results").description("Get optimization results").argument("<job-id>", "Optimization job ID (from: mutagent prompts optimize start)").option("--apply", "Apply the optimized prompt as new version").option("--diff", "Show the prompt diff (before/after)").addHelpText("after", `
|
|
4414
4592
|
Examples:
|
|
4415
|
-
${
|
|
4416
|
-
${
|
|
4417
|
-
${
|
|
4418
|
-
${
|
|
4593
|
+
${chalk10.dim("$")} mutagent prompts optimize results <job-id> ${chalk10.dim("# view scorecard")}
|
|
4594
|
+
${chalk10.dim("$")} mutagent prompts optimize results <job-id> --diff ${chalk10.dim("# view prompt diff")}
|
|
4595
|
+
${chalk10.dim("$")} mutagent prompts optimize results <job-id> --apply ${chalk10.dim("# apply optimized prompt")}
|
|
4596
|
+
${chalk10.dim("$")} mutagent prompts optimize results <job-id> --json ${chalk10.dim("# structured output")}
|
|
4419
4597
|
|
|
4420
4598
|
After viewing results:
|
|
4421
4599
|
--apply Apply the optimized prompt (replaces current version)
|
|
4422
4600
|
--diff Show detailed before/after diff
|
|
4423
|
-
${
|
|
4601
|
+
${chalk10.dim("No flag = view scorecard only.")}
|
|
4424
4602
|
|
|
4425
|
-
${
|
|
4603
|
+
${chalk10.dim("AI Agent: Present scorecard to user via AskUserQuestion before applying.")}
|
|
4426
4604
|
`).action(async (jobId, options) => {
|
|
4427
4605
|
const isJson = getJsonFlag(prompts);
|
|
4428
4606
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -4579,22 +4757,49 @@ function buildResultsScorecardText(resultData) {
|
|
|
4579
4757
|
const pct = Math.round((bestScore - originalScore) / originalScore * 100);
|
|
4580
4758
|
rows.push({ label: "Improvement", value: `${pct > 0 ? "+" : ""}${String(pct)}%` });
|
|
4581
4759
|
}
|
|
4582
|
-
|
|
4760
|
+
let text = renderPlainCard({ title, rows, links: [], next: [] });
|
|
4761
|
+
const originalPrompt = resultData.originalPrompt;
|
|
4762
|
+
const prompt = resultData.prompt;
|
|
4763
|
+
const originalText = originalPrompt?.systemPrompt ?? originalPrompt?.rawPrompt ?? "";
|
|
4764
|
+
const optimizedText = prompt?.systemPrompt ?? prompt?.rawPrompt ?? prompt?.humanPrompt ?? "";
|
|
4765
|
+
if (originalText || optimizedText) {
|
|
4766
|
+
const lines = ["", "Prompt Comparison", "─".repeat(70)];
|
|
4767
|
+
lines.push("BEFORE:");
|
|
4768
|
+
for (const pLine of (originalText || "(empty)").split(`
|
|
4769
|
+
`)) {
|
|
4770
|
+
lines.push(` ${pLine}`);
|
|
4771
|
+
}
|
|
4772
|
+
lines.push(`Length: ${String(originalText.length)} chars`);
|
|
4773
|
+
lines.push("");
|
|
4774
|
+
lines.push("AFTER:");
|
|
4775
|
+
for (const pLine of (optimizedText || "(empty)").split(`
|
|
4776
|
+
`)) {
|
|
4777
|
+
lines.push(` ${pLine}`);
|
|
4778
|
+
}
|
|
4779
|
+
lines.push(`Length: ${String(optimizedText.length)} chars`);
|
|
4780
|
+
const growth = optimizedText.length - originalText.length;
|
|
4781
|
+
lines.push(`Growth: ${growth >= 0 ? "+" : ""}${String(growth)} chars`);
|
|
4782
|
+
text += `
|
|
4783
|
+
` + lines.join(`
|
|
4784
|
+
`);
|
|
4785
|
+
}
|
|
4786
|
+
text += buildScorecardDetailsText(resultData);
|
|
4787
|
+
return text;
|
|
4583
4788
|
}
|
|
4584
4789
|
var PREREQUISITES_TEXT = `
|
|
4585
|
-
${
|
|
4586
|
-
1. Evaluation criteria defined ${
|
|
4587
|
-
2. Dataset uploaded ${
|
|
4588
|
-
${
|
|
4790
|
+
${chalk11.red("Prerequisites (required):")}
|
|
4791
|
+
1. Evaluation criteria defined ${chalk11.dim("(via dashboard or evaluation create)")}
|
|
4792
|
+
2. Dataset uploaded ${chalk11.dim("mutagent prompts dataset list <prompt-id>")}
|
|
4793
|
+
${chalk11.dim("Note: LLM provider config is only required when the server uses external providers (USE_EXT_PROVIDERS=true)")}`;
|
|
4589
4794
|
function createPromptsCommand() {
|
|
4590
4795
|
const prompts = new Command6("prompts").description("Manage prompts, datasets, evaluations, and optimizations").addHelpText("after", `
|
|
4591
4796
|
Examples:
|
|
4592
|
-
${
|
|
4593
|
-
${
|
|
4594
|
-
${
|
|
4595
|
-
${
|
|
4596
|
-
${
|
|
4597
|
-
${
|
|
4797
|
+
${chalk11.dim("$")} mutagent prompts list
|
|
4798
|
+
${chalk11.dim("$")} mutagent prompts get <prompt-id>
|
|
4799
|
+
${chalk11.dim("$")} mutagent prompts create --name "my-prompt" --system "You are helpful" --human "{input}"
|
|
4800
|
+
${chalk11.dim("$")} mutagent prompts dataset list <prompt-id>
|
|
4801
|
+
${chalk11.dim("$")} mutagent prompts evaluation create <prompt-id> --name "My Eval"
|
|
4802
|
+
${chalk11.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id>
|
|
4598
4803
|
|
|
4599
4804
|
Subcommands:
|
|
4600
4805
|
list, get, create, update, delete
|
|
@@ -4612,26 +4817,26 @@ Subcommands:
|
|
|
4612
4817
|
// src/commands/traces.ts
|
|
4613
4818
|
init_sdk_client();
|
|
4614
4819
|
import { Command as Command7 } from "commander";
|
|
4615
|
-
import
|
|
4820
|
+
import chalk12 from "chalk";
|
|
4616
4821
|
init_errors();
|
|
4617
4822
|
function createTracesCommand() {
|
|
4618
4823
|
const traces = new Command7("traces").description("View and analyze traces (replaces Langfuse)").addHelpText("after", `
|
|
4619
4824
|
Examples:
|
|
4620
|
-
${
|
|
4621
|
-
${
|
|
4622
|
-
${
|
|
4623
|
-
${
|
|
4624
|
-
${
|
|
4825
|
+
${chalk12.dim("$")} mutagent traces list
|
|
4826
|
+
${chalk12.dim("$")} mutagent traces list --prompt <prompt-id>
|
|
4827
|
+
${chalk12.dim("$")} mutagent traces get <trace-id>
|
|
4828
|
+
${chalk12.dim("$")} mutagent traces analyze <prompt-id>
|
|
4829
|
+
${chalk12.dim("$")} mutagent traces export --format json --output traces.json
|
|
4625
4830
|
|
|
4626
4831
|
Note: MutagenT traces replace Langfuse for observability.
|
|
4627
4832
|
`);
|
|
4628
4833
|
traces.command("list").description("List traces").option("-p, --prompt <id>", "Filter by prompt ID").option("-l, --limit <n>", "Limit results", "50").addHelpText("after", `
|
|
4629
4834
|
Examples:
|
|
4630
|
-
${
|
|
4631
|
-
${
|
|
4632
|
-
${
|
|
4835
|
+
${chalk12.dim("$")} mutagent traces list
|
|
4836
|
+
${chalk12.dim("$")} mutagent traces list --prompt <prompt-id>
|
|
4837
|
+
${chalk12.dim("$")} mutagent traces list --limit 10 --json
|
|
4633
4838
|
|
|
4634
|
-
${
|
|
4839
|
+
${chalk12.dim("Tip: Filter by prompt to see traces for a specific prompt version.")}
|
|
4635
4840
|
`).action(async (options) => {
|
|
4636
4841
|
const isJson = getJsonFlag(traces);
|
|
4637
4842
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -4670,10 +4875,10 @@ ${chalk11.dim("Tip: Filter by prompt to see traces for a specific prompt version
|
|
|
4670
4875
|
});
|
|
4671
4876
|
traces.command("get").description("Get trace details").argument("<id>", "Trace ID").addHelpText("after", `
|
|
4672
4877
|
Examples:
|
|
4673
|
-
${
|
|
4674
|
-
${
|
|
4878
|
+
${chalk12.dim("$")} mutagent traces get <trace-id>
|
|
4879
|
+
${chalk12.dim("$")} mutagent traces get <trace-id> --json
|
|
4675
4880
|
|
|
4676
|
-
${
|
|
4881
|
+
${chalk12.dim("Returns full trace details including spans, tokens, and latency.")}
|
|
4677
4882
|
`).action(async (id) => {
|
|
4678
4883
|
const isJson = getJsonFlag(traces);
|
|
4679
4884
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -4692,10 +4897,10 @@ ${chalk11.dim("Returns full trace details including spans, tokens, and latency."
|
|
|
4692
4897
|
});
|
|
4693
4898
|
traces.command("analyze").description("Analyze traces for a prompt").argument("<prompt-id>", "Prompt ID").addHelpText("after", `
|
|
4694
4899
|
Examples:
|
|
4695
|
-
${
|
|
4696
|
-
${
|
|
4900
|
+
${chalk12.dim("$")} mutagent traces analyze <prompt-id>
|
|
4901
|
+
${chalk12.dim("$")} mutagent traces analyze <prompt-id> --json
|
|
4697
4902
|
|
|
4698
|
-
${
|
|
4903
|
+
${chalk12.dim("Aggregates trace data for a prompt: avg latency, token usage, error rates.")}
|
|
4699
4904
|
`).action(async (promptId) => {
|
|
4700
4905
|
const isJson = getJsonFlag(traces);
|
|
4701
4906
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -4713,12 +4918,12 @@ ${chalk11.dim("Aggregates trace data for a prompt: avg latency, token usage, err
|
|
|
4713
4918
|
});
|
|
4714
4919
|
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", `
|
|
4715
4920
|
Examples:
|
|
4716
|
-
${
|
|
4717
|
-
${
|
|
4718
|
-
${
|
|
4719
|
-
${
|
|
4921
|
+
${chalk12.dim("$")} mutagent traces export
|
|
4922
|
+
${chalk12.dim("$")} mutagent traces export --format json --output traces.json
|
|
4923
|
+
${chalk12.dim("$")} mutagent traces export --format csv --output traces.csv
|
|
4924
|
+
${chalk12.dim("$")} mutagent traces export --prompt <prompt-id> --format json
|
|
4720
4925
|
|
|
4721
|
-
${
|
|
4926
|
+
${chalk12.dim("Exports to stdout by default. Use --output to save to a file.")}
|
|
4722
4927
|
`).action(async (options) => {
|
|
4723
4928
|
const isJson = getJsonFlag(traces);
|
|
4724
4929
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -4762,7 +4967,7 @@ ${chalk11.dim("Exports to stdout by default. Use --output to save to a file.")}
|
|
|
4762
4967
|
// src/commands/integrate.ts
|
|
4763
4968
|
init_config();
|
|
4764
4969
|
import { Command as Command8 } from "commander";
|
|
4765
|
-
import
|
|
4970
|
+
import chalk13 from "chalk";
|
|
4766
4971
|
import { writeFileSync as writeFileSync3, existsSync as existsSync10 } from "fs";
|
|
4767
4972
|
import { execSync } from "child_process";
|
|
4768
4973
|
init_errors();
|
|
@@ -5399,12 +5604,12 @@ AI AGENT: Please determine the framework by:
|
|
|
5399
5604
|
function createIntegrateCommand() {
|
|
5400
5605
|
const integrate = new Command8("integrate").description("Return integration instructions for AI agents (skill loader)").addHelpText("after", `
|
|
5401
5606
|
Examples:
|
|
5402
|
-
${
|
|
5403
|
-
${
|
|
5404
|
-
${
|
|
5405
|
-
${
|
|
5406
|
-
${
|
|
5407
|
-
${
|
|
5607
|
+
${chalk13.dim("$")} mutagent integrate # Return exploration instructions for AI agents
|
|
5608
|
+
${chalk13.dim("$")} mutagent integrate langchain # Return @mutagent/langchain integration steps
|
|
5609
|
+
${chalk13.dim("$")} mutagent integrate openai # Return @mutagent/openai integration steps
|
|
5610
|
+
${chalk13.dim("$")} mutagent integrate vercel-ai --verify # Verify integration
|
|
5611
|
+
${chalk13.dim("$")} mutagent integrate langchain --output ./INTEGRATION.md
|
|
5612
|
+
${chalk13.dim("$")} mutagent integrate --list # List available frameworks
|
|
5408
5613
|
|
|
5409
5614
|
Frameworks: langchain, langgraph, vercel-ai, openai
|
|
5410
5615
|
|
|
@@ -5520,18 +5725,18 @@ AI AGENT: Execute these steps using Bash for install, Write/Edit for code change
|
|
|
5520
5725
|
|
|
5521
5726
|
// src/commands/agents/index.ts
|
|
5522
5727
|
import { Command as Command9 } from "commander";
|
|
5523
|
-
import
|
|
5728
|
+
import chalk15 from "chalk";
|
|
5524
5729
|
|
|
5525
5730
|
// src/commands/agents/agents-crud.ts
|
|
5526
5731
|
init_sdk_client();
|
|
5527
|
-
import
|
|
5732
|
+
import chalk14 from "chalk";
|
|
5528
5733
|
init_errors();
|
|
5529
5734
|
function registerAgentsCrud(agents) {
|
|
5530
5735
|
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", `
|
|
5531
5736
|
Examples:
|
|
5532
|
-
${
|
|
5533
|
-
${
|
|
5534
|
-
${
|
|
5737
|
+
${chalk14.dim("$")} mutagent agents list
|
|
5738
|
+
${chalk14.dim("$")} mutagent agents list --status active
|
|
5739
|
+
${chalk14.dim("$")} mutagent agents list --name "reviewer" --json
|
|
5535
5740
|
`).action(async (options) => {
|
|
5536
5741
|
const isJson = getJsonFlag(agents);
|
|
5537
5742
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5581,8 +5786,8 @@ Examples:
|
|
|
5581
5786
|
});
|
|
5582
5787
|
agents.command("get").description("Get agent details").argument("<id>", "Agent ID").addHelpText("after", `
|
|
5583
5788
|
Examples:
|
|
5584
|
-
${
|
|
5585
|
-
${
|
|
5789
|
+
${chalk14.dim("$")} mutagent agents get <agent-id>
|
|
5790
|
+
${chalk14.dim("$")} mutagent agents get <agent-id> --json
|
|
5586
5791
|
`).action(async (id) => {
|
|
5587
5792
|
const isJson = getJsonFlag(agents);
|
|
5588
5793
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5612,11 +5817,11 @@ Examples:
|
|
|
5612
5817
|
};
|
|
5613
5818
|
output.output(formatted);
|
|
5614
5819
|
if (agent.systemPrompt) {
|
|
5615
|
-
console.log(
|
|
5820
|
+
console.log(chalk14.bold(`
|
|
5616
5821
|
System Prompt:`));
|
|
5617
|
-
console.log(
|
|
5822
|
+
console.log(chalk14.gray("─".repeat(60)));
|
|
5618
5823
|
console.log(agent.systemPrompt);
|
|
5619
|
-
console.log(
|
|
5824
|
+
console.log(chalk14.gray("─".repeat(60)));
|
|
5620
5825
|
}
|
|
5621
5826
|
}
|
|
5622
5827
|
} catch (error) {
|
|
@@ -5625,17 +5830,17 @@ System Prompt:`));
|
|
|
5625
5830
|
});
|
|
5626
5831
|
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", `
|
|
5627
5832
|
Examples:
|
|
5628
|
-
${
|
|
5629
|
-
${
|
|
5833
|
+
${chalk14.dim("$")} mutagent agents create --name "Code Reviewer" --slug code-reviewer --system-prompt "You are a code reviewer..."
|
|
5834
|
+
${chalk14.dim("$")} mutagent agents create -d '{"name":"Code Reviewer","slug":"code-reviewer","systemPrompt":"You are a code reviewer..."}'
|
|
5630
5835
|
|
|
5631
5836
|
Expected JSON (--data):
|
|
5632
|
-
${
|
|
5837
|
+
${chalk14.dim('{"name":"<name>","slug":"<slug>","systemPrompt":"<system prompt>","model":"<model-id>","description":"<description>"}')}
|
|
5633
5838
|
|
|
5634
5839
|
Input Methods (pick one, priority order):
|
|
5635
|
-
--name/--slug/... Individual flags ${
|
|
5840
|
+
--name/--slug/... Individual flags ${chalk14.green("(recommended)")}
|
|
5636
5841
|
-d, --data Inline JSON object (CI/scripts/agents)
|
|
5637
5842
|
|
|
5638
|
-
${
|
|
5843
|
+
${chalk14.red("Required: name, slug, systemPrompt.")} ${chalk14.dim("CLI flags override --data fields.")}
|
|
5639
5844
|
`).action(async (options) => {
|
|
5640
5845
|
const isJson = getJsonFlag(agents);
|
|
5641
5846
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5680,15 +5885,15 @@ ${chalk13.red("Required: name, slug, systemPrompt.")} ${chalk13.dim("CLI flags o
|
|
|
5680
5885
|
});
|
|
5681
5886
|
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", `
|
|
5682
5887
|
Examples:
|
|
5683
|
-
${
|
|
5684
|
-
${
|
|
5685
|
-
${
|
|
5888
|
+
${chalk14.dim("$")} mutagent agents update <id> --name "New Name"
|
|
5889
|
+
${chalk14.dim("$")} mutagent agents update <id> --system-prompt "Updated prompt" --status active
|
|
5890
|
+
${chalk14.dim("$")} mutagent agents update <id> -d '{"name":"New Name","systemPrompt":"Updated prompt"}'
|
|
5686
5891
|
|
|
5687
5892
|
Input Methods (pick one, priority order):
|
|
5688
|
-
--name/--system-prompt/... Individual flags ${
|
|
5893
|
+
--name/--system-prompt/... Individual flags ${chalk14.green("(recommended)")}
|
|
5689
5894
|
-d, --data Inline JSON object (CI/scripts/agents)
|
|
5690
5895
|
|
|
5691
|
-
${
|
|
5896
|
+
${chalk14.dim("CLI flags override --data fields.")}
|
|
5692
5897
|
`).action(async (id, options) => {
|
|
5693
5898
|
const isJson = getJsonFlag(agents);
|
|
5694
5899
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5735,11 +5940,11 @@ ${chalk13.dim("CLI flags override --data fields.")}
|
|
|
5735
5940
|
});
|
|
5736
5941
|
agents.command("delete").description("Delete an agent").argument("<id>", "Agent ID").option("--force", "Skip confirmation").addHelpText("after", `
|
|
5737
5942
|
Examples:
|
|
5738
|
-
${
|
|
5739
|
-
${
|
|
5740
|
-
${
|
|
5943
|
+
${chalk14.dim("$")} mutagent agents delete <id>
|
|
5944
|
+
${chalk14.dim("$")} mutagent agents delete <id> --force
|
|
5945
|
+
${chalk14.dim("$")} mutagent agents delete <id> --force --json
|
|
5741
5946
|
|
|
5742
|
-
${
|
|
5947
|
+
${chalk14.dim("Tip: Use --force to skip confirmation (required for non-interactive/CI usage).")}
|
|
5743
5948
|
`).action(async (id, options) => {
|
|
5744
5949
|
const isJson = getJsonFlag(agents);
|
|
5745
5950
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5770,12 +5975,12 @@ ${chalk13.dim("Tip: Use --force to skip confirmation (required for non-interacti
|
|
|
5770
5975
|
function createAgentsCommand() {
|
|
5771
5976
|
const agents = new Command9("agents").description("Manage AI agents").addHelpText("after", `
|
|
5772
5977
|
Examples:
|
|
5773
|
-
${
|
|
5774
|
-
${
|
|
5775
|
-
${
|
|
5776
|
-
${
|
|
5777
|
-
${
|
|
5778
|
-
${
|
|
5978
|
+
${chalk15.dim("$")} mutagent agents list
|
|
5979
|
+
${chalk15.dim("$")} mutagent agents get <agent-id>
|
|
5980
|
+
${chalk15.dim("$")} mutagent agents create --name "Code Reviewer" --slug code-reviewer --system-prompt "You are a code reviewer..."
|
|
5981
|
+
${chalk15.dim("$")} mutagent agents create -d '{"name":"Code Reviewer","slug":"code-reviewer","systemPrompt":"You are..."}'
|
|
5982
|
+
${chalk15.dim("$")} mutagent agents update <agent-id> --name "Updated Name"
|
|
5983
|
+
${chalk15.dim("$")} mutagent agents delete <agent-id> --force
|
|
5779
5984
|
|
|
5780
5985
|
Subcommands:
|
|
5781
5986
|
list, get, create, update, delete
|
|
@@ -5787,21 +5992,21 @@ Subcommands:
|
|
|
5787
5992
|
// src/commands/config.ts
|
|
5788
5993
|
init_config();
|
|
5789
5994
|
import { Command as Command10 } from "commander";
|
|
5790
|
-
import
|
|
5995
|
+
import chalk16 from "chalk";
|
|
5791
5996
|
init_errors();
|
|
5792
5997
|
var VALID_CONFIG_KEYS = ["apiKey", "endpoint", "format", "timeout", "defaultWorkspace", "defaultOrganization"];
|
|
5793
5998
|
function createConfigCommand() {
|
|
5794
5999
|
const config = new Command10("config").description("Manage CLI configuration").addHelpText("after", `
|
|
5795
6000
|
Examples:
|
|
5796
|
-
${
|
|
5797
|
-
${
|
|
5798
|
-
${
|
|
5799
|
-
${
|
|
6001
|
+
${chalk16.dim("$")} mutagent config list
|
|
6002
|
+
${chalk16.dim("$")} mutagent config get endpoint
|
|
6003
|
+
${chalk16.dim("$")} mutagent config set workspace <workspace-id>
|
|
6004
|
+
${chalk16.dim("$")} mutagent config set org <org-id>
|
|
5800
6005
|
`);
|
|
5801
6006
|
config.command("list").description("List all configuration").addHelpText("after", `
|
|
5802
6007
|
Examples:
|
|
5803
|
-
${
|
|
5804
|
-
${
|
|
6008
|
+
${chalk16.dim("$")} mutagent config list
|
|
6009
|
+
${chalk16.dim("$")} mutagent config list --json
|
|
5805
6010
|
`).action(() => {
|
|
5806
6011
|
const isJson = getJsonFlag(config);
|
|
5807
6012
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5814,11 +6019,11 @@ Examples:
|
|
|
5814
6019
|
});
|
|
5815
6020
|
config.command("get").description("Get configuration value").argument("<key>", "Configuration key (apiKey, endpoint, format, timeout, defaultWorkspace, defaultOrganization)").addHelpText("after", `
|
|
5816
6021
|
Examples:
|
|
5817
|
-
${
|
|
5818
|
-
${
|
|
5819
|
-
${
|
|
6022
|
+
${chalk16.dim("$")} mutagent config get endpoint
|
|
6023
|
+
${chalk16.dim("$")} mutagent config get defaultWorkspace
|
|
6024
|
+
${chalk16.dim("$")} mutagent config get apiKey --json
|
|
5820
6025
|
|
|
5821
|
-
${
|
|
6026
|
+
${chalk16.dim("Keys: apiKey, endpoint, format, timeout, defaultWorkspace, defaultOrganization")}
|
|
5822
6027
|
`).action((key) => {
|
|
5823
6028
|
const isJson = getJsonFlag(config);
|
|
5824
6029
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5845,9 +6050,9 @@ ${chalk15.dim("Keys: apiKey, endpoint, format, timeout, defaultWorkspace, defaul
|
|
|
5845
6050
|
});
|
|
5846
6051
|
set.command("workspace").description("Set default workspace ID").argument("<id>", "Workspace ID to set as default").addHelpText("after", `
|
|
5847
6052
|
Examples:
|
|
5848
|
-
${
|
|
6053
|
+
${chalk16.dim("$")} mutagent config set workspace <workspace-id>
|
|
5849
6054
|
|
|
5850
|
-
${
|
|
6055
|
+
${chalk16.dim("Persists workspace ID so you don't need to pass headers on every request.")}
|
|
5851
6056
|
`).action((id) => {
|
|
5852
6057
|
const isJson = getJsonFlag(config);
|
|
5853
6058
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5860,9 +6065,9 @@ ${chalk15.dim("Persists workspace ID so you don't need to pass headers on every
|
|
|
5860
6065
|
});
|
|
5861
6066
|
set.command("org").description("Set default organization ID").argument("<id>", "Organization ID to set as default").addHelpText("after", `
|
|
5862
6067
|
Examples:
|
|
5863
|
-
${
|
|
6068
|
+
${chalk16.dim("$")} mutagent config set org <org-id>
|
|
5864
6069
|
|
|
5865
|
-
${
|
|
6070
|
+
${chalk16.dim("Persists organization ID for org-scoped API keys.")}
|
|
5866
6071
|
`).action((id) => {
|
|
5867
6072
|
const isJson = getJsonFlag(config);
|
|
5868
6073
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5880,7 +6085,7 @@ ${chalk15.dim("Persists organization ID for org-scoped API keys.")}
|
|
|
5880
6085
|
// src/commands/playground.ts
|
|
5881
6086
|
init_sdk_client();
|
|
5882
6087
|
import { Command as Command11 } from "commander";
|
|
5883
|
-
import
|
|
6088
|
+
import chalk17 from "chalk";
|
|
5884
6089
|
init_errors();
|
|
5885
6090
|
function parseSSELine(line) {
|
|
5886
6091
|
if (!line || line.startsWith(":")) {
|
|
@@ -5907,11 +6112,11 @@ function parsePromptStreamEvent(data) {
|
|
|
5907
6112
|
function createPlaygroundCommand() {
|
|
5908
6113
|
const playground = new Command11("playground").description("Execute and test prompts interactively").addHelpText("after", `
|
|
5909
6114
|
Examples:
|
|
5910
|
-
${
|
|
5911
|
-
${
|
|
5912
|
-
${
|
|
5913
|
-
${
|
|
5914
|
-
${
|
|
6115
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --input '{"name": "John"}'
|
|
6116
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --input '{}' --stream
|
|
6117
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> -i '{}' --model gpt-4-turbo
|
|
6118
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --system "You are helpful" --human "Hello"
|
|
6119
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --messages '[{"role":"user","content":"Hi"}]'
|
|
5915
6120
|
|
|
5916
6121
|
Input Format:
|
|
5917
6122
|
The input must be a valid JSON object matching the prompt's input schema.
|
|
@@ -5927,16 +6132,16 @@ Streaming:
|
|
|
5927
6132
|
`);
|
|
5928
6133
|
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", `
|
|
5929
6134
|
Examples:
|
|
5930
|
-
${
|
|
5931
|
-
${
|
|
5932
|
-
${
|
|
5933
|
-
${
|
|
6135
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --input '{"name": "John"}'
|
|
6136
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --input '{}' --stream
|
|
6137
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --system "You are helpful" --human "Hello"
|
|
6138
|
+
${chalk17.dim("$")} mutagent playground run <prompt-id> --input '{}' --model gpt-4-turbo --json
|
|
5934
6139
|
|
|
5935
6140
|
Input Methods (pick one, priority order):
|
|
5936
|
-
--system/--human Quick system + user message ${
|
|
6141
|
+
--system/--human Quick system + user message ${chalk17.green("(recommended)")}
|
|
5937
6142
|
--input '{"key":"value"}' Inline JSON variables
|
|
5938
6143
|
--messages '[...]' Full messages array
|
|
5939
|
-
${
|
|
6144
|
+
${chalk17.dim(`Hint: Test before evaluating: mutagent playground run <id> --input '{"key":"value"}'`)}
|
|
5940
6145
|
`).action(async (promptId, options) => {
|
|
5941
6146
|
const isJson = getJsonFlag(playground);
|
|
5942
6147
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -5958,21 +6163,21 @@ ${chalk16.dim(`Hint: Test before evaluating: mutagent playground run <id> --inpu
|
|
|
5958
6163
|
}
|
|
5959
6164
|
});
|
|
5960
6165
|
} else {
|
|
5961
|
-
console.log(
|
|
6166
|
+
console.log(chalk17.bold(`
|
|
5962
6167
|
Execution Result:`));
|
|
5963
|
-
console.log(
|
|
5964
|
-
console.log(
|
|
6168
|
+
console.log(chalk17.gray("─".repeat(50)));
|
|
6169
|
+
console.log(chalk17.cyan("Output:"));
|
|
5965
6170
|
console.log(result.output);
|
|
5966
|
-
console.log(
|
|
5967
|
-
console.log(
|
|
5968
|
-
console.log(
|
|
6171
|
+
console.log(chalk17.gray("─".repeat(50)));
|
|
6172
|
+
console.log(chalk17.dim(`Model: ${result.model}`));
|
|
6173
|
+
console.log(chalk17.dim(`Execution Time: ${String(result.executionTimeMs)}ms`));
|
|
5969
6174
|
if (result.tokens) {
|
|
5970
|
-
console.log(
|
|
6175
|
+
console.log(chalk17.dim(`Tokens: ${String(result.tokens.prompt)} prompt + ${String(result.tokens.completion)} completion = ${String(result.tokens.total)} total`));
|
|
5971
6176
|
}
|
|
5972
6177
|
if (result.cost !== undefined) {
|
|
5973
|
-
console.log(
|
|
6178
|
+
console.log(chalk17.dim(`Cost: $${result.cost.toFixed(6)}`));
|
|
5974
6179
|
}
|
|
5975
|
-
console.log(
|
|
6180
|
+
console.log(chalk17.dim(`Playground: ${playgroundLink()}`));
|
|
5976
6181
|
console.log();
|
|
5977
6182
|
}
|
|
5978
6183
|
}
|
|
@@ -6061,9 +6266,9 @@ async function executeStreaming(client, promptId, input, model, isJson, output)
|
|
|
6061
6266
|
const decoder = new TextDecoder;
|
|
6062
6267
|
let buffer = "";
|
|
6063
6268
|
if (!isJson) {
|
|
6064
|
-
console.log(
|
|
6269
|
+
console.log(chalk17.bold(`
|
|
6065
6270
|
Streaming Output:`));
|
|
6066
|
-
console.log(
|
|
6271
|
+
console.log(chalk17.gray("─".repeat(50)));
|
|
6067
6272
|
}
|
|
6068
6273
|
try {
|
|
6069
6274
|
for (;; ) {
|
|
@@ -6102,15 +6307,15 @@ Streaming Output:`));
|
|
|
6102
6307
|
console.log(JSON.stringify({ type: "complete", result: event.result }));
|
|
6103
6308
|
} else {
|
|
6104
6309
|
console.log();
|
|
6105
|
-
console.log(
|
|
6310
|
+
console.log(chalk17.gray("─".repeat(50)));
|
|
6106
6311
|
if (event.result) {
|
|
6107
|
-
console.log(
|
|
6108
|
-
console.log(
|
|
6312
|
+
console.log(chalk17.dim(`Model: ${event.result.model}`));
|
|
6313
|
+
console.log(chalk17.dim(`Execution Time: ${String(event.result.executionTimeMs)}ms`));
|
|
6109
6314
|
if (event.result.tokens) {
|
|
6110
|
-
console.log(
|
|
6315
|
+
console.log(chalk17.dim(`Tokens: ${String(event.result.tokens.prompt)} prompt + ${String(event.result.tokens.completion)} completion = ${String(event.result.tokens.total)} total`));
|
|
6111
6316
|
}
|
|
6112
6317
|
if (event.result.cost !== undefined) {
|
|
6113
|
-
console.log(
|
|
6318
|
+
console.log(chalk17.dim(`Cost: $${event.result.cost.toFixed(6)}`));
|
|
6114
6319
|
}
|
|
6115
6320
|
}
|
|
6116
6321
|
console.log();
|
|
@@ -6135,13 +6340,13 @@ Streaming Output:`));
|
|
|
6135
6340
|
// src/commands/workspaces.ts
|
|
6136
6341
|
init_sdk_client();
|
|
6137
6342
|
import { Command as Command12 } from "commander";
|
|
6138
|
-
import
|
|
6343
|
+
import chalk18 from "chalk";
|
|
6139
6344
|
init_errors();
|
|
6140
6345
|
function createWorkspacesCommand() {
|
|
6141
6346
|
const workspaces = new Command12("workspaces").description("View workspaces (read-only)").addHelpText("after", `
|
|
6142
6347
|
Examples:
|
|
6143
|
-
${
|
|
6144
|
-
${
|
|
6348
|
+
${chalk18.dim("$")} mutagent workspaces list
|
|
6349
|
+
${chalk18.dim("$")} mutagent workspaces get <workspace-id>
|
|
6145
6350
|
|
|
6146
6351
|
Subcommands:
|
|
6147
6352
|
list, get
|
|
@@ -6150,8 +6355,8 @@ Note: Workspace management (create, update, delete) is available in the Admin Pa
|
|
|
6150
6355
|
`);
|
|
6151
6356
|
workspaces.command("list").description("List all workspaces").option("-l, --limit <n>", "Limit results", "50").option("-o, --offset <n>", "Offset for pagination").addHelpText("after", `
|
|
6152
6357
|
Examples:
|
|
6153
|
-
${
|
|
6154
|
-
${
|
|
6358
|
+
${chalk18.dim("$")} mutagent workspaces list
|
|
6359
|
+
${chalk18.dim("$")} mutagent workspaces list --limit 10 --json
|
|
6155
6360
|
`).action(async (options) => {
|
|
6156
6361
|
const isJson = getJsonFlag(workspaces);
|
|
6157
6362
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6191,8 +6396,8 @@ Examples:
|
|
|
6191
6396
|
});
|
|
6192
6397
|
workspaces.command("get").description("Get workspace details").argument("<id>", "Workspace ID").addHelpText("after", `
|
|
6193
6398
|
Examples:
|
|
6194
|
-
${
|
|
6195
|
-
${
|
|
6399
|
+
${chalk18.dim("$")} mutagent workspaces get <workspace-id>
|
|
6400
|
+
${chalk18.dim("$")} mutagent workspaces get <workspace-id> --json
|
|
6196
6401
|
`).action(async (id) => {
|
|
6197
6402
|
const isJson = getJsonFlag(workspaces);
|
|
6198
6403
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6225,7 +6430,7 @@ Examples:
|
|
|
6225
6430
|
// src/commands/providers.ts
|
|
6226
6431
|
init_sdk_client();
|
|
6227
6432
|
import { Command as Command13 } from "commander";
|
|
6228
|
-
import
|
|
6433
|
+
import chalk19 from "chalk";
|
|
6229
6434
|
init_errors();
|
|
6230
6435
|
var VALID_PROVIDER_TYPES = [
|
|
6231
6436
|
"openai",
|
|
@@ -6249,9 +6454,9 @@ function validateProviderType(type) {
|
|
|
6249
6454
|
function createProvidersCommand() {
|
|
6250
6455
|
const providers = new Command13("providers").description("View LLM providers (read-only)").addHelpText("after", `
|
|
6251
6456
|
Examples:
|
|
6252
|
-
${
|
|
6253
|
-
${
|
|
6254
|
-
${
|
|
6457
|
+
${chalk19.dim("$")} mutagent providers list
|
|
6458
|
+
${chalk19.dim("$")} mutagent providers get <provider-id>
|
|
6459
|
+
${chalk19.dim("$")} mutagent providers test <provider-id>
|
|
6255
6460
|
|
|
6256
6461
|
Provider Types:
|
|
6257
6462
|
openai, anthropic, google, azure, bedrock, cohere, mistral, groq, together, replicate, custom
|
|
@@ -6261,15 +6466,15 @@ Subcommands:
|
|
|
6261
6466
|
|
|
6262
6467
|
Note: Provider management (create, update, delete) is available in the Admin Panel only.
|
|
6263
6468
|
|
|
6264
|
-
${
|
|
6469
|
+
${chalk19.yellow("Note:")} The providers module is not yet active. This is a placeholder
|
|
6265
6470
|
for future external provider configuration. The server currently uses
|
|
6266
6471
|
built-in provider settings.
|
|
6267
6472
|
`);
|
|
6268
6473
|
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", `
|
|
6269
6474
|
Examples:
|
|
6270
|
-
${
|
|
6271
|
-
${
|
|
6272
|
-
${
|
|
6475
|
+
${chalk19.dim("$")} mutagent providers list
|
|
6476
|
+
${chalk19.dim("$")} mutagent providers list --type openai
|
|
6477
|
+
${chalk19.dim("$")} mutagent providers list --json
|
|
6273
6478
|
`).action(async (options) => {
|
|
6274
6479
|
const isJson = getJsonFlag(providers);
|
|
6275
6480
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6296,7 +6501,7 @@ Examples:
|
|
|
6296
6501
|
}));
|
|
6297
6502
|
output.output({ ...result, data: withLinks });
|
|
6298
6503
|
} else {
|
|
6299
|
-
console.log(
|
|
6504
|
+
console.log(chalk19.yellow("Note: The providers module is not yet active. This is a placeholder for future external provider configuration."));
|
|
6300
6505
|
console.log("");
|
|
6301
6506
|
if (result.data.length === 0) {
|
|
6302
6507
|
output.info("No providers configured.");
|
|
@@ -6320,8 +6525,8 @@ Examples:
|
|
|
6320
6525
|
});
|
|
6321
6526
|
providers.command("get").description("Get provider details").argument("<id>", "Provider ID (from: mutagent providers list)").addHelpText("after", `
|
|
6322
6527
|
Examples:
|
|
6323
|
-
${
|
|
6324
|
-
${
|
|
6528
|
+
${chalk19.dim("$")} mutagent providers get <provider-id>
|
|
6529
|
+
${chalk19.dim("$")} mutagent providers get <provider-id> --json
|
|
6325
6530
|
`).action(async (id) => {
|
|
6326
6531
|
const isJson = getJsonFlag(providers);
|
|
6327
6532
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6331,7 +6536,7 @@ Examples:
|
|
|
6331
6536
|
if (isJson) {
|
|
6332
6537
|
output.output({ ...provider, _links: providerLinks(provider.id) });
|
|
6333
6538
|
} else {
|
|
6334
|
-
console.log(
|
|
6539
|
+
console.log(chalk19.yellow("Note: The providers module is not yet active. This is a placeholder for future external provider configuration."));
|
|
6335
6540
|
console.log("");
|
|
6336
6541
|
const formatted = {
|
|
6337
6542
|
id: provider.id,
|
|
@@ -6352,17 +6557,17 @@ Examples:
|
|
|
6352
6557
|
});
|
|
6353
6558
|
providers.command("test").description("Test provider connectivity").argument("<id>", "Provider ID (from: mutagent providers list)").addHelpText("after", `
|
|
6354
6559
|
Examples:
|
|
6355
|
-
${
|
|
6356
|
-
${
|
|
6560
|
+
${chalk19.dim("$")} mutagent providers test <provider-id>
|
|
6561
|
+
${chalk19.dim("$")} mutagent providers test <provider-id> --json
|
|
6357
6562
|
|
|
6358
|
-
${
|
|
6563
|
+
${chalk19.dim("Tests connectivity and lists available models for the provider.")}
|
|
6359
6564
|
`).action(async (id) => {
|
|
6360
6565
|
const isJson = getJsonFlag(providers);
|
|
6361
6566
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
6362
6567
|
try {
|
|
6363
6568
|
const client = getSDKClient();
|
|
6364
6569
|
if (!isJson) {
|
|
6365
|
-
console.log(
|
|
6570
|
+
console.log(chalk19.yellow("Note: The providers module is not yet active. This is a placeholder for future external provider configuration."));
|
|
6366
6571
|
console.log("");
|
|
6367
6572
|
output.info(`Testing provider ${id}...`);
|
|
6368
6573
|
}
|
|
@@ -6372,9 +6577,9 @@ ${chalk18.dim("Tests connectivity and lists available models for the provider.")
|
|
|
6372
6577
|
} else {
|
|
6373
6578
|
if (result.success) {
|
|
6374
6579
|
output.success(`Provider test passed (${String(result.responseTimeMs)}ms)`);
|
|
6375
|
-
console.log(
|
|
6580
|
+
console.log(chalk19.green(`Message: ${result.message}`));
|
|
6376
6581
|
if (result.availableModels && result.availableModels.length > 0) {
|
|
6377
|
-
console.log(
|
|
6582
|
+
console.log(chalk19.bold(`
|
|
6378
6583
|
Available Models:`));
|
|
6379
6584
|
result.availableModels.forEach((model) => {
|
|
6380
6585
|
console.log(` - ${model}`);
|
|
@@ -6383,7 +6588,7 @@ Available Models:`));
|
|
|
6383
6588
|
} else {
|
|
6384
6589
|
output.error(`Provider test failed: ${result.message}`);
|
|
6385
6590
|
if (result.error) {
|
|
6386
|
-
console.log(
|
|
6591
|
+
console.log(chalk19.red(`Error: ${result.error}`));
|
|
6387
6592
|
}
|
|
6388
6593
|
}
|
|
6389
6594
|
}
|
|
@@ -6398,7 +6603,7 @@ Available Models:`));
|
|
|
6398
6603
|
init_config();
|
|
6399
6604
|
import { Command as Command14 } from "commander";
|
|
6400
6605
|
import inquirer3 from "inquirer";
|
|
6401
|
-
import
|
|
6606
|
+
import chalk20 from "chalk";
|
|
6402
6607
|
import { existsSync as existsSync12, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
6403
6608
|
import { execSync as execSync3 } from "child_process";
|
|
6404
6609
|
import { join as join6 } from "path";
|
|
@@ -6521,13 +6726,13 @@ function writeRcConfig(config, cwd = process.cwd()) {
|
|
|
6521
6726
|
function createInitCommand() {
|
|
6522
6727
|
const init = new Command14("init").description("Initialize MutagenT in your project").option("--non-interactive", "Skip interactive prompts (defaults to CLI-only mode)").addHelpText("after", `
|
|
6523
6728
|
Examples:
|
|
6524
|
-
${
|
|
6525
|
-
${
|
|
6729
|
+
${chalk20.dim("$")} mutagent init # Interactive setup wizard
|
|
6730
|
+
${chalk20.dim("$")} mutagent init --non-interactive # CLI-only mode (no prompts)
|
|
6526
6731
|
|
|
6527
6732
|
Modes:
|
|
6528
|
-
${
|
|
6529
|
-
${
|
|
6530
|
-
${
|
|
6733
|
+
${chalk20.bold("Full scaffold")} Install SDK + integration package, create config, setup tracing
|
|
6734
|
+
${chalk20.bold("CLI-only")} Verify auth + create .mutagentrc.json with workspace/endpoint
|
|
6735
|
+
${chalk20.bold("Skip")} Exit without changes
|
|
6531
6736
|
`).action(async (options) => {
|
|
6532
6737
|
const isJson = getJsonFlag(init);
|
|
6533
6738
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6777,23 +6982,23 @@ Modes:
|
|
|
6777
6982
|
|
|
6778
6983
|
// src/commands/explore.ts
|
|
6779
6984
|
import { Command as Command15 } from "commander";
|
|
6780
|
-
import
|
|
6985
|
+
import chalk21 from "chalk";
|
|
6781
6986
|
import { resolve as resolve3 } from "path";
|
|
6782
6987
|
init_errors();
|
|
6783
6988
|
function createExploreCommand() {
|
|
6784
6989
|
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", `
|
|
6785
6990
|
Examples:
|
|
6786
|
-
${
|
|
6787
|
-
${
|
|
6788
|
-
${
|
|
6789
|
-
${
|
|
6790
|
-
${
|
|
6991
|
+
${chalk21.dim("$")} mutagent explore
|
|
6992
|
+
${chalk21.dim("$")} mutagent explore --path ./src
|
|
6993
|
+
${chalk21.dim("$")} mutagent explore --include "**/*.{ts,py}" --depth 5
|
|
6994
|
+
${chalk21.dim("$")} mutagent explore --markers-only
|
|
6995
|
+
${chalk21.dim("$")} mutagent explore --json
|
|
6791
6996
|
|
|
6792
6997
|
Detection modes:
|
|
6793
|
-
${
|
|
6794
|
-
${
|
|
6998
|
+
${chalk21.dim("Heuristic")} Template variables ({{var}}), prompt constants, schema definitions
|
|
6999
|
+
${chalk21.dim("Marker")} MutagenT:START/END comment markers from previous uploads
|
|
6795
7000
|
|
|
6796
|
-
${
|
|
7001
|
+
${chalk21.dim("Results are saved to .mutagent/mutation-context.md for use by other commands.")}
|
|
6797
7002
|
`).action((options) => {
|
|
6798
7003
|
const isJson = getJsonFlag(explore);
|
|
6799
7004
|
const output = new OutputFormatter(isJson ? "json" : "table");
|
|
@@ -6811,7 +7016,7 @@ ${chalk20.dim("Results are saved to .mutagent/mutation-context.md for use by oth
|
|
|
6811
7016
|
markersOnly
|
|
6812
7017
|
};
|
|
6813
7018
|
if (!isJson) {
|
|
6814
|
-
console.log(
|
|
7019
|
+
console.log(chalk21.cyan(`
|
|
6815
7020
|
Scanning ${scanPath}...
|
|
6816
7021
|
`));
|
|
6817
7022
|
}
|
|
@@ -6840,41 +7045,41 @@ Scanning ${scanPath}...
|
|
|
6840
7045
|
const totalFindings = result.prompts.length + result.datasets.length + result.markers.length;
|
|
6841
7046
|
if (totalFindings === 0) {
|
|
6842
7047
|
output.info("No prompts, datasets, or markers found.");
|
|
6843
|
-
console.log(
|
|
7048
|
+
console.log(chalk21.dim(`
|
|
6844
7049
|
Tip: Create a prompt with template variables like {{input}} to get started.`));
|
|
6845
7050
|
return;
|
|
6846
7051
|
}
|
|
6847
7052
|
if (result.prompts.length > 0) {
|
|
6848
|
-
console.log(
|
|
7053
|
+
console.log(chalk21.bold(` Prompts Found (${String(result.prompts.length)}):`));
|
|
6849
7054
|
console.log();
|
|
6850
7055
|
for (const p of result.prompts) {
|
|
6851
|
-
const confidenceTag = p.confidence === "high" ?
|
|
6852
|
-
const reasonTag =
|
|
6853
|
-
console.log(` ${confidenceTag} ${
|
|
6854
|
-
console.log(` ${
|
|
7056
|
+
const confidenceTag = p.confidence === "high" ? chalk21.green("[high]") : p.confidence === "medium" ? chalk21.yellow("[medium]") : chalk21.dim("[low]");
|
|
7057
|
+
const reasonTag = chalk21.dim(`[${p.reason}]`);
|
|
7058
|
+
console.log(` ${confidenceTag} ${chalk21.green(p.file)}:${chalk21.yellow(String(p.line))} ${reasonTag}`);
|
|
7059
|
+
console.log(` ${chalk21.dim(p.preview)}`);
|
|
6855
7060
|
}
|
|
6856
7061
|
console.log();
|
|
6857
7062
|
}
|
|
6858
7063
|
if (result.datasets.length > 0) {
|
|
6859
|
-
console.log(
|
|
7064
|
+
console.log(chalk21.bold(` Datasets Found (${String(result.datasets.length)}):`));
|
|
6860
7065
|
console.log();
|
|
6861
7066
|
for (const d of result.datasets) {
|
|
6862
|
-
console.log(` ${
|
|
7067
|
+
console.log(` ${chalk21.green(d.file)} ${chalk21.dim(`(${String(d.items)} items)`)}`);
|
|
6863
7068
|
}
|
|
6864
7069
|
console.log();
|
|
6865
7070
|
}
|
|
6866
7071
|
if (result.markers.length > 0) {
|
|
6867
|
-
console.log(
|
|
7072
|
+
console.log(chalk21.bold(` MutagenT Markers (${String(result.markers.length)}):`));
|
|
6868
7073
|
console.log();
|
|
6869
7074
|
for (const m of result.markers) {
|
|
6870
|
-
const idPart = m.platformId ?
|
|
6871
|
-
console.log(` ${
|
|
7075
|
+
const idPart = m.platformId ? chalk21.cyan(` id=${m.platformId}`) : "";
|
|
7076
|
+
console.log(` ${chalk21.green(m.file)}:${chalk21.yellow(String(m.line))} ${chalk21.magenta(m.type)}${idPart}`);
|
|
6872
7077
|
}
|
|
6873
7078
|
console.log();
|
|
6874
7079
|
}
|
|
6875
|
-
console.log(
|
|
6876
|
-
console.log(` ${
|
|
6877
|
-
console.log(
|
|
7080
|
+
console.log(chalk21.dim(" ─────────────────────────────────"));
|
|
7081
|
+
console.log(` ${chalk21.bold("Summary:")} ${String(result.prompts.length)} prompts, ${String(result.datasets.length)} datasets, ${String(result.markers.length)} markers`);
|
|
7082
|
+
console.log(chalk21.dim(` Saved to .mutagent/mutation-context.md`));
|
|
6878
7083
|
console.log();
|
|
6879
7084
|
}
|
|
6880
7085
|
} catch (error) {
|
|
@@ -6886,7 +7091,7 @@ Scanning ${scanPath}...
|
|
|
6886
7091
|
|
|
6887
7092
|
// src/commands/skills.ts
|
|
6888
7093
|
import { Command as Command16 } from "commander";
|
|
6889
|
-
import
|
|
7094
|
+
import chalk22 from "chalk";
|
|
6890
7095
|
import { existsSync as existsSync13, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
6891
7096
|
import { join as join7 } from "path";
|
|
6892
7097
|
import { execSync as execSync4 } from "child_process";
|
|
@@ -7009,7 +7214,7 @@ function createSkillsCommand() {
|
|
|
7009
7214
|
const skills = new Command16("skills").description("Manage MutagenT CLI skills for coding agents");
|
|
7010
7215
|
skills.command("install").description("Install MutagenT CLI skill for Claude Code").addHelpText("after", `
|
|
7011
7216
|
Examples:
|
|
7012
|
-
${
|
|
7217
|
+
${chalk22.dim("$")} mutagent skills install
|
|
7013
7218
|
|
|
7014
7219
|
This creates a Claude Code skill at .claude/skills/mutagent-cli/SKILL.md
|
|
7015
7220
|
that teaches coding agents how to use the MutagenT CLI effectively.
|
|
@@ -7036,10 +7241,10 @@ ${SKILL_BODY}
|
|
|
7036
7241
|
});
|
|
7037
7242
|
} else {
|
|
7038
7243
|
output.success(`Installed MutagenT CLI skill`);
|
|
7039
|
-
console.log(` ${
|
|
7244
|
+
console.log(` ${chalk22.dim("Path:")} ${skillPath}`);
|
|
7040
7245
|
console.log("");
|
|
7041
|
-
console.log(` ${
|
|
7042
|
-
console.log(` ${
|
|
7246
|
+
console.log(` ${chalk22.dim("This skill teaches coding agents how to use the MutagenT CLI.")}`);
|
|
7247
|
+
console.log(` ${chalk22.dim("It will be automatically loaded by Claude Code when relevant triggers match.")}`);
|
|
7043
7248
|
}
|
|
7044
7249
|
});
|
|
7045
7250
|
return skills;
|
|
@@ -7048,7 +7253,7 @@ ${SKILL_BODY}
|
|
|
7048
7253
|
// src/commands/usage.ts
|
|
7049
7254
|
init_config();
|
|
7050
7255
|
import { Command as Command17 } from "commander";
|
|
7051
|
-
import
|
|
7256
|
+
import chalk23 from "chalk";
|
|
7052
7257
|
init_errors();
|
|
7053
7258
|
init_sdk_client();
|
|
7054
7259
|
var TRIAL_OPTIMIZATION_LIMIT = 5;
|
|
@@ -7064,8 +7269,8 @@ function renderProgressBar(used, limit, width = 30) {
|
|
|
7064
7269
|
function createUsageCommand() {
|
|
7065
7270
|
const usage = new Command17("usage").description("Show resource counts and optimization run limits").addHelpText("after", `
|
|
7066
7271
|
Examples:
|
|
7067
|
-
${
|
|
7068
|
-
${
|
|
7272
|
+
${chalk23.dim("$")} mutagent usage
|
|
7273
|
+
${chalk23.dim("$")} mutagent usage --json
|
|
7069
7274
|
`);
|
|
7070
7275
|
usage.action(async () => {
|
|
7071
7276
|
const isJson = getJsonFlag(usage);
|
|
@@ -7120,21 +7325,21 @@ Examples:
|
|
|
7120
7325
|
});
|
|
7121
7326
|
} else {
|
|
7122
7327
|
console.log("");
|
|
7123
|
-
console.log(
|
|
7124
|
-
console.log(
|
|
7328
|
+
console.log(chalk23.bold("\uD83D\uDCCA MutagenT Usage"));
|
|
7329
|
+
console.log(chalk23.dim("─".repeat(45)));
|
|
7125
7330
|
console.log("");
|
|
7126
|
-
console.log(
|
|
7127
|
-
console.log(` Prompts: ${
|
|
7128
|
-
console.log(` Datasets: ${
|
|
7129
|
-
console.log(` Evaluations: ${
|
|
7331
|
+
console.log(chalk23.bold("Resources:"));
|
|
7332
|
+
console.log(` Prompts: ${chalk23.cyan(String(promptCount))}`);
|
|
7333
|
+
console.log(` Datasets: ${chalk23.cyan(String(datasetCount))}`);
|
|
7334
|
+
console.log(` Evaluations: ${chalk23.cyan(String(evaluationCount))}`);
|
|
7130
7335
|
console.log("");
|
|
7131
|
-
console.log(
|
|
7132
|
-
console.log(` Remaining: ${
|
|
7336
|
+
console.log(chalk23.bold(`Optimization Runs (${chalk23.yellow("trial")} plan):`));
|
|
7337
|
+
console.log(` Remaining: ${chalk23.cyan(String(optimizationRemaining))} / ${String(optimizationLimit)}`);
|
|
7133
7338
|
console.log(` ${renderProgressBar(optimizationUsed, optimizationLimit)}`);
|
|
7134
7339
|
console.log("");
|
|
7135
|
-
console.log(
|
|
7136
|
-
console.log(
|
|
7137
|
-
console.log(` Upgrade: ${
|
|
7340
|
+
console.log(chalk23.yellow(` ⚠ ${String(optimizationRemaining)} optimization runs remaining`));
|
|
7341
|
+
console.log(chalk23.dim(` ℹ Optimization run counts are approximate`));
|
|
7342
|
+
console.log(` Upgrade: ${chalk23.underline(BILLING_URL)}`);
|
|
7138
7343
|
console.log("");
|
|
7139
7344
|
}
|
|
7140
7345
|
} catch (error) {
|
|
@@ -7166,46 +7371,46 @@ program.name("mutagent").description(`MutagenT CLI - AI-native prompt optimizati
|
|
|
7166
7371
|
showGlobalOptions: true
|
|
7167
7372
|
});
|
|
7168
7373
|
program.addHelpText("after", `
|
|
7169
|
-
${
|
|
7170
|
-
export MUTAGENT_API_KEY=mt_... ${
|
|
7171
|
-
--json ${
|
|
7172
|
-
|
|
7173
|
-
${
|
|
7174
|
-
mutagent auth login --browser ${
|
|
7175
|
-
mutagent auth status ${
|
|
7176
|
-
mutagent init ${
|
|
7177
|
-
mutagent explore ${
|
|
7178
|
-
mutagent workspaces list --json ${
|
|
7179
|
-
mutagent config set workspace <id> ${
|
|
7180
|
-
mutagent usage --json ${
|
|
7181
|
-
|
|
7182
|
-
mutagent prompts create --help ${
|
|
7183
|
-
mutagent prompts list --json ${
|
|
7184
|
-
mutagent prompts get <id> --json ${
|
|
7185
|
-
|
|
7186
|
-
mutagent prompts dataset add --help ${
|
|
7187
|
-
mutagent prompts dataset list <id> ${
|
|
7188
|
-
|
|
7189
|
-
mutagent prompts evaluation create --help ${
|
|
7190
|
-
mutagent prompts evaluation create <id> --guided --json ${
|
|
7191
|
-
mutagent prompts evaluation list <id> --json ${
|
|
7192
|
-
|
|
7193
|
-
mutagent prompts optimize start --help ${
|
|
7194
|
-
mutagent prompts optimize status <job-id> ${
|
|
7195
|
-
mutagent prompts optimize results <job-id> ${
|
|
7196
|
-
|
|
7197
|
-
mutagent integrate <framework> ${
|
|
7198
|
-
mutagent playground run <id> --input '{...}' ${
|
|
7199
|
-
|
|
7200
|
-
${
|
|
7201
|
-
1. mutagent prompts create --help ${
|
|
7202
|
-
2. mutagent prompts create ... --json ${
|
|
7203
|
-
3. mutagent prompts dataset add --help ${
|
|
7204
|
-
4. mutagent prompts dataset add <id> ... --json ${
|
|
7205
|
-
5. mutagent prompts evaluation create <id> --guided --json ${
|
|
7374
|
+
${chalk24.yellow("Non-Interactive Mode (CI/CD & Coding Agents):")}
|
|
7375
|
+
export MUTAGENT_API_KEY=mt_... ${chalk24.dim("or")} --api-key mt_...
|
|
7376
|
+
--json ${chalk24.dim("for structured output")} --non-interactive ${chalk24.dim("to disable prompts")}
|
|
7377
|
+
|
|
7378
|
+
${chalk24.yellow("Command Navigation:")}
|
|
7379
|
+
mutagent auth login --browser ${chalk24.dim("Authenticate (OAuth)")}
|
|
7380
|
+
mutagent auth status ${chalk24.dim("Check auth + workspace")}
|
|
7381
|
+
mutagent init ${chalk24.dim("Initialize project (.mutagentrc.json)")}
|
|
7382
|
+
mutagent explore ${chalk24.dim("Discover prompts in codebase")}
|
|
7383
|
+
mutagent workspaces list --json ${chalk24.dim("List workspaces (verify ID)")}
|
|
7384
|
+
mutagent config set workspace <id> ${chalk24.dim("Set active workspace")}
|
|
7385
|
+
mutagent usage --json ${chalk24.dim("Check plan limits")}
|
|
7386
|
+
|
|
7387
|
+
mutagent prompts create --help ${chalk24.dim("Upload prompt (read help first!)")}
|
|
7388
|
+
mutagent prompts list --json ${chalk24.dim("List prompts")}
|
|
7389
|
+
mutagent prompts get <id> --json ${chalk24.dim("Full prompt details + schemas")}
|
|
7390
|
+
|
|
7391
|
+
mutagent prompts dataset add --help ${chalk24.dim("Upload dataset (read help first!)")}
|
|
7392
|
+
mutagent prompts dataset list <id> ${chalk24.dim("List datasets")}
|
|
7393
|
+
|
|
7394
|
+
mutagent prompts evaluation create --help ${chalk24.dim("Create eval (read help first!)")}
|
|
7395
|
+
mutagent prompts evaluation create <id> --guided --json ${chalk24.dim("Guided eval workflow")}
|
|
7396
|
+
mutagent prompts evaluation list <id> --json ${chalk24.dim("List evaluations")}
|
|
7397
|
+
|
|
7398
|
+
mutagent prompts optimize start --help ${chalk24.dim("Run optimization (read help first!)")}
|
|
7399
|
+
mutagent prompts optimize status <job-id> ${chalk24.dim("Poll progress")}
|
|
7400
|
+
mutagent prompts optimize results <job-id> ${chalk24.dim("View scorecard")}
|
|
7401
|
+
|
|
7402
|
+
mutagent integrate <framework> ${chalk24.dim("Framework integration guide")}
|
|
7403
|
+
mutagent playground run <id> --input '{...}' ${chalk24.dim("Quick test")}
|
|
7404
|
+
|
|
7405
|
+
${chalk24.yellow("Workflow: Evaluate → Optimize:")}
|
|
7406
|
+
1. mutagent prompts create --help ${chalk24.dim("← read help")}
|
|
7407
|
+
2. mutagent prompts create ... --json ${chalk24.dim("← upload prompt with {variables} + inputSchema")}
|
|
7408
|
+
3. mutagent prompts dataset add --help ${chalk24.dim("← read help")}
|
|
7409
|
+
4. mutagent prompts dataset add <id> ... --json ${chalk24.dim("← upload dataset")}
|
|
7410
|
+
5. mutagent prompts evaluation create <id> --guided --json ${chalk24.dim("← guided eval")}
|
|
7206
7411
|
6. mutagent prompts optimize start <id> --dataset <d> --evaluation <e> --json
|
|
7207
7412
|
|
|
7208
|
-
${
|
|
7413
|
+
${chalk24.yellow("AI Agent Rules (MANDATORY for coding agents):")}
|
|
7209
7414
|
1. EVERY command MUST include --json (no exceptions)
|
|
7210
7415
|
2. Run <command> --help BEFORE first use of any command
|
|
7211
7416
|
3. Use --guided --json for evaluation creation (NEVER --guided alone)
|
|
@@ -7214,9 +7419,9 @@ ${chalk23.yellow("AI Agent Rules (MANDATORY for coding agents):")}
|
|
|
7214
7419
|
6. Use {single_braces} for template variables in prompts
|
|
7215
7420
|
7. Collect evaluation rubrics from the user — NEVER auto-generate
|
|
7216
7421
|
${!hasCredentials() ? `
|
|
7217
|
-
` +
|
|
7422
|
+
` + chalk24.yellow(" Warning: Not authenticated. Run: mutagent auth login --browser") + `
|
|
7218
7423
|
` : ""}${!hasRcConfig() ? `
|
|
7219
|
-
` +
|
|
7424
|
+
` + chalk24.green(" Get started: mutagent init") + `
|
|
7220
7425
|
` : ""}`);
|
|
7221
7426
|
program.hook("preAction", (thisCommand) => {
|
|
7222
7427
|
const globalOpts = thisCommand.optsWithGlobals();
|
|
@@ -7246,5 +7451,5 @@ program.addCommand(createSkillsCommand());
|
|
|
7246
7451
|
program.addCommand(createUsageCommand());
|
|
7247
7452
|
program.parse();
|
|
7248
7453
|
|
|
7249
|
-
//# debugId=
|
|
7454
|
+
//# debugId=B35CD49159FCE51364756E2164756E21
|
|
7250
7455
|
//# sourceMappingURL=cli.js.map
|