diff options
Diffstat (limited to 'src/main/claude/phases.ts')
| -rw-r--r-- | src/main/claude/phases.ts | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/main/claude/phases.ts b/src/main/claude/phases.ts index 89e7c22..a1cbba1 100644 --- a/src/main/claude/phases.ts +++ b/src/main/claude/phases.ts | |||
| @@ -160,11 +160,20 @@ When complete, summarize what was done and any follow-up tasks.`, | |||
| 160 | export function getPhaseConfig( | 160 | export function getPhaseConfig( |
| 161 | phase: Phase, | 161 | phase: Phase, |
| 162 | artifactDir: string, | 162 | artifactDir: string, |
| 163 | userPermissionMode?: UserPermissionMode | 163 | userPermissionMode?: UserPermissionMode, |
| 164 | customSystemPrompt?: string | ||
| 164 | ): PhaseConfig { | 165 | ): PhaseConfig { |
| 165 | const template = phaseConfigTemplates[phase]; | 166 | const template = phaseConfigTemplates[phase]; |
| 167 | |||
| 168 | // If a custom prompt is provided, substitute the {{artifactDir}} placeholder. | ||
| 169 | // Otherwise use the default template function (existing behaviour). | ||
| 170 | const systemPrompt = | ||
| 171 | customSystemPrompt !== undefined | ||
| 172 | ? customSystemPrompt.replace(/\{\{artifactDir\}\}/g, artifactDir) | ||
| 173 | : template.systemPrompt(artifactDir); | ||
| 174 | |||
| 166 | const config: PhaseConfig = { | 175 | const config: PhaseConfig = { |
| 167 | systemPrompt: template.systemPrompt(artifactDir), | 176 | systemPrompt, |
| 168 | tools: template.tools, | 177 | tools: template.tools, |
| 169 | permissionMode: template.permissionMode, | 178 | permissionMode: template.permissionMode, |
| 170 | initialMessage: template.initialMessage, | 179 | initialMessage: template.initialMessage, |
| @@ -175,6 +184,15 @@ export function getPhaseConfig( | |||
| 175 | return config; | 184 | return config; |
| 176 | } | 185 | } |
| 177 | 186 | ||
| 187 | /** | ||
| 188 | * Returns the default system prompt for a phase with "{{artifactDir}}" as a | ||
| 189 | * literal placeholder — the same format used when storing a custom prompt in | ||
| 190 | * the settings DB. Used by the Settings UI to display the default text. | ||
| 191 | */ | ||
| 192 | export function getDefaultSystemPromptTemplate(phase: Phase): string { | ||
| 193 | return phaseConfigTemplates[phase].systemPrompt("{{artifactDir}}"); | ||
| 194 | } | ||
| 195 | |||
| 178 | export function getPhaseInitialMessage(phase: Phase): string { | 196 | export function getPhaseInitialMessage(phase: Phase): string { |
| 179 | return phaseConfigTemplates[phase].initialMessage; | 197 | return phaseConfigTemplates[phase].initialMessage; |
| 180 | } | 198 | } |
