ai-git-tools 2.0.31 → 2.0.33

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.31",
3
+ "version": "2.0.33",
4
4
  "description": "AI-powered Git automation tools for commit messages and PR generation",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -114,14 +114,6 @@ export class GitHubAPI {
114
114
  */
115
115
  async fetchTeams(orgName = this.orgName) {
116
116
  try {
117
- // 先檢查認證狀態
118
- const authStatus = this.checkAuth();
119
- if (!authStatus.authenticated) {
120
- log.warning('GitHub CLI 未認證');
121
- log.info('請執行: gh auth login\n');
122
- return { teams: {}, members: [] };
123
- }
124
-
125
117
  log.step(`正在從 GitHub 抓取 ${orgName} 的團隊資訊...`);
126
118
 
127
119
  let teamsJson;
@@ -32,6 +32,20 @@ export class PRWorkflow {
32
32
  * 執行完整工作流程
33
33
  */
34
34
  async execute() {
35
+ // 0. 檢查 GitHub CLI 認證狀態(預覽模式不需要)
36
+ if (!this.config.preview) {
37
+ const authStatus = this.github.checkAuth();
38
+ if (!authStatus.authenticated) {
39
+ this.logger.error('\n❌ GitHub CLI 未認證\n');
40
+ console.log('請先執行認證:');
41
+ console.log(` ${this.logger.colors.green}gh auth login${this.logger.colors.reset}\n`);
42
+ console.log('選擇認證範圍時,請確保包含:');
43
+ console.log(' - repo (必需)');
44
+ console.log(' - read:org (如需使用 reviewer 功能)\n');
45
+ throw new Error('GitHub CLI 未認證,無法創建 PR');
46
+ }
47
+ }
48
+
35
49
  // 1. 驗證環境和分支
36
50
  const { baseBranch, headBranch } = await this.detectAndValidateBranches();
37
51