GitHub 插件:Pull Request 中 AI 贡献归因
GitHub Browser Plugin for AI Contribution Blame in Pull Requests

原始链接: https://blog.rbby.dev/posts/github-ai-contribution-blame-for-pull-requests/

## 开源领域人工智能的兴起与贡献追踪 人工智能代码生成(如 Claude Code 和 Copilot 等工具)的日益普及,正在导致开源项目贡献激增,这些贡献通常被称为“草率贡献”。虽然许多贡献者是善意的,但项目正在努力管理和评估这种新的涌入,甚至有些项目直接禁止人工智能辅助贡献。 **Git-AI** 项目旨在通过在现有的 Git 工作流程中**逐行追踪人工智能贡献**来解决这个问题。它记录了使用的人工智能模型和原始提示,并将这些数据直接存储在 Git 注释中——确保其在合并、变基和其他常见操作中得以保留。 这种追踪能够带来潜在的好处,例如建立每个拉取请求可接受的人工智能贡献百分比,提供有关代码来源的宝贵见解,并协助重构工作。一个 VSCode 集成会突出显示人工智能生成的代码,一个分叉的 GitHub 插件 (**refined-github-ai-pr**) 将这种可见性扩展到拉取请求,显示人工智能贡献百分比。 虽然目前仍处于原型阶段,未来可能获得官方支持,但 Git-AI 促进了关于将人工智能整合到协作开发中的讨论,并提供了一个供应商无关的解决方案来追踪其影响。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 工作 | 提交 登录 GitHub 浏览器插件,用于在拉取请求中进行 AI 贡献归责 (rbby.dev) 13 分,由 rbbydotdev 56 分钟前发布 | 隐藏 | 过去 | 收藏 | 3 条评论 verdverm 19 分钟前 | 下一个 [–] 给他们自己的账户 ID / 邮箱,以便使用标准的 git blame 工具不是更好吗?为什么我们需要插件或新工具来完成这个? 不知道这又被重新提交并放在 HN 首页的原因。(参见 2 天前的同行评论) 这篇文章有什么特点值得特殊对待?回复 nilespotter 1 分钟前 | 上一个 | 下一个 [–] 为什么不直接看代码,看看它是否优秀?回复 rbbydotdev 2 天前 | 上一个 [–] 仓库:https://github.com/rbbydotdev/refined-github-with-ai-pr 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Quickstart, TL;DR

refined-github-with-ai-pr

Identifying AI Contributions

The Rise of Low‑Friction AI Contributions

With the proliferation of effortless code‑generating tools like Claude Code, Codex, and Cursor, slop‑slung contributions are being doled out as outright spam in hopes of getting a name tacked onto popular open‑source projects. Most are well‑intentioned — it’s just that this workflow is entirely new, and the tools and norms haven’t been established yet. Some open‑source projects have publicly banned them (see: zig, tldr, ghostty), going so far as to vet contributors into a select trusted group.

When AI‑Generated Code Can Be Appropriate

Oftentimes, depending on the preference of the team and project, less consequential and isolated code could warrant a 100% AI contribution. Non‑user‑facing tooling, a private beta feature, or a proof‑of‑concept immediately come to mind. The ability to retroactively see which parts of the codebase were AI contributions, especially in these use cases, could be very valuable. What was tabbed in by Cursor at 3am six months ago could be a part of today’s refactor.

Percentages, Policies, and Maintainer Trust

Projects like Zig may never allow ai contributions, and I am not here to argue that they should change this stance. But in other cases, where the reaction is a heavy‑handed outright refusal, maintainers and developers could have a change of heart if they could codify an allowable percentage done by AI in each pull request. Even without a hard‑and‑fast rule, a percentage could serve as a sort of gut check — an overall score as part of a bigger picture of quality in a PR.

Enter the Git-Ai Project

git ai open graph image

What Git‑AI Does

The git-ai project allows you to automatically track agentic ai code contributions across your team and codebase, zeroing in line-by-line, preserving code-generating prompts, all while working within common git workflows. Git-ai works by extending and enhancing your current tooling without slowdown (thanks to Rust) while ‘staying out of the way’ - so you can work as if it’s not even there.

What Data Git‑AI Captures

git-ai stores things like per-line ai contributions, the model and prompt given for the code generated.

git-ai works by storing this ai contribution data in git notes. Git notes are simply blobs attached to commit refs. It’s eloquent in that the meta data stays with the commit, git-ai also contains additional instrumentation to “survive a merge --squash, rebase, reset, cherry-pick etc.”

Project Goals (From the README)

From the README.md:

Goals of git-ai project

🤖 Track AI code in a Multi-Agent world. Because developers get to choose their tools, engineering teams need a vendor agnostic way to track AI impact in their repos.

🎯 Accurate attribution from Laptop → Pull Request → Merged. Claude Code, Cursor and Copilot cannot track code after generation—Git AI follows it through the entire workflow.

🔄 Support real-world git workflows by making sure AI-Authorship annotations survive a merge --squash, rebase, reset, cherry-pick etc.

🔗 Maintain link between prompts and code - there is valuable context and requirements in team prompts—preserve them alongside code.

🚀 Git-native + Fast - git-ai is built on git plumbing commands. Negligible impact even in large repos (<100ms). Tested in Chromium.

NOTE: I have no affiliation with git-ai, but happily applaud their efforts, go check em’ out! github.com/git-ai-project/git-ai

Github PR interface Support

Why Focus on Pull Requests

To experimentally work towards a developer friendly solution, I wanted to try dropping this tooling into a common point of convergence within collaborative version control workflows; Github Pull Requests

Existing Git‑AI Integrations with VSCode

git-ai comes with many integrations, and even has an RFC v3.0, so other tooling providers may implement it themselves. The VSCode integration works very well. AI contributed code is given a gutter highlight, and upon line selectshows the model responsible for said ai generated code, long-hovering provides even more context.

git ai vscode
AI-contributed code highlighted in VSCode using the git-ai extension.

Extending the GitHub PR Experience

To recreate this editor/code-view highlighting, as well as provide human-vs-ai percentage metering in the Github PR experience, I forked an existing github extended plugin github-refined into refined-github-ai-pr This plugin has all the features of the prior, even allowing you to toggle this ai contribution blaming feature on and off in the options (Be sure to check out the screenshots below)

light mode screenshot
GitHub PR with AI contribution annotations in light mode.
dark mode screenshot
GitHub PR with AI contribution annotations in dark mode.

More on Git-Ai Tooling&mldr;

Although there is currently no official support from git-ai (as of Jan 2026) for extending the Github PR interface with Git-ai annotations. There is an early access feature: Stat Bot - to “Aggregate git-ai data at the PR, developer, repository and organization levels” It may be worth it for you to check out and could serve as an excellent way to support the creators of git-ai

Caveats

One Major Caveat with refined-github-with-ai-pr, is that it relies on augmenting Github’s HTML via classes, which could very well change without notice, breaking this plugin.

This plugin serves as a beta and prototype, to fuel the conversation of what working with these new tools might look like; and I encourage community members to join the conversation. Maybe github will work towards adding this themselves in the future. Please comment on this post in hackernews or open an issue for refined-github-ai-pr I’d love to hear what you’re thinking!

联系我们 contact @ memedata.com