4. Developer Platform & SRA CLI Toolkit
Complete guide to @sra-srs/sra-cli: installation, authentication, code traceability, AST reverse engineering, and CI/CD pipelines.
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 --versionAuthentication Methods
Method 1: Interactive Browser Login (Local Dev)
sra auth loginOpens 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)
sra auth login --token $AUTH_SECRET
sra auth whoamiCLI 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:
sra analyze --input specs.md --format ieee830 --watch2. sra sync — Synchronize Specification Locally
Pulls the latest requirement specification into your repository as sra.spec.json:
sra sync --id <analysis-id> --output sra.spec.json3. sra check & sra check --deep — Traceability Verification
Verifies that all files linked to requirements actually exist in the codebase:
# 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 --deep4. sra push — Sync Verification Status to Cloud
Uploads local code verification results back to the cloud workspace metadata:
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:
sra reverse --dir ./src --format ieee830 --output reverse-srs.jsonCI/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 pushHelp us improve the SRA enterprise documentation.