* Get list of base file names (without .md extension) from a directory * @param dirPath The directory path to list files from * @returns Array of base file names without .md extension * @example * // Given directory contains: agent-sdk-verifier-py.md, agent-sdk-verifier-ts.md, README.txt * awai
(dirPath: string)
| 127 | * // Returns: ['agent-sdk-verifier-py', 'agent-sdk-verifier-ts'] |
| 128 | */ |
| 129 | async function getBaseFileNames(dirPath: string): Promise<string[]> { |
| 130 | try { |
| 131 | const entries = await fs.readdir(dirPath, { |
| 132 | withFileTypes: true |
| 133 | }); |
| 134 | return entries.filter((entry: Dirent) => entry.isFile() && entry.name.endsWith('.md')).map((entry: Dirent) => { |
| 135 | // Remove .md extension specifically |
| 136 | const baseName = path.basename(entry.name, '.md'); |
| 137 | return baseName; |
| 138 | }); |
| 139 | } catch (error) { |
| 140 | const errorMsg = errorMessage(error); |
| 141 | logForDebugging(`Failed to read plugin components from ${dirPath}: ${errorMsg}`, { |
| 142 | level: 'error' |
| 143 | }); |
| 144 | logError(toError(error)); |
| 145 | // Return empty array to allow graceful degradation - plugin details can still be shown |
| 146 | return []; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Get list of skill directory names from a skills directory |
no test coverage detected