Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/cli/src/commands/gh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('<query>', 'Search query')
.option('--type <type>', 'Filter by type (issue, pull_request)')
.option('--state <state>', 'Filter by state (open, closed, merged)')
.option('--type <type>', 'Filter by type (default: issue)', 'issue')
.option('--state <state>', 'Filter by state (default: open)', 'open')
.option('--author <author>', 'Filter by author')
.option('--label <labels...>', 'Filter by labels')
.option('--limit <number>', 'Number of results', Number.parseInt, 10)
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions packages/subagents/src/github/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,16 @@ export class GitHubIndexer {

// Convert back to GitHubSearchResult format and apply filters
const results: GitHubSearchResult[] = [];
const seenIds = new Set<string>();

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;
Expand Down