@seahworks/branch-cli 1.0.9 → 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.
package/README.md CHANGED
@@ -131,7 +131,8 @@ seahseah-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 @@ seahseah-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
  ### 구성 요소
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seahworks/branch-cli",
3
- "version": "1.0.9",
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`));