diagram-to-iac 0.8.0__tar.gz → 0.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. diagram_to_iac-0.10.0/PKG-INFO +256 -0
  2. diagram_to_iac-0.10.0/README.md +235 -0
  3. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/pyproject.toml +3 -1
  4. diagram_to_iac-0.10.0/src/diagram_to_iac/r2d.py +345 -0
  5. diagram_to_iac-0.10.0/src/diagram_to_iac.egg-info/PKG-INFO +256 -0
  6. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac.egg-info/entry_points.txt +2 -0
  7. diagram_to_iac-0.8.0/PKG-INFO +0 -99
  8. diagram_to_iac-0.8.0/README.md +0 -78
  9. diagram_to_iac-0.8.0/src/diagram_to_iac/r2d.py +0 -13
  10. diagram_to_iac-0.8.0/src/diagram_to_iac.egg-info/PKG-INFO +0 -99
  11. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/setup.cfg +0 -0
  12. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/__init__.py +0 -0
  13. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/actions/__init__.py +0 -0
  14. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/actions/git_entry.py +0 -0
  15. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/actions/supervisor_entry.py +0 -0
  16. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/actions/terraform_agent_entry.py +0 -0
  17. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/__init__.py +0 -0
  18. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/demonstrator_langgraph/__init__.py +0 -0
  19. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/demonstrator_langgraph/agent.py +0 -0
  20. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/git_langgraph/__init__.py +0 -0
  21. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/git_langgraph/agent.py +0 -0
  22. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/git_langgraph/pr.py +0 -0
  23. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/hello_langgraph/__init__.py +0 -0
  24. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/hello_langgraph/agent.py +0 -0
  25. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/policy_agent/__init__.py +0 -0
  26. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/policy_agent/agent.py +0 -0
  27. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/policy_agent/integration_example.py +0 -0
  28. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/policy_agent/tools/__init__.py +0 -0
  29. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/policy_agent/tools/tfsec_tool.py +0 -0
  30. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/shell_langgraph/__init__.py +0 -0
  31. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/shell_langgraph/agent.py +0 -0
  32. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/shell_langgraph/detector.py +0 -0
  33. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/supervisor_langgraph/__init__.py +0 -0
  34. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/supervisor_langgraph/agent.py +0 -0
  35. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/supervisor_langgraph/demonstrator.py +0 -0
  36. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/supervisor_langgraph/guards.py +0 -0
  37. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/supervisor_langgraph/pat_loop.py +0 -0
  38. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/supervisor_langgraph/router.py +0 -0
  39. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/terraform_langgraph/__init__.py +0 -0
  40. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/terraform_langgraph/agent.py +0 -0
  41. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/agents/terraform_langgraph/parser.py +0 -0
  42. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/cli.py +0 -0
  43. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/core/__init__.py +0 -0
  44. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/core/agent_base.py +0 -0
  45. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/core/enhanced_memory.py +0 -0
  46. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/core/errors.py +0 -0
  47. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/core/issue_tracker.py +0 -0
  48. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/core/memory.py +0 -0
  49. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/services/__init__.py +0 -0
  50. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/services/observability.py +0 -0
  51. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/services/step_summary.py +0 -0
  52. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/__init__.py +0 -0
  53. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/api_utils.py +0 -0
  54. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/git/__init__.py +0 -0
  55. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/git/git.py +0 -0
  56. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/hello/__init__.py +0 -0
  57. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/hello/cal_utils.py +0 -0
  58. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/hello/text_utils.py +0 -0
  59. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/llm_utils/__init__.py +0 -0
  60. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/llm_utils/anthropic_driver.py +0 -0
  61. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/llm_utils/base_driver.py +0 -0
  62. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/llm_utils/gemini_driver.py +0 -0
  63. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/llm_utils/openai_driver.py +0 -0
  64. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/llm_utils/router.py +0 -0
  65. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/sec_utils.py +0 -0
  66. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/shell/__init__.py +0 -0
  67. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/shell/shell.py +0 -0
  68. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/text_utils.py +0 -0
  69. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac/tools/tf/terraform.py +0 -0
  70. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac.egg-info/SOURCES.txt +0 -0
  71. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac.egg-info/dependency_links.txt +0 -0
  72. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac.egg-info/requires.txt +0 -0
  73. {diagram_to_iac-0.8.0 → diagram_to_iac-0.10.0}/src/diagram_to_iac.egg-info/top_level.txt +0 -0
