Skip to content

feat: support a global reviewer config - #27

Open
theogrillat wants to merge 2 commits into
T-moz:mainfrom
theogrillat:feat/global-reviewer-config
Open

theogrillat wants to merge 2 commits into
T-moz:mainfrom
theogrillat:feat/global-reviewer-config

Conversation

@theogrillat

Copy link
Copy Markdown

Why

Reviewer configs can only live in each project's working directory. If you want the same reviewers everywhere, you have to copy the file into every repo, including repos where you can't commit it.

What

loadReviewers now looks for a config in this order, and the first file it finds wins:

  1. <cwd>/pair-programmer.reviewers.json (project config, same as before)
  2. $PI_CODING_AGENT_DIR/pair-programmer.reviewers.json, or ~/.pi/agent/pair-programmer.reviewers.json if the variable is unset (global config, new)
  3. The built-in default reviewers

A project config replaces the global one entirely; the two are not merged. An explicitly empty project list ({"reviewers": []}) still turns reviews off for that project. Only a missing project file falls through to the global one. If a config file exists but is invalid, you still get an error naming its path.

Other changes

  • Moved the agent-directory lookup ($PI_CODING_AGENT_DIR ?? ~/.pi/agent) out of logger.ts into src/agent-directory.ts, so the logger and the reviewer loader share it.
  • Added test/setup.ts, which points PI_CODING_AGENT_DIR at a directory that doesn't exist. Without it, a developer's real global config could leak into the test suite.
  • Documented the global config in the README.

Checks

  • npm run check passes: types, lint, formatting, 421 tests, 100% coverage.

Fall back to $PI_CODING_AGENT_DIR/pair-programmer.reviewers.json
(default ~/.pi/agent) when the working directory has no config. A project
config replaces the global one entirely.
Comment thread src/reviewers.ts Outdated
} catch (error) {
if (MissingConfigErrorSchema.safeParse(error).success) {
return DEFAULT_REVIEWERS;
return undefined;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined ??

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: readConfig now takes a whenMissing fallback, so a missing file delegates to the next source (project → global → defaults). No more undefined or ?? chaining.

Comment thread test/setup.ts Outdated
Comment on lines +4 to +5
// Keep tests from reading the developer's real Pi state directory, such as a
// global `pair-programmer.reviewers.json`.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Comment thread src/reviewers.ts Outdated
Comment thread src/agent-directory.ts Outdated
Chain config sources with an explicit fallback instead of undefined and ??,
and drop explanatory comments.
Comment thread README.md

Use `current` or a `provider/model` identifier. File patterns are relative to your working directory; exclusions take precedence. Add entries for more reviewers.

To use the same reviewers in every project, put the file in `~/.pi/agent/pair-programmer.reviewers.json` (or `$PI_CODING_AGENT_DIR/pair-programmer.reviewers.json`). A project config in your working directory replaces the global one entirely; the reviewers are not merged.

@T-moz T-moz Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also be compatible with omp

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants