package doctor
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=760a46e1a009f59ebb88f5657eb23380
sha512=6c6f89c9beba3e84a15fb4ec1771a51319968b3bfdb2015b0a7b88cf0cd66609ac91d0db8989ff68454306ef66797c4fe032e0870fb8035aeab67fdcf509f169
Description
doctor checks common OCaml development environment problems, including opam setup, active switches, dune, ocaml-lsp-server, ocamlformat, PATH issues, and editor integration hints.
README
doctor
doctor is a small diagnostic CLI for OCaml development environments.
Status: early 0.1.0 tool, intended to be useful and conservative rather than complete.
What It Checks
- Platform detection for Windows, macOS, Linux, and WSL where reasonably detectable.
- Core tool availability and versions for
opam,ocaml,dune, OCaml LSP (ocaml-lsp-serverorocamllsp), andocamlformat. - Whether opam appears initialized.
- Active and available opam switches.
- Heuristic shell environment sync by comparing the resolved
ocamlcommand with the active opam switchbindirectory where possible. - Installed opam packages for
dune,ocaml-lsp-server,ocamlformat, and optionalutop. - VS Code OCaml Platform extension detection when the
codecommand is available.
What It Does Not Do
- It does not replace opam, dune, ocaml-lsp, or editor setup docs.
- It does not run
opam init,opam switch create, oropam installfor you. - It does not edit shell startup files or modify user shell configuration.
- It does not implement destructive auto-fixes.
- It does not claim to diagnose every possible OCaml setup issue.
Installation From Source
git clone https://github.com/funwithcthulhu/doctor
cd doctor
opam install . --deps-only --with-test
dune build
dune runtestIf your shell has not been synced with the active opam switch, use opam exec -- dune build and opam exec -- dune runtest.
Local Install
opam pin add doctor . -yWhen testing uncommitted local changes, prefer a path pin so opam reads the working tree instead of git+file://...#main:
opam pin add doctor . -y --kind=pathAfter publication to opam-repository, the expected user flow is:
opam update
opam install doctor
doctor checkUsage
doctor check
doctor version
doctor --helpdoctor version prints:
doctor 0.1.0Example Output
$ doctor check
OCaml Doctor
[OK] platform detected: macOS
[OK] opam found: 2.2.1
[OK] OCaml found: 5.2.0
[OK] dune found: 3.17.0
[OK] OCaml LSP found: 1.19.0 (ocamllsp)
[WARN] ocamlformat not installed
Suggested fix: opam install ocamlformat
[OK] active switch: 5.2.0
[WARN] VS Code OCaml Platform extension not detected
Suggested fix: Install extension ocamllabs.ocaml-platform in VS Code.
Summary: 6 OK, 2 WARN, 0 ERRORExit Codes
0: no warnings or errors1: one or more warnings, no errors2: one or more errors3: unexpected internal failure
Development
Build:
dune buildRun tests:
dune runtestRun locally without installing:
dune exec doctor -- checkIf dune is not available on PATH, prefix these commands with opam exec --.
Tests use injectable process runners and deterministic fixtures. They should not require the local machine to have opam configured, VS Code installed, or a specific shell setup.
Contribution Ideas
- Improve shell detection for PowerShell, cmd.exe, MSYS2, and Cygwin.
- Add JSON output for editor integrations and issue templates.
- Add more editor checks without making VS Code mandatory.
- Improve opam switch environment explanations on Windows.
- Add targeted diagnostics for common dune and LSP project-layout problems.
Release Process
Maintainer release steps are documented in RELEASE.md.