contrib-aquarium 0.0.0-stage → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 webywz
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,200 @@
1
- # Temporary Holding Version
1
+ # contrib-aquarium
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <img src="docs/aquarium.svg" width="860" alt="Living SVG aquarium generated from webywz's GitHub contributions" />
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/webywz/contrib-aquarium/actions/workflows/ci.yml"><img src="https://github.com/webywz/contrib-aquarium/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-c4a35a?labelColor=1b2a2e" alt="MIT" /></a>
10
+ <a href="https://www.npmjs.com/package/contrib-aquarium"><img src="https://img.shields.io/badge/npx-contrib--aquarium-2a7a5c?labelColor=1b2a2e" alt="npx contrib-aquarium" /></a>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <strong>A living SVG aquarium driven by a GitHub contribution graph.</strong><br/>
15
+ Drop one image URL into a profile README. Activity becomes fish, kelp, bubbles, and water.
16
+ </p>
17
+
18
+ <p align="center">
19
+ 由 GitHub 贡献日历驱动的活体 SVG 鱼缸。把一张图放进 README,提交就变成鱼、海藻、气泡和水纹。
20
+ </p>
21
+
22
+ The tank is pure SVG (CSS + SMIL). No JavaScript in the embed, so GitHub READMEs can host it as a regular image. Dark water, brass rim — readable on both GitHub light and dark.
23
+
24
+ 鱼缸是自包含 SVG(CSS + SMIL),嵌入时不需要 JS,可当普通图片用。暗水色 + 铜框,在 GitHub 浅色 / 深色主题下都站得住。
25
+
26
+ > v0.1.0 is the first cut. `npx contrib-aquarium` is the published entry; until the package is on npm, clone this repo and run `npm run generate`.
27
+ >
28
+ > v0.1.0 是第一版。发布到 npm 之前请 clone 本仓库,用 `npm run generate`。
29
+
30
+ ---
31
+
32
+ ## Quick start · 快速开始
33
+
34
+ ```bash
35
+ npx contrib-aquarium generate --user YOUR_LOGIN --out aquarium.svg
36
+ ```
37
+
38
+ From this repo (until the package is published):
39
+
40
+ ```bash
41
+ git clone https://github.com/webywz/contrib-aquarium.git
42
+ cd contrib-aquarium
43
+ npm install
44
+ npm run generate -- --user YOUR_LOGIN --out aquarium.svg
45
+ ```
46
+
47
+ Then in a README:
48
+
49
+ ```markdown
50
+ ![contrib-aquarium](aquarium.svg)
51
+ ```
52
+
53
+ A GitHub token is optional. Without one, generation still succeeds via public events or a deterministic mock — demos never go blank.
54
+
55
+ 没有 token 也能跑:公开 Events 或按用户名哈希生成的演示日历会顶上,预览不会空。
56
+
57
+ ---
58
+
59
+ ## Data sources · 数据来源
60
+
61
+ `--source auto` (default) tries the following in order:
62
+
63
+ | Priority | Source | Needs token | What you get |
64
+ | --- | --- | --- | --- |
65
+ | 1 | **GraphQL** `contributionsCollection` | yes (`--token`, `GITHUB_TOKEN`, or `GH_TOKEN`) | Full last-year calendar — this is the real heatmap |
66
+ | 2 | **Public events** `GET /users/{login}/events/public` | no | Recent activity only (GitHub keeps ~90 days of events) |
67
+ | 3 | **Mock** from the username hash | no | A stable, contribution-like year so CI, demos, and offline use always render |
68
+
69
+ `--source graphql|events|mock` pins a single path.
70
+
71
+ `--source auto` 默认按上表回退。GraphQL 需要 token,拿到的是完整贡献日历;公开 Events 不需要 token,但只有最近活动;mock 用用户名哈希生成确定的假日历,离线 / CI / 演示保证出图。
72
+
73
+ ```bash
74
+ # real calendar
75
+ export GITHUB_TOKEN=ghp_...
76
+ npx contrib-aquarium generate --user webywz --out docs/aquarium.svg
77
+
78
+ # recent public events only
79
+ npx contrib-aquarium generate --user webywz --source events --out aquarium.svg
80
+
81
+ # offline demo (byte-stable for a given UTC day)
82
+ npx contrib-aquarium generate --user webywz --source mock --out aquarium.svg
83
+ ```
84
+
85
+ GraphQL is a fine-grained or classic PAT with permission to read public user data. In GitHub Actions, `secrets.GITHUB_TOKEN` is enough for public calendars.
86
+
87
+ ---
88
+
89
+ ## How activity becomes an aquarium · 贡献如何变成鱼缸
90
+
91
+ | Signal | Becomes |
92
+ | --- | --- |
93
+ | Yearly contribution total | School size (3–18 fish). `round(3 + sqrt(total) × 0.48)` |
94
+ | Busiest weeks | Larger koi / a centerpiece angelfish |
95
+ | Current streak | Kelp height and count |
96
+ | Last 14 days | Bubble density |
97
+ | Each week's total | Pebble / reef bed along the sand |
98
+ | Activity density | How much the water and plants move |
99
+
100
+ Empty years still get a few wanderers. The same username + calendar snapshot always draws the same tank.
101
+
102
+ | 信号 | 变成 |
103
+ | --- | --- |
104
+ | 全年贡献总数 | 鱼的数量(3–18)。`round(3 + sqrt(total) × 0.48)` |
105
+ | 最忙的几周 | 更大的锦鲤 / 一条主鱼(神仙鱼) |
106
+ | 当前连续提交 | 海藻高度与簇数 |
107
+ | 近 14 天 | 气泡密度 |
108
+ | 每周合计 | 沙地上的礁石起伏 |
109
+ | 活跃密度 | 水纹与海藻摆动幅度 |
110
+
111
+ ---
112
+
113
+ ## Embed in a README · 嵌入 README
114
+
115
+ ### 1. Commit a raw SVG
116
+
117
+ Generate once, commit `aquarium.svg`, reference it:
118
+
119
+ ```markdown
120
+ <p align="center">
121
+ <img src="aquarium.svg" width="860" alt="My contribution aquarium" />
122
+ </p>
123
+ ```
124
+
125
+ Same-repo relative paths work. For another repo use the raw URL:
126
+
127
+ ```markdown
128
+ ![aquarium](https://raw.githubusercontent.com/USER/REPO/main/aquarium.svg)
129
+ ```
130
+
131
+ ### 2. Regenerate daily with GitHub Actions
132
+
133
+ Copy [`examples/github-action.yml`](examples/github-action.yml) into your **profile repository** (the `USER/USER` repo) as `.github/workflows/aquarium.yml`. It:
134
+
135
+ 1. Runs on a daily cron and `workflow_dispatch`
136
+ 2. Uses this repo as a composite action
137
+ 3. Commits `aquarium.svg` when the tank actually changed
138
+
139
+ ```yaml
140
+ - uses: webywz/contrib-aquarium@main
141
+ with:
142
+ user: ${{ github.repository_owner }}
143
+ out: aquarium.svg
144
+ ```
145
+
146
+ This project's own demo is refreshed the same way: [`.github/workflows/daily-aquarium.yml`](.github/workflows/daily-aquarium.yml) generates [`docs/aquarium.svg`](docs/aquarium.svg) for `webywz` every day.
147
+
148
+ 把 [`examples/github-action.yml`](examples/github-action.yml) 拷到个人主页仓库,每天会重画并提交 `aquarium.svg`。本仓库的 Action 则给 `webywz` 更新 [`docs/aquarium.svg`](docs/aquarium.svg)。
149
+
150
+ GitHub's image proxy (Camo) may cache the SVG for a short while after a push. The file in the repo is current; the README thumbnail can lag a few hours.
151
+
152
+ GitHub 的 Camo 代理可能短暂缓存图片;仓库里的文件是新的,README 缩略图有时会晚几个小时。
153
+
154
+ ---
155
+
156
+ ## CLI
157
+
158
+ ```
159
+ contrib-aquarium generate --user <login> [--out aquarium.svg]
160
+ [--source auto|graphql|events|mock]
161
+ [--token <gh_token>]
162
+ ```
163
+
164
+ | Flag | Default | |
165
+ | --- | --- | --- |
166
+ | `--user` | required | GitHub login |
167
+ | `--out` | `aquarium.svg` | Output path (directories are created) |
168
+ | `--source` | `auto` | See data sources above |
169
+ | `--token` | `$GITHUB_TOKEN` / `$GH_TOKEN` | GraphQL auth |
170
+
171
+ ```bash
172
+ npm run generate -- --user webywz --out docs/aquarium.svg
173
+ npm test
174
+ npm run build
175
+ npm run lint
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Library
181
+
182
+ ```ts
183
+ import { generateAquarium, renderAquarium, mockActivity } from "contrib-aquarium";
184
+
185
+ const { svg, activity } = await generateAquarium({
186
+ user: "webywz",
187
+ source: "auto",
188
+ });
189
+
190
+ // or draw a fixture
191
+ const svgFromMock = renderAquarium(mockActivity("webywz", new Date("2026-10-29")));
192
+ ```
193
+
194
+ Node.js 18.18+ (native `fetch`). TypeScript types ship with the package.
195
+
196
+ ---
197
+
198
+ ## License
199
+
200
+ [MIT](LICENSE)
@@ -0,0 +1,20 @@
1
+ import type { Activity, LoadOptions } from "./types.js";
2
+ import { addUtcDays, parseUtcDate } from "./util.js";
3
+ export declare class ActivityError extends Error {
4
+ readonly code: string;
5
+ constructor(message: string, code: string, options?: {
6
+ cause?: unknown;
7
+ });
8
+ }
9
+ /**
10
+ * Deterministic contribution-like calendar derived from the username.
11
+ * Same login + same `now` (UTC day) always yields the same year.
12
+ */
13
+ export declare function mockActivity(login: string, now?: Date): Activity;
14
+ export declare function fetchGraphqlActivity(login: string, token: string, now?: Date, fetchImpl?: typeof fetch): Promise<Activity>;
15
+ export declare function fetchEventsActivity(login: string, token?: string, now?: Date, fetchImpl?: typeof fetch): Promise<Activity>;
16
+ export declare function loadActivity(options: LoadOptions): Promise<Activity>;
17
+ export declare function overlayCounts(base: Activity, counts: Map<string, number>, source: Activity["source"]): Activity;
18
+ export declare function activityFromCounts(login: string, counts: Map<string, number>, now: Date, source: Activity["source"]): Activity;
19
+ export { parseUtcDate, addUtcDays };
20
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAmB,WAAW,EAAc,MAAM,YAAY,CAAC;AACrF,OAAO,EACL,UAAU,EAKV,YAAY,EAKb,MAAM,WAAW,CAAC;AASnB,qBAAa,aAAc,SAAQ,KAAK;IAGpC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBADrB,OAAO,EAAE,MAAM,EACN,IAAI,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAKhC;AAoCD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,QAAQ,CAiC5E;AAuDD,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,IAAiB,EACtB,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,QAAQ,CAAC,CAkEnB;AAiCD,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,GAAE,IAAiB,EACtB,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,QAAQ,CAAC,CAmDnB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkD1E;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GACzB,QAAQ,CAWV;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GACzB,QAAQ,CAGV;AAED,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,297 @@
1
+ import { addUtcDays, enumerateUtcDays, hashString, lastYearRange, mulberry32, parseUtcDate, readPackageVersion, startOfUtcDay, utcIsoDate, weekdayUtc, } from "./util.js";
2
+ const GRAPHQL_URL = "https://api.github.com/graphql";
3
+ const EVENTS_URL = "https://api.github.com/users";
4
+ function userAgent() {
5
+ return `contrib-aquarium/${readPackageVersion()} (+https://github.com/webywz/contrib-aquarium)`;
6
+ }
7
+ export class ActivityError extends Error {
8
+ code;
9
+ constructor(message, code, options) {
10
+ super(message, options);
11
+ this.code = code;
12
+ this.name = "ActivityError";
13
+ }
14
+ }
15
+ function resolveToken(explicit) {
16
+ return explicit || process.env.GITHUB_TOKEN || process.env.GH_TOKEN || undefined;
17
+ }
18
+ function daysToWeeks(days) {
19
+ const weeks = [];
20
+ let current = [];
21
+ for (const day of days) {
22
+ if (day.weekday === 0 && current.length > 0) {
23
+ weeks.push({ days: current });
24
+ current = [];
25
+ }
26
+ current.push(day);
27
+ }
28
+ if (current.length > 0)
29
+ weeks.push({ days: current });
30
+ return weeks;
31
+ }
32
+ function emptyYear(login, now, source) {
33
+ const { from, to } = lastYearRange(now);
34
+ const days = enumerateUtcDays(from, to).map((date) => {
35
+ const iso = utcIsoDate(date);
36
+ return { date: iso, count: 0, weekday: weekdayUtc(iso) };
37
+ });
38
+ return {
39
+ login,
40
+ name: null,
41
+ totalContributions: 0,
42
+ weeks: daysToWeeks(days),
43
+ source,
44
+ range: { from: utcIsoDate(from), to: utcIsoDate(to) },
45
+ };
46
+ }
47
+ /**
48
+ * Deterministic contribution-like calendar derived from the username.
49
+ * Same login + same `now` (UTC day) always yields the same year.
50
+ */
51
+ export function mockActivity(login, now = new Date()) {
52
+ const { from, to } = lastYearRange(now);
53
+ const rng = mulberry32(hashString(login.trim().toLowerCase()));
54
+ const diligence = 0.22 + rng() * 0.5;
55
+ const strength = 1 + rng() * 7;
56
+ const weekendFactor = 0.12 + rng() * 0.4;
57
+ const burstiness = rng();
58
+ const seasonalPhase = rng() * Math.PI * 2;
59
+ const days = enumerateUtcDays(from, to).map((date, index) => {
60
+ const iso = utcIsoDate(date);
61
+ const weekday = weekdayUtc(iso);
62
+ const weekend = weekday === 0 || weekday === 6;
63
+ const season = 0.75 + 0.45 * Math.sin((index / 365) * Math.PI * 2 + seasonalPhase);
64
+ const p = diligence * season * (weekend ? weekendFactor : 1);
65
+ let count = 0;
66
+ if (rng() < p) {
67
+ const burst = burstiness > 0.72 && rng() > 0.9 ? 10 + Math.floor(rng() * 12) : 0;
68
+ count = Math.max(1, Math.round(strength * (0.35 + rng()) + burst));
69
+ if (weekend)
70
+ count = Math.max(1, Math.round(count * 0.45));
71
+ }
72
+ return { date: iso, count, weekday };
73
+ });
74
+ const totalContributions = days.reduce((sum, day) => sum + day.count, 0);
75
+ return {
76
+ login,
77
+ name: null,
78
+ totalContributions,
79
+ weeks: daysToWeeks(days),
80
+ source: "mock",
81
+ range: { from: utcIsoDate(from), to: utcIsoDate(to) },
82
+ };
83
+ }
84
+ const CALENDAR_QUERY = `query ($login: String!, $from: DateTime!, $to: DateTime!) {
85
+ user(login: $login) {
86
+ login
87
+ name
88
+ contributionsCollection(from: $from, to: $to) {
89
+ contributionCalendar {
90
+ totalContributions
91
+ weeks {
92
+ contributionDays {
93
+ date
94
+ contributionCount
95
+ weekday
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }`;
102
+ async function githubFetch(url, init, fetchImpl) {
103
+ const response = await fetchImpl(url, {
104
+ ...init,
105
+ signal: init.signal ?? AbortSignal.timeout(15_000),
106
+ });
107
+ return response;
108
+ }
109
+ export async function fetchGraphqlActivity(login, token, now = new Date(), fetchImpl = fetch) {
110
+ const { from, to } = lastYearRange(now);
111
+ const response = await githubFetch(GRAPHQL_URL, {
112
+ method: "POST",
113
+ headers: {
114
+ Accept: "application/json",
115
+ Authorization: `Bearer ${token}`,
116
+ "Content-Type": "application/json",
117
+ "User-Agent": userAgent(),
118
+ },
119
+ body: JSON.stringify({
120
+ query: CALENDAR_QUERY,
121
+ variables: {
122
+ login,
123
+ from: `${utcIsoDate(from)}T00:00:00Z`,
124
+ to: `${utcIsoDate(to)}T23:59:59Z`,
125
+ },
126
+ }),
127
+ }, fetchImpl);
128
+ if (response.status === 401 || response.status === 403) {
129
+ throw new ActivityError(`GitHub GraphQL rejected the token (${response.status})`, "auth");
130
+ }
131
+ if (!response.ok) {
132
+ throw new ActivityError(`GitHub GraphQL HTTP ${response.status}`, "http");
133
+ }
134
+ const body = (await response.json());
135
+ if (body.errors?.length) {
136
+ throw new ActivityError(body.errors[0].message, "graphql");
137
+ }
138
+ if (!body.data?.user) {
139
+ throw new ActivityError(`GitHub user "${login}" was not found`, "not_found");
140
+ }
141
+ const calendar = body.data.user.contributionsCollection?.contributionCalendar;
142
+ if (!calendar) {
143
+ throw new ActivityError("GitHub returned no contribution calendar", "empty");
144
+ }
145
+ const weeks = calendar.weeks.map((week) => ({
146
+ days: week.contributionDays.map((day) => ({
147
+ date: day.date,
148
+ count: day.contributionCount,
149
+ weekday: weekdayUtc(day.date),
150
+ })),
151
+ }));
152
+ return {
153
+ login: body.data.user.login,
154
+ name: body.data.user.name ?? null,
155
+ totalContributions: calendar.totalContributions,
156
+ weeks,
157
+ source: "graphql",
158
+ range: { from: utcIsoDate(from), to: utcIsoDate(to) },
159
+ };
160
+ }
161
+ function eventWeight(event) {
162
+ switch (event.type) {
163
+ case "PushEvent":
164
+ return Math.max(1, event.payload?.size ?? event.payload?.commits?.length ?? 1);
165
+ case "PullRequestEvent":
166
+ return 2;
167
+ case "PullRequestReviewEvent":
168
+ case "IssuesEvent":
169
+ case "IssueCommentEvent":
170
+ case "CreateEvent":
171
+ case "ReleaseEvent":
172
+ case "CommitCommentEvent":
173
+ return 1;
174
+ case "WatchEvent":
175
+ case "ForkEvent":
176
+ case "PublicEvent":
177
+ return 0;
178
+ default:
179
+ return event.type ? 1 : 0;
180
+ }
181
+ }
182
+ export async function fetchEventsActivity(login, token, now = new Date(), fetchImpl = fetch) {
183
+ const headers = {
184
+ Accept: "application/vnd.github+json",
185
+ "User-Agent": userAgent(),
186
+ "X-GitHub-Api-Version": "2022-11-28",
187
+ };
188
+ if (token)
189
+ headers.Authorization = `Bearer ${token}`;
190
+ const events = [];
191
+ for (let page = 1; page <= 3; page++) {
192
+ const url = `${EVENTS_URL}/${encodeURIComponent(login)}/events/public?per_page=100&page=${page}`;
193
+ const response = await githubFetch(url, { headers }, fetchImpl);
194
+ if (response.status === 404) {
195
+ throw new ActivityError(`GitHub user "${login}" was not found`, "not_found");
196
+ }
197
+ if (response.status === 403) {
198
+ throw new ActivityError("GitHub public events rate-limited", "rate_limit");
199
+ }
200
+ if (!response.ok) {
201
+ throw new ActivityError(`GitHub events HTTP ${response.status}`, "http");
202
+ }
203
+ const batch = (await response.json());
204
+ if (!Array.isArray(batch) || batch.length === 0)
205
+ break;
206
+ events.push(...batch);
207
+ if (batch.length < 100)
208
+ break;
209
+ }
210
+ const { from, to } = lastYearRange(now);
211
+ const counts = new Map();
212
+ for (const event of events) {
213
+ if (!event.created_at)
214
+ continue;
215
+ const iso = utcIsoDate(new Date(event.created_at));
216
+ if (iso < utcIsoDate(from) || iso > utcIsoDate(to))
217
+ continue;
218
+ const weight = eventWeight(event);
219
+ if (weight <= 0)
220
+ continue;
221
+ counts.set(iso, (counts.get(iso) ?? 0) + weight);
222
+ }
223
+ const days = enumerateUtcDays(from, to).map((date) => {
224
+ const iso = utcIsoDate(date);
225
+ return { date: iso, count: counts.get(iso) ?? 0, weekday: weekdayUtc(iso) };
226
+ });
227
+ return {
228
+ login,
229
+ name: null,
230
+ totalContributions: days.reduce((sum, day) => sum + day.count, 0),
231
+ weeks: daysToWeeks(days),
232
+ source: "events",
233
+ range: { from: utcIsoDate(from), to: utcIsoDate(to) },
234
+ };
235
+ }
236
+ export async function loadActivity(options) {
237
+ const login = options.user.trim().replace(/^@/, "");
238
+ if (!login) {
239
+ throw new ActivityError("A GitHub username is required", "usage");
240
+ }
241
+ const now = startOfUtcDay(options.now ?? new Date());
242
+ const token = resolveToken(options.token);
243
+ const fetchImpl = options.fetchImpl ?? fetch;
244
+ const source = options.source ?? "auto";
245
+ const tryGraphql = () => {
246
+ if (!token) {
247
+ throw new ActivityError("GraphQL source requires --token or GITHUB_TOKEN", "auth");
248
+ }
249
+ return fetchGraphqlActivity(login, token, now, fetchImpl);
250
+ };
251
+ if (source === "mock")
252
+ return mockActivity(login, now);
253
+ if (source === "graphql")
254
+ return tryGraphql();
255
+ if (source === "events") {
256
+ return fetchEventsActivity(login, token, now, fetchImpl);
257
+ }
258
+ if (token) {
259
+ try {
260
+ return await tryGraphql();
261
+ }
262
+ catch (error) {
263
+ if (error instanceof ActivityError && error.code === "not_found") {
264
+ throw error;
265
+ }
266
+ console.warn(`contrib-aquarium: GraphQL unavailable (${error instanceof Error ? error.message : error}); trying public events`);
267
+ }
268
+ }
269
+ try {
270
+ return await fetchEventsActivity(login, token, now, fetchImpl);
271
+ }
272
+ catch (error) {
273
+ if (error instanceof ActivityError && error.code === "not_found") {
274
+ throw error;
275
+ }
276
+ console.warn(`contrib-aquarium: public events unavailable (${error instanceof Error ? error.message : error}); using deterministic mock`);
277
+ return mockActivity(login, now);
278
+ }
279
+ }
280
+ export function overlayCounts(base, counts, source) {
281
+ const weeks = base.weeks.map((week) => ({
282
+ days: week.days.map((day) => ({
283
+ ...day,
284
+ count: counts.get(day.date) ?? day.count,
285
+ })),
286
+ }));
287
+ const totalContributions = weeks
288
+ .flatMap((week) => week.days)
289
+ .reduce((sum, day) => sum + day.count, 0);
290
+ return { ...base, weeks, totalContributions, source };
291
+ }
292
+ export function activityFromCounts(login, counts, now, source) {
293
+ const empty = emptyYear(login, now, source);
294
+ return overlayCounts(empty, counts, source);
295
+ }
296
+ export { parseUtcDate, addUtcDays };
297
+ //# sourceMappingURL=activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.js","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,UAAU,GACX,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,GAAG,gCAAgC,CAAC;AACrD,MAAM,UAAU,GAAG,8BAA8B,CAAC;AAElD,SAAS,SAAS;IAChB,OAAO,oBAAoB,kBAAkB,EAAE,gDAAgD,CAAC;AAClG,CAAC;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;IAG3B;IAFX,YACE,OAAe,EACN,IAAY,EACrB,OAA6B;QAE7B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAHf,SAAI,GAAJ,IAAI,CAAQ;QAIrB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,SAAS,YAAY,CAAC,QAAiB;IACrC,OAAO,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,SAAS,CAAC;AACnF,CAAC;AAED,SAAS,WAAW,CAAC,IAAuB;IAC1C,MAAM,KAAK,GAAsB,EAAE,CAAC;IACpC,IAAI,OAAO,GAAsB,EAAE,CAAC;IACpC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9B,OAAO,GAAG,E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