Skip to content

Releases

ghusage v0.2.0

Choose a tag to compare

@tanahiro2010 tanahiro2010 released this 24 Nov 13:36
v0.2.0
2255020

Highlights

  • Faster report generation for large caches.
  • Pull requests opened for inspection remain available offline without being counted as your own activity.
  • Improved cache and coverage handling, including safer migrations for viewed pull requests.
  • More reliable date and time handling across reports.

Performance

Report generation for large caches and long periods is faster. On a copy of a real cache (112,850 events, 2,928 pull requests, 388 repositories; 5 warm-up runs, then 50 runs; load + overview, p95):

Period Before 0.2.0
366 days 137.0 ms 117.0 ms
3,000 days 161.8 ms 132.2 ms
30 days 65.9 ms 61.4 ms
7 days 38.9 ms 39.1 ms

On the synthetic benchmark (Apple M4, release build, 100,000 events, cargo bench --bench latency, p50 / p95), the differences from 0.1.6 are within run-to-run variation:

0.1.6 0.2.0 Target (p95)
100k event aggregation (overview, 1 year) 57.7 / 60.0 ms 55.5 / 56.8 ms ≤ 1000 ms
100k event aggregation (daily, 1 year) 57.5 / 59.0 ms 55.4 / 58.6 ms ≤ 1000 ms
Cached 7-day aggregation 74.3 / 91.4 ms 76.6 / 78.3 ms ≤ 200 ms
Cached 30-day aggregation 100.6 / 108.2 ms 104.3 / 107.7 ms ≤ 500 ms

Install

npm install -g ghusage@0.2.0

Prebuilt binaries are provided for macOS (Apple Silicon and Intel), Linux (x64 and arm64), and Windows (x64 and arm64).

See the README for setup and usage.

What's Changed

New Contributors

Full Changelog: v0.1.6...v0.2.0

ghusage 0.1.6

Choose a tag to compare

@tanahiro2010 tanahiro2010 released this 22 Nov 15:03
v0.1.6
10f8504

Changes

  • JSON: in diff_stats, additions and deletions are now null when no commit has known line counts (coverage: "unavailable"). Before, they were 0, and only coverage showed that the value was unknown rather than zero lines. Partial sums are still numbers, with coverage: "partial". See JSON output. If a script reads these fields, handle null.

Performance

No change to the speed of ghusage itself in this release. Measured on Apple M4 (release build, 100,000 events, 50 runs after 5 warm-up runs, cargo bench --bench latency):

0.1.5 0.1.6 Target
Cached 7-day aggregation, p95 85 ms 82 ms ≤ 200 ms
Cached 30-day aggregation, p95 118 ms 106 ms ≤ 500 ms
100k event aggregation (overview), p95 75 ms 65 ms ≤ 1000 ms

The differences are within run-to-run variation (both runs were taken on a busy machine); the code paths are unchanged.

Development

  • CI now runs formatting, the benchmarks in test mode and the 100k-event terminal UI test on one Linux runner only, and links Windows tests with rust-lld. Per-platform release builds run only for pull requests into release. A push to dev went from 5.0 to 3.0 minutes.

Install / update

npm install -g ghusage@0.1.6

Full changelog: v0.1.5...v0.1.6

What's Changed

Full Changelog: v0.1.5...v0.1.6

ghusage 0.1.5

Choose a tag to compare

@tanahiro2010 tanahiro2010 released this 22 Nov 13:28
v0.1.5
e1cf17e

Lines changed by commits and pull requests

ghusage now reports how many lines your commits added and deleted, and each pull request's current diff (#8).

  • Reports: overview shows Lines changed (your commits). daily, weekly, monthly, yearly and repos gain +Lines and -Lines columns, in tables, Markdown and CSV. JSON summaries gain diff_stats.
  • Pull requests: prs gains a Changes column and pr a Changes (current snapshot) line, showing the base-to-head diff when the pull request was last synced. In JSON this is diff. It is a snapshot of the pull request, not changes made in the period, and it is never added to the commit totals.
  • Terminal UI: line counts on the Overview, Daily and Repositories screens, PR Detail, and the pull request commit list.
  • Fetching:
    • Line counts of pull request commits and pull request diffs come with the pull request query, at no extra request.
    • ghusage sync --diff-stats fetches the line counts still missing for your other commits in the period, 100 commits per GraphQL request, in parallel. About 1,100 commits took about 12 requests.
    • Counts already stored are never fetched again.
  • Honest totals:
    • Unknown line counts are never treated as zero. A sum over only some commits is marked (~ in tables, coverage: "partial" in JSON), and one with no known counts shows ?.
    • Merge commits are left out of the totals, because GitHub reports them against their first parent.
    • Commits whose changes reach the default branch as other commits are left out too, so the same change is not counted twice. These are commits that exist only in pull requests merged by squash or rebase, and commits removed by a force push. How many were left out is reported. This rule is provisional.

