diagram-to-iac 0.7.0__py3-none-any.whl → 0.8.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.
Files changed (77) hide show
  1. diagram_to_iac/__init__.py +10 -0
  2. diagram_to_iac/actions/__init__.py +7 -0
  3. diagram_to_iac/actions/git_entry.py +174 -0
  4. diagram_to_iac/actions/supervisor_entry.py +116 -0
  5. diagram_to_iac/actions/terraform_agent_entry.py +207 -0
  6. diagram_to_iac/agents/__init__.py +26 -0
  7. diagram_to_iac/agents/demonstrator_langgraph/__init__.py +10 -0
  8. diagram_to_iac/agents/demonstrator_langgraph/agent.py +826 -0
  9. diagram_to_iac/agents/git_langgraph/__init__.py +10 -0
  10. diagram_to_iac/agents/git_langgraph/agent.py +1018 -0
  11. diagram_to_iac/agents/git_langgraph/pr.py +146 -0
  12. diagram_to_iac/agents/hello_langgraph/__init__.py +9 -0
  13. diagram_to_iac/agents/hello_langgraph/agent.py +621 -0
  14. diagram_to_iac/agents/policy_agent/__init__.py +15 -0
  15. diagram_to_iac/agents/policy_agent/agent.py +507 -0
  16. diagram_to_iac/agents/policy_agent/integration_example.py +191 -0
  17. diagram_to_iac/agents/policy_agent/tools/__init__.py +14 -0
  18. diagram_to_iac/agents/policy_agent/tools/tfsec_tool.py +259 -0
  19. diagram_to_iac/agents/shell_langgraph/__init__.py +21 -0
  20. diagram_to_iac/agents/shell_langgraph/agent.py +122 -0
  21. diagram_to_iac/agents/shell_langgraph/detector.py +50 -0
  22. diagram_to_iac/agents/supervisor_langgraph/__init__.py +17 -0
  23. diagram_to_iac/agents/supervisor_langgraph/agent.py +1947 -0
  24. diagram_to_iac/agents/supervisor_langgraph/demonstrator.py +22 -0
  25. diagram_to_iac/agents/supervisor_langgraph/guards.py +23 -0
  26. diagram_to_iac/agents/supervisor_langgraph/pat_loop.py +49 -0
  27. diagram_to_iac/agents/supervisor_langgraph/router.py +9 -0
  28. diagram_to_iac/agents/terraform_langgraph/__init__.py +15 -0
  29. diagram_to_iac/agents/terraform_langgraph/agent.py +1216 -0
  30. diagram_to_iac/agents/terraform_langgraph/parser.py +76 -0
  31. diagram_to_iac/core/__init__.py +7 -0
  32. diagram_to_iac/core/agent_base.py +19 -0
  33. diagram_to_iac/core/enhanced_memory.py +302 -0
  34. diagram_to_iac/core/errors.py +4 -0
  35. diagram_to_iac/core/issue_tracker.py +49 -0
  36. diagram_to_iac/core/memory.py +132 -0
  37. diagram_to_iac/services/__init__.py +10 -0
  38. diagram_to_iac/services/observability.py +59 -0
  39. diagram_to_iac/services/step_summary.py +77 -0
  40. diagram_to_iac/tools/__init__.py +11 -0
  41. diagram_to_iac/tools/api_utils.py +108 -26
  42. diagram_to_iac/tools/git/__init__.py +45 -0
  43. diagram_to_iac/tools/git/git.py +956 -0
  44. diagram_to_iac/tools/hello/__init__.py +30 -0
  45. diagram_to_iac/tools/hello/cal_utils.py +31 -0
  46. diagram_to_iac/tools/hello/text_utils.py +97 -0
  47. diagram_to_iac/tools/llm_utils/__init__.py +20 -0
  48. diagram_to_iac/tools/llm_utils/anthropic_driver.py +87 -0
  49. diagram_to_iac/tools/llm_utils/base_driver.py +90 -0
  50. diagram_to_iac/tools/llm_utils/gemini_driver.py +89 -0
  51. diagram_to_iac/tools/llm_utils/openai_driver.py +93 -0
  52. diagram_to_iac/tools/llm_utils/router.py +303 -0
  53. diagram_to_iac/tools/sec_utils.py +4 -2
  54. diagram_to_iac/tools/shell/__init__.py +17 -0
  55. diagram_to_iac/tools/shell/shell.py +415 -0
  56. diagram_to_iac/tools/text_utils.py +277 -0
  57. diagram_to_iac/tools/tf/terraform.py +851 -0
  58. diagram_to_iac-0.8.0.dist-info/METADATA +99 -0
  59. diagram_to_iac-0.8.0.dist-info/RECORD +64 -0
  60. {diagram_to_iac-0.7.0.dist-info → diagram_to_iac-0.8.0.dist-info}/WHEEL +1 -1
  61. diagram_to_iac-0.8.0.dist-info/entry_points.txt +4 -0
  62. diagram_to_iac/agents/codegen_agent.py +0 -0
  63. diagram_to_iac/agents/consensus_agent.py +0 -0
  64. diagram_to_iac/agents/deployment_agent.py +0 -0
  65. diagram_to_iac/agents/github_agent.py +0 -0
  66. diagram_to_iac/agents/interpretation_agent.py +0 -0
  67. diagram_to_iac/agents/question_agent.py +0 -0
  68. diagram_to_iac/agents/supervisor.py +0 -0
  69. diagram_to_iac/agents/vision_agent.py +0 -0
  70. diagram_to_iac/core/config.py +0 -0
  71. diagram_to_iac/tools/cv_utils.py +0 -0
  72. diagram_to_iac/tools/gh_utils.py +0 -0
  73. diagram_to_iac/tools/tf_utils.py +0 -0
  74. diagram_to_iac-0.7.0.dist-info/METADATA +0 -16
  75. diagram_to_iac-0.7.0.dist-info/RECORD +0 -32
  76. diagram_to_iac-0.7.0.dist-info/entry_points.txt +0 -2
  77. {diagram_to_iac-0.7.0.dist-info → diagram_to_iac-0.8.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
+ ]