-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.json
More file actions
685 lines (685 loc) · 29 KB
/
package.json
File metadata and controls
685 lines (685 loc) · 29 KB
1
2
3
4
5
6
7
8
9
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
{
"name": "codegraph",
"displayName": "CodeGraph",
"description": "Cross-language code intelligence powered by graph analysis",
"version": "0.2.0",
"publisher": "aStudioPlus",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/anvanster/codegraph-vscode"
},
"engines": {
"vscode": "^1.90.0"
},
"categories": [
"Programming Languages",
"Linters",
"Other"
],
"keywords": [
"code intelligence",
"cross-language",
"code graph",
"navigation",
"AI"
],
"icon": "images/icon.png",
"activationEvents": [
"onLanguage:python",
"onLanguage:rust",
"onLanguage:typescript",
"onLanguage:javascript",
"onLanguage:go",
"onLanguage:c"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "codegraph.showDependencyGraph",
"title": "Show Dependency Graph",
"category": "CodeGraph"
},
{
"command": "codegraph.showCallGraph",
"title": "Show Call Graph",
"category": "CodeGraph"
},
{
"command": "codegraph.analyzeImpact",
"title": "Analyze Impact",
"category": "CodeGraph"
},
{
"command": "codegraph.showMetrics",
"title": "Show Parser Metrics",
"category": "CodeGraph"
},
{
"command": "codegraph.openAIChat",
"title": "Open AI Assistant",
"category": "CodeGraph"
},
{
"command": "codegraph.reindex",
"title": "Reindex Workspace",
"category": "CodeGraph"
},
{
"command": "codegraph.debugTools",
"title": "Debug Language Model Tools",
"category": "CodeGraph"
}
],
"configuration": {
"title": "CodeGraph",
"properties": {
"codegraph.enabled": {
"type": "boolean",
"default": true,
"description": "Enable CodeGraph extension"
},
"codegraph.languages": {
"type": "array",
"items": {
"type": "string"
},
"default": [
"python",
"rust",
"typescript",
"javascript",
"go",
"c"
],
"description": "Languages to index"
},
"codegraph.indexOnStartup": {
"type": "boolean",
"default": true,
"description": "Index workspace on startup"
},
"codegraph.maxFileSizeKB": {
"type": "number",
"default": 1024,
"description": "Maximum file size to index (KB)"
},
"codegraph.excludePatterns": {
"type": "array",
"items": {
"type": "string"
},
"default": [
"**/node_modules/**",
"**/target/**",
"**/__pycache__/**",
"**/dist/**",
"**/build/**",
"**/.git/**"
],
"description": "Glob patterns for files to exclude"
},
"codegraph.includePrivate": {
"type": "boolean",
"default": true,
"description": "Include private/internal symbols"
},
"codegraph.includeTests": {
"type": "boolean",
"default": true,
"description": "Include test files and functions"
},
"codegraph.ai.maxContextTokens": {
"type": "number",
"default": 4000,
"description": "Maximum tokens for AI context"
},
"codegraph.ai.contextStrategy": {
"type": "string",
"enum": [
"minimal",
"smart",
"maximum"
],
"default": "smart",
"description": "AI context selection strategy"
},
"codegraph.visualization.defaultDepth": {
"type": "number",
"default": 3,
"description": "Default depth for graph visualizations"
},
"codegraph.cache.enabled": {
"type": "boolean",
"default": true,
"description": "Enable query caching"
},
"codegraph.cache.maxSizeMB": {
"type": "number",
"default": 500,
"description": "Maximum cache size (MB)"
},
"codegraph.parallelParsing": {
"type": "boolean",
"default": true,
"description": "Enable parallel file parsing"
},
"codegraph.trace.server": {
"type": "string",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "Trace communication with the language server"
}
}
},
"chatParticipants": [
{
"id": "codegraph",
"fullName": "CodeGraph",
"name": "codegraph",
"description": "Provides code intelligence context from CodeGraph - dependency graphs, call graphs, impact analysis, and related code",
"isSticky": false,
"commands": [
{
"name": "dependencies",
"description": "Show dependency graph for the current file"
},
{
"name": "callgraph",
"description": "Show call graph for the function at cursor"
},
{
"name": "impact",
"description": "Analyze impact of changes to the current symbol"
},
{
"name": "tests",
"description": "Find tests related to the current code"
},
{
"name": "context",
"description": "Get comprehensive code context for AI analysis"
}
]
}
],
"languageModelTools": [
{
"name": "codegraph_get_dependency_graph",
"displayName": "Get Dependency Graph",
"description": "Retrieve the dependency graph for a source file showing imports and dependencies",
"modelDescription": "Use this tool to understand what files and modules a given file depends on. Returns a graph with nodes (files/modules) and edges (dependency relationships). Useful for understanding module architecture and import chains.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "dependency_graph",
"userDescription": "Analyzes file dependencies and import relationships in your codebase",
"tags": [
"code-analysis",
"dependencies",
"architecture"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI to analyze (e.g., file:///path/to/file.ts)"
},
"depth": {
"type": "number",
"description": "How many levels of dependencies to traverse (1-10, default: 3)",
"default": 3
},
"includeExternal": {
"type": "boolean",
"description": "Whether to include external dependencies from node_modules/packages",
"default": false
},
"direction": {
"type": "string",
"enum": [
"imports",
"importedBy",
"both"
],
"description": "Direction to analyze: 'imports' (what this file uses), 'importedBy' (what uses this file), or 'both'",
"default": "both"
},
"summary": {
"type": "boolean",
"description": "Return a condensed summary for large graphs",
"default": false
}
},
"required": [
"uri"
]
}
},
{
"name": "codegraph_get_call_graph",
"displayName": "Get Call Graph",
"description": "Retrieve the call graph for a function showing callers and callees",
"modelDescription": "Use this tool to understand function call relationships. Shows what functions call the target function (callers) and what functions the target calls (callees). Essential for understanding code execution flow and function dependencies.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "call_graph",
"userDescription": "Shows function call relationships and execution flow in your code",
"tags": [
"code-analysis",
"functions",
"call-graph"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI containing the function"
},
"line": {
"type": "number",
"description": "Line number of the function (0-indexed)"
},
"character": {
"type": "number",
"description": "Character position in the line (0-indexed)",
"default": 0
},
"depth": {
"type": "number",
"description": "How many levels deep to traverse the call graph",
"default": 3
},
"direction": {
"type": "string",
"enum": [
"callers",
"callees",
"both"
],
"description": "Direction: 'callers' (who calls this), 'callees' (what this calls), or 'both'",
"default": "both"
},
"summary": {
"type": "boolean",
"description": "Return a condensed summary for large call graphs",
"default": false
}
},
"required": [
"uri",
"line"
]
}
},
{
"name": "codegraph_analyze_impact",
"displayName": "Analyze Change Impact",
"description": "Analyze the impact of modifying, deleting, or renaming a symbol",
"modelDescription": "Use this tool before making changes to understand the blast radius. Shows all code that would be affected by changing a function, class, or variable. Returns direct impacts (immediate usages) and indirect impacts (transitive dependencies).",
"canBeReferencedInPrompt": true,
"toolReferenceName": "impact_analysis",
"userDescription": "Analyzes the impact of code changes before you make them",
"tags": [
"code-analysis",
"refactoring",
"impact"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI containing the symbol"
},
"line": {
"type": "number",
"description": "Line number of the symbol (0-indexed)"
},
"character": {
"type": "number",
"description": "Character position (0-indexed)",
"default": 0
},
"changeType": {
"type": "string",
"enum": [
"modify",
"delete",
"rename"
],
"description": "Type of change to analyze",
"default": "modify"
},
"summary": {
"type": "boolean",
"description": "Return a condensed summary when many impacts are found",
"default": false
}
},
"required": [
"uri",
"line"
]
}
},
{
"name": "codegraph_get_ai_context",
"displayName": "Get AI Context",
"description": "Get comprehensive code context optimized for AI analysis",
"modelDescription": "Use this tool to get rich context about a code location. Returns the primary code, related code (dependencies, callers, etc.), and architectural context. Automatically selects the most relevant related code based on the intent (explain, modify, debug, or test).",
"canBeReferencedInPrompt": true,
"toolReferenceName": "ai_context",
"userDescription": "Provides rich code context for AI analysis and understanding",
"tags": [
"code-analysis",
"ai",
"context"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI to get context for"
},
"line": {
"type": "number",
"description": "Line number (0-indexed)"
},
"character": {
"type": "number",
"description": "Character position (0-indexed)",
"default": 0
},
"intent": {
"type": "string",
"enum": [
"explain",
"modify",
"debug",
"test"
],
"description": "What you plan to do with the context. Affects which related code is selected.",
"default": "explain"
},
"maxTokens": {
"type": "number",
"description": "Maximum tokens of context to return",
"default": 4000
}
},
"required": [
"uri",
"line"
]
}
},
{
"name": "codegraph_find_related_tests",
"displayName": "Find Related Tests",
"description": "Find test files and test functions related to a code location",
"modelDescription": "Use this tool to discover tests that cover a piece of code. Useful when modifying code to understand what tests need updating, or when debugging to find relevant test cases.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "related_tests",
"userDescription": "Finds tests related to your code for testing and debugging",
"tags": [
"testing",
"code-analysis",
"quality"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI to find tests for"
},
"line": {
"type": "number",
"description": "Line number (0-indexed)",
"default": 0
},
"limit": {
"type": "number",
"description": "Maximum number of related tests to return",
"default": 10
}
},
"required": [
"uri"
]
}
},
{
"name": "codegraph_get_symbol_info",
"displayName": "Get Symbol Information",
"description": "Get detailed information about a symbol (function, class, variable, etc.)",
"modelDescription": "Use this tool to get metadata about a symbol: its type, signature, documentation, location, and usage statistics. Quick way to understand what a symbol is and how it's used. Set includeReferences=false for faster results when you only need type information.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "symbol_info",
"userDescription": "Shows detailed information about code symbols and their usage",
"tags": [
"code-analysis",
"symbols",
"documentation"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI containing the symbol"
},
"line": {
"type": "number",
"description": "Line number of the symbol (0-indexed)"
},
"character": {
"type": "number",
"description": "Character position (0-indexed)",
"default": 0
},
"includeReferences": {
"type": "boolean",
"description": "Whether to include all references to the symbol. Can be slow on large workspaces.",
"default": false
}
},
"required": [
"uri",
"line"
]
}
},
{
"name": "codegraph_analyze_complexity",
"displayName": "Analyze Complexity",
"description": "Analyze cyclomatic and cognitive complexity of code",
"modelDescription": "Use this tool to measure code complexity. Returns cyclomatic complexity, cognitive complexity, and other metrics. Helps identify code that may need refactoring due to high complexity. Can analyze a specific function (by line) or an entire file.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "complexity",
"userDescription": "Analyzes code complexity metrics to identify areas needing refactoring",
"tags": [
"code-analysis",
"complexity",
"quality"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI to analyze"
},
"line": {
"type": "number",
"description": "Optional line number to analyze a specific function (0-indexed)"
},
"threshold": {
"type": "number",
"description": "Complexity threshold for flagging (default: 10)",
"default": 10
},
"summary": {
"type": "boolean",
"description": "Return a condensed summary",
"default": false
}
},
"required": [
"uri"
]
}
},
{
"name": "codegraph_find_unused_code",
"displayName": "Find Unused Code",
"description": "Detect unused functions, variables, and imports in the codebase",
"modelDescription": "Use this tool to find dead code that can be safely removed. Returns unused symbols with confidence scores. Can scan a single file, module, or entire workspace. Useful for code cleanup and reducing maintenance burden.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "unused_code",
"userDescription": "Finds unused code that can be safely removed from your codebase",
"tags": [
"code-analysis",
"cleanup",
"quality"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI to analyze (optional for workspace scope)"
},
"scope": {
"type": "string",
"enum": [
"file",
"module",
"workspace"
],
"description": "Scope of analysis: 'file', 'module', or 'workspace'",
"default": "file"
},
"includeTests": {
"type": "boolean",
"description": "Whether to include test files in analysis",
"default": false
},
"confidence": {
"type": "number",
"description": "Minimum confidence threshold (0-1) for reporting unused code",
"default": 0.7
},
"summary": {
"type": "boolean",
"description": "Return a condensed summary",
"default": false
}
}
}
},
{
"name": "codegraph_analyze_coupling",
"displayName": "Analyze Coupling",
"description": "Analyze module coupling and cohesion metrics",
"modelDescription": "Use this tool to understand how tightly coupled modules are. Returns afferent coupling (incoming dependencies), efferent coupling (outgoing dependencies), and instability metrics. Helps identify modules that may need better abstraction or decoupling.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "coupling",
"userDescription": "Analyzes module coupling and cohesion for better architecture",
"tags": [
"code-analysis",
"architecture",
"quality"
],
"inputSchema": {
"type": "object",
"properties": {
"uri": {
"type": "string",
"description": "The file URI to analyze"
},
"includeExternal": {
"type": "boolean",
"description": "Whether to include external dependencies in analysis",
"default": false
},
"depth": {
"type": "number",
"description": "Depth of dependency analysis",
"default": 2
},
"summary": {
"type": "boolean",
"description": "Return a condensed summary",
"default": false
}
},
"required": [
"uri"
]
}
}
],
"menus": {
"editor/context": [
{
"command": "codegraph.showCallGraph",
"group": "codegraph",
"when": "editorTextFocus"
},
{
"command": "codegraph.analyzeImpact",
"group": "codegraph",
"when": "editorTextFocus"
}
]
},
"views": {
"explorer": [
{
"id": "codegraphSymbols",
"name": "CodeGraph Symbols",
"when": "codegraph.enabled"
}
]
}
},
"scripts": {
"vscode:prepublish": "npm run esbuild-base -- --production && npm run build-server",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"esbuild-base": "node esbuild.js",
"esbuild": "npm run esbuild-base -- --sourcemap",
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch",
"build-server": "cargo build --release -p codegraph-lsp",
"build-webview": "cd webview && npm run build",
"package": "vsce package",
"lint": "eslint src --ext ts",
"test": "vitest run",
"test:watch": "vitest",
"test:e2e": "npm run compile && node ./out/test/runTest.js"
},
"devDependencies": {
"@types/node": "^20.10.0",
"@types/vscode": "^1.85.0",
"@typescript-eslint/eslint-plugin": "^6.13.0",
"@typescript-eslint/parser": "^6.13.0",
"@vscode/vsce": "^2.22.0",
"@vsforge/config": "file:../vsforge/packages/@vsforge/config",
"@vsforge/shim": "file:../vsforge/packages/@vsforge/shim",
"@vsforge/test": "file:../vsforge/packages/@vsforge/test",
"esbuild": "^0.27.1",
"eslint": "^8.55.0",
"typescript": "^5.3.0",
"vitest": "^1.0.0"
},
"dependencies": {
"vscode-languageclient": "^9.0.1"
}
}