Metadata-Version: 2.4
Name: patchops-guard
Version: 0.2.0
Summary: PatchOps Guard CLI — SBOM, scans, and AI fixes from your terminal.
Author: Superlabs
License: MIT
Project-URL: Homepage, https://patchguard.ai
Project-URL: Documentation, https://patchguard.ai/docs
Project-URL: Source, https://github.com/superlabs-x/patchops-guard
Keywords: cve,sbom,security,patchops,patchguard
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.25
Requires-Dist: typer>=0.12
Requires-Dist: rich>=13.0
Requires-Dist: tomli-w>=1.0
Requires-Dist: tomli>=2.0; python_version < "3.11"
Requires-Dist: patchguard-ai>=0.1.1
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-mock>=3; extra == "dev"

# patchops CLI

Official command-line interface for [PatchOps Guard](https://patchguard.ai) —
SBOM generation, CVE scanning, and AI-driven fix jobs without leaving your
terminal.

## Install

```bash
pip install patchops-guard
```

Or install from source:

```bash
git clone https://github.com/superlabs-x/patchops-guard
pip install -e cli/
```

## Authentication

```bash
patchops auth login --api-key pk_live_...
patchops auth status
patchops auth logout
```

Credentials are stored with permissions `0600` at:

- Linux / macOS: `~/.config/patchops/config.toml`
- Windows: `%APPDATA%\patchops\config.toml`

Environment variables take precedence:

- `PATCHOPS_API_KEY` — bearer token
- `PATCHOPS_BASE_URL` — API host (default `https://patchguard.ai`)

## Scans

```bash
# Auto-detect: URL, lockfile, or docker image
patchops scan auto package-lock.json
patchops scan auto https://example.com
patchops scan auto nginx:1.25

# Explicit commands
patchops scan manifest package-lock.json --format json --output scan.json
patchops scan website https://example.com --fail-on-severity high
patchops scan docker nginx:1.25 --format sarif --output scan.sarif
```

Common flags:

- `--format json|table|sarif` — output shape (default `table`)
- `--output FILE` — write to file (stdout is default)
- `--severity critical|high|medium|low` — show only findings at or above
- `--fail-on-severity SEVERITY` — exit non-zero when met (CI-friendly)

## Findings

```bash
patchops findings list --status open --severity high
patchops findings get <finding-uuid>
```

## AI Repair

```bash
patchops repair start <finding-uuid> --wait
patchops repair status <job-uuid>
patchops repair list --status completed
```

## SBOM

```bash
# Emit CycloneDX 1.6 JSON from a lockfile
patchops sbom generate package-lock.json --output sbom.json

# Upload an SBOM for OSV vulnerability matching
patchops sbom upload sbom.json
```

Supported lockfiles: `package-lock.json`, `package.json`, `requirements.txt`,
`Pipfile.lock`, `pom.xml`, `go.mod`, `Gemfile.lock`, `Cargo.lock`,
`composer.lock`.

## Exit codes

- `0` — success
- `1` — general error (network, API, IO)
- `2` — usage error (bad argument, missing auth)
- `10-13` — `--fail-on-severity` threshold hit (low / medium / high / critical)

## License

MIT
