CLI|~6 min read

4. Developer Platform & SRA CLI Toolkit

Complete guide to @sra-srs/sra-cli: installation, authentication, code traceability, AST reverse engineering, and CI/CD pipelines.

01

Installation & Dual Authentication

Install the CLI globally and authenticate using browser OAuth or long-lived CI/CD API keys.

Global CLI Setup

The SRA CLI (@sra-srs/sra-cli) enables developers to integrate requirements engineering directly into their local development workflow and CI/CD pipelines.

Installation Commands

Install globally using your preferred package manager:

npm install -g @sra-srs/sra-cli
sra --version

Authentication Methods

Method 1: Interactive Browser Login (Local Dev)

bash
sra auth login

Opens your default browser to authorize the CLI session and stores a secure session token locally in ~/.sra/config.json.

Method 2: Non-Interactive Authentication (CI/CD Pipelines)

bash
sra auth login --token $AUTH_SECRET
sra auth whoami
02

CLI Command Reference

Comprehensive reference for sra analyze, sync, check, push, reverse, and status.

Command Catalog

1. sra analyze — Submit New Requirements Analysis

Submits a raw input file or string to the cloud pipeline and streams live progress to the terminal:

bash
sra analyze --input specs.md --format ieee830 --watch

2. sra sync — Synchronize Specification Locally

Pulls the latest requirement specification into your repository as sra.spec.json:

bash
sra sync --id <analysis-id> --output sra.spec.json

3. sra check & sra check --deep — Traceability Verification

Verifies that all files linked to requirements actually exist in the codebase:

bash
# Standard check: Verifies file path existence
sra check

# Deep check: Validates that code files contain requirement IDs (e.g. @sra-req REQ-001)
sra check --deep

4. sra push — Sync Verification Status to Cloud

Uploads local code verification results back to the cloud workspace metadata:

bash
sra push --id <analysis-id>

5. sra reverse — AST Codebase Reverse Engineering

Inspects a local codebase repository, builds an Abstract Syntax Tree (AST) structural digest (modules, interfaces, database entities), and reverse-engineers a complete requirements specification:

bash
sra reverse --dir ./src --format ieee830 --output reverse-srs.json
03

CI/CD Pipeline Automation Recipes

Automate requirements traceability compliance in GitHub Actions and GitLab CI.

Continuous Requirements Verification (CRV)

Ensure no Pull Request merges without verifying that modified code complies with project requirements:

GitHub Actions Workflow Recipe

Create .github/workflows/requirements-check.yml:

name: Requirements Compliance Check
on: [pull_request]

jobs:
  verify-traceability:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm install -g @sra-srs/sra-cli
      - name: Verify Requirements Traceability
        env:
          SRA_API_KEY: ${{ secrets.SRA_API_KEY }}
        run: |
          sra check --deep
          sra push
Was this page helpful?

Help us improve the SRA enterprise documentation.