Skip to content

CG-12243: Add pagination to SearchFilesByNameTool#893

Draft
codegen-sh[bot] wants to merge 2 commits intodevelopfrom
gen/18011694-27f7-445d-95f7-543f7e13b664
Draft

CG-12243: Add pagination to SearchFilesByNameTool#893
codegen-sh[bot] wants to merge 2 commits intodevelopfrom
gen/18011694-27f7-445d-95f7-543f7e13b664

Conversation

@codegen-sh
Copy link
Contributor

@codegen-sh codegen-sh bot commented Mar 18, 2025

Description

This PR adds pagination to the search_files_by_name tool, similar to how the search tool implements it. This addresses CG-12243.

Changes

  1. Updated SearchFilesByNameInput class to include pagination parameters:

    • Added page parameter (default: 1)
    • Added files_per_page parameter (default: 10)
  2. Updated SearchFilesByNameTool._run() method to pass pagination parameters to the underlying function

  3. Enhanced SearchFilesByNameResultObservation class:

    • Added pagination-related fields (page, total_pages, total_files, files_per_page)
    • Added custom render_as_string() method to display pagination info
  4. Updated search_files_by_name() function to implement pagination:

    • Collects all matching files
    • Sorts them alphabetically
    • Calculates pagination metrics
    • Returns only the files for the requested page

This implementation prevents blowup on larger repos when searching for common file types like *.py.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


codegen-bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

1 participant