From b1a0256235fb731705a983fb1d1efd797bef133f Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 14:24:36 +0100 Subject: [PATCH 01/13] feature-180-improve-ai-pr-descriptions: Enhance file prompt in update_pull_request_description_use_case to emphasize code changes in summaries --- .../usecase/steps/update_pull_request_description_use_case.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/usecase/steps/update_pull_request_description_use_case.ts b/src/data/usecase/steps/update_pull_request_description_use_case.ts index 312d439f5..47f27ddd7 100644 --- a/src/data/usecase/steps/update_pull_request_description_use_case.ts +++ b/src/data/usecase/steps/update_pull_request_description_use_case.ts @@ -161,7 +161,7 @@ ${changesDescription} openaiApiKey: string, openaiModel: string ): Promise { - const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly):\n\n` + + const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight any piece of code mentioned):\n\n` + `File: ${filename}\n` + `Status: ${status}\n` + `Changes: +${additions} -${deletions}\n` + From 6abcddd92335d63e69d146797468d9c2dc334115 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 13:25:14 +0000 Subject: [PATCH 02/13] gh-action: updated compiled files --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 2b285e377..481271af9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -53725,7 +53725,7 @@ ${changesDescription} return patch.split(/(?=@@)/).filter(section => section.trim().length > 0); } async processPatchSection(section, filename, status, additions, deletions, openaiApiKey, openaiModel) { - const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly):\n\n` + + const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight any piece of code mentioned):\n\n` + `File: ${filename}\n` + `Status: ${status}\n` + `Changes: +${additions} -${deletions}\n` + From 927c8116fd67a7d7379194989b0b9f569d1c72ae Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 14:32:53 +0100 Subject: [PATCH 03/13] feature-180-improve-ai-pr-descriptions: add logging for previous and current configurations in Execution class --- src/data/model/execution.ts | 4 +++- src/data/usecase/steps/check_changes_issue_size_use_case.ts | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/data/model/execution.ts b/src/data/model/execution.ts index 57a63ab32..c250e8a0c 100644 --- a/src/data/model/execution.ts +++ b/src/data/model/execution.ts @@ -228,7 +228,7 @@ export class Execution { } this.previousConfiguration = await new ConfigurationHandler().get(this) - + console.log(`Previous configuration: ${JSON.stringify(this.previousConfiguration, null, 2)}`); /** * Get labels of issue @@ -338,5 +338,7 @@ export class Execution { } this.currentConfiguration.branchType = this.issueType + + console.log(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`); } } \ No newline at end of file diff --git a/src/data/usecase/steps/check_changes_issue_size_use_case.ts b/src/data/usecase/steps/check_changes_issue_size_use_case.ts index 25bc891ad..149a34487 100644 --- a/src/data/usecase/steps/check_changes_issue_size_use_case.ts +++ b/src/data/usecase/steps/check_changes_issue_size_use_case.ts @@ -14,7 +14,6 @@ export class CheckChangesIssueSizeUseCase implements ParamUseCase Date: Mon, 24 Mar 2025 13:33:44 +0000 Subject: [PATCH 04/13] gh-action: updated compiled files --- dist/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/index.js b/dist/index.js index 481271af9..601952bb2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -48013,6 +48013,7 @@ class Execution { this.issueNumber = (0, title_utils_1.extractIssueNumberFromPush)(this.commit.branch); } this.previousConfiguration = await new configuration_handler_1.ConfigurationHandler().get(this); + console.log(`Previous configuration: ${JSON.stringify(this.previousConfiguration, null, 2)}`); /** * Get labels of issue */ @@ -48108,6 +48109,7 @@ class Execution { this.hotfix.active = this.pullRequest.base.indexOf(`${this.branches.hotfixTree}/`) > -1; } this.currentConfiguration.branchType = this.issueType; + console.log(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`); }; this.singleAction = singleAction; this.commitPrefixBuilder = commitPrefixBuilder; From dde9fb59a694d7ed82bec40946a0c932a6b4820d Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 14:36:46 +0100 Subject: [PATCH 05/13] feature-180-improve-ai-pr-descriptions: Refactor CheckChangesPullRequestSizeUseCase: remove unnecessary check for undefined parent branch --- .../steps/check_changes_pull_request_size_use_case.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts b/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts index cc3d50b4f..a113c67fa 100644 --- a/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts +++ b/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts @@ -14,12 +14,6 @@ export class CheckChangesPullRequestSizeUseCase implements ParamUseCase Date: Mon, 24 Mar 2025 13:37:34 +0000 Subject: [PATCH 06/13] gh-action: updated compiled files --- dist/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 601952bb2..e54da78a1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -51572,10 +51572,6 @@ class CheckChangesPullRequestSizeUseCase { core.info(`Executing ${this.taskId}.`); const result = []; try { - if (param.currentConfiguration.parentBranch === undefined) { - core.info(`Parent branch is undefined.`); - return result; - } const { size, reason } = await this.branchRepository.getSizeCategoryAndReason(param.owner, param.repo, param.pullRequest.head, param.pullRequest.base, param.sizeThresholds, param.labels, param.tokens.tokenPat); if (param.labels.sizedLabel !== size) { const labelNames = param.labels.currentIssueLabels.filter(name => name !== param.labels.sizedLabel); From f714f3efd25da5501c88f07825a5ff372eee2567 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 14:40:12 +0100 Subject: [PATCH 07/13] feature-180-improve-ai-pr-descriptions: Refactor CheckChangesPullRequestSizeUseCase: Update logging and parameter usage to reflect pull request context --- .../steps/check_changes_pull_request_size_use_case.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts b/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts index a113c67fa..f003690f3 100644 --- a/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts +++ b/src/data/usecase/steps/check_changes_pull_request_size_use_case.ts @@ -31,12 +31,12 @@ export class CheckChangesPullRequestSizeUseCase implements ParamUseCase Date: Mon, 24 Mar 2025 13:41:00 +0000 Subject: [PATCH 08/13] gh-action: updated compiled files --- dist/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index e54da78a1..7b20e9b21 100644 --- a/dist/index.js +++ b/dist/index.js @@ -51576,14 +51576,14 @@ class CheckChangesPullRequestSizeUseCase { if (param.labels.sizedLabel !== size) { const labelNames = param.labels.currentIssueLabels.filter(name => name !== param.labels.sizedLabel); labelNames.push(size); - await this.issueRepository.setLabels(param.owner, param.repo, param.issueNumber, labelNames, param.tokens.token); - console.log(`Updated labels on issue #${param.issueNumber}:`, labelNames); + await this.issueRepository.setLabels(param.owner, param.repo, param.pullRequest.number, labelNames, param.tokens.token); + console.log(`Updated labels on pull request #${param.pullRequest.number}:`, labelNames); result.push(new result_1.Result({ id: this.taskId, success: true, executed: true, steps: [ - `${reason}, so the issue was resized to ${size}.`, + `${reason}, so the pull request was resized to ${size}.`, ], })); } From a086410f360107dd5a58c8ae830dbdfc97d512f6 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 14:46:47 +0100 Subject: [PATCH 09/13] feature-180-improve-ai-pr-descriptions: Add support for push execution context in IssueContentInterface --- src/data/manager/description/base/issue_content_interface.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/data/manager/description/base/issue_content_interface.ts b/src/data/manager/description/base/issue_content_interface.ts index 28672222c..9534ad917 100644 --- a/src/data/manager/description/base/issue_content_interface.ts +++ b/src/data/manager/description/base/issue_content_interface.ts @@ -15,6 +15,8 @@ export abstract class IssueContentInterface extends ContentInterface { number = execution.issue.number } else if (execution.isPullRequest) { number = execution.pullRequest.number + } else if (execution.isPush) { + number = execution.issueNumber } else { return undefined; } @@ -42,6 +44,8 @@ export abstract class IssueContentInterface extends ContentInterface { number = execution.issue.number; } else if (execution.isPullRequest) { number = execution.pullRequest.number; + } else if (execution.isPush) { + number = execution.issueNumber; } else { return undefined; } From 2310944e8798567bfc4c42169ce3f35b7b82672f Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 13:47:36 +0000 Subject: [PATCH 10/13] gh-action: updated compiled files --- dist/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dist/index.js b/dist/index.js index 7b20e9b21..c4e7d7b97 100644 --- a/dist/index.js +++ b/dist/index.js @@ -47517,6 +47517,9 @@ class IssueContentInterface extends content_interface_1.ContentInterface { else if (execution.isPullRequest) { number = execution.pullRequest.number; } + else if (execution.isPush) { + number = execution.issueNumber; + } else { return undefined; } @@ -47540,6 +47543,9 @@ class IssueContentInterface extends content_interface_1.ContentInterface { else if (execution.isPullRequest) { number = execution.pullRequest.number; } + else if (execution.isPush) { + number = execution.issueNumber; + } else { return undefined; } From c5cde1513b70778f698618666267fa8ba31f7811 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 14:49:00 +0100 Subject: [PATCH 11/13] feature-180-improve-ai-pr-descriptions: Enhance file prompt formatting to include code highlighting in summary generation --- .../usecase/steps/update_pull_request_description_use_case.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/usecase/steps/update_pull_request_description_use_case.ts b/src/data/usecase/steps/update_pull_request_description_use_case.ts index 47f27ddd7..4b8bd5f65 100644 --- a/src/data/usecase/steps/update_pull_request_description_use_case.ts +++ b/src/data/usecase/steps/update_pull_request_description_use_case.ts @@ -161,7 +161,7 @@ ${changesDescription} openaiApiKey: string, openaiModel: string ): Promise { - const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight any piece of code mentioned):\n\n` + + const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight with \`\`\`language [new_line] [code here]\`\`\` any piece of code mentioned):\n\n` + `File: ${filename}\n` + `Status: ${status}\n` + `Changes: +${additions} -${deletions}\n` + From c813b7b655f5bc116a281080df5b0799d9efcff7 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 13:49:46 +0000 Subject: [PATCH 12/13] gh-action: updated compiled files --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index c4e7d7b97..8276c98d2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -53729,7 +53729,7 @@ ${changesDescription} return patch.split(/(?=@@)/).filter(section => section.trim().length > 0); } async processPatchSection(section, filename, status, additions, deletions, openaiApiKey, openaiModel) { - const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight any piece of code mentioned):\n\n` + + const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight with \`\`\`language [new_line] [code here]\`\`\` any piece of code mentioned):\n\n` + `File: ${filename}\n` + `Status: ${status}\n` + `Changes: +${additions} -${deletions}\n` + From 7180c5ce74c28dde622c10cd35cf3092593c1e16 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 24 Mar 2025 13:53:20 +0000 Subject: [PATCH 13/13] gh-action: updated compiled files and bumped version to 1.0.45 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 263f706ed..79d6714e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-board-flow", - "version": "1.0.44", + "version": "1.0.45", "description": "Automates branch management, GitHub project linking, and issue/PR tracking with Git-Flow methodology.", "main": "dist/index.js", "scripts": {