Skip to main content

CLI tools for GitHub — follow back, unfollow, and more.

Project description

gh-social

CLI tools for GitHub — follow back, unfollow, and more.

A fast, modular toolkit for common GitHub operations. Currently includes Follow Back and Unfollow tools, with more coming soon.

Tools

Tool Description
follow Follow all followers of any GitHub user
unfollow Unfollow users who don't follow you back

Features

  • Interactive Menu — Run without arguments for a guided menu experience
  • Concurrent Execution — Uses ThreadPoolExecutor with 16 workers for fast API operations
  • Smart Bot Detection — Identifies spam/bot accounts using a 2-of-3 heuristic
  • Dry-Run Mode — Preview targets before executing any actions
  • Rate Limit Aware — Checks GitHub API rate limits before proceeding
  • JSON Output — Machine-readable output for scripting and automation

Requirements

  • Python 3.10+
  • GitHub CLI (gh) — must be installed and authenticated
  • rich >= 13.0 — modern terminal output

Authentication

The toolkit uses your gh CLI credentials:

gh auth login
gh auth refresh -h github.com -s user

Installation

Note: On Debian/Ubuntu 23.04+ the system Python is externally managed (PEP 668). Use a virtual environment or pipx to avoid installation errors.

With pipx (Recommended)

pipx install gh-social

From PyPI

pip install gh-social

From Source (Development)

git clone https://github.com/ajangsupardi/gh-social.git
cd gh-social
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Usage

Interactive Mode

Run without arguments to see the menu:

gh-social
╭──────────────────────────────────────────────╮
│  🔍  gh-social  v1.0.4                      │
╰──────────────────────────────────────────────╯

  Choose a tool:

  1.  Follow Back   — Follow all followers of a target user
  2.  Unfollow      — Unfollow users who don't follow you back

  0.  Exit

  → Choice (0-2):

CLI Mode

# Follow Back
gh-social follow ajangsupardi              # Dry-run
gh-social follow ajangsupardi --execute    # Execute
gh-social follow ajangsupardi --limit 100  # Limit

# Unfollow
gh-social unfollow                         # Dry-run
gh-social unfollow --execute               # Execute
gh-social unfollow --limit 100             # Limit

# Common flags
gh-social follow ajangsupardi --json       # JSON output
gh-social follow ajangsupardi --execute --include-bots

As Library

from gh_social.api import get_session, api_paginate, follow_user
from gh_social.models import enrich_users_concurrent

# Initialize session
get_session()

# Use API functions directly
followers = api_paginate("users/octocat/followers")
follow_user("octocat")

Flags

Flag Description Default
--execute Execute action (otherwise dry-run) false
--limit N Limit number of users processed 0 (all)
--include-bots Include bot accounts false
--json Output in JSON format false

Project Structure

gh-social/
├── gh_social/              # Package
│   ├── __init__.py           # Version
│   ├── __main__.py           # Entry point
│   ├── cli.py                # CLI dispatcher + interactive menu
│   ├── api.py                # GitHub API (auth, pagination)
│   ├── models.py             # Data models & bot detection
│   ├── formatting.py         # Output formatting
│   └── tools/
│       └── social.py         # Follow back & unfollow logic
├── pyproject.toml            # Pip installable config
├── README.md
└── LICENSE

How It Works

Follow Back

1. Authenticate via gh CLI token
2. Fetch target user's followers (paginated, concurrent)
3. Fetch your following list to identify already-followed users
4. Filter out: yourself, already-followed, and optionally bots
5. Enrich user details concurrently (name, bio, repos)
6. Display table preview (dry-run) or execute follows concurrently

Unfollow

1. Authenticate via gh CLI token
2. Fetch your followers & following lists (concurrent)
3. Find: users you follow who DON'T follow you back
4. Filter out: optionally bots
5. Enrich user details concurrently (name, bio, repos)
6. Display table preview (dry-run) or execute unfollows concurrently

Bot Detection

Accounts are flagged as potential bots when 2 out of 3 conditions are met:

Condition Description
Default avatar Uses GitHub's default identicon
Empty bio No bio or whitespace only
Zero repos No public repositories

License

MIT License — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh_social-1.0.4.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gh_social-1.0.4-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file gh_social-1.0.4.tar.gz.

File metadata

  • Download URL: gh_social-1.0.4.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for gh_social-1.0.4.tar.gz
Algorithm Hash digest
SHA256 860438ee9a6ad3db415e250a10c05a69d1b603ddc6bddcaa7e04b6bab4e2004b
MD5 11a237ed9f1d479f4cd8025c762c133d
BLAKE2b-256 f25e0bd63fc0f7365e069eb203667d1c8a75417530a0ae89f443422c108f1efd

See more details on using hashes here.

File details

Details for the file gh_social-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: gh_social-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for gh_social-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d4c7d2cf6eecc0234332b91d1c7f5a19e7e8b9dbde574a4893f3b83f6a04a8d9
MD5 69586ac4e38a6438a4733c9b5fd195d3
BLAKE2b-256 0fb9e531ee604e1e66baf3af41832e254b8e03c08a937b37335d568063fad997

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page