* Helper to determine the specific parsing error for an agent file
(frontmatter: Record<string, unknown>)
| 401 | * Helper to determine the specific parsing error for an agent file |
| 402 | */ |
| 403 | function getParseError(frontmatter: Record<string, unknown>): string { |
| 404 | const agentType = frontmatter['name'] |
| 405 | const description = frontmatter['description'] |
| 406 | |
| 407 | if (!agentType || typeof agentType !== 'string') { |
| 408 | return 'Missing required "name" field in frontmatter' |
| 409 | } |
| 410 | |
| 411 | if (!description || typeof description !== 'string') { |
| 412 | return 'Missing required "description" field in frontmatter' |
| 413 | } |
| 414 | |
| 415 | return 'Unknown parsing error' |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * Parse hooks from frontmatter using the HooksSchema |