📊 一键导出、分类、分析你的 GitHub Stars,生成可视化仪表板
- ✅ 一键导出 - 从 GitHub 导出所有 starred 项目
- ✅ 自动分类 - 按语言、用途、价值自动打标签
- ✅ 生成报告 - Markdown 列表 + JSON 分析数据
- ✅ 可视化仪表板 - HTML 图表展示
- ✅ 清理工具 - 识别并清理不活跃项目
# macOS
brew install gh
# Linux (Debian/Ubuntu)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install gh
# Linux (Arch)
sudo pacman -S github-cli
# Windows (winget)
winget install GitHub.cli# macOS
brew install python3
# Linux (通常已预装)
sudo apt install python3
# Windows
winget install Python.Python.3.12# 登录 GitHub CLI
gh auth login
# 验证登录状态
gh auth status登录时会询问:
- What account? → GitHub.com
- Preferred protocol? → HTTPS
- Authenticate? → Login with a web browser
# 克隆到本地
git clone https://github.com/你的用户名/github-stars-tools.git
cd github-stars-tools
# 添加执行权限
chmod +x export-stars.sh cleanup-stars.sh创建文件夹和脚本:
# 创建工作目录
mkdir -p github-stars && cd github-stars
# 下载脚本(示例,实际请从仓库获取)
curl -O https://raw.githubusercontent.com/你的用户名/github-stars-tools/main/export-stars.sh
curl -O https://raw.githubusercontent.com/你的用户名/github-stars-tools/main/tag-stars.py
curl -O https://raw.githubusercontent.com/你的用户名/github-stars-tools/main/cleanup-stars.sh
# 添加执行权限
chmod +x *.sh如果你使用 OpenClaw,可以直接说:
"帮我创建 GitHub Stars 分析工具"
# 导出当前用户的 stars
./export-stars.sh
# 导出指定用户的 stars
./export-stars.sh --user=torvalds
# 指定输出目录
./export-stars.sh --output=./my-stars
# 跳过仪表板生成
./export-stars.sh --skip-dashboard如果脚本无法运行,可以手动导出:
# 导出原始 JSON
gh api user/starred --paginate > github-stars-raw.json
# 导出简化列表
gh api user/starred --paginate -q '.[] | "\(.full_name)\t\(.stargazers_count)\t\(.language)"' > stars-list.tsv| 文件 | 说明 |
|---|---|
github-stars-raw.json |
原始导出数据(完整 JSON) |
github-stars.md |
Markdown 项目列表(按语言分组) |
github-stars-analysis.json |
分析报告数据 |
star-tags.json |
分类标签数据 |
github-stars-tagged.md |
分类标签文档 |
inactive-stars.json |
不活跃项目列表 |
# 查看项目总数
cat github-stars-analysis.json | jq '.meta.total'
# 查看语言分布
cat github-stars-analysis.json | jq '.by_language'
# 查看顶级项目
cat github-stars-analysis.json | jq '.top_tier.mega'
# 查看 Markdown 列表
cat github-stars.md | head -50如果你有 github-stars-dashboard.html 模板:
# 直接在浏览器打开
open github-stars-dashboard.html
# 或启动本地服务器
python3 -m http.server 8080
# 访问 http://localhost:8080/github-stars-dashboard.html如果没有模板,可以手动创建:
Step 1: 创建 HTML 文件
touch github-stars-dashboard.htmlStep 2: 添加基础结构
在 github-stars-dashboard.html 中添加:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub Stars 分析仪表板</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 20px; }
.container { max-width: 1400px; margin: 0 auto; }
header { text-align: center; color: white; padding: 20px 0 40px; }
.dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }
.card { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.1); }
.chart-container { position: relative; height: 300px; }
</style>
</head>
<body>
<div class="container">
<header>
<h1>📊 GitHub Stars 分析仪表板</h1>
<p id="stats-summary">加载中...</p>
</header>
<div class="dashboard">
<div class="card">
<h2>💻 语言分布</h2>
<div class="chart-container">
<canvas id="languageChart"></canvas>
</div>
</div>
<div class="card">
<h2>💎 价值分布</h2>
<div class="chart-container">
<canvas id="valueChart"></canvas>
</div>
</div>
</div>
</div>
<script>
// 在这里添加图表配置(见下文)
</script>
</body>
</html>Step 3: 添加图表脚本
在 <script> 标签内添加:
// 从 github-stars-analysis.json 获取数据
// 注意:需要在本地服务器环境下运行
// 语言分布饼图
const languageCtx = document.getElementById('languageChart').getContext('2d');
new Chart(languageCtx, {
type: 'pie',
data: {
labels: ['Python', 'TypeScript', 'Go', 'Rust', 'Others'],
datasets: [{
data: [47, 42, 9, 4, 53], // 替换为你的实际数据
backgroundColor: ['#3776AB', '#3178C6', '#00ADD8', '#DEA584', '#95A5A6']
}]
},
options: {
responsive: true,
maintainAspectRatio: false
}
});
// 价值分布环形图
const valueCtx = document.getElementById('valueChart').getContext('2d');
new Chart(valueCtx, {
type: 'doughnut',
data: {
labels: ['⭐ Mega (10万+)', '⭐ Hot (5-10万)', '💎 Gem', '常规项目'],
datasets: [{
data: [4, 7, 6, 138], // 替换为你的实际数据
backgroundColor: ['#F39C12', '#E74C3C', '#9B59B6', '#95A5A6']
}]
},
options: {
responsive: true,
maintainAspectRatio: false
}
});创建脚本自动从 JSON 更新 HTML:
# 使用 Python 更新仪表板数据
python3 << 'EOF'
import json
import re
# 读取分析数据
with open('github-stars-analysis.json', 'r') as f:
data = json.load(f)
# 读取 HTML
with open('github-stars-dashboard.html', 'r') as f:
html = f.read()
# 更新统计信息
total = data['meta']['total']
date = data['meta']['generated_at']
html = re.sub(
r'<p id="stats-summary">.*?</p>',
f'<p id="stats-summary">{total} 个项目 · 生成于 {date}</p>',
html
)
# 保存
with open('github-stars-dashboard.html', 'w') as f:
f.write(html)
print("✅ 仪表板数据已更新")
EOF编辑 tag-stars.py 添加你的分类规则:
# 打开编辑
vim tag-stars.py
# 或
code tag-stars.py找到 PROJECT_TAGS 字典,添加你的规则:
PROJECT_TAGS = {
# AI Agent 项目
"openclaw/openclaw": ["ai-agent", "⭐mega", "self-host"],
"cline/cline": ["ai-agent", "⭐hot"],
# 添加你的自定义分类
"your-username/your-repo": ["custom-tag", "lang:python"],
"another/repo": ["ai-video", "💎gem"],
# ...
}
# 添加自定义标签
TAG_SYSTEM = {
# 你的自定义标签
"custom-tag": "自定义标签说明",
"my-workflow": "我的工作流工具",
# ...
}保存后重新运行:
python3 tag-stars.pycat inactive-stars.json | jq ../cleanup-stars.sh脚本会提示:
- 📦 已归档项目(建议删除)
⚠️ 长期不活跃项目(可选删除)
| 图表 | 说明 |
|---|---|
| 🏷️ 分类分布 | 按项目类别分布(AI Agent、LLM/API 等) |
| 💻 语言分布 | 按编程语言分布 |
| 💎 价值分布 | Mega/Hot/Gem 项目占比 |
| 🏆 TOP 15 | Stars 排行榜 |
| 🤖 AI Agent | AI Agent 项目详情 |
| 📦 自托管 | 可自托管项目列表 |
| 💎 隐藏宝藏 | 低 Stars 高潜力项目 |
| 标签 | 说明 | 示例项目 |
|---|---|---|
ai-agent |
AI Agent / 自主代理 | openclaw, cline, OpenManus |
llm-api |
LLM / API / 模型服务 | gpt4free, one-api |
ai-video |
AI 视频 / 数字人 | VideoCaptioner, LiveTalking |
wechat |
微信生态 | wechat-bot, Wechatsync |
automation |
自动化 / 爬虫 | EasySpider, XHS-Downloader |
knowledge-mgmt |
知识管理 | AppFlowy, quartz |
| 标签 | 标准 | 数量预期 |
|---|---|---|
⭐mega |
10万+ stars | 3-5 个 |
⭐hot |
5-10万 stars | 5-10 个 |
💎gem |
隐藏宝藏(低 Stars 高价值) | 你挑选 |
| 标签 | 说明 |
|---|---|
self-host |
可自托管 |
no-code |
无代码/低代码 |
status:archived |
已归档(建议取消 star) |
创建 .github/workflows/export-stars.yml:
name: Export GitHub Stars
on:
schedule:
- cron: '0 0 * * 0' # 每周执行
workflow_dispatch: # 手动触发
jobs:
export:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup GitHub CLI
run: |
sudo apt-get install gh
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Export Stars
run: |
chmod +x export-stars.sh
./export-stars.sh
- name: Commit Changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore: update stars data $(date +%Y-%m-%d)" || echo "No changes"
git pushgithub-stars/
├── export-stars.sh # 🌟 一键导出脚本(主入口)
├── tag-stars.py # 🏷️ 分类标签系统
├── cleanup-stars.sh # 🧹 清理不活跃项目
├── README.md # 📖 本文档
│
├── github-stars-raw.json # 📥 原始导出数据(JSON)
├── github-stars.md # 📝 Markdown 项目列表
├── github-stars-analysis.json# 📊 分析报告数据
├── github-stars-tagged.md # 🏷️ 分类标签文档
├── star-tags.json # 🏷️ 标签数据
├── inactive-stars.json # ⚠️ 不活跃项目列表
│
└── github-stars-dashboard.html # 🎨 可视化仪表板
# 导出 stars
./export-stars.sh
# 查看统计
cat github-stars-analysis.json | jq '.'
# 查看语言分布
cat github-stars-analysis.json | jq '.by_language'
# 查看顶级项目
cat github-stars-analysis.json | jq '.top_tier'
# 运行分类
python3 tag-stars.py
# 清理不活跃
./cleanup-stars.sh
# 打开仪表板
open github-stars-dashboard.html
# 启动本地服务器
python3 -m http.server 8080欢迎提交 Issue 和 PR!
MIT
Generated by OpenClaw 🦞