AI • Science • Technology • Future

Side Projects

Spotify Wrapped for Git History: A Developer’s Year in Code

Image from the original article
Featured image: original publisher image. Via original publisher.

Every December, social media feeds flood with Spotify Wrapped. It features top artists, listening time, and claims like ‘you’re in the top 1% of fans.’ Source: dev.to.

For a developer, that’s a familiar sight. But every year, the same thought arises: a developer spends far more hours writing code than listening to music. Where is the code version of Wrapped?

What Happened

Developer Curtis Sama created dev-wrapped, a tool that generates a year-in-code recap for any Git repository. It runs with a single command and requires no dependencies.

The tool produces three outputs: a terminal recap, an animated browser story, and a shareable card.

What You Get

  • A terminal recap with a gradient title, animated counters, and a heatmap of contributions.
  • An animated story in your browser, presented in Instagram-style slides. It includes your commits, lines of code, coding clock, and language usage.
  • A developer personality based on commit patterns: Night Owl, Firefighter, Cleaner, Sniper, Weekend Warrior, and six others.
  • A shareable card, 1080×1350 pixels, ready for X, LinkedIn, or Slack.

The tool is designed to be honest. It does not inflate stats or add artificial metrics. The ‘latest commit’ stat can be humbling, especially for active developers.

How It Works

The tool follows a strict principle: zero dependencies. It uses only native tools, ensuring fast startup and minimal trust in external packages.

Step 1: Reading Git History

It pulls all commits from a repository using one git log command with specific flags:

  1. --all --no-merges: includes all branches, skips merge commits.
  2. --since=2026-01-01 --until=2027-01-01: limits data to one year.
  3. --date=format:'%Y-%m-%d %H %M %u': preserves local time. A commit at 2am in Paris counts as 2am, not UTC.
  4. --pretty=format:'%x1e%H%x1f%an%x1f%ae%x1f%ad%x1f%s': safely splits commit data using ASCII record and unit separators.
  5. --numstat: tracks lines added and removed per file.

It ignores lockfiles and generated directories like node_modules/dist to prevent overestimating activity.

Step 2: Estimating Coding Hours

Git doesn’t record how long a developer worked. The tool estimates based on commit gaps.

It sorts commits and checks the time between each. If the gap is under two hours, it assumes continuous work and adds the gap. Otherwise, it adds 30 minutes for the work before the first commit.

This method is not perfect, but users report it closely matches their personal estimates.

Step 3: Personality Detection

Each personality is scored using a function. The highest score determines the result.

  • Night Owl: commits between 22:00 and 05:00 make up 30% or more.
  • Firefighter: at least 30% of commits are fixes or patches.
  • Marathoner: has a 3-week coding streak.

If no personality qualifies, the result is ‘The Steady Builder.’ Adding a new personality is a simple 10-line change, making it a great contribution for new developers.

Image from the original article
original publisher image. Via original publisher. · Source

Step 4: Browser Story & Share Card

The browser story is a single HTML file. It includes CSS, JavaScript, embedded fonts (Geist and Geist Mono), and stats in JSON. It works offline and looks identical across devices.

Icons are defined in SVG path data. The same strings render in slides and in canvas drawing commands like ctx.stroke(new Path2D(ICONS.moon)).

One source of truth, two renderers: the data is consistent, whether viewed in terminal or browser.

GitHub Mode

With --github, the tool scans a user’s entire GitHub profile. It counts pull requests, reviews, and issues, and uses the real contribution calendar.

It uses the GitHub GraphQL API. For the 40 most active repositories, it pages through commit history in parallel. Timestamps are converted to local time before analysis.

It requires a token. If you use the GitHub CLI, it finds one automatically. Otherwise, set the GITHUB_TOKEN environment variable.

It can even analyze public users. For example, npx dev-wrapped --github torvalds runs on Linus Torvalds’ profile.

The tool is open source and MIT licensed. It is available at github.com/Curtis-sama/dev-wrapped.

If it made you smile, a star on GitHub helps. The author also invites feedback: which personality did you get? Is it accurate?

For a visual example, see the demo card at this link.

For a full view of the output, see the card at this link.

And here’s a sample of the share card design: this link.

Sources & further reading

Featured image: original publisher image. Via original publisher. Image source

Leave a Reply

Your email address will not be published. Required fields are marked *