An open API service indexing awesome lists of open source software.

https://github.com/anchildress1/rai-lint

Dual-language linter for Responsible AI commit footers β€” shared logic for Node (@commitlint) and Python (gitlint).
https://github.com/anchildress1/rai-lint

ai attribution-tracking commitlint commitlint-plugin gitlint

Last synced: 1 day ago
JSON representation

Dual-language linter for Responsible AI commit footers β€” shared logic for Node (@commitlint) and Python (gitlint).

Awesome Lists containing this project

README

          

![CheckMarK RAI Lint Banner](docs/assets/rai-lint-banner.png)

**Stop playing hide-and-seek with AI in your commits.**

_A dual-language validation framework that makes AI attribution non-negotiable._

---

### πŸ“Š Project Stats

[![GitHub Repo Stars](https://img.shields.io/github/stars/ChecKMarKDevTools/rai-lint?style=for-the-badge&color=F0544B&cacheSeconds=3600)](https://github.com/ChecKMarKDevTools/rai-lint/stargazers) [![GitHub Issues](https://img.shields.io/github/issues/ChecKMarKDevTools/rai-lint?style=for-the-badge&color=34A853&cacheSeconds=3600)](https://github.com/ChecKMarKDevTools/rai-lint/issues) [![GitHub Release](https://img.shields.io/github/v/release/ChecKMarKDevTools/rai-lint?style=for-the-badge&color=EDC531)](https://github.com/ChecKMarKDevTools/rai-lint/releases) [![License: Polyform Shield License 1.0.0](https://img.shields.io/badge/license-Polyform%20Shield%20License%201.0.0-orange?style=for-the-badge)](LICENSE)

[![Sonar Tech Debt](https://img.shields.io/sonar/alert_status/checkmarkdevtools_rai-lint?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarqubecloud)](https://sonarcloud.io/summary/new_code?id=checkmarkdevtools_rai-lint) [![Bugs](https://img.shields.io/sonar/bugs/checkmarkdevtools_rai-lint?color=brightgreen&server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarqubecloud)](https://sonarcloud.io/summary/new_code?id=checkmarkdevtools_rai-lint) [![Code Smells](https://img.shields.io/sonar/code_smells/checkmarkdevtools_rai-lint?server=https%3A%2F%2Fsonarcloud.io&color=orange&label=code_smells&style=for-the-badge&logo=sonarqubecloud)](https://sonarcloud.io/summary/new_code?id=checkmarkdevtools_rai-lint) [![Coverage](https://img.shields.io/sonar/coverage/checkmarkdevtools_rai-lint?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarqubecloud)](https://sonarcloud.io/summary/new_code?id=checkmarkdevtools_rai-lint)

### πŸ—£οΈ Languages

[![JavaScript Badge](https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=000&style=for-the-badge)](https://developer.mozilla.org/en-US/docs/Web/JavaScript) [![TypeScript Badge](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=fff&style=for-the-badge)](https://www.typescriptlang.org/) [![Python Badge](https://img.shields.io/badge/Python-3670A0?logo=python&logoColor=ffdd54&style=for-the-badge)](https://www.python.org/)

### πŸ“¦ Packages

[![NPM Version](https://img.shields.io/npm/v/@checkmarkdevtools/commitlint-plugin-rai?style=for-the-badge&logo=npm&logoColor=fff&color=CB3837)](https://www.npmjs.com/package/@checkmarkdevtools/commitlint-plugin-rai) [![PyPI Version](https://img.shields.io/pypi/v/gitlint-rai?style=for-the-badge&logo=pypi&logoColor=fff&color=3775A9)](https://pypi.org/project/gitlint-rai/)

### πŸ€– AI & Automation

[![Verdent AI Badge](https://img.shields.io/badge/Verdent-00D486?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+VmVyZGVudDwvdGl0bGU+CjxwYXRoIGQ9Ik0xNy42IDkuOUMxNy42IDEyLjEgMTYuOCAxNC4yIDE1LjQgMTUuN0wxNS4xIDE2QzEzLjcgMTcuNSAxMi44IDE5LjYgMTIuOCAyMS44QzEyLjggMjIuNSAxMi45IDIzLjIgMTMuMSAyMy45QzEwLjcgMjIuOSA4LjggMjAuOSA4IDE4LjRDNy44IDE3LjYgNy43IDE2LjggNy43IDE2QzcuNyAxMy44IDguNSAxMS44IDkuOCAxMC4zTDE1LjMgNEMxNi4yIDUgMTYuOSA2LjEgMTcuMyA3LjVDMTcuNSA4LjIgMTcuNiA5IDE3LjYgOS45WiIgZmlsbD0iI2ZmZmZmZiIvPgo8cGF0aCBkPSJNMTQuMyAyMi43QzE0LjMgMjAuNSAxNS4xIDE4LjQgMTYuNSAxNi45TDE2LjggMTYuNkMxOC4yIDE1LjEgMTkuMSAxMyAxOS4xIDEwLjhDMTkuMSAxMCAxOSA5LjQgMTguOCA4LjdDMjEuMiA5LjcgMjMuMSAxMS43IDIzLjkgMTQuMkMyNCAxNSAyNC4yIDE1LjggMjQuMiAxNi42QzI0LjIgMTguOCAyMy40IDIwLjggMjIuMSAyMi4zTDE2LjYgMjguNkMxNS43IDI3LjYgMTUgMjYuNSAxNC42IDI1LjFDMTQuNCAyNC4zIDE0LjMgMjMuNSAxNC4zIDIyLjdaIiBmaWxsPSIjZmZmZmZmIi8+Cjwvc3ZnPg==&style=for-the-badge)](https://verdent.ai) [![GitHub Copilot Badge](https://img.shields.io/badge/GitHub%20Copilot-000?logo=githubcopilot&logoColor=fff&style=for-the-badge)](https://github.com/features/copilot) [![ChatGPT Badge](https://img.shields.io/badge/ChatGPT-74aa9c?style=for-the-badge)](http://chatgpt.com) ![GitHub Actions Badge](https://img.shields.io/badge/GitHub%20Actions-2088FF?logo=githubactions&logoColor=fff&style=for-the-badge)

### πŸ”§ Quality & Standards

[![Conventional Commits Badge](https://img.shields.io/badge/Conventional%20Commits-FE5196?logo=conventionalcommits&logoColor=fff&style=for-the-badge)](https://conventionalcommits.org/) [![commitlint Badge](https://img.shields.io/badge/commitlint-000?logo=commitlint&logoColor=fff&style=for-the-badge)](https://commitlint.js.org/) [![ESLint Badge](https://img.shields.io/badge/ESLint-4B32C3?logo=eslint&logoColor=fff&style=for-the-badge)](https://eslint.org/) ![Lefthook Badge](https://img.shields.io/badge/Lefthook-FF1E1E?logo=lefthook&logoColor=fff&style=for-the-badge)

![SonarQube Cloud Badge](https://img.shields.io/badge/SonarQube%20Cloud-126ED3?logo=sonarqubecloud&logoColor=fff&style=for-the-badge) ![Codecov Badge](https://img.shields.io/badge/Codecov-F01F7A?logo=codecov&logoColor=fff&style=for-the-badge)

---

[Installation](#installation-) β€’ [Quick Start](#quick-start-) β€’ [Required Commit Footers](#required-commit-footers-) β€’ [Documentation](/docs)

---

## What is this? πŸ€–

CheckMarK RAI Lint enforces **Responsible AI (RAI) attribution** in every commit. No more "who wrote this?" moments. No more mystery code. Just honest, trackable AI contributions.

**Read the full story:** [Did AI Erase Attribution? Your Git History Is Missing a Co-Author](https://dev.to/anchildress1/did-ai-erase-attribution-your-git-history-is-missing-a-co-author-1m2l)

```mermaid
%%{init: {'theme':'dark'}}%%
flowchart LR
A[Developer Commits] --> B{Has AI Footer?}
B -->|Yes| C[Commit Accepted βœ…]
B -->|No| D[Commit Rejected ❌]
C --> E[Clear AI Attribution]
D --> F[Add Footer & Retry]
```

### Why does this exist?

Because transparency matters. When AI writes code, everyone should know. This isn't about fear or compliance theaterβ€”it's about building trust and maintaining clear audit trails.

---

## Features 🎯

### πŸ”’ **Enforcement by Default**

Blocks commits without valid AI attribution footers. No exceptions.

### 🌍 **Dual-Language Support**

Native plugins for both JavaScript/TypeScript (`commitlint`) and Python (`gitlint`).

### πŸ“Š **Five Attribution Levels**

From human-only to AI-generated, track exactly who did what.

### ⚑ **Zero Config Start**

Works out-of-the-box with sensible defaults. Customize when ready.

---

## Required Commit Footers 🏷️

Every commit **must** include:

1. **One AI attribution footer** (pick the one that fits)
2. **Signed-off-by footer** (recommended for complete accountability)

> **πŸ’‘ Best Practice:** While only the RAI footer is strictly enforced, combining it with `Signed-off-by` creates a complete audit trailβ€”AI attribution plus human accountability. We strongly recommend enforcing both.

### AI Attribution Footers

Pick **one** of these based on AI involvement:

Footer Format
When to Use
Example

Authored-by
Human-only work, zero AI involvement
Authored-by: Jane Doe <jane@example.com>

Commit-generated-by
Trivial AI help (docs, messages, reviews)
Commit-generated-by: ChatGPT <chatgpt@openai.com>

Assisted-by
AI helped, but human did primary work
Assisted-by: GitHub Copilot <copilot@github.com>

Co-authored-by
Roughly 50/50 AI and human split
Co-authored-by: Verdent AI <verdent@verdent.ai>

Generated-by
Majority AI-generated code
Generated-by: GitHub Copilot <copilot@github.com>

### Signed-off-by Footer

**Human accountability.** This is YOUR stamp confirming you reviewed and take responsibility for the AI attribution above.

Format: `Signed-off-by: Your Name `

**Automate it:** `git commit -s` (or `--signoff`)

> [!NOTE]
> All patterns are case-insensitive and follow the [Git trailer format](https://git-scm.com/docs/git-interpret-trailers). Email addresses **must** use angle brackets (`Name `) β€” this is stricter than Git's spec but matches Git's own convention and ensures consistency.
>
> **By default, only RAI footers are enforced.** The `signed-off-by-exists` rule is available separately and can be enabled in your configuration for complete accountability.

---

## Installation πŸ“¦

### Node.js / Commitlint

```bash
npm install --save-dev @checkmarkdevtools/commitlint-plugin-rai
```

**Configure in `commitlint.config.js`:**

```javascript
export default {
extends: ['@commitlint/config-conventional'],
plugins: ['@checkmarkdevtools/commitlint-plugin-rai'],
rules: {
'rai-footer-exists': [2, 'always'],
'signed-off-by-exists': [2, 'always'],
},
};
```

### Python / Gitlint

```bash
uv add gitlint-rai
```

**Configure in `.gitlint`:**

```ini
[general]
contrib = gitlint_rai.rules.RaiFooterExists,gitlint_rai.rules.SignedOffByExists
```

---

## Quick Start πŸš€

### Hook Integration

Lefthook

```yaml
pre-push:
commands:
sonar-scan:
run: npx dotenv -- npx sonar-scanner

commit-msg:
commands:
commitlint:
run: npx --no-install commitlint --edit {1}
```

Husky

```bash
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1'
```

pre-commit

```yaml
repos:
- repo: local
hooks:
- id: gitlint
name: gitlint
entry: gitlint
args: [--msg-filename]
language: python
stages: [commit-msg]
```

---

## Monorepo Structure πŸ› οΈ

```
rai-lint/
β”œβ”€β”€ packages/
β”‚ β”œβ”€β”€ node-commitlint/ # Node.js/ESM plugin
β”‚ β”‚ β”œβ”€β”€ src/
β”‚ β”‚ β”‚ β”œβ”€β”€ rules/
β”‚ β”‚ β”‚ β”‚ └── rai-footer-exists.ts
β”‚ β”‚ β”‚ └── index.ts
β”‚ β”‚ |── package.json
β”‚ β”‚ β”œβ”€β”€ tests/
β”‚ β”‚
β”‚ └── python-gitlint/ # Python plugin
β”‚ β”œβ”€β”€ gitlint_rai/
β”‚ β”‚ β”œβ”€β”€ __init__.py
β”‚ β”‚ └── rules.py
β”‚ β”œβ”€β”€ tests/
β”‚ └── pyproject.toml
β”‚
β”œβ”€β”€ docs/ # Documentation
```

---

## Contributing 🀝

Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

## License πŸ“„

Look, I'm not gonna hide behind a wall of legalese here.

This runs on [Polyform Shield License 1.0.0](./LICENSE). That's **not open source** β€” but before you rage-quit, hear me out.

**What this means in actual English:**

Use it. Break it. Fix it. Ship it in your CI pipeline at work. Hell, use it to enforce commit messages on your team and become the office villain. I'm cool with all of that.

What I'm _not_ cool with? Someone spinning this up as "AI Lint Pro" with a $99/month subscription and a fancy landing page. If you want to make money off this code, we should probably have a conversation first.

**The vibe:** This is a tool to solve a real problem β€” AI attribution in commits is messy, and someone needed to standardize it. If you're using it for that purpose, internal or otherwise, you're good. If you're thinking about monetizing it... let's chat.

Sound fair? Cool. Now go lint some commits. πŸš€

---

## Show Some Love 🫢

If you find this project useful or want to support its development, consider starring the repo or connecting with me!

[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/anchildress1) [![dev.to Badge](https://img.shields.io/badge/dev.to-0A0A0A?logo=devdotto&logoColor=fff&style=for-the-badge)](https://dev.to/anchildress1) [![LinkedIn](https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/anchildress1/)

---

_Stop guessing. Start tracking._

**Co-authored-by: Verdent AI & GitHub Copilot**