@d3lm/pr-stats 0.1.0

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.
Files changed (3) hide show
  1. package/README.md +51 -0
  2. package/dist/index.mjs +1760 -0
  3. package/package.json +41 -0
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # pr-stats
2
+
3
+ Prints statistics for a GitHub user, e.g., time to review or size of authored PRs. It works with any repository your GitHub login can see.
4
+
5
+ ## Requirements
6
+
7
+ You need Node 20 or newer and one of two ways to authenticate.
8
+
9
+ - An authenticated gh CLI. Run `gh auth login` if you have not set that up yet.
10
+ - A GitHub access token, passed through `--token` or the `GITHUB_TOKEN` or `GH_TOKEN` environment variable. When a token is present, the tool calls the GitHub API directly and does not need the gh CLI at all. The token needs the `repo` scope to see private repositories.
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ npm install -g @d3lm/pr-stats
16
+ ```
17
+
18
+ You can also run it without installing through `npx @d3lm/pr-stats`.
19
+
20
+ ## Usage
21
+
22
+ ```sh
23
+ pr-stats
24
+ ```
25
+
26
+ Without flags, it looks at PRs from the last 90 days across all repositories you can access. It reports how quickly you finish review requests and how large your authored PRs are. The `--reports` flag picks which of these run. The size report includes three charts, a log-bucketed size histogram, a quantile strip per metric, and a line chart of PR sizes over time. The `--charts` flag picks which of them get printed.
27
+
28
+ ```sh
29
+ # Limit the search to one repository and a start date
30
+ pr-stats --repo owner/name --since 2026-01-01
31
+
32
+ # Run only the time-to-review analysis
33
+ pr-stats --reports review-time
34
+
35
+ # Report how many reviews finished within one working day
36
+ pr-stats --work-hours 9-17 --target 1d
37
+
38
+ # Report how many authored PRs stayed under 400 changed lines
39
+ pr-stats --size-target 400
40
+
41
+ # Print only the size histograms and skip the other charts
42
+ pr-stats --charts histogram
43
+
44
+ # Print no size charts at all
45
+ pr-stats --charts none
46
+
47
+ # Authenticate with an access token instead of the gh CLI
48
+ pr-stats --token ghp_yourtoken
49
+ ```
50
+
51
+ Run `pr-stats --help` for the full list of options.