Skip to content

Commit e706d60

Browse files
kimchanhyung98claudeLeeByeongMuk
committed
docs(husky): restructure guide into separate validation documentation
- Split husky-guide.md into branch-name-guide.md and commit-message-guide.md - Add dependabot branch type support - Allow underscore (_) character in branch names - Update validation scripts and GitHub Actions workflow Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Co-Authored-By: LeeByeongMuk <mansogod@gmail.com>
1 parent 4800329 commit e706d60

File tree

6 files changed

+170
-117
lines changed

6 files changed

+170
-117
lines changed

.github/docs/branch-name-guide.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66

77
## 허용 타입
88

9-
| 타입 | 설명 | 예시 |
10-
|------------|----------------------|----------------------------------|
11-
| `feature` | 새로운 기능 개발 | `feature/user-authentication` |
12-
| `fix` | 버그 수정 | `fix/login-bug` |
13-
| `hotfix` | 긴급 버그 수정 | `hotfix/critical-security-issue` |
14-
| `release` | 릴리스 준비 | `release/v1.0.0` |
15-
| `refactor` | 코드 리팩토링 | `refactor/auth-logic` |
16-
| `docs` | 문서 업데이트 | `docs/installation-guide` |
17-
| `test` | 테스트 추가 | `test/unit-tests` |
18-
| `chore` | 유지보수 작업 | `chore/update-deps` |
19-
| `style` | 스타일 개선 | `style/format-code` |
20-
| `copilot` | GitHub Copilot 지원 개발 | `copilot/add-validation` |
21-
| `claude` | Claude AI 지원 개발 | `claude/refactor-api` |
9+
| 타입 | 설명 | 예시 |
10+
|--------------|----------------------|----------------------------------|
11+
| `feature` | 새로운 기능 개발 | `feature/user-authentication` |
12+
| `fix` | 버그 수정 | `fix/login-bug` |
13+
| `hotfix` | 긴급 버그 수정 | `hotfix/critical-security-issue` |
14+
| `release` | 릴리스 준비 | `release/v1.0.0` |
15+
| `refactor` | 코드 리팩토링 | `refactor/auth-logic` |
16+
| `docs` | 문서 업데이트 | `docs/installation-guide` |
17+
| `test` | 테스트 추가 | `test/unit-tests` |
18+
| `chore` | 유지보수 작업 | `chore/update-deps` |
19+
| `style` | 스타일 개선 | `style/format-code` |
20+
| `copilot` | GitHub Copilot 지원 개발 | `copilot/add-validation` |
21+
| `claude` | Claude AI 지원 개발 | `claude/refactor-api` |
22+
| `dependabot` | 의존성 업데이트 | `dependabot/npm_and_yarn` |
2223

2324
## 보호 브랜치 (검사 제외)
2425

@@ -30,7 +31,7 @@
3031

3132
- **타입**: 위 표의 허용된 타입 중 하나 사용
3233
- **구분자**: `/` (슬래시) 사용
33-
- **허용 문자**: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.)
34+
- **허용 문자**: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.), 언더바(_)
3435

3536
#### 2단계 형식 (기본)
3637

@@ -59,7 +60,6 @@
5960
```bash
6061
❌ Feature/Frontend/User-auth # 타입, 도메인, 설명에 대문자 사용 금지
6162
❌ my-feature # 타입 누락
62-
❌ feature/add_function # 언더스코어 사용 금지
6363
❌ feature/a/b/c # 4단계 이상 금지
6464
❌ feature/ # 설명 누락
6565
```

.github/workflows/branch-name-check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
fi
2424
2525
# 허용된 타입
26-
VALID_TYPES="feature|fix|hotfix|release|refactor|docs|test|chore|style|copilot|claude"
26+
VALID_TYPES="feature|fix|hotfix|release|refactor|docs|test|chore|style|copilot|claude|dependabot"
2727
2828
# 패턴: type/description 또는 type/domain/description
29-
# 허용: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.)
30-
PATTERN="^(${VALID_TYPES})/[a-z0-9][a-z0-9.-]*(/[a-z0-9][a-z0-9.-]*)?$"
29+
# 허용: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.), 언더바(_)
30+
PATTERN="^(${VALID_TYPES})/[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)?$"
3131
3232
if [[ ! "$BRANCH" =~ $PATTERN ]]; then
3333
echo "❌ Invalid branch name: $BRANCH"

