Skip to content

Commit 22d5c39

Browse files
committed
feat(DocsGenerator): add check for index file freshness against component sources
1 parent 1c289ee commit 22d5c39

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tools/LlmsDocsGenerator/DocsGenerator.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,20 @@ public async Task<bool> CheckAsync()
136136
return false;
137137
}
138138

139+
var indexLastWrite = File.GetLastWriteTimeUtc(indexPath);
140+
141+
// compute the most recent component source timestamp:
142+
var newestComponentWrite = components
143+
.SelectMany(c => c.SourceFiles)
144+
.Select(File.GetLastWriteTimeUtc)
145+
.DefaultIfEmpty(indexLastWrite)
146+
.Max();
147+
148+
if (indexLastWrite < newestComponentWrite)
149+
{
150+
Console.WriteLine("Index file is stale relative to component sources. Please regenerate docs.");
151+
return false;
152+
}
139153
// Check each category file
140154
foreach (var category in categorized)
141155
{

0 commit comments

Comments
 (0)