···11# monopam
2233-Monorepo manager for OCaml using git subtrees.
33+Monorepo manager for OCaml.
4455## Core Idea
66
+2-2
dune-project
···10101111(package
1212 (name monopam)
1313- (synopsis "Manage opam overlays with git subtree monorepos")
1414- (description "Monopam helps manage an opam overlay by synchronizing packages between individual git checkouts and a monorepo using git subtrees.")
1313+ (synopsis "Monorepo manager for OCaml packages")
1414+ (description "Monopam helps manage an opam overlay by synchronizing packages between individual git checkouts and a monorepo.")
1515 (depends
1616 (ocaml (>= 5.2.0))
1717 (eio (>= 1.2))
+3-3
lib/fork_join.ml
···4949type discovery = {
5050 mono_exists : bool;
5151 src_exists : bool;
5252- has_subtree_history : bool; (** Can we git subtree split? *)
5252+ has_subtree_history : bool; (** Can we split this subtree? *)
5353 remote_accessible : bool option; (** None = not checked, Some = result *)
5454 opam_files : string list;
5555 local_path_is_repo : bool option; (** For join from local dir *)
···761761 Git.Repository.write_config git_repo config;
762762 Ok ()
763763764764-(** Execute git subtree split action. *)
764764+(** Execute subtree split action. *)
765765let exec_subtree_split ~fs ~state ~repo ~prefix =
766766 let git_repo = Git.Repository.open_repo ~fs repo in
767767 match Git.Repository.read_ref git_repo "HEAD" with
···774774 state.split_commit <- Some (Git.Hash.to_hex split_hash);
775775 Ok ())
776776777777-(** Execute git subtree add action. *)
777777+(** Execute subtree add action. *)
778778let exec_subtree_add ~proc ~fs ~repo ~prefix ~url ~branch =
779779 match Git_cli.fetch_url ~proc ~fs ~repo ~url ~branch () with
780780 | Error e -> Error (Git_error e)
+4-4
lib/fork_join.mli
···6969type discovery = {
7070 mono_exists : bool; (** Does mono/<name>/ exist? *)
7171 src_exists : bool; (** Does src/<name>/ exist? *)
7272- has_subtree_history : bool; (** Can we git subtree split? *)
7272+ has_subtree_history : bool; (** Can we split this subtree? *)
7373 remote_accessible : bool option; (** None = not checked, Some = result *)
7474 opam_files : string list; (** Package names found from .opam files *)
7575 local_path_is_repo : bool option; (** For join from local dir *)
···245245 subtree into its own repository.
246246247247 This operation: 1. Validates [mono/<name>/] exists 2. Validates
248248- [src/<name>/] does not exist 3. Uses [git subtree split] to extract history
249249- 4. Creates a new git repo at [src/<name>/] 5. Pushes the split commit to the
248248+ [src/<name>/] does not exist 3. Splits the subtree to extract history 4.
249249+ Creates a new git repo at [src/<name>/] 5. Pushes the split commit to the
250250 new repo 6. Updates [sources.toml] with [origin = "fork"] 7. Auto-discovers
251251 packages from [.opam] files.
252252···271271272272 This operation: 1. Derives name from URL if not provided 2. Validates
273273 [mono/<name>/] does not exist 3. Clones the repository to [src/<name>/] 4.
274274- Uses [git subtree add] to bring into monorepo 5. Updates [sources.toml] with
274274+ Adds the subtree into the monorepo 5. Updates [sources.toml] with
275275 [origin = "join"] 6. Auto-discovers packages from [.opam] files.
276276277277 @param url Git URL to clone from.
+1-2
lib/git_cli.mli
···11(** Git operations for monopam.
2233 This module provides git operations needed for managing individual checkouts
44- and git subtree operations in the monorepo. All operations use Eio for
55- process spawning. *)
44+ in the monorepo. All operations use Eio for process spawning. *)
6576(** {1 User configuration} *)
87
+1-1
lib/init.ml
···1212let claude_md_header =
1313 {|# Monorepo Development Guide
14141515-This is a monorepo managed by `monopam`. Each subdirectory is a git subtree
1515+This is a monorepo managed by `monopam`. Each subdirectory is a subtree
1616from a separate upstream repository.
17171818> **Note:** Check `CLAUDE.local.md` (if it exists) for additional local
+2-2
lib/monopam.ml
···11(** Monopam - Monorepo package manager.
2233- Orchestrates git subtree operations for managing a monorepo of OCaml
44- packages synchronized from upstream repositories. *)
33+ Manages a monorepo of OCaml packages synchronized from upstream
44+ repositories. *)
5566(** {1 Core Modules} *)
77
+4-4
lib/monopam.mli
···11(** Monopam - Monorepo package manager.
2233- Orchestrates git subtree operations for managing a monorepo of OCaml
44- packages synchronized from upstream repositories.
33+ Manages a monorepo of OCaml packages synchronized from upstream
44+ repositories.
5566 {1 Core Modules}
77···18181919 - {!Ctx} - Operational context (filesystem, package discovery, checkouts)
2020 - {!Init} - Monorepo initialization
2121- - {!Pull} - Pull operations (fetch checkouts, merge subtrees)
2222- - {!Push} - Push operations (subtree split, export to checkouts)
2121+ - {!Pull} - Pull operations (fetch checkouts, merge into monorepo)
2222+ - {!Push} - Push operations (extract and export to checkouts)
2323 - {!Add} - Add packages to monorepo
2424 - {!Remove} - Remove packages from monorepo
2525 - {!Clean} - Clean empty commits from history
+2-2
lib/push.ml
···11(** Push operations for exporting monorepo changes to checkouts and upstream.
2233- Uses subtree split to extract commits for each package and pushes to local
44- checkouts and optionally to remote upstreams. *)
33+ Extracts per-package commits and pushes to local checkouts and optionally to
44+ remote upstreams. *)
5566let src = Logs.Src.create "monopam.push" ~doc:"Monopam push operations"
77
+2-2
monopam.opam
···11# This file is generated by dune, edit dune-project instead
22opam-version: "2.0"
33-synopsis: "Manage opam overlays with git subtree monorepos"
33+synopsis: "Monorepo manager for OCaml packages"
44description:
55- "Monopam helps manage an opam overlay by synchronizing packages between individual git checkouts and a monorepo using git subtrees."
55+ "Monopam helps manage an opam overlay by synchronizing packages between individual git checkouts and a monorepo."
66maintainer: ["Anil Madhavapeddy <anil@recoil.org>"]
77authors: ["Anil Madhavapeddy <anil@recoil.org>"]
88license: "ISC"