Skip to main content

Rafter CLI

Project description

rafter-cli (Python)

Python CLI for Rafter — trigger and retrieve remote SAST/SCA security scans via the Rafter API.

Note: This package provides backend scanning only. For the full feature set—including agent security (secret scanning, command interception, pre-commit hooks, skill auditing)—install the Node.js package: npm install -g @rafter-security/cli

Installation

pip install rafter-cli

Requires Python 3.10+.

Quick Start

export RAFTER_API_KEY="your-key"   # or add to .env file

rafter run                                    # scan current repo (auto-detected)
rafter scan --repo myorg/myrepo --branch main # scan specific repo
rafter get SCAN_ID                            # retrieve results
rafter get SCAN_ID --interactive              # poll until complete
rafter usage                                  # check quota

Important: The scanner analyzes the remote repository on GitHub, not your local files. Auto-detection uses your local Git configuration to determine which repo and branch to scan.

Commands

rafter run [options]

Alias: rafter scan

Trigger a new security scan for your repository.

  • -r, --repo <repo> — org/repo (default: auto-detected from git remote)
  • -b, --branch <branch> — branch (default: current branch or 'main')
  • -k, --api-key <key> — API key (or RAFTER_API_KEY env var)
  • -f, --format <format>json or md (default: md)
  • --skip-interactive — don't wait for scan completion
  • --quiet — suppress status messages

rafter get <scan-id> [options]

Retrieve results from a scan.

  • -k, --api-key <key> — API key
  • -f, --format <format>json or md (default: md)
  • --interactive — poll until scan completes
  • --quiet — suppress status messages

rafter usage [options]

Check API quota and usage.

  • -k, --api-key <key> — API key

Piping and Automation

The CLI follows UNIX principles: scan data to stdout, status to stderr, no file writing.

# Filter critical vulnerabilities
rafter get SCAN_ID --format json | jq '.vulnerabilities[] | select(.level=="critical")'

# Count vulnerabilities
rafter get SCAN_ID --format json | jq '.vulnerabilities | length'

# CSV export
rafter get SCAN_ID --format json --quiet | jq -r '.vulnerabilities[] | [.level, .rule_id, .file, .line] | @csv'

# CI gate
if rafter get SCAN_ID --format json | jq -e '.vulnerabilities | length > 0'; then
    echo "Vulnerabilities found!" && exit 1
fi

# Save to file
rafter get SCAN_ID > scan_results.json

Exit Codes

Code Meaning
0 Success
1 General error
2 Scan not found
3 Quota exhausted

Configuration

  • API key: --api-key flag, RAFTER_API_KEY env var, or .env file
  • Git auto-detection: works in CI (GITHUB_REPOSITORY, GITHUB_REF_NAME, CI_REPOSITORY, CI_COMMIT_BRANCH)
  • Remote scanning: analyzes the remote repository, not local files

Documentation

Full docs at docs.rafter.so.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rafter_cli-0.4.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rafter_cli-0.4.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file rafter_cli-0.4.1.tar.gz.

File metadata

  • Download URL: rafter_cli-0.4.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for rafter_cli-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4980e672b38d24487709bd09d2edf55bd64df5f51b154d312583de1f1a783098
MD5 b8699c5c2a90cff05521af7a6e700222
BLAKE2b-256 85df09afeaab891333da668bbb04c00b5889aeb043031d1161a19577a8f1988b

See more details on using hashes here.

File details

Details for the file rafter_cli-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: rafter_cli-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for rafter_cli-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2073b2d37deabc94d6d0589ad16c4b81873b658b50712a96d49261625b9f0482
MD5 d0b44723719892f20ded4de932c124d0
BLAKE2b-256 87af24a4afb554f37b63ad5521c6841121a95f506253bb60cdce11ff9e6f5b68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page