mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 16:02:35 +00:00
Add linked issue guidance and ELI5 sections to PR generation prompts (#12613)
* Add linked issue guidance and ELI5 sections to PR generation prompts Include linked GitHub issues in PR descriptions with Fixes/Refs guidance, and require ELI5 Problem and Solution sections before implementation details. Tests verify linked issue substitution and prompt structure enforcement. * Include linked issue details in PR description generation - Fetch the linked GitHub/GitLab issue title and body so generated PRs reference real issue context instead of just a number - Use provider-specific reference syntax (Fixes/Refs, Closes/Related to, AB#) and label the issue by the active provider - Feed issue title and description into the generation prompt while treating them as untrusted context, never as instructions - Fall back to a cached work-item title when the provider lookup fails, and skip cross-provider issue attachment
This commit is contained in:
@@ -111,11 +111,15 @@ describe('issue source operations', () => {
|
||||
title: 'Use upstream issues',
|
||||
state: 'open',
|
||||
html_url: 'https://github.com/stablyai/orca/issues/923',
|
||||
labels: []
|
||||
labels: [],
|
||||
body: 'The issue body'
|
||||
})
|
||||
})
|
||||
|
||||
await expect(getIssue('/repo-root', 923)).resolves.toMatchObject({ number: 923 })
|
||||
await expect(getIssue('/repo-root', 923)).resolves.toMatchObject({
|
||||
number: 923,
|
||||
description: 'The issue body'
|
||||
})
|
||||
expect(ghExecFileAsyncMock).toHaveBeenCalledWith(
|
||||
['api', '--cache', '300s', 'repos/stablyai/orca/issues/923'],
|
||||
{ cwd: '/repo-root', host: 'github.com' }
|
||||
|
||||
@@ -87,7 +87,7 @@ export async function getIssue(
|
||||
}
|
||||
// Fallback for non-GitHub remotes
|
||||
const { stdout } = await ghExecFileAsync(
|
||||
['issue', 'view', String(issueNumber), '--json', 'number,title,state,url,labels'],
|
||||
['issue', 'view', String(issueNumber), '--json', 'number,title,state,url,labels,body'],
|
||||
ghOptions
|
||||
)
|
||||
const data = JSON.parse(stdout)
|
||||
|
||||
@@ -133,13 +133,15 @@ export function mapIssueInfo(data: {
|
||||
url?: string
|
||||
html_url?: string
|
||||
labels?: { name: string }[]
|
||||
body?: string | null
|
||||
}): IssueInfo {
|
||||
return {
|
||||
number: data.number,
|
||||
title: data.title,
|
||||
state: data.state?.toLowerCase() === 'open' ? 'open' : 'closed',
|
||||
url: data.html_url ?? data.url ?? '',
|
||||
labels: (data.labels || []).map((l) => l.name)
|
||||
labels: (data.labels || []).map((l) => l.name),
|
||||
...(typeof data.body === 'string' ? { description: data.body } : {})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user