Lovelace Developer Portal
Overview
Auth Hub
Studio
Agents Cloud
Skills
Memory Platform
Lattice Cloud
Hosting
Ada CLI
MCP Gateway
Ada
Periscope
Editor Extensions
Skip to main content

CI/CD Integration

Complete guide to integrating Ada CLI with continuous integration and deployment pipelines

Overview

Ada CLI integrates seamlessly with CI/CD pipelines to provide automated code analysis, AI-powered code review, and intelligent deployment assistance. This guide covers integration patterns for popular CI/CD platforms.

GitHub Actions

Basic Workflow

Create .github/workflows/lovelace.yml:

yaml
name: Lovelace AI Analysis

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

jobs:
  analyze:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0 # Full history for better analysis

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: "npm"

      - name: Install Ada CLI
        run: curl -fsSL https://d.uselovelace.com/install | sh

      - name: Authenticate with Lovelace
        run: lovelace auth signin --token ${{ secrets.LOVELACE_TOKEN }}

      - name: Initialize workspace
        run: ada workspace init --workspace ${{ github.repository }}

      - name: Run code analysis
        run: |
          ada analyze --output json --output-file analysis.json
          ada analyze --security --output json --output-file security.json

      - name: Upload analysis results
        uses: actions/upload-artifact@v3
        with:
          name: lovelace-analysis
          path: |
            analysis.json
            security.json

      - name: Comment on PR
        if: github.event_name == 'pull_request'
        uses: actions/github-script@v7
        with:
          script: |
            const fs = require('fs');
            const analysis = JSON.parse(fs.readFileSync('analysis.json', 'utf8'));

            const comment = `## 🤖 Lovelace AI Analysis

            **Code Quality Score**: ${analysis.quality_score}/100
            **Issues Found**: ${analysis.issues.length}
            **Security Concerns**: ${analysis.security_issues.length}

            ${analysis.summary}

            View full analysis in the [workflow artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).`;

            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: comment
            });

Advanced Workflow with Agent Execution

yaml
name: Comprehensive Lovelace Analysis

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  analysis:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup Lovelace
        uses: lovelace-ai/setup-action@v1
        with:
          token: ${{ secrets.LOVELACE_TOKEN }}
          workspace: ${{ github.repository }}

      - name: Start agent daemon
        run: ada agents daemon start

      - name: Run analysis agents
        run: |
          # Run multiple agents in parallel
          ada agents run analysis-worker --task code-quality --async &
          ada agents run security-worker --task vulnerability-scan --async &
          ada agents run test-worker --task generate-tests --async &

          # Wait for completion
          wait

      - name: Generate documentation
        run: ada agents run docs-worker --task api-docs --input ./src/api/

      - name: Create PR review
        run: |
          ada chat --provider anthropic --context git,workspace << EOF
          Please review this pull request and provide detailed feedback on:
          1. Code quality and architecture
          2. Security considerations
          3. Testing coverage
          4. Documentation completeness

          Focus on actionable improvements and best practices.
          EOF

      - name: Upload comprehensive report
        uses: actions/upload-artifact@v3
        with:
          name: lovelace-comprehensive-analysis
          path: |
            analysis-*.json
            security-report.json
            test-generation-report.json
            api-docs/

Reusable Action

Create .github/actions/lovelace-analysis/action.yml:

yaml
name: "Lovelace Analysis"
description: "Run Lovelace AI analysis on code"

inputs:
  token:
    description: "Lovelace authentication token"
    required: true
  workspace:
    description: "Workspace name"
    required: true
  analysis-type:
    description: "Type of analysis to run"
    required: false
    default: "full"

outputs:
  quality-score:
    description: "Code quality score"
    value: ${{ steps.analyze.outputs.quality-score }}

