Skip to content

Commit 0cda729

Browse files
Merge pull request #76 from raylanlin/pr/docs
feat(docs): add mmx help command + API doc links to --help
2 parents cbebc42 + c7a762d commit 0cda729

4 files changed

Lines changed: 44 additions & 0 deletions

File tree

src/commands/help.ts

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

src/commands/speech/synthesize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { SpeechRequest, SpeechResponse } from '../../types/api';
1414
export default defineCommand({
1515
name: 'speech synthesize',
1616
description: 'Synchronous TTS, up to 10k chars (speech-2.8-hd / 2.6 / 02)',
17+
apiDocs: '/docs/api-reference/speech-t2a-http',
1718
usage: 'mmx speech synthesize --text <text> [--out <path>] [flags]',
1819
options: [
1920
{ flag: '--model <model>', description: 'Model ID (default: speech-2.8-hd)' },

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: '/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/registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import configShow from './commands/config/show';
2323
import configSet from './commands/config/set';
2424
import configExportSchema from './commands/config/export-schema';
2525
import update from './commands/update';
26+
import help from './commands/help';
2627

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

@@ -282,4 +283,5 @@ export const registry = new CommandRegistry({
282283
'config set': configSet,
283284
'config export-schema': configExportSchema,
284285
'update': update,
286+
'help': help,
285287
});

0 commit comments

Comments
 (0)