Monorepo management for opam overlays
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve monopam status page: link repository to upstream, add synopsis

Replace the Version column (always "dev") with Synopsis from opam files.
Make the Repository column a clickable link to the upstream URL.

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

+34 -11
+9 -5
lib/monopam.ml
··· 132 132 Buffer.add_string buf 133 133 "This monorepo contains the following packages, synchronized from their \ 134 134 upstream repositories.\n\n"; 135 - Buffer.add_string buf "| Repository | Package | Version | Upstream |\n"; 136 - Buffer.add_string buf "|------------|---------|---------|----------|\n"; 135 + Buffer.add_string buf "| Repository | Package | Synopsis |\n"; 136 + Buffer.add_string buf "|------------|---------|----------|\n"; 137 137 List.iter 138 138 (fun (repo, pkgs) -> 139 139 List.iteri 140 140 (fun i pkg -> 141 - let repo_cell = if i = 0 then Printf.sprintf "**%s**" repo else "" in 142 141 let dev_repo = Uri.to_string (Package.dev_repo pkg) in 143 142 (* Clean up git+ prefix for display *) 144 143 let display_url = ··· 146 145 String.sub dev_repo 4 (String.length dev_repo - 4) 147 146 else dev_repo 148 147 in 148 + let repo_cell = 149 + if i = 0 then Printf.sprintf "[**%s**](%s)" repo display_url 150 + else "" 151 + in 152 + let synopsis = Option.value ~default:"" (Package.synopsis pkg) in 149 153 Buffer.add_string buf 150 - (Printf.sprintf "| %s | %s | %s | %s |\n" repo_cell 151 - (Package.name pkg) (Package.version pkg) display_url)) 154 + (Printf.sprintf "| %s | %s | %s |\n" repo_cell 155 + (Package.name pkg) synopsis)) 152 156 pkgs) 153 157 grouped; 154 158 Buffer.add_string buf "\n---\n\n";
+11 -1
lib/opam_repo.ml
··· 78 78 items 79 79 |> Option.value ~default:[] 80 80 81 + let find_synopsis (items : OP.opamfile_item list) : string option = 82 + List.find_map 83 + (fun (item : OP.opamfile_item) -> 84 + match item.pelem with 85 + | OP.Variable (name, value) when name.pelem = "synopsis" -> 86 + extract_string_value value 87 + | _ -> None) 88 + items 89 + 81 90 let parse_package_path (path : Fpath.t) : (string * string) option = 82 91 let segs = Fpath.segs path in 83 92 let rec find_after_packages = function ··· 108 117 else 109 118 let dev_repo = normalize_git_url url in 110 119 let depends = find_depends opamfile.file_contents in 111 - Ok (Package.create ~name ~version ~dev_repo ~depends ()) 120 + let synopsis = find_synopsis opamfile.file_contents in 121 + Ok (Package.create ~name ~version ~dev_repo ~depends ?synopsis ()) 112 122 with 113 123 | Eio.Io _ as e -> Error (Io_error (Printexc.to_string e)) 114 124 | exn -> Error (Parse_error (path_str, Printexc.to_string exn)))
+7 -3
lib/package.ml
··· 4 4 dev_repo : Uri.t; 5 5 branch : string option; 6 6 depends : string list; 7 + synopsis : string option; 7 8 } 8 9 9 - let create ~name ~version ~dev_repo ?branch ?(depends = []) () = 10 - { name; version; dev_repo; branch; depends } 10 + let create ~name ~version ~dev_repo ?branch ?(depends = []) ?synopsis () = 11 + { name; version; dev_repo; branch; depends; synopsis } 11 12 12 13 let name t = t.name 13 14 let version t = t.version 14 15 let dev_repo t = t.dev_repo 15 16 let branch t = t.branch 16 17 let depends t = t.depends 18 + let synopsis t = t.synopsis 17 19 18 20 let repo_name t = 19 21 (* Extract basename from dev-repo URL, stripping .git suffix *) ··· 32 34 let pp ppf t = 33 35 Fmt.pf ppf 34 36 "@[<hov 2>{ name = %S;@ version = %S;@ dev_repo = %a;@ branch = %a;@ \ 35 - depends = [%a] }@]" 37 + depends = [%a];@ synopsis = %a }@]" 36 38 t.name t.version Uri.pp t.dev_repo 37 39 Fmt.(option ~none:(any "None") string) 38 40 t.branch 39 41 Fmt.(list ~sep:(any ", ") string) 40 42 t.depends 43 + Fmt.(option ~none:(any "None") (quote string)) 44 + t.synopsis
+7 -2
lib/package.mli
··· 17 17 dev_repo:Uri.t -> 18 18 ?branch:string -> 19 19 ?depends:string list -> 20 + ?synopsis:string -> 20 21 unit -> 21 22 t 22 - (** [create ~name ~version ~dev_repo ?branch ?depends ()] creates a new package. 23 + (** [create ~name ~version ~dev_repo ?branch ?depends ?synopsis ()] creates a new package. 23 24 24 25 @param name The opam package name 25 26 @param version The package version (e.g., "dev") 26 27 @param dev_repo The git remote URL from the opam file's dev-repo field 27 28 @param branch Optional branch override; defaults to repository default 28 - @param depends List of opam package names this package depends on *) 29 + @param depends List of opam package names this package depends on 30 + @param synopsis Short description of the package *) 29 31 30 32 (** {1 Accessors} *) 31 33 ··· 43 45 44 46 val depends : t -> string list 45 47 (** [depends t] returns the list of opam package names this package depends on. *) 48 + 49 + val synopsis : t -> string option 50 + (** [synopsis t] returns the short description of the package, if any. *) 46 51 47 52 val repo_name : t -> string 48 53 (** [repo_name t] returns the repository name extracted from the dev-repo URL.