Clarx

CI Integration

How to add Clarx scoring to GitHub Actions, GitLab CI, and other pipelines.

CI Integration

Clarx is designed to run in CI. Add it to any pipeline to enforce a minimum score on every pull request.


GitHub Actions

Basic score gate

# .github/workflows/clarx.yml
name: Clarx AI-First Score

on:
  pull_request:
    branches: [main]

jobs:
  score:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npx clarx score --min-score 70

PR comment with markdown report

name: Clarx Score

on:
  pull_request:

jobs:
  score:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: actions/checkout@v4

      - name: Score and post as PR comment
        uses: actions/github-script@v7
        with:
          script: |
            const { execSync } = require('child_process');
            const report = execSync('npx clarx score --format markdown').toString();
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: report
            });

      - name: Enforce minimum score
        run: npx clarx score --min-score 65

GitLab CI

clarx:
  image: node:20
  script:
    - npx clarx score --min-score 70 --format json | tee clarx-report.json
  artifacts:
    paths:
      - clarx-report.json
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"

Start conservative. A low threshold that passes lets teams adopt Clarx without blocking work. Raise it incrementally.

PhaseRecommended threshold
Initial adoption--min-score 50 (blocks only hard failures)
Stabilized baseline--min-score 65
Target state--min-score 80

Do not set a threshold higher than the current score on main. The first run should always pass on the existing codebase.


Ignoring paths

Use --ignore to exclude generated directories that are not in .gitignore:

npx clarx score --ignore "**/.next,**/dist,**/coverage"

Or declare them in clarx-manifest.json under generated — the engine always excludes declared generated paths automatically.