(codexHome: string)
| 27 | ` |
| 28 | |
| 29 | export async function ensureCodexAgentsFile(codexHome: string): Promise<void> { |
| 30 | await ensureDir(codexHome) |
| 31 | const filePath = path.join(codexHome, "AGENTS.md") |
| 32 | const block = buildCodexAgentsBlock() |
| 33 | |
| 34 | if (!(await pathExists(filePath))) { |
| 35 | await writeText(filePath, block + "\n") |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | const existing = await readText(filePath) |
| 40 | const updated = upsertBlock(existing, block) |
| 41 | if (updated !== existing) { |
| 42 | await writeText(filePath, updated) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | function buildCodexAgentsBlock(): string { |
| 47 | return [CODEX_AGENTS_BLOCK_START, CODEX_AGENTS_BLOCK_BODY.trim(), CODEX_AGENTS_BLOCK_END].join("\n") |
no test coverage detected