- Rust 97%
- CSS 3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| .github/workflows | ||
| dist | ||
| output | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| readme.md | ||
Self-Reposcope 🔍
- GitHub の 言語使用量を SVG で可視化する CLI ツール(Rust 製)
A lightweight CLI tool built with Rust to visualize your GitHub language stats as SVG charts. - プライベートリポジトリにも対応
Supports private repositories
What's New
- Added support for excluding specific languages via
--excluded-languagesorEXCLUDED_LANGUAGES🎉 (Thanks @Snootic, PR #21)
できること / Features
-
GitHub API を用いて、自分のリポジトリを網羅的に集計
Aggregates all your repositories using the GitHub API -
各言語の使用量(バイト数)を積み上げ棒グラフで SVG 出力
Outputs an SVG stacked bar chart based on language usage (in bytes) -
プライベートリポジトリも対象(アクセストークン使用)
Supports private repositories (with access token) -
GitHub Actions での自動集計&更新
Automatically updates via GitHub Actions
背景 / Background
GitHub の使用言語統計を可視化する「Stats 系」リポジトリは多く存在します。
しかし、その多くは public リポジトリ限定だったり、導入手順が複雑だったりと、気軽に使えるものが少ないと感じていました。
たとえば、会社アカウントと個人アカウントを使い分けている開発者にとっては、
private リポジトリ中心の活動が可視化されないという課題があります。
自分の技術スタックをもっとアピールしたいけど、それができない ——
そこで、private リポジトリにも対応し、安全かつ「1 クリックで導入できる」ような体験を提供することを目指して、このツール(self-reposcope)を開発しました。
There are many "GitHub Stats" repositories out there that visualize language usage in your repositories.
However, most of them are limited to public repositories or have complex installation steps,
which makes them less accessible for casual use.
For developers who use both personal and company accounts,
activity in private repositories often goes unrepresented —
even though that’s where most of their work happens.
You might want to showcase your real tech stack — but you simply can’t.
So I built self-reposcope,
a tool that supports private repositories and offers a safe, one-click setup experience.
使い方 / Usage
🚀 GitHub Actions で自動更新(おすすめ)/ Automatic Updates via GitHub Actions (Recommended)
Repository にて、下記のように設定すると./outputを生成し、SVG を出力します。
By setting up the following workflow in your GitHub repository, self-reposcope will automatically generate SVG files in the ./output directory.
-
Repository の
Settings > Secrets and variables > Actions > [Repository secrets] > [New repository secret]で
Name:REPOSCOPE_TOKEN, Secret:ghp_XXXXXXXXXXXXXXX
(repo権限付き GitHub Token) を追加
Go toSettings > Secrets and variables > Actions > [Repository secrets],
then add a new secret with:- Name:
REPOSCOPE_TOKEN - Value: your personal access token (with
reposcope)
- Name:
-
.github/workflows/reposcope.ymlを作成し、以下のように記述:
Create a workflow file at.github/workflows/reposcope.ymlwith the following content:
name: Update Language Stats
on:
schedule:
- cron: "0 0 * * 1" # Every Monday
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout target repo
uses: actions/checkout@v3
- name: Download self-reposcope binary from GitHub Release
shell: bash
run: |
curl -L https://github.com/4okimi7uki/self-reposcope/releases/latest/download/self-reposcope -o self-reposcope
chmod +x ./self-reposcope
- name: Run self-reposcope CLI
shell: bash
run: |
mkdir -p output
./self-reposcope --token ${{ secrets.REPOSCOPE_TOKEN }}
- name: Commit and Push updated SVGs
shell: bash
env:
GH_PAT: ${{ secrets.REPOSCOPE_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add output/*.svg
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "update: language stats svg"
git push https://x-access-token:${GH_PAT}@github.com/${{ github.repository }} HEAD:main
fi
-
手動実行(
Actions>Update Language Stats>Run workflow) または 自動で毎週更新されます。差分がなければ新規出力されません。You can run the workflow manually (
Actions > Update Language Stats > Run workflow), or it will automatically run every Monday. If there are no changes in the output, nothing will be committed.
🧪 ローカルで試す / Try It Locally (Rust CLI)
実行環境 / Requirements
- Rust 1.87.0+ (with
cargo)
- リポジトリに対してアクセス権のある GitHub token を用意
Prepare a GitHub personal access token with access to your repositories - このリポジトリをクローン
Clone this repo .envファイルを作成して、GitHub token を設定:
Add your GitHub token to.env
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxx
- 下記コマンドで実行:
Run with:
cargo run --release
./outputに*.svgファイルが出力されていることを確認
Check that the*.svgfiles are generated in the./outputdirectory
🦊 Forgejo / Gitea support
Stats can be aggregated from GitHub, Forgejo, or both at once. Forgejo is enabled with:
--forgejo-url/FORGEJO_URL: instance root, e.g.https://git.example.com--forgejo-token/FORGEJO_TOKEN: access token withread:repositoryandread:user
GitHub stats are fetched through the GraphQL API (one request per 50 repos, with language colors; forks and organization repos are excluded). Forgejo has no GraphQL, so it uses REST with one request per repo. Set --github-api-url / SELF_REPOSCOPE_GITHUB_API_URL for GitHub Enterprise.
--token (GitHub) is now optional, but at least one forge must be configured. A repository with the same name on several forges (e.g. a mirror) is counted once; the first forge listed (GitHub) wins.
./self-reposcope --token "$GH_TOKEN" --forgejo-url https://git.example.com --forgejo-token "$FJ_TOKEN"
⚙️ Option: 言語の除外 / Excluding Specific Languages
特定の言語を可視化から除外したい場合は、以下のいずれかの方法で指定できます:
- CLI オプション
--excluded-languages - 環境変数
EXCLUDED_LANGUAGES
You can exclude specific languages either by using the --excluded-languages CLI option or the EXCLUDED_LANGUAGES environment variable.
For example:
CLI
# Specify directly
./self-reposcope --token ${{ secrets.REPOSCOPE_TOKEN }} --excluded-languages "Jupyter Notebook, HTML, CSS"
# Using GitHub Secrets
./self-reposcope --token ${{ secrets.REPOSCOPE_TOKEN }} --excluded-languages ${{ secrets.EXCLUDED_LANGUAGES }}
.env
EXCLUDED_LANGUAGES="Jupyter Notebook, HTML, CSS"
Languages must be separated by commas. Wrap the list in quotes if any language name contains spaces, otherwise it may not be recognized.
🤝 Contributors
2025 Aoki Mizuki – Developed with 🍭 and a sense of fun.
Using the released binary
Tagging vX.Y.Z builds self-reposcope and attaches it to the release on both GitHub and Forgejo. Other repos can fetch it with:
# GitHub
curl --fail -L https://github.com/Snootic/self-reposcope/releases/latest/download/self-reposcope -o self-reposcope
# Forgejo
curl --fail -L https://<forgejo-host>/snootic/self-reposcope/releases/latest/download/self-reposcope -o self-reposcope
chmod +x self-reposcope