Monorepo management for opam overlays

Fix URL handling for tangled.sh and single-dot handles

- Add is_tangled_host function to handle both tangled.org and tangled.sh
- Fix domain_from_handle to require 2 dots (user.domain.tld format)
- Handles like "gazagnaire.org" now return the full handle instead of
incorrectly extracting "org" as the domain

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+14 -4
+14 -4
lib/monopam.ml
··· 796 796 Log.app (fun m -> m "Updated CLAUDE.md") 797 797 end 798 798 799 - (** Extract domain from a handle (e.g., "anil.recoil.org" -> "recoil.org") *) 799 + (** Extract domain from a handle (e.g., "anil.recoil.org" -> "recoil.org"). 800 + Requires at least 2 dots (user.domain.tld), otherwise returns the full handle. *) 800 801 let domain_from_handle handle = 801 802 match String.index_opt handle '.' with 802 803 | None -> handle (* No dot, return as-is *) 803 - | Some i -> String.sub handle (i + 1) (String.length handle - i - 1) 804 + | Some first_dot -> 805 + let rest = String.sub handle (first_dot + 1) (String.length handle - first_dot - 1) in 806 + (* Check if rest has another dot (i.e., handle has at least 2 dots) *) 807 + if String.contains rest '.' then rest 808 + else handle (* Only one dot like "gazagnaire.org", return full handle *) 809 + 810 + (** Check if a host is a tangled server *) 811 + let is_tangled_host = function 812 + | Some "tangled.org" | Some "tangled.sh" -> true 813 + | _ -> false 804 814 805 815 (** Convert a clone URL to a push URL. 806 816 - GitHub HTTPS URLs are converted to SSH format 807 - - Tangled URLs (tangled.org) are converted to SSH format using the knot server 817 + - Tangled URLs (tangled.org/tangled.sh) are converted to SSH format using the knot server 808 818 - Other URLs are returned unchanged 809 819 @param knot Optional git push server hostname. If not provided, derived from handle in URL. *) 810 820 let url_to_push_url ?knot uri = ··· 820 830 else path 821 831 in 822 832 Printf.sprintf "git@github.com:%s" path 823 - | Some ("https" | "http"), Some "tangled.org" -> 833 + | Some ("https" | "http"), _ when is_tangled_host host -> 824 834 (* https://tangled.org/@handle/repo -> git@<knot>:handle/repo *) 825 835 let path = 826 836 if String.length path > 0 && path.[0] = '/' then