@checkmarkdevtools/commitlint-plugin-rai 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/rai-footer-exists.d.ts +4 -0
- package/dist/rules/rai-footer-exists.d.ts.map +1 -0
- package/dist/rules/rai-footer-exists.js +35 -0
- package/dist/rules/rai-footer-exists.js.map +1 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @checkmarkdevtools/commitlint-plugin-rai
|
|
2
|
+
|
|
3
|
+
Commitlint plugin for enforcing AI attribution in commit messages using standard Git trailers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @checkmarkdevtools/commitlint-plugin-rai
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Add to your `commitlint.config.js`:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
export default {
|
|
17
|
+
extends: ['@commitlint/config-conventional'],
|
|
18
|
+
plugins: ['@checkmarkdevtools/commitlint-plugin-rai'],
|
|
19
|
+
rules: {
|
|
20
|
+
'rai-footer-exists': [2, 'always'],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Valid Footer Formats
|
|
26
|
+
|
|
27
|
+
1. **`Authored-by: [Human] <email>`** - Human only, no AI
|
|
28
|
+
2. **`Commit-generated-by: [AI Tool] <email>`** - Trivial AI (docs, commit msg, advice, reviews)
|
|
29
|
+
3. **`Assisted-by: [AI Tool] <email>`** - AI helped, but primarily human code
|
|
30
|
+
4. **`Co-authored-by: [AI Tool] <email>`** - Roughly 50/50 AI and human (40-60 leeway)
|
|
31
|
+
5. **`Generated-by: [AI Tool] <email>`** - Majority of code was AI generated
|
|
32
|
+
|
|
33
|
+
All patterns are case-insensitive.
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- Node.js >= 20.0.0
|
|
38
|
+
- @commitlint/cli >= 19.0.0
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
Polyform Shield 1.0.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,QAAA,MAAM,MAAM,EAAE,MAIb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,MAAM,MAAM,GAAW;IACrB,KAAK,EAAE;QACL,mBAAmB,EAAE,eAAe;KACrC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rai-footer-exists.d.ts","sourceRoot":"","sources":["../../src/rules/rai-footer-exists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAU9C,QAAA,MAAM,eAAe,EAAE,IA6BtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const AI_ATTRIBUTION_PATTERNS = [
|
|
2
|
+
/^Authored-by:\s+[^<]+\s+<[^>]+>$/im,
|
|
3
|
+
/^Commit-generated-by:\s+[^<]+\s+<[^>]+>$/im,
|
|
4
|
+
/^Assisted-by:\s+[^<]+\s+<[^>]+>$/im,
|
|
5
|
+
/^Co-authored-by:\s+[^<]+\s+<[^>]+>$/im,
|
|
6
|
+
/^Generated-by:\s+[^<]+\s+<[^>]+>$/im,
|
|
7
|
+
];
|
|
8
|
+
const raiFooterExists = (parsed) => {
|
|
9
|
+
const { raw } = parsed;
|
|
10
|
+
if (!raw) {
|
|
11
|
+
return [false, 'Commit message is empty'];
|
|
12
|
+
}
|
|
13
|
+
const hasValidFooter = AI_ATTRIBUTION_PATTERNS.some((pattern) => pattern.test(raw));
|
|
14
|
+
if (!hasValidFooter) {
|
|
15
|
+
return [
|
|
16
|
+
false,
|
|
17
|
+
'Commit message must include AI attribution footer:\n' +
|
|
18
|
+
' 1. "Authored-by: [Human] <contact>" - Human only, no AI\n' +
|
|
19
|
+
' 2. "Commit-generated-by: [AI Tool] <contact>" - Trivial AI (docs, commit msg, advice)\n' +
|
|
20
|
+
' 3. "Assisted-by: [AI Tool] <contact>" - AI helped, but primarily human code\n' +
|
|
21
|
+
' 4. "Co-authored-by: [AI Tool] <contact>" - Roughly 50/50 AI and human (40-60 leeway)\n' +
|
|
22
|
+
' 5. "Generated-by: [AI Tool] <contact>" - Majority of code was AI generated\n' +
|
|
23
|
+
'\n' +
|
|
24
|
+
'Examples:\n' +
|
|
25
|
+
' - "Authored-by: Jane Doe <jane@example.com>"\n' +
|
|
26
|
+
' - "Commit-generated-by: ChatGPT <chatgpt@openai.com>"\n' +
|
|
27
|
+
' - "Assisted-by: GitHub Copilot <copilot@github.com>"\n' +
|
|
28
|
+
' - "Co-authored-by: Verdent AI <verdent@verdent.ai>"\n' +
|
|
29
|
+
' - "Generated-by: GitHub Copilot <copilot@github.com>"',
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
return [true, ''];
|
|
33
|
+
};
|
|
34
|
+
export default raiFooterExists;
|
|
35
|
+
//# sourceMappingURL=rai-footer-exists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rai-footer-exists.js","sourceRoot":"","sources":["../../src/rules/rai-footer-exists.ts"],"names":[],"mappings":"AAEA,MAAM,uBAAuB,GAAG;IAC9B,oCAAoC;IACpC,4CAA4C;IAC5C,oCAAoC;IACpC,uCAAuC;IACvC,qCAAqC;CACtC,CAAC;AAEF,MAAM,eAAe,GAAS,CAAC,MAAM,EAAE,EAAE;IACvC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEvB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,cAAc,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEpF,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO;YACL,KAAK;YACL,sDAAsD;gBACpD,6DAA6D;gBAC7D,2FAA2F;gBAC3F,iFAAiF;gBACjF,0FAA0F;gBAC1F,gFAAgF;gBAChF,IAAI;gBACJ,aAAa;gBACb,kDAAkD;gBAClD,2DAA2D;gBAC3D,0DAA0D;gBAC1D,yDAAyD;gBACzD,yDAAyD;SAC5D,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkmarkdevtools/commitlint-plugin-rai",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Commitlint plugin for RAI footer validation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20 <25"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "vitest run --coverage",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"lint": "eslint . --fix",
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"prepare": "npm run build",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"commitlint",
|
|
32
|
+
"plugin",
|
|
33
|
+
"rai",
|
|
34
|
+
"ai-attribution"
|
|
35
|
+
],
|
|
36
|
+
"author": "Ashley Childress",
|
|
37
|
+
"license": "Polyform-Shield-1.0.0",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/ChecKMarKDevTools/rai-lint.git",
|
|
41
|
+
"directory": "packages/node-commitlint"
|
|
42
|
+
},
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/ChecKMarKDevTools/rai-lint/issues"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/ChecKMarKDevTools/rai-lint#readme",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@commitlint/types": "^20.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@commitlint/types": "^20.0.0",
|
|
52
|
+
"@types/node": "^24.10.0",
|
|
53
|
+
"@vitest/coverage-v8": "^4.0.13",
|
|
54
|
+
"typescript": "^5.9.3",
|
|
55
|
+
"vitest": "^4.0.7"
|
|
56
|
+
},
|
|
57
|
+
"volta": {
|
|
58
|
+
"node": "24.11.1"
|
|
59
|
+
}
|
|
60
|
+
}
|