MCPcopy
hub / github.com/upstash/context7 / customizeSkillFilesForAgent

Function customizeSkillFilesForAgent

packages/cli/src/setup/templates.ts:65–95  ·  view source on GitHub ↗
(
  agent: string,
  skillName: string,
  files: Array<{ path: string; content: string }>
)

Source from the content-addressed store, hash-verified

63}
64
65export 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}

Callers 1

setupCliAgentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected