Commit Graph
44 Commits
Author SHA1 Message Date
tiennm99andGitHub 3fa396d7db docs: resync remaining stale references after S-tier + demo changes (#5)
- deployment-guide.md: embed example now lists all 14 cards (was 9).
- codebase-summary.md: FetchProductive row includes Weekday / WeekdayAllTime;
  shared helpers list adds renderWeekday, renderHeatmap, mixHex/parseHex.
- system-architecture.md: per-commit fetch diagram shows the weekday bucket
  alongside the hour bucket.
2026-04-19 09:09:25 +07:00
github-actions[bot] 3e6107226f chore(demo): regenerate gallery 2026-04-19 02:05:38 +00:00
tiennm99andGitHub e08bf6316b chore: drop tracked output/ sample in favor of CI-built demo gallery (#4)
The dracula sample under output/dracula/ was a reference render for the
README. Now that demo/ auto-generates every card × every theme on each
push, the sample is redundant — and keeping it trackers means every
behavioral tweak shows up as a diff in committed SVGs.

- Delete output/dracula/*.svg.
- .gitignore: collapse `output/*` + `!output/dracula/` to a plain `output/`.
- demo.yml: drop `output/**` from paths-ignore (no longer part of any push).
- README / docs: point readers at demo/ instead of output/dracula/.
2026-04-19 09:03:44 +07:00
github-actions[bot] cd94ffbf4c chore(demo): regenerate gallery 2026-04-19 02:00:54 +00:00
tiennm99andGitHub 872a5de358 feat(card): add S-tier cards — heatmap, streak, by-year, weekday, top-starred (#3)
Five new cards, all derived from data FetchProductive / FetchProfile already
pull, so zero additional API calls:

- contributions-heatmap: 7×53 calendar grid with a 5-bucket intensity ramp
  mixed from each theme's Background→Accent so palettes with no dedicated
  heat ramp still render sensibly.
- streak: current streak, longest streak with date ranges, active/total days.
- contributions-by-year: one bar per active year, peak year highlighted.
- productive-weekday + -all-time: 7-bar day-of-week mirror of the hour-of-day
  cards; FetchProductive now also fills Weekday / WeekdayAllTime histograms
  during the same commit-history pass.
- top-starred-repos: top 5 owned non-fork repos by stargazer count; threads
  Stars through RepoInfo.

Card count: 9 → 14. Registered in allCards grouped by recency (last-year
block, then all-time block). Render test extended to cover all new files
and realistic daily-series inputs.
2026-04-19 08:58:59 +07:00
tiennm99andGitHub 13b91e827b docs: link demo gallery from readme and correct stale theme count (#2)
- README points to demo/ as an auto-generated theme preview.
- Bump "60+ / 61 themes" references to the actual 65.
- Record Phase 7.5 in roadmap and list demo.yml + demo/ in layout.
2026-04-19 08:45:40 +07:00
github-actions[bot] e3c85c02e3 chore(demo): regenerate gallery 2026-04-19 01:35:49 +00:00
tiennm99andGitHub 79d6184942 ci(demo): add workflow rendering every card for every theme (#1)
Runs on push to main (skipping its own demo/output/markdown commits),
builds the ghstats binary, renders every theme for the repo owner,
and writes a demo/README.md gallery back to main.
2026-04-19 08:34:19 +07:00
tiennm99 cda44168b5 docs(readme): add tiennm99/tiennm99 as 'In the wild' example 2026-04-19 00:12:59 +07:00
tiennm99 94e13d2c65 docs: resync with current state across all project docs
- design-guidelines: every dimension was stale — card frame 340x200
  (was 500x220), corner radius 6, title 15px at (20,30), row y0/dy,
  donut centre (250,110) r=55/30, topN=5, legend y0=55 dy=20, bar chart
  area [35,325]x[45,155], area chart [28,312]x[45,150], icon scale 0.75.
- code-standards: FetchContributionsAllTime signature now ctx-first,
  viewbox 500x220 → 340x200.
- codebase-summary: test coverage lists main_test.go +
  TestDonutSingleSlice/Empty; filename convention says plain kebab-case
  (no numeric prefix).
- project-overview-pdr: forks/private defaults now on, not off.
- project-roadmap: add Phase 7 (Marketplace polish — resize, numeric-
  prefix drop, v1 floating tag, rename-rollback). Renumber planned
  phases 8-11. Fix "hard width 500 px" limitation.
- deployment-guide: document update-major-tag job; note
  Marketplace listing name is `ghstats-cards`.
v1.1.2
2026-04-19 00:09:00 +07:00
tiennm99 cda9172701 ci(release): auto-move floating major tag after successful release
Adds an update-major-tag job that runs after test/docker/binaries all
pass. Extracts the major component from the pushed tag (v1.2.3 → v1)
and force-moves that tag to the current commit, then pushes.

Consumers using `uses: tiennm99/ghstats@v1` now pick up each new
minor/patch release automatically without a workflow edit on their
end. The v1 tag only moves if every artifact job succeeded, so it
never points at a commit whose binaries or Docker image failed to
publish.
2026-04-18 23:58:15 +07:00
tiennm99 8bd2128564 Revert "chore: rename module + references to tiennm99/ghstats-cards"
This reverts commit 399a3dc. Repo stays as tiennm99/ghstats; the
Marketplace display name ("ghstats-cards" in action.yml) is the only
place the new name remains, since that field requires uniqueness on
the Marketplace.

plans/reports/* were added alongside the rename in the same commit
and are preserved by not deleting them in this revert.
2026-04-18 23:51:33 +07:00
tiennm99 399a3dc723 chore: rename module + references to tiennm99/ghstats-cards
Matches the Marketplace name; repo is being renamed in lockstep.

- go.mod module path: github.com/tiennm99/ghstats →
  github.com/tiennm99/ghstats-cards
- Import paths across every .go file updated.
- README badges, install snippets, and the 'go install' line point
  to the new URL/path.
- docs/deployment-guide.md workflow template, Docker image path, and
  release edit URL updated.

Breaking for consumers pinned to the old URL; they need to swap
tiennm99/ghstats → tiennm99/ghstats-cards in workflows and switch
Docker pulls to ghcr.io/tiennm99/ghstats-cards. GitHub's HTTP
redirect covers git clones but GHCR does NOT redirect — users must
update image URIs manually.
2026-04-18 23:40:29 +07:00
tiennm99 e165a35f63 docs(readme): link back to Marketplace listing + add badges
- Marketplace / Release / License badges at the top.
- Explicit Marketplace + source links under the intro so visitors
  arriving from the Marketplace page can jump to the repo and vice
  versa.

Also set repo topics via `gh repo edit`: ghstats, ghstats-cards,
github-action, github-marketplace, profile-readme, profile-stats,
stats-cards, svg-cards, go, github-stats.
2026-04-18 23:36:28 +07:00
tiennm99 d205865dba chore(action): rename Marketplace display to ghstats-cards
"ghstats" is already taken by an existing action/user/org on the
GitHub Marketplace, blocking publication. Rename the action's Marketplace
display name to ghstats-cards (still more descriptive of what it
produces). The repo URL, Docker image tag, and import path stay
tiennm99/ghstats — only the Marketplace listing label changes.
v1.1.1
2026-04-18 23:30:21 +07:00
tiennm99 3f954957cb build: refresh dracula samples at 340x200 v1.1.0 2026-04-18 23:26:55 +07:00
tiennm99 d0c75d5ff1 refactor(card): shrink cards from 500x220 to 340x200
Two ghstats cards side-by-side at 500px overflow GitHub's README column
width (~816px). Matching github-profile-summary-cards' 340x200 lets
consumers place two cards per row cleanly.

- Shared header() rect corner radius 8→6, title font 18→15, title anchor
  (25,35)→(20,30).
- All card layouts reworked:
  * profile + stats: row padding 70→55 / 24→20, icon 14→12, value
    font 13→12, stats right-anchor x=475→320.
  * donut_chart: centre (380,120)→(250,110), outerR 70→55, innerR 38→30,
    legend y0 70→55, swatch 12→10, topN 6→5.
  * productive-time: leftAxis 50→35, topPad 60→45, barGap 2→1.
  * contributions: leftPad/rightPad 35→28, topPad 60→45, chartH 120→105.

Visual parity with github-profile-summary-cards; two-per-row layouts in
profile READMEs now fit.

Also: document the one-time GitHub Marketplace publishing step in
deployment-guide (no CLI flag exists — UI checkbox only).
2026-04-18 23:26:48 +07:00
tiennm99 0310b7a2d9 docs: refresh for context plumbing, rate-limit handling, phase 6
- Fetcher signatures across codebase-summary and system-architecture
  now show the ctx-first arguments and document the rate-limit retry
  loop in Client.query.
- Attribution pseudo-code hoists the per-repo total out of the commit
  loop to match the current implementation (I6).
- Failure-modes table enumerates primary rate-limit retry, per-year
  nil-user warn, and -timeout / Ctrl-C cancellation.
- design-guidelines notes the single-slice donut special case.
- deployment-guide's release section documents the new test gate and
  the SHA-pinned Docker/GHA actions; troubleshooting adds the
  rate-limit-reset-too-long error. Rate-limit section describes the
  sleep-and-retry policy and -timeout flag.
- project-roadmap records Phase 6 (code-review remediation) as done,
  renumbers later planned phases, links the new review report.
v1.0.0
2026-04-18 22:55:32 +07:00
tiennm99 eb9bdc2593 build: update stats sample to match N9 label change 2026-04-18 22:44:31 +07:00
tiennm99 4aee0862ab test: meaningful escape check, single-slice donut, utcOffsetLabel
- I4 — TestRenderAll now seeds Name/Company with XML-significant chars
  that actually hit the render pipeline via cardTitle(). Previous test
  checked Bio which is no longer rendered, so the assertion was vacuous.
- New TestDonutSingleSlice guards against the I1 empty-arc regression:
  asserts the single-slice path emits <circle> primitives and not the
  degenerate A-command path.
- New TestDonutEmpty covers the zero-stats fallback.
- New TestUTCOffsetLabel pins the UTC±N.NN format across UTC,
  Asia/Saigon, Asia/Kolkata (half-hour), Asia/Kathmandu (quarter-hour).
  Catches %+.2f regressions.
2026-04-18 22:44:25 +07:00
tiennm99 1bf7b3035b feat(client): thread context.Context and honor rate-limit backoff
- N2 — Client.query, FetchProfile, FetchContributionsAllTime, and
  FetchProductive now take context.Context. main.go builds a root
  context with a -timeout flag (default 30m) and cancels on
  SIGINT/SIGTERM so Ctrl-C aborts in-flight pagination cleanly.
- N6 — on HTTP 429 or 403 with X-RateLimit-Remaining: 0, the client
  now parses Retry-After / X-RateLimit-Reset, sleeps (capped at 5
  minutes), and retries once. Longer reset windows surface as errors
  so the caller can reschedule the Action rather than burn 55 min of
  runner time idle.
2026-04-18 22:43:50 +07:00
tiennm99 cc7d0c6504 refactor(model): rename TotalContributions → TotalContributionsLastYear
N8 — the field is set from contributionsCollection.contributionCalendar,
a rolling last-year window, not a lifetime total. Rename + updated
comment makes the semantics explicit so future readers don't confuse
it with TotalCommitsAllTime.
2026-04-18 22:43:38 +07:00
tiennm99 76cf242ee9 fix: donut single-slice, partial-year warn, hoist per-repo total
- I1 — donut chart with a single slice (100%) now renders via two
  concentric <circle> elements instead of a degenerate SVG arc that
  drew nothing. Reproduced with a standalone probe; regression test
  added separately.
- I2 — FetchContributionsAllTime logs a warn to stderr when a year's
  query returns nil user data so callers notice partial results
  instead of rendering an empty all-time card silently.
- I6 — attributeCommit() receives the repo's byte total precomputed
  once per repo rather than re-summing language edges for every
  commit in the inner loop.
2026-04-18 22:43:24 +07:00
tiennm99 fcfec9a11b chore: small hygiene fixes from code review
- I3 — update FetchOptions doc to describe zero-value vs CLI-flag defaults.
- I5 — release workflow gates docker/binaries on a test job; tags no
  longer ship broken artifacts.
- N1 — replace handwritten joinErrs with strings.Join.
- N3 — truncate() now backs up to a UTF-8 rune boundary so error
  messages never end on a split codepoint.
- N4 — pin Docker base images (golang:1.26-alpine, alpine:3.21) to
  SHA256 digests.
- N5 — pin third-party GitHub Actions to commit SHAs with version
  comments for readability.
- N9 — drop the "(non-fork)" qualifier from the stats card label; the
  underlying GraphQL doesn't actually filter forks, so the phrasing
  was misleading.
2026-04-18 22:43:14 +07:00
tiennm99 514195c921 feat: flip include-forks / include-private defaults to true
Most users reach for ghstats to show their real activity. Making the
two visibility toggles opt-out rather than opt-in gives accurate stats
out of the box.

- -include-forks        false → true
- -include-private      false → true
- include_forks input   false → true
- include_private input false → true

Private-repo data silently no-ops when the token lacks repo scope, so
the default is safe for default github.token runs — it just won't
surface more than read:user already allows. Users who want the old
public-only behavior pass -include-private=false or set the Action
input to "false".
2026-04-18 22:20:46 +07:00
tiennm99 e348c7c381 refactor(card): drop numeric prefix from output filenames
Files now land at output/<theme>/profile-details.svg etc., without
leading 0-8 prefixes. README authors embed cards by name, so the
lexicographic-sort rationale for the prefix no longer applies.

- All Filename() methods + the allCards ordering comment updated.
- Tests updated to expect the 9 unnumbered filenames.
- README, deployment-guide, codebase-summary, roadmap references
  refreshed.
- Dracula sample SVGs regenerated under new names.
2026-04-18 22:20:09 +07:00
tiennm99 c211ecd6a4 docs: add project documentation set
Seven canonical docs under docs/ per the project structure convention:

- project-overview-pdr.md   users, non-goals, requirements
- codebase-summary.md       directory layout, module responsibilities
- system-architecture.md    runtime phases, GraphQL flow, SVG primitives
- code-standards.md         YAGNI/KISS/DRY, Go conventions, commit rules
- design-guidelines.md      frame dimensions, theme roles, per-card specs
- deployment-guide.md       Action/binary/Docker paths, release process
- project-roadmap.md        done phases (0-5), planned phases (6-9)

All files under the 800-line cap. Each leans on tables; grammar
sacrificed for concision per project rules.
2026-04-18 22:10:09 +07:00
tiennm99 c821999921 docs(readme): refresh for 9-card layout, seed sampling, visibility flags 2026-04-18 22:10:00 +07:00
tiennm99 075b09c9bb build: refresh dracula sample cards 2026-04-18 22:01:31 +07:00
tiennm99 90171c1080 feat: seed-based repo scanning + fork/private visibility flags
Replace the top-10-starred sampling with a seed list built from
contributionsCollection.commitContributionsByRepository, unioned across
every active contributionYear. Commit-history probes now land only on
repos where the user actually committed, covering all owned repos plus
forks and repos owned by others when allowed.

New visibility knobs (default off — public-facing READMEs stay
safe):
- -include-forks / include_forks    : include forked repos
- -include-private / include_private: include private repos (requires
                                      PAT with repo scope)

Compatibility:
- -top-repos default changed 10 → 0 (unlimited); still usable as a cap
  for fast local runs.
- commitHistoryQuery now takes $owner so probes can target forks or
  repos outside the user's ownership.
- FetchProfile now accepts FetchOptions; PublicRepos counts only repos
  that pass the visibility filter.

Seed-list approach mirrors github-profile-summary-cards' own repo
sourcing but keeps our byte-weighted commit attribution.
2026-04-18 22:01:26 +07:00
tiennm99 2e2e897513 build: refresh dracula sample cards 2026-04-18 21:40:50 +07:00
tiennm99 208629cf8f feat: add all-time variants of productive, language, contribution cards
Four time-bounded cards ("last year") now have all-time counterparts, and
the stats card gains a lifetime commits row.

New cards:
- 6-most-commit-language-all-time.svg (byte-weighted, all lifetime commits)
- 7-productive-time-all-time.svg       (hour histogram over all lifetime commits)
- 8-contributions-all-time.svg         (area chart spanning every active year)

Data pipeline:
- Drop the "since" filter from commitHistoryQuery; FetchProductive now
  paginates unbounded commits and splits each commit into last-year and
  all-time buckets in a single pass — no extra API calls.
- New contributionYearQuery iterates user.contributionYears to
  concatenate calendar data and accumulate TotalCommitsAllTime.
- -commits-per-repo default bumped 100 → 500 to give all-time depth.

Polish:
- Productive-time title embeds the configured tz as "UTC±N.NN" (e.g.
  UTC+7.00) on both last-year and all-time cards.
- Contribution x-axis flipped to mm/yy with an "mm/yy" footer caption
  paralleling productive-time's "hour of day".
- Contribution x-axis label stride now targets ~6 labels regardless of
  bucket count so the all-time chart (~100 months) stays readable while
  the underlying curve still samples every month.
2026-04-18 21:40:46 +07:00
tiennm99 01e97627f5 build: track dracula sample cards for README previews
Narrow the output/ gitignore so output/dracula/*.svg ships with the
repo — these are the preview images rendered into the README.
Other themes stay ignored; rebuild them locally as needed.
2026-04-18 21:21:00 +07:00
tiennm99 d0d3862780 feat(card): add contributions area chart card
New 5-contributions.svg renders the last year's contribution calendar
as a monthly smooth-filled area chart. Pure Go SVG; no extra API calls
— one additional contributionCalendar.weeks block in the existing
profile GraphQL query carries the data.

- Y-axis mirrored on both sides with nice ticks.
- X-axis labels in YY/MM format, every other month to avoid overlap.
- Smooth curve via Catmull-Rom interpolation converted to cubic Bezier
  (d3.curveCatmullRom default tension 0.5).
- Missing months between first and last are inserted as zero-count so
  the chart stays time-continuous.
2026-04-18 21:20:52 +07:00
tiennm99 442da96f99 refactor(card): add octicon labels to stats card
Replace the 2x3 grid with one row per stat: icon + label + right-aligned
value. Icons (star, commit, PR, issue, code-review, repos) mirror the
Octicons used by github-profile-summary-cards' stats card.
2026-04-18 21:09:46 +07:00
tiennm99 a12a331b57 build: enable gopls-lsp plugin via claude settings 2026-04-18 20:50:17 +07:00
tiennm99 9ac029dfae refactor(github): attribute commits by repo language byte share
Each commit now contributes a full "vote" partitioned across the repo's
languages proportional to linguist byte counts, instead of crediting only
the primary language. A 60% Go / 40% Python repo adds 0.6 to Go and 0.4
to Python per commit.

- RepoInfo gains []LangEdge capturing the full byte breakdown already
  returned by profileQuery.
- FetchProductive distributes each commit via a fixed-point scaleFactor
  (int64 preserved, percentages unchanged in the card).
- Fallback to primary language only when linguist reports zero bytes
  (empty repo).

Caveat: linguist excludes prose languages (Markdown, AsciiDoc, reST) from
its byte output, so Markdown-heavy repos still skew toward the detected
code fraction. Fixing that case requires per-commit file classification
via REST /commits/{sha} + go-enry — tracked as future work.
2026-04-18 20:50:04 +07:00
tiennm99 4d3dbe875e refactor(card): redesign profile details with octicon labels
- Title becomes "login (Name)" (or just "login") instead of
  "Name's Profile Details".
- Row labels replaced with Octicon glyphs (repos, company, location,
  link, clock, people) rendered in the theme's muted color.
- Joined and account-age rows merge into a single "YYYY-MM-DD (N years
  ago)" line; years round down to whole years with month/day fallbacks.
- Drop profile-summary-for-github from README credits — no code from
  that project is used. github-profile-summary-cards is the only direct
  reference.
2026-04-18 19:43:32 +07:00
tiennm99 ffc76ebc21 refactor(theme): port full github-profile-summary-cards palette
- Replace the previous 30-theme list with the complete 61-theme palette
  from github-profile-summary-cards (snake_case ids, e.g. github_dark,
  nord_bright, solarized_dark).
- Add Stroke and StrokeOpacity fields to Theme; card frame now uses the
  theme's own stroke instead of a hardcoded white overlay so light themes
  render a visible border.
- Drop the github-readme-stats credit from README; all palette data now
  comes from one upstream source.
2026-04-18 19:13:17 +07:00
tiennm99 cb502f2aa2 refactor: match github-profile-summary-cards chart styles
- Productive time is now a 24-hour bar chart with axes and nice tick labels
  instead of a 7x24 heatmap. Model Productive field reshaped from
  [7][24]int to [24]int.
- Language cards render as donut charts with a left-side legend instead of
  a stacked bar. Slices beyond top-6 collapse into an "Other" row.
- Add niceTicks helper (1/2/5 * 10^k ladder, d3-style) for axis ticks.
- Legacy language_bar.go removed.
2026-04-18 19:08:12 +07:00
tiennm99 40c311d304 refactor: split language card into repos-per-language and most-commit-language
Align card set with github-profile-summary-cards' 5-card layout:

  0-profile-details.svg       (unchanged)
  1-repos-per-language.svg    (new) owned repos grouped by primary language
  2-most-commit-language.svg  (new) last-year commits attributed to each repo's primary language
  3-stats.svg                 (renumbered)
  4-productive-time.svg       (renumbered)

- FetchProductive now fills p.CommitsByLanguage from the same commit history
  it uses for the heatmap, so no extra API calls are introduced.
- TopRepos carries primary language so productive-time can aggregate by lang.
- LangStat.Bytes renamed to Value (repo count or commit count, context-dependent).
- Shared bar+legend renderer extracted to language_bar.go.
- Ignore generated output/ directory.
2026-04-18 18:57:42 +07:00
tiennm99 643a15862b feat: implement profile summary cards with GraphQL fetch and Action wrapper
- Add GraphQL client fetching profile, stats, language aggregation, and
  per-repo commit histograms for the productive-time heatmap.
- Render real SVG cards (profile details, top languages, stats grid,
  weekday×hour heatmap) with XML escaping and thousands-formatted numbers.
- Expand theme palette to 30 built-ins ported from github-readme-stats;
  add -list-themes, multi-theme rendering, and 'all' shortcut.
- Package as Docker-based GitHub Action (action.yml, Dockerfile,
  entrypoint.sh) with optional auto-commit of generated cards.
- Release workflow publishes GHCR image and cross-platform binaries on
  v* tags.
- Unit tests cover rendering, XML escape, number formatting, language sort.
2026-04-18 18:39:51 +07:00
tiennm99 d92ef7e324 feat: scaffold ghstats — Go CLI for GitHub profile SVG cards 2026-04-18 18:22:20 +07:00
tiennm99andGitHub 5597226073 Initial commit 2026-04-18 18:18:23 +07:00