project-graph-mcp 1.3.0 → 2.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.
Files changed (113) hide show
  1. package/README.md +223 -17
  2. package/{AGENT_ROLE.md → docs/examples/AGENT_ROLE.md} +87 -30
  3. package/{AGENT_ROLE_MINIMAL.md → docs/examples/AGENT_ROLE_MINIMAL.md} +23 -8
  4. package/package.json +12 -8
  5. package/src/.project-graph-cache.json +1 -0
  6. package/src/analysis/analysis-cache.js +7 -0
  7. package/src/analysis/complexity.js +14 -0
  8. package/src/analysis/custom-rules.js +36 -0
  9. package/src/analysis/db-analysis.js +9 -0
  10. package/src/analysis/dead-code.js +19 -0
  11. package/src/analysis/full-analysis.js +18 -0
  12. package/src/analysis/jsdoc-checker.js +24 -0
  13. package/src/analysis/jsdoc-generator.js +10 -0
  14. package/src/analysis/large-files.js +11 -0
  15. package/src/analysis/outdated-patterns.js +12 -0
  16. package/src/analysis/similar-functions.js +16 -0
  17. package/src/analysis/test-annotations.js +21 -0
  18. package/src/analysis/type-checker.js +8 -0
  19. package/src/analysis/undocumented.js +14 -0
  20. package/src/cli/cli-handlers.js +4 -0
  21. package/src/cli/cli.js +5 -0
  22. package/src/compact/ai-context.js +7 -0
  23. package/src/compact/compact.js +18 -0
  24. package/src/compact/compress.js +13 -0
  25. package/src/compact/ctx-to-jsdoc.js +29 -0
  26. package/src/compact/doc-dialect.js +30 -0
  27. package/src/compact/expand.js +37 -0
  28. package/src/compact/framework-references.js +5 -0
  29. package/src/compact/instructions.js +3 -0
  30. package/src/compact/mode-config.js +8 -0
  31. package/src/compact/validate-pipeline.js +9 -0
  32. package/src/core/event-bus.js +9 -0
  33. package/src/core/filters.js +14 -0
  34. package/src/core/graph-builder.js +12 -0
  35. package/src/core/parser.js +31 -0
  36. package/src/core/workspace.js +8 -0
  37. package/src/lang/lang-go.js +17 -0
  38. package/src/lang/lang-python.js +12 -0
  39. package/src/lang/lang-sql.js +23 -0
  40. package/src/lang/lang-typescript.js +9 -0
  41. package/src/lang/lang-utils.js +4 -0
  42. package/src/mcp/mcp-server.js +17 -0
  43. package/src/mcp/tool-defs.js +3 -0
  44. package/src/mcp/tools.js +25 -0
  45. package/src/network/backend-lifecycle.js +19 -0
  46. package/src/network/backend.js +5 -0
  47. package/src/network/local-gateway.js +23 -0
  48. package/src/network/mdns.js +13 -0
  49. package/src/network/server.js +10 -0
  50. package/src/network/web-server.js +34 -0
  51. package/vendor/terser.mjs +49 -0
  52. package/web/.project-graph-cache.json +1 -0
  53. package/web/app.js +16 -0
  54. package/web/components/code-block.js +3 -0
  55. package/web/components/quick-open.js +5 -0
  56. package/web/dashboard-state.js +3 -0
  57. package/web/dashboard.html +27 -0
  58. package/web/dashboard.js +8 -0
  59. package/web/highlight.js +13 -0
  60. package/web/index.html +35 -0
  61. package/web/panels/ActionBoard/ActionBoard.css.js +1 -0
  62. package/web/panels/ActionBoard/ActionBoard.js +4 -0
  63. package/web/panels/ActionBoard/ActionBoard.tpl.js +1 -0
  64. package/web/panels/EventItem/EventItem.css.js +1 -0
  65. package/web/panels/EventItem/EventItem.js +4 -0
  66. package/web/panels/EventItem/EventItem.tpl.js +1 -0
  67. package/web/panels/ProjectItem/ProjectItem.css.js +1 -0
  68. package/web/panels/ProjectItem/ProjectItem.js +5 -0
  69. package/web/panels/ProjectItem/ProjectItem.tpl.js +1 -0
  70. package/web/panels/ProjectList/ProjectList.css.js +1 -0
  71. package/web/panels/ProjectList/ProjectList.js +4 -0
  72. package/web/panels/ProjectList/ProjectList.tpl.js +1 -0
  73. package/web/panels/SettingsPanel/.project-graph-cache.json +1 -0
  74. package/web/panels/SettingsPanel/SettingsPanel.css.js +1 -0
  75. package/web/panels/SettingsPanel/SettingsPanel.js +7 -0
  76. package/web/panels/SettingsPanel/SettingsPanel.tpl.js +1 -0
  77. package/web/panels/code-viewer.js +5 -0
  78. package/web/panels/ctx-panel.js +4 -0
  79. package/web/panels/dep-graph.js +6 -0
  80. package/web/panels/file-tree.js +188 -0
  81. package/web/panels/health-panel.js +3 -0
  82. package/web/panels/live-monitor.js +3 -0
  83. package/web/state.js +17 -0
  84. package/web/style.css +157 -0
  85. package/references/symbiote-3x.md +0 -834
  86. package/src/cli-handlers.js +0 -140
  87. package/src/cli.js +0 -83
  88. package/src/complexity.js +0 -223
  89. package/src/custom-rules.js +0 -583
  90. package/src/db-analysis.js +0 -194
  91. package/src/dead-code.js +0 -468
  92. package/src/filters.js +0 -227
  93. package/src/framework-references.js +0 -177
  94. package/src/full-analysis.js +0 -174
  95. package/src/graph-builder.js +0 -299
  96. package/src/instructions.js +0 -175
  97. package/src/jsdoc-generator.js +0 -214
  98. package/src/lang-go.js +0 -285
  99. package/src/lang-python.js +0 -197
  100. package/src/lang-sql.js +0 -309
  101. package/src/lang-typescript.js +0 -190
  102. package/src/lang-utils.js +0 -124
  103. package/src/large-files.js +0 -162
  104. package/src/mcp-server.js +0 -468
  105. package/src/outdated-patterns.js +0 -295
  106. package/src/parser.js +0 -452
  107. package/src/server.js +0 -28
  108. package/src/similar-functions.js +0 -278
  109. package/src/test-annotations.js +0 -301
  110. package/src/tool-defs.js +0 -525
  111. package/src/tools.js +0 -470
  112. package/src/undocumented.js +0 -260
  113. package/src/workspace.js +0 -70
