Skip to content

Commit 6b29dbd

Browse files
committed
feat: improve agent-friendliness with flag and subcommand aliases
- search: accept --query as alias for --q - config set: accept positional args (mmx config set region global) - vision describe: accept --file and --path as aliases for --image - speech: register 'speech generate' as alias for 'speech synthesize' All original flags and commands remain unchanged.
1 parent 1ab305d commit 6b29dbd

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/commands/config/set.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ export default defineCommand({
3030
'mmx config set --key base_url --value https://api-uw.minimax.io',
3131
],
3232
async run(config: Config, flags: GlobalFlags) {
33-
const key = flags.key as string | undefined;
34-
const value = flags.value as string | undefined;
33+
const positional = flags._positional as string[] | undefined;
34+
const key = (flags.key as string | undefined) ?? positional?.[0];
35+
const value = (flags.value as string | undefined) ?? positional?.[1];
3536

3637
if (!key || value === undefined) {
3738
throw new CLIError(

src/commands/search/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default defineCommand({
3030
'mmx search query --q "latest news" --output json',
3131
],
3232
async run(config: Config, flags: GlobalFlags) {
33-
const query = (flags.q ?? (flags._positional as string[]|undefined)?.[0]) as string | undefined;
33+
const query = (flags.q ?? flags.query ?? (flags._positional as string[]|undefined)?.[0]) as string | undefined;
3434

3535
if (!query) {
3636
throw new CLIError(

src/commands/vision/describe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default defineCommand({
6767
'mmx vision describe --file-id file-123456789 --prompt "Extract the text"',
6868
],
6969
async run(config: Config, flags: GlobalFlags) {
70-
let image = (flags.image ?? (flags._positional as string[]|undefined)?.[0]) as string | undefined;
70+
let image = (flags.image ?? flags.file ?? flags.path ?? (flags._positional as string[]|undefined)?.[0]) as string | undefined;
7171
let fileId = flags.fileId as string | undefined;
7272
const prompt = (flags.prompt as string) || 'Describe the image.';
7373

src/registry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ export const registry = new CommandRegistry({
269269
'auth logout': authLogout,
270270
'text chat': textChat,
271271
'speech synthesize': speechSynthesize,
272+
'speech generate': speechSynthesize,
272273
'speech voices': speechVoices,
273274
'image generate': imageGenerate,
274275
'video generate': videoGenerate,

0 commit comments

Comments
 (0)