cy0307 commited on
Commit
75874df
·
verified ·
1 Parent(s): baa1156

Refine star history visualization

Browse files
.github/workflows/quality.yml CHANGED
@@ -74,6 +74,9 @@ jobs:
74
  - name: Check generated brand assets
75
  run: python scripts/build_brand_assets.py --check
76
 
 
 
 
77
  - name: Check arXiv publication decisions
78
  run: python scripts/resolve_arxiv_publications.py --check
79
 
 
74
  - name: Check generated brand assets
75
  run: python scripts/build_brand_assets.py --check
76
 
77
+ - name: Check generated star-history assets
78
+ run: python scripts/build_star_history.py --check
79
+
80
  - name: Check arXiv publication decisions
81
  run: python scripts/resolve_arxiv_publications.py --check
82
 
.github/workflows/star-history.yml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Star history
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "43 2 * * *"
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ concurrency:
12
+ group: star-history-main
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ refresh:
17
+ name: Refresh star-growth chart
18
+ runs-on: ubuntu-latest
19
+ env:
20
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
21
+ steps:
22
+ - name: Check out repository
23
+ uses: actions/checkout@v4
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.x"
29
+
30
+ - name: Build charts from the current GitHub star count
31
+ env:
32
+ GITHUB_TOKEN: ${{ github.token }}
33
+ run: python scripts/build_star_history.py --snapshot
34
+
35
+ - name: Commit an updated history
36
+ run: |
37
+ CHART_FILES=(
38
+ assets/star-history.svg
39
+ assets/star-history-dark.svg
40
+ assets/star-history-mobile.svg
41
+ assets/star-history-mobile-dark.svg
42
+ docs/assets/star-history.svg
43
+ docs/assets/star-history-dark.svg
44
+ docs/assets/star-history-mobile.svg
45
+ docs/assets/star-history-mobile-dark.svg
46
+ data/star-history.json
47
+ )
48
+ if git diff --quiet -- "${CHART_FILES[@]}"; then
49
+ echo "Star history is already current."
50
+ exit 0
51
+ fi
52
+ git config user.name "ChaoYue0307"
53
+ git config user.email "hechaoyue0307@gmail.com"
54
+ git add "${CHART_FILES[@]}"
55
+ git commit -m "Refresh star history"
56
+ git push
assets/README.md CHANGED
@@ -18,6 +18,7 @@ Find the logos, diagrams, editorial cover, social previews, and generated brand
18
  - `loop-lifecycle-mobile.png` - Mobile rendering of the lifecycle with a readable vertical decision path.
19
  - `loop-runtime-map.png` - ChatGPT Image-generated runtime map from a nearby session through desktop, CI/cloud, and durable-worker execution.
20
  - `loop-maturity-model.png` - ChatGPT Image-generated seven-level maturity path from manual prompting to production-supervised loops.
 
21
  - `social-preview.png` - Canonical 1280x640 sharing card for `og:image`, social posts, and GitHub's social preview. After regenerating it, re-upload under repo Settings -> Social preview and publish a newly named Pages copy referenced by `docs/index.html` and the versioned X share page.
22
 
23
  Please keep assets lightweight and directly useful for repository presentation. Avoid adding screenshots or large generated files unless they improve the README or documentation experience.
 
18
  - `loop-lifecycle-mobile.png` - Mobile rendering of the lifecycle with a readable vertical decision path.
19
  - `loop-runtime-map.png` - ChatGPT Image-generated runtime map from a nearby session through desktop, CI/cloud, and durable-worker execution.
20
  - `loop-maturity-model.png` - ChatGPT Image-generated seven-level maturity path from manual prompting to production-supervised loops.
21
+ - `star-history.svg`, `star-history-dark.svg`, and the mobile variants - Responsive light and dark star-trail charts, refreshed from timestamped history and later repository-count snapshots.
22
  - `social-preview.png` - Canonical 1280x640 sharing card for `og:image`, social posts, and GitHub's social preview. After regenerating it, re-upload under repo Settings -> Social preview and publish a newly named Pages copy referenced by `docs/index.html` and the versioned X share page.
23
 
24
  Please keep assets lightweight and directly useful for repository presentation. Avoid adding screenshots or large generated files unless they improve the README or documentation experience.
assets/star-history-dark.svg ADDED
assets/star-history-mobile-dark.svg ADDED
assets/star-history-mobile.svg ADDED
assets/star-history.svg ADDED
data/README.md CHANGED
@@ -10,6 +10,7 @@ Download all 601 resources as deterministic tabular exports.
10
  - `resource_source_audit.csv` - Point-in-time source check for every row, including URL status, source title metadata, arXiv IDs, and GitHub repository stats where available.
11
  - `arxiv_publication_overrides.csv` - Human-verified conference, journal, and workshop records backed by official proceedings, DOI registries, OpenReview, or current author-supplied acceptance notes.
12
  - `arxiv_publication_audit.csv` - Complete decision table for every arXiv-linked resource: published, accepted, or preprint-only.
 
13
 
14
  The exports preserve each section and annotation while adding four discovery layers:
15
 
