project-graph-mcp 1.5.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 (121) hide show
  1. package/README.md +128 -8
  2. package/package.json +12 -8
  3. package/src/.project-graph-cache.json +1 -1
  4. package/src/analysis/analysis-cache.js +7 -0
  5. package/src/analysis/complexity.js +14 -0
  6. package/src/analysis/custom-rules.js +36 -0
  7. package/src/analysis/db-analysis.js +9 -0
  8. package/src/analysis/dead-code.js +19 -0
  9. package/src/analysis/full-analysis.js +18 -0
  10. package/src/analysis/jsdoc-checker.js +24 -0
  11. package/src/analysis/jsdoc-generator.js +10 -0
  12. package/src/analysis/large-files.js +11 -0
  13. package/src/analysis/outdated-patterns.js +12 -0
  14. package/src/analysis/similar-functions.js +16 -0
  15. package/src/analysis/test-annotations.js +21 -0
  16. package/src/analysis/type-checker.js +8 -0
  17. package/src/analysis/undocumented.js +14 -0
  18. package/src/cli/cli-handlers.js +4 -0
  19. package/src/cli/cli.js +5 -0
  20. package/src/compact/ai-context.js +7 -0
  21. package/src/compact/compact.js +18 -0
  22. package/src/compact/compress.js +13 -0
  23. package/src/compact/ctx-to-jsdoc.js +29 -0
  24. package/src/compact/doc-dialect.js +30 -0
  25. package/src/compact/expand.js +37 -0
  26. package/src/compact/framework-references.js +5 -0
  27. package/src/compact/instructions.js +3 -0
  28. package/src/compact/mode-config.js +8 -0
  29. package/src/compact/validate-pipeline.js +9 -0
  30. package/src/core/event-bus.js +9 -0
  31. package/src/core/filters.js +14 -0
  32. package/src/core/graph-builder.js +12 -0
  33. package/src/core/parser.js +31 -0
  34. package/src/core/workspace.js +8 -0
  35. package/src/lang/lang-go.js +17 -0
  36. package/src/lang/lang-python.js +12 -0
  37. package/src/lang/lang-sql.js +23 -0
  38. package/src/lang/lang-typescript.js +9 -0
  39. package/src/lang/lang-utils.js +4 -0
  40. package/src/mcp/mcp-server.js +17 -0
  41. package/src/mcp/tool-defs.js +3 -0
  42. package/src/mcp/tools.js +25 -0
  43. package/src/network/backend-lifecycle.js +19 -0
  44. package/src/network/backend.js +5 -0
  45. package/src/network/local-gateway.js +23 -0
  46. package/src/network/mdns.js +13 -0
  47. package/src/network/server.js +10 -0
  48. package/src/network/web-server.js +34 -0
  49. package/web/.project-graph-cache.json +1 -0
  50. package/web/app.js +16 -0
  51. package/web/components/code-block.js +3 -0
  52. package/web/components/quick-open.js +5 -0
  53. package/web/dashboard-state.js +3 -0
  54. package/web/dashboard.html +27 -0
  55. package/web/dashboard.js +8 -0
  56. package/web/highlight.js +13 -0
  57. package/web/index.html +35 -0
  58. package/web/panels/ActionBoard/ActionBoard.css.js +1 -0
  59. package/web/panels/ActionBoard/ActionBoard.js +4 -0
  60. package/web/panels/ActionBoard/ActionBoard.tpl.js +1 -0
  61. package/web/panels/EventItem/EventItem.css.js +1 -0
  62. package/web/panels/EventItem/EventItem.js +4 -0
  63. package/web/panels/EventItem/EventItem.tpl.js +1 -0
  64. package/web/panels/ProjectItem/ProjectItem.css.js +1 -0
  65. package/web/panels/ProjectItem/ProjectItem.js +5 -0
  66. package/web/panels/ProjectItem/ProjectItem.tpl.js +1 -0
  67. package/web/panels/ProjectList/ProjectList.css.js +1 -0
  68. package/web/panels/ProjectList/ProjectList.js +4 -0
  69. package/web/panels/ProjectList/ProjectList.tpl.js +1 -0
  70. package/web/panels/SettingsPanel/.project-graph-cache.json +1 -0
  71. package/web/panels/SettingsPanel/SettingsPanel.css.js +1 -0
  72. package/web/panels/SettingsPanel/SettingsPanel.js +7 -0
  73. package/web/panels/SettingsPanel/SettingsPanel.tpl.js +1 -0
  74. package/web/panels/code-viewer.js +5 -0
  75. package/web/panels/ctx-panel.js +4 -0
  76. package/web/panels/dep-graph.js +6 -0
  77. package/web/panels/file-tree.js +188 -0
  78. package/web/panels/health-panel.js +3 -0
  79. package/web/panels/live-monitor.js +3 -0
  80. package/web/state.js +17 -0
  81. package/web/style.css +157 -0
  82. package/references/symbiote-3x.md +0 -834
  83. package/src/ai-context.js +0 -113
  84. package/src/analysis-cache.js +0 -155
  85. package/src/cli-handlers.js +0 -271
  86. package/src/cli.js +0 -95
  87. package/src/compact.js +0 -207
  88. package/src/complexity.js +0 -237
  89. package/src/compress.js +0 -319
  90. package/src/ctx-to-jsdoc.js +0 -514
  91. package/src/custom-rules.js +0 -584
  92. package/src/db-analysis.js +0 -194
  93. package/src/dead-code.js +0 -468
  94. package/src/doc-dialect.js +0 -716
  95. package/src/filters.js +0 -227
  96. package/src/framework-references.js +0 -177
  97. package/src/full-analysis.js +0 -470
  98. package/src/graph-builder.js +0 -299
  99. package/src/instructions.js +0 -73
  100. package/src/jsdoc-checker.js +0 -351
  101. package/src/jsdoc-generator.js +0 -203
  102. package/src/lang-go.js +0 -285
  103. package/src/lang-python.js +0 -197
  104. package/src/lang-sql.js +0 -309
  105. package/src/lang-typescript.js +0 -190
  106. package/src/lang-utils.js +0 -124
  107. package/src/large-files.js +0 -163
  108. package/src/mcp-server.js +0 -675
  109. package/src/mode-config.js +0 -127
  110. package/src/outdated-patterns.js +0 -296
  111. package/src/parser.js +0 -662
  112. package/src/server.js +0 -28
  113. package/src/similar-functions.js +0 -279
  114. package/src/test-annotations.js +0 -323
  115. package/src/tool-defs.js +0 -793
  116. package/src/tools.js +0 -470
  117. package/src/type-checker.js +0 -188
  118. package/src/undocumented.js +0 -259
  119. package/src/workspace.js +0 -70
  120. /package/{AGENT_ROLE.md → docs/examples/AGENT_ROLE.md} +0 -0
  121. /package/{AGENT_ROLE_MINIMAL.md → docs/examples/AGENT_ROLE_MINIMAL.md} +0 -0
