✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more

Track AI Contributions to Your Codebase with git-commit-aider: An MCP Server for Seamless AI Integration

In the rapidly evolving landscape of software development, artificial intelligence (AI) is increasingly playing a pivotal role. From code generation to automated testing, AI agents are becoming indispensable tools for developers. However, effectively tracking and managing AI contributions within a codebase presents a unique set of challenges. This is where git-commit-aider, a simple yet powerful Model Context Protocol (MCP) server, steps in.

git-commit-aider is designed to seamlessly integrate with AI-powered development workflows, allowing you to automatically commit changes made by AI agents to your Git repository. By appending “(aider)” to the committer’s name, this tool enables you to easily distinguish AI-generated commits from those made by human developers, providing clear visibility into the AI’s impact on your project.

This tool is an important element of the UBOS ecosystem, letting teams see how much AI is contributing to their projects.

Understanding the Need for AI Contribution Tracking

As AI agents become more sophisticated and integrated into the development process, the need for robust contribution tracking becomes paramount. Without a clear mechanism for identifying AI-generated code, it can be difficult to:

  • Assess the impact of AI on code quality and maintainability: Understanding which parts of the codebase were modified by AI is crucial for evaluating the effectiveness of AI tools and identifying potential areas for improvement.
  • Ensure accountability and traceability: In collaborative development environments, it’s essential to know who or what is responsible for each change. AI contribution tracking provides a clear audit trail of AI-driven modifications.
  • Optimize AI workflows: By analyzing AI contribution data, you can gain insights into how AI agents are being used and identify opportunities to streamline AI-powered development processes.
  • Comply with regulatory requirements: Certain industries may have specific regulations regarding the use of AI in software development. AI contribution tracking can help ensure compliance with these requirements.

Key Features of git-commit-aider

git-commit-aider offers a range of features designed to simplify AI contribution tracking and enhance your development workflow:

  • Automated Commit Appending: The core functionality of git-commit-aider is its ability to automatically append “(aider)” to the committer’s name for AI-generated commits. This simple yet effective mechanism allows you to quickly and easily identify AI contributions within your Git history.
  • Customizable Commit Messages: The commit_staged tool allows you to specify a commit message for AI-generated changes. This enables you to provide context and explain the purpose of the AI’s modifications.
  • Environment Variable Support: git-commit-aider supports environment variables (GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL) for configuring committer information. This allows you to easily integrate the tool into your existing development environment and customize committer details as needed.
  • Fallback to Git Configuration: If environment variables are not set, git-commit-aider automatically falls back to the git config user.name and git config user.email commands to retrieve committer information. This ensures that the tool works seamlessly even without explicit environment variable configuration.
  • Working Directory Specification: The cwd parameter allows you to specify the working directory for the Git command. This is useful when working with multiple repositories or submodules.
  • Integration with Aider --stats: Commits marked with “(aider)” are automatically recognized by the aider --stats command, providing a convenient way to analyze AI contributions within your codebase.
  • Alternative Commit Amending: For users who prefer a more manual approach, git-commit-aider provides an alternative method for amending the author of existing commits using Git commands.

Use Cases for git-commit-aider

git-commit-aider is applicable to a wide range of use cases across various industries and development scenarios:

  • AI-Assisted Code Generation: When using AI tools to generate code snippets or entire modules, git-commit-aider can automatically commit these changes, providing clear attribution to the AI agent.
  • Automated Testing and Bug Fixing: If AI agents are used to perform automated testing or fix bugs, git-commit-aider can track these AI-driven modifications to the codebase.
  • Code Refactoring and Optimization: When AI agents are employed to refactor or optimize code, git-commit-aider can ensure that these changes are properly attributed to the AI.
  • Documentation Generation: If AI tools are used to generate documentation, git-commit-aider can track these AI-driven contributions to the documentation repository.
  • Machine Learning Model Training: When AI agents are used to train machine learning models, git-commit-aider can track changes to the training data or model code.

Installation and Configuration

Installing and configuring git-commit-aider is a straightforward process. Simply add the following configuration to your MCP settings file:

{ “mcpServers”: { “git-commit-aider”: { “command”: “npx”, “args”: [“mcp-git-commit-aider”] } } }

