Skip to content

Commit b52650d

Browse files
author
Raylan LIN
committed
feat(docs): add mmx help command + apiDocs to all commands
- New 'mmx help' command listing all official API doc links - Add apiDocs field to Command interface (command.ts) - Register apiDocs display in registry printCommandHelp - Add apiDocs to: text chat, speech synthesize, image generate, video generate, music generate, music cover - Update text chat --model: list all 7 models (M2.7/highspeed/M2.5/M2.5-highspeed/M2.1/M2/Text-01) - Update speech synthesize: 8 models (2.8/2.6/02/01 hd+turbo) - Update image description: image-01/image-01-live - Update video description: Hailuo-2.3/2.3-Fast/Hailuo-02
1 parent f07c4b3 commit b52650d

8 files changed

Lines changed: 56 additions & 4 deletions

File tree

src/command.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface Command {
1414
usage?: string;
1515
options?: OptionDef[];
1616
examples?: string[];
17+
apiDocs?: string;
1718
execute(config: Config, flags: GlobalFlags): Promise<void>;
1819
}
1920

@@ -23,6 +24,7 @@ export interface CommandSpec {
2324
usage?: string;
2425
options?: OptionDef[];
2526
examples?: string[];
27+
apiDocs?: string;
2628
run(config: Config, flags: GlobalFlags): Promise<void>;
2729
}
2830

@@ -33,6 +35,7 @@ export function defineCommand(spec: CommandSpec): Command {
3335
usage: spec.usage,
3436
options: spec.options,
3537
examples: spec.examples,
38+
apiDocs: spec.apiDocs,
3639
execute: spec.run,
3740
};
3841
}

src/commands/help.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { defineCommand } from '../command';
2+
import type { Config } from '../config/schema';
3+
import type { GlobalFlags } from '../types/flags';
4+
5+
interface ApiRef {
6+
command: string;
7+
title: string;
8+
url: string;
9+
}
10+
11+
const API_REFS: ApiRef[] = [
12+
{ command: 'mmx text chat', title: 'Text Generation (Chat Completion)', url: 'https://platform.minimax.io/docs/api-reference/text-post' },
13+
{ command: 'mmx speech synthesize', title: 'Speech T2A (Text-to-Audio)', url: 'https://platform.minimax.io/docs/api-reference/speech-t2a-http' },
14+
{ command: 'mmx image generate', title: 'Image Generation (T2I / I2I)', url: 'https://platform.minimax.io/docs/api-reference/image-generation-t2i' },
15+
{ command: 'mmx video generate', title: 'Video Generation (T2V / I2V / S2V)', url: 'https://platform.minimax.io/docs/api-reference/video-generation' },
16+
{ command: 'mmx music generate', title: 'Music Generation', url: 'https://platform.minimax.io/docs/api-reference/music-generation' },
17+
{ command: 'mmx music cover', title: 'Music Cover (via Music Generation)', url: 'https://platform.minimax.io/docs/api-reference/music-generation' },
18+
{ command: 'mmx search query', title: 'Web Search', url: 'https://platform.minimax.io/docs/api-reference/web-search' },
19+
{ command: 'mmx vision describe', title: 'Vision (Image Understanding)', url: 'https://platform.minimax.io/docs/api-reference/vision' },
20+
];
21+
22+
export default defineCommand({
23+
name: 'help',
24+
description: 'Show MiniMax API documentation links',
25+
usage: 'mmx help',
26+
apiDocs: 'https://platform.minimax.io/docs/api-reference',
27+
async run(_config: Config, _flags: GlobalFlags) {
28+
process.stdout.write(`
29+
MiniMax API Documentation Links
30+
31+
Official docs: https://platform.minimax.io/docs/api-reference
32+
33+
`);
34+
for (const ref of API_REFS) {
35+
process.stdout.write(` ${ref.command.padEnd(30)} ${ref.title}\n`);
36+
process.stdout.write(` ${' '.repeat(30)} ${ref.url}\n\n`);
37+
}
38+
},
39+
});

