@@ -45,25 +45,27 @@ public class LlmMarkdownExporter : IMarkdownExporter
4545
4646 public ValueTask StopAsync ( Cancel ctx = default ) => ValueTask . CompletedTask ;
4747
48- public ValueTask < bool > FinishExportAsync ( IDirectoryInfo outputFolder , Cancel ctx )
48+ public async ValueTask < bool > FinishExportAsync ( IDirectoryInfo outputFolder , Cancel ctx )
4949 {
5050 var outputDirectory = Path . Combine ( outputFolder . FullName , "docs" ) ;
5151 var zipPath = Path . Combine ( outputDirectory , "llm.zip" ) ;
52- using ( var zip = ZipFile . Open ( zipPath , ZipArchiveMode . Create ) )
53- {
54- var llmsTxt = Path . Combine ( outputDirectory , "llms.txt" ) ;
55- var llmsTxtRelativePath = Path . GetRelativePath ( outputDirectory , llmsTxt ) ;
56- _ = zip . CreateEntryFromFile ( llmsTxt , llmsTxtRelativePath ) ;
5752
58- var markdownFiles = Directory . GetFiles ( outputDirectory , "*.md" , SearchOption . AllDirectories ) ;
53+ // Create the llms.txt file with boilerplate content
54+ var llmsTxt = Path . Combine ( outputDirectory , "llms.txt" ) ;
55+ await outputFolder . FileSystem . File . WriteAllTextAsync ( llmsTxt , LlmsTxtTemplate , ctx ) ;
56+
57+ using var zip = ZipFile . Open ( zipPath , ZipArchiveMode . Create ) ;
58+ var llmsTxtRelativePath = Path . GetRelativePath ( outputDirectory , llmsTxt ) ;
59+ _ = zip . CreateEntryFromFile ( llmsTxt , llmsTxtRelativePath ) ;
60+
61+ var markdownFiles = Directory . GetFiles ( outputDirectory , "*.md" , SearchOption . AllDirectories ) ;
5962
60- foreach ( var file in markdownFiles )
61- {
62- var relativePath = Path . GetRelativePath ( outputDirectory , file ) ;
63- _ = zip . CreateEntryFromFile ( file , relativePath ) ;
64- }
63+ foreach ( var file in markdownFiles )
64+ {
65+ var relativePath = Path . GetRelativePath ( outputDirectory , file ) ;
66+ _ = zip . CreateEntryFromFile ( file , relativePath ) ;
6567 }
66- return ValueTask . FromResult ( true ) ;
68+ return true ;
6769 }
6870
6971 public async ValueTask < bool > ExportAsync ( MarkdownExportFileContext fileContext , Cancel ctx )
0 commit comments