File Handling
Flexible options for handling files, permissions, and content sources.
File Properties
skip— Skip file/folder creation entirelyskip_if_exists— Skip only if the file already existspermissions— Set custom file permissions (octal)content— Define file content inlinefile— Reference external file content
File propertiesyaml
files:
- README.md:
skip: true # Never create this file
- config.yml:
skip_if_exists: true # Only create if it doesn't exist
content: "default: value"
- scripts/deploy.sh:
permissions: '0755' # Executable script
content: |
#!/bin/bash
echo "Deploying..."Remote File Protocols
StructKit supports multiple protocols for fetching remote content:
HTTP/HTTPS
file: https://raw.githubusercontent.com/example/repo/main/requirements.txtGitHub Protocols
# Standard GitHub
file: github://github/gitignore/main/Python.gitignore
# GitHub HTTPS
file: githubhttps://actions/starter-workflows/main/ci/python-app.yml
# GitHub SSH (private repos)
file: githubssh://company/private-repo/main/config/template.ymlCloud Storage
# Amazon S3
file: s3://my-bucket/data/template.csv
# Google Cloud Storage
file: gs://my-bucket/configs/default.jsonEnvironment variables for HTTP behavior: STRUCTKIT_HTTP_TIMEOUT (default 10s), STRUCTKIT_HTTP_RETRIES (default 2), STRUCTKIT_DENY_NETWORK=1 to skip HTTP.
File Handling Strategies
Control how existing files are handled with --file-strategy:
- overwrite — Replace existing files (default)
- skip — Skip files that already exist
- append — Add content to existing files
- rename — Rename existing files with a suffix
- backup — Move existing files to backup directory
Terminalbash
# Skip existing files
structkit generate --file-strategy=skip my-config.yaml ./output
# Backup existing files
structkit generate --file-strategy=backup --backup=/tmp/backup my-config.yaml ./outputRelated
- YAML Configuration — Full YAML reference: structures, file content, variables, hooks, mappings, and remote sources.
- GitHub Actions — Install with httpdss/structkit-setup@v0, then validate and detect drift with httpdss/structkit-action@v0.
- Examples — Real-world YAML configs for Python apps, monorepos, Docker stacks, and Terraform modules.