terminalhire 0.13.0 → 0.14.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.
@@ -552,6 +552,31 @@ function normalize(tokens) {
552
552
  }
553
553
  return Array.from(result);
554
554
  }
555
+ function getAdjacentTags(tag, hops = 1, graph = GRAPH) {
556
+ const lower = String(tag ?? "").toLowerCase().trim();
557
+ const id = graph.ids.has(lower) ? lower : graph.synonyms.get(lower);
558
+ if (!id) return [];
559
+ const oneHop = (source) => {
560
+ const out = [];
561
+ for (const [to, edge] of graph.closure.get(source) ?? []) {
562
+ if (edge.via === to) out.push([to, edge.w]);
563
+ }
564
+ return out;
565
+ };
566
+ const byWeightThenId = (a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1);
567
+ const ring1 = oneHop(id).sort(byWeightThenId);
568
+ if (hops === 1) return ring1.map(([to]) => to);
569
+ const exclude = /* @__PURE__ */ new Set([id, ...ring1.map(([to]) => to)]);
570
+ const best = /* @__PURE__ */ new Map();
571
+ for (const [n, w1] of ring1) {
572
+ for (const [to, w2] of oneHop(n)) {
573
+ if (exclude.has(to)) continue;
574
+ const w = w1 * w2;
575
+ if (w > (best.get(to) ?? 0)) best.set(to, w);
576
+ }
577
+ }
578
+ return [...best.entries()].sort(byWeightThenId).map(([to]) => to);
579
+ }
555
580
  function expandWeighted(tags, graph = GRAPH) {
556
581
  const out = /* @__PURE__ */ new Map();
557
582
  const put = (tag, weight, via) => {
@@ -6346,6 +6371,7 @@ __export(src_exports, {
6346
6371
  flattenTiers: () => flattenTiers,
6347
6372
  funnelCounts: () => funnelCounts,
6348
6373
  generateIdentityKeypair: () => generateIdentityKeypair,
6374
+ getAdjacentTags: () => getAdjacentTags,
6349
6375
  getBuyer: () => getBuyer,
6350
6376
  githubBounties: () => githubBounties,
6351
6377
  githubToFingerprint: () => githubToFingerprint,
@@ -552,6 +552,31 @@ function normalize(tokens) {
552
552
  }
553
553
  return Array.from(result);
554
554
  }
555
+ function getAdjacentTags(tag, hops = 1, graph = GRAPH) {
556
+ const lower = String(tag ?? "").toLowerCase().trim();
557
+ const id = graph.ids.has(lower) ? lower : graph.synonyms.get(lower);
558
+ if (!id) return [];
559
+ const oneHop = (source) => {
560
+ const out = [];
561
+ for (const [to, edge] of graph.closure.get(source) ?? []) {
562
+ if (edge.via === to) out.push([to, edge.w]);
563
+ }
564
+ return out;
565
+ };
566
+ const byWeightThenId = (a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1);
567
+ const ring1 = oneHop(id).sort(byWeightThenId);
568
+ if (hops === 1) return ring1.map(([to]) => to);
569
+ const exclude = /* @__PURE__ */ new Set([id, ...ring1.map(([to]) => to)]);
570
+ const best = /* @__PURE__ */ new Map();
571
+ for (const [n, w1] of ring1) {
572
+ for (const [to, w2] of oneHop(n)) {
573
+ if (exclude.has(to)) continue;
574
+ const w = w1 * w2;
575
+ if (w > (best.get(to) ?? 0)) best.set(to, w);
576
+ }
577
+ }
578
+ return [...best.entries()].sort(byWeightThenId).map(([to]) => to);
579
+ }
555
580
  function expandWeighted(tags, graph = GRAPH) {
556
581
  const out = /* @__PURE__ */ new Map();
557
582
  const put = (tag, weight, via) => {
@@ -6346,6 +6371,7 @@ __export(src_exports, {
6346
6371
  flattenTiers: () => flattenTiers,
6347
6372
  funnelCounts: () => funnelCounts,
6348
6373
  generateIdentityKeypair: () => generateIdentityKeypair,
6374
+ getAdjacentTags: () => getAdjacentTags,
6349
6375
  getBuyer: () => getBuyer,
6350
6376
  githubBounties: () => githubBounties,
6351
6377
  githubToFingerprint: () => githubToFingerprint,