CLI Overview
keel is the official CLI for the Keel ecosystem to create, initialize, and maintain structured Go projects.
This section is based on the real code of keel and ss-keel-core, including tests and generator templates.
Sources of truth
Section titled “Sources of truth”keel/cmd/*: real definition of commands, arguments, aliases and flags.keel/internal/generator/templates/*: exact files and structure generated by the CLI.keel/cmd/*_test.go: expected behavior cases and errors.ss-keel-core/core/*: resulting HTTP runtime (/health,/docs, OpenAPI, lifecycle).
What the CLI solves
Section titled “What the CLI solves”- Creating projects ready to work with (
keel new) - Adopting Keel in existing projects (
keel init) - Generating components with automatic wiring (
keel generate) - Installing addons with automatic project wiring (
keel add) - Running project scripts (
keel run) - Shell autocompletion (
keel completion)
Available commands today
Section titled “Available commands today”| Command | Alias | Purpose |
|---|---|---|
keel new [project-name] | keel n | Creates a new project from official templates |
keel init | — | Generates keel.toml in an existing project |
keel generate [type] [name] | keel g | Generates modules/components and updates cmd/main.go |
keel add [alias|repo] | — | Installs an addon from the official registry or a direct GitHub repo |
keel run [script] | — | Runs scripts from [scripts] in keel.toml |
keel completion ... | — | Generates/installs autocompletion (zsh, bash, fish, powershell) |
keel --version | keel -v | Shows version, commit, build date and platform |
Recommended workflow
Section titled “Recommended workflow”# 1) Install CLIgo install github.com/slice-soft/keel@latest
# 2) Create projectkeel new my-apicd my-api
# 3) Run dev environmentkeel run dev
# 4) Generate first modulekeel generate module users --gorm
# 5) Install another addonkeel add jwt
# 6) Check commands and versionkeel --helpkeel --versionRelationship with ss-keel-core
Section titled “Relationship with ss-keel-core”The CLI generates code that directly uses ss-keel-core:
core.New(core.KConfig{...})app.Use(...)app.RegisterController(...)app.Listen()
When you run a generated project, you inherit the core’s behavior:
GET /health(ifDisableHealthisfalse)GET /docsandGET /docs/openapi.jsonwhenEnv != "production"- standardized HTTP error handling and graceful shutdown