Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): stop prompting to create CLAUDE.md from AGENTS.md
Chris199d7a622837
diff --git a/apps/desktop/src/main/cross-agent-convert/__tests__/detector.test.ts b/apps/desktop/src/main/cross-agent-convert/__tests__/detector.test.tsindex fb8ccceb24..7c28e8793a 100644--- a/apps/desktop/src/main/cross-agent-convert/__tests__/detector.test.ts+++ b/apps/desktop/src/main/cross-agent-convert/__tests__/detector.test.ts@@ -38,15 +38,12 @@ describe('isMissingOrEmptyTextFile / isNonEmptyTextFile', () => {});describe('detect — agents-md kind', () => {- it('claude-code session: AGENTS.md non-empty + CLAUDE.md missing → 1 item to-claude', async () => {+ it('claude-code session: AGENTS.md alone does not prompt or create CLAUDE.md', async () => {await fs.writeFile(path.join(tmpDir, 'AGENTS.md'), '# agents');const r = await detect({ workingDir: tmpDir, agentKind: 'claude-code' });- expect(r.items).toHaveLength(1);- expect(r.items[0]).toMatchObject({- kind: 'agents-md',- direction: 'to-claude',- label: 'AGENTS.md → CLAUDE.md',- });+ expect(r.items).toEqual([]);+ await expect(fs.stat(path.join(tmpDir, 'CLAUDE.md'))).rejects.toMatchObject({ code: 'ENOENT' });+ expect(await fs.readFile(path.join(tmpDir, 'AGENTS.md'), 'utf8')).toBe('# agents');});it('codex session: CLAUDE.md non-empty + AGENTS.md missing → 1 item to-codex', async () => {@@ -73,11 +70,13 @@ describe('detect — agents-md kind', () => {expect((await detect({ workingDir: tmpDir, agentKind: 'claude-code' })).items).toHaveLength(0);});- it('CLAUDE.md 是空文件 + AGENTS.md 非空 → 仍然推(codex 语义:目标 trim 为空算缺失)', async () => {+ it('empty CLAUDE.md + non-empty AGENTS.md does not prompt or overwrite either file', async () => {await fs.writeFile(path.join(tmpDir, 'CLAUDE.md'), '\n ');await fs.writeFile(path.join(tmpDir, 'AGENTS.md'), '# real');const r = await detect({ workingDir: tmpDir, agentKind: 'claude-code' });- expect(r.items).toHaveLength(1);+ expect(r.items).toEqual([]);+ expect(await fs.readFile(path.join(tmpDir, 'CLAUDE.md'), 'utf8')).toBe('\n ');+ expect(await fs.readFile(path.join(tmpDir, 'AGENTS.md'), 'utf8')).toBe('# real');});it('empty workingDir → 0 items', async () => {diff --git a/apps/desktop/src/main/cross-agent-convert/detector.ts b/apps/desktop/src/main/cross-agent-convert/detector.tsindex cc56b76f42..30cba2f047 100644--- a/apps/desktop/src/main/cross-agent-convert/detector.ts+++ b/apps/desktop/src/main/cross-agent-convert/detector.ts@@ -1,7 +1,8 @@/*** cross-agent-convert / detector*- * 4 项独立判断(双向)。每一项"对面端有内容 ∧ 本端缺失" → 推入 items。+ * 配置项独立判断:"对面端有内容 ∧ 本端缺失" → 推入 items。+ * 指令文件仅保留 CLAUDE.md → AGENTS.md;不再提示为 Claude Code 创建 CLAUDE.md。** 关键:用 codex 同款 `is_missing_or_empty_text_file` 语义 ——* 目标"不存在 OR trim 后为空" 才视为缺失。@@ -98,7 +99,7 @@ export async function detect(input: DetectInput): Promise<DetectResult> {const items: MigrationItem[] = [];const direction: MigrationDirection = input.agentKind === 'claude-code' ? 'to-claude' : 'to-codex';- // ── 第 1 项:CLAUDE.md ↔ AGENTS.md ────────────────────────────────────+ // ── 第 1 项:CLAUDE.md → AGENTS.md ────────────────────────────────────await detectAgentsMd(wd, direction, items);// ── 第 2 项:agents/ ─────────────────────────────────────────────────@@ -116,18 +117,7 @@ export async function detect(input: DetectInput): Promise<DetectResult> {async function detectAgentsMd(wd: string, direction: MigrationDirection, items: MigrationItem[]): Promise<void> {const claudeMd = path.join(wd, 'CLAUDE.md');const agentsMd = path.join(wd, 'AGENTS.md');- if (direction === 'to-claude') {- if ((await isNonEmptyTextFile(agentsMd)) && (await isMissingOrEmptyTextFile(claudeMd))) {- items.push({- id: 'agents-md:0',- kind: 'agents-md',- direction,- label: 'AGENTS.md → CLAUDE.md',- source: agentsMd,- target: claudeMd,- });- }- } else {+ if (direction === 'to-codex') {if ((await isNonEmptyTextFile(claudeMd)) && (await isMissingOrEmptyTextFile(agentsMd))) {items.push({id: 'agents-md:0',