Skip to content

Commit 936488a

Browse files
committed
cli(feat): Modernize CLI with new commands and streamlined flags
why: Align vcspull CLI with modern DevOps tool conventions (Terraform, Cargo, Ruff, Biome) for improved developer experience and automation support. Previous CLI lacked introspection commands, dry-run support, and machine-readable output. what: Breaking Changes: - Remove `vcspull import` command (split into `add` and `discover`) - Rename `-c/--config` to `-f/--file` across all commands - Add `-w/--workspace/--workspace-root` (all aliases supported) New Commands: - `vcspull list` - List configured repos with --tree, --json, --ndjson - `vcspull status` - Check repo health (exists, clean/dirty, ahead/behind) - `vcspull add` - Add single repository with --dry-run support - `vcspull discover` - Scan filesystem for repos with --dry-run support New Infrastructure: - Create _output.py for OutputFormatter (JSON/NDJSON/human modes) - Create _colors.py with semantic colors and NO_COLOR support - Add --dry-run/-n flag to sync, add, discover commands - Add --json/--ndjson structured output to sync, list, status - Add --color {auto,always,never} flag with NO_COLOR env support Improvements: - Split _import.py into add.py (single) and discover.py (bulk) - Update sync.py with new flags and dry-run preview mode - Update fmt.py to use -f flag instead of -c - Wire all new commands in __init__.py with updated examples - Update README.md with new command examples - Update CHANGES with breaking changes and migration guide - Update test_log.py for new module structure Migration Guide in CHANGES: - vcspull import NAME URL → vcspull add NAME URL - vcspull import --scan DIR → vcspull discover DIR - vcspull sync -c FILE → vcspull sync -f FILE - vcspull sync --workspace-root PATH → vcspull sync -w PATH refs: All tests pass (109 tests), mypy clean, ruff clean
1 parent 1514bde commit 936488a

13 files changed

Lines changed: 1392 additions & 1320 deletions

File tree

CHANGES

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,57 @@ $ pipx install --suffix=@next 'vcspull' --pip-args '\--pre' --force
3131

3232
<!-- Maintainers, insert changes / features for the next release here -->
3333

34-
_Notes on upcoming releases will be added here_
34+
### BREAKING CHANGES
35+
36+
This release modernizes the vcspull CLI to align with DevOps tool conventions (Terraform, Cargo, Ruff, Biome). **This is a breaking change release**.
37+
38+
#### Command Changes
39+
40+
- **REMOVED**: `vcspull import` command
41+
- Use `vcspull add <name> <url>` to add a single repository
42+
- Use `vcspull discover <path>` to scan and add multiple repositories
43+
- **NEW**: `vcspull list` - List configured repositories with optional `--tree`, `--json`, `--ndjson` output
44+
- **NEW**: `vcspull status` - Check repository health (ahead/behind, clean/dirty)
45+
- **NEW**: `vcspull add` - Add a single repository (replaces `vcspull import <name> <url>`)
46+
- **NEW**: `vcspull discover` - Scan filesystem for repositories (replaces `vcspull import --scan`)
47+
48+
#### Flag Changes
49+
50+
- **RENAMED**: `-c/--config``-f/--file` (all commands)
51+
- **NEW**: `-w/--workspace/--workspace-root` - All three aliases supported for workspace root
52+
- **NEW**: `--dry-run/-n` - Preview changes without making modifications (sync, add, discover)
53+
- **NEW**: `--json/--ndjson` - Machine-readable output for automation (sync, list, status)
54+
- **NEW**: `--color {auto,always,never}` - Control color output
55+
56+
#### Migration Guide
57+
58+
```bash
59+
# Old → New
60+
vcspull import NAME URL → vcspull add NAME URL
61+
vcspull import --scan DIR → vcspull discover DIR
62+
vcspull sync -c FILE → vcspull sync -f FILE
63+
vcspull sync --workspace-root PATH → vcspull sync -w PATH # (or keep long form)
64+
vcspull fmt -c FILE → vcspull fmt -f FILE
65+
```
66+
67+
### Features
68+
69+
#### Developer Experience Improvements
70+
71+
- All commands now support `--dry-run` for safe previewing of changes
72+
- Structured output (`--json`, `--ndjson`) enables CI/CD integration
73+
- Semantic colors with `NO_COLOR` environment variable support
74+
- Short `-w` flag for workspace root reduces typing
75+
- Consistent flag naming across all commands
76+
77+
#### New Introspection Commands
78+
79+
- `vcspull list` - View all configured repositories
80+
- `--tree` mode groups by workspace root
81+
- `--json/--ndjson` for programmatic access
82+
- `vcspull status` - Check repository health
83+
- Shows which repos exist, are dirty, or missing
84+
- `--detailed` mode for additional information
3585

