Metadata-Version: 2.4
Name: prodsensor-cli
Version: 1.0.1
Summary: CLI tool for ProdSensor production readiness analysis
Project-URL: Homepage, https://prodsensor.com
Project-URL: Documentation, https://prodsensor.com/docs/cli
Project-URL: Repository, https://github.com/prodsensor/prodsensor-cli
Author-email: ProdSensor <support@prodsensor.com>
License-Expression: MIT
Keywords: ci-cd,code-analysis,devops,production-readiness
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.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Requires-Dist: click>=8.0.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: rich>=13.0.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: respx>=0.20.0; extra == 'dev'
Description-Content-Type: text/markdown

# ProdSensor CLI

Command-line tool for running ProdSensor production readiness analysis in CI/CD pipelines.

## Installation

```bash
pip install prodsensor-cli
```

## Quick Start

1. Get an API key from [prodsensor.com/app](https://prodsensor.com/app)
2. Set up authentication:

```bash
# Option 1: Environment variable (recommended for CI/CD)
export PRODSENSOR_API_KEY=ps_live_your_key_here

# Option 2: Save to config file
prodsensor config set-key ps_live_your_key_here
```

3. Run an analysis:

```bash
prodsensor analyze https://github.com/your-org/your-repo
```

## Commands

### analyze

Analyze a repository for production readiness.

```bash
# Basic usage
prodsensor analyze https://github.com/owner/repo

# With JSON output
prodsensor analyze https://github.com/owner/repo --format json

# Start analysis without waiting
prodsensor analyze https://github.com/owner/repo --no-wait

# Custom timeout (10 minutes)
prodsensor analyze https://github.com/owner/repo --timeout 600

# Only fail on blockers (not warnings)
prodsensor analyze https://github.com/owner/repo --fail-on blockers
```

### status

Check the status of an analysis run.

```bash
prodsensor status <run-id>
prodsensor status <run-id> --format json
```

### report

Get the full analysis report.

```bash
prodsensor report <run-id>
prodsensor report <run-id> --format json
prodsensor report <run-id> --format markdown
prodsensor report <run-id> --format json -o report.json
```

### config

Manage CLI configuration.

```bash
# Save API key
prodsensor config set-key ps_live_your_key

# Remove saved API key
prodsensor config clear-key

# Show current configuration
prodsensor config show
```

## Exit Codes

The CLI uses exit codes that work with CI/CD pipelines:

| Code | Meaning |
|------|---------|
| 0 | PRODUCTION_READY |
| 1 | NOT_PRODUCTION_READY |
| 2 | CONDITIONALLY_READY |
| 3 | API/Network error |
| 4 | Authentication error |
| 5 | Timeout |

## CI/CD Integration

### GitHub Actions

```yaml
- name: Run ProdSensor Analysis
  env:
    PRODSENSOR_API_KEY: ${{ secrets.PRODSENSOR_API_KEY }}
  run: |
    pip install prodsensor-cli
    prodsensor analyze https://github.com/${{ github.repository }}
```

Or use the dedicated GitHub Action:

```yaml
- uses: prodsensor/action@v1
  with:
    api-key: ${{ secrets.PRODSENSOR_API_KEY }}
```

### GitLab CI

```yaml
production-readiness:
  script:
    - pip install prodsensor-cli
    - prodsensor analyze https://gitlab.com/$CI_PROJECT_PATH
  variables:
    PRODSENSOR_API_KEY: $PRODSENSOR_API_KEY
```

### Jenkins

```groovy
pipeline {
    environment {
        PRODSENSOR_API_KEY = credentials('prodsensor-api-key')
    }
    stages {
        stage('Production Readiness') {
            steps {
                sh 'pip install prodsensor-cli'
                sh 'prodsensor analyze ${GIT_URL}'
            }
        }
    }
}
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `PRODSENSOR_API_KEY` | API key for authentication |
| `PRODSENSOR_API_URL` | Custom API URL (for self-hosted) |

## Output Formats

### Summary (default)

Human-readable summary with verdict, score, and findings count.

### JSON

Full report data as JSON, suitable for parsing in scripts.

### Markdown

Report formatted as markdown, suitable for PR comments.

## License

MIT
