trace-mcp 1.6.0 → 1.6.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 CHANGED
@@ -5025,6 +5025,10 @@ function detectWorkspaces(rootPath) {
5025
5025
  function buildMultiRootWorkspaces(parentDir, childRoots) {
5026
5026
  const workspaces = [];
5027
5027
  for (const childRoot of childRoots) {
5028
+ if (!fs4.existsSync(childRoot)) {
5029
+ logger.warn({ childRoot }, "Skipping missing multi-root child directory");
5030
+ continue;
5031
+ }
5028
5032
  const relPath = path3.relative(parentDir, childRoot).replace(/\\/g, "/");
5029
5033
  const childName = path3.basename(childRoot);
5030
5034
  workspaces.push({ name: childName, path: relPath });
@@ -6312,12 +6316,15 @@ var FilePersister = class {
6312
6316
  }
6313
6317
  if (ext.symbols.length > 0) {
6314
6318
  const insertedIds = store.insertSymbols(fileId, ext.symbols);
6315
- const trigramBatch = ext.symbols.map((sym, i) => ({
6316
- id: insertedIds[i],
6317
- name: sym.name,
6318
- fqn: sym.fqn ?? null
6319
- }));
6320
- indexTrigramsBatch(store.db, trigramBatch);
6319
+ const trigramBySymbolId = /* @__PURE__ */ new Map();
6320
+ for (let i = 0; i < ext.symbols.length; i++) {
6321
+ trigramBySymbolId.set(ext.symbols[i].symbolId, {
6322
+ id: insertedIds[i],
6323
+ name: ext.symbols[i].name,
6324
+ fqn: ext.symbols[i].fqn ?? null
6325
+ });
6326
+ }
6327
+ indexTrigramsBatch(store.db, [...trigramBySymbolId.values()]);
6321
6328
  }
6322
6329
  if (ext.otherEdges.length > 0) this.storeRawEdges(ext.otherEdges);
6323
6330
  if (ext.importEdges.length > 0) {
@@ -6333,11 +6340,15 @@ var FilePersister = class {
6333
6340
  for (const fwResult of ext.frameworkExtracts) {
6334
6341
  if (fwResult.symbols.length > 0) {
6335
6342
  const fwIds = store.insertSymbols(fileId, fwResult.symbols);
6336
- indexTrigramsBatch(store.db, fwResult.symbols.map((sym, i) => ({
6337
- id: fwIds[i],
6338
- name: sym.name,
6339
- fqn: sym.fqn ?? null
6340
- })));
6343
+ const fwTrigramBySymbolId = /* @__PURE__ */ new Map();
6344
+ for (let i = 0; i < fwResult.symbols.length; i++) {
6345
+ fwTrigramBySymbolId.set(fwResult.symbols[i].symbolId, {
6346
+ id: fwIds[i],
6347
+ name: fwResult.symbols[i].name,
6348
+ fqn: fwResult.symbols[i].fqn ?? null
6349
+ });
6350
+ }
6351
+ indexTrigramsBatch(store.db, [...fwTrigramBySymbolId.values()]);
6341
6352
  }
6342
6353
  if (fwResult.edges?.length) {
6343
6354
  this.storeRawEdges(fwResult.edges);
@@ -29873,7 +29884,7 @@ function registerSessionTools(server, ctx) {
29873
29884
  }
29874
29885
 
29875
29886
  // src/server/server.ts
29876
- var PKG_VERSION = true ? "1.6.0" : "0.0.0-dev";
29887
+ var PKG_VERSION = true ? "1.6.1" : "0.0.0-dev";
29877
29888
  function j2(value) {
29878
29889
  return JSON.stringify(value, (_key, val) => val === null || val === void 0 ? void 0 : val);
29879
29890
  }
@@ -58308,21 +58319,25 @@ var initCommand = new Command("init").description("One-time global setup: config
58308
58319
  steps.push({ target: proj.root, action: "skipped", detail: "Config load failed" });
58309
58320
  continue;
58310
58321
  }
58311
- const dbPath = getDbPath(proj.root);
58312
- const db = initializeDatabase(dbPath);
58313
- const store = new Store(db);
58314
- const registry = new PluginRegistry();
58315
- for (const lp of createAllLanguagePlugins()) registry.registerLanguagePlugin(lp);
58316
- for (const fp of createAllIntegrationPlugins()) registry.registerFrameworkPlugin(fp);
58317
- const pipeline = new IndexingPipeline(store, registry, configResult.value, proj.root);
58318
- const result = await pipeline.indexAll(true);
58319
- steps.push({
58320
- target: proj.root,
58321
- action: "updated",
58322
- detail: `Upgraded: ${result.indexed} files, ${result.skipped} skipped, ${result.errors} errors`
58323
- });
58324
- updateLastIndexed(proj.root);
58325
- db.close();
58322
+ try {
58323
+ const dbPath = getDbPath(proj.root);
58324
+ const db = initializeDatabase(dbPath);
58325
+ const store = new Store(db);
58326
+ const registry = new PluginRegistry();
58327
+ for (const lp of createAllLanguagePlugins()) registry.registerLanguagePlugin(lp);
58328
+ for (const fp of createAllIntegrationPlugins()) registry.registerFrameworkPlugin(fp);
58329
+ const pipeline = new IndexingPipeline(store, registry, configResult.value, proj.root);
58330
+ const result = await pipeline.indexAll(true);
58331
+ steps.push({
58332
+ target: proj.root,
58333
+ action: "updated",
58334
+ detail: `Upgraded: ${result.indexed} files, ${result.skipped} skipped, ${result.errors} errors`
58335
+ });
58336
+ updateLastIndexed(proj.root);
58337
+ db.close();
58338
+ } catch (err32) {
58339
+ steps.push({ target: proj.root, action: "skipped", detail: `Upgrade failed: ${err32.message}` });
58340
+ }
58326
58341
  }
58327
58342
  spin?.stop("Upgrade complete");
58328
58343
  }
@@ -58520,29 +58535,34 @@ var upgradeCommand = new Command2("upgrade").description("Upgrade trace-mcp: run
58520
58535
  const dbPath = getDbPath(projectRoot);
58521
58536
  ensureGlobalDirs();
58522
58537
  if (!opts.dryRun) {
58523
- const db = initializeDatabase(dbPath);
58524
- const store = new Store(db);
58525
- const versionRow = db.prepare("SELECT value FROM schema_meta WHERE key = ?").get("schema_version");
58526
- const currentVersion = versionRow ? parseInt(versionRow.value, 10) : 0;
58527
- steps.push({
58528
- target: dbPath,
58529
- action: "updated",
58530
- detail: `Schema v${currentVersion}`
58531
- });
58532
- if (!opts.skipReindex) {
58533
- const registry = new PluginRegistry();
58534
- for (const p4 of createAllLanguagePlugins()) registry.registerLanguagePlugin(p4);
58535
- for (const p4 of createAllIntegrationPlugins()) registry.registerFrameworkPlugin(p4);
58536
- const pipeline = new IndexingPipeline(store, registry, config, projectRoot);
58537
- const result = await pipeline.indexAll(true);
58538
+ try {
58539
+ const db = initializeDatabase(dbPath);
58540
+ const store = new Store(db);
58541
+ const versionRow = db.prepare("SELECT value FROM schema_meta WHERE key = ?").get("schema_version");
58542
+ const currentVersion = versionRow ? parseInt(versionRow.value, 10) : 0;
58538
58543
  steps.push({
58539
- target: projectRoot,
58544
+ target: dbPath,
58540
58545
  action: "updated",
58541
- detail: `Reindexed: ${result.indexed} files, ${result.skipped} skipped, ${result.errors} errors`
58546
+ detail: `Schema v${currentVersion}`
58542
58547
  });
58543
- updateLastIndexed(projectRoot);
58548
+ if (!opts.skipReindex) {
58549
+ const registry = new PluginRegistry();
58550
+ for (const p4 of createAllLanguagePlugins()) registry.registerLanguagePlugin(p4);
58551
+ for (const p4 of createAllIntegrationPlugins()) registry.registerFrameworkPlugin(p4);
58552
+ const pipeline = new IndexingPipeline(store, registry, config, projectRoot);
58553
+ const result = await pipeline.indexAll(true);
58554
+ steps.push({
58555
+ target: projectRoot,
58556
+ action: "updated",
58557
+ detail: `Reindexed: ${result.indexed} files, ${result.skipped} skipped, ${result.errors} errors`
58558
+ });
58559
+ updateLastIndexed(projectRoot);
58560
+ }
58561
+ db.close();
58562
+ } catch (err32) {
58563
+ logger.error({ error: err32.message, project: projectRoot }, "Upgrade failed");
58564
+ steps.push({ target: projectRoot, action: "skipped", detail: `Upgrade failed: ${err32.message}` });
58544
58565
  }
58545
- db.close();
58546
58566
  } else {
58547
58567
  steps.push({ target: dbPath, action: "skipped", detail: "Would run migrations" });
58548
58568
  if (!opts.skipReindex) {
@@ -59909,7 +59929,7 @@ analyticsCommand.command("trends").description("Show daily usage trends: tokens,
59909
59929
  });
59910
59930
 
59911
59931
  // src/cli.ts
59912
- var PKG_VERSION2 = true ? "1.6.0" : "0.0.0-dev";
59932
+ var PKG_VERSION2 = true ? "1.6.1" : "0.0.0-dev";
59913
59933
  function registerDefaultPlugins(registry) {
59914
59934
  for (const p4 of createAllLanguagePlugins()) registry.registerLanguagePlugin(p4);
59915
59935
  for (const p4 of createAllIntegrationPlugins()) registry.registerFrameworkPlugin(p4);