@@ -1,163 +0,0 @@
1
- /**
2
- * Large Files Analyzer
3
- * Identifies files that may need splitting
4
- */
5
-
6
- import { readFileSync, readdirSync, statSync } from 'fs';
7
- import { join, relative, resolve } from 'path';
8
- import { parse } from '../vendor/acorn.mjs';
9
- import * as walk from '../vendor/walk.mjs';
10
- import { shouldExcludeDir, shouldExcludeFile, parseGitignore } from './filters.js';
11
-
12
- /**
13
- * @typedef {Object} LargeFileItem
14
- * @property {string} file
15
- * @property {number} lines
16
- * @property {number} functions
17
- * @property {number} classes
18
- * @property {number} exports
19
- * @property {string} rating - 'ok' | 'warning' | 'critical'
20
- * @property {string[]} reasons
21
- */
22
-
23
- /**
24
- * Find all JS files
25
- * @param {string} dir
26
- * @param {string} rootDir
27
- * @returns {string[]}
28
- */
29
- function findJSFiles(dir, rootDir = dir) {
30
- if (dir === rootDir) parseGitignore(rootDir);
31
- const files = [];
32
-
33
- try {
34
- for (const entry of readdirSync(dir)) {
35
- const fullPath = join(dir, entry);
36
- const relativePath = relative(rootDir, fullPath);
37
- const stat = statSync(fullPath);
38
-
39
- if (stat.isDirectory()) {
40
- if (!shouldExcludeDir(entry, relativePath)) {
41
- files.push(...findJSFiles(fullPath, rootDir));
42
- }
43
- } else if (entry.endsWith('.js') && !entry.endsWith('.css.js') && !entry.endsWith('.tpl.js')) {
44
- if (!shouldExcludeFile(entry, relativePath)) {
45
- files.push(fullPath);
46
- }
47
- }
48
- }
49
- } catch (e) { }
50
-
51
- return files;
52
- }
53
-
54
- /**
55
- * Analyze a single file
56
- * @param {string} filePath
57
- * @param {string} rootDir - Root directory for relative path calculation
58
- * @returns {LargeFileItem}
59
- */
60
- function analyzeFile(filePath, rootDir) {
61
- const code = readFileSync(filePath, 'utf-8');
62
- const relPath = relative(rootDir, filePath);
63
- const lines = code.split('\n').length;
64
-
65
- let functions = 0;
66
- let classes = 0;
67
- let exports = 0;
68
-
69
- let ast;
70
- try {
71
- ast = parse(code, { ecmaVersion: 'latest', sourceType: 'module', locations: true });
72
- } catch (e) {
73
- return { file: relPath, lines, functions: 0, classes: 0, exports: 0, rating: 'ok', reasons: [] };
74
- }
75
-
76
- walk.simple(ast, {
77
- FunctionDeclaration() { functions++; },
78
- ArrowFunctionExpression(node) {
79
- if (node.body.type === 'BlockStatement') functions++;
80
- },
81
- ClassDeclaration() { classes++; },
82
- ExportNamedDeclaration() { exports++; },
83
- ExportDefaultDeclaration() { exports++; },
84
- });
85
-
86
- // Calculate rating
87
- const reasons = [];
88
- let score = 0;
89
-
90
- if (lines > 500) {
91
- score += 2;
92
- reasons.push(`${lines} lines (>500)`);
93
- } else if (lines > 300) {
94
- score += 1;
95
- reasons.push(`${lines} lines (>300)`);
96
- }
97
-
98
- if (functions > 15) {
99
- score += 2;
100
- reasons.push(`${functions} functions (>15)`);
101
- } else if (functions > 10) {
102
- score += 1;
103
- reasons.push(`${functions} functions (>10)`);
104
- }
105
-
106
- if (classes > 3) {
107
- score += 2;
108
- reasons.push(`${classes} classes (>3)`);
109
- } else if (classes > 1) {
110
- score += 1;
111
- reasons.push(`${classes} classes (>1)`);
112
- }
113
-
114
- if (exports > 10) {
115
- score += 2;
116
- reasons.push(`${exports} exports (>10)`);
117
- } else if (exports > 5) {
118
- score += 1;
119
- reasons.push(`${exports} exports (>5)`);
120
- }
121
-
122
- let rating = 'ok';
123
- if (score >= 4) rating = 'critical';
124
- else if (score >= 2) rating = 'warning';
125
-
126
- return { file: relPath, lines, functions, classes, exports, rating, reasons };
127
- }
128
-
129
- /**
130
- * Get large files analysis
131
- * @param {string} dir
132
- * @param {Object} [options]
133
- * @param {boolean} [options.onlyProblematic=false] - Only show warning/critical
134
- * @returns {Promise<{total: number, stats: Object, items: LargeFileItem[]}>}
135
- */
136
- export async function getLargeFiles(dir, options = {}) {
137
- const onlyProblematic = options.onlyProblematic || false;
138
- const resolvedDir = resolve(dir);
139
- const files = findJSFiles(dir);
140
- let items = files.map(f => analyzeFile(f, resolvedDir));
141
-
142
- if (onlyProblematic) {
143
- items = items.filter(i => i.rating !== 'ok');
144
- }
145
-
146
- // Sort by lines descending
147
- items.sort((a, b) => b.lines - a.lines);
148
-
149
- const stats = {
150
- totalFiles: files.length,
151
- ok: items.filter(i => i.rating === 'ok').length,
152
- warning: items.filter(i => i.rating === 'warning').length,
153
- critical: items.filter(i => i.rating === 'critical').length,
154
- totalLines: items.reduce((s, i) => s + i.lines, 0),
155
- avgLines: items.length > 0 ? Math.round(items.reduce((s, i) => s + i.lines, 0) / items.length) : 0,
156
- };
157
-
158
- return {
159
- total: items.length,
160
- stats,
161
- items: items.slice(0, 30),
162
- };
163
- }