Skip to content

Refactor crawl function to Crawler class#19

Merged
saurabhsharma2u merged 2 commits intomainfrom
refactor-crawl-function-889141265657952000
Feb 25, 2026
Merged

Refactor crawl function to Crawler class#19
saurabhsharma2u merged 2 commits intomainfrom
refactor-crawl-function-889141265657952000

Conversation

@saurabhsharma2u
Copy link
Copy Markdown
Contributor

Refactored the crawl function in plugins/core/src/crawler/crawl.ts to reduce complexity. The logic has been moved to a new Crawler class in plugins/core/src/crawler/crawler.ts. This improves code organization and testability while maintaining the existing API and behavior. Confirmed that all tests pass.


PR created automatically by Jules for task 889141265657952000 started by @saurabhsharma2u

@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@saurabhsharma2u saurabhsharma2u marked this pull request as ready for review February 25, 2026 15:16
saurabhsharma2u and others added 2 commits February 25, 2026 07:22
This change extracts the logic from the complex `crawl` function in `plugins/core/src/crawler/crawl.ts` into a new `Crawler` class in `plugins/core/src/crawler/crawler.ts`. This improves maintainability and readability by encapsulating the crawler state and logic in a dedicated class while keeping the `crawl` function as a simple facade for backward compatibility.

- Created `Crawler` class with methods for initialization, queue management, and page processing.
- Moved `CrawlOptions` and `QueueItem` interfaces to `crawler.ts`.
- Updated `crawl.ts` to use `Crawler` class.
- Verified with existing tests in `plugins/core/tests/crawler.test.ts`.
@saurabhsharma2u saurabhsharma2u force-pushed the refactor-crawl-function-889141265657952000 branch from bfff21e to 94190a1 Compare February 25, 2026 15:24
@saurabhsharma2u saurabhsharma2u merged commit 11096aa into main Feb 25, 2026
@saurabhsharma2u saurabhsharma2u deleted the refactor-crawl-function-889141265657952000 branch February 25, 2026 15:24
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