MCPcopy Create free account
hub / github.com/AutoForgeAI/autoforge / _save_config

Function _save_config

server/services/project_config.py:145–169  ·  view source on GitHub ↗

Save the project configuration to disk. Creates the .autoforge directory if it doesn't exist. Args: project_dir: Path to the project directory. config: Configuration dictionary to save. Raises: OSError: If the file cannot be written.

(project_dir: Path, config: dict)

Source from the content-addressed store, hash-verified

143
144
145def _save_config(project_dir: Path, config: dict) -> None:
146 """
147 Save the project configuration to disk.
148
149 Creates the .autoforge directory if it doesn't exist.
150
151 Args:
152 project_dir: Path to the project directory.
153 config: Configuration dictionary to save.
154
155 Raises:
156 OSError: If the file cannot be written.
157 """
158 config_path = _get_config_path(project_dir)
159
160 # Ensure the .autoforge directory exists
161 config_path.parent.mkdir(parents=True, exist_ok=True)
162
163 try:
164 with open(config_path, "w", encoding="utf-8") as f:
165 json.dump(config, f, indent=2)
166 logger.debug("Saved config to %s", config_path)
167 except OSError as e:
168 logger.error("Failed to save config to %s: %s", config_path, e)
169 raise
170
171
172# =============================================================================

Callers 2

set_dev_commandFunction · 0.85
clear_dev_commandFunction · 0.85

Calls 1

_get_config_pathFunction · 0.85

Tested by

no test coverage detected