feat: adding lua linter
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
local M = {}
|
||||
|
||||
M.description = [[Executes a bash command in a shell.
|
||||
|
||||
IMPORTANT RULES:
|
||||
|
||||
@@ -3,64 +3,63 @@ local M = {}
|
||||
|
||||
--- Bash approval dialog strings
|
||||
M.bash_approval = {
|
||||
title = " BASH COMMAND APPROVAL",
|
||||
divider = " " .. string.rep("─", 56),
|
||||
command_label = " Command:",
|
||||
warning_prefix = " ⚠️ WARNING: ",
|
||||
options = {
|
||||
" [y] Allow once - Execute this command",
|
||||
" [s] Allow this session - Auto-allow until restart",
|
||||
" [a] Add to allow list - Always allow this command",
|
||||
" [n] Reject - Cancel execution",
|
||||
},
|
||||
cancel_hint = " Press key to choose | [q] or [Esc] to cancel",
|
||||
title = " BASH COMMAND APPROVAL",
|
||||
divider = " " .. string.rep("─", 56),
|
||||
command_label = " Command:",
|
||||
warning_prefix = " ⚠️ WARNING: ",
|
||||
options = {
|
||||
" [y] Allow once - Execute this command",
|
||||
" [s] Allow this session - Auto-allow until restart",
|
||||
" [a] Add to allow list - Always allow this command",
|
||||
" [n] Reject - Cancel execution",
|
||||
},
|
||||
cancel_hint = " Press key to choose | [q] or [Esc] to cancel",
|
||||
}
|
||||
|
||||
--- Diff view help message
|
||||
M.diff_help = {
|
||||
{ "Diff: ", "Normal" },
|
||||
{ "{path}", "Directory" },
|
||||
{ " | ", "Normal" },
|
||||
{ "y/<CR>", "Keyword" },
|
||||
{ " approve ", "Normal" },
|
||||
{ "n/q/<Esc>", "Keyword" },
|
||||
{ " reject ", "Normal" },
|
||||
{ "<Tab>", "Keyword" },
|
||||
{ " switch panes", "Normal" },
|
||||
{ "Diff: ", "Normal" },
|
||||
{ "{path}", "Directory" },
|
||||
{ " | ", "Normal" },
|
||||
{ "y/<CR>", "Keyword" },
|
||||
{ " approve ", "Normal" },
|
||||
{ "n/q/<Esc>", "Keyword" },
|
||||
{ " reject ", "Normal" },
|
||||
{ "<Tab>", "Keyword" },
|
||||
{ " switch panes", "Normal" },
|
||||
}
|
||||
|
||||
|
||||
--- Review UI interface strings
|
||||
M.review = {
|
||||
diff_header = {
|
||||
top = "╭─ %s %s %s ─────────────────────────────────────",
|
||||
path = "│ %s",
|
||||
op = "│ Operation: %s",
|
||||
status = "│ Status: %s",
|
||||
bottom = "╰────────────────────────────────────────────────────",
|
||||
},
|
||||
list_menu = {
|
||||
top = "╭─ Changes (%s) ──────────╮",
|
||||
items = {
|
||||
"│ │",
|
||||
"│ j/k: navigate │",
|
||||
"│ Enter: view diff │",
|
||||
"│ a: approve r: reject │",
|
||||
"│ A: approve all │",
|
||||
"│ q: close │",
|
||||
},
|
||||
bottom = "╰──────────────────────────────╯",
|
||||
},
|
||||
status = {
|
||||
applied = "Applied",
|
||||
approved = "Approved",
|
||||
pending = "Pending",
|
||||
},
|
||||
messages = {
|
||||
no_changes = " No changes to review",
|
||||
no_changes_short = "No changes to review",
|
||||
applied_count = "Applied %d change(s)",
|
||||
},
|
||||
diff_header = {
|
||||
top = "╭─ %s %s %s ─────────────────────────────────────",
|
||||
path = "│ %s",
|
||||
op = "│ Operation: %s",
|
||||
status = "│ Status: %s",
|
||||
bottom = "╰────────────────────────────────────────────────────",
|
||||
},
|
||||
list_menu = {
|
||||
top = "╭─ Changes (%s) ──────────╮",
|
||||
items = {
|
||||
"│ │",
|
||||
"│ j/k: navigate │",
|
||||
"│ Enter: view diff │",
|
||||
"│ a: approve r: reject │",
|
||||
"│ A: approve all │",
|
||||
"│ q: close │",
|
||||
},
|
||||
bottom = "╰──────────────────────────────╯",
|
||||
},
|
||||
status = {
|
||||
applied = "Applied",
|
||||
approved = "Approved",
|
||||
pending = "Pending",
|
||||
},
|
||||
messages = {
|
||||
no_changes = " No changes to review",
|
||||
no_changes_short = "No changes to review",
|
||||
applied_count = "Applied %d change(s)",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local M = {}
|
||||
|
||||
M.description = [[Makes a targeted edit to a file by replacing text.
|
||||
|
||||
The old_string should match the content you want to replace. The tool uses multiple
|
||||
|
||||
@@ -1,41 +1,43 @@
|
||||
local M = {}
|
||||
|
||||
M.params = {
|
||||
{
|
||||
name = "pattern",
|
||||
description = "Regular expression pattern to search for",
|
||||
type = "string",
|
||||
},
|
||||
{
|
||||
name = "path",
|
||||
description = "Directory or file to search in (default: project root)",
|
||||
type = "string",
|
||||
optional = true,
|
||||
},
|
||||
{
|
||||
name = "include",
|
||||
description = "File glob pattern to include (e.g., '*.lua')",
|
||||
type = "string",
|
||||
optional = true,
|
||||
},
|
||||
{
|
||||
name = "max_results",
|
||||
description = "Maximum number of results (default: 50)",
|
||||
type = "integer",
|
||||
optional = true,
|
||||
},
|
||||
{
|
||||
name = "pattern",
|
||||
description = "Regular expression pattern to search for",
|
||||
type = "string",
|
||||
},
|
||||
{
|
||||
name = "path",
|
||||
description = "Directory or file to search in (default: project root)",
|
||||
type = "string",
|
||||
optional = true,
|
||||
},
|
||||
{
|
||||
name = "include",
|
||||
description = "File glob pattern to include (e.g., '*.lua')",
|
||||
type = "string",
|
||||
optional = true,
|
||||
},
|
||||
{
|
||||
name = "max_results",
|
||||
description = "Maximum number of results (default: 50)",
|
||||
type = "integer",
|
||||
optional = true,
|
||||
},
|
||||
}
|
||||
|
||||
M.returns = {
|
||||
{
|
||||
name = "matches",
|
||||
description = "JSON array of matches with file, line_number, and content",
|
||||
type = "string",
|
||||
},
|
||||
{
|
||||
name = "error",
|
||||
description = "Error message if search failed",
|
||||
type = "string",
|
||||
optional = true,
|
||||
},
|
||||
{
|
||||
name = "matches",
|
||||
description = "JSON array of matches with file, line_number, and content",
|
||||
type = "string",
|
||||
},
|
||||
{
|
||||
name = "error",
|
||||
description = "Error message if search failed",
|
||||
type = "string",
|
||||
optional = true,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -23,7 +23,7 @@ end
|
||||
|
||||
--- System prompt for agent mode
|
||||
M.system =
|
||||
[[You are an expert AI coding assistant integrated into Neovim. You MUST use the provided tools to accomplish tasks.
|
||||
[[You are an expert AI coding assistant integrated into Neovim. You MUST use the provided tools to accomplish tasks.
|
||||
|
||||
## CRITICAL: YOU MUST USE TOOLS
|
||||
|
||||
|
||||
@@ -2,48 +2,48 @@
|
||||
local M = {}
|
||||
|
||||
M.modifiers = {
|
||||
complete = [[
|
||||
complete = [[
|
||||
You are completing an incomplete function.
|
||||
Return the complete function with all missing parts filled in.
|
||||
Keep the existing signature unless changes are required.
|
||||
Output only the code, no explanations.]],
|
||||
|
||||
refactor = [[
|
||||
refactor = [[
|
||||
You are refactoring existing code.
|
||||
Improve the code structure while maintaining the same behavior.
|
||||
Keep the function signature unchanged.
|
||||
Output only the refactored code, no explanations.]],
|
||||
|
||||
fix = [[
|
||||
fix = [[
|
||||
You are fixing a bug in the code.
|
||||
Identify and correct the issue while minimizing changes.
|
||||
Preserve the original intent of the code.
|
||||
Output only the fixed code, no explanations.]],
|
||||
|
||||
add = [[
|
||||
add = [[
|
||||
You are adding new code.
|
||||
Follow the existing code style and conventions.
|
||||
Output only the new code to be inserted, no explanations.]],
|
||||
|
||||
document = [[
|
||||
document = [[
|
||||
You are adding documentation to the code.
|
||||
Add appropriate comments/docstrings for the function.
|
||||
Include parameter types, return types, and description.
|
||||
Output the complete function with documentation.]],
|
||||
|
||||
test = [[
|
||||
test = [[
|
||||
You are generating tests for the code.
|
||||
Create comprehensive unit tests covering edge cases.
|
||||
Follow the testing conventions of the project.
|
||||
Output only the test code, no explanations.]],
|
||||
|
||||
optimize = [[
|
||||
optimize = [[
|
||||
You are optimizing code for performance.
|
||||
Improve efficiency while maintaining correctness.
|
||||
Document any significant algorithmic changes.
|
||||
Output only the optimized code, no explanations.]],
|
||||
|
||||
explain = [[
|
||||
explain = [[
|
||||
You are documenting code by adding documentation comments above it.
|
||||
Generate ONLY the documentation comment block (using the correct comment syntax for the file's language).
|
||||
Include: a brief description of what the code does, parameter types and descriptions, return type and description, and any important notes about edge cases or side effects.
|
||||
|
||||
@@ -20,32 +20,6 @@ When you need to perform a task:
|
||||
Always explain your reasoning before using tools.
|
||||
When you're done, provide a clear summary of what was accomplished.]]
|
||||
|
||||
M.dispatch_prompt = [[You are a research assistant. Your task is to find information and report back.
|
||||
You have access to: view (read files), grep (search content), glob (find files).
|
||||
Be thorough and report your findings clearly.]]
|
||||
|
||||
### File Operations
|
||||
- **read_file**: Read any file. Parameters: path (string)
|
||||
- **write_file**: Create or overwrite files. Parameters: path (string), content (string)
|
||||
- **edit_file**: Modify existing files. Parameters: path (string), find (string), replace (string)
|
||||
- **list_directory**: List files and directories. Parameters: path (string, optional), recursive (boolean, optional)
|
||||
- **search_files**: Find files. Parameters: pattern (string), content (string), path (string)
|
||||
- **delete_file**: Delete a file. Parameters: path (string), reason (string)
|
||||
|
||||
### Shell Commands
|
||||
- **bash**: Run shell commands. Parameters: command (string)
|
||||
|
||||
## WORKFLOW
|
||||
|
||||
1. **Analyze**: Understand the user's request.
|
||||
2. **Explore**: Use `list_directory`, `search_files`, or `read_file` to find relevant files.
|
||||
3. **Plan**: Think about what needs to be changed.
|
||||
4. **Execute**: Use `edit_file`, `write_file`, or `bash` to apply changes.
|
||||
5. **Verify**: You can check files after editing.
|
||||
|
||||
Always verify context before making changes.
|
||||
]]
|
||||
|
||||
M.dispatch_prompt = [[
|
||||
You are a research assistant. Your job is to explore the codebase and answer the user's question or find specific information.
|
||||
You have access to: view (read files), grep (search content), glob (find files).
|
||||
|
||||
@@ -3,12 +3,12 @@ local M = {}
|
||||
|
||||
--- Modal UI strings
|
||||
M.ui = {
|
||||
files_header = { "", "-- No files detected in LLM response --" },
|
||||
llm_response_header = "-- LLM Response: --",
|
||||
suggested_commands_header = "-- Suggested commands: --",
|
||||
commands_hint = "-- Press <leader><n> to run a command, or <leader>r to run all --",
|
||||
input_header = "-- Enter additional context below (Ctrl-Enter to submit, Esc to cancel) --",
|
||||
project_inspect_header = { "", "-- Project inspection results --" },
|
||||
files_header = { "", "-- No files detected in LLM response --" },
|
||||
llm_response_header = "-- LLM Response: --",
|
||||
suggested_commands_header = "-- Suggested commands: --",
|
||||
commands_hint = "-- Press <leader><n> to run a command, or <leader>r to run all --",
|
||||
input_header = "-- Enter additional context below (Ctrl-Enter to submit, Esc to cancel) --",
|
||||
project_inspect_header = { "", "-- Project inspection results --" },
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
local M = {}
|
||||
|
||||
M.builtin = {
|
||||
coder = {
|
||||
name = "coder",
|
||||
description = "Full-featured coding agent with file modification capabilities",
|
||||
system_prompt = [[You are an expert software engineer. You have access to tools to read, write, and modify files.
|
||||
coder = {
|
||||
name = "coder",
|
||||
description = "Full-featured coding agent with file modification capabilities",
|
||||
system_prompt = [[You are an expert software engineer. You have access to tools to read, write, and modify files.
|
||||
|
||||
## Your Capabilities
|
||||
- Read files to understand the codebase
|
||||
@@ -26,12 +26,12 @@ M.builtin = {
|
||||
- Make precise edits using exact string matching
|
||||
- Explain your reasoning before making changes
|
||||
- If unsure, ask for clarification]],
|
||||
tools = { "view", "edit", "write", "grep", "glob", "bash" },
|
||||
},
|
||||
planner = {
|
||||
name = "planner",
|
||||
description = "Planning agent - read-only, helps design implementations",
|
||||
system_prompt = [[You are a software architect. Analyze codebases and create implementation plans.
|
||||
tools = { "view", "edit", "write", "grep", "glob", "bash" },
|
||||
},
|
||||
planner = {
|
||||
name = "planner",
|
||||
description = "Planning agent - read-only, helps design implementations",
|
||||
system_prompt = [[You are a software architect. Analyze codebases and create implementation plans.
|
||||
|
||||
You can read files and search the codebase, but cannot modify files.
|
||||
Your role is to:
|
||||
@@ -41,18 +41,18 @@ Your role is to:
|
||||
4. Suggest which files to modify and how
|
||||
|
||||
Be thorough in your analysis before making recommendations.]],
|
||||
tools = { "view", "grep", "glob" },
|
||||
},
|
||||
explorer = {
|
||||
name = "explorer",
|
||||
description = "Exploration agent - quickly find information in codebase",
|
||||
system_prompt = [[You are a codebase exploration assistant. Find information quickly and report back.
|
||||
tools = { "view", "grep", "glob" },
|
||||
},
|
||||
explorer = {
|
||||
name = "explorer",
|
||||
description = "Exploration agent - quickly find information in codebase",
|
||||
system_prompt = [[You are a codebase exploration assistant. Find information quickly and report back.
|
||||
|
||||
Your goal is to efficiently search and summarize findings.
|
||||
Use glob to find files, grep to search content, and view to read specific files.
|
||||
Be concise and focused in your responses.]],
|
||||
tools = { "view", "grep", "glob" },
|
||||
},
|
||||
tools = { "view", "grep", "glob" },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
local M = {}
|
||||
|
||||
M.instructions = {
|
||||
intro = "You have access to the following tools. To use a tool, respond with a JSON block.",
|
||||
header = "To call a tool, output a JSON block like this:",
|
||||
example = [[
|
||||
intro = "You have access to the following tools. To use a tool, respond with a JSON block.",
|
||||
header = "To call a tool, output a JSON block like this:",
|
||||
example = [[
|
||||
```json
|
||||
{"tool": "tool_name", "parameters": {"param1": "value1"}}
|
||||
```
|
||||
]],
|
||||
footer = [[
|
||||
footer = [[
|
||||
After receiving tool results, continue your response or call another tool.
|
||||
When you're done, just respond normally without any tool calls.
|
||||
]],
|
||||
|
||||
@@ -8,4 +8,4 @@ Usage notes:
|
||||
- If content is truncated, use line ranges to read in chunks
|
||||
- Returns JSON with content, total_line_count, and is_truncated]]
|
||||
|
||||
return M
|
||||
return M
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local M = {}
|
||||
|
||||
M.description = [[Creates or overwrites a file with new content.
|
||||
|
||||
IMPORTANT:
|
||||
|
||||
Reference in New Issue
Block a user