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 (orRAFTER_API_KEYenv var)-f, --format <format>—jsonormd(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>—jsonormd(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-keyflag,RAFTER_API_KEYenv var, or.envfile - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4980e672b38d24487709bd09d2edf55bd64df5f51b154d312583de1f1a783098
|
|
| MD5 |
b8699c5c2a90cff05521af7a6e700222
|
|
| BLAKE2b-256 |
85df09afeaab891333da668bbb04c00b5889aeb043031d1161a19577a8f1988b
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2073b2d37deabc94d6d0589ad16c4b81873b658b50712a96d49261625b9f0482
|
|
| MD5 |
d0b44723719892f20ded4de932c124d0
|
|
| BLAKE2b-256 |
87af24a4afb554f37b63ad5521c6841121a95f506253bb60cdce11ff9e6f5b68
|