read_module
Retrieve the modification history of a given module to review past changes before making updates.
Instructions
【读取模块记录】修改功能前调用,读取对应模块的历史修改记录。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| moduleName | Yes | 模块名称 |
Implementation Reference
- src/index.ts:471-487 (handler)Handler function for the 'read_module' tool. Extracts moduleName from args, gets project root, calls readModuleLog, and returns the content.
private async handleReadModule(args: any) { const moduleName = typeof args?.moduleName === 'string' ? args.moduleName : ''; if (!moduleName) { return { content: [{ type: 'text', text: '❌ "moduleName" 是必填参数。' }], isError: true, }; } const projectRoot = getProjectRoot(); const content = readModuleLog(projectRoot, moduleName); return { content: [{ type: 'text', text: `# 模块记录: ${moduleName}\n\n${content}` }], }; } - src/module-logger.ts:42-52 (helper)Core helper function that reads the module log file from .github/prompts/modules/<moduleName>.md. Returns file contents or a default 'no records' / 'read failed' message.
export function readModuleLog(projectRoot: string, moduleName: string): string { const filePath = getModulePath(projectRoot, moduleName); try { if (fs.existsSync(filePath)) { return fs.readFileSync(filePath, 'utf-8'); } return `# 模块记录: ${moduleName}\n\n*暂无记录*\n`; } catch { return `# 模块记录: ${moduleName}\n\n*读取失败*\n`; } } - src/index.ts:198-211 (schema)Input schema for read_module tool. Requires 'moduleName' (string) as the only parameter.
{ name: 'read_module', description: '【读取模块记录】修改功能前调用,读取对应模块的历史修改记录。', inputSchema: { type: 'object', properties: { moduleName: { type: 'string', description: '模块名称', }, }, required: ['moduleName'], }, }, - src/index.ts:250-251 (registration)Routes the 'read_module' tool name to handleReadModule in the CallToolRequestSchema handler.
case 'read_module': return this.handleReadModule(args); - src/index.ts:198-211 (registration)Tool definition registered in ListToolsRequestSchema with name 'read_module' and its input schema.
{ name: 'read_module', description: '【读取模块记录】修改功能前调用,读取对应模块的历史修改记录。', inputSchema: { type: 'object', properties: { moduleName: { type: 'string', description: '模块名称', }, }, required: ['moduleName'], }, },