From 096f59da130b155b435b291be85b212c78ae25fa Mon Sep 17 00:00:00 2001 From: Giancarlo Erra Date: Thu, 9 Apr 2026 16:58:40 +0100 Subject: [PATCH] fix: update path handling and type imports in indexer and query tools --- src/services/indexer.ts | 2 +- src/tools/query-tools.ts | 3 ++- tests/unit/config.test.ts | 2 +- tests/unit/multi-collection-search.test.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/services/indexer.ts b/src/services/indexer.ts index f27da0b..09ebe72 100644 --- a/src/services/indexer.ts +++ b/src/services/indexer.ts @@ -170,7 +170,7 @@ function migrateAbsolutePathKeys(hashes: Map, resolvedProjectPat // Try to strip the stored project path prefix, or detect the common prefix const prefix = resolvedProjectPath - ? resolvedProjectPath + "/" + ? `${resolvedProjectPath}/` : detectCommonPrefix(hashes); if (!prefix) { diff --git a/src/tools/query-tools.ts b/src/tools/query-tools.ts index 2aec320..52f9f0f 100644 --- a/src/tools/query-tools.ts +++ b/src/tools/query-tools.ts @@ -14,6 +14,7 @@ import { getLockHolderPid, } from "../services/lock.js"; import { ensureOllamaReady } from "../services/ollama.js"; import { getCollectionInfo, getProjectMetadata, searchChunks, searchMultipleCollections } from "../services/qdrant.js"; import { ensureWatcherStarted, isWatchedByAnyProcess, isWatching } from "../services/watcher.js"; +import type { SearchResult } from "../types.js"; /** Format an IndexingProgress into display lines (elapsed, progress, batches, graph). */ function formatProgressLines(progress: IndexingProgress): { @@ -73,7 +74,7 @@ export async function handleQueryTool( const languageFilter = args.languageFilter as string | undefined; const includeLinked = args.includeLinked as boolean | undefined; - let allResults; + let allResults: SearchResult[]; if (includeLinked) { const collections = resolveLinkedCollections(resolvedPath); allResults = await searchMultipleCollections(collections, query, limit, fileFilter, languageFilter); diff --git a/tests/unit/config.test.ts b/tests/unit/config.test.ts index bbecb3a..c26089e 100644 --- a/tests/unit/config.test.ts +++ b/tests/unit/config.test.ts @@ -1,9 +1,9 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Giancarlo Erra - Altaire Limited -import { afterEach, beforeEach, describe, expect, it } from "vitest"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; +import { afterEach, beforeEach, describe, expect, it } from "vitest"; import { collectionName, contextCollectionName, detectGitBranch, graphCollectionName, loadLinkedProjects, projectIdFromPath, resolveLinkedCollections, sanitizeBranchName } from "../../src/config.js"; describe("config", () => { diff --git a/tests/unit/multi-collection-search.test.ts b/tests/unit/multi-collection-search.test.ts index 7b57b77..b94faad 100644 --- a/tests/unit/multi-collection-search.test.ts +++ b/tests/unit/multi-collection-search.test.ts @@ -8,8 +8,8 @@ */ import { describe, expect, it } from "vitest"; -import type { SearchResult } from "../../src/types.js"; import { mergeMultiCollectionResults } from "../../src/services/qdrant.js"; +import type { SearchResult } from "../../src/types.js"; // ── Helpers ─────────────────────────────────────────────────────────────