feat: change to diff workflow
This commit is contained in:
@@ -6,9 +6,7 @@ local ok_yaml, lyaml = pcall(require, "lyaml")
|
||||
local prompt_blocks = {
|
||||
["go-development"] = [[
|
||||
You are a coding assistant specialized in Go development.
|
||||
You will receive a project’s context and user instructions related to Go code,
|
||||
and you must return the requested modifications or guidance.
|
||||
When returning modifications, follow the specified YAML structure.
|
||||
You will receive a project’s context and user instructions related to Go code.
|
||||
Keep your suggestions aligned with Go best practices and idiomatic Go.
|
||||
]],
|
||||
["typo3-development"] = [[
|
||||
@@ -19,51 +17,36 @@ local prompt_blocks = {
|
||||
]],
|
||||
["rust-development"] = [[
|
||||
You are a coding assistant specialized in Rust development.
|
||||
You will receive a project’s context and user instructions related to Rust code,
|
||||
and you must return the requested modifications or guidance.
|
||||
When returning modifications, follow the specified YAML structure.
|
||||
Keep your suggestions aligned with Rust best practices and idiomatic Rust.
|
||||
You will receive a project’s context and user instructions related to Rust code.
|
||||
Keep your suggestions aligned with Rust best practices and idiomatic Rust.
|
||||
]],
|
||||
["basic-prompt"] = [[
|
||||
You are a coding assistant who receives a project's context and user instructions.
|
||||
The user will provide a prompt, and you will guide them through a workflow:
|
||||
1. First, you should analyse which files you need to solve the request.
|
||||
You can see which files are present in the provided project structure.
|
||||
Additionally if presented you could also ask for files of a library which is provided in for example composer.json.
|
||||
2. If file contents is needed provide a yaml which asks for the file contents.
|
||||
For example:
|
||||
project_name: example_project
|
||||
files:
|
||||
- path: "relative/path/to/file"
|
||||
3. If more information or context is needed, ask the user (outside of the YAML) to provide that.
|
||||
4. When all necessary information is gathered, provide the final YAML with the
|
||||
project's name and a list of files to be created or modified.
|
||||
Also explain the changes you made below the yaml.
|
||||
|
||||
The final YAML must have a top-level key named 'project_name' that matches the project's configured name,
|
||||
and a top-level key named 'files', which is a list of file changes. Each element in 'files' must be a mapping with:
|
||||
- 'path' for the file path relative to the project’s root directory.
|
||||
- either 'content' with a multiline string for new content, or 'delete: true' if the file should be deleted.
|
||||
Important: dont use comments in the code to explain which steps you have taken.
|
||||
Comments should just explain the code and not your thought process.
|
||||
You can explain your thought process outside of the YAML.
|
||||
|
||||
If more context is needed at any point before providing the final YAML, request it outside of the YAML.
|
||||
Additionally, it is forbidden to change any files which have not been requested or whose source code has not been provided.
|
||||
1. Analyse which files you need. Ask for file contents in YAML if needed.
|
||||
2. Request additional context outside YAML if necessary.
|
||||
3. When ready, provide final changes in YAML with:
|
||||
- 'project_name'
|
||||
- 'files', each having:
|
||||
* 'path'
|
||||
* 'diff' (for patching an existing file) OR 'content' (for a new file) OR 'delete'
|
||||
Important: do not provide entire file content for updates; instead provide a unified diff in 'diff'.
|
||||
Only modify or delete files whose contents you have explicitly requested and seen beforehand.
|
||||
]],
|
||||
["secure-coding"] = [[
|
||||
You are a coding assistant specialized in secure software development.
|
||||
As you generate code or provide guidance, you must consider the security impact of every decision.
|
||||
You will write and review code with a focus on minimizing vulnerabilities and following best security practices,
|
||||
such as validating all user inputs, avoiding unsafe libraries or functions, and following secure coding standards.
|
||||
Always consider security impacts. Use diffs for updates, new content for new files,
|
||||
and 'delete: true' for removals.
|
||||
]],
|
||||
["workflow-prompt"] = [[
|
||||
You are a coding assistant focusing on making the Neovim ChatGPT workflow straightforward and user-friendly.
|
||||
Provide a concise set of steps or guidance, reminding the user:
|
||||
- How to list needed files for further context
|
||||
- How to request additional information outside of the YAML
|
||||
- How to finalize changes with a YAML response containing project_name and files
|
||||
Always ensure that prompts and explanations remain clear and minimal, reducing user errors.
|
||||
Remind the user to:
|
||||
- List needed files for further context
|
||||
- Request additional information outside YAML if needed
|
||||
- Provide final changes in YAML with 'project_name' and 'files', using:
|
||||
* 'diff' for existing file modifications
|
||||
* 'content' for new files
|
||||
* 'delete: true' for file deletions
|
||||
]]
|
||||
}
|
||||
|
||||
@@ -103,7 +86,6 @@ function M.load()
|
||||
initial_prompt = "",
|
||||
directories = { "." },
|
||||
default_prompt_blocks = {},
|
||||
-- Changed default from 128000 to 16384 as requested
|
||||
token_limit = 16384,
|
||||
project_name = "",
|
||||
debug = false,
|
||||
@@ -113,7 +95,6 @@ function M.load()
|
||||
partial_acceptance = false,
|
||||
improved_debug = false,
|
||||
enable_chunking = false,
|
||||
-- New default for step-by-step
|
||||
enable_step_by_step = true,
|
||||
enable_debug_commands = false
|
||||
}
|
||||
@@ -161,7 +142,6 @@ function M.load()
|
||||
if type(result.enable_chunking) == "boolean" then
|
||||
config.enable_chunking = result.enable_chunking
|
||||
end
|
||||
-- Added logic to load enable_step_by_step from user config
|
||||
if type(result.enable_step_by_step) == "boolean" then
|
||||
config.enable_step_by_step = result.enable_step_by_step
|
||||
end
|
||||
@@ -174,7 +154,6 @@ function M.load()
|
||||
config.initial_prompt = "You are a coding assistant who receives a project's context and user instructions..."
|
||||
end
|
||||
|
||||
-- Merge the default prompt blocks with the config's initial prompt
|
||||
if type(config.default_prompt_blocks) == "table" and #config.default_prompt_blocks > 0 then
|
||||
local merged_prompt = {}
|
||||
for _, block_name in ipairs(config.default_prompt_blocks) do
|
||||
|
||||
Reference in New Issue
Block a user