runs:
  using: "composite"
  steps:
    - name: Install Ada CLI
      shell: bash
      run: curl -fsSL https://d.uselovelace.com/install | sh

    - name: Authenticate
      shell: bash
      run: lovelace auth signin --token ${{ inputs.token }}

    - name: Initialize workspace
      shell: bash
      run: ada workspace init --workspace ${{ inputs.workspace }}

    - name: Run analysis
      id: analyze
      shell: bash
      run: |
        case "${{ inputs.analysis-type }}" in
          "security")
            ada analyze --security --output json --output-file analysis.json
            ;;
          "quality")
            ada analyze --symbols --dependencies --output json --output-file analysis.json
            ;;
          "full")
            ada analyze --output json --output-file analysis.json
            ;;
        esac

        # Extract quality score for output
        SCORE=$(jq -r '.quality_score' analysis.json)
        echo "quality-score=$SCORE" >> $GITHUB_OUTPUT

GitLab CI/CD

Basic Pipeline

Create .gitlab-ci.yml:

yaml
stages:
  - analysis
  - review
  - report

variables:
  NODE_VERSION: "20"

lovelace-analysis:
  stage: analysis
  image: node:${NODE_VERSION}
  before_script:
    - curl -fsSL https://d.uselovelace.com/install | sh
    - lovelace auth signin --token $LOVELACE_TOKEN
  script:
    - ada workspace init --workspace $CI_PROJECT_NAME
    - ada analyze --output json --output-file analysis.json
    - ada analyze --security --output json --output-file security.json
  artifacts:
    reports:
      # GitLab security dashboard integration
      sast: security.json
    paths:
      - analysis.json
      - security.json
    expire_in: 1 week
  only:
    - merge_requests
    - main

ai-code-review:
  stage: review
  image: node:${NODE_VERSION}
  dependencies:
    - lovelace-analysis
  before_script:
    - curl -fsSL https://d.uselovelace.com/install | sh
    - lovelace auth signin --token $LOVELACE_TOKEN
  script:
    - |
      # Generate AI-powered code review
      ada chat --provider anthropic --context git << EOF
      Please review the changes in this merge request:

      $(git diff --name-only $CI_MERGE_REQUEST_TARGET_BRANCH_NAME)

      Provide specific feedback on code quality, security, and best practices.
      EOF > ai-review.md
    - |
      # Post review as MR comment
      curl --request POST \
        --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
        --header "Content-Type: application/json" \
        --data "{\"body\": \"$(cat ai-review.md)\"}" \
        "$CI_API_V4_URL/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes"
  artifacts:
    paths:
      - ai-review.md
  only:
    - merge_requests

generate-report:
  stage: report
  image: node:${NODE_VERSION}
  dependencies:
    - lovelace-analysis
  script:
    - |
      # Generate comprehensive HTML report
      ada agents run docs-worker --task analysis-report \
        --input analysis.json --output report.html
  artifacts:
    paths:
      - report.html
    expire_in: 30 days
  only:
    - main

Advanced Pipeline with Quality Gates

yaml
include:
  - template: Security/SAST.gitlab-ci.yml

stages:
  - prepare
  - analyze
  - quality-gate
  - deploy

variables:
  LOVELACE_QUALITY_THRESHOLD: "80"
  LOVELACE_SECURITY_THRESHOLD: "high"

prepare-workspace:
  stage: prepare
  image: node:20
  script:
    - curl -fsSL https://d.uselovelace.com/install | sh
    - lovelace auth signin --token $LOVELACE_TOKEN
    - ada workspace init --workspace $CI_PROJECT_NAME
    - ada workspace sync
  artifacts:
    paths:
      - .lovelace/
  cache:
    key: lovelace-workspace-$CI_COMMIT_REF_SLUG
    paths:
      - .lovelace/

