Find and remove dead code and unused APIs in OCaml projects
at main 36 lines 1.4 kB view raw
1(** System utilities for prune - TTY detection, dune operations, and project 2 validation *) 3 4(** {2 TTY and environment detection} *) 5 6val is_tty : unit -> bool 7(** [is_tty ()] checks if we're running in a TTY (for progress display). *) 8 9(** {2 Dune build operations} *) 10 11val build_project_and_index : 12 string -> Types.context -> (unit, [ `Build_failed of Types.context ]) result 13(** [build_project_and_index root_dir ctx] builds project and index for 14 analysis. Returns a custom error type to preserve context information for 15 better error reporting. *) 16 17val classify_build_error : Types.context -> Types.build_error_type 18(** [classify_build_error ctx] analyzes the last build result and classifies the 19 error type. *) 20 21(** {2 Project validation} *) 22 23val ocaml_version : unit -> string option 24(** [ocaml_version ()] gets the OCaml compiler version string. *) 25 26val check_ocaml_version : unit -> (unit, [ `Msg of string ]) result 27(** [check_ocaml_version ()] checks if OCaml compiler version meets minimum 28 requirements (5.3.0). *) 29 30val validate_dune_project : string -> (unit, [ `Msg of string ]) result 31(** [validate_dune_project root_dir] checks if directory contains a dune 32 project. *) 33 34val display_failure_and_exit : Types.context -> unit 35(** [display_failure_and_exit ctx] displays build failure consistently and exits 36 with the build's exit code. *)