From 8f7ab3e2680b7662bb37de3dd5871b8672c8d8ef Mon Sep 17 00:00:00 2001 From: catlog22 Date: Thu, 8 Jan 2026 20:25:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Codex=20AGENTS.md?= =?UTF-8?q?=20=E6=A0=87=E9=A2=98=E5=8C=B9=E9=85=8D=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 支持 "Codex Code Guidelines" 和 "Codex Instructions" 两种标题 - 使用不区分大小写的正则匹配 --- ccw/src/core/routes/claude-routes.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ccw/src/core/routes/claude-routes.ts b/ccw/src/core/routes/claude-routes.ts index a4bf983a..884c2a19 100644 --- a/ccw/src/core/routes/claude-routes.ts +++ b/ccw/src/core/routes/claude-routes.ts @@ -918,8 +918,11 @@ export async function handleClaudeRoutes(ctx: RouteContext): Promise { const isCodex = target === 'codex'; const targetDir = isCodex ? join(homedir(), '.codex') : join(homedir(), '.claude'); const targetFile = isCodex ? join(targetDir, 'AGENTS.md') : join(targetDir, 'CLAUDE.md'); - const headerText = isCodex ? '# Codex Instructions\n\n' : '# Claude Instructions\n\n'; - const headerPattern = isCodex ? /^# Codex Instructions\n\n?/ : /^# Claude Instructions\n\n?/; + const headerText = isCodex ? '# Codex Code Guidelines\n\n' : '# Claude Instructions\n\n'; + // Match common header patterns for both tools + const headerPattern = isCodex + ? /^#\s*(Codex\s*(Code\s*)?(Guidelines|Instructions))\n\n?/i + : /^#\s*Claude\s*Instructions\n\n?/i; const chineseRefLine = `- **中文回复准则**: @${guidelinesRef}`; const chineseRefPattern = /^- \*\*中文回复准则\*\*:.*chinese-response\.md.*$/gm;