refactor(core): 统一模板引擎到 src/template/ 目录

- 将 agent/prompt-template/ 目录合并到 src/template/
- 新增通用模板函数 renderTemplate、render
- 新增 Agent 特定函数 renderPromptTemplate、renderPrompt
- 新增 createToolDescriptionContext 支持工具描述模板变量
- 支持 ${GREP_TOOL_NAME} 等 Claude Code 风格变量
- 更新所有相关导入路径
This commit is contained in:
2025-12-16 16:05:10 +08:00
parent 30f35a6562
commit 1d380d0bcb
8 changed files with 359 additions and 112 deletions
+6 -3
View File
@@ -61,15 +61,18 @@ export {
// System Prompt
export { SystemPrompt } from './system-prompt.js';
// Prompt Template
// Prompt Template (re-export from ../template/)
export {
renderTemplate,
render,
renderPromptTemplate,
renderPrompt,
createDefaultContext,
createPlanContext,
createToolDescriptionContext,
checkPlanFileExists,
DEFAULT_TOOL_NAMES,
} from './prompt-template/index.js';
} from '../template/index.js';
export type {
PromptContext,
@@ -79,4 +82,4 @@ export type {
PlanModeContext,
EnvContext,
AgentContext,
} from './prompt-template/index.js';
} from '../template/index.js';