gitlint-rai 0.0.0__py3-none-any.whl
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.
- gitlint_rai/__init__.py +3 -0
- gitlint_rai/__main__.py +14 -0
- gitlint_rai/rules.py +80 -0
- gitlint_rai-0.0.0.dist-info/METADATA +23 -0
- gitlint_rai-0.0.0.dist-info/RECORD +9 -0
- gitlint_rai-0.0.0.dist-info/WHEEL +5 -0
- gitlint_rai-0.0.0.dist-info/entry_points.txt +5 -0
- gitlint_rai-0.0.0.dist-info/licenses/LICENSE +30 -0
- gitlint_rai-0.0.0.dist-info/top_level.txt +1 -0
gitlint_rai/__init__.py
ADDED
gitlint_rai/__main__.py
ADDED
gitlint_rai/rules.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from gitlint.rules import CommitRule, RuleViolation
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class RaiFooterExists(CommitRule):
|
|
7
|
+
name = "rai-footer-exists"
|
|
8
|
+
id = "UC1"
|
|
9
|
+
target = "commit"
|
|
10
|
+
|
|
11
|
+
AI_ATTRIBUTION_KEYS = {
|
|
12
|
+
"Authored-by",
|
|
13
|
+
"Commit-generated-by",
|
|
14
|
+
"Assisted-by",
|
|
15
|
+
"Co-authored-by",
|
|
16
|
+
"Generated-by",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
AI_ATTRIBUTION_VALUE_PATTERN = re.compile(r"^[^<]+ <[^>]+>$")
|
|
20
|
+
TRAILER_PATTERN = re.compile(r"^([A-Za-z][\w-]*)\s*:\s*(.+)$")
|
|
21
|
+
|
|
22
|
+
def _parse_trailers(self, message_body):
|
|
23
|
+
if not message_body:
|
|
24
|
+
return {}
|
|
25
|
+
|
|
26
|
+
lines = message_body if isinstance(message_body, list) else message_body.split("\n")
|
|
27
|
+
trailers = {}
|
|
28
|
+
in_trailer_block = False
|
|
29
|
+
trailer_lines = []
|
|
30
|
+
|
|
31
|
+
for i in range(len(lines) - 1, -1, -1):
|
|
32
|
+
line = lines[i].strip()
|
|
33
|
+
if not line:
|
|
34
|
+
if in_trailer_block:
|
|
35
|
+
break
|
|
36
|
+
continue
|
|
37
|
+
|
|
38
|
+
match = self.TRAILER_PATTERN.match(line)
|
|
39
|
+
if match:
|
|
40
|
+
in_trailer_block = True
|
|
41
|
+
trailer_lines.insert(0, (match.group(1), match.group(2)))
|
|
42
|
+
elif in_trailer_block:
|
|
43
|
+
break
|
|
44
|
+
|
|
45
|
+
for key, value in trailer_lines:
|
|
46
|
+
normalized_key = key.lower()
|
|
47
|
+
if normalized_key not in trailers:
|
|
48
|
+
trailers[normalized_key] = []
|
|
49
|
+
trailers[normalized_key].append(value.strip())
|
|
50
|
+
|
|
51
|
+
return trailers
|
|
52
|
+
|
|
53
|
+
def validate(self, commit):
|
|
54
|
+
trailers = self._parse_trailers(commit.message.body)
|
|
55
|
+
|
|
56
|
+
for key in self.AI_ATTRIBUTION_KEYS:
|
|
57
|
+
normalized_key = key.lower()
|
|
58
|
+
if normalized_key in trailers:
|
|
59
|
+
for value in trailers[normalized_key]:
|
|
60
|
+
if self.AI_ATTRIBUTION_VALUE_PATTERN.match(value):
|
|
61
|
+
return []
|
|
62
|
+
|
|
63
|
+
return [
|
|
64
|
+
RuleViolation(
|
|
65
|
+
self.id,
|
|
66
|
+
"Commit message must include AI attribution footer:\n"
|
|
67
|
+
' 1. "Authored-by: [Human] <contact>" - Human only, no AI\n'
|
|
68
|
+
' 2. "Commit-generated-by: [AI Tool] <contact>" - Trivial AI (docs, commit msg, advice)\n'
|
|
69
|
+
' 3. "Assisted-by: [AI Tool] <contact>" - AI helped, but primarily human code\n'
|
|
70
|
+
' 4. "Co-authored-by: [AI Tool] <contact>" - Roughly 50/50 AI and human (40-60 leeway)\n'
|
|
71
|
+
' 5. "Generated-by: [AI Tool] <contact>" - Majority of code was AI generated\n'
|
|
72
|
+
"\n"
|
|
73
|
+
"Examples:\n"
|
|
74
|
+
' - "Authored-by: Jane Doe <jane@example.com>"\n'
|
|
75
|
+
' - "Commit-generated-by: ChatGPT <chatgpt@openai.com>"\n'
|
|
76
|
+
' - "Assisted-by: GitHub Copilot <copilot@github.com>"\n'
|
|
77
|
+
' - "Co-authored-by: Verdent AI <verdent@verdent.ai>"\n'
|
|
78
|
+
' - "Generated-by: GitHub Copilot <copilot@github.com>"',
|
|
79
|
+
)
|
|
80
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitlint-rai
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Gitlint plugin for RAI footer validation
|
|
5
|
+
Author-email: Ashley Childress <human@checkmarkdevtools.dev>
|
|
6
|
+
License-Expression: LicenseRef-PolyForm-Shield-1.0.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/ChecKMarKDevTools/rai-lint
|
|
8
|
+
Project-URL: Repository, https://github.com/ChecKMarKDevTools/rai-lint
|
|
9
|
+
Project-URL: Issues, https://github.com/ChecKMarKDevTools/rai-lint/issues
|
|
10
|
+
Keywords: gitlint,rai,ai-attribution,commit-validation
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
18
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: <3.13,>=3.11
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: gitlint>=0.19.1
|
|
23
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
gitlint_rai/__init__.py,sha256=eUxlw8w3Y4Jv0ns3_CTNgFPrfOybEaS1rFcnRbV_t1w,77
|
|
2
|
+
gitlint_rai/__main__.py,sha256=8a6q0AQ1oPCR4d9JSXaEO14p3VS9vL0NrZngl_oYU7Y,238
|
|
3
|
+
gitlint_rai/rules.py,sha256=TArCtcjFH0ERMzTSylBquvBVpe-G2bKlu9F7k-UPDPo,2897
|
|
4
|
+
gitlint_rai-0.0.0.dist-info/licenses/LICENSE,sha256=3c8GK71bQJ4ntGrNHvwSXxL9xOcoKzZQBFUSzAV4k-o,2061
|
|
5
|
+
gitlint_rai-0.0.0.dist-info/METADATA,sha256=Xp_1rSj5owAUhx-7TII8cJO1XmAExb4wEvkyA0Mrejk,1037
|
|
6
|
+
gitlint_rai-0.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
gitlint_rai-0.0.0.dist-info/entry_points.txt,sha256=16Vx_ChzAUS3pIaVlUl-wO4QNS9d0cmNgBbdHcXsB7M,131
|
|
8
|
+
gitlint_rai-0.0.0.dist-info/top_level.txt,sha256=ZC0BtlUyjIdbfhft755kpqK8fh5ViuXYkbtcyKglq4E,12
|
|
9
|
+
gitlint_rai-0.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Polyform Shield License 1.0.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ChecKMarK DevTools / Ashley Childress
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to use,
|
|
7
|
+
copy, modify, and/or distribute the Software for any purpose—including personal, professional, or commercial use—subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
1. **No Profit or Monetization.**
|
|
10
|
+
The Software may not be sold, rebranded, licensed, hosted as a paid SaaS, or used as the basis of any product or service from which you or your organization earns revenue or profit, without explicit written permission from Ashley Childress.
|
|
11
|
+
|
|
12
|
+
- **You CAN** use, copy, fork, or adapt this for your own workflows, inside your company, for client projects, demos, education, or anything else—as long as you’re not selling the code, charging for it, or making money from the project itself.
|
|
13
|
+
- **You CANNOT** resell, offer as a paid service, or monetize this project or its derivatives without prior written approval.
|
|
14
|
+
|
|
15
|
+
2. **Endorsement.**
|
|
16
|
+
Neither the name of ChecKMarK DevTools / Ashley Childress nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
3. **Attribution.**
|
|
19
|
+
Any public fork, copy, or substantial reuse must include this LICENSE and a clear statement in your documentation or README:
|
|
20
|
+
“Based on original work by ChecKMarK DevTools / Ashley Childress – see \[original repo link\].”
|
|
21
|
+
|
|
22
|
+
4. **No Warranty.**
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
24
|
+
|
|
25
|
+
Full license text: https://polyformproject.org/licenses/shield/1.0.0/
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
This project is licensed under Polyform Shield License 1.0.0.
|
|
30
|
+
For exceptions or monetization/commercialization questions, contact Ashley Childress at [human@checkmarkdevtools.dev](mailto:human@checkmarkdevtools.dev).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitlint_rai
|