@@ -93,3 +94,14 @@ python3 scripts/build_hf_parquet.py --output /tmp/awesome-loop-engineering-hf/da
93
  ```
94
 
95
  The card is generated from `meta/hf_card_header.yaml`, `meta/hf_card_body.md`, the current dataset, and `CITATION.cff`. The Parquet shard is a lossless derivative of `data/resources.jsonl` and requires `pyarrow`. The YAML front matter is intentionally Hugging Face-only and must not be added to the GitHub README.
 
 
 
 
 
 
 
 
 
 
 
 
10
  - `resource_source_audit.csv` - Point-in-time source check for every row, including URL status, source title metadata, arXiv IDs, and GitHub repository stats where available.
11
  - `arxiv_publication_overrides.csv` - Human-verified conference, journal, and workshop records backed by official proceedings, DOI registries, OpenReview, or current author-supplied acceptance notes.
12
  - `arxiv_publication_audit.csv` - Complete decision table for every arXiv-linked resource: published, accepted, or preprint-only.
13
+ - `star-history.json` - Timestamp-only GitHub star history plus later repository-count snapshots, used to build the light, dark, desktop, and mobile growth charts without publishing account details.
14
 
15
  The exports preserve each section and annotation while adding four discovery layers:
16
 
 
94
  ```
95
 
96
  The card is generated from `meta/hf_card_header.yaml`, `meta/hf_card_body.md`, the current dataset, and `CITATION.cff`. The Parquet shard is a lossless derivative of `data/resources.jsonl` and requires `pyarrow`. The YAML front matter is intentionally Hugging Face-only and must not be added to the GitHub README.
97
+
98
+ Refresh the star-growth chart with the authenticated GitHub CLI, or regenerate it offline after changing the visual treatment:
99
+
100
+ ```sh
101
+ python3 scripts/build_star_history.py --gh-cli
102
+ python3 scripts/build_star_history.py --snapshot --gh-cli
103
+ python3 scripts/build_star_history.py --from-data
104
+ python3 scripts/build_star_history.py --check
105
+ ```
106
+
107
+ The daily Star History workflow reads the public repository star count and commits only when that count changes. Exact timestamps captured by the repository owner remain the chart's historical foundation; later points use count snapshots so automation does not require a personal access token.
data/resources.csv CHANGED
The diff for this file is too large to render. See raw diff
 
data/resources.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
data/resources.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f58ce5585120e05a2d87f3d36cf94e83d933df69bf51a295d9e587bd9f270d7f
3
- size 497218
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23ff1bc22d723a53c6956ad0d1dcd3077395eb3a363779201c97223356091905
3
+ size 497238
data/star-history.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": "ChaoYue0307/awesome-loop-engineering",
3
+ "source": "GitHub stargazer timestamps followed by repository star-count snapshots",
4
+ "total_stars": 36,
5
+ "first_starred_at": "2026-06-09T16:18:52Z",
6
+ "latest_starred_at": "2026-07-20T17:14:18Z",
7
+ "latest_observed_at": "2026-07-20T17:14:18Z",
8
+ "starred_at": [
9
+ "2026-06-09T16:18:52Z",
10
+ "2026-06-09T16:30:12Z",
11
+ "2026-06-09T16:32:12Z",
12
+ "2026-06-10T01:51:58Z",
13
+ "2026-06-10T02:25:00Z",
14
+ "2026-06-10T06:54:05Z",
15
+ "2026-06-17T07:46:13Z",
16
+ "2026-06-17T09:11:23Z",
17
+ "2026-06-20T13:43:46Z",
18
+ "2026-06-20T20:59:07Z",
19
+ "2026-06-21T00:32:43Z",
20
+ "2026-06-23T08:46:59Z",
21
+ "2026-06-24T16:17:50Z",
22
+ "2026-06-27T10:08:27Z",
23
+ "2026-06-29T06:00:58Z",
24
+ "2026-07-01T02:19:23Z",
25
+ "2026-07-01T03:15:41Z",
26
+ "2026-07-03T07:42:49Z",
27
+ "2026-07-07T08:44:59Z",
28
+ "2026-07-09T05:21:39Z",
29
+ "2026-07-09T13:26:50Z",
30
+ "2026-07-10T07:18:19Z",
31
+ "2026-07-15T09:04:18Z",
32
+ "2026-07-16T17:12:13Z",
33
+ "2026-07-17T00:50:37Z",
34
+ "2026-07-17T02:05:17Z",
35
+ "2026-07-17T06:59:59Z",
36
+ "2026-07-17T11:22:46Z",
37
+ "2026-07-18T02:36:12Z",
38
+ "2026-07-18T04:04:18Z",
39
+ "2026-07-18T04:30:48Z",
40
+ "2026-07-18T21:06:14Z",
41
+ "2026-07-19T12:50:19Z",
42
+ "2026-07-20T00:27:37Z",
43
+ "2026-07-20T08:06:18Z",
44
+ "2026-07-20T17:14:18Z"
45
+ ],
46
+ "count_snapshots": []
47
+ }
docs/assets/star-history-dark.svg ADDED
docs/assets/star-history-mobile-dark.svg ADDED
docs/assets/star-history-mobile.svg ADDED
docs/assets/star-history.svg ADDED
docs/index.html CHANGED
@@ -717,6 +717,24 @@
717
  }
718
  .future-shared strong { font-size: 0.92rem; }
