Function
fetchDocContent
(
repo: string,
branch: string,
filePath: string,
)
Source from the content-addressed store, hash-verified
| 70 | } |
| 71 | |
| 72 | export async function fetchDocContent( |
| 73 | repo: string, |
| 74 | branch: string, |
| 75 | filePath: string, |
| 76 | ): Promise<string | null> { |
| 77 | const url = `https://raw.githubusercontent.com/${repo}/${branch}/${filePath}` |
| 78 | const response = await fetch(url, { |
| 79 | headers: { 'User-Agent': 'tanstack-cli' }, |
| 80 | }) |
| 81 | |
| 82 | if (!response.ok) { |
| 83 | if (response.status === 404) { |
| 84 | return null |
| 85 | } |
| 86 | throw new Error(`Failed to fetch doc: ${response.statusText}`) |
| 87 | } |
| 88 | |
| 89 | return response.text() |
| 90 | } |
| 91 | |
| 92 | export async function searchTanStackDocs({ |
| 93 | query, |
Tested by
no test coverage detected