# 🩺 Pre-Deploy Doctor

**Pre-Deploy Doctor** is a local DevOps readiness checker that validates whether your environment is safe to deploy BEFORE you run Docker, kubectl, or CI/CD pipelines.

It runs 100% locally, requires no cloud accounts or AI, and is designed to catch common "stupid" mistakes before they hit your production infrastructure.

## 🚀 Features

- **Docker Health**: Checks if Docker is installed and the daemon is actually running.
- **Environment Validation**: Loads `.env` and validates that your required environment variables are set.
- **Port Conflicts**: Identifies if required ports are already in use and shows the conflicting process name.
- **Kubernetes Context Safety**: Warns you if your `kubectl` context isn't in your "allowed" list for the project.
- **Project Structure**: Ensures critical files like `Dockerfile` are present.

## 📦 Installation

```bash
pip install predeploy-doctor
```

## 🛠 Usage

Run inside any project directory:

```bash
predeploy check
```

### Configuration (`predeploy.yaml`)

Create a `predeploy.yaml` in your project root to customize the checks:

```yaml
required_env:
  - DB_URL
  - SECRET_KEY

required_ports:
  - 3000
  - 5432

kubernetes:
  allowed_contexts:
    - dev
    - staging
    - minikube
```

## 📋 Sample Output

```text
🩺 Pre-Deploy Doctor Report

✔ Docker is running
✔ Found Dockerfile
✔ All required environment variables are set
❌ Port 3000 already in use (Process: node)
⚠ Kubernetes context 'production' not in allowed list

==============================
Status: ❌ NOT SAFE TO DEPLOY
```

## 🔢 Exit Codes

- `0`: All checks passed (or only warnings). Safe to deploy.
- `1`: One or more critical checks failed. **Deployment should be blocked.**

## 📜 License

MIT