comprehensive-analysis:
  stage: analyze
  image: node:20
  dependencies:
    - prepare-workspace
  parallel:
    matrix:
      - ANALYSIS_TYPE: [quality, security, architecture, dependencies]
  script:
    - curl -fsSL https://d.uselovelace.com/install | sh
    - lovelace auth signin --token $LOVELACE_TOKEN
    - |
      case "$ANALYSIS_TYPE" in
        "quality")
          ada analyze --symbols --dependencies --output json --output-file quality-analysis.json
          ;;
        "security")
          ada analyze --security --output json --output-file security-analysis.json
          ;;
        "architecture")
          ada analyze --architecture --output json --output-file architecture-analysis.json
          ;;
        "dependencies")
          ada analyze --dependencies --output json --output-file deps-analysis.json
          ;;
      esac
  artifacts:
    paths:
      - "*-analysis.json"

quality-gate:
  stage: quality-gate
  image: node:20
  dependencies:
    - comprehensive-analysis
  script:
    - |
      # Check quality threshold
      QUALITY_SCORE=$(jq -r '.quality_score' quality-analysis.json)
      if [ "$QUALITY_SCORE" -lt "$LOVELACE_QUALITY_THRESHOLD" ]; then
        echo "Quality score $QUALITY_SCORE below threshold $LOVELACE_QUALITY_THRESHOLD"
        exit 1
      fi
    - |
      # Check security issues
      SECURITY_ISSUES=$(jq -r '.critical_issues | length' security-analysis.json)
      if [ "$SECURITY_ISSUES" -gt 0 ]; then
        echo "Found $SECURITY_ISSUES critical security issues"
        exit 1
      fi
    - echo "Quality gate passed!"
  allow_failure: false

Azure DevOps

Basic Pipeline

Create azure-pipelines.yml:

yaml
trigger:
  branches:
    include:
      - main
      - develop

pr:
  branches:
    include:
      - main

pool:
  vmImage: "ubuntu-latest"

variables:
  nodeVersion: "20.x"

stages:
  - stage: Analysis
    displayName: "Lovelace Analysis"
    jobs:
      - job: CodeAnalysis
        displayName: "Code Analysis"
        steps:
          - task: NodeTool@0
            inputs:
              versionSpec: $(nodeVersion)
            displayName: "Setup Node.js"

          - script: |
              curl -fsSL https://d.uselovelace.com/install | sh
            displayName: "Install Ada CLI"

          - script: |
              lovelace auth signin --token $(LOVELACE_TOKEN)
            displayName: "Authenticate with Lovelace"
            env:
              LOVELACE_TOKEN: $(LOVELACE_TOKEN)

          - script: |
              ada workspace init --workspace $(Build.Repository.Name)
              ada analyze --output json --output-file $(Build.ArtifactStagingDirectory)/analysis.json
            displayName: "Run Analysis"

          - task: PublishBuildArtifacts@1
            inputs:
              pathToPublish: "$(Build.ArtifactStagingDirectory)"
              artifactName: "lovelace-analysis"
            displayName: "Publish Analysis Results"

  - stage: Review
    displayName: "AI Code Review"
    condition: eq(variables['Build.Reason'], 'PullRequest')
    dependsOn: Analysis
    jobs:
      - job: AIReview
        displayName: "AI Code Review"
        steps:
          - task: DownloadBuildArtifacts@0
            inputs:
              artifactName: "lovelace-analysis"
              downloadPath: "$(System.ArtifactsDirectory)"

          - script: |
              curl -fsSL https://d.uselovelace.com/install | sh
              lovelace auth signin --token $(LOVELACE_TOKEN)
            env:
              LOVELACE_TOKEN: $(LOVELACE_TOKEN)

          - script: |
              # Generate AI review
              ada chat --provider anthropic --context git > ai-review.md

              # Post as PR comment using Azure DevOps REST API
              curl -X POST \
                -H "Authorization: Bearer $(System.AccessToken)" \
                -H "Content-Type: application/json" \
                -d "{\"comments\":[{\"parentCommentId\":0,\"content\":\"$(cat ai-review.md)\",\"commentType\":1}]}" \
                "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_apis/git/repositories/$(Build.Repository.ID)/pullRequests/$(System.PullRequest.PullRequestId)/threads?api-version=6.0"
            displayName: "Generate and Post AI Review"

