Remove .codegraph/config.json and the entire config surface. CodeGraph now indexes every file whose extension maps to a supported language and respects .gitignore everywhere — git repos via git itself, non-git projects via the `ignore` library (root + nested .gitignore files, the same way git does). - Remove CodeGraphConfig/DEFAULT_CONFIG, src/config.ts, and the public config API (the `config` option on init, getConfig/updateConfig/getConfigPath). - Derive the source-file allowlist from EXTENSION_MAP (isSourceFile); maxFileSize is now a constant. Drop the .codegraphignore marker. - Behavior change: committed, non-gitignored dirs (vendor/, a committed dist/) are now indexed — .gitignore is the single source of truth. Earlier inert fields (languages, frameworks, extractDocstrings, trackCallSites, customPatterns) and their dead helpers are removed as part of this. Resolves #283. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5b71a89574
commit
f6772dac7c
16 files changed
+223
-996
No files matched your search
-297
@@ -1,297 +0,0 @@
|
||||
/**
|
||||
* Configuration Management
|
||||
*
|
||||
* Load, save, and validate CodeGraph configuration.
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import picomatch from 'picomatch';
|
||||
import { CodeGraphConfig, DEFAULT_CONFIG, Language, NodeKind } from './types';
|
||||
import { normalizePath } from './utils';
|
||||
|
||||
/**
|
||||
* Configuration filename
|
||||
*/
|
||||
export const CONFIG_FILENAME = 'config.json';
|
||||
|
||||
/**
|
||||
* Get the config file path for a project
|
||||
*/
|
||||
export function getConfigPath(projectRoot: string): string {
|
||||
return path.join(projectRoot, '.codegraph', CONFIG_FILENAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a regex pattern is safe from ReDoS attacks.
|
||||
*
|
||||
* Rejects patterns with nested quantifiers (e.g., (a+)+, (a*)*) which
|
||||
* are the primary source of catastrophic backtracking. Also rejects
|
||||
* excessively long patterns and validates compilability.
|
||||
*/
|
||||
function isSafeRegex(pattern: string): boolean {
|
||||
// Reject excessively long patterns
|
||||
if (pattern.length > 500) return false;
|
||||
|
||||
// Reject nested quantifiers: (...)+ followed by +, *, or {
|
||||
// These are the primary cause of catastrophic backtracking
|
||||
if (/([+*}])\s*[+*{]/.test(pattern)) return false;
|
||||
if (/\([^)]*[+*][^)]*\)[+*{]/.test(pattern)) return false;
|
||||
|
||||
// Verify the pattern is a valid regex
|
||||
try {
|
||||
new RegExp(pattern);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a configuration object
|
||||
*/
|
||||
export function validateConfig(config: unknown): config is CodeGraphConfig {
|
||||
if (typeof config !== 'object' || config === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const c = config as Record<string, unknown>;
|
||||
|
||||
// Required fields
|
||||
if (typeof c.version !== 'number') return false;
|
||||
if (typeof c.rootDir !== 'string') return false;
|
||||
if (!Array.isArray(c.include)) return false;
|
||||
if (!Array.isArray(c.exclude)) return false;
|
||||
if (!Array.isArray(c.languages)) return false;
|
||||
if (!Array.isArray(c.frameworks)) return false;
|
||||
if (typeof c.maxFileSize !== 'number') return false;
|
||||
if (typeof c.extractDocstrings !== 'boolean') return false;
|
||||
if (typeof c.trackCallSites !== 'boolean') return false;
|
||||
|
||||
// Validate include/exclude are string arrays
|
||||
if (!c.include.every((p) => typeof p === 'string')) return false;
|
||||
if (!c.exclude.every((p) => typeof p === 'string')) return false;
|
||||
|
||||
// Validate languages
|
||||
const validLanguages: Language[] = [
|
||||
'typescript',
|
||||
'javascript',
|
||||
'python',
|
||||
'go',
|
||||
'rust',
|
||||
'java',
|
||||
'svelte',
|
||||
'unknown',
|
||||
];
|
||||
if (!c.languages.every((l) => validLanguages.includes(l as Language))) return false;
|
||||
|
||||
// Validate frameworks
|
||||
for (const fw of c.frameworks) {
|
||||
if (typeof fw !== 'object' || fw === null) return false;
|
||||
const framework = fw as Record<string, unknown>;
|
||||
if (typeof framework.name !== 'string') return false;
|
||||
}
|
||||
|
||||
// Validate custom patterns if present
|
||||
if (c.customPatterns !== undefined) {
|
||||
if (!Array.isArray(c.customPatterns)) return false;
|
||||
for (const pattern of c.customPatterns) {
|
||||
if (typeof pattern !== 'object' || pattern === null) return false;
|
||||
const p = pattern as Record<string, unknown>;
|
||||
if (typeof p.name !== 'string') return false;
|
||||
if (typeof p.pattern !== 'string') return false;
|
||||
if (typeof p.kind !== 'string') return false;
|
||||
|
||||
// Validate regex is compilable and reject patterns with known ReDoS risks
|
||||
if (!isSafeRegex(p.pattern)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge configuration with defaults
|
||||
*/
|
||||
function mergeConfig(
|
||||
defaults: CodeGraphConfig,
|
||||
overrides: Partial<CodeGraphConfig>
|
||||
): CodeGraphConfig {
|
||||
return {
|
||||
version: overrides.version ?? defaults.version,
|
||||
rootDir: overrides.rootDir ?? defaults.rootDir,
|
||||
include: overrides.include ?? defaults.include,
|
||||
exclude: overrides.exclude ?? defaults.exclude,
|
||||
languages: overrides.languages ?? defaults.languages,
|
||||
frameworks: overrides.frameworks ?? defaults.frameworks,
|
||||
maxFileSize: overrides.maxFileSize ?? defaults.maxFileSize,
|
||||
extractDocstrings: overrides.extractDocstrings ?? defaults.extractDocstrings,
|
||||
trackCallSites: overrides.trackCallSites ?? defaults.trackCallSites,
|
||||
customPatterns: overrides.customPatterns ?? defaults.customPatterns,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Load configuration from a project
|
||||
*/
|
||||
export function loadConfig(projectRoot: string): CodeGraphConfig {
|
||||
const configPath = getConfigPath(projectRoot);
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
// Return default config with adjusted rootDir
|
||||
return {
|
||||
...DEFAULT_CONFIG,
|
||||
rootDir: projectRoot,
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const content = fs.readFileSync(configPath, 'utf-8');
|
||||
const parsed = JSON.parse(content) as unknown;
|
||||
|
||||
// Merge with defaults to ensure all fields are present
|
||||
const merged = mergeConfig(DEFAULT_CONFIG, parsed as Partial<CodeGraphConfig>);
|
||||
merged.rootDir = projectRoot; // Always use actual project root
|
||||
|
||||
if (!validateConfig(merged)) {
|
||||
throw new Error('Invalid configuration format');
|
||||
}
|
||||
|
||||
return merged;
|
||||
} catch (error) {
|
||||
if (error instanceof SyntaxError) {
|
||||
throw new Error(`Invalid JSON in config file: ${configPath}`);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save configuration to a project
|
||||
*/
|
||||
export function saveConfig(projectRoot: string, config: CodeGraphConfig): void {
|
||||
const configPath = getConfigPath(projectRoot);
|
||||
const dir = path.dirname(configPath);
|
||||
|
||||
// Ensure directory exists
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
|
||||
// Create a copy without rootDir (it's always derived from project path)
|
||||
const toSave = { ...config };
|
||||
delete (toSave as Partial<CodeGraphConfig>).rootDir;
|
||||
|
||||
const content = JSON.stringify(toSave, null, 2);
|
||||
|
||||
// Atomic write: write to temp file then rename to prevent partial/corrupt configs
|
||||
const tmpPath = configPath + '.tmp';
|
||||
fs.writeFileSync(tmpPath, content, 'utf-8');
|
||||
fs.renameSync(tmpPath, configPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create default configuration for a new project
|
||||
*/
|
||||
export function createDefaultConfig(projectRoot: string): CodeGraphConfig {
|
||||
return {
|
||||
...DEFAULT_CONFIG,
|
||||
rootDir: projectRoot,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Update specific configuration values
|
||||
*/
|
||||
export function updateConfig(
|
||||
projectRoot: string,
|
||||
updates: Partial<CodeGraphConfig>
|
||||
): CodeGraphConfig {
|
||||
const current = loadConfig(projectRoot);
|
||||
const updated = mergeConfig(current, updates);
|
||||
updated.rootDir = projectRoot;
|
||||
saveConfig(projectRoot, updated);
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add patterns to include list
|
||||
*/
|
||||
export function addIncludePatterns(projectRoot: string, patterns: string[]): CodeGraphConfig {
|
||||
const config = loadConfig(projectRoot);
|
||||
const newPatterns = patterns.filter((p) => !config.include.includes(p));
|
||||
config.include = [...config.include, ...newPatterns];
|
||||
saveConfig(projectRoot, config);
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add patterns to exclude list
|
||||
*/
|
||||
export function addExcludePatterns(projectRoot: string, patterns: string[]): CodeGraphConfig {
|
||||
const config = loadConfig(projectRoot);
|
||||
const newPatterns = patterns.filter((p) => !config.exclude.includes(p));
|
||||
config.exclude = [...config.exclude, ...newPatterns];
|
||||
saveConfig(projectRoot, config);
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom pattern
|
||||
*/
|
||||
export function addCustomPattern(
|
||||
projectRoot: string,
|
||||
name: string,
|
||||
pattern: string,
|
||||
kind: NodeKind
|
||||
): CodeGraphConfig {
|
||||
const config = loadConfig(projectRoot);
|
||||
|
||||
if (!config.customPatterns) {
|
||||
config.customPatterns = [];
|
||||
}
|
||||
|
||||
// Check for duplicate name
|
||||
const existing = config.customPatterns.find((p) => p.name === name);
|
||||
if (existing) {
|
||||
existing.pattern = pattern;
|
||||
existing.kind = kind;
|
||||
} else {
|
||||
config.customPatterns.push({ name, pattern, kind });
|
||||
}
|
||||
|
||||
saveConfig(projectRoot, config);
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
const matchesPattern = (pattern: string, filePath: string): boolean => {
|
||||
return picomatch.isMatch(filePath, pattern, { dot: true });
|
||||
};
|
||||
|
||||
// Check exclude patterns first
|
||||
for (const pattern of config.exclude) {
|
||||
if (matchesPattern(pattern, filePath)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check include patterns
|
||||
for (const pattern of config.include) {
|
||||
if (matchesPattern(pattern, filePath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Default to not including if no pattern matches
|
||||
return false;
|
||||
}
|
||||
@@ -94,6 +94,17 @@ export const EXTENSION_MAP: Record<string, Language> = {
|
||||
'.luau': 'luau',
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether a file is one CodeGraph can parse, based purely on its extension.
|
||||
* This is the single source of truth for "should we index this file" — derived
|
||||
* from EXTENSION_MAP so parser support and indexing selection never drift.
|
||||
*/
|
||||
export function isSourceFile(filePath: string): boolean {
|
||||
const dot = filePath.lastIndexOf('.');
|
||||
if (dot < 0) return false;
|
||||
return filePath.slice(dot).toLowerCase() in EXTENSION_MAP;
|
||||
}
|
||||
|
||||
/**
|
||||
* Caches for loaded grammars and parsers
|
||||
*/
|
||||
|
||||
+79
-102
@@ -14,14 +14,13 @@ import {
|
||||
FileRecord,
|
||||
ExtractionResult,
|
||||
ExtractionError,
|
||||
CodeGraphConfig,
|
||||
} from '../types';
|
||||
import { QueryBuilder } from '../db/queries';
|
||||
import { extractFromSource } from './tree-sitter';
|
||||
import { detectLanguage, isLanguageSupported, initGrammars, loadGrammarsForLanguages } from './grammars';
|
||||
import { detectLanguage, isSourceFile, isLanguageSupported, initGrammars, loadGrammarsForLanguages } from './grammars';
|
||||
import { logDebug, logWarn } from '../errors';
|
||||
import { validatePathWithinRoot, normalizePath } from '../utils';
|
||||
import picomatch from 'picomatch';
|
||||
import ignore, { Ignore } from 'ignore';
|
||||
import { detectFrameworks } from '../resolution/frameworks';
|
||||
import type { ResolutionContext } from '../resolution/types';
|
||||
|
||||
@@ -94,36 +93,11 @@ export function hashContent(content: string): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a path matches any glob pattern (simplified)
|
||||
* Skip files larger than this (bytes). Generated bundles, minified JS, and
|
||||
* vendored blobs blow the WASM heap and the worker-recycle budget for no useful
|
||||
* symbols. 1 MB covers essentially all hand-written source.
|
||||
*/
|
||||
function matchesGlob(filePath: string, pattern: string): boolean {
|
||||
filePath = normalizePath(filePath);
|
||||
return picomatch.isMatch(filePath, pattern, { dot: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file should be included based on config
|
||||
*/
|
||||
export function shouldIncludeFile(
|
||||
filePath: string,
|
||||
config: CodeGraphConfig
|
||||
): boolean {
|
||||
// Check exclude patterns first
|
||||
for (const pattern of config.exclude) {
|
||||
if (matchesGlob(filePath, pattern)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check include patterns
|
||||
for (const pattern of config.include) {
|
||||
if (matchesGlob(filePath, pattern)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
const MAX_FILE_SIZE = 1024 * 1024;
|
||||
|
||||
/**
|
||||
* Collect git-visible files (tracked + untracked, .gitignore-respected) from the
|
||||
@@ -230,7 +204,7 @@ interface GitChanges {
|
||||
* Use `git status` to detect changed files instead of scanning every file.
|
||||
* Returns null on failure so callers fall back to full scan.
|
||||
*/
|
||||
function getGitChangedFiles(rootDir: string, config: CodeGraphConfig): GitChanges | null {
|
||||
function getGitChangedFiles(rootDir: string): GitChanges | null {
|
||||
try {
|
||||
const output = execFileSync(
|
||||
'git',
|
||||
@@ -248,8 +222,8 @@ function getGitChangedFiles(rootDir: string, config: CodeGraphConfig): GitChange
|
||||
const statusCode = line.substring(0, 2);
|
||||
const filePath = normalizePath(line.substring(3));
|
||||
|
||||
// Skip files that don't match include/exclude config
|
||||
if (!shouldIncludeFile(filePath, config)) continue;
|
||||
// Skip non-source files (git status already omits .gitignored paths).
|
||||
if (!isSourceFile(filePath)) continue;
|
||||
|
||||
if (statusCode === '??') {
|
||||
added.push(filePath);
|
||||
@@ -268,20 +242,14 @@ function getGitChangedFiles(rootDir: string, config: CodeGraphConfig): GitChange
|
||||
}
|
||||
|
||||
/**
|
||||
* Marker file name that indicates a directory (and all children) should be skipped
|
||||
*/
|
||||
const CODEGRAPH_IGNORE_MARKER = '.codegraphignore';
|
||||
|
||||
/**
|
||||
* Recursively scan directory for source files.
|
||||
* Recursively scan a directory for source files.
|
||||
*
|
||||
* In git repos, uses `git ls-files` to get the file list (inherently
|
||||
* respects .gitignore at all levels), then filters by config include patterns.
|
||||
* Falls back to filesystem walk for non-git projects.
|
||||
* In git repos, uses `git ls-files` (inherently respects .gitignore at all
|
||||
* levels), then keeps files with a supported source extension. For non-git
|
||||
* projects, falls back to a filesystem walk that parses .gitignore itself.
|
||||
*/
|
||||
export function scanDirectory(
|
||||
rootDir: string,
|
||||
config: CodeGraphConfig,
|
||||
onProgress?: (current: number, file: string) => void
|
||||
): string[] {
|
||||
// Fast path: use git to get all visible files (respects .gitignore everywhere)
|
||||
@@ -290,7 +258,7 @@ export function scanDirectory(
|
||||
const files: string[] = [];
|
||||
let count = 0;
|
||||
for (const filePath of gitFiles) {
|
||||
if (shouldIncludeFile(filePath, config)) {
|
||||
if (isSourceFile(filePath)) {
|
||||
files.push(filePath);
|
||||
count++;
|
||||
onProgress?.(count, filePath);
|
||||
@@ -300,7 +268,7 @@ export function scanDirectory(
|
||||
}
|
||||
|
||||
// Fallback: walk filesystem for non-git projects
|
||||
return scanDirectoryWalk(rootDir, config, onProgress);
|
||||
return scanDirectoryWalk(rootDir, onProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -309,7 +277,6 @@ export function scanDirectory(
|
||||
*/
|
||||
export async function scanDirectoryAsync(
|
||||
rootDir: string,
|
||||
config: CodeGraphConfig,
|
||||
onProgress?: (current: number, file: string) => void
|
||||
): Promise<string[]> {
|
||||
const gitFiles = getGitVisibleFiles(rootDir);
|
||||
@@ -317,7 +284,7 @@ export async function scanDirectoryAsync(
|
||||
const files: string[] = [];
|
||||
let count = 0;
|
||||
for (const filePath of gitFiles) {
|
||||
if (shouldIncludeFile(filePath, config)) {
|
||||
if (isSourceFile(filePath)) {
|
||||
files.push(filePath);
|
||||
count++;
|
||||
onProgress?.(count, filePath);
|
||||
@@ -330,7 +297,7 @@ export async function scanDirectoryAsync(
|
||||
return files;
|
||||
}
|
||||
|
||||
return scanDirectoryWalk(rootDir, config, onProgress);
|
||||
return scanDirectoryWalk(rootDir, onProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -338,14 +305,44 @@ export async function scanDirectoryAsync(
|
||||
*/
|
||||
function scanDirectoryWalk(
|
||||
rootDir: string,
|
||||
config: CodeGraphConfig,
|
||||
onProgress?: (current: number, file: string) => void
|
||||
): string[] {
|
||||
const files: string[] = [];
|
||||
let count = 0;
|
||||
const visitedDirs = new Set<string>();
|
||||
|
||||
function walk(dir: string): void {
|
||||
// A .gitignore matcher scoped to the directory that declared it. Patterns in
|
||||
// a nested .gitignore are relative to that directory, so we keep the dir
|
||||
// alongside the matcher and test paths relative to it — mirroring how git
|
||||
// applies .gitignore files at every level.
|
||||
interface ScopedIgnore {
|
||||
dir: string;
|
||||
ig: Ignore;
|
||||
}
|
||||
|
||||
const loadIgnore = (dir: string): ScopedIgnore | null => {
|
||||
try {
|
||||
const giPath = path.join(dir, '.gitignore');
|
||||
if (fs.existsSync(giPath)) {
|
||||
return { dir, ig: ignore().add(fs.readFileSync(giPath, 'utf-8')) };
|
||||
}
|
||||
} catch {
|
||||
// Unreadable .gitignore — treat as absent.
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const isIgnored = (fullPath: string, isDir: boolean, matchers: ScopedIgnore[]): boolean => {
|
||||
for (const { dir, ig } of matchers) {
|
||||
let rel = normalizePath(path.relative(dir, fullPath));
|
||||
if (!rel || rel.startsWith('..')) continue; // not under this matcher's dir
|
||||
if (isDir) rel += '/'; // dir-only rules (e.g. `build/`) only match with the slash
|
||||
if (ig.ignores(rel)) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function walk(dir: string, matchers: ScopedIgnore[]): void {
|
||||
let realDir: string;
|
||||
try {
|
||||
realDir = fs.realpathSync(dir);
|
||||
@@ -360,12 +357,9 @@ function scanDirectoryWalk(
|
||||
}
|
||||
visitedDirs.add(realDir);
|
||||
|
||||
// Check for .codegraphignore marker file
|
||||
const ignoreMarker = path.join(dir, CODEGRAPH_IGNORE_MARKER);
|
||||
if (fs.existsSync(ignoreMarker)) {
|
||||
logDebug('Skipping directory due to .codegraphignore marker', { dir });
|
||||
return;
|
||||
}
|
||||
// This directory's own .gitignore (if present) applies to everything below it.
|
||||
const own = loadIgnore(dir);
|
||||
const active = own ? [...matchers, own] : matchers;
|
||||
|
||||
let entries: fs.Dirent[];
|
||||
try {
|
||||
@@ -376,6 +370,9 @@ function scanDirectoryWalk(
|
||||
}
|
||||
|
||||
for (const entry of entries) {
|
||||
// Never descend into git internals or our own data directory.
|
||||
if (entry.name === '.git' || entry.name === '.codegraph') continue;
|
||||
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
const relativePath = normalizePath(path.relative(rootDir, fullPath));
|
||||
|
||||
@@ -384,19 +381,11 @@ function scanDirectoryWalk(
|
||||
const realTarget = fs.realpathSync(fullPath);
|
||||
const stat = fs.statSync(realTarget);
|
||||
if (stat.isDirectory()) {
|
||||
const dirPattern = relativePath + '/';
|
||||
let excluded = false;
|
||||
for (const pattern of config.exclude) {
|
||||
if (matchesGlob(dirPattern, pattern) || matchesGlob(relativePath, pattern)) {
|
||||
excluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!excluded) {
|
||||
walk(fullPath);
|
||||
if (!isIgnored(fullPath, true, active)) {
|
||||
walk(fullPath, active);
|
||||
}
|
||||
} else if (stat.isFile()) {
|
||||
if (shouldIncludeFile(relativePath, config)) {
|
||||
if (!isIgnored(fullPath, false, active) && isSourceFile(relativePath)) {
|
||||
files.push(relativePath);
|
||||
count++;
|
||||
onProgress?.(count, relativePath);
|
||||
@@ -409,19 +398,11 @@ function scanDirectoryWalk(
|
||||
}
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
const dirPattern = relativePath + '/';
|
||||
let excluded = false;
|
||||
for (const pattern of config.exclude) {
|
||||
if (matchesGlob(dirPattern, pattern) || matchesGlob(relativePath, pattern)) {
|
||||
excluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!excluded) {
|
||||
walk(fullPath);
|
||||
if (!isIgnored(fullPath, true, active)) {
|
||||
walk(fullPath, active);
|
||||
}
|
||||
} else if (entry.isFile()) {
|
||||
if (shouldIncludeFile(relativePath, config)) {
|
||||
if (!isIgnored(fullPath, false, active) && isSourceFile(relativePath)) {
|
||||
files.push(relativePath);
|
||||
count++;
|
||||
onProgress?.(count, relativePath);
|
||||
@@ -430,7 +411,7 @@ function scanDirectoryWalk(
|
||||
}
|
||||
}
|
||||
|
||||
walk(rootDir);
|
||||
walk(rootDir, []);
|
||||
return files;
|
||||
}
|
||||
|
||||
@@ -439,7 +420,6 @@ function scanDirectoryWalk(
|
||||
*/
|
||||
export class ExtractionOrchestrator {
|
||||
private rootDir: string;
|
||||
private config: CodeGraphConfig;
|
||||
private queries: QueryBuilder;
|
||||
/**
|
||||
* Names of frameworks detected for this project, populated by indexAll().
|
||||
@@ -449,9 +429,8 @@ export class ExtractionOrchestrator {
|
||||
*/
|
||||
private detectedFrameworkNames: string[] | null = null;
|
||||
|
||||
constructor(rootDir: string, config: CodeGraphConfig, queries: QueryBuilder) {
|
||||
constructor(rootDir: string, queries: QueryBuilder) {
|
||||
this.rootDir = rootDir;
|
||||
this.config = config;
|
||||
this.queries = queries;
|
||||
}
|
||||
|
||||
@@ -500,7 +479,7 @@ export class ExtractionOrchestrator {
|
||||
*/
|
||||
private ensureDetectedFrameworks(files?: string[]): string[] {
|
||||
if (this.detectedFrameworkNames !== null) return this.detectedFrameworkNames;
|
||||
const fileList = files ?? scanDirectory(this.rootDir, this.config);
|
||||
const fileList = files ?? scanDirectory(this.rootDir);
|
||||
const context = this.buildDetectionContext(fileList);
|
||||
this.detectedFrameworkNames = detectFrameworks(context).map((r) => r.name);
|
||||
return this.detectedFrameworkNames;
|
||||
@@ -534,7 +513,7 @@ export class ExtractionOrchestrator {
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const files = await scanDirectoryAsync(this.rootDir, this.config, (current, file) => {
|
||||
const files = await scanDirectoryAsync(this.rootDir, (current, file) => {
|
||||
onProgress?.({
|
||||
phase: 'scanning',
|
||||
current,
|
||||
@@ -802,18 +781,16 @@ export class ExtractionOrchestrator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Honour config.maxFileSize. Without this check, vendored
|
||||
// generated headers, minified bundles, and other multi-MB
|
||||
// files get indexed despite the user setting a size cap —
|
||||
// wasting WASM heap and the worker recycle budget on inputs
|
||||
// the user explicitly opted out of. The single-file extractFile
|
||||
// path already enforces this; the bulk path used to silently
|
||||
// skip the check.
|
||||
if (stats.size > this.config.maxFileSize) {
|
||||
// Honour MAX_FILE_SIZE. Without this check, vendored generated
|
||||
// headers, minified bundles, and other multi-MB files get indexed,
|
||||
// wasting WASM heap and the worker recycle budget on inputs with no
|
||||
// useful symbols. The single-file extractFile path already enforces
|
||||
// this; the bulk path used to silently skip the check.
|
||||
if (stats.size > MAX_FILE_SIZE) {
|
||||
processed++;
|
||||
filesSkipped++;
|
||||
errors.push({
|
||||
message: `File exceeds max size (${stats.size} > ${this.config.maxFileSize})`,
|
||||
message: `File exceeds max size (${stats.size} > ${MAX_FILE_SIZE})`,
|
||||
filePath,
|
||||
severity: 'warning',
|
||||
code: 'size_exceeded',
|
||||
@@ -1108,14 +1085,14 @@ export class ExtractionOrchestrator {
|
||||
}
|
||||
|
||||
// Check file size
|
||||
if (stats.size > this.config.maxFileSize) {
|
||||
if (stats.size > MAX_FILE_SIZE) {
|
||||
return {
|
||||
nodes: [],
|
||||
edges: [],
|
||||
unresolvedReferences: [],
|
||||
errors: [
|
||||
{
|
||||
message: `File exceeds max size (${stats.size} > ${this.config.maxFileSize})`,
|
||||
message: `File exceeds max size (${stats.size} > ${MAX_FILE_SIZE})`,
|
||||
filePath: relativePath,
|
||||
severity: 'warning',
|
||||
code: 'size_exceeded',
|
||||
@@ -1245,7 +1222,7 @@ export class ExtractionOrchestrator {
|
||||
});
|
||||
|
||||
const filesToIndex: string[] = [];
|
||||
const gitChanges = getGitChangedFiles(this.rootDir, this.config);
|
||||
const gitChanges = getGitChangedFiles(this.rootDir);
|
||||
|
||||
if (gitChanges) {
|
||||
// === Git fast path ===
|
||||
@@ -1291,7 +1268,7 @@ export class ExtractionOrchestrator {
|
||||
}
|
||||
} else {
|
||||
// === Fallback: full scan (non-git project or git failure) ===
|
||||
const currentFiles = new Set(scanDirectory(this.rootDir, this.config));
|
||||
const currentFiles = new Set(scanDirectory(this.rootDir));
|
||||
filesChecked = currentFiles.size;
|
||||
|
||||
// Build Map for O(1) lookups instead of .find() per file
|
||||
@@ -1376,7 +1353,7 @@ export class ExtractionOrchestrator {
|
||||
* Uses git status as a fast path when available, falling back to full scan.
|
||||
*/
|
||||
getChangedFiles(): { added: string[]; modified: string[]; removed: string[] } {
|
||||
const gitChanges = getGitChangedFiles(this.rootDir, this.config);
|
||||
const gitChanges = getGitChangedFiles(this.rootDir);
|
||||
|
||||
if (gitChanges) {
|
||||
// === Git fast path ===
|
||||
@@ -1420,7 +1397,7 @@ export class ExtractionOrchestrator {
|
||||
}
|
||||
|
||||
// === Fallback: full scan (non-git project or git failure) ===
|
||||
const currentFiles = new Set(scanDirectory(this.rootDir, this.config));
|
||||
const currentFiles = new Set(scanDirectory(this.rootDir));
|
||||
const trackedFiles = this.queries.getAllFiles();
|
||||
|
||||
// Build Map for O(1) lookups
|
||||
@@ -1467,4 +1444,4 @@ export class ExtractionOrchestrator {
|
||||
|
||||
// Re-export useful types and functions
|
||||
export { extractFromSource } from './tree-sitter';
|
||||
export { detectLanguage, isLanguageSupported, isGrammarLoaded, getSupportedLanguages, initGrammars, loadGrammarsForLanguages, loadAllGrammars } from './grammars';
|
||||
export { detectLanguage, isSourceFile, isLanguageSupported, isGrammarLoaded, getSupportedLanguages, initGrammars, loadGrammarsForLanguages, loadAllGrammars } from './grammars';
|
||||
+6
-62
@@ -7,7 +7,6 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import {
|
||||
CodeGraphConfig,
|
||||
Node,
|
||||
Edge,
|
||||
FileRecord,
|
||||
@@ -25,7 +24,6 @@ import {
|
||||
} from './types';
|
||||
import { DatabaseConnection, getDatabasePath } from './db';
|
||||
import { QueryBuilder } from './db/queries';
|
||||
import { loadConfig, saveConfig, createDefaultConfig } from './config';
|
||||
import {
|
||||
isInitialized,
|
||||
createDirectory,
|
||||
@@ -53,7 +51,6 @@ import { FileWatcher, WatchOptions } from './sync';
|
||||
// Re-export types for consumers
|
||||
export * from './types';
|
||||
export { getDatabasePath } from './db';
|
||||
export { getConfigPath } from './config';
|
||||
export {
|
||||
getCodeGraphDir,
|
||||
isInitialized,
|
||||
@@ -85,9 +82,6 @@ export { MCPServer } from './mcp';
|
||||
* Options for initializing a new CodeGraph project
|
||||
*/
|
||||
export interface InitOptions {
|
||||
/** Custom configuration overrides */
|
||||
config?: Partial<CodeGraphConfig>;
|
||||
|
||||
/** Whether to run initial indexing after init */
|
||||
index?: boolean;
|
||||
|
||||
@@ -128,7 +122,6 @@ export interface IndexOptions {
|
||||
export class CodeGraph {
|
||||
private db: DatabaseConnection;
|
||||
private queries: QueryBuilder;
|
||||
private config: CodeGraphConfig;
|
||||
private projectRoot: string;
|
||||
private orchestrator: ExtractionOrchestrator;
|
||||
private resolver: ReferenceResolver;
|
||||
@@ -148,17 +141,15 @@ export class CodeGraph {
|
||||
private constructor(
|
||||
db: DatabaseConnection,
|
||||
queries: QueryBuilder,
|
||||
config: CodeGraphConfig,
|
||||
projectRoot: string
|
||||
) {
|
||||
this.db = db;
|
||||
this.queries = queries;
|
||||
this.config = config;
|
||||
this.projectRoot = projectRoot;
|
||||
this.fileLock = new FileLock(
|
||||
path.join(projectRoot, '.codegraph', 'codegraph.lock')
|
||||
);
|
||||
this.orchestrator = new ExtractionOrchestrator(projectRoot, config, queries);
|
||||
this.orchestrator = new ExtractionOrchestrator(projectRoot, queries);
|
||||
this.resolver = createResolver(projectRoot, queries);
|
||||
this.graphManager = new GraphQueryManager(queries);
|
||||
this.traverser = new GraphTraverser(queries);
|
||||
@@ -194,19 +185,12 @@ export class CodeGraph {
|
||||
// Create directory structure
|
||||
createDirectory(resolvedRoot);
|
||||
|
||||
// Create and save configuration
|
||||
const config = createDefaultConfig(resolvedRoot);
|
||||
if (options.config) {
|
||||
Object.assign(config, options.config);
|
||||
}
|
||||
saveConfig(resolvedRoot, config);
|
||||
|
||||
// Initialize database
|
||||
const dbPath = getDatabasePath(resolvedRoot);
|
||||
const db = DatabaseConnection.initialize(dbPath);
|
||||
const queries = new QueryBuilder(db.getDb());
|
||||
|
||||
const instance = new CodeGraph(db, queries, config, resolvedRoot);
|
||||
const instance = new CodeGraph(db, queries, resolvedRoot);
|
||||
|
||||
// Run initial indexing if requested
|
||||
if (options.index) {
|
||||
@@ -219,7 +203,7 @@ export class CodeGraph {
|
||||
/**
|
||||
* Initialize synchronously (without indexing)
|
||||
*/
|
||||
static initSync(projectRoot: string, options: Omit<InitOptions, 'index' | 'onProgress'> = {}): CodeGraph {
|
||||
static initSync(projectRoot: string): CodeGraph {
|
||||
const resolvedRoot = path.resolve(projectRoot);
|
||||
|
||||
// Check if already initialized
|
||||
@@ -230,19 +214,12 @@ export class CodeGraph {
|
||||
// Create directory structure
|
||||
createDirectory(resolvedRoot);
|
||||
|
||||
// Create and save configuration
|
||||
const config = createDefaultConfig(resolvedRoot);
|
||||
if (options.config) {
|
||||
Object.assign(config, options.config);
|
||||
}
|
||||
saveConfig(resolvedRoot, config);
|
||||
|
||||
// Initialize database
|
||||
const dbPath = getDatabasePath(resolvedRoot);
|
||||
const db = DatabaseConnection.initialize(dbPath);
|
||||
const queries = new QueryBuilder(db.getDb());
|
||||
|
||||
return new CodeGraph(db, queries, config, resolvedRoot);
|
||||
return new CodeGraph(db, queries, resolvedRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,15 +244,12 @@ export class CodeGraph {
|
||||
throw new Error(`Invalid CodeGraph directory: ${validation.errors.join(', ')}`);
|
||||
}
|
||||
|
||||
// Load configuration
|
||||
const config = loadConfig(resolvedRoot);
|
||||
|
||||
// Open database
|
||||
const dbPath = getDatabasePath(resolvedRoot);
|
||||
const db = DatabaseConnection.open(dbPath);
|
||||
const queries = new QueryBuilder(db.getDb());
|
||||
|
||||
const instance = new CodeGraph(db, queries, config, resolvedRoot);
|
||||
const instance = new CodeGraph(db, queries, resolvedRoot);
|
||||
|
||||
// Sync if requested
|
||||
if (options.sync) {
|
||||
@@ -302,15 +276,12 @@ export class CodeGraph {
|
||||
throw new Error(`Invalid CodeGraph directory: ${validation.errors.join(', ')}`);
|
||||
}
|
||||
|
||||
// Load configuration
|
||||
const config = loadConfig(resolvedRoot);
|
||||
|
||||
// Open database
|
||||
const dbPath = getDatabasePath(resolvedRoot);
|
||||
const db = DatabaseConnection.open(dbPath);
|
||||
const queries = new QueryBuilder(db.getDb());
|
||||
|
||||
return new CodeGraph(db, queries, config, resolvedRoot);
|
||||
return new CodeGraph(db, queries, resolvedRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,32 +301,6 @@ export class CodeGraph {
|
||||
this.db.close();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// Configuration
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Get the current configuration
|
||||
*/
|
||||
getConfig(): CodeGraphConfig {
|
||||
return { ...this.config };
|
||||
}
|
||||
|
||||
/**
|
||||
* Update configuration
|
||||
*/
|
||||
updateConfig(updates: Partial<CodeGraphConfig>): void {
|
||||
Object.assign(this.config, updates);
|
||||
saveConfig(this.projectRoot, this.config);
|
||||
// Recreate orchestrator and resolver with new config
|
||||
this.orchestrator = new ExtractionOrchestrator(
|
||||
this.projectRoot,
|
||||
this.config,
|
||||
this.queries
|
||||
);
|
||||
this.resolver = createResolver(this.projectRoot, this.queries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the project root directory
|
||||
*/
|
||||
@@ -515,7 +460,6 @@ export class CodeGraph {
|
||||
|
||||
this.watcher = new FileWatcher(
|
||||
this.projectRoot,
|
||||
this.config,
|
||||
async () => {
|
||||
const result = await this.sync();
|
||||
const filesChanged = result.filesAdded + result.filesModified + result.filesRemoved;
|
||||
|
||||
+4
-8
@@ -9,8 +9,7 @@
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { CodeGraphConfig } from '../types';
|
||||
import { shouldIncludeFile } from '../extraction';
|
||||
import { isSourceFile } from '../extraction';
|
||||
import { logDebug, logWarn } from '../errors';
|
||||
import { normalizePath } from '../utils';
|
||||
import { watchDisabledReason } from './watch-policy';
|
||||
@@ -44,7 +43,7 @@ export interface WatchOptions {
|
||||
* Design goals:
|
||||
* - Minimal resource usage (native OS file events, no polling)
|
||||
* - Debounced to avoid thrashing on rapid saves
|
||||
* - Filters against CodeGraph include/exclude patterns
|
||||
* - Filters to supported source files by extension
|
||||
* - Ignores .codegraph/ directory changes
|
||||
*/
|
||||
export class FileWatcher {
|
||||
@@ -55,7 +54,6 @@ export class FileWatcher {
|
||||
private stopped = false;
|
||||
|
||||
private readonly projectRoot: string;
|
||||
private readonly config: CodeGraphConfig;
|
||||
private readonly debounceMs: number;
|
||||
private readonly syncFn: () => Promise<{ filesChanged: number; durationMs: number }>;
|
||||
private readonly onSyncComplete?: WatchOptions['onSyncComplete'];
|
||||
@@ -63,12 +61,10 @@ export class FileWatcher {
|
||||
|
||||
constructor(
|
||||
projectRoot: string,
|
||||
config: CodeGraphConfig,
|
||||
syncFn: () => Promise<{ filesChanged: number; durationMs: number }>,
|
||||
options: WatchOptions = {}
|
||||
) {
|
||||
this.projectRoot = projectRoot;
|
||||
this.config = config;
|
||||
this.syncFn = syncFn;
|
||||
this.debounceMs = options.debounceMs ?? 2000;
|
||||
this.onSyncComplete = options.onSyncComplete;
|
||||
@@ -112,8 +108,8 @@ export class FileWatcher {
|
||||
return;
|
||||
}
|
||||
|
||||
// Filter against include/exclude patterns
|
||||
if (!shouldIncludeFile(normalized, this.config)) {
|
||||
// Only sync changes to files we can actually parse.
|
||||
if (!isSourceFile(normalized)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
-291
@@ -426,297 +426,6 @@ export interface CodeBlock {
|
||||
node?: Node;
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Configuration Types
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Framework-specific hints for better extraction
|
||||
*/
|
||||
export interface FrameworkHint {
|
||||
/** Framework name (react, express, django, etc.) */
|
||||
name: string;
|
||||
|
||||
/** Version constraint if relevant */
|
||||
version?: string;
|
||||
|
||||
/** Custom patterns for this framework */
|
||||
patterns?: {
|
||||
/** Component detection patterns */
|
||||
components?: string[];
|
||||
/** Route detection patterns */
|
||||
routes?: string[];
|
||||
/** Model detection patterns */
|
||||
models?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for a CodeGraph project
|
||||
*/
|
||||
export interface CodeGraphConfig {
|
||||
/** Schema version for migrations */
|
||||
version: number;
|
||||
|
||||
/** Root directory of the project */
|
||||
rootDir: string;
|
||||
|
||||
/** Glob patterns for files to include */
|
||||
include: string[];
|
||||
|
||||
/** Glob patterns for files to exclude */
|
||||
exclude: string[];
|
||||
|
||||
/** Languages to process (auto-detected if empty) */
|
||||
languages: Language[];
|
||||
|
||||
/** Framework hints for better extraction */
|
||||
frameworks: FrameworkHint[];
|
||||
|
||||
/** Maximum file size to process (in bytes) */
|
||||
maxFileSize: number;
|
||||
|
||||
/** Whether to extract docstrings */
|
||||
extractDocstrings: boolean;
|
||||
|
||||
/** Whether to track call sites */
|
||||
trackCallSites: boolean;
|
||||
|
||||
/** Custom symbol patterns to extract */
|
||||
customPatterns?: {
|
||||
/** Name for this pattern group */
|
||||
name: string;
|
||||
/** Regex pattern to match */
|
||||
pattern: string;
|
||||
/** Node kind to assign */
|
||||
kind: NodeKind;
|
||||
}[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Default configuration values
|
||||
*/
|
||||
export const DEFAULT_CONFIG: CodeGraphConfig = {
|
||||
version: 1,
|
||||
rootDir: '.',
|
||||
include: [
|
||||
// TypeScript/JavaScript
|
||||
'**/*.ts',
|
||||
'**/*.tsx',
|
||||
'**/*.js',
|
||||
'**/*.jsx',
|
||||
// Python
|
||||
'**/*.py',
|
||||
// Go
|
||||
'**/*.go',
|
||||
// Rust
|
||||
'**/*.rs',
|
||||
// Java
|
||||
'**/*.java',
|
||||
// C/C++
|
||||
'**/*.c',
|
||||
'**/*.h',
|
||||
'**/*.cpp',
|
||||
'**/*.hpp',
|
||||
'**/*.cc',
|
||||
'**/*.cxx',
|
||||
// C#
|
||||
'**/*.cs',
|
||||
// PHP
|
||||
'**/*.php',
|
||||
// Drupal-specific PHP extensions
|
||||
'**/*.module',
|
||||
'**/*.install',
|
||||
'**/*.theme',
|
||||
'**/*.inc',
|
||||
// Drupal routing YAML
|
||||
'**/*.routing.yml',
|
||||
// Twig templates
|
||||
'**/*.twig',
|
||||
// Ruby
|
||||
'**/*.rb',
|
||||
// Swift
|
||||
'**/*.swift',
|
||||
// Kotlin
|
||||
'**/*.kt',
|
||||
'**/*.kts',
|
||||
// Dart
|
||||
'**/*.dart',
|
||||
// Svelte
|
||||
'**/*.svelte',
|
||||
// Vue
|
||||
'**/*.vue',
|
||||
// Liquid (Shopify themes)
|
||||
'**/*.liquid',
|
||||
// Pascal / Delphi
|
||||
'**/*.pas',
|
||||
'**/*.dpr',
|
||||
'**/*.dpk',
|
||||
'**/*.lpr',
|
||||
'**/*.dfm',
|
||||
'**/*.fmx',
|
||||
// Scala
|
||||
'**/*.scala',
|
||||
'**/*.sc',
|
||||
// Lua
|
||||
'**/*.lua',
|
||||
// Luau
|
||||
'**/*.luau',
|
||||
],
|
||||
exclude: [
|
||||
// Version control
|
||||
'**/.git/**',
|
||||
|
||||
// Dependencies
|
||||
'**/node_modules/**',
|
||||
'**/vendor/**',
|
||||
'**/Pods/**',
|
||||
|
||||
// Generic build outputs
|
||||
'**/dist/**',
|
||||
'**/build/**',
|
||||
'**/out/**',
|
||||
'**/bin/**',
|
||||
'**/obj/**',
|
||||
'**/target/**',
|
||||
|
||||
// JavaScript/TypeScript
|
||||
'**/*.min.js',
|
||||
'**/*.bundle.js',
|
||||
'**/.next/**',
|
||||
'**/.nuxt/**',
|
||||
'**/.svelte-kit/**',
|
||||
'**/.output/**',
|
||||
'**/.turbo/**',
|
||||
'**/.cache/**',
|
||||
'**/.parcel-cache/**',
|
||||
'**/.vite/**',
|
||||
'**/.astro/**',
|
||||
'**/.docusaurus/**',
|
||||
'**/.gatsby/**',
|
||||
'**/.webpack/**',
|
||||
'**/.nx/**',
|
||||
'**/.yarn/cache/**',
|
||||
'**/.pnpm-store/**',
|
||||
'**/storybook-static/**',
|
||||
|
||||
// React Native / Expo
|
||||
'**/.expo/**',
|
||||
'**/web-build/**',
|
||||
'**/ios/Pods/**',
|
||||
'**/ios/build/**',
|
||||
'**/android/build/**',
|
||||
'**/android/.gradle/**',
|
||||
|
||||
// Python
|
||||
'**/__pycache__/**',
|
||||
'**/.venv/**',
|
||||
'**/venv/**',
|
||||
'**/site-packages/**',
|
||||
'**/dist-packages/**',
|
||||
'**/.pytest_cache/**',
|
||||
'**/.mypy_cache/**',
|
||||
'**/.ruff_cache/**',
|
||||
'**/.tox/**',
|
||||
'**/.nox/**',
|
||||
'**/*.egg-info/**',
|
||||
'**/.eggs/**',
|
||||
|
||||
// Go
|
||||
'**/go/pkg/mod/**',
|
||||
|
||||
// Rust
|
||||
'**/target/debug/**',
|
||||
'**/target/release/**',
|
||||
|
||||
// Java/Kotlin/Gradle
|
||||
'**/.gradle/**',
|
||||
'**/.m2/**',
|
||||
'**/generated-sources/**',
|
||||
'**/.kotlin/**',
|
||||
|
||||
// Dart/Flutter
|
||||
'**/.dart_tool/**',
|
||||
|
||||
// C#/.NET
|
||||
'**/.vs/**',
|
||||
'**/.nuget/**',
|
||||
'**/artifacts/**',
|
||||
'**/publish/**',
|
||||
|
||||
// C/C++
|
||||
'**/cmake-build-*/**',
|
||||
'**/CMakeFiles/**',
|
||||
'**/bazel-*/**',
|
||||
'**/vcpkg_installed/**',
|
||||
'**/.conan/**',
|
||||
'**/Debug/**',
|
||||
'**/Release/**',
|
||||
'**/x64/**',
|
||||
'**/.pio/**', // Platform.io (IoT/embedded build artifacts and library deps)
|
||||
|
||||
// Electron
|
||||
'**/release/**',
|
||||
'**/*.app/**',
|
||||
'**/*.asar',
|
||||
|
||||
// Swift/iOS/Xcode
|
||||
'**/DerivedData/**',
|
||||
'**/.build/**',
|
||||
'**/.swiftpm/**',
|
||||
'**/xcuserdata/**',
|
||||
'**/Carthage/Build/**',
|
||||
'**/SourcePackages/**',
|
||||
|
||||
// Delphi/Pascal
|
||||
'**/__history/**',
|
||||
'**/__recovery/**',
|
||||
'**/*.dcu',
|
||||
|
||||
// PHP
|
||||
'**/.composer/**',
|
||||
'**/storage/framework/**',
|
||||
'**/bootstrap/cache/**',
|
||||
|
||||
// Drupal - core and contrib are rarely customised; index only custom code
|
||||
'**/web/core/**',
|
||||
'**/web/modules/contrib/**',
|
||||
'**/web/themes/contrib/**',
|
||||
|
||||
// Ruby
|
||||
'**/.bundle/**',
|
||||
'**/tmp/cache/**',
|
||||
'**/public/assets/**',
|
||||
'**/public/packs/**',
|
||||
'**/.yardoc/**',
|
||||
|
||||
// Testing/Coverage
|
||||
'**/coverage/**',
|
||||
'**/htmlcov/**',
|
||||
'**/.nyc_output/**',
|
||||
'**/test-results/**',
|
||||
'**/.coverage/**',
|
||||
|
||||
// IDE/Editor
|
||||
'**/.idea/**',
|
||||
|
||||
// Logs and temp
|
||||
'**/logs/**',
|
||||
'**/tmp/**',
|
||||
'**/temp/**',
|
||||
|
||||
// Documentation build output
|
||||
'**/_build/**',
|
||||
'**/docs/_build/**',
|
||||
'**/site/**',
|
||||
],
|
||||
languages: [],
|
||||
frameworks: [],
|
||||
maxFileSize: 1024 * 1024, // 1MB
|
||||
extractDocstrings: true,
|
||||
trackCallSites: true,
|
||||
};
|
||||
|
||||
// =============================================================================
|
||||
// Database Types
|
||||
// =============================================================================
|
||||
|
||||
Reference in new issue
Block a user