Metadata-Version: 2.4
Name: iac-to-docs
Version: 0.1.0
Summary: AI agent that reads Terraform, Helm, Kubernetes, and CI/CD files and auto-generates DevOps documentation.
Author-email: Sashank Lakra <lsashank.sl@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/lakra-sashank/IaC-to-Docs-An-AI-Agent-for-DevOps-Documentation
Project-URL: Repository, https://github.com/lakra-sashank/IaC-to-Docs-An-AI-Agent-for-DevOps-Documentation
Project-URL: Bug Tracker, https://github.com/lakra-sashank/IaC-to-Docs-An-AI-Agent-for-DevOps-Documentation/issues
Keywords: devops,documentation,terraform,kubernetes,helm,llm,gemini,iac,platform-engineering
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Documentation
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: google-generativeai>=0.8.0
Dynamic: license-file

# 🏗️ IaC-to-Docs

> **AI agent that reads your Terraform, Helm, Kubernetes, and CI/CD files — and writes your DevOps documentation automatically.**

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Powered by Gemini](https://img.shields.io/badge/Powered%20by-Gemini%202.5%20Pro-orange.svg)](https://ai.google.dev/)

---

## The Problem

Every DevOps team has the same documentation debt:

- Terraform modules nobody can explain
- Helm charts with mystery values
- Kubernetes manifests that "just work" until they don't
- Zero onboarding docs for new engineers

Writing docs manually is slow and they go stale immediately. **IaC-to-Docs solves this with one command.**

---

## Install & Run in 60 Seconds

```bash
# 1. Install
pip install iac-to-docs

# 2. Set your API key (get one free at https://aistudio.google.com)
export GOOGLE_API_KEY=your_key_here

# 3. Run against any repo
iac-to-docs --repo ./your-infra-repo
```

That's it. A complete `DEVOPS_DOCS.md` is written to your repo root.

---

## What Gets Generated

Each run produces a structured `DEVOPS_DOCS.md` with:

| Section | What it contains |
|---------|-----------------|
| **System Overview** | What the system does, tech stack, environments |
| **Architecture Diagram** | Mermaid diagram of services and their relationships |
| **Services & Components** | Per-service: image, ports, env vars, health checks, resources |
| **Infrastructure (IaC)** | Terraform resources, state backend, variables, outputs |
| **Deployment Instructions** | Step-by-step deploy guide with real commands |
| **CI/CD Workflow** | Pipeline stages, triggers, promotion flow, secrets needed |
| **Environment Setup** | Required env vars, secrets, namespaces, RBAC |
| **Operations Runbook** | Scale, restart, rollback, log access, shell exec |
| **Troubleshooting Guide** | Common issues table + debug commands |

Anything inferred (not explicitly in files) is labelled **[Assumed]** so you always know what's fact vs inference.

---

## Demo Output

👉 **[See a real generated DEVOPS_DOCS.md →](sample_repo/DEVOPS_DOCS.md)**

Generated from the `sample_repo/` in this repository, which contains:
- Terraform (EKS cluster + RDS + VPC)
- Kubernetes manifests (3 services)
- Helm chart
- GitHub Actions CI/CD pipeline
- Dockerfile

---

## Usage

### Basic
```bash
iac-to-docs --repo ./my-infra
```

### Specify output location
```bash
iac-to-docs --repo ./my-infra --output ./docs/DEVOPS_DOCS.md
```

### Point at a GitHub repo directly
```bash
iac-to-docs --repo https://github.com/org/infra-repo
```

### Generate only specific sections
```bash
iac-to-docs --repo ./my-infra --sections deployment runbook troubleshooting
```

### Use a faster/cheaper model
```bash
iac-to-docs --repo ./my-infra --model models/gemini-2.0-flash
```

### Full options
```
iac-to-docs --help

options:
  --repo,     -r   Path to local repo OR GitHub URL         [required]
  --output,   -o   Output path (default: <repo>/DEVOPS_DOCS.md)
  --api-key,  -k   Gemini API key (or set GOOGLE_API_KEY env var)
  --model,    -m   Gemini model (default: models/gemini-2.5-pro)
  --sections, -s   Generate specific sections only
  --no-mermaid     Skip architecture diagram
  --verbose,  -v   Detailed progress output
```

---

## Supported File Types

| Type | Files |
|------|-------|
| **Terraform** | `.tf`, `.tfvars` |
| **Kubernetes** | `.yaml`, `.yml` in `k8s/`, `manifests/`, `deploy/` |
| **Helm** | `Chart.yaml`, `values.yaml`, `templates/*.yaml` |
| **Docker** | `Dockerfile`, `docker-compose.yml` |
| **CI/CD** | GitHub Actions, Jenkinsfile, `.gitlab-ci.yml`, CircleCI |
| **Scripts** | `.sh`, `.bash`, `.py` |
| **Config** | `.env.example`, `config.yaml`, `config.json` |

---

## Architecture

```
iac-to-docs --repo ./infra
       │
       ▼
┌─────────────────────────────────────┐
│  Smart File Loader                  │
│  • Walks repo, skips noise          │
│  • Classifies by type               │
│  • Truncates oversized files        │
└──────────────┬──────────────────────┘
               │
       ┌───────▼────────┐
       │ Context Builder│  Groups files by type
       └───────┬────────┘  (terraform, k8s, cicd, full)
               │
       ┌───────▼────────────────────────────┐
       │  Multi-Section Agent               │
       │  Each section gets a focused prompt│
       │  + the most relevant context only  │
       │  → Gemini 2.5 Pro                  │
       └───────┬────────────────────────────┘
               │
       ┌───────▼────────┐
       │  Assembler     │  Table of contents
       └───────┬────────┘  Metadata header
               │           File index appendix
               ▼
         DEVOPS_DOCS.md
```

---

## Development Setup

```bash
git clone https://github.com/lakra-sashank/IaC-to-Docs-An-AI-Agent-for-DevOps-Documentation
cd IaC-to-Docs-An-AI-Agent-for-DevOps-Documentation

pip install -e ".[dev]"

export GOOGLE_API_KEY=your_key
iac-to-docs --repo ./sample_repo --verbose
```

---

## Built by

**Sashank Lakra** — Senior Platform & DevOps Engineer  
[LinkedIn](https://linkedin.com/in/sashanklakra-12b873a4) · [GitHub](https://github.com/lakra-sashank)