Jenkins

Declarative Pipeline

Create Jenkinsfile:

groovy
pipeline {
    agent any

    environment {
        LOVELACE_TOKEN = credentials('lovelace-token')
        NODE_VERSION = '20'
    }

    stages {
        stage('Setup') {
            steps {
                script {
                    // Install Node.js
                    def nodeHome = tool name: 'NodeJS', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
                    env.PATH = "${nodeHome}/bin:${env.PATH}"
                }

                sh 'curl -fsSL https://d.uselovelace.com/install | sh'
                sh 'lovelace auth signin --token $LOVELACE_TOKEN'
            }
        }

        stage('Initialize Workspace') {
            steps {
                sh 'ada workspace init --workspace ${JOB_NAME}'
            }
        }

        stage('Analysis') {
            parallel {
                stage('Code Quality') {
                    steps {
                        sh 'ada analyze --symbols --dependencies --output json --output-file quality-analysis.json'
                    }
                    post {
                        always {
                            archiveArtifacts artifacts: 'quality-analysis.json', fingerprint: true
                        }
                    }
                }

                stage('Security Scan') {
                    steps {
                        sh 'ada analyze --security --output json --output-file security-analysis.json'
                    }
                    post {
                        always {
                            archiveArtifacts artifacts: 'security-analysis.json', fingerprint: true
                        }
                    }
                }

                stage('Agent Tasks') {
                    steps {
                        sh '''
                            ada agents daemon start
                            ada agents run analysis-worker --task architecture-review --async
                            ada agents run test-worker --task coverage-analysis --async
                        '''
                    }
                }
            }
        }

        stage('Quality Gate') {
            steps {
                script {
                    def analysis = readJSON file: 'quality-analysis.json'
                    if (analysis.quality_score < 80) {
                        error "Quality score ${analysis.quality_score} below threshold 80"
                    }

                    def security = readJSON file: 'security-analysis.json'
                    if (security.critical_issues.size() > 0) {
                        error "Found ${security.critical_issues.size()} critical security issues"
                    }
                }
            }
        }

        stage('AI Review') {
            when {
                changeRequest()
            }
            steps {
                sh '''
                    ada chat --provider anthropic --context git << EOF
                    Please review this pull request and provide feedback on:
                    1. Code quality improvements
                    2. Security considerations
                    3. Architecture decisions

                    Focus on actionable recommendations.
                    EOF > ai-review.md
                '''

                script {
                    def review = readFile 'ai-review.md'
                    pullRequest.comment(review)
                }
            }
        }
    }

    post {
        always {
            sh 'ada agents daemon stop'
            cleanWs()
        }

        success {
            echo 'Lovelace analysis completed successfully!'
        }

        failure {
            echo 'Lovelace analysis failed. Check the logs for details.'
        }
    }
}

CircleCI

Configuration

Create .circleci/config.yml:

yaml
version: 2.1

orbs:
  node: circleci/node@5.1.0

executors:
  lovelace-executor:
    docker:
      - image: cimg/node:20.0
    resource_class: large

commands:
  setup-lovelace:
    steps:
      - run:
          name: Install Ada CLI
          command: curl -fsSL https://d.uselovelace.com/install | sh
      - run:
          name: Authenticate
          command: lovelace auth signin --token $LOVELACE_TOKEN

