diagram-to-iac 0.7.0__py3-none-any.whl → 0.9.0__py3-none-any.whl
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.
- diagram_to_iac/__init__.py +10 -0
- diagram_to_iac/actions/__init__.py +7 -0
- diagram_to_iac/actions/git_entry.py +174 -0
- diagram_to_iac/actions/supervisor_entry.py +116 -0
- diagram_to_iac/actions/terraform_agent_entry.py +207 -0
- diagram_to_iac/agents/__init__.py +26 -0
- diagram_to_iac/agents/demonstrator_langgraph/__init__.py +10 -0
- diagram_to_iac/agents/demonstrator_langgraph/agent.py +826 -0
- diagram_to_iac/agents/git_langgraph/__init__.py +10 -0
- diagram_to_iac/agents/git_langgraph/agent.py +1018 -0
- diagram_to_iac/agents/git_langgraph/pr.py +146 -0
- diagram_to_iac/agents/hello_langgraph/__init__.py +9 -0
- diagram_to_iac/agents/hello_langgraph/agent.py +621 -0
- diagram_to_iac/agents/policy_agent/__init__.py +15 -0
- diagram_to_iac/agents/policy_agent/agent.py +507 -0
- diagram_to_iac/agents/policy_agent/integration_example.py +191 -0
- diagram_to_iac/agents/policy_agent/tools/__init__.py +14 -0
- diagram_to_iac/agents/policy_agent/tools/tfsec_tool.py +259 -0
- diagram_to_iac/agents/shell_langgraph/__init__.py +21 -0
- diagram_to_iac/agents/shell_langgraph/agent.py +122 -0
- diagram_to_iac/agents/shell_langgraph/detector.py +50 -0
- diagram_to_iac/agents/supervisor_langgraph/__init__.py +17 -0
- diagram_to_iac/agents/supervisor_langgraph/agent.py +1947 -0
- diagram_to_iac/agents/supervisor_langgraph/demonstrator.py +22 -0
- diagram_to_iac/agents/supervisor_langgraph/guards.py +23 -0
- diagram_to_iac/agents/supervisor_langgraph/pat_loop.py +49 -0
- diagram_to_iac/agents/supervisor_langgraph/router.py +9 -0
- diagram_to_iac/agents/terraform_langgraph/__init__.py +15 -0
- diagram_to_iac/agents/terraform_langgraph/agent.py +1216 -0
- diagram_to_iac/agents/terraform_langgraph/parser.py +76 -0
- diagram_to_iac/core/__init__.py +7 -0
- diagram_to_iac/core/agent_base.py +19 -0
- diagram_to_iac/core/enhanced_memory.py +302 -0
- diagram_to_iac/core/errors.py +4 -0
- diagram_to_iac/core/issue_tracker.py +49 -0
- diagram_to_iac/core/memory.py +132 -0
- diagram_to_iac/r2d.py +345 -13
- diagram_to_iac/services/__init__.py +10 -0
- diagram_to_iac/services/observability.py +59 -0
- diagram_to_iac/services/step_summary.py +77 -0
- diagram_to_iac/tools/__init__.py +11 -0
- diagram_to_iac/tools/api_utils.py +108 -26
- diagram_to_iac/tools/git/__init__.py +45 -0
- diagram_to_iac/tools/git/git.py +956 -0
- diagram_to_iac/tools/hello/__init__.py +30 -0
- diagram_to_iac/tools/hello/cal_utils.py +31 -0
- diagram_to_iac/tools/hello/text_utils.py +97 -0
- diagram_to_iac/tools/llm_utils/__init__.py +20 -0
- diagram_to_iac/tools/llm_utils/anthropic_driver.py +87 -0
- diagram_to_iac/tools/llm_utils/base_driver.py +90 -0
- diagram_to_iac/tools/llm_utils/gemini_driver.py +89 -0
- diagram_to_iac/tools/llm_utils/openai_driver.py +93 -0
- diagram_to_iac/tools/llm_utils/router.py +303 -0
- diagram_to_iac/tools/sec_utils.py +4 -2
- diagram_to_iac/tools/shell/__init__.py +17 -0
- diagram_to_iac/tools/shell/shell.py +415 -0
- diagram_to_iac/tools/text_utils.py +277 -0
- diagram_to_iac/tools/tf/terraform.py +851 -0
- diagram_to_iac-0.9.0.dist-info/METADATA +256 -0
- diagram_to_iac-0.9.0.dist-info/RECORD +64 -0
- {diagram_to_iac-0.7.0.dist-info → diagram_to_iac-0.9.0.dist-info}/WHEEL +1 -1
- diagram_to_iac-0.9.0.dist-info/entry_points.txt +6 -0
- diagram_to_iac/agents/codegen_agent.py +0 -0
- diagram_to_iac/agents/consensus_agent.py +0 -0
- diagram_to_iac/agents/deployment_agent.py +0 -0
- diagram_to_iac/agents/github_agent.py +0 -0
- diagram_to_iac/agents/interpretation_agent.py +0 -0
- diagram_to_iac/agents/question_agent.py +0 -0
- diagram_to_iac/agents/supervisor.py +0 -0
- diagram_to_iac/agents/vision_agent.py +0 -0
- diagram_to_iac/core/config.py +0 -0
- diagram_to_iac/tools/cv_utils.py +0 -0
- diagram_to_iac/tools/gh_utils.py +0 -0
- diagram_to_iac/tools/tf_utils.py +0 -0
- diagram_to_iac-0.7.0.dist-info/METADATA +0 -16
- diagram_to_iac-0.7.0.dist-info/RECORD +0 -32
- diagram_to_iac-0.7.0.dist-info/entry_points.txt +0 -2
- {diagram_to_iac-0.7.0.dist-info → diagram_to_iac-0.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
class DryRunDemonstrator:
|
2
|
+
"""Helper to display dry-run information and collect user feedback."""
|
3
|
+
|
4
|
+
def show_issue(self, title: str, body: str) -> bool:
|
5
|
+
print("=== DRY RUN: GitHub issue would be created ===")
|
6
|
+
print(f"Title: {title}")
|
7
|
+
print(f"Body:\n{body}")
|
8
|
+
try:
|
9
|
+
answer = input("Proceed after reviewing? [y/N]: ").strip().lower()
|
10
|
+
except (KeyboardInterrupt, EOFError):
|
11
|
+
answer = ""
|
12
|
+
|
13
|
+
# Return True only if user explicitly chooses to proceed
|
14
|
+
should_proceed = answer in ['y', 'yes']
|
15
|
+
|
16
|
+
if should_proceed:
|
17
|
+
print("✅ User chose to proceed with issue creation")
|
18
|
+
else:
|
19
|
+
print("❌ User chose not to proceed, dry-run completed")
|
20
|
+
|
21
|
+
return should_proceed
|
22
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"""Utility guards for SupervisorAgent."""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import os
|
6
|
+
import time
|
7
|
+
from typing import Iterable
|
8
|
+
|
9
|
+
from diagram_to_iac.core.errors import MissingSecretError
|
10
|
+
|
11
|
+
|
12
|
+
def check_required_secrets(required: Iterable[str] | None = None) -> None:
|
13
|
+
"""Ensure required secrets exist and are not empty."""
|
14
|
+
start = time.perf_counter()
|
15
|
+
secrets = list(required) if required is not None else ["GITHUB_TOKEN"]
|
16
|
+
missing = [s for s in secrets if not os.environ.get(s, "").strip()]
|
17
|
+
if missing:
|
18
|
+
raise MissingSecretError(
|
19
|
+
"Missing required secret(s): " + ", ".join(missing)
|
20
|
+
)
|
21
|
+
# Function should be extremely fast; return quickly
|
22
|
+
_ = time.perf_counter() - start
|
23
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import os
|
2
|
+
import time
|
3
|
+
import logging
|
4
|
+
|
5
|
+
from . import __name__ as pkg_name
|
6
|
+
from diagram_to_iac.agents.git_langgraph import GitAgentInput
|
7
|
+
|
8
|
+
|
9
|
+
def request_and_wait_for_pat(repo_url: str, git_agent, poll_interval: int = 30, timeout: int = 600) -> bool:
|
10
|
+
"""Request TF_TOKEN_APP_TERRAFORM_IO from the user and wait until provided.
|
11
|
+
|
12
|
+
Parameters
|
13
|
+
----------
|
14
|
+
repo_url: str
|
15
|
+
Repository URL used for context in the GitHub issue comment.
|
16
|
+
git_agent: GitAgent
|
17
|
+
Agent used to post a comment requesting the token.
|
18
|
+
poll_interval: int, optional
|
19
|
+
How often to check for the environment variable, in seconds.
|
20
|
+
timeout: int, optional
|
21
|
+
Maximum time to wait before giving up, in seconds.
|
22
|
+
|
23
|
+
Returns
|
24
|
+
-------
|
25
|
+
bool
|
26
|
+
``True`` if the token was detected before timeout, ``False`` otherwise.
|
27
|
+
"""
|
28
|
+
logger = logging.getLogger(f"{pkg_name}.pat_loop")
|
29
|
+
message = (
|
30
|
+
"Please add the Terraform Cloud token `TF_TOKEN_APP_TERRAFORM_IO` as an "
|
31
|
+
"environment variable and reply 'retry init' once done."
|
32
|
+
)
|
33
|
+
|
34
|
+
try:
|
35
|
+
git_agent.run(
|
36
|
+
GitAgentInput(
|
37
|
+
query=f"open issue {message} for repository {repo_url}",
|
38
|
+
)
|
39
|
+
)
|
40
|
+
except Exception as e: # pragma: no cover - log but continue
|
41
|
+
logger.error(f"Failed to post PAT request comment: {e}")
|
42
|
+
|
43
|
+
env_name = "TF_TOKEN_APP_TERRAFORM_IO"
|
44
|
+
end = time.time() + timeout
|
45
|
+
while time.time() < end:
|
46
|
+
if os.environ.get(env_name):
|
47
|
+
return True
|
48
|
+
time.sleep(poll_interval)
|
49
|
+
return False
|
@@ -0,0 +1,9 @@
|
|
1
|
+
from typing import Dict
|
2
|
+
|
3
|
+
STACK_SUPPORT_THRESHOLD = 0.7
|
4
|
+
|
5
|
+
|
6
|
+
def route_on_stack(histogram: Dict[str, float]) -> bool:
|
7
|
+
"""Return True if any stack falls below the configured support threshold."""
|
8
|
+
return any(value < STACK_SUPPORT_THRESHOLD for value in histogram.values())
|
9
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"""
|
2
|
+
Terraform LangGraph Agent Package
|
3
|
+
|
4
|
+
This package contains the TerraformAgent implementation with its dedicated tools and configuration.
|
5
|
+
"""
|
6
|
+
|
7
|
+
from .agent import TerraformAgent, TerraformAgentInput, TerraformAgentOutput
|
8
|
+
from .parser import classify_terraform_error
|
9
|
+
|
10
|
+
__all__ = [
|
11
|
+
"TerraformAgent",
|
12
|
+
"TerraformAgentInput",
|
13
|
+
"TerraformAgentOutput",
|
14
|
+
"classify_terraform_error",
|
15
|
+
]
|