Skip to content

Commit

Permalink
insert readme first
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzaghrane committed Dec 24, 2024
1 parent dafe508 commit 5cfe85f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/gitingest/ingest_from_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5cfe85f

Please sign in to comment.