dev-wrapped 0.0.0-stage → 1.0.1
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.
- package/LICENSE +21 -0
- package/README.md +136 -3
- package/bin/git-wrapped.js +183 -0
- package/package.json +45 -6
- package/src/archetypes.js +128 -0
- package/src/fonts/Geist-Variable.woff2 +0 -0
- package/src/fonts/GeistMono-Variable.woff2 +0 -0
- package/src/fonts/OFL.txt +92 -0
- package/src/git.js +124 -0
- package/src/github.js +192 -0
- package/src/html.js +51 -0
- package/src/icons.js +48 -0
- package/src/stats.js +226 -0
- package/src/story/app.js +447 -0
- package/src/story/style.css +141 -0
- package/src/terminal.js +288 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 git-wrapped contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# git-wrapped
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/dev-wrapped)
|
|
6
|
+
[](https://www.npmjs.com/package/dev-wrapped)
|
|
7
|
+
[](package.json)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
### Spotify Wrapped, but for your Git history.
|
|
11
|
+
|
|
12
|
+
**One command. Your whole coding year, turned into a stunning terminal recap<br>and an animated story you can share.**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx dev-wrapped
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
<img src="assets/story.gif" width="288" alt="Animated Git Wrapped story" />
|
|
19
|
+
|
|
20
|
+
<img src="assets/card.png" width="400" alt="Shareable Git Wrapped card" />
|
|
21
|
+
|
|
22
|
+
Zero dependencies · Works on one repo, all your repos, or a whole GitHub account
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## What you get
|
|
29
|
+
|
|
30
|
+
**1. A gorgeous terminal recap**: gradient titles, animated counters, a contribution heatmap, your coding clock…
|
|
31
|
+
|
|
32
|
+
<img src="assets/terminal.png" width="620" alt="Terminal output" />
|
|
33
|
+
|
|
34
|
+
**2. An animated story in your browser**: full-screen slides, Instagram-story style, with confetti
|
|
35
|
+
|
|
36
|
+
**3. A 1080×1350 share card**: download the PNG at the end and post it with **#GitWrapped**
|
|
37
|
+
|
|
38
|
+
## Your developer personality
|
|
39
|
+
|
|
40
|
+
Based on *when* and *how* you commit, git-wrapped tells you who you really are:
|
|
41
|
+
|
|
42
|
+
| Personality | You… |
|
|
43
|
+
|---|---|
|
|
44
|
+
| **The Night Owl** | commit while the world sleeps |
|
|
45
|
+
| **The Early Bird** | ship before the coffee is ready |
|
|
46
|
+
| **The Weekend Warrior** | don't know what Saturday is |
|
|
47
|
+
| **The Firefighter** | are the one everybody calls when it's on fire |
|
|
48
|
+
| **The Marathoner** | kept a streak going for weeks |
|
|
49
|
+
| **The Cleaner** | deleted more code than you wrote |
|
|
50
|
+
| **The Architect** | land whole features in one commit |
|
|
51
|
+
| **The Sniper** | make tiny, surgical commits |
|
|
52
|
+
| **The Tornado** | had a day with 25+ commits |
|
|
53
|
+
| **The Professional** | have achieved work-life balance |
|
|
54
|
+
| **The Steady Builder** | just kept building |
|
|
55
|
+
|
|
56
|
+
Which one are you? Run it and find out.
|
|
57
|
+
|
|
58
|
+
## Stats included
|
|
59
|
+
|
|
60
|
+
- Total commits, active days and **estimated hours of coding**
|
|
61
|
+
- Lines added/removed, plus **how many novels that would fill** (*"That's 1.2× Dune"*)
|
|
62
|
+
- Year heatmap, **longest streak** and busiest day
|
|
63
|
+
- Peak hour, favorite weekday and **your latest-night commit**
|
|
64
|
+
- Top languages
|
|
65
|
+
- Your favorite commit words, how many times you wrote "fix", **WIP and rage commits**
|
|
66
|
+
- Your most edited file and your **partner in crime**
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Wrap the current repository (your commits only)
|
|
72
|
+
npx dev-wrapped
|
|
73
|
+
|
|
74
|
+
# Wrap ALL your projects at once
|
|
75
|
+
npx dev-wrapped --scan ~/code
|
|
76
|
+
|
|
77
|
+
# Your WHOLE GitHub account, nothing to clone
|
|
78
|
+
npx dev-wrapped --github
|
|
79
|
+
|
|
80
|
+
# Anyone's GitHub year
|
|
81
|
+
npx dev-wrapped --github torvalds
|
|
82
|
+
|
|
83
|
+
# A team recap of the current repo
|
|
84
|
+
npx dev-wrapped --everyone
|
|
85
|
+
|
|
86
|
+
# Another year
|
|
87
|
+
npx dev-wrapped --year 2025
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Option | Description |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `-y, --year <year>` | Year to wrap (default: current year) |
|
|
93
|
+
| `-s, --scan <dir>` | Scan every git repo inside a folder |
|
|
94
|
+
| `-g, --github [user]` | Wrap a whole GitHub account (default: yours) |
|
|
95
|
+
| `--tz <zone>` | Time zone used for hours in GitHub mode (default: yours) |
|
|
96
|
+
| `-a, --author <who>` | Name or email to match (repeatable). Default: your `git config` |
|
|
97
|
+
| `--everyone` | Count all authors (team recap) |
|
|
98
|
+
| `--no-open` | Don't open the browser story |
|
|
99
|
+
| `--no-anim` | Disable terminal animations |
|
|
100
|
+
| `-o, --out <file>` | Where to save the HTML story |
|
|
101
|
+
| `--json` | Output raw stats as JSON (build your own thing!) |
|
|
102
|
+
|
|
103
|
+
## GitHub mode
|
|
104
|
+
|
|
105
|
+
`--github` reads a whole account through the GitHub API: commits on every repo (including other people's projects you contributed to), **pull requests, reviews, issues** and your exact profile contribution calendar.
|
|
106
|
+
|
|
107
|
+
It needs a token, and finds one by itself if you use the [GitHub CLI](https://cli.github.com) (`gh auth login`). Otherwise:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
GITHUB_TOKEN=<your token> npx dev-wrapped --github
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Create the token at [github.com/settings/tokens](https://github.com/settings/tokens). No scope is needed for public data; add `repo` to include your private repositories.
|
|
114
|
+
|
|
115
|
+
> Commit details come from the default branch of the 40 repos you contributed to most.
|
|
116
|
+
|
|
117
|
+
## Privacy
|
|
118
|
+
|
|
119
|
+
In local mode, git-wrapped only reads your `git log`: no network calls, no tracking, no account.
|
|
120
|
+
In `--github` mode it talks only to `api.github.com`, with your own token.
|
|
121
|
+
The story is a single HTML file saved on your machine.
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
New personalities, stats or slides are very welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
126
|
+
|
|
127
|
+
If git-wrapped made you smile, **leave a star**. It really helps!
|
|
128
|
+
|
|
129
|
+
## Credits
|
|
130
|
+
|
|
131
|
+
- Typeface: [Geist and Geist Mono](https://vercel.com/font) by Vercel, under the SIL Open Font License (see `src/fonts/OFL.txt`).
|
|
132
|
+
- Icons: original line icons drawn for this project.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join, resolve } from 'node:path';
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import { readCommits, findRepos, isRepoDir, repoRoot, gitConfig } from '../src/git.js';
|
|
7
|
+
import { computeStats } from '../src/stats.js';
|
|
8
|
+
import { render, rawLine, style } from '../src/terminal.js';
|
|
9
|
+
import { buildHtml } from '../src/html.js';
|
|
10
|
+
import { resolveToken, makeRequest, fetchGitHubYear, GitHubError } from '../src/github.js';
|
|
11
|
+
|
|
12
|
+
const { DIM, BOLD, RESET } = style;
|
|
13
|
+
|
|
14
|
+
const HELP = `
|
|
15
|
+
${BOLD}git-wrapped${RESET} — Spotify Wrapped, but for your Git history
|
|
16
|
+
|
|
17
|
+
${BOLD}Usage${RESET}
|
|
18
|
+
npx dev-wrapped [options]
|
|
19
|
+
|
|
20
|
+
${BOLD}Examples${RESET}
|
|
21
|
+
npx dev-wrapped ${DIM}# this repo${RESET}
|
|
22
|
+
npx dev-wrapped --scan ~/code ${DIM}# every repo on your machine${RESET}
|
|
23
|
+
npx dev-wrapped --github ${DIM}# your whole GitHub account${RESET}
|
|
24
|
+
npx dev-wrapped --github torvalds ${DIM}# anyone's GitHub year${RESET}
|
|
25
|
+
|
|
26
|
+
${BOLD}GitHub mode${RESET} needs a token: it uses ${BOLD}gh auth token${RESET} if you have the GitHub CLI,
|
|
27
|
+
otherwise set ${BOLD}GITHUB_TOKEN${RESET} (create one at https://github.com/settings/tokens,
|
|
28
|
+
no scope needed for public data, "repo" to include your private repos).
|
|
29
|
+
|
|
30
|
+
${BOLD}Options${RESET}
|
|
31
|
+
-y, --year <year> Year to wrap (default: current year)
|
|
32
|
+
-s, --scan <dir> Scan every git repo inside <dir> (e.g. ~/code)
|
|
33
|
+
-g, --github [user] Wrap a whole GitHub account, no cloning needed
|
|
34
|
+
(default: the account of your token)
|
|
35
|
+
--tz <zone> Time zone for --github hours (default: yours)
|
|
36
|
+
-a, --author <who> Name or email to match (repeatable). Default: your git config
|
|
37
|
+
--everyone Count every author (great for team recaps)
|
|
38
|
+
--no-open Don't open the story in the browser
|
|
39
|
+
--no-anim Disable terminal animations
|
|
40
|
+
-o, --out <file> Where to save the HTML story
|
|
41
|
+
--json Print raw stats as JSON
|
|
42
|
+
-h, --help Show this help
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
function parseArgs(argv) {
|
|
46
|
+
const o = { year: new Date().getFullYear(), scan: null, github: undefined, tz: Intl.DateTimeFormat().resolvedOptions().timeZone, authors: [], everyone: false, open: true, anim: true, out: null, json: false };
|
|
47
|
+
for (let i = 0; i < argv.length; i++) {
|
|
48
|
+
const a = argv[i];
|
|
49
|
+
const next = () => {
|
|
50
|
+
const v = argv[++i];
|
|
51
|
+
if (v === undefined) fail(`Missing value for ${a}`);
|
|
52
|
+
return v;
|
|
53
|
+
};
|
|
54
|
+
if (a === '-y' || a === '--year') o.year = Number(next());
|
|
55
|
+
else if (a === '-s' || a === '--scan') o.scan = next();
|
|
56
|
+
else if (a === '-g' || a === '--github') o.github = argv[i + 1] && !argv[i + 1].startsWith('-') ? argv[++i].replace(/^@/, '') : null;
|
|
57
|
+
else if (a === '--tz') o.tz = next();
|
|
58
|
+
else if (a === '-a' || a === '--author') o.authors.push(next().toLowerCase());
|
|
59
|
+
else if (a === '--everyone') o.everyone = true;
|
|
60
|
+
else if (a === '--no-open') o.open = false;
|
|
61
|
+
else if (a === '--no-anim') o.anim = false;
|
|
62
|
+
else if (a === '-o' || a === '--out') o.out = next();
|
|
63
|
+
else if (a === '--json') o.json = true;
|
|
64
|
+
else if (a === '-h' || a === '--help') {
|
|
65
|
+
rawLine(HELP);
|
|
66
|
+
process.exit(0);
|
|
67
|
+
} else fail(`Unknown option: ${a}`);
|
|
68
|
+
}
|
|
69
|
+
if (!Number.isInteger(o.year) || o.year < 1970 || o.year > 3000) fail('Invalid --year');
|
|
70
|
+
try {
|
|
71
|
+
new Intl.DateTimeFormat('en-US', { timeZone: o.tz });
|
|
72
|
+
} catch {
|
|
73
|
+
fail(`Unknown time zone: ${o.tz} (example: Europe/Paris)`);
|
|
74
|
+
}
|
|
75
|
+
if (o.github !== undefined && o.github !== null && !/^[a-z\d](?:[a-z\d-]{0,38})$/i.test(o.github)) fail(`Invalid GitHub username: ${o.github}`);
|
|
76
|
+
return o;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function fail(msg) {
|
|
80
|
+
console.error(`\n ${msg}\n`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function openFile(file) {
|
|
85
|
+
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'cmd' : 'xdg-open';
|
|
86
|
+
const args = process.platform === 'win32' ? ['/c', 'start', '""', file] : [file];
|
|
87
|
+
try {
|
|
88
|
+
const child = spawn(cmd, args, { stdio: 'ignore', detached: true });
|
|
89
|
+
child.on('error', () => {});
|
|
90
|
+
child.unref();
|
|
91
|
+
return true;
|
|
92
|
+
} catch {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function loadGitHub(o) {
|
|
98
|
+
const token = resolveToken();
|
|
99
|
+
if (!token) {
|
|
100
|
+
fail(
|
|
101
|
+
'GitHub mode needs a token.\n' +
|
|
102
|
+
' • If you have the GitHub CLI: gh auth login\n' +
|
|
103
|
+
' • Otherwise: create a token at https://github.com/settings/tokens and run\n' +
|
|
104
|
+
' GITHUB_TOKEN=<your token> npx dev-wrapped --github'
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
const request = makeRequest(token);
|
|
108
|
+
let login = o.github;
|
|
109
|
+
if (!login) login = (await request('query { viewer { login } }')).viewer.login;
|
|
110
|
+
const status = (msg) => process.stderr.isTTY && process.stderr.write(`\r\x1b[2K ${DIM}${msg}${RESET}`);
|
|
111
|
+
status(`Fetching @${login}'s ${o.year} from GitHub…`);
|
|
112
|
+
const res = await fetchGitHubYear(login, {
|
|
113
|
+
year: o.year,
|
|
114
|
+
timeZone: o.tz,
|
|
115
|
+
request,
|
|
116
|
+
onProgress: (p) => p.phase === 'repo' && status(`Reading commits… ${p.done}/${p.total} repos (${p.repo})`),
|
|
117
|
+
});
|
|
118
|
+
if (process.stderr.isTTY) process.stderr.write('\r\x1b[2K');
|
|
119
|
+
if (!res.commits.length && !res.github.contributions) fail(`@${login} has no public activity in ${o.year}.`);
|
|
120
|
+
return computeStats(res.commits, {
|
|
121
|
+
year: o.year,
|
|
122
|
+
name: res.user.name || res.user.login,
|
|
123
|
+
calendar: res.calendar,
|
|
124
|
+
github: res.github,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function main() {
|
|
129
|
+
const o = parseArgs(process.argv.slice(2));
|
|
130
|
+
const stats = o.github !== undefined ? await loadGitHub(o) : loadLocal(o);
|
|
131
|
+
await output(stats, o);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function loadLocal(o) {
|
|
135
|
+
let repos;
|
|
136
|
+
if (o.scan) {
|
|
137
|
+
repos = findRepos(o.scan);
|
|
138
|
+
if (!repos.length) fail(`No git repositories found in ${o.scan}`);
|
|
139
|
+
} else {
|
|
140
|
+
if (!isRepoDir(process.cwd())) fail('Not inside a git repository. Run it in a repo, or use --scan ~/code to wrap all your projects.');
|
|
141
|
+
repos = [repoRoot(process.cwd())];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const since = `${o.year}-01-01T00:00:00`;
|
|
145
|
+
const until = `${o.year + 1}-01-01T00:00:00`;
|
|
146
|
+
const all = repos.flatMap((r) => readCommits(r, { since, until }));
|
|
147
|
+
|
|
148
|
+
const cwd = o.scan ? repos[0] : process.cwd();
|
|
149
|
+
const myEmail = gitConfig('user.email', cwd).toLowerCase();
|
|
150
|
+
const myName = gitConfig('user.name', cwd);
|
|
151
|
+
let who = o.authors;
|
|
152
|
+
if (!who.length && !o.everyone) who = [myEmail, myName.toLowerCase()].filter(Boolean);
|
|
153
|
+
const mine = o.everyone || !who.length ? all : all.filter((c) => who.some((w) => c.email.includes(w) || c.name.toLowerCase().includes(w)));
|
|
154
|
+
|
|
155
|
+
if (!mine.length) {
|
|
156
|
+
fail(
|
|
157
|
+
all.length
|
|
158
|
+
? `Found ${all.length} commits in ${o.year}, but none by ${who.join(' / ')}.\n Try --author <name|email> or --everyone.`
|
|
159
|
+
: `No commits found in ${o.year}. Try another --year.`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const name = o.everyone ? 'Team ' + (repos.length === 1 ? repos[0].split(/[\\/]/).pop() : 'recap') : myName || mine[0].name;
|
|
164
|
+
return computeStats(mine, { year: o.year, allCommits: all, name, repos });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function output(stats, o) {
|
|
168
|
+
if (o.json) {
|
|
169
|
+
process.stdout.write(JSON.stringify(stats, null, 2) + '\n');
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
await render(stats, { anim: o.anim });
|
|
174
|
+
|
|
175
|
+
const file = resolve(o.out || join(tmpdir(), `git-wrapped-${o.year}.html`));
|
|
176
|
+
writeFileSync(file, buildHtml(stats));
|
|
177
|
+
const opened = o.open && process.stdout.isTTY && openFile(file);
|
|
178
|
+
rawLine(` ${BOLD}◆ Your animated story${RESET} ${DIM}${opened ? 'is opening in your browser' : 'is ready'}:${RESET}`);
|
|
179
|
+
rawLine(` ${DIM}file://${file}${RESET}`);
|
|
180
|
+
rawLine(` ${DIM}Download your card at the end and share it with${RESET} ${BOLD}#GitWrapped${RESET}\n`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
main().catch((e) => fail(e instanceof GitHubError ? e.message : e.stack || e.message));
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dev-wrapped",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dev-wrapped",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "🎁 Spotify Wrapped, but for your Git history. Stunning terminal recap + a shareable story in your browser. Zero dependencies.",
|
|
5
|
+
"author": "Curtis-sama",
|
|
6
|
+
"homepage": "https://github.com/Curtis-sama/dev-wrapped#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Curtis-sama/dev-wrapped.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Curtis-sama/dev-wrapped/issues"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"bin": {
|
|
16
|
+
"dev-wrapped": "bin/git-wrapped.js",
|
|
17
|
+
"git-wrapped": "bin/git-wrapped.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"bin",
|
|
21
|
+
"src",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"start": "node bin/git-wrapped.js",
|
|
27
|
+
"test": "node --test"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"git",
|
|
31
|
+
"wrapped",
|
|
32
|
+
"year-in-review",
|
|
33
|
+
"stats",
|
|
34
|
+
"cli",
|
|
35
|
+
"terminal",
|
|
36
|
+
"developer",
|
|
37
|
+
"commits",
|
|
38
|
+
"github",
|
|
39
|
+
"spotify-wrapped"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18"
|
|
43
|
+
},
|
|
44
|
+
"license": "MIT"
|
|
45
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// Each archetype: a score (>= 1 means "qualifies"), and a color palette used by the
|
|
2
|
+
// terminal and the browser story. The highest score wins.
|
|
3
|
+
export const ARCHETYPES = [
|
|
4
|
+
{
|
|
5
|
+
id: 'night-owl',
|
|
6
|
+
icon: 'moon',
|
|
7
|
+
emoji: '🦉',
|
|
8
|
+
name: 'The Night Owl',
|
|
9
|
+
tagline: 'The bugs come out at night. So do you.',
|
|
10
|
+
description: 'Most of your code was written while the rest of the world was asleep.',
|
|
11
|
+
palette: ['#1e1b4b', '#6d28d9', '#c084fc', '#f0abfc'],
|
|
12
|
+
score: (s) => s.nightShare / 0.3,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'early-bird',
|
|
16
|
+
icon: 'sunrise',
|
|
17
|
+
emoji: '🌅',
|
|
18
|
+
name: 'The Early Bird',
|
|
19
|
+
tagline: 'Shipping before the coffee is even ready.',
|
|
20
|
+
description: 'You do your best work at dawn, before the first Slack message lands.',
|
|
21
|
+
palette: ['#7c2d12', '#ea580c', '#fbbf24', '#fef3c7'],
|
|
22
|
+
score: (s) => s.earlyShare / 0.22,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'weekend-warrior',
|
|
26
|
+
icon: 'weekend',
|
|
27
|
+
emoji: '⚔️',
|
|
28
|
+
name: 'The Weekend Warrior',
|
|
29
|
+
tagline: 'Saturday? Never heard of her.',
|
|
30
|
+
description: 'A huge chunk of your commits landed on Saturdays and Sundays.',
|
|
31
|
+
palette: ['#450a0a', '#dc2626', '#fb7185', '#fecdd3'],
|
|
32
|
+
score: (s) => s.weekendShare / 0.33,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'firefighter',
|
|
36
|
+
icon: 'flame',
|
|
37
|
+
emoji: '🚒',
|
|
38
|
+
name: 'The Firefighter',
|
|
39
|
+
tagline: 'Something is always on fire. You bring the hose.',
|
|
40
|
+
description: 'Fixes, patches and hotfixes: you are the one everyone calls.',
|
|
41
|
+
palette: ['#431407', '#f97316', '#facc15', '#fff7ed'],
|
|
42
|
+
score: (s) => s.fixShare / 0.3,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'marathoner',
|
|
46
|
+
icon: 'trend',
|
|
47
|
+
emoji: '🏃',
|
|
48
|
+
name: 'The Marathoner',
|
|
49
|
+
tagline: 'Consistency is your superpower.',
|
|
50
|
+
description: 'You kept a commit streak going for weeks. Relentless.',
|
|
51
|
+
palette: ['#052e16', '#16a34a', '#4ade80', '#dcfce7'],
|
|
52
|
+
score: (s) => s.longestStreak.length / 21,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'cleaner',
|
|
56
|
+
icon: 'trash',
|
|
57
|
+
emoji: '🧹',
|
|
58
|
+
name: 'The Cleaner',
|
|
59
|
+
tagline: 'The best code is no code.',
|
|
60
|
+
description: 'You deleted more than you wrote. Every codebase needs someone like you.',
|
|
61
|
+
palette: ['#083344', '#0891b2', '#67e8f9', '#ecfeff'],
|
|
62
|
+
score: (s) => (s.removed > s.added && s.commits > 10 ? 1.2 + (s.removed - s.added) / (s.added + 1) : 0),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'architect',
|
|
66
|
+
icon: 'cube',
|
|
67
|
+
emoji: '🏗️',
|
|
68
|
+
name: 'The Architect',
|
|
69
|
+
tagline: 'Go big or go home.',
|
|
70
|
+
description: 'Your commits are massive. Whole features, landed in one go.',
|
|
71
|
+
palette: ['#172554', '#2563eb', '#60a5fa', '#dbeafe'],
|
|
72
|
+
score: (s) => s.avgLines / 400,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'sniper',
|
|
76
|
+
icon: 'scope',
|
|
77
|
+
emoji: '🎯',
|
|
78
|
+
name: 'The Sniper',
|
|
79
|
+
tagline: 'Small commits. Surgical precision.',
|
|
80
|
+
description: 'Tiny, focused commits — the kind reviewers dream about.',
|
|
81
|
+
palette: ['#1a2e05', '#65a30d', '#bef264', '#f7fee7'],
|
|
82
|
+
score: (s) => (s.commits >= 40 && s.avgLines > 0 ? 20 / s.avgLines : 0),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'tornado',
|
|
86
|
+
icon: 'tornado',
|
|
87
|
+
emoji: '🌪️',
|
|
88
|
+
name: 'The Tornado',
|
|
89
|
+
tagline: 'When you go, you GO.',
|
|
90
|
+
description: 'Some days you commit like a machine gun. Your busiest day was legendary.',
|
|
91
|
+
palette: ['#3b0764', '#a21caf', '#f472b6', '#fce7f3'],
|
|
92
|
+
score: (s) => (s.busiest ? s.busiest.count / 25 : 0),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'nine-to-five',
|
|
96
|
+
icon: 'briefcase',
|
|
97
|
+
emoji: '💼',
|
|
98
|
+
name: 'The Professional',
|
|
99
|
+
tagline: 'Work-life balance: achieved.',
|
|
100
|
+
description: 'Weekdays, office hours, clean exit. Your therapist is proud of you.',
|
|
101
|
+
palette: ['#0f172a', '#334155', '#94a3b8', '#f1f5f9'],
|
|
102
|
+
score: (s) => s.officeShare / 0.75,
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
export const DEFAULT_ARCHETYPE = {
|
|
107
|
+
id: 'builder',
|
|
108
|
+
icon: 'stack',
|
|
109
|
+
emoji: '🧑💻',
|
|
110
|
+
name: 'The Steady Builder',
|
|
111
|
+
tagline: 'Brick by brick, commit by commit.',
|
|
112
|
+
description: 'No drama, no burnout: you just kept building, all year long.',
|
|
113
|
+
palette: ['#022c22', '#0d9488', '#5eead4', '#f0fdfa'],
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export function pickArchetype(stats) {
|
|
117
|
+
let best = null;
|
|
118
|
+
let bestScore = 1;
|
|
119
|
+
for (const a of ARCHETYPES) {
|
|
120
|
+
const sc = a.score(stats);
|
|
121
|
+
if (sc >= bestScore) {
|
|
122
|
+
best = a;
|
|
123
|
+
bestScore = sc;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const { score, ...rest } = best || DEFAULT_ARCHETYPE;
|
|
127
|
+
return rest;
|
|
128
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2023 Vercel, in collaboration with basement.studio
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|