Skip to content

Commit c13e1f2

Browse files
committed
Fix directory path normalization
1 parent f54df3f commit c13e1f2

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "directory-indexer",
3-
"version": "0.0.14",
3+
"version": "0.0.15",
44
"description": "AI-powered directory indexing with semantic search for MCP servers",
55
"main": "dist/cli.js",
66
"bin": {

src/indexing.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ export async function indexDirectories(paths: string[], config: Config): Promise
177177
for (const path of paths) {
178178
try {
179179
// Mark directory as indexing
180-
await sqlite.upsertDirectory(path, 'indexing');
180+
const normalizedPath = normalizePath(path);
181+
await sqlite.upsertDirectory(normalizedPath, 'indexing');
181182

182183
const files = await scanDirectory(path, scanOptions);
183184

@@ -235,10 +236,11 @@ export async function indexDirectories(paths: string[], config: Config): Promise
235236
// Mark directory as completed if no errors for this directory
236237
const directoryErrors = errors.filter(err => err.includes(path));
237238
const directoryStatus = directoryErrors.length > 0 ? 'failed' : 'completed';
238-
await sqlite.upsertDirectory(path, directoryStatus);
239+
await sqlite.upsertDirectory(normalizedPath, directoryStatus);
239240

240241
} catch (error) {
241-
await sqlite.upsertDirectory(path, 'failed');
242+
const normalizedPath = normalizePath(path);
243+
await sqlite.upsertDirectory(normalizedPath, 'failed');
242244
errors.push(`Failed to scan directory ${path}: ${(error as Error).message}`);
243245
}
244246
}

src/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ export async function getIndexStatus(): Promise<IndexStatus> {
455455
COUNT(f.id) as files_count,
456456
COALESCE(SUM(json_array_length(f.chunks_json)), 0) as chunks_count
457457
FROM directories d
458-
LEFT JOIN files f ON f.parent_dirs LIKE '%' || d.path || '%'
458+
LEFT JOIN files f ON f.parent_dirs LIKE '%"' || d.path || '"%'
459459
GROUP BY d.id, d.path, d.status, d.indexed_at
460460
ORDER BY d.indexed_at DESC
461461
`);
@@ -464,7 +464,7 @@ export async function getIndexStatus(): Promise<IndexStatus> {
464464
const directories: DirectoryStatus[] = directoryDetails.map(row => {
465465
const errorsByDirStmt = sqlite.db.prepare(`
466466
SELECT errors_json FROM files
467-
WHERE parent_dirs LIKE '%' || ? || '%' AND errors_json IS NOT NULL
467+
WHERE parent_dirs LIKE '%"' || ? || '"%' AND errors_json IS NOT NULL
468468
`);
469469
const dirErrors = errorsByDirStmt.all(row.path) as { errors_json: string }[];
470470

0 commit comments

Comments
 (0)