ai-git-tools 2.1.8 → 2.1.9

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 CHANGED
@@ -99,7 +99,7 @@ registerCommand(program, 'redmine-update', '分析並更新 Redmine Issue 的開
99
99
  { flags: '--output <file>', description: '保存 preview 草稿 JSON' },
100
100
  { flags: '--apply', description: '套用已審核的草稿' },
101
101
  { flags: '--from <file>', description: '指定要套用的 preview 草稿 JSON' },
102
- { flags: '--force', description: '強制略過衝突與重複同步檢查' },
102
+ { flags: '--force', description: '強制略過 Issue 狀態或內容衝突檢查' },
103
103
  ], redmineUpdateCommand);
104
104
 
105
105
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-git-tools",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "AI-powered Git automation tools for commit messages and PR generation",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -137,7 +137,7 @@ export async function applyRedmineDraft({ draft, client, force = false, onProgre
137
137
  for (const [index, item] of draft.drafts.entries()) {
138
138
  try {
139
139
  onProgress({ phase: 'apply-issue', index: index + 1, total: draft.drafts.length, issueId: item.issueId });
140
- const current = await client.getIssue(item.issueId, { include: 'allowed_statuses,journals' });
140
+ const current = await client.getIssue(item.issueId, { include: 'allowed_statuses' });
141
141
 
142
142
  const statusChanged = item.originalStatusId !== null && current.status?.id !== item.originalStatusId;
143
143
  const descriptionChanged = current.description !== item.originalDescription;
@@ -148,7 +148,7 @@ export function formatRedmineDescription(description = '', source = null) {
148
148
 
149
149
  /**
150
150
  * 格式化 Redmine Issue note
151
- * @param {{issueId: number|string, analysis: object, evidence: object, pullRequest?: object|null, syncId?: string}} input
151
+ * @param {{issue?: object, analysis?: object, evidence?: object, pullRequest?: object|null}} input
152
152
  * @returns {string}
153
153
  */
154
154
  export function formatRedmineNote({ issue = {}, analysis = {}, evidence = {}, pullRequest = null }) {
@@ -188,19 +188,22 @@ export function formatRedmineNote({ issue = {}, analysis = {}, evidence = {}, pu
188
188
 
189
189
  if (evidence.currentBranch || evidence.baseBranch || pullRequest) {
190
190
  const branch = evidence.currentBranch || '—';
191
- const branchUrl = evidence.repository
191
+ const branchUrl = evidence.repository && branch !== '—'
192
192
  ? `https://github.com/${evidence.repository}/tree/${encodeURI(branch)}`
193
193
  : '';
194
+ const base = evidence.baseBranch || '—';
195
+ const baseUrl = evidence.repository && base !== '—'
196
+ ? `https://github.com/${evidence.repository}/tree/${encodeURI(base)}`
197
+ : '';
194
198
  const gitLines = [
195
199
  '### Git',
196
200
  '',
197
201
  `- Branch:${branchUrl ? `[${branch}](${branchUrl})` : `\`\`${branch}\`\``}`,
198
- `- Base:${branchUrl ? `[${evidence.baseBranch || '—'}](https://github.com/${evidence.repository}/tree/${encodeURI(evidence.baseBranch || '')})` : evidence.baseBranch || '—'}`,
202
+ `- Base:${baseUrl ? `[${base}](${baseUrl})` : base}`,
199
203
  ];
200
204
  if (pullRequest) {
201
205
  gitLines.push(
202
- `- PR:${pullRequest.url ? `[${pullRequest.url}](${pullRequest.url})` : `#${pullRequest.number}`}`,
203
- `- PR 狀態:${pullRequest.state || '—'}${pullRequest.mergedAt ? `(合併於 ${pullRequest.mergedAt})` : ''}`
206
+ `- PR:${pullRequest.url ? `[${pullRequest.url}](${pullRequest.url})` : `#${pullRequest.number}`}`
204
207
  );
205
208
  }
206
209
  sections.push(