@@ -0,0 +1,256 @@
1
+ Metadata-Version: 2.4
2
+ Name: diagram-to-iac
3
+ Version: 0.10.0
4
+ Summary: Convert architecture diagrams into IaC modules
5
+ Author-email: vindpro <admin@vindpro.com>
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: anthropic==0.54.0
8
+ Requires-Dist: google_api_python_client==2.172.0
9
+ Requires-Dist: langchain_anthropic==0.3.15
10
+ Requires-Dist: langchain-core<1.0.0,>=0.3.62
11
+ Requires-Dist: langchain_google_genai==2.1.5
12
+ Requires-Dist: langchain_openai==0.3.24
13
+ Requires-Dist: langgraph==0.4.8
14
+ Requires-Dist: openai==1.88.0
15
+ Requires-Dist: protobuf>=5.27.0
16
+ Requires-Dist: pydantic==2.11.7
17
+ Requires-Dist: PyYAML==6.0.2
18
+ Requires-Dist: Requests==2.32.4
19
+ Requires-Dist: GitPython<4.0,>=3.1
20
+ Requires-Dist: pytest-mock<4.0.0,>=3.10.0
21
+
22
+ # diagram-to-iac
23
+
24
+ > **"One container, many minds—zero manual toil."**
25
+
26
+ An automated DevOps-in-a-Box system that intelligently handles complete Repo-to-Deployment (R2D) workflows. The project combines AI-powered infrastructure analysis with GitHub automation for self-healing deployments.
27
+
28
+ ## 🚀 DevOps-in-a-Box: R2D Action
29
+
30
+ The **R2D (Repo-to-Deployment) Action** is a self-healing, Terraform-first DevOps automation solution that lives inside a single GitHub Action. When you supply any repository URL, our SupervisorAgent marshals specialized agents to handle the complete deployment workflow.
31
+
32
+ ### Quick Start with GitHub Actions
33
+
34
+ ```yaml
35
+ name: Deploy Infrastructure
36
+ on:
37
+ push:
38
+ branches: [main]
39
+
40
+ jobs:
41
+ deploy:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - name: Deploy with R2D
45
+ uses: amartyamandal/diagram-to-iac/.github/actions/r2d@v1
46
+ with:
47
+ repo: ${{ github.server_url }}/${{ github.repository }}
48
+ env:
49
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50
+ TF_CLOUD_TOKEN: ${{ secrets.TF_CLOUD_TOKEN }}
51
+ ```
52
+
53
+ ### Key Features
54
+
55
+ - **🤖 Self-Healing**: Automatically creates GitHub Issues for errors and suggests fixes
56
+ - **🔒 Security-First**: Non-root container execution with workspace isolation
57
+ - **🌍 Multi-Cloud**: Supports Terraform, PowerShell, Bash, and Ansible deployments
58
+ - **📊 Observable**: Rich logging, step summaries, and artifact collection
59
+ - **🔄 Resumable**: Thread-based conversation tracking for workflow continuation
60
+ - **🧪 Testable**: Comprehensive dry-run mode for safe testing
61
+
62
+ ### The Cast: Specialized Agents
63
+
64
+ | Agent | Capability | Never Does |
65
+ |-------|------------|------------|
66
+ | **SupervisorAgent** | Orchestrates workflow, manages checkpoints | Edit code directly |
67
+ | **GitAgent** | Clone, branch, PR creation, assign @github-copilot | Guess network credentials |
68
+ | **ShellAgent** | Safe command execution, stack detection | Execute non-allowlisted binaries |
69
+ | **TerraformAgent** | Init/plan/apply, error classification | Apply with critical security issues |
70
+ | **PolicyAgent** | tfsec + OPA security gates | Ignore critical findings |
71
+
72
+ ## 📦 Installation
73
+
74
+ Create a virtual environment with Python 3.11+ and install the project in editable mode. Development dependencies (linting, testing, etc.) are provided through the `dev` extra:
75
+
76
+ ```bash
77
+ pip install -e .[dev]
78
+ ```
79
+
80
+ ## 🖥️ Running the CLI
81
+
82
+ The project exposes several entry points via `pyproject.toml`:
83
+
84
+ ### Main R2D CLI
85
+ ```bash
86
+ # Run complete R2D workflow
87
+ diagram-to-iac https://github.com/user/repo
88
+ r2d-agent https://github.com/user/repo --dry-run
89
+
90
+ # Get help
91
+ diagram-to-iac --help
92
+ ```
93
+
94
+ ### Individual Agent CLIs
95
+ ```bash
96
+ # SupervisorAgent (orchestration)
97
+ supervisor-agent --repo-url https://github.com/user/repo
98
+
99
+ # GitAgent (repository operations)
100
+ git-agent --repo-url https://github.com/user/repo
101
+
102
+ # TerraformAgent (infrastructure deployment)
103
+ terraform-agent --query "terraform plan"
104
+ ```
105
+
106
+ ### Interactive Mode
107
+
108
+ Running without arguments enters interactive mode:
109
+
110
+ ```bash
111
+ $ supervisor-agent --dry-run
112
+ ╔══════════════════════════════════════════════════════════════════════════════╗
113
+ ║ 🤖 DevOps-in-a-Box: SupervisorAgent ║
114
+ ║ "One container, many minds—zero manual toil." ║
115
+ ╚══════════════════════════════════════════════════════════════════════════════╝
116
+
117
+ Repository URL: https://github.com/octocat/Hello-World.git
118
+ 🚀 R2D SupervisorAgent - Workflow Orchestration
119
+ 📅 Default branch name: r2d-<timestamp>
120
+ 📝 Press Enter to use default, or type a custom branch name:
121
+ ```
122
+
123
+ The agent will continue with the complete workflow (clone → detect → deploy → issue creation). The `--dry-run` flag simulates actions without making changes.
124
+
125
+ ## Running Tests
126
+
127
+ All tests use `pytest` and are located under the `tests` directory. After installing the development dependencies, run:
128
+
129
+ ```bash
130
+ pytest
131
+ ```
132
+
133
+ ## 📊 Logs and Observability
134
+
135
+ DevOps-in-a-Box provides comprehensive observability for all R2D workflows:
136
+
137
+ ### Structured Logging
138
+ Each run creates a JSONL log file under the `logs/` directory (e.g. `logs/run-<timestamp>.jsonl`).
139
+ Every significant event is logged as structured JSON for easy parsing and analysis:
140
+
141
+ ```bash
142
+ # Follow live logs
143
+ tail -f logs/run-*.jsonl
144
+
145
+ # Parse with jq for specific events
146
+ cat logs/run-*.jsonl | jq '. | select(.event_type == "terraform_apply")'
147
+ ```
148
+
149
+ ### Step Summary Dashboard
150
+ After each workflow, a Markdown dashboard is generated at `step-summary.md` with:
151
+ - 📈 Terraform resource changes and cost estimates
152
+ - 🔒 Security findings from tfsec/OPA scans
153
+ - 🏗️ Infrastructure modules and dependencies
154
+ - ⚡ Performance metrics and execution times
155
+
156
+ ### GitHub Integration
157
+ - **Issues**: Automatically created for errors with detailed context
158
+ - **Pull Requests**: Auto-drafted fixes assigned to @github-copilot
159
+ - **Workflow Summaries**: Rich GitHub Actions step summaries
160
+ - **Artifacts**: Logs, plans, and reports uploaded for download
161
+
162
+ ### CI/CD Artifacts
163
+ In GitHub Actions, the following artifacts are automatically collected:
164
+ - `logs/` - Structured JSONL logs
165
+ - `*.tfplan` - Terraform plan files
166
+ - `step-summary.md` - Workflow dashboard
167
+ - `r2d-artifacts/` - Complete workflow artifacts
168
+
169
+ ## 🔧 GitHub Actions Usage
170
+
171
+ Add the R2D action to your workflow for automated infrastructure deployment:
172
+
173
+ ### Basic Setup
174
+
175
+ ```yaml
176
+ name: Deploy Infrastructure
177
+ on:
178
+ push:
179
+ branches: [main]
180
+
181
+ jobs:
182
+ deploy:
183
+ runs-on: ubuntu-latest
184
+ steps:
185
+ - name: Deploy with R2D
186
+ uses: amartyamandal/diagram-to-iac/.github/actions/r2d@v1
187
+ with:
188
+ repo: ${{ github.server_url }}/${{ github.repository }}
189
+ env:
190
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
191
+ TF_CLOUD_TOKEN: ${{ secrets.TF_CLOUD_TOKEN }}
192
+ ```
193
+
194
+ ### Advanced Configuration
195
+
196
+ ```yaml
197
+ - name: Deploy with Custom Settings
198
+ uses: amartyamandal/diagram-to-iac/.github/actions/r2d@v1
199
+ with:
200
+ repo: 'https://github.com/my-org/infrastructure'
201
+ package_version: 'v2.1.0'
202
+ dry_run: 'false'
203
+ branch_name: 'deploy-prod'
204
+ thread_id: 'prod-deployment-001'
205
+ env:
206
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
207
+ TF_CLOUD_TOKEN: ${{ secrets.TF_CLOUD_TOKEN }}
208
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
209
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
210
+ ```
211
+
212
+ ### Required Secrets
213
+
214
+ Configure these in your repository settings:
215
+
216
+ | Secret | Description | Required |
217
+ |--------|-------------|----------|
218
+ | `GITHUB_TOKEN` | GitHub API access (auto-provided) | ✅ Yes |
219
+ | `TF_CLOUD_TOKEN` | Terraform Cloud API token | ✅ Yes |
220
+ | `OPENAI_API_KEY` | OpenAI API key | ❌ Optional |
221
+ | `ANTHROPIC_API_KEY` | Claude API key | ❌ Optional |
222
+ | `GOOGLE_API_KEY` | Gemini API key | ❌ Optional |
223
+
224
+ ### Example Workflows
225
+
226
+ See [`.github/actions/r2d/examples/`](.github/actions/r2d/examples/) for complete workflow examples:
227
+
228
+ - **Basic Deployment**: Simple push-to-deploy workflow
229
+ - **Multi-Environment**: Deploy to dev/staging/prod with approvals
230
+ - **PR Validation**: Validate infrastructure changes in pull requests
231
+ - **Drift Detection**: Scheduled infrastructure drift monitoring
232
+ - **External Repository**: Deploy from external repositories
233
+
234
+
235
+ After each workflow run, a Markdown dashboard is generated at `step-summary.md`
236
+ showing a high level overview of Terraform modules, resource changes and tfsec
237
+ findings. The dashboard is derived from the JSONL logs and can be viewed
238
+ directly in the repository or uploaded as a build artifact.
239
+
240
+
241
+
242
+ This repository provides a container action that runs the `SupervisorAgent` on the current repository. Add the action to a workflow as shown below:
243
+
244
+ ```yaml
245
+ jobs:
246
+ supervisor:
247
+ runs-on: ubuntu-latest
248
+ steps:
249
+ - uses: actions/checkout@v4
250
+ - name: Run Supervisor Agent
251
+ uses: ./.github/actions/supervisor
252
+ env:
253
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
254
+ ```
255
+
256
+ The action reads `GITHUB_REPOSITORY` and `GITHUB_TOKEN` automatically to clone the repository and execute the agent.
@@ -0,0 +1,235 @@
1
+ # diagram-to-iac
2
+
3
+ > **"One container, many minds—zero manual toil."**
4
+
5
+ An automated DevOps-in-a-Box system that intelligently handles complete Repo-to-Deployment (R2D) workflows. The project combines AI-powered infrastructure analysis with GitHub automation for self-healing deployments.
6
+
7
+ ## 🚀 DevOps-in-a-Box: R2D Action
8
+
9
+ The **R2D (Repo-to-Deployment) Action** is a self-healing, Terraform-first DevOps automation solution that lives inside a single GitHub Action. When you supply any repository URL, our SupervisorAgent marshals specialized agents to handle the complete deployment workflow.
10
+
11
+ ### Quick Start with GitHub Actions
12
+
13
+ ```yaml
14
+ name: Deploy Infrastructure
15
+ on:
16
+ push:
17
+ branches: [main]
18
+
19
+ jobs:
20
+ deploy:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Deploy with R2D
24
+ uses: amartyamandal/diagram-to-iac/.github/actions/r2d@v1
25
+ with:
26
+ repo: ${{ github.server_url }}/${{ github.repository }}
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
+ TF_CLOUD_TOKEN: ${{ secrets.TF_CLOUD_TOKEN }}
30
+ ```
31
+
32
+ ### Key Features
33
+
34
+ - **🤖 Self-Healing**: Automatically creates GitHub Issues for errors and suggests fixes
35
+ - **🔒 Security-First**: Non-root container execution with workspace isolation
36
+ - **🌍 Multi-Cloud**: Supports Terraform, PowerShell, Bash, and Ansible deployments
37
+ - **📊 Observable**: Rich logging, step summaries, and artifact collection
38
+ - **🔄 Resumable**: Thread-based conversation tracking for workflow continuation
39
+ - **🧪 Testable**: Comprehensive dry-run mode for safe testing
40
+
41
+ ### The Cast: Specialized Agents
42
+
43
+ | Agent | Capability | Never Does |
44
+ |-------|------------|------------|
45
+ | **SupervisorAgent** | Orchestrates workflow, manages checkpoints | Edit code directly |
46
+ | **GitAgent** | Clone, branch, PR creation, assign @github-copilot | Guess network credentials |
47
+ | **ShellAgent** | Safe command execution, stack detection | Execute non-allowlisted binaries |
48
+ | **TerraformAgent** | Init/plan/apply, error classification | Apply with critical security issues |
49
+ | **PolicyAgent** | tfsec + OPA security gates | Ignore critical findings |
50
+
51
+ ## 📦 Installation
52
+
53
+ Create a virtual environment with Python 3.11+ and install the project in editable mode. Development dependencies (linting, testing, etc.) are provided through the `dev` extra:
54
+
55
+ ```bash
56
+ pip install -e .[dev]
57
+ ```
58
+
59
+ ## 🖥️ Running the CLI
60
+
61
+ The project exposes several entry points via `pyproject.toml`:
62
+
63
+ ### Main R2D CLI
64
+ ```bash
65
+ # Run complete R2D workflow
66
+ diagram-to-iac https://github.com/user/repo
67
+ r2d-agent https://github.com/user/repo --dry-run
68
+
69
+ # Get help
70
+ diagram-to-iac --help
71
+ ```
72
+
73
+ ### Individual Agent CLIs
74
+ ```bash
75
+ # SupervisorAgent (orchestration)
76
+ supervisor-agent --repo-url https://github.com/user/repo
77
+
78
+ # GitAgent (repository operations)
79
+ git-agent --repo-url https://github.com/user/repo
80
+
81
+ # TerraformAgent (infrastructure deployment)
82
+ terraform-agent --query "terraform plan"
83
+ ```
84
+
85
+ ### Interactive Mode
86
+
87
+ Running without arguments enters interactive mode:
88
+
89
+ ```bash
90
+ $ supervisor-agent --dry-run
91
+ ╔══════════════════════════════════════════════════════════════════════════════╗
92
+ ║ 🤖 DevOps-in-a-Box: SupervisorAgent ║
93
+ ║ "One container, many minds—zero manual toil." ║
94
+ ╚══════════════════════════════════════════════════════════════════════════════╝
95
+
96
+ Repository URL: https://github.com/octocat/Hello-World.git
97
+ 🚀 R2D SupervisorAgent - Workflow Orchestration
98
+ 📅 Default branch name: r2d-<timestamp>
99
+ 📝 Press Enter to use default, or type a custom branch name:
100
+ ```
101
+
102
+ The agent will continue with the complete workflow (clone → detect → deploy → issue creation). The `--dry-run` flag simulates actions without making changes.
103
+
104
+ ## Running Tests
105
+
106
+ All tests use `pytest` and are located under the `tests` directory. After installing the development dependencies, run:
107
+
108
+ ```bash
109
+ pytest
110
+ ```
111
+
112
+ ## 📊 Logs and Observability
113
+
114
+ DevOps-in-a-Box provides comprehensive observability for all R2D workflows:
115
+
116
+ ### Structured Logging
117
+ Each run creates a JSONL log file under the `logs/` directory (e.g. `logs/run-<timestamp>.jsonl`).
118
+ Every significant event is logged as structured JSON for easy parsing and analysis:
119
+
120
+ ```bash
121
+ # Follow live logs
122
+ tail -f logs/run-*.jsonl
123
+
124
+ # Parse with jq for specific events
125
+ cat logs/run-*.jsonl | jq '. | select(.event_type == "terraform_apply")'
126
+ ```
127
+
128
+ ### Step Summary Dashboard
129
+ After each workflow, a Markdown dashboard is generated at `step-summary.md` with:
130
+ - 📈 Terraform resource changes and cost estimates
131
+ - 🔒 Security findings from tfsec/OPA scans
132
+ - 🏗️ Infrastructure modules and dependencies
133
+ - ⚡ Performance metrics and execution times
134
+
135
+ ### GitHub Integration
136
+ - **Issues**: Automatically created for errors with detailed context
137
+ - **Pull Requests**: Auto-drafted fixes assigned to @github-copilot
138
+ - **Workflow Summaries**: Rich GitHub Actions step summaries
139
+ - **Artifacts**: Logs, plans, and reports uploaded for download
140
+
141
+ ### CI/CD Artifacts
142
+ In GitHub Actions, the following artifacts are automatically collected:
143
+ - `logs/` - Structured JSONL logs
144
+ - `*.tfplan` - Terraform plan files
145
+ - `step-summary.md` - Workflow dashboard
146
+ - `r2d-artifacts/` - Complete workflow artifacts
147
+
148
+ ## 🔧 GitHub Actions Usage
149
+
150
+ Add the R2D action to your workflow for automated infrastructure deployment:
151
+
152
+ ### Basic Setup
153
+
154
+ ```yaml
155
+ name: Deploy Infrastructure
156
+ on:
157
+ push:
158
+ branches: [main]
159
+
160
+ jobs:
161
+ deploy:
162
+ runs-on: ubuntu-latest
163
+ steps:
164
+ - name: Deploy with R2D
165
+ uses: amartyamandal/diagram-to-iac/.github/actions/r2d@v1
166
+ with:
167
+ repo: ${{ github.server_url }}/${{ github.repository }}
168
+ env:
169
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170
+ TF_CLOUD_TOKEN: ${{ secrets.TF_CLOUD_TOKEN }}
171
+ ```
172
+
173
+ ### Advanced Configuration
174
+
175
+ ```yaml
176
+ - name: Deploy with Custom Settings
177
+ uses: amartyamandal/diagram-to-iac/.github/actions/r2d@v1
178
+ with:
179
+ repo: 'https://github.com/my-org/infrastructure'
180
+ package_version: 'v2.1.0'
181
+ dry_run: 'false'
182
+ branch_name: 'deploy-prod'
183
+ thread_id: 'prod-deployment-001'
184
+ env:
185
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186
+ TF_CLOUD_TOKEN: ${{ secrets.TF_CLOUD_TOKEN }}
187
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
188
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
189
+ ```
190
+
191
+ ### Required Secrets
192
+
193
+ Configure these in your repository settings:
194
+
195
+ | Secret | Description | Required |
196
+ |--------|-------------|----------|
197
+ | `GITHUB_TOKEN` | GitHub API access (auto-provided) | ✅ Yes |
198
+ | `TF_CLOUD_TOKEN` | Terraform Cloud API token | ✅ Yes |
199
+ | `OPENAI_API_KEY` | OpenAI API key | ❌ Optional |
200
+ | `ANTHROPIC_API_KEY` | Claude API key | ❌ Optional |
201
+ | `GOOGLE_API_KEY` | Gemini API key | ❌ Optional |
202
+
203
+ ### Example Workflows
204
+
205
+ See [`.github/actions/r2d/examples/`](.github/actions/r2d/examples/) for complete workflow examples:
206
+
207
+ - **Basic Deployment**: Simple push-to-deploy workflow
208
+ - **Multi-Environment**: Deploy to dev/staging/prod with approvals
209
+ - **PR Validation**: Validate infrastructure changes in pull requests
210
+ - **Drift Detection**: Scheduled infrastructure drift monitoring
211
+ - **External Repository**: Deploy from external repositories
212
+
213
+
214
+ After each workflow run, a Markdown dashboard is generated at `step-summary.md`
215
+ showing a high level overview of Terraform modules, resource changes and tfsec
216
+ findings. The dashboard is derived from the JSONL logs and can be viewed
217
+ directly in the repository or uploaded as a build artifact.
218
+
219
+
220
+
221
+ This repository provides a container action that runs the `SupervisorAgent` on the current repository. Add the action to a workflow as shown below:
222
+
223
+ ```yaml
224
+ jobs:
225
+ supervisor:
226
+ runs-on: ubuntu-latest
227
+ steps:
228
+ - uses: actions/checkout@v4
229
+ - name: Run Supervisor Agent
230
+ uses: ./.github/actions/supervisor
231
+ env:
232
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
233
+ ```
234
+
235
+ The action reads `GITHUB_REPOSITORY` and `GITHUB_TOKEN` automatically to clone the repository and execute the agent.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "diagram-to-iac"
7
- version = "0.8.0"
7
+ version = "0.10.0"
8
8
  description = "Convert architecture diagrams into IaC modules"
9
9
  readme = "README.md"
10
10
  authors = [{ name="vindpro", email="admin@vindpro.com" }]
@@ -14,7 +14,9 @@ dependencies = ["anthropic==0.54.0", "google_api_python_client==2.172.0", "langc
14
14
 
15
15
  [project.scripts]
16
16
  diagram-to-iac = "diagram_to_iac.cli:main"
17
+ r2d-agent = "diagram_to_iac.r2d:main"
17
18
  git-agent = "diagram_to_iac.actions.git_entry:main"
19
+ terraform-agent = "diagram_to_iac.actions.terraform_agent_entry:main"
18
20
  supervisor-agent = "diagram_to_iac.actions.supervisor_entry:main"
19
21
 
20
22
  [tool.setuptools] # (intentionally left empty)