@gracefullight/validate-branch 1.1.0 → 1.1.1

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
@@ -1,78 +1,78 @@
1
1
  # @gracefullight/validate-branch
2
2
 
3
- > 커스텀 정규식을 지원하는 Git 브랜치 이름 유효성 검사 도구
3
+ > Git branch name validation tool with custom regexp support
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@gracefullight/validate-branch.svg)](https://www.npmjs.com/package/@gracefullight/validate-branch)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- **한국어** | [English](./README.en.md)
8
+ **English** | [한국어](./README.ko.md)
9
9
 
10
- ## 주요 기능
10
+ ## Features
11
11
 
12
- - **유연한 정규식 패턴** - 기본 패턴 또는 커스텀 정규식 사용
13
- - **현재 브랜치 감지** - Git 저장소에서 현재 브랜치 이름 자동 감지
14
- - **설정 파일 지원** - `branch.config.{ts,js,mjs}` 파일에서 패턴 로드
15
- - **CLI 도구** - 명령줄에서 직접 사용 가능
16
- - **상세한 오류 메시지** - 실패 명확한 오류 설명 제공
17
- - **타입스크립트 지원** - 완전한 TypeScript 타입 정의
12
+ - **Flexible Regular Expression Pattern** - Use default pattern or custom regular expression
13
+ - **Current Branch Detection** - Automatically detect current branch name from Git repository
14
+ - **Config File Support** - Load patterns from `branch.config.{ts,js,mjs}` files
15
+ - **CLI Tool** - Use directly from command line
16
+ - **Detailed Error Messages** - Clear error descriptions on validation failure
17
+ - **Full TypeScript Support** - Complete TypeScript type definitions
18
18
 
19
- ## 기본 패턴
19
+ ## Default Pattern
20
20
 
21
- 기본적으로 다음 브랜치 이름이 허용됩니다:
21
+ By default, the following branch names are allowed:
22
22
 
23
- - `main` / `master` - 메인 브랜치
24
- - `develop` / `stage` - 개발/스테이지 브랜치
25
- - `feature/.*` - 기능 브랜치 (예: `feature/login`, `feature/user-auth`)
26
- - `fix/.*` - 버그 수정 브랜치 (예: `fix/memory-leak`, `fix/typo`)
27
- - `hotfix/.*` - 핫픽스 브랜치 (예: `hotfix/critical-bug`)
28
- - `release/.*` - 릴리스 브랜치 (예: `release/v1.0.0`)
23
+ - `main` / `master` - Main branches
24
+ - `develop` / `stage` - Development/staging branches
25
+ - `feature/.*` - Feature branches (e.g., `feature/login`, `feature/user-auth`)
26
+ - `fix/.*` - Bug fix branches (e.g., `fix/memory-leak`, `fix/typo`)
27
+ - `hotfix/.*` - Hotfix branches (e.g., `hotfix/critical-bug`)
28
+ - `release/.*` - Release branches (e.g., `release/v1.0.0`)
29
29
 
30
- ## 설치
30
+ ## Installation
31
31
 
32
32
  ```bash
33
- # pnpm 사용
33
+ # Using pnpm
34
34
  pnpm add @gracefullight/validate-branch
35
35
 
36
- # npm 사용
36
+ # Using npm
37
37
  npm install @gracefullight/validate-branch
38
38
 
39
- # yarn 사용
39
+ # Using yarn
40
40
  yarn add @gracefullight/validate-branch
41
41
  ```
42
42
 
43
- ## 사용법
43
+ ## Usage
44
44
 
45
- ### CLI 사용
45
+ ### CLI Usage
46
46
 
47
47
  ```bash
48
- # 현재 브랜치 검증
48
+ # Validate current branch
49
49
  npx validate-branch
50
50
 
51
- # 특정 브랜치 검증
51
+ # Validate specific branch
52
52
  npx validate-branch --test feature/new-feature
53
53
 
54
- # 커스텀 정규식 사용
54
+ # Use custom regular expression
55
55
  npx validate-branch --regexp "^(main|develop|feature/.+)$"
56
56
  ```
57
57
 
58
- ### 프로그래밍 방식 사용
58
+ ### Programmatic Usage
59
59
 
60
- #### 기본 패턴으로 검증
60
+ #### Validate with Default Pattern
61
61
 
62
62
  ```typescript
63
63
  import { validateBranchName, validateWithDetails } from "@gracefullight/validate-branch";
64
64
 
65
- // 간단한 boolean 반환
65
+ // Simple boolean return
66
66
  const isValid = validateBranchName("feature/new-component");
67
67
  console.log(isValid); // true
68
68
 
69
- // 상세한 결과 반환
69
+ // Detailed result return
70
70
  const result = validateWithDetails("feature/new-component");
71
71
  console.log(result);
72
72
  // { valid: true, branchName: "feature/new-component" }
73
73
  ```
74
74
 
75
- #### 커스텀 정규식 사용
75
+ #### Validate with Custom Regexp
76
76
 
77
77
  ```typescript
78
78
  import { validateBranchName } from "@gracefullight/validate-branch";
@@ -82,16 +82,16 @@ const isValid = validateBranchName("story/US-123-add-user", { customRegexp: cust
82
82
  console.log(isValid); // true
83
83
  ```
84
84
 
85
- #### 현재 브랜치 이름 가져오기
85
+ #### Get Current Branch Name
86
86
 
87
87
  ```typescript
88
88
  import { getCurrentBranchName } from "@gracefullight/validate-branch";
89
89
 
90
90
  const currentBranch = await getCurrentBranchName();
91
- console.log(currentBranch); // "feature/new-component" 또는 null
91
+ console.log(currentBranch); // "feature/new-component" or null
92
92
  ```
93
93
 
94
- #### 설정 파일 로드
94
+ #### Load Config File
95
95
 
96
96
  ```typescript
97
97
  import { loadConfig } from "@gracefullight/validate-branch";
@@ -100,87 +100,87 @@ const config = await loadConfig();
100
100
  console.log(config);
101
101
  // {
102
102
  // pattern: "^(main|develop|feature/.+)$",
103
- // description: "프로젝트 브랜치 네이밍 규칙"
103
+ // description: "Project branch naming rules"
104
104
  // }
105
105
  ```
106
106
 
107
- ## 설정 파일
107
+ ## Configuration File
108
108
 
109
- 프로젝트 루트에 `branch.config.ts` 또는 `branch.config.js` 파일을 생성하여 커스텀 패턴을 정의하세요.
109
+ Create a `branch.config.ts` or `branch.config.js` file in your project root to define custom patterns.
110
110
 
111
- ### TypeScript 설정 (`branch.config.ts`)
111
+ ### TypeScript Config (`branch.config.ts`)
112
112
 
113
113
  ```typescript
114
114
  import type { Config } from "@gracefullight/validate-branch";
115
115
 
116
116
  const config: Config = {
117
117
  pattern: "^(main|develop|feature/.+|fix/.+|refactor/.+)$",
118
- description: "프로젝트 브랜치 네이밍 규칙",
118
+ description: "Project branch naming rules",
119
119
  };
120
120
 
121
121
  export default config;
122
122
  ```
123
123
 
124
- ### JavaScript 설정 (`branch.config.js`)
124
+ ### JavaScript Config (`branch.config.js`)
125
125
 
126
126
  ```javascript
127
127
  module.exports = {
128
128
  pattern: "^(main|develop|feature/.+|fix/.+)$",
129
- description: "프로젝트 브랜치 네이밍 규칙",
129
+ description: "Project branch naming rules",
130
130
  };
131
131
  ```
132
132
 
133
- ### 프리셋 사용 (`branch.config.ts`)
133
+ ### Using Presets (`branch.config.ts`)
134
134
 
135
- 커스텀 패턴 대신 내장 프리셋을 사용할 있습니다.
135
+ You can use built-in presets instead of custom patterns.
136
136
 
137
137
  ```typescript
138
138
  import type { Config } from "@gracefullight/validate-branch";
139
139
 
140
140
  const config: Config = {
141
- preset: "jira", // "gitflow" 또는 "jira"
142
- description: "JIRA 티켓 기반 브랜치 네이밍",
141
+ preset: "jira", // "gitflow" or "jira"
142
+ description: "JIRA ticket-based branch naming",
143
143
  };
144
144
 
145
145
  export default config;
146
146
  ```
147
147
 
148
- **사용 가능한 프리셋:**
148
+ **Available Presets:**
149
149
 
150
- #### `gitflow` (기본값)
150
+ #### `gitflow` (default)
151
151
 
152
- Git Flow 브랜치 전략을 따르는 패턴입니다.
152
+ Pattern following Git Flow branching strategy.
153
153
 
154
- | 상태 | 브랜치 예시 |
155
- |------|------------|
156
- | ✅ 허용 | `main`, `master`, `develop`, `stage` |
157
- | ✅ 허용 | `feature/login`, `feature/user-auth`, `feature/add-payment` |
158
- | ✅ 허용 | `fix/memory-leak`, `fix/typo`, `fix/null-pointer` |
159
- | ✅ 허용 | `hotfix/critical-bug`, `hotfix/security-patch` |
160
- | ✅ 허용 | `release/v1.0.0`, `release/2.3.1` |
161
- | ❌ 거부 | `login`, `bugfix`, `my-branch` (prefix 없음) |
162
- | ❌ 거부 | `feature/`, `fix/` (이름 없음) |
163
- | ❌ 거부 | `Feature/Login`, `FIX/bug` (대문자 prefix) |
154
+ | Status | Branch Examples |
155
+ |--------|-----------------|
156
+ | ✅ Allowed | `main`, `master`, `develop`, `stage` |
157
+ | ✅ Allowed | `feature/login`, `feature/user-auth`, `feature/add-payment` |
158
+ | ✅ Allowed | `fix/memory-leak`, `fix/typo`, `fix/null-pointer` |
159
+ | ✅ Allowed | `hotfix/critical-bug`, `hotfix/security-patch` |
160
+ | ✅ Allowed | `release/v1.0.0`, `release/2.3.1` |
161
+ | ❌ Rejected | `login`, `bugfix`, `my-branch` (no prefix) |
162
+ | ❌ Rejected | `feature/`, `fix/` (no name) |
163
+ | ❌ Rejected | `Feature/Login`, `FIX/bug` (uppercase prefix) |
164
164
 
165
165
  #### `jira`
166
166
 
167
- JIRA 티켓 번호 기반 브랜치 패턴입니다.
167
+ JIRA ticket number-based branch pattern.
168
168
 
169
- | 상태 | 브랜치 예시 |
170
- |------|------------|
171
- | ✅ 허용 | `main`, `master`, `develop`, `stage` |
172
- | ✅ 허용 | `FEATURE-123`, `FEATURE-1`, `FEATURE-99999` |
173
- | ✅ 허용 | `BUG-456`, `STORY-789`, `TASK-101`, `HOTFIX-202` |
174
- | ❌ 거부 | `feature/login` (gitflow 스타일) |
175
- | ❌ 거부 | `FEATURE-ABC` (숫자 아님) |
176
- | ❌ 거부 | `feature-123` (소문자) |
177
- | ❌ 거부 | `JIRA-123/description` (슬래시 포함) |
169
+ | Status | Branch Examples |
170
+ |--------|-----------------|
171
+ | ✅ Allowed | `main`, `master`, `develop`, `stage` |
172
+ | ✅ Allowed | `FEATURE-123`, `FEATURE-1`, `FEATURE-99999` |
173
+ | ✅ Allowed | `BUG-456`, `STORY-789`, `TASK-101`, `HOTFIX-202` |
174
+ | ❌ Rejected | `feature/login` (gitflow style) |
175
+ | ❌ Rejected | `FEATURE-ABC` (not a number) |
176
+ | ❌ Rejected | `feature-123` (lowercase) |
177
+ | ❌ Rejected | `JIRA-123/description` (contains slash) |
178
178
 
179
- ## API 레퍼런스
179
+ ## API Reference
180
180
 
181
181
  ### `validateBranchName(branchName, options?)`
182
182
 
183
- 브랜치 이름이 유효한지 확인합니다.
183
+ Check if a branch name is valid.
184
184
 
185
185
  ```typescript
186
186
  interface ValidateBranchNameOptions {
@@ -194,19 +194,19 @@ function validateBranchName(
194
194
  ): boolean
195
195
  ```
196
196
 
197
- **매개변수:**
198
- - `branchName`: 검증할 브랜치 이름
199
- - `options`: 선택사항, 검증 옵션 객체
200
- - `customRegexp`: 커스텀 정규식 문자열
201
- - `preset`: 프리셋 패턴 (`gitflow` 또는 `jira`, 기본값: `gitflow`)
197
+ **Parameters:**
198
+ - `branchName`: Branch name to validate
199
+ - `options`: Optional, validation options object
200
+ - `customRegexp`: Custom regular expression string
201
+ - `preset`: Preset pattern (`gitflow` or `jira`, default: `gitflow`)
202
202
 
203
- **반환값:** 유효 여부
203
+ **Returns:** Validity status
204
204
 
205
205
  ---
206
206
 
207
207
  ### `validateWithDetails(branchName, options?)`
208
208
 
209
- 상세한 검증 결과를 반환합니다.
209
+ Return detailed validation result.
210
210
 
211
211
  ```typescript
212
212
  function validateWithDetails(
@@ -215,16 +215,16 @@ function validateWithDetails(
215
215
  ): ValidationResult
216
216
  ```
217
217
 
218
- **반환값:**
218
+ **Returns:**
219
219
  ```typescript
220
220
  {
221
221
  valid: boolean;
222
222
  branchName: string;
223
- error?: string; // 실패 오류 메시지
223
+ error?: string; // Error message on failure
224
224
  }
225
225
  ```
226
226
 
227
- **예시:**
227
+ **Example:**
228
228
  ```typescript
229
229
  const result = validateWithDetails("invalid-branch");
230
230
  // {
@@ -238,45 +238,45 @@ const result = validateWithDetails("invalid-branch");
238
238
 
239
239
  ### `getCurrentBranchName()`
240
240
 
241
- 현재 Git 브랜치 이름을 가져옵니다.
241
+ Get current Git branch name.
242
242
 
243
243
  ```typescript
244
244
  function getCurrentBranchName(): Promise<string | null>
245
245
  ```
246
246
 
247
- **반환값:** 현재 브랜치 이름, Git 저장소가 아닌 경우 `null`
247
+ **Returns:** Current branch name, `null` if not in a Git repository
248
248
 
249
249
  ---
250
250
 
251
251
  ### `loadConfig()`
252
252
 
253
- 프로젝트 설정 파일을 로드합니다.
253
+ Load project configuration file.
254
254
 
255
255
  ```typescript
256
256
  function loadConfig(): Promise<Config | null>
257
257
  ```
258
258
 
259
- **설정 파일 탐색 순서:**
259
+ **Config file search order:**
260
260
  1. `branch.config.ts`
261
261
  2. `branch.config.mts`
262
262
  3. `branch.config.js`
263
263
  4. `branch.config.cjs`
264
264
  5. `branch.config.mjs`
265
265
 
266
- **반환값:** 설정 객체 또는 설정 파일이 없는 경우 `null`
266
+ **Returns:** Configuration object, `null` if no config file exists
267
267
 
268
268
  ---
269
269
 
270
- ## 타입 정의
270
+ ## Type Definitions
271
271
 
272
272
  ### `Config`
273
273
 
274
274
  ```typescript
275
275
  interface Config {
276
- pattern?: string; // 단일 정규식 패턴
277
- patterns?: string[]; // 다중 정규식 패턴 (예정)
278
- preset?: "gitflow" | "jira"; // 프리셋 패턴 (기본값: "gitflow")
279
- description?: string; // 설정 설명
276
+ pattern?: string; // Single regex pattern
277
+ patterns?: string[]; // Multiple regex patterns (planned)
278
+ preset?: "gitflow" | "jira"; // Preset pattern (default: "gitflow")
279
+ description?: string; // Config description
280
280
  }
281
281
  ```
282
282
 
@@ -290,11 +290,11 @@ interface ValidationResult {
290
290
  }
291
291
  ```
292
292
 
293
- ## 예제
293
+ ## Examples
294
294
 
295
- ### Git Hooks와 함께 사용
295
+ ### Use with Git Hooks
296
296
 
297
- #### `package.json`에서 husky 설정
297
+ #### With Husky in `package.json`
298
298
 
299
299
  ```json
300
300
  {
@@ -306,7 +306,7 @@ interface ValidationResult {
306
306
  }
307
307
  ```
308
308
 
309
- #### 직접 Git Hooks 사용
309
+ #### Direct Git Hooks
310
310
 
311
311
  ```bash
312
312
  #!/bin/sh
@@ -314,12 +314,12 @@ interface ValidationResult {
314
314
 
315
315
  npx validate-branch
316
316
  if [ $? -ne 0 ]; then
317
- echo "브랜치 이름이 규칙에 맞지 않습니다."
317
+ echo "Branch name does not follow naming conventions."
318
318
  exit 1
319
319
  fi
320
320
  ```
321
321
 
322
- ### GitHub Actions와 함께 사용
322
+ ### Use with GitHub Actions
323
323
 
324
324
  ```yaml
325
325
  name: Branch Validation
@@ -346,7 +346,7 @@ jobs:
346
346
  run: validate-branch --test ${{ github.head_ref }}
347
347
  ```
348
348
 
349
- ### CI/CD 파이프라인에서 사용
349
+ ### Use in CI/CD Pipeline
350
350
 
351
351
  ```yaml
352
352
  # .github/workflows/ci.yml
@@ -362,14 +362,14 @@ jobs:
362
362
  run: npx validate-branch
363
363
  ```
364
364
 
365
- ### ESLint 플러그인과 함께 사용
365
+ ### Use with ESLint Plugin
366
366
 
367
367
  ```javascript
368
368
  // .eslintrc.js
369
369
  const { execSync } = require("child_process");
370
370
 
371
371
  module.exports = {
372
- // ... 기본 설정
372
+ // ... other config
373
373
  rules: {
374
374
  "custom/validate-branch": {
375
375
  meta: {
@@ -401,70 +401,70 @@ module.exports = {
401
401
  };
402
402
  ```
403
403
 
404
- ## 개발
404
+ ## Development
405
405
 
406
- ### 설정
406
+ ### Setup
407
407
 
408
408
  ```bash
409
- # 저장소 클론
409
+ # Clone repository
410
410
  git clone https://github.com/gracefullight/saju.git
411
411
  cd packages/validate-branch
412
412
 
413
- # 의존성 설치
413
+ # Install dependencies
414
414
  pnpm install
415
415
 
416
- # 빌드
416
+ # Build
417
417
  pnpm build
418
418
 
419
- # 테스트
419
+ # Test
420
420
  pnpm test
421
421
 
422
- # 린트
422
+ # Lint
423
423
  pnpm lint
424
424
 
425
- # 포맷
425
+ # Format
426
426
  pnpm lint:fix
427
427
  ```
428
428
 
429
- ### 로컬에서 CLI 테스트
429
+ ### Test CLI Locally
430
430
 
431
431
  ```bash
432
- # 빌드 로컬에서 CLI 테스트
432
+ # After building, test CLI locally
433
433
  node bin/validate-branch.js --test feature/new-feature
434
434
 
435
- # 커스텀 패턴 테스트
435
+ # Test with custom pattern
436
436
  node bin/validate-branch.js --test invalid-name --regexp "^(main|develop)$"
437
437
  ```
438
438
 
439
- ## 기여하기
439
+ ## Contributing
440
440
 
441
- 기여를 환영합니다! Pull Request를 자유롭게 제출해주세요.
441
+ Contributions are welcome! Please feel free to submit a Pull Request.
442
442
 
443
- 1. 저장소 포크
444
- 2. feature 브랜치 생성 (`git checkout -b feature/amazing-feature`)
445
- 3. 변경사항 커밋 (`git commit -m 'Add some amazing feature'`)
446
- 4. 브랜치에 푸시 (`git push origin feature/amazing-feature`)
447
- 5. Pull Request 오픈
443
+ 1. Fork repository
444
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
445
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
446
+ 4. Push to branch (`git push origin feature/amazing-feature`)
447
+ 5. Open a Pull Request
448
448
 
449
- ### 가이드라인
449
+ ### Guidelines
450
450
 
451
- - 기능에 대한 테스트 작성
452
- - 코드 커버리지 유지 또는 개선
453
- - 기존 코드 스타일 따르기 (Biome으로 강제)
454
- - 필요에 따라 문서 업데이트
451
+ - Write tests for new features
452
+ - Maintain or improve code coverage
453
+ - Follow existing code style (enforced by Biome)
454
+ - Update documentation as needed
455
455
 
456
- ## 라이선스
456
+ ## License
457
457
 
458
458
  MIT © [gracefullight](https://github.com/gracefullight)
459
459
 
460
- ## 관련 프로젝트
460
+ ## Related Projects
461
461
 
462
- - [isomorphic-git](https://isomorphic-git.org/) - Git 구현 라이브러리
463
- - [Commander.js](https://commander.js/) - Node.js CLI 프레임워크
464
- - [Chalk](https://chalk.js.org/) - 터미널 문자열 스타일링
462
+ - [isomorphic-git](https://isomorphic-git.org/) - Git implementation library
463
+ - [Commander.js](https://commander.js/) - Node.js CLI framework
464
+ - [Chalk](https://chalk.js.org/) - Terminal string styling
465
465
 
466
- ## 지원
466
+ ## Support
467
467
 
468
- - [문서](https://github.com/gracefullight/saju#readme)
469
- - [이슈 트래커](https://github.com/gracefullight/saju/issues)
470
- - [토론](https://github.com/gracefullight/saju/discussions)
468
+ - [Documentation](https://github.com/gracefullight/saju#readme)
469
+ - [Issue Tracker](https://github.com/gracefullight/saju/issues)
470
+ - [Discussions](https://github.com/gracefullight/saju/discussions)
package/dist/cli.js CHANGED
@@ -1,20 +1,57 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { Command, Option } from "commander";
5
4
  import chalk from "chalk";
5
+ import { Command, Option } from "commander";
6
+
7
+ // src/load-config.ts
8
+ import { readFile } from "fs/promises";
9
+ import { resolve } from "path";
10
+ import { cwd } from "process";
11
+ var CONFIG_FILES = [
12
+ "branch.config.ts",
13
+ "branch.config.mts",
14
+ "branch.config.js",
15
+ "branch.config.cjs",
16
+ "branch.config.mjs"
17
+ ];
18
+ async function loadConfig() {
19
+ for (const file of CONFIG_FILES) {
20
+ const configPath = resolve(cwd(), file);
21
+ try {
22
+ await readFile(configPath, "utf-8");
23
+ if (file.endsWith(".ts") || file.endsWith(".mts")) {
24
+ const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
25
+ return config;
26
+ }
27
+ if (file.endsWith(".mjs")) {
28
+ const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
29
+ return config;
30
+ }
31
+ if (file.endsWith(".js") || file.endsWith(".cjs")) {
32
+ const { default: config } = await import(configPath);
33
+ return config;
34
+ }
35
+ } catch (error) {
36
+ if (error.code !== "ENOENT") {
37
+ console.error(`Error loading config file ${file}:`, error);
38
+ }
39
+ }
40
+ }
41
+ return null;
42
+ }
6
43
 
7
44
  // src/validate-branch-name.ts
8
- import * as git from "isomorphic-git";
9
45
  import * as fs from "fs";
10
- import { cwd } from "process";
46
+ import { cwd as cwd2 } from "process";
47
+ import * as git from "isomorphic-git";
11
48
  var GITFLOW_PATTERN = /^(main|master|develop|stage|feature\/[A-Za-z0-9_-]+|fix\/[A-Za-z0-9_-]+|hotfix\/[A-Za-z0-9_-]+|release\/[A-Za-z0-9_.-]+)$/;
12
49
  var JIRA_PATTERN = /^(main|master|develop|stage|[A-Z]+-[0-9]+)$/;
13
50
  async function getCurrentBranchName() {
14
51
  try {
15
52
  const branch = await git.currentBranch({
16
53
  fs,
17
- dir: cwd(),
54
+ dir: cwd2(),
18
55
  fullname: false
19
56
  });
20
57
  return branch ?? null;
@@ -46,43 +83,6 @@ function validateWithDetails(branchName, options) {
46
83
  };
47
84
  }
48
85
 
49
- // src/load-config.ts
50
- import { readFile } from "fs/promises";
51
- import { resolve } from "path";
52
- import { cwd as cwd2 } from "process";
53
- var CONFIG_FILES = [
54
- "branch.config.ts",
55
- "branch.config.mts",
56
- "branch.config.js",
57
- "branch.config.cjs",
58
- "branch.config.mjs"
59
- ];
60
- async function loadConfig() {
61
- for (const file of CONFIG_FILES) {
62
- const configPath = resolve(cwd2(), file);
63
- try {
64
- await readFile(configPath, "utf-8");
65
- if (file.endsWith(".ts") || file.endsWith(".mts")) {
66
- const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
67
- return config;
68
- }
69
- if (file.endsWith(".mjs")) {
70
- const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
71
- return config;
72
- }
73
- if (file.endsWith(".js") || file.endsWith(".cjs")) {
74
- const { default: config } = await import(configPath);
75
- return config;
76
- }
77
- } catch (error) {
78
- if (error.code !== "ENOENT") {
79
- console.error(`Error loading config file ${file}:`, error);
80
- }
81
- }
82
- }
83
- return null;
84
- }
85
-
86
86
  // src/cli.ts
87
87
  var SUCCESS_CODE = 0;
88
88
  var FAILED_CODE = 1;