3686
## vcspull v1.38.0 (2025-10-18)
3787

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You can test the unpublished version of vcspull before its released.
6868
## Configuration
6969

7070
Add your repos to `~/.vcspull.yaml`. You can edit the file by hand or let
71-
`vcspull import` create entries for you.
71+
`vcspull add` or `vcspull discover` create entries for you.
7272

7373
```yaml
7474
~/code/:
@@ -91,31 +91,32 @@ more [configuration](https://vcspull.git-pull.com/configuration.html))
9191
be used as a declarative manifest to clone your repos consistently across
9292
machines. Subsequent syncs of initialized repos will fetch the latest commits.
9393

94-
### Import repositories from the CLI
94+
### Add repositories from the CLI
9595

96-
Register an existing remote without touching YAML manually:
96+
Register a single repository without touching YAML manually:
9797

9898
```console
99-
$ vcspull import my-lib https://github.com/example/my-lib.git --path ~/code/my-lib
99+
$ vcspull add my-lib https://github.com/example/my-lib.git --path ~/code/my-lib
100100
```
101101

102102
- Omit `--path` to default the entry under `./`.
103-
- Use `--workspace-root` when you want to force a specific workspace root, e.g.
104-
`--workspace-root ~/projects/libs`.
105-
- Pass `-c/--config` to import into an alternate YAML file.
103+
- Use `-w/--workspace` when you want to force a specific workspace root, e.g.
104+
`-w ~/projects/libs`.
105+
- Pass `-f/--file` to add to an alternate YAML file.
106+
- Use `--dry-run` to preview changes before writing.
106107
- Follow with `vcspull sync my-lib` to clone or update the working tree after registration.
107108

108-
### Scan local checkouts and import en masse
109+
### Discover local checkouts and add en masse
109110

110111
Have a directory tree full of cloned Git repositories? Scan and append them to
111112
your configuration:
112113

113114
```console
114-
$ vcspull import --scan ~/code --recursive
115+
$ vcspull discover ~/code --recursive
115116
```
116117

117118
The scan shows each repository before import unless you opt into `--yes`. Add
118-
`--workspace-root ~/code/` to pin the resulting workspace root or `--config` to
119+
`-w ~/code/` to pin the resulting workspace root or `-f` to
119120
write somewhere other than the default `~/.vcspull.yaml`.
120121

121122
### Normalize configuration files
@@ -124,7 +125,7 @@ After importing or editing by hand, run the formatter to tidy up keys and keep
124125
entries sorted:
125126

126127
```console
127-
$ vcspull fmt --config ~/.vcspull.yaml --write
128+
$ vcspull fmt -f ~/.vcspull.yaml --write
128129
```
129130

130131
Use `vcspull fmt --all --write` to format every YAML file that vcspull can
@@ -149,7 +150,7 @@ or svn project with a git dependency:
149150
Clone / update repos via config file:
150151

151152
```console
152-
$ vcspull sync -c external_deps.yaml '*'
153+
$ vcspull sync -f external_deps.yaml '*'
153154
```
154155

155156
See the [Quickstart](https://vcspull.git-pull.com/quickstart.html) for

0 commit comments

Comments
 (0)