@seahworks/branch-cli 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +15 -14
  2. package/package.json +1 -1
  3. package/src/index.js +30 -2
package/README.md CHANGED
@@ -91,7 +91,7 @@ git checkout dev_06MON
91
91
  ### 2. CLI 도구 실행
92
92
 
93
93
  ```bash
94
- seah-branch
94
+ seahseah-branch
95
95
  ```
96
96
 
97
97
  도구가 자동으로 다음을 확인합니다:
@@ -131,7 +131,8 @@ seah-branch
131
131
  생성되는 브랜치는 다음 형식을 따릅니다:
132
132
 
133
133
  ```
134
- {type}/{year}/{module}/{company}/{mmdd}-{sr-number}
134
+ {type}/{year}/{module}/{company}/{mmdd}-{sr-number}-{creator}
135
+
135
136
  ```
136
137
 
137
138
  ### 예시
@@ -139,13 +140,13 @@ seah-branch
139
140
  **티켓 번호가 있는 경우:**
140
141
 
141
142
  ```
142
- feature/2025/appr/AAAA/1229-sr2612-01234
143
+ feature/2025/appr/AAAA/1229-sr2612-01234-honggildong
143
144
  ```
144
145
 
145
146
  **티켓 번호가 없는 경우:**
146
147
 
147
148
  ```
148
- feature/2025/board/etc/1229
149
+ feature/2025/board/etc/1229-honggildong
149
150
  ```
150
151
 
151
152
  ### 구성 요소
@@ -162,7 +163,7 @@ feature/2025/board/etc/1229
162
163
  ### ✅ 정상 진행
163
164
 
164
165
  ```bash
165
- $ -branch
166
+ $ seah-branch
166
167
 
167
168
  🌿 세아웍스 브랜치 생성 도구
168
169
 
@@ -189,7 +190,7 @@ $ -branch
189
190
  ### ❌ dev 브랜치가 아닌 경우
190
191
 
191
192
  ```bash
192
- $ -branch
193
+ $ seah-branch
193
194
 
194
195
  🌿 세아웍스 브랜치 생성 도구
195
196
 
@@ -206,7 +207,7 @@ $ -branch
206
207
  ### ⚠️ Pull이 필요한 경우
207
208
 
208
209
  ```bash
209
- $ -branch
210
+ $ seah-branch
210
211
 
211
212
  🌿 세아웍스 브랜치 생성 도구
212
213
 
@@ -228,7 +229,7 @@ $ -branch
228
229
  ### ⚠️ Push가 필요한 경우
229
230
 
230
231
  ```bash
231
- $ -branch
232
+ $ seah-branch
232
233
 
233
234
  🌿 세아웍스 브랜치 생성 도구
234
235
 
@@ -266,7 +267,7 @@ npm update -g @seahworks/branch-cli
266
267
 
267
268
  ## 문제 해결
268
269
 
269
- ### command not found: -branch
270
+ ### command not found: seah-branch
270
271
 
271
272
  #### Windows - Git Bash
272
273
 
@@ -280,7 +281,7 @@ echo "export PATH=\"$YARN_BIN:\$PATH\"" >> ~/.bashrc
280
281
  source ~/.bashrc
281
282
 
282
283
  # 확인
283
- -branch
284
+ seah-branch
284
285
  ```
285
286
 
286
287
  #### Windows - PowerShell/CMD
@@ -345,19 +346,19 @@ npx @seahworks/branch-cli
345
346
  **Windows - Git Bash:**
346
347
 
347
348
  ```bash
348
- "/c/Users/YourName/AppData/Local/Yarn/bin/-branch"
349
+ "/c/Users/YourName/AppData/Local/Yarn/bin/seah-branch"
349
350
  ```
350
351
 
351
352
  **Windows - PowerShell/CMD:**
352
353
 
353
354
  ```bash
354
- C:\Users\YourName\AppData\Local\Yarn\bin\-branch
355
+ C:\Users\YourName\AppData\Local\Yarn\bin\seah-branch
355
356
  ```
356
357
 
357
358
  **macOS / Linux:**
358
359
 
359
360
  ```bash
360
- $(yarn global bin)/-branch
361
+ $(yarn global bin)/seah-branch
361
362
  ```
362
363
 
363
364
  #### package.json 스크립트
@@ -367,7 +368,7 @@ $(yarn global bin)/-branch
367
368
  ```json
368
369
  {
369
370
  "scripts": {
370
- "branch": "-branch"
371
+ "branch": "seah-branch"
371
372
  }
372
373
  }
373
374
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seahworks/branch-cli",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "세아웍스 Git 브랜치 네이밍 규칙 준수 도구",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -11,6 +11,17 @@ function getTodayMMDD() {
11
11
  return `${month}${day}`;
12
12
  }
13
13
 
14
+ // Git 사용자 이름 가져오기
15
+ function getGitUserName() {
16
+ try {
17
+ const name = execSync("git config user.name", { encoding: "utf-8" }).trim();
18
+ return name;
19
+ } catch (error) {
20
+ console.error(chalk.yellow("⚠️ Git user.name을 가져올 수 없습니다."));
21
+ return null;
22
+ }
23
+ }
24
+
14
25
  // SR/ITS 번호 검증
15
26
  function validateSRNumber(value) {
16
27
  return true;
@@ -164,6 +175,17 @@ async function createBranch() {
164
175
  // 브랜치 검증 및 준비
165
176
  await validateAndPrepareBranch();
166
177
 
178
+ // Git 사용자 이름 가져오기
179
+ const gitUserName = getGitUserName();
180
+ if (!gitUserName) {
181
+ console.log(chalk.red("❌ Git user.name이 설정되지 않았습니다."));
182
+ console.log(chalk.yellow("다음 명령어로 설정하세요:"));
183
+ console.log(chalk.cyan(' git config --global user.name "Your Name"\n'));
184
+ process.exit(1);
185
+ }
186
+
187
+ console.log(chalk.blue(`👤 생성자: ${gitUserName}\n`));
188
+
167
189
  try {
168
190
  // 브랜치 타입 선택
169
191
  const type = await select({
@@ -199,12 +221,18 @@ async function createBranch() {
199
221
  const year = new Date().getFullYear();
200
222
  const date = getTodayMMDD();
201
223
 
224
+ // 사용자 이름을 소문자로 변환 (공백 제거, 특수문자 제거)
225
+ const userName = gitUserName
226
+ .toLowerCase()
227
+ .replace(/\s+/g, "-")
228
+ .replace(/[^a-z0-9-]/g, "");
229
+
202
230
  // SR 번호가 없으면 브랜치명에서 제외
203
231
  let branchName;
204
232
  if (!srNumberInput || srNumberInput.trim() === "") {
205
- branchName = `${type}/${year}/${module}/${company}/${date}`;
233
+ branchName = `${type}/${year}/${module}/${company}/${date}-${userName}`;
206
234
  } else {
207
- branchName = `${type}/${year}/${module}/${company}/${date}-${srNumberInput.toLowerCase()}`;
235
+ branchName = `${type}/${year}/${module}/${company}/${date}-${srNumberInput.toLowerCase()}-${userName}`;
208
236
  }
209
237
 
210
238
  console.log(chalk.yellow(`\n생성할 브랜치: ${branchName}\n`));