mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
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:
@@ -15,6 +15,7 @@ import type {
|
||||
ResolvedAgentPrompts,
|
||||
ResolvedBacklogPlanPrompts,
|
||||
ResolvedEnhancementPrompts,
|
||||
ResolvedCommitMessagePrompts,
|
||||
} from '@automaker/types';
|
||||
import { STATIC_PORT, SERVER_PORT } from '@automaker/types';
|
||||
|
||||
@@ -429,6 +430,40 @@ export const DEFAULT_ENHANCEMENT_PROMPTS: ResolvedEnhancementPrompts = {
|
||||
uxReviewerSystemPrompt: UX_REVIEWER_SYSTEM_PROMPT,
|
||||
};
|
||||
|
||||
/**
|
||||
* ========================================================================
|
||||
* COMMIT MESSAGE PROMPTS
|
||||
* ========================================================================
|
||||
*/
|
||||
|
||||
export const DEFAULT_COMMIT_MESSAGE_SYSTEM_PROMPT = `You are a git commit message generator. Your task is to create a clear, concise commit message based on the git diff provided.
|
||||
|
||||
Rules:
|
||||
- Output ONLY the commit message, nothing else
|
||||
- First line should be a short summary (50 chars or less) in imperative mood
|
||||
- Start with a conventional commit type if appropriate (feat:, fix:, refactor:, docs:, chore:, style:, test:, perf:, ci:, build:)
|
||||
- Keep it concise and descriptive
|
||||
- Focus on WHAT changed and WHY (if clear from the diff), not HOW
|
||||
- No quotes, backticks, or extra formatting
|
||||
- If there are multiple changes, provide a brief summary on the first line
|
||||
|
||||
Examples:
|
||||
- feat: Add dark mode toggle to settings
|
||||
- fix: Resolve login validation edge case
|
||||
- refactor: Extract user authentication logic
|
||||
- docs: Update installation instructions
|
||||
- chore: Update dependencies to latest versions
|
||||
- style: Fix inconsistent indentation in components
|
||||
- test: Add unit tests for user service
|
||||
- perf: Optimize database query for user lookup`;
|
||||
|
||||
/**
|
||||
* Default Commit Message prompts (for AI commit message generation)
|
||||
*/
|
||||
export const DEFAULT_COMMIT_MESSAGE_PROMPTS: ResolvedCommitMessagePrompts = {
|
||||
systemPrompt: DEFAULT_COMMIT_MESSAGE_SYSTEM_PROMPT,
|
||||
};
|
||||
|
||||
/**
|
||||
* ========================================================================
|
||||
* COMBINED DEFAULTS
|
||||
@@ -443,4 +478,5 @@ export const DEFAULT_PROMPTS = {
|
||||
agent: DEFAULT_AGENT_PROMPTS,
|
||||
backlogPlan: DEFAULT_BACKLOG_PLAN_PROMPTS,
|
||||
enhancement: DEFAULT_ENHANCEMENT_PROMPTS,
|
||||
commitMessage: DEFAULT_COMMIT_MESSAGE_PROMPTS,
|
||||
} as const;
|
||||
|
||||
@@ -41,6 +41,8 @@ export {
|
||||
DEFAULT_BACKLOG_PLAN_USER_PROMPT_TEMPLATE,
|
||||
DEFAULT_BACKLOG_PLAN_PROMPTS,
|
||||
DEFAULT_ENHANCEMENT_PROMPTS,
|
||||
DEFAULT_COMMIT_MESSAGE_SYSTEM_PROMPT,
|
||||
DEFAULT_COMMIT_MESSAGE_PROMPTS,
|
||||
DEFAULT_PROMPTS,
|
||||
} from './defaults.js';
|
||||
|
||||
@@ -50,6 +52,7 @@ export {
|
||||
mergeAgentPrompts,
|
||||
mergeBacklogPlanPrompts,
|
||||
mergeEnhancementPrompts,
|
||||
mergeCommitMessagePrompts,
|
||||
mergeAllPrompts,
|
||||
} from './merge.js';
|
||||
|
||||
@@ -59,4 +62,5 @@ export type {
|
||||
ResolvedAgentPrompts,
|
||||
ResolvedBacklogPlanPrompts,
|
||||
ResolvedEnhancementPrompts,
|
||||
ResolvedCommitMessagePrompts,
|
||||
} from '@automaker/types';
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user