(name: string)
| 144 | * Returns null when the template has no README. |
| 145 | */ |
| 146 | export async function fetchTemplateReadme(name: string): Promise<string | null> { |
| 147 | const res = await fetch(`/api/workspaces/templates/${encodeURIComponent(name)}/readme`); |
| 148 | if (res.status === 404) return null; |
| 149 | if (!res.ok) throw new Error(`fetch readme failed: ${res.status}`); |
| 150 | const raw = await res.text(); |
| 151 | return stripFrontmatter(raw); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Strip a leading YAML frontmatter block (`---` ... `---`) so the rendered |
no test coverage detected