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

https://github.com/ljlm0402/auto-github-tool

๐Ÿ—ƒ๏ธ AGT(Automatic Git & GitHub Tool)
https://github.com/ljlm0402/auto-github-tool

automatic branch git github issues pull-request tool

Last synced: 4 months ago
JSON representation

๐Ÿ—ƒ๏ธ AGT(Automatic Git & GitHub Tool)

Awesome Lists containing this project

README

          




Project Logo




Auto GitHub Tool


๐Ÿค– A CLI tool to automate GitHub issue handling, branch creation, and PR submission.



npm Info



npm Version


npm Release Version


npm Downloads


npm Package License



github Stars


github Forks


github Contributors


github Issues


ยท English ยท Korean

---

## Introduction

AGT (Auto GitHub Tool) is a CLI tool that automates branch management and pull request creation based on GitHub Issues, improving developer productivity and maintaining consistency in branch management.

### โœจ Key Features

- **๐ŸŽฏ Interactive Menu Mode**: Easy access to all features through an intuitive menu
- **๐Ÿ“‹ Issue Management**: View issue lists and create issues using templates
- **๐ŸŒฟ Branch Automation**: Automatically create issue-based branches (feature/bugfix/hotfix/release)
- **๐Ÿ”€ PR Creation**: Automatically create pull requests using templates
- **๐Ÿท๏ธ Label Management**: Create and manage GitHub labels
- **โš™๏ธ Configuration File**: Support for project-specific or global settings (.agtrc.json)
- **๐Ÿช„ Setup Wizard**: Interactive 5-step setup wizard for easy first-time configuration
- **๐ŸŽจ Enhanced UX**: Better user experience with colored output, spinners, and input validation
- **๐Ÿ“Š Logging System**: Comprehensive logging to `~/.agt/agt.log` for debugging and tracking
- **โšก Smart Caching**: Automatic caching of GitHub API responses for improved performance
- **๐Ÿ”„ Error Recovery**: Unified error handling system with automatic retry mechanism
- **โœ… Input Validation**: Multi-layer security validation to prevent shell injection
- **๐Ÿ“ˆ Performance**: Parallel API operations for 50-75% faster command execution

## ๐Ÿ“‹ Table of Contents

