feat: server-side GitHub search for issue/PR pickers (#1352)

Replace local-only filtering in GitHub issue/PR picker dialogs with
server-side GitHub Search API queries. Search text is sent as a query
parameter to the server, which uses the GitHub Search API
(issuesAndPullRequests endpoint) with repo: qualifiers including fork
network support. Results are debounced at 350ms to respect API rate
limits.

- Add query parameter to GitHubAPI issuesList/prsList interface
- Server routes use Search API when query is present, standard list
  endpoint when absent
- Fork networks handled via repo:owner/repo OR repo:owner/upstream
- PR search fetches full PR details after Search API for head/base/draft
  fields
- Remove local filter memos from all three picker dialogs
- Add debounced search effect with abort controller cleanup
- Update VS Code backend and webview API for parity
- Update search placeholders in all locales

Closes #1350

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Tom Rochette
2026-06-08 15:37:42 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent 5589ca991a
commit 7b1b3167a4
16 changed files with 457 additions and 149 deletions
+43
View File
@@ -105,12 +105,55 @@ export const listIssues = async (
accessToken: string,
directory: string,
page: number = 1,
searchQuery?: string,
): Promise<GitHubIssuesListResult> => {
const repo = await resolveRepoFromDirectory(directory);
if (!repo) {
return { connected: true, repo: null, issues: [] };
}
if (searchQuery) {
const q = `repo:${repo.owner}/${repo.repo} ${searchQuery} type:issue state:open`;
const url = new URL(`${API_BASE}/search/issues`);
url.searchParams.set('q', q);
url.searchParams.set('per_page', '50');
url.searchParams.set('page', String(page));
const resp = await githubFetch(url.toString(), accessToken);
if (resp.status === 401) {
return { connected: false };
}
const json = await jsonOrNull<{ total_count?: number; items?: unknown[] }>(resp);
if (!resp.ok || !json) {
throw new Error('Failed to search issues');
}
const totalCount = typeof json.total_count === 'number' ? json.total_count : 0;
const items = Array.isArray(json.items) ? json.items : [];
const issues = items
.map((entry) => {
const rec = entry && typeof entry === 'object' ? (entry as JsonRecord) : null;
if (!rec || rec.pull_request) return null;
const number = typeof rec.number === 'number' ? rec.number : 0;
if (!number) return null;
const state = readString(rec.state) === 'closed' ? 'closed' : 'open';
return {
number,
title: readString(rec.title) || '',
url: readString(rec.html_url) || '',
state,
author: mapUser(rec.user),
labels: mapLabels(rec.labels),
};
})
.filter(Boolean) as GitHubIssuesListResult['issues'];
const fetchedCount = (page - 1) * 50 + items.length;
const hasMore = fetchedCount < totalCount;
return { connected: true, repo, issues: issues || [], page, hasMore };
}
const url = new URL(`${API_BASE}/repos/${repo.owner}/${repo.repo}/issues`);
url.searchParams.set('state', 'open');
url.searchParams.set('per_page', '50');