arela
Version:
AI-powered CTO with multi-agent orchestration, code summarization, visual testing (web + mobile) for blazing fast development.
123 lines • 2.97 kB
TypeScript
/**
* GraphDB - SQLite interface for storing and querying codebase graph
*/
import { FileNode, FunctionNode, ApiEndpoint, ApiCall } from "./types.js";
export declare class GraphDB {
private db;
private dbPath;
constructor(dbPath: string);
/**
* Initialize database schema
*/
private initSchema;
/**
* Add a file to the database
*/
addFile(file: FileNode): number;
/**
* Add a function to the database
*/
addFunction(fileId: number, func: FunctionNode): number;
/**
* Add an import relationship
*/
addImport(fromFileId: number, toFileId: number | null, toModule: string | null, importType: string, importedNames: string[], line: number): void;
/**
* Add a function call relationship
*/
addFunctionCall(callerFunctionId: number, calleeFunctionId: number | null, calleeName: string | null, line: number): void;
/**
* Add an API endpoint
*/
addApiEndpoint(endpoint: ApiEndpoint): void;
/**
* Add an API call
*/
addApiCall(fileId: number, call: ApiCall): void;
/**
* Get file ID by path
*/
getFileId(filePath: string): number | null;
/**
* Get function ID by name and file ID
*/
getFunctionId(fileId: number, functionName: string): number | null;
/**
* Query the database
*/
query(sql: string, params?: any[]): any[];
/**
* Execute raw SQL
*/
exec(sql: string): void;
/**
* Begin transaction
*/
beginTransaction(): void;
/**
* Commit transaction
*/
commit(): void;
/**
* Rollback transaction
*/
rollback(): void;
/**
* Get summary statistics
*/
getSummary(): {
filesCount: number;
functionsCount: number;
importsCount: number;
functionCallsCount: number;
apiEndpointsCount: number;
apiCallsCount: number;
};
/**
* Clear all data (for refresh)
*/
clear(): void;
/**
* Update metadata (e.g., last_ingest_time)
*/
setMetadata(key: string, value: string): void;
/**
* Get metadata value
*/
getMetadata(key: string): string | null;
/**
* Check if graph is stale (> 24 hours old)
*/
isStale(maxAgeHours?: number): boolean;
/**
* Get all files
*/
getAllFiles(): Array<{
id: number;
path: string;
repo: string;
type: string;
lines: number;
}>;
/**
* Get all imports with file details
*/
getAllImports(): Array<{
id: number;
from_file_id: number;
to_file_id: number | null;
from_module?: string;
to_module: string | null;
from_file?: {
path: string;
};
to_file?: {
path: string;
};
}>;
/**
* Close the database connection
*/
close(): void;
}
//# sourceMappingURL=storage.d.ts.map