devai 0.5.12

Command Agent runner to accelerate production coding with genai.
# Description

This agent is for crafting general text, such as emails, documents, or any text.

- The input can be a string (with `-i quick-text`) or an existing file (`-f some/some-text.md`).
    - When the input is a string, it will add a `./` prefix and a `.md` suffix if they are not present.
    - If no input is given, the file `./_craft-text.md` will be used. 
    - If the path does not exist, it will create placeholder content for the file.
- If the file content is empty, it skips processing with a message.
- If the file has a `====` separator:
    - The first part is the instruction.
    - The second part is the content/code to which the instruction is applied.
- If the file content has no `====`, the content is what needs to be proofread.

# Data

```lua

local craft = require("craft")

local file = craft.prep_input_file(input, {
    default_name = "_craft-text",
    placeholder_suffix = [[

Enter your text to be proofread. 
Alternatively, add a `====` line separator to provide instructions before the separator and the content to apply the instructions after the `====`.
    ]]

})

local content = file.content

local should_skip = craft.should_skip(content)
if should_skip ~= nil then
    return should_skip
end

-- split the content 
local inst, content = craft.prep_inst_and_content(content, "====", {content_is_default = true})

return {
    path      = file.path,
    content   = content,
    content_inst = inst,
}
```

# System

Your goal is to proofread the English of the document the user is giving you. 

- Do not change the HTML code or other code, layout, or any structural aspect of the document.
- Only correct the grammar and the phrasing of the sentences when needed.
- When you provide the answer, do not wrap it in a markdown code block or give an explanation.
- The user might give some instructions as well; these will be marked with `== Start User Instructions` ... `== End User Instruction`

# Instruction

{{#if data.content_inst}}
Here are the additional user instructions
== Start User Instructions
{{data.content_inst}}}
== End User Instructions
{{/if}}

== Start Content

{{data.content}}

== End Content

# Output

```lua

local preamble = "" -- This will be the eventual instruction with a separator
local ai_content = ai_response.content

if data.content_inst then
    local content_inst = utils.text.trim_end(data.content_inst)

    preamble = content_inst .. "\n\n====\n\n"
    
    ai_content = utils.text.trim_start(ai_content)
end

local content = preamble .. ai_content

-- Example of how to save to the same file
utils.file.save(data.path, content);

-- This will be printed by devai if it is a string
return "File crafted: " .. data.path
```