.husky/docs/branch-name-guide.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# 브랜치명 검증 가이드
2+
3+
**실행 시점**: `git push` 시 (푸시 전)
4+
**스크립트**: `.husky/validate-branch.cjs`
5+
**형식**: `<type>/<description>` 또는 `<type>/<domain>/<description>`
6+
**허용 문자**: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.), 언더바(_)
7+
8+
## 허용 타입
9+
10+
| 타입 | 설명 | 예시 |
11+
|--------------|----------------------|----------------------------------|
12+
| `feature` | 새로운 기능 개발 | `feature/user-authentication` |
13+
| `fix` | 버그 수정 | `fix/login-bug` |
14+
| `hotfix` | 긴급 버그 수정 | `hotfix/critical-security-issue` |
15+
| `release` | 릴리스 준비 | `release/v1.0.0` |
16+
| `refactor` | 코드 리팩토링 | `refactor/auth-logic` |
17+
| `docs` | 문서 업데이트 | `docs/installation-guide` |
18+
| `test` | 테스트 추가 | `test/unit-tests` |
19+
| `chore` | 유지보수 작업 | `chore/update-deps` |
20+
| `style` | 스타일 개선 | `style/format-code` |
21+
| `copilot` | GitHub Copilot 지원 개발 | `copilot/add-validation` |
22+
| `claude` | Claude AI 지원 개발 | `claude/refactor-api` |
23+
| `dependabot` | 의존성 업데이트 | `dependabot/npm_and_yarn` |
24+
25+
## 보호 브랜치 (직접 푸시 허용)
26+
27+
`main`, `master`, `develop`, `staging`
28+
29+
## 브랜치명 형식
30+
31+
### 2단계 형식 (기본)
32+
33+
```bash
34+
✅ feature/user-authentication
35+
✅ fix/404-error
36+
✅ copilot/add-validation
37+
✅ claude/refactor-api
38+
✅ hotfix/security-patch-2024
39+
✅ release/1.0.0
40+
✅ dependabot/npm_and_yarn/turbo-2.7.3
41+
```
42+
43+
### 3단계 형식 (도메인 포함)
44+
45+
```bash
46+
✅ feature/frontend/user-authentication
47+
✅ fix/api/null-response
48+
✅ refactor/backend/auth-logic
49+
✅ docs/api/endpoint-guide
50+
✅ test/integration/payment-flow
51+
```
52+
53+
### ❌ 잘못된 형식
54+
55+
```bash
56+
Feature/Frontend/User-auth # 대문자 사용 금지
57+
my-feature # 타입 누락
58+
feature/a/b/c # 4단계 이상 금지
59+
feature/ # 설명 누락
60+
```
61+
62+
## 작명 규칙
63+
64+
1. **소문자만 사용**: `Feature` ❌ → `feature`
65+
2. **명확한 설명**: `fix/bug` ❌ → `fix/login-validation-error`
66+
3. **하이픈으로 단어 구분**: `userauth` ❌ → `user-authentication`
67+
4. **간결하게**: `feature/add-new-user-authentication-system-for-web`
68+
`feature/user-authentication`
69+
70+
## 검증 우회
71+
72+
```bash
73+
# 긴급 상황에서만 사용
74+
git push --no-verify
75+
```
76+
77+
⚠️ **주의**: GitHub Actions에서는 우회할 수 없으므로 규칙을 준수하세요.
78+
79+
## 다중 검증 계층
80+
81+
| 계층 | 시점 | 우회 가능 여부 |
82+
|----------------|-----------------|----------------------------|
83+
| 로컬 Husky | `git push` 실행 시 |`--no-verify` 플래그로 우회 가능 |
84+
| GitHub Actions | PR 생성/수정 시 | ❌ 필수 체크 (우회 불가) |
85+
86+
GitHub Actions 검증은 `.github/workflows/branch-name-check.yml`에서 실행됩니다.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# 커밋 메시지 검증 가이드
2+
3+
**실행 시점**: `git commit` 시 (커밋 생성 전)
4+
**스크립트**: `.husky/validate-commit.cjs`
5+
**형식**: `<type>(scope): <subject>` 또는 `<type>: <subject>`
6+
7+
## 허용 타입
8+
9+
| 타입 | 설명 | 예시 |
10+
|------------|------------------|-------------------------------|
11+
| `feat` | 새로운 기능 추가 | `feat: 사용자 인증 추가` |
12+
| `fix` | 버그 수정 | `fix(api): null 응답 처리` |
13+
| `docs` | 문서 수정 | `docs: 설치 가이드 업데이트` |
14+
| `style` | 코드 스타일 변경 | `style: 코드 포맷팅` |
15+
| `refactor` | 코드 리팩토링 | `refactor(auth): 로직 개선` |
16+
| `test` | 테스트 추가/수정 | `test: 유닛 테스트 추가` |
17+
| `chore` | 빌드/설정 변경 | `chore: 의존성 업데이트` |
18+
| `build` | 빌드 시스템/외부 의존성 변경 | `build: webpack 설정 업데이트` |
19+
| `ci` | CI 설정 파일/스크립트 변경 | `ci: GitHub Actions 워크플로우 추가` |
20+
| `revert` | 이전 커밋 되돌리기 | `revert: feat(auth) 커밋 되돌림` |
21+
22+
## 형식 규칙
23+
24+
### ✅ 올바른 형식
25+
26+
```bash
27+
feat: 사용자 인증 추가
28+
feat(auth): JWT 토큰 검증 추가
29+
fix(api): null 응답 처리
30+
docs: 설치 가이드 업데이트
31+
```
32+
33+
### ❌ 잘못된 형식
34+
35+
```bash
36+
Add feature # 타입 누락
37+
feat add feature # 콜론 누락
38+
feat(): 기능 추가 # 빈 scope
39+
FEAT: 기능 추가 # 대문자 사용 금지
40+
```
41+
42+
## Scope (선택사항)
43+
44+
Scope는 변경 범위를 명시합니다:
45+
- `feat(api): REST API 추가`
46+
- `fix(auth): 로그인 버그 수정`
47+
- `refactor(ui): 컴포넌트 구조 개선`
48+
49+
## Subject 작성 규칙
50+
51+
1. **명령형 현재 시제 사용**: "추가했음" ❌ → "추가" ✅
52+
2. **첫 글자 소문자**: "추가" ✅ (영어: "add" ✅)
53+
3. **마침표 사용 안 함**: "기능 추가." ❌ → "기능 추가" ✅
54+
4. **50자 이내 권장**: 간결하고 명확하게
55+
56+
## 검증 우회
57+
58+
```bash
59+
# 긴급 상황에서만 사용
60+
git commit --no-verify -m "message"
61+
```
62+
63+
⚠️ **주의**: 가급적 사용하지 말고, 규칙을 준수하세요.

