Skip to content

feat(constellation): add celestial star-map SVG visualization with pr…#4735

Open
MasterJi27 wants to merge 2 commits into
JhaSourav07:mainfrom
MasterJi27:main
Open

feat(constellation): add celestial star-map SVG visualization with pr…#4735
MasterJi27 wants to merge 2 commits into
JhaSourav07:mainfrom
MasterJi27:main

Conversation

@MasterJi27
Copy link
Copy Markdown

feat: Contribution Constellation — Star-Map SVG Visualization with Procedural Night Sky, Constellation Lines, and Timezone-Aware Zodiac Ring

Description

Fixes #4734

Adds a new ?view=constellation visualization mode that renders GitHub contribution history as a celestial star map with procedural night sky, constellation lines connecting bright contribution clusters, a timezone-aware zodiac ring, and CSS animations.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

Constellation Preview

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=jhasourav07&view=constellation&theme=neon).
  • I have run npm run format and npm run lint locally and resolved all errors.
  • My commits follow the Conventional Commits format.
  • I have updated README.md if I added a new theme or URL parameter.
  • I have starred the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard.
  • (Recommended) I joined the CommitPulse Discord community.
image

Copilot AI review requested due to automatic review settings June 6, 2026 22:33
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jun 6, 2026

@MasterJi27 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new “constellation” view that renders a star-map style SVG visualization of a user’s GitHub contributions and wires it into the streak API.

Changes:

  • Extends request validation + API routing to support view=constellation
  • Introduces a new constellation SVG generator and its associated constants
  • Adds Vitest coverage for the new generator

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
lib/validations.ts Allows constellation as a valid view parameter
lib/svg/constellationConstants.ts Adds layout/style constants for the constellation SVG
lib/svg/constellation.ts Implements the constellation SVG generator (stars, ring, labels, CSS)
lib/svg/constellation.test.ts Adds tests for SVG generation and key features
app/api/streak/route.ts Routes view=constellation requests to the new generator

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +31
function makeMockCalendar(
totalContributions: number,
days: { date: string; count: number }[]
): ContributionCalendar {
// Split days into weeks (7 days per week)
const weeks: ContributionCalendar['weeks'] = [];
const sorted = [...days].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime());

for (let i = 0; i < sorted.length; i += 7) {
const weekDays = sorted.slice(i, i + 7);
// Pad to 7 days
while (weekDays.length < 7) {
const lastDate = weekDays[weekDays.length - 1]?.date || '2025-01-01';
const nextDate = new Date(lastDate + 'T12:00:00Z');
nextDate.setDate(nextDate.getDate() + 1);
weekDays.push({
date: nextDate.toISOString().slice(0, 10),
count: 0,
});
}
weeks.push({ contributionDays: weekDays });
}

return { totalContributions, weeks };
}
Comment thread lib/svg/constellation.ts Outdated

// ─── Background Starfield ───────────────────────────────────────────────────

