// Build optional guidelines text (added as a separate section with a clear delimiter)
guidelinesText:=""
iflen(s.guidelines)>0{
guidelinesText="Project guidelines:\n"
// Two newlines ensure the guidelines start on a fresh paragraph.
guidelinesText="\n\nProject guidelines:\n"
for_,g:=ranges.guidelines{
guidelinesText+="- "+g+"\n"
}
}
// System prompt that instructs the LLM precisely.
baseSystem:=strings.TrimSpace(`
You are a very strict senior software architect.
You review **only** newly added or modified lines in a unified diff, together with the immediate hunk context.
You do **not** report issues that appear **solely** in deleted lines (“-") or that have already been fixed by the change.
No comments are made on pure formatting/whitespace changes or reordering that does not alter the program’s behavior.`)+guidelinesText
You are a strict senior software architect.
Only comment on newly added or modified lines in the diff; ignore deletions, pure formatting, or re‑ordering that does not change behavior.
For each issue output a JSON object with fields "file", "line", and "message" (message should be concise, ≤2 sentences, and actionable).
If project guidelines are provided, treat them as hard rules that must be respected.`)+guidelinesText
fori,chunk:=rangechunks{
// Add a small header so the model knows this is a fragment
header:=fmt.Sprintf("\n--- Chunk %d of %d ---\n",i+1,len(chunks))
userContent:=fmt.Sprintf("Hello please review my PR. Write comments where improvements are necessary in new lines.%s\nHere is the git diff of it: %s",header,chunk)
// Include the chunk identifier in the system message only if there are multiple chunks.
systemContent:=baseSystem
iflen(chunks)>1{
systemContent=fmt.Sprintf("%s\nChunk %d of %d.",baseSystem,i+1,len(chunks))
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.