trace-mcp 1.15.2 → 1.16.1
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/dist/cli.js +45 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.js +32 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/scripts/postinstall-app.mjs +107 -0
package/dist/cli.js
CHANGED
|
@@ -88596,7 +88596,7 @@ import https from "https";
|
|
|
88596
88596
|
import { spawnSync } from "child_process";
|
|
88597
88597
|
import path63 from "path";
|
|
88598
88598
|
import fs64 from "fs";
|
|
88599
|
-
var CURRENT_VERSION = true ? "1.
|
|
88599
|
+
var CURRENT_VERSION = true ? "1.16.1" : "0.0.0-dev";
|
|
88600
88600
|
var UPDATE_CACHE_PATH = path63.join(TRACE_MCP_HOME, "update-check.json");
|
|
88601
88601
|
function readCache() {
|
|
88602
88602
|
try {
|
|
@@ -105899,12 +105899,30 @@ function buildGraphData(store, opts) {
|
|
|
105899
105899
|
}
|
|
105900
105900
|
return buildSingleProjectGraph(store, opts, scope, depth, granularity, hideIsolated);
|
|
105901
105901
|
}
|
|
105902
|
+
var GRAPH_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
105903
|
+
"node_modules",
|
|
105904
|
+
"vendor",
|
|
105905
|
+
".git",
|
|
105906
|
+
"dist",
|
|
105907
|
+
"build",
|
|
105908
|
+
"__pycache__",
|
|
105909
|
+
".venv",
|
|
105910
|
+
".next",
|
|
105911
|
+
".nuxt",
|
|
105912
|
+
"coverage",
|
|
105913
|
+
".turbo",
|
|
105914
|
+
".cache"
|
|
105915
|
+
]);
|
|
105916
|
+
function isExcludedPath(filePath) {
|
|
105917
|
+
const segments = filePath.split("/");
|
|
105918
|
+
return segments.some((seg) => GRAPH_EXCLUDE_DIRS.has(seg));
|
|
105919
|
+
}
|
|
105902
105920
|
function buildSingleProjectGraph(store, opts, scope, depth, granularity, hideIsolated) {
|
|
105903
105921
|
let seedFiles;
|
|
105904
105922
|
if (scope === "project") {
|
|
105905
|
-
seedFiles = store.getAllFiles();
|
|
105923
|
+
seedFiles = store.getAllFiles().filter((f) => !isExcludedPath(f.path));
|
|
105906
105924
|
} else {
|
|
105907
|
-
const allFiles = store.getAllFiles();
|
|
105925
|
+
const allFiles = store.getAllFiles().filter((f) => !isExcludedPath(f.path));
|
|
105908
105926
|
if (scope.includes("*")) {
|
|
105909
105927
|
const isMatch = (0, import_picomatch2.default)(scope, { dot: true });
|
|
105910
105928
|
seedFiles = allFiles.filter((f) => isMatch(f.path));
|
|
@@ -105941,7 +105959,7 @@ function buildFederatedGraph(mainStore, opts) {
|
|
|
105941
105959
|
opts.granularity ?? "file",
|
|
105942
105960
|
opts.hideIsolated === true
|
|
105943
105961
|
);
|
|
105944
|
-
const mainPrefix =
|
|
105962
|
+
const mainPrefix = allRepos.find((r) => r.repo_root === projectRoot)?.name ?? path94.basename(projectRoot);
|
|
105945
105963
|
for (const n of mainResult.nodes) {
|
|
105946
105964
|
n.repo = mainPrefix;
|
|
105947
105965
|
allNodes.push(n);
|
|
@@ -106074,6 +106092,7 @@ function buildFileGraph2(store, seedFiles, depth, edgeFilter, hideIsolated, opts
|
|
|
106074
106092
|
const vizNodeMap = /* @__PURE__ */ new Map();
|
|
106075
106093
|
for (const [, file] of allFilesById) {
|
|
106076
106094
|
if (vizNodeMap.has(file.path)) continue;
|
|
106095
|
+
if (isExcludedPath(file.path)) continue;
|
|
106077
106096
|
vizNodeMap.set(file.path, {
|
|
106078
106097
|
id: file.path,
|
|
106079
106098
|
label: path94.basename(file.path),
|
|
@@ -106140,8 +106159,15 @@ function buildSymbolGraph(store, seedFiles, depth, edgeFilter, hideIsolated, opt
|
|
|
106140
106159
|
}
|
|
106141
106160
|
const fileNodeRefs = store.getNodeRefsBatch([...visitedFileNodes]);
|
|
106142
106161
|
const connectedFileIds = /* @__PURE__ */ new Set();
|
|
106162
|
+
const candidateFileRefIds = [];
|
|
106163
|
+
for (const [, ref] of fileNodeRefs) {
|
|
106164
|
+
if (ref.nodeType === "file") candidateFileRefIds.push(ref.refId);
|
|
106165
|
+
}
|
|
106166
|
+
const candidateFilesMap = candidateFileRefIds.length > 0 ? store.getFilesByIds(candidateFileRefIds) : /* @__PURE__ */ new Map();
|
|
106143
106167
|
for (const [nodeId, ref] of fileNodeRefs) {
|
|
106144
106168
|
if (ref.nodeType === "file") {
|
|
106169
|
+
const file = candidateFilesMap.get(ref.refId);
|
|
106170
|
+
if (file && isExcludedPath(file.path)) continue;
|
|
106145
106171
|
nodeIdToFileId.set(nodeId, ref.refId);
|
|
106146
106172
|
connectedFileIds.add(ref.refId);
|
|
106147
106173
|
}
|
|
@@ -106210,6 +106236,7 @@ function buildSymbolGraph(store, seedFiles, depth, edgeFilter, hideIsolated, opt
|
|
|
106210
106236
|
const symbolIdToVizId = /* @__PURE__ */ new Map();
|
|
106211
106237
|
for (const sym of symbolsById.values()) {
|
|
106212
106238
|
const file = filesById.get(sym.file_id);
|
|
106239
|
+
if (file && isExcludedPath(file.path)) continue;
|
|
106213
106240
|
vizNodes.push({
|
|
106214
106241
|
id: sym.symbol_id,
|
|
106215
106242
|
label: sym.name,
|
|
@@ -106478,7 +106505,7 @@ DATA.edges.forEach(e => {
|
|
|
106478
106505
|
});
|
|
106479
106506
|
|
|
106480
106507
|
// BFS to collect neighbors at N levels deep \u2014 returns Map<nodeId, depthLevel>
|
|
106481
|
-
let highlightDepth = ${opts
|
|
106508
|
+
let highlightDepth = ${opts?.highlightDepth ?? 1};
|
|
106482
106509
|
function getNeighborsAtDepth(startId, maxDepth) {
|
|
106483
106510
|
const depthMap = new Map(); // nodeId \u2192 depth level (1-based)
|
|
106484
106511
|
let frontier = new Set([startId]);
|
|
@@ -115478,7 +115505,7 @@ var TopologyStore = class {
|
|
|
115478
115505
|
};
|
|
115479
115506
|
|
|
115480
115507
|
// src/server/server.ts
|
|
115481
|
-
var PKG_VERSION = true ? "1.
|
|
115508
|
+
var PKG_VERSION = true ? "1.16.1" : "0.0.0-dev";
|
|
115482
115509
|
function j2(value) {
|
|
115483
115510
|
return JSON.stringify(value, (_key, val) => val === null || val === void 0 ? void 0 : val);
|
|
115484
115511
|
}
|
|
@@ -120676,7 +120703,7 @@ var visualizeCommand = new Command12("visualize").alias("viz").description("Gene
|
|
|
120676
120703
|
topoStore?.close();
|
|
120677
120704
|
db.close();
|
|
120678
120705
|
if (result.isErr()) {
|
|
120679
|
-
console.error("Error:", result.error.message);
|
|
120706
|
+
console.error("Error:", "message" in result.error ? result.error.message : result.error.code);
|
|
120680
120707
|
process.exit(1);
|
|
120681
120708
|
}
|
|
120682
120709
|
console.log(`Graph: ${result.value.nodes} nodes, ${result.value.edges} edges, ${result.value.communities} communities`);
|
|
@@ -120695,7 +120722,7 @@ visualizeCommand.command("federation").alias("fed").description("Open federation
|
|
|
120695
120722
|
});
|
|
120696
120723
|
topoStore.close();
|
|
120697
120724
|
if (result.isErr()) {
|
|
120698
|
-
console.error("Error:", result.error.message);
|
|
120725
|
+
console.error("Error:", "message" in result.error ? result.error.message : result.error.code);
|
|
120699
120726
|
process.exit(1);
|
|
120700
120727
|
}
|
|
120701
120728
|
console.log(`Federation: ${result.value.services} services, ${result.value.edges} edges`);
|
|
@@ -121058,7 +121085,7 @@ var ProjectManager = class {
|
|
|
121058
121085
|
|
|
121059
121086
|
// src/cli.ts
|
|
121060
121087
|
init_global();
|
|
121061
|
-
var PKG_VERSION2 = true ? "1.
|
|
121088
|
+
var PKG_VERSION2 = true ? "1.16.1" : "0.0.0-dev";
|
|
121062
121089
|
function registerDefaultPlugins2(registry) {
|
|
121063
121090
|
for (const p5 of createAllLanguagePlugins()) registry.registerLanguagePlugin(p5);
|
|
121064
121091
|
for (const p5 of createAllIntegrationPlugins()) registry.registerFrameworkPlugin(p5);
|
|
@@ -121360,6 +121387,15 @@ program.command("serve-http").description("Start MCP server (HTTP/SSE transport)
|
|
|
121360
121387
|
const startedAt = Date.now();
|
|
121361
121388
|
const httpServer = http.createServer(async (req, res) => {
|
|
121362
121389
|
const clientIp = req.socket.remoteAddress ?? "unknown";
|
|
121390
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
121391
|
+
res.setHeader("Access-Control-Expose-Headers", "X-Graph-Nodes, X-Graph-Edges, X-Graph-Communities");
|
|
121392
|
+
if (req.method === "OPTIONS") {
|
|
121393
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
|
121394
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
121395
|
+
res.writeHead(204);
|
|
121396
|
+
res.end();
|
|
121397
|
+
return;
|
|
121398
|
+
}
|
|
121363
121399
|
if (isRateLimited(clientIp)) {
|
|
121364
121400
|
res.writeHead(429, { "Content-Type": "application/json", "Retry-After": "60" });
|
|
121365
121401
|
res.end(JSON.stringify({ error: "Too many requests" }));
|