init command
keel initinit takes no arguments or flags.
When to use it
Section titled “When to use it”- You already have a Go project and want to use
keel run. - You migrated a project to the Keel layout and are missing
keel.toml.
Exact behavior
Section titled “Exact behavior”- Verifies that
keel.tomldoes not exist. - Asks if you want to use Air for hot reload.
- If you choose Air and it is not in
PATH, tries to install it with:Terminal window go install github.com/air-verse/air@latest - Generates
keel.toml. - If Air is enabled and
.air.tomldoes not exist, creates it.
Generated files
Section titled “Generated files”Always:
keel.toml
Optional:
.air.toml
Initial keel.toml content
Section titled “Initial keel.toml content”In init mode, the [app] section is created empty for you to fill in:
[app]name = ""version = ""It also includes base scripts (dev, build, test, lint) and [features].
Variants of the dev script
Section titled “Variants of the dev script”The value of dev depends on the Air choice and the state of .air.toml:
- without Air:
dev = "go run ./cmd/main.go" - with Air and existing
.air.toml:dev = "air -c .air.toml" - with Air and new
.air.toml(created by init):dev = "air"
Typical adoption example
Section titled “Typical adoption example”cd existing-servicekeel initkeel run testCommon errors
Section titled “Common errors”keel.toml already exists in this directoryfailed to install Air: ...failed generating keel.toml: ...
Best practices after init
Section titled “Best practices after init”- Fill in
[app]with real name/version. - Review scripts for your actual CI/CD flow.
- Run
keel run testto validate that the project is already integrated.