primate init
Scaffolds a primate.toml in the current working directory. Walks you
through the source directory, which target languages to generate, the
output path for each, and any external plugins.
primate init
primate is meant to drop into existing repos, so init only creates
the config — no constants/ directory, no starter .prim, no
AGENTS.md, no .gitignore munging.
What the wizard asks
- Where do your
.primsource files live? A directory under the project root (e.g.constants/,shared/constants/). Path autocomplete suggests existing directories. If the directory doesn’t exist yet,inittells you so on the spot — you’ll create it and drop your first.primfile in before the nextprimate build. - Which languages should primate generate? Multiselect across TypeScript, Rust, and Python. None checked by default — pick the ones you actually want.
- For each picked language: where should the output go? Path
autocomplete on every prompt. No preset value, since the right
path depends on your repo layout — the help line shows an
example for shape (
e.g. web/src/generated/constants/). - Use an external generator plugin? If yes, loops through name / command / path until you say no. See Plugins.
The wizard uses inquire for prompts. Press Esc to cancel at any point; nothing is written until the wizard completes.
What the result looks like
The generated primate.toml is heavily commented and lists every
option each picked generator accepts at its default value. Picking
TypeScript writes the full set of TypeScript options inline:
[[output]]
generator = "typescript"
# A directory. primate emits one `.ts` per namespace plus
# an `index.ts` that re-exports each one.
path = "web/src/generated/constants/"
# Generator options. Defaults shown — change as needed.
options.naming = "camelCase" # or "SCREAMING_SNAKE_CASE"
options.duration = "number" # or "temporal" for Temporal.Duration
options.u64 = "number" # or "bigint" for u64-typed constants
options.enumStyle = "literal" # or "const" or "enum" — see docs
Same idea for Rust and Python; only the targets you pick land in the file (no commented-out scaffolding for skipped ones).
Flags
--force/-f— overwrite an existingprimate.toml. Default is to refuse so an existing config doesn’t get clobbered.
After primate init
The wizard prints a small “next steps” block — create the source
directory, drop in a .prim file, run primate build. There’s also
a recommendation to commit the generated files alongside source:
consumers don’t need primate installed to use them, and CI can gate
on git diff --exit-code after primate build to catch drift.
See also
primate build— the generator pipelineinitconfigures.primate fmt— formatter; run after every.primedit.- Plugin protocol — what external generators need to implement.