ai-git-tools 2.0.37 → 2.0.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-git-tools",
3
- "version": "2.0.37",
3
+ "version": "2.0.38",
4
4
  "description": "AI-powered Git automation tools for commit messages and PR generation",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -11,13 +11,9 @@ export class GitOperations {
11
11
  */
12
12
  detectReleaseBranches() {
13
13
  try {
14
- // 嘗試同步遠端,失敗就用本機已知的遠端資訊
15
- try {
16
- execSync('git fetch origin', { stdio: 'ignore', timeout: 15000 });
17
- } catch (_) {
18
- // fetch 失敗,繼續使用已經 cache 的遠端分支
19
- }
20
- const branches = execSync('git branch -r', { encoding: 'utf-8' })
14
+ execSync('git fetch origin', { stdio: 'ignore' });
15
+ const branches = execSync('git branch -r')
16
+ .toString()
21
17
  .split('\n')
22
18
  .map((b) => b.trim())
23
19
  .filter((b) => b.startsWith('origin/release-'))
@@ -35,18 +31,12 @@ export class GitOperations {
35
31
  const branches = this.detectReleaseBranches();
36
32
  if (branches.length === 0) return null;
37
33
 
38
- // 優先選月分支(-m),其次週分支(-w),最後 fallback 到全部 release 分支
39
34
  const monthlyBranches = branches.filter((b) => b.includes('-m'));
40
35
  const weeklyBranches = branches.filter((b) => b.includes('-w'));
41
- const priorityBranches =
42
- monthlyBranches.length > 0
43
- ? monthlyBranches
44
- : weeklyBranches.length > 0
45
- ? weeklyBranches
46
- : branches;
36
+ const priorityBranches = monthlyBranches.length > 0 ? monthlyBranches : weeklyBranches;
47
37
 
48
38
  priorityBranches.sort().reverse();
49
- return priorityBranches[0] || null;
39
+ return priorityBranches[0];
50
40
  }
51
41
 
52
42
  /**