refactor(core): 移除未使用的 prompt-template templates 目录
This commit is contained in:
@@ -4,8 +4,6 @@ import {
|
||||
createDefaultContext,
|
||||
createPlanContext,
|
||||
DEFAULT_TOOL_NAMES,
|
||||
generatePlanPrompt,
|
||||
resolveAgentPrompt,
|
||||
} from '../../../src/agent/prompt-template/index.js';
|
||||
import type { PromptContext } from '../../../src/agent/prompt-template/types.js';
|
||||
|
||||
@@ -153,43 +151,6 @@ describe('Prompt Template System', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('generatePlanPrompt', () => {
|
||||
it('should generate prompt with tool names resolved', () => {
|
||||
const prompt = generatePlanPrompt({});
|
||||
expect(prompt).toContain('glob');
|
||||
expect(prompt).toContain('grep_content');
|
||||
expect(prompt).toContain('read_file');
|
||||
});
|
||||
|
||||
it('should include plan file path', () => {
|
||||
const prompt = generatePlanPrompt({ planFilePath: '/test/plan.md' });
|
||||
expect(prompt).toContain('/test/plan.md');
|
||||
});
|
||||
|
||||
it('should generate shorter prompt for subagent', () => {
|
||||
const mainPrompt = generatePlanPrompt({ isSubagent: false });
|
||||
const subPrompt = generatePlanPrompt({ isSubagent: true });
|
||||
expect(subPrompt.length).toBeLessThan(mainPrompt.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveAgentPrompt', () => {
|
||||
it('should resolve template variables in prompt', () => {
|
||||
const basePrompt = 'Use ${tools.glob} to search';
|
||||
const resolved = resolveAgentPrompt(basePrompt, {});
|
||||
expect(resolved).toBe('Use glob to search');
|
||||
});
|
||||
|
||||
it('should handle isPlanMode option', () => {
|
||||
const basePrompt = '${plan.isActive ? "Plan mode" : "Normal mode"}';
|
||||
const planResolved = resolveAgentPrompt(basePrompt, { isPlanMode: true });
|
||||
expect(planResolved).toBe('Plan mode');
|
||||
|
||||
const normalResolved = resolveAgentPrompt(basePrompt, { isPlanMode: false });
|
||||
expect(normalResolved).toBe('Normal mode');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Edge Cases', () => {
|
||||
it('should handle empty template', () => {
|
||||
const result = renderTemplate('', context);
|
||||
|
||||
Reference in New Issue
Block a user