diff --git a/src/gitingest/ingest_from_query.py b/src/gitingest/ingest_from_query.py index 2991b09..4e7d5e7 100644 --- a/src/gitingest/ingest_from_query.py +++ b/src/gitingest/ingest_from_query.py @@ -219,9 +219,21 @@ def create_file_content_string(files: List[Dict]) -> str: output = "" separator = "=" * 48 + "\n" + # First add README.md if it exists for file in files: if not file['content']: continue + if file['path'].lower() == '/readme.md': + output += separator + output += f"File: {file['path']}\n" + output += separator + output += f"{file['content']}\n\n" + break + + # Then add all other files in their original order + for file in files: + if not file['content'] or file['path'].lower() == '/readme.md': + continue output += separator output += f"File: {file['path']}\n" output += separator