diff --git a/src/commands/help.ts b/src/commands/help.ts new file mode 100644 index 0000000..04a9937 --- /dev/null +++ b/src/commands/help.ts @@ -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`); + } + }, +}); 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 d5ed5fc..b0be8b3 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: '/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, });