Skip to content

Commit b315d52

Browse files
authored
Insert readme first (#46)
1 parent fe02f66 commit b315d52

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/gitingest/ingest_from_query.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,21 @@ def create_file_content_string(files: List[Dict]) -> str:
219219
output = ""
220220
separator = "=" * 48 + "\n"
221221

222+
# First add README.md if it exists
222223
for file in files:
223224
if not file['content']:
224225
continue
226+
if file['path'].lower() == '/readme.md':
227+
output += separator
228+
output += f"File: {file['path']}\n"
229+
output += separator
230+
output += f"{file['content']}\n\n"
231+
break
232+
233+
# Then add all other files in their original order
234+
for file in files:
235+
if not file['content'] or file['path'].lower() == '/readme.md':
236+
continue
225237
output += separator
226238
output += f"File: {file['path']}\n"
227239
output += separator

0 commit comments

Comments
 (0)