Line counts are easily dominated by generated files, formatting and dependency updates. They describe what changed, not how much or how well anyone worked. See Lines changed.

Cache: the cache schema moves to version 3. A cache opened by 0.1.5 cannot be read by older versions. Pull requests synced before this version have no recorded merge method, so their commits are left out of line totals until you run ghusage sync --full for the period.

Performance

Incremental syncs are about 2.4 times faster. Measured with the published 0.1.4 and 0.1.5 on the same account (sync --since 30d, Apple M4, versions alternating with 90 s pauses):

0.1.4 0.1.5
Incremental sync (mean of runs) 14.8 s 6.2 s
Requests per incremental sync 45–47 46–47

The number of requests is unchanged; the time saved comes from running them at the same time:

  • Search pages and REST pages beyond the first are fetched in parallel, since the first page tells how many there are.
  • Commit search and the repository list start together with the pull request search.
  • A search page that GitHub reports as incomplete (its search timed out) is fetched again before the range is reported as partial.

A first sync of an empty cache is not faster: it is bound by GitHub's search rate limit (30 requests per minute). Cached reports are as fast as in 0.1.4 (cached 7-day aggregation p95 85 ms, 30-day 118 ms on Apple M4 with 100,000 events).

Sync progress

While a sync runs in a terminal, the progress now shows how many requests run in parallel out of --concurrency, how many have finished, and up to four of the requests in flight with how long each has been running.

Other changes

  • Documentation site: sitemap, robots.txt, canonical URLs, Open Graph tags, and links between the English and Japanese pages.
  • Issue forms and a pull request template.
  • The documentation now gives the correct default for --concurrency (8).

Install / update

npm install -g ghusage@0.1.5

Full changelog: v0.1.4...v0.1.5

ghusage 0.1.4

Choose a tag to compare

@tanahiro2010 tanahiro2010 released this 22 Nov 08:51
v0.1.4
fbd3f99

Markdown output and profile READMEs

  • New output format: --format markdown renders overview, daily, weekly, monthly, yearly and repos as GitHub-flavored Markdown tables.
    • Text from GitHub is sanitized, and any Markdown or HTML syntax in it is escaped, so it cannot break the tables or add links and images.
    • Like JSON and CSV, private repository names are hidden unless --include-private is given.
    • Other commands reject the format with exit code 2.
  • New guide: Profile README (日本語). It has a ready-to-copy GitHub Actions workflow that updates a section of your profile README every day. The section sits between <!-- ghusage:start --> and <!-- ghusage:end --> markers. The workflow keeps the ghusage cache between runs, so each run only syncs what changed. It uses --public-only and --require-complete, so a run with incomplete data leaves the README unchanged.
ghusage overview --since 30d --public-only --format markdown

Fixes

  • Terminal UI: on narrow terminals, the Repositories tab now hides its less important columns, so repository names stay readable. It drops PR events, active PRs, issues, merged, reviews and then visibility, in that order. Before, a 110-column terminal left about eight characters for the name.
  • Terminal UI: on macOS and Linux, SIGTERM and SIGHUP now end the UI the same way q does, so the terminal is restored. Before, the terminal was left in the alternate screen with input echo off.

Documentation

  • The home page of the documentation site now shows a terminal screenshot.
  • Known limitations are updated for the two fixes above.

Install / update

npm install -g ghusage@0.1.4

Full changelog: v0.1.3...v0.1.4

ghusage 0.1.3

Choose a tag to compare

@tanahiro2010 tanahiro2010 released this 22 Nov 07:45
v0.1.3
739cc30

Faster reports from the cache

