Add optional context to PR description generation (#270)

* types: add optional context parameter to generatePullRequestDescription signature

* api: update gitApi to pass optional context to PR description generation

* http: include trimmed context in PR description API request body

* ui: add additional context input for PR generation with desktop disclosure and mobile sheet

* desktop: pass optional context to Tauri generate_pr_description command

* tauri: add optional context parameter and inject into PR description prompt

* server: read optional context from request and inject into PR description prompt

* vscode: update type signature for context parameter (compatibility only)

* fix(vscode): drop context from pr-description payload

Remove context field from PR description payload
Send only base and head to the bridge API for PR descriptions
Clarify payload compatibility across web/desktop environments
This commit is contained in:
Nelson Pires
2026-02-03 13:05:19 +02:00
committed by GitHub
parent 392cd888a8
commit aeec68d224
7 changed files with 139 additions and 19 deletions
+8 -3
View File
@@ -250,17 +250,22 @@ export async function generateCommitMessage(
export async function generatePullRequestDescription(
directory: string,
payload: { base: string; head: string }
payload: { base: string; head: string; context?: string }
): Promise<{ title: string; body: string }> {
const { base, head } = payload;
const { base, head, context } = payload;
if (!base || !head) {
throw new Error('base and head are required');
}
const requestBody: { base: string; head: string; context?: string } = { base, head };
if (context?.trim()) {
requestBody.context = context.trim();
}
const response = await fetch(buildUrl(`${API_BASE}/pr-description`, directory), {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ base, head }),
body: JSON.stringify(requestBody),
});
if (!response.ok) {