feat(repo): add project-level review prompt with UI redesign

- Add database migration and repository for project review prompts
- Add API endpoint for setting project-level prompts
- Integrate project prompts into Agent and Codex review flows
- Redesign repository management UI with dialog-based prompt editor
- Replace flat buttons with Switch for webhook toggle and dedicated prompt button
- Add Dialog and DropdownMenu UI components from Radix UI
- Add comprehensive tests for wiring and interactions
This commit is contained in:
jeffusion
2026-03-26 12:14:39 +08:00
committed by 路遥知码力
parent c313764b61
commit d5deb75231
30 changed files with 1439 additions and 123 deletions

View File

@@ -11,14 +11,32 @@ export function withGlobalPrompt(systemContent: string, globalPrompt: string | u
return `${systemContent}\n\n${globalPrompt}`;
}
export function mergeReviewPrompts(
globalPrompt: string | undefined,
projectPrompt: string | undefined
): string | undefined {
const normalized = [globalPrompt, projectPrompt]
.map((item) => item?.trim())
.filter((item): item is string => !!item && item.length > 0);
if (normalized.length === 0) {
return undefined;
}
return normalized.join('\n\n');
}
export function withCoreGlobalPrompt(
systemContent: string,
globalPrompt: string | undefined,
maxChars = 240
maxChars?: number
): string {
if (!globalPrompt || globalPrompt.trim() === '') {
return systemContent;
}
const compact = globalPrompt.trim().slice(0, maxChars);
const normalized = globalPrompt.trim();
const compact =
typeof maxChars === 'number' && maxChars > 0 ? normalized.slice(0, maxChars) : normalized;
return `${systemContent}\n\n${compact}`;
}