Run the script with the following command using one of the following subcommands:
generate: Generate the project structure based on the YAML configuration.generate-schema: Generate JSON schema for available structure templates.validate: Validate the YAML configuration file.info: Display information about the script and its dependencies.list: List the available structs
For more information, run the script with the -h or --help option (this is also available for each subcommand):
structkit -hUse the list command to see all available structures:
structkit listOr if you have auto-completion enabled, use Tab to see all options:
structkit generate <Tab>
# Shows all available structuresIf you have a .struct.yaml in the current directory and want to generate into the current directory, you can simply run:
structkit generatestructkit generate terraform/modules/generic ./my-terraform-moduleFor local YAML configuration files, the file:// protocol is automatically added:
# Both of these work identically
structkit generate my-config.yaml ./output
structkit generate file://my-config.yaml ./outputTip: If your config file is named .struct.yaml in the current directory and you want to generate into the current directory, you can simply run:
structkit generatestructkit generate --dry-run --diff file://structure.yaml ./outputstructkit generate \
--log=DEBUG \
--dry-run \
--backup=/path/to/backup \
--file-strategy=rename \
--log-file=/path/to/logfile.log \
terraform-module \
./my-terraform-module--log: Set logging level (DEBUG, INFO, WARNING, ERROR)--dry-run: Preview actions without making changes--diff: Show unified diffs for files that would be created/modified (useful with--dry-runand console output)--backup: Specify backup directory for existing files--file-strategy: Choose how to handle existing files (overwrite, skip, append, rename, backup)--log-file: Write logs to specified file--mappings-file: Provide external mappings file (can be used multiple times)
The generate-schema command creates JSON schema definitions for available structure templates, making it easier for tools and IDEs to provide autocompletion and validation.
# Generate schema to stdout
structkit generate-schema
# Generate schema with custom structures path
structkit generate-schema -s /path/to/custom/structures
# Save schema to file
structkit generate-schema -o schema.json
# Combine custom path and output file
structkit generate-schema -s /path/to/custom/structures -o schema.json-s, --structures-path: Path to additional structure definitions (optional)-o, --output: Output file path for the schema (default: stdout)
The generated schema includes all available structures from both the built-in contribs directory and any custom structures path you specify. This is useful for:
- IDE autocompletion when writing
.struct.yamlfiles - Validation of structure references in your configurations
- Programmatic discovery of available templates
Create a minimal .struct.yaml in the current directory:
structkit initOr specify a directory:
structkit init ./my-projectThe file includes:
- pre_hooks/post_hooks with echo commands
- A README.md placeholder in files
- A folders entry pointing to the github/workflows/run-structkit workflow at ./
structkit validate my-structure.yamlstructkit liststructkit info <structure_definition>