File tree Expand file tree Collapse file tree 4 files changed +34
-1
lines changed
Expand file tree Collapse file tree 4 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export function prepareDocumentsForEmbedding(documents: Document[]): EmbeddingDo
4141 docstring : doc . metadata . docstring ,
4242 snippet : doc . metadata . snippet ,
4343 imports : doc . metadata . imports ,
44+ callees : doc . metadata . callees ,
4445 } ,
4546 } ) ) ;
4647}
@@ -76,6 +77,7 @@ export function prepareDocumentForEmbedding(doc: Document): EmbeddingDocument {
7677 docstring : doc . metadata . docstring ,
7778 snippet : doc . metadata . snippet ,
7879 imports : doc . metadata . imports ,
80+ callees : doc . metadata . callees ,
7981 } ,
8082 } ;
8183}
Original file line number Diff line number Diff line change 33export { MarkdownScanner } from './markdown' ;
44export { ScannerRegistry } from './registry' ;
55export type {
6+ CalleeInfo ,
7+ CallerInfo ,
68 Document ,
79 DocumentMetadata ,
810 DocumentType ,
Original file line number Diff line number Diff line change @@ -9,6 +9,30 @@ export type DocumentType =
99 | 'method'
1010 | 'documentation' ;
1111
12+ /**
13+ * Information about a function/method that calls this component
14+ */
15+ export interface CallerInfo {
16+ /** Name of the calling function/method */
17+ name : string ;
18+ /** File path where the call originates */
19+ file : string ;
20+ /** Line number of the call site */
21+ line : number ;
22+ }
23+
24+ /**
25+ * Information about a function/method called by this component
26+ */
27+ export interface CalleeInfo {
28+ /** Name of the called function/method */
29+ name : string ;
30+ /** File path of the called function (if resolved) */
31+ file ?: string ;
32+ /** Line number of the call within this component */
33+ line : number ;
34+ }
35+
1236export interface Document {
1337 id : string ; // Unique identifier: file:name:line
1438 text : string ; // Text to embed (for vector search)
@@ -29,6 +53,10 @@ export interface DocumentMetadata {
2953 snippet ?: string ; // Actual code content (truncated if large)
3054 imports ?: string [ ] ; // File-level imports (module specifiers)
3155
56+ // Relationship data (call graph)
57+ callees ?: CalleeInfo [ ] ; // Functions/methods this component calls
58+ // Note: callers are computed at query time via reverse lookup
59+
3260 // Extensible for future use
3361 custom ?: Record < string , unknown > ;
3462}
Original file line number Diff line number Diff line change 22 * Vector storage and embedding types
33 */
44
5- import type { DocumentType } from '../scanner/types' ;
5+ import type { CalleeInfo , DocumentType } from '../scanner/types' ;
66
77/**
88 * Document to be embedded and stored
@@ -33,6 +33,7 @@ export interface SearchResultMetadata {
3333 docstring ?: string ; // Documentation comment
3434 snippet ?: string ; // Actual code content (truncated if large)
3535 imports ?: string [ ] ; // File-level imports (module specifiers)
36+ callees ?: CalleeInfo [ ] ; // Functions/methods this component calls
3637 // Allow additional custom fields for extensibility (e.g., GitHub indexer uses 'document')
3738 [ key : string ] : unknown ;
3839}
You can’t perform that action at this time.
0 commit comments