track_file_evolution
Visualize a file's git commit history to understand changes and development rationale over time.
Instructions
Show how a file evolved through git commits with rationale
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | No | Path to manuscript directory (defaults to current directory) | |
| file_path | Yes | File to track evolution for | |
| limit | No | Maximum commits to return |
Implementation Reference
- src/tools/WriterToolHandlers.ts:466-471 (handler)MCP tool handler: extracts file_path and limit from args and delegates execution to WritersAid instance.private async trackFileEvolution(args: Record<string, unknown>) { const filePath = args.file_path as string; const limit = (args.limit as number) || 10; return this.writersAid.trackFileEvolution({ filePath, limit }); }
- Tool schema defining input parameters: file_path (required), optional limit and project_path.{ name: "track_file_evolution", description: "Show how a file evolved through git commits with rationale", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, file_path: { type: "string", description: "File to track evolution for" }, limit: { type: "number", description: "Maximum commits to return", default: 10 }, }, required: ["file_path"], }, },
- src/tools/WriterToolHandlers.ts:84-85 (registration)Tool registration in the central handleTool switch statement.case "track_file_evolution": return this.trackFileEvolution(args);
- src/WritersAid.ts:639-657 (helper)Core helper method in WritersAid that fetches git commit history for the file via GitIntegrator and formats evolution data with commit details.async trackFileEvolution(options: { filePath: string; limit?: number }) { const evolution = await this.gitIntegrator.getFileEvolution(options.filePath); const limited = evolution.slice(0, options.limit || 10); return { filePath: options.filePath, revisions: limited.map(({ revision, commit }) => ({ commitHash: commit.commitHash, timestamp: new Date(commit.timestamp * 1000).toISOString(), author: commit.author, message: commit.message, linesAdded: revision.linesAdded, linesRemoved: revision.linesRemoved, rationale: revision.rationale, sessionLinked: !!commit.sessionId, })), total: evolution.length, }; }