diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-22 13:06:46 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-22 13:06:46 -0400 |
| commit | df0635f1bba611b8b44975057acd579102d209dd (patch) | |
| tree | 79a3ae004d5de136a5b5647e87f325d62561f9de | |
| parent | f8c09209513507ad9af7822c32119cf6d6fae0ac (diff) | |
| download | decky-lsfg-vk-df0635f1bba611b8b44975057acd579102d209dd.tar.gz decky-lsfg-vk-df0635f1bba611b8b44975057acd579102d209dd.zip | |
further automate population of hardcoded fields
| -rw-r--r-- | py_modules/lsfg_vk/config_schema.py | 64 | ||||
| -rw-r--r-- | py_modules/lsfg_vk/config_schema_generated.py | 118 | ||||
| -rw-r--r-- | py_modules/lsfg_vk/configuration.py | 44 | ||||
| -rw-r--r-- | py_modules/lsfg_vk/configuration_helpers_generated.py | 22 | ||||
| -rw-r--r-- | scripts/generate_python_boilerplate.py | 319 | ||||
| -rw-r--r-- | scripts/generate_ts_schema.py | 18 | ||||
| -rw-r--r-- | src/config/generatedConfigSchema.ts | 18 |
7 files changed, 499 insertions, 104 deletions
diff --git a/py_modules/lsfg_vk/config_schema.py b/py_modules/lsfg_vk/config_schema.py index 6728106..a7827ae 100644 --- a/py_modules/lsfg_vk/config_schema.py +++ b/py_modules/lsfg_vk/config_schema.py @@ -19,6 +19,9 @@ from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent.parent)) from shared_config import CONFIG_SCHEMA_DEF, ConfigFieldType, get_field_names, get_defaults, get_field_types +# Import auto-generated configuration components +from .config_schema_generated import ConfigurationData, get_script_parsing_logic, get_script_generation_logic + @dataclass class ConfigField: @@ -68,19 +71,11 @@ SCRIPT_ONLY_FIELDS = { COMPLETE_CONFIG_SCHEMA = {**CONFIG_SCHEMA, **SCRIPT_ONLY_FIELDS} -class ConfigurationData(TypedDict): - """Type-safe configuration data structure""" - dll: str - multiplier: int - flow_scale: float - performance_mode: bool - hdr_mode: bool - experimental_present_mode: str - dxvk_frame_rate: int - enable_wow64: bool - disable_steamdeck_mode: bool - mangohud_workaround: bool - disable_vkbasalt: bool +# Import auto-generated configuration components +from .config_schema_generated import ConfigurationData, get_script_parsing_logic, get_script_generation_logic + +# Note: ConfigurationData is now imported from generated file +# No need to manually maintain the TypedDict anymore! class ConfigurationManager: @@ -295,46 +290,9 @@ class ConfigurationManager: Returns: Dict containing parsed script-only field values """ - script_values = {} - - try: - lines = script_content.split('\n') - - for line in lines: - line = line.strip() - - # Skip comments, empty lines, and non-export lines - if not line or line.startswith('#') or not line.startswith('export '): - continue - - # Parse export statements: export VAR=value - if '=' in line: - # Remove 'export ' prefix - export_line = line[len('export '):] - key, value = export_line.split('=', 1) - key = key.strip() - value = value.strip() - - # Map environment variables to config field names - if key == "DXVK_FRAME_RATE": - try: - script_values["dxvk_frame_rate"] = int(value) - except ValueError: - pass - elif key == "PROTON_USE_WOW64": - script_values["enable_wow64"] = value == "1" - elif key == "SteamDeck": - script_values["disable_steamdeck_mode"] = value == "0" - elif key == "MANGOHUD": - script_values["mangohud_workaround"] = value == "1" - elif key == "DISABLE_VKBASALT": - script_values["disable_vkbasalt"] = value == "1" - - except (ValueError, KeyError, IndexError) as e: - # If parsing fails, log the error and return empty dict (will use defaults) - print(f"Error parsing script content: {e}") - - return script_values + # Use auto-generated parsing logic + parse_script_values = get_script_parsing_logic() + return parse_script_values(script_content.split('\n')) @staticmethod def merge_config_with_script(toml_config: ConfigurationData, script_values: Dict[str, Union[bool, int, str]]) -> ConfigurationData: diff --git a/py_modules/lsfg_vk/config_schema_generated.py b/py_modules/lsfg_vk/config_schema_generated.py new file mode 100644 index 0000000..46bc58f --- /dev/null +++ b/py_modules/lsfg_vk/config_schema_generated.py @@ -0,0 +1,118 @@ +""" +Auto-generated configuration schema components from shared_config.py +DO NOT EDIT THIS FILE MANUALLY - it will be overwritten on build +""" + +from typing import TypedDict, Dict, Any, Union, cast +from enum import Enum +import sys +from pathlib import Path + +# Import shared configuration constants +sys.path.insert(0, str(Path(__file__).parent.parent.parent)) +from shared_config import CONFIG_SCHEMA_DEF, ConfigFieldType + + +class ConfigurationData(TypedDict): + """Type-safe configuration data structure - AUTO-GENERATED""" + dll: str + multiplier: int + flow_scale: float + performance_mode: bool + hdr_mode: bool + experimental_present_mode: str + dxvk_frame_rate: int + enable_wow64: bool + disable_steamdeck_mode: bool + mangohud_workaround: bool + disable_vkbasalt: bool + + +def get_script_parsing_logic(): + """Return the script parsing logic as a callable""" + def parse_script_values(lines): + script_values = {} + for line in lines: + line = line.strip() + if not line or line.startswith("#") or not line.startswith("export "): + continue + if "=" in line: + export_line = line[len("export "):] + key, value = export_line.split("=", 1) + key = key.strip() + value = value.strip() + + # Auto-generated parsing logic: + if key == "DXVK_FRAME_RATE": + try: + script_values["dxvk_frame_rate"] = int(value) + except ValueError: + pass + if key == "PROTON_USE_WOW64": + script_values["enable_wow64"] = value == "1" + if key == "SteamDeck": + script_values["disable_steamdeck_mode"] = value == "0" + if key == "MANGOHUD": + script_values["mangohud_workaround"] = value == "1" + if key == "DISABLE_VKBASALT": + script_values["disable_vkbasalt"] = value == "1" + + return script_values + return parse_script_values + + +def get_script_generation_logic(): + """Return the script generation logic as a callable""" + def generate_script_lines(config): + lines = [] + dxvk_frame_rate = config.get("dxvk_frame_rate", 0) + if dxvk_frame_rate > 0: + lines.append(f"export DXVK_FRAME_RATE={dxvk_frame_rate}") + if config.get("enable_wow64", False): + lines.append("export PROTON_USE_WOW64=1") + if config.get("disable_steamdeck_mode", False): + lines.append("export SteamDeck=0") + if config.get("mangohud_workaround", False): + lines.append("export MANGOHUD=1") + if config.get("disable_vkbasalt", False): + lines.append("export DISABLE_VKBASALT=1") + return lines + return generate_script_lines + + +def get_function_parameters() -> str: + """Return function signature parameters""" + return """dll: str = "/games/Lossless Scaling/Lossless.dll", + multiplier: int = 1, + flow_scale: float = 0.8, + performance_mode: bool = True, + hdr_mode: bool = False, + experimental_present_mode: str = "fifo", + dxvk_frame_rate: int = 0, + enable_wow64: bool = False, + disable_steamdeck_mode: bool = False, + mangohud_workaround: bool = False, + disable_vkbasalt: bool = False""" + + +def create_config_dict(**kwargs) -> ConfigurationData: + """Create configuration dictionary from keyword arguments""" + return cast(ConfigurationData, { + "dll": dll, + "multiplier": multiplier, + "flow_scale": flow_scale, + "performance_mode": performance_mode, + "hdr_mode": hdr_mode, + "experimental_present_mode": experimental_present_mode, + "dxvk_frame_rate": dxvk_frame_rate, + "enable_wow64": enable_wow64, + "disable_steamdeck_mode": disable_steamdeck_mode, + "mangohud_workaround": mangohud_workaround, + "disable_vkbasalt": disable_vkbasalt, + }) + + +# Field lists for dynamic operations +TOML_FIELDS = ['dll', 'multiplier', 'flow_scale', 'performance_mode', 'hdr_mode', 'experimental_present_mode'] +SCRIPT_FIELDS = ['dxvk_frame_rate', 'enable_wow64', 'disable_steamdeck_mode', 'mangohud_workaround', 'disable_vkbasalt'] +ALL_FIELDS = ['dll', 'multiplier', 'flow_scale', 'performance_mode', 'hdr_mode', 'experimental_present_mode', 'dxvk_frame_rate', 'enable_wow64', 'disable_steamdeck_mode', 'mangohud_workaround', 'disable_vkbasalt'] diff --git a/py_modules/lsfg_vk/configuration.py b/py_modules/lsfg_vk/configuration.py index 49653ea..e745e29 100644 --- a/py_modules/lsfg_vk/configuration.py +++ b/py_modules/lsfg_vk/configuration.py @@ -6,7 +6,9 @@ from pathlib import Path from typing import Dict, Any from .base_service import BaseService -from .config_schema import ConfigurationManager, ConfigurationData, CONFIG_SCHEMA +from .config_schema import ConfigurationManager, CONFIG_SCHEMA +from .config_schema_generated import ConfigurationData, get_script_generation_logic +from .configuration_helpers_generated import log_configuration_update from .types import ConfigurationResponse @@ -149,13 +151,8 @@ class ConfigurationService(BaseService): if not script_result["success"]: self.log.warning(f"Failed to update launch script: {script_result['error']}") - self.log.info(f"Updated lsfg TOML configuration: " - f"dll='{dll}', multiplier={multiplier}, flow_scale={flow_scale}, " - f"performance_mode={performance_mode}, hdr_mode={hdr_mode}, " - f"experimental_present_mode='{experimental_present_mode}', " - f"dxvk_frame_rate={dxvk_frame_rate}, " - f"enable_wow64={enable_wow64}, disable_steamdeck_mode={disable_steamdeck_mode}, " - f"mangohud_workaround={mangohud_workaround}, disable_vkbasalt={disable_vkbasalt}") + # Use auto-generated logging + log_configuration_update(self.log, config) return self._success_response(ConfigurationResponse, "lsfg configuration updated successfully", @@ -254,29 +251,14 @@ class ConfigurationService(BaseService): "# This script sets up the environment for lsfg-vk to work with the plugin configuration" ] - # Add optional export statements based on configuration - if config.get("enable_wow64", False): - lines.append("export PROTON_USE_WOW64=1") + # Use auto-generated script generation logic + generate_script_lines = get_script_generation_logic() + lines.extend(generate_script_lines(config)) - if config.get("disable_steamdeck_mode", False): - lines.append("export SteamDeck=0") - - if config.get("mangohud_workaround", False): - lines.append("export MANGOHUD=1") - lines.append("export MANGOHUD_CONFIG=alpha=0.001,background_alpha=0.001") - - if config.get("disable_vkbasalt", False): - lines.append("export DISABLE_VKBASALT=1") - - # Add DXVK_FRAME_RATE if dxvk_frame_rate is set - dxvk_frame_rate = config.get("dxvk_frame_rate", 0) - if dxvk_frame_rate > 0: - lines.append(f"export DXVK_FRAME_RATE={dxvk_frame_rate}") - - # Always add the LSFG_PROCESS export - lines.append("export LSFG_PROCESS=decky-lsfg-vk") - - # Add the execution line - lines.append('exec "$@"') + # Always add the LSFG_PROCESS export and execution line + lines.extend([ + "export LSFG_PROCESS=decky-lsfg-vk", + 'exec "$@"' + ]) return "\n".join(lines) + "\n" diff --git a/py_modules/lsfg_vk/configuration_helpers_generated.py b/py_modules/lsfg_vk/configuration_helpers_generated.py new file mode 100644 index 0000000..f9f4a65 --- /dev/null +++ b/py_modules/lsfg_vk/configuration_helpers_generated.py @@ -0,0 +1,22 @@ +""" +Auto-generated configuration helper functions from shared_config.py +DO NOT EDIT THIS FILE MANUALLY - it will be overwritten on build +""" + +from typing import Dict, Any +from .config_schema_generated import ConfigurationData, ALL_FIELDS + + +def log_configuration_update(logger, config: ConfigurationData) -> None: + """Log configuration update with all field values""" + logger.info(f"Updated lsfg TOML configuration: dll={config['dll']}, multiplier={config['multiplier']}, flow_scale={config['flow_scale']}, performance_mode={config['performance_mode']}, hdr_mode={config['hdr_mode']}, experimental_present_mode={config['experimental_present_mode']}, dxvk_frame_rate={config['dxvk_frame_rate']}, enable_wow64={config['enable_wow64']}, disable_steamdeck_mode={config['disable_steamdeck_mode']}, mangohud_workaround={config['mangohud_workaround']}, disable_vkbasalt={config['disable_vkbasalt']}") + + +def get_config_field_names() -> list[str]: + """Get all configuration field names""" + return ALL_FIELDS.copy() + + +def extract_config_values(config: ConfigurationData) -> Dict[str, Any]: + """Extract configuration values as a dictionary""" + return {field: config[field] for field in ALL_FIELDS} diff --git a/scripts/generate_python_boilerplate.py b/scripts/generate_python_boilerplate.py new file mode 100644 index 0000000..0101ae4 --- /dev/null +++ b/scripts/generate_python_boilerplate.py @@ -0,0 +1,319 @@ +#!/usr/bin/env python3 +""" +Generate Python boilerplate from shared_config.py + +This script generates repetitive Python code patterns from the canonical schema, +reducing manual maintenance when adding/removing configuration fields. +""" + +import sys +from pathlib import Path + +# Add project root to path to import shared_config +project_root = Path(__file__).parent.parent +sys.path.insert(0, str(project_root)) + +from shared_config import CONFIG_SCHEMA_DEF, ConfigFieldType + + +def get_python_type(field_type: ConfigFieldType) -> str: + """Convert ConfigFieldType to Python type annotation""" + type_map = { + ConfigFieldType.BOOLEAN: "bool", + ConfigFieldType.INTEGER: "int", + ConfigFieldType.FLOAT: "float", + ConfigFieldType.STRING: "str" + } + return type_map.get(field_type, "Any") + + +def get_env_var_name(field_name: str) -> str: + """Convert field name to environment variable name""" + env_map = { + "dxvk_frame_rate": "DXVK_FRAME_RATE", + "enable_wow64": "PROTON_USE_WOW64", + "disable_steamdeck_mode": "SteamDeck", + "mangohud_workaround": "MANGOHUD", + "disable_vkbasalt": "DISABLE_VKBASALT" + } + return env_map.get(field_name, field_name.upper()) + + +def generate_typed_dict() -> str: + """Generate ConfigurationData TypedDict""" + lines = [ + "class ConfigurationData(TypedDict):", + " \"\"\"Type-safe configuration data structure - AUTO-GENERATED\"\"\"" + ] + + for field_name, field_def in CONFIG_SCHEMA_DEF.items(): + python_type = get_python_type(ConfigFieldType(field_def["fieldType"])) + lines.append(f" {field_name}: {python_type}") + + return "\n".join(lines) + + +def generate_function_signature() -> str: + """Generate function signature for update_config and create_config_from_args""" + params = [] + + for field_name, field_def in CONFIG_SCHEMA_DEF.items(): + python_type = get_python_type(ConfigFieldType(field_def["fieldType"])) + default = field_def["default"] + + # Format default value + if isinstance(default, str): + default_str = f'"{default}"' + elif isinstance(default, bool): + default_str = str(default) + else: + default_str = str(default) + + params.append(f"{field_name}: {python_type} = {default_str}") + + return ",\n ".join(params) + + +def generate_config_dict_creation() -> str: + """Generate dictionary creation for create_config_from_args""" + lines = [" return cast(ConfigurationData, {"] + + for field_name in CONFIG_SCHEMA_DEF.keys(): + lines.append(f' "{field_name}": {field_name},') + + lines.append(" })") + return "\n".join(lines) + + +def generate_script_parsing() -> str: + """Generate script content parsing logic""" + lines = [] + + script_fields = [ + (field_name, field_def) + for field_name, field_def in CONFIG_SCHEMA_DEF.items() + if field_def.get("location") == "script" + ] + + for field_name, field_def in script_fields: + env_var = get_env_var_name(field_name) + field_type = ConfigFieldType(field_def["fieldType"]) + + if field_type == ConfigFieldType.BOOLEAN: + if field_name == "disable_steamdeck_mode": + # Special case: SteamDeck=0 means disable_steamdeck_mode=True + lines.append(f' elif key == "{env_var}":') + lines.append(f' script_values["{field_name}"] = value == "0"') + else: + lines.append(f' elif key == "{env_var}":') + lines.append(f' script_values["{field_name}"] = value == "1"') + elif field_type == ConfigFieldType.INTEGER: + lines.append(f' elif key == "{env_var}":') + lines.append(' try:') + lines.append(f' script_values["{field_name}"] = int(value)') + lines.append(' except ValueError:') + lines.append(' pass') + elif field_type == ConfigFieldType.FLOAT: + lines.append(f' elif key == "{env_var}":') + lines.append(' try:') + lines.append(f' script_values["{field_name}"] = float(value)') + lines.append(' except ValueError:') + lines.append(' pass') + elif field_type == ConfigFieldType.STRING: + lines.append(f' elif key == "{env_var}":') + lines.append(f' script_values["{field_name}"] = value') + + return "\n".join(lines) + + +def generate_script_generation() -> str: + """Generate script content generation logic""" + lines = [] + + script_fields = [ + (field_name, field_def) + for field_name, field_def in CONFIG_SCHEMA_DEF.items() + if field_def.get("location") == "script" + ] + + for field_name, field_def in script_fields: + env_var = get_env_var_name(field_name) + field_type = ConfigFieldType(field_def["fieldType"]) + + if field_type == ConfigFieldType.BOOLEAN: + if field_name == "disable_steamdeck_mode": + # Special case: disable_steamdeck_mode=True should export SteamDeck=0 + lines.append(f' if config.get("{field_name}", False):') + lines.append(f' lines.append("export {env_var}=0")') + else: + lines.append(f' if config.get("{field_name}", False):') + lines.append(f' lines.append("export {env_var}=1")') + elif field_type in [ConfigFieldType.INTEGER, ConfigFieldType.FLOAT]: + default = field_def["default"] + if field_name == "dxvk_frame_rate": + # Special handling for DXVK_FRAME_RATE (only export if > 0) + lines.append(f' {field_name} = config.get("{field_name}", {default})') + lines.append(f' if {field_name} > 0:') + lines.append(f' lines.append(f"export {env_var}={{{field_name}}}")') + else: + lines.append(f' {field_name} = config.get("{field_name}", {default})') + lines.append(f' if {field_name} != {default}:') + lines.append(f' lines.append(f"export {env_var}={{{field_name}}}")') + elif field_type == ConfigFieldType.STRING: + lines.append(f' {field_name} = config.get("{field_name}", "")') + lines.append(f' if {field_name}:') + lines.append(f' lines.append(f"export {env_var}={{{field_name}}}")') + + return "\n".join(lines) + + +def generate_log_statement() -> str: + """Generate logging statement with all field values""" + field_parts = [] + + for field_name in CONFIG_SCHEMA_DEF.keys(): + field_parts.append(f"{field_name}={{{field_name}}}") + + log_format = ", ".join(field_parts) + return f' self.log.info(f"Updated lsfg TOML configuration: {log_format}")' + + +def generate_complete_schema_file() -> str: + """Generate complete config_schema_generated.py file""" + lines = [ + '"""', + 'Auto-generated configuration schema components from shared_config.py', + 'DO NOT EDIT THIS FILE MANUALLY - it will be overwritten on build', + '"""', + '', + 'from typing import TypedDict, Dict, Any, Union, cast', + 'from enum import Enum', + 'import sys', + 'from pathlib import Path', + '', + '# Import shared configuration constants', + 'sys.path.insert(0, str(Path(__file__).parent.parent.parent))', + 'from shared_config import CONFIG_SCHEMA_DEF, ConfigFieldType', + '', + '', + generate_typed_dict(), + '', + '', + 'def get_script_parsing_logic():', + ' """Return the script parsing logic as a callable"""', + ' def parse_script_values(lines):', + ' script_values = {}', + ' for line in lines:', + ' line = line.strip()', + ' if not line or line.startswith("#") or not line.startswith("export "):', + ' continue', + ' if "=" in line:', + ' export_line = line[len("export "):]', + ' key, value = export_line.split("=", 1)', + ' key = key.strip()', + ' value = value.strip()', + '', + ' # Auto-generated parsing logic:', + f'{generate_script_parsing().replace(" elif", " if")}', + '', + ' return script_values', + ' return parse_script_values', + '', + '', + 'def get_script_generation_logic():', + ' """Return the script generation logic as a callable"""', + ' def generate_script_lines(config):', + ' lines = []', + f'{generate_script_generation()}', + ' return lines', + ' return generate_script_lines', + '', + '', + 'def get_function_parameters() -> str:', + ' """Return function signature parameters"""', + f' return """{generate_function_signature()}"""', + '', + '', + 'def create_config_dict(**kwargs) -> ConfigurationData:', + ' """Create configuration dictionary from keyword arguments"""', + f'{generate_config_dict_creation().replace(" return cast(ConfigurationData, {", " return cast(ConfigurationData, {").replace(" })", " })")}', + '', + '', + '# Field lists for dynamic operations', + f'TOML_FIELDS = {[name for name, field in CONFIG_SCHEMA_DEF.items() if field.get("location") == "toml"]}', + f'SCRIPT_FIELDS = {[name for name, field in CONFIG_SCHEMA_DEF.items() if field.get("location") == "script"]}', + f'ALL_FIELDS = {list(CONFIG_SCHEMA_DEF.keys())}', + '' + ] + + return '\n'.join(lines) + + +def generate_complete_configuration_helpers() -> str: + """Generate configuration_helpers_generated.py file""" + + # Generate the log format string using config parameter + log_parts = [] + for field_name in CONFIG_SCHEMA_DEF.keys(): + log_parts.append(f"{field_name}={{config['{field_name}']}}") + log_format = ", ".join(log_parts) + + lines = [ + '"""', + 'Auto-generated configuration helper functions from shared_config.py', + 'DO NOT EDIT THIS FILE MANUALLY - it will be overwritten on build', + '"""', + '', + 'from typing import Dict, Any', + 'from .config_schema_generated import ConfigurationData, ALL_FIELDS', + '', + '', + 'def log_configuration_update(logger, config: ConfigurationData) -> None:', + ' """Log configuration update with all field values"""', + f' logger.info(f"Updated lsfg TOML configuration: {log_format}")', + '', + '', + 'def get_config_field_names() -> list[str]:', + ' """Get all configuration field names"""', + ' return ALL_FIELDS.copy()', + '', + '', + 'def extract_config_values(config: ConfigurationData) -> Dict[str, Any]:', + ' """Extract configuration values as a dictionary"""', + ' return {field: config[field] for field in ALL_FIELDS}', + '' + ] + + return '\n'.join(lines) + + +def main(): + """Generate complete Python configuration files""" + try: + # Create generated files in py_modules/lsfg_vk/ + target_dir = project_root / "py_modules" / "lsfg_vk" + + # Generate the complete schema file + schema_content = generate_complete_schema_file() + schema_file = target_dir / "config_schema_generated.py" + schema_file.write_text(schema_content) + print(f"ā
Generated {schema_file.relative_to(project_root)}") + + # Generate configuration helpers + helpers_content = generate_complete_configuration_helpers() + helpers_file = target_dir / "configuration_helpers_generated.py" + helpers_file.write_text(helpers_content) + print(f"ā
Generated {helpers_file.relative_to(project_root)}") + + print(f"\nšÆ Ready-to-use files generated!") + print(" Import these in your main files:") + print(" - from .config_schema_generated import ConfigurationData, get_script_parsing_logic, etc.") + print(" - from .configuration_helpers_generated import log_configuration_update, etc.") + + except Exception as e: + print(f"ā Error generating Python files: {e}") + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/scripts/generate_ts_schema.py b/scripts/generate_ts_schema.py index dcdddf2..1997c55 100644 --- a/scripts/generate_ts_schema.py +++ b/scripts/generate_ts_schema.py @@ -114,7 +114,7 @@ def generate_typescript_schema(): def main(): - """Main function to generate TypeScript schema""" + """Main function to generate TypeScript schema and Python boilerplate""" try: # Generate the TypeScript content ts_content = generate_typescript_schema() @@ -126,8 +126,22 @@ def main(): print(f"ā
Generated {target_file} from shared_config.py") print(f" Fields: {len(CONFIG_SCHEMA_DEF)}") + # Also generate Python boilerplate + print("\nš Generating Python boilerplate...") + from pathlib import Path + import subprocess + + boilerplate_script = project_root / "scripts" / "generate_python_boilerplate.py" + result = subprocess.run([sys.executable, str(boilerplate_script)], + capture_output=True, text=True) + + if result.returncode == 0: + print(result.stdout) + else: + print(f"ā ļø Python boilerplate generation had issues:\n{result.stderr}") + except Exception as e: - print(f"ā Error generating TypeScript schema: {e}") + print(f"ā Error generating schema: {e}") sys.exit(1) diff --git a/src/config/generatedConfigSchema.ts b/src/config/generatedConfigSchema.ts index b7487bd..cb08252 100644 --- a/src/config/generatedConfigSchema.ts +++ b/src/config/generatedConfigSchema.ts @@ -83,18 +83,6 @@ export const CONFIG_SCHEMA: Record<string, ConfigField> = { default: false, description: "Disables vkBasalt layer which can conflict with LSFG (Reshade, some Decky plugins)" }, - foobar_toggle: { - name: "foobar_toggle", - fieldType: ConfigFieldType.BOOLEAN, - default: false, - description: "Test script-only toggle that exports FOOBAR=1 (for testing purposes)" - }, - test_config_only: { - name: "test_config_only", - fieldType: ConfigFieldType.STRING, - default: "default_value", - description: "Test TOML-only configuration field (not in script)" - }, }; // Type-safe configuration data structure @@ -110,8 +98,6 @@ export interface ConfigurationData { disable_steamdeck_mode: boolean; mangohud_workaround: boolean; disable_vkbasalt: boolean; - foobar_toggle: boolean; - test_config_only: string; } // Helper functions @@ -132,8 +118,6 @@ export function getDefaults(): ConfigurationData { disable_steamdeck_mode: false, mangohud_workaround: false, disable_vkbasalt: false, - foobar_toggle: false, - test_config_only: "default_value", }; } @@ -150,8 +134,6 @@ export function getFieldTypes(): Record<string, ConfigFieldType> { disable_steamdeck_mode: ConfigFieldType.BOOLEAN, mangohud_workaround: ConfigFieldType.BOOLEAN, disable_vkbasalt: ConfigFieldType.BOOLEAN, - foobar_toggle: ConfigFieldType.BOOLEAN, - test_config_only: ConfigFieldType.STRING, }; } |
