mirror of
https://github.com/johndoe6345789/AutoMetabuilder.git
synced 2026-04-24 13:54:59 +00:00
- Implement core components: CLI argument parsing, environment loading, GitHub service creation, and logging configuration. - Add support for OpenAI client setup and model resolution. - Develop SDLC context loader from GitHub and repository files. - Implement workflow context and engine builders. - Introduce major workflow packages: `game_tick_loop` and `contextual_iterative_loop`. - Update localization files with new package descriptions and labels. - Streamline web navigation by loading items from a dedicated JSON file.
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""Helpers for normalizing workflow values."""
|
|
|
|
|
|
class ValueHelpers:
|
|
"""Normalize values for workflow helpers."""
|
|
@staticmethod
|
|
def ensure_list(value):
|
|
"""Return a list for any incoming value."""
|
|
if value is None:
|
|
return []
|
|
if isinstance(value, list):
|
|
return value
|
|
if isinstance(value, (tuple, set)):
|
|
return list(value)
|
|
if isinstance(value, str):
|
|
return [line for line in value.splitlines() if line.strip()]
|
|
return [value]
|
|
|
|
@staticmethod
|
|
def coerce_bool(value) -> bool:
|
|
"""Coerce values into booleans."""
|
|
if isinstance(value, bool):
|
|
return value
|
|
if isinstance(value, str):
|
|
lowered = value.strip().lower()
|
|
if lowered in ("true", "yes", "1"):
|
|
return True
|
|
if lowered in ("false", "no", "0", ""):
|
|
return False
|
|
return bool(value)
|
|
|
|
@staticmethod
|
|
def normalize_separator(text):
|
|
"""Normalize escaped separators."""
|
|
if text is None:
|
|
return ""
|
|
if isinstance(text, str):
|
|
return text.replace("\\n", "\n").replace("\\t", "\t")
|
|
return str(text)
|