Skip to Content
FeaturesCLI Reference

CLI Reference

Primary focus: The CLI is designed for PR reviews and quality gates in CI/CD pipelines. While it supports triggering scans and exporting results, the core use case is integrating CodeStax security checks into your automated workflows — blocking merges that introduce critical vulnerabilities and triggering PR-level reviews on every pull request.

The CodeStax CLI lets you interact with the platform from your terminal or CI/CD pipeline.

Installation

Download the CLI from your CodeStax dashboard or clone from the repository:

# Download the CLI script curl -o codestax https://codestax.co/cli/codestax chmod +x codestax # Or use directly with Python python3 codestax.py <command> # Verify installation python3 codestax.py --version

Authentication

Set your API key as an environment variable:

export CODESTAX_API_KEY="your-api-key-here" export CODESTAX_API_URL="https://codestax.co/api/v1" # optional, defaults to production

Generate an API key from Settings → API Keys in the dashboard.

Commands

codestax trigger

Trigger a security scan on a repository.

codestax trigger --repo my-org/my-repo --type deep
FlagRequiredDefaultDescription
--repoYesRepository in owner/name format
--typeNosmartScan type: smart or deep
--branchNodefault branchBranch to scan
--waitNofalseWait for scan to complete and print results

codestax gate

Enforce a quality gate. Returns exit code 0 (pass) or 1 (fail).

codestax gate --repo my-org/my-repo --scan latest
FlagRequiredDefaultDescription
--repoYesRepository in owner/name format
--scanNolatestScan ID or latest
--max-criticalNo0Max critical findings allowed
--max-highNo5Max high findings allowed
--max-scoreNo50Max risk score allowed

codestax list

List scans for a repository.

codestax list --repo my-org/my-repo --limit 10
FlagRequiredDefaultDescription
--repoYesRepository in owner/name format
--limitNo20Number of results
--statusNoallFilter by status: completed, running, failed
--formatNotableOutput format: table, json

codestax issues

List issues from the latest scan.

codestax issues --repo my-org/my-repo --severity critical,high
FlagRequiredDefaultDescription
--repoYesRepository in owner/name format
--scanNolatestScan ID or latest
--severityNoallComma-separated: critical, high, medium, low
--typeNoallFilter by scanner type: sast, sca, secrets, iac
--formatNotableOutput format: table, json

codestax dora

Retrieve DORA metrics for a repository.

codestax dora --repo my-org/my-repo --period 30d
FlagRequiredDefaultDescription
--repoYesRepository in owner/name format
--periodNo30dTime period: 7d, 30d, 90d
--formatNotableOutput format: table, json

codestax export

Export scan results in various formats.

codestax export --repo my-org/my-repo --format sarif --output results.sarif
FlagRequiredDefaultDescription
--repoYesRepository in owner/name format
--scanNolatestScan ID or latest
--formatYesExport format: sarif, csv, json
--outputNostdoutOutput file path

codestax review

Trigger a PR review.

codestax review --repo my-org/my-repo --pr 42
FlagRequiredDefaultDescription
--repoYesRepository in owner/name format
--prYesPull request number
--waitNofalseWait for review to complete

CI/CD Usage

GitHub Actions

name: CodeStax Security Gate on: [pull_request] jobs: security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install CodeStax CLI run: | curl -o codestax.py https://codestax.co/cli/codestax chmod +x codestax.py - name: Trigger Scan env: CODESTAX_API_KEY: ${{ secrets.CODESTAX_API_KEY }} run: python3 codestax.py trigger --repo ${{ github.repository }} --wait - name: Enforce Quality Gate env: CODESTAX_API_KEY: ${{ secrets.CODESTAX_API_KEY }} run: python3 codestax.py gate --repo ${{ github.repository }} --max-critical 0 --max-high 3

GitLab CI

codestax-gate: image: python:3.11-alpine stage: test before_script: - curl -o codestax.py https://codestax.co/cli/codestax - chmod +x codestax.py script: - python3 codestax.py trigger --repo $CI_PROJECT_PATH --wait - python3 codestax.py gate --repo $CI_PROJECT_PATH --max-critical 0 variables: CODESTAX_API_KEY: $CODESTAX_API_KEY

Exit Codes

CodeMeaning
0Success / gate passed
1Gate failed / scan found issues above threshold
2Authentication error (invalid or missing API key)
3Network error (could not reach API)
4Invalid arguments