( value: unknown, source: string, )
| 349 | * and other fields degrade. |
| 350 | */ |
| 351 | export function parseShellFrontmatter( |
| 352 | value: unknown, |
| 353 | source: string, |
| 354 | ): FrontmatterShell | undefined { |
| 355 | if (value == null) { |
| 356 | return undefined |
| 357 | } |
| 358 | const normalized = String(value).trim().toLowerCase() |
| 359 | if (normalized === '') { |
| 360 | return undefined |
| 361 | } |
| 362 | if ((FRONTMATTER_SHELLS as readonly string[]).includes(normalized)) { |
| 363 | return normalized as FrontmatterShell |
| 364 | } |
| 365 | logForDebugging( |
| 366 | `Frontmatter 'shell: ${value}' in ${source} is not recognized. Valid values: ${FRONTMATTER_SHELLS.join(', ')}. Falling back to bash.`, |
| 367 | { level: 'warn' }, |
| 368 | ) |
| 369 | return undefined |
| 370 | } |
no test coverage detected