# Data ```lua -- Notes: -- - input: This is the FileMeta (with .path, .name, .stem, .ext) for each file matching the -f glob. -- - file::load(input.path) will return a FileRecord, including .content for the file's content. -- - In Lua, to return a dictionary/object, use the notation `{ name = value, … }`. return { file = file::load(input.path) }; ``` # Instruction For the following markdown file: {{data.file.path}} ```{{data.file.ext}} {{data.file.content}} ``` - Correct the English of all comments if it is a codebase (do not correct the code). - Correct the English of all content if it is a Markdown file. - Preserve the whitespace (do not convert tabs to spaces and vice versa). - If English spelling and grammar are correct, do not change. - Return the corrected content without any explanation. # Output ```lua -- Note 1: LLMs often, but not always, return a code block for the result. -- The md::outer_block_content_or_raw function will extract the content between the first -- and last triple backticks or return ai_response if there are no triple backticks. -- This might be removed. -- Note 2: This could create problems sometimes if the content is markdown, and LLMs do not tend to return the 6 backticks. -- In those cases, instructing the LLMs not to put the result in markdown text can be an option. local content = utils.md.outer_block_content_or_raw(ai_response.content) -- Note: It is also nice to normalize files with a single ending empty line. content = text::ensure_single_ending_newline(content) -- Example of how to save to the same file utils.file.save(data.file.path, content) -- This will be printed by devai if it is a string return "File processed: " .. data.file.path ```