devlensio 1.2.0 → 1.4.0
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.
- package/dist/graph/edges/callEdges.js +77 -3
- package/dist/graph/edges/callEdges.test.js +1 -1
- package/dist/graph/edges/callOrder.test.d.ts +1 -0
- package/dist/graph/edges/callOrder.test.js +227 -0
- package/dist/graph/edges/propEdges.js +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/parser/callFlow.d.ts +15 -0
- package/dist/parser/callFlow.js +302 -0
- package/dist/parser/callOrder.test.d.ts +1 -0
- package/dist/parser/callOrder.test.js +407 -0
- package/dist/parser/extractors/components.js +18 -28
- package/dist/parser/extractors/functions.d.ts +12 -3
- package/dist/parser/extractors/functions.js +58 -36
- package/dist/parser/extractors/moduleScope.js +1 -1
- package/dist/parser/moduleScope.test.js +5 -3
- package/dist/summarizer/index.js +53 -4
- package/dist/summarizer/prompts.js +111 -50
- package/dist/summarizer/prompts.test.d.ts +1 -0
- package/dist/summarizer/prompts.test.js +112 -0
- package/dist/types.d.ts +63 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/extractors/go/bin/darwin-amd64/devlens_go_extractor +0 -0
- package/extractors/go/bin/darwin-arm64/devlens_go_extractor +0 -0
- package/extractors/go/bin/linux-amd64/devlens_go_extractor +0 -0
- package/extractors/go/bin/linux-arm64/devlens_go_extractor +0 -0
- package/extractors/go/bin/windows-amd64/devlens_go_extractor.exe +0 -0
- package/extractors/go/calls.go +89 -10
- package/extractors/go/nodes.go +29 -11
- package/extractors/go/parser.go +311 -21
- package/extractors/java/devlens_java_extractor.jar +0 -0
- package/extractors/java/src/devlens/extractor/Extractor.java +36 -10
- package/extractors/java/src/devlens/extractor/Parser.java +387 -0
- package/extractors/java/src/devlens/extractor/edges/Calls.java +66 -10
- package/extractors/python/devlens_extractors_python/edges/calls.py +26 -3
- package/extractors/python/devlens_extractors_python/parser/__init__.py +4 -3
- package/extractors/python/devlens_extractors_python/parser/functions.py +199 -42
- package/extractors/rust/bin/darwin-amd64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/darwin-arm64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/linux-amd64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/linux-arm64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/windows-amd64/devlens_rust_extractor.exe +0 -0
- package/extractors/rust/src/calls.rs +82 -8
- package/extractors/rust/src/nodes.rs +29 -0
- package/extractors/rust/src/parser.rs +362 -27
- package/package.json +77 -73
|
@@ -112,6 +112,52 @@ pub const KIND_ENUM: &str = "ENUM";
|
|
|
112
112
|
pub const KIND_TRAIT: &str = "TRAIT";
|
|
113
113
|
pub const KIND_IMPL_BLOCK: &str = "IMPL_BLOCK";
|
|
114
114
|
|
|
115
|
+
/// Execution region of a call site (docs/CALL_ORDER.md §4.3). Rust emits only
|
|
116
|
+
/// these three: there is no JSX ("handler"), and FILE nodes carry no call
|
|
117
|
+
/// sites at all ("module").
|
|
118
|
+
#[derive(Clone, Copy, PartialEq, Eq)]
|
|
119
|
+
pub enum CallScope {
|
|
120
|
+
Inline,
|
|
121
|
+
Callback,
|
|
122
|
+
Nested,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
impl CallScope {
|
|
126
|
+
pub fn as_str(self) -> &'static str {
|
|
127
|
+
match self {
|
|
128
|
+
CallScope::Inline => "inline",
|
|
129
|
+
CallScope::Callback => "callback",
|
|
130
|
+
CallScope::Nested => "nested",
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
impl Default for CallScope {
|
|
136
|
+
fn default() -> Self {
|
|
137
|
+
CallScope::Inline
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// When a detached call runs relative to the frame (docs/CALL_ORDER.md §2).
|
|
142
|
+
/// The schedulers reachable from Rust source are tokio tasks, tokio timers and
|
|
143
|
+
/// callback positions whose scheduler cannot be classified.
|
|
144
|
+
#[derive(Clone, Copy, PartialEq, Eq)]
|
|
145
|
+
pub enum DeferKind {
|
|
146
|
+
Timer,
|
|
147
|
+
Promise,
|
|
148
|
+
Unknown,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
impl DeferKind {
|
|
152
|
+
pub fn as_str(self) -> &'static str {
|
|
153
|
+
match self {
|
|
154
|
+
DeferKind::Timer => "timer",
|
|
155
|
+
DeferKind::Promise => "promise",
|
|
156
|
+
DeferKind::Unknown => "unknown",
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
115
161
|
#[derive(Clone, Default)]
|
|
116
162
|
pub struct CallSite {
|
|
117
163
|
/// call expression text (path or receiver.method form)
|
|
@@ -121,6 +167,32 @@ pub struct CallSite {
|
|
|
121
167
|
/// coarse literal type tags per argument ("string"/"number"/"boolean"/
|
|
122
168
|
/// "char"/"unknown") — same vocabulary as the TS engine's callSites
|
|
123
169
|
pub arg_types: Vec<String>,
|
|
170
|
+
|
|
171
|
+
// ── callOrder/v1 — see docs/CALL_ORDER.md ──
|
|
172
|
+
/// 1-based lexical rank among every recorded site of the owner body
|
|
173
|
+
pub order: usize,
|
|
174
|
+
/// 1-based line of the call expression
|
|
175
|
+
pub line: usize,
|
|
176
|
+
/// 0-based column of the call expression (proc_macro2 columns are 0-based)
|
|
177
|
+
pub col: usize,
|
|
178
|
+
/// `order` of the enclosing call expression: foo(bar()) → bar.nested = foo.order
|
|
179
|
+
pub nested: Option<usize>,
|
|
180
|
+
/// where the site runs relative to the owner's frame
|
|
181
|
+
pub scope: CallScope,
|
|
182
|
+
/// the frame suspends on this call (`await`)
|
|
183
|
+
pub awaited: bool,
|
|
184
|
+
/// when this call runs relative to the frame, when detached
|
|
185
|
+
pub defer: Option<DeferKind>,
|
|
186
|
+
/// provenance for the scheduler symbol ("tokio::spawn", "iter.map")
|
|
187
|
+
pub defer_detail: Option<String>,
|
|
188
|
+
/// may run in parallel with the frame (thread / task / rayon)
|
|
189
|
+
pub conc: bool,
|
|
190
|
+
/// may execute 0..N times (loop body or iterator closure)
|
|
191
|
+
pub repeat: bool,
|
|
192
|
+
/// may execute 0 times (branch / match arm)
|
|
193
|
+
pub maybe: bool,
|
|
194
|
+
/// its result can abort the remaining calls in the block (`?`)
|
|
195
|
+
pub early_exit: bool,
|
|
124
196
|
}
|
|
125
197
|
|
|
126
198
|
#[derive(Clone)]
|
|
@@ -222,10 +294,180 @@ fn has_cfg_test(attrs: &[syn::Attribute]) -> bool {
|
|
|
222
294
|
|
|
223
295
|
// ── call collection (per fn body; nested items are NOT descended into) ──
|
|
224
296
|
|
|
297
|
+
/// Flags shared by every call site inside the subtree currently being
|
|
298
|
+
/// visited. Pushed by the visitor when it enters a region whose sites share
|
|
299
|
+
/// them (a branch arm, a loop body, a closure handed to a call, …).
|
|
300
|
+
#[derive(Clone, Default)]
|
|
301
|
+
struct CallContext {
|
|
302
|
+
scope: Option<CallScope>,
|
|
303
|
+
defer: Option<DeferKind>,
|
|
304
|
+
defer_detail: Option<String>,
|
|
305
|
+
conc: bool,
|
|
306
|
+
repeat: bool,
|
|
307
|
+
maybe: bool,
|
|
308
|
+
}
|
|
309
|
+
|
|
225
310
|
struct CallCollector {
|
|
226
311
|
calls: Vec<String>,
|
|
227
312
|
call_sites: Vec<CallSite>,
|
|
228
313
|
orm_calls: Vec<OrmCall>,
|
|
314
|
+
/// ordinal handed to the next recorded site (1-based)
|
|
315
|
+
order: usize,
|
|
316
|
+
/// ordinals of the call expressions currently open → `nested`
|
|
317
|
+
call_stack: Vec<usize>,
|
|
318
|
+
/// inherited execution regions, innermost last
|
|
319
|
+
ctx: Vec<CallContext>,
|
|
320
|
+
/// `await` / `?` apply to the call recorded FIRST inside their operand —
|
|
321
|
+
/// the operator wraps that call expression, not its arguments
|
|
322
|
+
pending_await: bool,
|
|
323
|
+
pending_early_exit: bool,
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
impl<'ast> CallCollector {
|
|
327
|
+
fn new() -> Self {
|
|
328
|
+
CallCollector {
|
|
329
|
+
calls: vec![],
|
|
330
|
+
call_sites: vec![],
|
|
331
|
+
orm_calls: vec![],
|
|
332
|
+
order: 0,
|
|
333
|
+
call_stack: vec![],
|
|
334
|
+
ctx: vec![],
|
|
335
|
+
pending_await: false,
|
|
336
|
+
pending_early_exit: false,
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/// Record one call site and return its ordinal. The SET of recorded sites
|
|
341
|
+
/// is decided by the visitor's walk; this only annotates it.
|
|
342
|
+
fn record(
|
|
343
|
+
&mut self,
|
|
344
|
+
name: String,
|
|
345
|
+
arg_count: usize,
|
|
346
|
+
arg_types: Vec<String>,
|
|
347
|
+
span: Span,
|
|
348
|
+
) -> usize {
|
|
349
|
+
self.order += 1;
|
|
350
|
+
let order = self.order;
|
|
351
|
+
let mut ctx = CallContext::default();
|
|
352
|
+
for c in &self.ctx {
|
|
353
|
+
if c.scope.is_some() {
|
|
354
|
+
ctx.scope = c.scope;
|
|
355
|
+
}
|
|
356
|
+
if c.defer.is_some() {
|
|
357
|
+
ctx.defer = c.defer;
|
|
358
|
+
}
|
|
359
|
+
if c.defer_detail.is_some() {
|
|
360
|
+
ctx.defer_detail = c.defer_detail.clone();
|
|
361
|
+
}
|
|
362
|
+
ctx.conc |= c.conc;
|
|
363
|
+
ctx.repeat |= c.repeat;
|
|
364
|
+
ctx.maybe |= c.maybe;
|
|
365
|
+
}
|
|
366
|
+
let start = span.start();
|
|
367
|
+
self.calls.push(name.clone());
|
|
368
|
+
self.call_sites.push(CallSite {
|
|
369
|
+
name,
|
|
370
|
+
arg_count,
|
|
371
|
+
arg_types,
|
|
372
|
+
order,
|
|
373
|
+
line: start.line,
|
|
374
|
+
col: start.column,
|
|
375
|
+
nested: self.call_stack.last().copied(),
|
|
376
|
+
scope: ctx.scope.unwrap_or_default(),
|
|
377
|
+
awaited: std::mem::take(&mut self.pending_await),
|
|
378
|
+
defer: ctx.defer,
|
|
379
|
+
defer_detail: ctx.defer_detail,
|
|
380
|
+
conc: ctx.conc,
|
|
381
|
+
repeat: ctx.repeat,
|
|
382
|
+
maybe: ctx.maybe,
|
|
383
|
+
early_exit: std::mem::take(&mut self.pending_early_exit),
|
|
384
|
+
});
|
|
385
|
+
order
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/// Visit a closure / async block. It is a function boundary: it does not
|
|
389
|
+
/// inherit `nested` from an enclosing call expression.
|
|
390
|
+
fn visit_detached(&mut self, expr: &'ast syn::Expr, ctx: CallContext) {
|
|
391
|
+
let saved_stack = std::mem::take(&mut self.call_stack);
|
|
392
|
+
self.ctx.push(ctx);
|
|
393
|
+
self.visit_expr(expr);
|
|
394
|
+
self.ctx.pop();
|
|
395
|
+
self.call_stack = saved_stack;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/// A call argument: only a closure / async block runs detached —
|
|
399
|
+
/// `spawn(f())` still evaluates `f()` in the frame.
|
|
400
|
+
fn visit_arg(&mut self, arg: &'ast syn::Expr, callee: &str) {
|
|
401
|
+
if is_callback_expr(arg) {
|
|
402
|
+
self.visit_detached(arg, callback_context(callee));
|
|
403
|
+
} else {
|
|
404
|
+
self.visit_expr(arg);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
fn is_callback_expr(e: &syn::Expr) -> bool {
|
|
410
|
+
matches!(e, syn::Expr::Closure(_) | syn::Expr::Async(_))
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/// Last segment of a call name: `tokio::spawn` → spawn, `items.iter.map` → map.
|
|
414
|
+
fn callee_leaf(name: &str) -> &str {
|
|
415
|
+
let after_path = name.rsplit("::").next().unwrap_or(name);
|
|
416
|
+
after_path.rsplit('.').next().unwrap_or(after_path)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/// Synchronous iteration combinators: their closure runs 0..N times inside the
|
|
420
|
+
/// frame (docs/CALL_ORDER.md §4.2 `repeat`).
|
|
421
|
+
const ITERATION_METHODS: [&str; 14] = [
|
|
422
|
+
"map",
|
|
423
|
+
"for_each",
|
|
424
|
+
"filter",
|
|
425
|
+
"filter_map",
|
|
426
|
+
"flat_map",
|
|
427
|
+
"fold",
|
|
428
|
+
"any",
|
|
429
|
+
"all",
|
|
430
|
+
"find",
|
|
431
|
+
"position",
|
|
432
|
+
"take_while",
|
|
433
|
+
"skip_while",
|
|
434
|
+
"try_for_each",
|
|
435
|
+
"retain",
|
|
436
|
+
];
|
|
437
|
+
|
|
438
|
+
/// Execution context of a closure / async block handed to `callee`.
|
|
439
|
+
fn callback_context(callee: &str) -> CallContext {
|
|
440
|
+
let leaf = callee_leaf(callee);
|
|
441
|
+
let mut ctx = CallContext {
|
|
442
|
+
scope: Some(CallScope::Callback),
|
|
443
|
+
..Default::default()
|
|
444
|
+
};
|
|
445
|
+
let mut classified = true;
|
|
446
|
+
if callee.contains("tokio::") && leaf == "spawn" {
|
|
447
|
+
// tokio::spawn — a task started now, joined later
|
|
448
|
+
ctx.defer = Some(DeferKind::Promise);
|
|
449
|
+
ctx.conc = true;
|
|
450
|
+
} else if callee.contains("thread::") && (leaf == "spawn" || leaf == "scope") {
|
|
451
|
+
// std::thread::spawn / thread::scope — starts now, so concurrent but
|
|
452
|
+
// not deferred (same reading as Go's `go f()`)
|
|
453
|
+
ctx.conc = true;
|
|
454
|
+
} else if callee.contains("rayon::") || callee.contains("par_iter") {
|
|
455
|
+
ctx.conc = true;
|
|
456
|
+
} else if callee.contains("tokio::time::") {
|
|
457
|
+
ctx.defer = Some(DeferKind::Timer);
|
|
458
|
+
} else {
|
|
459
|
+
classified = false;
|
|
460
|
+
}
|
|
461
|
+
if ITERATION_METHODS.contains(&leaf) {
|
|
462
|
+
ctx.repeat = true;
|
|
463
|
+
classified = true;
|
|
464
|
+
}
|
|
465
|
+
if !classified {
|
|
466
|
+
// a callback position whose scheduler cannot be classified
|
|
467
|
+
ctx.defer = Some(DeferKind::Unknown);
|
|
468
|
+
}
|
|
469
|
+
ctx.defer_detail = Some(callee.to_string());
|
|
470
|
+
ctx
|
|
229
471
|
}
|
|
230
472
|
|
|
231
473
|
/// Coarse literal type tag for one argument expression.
|
|
@@ -294,6 +536,105 @@ impl<'ast> Visit<'ast> for CallCollector {
|
|
|
294
536
|
// belong to the enclosing function — skip them entirely
|
|
295
537
|
fn visit_item(&mut self, _item: &'ast syn::Item) {}
|
|
296
538
|
|
|
539
|
+
// Wrapper expressions decide the flags of the sites inside them, so they
|
|
540
|
+
// are walked by hand: the RECORDED set is untouched (only the four call
|
|
541
|
+
// shapes record anything), only the annotations change.
|
|
542
|
+
fn visit_expr(&mut self, e: &'ast syn::Expr) {
|
|
543
|
+
match e {
|
|
544
|
+
// `f().await` — the frame suspends on the call
|
|
545
|
+
syn::Expr::Await(a) => {
|
|
546
|
+
let saved = self.pending_await;
|
|
547
|
+
self.pending_await = true;
|
|
548
|
+
self.visit_expr(&a.base);
|
|
549
|
+
self.pending_await = saved;
|
|
550
|
+
}
|
|
551
|
+
// `f()?` — the call can abort the rest of the block
|
|
552
|
+
syn::Expr::Try(t) => {
|
|
553
|
+
let saved = self.pending_early_exit;
|
|
554
|
+
self.pending_early_exit = true;
|
|
555
|
+
self.visit_expr(&t.expr);
|
|
556
|
+
self.pending_early_exit = saved;
|
|
557
|
+
}
|
|
558
|
+
// branch arms may not run at all
|
|
559
|
+
syn::Expr::If(x) => {
|
|
560
|
+
self.visit_expr(&x.cond);
|
|
561
|
+
self.ctx.push(CallContext {
|
|
562
|
+
maybe: true,
|
|
563
|
+
..Default::default()
|
|
564
|
+
});
|
|
565
|
+
self.visit_block(&x.then_branch);
|
|
566
|
+
self.ctx.pop();
|
|
567
|
+
if let Some((_, else_branch)) = &x.else_branch {
|
|
568
|
+
self.ctx.push(CallContext {
|
|
569
|
+
maybe: true,
|
|
570
|
+
..Default::default()
|
|
571
|
+
});
|
|
572
|
+
self.visit_expr(else_branch);
|
|
573
|
+
self.ctx.pop();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
syn::Expr::Match(m) => {
|
|
577
|
+
self.visit_expr(&m.expr);
|
|
578
|
+
self.ctx.push(CallContext {
|
|
579
|
+
maybe: true,
|
|
580
|
+
..Default::default()
|
|
581
|
+
});
|
|
582
|
+
for arm in &m.arms {
|
|
583
|
+
self.visit_arm(arm);
|
|
584
|
+
}
|
|
585
|
+
self.ctx.pop();
|
|
586
|
+
}
|
|
587
|
+
// loop bodies run 0..N times (the iterator/predicate does not)
|
|
588
|
+
syn::Expr::ForLoop(f) => {
|
|
589
|
+
self.visit_expr(&f.expr);
|
|
590
|
+
self.ctx.push(CallContext {
|
|
591
|
+
repeat: true,
|
|
592
|
+
..Default::default()
|
|
593
|
+
});
|
|
594
|
+
self.visit_block(&f.body);
|
|
595
|
+
self.ctx.pop();
|
|
596
|
+
}
|
|
597
|
+
syn::Expr::While(w) => {
|
|
598
|
+
self.visit_expr(&w.cond);
|
|
599
|
+
self.ctx.push(CallContext {
|
|
600
|
+
repeat: true,
|
|
601
|
+
..Default::default()
|
|
602
|
+
});
|
|
603
|
+
self.visit_block(&w.body);
|
|
604
|
+
self.ctx.pop();
|
|
605
|
+
}
|
|
606
|
+
syn::Expr::Loop(l) => {
|
|
607
|
+
self.ctx.push(CallContext {
|
|
608
|
+
repeat: true,
|
|
609
|
+
..Default::default()
|
|
610
|
+
});
|
|
611
|
+
self.visit_block(&l.body);
|
|
612
|
+
self.ctx.pop();
|
|
613
|
+
}
|
|
614
|
+
other => syn::visit::visit_expr(self, other),
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// `let f = || …` / `let f = async move { … }` — a function with no node of
|
|
619
|
+
// its own lives here: scope "nested".
|
|
620
|
+
fn visit_local(&mut self, l: &'ast syn::Local) {
|
|
621
|
+
let Some(init) = &l.init else { return };
|
|
622
|
+
if is_callback_expr(&init.expr) {
|
|
623
|
+
self.visit_detached(
|
|
624
|
+
&init.expr,
|
|
625
|
+
CallContext {
|
|
626
|
+
scope: Some(CallScope::Nested),
|
|
627
|
+
..Default::default()
|
|
628
|
+
},
|
|
629
|
+
);
|
|
630
|
+
} else {
|
|
631
|
+
self.visit_expr(&init.expr);
|
|
632
|
+
}
|
|
633
|
+
if let Some((_, diverge)) = &init.diverge {
|
|
634
|
+
self.visit_expr(diverge);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
297
638
|
fn visit_expr_call(&mut self, e: &'ast syn::ExprCall) {
|
|
298
639
|
let name = match &*e.func {
|
|
299
640
|
syn::Expr::Path(p) => {
|
|
@@ -305,13 +646,6 @@ impl<'ast> Visit<'ast> for CallCollector {
|
|
|
305
646
|
}
|
|
306
647
|
other => collapse_tokens(&other.to_token_stream().to_string()),
|
|
307
648
|
};
|
|
308
|
-
self.calls.push(name.clone());
|
|
309
|
-
let arg_types: Vec<String> = e.args.iter().map(arg_type_tag).collect();
|
|
310
|
-
self.call_sites.push(CallSite {
|
|
311
|
-
name: name.clone(),
|
|
312
|
-
arg_count: e.args.len(),
|
|
313
|
-
arg_types,
|
|
314
|
-
});
|
|
315
649
|
// diesel top-level write fns: insert_into(table) / update(table) /
|
|
316
650
|
// delete(table)
|
|
317
651
|
if let Some(first) = DIESEL_WRITE_FNS
|
|
@@ -326,20 +660,20 @@ impl<'ast> Visit<'ast> for CallCollector {
|
|
|
326
660
|
});
|
|
327
661
|
}
|
|
328
662
|
}
|
|
329
|
-
|
|
663
|
+
let arg_types: Vec<String> = e.args.iter().map(arg_type_tag).collect();
|
|
664
|
+
let order = self.record(name.clone(), e.args.len(), arg_types, e.span());
|
|
665
|
+
self.call_stack.push(order);
|
|
666
|
+
self.visit_expr(&e.func);
|
|
667
|
+
for arg in &e.args {
|
|
668
|
+
self.visit_arg(arg, &name);
|
|
669
|
+
}
|
|
670
|
+
self.call_stack.pop();
|
|
330
671
|
}
|
|
331
672
|
|
|
332
673
|
fn visit_expr_method_call(&mut self, e: &'ast syn::ExprMethodCall) {
|
|
333
674
|
let recv = collapse_tokens(&e.receiver.to_token_stream().to_string());
|
|
334
675
|
let method = e.method.to_string();
|
|
335
676
|
let mname = format!("{}.{}", recv, method);
|
|
336
|
-
self.calls.push(mname.clone());
|
|
337
|
-
let arg_types: Vec<String> = e.args.iter().map(arg_type_tag).collect();
|
|
338
|
-
self.call_sites.push(CallSite {
|
|
339
|
-
name: mname,
|
|
340
|
-
arg_count: e.args.len(),
|
|
341
|
-
arg_types,
|
|
342
|
-
});
|
|
343
677
|
// Diesel query DSL on a table path (receiver contains ::table or
|
|
344
678
|
// ::dsl::, or is a bare table-name alias)
|
|
345
679
|
let is_table_path = recv.contains("::table")
|
|
@@ -358,7 +692,15 @@ impl<'ast> Visit<'ast> for CallCollector {
|
|
|
358
692
|
});
|
|
359
693
|
}
|
|
360
694
|
}
|
|
361
|
-
|
|
695
|
+
let arg_types: Vec<String> = e.args.iter().map(arg_type_tag).collect();
|
|
696
|
+
let order = self.record(mname.clone(), e.args.len(), arg_types, e.span());
|
|
697
|
+
// syn order: receiver first, then arguments
|
|
698
|
+
self.call_stack.push(order);
|
|
699
|
+
self.visit_expr(&e.receiver);
|
|
700
|
+
for arg in &e.args {
|
|
701
|
+
self.visit_arg(arg, &mname);
|
|
702
|
+
}
|
|
703
|
+
self.call_stack.pop();
|
|
362
704
|
}
|
|
363
705
|
}
|
|
364
706
|
|
|
@@ -732,24 +1074,17 @@ fn parse_fn_like(
|
|
|
732
1074
|
.collect();
|
|
733
1075
|
|
|
734
1076
|
// calls + Diesel R/W facts within THIS body only (nested items skipped)
|
|
735
|
-
let mut cc = CallCollector
|
|
736
|
-
calls: vec![],
|
|
737
|
-
call_sites: vec![],
|
|
738
|
-
orm_calls: vec![],
|
|
739
|
-
};
|
|
1077
|
+
let mut cc = CallCollector::new();
|
|
740
1078
|
cc.visit_block(block);
|
|
741
1079
|
let mut seen: BTreeSet<String> = BTreeSet::new();
|
|
742
1080
|
for c in cc.calls {
|
|
743
1081
|
seen.insert(c);
|
|
744
1082
|
}
|
|
745
1083
|
pi.calls = seen.into_iter().collect();
|
|
746
|
-
//
|
|
747
|
-
|
|
1084
|
+
// callOrder/v1: every occurrence is kept, so a repeated call keeps its
|
|
1085
|
+
// position in the sequence.
|
|
748
1086
|
for cs in cc.call_sites {
|
|
749
|
-
|
|
750
|
-
if seen_sites.insert(key) {
|
|
751
|
-
pi.call_sites.push(cs);
|
|
752
|
-
}
|
|
1087
|
+
pi.call_sites.push(cs);
|
|
753
1088
|
}
|
|
754
1089
|
pi.orm_calls = cc.orm_calls;
|
|
755
1090
|
pi
|
package/package.json
CHANGED
|
@@ -1,73 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "devlensio",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Codebase intelligence engine for TypeScript/JavaScript/React/Next.js, Python, Java, Go, and Rust repositories.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"extractors/
|
|
41
|
-
"!extractors/
|
|
42
|
-
"!extractors/
|
|
43
|
-
"!extractors/
|
|
44
|
-
"extractors/
|
|
45
|
-
"!extractors/
|
|
46
|
-
"extractors/
|
|
47
|
-
"!extractors/
|
|
48
|
-
"
|
|
49
|
-
"!extractors/
|
|
50
|
-
"
|
|
51
|
-
"!extractors/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "devlensio",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Codebase intelligence engine for TypeScript/JavaScript/React/Next.js, Python, Java, Go, and Rust repositories.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./version": {
|
|
15
|
+
"types": "./dist/version.d.ts",
|
|
16
|
+
"import": "./dist/version.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "bun --watch src/server/index.ts",
|
|
21
|
+
"start": "bun src/server/index.ts",
|
|
22
|
+
"build": "tsc --project tsconfig.build.json",
|
|
23
|
+
"test": "bun test",
|
|
24
|
+
"export-graph": "bun src/debug/exportGraph.ts",
|
|
25
|
+
"prepack": "node extractors/java/build.mjs && node extractors/go/build.mjs && node extractors/rust/build.mjs",
|
|
26
|
+
"postinstall": "node extractors/python/setup.mjs"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"codebase",
|
|
30
|
+
"graph",
|
|
31
|
+
"ast",
|
|
32
|
+
"typescript",
|
|
33
|
+
"javascript",
|
|
34
|
+
"devtools"
|
|
35
|
+
],
|
|
36
|
+
"author": "",
|
|
37
|
+
"license": "AGPL-3.0",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist/**/*",
|
|
40
|
+
"extractors/java/**",
|
|
41
|
+
"!extractors/java/classes",
|
|
42
|
+
"!extractors/java/lib",
|
|
43
|
+
"!extractors/java/sources.txt",
|
|
44
|
+
"extractors/python/**",
|
|
45
|
+
"!extractors/python/.venv",
|
|
46
|
+
"!extractors/python/*.egg-info",
|
|
47
|
+
"!extractors/python/**/__pycache__",
|
|
48
|
+
"extractors/go/**",
|
|
49
|
+
"!extractors/go/tests",
|
|
50
|
+
"extractors/rust/**",
|
|
51
|
+
"!extractors/rust/tests",
|
|
52
|
+
"!extractors/rust/target",
|
|
53
|
+
"!extractors/rust/Cargo.lock",
|
|
54
|
+
"!extractors/python/tests",
|
|
55
|
+
"!extractors/java/tests"
|
|
56
|
+
],
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@anthropic-ai/sdk": "^0.104.2",
|
|
59
|
+
"@google/genai": "^2.8.0",
|
|
60
|
+
"dotenv": "^17.4.2",
|
|
61
|
+
"openai": "^6.42.0",
|
|
62
|
+
"simple-git": "^3.36.0",
|
|
63
|
+
"ts-morph": "^28.0.0",
|
|
64
|
+
"uuid": "^11.0.0"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/bun": "^1.3.9",
|
|
68
|
+
"@types/jest": "^30.0.0",
|
|
69
|
+
"@types/node": "^25.3.0",
|
|
70
|
+
"@types/uuid": "^11.0.0",
|
|
71
|
+
"jest": "^30.2.0",
|
|
72
|
+
"ts-jest": "^29.4.6",
|
|
73
|
+
"ts-node": "^10.9.2",
|
|
74
|
+
"ts-node-dev": "^2.0.0",
|
|
75
|
+
"typescript": "^5.9.3"
|
|
76
|
+
}
|
|
77
|
+
}
|