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

Function fetchRule

packages/cli/src/setup/templates.ts:41–51  ·  view source on GitHub ↗
(filename: string, fallback: string)

Source from the content-addressed store, hash-verified

39export type RuleMode = "mcp" | "cli";
40
41async function fetchRule(filename: string, fallback: string): Promise<string> {
42 for (const base of GITHUB_RAW_URLS) {
43 try {
44 const res = await fetch(`${base}/${filename}`);
45 if (res.ok) return await res.text();
46 } catch {
47 continue;
48 }
49 }
50 return fallback;
51}
52
53export async function getRuleContent(mode: RuleMode, agent: string): Promise<string> {
54 const [filename, fallback] =

Callers 1

getRuleContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected