Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/commands/help.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defineCommand } from '../command';
import { DOCS_HOSTS } from '../config/schema';
import type { Config } from '../config/schema';
import type { GlobalFlags } from '../types/flags';

interface ApiRef {
command: string;
title: string;
path: string;
}

const API_REFS: ApiRef[] = [
{ command: 'mmx text chat', title: 'Text Generation (Chat Completion)', path: '/docs/api-reference/text-post' },
{ command: 'mmx speech synthesize', title: 'Speech T2A (Text-to-Audio)', path: '/docs/api-reference/speech-t2a-http' },
{ command: 'mmx image generate', title: 'Image Generation (T2I / I2I)', path: '/docs/api-reference/image-generation-t2i' },
{ command: 'mmx video generate', title: 'Video Generation (T2V / I2V / S2V)', path: '/docs/api-reference/video-generation' },
{ command: 'mmx music generate', title: 'Music Generation', path: '/docs/api-reference/music-generation' },
{ command: 'mmx music cover', title: 'Music Cover (via Music Generation)', path: '/docs/api-reference/music-generation' },
{ command: 'mmx search query', title: 'Web Search', path: '/docs/api-reference/web-search' },
{ command: 'mmx vision describe', title: 'Vision (Image Understanding)', path: '/docs/api-reference/vision' },
];

export default defineCommand({
name: 'help',
description: 'Show MiniMax API documentation links',
usage: 'mmx help',
async run(config: Config, _flags: GlobalFlags) {
const host = DOCS_HOSTS[config.region] || DOCS_HOSTS.global;
process.stdout.write(`
MiniMax API Documentation Links

Official docs: ${host}/docs/api-reference

`);
for (const ref of API_REFS) {
process.stdout.write(` ${ref.command.padEnd(30)} ${ref.title}\n`);
process.stdout.write(` ${' '.repeat(30)} ${host}${ref.path}\n\n`);
}
},
});
1 change: 1 addition & 0 deletions src/commands/speech/synthesize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { SpeechRequest, SpeechResponse } from '../../types/api';
export default defineCommand({
name: 'speech synthesize',
description: 'Synchronous TTS, up to 10k chars (speech-2.8-hd / 2.6 / 02)',
apiDocs: '/docs/api-reference/speech-t2a-http',
usage: 'mmx speech synthesize --text <text> [--out <path>] [flags]',
options: [
{ flag: '--model <model>', description: 'Model ID (default: speech-2.8-hd)' },
Expand Down
1 change: 1 addition & 0 deletions src/commands/text/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function extractText(content: ContentBlock[]): string {
export default defineCommand({
name: 'text chat',
description: 'Send a chat completion (MiniMax Messages API)',
apiDocs: '/docs/api-reference/text-post',
usage: 'mmx text chat --message <text> [flags]',
options: [
{ flag: '--model <model>', description: 'Model ID (default: MiniMax-M2.7)' },
Expand Down
2 changes: 2 additions & 0 deletions src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import configShow from './commands/config/show';
import configSet from './commands/config/set';
import configExportSchema from './commands/config/export-schema';
import update from './commands/update';
import help from './commands/help';

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

Expand Down Expand Up @@ -282,4 +283,5 @@ export const registry = new CommandRegistry({
'config set': configSet,
'config export-schema': configExportSchema,
'update': update,
'help': help,
});
Loading