package/src/tool-defs.js DELETED
@@ -1,525 +0,0 @@
1
- /**
2
- * MCP Tool Definitions
3
- */
4
-
5
- export const TOOLS = [
6
- // Graph Tools
7
- {
8
- name: 'get_skeleton',
9
- description: 'Get compact minified project overview (10-50x smaller than source). Returns legend, stats, and node summaries.',
10
- inputSchema: {
11
- type: 'object',
12
- properties: {
13
- path: {
14
- type: 'string',
15
- description: 'Path to scan (e.g., "src/components")',
16
- },
17
- },
18
- required: ['path'],
19
- },
20
- },
21
- {
22
- name: 'get_focus_zone',
23
- description: 'Get enriched context for recently modified files. Auto-detects from git or accepts explicit file list.',
24
- inputSchema: {
25
- type: 'object',
26
- properties: {
27
- path: { type: 'string' },
28
- recentFiles: {
29
- type: 'array',
30
- items: { type: 'string' },
31
- description: 'Explicit list of files to expand',
32
- },
33
- useGitDiff: {
34
- type: 'boolean',
35
- description: 'Auto-detect from git diff',
36
- },
37
- },
38
- },
39
- },
40
- {
41
- name: 'expand',
42
- description: 'Expand a minified symbol to full details. Use "SN" for class or "SN.tP" for specific method.',
43
- inputSchema: {
44
- type: 'object',
45
- properties: {
46
- symbol: {
47
- type: 'string',
48
- description: 'Minified symbol (e.g., "SN" or "SN.tP")',
49
- },
50
- },
51
- required: ['symbol'],
52
- },
53
- },
54
- {
55
- name: 'deps',
56
- description: 'Get dependency tree for a symbol. Shows imports, usedBy, and calls.',
57
- inputSchema: {
58
- type: 'object',
59
- properties: {
60
- symbol: { type: 'string' },
61
- },
62
- required: ['symbol'],
63
- },
64
- },
65
- {
66
- name: 'usages',
67
- description: 'Find all usages of a symbol across the project.',
68
- inputSchema: {
69
- type: 'object',
70
- properties: {
71
- symbol: { type: 'string' },
72
- },
73
- required: ['symbol'],
74
- },
75
- },
76
- {
77
- name: 'get_call_chain',
78
- description: 'Find the shortest call chain from one function/class to another through the dependency graph.',
79
- inputSchema: {
80
- type: 'object',
81
- properties: {
82
- from: { type: 'string', description: 'Starting symbol (e.g., "authMiddleware")' },
83
- to: { type: 'string', description: 'Target symbol (e.g., "renderDashboard")' },
84
- path: { type: 'string', description: 'Path to scan (optional)' }
85
- },
86
- required: ['from', 'to'],
87
- },
88
- },
89
- {
90
- name: 'invalidate_cache',
91
- description: 'Invalidate the cached graph. Use after making code changes.',
92
- inputSchema: {
93
- type: 'object',
94
- properties: {},
95
- },
96
- },
97
-
98
- // Test Checklist Tools
99
- {
100
- name: 'get_pending_tests',
101
- description: 'Get list of pending browser tests from @test/@expect annotations.',
102
- inputSchema: {
103
- type: 'object',
104
- properties: {
105
- path: { type: 'string', description: 'Path to scan (e.g., "src/components")' },
106
- },
107
- required: ['path'],
108
- },
109
- },
110
- {
111
- name: 'mark_test_passed',
112
- description: 'Mark a test step as passed. Use the test ID returned by get_pending_tests.',
113
- inputSchema: {
114
- type: 'object',
115
- properties: {
116
- testId: { type: 'string', description: 'Test ID (e.g., "togglePin.0")' },
117
- },
118
- required: ['testId'],
119
- },
120
- },
121
- {
122
- name: 'mark_test_failed',
123
- description: 'Mark a test step as failed with a reason.',
124
- inputSchema: {
125
- type: 'object',
126
- properties: {
127
- testId: { type: 'string' },
128
- reason: { type: 'string', description: 'Why the test failed' },
129
- },
130
- required: ['testId', 'reason'],
131
- },
132
- },
133
- {
134
- name: 'get_test_summary',
135
- description: 'Get summary of test progress: passed, failed, pending counts.',
136
- inputSchema: {
137
- type: 'object',
138
- properties: {
139
- path: { type: 'string' },
140
- },
141
- required: ['path'],
142
- },
143
- },
144
- {
145
- name: 'reset_test_state',
146
- description: 'Reset all test progress to start fresh.',
147
- inputSchema: {
148
- type: 'object',
149
- properties: {},
150
- },
151
- },
152
-
153
- // Filter Configuration Tools
154
- {
155
- name: 'get_filters',
156
- description: 'Get current filter configuration (excluded dirs, patterns, gitignore status).',
157
- inputSchema: {
158
- type: 'object',
159
- properties: {},
160
- },
161
- },
162
- {
163
- name: 'set_filters',
164
- description: 'Update filter configuration. Pass only fields you want to change.',
165
- inputSchema: {
166
- type: 'object',
167
- properties: {
168
- excludeDirs: {
169
- type: 'array',
170
- items: { type: 'string' },
171
- description: 'Directories to exclude (replaces current list)',
172
- },
173
- excludePatterns: {
174
- type: 'array',
175
- items: { type: 'string' },
176
- description: 'File patterns to exclude (e.g., "*.test.js")',
177
- },
178
- includeHidden: {
179
- type: 'boolean',
180
- description: 'Include hidden directories (starting with .)',
181
- },
182
- useGitignore: {
183
- type: 'boolean',
184
- description: 'Parse and use .gitignore patterns',
185
- },
186
- },
187
- },
188
- },
189
- {
190
- name: 'add_excludes',
191
- description: 'Add directories to exclude list without replacing.',
192
- inputSchema: {
193
- type: 'object',
194
- properties: {
195
- dirs: {
196
- type: 'array',
197
- items: { type: 'string' },
198
- description: 'Directories to add to exclude list',
199
- },
200
- },
201
- required: ['dirs'],
202
- },
203
- },
204
- {
205
- name: 'remove_excludes',
206
- description: 'Remove directories from exclude list.',
207
- inputSchema: {
208
- type: 'object',
209
- properties: {
210
- dirs: {
211
- type: 'array',
212
- items: { type: 'string' },
213
- description: 'Directories to remove from exclude list',
214
- },
215
- },
216
- required: ['dirs'],
217
- },
218
- },
219
- {
220
- name: 'reset_filters',
221
- description: 'Reset filters to default configuration.',
222
- inputSchema: {
223
- type: 'object',
224
- properties: {},
225
- },
226
- },
227
-
228
- // Guidelines
229
- {
230
- name: 'get_usage_guide',
231
- description: [
232
- 'Get the comprehensive usage guide for project-graph with examples and best practices.',
233
- 'Call this FIRST when planning how to analyze, navigate, or audit a codebase.',
234
- 'Returns practical examples and recommended workflow for each feature area.',
235
- '',
236
- 'Available topics: navigation, analysis, testing, documentation, rules, workflow.',
237
- 'Omit topic to get the full guide.',
238
- ].join('\n'),
239
- inputSchema: {
240
- type: 'object',
241
- properties: {
242
- topic: {
243
- type: 'string',
244
- description: 'Optional topic filter: navigation, analysis, testing, documentation, rules, workflow',
245
- },
246
- },
247
- },
248
- },
249
- {
250
- name: 'get_agent_instructions',
251
- description: 'Get coding guidelines, architectural standards, and JSDoc rules for this project.',
252
- inputSchema: {
253
- type: 'object',
254
- properties: {},
255
- },
256
- },
257
-
258
- // Documentation Analysis
259
- {
260
- name: 'get_undocumented',
261
- description: 'Find classes/functions missing JSDoc annotations. Use for documentation generation.',
262
- inputSchema: {
263
- type: 'object',
264
- properties: {
265
- path: {
266
- type: 'string',
267
- description: 'Path to scan (e.g., "src/components")',
268
- },
269
- level: {
270
- type: 'string',
271
- enum: ['tests', 'params', 'all'],
272
- description: 'Strictness: tests (default) = @test/@expect, params = +@param/@returns, all = +description',
273
- },
274
- },
275
- required: ['path'],
276
- },
277
- },
278
-
279
- // Code Quality
280
- {
281
- name: 'get_dead_code',
282
- description: 'Find unused functions, classes, exports, variables, and imports (dead code). Use for cleanup.',
283
- inputSchema: {
284
- type: 'object',
285
- properties: {
286
- path: {
287
- type: 'string',
288
- description: 'Path to scan (e.g., "src/")',
289
- },
290
- },
291
- required: ['path'],
292
- },
293
- },
294
- {
295
- name: 'generate_jsdoc',
296
- description: 'Generate JSDoc template for a file or specific function. Returns ready-to-use JSDoc blocks.',
297
- inputSchema: {
298
- type: 'object',
299
- properties: {
300
- path: {
301
- type: 'string',
302
- description: 'Path to JS file',
303
- },
304
- name: {
305
- type: 'string',
306
- description: 'Optional: specific function/method name',
307
- },
308
- },
309
- required: ['path'],
310
- },
311
- },
312
- {
313
- name: 'get_similar_functions',
314
- description: 'Find functionally similar functions (potential duplicates). Returns pairs with similarity score.',
315
- inputSchema: {
316
- type: 'object',
317
- properties: {
318
- path: {
319
- type: 'string',
320
- description: 'Path to scan (e.g., "src/")',
321
- },
322
- threshold: {
323
- type: 'number',
324
- description: 'Minimum similarity percentage (default: 60)',
325
- },
326
- },
327
- required: ['path'],
328
- },
329
- },
330
- {
331
- name: 'get_complexity',
332
- description: 'Analyze cyclomatic complexity of functions. Identifies high-complexity code needing refactoring.',
333
- inputSchema: {
334
- type: 'object',
335
- properties: {
336
- path: {
337
- type: 'string',
338
- description: 'Path to scan (e.g., "src/")',
339
- },
340
- minComplexity: {
341
- type: 'number',
342
- description: 'Minimum complexity to include (default: 1)',
343
- },
344
- onlyProblematic: {
345
- type: 'boolean',
346
- description: 'Only show high/critical items',
347
- },
348
- },
349
- required: ['path'],
350
- },
351
- },
352
- {
353
- name: 'get_large_files',
354
- description: 'Find files that may need splitting. Analyzes lines, functions, classes, and exports.',
355
- inputSchema: {
356
- type: 'object',
357
- properties: {
358
- path: {
359
- type: 'string',
360
- description: 'Path to scan (e.g., "src/")',
361
- },
362
- onlyProblematic: {
363
- type: 'boolean',
364
- description: 'Only show warning/critical files',
365
- },
366
- },
367
- required: ['path'],
368
- },
369
- },
370
- {
371
- name: 'get_outdated_patterns',
372
- description: 'Find legacy code patterns and redundant npm dependencies (now built into Node.js 18+).',
373
- inputSchema: {
374
- type: 'object',
375
- properties: {
376
- path: {
377
- type: 'string',
378
- description: 'Path to scan (e.g., "src/" or ".")',
379
- },
380
- codeOnly: {
381
- type: 'boolean',
382
- description: 'Only check code patterns',
383
- },
384
- depsOnly: {
385
- type: 'boolean',
386
- description: 'Only check package.json dependencies',
387
- },
388
- },
389
- required: ['path'],
390
- },
391
- },
392
- {
393
- name: 'get_full_analysis',
394
- description: 'Run ALL code quality checks at once. Returns combined report with Health Score (0-100).',
395
- inputSchema: {
396
- type: 'object',
397
- properties: {
398
- path: {
399
- type: 'string',
400
- description: 'Path to scan (e.g., "src/" or ".")',
401
- },
402
- includeItems: {
403
- type: 'boolean',
404
- description: 'Include individual items in report',
405
- },
406
- },
407
- required: ['path'],
408
- },
409
- },
410
- {
411
- name: 'get_custom_rules',
412
- description: 'List all custom code analysis rules. Rules are stored in JSON files in rules/ directory.',
413
- inputSchema: {
414
- type: 'object',
415
- properties: {},
416
- },
417
- },
418
- {
419
- name: 'set_custom_rule',
420
- description: 'Add or update a custom code analysis rule. Creates ruleset if it does not exist.',
421
- inputSchema: {
422
- type: 'object',
423
- properties: {
424
- ruleSet: {
425
- type: 'string',
426
- description: 'Name of ruleset (e.g., "symbiote", "react", "custom")',
427
- },
428
- rule: {
429
- type: 'object',
430
- description: 'Rule definition with id, name, description, pattern, patternType, replacement, severity, filePattern',
431
- },
432
- },
433
- required: ['ruleSet', 'rule'],
434
- },
435
- },
436
- {
437
- name: 'check_custom_rules',
438
- description: 'Run custom rules analysis on a directory. Returns violations found.',
439
- inputSchema: {
440
- type: 'object',
441
- properties: {
442
- path: {
443
- type: 'string',
444
- description: 'Path to scan',
445
- },
446
- ruleSet: {
447
- type: 'string',
448
- description: 'Optional: specific ruleset to use',
449
- },
450
- severity: {
451
- type: 'string',
452
- description: 'Optional: filter by severity (error/warning/info)',
453
- },
454
- },
455
- required: ['path'],
456
- },
457
- },
458
-
459
- // Framework References
460
- {
461
- name: 'get_framework_reference',
462
- description: 'Get framework-specific AI reference documentation. Auto-detects framework from project or accepts explicit name. Returns full API reference, patterns, and common mistakes as agent context.',
463
- inputSchema: {
464
- type: 'object',
465
- properties: {
466
- framework: {
467
- type: 'string',
468
- description: 'Framework reference name (e.g., "symbiote-3x"). If omitted, auto-detects from path.',
469
- },
470
- path: {
471
- type: 'string',
472
- description: 'Project path for auto-detection (e.g., "src/")',
473
- },
474
- },
475
- },
476
- },
477
-
478
- // Database Analysis
479
- {
480
- name: 'get_db_schema',
481
- description: 'Get database schema from SQL files. Extracts tables, columns, and types from schema.sql or migration files in the project.',
482
- inputSchema: {
483
- type: 'object',
484
- properties: {
485
- path: {
486
- type: 'string',
487
- description: 'Path to scan (e.g., "." or "database/")',
488
- },
489
- },
490
- required: ['path'],
491
- },
492
- },
493
- {
494
- name: 'get_table_usage',
495
- description: 'Show which functions read/write database tables. Traces SQL queries in JS/TS/Python/Go code to table references.',
496
- inputSchema: {
497
- type: 'object',
498
- properties: {
499
- path: {
500
- type: 'string',
501
- description: 'Path to scan (e.g., "src/")',
502
- },
503
- table: {
504
- type: 'string',
505
- description: 'Optional: filter to a specific table name',
506
- },
507
- },
508
- required: ['path'],
509
- },
510
- },
511
- {
512
- name: 'get_db_dead_tables',
513
- description: 'Find tables and columns defined in schema but never referenced in code queries. Requires .sql schema files in the project.',
514
- inputSchema: {
515
- type: 'object',
516
- properties: {
517
- path: {
518
- type: 'string',
519
- description: 'Path to scan (e.g., ".")',
520
- },
521
- },
522
- required: ['path'],
523
- },
524
- },
525
- ];