Commit f98fd29
authored
refactor(prompt): make prompt construction template-driven (#625)
## Why
Prompt construction in `internal/prompt` had accumulated too much behavior in Go-side string assembly, which made the actual prompt structure hard to reason about, easy to regress during cleanup, and split across multiple sources of truth. This refactor moves the prompt format itself into templates so the rendered prompt shape is defined where it is authored, while preserving existing review behavior and fixing the regressions uncovered during the migration and subsequent `roborev` reviews.
## Summary
- make prompt construction template-driven end to end by moving assembled prompt bodies, prompt sections, and agent-specific system prompts onto embedded `.md.gotmpl` templates backed by typed view data
- preserve existing prompt behavior while fixing cleanup regressions in dirty and range prompt fitting, including truncated diff fallbacks, optional-context retention, and fallback selection quality
- resolve the accumulated `roborev` findings on `gotmpl` so the branch ends with no open review jobs
## Test Plan
- [x] go fmt ./...
- [x] go vet ./...
- [x] go test ./...
Co-authored-by: Marius van Niekerk <mariusvniekerk@users.noreply.github.com>1 parent c27d4dc commit f98fd29
21 files changed
Lines changed: 1661 additions & 642 deletions
File tree
- internal
- agent
- prompt
- templates
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
0 commit comments