function generateBackgroundStars(seed: string, density: number, bgColor: string): BackgroundStar[] {
Comment thread lib/svg/constellation.ts Outdated
Comment on lines +171 to +174
function buildConstellationLines(
stars: ContributionStar[],
accentColor: string
): ConstellationLines[] {
Comment thread lib/svg/constellation.ts
Comment on lines +189 to +191
const sorted = brightest.sort(
(a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()
);
Comment thread lib/svg/constellation.ts
Comment on lines +302 to +306
export function generateConstellationSVG(
stats: StreakStats,
params: BadgeParams,
calendar: ContributionCalendar
): string {
Comment thread lib/svg/constellation.ts Outdated
const year = firstDay
? new Date(firstDay.date + 'T12:00:00Z').getUTCFullYear()
: new Date().getUTCFullYear();
const currentMonthIndex = new Date().getUTCMonth();
Comment thread app/api/streak/route.ts
Comment on lines +427 to +429
} else if (normalizedView === 'constellation') {
const stats = calculateStreak(calendar, timezone, undefined, grace);
svg = generateConstellationSVG(stats, params, calendar);
Comment thread lib/svg/constellation.ts Outdated
Comment on lines +322 to +323
// Parse density from params or use default
const density = DEFAULT_BG_STAR_COUNT;
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

🚨 Hey @MasterJi27, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

Please fix the issues before this can be reviewed. Here's how:

1. Run checks locally before pushing:

npm run format:check   # Check Prettier formatting
npm run lint           # Run ESLint
npm run typecheck      # TypeScript type check
npm run test           # Run unit tests (Vitest)
npm run build          # Verify production build passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

…ocedural night sky, constellation lines, and timezone-aware zodiac ring
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Comment thread lib/svg/constellation.ts
Comment on lines +310 to +314
// Determine year from calendar data
const firstDay = calendar.weeks[0]?.contributionDays[0];
const year = firstDay
? new Date(firstDay.date + 'T12:00:00Z').getUTCFullYear()
: new Date().getUTCFullYear();
Comment thread lib/svg/constellation.ts
Comment on lines +74 to +80
const posSeed = deterministicRandom(`${seed}:bg:pos:${i}`);
const brightnessSeed = deterministicRandom(`${seed}:bg:bright:${i}`);
const delaySeed = deterministicRandom(`${seed}:bg:delay:${i}`);

// Position: spread across the full canvas, avoiding the very center ring area slightly
const cx = STARFIELD_MIN_X + posSeed * (STARFIELD_MAX_X - STARFIELD_MIN_X);
const cy = STARFIELD_MIN_Y + brightnessSeed * (STARFIELD_MAX_Y - STARFIELD_MIN_Y);
Comment thread lib/svg/constellation.ts
Comment on lines +386 to +388
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${CONSTELLATION_SVG_WIDTH}" height="${CONSTELLATION_SVG_HEIGHT}" viewBox="0 0 ${CONSTELLATION_SVG_WIDTH} ${CONSTELLATION_SVG_HEIGHT}" role="img" aria-labelledby="cp-constellation-title cp-constellation-desc">
<title id="cp-constellation-title">CommitPulse Constellation Map for ${safeUser}</title>
<desc id="cp-constellation-desc">A celestial star-map visualization of ${safeUser}'s GitHub contributions in ${year}. Each star represents a day with contributions; brighter stars indicate more commits. Constellation lines connect the brightest stars within each month.</desc>
Comment thread lib/svg/constellation.ts
Comment on lines +279 to +282
@keyframes ${CSS_PREFIX}-milkyway-rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}`;
Comment thread lib/svg/constellation.ts
Comment on lines +401 to +402
<!-- Milky Way gradient band -->
<rect x="0" y="0" width="${CONSTELLATION_SVG_WIDTH}" height="${CONSTELLATION_SVG_HEIGHT}" fill="url(#${CSS_PREFIX}-milkyway)" />
Comment on lines +84 to +95
it('includes the zodiac ring with 12 arcs', () => {
const calendar = makeMockCalendar(24, [
{ date: '2025-01-15', contributionCount: 2 },
{ date: '2025-06-15', contributionCount: 2 },
{ date: '2025-12-25', contributionCount: 2 },
]);
const svg = generateConstellationSVG(makeMockStats(), makeMockParams(), calendar);

// Should have 12 path elements for the zodiac ring arcs
const arcMatches = svg.match(/id="ck-zodiac-ring"/);
expect(arcMatches).not.toBeNull();
});
- Add 'constellation' to BadgeParams.view type union in types/index.ts
- Remove unused ContributionCalendar import in app/api/streak/route.ts

Fixes CI lint (no-unused-vars) and typecheck failures on PR JhaSourav07#4735.
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Contribution Constellation — Star-Map SVG Visualization with Procedural Night Sky, Constellation Lines & Timezone-Aware Zodiac Segmentation

2 participants