| 63 | } |
| 64 | |
| 65 | export function customizeSkillFilesForAgent( |
| 66 | agent: string, |
| 67 | skillName: string, |
| 68 | files: Array<{ path: string; content: string }> |
| 69 | ): Array<{ path: string; content: string }> { |
| 70 | if (agent !== "codex" || skillName !== "find-docs") { |
| 71 | return files; |
| 72 | } |
| 73 | |
| 74 | return files.map((file) => { |
| 75 | if (file.path !== "SKILL.md" || file.content.includes(CODEX_CLI_SANDBOX_GUIDANCE)) { |
| 76 | return file; |
| 77 | } |
| 78 | |
| 79 | const marker = "## Step 1: Resolve a Library"; |
| 80 | const guidance = `${CODEX_CLI_SANDBOX_GUIDANCE}\n\n`; |
| 81 | |
| 82 | if (file.content.includes(marker)) { |
| 83 | return { |
| 84 | ...file, |
| 85 | content: file.content.replace(marker, `${guidance}${marker}`), |
| 86 | }; |
| 87 | } |
| 88 | |
| 89 | const separator = file.content.endsWith("\n") ? "\n" : "\n\n"; |
| 90 | return { |
| 91 | ...file, |
| 92 | content: `${file.content}${separator}${CODEX_CLI_SANDBOX_GUIDANCE}\n`, |
| 93 | }; |
| 94 | }); |
| 95 | } |