/** * M8 MCP Server 核心类型定义 * @作者 li peng * @创建时间 2025-12-20 * @描述 定义 MCP Server 所需的所有接口和类型 */ /** * MCP 工具定义 */ export interface ToolDefinition { name: string; description: string; inputSchema: { type: 'object'; properties: Record; required?: string[]; }; } /** * MCP 工具执行结果 */ export interface ToolResult { content: Array<{ type: 'text'; text: string; }>; isError?: boolean; } /** * 文档分类类型 */ export type DocumentCategory = 'ejs-api' | 'ui-component' | 'util-tool' | 'typical-case' | 'standard'; /** * 搜索选项 */ export interface SearchOptions { category?: DocumentCategory; limit?: number; } /** * 搜索结果 */ export interface SearchResult { title: string; category: DocumentCategory; description: string; content: string; } /** * Props 定义 */ export interface PropDefinition { name: string; type: string; default?: string; required: boolean; description: string; } /** * Events 定义 */ export interface EventDefinition { name: string; parameters: string; description: string; } /** * Slots 定义 */ export interface SlotDefinition { name: string; description: string; } /** * 代码示例 */ export interface CodeExample { title: string; code: string; description?: string; } /** * 组件信息 */ export interface ComponentInfo { id: string; name: string; title: string; description: string; props: PropDefinition[]; events: EventDefinition[]; slots?: SlotDefinition[]; examples: { vue2?: CodeExample[]; vue3?: CodeExample[]; }; } /** * API 方法定义 */ export interface ApiMethod { name: string; description: string; parameters: Array<{ name: string; type: string; required: boolean; description: string; }>; returnValue: { type: string; description: string; }; platformSupport: { ios: boolean; android: boolean; h5: boolean; }; examples: CodeExample[]; } /** * API 模块信息 */ export interface ApiInfo { module: string; description: string; methods: ApiMethod[]; } /** * Util 方法定义 */ export interface UtilMethod { name: string; description: string; parameters: Array<{ name: string; type: string; required: boolean; description: string; }>; returnValue: { type: string; description: string; }; examples: CodeExample[]; } /** * Util 分类信息 */ export interface UtilInfo { category: string; title: string; description: string; methods: UtilMethod[]; } /** * 编码规范类型 */ export type StandardType = 'css' | 'javascript' | 'vue' | 'project-structure' | 'all'; /** * 编码规则 */ export interface CodingRule { id: string; title: string; description: string; correctExample?: string; incorrectExample?: string; } /** * 编码规范 */ export interface CodingStandard { id: string; category: Exclude; title: string; description?: string; rules: CodingRule[]; } /** * 单一代码生成类型 */ export type GenerateType = 'vue-component' | 'javascript' | 'scss' | 'api-call' | 'full-page'; /** * 可组合的代码类型(用于多选) */ export type ComposableCodeType = 'vue-component' | 'javascript' | 'scss' | 'api-call' | 'router' | 'mock'; /** * 代码生成选项 */ export interface GenerateOptions { type: GenerateType | ComposableCodeType[]; requirement: string; vueVersion?: 2 | 3; components?: string[]; /** 模块路径,默认为 src/pages 下 */ modulePath?: string; /** 是否使用 Mock 数据,默认 true */ useMock?: boolean; } /** * 多文件生成结果 */ export interface MultiFileGeneratedCode { files: Array<{ type: ComposableCodeType; code: string; language: string; filename: string; /** 相对于模块的路径 */ relativePath?: string; }>; explanation: string; /** 模块路径 */ modulePath: string; } /** * 文件头选项 */ export interface HeaderOptions { author?: string; description: string; version?: string; } /** * 生成的代码 */ export interface GeneratedCode { code: string; language: string; explanation: string; } /** * 推荐类型 */ export type RecommendationType = 'ui' | 'data' | 'native' | 'general'; /** * 推荐结果类型 */ export type RecommendationResultType = 'ejs-api' | 'ui-component' | 'util-method'; /** * 推荐结果 */ export interface Recommendation { type: RecommendationResultType; name: string; description: string; reason: string; priority: number; usage: string; } /** * UI 组件文档 */ export interface UIComponentDoc extends ComponentInfo { } /** * API 文档 */ export interface ApiDoc extends ApiInfo { } /** * Util 文档 */ export interface UtilDoc extends UtilInfo { } /** * 编码规范文档 */ export interface CodingStandardDoc extends CodingStandard { } /** * 典型案例文档 */ export interface CaseDoc { id: string; title: string; description: string; category: 'list-detail' | 'form-submit'; vueVersion: 2 | 3; code: string; } /** * 文档索引 */ export interface DocumentIndex { components: Map; apis: Map; utils: Map; standards: Map; cases: CaseDoc[]; } /** * 低码组件配置项类型 */ export type CardConfigItemType = 'number' | 'text' | 'boolean' | 'radio' | 'select' | 'color' | 'colors' | 'range' | 'area' | 'uploadimage' | 'uploadvideo' | 'uploadfile' | 'array' | 'tab' | 'boxmodel' | 'font'; /** * 低码组件生成选项 */ export interface CardComponentOptions { componentName: string; requirement: string; projectName?: string; dimension?: { width: string | number; height: string | number; }; } /** * 低码组件生成结果 */ export interface CardComponentResult { files: Array<{ path: string; content: string; language: string; }>; createCommand: string; explanation: string; } //# sourceMappingURL=index.d.ts.map