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.
16 lines
639 B
Python
16 lines
639 B
Python
"""Edit file content with search/replace."""
|
|
|
|
def edit_file(path: str, search: str, replace: str) -> str:
|
|
"""Replace text in a file."""
|
|
try:
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
content = f.read()
|
|
if search not in content:
|
|
return f"Error: '{search}' not found in {path}"
|
|
new_content = content.replace(search, replace)
|
|
with open(path, "w", encoding="utf-8") as f:
|
|
f.write(new_content)
|
|
return f"Successfully edited {path}"
|
|
except Exception as error: # pylint: disable=broad-exception-caught
|
|
return f"Error editing file {path}: {error}"
|