@@ -7,10 +7,7 @@ import {
77 RootPromptDefinition ,
88} from '../shared-interfaces.js' ;
99import { Rating } from '../ratings/rating-types.js' ;
10- import {
11- extractPromptContextFilePatterns ,
12- renderHandlebarsTemplate ,
13- } from './prompt-templating.js' ;
10+ import { renderHandlebarsTemplate } from './prompt-templating.js' ;
1411import { McpServerOptions } from '../codegen/llm-runner.js' ;
1512import { lazy } from '../utils/lazy-creation.js' ;
1613import { EnvironmentConfig } from './environment-config.js' ;
@@ -120,21 +117,21 @@ export class Environment {
120117 }
121118
122119 systemPromptGeneration = lazy ( ( ) => {
123- return this . renderRelativePrompt ( this . config . generationSystemPrompt ) ;
120+ return this . renderRelativePrompt ( this . config . generationSystemPrompt ) . result ;
124121 } ) ;
125122
126123 systemPromptRepair = lazy ( ( ) => {
127124 if ( ! this . config . repairSystemPrompt ) {
128125 return 'Please fix the given errors and return the corrected code.' ;
129126 }
130- return this . renderRelativePrompt ( this . config . repairSystemPrompt ) ;
127+ return this . renderRelativePrompt ( this . config . repairSystemPrompt ) . result ;
131128 } ) ;
132129
133130 systemPromptEditing = lazy ( ( ) => {
134131 if ( ! this . config . editingSystemPrompt ) {
135132 return this . systemPromptGeneration ( ) ;
136133 }
137- return this . renderRelativePrompt ( this . config . editingSystemPrompt ) ;
134+ return this . renderRelativePrompt ( this . config . editingSystemPrompt ) . result ;
138135 } ) ;
139136
140137 /**
@@ -275,14 +272,12 @@ export class Environment {
275272 ratings : Rating [ ] ,
276273 isEditing : boolean
277274 ) : PromptDefinition {
278- const { promptText, contextFiles } = extractPromptContextFilePatterns (
279- this . renderRelativePrompt ( relativePath )
280- ) ;
275+ const { result, contextFiles } = this . renderRelativePrompt ( relativePath ) ;
281276
282277 return {
283278 name : name ,
284279 kind : 'single' ,
285- prompt : promptText ,
280+ prompt : result ,
286281 ratings,
287282 systemPromptType : isEditing ? 'editing' : 'generation' ,
288283 contextFilePatterns : contextFiles ,
@@ -387,7 +382,7 @@ export class Environment {
387382 }
388383
389384 /** Renders a prompt from a path relative to the environment config. */
390- private renderRelativePrompt ( relativePath : string ) : string {
385+ private renderRelativePrompt ( relativePath : string ) {
391386 const path = resolve ( this . rootPath , relativePath ) ;
392387 return this . renderPrompt ( readFileSync ( path , 'utf8' ) , path ) ;
393388 }
0 commit comments