719
  .future-shared p { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720
  code {
721
  border: 1px solid var(--line);
722
  border-radius: 4px;
@@ -961,6 +979,7 @@
961
  .future-step:nth-child(2n+1) { border-left: 0; padding-left: 0; }
962
  .future-step:nth-child(n+3) { border-top: 1px solid var(--line); }
963
  .future-shared { grid-template-columns: 1fr; gap: 10px; align-items: start; }
 
964
  .maturity-guide { grid-template-columns: 150px minmax(0, 1fr); gap: 24px; }
965
  .level { grid-template-columns: 52px minmax(0, 1fr); gap: 16px; }
966
  .level .number { grid-row: 1 / 3; }
@@ -1200,6 +1219,7 @@
1200
  .future-steps { grid-template-columns: 1fr; }
1201
  .future-step:nth-child(n) { border-top: 1px solid var(--line); border-left: 0; padding: 15px 0; }
1202
  .future-step:first-child { border-top: 0; }
 
1203
  .resource-toolbar { grid-template-columns: 1fr; }
1204
  .resource-toolbar label:first-child { grid-column: auto; }
1205
  .resource-select { padding-inline: 10px; font-size: 0.86rem; }
@@ -1276,7 +1296,7 @@
1276
  "description": "A practical field guide and implementation kit for recurring, stateful, verified AI-agent systems.",
1277
  "keywords": ["Loop Engineering", "AI agents", "Coding agents", "Agent workflows", "Agentic loops"],
1278
  "datePublished": "2026-06-10",
1279
- "dateModified": "2026-07-20",
1280
  "sameAs": [
1281
  "https://github.com/ChaoYue0307/awesome-loop-engineering",
1282
  "https://huggingface.co/datasets/cy0307/awesome-loop-engineering"
@@ -1990,6 +2010,28 @@
1990
  </details>
1991
  </div>
1992
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1993
  </main>
1994
 
1995
  <footer>
 
717
  }
718
  .future-shared strong { font-size: 0.92rem; }
719
  .future-shared p { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
720
+ .star-history-chart {
721
+ display: block;
722
+ width: 100%;
723
+ color: inherit;
724
+ line-height: 0;
725
+ text-decoration: none;
726
+ }
727
+ .star-history-chart img { display: block; width: 100%; height: auto; }
728
+ .growth-note {
729
+ display: flex;
730
+ align-items: center;
731
+ justify-content: space-between;
732
+ gap: 24px;
733
+ border-bottom: 1px solid var(--line-strong);
734
+ padding: 20px 0;
735
+ }
736
+ .growth-note p { max-width: 760px; margin: 0; color: var(--muted); font-size: 0.88rem; }
737
+ .growth-note .button { flex: 0 0 auto; }
738
  code {
739
  border: 1px solid var(--line);
740
  border-radius: 4px;
 
979
  .future-step:nth-child(2n+1) { border-left: 0; padding-left: 0; }
980
  .future-step:nth-child(n+3) { border-top: 1px solid var(--line); }
981
  .future-shared { grid-template-columns: 1fr; gap: 10px; align-items: start; }
982
+ .growth-note { align-items: flex-start; flex-direction: column; gap: 14px; }
983
  .maturity-guide { grid-template-columns: 150px minmax(0, 1fr); gap: 24px; }
984
  .level { grid-template-columns: 52px minmax(0, 1fr); gap: 16px; }
985
  .level .number { grid-row: 1 / 3; }
 
1219
  .future-steps { grid-template-columns: 1fr; }
1220
  .future-step:nth-child(n) { border-top: 1px solid var(--line); border-left: 0; padding: 15px 0; }
1221
  .future-step:first-child { border-top: 0; }
1222
+ .growth-note .button { width: 100%; }
1223
  .resource-toolbar { grid-template-columns: 1fr; }
1224
  .resource-toolbar label:first-child { grid-column: auto; }
1225
  .resource-select { padding-inline: 10px; font-size: 0.86rem; }
 
1296
  "description": "A practical field guide and implementation kit for recurring, stateful, verified AI-agent systems.",
1297
  "keywords": ["Loop Engineering", "AI agents", "Coding agents", "Agent workflows", "Agentic loops"],
1298
  "datePublished": "2026-06-10",
1299
+ "dateModified": "2026-07-21",
1300
  "sameAs": [
1301
  "https://github.com/ChaoYue0307/awesome-loop-engineering",
1302
  "https://huggingface.co/datasets/cy0307/awesome-loop-engineering"
 
2010
  </details>
2011
  </div>
2012
  </section>
2013
+
2014
+ <section id="growth">
2015
+ <div class="wrap">
2016
+ <div class="section-head">
2017
+ <div>
2018
+ <p class="section-label"><i class="icon" data-lucide="chart-no-axes-combined" aria-hidden="true"></i><span>10 / Community momentum</span></p>
2019
+ <h2>Follow the star trail.</h2>
2020
+ </div>
2021
+ <p class="section-intro">Each milestone marks more researchers and builders discovering the field guide, from the first save to the latest GitHub count.</p>
2022
+ </div>
2023
+ <a class="star-history-chart" href="https://github.com/ChaoYue0307/awesome-loop-engineering" aria-label="Open Awesome Loop Engineering on GitHub">
2024
+ <picture>
2025
+ <source media="(max-width: 560px)" srcset="assets/star-history-mobile.svg">
2026
+ <img src="assets/star-history.svg" alt="GitHub star growth for Awesome Loop Engineering" width="1200" height="560" loading="lazy">
2027
+ </picture>
2028
+ </a>
2029
+ <div class="growth-note">
2030
+ <p>Star the repository to keep the field guide nearby and help more researchers, engineers, and developers find its resources and implementation kit.</p>
2031
+ <a class="button primary" href="https://github.com/ChaoYue0307/awesome-loop-engineering"><i class="icon" data-lucide="sparkles" aria-hidden="true"></i>Star on GitHub</a>
2032
+ </div>
2033
+ </div>
2034
+ </section>
2035
  </main>
2036
 
2037
  <footer>
docs/sitemap.xml CHANGED
@@ -2,7 +2,7 @@
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
  <url>
4
  <loc>https://chaoyue0307.github.io/awesome-loop-engineering/</loc>
5
- <lastmod>2026-07-18</lastmod>
6
  <changefreq>weekly</changefreq>
7
  <priority>1.0</priority>
8
  </url>
 
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
  <url>
4
  <loc>https://chaoyue0307.github.io/awesome-loop-engineering/</loc>
5
+ <lastmod>2026-07-21</lastmod>
6
  <changefreq>weekly</changefreq>
7
  <priority>1.0</priority>
8
  </url>
scripts/build_star_history.py ADDED
@@ -0,0 +1,553 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Fetch GitHub stargazer timestamps and build branded star-history charts."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import json
8
+ import math
9
+ import os
10
+ import subprocess
11
+ import urllib.error
12
+ import urllib.request
13
+ from dataclasses import dataclass
14
+ from datetime import datetime, timedelta, timezone
15
+ from pathlib import Path
16
+ from typing import Optional
17
+ from xml.sax.saxutils import escape
18
+
19
+
20
+ ROOT = Path(__file__).resolve().parents[1]
21
+ DEFAULT_REPOSITORY = "ChaoYue0307/awesome-loop-engineering"
22
+ DATA_PATH = ROOT / "data" / "star-history.json"
23
+ OUTPUT_PATHS = {
24
+ "light": (
25
+ ROOT / "assets" / "star-history.svg",
26
+ ROOT / "docs" / "assets" / "star-history.svg",
27
+ ),
28
+ "dark": (
29
+ ROOT / "assets" / "star-history-dark.svg",
30
+ ROOT / "docs" / "assets" / "star-history-dark.svg",
31
+ ),
32
+ "light-mobile": (
33
+ ROOT / "assets" / "star-history-mobile.svg",
34
+ ROOT / "docs" / "assets" / "star-history-mobile.svg",
35
+ ),
36
+ "dark-mobile": (
37
+ ROOT / "assets" / "star-history-mobile-dark.svg",
38
+ ROOT / "docs" / "assets" / "star-history-mobile-dark.svg",
39
+ ),
40
+ }
41
+
42
+
43
+ @dataclass(frozen=True)
44
+ class Theme:
45
+ background: str
46
+ border: str
47
+ grid: str
48
+ text: str
49
+ muted: str
50
+ line: str
51
+ area: str
52
+ point: str
53
+ badge: str
54
+ brand: str
55
+ shadow: str
56
+
57
+
58
+ THEMES = {
59
+ "light": Theme(
60
+ background="#FFFDFC",
61
+ border="#DCE2ED",
62
+ grid="#D9E0EB",
63
+ text="#172033",
64
+ muted="#647089",
65
+ line="#F25F5C",
66
+ area="#FDE3E1",
67
+ point="#F5BE3D",
68
+ badge="#FFFFFF",
69
+ brand="#2457D6",
70
+ shadow="#E9EDF5",
71
+ ),
72
+ "dark": Theme(
73
+ background="#111827",
74
+ border="#344158",
75
+ grid="#354158",
76
+ text="#F8FAFC",
77
+ muted="#AAB6CA",
78
+ line="#FF8582",
79
+ area="#572F38",
80
+ point="#FFD166",
81
+ badge="#172033",
82
+ brand="#73A7FF",
83
+ shadow="#0B1220",
84
+ ),
85
+ }
86
+
87
+
88
+ def parse_args() -> argparse.Namespace:
89
+ parser = argparse.ArgumentParser(description=__doc__)
90
+ parser.add_argument(
91
+ "--repo",
92
+ default=os.environ.get("GITHUB_REPOSITORY", DEFAULT_REPOSITORY),
93
+ help="GitHub repository in owner/name form.",
94
+ )
95
+ parser.add_argument(
96
+ "--gh-cli",
97
+ action="store_true",
98
+ help="Fetch through the authenticated GitHub CLI instead of Python's REST client.",
99
+ )
100
+ parser.add_argument(
101
+ "--check",
102
+ action="store_true",
103
+ help="Verify committed charts against committed timestamp data without network access.",
104
+ )
105
+ parser.add_argument(
106
+ "--from-data",
107
+ action="store_true",
108
+ help="Regenerate charts from committed timestamp data without network access.",
109
+ )
110
+ parser.add_argument(
111
+ "--snapshot",
112
+ action="store_true",
113
+ help="Append the public repository star count when it differs from the latest observation.",
114
+ )
115
+ return parser.parse_args()
116
+
117
+
118
+ def parse_timestamp(value: str) -> datetime:
119
+ parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))
120
+ if parsed.tzinfo is None:
121
+ parsed = parsed.replace(tzinfo=timezone.utc)
122
+ return parsed.astimezone(timezone.utc)
123
+
124
+
125
+ def format_timestamp(value: datetime) -> str:
126
+ return value.astimezone(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
127
+
128
+
129
+ def normalize_timestamps(values: list[str]) -> list[str]:
130
+ return [format_timestamp(value) for value in sorted(parse_timestamp(item) for item in values)]
131
+
132
+
133
+ def fetch_with_gh(repository: str) -> list[str]:
134
+ command = [
135
+ "gh",
136
+ "api",
137
+ "--paginate",
138
+ "-H",
139
+ "Accept: application/vnd.github.star+json",
140
+ f"repos/{repository}/stargazers",
141
+ "--jq",
142
+ ".[].starred_at",
143
+ ]
144
+ result = subprocess.run(command, check=True, capture_output=True, text=True)
145
+ return normalize_timestamps([line for line in result.stdout.splitlines() if line.strip()])
146
+
147
+
148
+ def fetch_with_api(repository: str, token: str) -> list[str]:
149
+ timestamps: list[str] = []
150
+ page = 1
151
+ while True:
152
+ url = f"https://api.github.com/repos/{repository}/stargazers?per_page=100&page={page}"
153
+ request = urllib.request.Request(
154
+ url,
155
+ headers={
156
+ "Accept": "application/vnd.github.star+json",
157
+ "Authorization": f"Bearer {token}",
158
+ "User-Agent": "awesome-loop-engineering-star-history",
159
+ "X-GitHub-Api-Version": "2022-11-28",
160
+ },
161
+ )
162
+ try:
163
+ with urllib.request.urlopen(request, timeout=30) as response:
164
+ items = json.load(response)
165
+ except urllib.error.HTTPError as error:
166
+ detail = error.read().decode("utf-8", errors="replace")
167
+ raise RuntimeError(f"GitHub API returned {error.code}: {detail}") from error
168
+
169
+ if not isinstance(items, list):
170
+ raise RuntimeError("GitHub stargazer response was not a list")
171
+ timestamps.extend(str(item["starred_at"]) for item in items if item.get("starred_at"))
172
+ if len(items) < 100:
173
+ break
174
+ page += 1
175
+
176
+ return normalize_timestamps(timestamps)
177
+
178
+
179
+ def fetch_repository_star_count(repository: str, token: Optional[str]) -> int:
180
+ url = f"https://api.github.com/repos/{repository}"
181
+ headers = {
182
+ "Accept": "application/vnd.github+json",
183
+ "User-Agent": "awesome-loop-engineering-star-history",
184
+ "X-GitHub-Api-Version": "2022-11-28",
185
+ }
186
+ if token:
187
+ headers["Authorization"] = f"Bearer {token}"
188
+ request = urllib.request.Request(url, headers=headers)
189
+ try:
190
+ with urllib.request.urlopen(request, timeout=30) as response:
191
+ payload = json.load(response)
192
+ except urllib.error.HTTPError as error:
193
+ detail = error.read().decode("utf-8", errors="replace")
194
+ raise RuntimeError(f"GitHub repository API returned {error.code}: {detail}") from error
195
+
196
+ count = payload.get("stargazers_count") if isinstance(payload, dict) else None
197
+ if not isinstance(count, int) or count < 0:
198
+ raise RuntimeError("GitHub repository response did not include a valid stargazers_count")
199
+ return count
200
+
201
+
202
+ def fetch_repository_star_count_with_gh(repository: str) -> int:
203
+ command = ["gh", "api", f"repos/{repository}", "--jq", ".stargazers_count"]
204
+ result = subprocess.run(command, check=True, capture_output=True, text=True)
205
+ try:
206
+ count = int(result.stdout.strip())
207
+ except ValueError as error:
208
+ raise RuntimeError("GitHub CLI did not return a valid stargazers_count") from error
209
+ if count < 0:
210
+ raise RuntimeError("GitHub CLI returned a negative stargazers_count")
211
+ return count
212
+
213
+
214
+ def normalize_snapshots(values: list[object], after: Optional[datetime] = None) -> list[dict[str, object]]:
215
+ snapshots: list[dict[str, object]] = []
216
+ for value in values:
217
+ if not isinstance(value, dict):
218
+ raise ValueError("Star-count snapshots must be objects")
219
+ observed_at = parse_timestamp(str(value.get("observed_at", "")))
220
+ stars = value.get("stars")
221
+ if not isinstance(stars, int) or stars < 0:
222
+ raise ValueError("Star-count snapshots require a non-negative integer stars value")
223
+ if after is not None and observed_at <= after:
224
+ continue
225
+ snapshots.append({"observed_at": format_timestamp(observed_at), "stars": stars})
226
+ return sorted(snapshots, key=lambda item: str(item["observed_at"]))
227
+
228
+
229
+ def canonical_payload(payload: dict[str, object]) -> dict[str, object]:
230
+ repository = str(payload.get("repository", DEFAULT_REPOSITORY))
231
+ normalized = normalize_timestamps([str(value) for value in payload.get("starred_at", [])])
232
+ latest_exact = parse_timestamp(normalized[-1]) if normalized else None
233
+ snapshots = normalize_snapshots(list(payload.get("count_snapshots", [])), after=latest_exact)
234
+ latest_total = int(snapshots[-1]["stars"]) if snapshots else len(normalized)
235
+ latest_observed = str(snapshots[-1]["observed_at"]) if snapshots else (normalized[-1] if normalized else None)
236
+ return {
237
+ "repository": repository,
238
+ "source": "GitHub stargazer timestamps followed by repository star-count snapshots",
239
+ "total_stars": latest_total,
240
+ "first_starred_at": normalized[0] if normalized else None,
241
+ "latest_starred_at": normalized[-1] if normalized else None,
242
+ "latest_observed_at": latest_observed,
243
+ "starred_at": normalized,
244
+ "count_snapshots": snapshots,
245
+ }
246
+
247
+
248
+ def source_payload(repository: str, timestamps: list[str]) -> dict[str, object]:
249
+ return canonical_payload(
250
+ {
251
+ "repository": repository,
252
+ "starred_at": timestamps,
253
+ "count_snapshots": [],
254
+ }
255
+ )
256
+
257
+
258
+ def snapshot_payload(payload: dict[str, object], stars: int, observed_at: datetime) -> dict[str, object]:
259
+ canonical = canonical_payload(payload)
260
+ if stars == canonical["total_stars"]:
261
+ return canonical
262
+ snapshots = list(canonical["count_snapshots"])
263
+ snapshots.append({"observed_at": format_timestamp(observed_at), "stars": stars})
264
+ canonical["count_snapshots"] = snapshots
265
+ return canonical_payload(canonical)
266
+
267
+
268
+ def history_points(payload: dict[str, object]) -> list[tuple[datetime, int]]:
269
+ canonical = canonical_payload(payload)
270
+ points = [
271
+ (parse_timestamp(str(value)), count)
272
+ for count, value in enumerate(canonical["starred_at"], start=1)
273
+ ]
274
+ points.extend(
275
+ (parse_timestamp(str(item["observed_at"])), int(item["stars"]))
276
+ for item in canonical["count_snapshots"]
277
+ )
278
+ return sorted(points, key=lambda point: point[0])
279
+
280
+
281
+ def serialize_payload(payload: dict[str, object]) -> bytes:
282
+ return (json.dumps(payload, indent=2, ensure_ascii=True) + "\n").encode("utf-8")
283
+
284
+
285
+ def nice_step(value: int) -> int:
286
+ if value <= 4:
287
+ return 1
288
+ rough = value / 4
289
+ magnitude = 10 ** math.floor(math.log10(rough))
290
+ normalized = rough / magnitude
291
+ for candidate in (1, 2, 5, 10):
292
+ if normalized <= candidate:
293
+ return max(1, int(candidate * magnitude))
294
+ return max(1, int(10 * magnitude))
295
+
296
+
297
+ def date_label(value: datetime, include_year: bool = False) -> str:
298
+ label = f"{value.strftime('%b')} {value.day}"
299
+ return f"{label}, {value.year}" if include_year else label
300
+
301
+
302
+ def fmt(value: float) -> str:
303
+ return f"{value:.2f}".rstrip("0").rstrip(".")
304
+
305
+
306
+ def star_path(cx: float, cy: float, outer: float, inner: float) -> str:
307
+ points: list[str] = []
308
+ for index in range(10):
309
+ radius = outer if index % 2 == 0 else inner
310
+ angle = -math.pi / 2 + index * math.pi / 5
311
+ x = cx + math.cos(angle) * radius
312
+ y = cy + math.sin(angle) * radius
313
+ command = "M" if index == 0 else "L"
314
+ points.append(f"{command} {fmt(x)} {fmt(y)}")
315
+ return " ".join(points) + " Z"
316
+
317
+
318
+ def chart_svg(repository: str, payload: dict[str, object], theme_name: str, compact: bool = False) -> bytes:
319
+ points = history_points(payload)
320
+ if not points:
321
+ raise ValueError("At least one star-history observation is required")
322
+
323
+ theme = THEMES[theme_name]
324
+ total = points[-1][1]
325
+ peak = max(point[1] for point in points)
326
+ first = points[0][0]
327
+ latest = points[-1][0]
328
+ start = first.replace(hour=0, minute=0, second=0, microsecond=0)
329
+ end = latest.replace(hour=23, minute=59, second=59, microsecond=0)
330
+ end = max(end, start + timedelta(days=1))
331
+ duration = (end - start).total_seconds()
332
+ history_days = (latest.date() - first.date()).days + 1
333
+
334
+ if compact:
335
+ width, height = 720, 680
336
+ frame_x, frame_y, frame_width, frame_height = 16, 16, 688, 648
337
+ header_x = 48
338
+ eyebrow_y, title_y = 62, 108
339
+ subtitle_y, subtitle_gap = 143, 27
340
+ eyebrow_size, title_size, subtitle_size = 17, 40, 20
341
+ meta_y = 211
342
+ plot_left, plot_right, plot_top, plot_bottom = 74, 670, 252, 535
343
+ y_label_x, x_label_y = 58, 570
344
+ axis_font, line_width = 17, 5
345
+ callout_width, callout_height, callout_font = 142, 40, 18
346
+ footer_line_y, footer_text_y, footer_range_y = 603, 630, 653
347
+ footer_left, footer_right, footer_font = 48, 672, 16
348
+ x_tick_count = 3
349
+ else:
350
+ width, height = 1200, 560
351
+ frame_x, frame_y, frame_width, frame_height = 24, 24, 1152, 512
352
+ header_x = 78
353
+ eyebrow_y, title_y = 72, 113
354
+ subtitle_y, subtitle_gap = 143, 0
355
+ eyebrow_size, title_size, subtitle_size = 14, 34, 16
356
+ meta_y = 91
357
+ plot_left, plot_right, plot_top, plot_bottom = 102, 1122, 184, 442
358
+ y_label_x, x_label_y = 82, 474
359
+ axis_font, line_width = 13, 4
360
+ callout_width, callout_height, callout_font = 118, 34, 14
361
+ footer_line_y, footer_text_y, footer_range_y = 500, 525, 525
362
+ footer_left, footer_right, footer_font = 78, 1122, 13
363
+ x_tick_count = 5
364
+
365
+ plot_width = plot_right - plot_left
366
+ plot_height = plot_bottom - plot_top
367
+ y_step = nice_step(peak)
368
+ y_max = max(y_step, math.ceil(peak / y_step) * y_step)
369
+
370
+ def x_position(value: datetime) -> float:
371
+ ratio = (value - start).total_seconds() / duration
372
+ return plot_left + ratio * plot_width
373
+
374
+ def y_position(count: int) -> float:
375
+ return plot_bottom - (count / y_max) * plot_height
376
+
377
+ release_x = x_position(latest)
378
+ endpoint_y = y_position(total)
379
+ path_parts = [f"M {fmt(plot_left)} {fmt(y_position(0))}"]
380
+ event_points: list[tuple[float, float, int]] = []
381
+ for event, count in points:
382
+ x = x_position(event)
383
+ y = y_position(count)
384
+ path_parts.append(f"L {fmt(x)} {fmt(y)}")
385
+ event_points.append((x, y, count))
386
+ path_parts.append(f"L {fmt(plot_right)} {fmt(endpoint_y)}")
387
+ line_path = " ".join(path_parts)
388
+ area_path = f"{line_path} V {plot_bottom} H {plot_left} Z"
389
+
390
+ y_ticks = list(range(0, y_max + 1, y_step))
391
+ x_ticks = [start + (end - start) * (index / (x_tick_count - 1)) for index in range(x_tick_count)]
392
+ if endpoint_y - callout_height - 12 >= plot_top:
393
+ callout_y = endpoint_y - callout_height - 12
394
+ else:
395
+ callout_y = endpoint_y + 14
396
+ milestone_points = [
397
+ point for point in event_points
398
+ if point[2] == 1 or point[2] % 10 == 0 or point[2] == total
399
+ ]
400
+
401
+ title = f"GitHub star growth for {repository}"
402
+ description = (
403
+ f"GitHub star history from {date_label(first, True)} to "
404
+ f"{date_label(latest, True)}, ending at {total} stars."
405
+ )
406
+ rows: list[str] = [
407
+ f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" viewBox="0 0 {width} {height}" role="img" aria-labelledby="title desc">',
408
+ f" <title id=\"title\">{escape(title)}</title>",
409
+ f" <desc id=\"desc\">{escape(description)}</desc>",
410
+ " <style>",
411
+ " text { font-family: ui-rounded, 'SF Pro Rounded', 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 0; }",
412
+ " </style>",
413
+ " <defs>",
414
+ " <filter id=\"rough-line\" x=\"-3%\" y=\"-6%\" width=\"106%\" height=\"112%\">",
415
+ " <feTurbulence type=\"fractalNoise\" baseFrequency=\"0.008 0.12\" numOctaves=\"1\" seed=\"17\" result=\"noise\"/>",
416
+ " <feDisplacementMap in=\"SourceGraphic\" in2=\"noise\" scale=\"1.2\" xChannelSelector=\"R\" yChannelSelector=\"G\"/>",
417
+ " </filter>",
418
+ f' <clipPath id="plot-clip"><rect x="{plot_left - 3}" y="{plot_top - 5}" width="{plot_width + 6}" height="{plot_height + 10}"/></clipPath>',
419
+ " </defs>",
420
+ f' <rect x="{frame_x + 5}" y="{frame_y + 7}" width="{frame_width}" height="{frame_height}" rx="8" fill="{theme.shadow}" opacity="0.58"/>',
421
+ f' <rect x="{frame_x}" y="{frame_y}" width="{frame_width}" height="{frame_height}" rx="8" fill="{theme.background}" stroke="{theme.border}" stroke-width="2"/>',
422
+ f' <path d="{star_path(header_x + 7, eyebrow_y - 5, 8 if compact else 7, 3.5 if compact else 3)}" fill="{theme.point}" stroke="{theme.text}" stroke-width="1"/>',
423
+ f' <text x="{header_x + (24 if compact else 21)}" y="{eyebrow_y}" fill="{theme.brand}" font-size="{eyebrow_size}" font-weight="800">STAR HISTORY</text>',
424
+ f' <text x="{header_x}" y="{title_y}" fill="{theme.text}" font-size="{title_size}" font-weight="760">{total} stars and counting</text>',
425
+ ]
426
+
427
+ if compact:
428
+ rows.extend(
429
+ [
430
+ f' <text x="{header_x}" y="{subtitle_y}" fill="{theme.muted}" font-size="{subtitle_size}">Every star helps more builders discover</text>',
431
+ f' <text x="{header_x}" y="{subtitle_y + subtitle_gap}" fill="{theme.muted}" font-size="{subtitle_size}">loop engineering.</text>',
432
+ f' <text x="{header_x}" y="{meta_y}" fill="{theme.brand}" font-size="{eyebrow_size}" font-weight="700">{history_days} days of growth</text>',
433
+ f' <text x="{footer_right}" y="{meta_y}" fill="{theme.muted}" font-size="{eyebrow_size}" text-anchor="end">Updated {escape(date_label(latest))}</text>',
434
+ ]
435
+ )
436
+ else:
437
+ rows.extend(
438
+ [
439
+ f' <text x="{header_x}" y="{subtitle_y}" fill="{theme.muted}" font-size="{subtitle_size}">Every star helps more builders discover loop engineering.</text>',
440
+ f' <text x="{footer_right}" y="{meta_y}" fill="{theme.text}" font-size="28" font-weight="760" text-anchor="end">{history_days}</text>',
441
+ f' <text x="{footer_right}" y="{meta_y + 25}" fill="{theme.muted}" font-size="12" font-weight="750" text-anchor="end">DAYS OF GROWTH</text>',
442
+ ]
443
+ )
444
+
445
+ for tick in y_ticks:
446
+ y = y_position(tick)
447
+ rows.extend(
448
+ [
449
+ f' <line x1="{plot_left}" y1="{fmt(y)}" x2="{plot_right}" y2="{fmt(y)}" stroke="{theme.grid}" stroke-width="1" stroke-dasharray="3 9" stroke-linecap="round"/>',
450
+ f' <text x="{y_label_x}" y="{fmt(y + axis_font * 0.38)}" fill="{theme.muted}" font-size="{axis_font}" text-anchor="end">{tick}</text>',
451
+ ]
452
+ )
453
+
454
+ for index, tick in enumerate(x_ticks):
455
+ x = x_position(tick)
456
+ anchor = "start" if index == 0 else "end" if index == x_tick_count - 1 else "middle"
457
+ rows.append(
458
+ f' <text x="{fmt(x)}" y="{x_label_y}" fill="{theme.muted}" font-size="{axis_font}" text-anchor="{anchor}">{escape(date_label(tick))}</text>'
459
+ )
460
+
461
+ rows.extend(
462
+ [
463
+ ' <g clip-path="url(#plot-clip)">',
464
+ f' <path d="{area_path}" fill="{theme.area}" opacity="0.6"/>',
465
+ f' <path d="{line_path}" fill="none" stroke="{theme.line}" stroke-width="{line_width + 3}" stroke-linejoin="round" stroke-linecap="round" opacity="0.13" transform="translate(0 2)"/>',
466
+ f' <path d="{line_path}" fill="none" stroke="{theme.line}" stroke-width="{line_width}" stroke-linejoin="round" stroke-linecap="round" filter="url(#rough-line)"/>',
467
+ " </g>",
468
+ ]
469
+ )
470
+
471
+ for x, y, count in milestone_points:
472
+ outer = (12 if compact else 10) if count == total else (8 if compact else 6)
473
+ inner = outer * 0.46
474
+ rows.append(
475
+ f' <path d="{star_path(x, y, outer, inner)}" fill="{theme.point}" stroke="{theme.text}" stroke-width="{1.6 if count == total else 1}" stroke-linejoin="round"/>'
476
+ )
477
+
478
+ callout_gap = 28 if compact else 24
479
+ callout_x = min(plot_right - callout_width - 16, max(plot_left + 8, release_x - callout_width - callout_gap))
480
+ rows.extend(
481
+ [
482
+ f' <path d="M {fmt(callout_x + callout_width)} {fmt(callout_y + callout_height / 2)} L {fmt(release_x - (13 if compact else 11))} {fmt(endpoint_y)}" fill="none" stroke="{theme.line}" stroke-width="1.5" stroke-dasharray="3 5" stroke-linecap="round"/>',
483
+ f' <rect x="{fmt(callout_x)}" y="{fmt(callout_y)}" width="{callout_width}" height="{callout_height}" rx="8" fill="{theme.badge}" stroke="{theme.line}"/>',
484
+ f' <text x="{fmt(callout_x + callout_width / 2)}" y="{fmt(callout_y + callout_height * 0.68)}" fill="{theme.text}" font-size="{callout_font}" font-weight="700" text-anchor="middle">{total} stars</text>',
485
+ f' <line x1="{footer_left}" y1="{footer_line_y}" x2="{footer_right}" y2="{footer_line_y}" stroke="{theme.border}"/>',
486
+ f' <path d="{star_path(footer_left + 7, footer_text_y - 5, 6 if compact else 5, 2.7 if compact else 2.2)}" fill="{theme.point}" stroke="{theme.text}" stroke-width="0.8"/>',
487
+ f' <text x="{footer_left + 22}" y="{footer_text_y}" fill="{theme.muted}" font-size="{footer_font}">{escape(repository)}</text>',
488
+ f' <text x="{footer_right}" y="{footer_range_y}" fill="{theme.muted}" font-size="{footer_font}" text-anchor="end">{escape(date_label(first, True))} to {escape(date_label(latest, True))}</text>',
489
+ "</svg>",
490
+ "",
491
+ ]
492
+ )
493
+ return "\n".join(rows).encode("utf-8")
494
+
495
+
496
+ def expected_files(payload: dict[str, object]) -> dict[Path, bytes]:
497
+ canonical = canonical_payload(payload)
498
+ repository = str(canonical["repository"])
499
+ expected = {DATA_PATH: serialize_payload(canonical)}
500
+ for variant, paths in OUTPUT_PATHS.items():
501
+ theme_name = "dark" if variant.startswith("dark") else "light"
502
+ svg = chart_svg(repository, canonical, theme_name, compact=variant.endswith("mobile"))
503
+ for path in paths:
504
+ expected[path] = svg
505
+ return expected
506
+
507
+
508
+ def main() -> None:
509
+ args = parse_args()
510
+ if sum((args.check, args.from_data, args.snapshot)) > 1:
511
+ raise SystemExit("Choose only one of --check, --from-data, or --snapshot")
512
+
513
+ if args.check or args.from_data or args.snapshot:
514
+ if not DATA_PATH.exists():
515
+ raise SystemExit(f"Missing {DATA_PATH.relative_to(ROOT)}")
516
+ payload = json.loads(DATA_PATH.read_text(encoding="utf-8"))
517
+
518
+ if args.snapshot:
519
+ token = os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN")
520
+ if args.gh_cli:
521
+ star_count = fetch_repository_star_count_with_gh(args.repo)
522
+ else:
523
+ star_count = fetch_repository_star_count(args.repo, token)
524
+ payload = snapshot_payload(payload, star_count, datetime.now(timezone.utc))
525
+ elif not (args.check or args.from_data):
526
+ token = os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN")
527
+ if args.gh_cli or not token:
528
+ timestamps = fetch_with_gh(args.repo)
529
+ else:
530
+ timestamps = fetch_with_api(args.repo, token)
531
+ payload = source_payload(args.repo, timestamps)
532
+
533
+ expected = expected_files(payload)
534
+ stale: list[Path] = []
535
+ for path, content in expected.items():
536
+ if args.check:
537
+ if not path.exists() or path.read_bytes() != content:
538
+ stale.append(path)
539
+ continue
540
+ path.parent.mkdir(parents=True, exist_ok=True)
541
+ if not path.exists() or path.read_bytes() != content:
542
+ path.write_bytes(content)
543
+ print(f"wrote {path.relative_to(ROOT)}")
544
+
545
+ if stale:
546
+ formatted = "\n".join(f"- {path.relative_to(ROOT)}" for path in stale)
547
+ raise SystemExit(f"Star-history artifacts are stale; run scripts/build_star_history.py:\n{formatted}")
548
+ if args.check:
549
+ print(f"Star-history assets are current ({payload['total_stars']} stars).")
550
+
551
+
552
+ if __name__ == "__main__":
553
+ main()