Skip to content

Show CLI usage instead of crashing when no URLs are given - #213

Open
sebxt wants to merge 1 commit into
duckduckgo:mainfrom
sebxt:fix/cli-crash-without-urls
Open

sebxt wants to merge 1 commit into
duckduckgo:mainfrom
sebxt:fix/cli-crash-without-urls

Conversation

@sebxt

@sebxt sebxt commented Oct 19, 2026

Copy link
Copy Markdown

figureOut() in cli/crawlConfig.js called crawlConfig.urls.map(...) unconditionally. When no URL is passed (no -u, no -i, no urls in the config file) this threw TypeError: Cannot read properties of undefined (reading 'map'), so the existing program.help() fallback in crawl-cli.js was never reached.

This change only normalizes urls when it is set, and adds a case to tests/cli/crawlConfig.test.js that calls figureOut() with an output path and no URLs.

Before: npm run crawl -- -o ./data prints a TypeError stack trace.
After: it prints the usage text.

Tested with npm run lint and node tests/cli/crawlConfig.test.js (fails before the fix, passes after), plus the rest of npm test.

Fixes #212

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@muodov

muodov commented Oct 21, 2026

Copy link
Copy Markdown
Member

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code review found no issues

No high-confidence issues detected in this change.

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.

crawl-cli throws TypeError instead of printing usage when no URLs are given

2 participants