@syke1/mcp-server 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/README.md +112 -0
- package/dist/ai/analyzer.d.ts +3 -0
- package/dist/ai/analyzer.js +120 -0
- package/dist/ai/realtime-analyzer.d.ts +20 -0
- package/dist/ai/realtime-analyzer.js +182 -0
- package/dist/graph.d.ts +13 -0
- package/dist/graph.js +105 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +518 -0
- package/dist/languages/cpp.d.ts +2 -0
- package/dist/languages/cpp.js +109 -0
- package/dist/languages/dart.d.ts +2 -0
- package/dist/languages/dart.js +162 -0
- package/dist/languages/go.d.ts +2 -0
- package/dist/languages/go.js +111 -0
- package/dist/languages/java.d.ts +2 -0
- package/dist/languages/java.js +113 -0
- package/dist/languages/plugin.d.ts +20 -0
- package/dist/languages/plugin.js +148 -0
- package/dist/languages/python.d.ts +2 -0
- package/dist/languages/python.js +129 -0
- package/dist/languages/ruby.d.ts +2 -0
- package/dist/languages/ruby.js +97 -0
- package/dist/languages/rust.d.ts +2 -0
- package/dist/languages/rust.js +121 -0
- package/dist/languages/typescript.d.ts +2 -0
- package/dist/languages/typescript.js +138 -0
- package/dist/license/validator.d.ts +23 -0
- package/dist/license/validator.js +297 -0
- package/dist/tools/analyze-impact.d.ts +23 -0
- package/dist/tools/analyze-impact.js +102 -0
- package/dist/tools/gate-build.d.ts +25 -0
- package/dist/tools/gate-build.js +243 -0
- package/dist/watcher/file-cache.d.ts +56 -0
- package/dist/watcher/file-cache.js +241 -0
- package/dist/web/public/app.js +2398 -0
- package/dist/web/public/index.html +258 -0
- package/dist/web/public/style.css +1827 -0
- package/dist/web/server.d.ts +29 -0
- package/dist/web/server.js +744 -0
- package/package.json +50 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.pythonPlugin = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const plugin_1 = require("./plugin");
|
|
40
|
+
const FROM_IMPORT_RE = /^from\s+(\S+)\s+import/;
|
|
41
|
+
const IMPORT_RE = /^import\s+(\S+)/;
|
|
42
|
+
exports.pythonPlugin = {
|
|
43
|
+
id: "python",
|
|
44
|
+
name: "Python",
|
|
45
|
+
extensions: [".py"],
|
|
46
|
+
codeBlockLang: "python",
|
|
47
|
+
detectProject(root) {
|
|
48
|
+
return fs.existsSync(path.join(root, "pyproject.toml")) ||
|
|
49
|
+
fs.existsSync(path.join(root, "requirements.txt")) ||
|
|
50
|
+
fs.existsSync(path.join(root, "setup.py"));
|
|
51
|
+
},
|
|
52
|
+
getSourceDirs(root) {
|
|
53
|
+
const srcDir = path.join(root, "src");
|
|
54
|
+
if (fs.existsSync(srcDir))
|
|
55
|
+
return [srcDir];
|
|
56
|
+
return [root];
|
|
57
|
+
},
|
|
58
|
+
getPackageName(root) {
|
|
59
|
+
try {
|
|
60
|
+
const toml = fs.readFileSync(path.join(root, "pyproject.toml"), "utf-8");
|
|
61
|
+
const match = toml.match(/name\s*=\s*"([^"]+)"/);
|
|
62
|
+
return match ? match[1] : path.basename(root);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return path.basename(root);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
discoverFiles(dir) {
|
|
69
|
+
return (0, plugin_1.discoverAllFiles)(dir, [".py"]);
|
|
70
|
+
},
|
|
71
|
+
parseImports(filePath, projectRoot, sourceDir) {
|
|
72
|
+
let content;
|
|
73
|
+
try {
|
|
74
|
+
content = fs.readFileSync(filePath, "utf-8");
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
const imports = [];
|
|
80
|
+
for (const line of content.split("\n")) {
|
|
81
|
+
const trimmed = line.trim();
|
|
82
|
+
if (trimmed.startsWith("#"))
|
|
83
|
+
continue;
|
|
84
|
+
let modulePath = null;
|
|
85
|
+
const fromMatch = trimmed.match(FROM_IMPORT_RE);
|
|
86
|
+
if (fromMatch) {
|
|
87
|
+
modulePath = fromMatch[1];
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const impMatch = trimmed.match(IMPORT_RE);
|
|
91
|
+
if (impMatch) {
|
|
92
|
+
modulePath = impMatch[1];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (!modulePath)
|
|
96
|
+
continue;
|
|
97
|
+
// Handle relative imports (starts with .)
|
|
98
|
+
if (modulePath.startsWith(".")) {
|
|
99
|
+
const dots = modulePath.match(/^\.+/)?.[0].length || 1;
|
|
100
|
+
let base = path.dirname(filePath);
|
|
101
|
+
for (let i = 1; i < dots; i++)
|
|
102
|
+
base = path.dirname(base);
|
|
103
|
+
const rest = modulePath.slice(dots).replace(/\./g, path.sep);
|
|
104
|
+
const resolved = resolveModule(base, rest);
|
|
105
|
+
if (resolved)
|
|
106
|
+
imports.push(resolved);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
// Try resolving as local module relative to source dir
|
|
110
|
+
const modPath = modulePath.replace(/\./g, path.sep);
|
|
111
|
+
const resolved = resolveModule(sourceDir, modPath);
|
|
112
|
+
if (resolved)
|
|
113
|
+
imports.push(resolved);
|
|
114
|
+
}
|
|
115
|
+
return imports;
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
function resolveModule(baseDir, modPath) {
|
|
119
|
+
const candidates = [
|
|
120
|
+
path.join(baseDir, modPath + ".py"),
|
|
121
|
+
path.join(baseDir, modPath, "__init__.py"),
|
|
122
|
+
];
|
|
123
|
+
for (const c of candidates) {
|
|
124
|
+
const normalized = path.normalize(c);
|
|
125
|
+
if (fs.existsSync(normalized))
|
|
126
|
+
return normalized;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.rubyPlugin = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const plugin_1 = require("./plugin");
|
|
40
|
+
const REQUIRE_RELATIVE_RE = /^require_relative\s+['"](.+?)['"]/;
|
|
41
|
+
exports.rubyPlugin = {
|
|
42
|
+
id: "ruby",
|
|
43
|
+
name: "Ruby",
|
|
44
|
+
extensions: [".rb"],
|
|
45
|
+
codeBlockLang: "ruby",
|
|
46
|
+
detectProject(root) {
|
|
47
|
+
return fs.existsSync(path.join(root, "Gemfile"));
|
|
48
|
+
},
|
|
49
|
+
getSourceDirs(root) {
|
|
50
|
+
const libDir = path.join(root, "lib");
|
|
51
|
+
if (fs.existsSync(libDir))
|
|
52
|
+
return [libDir];
|
|
53
|
+
return [root];
|
|
54
|
+
},
|
|
55
|
+
getPackageName(root) {
|
|
56
|
+
// Try reading from gemspec
|
|
57
|
+
try {
|
|
58
|
+
const gemspecs = fs.readdirSync(root).filter(f => f.endsWith(".gemspec"));
|
|
59
|
+
if (gemspecs.length > 0) {
|
|
60
|
+
const content = fs.readFileSync(path.join(root, gemspecs[0]), "utf-8");
|
|
61
|
+
const match = content.match(/\.name\s*=\s*['"]([^'"]+)['"]/);
|
|
62
|
+
if (match)
|
|
63
|
+
return match[1];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch { }
|
|
67
|
+
return path.basename(root);
|
|
68
|
+
},
|
|
69
|
+
discoverFiles(dir) {
|
|
70
|
+
return (0, plugin_1.discoverAllFiles)(dir, [".rb"]);
|
|
71
|
+
},
|
|
72
|
+
parseImports(filePath, _projectRoot, _sourceDir) {
|
|
73
|
+
let content;
|
|
74
|
+
try {
|
|
75
|
+
content = fs.readFileSync(filePath, "utf-8");
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const fileDir = path.dirname(filePath);
|
|
81
|
+
const imports = [];
|
|
82
|
+
for (const line of content.split("\n")) {
|
|
83
|
+
const trimmed = line.trim();
|
|
84
|
+
if (trimmed.startsWith("#"))
|
|
85
|
+
continue;
|
|
86
|
+
const match = trimmed.match(REQUIRE_RELATIVE_RE);
|
|
87
|
+
if (!match)
|
|
88
|
+
continue;
|
|
89
|
+
const reqPath = match[1];
|
|
90
|
+
const resolved = path.normalize(path.resolve(fileDir, reqPath + ".rb"));
|
|
91
|
+
if (fs.existsSync(resolved)) {
|
|
92
|
+
imports.push(resolved);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return imports;
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.rustPlugin = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const plugin_1 = require("./plugin");
|
|
40
|
+
const USE_CRATE_RE = /^use\s+crate::(\S+)/;
|
|
41
|
+
const MOD_RE = /^mod\s+(\w+)\s*;/;
|
|
42
|
+
exports.rustPlugin = {
|
|
43
|
+
id: "rust",
|
|
44
|
+
name: "Rust",
|
|
45
|
+
extensions: [".rs"],
|
|
46
|
+
codeBlockLang: "rust",
|
|
47
|
+
detectProject(root) {
|
|
48
|
+
return fs.existsSync(path.join(root, "Cargo.toml"));
|
|
49
|
+
},
|
|
50
|
+
getSourceDirs(root) {
|
|
51
|
+
const srcDir = path.join(root, "src");
|
|
52
|
+
return fs.existsSync(srcDir) ? [srcDir] : [];
|
|
53
|
+
},
|
|
54
|
+
getPackageName(root) {
|
|
55
|
+
try {
|
|
56
|
+
const cargo = fs.readFileSync(path.join(root, "Cargo.toml"), "utf-8");
|
|
57
|
+
const match = cargo.match(/name\s*=\s*"([^"]+)"/);
|
|
58
|
+
return match ? match[1] : path.basename(root);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return path.basename(root);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
discoverFiles(dir) {
|
|
65
|
+
return (0, plugin_1.discoverAllFiles)(dir, [".rs"]);
|
|
66
|
+
},
|
|
67
|
+
parseImports(filePath, _projectRoot, sourceDir) {
|
|
68
|
+
let content;
|
|
69
|
+
try {
|
|
70
|
+
content = fs.readFileSync(filePath, "utf-8");
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
const imports = [];
|
|
76
|
+
for (const line of content.split("\n")) {
|
|
77
|
+
const trimmed = line.trim();
|
|
78
|
+
// use crate::module::submodule
|
|
79
|
+
const useMatch = trimmed.match(USE_CRATE_RE);
|
|
80
|
+
if (useMatch) {
|
|
81
|
+
const cratePath = useMatch[1].replace(/::/g, path.sep).replace(/;$/, "").replace(/\{.*$/, "");
|
|
82
|
+
const resolved = resolveRustPath(sourceDir, cratePath);
|
|
83
|
+
if (resolved)
|
|
84
|
+
imports.push(resolved);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
// mod module_name;
|
|
88
|
+
const modMatch = trimmed.match(MOD_RE);
|
|
89
|
+
if (modMatch) {
|
|
90
|
+
const modName = modMatch[1];
|
|
91
|
+
const fileDir = path.dirname(filePath);
|
|
92
|
+
const resolved = resolveRustMod(fileDir, modName);
|
|
93
|
+
if (resolved)
|
|
94
|
+
imports.push(resolved);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return imports;
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
function resolveRustPath(srcDir, modPath) {
|
|
101
|
+
const candidates = [
|
|
102
|
+
path.normalize(path.join(srcDir, modPath + ".rs")),
|
|
103
|
+
path.normalize(path.join(srcDir, modPath, "mod.rs")),
|
|
104
|
+
];
|
|
105
|
+
for (const c of candidates) {
|
|
106
|
+
if (fs.existsSync(c))
|
|
107
|
+
return c;
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
function resolveRustMod(dir, modName) {
|
|
112
|
+
const candidates = [
|
|
113
|
+
path.normalize(path.join(dir, modName + ".rs")),
|
|
114
|
+
path.normalize(path.join(dir, modName, "mod.rs")),
|
|
115
|
+
];
|
|
116
|
+
for (const c of candidates) {
|
|
117
|
+
if (fs.existsSync(c))
|
|
118
|
+
return c;
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.typescriptPlugin = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const plugin_1 = require("./plugin");
|
|
40
|
+
const TS_IMPORT_RE = /(?:import|export)\s+.*?from\s+['"](.+?)['"]/;
|
|
41
|
+
const TS_SIDE_EFFECT_RE = /^import\s+['"](.+?)['"]/;
|
|
42
|
+
function resolveTsImport(fromDir, importPath) {
|
|
43
|
+
const base = path.resolve(fromDir, importPath);
|
|
44
|
+
const candidates = [
|
|
45
|
+
base,
|
|
46
|
+
base + ".ts",
|
|
47
|
+
base + ".js",
|
|
48
|
+
path.join(base, "index.ts"),
|
|
49
|
+
path.join(base, "index.js"),
|
|
50
|
+
];
|
|
51
|
+
for (const candidate of candidates) {
|
|
52
|
+
if (fs.existsSync(candidate)) {
|
|
53
|
+
return path.normalize(candidate);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
exports.typescriptPlugin = {
|
|
59
|
+
id: "typescript",
|
|
60
|
+
name: "TypeScript",
|
|
61
|
+
extensions: [".ts", ".tsx"],
|
|
62
|
+
codeBlockLang: "typescript",
|
|
63
|
+
detectProject(root) {
|
|
64
|
+
return fs.existsSync(path.join(root, "tsconfig.json")) ||
|
|
65
|
+
(fs.existsSync(path.join(root, "package.json")) &&
|
|
66
|
+
fs.existsSync(path.join(root, "src")));
|
|
67
|
+
},
|
|
68
|
+
getSourceDirs(root) {
|
|
69
|
+
const srcDir = path.join(root, "src");
|
|
70
|
+
return fs.existsSync(srcDir) ? [srcDir] : [];
|
|
71
|
+
},
|
|
72
|
+
getPackageName(root) {
|
|
73
|
+
try {
|
|
74
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf-8"));
|
|
75
|
+
return pkg.name || path.basename(root);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return path.basename(root);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
discoverFiles(dir) {
|
|
82
|
+
return (0, plugin_1.discoverAllFiles)(dir, [".ts", ".tsx"]).filter(f => !f.endsWith(".d.ts"));
|
|
83
|
+
},
|
|
84
|
+
parseImports(filePath, _projectRoot, _sourceDir) {
|
|
85
|
+
let content;
|
|
86
|
+
try {
|
|
87
|
+
content = fs.readFileSync(filePath, "utf-8");
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
const fileDir = path.dirname(filePath);
|
|
93
|
+
const imports = [];
|
|
94
|
+
for (const line of content.split("\n")) {
|
|
95
|
+
const trimmed = line.trim();
|
|
96
|
+
let importPath = null;
|
|
97
|
+
const match = trimmed.match(TS_IMPORT_RE) || trimmed.match(TS_SIDE_EFFECT_RE);
|
|
98
|
+
if (match)
|
|
99
|
+
importPath = match[1];
|
|
100
|
+
if (!importPath)
|
|
101
|
+
continue;
|
|
102
|
+
if (!importPath.startsWith("."))
|
|
103
|
+
continue;
|
|
104
|
+
const resolved = resolveTsImport(fileDir, importPath);
|
|
105
|
+
if (resolved)
|
|
106
|
+
imports.push(resolved);
|
|
107
|
+
}
|
|
108
|
+
return imports;
|
|
109
|
+
},
|
|
110
|
+
classifyLayer(relPath) {
|
|
111
|
+
const lower = relPath.toLowerCase();
|
|
112
|
+
const fileName = lower.split("/").pop() || "";
|
|
113
|
+
if (fileName.endsWith(".jsx") || fileName.endsWith(".tsx") ||
|
|
114
|
+
lower.includes("components/") || lower.includes("web/public/")) {
|
|
115
|
+
return "FE";
|
|
116
|
+
}
|
|
117
|
+
if (fileName.endsWith("server.ts") || fileName.endsWith("server.js") ||
|
|
118
|
+
lower.includes("web/server")) {
|
|
119
|
+
return "API";
|
|
120
|
+
}
|
|
121
|
+
if (fileName.endsWith(".model.ts") || fileName.endsWith(".entity.ts") ||
|
|
122
|
+
fileName.endsWith(".schema.ts")) {
|
|
123
|
+
return "DB";
|
|
124
|
+
}
|
|
125
|
+
if (fileName.endsWith(".service.ts") || fileName.endsWith(".controller.ts") ||
|
|
126
|
+
lower.includes("tools/") || lower.includes("ai/") || lower.includes("watcher/")) {
|
|
127
|
+
return "BE";
|
|
128
|
+
}
|
|
129
|
+
if (fileName === "index.ts" || fileName === "index.js" ||
|
|
130
|
+
fileName.endsWith(".config.ts") || fileName.endsWith(".config.js")) {
|
|
131
|
+
return "CONFIG";
|
|
132
|
+
}
|
|
133
|
+
if (fileName.endsWith(".util.ts") || fileName.endsWith(".helper.ts")) {
|
|
134
|
+
return "UTIL";
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
},
|
|
138
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface LicenseStatus {
|
|
2
|
+
plan: "free" | "pro";
|
|
3
|
+
email?: string;
|
|
4
|
+
expiresAt?: string;
|
|
5
|
+
source: "online" | "cache" | "default";
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Start heartbeat interval (called after successful Pro validation)
|
|
10
|
+
*/
|
|
11
|
+
export declare function startHeartbeat(key: string, deviceId: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Stop heartbeat and deactivate session (called on shutdown)
|
|
14
|
+
*/
|
|
15
|
+
export declare function stopAndDeactivate(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Get current device fingerprint (exported for use by index.ts)
|
|
18
|
+
*/
|
|
19
|
+
export declare function getDeviceId(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Main license validation — called on MCP server startup
|
|
22
|
+
*/
|
|
23
|
+
export declare function checkLicense(): Promise<LicenseStatus>;
|