trace-mcp 1.14.0 → 1.14.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 +63 -20
- package/dist/cli.js.map +1 -1
- package/dist/index.js +55 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5006,7 +5006,7 @@ import https from "https";
|
|
|
5006
5006
|
import { spawnSync } from "child_process";
|
|
5007
5007
|
import path3 from "path";
|
|
5008
5008
|
import fs5 from "fs";
|
|
5009
|
-
var CURRENT_VERSION = true ? "1.14.
|
|
5009
|
+
var CURRENT_VERSION = true ? "1.14.1" : "0.0.0-dev";
|
|
5010
5010
|
var UPDATE_CACHE_PATH = path3.join(TRACE_MCP_HOME, "update-check.json");
|
|
5011
5011
|
function readCache() {
|
|
5012
5012
|
try {
|
|
@@ -13339,6 +13339,7 @@ import fs28 from "fs";
|
|
|
13339
13339
|
// src/topology/contract-parser.ts
|
|
13340
13340
|
import fs23 from "fs";
|
|
13341
13341
|
import path27 from "path";
|
|
13342
|
+
import Database2 from "better-sqlite3";
|
|
13342
13343
|
var EXCLUDE_DIRS = ["node_modules", "vendor", ".git", "dist", "build", "__pycache__"];
|
|
13343
13344
|
function parseContracts(repoRoot) {
|
|
13344
13345
|
const contracts = [];
|
|
@@ -13543,6 +13544,36 @@ function findSpecFiles(root) {
|
|
|
13543
13544
|
walk2(root, 0);
|
|
13544
13545
|
return results;
|
|
13545
13546
|
}
|
|
13547
|
+
function extractRoutesFromDb(dbPath) {
|
|
13548
|
+
if (!fs23.existsSync(dbPath)) return null;
|
|
13549
|
+
try {
|
|
13550
|
+
const db = new Database2(dbPath, { readonly: true });
|
|
13551
|
+
try {
|
|
13552
|
+
const rows = db.prepare(
|
|
13553
|
+
"SELECT method, uri, name FROM routes ORDER BY uri"
|
|
13554
|
+
).all();
|
|
13555
|
+
if (rows.length === 0) return null;
|
|
13556
|
+
const endpoints = rows.map((r) => ({
|
|
13557
|
+
method: r.method === "ANY" ? null : r.method,
|
|
13558
|
+
path: r.uri.startsWith("/") ? r.uri : `/${r.uri}`,
|
|
13559
|
+
operationId: r.name ?? void 0
|
|
13560
|
+
}));
|
|
13561
|
+
logger.debug({ dbPath, count: endpoints.length }, "Extracted routes from trace-mcp DB");
|
|
13562
|
+
return {
|
|
13563
|
+
type: "framework_routes",
|
|
13564
|
+
specPath: dbPath,
|
|
13565
|
+
version: "auto",
|
|
13566
|
+
endpoints,
|
|
13567
|
+
events: []
|
|
13568
|
+
};
|
|
13569
|
+
} finally {
|
|
13570
|
+
db.close();
|
|
13571
|
+
}
|
|
13572
|
+
} catch (e) {
|
|
13573
|
+
logger.warn({ dbPath, error: e.message }, "Failed to extract routes from DB");
|
|
13574
|
+
return null;
|
|
13575
|
+
}
|
|
13576
|
+
}
|
|
13546
13577
|
|
|
13547
13578
|
// src/topology/service-detector.ts
|
|
13548
13579
|
import fs25 from "fs";
|
|
@@ -14042,7 +14073,7 @@ function scanFileContent(filePath, content, results) {
|
|
|
14042
14073
|
|
|
14043
14074
|
// src/federation/federated-search.ts
|
|
14044
14075
|
import fs27 from "fs";
|
|
14045
|
-
import
|
|
14076
|
+
import Database3 from "better-sqlite3";
|
|
14046
14077
|
function federatedSearch(topoStore, query, filters, limit = 20) {
|
|
14047
14078
|
const repos = topoStore.getAllFederatedRepos();
|
|
14048
14079
|
const allItems = [];
|
|
@@ -14051,7 +14082,7 @@ function federatedSearch(topoStore, query, filters, limit = 20) {
|
|
|
14051
14082
|
if (!repo.db_path || !fs27.existsSync(repo.db_path)) continue;
|
|
14052
14083
|
let db = null;
|
|
14053
14084
|
try {
|
|
14054
|
-
db = new
|
|
14085
|
+
db = new Database3(repo.db_path, { readonly: true });
|
|
14055
14086
|
db.pragma("busy_timeout = 3000");
|
|
14056
14087
|
const ftsResults = searchFts(db, query, limit, 0, {
|
|
14057
14088
|
kind: filters?.kind,
|
|
@@ -14096,7 +14127,7 @@ function federatedSearch(topoStore, query, filters, limit = 20) {
|
|
|
14096
14127
|
}
|
|
14097
14128
|
|
|
14098
14129
|
// src/federation/federation-helpers.ts
|
|
14099
|
-
import
|
|
14130
|
+
import Database4 from "better-sqlite3";
|
|
14100
14131
|
|
|
14101
14132
|
// src/federation/schema-diff.ts
|
|
14102
14133
|
function diffSchemas(oldSchema, newSchema, pathPrefix = "") {
|
|
@@ -14322,7 +14353,7 @@ function detectBreakingChanges2(topoStore, ep) {
|
|
|
14322
14353
|
function resolveSymbolsAtLocation(dbPath, filePath, line) {
|
|
14323
14354
|
if (!line) return [];
|
|
14324
14355
|
try {
|
|
14325
|
-
const db = new
|
|
14356
|
+
const db = new Database4(dbPath, { readonly: true });
|
|
14326
14357
|
try {
|
|
14327
14358
|
const rows = db.prepare(`
|
|
14328
14359
|
SELECT s.symbol_id, s.name, s.kind, s.fqn
|
|
@@ -14561,6 +14592,11 @@ var FederationManager = class {
|
|
|
14561
14592
|
}
|
|
14562
14593
|
}
|
|
14563
14594
|
}
|
|
14595
|
+
if (contracts.length === 0) {
|
|
14596
|
+
const dbPath = getDbPath(serviceRoot);
|
|
14597
|
+
const fromDb = extractRoutesFromDb(dbPath);
|
|
14598
|
+
if (fromDb) contracts.push(fromDb);
|
|
14599
|
+
}
|
|
14564
14600
|
for (const contract of contracts) {
|
|
14565
14601
|
const contractId = this.topoStore.insertContract(serviceId, {
|
|
14566
14602
|
contractType: contract.type,
|
|
@@ -14680,7 +14716,14 @@ var FederationManager = class {
|
|
|
14680
14716
|
for (const call of linkedCalls) {
|
|
14681
14717
|
const targetEndpoint = this.topoStore.getAllEndpoints().find((e) => e.id === call.matched_endpoint_id);
|
|
14682
14718
|
if (!targetEndpoint) continue;
|
|
14683
|
-
const
|
|
14719
|
+
const repoRoot = repo.repo_root.endsWith("/") ? repo.repo_root : `${repo.repo_root}/`;
|
|
14720
|
+
const callPath = call.file_path.startsWith("/") ? call.file_path : `/${call.file_path}`;
|
|
14721
|
+
const candidates = services.filter((s) => {
|
|
14722
|
+
if (s.repo_root === repo.repo_root) return true;
|
|
14723
|
+
const svcRoot = s.repo_root.endsWith("/") ? s.repo_root : `${s.repo_root}/`;
|
|
14724
|
+
return callPath.startsWith(svcRoot) || call.file_path.startsWith(svcRoot);
|
|
14725
|
+
});
|
|
14726
|
+
const sourceService = candidates.sort((a, b) => b.repo_root.length - a.repo_root.length)[0];
|
|
14684
14727
|
if (!sourceService || sourceService.id === targetEndpoint.service_id) continue;
|
|
14685
14728
|
this.topoStore.insertCrossServiceEdge({
|
|
14686
14729
|
sourceServiceId: sourceService.id,
|
|
@@ -29360,7 +29403,7 @@ function registerAITools(server, ctx) {
|
|
|
29360
29403
|
}
|
|
29361
29404
|
|
|
29362
29405
|
// src/bundles.ts
|
|
29363
|
-
import
|
|
29406
|
+
import Database5 from "better-sqlite3";
|
|
29364
29407
|
import path51 from "path";
|
|
29365
29408
|
import fs42 from "fs";
|
|
29366
29409
|
import crypto5 from "crypto";
|
|
@@ -29391,9 +29434,9 @@ function saveManifest(manifest) {
|
|
|
29391
29434
|
function exportBundle(sourceDbPath, packageName, version) {
|
|
29392
29435
|
ensureBundlesDir();
|
|
29393
29436
|
const bundlePath = getBundlePath(packageName, version);
|
|
29394
|
-
const src = new
|
|
29437
|
+
const src = new Database5(sourceDbPath, { readonly: true });
|
|
29395
29438
|
if (fs42.existsSync(bundlePath)) fs42.unlinkSync(bundlePath);
|
|
29396
|
-
const dst = new
|
|
29439
|
+
const dst = new Database5(bundlePath);
|
|
29397
29440
|
dst.pragma("journal_mode = WAL");
|
|
29398
29441
|
dst.pragma("synchronous = OFF");
|
|
29399
29442
|
dst.exec(`
|
|
@@ -29575,7 +29618,7 @@ function loadBundle(packageName, version) {
|
|
|
29575
29618
|
const bundlePath = getBundlePath(packageName, version);
|
|
29576
29619
|
if (!fs42.existsSync(bundlePath)) return null;
|
|
29577
29620
|
try {
|
|
29578
|
-
const db = new
|
|
29621
|
+
const db = new Database5(bundlePath, { readonly: true });
|
|
29579
29622
|
return { package: packageName, version, db };
|
|
29580
29623
|
} catch (e) {
|
|
29581
29624
|
logger.warn({ package: packageName, version, error: e }, "Failed to load bundle");
|
|
@@ -29626,7 +29669,7 @@ function searchBundles(bundles, query, opts = {}) {
|
|
|
29626
29669
|
}
|
|
29627
29670
|
|
|
29628
29671
|
// src/analytics/analytics-store.ts
|
|
29629
|
-
import
|
|
29672
|
+
import Database6 from "better-sqlite3";
|
|
29630
29673
|
import path52 from "path";
|
|
29631
29674
|
var ANALYTICS_DB_PATH = path52.join(TRACE_MCP_HOME, "analytics.db");
|
|
29632
29675
|
var SCHEMA_SQL = `
|
|
@@ -29676,7 +29719,7 @@ var AnalyticsStore = class {
|
|
|
29676
29719
|
constructor(dbPath) {
|
|
29677
29720
|
ensureGlobalDirs();
|
|
29678
29721
|
const p5 = dbPath ?? ANALYTICS_DB_PATH;
|
|
29679
|
-
this.db = new
|
|
29722
|
+
this.db = new Database6(p5);
|
|
29680
29723
|
this.db.pragma("journal_mode = WAL");
|
|
29681
29724
|
this.db.pragma("foreign_keys = OFF");
|
|
29682
29725
|
this.db.exec(SCHEMA_SQL);
|
|
@@ -32663,7 +32706,7 @@ function registerSessionTools(server, ctx) {
|
|
|
32663
32706
|
}
|
|
32664
32707
|
|
|
32665
32708
|
// src/topology/topology-db.ts
|
|
32666
|
-
import
|
|
32709
|
+
import Database7 from "better-sqlite3";
|
|
32667
32710
|
var TOPOLOGY_DDL = `
|
|
32668
32711
|
CREATE TABLE IF NOT EXISTS services (
|
|
32669
32712
|
id INTEGER PRIMARY KEY,
|
|
@@ -32813,7 +32856,7 @@ function findBestEndpointMatch(urlPattern, method, endpoints) {
|
|
|
32813
32856
|
var TopologyStore = class {
|
|
32814
32857
|
db;
|
|
32815
32858
|
constructor(dbPath) {
|
|
32816
|
-
this.db = new
|
|
32859
|
+
this.db = new Database7(dbPath);
|
|
32817
32860
|
this.db.pragma("journal_mode = WAL");
|
|
32818
32861
|
this.db.pragma("foreign_keys = ON");
|
|
32819
32862
|
this.db.pragma("busy_timeout = 5000");
|
|
@@ -33169,7 +33212,7 @@ var TopologyStore = class {
|
|
|
33169
33212
|
};
|
|
33170
33213
|
|
|
33171
33214
|
// src/server/server.ts
|
|
33172
|
-
var PKG_VERSION = true ? "1.14.
|
|
33215
|
+
var PKG_VERSION = true ? "1.14.1" : "0.0.0-dev";
|
|
33173
33216
|
function j2(value) {
|
|
33174
33217
|
return JSON.stringify(value, (_key, val) => val === null || val === void 0 ? void 0 : val);
|
|
33175
33218
|
}
|
|
@@ -65925,7 +65968,7 @@ function installTweakccPrompts(opts) {
|
|
|
65925
65968
|
import fs93 from "fs";
|
|
65926
65969
|
import path103 from "path";
|
|
65927
65970
|
import os10 from "os";
|
|
65928
|
-
import
|
|
65971
|
+
import Database8 from "better-sqlite3";
|
|
65929
65972
|
var HOME3 = os10.homedir();
|
|
65930
65973
|
function detectProject(dir) {
|
|
65931
65974
|
const projectRoot = path103.resolve(dir);
|
|
@@ -66109,7 +66152,7 @@ function detectExistingDb(root, globalDbPath) {
|
|
|
66109
66152
|
const dbPath = candidates.find((p5) => fs93.existsSync(p5));
|
|
66110
66153
|
if (!dbPath) return null;
|
|
66111
66154
|
try {
|
|
66112
|
-
const db = new
|
|
66155
|
+
const db = new Database8(dbPath, { readonly: true });
|
|
66113
66156
|
const versionRow = db.prepare("SELECT value FROM schema_meta WHERE key = ?").get("schema_version");
|
|
66114
66157
|
const schemaVersion = versionRow ? parseInt(versionRow.value, 10) : 0;
|
|
66115
66158
|
const countRow = db.prepare("SELECT COUNT(*) as cnt FROM files").get();
|
|
@@ -69888,7 +69931,7 @@ function shortPath6(p5) {
|
|
|
69888
69931
|
// src/cli/status.ts
|
|
69889
69932
|
import { Command as Command11 } from "commander";
|
|
69890
69933
|
import fs103 from "fs";
|
|
69891
|
-
import
|
|
69934
|
+
import Database9 from "better-sqlite3";
|
|
69892
69935
|
function resolveDbPath5(projectRoot) {
|
|
69893
69936
|
const entry = getProject(projectRoot);
|
|
69894
69937
|
if (entry) return entry.dbPath;
|
|
@@ -69937,7 +69980,7 @@ var statusCommand = new Command11("status").description("Show indexing progress
|
|
|
69937
69980
|
console.log("Run `trace-mcp serve` or `trace-mcp index` first.");
|
|
69938
69981
|
process.exit(1);
|
|
69939
69982
|
}
|
|
69940
|
-
const db = new
|
|
69983
|
+
const db = new Database9(dbPath, { readonly: true });
|
|
69941
69984
|
db.pragma("journal_mode = WAL");
|
|
69942
69985
|
try {
|
|
69943
69986
|
const progress = readProgressFromDb(db);
|
|
@@ -70050,7 +70093,7 @@ visualizeCommand.command("federation").alias("fed").description("Open federation
|
|
|
70050
70093
|
});
|
|
70051
70094
|
|
|
70052
70095
|
// src/cli.ts
|
|
70053
|
-
var PKG_VERSION2 = true ? "1.14.
|
|
70096
|
+
var PKG_VERSION2 = true ? "1.14.1" : "0.0.0-dev";
|
|
70054
70097
|
function registerDefaultPlugins(registry) {
|
|
70055
70098
|
for (const p5 of createAllLanguagePlugins()) registry.registerLanguagePlugin(p5);
|
|
70056
70099
|
for (const p5 of createAllIntegrationPlugins()) registry.registerFrameworkPlugin(p5);
|