* fix: rebrand prompt identity to openclaude * fix prompt branding * fix: align prompt branding with config compatibility
85 lines
3.4 KiB
TypeScript
85 lines
3.4 KiB
TypeScript
import { afterEach, expect, test } from 'bun:test'
|
|
|
|
import { getSystemPrompt, DEFAULT_AGENT_PROMPT } from './prompts.js'
|
|
import { CLI_SYSPROMPT_PREFIXES, getCLISyspromptPrefix } from './system.js'
|
|
import { CLAUDE_CODE_GUIDE_AGENT } from '../tools/AgentTool/built-in/claudeCodeGuideAgent.js'
|
|
import { GENERAL_PURPOSE_AGENT } from '../tools/AgentTool/built-in/generalPurposeAgent.js'
|
|
import { EXPLORE_AGENT } from '../tools/AgentTool/built-in/exploreAgent.js'
|
|
import { PLAN_AGENT } from '../tools/AgentTool/built-in/planAgent.js'
|
|
import { STATUSLINE_SETUP_AGENT } from '../tools/AgentTool/built-in/statuslineSetup.js'
|
|
|
|
const originalSimpleEnv = process.env.CLAUDE_CODE_SIMPLE
|
|
|
|
afterEach(() => {
|
|
process.env.CLAUDE_CODE_SIMPLE = originalSimpleEnv
|
|
})
|
|
|
|
test('CLI identity prefixes describe OpenClaude instead of Claude Code', () => {
|
|
expect(getCLISyspromptPrefix()).toContain('OpenClaude')
|
|
expect(getCLISyspromptPrefix()).not.toContain('Claude Code')
|
|
expect(getCLISyspromptPrefix()).not.toContain("Anthropic's official CLI for Claude")
|
|
|
|
for (const prefix of CLI_SYSPROMPT_PREFIXES) {
|
|
expect(prefix).toContain('OpenClaude')
|
|
expect(prefix).not.toContain('Claude Code')
|
|
expect(prefix).not.toContain("Anthropic's official CLI for Claude")
|
|
}
|
|
})
|
|
|
|
test('simple mode identity describes OpenClaude instead of Claude Code', async () => {
|
|
process.env.CLAUDE_CODE_SIMPLE = '1'
|
|
|
|
const prompt = await getSystemPrompt([], 'gpt-4o')
|
|
|
|
expect(prompt[0]).toContain('OpenClaude')
|
|
expect(prompt[0]).not.toContain('Claude Code')
|
|
expect(prompt[0]).not.toContain("Anthropic's official CLI for Claude")
|
|
})
|
|
|
|
test('built-in agent prompts describe OpenClaude instead of Claude Code', () => {
|
|
expect(DEFAULT_AGENT_PROMPT).toContain('OpenClaude')
|
|
expect(DEFAULT_AGENT_PROMPT).not.toContain('Claude Code')
|
|
expect(DEFAULT_AGENT_PROMPT).not.toContain("Anthropic's official CLI for Claude")
|
|
|
|
const generalPrompt = GENERAL_PURPOSE_AGENT.getSystemPrompt({
|
|
toolUseContext: { options: {} as never },
|
|
})
|
|
expect(generalPrompt).toContain('OpenClaude')
|
|
expect(generalPrompt).not.toContain('Claude Code')
|
|
expect(generalPrompt).not.toContain("Anthropic's official CLI for Claude")
|
|
|
|
const explorePrompt = EXPLORE_AGENT.getSystemPrompt({
|
|
toolUseContext: { options: {} as never },
|
|
})
|
|
expect(explorePrompt).toContain('OpenClaude')
|
|
expect(explorePrompt).not.toContain('Claude Code')
|
|
expect(explorePrompt).not.toContain("Anthropic's official CLI for Claude")
|
|
|
|
const planPrompt = PLAN_AGENT.getSystemPrompt({
|
|
toolUseContext: { options: {} as never },
|
|
})
|
|
expect(planPrompt).toContain('OpenClaude')
|
|
expect(planPrompt).not.toContain('Claude Code')
|
|
|
|
const statuslinePrompt = STATUSLINE_SETUP_AGENT.getSystemPrompt({
|
|
toolUseContext: { options: {} as never },
|
|
})
|
|
expect(statuslinePrompt).toContain('OpenClaude')
|
|
expect(statuslinePrompt).not.toContain('Claude Code')
|
|
|
|
const guidePrompt = CLAUDE_CODE_GUIDE_AGENT.getSystemPrompt({
|
|
toolUseContext: {
|
|
options: {
|
|
commands: [],
|
|
agentDefinitions: { activeAgents: [] },
|
|
mcpClients: [],
|
|
} as never,
|
|
},
|
|
})
|
|
expect(guidePrompt).toContain('OpenClaude')
|
|
expect(guidePrompt).toContain('You are the OpenClaude guide agent.')
|
|
expect(guidePrompt).toContain('**OpenClaude** (the CLI tool)')
|
|
expect(guidePrompt).not.toContain('You are the Claude guide agent.')
|
|
expect(guidePrompt).not.toContain('**Claude Code** (the CLI tool)')
|
|
})
|