Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit d2d5e87

Browse files
committed
Add top authors display to git pkgs stats output
1 parent 037d5d0 commit d2d5e87

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## [Unreleased]
22

3+
- `git pkgs stats` now shows top authors in default output
4+
35
## [0.5.0] - 2026-01-04
46

57
- `git pkgs init` now installs git hooks by default (use `--no-hooks` to skip)

lib/git/pkgs/commands/stats.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ def collect_stats(branch, branch_name)
103103
{ path: manifest.path, ecosystem: manifest.ecosystem, changes: change_counts[manifest.id] || 0 }
104104
end
105105

106+
top_authors = changes
107+
.where(change_type: "added")
108+
.joins(:commit)
109+
.group("commits.author_name")
110+
.order("count_all DESC")
111+
.limit(5)
112+
.count
113+
114+
data[:top_authors] = top_authors.map { |name, count| { name: name, added: count } }
115+
106116
data
107117
end
108118

@@ -159,6 +169,15 @@ def output_text(data)
159169
data[:manifests].each do |m|
160170
puts " #{m[:path]} (#{m[:ecosystem]}): #{m[:changes]} changes"
161171
end
172+
173+
if data[:top_authors]&.any?
174+
puts
175+
puts "Top Authors (by deps added)"
176+
puts "-" * 27
177+
data[:top_authors].each do |author|
178+
puts " #{author[:added].to_s.rjust(4)} #{author[:name]}"
179+
end
180+
end
162181
end
163182

164183
def output_by_author

0 commit comments

Comments
 (0)