CI/CD Examples
livectx can run in any CI environment by downloading the binary. Use the livectx ci command for streamlined CI workflows with automatic commit and push support.
The ci command
livectx ci --commit --push generates context files, commits changes, and pushes to remote — all in one command.
GitLab CI
.gitlab-ci.yml
stages:
- context
generate-context:
stage: context
image: alpine:latest
variables:
ANTHROPIC_API_KEY: $ANTHROPIC_API_KEY
before_script:
- apk add --no-cache curl git
- curl -sSL https://livectx.com/install.sh | sh
script:
- livectx ci --commit --push
only:
- mainWithout Push (Artifacts Only)
.gitlab-ci.yml
generate-context:
stage: context
image: alpine:latest
variables:
ANTHROPIC_API_KEY: $ANTHROPIC_API_KEY
before_script:
- apk add --no-cache curl
- curl -sSL https://livectx.com/install.sh | sh
script:
- livectx generate
artifacts:
paths:
- CONTEXT.md
- SYSTEM_PROMPT.md
expire_in: 1 week
only:
- main
- merge_requestsCircleCI
.circleci/config.yml
version: 2.1
jobs:
generate-context:
docker:
- image: cimg/base:stable
steps:
- checkout
- run:
name: Install livectx
command: curl -sSL https://livectx.com/install.sh | sh
- run:
name: Generate and push context
command: livectx ci --commit --push
workflows:
main:
jobs:
- generate-context:
filters:
branches:
only: mainJenkins
Jenkinsfile
pipeline {
agent any
environment {
ANTHROPIC_API_KEY = credentials('anthropic-api-key')
}
stages {
stage('Install livectx') {
steps {
sh 'curl -sSL https://livectx.com/install.sh | sh'
}
}
stage('Generate Context') {
steps {
sh 'livectx ci --commit --push'
}
}
}
post {
always {
archiveArtifacts artifacts: 'CONTEXT.md, SYSTEM_PROMPT.md', fingerprint: true, allowEmptyArchive: true
}
}
}Azure DevOps
azure-pipelines.yml
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
- group: api-keys # Contains ANTHROPIC_API_KEY
steps:
- checkout: self
persistCredentials: true
- script: curl -sSL https://livectx.com/install.sh | sh
displayName: 'Install livectx'
- script: livectx ci --commit --push
displayName: 'Generate and push context'
env:
ANTHROPIC_API_KEY: $(ANTHROPIC_API_KEY)Bitbucket Pipelines
bitbucket-pipelines.yml
image: atlassian/default-image:4
pipelines:
branches:
main:
- step:
name: Generate context
script:
- curl -sSL https://livectx.com/install.sh | sh
- livectx ci --commit --push
artifacts:
- CONTEXT.md
- SYSTEM_PROMPT.mdManual Binary Download
For environments where the install script doesn't work, download the binary directly:
# Download latest release
VERSION=$(curl -s https://api.github.com/repos/skridlevsky/livectx/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
VERSION_NUM="${VERSION#v}" # Remove 'v' prefix
# Detect OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
[ "$ARCH" = "x86_64" ] && ARCH="amd64"
[ "$ARCH" = "aarch64" ] && ARCH="arm64"
# Download and extract
curl -fsSL "https://github.com/skridlevsky/livectx/releases/download/${VERSION}/livectx_${VERSION_NUM}_${OS}_${ARCH}.tar.gz" | tar xz
./livectx generateEnvironment Variables
All CI platforms need access to your LLM API key. Store it as a secret/secure variable:
| Platform | Where to set secrets |
|---|---|
| GitLab CI | Settings → CI/CD → Variables |
| CircleCI | Project Settings → Environment Variables |
| Jenkins | Manage Jenkins → Credentials |
| Azure DevOps | Pipelines → Library → Variable Groups |
| Bitbucket | Repository Settings → Pipelines → Variables |
Tip: Use [skip ci]
The default commit message includes [skip ci] to prevent infinite CI loops.