codex-plugin-cc/plugins/codex/scripts/lib/prompts.mjs
Dominik Kundel c69527eb18
Initial commit
Co-authored-by: Codex <noreply@openai.com>
2026-03-30 09:42:33 -07:00

14 lines
440 B
JavaScript

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] : "";
});
}