DEV Community

Cover image for I built Spotify Wrapped for your Git history (one command, zero dependencies)
Curtis-sama
Curtis-sama

Posted on

I built Spotify Wrapped for your Git history (one command, zero dependencies)

Every December, my feed fills up with Spotify Wrapped screenshots. Top artists, minutes listened, "you're in the top 1% of fans"…

And every December I think: I spent way more hours this year writing code than listening to music. Where's that recap?

So I built it.

npx dev-wrapped
Enter fullscreen mode Exit fullscreen mode

Run it in any Git repository and you get your year in code: in the terminal first, then as an animated story in your browser, Instagram-style, ending with a card you can share.

The animated story

What you get

A terminal recap. Big gradient title, animated counters, a contribution heatmap of your year, a chart of the hours you code, your languages, and a few confessions pulled from your commit messages.

Terminal output

An animated story in your browser. Full-screen slides you tap through: your commits, your lines of code, your coding clock, your year at a glance, your languages, your favorite commit words.

A developer personality. Based on when and how you commit, git-wrapped decides who you really are:

  • The Night Owl: most of your code was written while the world was asleep
  • The Firefighter: fixes, patches, hotfixes… you're the one everyone calls
  • The Cleaner: you deleted more code than you wrote
  • The Sniper: tiny, surgical commits
  • The Weekend Warrior: you don't know what Saturday is

…and six more.

A share card. A 1080×1350 image with your stats, ready for X, LinkedIn or your team's Slack.

What the card looks like

Here's an example card, generated from a demo repository:

Example Git Wrapped card

Run it on your own repos and see what yours says about you. Fair warning: the "latest commit" stat can be humbling.

Three ways to run it

npx dev-wrapped                     # the repo you're in (your commits)
npx dev-wrapped --scan ~/code       # every repo on your machine
npx dev-wrapped --github            # your whole GitHub account
npx dev-wrapped --github torvalds   # yes, you can look up anyone
Enter fullscreen mode Exit fullscreen mode

The --github mode uses the GitHub API, so it also counts pull requests, reviews and issues, and uses your exact profile contribution calendar. It needs a token: if you use the GitHub CLI it finds one automatically, otherwise set GITHUB_TOKEN.

How it works

I set myself one rule: zero dependencies. npx should start instantly, and nobody should have to trust 200 transitive packages to look at their own commits.

1. Reading Git

Everything comes from one git log call:

git log --all --no-merges \
  --since=2026-01-01 --until=2027-01-01 \
  --date=format:'%Y-%m-%d %H %M %u' \
  --pretty=format:'%x1e%H%x1f%an%x1f%ae%x1f%ad%x1f%s' \
  --numstat
Enter fullscreen mode Exit fullscreen mode

A few details that matter:

  • %x1e and %x1f are ASCII record and unit separators. Commit messages can contain any character a human can type, but nobody types those two, so splitting is safe.
  • --date=format: keeps the author's local time. If you committed at 2am in Paris, it counts as 2am, not 1am UTC. That's what makes the Night Owl detection honest.
  • --numstat gives lines added and removed per file. Lockfiles (package-lock.json, yarn.lock, Cargo.lock…) and node_modules/dist are ignored. Otherwise one npm install would make you "The Architect".

2. Estimating hours of coding

Git doesn't know how long you worked, but commit timestamps give a decent estimate. Sort all commits, then walk through them:

  • if the gap to the previous commit is under 2 hours, you were probably still working: add the gap;
  • otherwise it's a new session: add a flat 30 minutes for the work before its first commit.
let total = FIRST_COMMIT;            // 30 min
for (let i = 1; i < times.length; i++) {
  const gap = times[i] - times[i - 1];
  total += gap < TWO_HOURS ? gap : FIRST_COMMIT;
}
Enter fullscreen mode Exit fullscreen mode

It's not perfect, but it's surprisingly close to what people guess when they see it.

3. Picking a personality

Each personality is a score function. A score of 1 means "you qualify", and the highest score wins:

{ name: 'The Night Owl',  score: (s) => s.nightShare / 0.3 },         // 30%+ commits between 22:00 and 05:00
{ name: 'The Firefighter', score: (s) => s.fixShare / 0.3 },          // 30%+ commits are fixes
{ name: 'The Marathoner', score: (s) => s.longestStreak.length / 21 },// 3-week streak
Enter fullscreen mode Exit fullscreen mode

Nobody qualifies? You're The Steady Builder. Adding a personality is about 10 lines, which makes it a great first contribution.

4. A story in a single HTML file

The browser story is one self-contained HTML file written to your temp folder: CSS, JavaScript, your stats as JSON, and the fonts embedded in base64 (Geist and Geist Mono). It looks identical on every machine and works offline.

The icons are pure SVG path data. The same strings render as inline <svg> in the slides and as Path2D objects on the <canvas> that draws the share card:

ctx.stroke(new Path2D(ICONS.moon));
Enter fullscreen mode Exit fullscreen mode

One source of truth, two renderers.

5. GitHub mode

--github uses the GraphQL API. One query fetches the profile's contributionsCollection: totals, the contribution calendar and the repos you committed to. Then, for your 40 most active repos, it pages through the commit history filtered by your user ID, a few repos in parallel. Timestamps come back in UTC, so they're converted to your time zone with Intl.DateTimeFormat before the stats run.

Try it

npx dev-wrapped
Enter fullscreen mode Exit fullscreen mode

It's open source and MIT licensed: github.com/Curtis-sama/dev-wrapped

If it made you smile, a ⭐ on GitHub helps a lot. And I'd love to know: which personality did you get, and is it accurate? Drop it in the comments 👇

Top comments (0)