(filename: string, fallback: string)
| 39 | export type RuleMode = "mcp" | "cli"; |
| 40 | |
| 41 | async 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 | |
| 53 | export async function getRuleContent(mode: RuleMode, agent: string): Promise<string> { |
| 54 | const [filename, fallback] = |