Skip to content

Gain insights into your GitHub repos, public or private — powered by Rust and token auth.

License

Notifications You must be signed in to change notification settings

4okimi7uki/self-reposcope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self-Reposcope 🔍

Badge Rust License

stats

  • 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-languages or EXCLUDED_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.

  1. Repository の Settings > Secrets and variables > Actions > [Repository secrets] > [New repository secret]
    Name: REPOSCOPE_TOKEN, Secret: ghp_XXXXXXXXXXXXXXX
    (repo 権限付き GitHub Token) を追加
    Go to Settings > Secrets and variables > Actions > [Repository secrets],
    then add a new secret with:

    • Name: REPOSCOPE_TOKEN
    • Value: your personal access token (with repo scope)
  2. .github/workflows/reposcope.yml を作成し、以下のように記述:
    Create a workflow file at .github/workflows/reposcope.yml with 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
  1. 手動実行(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)
  1. リポジトリに対してアクセス権のある GitHub token を用意
    Prepare a GitHub personal access token with access to your repositories
  2. このリポジトリをクローン
    Clone this repo
  3. .envファイルを作成して、GitHub token を設定:
    Add your GitHub token to .env
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxx
  1. 下記コマンドで実行:
    Run with:
cargo run --release
  1. ./output*.svgファイルが出力されていることを確認
    Check that the *.svg files are generated in the ./output directory

⚙️ 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

contributors

2025 Aoki Mizuki – Developed with 🍭 and a sense of fun.

About

Gain insights into your GitHub repos, public or private — powered by Rust and token auth.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •