From d49f204bd64b34953455d1ef4923aebf66683ed0 Mon Sep 17 00:00:00 2001 From: Raylan LIN Date: Fri, 10 Apr 2026 16:47:32 +0800 Subject: [PATCH 1/2] 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 --- src/commands/help.ts | 39 +++++++++++++++++++++++++++++++++++++++ src/commands/text/chat.ts | 1 + src/registry.ts | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 src/commands/help.ts diff --git a/src/commands/help.ts b/src/commands/help.ts new file mode 100644 index 0000000..aa6506b --- /dev/null +++ b/src/commands/help.ts @@ -0,0 +1,39 @@ +import { defineCommand } from '../command'; +import type { Config } from '../config/schema'; +import type { GlobalFlags } from '../types/flags'; + +interface ApiRef { + command: string; + title: string; + url: string; +} + +const API_REFS: ApiRef[] = [ + { command: 'mmx text chat', title: 'Text Generation (Chat Completion)', url: 'https://platform.minimax.io/docs/api-reference/text-post' }, + { command: 'mmx speech synthesize', title: 'Speech T2A (Text-to-Audio)', url: 'https://platform.minimax.io/docs/api-reference/speech-t2a-http' }, + { command: 'mmx image generate', title: 'Image Generation (T2I / I2I)', url: 'https://platform.minimax.io/docs/api-reference/image-generation-t2i' }, + { command: 'mmx video generate', title: 'Video Generation (T2V / I2V / S2V)', url: 'https://platform.minimax.io/docs/api-reference/video-generation' }, + { command: 'mmx music generate', title: 'Music Generation', url: 'https://platform.minimax.io/docs/api-reference/music-generation' }, + { command: 'mmx music cover', title: 'Music Cover (via Music Generation)', url: 'https://platform.minimax.io/docs/api-reference/music-generation' }, + { command: 'mmx search query', title: 'Web Search', url: 'https://platform.minimax.io/docs/api-reference/web-search' }, + { command: 'mmx vision describe', title: 'Vision (Image Understanding)', url: 'https://platform.minimax.io/docs/api-reference/vision' }, +]; + +export default defineCommand({ + name: 'help', + description: 'Show MiniMax API documentation links', + usage: 'mmx help', + apiDocs: 'https://platform.minimax.io/docs/api-reference', + async run(_config: Config, _flags: GlobalFlags) { + process.stdout.write(` +MiniMax API Documentation Links + + Official docs: https://platform.minimax.io/docs/api-reference + +`); + for (const ref of API_REFS) { + process.stdout.write(` ${ref.command.padEnd(30)} ${ref.title}\n`); + process.stdout.write(` ${' '.repeat(30)} ${ref.url}\n\n`); + } + }, +}); diff --git a/src/commands/text/chat.ts b/src/commands/text/chat.ts index d5ed5fc..6594827 100644 --- a/src/commands/text/chat.ts +++ b/src/commands/text/chat.ts @@ -78,6 +78,7 @@ function extractText(content: ContentBlock[]): string { export default defineCommand({ name: 'text chat', description: 'Send a chat completion (MiniMax Messages API)', + apiDocs: 'https://platform.minimax.io/docs/api-reference/text-post', usage: 'mmx text chat --message [flags]', options: [ { flag: '--model ', description: 'Model ID (default: MiniMax-M2.7)' }, diff --git a/src/registry.ts b/src/registry.ts index 40dd97a..defe60a 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -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'; @@ -282,4 +283,5 @@ export const registry = new CommandRegistry({ 'config set': configSet, 'config export-schema': configExportSchema, 'update': update, + 'help': help, }); From c7a762dac52ba9e93818aaab489d4fb023cc8619 Mon Sep 17 00:00:00 2001 From: tars90percent Date: Fri, 10 Apr 2026 19:40:37 +0800 Subject: [PATCH 2/2] fix: apiDocs paths, region-aware help, add speech apiDocs - Change all apiDocs from full URLs to paths (works with DOCS_HOSTS) - Make help command region-aware using DOCS_HOSTS + config.region - Remove self-referential apiDocs from help command - Add missing apiDocs to speech/synthesize (was claimed in PR body) --- src/commands/help.ts | 27 ++++++++++++++------------- src/commands/speech/synthesize.ts | 1 + src/commands/text/chat.ts | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/commands/help.ts b/src/commands/help.ts index aa6506b..04a9937 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -1,39 +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; - url: string; + path: string; } const API_REFS: ApiRef[] = [ - { command: 'mmx text chat', title: 'Text Generation (Chat Completion)', url: 'https://platform.minimax.io/docs/api-reference/text-post' }, - { command: 'mmx speech synthesize', title: 'Speech T2A (Text-to-Audio)', url: 'https://platform.minimax.io/docs/api-reference/speech-t2a-http' }, - { command: 'mmx image generate', title: 'Image Generation (T2I / I2I)', url: 'https://platform.minimax.io/docs/api-reference/image-generation-t2i' }, - { command: 'mmx video generate', title: 'Video Generation (T2V / I2V / S2V)', url: 'https://platform.minimax.io/docs/api-reference/video-generation' }, - { command: 'mmx music generate', title: 'Music Generation', url: 'https://platform.minimax.io/docs/api-reference/music-generation' }, - { command: 'mmx music cover', title: 'Music Cover (via Music Generation)', url: 'https://platform.minimax.io/docs/api-reference/music-generation' }, - { command: 'mmx search query', title: 'Web Search', url: 'https://platform.minimax.io/docs/api-reference/web-search' }, - { command: 'mmx vision describe', title: 'Vision (Image Understanding)', url: 'https://platform.minimax.io/docs/api-reference/vision' }, + { 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', - apiDocs: 'https://platform.minimax.io/docs/api-reference', - async run(_config: Config, _flags: GlobalFlags) { + async run(config: Config, _flags: GlobalFlags) { + const host = DOCS_HOSTS[config.region] || DOCS_HOSTS.global; process.stdout.write(` MiniMax API Documentation Links - Official docs: https://platform.minimax.io/docs/api-reference + 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)} ${ref.url}\n\n`); + process.stdout.write(` ${' '.repeat(30)} ${host}${ref.path}\n\n`); } }, }); diff --git a/src/commands/speech/synthesize.ts b/src/commands/speech/synthesize.ts index 8083920..d97939a 100644 --- a/src/commands/speech/synthesize.ts +++ b/src/commands/speech/synthesize.ts @@ -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 [--out ] [flags]', options: [ { flag: '--model ', description: 'Model ID (default: speech-2.8-hd)' }, diff --git a/src/commands/text/chat.ts b/src/commands/text/chat.ts index 6594827..b0be8b3 100644 --- a/src/commands/text/chat.ts +++ b/src/commands/text/chat.ts @@ -78,7 +78,7 @@ function extractText(content: ContentBlock[]): string { export default defineCommand({ name: 'text chat', description: 'Send a chat completion (MiniMax Messages API)', - apiDocs: 'https://platform.minimax.io/docs/api-reference/text-post', + apiDocs: '/docs/api-reference/text-post', usage: 'mmx text chat --message [flags]', options: [ { flag: '--model ', description: 'Model ID (default: MiniMax-M2.7)' },