feat: add review.default_reviewers config for /gsd-review defaults (#3464)
* feat(review): add review.default_reviewers selection policy * docs(review): explain default reviewer config and precedence * chore(changeset): add feature entry for review.default_reviewers * chore(changeset): set pr field for #3464 * test(review): cover unavailable default-reviewer failure path * fix(review): sync sdk and inventory parity for default reviewers * fix(review): use canonical /gsd:review namespace in source
This commit is contained in:
@@ -47,6 +47,7 @@ const VALID_CONFIG_KEYS = new Set([
|
||||
'git.branching_strategy', 'git.base_branch', 'git.phase_branch_template', 'git.milestone_branch_template', 'git.quick_branch_template',
|
||||
'planning.commit_docs', 'planning.search_gitignored', 'planning.sub_repos',
|
||||
'review.ollama_host', 'review.lm_studio_host', 'review.llama_cpp_host',
|
||||
'review.default_reviewers',
|
||||
'workflow.cross_ai_execution', 'workflow.cross_ai_command', 'workflow.cross_ai_timeout',
|
||||
'workflow.subagent_timeout',
|
||||
'executor.stall_detect_interval_minutes',
|
||||
|
||||
@@ -13,6 +13,7 @@ const {
|
||||
} = require('./model-profiles.cjs');
|
||||
const { VALID_CONFIG_KEYS, isValidConfigKey } = require('./config-schema.cjs');
|
||||
const { isSecretKey, maskSecret } = require('./secrets.cjs');
|
||||
const { normalizeConfiguredDefaultReviewers } = require('./review-reviewer-selection.cjs');
|
||||
|
||||
const CONFIG_KEY_SUGGESTIONS = {
|
||||
'workflow.nyquist_validation_enabled': 'workflow.nyquist_validation',
|
||||
@@ -444,6 +445,14 @@ function cmdConfigSet(cwd, keyPath, value, raw) {
|
||||
error(`Invalid workflow.human_verify_mode '${value}'. Valid values: ${VALID_HUMAN_VERIFY_MODES.join(', ')}`);
|
||||
}
|
||||
|
||||
if (keyPath === 'review.default_reviewers') {
|
||||
const normalized = normalizeConfiguredDefaultReviewers(parsedValue);
|
||||
if (normalized.errors.length > 0) {
|
||||
error(normalized.errors[0]);
|
||||
}
|
||||
parsedValue = normalized.values;
|
||||
}
|
||||
|
||||
const setConfigValueResult = setConfigValue(cwd, keyPath, parsedValue);
|
||||
|
||||
// Mask secrets in both JSON and text output. The plaintext is written
|
||||
|
||||
125
get-shit-done/bin/lib/review-reviewer-selection.cjs
Normal file
125
get-shit-done/bin/lib/review-reviewer-selection.cjs
Normal file
@@ -0,0 +1,125 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Review Reviewer Selection Module
|
||||
*
|
||||
* Owns reviewer-selection policy projection for /gsd:review:
|
||||
* explicit flags > --all > review.default_reviewers > all detected.
|
||||
*/
|
||||
|
||||
const KNOWN_REVIEWER_SLUGS = [
|
||||
'gemini',
|
||||
'claude',
|
||||
'codex',
|
||||
'coderabbit',
|
||||
'opencode',
|
||||
'qwen',
|
||||
'cursor',
|
||||
'ollama',
|
||||
'lm_studio',
|
||||
'llama_cpp',
|
||||
];
|
||||
|
||||
function normalizeConfiguredDefaultReviewers(rawValue) {
|
||||
if (rawValue === undefined || rawValue === null) {
|
||||
return { absent: true, values: [], errors: [] };
|
||||
}
|
||||
if (!Array.isArray(rawValue)) {
|
||||
return {
|
||||
absent: false,
|
||||
values: [],
|
||||
errors: ['review.default_reviewers must be a JSON array of reviewer slugs'],
|
||||
};
|
||||
}
|
||||
if (rawValue.length === 0) {
|
||||
return {
|
||||
absent: false,
|
||||
values: [],
|
||||
errors: ['review.default_reviewers cannot be empty'],
|
||||
};
|
||||
}
|
||||
|
||||
const seen = new Set();
|
||||
const normalized = [];
|
||||
const errors = [];
|
||||
for (const item of rawValue) {
|
||||
if (typeof item !== 'string') {
|
||||
errors.push('review.default_reviewers must contain only string slugs');
|
||||
continue;
|
||||
}
|
||||
if (!/^[a-zA-Z0-9_-]+$/.test(item)) {
|
||||
errors.push(`invalid reviewer slug in review.default_reviewers: ${item}`);
|
||||
continue;
|
||||
}
|
||||
const slug = item.toLowerCase();
|
||||
if (!seen.has(slug)) {
|
||||
seen.add(slug);
|
||||
normalized.push(slug);
|
||||
}
|
||||
}
|
||||
|
||||
return { absent: false, values: normalized, errors };
|
||||
}
|
||||
|
||||
function resolveReviewerSelection(input) {
|
||||
const detected = new Set((input.detected || []).map((v) => String(v).toLowerCase()));
|
||||
const explicitFlags = new Set((input.explicitFlags || []).map((v) => String(v).toLowerCase()));
|
||||
const allFlag = !!input.allFlag;
|
||||
const normalizedDefaults = normalizeConfiguredDefaultReviewers(input.configuredDefaultReviewers);
|
||||
|
||||
const warnings = [];
|
||||
const infos = [];
|
||||
const errors = [...normalizedDefaults.errors];
|
||||
|
||||
let source = 'no_config_all_detected';
|
||||
let selected = [];
|
||||
|
||||
if (explicitFlags.size > 0) {
|
||||
source = 'explicit_flags';
|
||||
selected = [...explicitFlags].filter((slug) => detected.has(slug));
|
||||
const missing = [...explicitFlags].filter((slug) => !detected.has(slug));
|
||||
if (missing.length > 0) {
|
||||
infos.push(`explicit reviewers missing on host: ${missing.join(', ')}`);
|
||||
}
|
||||
if (selected.length === 0 && errors.length === 0) {
|
||||
errors.push('no selected reviewers are available for explicit flags');
|
||||
}
|
||||
} else if (allFlag) {
|
||||
source = 'all_flag';
|
||||
selected = [...detected];
|
||||
} else if (!normalizedDefaults.absent) {
|
||||
source = 'config_default';
|
||||
const knownDefaults = [];
|
||||
for (const slug of normalizedDefaults.values) {
|
||||
if (!KNOWN_REVIEWER_SLUGS.includes(slug)) {
|
||||
warnings.push(`unknown reviewer slug in review.default_reviewers: ${slug}`);
|
||||
} else {
|
||||
knownDefaults.push(slug);
|
||||
}
|
||||
}
|
||||
const undetected = knownDefaults.filter((slug) => !detected.has(slug));
|
||||
if (undetected.length > 0) {
|
||||
infos.push(`configured reviewers not detected on this host: ${undetected.join(', ')}`);
|
||||
}
|
||||
selected = knownDefaults.filter((slug) => detected.has(slug));
|
||||
if (selected.length === 0 && errors.length === 0) {
|
||||
errors.push('all configured default reviewers are unavailable on this host');
|
||||
}
|
||||
} else {
|
||||
selected = [...detected];
|
||||
}
|
||||
|
||||
return {
|
||||
source,
|
||||
selected: selected.sort(),
|
||||
warnings,
|
||||
infos,
|
||||
errors,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
KNOWN_REVIEWER_SLUGS,
|
||||
normalizeConfiguredDefaultReviewers,
|
||||
resolveReviewerSelection,
|
||||
};
|
||||
@@ -49,7 +49,19 @@ Parse flags from `$ARGUMENTS`:
|
||||
- `--lm-studio` → include LM Studio (local server, OpenAI-compatible)
|
||||
- `--llama-cpp` → include llama.cpp (local server, OpenAI-compatible)
|
||||
- `--all` → include all available (CLIs + running local servers)
|
||||
- No flags → include all available
|
||||
- No flags → if `review.default_reviewers` is set, include only configured reviewers that are detected; otherwise include all available
|
||||
|
||||
Reviewer-selection precedence:
|
||||
1. Individual reviewer flags (`--gemini`, `--codex`, etc.)
|
||||
2. `--all`
|
||||
3. `review.default_reviewers`
|
||||
4. No key + no flags → all detected reviewers
|
||||
|
||||
`review.default_reviewers` behavior:
|
||||
- Value must be a non-empty array of slug strings (configured via `gsd config-set review.default_reviewers '["gemini","codex"]'`)
|
||||
- Unknown slugs warn and are ignored
|
||||
- Known-but-undetected slugs emit an info note and are ignored
|
||||
- If all configured reviewers are unavailable, fail with an actionable message
|
||||
|
||||
If no CLIs are available:
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user