feat(prompts): implement customizable commit message prompts

- Added a new section in the UI for customizing commit message prompts.
- Integrated a system prompt for AI-generated commit messages, allowing users to define their own instructions.
- Updated the backend to merge custom prompts with default settings for commit message generation.
- Enhanced the commit message generation logic to utilize the effective system prompt based on user settings.
This commit is contained in:
Shirone
2026-01-12 20:48:08 +01:00
parent 5e4f5f86cd
commit 0261ec2892
6 changed files with 111 additions and 1 deletions

View File

@@ -14,17 +14,20 @@ import type {
AgentPrompts,
BacklogPlanPrompts,
EnhancementPrompts,
CommitMessagePrompts,
CustomPrompt,
ResolvedAutoModePrompts,
ResolvedAgentPrompts,
ResolvedBacklogPlanPrompts,
ResolvedEnhancementPrompts,
ResolvedCommitMessagePrompts,
} from '@automaker/types';
import {
DEFAULT_AUTO_MODE_PROMPTS,
DEFAULT_AGENT_PROMPTS,
DEFAULT_BACKLOG_PLAN_PROMPTS,
DEFAULT_ENHANCEMENT_PROMPTS,
DEFAULT_COMMIT_MESSAGE_PROMPTS,
} from './defaults.js';
/**
@@ -120,6 +123,18 @@ export function mergeEnhancementPrompts(custom?: EnhancementPrompts): ResolvedEn
};
}
/**
* Merge custom Commit Message prompts with defaults
* Custom prompts override defaults only when enabled=true
*/
export function mergeCommitMessagePrompts(
custom?: CommitMessagePrompts
): ResolvedCommitMessagePrompts {
return {
systemPrompt: resolvePrompt(custom?.systemPrompt, DEFAULT_COMMIT_MESSAGE_PROMPTS.systemPrompt),
};
}
/**
* Merge all custom prompts with defaults
* Returns a complete PromptCustomization with all fields populated
@@ -130,5 +145,6 @@ export function mergeAllPrompts(custom?: PromptCustomization) {
agent: mergeAgentPrompts(custom?.agent),
backlogPlan: mergeBacklogPlanPrompts(custom?.backlogPlan),
enhancement: mergeEnhancementPrompts(custom?.enhancement),
commitMessage: mergeCommitMessagePrompts(custom?.commitMessage),
};
}