-
Notifications
You must be signed in to change notification settings - Fork 361
Expand file tree
/
Copy pathadapter.py
More file actions
77 lines (61 loc) · 2.36 KB
/
adapter.py
File metadata and controls
77 lines (61 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""Abstract adapter interface for CLI-based automation."""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from cli_harness.simulator import HumanSimulator
@dataclass
class AdapterConfig:
"""Configuration for a CLI adapter run."""
vision_path: Path
output_dir: Path
rules_path: Path
tech_env_path: Path | None = None
prompt_template: str | None = None
model: str | None = None
simulator_model: str | None = None # kept for backwards compat; prefer simulator field
aws_profile: str | None = None
aws_region: str | None = None
openapi_content: str | None = None # injected into prompt/simulator for contract validation
simulator: "HumanSimulator | None" = None # pre-built by orchestrator; shared across adapters
timeout_seconds: int = 7200 # 2 hours max
@dataclass
class AdapterResult:
"""Result from a CLI adapter run."""
success: bool
output_dir: Path
aidlc_docs_dir: Path | None = None
workspace_dir: Path | None = None
error: str | None = None
elapsed_seconds: float = 0.0
token_estimate: int | None = None
extra: dict = field(default_factory=dict)
class CLIAdapter(ABC):
"""Abstract base for CLI-specific automation adapters."""
@property
@abstractmethod
def name(self) -> str:
"""Human-readable CLI tool name (e.g., 'kiro-cli')."""
...
@abstractmethod
def check_prerequisites(self) -> tuple[bool, str]:
"""Verify the CLI tool is installed, configured, and accessible.
Returns:
(ok, message) — True with a success message, or False with
a description of what's missing.
"""
...
@abstractmethod
def run(self, config: AdapterConfig) -> AdapterResult:
"""Execute the AIDLC process through the CLI tool and capture outputs.
The implementation should:
1. Set up a clean workspace with vision.md, tech-env.md, and rules
2. Launch the CLI tool or connect to a running instance
3. Send the AIDLC prompt to the CLI tool
4. Monitor for completion (all AIDLC phases done)
5. Extract aidlc-docs/ and workspace/ from the output
6. Generate run-meta.yaml with timing and adapter info
"""
...