MCPcopy
hub / github.com/EveryInc/compound-engineering-plugin / ensureCodexAgentsFile

Function ensureCodexAgentsFile

src/utils/codex-agents.ts:29–44  ·  view source on GitHub ↗
(codexHome: string)

Source from the content-addressed store, hash-verified

27`
28
29export 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
46function buildCodexAgentsBlock(): string {
47 return [CODEX_AGENTS_BLOCK_START, CODEX_AGENTS_BLOCK_BODY.trim(), CODEX_AGENTS_BLOCK_END].join("\n")

Callers 3

runFunction · 0.90
runFunction · 0.90

Calls 6

ensureDirFunction · 0.90
pathExistsFunction · 0.90
writeTextFunction · 0.90
readTextFunction · 0.90
buildCodexAgentsBlockFunction · 0.85
upsertBlockFunction · 0.70

Tested by

no test coverage detected