evrex-mcp 0.2.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -433,6 +433,12 @@ function toRepoRelative(filePath, root) {
433
433
  }
434
434
  return filePath;
435
435
  }
436
+ function sameFileRef(a, b) {
437
+ if (a === b) return true;
438
+ if (a.endsWith(`/${b}`)) return true;
439
+ if (b.endsWith(`/${a}`)) return true;
440
+ return false;
441
+ }
436
442
  async function resolveRepos() {
437
443
  const override = process.env.EVREX_REPO_PATH;
438
444
  if (override) {
@@ -458,9 +464,14 @@ async function evrexWhy(filePath, question) {
458
464
  const sessions = (await Promise.all(sessionIds.map((id) => evrexApi.session(id)))).filter(
459
465
  (s) => s !== null
460
466
  );
461
- const rejected = sessions.flatMap((s) => s.rejected).slice(0, MAX_ITEMS);
462
- const constraints = sessions.flatMap((s) => s.constraints).slice(0, MAX_ITEMS);
463
- const decisions = sessions.flatMap((s) => s.decisions).slice(0, MAX_ITEMS);
467
+ const target = isAbsolute(filePath) ? toRepoRelative(filePath, root) : filePath;
468
+ const aboutTarget = (item) => (item.files ?? []).some((f) => sameFileRef(toRepoRelative(f, root), target));
469
+ const byRelevance = (items) => [...items].sort(
470
+ (a, b) => Number(aboutTarget(b)) - Number(aboutTarget(a))
471
+ );
472
+ const rejected = byRelevance(sessions.flatMap((s) => s.rejected)).slice(0, MAX_ITEMS);
473
+ const constraints = byRelevance(sessions.flatMap((s) => s.constraints)).slice(0, MAX_ITEMS);
474
+ const decisions = byRelevance(sessions.flatMap((s) => s.decisions)).slice(0, MAX_ITEMS);
464
475
  const parts = [];
465
476
  const heuristic = sessions.some((s) => s.insightsSource === "heuristic");
466
477
  if (rejected.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evrex-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server that gives coding agents the recorded reasoning behind a repo: prior decisions, hard constraints, and approaches already rejected.",
5
5
  "keywords": [
6
6
  "mcp",