fix(server): return project suggestion roots in the form project.add stores

Git reports Windows repo roots with forward slashes, so an added suggestion kept
showing because its path never matched the new project's root.
This commit is contained in:
Mohamed Boudra
2026-10-31 12:01:07 +01:00
parent 7bae914eac
commit b3a3a4d903
2 changed files with 4 additions and 2 deletions
@@ -88,7 +88,8 @@ describe("listProjectSuggestions", () => {
let gitService: WorkspaceGitServiceImpl;
beforeEach(() => {
root = realpathSync(mkdtempSync(path.join(tmpdir(), "project-suggestions-")));
// The native realpath expands Windows short names (RUNNER~1), which git reports in full.
root = realpathSync.native(mkdtempSync(path.join(tmpdir(), "project-suggestions-")));
gitService = new WorkspaceGitServiceImpl({
logger: createTestLogger(),
paseoHome: path.join(root, ".paseo"),
@@ -118,7 +118,8 @@ async function resolveProjectRoot(
return null;
}
const checkout = await workspaceGitService.getCheckout(cwd);
const rootPath = checkout.mainRepoRoot ?? checkout.worktreeRoot ?? cwd;
// Git reports Windows roots with forward slashes; resolve to the form project.add keys by.
const rootPath = resolve(checkout.mainRepoRoot ?? checkout.worktreeRoot ?? cwd);
if (rootPath !== cwd && !(await isDirectory(rootPath))) {
return null;
}