@magic5644/graph-it-live 1.0.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/LICENSE +21 -0
- package/README.md +712 -0
- package/bin/graph-it +2 -0
- package/dist/astWorker.js +42176 -0
- package/dist/graph-it.js +42584 -0
- package/dist/indexerWorker.js +42178 -0
- package/dist/mcpServer.mjs +435 -0
- package/dist/mcpWorker.js +42313 -0
- package/dist/queries/python.scm +65 -0
- package/dist/queries/rust.scm +82 -0
- package/dist/queries/typescript.scm +104 -0
- package/dist/wasm/sqljs.wasm +0 -0
- package/dist/wasm/tree-sitter-python.wasm +0 -0
- package/dist/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/wasm/tree-sitter.wasm +0 -0
- package/package.json +1150 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
; Python Tree-sitter query for call graph extraction
|
|
2
|
+
; Capture names:
|
|
3
|
+
; @def.function — top-level function definitions
|
|
4
|
+
; @def.class — class definitions
|
|
5
|
+
; @def.method — method definitions inside classes
|
|
6
|
+
; @call — CALLS relation (function/method invocations)
|
|
7
|
+
; @inherit — INHERITS relation (class base classes)
|
|
8
|
+
; @uses — USES relation (attribute access as module/symbol reference)
|
|
9
|
+
|
|
10
|
+
; --------------------------------------------------------------------------
|
|
11
|
+
; DEFINITIONS
|
|
12
|
+
; --------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
; Top-level function definition
|
|
15
|
+
(function_definition
|
|
16
|
+
name: (identifier) @def.function)
|
|
17
|
+
|
|
18
|
+
; Class definition
|
|
19
|
+
(class_definition
|
|
20
|
+
name: (identifier) @def.class)
|
|
21
|
+
|
|
22
|
+
; Methods inside classes (indented function_definition under a block)
|
|
23
|
+
(class_definition
|
|
24
|
+
body: (block
|
|
25
|
+
(function_definition
|
|
26
|
+
name: (identifier) @def.method)))
|
|
27
|
+
|
|
28
|
+
; --------------------------------------------------------------------------
|
|
29
|
+
; CALLS
|
|
30
|
+
; --------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
; Direct function call: foo()
|
|
33
|
+
(call
|
|
34
|
+
function: (identifier) @call)
|
|
35
|
+
|
|
36
|
+
; Method/attribute call: obj.method()
|
|
37
|
+
(call
|
|
38
|
+
function: (attribute
|
|
39
|
+
attribute: (identifier) @call))
|
|
40
|
+
|
|
41
|
+
; --------------------------------------------------------------------------
|
|
42
|
+
; INHERITS (class bases)
|
|
43
|
+
; --------------------------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
; class Foo(Base): — simple identifier base
|
|
46
|
+
; Note: field name omitted for cross-version grammar compatibility (some grammars
|
|
47
|
+
; use 'superclasses', others 'bases'). Matching argument_list as a direct child
|
|
48
|
+
; of class_definition is unambiguous.
|
|
49
|
+
(class_definition
|
|
50
|
+
(argument_list
|
|
51
|
+
(identifier) @inherit))
|
|
52
|
+
|
|
53
|
+
; class Foo(module.Base): — attribute access base
|
|
54
|
+
(class_definition
|
|
55
|
+
(argument_list
|
|
56
|
+
(attribute
|
|
57
|
+
attribute: (identifier) @inherit)))
|
|
58
|
+
|
|
59
|
+
; --------------------------------------------------------------------------
|
|
60
|
+
; USES (attribute access as dependency reference)
|
|
61
|
+
; --------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
; module.symbol references (e.g. typing.Optional, collections.OrderedDict)
|
|
64
|
+
(attribute
|
|
65
|
+
object: (identifier) @uses)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
; Rust Tree-sitter query for call graph extraction
|
|
2
|
+
; Capture names:
|
|
3
|
+
; @def.function — free function definitions
|
|
4
|
+
; @def.class — struct definitions (analogous to class)
|
|
5
|
+
; @def.method — impl method definitions
|
|
6
|
+
; @def.type — type alias declarations
|
|
7
|
+
; @def.interface — trait definitions
|
|
8
|
+
; @call — CALLS relation (function/method invocations)
|
|
9
|
+
; @impl — IMPLEMENTS relation (trait impl)
|
|
10
|
+
; @uses — USES relation (type path references)
|
|
11
|
+
|
|
12
|
+
; --------------------------------------------------------------------------
|
|
13
|
+
; DEFINITIONS
|
|
14
|
+
; --------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
; Free function
|
|
17
|
+
(function_item
|
|
18
|
+
name: (identifier) @def.function)
|
|
19
|
+
|
|
20
|
+
; Struct (treated as class-like entity)
|
|
21
|
+
(struct_item
|
|
22
|
+
name: (type_identifier) @def.class)
|
|
23
|
+
|
|
24
|
+
; Enum
|
|
25
|
+
(enum_item
|
|
26
|
+
name: (type_identifier) @def.class)
|
|
27
|
+
|
|
28
|
+
; Trait definition (interface-like)
|
|
29
|
+
(trait_item
|
|
30
|
+
name: (type_identifier) @def.interface)
|
|
31
|
+
|
|
32
|
+
; Type alias
|
|
33
|
+
(type_item
|
|
34
|
+
name: (type_identifier) @def.type)
|
|
35
|
+
|
|
36
|
+
; Methods inside impl blocks
|
|
37
|
+
(impl_item
|
|
38
|
+
body: (declaration_list
|
|
39
|
+
(function_item
|
|
40
|
+
name: (identifier) @def.method)))
|
|
41
|
+
|
|
42
|
+
; --------------------------------------------------------------------------
|
|
43
|
+
; CALLS
|
|
44
|
+
; --------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
; Direct function call: foo()
|
|
47
|
+
(call_expression
|
|
48
|
+
function: (identifier) @call)
|
|
49
|
+
|
|
50
|
+
; Method call: self.method()
|
|
51
|
+
(call_expression
|
|
52
|
+
function: (field_expression
|
|
53
|
+
field: (field_identifier) @call))
|
|
54
|
+
|
|
55
|
+
; Scoped/path call: Foo::bar() or std::collections::HashMap::new()
|
|
56
|
+
(call_expression
|
|
57
|
+
function: (scoped_identifier
|
|
58
|
+
name: (identifier) @call))
|
|
59
|
+
|
|
60
|
+
; --------------------------------------------------------------------------
|
|
61
|
+
; IMPLEMENTS (trait impl)
|
|
62
|
+
; --------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
; impl Trait for Type { ... }
|
|
65
|
+
(impl_item
|
|
66
|
+
trait: (type_identifier) @impl)
|
|
67
|
+
|
|
68
|
+
; impl crate::module::Trait for Type { ... }
|
|
69
|
+
(impl_item
|
|
70
|
+
trait: (scoped_type_identifier
|
|
71
|
+
name: (type_identifier) @impl))
|
|
72
|
+
|
|
73
|
+
; --------------------------------------------------------------------------
|
|
74
|
+
; USES (type references)
|
|
75
|
+
; --------------------------------------------------------------------------
|
|
76
|
+
|
|
77
|
+
; Simple type identifier in signatures/fields
|
|
78
|
+
(type_identifier) @uses
|
|
79
|
+
|
|
80
|
+
; Scoped type path (e.g. std::sync::Arc, crate::services::MyService)
|
|
81
|
+
(scoped_type_identifier
|
|
82
|
+
name: (type_identifier) @uses)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
; TypeScript/JavaScript Tree-sitter query for call graph extraction
|
|
2
|
+
; Capture names:
|
|
3
|
+
; @def.function — top-level function declarations
|
|
4
|
+
; @def.method — class method definitions
|
|
5
|
+
; @def.class — class declarations
|
|
6
|
+
; @def.interface — interface declarations
|
|
7
|
+
; @def.type — type alias declarations
|
|
8
|
+
; @def.variable — exported const/let/var declarations
|
|
9
|
+
; @call — CALLS relation (function/method invocations)
|
|
10
|
+
; @inherit — INHERITS relation (extends clause)
|
|
11
|
+
; @impl — IMPLEMENTS relation (implements clause)
|
|
12
|
+
; @uses — USES relation (type references)
|
|
13
|
+
|
|
14
|
+
; --------------------------------------------------------------------------
|
|
15
|
+
; DEFINITIONS
|
|
16
|
+
; --------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
; Top-level function declarations
|
|
19
|
+
(function_declaration
|
|
20
|
+
name: (identifier) @def.function)
|
|
21
|
+
|
|
22
|
+
; Arrow function assigned to a const (exported or not)
|
|
23
|
+
(lexical_declaration
|
|
24
|
+
(variable_declarator
|
|
25
|
+
name: (identifier) @def.variable
|
|
26
|
+
value: (arrow_function)))
|
|
27
|
+
|
|
28
|
+
(variable_declaration
|
|
29
|
+
(variable_declarator
|
|
30
|
+
name: (identifier) @def.variable
|
|
31
|
+
value: (arrow_function)))
|
|
32
|
+
|
|
33
|
+
; Class declarations
|
|
34
|
+
(class_declaration
|
|
35
|
+
name: (type_identifier) @def.class)
|
|
36
|
+
|
|
37
|
+
; Method definitions inside classes
|
|
38
|
+
(method_definition
|
|
39
|
+
name: (property_identifier) @def.method)
|
|
40
|
+
|
|
41
|
+
; Interface declarations
|
|
42
|
+
(interface_declaration
|
|
43
|
+
name: (type_identifier) @def.interface)
|
|
44
|
+
|
|
45
|
+
; Type alias declarations
|
|
46
|
+
(type_alias_declaration
|
|
47
|
+
name: (type_identifier) @def.type)
|
|
48
|
+
|
|
49
|
+
; --------------------------------------------------------------------------
|
|
50
|
+
; CALLS
|
|
51
|
+
; --------------------------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
; Simple function call: foo()
|
|
54
|
+
(call_expression
|
|
55
|
+
function: (identifier) @call)
|
|
56
|
+
|
|
57
|
+
; Method call: obj.method()
|
|
58
|
+
(call_expression
|
|
59
|
+
function: (member_expression
|
|
60
|
+
property: (property_identifier) @call))
|
|
61
|
+
|
|
62
|
+
; Constructor call: new Foo()
|
|
63
|
+
(new_expression
|
|
64
|
+
constructor: (identifier) @call)
|
|
65
|
+
|
|
66
|
+
; Constructor call: new ns.Foo()
|
|
67
|
+
(new_expression
|
|
68
|
+
constructor: (member_expression
|
|
69
|
+
property: (property_identifier) @call))
|
|
70
|
+
|
|
71
|
+
; --------------------------------------------------------------------------
|
|
72
|
+
; INHERITS (class extends)
|
|
73
|
+
; --------------------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
; class Foo extends Bar
|
|
76
|
+
(class_heritage
|
|
77
|
+
(extends_clause
|
|
78
|
+
value: (identifier) @inherit))
|
|
79
|
+
|
|
80
|
+
; class Foo extends ns.Bar
|
|
81
|
+
(class_heritage
|
|
82
|
+
(extends_clause
|
|
83
|
+
value: (member_expression
|
|
84
|
+
property: (property_identifier) @inherit)))
|
|
85
|
+
|
|
86
|
+
; --------------------------------------------------------------------------
|
|
87
|
+
; IMPLEMENTS (TypeScript class implements)
|
|
88
|
+
; --------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
; class Foo implements IFoo
|
|
91
|
+
(class_heritage
|
|
92
|
+
(implements_clause
|
|
93
|
+
(type_identifier) @impl))
|
|
94
|
+
|
|
95
|
+
; --------------------------------------------------------------------------
|
|
96
|
+
; USES (type references)
|
|
97
|
+
; --------------------------------------------------------------------------
|
|
98
|
+
|
|
99
|
+
; Type identifiers in annotations (e.g. param: MyType, return: MyType)
|
|
100
|
+
(type_identifier) @uses
|
|
101
|
+
|
|
102
|
+
; Generic type params: Array<MyType>
|
|
103
|
+
(generic_type
|
|
104
|
+
name: (type_identifier) @uses)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|