ai-git-tools 2.0.11 → 2.0.12
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
package/src/commands/pr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PR 命令 - 完整複製自 scripts/ai-auto-pr.mjs
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* 使用 pr-modules 的完整邏輯(從 scripts/ai-pr-modules 複製)
|
|
5
5
|
* 確保功能與 scripts 版本完全相同
|
|
6
6
|
*/
|
|
@@ -22,6 +22,12 @@ export async function prCommand() {
|
|
|
22
22
|
// 載入配置(使用 scripts/ 的配置載入邏輯)
|
|
23
23
|
const config = await loadConfig();
|
|
24
24
|
|
|
25
|
+
if (config.output.verbose) {
|
|
26
|
+
console.log('📋 使用配置:');
|
|
27
|
+
console.log(` AI Model: ${config.ai.model}`);
|
|
28
|
+
console.log(` Max Diff Length: ${config.ai.maxDiffLength}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
// 執行工作流程(使用 scripts/ 的完整工作流)
|
|
26
32
|
const workflow = new PRWorkflow(config);
|
|
27
33
|
await workflow.execute();
|
|
@@ -47,9 +47,6 @@ export function parseCliArgs() {
|
|
|
47
47
|
case '--auto-labels':
|
|
48
48
|
config.autoLabels = true;
|
|
49
49
|
break;
|
|
50
|
-
case '--no-labels':
|
|
51
|
-
config.autoLabels = false;
|
|
52
|
-
break;
|
|
53
50
|
case '--help':
|
|
54
51
|
showHelp();
|
|
55
52
|
process.exit(0);
|
|
@@ -120,8 +117,7 @@ function showHelp() {
|
|
|
120
117
|
--preview 僅預覽 PR 內容,不實際創建
|
|
121
118
|
--no-confirm 跳過確認直接創建
|
|
122
119
|
--interactive-reviewers 啟用互動式 reviewer 選擇(預設啟用)
|
|
123
|
-
--auto-labels
|
|
124
|
-
--no-labels 不添加 Labels
|
|
120
|
+
--auto-labels 自動添加 Labels(預設啟用)
|
|
125
121
|
--help 顯示此說明
|
|
126
122
|
|
|
127
123
|
範例:
|
|
@@ -8,7 +8,8 @@ import { colors } from '../utils/constants.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export class GitHubAPI {
|
|
10
10
|
constructor(config = {}) {
|
|
11
|
-
|
|
11
|
+
// 如果沒有提供 orgName 或為空字串,則不設置默認值
|
|
12
|
+
this.orgName = config.orgName || null;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -80,6 +81,13 @@ export class GitHubAPI {
|
|
|
80
81
|
* 從 GitHub 抓取組織的團隊列表
|
|
81
82
|
*/
|
|
82
83
|
async fetchTeams(orgName = this.orgName) {
|
|
84
|
+
// 如果沒有 orgName,直接返回空結果
|
|
85
|
+
if (!orgName || orgName.trim() === '') {
|
|
86
|
+
log.warning('未設置 GitHub 組織名稱');
|
|
87
|
+
log.info('請在 .ai-pr-config.mjs 中設置 github.orgName 或使用 --org 參數\n');
|
|
88
|
+
return { teams: {}, members: [] };
|
|
89
|
+
}
|
|
90
|
+
|
|
83
91
|
try {
|
|
84
92
|
// 先檢查認證狀態
|
|
85
93
|
const authStatus = this.checkAuth();
|