@mutagent/cli 0.1.249 → 0.1.251
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 +35 -5
- package/dist/bin/cli.js.map +8 -7
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -1214,7 +1214,7 @@ async function installHelix(opts, deps = {}) {
|
|
|
1214
1214
|
await extract(tgzPath, versionDir);
|
|
1215
1215
|
const locateInitBin = deps.locateInitBin ?? defaultLocateInitBin;
|
|
1216
1216
|
const binPath = await locateInitBin(versionDir);
|
|
1217
|
-
const initArgs = ["init"];
|
|
1217
|
+
const initArgs = ["init", "--yes"];
|
|
1218
1218
|
const runInit = deps.runInit ?? defaultRunInit;
|
|
1219
1219
|
const code = await runInit(binPath, initArgs, process.cwd());
|
|
1220
1220
|
if (code !== 0) {
|
|
@@ -1466,7 +1466,7 @@ async function installPackage(pkg, opts, deps = {}) {
|
|
|
1466
1466
|
const initBin = await (deps.locateInitBin ?? defaultLocateInitBin)(pkgDir);
|
|
1467
1467
|
const countFiles = deps.countProjectFiles ?? countProjectFiles;
|
|
1468
1468
|
const before = countFiles(projectPath);
|
|
1469
|
-
const initCode = await (deps.runInit ?? defaultRunInit)(initBin, ["init"], projectPath);
|
|
1469
|
+
const initCode = await (deps.runInit ?? defaultRunInit)(initBin, ["init", "--yes"], projectPath);
|
|
1470
1470
|
const landed = countFiles(projectPath) > before;
|
|
1471
1471
|
return finish({
|
|
1472
1472
|
package: pkg,
|
|
@@ -6055,6 +6055,32 @@ ${lines.join(`
|
|
|
6055
6055
|
`;
|
|
6056
6056
|
}
|
|
6057
6057
|
|
|
6058
|
+
// src/lib/global-version-flag.ts
|
|
6059
|
+
var GLOBAL_VALUE_OPTIONS = new Set(["--api-key", "--endpoint"]);
|
|
6060
|
+
function findSubcommandIndex(rawArgs) {
|
|
6061
|
+
for (let i = 0;i < rawArgs.length; i++) {
|
|
6062
|
+
const arg = rawArgs[i];
|
|
6063
|
+
if (arg === undefined)
|
|
6064
|
+
continue;
|
|
6065
|
+
if (arg === "--")
|
|
6066
|
+
return i + 1 < rawArgs.length ? i + 1 : -1;
|
|
6067
|
+
if (arg.startsWith("-")) {
|
|
6068
|
+
if (GLOBAL_VALUE_OPTIONS.has(arg))
|
|
6069
|
+
i++;
|
|
6070
|
+
continue;
|
|
6071
|
+
}
|
|
6072
|
+
return i;
|
|
6073
|
+
}
|
|
6074
|
+
return -1;
|
|
6075
|
+
}
|
|
6076
|
+
function isGlobalVersionFlag(rawArgs) {
|
|
6077
|
+
const versionAt = rawArgs.findIndex((a) => a === "-v" || a === "--version");
|
|
6078
|
+
if (versionAt === -1)
|
|
6079
|
+
return false;
|
|
6080
|
+
const subcommandAt = findSubcommandIndex(rawArgs);
|
|
6081
|
+
return subcommandAt === -1 || versionAt < subcommandAt;
|
|
6082
|
+
}
|
|
6083
|
+
|
|
6058
6084
|
// src/bin/cli.ts
|
|
6059
6085
|
var cliVersion = "0.1.1";
|
|
6060
6086
|
if (process.env.CLI_VERSION) {
|
|
@@ -6072,7 +6098,7 @@ var program = new Command13;
|
|
|
6072
6098
|
program.name("mutagent").description(`Mutagent CLI - command-line client for the Mutagent platform
|
|
6073
6099
|
|
|
6074
6100
|
Documentation: https://docs.mutagent.io/cli
|
|
6075
|
-
Dashboard: https://app.mutagent.io`).option("
|
|
6101
|
+
Dashboard: https://app.mutagent.io`).option("--json", "Output results as JSON (for AI agents)").option("--api-key <key>", "Mutagent API key").option("--endpoint <url>", "Mutagent server endpoint").option("--non-interactive", "Disable interactive prompts (for CI/AI agents)").configureHelp({
|
|
6076
6102
|
sortSubcommands: true,
|
|
6077
6103
|
showGlobalOptions: true
|
|
6078
6104
|
});
|
|
@@ -6086,6 +6112,10 @@ ${chalk19.bold.cyan("WORKFLOWS:")}
|
|
|
6086
6112
|
${chalk19.dim("For CLI usage guidance for AI agents, see the Skill at")}
|
|
6087
6113
|
${chalk19.cyan(".claude/skills/mutagent-cli/SKILL.md")}
|
|
6088
6114
|
|
|
6115
|
+
${chalk19.yellow("Global flags:")}
|
|
6116
|
+
-v, --version ${chalk19.dim("Print the CLI version")} ${chalk19.dim("(before a subcommand; after one it is the subcommand's)")}
|
|
6117
|
+
--json --api-key <k> --endpoint <url> --non-interactive
|
|
6118
|
+
|
|
6089
6119
|
${chalk19.yellow("Non-Interactive Mode (CI/CD & Coding Agents):")}
|
|
6090
6120
|
export MUTAGENT_API_KEY=mt_... ${chalk19.dim("or")} --api-key mt_...
|
|
6091
6121
|
--json ${chalk19.dim("for structured output")} --non-interactive ${chalk19.dim("to disable prompts")}
|
|
@@ -6142,7 +6172,7 @@ ${!hasCredentials() ? `
|
|
|
6142
6172
|
` + chalk19.green(" Get started: mutagent init") + `
|
|
6143
6173
|
` : ""}`);
|
|
6144
6174
|
var rawArgs = process.argv.slice(2);
|
|
6145
|
-
if (
|
|
6175
|
+
if (isGlobalVersionFlag(rawArgs)) {
|
|
6146
6176
|
if (rawArgs.includes("--json")) {
|
|
6147
6177
|
console.log(JSON.stringify({
|
|
6148
6178
|
version: cliVersion,
|
|
@@ -6179,5 +6209,5 @@ program.addCommand(createFeedbackCommand());
|
|
|
6179
6209
|
program.addCommand(createTraceCommand());
|
|
6180
6210
|
program.parse();
|
|
6181
6211
|
|
|
6182
|
-
//# debugId=
|
|
6212
|
+
//# debugId=B0E8F30FEF98BABD64756E2164756E21
|
|
6183
6213
|
//# sourceMappingURL=cli.js.map
|