cleanmsg 0.1.0__tar.gz → 0.1.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cleanmsg
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Remove AI attribution lines (Co-Authored-By: Claude, Copilot, Cursor...) or any text from git commit messages, safely.
5
5
  Project-URL: Homepage, https://github.com/enikakis/cleanmsg
6
6
  Project-URL: Issues, https://github.com/enikakis/cleanmsg/issues
@@ -162,7 +162,14 @@ Generated by GitHub Copilot
162
162
 
163
163
  Also Codex, ChatGPT, Gemini, Devin, Windsurf, Codeium, Amazon Q, Jules, Junie, Cline,
164
164
  Roo Code and opencode. Human co-authors (`Co-authored-by: Jane <jane@example.com>`)
165
- are kept. Run `cleanmsg --show-ai-patterns` for the exact regular expressions.
165
+ are kept.
166
+
167
+ Some tools share a name with real people (Claude, Devin, Jules, Gemini, Junie). For
168
+ those, the name alone is not enough: the line is only removed when it is clearly the
169
+ tool, for example `Claude Opus 4.5`, `Devin AI`, a `noreply@anthropic.com` address or
170
+ a `[bot]` address. So `Co-authored-by: Devin Smith <devin@example.com>` is kept.
171
+
172
+ Run `cleanmsg --show-ai-patterns` for the exact regular expressions.
166
173
  Missing a tool? Open an issue or PR.
167
174
 
168
175
  ## Safety
@@ -140,7 +140,14 @@ Generated by GitHub Copilot
140
140
 
141
141
  Also Codex, ChatGPT, Gemini, Devin, Windsurf, Codeium, Amazon Q, Jules, Junie, Cline,
142
142
  Roo Code and opencode. Human co-authors (`Co-authored-by: Jane <jane@example.com>`)
143
- are kept. Run `cleanmsg --show-ai-patterns` for the exact regular expressions.
143
+ are kept.
144
+
145
+ Some tools share a name with real people (Claude, Devin, Jules, Gemini, Junie). For
146
+ those, the name alone is not enough: the line is only removed when it is clearly the
147
+ tool, for example `Claude Opus 4.5`, `Devin AI`, a `noreply@anthropic.com` address or
148
+ a `[bot]` address. So `Co-authored-by: Devin Smith <devin@example.com>` is kept.
149
+
150
+ Run `cleanmsg --show-ai-patterns` for the exact regular expressions.
144
151
  Missing a tool? Open an issue or PR.
145
152
 
146
153
  ## Safety