src/commands/image/generate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import { promptText, failIfMissing } from '../../utils/prompt';
1818

1919
export default defineCommand({
2020
name: 'image generate',
21-
description: 'Generate images (image-01)',
21+
description: 'Generate images (image-01 / image-01-live)',
22+
apiDocs: 'https://platform.minimax.io/docs/api-reference/image-generation-t2i',
2223
usage: 'mmx image generate --prompt <text> [flags]',
2324
options: [
2425
{ flag: '--prompt <text>', description: 'Image description', required: true },

src/commands/music/cover.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { musicCoverModel } from './models';
1313

1414
export default defineCommand({
1515
name: 'music cover',
16-
description: 'Generate a cover version of a song based on reference audio (music-cover-free)',
16+
description: 'Generate a cover version of a song based on reference audio (music-cover / music-cover-free)',
17+
apiDocs: 'https://platform.minimax.io/docs/api-reference/music-generation',
1718
usage: 'mmx music cover --prompt <text> (--audio <url> | --audio-file <path>) [--lyrics <text>] [--out <path>] [flags]',
1819
options: [
1920
{ flag: '--prompt <text>', description: 'Target cover style, e.g. "Indie folk, acoustic guitar, warm male vocal"' },

src/commands/music/generate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { musicGenerateModel } from './models';
1313

1414
export default defineCommand({
1515
name: 'music generate',
16-
description: 'Generate a song (music-2.6-free)',
16+
description: 'Generate a song (music-2.6 / music-2.6-free / music-2.5+ / music-2.5)',
17+
apiDocs: 'https://platform.minimax.io/docs/api-reference/music-generation',
1718
usage: 'mmx music generate --prompt <text> (--lyrics <text> | --instrumental | --lyrics-optimizer) [--out <path>] [flags]',
1819
options: [
1920
{ flag: '--prompt <text>', description: 'Music style description (can be detailed — see examples)' },

src/commands/text/chat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ function extractText(content: ContentBlock[]): string {
7878
export default defineCommand({
7979
name: 'text chat',
8080
description: 'Send a chat completion (MiniMax Messages API)',
81+
apiDocs: 'https://platform.minimax.io/docs/api-reference/text-post',
8182
usage: 'mmx text chat --message <text> [flags]',
8283
options: [
8384
{ flag: '--model <model>', description: 'Model ID (default: MiniMax-M2.7)' },

src/commands/video/generate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import { promptText, failIfMissing } from '../../utils/prompt';
2121

2222
export default defineCommand({
2323
name: 'video generate',
24-
description: 'Generate a video (Hailuo-2.3 / 2.3-Fast)',
24+
description: 'Generate a video (Hailuo-2.3 / 2.3-Fast / Hailuo-02)',
25+
apiDocs: 'https://platform.minimax.io/docs/api-reference/video-generation',
2526
usage: 'mmx video generate --prompt <text> [flags]',
2627
options: [
2728
{ flag: '--model <model>', description: 'Model ID (default: MiniMax-Hailuo-2.3)' },

src/registry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import configShow from './commands/config/show';
2222
import configSet from './commands/config/set';
2323
import configExportSchema from './commands/config/export-schema';
2424
import update from './commands/update';
25+
import help from './commands/help';
2526

2627
export type { Command, OptionDef } from './command';
2728

@@ -237,6 +238,9 @@ ${b('Getting Help:')}
237238
out.write(` ${d(ex)}\n`);
238239
}
239240
}
241+
if (cmd.apiDocs) {
242+
out.write(`\n${b('API Reference:')} ${d(cmd.apiDocs)}\n`);
243+
}
240244
out.write(`\n${d('Global flags (--api-key, --output, --quiet, etc.) are always available.')}\n`);
241245
out.write(`${d("Run")} mmx --help ${d('for the full list.')}\n`);
242246
}
@@ -278,4 +282,5 @@ export const registry = new CommandRegistry({
278282
'config set': configSet,
279283
'config export-schema': configExportSchema,
280284
'update': update,
285+
'help': help,
281286
});

0 commit comments

Comments
 (0)