RepoForge
RepoForge provides repository archive discovery and safe refresh helpers used by
thesa.
The crate is intentionally focused. It scans an archive root for Git worktrees,
derives stable owner/repo slugs from GitHub remotes or archive paths, and
refreshes clones with git pull --ff-only without touching dirty worktrees.
Install
[]
= "0.1"
The package and library crate name are both repoforge.
Archive Layout
RepoForge is designed for archive trees like this:
archives/
octocat/
Hello-World/
.git/
rust-lang/
rust/
.git/
When remote.origin.url is a GitHub URL, the slug is derived from the remote.
For example https://github.com/octocat/Hello-World.git becomes
octocat/Hello-World.
If there is no GitHub remote, RepoForge falls back to the path layout. For
example archives/octocat/Hello-World becomes octocat/Hello-World.
Discovery
use Path;
let archives = discover_git_archives?;
for archive in archives
# Ok::
Use a filter to limit results by slug or path:
let archives = discover_git_archives?;
# Ok::
Discovery is recursive but stops descending when it finds a Git worktree.
.git, .thesa, and target directories are skipped.
Refresh
let archives = discover_git_archives?;
let summary = refresh_git_archives;
println!;
if summary.has_failures
# Ok::
Refresh behavior:
- Runs
git status --porcelainbefore pulling. - Dirty worktrees fail fast and are not pulled.
- Runs
git pull --ff-onlyfor clean worktrees. - Reports
UpdatedwhenHEADchanges. - Reports
Unchangedwhen the pull succeeds without changingHEAD. - Uses bounded concurrency with
refresh_git_archives.
Slug Helpers
assert_eq!;
Supported GitHub remote forms include HTTPS and SSH:
https://github.com/owner/repo.githttp://github.com/owner/repo.gitgit@github.com:owner/repo.gitssh://git@github.com/owner/repo.git
Safety Contract
RepoForge does not delete, reset, checkout, stash, or force-pull anything. It
only uses read-only Git inspection commands plus git pull --ff-only after
confirming the worktree is clean.
Callers such as thesa remain responsible for archive metadata sidecars,
checksums, and higher-level reporting.