Skip to content

Add --single flag to disable recursive crawling for single-page mode#44

Merged
YusukeHirao merged 4 commits intomainfrom
claude/fix-single-flag-crawl-v1dvO
Mar 5, 2026
Merged

Add --single flag to disable recursive crawling for single-page mode#44
YusukeHirao merged 4 commits intomainfrom
claude/fix-single-flag-crawl-v1dvO

Conversation

@YusukeHirao
Copy link
Copy Markdown
Member

@YusukeHirao YusukeHirao commented Mar 5, 2026

Summary

This PR introduces a new --single flag to the crawl command that disables recursive crawling, allowing users to crawl only a single page without following links. It also adds validation to warn users when conflicting flags are specified together.

closes: #32

Key Changes

  • New --single flag: When enabled, sets recursive: false to crawl only the specified page(s) without following links
  • Flag precedence: The --single flag takes precedence over the --recursive flag when both are specified
  • List mode compatibility: The --list and --list-file modes already disable recursion; --single is now ignored with a warning when used alongside these flags
  • User warnings: Added console warning when --single is specified together with --list or --list-file to clarify which flag takes effect
  • Comprehensive test coverage: Added 172 lines of test cases covering:
    • --single flag behavior with and without --recursive
    • Interaction with --list mode
    • Warning messages for conflicting flag combinations
    • Pipeline integration test to verify flag propagation

Implementation Details

  • Modified startCrawl() to check flags.single in addition to isList when determining the recursive option
  • Added validation in crawl() function to detect and warn about --single combined with --list or --list-file
  • Updated README with example usage of the new flag

https://claude.ai/code/session_01MtQUvLdJfkZGTaQf6ThhSd

claude added 4 commits March 5, 2026 09:25
--single フラグが CLI 定義に存在するが startCrawl の recursive 判定に
含まれておらず、フラグが無視されていた問題を修正。
isList と同様に flags.single が true の場合は recursive: false を設定する。

Closes #32

https://claude.ai/code/session_01MtQUvLdJfkZGTaQf6ThhSd
- crawl.spec.ts: vi.resetModules() を追加しモジュールキャッシュの問題を解消
- crawl.spec.ts: as never キャストを型安全な CrawlFlags 型に置換
- crawl.spec.ts: 未使用の mockWrite/mockGarbageCollect トップレベル変数を削除
- crawl.spec.ts: --single と --recursive 同時指定のエッジケーステストを追加
- pipeline.spec.ts: --single フラグが startCrawl に正しく伝搬されるテストを追加

https://claude.ai/code/session_01MtQUvLdJfkZGTaQf6ThhSd
- recursive 判定にコメントを追加し、--single が recursive を無効化する
  意図を明確化
- --single と --list/--list-file の同時指定時に警告メッセージを出力
- 同時指定シナリオのテストを追加

https://claude.ai/code/session_01MtQUvLdJfkZGTaQf6ThhSd
例セクションに --single の使用例が欠けていたため追加。

https://claude.ai/code/session_01MtQUvLdJfkZGTaQf6ThhSd
@YusukeHirao YusukeHirao merged commit 53e26b6 into main Mar 5, 2026
3 checks passed
@YusukeHirao YusukeHirao deleted the claude/fix-single-flag-crawl-v1dvO branch March 5, 2026 10:03
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.

Bug: --single フラグが機能しない(再帰クロールが停止しない)

2 participants