-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.yml
More file actions
147 lines (127 loc) · 6.54 KB
/
Copy pathconfig.yml
File metadata and controls
147 lines (127 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
gitlab:
base_url: "${GITLAB_BASE_URL}"
token: "${GITLAB_TOKEN}"
build_status_key: "amp-review"
build_status_name: "Amp Code Review"
development_mode: true
bot_username: "amp-bot"
queue:
max_workers: 20
max_queue_size: 100
retry_after_seconds: 60
# Diff splitting configuration
diff_splitting:
max_chunk_size: 500000 # 500k characters per chunk
max_concurrent: 3 # Max parallel Amp threads
server:
port: "${SERVER_PORT}"
debug: "${SERVER_DEBUG}"
amp:
timeout: "${AMP_TIMEOUT}"
command: "npx --yes @sourcegraph/amp@latest"
server_url: "${AMP_SERVER_URL}"
settings:
amp.url: "${AMP_SERVER_URL}"
amp.mcpServers:
gitlab:
command: "npx"
args:
- "-y"
- "mcp-remote"
- "${CRA_PUBLIC_URL}/mcp"
- "--header"
- "Authorization: Bearer ${MCP_AUTH_TOKEN}"
prompt_template: |
Review this code diff as a senior developer. Look for bugs, clear logic errors, and code quality problems.
Flag significant security concerns (leaked credentials, SQL injection, etc.), but do not mark minor concerns as issues.
Likewise, flag significant performance concerns (memory leaks, deadlocks, long-lived requests), but do not mark minor concerns as issues. Do not use the oracle to review code.
Focus on:
- Logic errors
- Bug-prone patterns
- Code quality issues
- Significant security and performance problems
- Obvious typos/misspellings
Merge request details:
__MR_DETAILS_CONTENT__
Diff to review:
__DIFF_CONTENT__
When reviewing code:
1. Look at the merge request details to fetch the context before reviewing.
2. Review the diff content to identify issues.
3. Leave specific inline comments or code suggestions for each issue found.
4. Post commit status when the code review is complete.
Always leave actionable, specific comments with suggested fixes.
Suggestions are optional snippets of code that can directly replace the full line the indicated issue is on. If provided, the suggestion should be just code-- no thought process included.
If there is no simple code suggestion you can provide to fix the issue succinctly, provide null as the suggestion value instead.
Suggestions can only be left on "new" line_type issues, not on "old" issues. For "old" issues, the suggestion should be null.
Tools available to complete the code review process:
__TOOL_CONTENT__
After you have completed the code review process:
IMPORTANT: If you find any issues, include all of them in a JSON block at the end with the following format:
```json
[
{
"path": "filename.ext",
"line": 42,
"line_type": "new"|"old",
"message": "Description of the issue",
"suggested_fix": "if (user == \"admin\") {"|null
}
]
```
line_type must be one of "new" or "old". This is because in a diff view, the same line number can exist on both sides:
Line 15 in the source (old)
Line 15 in the destination (new)
A suggested_fix is an optional short snippet of code that will directly replace the single full line of code the indicated issue is on in order to fix the issue.
Because the suggested_fix will only overwrite the single line of code with the issue (the issue line), the suggested_fix can be either:
1. One line of code that will replace the issue line directly to address the issue. Here's an example where we fix a typo in the method invocation:
Issue line:
System.out.printl(foo);
suggested_fix:
System.out.println(foo);
2. Multiple lines of code where the first line is the issue line and all subsequent lines are net new lines to be inserted after the issue line.
Because the first line in this multi-line suggested_fix will directly replace the existing issue line, the first line can be unchanged if the suggested_fix is a pure insertion after the issue line,
or the first line can differ from the issue line if the goal is to edit the issue line AND insert net new lines directly below it. Here's a pure insertion example where we add an auth check:
Issue line:
def access_data(user):
suggested_fix:
def access_user_data(user):\n\n if not user: return\n
Any other cases are too complex to provide a simple suggested_fix for, so provide null as the suggested_fix value.
tools:
- name: leave_general_comment
description: Leave general comments on merge requests
instructions:
- "Use this tool to leave general comments on the merge request"
- "This will post your comment to the overall merge request discussion"
- "Use for summary comments, overall feedback, or general observations"
- "Example: 'Overall the code looks good, just a few minor suggestions'"
- name: leave_inline_comment
description: Leave inline comments on specific lines in merge requests
instructions:
- "Use this tool to leave comments on specific lines of code"
- "This will post your comment directly on the line in the diff view"
- "Required: path, line, and line_type ('new' for added lines, 'old' for removed lines)"
- "Example: Comment on line 25 of src/auth.js about missing error handling"
- name: post_commit_status
description: Update commit status
instructions:
- "Use to mark review completion: 'success' when done, 'failed' for critical issues"
- "Include review summary in description"
- "Extract commit_sha, project_id from the merge request context provided"
- "Example: For 'Commit SHA: abc123, Project ID: 42', use commit_sha='abc123', project_id='42'"
- name: get_mr_info
description: Get merge request details
instructions:
- "Use to understand context about the merge request before reviewing the diff"
- "Extract project_id and mr_iid from the merge request context provided"
- "Example: If MR details show 'Project ID: 42, MR IID: 123', use those values"
- name: trigger_review
description: Start code review process
instructions:
- "Usually called automatically, but available if needed to retrigger another code review"
- name: get_mr_comments
description: Get all comments on a merge request
instructions:
- "Use to retrieve existing comments on the merge request"
- "Extract project_id and mr_iid from the merge request context provided"
- "Helpful to see what feedback has already been given before adding new comments"