Reports over a period (overview, daily, prs, the terminal UI, ...) load much faster from a large cache. The output is unchanged.

  • Earlier history only where it is used. For lifetime timings such as time to first review, a period load also reads events from before the period. It did this for every pull request active in the period. Timings are computed only for your own pull requests, so the earlier history is now read only for those.
  • Cheaper row decoding. Reading a cached event looked up each of its columns by name on every row, and profiles showed this lookup dominating large loads. Column positions are now resolved once per query.

Benchmark with 100,000 cached events (release build, p95):

0.1.2 0.1.3 Target
Cached 7-day aggregation (load + overview), CI runner (x64) 643 ms 145 ms ≤ 200 ms
Cached 30-day aggregation (load + overview), CI runner (x64) 806 ms 223 ms ≤ 500 ms
Cached 7-day aggregation, Apple Silicon — 94 ms ≤ 200 ms
Cached 30-day aggregation, Apple Silicon — 126 ms ≤ 500 ms

The CI rows compare both versions on the same runner. The Apple Silicon rows were measured locally (50 runs after 5 warm-up runs).

Documentation

  • Known limitations: waiting for an exhausted primary rate limit has been checked against the real GitHub API by using up the search limit. Secondary rate limits are still covered only by tests that simulate GitHub's responses.

Install / update

npm install -g ghusage@0.1.3

Full changelog: v0.1.2...v0.1.3

ghusage 0.1.2

Choose a tag to compare

@tanahiro2010 tanahiro2010 released this 22 Nov 04:56
v0.1.2
770195e

Highlights

Open a commit and read its diff

  • New command: ghusage commit <OWNER/REPO@SHA | commit URL> [--patch] shows one commit: its author and committer, parents, full message and changed files with lines added and removed. Add --patch to print the diff. It also accepts .../pull/NUMBER/commits/SHA URLs and --format json.
  • In the terminal UI, the PR Detail screen now lists the pull request's commits, oldest first. Commits removed by a force push stay in the list, dimmed and marked removed. Press Tab to move the focus to the list, / to search it, Enter to open a commit and o to open it on GitHub.
  • The new Commit screen shows the commit's details, the changed files and a colored diff. The diff keeps its +, - and @@ prefixes, so it is readable without color. Use ] and [ to jump between files. The commit loads in the background, so the UI keeps responding while it loads.
  • Fetched commits are cached, so a commit you have opened once can be shown again with --offline. The cache includes the commit message, file names and the diff. See Privacy.

npm installs recover from a missing native package

ghusage on npm ships its binary in a per-platform optional dependency (@ghusage/ghusage-<os>-<arch>). Sometimes the optional dependency doesn't get installed. This happens, for example, when a registry mirror or a supply-chain proxy has not picked up the new version yet. Before, the command then failed with "Missing optional native package".

  • The launcher now fetches the missing native package on first run. It uses your own npm configuration (registry, proxy and auth), so the package comes from wherever npm itself would fetch it, and it is stored in a cache directory.
  • Set GHUSAGE_NO_AUTO_INSTALL=1 to turn this off. Set GHUSAGE_CACHE_DIR to choose where the package is stored.
  • The release process now waits until every platform package is available on the registry before it publishes the main package.
  • See Getting started → Missing native package for updating and for fixing an install by hand.

Japanese documentation

The documentation site has moved to https://ghusage.under18.dev and now has a full Japanese translation at /ja/.

Fixes

  • Reports over a period loaded slowly from a large cache. For each pull request active in the period, SQLite scanned all of the account's cached events. The query now uses the pull request index. In the debug benchmark, cached 7- and 30-day loads went from over two minutes to seconds.
  • TUI: the PR timing row "Review → author reply" is renamed "Review → next author activity". The value counts any next activity by the author, not only replies.

Documentation

  • Known limitations now cover:
    • narrow terminals
    • termination by signal (the terminal UI does not restore the terminal after SIGTERM)
    • the permissions of an existing data directory, which are left unchanged
  • The Platforms section now says what has been checked by hand on Windows and states that Linux is covered by CI only.
  • The rate-limit section now states that rate-limit handling is tested with simulated GitHub responses, not by exhausting a real account's limits.

Install / update

npm install -g ghusage@0.1.2

Full changelog: v0.1.1...v0.1.2