Hof Creators are code generator modules intended for one-time bootstrapping from a few inputs. Use them to give your users one-liners for getting started or to provide reusable application blueprints.
hof create is run by users who provide the url to a git repository.
The user is presented with an interactive prompt you design.
Their answers provide the input to your generator,
which should output the files they need to get started using your project.
The process is flexible enough for any git repository to provide the creator experience,
so what you generate does not have to be
Adding a Creator to your repository
To add a creator to a git repository, we have to set up a CUE module and hof generator, and then push a tag.
- initialize a CUE repository in your project (
hof mod init cue <repo-url>)
- add a
creator.cueat the root of your repository to hold the generator
- fill in the generator, templates, and prompt
- test the creator locally
- tag and push
There are a number of options for how to organize a creator, provide the prompt and inputs, and conditionally ask questions or output files. More information is provided below.
The following is the creator from the
in the video above.
As we were saying, a
creator is a hof generator with a
run as a one-time code generation.
The main new part is the
prompt where you can ask the user for inputs.
These then form the input value to code generation,
and at this point, the creator is like any other generator
Users then run
hof create <repo>@<tag> to bootstrap
full applications or features to an existing application.
Since creators are just generators, you can create the files
needed for CI/CD, deployment, security, or other system.
You can output CUE files and many
will also provide creators to bootstrap the
initial files needed to use their module.
To learn more about writing creators, prompts, and how to give your users one-line bootstrapping or application blueprints, see the hof create section