Skip to content

Conversation

@tony
Copy link
Member

@tony tony commented Jan 3, 2026

Summary

Add a new vcspull search subcommand for quickly finding repositories across your configuration using ripgrep-inspired query syntax.

Key features:

  • Field-scoped queries - Target specific fields with prefixes: name:django, url:github, path:code, workspace:~/projects
  • Regex by default - All patterns use Python regex, making complex matches easy
  • Smart matching modes:
    • -i/--ignore-case - Force case-insensitive
    • -S/--smart-case - Case-insensitive unless pattern has uppercase (like rg)
    • -F/--fixed-strings - Literal string matching
    • --word-regexp - Match whole words only
  • Boolean logic:
    • Default AND - all terms must match
    • --any - OR matching (any term matches)
    • -v/--invert-match - Show non-matching repos
  • Output formats:
    • Human-readable with match highlighting
    • --json - Single JSON array for scripting
    • --ndjson - Streaming newline-delimited JSON

Examples

# Basic search across all fields
vcspull search django

# Field-scoped queries
vcspull search name:django url:github

# Literal URL matching
vcspull search --fixed-strings 'git+https://github.com/org/repo.git'

# Find repos NOT on GitHub
vcspull search -v url:github

# Case-insensitive OR search
vcspull search -i --any django flask pyramid

Changes

  • src/vcspull/cli/search.py - New search implementation with query parsing, pattern compilation, and output formatting
  • src/vcspull/cli/__init__.py - CLI integration and help examples
  • src/vcspull/cli/_formatter.py - New flags for help formatting
  • tests/cli/test_search.py - Comprehensive test coverage
  • docs/cli/search.md - Full command documentation
  • docs/api/cli/search.md - API reference
  • README.md - Usage examples

Test plan

  • uv run ruff format .
  • uv run ruff check . --fix --show-fixes
  • uv run mypy
  • uv run py.test

@tony tony changed the title search Add rg-like search command for repositories Jan 3, 2026
@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

❌ Patch coverage is 91.50943% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.42%. Comparing base (3528647) to head (d219ee4).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/vcspull/cli/search.py 91.50% 11 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #494      +/-   ##
==========================================
+ Coverage   79.24%   80.42%   +1.18%     
==========================================
  Files          15       16       +1     
  Lines        1980     2192     +212     
  Branches      404      454      +50     
==========================================
+ Hits         1569     1763     +194     
- Misses        267      278      +11     
- Partials      144      151       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony tony changed the title Add rg-like search command for repositories feat(cli): Add vcspull search command with rg-style field-scoped queries Jan 3, 2026
@tony tony force-pushed the search branch 2 times, most recently from 9f41aaf to 214a2f2 Compare January 3, 2026 10:51
@tony
Copy link
Member Author

tony commented Jan 3, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

tony added a commit that referenced this pull request Jan 3, 2026
why: Users need to know about the new search feature in the changelog.
what:
- Add New features section for v1.49.x
- Document vcspull search command with usage examples
- Include key features and advanced examples
tony added 5 commits January 3, 2026 09:49
why: Provide fast repository discovery with field-scoped, regex-based queries.
what:
- add search subcommand with query parsing, highlighting, and JSON/NDJSON output
- integrate parser/help coloring for new search flags
why: Validate search behavior across matching modes and outputs.
what:
- add search command fixtures and JSON/NDJSON assertions
- update CLI logger expectation for new subcommand
why: Keep CLI documentation aligned with the new search subcommand.
what:
- add search command docs and API reference stubs
- update CLI indexes and README examples
why: New search module needed unit tests for helper functions and edge cases.
what:
- Add unit tests for normalize_fields, parse_query_terms, compile_search_patterns
- Add highlight_text tests with color modes enabled/disabled
- Add search_repos tests for url/workspace field matches, error handling
- Test auto-discover config path and invalid input handling
- Use user_path fixture (via libvcs set_home autouse) instead of manual HOME setup
why: Users need to know about the new search feature in the changelog.
what:
- Add New features section for v1.49.x
- Document vcspull search command with usage examples
- Include key features and advanced examples
@tony tony merged commit c673006 into master Jan 3, 2026
9 checks passed
@tony tony deleted the search branch January 3, 2026 15:58
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.

2 participants