git-update
Update Git projects with history tracking, changelog generation, and multi-provider synchronization. Perform updates, rollbacks, comparisons, and track changes across repositories.
Instructions
Advanced project update tool with history tracking, changelog generation, and multi-provider synchronization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Update operation to perform | |
| author | No | Filter by author | |
| autoCommit | No | Automatically commit changes | |
| changelogPath | No | Path to changelog file | |
| commitMessage | No | Custom commit message | |
| compareType | No | Type of comparison target | |
| compareWith | No | Target to compare with | |
| createTag | No | Create a tag after update | |
| forceSync | No | Force synchronization | |
| format | No | Output format for history | |
| groupByType | No | Group changelog entries by type | |
| includeCommits | No | Include commit details in changelog | |
| projectPath | Yes | Path to the Git repository | |
| provider | No | Provider for remote operations | |
| providers | No | Providers to sync with | |
| rollbackTo | No | Target for rollback (commit, tag, or version) | |
| rollbackType | No | Type of rollback target | |
| since | No | Start date for history (ISO format or relative) | |
| tagName | No | Name for the tag | |
| trackFile | No | File to track for changes | |
| trackPattern | No | Pattern to track for changes | |
| until | No | End date for history (ISO format or relative) | |
| updateType | No | Type of update to perform | |
| version | No | Version for changelog entry | |
| watchMode | No | Enable watch mode for tracking |
Implementation Reference
- src/tools/git-update.ts:229-283 (handler)Main handler function for the git-update tool. Validates parameters and dispatches to action-specific handlers like update, history, changelog, etc.async execute(params: GitUpdateParams): Promise<ToolResult> { const startTime = Date.now(); this.logger.info(`Executing git-update ${params.action}`); try { // Validate parameters const validation = ParameterValidator.validateToolParams('git-update', params); if (!validation.isValid) { return OperationErrorHandler.createToolError( 'VALIDATION_ERROR', 'Parameter validation failed', params.action, validation, validation.suggestions ); } // Route to appropriate handler switch (params.action) { case 'update': return await this.handleUpdate(params, startTime); case 'history': return await this.handleHistory(params, startTime); case 'changelog': return await this.handleChangelog(params, startTime); case 'track': return await this.handleTrack(params, startTime); case 'sync-providers': return await this.handleSyncProviders(params, startTime); case 'status': return await this.handleStatus(params, startTime); case 'rollback': return await this.handleRollback(params, startTime); case 'compare': return await this.handleCompare(params, startTime); default: return OperationErrorHandler.createToolError( 'UNSUPPORTED_OPERATION', `Update operation '${params.action}' is not supported`, params.action, {}, ['Use one of: update, history, changelog, track, sync-providers, status, rollback, compare'] ); } } catch (error) { this.logger.error('Error executing git-update'); return OperationErrorHandler.createToolError( 'EXECUTION_ERROR', `Failed to execute git-update ${params.action}: ${error instanceof Error ? error.message : 'Unknown error'}`, params.action, { error: error instanceof Error ? error.message : String(error) }, ['Check project path and Git repository status'] ); } }
- src/tools/git-update.ts:109-227 (schema)Static method providing the complete JSON schema for the git-update tool, including all input parameters and their types.static getToolSchema() { return { name: 'git-update', description: 'Advanced project update tool with history tracking, changelog generation, and multi-provider synchronization', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['update', 'history', 'changelog', 'track', 'sync-providers', 'status', 'rollback', 'compare'], description: 'Update operation to perform' }, projectPath: { type: 'string', description: 'Path to the Git repository' }, provider: { type: 'string', enum: ['github', 'gitea', 'both'], description: 'Provider for remote operations' }, updateType: { type: 'string', enum: ['all', 'dependencies', 'code', 'docs', 'config'], description: 'Type of update to perform' }, autoCommit: { type: 'boolean', description: 'Automatically commit changes' }, commitMessage: { type: 'string', description: 'Custom commit message' }, createTag: { type: 'boolean', description: 'Create a tag after update' }, tagName: { type: 'string', description: 'Name for the tag' }, since: { type: 'string', description: 'Start date for history (ISO format or relative)' }, until: { type: 'string', description: 'End date for history (ISO format or relative)' }, author: { type: 'string', description: 'Filter by author' }, format: { type: 'string', enum: ['json', 'markdown', 'text'], description: 'Output format for history' }, changelogPath: { type: 'string', description: 'Path to changelog file' }, version: { type: 'string', description: 'Version for changelog entry' }, includeCommits: { type: 'boolean', description: 'Include commit details in changelog' }, groupByType: { type: 'boolean', description: 'Group changelog entries by type' }, trackFile: { type: 'string', description: 'File to track for changes' }, trackPattern: { type: 'string', description: 'Pattern to track for changes' }, watchMode: { type: 'boolean', description: 'Enable watch mode for tracking' }, providers: { type: 'array', items: { type: 'string' }, description: 'Providers to sync with' }, forceSync: { type: 'boolean', description: 'Force synchronization' }, rollbackTo: { type: 'string', description: 'Target for rollback (commit, tag, or version)' }, rollbackType: { type: 'string', enum: ['commit', 'tag', 'version'], description: 'Type of rollback target' }, compareWith: { type: 'string', description: 'Target to compare with' }, compareType: { type: 'string', enum: ['commit', 'tag', 'branch', 'provider'], description: 'Type of comparison target' } }, required: ['action', 'projectPath'] } }; }
- src/server.ts:504-505 (registration)Registration and dispatch in the main server executeTool switch statement. Calls gitUpdateTool.execute() when 'git-update' is requested.case 'git-update': return await this.gitUpdateTool.execute(args);
- src/server.ts:110-110 (registration)Instantiation of GitUpdateTool instance during server initialization with provider configuration.this.gitUpdateTool = new GitUpdateTool(providerConfig);
- src/server.ts:142-146 (registration)Tool schema registration in the ListTools handler response array.GitUpdateTool.getToolSchema(), GitHistoryTool.getToolSchema() ] }; });
- Helper validation method specific to git-update tool parameters and actions.private static validateUpdateParams(action: string, params: ToolParams): ValidationResult { const result: ValidationResult = { isValid: true, errors: [], warnings: [], suggestions: [] }; switch (action) { case 'update': if (params.updateType && !['all', 'dependencies', 'code', 'docs', 'config'].includes(params.updateType)) { result.errors.push('Invalid update type. Must be one of: all, dependencies, code, docs, config'); result.suggestions.push('Use updateType: "all", "dependencies", "code", "docs", or "config"'); result.isValid = false; } break; case 'history': if (params.format && !['json', 'markdown', 'text'].includes(params.format)) { result.errors.push('Invalid format. Must be one of: json, markdown, text'); result.suggestions.push('Use format: "json", "markdown", or "text"'); result.isValid = false; } break; case 'changelog': if (params.version && !/^[\d]+\.[\d]+\.[\d]+/.test(params.version)) { result.warnings.push('Version format should follow semantic versioning (e.g., 1.0.0)'); } break; case 'track': if (!params.trackFile && !params.trackPattern) { result.warnings.push('No specific file or pattern to track - will track all changes'); } break; case 'sync-providers': if (params.providers && Array.isArray(params.providers)) { const validProviders = ['github', 'gitea']; const invalidProviders = params.providers.filter(p => !validProviders.includes(p)); if (invalidProviders.length > 0) { result.errors.push(`Invalid providers: ${invalidProviders.join(', ')}`); result.suggestions.push('Use providers: "github", "gitea", or both'); result.isValid = false; } } break; case 'rollback': if (!params.rollbackTo) { result.errors.push('rollbackTo parameter is required for rollback operation'); result.suggestions.push('Provide a commit hash, tag name, or version to rollback to'); result.isValid = false; } if (params.rollbackType && !['commit', 'tag', 'version'].includes(params.rollbackType)) { result.errors.push('Invalid rollback type. Must be one of: commit, tag, version'); result.suggestions.push('Use rollbackType: "commit", "tag", or "version"'); result.isValid = false; } break; case 'compare': if (!params.compareWith) { result.errors.push('compareWith parameter is required for compare operation'); result.suggestions.push('Provide a commit hash, tag name, branch, or provider to compare with'); result.isValid = false; } if (params.compareType && !['commit', 'tag', 'branch', 'provider'].includes(params.compareType)) { result.errors.push('Invalid compare type. Must be one of: commit, tag, branch, provider'); result.suggestions.push('Use compareType: "commit", "tag", "branch", or "provider"'); result.isValid = false; } break; case 'status': // Status operation has no specific validation requirements break; } return result; }