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.2.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.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rafter_cli-0.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 166d0b94871a5dd333d744f990767086449b5bb1a6148a579119d181bb047e6b
MD5 c489e580b21bf19d5478f05e04d989c5
BLAKE2b-256 cb4d0d776a3d390785fb58136e3644f36a296bd94caeac550d3704bf22b4cca2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rafter_cli-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 370177c54d90a3c4b1ceb85b4456fbbcad15a95827fed44b432574b425ce81c9
MD5 de55a33cf454614188dbac90dd6aaaf4
BLAKE2b-256 2c9a71c352c4158c627a1387b50659c0399b9bb7ce222d3d82a63cc075a15962

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