A monorepo management tool for the agentic ages
at main 70 lines 2.4 kB view raw
1(** Git backend for direct repository vendoring. 2 3 Implements vendoring of arbitrary git repositories using the three-tier branch model: 4 - git/upstream/<name> - pristine upstream code 5 - git/vendor/<name> - upstream history rewritten with vendor/git/<name>/ prefix 6 - git/patches/<name> - local modifications 7 8 Unlike the opam backend which discovers packages via opam repositories, 9 this backend allows cloning any git repository directly. *) 10 11(** {1 Branch Naming} *) 12 13val upstream_branch : string -> string 14(** [upstream_branch name] returns the upstream branch name "git/upstream/<name>". *) 15 16val vendor_branch : string -> string 17(** [vendor_branch name] returns the vendor branch name "git/vendor/<name>". *) 18 19val patches_branch : string -> string 20(** [patches_branch name] returns the patches branch name "git/patches/<name>". *) 21 22val vendor_path : string -> string 23(** [vendor_path name] returns the vendor directory path "vendor/git/<name>". *) 24 25(** {1 Repository Info} *) 26 27type repo_info = { 28 name : string; (** User-specified name *) 29 url : string; (** Git URL to clone from *) 30 branch : string option; (** Optional branch/tag to track *) 31 subdir : string option; (** Optional subdirectory to extract *) 32} 33 34(** {1 Repository Operations} *) 35 36val add_repo : 37 proc_mgr:Git.proc_mgr -> 38 root:Worktree.root -> 39 ?cache:Vendor_cache.t -> 40 repo_info -> 41 Backend.add_result 42(** [add_repo ~proc_mgr ~root ?cache info] vendors a git repository. 43 44 Creates the three-tier branch structure: 45 1. Fetches from url into git/upstream/<name> 46 2. Rewrites history into git/vendor/<name> with vendor/git/<name>/ prefix 47 3. Creates git/patches/<name> for local modifications 48 49 If [subdir] is specified, only that subdirectory is extracted from the repo. *) 50 51val update_repo : 52 proc_mgr:Git.proc_mgr -> 53 root:Worktree.root -> 54 ?cache:Vendor_cache.t -> 55 string -> 56 Backend.update_result 57(** [update_repo ~proc_mgr ~root ?cache name] updates a vendored repository from upstream. *) 58 59val list_repos : 60 proc_mgr:Git.proc_mgr -> 61 root:Worktree.root -> 62 string list 63(** [list_repos ~proc_mgr ~root] returns names of all vendored git repositories. *) 64 65val remove_repo : 66 proc_mgr:Git.proc_mgr -> 67 root:Worktree.root -> 68 string -> 69 unit 70(** [remove_repo ~proc_mgr ~root name] removes a vendored repository. *)