jobs:
  analyze:
    executor: lovelace-executor
    steps:
      - checkout
      - setup-lovelace
      - run:
          name: Initialize workspace
          command: ada workspace init --workspace $CIRCLE_PROJECT_REPONAME
      - run:
          name: Run comprehensive analysis
          command: |
            ada analyze --output json --output-file analysis.json
            ada analyze --security --output json --output-file security.json
      - store_artifacts:
          path: analysis.json
      - store_artifacts:
          path: security.json
      - persist_to_workspace:
          root: .
          paths:
            - analysis.json
            - security.json

  ai-review:
    executor: lovelace-executor
    steps:
      - checkout
      - attach_workspace:
          at: .
      - setup-lovelace
      - run:
          name: Generate AI review
          command: |
            ada chat --provider anthropic --context git > ai-review.md
      - run:
          name: Post PR comment
          command: |
            if [ -n "$CIRCLE_PULL_REQUEST" ]; then
              PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's/.*\/pull\///')
              gh pr comment $PR_NUMBER --body-file ai-review.md
            fi

  quality-gate:
    executor: lovelace-executor
    steps:
      - attach_workspace:
          at: .
      - run:
          name: Check quality thresholds
          command: |
            QUALITY_SCORE=$(jq -r '.quality_score' analysis.json)
            if [ "$QUALITY_SCORE" -lt 80 ]; then
              echo "Quality score $QUALITY_SCORE below threshold 80"
              exit 1
            fi

            CRITICAL_ISSUES=$(jq -r '.critical_issues | length' security.json)
            if [ "$CRITICAL_ISSUES" -gt 0 ]; then
              echo "Found $CRITICAL_ISSUES critical security issues"
              exit 1
            fi

workflows:
  lovelace-analysis:
    jobs:
      - analyze
      - ai-review:
          requires:
            - analyze
          filters:
            branches:
              ignore: main
      - quality-gate:
          requires:
            - analyze

Best Practices

Security

  1. Store tokens securely: Use CI/CD platform secret management
  2. Limit permissions: Use least-privilege tokens
  3. Audit access: Monitor token usage and access patterns
  4. Rotate tokens: Regularly rotate authentication tokens

Performance

  1. Cache dependencies: Cache Ada CLI installation and workspace data
  2. Parallel execution: Run different analysis types in parallel
  3. Incremental analysis: Only analyze changed files when appropriate
  4. Resource allocation: Allocate sufficient CPU and memory for analysis

Integration Patterns

  1. Quality gates: Use analysis results to block deployments
  2. Progressive analysis: Start with basic analysis, add more over time
  3. Contextual feedback: Provide specific, actionable feedback
  4. Artifact management: Store and version analysis results

Monitoring

  1. Track metrics: Monitor analysis completion rates and timing
  2. Alert on failures: Set up alerts for analysis failures
  3. Quality trends: Track code quality improvements over time
  4. Usage analytics: Monitor which features are most valuable

Troubleshooting

Common Issues

Authentication failures:

bash
# Check token validity
lovelace auth status

# Verify token in CI environment
echo $LOVELACE_TOKEN | head -c 20

Workspace initialization failures:

bash
# Check workspace permissions
ada workspace list

# Initialize with explicit workspace
ada workspace init --workspace explicit-name

Analysis timeouts:

bash
# Increase timeout
lovelace config set analysis.timeout 600

# Run with reduced scope
ada analyze --files "src/**/*.ts"

See Also:

  • CLI Quickstart - Install, authenticate, and run a first chat
  • CLI Installation - Full install matrix

Build and deploy AI agents with ease.

Quick Start

  • Getting Started
  • Build Your First Agent
  • Platform Concepts
  • Examples & Tutorials

Develop

  • Create an Agent
  • Connect an MCP Server
  • API Reference
  • CLI Tools

Platform

  • Agents Cloud
  • Roadmap
  • Platform Changelog
  • Status

Resources

  • Discord
  • GitHub
  • Support
  • Developer Blog
Lovelace logo
Lovelace
Made with ❤️ by Reasonable Tech CompanySupport
TermsPrivacy
All systems operational

Overview

Installation

Quick Start

Interactive Chat

Agent Execution

Workspace Management

MCP Integration

Authentication Setup

Editor Integration

AI Chat Analysis

Overview

ada chat

ada agents

ada workspace

lovelace mcp

ada sessions

ada setup

lovelace auth

lovelace config

ada doctor

ada reset

Overview

Product Requirements

Project Organization

Overview

Documentation

Hackathon

Learning

CI/CD

Editors