Skip to content

Tool to search for issues #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ShreyPaharia
Copy link

@ShreyPaharia ShreyPaharia commented May 23, 2025

Implements #112

@Copilot Copilot AI review requested due to automatic review settings May 23, 2025 18:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for searching GitHub issues alongside the existing code and documentation search tools.

  • Introduces searchIssues in the GitHub client and a searchRepositoryIssues wrapper with formatted output and pagination.
  • Registers new issue-search tools in both the generic and default repo handlers.
  • Updates tests to verify the new tools’ registration and descriptions.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/api/utils/githubClient.ts Added searchIssues to call GitHub’s issues search API
src/api/tools/commonTools.ts Implemented searchRepositoryIssues and name/description generators
src/api/tools/repoHandlers/GenericRepoHandler.ts Registered search_generic_issues tool
src/api/tools/repoHandlers/DefaultRepoHandler.ts Registered default issue search tool with dynamic naming
src/api/tools/index.test.ts Extended tests to include the new issue-search tools
Comments suppressed due to low confidence (2)

src/api/utils/githubClient.ts:288

  • [nitpick] The return type is declared as Promise<any>, which makes callers lose type safety. Define and use an interface for the GitHub issues search response instead of any.
export async function searchIssues(  query: string,

src/api/tools/index.test.ts:63

  • The new searchRepositoryIssues behavior (e.g., no‐results, pagination, error cases) isn’t covered by unit tests. Add tests for those scenarios to ensure formatting and pagination logic works as intended.
search_myrepo_issues: {

Comment on lines +712 to +713
* Search for issues in a GitHub repository
* Supports filtering by issue state and pagination
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The searchRepositoryIssues JSDoc is missing @param tags for each argument. Add parameter descriptions to clarify expected inputs and defaults.

Suggested change
* Search for issues in a GitHub repository
* Supports filtering by issue state and pagination
* Search for issues in a GitHub repository.
* Supports filtering by issue state and pagination.
*
* @param {RepoData} repoData - The repository data object containing owner and repo information.
* @param {string} query - The search query string to filter issues.
* @param {"open" | "closed" | "all"} [state="all"] - The state of issues to filter by. Defaults to "all".
* @param {number} [page=1] - The page number for pagination. Defaults to 1.
* @param {Env} env - The environment object containing configuration and secrets.
* @param {any} ctx - The context object for the request, used for logging and tracing.

Copilot uses AI. Check for mistakes.

* Search for issues in a GitHub repository
* Supports filtering by issue state and pagination
*/
export async function searchRepositoryIssues({
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This function mixes data fetching and text formatting in one large block. Consider extracting the markdown‐generation logic into a helper to improve readability and testability.

Copilot uses AI. Check for mistakes.

owner,
repo,
}: RepoData): string {
return `Search open or closed issues within the GitHub repository: "${owner}/${repo}".`;
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The default description only mentions open/closed states but not pagination or the all option. Align it with the generic tool description to avoid confusion.

Suggested change
return `Search open or closed issues within the GitHub repository: "${owner}/${repo}".`;
return `Search open or closed issues within the GitHub repository: "${owner}/${repo}". Supports pagination and the 'all' option to retrieve all matching issues.`;

Copilot uses AI. Check for mistakes.

@idosal
Copy link
Owner

idosal commented May 28, 2025

Thanks for the contribution @ShreyPaharia!

Did you have a chance to test it out? Did the LLMs use it correctly? Did it help them reach a better answer?

@ShreyPaharia
Copy link
Author

Thanks for the contribution @ShreyPaharia!

Did you have a chance to test it out? Did the LLMs use it correctly? Did it help them reach a better answer?

Welcome @idosal !
This is definitely helpful! Sharing below an example conversation.


User

How to solve the failure in parsing prd for this repo github.com/eyaltoledano/claude-task-master


Cursor

Let me help you investigate this issue. First, I'll try to match the library name to get the correct owner and repo information.

Now that I have confirmed the repository information, let me fetch its documentation to understand what might be causing the parsing failure.

I notice that there's no standard documentation available. Let me search through the repository's code to understand its structure and potential PRD-related files.

I notice that there are some issues accessing the repository. Let me check if there are any open issues that might provide more context about this problem.

Let me check the specific issue about PRD parsing failure to understand the problem better.

Based on the issue and comments, I can help explain the PRD parsing failure and provide a solution. Here are the key points:

  1. Location Requirements:
  • The PRD file must be in one of two locations:
    • Root directory as prd.txt
    • scripts/prd.txt directory
  • The file must be named prd.txt (lowercase) not PRD.txt or prd.md
  1. Known Issues:
  • There are timing out issues with different tools (Roo and others) that don't have the same rules as Cursor
  • The issue occurs with both Anthropic and Perplexity APIs
  • The error manifests as either:
    • MCP error -32001: Request timed out
    • Schema validation errors
    • Client failure code: 499

To solve this issue:

  1. First, ensure your PRD is in the correct location and format:

    • Move your PRD from /specs/design/prd.md to either:
      • /prd.txt (root directory) or
      • /scripts/prd.txt
    • Rename the file to lowercase prd.txt
  2. If you're still experiencing timeouts:

    • Try breaking down your PRD into smaller sections if it's large
    • The example in the issue showed a PRD with 87 lines and 1250 tokens, which should be within limits
    • Consider adding more structure to your PRD to make it easier to parse
  3. If using the CLI:

    • Make sure you're using the latest version (0.13.2 or newer)
    • Try running the command multiple times as there might be intermittent timeout issues
    • Consider using Cursor instead of other tools as it has better timeout handling
  4. If the issue persists:

    • Check that your PRD follows the expected format and structure
    • Try reducing the complexity of your PRD if possible
    • Consider breaking down the PRD parsing into smaller chunks

Would you like me to help you with any specific part of implementing these solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants