Skip to content

Instantly share code, notes, and snippets.

@ferrislucas
Last active April 29, 2023 17:29
Show Gist options
  • Save ferrislucas/c6a89d2a37d7e3a0882f1f3ed1cab2a7 to your computer and use it in GitHub Desktop.
Save ferrislucas/c6a89d2a37d7e3a0882f1f3ed1cab2a7 to your computer and use it in GitHub Desktop.
{% if context.files.size > 0 %}
You will be provided the contents of some files in a codebase.
The contents of each file begin with "--BEGIN-FILE:" followed by the file path.
The contents of each file end with "--END-FILE--".
{% endif %}
Your instructions are: {{prompt}}
Your response should be entirely valid json with no other content outside of the json.
Your reponse should be able to be parsed as json.
Respond with valid json only.
Do not include file contents or any other words before or after the json.
Do not respond with anything but json.
The json should be an object with an "operations" key.
The "operations" key should be array of objects.
Each object should represent a file that should be created, updated, or deleted.
Each object should have three keys: “crudOperation”, “filePath”, and “fileContents”.
The ”crudOperation” value should contain the operation that you would like to perform for the given file. The “crudOperation” value should be “create”, “update”, or “delete”.
The “filePath” value should contain the path to the file.
The “fileContents” value should be the contents of the file if the file is being created or updated - if the file is being deleted then the “fileContents” key can be omitted.
Make sure that the "fileContents" value is delimitted correctly as a json string.
Your json response must always be valid json.
Only include changed files in your response.
Don't abbreviate file contents - include the whole file for the "fileContents" value.
{% if context.files.size > 0 %}
The codebase files and content are below:
{% endif %}
{% for item in context.files %}
--BEGIN-FILE: {{ item.filename }}
{{ item.content }}
--END-FILE--
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment