Skip to content

Conversation

tony
Copy link
Member

@tony tony commented May 10, 2025

Changes

New: Added vcspull import

  • Unified command for importing repositories into vcspull configuration, following the infrastructure-as-code pattern similar to Terraform's import command.
  • Manual import: Register a single repository with vcspull import <name> <url>
    • Optional --dir/--path helpers for base directory detection
    • Example: uv run vcspull import myrepo [email protected]:user/myrepo.git --dir ~/code
  • Filesystem scan: Discover and import existing repositories with vcspull import --scan <dir>
    • Recursively scan with --recursive/-r
    • Interactive confirmation prompt or --yes for unattended runs
    • Custom base directory with --base-dir-key
    • Example: uv run vcspull import --scan ~/study/typescript --recursive --yes

New: Added vcspull fmt

  • Introduces a fmt subcommand to normalize configuration files (sort directories/repos, convert compact entries to verbose {repo: ...} form, and standardize keys).
  • Example: uv run vcspull fmt --config ~/.vcspull.yaml --write

Logging Improvements

  • Enhanced logging system with better CLI module propagation and StreamHandler configuration.
  • Improved output visibility in tests and CLI usage with proper handler management.
  • Ensure handlers survive pytest stream rotation via safe flush/reset logic.
  • Added regression test test_import_scan_stream_output to guarantee user-facing output remains visible.

Config & CLI Enhancements

  • ConfigReader now reads files using UTF-8 explicitly.
  • Shared helper save_config_yaml centralizes YAML writes with UTF-8 encoding.
  • CLI parser now wires in the new subcommands and routes to dedicated modules.
  • Module naming: _import.py (leading underscore) avoids Python's import keyword conflict.

Fixes: #25, #333

Testing

  • uv run ruff check . --fix --show-fixes
  • uv run mypy
  • uv run pytest (132 tests passing)

Additional Notes

  • Extensive new CLI tests cover import/fmt behaviors, including duplicate detection, confirmation prompts, and formatting summaries.
  • Logging test suite expanded to validate handler configuration, propagation, and formatter integration.
  • Command naming aligns with IaC terminology: import clearly communicates bringing repositories under vcspull management, whether manually specified or discovered from the filesystem.

This comment was marked as outdated.

@tony tony changed the title !squash initial: add and add-from-fs New commands: add and add-from-fs May 10, 2025
@tony tony force-pushed the scanner-and-add branch 2 times, most recently from a36fbef to 69a222e Compare May 10, 2025 16:36
Copy link

codecov bot commented May 10, 2025

Codecov Report

❌ Patch coverage is 78.50000% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.23%. Comparing base (e6d2c45) to head (e4eca51).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/vcspull/cli/fmt.py 74.80% 20 Missing and 13 partials ⚠️
src/vcspull/log.py 87.30% 3 Missing and 5 partials ⚠️
src/vcspull/cli/sync.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #465      +/-   ##
==========================================
+ Coverage   78.93%   80.23%   +1.29%     
==========================================
  Files           8        9       +1     
  Lines         413      597     +184     
  Branches       85      134      +49     
==========================================
+ Hits          326      479     +153     
- Misses         52       67      +15     
- Partials       35       51      +16     

☔ 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 force-pushed the scanner-and-add branch 3 times, most recently from d37cb7e to 628830e Compare May 17, 2025 11:49
@tony tony force-pushed the scanner-and-add branch 3 times, most recently from e85482d to e26036d Compare June 1, 2025 11:07
@tony tony force-pushed the scanner-and-add branch 6 times, most recently from 740c98c to 1045626 Compare June 22, 2025 14:09
@tony tony force-pushed the scanner-and-add branch from ca15fce to c68f1d5 Compare June 28, 2025 11:57
@tony tony force-pushed the scanner-and-add branch from c68f1d5 to 32bbbd8 Compare July 5, 2025 12:09
@tony tony force-pushed the scanner-and-add branch from 1a6b722 to 40c47a6 Compare July 12, 2025 14:02
@tony tony force-pushed the scanner-and-add branch from 40c47a6 to 1e1becb Compare July 20, 2025 21:06
@tony tony force-pushed the scanner-and-add branch 9 times, most recently from b02d442 to 27d3297 Compare September 4, 2025 11:08
@tony tony force-pushed the scanner-and-add branch 2 times, most recently from f310106 to 9c5c92e Compare September 5, 2025 15:15
@tony tony force-pushed the scanner-and-add branch 7 times, most recently from aefcf5a to c5dfc5e Compare October 5, 2025 23:27
@tony tony force-pushed the scanner-and-add branch 3 times, most recently from 28b332d to 013bd1d Compare October 18, 2025 09:33
@tony tony changed the title New commands: add and add-from-fs New commands: add, add-from-fs, fmt Oct 18, 2025
tony added a commit that referenced this pull request Oct 18, 2025
…mand

why: Align with infrastructure-as-code terminology (e.g., Terraform import)
and improve clarity by using a single command that better communicates the
operation: importing repositories into vcspull configuration.

what:
- Rename add.py → _import.py (leading underscore avoids Python keyword)
- Merge add_from_fs.py functionality into _import.py
- Unify commands: add → import, add-from-fs → import --scan
- Update all test fixtures and test names to use import terminology
- Update logging tests to reflect new module names
- All 132 tests passing, linting and type checking clean

refs: #465
@tony tony changed the title New commands: add, add-from-fs, fmt New commands: import, import --scan, fmt Oct 18, 2025
@tony tony force-pushed the scanner-and-add branch 2 times, most recently from 0616efd to 1a16c43 Compare October 18, 2025 13:05
@tony tony marked this pull request as ready for review October 18, 2025 13:21
sourcery-ai[bot]

This comment was marked as outdated.

@tony tony force-pushed the scanner-and-add branch 3 times, most recently from eae7027 to 63ccf57 Compare October 18, 2025 14:38
tony added 3 commits October 18, 2025 09:52
why:
- expose configuration management (import, import --scan, fmt) through the main CLI
- keep user-facing output visible after the logging refactor
- ensure default config readers use UTF-8 consistently

what:
- wire import/import --scan/fmt subcommands into `vcspull` CLI entry and parser
- implement `cli/import_.py`, `cli/fmt.py` plus extensive tests
- centralize config saves via `save_config_yaml` and open configs as UTF-8
- refactor `setup_logger` to replace NullHandler with stdout stream and add
  regression test for CLI output
- expand logging test suite to cover formatter and propagation behavior

This keeps the subject succinct while the bullets break down the “why/what” of
the large diff. Adjust component prefixes as needed if you prefer more
granularity (e.g., separate commits per concern), but this structure documents
all the key changes in one place.
why: surface import and fmt workflows introduced alongside scanner support.

what:

- link new cli pages in command toctrees

- document manual import, --scan options, and fmt usage

- reference new commands from quickstart guidance
@tony tony merged commit bf0a2c5 into master Oct 18, 2025
10 checks passed
@tony tony deleted the scanner-and-add branch October 18, 2025 14:57
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.

Scan for vcs repos and save, ignore feature, add-from-fs

1 participant