@merittdev/horus 0.21.3 → 0.21.5

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.
Binary file
package/dist/index.cjs CHANGED
@@ -3057,7 +3057,7 @@ var init_version = __esm({
3057
3057
  "../../packages/core/src/version.ts"() {
3058
3058
  "use strict";
3059
3059
  init_cjs_shims();
3060
- HORUS_VERSION = true ? "0.21.3" : "dev";
3060
+ HORUS_VERSION = true ? "0.21.5" : "dev";
3061
3061
  PINNED_SOURCE_VERSION = HORUS_VERSION;
3062
3062
  SOURCE_PIN_ENFORCED = HORUS_VERSION !== "dev";
3063
3063
  }
@@ -72464,7 +72464,7 @@ var SourceCodeProvider = class {
72464
72464
  kind = "code";
72465
72465
  // --- helpers -------------------------------------------------------------
72466
72466
  nodeToSymbol(n4) {
72467
- return {
72467
+ const sym = {
72468
72468
  id: n4.id,
72469
72469
  name: n4.name,
72470
72470
  filePath: n4.filePath,
@@ -72474,6 +72474,8 @@ var SourceCodeProvider = class {
72474
72474
  language: n4.language,
72475
72475
  className: n4.className
72476
72476
  };
72477
+ if (n4.aliasOf) sym.aliasOf = n4.aliasOf;
72478
+ return sym;
72477
72479
  }
72478
72480
  /** Map a serialized graph node to a `Symbol`, coercing the host's `0` line sentinel to undefined. */
72479
72481
  serializedToSymbol(n4) {
@@ -72487,6 +72489,7 @@ var SourceCodeProvider = class {
72487
72489
  if (n4.className) sym.className = n4.className;
72488
72490
  if (n4.signature) sym.signature = n4.signature;
72489
72491
  if (n4.language) sym.language = n4.language;
72492
+ if (n4.aliasOf) sym.aliasOf = n4.aliasOf;
72490
72493
  return sym;
72491
72494
  }
72492
72495
  /**
@@ -97563,10 +97566,15 @@ function isDeprioritizedSeedPath(filePath) {
97563
97566
  function isDeprioritizedSeed(s5) {
97564
97567
  return isDeprioritizedSeedPath(s5.filePath) || isCodegenPath(s5.filePath) || isTypeDeclarationSymbol(s5);
97565
97568
  }
97569
+ function isDeclarationFile(filePath) {
97570
+ return /\.d\.[cm]?ts$/i.test(filePath);
97571
+ }
97566
97572
  function productTier(candidates, includeTests = false) {
97567
97573
  if (includeTests) return candidates;
97568
97574
  const product = candidates.filter((s5) => !isDeprioritizedSeedPath(s5.filePath));
97569
- return product.length > 0 ? product : candidates;
97575
+ const pool = product.length > 0 ? product : candidates;
97576
+ const impl = pool.filter((s5) => !isDeclarationFile(s5.filePath));
97577
+ return impl.length > 0 ? impl : pool;
97570
97578
  }
97571
97579
  function isAnchoredExactSeed(s5, qualifier, hintHasCode, preferNamed) {
97572
97580
  if (qualifier && qualifierBoost(s5, qualifier) >= 40) return true;
@@ -97599,7 +97607,7 @@ function scoreExactCandidate(query, symbol, includeTests) {
97599
97607
  if (!includeTests && isDeprioritizedSeedPath(symbol.filePath) || isCodegenPath(symbol.filePath)) {
97600
97608
  score -= 6;
97601
97609
  }
97602
- if (/\.d\.[cm]?ts$/i.test(symbol.filePath)) score -= 3;
97610
+ if (isDeclarationFile(symbol.filePath)) score -= 3;
97603
97611
  const loc = (symbol.endLine ?? 0) - (symbol.startLine ?? 0);
97604
97612
  if (loc > 0) score += Math.min(4, Math.log2(loc + 1));
97605
97613
  return score;
@@ -97622,6 +97630,16 @@ function parseSymbolQuery(query) {
97622
97630
  if (container.length < 2 || m5[2].length < 2) return null;
97623
97631
  return { symbol: m5[2], container, isPath: false };
97624
97632
  }
97633
+ function redirectExportAlias(candidates) {
97634
+ const head = candidates[0];
97635
+ if (head === void 0 || head.aliasOf === void 0 || head.aliasOf === "") return candidates;
97636
+ const implName = head.aliasOf.toLowerCase();
97637
+ const impl = candidates.find(
97638
+ (s5) => s5.id !== head.id && s5.name.toLowerCase() === implName && s5.filePath === head.filePath
97639
+ ) ?? candidates.find((s5) => s5.id !== head.id && s5.name.toLowerCase() === implName);
97640
+ if (impl === void 0) return candidates;
97641
+ return [impl, ...candidates.filter((s5) => s5.id !== impl.id)];
97642
+ }
97625
97643
  function resolveSymbolQuery(query, symbols, opts) {
97626
97644
  const includeTests = opts?.includeTests === true;
97627
97645
  const qualifier = parseSymbolQuery(query);
@@ -97645,7 +97663,10 @@ function resolveSymbolQuery(query, symbols, opts) {
97645
97663
  const ambiguous = kind !== "fuzzy" && kind !== "none" && first !== void 0 && second !== void 0 && first.score === second.score && first.symbol.filePath !== second.symbol.filePath;
97646
97664
  return {
97647
97665
  kind,
97648
- candidates: [...scoredTier.map((s5) => s5.symbol), ...rest],
97666
+ // B2: redirect a public export-alias hit (`Component` → `BaseComponent`) to the
97667
+ // implementation so explain/blast-radius/search land on real product code, not the
97668
+ // empty alias stub. No-op unless the head candidate carries `aliasOf`.
97669
+ candidates: redirectExportAlias([...scoredTier.map((s5) => s5.symbol), ...rest]),
97649
97670
  ambiguous,
97650
97671
  qualifier
97651
97672
  };
@@ -97659,7 +97680,16 @@ async function resolveSeedSymbol(code, query, opts) {
97659
97680
  const seen = new Set(pool.map((s5) => s5.id));
97660
97681
  for (const s5 of extra) if (!seen.has(s5.id)) pool.push(s5);
97661
97682
  }
97662
- return resolveSymbolQuery(query, pool, { includeTests: opts?.includeTests ?? false });
97683
+ const includeTests = opts?.includeTests ?? false;
97684
+ let resolution = resolveSymbolQuery(query, pool, { includeTests });
97685
+ const head = resolution.candidates[0];
97686
+ if (head?.aliasOf !== void 0 && head.aliasOf !== "" && !pool.some((s5) => s5.id !== head.id && s5.name.toLowerCase() === head.aliasOf.toLowerCase())) {
97687
+ const implHits = await code.searchSymbols(head.aliasOf, Math.max(limit, 20));
97688
+ const seen = new Set(pool.map((s5) => s5.id));
97689
+ for (const s5 of implHits) if (!seen.has(s5.id)) pool.push(s5);
97690
+ resolution = resolveSymbolQuery(query, pool, { includeTests });
97691
+ }
97692
+ return resolution;
97663
97693
  }
97664
97694
  function rankSeeds(seeds, hintTokens, changedFiles, hintHasCode, qualifier, preferNamed) {
97665
97695
  const scored = seeds.map((symbol, i3) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merittdev/horus",
3
- "version": "0.21.3",
3
+ "version": "0.21.5",
4
4
  "description": "Local-first, source-aware production-incident investigation engine",
5
5
  "type": "module",
6
6
  "bin": {