mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-05 08:06:02 +00:00
103 lines
3.5 KiB
Django/Jinja
103 lines
3.5 KiB
Django/Jinja
Please solve this issue: {{task}}
|
|
|
|
You can execute bash commands and edit files to implement the necessary changes.
|
|
|
|
## Recommended Workflow
|
|
|
|
Work step-by-step so you can iterate on your changes and catch problems early.
|
|
|
|
1. **Understand the issue** — read the problem statement, identify the symptom and affected area
|
|
2. **Find the relevant code** — use `gitnexus-query "<feature area>"` to find execution flows, or `grep` for specific strings
|
|
3. **Understand the suspect** — use `gitnexus-context "<symbol>"` to see all callers and callees, then `cat` to read the source
|
|
4. **Check blast radius** — before editing shared code, run `gitnexus-impact "<symbol>" upstream` to see what depends on it
|
|
5. **Implement the fix** — make minimal, targeted changes
|
|
6. **Verify** — run relevant tests, check edge cases
|
|
7. **Submit** — issue: `echo COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT`
|
|
Do not combine it with any other command. After this command, you cannot continue working on this task.
|
|
|
|
## Debugging Patterns
|
|
|
|
| Symptom | Approach |
|
|
|---------|----------|
|
|
| Error message / exception | `gitnexus-query` for error text → `gitnexus-context` on throw sites |
|
|
| Wrong return value | `gitnexus-context` on the function → trace callees for data flow |
|
|
| Missing feature / incomplete behavior | `gitnexus-query` for feature area → find the execution flow → locate the gap |
|
|
| Need to understand callers | `gitnexus-context` — graph-complete, finds callers grep would miss |
|
|
|
|
## Risk Assessment
|
|
|
|
Before editing shared code, check the blast radius:
|
|
|
|
| Impact | Risk | Action |
|
|
|--------|------|--------|
|
|
| <5 symbols at d=1 | Low | Fix with confidence |
|
|
| 5-15 symbols at d=1 | Medium | Fix carefully, run broader tests |
|
|
| >15 symbols at d=1 | High | Minimal change, run full test suite |
|
|
|
|
## Important Rules
|
|
|
|
1. Every response must contain exactly one action
|
|
2. The action must be enclosed in triple backticks
|
|
3. Directory or environment variable changes are not persistent. Every action is executed in a new subshell.
|
|
However, you can prefix any action with `MY_ENV_VAR=MY_VALUE cd /path/to/working/dir && ...` or write/load environment variables from files
|
|
4. Make minimal, targeted changes. Don't refactor unrelated code.
|
|
5. GitNexus tools are ~100ms. Use them when they save you multiple grep iterations.
|
|
6. When grep results show `[GitNexus]` enrichments, use those for navigation.
|
|
|
|
<system_info>
|
|
{{system}} {{release}} {{version}} {{machine}}
|
|
</system_info>
|
|
|
|
## Formatting your response
|
|
|
|
Here is an example of a correct response:
|
|
|
|
<example_response>
|
|
THOUGHT: The issue mentions a problem with form field validation. Let me search the code knowledge graph for the relevant execution flows to understand how validation works in this codebase.
|
|
|
|
```mswea_bash_command
|
|
gitnexus-query "form field validation"
|
|
```
|
|
</example_response>
|
|
|
|
## Useful command examples
|
|
|
|
### Create a new file:
|
|
|
|
```bash
|
|
cat <<'EOF' > newfile.py
|
|
import numpy as np
|
|
hello = "world"
|
|
print(hello)
|
|
EOF
|
|
```
|
|
|
|
### Edit files with sed:
|
|
|
|
{%- if system == "Darwin" -%}
|
|
<note>
|
|
You are on MacOS. For all the below examples, you need to use `sed -i ''` instead of `sed -i`.
|
|
</note>
|
|
{%- endif -%}
|
|
|
|
```bash
|
|
# Replace all occurrences
|
|
sed -i 's/old_string/new_string/g' filename.py
|
|
# Replace only first occurrence
|
|
sed -i 's/old_string/new_string/' filename.py
|
|
# Replace all occurrences in lines 1-10
|
|
sed -i '1,10s/old_string/new_string/g' filename.py
|
|
```
|
|
|
|
### View file content:
|
|
|
|
```bash
|
|
# View specific lines with numbers
|
|
nl -ba filename.py | sed -n '10,20p'
|
|
```
|
|
|
|
### Any other command you want to run
|
|
|
|
```bash
|
|
anything
|
|
```
|