@nithin554/code-crawler 0.1.36 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,11 +17,22 @@ export interface SymbolRef {
17
17
  }
18
18
  export interface CallerInfo {
19
19
  caller: SymbolRef;
20
- /** Properties of the CALLS edge (call site line, resolution, confidence). */
20
+ /** Properties of the call edge (call site line, resolution, confidence). */
21
21
  callSiteLine?: number;
22
22
  resolved?: boolean;
23
+ /** Which edge kind connected the caller: CALLS | DYNAMIC_DISPATCH | ADVISES. */
24
+ edgeKind?: EdgeKind;
23
25
  }
24
- export interface CallerQueryOptions {
26
+ /** Options controlling which dynamic edges a traversal follows. */
27
+ export interface DynamicEdgeOptions {
28
+ /** Follow DYNAMIC_DISPATCH edges (virtual/interface call targets). */
29
+ includeDynamic?: boolean;
30
+ /** Follow ADVISES edges (aspect advice -> advised method). */
31
+ includeAdvice?: boolean;
32
+ }
33
+ /** Edge kinds a traversal should follow, ordered from most to least certain. */
34
+ export declare function traversalEdgeKinds(opts?: DynamicEdgeOptions): EdgeKind[];
35
+ export interface CallerQueryOptions extends DynamicEdgeOptions {
25
36
  /** Include transitive callers (whole call graph above). Default true. */
26
37
  transitive?: boolean;
27
38
  /** Max depth for transitive traversal. Bounded by config maxDepth. */
@@ -39,9 +50,10 @@ export declare function getCallers(store: GraphStore, symbol: string, opts?: Cal
39
50
  caller: SymbolRef;
40
51
  depth: number;
41
52
  callSiteLine?: number;
53
+ edgeKind: EdgeKind;
42
54
  }[];
43
55
  } | null;
44
- export interface CalleeQueryOptions {
56
+ export interface CalleeQueryOptions extends DynamicEdgeOptions {
45
57
  /** Include transitive callees (whole call graph below). Default true. */
46
58
  transitive?: boolean;
47
59
  maxDepth?: number;
@@ -56,6 +68,7 @@ export declare function getCallees(store: GraphStore, symbol: string, opts?: Cal
56
68
  callee: SymbolRef;
57
69
  depth: number;
58
70
  callSiteLine?: number;
71
+ edgeKind: EdgeKind;
59
72
  }[];
60
73
  } | null;
61
74
  export interface PathEntry {
@@ -65,19 +78,40 @@ export interface PathEntry {
65
78
  edges: {
66
79
  source: string;
67
80
  target: string;
81
+ kind?: EdgeKind;
68
82
  callSiteLine?: number;
69
83
  resolved?: boolean;
70
84
  }[];
71
85
  }
72
- export interface TracePathOptions {
86
+ export interface TracePathOptions extends DynamicEdgeOptions {
73
87
  maxDepth?: number;
74
88
  limit?: number;
75
89
  }
76
90
  /**
77
- * Find up to `limit` static call paths between two symbols.
78
- * BFS over CALLS edges so the shortest paths come first.
91
+ * Find up to `limit` call paths between two symbols.
92
+ * BFS over the selected edge kinds so the shortest paths come first.
79
93
  */
80
94
  export declare function tracePath(store: GraphStore, from: string, to: string, opts?: TracePathOptions): PathEntry[] | null;
95
+ export interface ExecutionTraceOptions extends DynamicEdgeOptions {
96
+ maxDepth?: number;
97
+ limit?: number;
98
+ }
99
+ export interface ExecutionStep {
100
+ symbol: SymbolRef;
101
+ depth: number;
102
+ /** How the runtime reached this symbol. INTERCEPT marks woven advice. */
103
+ via?: EdgeKind | "INTERCEPT";
104
+ callSiteLine?: number;
105
+ }
106
+ /**
107
+ * Dynamic execution trace: follows static + virtual dispatch edges and weaves
108
+ * in aspect advice. When a call reaches an advised method, the advice method
109
+ * is visited first (an `INTERCEPT` edge), then the method itself.
110
+ */
111
+ export declare function traceExecution(store: GraphStore, symbol: string, opts?: ExecutionTraceOptions): {
112
+ root: SymbolRef;
113
+ steps: ExecutionStep[];
114
+ } | null;
81
115
  export interface SubgraphOptions {
82
116
  radius?: number;
83
117
  edgeKinds?: EdgeKind[];
@@ -109,3 +143,99 @@ export interface SearchOptions {
109
143
  export declare function searchSymbols(store: GraphStore, query: string, opts?: SearchOptions): SymbolRef[];
110
144
  /** Suggest similar symbols when an exact lookup fails. */
111
145
  export declare function suggestSymbols(store: GraphStore, symbol: string, limit?: number): SymbolRef[];
146
+ export interface ImplementationResult {
147
+ target: SymbolRef;
148
+ implementations: {
149
+ type: SymbolRef;
150
+ depth: number;
151
+ via: "EXTENDS" | "IMPLEMENTS";
152
+ }[];
153
+ }
154
+ /**
155
+ * Find every type that implements/extends a given interface or superclass,
156
+ * directly or transitively.
157
+ */
158
+ export declare function findImplementations(store: GraphStore, symbol: string, opts?: {
159
+ maxDepth?: number;
160
+ limit?: number;
161
+ }): ImplementationResult | null;
162
+ export interface AdviceDetail {
163
+ method: SymbolRef;
164
+ adviceKind?: string;
165
+ pointcut?: string;
166
+ advised: SymbolRef[];
167
+ }
168
+ export interface AspectDetail {
169
+ aspect: SymbolRef;
170
+ advice: AdviceDetail[];
171
+ }
172
+ /** List aspects, their advice methods, and the methods each advice intercepts. */
173
+ export declare function getAspects(store: GraphStore, opts?: {
174
+ limit?: number;
175
+ }): AspectDetail[];
176
+ export interface DecoratorInfo {
177
+ name: string;
178
+ fqn?: string;
179
+ decorator: boolean;
180
+ line?: number;
181
+ arguments: string[];
182
+ }
183
+ export interface SymbolDecorators {
184
+ symbol: SymbolRef;
185
+ decorators: DecoratorInfo[];
186
+ members: {
187
+ symbol: SymbolRef;
188
+ decorators: DecoratorInfo[];
189
+ }[];
190
+ }
191
+ /**
192
+ * Decorators/annotations applied to a symbol, optionally including the
193
+ * annotations on its declared members (methods, constructors, fields).
194
+ */
195
+ export declare function getDecorators(store: GraphStore, symbol: string, opts?: {
196
+ includeMembers?: boolean;
197
+ }): SymbolDecorators | null;
198
+ export interface AnnotatedSymbol {
199
+ symbol: SymbolRef;
200
+ annotation: {
201
+ name: string;
202
+ fqn?: string;
203
+ };
204
+ line?: number;
205
+ arguments: string[];
206
+ }
207
+ /**
208
+ * Find every symbol annotated/decorated with the given annotation. Accepts a
209
+ * simple name (`Transactional`), a node id (`@Transactional`) or an FQN.
210
+ */
211
+ export declare function findAnnotated(store: GraphStore, annotation: string, opts?: {
212
+ kind?: NodeKind;
213
+ limit?: number;
214
+ }): AnnotatedSymbol[];
215
+ export interface Hotspot {
216
+ symbol: SymbolRef;
217
+ fanIn: number;
218
+ fanOut: number;
219
+ adviceCount: number;
220
+ }
221
+ /** Rank callable symbols by incoming/outgoing call volume. */
222
+ export declare function hotspots(store: GraphStore, opts?: {
223
+ limit?: number;
224
+ minFanIn?: number;
225
+ includeDynamic?: boolean;
226
+ }): Hotspot[];
227
+ export interface DeadSymbol {
228
+ symbol: SymbolRef;
229
+ reason: string;
230
+ }
231
+ /**
232
+ * Find methods/constructors with no incoming call, dispatch or advice edges.
233
+ * Heuristic: framework entry points, tests and constructors are excluded by
234
+ * default because they are invoked reflectively or by containers.
235
+ */
236
+ export declare function deadCode(store: GraphStore, opts?: {
237
+ limit?: number;
238
+ includeConstructors?: boolean;
239
+ includeTests?: boolean;
240
+ includeDynamic?: boolean;
241
+ }): DeadSymbol[];