ai-git-tools 1.0.5 → 2.0.0
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/bin/cli.js +24 -45
- package/package.json +1 -1
- package/src/commands/commit-all.js +250 -189
- package/src/commands/commit.js +92 -76
- package/src/commands/init.js +33 -131
- package/src/commands/pr.js +121 -237
- package/src/core/ai-client.js +19 -84
- package/src/core/config-loader.js +165 -133
- package/src/core/git-operations.js +90 -201
- package/src/utils/helpers.js +43 -54
- package/src/utils/logger.js +28 -100
- package/src/commands/workflow.js +0 -36
- package/src/core/github-api.js +0 -139
- package/src/index.js +0 -16
package/bin/cli.js
CHANGED
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* AI Git Tools CLI
|
|
5
5
|
*
|
|
6
6
|
* AI-powered Git automation for commit messages and PR generation
|
|
7
|
+
* 完全重写版本基于 scripts/ 原始实现
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { Command } from 'commander';
|
|
10
|
-
import chalk from 'chalk';
|
|
11
11
|
import { commitCommand } from '../src/commands/commit.js';
|
|
12
12
|
import { commitAllCommand } from '../src/commands/commit-all.js';
|
|
13
13
|
import { prCommand } from '../src/commands/pr.js';
|
|
14
|
-
import { workflowCommand } from '../src/commands/workflow.js';
|
|
15
14
|
import { initCommand } from '../src/commands/init.js';
|
|
16
15
|
|
|
17
16
|
const program = new Command();
|
|
@@ -19,68 +18,48 @@ const program = new Command();
|
|
|
19
18
|
program
|
|
20
19
|
.name('ai-git-tools')
|
|
21
20
|
.description('AI-powered Git automation tools')
|
|
22
|
-
.version('
|
|
21
|
+
.version('2.0.0');
|
|
23
22
|
|
|
24
23
|
// Init 命令
|
|
25
24
|
program
|
|
26
25
|
.command('init')
|
|
27
|
-
.description('
|
|
26
|
+
.description('初始化配置文件 (.ai-git-config.mjs)')
|
|
28
27
|
.action(initCommand);
|
|
29
28
|
|
|
30
29
|
// Commit 命令
|
|
31
30
|
program
|
|
32
31
|
.command('commit')
|
|
33
|
-
.description('
|
|
34
|
-
.option('
|
|
35
|
-
.option('-v, --verbose', '
|
|
36
|
-
.option('--max-diff <number>', '最大 diff
|
|
37
|
-
.option('--max-retries <number>', '
|
|
32
|
+
.description('AI 自动生成 commit message 并提交')
|
|
33
|
+
.option('--model <model>', '指定 AI 模型')
|
|
34
|
+
.option('-v, --verbose', '显示详细输出')
|
|
35
|
+
.option('--max-diff <number>', '最大 diff 长度')
|
|
36
|
+
.option('--max-retries <number>', '最大重试次数')
|
|
38
37
|
.action(commitCommand);
|
|
39
38
|
|
|
40
39
|
// Commit All 命令
|
|
41
40
|
program
|
|
42
41
|
.command('commit-all')
|
|
43
|
-
.
|
|
44
|
-
.
|
|
45
|
-
.option('-
|
|
46
|
-
.option('-
|
|
47
|
-
.option('--max-
|
|
48
|
-
.option('--max-retries <number>', '最大重試次數', parseInt)
|
|
42
|
+
.description('智能分析所有变更并自动分组提交')
|
|
43
|
+
.option('--model <model>', '指定 AI 模型')
|
|
44
|
+
.option('-v, --verbose', '显示详细输出')
|
|
45
|
+
.option('--max-diff <number>', '最大 diff 长度')
|
|
46
|
+
.option('--max-retries <number>', '最大重试次数')
|
|
49
47
|
.action(commitAllCommand);
|
|
50
48
|
|
|
51
49
|
// PR 命令
|
|
52
50
|
program
|
|
53
51
|
.command('pr')
|
|
54
|
-
.description('
|
|
55
|
-
.option('
|
|
56
|
-
.option('
|
|
57
|
-
.option('
|
|
58
|
-
.option('--
|
|
59
|
-
.option('--
|
|
60
|
-
.option('--
|
|
61
|
-
.option('--
|
|
62
|
-
.option('--auto-
|
|
52
|
+
.description('AI 自动生成 PR 并创建 Pull Request')
|
|
53
|
+
.option('--base <branch>', '指定目标分支')
|
|
54
|
+
.option('--head <branch>', '指定来源分支')
|
|
55
|
+
.option('--model <model>', '指定 AI 模型')
|
|
56
|
+
.option('--org <org-name>', '指定 GitHub 组织名称')
|
|
57
|
+
.option('--draft', '创建草稿 PR')
|
|
58
|
+
.option('--preview', '仅预览 PR 内容,不实际创建')
|
|
59
|
+
.option('--no-confirm', '跳过确认直接创建')
|
|
60
|
+
.option('--auto-reviewers', '自动选择 reviewers')
|
|
61
|
+
.option('--auto-labels', '自动添加 Labels')
|
|
63
62
|
.option('--no-labels', '不添加 Labels')
|
|
64
|
-
.option('--org <name>', 'GitHub 組織名稱')
|
|
65
63
|
.action(prCommand);
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
program
|
|
69
|
-
.command('workflow')
|
|
70
|
-
.alias('wf')
|
|
71
|
-
.description('完整工作流程:commit-all + pr')
|
|
72
|
-
.option('-m, --model <model>', '指定 AI 模型')
|
|
73
|
-
.option('-v, --verbose', '顯示詳細輸出')
|
|
74
|
-
.option('-b, --base <branch>', 'PR 目標分支')
|
|
75
|
-
.option('--draft', '創建草稿 PR')
|
|
76
|
-
.option('--auto-reviewers', '自動選擇 reviewers')
|
|
77
|
-
.option('--auto-labels', '自動添加 Labels')
|
|
78
|
-
.action(workflowCommand);
|
|
79
|
-
|
|
80
|
-
// 解析命令列參數
|
|
81
|
-
program.parse(process.argv);
|
|
82
|
-
|
|
83
|
-
// 如果沒有提供命令,顯示幫助
|
|
84
|
-
if (!process.argv.slice(2).length) {
|
|
85
|
-
program.outputHelp();
|
|
86
|
-
}
|
|
65
|
+
program.parse();
|