[Previous handler.py content...]
async def process_field_dependencies(self, request: InputRequest, field_updates: Dict[str, Any]):
"""Process field dependencies based on user input.
Some fields might need to be updated based on values of other fields.
For example, if user selects Python as language, we need to show Python version field.
Args:
request: Current input request
field_updates: Updated field values
"""
try:
if request.request_id == "environment_setup":
language = field_updates.get("language")
if language:
# Update required fields based on language selection
for field in request.fields:
if field.name == "python_version":
field.required = language in ["python", "both"]
elif field.name == "node_version":
field.required = language in ["node", "both"]
elif request.request_id == "test_configuration":
test_framework = field_updates.get("test_framework")
if test_framework:
# Update coverage options based on test framework
for field in request.fields:
if field.name == "include_coverage":
field.options = self._get_coverage_options(test_framework)
def _get_coverage_options(self, framework: str) -> List[Dict[str, str]]:
"""Get coverage tool options based on test framework."""
coverage_tools = {
"pytest": [
{"value": "pytest-cov", "label": "pytest-cov"},
{"value": "coverage", "label": "coverage.py"}
],
"unittest": [
{"value": "coverage", "label": "coverage.py"}
],
"jest": [
{"value": "jest-coverage", "label": "Jest Coverage"}
],
"mocha": [
{"value": "nyc", "label": "Istanbul/nyc"}
]
}
return coverage_tools.get(framework, [])