chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
export function loadPromptTemplate(rootDir, name) {
|
||||
const promptPath = path.join(rootDir, "prompts", `${name}.md`);
|
||||
return fs.readFileSync(promptPath, "utf8");
|
||||
}
|
||||
|
||||
export function interpolateTemplate(template, variables) {
|
||||
return template.replace(/\{\{([A-Z_]+)\}\}/g, (_, key) => {
|
||||
return Object.prototype.hasOwnProperty.call(variables, key) ? variables[key] : "";
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user