mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
refactor: improve code quality based on Gemini Code Assist suggestions
Applied three code quality improvements suggested by Gemini Code Assist: 1. **Replace nested ternary with map object (enhance.ts)** - Changed nested ternary operator to Record<EnhancementMode, string> map - Improves readability and maintainability - More declarative approach for system prompt selection 2. **Simplify handleToggle logic (prompt-customization-section.tsx)** - Removed redundant if/else branches - Both branches were calculating the same value - Cleaner, more concise implementation 3. **Add type safety to updatePrompt with generics (prompt-customization-section.tsx)** - Changed field parameter from string to keyof NonNullable<PromptCustomization[T]> - Prevents runtime errors from misspelled field names - Improved developer experience with autocomplete All tests passing (774/774). Builds successful. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -136,14 +136,13 @@ export function createEnhanceHandler(
|
||||
const prompts = await getPromptCustomization(settingsService, '[EnhancePrompt]');
|
||||
|
||||
// Get the system prompt for this mode from merged prompts
|
||||
const systemPrompt =
|
||||
validMode === 'improve'
|
||||
? prompts.enhancement.improveSystemPrompt
|
||||
: validMode === 'technical'
|
||||
? prompts.enhancement.technicalSystemPrompt
|
||||
: validMode === 'simplify'
|
||||
? prompts.enhancement.simplifySystemPrompt
|
||||
: prompts.enhancement.acceptanceSystemPrompt;
|
||||
const systemPromptMap: Record<EnhancementMode, string> = {
|
||||
improve: prompts.enhancement.improveSystemPrompt,
|
||||
technical: prompts.enhancement.technicalSystemPrompt,
|
||||
simplify: prompts.enhancement.simplifySystemPrompt,
|
||||
acceptance: prompts.enhancement.acceptanceSystemPrompt,
|
||||
};
|
||||
const systemPrompt = systemPromptMap[validMode];
|
||||
|
||||
logger.debug(`Using ${validMode} system prompt (length: ${systemPrompt.length} chars)`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user