Author SHA1 Message Date
ShayManorandClaude Opus 5 27645048f1 feat(deploy): add self-host compose file and document self-hosting
The repo had three Dockerfiles but nothing that ran them together, and the
README never mentioned self-hosting. The only deploy path was deploy/compose.yml,
which is bound to the production box: it pulls private ghcr images and hard-fails
on seven env vars including OAuth credentials, so nobody else could run it.

Every one of those vars already has a default in the service config; the
:?missing guards are a production-deploy check, not an application requirement.
This adds a root compose file that builds the three services from source and
needs only GITHUB_PAT and FETCHER_INTERNAL_TOKEN.

deploy/compose.yml is unchanged, so production is unaffected.

Verified by running it: all three images build, all five containers start, the
generator serves the SPA and /api/health, and edge answers /<username> with
upstream_ok true.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-23 10:33:26 -07:00
shayandClaude Opus 5 107273a1c8 fix(auth): send an https redirect_uri so GitHub sign-in works
The OAuth app registers https://gh-stats.com/api/auth/github/callback, but
the app was sending the http:// form. GitHub compares redirect_uri to the
registered callback character for character, so it refused every attempt
with "The redirect_uri is not associated with this application" and showed
users a warning that the app might be redirecting them somewhere they were
not expecting. Sign-in has been failing for everyone, and it gates themes,
custom tags and achievements.

_derived_redirect_uri built the URL from X-Forwarded-Proto, falling back to
request.scheme. The cloudflared tunnel does not reliably forward that
header, so the scheme resolved to http. The comment above it claimed the
headers are set, which is what hid this.

Anything that is not localhost or 127.0.0.1 is https. Local dev keeps
working over plain http, pinned by a test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-23 09:38:26 -07:00
shay 12f6890f57 feat(readme): add migration guide for transitioning from github-readme-stats. 2026-08-22 16:33:29 -07:00
shay 584306beb0 feat(api): add widget_name parameter to render_composite_adhoc function. 2026-08-22 16:33:24 -07:00
shayandClaude Opus 5 319f37761c chore: add MIT license
The repo had no license file, which means all rights reserved: nobody
could legally fork or reuse it. MIT is the category norm.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-22 16:10:44 -07:00
shayandClaude Opus 5 faf41ad952 feat(frontend): show the product, keep work across sign-in, add social preview
Of 27 people who typed a username in the last 14 days, 15 left before a
widget rendered. The landing page showed zero pixels of a product whose
entire value is visual, so it now leads with a live example card and says
concretely what you get.

Sign-in used to discard everything: with no router the OAuth `next` is
always "/", so users came back to an empty search box with their theme,
widget order and achievements gone. Persist work-in-progress to
sessionStorage and restore it on mount.

The Workshop preview seeds from demo data (grade A, 842 commits,
collaborators named alex/jordan/sam) with nothing saying so, so users saw
numbers they knew were wrong. Label it until real data arrives.

Add title, description, canonical, OG and Twitter tags, robots.txt and a
sitemap. The page was a 445-byte shell titled "GitHub Widgets", so every
link shared anywhere rendered with no image and no description.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-22 16:10:44 -07:00
shayandClaude Opus 5 0904c4bb9f feat(generator): raise enrollment ceiling, add burst guard, stop enqueue loop
ENROLLMENT_DAILY_CAP was 50, so any traffic spike past 50 new users in a
day was turned away with a rate_limited card. Raise the default to 500 and
add ENROLLMENT_HOURLY_CAP=60. The hourly guard is the one that actually
protects the shared PAT: a new user costs ~37 REST calls (p90 ~104)
against a 5000/hr budget, and a spike arrives inside an hour rather than
spread over a day. Counted off users.enrolled_at, so no schema change.

Also stop an unbounded enqueue loop. `name` is drawn inside the composite
and never persisted standalone, and `achievements` renders nothing until
the user authors one, so their SVG is permanently absent and every request
re-enqueued a build that could never produce it. Only self-heal when no
build has actually landed, keyed off widget_data for the current hash.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-22 16:10:44 -07:00
shayandClaude Opus 5 769cde552d feat(widgets): attribution on every widget, and make it legible
Five of the seven standalone widgets and all three placeholder cards
carried no attribution at all, and where it did render it was font-size 9
at opacity 0.5 (about 2.1:1 contrast) at the bottom of a 1500px card. Each
embedded widget sits on a public profile and is the only organic
acquisition surface we have.

Shared helper so the styling can't drift again. font-size 10, opacity
0.75 (about 3.1:1), still using the theme's text_secondary so it stays
roughly 4x fainter than the user's own content. Composite output is
byte-identical in size; four standalone cards grow 16px where the footer
would otherwise collide with existing content.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-22 16:10:26 -07:00
shayandClaude Opus 5 06ab1c878e fix(fetcher): guard REST calls so a rate limit can't poison user records
The five REST calls parsed `.json()` with no status check, so a 403
{"message": "API rate limit exceeded..."} body was returned as user data.
`_is_github_not_found` only matched "Not Found", so it was recorded as a
successful fetch and upsert_user overwrote the user's last-good row. Every
user touched during the exhaustion window then served a blank card for up
to 24h while /metrics reported ok.

Reuse the existing `_raise_if_transient` on all five so exhaustion raises
GitHubTransientError before the upsert, preserving last-good and letting
the caller retry. `_raise_if_transient` was GraphQL-shaped and crashed on
the JSON arrays the list endpoints return, so it now ignores non-dict
bodies. A rate limit inside the per-repo fan-out aborts the fetch; a 404
on a single repo stays non-fatal.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
2026-08-22 16:10:26 -07:00
shay eea1734a04 fix(languages): center donut chart and legend based on card midline. 2026-07-25 16:23:28 -07:00
shay fe4bb4e87e fix(api): normalize GitHub usernames to lowercase and update tests. 2026-07-19 21:01:40 -07:00
shayandClaude Opus 4.8 0586f83a33 fix(fetcher): keep last-good counts on GitHub rate limits + expose fetch metrics
Rate-limited / 5xx / network failures were silently returning 0 from the
commit- and PR-count paths, then overwriting good values in fetcher.db —
turning a traffic spike into permanently-wrong "0 commits" cards. Raise
GitHubTransientError instead so the fetch aborts and the last-good row is
retained; genuine NOT_FOUND still yields 0.

Add a shared fetch-outcome counter (fetch_metrics table, spanning the web
workers and the cron container) surfaced at an unauthenticated GET /metrics
as ghstats_fetch_total{outcome="ok|not_found|rate_limited|error"}, so rate
limits are visible to the monitoring stack instead of dying silently.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 11:45:42 -07:00
shay d1e89fb1c3 fix(api): normalize GitHub usernames to lowercase and update tests. 2026-06-12 01:37:08 -07:00
shay e53d1cfbe0 fix(api): normalize GitHub usernames to lowercase and update tests. 2026-06-12 01:17:53 -07:00
shay c54b5ac6ff feat(ResultScreen): wraps embed image markdown in a link to origin 2026-06-11 21:33:39 -07:00
shay ceac269738 feat(ResultScreen): wraps embed image markdown in a link to origin 2026-06-11 16:12:06 -07:00
shay 78299fa2b9 feat(GrowthChart): refactor y-coordinate mapping and add 2026-05-29 10:27:45 -07:00
shay 410b503877 feat(Analytics): add daily stats rollup to persist data beyond pruning 2026-05-27 10:47:42 -07:00
shay 61b8090c64 feat(api): add endpoint for retrieving growth data for the dashboard 2026-05-27 10:28:51 -07:00
shay a1d1813a51 feat(api): add endpoint for retrieving growth data for the dashboard 2026-05-27 10:23:49 -07:00
shay f66088e5d6 feat(api): add endpoint for retrieving growth data for the dashboard 2026-05-27 10:21:32 -07:00
shay 99c40cb0ce feat(api): add endpoint for retrieving growth data for the dashboard 2026-05-27 10:16:11 -07:00
shay e7a0521ff6 feat(api): implement self-healing build enqueue for user widgets 2026-05-26 15:23:14 -07:00
shay 2be8dc1ca3 feat(firebase): add Firebase initialization script to index.html 2026-05-26 15:20:41 -07:00
shay 369d42bb5f feat(api): implement auto-enrollment for unknown users on first hit 2026-05-26 15:10:20 -07:00
shay 151f330d31 feat(analytics): add request tracking decorator for API endpoints 2026-05-12 01:47:13 -04:00
shay 01927b2173 feat(analytics): include render-only users in activity count query 2026-05-11 23:34:57 -04:00
shay d4cbbae82a feat(api): add basic auth protection to /dev dashboard route 2026-05-11 19:03:26 -04:00
shay ef48d2581b feat(admin dashboard): add admin dashboard 2026-05-11 18:26:43 -04:00
shay 00bf46968a feat(admin dashboard): add admin dashboard 2026-05-11 18:25:09 -04:00
shay ab7c9b32aa feat(README): update 2026-05-08 19:46:01 -04:00
shay 05efac8fd2 feat(README): update 2026-05-08 19:45:37 -04:00
shay 9d15dd6c94 feat(grade): add data attributes for footer attribution in widgets 2026-05-06 16:38:59 -04:00
shay 8f7b27f806 feat(grade): add footer attribution for visual consistency in widget 2026-05-06 10:32:00 -04:00
shay 99378e13cd feat(api): add compatibility route for top-langs to handle upstream URLs. 2026-05-06 10:26:53 -04:00
shay 9639051398 feat(ResultScreen): add widget status and manual refresh functionality. 2026-05-04 21:52:44 -04:00
shay 8dbbd16cf9 feat(api): auto-enroll users typing unknown usernames into workshop 2026-05-04 16:34:12 -04:00
shay 6edf98334c feat(api): add idempotency check for already queued builds in callback 2026-05-04 15:52:03 -04:00
shay 673eb5b39d feat(tests): implement dynamic GraphQL response handling for tests 2026-05-04 12:56:52 -04:00
shay 4a1d31ffdd feat(api): implement async fetch with callback to enqueue build job 2026-05-04 12:35:41 -04:00
shay 50dd73a0de feat(api): distinguish between not enrolled and not found user statuses 2026-05-03 20:38:21 -04:00
shay 954f259b8f feat(worker): update worker to render and persist SVGs with widget data 2026-04-25 12:28:38 -04:00
shay 7f1e53cfad feat(db): normalize usernames in enrollment_rank for case insensitivity 2026-04-22 12:50:14 -04:00
shay 5102a36238 feat(workshop): refine login banner to display only for signed-in users. 2026-04-21 15:40:46 -04:00
shay 9cc9de2147 feat(api): add shortcut for rendering grade widget with username query. 2026-04-21 15:09:17 -04:00
shay a4ca81eab9 feat(workshop): simplify button visibility and update user message. 2026-04-21 14:46:46 -04:00
shay 118c8b7cc4 feat(workshop): add drag-and-drop functionality for achievements list 2026-04-21 14:10:37 -04:00
shay 113e4747cf feat(readme): replace hero widget image with composite widget example 2026-04-21 14:09:13 -04:00
shay a06bd2a20c feat(readme): replace hero widget image with composite widget example 2026-04-21 14:07:26 -04:00
shay 8941ed2f15 feat(readme): replace hero widget image with composite widget example 2026-04-21 14:07:15 -04:00
shay 048756c787 feat(workshop-screen): add generate button for editable users 2026-04-21 11:43:00 -04:00
shay fc4e8e4da5 feat(readme): update instructions and add table of contents section 2026-04-20 16:13:28 -04:00
shay b5bba19d46 feat(readme): update instructions and add table of contents section 2026-04-20 16:05:42 -04:00
shay 795f49d0a8 feat(api): update ResultScreen to use fallback URL for embed snippet 2026-04-20 16:05:33 -04:00
shay 451cb45788 feat(api): add sanitize_settings_query function for URL params handling 2026-04-20 15:04:15 -04:00
shay 96dc98142f feat(composite): add show_name parameter to control header visibility. 2026-04-20 15:04:09 -04:00
shay b66f966adb feat(workshop): refactor achievements section for improved layout. 2026-04-20 14:38:29 -04:00
shay 599c1ed672 feat(processor): refactor byte tally logic for authored repositories only. 2026-04-20 14:19:26 -04:00
shay fdd6b61172 feat(rendering): adjust text position in SVG for better visibility. 2026-04-20 14:19:18 -04:00
shay 13cc2b4eed feat(build-system): introduce BUILD_VERSION for widget invalidation logic. 2026-04-20 14:09:04 -04:00
shay a88561073a feat(result-screen): add onRegenerate prop to ResultScreen component. 2026-04-20 13:56:43 -04:00
shay 58fd6fbe67 feat(streaks): replace show_dates with customizable color setting. 2026-04-20 13:49:21 -04:00
shay 39d07fb7e0 feat(processor): add consistency scoring based on active commit weeks. 2026-04-20 13:43:08 -04:00
shay bd59910e54 feat(workshop): fetch and set user-specific widget settings on load. 2026-04-20 13:33:10 -04:00
shay e60acaca74 feat(workshop): implement drag-and-drop reordering for widgets. 2026-04-20 13:28:33 -04:00
shay ca795f7e71 feat(api): add 'streaks' to allowed widgets and settings structure. 2026-04-20 13:05:40 -04:00
shay 4febce9fca feat(api): add 'streaks' to allowed widgets and settings structure. 2026-04-20 13:05:34 -04:00
shay f43beb2ef6 feat(workflows): add health check workflow for automated monitoring. 2026-04-20 12:57:58 -04:00
Shay ManorandGitHub b98b32f030 Merge pull request #3 from ShayManor/feat/streaks-widget
Feat/streaks widget
2026-04-20 12:45:38 -04:00
shay 1d0fd3013e feat(streaks): persist streaks on refresh and pass to renderer
Phase 1 worker now reads the stored streak, computes an updated one via
processor.compute_streaks, persists it to the DB (preserving the all-time
max across settings changes), and includes it in widget_data. Phase 2
_render_widgets pre-reads the stored streak and passes it to the processor.
2026-04-20 11:52:22 -04:00
shay 788470cae0 feat(streaks): enable streaks widget by default 2026-04-20 11:49:43 -04:00
shayandClaude Opus 4.7 f23449a17e feat(streaks): render streaks widget in generate_widgets_from_github
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 11:48:09 -04:00
shay cb7a00d7c4 feat(streaks): add streaks widget renderer
Add render_streaks_widget() to generator/src/widgets/streaks.py with
flame/trophy icons, two-column layout, optional date display, and
export it from the widgets package; append 3 smoke tests (all 11 pass).
2026-04-20 11:45:51 -04:00
shayandClaude Sonnet 4.6 3b00a0aeac feat(streaks): compute current and max streak with grace day
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 11:42:59 -04:00
shayandClaude Sonnet 4.6 7fb1ba3e01 feat(streaks): add user_streaks table and get/put helpers
Adds the user_streaks table to settings.db schema and implements
get_user_streak / put_user_streak helpers with upsert semantics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 11:40:13 -04:00
shay dd4a3d50d8 feat(streaks): add StreakData model 2026-04-20 11:36:45 -04:00
shay 5a2bc11840 feat(ui): enhance AuthButton styling and position for better UX. 2026-04-19 21:51:30 -04:00
shay fa96adb5d1 feat(docs): update instance URL and enhance README formatting. 2026-04-19 21:51:23 -04:00
Shay ManorandGitHub 728f3f038d Merge pull request #2 from ShayManor/oauth
Oauth
2026-04-19 21:02:25 -04:00
shayandClaude Opus 4.7 f9caa61c77 fix(frontend): send cookies on /generate POST
Without credentials: 'include', the session cookie isn't attached and
the OAuth-guarded endpoint returns 401.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:10:14 -04:00
shayandClaude Opus 4.7 9e837519cc feat(deploy): wire OAuth secrets; rename env vars off GITHUB_ prefix
GitHub Actions rejects secret names starting with GITHUB_. Rename the
OAuth env vars to GH_OAUTH_* in config.py, compose.yml, and the deploy
workflow so the values can flow through Actions secrets into the
generator container.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:02:52 -04:00
shayandClaude Opus 4.7 be8823c4cf chore(frontend): delete lib/editToken.ts (replaced by OAuth)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:18:32 -04:00
shay ccdd8231ce feat(frontend): gate WorkshopScreen edit UI on OAuth login match 2026-04-19 19:16:59 -04:00
shay cd927e686f feat(frontend): AuthButton — GitHub sign-in / avatar chip 2026-04-19 19:14:06 -04:00
shayandClaude Sonnet 4.6 8ccc0af1cf feat(frontend): App fetches /me, removes editToken plumbing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 19:12:36 -04:00
shay b2baded94a feat(frontend): add lib/auth.ts with fetchMe, signInUrl, signOut 2026-04-19 19:10:05 -04:00
shay 8b7f999adc feat(api): per-login mutate rate limit layered on per-IP 2026-04-19 19:09:04 -04:00
shay 0cd7bf339d feat(api): remove public /enroll endpoint and auto-enroll on /data 2026-04-19 19:06:38 -04:00
shay 91f6328efd feat(api): /generate and /refresh use OAuth session; remove edit_token helpers 2026-04-19 19:03:16 -04:00
shay 4ee71e0b86 feat(api): PATCH /settings uses OAuth session + same-origin 2026-04-19 18:59:46 -04:00
shayandClaude Opus 4.7 eb4b68bf0d feat(api): OAuth callback — verify state, fetch profile, implicit enroll
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 18:57:20 -04:00
shayandClaude Opus 4.7 98c40ff993 feat(api): add /api/auth/github/login with CSRF state + local-only next
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 18:54:44 -04:00
shay a6356d4d1d feat(api): add /api/auth/me and /api/auth/logout 2026-04-19 18:53:12 -04:00
shay 232812b3a0 feat(api): configure Flask session + init OAuth client 2026-04-19 18:51:22 -04:00
shay 4602bb9494 test(auth): unit tests for require_github_owner and require_same_origin 2026-04-19 18:49:39 -04:00
shay ccd0f63fa8 feat(auth): add OAuth client + require_github_owner/require_same_origin decorators 2026-04-19 18:48:14 -04:00
shay ec9d4c3672 db: remove dead _hash_edit_token; convert verify_edit_token to stub
_hash_edit_token was only called by verify_edit_token and has no remaining
callers in db.py (enroll no longer hashes tokens). Remove it along with the
unused 'secrets' and 'hmac' imports.

Keep verify_edit_token as a NotImplementedError stub since api.py's
require_edit_token decorator still references it. Task 12 will remove both
the decorator and this function together when switching to session-based auth.
2026-04-19 18:47:11 -04:00
shay 22483aea19 db: enroll() accepts github profile; no longer returns edit_token 2026-04-19 18:45:26 -04:00
shay 57b782ceaf db: add github_id and github_avatar_url columns + set_github_profile 2026-04-19 18:44:01 -04:00
shay 4822272b49 config: add GitHub OAuth + session env vars 2026-04-19 18:40:28 -04:00
shayandClaude Opus 4.7 1501139143 deps: add authlib for GitHub OAuth
Pins authlib>=1.3,<2 so the generator can register a GitHub OAuth
client for the upcoming login flow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 18:39:45 -04:00
shay 58e794fd57 feat(tags): add auto-awarded profile tags and validation utilities. 2026-04-19 09:37:32 -04:00
shay ca74e91e3e feat(readme): update README to describe new SVG widget features. 2026-04-19 09:34:40 -04:00
shay 016583c9f3 feat(api): implement per-user edit token for settings mutations 2026-04-19 09:34:26 -04:00
shay 3ecb6ad67b feat(tags): implement custom tag color merging and label support 2026-04-18 14:52:32 -04:00
shay 3e70e4b4ef feat(languages): add hidden languages picker and enrich language data 2026-04-18 13:39:44 -04:00
shay 5198eab86a feat(icons): replace inline SVGs with consistent JSX properties for icons 2026-04-18 13:17:00 -04:00
shay 12fb6c331b feat(worker): add achievements parameter to widget settings processing 2026-04-18 13:05:49 -04:00
shay 89a05f2a59 chore(WorkshopScreen): update ICONS type from JSX.Element to ReactNode 2026-04-18 12:51:48 -04:00
shay 3aebd40279 chore(favicon): replace old SVG with new design for favicon icon
chore(ResultScreen): simplify embed section layout and improve copy button
chore(WorkshopScreen): replace emoji icons with inline SVGs for consistency
chore(index.html): update page
2026-04-18 12:50:23 -04:00
shay eadd074402 chore(App): add PATCH request to sync user settings with backend before render 2026-04-18 12:40:16 -04:00
shay dd45d49c22 chore(ResultScreen): add copy functionality for embed snippet button 2026-04-18 12:35:27 -04:00
shay 8ac657b874 chore(ResultScreen): update props to reflect SVG generation process changes 2026-04-18 12:17:25 -04:00
shay 7b2301cec0 chore(api): rename test function for clarity on enrollment behavior 2026-04-18 11:58:02 -04:00
shay f9c59d934d chore(api): add asynchronous build kickoff for improved responsiveness 2026-04-18 11:26:25 -04:00
shay 3ffb2cfb6f chore(frontend): add demo data 2026-04-18 11:15:16 -04:00
shay 79b9c31197 feat(api): implement precomputed widget data storage and retrieval. 2026-04-18 11:13:43 -04:00
shay f0c6edacf6 feat(api): add endpoint for fetching computed widget data by username. 2026-04-18 10:54:41 -04:00
shay a63c1891a0 feat(deploy): change deployment runner from minipc to self-hosted. 2026-04-18 01:06:59 -04:00
shay 873ca512bd feat(readme): update Docker badge to reflect new deployment workflow. 2026-04-18 00:52:46 -04:00
shay 19a357d92b feat(readme): remove references to deleted production pipeline design. 2026-04-18 00:02:34 -04:00
Shay ManorandGitHub a96b0d0b3f Merge pull request #1 from ShayManor/smanor/production-pipeline
Split monolith into fetcher/generator/edge services + React SPA + CI
2026-04-17 18:38:38 -04:00
107 changed files with 13704 additions and 4311 deletions
+14
View File
@@ -0,0 +1,14 @@
# Copy to .env and fill in. Only these two matter.
# A GitHub personal access token. Classic or fine-grained, no scopes needed
# for public data - it is only used to raise your GitHub API rate limit.
# Create one at https://github.com/settings/tokens
GITHUB_PAT=
# Shared secret the three services use to talk to each other. Any random
# string; it never leaves your machine. Generate one with:
# openssl rand -hex 32
FETCHER_INTERNAL_TOKEN=
# Port the card service listens on (http://localhost:PORT).
#GHSTATS_PORT=5003
+92
View File
@@ -0,0 +1,92 @@
name: build and deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
jobs:
build:
name: build ${{ matrix.service }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
service: [fetcher, generator, edge]
outputs:
image_tag: ${{ steps.tag.outputs.value }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image tag (sha-<short>)
id: tag
env:
SHA: ${{ github.sha }}
run: echo "value=sha-${SHA:0:7}" >> "$GITHUB_OUTPUT"
- name: Compute image name (lowercase)
id: img
env:
OWNER: ${{ github.repository_owner }}
SERVICE: ${{ matrix.service }}
run: echo "name=${REGISTRY}/${OWNER,,}/ghstats-${SERVICE}" >> "$GITHUB_OUTPUT"
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.img.outputs.name }}
tags: |
type=raw,value=${{ steps.tag.outputs.value }}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build ${{ matrix.service }} image
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.service }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.service }}
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
deploy:
name: deploy to mini PC
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Deploy compose stack
env:
IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
GITHUB_PAT: ${{ secrets.FETCHER_GITHUB_PAT }}
FETCHER_INTERNAL_TOKEN: ${{ secrets.FETCHER_INTERNAL_TOKEN }}
GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }}
GH_OAUTH_CLIENT_SECRET: ${{ secrets.GH_OAUTH_CLIENT_SECRET }}
GENERATOR_SECRET_KEY: ${{ secrets.GENERATOR_SECRET_KEY }}
ALLOWED_ORIGINS: ${{ secrets.ALLOWED_ORIGINS }}
DEV_DASHBOARD_USER: ${{ secrets.DEV_DASHBOARD_USER }}
DEV_DASHBOARD_PASSWORD: ${{ secrets.DEV_DASHBOARD_PASSWORD }}
run: ./deploy/deploy.sh
-29
View File
@@ -1,29 +0,0 @@
name: docker
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: ${{ matrix.service }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
service: [fetcher, generator, edge]
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build ${{ matrix.service }} image
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.service }}
push: false
tags: ghstats-${{ matrix.service }}:ci
cache-from: type=gha,scope=${{ matrix.service }}
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
+258
View File
@@ -0,0 +1,258 @@
name: health check
on:
schedule:
# Every 15 minutes — matches the refresh cron cadence
- cron: '*/15 * * * *'
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: health-check-${{ github.ref }}
cancel-in-progress: false
jobs:
tests:
name: pytest-${{ matrix.service }}
runs-on: ubuntu-latest
# Scheduled runs are an uptime probe only — skip the test matrix.
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
service: [fetcher, generator, edge]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: ${{ matrix.service }}/requirements.txt
- name: Install dependencies
working-directory: ${{ matrix.service }}
run: pip install -r requirements.txt
- name: Run pytest
id: pytest
working-directory: ${{ matrix.service }}
run: |
set -o pipefail
pytest -v --tb=short --color=no 2>&1 | tee "/tmp/pytest-${SERVICE}.log"
env:
SERVICE: ${{ matrix.service }}
- name: Upload pytest log
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-${{ matrix.service }}
path: /tmp/pytest-${{ matrix.service }}.log
retention-days: 14
site-health:
name: site-health
runs-on: ubuntu-latest
# Only probe production on schedule / manual / push to main — not on
# PRs, where failures wouldn't indicate a prod incident.
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- name: Check edge homepage
id: check-edge
run: |
echo "GET https://gh-stats.com/"
HTTP_CODE=$(curl -sSL -o /tmp/edge-home.html -w "%{http_code}" --max-time 30 https://gh-stats.com/)
echo "HTTP $HTTP_CODE"
if [ "$HTTP_CODE" != "200" ]; then
echo "::error::Edge homepage returned HTTP $HTTP_CODE"
head -c 500 /tmp/edge-home.html || true
exit 1
fi
- name: Check widget SVG endpoint
id: check-widget
run: |
# Cloudflare routes /api/* to the generator directly. The bare
# /<user> and /<user>/<widget>.svg paths land on the SPA shell
# in prod, so we probe the canonical /api/<user>/<widget>.svg.
URL="https://gh-stats.com/api/ShayManor/grade.svg"
echo "GET $URL"
HTTP_CODE=$(curl -sS -D /tmp/widget-headers.txt -o /tmp/widget-body.svg \
-w "%{http_code}" --max-time 30 "$URL")
echo "HTTP $HTTP_CODE"
cat /tmp/widget-headers.txt
if [ "$HTTP_CODE" != "200" ]; then
echo "::error::Widget endpoint returned HTTP $HTTP_CODE"
exit 1
fi
CT=$(grep -i '^content-type:' /tmp/widget-headers.txt | tail -n1 | awk '{print $2}' | tr -d '\r' || true)
case "$CT" in
image/svg+xml*) : ;;
*) echo "::error::Unexpected Content-Type='$CT' (expected image/svg+xml)"; exit 1;;
esac
if ! head -c 200 /tmp/widget-body.svg | grep -q '<svg'; then
echo "::error::Response body does not look like SVG"
head -c 200 /tmp/widget-body.svg; echo
exit 1
fi
STATUS=$(grep -i '^x-widget-status:' /tmp/widget-headers.txt | tail -n1 | awk '{print $2}' | tr -d '\r' || true)
# ready / building / rate_limited are healthy; absent is fine
# on cache hits; not_found is a failure.
case "$STATUS" in
""|ready|building|rate_limited) echo "X-Widget-Status='${STATUS:-<absent>}' (ok)";;
*) echo "::error::Unhealthy X-Widget-Status='$STATUS'"; exit 1;;
esac
- name: Check generator health pipeline
id: check-api
run: |
# Generator's purpose-built liveness probe, routed through
# Cloudflare's /api/* rule.
URL="https://gh-stats.com/api/health"
echo "GET $URL"
BODY=$(curl -sS --max-time 30 -w "\n%{http_code}" "$URL")
HTTP_CODE=$(printf '%s\n' "$BODY" | tail -n1)
JSON=$(printf '%s\n' "$BODY" | sed '$d')
echo "HTTP $HTTP_CODE"
echo "$JSON"
if [ "$HTTP_CODE" != "200" ]; then
echo "::error::/api/health returned HTTP $HTTP_CODE"
exit 1
fi
STATUS=$(printf '%s' "$JSON" | python3 -c 'import json,sys; print(json.load(sys.stdin).get("status",""))' 2>/dev/null || echo "")
if [ "$STATUS" != "ok" ]; then
echo "::error::/api/health reports status='$STATUS' (expected 'ok')"
exit 1
fi
echo "generator pipeline healthy"
notify:
name: notify-on-failure
runs-on: ubuntu-latest
needs: [tests, site-health]
if: always() && (needs.tests.result == 'failure' || needs.site-health.result == 'failure')
env:
TESTS_RESULT: ${{ needs.tests.result }}
HEALTH_RESULT: ${{ needs.site-health.result }}
EVENT_NAME: ${{ github.event_name }}
REF_NAME: ${{ github.ref_name }}
COMMIT_SHA: ${{ github.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
RUN_ID: ${{ github.run_id }}
steps:
- name: Download pytest logs
if: needs.tests.result == 'failure'
uses: actions/download-artifact@v4
with:
path: logs
pattern: pytest-*
continue-on-error: true
- name: Assemble email body
run: |
NOW=$(date -u '+%Y-%m-%d %H:%M:%S UTC')
RUN_URL="${SERVER_URL}/${REPO}/actions/runs/${RUN_ID}"
{
echo "gh-stats.com — health check failed"
echo "===================================="
echo ""
case "$EVENT_NAME" in
schedule) echo "Trigger: scheduled uptime probe";;
push) echo "Trigger: push to ${REF_NAME} (${COMMIT_SHA})";;
pull_request) echo "Trigger: PR #${PR_NUMBER} → main";;
workflow_dispatch) echo "Trigger: manual run";;
*) echo "Trigger: ${EVENT_NAME}";;
esac
echo "Time: $NOW"
echo "Repo: ${REPO}"
echo ""
echo "Job results"
echo "-----------"
printf " %-14s %s\n" "pytest:" "${TESTS_RESULT}"
printf " %-14s %s\n" "site-health:" "${HEALTH_RESULT}"
echo ""
if [ "$HEALTH_RESULT" = "failure" ]; then
echo "Site health"
echo "-----------"
echo " One or more endpoints on https://gh-stats.com are not"
echo " responding as expected. See the run logs for the failing"
echo " step and its HTTP code."
echo ""
fi
if [ "$TESTS_RESULT" = "failure" ] && [ -d logs ]; then
echo "Failing tests"
echo "-------------"
for dir in logs/pytest-*; do
[ -d "$dir" ] || continue
service=${dir#logs/pytest-}
log="$dir/pytest-${service}.log"
[ -f "$log" ] || continue
# Did this service actually fail? pytest prints FAILED lines
# per failure and a summary like "=== 3 failed ...". If
# neither appears, skip it.
if ! grep -qE '^(FAILED |=+ .* failed)' "$log"; then
continue
fi
echo ""
echo "[$service]"
grep -E '^(FAILED |=+ .* (failed|error))' "$log" | head -n 20
echo "..."
tail -n 60 "$log"
done
echo ""
fi
echo "Full logs"
echo "---------"
echo " $RUN_URL"
echo ""
echo "--"
echo "github-readme-stats automated monitor"
} > /tmp/email-body.txt
echo "----- email body -----"
cat /tmp/email-body.txt
echo "----------------------"
- name: Send email via ntfy
env:
NTFY_TOKEN: ${{ secrets.NTFY_ACCESS_TOKEN }}
NTFY_TOPIC: ${{ secrets.NTFY_TOPIC }}
NOTIFY_EMAIL: ${{ secrets.NOTIFY_EMAIL }}
run: |
missing=()
[ -z "$NTFY_TOKEN" ] && missing+=("NTFY_ACCESS_TOKEN")
[ -z "$NTFY_TOPIC" ] && missing+=("NTFY_TOPIC")
[ -z "$NOTIFY_EMAIL" ] && missing+=("NOTIFY_EMAIL")
if [ ${#missing[@]} -gt 0 ]; then
echo "::error::Missing required secret(s): ${missing[*]}"
echo "::error::Configure at: Settings → Secrets and variables → Actions"
exit 1
fi
if [ "$HEALTH_RESULT" = "failure" ] && [ "$TESTS_RESULT" = "failure" ]; then
SUBJECT="gh-stats.com is DOWN and tests are failing"
elif [ "$HEALTH_RESULT" = "failure" ]; then
SUBJECT="gh-stats.com is DOWN"
else
SUBJECT="gh-stats.com tests failed on ${REF_NAME}"
fi
RUN_URL="${SERVER_URL}/${REPO}/actions/runs/${RUN_ID}"
curl -fsS \
-H "Title: $SUBJECT" \
-H "Priority: high" \
-H "Tags: warning,rotating_light,gh-stats" \
-H "Email: $NOTIFY_EMAIL" \
-H "Click: $RUN_URL" \
-H "Authorization: Bearer $NTFY_TOKEN" \
--data-binary @/tmp/email-body.txt \
"https://ntfy.sh/$NTFY_TOPIC"
+8
View File
@@ -234,3 +234,11 @@ generator/frontend/node_modules/
.superpowers/
.playwright-mcp/
screenshots/
# Kept locally, not tracked
/CLAUDE.md
/docs/
**/*.md
!README.md
!**/README.md
/data/
-63
View File
@@ -1,63 +0,0 @@
# CLAUDE.md
Guidance for Claude Code working in this repository.
## Layout
This is a monorepo of three independent Python services plus a Vite+React
frontend. Each service has its own `requirements.txt`, `pytest.ini`,
`Dockerfile`, and README:
- `fetcher/` — port 5001. Owns the GitHub PAT and `fetcher.db`. Refresh
cron polls GitHub, upserts raw payloads, serves `/data/<u>` to internal
callers only.
- `generator/` — port 5002. Owns settings + widgets SQLite DBs. Build
worker renders SVGs from fetcher data. Serves the React SPA from
`src/static/` and all `/api/*` routes. Frontend sources live in
`generator/frontend/` and get built into `src/static/` by the
multi-stage Dockerfile.
- `edge/` — port 5003. Cache-first SVG proxy in front of the generator;
Flask-Caching + Flask-Compress, optional Redis.
Per-service READMEs cover run/test/Docker commands. The design and
implementation plan live in `docs/superpowers/`.
## Working on a single service
Each service is self-contained. `cd <service> && pytest` is the test
entry point; `cd <service> && pip install -r requirements.txt` is the
dependency install. Don't cross-import across services — they talk
over HTTP (generator → fetcher via `generator/src/fetcher_client.py`;
edge → generator via `edge/src/api.py::_fetch_origin`).
## Configuration
All runtime tuning is in each service's `src/config.py` and is
overridable via env vars:
- `fetcher/src/config.py` — `GITHUB_PAT`, `FETCHER_INTERNAL_TOKEN`,
`COLLABORATOR_*`, `COMMIT_*`, `API_TIMEOUT`, refresh cadence.
- `generator/src/config.py` — `FETCHER_URL`, `FETCHER_INTERNAL_TOKEN`,
`ENROLLMENT_DAILY_CAP`, `WIDGET_LRU_PER_USER`, `POLL_INTERVAL_MINUTES`,
`TAG_MAX_COUNT`, `TAG_LANGUAGE_MAP`, `TAG_TOPIC_MAP`,
`ENABLED_WIDGETS`, `WIDGET_ORDER`, `HIDDEN_LANGUAGES`.
- `edge/src/config.py` — `GENERATOR_URL`, `CACHE_TYPE`,
`CACHE_REDIS_URL`, `CACHE_DEFAULT_TIMEOUT`, `CACHE_THRESHOLD`,
`UPSTREAM_TIMEOUT`.
## Conventions
- Widget renderers return SVG strings; only `generator/src/worker.py`
persists them (via `db.put_widgets`).
- The `X-Widget-Status` header (`ready | building | rate_limited |
not_found`) is the contract between generator and edge for what to
cache.
- Generator ↔ fetcher traffic uses the shared secret
`FETCHER_INTERNAL_TOKEN` (HTTP header `X-Internal-Token`). Public
routes on the generator don't require auth in v1.
- Adding a widget still means: new `generator/src/widgets/<name>.py`,
export from `generator/src/widgets/__init__.py`, wire into
`generator/src/processor.py::generate_widgets_from_github`, add the
key to `WIDGET_ORDER` / `ENABLED_WIDGETS` in
`generator/src/config.py`.
- Adding a theme: entry in `generator/src/themes/themes.py`.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Shay Manor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+397 -27
View File
@@ -1,43 +1,413 @@
# github-readme-stats
[![tests](https://github.com/ShayManor/github-readme-stats/actions/workflows/tests.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/tests.yml)
[![docker](https://github.com/ShayManor/github-readme-stats/actions/workflows/docker.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/docker.yml)
[![build and deploy](https://github.com/ShayManor/github-readme-stats/actions/workflows/deploy.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/deploy.yml)
A monorepo of three independent Python services plus a React frontend,
each self-contained. See each service's README for details.
A single SVG widget you drop into your GitHub profile README. It scores
your account, charts your contribution timeline, highlights your top
collaborators, breaks down your languages, tracks your commit streaks,
and earns you tags like `Backend`, `ML`, or `Founder #42`.
## Services
```md
![my stats](https://gh-stats.com/api/YOUR_USERNAME)
```
| Folder | Port | Responsibility |
<img src="./assets/examples/composite-midnight.svg" width="420" alt="composite widget, midnight theme" />
<details>
<summary>Table of contents (click to expand)</summary>
- [Quick start](#quick-start)
- [Themes](#themes)
- [Individual widgets](#individual-widgets)
- [Migrating from github-readme-stats](#migrating-from-github-readme-stats)
- [Query parameter reference](#query-parameter-reference)
- [Auto-awarded tags](#auto-awarded-tags)
- [Refreshing your data](#refreshing-your-data)
- [FAQ](#faq)
- [Gallery](#gallery)
</details>
---
## Quick start
1. Open <https://gh-stats.com/api/>.
2. Sign in with GitHub. Signing in is how you prove ownership of the
username, and it unlocks the editor.
3. Pick a theme, reorder widgets, add any custom tags or achievements.
4. Click **Generate**.
5. Paste this one line into your profile README:
```md
![my stats](https://gh-stats.com/api/YOUR_USERNAME)
```
The image URL is stable. Once it's in your README you can change
themes, tags, or widget order in the editor at any time without
touching the markdown.
> [!NOTE]
> Only public GitHub activity is counted. Private repos, private
> commit counts, and contributions to org-restricted repos are never
> visible to the fetcher.
---
## Themes
Pass `?theme=<name>` on the URL, or pick one in the editor.
| Theme | Preview |
|---|---|
| `midnight` (default) | <img src="./assets/examples/composite-midnight.svg" width="280" /> |
| `onyx` | <img src="./assets/examples/composite-onyx.svg" width="280" /> |
| `nord` | <img src="./assets/examples/composite-nord.svg" width="280" /> |
| `clean` | <img src="./assets/examples/composite-clean.svg" width="280" /> |
| `paper` | <img src="./assets/examples/composite-paper.svg" width="280" /> |
```md
![stats](https://gh-stats.com/api/YOUR_USERNAME?theme=onyx)
```
### Auto-switching for dark and light mode
Add GitHub's theme suffix to serve a different image to dark vs. light
viewers:
```md
![dark](https://gh-stats.com/api/YOUR_USERNAME?theme=onyx#gh-dark-mode-only)
![light](https://gh-stats.com/api/YOUR_USERNAME?theme=clean#gh-light-mode-only)
```
Or use `<picture>` for precise `prefers-color-scheme` control:
```html
<picture>
<source srcset="https://gh-stats.com/api/YOUR_USERNAME?theme=onyx"
media="(prefers-color-scheme: dark)" />
<source srcset="https://gh-stats.com/api/YOUR_USERNAME?theme=clean"
media="(prefers-color-scheme: light)" />
<img src="https://gh-stats.com/api/YOUR_USERNAME" />
</picture>
```
---
## Individual widgets
Every widget is independently addressable at
`https://gh-stats.com/api/<username>/<widget>.svg`. Embed one, two, or all
of them.
### Grade
Overall score (0 to 100), letter grade, and your top role tags.
<img src="./assets/examples/grade.svg" width="380" alt="grade widget" />
```md
![grade](https://gh-stats.com/api/YOUR_USERNAME/grade.svg)
```
### Impact
Your contribution volume over the last 6 months, drawn as a smooth area
chart.
<img src="./assets/examples/impact.svg" width="380" alt="impact widget" />
```md
![impact](https://gh-stats.com/api/YOUR_USERNAME/impact.svg)
```
### Streaks
Current and longest contribution streaks.
<img src="./assets/examples/streaks.svg" width="380" alt="streaks widget" />
```md
![streaks](https://gh-stats.com/api/YOUR_USERNAME/streaks.svg)
```
### Top collaborators
The people you actually work with, filtered down to repos of a
reasonable size so a drive-by PR to `react` does not put the React team
on your card.
<img src="./assets/examples/collaborators.svg" width="380" alt="collaborators widget" />
```md
![collaborators](https://gh-stats.com/api/YOUR_USERNAME/collaborators.svg)
```
### Recent focus
What you have actually been working on lately, grouped by topic.
<img src="./assets/examples/focus.svg" width="380" alt="focus widget" />
```md
![focus](https://gh-stats.com/api/YOUR_USERNAME/focus.svg)
```
### Languages
Your language mix, weighted by bytes in repos you authored. Forks with
no meaningful contribution are ignored.
<img src="./assets/examples/languages.svg" width="380" alt="languages widget" />
```md
![languages](https://gh-stats.com/api/YOUR_USERNAME/languages.svg)
```
### Achievements
Hand-entered lines for hackathons, talks, awards, and certifications.
<img src="./assets/examples/achievements.svg" width="380" alt="achievements widget" />
```md
![achievements](https://gh-stats.com/api/YOUR_USERNAME/achievements.svg)
```
### Side by side
GitHub strips inline CSS, so an HTML table is the simplest way to put
two widgets next to each other.
```html
<table><tr>
<td><img src="https://gh-stats.com/api/YOUR_USERNAME/grade.svg" /></td>
<td><img src="https://gh-stats.com/api/YOUR_USERNAME/languages.svg" /></td>
</tr></table>
```
---
## Migrating from github-readme-stats
[`anuraghazra/github-readme-stats`](https://github.com/anuraghazra/github-readme-stats)
is the card most profile READMEs use, and it is a good project. Its README now
carries a deprecation notice pointing at a successor, so if you are looking to
move, the common URL shapes work here with only the domain changed.
| Your current URL | Change it to |
|---|---|
| `github-readme-stats.vercel.app/api?username=U` | `gh-stats.com/api?username=U` |
| `github-readme-stats.vercel.app/api/top-langs?username=U` | `gh-stats.com/api/top-langs?username=U` |
| `github-readme-streak-stats.herokuapp.com/?user=U` | `gh-stats.com/api/streak/U` |
Nothing else in your README changes.
> [!NOTE]
> `theme=` is honoured on the composite card (`/api/<user>`). On the
> compatibility and single-widget URLs above it is currently ignored and the
> default theme is served.
If you would rather replace several badges with one image, use the composite
card instead and delete the rest:
```md
![stats](https://gh-stats.com/api/YOUR_USERNAME)
```
## Query parameter reference
Every URL accepts query parameters. They override the owner's saved
settings on a per-embed basis, so viewers can tweak the look without
changing anything the owner has stored.
Values with special characters must be URL-encoded: `#a78bfa` becomes
`%23a78bfa`, a space becomes `%20`.
### Common parameters
| Parameter | What it does | Example |
|---|---|---|
| [`fetcher/`](./fetcher/README.md) | 5001 | Owns GitHub PAT + `fetcher.db`; cron-refreshes data |
| [`generator/`](./generator/README.md) | 5002 | Settings + widgets DBs, build worker, serves React SPA + `/api/*` |
| [`edge/`](./edge/README.md) | 5003 | Cache-first SVG proxy; deploy globally |
| `theme` | Built-in theme name. | `?theme=onyx` |
| `widgets` | Which widgets to show on the composite card. | `?widgets=grade,streaks,languages` |
| `order` | Render order on the composite card. | `?order=grade,streaks,languages` |
| `hide` | Languages to exclude from the languages widget. | `?hide=HTML,CSS,Makefile` |
| `tags` | Extra custom role tags on the grade widget. | `?tags=ML,Systems` |
## Design Docs
### Per-widget parameters
- Spec: [`docs/superpowers/specs/2026-04-17-production-pipeline-design.md`](docs/superpowers/specs/2026-04-17-production-pipeline-design.md)
- Plan: [`docs/superpowers/plans/2026-04-17-production-pipeline.md`](docs/superpowers/plans/2026-04-17-production-pipeline.md)
Use dot notation: `<widget>.<key>=<value>`.
## Quick start (local dev, no Docker)
| Parameter | What it does | Type | Default |
|---|---|---|---|
| `grade.max_tags` | Max role tags shown (1 to 20). | int | all tags |
| `impact.line_color` | Accent color for the area curve. | hex color | theme accent |
| `streaks.color` | Accent color for the current-streak text. | hex color | theme accent |
| `collaborators.max_count` | Max collaborators shown (1 to 10). | int | 5 |
| `collaborators.bar_color` | Accent color for the commit bars. | hex color | theme accent |
| `focus.max_categories` | Max focus clusters shown (1 to 10). | int | 6 |
| `languages.max_languages` | Max languages shown (1 to 10). | int | 5 |
| `achievements.max_items` | Max achievement rows shown (1 to 10). | int | 5 |
# 1) fetcher
(cd fetcher && pip install -r requirements.txt &&
FETCHER_INTERNAL_TOKEN=dev GITHUB_PAT=<your-pat> python -m src.api) &
---
# 2) generator API, worker, cron (three processes)
cd generator && pip install -r requirements.txt
FETCHER_URL=http://localhost:5001 FETCHER_INTERNAL_TOKEN=dev python -m src.api &
FETCHER_URL=http://localhost:5001 FETCHER_INTERNAL_TOKEN=dev python -m src.worker &
FETCHER_URL=http://localhost:5001 FETCHER_INTERNAL_TOKEN=dev python -m src.cron &
## Auto-awarded tags
# 3) edge
(cd ../edge && pip install -r requirements.txt &&
GENERATOR_URL=http://localhost:5002 python -m src.api) &
Some tags on the grade card are earned from real activity. No query
parameter will add them if you have not earned them:
# 4) frontend (dev server)
cd ../generator/frontend && npm install && npm run dev
- `Founder #N` is your enrollment number, fixed when you first sign in.
- Role tags like `Backend`, `Frontend`, `ML`, `Mobile`, `DevOps`,
`Cloud`, `Systems`, `Database`, `Security` are derived from your
language mix and repo topics.
Test everything:
---
(cd fetcher && pytest) && (cd generator && pytest) && (cd edge && pytest)
## Refreshing your data
The refresh cron re-pulls GitHub data every 15 minutes, so new commits
usually appear in your widget within that window. GitHub's image CDN
may add another minute or two on top.
If you need an immediate update (for example right after merging
something big), click **Refresh now** in the editor. It is a one-shot
per account, so save it for when it matters.
---
## Self-hosting
The public instance at `gh-stats.com` is free and you do not need to run your
own. Self-host if you want your own rate limit, private repository data staying
on your hardware, or control over when cards rebuild.
You need Docker and a GitHub token. The token needs no scopes for public data;
it exists to raise your GitHub API rate limit.
```bash
git clone https://github.com/ShayManor/github-readme-stats
cd github-readme-stats
cp .env.example .env # put your token in GITHUB_PAT
docker compose up -d --build
```
Then open `http://localhost:5002` and embed from your own host:
```md
![stats](http://localhost:5002/api/YOUR_USERNAME)
```
Three services come up behind `docker compose`: `fetcher` talks to GitHub and
owns the token, `generator` renders the SVGs and serves the web UI on 5002, and
`edge` is a caching proxy on 5003 that serves cards at `/<username>`. Data lives
in `./data`. Set `GHSTATS_PORT` to move the web UI off 5002.
## FAQ
**Can I use a private GitHub account?**
No. The service only reads public activity. Private repos, private
commit counts, and contributions to org-restricted repos are not
visible to GitHub's public API, so they are never part of the widget.
**How fresh is the data?**
Every 15 minutes, automatically. You can also click **Refresh now**
once per account for an immediate update.
**How do I edit my widget?**
Sign in with GitHub at <https://gh-stats.com/api/>. Only the account whose
login matches the username can edit that widget's settings.
**Can I change the widget without re-embedding?**
Yes. The image URL is stable. Edit in the editor, click **Generate**,
and the next fetch serves the new version. GitHub's image cache may
delay propagation by a few minutes.
**Can I embed someone else's widget with my own theme or filters?**
Yes, use the [query parameters](#query-parameter-reference). The
owner's saved settings are not affected.
**I am getting a placeholder card. What is wrong?**
`building` means the first render is still in progress, give it a
minute. `not_found` means GitHub does not know that username.
**Why does my languages card look wrong?**
It counts bytes in repos you authored. Forks with little commit
activity are dropped. Add `?hide=HTML,CSS,Makefile` if generated files
dominate the breakdown.
**Can I reorder widgets?**
Yes, either in the editor (drag and drop) or by passing
`?widgets=...&order=...` on the URL.
---
## Gallery
### Composite themes
<table>
<tr>
<td align="center"><b>midnight</b><br/><img src="./assets/examples/composite-midnight.svg" width="260" /></td>
<td align="center"><b>onyx</b><br/><img src="./assets/examples/composite-onyx.svg" width="260" /></td>
</tr>
<tr>
<td align="center"><b>nord</b><br/><img src="./assets/examples/composite-nord.svg" width="260" /></td>
<td align="center"><b>clean</b><br/><img src="./assets/examples/composite-clean.svg" width="260" /></td>
</tr>
<tr>
<td align="center"><b>paper</b><br/><img src="./assets/examples/composite-paper.svg" width="260" /></td>
<td align="center"><b>custom (onyx, 3 widgets)</b><br/><img src="./assets/examples/composite-custom.svg" width="260" /></td>
</tr>
</table>
### Single-widget examples
<table>
<tr>
<td align="center"><b>Grade</b><br/><img src="./assets/examples/grade.svg" width="320" /></td>
<td align="center"><b>Grade (max_tags=3)</b><br/><img src="./assets/examples/grade-compact.svg" width="320" /></td>
</tr>
<tr>
<td align="center"><b>Impact</b><br/><img src="./assets/examples/impact.svg" width="320" /></td>
<td align="center"><b>Impact (purple line)</b><br/><img src="./assets/examples/impact-purple.svg" width="320" /></td>
</tr>
<tr>
<td align="center"><b>Streaks</b><br/><img src="./assets/examples/streaks.svg" width="320" /></td>
<td align="center"><b>Streaks (green)</b><br/><img src="./assets/examples/streaks-green.svg" width="320" /></td>
</tr>
<tr>
<td align="center"><b>Languages</b><br/><img src="./assets/examples/languages.svg" width="320" /></td>
<td align="center"><b>Languages (hide Shell, Dockerfile)</b><br/><img src="./assets/examples/languages-hide.svg" width="320" /></td>
</tr>
<tr>
<td align="center"><b>Collaborators</b><br/><img src="./assets/examples/collaborators.svg" width="320" /></td>
<td align="center"><b>Focus</b><br/><img src="./assets/examples/focus.svg" width="320" /></td>
</tr>
<tr>
<td align="center"><b>Achievements</b><br/><img src="./assets/examples/achievements.svg" width="320" /></td>
<td></td>
</tr>
</table>
### Mix and match
Embed two widgets side by side with an HTML table:
```html
<table><tr>
<td><img src="https://gh-stats.com/api/YOUR_USERNAME/grade.svg" /></td>
<td><img src="https://gh-stats.com/api/YOUR_USERNAME/languages.svg" /></td>
</tr></table>
```
Stack a custom composite with only three widgets:
```md
![stats](https://gh-stats.com/api/YOUR_USERNAME?theme=onyx&widgets=grade,streaks,languages&order=grade,streaks,languages)
```
Recolor the impact line:
```md
![impact](https://gh-stats.com/api/YOUR_USERNAME/impact.svg?impact.line_color=%23a78bfa)
```
+72
View File
@@ -0,0 +1,72 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="274" viewBox="0 0 380 274" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="272" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">ACHIEVEMENTS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 8)">
<rect width="348" height="48" rx="8" fill="#d29922" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#d29922" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="#d29922" stroke-width="1.5"/>
<rect x="3" y="16" width="18" height="1.5" rx="0.5" fill="#d29922" opacity="0.85"/>
<path d="M9 9l-2 3 2 3m6-6l2 3-2 3" stroke="#d29922" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">Hackathon winner</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Y Combinator AI Hackathon · 2025-11</text>
</g>
<g transform="translate(16, 64)">
<rect width="348" height="48" rx="8" fill="#3fb950" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#3fb950" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="#3fb950" stroke-width="1.5" stroke-linejoin="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">Speaker at PyCon</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Async at scale · 2024-05</text>
</g>
<g transform="translate(16, 120)">
<rect width="348" height="48" rx="8" fill="#58a6ff" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#58a6ff" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M7 2h10v2h2.5c.8 0 1.5.7 1.5 1.5V8c0 1.7-1.3 3-3 3h-.5c-.5 1.5-1.8 2.7-3.5 3v2.5h3c.6 0 1 .4 1 1s-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h3V14c-1.7-.3-3-1.5-3.5-3H6c-1.7 0-3-1.3-3-3V5.5C3 4.7 3.7 4 4.5 4H7V2zm0 4H4.5v2c0 .8.7 1.5 1.5 1.5h1V6zm12.5 0H17v3.5h1c.8 0 1.5-.7 1.5-1.5V6z" fill="#58a6ff" opacity="0.85"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">Open Source Award</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">GitHub Stars program · 2024-01</text>
</g>
<g transform="translate(16, 176)">
<rect width="348" height="48" rx="8" fill="#bc8cff" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#bc8cff" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<circle cx="12" cy="14" r="5" fill="#bc8cff" opacity="0.2"/>
<circle cx="12" cy="14" r="4" fill="none" stroke="#bc8cff" stroke-width="1.5"/>
<path d="M12 11.5l1 2 2.2.3-1.6 1.5.4 2.2-2-1-2 1 .4-2.2-1.6-1.5 2.2-.3z" fill="#bc8cff"/>
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="#bc8cff" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">AWS Certified Solutions Architect</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Professional · 2023-09</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

+89
View File
@@ -0,0 +1,89 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="298" viewBox="0 0 380 298" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="296" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">TOP COLLABORATORS</text>
<g transform="translate(0, 36)">
<g transform="translate(36, 20)">
<circle cx="0" cy="0" r="18" fill="hsl(285, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">torvalds</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">4 repos · 142 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="120.0" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="120.0" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 70)">
<circle cx="0" cy="0" r="18" fill="hsl(165, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">G</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">gaearon</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">3 repos · 98 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="82.8169014084507" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="82.8169014084507" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 120)">
<circle cx="0" cy="0" r="18" fill="hsl(238, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">S</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">sindresorhus</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">2 repos · 64 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="54.08450704225352" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="54.08450704225352" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 170)">
<circle cx="0" cy="0" r="18" fill="hsl(157, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">tj</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">2 repos · 47 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="39.71830985915493" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="39.71830985915493" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 220)">
<circle cx="0" cy="0" r="18" fill="hsl(231, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">Y</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">yyx990803</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">1 repos · 31 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="26.197183098591548" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="26.197183098591548" dur="0.6s" fill="freeze"/>
</rect>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

+543
View File
@@ -0,0 +1,543 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="420" height="1756" viewBox="0 0 420 1756">
<rect width="420" height="1756" rx="16" fill="#ffffff"/>
<rect x="0.5" y="0.5" width="419" height="1755" rx="16"
fill="none" stroke="#d8dee4" stroke-width="1"/>
<svg x="20" y="20" width="380" height="226" viewBox="0 0 380 226">
<defs>
<filter id="grade_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="grade_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="224" rx="10" ry="10"
fill="#f6f8fa" stroke="#d8dee4" stroke-width="1" filter="url(#grade_shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#eaeef2" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#eaeef2" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#24292f">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#656d76"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76" letter-spacing="0.4">Score <tspan fill="#24292f" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#eaeef2" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#656d76" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#656d76"/><line x1="7" y1="10" x2="7" y2="14" stroke="#656d76" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#656d76" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#24292f">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#656d76" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#656d76" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#656d76" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#24292f">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#656d76" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#24292f">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#656d76" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#656d76" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#656d76" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#656d76" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#24292f">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#656d76" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#656d76" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#656d76" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#656d76" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#24292f">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#eaeef2" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#0969da" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#0969da" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#0969da">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#0969da" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#0969da" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#0969da">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#0969da" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#0969da" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#0969da">Systems</text>
</g>
<g transform="translate(177, 0)" opacity="0.9">
<rect width="51" height="24" rx="12" fill="#0969da" opacity="0.12"/>
<rect width="51" height="24" rx="12" fill="none" stroke="#0969da" stroke-width="1" opacity="0.3"/>
<text x="25" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#0969da">Cloud</text>
</g>
<g transform="translate(234, 0)" opacity="0.9">
<rect width="90" height="24" rx="12" fill="#facc15" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#facc15" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#facc15">Founder #42</text>
</g>
<g transform="translate(0, 30)" opacity="0.55">
<rect width="90" height="24" rx="12" fill="#0969da" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#0969da" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#0969da">Open source</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="262" width="380" height="200" viewBox="0 0 380 200">
<defs>
<filter id="impact_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="impact_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="198" rx="10" ry="10"
fill="#f6f8fa" stroke="#d8dee4" stroke-width="1" filter="url(#impact_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#656d76" letter-spacing="0.8" opacity="0.7">IMPACT TIMELINE</text>
<g transform="translate(0, 36)">
<defs>
<linearGradient id="impact_areaGrad" x1="0" y1="8" x2="0" y2="90" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#0969da" stop-opacity="0.35"/>
<stop offset="100%" stop-color="#0969da" stop-opacity="0.02"/>
</linearGradient>
</defs>
<text x="34" y="12.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#656d76">41</text><line x1="40" y1="8.0" x2="356" y2="8.0" stroke="#eaeef2" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="53.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#656d76">20</text><line x1="40" y1="49.0" x2="356" y2="49.0" stroke="#eaeef2" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="94.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#656d76">0</text><line x1="40" y1="90.0" x2="356" y2="90.0" stroke="#eaeef2" stroke-width="0.5" stroke-dasharray="3,3"/>
<text x="40.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#656d76">2025-10</text><text x="204.3" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#656d76">2026-01</text><text x="356.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#656d76">2026-04</text>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0 L 356.0 90 L 40.0 90 Z" fill="url(#impact_areaGrad)"/>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0" fill="none" stroke="#0969da" stroke-width="2" stroke-linecap="round"/>
<g transform="translate(20, 136)">
<text x="0" y="0" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="700" fill="#24292f">577</text>
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">commits over 6mo</text>
</g>
</g>
</svg>
<svg x="20" y="478" width="380" height="170" viewBox="0 0 380 170">
<defs>
<filter id="streaks_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="streaks_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#f6f8fa" stroke="#d8dee4" stroke-width="1" filter="url(#streaks_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#656d76" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#656d76">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#0969da">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#656d76">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#24292f">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#d8dee4" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#eaeef2"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#0969da"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#0969da"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">Sep 13 – Nov 12, 2025</text>
</g>
</svg>
<svg x="20" y="664" width="380" height="298" viewBox="0 0 380 298">
<defs>
<filter id="collaborators_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="collaborators_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="296" rx="10" ry="10"
fill="#f6f8fa" stroke="#d8dee4" stroke-width="1" filter="url(#collaborators_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#656d76" letter-spacing="0.8" opacity="0.7">TOP COLLABORATORS</text>
<g transform="translate(0, 36)">
<g transform="translate(36, 20)">
<circle cx="0" cy="0" r="18" fill="hsl(285, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">torvalds</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">4 repos · 142 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#eaeef2"/>
<rect x="200" y="-6" width="120.0" height="8" rx="4" fill="#8250df" opacity="0.8">
<animate attributeName="width" from="0" to="120.0" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 70)">
<circle cx="0" cy="0" r="18" fill="hsl(165, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">G</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">gaearon</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">3 repos · 98 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#eaeef2"/>
<rect x="200" y="-6" width="82.8169014084507" height="8" rx="4" fill="#8250df" opacity="0.8">
<animate attributeName="width" from="0" to="82.8169014084507" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 120)">
<circle cx="0" cy="0" r="18" fill="hsl(238, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">S</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">sindresorhus</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">2 repos · 64 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#eaeef2"/>
<rect x="200" y="-6" width="54.08450704225352" height="8" rx="4" fill="#8250df" opacity="0.8">
<animate attributeName="width" from="0" to="54.08450704225352" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 170)">
<circle cx="0" cy="0" r="18" fill="hsl(157, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">tj</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">2 repos · 47 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#eaeef2"/>
<rect x="200" y="-6" width="39.71830985915493" height="8" rx="4" fill="#8250df" opacity="0.8">
<animate attributeName="width" from="0" to="39.71830985915493" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 220)">
<circle cx="0" cy="0" r="18" fill="hsl(231, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">Y</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">yyx990803</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">1 repos · 31 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#eaeef2"/>
<rect x="200" y="-6" width="26.197183098591548" height="8" rx="4" fill="#8250df" opacity="0.8">
<animate attributeName="width" from="0" to="26.197183098591548" dur="0.6s" fill="freeze"/>
</rect>
</g>
</g>
</svg>
<svg x="20" y="978" width="380" height="234" viewBox="0 0 380 234">
<defs>
<filter id="focus_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="focus_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="232" rx="10" ry="10"
fill="#f6f8fa" stroke="#d8dee4" stroke-width="1" filter="url(#focus_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#656d76" letter-spacing="0.8" opacity="0.7">RECENT FOCUS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#24292f">Backend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#eaeef2"/>
<rect x="90" y="4" width="210.0" height="14" rx="7" fill="#58a6ff" opacity="0.8">
<animate attributeName="width" from="0" to="210.0" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">412 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#58a6ff">38%</text>
</g>
<g transform="translate(16, 36)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#24292f">ML</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#eaeef2"/>
<rect x="90" y="4" width="132.6315789473684" height="14" rx="7" fill="#3fb950" opacity="0.8">
<animate attributeName="width" from="0" to="132.6315789473684" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">260 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#3fb950">24%</text>
</g>
<g transform="translate(16, 72)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#24292f">Frontend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#eaeef2"/>
<rect x="90" y="4" width="99.47368421052632" height="14" rx="7" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="99.47368421052632" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">195 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#bc8cff">18%</text>
</g>
<g transform="translate(16, 108)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#24292f">DevOps</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#eaeef2"/>
<rect x="90" y="4" width="66.3157894736842" height="14" rx="7" fill="#d29922" opacity="0.8">
<animate attributeName="width" from="0" to="66.3157894736842" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">130 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#d29922">12%</text>
</g>
<g transform="translate(16, 144)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#24292f">Cloud</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#eaeef2"/>
<rect x="90" y="4" width="44.21052631578947" height="14" rx="7" fill="#f0883e" opacity="0.8">
<animate attributeName="width" from="0" to="44.21052631578947" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76">87 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#f0883e">8%</text>
</g>
<text x="16" y="188" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76" opacity="0.7">Recent activity · last year</text>
</g>
</svg>
<svg x="20" y="1228" width="380" height="208" viewBox="0 0 380 208">
<defs>
<filter id="languages_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="languages_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="206" rx="10" ry="10"
fill="#f6f8fa" stroke="#d8dee4" stroke-width="1" filter="url(#languages_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#656d76" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="113.3 163.1" stroke-dashoffset="0.0"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="63.6 212.9" stroke-dashoffset="-113.3"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="163.1" to="-113.3" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="41.5 235.0" stroke-dashoffset="-176.9"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="99.5" to="-176.9" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="30.4 246.0" stroke-dashoffset="-218.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="58.1" to="-218.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#89e051" stroke-width="16"
stroke-dasharray="16.6 259.9" stroke-dashoffset="-248.8"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="27.6" to="-248.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#656d76" stroke-width="16"
stroke-dasharray="11.1 265.4" stroke-dashoffset="-265.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="11.1" to="-265.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="28" fill="#f6f8fa"/>
<text x="60" y="87.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#24292f">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#24292f">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#656d76">41%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#24292f">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#656d76">23%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#24292f">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#656d76">15%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#24292f">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#656d76">11%</text>
</g>
<g transform="translate(140, 108)">
<rect width="10" height="10" rx="2" fill="#89e051"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#24292f">Shell</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#656d76">6%</text>
</g>
<g transform="translate(140, 130)">
<rect width="10" height="10" rx="2" fill="#656d76"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#24292f">Other</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#656d76">4%</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="1452" width="380" height="274" viewBox="0 0 380 274">
<defs>
<filter id="achievements_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="achievements_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="272" rx="10" ry="10"
fill="#f6f8fa" stroke="#d8dee4" stroke-width="1" filter="url(#achievements_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#656d76" letter-spacing="0.8" opacity="0.7">ACHIEVEMENTS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 8)">
<rect width="348" height="48" rx="8" fill="#9a6700" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#9a6700" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="#9a6700" stroke-width="1.5"/>
<rect x="3" y="16" width="18" height="1.5" rx="0.5" fill="#9a6700" opacity="0.85"/>
<path d="M9 9l-2 3 2 3m6-6l2 3-2 3" stroke="#9a6700" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">Hackathon winner</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">Y Combinator AI Hackathon · 2025-11</text>
</g>
<g transform="translate(16, 64)">
<rect width="348" height="48" rx="8" fill="#1a7f37" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#1a7f37" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="#1a7f37" stroke-width="1.5" stroke-linejoin="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">Speaker at PyCon</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">Async at scale · 2024-05</text>
</g>
<g transform="translate(16, 120)">
<rect width="348" height="48" rx="8" fill="#0969da" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#0969da" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M7 2h10v2h2.5c.8 0 1.5.7 1.5 1.5V8c0 1.7-1.3 3-3 3h-.5c-.5 1.5-1.8 2.7-3.5 3v2.5h3c.6 0 1 .4 1 1s-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h3V14c-1.7-.3-3-1.5-3.5-3H6c-1.7 0-3-1.3-3-3V5.5C3 4.7 3.7 4 4.5 4H7V2zm0 4H4.5v2c0 .8.7 1.5 1.5 1.5h1V6zm12.5 0H17v3.5h1c.8 0 1.5-.7 1.5-1.5V6z" fill="#0969da" opacity="0.85"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">Open Source Award</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">GitHub Stars program · 2024-01</text>
</g>
<g transform="translate(16, 176)">
<rect width="348" height="48" rx="8" fill="#8250df" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#8250df" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<circle cx="12" cy="14" r="5" fill="#8250df" opacity="0.2"/>
<circle cx="12" cy="14" r="4" fill="none" stroke="#8250df" stroke-width="1.5"/>
<path d="M12 11.5l1 2 2.2.3-1.6 1.5.4 2.2-2-1-2 1 .4-2.2-1.6-1.5 2.2-.3z" fill="#8250df"/>
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="#8250df" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#24292f">AWS Certified Solutions Architect</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#656d76">Professional · 2023-09</text>
</g>
</g>
</svg>
<text x="210" y="1748" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#656d76" opacity="0.5">Generated with gh-stats</text>
</svg>

After

Width:  |  Height:  |  Size: 38 KiB

+268
View File
@@ -0,0 +1,268 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="420" height="686" viewBox="0 0 420 686">
<rect width="420" height="686" rx="16" fill="#09090b"/>
<rect x="0.5" y="0.5" width="419" height="685" rx="16"
fill="none" stroke="#27272a" stroke-width="1"/>
<svg x="20" y="20" width="380" height="226" viewBox="0 0 380 226">
<defs>
<filter id="grade_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="grade_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="224" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#grade_shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#27272a" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#27272a" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#fafafa">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#a1a1aa"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa" letter-spacing="0.4">Score <tspan fill="#fafafa" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#27272a" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#a1a1aa" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#a1a1aa"/><line x1="7" y1="10" x2="7" y2="14" stroke="#a1a1aa" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#a1a1aa" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#a1a1aa" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#a1a1aa" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#a1a1aa" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#a1a1aa" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#a1a1aa" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#a1a1aa" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#a1a1aa" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#27272a" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Systems</text>
</g>
<g transform="translate(177, 0)" opacity="0.9">
<rect width="51" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="51" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="25" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Cloud</text>
</g>
<g transform="translate(234, 0)" opacity="0.9">
<rect width="90" height="24" rx="12" fill="#facc15" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#facc15" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#facc15">Founder #42</text>
</g>
<g transform="translate(0, 30)" opacity="0.55">
<rect width="90" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Open source</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="262" width="380" height="170" viewBox="0 0 380 170">
<defs>
<filter id="streaks_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="streaks_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#streaks_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#a1a1aa">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#a78bfa">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#a1a1aa">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#fafafa">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#27272a" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#27272a"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#a78bfa"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#a78bfa"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">Sep 13 – Nov 12, 2025</text>
</g>
</svg>
<svg x="20" y="448" width="380" height="208" viewBox="0 0 380 208">
<defs>
<filter id="languages_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="languages_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="206" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#languages_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="113.3 163.1" stroke-dashoffset="0.0"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="63.6 212.9" stroke-dashoffset="-113.3"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="163.1" to="-113.3" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="41.5 235.0" stroke-dashoffset="-176.9"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="99.5" to="-176.9" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="30.4 246.0" stroke-dashoffset="-218.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="58.1" to="-218.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#89e051" stroke-width="16"
stroke-dasharray="16.6 259.9" stroke-dashoffset="-248.8"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="27.6" to="-248.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#a1a1aa" stroke-width="16"
stroke-dasharray="11.1 265.4" stroke-dashoffset="-265.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="11.1" to="-265.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="28" fill="#18181b"/>
<text x="60" y="87.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#fafafa">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">41%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">23%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">15%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">11%</text>
</g>
<g transform="translate(140, 108)">
<rect width="10" height="10" rx="2" fill="#89e051"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Shell</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">6%</text>
</g>
<g transform="translate(140, 130)">
<rect width="10" height="10" rx="2" fill="#a1a1aa"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Other</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">4%</text>
</g>
</g>
</g>
</svg>
<text x="210" y="678" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa" opacity="0.5">Generated with gh-stats</text>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB

+543
View File
@@ -0,0 +1,543 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="420" height="1756" viewBox="0 0 420 1756">
<rect width="420" height="1756" rx="16" fill="#121820"/>
<rect x="0.5" y="0.5" width="419" height="1755" rx="16"
fill="none" stroke="#2a3444" stroke-width="1"/>
<svg x="20" y="20" width="380" height="226" viewBox="0 0 380 226">
<defs>
<filter id="grade_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="grade_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="224" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#grade_shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#1e2836" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#1e2836" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#d1d9e0">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#7d8895"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895" letter-spacing="0.4">Score <tspan fill="#d1d9e0" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#1e2836" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#7d8895" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#7d8895"/><line x1="7" y1="10" x2="7" y2="14" stroke="#7d8895" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#7d8895" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#7d8895" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#7d8895" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#7d8895" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#7d8895" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#7d8895" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#7d8895" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#7d8895" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#7d8895" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#7d8895" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#7d8895" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#7d8895" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#7d8895" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#1e2836" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Systems</text>
</g>
<g transform="translate(177, 0)" opacity="0.9">
<rect width="51" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="51" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="25" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Cloud</text>
</g>
<g transform="translate(234, 0)" opacity="0.9">
<rect width="90" height="24" rx="12" fill="#facc15" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#facc15" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#facc15">Founder #42</text>
</g>
<g transform="translate(0, 30)" opacity="0.55">
<rect width="90" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Open source</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="262" width="380" height="200" viewBox="0 0 380 200">
<defs>
<filter id="impact_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="impact_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="198" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#impact_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">IMPACT TIMELINE</text>
<g transform="translate(0, 36)">
<defs>
<linearGradient id="impact_areaGrad" x1="0" y1="8" x2="0" y2="90" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#58a6ff" stop-opacity="0.35"/>
<stop offset="100%" stop-color="#58a6ff" stop-opacity="0.02"/>
</linearGradient>
</defs>
<text x="34" y="12.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">41</text><line x1="40" y1="8.0" x2="356" y2="8.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="53.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">20</text><line x1="40" y1="49.0" x2="356" y2="49.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="94.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">0</text><line x1="40" y1="90.0" x2="356" y2="90.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/>
<text x="40.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2025-10</text><text x="204.3" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2026-01</text><text x="356.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2026-04</text>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0 L 356.0 90 L 40.0 90 Z" fill="url(#impact_areaGrad)"/>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0" fill="none" stroke="#58a6ff" stroke-width="2" stroke-linecap="round"/>
<g transform="translate(20, 136)">
<text x="0" y="0" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="700" fill="#d1d9e0">577</text>
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">commits over 6mo</text>
</g>
</g>
</svg>
<svg x="20" y="478" width="380" height="170" viewBox="0 0 380 170">
<defs>
<filter id="streaks_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="streaks_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#streaks_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7d8895">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#58a6ff">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7d8895">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#d1d9e0">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#2a3444" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#1e2836"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#58a6ff"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#58a6ff"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Sep 13 – Nov 12, 2025</text>
</g>
</svg>
<svg x="20" y="664" width="380" height="298" viewBox="0 0 380 298">
<defs>
<filter id="collaborators_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="collaborators_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="296" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#collaborators_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">TOP COLLABORATORS</text>
<g transform="translate(0, 36)">
<g transform="translate(36, 20)">
<circle cx="0" cy="0" r="18" fill="hsl(285, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">torvalds</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">4 repos · 142 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="120.0" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="120.0" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 70)">
<circle cx="0" cy="0" r="18" fill="hsl(165, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">G</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">gaearon</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">3 repos · 98 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="82.8169014084507" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="82.8169014084507" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 120)">
<circle cx="0" cy="0" r="18" fill="hsl(238, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">S</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">sindresorhus</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">2 repos · 64 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="54.08450704225352" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="54.08450704225352" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 170)">
<circle cx="0" cy="0" r="18" fill="hsl(157, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">tj</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">2 repos · 47 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="39.71830985915493" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="39.71830985915493" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 220)">
<circle cx="0" cy="0" r="18" fill="hsl(231, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">Y</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">yyx990803</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">1 repos · 31 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#1e2836"/>
<rect x="200" y="-6" width="26.197183098591548" height="8" rx="4" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="26.197183098591548" dur="0.6s" fill="freeze"/>
</rect>
</g>
</g>
</svg>
<svg x="20" y="978" width="380" height="234" viewBox="0 0 380 234">
<defs>
<filter id="focus_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="focus_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="232" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#focus_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">RECENT FOCUS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">Backend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="210.0" height="14" rx="7" fill="#58a6ff" opacity="0.8">
<animate attributeName="width" from="0" to="210.0" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">412 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#58a6ff">38%</text>
</g>
<g transform="translate(16, 36)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">ML</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="132.6315789473684" height="14" rx="7" fill="#3fb950" opacity="0.8">
<animate attributeName="width" from="0" to="132.6315789473684" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">260 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#3fb950">24%</text>
</g>
<g transform="translate(16, 72)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">Frontend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="99.47368421052632" height="14" rx="7" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="99.47368421052632" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">195 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#bc8cff">18%</text>
</g>
<g transform="translate(16, 108)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">DevOps</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="66.3157894736842" height="14" rx="7" fill="#d29922" opacity="0.8">
<animate attributeName="width" from="0" to="66.3157894736842" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">130 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#d29922">12%</text>
</g>
<g transform="translate(16, 144)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">Cloud</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="44.21052631578947" height="14" rx="7" fill="#f0883e" opacity="0.8">
<animate attributeName="width" from="0" to="44.21052631578947" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">87 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#f0883e">8%</text>
</g>
<text x="16" y="188" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895" opacity="0.7">Recent activity · last year</text>
</g>
</svg>
<svg x="20" y="1228" width="380" height="208" viewBox="0 0 380 208">
<defs>
<filter id="languages_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="languages_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="206" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#languages_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="113.3 163.1" stroke-dashoffset="0.0"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="63.6 212.9" stroke-dashoffset="-113.3"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="163.1" to="-113.3" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="41.5 235.0" stroke-dashoffset="-176.9"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="99.5" to="-176.9" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="30.4 246.0" stroke-dashoffset="-218.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="58.1" to="-218.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#89e051" stroke-width="16"
stroke-dasharray="16.6 259.9" stroke-dashoffset="-248.8"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="27.6" to="-248.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#7d8895" stroke-width="16"
stroke-dasharray="11.1 265.4" stroke-dashoffset="-265.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="11.1" to="-265.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="28" fill="#1a2230"/>
<text x="60" y="87.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#d1d9e0">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">41%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">23%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">15%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">11%</text>
</g>
<g transform="translate(140, 108)">
<rect width="10" height="10" rx="2" fill="#89e051"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Shell</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">6%</text>
</g>
<g transform="translate(140, 130)">
<rect width="10" height="10" rx="2" fill="#7d8895"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Other</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">4%</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="1452" width="380" height="274" viewBox="0 0 380 274">
<defs>
<filter id="achievements_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="achievements_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="272" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#achievements_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">ACHIEVEMENTS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 8)">
<rect width="348" height="48" rx="8" fill="#d29922" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#d29922" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="#d29922" stroke-width="1.5"/>
<rect x="3" y="16" width="18" height="1.5" rx="0.5" fill="#d29922" opacity="0.85"/>
<path d="M9 9l-2 3 2 3m6-6l2 3-2 3" stroke="#d29922" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">Hackathon winner</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Y Combinator AI Hackathon · 2025-11</text>
</g>
<g transform="translate(16, 64)">
<rect width="348" height="48" rx="8" fill="#3fb950" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#3fb950" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="#3fb950" stroke-width="1.5" stroke-linejoin="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">Speaker at PyCon</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Async at scale · 2024-05</text>
</g>
<g transform="translate(16, 120)">
<rect width="348" height="48" rx="8" fill="#58a6ff" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#58a6ff" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M7 2h10v2h2.5c.8 0 1.5.7 1.5 1.5V8c0 1.7-1.3 3-3 3h-.5c-.5 1.5-1.8 2.7-3.5 3v2.5h3c.6 0 1 .4 1 1s-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h3V14c-1.7-.3-3-1.5-3.5-3H6c-1.7 0-3-1.3-3-3V5.5C3 4.7 3.7 4 4.5 4H7V2zm0 4H4.5v2c0 .8.7 1.5 1.5 1.5h1V6zm12.5 0H17v3.5h1c.8 0 1.5-.7 1.5-1.5V6z" fill="#58a6ff" opacity="0.85"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">Open Source Award</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">GitHub Stars program · 2024-01</text>
</g>
<g transform="translate(16, 176)">
<rect width="348" height="48" rx="8" fill="#bc8cff" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#bc8cff" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<circle cx="12" cy="14" r="5" fill="#bc8cff" opacity="0.2"/>
<circle cx="12" cy="14" r="4" fill="none" stroke="#bc8cff" stroke-width="1.5"/>
<path d="M12 11.5l1 2 2.2.3-1.6 1.5.4 2.2-2-1-2 1 .4-2.2-1.6-1.5 2.2-.3z" fill="#bc8cff"/>
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="#bc8cff" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#d1d9e0">AWS Certified Solutions Architect</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Professional · 2023-09</text>
</g>
</g>
</svg>
<text x="210" y="1748" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895" opacity="0.5">Generated with gh-stats</text>
</svg>

After

Width:  |  Height:  |  Size: 38 KiB

+543
View File
@@ -0,0 +1,543 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="420" height="1756" viewBox="0 0 420 1756">
<rect width="420" height="1756" rx="16" fill="#1e2433"/>
<rect x="0.5" y="0.5" width="419" height="1755" rx="16"
fill="none" stroke="#3d4659" stroke-width="1"/>
<svg x="20" y="20" width="380" height="226" viewBox="0 0 380 226">
<defs>
<filter id="grade_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="grade_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="224" rx="10" ry="10"
fill="#2a3142" stroke="#3d4659" stroke-width="1" filter="url(#grade_shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#333d50" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#333d50" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#e5e9f0">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#8892a4"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4" letter-spacing="0.4">Score <tspan fill="#e5e9f0" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#333d50" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#8892a4" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#8892a4"/><line x1="7" y1="10" x2="7" y2="14" stroke="#8892a4" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#8892a4" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#e5e9f0">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#8892a4" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#8892a4" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#8892a4" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#e5e9f0">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#8892a4" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#e5e9f0">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#8892a4" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#8892a4" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#8892a4" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#8892a4" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#e5e9f0">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#8892a4" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#8892a4" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#8892a4" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#8892a4" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#e5e9f0">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#333d50" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#88c0d0" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#88c0d0" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#88c0d0">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#88c0d0" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#88c0d0" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#88c0d0">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#88c0d0" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#88c0d0" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#88c0d0">Systems</text>
</g>
<g transform="translate(177, 0)" opacity="0.9">
<rect width="51" height="24" rx="12" fill="#88c0d0" opacity="0.12"/>
<rect width="51" height="24" rx="12" fill="none" stroke="#88c0d0" stroke-width="1" opacity="0.3"/>
<text x="25" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#88c0d0">Cloud</text>
</g>
<g transform="translate(234, 0)" opacity="0.9">
<rect width="90" height="24" rx="12" fill="#facc15" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#facc15" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#facc15">Founder #42</text>
</g>
<g transform="translate(0, 30)" opacity="0.55">
<rect width="90" height="24" rx="12" fill="#88c0d0" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#88c0d0" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#88c0d0">Open source</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="262" width="380" height="200" viewBox="0 0 380 200">
<defs>
<filter id="impact_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="impact_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="198" rx="10" ry="10"
fill="#2a3142" stroke="#3d4659" stroke-width="1" filter="url(#impact_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#8892a4" letter-spacing="0.8" opacity="0.7">IMPACT TIMELINE</text>
<g transform="translate(0, 36)">
<defs>
<linearGradient id="impact_areaGrad" x1="0" y1="8" x2="0" y2="90" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#88c0d0" stop-opacity="0.35"/>
<stop offset="100%" stop-color="#88c0d0" stop-opacity="0.02"/>
</linearGradient>
</defs>
<text x="34" y="12.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#8892a4">41</text><line x1="40" y1="8.0" x2="356" y2="8.0" stroke="#333d50" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="53.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#8892a4">20</text><line x1="40" y1="49.0" x2="356" y2="49.0" stroke="#333d50" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="94.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#8892a4">0</text><line x1="40" y1="90.0" x2="356" y2="90.0" stroke="#333d50" stroke-width="0.5" stroke-dasharray="3,3"/>
<text x="40.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#8892a4">2025-10</text><text x="204.3" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#8892a4">2026-01</text><text x="356.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#8892a4">2026-04</text>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0 L 356.0 90 L 40.0 90 Z" fill="url(#impact_areaGrad)"/>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0" fill="none" stroke="#88c0d0" stroke-width="2" stroke-linecap="round"/>
<g transform="translate(20, 136)">
<text x="0" y="0" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="700" fill="#e5e9f0">577</text>
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">commits over 6mo</text>
</g>
</g>
</svg>
<svg x="20" y="478" width="380" height="170" viewBox="0 0 380 170">
<defs>
<filter id="streaks_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="streaks_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#2a3142" stroke="#3d4659" stroke-width="1" filter="url(#streaks_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#8892a4" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#8892a4">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#88c0d0">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#8892a4">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#e5e9f0">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#3d4659" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#333d50"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#88c0d0"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#88c0d0"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">Sep 13 – Nov 12, 2025</text>
</g>
</svg>
<svg x="20" y="664" width="380" height="298" viewBox="0 0 380 298">
<defs>
<filter id="collaborators_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="collaborators_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="296" rx="10" ry="10"
fill="#2a3142" stroke="#3d4659" stroke-width="1" filter="url(#collaborators_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#8892a4" letter-spacing="0.8" opacity="0.7">TOP COLLABORATORS</text>
<g transform="translate(0, 36)">
<g transform="translate(36, 20)">
<circle cx="0" cy="0" r="18" fill="hsl(285, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">torvalds</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">4 repos · 142 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#333d50"/>
<rect x="200" y="-6" width="120.0" height="8" rx="4" fill="#b48ead" opacity="0.8">
<animate attributeName="width" from="0" to="120.0" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 70)">
<circle cx="0" cy="0" r="18" fill="hsl(165, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">G</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">gaearon</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">3 repos · 98 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#333d50"/>
<rect x="200" y="-6" width="82.8169014084507" height="8" rx="4" fill="#b48ead" opacity="0.8">
<animate attributeName="width" from="0" to="82.8169014084507" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 120)">
<circle cx="0" cy="0" r="18" fill="hsl(238, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">S</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">sindresorhus</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">2 repos · 64 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#333d50"/>
<rect x="200" y="-6" width="54.08450704225352" height="8" rx="4" fill="#b48ead" opacity="0.8">
<animate attributeName="width" from="0" to="54.08450704225352" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 170)">
<circle cx="0" cy="0" r="18" fill="hsl(157, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">tj</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">2 repos · 47 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#333d50"/>
<rect x="200" y="-6" width="39.71830985915493" height="8" rx="4" fill="#b48ead" opacity="0.8">
<animate attributeName="width" from="0" to="39.71830985915493" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 220)">
<circle cx="0" cy="0" r="18" fill="hsl(231, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">Y</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">yyx990803</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">1 repos · 31 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#333d50"/>
<rect x="200" y="-6" width="26.197183098591548" height="8" rx="4" fill="#b48ead" opacity="0.8">
<animate attributeName="width" from="0" to="26.197183098591548" dur="0.6s" fill="freeze"/>
</rect>
</g>
</g>
</svg>
<svg x="20" y="978" width="380" height="234" viewBox="0 0 380 234">
<defs>
<filter id="focus_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="focus_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="232" rx="10" ry="10"
fill="#2a3142" stroke="#3d4659" stroke-width="1" filter="url(#focus_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#8892a4" letter-spacing="0.8" opacity="0.7">RECENT FOCUS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#e5e9f0">Backend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#333d50"/>
<rect x="90" y="4" width="210.0" height="14" rx="7" fill="#58a6ff" opacity="0.8">
<animate attributeName="width" from="0" to="210.0" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">412 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#58a6ff">38%</text>
</g>
<g transform="translate(16, 36)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#e5e9f0">ML</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#333d50"/>
<rect x="90" y="4" width="132.6315789473684" height="14" rx="7" fill="#3fb950" opacity="0.8">
<animate attributeName="width" from="0" to="132.6315789473684" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">260 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#3fb950">24%</text>
</g>
<g transform="translate(16, 72)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#e5e9f0">Frontend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#333d50"/>
<rect x="90" y="4" width="99.47368421052632" height="14" rx="7" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="99.47368421052632" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">195 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#bc8cff">18%</text>
</g>
<g transform="translate(16, 108)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#e5e9f0">DevOps</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#333d50"/>
<rect x="90" y="4" width="66.3157894736842" height="14" rx="7" fill="#d29922" opacity="0.8">
<animate attributeName="width" from="0" to="66.3157894736842" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">130 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#d29922">12%</text>
</g>
<g transform="translate(16, 144)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#e5e9f0">Cloud</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#333d50"/>
<rect x="90" y="4" width="44.21052631578947" height="14" rx="7" fill="#f0883e" opacity="0.8">
<animate attributeName="width" from="0" to="44.21052631578947" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4">87 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#f0883e">8%</text>
</g>
<text x="16" y="188" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4" opacity="0.7">Recent activity · last year</text>
</g>
</svg>
<svg x="20" y="1228" width="380" height="208" viewBox="0 0 380 208">
<defs>
<filter id="languages_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="languages_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="206" rx="10" ry="10"
fill="#2a3142" stroke="#3d4659" stroke-width="1" filter="url(#languages_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#8892a4" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="113.3 163.1" stroke-dashoffset="0.0"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="63.6 212.9" stroke-dashoffset="-113.3"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="163.1" to="-113.3" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="41.5 235.0" stroke-dashoffset="-176.9"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="99.5" to="-176.9" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="30.4 246.0" stroke-dashoffset="-218.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="58.1" to="-218.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#89e051" stroke-width="16"
stroke-dasharray="16.6 259.9" stroke-dashoffset="-248.8"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="27.6" to="-248.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#8892a4" stroke-width="16"
stroke-dasharray="11.1 265.4" stroke-dashoffset="-265.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="11.1" to="-265.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="28" fill="#2a3142"/>
<text x="60" y="87.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#e5e9f0">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#e5e9f0">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#8892a4">41%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#e5e9f0">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#8892a4">23%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#e5e9f0">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#8892a4">15%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#e5e9f0">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#8892a4">11%</text>
</g>
<g transform="translate(140, 108)">
<rect width="10" height="10" rx="2" fill="#89e051"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#e5e9f0">Shell</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#8892a4">6%</text>
</g>
<g transform="translate(140, 130)">
<rect width="10" height="10" rx="2" fill="#8892a4"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#e5e9f0">Other</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#8892a4">4%</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="1452" width="380" height="274" viewBox="0 0 380 274">
<defs>
<filter id="achievements_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="achievements_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="272" rx="10" ry="10"
fill="#2a3142" stroke="#3d4659" stroke-width="1" filter="url(#achievements_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#8892a4" letter-spacing="0.8" opacity="0.7">ACHIEVEMENTS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 8)">
<rect width="348" height="48" rx="8" fill="#ebcb8b" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#ebcb8b" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="#ebcb8b" stroke-width="1.5"/>
<rect x="3" y="16" width="18" height="1.5" rx="0.5" fill="#ebcb8b" opacity="0.85"/>
<path d="M9 9l-2 3 2 3m6-6l2 3-2 3" stroke="#ebcb8b" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">Hackathon winner</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">Y Combinator AI Hackathon · 2025-11</text>
</g>
<g transform="translate(16, 64)">
<rect width="348" height="48" rx="8" fill="#a3be8c" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#a3be8c" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="#a3be8c" stroke-width="1.5" stroke-linejoin="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">Speaker at PyCon</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">Async at scale · 2024-05</text>
</g>
<g transform="translate(16, 120)">
<rect width="348" height="48" rx="8" fill="#88c0d0" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#88c0d0" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M7 2h10v2h2.5c.8 0 1.5.7 1.5 1.5V8c0 1.7-1.3 3-3 3h-.5c-.5 1.5-1.8 2.7-3.5 3v2.5h3c.6 0 1 .4 1 1s-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h3V14c-1.7-.3-3-1.5-3.5-3H6c-1.7 0-3-1.3-3-3V5.5C3 4.7 3.7 4 4.5 4H7V2zm0 4H4.5v2c0 .8.7 1.5 1.5 1.5h1V6zm12.5 0H17v3.5h1c.8 0 1.5-.7 1.5-1.5V6z" fill="#88c0d0" opacity="0.85"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">Open Source Award</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">GitHub Stars program · 2024-01</text>
</g>
<g transform="translate(16, 176)">
<rect width="348" height="48" rx="8" fill="#b48ead" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#b48ead" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<circle cx="12" cy="14" r="5" fill="#b48ead" opacity="0.2"/>
<circle cx="12" cy="14" r="4" fill="none" stroke="#b48ead" stroke-width="1.5"/>
<path d="M12 11.5l1 2 2.2.3-1.6 1.5.4 2.2-2-1-2 1 .4-2.2-1.6-1.5 2.2-.3z" fill="#b48ead"/>
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="#b48ead" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#e5e9f0">AWS Certified Solutions Architect</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#8892a4">Professional · 2023-09</text>
</g>
</g>
</svg>
<text x="210" y="1748" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#8892a4" opacity="0.5">Generated with gh-stats</text>
</svg>

After

Width:  |  Height:  |  Size: 38 KiB

+543
View File
@@ -0,0 +1,543 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="420" height="1756" viewBox="0 0 420 1756">
<rect width="420" height="1756" rx="16" fill="#09090b"/>
<rect x="0.5" y="0.5" width="419" height="1755" rx="16"
fill="none" stroke="#27272a" stroke-width="1"/>
<svg x="20" y="20" width="380" height="226" viewBox="0 0 380 226">
<defs>
<filter id="grade_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="grade_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="224" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#grade_shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#27272a" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#27272a" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#fafafa">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#a1a1aa"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa" letter-spacing="0.4">Score <tspan fill="#fafafa" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#27272a" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#a1a1aa" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#a1a1aa"/><line x1="7" y1="10" x2="7" y2="14" stroke="#a1a1aa" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#a1a1aa" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#a1a1aa" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#a1a1aa" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#a1a1aa" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#a1a1aa" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#a1a1aa" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#a1a1aa" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#a1a1aa" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#a1a1aa" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#fafafa">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#27272a" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Systems</text>
</g>
<g transform="translate(177, 0)" opacity="0.9">
<rect width="51" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="51" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="25" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Cloud</text>
</g>
<g transform="translate(234, 0)" opacity="0.9">
<rect width="90" height="24" rx="12" fill="#facc15" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#facc15" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#facc15">Founder #42</text>
</g>
<g transform="translate(0, 30)" opacity="0.55">
<rect width="90" height="24" rx="12" fill="#a78bfa" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#a78bfa">Open source</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="262" width="380" height="200" viewBox="0 0 380 200">
<defs>
<filter id="impact_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="impact_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="198" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#impact_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">IMPACT TIMELINE</text>
<g transform="translate(0, 36)">
<defs>
<linearGradient id="impact_areaGrad" x1="0" y1="8" x2="0" y2="90" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#a78bfa" stop-opacity="0.35"/>
<stop offset="100%" stop-color="#a78bfa" stop-opacity="0.02"/>
</linearGradient>
</defs>
<text x="34" y="12.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#a1a1aa">41</text><line x1="40" y1="8.0" x2="356" y2="8.0" stroke="#27272a" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="53.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#a1a1aa">20</text><line x1="40" y1="49.0" x2="356" y2="49.0" stroke="#27272a" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="94.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#a1a1aa">0</text><line x1="40" y1="90.0" x2="356" y2="90.0" stroke="#27272a" stroke-width="0.5" stroke-dasharray="3,3"/>
<text x="40.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#a1a1aa">2025-10</text><text x="204.3" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#a1a1aa">2026-01</text><text x="356.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#a1a1aa">2026-04</text>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0 L 356.0 90 L 40.0 90 Z" fill="url(#impact_areaGrad)"/>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0" fill="none" stroke="#a78bfa" stroke-width="2" stroke-linecap="round"/>
<g transform="translate(20, 136)">
<text x="0" y="0" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="700" fill="#fafafa">577</text>
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">commits over 6mo</text>
</g>
</g>
</svg>
<svg x="20" y="478" width="380" height="170" viewBox="0 0 380 170">
<defs>
<filter id="streaks_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="streaks_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#streaks_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#a1a1aa">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#a78bfa">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#a1a1aa">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#fafafa">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#27272a" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#27272a"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#a78bfa"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#a78bfa"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">Sep 13 – Nov 12, 2025</text>
</g>
</svg>
<svg x="20" y="664" width="380" height="298" viewBox="0 0 380 298">
<defs>
<filter id="collaborators_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="collaborators_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="296" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#collaborators_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">TOP COLLABORATORS</text>
<g transform="translate(0, 36)">
<g transform="translate(36, 20)">
<circle cx="0" cy="0" r="18" fill="hsl(285, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">torvalds</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">4 repos · 142 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#27272a"/>
<rect x="200" y="-6" width="120.0" height="8" rx="4" fill="#c084fc" opacity="0.8">
<animate attributeName="width" from="0" to="120.0" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 70)">
<circle cx="0" cy="0" r="18" fill="hsl(165, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">G</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">gaearon</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">3 repos · 98 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#27272a"/>
<rect x="200" y="-6" width="82.8169014084507" height="8" rx="4" fill="#c084fc" opacity="0.8">
<animate attributeName="width" from="0" to="82.8169014084507" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 120)">
<circle cx="0" cy="0" r="18" fill="hsl(238, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">S</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">sindresorhus</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">2 repos · 64 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#27272a"/>
<rect x="200" y="-6" width="54.08450704225352" height="8" rx="4" fill="#c084fc" opacity="0.8">
<animate attributeName="width" from="0" to="54.08450704225352" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 170)">
<circle cx="0" cy="0" r="18" fill="hsl(157, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">tj</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">2 repos · 47 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#27272a"/>
<rect x="200" y="-6" width="39.71830985915493" height="8" rx="4" fill="#c084fc" opacity="0.8">
<animate attributeName="width" from="0" to="39.71830985915493" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 220)">
<circle cx="0" cy="0" r="18" fill="hsl(231, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">Y</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">yyx990803</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">1 repos · 31 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#27272a"/>
<rect x="200" y="-6" width="26.197183098591548" height="8" rx="4" fill="#c084fc" opacity="0.8">
<animate attributeName="width" from="0" to="26.197183098591548" dur="0.6s" fill="freeze"/>
</rect>
</g>
</g>
</svg>
<svg x="20" y="978" width="380" height="234" viewBox="0 0 380 234">
<defs>
<filter id="focus_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="focus_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="232" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#focus_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">RECENT FOCUS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#fafafa">Backend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#27272a"/>
<rect x="90" y="4" width="210.0" height="14" rx="7" fill="#58a6ff" opacity="0.8">
<animate attributeName="width" from="0" to="210.0" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">412 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#58a6ff">38%</text>
</g>
<g transform="translate(16, 36)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#fafafa">ML</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#27272a"/>
<rect x="90" y="4" width="132.6315789473684" height="14" rx="7" fill="#3fb950" opacity="0.8">
<animate attributeName="width" from="0" to="132.6315789473684" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">260 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#3fb950">24%</text>
</g>
<g transform="translate(16, 72)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#fafafa">Frontend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#27272a"/>
<rect x="90" y="4" width="99.47368421052632" height="14" rx="7" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="99.47368421052632" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">195 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#bc8cff">18%</text>
</g>
<g transform="translate(16, 108)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#fafafa">DevOps</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#27272a"/>
<rect x="90" y="4" width="66.3157894736842" height="14" rx="7" fill="#d29922" opacity="0.8">
<animate attributeName="width" from="0" to="66.3157894736842" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">130 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#d29922">12%</text>
</g>
<g transform="translate(16, 144)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#fafafa">Cloud</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#27272a"/>
<rect x="90" y="4" width="44.21052631578947" height="14" rx="7" fill="#f0883e" opacity="0.8">
<animate attributeName="width" from="0" to="44.21052631578947" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa">87 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#f0883e">8%</text>
</g>
<text x="16" y="188" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa" opacity="0.7">Recent activity · last year</text>
</g>
</svg>
<svg x="20" y="1228" width="380" height="208" viewBox="0 0 380 208">
<defs>
<filter id="languages_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="languages_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="206" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#languages_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="113.3 163.1" stroke-dashoffset="0.0"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="63.6 212.9" stroke-dashoffset="-113.3"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="163.1" to="-113.3" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="41.5 235.0" stroke-dashoffset="-176.9"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="99.5" to="-176.9" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="30.4 246.0" stroke-dashoffset="-218.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="58.1" to="-218.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#89e051" stroke-width="16"
stroke-dasharray="16.6 259.9" stroke-dashoffset="-248.8"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="27.6" to="-248.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#a1a1aa" stroke-width="16"
stroke-dasharray="11.1 265.4" stroke-dashoffset="-265.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="11.1" to="-265.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="28" fill="#18181b"/>
<text x="60" y="87.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#fafafa">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">41%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">23%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">15%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">11%</text>
</g>
<g transform="translate(140, 108)">
<rect width="10" height="10" rx="2" fill="#89e051"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Shell</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">6%</text>
</g>
<g transform="translate(140, 130)">
<rect width="10" height="10" rx="2" fill="#a1a1aa"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#fafafa">Other</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#a1a1aa">4%</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="1452" width="380" height="274" viewBox="0 0 380 274">
<defs>
<filter id="achievements_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="achievements_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="272" rx="10" ry="10"
fill="#18181b" stroke="#27272a" stroke-width="1" filter="url(#achievements_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#a1a1aa" letter-spacing="0.8" opacity="0.7">ACHIEVEMENTS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 8)">
<rect width="348" height="48" rx="8" fill="#fb923c" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#fb923c" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="#fb923c" stroke-width="1.5"/>
<rect x="3" y="16" width="18" height="1.5" rx="0.5" fill="#fb923c" opacity="0.85"/>
<path d="M9 9l-2 3 2 3m6-6l2 3-2 3" stroke="#fb923c" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">Hackathon winner</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">Y Combinator AI Hackathon · 2025-11</text>
</g>
<g transform="translate(16, 64)">
<rect width="348" height="48" rx="8" fill="#4ade80" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#4ade80" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="#4ade80" stroke-width="1.5" stroke-linejoin="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">Speaker at PyCon</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">Async at scale · 2024-05</text>
</g>
<g transform="translate(16, 120)">
<rect width="348" height="48" rx="8" fill="#a78bfa" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#a78bfa" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M7 2h10v2h2.5c.8 0 1.5.7 1.5 1.5V8c0 1.7-1.3 3-3 3h-.5c-.5 1.5-1.8 2.7-3.5 3v2.5h3c.6 0 1 .4 1 1s-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h3V14c-1.7-.3-3-1.5-3.5-3H6c-1.7 0-3-1.3-3-3V5.5C3 4.7 3.7 4 4.5 4H7V2zm0 4H4.5v2c0 .8.7 1.5 1.5 1.5h1V6zm12.5 0H17v3.5h1c.8 0 1.5-.7 1.5-1.5V6z" fill="#a78bfa" opacity="0.85"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">Open Source Award</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">GitHub Stars program · 2024-01</text>
</g>
<g transform="translate(16, 176)">
<rect width="348" height="48" rx="8" fill="#c084fc" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#c084fc" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<circle cx="12" cy="14" r="5" fill="#c084fc" opacity="0.2"/>
<circle cx="12" cy="14" r="4" fill="none" stroke="#c084fc" stroke-width="1.5"/>
<path d="M12 11.5l1 2 2.2.3-1.6 1.5.4 2.2-2-1-2 1 .4-2.2-1.6-1.5 2.2-.3z" fill="#c084fc"/>
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="#c084fc" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#fafafa">AWS Certified Solutions Architect</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#a1a1aa">Professional · 2023-09</text>
</g>
</g>
</svg>
<text x="210" y="1748" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#a1a1aa" opacity="0.5">Generated with gh-stats</text>
</svg>

After

Width:  |  Height:  |  Size: 38 KiB

+543
View File
@@ -0,0 +1,543 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="420" height="1756" viewBox="0 0 420 1756">
<rect width="420" height="1756" rx="16" fill="#faf8f5"/>
<rect x="0.5" y="0.5" width="419" height="1755" rx="16"
fill="none" stroke="#e0d8cf" stroke-width="1"/>
<svg x="20" y="20" width="380" height="226" viewBox="0 0 380 226">
<defs>
<filter id="grade_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="grade_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="224" rx="10" ry="10"
fill="#f5f0eb" stroke="#e0d8cf" stroke-width="1" filter="url(#grade_shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#ebe5dd" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#ebe5dd" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#3d3529">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#7a7062"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062" letter-spacing="0.4">Score <tspan fill="#3d3529" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#ebe5dd" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#7a7062" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#7a7062"/><line x1="7" y1="10" x2="7" y2="14" stroke="#7a7062" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#7a7062" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#3d3529">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#7a7062" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#7a7062" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#7a7062" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#3d3529">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#7a7062" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#3d3529">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#7a7062" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#7a7062" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#7a7062" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#7a7062" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#3d3529">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#7a7062" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#7a7062" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#7a7062" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#7a7062" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#3d3529">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#ebe5dd" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#b45309" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#b45309" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#b45309">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#b45309" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#b45309" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#b45309">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#b45309" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#b45309" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#b45309">Systems</text>
</g>
<g transform="translate(177, 0)" opacity="0.9">
<rect width="51" height="24" rx="12" fill="#b45309" opacity="0.12"/>
<rect width="51" height="24" rx="12" fill="none" stroke="#b45309" stroke-width="1" opacity="0.3"/>
<text x="25" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#b45309">Cloud</text>
</g>
<g transform="translate(234, 0)" opacity="0.9">
<rect width="90" height="24" rx="12" fill="#facc15" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#facc15" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#facc15">Founder #42</text>
</g>
<g transform="translate(0, 30)" opacity="0.55">
<rect width="90" height="24" rx="12" fill="#b45309" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#b45309" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#b45309">Open source</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="262" width="380" height="200" viewBox="0 0 380 200">
<defs>
<filter id="impact_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="impact_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="198" rx="10" ry="10"
fill="#f5f0eb" stroke="#e0d8cf" stroke-width="1" filter="url(#impact_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7a7062" letter-spacing="0.8" opacity="0.7">IMPACT TIMELINE</text>
<g transform="translate(0, 36)">
<defs>
<linearGradient id="impact_areaGrad" x1="0" y1="8" x2="0" y2="90" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#b45309" stop-opacity="0.35"/>
<stop offset="100%" stop-color="#b45309" stop-opacity="0.02"/>
</linearGradient>
</defs>
<text x="34" y="12.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7a7062">41</text><line x1="40" y1="8.0" x2="356" y2="8.0" stroke="#ebe5dd" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="53.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7a7062">20</text><line x1="40" y1="49.0" x2="356" y2="49.0" stroke="#ebe5dd" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="94.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7a7062">0</text><line x1="40" y1="90.0" x2="356" y2="90.0" stroke="#ebe5dd" stroke-width="0.5" stroke-dasharray="3,3"/>
<text x="40.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7a7062">2025-10</text><text x="204.3" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7a7062">2026-01</text><text x="356.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7a7062">2026-04</text>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0 L 356.0 90 L 40.0 90 Z" fill="url(#impact_areaGrad)"/>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0" fill="none" stroke="#b45309" stroke-width="2" stroke-linecap="round"/>
<g transform="translate(20, 136)">
<text x="0" y="0" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="700" fill="#3d3529">577</text>
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">commits over 6mo</text>
</g>
</g>
</svg>
<svg x="20" y="478" width="380" height="170" viewBox="0 0 380 170">
<defs>
<filter id="streaks_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="streaks_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#f5f0eb" stroke="#e0d8cf" stroke-width="1" filter="url(#streaks_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7a7062" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7a7062">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#b45309">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7a7062">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#3d3529">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#e0d8cf" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#ebe5dd"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#b45309"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#b45309"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">Sep 13 – Nov 12, 2025</text>
</g>
</svg>
<svg x="20" y="664" width="380" height="298" viewBox="0 0 380 298">
<defs>
<filter id="collaborators_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="collaborators_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="296" rx="10" ry="10"
fill="#f5f0eb" stroke="#e0d8cf" stroke-width="1" filter="url(#collaborators_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7a7062" letter-spacing="0.8" opacity="0.7">TOP COLLABORATORS</text>
<g transform="translate(0, 36)">
<g transform="translate(36, 20)">
<circle cx="0" cy="0" r="18" fill="hsl(285, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">torvalds</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">4 repos · 142 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#ebe5dd"/>
<rect x="200" y="-6" width="120.0" height="8" rx="4" fill="#7e22ce" opacity="0.8">
<animate attributeName="width" from="0" to="120.0" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 70)">
<circle cx="0" cy="0" r="18" fill="hsl(165, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">G</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">gaearon</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">3 repos · 98 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#ebe5dd"/>
<rect x="200" y="-6" width="82.8169014084507" height="8" rx="4" fill="#7e22ce" opacity="0.8">
<animate attributeName="width" from="0" to="82.8169014084507" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 120)">
<circle cx="0" cy="0" r="18" fill="hsl(238, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">S</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">sindresorhus</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">2 repos · 64 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#ebe5dd"/>
<rect x="200" y="-6" width="54.08450704225352" height="8" rx="4" fill="#7e22ce" opacity="0.8">
<animate attributeName="width" from="0" to="54.08450704225352" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 170)">
<circle cx="0" cy="0" r="18" fill="hsl(157, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">T</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">tj</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">2 repos · 47 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#ebe5dd"/>
<rect x="200" y="-6" width="39.71830985915493" height="8" rx="4" fill="#7e22ce" opacity="0.8">
<animate attributeName="width" from="0" to="39.71830985915493" dur="0.6s" fill="freeze"/>
</rect>
</g>
<g transform="translate(36, 220)">
<circle cx="0" cy="0" r="18" fill="hsl(231, 50%, 40%)"/>
<text x="0" y="1" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="600" fill="white">Y</text>
<text x="28" y="-2" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">yyx990803</text>
<text x="28" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">1 repos · 31 commits</text>
<rect x="200" y="-6" width="130" height="8" rx="4" fill="#ebe5dd"/>
<rect x="200" y="-6" width="26.197183098591548" height="8" rx="4" fill="#7e22ce" opacity="0.8">
<animate attributeName="width" from="0" to="26.197183098591548" dur="0.6s" fill="freeze"/>
</rect>
</g>
</g>
</svg>
<svg x="20" y="978" width="380" height="234" viewBox="0 0 380 234">
<defs>
<filter id="focus_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="focus_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="232" rx="10" ry="10"
fill="#f5f0eb" stroke="#e0d8cf" stroke-width="1" filter="url(#focus_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7a7062" letter-spacing="0.8" opacity="0.7">RECENT FOCUS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#3d3529">Backend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#ebe5dd"/>
<rect x="90" y="4" width="210.0" height="14" rx="7" fill="#58a6ff" opacity="0.8">
<animate attributeName="width" from="0" to="210.0" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">412 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#58a6ff">38%</text>
</g>
<g transform="translate(16, 36)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#3d3529">ML</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#ebe5dd"/>
<rect x="90" y="4" width="132.6315789473684" height="14" rx="7" fill="#3fb950" opacity="0.8">
<animate attributeName="width" from="0" to="132.6315789473684" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">260 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#3fb950">24%</text>
</g>
<g transform="translate(16, 72)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#3d3529">Frontend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#ebe5dd"/>
<rect x="90" y="4" width="99.47368421052632" height="14" rx="7" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="99.47368421052632" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">195 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#bc8cff">18%</text>
</g>
<g transform="translate(16, 108)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#3d3529">DevOps</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#ebe5dd"/>
<rect x="90" y="4" width="66.3157894736842" height="14" rx="7" fill="#d29922" opacity="0.8">
<animate attributeName="width" from="0" to="66.3157894736842" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">130 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#d29922">12%</text>
</g>
<g transform="translate(16, 144)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#3d3529">Cloud</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#ebe5dd"/>
<rect x="90" y="4" width="44.21052631578947" height="14" rx="7" fill="#f0883e" opacity="0.8">
<animate attributeName="width" from="0" to="44.21052631578947" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062">87 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#f0883e">8%</text>
</g>
<text x="16" y="188" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062" opacity="0.7">Recent activity · last year</text>
</g>
</svg>
<svg x="20" y="1228" width="380" height="208" viewBox="0 0 380 208">
<defs>
<filter id="languages_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="languages_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="206" rx="10" ry="10"
fill="#f5f0eb" stroke="#e0d8cf" stroke-width="1" filter="url(#languages_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7a7062" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="113.3 163.1" stroke-dashoffset="0.0"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="63.6 212.9" stroke-dashoffset="-113.3"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="163.1" to="-113.3" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="41.5 235.0" stroke-dashoffset="-176.9"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="99.5" to="-176.9" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="30.4 246.0" stroke-dashoffset="-218.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="58.1" to="-218.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#89e051" stroke-width="16"
stroke-dasharray="16.6 259.9" stroke-dashoffset="-248.8"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="27.6" to="-248.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#7a7062" stroke-width="16"
stroke-dasharray="11.1 265.4" stroke-dashoffset="-265.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="11.1" to="-265.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="28" fill="#f5f0eb"/>
<text x="60" y="87.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#3d3529">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#3d3529">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7a7062">41%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#3d3529">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7a7062">23%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#3d3529">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7a7062">15%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#3d3529">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7a7062">11%</text>
</g>
<g transform="translate(140, 108)">
<rect width="10" height="10" rx="2" fill="#89e051"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#3d3529">Shell</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7a7062">6%</text>
</g>
<g transform="translate(140, 130)">
<rect width="10" height="10" rx="2" fill="#7a7062"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#3d3529">Other</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7a7062">4%</text>
</g>
</g>
</g>
</svg>
<svg x="20" y="1452" width="380" height="274" viewBox="0 0 380 274">
<defs>
<filter id="achievements_shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="achievements_avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="272" rx="10" ry="10"
fill="#f5f0eb" stroke="#e0d8cf" stroke-width="1" filter="url(#achievements_shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7a7062" letter-spacing="0.8" opacity="0.7">ACHIEVEMENTS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 8)">
<rect width="348" height="48" rx="8" fill="#a16207" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#a16207" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="#a16207" stroke-width="1.5"/>
<rect x="3" y="16" width="18" height="1.5" rx="0.5" fill="#a16207" opacity="0.85"/>
<path d="M9 9l-2 3 2 3m6-6l2 3-2 3" stroke="#a16207" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">Hackathon winner</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">Y Combinator AI Hackathon · 2025-11</text>
</g>
<g transform="translate(16, 64)">
<rect width="348" height="48" rx="8" fill="#4d7c0f" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#4d7c0f" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="#4d7c0f" stroke-width="1.5" stroke-linejoin="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">Speaker at PyCon</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">Async at scale · 2024-05</text>
</g>
<g transform="translate(16, 120)">
<rect width="348" height="48" rx="8" fill="#b45309" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#b45309" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M7 2h10v2h2.5c.8 0 1.5.7 1.5 1.5V8c0 1.7-1.3 3-3 3h-.5c-.5 1.5-1.8 2.7-3.5 3v2.5h3c.6 0 1 .4 1 1s-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h3V14c-1.7-.3-3-1.5-3.5-3H6c-1.7 0-3-1.3-3-3V5.5C3 4.7 3.7 4 4.5 4H7V2zm0 4H4.5v2c0 .8.7 1.5 1.5 1.5h1V6zm12.5 0H17v3.5h1c.8 0 1.5-.7 1.5-1.5V6z" fill="#b45309" opacity="0.85"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">Open Source Award</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">GitHub Stars program · 2024-01</text>
</g>
<g transform="translate(16, 176)">
<rect width="348" height="48" rx="8" fill="#7e22ce" opacity="0.06"/>
<rect width="348" height="48" rx="8" fill="none" stroke="#7e22ce" stroke-width="0.5" opacity="0.3"/>
<g transform="translate(12, 12)">
<svg viewBox="0 0 24 24" width="24" height="24">
<circle cx="12" cy="14" r="5" fill="#7e22ce" opacity="0.2"/>
<circle cx="12" cy="14" r="4" fill="none" stroke="#7e22ce" stroke-width="1.5"/>
<path d="M12 11.5l1 2 2.2.3-1.6 1.5.4 2.2-2-1-2 1 .4-2.2-1.6-1.5 2.2-.3z" fill="#7e22ce"/>
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="#7e22ce" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>
</g>
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="#3d3529">AWS Certified Solutions Architect</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7a7062">Professional · 2023-09</text>
</g>
</g>
</svg>
<text x="210" y="1748" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7a7062" opacity="0.5">Generated with gh-stats</text>
</svg>

After

Width:  |  Height:  |  Size: 38 KiB

+76
View File
@@ -0,0 +1,76 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="234" viewBox="0 0 380 234" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="232" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">RECENT FOCUS</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">Backend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="210.0" height="14" rx="7" fill="#58a6ff" opacity="0.8">
<animate attributeName="width" from="0" to="210.0" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">412 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#58a6ff">38%</text>
</g>
<g transform="translate(16, 36)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">ML</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="132.6315789473684" height="14" rx="7" fill="#3fb950" opacity="0.8">
<animate attributeName="width" from="0" to="132.6315789473684" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">260 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#3fb950">24%</text>
</g>
<g transform="translate(16, 72)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">Frontend</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="99.47368421052632" height="14" rx="7" fill="#bc8cff" opacity="0.8">
<animate attributeName="width" from="0" to="99.47368421052632" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">195 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#bc8cff">18%</text>
</g>
<g transform="translate(16, 108)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">DevOps</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="66.3157894736842" height="14" rx="7" fill="#d29922" opacity="0.8">
<animate attributeName="width" from="0" to="66.3157894736842" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">130 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#d29922">12%</text>
</g>
<g transform="translate(16, 144)">
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="600" fill="#d1d9e0">Cloud</text>
<rect x="90" y="4" width="210" height="14" rx="7" fill="#1e2836"/>
<rect x="90" y="4" width="44.21052631578947" height="14" rx="7" fill="#f0883e" opacity="0.8">
<animate attributeName="width" from="0" to="44.21052631578947" dur="0.7s" fill="freeze"/>
</rect>
<text x="90" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">87 commits</text>
<text x="308" y="15" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" font-weight="700" fill="#f0883e">8%</text>
</g>
<text x="16" y="188" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895" opacity="0.7">Recent activity · last year</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

+95
View File
@@ -0,0 +1,95 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="192" viewBox="0 0 380 192" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="190" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#1e2836" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#1e2836" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#d1d9e0">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#7d8895"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895" letter-spacing="0.4">Score <tspan fill="#d1d9e0" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#1e2836" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#7d8895" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#7d8895"/><line x1="7" y1="10" x2="7" y2="14" stroke="#7d8895" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#7d8895" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#7d8895" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#7d8895" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#7d8895" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#7d8895" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#7d8895" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#7d8895" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#7d8895" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#7d8895" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#7d8895" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#7d8895" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#7d8895" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#7d8895" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#1e2836" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Systems</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

+113
View File
@@ -0,0 +1,113 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="226" viewBox="0 0 380 226" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="224" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<g transform="translate(0, 0)">
<g transform="translate(52, 48)">
<circle cx="0" cy="0" r="36" fill="none" stroke="#1e2836" stroke-width="5"/>
<circle cx="0" cy="0" r="36" fill="none" stroke="#3fb950" stroke-width="5"
stroke-dasharray="226.1946710584651" stroke-dashoffset="26.23858184278195"
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="226.1946710584651" to="26.23858184278195" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="10.50" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="30" font-weight="800" fill="#3fb950">A</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="#1e2836" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="#d1d9e0">Developer Profile</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="#7d8895"></text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895" letter-spacing="0.4">Score <tspan fill="#d1d9e0" font-weight="600">88</tspan> / 100</text>
</g>
<line x1="20" y1="96" x2="360" y2="96" stroke="#1e2836" stroke-width="0.5"/>
<g transform="translate(20, 100)">
<g transform="translate(34.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="7" cy="7" r="3" fill="none" stroke="#7d8895" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="#7d8895"/><line x1="7" y1="10" x2="7" y2="14" stroke="#7d8895" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="#7d8895" stroke-width="1.4"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">1,423</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Commits</text>
</g>
<g transform="translate(102.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="4" cy="4" r="2" fill="none" stroke="#7d8895" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="#7d8895" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="#7d8895" stroke-width="1.2"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">87</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">PRs</text>
</g>
<g transform="translate(170.0, 0)">
<g transform="translate(-7, 0)"><g><path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="#7d8895" stroke-width="1.2" stroke-linejoin="round"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">342</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Stars</text>
</g>
<g transform="translate(238.0, 0)">
<g transform="translate(-7, 0)"><g><rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="#7d8895" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="#7d8895" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="#7d8895" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="#7d8895" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">28</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Repos</text>
</g>
<g transform="translate(306.0, 0)">
<g transform="translate(-7, 0)"><g><circle cx="5" cy="4" r="2.5" fill="none" stroke="#7d8895" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="#7d8895" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="#7d8895" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="#7d8895" stroke-width="1"/></g></g>
<text x="0" y="28" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="14" font-weight="700" fill="#d1d9e0">156</text>
<text x="0" y="41" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">Followers</text>
</g>
</g>
<line x1="20" y1="148" x2="360" y2="148" stroke="#1e2836" stroke-width="0.5"/>
<g transform="translate(20, 154)">
<g transform="translate(0, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Backend</text>
</g>
<g transform="translate(70, 0)" opacity="0.9">
<rect width="31" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="31" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="15" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">ML</text>
</g>
<g transform="translate(107, 0)" opacity="0.9">
<rect width="64" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="64" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="32" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Systems</text>
</g>
<g transform="translate(177, 0)" opacity="0.9">
<rect width="51" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="51" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="25" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Cloud</text>
</g>
<g transform="translate(234, 0)" opacity="0.9">
<rect width="90" height="24" rx="12" fill="#facc15" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#facc15" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#facc15">Founder #42</text>
</g>
<g transform="translate(0, 30)" opacity="0.55">
<rect width="90" height="24" rx="12" fill="#58a6ff" opacity="0.12"/>
<rect width="90" height="24" rx="12" fill="none" stroke="#58a6ff" stroke-width="1" opacity="0.3"/>
<text x="45" y="16" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="500" fill="#58a6ff">Open source</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

+30
View File
@@ -0,0 +1,30 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="200" viewBox="0 0 380 200" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="198" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">IMPACT TIMELINE</text>
<g transform="translate(0, 36)">
<defs>
<linearGradient id="areaGrad" x1="0" y1="8" x2="0" y2="90" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#a78bfa" stop-opacity="0.35"/>
<stop offset="100%" stop-color="#a78bfa" stop-opacity="0.02"/>
</linearGradient>
</defs>
<text x="34" y="12.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">41</text><line x1="40" y1="8.0" x2="356" y2="8.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="53.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">20</text><line x1="40" y1="49.0" x2="356" y2="49.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="94.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">0</text><line x1="40" y1="90.0" x2="356" y2="90.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/>
<text x="40.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2025-10</text><text x="204.3" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2026-01</text><text x="356.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2026-04</text>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0 L 356.0 90 L 40.0 90 Z" fill="url(#areaGrad)"/>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0" fill="none" stroke="#a78bfa" stroke-width="2" stroke-linecap="round"/>
<g transform="translate(20, 136)">
<text x="0" y="0" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="700" fill="#d1d9e0">577</text>
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">commits over 6mo</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

+30
View File
@@ -0,0 +1,30 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="200" viewBox="0 0 380 200" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="198" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">IMPACT TIMELINE</text>
<g transform="translate(0, 36)">
<defs>
<linearGradient id="areaGrad" x1="0" y1="8" x2="0" y2="90" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#58a6ff" stop-opacity="0.35"/>
<stop offset="100%" stop-color="#58a6ff" stop-opacity="0.02"/>
</linearGradient>
</defs>
<text x="34" y="12.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">41</text><line x1="40" y1="8.0" x2="356" y2="8.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="53.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">20</text><line x1="40" y1="49.0" x2="356" y2="49.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/><text x="34" y="94.0" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">0</text><line x1="40" y1="90.0" x2="356" y2="90.0" stroke="#1e2836" stroke-width="0.5" stroke-dasharray="3,3"/>
<text x="40.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2025-10</text><text x="204.3" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2026-01</text><text x="356.0" y="104" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" font-size="9" fill="#7d8895">2026-04</text>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0 L 356.0 90 L 40.0 90 Z" fill="url(#areaGrad)"/>
<path d="M 40.0 84.0 C 46.3 84.0, 46.3 80.0, 52.6 80.0 C 59.0 80.0, 59.0 74.0, 65.3 74.0 C 71.6 74.0, 71.6 78.0, 77.9 78.0 C 84.2 78.0, 84.2 68.0, 90.6 68.0 C 96.9 68.0, 96.9 62.0, 103.2 62.0 C 109.5 62.0, 109.5 72.0, 115.8 72.0 C 122.2 72.0, 122.2 66.0, 128.5 66.0 C 134.8 66.0, 134.8 54.0, 141.1 54.0 C 147.4 54.0, 147.4 46.0, 153.8 46.0 C 160.1 46.0, 160.1 56.0, 166.4 56.0 C 172.7 56.0, 172.7 52.0, 179.0 52.0 C 185.4 52.0, 185.4 40.0, 191.7 40.0 C 198.0 40.0, 198.0 48.0, 204.3 48.0 C 210.6 48.0, 210.6 34.0, 217.0 34.0 C 223.3 34.0, 223.3 26.0, 229.6 26.0 C 235.9 26.0, 235.9 38.0, 242.2 38.0 C 248.6 38.0, 248.6 42.0, 254.9 42.0 C 261.2 42.0, 261.2 30.0, 267.5 30.0 C 273.8 30.0, 273.8 20.0, 280.2 20.0 C 286.5 20.0, 286.5 32.0, 292.8 32.0 C 299.1 32.0, 299.1 24.0, 305.4 24.0 C 311.8 24.0, 311.8 8.0, 318.1 8.0 C 324.4 8.0, 324.4 14.0, 330.7 14.0 C 337.0 14.0, 337.0 22.0, 343.4 22.0 C 349.7 22.0, 349.7 16.0, 356.0 16.0" fill="none" stroke="#58a6ff" stroke-width="2" stroke-linecap="round"/>
<g transform="translate(20, 136)">
<text x="0" y="0" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="700" fill="#d1d9e0">577</text>
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="#7d8895">commits over 6mo</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

+71
View File
@@ -0,0 +1,71 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="164" viewBox="0 0 380 164" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="162" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="64.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="126.1 150.4" stroke-dashoffset="0.0"
transform="rotate(-90 60 64.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="64.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="70.8 205.7" stroke-dashoffset="-126.1"
transform="rotate(-90 60 64.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="150.4" to="-126.1" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="64.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="46.2 230.3" stroke-dashoffset="-196.8"
transform="rotate(-90 60 64.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="79.6" to="-196.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="64.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="33.7 242.7" stroke-dashoffset="-243.0"
transform="rotate(-90 60 64.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="33.5" to="-243.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="64.0" r="28" fill="#1a2230"/>
<text x="60" y="65.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#d1d9e0">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">46%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">26%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">17%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">12%</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

+95
View File
@@ -0,0 +1,95 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="208" viewBox="0 0 380 208" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="206" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">LANGUAGES</text>
<g transform="translate(0, 36)">
<g transform="translate(16, 0)">
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3572A5" stroke-width="16"
stroke-dasharray="113.3 163.1" stroke-dashoffset="0.0"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="276.5" to="0.0" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#3178c6" stroke-width="16"
stroke-dasharray="63.6 212.9" stroke-dashoffset="-113.3"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="163.1" to="-113.3" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#00ADD8" stroke-width="16"
stroke-dasharray="41.5 235.0" stroke-dashoffset="-176.9"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="99.5" to="-176.9" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#dea584" stroke-width="16"
stroke-dasharray="30.4 246.0" stroke-dashoffset="-218.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="58.1" to="-218.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#89e051" stroke-width="16"
stroke-dasharray="16.6 259.9" stroke-dashoffset="-248.8"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="27.6" to="-248.8" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="44" fill="none" stroke="#7d8895" stroke-width="16"
stroke-dasharray="11.1 265.4" stroke-dashoffset="-265.4"
transform="rotate(-90 60 86.0)" opacity="0.85">
<animate attributeName="stroke-dashoffset" from="11.1" to="-265.4" dur="0.8s" fill="freeze"/>
</circle>
<circle cx="60" cy="86.0" r="28" fill="#1a2230"/>
<text x="60" y="87.0" text-anchor="middle" dominant-baseline="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="700" fill="#d1d9e0">Python</text>
<g transform="translate(140, 20)">
<rect width="10" height="10" rx="2" fill="#3572A5"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Python</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">41%</text>
</g>
<g transform="translate(140, 42)">
<rect width="10" height="10" rx="2" fill="#3178c6"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">TypeScript</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">23%</text>
</g>
<g transform="translate(140, 64)">
<rect width="10" height="10" rx="2" fill="#00ADD8"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Go</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">15%</text>
</g>
<g transform="translate(140, 86)">
<rect width="10" height="10" rx="2" fill="#dea584"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Rust</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">11%</text>
</g>
<g transform="translate(140, 108)">
<rect width="10" height="10" rx="2" fill="#89e051"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Shell</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">6%</text>
</g>
<g transform="translate(140, 130)">
<rect width="10" height="10" rx="2" fill="#7d8895"/>
<text x="16" y="9" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="12" fill="#d1d9e0">Other</text>
<text x="210" y="9" text-anchor="end" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" font-weight="600" fill="#7d8895">4%</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

+43
View File
@@ -0,0 +1,43 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="170" viewBox="0 0 380 170" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7d8895">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#3fb950">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7d8895">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#d1d9e0">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#2a3444" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#1e2836"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#3fb950"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#3fb950"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Sep 13 – Nov 12, 2025</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+43
View File
@@ -0,0 +1,43 @@
<svg xmlns="http://www.w3.org/2000/svg" width="380" height="170" viewBox="0 0 380 170" fill="none">
<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="104%">
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
<clipPath id="avatarClip"><circle cx="0" cy="0" r="18"/></clipPath>
</defs>
<rect x="1" y="1" width="378" height="168" rx="10" ry="10"
fill="#1a2230" stroke="#2a3444" stroke-width="1" filter="url(#shadow)"/>
<text x="20" y="30" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif" font-size="11" font-weight="600" fill="#7d8895" letter-spacing="0.8" opacity="0.7">STREAKS</text>
<g transform="translate(0, 36)">
<text x="105" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7d8895">CURRENT</text>
<text x="105" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#58a6ff">23</text>
<text x="275" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="#7d8895">LONGEST</text>
<text x="275" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="#d1d9e0">61</text>
<line x1="190" y1="10" x2="190" y2="76"
stroke="#2a3444" stroke-width="1"/>
<rect x="50" y="92" width="280" height="5" rx="2.5" fill="#1e2836"/>
<rect x="50" y="92" width="105.57" height="5" rx="2.5" fill="#58a6ff"/>
<circle cx="155.57" cy="94.5" r="3.5" fill="#58a6ff"/>
<text x="50" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Mar 30 – Today</text>
<text x="330" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="#7d8895">Sep 13 – Nov 12, 2025</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+89
View File
@@ -0,0 +1,89 @@
name: ghstats
services:
fetcher:
image: ghcr.io/shaymanor/ghstats-fetcher:${IMAGE_TAG:-latest}
container_name: ghstats-fetcher
restart: unless-stopped
environment:
GITHUB_PAT: ${GITHUB_PAT:?missing GITHUB_PAT}
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
GENERATOR_URL: http://generator:5002
volumes:
- ${HOME}/ghstats/data/fetcher:/app/data
ports:
- "127.0.0.1:5001:5001"
fetcher-cron:
image: ghcr.io/shaymanor/ghstats-fetcher:${IMAGE_TAG:-latest}
container_name: ghstats-fetcher-cron
restart: unless-stopped
command: ["python", "-m", "src.cron"]
environment:
GITHUB_PAT: ${GITHUB_PAT:?missing GITHUB_PAT}
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
volumes:
- ${HOME}/ghstats/data/fetcher:/app/data
depends_on:
- fetcher
generator:
image: ghcr.io/shaymanor/ghstats-generator:${IMAGE_TAG:-latest}
container_name: ghstats-generator
restart: unless-stopped
environment:
FETCHER_URL: http://fetcher:5001
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
GH_OAUTH_CLIENT_ID: ${GH_OAUTH_CLIENT_ID:?missing GH_OAUTH_CLIENT_ID}
GH_OAUTH_CLIENT_SECRET: ${GH_OAUTH_CLIENT_SECRET:?missing GH_OAUTH_CLIENT_SECRET}
GENERATOR_SECRET_KEY: ${GENERATOR_SECRET_KEY:?missing GENERATOR_SECRET_KEY}
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-https://gh-stats.com}
BUILD_VERSION: ${IMAGE_TAG:-}
DEV_DASHBOARD_USER: ${DEV_DASHBOARD_USER:?missing DEV_DASHBOARD_USER}
DEV_DASHBOARD_PASSWORD: ${DEV_DASHBOARD_PASSWORD:?missing DEV_DASHBOARD_PASSWORD}
volumes:
- ${HOME}/ghstats/data/generator:/app/data
ports:
- "127.0.0.1:5002:5002"
depends_on:
- fetcher
generator-worker:
image: ghcr.io/shaymanor/ghstats-generator:${IMAGE_TAG:-latest}
container_name: ghstats-generator-worker
restart: unless-stopped
command: ["python", "-m", "src.worker"]
environment:
FETCHER_URL: http://fetcher:5001
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
BUILD_VERSION: ${IMAGE_TAG:-}
volumes:
- ${HOME}/ghstats/data/generator:/app/data
depends_on:
- generator
generator-cron:
image: ghcr.io/shaymanor/ghstats-generator:${IMAGE_TAG:-latest}
container_name: ghstats-generator-cron
restart: unless-stopped
command: ["python", "-m", "src.cron"]
environment:
FETCHER_URL: http://fetcher:5001
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
BUILD_VERSION: ${IMAGE_TAG:-}
volumes:
- ${HOME}/ghstats/data/generator:/app/data
depends_on:
- generator
edge:
image: ghcr.io/shaymanor/ghstats-edge:${IMAGE_TAG:-latest}
container_name: ghstats-edge
restart: unless-stopped
environment:
GENERATOR_URL: http://generator:5002
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
ports:
- "127.0.0.1:5003:5003"
depends_on:
- generator
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Pulls the current image tag and brings up the compose stack.
# Expects GITHUB_PAT, FETCHER_INTERNAL_TOKEN, and IMAGE_TAG to be present in
# the environment (exported by the GitHub Actions deploy job).
set -euo pipefail
cd "$(dirname "$0")"
mkdir -p "$HOME/ghstats/data/fetcher" "$HOME/ghstats/data/generator"
docker compose pull
docker compose up -d --remove-orphans
docker compose ps
+72
View File
@@ -0,0 +1,72 @@
# Self-hosting gh-stats.
#
# Runs the same three services and the same published images that gh-stats.com
# runs. Everything is optional except GITHUB_PAT and FETCHER_INTERNAL_TOKEN.
#
# cp .env.example .env # then put your PAT in it
# docker compose up -d --build
# open http://localhost:5002
#
# The production deploy uses deploy/compose.yml instead; this file is the
# stripped-down version for running it on your own box.
name: ghstats
x-fetcher-env: &fetcher-env
GITHUB_PAT: ${GITHUB_PAT:?set GITHUB_PAT in .env - see .env.example}
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?set FETCHER_INTERNAL_TOKEN in .env - any random string}
services:
fetcher:
build: ./fetcher
image: ghstats-fetcher:local
restart: unless-stopped
environment:
<<: *fetcher-env
GENERATOR_URL: http://generator:5002
volumes:
- ./data/fetcher:/app/data
fetcher-cron:
build: ./fetcher
image: ghstats-fetcher:local
restart: unless-stopped
command: ["python", "-m", "src.cron"]
environment: *fetcher-env
volumes:
- ./data/fetcher:/app/data
depends_on: [fetcher]
generator:
build: ./generator
image: ghstats-generator:local
restart: unless-stopped
environment: &generator-env
FETCHER_URL: http://fetcher:5001
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?set FETCHER_INTERNAL_TOKEN in .env - any random string}
volumes:
- ./data/generator:/app/data
ports:
- "${GHSTATS_PORT:-5002}:5002"
depends_on: [fetcher]
generator-worker:
build: ./generator
image: ghstats-generator:local
restart: unless-stopped
command: ["python", "-m", "src.worker"]
environment: *generator-env
volumes:
- ./data/generator:/app/data
depends_on: [generator]
edge:
build: ./edge
image: ghstats-edge:local
restart: unless-stopped
environment:
GENERATOR_URL: http://generator:5002
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?set FETCHER_INTERNAL_TOKEN in .env - any random string}
ports:
- "${GHSTATS_EDGE_PORT:-5003}:5003"
depends_on: [generator]
File diff suppressed because it is too large Load Diff
@@ -1,531 +0,0 @@
# Production Pipeline Design — github-readme-stats
**Date:** 2026-04-17
**Status:** Approved for planning
**Scope:** Restructure the repo into three independent Python services (fetcher, generator, edge), each with its own Docker image, tests, README, and API. The existing React/Vite frontend folds into the generator service (built and served by it, but kept as a decoupled React app with its own sources). Redis is designed for but not stood up in v1; the edge uses in-process Flask-Caching + Flask-Compress as free wins. Hosting/orchestration is explicitly out of scope.
## Goals
- A public, unauthenticated URL `GET /<github-username>` returns an SVG profile card suitable for embedding in a GitHub README.
- If the username is unknown at request time, return a clean "we're building your widget" placeholder immediately; fetch and build in the background.
- GitHub API calls are tightly rate-limited and live behind a single internal service (the fetcher) that holds the only GitHub PAT.
- The serving path is always a precomputed SVG lookup — never a render on the hot path.
- The three services must be genuinely independent so the generator can later be split into a build worker + a serverless edge serving layer without reshuffling the other services.
## Non-Goals (v1)
- No GitHub OAuth, no login, no per-user auth on the settings API. An auth stub is included so auth can be added later without touching call sites.
- No hosting, CI, cloud config, or docker-compose.
- No analytics, no metrics dashboard, no admin UI.
- No Postgres / remote DB. SQLite with WAL is sufficient for the v1 workload (one writer per DB, small volumes, mostly reads). All DB access lives behind one `db.py` per service so a swap to Postgres is a localized change.
- **No Redis deployment in v1.** Redis is designed in this spec so the integration points are correct, but v1 ships without Redis standing up. Edge uses in-process Flask-Caching; generator/fetcher skip the cache layer and talk directly over HTTP. Enabling Redis later is a config toggle — see the Redis section.
## Architecture
```
GitHub README embed Browser (user visits app)
│ │
▼ ▼
┌───────────────┐ ┌─────────────────────────────┐
│ Edge service │ │ Generator service │
│ (many nodes) │──── HTTP ─────►│ / + /assets/* → React SPA │
│ Flask- │ origin fetch │ /api/<u> → widget │
│ Caching + │ on miss │ /api/enroll → enroll │
│ Compress │ │ /api/<u>/... → settings │
│ - /<u> │ │ + build worker container │
│ - /<u>/<w> │ │ + poll cron container │
└───────────────┘ └──────┬──────────┬───────────┘
│ │
settings.db widgets.db
▲
│
HTTP (internal,
X-Internal-Token)
│
┌─────────────────▼───────┐
│ Fetcher service │
│ - /data/<u> (auto- │
│ fetches on miss) │
│ - /fetch (force) │
│ - /avatar │
│ + cron container │
└──────┬──────────────────┘
▼
fetcher.db
│
▼
GitHub API
(v2) Redis slots between edge↔generator and generator↔fetcher.
cache.py is a no-op wrapper until REDIS_URL is set.
```
The edge has no DB of its own and no origin DB access — it's a cache-first proxy. The generator serves both the React SPA (static files at `/`) and the API (`/api/*`). Deploy as many edge instances around the world as you like.
## Redis (designed, not deployed in v1)
Specified here so the code knows the integration shape. v1 behavior: every `REDIS_URL` env var is unset → the cache wrapper short-circuits to a no-op, and every caller falls through to the underlying service. No code changes required to enable later — set `REDIS_URL` and it starts caching.
One Redis instance, accessible from fetcher, generator, and edge. Two key namespaces:
| Key | Value | TTL | Written by | Read by |
|---|---|---|---|---|
| `fetcher:data:<u>` | JSON payload from fetcher | 1h | fetcher (on miss-fill), generator cron on invalidation | generator API + worker |
| `fetcher:hash:<u>` | Current `payload_hash` | 1h | fetcher | generator cron (cheap change detection) |
| `widget:composite:<u>` | SVG string | 24h | edge (on miss-fill), generator (on rebuild invalidation) | edge |
| `widget:<name>:<u>` | SVG string per widget | 24h | same as composite | edge |
| `enroll:day:<YYYY-MM-DD>` | Counter | 48h | generator API | generator API (rate limit check) |
Rules:
- **Redis is a cache, never a source of truth.** Every key has a TTL. Losing Redis is a latency event, not a correctness event.
- **Invalidation on write, not just TTL.** When the build worker writes new widget rows, it immediately `DEL`s the matching `widget:*:<u>` keys so the next edge read re-populates. Same for fetcher on re-fetch.
- **Single Redis instance in v1.** If edge latency to a single Redis becomes a problem, swap to an edge-native KV (Cloudflare KV, Upstash) — only `edge/src/api.py` changes.
## Services
### 1. Fetcher
**Purpose:** Own every GitHub API interaction. Hold the PAT. Expose cached payloads to the generator.
**Endpoints** (all internal; not exposed to the public internet):
- `GET /data/<username>` — return stored payload JSON. If not stored, fetch from GitHub, store, return. This is the first-enrollment path. 502 on GitHub failure; 404 if GitHub says the user doesn't exist (fetcher stores a `{error: "not_found"}` marker so repeat calls are cheap).
- `POST /fetch {username}` — force re-fetch, ignoring any existing cache. Used by the fetcher's own cron and by manual admin action. Returns `{stored, payload_hash, changed}`.
- `GET /avatar/<username>` — return avatar bytes. GitHub's `https://github.com/<u>.png` is public and requires no PAT, so this is cheap. Used by the generator's placeholder renderer.
- `GET /health`
**Auth:** every request requires `X-Internal-Token: <shared-secret>` header. The generator holds the matching secret. The fetcher never listens on a public interface.
**Storage:** `fetcher.db` (SQLite), single table:
```sql
CREATE TABLE users (
username TEXT PRIMARY KEY,
data_json TEXT NOT NULL, -- full GitHub payload OR {"error":"not_found"}
payload_hash TEXT NOT NULL, -- sha256 of data_json
fetched_at TEXT NOT NULL, -- UTC ISO 8601
last_requested_at TEXT NOT NULL -- updated on every GET /data; drives GC
);
```
**Cron (`fetcher/src/cron.py`):** runs every hour. Each tick:
1. Select users with `fetched_at < now - 24h` AND `last_requested_at > now - 7d`. Stagger calls across the hour so we don't burst GitHub.
2. For each, call `POST /fetch` internally (or the equivalent function). Update `payload_hash`.
3. Delete rows where `last_requested_at < now - 7d` (trial GC — unused enrollments drop out automatically). `last_requested_at` is updated on every `GET /data/<u>`, so actively-embedded users are never dropped.
**Env vars:**
- `FETCHER_PORT` (default `5001`)
- `FETCHER_DB_PATH` (default `./data/fetcher.db` inside container)
- `GITHUB_PAT` (required)
- `FETCHER_INTERNAL_TOKEN` (required; the shared secret)
- `FETCHER_REFRESH_INTERVAL_HOURS` (default `24`)
- `FETCHER_TRIAL_GC_DAYS` (default `7`)
- `REDIS_URL` (optional; if set, writes to cache on fetch)
**DB pragmas:** on connection open, run `PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL; PRAGMA foreign_keys=ON; PRAGMA busy_timeout=5000;`.
### 2. Generator
**Purpose:** Serve precomputed SVGs to the public internet. Hold user settings. Build widgets in the background. Never call GitHub directly; only talk to the fetcher over HTTP.
All API endpoints are under the `/api/` prefix. Root `/` and `/assets/*` serve the React SPA built into `src/static/`.
**Public API endpoints:**
- `GET /api/<username>` — return composite SVG from `widgets.db`. Placeholder on miss. Sets `X-Widget-Status` header.
- `GET /api/<username>/<widget>.svg` — individual widget. Same behavior.
- `POST /api/enroll {username}` — explicit enrollment (SPA uses this). Also auto-invoked when `GET /api/<unknown>` arrives. Enforces daily rate limit. Returns `{enrolled, job_id}` or `{error: "rate_limited"}`.
- `GET /api/health`
**Auth-gated API endpoints** (auth stub in v1 — passes everything through; real auth later):
- `GET /api/<username>/settings` — current settings.
- `PATCH /api/<username>/settings` — update settings; enqueues a rebuild. Unlimited. Does NOT re-fetch GitHub.
- `POST /api/<username>/refresh` — one-shot manual re-fetch + rebuild. Calls fetcher's `POST /fetch`, then enqueues a rebuild. Gated by `manual_refresh_used` flag (allowed once per user, ever). Returns 409 `already_used` after the first call.
**Storage:**
**`settings.db`** (SQLite):
```sql
CREATE TABLE users (
username TEXT PRIMARY KEY,
settings_json TEXT NOT NULL, -- theme, enabled widgets, order, custom_tags, achievements, widget_settings
settings_hash TEXT NOT NULL, -- sha256 of canonicalized settings_json
enrolled_at TEXT NOT NULL,
last_fetcher_payload_hash TEXT, -- last hash we rebuilt from; cron compares
manual_refresh_used INTEGER DEFAULT 0, -- enforces one-shot user-triggered re-fetch
last_requested_at TEXT NOT NULL -- updated on every GET /<u>; drives trial GC
);
CREATE TABLE enrollments_daily (
day TEXT PRIMARY KEY, -- YYYY-MM-DD, UTC
count INTEGER NOT NULL
);
CREATE TABLE jobs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
kind TEXT NOT NULL, -- "build"
username TEXT NOT NULL,
status TEXT NOT NULL, -- "pending" | "running" | "done" | "failed"
attempts INTEGER DEFAULT 0,
last_error TEXT,
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL
);
CREATE INDEX idx_jobs_pending ON jobs(status, created_at);
```
**`widgets.db`** (SQLite in v1; designed for swap to remote backend later):
```sql
CREATE TABLE widgets (
username TEXT NOT NULL,
settings_hash TEXT NOT NULL,
widget_name TEXT NOT NULL, -- "composite" | "grade" | "focus" | ...
svg TEXT NOT NULL,
built_at TEXT NOT NULL,
PRIMARY KEY (username, settings_hash, widget_name)
);
CREATE TABLE current_widget (
username TEXT PRIMARY KEY,
settings_hash TEXT NOT NULL, -- pointer to the "live" set
updated_at TEXT NOT NULL
);
CREATE INDEX idx_widgets_username ON widgets(username);
```
The `widgets_repo.py` module wraps all access. Future swap to Postgres / Turso / D1 / S3 changes only that one file.
**Build worker (`generator/src/build_worker.py`):**
- In-process thread polling `jobs` table every 500ms.
- For each pending job: mark `running`, load settings, `GET {fetcher}/data/<u>` (fetcher auto-fetches on miss), compute `settings_hash`, render all enabled widgets + composite, upsert into `widgets.db`, flip `current_widget` pointer atomically, LRU-trim to 10 rows per user, mark `done`.
- Failure: increment `attempts`, exponential backoff (1min, 5min, 15min); after 3 attempts mark `failed` and leave the existing widget (if any) in place. Placeholder continues to serve for un-built users.
- Extractable to a standalone process later (same DB, same code, separate entrypoint).
**Generator cron (`generator/src/cron.py`):** runs every 15 minutes.
1. For each enrolled user, `GET {fetcher}/data/<u>` (response includes `payload_hash`).
2. If `payload_hash != last_fetcher_payload_hash`, enqueue a build job and update `last_fetcher_payload_hash`.
3. LRU-trim widgets per user.
**Enrollment rate limit:** global cap of 50 new enrollments per UTC day (`ENROLLMENT_DAILY_CAP`). Over cap → `POST /enroll` returns `rate_limited`; `GET /<unknown>` returns a "try again tomorrow" placeholder. Enrollment counter increments only on *new* users, not on re-requests.
**Placeholder renderer (`generator/src/placeholder.py`):** produces SVGs matching the card wrapper and theme of real widgets. Three variants:
- **building**: "Building @username's widget... This usually takes under a minute." Shows avatar if fetched (generator calls `GET {fetcher}/avatar/<u>`). Serves when user is enrolled but widgets not yet built.
- **rate_limited**: "Too many new users today — try again tomorrow." Shown when enrollment cap is hit.
- **not_found**: "GitHub user @username doesn't exist." Shown when fetcher stored a `not_found` marker.
Placeholders are rendered on the fly (no DB lookup needed) and served with `Cache-Control: no-store`.
**Env vars:**
- `GENERATOR_PORT` (default `5002`)
- `GENERATOR_SETTINGS_DB_PATH` (default `./data/settings.db`)
- `GENERATOR_WIDGETS_DB_PATH` (default `./data/widgets.db`)
- `FETCHER_URL` (required, e.g. `http://mini-pc:5001`)
- `FETCHER_INTERNAL_TOKEN` (required, matches fetcher's)
- `REDIS_URL` (optional; if set, read-through to fetcher cache and invalidation on rebuild)
- `ENROLLMENT_DAILY_CAP` (default `50`)
- `WIDGET_LRU_PER_USER` (default `10`)
- `GENERATOR_POLL_INTERVAL_MINUTES` (default `15`)
**DB pragmas:** same as fetcher (WAL + NORMAL sync + 5s busy_timeout).
### 3. Edge
**Purpose:** Serve widget SVGs cache-first, with the generator as origin. Deploy many instances around the world (Cloud Run, Fly, Lambda container, etc.). No DB of its own.
**Endpoints:**
- `GET /<username>` — check cache; hit → return; miss → fetch generator `GET /api/<u>`, cache, return.
- `GET /<username>/<widget>.svg` — same pattern.
- `GET /health` — reports cache type + origin reachability.
**Caching (v1):** [Flask-Caching](https://flask-caching.readthedocs.io/) with `CACHE_TYPE=SimpleCache` — in-process LRU, per-instance, no external dependency. Wrapped by a thin `cache.py` so `CACHE_TYPE=RedisCache` + `CACHE_REDIS_URL` swaps in Redis later with no call-site changes. TTL: 24h. Max entries per instance: 10000.
**Compression:** [Flask-Compress](https://github.com/colour-science/flask-compress) on, default settings. SVG is text — gzip typically 70-80%% savings.
**HTTP cache headers on hits:**
- `Cache-Control: public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400`
**Placeholder handling:** generator sets `X-Widget-Status: ready | building | rate_limited | not_found`. Edge only caches `ready` responses. Others are passed through with `Cache-Control: no-store` so a CDN in front doesn't memorize them.
**Implementation:** single `edge/src/api.py` Flask file (~100 lines) + `edge/src/cache.py` (~30 lines).
**Env vars:**
- `EDGE_PORT` (default `5003`)
- `GENERATOR_URL` (required — origin)
- `CACHE_TYPE` (default `SimpleCache`; later `RedisCache`)
- `CACHE_REDIS_URL` (optional)
- `CACHE_DEFAULT_TIMEOUT` (default `86400`)
### Frontend (served by the generator)
**Not a separate service.** The existing React/Vite frontend moves into `generator/frontend/` (source code) and is built by the generator's Dockerfile. The Flask app in `generator/src/api.py` serves the built static bundle from `/` (and `/assets/*`). The architecture stays decoupled — React sources live in their own folder, are built by their own toolchain, and only the static output is served by Flask.
**URL split on the generator:**
| Path | Served | Notes |
|---|---|---|
| `/` | `generator/frontend/dist/index.html` | React SPA entry |
| `/assets/*` | `generator/frontend/dist/assets/*` | JS/CSS bundles |
| `/api/<u>` | Flask route | widget origin (called by edge) |
| `/api/<u>/<w>.svg` | Flask route | individual widget origin |
| `/api/enroll` | Flask route | enrollment |
| `/api/<u>/settings` | Flask route | settings CRUD |
| `/api/<u>/refresh` | Flask route | one-shot re-fetch |
| `/api/health` | Flask route | health |
**Why `/api/` prefix:** keeps the frontend `/` clean for the SPA and keeps widget origin paths from colliding with React routes. The edge rewrites `GET /<u>` → `GET /api/<u>` when calling origin.
**Dockerfile (one, multi-stage):**
1. **Stage `frontend-build`** — `node:20-alpine`, `npm ci && npm run build` inside `/app/frontend`, produces `/app/frontend/dist`.
2. **Stage `runtime`** — `python:3.11-slim`, install `requirements.txt`, copy `src/` and the built `frontend/dist` from stage 1 into `src/static/`. Flask serves from there.
**Flow (v1, no auth):**
1. User opens `https://generator.example.com/` → React SPA loads.
2. User enters their GitHub username → calls `POST /api/enroll`.
3. UI polls `GET {EDGE_URL}/<username>` preview (placeholder until build completes).
4. Settings form edits go to `PATCH /api/<username>/settings`.
5. "Refresh from GitHub" button calls `POST /api/<username>/refresh`. Disabled after one use (server enforces 409).
6. UI displays the embeddable edge URL for pasting into their README.
**Vite env vars:** `VITE_GENERATOR_URL`, `VITE_EDGE_URL` (baked at build time by the Dockerfile).
## File Layout
Simplified — each Python service is ~4-6 files plus its rendering assets.
```
github-readme-stats/
├── fetcher/
│ ├── src/
│ │ ├── __init__.py
│ │ ├── api.py # Flask app + all routes + auth header check
│ │ ├── github.py # GitHub GraphQL/REST client (from src/data/fetcher.py)
│ │ ├── db.py # SQLite repo, WAL setup, schema migrations
│ │ ├── cron.py # scheduled refresh + GC; run as separate container
│ │ └── config.py
│ ├── tests/
│ │ ├── test_api.py
│ │ ├── test_github.py
│ │ ├── test_db.py
│ │ └── test_cron.py
│ ├── data/ # gitignored
│ ├── Dockerfile
│ ├── requirements.txt
│ ├── pytest.ini
│ └── README.md
│
├── generator/
│ ├── frontend/ # React+Vite sources (moved from top-level frontend/)
│ │ ├── src/
│ │ ├── package.json
│ │ ├── vite.config.ts
│ │ └── tsconfig.json
│ ├── src/
│ │ ├── __init__.py
│ │ ├── api.py # Flask app + all /api/* routes + SPA static serve + fetcher HTTP client inline + auth stub inline
│ │ ├── worker.py # build worker loop; run as separate container
│ │ ├── cron.py # polls fetcher, enqueues rebuilds; run as separate container
│ │ ├── db.py # settings_repo + widgets_repo together
│ │ ├── cache.py # no-op in v1 (REDIS_URL unset); real wrapper otherwise
│ │ ├── placeholder.py # three SVG variants
│ │ ├── processor.py # widget rendering pipeline (from src/data/processor.py)
│ │ ├── config.py
│ │ ├── static/ # populated at Docker build time from frontend/dist
│ │ ├── widgets/ # (from src/widgets/)
│ │ ├── themes/ # (from src/themes/)
│ │ ├── models/ # (from src/models/)
│ │ └── utils/ # (from src/utils/)
│ ├── tests/
│ │ ├── test_api.py
│ │ ├── test_worker.py
│ │ ├── test_cron.py
│ │ ├── test_db.py
│ │ ├── test_placeholder.py
│ │ ├── test_processor.py
│ │ └── integration/
│ │ └── test_end_to_end.py
│ ├── data/ # gitignored
│ ├── Dockerfile # multi-stage: node build → python runtime (api+worker+cron share image)
│ ├── requirements.txt
│ ├── pytest.ini
│ └── README.md
│
├── edge/
│ ├── src/
│ │ ├── __init__.py
│ │ ├── api.py # Flask app + Flask-Caching + Flask-Compress + origin fetch
│ │ ├── cache.py # Flask-Caching config (SimpleCache now, RedisCache later)
│ │ └── config.py
│ ├── tests/
│ │ └── test_api.py
│ ├── Dockerfile
│ ├── requirements.txt
│ ├── pytest.ini
│ └── README.md
│
├── docs/superpowers/specs/2026-04-17-production-pipeline-design.md
├── .gitignore # **/data/*.db, built artifacts
└── README.md # points to each service's README
```
**Independence rules:**
- No Python imports cross service folders. Communication only via HTTP + Redis.
- No shared package. Duplicate any trivial util (e.g., `payload_hash`) per service.
- Each service has its own `requirements.txt`, `pytest.ini`, `Dockerfile`, `README.md`.
- `docker build ./fetcher` etc. succeeds with no repo-root build context.
- Generator ships one Docker image; three containers run from it with different `CMD`s: `python -m src.api`, `python -m src.worker`, `python -m src.cron`.
## Code to Delete
The current `src/` layout is retired wholesale. Specifically:
- `run.py` — CLI entry point replaced by frontend + API.
- `src/generate.py` — replaced by the generator service.
- `src/fetcher_api.py`, `src/generator_api.py` — replaced by `fetcher/src/api.py` and `generator/src/api.py`.
- `src/db/` — schema moves to fetcher's `repository.py`; dummy user pattern replaced by placeholders.
- `src/data/ARCHITECTURE.md` — superseded by this spec.
- `widget_*.svg` at repo root — build artifacts, no longer produced.
- `data/ghstats.db` at repo root — replaced by per-service `data/*.db`.
- `REPORT.md`, `CHANGELOG.md` — stale; drop unless user wants them kept.
- `src/README.md` — superseded by per-service READMEs.
`CLAUDE.md` is updated to reflect the new layout (sections on commands, architecture, configuration). `CONFIGURATION.md` and `TAG_CUSTOMIZATION.md` move into the generator's `README.md` (or its own `docs/` under `generator/`).
Existing widget/theme/model code under `src/widgets/`, `src/themes/`, `src/models/`, `src/utils/`, and most of `src/data/processor.py` move into `generator/src/` and are kept. `src/data/fetcher.py` moves into `fetcher/src/github.py`. The top-level `frontend/` folder moves wholesale into `generator/frontend/`.
## Data Flow
### First-time `GET /shaymanor` (from a README embed, hitting the edge)
1. Edge: Flask-Caching lookup for `/shaymanor` → miss.
2. Edge: HTTP `GET {generator}/api/shaymanor` → origin.
3. Generator: `widgets_repo.get_current(shaymanor)` → miss.
4. Generator: `settings_repo.get(shaymanor)` → miss → user unenrolled.
5. Enrollment path:
a. Check today's counter in `enrollments_daily`. If `>= 50`, return `rate_limited` placeholder with `X-Widget-Status: rate_limited` and `Cache-Control: no-store`.
b. Insert default settings row. Increment counter.
c. Insert `build` job.
6. Generator returns `building` placeholder with `X-Widget-Status: building`, `Cache-Control: no-store`.
7. Edge sees non-`ready` status header, returns SVG to the reader without caching.
### Build worker processing a job
1. Mark job `running`.
2. `cache.get("fetcher:data:<u>")` via the wrapper (v1 = no-op, always miss). Miss → `GET {fetcher}/data/<u>` with internal token (fetcher auto-fetches from GitHub on miss). Hit → use cached payload.
3. If payload is the `not_found` marker: upsert a `not_found` placeholder into widgets; flip `current_widget`; mark job `done`. No retries on this user.
4. Otherwise: load settings, compute `settings_hash`, render all enabled widgets + composite via the existing `processor.py` pipeline.
5. Transaction: insert widget rows, flip `current_widget`, update `settings.last_fetcher_payload_hash`.
6. `cache.delete("widget:composite:<u>")` and per-widget keys (v1 no-op; real invalidation once Redis is enabled).
7. LRU-trim widgets for this user to 10 hashes.
8. Mark job `done`.
The edge clears its own Flask-Caching entry via TTL expiry (24h) in v1. Users who want instant invalidation on rebuild can call the edge's `POST /admin/purge/<u>` (added in v2 when Redis comes online — not in v1).
### Cron-driven refresh
1. Fetcher cron (hourly) re-fetches due users; updates `payload_hash` on change.
2. Generator cron (15 min) calls fetcher `GET /data/<u>` per enrolled user (response includes `payload_hash`). Compares with `last_fetcher_payload_hash`. On mismatch, enqueues `build` job. (When Redis comes online in v2, this reads `fetcher:hash:<u>` from Redis — HTTP becomes the fallback.)
3. Trial users not requested in 7 days are GC'd by fetcher cron.
### Settings change from frontend
1. `PATCH /shaymanor/settings` (auth stub passes through).
2. Generator computes new `settings_hash`, updates `settings_json`.
3. Enqueue `build` job.
4. Old `(username, old_hash)` rows remain in `widgets` until LRU-trimmed. `current_widget` flips once the build completes — no user-visible flicker.
### Manual refresh (one-shot, user-triggered)
1. `POST /shaymanor/refresh`.
2. If `manual_refresh_used = 1`, return 409 `already_used`.
3. Otherwise: set `manual_refresh_used = 1`, call fetcher `POST /fetch {username: shaymanor}` (this burns one GitHub-quota hit), enqueue `build` job. The rebuild will pick up the freshly-fetched data on the next poll.
After this one-shot is spent, the user's data only changes via fetcher cron (every 24h). Settings edits continue to trigger unlimited rebuilds but never re-fetch.
## Error Handling
| Failure mode | Behavior |
|---|---|
| Fetcher unreachable from generator | Build job retries with backoff; placeholder continues to serve; `/health` reports degraded. |
| GitHub returns 5xx | Fetcher returns 502 to generator; build job retries. |
| GitHub returns 404 | Fetcher stores `{error: "not_found"}`; generator builds a `not_found` placeholder once, stops retrying. |
| GitHub rate-limit | Fetcher returns 429 to generator; build job retries with longer backoff. |
| Enrollment cap exceeded | `POST /enroll` → `rate_limited`. `GET /<unknown>` → `rate_limited` placeholder. Next day resets. |
| Settings DB or widgets DB corrupt | Generator serves 503. Intentional — this is a server bug, not a missing-user condition. |
| Build worker dies mid-job | On next start, any `running` job older than 10 minutes is reclaimed to `pending`. |
| Manual refresh reused | 409 `already_used`. |
## Testing
Each service has its own `tests/` and runs with `cd <service> && pytest`.
**Fetcher:**
- `test_repository.py`: upsert, payload_hash stability, last_requested_at update on read.
- `test_github_client.py`: mocked HTTP with the `responses` library; covers GraphQL + REST paths, 404, 429, 502.
- `test_api.py`: auth-header enforcement, auto-fetch on miss, 404 handling.
- `test_cron.py`: staggered refresh, GC of stale trial users.
**Generator:**
- `test_db.py`: settings + widgets CRUD, settings_hash canonicalization, LRU trimming, `current_widget` pointer atomicity, WAL pragma applied.
- `test_placeholder.py`: each of the three placeholder variants renders valid SVG and matches theme.
- `test_worker.py`: picks jobs, retries on fetcher failures, handles `not_found` marker, invalidates Redis on success.
- `test_api.py`: full surface — auth stub, rate limit, enrollment auto-trigger on `GET /api/<unknown>`, serves precomputed on hit, placeholder on miss, `X-Widget-Status` header correct per case, SPA served at `/`.
- `test_cron.py`: polls fetcher via HTTP, enqueues only on hash change.
- `test_processor.py`: carry-over tests for widget rendering (from existing code).
**Edge (`edge/tests/`):**
- `test_api.py`: SimpleCache hit returns cached SVG; miss fetches origin, caches, returns; `X-Widget-Status: ready` is cached, others pass through uncached; gzip content-encoding applied to responses > threshold.
**Integration (`generator/tests/integration/`):** spin up generator API + worker + cron + edge + a fake fetcher (responses/respx mock) in-process, drive `GET /<newuser>` end to end via the edge. Assert placeholder → build → real SVG transition and that the edge serves from cache on second request.
**Frontend:** Vitest smoke tests: form submit, preview fetch, settings save. No E2E required in v1.
## Security
- Fetcher's `X-Internal-Token` is required on every endpoint except `/health`. Constant-time comparison. 401 on mismatch.
- No endpoint on the fetcher is exposed to the public internet. Deployment guidance in the fetcher README: bind to `127.0.0.1` or a private interface.
- Generator does not echo stored data anywhere except via the widget SVG — no `/data/<u>` mirror. Prevents the generator from leaking raw GitHub payloads.
- Frontend talks to generator over HTTPS in production (user's responsibility).
- No secrets logged. No `GITHUB_PAT` in generator env at all.
## Observability
- Each service logs to stdout in a line-oriented format: `ts level service event key=val ...`.
- `/health` on each service returns `{status, service, db_ok, upstream_ok?}`.
- No metrics backend in v1.
## Migration Plan (executed by the implementation phase)
1. Create new folder scaffolding and move code wholesale. Do not keep the old `src/` in parallel — cut over in one branch.
2. Split `src/db/repository.py` into fetcher's `repository.py`.
3. Define new settings_repo and widgets_repo in `generator/src/`.
4. Write placeholder renderer using the existing card wrapper util (moved into `generator/src/utils/`).
5. Wire build worker + cron.
6. Update `.gitignore`; delete retired files and build artifacts.
7. Update the top-level `README.md` to point to the three service READMEs.
8. Update `CLAUDE.md` to reflect the new layout.
## Open Questions
None at time of writing. All design choices confirmed in brainstorming.
## Future Work (out of scope for this spec)
- GitHub OAuth on settings endpoints.
- Postgres migration (swap `db.py` per service; all call sites unchanged).
- Edge-native KV store (Cloudflare KV / Upstash) if single-Redis latency is a problem from far regions.
- Admin endpoints for cron pause / manual re-fetch / user purge.
- Metrics + alerting.
+2 -1
View File
@@ -6,4 +6,5 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY src ./src
EXPOSE 5003
CMD ["gunicorn", "-b", "0.0.0.0:5003", "-w", "2", "src.api:app"]
# Bind to $PORT when set (e.g. Cloud Run injects PORT=8080); default to 5003.
CMD ["sh", "-c", "exec gunicorn -b 0.0.0.0:${PORT:-5003} -w 2 src.api:app"]
+93
View File
@@ -0,0 +1,93 @@
"""Edge analytics — record + flush + push to generator.
The hot path enqueues; the background thread does the network I/O. If the
generator is unreachable we drop the batch (logging a warning) and let the
queue catch the next tick.
"""
import logging
import threading
import time
from collections import deque
import requests
from . import config
log = logging.getLogger("edge.analytics")
_QUEUE: deque = deque(maxlen=config.ANALYTICS_QUEUE_MAX)
_QUEUE_LOCK = threading.Lock()
_THREAD_LOCK = threading.Lock()
_FLUSH_THREAD: threading.Thread | None = None
_events_dropped: int = 0
_drop_lock = threading.Lock()
def _reset_for_tests() -> None:
global _events_dropped, _FLUSH_THREAD, _QUEUE
with _QUEUE_LOCK:
_QUEUE = deque(maxlen=config.ANALYTICS_QUEUE_MAX)
with _drop_lock:
_events_dropped = 0
_FLUSH_THREAD = None
def record_request(endpoint: str, username: str | None, widget: str | None,
status: int, latency_ms: int, cache_hit: int | None = None) -> None:
ev = {
"ts": int(time.time()),
"service": "edge",
"kind": "request",
"username": username,
"endpoint": endpoint,
"widget": widget,
"status": int(status),
"latency_ms": int(latency_ms),
"cache_hit": cache_hit,
}
global _events_dropped
with _QUEUE_LOCK:
if len(_QUEUE) >= _QUEUE.maxlen:
with _drop_lock:
_events_dropped += 1
return
_QUEUE.append(ev)
def flush_now() -> int:
with _QUEUE_LOCK:
batch = list(_QUEUE)
_QUEUE.clear()
if not batch:
return 0
if not config.ANALYTICS_GENERATOR_URL or not config.ANALYTICS_INTERNAL_TOKEN:
return 0
try:
requests.post(
f"{config.ANALYTICS_GENERATOR_URL}/internal/analytics/events",
headers={"X-Internal-Token": config.ANALYTICS_INTERNAL_TOKEN},
json={"events": batch},
timeout=2,
)
except Exception:
log.warning("analytics flush failed (events lost)", exc_info=True)
return 0
return len(batch)
def _flush_loop():
while True:
time.sleep(config.ANALYTICS_FLUSH_SECONDS)
try:
flush_now()
except Exception:
log.exception("flush loop error")
def start_flush_thread():
global _FLUSH_THREAD
with _THREAD_LOCK:
if _FLUSH_THREAD is not None and _FLUSH_THREAD.is_alive():
return
t = threading.Thread(target=_flush_loop, name="edge-analytics-flush", daemon=True)
t.start()
_FLUSH_THREAD = t
+97 -6
View File
@@ -1,24 +1,78 @@
"""Edge service — cache-first SVG proxy in front of the generator."""
import logging
import re
import time
from collections import defaultdict, deque
from threading import Lock
import requests
from flask import Flask, Response, jsonify
from flask import Flask, Response, jsonify, request
from flask_compress import Compress
from . import cache as cache_mod, config
from . import analytics, cache as cache_mod, config
app = Flask(__name__)
# Tolerate stray trailing slashes on every route, matching the generator. A
# hand-copied embed URL like `/alice/` should resolve like `/alice` instead of
# Flask's default strict_slashes 404. Set before the route decorators run.
app.url_map.strict_slashes = False
Compress(app)
cache_ext = cache_mod.build_cache(app)
log = logging.getLogger("edge")
analytics.start_flush_thread()
# GitHub usernames: 1-39 chars, alnum, single hyphens. Keep the regex in
# sync with generator/src/utils/validate.py so invalid paths get rejected
# before they waste an upstream round-trip.
_USERNAME_RE = re.compile(r"^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$")
_ALLOWED_WIDGETS = {"grade", "impact", "collaborators", "focus", "languages", "achievements", "composite"}
def _valid_username(u: str) -> bool:
return bool(u) and bool(_USERNAME_RE.match(u))
# ---- Per-IP rate limiter ---------------------------------------------------
# The edge is the mini PC's front door. Cache hits are cheap, but a hostile
# cache-miss storm (unique usernames, unique widget names) would funnel into
# the generator's render path. Bound it here so the generator's own limiter
# isn't the only layer. Operators who run behind a CDN / nginx should prefer
# the upstream limiter and raise these env vars.
_rate_lock = Lock()
_rate_hits: dict[str, deque] = defaultdict(deque)
def _client_ip() -> str:
fwd = request.headers.get("X-Forwarded-For", "")
if fwd:
return fwd.split(",")[-1].strip()
return request.remote_addr or "unknown"
def _allow(ip: str) -> bool:
now = time.time()
cutoff = now - config.RATE_LIMIT_WINDOW
with _rate_lock:
q = _rate_hits[ip]
while q and q[0] < cutoff:
q.popleft()
if len(q) >= config.RATE_LIMIT_MAX:
return False
q.append(now)
return True
def _cache_key(path: str) -> str:
return f"edge:{path}"
def _fetch_origin(path: str) -> requests.Response:
def _fetch_origin(path: str, client_ip: str) -> requests.Response:
url = f"{config.GENERATOR_URL}/api/{path}"
return requests.get(url, timeout=config.UPSTREAM_TIMEOUT)
# Forward the caller's IP so the generator's rate limiter can
# discriminate per user rather than treating the edge's single IP as
# one client — otherwise the first 300 requests/min exhaust the bucket
# for everyone behind the edge.
headers = {"X-Forwarded-For": client_ip}
return requests.get(url, headers=headers, timeout=config.UPSTREAM_TIMEOUT)
@app.route("/health", methods=["GET"])
@@ -34,32 +88,51 @@ def health():
@app.route("/<username>", methods=["GET"])
def serve(username: str):
if not _valid_username(username):
return jsonify({"error": "invalid_username"}), 400
# GitHub usernames are case-insensitive; canonicalize to lowercase so the
# cache key and the upstream path don't fragment by case.
username = username.lower()
return _serve(username, path=username)
@app.route("/<username>/<widget>.svg", methods=["GET"])
def serve_widget(username: str, widget: str):
if not _valid_username(username):
return jsonify({"error": "invalid_username"}), 400
if widget not in _ALLOWED_WIDGETS:
return jsonify({"error": "unknown_widget"}), 400
username = username.lower()
return _serve(f"{username}/{widget}", path=f"{username}/{widget}.svg")
def _serve(key_suffix: str, path: str) -> Response:
t0 = time.monotonic()
ip = _client_ip()
if not _allow(ip):
return jsonify({"error": "rate_limited"}), 429
ck = _cache_key(key_suffix)
cached = cache_ext.get(ck)
if cached is not None:
body, content_type = cached
return Response(body, mimetype=content_type, headers={
resp = Response(body, mimetype=content_type, headers={
"X-Widget-Status": "ready",
"X-Cache": "HIT",
"Cache-Control": "public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400",
})
_record(path, key_suffix, 200, t0, cache_hit=1)
return resp
try:
r = _fetch_origin(path)
r = _fetch_origin(path, ip)
except Exception as e:
log.warning("origin unreachable for %s: %s", path, e)
_record(path, key_suffix, 503, t0, cache_hit=0)
return jsonify({"error": "origin unreachable"}), 503
if r.status_code >= 500:
_record(path, key_suffix, 503, t0, cache_hit=0)
return jsonify({"error": "origin error"}), 503
status = r.headers.get("X-Widget-Status", "ready")
@@ -70,6 +143,7 @@ def _serve(key_suffix: str, path: str) -> Response:
else:
cc = "no-store"
_record(path, key_suffix, r.status_code, t0, cache_hit=0)
return Response(r.content, status=r.status_code, mimetype=content_type, headers={
"X-Widget-Status": status,
"X-Cache": "MISS",
@@ -77,6 +151,23 @@ def _serve(key_suffix: str, path: str) -> Response:
})
def _record(path: str, key_suffix: str, status: int, t0: float, cache_hit: int) -> None:
"""Normalize the edge URL into (endpoint_template, username, widget)
so the dashboard can group across users without exploding cardinality."""
if "/" in key_suffix:
username, widget = key_suffix.split("/", 1)
endpoint = "/<u>/<widget>.svg"
else:
username = key_suffix
widget = "composite"
endpoint = "/<u>"
analytics.record_request(
endpoint=endpoint, username=username, widget=widget,
status=status, latency_ms=int((time.monotonic() - t0) * 1000),
cache_hit=cache_hit,
)
def main():
app.run(host="0.0.0.0", port=config.PORT)
+12
View File
@@ -7,3 +7,15 @@ CACHE_REDIS_URL = os.getenv("CACHE_REDIS_URL", "")
CACHE_DEFAULT_TIMEOUT = int(os.getenv("CACHE_DEFAULT_TIMEOUT", "86400"))
CACHE_THRESHOLD = int(os.getenv("CACHE_THRESHOLD", "10000"))
UPSTREAM_TIMEOUT = int(os.getenv("EDGE_UPSTREAM_TIMEOUT", "10"))
# Per-IP rate limit at the edge. Anti-abuse only — cache hits are cheap
# and cache misses are already bounded by the generator's global
# semaphore, so normal traffic should never notice this. Generous by
# default; tighten via env if a specific IP misbehaves.
RATE_LIMIT_MAX = int(os.getenv("EDGE_RATE_LIMIT_MAX", "3000"))
RATE_LIMIT_WINDOW = int(os.getenv("EDGE_RATE_LIMIT_WINDOW", "60"))
ANALYTICS_GENERATOR_URL = os.getenv("ANALYTICS_GENERATOR_URL", os.getenv("GENERATOR_URL", "http://localhost:5002"))
ANALYTICS_INTERNAL_TOKEN = os.getenv("FETCHER_INTERNAL_TOKEN", "")
ANALYTICS_FLUSH_SECONDS = int(os.getenv("ANALYTICS_FLUSH_SECONDS", "5"))
ANALYTICS_QUEUE_MAX = int(os.getenv("ANALYTICS_QUEUE_MAX", "2000"))
+46
View File
@@ -0,0 +1,46 @@
import responses
from src import analytics as a
from src import config as cfg
def test_record_request_enqueues():
a._reset_for_tests()
a.record_request("/<u>", "alice", "composite", 200, 12, cache_hit=1)
assert len(a._QUEUE) == 1
e = a._QUEUE[0]
assert e["service"] == "edge"
assert e["username"] == "alice"
assert e["latency_ms"] == 12
@responses.activate
def test_flush_posts_batch(monkeypatch):
monkeypatch.setattr(cfg, "ANALYTICS_GENERATOR_URL", "http://gen:5002")
monkeypatch.setattr(cfg, "ANALYTICS_INTERNAL_TOKEN", "secret")
a._reset_for_tests()
responses.add(responses.POST, "http://gen:5002/internal/analytics/events",
json={"ingested": 2}, status=200)
a.record_request("/<u>", "alice", "composite", 200, 12, cache_hit=1)
a.record_request("/<u>", "bob", "composite", 200, 8, cache_hit=0)
a.flush_now()
assert len(responses.calls) == 1
import json
body = json.loads(responses.calls[0].request.body)
assert len(body["events"]) == 2
def test_instrument_wraps_serve_and_records(monkeypatch):
monkeypatch.setattr(cfg, "ANALYTICS_INTERNAL_TOKEN", "secret")
a._reset_for_tests()
from src import api as apimod
with apimod.app.test_client() as c:
class FakeResp:
status_code = 200
content = b"<svg/>"
headers = {"X-Widget-Status": "ready", "Content-Type": "image/svg+xml"}
monkeypatch.setattr(apimod, "_fetch_origin", lambda *a, **k: FakeResp())
apimod.cache_ext.clear()
c.get("/alice")
assert len(a._QUEUE) == 1
assert a._QUEUE[0]["username"] == "alice"
assert a._QUEUE[0]["endpoint"] == "/<u>"
+11
View File
@@ -44,6 +44,17 @@ def test_origin_error_returns_503(client):
assert r.status_code == 503
@responses.activate
def test_trailing_slash_tolerated(client):
"""A hand-copied `/alice/` must resolve like `/alice`, not 404."""
responses.add(responses.GET, "http://gen:5002/api/alice",
body=b"<svg>ready</svg>", status=200,
headers={"X-Widget-Status": "ready", "Content-Type": "image/svg+xml"})
r = client.get("/alice/")
assert r.status_code == 200
assert r.data == b"<svg>ready</svg>"
def test_health(client):
r = client.get("/health")
assert r.status_code == 200
+91
View File
@@ -0,0 +1,91 @@
"""Fetcher analytics — record fetch latency + push batches to the generator.
The hot path enqueues; a daemon thread flushes batches over the internal
Docker network. On push failure we drop the batch and keep going.
"""
import logging
import threading
import time
from collections import deque
import requests
from . import config
log = logging.getLogger("fetcher.analytics")
_QUEUE: deque = deque(maxlen=config.ANALYTICS_QUEUE_MAX)
_QUEUE_LOCK = threading.Lock()
_THREAD_LOCK = threading.Lock()
_FLUSH_THREAD: threading.Thread | None = None
_events_dropped: int = 0
_drop_lock = threading.Lock()
def _reset_for_tests() -> None:
global _events_dropped, _FLUSH_THREAD, _QUEUE
with _QUEUE_LOCK:
_QUEUE = deque(maxlen=config.ANALYTICS_QUEUE_MAX)
with _drop_lock:
_events_dropped = 0
_FLUSH_THREAD = None
def record_fetch(username: str, status: int, latency_ms: int) -> None:
ev = {
"ts": int(time.time()),
"service": "fetcher",
"kind": "fetch",
"username": username,
"endpoint": "github/users/<u>",
"widget": None,
"status": int(status),
"latency_ms": int(latency_ms),
"cache_hit": None,
}
global _events_dropped
with _QUEUE_LOCK:
if len(_QUEUE) >= _QUEUE.maxlen:
with _drop_lock:
_events_dropped += 1
return
_QUEUE.append(ev)
def flush_now() -> int:
with _QUEUE_LOCK:
batch = list(_QUEUE)
_QUEUE.clear()
if not batch:
return 0
if not config.GENERATOR_URL or not config.INTERNAL_TOKEN:
return 0
try:
requests.post(
f"{config.GENERATOR_URL}/internal/analytics/events",
headers={"X-Internal-Token": config.INTERNAL_TOKEN},
json={"events": batch},
timeout=2,
)
except Exception:
log.warning("analytics flush failed (events lost)", exc_info=True)
return 0
return len(batch)
def _flush_loop():
while True:
time.sleep(config.ANALYTICS_FLUSH_SECONDS)
try:
flush_now()
except Exception:
log.exception("flush loop error")
def start_flush_thread():
global _FLUSH_THREAD
with _THREAD_LOCK:
if _FLUSH_THREAD is not None and _FLUSH_THREAD.is_alive():
return
t = threading.Thread(target=_flush_loop, name="fetcher-analytics-flush", daemon=True)
t.start()
_FLUSH_THREAD = t
+189 -6
View File
@@ -1,12 +1,46 @@
"""Flask app for the fetcher service. All endpoints require X-Internal-Token."""
import hmac
import logging
import re
import threading
import time
import requests
from concurrent.futures import ThreadPoolExecutor
from flask import Flask, jsonify, request, Response
from functools import wraps
from . import config, db, github
from . import analytics, config, db, github
app = Flask(__name__)
log = logging.getLogger("fetcher.api")
analytics.start_flush_thread()
# Background pool for /fetch-async. The fetch routinely takes 10-20s of
# wall clock even after parallelization, which is too long to hold an HTTP
# request open from the generator (it would block the worker on its hot
# path). Submitting to this pool lets us return 202 immediately and call
# the generator back when the fetch finishes.
_BG_POOL = ThreadPoolExecutor(
max_workers=max(1, config.ASYNC_FETCH_WORKERS),
thread_name_prefix="fetch-bg",
)
# Per-process in-flight set. If two callers ask us to fetch the same user
# while the first fetch is still running, we ack the second one without
# starting a duplicate GitHub call. Per-process only — fine for v1's single
# fetcher container; a multi-replica deploy would need a distributed lock.
_INFLIGHT: set[str] = set()
_INFLIGHT_LOCK = threading.Lock()
# Must stay in sync with github.py's _USERNAME_RE. Trust boundary: the
# fetcher is called only by the generator over the internal network, but
# a compromised/bugged generator must not be able to turn us into an
# arbitrary GitHub URL fetcher.
_USERNAME_RE = re.compile(r"^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$")
def _valid_username(u) -> bool:
return isinstance(u, str) and bool(_USERNAME_RE.match(u))
def require_internal_token(fn):
@@ -24,15 +58,44 @@ def health():
return jsonify({"status": "ok", "service": "fetcher", "users": len(db.list_usernames())})
@app.route("/metrics", methods=["GET"])
def metrics():
"""Prometheus-format fetch-outcome counters for the monitoring stack.
Deliberately unauthenticated (the rest of the API requires the internal
token): it exposes only aggregate counts — no usernames, no payloads — and
the scraper (vmagent) can't send our internal header. The counts are read
from fetcher.db, so they include the cron container's fetches too."""
counts = db.read_fetch_metrics()
lines = [
"# HELP ghstats_fetch_total GitHub fetch outcomes by result.",
"# TYPE ghstats_fetch_total counter",
]
for outcome, n in counts.items():
lines.append(f'ghstats_fetch_total{{outcome="{outcome}"}} {n}')
return Response("\n".join(lines) + "\n", mimetype="text/plain; version=0.0.4")
@app.route("/data/<username>", methods=["GET"])
@require_internal_token
def get_data(username: str):
if not _valid_username(username):
return jsonify({"error": "invalid_username"}), 400
row = db.get_user(username)
if row is None:
# Auto-fetch path
data = github.fetch_github_data(username, token=config.GITHUB_PAT)
t0 = time.monotonic()
try:
data = github.fetch_github_data(username, token=config.GITHUB_PAT)
except Exception:
analytics.record_fetch(username, 502, int((time.monotonic() - t0) * 1000))
log.exception("github fetch failed for %s", username)
return jsonify({"error": "fetch_failed"}), 502
if _is_github_not_found(data):
data = {"error": "not_found"}
analytics.record_fetch(username, 404, int((time.monotonic() - t0) * 1000))
else:
analytics.record_fetch(username, 200, int((time.monotonic() - t0) * 1000))
h = db.upsert_user(username, data)
return jsonify({"data": data, "payload_hash": h, "fetched": True})
return jsonify({
@@ -48,24 +111,126 @@ def get_data(username: str):
def force_fetch():
body = request.get_json(silent=True) or {}
username = body.get("username")
if not username:
return jsonify({"error": "username required"}), 400
if not _valid_username(username):
return jsonify({"error": "invalid_username"}), 400
t0 = time.monotonic()
try:
data = github.fetch_github_data(username, token=config.GITHUB_PAT)
except Exception as e:
return jsonify({"error": f"fetch failed: {e}"}), 502
# Previously returned f"fetch failed: {e}" which leaks internal
# exception text (URLs, stack fragments) across the trust boundary.
analytics.record_fetch(username, 502, int((time.monotonic() - t0) * 1000))
_record_fetch_failure(username, e)
return jsonify({"error": "fetch_failed"}), 502
if _is_github_not_found(data):
data = {"error": "not_found"}
analytics.record_fetch(username, 404, int((time.monotonic() - t0) * 1000))
db.bump_fetch_metric("not_found")
else:
analytics.record_fetch(username, 200, int((time.monotonic() - t0) * 1000))
db.bump_fetch_metric("ok")
old = db.get_user(username)
old_hash = old["payload_hash"] if old else None
new_hash = db.upsert_user(username, data)
return jsonify({"stored": True, "payload_hash": new_hash, "changed": old_hash != new_hash})
def _bg_fetch(username: str) -> None:
"""Background fetch + generator callback. Runs on _BG_POOL.
Always notifies the generator on completion (including not_found and
failure cases) so the generator can decide whether to enqueue a build,
persist a not_found marker, or do nothing. Without the callback the
generator would have to poll, which is exactly the design we're
removing — the worker used to block on the synchronous /data call and
time out on long fetches.
"""
try:
t0 = time.monotonic()
try:
data = github.fetch_github_data(username, token=config.GITHUB_PAT)
if _is_github_not_found(data):
data = {"error": "not_found"}
analytics.record_fetch(username, 404, int((time.monotonic() - t0) * 1000))
db.bump_fetch_metric("not_found")
else:
analytics.record_fetch(username, 200, int((time.monotonic() - t0) * 1000))
db.bump_fetch_metric("ok")
payload_hash = db.upsert_user(username, data)
ok = True
except Exception as e:
analytics.record_fetch(username, 502, int((time.monotonic() - t0) * 1000))
_record_fetch_failure(username, e)
payload_hash = ""
ok = False
_notify_generator_data_ready(username, payload_hash, ok)
finally:
with _INFLIGHT_LOCK:
_INFLIGHT.discard(username)
def _notify_generator_data_ready(username: str, payload_hash: str, ok: bool) -> None:
if not config.GENERATOR_URL or not config.INTERNAL_TOKEN:
return
try:
requests.post(
f"{config.GENERATOR_URL}/internal/data-ready",
headers={"X-Internal-Token": config.INTERNAL_TOKEN},
json={"username": username, "payload_hash": payload_hash, "ok": ok},
timeout=5,
)
except Exception:
log.warning("data-ready callback to generator failed for %s", username, exc_info=True)
@app.route("/fetch-async", methods=["POST"])
@require_internal_token
def fetch_async():
"""Kick off a background GitHub fetch and return immediately.
The generator calls this on enrollment so the user-perceived latency
isn't bounded by GitHub's response time + the generator's HTTP
timeout. When the fetch completes the fetcher posts back to
/internal/data-ready on the generator, which is what enqueues the
build job.
"""
body = request.get_json(silent=True) or {}
username = body.get("username")
if not _valid_username(username):
return jsonify({"error": "invalid_username"}), 400
with _INFLIGHT_LOCK:
if username in _INFLIGHT:
return jsonify({"queued": True, "already_inflight": True}), 202
_INFLIGHT.add(username)
try:
_BG_POOL.submit(_bg_fetch, username)
except RuntimeError:
# Pool was shut down (process exiting). Drop the in-flight marker
# so a retry after restart isn't blocked by a stale entry.
with _INFLIGHT_LOCK:
_INFLIGHT.discard(username)
return jsonify({"error": "shutting_down"}), 503
return jsonify({"queued": True}), 202
@app.route("/avatar/<username>", methods=["GET"])
@require_internal_token
def avatar(username: str):
r = requests.get(f"https://github.com/{username}.png", timeout=config.API_TIMEOUT, allow_redirects=True)
# SSRF surface: we build https://github.com/<u>.png from path input. The
# <username> Flask converter already refuses slashes, but allowlist the
# shape anyway so any future change to the proxy path can't turn into a
# URL-smuggling primitive.
if not _valid_username(username):
return jsonify({"error": "invalid_username"}), 400
try:
r = requests.get(
f"https://github.com/{username}.png",
timeout=config.API_TIMEOUT,
allow_redirects=True,
)
except Exception:
log.exception("avatar fetch failed for %s", username)
return jsonify({"error": "avatar_unavailable"}), 502
if r.status_code != 200:
return jsonify({"error": "avatar unavailable"}), 404
return Response(r.content, mimetype=r.headers.get("Content-Type", "image/png"))
@@ -77,9 +242,27 @@ def _is_github_not_found(data: dict) -> bool:
return True
if isinstance(user, dict) and user.get("message") == "Not Found":
return True
# An error body (rate limit, abuse detection, anything else GitHub answers
# with a bare {"message": ...}) carries no login. It is not user data and
# must never be recorded as a successful fetch. github.py raises
# GitHubTransientError before we get here in practice; this is the backstop.
if isinstance(user, dict) and "login" not in user:
return True
return False
def _record_fetch_failure(username: str, exc: Exception) -> None:
"""Classify a failed fetch for metrics + logs. A transient failure (rate
limit / 5xx / network) is the signal worth surfacing: it means we aborted
and kept the last-good record instead of persisting zeros."""
if isinstance(exc, github.GitHubTransientError):
db.bump_fetch_metric("rate_limited")
log.warning("github fetch transient failure for %s (kept last-good): %s", username, exc)
else:
db.bump_fetch_metric("error")
log.exception("github fetch failed for %s", username)
def main():
db.init_db()
app.run(host="0.0.0.0", port=config.PORT)
+10
View File
@@ -9,6 +9,13 @@ REFRESH_INTERVAL_HOURS = int(os.getenv("FETCHER_REFRESH_INTERVAL_HOURS", "24"))
TRIAL_GC_DAYS = int(os.getenv("FETCHER_TRIAL_GC_DAYS", "7"))
API_TIMEOUT = int(os.getenv("API_TIMEOUT", "15"))
# Generator URL is used as a callback target when a /fetch-async background
# task completes. Token-protected via the same FETCHER_INTERNAL_TOKEN that
# secures generator -> fetcher calls. Empty string disables the callback,
# which is fine for tests and one-shot scripts.
GENERATOR_URL = os.getenv("GENERATOR_URL", "http://localhost:5002")
ASYNC_FETCH_WORKERS = int(os.getenv("FETCHER_ASYNC_WORKERS", "2"))
# Collaborator-detection tuning
COLLABORATOR_MAX_REPO_SIZE = int(os.getenv("COLLABORATOR_MAX_REPO_SIZE", "150"))
COLLABORATOR_TOP_REPOS = int(os.getenv("COLLABORATOR_TOP_REPOS", "30"))
@@ -23,3 +30,6 @@ DEEP_COLLAB_THRESHOLD = int(os.getenv("DEEP_COLLAB_THRESHOLD", "25"))
# Commit-fetching caps
COMMIT_MAX_REPOS = int(os.getenv("COMMIT_MAX_REPOS", "10"))
COMMIT_PER_REPO = int(os.getenv("COMMIT_PER_REPO", "30"))
ANALYTICS_FLUSH_SECONDS = int(os.getenv("ANALYTICS_FLUSH_SECONDS", "5"))
ANALYTICS_QUEUE_MAX = int(os.getenv("ANALYTICS_QUEUE_MAX", "2000"))
+8
View File
@@ -18,9 +18,17 @@ def tick(hours: int, active_within_days: int, gc_days: int) -> dict:
user = data.get("user")
if user is None or (isinstance(user, dict) and user.get("message") == "Not Found"):
data = {"error": "not_found"}
db.bump_fetch_metric("not_found")
else:
db.bump_fetch_metric("ok")
db.upsert_user(username, data)
refreshed += 1
except github.GitHubTransientError as e:
db.bump_fetch_metric("rate_limited")
log.warning("refresh rate-limited for %s (kept last-good): %s", username, e)
failed += 1
except Exception as e:
db.bump_fetch_metric("error")
log.warning("refresh failed for %s: %s", username, e)
failed += 1
gc_removed = db.delete_stale(days=gc_days)
+44
View File
@@ -25,8 +25,20 @@ CREATE TABLE IF NOT EXISTS users (
);
CREATE INDEX IF NOT EXISTS idx_users_fetched_at ON users(fetched_at);
CREATE INDEX IF NOT EXISTS idx_users_last_requested_at ON users(last_requested_at);
-- Monotonic fetch-outcome counters, shared across the web workers and the
-- cron container (both mount the same fetcher.db). Scraped via /metrics so
-- rate limits surface in the monitoring stack instead of dying silently.
CREATE TABLE IF NOT EXISTS fetch_metrics (
outcome TEXT PRIMARY KEY,
count INTEGER NOT NULL DEFAULT 0
);
"""
# The full label set is emitted even at zero so the counter exists in the
# scrape target from the first request (rate() needs a prior sample to work).
FETCH_OUTCOMES = ("ok", "not_found", "rate_limited", "error")
def _now() -> str:
return datetime.utcnow().isoformat(timespec="seconds") + "Z"
@@ -119,3 +131,35 @@ def users_due_for_refresh(hours: int, active_within_days: int) -> list[str]:
def list_usernames() -> list[str]:
with _connect() as c:
return [r["username"] for r in c.execute("SELECT username FROM users ORDER BY username").fetchall()]
def bump_fetch_metric(outcome: str, n: int = 1) -> None:
"""Increment the counter for a fetch outcome (one of FETCH_OUTCOMES).
Best-effort telemetry: a metrics write must never break a fetch, so
failures are swallowed."""
if outcome not in FETCH_OUTCOMES:
outcome = "error"
try:
with _connect() as c:
c.execute(
"""INSERT INTO fetch_metrics(outcome, count) VALUES (?, ?)
ON CONFLICT(outcome) DO UPDATE SET count = count + excluded.count""",
(outcome, n),
)
c.commit()
except sqlite3.Error:
pass
def read_fetch_metrics() -> dict:
"""Return {outcome: count} for every outcome in FETCH_OUTCOMES (zero-filled)."""
counts = {o: 0 for o in FETCH_OUTCOMES}
try:
with _connect() as c:
for row in c.execute("SELECT outcome, count FROM fetch_metrics"):
if row["outcome"] in counts:
counts[row["outcome"]] = row["count"]
except sqlite3.Error:
pass
return counts
+292 -96
View File
@@ -1,12 +1,80 @@
"""GitHub data fetching functions."""
import re
import requests
import base64
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Optional, Protocol
from . import config
# GitHub's own username rules: alphanumerics and hyphens, 1–39 chars, no
# leading/trailing hyphen, no double-hyphens. The fetcher hard-refuses
# anything else before it reaches URL construction or GraphQL interpolation —
# the generator validates too, but this is the last line of defense before
# we talk to GitHub on a caller's behalf.
_USERNAME_RE = re.compile(r"^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$")
# Repo full names: owner/repo. Owner matches the username rule; repo allows the
# same chars plus dot and underscore (matches GitHub's repo-name regex).
_REPO_FULL_NAME_RE = re.compile(
r"^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}"
r"/[A-Za-z0-9_.-]{1,100}$"
)
def _assert_username(name: str) -> str:
if not isinstance(name, str) or not _USERNAME_RE.match(name):
raise ValueError(f"invalid github username: {name!r}")
return name
def _assert_repo_full_name(name: str) -> str:
if not isinstance(name, str) or not _REPO_FULL_NAME_RE.match(name):
raise ValueError(f"invalid github repo name: {name!r}")
return name
class GitHubTransientError(Exception):
"""A GitHub call failed transiently (rate limit, 5xx, or a network error)
rather than returning real data.
This MUST NOT be swallowed into a zero/empty count. A contribution count
computed from a rate-limited response is 0, and persisting that 0 silently
overwrites the last good value in fetcher.db — which is exactly how a
traffic spike turns into permanently-wrong "0 commits" cards until the
next successful fetch. Propagate it instead so the caller aborts the fetch
and keeps the previously-cached record."""
def _raise_if_transient(resp) -> None:
"""Raise GitHubTransientError if `resp` looks like a rate limit or server
error. A genuine NOT_FOUND (unknown user) is left alone — that is a real,
persistable "this user has no data" answer, not a transient failure."""
if resp.status_code in (429, 500, 502, 503, 504):
raise GitHubTransientError(f"HTTP {resp.status_code}")
# Primary/secondary REST rate limits come back as 403 with the remaining
# budget at 0 (or a "secondary rate limit" message).
if resp.status_code == 403 and resp.headers.get("X-RateLimit-Remaining") == "0":
raise GitHubTransientError("REST rate limit exhausted")
if resp.status_code == 403 and "rate limit" in (resp.text or "").lower():
raise GitHubTransientError("REST rate limit exhausted")
# GraphQL reports rate limits as HTTP 200 with an `errors` array — the same
# 200 that a valid response uses — so the body has to be inspected.
try:
body = resp.json()
except ValueError:
return
# REST list endpoints (events, repos, contributors) answer with a JSON
# array — only a GraphQL-shaped object can carry an `errors` block.
if not isinstance(body, dict):
return
for err in (body.get("errors") or []):
if err.get("type") in ("RATE_LIMITED", "SERVICE_UNAVAILABLE"):
raise GitHubTransientError(err.get("message") or err.get("type"))
class GitHubDataSource(Protocol):
"""Protocol for GitHub data sources - allows swapping implementations."""
@@ -46,6 +114,10 @@ class GitHubDataSource(Protocol):
"""Fetch and encode avatar as base64."""
...
def fetch_repo_languages(self, full_name: str) -> dict:
"""Return {language: bytes} for a single repo, or {} on failure."""
...
class DirectAPISource:
"""Direct GitHub API implementation - for immediate requests."""
@@ -96,26 +168,36 @@ class DirectAPISource:
def fetch_user_data(self, username: str) -> dict:
"""Fetch user profile data."""
return requests.get(
_assert_username(username)
resp = requests.get(
f"{self.base}/users/{username}",
headers=self.headers
).json()
headers=self.headers,
timeout=config.API_TIMEOUT,
)
_raise_if_transient(resp)
return resp.json()
def fetch_repos(self, username: str) -> list:
"""Fetch user repositories (owned + contributed to)."""
# Fetch owned repos
owned = requests.get(
f"{self.base}/users/{username}/repos",
headers=self.headers,
params={"per_page": 100, "sort": "pushed", "type": "owner"},
).json()
_assert_username(username)
# Fetch all repos (includes collabs, orgs)
all_repos = requests.get(
f"{self.base}/users/{username}/repos",
headers=self.headers,
params={"per_page": 100, "sort": "pushed", "type": "all"},
).json()
def _get(repo_type: str):
resp = requests.get(
f"{self.base}/users/{username}/repos",
headers=self.headers,
params={"per_page": 100, "sort": "pushed", "type": repo_type},
timeout=config.API_TIMEOUT,
)
_raise_if_transient(resp)
return resp.json()
# The two REST calls are independent — fire them in parallel so the
# second isn't waiting on the first to come back.
with ThreadPoolExecutor(max_workers=2, thread_name_prefix="fetch-repos") as pool:
fut_owned = pool.submit(_get, "owner")
fut_all = pool.submit(_get, "all")
owned = fut_owned.result()
all_repos = fut_all.result()
# Combine and deduplicate
repos = owned if isinstance(owned, list) else []
@@ -131,12 +213,16 @@ class DirectAPISource:
def fetch_events(self, username: str) -> list:
"""Fetch user events."""
_assert_username(username)
resp = requests.get(
f"{self.base}/users/{username}/events",
headers=self.headers,
params={"per_page": 100},
).json()
return resp if isinstance(resp, list) else []
timeout=config.API_TIMEOUT,
)
_raise_if_transient(resp)
events = resp.json()
return events if isinstance(events, list) else []
def fetch_commits(self, username: str, repos: list = None) -> list:
"""
@@ -155,28 +241,33 @@ class DirectAPISource:
from datetime import datetime
try:
_assert_username(username)
# Get the last year of contribution data
now = datetime.now()
one_year_ago = now.replace(year=now.year - 1)
from_date = one_year_ago.strftime("%Y-%m-%dT%H:%M:%SZ")
to_date = now.strftime("%Y-%m-%dT%H:%M:%SZ")
query = f'''
query {{
user(login: "{username}") {{
contributionsCollection(from: "{from_date}", to: "{to_date}") {{
contributionCalendar {{
weeks {{
contributionDays {{
# Parameterize username + date range — interpolating username into
# the query lets a malicious name break out of the string literal
# and smuggle additional GraphQL fields. GitHub's PAT scopes bound
# the damage, but the injection is still worth shutting down.
query = """
query($login: String!, $from: DateTime!, $to: DateTime!) {
user(login: $login) {
contributionsCollection(from: $from, to: $to) {
contributionCalendar {
weeks {
contributionDays {
date
contributionCount
}}
}}
}}
}}
}}
}}
'''
}
}
}
}
}
}
"""
headers = {
**self.headers,
@@ -188,7 +279,10 @@ class DirectAPISource:
resp = requests.post(
'https://api.github.com/graphql',
json={'query': query},
json={
'query': query,
'variables': {'login': username, 'from': from_date, 'to': to_date},
},
headers=headers,
timeout=config.API_TIMEOUT
)
@@ -245,6 +339,13 @@ class DirectAPISource:
return self._fetch_commit_count_graphql_range(username, since_date)
else:
return self._fetch_commit_count_graphql_alltime(username)
except GitHubTransientError:
# Rate limit / 5xx: abort the fetch so the caller keeps the last
# good count instead of persisting a spurious 0.
raise
except requests.RequestException as e:
# A network-level failure is transient too.
raise GitHubTransientError(str(e))
except Exception as e:
print(f" Error fetching contribution count: {e}")
return 0
@@ -253,6 +354,7 @@ class DirectAPISource:
"""Fetch all-time contribution count using GraphQL."""
from datetime import datetime
_assert_username(username)
# First, get account creation date
query = '''
query($username: String!) {
@@ -277,6 +379,7 @@ class DirectAPISource:
timeout=config.API_TIMEOUT
)
_raise_if_transient(resp)
if not resp.ok or 'data' not in resp.json():
print(f" GraphQL error: {resp.status_code}")
return 0
@@ -289,39 +392,51 @@ class DirectAPISource:
created_year = int(created_at[:4])
current_year = datetime.now().year
# Fetch year by year
total_contributions = 0
# Fetch year by year, in parallel. Sequentially this was 1 request
# per year of account age (~7-10 calls for typical accounts), each
# ~1s — easily a 10s wall-clock contributor on its own.
print(f" Fetching contributions from {created_year} to {current_year}...")
for year in range(created_year, current_year + 1):
year_query = f'''
query {{
user(login: "{username}") {{
contributionsCollection(from: "{year}-01-01T00:00:00Z", to: "{year}-12-31T23:59:59Z") {{
contributionCalendar {{
totalContributions
}}
}}
}}
}}
'''
year_query = """
query($login: String!, $from: DateTime!, $to: DateTime!) {
user(login: $login) {
contributionsCollection(from: $from, to: $to) {
contributionCalendar { totalContributions }
}
}
}
"""
def _fetch_year(year: int) -> tuple[int, int]:
year_resp = requests.post(
'https://api.github.com/graphql',
json={'query': year_query},
json={
'query': year_query,
'variables': {
'login': username,
'from': f"{year}-01-01T00:00:00Z",
'to': f"{year}-12-31T23:59:59Z",
},
},
headers=headers,
timeout=config.API_TIMEOUT
timeout=config.API_TIMEOUT,
)
if year_resp.ok:
year_data = year_resp.json()
if 'data' in year_data and year_data['data'].get('user'):
year_contributions = year_data['data']['user']['contributionsCollection']['contributionCalendar']['totalContributions']
total_contributions += year_contributions
print(f" {year}: {year_contributions:,} contributions")
else:
print(f" {year}: Error - {year_data}")
else:
_raise_if_transient(year_resp)
if not year_resp.ok:
print(f" {year}: HTTP {year_resp.status_code}")
return year, 0
year_data = year_resp.json()
if 'data' in year_data and year_data['data'].get('user'):
n = year_data['data']['user']['contributionsCollection']['contributionCalendar']['totalContributions']
return year, n
print(f" {year}: Error - {year_data}")
return year, 0
years = list(range(created_year, current_year + 1))
total_contributions = 0
with ThreadPoolExecutor(max_workers=min(10, len(years) or 1)) as pool:
for year, n in sorted(pool.map(_fetch_year, years)):
total_contributions += n
print(f" {year}: {n:,} contributions")
print(f" GraphQL API found {total_contributions:,} contributions (all-time)")
return total_contributions
@@ -330,21 +445,20 @@ class DirectAPISource:
"""Fetch contribution count for a specific date range using GraphQL."""
from datetime import datetime
_assert_username(username)
# Convert since_date to proper format
from_date = f"{since_date}T00:00:00Z"
to_date = datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
query = f'''
query {{
user(login: "{username}") {{
contributionsCollection(from: "{from_date}", to: "{to_date}") {{
contributionCalendar {{
totalContributions
}}
}}
}}
}}
'''
query = """
query($login: String!, $from: DateTime!, $to: DateTime!) {
user(login: $login) {
contributionsCollection(from: $from, to: $to) {
contributionCalendar { totalContributions }
}
}
}
"""
headers = {
**self.headers,
@@ -356,11 +470,15 @@ class DirectAPISource:
resp = requests.post(
'https://api.github.com/graphql',
json={'query': query},
json={
'query': query,
'variables': {'login': username, 'from': from_date, 'to': to_date},
},
headers=headers,
timeout=config.API_TIMEOUT
timeout=config.API_TIMEOUT,
)
_raise_if_transient(resp)
if resp.ok:
data = resp.json()
if 'data' in data and data['data'].get('user'):
@@ -391,9 +509,14 @@ class DirectAPISource:
timeout=config.API_TIMEOUT
)
_raise_if_transient(resp)
if resp.ok:
data = resp.json()
return data.get("total_count", 0)
except GitHubTransientError:
raise
except requests.RequestException as e:
raise GitHubTransientError(str(e))
except Exception as e:
print(f"Warning: Failed to fetch PR count via search API: {e}")
@@ -418,6 +541,7 @@ class DirectAPISource:
timeout=config.API_TIMEOUT
)
_raise_if_transient(resp)
if resp.ok:
contributors = resp.json()
# Filter by minimum commits
@@ -425,6 +549,8 @@ class DirectAPISource:
c for c in contributors
if c.get("contributions", 0) >= min_commits
]
except GitHubTransientError:
raise
except Exception as e:
print(f"Warning: Failed to fetch contributors from {repo_name}: {e}")
@@ -502,6 +628,25 @@ class DirectAPISource:
pass
return ""
def fetch_repo_languages(self, full_name: str) -> dict:
"""Return {language: bytes} for a repo. REST returns exactly this
shape — total is summed client-side."""
try:
resp = requests.get(
f"{self.base}/repos/{full_name}/languages",
headers=self.headers,
timeout=config.API_TIMEOUT,
)
_raise_if_transient(resp)
if resp.ok:
data = resp.json()
return data if isinstance(data, dict) else {}
except GitHubTransientError:
raise
except Exception:
pass
return {}
# TODO: Future implementation for queue-based batching
# class QueuedAPISource:
@@ -536,34 +681,44 @@ def fetch_github_data(
# Use provided data source or default to direct API
source = data_source or DirectAPISource(token)
# Fetch all data through the data source abstraction
user = source.fetch_user_data(username)
repos = source.fetch_repos(username)
events = source.fetch_events(username)
commits = source.fetch_commits(username)
# Fetch contribution counts (commits + PRs + issues + reviews)
print(" Fetching all-time contribution count...")
total_commits = source.fetch_commit_count(username, repos)
# Recent contributions (last 6 months)
six_months_ago = (datetime.now() - timedelta(days=180)).strftime("%Y-%m-%d")
print(" Fetching recent contribution count (last 6 months)...")
recent_commits = source.fetch_commit_count(username, repos, since_date=six_months_ago)
# Fetch PR count
print(" Fetching PR count...")
total_prs = source.fetch_pr_count(username)
# Stage 1: every fetch with no dependencies on another fetch's result
# runs in parallel. Previously these 8 calls ran one at a time, so the
# whole pipeline was wait-time × 8. Each is I/O-bound (a single HTTPS
# request to GitHub or a small GraphQL query), so threading is the
# right primitive. _fetch_collaborators_data internally calls
# fetch_user_commit_repos and ignores the `repos` arg, so it has no
# ordering dependency on fetch_repos — start them together.
with ThreadPoolExecutor(max_workers=10, thread_name_prefix="fetch-stage1") as pool:
fut_user = pool.submit(source.fetch_user_data, username)
fut_repos = pool.submit(source.fetch_repos, username)
fut_events = pool.submit(source.fetch_events, username)
fut_commits = pool.submit(source.fetch_commits, username)
fut_total = pool.submit(source.fetch_commit_count, username, [])
fut_recent = pool.submit(source.fetch_commit_count, username, [], six_months_ago)
fut_prs = pool.submit(source.fetch_pr_count, username)
fut_collab = pool.submit(_fetch_collaborators_data, username, [], source)
# Fetch collaborators from user's active repos
collaborators_data = _fetch_collaborators_data(
username, repos, source
)
user = fut_user.result()
repos = fut_repos.result()
events = fut_events.result()
commits = fut_commits.result()
total_commits = fut_total.result()
recent_commits = fut_recent.result()
total_prs = fut_prs.result()
collaborators_data = fut_collab.result()
# Fetch avatar
# Stage 2: avatar needs user.avatar_url, languages need the repos list.
# Both run in parallel against each other.
avatar_b64 = ""
if user.get("avatar_url"):
avatar_b64 = source.fetch_avatar(user["avatar_url"])
avatar_url = user.get("avatar_url") if isinstance(user, dict) else None
with ThreadPoolExecutor(max_workers=2, thread_name_prefix="fetch-stage2") as pool:
fut_lang = pool.submit(_enrich_repo_languages, repos, source)
fut_avatar = pool.submit(source.fetch_avatar, avatar_url) if avatar_url else None
fut_lang.result()
if fut_avatar is not None:
avatar_b64 = fut_avatar.result()
return {
"user": user,
@@ -578,6 +733,26 @@ def fetch_github_data(
}
def _enrich_repo_languages(repos: list, source: GitHubDataSource) -> None:
"""Mutates `repos` in-place, attaching `language_bytes: {lang: bytes}` to
each repo. Uses a small thread pool — one REST call per repo is cheap
individually, but sequentially N repos would block the fetch noticeably."""
if not repos:
return
names = [(i, r["full_name"]) for i, r in enumerate(repos) if r.get("full_name")]
print(f" Fetching language byte breakdown for {len(names)} repos...")
with ThreadPoolExecutor(max_workers=10) as pool:
futures = {pool.submit(source.fetch_repo_languages, fn): i for i, fn in names}
for fut in as_completed(futures):
i = futures[fut]
try:
repos[i]["language_bytes"] = fut.result() or {}
except GitHubTransientError:
raise
except Exception:
repos[i]["language_bytes"] = {}
def _fetch_collaborators_data(
username: str,
repos: list,
@@ -634,14 +809,35 @@ def _fetch_collaborators_data(
qualifying = qualifying[:config.COLLABORATOR_TOP_REPOS]
print(f" Scoring collaborators across {len(qualifying)} qualifying repos")
# Step 3+4: fetch contributors and score
# Step 3: fetch contributors for all qualifying repos in parallel.
# The per-repo REST call is ~300-500ms; sequentially this dominated the
# whole fetch (30 repos × ~0.5s ≈ 15s). Fan out with the same pool size
# used for languages — GitHub's secondary rate limit tolerates this fine.
contributors_by_repo: dict[str, list] = {}
with ThreadPoolExecutor(max_workers=10) as pool:
futures = {
pool.submit(source.fetch_repo_contributors, r["full_name"], 1): r["full_name"]
for r in qualifying
}
for fut in as_completed(futures):
full_name = futures[fut]
try:
contributors_by_repo[full_name] = fut.result() or []
except GitHubTransientError:
raise
except Exception as e:
print(f" failed to fetch contributors for {full_name}: {e}")
contributors_by_repo[full_name] = []
# Step 4: score sequentially (cheap, in-memory) preserving the original
# `qualifying` order so deterministic-output tests still pass.
collab_stats: dict = {}
for r in qualifying:
full_name = r["full_name"]
user_commits = r["user_commits"]
boost = config.OWNER_BOOST if r["is_owner"] else 1.0
contributors = source.fetch_repo_contributors(full_name, min_commits=1)
contributors = contributors_by_repo.get(full_name, [])
# Drop huge OSS projects
if len(contributors) >= config.COLLABORATOR_MAX_REPO_SIZE:
print(f" skipping {full_name}: too many contributors ({len(contributors)})")
+57
View File
@@ -0,0 +1,57 @@
import os
import tempfile
import pytest
import responses
from src import analytics as a
from src import config as cfg
from src import db as dbmod
from src import api as apimod
@pytest.fixture
def client(monkeypatch):
with tempfile.TemporaryDirectory() as d:
monkeypatch.setattr(dbmod, "DB_PATH", os.path.join(d, "t.db"))
monkeypatch.setattr(apimod.config, "INTERNAL_TOKEN", "secret")
monkeypatch.setattr(apimod.config, "GITHUB_PAT", "ghp_test")
dbmod.init_db()
app = apimod.app
app.config["TESTING"] = True
with app.test_client() as c:
yield c
def test_record_fetch():
a._reset_for_tests()
a.record_fetch("alice", 200, 312)
assert len(a._QUEUE) == 1
e = a._QUEUE[0]
assert e["service"] == "fetcher"
assert e["kind"] == "fetch"
assert e["status"] == 200
assert e["latency_ms"] == 312
assert e["endpoint"] == "github/users/<u>"
@responses.activate
def test_flush_posts(monkeypatch):
monkeypatch.setattr(cfg, "GENERATOR_URL", "http://gen:5002")
monkeypatch.setattr(cfg, "INTERNAL_TOKEN", "secret")
a._reset_for_tests()
responses.add(responses.POST, "http://gen:5002/internal/analytics/events",
json={"ingested": 1}, status=200)
a.record_fetch("alice", 200, 100)
a.flush_now()
assert len(responses.calls) == 1
def test_force_fetch_records_event(monkeypatch, client):
a._reset_for_tests()
monkeypatch.setattr("src.api.github.fetch_github_data",
lambda u, token: {"user": {"login": u}})
r = client.post("/fetch",
headers={"X-Internal-Token": "secret"},
json={"username": "alice"})
assert r.status_code == 200
assert any(e["kind"] == "fetch" and e["username"] == "alice"
for e in a._QUEUE)
+154 -22
View File
@@ -30,33 +30,57 @@ def test_endpoints_require_internal_token(client):
assert r.status_code == 401
def test_metrics_endpoint_no_auth_and_prometheus_format(client):
from src import db as dbmod
dbmod.bump_fetch_metric("ok")
dbmod.bump_fetch_metric("rate_limited")
r = client.get("/metrics")
assert r.status_code == 200
body = r.get_data(as_text=True)
assert "# TYPE ghstats_fetch_total counter" in body
assert 'ghstats_fetch_total{outcome="ok"} 1' in body
assert 'ghstats_fetch_total{outcome="rate_limited"} 1' in body
# Every outcome is emitted even at zero so rate() has a baseline sample.
assert 'ghstats_fetch_total{outcome="not_found"} 0' in body
@resp_lib.activate
def test_data_auto_fetches_on_miss(client, monkeypatch):
# fetch_commits: contributionCalendar/weeks
resp_lib.add(resp_lib.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"contributionCalendar": {"weeks": []}}}}}, status=200)
# fetch_commit_count (alltime) — first call: get createdAt
resp_lib.add(resp_lib.POST, "https://api.github.com/graphql",
json={"data": {"user": {"createdAt": "2020-01-01T00:00:00Z"}}}, status=200)
# fetch_commit_count (alltime) — per-year contribution totals (2020–2026, 7 years)
for _ in range(7):
resp_lib.add(resp_lib.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"contributionCalendar": {"totalContributions": 10}}}}},
status=200)
# fetch_commit_count (recent, last 6 months)
resp_lib.add(resp_lib.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"contributionCalendar": {"totalContributions": 5}}}}},
status=200)
# fetch_user_commit_repos (for collaborators)
resp_lib.add(resp_lib.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"commitContributionsByRepository": []}}}},
status=200)
# PR count search
# The fetcher fires the independent GitHub calls in parallel, so we
# can't rely on a fixed FIFO order of `resp_lib.add` calls. Match each
# GraphQL call by inspecting the request body and returning the right
# response for that query — this mirrors how the real GitHub API
# routes by query content rather than insertion order.
import json as _json
def _graphql_callback(request):
body = _json.loads(request.body)
q = body.get("query", "")
variables = body.get("variables", {})
if "weeks" in q:
data = {"user": {"contributionsCollection": {"contributionCalendar": {"weeks": []}}}}
elif "createdAt" in q:
data = {"user": {"createdAt": "2020-01-01T00:00:00Z"}}
elif "commitContributionsByRepository" in q:
data = {"user": {"contributionsCollection": {"commitContributionsByRepository": []}}}
elif "contributionCalendar" in q and "totalContributions" in q:
# Both alltime per-year and 6-month range queries land here. Tests
# don't care about the exact totals — just that a number comes back.
data = {"user": {"contributionsCollection": {"contributionCalendar": {"totalContributions": 10}}}}
else:
data = {"user": None}
return (200, {}, _json.dumps({"data": data}))
resp_lib.add_callback(resp_lib.POST, "https://api.github.com/graphql",
callback=_graphql_callback)
resp_lib.add(resp_lib.GET, "https://api.github.com/search/issues",
json={"total_count": 0, "items": []}, status=200)
resp_lib.add(resp_lib.GET, "https://api.github.com/users/alice",
json={"login": "alice", "public_repos": 1, "followers": 0, "avatar_url": "https://avatars.example/a"}, status=200)
# fetch_repos: two calls (owner + all)
json={"login": "alice", "public_repos": 1, "followers": 0,
"avatar_url": "https://avatars.example/a"},
status=200)
# fetch_repos fires the owner+all calls in parallel; both hit the same URL.
resp_lib.add(resp_lib.GET, "https://api.github.com/users/alice/repos", json=[], status=200)
resp_lib.add(resp_lib.GET, "https://api.github.com/users/alice/repos", json=[], status=200)
resp_lib.add(resp_lib.GET, "https://api.github.com/users/alice/events", json=[], status=200)
@@ -71,3 +95,111 @@ def test_data_auto_fetches_on_miss(client, monkeypatch):
def test_force_fetch_requires_auth(client):
r = client.post("/fetch", json={"username": "alice"})
assert r.status_code == 401
def test_fetch_async_requires_auth(client):
r = client.post("/fetch-async", json={"username": "alice"})
assert r.status_code == 401
def test_fetch_async_rejects_invalid_username(client):
r = client.post("/fetch-async", headers={"X-Internal-Token": "secret"},
json={"username": "../etc/passwd"})
assert r.status_code == 400
def test_fetch_async_runs_in_background_and_calls_back(client, monkeypatch):
"""The async path must (a) return 202 immediately without waiting for
GitHub, and (b) POST back to the generator's /internal/data-ready when
the background fetch completes. Without (a) we'd be back to the old
synchronous-blocking design that timed out the worker; without (b)
nothing would ever enqueue the build job."""
import threading
from src import api as apimod
fetch_done = threading.Event()
callback_calls: list = []
def fake_fetch(username, token=None):
# Block briefly so the test can prove /fetch-async returned before
# this finished.
fetch_done.wait(timeout=2)
return {"user": {"login": username, "avatar_url": "x"}, "repos": []}
def fake_post(url, headers=None, json=None, timeout=None):
callback_calls.append({"url": url, "json": json, "headers": headers})
class _R: status_code = 200
return _R()
monkeypatch.setattr(apimod.github, "fetch_github_data", fake_fetch)
monkeypatch.setattr(apimod.requests, "post", fake_post)
monkeypatch.setattr(apimod.config, "GENERATOR_URL", "http://gen:5002")
r = client.post("/fetch-async", headers={"X-Internal-Token": "secret"},
json={"username": "alice"})
assert r.status_code == 202
assert r.get_json()["queued"] is True
# Let the background fetch finish; wait for the callback.
fetch_done.set()
for _ in range(50):
if callback_calls:
break
threading.Event().wait(0.05)
assert len(callback_calls) == 1
cb = callback_calls[0]
assert cb["url"] == "http://gen:5002/internal/data-ready"
assert cb["json"]["username"] == "alice"
assert cb["json"]["ok"] is True
assert cb["json"]["payload_hash"]
def test_fetch_async_dedupes_inflight(client, monkeypatch):
"""A second /fetch-async call for the same user while the first is
still in flight must not start a second GitHub fetch."""
import threading
from src import api as apimod
started = threading.Event()
release = threading.Event()
fetch_calls = {"n": 0}
def fake_fetch(username, token=None):
fetch_calls["n"] += 1
started.set()
release.wait(timeout=2)
return {"user": {"login": username, "avatar_url": "x"}, "repos": []}
monkeypatch.setattr(apimod.github, "fetch_github_data", fake_fetch)
monkeypatch.setattr(apimod.requests, "post", lambda *a, **kw: type("R", (), {"status_code": 200})())
monkeypatch.setattr(apimod.config, "GENERATOR_URL", "")
r1 = client.post("/fetch-async", headers={"X-Internal-Token": "secret"},
json={"username": "alice"})
assert r1.status_code == 202
assert started.wait(timeout=2)
r2 = client.post("/fetch-async", headers={"X-Internal-Token": "secret"},
json={"username": "alice"})
assert r2.status_code == 202
assert r2.get_json().get("already_inflight") is True
release.set()
# Drain
for _ in range(50):
if fetch_calls["n"] >= 1 and "alice" not in apimod._INFLIGHT:
break
threading.Event().wait(0.05)
assert fetch_calls["n"] == 1
def test_rate_limit_body_is_not_classified_as_valid_user_data():
# A rate-limit body reaching the classifier must never take the success
# branch — that is what overwrote a good record with a blank card.
data = {"user": {"message": "API rate limit exceeded for user ID 123.",
"documentation_url": "https://docs.github.com/"}}
assert apimod._is_github_not_found(data) is True
assert apimod._is_github_not_found({"user": {"login": "alice"}}) is False
assert apimod._is_github_not_found({"user": {"message": "Not Found"}}) is True
assert apimod._is_github_not_found({"user": None}) is True
+17
View File
@@ -4,6 +4,7 @@ import pytest
from unittest.mock import patch
from src import db as dbmod
from src import cron as cronmod
from src import github as ghmod
@pytest.fixture
@@ -26,6 +27,22 @@ def test_refresh_tick_calls_github_for_due_users(tmp_db):
assert stats["refreshed"] == 1
def test_refresh_rate_limit_keeps_last_good_and_counts_metric(tmp_db):
# A rate-limited refresh must NOT overwrite the cached row, and must be
# counted as rate_limited so the monitoring stack can see it.
dbmod.upsert_user("alice", {"user": {"login": "alice"}, "total_commits": 1841})
with dbmod._connect() as c:
c.execute("UPDATE users SET fetched_at='2020-01-01T00:00:00Z', last_requested_at=? WHERE username='alice'",
(dbmod._now(),))
with patch("src.cron.github.fetch_github_data",
side_effect=ghmod.GitHubTransientError("rate limited")):
stats = cronmod.tick(hours=24, active_within_days=7, gc_days=7)
assert stats["failed"] == 1 and stats["refreshed"] == 0
# Last-good data retained.
assert dbmod.get_user("alice")["data"]["total_commits"] == 1841
assert dbmod.read_fetch_metrics()["rate_limited"] == 1
def test_tick_runs_gc_for_abandoned_trial_users(tmp_db):
dbmod.upsert_user("ghost", {"user": {"login": "ghost"}})
with dbmod._connect() as c:
+17
View File
@@ -30,6 +30,23 @@ def test_upsert_and_get_round_trip(tmp_db):
assert row["fetched_at"]
def test_fetch_metrics_round_trip(tmp_db):
# Zero-filled for every known outcome before anything is recorded.
assert dbmod.read_fetch_metrics() == {o: 0 for o in dbmod.FETCH_OUTCOMES}
dbmod.bump_fetch_metric("ok")
dbmod.bump_fetch_metric("ok")
dbmod.bump_fetch_metric("rate_limited")
counts = dbmod.read_fetch_metrics()
assert counts["ok"] == 2
assert counts["rate_limited"] == 1
assert counts["not_found"] == 0
def test_fetch_metric_unknown_outcome_buckets_to_error(tmp_db):
dbmod.bump_fetch_metric("bogus")
assert dbmod.read_fetch_metrics()["error"] == 1
def test_payload_hash_is_deterministic_and_changes_on_diff():
h1 = dbmod.payload_hash({"a": 1, "b": 2})
h2 = dbmod.payload_hash({"b": 2, "a": 1})
+215 -51
View File
@@ -5,61 +5,38 @@ from src import github
@responses.activate
def test_fetch_user_data_returns_user_payload():
# fetch_commits: contributionCalendar/weeks
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"contributionCalendar": {"weeks": []}}}}},
status=200,
)
# fetch_commit_count (alltime) — first call: get createdAt
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": {"createdAt": "2020-01-01T00:00:00Z"}}},
status=200,
)
# fetch_commit_count (alltime) — per-year contribution totals (2020–2026)
for _ in range(7):
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"contributionCalendar": {"totalContributions": 10}}}}},
status=200,
)
# fetch_commit_count (recent, last 6 months)
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"contributionCalendar": {"totalContributions": 5}}}}},
status=200,
)
# fetch_user_commit_repos (for collaborators)
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": {"contributionsCollection": {"commitContributionsByRepository": []}}}},
status=200,
)
# PR count search
responses.add(
responses.GET, "https://api.github.com/search/issues",
json={"total_count": 0, "items": []},
status=200,
)
# The fetcher fires the independent GitHub calls in parallel, so the
# mock registry can't depend on FIFO ordering. Route GraphQL requests
# by query content instead.
import json as _json
def _graphql_callback(request):
q = _json.loads(request.body).get("query", "")
if "weeks" in q:
data = {"user": {"contributionsCollection": {"contributionCalendar": {"weeks": []}}}}
elif "createdAt" in q:
data = {"user": {"createdAt": "2020-01-01T00:00:00Z"}}
elif "commitContributionsByRepository" in q:
data = {"user": {"contributionsCollection": {"commitContributionsByRepository": []}}}
elif "totalContributions" in q:
data = {"user": {"contributionsCollection": {"contributionCalendar": {"totalContributions": 10}}}}
else:
data = {"user": None}
return (200, {}, _json.dumps({"data": data}))
responses.add_callback(responses.POST, "https://api.github.com/graphql",
callback=_graphql_callback)
responses.add(responses.GET, "https://api.github.com/search/issues",
json={"total_count": 0, "items": []}, status=200)
responses.add(
responses.GET, "https://api.github.com/users/alice",
json={"login": "alice", "public_repos": 3, "followers": 5, "avatar_url": "https://avatars.example/1"},
json={"login": "alice", "public_repos": 3, "followers": 5,
"avatar_url": "https://avatars.example/1"},
status=200,
)
# fetch_repos: two calls (owner + all)
responses.add(
responses.GET, "https://api.github.com/users/alice/repos",
json=[], status=200,
)
responses.add(
responses.GET, "https://api.github.com/users/alice/repos",
json=[], status=200,
)
responses.add(
responses.GET, "https://api.github.com/users/alice/events",
json=[], status=200,
)
responses.add(responses.GET, "https://api.github.com/users/alice/repos", json=[], status=200)
responses.add(responses.GET, "https://api.github.com/users/alice/repos", json=[], status=200)
responses.add(responses.GET, "https://api.github.com/users/alice/events", json=[], status=200)
data = github.fetch_github_data("alice", token="t")
assert data["user"]["login"] == "alice"
assert "repos" in data
@@ -76,6 +53,12 @@ def test_fetch_handles_404():
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": None}}, status=200,
)
# Both fetch_repos calls (owner + all) hit the same URL — register
# twice so the parallel firing gets a response either way round.
responses.add(
responses.GET, "https://api.github.com/users/nope/repos",
json={"message": "Not Found"}, status=404,
)
responses.add(
responses.GET, "https://api.github.com/users/nope/repos",
json={"message": "Not Found"}, status=404,
@@ -84,5 +67,186 @@ def test_fetch_handles_404():
responses.GET, "https://api.github.com/users/nope/events",
json={"message": "Not Found"}, status=404,
)
responses.add(
responses.GET, "https://api.github.com/search/issues",
json={"total_count": 0, "items": []}, status=200,
)
data = github.fetch_github_data("nope", token="t")
assert data["user"].get("message") == "Not Found" or data["user"] is None
@responses.activate
def test_commit_count_raises_on_graphql_rate_limit():
# GraphQL reports a rate limit as HTTP 200 with an `errors` array — the
# exact shape a valid response uses. It must NOT be swallowed into a 0
# that would overwrite the last good count in fetcher.db.
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": None},
"errors": [{"type": "RATE_LIMITED", "message": "API rate limit exceeded"}]},
status=200,
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_commit_count("alice", [])
@responses.activate
def test_commit_count_raises_on_rest_rate_limit():
# A 403 with the remaining budget at 0 is a rate limit, not a real answer.
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"message": "rate limited"}, status=403,
headers={"X-RateLimit-Remaining": "0"},
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_commit_count("alice", [])
@responses.activate
def test_commit_count_zero_on_not_found_is_not_transient():
# A genuinely unknown user (NOT_FOUND, no rate-limit error) is a real,
# persistable "no data" answer — return 0, don't raise.
responses.add(
responses.POST, "https://api.github.com/graphql",
json={"data": {"user": None}}, status=200,
)
src = github.DirectAPISource(token="t")
assert src.fetch_commit_count("ghost", []) == 0
# --- REST rate-limit guards -------------------------------------------------
# The REST calls used to hand `.json()` straight back, so a 403 rate-limit body
# ({"message": "API rate limit exceeded for user ID ..."}) was persisted as if
# it were real data, wiping the user's last-good record for up to 24h.
RATE_LIMIT_BODY = {
"message": "API rate limit exceeded for user ID 123.",
"documentation_url": "https://docs.github.com/rest/overview/rate-limits",
}
RATE_LIMIT_HEADERS = {"X-RateLimit-Remaining": "0"}
@responses.activate
def test_fetch_user_data_raises_on_rest_rate_limit():
responses.add(
responses.GET, "https://api.github.com/users/alice",
json=RATE_LIMIT_BODY, status=403, headers=RATE_LIMIT_HEADERS,
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_user_data("alice")
@responses.activate
def test_fetch_user_data_raises_on_rate_limit_without_header():
# Secondary rate limits come back as 403 without the remaining-budget
# header — the message is the only signal.
responses.add(
responses.GET, "https://api.github.com/users/alice",
json={"message": "You have exceeded a secondary rate limit."}, status=403,
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_user_data("alice")
@responses.activate
def test_fetch_repos_raises_on_rest_rate_limit():
responses.add(
responses.GET, "https://api.github.com/users/alice/repos",
json=RATE_LIMIT_BODY, status=403, headers=RATE_LIMIT_HEADERS,
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_repos("alice")
@responses.activate
def test_fetch_events_raises_on_rest_rate_limit():
responses.add(
responses.GET, "https://api.github.com/users/alice/events",
json=RATE_LIMIT_BODY, status=403, headers=RATE_LIMIT_HEADERS,
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_events("alice")
@responses.activate
def test_fetch_repo_contributors_raises_on_rest_rate_limit():
responses.add(
responses.GET, "https://api.github.com/repos/alice/proj/contributors",
json=RATE_LIMIT_BODY, status=403, headers=RATE_LIMIT_HEADERS,
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_repo_contributors("alice/proj")
@responses.activate
def test_fetch_repo_languages_raises_on_rest_rate_limit():
responses.add(
responses.GET, "https://api.github.com/repos/alice/proj/languages",
json=RATE_LIMIT_BODY, status=403, headers=RATE_LIMIT_HEADERS,
)
src = github.DirectAPISource(token="t")
with pytest.raises(github.GitHubTransientError):
src.fetch_repo_languages("alice/proj")
@responses.activate
def test_single_repo_404_stays_non_fatal():
# A deleted/renamed repo is a real per-repo answer, not a budget problem:
# it must keep degrading gracefully instead of aborting the whole fetch.
responses.add(
responses.GET, "https://api.github.com/repos/alice/gone/languages",
json={"message": "Not Found"}, status=404,
)
responses.add(
responses.GET, "https://api.github.com/repos/alice/gone/contributors",
json={"message": "Not Found"}, status=404,
)
src = github.DirectAPISource(token="t")
assert src.fetch_repo_languages("alice/gone") == {}
assert src.fetch_repo_contributors("alice/gone") == []
@responses.activate
def test_rest_success_path_unchanged():
responses.add(
responses.GET, "https://api.github.com/users/alice",
json={"login": "alice", "followers": 5}, status=200,
)
responses.add(
responses.GET, "https://api.github.com/users/alice/events",
json=[{"type": "PushEvent"}], status=200,
)
responses.add(
responses.GET, "https://api.github.com/repos/alice/proj/languages",
json={"Python": 100}, status=200,
)
responses.add(
responses.GET, "https://api.github.com/repos/alice/proj/contributors",
json=[{"login": "bob", "contributions": 4}], status=200,
)
src = github.DirectAPISource(token="t")
assert src.fetch_user_data("alice")["login"] == "alice"
assert src.fetch_events("alice") == [{"type": "PushEvent"}]
assert src.fetch_repo_languages("alice/proj") == {"Python": 100}
assert src.fetch_repo_contributors("alice/proj") == [{"login": "bob", "contributions": 4}]
@responses.activate
def test_rate_limited_repo_languages_aborts_whole_fetch():
# A rate limit inside the per-repo fan-out means the budget is gone, so it
# must propagate rather than being swallowed into an empty breakdown.
responses.add(
responses.GET, "https://api.github.com/repos/alice/proj/languages",
json=RATE_LIMIT_BODY, status=403, headers=RATE_LIMIT_HEADERS,
)
src = github.DirectAPISource(token="t")
repos = [{"full_name": "alice/proj"}]
with pytest.raises(github.GitHubTransientError):
github._enrich_repo_languages(repos, src)
+51 -10
View File
@@ -1,13 +1,54 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>frontend</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<head>
<meta charset="UTF-8"/>
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>gh-stats - one stats card for your GitHub profile README</title>
<meta name="description"
content="Drop one line into your GitHub profile README and get a single SVG card: your score, contribution timeline, top collaborators, language breakdown, commit streaks and auto-awarded tags. Free, no signup needed."/>
<link rel="canonical" href="https://gh-stats.com/"/>
<meta property="og:type" content="website"/>
<meta property="og:site_name" content="gh-stats"/>
<meta property="og:url" content="https://gh-stats.com/"/>
<meta property="og:title" content="One stats card for your GitHub profile README"/>
<meta property="og:description"
content="Score, contribution timeline, top collaborators, languages, streaks and tags. One line of markdown, five themes, no signup."/>
<meta property="og:image" content="https://gh-stats.com/og.png"/>
<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="630"/>
<meta property="og:image:alt" content="A gh-stats card on a GitHub profile README."/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:title" content="One stats card for your GitHub profile README"/>
<meta name="twitter:description"
content="Score, contribution timeline, top collaborators, languages, streaks and tags. One line of markdown, five themes, no signup."/>
<meta name="twitter:image" content="https://gh-stats.com/og.png"/>
<script type="module">
// Import the functions you need from the SDKs you need
import {initializeApp} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-app.js";
import {getAnalytics} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-analytics.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyCy2pUW8Geo0Aagq9mTYKlfCpa9GUIXpy8",
authDomain: "gh-stats-284de.firebaseapp.com",
projectId: "gh-stats-284de",
storageBucket: "gh-stats-284de.firebasestorage.app",
messagingSenderId: "723662839762",
appId: "1:723662839762:web:4ba5337f6489ea67dc320b",
measurementId: "G-228GR89RYX"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

+3
View File
@@ -0,0 +1,3 @@
User-agent: *
Allow: /
Sitemap: https://gh-stats.com/sitemap.xml
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://gh-stats.com/</loc>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
</urlset>
+352 -32
View File
@@ -1,8 +1,14 @@
import { useState, useRef, useCallback } from 'react'
import { useState, useRef, useCallback, useEffect } from 'react'
import './index.css'
import { SearchScreen } from './screens/SearchScreen'
import { WorkshopScreen } from './screens/WorkshopScreen'
import { ResultScreen } from './screens/ResultScreen'
import { DevScreen } from './screens/DevScreen'
import { AuthButton } from './components/AuthButton'
import type { WidgetData } from './lib/renderWidgets'
import { DEMO_WIDGET_DATA } from './lib/demoData'
import { fetchMe, type Me } from './lib/auth'
import { buildEmbedUrl } from './lib/settingsQuery'
export type Achievement = {
title: string
@@ -14,6 +20,7 @@ export type Achievement = {
export type PerWidgetSettings = {
grade?: { max_tags?: number }
impact?: { line_color?: string }
streaks?: { color?: string }
collaborators?: { max_count?: number; bar_color?: string }
focus?: { max_categories?: number }
languages?: { max_languages?: number }
@@ -23,6 +30,7 @@ export type PerWidgetSettings = {
export type WidgetSettings = {
theme: string
widgets: string[]
widgetOrder: string[]
impactPeriod: string
customTags: string[]
hiddenLanguages: string[]
@@ -32,7 +40,8 @@ export type WidgetSettings = {
const DEFAULT_SETTINGS: WidgetSettings = {
theme: 'midnight',
widgets: ['grade', 'impact', 'collaborators', 'focus', 'languages'],
widgets: ['name', 'grade', 'impact', 'streaks', 'collaborators', 'focus', 'languages'],
widgetOrder: ['name', 'grade', 'impact', 'streaks', 'collaborators', 'focus', 'languages', 'achievements'],
impactPeriod: '6mo',
customTags: [],
hiddenLanguages: [],
@@ -42,40 +51,256 @@ const DEFAULT_SETTINGS: WidgetSettings = {
type Step = 'search' | 'workshop' | 'result'
// Signing in navigates the whole tab through GitHub's OAuth flow, and the
// SPA keeps username + settings only in React state, so without this the
// user comes back to an empty search box with their edits gone.
// sessionStorage survives the round trip within the tab.
const RESUME_KEY = 'gh-stats:in-progress'
type Resume = { username: string; settings: WidgetSettings }
function loadResume(): Resume | null {
try {
const raw = sessionStorage.getItem(RESUME_KEY)
if (!raw) return null
const parsed = JSON.parse(raw) as Partial<Resume> | null
if (!parsed || typeof parsed.username !== 'string' || !parsed.username) return null
if (!parsed.settings || typeof parsed.settings !== 'object') return null
return { username: parsed.username, settings: { ...DEFAULT_SETTINGS, ...parsed.settings } }
} catch {
return null
}
}
const POLL_INTERVAL_MS = 2000
const POLL_TIMEOUT_MS = 120_000
// ResultScreen poll: a bit slower than the workshop poll because each tick
// re-fetches the full SVG, not a small JSON. 3s spacing is responsive
// enough to feel near-instant when the widget lands.
const RESULT_POLL_INTERVAL_MS = 3000
// Give up after 3 minutes — long enough to cover even worst-case
// first-time GitHub fetches; past that the user can hit "Check now".
const RESULT_POLL_TIMEOUT_MS = 180_000
type WidgetStatus = 'ready' | 'building' | 'not_found' | 'rate_limited'
function readWidgetStatus(r: Response): WidgetStatus {
const raw = r.headers.get('X-Widget-Status')
if (raw === 'building' || raw === 'not_found' || raw === 'rate_limited') return raw
return 'ready'
}
export default function App() {
const [step, setStep] = useState<Step>('search')
const [username, setUsername] = useState('')
const [settings, setSettings] = useState<WidgetSettings>({ ...DEFAULT_SETTINGS })
if (typeof window !== 'undefined' && window.location.pathname === '/dev') {
return <DevScreen />
}
const [me, setMe] = useState<Me>({ login: null })
// Work in progress left behind by a sign-in redirect, if any.
const [resumed] = useState(loadResume)
const [step, setStep] = useState<Step>(resumed ? 'workshop' : 'search')
const [username, setUsername] = useState(resumed?.username ?? '')
const [settings, setSettings] = useState<WidgetSettings>(resumed?.settings ?? { ...DEFAULT_SETTINGS })
const [widgetData, setWidgetData] = useState<WidgetData | null>(null)
const [fetchDone, setFetchDone] = useState(false)
const [fetchError, setFetchError] = useState<string | null>(null)
const fetchRef = useRef<AbortController | null>(null)
// Final SVG produced by POST /api/<u>/generate. Rendered on the Result
// screen so the user sees the actual backend output, not demo data.
const [generatedSvg, setGeneratedSvg] = useState<string | null>(null)
const [generateError, setGenerateError] = useState<string | null>(null)
const [generating, setGenerating] = useState(false)
// The URL we actually fetched for the preview — also the one we show as
// the embed snippet. For owners this is /api/<u> (backed by stored
// settings). For visitors it's /api/<u>?<query>, which round-trips their
// Workshop edits without touching the owner's saved widget.
const [embedUrl, setEmbedUrl] = useState<string>('')
// 'ready' once the backend has actually rendered the user's widget; until
// then the SVG returned by /api/<u> is the "Building @user's widget…"
// placeholder. We poll on this so the page upgrades itself from
// placeholder to real widget without the user having to refresh.
const [widgetStatus, setWidgetStatus] = useState<'ready' | 'building' | 'not_found' | 'rate_limited'>('ready')
const pollTimer = useRef<number | null>(null)
const pollStart = useRef<number>(0)
const aborted = useRef(false)
const resultPollTimer = useRef<number | null>(null)
const resultPollStart = useRef<number>(0)
const startFetch = useCallback((user: string) => {
if (fetchRef.current) fetchRef.current.abort()
const ctrl = new AbortController()
fetchRef.current = ctrl
const stopPolling = useCallback(() => {
if (pollTimer.current != null) {
window.clearTimeout(pollTimer.current)
pollTimer.current = null
}
}, [])
const stopResultPolling = useCallback(() => {
if (resultPollTimer.current != null) {
window.clearTimeout(resultPollTimer.current)
resultPollTimer.current = null
}
}, [])
// Pull and re-render the embed SVG once. Used both by the auto-poll loop
// (when the first /api/<u> returned a building placeholder) and by the
// manual "Check now" button on ResultScreen.
const refetchEmbed = useCallback(async () => {
if (!embedUrl) return
try {
const r = await fetch(`${embedUrl}${embedUrl.includes('?') ? '&' : '?'}t=${Date.now()}`)
if (!r.ok) return
const status = readWidgetStatus(r)
const text = await r.text()
setGeneratedSvg(text)
setWidgetStatus(status)
} catch {
/* transient — let the next poll tick try again */
}
}, [embedUrl])
useEffect(() => stopPolling, [stopPolling])
useEffect(() => stopResultPolling, [stopResultPolling])
useEffect(() => { fetchMe().then(setMe) }, [])
// Result-screen auto-refresh. Backend serves a "Building @user's widget…"
// placeholder SVG (with header X-Widget-Status: building) until the
// worker finishes the first build. Without this loop the user would
// stare at the placeholder until they manually reloaded.
useEffect(() => {
if (step !== 'result' || widgetStatus !== 'building' || !embedUrl) return
resultPollStart.current = Date.now()
const tick = async () => {
await refetchEmbed()
if (Date.now() - resultPollStart.current > RESULT_POLL_TIMEOUT_MS) {
stopResultPolling()
return
}
resultPollTimer.current = window.setTimeout(tick, RESULT_POLL_INTERVAL_MS)
}
resultPollTimer.current = window.setTimeout(tick, RESULT_POLL_INTERVAL_MS)
return stopResultPolling
}, [step, widgetStatus, embedUrl, refetchEmbed, stopResultPolling])
// `keepSettings` is set when resuming after a sign-in redirect: the
// settings already on screen are the user's own unsaved edits, so neither
// the reset nor the server hydration below may overwrite them.
const startFetch = useCallback((user: string, keepSettings = false) => {
stopPolling()
aborted.current = false
pollStart.current = Date.now()
setFetchDone(false)
setFetchError(null)
// Show demo data immediately so Workshop is interactive while the worker builds.
setWidgetData(DEMO_WIDGET_DATA)
// Reset to defaults first so the form doesn't briefly show the previous
// user's settings while we fetch this user's saved blob.
if (!keepSettings) setSettings({ ...DEFAULT_SETTINGS })
fetch('/api/fetch', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: user }),
signal: ctrl.signal,
})
.then(r => {
if (!r.ok) throw new Error(`Fetch failed (${r.status})`)
return r.json()
})
.then(() => setFetchDone(true))
.catch(e => {
if (e.name !== 'AbortError') {
console.warn('Fetch error:', e)
setFetchError(e.message)
// Hydrate the Workshop form from the user's persisted settings.
// Backend stores snake_case keys; we map them onto the camelCase
// state shape here. 404 (not enrolled yet) is expected — keep defaults.
if (!keepSettings) void (async () => {
try {
const r = await fetch(`/api/${encodeURIComponent(user)}/settings`, {
credentials: 'include',
})
if (aborted.current) return
if (!r.ok) return
const body = await r.json().catch(() => null) as { settings?: Record<string, unknown> } | null
const s = body?.settings
if (!s || typeof s !== 'object') return
setSettings(prev => {
const next: WidgetSettings = { ...prev }
if (typeof s.theme === 'string') next.theme = s.theme
if (Array.isArray(s.enabled)) next.widgets = s.enabled.filter(x => typeof x === 'string') as string[]
if (Array.isArray(s.widget_order)) next.widgetOrder = s.widget_order.filter(x => typeof x === 'string') as string[]
if (Array.isArray(s.custom_tags)) next.customTags = s.custom_tags.filter(x => typeof x === 'string') as string[]
if (Array.isArray(s.hidden_languages)) next.hiddenLanguages = s.hidden_languages.filter(x => typeof x === 'string') as string[]
if (s.widget_settings && typeof s.widget_settings === 'object') {
next.widgetSettings = s.widget_settings as PerWidgetSettings
}
if (Array.isArray(s.achievements)) {
next.achievements = s.achievements
.filter((a): a is Record<string, unknown> => !!a && typeof a === 'object')
.map(a => ({
title: typeof a.title === 'string' ? a.title : '',
subtitle: typeof a.subtitle === 'string' ? a.subtitle : '',
event_date: typeof a.event_date === 'string' ? a.event_date : '',
icon: typeof a.icon === 'string' ? a.icon : 'trophy',
}))
}
return next
})
} catch (e) {
if (!aborted.current) console.warn('Settings load failed:', e)
}
})()
const poll = async () => {
if (aborted.current) return
try {
const r = await fetch(`/api/${encodeURIComponent(user)}/data`)
if (aborted.current) return
const body = await r.json().catch(
() => ({} as { status?: string; data?: WidgetData })
)
const status = body.status
if (r.status === 200 && status === 'ready' && body.data) {
setWidgetData(body.data)
setFetchDone(true)
return
}
})
}, [])
if (status === 'not_found') {
// Fetcher confirmed the user doesn't exist on GitHub.
setFetchError('User not found')
setFetchDone(true)
return
}
if (r.status === 404) {
// 404 without status==='not_found' means the user simply isn't
// enrolled yet (no settings row). Keep the demo data on screen
// and stop polling — no error to display.
setFetchDone(true)
return
}
if (r.status === 429 || status === 'rate_limited') {
setFetchError('Enrollment limit reached — try again tomorrow')
setFetchDone(true)
return
}
// 202 building (or any non-terminal) — poll again until timeout.
if (Date.now() - pollStart.current > POLL_TIMEOUT_MS) {
setFetchError('Still building — refresh to keep waiting')
setFetchDone(true)
return
}
pollTimer.current = window.setTimeout(poll, POLL_INTERVAL_MS)
} catch (e) {
if (aborted.current) return
console.warn('Data poll failed:', e)
setFetchError('Network error')
setFetchDone(true)
}
}
poll()
}, [stopPolling])
// Keep the in-progress username and settings recoverable across the
// sign-in redirect (and a plain reload). Cleared once the user is back
// on the search screen, so a fresh visit starts fresh.
useEffect(() => {
try {
if (step === 'search' || !username) sessionStorage.removeItem(RESUME_KEY)
else sessionStorage.setItem(RESUME_KEY, JSON.stringify({ username, settings }))
} catch {
/* private mode or quota: resuming is a nicety, not a requirement */
}
}, [step, username, settings])
// Restore: the widget data itself is not persisted, so re-fetch it for
// the username we came back to.
useEffect(() => {
if (resumed) startFetch(resumed.username, true)
}, [resumed, startFetch])
const handleSearch = (user: string) => {
setUsername(user)
@@ -83,20 +308,106 @@ export default function App() {
setStep('workshop')
}
const handleGenerate = () => {
const handleGenerate = async () => {
setStep('result')
setGenerating(true)
setGeneratedSvg(null)
setGenerateError(null)
setWidgetStatus('ready')
const isOwner = !!me.login && me.login.toLowerCase() === username.toLowerCase()
try {
if (isOwner) {
// Owner path: persist settings, then force a server-side render
// against the stored payload. The resulting /api/<u> is the embed.
const backendSettings = {
theme: settings.theme,
enabled: settings.widgets,
widget_order: settings.widgetOrder,
custom_tags: settings.customTags,
hidden_languages: settings.hiddenLanguages,
widget_settings: settings.widgetSettings,
achievements: settings.achievements.filter(a => a.title.trim()),
}
const patchRes = await fetch(`/api/${encodeURIComponent(username)}/settings`, {
method: 'PATCH',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(backendSettings),
})
if (!patchRes.ok && patchRes.status !== 404) {
setGenerateError(`Settings sync failed (HTTP ${patchRes.status})`)
return
}
const r = await fetch(`/api/${encodeURIComponent(username)}/generate`, {
method: 'POST',
credentials: 'include',
})
if (r.status === 404) {
const body = await r.json().catch(() => ({} as { status?: string }))
setGenerateError(body.status === 'not_found' ? 'User not found' : 'Not enrolled')
return
}
if (!r.ok) {
setGenerateError(`Generate failed (HTTP ${r.status})`)
return
}
const cleanUrl = `${window.location.origin}/api/${encodeURIComponent(username)}`
// Cache-bust so regenerate after settings change shows the new
// version, not a stale browser copy. The cache-busting `t` param
// is not read server-side (not in the allow-list) so the render
// stays cacheable at the edge.
const svgRes = await fetch(`${cleanUrl}?t=${Date.now()}`)
if (!svgRes.ok) {
setGenerateError(`SVG fetch failed (HTTP ${svgRes.status})`)
return
}
setGeneratedSvg(await svgRes.text())
setEmbedUrl(cleanUrl)
setWidgetStatus(readWidgetStatus(svgRes))
} else {
// Visitor path: encode Workshop edits into a query string and hit
// the same URL we'll hand the user for their README. No owner
// settings are written. The backend renders ad-hoc against the
// fetcher's cached payload for this user.
const url = buildEmbedUrl(window.location.origin, username, settings)
// Same cache-bust trick — unknown query params are ignored by the
// sanitizer, so this doesn't alter the rendered output.
const svgRes = await fetch(`${url}${url.includes('?') ? '&' : '?'}t=${Date.now()}`)
if (svgRes.status === 404) {
setGenerateError('User not enrolled — ask them to sign in and generate first')
return
}
if (!svgRes.ok) {
setGenerateError(`SVG fetch failed (HTTP ${svgRes.status})`)
return
}
setGeneratedSvg(await svgRes.text())
setEmbedUrl(url)
setWidgetStatus(readWidgetStatus(svgRes))
}
} catch (e) {
console.warn('generate call failed:', e)
setGenerateError('Network error')
} finally {
setGenerating(false)
}
}
const handleBack = () => {
if (step === 'result') setStep('workshop')
else if (step === 'workshop') {
if (fetchRef.current) fetchRef.current.abort()
aborted.current = true
stopPolling()
setStep('search')
}
}
return (
<div className="min-h-screen bg-gray-50">
<div className="fixed right-4 top-4 z-50">
<AuthButton me={me} onChange={setMe} />
</div>
{step === 'search' && (
<SearchScreen onSearch={handleSearch} />
)}
@@ -108,15 +419,24 @@ export default function App() {
onGenerate={handleGenerate}
onBack={handleBack}
fetchDone={fetchDone}
fetchError={fetchError}
widgetData={widgetData}
isDemoData={widgetData === DEMO_WIDGET_DATA}
me={me}
onAuthChange={setMe}
/>
)}
{step === 'result' && (
<ResultScreen
username={username}
settings={settings}
fetchDone={fetchDone}
fetchError={fetchError}
generating={generating}
generatedSvg={generatedSvg}
generateError={generateError}
embedUrl={embedUrl}
widgetStatus={widgetStatus}
onBack={handleBack}
onRegenerate={handleGenerate}
onRefresh={refetchEmbed}
/>
)}
</div>
@@ -0,0 +1,36 @@
import type { Me } from '../lib/auth'
import { signInUrl, signOut } from '../lib/auth'
export function AuthButton({ me, onChange }: { me: Me; onChange: (m: Me) => void }) {
if (!me.login) {
return (
<a
href={signInUrl()}
className="inline-flex items-center gap-2 rounded-full bg-gray-900 px-4 py-1.5 text-sm font-medium text-white shadow-sm transition hover:bg-gray-800"
>
<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" className="h-4 w-4">
<path d="M8 0C3.58 0 0 3.58 0 8a8 8 0 0 0 5.47 7.59c.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.42 7.42 0 0 1 4 0c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z" />
</svg>
Sign in with GitHub
</a>
)
}
return (
<div className="inline-flex items-center gap-2 rounded-full border border-gray-200 bg-white py-1 pr-1 pl-3 text-sm shadow-sm">
{me.avatar_url && (
<img
src={me.avatar_url}
alt=""
className="h-6 w-6 rounded-full object-cover"
/>
)}
<span className="font-medium text-gray-900">{me.login}</span>
<button
onClick={async () => { await signOut(); onChange({ login: null }) }}
className="rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700 transition hover:bg-gray-200"
>
Sign out
</button>
</div>
)
}
@@ -0,0 +1,163 @@
import { useEffect, useState } from 'react'
import { fetchGrowth, type Growth } from '../lib/dev'
type Mode = 'daily' | 'weekly'
export function GrowthChart() {
const [data, setData] = useState<Growth | null>(null)
const [mode, setMode] = useState<Mode>('daily')
useEffect(() => { fetchGrowth().then(setData).catch(() => {}) }, [])
// Trim leading empty buckets so the chart starts at the first day/week
// with traffic instead of e.g. four weeks of zeros from before the
// service went live.
const rawPoints = data ? (mode === 'daily' ? data.daily : data.weekly) : []
const firstActive = rawPoints.findIndex(p => p.requests > 0 || p.users > 0)
const points = firstActive >= 0 ? rawPoints.slice(firstActive) : []
const labels = points.map(p => 'day' in p ? p.day : p.week)
const requests = points.map(p => p.requests)
const users = points.map(p => p.users)
return (
<div className="rounded-lg border border-white/10 bg-white/[0.02] p-4">
<div className="mb-3 flex items-center justify-between">
<div className="text-sm text-white/70">Growth</div>
<div className="flex gap-1 text-xs">
<Tab active={mode === 'daily'} onClick={() => setMode('daily')}>day · 30</Tab>
<Tab active={mode === 'weekly'} onClick={() => setMode('weekly')}>week · 12</Tab>
</div>
</div>
{!data ? (
<div className="text-xs text-white/40">loading…</div>
) : points.length === 0 ? (
<div className="text-xs text-white/40">no traffic yet</div>
) : (
<div className="space-y-4">
<Line label="Requests" values={requests} labels={labels} mode={mode} stroke="#60a5fa" />
<Line label="Unique users" values={users} labels={labels} mode={mode} stroke="#a78bfa" />
</div>
)}
</div>
)
}
function Tab({ active, onClick, children }: { active: boolean; onClick: () => void; children: React.ReactNode }) {
return (
<button
onClick={onClick}
className={`rounded px-2 py-0.5 font-mono transition ${
active ? 'bg-white/10 text-white' : 'text-white/40 hover:text-white/70'
}`}
>
{children}
</button>
)
}
function Line({ label, values, labels, mode, stroke }: {
label: string; values: number[]; labels: string[]; mode: Mode; stroke: string
}) {
const width = 600
const height = 70
const vbH = height + 10 // viewBox height; bottom 10 holds the x-tick marks
const max = Math.max(1, ...values)
const n = values.length
const stepX = n > 1 ? width / (n - 1) : 0
const total = values.reduce((a, b) => a + b, 0)
const latest = values[n - 1] ?? 0
// Map a value to its y coordinate in viewBox space; reused for both the
// line points and the y-axis label positions so they stay aligned.
const yFor = (v: number) => height - (v / max) * (height - 4) - 2
const xy = values.map((v, i) => ({ x: n > 1 ? i * stepX : width / 2, y: yFor(v) }))
const pts = xy.map(p => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(' ')
// Sealed area polygon: only valid when we have a real line (n >= 2).
const area = n > 1 ? `0,${height} ${pts} ${width},${height}` : ''
const ticks = pickTicks(labels, Math.min(6, n))
// y-axis labels: top (max), middle, baseline (0). Percent positions are
// relative to the same viewBox the chart is drawn in.
const yMarks = max > 1
? [max, Math.round(max / 2), 0]
: [max, 0]
return (
<div>
<div className="mb-1 flex items-baseline justify-between text-xs">
<span className="text-white/60">{label}</span>
<span className="font-mono tabular-nums text-white/40">
latest <span className="text-white/80">{latest.toLocaleString()}</span>
<span className="ml-3">total <span className="text-white/80">{total.toLocaleString()}</span></span>
</span>
</div>
<div className="flex gap-1.5">
{/* y-axis */}
<div className="relative w-7 shrink-0" style={{ height: vbH }}>
{yMarks.map(v => (
<span key={v}
className="absolute right-0 -translate-y-1/2 font-mono text-[10px] tabular-nums text-white/35"
style={{ top: `${(yFor(v) / vbH) * 100}%` }}>
{fmtCompact(v)}
</span>
))}
</div>
{/* plot + x-axis */}
<div className="min-w-0 flex-1">
<svg viewBox={`0 0 ${width} ${vbH}`} className="w-full" style={{ height: vbH }} preserveAspectRatio="none">
{area && <polyline points={area} fill={stroke} fillOpacity="0.08" stroke="none" />}
{n > 1 && (
<polyline points={pts} fill="none" stroke={stroke} strokeWidth={1.5}
strokeLinecap="round" strokeLinejoin="round"
vectorEffect="non-scaling-stroke" />
)}
{n === 1 && (
<circle cx={xy[0].x} cy={xy[0].y} r={3} fill={stroke} />
)}
{ticks.map(t => {
const x = n > 1 ? t.idx * stepX : width / 2
return (
<line key={`tick-${t.idx}`} x1={x} x2={x} y1={height} y2={height + 3}
stroke="rgb(255 255 255 / 0.15)" strokeWidth={1}
vectorEffect="non-scaling-stroke" />
)
})}
</svg>
<div className="relative mt-1 h-3">
{ticks.map(t => (
<span key={`label-${t.idx}`}
className="absolute -translate-x-1/2 whitespace-nowrap font-mono text-[10px] text-white/40"
style={{ left: n > 1 ? `${(t.idx / (n - 1)) * 100}%` : '50%' }}>
{formatTick(t.label, mode)}
</span>
))}
</div>
</div>
</div>
</div>
)
}
function fmtCompact(n: number): string {
if (n >= 10000) return `${Math.round(n / 1000)}k`
if (n >= 1000) return `${(n / 1000).toFixed(1)}k`
return String(Math.round(n))
}
function pickTicks(labels: string[], n: number): { idx: number; label: string }[] {
if (labels.length === 0 || n <= 0) return []
if (labels.length <= n) return labels.map((label, idx) => ({ idx, label }))
const out: { idx: number; label: string }[] = []
for (let i = 0; i < n; i++) {
const idx = Math.round((i * (labels.length - 1)) / (n - 1))
out.push({ idx, label: labels[idx] })
}
return out
}
function formatTick(label: string, mode: Mode): string {
if (mode === 'daily') {
// "2026-05-27" -> "05-27"
return label.length >= 10 ? label.slice(5) : label
}
// "2026-W21" -> "W21"
const parts = label.split('-')
return parts[1] || label
}
@@ -0,0 +1,30 @@
import { useEffect, useState } from 'react'
import { fetchHealth, type Health } from '../lib/dev'
export function HealthStrip() {
const [h, setH] = useState<Health | null>(null)
useEffect(() => { fetchHealth().then(setH).catch(() => {}) }, [])
if (!h) return null
const pct = (n: number) => `${(n * 100).toFixed(1)}%`
return (
<div className="rounded-lg border border-white/10 bg-white/[0.02] p-4">
<div className="mb-3 text-sm text-white/70">Health</div>
<div className="grid grid-cols-3 gap-3 text-center">
<Pill label="Edge cache hit" value={pct(h.edge_cache_hit_rate)} />
<Pill label="Fetch error" value={pct(h.fetcher_error_rate)} tone={h.fetcher_error_rate > 0.05 ? 'warn' : 'ok'} />
<Pill label="Events dropped 24h" value={h.events_dropped_24h.toLocaleString()}
tone={h.events_dropped_24h > 0 ? 'warn' : 'ok'} />
</div>
</div>
)
}
function Pill({ label, value, tone = 'ok' }: { label: string; value: string; tone?: 'ok' | 'warn' }) {
const color = tone === 'warn' ? 'text-amber-400' : 'text-emerald-400'
return (
<div className="rounded bg-white/[0.03] px-2 py-2">
<div className="text-xs text-white/40">{label}</div>
<div className={`mt-1 font-mono text-lg ${color}`}>{value}</div>
</div>
)
}
@@ -0,0 +1,34 @@
import { useEffect, useState } from 'react'
import { fetchLatency, type LatencyRow } from '../lib/dev'
export function LatencyChart() {
const [rows, setRows] = useState<LatencyRow[]>([])
useEffect(() => { fetchLatency().then(setRows).catch(() => {}) }, [])
const max = Math.max(1, ...rows.map(r => r.p95))
return (
<div className="rounded-lg border border-white/10 bg-white/[0.02] p-4">
<div className="mb-3 text-sm text-white/70">Latency by endpoint</div>
{rows.length === 0 && <div className="text-xs text-white/40">no traffic yet</div>}
<div className="space-y-1.5">
{rows.map(r => (
<div key={r.endpoint} className="grid grid-cols-[1fr_auto] items-center gap-3 font-mono text-xs">
<div>
<div className="text-white/70">{r.endpoint}</div>
<div className="mt-1 h-1.5 w-full overflow-hidden rounded bg-white/[0.04]">
<div className="h-full bg-sky-400/60" style={{ width: `${(r.p50 / max) * 100}%` }} />
<div className="-mt-1.5 h-1.5 bg-sky-300/30" style={{ width: `${(r.p95 / max) * 100}%` }} />
</div>
</div>
<div className="text-right text-white/80 tabular-nums">
<span>{r.p50}</span><span className="text-white/30"> · </span>
<span>{r.p95}</span><span className="text-white/30"> · </span>
<span>{r.p99}ms</span>
</div>
</div>
))}
</div>
</div>
)
}
@@ -0,0 +1,17 @@
type Props = { values: number[]; width?: number; height?: number; stroke?: string }
export function Sparkline({ values, width = 140, height = 32, stroke = '#60a5fa' }: Props) {
if (values.length === 0) return <svg width={width} height={height} />
const max = Math.max(1, ...values)
const stepX = width / Math.max(1, values.length - 1)
const pts = values.map((v, i) => {
const x = i * stepX
const y = height - (v / max) * (height - 2) - 1
return `${x.toFixed(1)},${y.toFixed(1)}`
}).join(' ')
return (
<svg width={width} height={height} viewBox={`0 0 ${width} ${height}`}>
<polyline points={pts} fill="none" stroke={stroke} strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" />
</svg>
)
}
@@ -0,0 +1,26 @@
import type { ReactNode } from 'react'
import { Sparkline } from './Sparkline'
import type { Summary } from '../lib/dev'
function Card({ label, value, sub }: { label: string; value: string; sub?: ReactNode }) {
return (
<div className="rounded-lg border border-white/10 bg-white/[0.02] px-4 py-3">
<div className="text-xs uppercase tracking-wide text-white/50">{label}</div>
<div className="mt-1 text-2xl font-mono text-white">{value}</div>
{sub && <div className="mt-1 text-xs text-white/40">{sub}</div>}
</div>
)
}
export function StatCards({ s }: { s: Summary }) {
const fmt = (n: number) => n.toLocaleString()
return (
<div className="grid grid-cols-1 gap-3 md:grid-cols-4">
<Card label="Requests 7d" value={fmt(s.requests_7d)}
sub={<Sparkline values={s.daily_requests.map(d => d.count)} />} />
<Card label="Active users 7d" value={fmt(s.active_users_7d)} />
<Card label="p50 / p95 latency" value={`${s.p50_ms}/${s.p95_ms}ms`} />
<Card label="Renders 7d" value={fmt(s.renders_7d)} sub={`avg ${s.avg_render_ms}ms`} />
</div>
)
}
@@ -0,0 +1,81 @@
import { useEffect, useMemo, useState } from 'react'
import { fetchUsers, type UserRow } from '../lib/dev'
function timeAgo(ts: number | null): string {
if (!ts) return '—'
const s = Math.max(0, Math.floor(Date.now() / 1000 - ts))
if (s < 60) return `${s}s ago`
if (s < 3600) return `${Math.floor(s / 60)}m ago`
if (s < 86400) return `${Math.floor(s / 3600)}h ago`
return `${Math.floor(s / 86400)}d ago`
}
export function UsersTable() {
const [q, setQ] = useState('')
const [sort, setSort] = useState<'requests' | 'latency' | 'last_seen'>('requests')
const [rows, setRows] = useState<UserRow[]>([])
const [loading, setLoading] = useState(true)
useEffect(() => {
let alive = true
const h = window.setTimeout(() => {
setLoading(true)
fetchUsers(q, sort).then(r => { if (alive) { setRows(r); setLoading(false) } })
.catch(() => { if (alive) setLoading(false) })
}, 200)
return () => { alive = false; window.clearTimeout(h) }
}, [q, sort])
const sorted = useMemo(() => rows, [rows])
return (
<div className="rounded-lg border border-white/10 bg-white/[0.02]">
<div className="flex items-center justify-between border-b border-white/10 px-4 py-2">
<div className="text-sm text-white/70">Users</div>
<div className="flex gap-2">
<select value={sort} onChange={e => setSort(e.target.value as 'requests' | 'latency' | 'last_seen')}
className="rounded bg-white/[0.04] px-2 py-1 text-xs text-white/80">
<option value="requests">requests</option>
<option value="latency">latency</option>
<option value="last_seen">last seen</option>
</select>
<input value={q} onChange={e => setQ(e.target.value)} placeholder="search…"
className="rounded bg-white/[0.04] px-2 py-1 text-xs text-white/80 placeholder:text-white/30" />
</div>
</div>
<table className="w-full text-left text-sm">
<thead className="text-xs uppercase text-white/40">
<tr>
<th className="px-4 py-2 font-normal">User</th>
<th className="px-4 py-2 font-normal">Req 7d</th>
<th className="px-4 py-2 font-normal">Last seen</th>
<th className="px-4 py-2 font-normal">Top endpoint</th>
<th className="px-4 py-2 text-right font-normal">Avg ms</th>
</tr>
</thead>
<tbody>
{loading && <tr><td colSpan={5} className="px-4 py-6 text-center text-white/40">loading…</td></tr>}
{!loading && sorted.length === 0 && (
<tr><td colSpan={5} className="px-4 py-6 text-center text-white/40">no users yet</td></tr>
)}
{sorted.map(u => (
<tr key={u.username} className="border-t border-white/5">
<td className="px-4 py-2 text-white/90">
<div className="flex items-center gap-2">
{u.github_avatar_url
? <img src={u.github_avatar_url} alt="" className="h-5 w-5 rounded-full" />
: <span className="inline-block h-5 w-5 rounded-full bg-white/10" />}
<span className="font-mono">{u.username}</span>
</div>
</td>
<td className="px-4 py-2 font-mono text-white/80">{u.requests_7d.toLocaleString()}</td>
<td className="px-4 py-2 text-white/60">{timeAgo(u.last_seen)}</td>
<td className="px-4 py-2 font-mono text-white/60">{u.top_endpoint || '—'}</td>
<td className="px-4 py-2 text-right font-mono text-white/80">{u.avg_latency_ms}</td>
</tr>
))}
</tbody>
</table>
</div>
)
}
+20
View File
@@ -0,0 +1,20 @@
export type Me = { login: string | null; avatar_url?: string }
export async function fetchMe(): Promise<Me> {
const r = await fetch('/api/auth/me', { credentials: 'include' })
if (!r.ok) return { login: null }
return r.json() as Promise<Me>
}
export function signInUrl(next?: string): string {
const n = next ?? (window.location.pathname + window.location.search)
return `/api/auth/github/login?next=${encodeURIComponent(n)}`
}
export async function signOut(): Promise<void> {
await fetch('/api/auth/logout', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
})
}
+47
View File
@@ -0,0 +1,47 @@
import type { WidgetData } from './renderWidgets'
// Used to show a fully-populated Workshop preview instantly while the real
// data is building asynchronously on the server. Swapped out when the
// /data endpoint returns status=ready.
export const DEMO_WIDGET_DATA: WidgetData = {
grade: {
grade: 'A',
score: 78,
stats: { commits: 842, prs: 47, stars: 156, repos: 28, followers: 92 },
tags: [
{ tag: 'backend', source: 'earned', confidence: 0.7 },
{ tag: 'frontend', source: 'earned', confidence: 0.55 },
{ tag: 'devops', source: 'earned', confidence: 0.3 },
],
breakdown: {},
},
impact: Array.from({ length: 24 }, (_, i) => ({
week_start: new Date(Date.now() - (23 - i) * 7 * 86400000).toISOString().slice(0, 10),
commits: Math.max(0, Math.round(14 + Math.sin(i * 0.5) * 9 + (i % 3) * 2)),
})),
collaborators: [
{ username: 'alex', shared_repos: 4, shared_commits: 87 },
{ username: 'jordan', shared_repos: 2, shared_commits: 54 },
{ username: 'sam', shared_repos: 3, shared_commits: 31 },
],
focus: [
{ category: 'Backend', percentage: 45, commit_count: 379 },
{ category: 'Frontend', percentage: 30, commit_count: 252 },
{ category: 'DevOps', percentage: 15, commit_count: 126 },
{ category: 'ML', percentage: 10, commit_count: 84 },
],
languages: [
{ language: 'Python', percentage: 42, loc: 12 },
{ language: 'TypeScript', percentage: 28, loc: 8 },
{ language: 'Go', percentage: 18, loc: 5 },
{ language: 'Rust', percentage: 12, loc: 3 },
],
streaks: {
current: 12,
max: 47,
current_start: new Date(Date.now() - 11 * 86400000).toISOString().slice(0, 10),
last_active_date: new Date().toISOString().slice(0, 10),
max_start: '2024-09-04',
max_end: '2024-10-20',
},
}
+57
View File
@@ -0,0 +1,57 @@
// Read helpers for the /dev dashboard. All four endpoints require a
// Basic-auth session that the browser establishes via the WWW-Authenticate
// challenge the first time the SPA hits /api/dev/summary.
export type Summary = {
requests_7d: number
active_users_7d: number
p50_ms: number
p95_ms: number
renders_7d: number
avg_render_ms: number
daily_requests: { day: string; count: number }[]
}
export type UserRow = {
username: string
requests_7d: number
last_seen: number | null
avg_latency_ms: number
top_endpoint: string
github_avatar_url: string | null
}
export type LatencyRow = {
endpoint: string
count: number
p50: number
p95: number
p99: number
}
export type Health = {
edge_cache_hit_rate: number
fetcher_error_rate: number
events_dropped_24h: number
oldest_event_ts: number | null
}
export type Growth = {
daily: { day: string; users: number; requests: number }[]
weekly: { week: string; users: number; requests: number }[]
}
async function getJSON<T>(path: string): Promise<T> {
const r = await fetch(path, { credentials: 'include' })
if (r.status === 401) throw new Error('unauthorized')
if (r.status === 503) throw new Error('dashboard_disabled')
if (!r.ok) throw new Error(`HTTP ${r.status}`)
return (await r.json()) as T
}
export const fetchSummary = () => getJSON<Summary>('/api/dev/summary')
export const fetchUsers = (q = '', sort = 'requests') =>
getJSON<UserRow[]>(`/api/dev/users?q=${encodeURIComponent(q)}&sort=${sort}`)
export const fetchLatency = () => getJSON<LatencyRow[]>('/api/dev/latency')
export const fetchHealth = () => getJSON<Health>('/api/dev/health')
export const fetchGrowth = () => getJSON<Growth>('/api/dev/growth')
+151 -13
View File
@@ -5,7 +5,7 @@ import { THEMES, TAG_COLORS, GRADE_COLORS, FOCUS_COLORS, LANG_COLORS, type Theme
export type GradeData = {
grade: string; score: number
stats: Record<string, number>
tags: { tag: string; source: string; confidence: number }[]
tags: { tag: string; source: string; confidence: number; label?: string | null }[]
breakdown: Record<string, number>
}
export type ImpactWeek = { week_start: string; commits: number }
@@ -13,6 +13,11 @@ export type CollaboratorData = { username: string; shared_repos: number; shared_
export type FocusCategory = { category: string; percentage: number; commit_count: number }
export type LanguageData = { language: string; percentage: number; loc: number }
export type AchievementInput = { title: string; subtitle: string; event_date: string; icon: string }
export type StreakData = {
current: number; max: number
current_start?: string; last_active_date?: string
max_start?: string; max_end?: string
}
export type WidgetData = {
grade?: GradeData
@@ -20,11 +25,13 @@ export type WidgetData = {
collaborators?: CollaboratorData[]
focus?: FocusCategory[]
languages?: LanguageData[]
streaks?: StreakData
}
export type PerWidgetSettings = {
grade?: { max_tags?: number }
impact?: { line_color?: string }
streaks?: { color?: string }
collaborators?: { max_count?: number; bar_color?: string }
focus?: { max_categories?: number }
languages?: { max_languages?: number }
@@ -36,6 +43,15 @@ export type PerWidgetSettings = {
const esc = (s: string) => s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;')
const font = '-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif'
const TAG_ACRONYMS = new Set(['ml','ai','ui','ux','api','cli','sql','css','html','js','ios'])
function formatTagLabel(tag: string): string {
return tag.split('-')
.map(w => TAG_ACRONYMS.has(w.toLowerCase())
? w.toUpperCase()
: w.charAt(0).toUpperCase() + w.slice(1))
.join(' ')
}
function cardWrapper(inner: string, w: number, h: number, t: Theme, title: string, prefix = '') {
const sid = `${prefix}shadow`
return `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}" fill="none">
@@ -50,7 +66,7 @@ function iconSvg(kind: string, color: string): string {
const icons: Record<string, string> = {
commits: `<circle cx="7" cy="7" r="3" fill="none" stroke="${color}" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="${color}"/><line x1="7" y1="10" x2="7" y2="14" stroke="${color}" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="${color}" stroke-width="1.4"/>`,
prs: `<circle cx="4" cy="4" r="2" fill="none" stroke="${color}" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="${color}" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="${color}" stroke-width="1.2"/>`,
stars: `<path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="${color}" opacity="0.85"/>`,
stars: `<path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="${color}" stroke-width="1.2" stroke-linejoin="round"/>`,
repos: `<rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="${color}" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="${color}" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="${color}" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="${color}" stroke-width="1"/>`,
followers: `<circle cx="5" cy="4" r="2.5" fill="none" stroke="${color}" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="${color}" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="${color}" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="${color}" stroke-width="1"/>`,
}
@@ -82,7 +98,7 @@ function renderGrade(data: GradeData, t: Theme, s?: { max_tags?: number }): stri
let tagsSvg = '', tx = 0, ty = 0
for (const tag of tags) {
const tc = TAG_COLORS[tag.tag] ?? t.accent
const label = tag.tag.replace(/-/g,' ').replace(/\b\w/g, c => c.toUpperCase())
const label = tag.label || formatTagLabel(tag.tag)
const tw = Math.round(label.length * 6.6 + 18)
const po = tag.source === 'earned' ? 0.9 : 0.55
if (tx + tw > 340) { tx = 0; ty += 30 }
@@ -95,9 +111,19 @@ function renderGrade(data: GradeData, t: Theme, s?: { max_tags?: number }): stri
const tagPad = tagsH > 24 ? 18 : 14
const cardH = tags.length ? tagsY + tagsH + tagPad : statsY + 54
let inner = `<g transform="translate(52, 48)"><circle cx="0" cy="0" r="${radius}" fill="none" stroke="${t.grid}" stroke-width="5"/><circle cx="0" cy="0" r="${radius}" fill="none" stroke="${color}" stroke-width="5" stroke-dasharray="${circ.toFixed(1)}" stroke-dashoffset="${offset.toFixed(1)}" stroke-linecap="round" transform="rotate(-90)"/><text x="0" y="-4" text-anchor="middle" dominant-baseline="middle" font-family="${font}" font-size="${gf}" font-weight="800" fill="${color}">${esc(data.grade)}</text><text x="0" y="18" text-anchor="middle" font-family="${font}" font-size="11" fill="${t.text_secondary}">${data.score.toFixed(0)} / 100</text></g>
const breakdownLabels: Record<string, string> = {
commits: 'Commits', consistency: 'Consistency', repos: 'Repos',
stars: 'Stars', forks: 'Forks', activity: 'Activity', followers: 'Followers',
}
const topStrengths = Object.entries(data.breakdown || {})
.sort((a, b) => b[1] - a[1])
.slice(0, 2)
.map(([k]) => breakdownLabels[k] ?? k.charAt(0).toUpperCase() + k.slice(1))
const strengthsLine = topStrengths.length ? `Strong in ${topStrengths.join(' · ')}` : ''
let inner = `<g transform="translate(52, 48)"><circle cx="0" cy="0" r="${radius}" fill="none" stroke="${t.grid}" stroke-width="5"/><circle cx="0" cy="0" r="${radius}" fill="none" stroke="${color}" stroke-width="5" stroke-dasharray="${circ.toFixed(1)}" stroke-dashoffset="${offset.toFixed(1)}" stroke-linecap="round" transform="rotate(-90)"/><text x="0" y="${(gf * 0.35).toFixed(2)}" text-anchor="middle" font-family="${font}" font-size="${gf}" font-weight="800" fill="${color}">${esc(data.grade)}</text></g>
<line x1="100" y1="16" x2="100" y2="80" stroke="${t.grid}" stroke-width="1"/>
<g transform="translate(114, 26)"><text x="0" y="10" font-family="${font}" font-size="16" font-weight="700" fill="${t.text}">Developer Profile</text><text x="0" y="28" font-family="${font}" font-size="11" fill="${t.text_secondary}">Grade <tspan fill="${color}" font-weight="700">${esc(data.grade)}</tspan> · ${data.score.toFixed(0)}/100</text></g>
<g transform="translate(114, 26)"><text x="0" y="10" font-family="${font}" font-size="16" font-weight="700" fill="${t.text}">Developer Profile</text><text x="0" y="32" font-family="${font}" font-size="11" fill="${t.text_secondary}">${esc(strengthsLine)}</text><text x="0" y="50" font-family="${font}" font-size="10" letter-spacing="0.4" fill="${t.text_secondary}">Score <tspan fill="${t.text}" font-weight="600">${data.score.toFixed(0)}</tspan> / 100</text></g>
<line x1="20" y1="${statsY-4}" x2="360" y2="${statsY-4}" stroke="${t.grid}" stroke-width="0.5"/>
<g transform="translate(20, ${statsY})">${statsSvg}</g>`
@@ -238,6 +264,91 @@ function renderLanguages(languages: LanguageData[], t: Theme, s?: { max_language
return cardWrapper(inner, 380, rowsH + 36, t, 'Languages')
}
const STREAK_MONTHS = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
const STREAK_COLOR_RE = /^#[0-9a-fA-F]{3,8}$/
function streaksSafeColor(value: string | undefined, fallback: string): string {
if (typeof value !== 'string' || value.length > 32) return fallback
return STREAK_COLOR_RE.test(value) ? value : fallback
}
function streakParseDate(iso?: string): { y: number; m: number; d: number } | null {
if (!iso) return null
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso)
if (!m) return null
const y = Number(m[1]), mo = Number(m[2]), d = Number(m[3])
if (!y || mo < 1 || mo > 12 || d < 1 || d > 31) return null
return { y, m: mo, d }
}
function streakFmtDay(dt: { y: number; m: number; d: number }, includeYear: boolean): string {
return includeYear ? `${STREAK_MONTHS[dt.m-1]} ${dt.d}, ${dt.y}` : `${STREAK_MONTHS[dt.m-1]} ${dt.d}`
}
function fmtStreakCurrent(startIso?: string, todayIso?: string): string {
const s = streakParseDate(startIso); if (!s) return ''
const t = streakParseDate(todayIso) ?? { y: new Date().getFullYear(), m: 1, d: 1 }
return `${streakFmtDay(s, s.y !== t.y)} – Today`
}
function fmtStreakLongest(startIso?: string, endIso?: string): string {
const s = streakParseDate(startIso), e = streakParseDate(endIso)
if (s && e) {
if (s.y === e.y) return `${streakFmtDay(s, false)} – ${streakFmtDay(e, true)}`
return `${streakFmtDay(s, true)} – ${streakFmtDay(e, true)}`
}
if (e) return streakFmtDay(e, true)
if (s) return streakFmtDay(s, true)
return ''
}
function renderStreaks(data: StreakData, t: Theme, s?: { color?: string }): string {
const width = 380, height = 170
const currentColor = streaksSafeColor(s?.color, t.accent)
const maxColor = t.text
const leftX = 105, rightX = 275, dividerX = 190
const barX = 50, barW = 280
const fraction = data.max > 0 ? Math.max(0, Math.min(1, data.current / data.max)) : 0
const fillW = +(barW * fraction).toFixed(2)
const currentCaption = data.current > 0
? fmtStreakCurrent(data.current_start, data.last_active_date)
: ''
const longestCaption = fmtStreakLongest(data.max_start, data.max_end)
const endDot = fillW > 0
? `<circle cx="${(barX + fillW).toFixed(2)}" cy="94.5" r="3.5" fill="${currentColor}"/>`
: ''
const inner = `
<text x="${leftX}" y="22" text-anchor="middle" font-family="${font}" font-size="10" font-weight="600" letter-spacing="1.4" fill="${t.text_secondary}">CURRENT</text>
<text x="${leftX}" y="66" text-anchor="middle" font-family="${font}" font-size="40" font-weight="800" fill="${currentColor}">${data.current}</text>
<text x="${rightX}" y="22" text-anchor="middle" font-family="${font}" font-size="10" font-weight="600" letter-spacing="1.4" fill="${t.text_secondary}">LONGEST</text>
<text x="${rightX}" y="66" text-anchor="middle" font-family="${font}" font-size="40" font-weight="800" fill="${maxColor}">${data.max}</text>
<line x1="${dividerX}" y1="10" x2="${dividerX}" y2="76" stroke="${t.card_border}" stroke-width="1"/>
<rect x="${barX}" y="92" width="${barW}" height="5" rx="2.5" fill="${t.grid}"/>
<rect x="${barX}" y="92" width="${fillW}" height="5" rx="2.5" fill="${currentColor}"/>
${endDot}
<text x="${barX}" y="116" font-family="${font}" font-size="10" fill="${t.text_secondary}">${esc(currentCaption)}</text>
<text x="${barX + barW}" y="116" text-anchor="end" font-family="${font}" font-size="10" fill="${t.text_secondary}">${esc(longestCaption)}</text>`
return cardWrapper(inner, width, height, t, 'Streaks')
}
function achievementIconSvg(iconType: string, color: string): string {
// Mirrors generator/src/widgets/achievements.py::_achievement_icon_svg so
// the Workshop client preview matches the backend-rendered composite.
const icons: Record<string, string> = {
trophy: `<svg viewBox="0 0 24 24" width="24" height="24"><path d="M7 2h10v2h2.5c.8 0 1.5.7 1.5 1.5V8c0 1.7-1.3 3-3 3h-.5c-.5 1.5-1.8 2.7-3.5 3v2.5h3c.6 0 1 .4 1 1s-.4 1-1 1H7c-.6 0-1-.4-1-1s.4-1 1-1h3V14c-1.7-.3-3-1.5-3.5-3H6c-1.7 0-3-1.3-3-3V5.5C3 4.7 3.7 4 4.5 4H7V2zm0 4H4.5v2c0 .8.7 1.5 1.5 1.5h1V6zm12.5 0H17v3.5h1c.8 0 1.5-.7 1.5-1.5V6z" fill="${color}" opacity="0.85"/></svg>`,
medal: `<svg viewBox="0 0 24 24" width="24" height="24"><circle cx="12" cy="14" r="5" fill="${color}" opacity="0.2"/><circle cx="12" cy="14" r="4" fill="none" stroke="${color}" stroke-width="1.5"/><path d="M12 11.5l1 2 2.2.3-1.6 1.5.4 2.2-2-1-2 1 .4-2.2-1.6-1.5 2.2-.3z" fill="${color}"/><path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="${color}" stroke-width="1.5" fill="none" stroke-linecap="round"/></svg>`,
star: `<svg viewBox="0 0 24 24" width="24" height="24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" fill="none" stroke="${color}" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
hackathon: `<svg viewBox="0 0 24 24" width="24" height="24"><rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="${color}" stroke-width="1.5"/><rect x="3" y="16" width="18" height="1.5" rx="0.5" fill="${color}" opacity="0.85"/><path d="M9 9l-2 3 2 3m6-6l2 3-2 3" stroke="${color}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg>`,
}
return icons[iconType] ?? icons.trophy
}
function renderAchievements(achievements: AchievementInput[], t: Theme, s?: { max_items?: number }): string {
const maxItems = Math.min(Math.max(s?.max_items ?? 5, 1), 10)
const shown = achievements.filter(a => a.title.trim()).slice(0, maxItems)
@@ -249,7 +360,8 @@ function renderAchievements(achievements: AchievementInput[], t: Theme, s?: { ma
for (let i = 0; i < shown.length; i++) {
const ach = shown[i], y = i * 56
const color = accentColors[i % accentColors.length]
items += `<g transform="translate(16, ${y+8})"><rect width="348" height="48" rx="8" fill="${color}" opacity="0.06"/><rect width="348" height="48" rx="8" fill="none" stroke="${color}" stroke-width="0.5" opacity="0.3"/><text x="16" y="20" font-family="${font}" font-size="13" font-weight="600" fill="${t.text}">${esc(ach.title)}</text><text x="16" y="36" font-family="${font}" font-size="10" fill="${t.text_secondary}">${esc(ach.subtitle)}${ach.event_date ? ' · ' + ach.event_date : ''}</text></g>`
const icon = achievementIconSvg(ach.icon, color)
items += `<g transform="translate(16, ${y+8})"><rect width="348" height="48" rx="8" fill="${color}" opacity="0.06"/><rect width="348" height="48" rx="8" fill="none" stroke="${color}" stroke-width="0.5" opacity="0.3"/><g transform="translate(12, 12)">${icon}</g><text x="48" y="20" font-family="${font}" font-size="13" font-weight="600" fill="${t.text}">${esc(ach.title)}</text><text x="48" y="36" font-family="${font}" font-size="10" fill="${t.text_secondary}">${esc(ach.subtitle)}${ach.event_date ? ' · ' + ach.event_date : ''}</text></g>`
}
return cardWrapper(items, 380, shown.length * 56 + 50, t, 'Achievements')
@@ -283,6 +395,7 @@ export function renderAllWidgets(opts: {
widgetOrder: string[]
achievements: AchievementInput[]
widgetSettings: PerWidgetSettings
hiddenLanguages?: string[]
username: string
}): string {
const t = THEMES[opts.theme] ?? THEMES.dark
@@ -293,18 +406,30 @@ export function renderAllWidgets(opts: {
widgetSvgs.grade = renderGrade(opts.data.grade, t, opts.widgetSettings.grade)
if (enabled.has('impact') && opts.data.impact)
widgetSvgs.impact = renderImpact(opts.data.impact, t, opts.widgetSettings.impact)
if (enabled.has('streaks') && opts.data.streaks)
widgetSvgs.streaks = renderStreaks(opts.data.streaks, t, opts.widgetSettings.streaks)
if (enabled.has('collaborators') && opts.data.collaborators)
widgetSvgs.collaborators = renderCollaborators(opts.data.collaborators, t, opts.widgetSettings.collaborators)
if (enabled.has('focus') && opts.data.focus)
widgetSvgs.focus = renderFocus(opts.data.focus, t, opts.widgetSettings.focus)
if (enabled.has('languages') && opts.data.languages)
widgetSvgs.languages = renderLanguages(opts.data.languages, t, opts.widgetSettings.languages)
if (enabled.has('languages') && opts.data.languages) {
// Apply hidden_languages client-side too so the Workshop preview reflects
// the user's choice instantly — backend filtering only kicks in on the
// next prefetch or on POST /generate.
const hiddenSet = new Set(opts.hiddenLanguages ?? [])
const filtered = opts.data.languages.filter(l => !hiddenSet.has(l.language))
const total = filtered.reduce((a, l) => a + l.percentage, 0) || 1
const rescaled = filtered.map(l => ({ ...l, percentage: Math.round(l.percentage / total * 1000) / 10 }))
widgetSvgs.languages = renderLanguages(rescaled, t, opts.widgetSettings.languages)
}
if (enabled.has('achievements'))
widgetSvgs.achievements = renderAchievements(opts.achievements, t, opts.widgetSettings.achievements)
// Compose
const totalW = 420, headerH = 60, padding = 20, gap = 16
const ordered = opts.widgetOrder.filter(k => enabled.has(k) && widgetSvgs[k])
const showName = enabled.has('name')
const totalW = 420, headerH = showName ? 60 : 0, padding = 20, gap = 16
// "name" is a pseudo-widget — it controls the header, not a rendered svg.
const ordered = opts.widgetOrder.filter(k => k !== 'name' && enabled.has(k) && widgetSvgs[k])
const parts = ordered.map(key => {
const { inner, h } = extractInner(widgetSvgs[key], key)
@@ -314,8 +439,21 @@ export function renderAllWidgets(opts: {
const contentH = parts.reduce((a, p) => a + p.h, 0) + gap * Math.max(parts.length - 1, 0)
const totalH = headerH + contentH + padding * 2 + 10
const avatar = `<circle cx="30" cy="30" r="16" fill="${t.accent}" opacity="0.3"/>`
const header = `${avatar}<text x="54" y="38" font-family="${font}" font-size="16" font-weight="700" fill="${t.text}">${esc(opts.username || 'Developer')}</text><line x1="${padding}" y1="${headerH}" x2="${totalW-padding}" y2="${headerH}" stroke="${t.card_border}" stroke-width="0.5"/>`
// Header (avatar + username). Only drawn when "name" is enabled. The
// avatar pulls from github.com/<user>.png which redirects to
// avatars.githubusercontent.com; the accent circle underneath is a
// fallback for missing users / slow loads.
let header = ''
if (showName) {
const avatarUrl = opts.username
? `https://github.com/${encodeURIComponent(opts.username)}.png?size=64`
: ''
const avatarImg = avatarUrl
? `<image x="14" y="14" width="32" height="32" href="${esc(avatarUrl)}" clip-path="url(#mainAvatarClip)" preserveAspectRatio="xMidYMid slice"/>`
: ''
const avatar = `<defs><clipPath id="mainAvatarClip"><circle cx="30" cy="30" r="16"/></clipPath></defs><circle cx="30" cy="30" r="16" fill="${t.accent}" opacity="0.3"/>${avatarImg}`
header = `${avatar}<text x="54" y="38" font-family="${font}" font-size="16" font-weight="700" fill="${t.text}">${esc(opts.username || 'Developer')}</text><line x1="${padding}" y1="${headerH}" x2="${totalW-padding}" y2="${headerH}" stroke="${t.card_border}" stroke-width="0.5"/>`
}
let yOffset = headerH + padding
let embedded = ''
@@ -328,6 +466,6 @@ export function renderAllWidgets(opts: {
<rect width="${totalW}" height="${totalH}" rx="16" fill="${t.bg}"/>
<rect x="0.5" y="0.5" width="${totalW-1}" height="${totalH-1}" rx="16" fill="none" stroke="${t.card_border}" stroke-width="1"/>
${header}${embedded}
<text x="${totalW/2}" y="${totalH-8}" text-anchor="middle" font-family="${font}" font-size="9" fill="${t.text_secondary}" opacity="0.5">Generated with ♥</text>
<text x="${totalW/2}" y="${totalH-8}" text-anchor="middle" font-family="${font}" font-size="9" fill="${t.text_secondary}" opacity="0.5">Generated with gh-stats.com</text>
</svg>`
}
@@ -0,0 +1,90 @@
// Settings ⇄ query-string encoder for the public widget embed URL.
//
// The backend's `GET /api/<u>?...` accepts the same fields that
// `PATCH /settings` takes, but encoded flat in the query. The encoding is
// designed to stay human-readable for the common cases (theme, widgets,
// order) and fall back to compact base64 only for achievements, which are
// shape-y enough that spelling them out inflates the URL.
//
// Keep this in sync with `sanitize_settings_query` in `generator/src/api.py`.
import type { WidgetSettings, Achievement } from '../App'
// The theme id the backend treats as the default. Omit from the URL so
// the common case stays terse.
const DEFAULT_THEME = 'midnight'
// Standard widget set / order. If the user hasn't deviated, skip emitting
// the param so the embed URL doesn't balloon with boilerplate.
const DEFAULT_WIDGETS = ['name', 'grade', 'impact', 'streaks', 'collaborators', 'focus', 'languages']
const DEFAULT_ORDER = ['name', 'grade', 'impact', 'streaks', 'collaborators', 'focus', 'languages', 'achievements']
function arrayEquals(a: string[], b: string[]): boolean {
if (a.length !== b.length) return false
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false
return true
}
// RFC-4648 url-safe base64 without padding. Matches what Python's
// `base64.urlsafe_b64decode` re-pads in the backend parser.
function urlsafeB64Encode(s: string): string {
const bytes = new TextEncoder().encode(s)
let bin = ''
for (const b of bytes) bin += String.fromCharCode(b)
return btoa(bin).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '')
}
function achievementsParam(achievements: Achievement[]): string | null {
const keepers = achievements.filter(a => (a.title || '').trim())
if (!keepers.length) return null
const payload = keepers.map(a => ({
title: a.title,
subtitle: a.subtitle,
event_date: a.event_date,
icon: a.icon,
}))
return urlsafeB64Encode(JSON.stringify(payload))
}
export function settingsToQuery(settings: WidgetSettings): string {
const params = new URLSearchParams()
if (settings.theme && settings.theme !== DEFAULT_THEME) {
params.set('theme', settings.theme)
}
if (!arrayEquals(settings.widgets, DEFAULT_WIDGETS)) {
params.set('widgets', settings.widgets.join(','))
}
if (!arrayEquals(settings.widgetOrder, DEFAULT_ORDER)) {
params.set('order', settings.widgetOrder.join(','))
}
if (settings.hiddenLanguages.length) {
params.set('hide', settings.hiddenLanguages.join(','))
}
if (settings.customTags.length) {
params.set('tags', settings.customTags.join(','))
}
// Per-widget settings flatten to `<widget>.<key>=<value>`. Any undefined
// or null leaf is skipped so the URL stays minimal.
for (const [widget, ws] of Object.entries(settings.widgetSettings)) {
if (!ws) continue
for (const [key, val] of Object.entries(ws as Record<string, unknown>)) {
if (val === undefined || val === null || val === '') continue
params.set(`${widget}.${key}`, String(val))
}
}
const ach = achievementsParam(settings.achievements)
if (ach) params.set('ach', ach)
// URLSearchParams.toString() percent-encodes values (including the `#` in
// hex colors), so callers can splice the result straight into a URL.
return params.toString()
}
export function buildEmbedUrl(origin: string, username: string, settings: WidgetSettings): string {
const qs = settingsToQuery(settings)
const base = `${origin}/api/${encodeURIComponent(username)}`
return qs ? `${base}?${qs}` : base
}
@@ -0,0 +1,79 @@
import { useEffect, useState } from 'react'
import type { ReactNode } from 'react'
import { fetchSummary, type Summary } from '../lib/dev'
import { StatCards } from '../components/StatCards'
import { UsersTable } from '../components/UsersTable'
import { LatencyChart } from '../components/LatencyChart'
import { HealthStrip } from '../components/HealthStrip'
import { GrowthChart } from '../components/GrowthChart'
const REFRESH_MS = 15_000
export function DevScreen() {
const [s, setS] = useState<Summary | null>(null)
const [error, setError] = useState<string | null>(null)
const [lastRefresh, setLastRefresh] = useState<Date>(new Date())
useEffect(() => {
let alive = true
const load = () =>
fetchSummary()
.then(v => { if (!alive) return; setS(v); setError(null); setLastRefresh(new Date()) })
.catch(e => { if (alive) setError(e.message || 'error') })
load()
const h = window.setInterval(load, REFRESH_MS)
return () => { alive = false; window.clearInterval(h) }
}, [])
if (error === 'dashboard_disabled') {
return (
<Shell>
<div className="rounded-lg border border-amber-500/30 bg-amber-500/[0.06] p-6 text-amber-200">
The /dev dashboard is not configured on this deploy
(set DEV_DASHBOARD_USER and DEV_DASHBOARD_PASSWORD).
</div>
</Shell>
)
}
if (error === 'unauthorized') {
return (
<Shell>
<div className="text-white/60">Sign in to view the dashboard. Reload to retry.</div>
</Shell>
)
}
return (
<Shell lastRefresh={lastRefresh}>
{s ? <StatCards s={s} /> : <div className="text-white/40">loading…</div>}
<div className="mt-6">
<GrowthChart />
</div>
<div className="mt-6">
<UsersTable />
</div>
<div className="mt-6 grid grid-cols-1 gap-4 md:grid-cols-2">
<LatencyChart />
<HealthStrip />
</div>
</Shell>
)
}
function Shell({ children, lastRefresh }: { children: ReactNode; lastRefresh?: Date }) {
return (
<div className="min-h-screen bg-[#0b0d10] px-6 py-6 text-white">
<div className="mx-auto max-w-6xl">
<header className="mb-6 flex items-baseline justify-between">
<h1 className="font-mono text-lg text-white/90">/dev · gh-stats analytics</h1>
{lastRefresh && (
<div className="text-xs text-white/40">
last refresh {lastRefresh.toLocaleTimeString()}
</div>
)}
</header>
{children}
</div>
</div>
)
}
+115 -66
View File
@@ -1,6 +1,5 @@
import { useState, useEffect } from 'react'
import DOMPurify from 'dompurify'
import type { WidgetSettings } from '../App'
import { useMemo, useState } from 'react'
function sanitizeSvg(raw: string): string {
return DOMPurify.sanitize(raw, {
@@ -12,94 +11,144 @@ function sanitizeSvg(raw: string): string {
type Props = {
username: string
settings: WidgetSettings
fetchDone: boolean
fetchError: string | null
generating: boolean
generatedSvg: string | null
generateError: string | null
// Owner renders embed as /api/<u>; visitors get /api/<u>?<their settings>.
// We display whichever URL was used to produce the SVG above, so the
// snippet they copy matches what they're previewing.
embedUrl: string
// 'building' means the SVG above is still the "Building @user's
// widget…" placeholder; the parent is auto-polling for the real one.
widgetStatus: 'ready' | 'building' | 'not_found' | 'rate_limited'
onBack: () => void
onRegenerate: () => void
// Manual refetch — same fetch the auto-poll runs, exposed as a button
// so the user has a way to nudge it if they want.
onRefresh: () => void
}
export function ResultScreen({ username, settings, fetchDone, fetchError, onBack }: Props) {
const [svgContent, setSvgContent] = useState<string>('')
const [loading, setLoading] = useState(true)
const [generated, setGenerated] = useState(false)
export function ResultScreen({ username, generating, generatedSvg, generateError, embedUrl, widgetStatus, onBack, onRegenerate, onRefresh }: Props) {
const safeSvg = useMemo(() => (generatedSvg ? sanitizeSvg(generatedSvg) : ''), [generatedSvg])
const [copied, setCopied] = useState(false)
const fallbackUrl = `${window.location.origin}/api/${encodeURIComponent(username)}`
const finalUrl = embedUrl || fallbackUrl
const embedSnippet = `[![${username}](${finalUrl})](${window.location.origin})`
// Generate the final SVG once fetch completes
useEffect(() => {
if (!fetchDone) return
if (generated) return
setLoading(true)
fetch('/api/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username,
theme: settings.theme,
widgets: settings.widgets,
widget_order: ['grade', 'impact', 'collaborators', 'focus', 'languages', 'achievements'],
custom_tags: settings.customTags.length ? settings.customTags : undefined,
hidden_languages: settings.hiddenLanguages.length ? settings.hiddenLanguages : undefined,
achievements: settings.achievements.filter(a => a.title.trim()),
widget_settings: settings.widgetSettings,
format: 'svg',
}),
})
.then(r => r.text())
.then(svg => {
// SVG is sanitized via DOMPurify before rendering
setSvgContent(sanitizeSvg(svg))
setLoading(false)
setGenerated(true)
})
.catch(() => setLoading(false))
}, [fetchDone])
const waiting = !fetchDone
const copy = async () => {
try {
await navigator.clipboard.writeText(embedSnippet)
setCopied(true)
setTimeout(() => setCopied(false), 1500)
} catch {
/* ignore */
}
}
return (
<div className="min-h-screen flex flex-col items-center animate-fade-in-up">
{/* Back button */}
<div className="w-full max-w-2xl px-6 pt-6">
<div className="w-full max-w-3xl px-6 pt-6 flex items-center justify-between">
<button
onClick={onBack}
className="flex items-center gap-1.5 text-xs text-gray-400 hover:text-gray-600 transition-colors"
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M19 12H5M12 19l-7-7 7-7"/>
<path d="M19 12H5M12 19l-7-7 7-7" />
</svg>
Back
</button>
<button
onClick={onRegenerate}
disabled={generating}
title="Re-render the widget from the most recent cached data. Does not re-fetch from GitHub."
className="flex items-center gap-1.5 text-xs text-gray-500 hover:text-gray-800 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className={generating ? 'animate-spin-slow' : ''}
>
<path d="M21 12a9 9 0 1 1-3-6.7L21 8" />
<path d="M21 3v5h-5" />
</svg>
{generating ? 'Regenerating…' : 'Regenerate'}
</button>
</div>
<div className="flex-1 flex flex-col items-center justify-center px-6 pb-12">
<h2 className="font-serif text-2xl text-gray-800 tracking-tight mb-1">
<div className="flex-1 flex flex-col items-center justify-center px-6 pb-12 w-full max-w-3xl">
<h2 className="font-serif text-3xl text-gray-800 tracking-tight mb-2">
Your Widget
</h2>
{waiting ? (
<div className="mt-8 flex flex-col items-center gap-3">
<div className="w-5 h-5 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin-slow" />
<p className="text-xs text-gray-400">Generating with real data...</p>
{generating && (
<div className="mt-10 flex flex-col items-center gap-3">
<div className="w-6 h-6 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin-slow" />
<p className="text-xs text-gray-400">Generating with real data…</p>
</div>
) : loading ? (
<div className="mt-8 flex flex-col items-center gap-3">
<div className="w-5 h-5 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin-slow" />
<p className="text-xs text-gray-400">Rendering...</p>
)}
{!generating && generateError && (
<div className="mt-10 flex flex-col items-center gap-3">
<p className="text-sm text-red-500">{generateError}</p>
</div>
) : (
)}
{!generating && !generateError && safeSvg && (
<>
{fetchError && (
<p className="text-[10px] text-amber-500 mb-4">
Could not fetch live data — showing demo widget
</p>
{widgetStatus === 'building' && (
<div className="mt-6 flex items-center gap-2 text-xs text-gray-500">
<div className="w-3 h-3 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin-slow" />
<span>Still building on the server — this page will update automatically when ready.</span>
<button
onClick={onRefresh}
className="ml-2 px-2 py-1 rounded-md text-gray-600 hover:text-gray-900 hover:bg-gray-100 transition-colors"
>
Check now
</button>
</div>
)}
{!fetchError && (
<p className="text-xs text-gray-400 mb-6">
Generated with real data
</p>
)}
{/* SVG content is sanitized with DOMPurify.sanitize() before rendering */}
<div dangerouslySetInnerHTML={{ __html: svgContent }} />
<div className="w-full mt-6 rounded-2xl bg-white shadow-lg ring-1 ring-gray-200 p-6 flex justify-center">
{/*
Force the inline SVG to scale up to the card width. The
composite is authored at 380px wide — without this the
preview looked tiny on wide screens.
*/}
<div
className="w-full max-w-xl [&_svg]:w-full [&_svg]:h-auto"
dangerouslySetInnerHTML={{ __html: safeSvg }}
/>
</div>
<div className="w-full mt-8">
<p className="text-xs uppercase tracking-wider text-gray-500 mb-2">Embed in your README</p>
<div className="relative">
<pre className="bg-gray-900 text-gray-100 text-xs p-4 pr-12 rounded-lg overflow-x-auto">
{embedSnippet}
</pre>
<button
onClick={copy}
title={copied ? 'Copied!' : 'Copy'}
className="absolute top-2 right-2 p-1.5 rounded-md text-gray-400 hover:text-gray-100 hover:bg-gray-800 transition-colors"
>
{copied ? (
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polyline points="20 6 9 17 4 12" />
</svg>
) : (
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
</svg>
)}
</button>
</div>
</div>
</>
)}
</div>
+60 -25
View File
@@ -4,8 +4,14 @@ type Props = {
onSearch: (username: string) => void
}
// A real card served by the live API, so the landing page shows the actual
// product, not a mockup. The frame below has a fixed height so a slow or
// failed load never reflows the page or pushes the input out of view.
const EXAMPLE_URL = 'https://gh-stats.com/api/shaymanor'
export function SearchScreen({ onSearch }: Props) {
const [value, setValue] = useState('')
const [exampleFailed, setExampleFailed] = useState(false)
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
@@ -14,31 +20,60 @@ export function SearchScreen({ onSearch }: Props) {
}
return (
<div className="min-h-screen flex items-center justify-center animate-fade-in-up">
<div className="text-center w-full max-w-md px-6">
<h1 className="font-serif text-4xl text-gray-800 tracking-tight mb-2">
GitHub Stats
</h1>
<p className="text-sm text-gray-400 mb-8">
Generate your profile widget
</p>
<form onSubmit={handleSubmit} className="flex gap-2">
<input
type="text"
value={value}
onChange={e => setValue(e.target.value)}
placeholder="Enter GitHub username..."
autoFocus
className="flex-1 px-4 py-3 rounded-xl border border-gray-200 bg-white text-sm text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 transition-colors"
/>
<button
type="submit"
disabled={!value.trim()}
className="px-6 py-3 rounded-xl bg-gray-800 text-white text-sm font-medium hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
>
Go
</button>
</form>
<div className="min-h-screen flex items-start md:items-center justify-center px-6 py-12 animate-fade-in-up">
<div className="w-full max-w-4xl grid gap-10 md:grid-cols-2 md:items-center">
<div className="w-full max-w-md mx-auto md:mx-0 text-center md:text-left">
<h1 className="font-serif text-4xl md:text-5xl text-gray-800 tracking-tight mb-3">
GitHub Stats
</h1>
<p className="text-sm text-gray-500 leading-relaxed mb-8">
One image for your profile README: your score, contribution timeline,
top collaborators, language breakdown, commit streaks and auto-awarded tags.
</p>
<form onSubmit={handleSubmit} className="flex gap-2">
<input
type="text"
value={value}
onChange={e => setValue(e.target.value)}
placeholder="Enter GitHub username..."
autoFocus
className="flex-1 min-w-0 px-4 py-3 rounded-xl border border-gray-200 bg-white text-sm text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 transition-colors"
/>
<button
type="submit"
disabled={!value.trim()}
className="px-6 py-3 rounded-xl bg-gray-800 text-white text-sm font-medium hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
>
Go
</button>
</form>
<p className="mt-3 text-xs text-gray-400">
Five themes · one line of markdown · no signup
</p>
</div>
<div className="w-full max-w-[420px] mx-auto md:mx-0">
<div className="relative h-[300px] md:h-[420px] overflow-hidden rounded-2xl border border-gray-200 bg-white">
{exampleFailed ? (
<p className="absolute inset-0 flex items-center justify-center text-xs text-gray-400">
Example card unavailable
</p>
) : (
<img
src={EXAMPLE_URL}
width={420}
height={1196}
alt="Example stats card"
onError={() => setExampleFailed(true)}
className="block w-full"
/>
)}
<div className="pointer-events-none absolute inset-x-0 bottom-0 h-14 md:h-16 bg-gradient-to-t from-gray-50 to-transparent" />
</div>
<p className="mt-3 text-center md:text-left font-mono text-[11px] text-gray-400 truncate">
gh-stats.com/api/shaymanor
</p>
</div>
</div>
</div>
)
+585 -269
View File
@@ -1,29 +1,111 @@
import { useState, useEffect, useRef, useMemo } from 'react'
import { useState, useMemo, type ReactNode } from 'react'
import DOMPurify from 'dompurify'
import type { WidgetSettings, Achievement, PerWidgetSettings } from '../App'
import { renderAllWidgets, type WidgetData } from '../lib/renderWidgets'
import type { Me } from '../lib/auth'
// Defense-in-depth: the client-rendered preview assembles SVG from
// GitHub-sourced strings (collaborator logins, repo names) and user-typed
// achievement text. renderWidgets escapes known fields, but one missed
// interpolation anywhere upstream would turn into HTML in the preview.
// DOMPurify neutralises that without affecting normal SVG shapes/styles.
const SVG_SANITIZE_CONFIG = {
USE_PROFILES: { svg: true, svgFilters: true },
ADD_TAGS: [
'image', 'use', 'clipPath', 'defs', 'style', 'animate', 'animateTransform',
'feDropShadow', 'filter', 'linearGradient', 'stop',
],
ADD_ATTR: [
'xlink:href', 'href', 'clip-path', 'viewBox', 'preserveAspectRatio',
'xmlns', 'xmlns:xlink', 'rx', 'ry', 'attributeName', 'from', 'to', 'dur',
'fill', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap',
'stroke-linejoin', 'dominant-baseline', 'letter-spacing', 'opacity',
'filter', 'flood-color', 'flood-opacity', 'stdDeviation',
],
}
// Mini-preview swatches (bg + card + accent). Flat-color swatches all read
// the same dark/light — showing the accent color is what actually separates
// Midnight (blue) from Onyx (purple) from Nord (cyan), etc.
const THEMES = [
{ id: 'midnight', label: 'Midnight', color: '#121820' },
{ id: 'onyx', label: 'Onyx', color: '#09090b' },
{ id: 'nord', label: 'Nord', color: '#1e2433' },
{ id: 'clean', label: 'Clean', color: '#ffffff', border: true },
{ id: 'paper', label: 'Paper', color: '#faf8f5', border: true },
{ id: 'midnight', label: 'Midnight', bg: '#121820', card: '#1a2230', border: '#2a3444', accent: '#58a6ff', light: false },
{ id: 'onyx', label: 'Onyx', bg: '#09090b', card: '#18181b', border: '#27272a', accent: '#a78bfa', light: false },
{ id: 'nord', label: 'Nord', bg: '#1e2433', card: '#2a3142', border: '#3d4659', accent: '#88c0d0', light: false },
{ id: 'clean', label: 'Clean', bg: '#ffffff', card: '#f6f8fa', border: '#d8dee4', accent: '#0969da', light: true },
{ id: 'paper', label: 'Paper', bg: '#faf8f5', card: '#f5f0eb', border: '#e0d8cf', accent: '#b45309', light: true },
]
const ALL_WIDGETS = [
// "name" is the avatar + username header. Pinned at the top — can be
// toggled off but never reordered. Keep this entry first.
{ id: 'name', label: 'Name' },
{ id: 'grade', label: 'Grade' },
{ id: 'impact', label: 'Impact Timeline' },
{ id: 'streaks', label: 'Streaks' },
{ id: 'collaborators', label: 'Top Collaborators' },
{ id: 'focus', label: 'Recent Focus' },
{ id: 'languages', label: 'Languages' },
{ id: 'achievements', label: 'Achievements' },
]
const ICONS = [
{ id: 'trophy', label: '🏆' },
{ id: 'medal', label: '🥇' },
{ id: 'star', label: '⭐' },
{ id: 'hackathon', label: '💻' },
// Lucide-style hollow glyphs: consistent stroke-weight + viewBox so the 4
// buttons line up and read as one icon family. Kept as JSX so they inherit
// currentColor from the surrounding button's text color.
const ICON_SVG_PROPS = {
width: 16,
height: 16,
viewBox: '0 0 24 24',
fill: 'none',
stroke: 'currentColor',
strokeWidth: 1.75,
strokeLinecap: 'round' as const,
strokeLinejoin: 'round' as const,
}
const ICONS: { id: string; svg: ReactNode }[] = [
{
id: 'trophy',
svg: (
<svg {...ICON_SVG_PROPS}>
<path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6" />
<path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18" />
<path d="M4 22h16" />
<path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" />
<path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" />
<path d="M18 2H6v7a6 6 0 0 0 12 0V2z" />
</svg>
),
},
{
id: 'medal',
svg: (
<svg {...ICON_SVG_PROPS}>
<path d="M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15" />
<path d="M11 12 5.12 2.2" />
<path d="m13 12 5.88-9.8" />
<path d="M8 7h8" />
<circle cx="12" cy="17" r="5" />
<path d="M12 18v-2h-.5" />
</svg>
),
},
{
id: 'star',
svg: (
<svg {...ICON_SVG_PROPS}>
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26" />
</svg>
),
},
{
id: 'hackathon',
svg: (
<svg {...ICON_SVG_PROPS}>
<polyline points="16 18 22 12 16 6" />
<polyline points="8 6 2 12 8 18" />
</svg>
),
},
]
const COLOR_PRESETS = [
@@ -61,6 +143,63 @@ function NumberStepper({ value, min, max, onChange }: {
)
}
// Common "noise" languages users typically want to hide — shown even when
// the account-level detection hasn't surfaced them yet (e.g., first load).
const COMMON_HIDE_LANGS = ['HTML', 'CSS', 'SCSS', 'Jupyter Notebook', 'TeX', 'Shell', 'Dockerfile', 'Makefile', 'Batchfile']
function HiddenLanguagesPicker({
detected, hidden, onChange,
}: {
detected: { language: string }[]
hidden: string[]
onChange: (next: string[]) => void
}) {
const seen = new Set<string>()
const options: string[] = []
for (const d of detected) if (d.language && !seen.has(d.language)) { seen.add(d.language); options.push(d.language) }
for (const c of COMMON_HIDE_LANGS) if (!seen.has(c)) { seen.add(c); options.push(c) }
// Preserve any user-set hidden that we haven't otherwise seen.
for (const h of hidden) if (!seen.has(h)) { seen.add(h); options.push(h) }
const toggle = (lang: string) => {
onChange(hidden.includes(lang) ? hidden.filter(h => h !== lang) : [...hidden, lang])
}
return (
<div>
<div className="flex items-center justify-between mb-1.5">
<span className="text-[10px] text-gray-500">Hide languages</span>
{hidden.length > 0 && (
<button
onClick={() => onChange([])}
className="text-[10px] text-gray-400 hover:text-gray-600 transition-colors"
>
Clear
</button>
)}
</div>
<div className="flex flex-wrap gap-1">
{options.map(lang => {
const active = hidden.includes(lang)
return (
<button
key={lang}
onClick={() => toggle(lang)}
className={`px-2 py-0.5 rounded-md text-[10px] transition-colors ${
active
? 'bg-gray-800 text-white border border-gray-800'
: 'bg-white text-gray-500 border border-gray-200 hover:text-gray-800 hover:border-gray-300'
}`}
>
{lang}
</button>
)
})}
</div>
</div>
)
}
function ColorPicker({ value, onChange }: { value: string; onChange: (v: string) => void }) {
return (
<div className="flex gap-1.5 flex-wrap">
@@ -69,7 +208,7 @@ function ColorPicker({ value, onChange }: { value: string; onChange: (v: string)
key={c}
onClick={() => onChange(c)}
className={`w-5 h-5 rounded-full transition-all ${
value === c ? 'ring-2 ring-offset-1 ring-blue-500' : 'hover:ring-1 hover:ring-gray-300'
value === c ? 'ring-2 ring-offset-1 ring-gray-900' : 'hover:ring-1 hover:ring-gray-300'
}`}
style={{ backgroundColor: c }}
/>
@@ -85,6 +224,11 @@ type Props = {
onGenerate: () => void
onBack: () => void
fetchDone: boolean
fetchError: string | null
widgetData: WidgetData | null
isDemoData: boolean
me: Me
onAuthChange?: (m: Me) => void
}
export function WorkshopScreen({
@@ -94,11 +238,51 @@ export function WorkshopScreen({
onGenerate,
onBack,
fetchDone,
fetchError,
widgetData,
isDemoData,
me,
}: Props) {
const [widgetData, setWidgetData] = useState<WidgetData | null>(null)
const [dataLoading, setDataLoading] = useState(true)
const canEdit = !!me.login && me.login.toLowerCase() === username.toLowerCase()
const [expandedWidget, setExpandedWidget] = useState<string | null>(null)
const dataFetched = useRef(false)
// Index being dragged + index currently hovered (for drop-line indicator).
const [dragIndex, setDragIndex] = useState<number | null>(null)
const [dropIndex, setDropIndex] = useState<number | null>(null)
// Same pattern for the achievements list so the two drag interactions
// don't share state and fight each other.
const [achDragIndex, setAchDragIndex] = useState<number | null>(null)
const [achDropIndex, setAchDropIndex] = useState<number | null>(null)
// Build the render-order list from settings.widgetOrder, tolerating
// stale persisted data: drop unknown ids, append any known widgets
// the stored order forgot. Keeps the UI functional if ALL_WIDGETS
// gains or loses an entry between releases.
const knownIds = useMemo(() => new Set(ALL_WIDGETS.map(w => w.id)), [])
// "name" is pinned at index 0 regardless of persisted order. We still keep
// it in orderedIds so the composite-render path can find it, but the drag
// UI below treats it as non-reorderable.
const orderedIds = useMemo(() => {
const seen = new Set<string>()
const out: string[] = ['name']
seen.add('name')
for (const id of settings.widgetOrder) {
if (knownIds.has(id) && !seen.has(id)) { seen.add(id); out.push(id) }
}
for (const w of ALL_WIDGETS) {
if (!seen.has(w.id)) { seen.add(w.id); out.push(w.id) }
}
return out
}, [settings.widgetOrder, knownIds])
const moveWidget = (from: number, to: number) => {
if (from === to || from < 0 || to < 0 || from >= orderedIds.length || to >= orderedIds.length) return
// Never move "name" and never drop another widget above it (index 0).
if (orderedIds[from] === 'name' || to === 0) return
const next = orderedIds.slice()
const [item] = next.splice(from, 1)
next.splice(to, 0, item)
onSettingsChange({ ...settings, widgetOrder: next })
}
const updateSetting = <K extends keyof WidgetSettings>(key: K, val: WidgetSettings[K]) => {
onSettingsChange({ ...settings, [key]: val })
@@ -144,45 +328,30 @@ export function WorkshopScreen({
updateSetting('achievements', settings.achievements.filter((_, i) => i !== idx))
}
// Fetch widget data once on mount (or when fetch completes)
useEffect(() => {
if (dataFetched.current || !fetchDone) return
dataFetched.current = true
setDataLoading(true)
fetch('/api/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username,
widgets: ['grade', 'impact', 'collaborators', 'focus', 'languages'],
widget_order: ['grade', 'impact', 'collaborators', 'focus', 'languages'],
custom_tags: settings.customTags.length ? settings.customTags : undefined,
hidden_languages: settings.hiddenLanguages.length ? settings.hiddenLanguages : undefined,
format: 'data',
}),
})
.then(r => r.json())
.then(json => {
setWidgetData(json.data)
setDataLoading(false)
})
.catch(() => setDataLoading(false))
}, [fetchDone])
const moveAchievement = (from: number, to: number) => {
const list = settings.achievements
if (from === to || from < 0 || to < 0 || from >= list.length || to >= list.length) return
const next = list.slice()
const [item] = next.splice(from, 1)
next.splice(to, 0, item)
updateSetting('achievements', next)
}
// Render SVG client-side whenever settings change (instant, no API call)
const svgContent = useMemo(() => {
if (!widgetData) return ''
return renderAllWidgets({
const raw = renderAllWidgets({
data: widgetData,
theme: settings.theme,
widgets: settings.widgets,
widgetOrder: ['grade', 'impact', 'collaborators', 'focus', 'languages', 'achievements'],
widgetOrder: orderedIds,
achievements: settings.achievements,
widgetSettings: settings.widgetSettings,
hiddenLanguages: settings.hiddenLanguages,
username,
})
}, [widgetData, settings, username])
return DOMPurify.sanitize(raw, SVG_SANITIZE_CONFIG)
}, [widgetData, settings, username, orderedIds])
return (
<div className="min-h-screen animate-fade-in-up">
@@ -200,247 +369,394 @@ export function WorkshopScreen({
Back
</button>
<div className="text-sm font-semibold text-gray-800 mb-1">{username}</div>
<div className="flex items-center gap-1.5 text-[10px] text-gray-400 mb-6">
{fetchDone ? (
<>
<div className="w-1.5 h-1.5 rounded-full bg-emerald-400" />
Data ready
</>
) : (
<>
<div className="w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse" />
Fetching data...
</>
)}
</div>
<div className="text-sm font-semibold text-gray-800 mb-4">{username}</div>
{/* Theme */}
<div className="mb-5">
<div className="text-[10px] uppercase tracking-wider text-gray-400 font-medium mb-3">Theme</div>
<div className="flex gap-2 flex-wrap">
{THEMES.map(t => (
<button
key={t.id}
onClick={() => updateSetting('theme', t.id)}
title={t.label}
className={`w-9 h-9 rounded-lg transition-all ${
settings.theme === t.id
? 'ring-2 ring-blue-500 ring-offset-2'
: t.border
? 'border border-gray-200 hover:border-gray-300'
: 'hover:ring-1 hover:ring-gray-300 hover:ring-offset-1'
}`}
style={{ backgroundColor: t.color }}
/>
))}
</div>
<div className="text-[10px] text-gray-400 mt-1.5">
{THEMES.find(t => t.id === settings.theme)?.label}
</div>
</div>
{/* Widgets with inline advanced settings */}
<div className="mb-5">
<div className="text-[10px] uppercase tracking-wider text-gray-400 font-medium mb-3">Widgets</div>
<div className="flex flex-col gap-0.5">
{ALL_WIDGETS.map(w => {
const enabled = settings.widgets.includes(w.id)
const hasAdvanced = ['grade', 'impact', 'collaborators', 'focus', 'languages', 'achievements'].includes(w.id)
const isExpanded = expandedWidget === w.id && enabled
return (
<div key={w.id}>
<div className="flex items-center">
<button
onClick={() => toggleWidget(w.id)}
className={`flex-1 flex items-center gap-2.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors text-left ${
enabled
? 'text-gray-800 bg-gray-50'
: 'text-gray-400 hover:text-gray-500 hover:bg-gray-50/50'
}`}
>
<div className={`w-3.5 h-3.5 rounded flex-shrink-0 transition-colors ${enabled ? 'bg-blue-500' : 'bg-gray-200'}`} />
{w.label}
</button>
{hasAdvanced && enabled && (
<button
onClick={() => toggleAdvanced(w.id)}
className="p-1.5 text-gray-400 hover:text-gray-600 transition-colors"
title="Advanced settings"
>
<ChevronIcon open={isExpanded} />
</button>
)}
</div>
{isExpanded && (
<div className="ml-6 mt-1 mb-2 p-2.5 rounded-lg bg-gray-50/80 border border-gray-100 flex flex-col gap-2.5">
{w.id === 'grade' && (
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max tags</span>
<NumberStepper
value={getWidgetSetting('grade', 'max_tags', 6)}
min={1} max={20}
onChange={v => updateWidgetSetting('grade', 'max_tags', v)}
/>
</div>
)}
{w.id === 'impact' && (
<div>
<span className="text-[10px] text-gray-500 block mb-1.5">Line color</span>
<ColorPicker
value={getWidgetSetting('impact', 'line_color', '#58a6ff')}
onChange={v => updateWidgetSetting('impact', 'line_color', v)}
/>
</div>
)}
{w.id === 'collaborators' && (
<div className="flex flex-col gap-2.5">
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max shown</span>
<NumberStepper
value={getWidgetSetting('collaborators', 'max_count', 5)}
min={1} max={10}
onChange={v => updateWidgetSetting('collaborators', 'max_count', v)}
/>
</div>
<div>
<span className="text-[10px] text-gray-500 block mb-1.5">Bar color</span>
<ColorPicker
value={getWidgetSetting('collaborators', 'bar_color', '#a78bfa')}
onChange={v => updateWidgetSetting('collaborators', 'bar_color', v)}
/>
</div>
</div>
)}
{w.id === 'focus' && (
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max categories</span>
<NumberStepper
value={getWidgetSetting('focus', 'max_categories', 6)}
min={1} max={10}
onChange={v => updateWidgetSetting('focus', 'max_categories', v)}
/>
</div>
)}
{w.id === 'languages' && (
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max languages</span>
<NumberStepper
value={getWidgetSetting('languages', 'max_languages', 5)}
min={1} max={10}
onChange={v => updateWidgetSetting('languages', 'max_languages', v)}
/>
</div>
)}
{w.id === 'achievements' && (
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max shown</span>
<NumberStepper
value={getWidgetSetting('achievements', 'max_items', 5)}
min={1} max={10}
onChange={v => updateWidgetSetting('achievements', 'max_items', v)}
/>
</div>
)}
</div>
)}
</div>
)
})}
</div>
</div>
{/* Achievements editor */}
{settings.widgets.includes('achievements') && (
<div className="mb-5">
<div className="text-[10px] uppercase tracking-wider text-gray-400 font-medium mb-3">Achievements</div>
<div className="flex flex-col gap-2">
{settings.achievements.map((ach, idx) => (
<div key={idx} className="p-2.5 rounded-lg border border-gray-100 bg-gray-50/50">
<div className="flex items-center gap-1.5 mb-2">
{ICONS.map(ic => (
<button
key={ic.id}
onClick={() => updateAchievement(idx, 'icon', ic.id)}
className={`w-7 h-7 rounded-md text-sm flex items-center justify-center transition-colors ${
ach.icon === ic.id
? 'bg-gray-800 ring-1 ring-gray-800'
: 'bg-white border border-gray-200 hover:border-gray-300'
}`}
title={ic.id}
>
{ic.label}
</button>
))}
<div className="flex-1" />
<button
onClick={() => removeAchievement(idx)}
className="text-gray-300 hover:text-red-400 transition-colors text-xs px-1"
title="Remove"
>
✕
</button>
</div>
<input
type="text"
value={ach.title}
onChange={e => updateAchievement(idx, 'title', e.target.value)}
placeholder="Title (e.g. Hackathon Winner)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5"
/>
<input
type="text"
value={ach.subtitle}
onChange={e => updateAchievement(idx, 'subtitle', e.target.value)}
placeholder="Subtitle (e.g. 1st Place · AI Track)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5"
/>
<input
type="text"
value={ach.event_date}
onChange={e => updateAchievement(idx, 'event_date', e.target.value)}
placeholder="Date (e.g. 2025-01)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300"
/>
</div>
))}
<button
onClick={addAchievement}
className="w-full py-2 rounded-lg border border-dashed border-gray-200 text-xs text-gray-400 hover:text-gray-600 hover:border-gray-300 transition-colors"
>
+ Add achievement
</button>
</div>
</div>
)}
{/* Spacer */}
<div className="flex-1 min-h-4" />
{/* Generate button */}
<button
onClick={onGenerate}
className="w-full py-3 rounded-xl bg-gray-800 text-white text-sm font-medium hover:bg-gray-700 transition-colors"
className="w-full py-3 rounded-xl bg-gray-800 text-white text-sm font-medium hover:bg-gray-700 transition-colors mb-6"
>
Generate →
</button>
{fetchError && (
<div className="flex items-center gap-1.5 text-[10px] text-red-500 mb-6">
<div className="w-1.5 h-1.5 rounded-full bg-red-400" />
{fetchError}
</div>
)}
{!canEdit && me.login && (
<div className="banner">
{`Signed in as ${me.login}. Changes here produce a shareable link with query params. Only ${username} can save them permanently.`}
</div>
)}
{/* Theme */}
<div className="mb-5">
<div className="text-[10px] uppercase tracking-wider text-gray-400 font-medium mb-3">Theme</div>
<div className="flex gap-2 flex-wrap">
{THEMES.map(t => (
<button
key={t.id}
onClick={() => updateSetting('theme', t.id)}
title={t.label}
aria-label={t.label}
className={`w-9 h-9 rounded-lg overflow-hidden transition-all ${
settings.theme === t.id
? 'ring-2 ring-gray-900 ring-offset-2'
: t.light
? 'ring-1 ring-gray-200 hover:ring-gray-300'
: 'hover:ring-1 hover:ring-gray-400 hover:ring-offset-1'
}`}
>
<svg viewBox="0 0 36 36" width="36" height="36">
<rect width="36" height="36" rx="8" fill={t.bg} />
<rect x="6" y="8" width="24" height="20" rx="4" fill={t.card} stroke={t.border} strokeWidth="1" />
<circle cx="11" cy="18" r="3" fill={t.accent} />
<rect x="16" y="16.25" width="10" height="1.75" rx="0.875" fill={t.accent} opacity="0.75" />
<rect x="16" y="19.75" width="7" height="1.5" rx="0.75" fill={t.accent} opacity="0.35" />
</svg>
</button>
))}
</div>
<div className="text-[10px] text-gray-400 mt-1.5">
{THEMES.find(t => t.id === settings.theme)?.label}
</div>
</div>
{/* Widgets with inline advanced settings */}
<div className="mb-5">
<div className="text-[10px] uppercase tracking-wider text-gray-400 font-medium mb-3">Widgets</div>
<div className="flex flex-col gap-0.5">
{orderedIds.map((id, idx) => {
const w = ALL_WIDGETS.find(x => x.id === id)
if (!w) return null
const enabled = settings.widgets.includes(w.id)
const hasAdvanced = ['grade', 'impact', 'streaks', 'collaborators', 'focus', 'languages', 'achievements'].includes(w.id)
const isExpanded = expandedWidget === w.id && enabled
// "name" is pinned — no drag affordance, no drop lines.
// The dropIndex comparisons below still use the real idx
// so downstream rows behave normally when name is skipped.
const isPinned = w.id === 'name'
const isDragging = !isPinned && dragIndex === idx
const showDropLineAbove = !isPinned && idx > 0 && dropIndex === idx && dragIndex !== null && dragIndex !== idx
// Drop-line below the last row when dragging past the end.
const showDropLineBelow = !isPinned && idx === orderedIds.length - 1 && dropIndex === orderedIds.length && dragIndex !== null
return (
<div key={w.id}>
{showDropLineAbove && <div className="h-0.5 bg-gray-900 rounded-full mx-2 mb-0.5" />}
<div
className={`flex items-center transition-opacity ${isDragging ? 'opacity-40' : ''}`}
draggable={!isPinned}
onDragStart={isPinned ? undefined : e => {
setDragIndex(idx)
e.dataTransfer.effectAllowed = 'move'
// Firefox needs some payload to start a drag.
e.dataTransfer.setData('text/plain', String(idx))
}}
onDragOver={isPinned ? undefined : e => {
if (dragIndex === null) return
e.preventDefault()
e.dataTransfer.dropEffect = 'move'
// Midpoint decides whether the drop slot is this row
// or the next — gives a predictable feel between rows.
const rect = e.currentTarget.getBoundingClientRect()
const after = e.clientY - rect.top > rect.height / 2
const target = after ? idx + 1 : idx
// Landing on the drag source's own slot is a no-op;
// hide the indicator so it doesn't look interactive.
if (target === dragIndex || target === dragIndex + 1) {
setDropIndex(null)
} else {
setDropIndex(target)
}
}}
onDrop={isPinned ? undefined : e => {
e.preventDefault()
if (dragIndex === null || dropIndex === null) {
setDragIndex(null); setDropIndex(null); return
}
// Removing the source before inserting shifts later
// indices down by one — adjust the target accordingly.
const to = dropIndex > dragIndex ? dropIndex - 1 : dropIndex
moveWidget(dragIndex, to)
setDragIndex(null); setDropIndex(null)
}}
onDragEnd={isPinned ? undefined : () => { setDragIndex(null); setDropIndex(null) }}
>
{isPinned ? (
<span
className="px-1 text-gray-300 select-none"
title="Pinned — can't be reordered"
aria-hidden
>
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<rect x="3" y="11" width="18" height="10" rx="2"/>
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
</svg>
</span>
) : (
<span
className="px-1 text-gray-300 hover:text-gray-500 cursor-grab active:cursor-grabbing select-none"
title="Drag to reorder"
aria-hidden
>
⋮⋮
</span>
)}
<button
onClick={() => toggleWidget(w.id)}
className={`flex-1 flex items-center gap-2.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors text-left ${
enabled
? 'text-gray-800 bg-gray-50'
: 'text-gray-400 hover:text-gray-500 hover:bg-gray-50/50'
}`}
>
<div className={`w-3.5 h-3.5 rounded flex-shrink-0 transition-colors ${enabled ? 'bg-gray-900' : 'bg-gray-200'}`} />
{w.label}
</button>
{hasAdvanced && enabled && (
<button
onClick={() => toggleAdvanced(w.id)}
className="p-1.5 text-gray-400 hover:text-gray-600 transition-colors"
title="Advanced settings"
>
<ChevronIcon open={isExpanded} />
</button>
)}
</div>
{showDropLineBelow && <div className="h-0.5 bg-gray-900 rounded-full mx-2 mt-0.5" />}
{isExpanded && (
<div className="ml-6 mt-1 mb-2 p-2.5 rounded-lg bg-gray-50/80 border border-gray-100 flex flex-col gap-2.5">
{w.id === 'grade' && (
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max tags</span>
<NumberStepper
value={getWidgetSetting('grade', 'max_tags', 6)}
min={1} max={20}
onChange={v => updateWidgetSetting('grade', 'max_tags', v)}
/>
</div>
)}
{w.id === 'impact' && (
<div>
<span className="text-[10px] text-gray-500 block mb-1.5">Line color</span>
<ColorPicker
value={getWidgetSetting('impact', 'line_color', '#58a6ff')}
onChange={v => updateWidgetSetting('impact', 'line_color', v)}
/>
</div>
)}
{w.id === 'streaks' && (
<div>
<span className="text-[10px] text-gray-500 block mb-1.5">Streak color</span>
<ColorPicker
value={getWidgetSetting('streaks', 'color', '#58a6ff')}
onChange={v => updateWidgetSetting('streaks', 'color', v)}
/>
</div>
)}
{w.id === 'collaborators' && (
<div className="flex flex-col gap-2.5">
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max shown</span>
<NumberStepper
value={getWidgetSetting('collaborators', 'max_count', 5)}
min={1} max={10}
onChange={v => updateWidgetSetting('collaborators', 'max_count', v)}
/>
</div>
<div>
<span className="text-[10px] text-gray-500 block mb-1.5">Bar color</span>
<ColorPicker
value={getWidgetSetting('collaborators', 'bar_color', '#a78bfa')}
onChange={v => updateWidgetSetting('collaborators', 'bar_color', v)}
/>
</div>
</div>
)}
{w.id === 'focus' && (
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max categories</span>
<NumberStepper
value={getWidgetSetting('focus', 'max_categories', 6)}
min={1} max={10}
onChange={v => updateWidgetSetting('focus', 'max_categories', v)}
/>
</div>
)}
{w.id === 'languages' && (
<div className="flex flex-col gap-2.5">
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max languages</span>
<NumberStepper
value={getWidgetSetting('languages', 'max_languages', 5)}
min={1} max={10}
onChange={v => updateWidgetSetting('languages', 'max_languages', v)}
/>
</div>
<HiddenLanguagesPicker
detected={widgetData?.languages ?? []}
hidden={settings.hiddenLanguages}
onChange={next => updateSetting('hiddenLanguages', next)}
/>
</div>
)}
{w.id === 'achievements' && (
<div className="flex flex-col gap-2.5">
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max shown</span>
<NumberStepper
value={getWidgetSetting('achievements', 'max_items', 5)}
min={1} max={10}
onChange={v => updateWidgetSetting('achievements', 'max_items', v)}
/>
</div>
<div className="flex flex-col gap-2">
{settings.achievements.map((ach, aidx) => {
const achIsDragging = achDragIndex === aidx
const achShowLineAbove = aidx > 0 && achDropIndex === aidx && achDragIndex !== null && achDragIndex !== aidx
const achShowLineBelow = aidx === settings.achievements.length - 1 && achDropIndex === settings.achievements.length && achDragIndex !== null
return (
<div key={aidx}>
{achShowLineAbove && <div className="h-0.5 bg-gray-900 rounded-full mx-2 mb-0.5" />}
<div
className={`p-2.5 rounded-lg border border-gray-100 bg-white transition-opacity ${achIsDragging ? 'opacity-40' : ''}`}
draggable
onDragStart={e => {
setAchDragIndex(aidx)
e.dataTransfer.effectAllowed = 'move'
e.dataTransfer.setData('text/plain', String(aidx))
}}
onDragOver={e => {
if (achDragIndex === null) return
e.preventDefault()
e.dataTransfer.dropEffect = 'move'
const rect = e.currentTarget.getBoundingClientRect()
const after = e.clientY - rect.top > rect.height / 2
const target = after ? aidx + 1 : aidx
if (target === achDragIndex || target === achDragIndex + 1) {
setAchDropIndex(null)
} else {
setAchDropIndex(target)
}
}}
onDrop={e => {
e.preventDefault()
if (achDragIndex === null || achDropIndex === null) {
setAchDragIndex(null); setAchDropIndex(null); return
}
const to = achDropIndex > achDragIndex ? achDropIndex - 1 : achDropIndex
moveAchievement(achDragIndex, to)
setAchDragIndex(null); setAchDropIndex(null)
}}
onDragEnd={() => { setAchDragIndex(null); setAchDropIndex(null) }}
>
<div className="flex items-center gap-1.5 mb-2">
<span
className="text-gray-300 hover:text-gray-500 cursor-grab active:cursor-grabbing select-none pr-1"
title="Drag to reorder"
aria-hidden
>
<svg width="10" height="12" viewBox="0 0 10 16" fill="currentColor" aria-hidden="true">
<circle cx="2.5" cy="3" r="1.2"/><circle cx="7.5" cy="3" r="1.2"/>
<circle cx="2.5" cy="8" r="1.2"/><circle cx="7.5" cy="8" r="1.2"/>
<circle cx="2.5" cy="13" r="1.2"/><circle cx="7.5" cy="13" r="1.2"/>
</svg>
</span>
{ICONS.map(ic => {
const selected = ach.icon === ic.id
return (
<button
key={ic.id}
onClick={() => updateAchievement(aidx, 'icon', ic.id)}
className={`w-8 h-8 rounded-md flex items-center justify-center transition-colors ${
selected
? 'bg-gray-800 text-white border border-gray-800'
: 'bg-white text-gray-500 border border-gray-200 hover:text-gray-800 hover:border-gray-300'
}`}
title={ic.id}
aria-pressed={selected}
>
{ic.svg}
</button>
)
})}
<div className="flex-1" />
<button
onClick={() => removeAchievement(aidx)}
className="text-gray-300 hover:text-red-400 transition-colors text-xs px-1"
title="Remove"
>
✕
</button>
</div>
<input
type="text"
value={ach.title}
onChange={e => updateAchievement(aidx, 'title', e.target.value)}
placeholder="Title (e.g. Hackathon Winner)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5"
/>
<input
type="text"
value={ach.subtitle}
onChange={e => updateAchievement(aidx, 'subtitle', e.target.value)}
placeholder="Subtitle (e.g. 1st Place · AI Track)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5"
/>
<input
type="text"
value={ach.event_date}
onChange={e => updateAchievement(aidx, 'event_date', e.target.value)}
placeholder="Date (e.g. 2025-01)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300"
/>
</div>
{achShowLineBelow && <div className="h-0.5 bg-gray-900 rounded-full mx-2 mt-0.5" />}
</div>
)
})}
<button
onClick={addAchievement}
className="w-full py-2 rounded-lg border border-dashed border-gray-200 text-xs text-gray-400 hover:text-gray-600 hover:border-gray-300 transition-colors"
>
+ Add achievement
</button>
</div>
</div>
)}
</div>
)}
</div>
)
})}
</div>
</div>
</div>
{/* Right preview area */}
<div className="flex-1 flex items-start justify-center p-8 overflow-auto">
<div className="relative">
{isDemoData && svgContent && (
<div className="flex items-center gap-1.5 mx-auto mb-3 w-fit rounded-full border border-amber-200 bg-amber-50 px-2.5 py-1 text-[10px] text-amber-700">
<div className="w-1.5 h-1.5 rounded-full bg-amber-400" />
Sample data until your stats finish building
</div>
)}
{svgContent ? (
<div dangerouslySetInnerHTML={{ __html: svgContent }} />
) : (
<div className="w-[420px] h-[600px] rounded-2xl border border-gray-200 bg-white flex items-center justify-center">
{dataLoading ? (
{!fetchDone ? (
<div className="w-5 h-5 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin-slow" />
) : (
<p className="text-xs text-gray-400">No data available</p>
+1
View File
@@ -5,3 +5,4 @@ requests==2.32.3
pytest==8.3.3
responses==0.25.3
gunicorn==23.0.0
authlib>=1.3,<2
+213
View File
@@ -0,0 +1,213 @@
"""Generate static SVG examples for the README.
Renders each widget plus the composite card in every built-in theme using
plausible hand-crafted model instances. Outputs go to
`screenshots/examples/`. Run from the repo root:
cd generator && python -m scripts.gen_readme_examples
No GitHub calls, no fetcher, no database.
"""
from __future__ import annotations
import os
import pathlib
import sys
from datetime import date, timedelta
# Ensure `src` package is importable when running `python -m scripts.*`.
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.models import (
AchievementData,
CollaboratorData,
FocusCategory,
GradeData,
ImpactWeek,
LanguageData,
StreakData,
TagData,
)
from src.widgets import (
render_achievements_widget,
render_collaborators_widget,
render_focus_widget,
render_grade_widget,
render_impact_widget,
render_languages_widget,
render_streaks_widget,
)
from src.widgets.composite import compose_widget
OUT = pathlib.Path(__file__).resolve().parents[2] / "assets" / "examples"
OUT.mkdir(parents=True, exist_ok=True)
def grade_sample() -> GradeData:
return GradeData(
grade="A",
score=88.4,
stats={"commits": 1423, "prs": 87, "stars": 342, "repos": 28, "followers": 156},
tags=[
TagData(tag="Backend", source="earned", confidence=0.95),
TagData(tag="ML", source="earned", confidence=0.82),
TagData(tag="Systems", source="earned", confidence=0.70),
TagData(tag="Cloud", source="earned", confidence=0.60),
TagData(tag="founder", source="earned", label="Founder #42"),
TagData(tag="Open Source", source="chosen"),
],
)
def impact_sample() -> list[ImpactWeek]:
today = date.today()
start = today - timedelta(days=7 * 26)
pattern = [3, 5, 8, 6, 11, 14, 9, 12, 18, 22, 17, 19, 25, 21, 28, 32, 26, 24,
30, 35, 29, 33, 41, 38, 34, 37]
weeks: list[ImpactWeek] = []
for i, count in enumerate(pattern):
weeks.append(ImpactWeek(week_start=(start + timedelta(days=7 * i)).isoformat(),
commits=count))
return weeks
def streaks_sample() -> StreakData:
today = date.today()
return StreakData(
current=23,
max=61,
current_start=(today - timedelta(days=22)).isoformat(),
last_active_date=today.isoformat(),
max_start=(today - timedelta(days=220)).isoformat(),
max_end=(today - timedelta(days=160)).isoformat(),
)
def collaborators_sample() -> list[CollaboratorData]:
return [
CollaboratorData(username="torvalds", shared_repos=4, shared_commits=142),
CollaboratorData(username="gaearon", shared_repos=3, shared_commits=98),
CollaboratorData(username="sindresorhus", shared_repos=2, shared_commits=64),
CollaboratorData(username="tj", shared_repos=2, shared_commits=47),
CollaboratorData(username="yyx990803", shared_repos=1, shared_commits=31),
]
def focus_sample() -> list[FocusCategory]:
return [
FocusCategory(category="Backend", percentage=38.0, commit_count=412),
FocusCategory(category="ML", percentage=24.0, commit_count=260),
FocusCategory(category="Frontend", percentage=18.0, commit_count=195),
FocusCategory(category="DevOps", percentage=12.0, commit_count=130),
FocusCategory(category="Cloud", percentage=8.0, commit_count=87),
]
def languages_sample() -> list[LanguageData]:
return [
LanguageData(language="Python", percentage=41.0, loc=180_432),
LanguageData(language="TypeScript", percentage=23.0, loc=102_310),
LanguageData(language="Go", percentage=15.0, loc=66_540),
LanguageData(language="Rust", percentage=11.0, loc=48_210),
LanguageData(language="Shell", percentage=6.0, loc=27_004),
LanguageData(language="Dockerfile", percentage=4.0, loc=18_120),
]
def achievements_sample() -> list[AchievementData]:
return [
AchievementData(title="Hackathon winner",
subtitle="Y Combinator AI Hackathon",
event_date="2025-11",
icon="hackathon"),
AchievementData(title="Speaker at PyCon",
subtitle="Async at scale",
event_date="2024-05",
icon="star"),
AchievementData(title="Open Source Award",
subtitle="GitHub Stars program",
event_date="2024-01",
icon="trophy"),
AchievementData(title="AWS Certified Solutions Architect",
subtitle="Professional",
event_date="2023-09",
icon="medal"),
]
def render_all(theme: str, widget_settings: dict | None = None) -> dict[str, str]:
ws = widget_settings or {}
widgets = {
"grade": render_grade_widget(grade_sample(), theme, settings=ws.get("grade")),
"impact": render_impact_widget(impact_sample(), theme, settings=ws.get("impact")),
"streaks": render_streaks_widget(streaks_sample(), theme, settings=ws.get("streaks")),
"collaborators": render_collaborators_widget(collaborators_sample(), theme, settings=ws.get("collaborators")),
"focus": render_focus_widget(focus_sample(), theme, settings=ws.get("focus")),
"languages": render_languages_widget(languages_sample(), theme, settings=ws.get("languages")),
"achievements": render_achievements_widget(achievements_sample(), theme, settings=ws.get("achievements")),
}
return widgets
def write(name: str, svg: str) -> None:
(OUT / name).write_text(svg)
print(f" wrote {name} ({len(svg)}B)")
def main() -> None:
print(f"generating into {OUT}")
# Individual widgets in the default theme.
default = render_all("dark")
for key, svg in default.items():
write(f"{key}.svg", svg)
# Composite card in every theme.
for theme in ("dark", "onyx", "nord", "light", "paper"):
widgets = render_all(theme)
svg = compose_widget(
widgets=widgets,
enabled=["grade", "impact", "streaks", "collaborators", "focus", "languages", "achievements"],
theme_name=theme,
username="demo",
show_name=False,
)
label = {"dark": "midnight", "light": "clean"}.get(theme, theme)
write(f"composite-{label}.svg", svg)
# Customization demos.
purple_impact = render_impact_widget(impact_sample(), "dark",
settings={"line_color": "#a78bfa"})
write("impact-purple.svg", purple_impact)
green_streaks = render_streaks_widget(streaks_sample(), "dark",
settings={"color": "#3fb950"})
write("streaks-green.svg", green_streaks)
compact_grade = render_grade_widget(grade_sample(), "dark",
settings={"max_tags": 3})
write("grade-compact.svg", compact_grade)
hidden_langs = render_languages_widget(
[l for l in languages_sample() if l.language not in {"Shell", "Dockerfile"}],
"dark",
)
write("languages-hide.svg", hidden_langs)
# Composite picking only a few widgets, onyx theme.
onyx_widgets = render_all("onyx")
svg = compose_widget(
widgets={k: onyx_widgets[k] for k in ("grade", "streaks", "languages")},
enabled=["grade", "streaks", "languages"],
theme_name="onyx",
username="demo",
show_name=False,
)
write("composite-custom.svg", svg)
print("done")
if __name__ == "__main__":
main()
+481
View File
@@ -0,0 +1,481 @@
"""Analytics: bounded in-memory queue, daemon flush thread, query helpers.
Three call sites write events:
* record_request — generator's own HTTP path (rarely used; edge handles most)
* record_render — worker / on-demand /generate
* ingest_batch — POST /internal/analytics/events from edge & fetcher
All writes go through a shared bounded deque so the hot path never blocks on
SQLite I/O. A daemon thread flushes the queue every _FLUSH_SECONDS into
analytics.db in a single transaction.
"""
import json
import logging
import math
import threading
import time
from collections import deque
from typing import Any
from . import config, db
log = logging.getLogger("generator.analytics")
_FLUSH_SECONDS = config.ANALYTICS_FLUSH_SECONDS
_QUEUE_MAX = config.ANALYTICS_QUEUE_MAX
_RETENTION_DAYS = config.ANALYTICS_RETENTION_DAYS
_QUEUE: deque = deque(maxlen=_QUEUE_MAX)
_QUEUE_LOCK = threading.Lock()
_FLUSH_THREAD: threading.Thread | None = None
_THREAD_LOCK = threading.Lock()
_events_dropped: int = 0
_drop_lock = threading.Lock()
_ALLOWED_KINDS = {"request", "render", "fetch"}
_ALLOWED_SERVICES = {"edge", "generator", "fetcher"}
def _reset_for_tests() -> None:
"""Clear the queue + dropped counter; rebuild deque so a monkeypatched
_QUEUE_MAX takes effect for the next test."""
global _FLUSH_THREAD, _events_dropped, _QUEUE
with _QUEUE_LOCK:
_QUEUE = deque(maxlen=_QUEUE_MAX)
with _drop_lock:
_events_dropped = 0
_FLUSH_THREAD = None
def _enqueue(event: dict) -> None:
global _events_dropped
with _QUEUE_LOCK:
if len(_QUEUE) >= _QUEUE.maxlen:
with _drop_lock:
_events_dropped += 1
return
_QUEUE.append(event)
def record_request(endpoint: str, username: str | None, widget: str | None,
status: int, latency_ms: int, cache_hit: int | None = None) -> None:
_enqueue({
"ts": int(time.time()),
"service": "generator",
"kind": "request",
"username": username,
"endpoint": endpoint,
"widget": widget,
"status": int(status),
"latency_ms": int(latency_ms),
"cache_hit": cache_hit,
})
def record_render(username: str, widget: str, latency_ms: int) -> None:
_enqueue({
"ts": int(time.time()),
"service": "generator",
"kind": "render",
"username": username,
"endpoint": None,
"widget": widget,
"status": None,
"latency_ms": int(latency_ms),
"cache_hit": None,
})
def _coerce_int_or_none(v: Any) -> int | None:
if isinstance(v, bool) or v is None:
return None
if isinstance(v, int):
return v
return None
def _validate(ev: Any) -> dict | None:
if not isinstance(ev, dict):
return None
try:
ts = int(ev.get("ts", 0))
if ts <= 0:
ts = int(time.time())
service = ev.get("service")
kind = ev.get("kind")
latency_ms = int(ev.get("latency_ms"))
except (TypeError, ValueError):
return None
if service not in _ALLOWED_SERVICES or kind not in _ALLOWED_KINDS:
return None
return {
"ts": ts,
"service": service,
"kind": kind,
"username": ev.get("username") if isinstance(ev.get("username"), str) else None,
"endpoint": ev.get("endpoint") if isinstance(ev.get("endpoint"), str) else None,
"widget": ev.get("widget") if isinstance(ev.get("widget"), str) else None,
"status": _coerce_int_or_none(ev.get("status")),
"latency_ms": max(0, latency_ms),
"cache_hit": _coerce_int_or_none(ev.get("cache_hit")),
}
def ingest_batch(events: list) -> int:
"""Validate + persist a batch in one transaction. Returns rows inserted."""
if not isinstance(events, list):
return 0
cleaned = []
for ev in events[:500]:
n = _validate(ev)
if n is not None:
cleaned.append(n)
if not cleaned:
return 0
with db.analytics_conn() as c:
c.executemany(
"""INSERT INTO events(ts, service, kind, username, endpoint, widget,
status, latency_ms, cache_hit)
VALUES (:ts, :service, :kind, :username, :endpoint, :widget,
:status, :latency_ms, :cache_hit)""",
cleaned,
)
c.commit()
return len(cleaned)
def _drain_queue() -> list[dict]:
with _QUEUE_LOCK:
out = list(_QUEUE)
_QUEUE.clear()
return out
def _flush_loop() -> None:
while True:
time.sleep(_FLUSH_SECONDS)
try:
batch = _drain_queue()
if batch:
ingest_batch(batch)
except Exception:
log.exception("analytics flush failed")
def start_flush_thread() -> None:
global _FLUSH_THREAD
with _THREAD_LOCK:
if _FLUSH_THREAD is not None and _FLUSH_THREAD.is_alive():
return
t = threading.Thread(target=_flush_loop, name="analytics-flush", daemon=True)
t.start()
_FLUSH_THREAD = t
def _percentile(sorted_vals: list[int], pct: float) -> int:
if not sorted_vals:
return 0
n = len(sorted_vals)
k = max(0, min(n - 1, math.ceil(pct / 100.0 * n) - 1))
return int(sorted_vals[k])
def query_summary() -> dict:
now = int(time.time())
week_ago = now - 7 * 86400
with db.analytics_conn() as c:
req_rows = c.execute(
"""SELECT username, latency_ms, ts FROM events
WHERE kind='request' AND ts >= ?""", (week_ago,)
).fetchall()
render_rows = c.execute(
"""SELECT username, latency_ms FROM events
WHERE kind='render' AND ts >= ?""", (week_ago,)
).fetchall()
requests_7d = len(req_rows)
renders_7d = len(render_rows)
latencies = sorted(r["latency_ms"] for r in req_rows)
active = {r["username"] for r in req_rows if r["username"]}
active.update(r["username"] for r in render_rows if r["username"])
avg_render_ms = (sum(r["latency_ms"] for r in render_rows) // renders_7d) if renders_7d else 0
by_day: dict[str, int] = {}
for r in req_rows:
day = time.strftime("%Y-%m-%d", time.gmtime(r["ts"]))
by_day[day] = by_day.get(day, 0) + 1
daily = []
for i in range(6, -1, -1):
day = time.strftime("%Y-%m-%d", time.gmtime(now - i * 86400))
daily.append({"day": day, "count": by_day.get(day, 0)})
return {
"requests_7d": requests_7d,
"active_users_7d": len(active),
"p50_ms": _percentile(latencies, 50),
"p95_ms": _percentile(latencies, 95),
"renders_7d": renders_7d,
"avg_render_ms": avg_render_ms,
"daily_requests": daily,
}
def query_users(q: str = "", sort: str = "requests", limit: int = 200) -> list[dict]:
now = int(time.time())
week_ago = now - 7 * 86400
with db.analytics_conn() as c:
c.execute("ATTACH DATABASE ? AS settings", (db.SETTINGS_DB_PATH,))
try:
# Count any event kind (request OR render) as activity so the
# table matches `active_users_7d` in query_summary — without
# this, render-only users (e.g. cron-driven worker refreshes
# before any edge traffic) appear in the count but not the
# table, which looks like a bug.
rows = c.execute(
"""SELECT e.username AS username,
SUM(CASE WHEN e.kind='request' THEN 1 ELSE 0 END) AS requests_7d,
MAX(e.ts) AS last_seen,
COALESCE(AVG(CASE WHEN e.kind='request'
THEN e.latency_ms END), 0) AS avg_latency_ms,
(SELECT u.github_avatar_url FROM settings.users u
WHERE u.username = e.username) AS github_avatar_url
FROM events e
WHERE e.kind IN ('request', 'render')
AND e.ts >= ? AND e.username IS NOT NULL
GROUP BY e.username""",
(week_ago,),
).fetchall()
top_eps_rows = c.execute(
"""SELECT username, endpoint, COUNT(*) AS n
FROM events
WHERE kind='request' AND ts >= ? AND username IS NOT NULL
GROUP BY username, endpoint""",
(week_ago,),
).fetchall()
finally:
c.execute("DETACH DATABASE settings")
top_by_user: dict[str, tuple[str, int]] = {}
for r in top_eps_rows:
cur = top_by_user.get(r["username"])
if cur is None or r["n"] > cur[1]:
top_by_user[r["username"]] = (r["endpoint"], r["n"])
out = []
needle = q.lower().strip()
for r in rows:
if needle and needle not in (r["username"] or "").lower():
continue
out.append({
"username": r["username"],
"requests_7d": r["requests_7d"],
"last_seen": r["last_seen"],
"avg_latency_ms": int(r["avg_latency_ms"] or 0),
"top_endpoint": top_by_user.get(r["username"], ("", 0))[0],
"github_avatar_url": r["github_avatar_url"],
})
key = {
"requests": lambda u: -u["requests_7d"],
"latency": lambda u: -u["avg_latency_ms"],
"last_seen": lambda u: -(u["last_seen"] or 0),
}.get(sort, lambda u: -u["requests_7d"])
out.sort(key=key)
return out[: max(1, min(int(limit), 500))]
def rollup_daily_stats() -> int:
"""Snapshot the events table into daily_stats so per-day numbers
survive the 14d event prune.
Aggregates every day that still has events in the events table,
UPSERTing one row per day with (request count, JSON list of unique
usernames). Days whose events have already been pruned are left
untouched — their previously-written daily_stats row is preserved.
Idempotent: re-running rebuilds the affected days from current
events. Pairs with prune_old, which aligns its cutoff to UTC
midnight so a day is either entirely retained or entirely pruned
(no half-pruned days that would corrupt the snapshot on next call).
Returns number of day rows written.
"""
with db.analytics_conn() as c:
rows = c.execute(
"""SELECT ts, kind, username FROM events
WHERE kind IN ('request', 'render')"""
).fetchall()
if not rows:
return 0
buckets: dict[str, dict] = {}
for r in rows:
day = time.strftime("%Y-%m-%d", time.gmtime(r["ts"]))
b = buckets.setdefault(day, {"requests": 0, "users": set()})
if r["kind"] == "request":
b["requests"] += 1
if r["username"]:
b["users"].add(r["username"])
now_iso = db._now()
payload = [
{"day": day,
"requests": b["requests"],
"users_json": json.dumps(sorted(b["users"]), separators=(",", ":")),
"updated_at": now_iso}
for day, b in buckets.items()
]
with db.analytics_conn() as c:
c.executemany(
"""INSERT INTO daily_stats(day, requests, users_json, updated_at)
VALUES (:day, :requests, :users_json, :updated_at)
ON CONFLICT(day) DO UPDATE SET
requests = excluded.requests,
users_json = excluded.users_json,
updated_at = excluded.updated_at""",
payload,
)
c.commit()
return len(payload)
def query_growth(daily_n: int = 30, weekly_n: int = 12) -> dict:
"""Per-day and per-week unique users + request counts.
Reads from daily_stats (the long-lived snapshot table) so historical
numbers survive past the 14d event retention. Calls rollup_daily_stats
first so today's partial-day numbers are fresh even between cron ticks.
"Users" mirrors the active_users definition in query_summary — any
kind in (request, render) counts as active. Weekly uniques are the
set-union across the week's days (not a sum), so a user active on
multiple days in the same week counts once.
Returns:
{"daily": [{"day": "YYYY-MM-DD", "users": int, "requests": int}, ...], # oldest -> newest
"weekly": [{"week": "GGGG-Www", "users": int, "requests": int}, ...]}
"""
rollup_daily_stats()
now = int(time.time())
with db.analytics_conn() as c:
stat_rows = c.execute(
"SELECT day, requests, users_json FROM daily_stats"
).fetchall()
by_day: dict[str, dict] = {}
for r in stat_rows:
try:
users = set(json.loads(r["users_json"]))
except (ValueError, TypeError):
users = set()
by_day[r["day"]] = {"requests": int(r["requests"] or 0), "users": users}
daily = []
for i in range(daily_n - 1, -1, -1):
d = time.strftime("%Y-%m-%d", time.gmtime(now - i * 86400))
b = by_day.get(d)
daily.append({
"day": d,
"requests": b["requests"] if b else 0,
"users": len(b["users"]) if b else 0,
})
# Weekly: union across each ISO week's days. Stepping by 7 days from
# `now` lands on a different calendar day each loop but always inside
# the target ISO week, so %G-W%V correctly picks out one week per step.
week_buckets: dict[str, dict] = {}
for day, b in by_day.items():
try:
gm = time.strptime(day, "%Y-%m-%d")
except ValueError:
continue
wk = time.strftime("%G-W%V", gm)
wb = week_buckets.setdefault(wk, {"requests": 0, "users": set()})
wb["requests"] += b["requests"]
wb["users"].update(b["users"])
weekly = []
for i in range(weekly_n - 1, -1, -1):
wk = time.strftime("%G-W%V", time.gmtime(now - i * 7 * 86400))
wb = week_buckets.get(wk)
weekly.append({
"week": wk,
"requests": wb["requests"] if wb else 0,
"users": len(wb["users"]) if wb else 0,
})
return {"daily": daily, "weekly": weekly}
def query_latency() -> list[dict]:
now = int(time.time())
week_ago = now - 7 * 86400
with db.analytics_conn() as c:
top = c.execute(
"""SELECT endpoint, COUNT(*) AS n FROM events
WHERE kind='request' AND ts >= ? AND endpoint IS NOT NULL
GROUP BY endpoint ORDER BY n DESC LIMIT 12""",
(week_ago,),
).fetchall()
out = []
for r in top:
vals = [
row["latency_ms"]
for row in c.execute(
"""SELECT latency_ms FROM events
WHERE kind='request' AND ts >= ? AND endpoint = ?""",
(week_ago, r["endpoint"]),
).fetchall()
]
vals.sort()
out.append({
"endpoint": r["endpoint"],
"count": r["n"],
"p50": _percentile(vals, 50),
"p95": _percentile(vals, 95),
"p99": _percentile(vals, 99),
})
return out
def query_health() -> dict:
now = int(time.time())
week_ago = now - 7 * 86400
with db.analytics_conn() as c:
edge = c.execute(
"""SELECT SUM(CASE WHEN cache_hit=1 THEN 1 ELSE 0 END) AS hits,
COUNT(*) AS total
FROM events WHERE service='edge' AND kind='request' AND ts >= ?""",
(week_ago,),
).fetchone()
fetcher = c.execute(
"""SELECT SUM(CASE WHEN status >= 400 THEN 1 ELSE 0 END) AS errs,
COUNT(*) AS total
FROM events WHERE service='fetcher' AND kind='fetch' AND ts >= ?""",
(week_ago,),
).fetchone()
oldest = c.execute(
"SELECT MIN(ts) AS oldest FROM events"
).fetchone()
edge_total = (edge["total"] or 0)
fetch_total = (fetcher["total"] or 0)
return {
"edge_cache_hit_rate": (edge["hits"] / edge_total) if edge_total else 0.0,
"fetcher_error_rate": (fetcher["errs"] / fetch_total) if fetch_total else 0.0,
"events_dropped_24h": _events_dropped,
"oldest_event_ts": oldest["oldest"] if oldest and oldest["oldest"] else None,
}
def prune_old(retention_days: int = _RETENTION_DAYS) -> int:
# Align cutoff to UTC midnight: a day's events are either fully kept
# or fully pruned. Without this, the rollup running after a prune
# could observe a half-emptied day and overwrite daily_stats with
# partial counts.
import calendar
target_day = time.gmtime(int(time.time()) - retention_days * 86400)
cutoff = calendar.timegm((target_day.tm_year, target_day.tm_mon, target_day.tm_mday,
0, 0, 0, 0, 0, 0))
deleted = 0
with db.analytics_conn() as c:
while True:
cur = c.execute(
"DELETE FROM events WHERE id IN ("
" SELECT id FROM events WHERE ts < ? LIMIT 5000)",
(cutoff,),
)
c.commit()
n = cur.rowcount or 0
deleted += n
if n < 5000:
break
return deleted
+1131 -42
View File
File diff suppressed because it is too large Load Diff
+120
View File
@@ -0,0 +1,120 @@
"""GitHub OAuth integration for the generator service.
Owns:
- OAuth client registration (authlib)
- `current_login()` — lowercase GitHub login from session, or None
- `require_github_owner` — decorator: 401 if no session, 403 if mismatch
- `require_same_origin` — decorator: 403 if Origin/Referer not in allowlist
"""
from functools import wraps
from urllib.parse import urlparse
from authlib.integrations.flask_client import OAuth
from flask import jsonify, request, session
from . import config
_oauth: OAuth | None = None
def init_oauth(app) -> OAuth:
"""Register the `github` provider. Safe to call once at app startup."""
global _oauth
oauth = OAuth(app)
oauth.register(
name="github",
client_id=config.GITHUB_OAUTH_CLIENT_ID,
client_secret=config.GITHUB_OAUTH_CLIENT_SECRET,
access_token_url="https://github.com/login/oauth/access_token",
authorize_url="https://github.com/login/oauth/authorize",
api_base_url="https://api.github.com/",
client_kwargs={"scope": "read:user"},
)
_oauth = oauth
return oauth
def github_client():
if _oauth is None:
raise RuntimeError("OAuth not initialized — call init_oauth(app) first.")
return _oauth.github
def current_login() -> str | None:
v = session.get("gh_login")
return v.lower() if isinstance(v, str) else None
def _origin_ok() -> bool:
origin = request.headers.get("Origin") or request.headers.get("Referer") or ""
if not origin:
return False
try:
o = urlparse(origin)
normalized = f"{o.scheme}://{o.netloc}"
except Exception:
return False
return normalized in config.ALLOWED_ORIGINS
def require_github_owner(fn):
"""401 if no session; 403 if session login != url username (case-insensitive)."""
@wraps(fn)
def wrapper(username: str, *args, **kwargs):
me = current_login()
if me is None:
return jsonify({"error": "login_required"}), 401
if me != (username or "").lower():
return jsonify({"error": "forbidden"}), 403
return fn(username, *args, **kwargs)
return wrapper
def require_same_origin(fn):
"""Defense in depth beyond SameSite=Lax. Rejects cross-site mutate attempts."""
@wraps(fn)
def wrapper(*args, **kwargs):
if not _origin_ok():
return jsonify({"error": "bad_origin"}), 403
return fn(*args, **kwargs)
return wrapper
import base64
import hmac as _hmac
from functools import wraps as _wraps
from flask import jsonify as _jsonify, request as _request
from . import config as _config
def require_basic_auth(fn):
"""HTTP Basic Auth gate for the /dev dashboard. Returns 503 if either
credential env var is unset so a missing-secret deploy fails closed.
Constant-time comparison on the decoded user+pass concatenation keeps
the timing channel narrow without leaking length."""
@_wraps(fn)
def wrapper(*args, **kwargs):
u = _config.DEV_DASHBOARD_USER
p = _config.DEV_DASHBOARD_PASSWORD
if not u or not p:
return _jsonify({"error": "dashboard_disabled"}), 503
hdr = _request.headers.get("Authorization", "")
if not hdr.startswith("Basic "):
return _unauth()
try:
decoded = base64.b64decode(hdr[6:].encode("ascii"), validate=True).decode("utf-8")
except Exception:
return _unauth()
expected = f"{u}:{p}"
if not _hmac.compare_digest(decoded, expected):
return _unauth()
return fn(*args, **kwargs)
return wrapper
def _unauth():
resp = _jsonify({"error": "unauthorized"})
resp.status_code = 401
resp.headers["WWW-Authenticate"] = 'Basic realm="dev"'
return resp
+70 -4
View File
@@ -42,15 +42,24 @@ COMMIT_PER_REPO = int(os.getenv("COMMIT_PER_REPO", "30"))
API_TIMEOUT = int(os.getenv("API_TIMEOUT", "5"))
"""Timeout in seconds for API requests."""
# Deploy / invalidation.
# When set (populated from IMAGE_TAG in deploy/compose.yml), every generator
# container compares this to the persisted 'widgets_built_version' on boot;
# if it changed, all enrolled users get a fresh build job queued so widgets
# re-render against the new code. Empty string disables the check — useful
# in local dev where a restart shouldn't invalidate the cache.
BUILD_VERSION = os.getenv("BUILD_VERSION", "").strip()
# Data source
DATA_SOURCE_TYPE = os.getenv("DATA_SOURCE", "direct")
"""Data source type: 'direct' for immediate API calls, 'queued' for batch processing."""
# Widget settings
WIDGET_ORDER = ["grade", "impact", "collaborators", "focus", "languages", "achievements"]
"""Default order of widgets. Customize by reordering this list."""
WIDGET_ORDER = ["name", "grade", "impact", "streaks", "collaborators", "focus", "languages", "achievements"]
"""Default order of widgets. "name" is the avatar+username header and is
always pinned first in the UI — it can be toggled off but not reordered."""
ENABLED_WIDGETS = ["grade", "impact", "collaborators", "focus", "languages", "achievements"]
ENABLED_WIDGETS = ["name", "grade", "impact", "streaks", "collaborators", "focus", "languages", "achievements"]
"""Which widgets to display. Remove any you don't want to show."""
# Language filtering
@@ -109,9 +118,66 @@ TAG_TOPIC_MAP = {
PORT = int(os.getenv("GENERATOR_PORT", "5002"))
SETTINGS_DB_PATH = os.getenv("GENERATOR_SETTINGS_DB_PATH", "./data/settings.db")
WIDGETS_DB_PATH = os.getenv("GENERATOR_WIDGETS_DB_PATH", "./data/widgets.db")
ANALYTICS_DB_PATH = os.getenv("GENERATOR_ANALYTICS_DB_PATH", "./data/analytics.db")
ANALYTICS_RETENTION_DAYS = int(os.getenv("ANALYTICS_RETENTION_DAYS", "14"))
ANALYTICS_FLUSH_SECONDS = int(os.getenv("ANALYTICS_FLUSH_SECONDS", "5"))
ANALYTICS_QUEUE_MAX = int(os.getenv("ANALYTICS_QUEUE_MAX", "2000"))
DEV_DASHBOARD_USER = os.getenv("DEV_DASHBOARD_USER", "")
DEV_DASHBOARD_PASSWORD = os.getenv("DEV_DASHBOARD_PASSWORD", "")
FETCHER_URL = os.getenv("FETCHER_URL", "http://localhost:5001")
FETCHER_INTERNAL_TOKEN = os.getenv("FETCHER_INTERNAL_TOKEN", "")
REDIS_URL = os.getenv("REDIS_URL", "")
ENROLLMENT_DAILY_CAP = int(os.getenv("ENROLLMENT_DAILY_CAP", "50"))
ENROLLMENT_DAILY_CAP = int(os.getenv("ENROLLMENT_DAILY_CAP", "500"))
# Burst guard. A new user costs ~37 GitHub REST calls (p90 ~104) against a
# 5000/hr budget, and a launch spike arrives in one hour rather than spread
# over a day, so the hourly ceiling is what actually protects the PAT.
ENROLLMENT_HOURLY_CAP = int(os.getenv("ENROLLMENT_HOURLY_CAP", "60"))
WIDGET_LRU_PER_USER = int(os.getenv("WIDGET_LRU_PER_USER", "10"))
POLL_INTERVAL_MINUTES = int(os.getenv("GENERATOR_POLL_INTERVAL_MINUTES", "15"))
# --- Mini-PC capacity controls ---
# The generator runs on a single mini PC, so the constraining resources are
# CPU (SVG render) and the GitHub PAT (fetch). Everything here is tunable via
# env so the operator can loosen limits after measuring real load.
# Per-IP sliding-window rate limits: (max_hits, window_seconds). These are
# anti-abuse ceilings, not capacity controls — the mini PC is actually
# protected by the global semaphore + worker pool + queue cap below, so
# per-IP numbers stay lenient. Tighten via env only if you see a specific
# abuser.
RATE_LIMIT_READ_MAX = int(os.getenv("RATE_LIMIT_READ_MAX", "3000"))
RATE_LIMIT_READ_WINDOW = int(os.getenv("RATE_LIMIT_READ_WINDOW", "60"))
RATE_LIMIT_MUTATE_MAX = int(os.getenv("RATE_LIMIT_MUTATE_MAX", "120"))
RATE_LIMIT_MUTATE_WINDOW = int(os.getenv("RATE_LIMIT_MUTATE_WINDOW", "60"))
RATE_LIMIT_ENROLL_MAX = int(os.getenv("RATE_LIMIT_ENROLL_MAX", "60"))
RATE_LIMIT_ENROLL_WINDOW = int(os.getenv("RATE_LIMIT_ENROLL_WINDOW", "300"))
# Global across-all-IPs caps. These are the mini-PC backstop: even a
# thousand-IP botnet can't induce more than this much work at once.
GENERATE_CONCURRENCY = int(os.getenv("GENERATE_CONCURRENCY", "2"))
PREFETCH_MAX_WORKERS = int(os.getenv("PREFETCH_MAX_WORKERS", "2"))
PENDING_JOB_QUEUE_CAP = int(os.getenv("PENDING_JOB_QUEUE_CAP", "200"))
# How long a /generate caller will wait for the semaphore before giving up.
GENERATE_SEMAPHORE_WAIT_S = float(os.getenv("GENERATE_SEMAPHORE_WAIT_S", "15"))
# --- GitHub OAuth ---
# Env names avoid the reserved GITHUB_ prefix so they can be stored as GitHub
# Actions secrets (which reject GITHUB_* names).
GITHUB_OAUTH_CLIENT_ID = os.getenv("GH_OAUTH_CLIENT_ID", "")
GITHUB_OAUTH_CLIENT_SECRET = os.getenv("GH_OAUTH_CLIENT_SECRET", "")
GITHUB_OAUTH_REDIRECT_URI = os.getenv("GH_OAUTH_REDIRECT_URI", "")
# Flask session secret. Generate once: python -c "import secrets; print(secrets.token_hex(32))"
SECRET_KEY = os.getenv("GENERATOR_SECRET_KEY", "")
# Dev-only override; defaults to True so production HTTPS cookies work.
SESSION_COOKIE_SECURE = os.getenv("SESSION_COOKIE_SECURE", "true").lower() != "false"
# CSRF defense-in-depth: Origin/Referer allowlist for state-changing routes.
ALLOWED_ORIGINS = tuple(
o.strip() for o in os.getenv("ALLOWED_ORIGINS", "https://gh-stats.com").split(",") if o.strip()
)
# Per-login rate limit on mutate routes, layered on top of per-IP limits.
RATE_LIMIT_MUTATE_PER_LOGIN_MAX = int(os.getenv("RATE_LIMIT_MUTATE_PER_LOGIN_MAX", "120"))
RATE_LIMIT_MUTATE_PER_LOGIN_WINDOW = int(os.getenv("RATE_LIMIT_MUTATE_PER_LOGIN_WINDOW", "60"))
+34 -2
View File
@@ -3,18 +3,37 @@
Run as its own container: CMD python -m src.cron
"""
import logging
import os
import time
from . import config, db, fetcher_client
from . import analytics, config, db, fetcher_client
log = logging.getLogger("generator.cron")
# Pacing between users in a single tick. On a mini PC with N enrolled
# users, a tight loop would fire N fetcher calls back-to-back, each of
# which can become a GitHub call — trivially enough to spike CPU and
# burn PAT budget. Default 0.25s keeps 1000 users inside a ~4-minute
# tick while leaving headroom in the 15-minute window.
_TICK_INTER_USER_SLEEP_S = float(os.getenv("GENERATOR_CRON_INTER_USER_SLEEP_S", "0.25"))
# Queue-depth backstop. If the build worker is already behind, don't
# enqueue more: let it drain. Keeps SQLite from swelling when a burst of
# GitHub changes arrives at once.
_TICK_QUEUE_CAP = int(os.getenv("GENERATOR_CRON_QUEUE_CAP", str(config.PENDING_JOB_QUEUE_CAP)))
def tick() -> dict:
enqueued = 0
failed = 0
skipped_queue_full = 0
for username in db.list_enrolled():
try:
if db.pending_job_count() >= _TICK_QUEUE_CAP:
skipped_queue_full += 1
# Don't hammer the fetcher either when the queue is full.
time.sleep(_TICK_INTER_USER_SLEEP_S)
continue
info = db.get_settings(username)
current = info.get("last_fetcher_payload_hash")
r = fetcher_client.get_data(username)
@@ -26,7 +45,20 @@ def tick() -> dict:
except Exception as e:
log.warning("poll failed for %s: %s", username, e)
failed += 1
return {"enqueued": enqueued, "failed": failed}
if _TICK_INTER_USER_SLEEP_S > 0:
time.sleep(_TICK_INTER_USER_SLEEP_S)
try:
# Snapshot first, prune second: rollup persists the per-day
# aggregates that the growth chart reads, then prune drops the
# raw events whose stats we just captured.
analytics.rollup_daily_stats()
except Exception:
log.exception("analytics rollup failed")
try:
analytics.prune_old()
except Exception:
log.exception("analytics prune failed")
return {"enqueued": enqueued, "failed": failed, "skipped_queue_full": skipped_queue_full}
def main():
+351 -18
View File
@@ -15,6 +15,7 @@ from . import config
SETTINGS_DB_PATH = config.SETTINGS_DB_PATH
WIDGETS_DB_PATH = config.WIDGETS_DB_PATH
ANALYTICS_DB_PATH = config.ANALYTICS_DB_PATH
_SETTINGS_SCHEMA = """
CREATE TABLE IF NOT EXISTS users (
@@ -24,7 +25,10 @@ CREATE TABLE IF NOT EXISTS users (
enrolled_at TEXT NOT NULL,
last_fetcher_payload_hash TEXT,
manual_refresh_used INTEGER DEFAULT 0,
last_requested_at TEXT NOT NULL
last_requested_at TEXT NOT NULL,
edit_token_hash TEXT,
github_id INTEGER,
github_avatar_url TEXT
);
CREATE TABLE IF NOT EXISTS enrollments_daily (
day TEXT PRIMARY KEY,
@@ -41,6 +45,20 @@ CREATE TABLE IF NOT EXISTS jobs (
updated_at TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_jobs_pending ON jobs(status, created_at);
CREATE TABLE IF NOT EXISTS meta (
key TEXT PRIMARY KEY,
value TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS user_streaks (
username TEXT PRIMARY KEY,
current_streak INTEGER NOT NULL DEFAULT 0,
current_start TEXT NOT NULL DEFAULT '',
last_active_date TEXT NOT NULL DEFAULT '',
max_streak INTEGER NOT NULL DEFAULT 0,
max_start TEXT NOT NULL DEFAULT '',
max_end TEXT NOT NULL DEFAULT '',
updated_at TEXT NOT NULL
);
"""
_WIDGETS_SCHEMA = """
@@ -57,7 +75,45 @@ CREATE TABLE IF NOT EXISTS current_widget (
settings_hash TEXT NOT NULL,
updated_at TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS widget_data (
username TEXT NOT NULL,
settings_hash TEXT NOT NULL,
data_json TEXT NOT NULL,
built_at TEXT NOT NULL,
PRIMARY KEY (username, settings_hash)
);
CREATE INDEX IF NOT EXISTS idx_widgets_username ON widgets(username);
CREATE INDEX IF NOT EXISTS idx_widget_data_username ON widget_data(username);
"""
_ANALYTICS_SCHEMA = """
CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
ts INTEGER NOT NULL,
service TEXT NOT NULL,
kind TEXT NOT NULL,
username TEXT,
endpoint TEXT,
widget TEXT,
status INTEGER,
latency_ms INTEGER NOT NULL,
cache_hit INTEGER
);
CREATE INDEX IF NOT EXISTS idx_events_ts ON events(ts);
CREATE INDEX IF NOT EXISTS idx_events_user_ts ON events(username, ts);
CREATE INDEX IF NOT EXISTS idx_events_endpoint_ts ON events(endpoint, ts);
-- Per-day aggregates that outlive the events table. Events are pruned at
-- ANALYTICS_RETENTION_DAYS (14d default), but the dev dashboard's growth
-- chart needs per-day/per-week numbers going back further. analytics.py's
-- rollup writes one row per day with the request count and the set of
-- unique usernames (as JSON, so weekly uniques can be computed by union).
CREATE TABLE IF NOT EXISTS daily_stats (
day TEXT PRIMARY KEY,
requests INTEGER NOT NULL,
users_json TEXT NOT NULL,
updated_at TEXT NOT NULL
);
"""
@@ -98,13 +154,37 @@ def _widgets_conn():
conn.close()
@contextmanager
def analytics_conn():
conn = _open(ANALYTICS_DB_PATH)
try:
yield conn
finally:
conn.close()
def init_analytics_db() -> None:
with analytics_conn() as c:
c.executescript(_ANALYTICS_SCHEMA)
c.commit()
def init_dbs() -> None:
with _settings_conn() as c:
c.executescript(_SETTINGS_SCHEMA)
# Additive migration for DBs created before the auth rollout.
cols = {r["name"] for r in c.execute("PRAGMA table_info(users)").fetchall()}
if "edit_token_hash" not in cols:
c.execute("ALTER TABLE users ADD COLUMN edit_token_hash TEXT")
if "github_id" not in cols:
c.execute("ALTER TABLE users ADD COLUMN github_id INTEGER")
if "github_avatar_url" not in cols:
c.execute("ALTER TABLE users ADD COLUMN github_avatar_url TEXT")
c.commit()
with _widgets_conn() as c:
c.executescript(_WIDGETS_SCHEMA)
c.commit()
init_analytics_db()
def settings_hash(settings: dict) -> str:
@@ -114,29 +194,55 @@ def settings_hash(settings: dict) -> str:
# ---- settings / enrollment ----
def enroll(username: str, defaults: dict) -> int:
"""Insert a settings row + increment daily counter + enqueue build. Returns job_id."""
def enroll(username: str, defaults: dict,
github_id: int | None = None,
github_avatar_url: str | None = None,
enqueue_build: bool = True) -> dict:
"""Insert a settings row if missing, bump the daily counter, optionally
enqueue a build.
`enqueue_build=False` is used by the OAuth callback so the build job is
only added to the queue *after* the fetcher has actually fetched the
user (via the /internal/data-ready callback). Without this, the worker
would pop a build job for a user the fetcher hasn't seen yet and either
block on a synchronous GitHub fetch or retry-fail until cron.
Idempotent: calling again for an existing user refreshes
github_avatar_url. Returns {"job_id": int|None}.
"""
sh = settings_hash(defaults)
now = _now()
with _settings_conn() as c:
c.execute(
"""INSERT INTO users(username, settings_json, settings_hash, enrolled_at, last_requested_at)
VALUES (?, ?, ?, ?, ?)
cur_ins = c.execute(
"""INSERT INTO users(username, settings_json, settings_hash, enrolled_at,
last_requested_at, github_id, github_avatar_url)
VALUES (?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(username) DO NOTHING""",
(username, json.dumps(defaults), sh, now, now),
)
c.execute(
"""INSERT INTO enrollments_daily(day, count) VALUES (?, 1)
ON CONFLICT(day) DO UPDATE SET count = count + 1""",
(_today(),),
)
cur = c.execute(
"""INSERT INTO jobs(kind, username, status, created_at, updated_at)
VALUES ('build', ?, 'pending', ?, ?)""",
(username, now, now),
(username, json.dumps(defaults), sh, now, now, github_id, github_avatar_url),
)
inserted = cur_ins.rowcount == 1
if not inserted and (github_id is not None or github_avatar_url is not None):
c.execute(
"UPDATE users SET github_id=COALESCE(?, github_id), "
"github_avatar_url=COALESCE(?, github_avatar_url) WHERE username=?",
(github_id, github_avatar_url, username),
)
if inserted:
c.execute(
"""INSERT INTO enrollments_daily(day, count) VALUES (?, 1)
ON CONFLICT(day) DO UPDATE SET count = count + 1""",
(_today(),),
)
job_id: int | None = None
if enqueue_build:
cur = c.execute(
"""INSERT INTO jobs(kind, username, status, created_at, updated_at)
VALUES ('build', ?, 'pending', ?, ?)""",
(username, now, now),
)
job_id = cur.lastrowid
c.commit()
return cur.lastrowid
return {"job_id": job_id}
def enrollments_today() -> int:
@@ -145,6 +251,38 @@ def enrollments_today() -> int:
return row["count"] if row else 0
def enrollments_last_hour() -> int:
"""Enrollments in the trailing 60 minutes. Reads `users.enrolled_at`
directly (ISO-8601 Zulu, so lexicographic order is chronological) rather
than keeping a second counter table."""
cutoff = (datetime.utcnow() - timedelta(hours=1)).isoformat(timespec="seconds") + "Z"
with _settings_conn() as c:
row = c.execute(
"SELECT COUNT(*) AS n FROM users WHERE enrolled_at >= ?", (cutoff,)
).fetchone()
return row["n"] if row else 0
def enrollment_rank(username: str) -> Optional[int]:
"""1-based position in overall enrollment order by enrolled_at. Used by
tag rules that reward early users (e.g. the 'founder' tag).
Usernames are persisted lowercased by `enroll()`, but callers may pass the
GitHub-returned login (which preserves the original casing). Normalize
here so a mixed-case lookup doesn't silently miss the row.
"""
if not username:
return None
key = username.lower()
with _settings_conn() as c:
row = c.execute("SELECT enrolled_at FROM users WHERE username=?", (key,)).fetchone()
if row is None:
return None
return c.execute(
"SELECT COUNT(*) FROM users WHERE enrolled_at <= ?", (row["enrolled_at"],)
).fetchone()[0]
def get_settings(username: str) -> Optional[dict]:
with _settings_conn() as c:
row = c.execute("SELECT * FROM users WHERE username=?", (username,)).fetchone()
@@ -205,6 +343,65 @@ def set_last_fetcher_hash(username: str, h: str) -> None:
c.commit()
def get_user_streak(username: str) -> Optional[dict]:
"""Return the persisted streak row for a user, or None if never written."""
with _settings_conn() as c:
row = c.execute(
"SELECT * FROM user_streaks WHERE username=?", (username,)
).fetchone()
if row is None:
return None
return {
"current_streak": row["current_streak"],
"current_start": row["current_start"],
"last_active_date": row["last_active_date"],
"max_streak": row["max_streak"],
"max_start": row["max_start"],
"max_end": row["max_end"],
"updated_at": row["updated_at"],
}
def put_user_streak(username: str, streak: dict) -> None:
"""UPSERT the streak row for a user. Caller supplies the merged values."""
now = _now()
with _settings_conn() as c:
c.execute(
"""INSERT INTO user_streaks(
username, current_streak, current_start, last_active_date,
max_streak, max_start, max_end, updated_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(username) DO UPDATE SET
current_streak=excluded.current_streak,
current_start=excluded.current_start,
last_active_date=excluded.last_active_date,
max_streak=excluded.max_streak,
max_start=excluded.max_start,
max_end=excluded.max_end,
updated_at=excluded.updated_at""",
(
username,
int(streak.get("current_streak", 0)),
streak.get("current_start", ""),
streak.get("last_active_date", ""),
int(streak.get("max_streak", 0)),
streak.get("max_start", ""),
streak.get("max_end", ""),
now,
),
)
c.commit()
def set_github_profile(username: str, github_id: int, github_avatar_url: str) -> None:
with _settings_conn() as c:
c.execute(
"UPDATE users SET github_id=?, github_avatar_url=? WHERE username=?",
(github_id, github_avatar_url, username),
)
c.commit()
# ---- jobs ----
def enqueue_build(username: str) -> int:
@@ -219,6 +416,80 @@ def enqueue_build(username: str) -> int:
return cur.lastrowid
def has_open_build(username: str) -> bool:
"""True if the user has a pending or running build job. Used by callers
that want enqueue idempotency without taking on the SQL themselves."""
with _settings_conn() as c:
row = c.execute(
"""SELECT 1 FROM jobs
WHERE username=? AND kind='build' AND status IN ('pending', 'running')
LIMIT 1""",
(username,),
).fetchone()
return row is not None
def enqueue_build_all() -> int:
"""Enqueue a 'build' job for every enrolled user that doesn't already
have one pending. Returns the number inserted. Idempotent — safe to
call from whichever generator container boots first after a deploy.
"""
now = _now()
with _settings_conn() as c:
c.execute("BEGIN IMMEDIATE")
cur = c.execute(
"""INSERT INTO jobs(kind, username, status, created_at, updated_at)
SELECT 'build', u.username, 'pending', ?, ?
FROM users u
WHERE NOT EXISTS (
SELECT 1 FROM jobs j
WHERE j.username = u.username
AND j.kind = 'build'
AND j.status IN ('pending', 'running')
)""",
(now, now),
)
inserted = cur.rowcount or 0
c.commit()
return inserted
def claim_build_version(version: str) -> bool:
"""Atomically stamp the 'widgets_built_version' meta row. Returns True
iff this call changed it (the caller should then enqueue rebuilds);
False if it already matched — i.e. another container on this host
already claimed this deploy.
Uses BEGIN IMMEDIATE so racing generator/worker/cron containers
serialize and only one observes the change.
"""
if not version:
return False
with _settings_conn() as c:
c.execute("BEGIN IMMEDIATE")
row = c.execute(
"SELECT value FROM meta WHERE key='widgets_built_version'"
).fetchone()
if row and row["value"] == version:
c.commit()
return False
c.execute(
"""INSERT INTO meta(key, value) VALUES('widgets_built_version', ?)
ON CONFLICT(key) DO UPDATE SET value=excluded.value""",
(version,),
)
c.commit()
return True
def pending_job_count() -> int:
"""Depth of the build queue. Used as backpressure so bursts of
enroll/PATCH don't blow up SQLite when the worker is behind."""
with _settings_conn() as c:
row = c.execute("SELECT COUNT(*) AS n FROM jobs WHERE status='pending'").fetchone()
return int(row["n"]) if row else 0
def claim_next_job() -> Optional[dict]:
now = _now()
with _settings_conn() as c:
@@ -282,6 +553,33 @@ def put_widgets(username: str, hash_: str, widgets: dict[str, str]) -> None:
c.commit()
def get_current_widget_hash(username: str) -> Optional[str]:
"""The settings_hash that current_widget points at (or None if nothing
has been prefetched/rendered yet). Distinct from users.settings_hash,
which is the hash of the *currently configured* settings."""
with _widgets_conn() as c:
row = c.execute(
"SELECT settings_hash FROM current_widget WHERE username=?",
(username,),
).fetchone()
return row["settings_hash"] if row else None
def point_current_widget(username: str, hash_: str) -> None:
"""Flip the current_widget pointer to a settings_hash. Used by the
prefetch worker (which writes only widget_data, not SVG rows) and by
the render path (which writes both, but calls this too for clarity)."""
now = _now()
with _widgets_conn() as c:
c.execute(
"""INSERT INTO current_widget(username, settings_hash, updated_at)
VALUES (?, ?, ?)
ON CONFLICT(username) DO UPDATE SET settings_hash=excluded.settings_hash, updated_at=excluded.updated_at""",
(username, hash_, now),
)
c.commit()
def get_current_widget(username: str, widget_name: str) -> Optional[str]:
with _widgets_conn() as c:
row = c.execute(
@@ -293,6 +591,37 @@ def get_current_widget(username: str, widget_name: str) -> Optional[str]:
return row["svg"] if row else None
def put_widget_data(username: str, hash_: str, data: dict) -> None:
"""Store computed widget data for client-side rendering. Keyed to the
same (username, settings_hash) that widgets are — the worker writes both
in the same build pass."""
now = _now()
with _widgets_conn() as c:
c.execute(
"""INSERT INTO widget_data(username, settings_hash, data_json, built_at)
VALUES (?, ?, ?, ?)
ON CONFLICT(username, settings_hash) DO UPDATE SET
data_json = excluded.data_json, built_at = excluded.built_at""",
(username, hash_, json.dumps(data, separators=(",", ":")), now),
)
c.commit()
def get_current_widget_data(username: str) -> Optional[dict]:
"""Returns {'data': <dict>, 'settings_hash': str} for the pointer in
current_widget, or None if nothing is built yet."""
with _widgets_conn() as c:
row = c.execute(
"""SELECT wd.data_json, wd.settings_hash FROM widget_data wd
JOIN current_widget cw ON cw.username=wd.username AND cw.settings_hash=wd.settings_hash
WHERE wd.username=?""",
(username,),
).fetchone()
if row is None:
return None
return {"data": json.loads(row["data_json"]), "settings_hash": row["settings_hash"]}
def lru_trim(username: str, keep: int) -> int:
"""Keep only the N newest settings_hashes per user; delete older rows."""
with _widgets_conn() as c:
@@ -309,5 +638,9 @@ def lru_trim(username: str, keep: int) -> int:
f"DELETE FROM widgets WHERE username=? AND settings_hash IN ({placeholders})",
(username, *to_delete),
)
c.execute(
f"DELETE FROM widget_data WHERE username=? AND settings_hash IN ({placeholders})",
(username, *to_delete),
)
c.commit()
return cur.rowcount
+23 -2
View File
@@ -8,14 +8,35 @@ def _headers() -> dict:
return {"X-Internal-Token": config.FETCHER_INTERNAL_TOKEN}
# Most calls hit the cache and return in <100ms; the only slow path is when
# the fetcher's /data endpoint falls back to a synchronous GitHub fetch
# (used by the /?username=X shortcut). 60s leaves headroom for the
# parallelized worst case (~15-25s) without poisoning the worker's job
# retry chain on a transient blip.
_TIMEOUT_S = 60
def get_data(username: str) -> dict:
r = requests.get(f"{config.FETCHER_URL}/data/{username}", headers=_headers(), timeout=30)
r = requests.get(f"{config.FETCHER_URL}/data/{username}", headers=_headers(),
timeout=_TIMEOUT_S)
r.raise_for_status()
return r.json()
def force_fetch(username: str) -> dict:
r = requests.post(f"{config.FETCHER_URL}/fetch", headers=_headers(),
json={"username": username}, timeout=30)
json={"username": username}, timeout=_TIMEOUT_S)
r.raise_for_status()
return r.json()
def start_fetch_async(username: str) -> dict:
"""Tell the fetcher to fetch this user in the background. Returns 202
after the fetcher has accepted the job — does NOT wait for the GitHub
fetch to complete. The fetcher will POST back to /internal/data-ready
on this service when the data is persisted, which is what enqueues the
build job. See fetcher.api.fetch_async for the other half."""
r = requests.post(f"{config.FETCHER_URL}/fetch-async", headers=_headers(),
json={"username": username}, timeout=10)
r.raise_for_status()
return r.json()
+2
View File
@@ -8,6 +8,7 @@ from .types import (
FocusCategory,
LanguageData,
AchievementData,
StreakData,
)
__all__ = [
@@ -18,4 +19,5 @@ __all__ = [
"FocusCategory",
"LanguageData",
"AchievementData",
"StreakData",
]
+11
View File
@@ -17,6 +17,7 @@ class TagData:
tag: str
source: str = "earned" # "earned" | "chosen"
confidence: float = 1.0
label: str | None = None # optional display override (e.g. "Founder #42")
@dataclass
@@ -55,3 +56,13 @@ class AchievementData:
subtitle: str = ""
event_date: str = ""
icon: str = "trophy" # trophy, medal, star, hackathon
@dataclass
class StreakData:
current: int = 0 # consecutive days ending today (or yesterday under grace)
max: int = 0 # all-time longest observed streak
current_start: str = "" # ISO date the current streak started, "" if current == 0
last_active_date: str = "" # most recent date with contributions in the window
max_start: str = "" # ISO date the max streak started (best-effort)
max_end: str = "" # ISO date the max streak ended (best-effort)
+4
View File
@@ -4,6 +4,7 @@ Uses the same card wrapper + theme system as real widgets so they look consisten
"""
from .themes.themes import THEMES
from .utils.svg_helpers import card_wrapper, escape
from .widgets.attribution import attribution_text
_MESSAGES = {
"building": ("Building @{u}'s widget\u2026", "This usually takes under a minute."),
@@ -24,5 +25,8 @@ def render(variant: str, username: str, theme: str = "dark") -> str:
f'font-size="18" font-weight="600" fill="{palette["text"]}">{escape(title)}</text>'
f'<text x="24" y="82" font-family="-apple-system,Segoe UI,sans-serif" '
f'font-size="13" fill="{palette["text_secondary"]}">{escape(subtitle)}</text>'
# The card is 120 tall and the subtitle ends around y=85, so the
# footer fits inside the existing bottom padding.
+ attribution_text(palette, 200, 112, 0)
)
return card_wrapper(inner, width=400, height=120, theme=palette)
+261 -25
View File
@@ -1,6 +1,6 @@
"""GitHub data processing and widget generation."""
from datetime import datetime, timedelta
from datetime import datetime, timedelta, date
from collections import defaultdict
from .models import (
@@ -10,6 +10,8 @@ from .models import (
CollaboratorData,
FocusCategory,
LanguageData,
AchievementData,
StreakData,
)
from .widgets import (
render_grade_widget,
@@ -17,6 +19,8 @@ from .widgets import (
render_collaborators_widget,
render_focus_widget,
render_languages_widget,
render_achievements_widget,
render_streaks_widget,
)
@@ -61,15 +65,40 @@ def compute_grade(github_data: dict, custom_tags: list[str] = None) -> GradeData
if prs == 0:
prs = sum(1 for ev in events if ev.get("type") == "PullRequestEvent")
scores = {
"repos": min(repo_count / 30 * 100, 100),
"stars": min(stars / 200 * 100, 100),
"forks": min(forks / 50 * 100, 100),
"followers": min(followers / 100 * 100, 100),
"activity": min(len(events) / 80 * 100, 100),
}
# Last-year consistency: count distinct ISO weeks with at least one
# commit on the GitHub contribution calendar (which always covers the
# trailing year). 40 active weeks out of ~52 tops this factor out, so
# someone who works in bursts isn't penalised, but sporadic once-a-
# quarter activity scores low.
daily = github_data.get("commits", [])
active_weeks: set = set()
if isinstance(daily, list):
for day in daily:
if not isinstance(day, dict):
continue
if day.get("count", 0) <= 0:
continue
date_str = day.get("date")
if not isinstance(date_str, str):
continue
try:
iso = date.fromisoformat(date_str).isocalendar()
active_weeks.add((iso[0], iso[1]))
except ValueError:
continue
total = sum(scores.values()) / len(scores)
# Weights sum to 1.0
per_factor = {
"commits": (min(commits / 3000 * 100, 100), 0.33),
"consistency": (min(len(active_weeks) / 40 * 100, 100), 0.22),
"repos": (min(repo_count / 40 * 100, 100), 0.15),
"stars": (min(stars / 200 * 100, 100), 0.11),
"forks": (min(forks / 20 * 100, 100), 0.08),
"activity": (min(len(events) / 80 * 100, 100), 0.08),
"followers": (min(followers / 100 * 100, 100), 0.03),
}
scores = {k: v for k, (v, _w) in per_factor.items()}
total = sum(v * w for v, w in per_factor.values())
# Grade scale
if total >= 97:
@@ -96,18 +125,11 @@ def compute_grade(github_data: dict, custom_tags: list[str] = None) -> GradeData
grade = "B-"
elif total >= 42:
grade = "C+"
elif total >= 35:
grade = "C"
elif total >= 28:
grade = "C-"
elif total >= 20:
grade = "D+"
elif total >= 12:
grade = "D"
elif total >= 5:
grade = "D-"
else:
grade = "F"
# C is the floor. Anything that would previously have slid into C-,
# D+, D, D-, or F is clamped up to C — the widget is meant to be an
# encouraging profile snapshot, not a failure grade.
grade = "C"
stats = {
"commits": commits,
@@ -189,6 +211,7 @@ def _compute_tags(github_data: dict, max_tags: int = None, custom_tags: list[str
# Apply threshold rules
awarded_tags = []
tag_label_overrides: dict[str, str] = {}
# Fullstack: >25% frontend AND >25% backend
if category_percentages.get("Frontend", 0) > 0.25 and category_percentages.get("Backend", 0) > 0.25:
@@ -235,9 +258,22 @@ def _compute_tags(github_data: dict, max_tags: int = None, custom_tags: list[str
for tag in custom_tags:
awarded_tags.append((tag, 1.0))
# Auto-awarded tags (username-specific + rule-based; see src/tag_rules.py).
from . import tag_rules
username = (github_data.get("user") or {}).get("login", "")
for auto_tag, label in tag_rules.evaluate(username, github_data):
awarded_tags.append((auto_tag, 1.0))
if label:
tag_label_overrides[auto_tag] = label
# Sort by confidence and limit to max_tags
for tag, conf in sorted(awarded_tags, key=lambda x: -x[1])[:max_tags]:
tags.append(TagData(tag=tag, source="earned" if conf < 1.0 else "custom", confidence=round(conf, 2)))
tags.append(TagData(
tag=tag,
source="earned" if conf < 1.0 else "custom",
confidence=round(conf, 2),
label=tag_label_overrides.get(tag),
))
return tags
@@ -409,8 +445,13 @@ def compute_focus(github_data: dict, hidden_languages: list[str] = None) -> list
focus_counts = defaultdict(float)
# Use top 30 most recently pushed repos
sorted_repos = sorted(repos, key=lambda r: r.get("pushed_at", ""), reverse=True)
# Use top 30 most recently pushed repos. `r.get("pushed_at", "")` is
# NOT enough — when GitHub returns the field as JSON null (archived /
# never-pushed repos, common in torvalds-sized accounts), .get returns
# None and the sort blows up with "'<' not supported between instances
# of 'str' and 'NoneType'". `or ""` coerces null-valued keys to the
# same empty-string fallback as missing keys.
sorted_repos = sorted(repos, key=lambda r: r.get("pushed_at") or "", reverse=True)
active_repos = sorted_repos[:30]
# Count languages in active repos (excluding hidden languages)
@@ -461,6 +502,11 @@ def compute_languages(github_data: dict, hidden_languages: list[str] = None) ->
"""
Compute language distribution from repos.
Prefers per-repo byte breakdowns (`repo["language_bytes"]`) when present —
that matches GitHub's own "Most Used Languages" widget. Falls back to a
primary-language repo-count tally for payloads fetched before the
enrichment step landed.
Args:
github_data: GitHub profile data
hidden_languages: Optional list of languages to exclude (e.g., ["HTML", "CSS"])
@@ -469,13 +515,71 @@ def compute_languages(github_data: dict, hidden_languages: list[str] = None) ->
if hidden_languages is None:
hidden_languages = HIDDEN_LANGUAGES
hidden_set = {h for h in hidden_languages}
repos = github_data["repos"]
lang_counts = defaultdict(int)
login = (github_data.get("user") or {}).get("login") or ""
login_lc = login.lower()
def _is_authored(r: dict) -> bool:
# Repos the user mostly didn't write shouldn't dominate their
# language mix. "Authored" = not a fork AND owned by the user
# (or by an org where we can't easily tell, so stay conservative
# and require personal ownership). This drops the big-fork /
# random-org-contribution case that was skewing the widget.
if r.get("fork"):
return False
owner_login = ((r.get("owner") or {}).get("login") or "").lower()
return bool(owner_login) and owner_login == login_lc
def _byte_tally(predicate) -> dict[str, int]:
totals: dict[str, int] = defaultdict(int)
for r in repos:
if not predicate(r):
continue
lb = r.get("language_bytes") or {}
if not isinstance(lb, dict):
continue
for lang, n in lb.items():
if lang and lang not in hidden_set:
totals[lang] += int(n or 0)
return totals
# Preferred: bytes across authored repos only.
byte_totals = _byte_tally(_is_authored)
# Fallback ladder so the widget is never empty: if the user has no
# authored repos with byte data (rare — new accounts, or everything
# is a fork), expand to all non-fork repos, and finally to everything.
if not byte_totals:
byte_totals = _byte_tally(lambda r: not r.get("fork"))
if not byte_totals:
byte_totals = _byte_tally(lambda r: True)
if byte_totals:
total = sum(byte_totals.values()) or 1
return [
LanguageData(
language=lang,
percentage=round(size / total * 100, 1),
loc=size,
)
for lang, size in sorted(byte_totals.items(), key=lambda x: -x[1])
]
# Legacy fallback: repo-count by primary language, same ownership filter.
lang_counts: dict[str, int] = defaultdict(int)
for r in repos:
if not _is_authored(r):
continue
lang = r.get("language")
if lang and lang not in hidden_languages:
if lang and lang not in hidden_set:
lang_counts[lang] += 1
if not lang_counts:
for r in repos:
lang = r.get("language")
if lang and lang not in hidden_set:
lang_counts[lang] += 1
total = sum(lang_counts.values()) or 1
return [
@@ -488,6 +592,115 @@ def compute_languages(github_data: dict, hidden_languages: list[str] = None) ->
]
def compute_streaks(github_data: dict, stored: dict | None) -> StreakData:
"""
Compute the user's current and longest contribution streaks.
Current streak: starts at today if today has contributions; else at
yesterday if yesterday has contributions (1-day grace for end-of-UTC).
Walks backward while consecutive days are all active.
Max streak: scans the contribution window for the longest consecutive run,
then merges with `stored["max_streak"]`. The greater value wins; when the
stored value wins, its start/end dates are preserved.
Args:
github_data: Raw fetcher payload; reads "commits" as a list of
{"date": "YYYY-MM-DD", "count": N}. Zero-count entries are ignored.
stored: Optional dict from db.get_user_streak(username). None on first
observation.
"""
entries = github_data.get("commits") or []
active = set()
for e in entries:
if not isinstance(e, dict):
continue
d = e.get("date")
n = e.get("count") or 0
if d and n > 0:
active.add(d)
stored = stored or {}
prior_max = int(stored.get("max_streak", 0) or 0)
prior_max_start = stored.get("max_start", "") or ""
prior_max_end = stored.get("max_end", "") or ""
stored_last = stored.get("last_active_date", "") or ""
if not active:
return StreakData(
current=0,
max=prior_max,
current_start="",
last_active_date=stored_last,
max_start=prior_max_start,
max_end=prior_max_end,
)
today = datetime.utcnow().date()
yesterday = today - timedelta(days=1)
if today.isoformat() in active:
cursor = today
elif yesterday.isoformat() in active:
cursor = yesterday
else:
cursor = None
current = 0
current_start = ""
if cursor is not None:
start = cursor
while start.isoformat() in active:
current += 1
start -= timedelta(days=1)
current_start = (start + timedelta(days=1)).isoformat()
sorted_dates = sorted(active)
from datetime import date as _date
max_len = 0
max_start_iso = ""
max_end_iso = ""
run_start = sorted_dates[0]
run_len = 1
prev = _date.fromisoformat(run_start)
for ds in sorted_dates[1:]:
cur = _date.fromisoformat(ds)
if (cur - prev).days == 1:
run_len += 1
else:
if run_len > max_len:
max_len = run_len
max_start_iso = run_start
max_end_iso = prev.isoformat()
run_start = ds
run_len = 1
prev = cur
if run_len > max_len:
max_len = run_len
max_start_iso = run_start
max_end_iso = prev.isoformat()
if max_len > prior_max:
merged_max = max_len
merged_start = max_start_iso
merged_end = max_end_iso
else:
merged_max = prior_max
merged_start = prior_max_start
merged_end = prior_max_end
last_active = sorted_dates[-1]
return StreakData(
current=current,
max=merged_max,
current_start=current_start,
last_active_date=last_active,
max_start=merged_start,
max_end=merged_end,
)
def generate_widgets_from_github(
github_data: dict,
theme: str = "dark",
@@ -495,6 +708,8 @@ def generate_widgets_from_github(
hidden_languages: list[str] = None,
enabled: list[str] = None,
widget_settings: dict[str, dict] | None = None,
achievements: list[dict] | None = None,
stored_streak: dict | None = None,
) -> dict[str, str]:
"""
Takes raw GitHub API data and returns rendered SVG strings
@@ -509,6 +724,8 @@ def generate_widgets_from_github(
Defaults to ENABLED_WIDGETS from config.
widget_settings: Optional per-widget settings dict, keyed by widget name.
Each value is a dict of settings for that widget's renderer.
stored_streak: Optional dict from db.get_user_streak(username); carries
the all-time longest streak forward across refreshes.
"""
from .config import ENABLED_WIDGETS
@@ -539,4 +756,23 @@ def generate_widgets_from_github(
languages = compute_languages(github_data, hidden_languages=hidden_languages)
widgets["languages"] = render_languages_widget(languages, theme, settings=ws.get("languages"))
if "streaks" in enabled_set:
streak = compute_streaks(github_data, stored_streak)
widgets["streaks"] = render_streaks_widget(streak, theme, settings=ws.get("streaks"))
if "achievements" in enabled_set:
# User-authored content — no GitHub data involved.
raw = [a for a in (achievements or []) if (a.get("title") or "").strip()]
items = [
AchievementData(
title=a.get("title", ""),
subtitle=a.get("subtitle", ""),
event_date=a.get("event_date", ""),
icon=a.get("icon", "trophy"),
)
for a in raw
]
if items:
widgets["achievements"] = render_achievements_widget(items, theme, settings=ws.get("achievements"))
return widgets
+108
View File
@@ -0,0 +1,108 @@
"""Auto-awarded profile tags.
This is the single place to add new custom tags. Three pieces plug together:
TAG_DEFS — display metadata (color, label) for each tag ID.
USER_TAGS — hardcoded tags by username. Great for VIP/creator badges.
TAG_RULES — predicate-driven awards based on account signals.
To add a new tag:
1. Add its color + label to TAG_DEFS below.
2. Award it either by listing the username in USER_TAGS, or by appending
a (tag_id, predicate) pair to TAG_RULES.
Predicates receive (username, github_data) and return one of:
False / None — not awarded
True — awarded with the default TAG_DEFS label
str — awarded with this string as a custom label (e.g. "Founder #42")
Any exception inside a predicate is swallowed — a broken rule can't break the
whole tag pipeline.
"""
from typing import Callable, Union
# ---- Display metadata -------------------------------------------------------
TAG_DEFS: dict[str, dict] = {
"creator": {"color": "#f472b6", "label": "Creator"},
"open-source": {"color": "#3fb950", "label": "Open Source"},
"founder": {"color": "#facc15", "label": "Founder"},
"hackathon-winner": {"color": "#fb923c", "label": "Hackathon Winner"},
"early-adopter": {"color": "#a78bfa", "label": "Early Adopter"},
}
# ---- Username → tags --------------------------------------------------------
# Usernames are compared case-insensitively.
USER_TAGS: dict[str, list[str]] = {
"shaymanor": ["creator"],
}
# ---- Rule predicates --------------------------------------------------------
PredicateResult = Union[bool, str, None]
def _open_source_maintainer(username: str, data: dict) -> PredicateResult:
"""At least 3 non-fork repos with ≥10 stars, OR ≥50 total stars."""
repos = data.get("repos") or []
non_fork = [r for r in repos if not r.get("fork")]
popular = sum(1 for r in non_fork if (r.get("stargazers_count") or 0) >= 10)
total_stars = sum((r.get("stargazers_count") or 0) for r in non_fork)
return popular >= 3 or total_stars >= 50
def _first_n_enrolled(n: int) -> Callable[[str, dict], PredicateResult]:
"""Returns a predicate that fires for users in the first N enrollments.
When it fires, the label includes the rank (e.g. "Founder #42").
"""
def predicate(username: str, _data: dict) -> PredicateResult:
from .db import enrollment_rank
rank = enrollment_rank(username)
if rank is None or rank > n:
return False
return f"Founder #{rank}"
return predicate
TAG_RULES: list[tuple[str, Callable[[str, dict], PredicateResult]]] = [
("open-source", _open_source_maintainer),
("founder", _first_n_enrolled(1000)),
]
# ---- Entry point ------------------------------------------------------------
def evaluate(username: str, github_data: dict) -> list[tuple[str, str | None]]:
"""Return ordered (tag_id, label_override) pairs awarded to this user.
label_override is None unless the predicate returned a string, in which
case that string replaces the default TAG_DEFS label for this user.
"""
awarded: list[tuple[str, str | None]] = []
seen: set[str] = set()
key = (username or "").lower()
for tag in USER_TAGS.get(key, []):
if tag not in seen:
awarded.append((tag, None))
seen.add(tag)
for tag, predicate in TAG_RULES:
if tag in seen:
continue
try:
result = predicate(username, github_data)
except Exception:
continue
if not result:
continue
label = result if isinstance(result, str) else None
awarded.append((tag, label))
seen.add(tag)
return awarded
+15
View File
@@ -94,6 +94,21 @@ TAG_COLORS = {
"open-source": "#3fb950",
}
# Pick up colors for custom/auto-awarded tags defined in src/tag_rules.py so
# adding a new tag there is a single-file change.
def _merge_custom_tag_colors() -> None:
try:
from .. import tag_rules
except Exception:
return
for tag_id, meta in tag_rules.TAG_DEFS.items():
color = meta.get("color")
if color and tag_id not in TAG_COLORS:
TAG_COLORS[tag_id] = color
_merge_custom_tag_colors()
GRADE_COLORS = {
"S": "#ff6b9d",
"A": "#3fb950",
+13 -1
View File
@@ -1,5 +1,17 @@
"""Utility functions for SVG generation."""
from .svg_helpers import escape, card_wrapper, icon_svg
from .validate import (
is_valid_username,
is_valid_color,
safe_color,
validate_theme_name,
clip_text,
settings_size_ok,
)
__all__ = ["escape", "card_wrapper", "icon_svg"]
__all__ = [
"escape", "card_wrapper", "icon_svg",
"is_valid_username", "is_valid_color", "safe_color",
"validate_theme_name", "clip_text", "settings_size_ok",
]
+1 -1
View File
@@ -36,7 +36,7 @@ def icon_svg(kind: str, color: str) -> str:
icons = {
"commits": f'<circle cx="7" cy="7" r="3" fill="none" stroke="{color}" stroke-width="1.4"/><circle cx="7" cy="7" r="1" fill="{color}"/><line x1="7" y1="10" x2="7" y2="14" stroke="{color}" stroke-width="1.4"/><line x1="7" y1="0" x2="7" y2="4" stroke="{color}" stroke-width="1.4"/>',
"prs": f'<circle cx="4" cy="4" r="2" fill="none" stroke="{color}" stroke-width="1.2"/><circle cx="10" cy="10" r="2" fill="none" stroke="{color}" stroke-width="1.2"/><path d="M4 6v4c0 1.1.9 2 2 2h2" fill="none" stroke="{color}" stroke-width="1.2"/>',
"stars": f'<path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="{color}" opacity="0.85"/>',
"stars": f'<path d="M7 1l1.8 3.6 4 .6-2.9 2.8.7 4L7 10.2 3.4 12l.7-4L1.2 5.2l4-.6z" fill="none" stroke="{color}" stroke-width="1.2" stroke-linejoin="round"/>',
"repos": f'<rect x="2" y="1" width="10" height="12" rx="1.5" fill="none" stroke="{color}" stroke-width="1.2"/><line x1="5" y1="4" x2="9" y2="4" stroke="{color}" stroke-width="1"/><line x1="5" y1="6.5" x2="9" y2="6.5" stroke="{color}" stroke-width="1"/><line x1="5" y1="9" x2="7" y2="9" stroke="{color}" stroke-width="1"/>',
"followers": f'<circle cx="5" cy="4" r="2.5" fill="none" stroke="{color}" stroke-width="1.2"/><path d="M0.5 12c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4" fill="none" stroke="{color}" stroke-width="1.2"/><circle cx="11" cy="3.5" r="1.8" fill="none" stroke="{color}" stroke-width="1"/><path d="M10 7.5c1.5 0 3.5 1 3.5 3" fill="none" stroke="{color}" stroke-width="1"/>',
}
+62
View File
@@ -0,0 +1,62 @@
"""Input validation helpers shared across API, worker, and widget renderers.
These sit at the trust boundary between user input and anything that flows
into (a) outbound URLs to GitHub, (b) SVG markup, or (c) persisted settings.
Anything that crosses that boundary must be validated here first.
"""
from __future__ import annotations
import re
# GitHub usernames: 1–39 chars, alphanumeric or single hyphens, cannot start/end
# with a hyphen and cannot have consecutive hyphens. This matches GitHub's own
# signup regex — anything outside it is not a real account and should not be
# forwarded to the fetcher or embedded in URLs / GraphQL.
_USERNAME_RE = re.compile(r"^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$")
# CSS color accepted by the widget renderers: #rgb, #rrggbb, #rrggbbaa, or a
# short allow-list of named colors that we actually use in themes. Permissive
# parsers let an attacker smuggle quote chars into SVG attribute context.
_COLOR_HEX_RE = re.compile(r"^#[0-9a-fA-F]{3,8}$")
_COLOR_NAMES = {
"transparent", "currentcolor", "none",
"white", "black", "red", "green", "blue",
}
_MAX_SETTINGS_BYTES = 64 * 1024 # 64 KB — plenty for theme + achievements
def is_valid_username(name: str) -> bool:
return isinstance(name, str) and bool(_USERNAME_RE.match(name))
def is_valid_color(value: str) -> bool:
if not isinstance(value, str) or len(value) > 32:
return False
return bool(_COLOR_HEX_RE.match(value)) or value.lower() in _COLOR_NAMES
def safe_color(value, fallback: str) -> str:
"""Return `value` if it's a valid color string, else `fallback`."""
return value if is_valid_color(value) else fallback
def validate_theme_name(name, allowed: set[str], fallback: str = "dark") -> str:
"""Return name if it's in `allowed`, else `fallback`. Prevents KeyError DoS
on THEMES[name] when a user patches in an unknown theme."""
if isinstance(name, str) and name in allowed:
return name
return fallback
def clip_text(value, max_len: int) -> str:
"""Coerce `value` to a string and truncate. Used for user-authored fields
that flow into SVG text (title, subtitle, event_date)."""
if value is None:
return ""
s = value if isinstance(value, str) else str(value)
return s[:max_len]
def settings_size_ok(raw_json: str) -> bool:
return len(raw_json.encode("utf-8")) <= _MAX_SETTINGS_BYTES
+2
View File
@@ -6,6 +6,7 @@ from .collaborators import render_collaborators_widget
from .focus import render_focus_widget
from .languages import render_languages_widget
from .achievements import render_achievements_widget
from .streaks import render_streaks_widget
from .composite import compose_widget
__all__ = [
@@ -15,5 +16,6 @@ __all__ = [
"render_focus_widget",
"render_languages_widget",
"render_achievements_widget",
"render_streaks_widget",
"compose_widget",
]
+8 -3
View File
@@ -3,6 +3,7 @@
from ..models import AchievementData
from ..themes import THEMES
from ..utils import escape, card_wrapper
from .attribution import FOOTER_H, attribution_text
def _achievement_icon_svg(icon_type: str, color: str) -> str:
@@ -18,7 +19,8 @@ def _achievement_icon_svg(icon_type: str, color: str) -> str:
<path d="M9 3l3 8m0-8l3 8m-6-8h6" stroke="{color}" stroke-width="1.5" fill="none" stroke-linecap="round"/>
</svg>''',
"star": f'''<svg viewBox="0 0 24 24" width="24" height="24">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" fill="{color}" opacity="0.85"/>
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
fill="none" stroke="{color}" stroke-width="1.5" stroke-linejoin="round"/>
</svg>''',
"hackathon": f'''<svg viewBox="0 0 24 24" width="24" height="24">
<rect x="4" y="5" width="16" height="11" rx="1" fill="none" stroke="{color}" stroke-width="1.5"/>
@@ -65,8 +67,11 @@ def render_achievements_widget(
<text x="48" y="20" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="13" font-weight="600" fill="{t["text"]}">{escape(ach.title)}</text>
<text x="48" y="36" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="{t["text_secondary"]}">{escape(ach.subtitle)}{(" · " + ach.event_date) if ach.event_date else ""}</text>
font-size="10" fill="{t["text_secondary"]}">{escape(ach.subtitle)}{(" · " + escape(ach.event_date)) if ach.event_date else ""}</text>
</g>'''
total_h = len(shown) * 56 + 50
# The last achievement row leaves only 14px below it, so reserve
# FOOTER_H for the attribution footer.
total_h = len(shown) * 56 + 50 + FOOTER_H
items += attribution_text(t, 190, total_h - 36 - 8)
return card_wrapper(items, 380, total_h, t, "Achievements")
+24
View File
@@ -0,0 +1,24 @@
"""Shared "Generated with gh-stats.com" footer for standalone widget SVGs.
Every widget served at /api/<u>/<widget>.svg carries this footer; keeping it
in one place means all eight cards render it at the same size, opacity and
offset from the card's bottom edge.
"""
# Vertical space the footer needs at the bottom of a card. Widgets without
# that much bottom padding already grow by it; composite.py reads the same
# number back off data-gh-h to reclaim it when the widget is inlined.
FOOTER_H = 16
def attribution_text(theme: dict, x: float, y: float, reserved_h: int = FOOTER_H) -> str:
"""Footer <text>, centered on x with its baseline at y.
data-gh-attribution marks it for composite.py to strip; data-gh-h says how
much card height the composite reclaims along with it (0 when the footer
sits inside padding the card already had).
"""
return f'''<text data-gh-attribution="1" data-gh-h="{reserved_h}"
x="{x}" y="{y}" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="{theme["text_secondary"]}" opacity="0.75">Generated with gh-stats.com</text>'''
+6 -2
View File
@@ -2,7 +2,8 @@
from ..models import CollaboratorData
from ..themes import THEMES
from ..utils import escape, card_wrapper
from ..utils import escape, card_wrapper, safe_color
from .attribution import attribution_text
def render_collaborators_widget(collabs: list[CollaboratorData], theme_name: str = "dark", settings: dict | None = None) -> str:
@@ -15,7 +16,7 @@ def render_collaborators_widget(collabs: list[CollaboratorData], theme_name: str
t = THEMES[theme_name]
s = settings or {}
max_count = min(max(int(s.get("max_count", 5)), 1), 10)
bar_color = s.get("bar_color") or t["purple"]
bar_color = safe_color(s.get("bar_color"), t["purple"])
items = ""
for i, c in enumerate(collabs[:max_count]):
@@ -49,4 +50,7 @@ def render_collaborators_widget(collabs: list[CollaboratorData], theme_name: str
</g>'''
total_h = len(collabs[:max_count]) * 50 + 48
# The rows already leave 26px of bottom padding, so the footer fits
# inside it and the card height is unchanged (reserved height 0).
items += attribution_text(t, 190, total_h - 36 - 8, 0)
return card_wrapper(items, 380, total_h, t, "Top Collaborators")
+42 -11
View File
@@ -5,9 +5,23 @@ from ..themes import THEMES
from ..utils import escape
_ATTRIBUTION_RE = re.compile(
r'<text\b[^>]*\bdata-gh-attribution="1"[^>]*>[^<]*</text>',
re.DOTALL,
)
_ATTRIBUTION_H_RE = re.compile(r'\bdata-gh-h="(\d+)"')
def _extract_inner(svg: str, widget_key: str) -> tuple[str, int]:
"""Extract the inner content from a widget SVG and rewrite IDs to be unique.
Also strips any per-widget "Generated with gh-stats.com" attribution text
(marked with data-gh-attribution="1") and shrinks the reported height
by data-gh-h so the composite doesn't reserve empty space for the
removed footer. The composite has its own attribution at the bottom
of the whole card; per-widget attributions are for the standalone
/api/<u>/<widget>.svg embed paths.
Returns (inner_svg_content, height).
"""
# Parse height
@@ -31,6 +45,14 @@ def _extract_inner(svg: str, widget_key: str) -> tuple[str, int]:
inner = re.sub(r'<svg[^>]*>', '', inner, count=1)
inner = re.sub(r'</svg>\s*$', '', inner)
# Strip any embedded attribution and reclaim its reserved height.
attr_match = _ATTRIBUTION_RE.search(inner)
if attr_match:
inner = inner.replace(attr_match.group(0), '', 1)
h_match = _ATTRIBUTION_H_RE.search(attr_match.group(0))
if h_match:
h -= int(h_match.group(1))
return inner, h
@@ -40,20 +62,29 @@ def compose_widget(
theme_name: str = "dark",
username: str = "",
avatar_b64: str = "",
show_name: bool = True,
) -> str:
"""
Takes rendered SVG strings for each widget type and composes them
into a single unified profile widget by inlining widget SVGs directly.
`show_name` controls whether the avatar + username header block is
drawn. It's the "name" pseudo-widget — pinned first in the UI, can be
toggled off but not reordered. When false, widgets start at the top
edge (minus the standard padding) so there's no orphan gap.
"""
t = THEMES[theme_name]
total_w = 420
header_h = 60
header_h = 60 if show_name else 0
padding = 20
gap = 16
# Extract inner content from each widget SVG
# Extract inner content from each widget SVG. "name" has no rendered
# widget — it maps to the header block and is consumed by show_name.
parts = []
for key in enabled:
if key == "name":
continue
if key in widgets and widgets[key]:
inner, h = _extract_inner(widgets[key], key)
parts.append((key, inner, h))
@@ -61,16 +92,16 @@ def compose_widget(
content_h = sum(h for _, _, h in parts) + gap * max(len(parts) - 1, 0)
total_h = header_h + content_h + padding * 2 + 10
# Header
avatar_svg = ""
if avatar_b64:
avatar_svg = f'''
# Header (avatar + username). Only drawn when "name" is enabled.
header = ""
if show_name:
if avatar_b64:
avatar_svg = f'''
<defs><clipPath id="mainAvatarClip"><circle cx="30" cy="30" r="16"/></clipPath></defs>
<image x="14" y="14" width="32" height="32" href="data:image/png;base64,{avatar_b64}" clip-path="url(#mainAvatarClip)"/>'''
else:
avatar_svg = f'<circle cx="30" cy="30" r="16" fill="{t["accent"]}" opacity="0.3"/>'
header = f'''
else:
avatar_svg = f'<circle cx="30" cy="30" r="16" fill="{t["accent"]}" opacity="0.3"/>'
header = f'''
{avatar_svg}
<text x="54" y="38" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="{t["text"]}">{escape(username or "Developer")}</text>
@@ -96,5 +127,5 @@ def compose_widget(
{embedded}
<text x="{total_w // 2}" y="{total_h - 8}" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="{t["text_secondary"]}" opacity="0.5">Generated with ♥</text>
font-size="10" fill="{t["text_secondary"]}" opacity="0.75">Generated with gh-stats.com</text>
</svg>'''
+5 -1
View File
@@ -3,6 +3,7 @@
from ..models import FocusCategory
from ..themes import THEMES, FOCUS_COLORS
from ..utils import escape, card_wrapper
from .attribution import FOOTER_H, attribution_text
def render_focus_widget(categories: list[FocusCategory], theme_name: str = "dark", period: str = "1y", settings: dict | None = None) -> str:
@@ -59,5 +60,8 @@ def render_focus_widget(categories: list[FocusCategory], theme_name: str = "dark
<text x="16" y="{subtitle_y}" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="{t["text_secondary"]}" opacity="0.7">Recent activity · {period_display}</text>'''
card_h = len(cats) * 36 + 54
# The period subtitle leaves only 8px below it, so reserve FOOTER_H for
# the attribution footer.
card_h = len(cats) * 36 + 54 + FOOTER_H
items += attribution_text(t, 190, card_h - 36 - 8)
return card_wrapper(items, 380, card_h, t, "Recent Focus")
+67 -7
View File
@@ -4,6 +4,46 @@ import math
from ..models import GradeData
from ..themes import THEMES, TAG_COLORS, GRADE_COLORS
from ..utils import escape, card_wrapper, icon_svg
from .attribution import FOOTER_H, attribution_text
# Tokens that should render uppercase instead of title-cased (e.g. "ml-engineer"
# → "ML Engineer", not "Ml Engineer").
_TAG_ACRONYMS = {"ml", "ai", "ui", "ux", "api", "cli", "sql", "css", "html", "js", "ios"}
# Human-readable names for the breakdown factors `compute_grade` emits. Used in
# the subtitle's "Strong in ..." callout to surface the two highest-scoring
# pillars of the grade — real info instead of repeating the letter + score.
_BREAKDOWN_LABELS = {
"commits": "Commits",
"consistency": "Consistency",
"repos": "Repos",
"stars": "Stars",
"forks": "Forks",
"activity": "Activity",
"followers": "Followers",
}
def _top_strengths(breakdown: dict | None, n: int = 2) -> list[str]:
if not breakdown:
return []
ranked = sorted(breakdown.items(), key=lambda kv: kv[1], reverse=True)
return [_BREAKDOWN_LABELS.get(k, k.capitalize()) for k, _ in ranked[:n]]
def _format_tag_label(tag: str) -> str:
# Custom tags may define an explicit label in src/tag_rules.py::TAG_DEFS.
try:
from .. import tag_rules
meta = tag_rules.TAG_DEFS.get(tag)
if meta and meta.get("label"):
return meta["label"]
except Exception:
pass
return " ".join(
w.upper() if w.lower() in _TAG_ACRONYMS else w.capitalize()
for w in tag.split("-")
)
def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dict | None = None) -> str:
@@ -28,7 +68,10 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
radius = 36
circumference = 2 * math.pi * radius
offset = circumference * (1 - score / 100)
# S-tier grades get a fully closed ring regardless of exact score — the
# letter "S" itself carries the "top of the scale" meaning, so the visual
# should match. S+, S++ share the full circle.
offset = 0 if base == "S" else circumference * (1 - score / 100)
grade_font = 30 if len(data.grade) <= 2 else 22
# Stats row with icons
@@ -63,7 +106,7 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
for tag in (data.tags or []):
tag_color = TAG_COLORS.get(tag.tag, t["accent"])
label = tag.tag.replace("-", " ").title()
label = getattr(tag, "label", None) or _format_tag_label(tag.tag)
tw = int(len(label) * 6.6 + 18)
pill_opacity = 0.9 if tag.source == "earned" else 0.55
@@ -86,7 +129,16 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
stats_y = 100
tags_y = stats_y + 54
tag_padding = 18 if tags_h > 24 else 14
# Reserve space at the bottom for the "Generated with gh-stats.com"
# attribution. Matches the composite widget's footer convention so
# the standalone grade widget feels visually consistent when it's
# embedded on its own (the /api/<u>/grade.svg path).
footer_h = FOOTER_H
card_h = (tags_y + tags_h + tag_padding) if data.tags else (stats_y + 54)
card_h += footer_h
strengths = _top_strengths(data.breakdown)
strengths_line = f"Strong in {' · '.join(strengths)}" if strengths else ""
inner = f'''
<g transform="translate(52, 48)">
@@ -96,18 +148,18 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
stroke-linecap="round" transform="rotate(-90)">
<animate attributeName="stroke-dashoffset" from="{circumference}" to="{offset}" dur="1s" fill="freeze"/>
</circle>
<text x="0" y="-4" text-anchor="middle" dominant-baseline="middle"
<text x="0" y="{grade_font * 0.35:.2f}" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="{grade_font}" font-weight="800" fill="{color}">{escape(data.grade)}</text>
<text x="0" y="18" text-anchor="middle" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="{t["text_secondary"]}">{score:.0f} / 100</text>
</g>
<line x1="100" y1="16" x2="100" y2="80" stroke="{t["grid"]}" stroke-width="1"/>
<g transform="translate(114, 26)">
<text x="0" y="10" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="16" font-weight="700" fill="{t["text"]}">Developer Profile</text>
<text x="0" y="28" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="{t["text_secondary"]}">Grade <tspan fill="{color}" font-weight="700">{escape(data.grade)}</tspan> · {score:.0f}/100</text>
<text x="0" y="32" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="11" fill="{t["text_secondary"]}">{strengths_line}</text>
<text x="0" y="50" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="{t["text_secondary"]}" letter-spacing="0.4">Score <tspan fill="{t["text"]}" font-weight="600">{score:.0f}</tspan> / 100</text>
</g>
<line x1="20" y1="{stats_y - 4}" x2="360" y2="{stats_y - 4}" stroke="{t["grid"]}" stroke-width="0.5"/>
<g transform="translate(20, {stats_y})">
@@ -121,4 +173,12 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
{tags_svg}
</g>'''
# Footer attribution. Marked with data-gh-attribution so composite.py
# can strip it (and reclaim the 16px) when this widget gets inlined
# — the composite has its own footer at the bottom of the whole
# card, so showing both would double-tag the same image.
# Positioned in the inner-svg coordinate space (card_wrapper passes
# title="" here, so inner is not vertically offset).
inner += attribution_text(t, 190, card_h - 8, footer_h)
return card_wrapper(inner, 380, card_h, t, "")
+9 -3
View File
@@ -2,7 +2,8 @@
from ..models import ImpactWeek
from ..themes import THEMES
from ..utils import card_wrapper
from ..utils import card_wrapper, safe_color
from .attribution import FOOTER_H, attribution_text
def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", period: str = "6mo", settings: dict | None = None) -> str:
@@ -13,8 +14,10 @@ def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", peri
"""
t = THEMES[theme_name]
s = settings or {}
line_color = s.get("line_color") or t["accent"]
w, h = 380, 200
line_color = safe_color(s.get("line_color"), t["accent"])
# The summary block already ends ~12px above the card edge, which the
# footer would sit on top of, so reserve FOOTER_H for it.
w, h = 380, 200 + FOOTER_H
chart_x, chart_y = 40, 8
chart_w, chart_h = 316, 82
@@ -31,6 +34,7 @@ def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", peri
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="{t["text_secondary"]}">commits over {period}</text>
</g>'''
inner += attribution_text(t, 190, h - 36 - 8)
return card_wrapper(inner, w, h, t, "Impact Timeline")
max_commits = max((wk.commits for wk in weeks), default=1) or 1
@@ -92,4 +96,6 @@ def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", peri
font-size="9" fill="{t["text_secondary"]}">commits over {period}</text>
</g>'''
inner += attribution_text(t, 190, h - 36 - 8)
return card_wrapper(inner, w, h, t, "Impact Timeline")
+22 -6
View File
@@ -4,6 +4,7 @@ import math
from ..models import LanguageData
from ..themes import THEMES, LANG_COLORS, FOCUS_COLORS
from ..utils import escape, card_wrapper
from .attribution import FOOTER_H, attribution_text
def render_languages_widget(languages: list[LanguageData], theme_name: str = "dark", settings: dict | None = None) -> str:
@@ -40,12 +41,18 @@ def render_languages_widget(languages: list[LanguageData], theme_name: str = "da
for lang in langs:
lang.percentage = round(lang.percentage * factor, 1)
# Calculate center position to align with legend
legend_start = 20
legend_height = len(langs) * 22
cy = legend_start + legend_height / 2
cx, r = 60, 44
inner_r = 28
# The donut is 2 * (r + stroke-width/2) = 104px tall, but the legend block
# is only 22px per language. Centering the donut on the legend alone put
# its top above the card body whenever the legend was shorter than the
# donut (<= 3 languages), overlapping the card title. Center the donut and
# the legend on the body's midline instead; at >= 4 languages this is
# identical to the old geometry.
legend_height = len(langs) * 22
rows_h = max(legend_height + 40, 120)
cy = rows_h / 2
legend_start = (rows_h - legend_height) / 2
circumference = 2 * math.pi * r
arcs = ""
@@ -95,5 +102,14 @@ def render_languages_widget(languages: list[LanguageData], theme_name: str = "da
{legend}
</g>'''
rows_h = max(len(langs) * 22 + 40, 120)
return card_wrapper(inner, 380, rows_h + 36, t, "Languages")
# Footer attribution. Marked with data-gh-attribution so composite.py
# can strip it (and reclaim the 16px) when inlining the widget into
# the larger composite — the composite has its own footer, showing
# both would be visually redundant. card_wrapper here passes
# title="Languages", which adds a 36px translate to inner. The 36 is
# already baked into the card height (rows_h + 36); the attribution
# adds another 16 on top, positioned 8px from the bottom of the card.
footer_h = FOOTER_H
card_h = rows_h + 36 + footer_h
inner += attribution_text(t, 190, card_h - 36 - 8, footer_h)
return card_wrapper(inner, 380, card_h, t, "Languages")
+124
View File
@@ -0,0 +1,124 @@
"""Streaks widget rendering."""
from datetime import date
from ..models import StreakData
from ..themes import THEMES
from ..utils import escape, card_wrapper, safe_color
from .attribution import FOOTER_H, attribution_text
def _fmt_day(d: date, include_year: bool) -> str:
# %-d strips leading zero (POSIX-only; the service runs in a Linux container).
return d.strftime("%b %-d, %Y") if include_year else d.strftime("%b %-d")
def _fmt_current(start_iso: str, today_iso: str) -> str:
"""Caption for the current-streak date, e.g. 'Apr 8 – Today' or
'Apr 8, 2025 – Today' when the streak spans years."""
if not start_iso:
return ""
try:
s = date.fromisoformat(start_iso)
t = date.fromisoformat(today_iso) if today_iso else date.today()
except ValueError:
return ""
return f"{_fmt_day(s, s.year != t.year)} – Today"
def _fmt_longest(start_iso: str, end_iso: str) -> str:
"""Caption for the longest-streak date range. Keeps the year on the end date;
adds a year to the start date only when start/end straddle years."""
try:
s = date.fromisoformat(start_iso) if start_iso else None
e = date.fromisoformat(end_iso) if end_iso else None
except ValueError:
return ""
if s and e:
if s.year == e.year:
return f"{_fmt_day(s, False)} – {_fmt_day(e, True)}"
return f"{_fmt_day(s, True)} – {_fmt_day(e, True)}"
if e:
return _fmt_day(e, True)
if s:
return _fmt_day(s, True)
return ""
def render_streaks_widget(
data: StreakData,
theme_name: str = "dark",
settings: dict | None = None,
) -> str:
"""Render the streaks widget.
Settings:
color (str): Hex color for the current-streak number and progress bar
fill (default theme accent).
"""
t = THEMES[theme_name]
s = settings or {}
current_color = safe_color(s.get("color"), t["accent"])
max_color = t["text"]
# The body already ends ~15px above the card edge, which the footer would
# sit on top of, so reserve FOOTER_H for it.
width, height = 380, 170 + FOOTER_H
# Inner content is translated 36px down by card_wrapper's title strip, so
# every y below is measured from that inner origin.
left_x = 105
right_x = 275
divider_x = 190
bar_x = 50
bar_w = 280
fraction = (data.current / data.max) if data.max > 0 else 0.0
fraction = max(0.0, min(1.0, fraction))
fill_w = round(bar_w * fraction, 2)
current_caption = _fmt_current(data.current_start, data.last_active_date) if data.current > 0 else ""
longest_caption = _fmt_longest(data.max_start, data.max_end)
# End-cap dot on the progress fill — hidden at 0% so it doesn't float
# detached at the bar start when the user has no current streak.
end_dot = ""
if fill_w > 0:
end_dot = (
f'<circle cx="{bar_x + fill_w:.2f}" cy="94.5" r="3.5" '
f'fill="{current_color}"/>'
)
inner = f'''
<text x="{left_x}" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="{t["text_secondary"]}">CURRENT</text>
<text x="{left_x}" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="{current_color}">{data.current}</text>
<text x="{right_x}" y="22" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" font-weight="600" letter-spacing="1.4"
fill="{t["text_secondary"]}">LONGEST</text>
<text x="{right_x}" y="66" text-anchor="middle"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="40" font-weight="800" fill="{max_color}">{data.max}</text>
<line x1="{divider_x}" y1="10" x2="{divider_x}" y2="76"
stroke="{t["card_border"]}" stroke-width="1"/>
<rect x="{bar_x}" y="92" width="{bar_w}" height="5" rx="2.5" fill="{t["grid"]}"/>
<rect x="{bar_x}" y="92" width="{fill_w}" height="5" rx="2.5" fill="{current_color}"/>
{end_dot}
<text x="{bar_x}" y="116"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="{t["text_secondary"]}">{escape(current_caption)}</text>
<text x="{bar_x + bar_w}" y="116" text-anchor="end"
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="10" fill="{t["text_secondary"]}">{escape(longest_caption)}</text>'''
inner += attribution_text(t, 190, height - 36 - 8)
return card_wrapper(inner, width, height, t, "Streaks")
+152 -12
View File
@@ -1,21 +1,74 @@
"""Build worker. Pulls pending jobs and renders widgets.
"""Prefetch worker. Pulls pending jobs, populates widget data, renders SVGs.
Each job (from enroll/settings-change/cron-detected payload change) goes
through two steps in one pass: compute the widget_data dict for the client-
side Workshop preview, then render and persist the composite + per-widget
SVGs so embedded README widgets stay fresh as the underlying GitHub data
rotates. The /generate endpoint reuses the same render path for on-demand
re-renders triggered by the Generate button.
Run as its own container: CMD python -m src.worker
"""
import logging
import time
from dataclasses import asdict
from . import cache, config, db, fetcher_client, placeholder, processor
from . import analytics, cache, config, db, fetcher_client, placeholder, processor
from .widgets import compose_widget
log = logging.getLogger("generator.worker")
MAX_ATTEMPTS = 3
def _compute_widget_data(payload: dict, settings: dict, username: str) -> dict:
"""Compute raw widget data dict for client-side rendering.
Also persists the user's streak state as a side effect — the longest streak
must survive settings-hash rotations, so it lives outside widget_data.
"""
custom_tags = settings.get("custom_tags")
hidden_languages = settings.get("hidden_languages")
stored_streak = db.get_user_streak(username)
streak = processor.compute_streaks(payload, stored_streak)
db.put_user_streak(username, {
"current_streak": streak.current,
"current_start": streak.current_start,
"last_active_date": streak.last_active_date,
"max_streak": streak.max,
"max_start": streak.max_start,
"max_end": streak.max_end,
})
return {
"grade": asdict(processor.compute_grade(payload, custom_tags=custom_tags)),
"impact": [asdict(w) for w in processor.compute_impact_timeline(payload)],
"collaborators": [asdict(c) for c in processor.compute_collaborators(payload)],
"focus": [asdict(f) for f in processor.compute_focus(payload, hidden_languages=hidden_languages)],
"languages": [asdict(l) for l in processor.compute_languages(payload, hidden_languages=hidden_languages)],
"streaks": asdict(streak),
}
def _render_and_persist(username: str, payload: dict, settings: dict, settings_hash: str) -> None:
"""Render SVGs from the payload and persist to widgets.db. Used by the
cron-driven worker so embedded widgets keep ticking forward (streak
counter, etc.) as the fetcher refreshes the underlying data — without
waiting for the user to manually click Generate."""
t0 = time.monotonic()
widgets = _render_widgets(username, payload, settings)
db.put_widgets(username, settings_hash, widgets)
cache.Cache().delete(
f"widget:composite:{username}",
*[f"widget:{n}:{username}" for n in widgets],
)
analytics.record_render(username, "composite",
int((time.monotonic() - t0) * 1000))
def _render_widgets(username: str, payload: dict, settings: dict) -> dict[str, str]:
enabled = settings.get("enabled") or config.ENABLED_WIDGETS
order = settings.get("widget_order") or config.WIDGET_ORDER
theme = settings.get("theme", "dark")
stored_streak = db.get_user_streak(username)
widgets = processor.generate_widgets_from_github(
payload,
theme=theme,
@@ -23,11 +76,21 @@ def _render_widgets(username: str, payload: dict, settings: dict) -> dict[str, s
hidden_languages=settings.get("hidden_languages"),
enabled=enabled,
widget_settings=settings.get("widget_settings") or {},
achievements=settings.get("achievements") or [],
stored_streak=stored_streak,
)
ordered = [w for w in order if w in enabled and w in widgets and widgets[w]]
enabled_set = set(enabled)
show_name = "name" in enabled_set
# Preserve "name" in the ordered list so the composite honors its
# user-ordered position (always 0 today, but future-proof).
ordered = [
w for w in order
if w in enabled_set and (w == "name" or (w in widgets and widgets[w]))
]
composite = compose_widget(
widgets=widgets, enabled=ordered, theme_name=theme,
username=username, avatar_b64=payload.get("avatar_b64", ""),
show_name=show_name,
)
out = {name: svg for name, svg in widgets.items() if svg}
out["composite"] = composite
@@ -35,6 +98,10 @@ def _render_widgets(username: str, payload: dict, settings: dict) -> dict[str, s
def process_one() -> bool:
"""Claim a pending job: populate widget_data AND render SVGs. The render
step is what keeps embedded README widgets fresh as the fetcher rotates
payloads — without it, SVGs would only ever update when the user clicks
Generate, which is why the streak counter previously appeared frozen."""
job = db.claim_next_job()
if job is None:
return False
@@ -43,9 +110,8 @@ def process_one() -> bool:
result = fetcher_client.get_data(username)
payload = result.get("data") or {}
if payload.get("error") == "not_found":
svg = placeholder.render("not_found", username, theme="dark")
db.put_widgets(username, "not_found", {"composite": svg})
cache.Cache().delete(f"widget:composite:{username}")
db.put_widget_data(username, "not_found", {"not_found": True})
db.point_current_widget(username, "not_found")
db.complete_job(job["id"])
log.info("not_found marker persisted for %s", username)
return True
@@ -55,25 +121,99 @@ def process_one() -> bool:
db.fail_job(job["id"], "settings missing", retry=False)
return True
widgets = _render_widgets(username, payload, settings_row["settings"])
db.put_widgets(username, settings_row["settings_hash"], widgets)
settings = settings_row["settings"]
settings_hash = settings_row["settings_hash"]
widget_data = _compute_widget_data(payload, settings, username)
db.put_widget_data(username, settings_hash, widget_data)
_render_and_persist(username, payload, settings, settings_hash)
db.point_current_widget(username, settings_hash)
db.set_last_fetcher_hash(username, result.get("payload_hash", ""))
db.lru_trim(username, config.WIDGET_LRU_PER_USER)
c = cache.Cache()
c.delete(f"widget:composite:{username}", *[f"widget:{n}:{username}" for n in widgets])
db.complete_job(job["id"])
log.info("built widgets for %s", username)
log.info("prefetched + rendered widgets for %s", username)
return True
except Exception as e:
retry = job["attempts"] < MAX_ATTEMPTS
db.fail_job(job["id"], str(e)[:500], retry=retry)
log.warning("build failed for %s (retry=%s): %s", username, retry, e)
log.warning("prefetch failed for %s (retry=%s): %s", username, retry, e)
return True
def render_composite_adhoc(username: str, override_settings: dict,
widget_name: str = "composite") -> str | None:
"""Render `widget_name` for `username` using stored settings merged
with the per-request `override_settings`. Does NOT persist anything.
Used by the public `GET /api/<u>?...` endpoint so unauthenticated visitors
can preview/embed a widget configured purely via query string, without
touching the owner's stored settings.
Returns the SVG string, or None if the user isn't enrolled / the fetcher
has no data for them (caller should fall through to the cached path).
"""
settings_row = db.get_settings(username)
if settings_row is None:
return None
result = fetcher_client.get_data(username)
payload = result.get("data") or {}
if not payload or payload.get("error") == "not_found":
return None
effective = {**settings_row["settings"], **(override_settings or {})}
if widget_name != "composite":
# Only the requested widget is returned, so don't pay to render the
# rest: generate_widgets_from_github skips anything not enabled.
effective["enabled"] = [widget_name]
t0 = time.monotonic()
widgets = _render_widgets(username, payload, effective)
analytics.record_render(username, "composite",
int((time.monotonic() - t0) * 1000))
return widgets.get(widget_name)
def render_widgets_now(username: str) -> dict[str, str]:
"""Phase 2: synchronously render composite SVG and persist it.
Called from POST /api/<u>/generate. Reuses the fetcher's cached payload
(a cheap internal HTTP lookup) so the user-facing render is fast even
if the prefetch job hasn't drained from the queue yet.
"""
settings_row = db.get_settings(username)
if settings_row is None:
raise LookupError("not_enrolled")
result = fetcher_client.get_data(username)
payload = result.get("data") or {}
if payload.get("error") == "not_found":
svg = placeholder.render("not_found", username, theme=settings_row["settings"].get("theme", "dark"))
db.put_widgets(username, "not_found", {"composite": svg})
db.point_current_widget(username, "not_found")
cache.Cache().delete(f"widget:composite:{username}")
return {"composite": svg}
t0 = time.monotonic()
widgets = _render_widgets(username, payload, settings_row["settings"])
db.put_widgets(username, settings_row["settings_hash"], widgets)
db.point_current_widget(username, settings_row["settings_hash"])
c = cache.Cache()
c.delete(f"widget:composite:{username}", *[f"widget:{n}:{username}" for n in widgets])
analytics.record_render(username, "composite",
int((time.monotonic() - t0) * 1000))
log.info("rendered widgets on-demand for %s", username)
return widgets
def main():
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s %(message)s")
db.init_dbs()
# If this boot is the first container to see a new BUILD_VERSION,
# enqueue a rebuild for every enrolled user. claim_build_version is
# atomic so racing with the api/cron containers is safe.
if config.BUILD_VERSION:
try:
if db.claim_build_version(config.BUILD_VERSION):
n = db.enqueue_build_all()
log.info("build %s: queued %d rebuild(s)", config.BUILD_VERSION, n)
except Exception:
log.exception("build-version invalidation failed")
while True:
db.reclaim_stuck_jobs(older_than_minutes=10)
if not process_one():
+36 -7
View File
@@ -1,5 +1,5 @@
"""End-to-end: api + worker in-process + mocked fetcher HTTP."""
import os, tempfile
import os, tempfile, time
import pytest
import responses
from src import api as apimod, db as dbmod, worker
@@ -17,7 +17,13 @@ def env(monkeypatch):
@responses.activate
def test_first_request_builds_then_serves_ready(env):
def test_full_flow_data_then_generate_then_serve(env):
"""End-to-end of the new two-phase pipeline:
1. OAuth callback enrolls user + kicks off prefetch (worker populates widget_data)
2. /data endpoint returns widget data
3. /generate renders SVG from the cached payload + settings
4. /api/<u> serves the stored SVG to README consumers
"""
responses.add(
responses.GET, "http://fetcher-mock/data/alice",
json={"data": {"user": {"login": "alice"}, "repos": [], "events": [],
@@ -27,13 +33,36 @@ def test_first_request_builds_then_serves_ready(env):
)
client = apimod.app.test_client()
r1 = client.get("/api/alice")
assert r1.headers["X-Widget-Status"] == "building"
# Phase 1: OAuth callback enrolls user (simulated via db.enroll).
dbmod.enroll("alice", {"theme": "dark"})
# Widget data should be building right after enrollment.
r_data = client.get("/api/alice/data")
assert r_data.status_code == 202
# Drain any residual job synchronously in case the kickoff thread lost
# the race (and to make the assertion deterministic).
for _ in range(5):
if not worker.process_one():
break
r2 = client.get("/api/alice")
assert r2.headers["X-Widget-Status"] == "ready"
assert r2.data.startswith(b"<svg") or r2.data.startswith(b"<?xml")
# Widget data should now be available for client-side preview.
deadline = time.time() + 2.0
while time.time() < deadline:
r = client.get("/api/alice/data")
if r.status_code == 200 and r.get_json().get("status") == "ready":
break
time.sleep(0.05)
assert r.status_code == 200 and r.get_json()["status"] == "ready"
# Phase 2: Generate button → render SVG (with session).
with client.session_transaction() as s:
s["gh_login"] = "alice"
r_gen = client.post("/api/alice/generate", headers={"Origin": "https://gh-stats.com"})
assert r_gen.status_code == 200
assert r_gen.get_json()["status"] == "ready"
# Phase 3: SVG is served from DB.
r_svg = client.get("/api/alice")
assert r_svg.headers["X-Widget-Status"] == "ready"
assert r_svg.data.startswith(b"<svg") or r_svg.data.startswith(b"<?xml")
+276
View File
@@ -0,0 +1,276 @@
import os, tempfile, time
import pytest
from src import db as dbmod
from src import analytics as a
@pytest.fixture
def fresh(monkeypatch):
with tempfile.TemporaryDirectory() as d:
monkeypatch.setattr(dbmod, "SETTINGS_DB_PATH", os.path.join(d, "s.db"))
monkeypatch.setattr(dbmod, "WIDGETS_DB_PATH", os.path.join(d, "w.db"))
monkeypatch.setattr(dbmod, "ANALYTICS_DB_PATH", os.path.join(d, "a.db"))
dbmod.init_dbs()
a._reset_for_tests()
yield
def test_ingest_batch_writes_rows(fresh):
n = a.ingest_batch([
{"ts": 1000, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 12, "cache_hit": 1},
{"ts": 1001, "service": "edge", "kind": "request",
"username": "bob", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 8, "cache_hit": 0},
])
assert n == 2
with dbmod.analytics_conn() as c:
rows = c.execute("SELECT username, latency_ms FROM events ORDER BY ts").fetchall()
assert [(r["username"], r["latency_ms"]) for r in rows] == [("alice", 12), ("bob", 8)]
def test_ingest_drops_bad_rows(fresh):
n = a.ingest_batch([
{"ts": 1, "service": "edge", "kind": "request", "latency_ms": 1},
{"missing": "everything"},
{"ts": 2, "service": "edge", "kind": "request", "latency_ms": "not-int"},
])
assert n == 1
def test_record_render_flushes_to_db(fresh, monkeypatch):
monkeypatch.setattr(a, "_FLUSH_SECONDS", 0.05)
a.start_flush_thread()
a.record_render("alice", "composite", 142)
deadline = time.time() + 3
row = None
while time.time() < deadline:
with dbmod.analytics_conn() as c:
row = c.execute("SELECT * FROM events WHERE kind='render'").fetchone()
if row:
break
time.sleep(0.05)
assert row is not None
assert row["username"] == "alice"
assert row["widget"] == "composite"
assert row["latency_ms"] == 142
def test_summary_aggregates_last_7d(fresh):
now = int(time.time())
rows = [
{"ts": now - 60, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": now - 120, "service": "edge", "kind": "request",
"username": "bob", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 50, "cache_hit": 0},
{"ts": now - 10 * 86400, "service": "edge", "kind": "request",
"username": "old", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 999, "cache_hit": 0},
{"ts": now - 30, "service": "generator", "kind": "render",
"username": "alice", "widget": "composite", "latency_ms": 200},
]
a.ingest_batch(rows)
s = a.query_summary()
assert s["requests_7d"] == 2 # 'old' falls outside the 7d window
assert s["active_users_7d"] == 2 # alice (edge+render dedup) + bob
assert s["renders_7d"] == 1
assert s["avg_render_ms"] == 200
assert s["p50_ms"] in (10, 50)
assert s["p95_ms"] == 50
assert len(s["daily_requests"]) == 7
def test_query_users_returns_per_user_rows(fresh):
now = int(time.time())
a.ingest_batch([
{"ts": now - 60, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": now - 30, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>/grade.svg", "widget": "grade",
"status": 200, "latency_ms": 20, "cache_hit": 1},
{"ts": now - 10, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 30, "cache_hit": 1},
])
users = a.query_users()
assert len(users) == 1
u = users[0]
assert u["username"] == "alice"
assert u["requests_7d"] == 3
assert u["top_endpoint"] == "/<u>"
assert u["avg_latency_ms"] == 20
def test_query_latency_returns_percentiles(fresh):
now = int(time.time())
a.ingest_batch([
{"ts": now - 1, "service": "edge", "kind": "request",
"username": "u", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": v, "cache_hit": 1}
for v in range(1, 101)
])
rows = a.query_latency()
by_ep = {r["endpoint"]: r for r in rows}
assert by_ep["/<u>"]["count"] == 100
assert by_ep["/<u>"]["p50"] == 50
assert by_ep["/<u>"]["p95"] == 95
assert by_ep["/<u>"]["p99"] == 99
def test_query_growth_buckets_by_day_and_week(fresh):
now = int(time.time())
a.ingest_batch([
# Today: alice (2 requests), bob (1 request), carol (render only)
{"ts": now - 60, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": now - 120, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": now - 180, "service": "edge", "kind": "request",
"username": "bob", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": now - 240, "service": "generator", "kind": "render",
"username": "carol", "widget": "composite", "latency_ms": 100},
# 10 days ago: dave (1 request) — outside the 30d window's start
# would still land in the daily bucket if within range
{"ts": now - 10 * 86400, "service": "edge", "kind": "request",
"username": "dave", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
])
g = a.query_growth(daily_n=30, weekly_n=12)
assert len(g["daily"]) == 30
assert len(g["weekly"]) == 12
# Today = last entry. Requests count only kind='request', users include
# render-only callers — matching active_users_7d's definition.
today = g["daily"][-1]
assert today["requests"] == 3
assert today["users"] == 3 # alice, bob, carol
# 10-day-ago bucket has dave's single request
ten_days_ago = g["daily"][-11]
assert ten_days_ago["requests"] == 1
assert ten_days_ago["users"] == 1
# Current week (last weekly entry) includes today's traffic
assert g["weekly"][-1]["requests"] >= 3
assert g["weekly"][-1]["users"] >= 3
def test_growth_numbers_survive_event_prune(fresh):
"""The whole point of daily_stats: per-day counts must persist even
after their underlying events get pruned past the retention window."""
now = int(time.time())
twenty_days_ago = now - 20 * 86400
a.ingest_batch([
{"ts": twenty_days_ago, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": twenty_days_ago + 60, "service": "edge", "kind": "request",
"username": "bob", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": twenty_days_ago + 120, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
])
a.rollup_daily_stats()
pruned = a.prune_old(retention_days=14)
assert pruned == 3 # all three events were older than 14 days
g = a.query_growth(daily_n=30, weekly_n=12)
target_day = time.strftime("%Y-%m-%d", time.gmtime(twenty_days_ago))
bucket = next(d for d in g["daily"] if d["day"] == target_day)
assert bucket["requests"] == 3
assert bucket["users"] == 2 # alice (deduped) + bob
def test_weekly_uniques_dedupe_across_days(fresh):
"""A user active on multiple days within the same ISO week counts
once for that week — set union, not sum-of-daily-uniques."""
now = int(time.time())
# Pin to a known weekday so all three timestamps land in the same ISO week.
# Monday-ish: subtract `weekday` days from now to land near Mon, then offset.
monday = now - time.gmtime(now).tm_wday * 86400 + 12 * 3600 # noon UTC Monday
a.ingest_batch([
{"ts": monday, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": monday + 86400, "service": "edge", "kind": "request",
"username": "alice", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
{"ts": monday + 2 * 86400, "service": "edge", "kind": "request",
"username": "bob", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 10, "cache_hit": 1},
])
g = a.query_growth(daily_n=30, weekly_n=12)
target_week = time.strftime("%G-W%V", time.gmtime(monday))
week_row = next(w for w in g["weekly"] if w["week"] == target_week)
assert week_row["requests"] == 3
assert week_row["users"] == 2 # alice (Mon+Tue) deduped + bob (Wed)
def test_query_health(fresh):
now = int(time.time())
a.ingest_batch([
{"ts": now - 1, "service": "edge", "kind": "request",
"username": "u", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 1, "cache_hit": 1},
{"ts": now - 2, "service": "edge", "kind": "request",
"username": "u", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 1, "cache_hit": 0},
{"ts": now - 3, "service": "fetcher", "kind": "fetch",
"username": "u", "endpoint": "github/users/<u>",
"status": 500, "latency_ms": 100},
{"ts": now - 4, "service": "fetcher", "kind": "fetch",
"username": "u", "endpoint": "github/users/<u>",
"status": 200, "latency_ms": 100},
])
h = a.query_health()
assert abs(h["edge_cache_hit_rate"] - 0.5) < 1e-6
assert abs(h["fetcher_error_rate"] - 0.5) < 1e-6
assert h["events_dropped_24h"] == 0
def test_prune_drops_old_events(fresh):
now = int(time.time())
a.ingest_batch([
{"ts": now - 20 * 86400, "service": "edge", "kind": "request",
"username": "u", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 1, "cache_hit": 1},
{"ts": now, "service": "edge", "kind": "request",
"username": "u", "endpoint": "/<u>", "widget": "composite",
"status": 200, "latency_ms": 1, "cache_hit": 1},
])
deleted = a.prune_old(retention_days=14)
assert deleted == 1
with dbmod.analytics_conn() as c:
n = c.execute("SELECT COUNT(*) AS n FROM events").fetchone()["n"]
assert n == 1
def test_queue_drops_when_full_and_counts(fresh, monkeypatch):
monkeypatch.setattr(a, "_QUEUE_MAX", 3)
a._reset_for_tests()
for i in range(10):
a.record_render("u", "composite", i)
assert a._events_dropped == 7
def test_query_users_includes_render_only_users(fresh):
"""Render-only users (worker fired but no edge traffic yet) must still
appear in the table — without this, `active_users_7d` says N while the
table looks empty, which reads as a bug."""
now = int(time.time())
a.ingest_batch([
{"ts": now - 60, "service": "generator", "kind": "render",
"username": "alice", "widget": "composite", "latency_ms": 200},
])
users = a.query_users()
assert len(users) == 1
u = users[0]
assert u["username"] == "alice"
assert u["requests_7d"] == 0 # no request events yet
assert u["last_seen"] == now - 60
assert u["avg_latency_ms"] == 0 # latency only averages request events

Some files were not shown because too many files have changed in this diff Show More