refactor: finish strict tool-call typing and mapper dedup

This commit is contained in:
Mohamed Boudra
2026-02-09 09:07:14 +07:00
parent 6d4992b2f5
commit 896f88fa34
10 changed files with 823 additions and 1581 deletions
+17
View File
@@ -0,0 +1,17 @@
export function stripCwdPrefix(filePath: string, cwd?: string): string {
if (!cwd || !filePath) {
return filePath;
}
const normalizedCwd = cwd.replace(/\\/g, "/").replace(/\/+$/, "");
const normalizedPath = filePath.replace(/\\/g, "/");
const prefix = `${normalizedCwd}/`;
if (normalizedPath.startsWith(prefix)) {
return normalizedPath.slice(prefix.length);
}
if (normalizedPath === normalizedCwd) {
return ".";
}
return filePath;
}