Integrate Vigthoria into your CI/CD pipelines for automated AI workflows.
Automate AI-powered code reviews and documentation generation.
.github/workflows/vigthoria-review.ymlname: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Changed Files
id: changed
run: |
files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | tr '\n' ' ')
echo "files=$files" >> $GITHUB_OUTPUT
- name: AI Code Review
env:
VIGTHORIA_API_KEY: ${{ secrets.VIGTHORIA_API_KEY }}
run: |
for file in ${{ steps.changed.outputs.files }}; do
if [[ -f "$file" ]]; then
content=$(cat "$file")
response=$(curl -s https://api.vigthoria.io/v1/chat/completions \
-H "Authorization: Bearer $VIGTHORIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "vigthoria-code-v2",
"messages": [
{"role": "system", "content": "Review this code for bugs, security issues, and improvements. Be concise."},
{"role": "user", "content": "'"$content"'"}
],
"max_tokens": 500
}')
review=$(echo $response | jq -r '.choices[0].message.content')
echo "## Review for $file" >> review.md
echo "$review" >> review.md
echo "" >> review.md
fi
done
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const review = fs.readFileSync('review.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🤖 **AI Code Review**\n\n' + review
});
Add AI-powered testing and documentation to GitLab pipelines.
.gitlab-ci.ymlstages:
- test
- ai-analysis
- deploy
variables:
VIGTHORIA_API_KEY: ${VIGTHORIA_API_KEY}
ai-code-analysis:
stage: ai-analysis
image: node:20
script:
- |
npm install -g vigthoria-cli
# Analyze codebase
vigthoria analyze src/ \
--model vigthoria-code-v2 \
--output analysis.json
# Generate documentation
vigthoria document src/ \
--model vigthoria-reasoning-v2 \
--output docs/api/
artifacts:
paths:
- analysis.json
- docs/
expire_in: 1 week
only:
- merge_requests
- main
generate-tests:
stage: ai-analysis
image: python:3.11
script:
- pip install requests
- |
python << 'EOF'
import requests
import os
import json
api_key = os.environ['VIGTHORIA_API_KEY']
# Read source files
for root, dirs, files in os.walk('src'):
for file in files:
if file.endswith('.py'):
filepath = os.path.join(root, file)
with open(filepath, 'r') as f:
code = f.read()
response = requests.post(
'https://api.vigthoria.io/v1/chat/completions',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
},
json={
'model': 'vigthoria-code-v2',
'messages': [
{'role': 'system', 'content': 'Generate pytest unit tests for this code.'},
{'role': 'user', 'content': code}
],
'max_tokens': 1000
}
)
tests = response.json()['choices'][0]['message']['content']
test_file = filepath.replace('src/', 'tests/test_')
os.makedirs(os.path.dirname(test_file), exist_ok=True)
with open(test_file, 'w') as f:
f.write(tests)
EOF
artifacts:
paths:
- tests/
only:
- merge_requests
Integrate Vigthoria into Jenkins declarative pipelines.
Jenkinsfilepipeline {
agent any
environment {
VIGTHORIA_API_KEY = credentials('vigthoria-api-key')
}
stages {
stage('AI Code Quality') {
steps {
script {
def changedFiles = sh(
script: 'git diff --name-only HEAD~1',
returnStdout: true
).trim().split('\n')
def reviews = []
changedFiles.each { file ->
if (fileExists(file)) {
def content = readFile(file)
def response = httpRequest(
url: 'https://api.vigthoria.io/v1/chat/completions',
httpMode: 'POST',
contentType: 'APPLICATION_JSON',
customHeaders: [[
name: 'Authorization',
value: "Bearer ${VIGTHORIA_API_KEY}"
]],
requestBody: """
{
"model": "vigthoria-code-v2",
"messages": [
{"role": "system", "content": "Analyze code quality. Report issues only."},
{"role": "user", "content": ${groovy.json.JsonOutput.toJson(content)}}
],
"max_tokens": 500
}
"""
)
def result = readJSON text: response.content
reviews.add("${file}: ${result.choices[0].message.content}")
}
}
writeFile file: 'ai-review.txt', text: reviews.join('\n\n')
}
}
post {
always {
archiveArtifacts 'ai-review.txt'
}
}
}
stage('AI-Generated Changelog') {
when {
branch 'main'
}
steps {
script {
def commits = sh(
script: 'git log --oneline HEAD~10..HEAD',
returnStdout: true
).trim()
def response = httpRequest(
url: 'https://api.vigthoria.io/v1/chat/completions',
httpMode: 'POST',
contentType: 'APPLICATION_JSON',
customHeaders: [[
name: 'Authorization',
value: "Bearer ${VIGTHORIA_API_KEY}"
]],
requestBody: """
{
"model": "vigthoria-creative-v2",
"messages": [
{"role": "system", "content": "Generate a user-friendly changelog from these commits."},
{"role": "user", "content": "${commits.replace('"', '\\"')}"}
]
}
"""
)
def result = readJSON text: response.content
writeFile file: 'CHANGELOG.md', text: result.choices[0].message.content
}
}
}
}
}
version: 2.1
orbs:
node: circleci/node@5
jobs:
ai-documentation:
docker:
- image: cimg/node:20.0
steps:
- checkout
- run:
name: Generate AI Documentation
command: |
npm install vigthoria-sdk
node << 'EOF'
const { Vigthoria } = require('vigthoria-sdk');
const fs = require('fs');
const path = require('path');
const client = new Vigthoria(process.env.VIGTHORIA_API_KEY);
async function generateDocs() {
const files = fs.readdirSync('src').filter(f => f.endsWith('.js'));
for (const file of files) {
const code = fs.readFileSync(path.join('src', file), 'utf8');
const response = await client.chat.completions.create({
model: 'vigthoria-code-v2',
messages: [
{ role: 'system', content: 'Generate JSDoc documentation for this code.' },
{ role: 'user', content: code }
]
});
const docs = response.choices[0].message.content;
fs.writeFileSync(
path.join('docs', file.replace('.js', '.md')),
docs
);
}
}
generateDocs().catch(console.error);
EOF
- persist_to_workspace:
root: .
paths:
- docs/
workflows:
build-and-document:
jobs:
- ai-documentation:
context: vigthoria-context
Store your API key securely in each platform: