fix: clarify conflict and response style prompts
Conflict resolution prompts now ask for an analysis-first strategy Response style instructions are wrapped as system reminders Prompt templates stay separate from reminder formatting
This commit is contained in:
@@ -73,6 +73,7 @@ import { usePermissionStore } from '@/stores/permissionStore';
|
||||
import { extractGitChangedFiles } from './changedFiles';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { fetchResponseStyleInstruction } from '@/lib/responseStyle';
|
||||
import { wrapSystemReminder } from '@/lib/systemReminder';
|
||||
import { getSyncMessages } from '@/sync/sync-refs';
|
||||
|
||||
const MAX_VISIBLE_TEXTAREA_LINES = 8;
|
||||
@@ -1576,7 +1577,7 @@ const ChatInputComponent: React.FC<ChatInputProps> = ({ onOpenSettings, scrollTo
|
||||
const responseStyleInstruction = await fetchResponseStyleInstruction().catch(() => null);
|
||||
if (responseStyleInstruction) {
|
||||
additionalParts.push({
|
||||
text: responseStyleInstruction,
|
||||
text: wrapSystemReminder(responseStyleInstruction),
|
||||
synthetic: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ Do not implement changes until I confirm; end with: "Next actions: <1 sentence>"
|
||||
{ key: 'operation_label', description: 'Operation label in lower-case (merge/rebase).' },
|
||||
{ key: 'head_ref', description: 'Head reference for preserving intent.' },
|
||||
],
|
||||
template: 'Resolve {{operation_label}} conflicts, stage the resolved files, and complete the {{operation_label}}. Preserve the intent of changes from {{head_ref}}.',
|
||||
template: 'Investigate the {{operation_label}} conflicts and concisely report the intended resolution strategy without making modifications. Wait for confirmation before resolving, staging, or continuing the {{operation_label}}. Preserve the intent of changes from {{head_ref}}.',
|
||||
},
|
||||
{
|
||||
id: 'git.conflict.resolve.instructions',
|
||||
@@ -307,13 +307,16 @@ Do not implement changes until I confirm; end with: "Next actions: <1 sentence>"
|
||||
- Operation: {{operation}}
|
||||
- Head Info: {{head_info}}
|
||||
|
||||
Required steps:
|
||||
Required steps before confirmation:
|
||||
1. Read each conflicted file to understand the conflict markers (<<<<<<< HEAD, =======, >>>>>>> ...)
|
||||
2. Edit each file to resolve conflicts by choosing the correct code or merging both changes appropriately
|
||||
3. Stage all resolved files with: git add <file>
|
||||
4. Complete the {{operation_label}} with: {{continue_cmd}}
|
||||
2. Inspect the relevant surrounding code and changes from both sides
|
||||
3. Report a concise per-file resolution strategy and any assumptions or tradeoffs
|
||||
4. Wait for explicit user confirmation before editing files, staging files, or running: {{continue_cmd}}
|
||||
|
||||
Important:
|
||||
- Do not modify files before the user confirms the proposed strategy
|
||||
- Do not stage files before the user confirms the proposed strategy
|
||||
- Do not continue the {{operation_label}} before the user confirms the proposed strategy
|
||||
- Remove ALL conflict markers from files (<<<<<<< HEAD, =======, >>>>>>>)
|
||||
- Make sure the final code is syntactically correct and preserves intent from both sides
|
||||
- Do not leave any files with unresolved conflict markers
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
const SYSTEM_REMINDER_OPEN = '<system-reminder>';
|
||||
const SYSTEM_REMINDER_CLOSE = '</system-reminder>';
|
||||
|
||||
export const wrapSystemReminder = (text: string): string => {
|
||||
const trimmed = text.trim();
|
||||
if (!trimmed) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (trimmed.startsWith(SYSTEM_REMINDER_OPEN) && trimmed.endsWith(SYSTEM_REMINDER_CLOSE)) {
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
return `${SYSTEM_REMINDER_OPEN}\n${trimmed}\n${SYSTEM_REMINDER_CLOSE}`;
|
||||
};
|
||||
Reference in New Issue
Block a user