Skip to content

refactor: detach the file writing logic from the readme building #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions readmeai/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ def readme_agent(config: ConfigLoader, output_file: str) -> None:

async def readme_generator(config: ConfigLoader, output_file: str) -> None:
"""Processes the repository and builds the README file."""
section_contents = await get_readme(config)

FileHandler().write(output_file, section_contents)

log_process_completion(output_file)


async def get_readme(config: ConfigLoader) -> str:
with tempfile.TemporaryDirectory() as tmp_dir:
repo_path = await load_data(config.config.git.repository, tmp_dir)
processor: RepositoryAnalyzer = RepositoryAnalyzer(config=config)
Expand Down Expand Up @@ -84,11 +92,7 @@ async def readme_generator(config: ConfigLoader, output_file: str) -> None:
if config.config.md.logo in [None, "", DefaultLogos, CustomLogos]:
config.config.md.logo = DefaultLogos.PURPLE.value

section_contents = MarkdownBuilder(config, context, summaries, tmp_dir).build()

FileHandler().write(output_file, section_contents)

log_process_completion(output_file)
return MarkdownBuilder(config, context, summaries, tmp_dir).build()


async def generate_image(config: ConfigLoader) -> None:
Expand Down