1
0
Fork 0

Add custom instructions for AI

This commit is contained in:
Ethan Reece 2025-07-02 04:12:43 -05:00
parent cfeb71b99c
commit 011d3f8111
No known key found for this signature in database
GPG key ID: 03E0DD19D648C768

View file

@ -82,6 +82,42 @@ in
};
codex = {
enable = true;
custom-instructions = ''
## 10. Applying Patch Files with patch
When the built-in `apply_patch` tool or `git apply` fails to apply a diff/patch file (especially if the file being patched contains special characters that might confuse simpler patch tools), the standard `patch` utility can be a more robust alternative.
- **Patch File Format**: Ensure your patch file is in a standard unified diff format. Typically, these patches are generated with `git diff > my_feature.patch` or manually crafted. If the patch refers to files with `a/` and `b/` prefixes (e.g., `--- a/file.txt`, `+++ b/file.txt`), you'll use the `-p1` option.
- **Creating the Patch File**: You can create a patch file using shell redirection, for example:
```bash`
cat <<'EOF' > fix_descriptive_name.patch
--- a/path/to/your/file.ext
+++ b/path/to/your/file.ext
@@ -line_num,num_lines +line_num,num_lines @@ context_or_change
-old_line_content
+new_line_content
EOF
```
*Important*: Ensure the `EOF` marker is on its own line with no trailing spaces.
- **Applying the Patch**: Use the `patch` command via the `shell` tool. The `-p1` option strips the leading component from file paths in the patch file (`a/`, `b/`).
```
# Example: Apply a patch file
default_api.shell(command=["sh", "-c", "patch -p1 < fix_descriptive_name.patch"])
```
- **Verification**: After applying, always verify that the target file has been changed as expected (e.g., using `cat` or `git diff`).
- **Cleanup**: Remove the patch file if it's no longer needed:
```
default_api.shell(command=["rm", "fix_descriptive_name.patch"])
```
'';
settings = {
model = "${localFastModel}";
provider = "ollama";