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

Function getRuleContent

packages/cli/src/setup/templates.ts:53–63  ·  view source on GitHub ↗
(mode: RuleMode, agent: string)

Source from the content-addressed store, hash-verified

51}
52
53export async function getRuleContent(mode: RuleMode, agent: string): Promise<string> {
54 const [filename, fallback] =
55 mode === "mcp" ? ["context7-mcp.md", FALLBACK_MCP] : ["context7-cli.md", FALLBACK_CLI];
56 let body = await fetchRule(filename, fallback);
57
58 if (mode === "cli" && agent === "codex" && !body.includes(CODEX_CLI_SANDBOX_GUIDANCE)) {
59 body = `${body.trimEnd()}\n${CODEX_CLI_SANDBOX_GUIDANCE}\n`;
60 }
61
62 return agent === "cursor" ? `${CURSOR_FRONTMATTER}${body}` : body;
63}
64
65export function customizeSkillFilesForAgent(
66 agent: string,

Callers 2

installRuleFunction · 0.85
setup.test.tsFile · 0.85

Calls 1

fetchRuleFunction · 0.85

Tested by

no test coverage detected