Skip to content

refactor(scan): move repository discovery out of the cli module - #58

Merged
bircni merged 1 commit into
mainfrom
refactor/extract-scan-module
Aug 23, 2026
Merged

refactor(scan): move repository discovery out of the cli module#58
bircni merged 1 commit into
mainfrom
refactor/extract-scan-module

Conversation

@bircni

@bircni bircni commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Why

find_repositories is the filesystem-scanning engine — it walks the requested
directory, decides which entries are repositories the user asked about, and collects
their state in parallel. It lived in cli, whose job is parsing what the user typed,
which left Args acting as both a data bag and the scanner.

What

It moves to a scan module as free functions taking &Args, so the dependency runs one
way: scan reads the arguments, cli knows nothing about walking the disk.

cli.rs drops from 175 to 84 lines — now just the Args definition and the output
filter. scan.rs is 97 lines.

Compatibility

Pure move, no behaviour change. A binary built from the parent commit and one built from
this branch produce byte-identical output across the flag matrix, on the same fixture
used in #56 (clean, dirty, detached, local-only, unpushed, stashed, worktree, nested,
unreadable and subdir repositories).

All 132 tests pass unchanged apart from the call-site rename.

`find_repositories` is the filesystem-scanning engine: it walks the
requested directory, decides which entries are repositories the user
asked about, and collects their state in parallel. It lived in `cli`,
whose job is parsing what the user typed, which left `Args` acting as
both a data bag and the scanner.

It moves to a `scan` module as free functions taking `&Args`, so the
dependency runs one way: `scan` reads the arguments, `cli` knows nothing
about walking the disk. `cli` drops from 175 to 84 lines and is now just
the `Args` definition plus the output filter.

Pure move - a binary built from the parent commit and this one produce
byte-identical output across the flag matrix.
@bircni
bircni force-pushed the refactor/extract-scan-module branch from 1f83303 to f2956dc Compare August 23, 2026 20:56
@bircni
bircni merged commit 7cd5af3 into main Aug 23, 2026
9 checks passed
@bircni
bircni deleted the refactor/extract-scan-module branch August 23, 2026 21:05
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