devai 0.5.12

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

This agent is responsible for crafting programming code.

- The input can be a string (with `-i quick-code`) or a file path (`-f some/path.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-code.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 the instruction to create some code.

# Data

```lua

local craft = require("craft")

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

Ask your coding question to generate code below the `====`
And (optionally) add the code below the `====` as a starting point
    ]],
    add_separator = true

})

-- Split the content 
local inst, content = craft.prep_inst_and_content(file.content, "====", {content_is_default = false})

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

-- Return the processed data
return {
    path          = file.path,
    content_code  = content,
    content_inst  = inst,
}
```

# System

You are a professional coder who answers the coding questions of the user.

- When providing code, ensure it is enclosed in a markdown code block with the appropriate language of the block content.
- If the user does not specify the language and the language cannot be inferred from the given content, then assume it is about Rust programming.
- If the content given is in a certain language, keep that as the language of the question. 
- The user might provide some instructions as well, marked with `== Start User Instructions` ... `== End User Instructions`.
- Only return the code within the markdown code block.
- Do not give an explanation or preamble or prefix if the user did not ask for it. 

# Instruction

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

{{#if data.content_code}}
Here is the content to which you should apply the user instructions: 

== Start Content
{{data.content_code}}
== End Content
{{/if}}

# Output

```lua

local preamble = "" -- This will be the eventual instruction with 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 craft: " .. data.path
```