Serialization
The GitLab lexicon serializes resources into .gitlab-ci.yml YAML. Keys are
converted to snake_case and jobs use kebab-case names. Stages are automatically
collected from all job definitions.
Building
Section titled “Building”Run chant build to produce a .gitlab-ci.yml from your declarations:
chant build# Writes dist/.gitlab-ci.ymlThe generated file includes:
stages:list — automatically collected from all jobstagepropertiesdefault:section — if aDefaultresource is exportedworkflow:section — if aWorkflowresource is exported- Job definitions with
snake_casekeys andkebab-casejob names
Key conversions
Section titled “Key conversions”| Chant (TypeScript) | YAML output | Rule |
|---|---|---|
export const buildApp = new Job({...}) | build-app: | Export name → kebab-case job key |
expire_in: "1 week" | expire_in: 1 week | Property names use spec-native snake_case |
new Image({ name: "node:20" }) | image: node:20 | Single-property objects are collapsed |
Validating locally
Section titled “Validating locally”The output is standard GitLab CI YAML. Validate with the GitLab CI Lint API or locally:
# Using the GitLab APIcurl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ --data-urlencode "content=$(cat dist/.gitlab-ci.yml)" \ "https://gitlab.com/api/v4/ci/lint"
# Using the glab CLIglab ci lint dist/.gitlab-ci.ymlCompatibility
Section titled “Compatibility”The output is compatible with:
- GitLab CI/CD (any recent GitLab version)
- GitLab CI Lint API
glabCLI tool- Any tool that processes
.gitlab-ci.ymlfiles