An open API service indexing awesome lists of open source software.

https://github.com/taxi-tabby/github-followerandtraitor

It's a tool with GitHub followers and follower management. Balance it out like Thanos.
https://github.com/taxi-tabby/github-followerandtraitor

github githubapi tool typescript

Last synced: about 1 month ago
JSON representation

It's a tool with GitHub followers and follower management. Balance it out like Thanos.

Awesome Lists containing this project

README

          

# GitHub Follower Traitor


πŸ•΅οΈ Track who doesn't follow you back on GitHub


[English](#overview) | [ν•œκ΅­μ–΄](#κ°œμš”)

---

## Overview

GitHub Follower Traitor is a command-line tool that helps you analyze and manage your GitHub followers and following relationships. It identifies users who don't follow you back ("traitors") and those you don't follow back, allowing you to easily manage your GitHub connections.

### Features

- πŸ“Š View statistics of your GitHub followers and following
- πŸ” Identify users who don't follow you back (traitors)
- πŸ‘€ Find followers you don't follow back
- βœ… Bulk follow/unfollow options
- 🎯 Individual user follow/unfollow capabilities
- 🌐 Detailed view of all followers and followings

## Installation

### Prerequisites

- Node.js (v16 or higher recommended)
- npm (comes with Node.js)
- GitHub Personal Access Token

### Setup

1. **Clone the repository**
```bash
git clone https://github.com/yourusername/github-follower-traitor.git
cd github-follower-traitor
```

2. **Install dependencies**
```bash
npm install
```

3. **Create .env file**
Create a `.env` file in the root directory with the following content:
```
GITHUB_TOKEN=your_github_personal_access_token
GITHUB_USERNAME=your_github_username

# API Rate Limit Settings (milliseconds)
# GitHub allows 5,000 API requests per hour for authenticated users
# Wait time between each request (default: 1000ms = 1 second)
RATELIMIT_WAIT_MS=1000

# Timeout Settings (milliseconds)
# If the task is not completed within this time, progress is saved and the process exits
# The next execution will resume from the saved point
# Examples: 50 minutes = 3000000ms, 9 minutes = 540000ms
TIMEOVER_MS=3000000
```
> Note: To create a personal access token, go to GitHub Settings > Developer settings > Personal access tokens. Make sure to select the "user:follow" scope.

4. **Build the application**
```bash
npm run build
```

## Usage

### Running the Application

```bash
npm start
```

### Available Commands

Once you run the application, you'll see a menu with the following options:

1. **Follow all users who follow me but I don't follow back**
- Automatically follow all users who follow you but you don't follow back

2. **Unfollow all users who don't follow me back**
- Automatically unfollow all users who don't follow you (traitors)

3. **Follow a specific user**
- Follow a specific GitHub user by username

4. **Unfollow a specific user**
- Unfollow a specific GitHub user by username

5. **View detailed status**
- Access a sub-menu with detailed listing options:
- View all followers
- View all followings
- See all traitors (who don't follow you back)
- View all unfollowed followers (followers you don't follow)

0. **Exit**
- Close the application

## Development

```bash
# Run the application in development mode
npm run dev

# Watch mode (auto-compile on file changes)
npm run watch

# Lint the code
npm run lint

# Clean the build directory
npm run clean

# Rebuild (clean + build)
npm run rebuild

# πŸš€ NEW: Instant Sync (Auto follow/unfollow)
npm run instant-run
```

### Menu Options

When you run the application, you'll see the following menu:

1. **Follow all users who follow me but I don't follow back** - Automatically follow all users who follow you but you don't follow back
2. **Unfollow all users who don't follow me back** - Automatically unfollow all users who don't follow you back
3. **Follow a specific user** - Follow a specific GitHub user
4. **Unfollow a specific user** - Unfollow a specific GitHub user
5. **View detailed status** - View detailed lists of followers, following, traitors, and unfollowed followers
6. **πŸš€ Instant Sync (1 + 2)** - Automatically perform both options 1 and 2 in sequence for perfect synchronization
0. **Exit** - Exit the application

### Instant Sync Feature

The new **Instant Sync** feature (`npm run instant-run`) is perfect for quickly synchronizing your followers and following:

- Automatically unfollows users who don't follow you back
- Automatically follows users who follow you but you don't follow back
- Runs completely automatically without user interaction
- Displays detailed progress and final statistics
- Exits automatically when complete
- **Smart timeout handling**: If the process takes too long (based on `TIMEOVER_MS` setting), it saves progress to `savedata.json` and resumes from that point on the next run
- **Rate limit protection**: Respects GitHub API rate limits with configurable delays between requests (`RATELIMIT_WAIT_MS`)

This is ideal for:
- Daily maintenance of your GitHub following list
- Keeping follower/following counts balanced
- Automated scripts and scheduled tasks (cron jobs, etc.)
- Large follower/following lists that may exceed time limits

**How it works with cron jobs:**
If you schedule this script to run every hour or every 10 minutes, and it doesn't complete within the `TIMEOVER_MS` limit:
1. The script saves its progress to `savedata.json`
2. On the next scheduled run, it automatically resumes from where it left off
3. When all tasks are completed, `savedata.json` is automatically deleted

## License

This project is get no license.

---

# GitHub Follower Traitor


πŸ•΅οΈ GitHubμ—μ„œ λ§žνŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬μš©μž μΆ”μ ν•˜κΈ°


## κ°œμš”

GitHub Follower TraitorλŠ” GitHub νŒ”λ‘œμ›Œμ™€ νŒ”λ‘œμž‰ 관계λ₯Ό λΆ„μ„ν•˜κ³  κ΄€λ¦¬ν•˜λŠ” μ»€λ§¨λ“œλΌμΈ λ„κ΅¬μž…λ‹ˆλ‹€. λ§žνŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬μš©μž("λ°°μ‹ μž")와 당신이 νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” νŒ”λ‘œμ›Œλ₯Ό μ‹λ³„ν•˜μ—¬ GitHub 연결을 μ‰½κ²Œ 관리할 수 있게 λ„μ™€μ€λ‹ˆλ‹€.

### κΈ°λŠ₯

- πŸ“Š GitHub νŒ”λ‘œμ›Œ 및 νŒ”λ‘œμž‰ 톡계 확인
- πŸ” λ§žνŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬μš©μž(λ°°μ‹ μž) 식별
- πŸ‘€ 당신이 νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” νŒ”λ‘œμ›Œ μ°ΎκΈ°
- βœ… 일괄 νŒ”λ‘œμš°/μ–ΈνŒ”λ‘œμš° μ˜΅μ…˜
- 🎯 κ°œλ³„ μ‚¬μš©μž νŒ”λ‘œμš°/μ–ΈνŒ”λ‘œμš° κΈ°λŠ₯
- 🌐 λͺ¨λ“  νŒ”λ‘œμ›Œ 및 νŒ”λ‘œμž‰ 상세 보기

## μ„€μΉ˜

### ν•„μˆ˜ 쑰건

- Node.js (v16 이상 ꢌμž₯)
- npm (Node.js와 ν•¨κ»˜ 제곡)
- GitHub 개인 μ•‘μ„ΈμŠ€ 토큰

### μ„€μ •

1. **μ €μž₯μ†Œ 볡제**
```bash
git clone https://github.com/yourusername/github-follower-traitor.git
cd github-follower-traitor
```

2. **μ˜μ‘΄μ„± μ„€μΉ˜**
```bash
npm install
```

3. **.env 파일 생성**
루트 디렉토리에 λ‹€μŒ λ‚΄μš©μœΌλ‘œ `.env` νŒŒμΌμ„ μƒμ„±ν•˜μ„Έμš”:
```
GITHUB_TOKEN=your_github_personal_access_token
GITHUB_USERNAME=your_github_username

# API Rate Limit μ„€μ • (λ°€λ¦¬μ΄ˆ)
# GitHubλŠ” 인증된 μ‚¬μš©μžμ—κ²Œ μ‹œκ°„λ‹Ή 5,000건의 API μš”μ²­μ„ ν—ˆμš©
# 각 μš”μ²­ μ‚¬μ΄μ˜ λŒ€κΈ° μ‹œκ°„ (κΈ°λ³Έκ°’: 1000ms = 1초)
RATELIMIT_WAIT_MS=1000

# Timeout μ„€μ • (λ°€λ¦¬μ΄ˆ)
# 이 μ‹œκ°„ 내에 μž‘μ—…μ΄ μ™„λ£Œλ˜μ§€ μ•ŠμœΌλ©΄ μ§„ν–‰ μƒνƒœλ₯Ό μ €μž₯ν•˜κ³  μ’…λ£Œ
# λ‹€μŒ μ‹€ν–‰ μ‹œ μ €μž₯된 지점뢀터 재개됨
# 예: 50λΆ„ = 3000000ms, 9λΆ„ = 540000ms
TIMEOVER_MS=3000000
```
> μ°Έκ³ : 개인 μ•‘μ„ΈμŠ€ 토큰을 μƒμ„±ν•˜λ €λ©΄ GitHub μ„€μ • > 개발자 μ„€μ • > 개인 μ•‘μ„ΈμŠ€ ν† ν°μœΌλ‘œ μ΄λ™ν•˜μ„Έμš”. "user:follow" λ²”μœ„λ₯Ό 선택해야 ν•©λ‹ˆλ‹€.

4. **μ• ν”Œλ¦¬μΌ€μ΄μ…˜ λΉŒλ“œ**
```bash
npm run build
```

## μ‚¬μš©λ²•

### μ• ν”Œλ¦¬μΌ€μ΄μ…˜ μ‹€ν–‰

```bash
npm start
```

### μ‚¬μš© κ°€λŠ₯ν•œ λͺ…λ Ή

μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ„ μ‹€ν–‰ν•˜λ©΄ λ‹€μŒ μ˜΅μ…˜μ΄ ν¬ν•¨λœ 메뉴가 ν‘œμ‹œλ©λ‹ˆλ‹€:

1. **λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜λŠ”λ° λ‚΄κ°€ νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” λͺ¨λ“  μ‚¬λžŒμ„ νŒ”λ‘œμš°ν•˜κΈ°**
- 당신을 νŒ”λ‘œμš°ν•˜μ§€λ§Œ 당신이 νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” λͺ¨λ“  μ‚¬μš©μžλ₯Ό μžλ™μœΌλ‘œ νŒ”λ‘œμš°ν•©λ‹ˆλ‹€

2. **λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ”λ° λ‚΄κ°€ νŒ”λ‘œμš°ν•˜κ³  μžˆλŠ” λͺ¨λ“  μ‚¬λžŒ μ–ΈνŒ”λ‘œμš°ν•˜κΈ°**
- 당신을 νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” λͺ¨λ“  μ‚¬μš©μž(λ°°μ‹ μž)λ₯Ό μžλ™μœΌλ‘œ μ–ΈνŒ”λ‘œμš°ν•©λ‹ˆλ‹€

3. **νŠΉμ • μ‚¬μš©μž νŒ”λ‘œμš°ν•˜κΈ°**
- μ‚¬μš©μž μ΄λ¦„μœΌλ‘œ νŠΉμ • GitHub μ‚¬μš©μžλ₯Ό νŒ”λ‘œμš°ν•©λ‹ˆλ‹€

4. **νŠΉμ • μ‚¬μš©μž μ–ΈνŒ”λ‘œμš°ν•˜κΈ°**
- μ‚¬μš©μž μ΄λ¦„μœΌλ‘œ νŠΉμ • GitHub μ‚¬μš©μžλ₯Ό μ–ΈνŒ”λ‘œμš°ν•©λ‹ˆλ‹€

5. **μ„ΈλΆ€ μƒνƒœλ³΄κΈ°**
- 상세 λͺ©λ‘ μ˜΅μ…˜μ΄ μžˆλŠ” ν•˜μœ„ 메뉴에 μ ‘κ·Όν•©λ‹ˆλ‹€:
- λͺ¨λ“  νŒ”λ‘œμ›Œ λͺ©λ‘ 보기
- λͺ¨λ“  νŒ”λ‘œμž‰ λͺ©λ‘ 보기
- λͺ¨λ“  λ°°μ‹ μž λͺ©λ‘ 보기 (λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬λžŒ)
- λͺ¨λ“  λ―ΈνŒ”λ‘œμš° νŒ”λ‘œμ›Œ λͺ©λ‘ 보기 (λ‚΄κ°€ νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” νŒ”λ‘œμ›Œ)

6. **πŸš€ μ¦‰μ‹œ 동기화 (1 + 2)**
- 1번과 2번 μ˜΅μ…˜μ„ 순차적으둜 μžλ™ μ‹€ν–‰ν•˜μ—¬ μ™„λ²½ν•œ 동기화λ₯Ό μˆ˜ν–‰ν•©λ‹ˆλ‹€

0. **μ’…λ£Œν•˜κΈ°**
- μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ„ μ’…λ£Œν•©λ‹ˆλ‹€

### μ¦‰μ‹œ 동기화 κΈ°λŠ₯

μƒˆλ‘œμš΄ **μ¦‰μ‹œ 동기화** κΈ°λŠ₯ (`npm run instant-run`)은 νŒ”λ‘œμ›Œμ™€ νŒ”λ‘œμž‰μ„ λΉ λ₯΄κ²Œ λ™κΈ°ν™”ν•˜λŠ” 데 μ™„λ²½ν•©λ‹ˆλ‹€:

- λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬μš©μžλ“€μ„ μžλ™μœΌλ‘œ μ–ΈνŒ”λ‘œμš°
- λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜μ§€λ§Œ λ‚΄κ°€ νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬μš©μžλ“€μ„ μžλ™μœΌλ‘œ νŒ”λ‘œμš°
- μ‚¬μš©μž μƒν˜Έμž‘μš© 없이 μ™„μ „νžˆ μžλ™μœΌλ‘œ μ‹€ν–‰
- μƒμ„Έν•œ μ§„ν–‰ 상황과 μ΅œμ’… 톡계 ν‘œμ‹œ
- μ™„λ£Œ μ‹œ μžλ™μœΌλ‘œ μ’…λ£Œ
- **슀마트 νƒ€μž„μ•„μ›ƒ 처리**: μž‘μ—…μ΄ λ„ˆλ¬΄ 였래 κ±Έλ¦¬λŠ” 경우(`TIMEOVER_MS` μ„€μ • κΈ°μ€€), `savedata.json`에 μ§„ν–‰ 상황을 μ €μž₯ν•˜κ³  λ‹€μŒ μ‹€ν–‰ μ‹œ ν•΄λ‹Ή 지점뢀터 재개 (instant-run ν•œμ •)
- **Rate Limit 보호**: μš”μ²­ μ‚¬μ΄μ˜ μ§€μ—° μ‹œκ°„μ„ μ„€μ •(`RATELIMIT_WAIT_MS`)ν•˜μ—¬ GitHub API ratelimit 에 μ•ˆκ±Έλ¦¬κ²Œ ν•˜κΈ° μœ„ν•œ μ΅œμ†Œν•œμ˜ 쑰치 (instant-run ν•œμ •)

λ‹€μŒκ³Ό 같은 κ²½μš°μ— μ΄μƒμ μž…λ‹ˆλ‹€:
- GitHub νŒ”λ‘œμž‰ λͺ©λ‘μ˜ 일일 관리
- νŒ”λ‘œμ›Œ/νŒ”λ‘œμž‰ 수의 κ· ν˜• μœ μ§€
- μžλ™ν™”λœ 슀크립트 및 μ˜ˆμ•½λœ μž‘μ—… (cron μž‘μ—… λ“±)
- μ‹œκ°„ μ œν•œμ„ μ΄ˆκ³Όν•  수 μžˆλŠ” λŒ€κ·œλͺ¨ νŒ”λ‘œμ›Œ/νŒ”λ‘œμž‰ λͺ©λ‘

**Cron μž‘μ—…κ³Ό ν•¨κ»˜ μž‘λ™ν•˜λŠ” 방법:** (instant-run ν•œμ •)
1μ‹œκ°„λ§ˆλ‹€ λ˜λŠ” 10λΆ„λ§ˆλ‹€ 이 슀크립트λ₯Ό μ‹€ν–‰ν•˜λ„λ‘ μ˜ˆμ•½ν–ˆλŠ”λ° `TIMEOVER_MS` μ œν•œ 내에 μ™„λ£Œλ˜μ§€ μ•ŠλŠ” 경우:
1. μŠ€ν¬λ¦½νŠΈκ°€ μ§„ν–‰ 상황을 `savedata.json`에 μ €μž₯
2. λ‹€μŒ μ˜ˆμ•½λœ μ‹€ν–‰ μ‹œ μžλ™μœΌλ‘œ μ€‘λ‹¨λœ 지점뢀터 재개
3. λͺ¨λ“  μž‘μ—…μ΄ μ™„λ£Œλ˜λ©΄ `savedata.json`이 μžλ™μœΌλ‘œ μ‚­μ œλ¨

## 개발

```bash
# 개발 λͺ¨λ“œλ‘œ μ• ν”Œλ¦¬μΌ€μ΄μ…˜ μ‹€ν–‰
npm run dev

# κ°μ‹œ λͺ¨λ“œ (파일 λ³€κ²½ μ‹œ μžλ™ 컴파일)
npm run watch

# μ½”λ“œ 린트
npm run lint

# λΉŒλ“œ 디렉토리 정리
npm run clean

# μž¬λΉŒλ“œ (clean + build)
npm run rebuild

# πŸš€ μƒˆλ‘œμš΄ κΈ°λŠ₯: μ¦‰μ‹œ 동기화 (μžλ™ νŒ”λ‘œμš°/μ–ΈνŒ”λ‘œμš°)
npm run instant-run
```

## λΌμ΄μ„ΌμŠ€
이 ν”„λ‘œμ νŠΈλŠ” λΌμ΄μ„ μŠ€κ°€ μ—†μŠ΅λ‹ˆλ‹€.

----
> 메인 ν™”λ©΄
```bash
(base) PS R:\project\github-follower-traitor> npm run start

> github-follower-traitor@1.0.0 start
> node dist/index.js

GitHub Follower and Traitor μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ μ‹œμž‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€!
ν˜„μž¬ μ‹œκ°„: 2025. 5. 5. μ˜€ν›„ 11:19:10

"taxi-tabby" μ‚¬μš©μžμ˜ νŒ”λ‘œμ›Œμ™€ νŒ”λ‘œμž‰ 정보λ₯Ό κ°€μ Έμ˜€λŠ” 쀑...
followers (νŒ”λ‘œμ›Œ 수): 27
following (νŒ”λ‘œμž‰ 수): 27

λ‚΄κ°€ νŒ”λ‘œμš°ν•˜μ§€λ§Œ λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬μš©μž 수: 0
λ°°μ‹ μž λͺ©λ‘:

λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜μ§€λ§Œ λ‚΄κ°€ νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” μ‚¬μš©μž 수: 0
νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” νŒ”λ‘œμ›Œ:

πŸ“Š GitHub Follow control menu:
1: Follow all users who follow me but I don't follow back - λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜λŠ”λ° λ‚΄κ°€ νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ” λͺ¨λ“  μ‚¬λžŒμ„ νŒ”λ‘œμš°ν•˜κΈ°
2: Unfollow all users who don't follow me back - λ‚˜λ₯Ό νŒ”λ‘œμš°ν•˜μ§€ μ•ŠλŠ”λ° λ‚΄κ°€ νŒ”λ‘œμš°ν•˜κ³  μžˆλŠ” λͺ¨λ“  μ‚¬λžŒ μ–ΈνŒ”λ‘œμš°ν•˜κΈ°
3: Follow a specific user - νŠΉμ • μ‚¬μš©μž νŒ”λ‘œμš°ν•˜κΈ°
4: Unfollow a specific user - νŠΉμ • μ‚¬μš©μž μ–ΈνŒ”λ‘œμš°ν•˜κΈ°
5: View detailed status - μ„ΈλΆ€ μƒνƒœλ³΄κΈ° (Sub Menu)
0: Exit - μ’…λ£Œν•˜κΈ°
```