openmatrix 0.1.21 → 0.1.22
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.
|
@@ -54,6 +54,18 @@ export declare class GitCommitManager {
|
|
|
54
54
|
analyzeImpactScope(files: string[]): Promise<string[]>;
|
|
55
55
|
/**
|
|
56
56
|
* 生成提交信息
|
|
57
|
+
*
|
|
58
|
+
* 格式规范:
|
|
59
|
+
* <type>: (TASK-XXX) 简短描述
|
|
60
|
+
*
|
|
61
|
+
* - 改动点1
|
|
62
|
+
* - 改动点2
|
|
63
|
+
*
|
|
64
|
+
* 影响范围: 模块/功能
|
|
65
|
+
* 文件改动: 文件1, 文件2
|
|
66
|
+
*
|
|
67
|
+
* Run: run-xxx (可选)
|
|
68
|
+
* Co-Authored-By: OpenMatrix <https://github.com/bigfish1913/openmatrix>
|
|
57
69
|
*/
|
|
58
70
|
generateCommitMessage(info: CommitInfo): string;
|
|
59
71
|
/**
|
|
@@ -118,24 +118,39 @@ class GitCommitManager {
|
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* 生成提交信息
|
|
121
|
+
*
|
|
122
|
+
* 格式规范:
|
|
123
|
+
* <type>: (TASK-XXX) 简短描述
|
|
124
|
+
*
|
|
125
|
+
* - 改动点1
|
|
126
|
+
* - 改动点2
|
|
127
|
+
*
|
|
128
|
+
* 影响范围: 模块/功能
|
|
129
|
+
* 文件改动: 文件1, 文件2
|
|
130
|
+
*
|
|
131
|
+
* Run: run-xxx (可选)
|
|
132
|
+
* Co-Authored-By: OpenMatrix <https://github.com/bigfish1913/openmatrix>
|
|
121
133
|
*/
|
|
122
134
|
generateCommitMessage(info) {
|
|
123
135
|
const lines = [];
|
|
124
|
-
//
|
|
125
|
-
const
|
|
126
|
-
tdd: '
|
|
127
|
-
develop: '
|
|
128
|
-
verify: '
|
|
129
|
-
accept: '
|
|
136
|
+
// 类型映射:根据 phase 确定提交类型
|
|
137
|
+
const phaseToType = {
|
|
138
|
+
tdd: 'test',
|
|
139
|
+
develop: 'feat',
|
|
140
|
+
verify: 'test',
|
|
141
|
+
accept: 'feat'
|
|
130
142
|
};
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
const commitType = phaseToType[info.phase] || 'feat';
|
|
144
|
+
// 标题行 - 限制 50 字符
|
|
145
|
+
let title = info.taskTitle;
|
|
146
|
+
if (title.length > 50) {
|
|
147
|
+
title = title.slice(0, 47) + '...';
|
|
148
|
+
}
|
|
149
|
+
// 格式: feat: (TASK-001) 简短描述
|
|
150
|
+
lines.push(`${commitType}: (${info.taskId}) ${title}`);
|
|
135
151
|
lines.push('');
|
|
136
|
-
// 修改内容
|
|
152
|
+
// 修改内容 - 使用文件名作为改动点
|
|
137
153
|
if (info.changes.length > 0) {
|
|
138
|
-
lines.push('## 修改内容');
|
|
139
154
|
for (const change of info.changes.slice(0, 10)) {
|
|
140
155
|
lines.push(`- ${change}`);
|
|
141
156
|
}
|
|
@@ -146,16 +161,25 @@ class GitCommitManager {
|
|
|
146
161
|
}
|
|
147
162
|
// 影响范围
|
|
148
163
|
if (info.impactScope.length > 0) {
|
|
149
|
-
lines.push(
|
|
150
|
-
|
|
151
|
-
|
|
164
|
+
lines.push(`影响范围: ${info.impactScope.join('、')}`);
|
|
165
|
+
}
|
|
166
|
+
// 文件改动 - 简化显示
|
|
167
|
+
const changedFiles = info.changes.slice(0, 5).map(f => {
|
|
168
|
+
const parts = f.split('/');
|
|
169
|
+
return parts.length > 2 ? parts.slice(-2).join('/') : f;
|
|
170
|
+
});
|
|
171
|
+
if (changedFiles.length > 0) {
|
|
172
|
+
const fileSummary = changedFiles.join(', ');
|
|
173
|
+
const suffix = info.changes.length > 5 ? ` 等 ${info.changes.length} 个文件` : '';
|
|
174
|
+
lines.push(`文件改动: ${fileSummary}${suffix}`);
|
|
175
|
+
}
|
|
176
|
+
lines.push('');
|
|
177
|
+
// Run ID (可选)
|
|
178
|
+
if (info.runId) {
|
|
179
|
+
lines.push(`Run: ${info.runId}`);
|
|
152
180
|
}
|
|
153
|
-
//
|
|
154
|
-
lines.push(
|
|
155
|
-
lines.push(`Task-ID: ${info.taskId}`);
|
|
156
|
-
lines.push(`Run-ID: ${info.runId}`);
|
|
157
|
-
lines.push(`Phase: ${info.phase}`);
|
|
158
|
-
lines.push(`Co-Authored-By: OpenMatrix Agent <agent@openmatrix.dev>`);
|
|
181
|
+
// Co-Author
|
|
182
|
+
lines.push(`Co-Authored-By: OpenMatrix <https://github.com/bigfish1913/openmatrix>`);
|
|
159
183
|
return lines.join('\n');
|
|
160
184
|
}
|
|
161
185
|
/**
|