Ensure that the GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL environment variables are set, or that the git config user.name and git config user.email commands are properly configured. Then, you can prompt the AI by something like:

Commit the changes for me

This command will commit the staged changes with the specified message, automatically appending “(aider)” to the committer’s name.

Calculating AI Contribution with the Provided Script

The provided script offers a powerful way to calculate the contribution of AI to your codebase, measured in lines of code (added, deleted, and total changes). This script analyzes Git logs to identify commits made by AI agents (identified by the AI_MATCHER variable) and calculates the total lines of code added and deleted by these agents.

How to Use the Script:

  1. Save the Script: Save the script to a file, for example, calculate_ai_contribution.sh.
  2. Make it Executable: Run chmod +x calculate_ai_contribution.sh to make the script executable.
  3. Run the Script: Execute the script with a revision range as an argument. For example:
    • ./calculate_ai_contribution.sh HEAD~5..HEAD (analyzes the last 5 commits)
    • ./calculate_ai_contribution.sh main..my-feature-branch (analyzes commits on a feature branch not yet in main)

The script will output a JSON object containing the following information:

  • ai_percentage: The percentage of total lines changed that were contributed by AI authors.
  • ai_changes: An object detailing the aggregated line changes (added, deleted, and total) made by AI authors.
  • human_changes: An object detailing the aggregated line changes made by human authors.
  • details: An array of objects providing a detailed breakdown of changes, including the file name, author, whether the author is an AI, and the number of lines added, deleted, and the total changes for that file by that author.

Configuration Options:

The script provides several configuration options that can be customized to match your repository’s conventions:

  • AI_MATCHER: The string used to identify AI-generated commits in author names (default: “(aider)”).
  • IGNORE_PATTERNS: An array of patterns for files/paths to be excluded from the calculation (e.g., “package-lock.json", ".lock”).

The UBOS Platform: Empowering AI-Driven Development

git-commit-aider is a valuable tool for tracking AI contributions within your codebase, but it’s just one piece of the puzzle. To truly unlock the potential of AI in software development, you need a comprehensive platform that provides the tools and infrastructure necessary to build, deploy, and manage AI agents.

This is where UBOS comes in. UBOS is a full-stack AI Agent Development Platform designed to empower businesses across all departments to leverage the power of AI. With UBOS, you can:

  • Orchestrate AI Agents: Seamlessly manage and coordinate multiple AI agents to achieve complex development tasks.
  • Connect to Enterprise Data: Connect AI agents to your enterprise data sources, enabling them to access and process relevant information.
  • Build Custom AI Agents: Develop custom AI agents tailored to your specific needs and requirements.
  • Utilize Your LLM Model: Integrate your own Large Language Model (LLM) to create AI agents with advanced natural language processing capabilities.
  • Build Multi-Agent Systems: Develop sophisticated multi-agent systems that can collaborate and solve complex problems.

By combining git-commit-aider with the UBOS platform, you can create a truly AI-driven development environment that enables you to:

  • Increase Development Velocity: Automate repetitive tasks and accelerate the development process.
  • Improve Code Quality: Leverage AI agents to identify and fix bugs, refactor code, and improve overall code quality.
  • Enhance Collaboration: Foster collaboration between human developers and AI agents, enabling them to work together more effectively.
  • Gain Deeper Insights: Analyze AI contribution data to gain insights into the effectiveness of AI tools and optimize AI-powered development processes.

Conclusion

git-commit-aider is an essential tool for any development team that is leveraging AI in their workflow. By providing a simple and effective way to track AI contributions, this tool enables you to gain valuable insights into the impact of AI on your codebase and optimize your AI-powered development processes. Coupled with the UBOS platform, git-commit-aider becomes an integral part of a comprehensive AI-driven development environment that empowers you to build better software, faster.

Featured Templates

View More
AI Assistants
Talk with Claude 3
159 1523
Verified Icon
AI Agents
AI Chatbot Starter Kit
1336 8300 5.0
AI Agents
AI Video Generator
252 2007 5.0
AI Assistants
Image to text with Claude 3
152 1366
AI Characters
Your Speaking Avatar
169 928

Start your free trial

Build your solution today. No credit card required.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.