Fix .gitignore support and Windows path separator bug in scanner

Normalize paths to forward slashes in matchesGlob() and scanDirectory()
so glob exclude patterns work on Windows. Add getGitIgnoredDirectories()
using git ls-files to skip .gitignore'd directories during indexing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-02-10 04:08:10 -06:00
co-authored by Claude Opus 4.6
parent 4825661e02
commit 62a6cf38fe
4 changed files with 158 additions and 3 deletions
+4
View File
@@ -7,6 +7,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { CodeGraphConfig, DEFAULT_CONFIG, Language, NodeKind } from './types';
import { normalizePath } from './utils';
/**
* Configuration filename
@@ -240,6 +241,9 @@ export function addCustomPattern(
* Check if a file path matches the include/exclude patterns
*/
export function shouldIncludeFile(filePath: string, config: CodeGraphConfig): boolean {
// Normalize to forward slashes so Windows backslash paths match glob patterns
filePath = normalizePath(filePath);
// Simple glob matching (for now, just check if any pattern matches)
// A full implementation would use a proper glob library