Skip to content

Extract crawl progress formatting into dedicated module#52

Merged
YusukeHirao merged 4 commits intomainfrom
claude/fix-crawler-progress-display-lXHfq
Mar 9, 2026
Merged

Extract crawl progress formatting into dedicated module#52
YusukeHirao merged 4 commits intomainfrom
claude/fix-crawler-progress-display-lXHfq

Conversation

@YusukeHirao
Copy link
Copy Markdown
Member

@YusukeHirao YusukeHirao commented Mar 7, 2026

Summary

Refactored the crawl progress display formatting logic into a dedicated formatCrawlProgress function, improving code organization and testability.

closes: #37

Key Changes

  • Created new format-crawl-progress.ts module with formatCrawlProgress() function that encapsulates all progress display formatting logic
  • Added comprehensive test suite (format-crawl-progress.spec.ts) with 11 test cases covering:
    • Basic progress display (done/found/remaining counts)
    • External URL tracking
    • Resume offset handling
    • Parallel worker count display
    • Percentage calculation
    • Edge cases (zero totals)
    • Combined scenarios with multiple parameters
  • Updated crawler.ts to use the new formatCrawlProgress() function, replacing inline formatting logic
  • Improved progress display format from done/total(ext)(pct%)[parallel] to done / found (+ext) (pct%) [remaining] [parallel] for better clarity

Implementation Details

  • The function calculates internal vs. external URL counts separately to provide clearer progress information
  • Remaining count is calculated as the sum of internal and external remaining URLs
  • Percentage is calculated based on all URLs (internal + external + resume offset)
  • ANSI color formatting is preserved with bold for main metrics and dim for secondary information
  • Fully documented with JSDoc comments explaining all parameters and behavior

https://claude.ai/code/session_01LZgFU6p94rfq1ea8i2aJai

claude added 4 commits March 6, 2026 09:07
…ning

Change progress format from "Crawling: 8/108(0/0) (7%) [10 parallel]"
to "Crawling: 8 done / 108 found (+0/0 ext) [100 remaining] [10 parallel]"
to clarify that the total is expected to grow during crawling.

Closes #37

https://claude.ai/code/session_01LZgFU6p94rfq1ea8i2aJai
…atCrawlProgress

- Add exact output format test using toBe for regression detection
- Add resumeOffset + externalTotal combined parameter test
- Clean up auto-generated JSDoc @param root0 annotations

https://claude.ai/code/session_01LZgFU6p94rfq1ea8i2aJai
The percentage gives users a quick-glance progress indicator that
complements the "remaining" count. While % can decrease as new URLs
are discovered during crawling, having both metrics together avoids
confusion.

https://claude.ai/code/session_01LZgFU6p94rfq1ea8i2aJai
@YusukeHirao YusukeHirao merged commit d641373 into main Mar 9, 2026
3 checks passed
@YusukeHirao YusukeHirao deleted the claude/fix-crawler-progress-display-lXHfq branch March 9, 2026 08:33
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.

Enhancement(crawler): クロール進捗表示の総ページ数が増え続ける

2 participants