Skip to main content
Version: Next

vela def init-module

Initialize a new definition module.

Synopsis

Initialize a new Go-based definition module with proper directory structure.

Creates:

  • module.yaml with metadata
  • go.mod and go.sum files
  • cmd/register/main.go entry point for registry loading
  • components/, traits/, policies/, workflowsteps/ directories
  • Scaffolded definition files (optional)
  • README.md with documentation

This sets up a complete module that can be published as a Go module and applied using 'vela def apply-module'.

vela def init-module [flags]

Examples

# Initialize a new module - creates 'my-defs' directory automatically
> vela def init-module --name my-defs

# Initialize a module in a specific directory
> vela def init-module ./my-definitions

# Initialize with custom module name and Go module path
> vela def init-module ./my-defs --name my-defs --go-module github.com/myorg/my-defs

# Initialize with example definitions
> vela def init-module --name my-defs --with-examples

# Initialize with scaffolded component definitions
> vela def init-module --name my-defs --components webservice,worker,task

# Initialize with multiple definition types
> vela def init-module --name my-defs --components api,backend --traits autoscaler --policies topology

# Initialize in current directory (if no --name or path given)
> vela def init-module

Options

      --components string      Comma-separated component names to scaffold (e.g., webservice,worker)
-d, --desc string Description of the module
-g, --go-module string Go module path (e.g., github.com/myorg/my-defs)
-h, --help help for init-module
-n, --name string Name for the module (defaults to directory name)
--policies string Comma-separated policy names to scaffold (e.g., topology,override)
--traits string Comma-separated trait names to scaffold (e.g., autoscaler,ingress)
-e, --with-examples Include example definitions
--workflowsteps string Comma-separated workflow step names to scaffold (e.g., deploy,notify)

Options inherited from parent commands

  -V, --verbosity Level   number for the log level verbosity
-y, --yes Assume yes for all user prompts

SEE ALSO

Go Back to CLI Commands Homepage.

Auto generated by spf13/cobra script in KubeVela.