The goal of this 3rd-party repository is to provide a minimal and idiomatic template for setting up an OCaml project. It was just updated to use dune instead of jbuilder.
I agree that such a command should be added. Previously, I was against such a command because I thought it could have been implemented just as easily externally. While that may be correct, such an approach will not result in a smooth user experience. So I would certainly be in favor of adding such a command. Anyone who would like to drive the effort on this should get in touch with the dune maintainers.
FWIW, I had the vague idea that it’s an IDE’s job to manage the project’s build system. I think we’d need dune files to be simple enough to be manageable by a program (IDE) while remaining editable manually. The IDE could bail if it encounters unknown directives or if certain assumptions on the project structure are violated.
It would be nice to just click to add a component, choose its type (public library, private library, collection of executables, etc.), specify dependencies and give it a name. I don’t have much experience using such IDE features let alone designing them but it seems like they would or should exist elsewhere.
Some of us prefer doing this stuff by hand, or using very lightweight tools. (There are many things I want automated in my dev environment, but this isn’t one of them.)
Or dune init can be a cli feature that can be invoked by an IDE (and therefore not specific to any editor – unless you’re refering to a different meaning of IDE).
The experience of using Java + Gradle with Intellij IDEA is sort of like this and I agree it’s helpful.
But that said, your starter kit looks neat as a reference implementation for starting out, thanks for that!
I agree that ideally this would not be a feature for dune to provide. Unfortunately, in practice the situation makes it very hard to punt this functionality to an IDE. First of all, there’s no single IDE preferred by OCaml users and no single protocol that would support this feature (like LSP). So this means that every text editor would have to implement this functionality from scratch. Given the probability of duplicate effort, and the fact that most text editors use programming languages far inferior to OCaml, doing this in dune is the lesser of all evils.
In the future, it would be nicer for dune to have a more complete way of exposing the internals of the project structure for real IDE’s to operate on.