@mutagent/cli 0.1.200 → 0.1.202
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 +94 -95
- package/dist/bin/cli.js.map +8 -7
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -945,7 +945,6 @@ import { writeFileSync as writeFileSync2 } from "fs";
|
|
|
945
945
|
|
|
946
946
|
// src/lib/framework-detection.ts
|
|
947
947
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
948
|
-
import { execSync } from "child_process";
|
|
949
948
|
import { join as join3 } from "path";
|
|
950
949
|
var FRAMEWORK_DETECTION_MAP = {
|
|
951
950
|
"@mastra/core": {
|
|
@@ -956,32 +955,27 @@ var FRAMEWORK_DETECTION_MAP = {
|
|
|
956
955
|
"@langchain/langgraph": {
|
|
957
956
|
name: "langgraph",
|
|
958
957
|
displayName: "LangGraph",
|
|
959
|
-
npmPackage: "@langchain/langgraph"
|
|
960
|
-
mutagentPackage: "@mutagent/langgraph"
|
|
958
|
+
npmPackage: "@langchain/langgraph"
|
|
961
959
|
},
|
|
962
960
|
langchain: {
|
|
963
961
|
name: "langchain",
|
|
964
962
|
displayName: "LangChain",
|
|
965
|
-
npmPackage: "langchain"
|
|
966
|
-
mutagentPackage: "@mutagent/langchain"
|
|
963
|
+
npmPackage: "langchain"
|
|
967
964
|
},
|
|
968
965
|
"@langchain/core": {
|
|
969
966
|
name: "langchain",
|
|
970
967
|
displayName: "LangChain",
|
|
971
|
-
npmPackage: "@langchain/core"
|
|
972
|
-
mutagentPackage: "@mutagent/langchain"
|
|
968
|
+
npmPackage: "@langchain/core"
|
|
973
969
|
},
|
|
974
970
|
"@ai-sdk/core": {
|
|
975
971
|
name: "vercel-ai",
|
|
976
972
|
displayName: "Vercel AI SDK",
|
|
977
|
-
npmPackage: "@ai-sdk/core"
|
|
978
|
-
mutagentPackage: "@mutagent/vercel-ai"
|
|
973
|
+
npmPackage: "@ai-sdk/core"
|
|
979
974
|
},
|
|
980
975
|
ai: {
|
|
981
976
|
name: "vercel-ai",
|
|
982
977
|
displayName: "Vercel AI SDK",
|
|
983
|
-
npmPackage: "ai"
|
|
984
|
-
mutagentPackage: "@mutagent/vercel-ai"
|
|
978
|
+
npmPackage: "ai"
|
|
985
979
|
},
|
|
986
980
|
"@google/genai": {
|
|
987
981
|
name: "generic",
|
|
@@ -991,40 +985,9 @@ var FRAMEWORK_DETECTION_MAP = {
|
|
|
991
985
|
openai: {
|
|
992
986
|
name: "openai",
|
|
993
987
|
displayName: "OpenAI SDK",
|
|
994
|
-
npmPackage: "openai"
|
|
995
|
-
mutagentPackage: "@mutagent/openai"
|
|
988
|
+
npmPackage: "openai"
|
|
996
989
|
}
|
|
997
990
|
};
|
|
998
|
-
function detectPackageManager(cwd = process.cwd()) {
|
|
999
|
-
if (existsSync3(join3(cwd, "bun.lockb")) || existsSync3(join3(cwd, "bun.lock"))) {
|
|
1000
|
-
return "bun";
|
|
1001
|
-
}
|
|
1002
|
-
if (existsSync3(join3(cwd, "pnpm-lock.yaml"))) {
|
|
1003
|
-
return "pnpm";
|
|
1004
|
-
}
|
|
1005
|
-
if (existsSync3(join3(cwd, "yarn.lock"))) {
|
|
1006
|
-
return "yarn";
|
|
1007
|
-
}
|
|
1008
|
-
if (existsSync3(join3(cwd, "package-lock.json"))) {
|
|
1009
|
-
return "npm";
|
|
1010
|
-
}
|
|
1011
|
-
try {
|
|
1012
|
-
execSync("bun --version", { stdio: "ignore" });
|
|
1013
|
-
return "bun";
|
|
1014
|
-
} catch {
|
|
1015
|
-
return "npm";
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
function getInstallCommand(pm, packages) {
|
|
1019
|
-
const pkgList = packages.join(" ");
|
|
1020
|
-
const commands = {
|
|
1021
|
-
bun: `bun add ${pkgList}`,
|
|
1022
|
-
npm: `npm install ${pkgList}`,
|
|
1023
|
-
yarn: `yarn add ${pkgList}`,
|
|
1024
|
-
pnpm: `pnpm add ${pkgList}`
|
|
1025
|
-
};
|
|
1026
|
-
return commands[pm];
|
|
1027
|
-
}
|
|
1028
991
|
function detectFrameworkFromPackageJson(cwd = process.cwd()) {
|
|
1029
992
|
const pkgPath = join3(cwd, "package.json");
|
|
1030
993
|
if (!existsSync3(pkgPath)) {
|
|
@@ -2767,7 +2730,6 @@ init_config();
|
|
|
2767
2730
|
import { Command as Command6 } from "commander";
|
|
2768
2731
|
import inquirer2 from "inquirer";
|
|
2769
2732
|
import chalk12 from "chalk";
|
|
2770
|
-
import { execSync as execSync2 } from "child_process";
|
|
2771
2733
|
init_errors();
|
|
2772
2734
|
function createInitCommand() {
|
|
2773
2735
|
const init = new Command6("init").description("Initialize MutagenT in your project").option("--non-interactive", "Skip interactive prompts (defaults to CLI-only mode)").addHelpText("after", `
|
|
@@ -2776,7 +2738,6 @@ Examples:
|
|
|
2776
2738
|
${chalk12.dim("$")} mutagent init --non-interactive # CLI-only mode (no prompts)
|
|
2777
2739
|
|
|
2778
2740
|
Modes:
|
|
2779
|
-
${chalk12.bold("Full scaffold")} Install SDK + integration package, create config, setup tracing
|
|
2780
2741
|
${chalk12.bold("CLI-only")} Verify auth + create .mutagentrc.json with workspace/endpoint
|
|
2781
2742
|
${chalk12.bold("Skip")} Exit without changes
|
|
2782
2743
|
`).action(async (options) => {
|
|
@@ -2868,10 +2829,6 @@ Modes:
|
|
|
2868
2829
|
output.info("No AI framework detected in package.json.");
|
|
2869
2830
|
}
|
|
2870
2831
|
const modeChoices = [
|
|
2871
|
-
...confirmedFramework?.mutagentPackage ? [{
|
|
2872
|
-
name: `Full scaffold - Install @mutagent/sdk + ${confirmedFramework.mutagentPackage}, create config, setup tracing`,
|
|
2873
|
-
value: "full"
|
|
2874
|
-
}] : [],
|
|
2875
2832
|
{
|
|
2876
2833
|
name: "CLI-only - Verify auth + create .mutagentrc.json config",
|
|
2877
2834
|
value: "cli-only"
|
|
@@ -2932,53 +2889,22 @@ Modes:
|
|
|
2932
2889
|
...resolvedOrgId ? { defaultOrganization: resolvedOrgId } : {},
|
|
2933
2890
|
...confirmedFramework ? { framework: confirmedFramework.name } : {}
|
|
2934
2891
|
};
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
execSync2(installCmd, { cwd, stdio: "inherit" });
|
|
2943
|
-
output.success("Packages installed successfully.");
|
|
2944
|
-
} catch {
|
|
2945
|
-
output.error("Package installation failed. You can install manually:");
|
|
2946
|
-
output.info(` ${installCmd}`);
|
|
2947
|
-
}
|
|
2948
|
-
writeRcConfig(rcConfig, cwd);
|
|
2949
|
-
output.success("Created .mutagentrc.json");
|
|
2950
|
-
if (!isJson && workspaceValidation) {
|
|
2951
|
-
if (workspaceValidation.corrected) {
|
|
2952
|
-
output.warn(`Workspace auto-corrected to: ${workspaceValidation.name} (${workspaceValidation.id})`);
|
|
2953
|
-
} else {
|
|
2954
|
-
output.info(`Workspace: ${workspaceValidation.name} (${workspaceValidation.id})`);
|
|
2955
|
-
}
|
|
2892
|
+
writeRcConfig(rcConfig, cwd);
|
|
2893
|
+
output.success("Created .mutagentrc.json");
|
|
2894
|
+
if (!isJson && workspaceValidation) {
|
|
2895
|
+
if (workspaceValidation.corrected) {
|
|
2896
|
+
output.warn(`Workspace auto-corrected to: ${workspaceValidation.name} (${workspaceValidation.id})`);
|
|
2897
|
+
} else {
|
|
2898
|
+
output.info(`Workspace: ${workspaceValidation.name} (${workspaceValidation.id})`);
|
|
2956
2899
|
}
|
|
2900
|
+
}
|
|
2901
|
+
if (!authenticated) {
|
|
2902
|
+
output.info("Next: mutagent auth login --browser");
|
|
2903
|
+
} else {
|
|
2904
|
+
output.info('Ready! Run "mutagent --help" to see available commands.');
|
|
2957
2905
|
if (!isJson) {
|
|
2958
2906
|
output.info("Verify workspace: mutagent workspaces list --json");
|
|
2959
2907
|
}
|
|
2960
|
-
console.log("");
|
|
2961
|
-
output.info("Next steps:");
|
|
2962
|
-
output.info(` 1. Add MutagenT tracing to your ${confirmedFramework.name} code via ${confirmedFramework.mutagentPackage}`);
|
|
2963
|
-
output.info(" 2. Run: mutagent providers list (confirm an LLM provider is configured)");
|
|
2964
|
-
} else {
|
|
2965
|
-
writeRcConfig(rcConfig, cwd);
|
|
2966
|
-
output.success("Created .mutagentrc.json");
|
|
2967
|
-
if (!isJson && workspaceValidation) {
|
|
2968
|
-
if (workspaceValidation.corrected) {
|
|
2969
|
-
output.warn(`Workspace auto-corrected to: ${workspaceValidation.name} (${workspaceValidation.id})`);
|
|
2970
|
-
} else {
|
|
2971
|
-
output.info(`Workspace: ${workspaceValidation.name} (${workspaceValidation.id})`);
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
if (!authenticated) {
|
|
2975
|
-
output.info("Next: mutagent auth login --browser");
|
|
2976
|
-
} else {
|
|
2977
|
-
output.info('Ready! Run "mutagent --help" to see available commands.');
|
|
2978
|
-
if (!isJson) {
|
|
2979
|
-
output.info("Verify workspace: mutagent workspaces list --json");
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
2908
|
}
|
|
2983
2909
|
const initDirective = {
|
|
2984
2910
|
instruction: "Verify workspace. Run: mutagent workspaces list --json",
|
|
@@ -3007,7 +2933,7 @@ import { Command as Command7 } from "commander";
|
|
|
3007
2933
|
import chalk13 from "chalk";
|
|
3008
2934
|
import { existsSync as existsSync6, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
3009
2935
|
import { dirname, join as join7 } from "path";
|
|
3010
|
-
import { execSync
|
|
2936
|
+
import { execSync } from "child_process";
|
|
3011
2937
|
|
|
3012
2938
|
// src/generated/skill-content.ts
|
|
3013
2939
|
var SKILL_FILES = {
|
|
@@ -3622,7 +3548,7 @@ var SKILL_CONTENT = SKILL_FILES["SKILL.md"] ?? "";
|
|
|
3622
3548
|
// src/commands/skills.ts
|
|
3623
3549
|
function findRepoRoot() {
|
|
3624
3550
|
try {
|
|
3625
|
-
return
|
|
3551
|
+
return execSync("git rev-parse --show-toplevel", {
|
|
3626
3552
|
encoding: "utf-8",
|
|
3627
3553
|
stdio: ["pipe", "pipe", "pipe"]
|
|
3628
3554
|
}).trim();
|
|
@@ -5050,6 +4976,78 @@ ${chalk17.yellow("Note:")} install is login-gated. Run ${chalk17.cyan("mutagent
|
|
|
5050
4976
|
|
|
5051
4977
|
// src/bin/cli.ts
|
|
5052
4978
|
init_config();
|
|
4979
|
+
|
|
4980
|
+
// src/lib/brand.ts
|
|
4981
|
+
var BRAND = {
|
|
4982
|
+
name: "MUTAGENT",
|
|
4983
|
+
primary: "#7E47D7",
|
|
4984
|
+
accent: "#45b8cc",
|
|
4985
|
+
gradientFrom: "#45b8cc",
|
|
4986
|
+
gradientTo: "#7E47D7",
|
|
4987
|
+
voice: "Agent Development Life Cycle — spec · build · evaluate · diagnose · optimize"
|
|
4988
|
+
};
|
|
4989
|
+
var WORDMARK = [
|
|
4990
|
+
" ███╗ ███╗ ██╗ ██╗ ████████╗ █████╗ ██████╗ ███████╗ ███╗ ██╗ ████████╗ ",
|
|
4991
|
+
" ████╗ ████║ ██║ ██║ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██╔════╝ ████╗ ██║ ╚══██╔══╝ ",
|
|
4992
|
+
" ██╔████╔██║ ██║ ██║ ██║ ███████║ ██║ ███╗ █████╗ ██╔██╗ ██║ ██║ ",
|
|
4993
|
+
" ██║╚██╔╝██║ ██║ ██║ ██║ ██╔══██║ ██║ ██║ ██╔══╝ ██║╚██╗██║ ██║ ",
|
|
4994
|
+
" ██║ ╚═╝ ██║ ╚██████╔╝ ██║ ██║ ██║ ╚██████╔╝ ███████╗ ██║ ╚████║ ██║ ",
|
|
4995
|
+
" ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═══╝ ╚═╝ "
|
|
4996
|
+
];
|
|
4997
|
+
var WORDMARK_MIN_COLUMNS = 84;
|
|
4998
|
+
function hexToRgb(hex) {
|
|
4999
|
+
const n = parseInt(hex.slice(1), 16);
|
|
5000
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
5001
|
+
}
|
|
5002
|
+
var lerp = (a, b, t) => Math.round(a + (b - a) * t);
|
|
5003
|
+
function mix(from, to, t) {
|
|
5004
|
+
return [lerp(from[0], to[0], t), lerp(from[1], to[1], t), lerp(from[2], to[2], t)];
|
|
5005
|
+
}
|
|
5006
|
+
var ansi = (r, g, b) => `\x1B[38;2;${r};${g};${b}m`;
|
|
5007
|
+
var RESET = "\x1B[0m";
|
|
5008
|
+
function gradientLine(line, from, to) {
|
|
5009
|
+
const chars = Array.from(line);
|
|
5010
|
+
const n = chars.length;
|
|
5011
|
+
let out = "";
|
|
5012
|
+
chars.forEach((ch, i) => {
|
|
5013
|
+
if (ch === " ") {
|
|
5014
|
+
out += ch;
|
|
5015
|
+
return;
|
|
5016
|
+
}
|
|
5017
|
+
const [r, g, b] = mix(from, to, n > 1 ? i / (n - 1) : 0);
|
|
5018
|
+
out += ansi(r, g, b) + ch;
|
|
5019
|
+
});
|
|
5020
|
+
return out + RESET;
|
|
5021
|
+
}
|
|
5022
|
+
function hasTruecolor(env = process.env) {
|
|
5023
|
+
return /truecolor|24bit/i.test(env.COLORTERM ?? "");
|
|
5024
|
+
}
|
|
5025
|
+
function detectBannerEnv(stream = process.stdout, env = process.env) {
|
|
5026
|
+
return {
|
|
5027
|
+
isTTY: stream.isTTY === true,
|
|
5028
|
+
columns: stream.columns ?? 80,
|
|
5029
|
+
truecolor: hasTruecolor(env),
|
|
5030
|
+
disabled: env.MUTAGENT_NO_BANNER === "1"
|
|
5031
|
+
};
|
|
5032
|
+
}
|
|
5033
|
+
function renderBanner(env = detectBannerEnv()) {
|
|
5034
|
+
if (env.disabled || !env.isTTY)
|
|
5035
|
+
return "";
|
|
5036
|
+
const from = hexToRgb(BRAND.gradientFrom);
|
|
5037
|
+
const to = hexToRgb(BRAND.gradientTo);
|
|
5038
|
+
const wide = env.columns >= WORDMARK_MIN_COLUMNS;
|
|
5039
|
+
const art = wide ? WORDMARK : [` ${BRAND.name}`];
|
|
5040
|
+
const lines = env.truecolor ? art.map((l) => gradientLine(l, from, to)) : art.map((l) => `${ansi(...from)}${l}${RESET}`);
|
|
5041
|
+
if (wide) {
|
|
5042
|
+
lines.push(env.truecolor ? gradientLine(` ${BRAND.voice}`, from, to) : `\x1B[90m ${BRAND.voice}${RESET}`);
|
|
5043
|
+
}
|
|
5044
|
+
return `
|
|
5045
|
+
${lines.join(`
|
|
5046
|
+
`)}
|
|
5047
|
+
`;
|
|
5048
|
+
}
|
|
5049
|
+
|
|
5050
|
+
// src/bin/cli.ts
|
|
5053
5051
|
var cliVersion = "0.1.1";
|
|
5054
5052
|
if (process.env.CLI_VERSION) {
|
|
5055
5053
|
cliVersion = process.env.CLI_VERSION;
|
|
@@ -5070,6 +5068,7 @@ program.name("mutagent").description(`MutagenT CLI - command-line client for the
|
|
|
5070
5068
|
sortSubcommands: true,
|
|
5071
5069
|
showGlobalOptions: true
|
|
5072
5070
|
});
|
|
5071
|
+
program.addHelpText("beforeAll", () => renderBanner());
|
|
5073
5072
|
program.addHelpText("after", `
|
|
5074
5073
|
${chalk18.bold.cyan("WORKFLOWS:")}
|
|
5075
5074
|
${chalk18.bold("Setup")} mutagent login → mutagent init
|
|
@@ -5171,5 +5170,5 @@ program.addCommand(createInstallCommand());
|
|
|
5171
5170
|
program.addCommand(createFeedbackCommand());
|
|
5172
5171
|
program.parse();
|
|
5173
5172
|
|
|
5174
|
-
//# debugId=
|
|
5173
|
+
//# debugId=A51690709331539564756E2164756E21
|
|
5175
5174
|
//# sourceMappingURL=cli.js.map
|