diff --git a/packages/cli/src/commands/gh.ts b/packages/cli/src/commands/gh.ts index e452826..e178fa8 100644 --- a/packages/cli/src/commands/gh.ts +++ b/packages/cli/src/commands/gh.ts @@ -100,10 +100,10 @@ export const ghCommand = new Command('gh') ) .addCommand( new Command('search') - .description('Search GitHub issues and PRs') + .description('Search GitHub issues and PRs (defaults to open issues)') .argument('', 'Search query') - .option('--type ', 'Filter by type (issue, pull_request)') - .option('--state ', 'Filter by state (open, closed, merged)') + .option('--type ', 'Filter by type (default: issue)', 'issue') + .option('--state ', 'Filter by state (default: open)', 'open') .option('--author ', 'Filter by author') .option('--label ', 'Filter by labels') .option('--limit ', 'Number of results', Number.parseInt, 10) @@ -142,10 +142,10 @@ export const ghCommand = new Command('gh') spinner.text = 'Searching...'; - // Search + // Search with smart defaults (type: issue, state: open) const results = await ghIndexer.search(query, { - type: options.type as 'issue' | 'pull_request' | undefined, - state: options.state as 'open' | 'closed' | 'merged' | undefined, + type: options.type as 'issue' | 'pull_request', + state: options.state as 'open' | 'closed' | 'merged', author: options.author, labels: options.label, limit: options.limit, diff --git a/packages/subagents/src/github/indexer.ts b/packages/subagents/src/github/indexer.ts index 28e8182..e79dba6 100644 --- a/packages/subagents/src/github/indexer.ts +++ b/packages/subagents/src/github/indexer.ts @@ -177,10 +177,16 @@ export class GitHubIndexer { // Convert back to GitHubSearchResult format and apply filters const results: GitHubSearchResult[] = []; + const seenIds = new Set(); for (const result of vectorResults) { const doc = JSON.parse(result.metadata.document as string) as GitHubDocument; + // Deduplicate by document ID + const docId = `${doc.type}-${doc.number}`; + if (seenIds.has(docId)) continue; + seenIds.add(docId); + // Apply filters if (options.type && doc.type !== options.type) continue; if (options.state && doc.state !== options.state) continue;