Skip to content

refactor: modularize CLI and adopt argparse subparsers#1

Open
flitzrrr wants to merge 2 commits into
feature/authenticated-crawlingfrom
feature/cli-architecture-refactor
Open

refactor: modularize CLI and adopt argparse subparsers#1
flitzrrr wants to merge 2 commits into
feature/authenticated-crawlingfrom
feature/cli-architecture-refactor

Conversation

@flitzrrr
Copy link
Copy Markdown
Owner

@flitzrrr flitzrrr commented Feb 27, 2026

Stack position

This is PR 2 of 2 in the fork-native stack.

Summary

Implements the architecture follow-up from reviews/pr2-review.md.

Changes

  • Split crawler/cli.py into focused modules:
    • crawler/cli_auth.py
    • crawler/cli_output.py
    • crawler/cli_config.py
    • crawler/cli_parsers.py
  • Switched crawl command routing to argparse subparsers (capture-auth).
  • Preserved backward-compatible CLI UX (crawl <url> still works).
  • Preserved compatibility wrappers in crawler/cli.py for existing tests/internals.

Validation

  • uv run --extra dev --with pytest-cov python -m pytest --cov=crawler --cov-report=term-missing
  • Result: 271 passed, TOTAL 100% coverage.

@flitzrrr
Copy link
Copy Markdown
Owner Author

Final readiness check completed.

What was rechecked:

  • Full test suite with coverage (uv run --extra dev --with pytest-cov python -m pytest --cov=crawler --cov-report=term-missing)
  • CLI parser behavior for default sys.argv handling
  • Stacked PR scope isolation (only architecture refactor + related tests)

One issue found during review check and fixed in b5e0478:

  • parse_crawl_args(None) was not reading sys.argv after refactor.
  • Fix: _normalize_crawl_argv now defaults to sys.argv[1:].
  • Regression tests added in tests/test_cli.py.

Current status:

  • 271 passed
  • TOTAL 100% coverage
  • Branch is clean and ready for review/merge.

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