MCPcopy Create free account
hub / github.com/cli/cli / resolvePrompt

Function resolvePrompt

evals/src/core/suite.ts:118–124  ·  view source on GitHub ↗
(prompt: string, placeholders: Readonly<Record<string, string>>)

Source from the content-addressed store, hash-verified

116
117/** Substitutes `{{NAME}}` placeholders, refusing prompts that need a value the fixture does not provide. */
118export function resolvePrompt(prompt: string, placeholders: Readonly<Record<string, string>>): string {
119 return prompt.replaceAll(/\{\{([A-Z][A-Z0-9_]*)\}\}/g, (match, name: string) => {
120 const value = Object.hasOwn(placeholders, name) ? placeholders[name] : undefined;
121 if (value === undefined) throw new Error(`The prompt references ${match}, but this fixture does not provide it`);
122 return value;
123 });
124}
125
126/** The checked-in eval definition of a suite scenario. */
127export function definitionPath(suite: string, scenario: string): string {

Callers 2

graders.test.tsFile · 0.85
trialMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected