AGT(Automatic GitHub Tool)는 GitHub Issue를 기반으로 브랜치 관리와 풀 리퀘스트(PR) 생성을 자동화하여 개발자의 생산성을 향상시키고, 브랜치 관리의 일관성을 유지하는 도구입니다.
이 도구를 사용하면 다음과 같은 작업을 빠르게 수행할 수 있습니다:
- 이슈 목록 조회
- 새 이슈 생성 (제목 입력 가능)
- 이슈 기반 브랜치 생성
- PR 생성
- Node.js 14 이상
- GitHub CLI (gh) 설치 필요
- GitHub 계정이 필요합니다.
node -v # 버전 확인
gh --version # 설치 확인
-
GitHub CLI 설치
# Homebrew를 통한 설치 brew install gh
-
GitHub 계정 연동
gh auth login
- 프롬프트에 따라 진행:
? What account do you want to log into?
→GitHub.com
선택? What is your preferred protocol for Git operations?
→HTTPS
선택? Authenticate Git with your GitHub credentials?
→Yes
선택? How would you like to authenticate GitHub CLI?
→Login with a web browser
선택- 표시된 one-time code를 복사
- 자동으로 열리는 브라우저에서 GitHub 로그인
- 복사한 코드 입력하여 인증 완료
- 프롬프트에 따라 진행:
-
AGT 오픈소스 설치
npm install -g auth-github-tool
설치 후 agt 명령어를 사용하여 실행할 수 있습니다.
agt help # 사용 가능한 명령어 목록 출력
agt list # 오픈된 이슈 목록 조회
agt issue # 새 이슈 생성
agt branch # 선택한 이슈 기반 브랜치 생성
agt pr # 현재 브랜치에서 PR 생성
agt label # label 생성
$ agt help
Usage: agt <command> [options]
Commands:
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
Examples:
agt help
agt list
agt issue
agt branch
agt pr
agt label
현재 저장소의 모든 이슈를 번호 순으로 정렬하여 보여줍니다.
$ agt list
=== 📋 Open Issues ===
{issue-number} {issue-title} {issue-label}
...
이슈 생성
$ agt issue
> 📍 Enter issue title: {issue-title}
📌 Available Issue Templates:
1. bug_report.md
2. feature_request.md
3. question.md
> Select a template number or press Enter to skip: {issue-template-number}
// If issue template is not selected (When selected, input items are added based on the contents of the template.)
> 📝 Enter issue description: {issue-description}
> 👥 Enter assignees (comma-separated, or press Enter to skip): {issue-assignees}
> 👥 Assignee set to your account: {your-github-account} (skip)
=== 📋 Available Labels ===
[1] bug
[2] documentation
[3] duplicate
[4] enhancement
[5] good first issue
[6] help wanted
[7] invalid
[8] question
[9] wontfix
> 🏷 Select labels [1...9]: {issue-lables-number}
> 🏷️ Selected Labels: [{issue-labels-name}]
> 📅 Enter milestone (or press Enter to skip): {issue-milestone}
✅ GitHub issue created successfully.
이슈 번호를 입력받아 해당 이슈의 제목을 기반으로 새로운 브랜치를 생성합니다.
- 브랜치 명명 규칙:
{branch-types(feature, bugfix, hotfix, release)}/{issue-number}-{issue-title}
$ agt branch
=== 📋 Open Issues ===
{issue-number} {issue-title} {issue-label}
...
> 🔢 Enter issue number to create branch: {issue-number}
📌 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: {branch-type-number}
✅ Branch '{branch-type}/{issue-number}-{issue-title}' created.
현재 브랜치에서 PR을 자동으로 생성합니다.
$ agt pr
> 📌 Enter PR title: {pull-request-title}
> 📌 Provide a short summary of your changes: {pull-request-summary}
=== 📋 Open Issues ===
> 🔍 Enter the related issue number (e.g., #32): {pull-request-issue-number}
> ✨ Describe the major changes in your PR: {pull-request-changes}
> ✅ Have you tested the changes locally? (yes/no): {pull-request-tested}
> 📏 Does your code follow the project’s style guidelines? (yes/no): {pull-request-guidelines}
> 📖 Have you updated the documentation if necessary? (yes/no): {pull-request-documentation}
> 🔗 Add any additional information (optional): {pull-request-additional}
> 👀 Enter reviewers (comma-separated, or press Enter to skip): {pull-request-reviewers}
> 👥 Enter assignees (comma-separated, or press Enter to skip): {pull-request-assignees}
> 👥 Assignee set to your account: {your-github-account}
=== 📋 Available Labels ===
[1] bug
[2] documentation
[3] duplicate
[4] enhancement
[5] good first issue
[6] help wanted
[7] invalid
[8] question
[9] wontfix
> 🏷 Select labels [1...9]: {issue-lables-number}
> 🏷️ Selected Labels: [{issue-labels-name}]
> 📅 Enter milestone (or press Enter to skip): {pull-request-milestone}
[1] HEAD -> origin/master
[2] development
[3] master
> 🌿 Select base branch: {base-branch-number}
🚀 Pushing branch {currentBranch} to remote repository...
🔄 Creating a new pull request...
✅ Pull request created successfully.
-
Git 저장소가 아닌 경우
Error: Not a git repository. Please run 'git init' first.
➡️ 해결:
git init
명령어로 Git 저장소 초기화 -
GitHub CLI 인증 오류
Error: Please run 'gh auth login' to authenticate with GitHub.
➡️ 해결:
gh auth login
실행하여 재인증 -
소스 브랜치가 없는 경우
Error: Source branch '{branch-name}' does not exist
➡️ 해결: 해당하는 브랜치가 존재하는지 확인
이 프로젝트는 MIT 라이선스를 따릅니다.