feat(trace): keep line attribution across renames
Merged
JI
2d ago+770+770+012345678901234567890123456789-59-59-01234567890123456789
Milestone 3 of spec issue-3639: the AI/human line split survives renames and history rewrites (R-007).
- Commit lines now detect renames. A renamed file shows only the lines that changed, under its new path, with its old path. The ledger matches the new path first, then the old one.
- At push, each session file is blamed under its path at HEAD, so the lines of a file that a later commit renamed still count for the session. Each line counts for the path that its commit changed.
- The replacement scan follows renamed files. A human change to a renamed file sends the session again and joins it, as it does without the rename (R-004, R-010).
- Amend, rebase, squash, and cherry-pick already kept the split through the post-rewrite hook and the content match. They now have lifecycle coverage.
- The Trace README gets a "Renames and rewrites" row with its limits.
The spec lists position-first matching for repeated lines as a risk mitigation. It is not needed for the counts: a line counts as AI only as often as the ledger recorded it.
Refs #3639
AI disclosure: this change was made with the assistance of Claude Code.