- [Requirements](#-requirements)
- [Installation](#-installation)
- [Quick Start](#-quick-start)
- [Usage](#-usage)
- [Interactive Mode](#interactive-mode-recommended)
- [Direct Commands](#direct-commands)
- [Configuration File](#configuration-file)
- [Command Guide](#-command-guide)
- [Setup Wizard](#1-setup-wizard)
- [Help](#2-help)
- [List Issues](#3-list-issues)
- [Create Issue](#4-create-issue)
- [Create Branch](#5-create-branch)
- [Create Pull Request](#6-create-pull-request)
- [Create Label](#7-create-label)
- [Statistics](#8-statistics)
- [Project Structure](#-project-structure)
- [Developer Guide](#-developer-guide)
- [Troubleshooting](#-troubleshooting)
- [Contributing](#-contributing)
- [License](#-license)

## ๐Ÿ“Œ Requirements

- Node.js 14 or higher
- GitHub CLI (gh) installation required
- GitHub account

```sh
node -v # Check version
gh --version # Check installation
```

## ๐Ÿš€ Installation

1. **Install GitHub CLI**

```bash
# Install via Homebrew (macOS)
brew install gh

# Other platforms: https://cli.github.com/
```

2. **Authenticate GitHub Account**

```bash
gh auth login
```

Follow the prompts:

1. `? What account do you want to log into?` โ†’ Select `GitHub.com`
2. `? What is your preferred protocol for Git operations?` โ†’ Select `HTTPS`
3. `? Authenticate Git with your GitHub credentials?` โ†’ Select `Yes`
4. `? How would you like to authenticate GitHub CLI?` โ†’ Select `Login with a web browser`
5. Copy the one-time code displayed
6. Log in to GitHub in the automatically opened browser
7. Enter the copied code to complete authentication

3. **Install AGT**

```bash
npm install -g auto-github-tool
```

After installation, you can use the `agt` command.

## ๐Ÿš€ Quick Start

The easiest way to get started with AGT is using the setup wizard:

```bash
$ agt setup

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿš€ AGT Setup Wizard โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

This wizard will help you configure AGT for the first time.
It will check your environment and guide you through the setup.

โœ… Step 1: Checking Git Installation
โœ“ Git is installed (version 2.39.0)

โœ… Step 2: Checking GitHub CLI Installation
โœ“ GitHub CLI is installed (version 2.40.0)

โœ… Step 3: Verifying GitHub Authentication
โœ“ Authenticated as yourusername

โœ… Step 4: Testing GitHub Connection
โœ“ Successfully connected to GitHub API

โš™๏ธ Step 5: AGT Configuration (Optional)
? Where would you like to store the configuration?
โฏ ๐Ÿ“ Local (current project only)
๐ŸŒ Global (all projects)
โญ๏ธ Skip for now

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Setup Summary โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โœ… PASS Git installation
โœ… PASS GitHub CLI installation
โœ… PASS GitHub authentication
โœ… PASS GitHub connection
โญ๏ธ SKIP AGT configuration

๐ŸŽ‰ Setup completed successfully!

You're ready to use Auto GitHub Tool!

Quick Start:
โ€ข Run 'agt' to start interactive mode
โ€ข Run 'agt help' to see all commands
โ€ข Run 'agt list' to view open issues
```

## ๐Ÿ›  Usage

### Interactive Mode (Recommended)

The easiest way to use AGT. Simply type `agt` without any command to display the interactive menu:

```bash
$ agt

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿค– Auto GitHub Tool - Main Menu โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

? What would you like to do? (Use arrow keys)
โฏ ๐Ÿ“‹ List open issues
โž• Create a new issue
๐ŸŒฟ Create a branch from an issue
๐Ÿ”€ Create a pull request
๐Ÿท๏ธ Create a new label
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โš™๏ธ Configure AGT settings
โ“ Show help
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
๐Ÿšช Exit
```

### Direct Commands

You can directly execute specific tasks by entering commands:

```bash
agt help # Show available commands
agt setup # Run setup wizard (first-time users)
agt list # View open issues
agt issue # Create a new issue
agt branch # Create a branch from an issue
agt pr # Create a PR from current branch
agt label # Create a label
agt stats # Show repository statistics
agt config # Initialize configuration
```

### Configuration File

AGT supports project-specific or global configuration.

#### Initialize Configuration

```bash
# Local project configuration (.agtrc.json)
$ agt config

# Global configuration (~/.agtrc.json)
$ agt config --global
```

#### Configuration File Example (.agtrc.json)

The project includes a `.agtrc.example.json` file. Copy it to use:

```bash
cp .agtrc.example.json .agtrc.json
```

```json
{
"defaultBaseBranch": "main",
"branchTypes": [
{ "id": "1", "name": "feature", "description": "Develop new features" },
{ "id": "2", "name": "bugfix", "description": "Fix bugs" },
{ "id": "3", "name": "hotfix", "description": "Urgent fixes" },
{ "id": "4", "name": "release", "description": "Prepare for a release" }
],
"autoAssign": true,
"defaultLabels": [],
"autoTemplates": true
}
```

**Configuration Options:**

- `defaultBaseBranch`: Default base branch when creating PRs
- `branchTypes`: Define branch types
- `autoAssign`: Automatically assign yourself
- `defaultLabels`: Default labels to apply
- `autoTemplates`: Automatically use templates

## ๐Ÿ“š Command Guide

### 1. Setup Wizard

Interactive setup wizard to help you configure AGT for the first time.

```bash
$ agt setup

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿš€ AGT Setup Wizard โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

This wizard will check:
โœ“ Git installation
โœ“ GitHub CLI installation
โœ“ GitHub authentication
โœ“ GitHub connection
โš™๏ธ AGT configuration (optional)

Run this command when:
โ€ข First time using AGT
โ€ข After reinstalling dependencies
โ€ข Having authentication issues
โ€ข Want to reconfigure AGT
```

**What it does:**

1. **Git Check**: Verifies Git is installed and accessible
2. **GitHub CLI Check**: Verifies GitHub CLI (gh) is installed
3. **Authentication**: Checks if you're authenticated with GitHub
4. **Connection Test**: Tests GitHub API connectivity
5. **Configuration**: Optionally create local or global config (can be skipped)

**Features:**

- โœ… Sequential validation with helpful error messages
- ๐Ÿ”„ Interactive recovery options for failed steps
- โญ๏ธ Skip configuration if you prefer default settings
- ๐Ÿ“Š Detailed summary at the end

### 2. Help

```bash
$ agt help

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ AGT Command Reference โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Usage:
agt [command]

Commands:
(no command) Start interactive menu
setup Run setup wizard (recommended for first-time users)
help Show this help message
list Show open issues
issue Create a new issue
branch Create a branch from an issue
pr Create a pull request
label Create a new label
stats Show repository statistics
config Configure AGT settings

Configuration Files:
.agtrc.json Project-specific settings
~/.agtrc.json User-wide settings

Quick Start:
$ agt # Interactive mode (recommended for beginners)
$ agt setup # First-time setup wizard
$ agt list # View open issues
$ agt config # Initialize configuration
```

### 3. List Issues

View all open issues in the current repository.

```bash
$ agt list

=== ๐Ÿ“‹ Open Issues ===

123 Fix login bug [bug]
124 Add dark mode feature [enhancement]
125 Update documentation [documentation]
```

### 4. Create Issue

Create issues using templates.

```bash
$ agt issue

๐Ÿ“ Enter issue title: Fix login authentication issue

๐Ÿ“Œ Available Issue Templates:
1. bug_report.md
2. feature_request.md
3. question.md
Select a template number or press Enter to skip: 1

๐Ÿž Describe the bug clearly: Users cannot login with valid credentials
โœ… What did you expect to happen?: Successful login
...

๐Ÿ‘ฅ Enter assignees (comma-separated, or press Enter to skip):
โœ“ Assignee set to your account: yourusername

=== ๐Ÿ“‹ Available Labels ===
[1] bug
[2] enhancement
[3] documentation
...
๐Ÿท Select labels [1...9 / a, b, c]: 1

๐Ÿท๏ธ Selected Labels: bug

๐Ÿ“… Enter milestone (or press Enter to skip): v1.0

โ ‹ Creating GitHub issue...
โœ… GitHub issue created successfully.
```

### 5. Create Branch

Automatically create a branch by selecting an issue number.

**Branch Naming Convention:** `{type}/{issue-number}-{sanitized-title}`

```bash
$ agt branch

=== ๐Ÿ“‹ Open Issues ===

123 Fix login bug [bug]
124 Add dark mode feature [enhancement]

๐Ÿ”ข Enter issue number to create branch: 123

๐Ÿ“Œ Select a branch type:
[1] feature - Develop new features
[2] bugfix - Fix bugs
[3] hotfix - Urgent fixes
[4] release - Prepare for a release

๐Ÿ”ข Enter the branch type number: 2

โ ‹ Creating branch 'bugfix/123-fix-login-bug'...
โœ… Branch 'bugfix/123-fix-login-bug' has been successfully created.
```

### 6. Create Pull Request

Automatically create a PR from the current branch. Supports templates and can automatically link related issues.

```bash
$ agt pr

๐Ÿ“ Enter PR title: Fix login authentication bug

๐Ÿ“Œ Provide a short summary of your changes: Fixed session validation logic

=== ๐Ÿ“‹ Open Issues ===
123 Fix login bug [bug]

๐Ÿ” Enter the related issue number (e.g., #27): 123
โœจ Describe the major changes in your PR: Updated auth middleware
โœ… Have you tested the changes locally? (yes/no): yes
๐Ÿ“ Does your code follow the project's style guidelines? (yes/no): yes
๐Ÿ“– Have you updated the documentation if necessary? (yes/no): yes
๐Ÿ”— Add any additional information (optional):

๐Ÿ‘€ Enter reviewers (comma-separated, or press Enter to skip):
๐Ÿ‘ฅ Enter assignees (comma-separated, or press Enter to skip):
โœ“ Assignee set to your account: yourusername

=== ๐Ÿ“‹ Available Labels ===
[1] bug
[2] enhancement
๐Ÿท Select labels [1...9 / a, b, c]: 1

๐Ÿท๏ธ Selected Labels: bug

๐Ÿ“… Enter milestone (or press Enter to skip): v1.0

๐ŸŒฟ Available branches:
[1] main (default)
[2] development
Select base branch (or press Enter for 'main'):

Current branch: bugfix/123-fix-login-bug
Found 3 commit(s) to push.

โ ‹ Pushing branch 'bugfix/123-fix-login-bug' to remote...
โœ… Branch 'bugfix/123-fix-login-bug' pushed successfully.
โ ‹ Creating pull request...
โœ… Pull request created successfully.
```

### 7. Create Label

Create a new label in the GitHub repository.

```bash
$ agt label

๐Ÿท Enter label name: urgent
๐ŸŽจ Enter label color (6-digit hex, e.g., FFFFFF) [default: FFFFFF]: FF0000
๐Ÿ“ Enter label description (optional): Urgent issues that need immediate attention

โ ‹ Creating label 'urgent'...
โœ… Label 'urgent' has been successfully created.
```

### 8. Statistics

Display comprehensive repository statistics and insights.

```bash
$ agt stats

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿ“Š Repository Statistics โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Repository: ljlm0402/auto-github-tool

๐Ÿ“ˆ Overview
โญ Stars: 42
๐Ÿด Forks: 8
๐Ÿ‘๏ธ Watchers: 5
๐Ÿ› Open Issues: 3
๐Ÿ”“ Open PRs: 1

๐Ÿ‘ฅ Contributors
Total contributors: 5

Top Contributors:
โ€ข ljlm0402 (245 commits)
โ€ข contributor2 (38 commits)
โ€ข contributor3 (12 commits)

๐Ÿท๏ธ Most Used Labels
โ€ข bug (12 issues)
โ€ข enhancement (8 issues)
โ€ข documentation (5 issues)

๐Ÿ“Š Issue Statistics
โ€ข Total Issues: 45
โ€ข Open: 3
โ€ข Closed: 42
โ€ข Close Rate: 93.3%

๐Ÿ”€ PR Statistics
โ€ข Total PRs: 38
โ€ข Open: 1
โ€ข Merged: 35
โ€ข Closed: 2
โ€ข Merge Rate: 94.6%
```

**Features:**

- โšก **Fast Performance**: Parallel API calls (50-75% faster)
- ๐Ÿ“Š **Comprehensive Data**: Stars, forks, issues, PRs, contributors
- ๐ŸŽฏ **Smart Caching**: Results cached for 5 minutes
- ๐ŸŽจ **Beautiful Output**: Colored and formatted display

### Contributing to the Project

1. **Create an issue**

```bash
agt issue
```

2. **Create a branch**

```bash
agt branch
```

3. **Make changes and commit**

```bash
git add .
git commit -m "feat: Add new feature"
```

4. **Create a PR**
```bash
agt pr
```

## ๐Ÿ‘€ Debug Mode

AGT includes a comprehensive debug mode for troubleshooting issues. When enabled, it shows detailed logs in the console and records them to `~/.agt/agt.log`.

### Enable Debug Mode

```bash
# Set environment variable
AGT_DEBUG=true agt branch

# Or use the --debug flag
agt branch --debug
```

### View Logs

```bash
# View log file location
ls ~/.agt/

# Tail logs in real-time
tail -f ~/.agt/agt.log

# Search logs (macOS/Linux)
grep "ERROR" ~/.agt/agt.log
```

### Log Levels

- **INFO**: General information about operations
- **DEBUG**: Detailed debugging information
- **WARN**: Warning messages
- **ERROR**: Error messages with stack traces

## ๐Ÿ” Troubleshooting

### โŒ Common Errors

1. **Not a Git repository**

```
โŒ This is not a Git repository. Please run 'git init' first.
```

โžก๏ธ Solution: Initialize Git repository with `git init`

2. **GitHub CLI authentication error**

```
โŒ GitHub authentication failed. Please run 'gh auth login' first.
```

โžก๏ธ Solution: Re-authenticate with `gh auth login` or run `agt setup`

3. **GitHub CLI not installed**

```
โŒ GitHub CLI is not installed. Please install it: https://cli.github.com/
```

โžก๏ธ Solution: Install with `brew install gh` (macOS) or from the official website

4. **Network errors**

```
โŒ Network error: Please check your internet connection and try again.
```

โžก๏ธ Solution: AGT automatically retries network operations up to 3 times. If the error persists, check your internet connection

5. **Branch does not exist**

```
โŒ Source branch 'feature/123-...' does not exist
```

โžก๏ธ Solution: Create the branch first with `agt branch`

6. **No commits**

```
โŒ No commits found between 'main' and 'feature/123-...'.
Please commit your changes before creating a PR.
```

โžก๏ธ Solution: Commit your changes before creating a PR

7. **Invalid branch name**
```
โŒ Invalid branch name: Branch names cannot contain shell special characters
```
โžก๏ธ Solution: AGT automatically sanitizes branch names. If you see this error, the issue title may contain forbidden characters

### ๐Ÿ†˜ Getting Help

If you're still experiencing issues:

1. **Run setup wizard**: `agt setup` to verify your environment
2. **Enable debug mode**: `AGT_DEBUG=true agt ` for detailed logs
3. **Check logs**: View `~/.agt/agt.log` for error details
4. **Report issue**: Create an issue on GitHub with the error message and logs

## ๐Ÿค Contributing

Contributions are always welcome! Please feel free to open an issue or submit a pull request.

## ๐Ÿ’ณ License

[MIT](LICENSE)

---


Made with โค๏ธ by AGUMON ๐Ÿฆ–