Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,35 +174,12 @@ URL Parameter > Theme Default > System Fallback
| `hide_background` | `boolean` | No | `false` | Remove the background rect, letting the monolith float on the page |
| `hide_stats` | `boolean` | No | `false` | Hides the bottom row displaying Current Streak, Annual Sync Total, and Peak Streak stats when set to `true` or `1`. |
| `tz` | `string` | No | Omitted = UTC | IANA timezone (e.g. `Asia/Kolkata`, `America/New_York`) — aligns "today" with the user local midnight. Note: `?tz=UTC` is valid but cached separately from omitting `tz`. |
| `grace` | `number` | No | `1` | Configures the streak survival grace period in days (0 to 7). Useful for weekend-only contributors. |
| `lang` | `string` | No | `en` | Language code for labels (`en`, `es`, `hi`, `fr`, `pt`, `ko`, `ja`, `de`, `zh`) |
| `view` | `string` | No | `default` | Rendering mode: `default` (3D Monolith) or `monthly` (Compact monthly stats) |
| `delta_format` | `string` | No | `percent` | Format for month-over-month delta in monthly view: `percent` (e.g. +12%), `absolute` (e.g. +15 commits), or `both` |
| `width` | `number` | No | `300` | Custom width for the SVG canvas (currently only applies to `view=monthly`) |
| `height` | `number` | No | `120` | Custom height for the SVG canvas (currently only applies to `view=monthly`) |
| Parameter | Type | Required | Default | Description |
| ----------------- | --------- | ---------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `user` | `string` | ✅ **Yes** | — | GitHub username to render |
| `theme` | `string` | No | `dark` | Preset theme name (see below) |
| `bg` | `hex` | No | Theme default | Background color — **without** `#` |
| `accent` | `hex` | No | Theme default | Tower & glow color — **without** `#` |
| `text` | `hex` | No | Theme default | Label & stat text color — **without** `#` |
| `radius` | `number` | No | `8` | Border corner radius in pixels |
| `border` | `string` | No | — | Custom stroke color around the main SVG container — **without** `#` |
| `speed` | `string` | No | `8s` | Radar scan duration (`2s`–`20s`, default `8s`) |
| `scale` | `string` | No | `linear` | Tower height scaling: `linear` or `log` (logarithmic) |
| `size` | `string` | No | `medium` | Badge dimensions: `small` (400×280), `medium` (600×420), `large` (800×560) |
| `font` | `string` | No | CommitPulse default typography | Any **Google Font** name (e.g. `Orbitron`, `Inter`) |
| `refresh` | `boolean` | No | `false` | Bypass cache for real-time data |
| `year` | `string` | No | — | Calendar year to render (e.g. `2023`, `2024`) |
| `hide_title` | `boolean` | No | `false` | Hide GitHub username/title from the SVG badge |
| `hide_background` | `boolean` | No | `false` | Remove the background rect, letting the monolith float on the page |
| `hide_stats` | `boolean` | No | `false` | Hides the bottom row displaying Current Streak, Annual Sync Total, and Peak Streak stats when set to `true` or `1`. |
| `tz` | `string` | No | Omitted = UTC | IANA timezone (e.g. `Asia/Kolkata`) — aligns "today" with the user local midnight. Note: `?tz=UTC` is cached separately from omitting `tz`. |
| `lang` | `string` | No | `en` | Language code for labels (`en`, `es`, `hi`, `fr`, `pt`, `ko`, `ja`) |
| `view` | `string` | No | `default` | Rendering mode: `default` (3D Monolith) or `monthly` (Compact monthly stats) |
| `delta_format` | `string` | No | `percent` | Format for month-over-month delta in monthly view: `percent` (e.g. +12%), `absolute` (e.g. +15 commits), or `both` |
| `width` | `number` | No | `300` | Custom width for the SVG canvas (currently only applies to `view=monthly`) |
| `height` | `number` | No | `120` | Custom height for the SVG canvas (currently only applies to `view=monthly`) |

### Theme Presets

Expand Down
29 changes: 29 additions & 0 deletions lib/calculate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,35 @@ describe('calculateStreak', () => {
expect(result.longestStreak).toBe(10);
expect(result.currentStreak).toBe(5);
});

it('handles weekend-only commits correctly across massive 5-day gaps', () => {
// 2024-01-01 is a Monday.
// We simulate a user who commits ONLY on Saturdays and Sundays.
const calendar = buildCalendar([
0,
0,
0,
0,
0,
1,
1, // Week 1: Mon-Fri (0), Sat-Sun (1)
0,
0,
0,
0,
0,
1,
1, // Week 2: Mon-Fri (0), Sat-Sun (1)
]);

const result = calculateStreak(calendar);

// The gap from Monday to Friday is 5 days, which far exceeds the
// default grace period of 1. Therefore, the streak must break every week.
expect(result.currentStreak).toBe(2);
expect(result.longestStreak).toBe(2);
expect(result.totalContributions).toBe(4);
});
});
it('handles massive single-day commit spike timeline', () => {
const calendar = buildCalendar([
Expand Down
Loading