(workDir: string, filePath: string)
| 1856 | } |
| 1857 | |
| 1858 | function resolveWorktreeFilePath(workDir: string, filePath: string): { absolutePath: string; relativePath: string } | null { |
| 1859 | const resolvedWorkDir = path.resolve(workDir) |
| 1860 | const absolutePath = path.resolve(resolvedWorkDir, filePath) |
| 1861 | const relativePath = path.relative(resolvedWorkDir, absolutePath) |
| 1862 | if (!relativePath || relativePath.startsWith("..") || path.isAbsolute(relativePath)) { |
| 1863 | return null |
| 1864 | } |
| 1865 | return { |
| 1866 | absolutePath, |
| 1867 | relativePath: relativePath.split(path.sep).join("/"), |
| 1868 | } |
| 1869 | } |
| 1870 | |
| 1871 | function finalizeFilePatchResponse(patch: string, allowTruncation: boolean = true): GetFilePatchResponse { |
| 1872 | if (!patch) { |
no outgoing calls
no test coverage detected