Skip to main content

Crate repoforge

Crate repoforge 

Source
Expand description

Repository archive discovery and safe refresh helpers for thesa.

Made by Trevor Knott for Knott Dynamics.

RepoForge is intentionally small: it knows how to find Git worktrees inside an archive root, derive a stable owner/repo slug from a GitHub or Bitbucket remote or path layout, and refresh those clones with git pull --ff-only. It does not write manifests, own terminal UI, or mutate dirty worktrees.

The refresh path refuses dirty worktrees before pulling, so callers do not silently overwrite local archive edits.

use std::path::Path;

assert_eq!(
    repoforge::parse_github_remote_slug("https://github.com/octocat/Hello-World.git"),
    Some("octocat/Hello-World".to_string())
);
assert_eq!(
    repoforge::fallback_archive_slug(
        Path::new("archives"),
        Path::new("archives/octocat/Hello-World"),
    ),
    "octocat/Hello-World"
);

Structs§

GitArchiveCandidate
A discovered Git archive worktree.
GitRefreshEntry
Successful refresh result for one worktree.
GitRefreshFailure
Failed refresh result for one worktree.
GitRefreshSummary
Summary returned by refresh_git_archives.

Enums§

GitProvider
Recognized Git hosting providers for archive remotes.
GitRefreshStatus
Outcome for one successful archive refresh.
RepoForgeError
Errors returned while discovering or refreshing Git archive worktrees.

Constants§

AGENT_GUIDE
Operational guide for autonomous agents using RepoForge.

Functions§

discover_git_archives
Discover Git worktrees under an archive root.
discover_git_archives_for_owner
Discover Git worktrees for one owner, organization, or workspace under an archive root.
ensure_clean_git_worktree
Fail if a worktree has local changes according to git status --porcelain.
fallback_archive_slug
Derive a slug from archive path layout when no GitHub remote is available.
git_archive_slug
Derive a stable archive slug from a remote URL or archive path layout.
git_head
Read the current HEAD commit hash for a worktree.
git_remote_origin_url
Read remote.origin.url from a Git worktree.
git_web_url_for_slug
Build a canonical provider web URL from an owner/repo slug.
github_web_url_for_slug
Build a canonical https://github.com/owner/repo URL from an owner/repo slug.
is_git_worktree
Return true when path looks like a Git worktree.
parse_bitbucket_remote_slug
Parse a Bitbucket Cloud remote URL into workspace/repo.
parse_git_remote_slug
Parse a recognized GitHub or Bitbucket remote into its provider and owner/repo slug.
parse_github_remote_slug
Parse a GitHub remote URL into owner/repo.
refresh_git_archives
Refresh multiple Git archives with bounded concurrency.
refresh_one_git_archive
Refresh one Git archive with git pull --ff-only.
run_git_capture
Run git in repo_path and capture stdout/stderr.
split_owner_repo_slug
Split a normalized owner/repo slug into borrowed owner and repo parts.

Type Aliases§

Result
Result type used by RepoForge APIs.