.husky/husky-guide.md

Lines changed: 0 additions & 96 deletions
This file was deleted.

.husky/validate-branch.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const {execSync} = require('child_process');
44

55
// 허용 규칙
6-
const validTypes = ['feature', 'fix', 'hotfix', 'release', 'refactor', 'docs', 'test', 'chore', 'style', 'copilot', 'claude'];
6+
const validTypes = ['feature', 'fix', 'hotfix', 'release', 'refactor', 'docs', 'test', 'chore', 'style', 'copilot', 'claude', 'dependabot'];
77
const validPattern = '<type>/<description> 또는 <type>/<domain>/<description>';
88

99
// 현재 브랜치명 확인
@@ -22,8 +22,8 @@ if (protectedBranches.includes(currentBranch)) {
2222
}
2323

2424
// 패턴: `type/description` 또는 `type/domain/description`
25-
// 허용: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.)
26-
const branchPattern = new RegExp(`^(${validTypes.join('|')})\\/[a-z0-9][a-z0-9.-]*(\\/[a-z0-9][a-z0-9.-]*)?$`);
25+
// 허용: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.), 언더바(_)
26+
const branchPattern = new RegExp(`^(${validTypes.join('|')})\\/[a-z0-9][a-z0-9._-]*(\\/[a-z0-9][a-z0-9._-]*)?$`);
2727
if (!branchPattern.test(currentBranch)) {
2828
console.error(`* 잘못된 형식 : ${currentBranch}`);
2929
console.error(`* 올바른 형식 : ${validPattern}`);

0 commit comments

Comments
 (0)