@virsanghavi/axis-server 1.7.0 → 1.7.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.
@@ -1426,11 +1426,18 @@ async function searchFile(filePath, rootDir, keywords) {
1426
1426
  const relativePath = path3.relative(rootDir, filePath);
1427
1427
  const matchedKeywords = keywords.filter((kw) => contentLower.includes(kw));
1428
1428
  if (matchedKeywords.length === 0) return null;
1429
+ const coverage = matchedKeywords.length / keywords.length;
1430
+ if (keywords.length >= 3 && coverage < 0.4) return null;
1431
+ if (keywords.length === 2 && matchedKeywords.length < 1) return null;
1429
1432
  const lines = content.split("\n");
1430
- let score = matchedKeywords.length;
1433
+ let score = coverage * coverage * matchedKeywords.length;
1431
1434
  const relLower = relativePath.toLowerCase();
1435
+ let pathMatches = 0;
1432
1436
  for (const kw of keywords) {
1433
- if (relLower.includes(kw)) score += 2;
1437
+ if (relLower.includes(kw)) {
1438
+ score += 3;
1439
+ pathMatches++;
1440
+ }
1434
1441
  }
1435
1442
  const matchingLineIndices = [];
1436
1443
  for (let i = 0; i < lines.length; i++) {
@@ -1439,6 +1446,22 @@ async function searchFile(filePath, rootDir, keywords) {
1439
1446
  matchingLineIndices.push(i);
1440
1447
  }
1441
1448
  }
1449
+ let proximityBonus = 0;
1450
+ for (let i = 0; i < matchingLineIndices.length; i++) {
1451
+ const windowStart = matchingLineIndices[i];
1452
+ const windowEnd = windowStart + 10;
1453
+ const keywordsInWindow = /* @__PURE__ */ new Set();
1454
+ for (let j = i; j < matchingLineIndices.length && matchingLineIndices[j] <= windowEnd; j++) {
1455
+ const lineLower = lines[matchingLineIndices[j]].toLowerCase();
1456
+ for (const kw of matchedKeywords) {
1457
+ if (lineLower.includes(kw)) keywordsInWindow.add(kw);
1458
+ }
1459
+ }
1460
+ if (keywordsInWindow.size >= 2) {
1461
+ proximityBonus = Math.max(proximityBonus, keywordsInWindow.size * 1.5);
1462
+ }
1463
+ }
1464
+ score += proximityBonus;
1442
1465
  score += Math.min(matchingLineIndices.length, 20) * 0.1;
1443
1466
  const regions = [];
1444
1467
  let lastEnd = -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virsanghavi/axis-server",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Axis MCP Server CLI",
5
5
  "main": "dist/index.js",
6
6
  "bin": {