@@ -7,10 +7,7 @@ import {
7
7
RootPromptDefinition ,
8
8
} from '../shared-interfaces.js' ;
9
9
import { Rating } from '../ratings/rating-types.js' ;
10
- import {
11
- extractPromptContextFilePatterns ,
12
- renderHandlebarsTemplate ,
13
- } from './prompt-templating.js' ;
10
+ import { renderHandlebarsTemplate } from './prompt-templating.js' ;
14
11
import { McpServerOptions } from '../codegen/llm-runner.js' ;
15
12
import { lazy } from '../utils/lazy-creation.js' ;
16
13
import { EnvironmentConfig } from './environment-config.js' ;
@@ -120,21 +117,21 @@ export class Environment {
120
117
}
121
118
122
119
systemPromptGeneration = lazy ( ( ) => {
123
- return this . renderRelativePrompt ( this . config . generationSystemPrompt ) ;
120
+ return this . renderRelativePrompt ( this . config . generationSystemPrompt ) . result ;
124
121
} ) ;
125
122
126
123
systemPromptRepair = lazy ( ( ) => {
127
124
if ( ! this . config . repairSystemPrompt ) {
128
125
return 'Please fix the given errors and return the corrected code.' ;
129
126
}
130
- return this . renderRelativePrompt ( this . config . repairSystemPrompt ) ;
127
+ return this . renderRelativePrompt ( this . config . repairSystemPrompt ) . result ;
131
128
} ) ;
132
129
133
130
systemPromptEditing = lazy ( ( ) => {
134
131
if ( ! this . config . editingSystemPrompt ) {
135
132
return this . systemPromptGeneration ( ) ;
136
133
}
137
- return this . renderRelativePrompt ( this . config . editingSystemPrompt ) ;
134
+ return this . renderRelativePrompt ( this . config . editingSystemPrompt ) . result ;
138
135
} ) ;
139
136
140
137
/**
@@ -275,14 +272,12 @@ export class Environment {
275
272
ratings : Rating [ ] ,
276
273
isEditing : boolean
277
274
) : PromptDefinition {
278
- const { promptText, contextFiles } = extractPromptContextFilePatterns (
279
- this . renderRelativePrompt ( relativePath )
280
- ) ;
275
+ const { result, contextFiles } = this . renderRelativePrompt ( relativePath ) ;
281
276
282
277
return {
283
278
name : name ,
284
279
kind : 'single' ,
285
- prompt : promptText ,
280
+ prompt : result ,
286
281
ratings,
287
282
systemPromptType : isEditing ? 'editing' : 'generation' ,
288
283
contextFilePatterns : contextFiles ,
@@ -387,7 +382,7 @@ export class Environment {
387
382
}
388
383
389
384
/** Renders a prompt from a path relative to the environment config. */
390
- private renderRelativePrompt ( relativePath : string ) : string {
385
+ private renderRelativePrompt ( relativePath : string ) {
391
386
const path = resolve ( this . rootPath , relativePath ) ;
392
387
return this . renderPrompt ( readFileSync ( path , 'utf8' ) , path ) ;
393
388
}
0 commit comments