Monorepo management for opam overlays
0
fork

Configure Feed

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

Remove tangled and xrpc-auth dependencies from monopam

The tangled auth was only used to validate handles before init, but
this is redundant since we already validate handles against the
registry. The registry lookup provides sufficient validation.

Removes:
- tangled and xrpc-auth library dependencies
- validate_handle function that required tangled login
- Not_authenticated and Handle_not_found error variants
- ~sw and ~env parameters from Verse.init

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

+24 -64
+1 -2
bin/main.ml
··· 513 513 let info = Cmd.info "init" ~doc ~man in 514 514 let run root handle () = 515 515 Eio_main.run @@ fun env -> 516 - Eio.Switch.run @@ fun sw -> 517 516 let fs = Eio.Stdenv.fs env in 518 517 let proc = Eio.Stdenv.process_mgr env in 519 518 let root = ··· 526 525 | Ok p -> p 527 526 | Error (`Msg _) -> Fpath.v "." 528 527 in 529 - match Monopam.Verse.init ~proc ~fs ~sw ~env ~root ~handle () with 528 + match Monopam.Verse.init ~proc ~fs ~root ~handle () with 530 529 | Ok () -> 531 530 Fmt.pr "Monoverse workspace initialized at %a@." Fpath.pp root; 532 531 `Ok ()
+1 -1
lib/dune
··· 1 1 (library 2 2 (name monopam) 3 3 (public_name monopam) 4 - (libraries eio tomlt tomlt.eio xdge opam-file-format fmt logs uri fpath claude jsont jsont.bytesrw ptime ptime.clock.os tangled xrpc-auth str)) 4 + (libraries eio tomlt tomlt.eio xdge opam-file-format fmt logs uri fpath claude jsont jsont.bytesrw ptime ptime.clock.os str))
+17 -50
lib/verse.ml
··· 2 2 | Config_error of string 3 3 | Git_error of Git.error 4 4 | Registry_error of string 5 - | Handle_not_found of string 6 - | Not_authenticated 7 5 | Member_not_found of string 8 6 | Workspace_exists of Fpath.t 9 7 | Not_a_workspace of Fpath.t ··· 12 10 | Config_error msg -> Fmt.pf ppf "Configuration error: %s" msg 13 11 | Git_error e -> Fmt.pf ppf "Git error: %a" Git.pp_error e 14 12 | Registry_error msg -> Fmt.pf ppf "Registry error: %s" msg 15 - | Handle_not_found h -> Fmt.pf ppf "Handle not found: %s" h 16 - | Not_authenticated -> 17 - Fmt.pf ppf "Not authenticated. Run 'tangled auth login' first." 18 13 | Member_not_found h -> Fmt.pf ppf "Member not in registry: %s" h 19 14 | Workspace_exists p -> Fmt.pf ppf "Workspace already exists: %a" Fpath.pp p 20 15 | Not_a_workspace p -> Fmt.pf ppf "Not a opamverse workspace: %a" Fpath.pp p ··· 54 49 Fmt.(list ~sep:cut pp_member_status) 55 50 s.tracked_members 56 51 57 - (* Helper to validate handle via tangled API. 58 - We reuse the tangled CLI's session credentials - user must run 'tangled auth login' first. *) 59 - let validate_handle ~sw ~env handle = 60 - try 61 - (* Use app_name:"tangled" to reuse tangled CLI's session without polluting monopam's directory *) 62 - let api = 63 - Tangled.Api.create ~sw ~env ~app_name:"tangled" ~pds:"https://bsky.social" () 64 - in 65 - (* Try to load existing session from tangled CLI *) 66 - let session = Xrpc_auth.Session.load env#fs ~app_name:"tangled" () in 67 - match session with 68 - | None -> Error Not_authenticated 69 - | Some session -> ( 70 - Tangled.Api.resume api ~session; 71 - try 72 - let _did = Tangled.Api.resolve_handle api handle in 73 - Ok () 74 - with Eio.Io (Xrpc.Error.E _, _) -> Error (Handle_not_found handle)) 75 - with Eio.Io (Xrpc.Error.E _, _) -> Error Not_authenticated 76 - 77 52 (* Helper to check if a path is a directory *) 78 53 let is_directory ~fs path = 79 54 let eio_path = Eio.Path.(fs / Fpath.to_string path) in ··· 107 82 is_directory ~fs Fpath.(verse_path / name)) 108 83 with Eio.Io _ -> [] 109 84 110 - let init ~proc ~fs ~sw ~env ~root ~handle () = 85 + let init ~proc ~fs ~root ~handle () = 111 86 (* Check if config already exists in XDG *) 112 87 let config_file = Verse_config.config_file () in 113 88 Logs.info (fun m -> m "Config file: %a" Fpath.pp config_file); ··· 130 105 | exception _ -> root 131 106 in 132 107 Logs.info (fun m -> m "Workspace root: %a" Fpath.pp root); 133 - (* Validate handle *) 134 - Logs.info (fun m -> m "Validating handle: %s" handle); 135 - match validate_handle ~sw ~env handle with 136 - | Error e -> 137 - Logs.err (fun m -> m "Handle validation failed"); 138 - Error e 139 - | Ok () -> 140 - Logs.info (fun m -> m "Handle validated successfully"); 141 - (* Create config - need this temporarily to get paths *) 142 - let config = Verse_config.create ~root ~handle () in 143 - (* Clone registry first to look up user's repos *) 144 - Logs.info (fun m -> m "Cloning registry..."); 145 - match Verse_registry.clone_or_pull ~proc ~fs ~config () with 146 - | Error msg -> 147 - Logs.err (fun m -> m "Registry clone failed: %s" msg); 148 - Error (Registry_error msg) 149 - | Ok registry -> 150 - Logs.info (fun m -> m "Registry loaded"); 151 - (* Look up user in registry *) 152 - match Verse_registry.find_member registry ~handle with 153 - | None -> 154 - Logs.err (fun m -> m "Handle %s not found in registry" handle); 155 - Error (Member_not_found handle) 156 - | Some member -> 108 + (* Create config - need this temporarily to get paths *) 109 + let config = Verse_config.create ~root ~handle () in 110 + (* Clone registry first to look up user's repos *) 111 + Logs.info (fun m -> m "Cloning registry..."); 112 + match Verse_registry.clone_or_pull ~proc ~fs ~config () with 113 + | Error msg -> 114 + Logs.err (fun m -> m "Registry clone failed: %s" msg); 115 + Error (Registry_error msg) 116 + | Ok registry -> 117 + Logs.info (fun m -> m "Registry loaded"); 118 + (* Look up user in registry - this validates the handle *) 119 + match Verse_registry.find_member registry ~handle with 120 + | None -> 121 + Logs.err (fun m -> m "Handle %s not found in registry" handle); 122 + Error (Member_not_found handle) 123 + | Some member -> 157 124 Logs.info (fun m -> m "Found member: mono=%s opam=%s" member.monorepo member.opamrepo); 158 125 (* Create workspace directories *) 159 126 Logs.info (fun m -> m "Creating workspace directories...");
+5 -11
lib/verse.mli
··· 1 1 (** Monoverse operations. 2 2 3 - Federated monorepo collaboration. Members are identified by tangled handles 4 - with strict validation via the AT Protocol identity system. *) 3 + Federated monorepo collaboration. Members are identified by handles 4 + and validated against the registry. *) 5 5 6 6 (** {1 Error Types} *) 7 7 ··· 9 9 | Config_error of string (** Configuration loading/saving error *) 10 10 | Git_error of Git.error (** Git operation failed *) 11 11 | Registry_error of string (** Registry clone/pull/parse error *) 12 - | Handle_not_found of string (** Handle could not be resolved *) 13 - | Not_authenticated (** Tangled login required *) 14 12 | Member_not_found of string (** Handle not in registry *) 15 13 | Workspace_exists of Fpath.t (** Workspace already initialized *) 16 14 | Not_a_workspace of Fpath.t (** Not a opamverse workspace *) ··· 48 46 val init : 49 47 proc:_ Eio.Process.mgr -> 50 48 fs:Eio.Fs.dir_ty Eio.Path.t -> 51 - sw:Eio.Switch.t -> 52 - env:< clock : _ Eio.Time.clock ; net : _ Eio.Net.t ; fs : Eio.Fs.dir_ty Eio.Path.t ; .. > -> 53 49 root:Fpath.t -> 54 50 handle:string -> 55 51 unit -> 56 52 (unit, error) result 57 - (** [init ~proc ~fs ~sw ~env ~root ~handle ()] initializes a new opamverse workspace. 53 + (** [init ~proc ~fs ~root ~handle ()] initializes a new opamverse workspace. 58 54 59 55 Creates the workspace structure: 60 56 - [root/.opamverse/config.toml] ··· 63 59 - [root/src/] (source checkouts) 64 60 - [root/verse/] (other users' monorepos) 65 61 66 - The handle is validated against the tangled network (requires prior login). 62 + The handle is validated against the registry. 67 63 68 64 @param proc Eio process manager 69 65 @param fs Eio filesystem 70 - @param sw Eio switch 71 - @param env Eio environment for tangled API 72 66 @param root Workspace root (must be absolute) 73 - @param handle User's tangled handle *) 67 + @param handle User's handle *) 74 68 75 69 val status : 76 70 proc:_ Eio.Process.mgr ->