Skip to content

Retrieve Duo Code Review custom instructions from repository files

Context

We will soon inject custom instructions into the Duo Code Review prompt (#545136 (closed)). There needs to be a way for users to specify and store these instructions.

Goal

Make it possible to retrieve custom instructions stored as files in the repository:

  • Determine the folder/file structure
  • Implement logic to read this content when a review is requested

Proposal

  • Store instructions in .gitlab/duo at the root of the repository.
  • 1 file per feature, e.g. .gitlab/duo/mr-review-instructions.yaml for Duo Code Review.
  • N instructions per file/feature.
  • File filters are glob patterns.

File format:

instructions:
- name: All Go
  fileFilters: 
  - *.go
  instructions: |
    1. We use testify as the testing library
    2. Prefer to store large consts in a file and access them using go:export

- name: Typescript
  fileFilters:
  - *.ts
  - *.js
  instructions: |
    Always prefer TS over JS. No JS allowed any more ever!

Preferring yaml over markdown+front matter because:

  • Easier to parse
  • Other configs in GitLab use yaml (e.g. CI)
Edited by François Rosé