|
| 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 | +}); |
0 commit comments