project-graph-mcp 1.5.0 → 2.1.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/README.md +171 -31
- package/docs/img/explorer-compact.jpg +0 -0
- package/docs/img/explorer-expanded.jpg +0 -0
- package/package.json +12 -8
- package/src/.project-graph-cache.json +1 -1
- package/src/analysis/analysis-cache.js +7 -0
- package/src/analysis/complexity.js +14 -0
- package/src/analysis/custom-rules.js +36 -0
- package/src/analysis/db-analysis.js +9 -0
- package/src/analysis/dead-code.js +19 -0
- package/src/analysis/full-analysis.js +18 -0
- package/src/analysis/jsdoc-checker.js +24 -0
- package/src/analysis/jsdoc-generator.js +10 -0
- package/src/analysis/large-files.js +11 -0
- package/src/analysis/outdated-patterns.js +12 -0
- package/src/analysis/similar-functions.js +16 -0
- package/src/analysis/test-annotations.js +21 -0
- package/src/analysis/type-checker.js +8 -0
- package/src/analysis/undocumented.js +14 -0
- package/src/cli/cli-handlers.js +4 -0
- package/src/cli/cli.js +5 -0
- package/src/compact/.project-graph-cache.json +1 -0
- package/src/compact/ai-context.js +7 -0
- package/src/compact/compact-migrate.js +17 -0
- package/src/compact/compact.js +18 -0
- package/src/compact/compress.js +14 -0
- package/src/compact/ctx-to-jsdoc.js +29 -0
- package/src/compact/doc-dialect.js +30 -0
- package/src/compact/expand.js +37 -0
- package/src/compact/framework-references.js +5 -0
- package/src/compact/instructions.js +3 -0
- package/src/compact/mode-config.js +8 -0
- package/src/compact/validate-pipeline.js +9 -0
- package/src/core/event-bus.js +9 -0
- package/src/core/filters.js +14 -0
- package/src/core/graph-builder.js +12 -0
- package/src/core/parser.js +31 -0
- package/src/core/workspace.js +8 -0
- package/src/lang/lang-go.js +17 -0
- package/src/lang/lang-python.js +12 -0
- package/src/lang/lang-sql.js +23 -0
- package/src/lang/lang-typescript.js +9 -0
- package/src/lang/lang-utils.js +4 -0
- package/src/mcp/mcp-server.js +17 -0
- package/src/mcp/tool-defs.js +3 -0
- package/src/mcp/tools.js +25 -0
- package/src/network/backend-lifecycle.js +19 -0
- package/src/network/backend.js +5 -0
- package/src/network/local-gateway.js +23 -0
- package/src/network/mdns.js +13 -0
- package/src/network/server.js +10 -0
- package/src/network/web-server.js +34 -0
- package/web/.project-graph-cache.json +1 -0
- package/web/app.js +17 -0
- package/web/components/code-block.js +3 -0
- package/web/components/quick-open.js +5 -0
- package/web/dashboard-state.js +3 -0
- package/web/dashboard.html +27 -0
- package/web/dashboard.js +8 -0
- package/web/highlight.js +13 -0
- package/web/index.html +35 -0
- package/web/panels/ActionBoard/ActionBoard.css.js +1 -0
- package/web/panels/ActionBoard/ActionBoard.js +4 -0
- package/web/panels/ActionBoard/ActionBoard.tpl.js +1 -0
- package/web/panels/EventItem/EventItem.css.js +1 -0
- package/web/panels/EventItem/EventItem.js +4 -0
- package/web/panels/EventItem/EventItem.tpl.js +1 -0
- package/web/panels/ProjectItem/ProjectItem.css.js +1 -0
- package/web/panels/ProjectItem/ProjectItem.js +5 -0
- package/web/panels/ProjectItem/ProjectItem.tpl.js +1 -0
- package/web/panels/ProjectList/ProjectList.css.js +1 -0
- package/web/panels/ProjectList/ProjectList.js +4 -0
- package/web/panels/ProjectList/ProjectList.tpl.js +1 -0
- package/web/panels/SettingsPanel/.project-graph-cache.json +1 -0
- package/web/panels/SettingsPanel/SettingsPanel.css.js +1 -0
- package/web/panels/SettingsPanel/SettingsPanel.js +7 -0
- package/web/panels/SettingsPanel/SettingsPanel.tpl.js +1 -0
- package/web/panels/code-viewer.js +5 -0
- package/web/panels/ctx-panel.js +4 -0
- package/web/panels/dep-graph.js +6 -0
- package/web/panels/file-tree.js +188 -0
- package/web/panels/health-panel.js +3 -0
- package/web/panels/live-monitor.js +3 -0
- package/web/state.js +17 -0
- package/web/style.css +157 -0
- package/references/symbiote-3x.md +0 -834
- package/src/ai-context.js +0 -113
- package/src/analysis-cache.js +0 -155
- package/src/cli-handlers.js +0 -271
- package/src/cli.js +0 -95
- package/src/compact.js +0 -207
- package/src/complexity.js +0 -237
- package/src/compress.js +0 -319
- package/src/ctx-to-jsdoc.js +0 -514
- package/src/custom-rules.js +0 -584
- package/src/db-analysis.js +0 -194
- package/src/dead-code.js +0 -468
- package/src/doc-dialect.js +0 -716
- package/src/filters.js +0 -227
- package/src/framework-references.js +0 -177
- package/src/full-analysis.js +0 -470
- package/src/graph-builder.js +0 -299
- package/src/instructions.js +0 -73
- package/src/jsdoc-checker.js +0 -351
- package/src/jsdoc-generator.js +0 -203
- package/src/lang-go.js +0 -285
- package/src/lang-python.js +0 -197
- package/src/lang-sql.js +0 -309
- package/src/lang-typescript.js +0 -190
- package/src/lang-utils.js +0 -124
- package/src/large-files.js +0 -163
- package/src/mcp-server.js +0 -675
- package/src/mode-config.js +0 -127
- package/src/outdated-patterns.js +0 -296
- package/src/parser.js +0 -662
- package/src/server.js +0 -28
- package/src/similar-functions.js +0 -279
- package/src/test-annotations.js +0 -323
- package/src/tool-defs.js +0 -793
- package/src/tools.js +0 -470
- package/src/type-checker.js +0 -188
- package/src/undocumented.js +0 -259
- package/src/workspace.js +0 -70
- /package/{AGENT_ROLE.md → docs/examples/AGENT_ROLE.md} +0 -0
- /package/{AGENT_ROLE_MINIMAL.md → docs/examples/AGENT_ROLE_MINIMAL.md} +0 -0
package/src/large-files.js
DELETED
|
@@ -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
|
-
}
|