* Detect whether a file is a plugin manifest or marketplace manifest
( filePath: string, )
| 52 | * Detect whether a file is a plugin manifest or marketplace manifest |
| 53 | */ |
| 54 | function detectManifestType( |
| 55 | filePath: string, |
| 56 | ): 'plugin' | 'marketplace' | 'unknown' { |
| 57 | const fileName = path.basename(filePath) |
| 58 | const dirName = path.basename(path.dirname(filePath)) |
| 59 | |
| 60 | // Check filename patterns |
| 61 | if (fileName === 'plugin.json') return 'plugin' |
| 62 | if (fileName === 'marketplace.json') return 'marketplace' |
| 63 | |
| 64 | // Check if it's in .claude-plugin directory |
| 65 | if (dirName === '.claude-plugin') { |
| 66 | return 'plugin' // Most likely plugin.json |
| 67 | } |
| 68 | |
| 69 | return 'unknown' |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Format Zod validation errors into a readable format |