@@ -1,3 +1,3 @@
1
1
  """cleanmsg: remove text or AI attribution lines from git commit messages."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"
@@ -15,17 +15,36 @@ ENV_SPEC = "CLEANMSG_SPEC"
15
15
  # Lines that AI coding tools commonly append to commit messages.
16
16
  # Each regex is matched against a single line (case-insensitive) and the
17
17
  # whole line is removed when it matches.
18
- _AI_TOOLS = (
19
- r"Claude|Anthropic|(?:GitHub\s+)?Copilot|Cursor(?:\s+Agent)?|Codex|ChatGPT|OpenAI|"
20
- r"Gemini|Aider|Devin|Windsurf|Codeium|Amazon\s+Q|Jules|Junie|Cline|Roo\s*Code|opencode"
18
+
19
+ # Tool names nobody is called: the name alone identifies the tool.
20
+ _TOOL_NAMES = (
21
+ r"Anthropic|(?:GitHub\s+)?Copilot|Cursor(?:\s+Agent)?|Codex|ChatGPT|OpenAI|"
22
+ r"Aider|Windsurf|Codeium|Amazon\s+Q|Cline|Roo\s*Code|opencode"
21
23
  )
24
+ # Tool names that are also people's first names. A co-author with one of
25
+ # these names is only removed when something else shows it is the tool.
26
+ _PERSON_NAMES = r"Claude|Devin|Jules|Gemini|Junie"
27
+ # Words after the name that only a tool uses: "Claude Opus 4.5", "Devin AI", "Gemini CLI".
28
+ _TOOL_SUFFIX = r"(?:AI|Agent|Assist|Bot|CLI|Code|Opus|Sonnet|Haiku|Fable|Pro|Flash|\d)\b"
29
+ # Addresses tools commit with: noreply@..., cursoragent@..., name[bot]@...
30
+ _TOOL_DOMAINS = r"anthropic\.com|openai\.com|cursor\.(?:com|sh)|aider\.chat"
31
+ _TOOL_LOCAL = r"(?:no-?reply|[^@<>\s]*agent|[^@<>\s]*\[bot\])"
32
+
33
+ _TRAILER = r"^[ \t]*Co-authored-by:[ \t]*"
22
34
  AI_PATTERNS: List[str] = [
23
- # Co-Authored-By: Claude <noreply@anthropic.com>, Co-authored-by: Copilot <...>, ...
24
- rf"^[ \t]*Co-authored-by:[ \t]*(?:{_AI_TOOLS})\b.*$",
25
- # Co-authored-by trailers identified by the tool's e-mail domain
26
- r"^[ \t]*Co-authored-by:.*<[^>]*@(?:anthropic\.com|openai\.com|cursor\.(?:com|sh)|aider\.chat)>[ \t]*$",
35
+ # Co-authored-by: Copilot <...>, Co-authored-by: Cursor Agent <...>, ...
36
+ rf"{_TRAILER}(?:{_TOOL_NAMES})\b.*$",
37
+ # Co-Authored-By: Claude Opus 4.5 <...>, Co-authored-by: Devin AI <...>
38
+ rf"{_TRAILER}(?:{_PERSON_NAMES})[ \t]+{_TOOL_SUFFIX}.*$",
39
+ # Co-authored-by: Claude (no e-mail: not a real person's trailer)
40
+ rf"{_TRAILER}(?:{_PERSON_NAMES})[ \t]*$",
41
+ # Co-Authored-By: Claude <noreply@anthropic.com>, ... <cursoragent@cursor.com>
42
+ rf"{_TRAILER}.*<{_TOOL_LOCAL}@(?:{_TOOL_DOMAINS})>[ \t]*$",
43
+ # Co-authored-by: Jules <...+google-labs-jules[bot]@users.noreply.github.com>
44
+ rf"{_TRAILER}.*<[^>@]*(?:{_PERSON_NAMES})[^>@]*\[bot\]@users\.noreply\.github\.com>[ \t]*$",
27
45
  # 🤖 Generated with [Claude Code](https://claude.com/claude-code), Generated by Copilot, ...
28
- rf"^[ \t]*(?:🤖[ \t]*)?Generated[ \t]+(?:with|by|using)[ \t]+\[?(?:{_AI_TOOLS})\b.*$",
46
+ rf"^[ \t]*(?:🤖[ \t]*)?Generated[ \t]+(?:with|by|using)[ \t]+\[?"
47
+ rf"(?:{_TOOL_NAMES}|{_PERSON_NAMES})\b.*$",
29
48
  ]
30
49
 
31
50
 
@@ -90,6 +90,40 @@ class TestAI:
90
90
  def test_leaves_humans_and_normal_text(self, msg):
91
91
  assert clean(f"Subject\n\n{msg}", ai=True) == f"Subject\n\n{msg}"
92
92
 
93
+ # Some AI tools share a name with real people. A person with that name
94
+ # must be kept; only the tool's own trailer goes.
95
+ @pytest.mark.parametrize("line", [
96
+ "Co-authored-by: Claude",
97
+ "Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>",
98
+ "Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>",
99
+ "Co-authored-by: Jules <161369871+google-labs-jules[bot]@users.noreply.github.com>",
100
+ "Co-authored-by: gemini-code-assist[bot] "
101
+ "<176961590+gemini-code-assist[bot]@users.noreply.github.com>",
102
+ "Co-authored-by: Gemini 2.5 Pro <noreply@google.com>",
103
+ "Co-authored-by: Gemini CLI <gemini-cli@example.com>",
104
+ ])
105
+ def test_removes_ai_tools_with_human_names(self, line):
106
+ msg = f"Add login form\n\n{line}\n"
107
+ assert clean(msg, ai=True) == "Add login form\n"
108
+
109
+ @pytest.mark.parametrize("line", [
110
+ "Co-authored-by: Devin Smith <devin@acme.com>",
111
+ "Co-authored-by: Devin <12345+devin@users.noreply.github.com>",
112
+ "Co-authored-by: Devin Aiken <devin@acme.com>",
113
+ "Co-authored-by: Jules Verne <jules@acme.com>",
114
+ "Co-authored-by: Jules Proulx <jules@acme.com>",
115
+ "Co-authored-by: Gemini Lee <gemini@acme.com>",
116
+ "Co-authored-by: Claude Monet <claude@acme.com>",
117
+ "Co-authored-by: Claude <claude@users.noreply.github.com>",
118
+ "Co-authored-by: Junie Moon <junie@acme.com>",
119
+ "Co-authored-by: Jane Doe <jane@anthropic.com>",
120
+ "Co-authored-by: Sam Abbot <abbot@openai.com>",
121
+ "Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>",
122
+ ])
123
+ def test_keeps_people_who_share_a_tool_name(self, line):
124
+ msg = f"Add login form\n\n{line}\n"
125
+ assert clean(msg, ai=True) == msg
126
+
93
127
  def test_keeps_other_trailers(self):
94
128
  msg = ("Fix\n\nCo-authored-by: Jane <jane@example.com>\n"
95
129
  "Co-Authored-By: Claude <noreply@anthropic.com>\n")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes