(targetPath: string)
| 107 | } |
| 108 | |
| 109 | async function resolveRealPathAllowMissing(targetPath: string): Promise<string> { |
| 110 | const missingSegments: string[] = []; |
| 111 | let currentPath = targetPath; |
| 112 | |
| 113 | while (true) { |
| 114 | try { |
| 115 | const realPath = await fsPromises.realpath(currentPath); |
| 116 | return missingSegments.length === 0 ? realPath : path.join(realPath, ...missingSegments); |
| 117 | } catch (error) { |
| 118 | if (!hasErrorCode(error, "ENOENT")) { |
| 119 | throw error; |
| 120 | } |
| 121 | |
| 122 | const parentPath = path.dirname(currentPath); |
| 123 | if (parentPath === currentPath) { |
| 124 | throw error; |
| 125 | } |
| 126 | |
| 127 | missingSegments.unshift(path.basename(currentPath)); |
| 128 | currentPath = parentPath; |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | export async function resolveContainedSkillFilePath( |
| 134 | skillDir: string, |
no test coverage detected