2025-04-19 03:02:44 +08:00
|
|
|
|
/**
|
|
|
|
|
* initProjectRules prompt 生成器
|
|
|
|
|
* 負責將模板和參數組合成最終的 prompt
|
|
|
|
|
*/
|
|
|
|
|
|
2025-04-26 19:58:52 +08:00
|
|
|
|
import {
|
|
|
|
|
loadPrompt,
|
|
|
|
|
generatePrompt,
|
|
|
|
|
loadPromptFromTemplate,
|
|
|
|
|
} from "../loader.js";
|
2025-04-19 03:02:44 +08:00
|
|
|
|
import { getRulesFilePath } from "../../utils/pathUtils.js";
|
|
|
|
|
/**
|
|
|
|
|
* initProjectRules prompt 參數介面
|
|
|
|
|
*/
|
|
|
|
|
export interface InitProjectRulesPromptParams {
|
|
|
|
|
// 目前沒有額外參數,未來可按需擴展
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 獲取 initProjectRules 的完整 prompt
|
|
|
|
|
* @param params prompt 參數(可選)
|
|
|
|
|
* @returns 生成的 prompt
|
|
|
|
|
*/
|
|
|
|
|
export function getInitProjectRulesPrompt(
|
|
|
|
|
params?: InitProjectRulesPromptParams
|
|
|
|
|
): string {
|
|
|
|
|
// 使用基本模板
|
|
|
|
|
const rulesPath = getRulesFilePath();
|
2025-04-26 19:58:52 +08:00
|
|
|
|
const indexTemplate = loadPromptFromTemplate("initProjectRules/index.md");
|
|
|
|
|
const basePrompt = generatePrompt(indexTemplate, {
|
2025-04-19 03:02:44 +08:00
|
|
|
|
rulesPath,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 載入可能的自定義 prompt (通過環境變數覆蓋或追加)
|
|
|
|
|
return loadPrompt(basePrompt, "INIT_PROJECT_RULES");
|
|
|
|
|
}
|