@traversets/code-extractor
Version:
The TypeScript Code Extractor and Analyzer can be handy for RAG (Retrieval-Augmented Generation) systems for codebases. It provides a detailed and structured representation of the codebase that can be converted into embeddings, enabling more effective adv
71 lines (70 loc) • 2.03 kB
TypeScript
import { RequestHeader } from "../core/constants";
export type HeadersType = {
[key in keyof RequestHeader]: string;
};
export interface IRequestOptions {
hostname: string;
path: string;
method: string;
headers?: any;
jwtToken?: string;
}
import ts from "typescript";
export interface IFunctionInfo {
name: string;
content: string;
parameters: IProperty[];
returnType?: string;
comments?: string;
summary?: string;
kind?: string;
}
export interface IClassInfo {
name?: string;
functions: IFunctionInfo[];
properties: IProperty[];
summary?: string;
imports?: string;
interfaces?: IInterfaceInfo[];
enums?: IEnumInfo[];
}
export interface IInterfaceInfo {
name: string;
properties: IProperty[];
summary?: string;
}
export interface IEnumInfo {
name: string;
members: IProperty[];
summary?: string;
}
export interface IModuleInfo {
name?: string;
path: string;
classes?: IClassInfo[];
functions?: IFunctionInfo[];
interfaces?: IInterfaceInfo[];
enums?: IEnumInfo[];
dependencies: string[];
properties?: IProperty[];
errors?: string[];
}
export interface ICodebaseMap {
[repo: string]: {
modules: {
[path: string]: IModuleInfo;
};
};
}
export type TNode = ts.FunctionDeclaration | ts.MethodDeclaration | ts.InterfaceDeclaration | ts.EnumDeclaration | ts.ArrowFunction;
export type DeclarationOrFunctionNode = ts.FunctionDeclaration | ts.MethodDeclaration | ts.ParameterDeclaration | ts.PropertyDeclaration | ts.PropertySignature | ts.ArrowFunction;
export type DeclarationFunctionNode = ts.FunctionDeclaration | ts.MethodDeclaration | ts.ArrowFunction | (ts.ClassElement & ts.FunctionDeclaration) | (ts.ClassElement & ts.ArrowFunction) | (ts.ClassElement & ts.MethodDeclaration);
export interface IProperty {
name: string;
type?: string;
}
export declare enum SomeEnum {
MORNING = "morning"
}
export interface ICodebaseKnowledgeExtractor {
}