Skip to content

Commit 82dd569

Browse files
authored
feat: remove "Ai-assisted" trailer (#27)
It's noisy and I think unnecessary.
1 parent ec86395 commit 82dd569

3 files changed

Lines changed: 15 additions & 45 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ It finds agents in four ways:
1111

1212
Multiple agents can be attributed in a single commit. Results are deduplicated by email address.
1313

14-
If any agents are found, it will append the following git trailers to the git commit:
14+
If any agents are found, it will append the following git trailer to the git commit:
1515

1616
```
1717
Co-authored-by: <email>
18-
Ai-assisted: true
1918
```
2019

2120
Emails are the official "agent" emails, where available, such as `Claude Code <noreply@anthropic.com>`.

src/git.rs

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,34 @@ pub fn append_trailers(commit_msg_file: &PathBuf, agent: &Agent, debug: bool) ->
2525
let addr = Agent::extract_email_addr(agent.email);
2626
let content_lower = content.to_lowercase();
2727
let has_co_author = content_lower.contains("co-authored-by:") && content_lower.contains(&addr.to_lowercase());
28-
let has_ai_assisted = content_lower.contains("ai-assisted: true");
2928

30-
if has_co_author && has_ai_assisted {
29+
if has_co_author {
3130
if debug {
3231
eprintln!("\n=== Git Command ===");
33-
eprintln!("Trailers already present, skipping git interpret-trailers");
32+
eprintln!("Co-authored-by trailer already present, skipping git interpret-trailers");
3433
}
3534
return Ok(());
3635
}
3736

38-
let mut cmd = std::process::Command::new("git");
39-
cmd.arg("interpret-trailers").arg("--in-place");
37+
let co_authored = format!("Co-authored-by: {}", agent.email);
4038

41-
if !has_co_author {
42-
let co_authored = format!("Co-authored-by: {}", agent.email);
43-
if debug {
44-
eprintln!("\n=== Git Command ===");
45-
eprintln!(
46-
"git interpret-trailers --in-place --trailer \"{}\" --if-exists addIfDifferent --trailer \"Ai-assisted: true\" \"{}\"",
47-
co_authored,
48-
commit_msg_file.display()
49-
);
50-
}
51-
cmd.arg("--trailer")
52-
.arg(&co_authored)
53-
.arg("--if-exists")
54-
.arg("addIfDifferent");
55-
} else if debug {
39+
if debug {
5640
eprintln!("\n=== Git Command ===");
5741
eprintln!(
58-
"git interpret-trailers --in-place --trailer \"Ai-assisted: true\" \"{}\"",
42+
"git interpret-trailers --in-place --trailer \"{}\" --if-exists addIfDifferent \"{}\"",
43+
co_authored,
5944
commit_msg_file.display()
6045
);
6146
}
6247

63-
if !has_ai_assisted {
64-
cmd.arg("--trailer").arg("Ai-assisted: true");
65-
}
66-
67-
cmd.arg(commit_msg_file);
48+
let mut cmd = std::process::Command::new("git");
49+
cmd.arg("interpret-trailers")
50+
.arg("--in-place")
51+
.arg("--trailer")
52+
.arg(&co_authored)
53+
.arg("--if-exists")
54+
.arg("addIfDifferent")
55+
.arg(commit_msg_file);
6856

6957
let output = cmd.output()?;
7058

src/main.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,6 @@ mod tests {
265265
"Should not add duplicate trailer for same email address, found {} occurrences",
266266
co_author_count
267267
);
268-
assert!(
269-
content.contains("Ai-assisted: true"),
270-
"Should still add Ai-assisted trailer even when co-authored-by already exists"
271-
);
272268
}
273269

274270
#[test]
@@ -294,11 +290,6 @@ mod tests {
294290
"Should not add duplicate trailer for same email address, found {} occurrences",
295291
co_author_count
296292
);
297-
// But SHOULD have added Ai-assisted
298-
assert!(
299-
content.contains("Ai-assisted: true"),
300-
"Should still add Ai-assisted trailer even when co-authored-by already exists"
301-
);
302293
}
303294

304295
#[test]
@@ -375,7 +366,6 @@ mod tests {
375366

376367
let content = fs::read_to_string(file.path()).unwrap();
377368
assert!(content.contains("Co-authored-by: Claude Code <noreply@anthropic.com>"));
378-
assert!(content.contains("Ai-assisted: true"));
379369
}
380370

381371
#[test]
@@ -426,12 +416,5 @@ mod tests {
426416
let content = fs::read_to_string(file.path()).unwrap();
427417
assert!(content.contains("Co-authored-by: Claude Code <noreply@anthropic.com>"));
428418
assert!(content.contains("Co-authored-by: Amp <amp@ampcode.com>"));
429-
430-
let ai_assisted_count = content.matches("Ai-assisted: true").count();
431-
assert_eq!(
432-
ai_assisted_count, 1,
433-
"Ai-assisted trailer should appear exactly once, found {} occurrences",
434-
ai_assisted_count
435-
);
436419
}
437420
}

0 commit comments

Comments
 (0)